diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index e36a16609a2..ecea87c86d3 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,3 @@ # These are supported funding model platforms - +github: plotly custom: https://plot.ly/products/consulting-and-oem/ diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 142eb02c06b..8ce0abc990c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,20 +2,17 @@ Thanks for your interest in plotly.js! ### Translations: -- Make a PR directly to the main repository - Please @ mention a few other speakers of this language who can help review your translations. - If you've omitted any keys from [dist/translation_keys.txt](https://github.com/plotly/plotly.js/blob/master/dist/translation-keys.txt) - which means they will fall back on the US English text - just make a short comment about why in the PR description: the English text works fine in your language, or you would like someone else to help translating those, or whatever the reason. - You should only update files in `lib/locales/`, not those in `dist/` ### Features, Bug fixes, and others: -Developers are strongly encouraged to first make a PR to their own plotly.js fork and ask one of the maintainers to review the modifications there. Once the pull request is deemed satisfactory, the developer will be asked to make a pull request to the main plotly.js repo and may be asked to squash some commits before doing so. - -Before opening a pull request, developer should: +Before opening a pull request, developer should: - `git rebase` their local branch off the latest `master`, - make sure to **not** `git add` the `dist/` folder (the `dist/` is updated only on version bumps), -- make sure to commit changes to the `package-lock.json` file (if any), +- make sure to commit changes to the `package-lock.json` file (if any new dependency required), - write an overview of what the PR attempts to do, - select the _Allow edits from maintainers_ option (see this [article](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) for more details). diff --git a/.gitignore b/.gitignore index 0f7e76037ad..f4c03139eec 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ build/* npm-debug.log* *.sublime* +*~ +tags .* !.circleci diff --git a/CHANGELOG.md b/CHANGELOG.md index f12960c3c28..ccf78caf9aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,99 @@ To see all merged commits on the master branch that will be part of the next plo where X.Y.Z is the semver of most recent plotly.js release. +## [1.58.0] -- 2020-12-02 + +### Added + - Add `ticklabelposition` attribute to cartesian axes and colorbars [#5275], + this feature was anonymously sponsored: thank you to our sponsor! + - Add "strict" `autotypenumbers` to axes and `layout` [#5240] + - Add `itemwidth` to legends [#5212], + with thanks to @s417-lama for the contribution! + - Add `root.color` attribute to `sunburst` and `treemap` traces [#5232, #5245], + with thanks to @thierryVergult for the contribution! + +### Changed + - Enable fast `image` rendering for all linear axes [#5307], + with thanks to @almarklein for the contribution! + - Rework `matches` and `scaleanchor` so they work together [#5287] + +### Fixed + - Fix hover on mobile and tablet devices for gl3d subplots [#5239] + (regression introduced in 1.34.0), with thanks to @jdpaterson for the contribution! + - Fix interactions when static/dynamic CSS transforms e.g. scale and translate are applied to the + graph div or its parents [#5193, #5302], with thanks to @alexhartstone for the contribution! + - Fix reordering of mapbox raster and image layers on update [#5269] + - Fix `categoryorder` for missing values in cartesian traces [#5268] + - Fix `automargin` bug to provide space for long axis labels [#5237] + - Avoid styling of backgrounds during `automargin` redraws [#5236] + - Fix displaying zero length bars with `staticPlot` config option [#5294] + - Fix setting false locale to "en-US" [#5293] + - Fix typo in Czech locale file [#5255], + with thanks to @helb for the contribution! + - Fix `gl3d` scene initialization [#5233] + + +## [1.57.1] -- 2020-10-20 + +### Changed + - Update template for new pull requests [#5220] + - Provide a default `hovertemplate` label for attribute "base" in `bar` traces [#5216] + +### Fixed + - Fix `staticPlot` behaviour for `rangeslider` and `legend` [#5210], + with thanks to @miqh for the contribution! + - Fix `colorbar` react to new styles [#5217], + with thanks to @anaplian for the contribution! + - Fix `computed` margins when plot involves too many redraws [#5225] + - Fix build issue for Chart Studio Cloud (regression introduced in 1.56.0) [#5223] + + +## [1.57.0] -- 2020-10-15 + +### Added + - Introduce "domain" axis references in layout `images`, `shapes` and `annotations` [#5014] + - Add `rotation` attribute to `sunburst` traces [#5171, #5201], + with thanks to @thierryVergult for the contribution! + - Provide computed margins in "full-json" export [#5203], + this feature was anonymously sponsored: thank you to our sponsor! + +### Changed + - Mention the "full-json" option in the `Plotly.toImage` warning [#5204] + - Use current graph dimensions in `Plotly.downloadImage` [#5209] + +### Fixed + - Fix importing color modules for webpack users (regression introduced in 1.56.0) [#5189] + - Fix positioning ticks and labels on axes with `rangebreaks` and/or "period" `ticklabelmode` [#5187, #5208] + - Fix autorange computation when a category matches a range extreme [#5211], + with thanks to @LoganWlv for the contribution! + - Fix displaying modebar after `Plotly.restyle` [#5181], + with thanks to @Yook74 for the contribution! + + +## [1.56.0] -- 2020-09-30 + +### Added + - Introduce period positioning attributes on date axes in various cartesian traces [#5074, #5175], + this feature was anonymously sponsored: thank you to our sponsor! + - Add `minexponent` attribute to improve control over SI prefixes in axis tick labels [#5121], + with thanks to @ignamv for the contribution! + - Add `sort` attribute to `sunburst` and `treemap` traces to disable automatic sort [#5164], + with thanks to @thierryVergult for the contribution! + - Handle `rgba` colors in `colorscale` of `surface` traces [#5166], + with thanks to @lucapinello for the contribution! + +### Changed + - Disable undesirable text selections on graphs [#5165] + - Adjust `tick0` for weekly periods [#5180] + - More informative error messages when creating `sunburst` and `treemap` charts [#5163] + +### Fixed + - Fix positioning `legend` items [#5139], + with thanks to @fredrikw for the contribution! + - Fix rounding big numbers in `pie` and `sunburst` traces [#5152] + - Display `marker` and `line` colors in `scatter3d` and `scattergl` when hovering [#4867] + + ## [1.55.2] -- 2020-09-08 ### Fixed @@ -24,8 +117,10 @@ where X.Y.Z is the semver of most recent plotly.js release. ## [1.55.0] -- 2020-09-02 ### Added - - Introduce "period" `ticklabelmode` on cartesian date axes [#4993, #5055, #5060, #5065, #5088, #5089] - - Add new formatting options for weeks and quarters [#5026] + - Introduce "period" `ticklabelmode` on cartesian date axes [#4993, #5055, #5060, #5065, #5088, #5089], + this feature was anonymously sponsored: thank you to our sponsor! + - Add new formatting options for weeks and quarters [#5026], + this feature was anonymously sponsored: thank you to our sponsor! - Add `source` attribute to `image` traces for fast rendering [#5075] - Add `zsmooth` attribute for discrete `heatmapgl` traces [#4953], with thanks to @ordiology for the contribution! - Add horizontal and vertical markers for arrow charts [#5010] @@ -155,8 +250,10 @@ where X.Y.Z is the semver of most recent plotly.js release. ### Added - Introduce `rangebreaks` on date axes mainly thanks to [#4614] with API revision & improvements in - [#4639, #4641, #4644, #4649, #4652, #4653, #4660, #4661, #4670, #4677, #4684, #4688, #4695, #4696, #4698, #4699] - - Introduce "(x|y) unified" `hovermode` [#4620, #4664, #4669, #4687] + [#4639, #4641, #4644, #4649, #4652, #4653, #4660, #4661, #4670, #4677, #4684, #4688, #4695, #4696, #4698, #4699], + this feature was anonymously sponsored: thank you to our sponsor! + - Introduce "(x|y) unified" `hovermode` [#4620, #4664, #4669, #4687], + this feature was anonymously sponsored: thank you to our sponsor! - Add "hovered data" mode to `spikesnap` [#4665] - Add "full-json" export format to `Plotly.toImage` and `Plotly.dowloadImage` [#4593] - Add `node.customdata` and `link.customdata` to `sankey` traces [#4621] diff --git a/README.md b/README.md index ba95b4385e3..3325fac3f7a 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Building instructions using `webpack`, `browserify` and other build frameworks a ## Bugs and feature requests -Have a bug or a feature request? Please [open a Github issue](https://github.com/plotly/plotly.js/issues/new) keeping in mind the [issue guidelines](https://github.com/plotly/plotly.js/blob/master/.github/ISSUE_TEMPLATE.md). You may also want to read about [how changes get made to Plotly.js](https://github.com/plotly/plotly.js/blob/masterCONTRIBUTING.md) +Have a bug or a feature request? Please [open a Github issue](https://github.com/plotly/plotly.js/issues/new) keeping in mind the [issue guidelines](https://github.com/plotly/plotly.js/blob/master/.github/ISSUE_TEMPLATE.md). You may also want to read about [how changes get made to Plotly.js](https://github.com/plotly/plotly.js/blob/master/CONTRIBUTING.md) ## Documentation diff --git a/dist/README.md b/dist/README.md index c8357f910f1..07e79ca3e68 100644 --- a/dist/README.md +++ b/dist/README.md @@ -51,7 +51,7 @@ object. This property must be set before the plotly.js script tag, for example: Plotly.js defaults to US English (en-US) and includes British English (en) in the standard bundle. Many other localizations are available - here is an example using Swiss-German (de-CH), see the contents of this directory for the full list. -They are also available on our CDN as https://cdn.plot.ly/plotly-locale-de-ch-latest.js OR https://cdn.plot.ly/plotly-locale-de-ch-1.55.2.js +They are also available on our CDN as https://cdn.plot.ly/plotly-locale-de-ch-latest.js OR https://cdn.plot.ly/plotly-locale-de-ch-1.58.0.js Note that the file names are all lowercase, even though the region is uppercase when you apply a locale. *After* the plotly.js script tag, add: @@ -74,12 +74,12 @@ The main plotly.js bundle includes all the official (non-beta) trace modules. It be can imported as minified javascript - using dist file `dist/plotly.min.js` -- using CDN URL https://cdn.plot.ly/plotly-latest.min.js OR https://cdn.plot.ly/plotly-1.55.2.min.js +- using CDN URL https://cdn.plot.ly/plotly-latest.min.js OR https://cdn.plot.ly/plotly-1.58.0.min.js or as raw javascript: - using the `plotly.js-dist` npm package (starting in `v1.39.0`) - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-latest.js OR https://cdn.plot.ly/plotly-1.55.2.js +- using CDN URL https://cdn.plot.ly/plotly-latest.js OR https://cdn.plot.ly/plotly-1.58.0.js - using CommonJS with `require('plotly.js')` If you would like to have access to the attribute meta information (including attribute descriptions as on the [schema reference page](https://plotly.com/javascript/reference/)), use dist file `dist/plotly-with-meta.js` @@ -88,7 +88,7 @@ The main plotly.js bundle weights in at: | plotly.js | plotly.min.js | plotly.min.js + gzip | plotly-with-meta.js | |-----------|---------------|----------------------|---------------------| -| 7.1 MB | 3.3 MB | 997.5 kB | 7.4 MB | +| 7.2 MB | 3.3 MB | 1006.9 kB | 7.5 MB | ## Partial bundles @@ -114,7 +114,7 @@ The `basic` partial bundle contains trace modules `scatter`, `bar` and `pie`. | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.5 MB | 907.8 kB | 298.2 kB | +| 2.6 MB | 934.9 kB | 307.1 kB | #### CDN links @@ -122,8 +122,8 @@ The `basic` partial bundle contains trace modules `scatter`, `bar` and `pie`. | ------ | --- | | Latest | https://cdn.plot.ly/plotly-basic-latest.js | | Latest minified | https://cdn.plot.ly/plotly-basic-latest.min.js | -| Tagged | https://cdn.plot.ly/plotly-basic-1.55.2.js | -| Tagged minified | https://cdn.plot.ly/plotly-basic-1.55.2.min.js | +| Tagged | https://cdn.plot.ly/plotly-basic-1.58.0.js | +| Tagged minified | https://cdn.plot.ly/plotly-basic-1.58.0.min.js | #### npm package (starting in `v1.39.0`) @@ -167,7 +167,7 @@ The `cartesian` partial bundle contains trace modules `scatter`, `bar`, `box`, ` | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.9 MB | 1 MB | 350.6 kB | +| 3 MB | 1.1 MB | 360.8 kB | #### CDN links @@ -175,8 +175,8 @@ The `cartesian` partial bundle contains trace modules `scatter`, `bar`, `box`, ` | ------ | --- | | Latest | https://cdn.plot.ly/plotly-cartesian-latest.js | | Latest minified | https://cdn.plot.ly/plotly-cartesian-latest.min.js | -| Tagged | https://cdn.plot.ly/plotly-cartesian-1.55.2.js | -| Tagged minified | https://cdn.plot.ly/plotly-cartesian-1.55.2.min.js | +| Tagged | https://cdn.plot.ly/plotly-cartesian-1.58.0.js | +| Tagged minified | https://cdn.plot.ly/plotly-cartesian-1.58.0.min.js | #### npm package (starting in `v1.39.0`) @@ -220,7 +220,7 @@ The `geo` partial bundle contains trace modules `scatter`, `scattergeo` and `cho | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.6 MB | 934.8 kB | 307.9 kB | +| 2.7 MB | 961.5 kB | 316.5 kB | #### CDN links @@ -228,8 +228,8 @@ The `geo` partial bundle contains trace modules `scatter`, `scattergeo` and `cho | ------ | --- | | Latest | https://cdn.plot.ly/plotly-geo-latest.js | | Latest minified | https://cdn.plot.ly/plotly-geo-latest.min.js | -| Tagged | https://cdn.plot.ly/plotly-geo-1.55.2.js | -| Tagged minified | https://cdn.plot.ly/plotly-geo-1.55.2.min.js | +| Tagged | https://cdn.plot.ly/plotly-geo-1.58.0.js | +| Tagged minified | https://cdn.plot.ly/plotly-geo-1.58.0.min.js | #### npm package (starting in `v1.39.0`) @@ -273,7 +273,7 @@ The `gl3d` partial bundle contains trace modules `scatter`, `scatter3d`, `surfac | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 3.6 MB | 1.4 MB | 456.2 kB | +| 3.6 MB | 1.4 MB | 462.9 kB | #### CDN links @@ -281,8 +281,8 @@ The `gl3d` partial bundle contains trace modules `scatter`, `scatter3d`, `surfac | ------ | --- | | Latest | https://cdn.plot.ly/plotly-gl3d-latest.js | | Latest minified | https://cdn.plot.ly/plotly-gl3d-latest.min.js | -| Tagged | https://cdn.plot.ly/plotly-gl3d-1.55.2.js | -| Tagged minified | https://cdn.plot.ly/plotly-gl3d-1.55.2.min.js | +| Tagged | https://cdn.plot.ly/plotly-gl3d-1.58.0.js | +| Tagged minified | https://cdn.plot.ly/plotly-gl3d-1.58.0.min.js | #### npm package (starting in `v1.39.0`) @@ -326,7 +326,7 @@ The `gl2d` partial bundle contains trace modules `scatter`, `scattergl`, `splom` | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 3.6 MB | 1.5 MB | 478.5 kB | +| 3.7 MB | 1.5 MB | 487.8 kB | #### CDN links @@ -334,8 +334,8 @@ The `gl2d` partial bundle contains trace modules `scatter`, `scattergl`, `splom` | ------ | --- | | Latest | https://cdn.plot.ly/plotly-gl2d-latest.js | | Latest minified | https://cdn.plot.ly/plotly-gl2d-latest.min.js | -| Tagged | https://cdn.plot.ly/plotly-gl2d-1.55.2.js | -| Tagged minified | https://cdn.plot.ly/plotly-gl2d-1.55.2.min.js | +| Tagged | https://cdn.plot.ly/plotly-gl2d-1.58.0.js | +| Tagged minified | https://cdn.plot.ly/plotly-gl2d-1.58.0.min.js | #### npm package (starting in `v1.39.0`) @@ -379,7 +379,7 @@ The `mapbox` partial bundle contains trace modules `scatter`, `scattermapbox`, ` | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 3.3 MB | 1.6 MB | 494.8 kB | +| 3.4 MB | 1.7 MB | 503.6 kB | #### CDN links @@ -387,8 +387,8 @@ The `mapbox` partial bundle contains trace modules `scatter`, `scattermapbox`, ` | ------ | --- | | Latest | https://cdn.plot.ly/plotly-mapbox-latest.js | | Latest minified | https://cdn.plot.ly/plotly-mapbox-latest.min.js | -| Tagged | https://cdn.plot.ly/plotly-mapbox-1.55.2.js | -| Tagged minified | https://cdn.plot.ly/plotly-mapbox-1.55.2.min.js | +| Tagged | https://cdn.plot.ly/plotly-mapbox-1.58.0.js | +| Tagged minified | https://cdn.plot.ly/plotly-mapbox-1.58.0.min.js | #### npm package (starting in `v1.39.0`) @@ -432,7 +432,7 @@ The `finance` partial bundle contains trace modules `scatter`, `bar`, `histogram | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.7 MB | 995.7 kB | 323.6 kB | +| 2.8 MB | 1 MB | 333 kB | #### CDN links @@ -440,8 +440,8 @@ The `finance` partial bundle contains trace modules `scatter`, `bar`, `histogram | ------ | --- | | Latest | https://cdn.plot.ly/plotly-finance-latest.js | | Latest minified | https://cdn.plot.ly/plotly-finance-latest.min.js | -| Tagged | https://cdn.plot.ly/plotly-finance-1.55.2.js | -| Tagged minified | https://cdn.plot.ly/plotly-finance-1.55.2.min.js | +| Tagged | https://cdn.plot.ly/plotly-finance-1.58.0.js | +| Tagged minified | https://cdn.plot.ly/plotly-finance-1.58.0.min.js | #### npm package (starting in `v1.39.0`) diff --git a/dist/plot-schema.json b/dist/plot-schema.json index 4cc41b4cff4..a063592a599 100644 --- a/dist/plot-schema.json +++ b/dist/plot-schema.json @@ -481,6 +481,56 @@ "anim": true, "description": "Sets the y coordinate step. See `y0` for more info." }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "yperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the y axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "yperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis." + }, + "yperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis." + }, "stackgroup": { "valType": "string", "role": "info", @@ -1630,6 +1680,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -1811,6 +1876,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -2791,6 +2864,56 @@ "anim": true, "description": "Sets the y coordinate step. See `y0` for more info." }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "yperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the y axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "yperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis." + }, + "yperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis." + }, "text": { "valType": "string", "role": "info", @@ -3421,6 +3544,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -3602,6 +3740,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -4572,6 +4718,56 @@ "editType": "calc", "description": "Sets the y coordinate step for multi-box traces set using q1/median/q3." }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "yperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the y axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "yperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis." + }, + "yperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis." + }, "name": { "valType": "string", "role": "info", @@ -5908,6 +6104,74 @@ "ytype": "scaled" } }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer.", + "impliedEdits": { + "xtype": "scaled" + } + }, + "yperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the y axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer.", + "impliedEdits": { + "ytype": "scaled" + } + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01.", + "impliedEdits": { + "xtype": "scaled" + } + }, + "yperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01.", + "impliedEdits": { + "ytype": "scaled" + } + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis.", + "impliedEdits": { + "xtype": "scaled" + } + }, + "yperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis.", + "impliedEdits": { + "ytype": "scaled" + } + }, "text": { "valType": "data_array", "editType": "calc", @@ -6274,6 +6538,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -6455,6 +6734,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -7525,6 +7812,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -7706,6 +8008,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -9048,6 +9358,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -9229,6 +9554,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -10348,6 +10681,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -10529,6 +10877,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -11079,6 +11435,68 @@ "ytype": "scaled" } }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer.", + "impliedEdits": { + "xtype": "scaled" + } + }, + "yperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the y axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer.", + "impliedEdits": { + "ytype": "scaled" + } + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "yperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis.", + "impliedEdits": { + "xtype": "scaled" + } + }, + "yperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis.", + "impliedEdits": { + "ytype": "scaled" + } + }, "text": { "valType": "data_array", "editType": "calc", @@ -11610,6 +12028,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -11791,6 +12224,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -13371,6 +13812,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -13552,6 +14008,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -15488,6 +15952,56 @@ "editType": "calc", "description": "Sets the y coordinate step. See `y0` for more info." }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "yperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the y axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "yperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis." + }, + "yperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis." + }, "hovertext": { "valType": "string", "role": "info", @@ -16149,6 +16663,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -16330,6 +16859,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -16946,6 +17483,56 @@ "editType": "calc", "description": "Sets the y coordinate step. See `y0` for more info." }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "yperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the y axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "yperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis." + }, + "yperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis." + }, "hovertext": { "valType": "string", "role": "info", @@ -19390,6 +19977,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -19571,6 +20173,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -19935,6 +20545,31 @@ "editType": "none" } }, + "rotation": { + "valType": "angle", + "role": "style", + "dflt": 0, + "editType": "plot", + "description": "Rotates the whole diagram counterclockwise by some angle. By default the first slice starts at 3 o'clock." + }, + "sort": { + "valType": "boolean", + "role": "style", + "dflt": true, + "editType": "calc", + "description": "Determines whether or not the sectors are reordered from largest to smallest." + }, + "root": { + "color": { + "valType": "color", + "editType": "calc", + "role": "style", + "dflt": "rgba(0,0,0,0)", + "description": "sets the color of the root node for a sunburst or a treemap trace. this has no effect when a colorscale is used to set the markers." + }, + "editType": "calc", + "role": "object" + }, "domain": { "x": { "valType": "info_array", @@ -20743,6 +21378,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -20924,6 +21574,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -21369,6 +22027,24 @@ "editType": "plot", "description": "Sets the positions of the `text` elements." }, + "sort": { + "valType": "boolean", + "role": "style", + "dflt": true, + "editType": "calc", + "description": "Determines whether or not the sectors are reordered from largest to smallest." + }, + "root": { + "color": { + "valType": "color", + "editType": "calc", + "role": "style", + "dflt": "rgba(0,0,0,0)", + "description": "sets the color of the root node for a sunburst or a treemap trace. this has no effect when a colorscale is used to set the markers." + }, + "editType": "calc", + "role": "object" + }, "domain": { "x": { "valType": "info_array", @@ -22946,6 +23622,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -23127,6 +23818,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -23520,6 +24219,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -23701,6 +24415,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -25110,6 +25832,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -25291,6 +26028,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -26788,6 +27533,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -26969,6 +27729,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -28086,6 +28854,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -28267,6 +29050,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -29217,6 +30008,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -29398,6 +30204,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -30431,6 +31245,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -30612,6 +31441,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -31538,6 +32375,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -31719,6 +32571,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -33196,6 +34056,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -33377,6 +34252,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -34597,6 +35480,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -34778,6 +35676,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -35253,6 +36159,56 @@ "editType": "calc", "description": "Sets the y coordinate step. See `y0` for more info." }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "yperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the y axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "yperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis." + }, + "yperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis." + }, "text": { "valType": "string", "role": "info", @@ -35666,6 +36622,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -35847,6 +36818,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -37728,6 +38707,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -37909,6 +38903,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -38696,7 +39698,7 @@ "editType": "calc", "items": { "valType": "subplotid", - "regex": "/^x([2-9]|[1-9][0-9]+)?$/", + "regex": "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", "editType": "plot" }, "description": "Sets the list of x axes corresponding to dimensions of this splom trace. By default, a splom will match the first N xaxes where N is the number of input dimensions. Note that, in case where `diagonal.visible` is false and `showupperhalf` or `showlowerhalf` is false, this splom trace will generate one less x-axis and one less y-axis." @@ -38708,7 +39710,7 @@ "editType": "calc", "items": { "valType": "subplotid", - "regex": "/^y([2-9]|[1-9][0-9]+)?$/", + "regex": "/^y([2-9]|[1-9][0-9]+)?( domain)?$/", "editType": "plot" }, "description": "Sets the list of y axes corresponding to dimensions of this splom trace. By default, a splom will match the first N yaxes where N is the number of input dimensions. Note that, in case where `diagonal.visible` is false and `showupperhalf` or `showlowerhalf` is false, this splom trace will generate one less x-axis and one less y-axis." @@ -39878,6 +40880,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -40059,6 +41076,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -40961,6 +41986,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -41142,6 +42182,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -41908,6 +42956,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -42089,6 +43152,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -42912,6 +43983,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -43093,6 +44179,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -44119,6 +45213,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -44300,6 +45409,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -45055,6 +46172,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -45236,6 +46368,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -47102,6 +48242,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -48183,6 +49331,17 @@ "editType": "calc", "description": "Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "calc", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "autorange": { "valType": "enumerated", "values": [ @@ -48382,6 +49541,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number" + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -48751,6 +49918,17 @@ "editType": "calc", "description": "Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "calc", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "autorange": { "valType": "enumerated", "values": [ @@ -48950,6 +50128,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number" + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -50657,6 +51843,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -50838,6 +52039,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -51936,6 +53145,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -52117,6 +53341,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -52448,6 +53680,31 @@ "editType": "none", "description": "Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves." }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis." + }, "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", @@ -52973,6 +54230,31 @@ "editType": "none", "description": "Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves." }, + "xperiod": { + "valType": "any", + "dflt": 0, + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *M* on the x axis. Special values in the form of *M* could be used to declare the number of months. In this case `n` must be a positive integer." + }, + "xperiod0": { + "valType": "any", + "role": "info", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01." + }, + "xperiodalignment": { + "valType": "enumerated", + "values": [ + "start", + "middle", + "end" + ], + "dflt": "middle", + "role": "style", + "editType": "calc", + "description": "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis." + }, "x": { "valType": "data_array", "editType": "calc+clearAxisTypes", @@ -54680,6 +55962,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -54861,6 +56158,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -55949,6 +57254,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "calc" + }, "ticklen": { "valType": "number", "min": 0, @@ -56130,6 +57450,14 @@ "editType": "calc", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "calc", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -57866,6 +59194,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -58047,6 +59390,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ @@ -59477,6 +60828,12 @@ "editType": "plot", "role": "object" }, + "computed": { + "valType": "any", + "role": "info", + "editType": "none", + "description": "Placeholder for exporting automargin-impacting values namely `margin.t`, `margin.b`, `margin.l` and `margin.r` in *full-json* mode." + }, "paper_bgcolor": { "valType": "color", "role": "style", @@ -59491,6 +60848,17 @@ "editType": "layoutstyle", "description": "Sets the background color of the plotting area in-between x and y axes." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "calc", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. This is the default value; however it could be overridden for individual axes." + }, "separators": { "valType": "string", "role": "style", @@ -60000,7 +61368,7 @@ "items": { "valType": "enumerated", "values": [ - "/^x([2-9]|[1-9][0-9]+)?$/", + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", "" ], "editType": "plot" @@ -60015,7 +61383,7 @@ "items": { "valType": "enumerated", "values": [ - "/^y([2-9]|[1-9][0-9]+)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/", "" ], "editType": "plot" @@ -60228,6 +61596,17 @@ "_noTemplating": true, "description": "Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "calc", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "autorange": { "valType": "enumerated", "values": [ @@ -60291,8 +61670,8 @@ "scaleanchor": { "valType": "enumerated", "values": [ - "/^x([2-9]|[1-9][0-9]+)?$/", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "plot", @@ -60312,10 +61691,9 @@ "range", "domain" ], - "dflt": "range", "role": "info", "editType": "plot", - "description": "If this axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), determines how that happens: by increasing the *range* (default), or by decreasing the *domain*." + "description": "If this axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), determines how that happens: by increasing the *range*, or by decreasing the *domain*. Default is *domain* for axes containing image traces, *range* otherwise." }, "constraintoward": { "valType": "enumerated", @@ -60334,8 +61712,8 @@ "matches": { "valType": "enumerated", "values": [ - "/^x([2-9]|[1-9][0-9]+)?$/", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "calc", @@ -60498,6 +61876,25 @@ "editType": "ticks", "description": "Determines where tick labels are drawn with respect to their corresponding ticks and grid lines. Only has an effect for axes of `type` *date* When set to *period*, tick labels are drawn in the middle of the period between ticks." }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside left", + "inside left", + "outside right", + "inside right", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "editType": "calc", + "description": "Determines where tick labels are drawn with respect to the axis Please note that top or bottom has no effect on x axes or when `ticklabelmode` is set to *period*. Similarly left or right has no effect on y axes or when `ticklabelmode` is set to *period*. Has no effect on *multicategory* axes or when `tickson` is set to *boundaries*." + }, "mirror": { "valType": "enumerated", "values": [ @@ -60708,6 +62105,14 @@ "editType": "ticks", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "ticks", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -60868,8 +62273,8 @@ "valType": "enumerated", "values": [ "free", - "/^x([2-9]|[1-9][0-9]+)?$/", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "plot", @@ -60891,8 +62296,8 @@ "valType": "enumerated", "values": [ "free", - "/^x([2-9]|[1-9][0-9]+)?$/", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "plot", @@ -61416,6 +62821,17 @@ "_noTemplating": true, "description": "Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "calc", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "autorange": { "valType": "enumerated", "values": [ @@ -61479,8 +62895,8 @@ "scaleanchor": { "valType": "enumerated", "values": [ - "/^x([2-9]|[1-9][0-9]+)?$/", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "plot", @@ -61500,10 +62916,9 @@ "range", "domain" ], - "dflt": "range", "role": "info", "editType": "plot", - "description": "If this axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), determines how that happens: by increasing the *range* (default), or by decreasing the *domain*." + "description": "If this axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), determines how that happens: by increasing the *range*, or by decreasing the *domain*. Default is *domain* for axes containing image traces, *range* otherwise." }, "constraintoward": { "valType": "enumerated", @@ -61522,8 +62937,8 @@ "matches": { "valType": "enumerated", "values": [ - "/^x([2-9]|[1-9][0-9]+)?$/", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "calc", @@ -61686,6 +63101,25 @@ "editType": "ticks", "description": "Determines where tick labels are drawn with respect to their corresponding ticks and grid lines. Only has an effect for axes of `type` *date* When set to *period*, tick labels are drawn in the middle of the period between ticks." }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside left", + "inside left", + "outside right", + "inside right", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "editType": "calc", + "description": "Determines where tick labels are drawn with respect to the axis Please note that top or bottom has no effect on x axes or when `ticklabelmode` is set to *period*. Similarly left or right has no effect on y axes or when `ticklabelmode` is set to *period*. Has no effect on *multicategory* axes or when `tickson` is set to *boundaries*." + }, "mirror": { "valType": "enumerated", "values": [ @@ -61896,6 +63330,14 @@ "editType": "ticks", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "ticks", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -62056,8 +63498,8 @@ "valType": "enumerated", "values": [ "free", - "/^x([2-9]|[1-9][0-9]+)?$/", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "plot", @@ -62079,8 +63521,8 @@ "valType": "enumerated", "values": [ "free", - "/^x([2-9]|[1-9][0-9]+)?$/", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/", + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "plot", @@ -62536,6 +63978,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -62955,6 +64405,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -63374,6 +64832,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -63962,6 +65428,17 @@ "_noTemplating": true, "description": "Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "plot", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "autorange": { "valType": "enumerated", "values": [ @@ -64217,6 +65694,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -64573,6 +66058,17 @@ "_noTemplating": true, "description": "Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "plot", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "autorange": { "valType": "enumerated", "values": [ @@ -64828,6 +66324,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -65184,6 +66688,17 @@ "_noTemplating": true, "description": "Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "plot", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "autorange": { "valType": "enumerated", "values": [ @@ -65439,6 +66954,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -67056,6 +68579,17 @@ "_noTemplating": true, "description": "Sets the axis type. By default, plotly attempts to determined the axis type by looking into the data of the traces that referenced the axis in question." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "calc", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "autorange": { "valType": "enumerated", "values": [ @@ -67445,6 +68979,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -67618,6 +69160,17 @@ "_noTemplating": true, "description": "Sets the angular axis type. If *linear*, set `thetaunit` to determine the unit in which axis value are shown. If *category, use `period` to set the number of integer coordinates around polar axis." }, + "autotypenumbers": { + "valType": "enumerated", + "values": [ + "convert types", + "strict" + ], + "dflt": "convert types", + "role": "info", + "editType": "calc", + "description": "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers." + }, "categoryorder": { "valType": "enumerated", "values": [ @@ -67908,6 +69461,14 @@ "editType": "plot", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "plot", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "separatethousands": { "valType": "boolean", "dflt": false, @@ -68364,6 +69925,14 @@ "editType": "legend", "description": "Determines if the legend items symbols scale with their corresponding *trace* attributes or remain *constant* independent of the symbol size on the graph." }, + "itemwidth": { + "valType": "number", + "min": 30, + "dflt": 30, + "role": "style", + "editType": "legend", + "description": "Sets the width (in px) of the legend item symbols (the part other than the title.text)." + }, "itemclick": { "valType": "enumerated", "values": [ @@ -68710,45 +70279,45 @@ "valType": "any", "role": "info", "editType": "calc+arraydraw", - "description": "Sets the x component of the arrow tail about the arrow head. If `axref` is `pixel`, a positive (negative) component corresponds to an arrow pointing from right to left (left to right). If `axref` is an axis, this is an absolute value on that axis, like `x`, NOT a relative value." + "description": "Sets the x component of the arrow tail about the arrow head. If `axref` is `pixel`, a positive (negative) component corresponds to an arrow pointing from right to left (left to right). If `axref` is not `pixel` and is exactly the same as `xref`, this is an absolute value on that axis, like `x`, specified in the same coordinates as `xref`." }, "ay": { "valType": "any", "role": "info", "editType": "calc+arraydraw", - "description": "Sets the y component of the arrow tail about the arrow head. If `ayref` is `pixel`, a positive (negative) component corresponds to an arrow pointing from bottom to top (top to bottom). If `ayref` is an axis, this is an absolute value on that axis, like `y`, NOT a relative value." + "description": "Sets the y component of the arrow tail about the arrow head. If `ayref` is `pixel`, a positive (negative) component corresponds to an arrow pointing from bottom to top (top to bottom). If `ayref` is not `pixel` and is exactly the same as `yref`, this is an absolute value on that axis, like `y`, specified in the same coordinates as `yref`." }, "axref": { "valType": "enumerated", "dflt": "pixel", "values": [ "pixel", - "/^x([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "calc", - "description": "Indicates in what terms the tail of the annotation (ax,ay) is specified. If `pixel`, `ax` is a relative offset in pixels from `x`. If set to an x axis id (e.g. *x* or *x2*), `ax` is specified in the same terms as that axis. This is useful for trendline annotations which should continue to indicate the correct trend when zoomed." + "description": "Indicates in what coordinates the tail of the annotation (ax,ay) is specified. If set to a ax axis id (e.g. *ax* or *ax2*), the `ax` position refers to a ax coordinate. If set to *paper*, the `ax` position refers to the distance from the left of the plotting area in normalized coordinates where *0* (*1*) corresponds to the left (right). If set to a ax axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the left of the domain of that axis: e.g., *ax2 domain* refers to the domain of the second ax axis and a ax position of 0.5 refers to the point between the left and the right of the domain of the second ax axis. In order for absolute positioning of the arrow to work, *axref* must be exactly the same as *xref*, otherwise *axref* will revert to *pixel* (explained next). For relative positioning, *axref* can be set to *pixel*, in which case the *ax* value is specified in pixels relative to *x*. Absolute positioning is useful for trendline annotations which should continue to indicate the correct trend when zoomed. Relative positioning is useful for specifying the text offset for an annotated point." }, "ayref": { "valType": "enumerated", "dflt": "pixel", "values": [ "pixel", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "calc", - "description": "Indicates in what terms the tail of the annotation (ax,ay) is specified. If `pixel`, `ay` is a relative offset in pixels from `y`. If set to a y axis id (e.g. *y* or *y2*), `ay` is specified in the same terms as that axis. This is useful for trendline annotations which should continue to indicate the correct trend when zoomed." + "description": "Indicates in what coordinates the tail of the annotation (ax,ay) is specified. If set to a ay axis id (e.g. *ay* or *ay2*), the `ay` position refers to a ay coordinate. If set to *paper*, the `ay` position refers to the distance from the bottom of the plotting area in normalized coordinates where *0* (*1*) corresponds to the bottom (top). If set to a ay axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the bottom of the domain of that axis: e.g., *ay2 domain* refers to the domain of the second ay axis and a ay position of 0.5 refers to the point between the bottom and the top of the domain of the second ay axis. In order for absolute positioning of the arrow to work, *ayref* must be exactly the same as *yref*, otherwise *ayref* will revert to *pixel* (explained next). For relative positioning, *ayref* can be set to *pixel*, in which case the *ay* value is specified in pixels relative to *y*. Absolute positioning is useful for trendline annotations which should continue to indicate the correct trend when zoomed. Relative positioning is useful for specifying the text offset for an annotated point." }, "xref": { "valType": "enumerated", "values": [ "paper", - "/^x([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "calc", - "description": "Sets the annotation's x coordinate axis. If set to an x axis id (e.g. *x* or *x2*), the `x` position refers to an x coordinate If set to *paper*, the `x` position refers to the distance from the left side of the plotting area in normalized coordinates where 0 (1) corresponds to the left (right) side." + "description": "Sets the annotation's x coordinate axis. If set to a x axis id (e.g. *x* or *x2*), the `x` position refers to a x coordinate. If set to *paper*, the `x` position refers to the distance from the left of the plotting area in normalized coordinates where *0* (*1*) corresponds to the left (right). If set to a x axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the left of the domain of that axis: e.g., *x2 domain* refers to the domain of the second x axis and a x position of 0.5 refers to the point between the left and the right of the domain of the second x axis." }, "x": { "valType": "any", @@ -68780,11 +70349,11 @@ "valType": "enumerated", "values": [ "paper", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "calc", - "description": "Sets the annotation's y coordinate axis. If set to an y axis id (e.g. *y* or *y2*), the `y` position refers to an y coordinate If set to *paper*, the `y` position refers to the distance from the bottom of the plotting area in normalized coordinates where 0 (1) corresponds to the bottom (top)." + "description": "Sets the annotation's y coordinate axis. If set to a y axis id (e.g. *y* or *y2*), the `y` position refers to a y coordinate. If set to *paper*, the `y` position refers to the distance from the bottom of the plotting area in normalized coordinates where *0* (*1*) corresponds to the bottom (top). If set to a y axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the bottom of the domain of that axis: e.g., *y2 domain* refers to the domain of the second y axis and a y position of 0.5 refers to the point between the bottom and the top of the domain of the second y axis." }, "y": { "valType": "any", @@ -68951,11 +70520,11 @@ "valType": "enumerated", "values": [ "paper", - "/^x([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "calc", - "description": "Sets the shape's x coordinate axis. If set to an x axis id (e.g. *x* or *x2*), the `x` position refers to an x coordinate. If set to *paper*, the `x` position refers to the distance from the left side of the plotting area in normalized coordinates where *0* (*1*) corresponds to the left (right) side. If the axis `type` is *log*, then you must take the log of your desired range. If the axis `type` is *date*, then you must convert the date to unix time in milliseconds." + "description": "Sets the shape's x coordinate axis. If set to a x axis id (e.g. *x* or *x2*), the `x` position refers to a x coordinate. If set to *paper*, the `x` position refers to the distance from the left of the plotting area in normalized coordinates where *0* (*1*) corresponds to the left (right). If set to a x axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the left of the domain of that axis: e.g., *x2 domain* refers to the domain of the second x axis and a x position of 0.5 refers to the point between the left and the right of the domain of the second x axis. If the axis `type` is *log*, then you must take the log of your desired range. If the axis `type` is *date*, then you must convert the date to unix time in milliseconds." }, "xsizemode": { "valType": "enumerated", @@ -68990,11 +70559,11 @@ "valType": "enumerated", "values": [ "paper", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "role": "info", "editType": "calc", - "description": "Sets the annotation's y coordinate axis. If set to an y axis id (e.g. *y* or *y2*), the `y` position refers to an y coordinate If set to *paper*, the `y` position refers to the distance from the bottom of the plotting area in normalized coordinates where *0* (*1*) corresponds to the bottom (top)." + "description": "Sets the annotation's y coordinate axis. If set to a y axis id (e.g. *y* or *y2*), the `y` position refers to a y coordinate. If set to *paper*, the `y` position refers to the distance from the bottom of the plotting area in normalized coordinates where *0* (*1*) corresponds to the bottom (top). If set to a y axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the bottom of the domain of that axis: e.g., *y2 domain* refers to the domain of the second y axis and a y position of 0.5 refers to the point between the bottom and the top of the domain of the second y axis." }, "ysizemode": { "valType": "enumerated", @@ -69150,14 +70719,14 @@ "role": "info", "dflt": 0, "editType": "arraydraw", - "description": "Sets the image container size horizontally. The image will be sized based on the `position` value. When `xref` is set to `paper`, units are sized relative to the plot width." + "description": "Sets the image container size horizontally. The image will be sized based on the `position` value. When `xref` is set to `paper`, units are sized relative to the plot width. When `xref` ends with ` domain`, units are sized relative to the axis width." }, "sizey": { "valType": "number", "role": "info", "dflt": 0, "editType": "arraydraw", - "description": "Sets the image container size vertically. The image will be sized based on the `position` value. When `yref` is set to `paper`, units are sized relative to the plot height." + "description": "Sets the image container size vertically. The image will be sized based on the `position` value. When `yref` is set to `paper`, units are sized relative to the plot height. When `yref` ends with ` domain`, units are sized relative to the axis height." }, "sizing": { "valType": "enumerated", @@ -69222,23 +70791,23 @@ "valType": "enumerated", "values": [ "paper", - "/^x([2-9]|[1-9][0-9]+)?$/" + "/^x([2-9]|[1-9][0-9]+)?( domain)?$/" ], "dflt": "paper", "role": "info", "editType": "arraydraw", - "description": "Sets the images's x coordinate axis. If set to a x axis id (e.g. *x* or *x2*), the `x` position refers to an x data coordinate If set to *paper*, the `x` position refers to the distance from the left of plot in normalized coordinates where *0* (*1*) corresponds to the left (right)." + "description": "Sets the images's x coordinate axis. If set to a x axis id (e.g. *x* or *x2*), the `x` position refers to a x coordinate. If set to *paper*, the `x` position refers to the distance from the left of the plotting area in normalized coordinates where *0* (*1*) corresponds to the left (right). If set to a x axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the left of the domain of that axis: e.g., *x2 domain* refers to the domain of the second x axis and a x position of 0.5 refers to the point between the left and the right of the domain of the second x axis." }, "yref": { "valType": "enumerated", "values": [ "paper", - "/^y([2-9]|[1-9][0-9]+)?$/" + "/^y([2-9]|[1-9][0-9]+)?( domain)?$/" ], "dflt": "paper", "role": "info", "editType": "arraydraw", - "description": "Sets the images's y coordinate axis. If set to a y axis id (e.g. *y* or *y2*), the `y` position refers to a y data coordinate. If set to *paper*, the `y` position refers to the distance from the bottom of the plot in normalized coordinates where *0* (*1*) corresponds to the bottom (top)." + "description": "Sets the images's y coordinate axis. If set to a y axis id (e.g. *y* or *y2*), the `y` position refers to a y coordinate. If set to *paper*, the `y` position refers to the distance from the bottom of the plotting area in normalized coordinates where *0* (*1*) corresponds to the bottom (top). If set to a y axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the bottom of the domain of that axis: e.g., *y2 domain* refers to the domain of the second y axis and a y position of 0.5 refers to the point between the bottom and the top of the domain of the second y axis." }, "editType": "arraydraw", "name": { @@ -70327,6 +71896,21 @@ "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", "dflt": "" }, + "ticklabelposition": { + "valType": "enumerated", + "values": [ + "outside", + "inside", + "outside top", + "inside top", + "outside bottom", + "inside bottom" + ], + "dflt": "outside", + "role": "info", + "description": "Determines where tick labels are drawn.", + "editType": "colorbars" + }, "ticklen": { "valType": "number", "min": 0, @@ -70508,6 +72092,14 @@ "editType": "colorbars", "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B." }, + "minexponent": { + "valType": "number", + "dflt": 3, + "min": 0, + "role": "style", + "editType": "colorbars", + "description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*." + }, "showexponent": { "valType": "enumerated", "values": [ diff --git a/dist/plotly-basic.js b/dist/plotly-basic.js index e07c60ee93d..8ccdf13ceb1 100644 --- a/dist/plotly-basic.js +++ b/dist/plotly-basic.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic) v1.55.2 +* plotly.js (basic) v1.58.0 * Copyright 2012-2020, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -72,7 +72,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":171}],2:[function(_dereq_,module,exports){ +},{"../src/lib":201}],2:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85,7 +85,7 @@ for(var selector in rules) { module.exports = _dereq_('../src/traces/bar'); -},{"../src/traces/bar":275}],3:[function(_dereq_,module,exports){ +},{"../src/traces/bar":306}],3:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98,7 +98,7 @@ module.exports = _dereq_('../src/traces/bar'); module.exports = _dereq_('../src/core'); -},{"../src/core":152}],4:[function(_dereq_,module,exports){ +},{"../src/core":182}],4:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -131,7 +131,7 @@ module.exports = Plotly; module.exports = _dereq_('../src/traces/pie'); -},{"../src/traces/pie":290}],6:[function(_dereq_,module,exports){ +},{"../src/traces/pie":321}],6:[function(_dereq_,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -153,182 +153,143 @@ module.exports = _dereq_('../src/traces/pie'); // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -var objectCreate = Object.create || objectCreatePolyfill -var objectKeys = Object.keys || objectKeysPolyfill -var bind = Function.prototype.bind || functionBindPolyfill +'use strict'; -function EventEmitter() { - if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { - this._events = objectCreate(null); - this._eventsCount = 0; +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); } - this._maxListeners = this._maxListeners || undefined; +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); } module.exports = EventEmitter; +module.exports.once = once; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. var defaultMaxListeners = 10; -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; - } - }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } } +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } this._maxListeners = n; return this; }; -function $getMaxListeners(that) { +function _getMaxListeners(that) { if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); -}; - -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); - } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); - } -} + return _getMaxListeners(this); +}; EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); var doError = (type === 'error'); - events = this._events; - if (events) - doError = (doError && events.error == null); + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); else if (!doError) return false; // If there is no 'error' event listener then throw. if (doError) { - if (arguments.length > 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -339,19 +300,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -360,7 +320,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -368,33 +328,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -416,44 +372,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -463,20 +404,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -498,35 +438,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -535,7 +478,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -543,7 +486,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -552,7 +495,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -565,17 +508,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -598,12 +542,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -612,16 +556,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -629,6 +566,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -637,23 +580,33 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],7:[function(_dereq_,module,exports){ @@ -11296,7 +11249,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); },{}],10:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -12472,8 +12425,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":27}],11:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":56}],11:[function(_dereq_,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -12499,7 +12452,158 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":16}],12:[function(_dereq_,module,exports){ +},{"is-string-blank":45}],12:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],13:[function(_dereq_,module,exports){ +module.exports = clone; + +/** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param {mat4} a matrix to clone + * @returns {mat4} a new 4x4 matrix + */ +function clone(a) { + var out = new Float32Array(16); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],14:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],15:[function(_dereq_,module,exports){ +module.exports = create; + +/** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ +function create() { + var out = new Float32Array(16); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],16:[function(_dereq_,module,exports){ +module.exports = determinant; + +/** + * Calculates the determinant of a mat4 + * + * @param {mat4} a the source matrix + * @returns {Number} determinant of a + */ +function determinant(a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; +}; +},{}],17:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -12547,8 +12651,1033 @@ function fromQuat(out, q) { return out; }; -},{}],13:[function(_dereq_,module,exports){ -(function (global){ +},{}],18:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],19:[function(_dereq_,module,exports){ +module.exports = fromRotationTranslation; + +/** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat4} q Rotation quaternion + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; +}; +},{}],20:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],21:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],22:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],23:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],24:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],25:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],26:[function(_dereq_,module,exports){ +module.exports = identity; + +/** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ +function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],27:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":12,"./clone":13,"./copy":14,"./create":15,"./determinant":16,"./fromQuat":17,"./fromRotation":18,"./fromRotationTranslation":19,"./fromScaling":20,"./fromTranslation":21,"./fromXRotation":22,"./fromYRotation":23,"./fromZRotation":24,"./frustum":25,"./identity":26,"./invert":28,"./lookAt":29,"./multiply":30,"./ortho":31,"./perspective":32,"./perspectiveFromFieldOfView":33,"./rotate":34,"./rotateX":35,"./rotateY":36,"./rotateZ":37,"./scale":38,"./str":39,"./translate":40,"./transpose":41}],28:[function(_dereq_,module,exports){ +module.exports = invert; + +/** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; +}; +},{}],29:[function(_dereq_,module,exports){ +var identity = _dereq_('./identity'); + +module.exports = lookAt; + +/** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {vec3} eye Position of the viewer + * @param {vec3} center Point the viewer is looking at + * @param {vec3} up vec3 pointing up + * @returns {mat4} out + */ +function lookAt(out, eye, center, up) { + var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, + eyex = eye[0], + eyey = eye[1], + eyez = eye[2], + upx = up[0], + upy = up[1], + upz = up[2], + centerx = center[0], + centery = center[1], + centerz = center[2]; + + if (Math.abs(eyex - centerx) < 0.000001 && + Math.abs(eyey - centery) < 0.000001 && + Math.abs(eyez - centerz) < 0.000001) { + return identity(out); + } + + z0 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + + x0 = upy * z2 - upz * z1; + x1 = upz * z0 - upx * z2; + x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + y0 = z1 * x2 - z2 * x1; + y1 = z2 * x0 - z0 * x2; + y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + + return out; +}; +},{"./identity":26}],30:[function(_dereq_,module,exports){ +module.exports = multiply; + +/** + * Multiplies two mat4's + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ +function multiply(out, a, b) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + // Cache only the current line of the second matrix + var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; + out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; + out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; + out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + return out; +}; +},{}],31:[function(_dereq_,module,exports){ +module.exports = ortho; + +/** + * Generates a orthogonal projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} left Left bound of the frustum + * @param {number} right Right bound of the frustum + * @param {number} bottom Bottom bound of the frustum + * @param {number} top Top bound of the frustum + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function ortho(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; +},{}],32:[function(_dereq_,module,exports){ +module.exports = perspective; + +/** + * Generates a perspective projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspective(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2), + nf = 1 / (near - far); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + return out; +}; +},{}],33:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],34:[function(_dereq_,module,exports){ +module.exports = rotate; + +/** + * Rotates a mat4 by the given angle + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function rotate(out, a, rad, axis) { + var x = axis[0], y = axis[1], z = axis[2], + len = Math.sqrt(x * x + y * y + z * z), + s, c, t, + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23, + b00, b01, b02, + b10, b11, b12, + b20, b21, b22; + + if (Math.abs(len) < 0.000001) { return null; } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + s = Math.sin(rad); + c = Math.cos(rad); + t = 1 - c; + + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + // Construct the elements of the rotation matrix + b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; + b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; + b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; +}; +},{}],35:[function(_dereq_,module,exports){ +module.exports = rotateX; + +/** + * Rotates a matrix by the given angle around the X axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateX(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; +}; +},{}],36:[function(_dereq_,module,exports){ +module.exports = rotateY; + +/** + * Rotates a matrix by the given angle around the Y axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateY(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; +}; +},{}],37:[function(_dereq_,module,exports){ +module.exports = rotateZ; + +/** + * Rotates a matrix by the given angle around the Z axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateZ(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; +}; +},{}],38:[function(_dereq_,module,exports){ +module.exports = scale; + +/** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to scale + * @param {vec3} v the vec3 to scale the matrix by + * @returns {mat4} out + **/ +function scale(out, a, v) { + var x = v[0], y = v[1], z = v[2]; + + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],39:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],40:[function(_dereq_,module,exports){ +module.exports = translate; + +/** + * Translate a mat4 by the given vector + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to translate + * @param {vec3} v vector to translate by + * @returns {mat4} out + */ +function translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; +}; +},{}],41:[function(_dereq_,module,exports){ +module.exports = transpose; + +/** + * Transpose the values of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function transpose(out, a) { + // If we are transposing ourselves we can skip a few steps but have to cache some values + if (out === a) { + var a01 = a[1], a02 = a[2], a03 = a[3], + a12 = a[6], a13 = a[7], + a23 = a[11]; + + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + + return out; +}; +},{}],42:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -12563,8 +13692,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":15}],14:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":44}],43:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -12590,9 +13719,9 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":15}],15:[function(_dereq_,module,exports){ +},{"is-browser":44}],44:[function(_dereq_,module,exports){ module.exports = true; -},{}],16:[function(_dereq_,module,exports){ +},{}],45:[function(_dereq_,module,exports){ 'use strict'; /** @@ -12629,7 +13758,7 @@ module.exports = function(str){ return true; } -},{}],17:[function(_dereq_,module,exports){ +},{}],46:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -12656,7 +13785,7 @@ function getBoundingClientOffset (element) { } } -},{}],18:[function(_dereq_,module,exports){ +},{}],47:[function(_dereq_,module,exports){ module.exports = parse @@ -12715,7 +13844,7 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],19:[function(_dereq_,module,exports){ +},{}],48:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -12843,7 +13972,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":20,"./lib/epsilon":21,"./lib/geojson":22,"./lib/intersecter":23,"./lib/segment-chainer":25,"./lib/segment-selector":26}],20:[function(_dereq_,module,exports){ +},{"./lib/build-log":49,"./lib/epsilon":50,"./lib/geojson":51,"./lib/intersecter":52,"./lib/segment-chainer":54,"./lib/segment-selector":55}],49:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -12958,7 +14087,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],21:[function(_dereq_,module,exports){ +},{}],50:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -13130,7 +14259,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],22:[function(_dereq_,module,exports){ +},{}],51:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -13320,7 +14449,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],23:[function(_dereq_,module,exports){ +},{}],52:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -13827,7 +14956,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":24}],24:[function(_dereq_,module,exports){ +},{"./linked-list":53}],53:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -13910,7 +15039,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],25:[function(_dereq_,module,exports){ +},{}],54:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -14164,7 +15293,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],26:[function(_dereq_,module,exports){ +},{}],55:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -14332,7 +15461,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],27:[function(_dereq_,module,exports){ +},{}],56:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -14518,8 +15647,8 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],28:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +},{}],57:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -15715,7 +16844,7 @@ else { })(Math); -},{}],29:[function(_dereq_,module,exports){ +},{}],58:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -15786,7 +16915,7 @@ module.exports = [ } ]; -},{}],30:[function(_dereq_,module,exports){ +},{}],59:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -15801,7 +16930,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -16141,7 +17297,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":205,"../../plots/cartesian/constants":221,"../../plots/font_attributes":243,"./arrow_paths":29}],31:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":177,"../../plot_api/plot_template":235,"../../plots/cartesian/constants":252,"../../plots/font_attributes":274,"./arrow_paths":58}],60:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16178,10 +17334,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -16230,7 +17388,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":171,"../../plots/cartesian/axes":215,"./draw":36}],32:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/cartesian/axes":246,"./draw":65}],61:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16368,7 +17526,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":171,"../../plot_api/plot_template":205,"../../registry":257}],33:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plot_api/plot_template":235,"../../registry":288}],62:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16447,7 +17605,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":171,"../color":45}],34:[function(_dereq_,module,exports){ +},{"../../lib":201,"../color":74}],63:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16510,7 +17668,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":194,"fast-isnumeric":11}],35:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":224,"fast-isnumeric":11}],64:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16573,7 +17731,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -16617,7 +17776,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":171,"../../plots/array_container_defaults":211,"../../plots/cartesian/axes":215,"./attributes":30,"./common_defaults":33}],36:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/array_container_defaults":241,"../../plots/cartesian/axes":246,"./attributes":59,"./common_defaults":62}],65:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16633,6 +17792,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -16693,6 +17853,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -16916,13 +18101,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -16938,12 +18124,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -16960,8 +18151,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -17151,7 +18363,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -17182,22 +18394,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -17229,14 +18442,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -17245,7 +18461,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -17255,7 +18473,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -17275,7 +18495,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -17317,7 +18537,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":171,"../../lib/setcursor":190,"../../lib/svg_text_utils":192,"../../plot_api/plot_template":205,"../../plots/cartesian/axes":215,"../../plots/plots":249,"../../registry":257,"../color":45,"../dragelement":64,"../drawing":67,"../fx":85,"./draw_arrow_head":37,"d3":9}],37:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../lib/setcursor":220,"../../lib/svg_text_utils":222,"../../plot_api/plot_template":235,"../../plots/cartesian/axes":246,"../../plots/plots":280,"../../registry":288,"../color":74,"../dragelement":93,"../drawing":96,"../fx":114,"./draw_arrow_head":66,"d3":9}],66:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17335,6 +18555,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -17454,9 +18679,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -17468,7 +18693,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":45,"./arrow_paths":29,"d3":9}],38:[function(_dereq_,module,exports){ +},{"../../lib":201,"../color":74,"./arrow_paths":58,"d3":9}],67:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17502,7 +18727,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":227,"./attributes":30,"./calc_autorange":31,"./click":32,"./convert_coords":34,"./defaults":35,"./draw":36}],39:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":258,"./attributes":59,"./calc_autorange":60,"./click":61,"./convert_coords":63,"./defaults":64,"./draw":65}],68:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17590,7 +18815,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":198,"../../plot_api/plot_template":205,"../annotations/attributes":30}],40:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":228,"../../plot_api/plot_template":235,"../annotations/attributes":59}],69:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17655,7 +18880,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":171,"../../plots/cartesian/axes":215}],41:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/cartesian/axes":246}],70:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17731,7 +18956,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":171,"../../plots/array_container_defaults":211,"../../plots/cartesian/axes":215,"../annotations/common_defaults":33,"./attributes":39}],42:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/array_container_defaults":241,"../../plots/cartesian/axes":246,"../annotations/common_defaults":62,"./attributes":68}],71:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17783,7 +19008,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":246,"../annotations/draw":36}],43:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":277,"../annotations/draw":65}],72:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17831,7 +19056,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":171,"../../registry":257,"./attributes":39,"./convert":40,"./defaults":41,"./draw":42}],44:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288,"./attributes":68,"./convert":69,"./defaults":70,"./draw":71}],73:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17871,7 +19096,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],45:[function(_dereq_,module,exports){ +},{}],74:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18045,7 +19270,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":44,"fast-isnumeric":11,"tinycolor2":28}],46:[function(_dereq_,module,exports){ +},{"./attributes":73,"fast-isnumeric":11,"tinycolor2":57}],75:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18170,6 +19395,17 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -18186,6 +19422,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -18224,7 +19461,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":165,"../../plot_api/edit_types":198,"../../plots/cartesian/layout_attributes":229,"../../plots/font_attributes":243}],47:[function(_dereq_,module,exports){ +},{"../../lib/extend":195,"../../plot_api/edit_types":228,"../../plots/cartesian/layout_attributes":260,"../../plots/font_attributes":274}],76:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18252,7 +19489,7 @@ module.exports = { } }; -},{}],48:[function(_dereq_,module,exports){ +},{}],77:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18306,10 +19543,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -18318,7 +19559,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":171,"../../plot_api/plot_template":205,"../../plots/cartesian/tick_label_defaults":236,"../../plots/cartesian/tick_mark_defaults":237,"../../plots/cartesian/tick_value_defaults":238,"./attributes":46}],49:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plot_api/plot_template":235,"../../plots/cartesian/tick_label_defaults":267,"../../plots/cartesian/tick_mark_defaults":268,"../../plots/cartesian/tick_value_defaults":269,"./attributes":75}],78:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18337,6 +19578,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -18591,10 +19833,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -18706,18 +19948,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -18781,20 +20024,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -18804,7 +20046,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -18849,7 +20095,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -18905,7 +20151,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -19000,10 +20246,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -19045,7 +20293,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":147,"../../lib":171,"../../lib/extend":165,"../../lib/setcursor":190,"../../lib/svg_text_utils":192,"../../plots/cartesian/axes":215,"../../plots/cartesian/axis_defaults":217,"../../plots/cartesian/layout_attributes":229,"../../plots/cartesian/position_defaults":232,"../../plots/plots":249,"../../registry":257,"../color":45,"../colorscale/helpers":56,"../dragelement":64,"../drawing":67,"../titles":140,"./constants":47,"d3":9,"tinycolor2":28}],50:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176,"../../lib":201,"../../lib/extend":195,"../../lib/setcursor":220,"../../lib/svg_text_utils":222,"../../plots/cartesian/axes":246,"../../plots/cartesian/axis_defaults":248,"../../plots/cartesian/layout_attributes":260,"../../plots/cartesian/position_defaults":263,"../../plots/plots":280,"../../registry":288,"../color":74,"../colorscale/helpers":85,"../dragelement":93,"../drawing":96,"../titles":169,"./constants":76,"d3":9,"tinycolor2":57}],79:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19064,7 +20312,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":171}],51:[function(_dereq_,module,exports){ +},{"../../lib":201}],80:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19086,7 +20334,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":46,"./defaults":48,"./draw":49,"./has_colorbar":50}],52:[function(_dereq_,module,exports){ +},{"./attributes":75,"./defaults":77,"./draw":78,"./has_colorbar":79}],81:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19294,7 +20542,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":186,"../colorbar/attributes":46,"./scales.js":60}],53:[function(_dereq_,module,exports){ +},{"../../lib/regex":216,"../colorbar/attributes":75,"./scales.js":89}],82:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19373,7 +20621,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":171,"./helpers":56,"fast-isnumeric":11}],54:[function(_dereq_,module,exports){ +},{"../../lib":201,"./helpers":85,"fast-isnumeric":11}],83:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19450,7 +20698,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":171,"./helpers":56}],55:[function(_dereq_,module,exports){ +},{"../../lib":201,"./helpers":85}],84:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19575,7 +20823,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":171,"../../registry":257,"../colorbar/defaults":48,"../colorbar/has_colorbar":50,"./scales":60,"fast-isnumeric":11}],56:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288,"../colorbar/defaults":77,"../colorbar/has_colorbar":79,"./scales":89,"fast-isnumeric":11}],85:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19815,7 +21063,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":171,"../color":45,"./scales":60,"d3":9,"fast-isnumeric":11,"tinycolor2":28}],57:[function(_dereq_,module,exports){ +},{"../../lib":201,"../color":74,"./scales":89,"d3":9,"fast-isnumeric":11,"tinycolor2":57}],86:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19857,7 +21105,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":52,"./calc":53,"./cross_trace_defaults":54,"./defaults":55,"./helpers":56,"./layout_attributes":58,"./layout_defaults":59,"./scales":60}],58:[function(_dereq_,module,exports){ +},{"./attributes":81,"./calc":82,"./cross_trace_defaults":83,"./defaults":84,"./helpers":85,"./layout_attributes":87,"./layout_defaults":88,"./scales":89}],87:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19918,7 +21166,7 @@ module.exports = { })) }; -},{"../../lib/extend":165,"./attributes":52,"./scales":60}],59:[function(_dereq_,module,exports){ +},{"../../lib/extend":195,"./attributes":81,"./scales":89}],88:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19969,7 +21217,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":171,"../../plot_api/plot_template":205,"./defaults":55,"./layout_attributes":58}],60:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plot_api/plot_template":235,"./defaults":84,"./layout_attributes":87}],89:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20173,7 +21421,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":28}],61:[function(_dereq_,module,exports){ +},{"tinycolor2":57}],90:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20206,7 +21454,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],62:[function(_dereq_,module,exports){ +},{}],91:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20244,7 +21492,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":171}],63:[function(_dereq_,module,exports){ +},{"../../lib":201}],92:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20303,7 +21551,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],64:[function(_dereq_,module,exports){ +},{}],93:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20595,7 +21843,7 @@ function pointerOffset(e) { ); } -},{"../../lib":171,"../../plots/cartesian/constants":221,"./align":61,"./cursor":62,"./unhover":65,"has-hover":13,"has-passive-events":14,"mouse-event-offset":17}],65:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/cartesian/constants":252,"./align":90,"./cursor":91,"./unhover":94,"has-hover":42,"has-passive-events":43,"mouse-event-offset":46}],94:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20650,7 +21898,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":163,"../../lib/events":164,"../../lib/throttle":193,"../fx/constants":79}],66:[function(_dereq_,module,exports){ +},{"../../lib/dom":193,"../../lib/events":194,"../../lib/throttle":223,"../fx/constants":108}],95:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20675,7 +21923,7 @@ exports.dash = { }; -},{}],67:[function(_dereq_,module,exports){ +},{}],96:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20695,6 +21943,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -20756,7 +22005,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -21382,7 +22631,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -21773,7 +23022,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -21807,7 +23056,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -21826,7 +23075,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -21857,9 +23106,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -21867,11 +23116,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":81,"../../constants/alignment":147,"../../constants/interactions":149,"../../constants/xmlns_namespaces":151,"../../lib":171,"../../lib/svg_text_utils":192,"../../registry":257,"../../traces/scatter/make_bubble_size_func":314,"../../traces/scatter/subtypes":321,"../color":45,"../colorscale":57,"./symbol_defs":68,"d3":9,"fast-isnumeric":11,"tinycolor2":28}],68:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":110,"../../constants/alignment":176,"../../constants/interactions":179,"../../constants/xmlns_namespaces":181,"../../lib":201,"../../lib/svg_text_utils":222,"../../registry":288,"../../traces/scatter/make_bubble_size_func":345,"../../traces/scatter/subtypes":353,"../color":74,"../colorscale":86,"./symbol_defs":97,"d3":9,"fast-isnumeric":11,"tinycolor2":57}],97:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22435,7 +23684,7 @@ module.exports = { } }; -},{"d3":9}],69:[function(_dereq_,module,exports){ +},{"d3":9}],98:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22550,7 +23799,7 @@ module.exports = { } }; -},{}],70:[function(_dereq_,module,exports){ +},{}],99:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22636,7 +23885,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":171,"../../plots/cartesian/axes":215,"../../registry":257,"./compute_error":71,"fast-isnumeric":11}],71:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/cartesian/axes":246,"../../registry":288,"./compute_error":100,"fast-isnumeric":11}],100:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22737,7 +23986,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],72:[function(_dereq_,module,exports){ +},{}],101:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22812,7 +24061,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":171,"../../plot_api/plot_template":205,"../../registry":257,"./attributes":69,"fast-isnumeric":11}],73:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plot_api/plot_template":235,"../../registry":288,"./attributes":98,"fast-isnumeric":11}],102:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22881,7 +24130,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":171,"../../plot_api/edit_types":198,"./attributes":69,"./calc":70,"./compute_error":71,"./defaults":72,"./plot":74,"./style":75}],74:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plot_api/edit_types":228,"./attributes":98,"./calc":99,"./compute_error":100,"./defaults":101,"./plot":103,"./style":104}],103:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23053,7 +24302,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":321,"../drawing":67,"d3":9,"fast-isnumeric":11}],75:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":353,"../drawing":96,"d3":9,"fast-isnumeric":11}],104:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23090,7 +24339,7 @@ module.exports = function style(traces) { }); }; -},{"../color":45,"d3":9}],76:[function(_dereq_,module,exports){ +},{"../color":74,"d3":9}],105:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23126,7 +24375,7 @@ module.exports = { } }; -},{"../../lib/extend":165,"../../plots/font_attributes":243,"./layout_attributes":86}],77:[function(_dereq_,module,exports){ +},{"../../lib/extend":195,"../../plots/font_attributes":274,"./layout_attributes":115}],106:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23185,7 +24434,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":171,"../../registry":257}],78:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288}],107:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23222,7 +24471,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":257,"./hover":82}],79:[function(_dereq_,module,exports){ +},{"../../registry":288,"./hover":111}],108:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23254,7 +24503,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],80:[function(_dereq_,module,exports){ +},{}],109:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23280,7 +24529,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":171,"./attributes":76,"./hoverlabel_defaults":83}],81:[function(_dereq_,module,exports){ +},{"../../lib":201,"./attributes":105,"./hoverlabel_defaults":112}],110:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23542,7 +24791,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":171}],82:[function(_dereq_,module,exports){ +},{"../../lib":201}],111:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23558,6 +24807,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -23737,7 +24988,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -23881,6 +25134,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -24261,10 +25520,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -24505,7 +25762,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -24613,7 +25870,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -24648,8 +25905,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -24657,7 +25919,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -24757,8 +26019,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -25017,7 +26279,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -25033,7 +26298,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -25042,49 +26308,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -25396,7 +26663,7 @@ function plainText(s, len) { }); } -},{"../../lib":171,"../../lib/events":164,"../../lib/override_cursor":182,"../../lib/svg_text_utils":192,"../../plots/cartesian/axes":215,"../../registry":257,"../color":45,"../dragelement":64,"../drawing":67,"../legend/defaults":97,"../legend/draw":98,"./constants":79,"./helpers":81,"d3":9,"fast-isnumeric":11,"tinycolor2":28}],83:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../lib/events":194,"../../lib/override_cursor":212,"../../lib/svg_text_utils":222,"../../plots/cartesian/axes":246,"../../registry":288,"../color":74,"../dragelement":93,"../drawing":96,"../legend/defaults":126,"../legend/draw":127,"./constants":108,"./helpers":110,"d3":9,"fast-isnumeric":11,"tinycolor2":57}],112:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25442,7 +26709,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":171,"../color":45,"./helpers":81}],84:[function(_dereq_,module,exports){ +},{"../../lib":201,"../color":74,"./helpers":110}],113:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25498,7 +26765,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":171,"./layout_attributes":86}],85:[function(_dereq_,module,exports){ +},{"../../lib":201,"./layout_attributes":115}],114:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25577,7 +26844,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":171,"../dragelement":64,"./attributes":76,"./calc":77,"./click":78,"./constants":79,"./defaults":80,"./helpers":81,"./hover":82,"./layout_attributes":86,"./layout_defaults":87,"./layout_global_defaults":88,"d3":9}],86:[function(_dereq_,module,exports){ +},{"../../lib":201,"../dragelement":93,"./attributes":105,"./calc":106,"./click":107,"./constants":108,"./defaults":109,"./helpers":110,"./hover":111,"./layout_attributes":115,"./layout_defaults":116,"./layout_global_defaults":117,"d3":9}],115:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25693,7 +26960,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":243,"./constants":79}],87:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":274,"./constants":108}],116:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25741,7 +27008,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":171,"./helpers":81,"./hoverlabel_defaults":83,"./hovermode_defaults":84,"./layout_attributes":86}],88:[function(_dereq_,module,exports){ +},{"../../lib":201,"./helpers":110,"./hoverlabel_defaults":112,"./hovermode_defaults":113,"./layout_attributes":115}],117:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25764,7 +27031,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":171,"./hoverlabel_defaults":83,"./layout_attributes":86}],89:[function(_dereq_,module,exports){ +},{"../../lib":201,"./hoverlabel_defaults":112,"./layout_attributes":115}],118:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26138,7 +27405,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":171,"../../lib/regex":186,"../../plot_api/plot_template":205,"../../plots/cartesian/constants":221,"../../plots/domain":242}],90:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../lib/regex":216,"../../plot_api/plot_template":235,"../../plots/cartesian/constants":252,"../../plots/domain":273}],119:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26151,6 +27418,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -26273,7 +27541,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw' }); -},{"../../plot_api/plot_template":205,"../../plots/cartesian/constants":221}],91:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":177,"../../plot_api/plot_template":235,"../../plots/cartesian/constants":252}],120:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26354,7 +27622,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":194,"fast-isnumeric":11}],92:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":224,"fast-isnumeric":11}],121:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26406,7 +27674,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -26419,7 +27687,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":171,"../../plots/array_container_defaults":211,"../../plots/cartesian/axes":215,"./attributes":90}],93:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/array_container_defaults":241,"../../plots/cartesian/axes":246,"./attributes":119}],122:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26433,6 +27701,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -26449,7 +27718,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -26552,10 +27821,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -26564,8 +27848,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -26589,8 +27890,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -26644,7 +27945,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":151,"../../plots/cartesian/axes":215,"../drawing":67,"d3":9}],94:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":181,"../../plots/cartesian/axes":246,"../../plots/cartesian/axis_ids":249,"../drawing":96,"d3":9}],123:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26668,7 +27969,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":227,"./attributes":90,"./convert_coords":91,"./defaults":92,"./draw":93}],95:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":258,"./attributes":119,"./convert_coords":120,"./defaults":121,"./draw":122}],124:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26740,6 +28041,14 @@ module.exports = { editType: 'legend', + }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + + editType: 'legend', + }, itemclick: { @@ -26829,7 +28138,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":243,"../color/attributes":44}],96:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":274,"../color/attributes":73}],125:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26849,13 +28158,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],97:[function(_dereq_,module,exports){ +},{}],126:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26971,6 +28278,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -26989,7 +28297,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":171,"../../plot_api/plot_template":205,"../../plots/layout_attributes":247,"../../registry":257,"./attributes":95,"./helpers":101}],98:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plot_api/plot_template":235,"../../plots/layout_attributes":278,"../../registry":288,"./attributes":124,"./helpers":130}],127:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -27081,7 +28389,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -27402,11 +28709,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -27459,11 +28766,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -27533,7 +28843,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -27586,8 +28897,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -27700,7 +29011,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -27783,7 +29094,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":147,"../../lib":171,"../../lib/events":164,"../../lib/svg_text_utils":192,"../../plots/plots":249,"../../registry":257,"../color":45,"../dragelement":64,"../drawing":67,"./constants":96,"./get_legend_data":99,"./handle_click":100,"./helpers":101,"./style":103,"d3":9}],99:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176,"../../lib":201,"../../lib/events":194,"../../lib/svg_text_utils":222,"../../plots/plots":280,"../../registry":288,"../color":74,"../dragelement":93,"../drawing":96,"./constants":125,"./get_legend_data":128,"./handle_click":129,"./helpers":130,"./style":132,"d3":9}],128:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -27892,7 +29203,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":257,"./helpers":101}],100:[function(_dereq_,module,exports){ +},{"../../registry":288,"./helpers":130}],129:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28131,7 +29442,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":171,"../../registry":257}],101:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288}],130:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28155,7 +29466,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],102:[function(_dereq_,module,exports){ +},{}],131:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28179,7 +29490,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":95,"./defaults":97,"./draw":98,"./style":103}],103:[function(_dereq_,module,exports){ +},{"./attributes":124,"./defaults":126,"./draw":127,"./style":132}],132:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28194,6 +29505,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -28202,6 +29514,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -28212,6 +29526,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -28240,7 +29557,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -28343,7 +29660,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -28363,7 +29680,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -28453,7 +29770,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -28465,7 +29782,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -28493,7 +29810,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -28533,7 +29850,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -28557,7 +29874,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -28597,7 +29914,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -28624,7 +29941,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -28660,7 +29977,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -28758,7 +30075,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -28806,7 +30123,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":171,"../../registry":257,"../../traces/pie/helpers":289,"../../traces/pie/style_one":295,"../../traces/scatter/subtypes":321,"../color":45,"../colorscale/helpers":56,"../drawing":67,"d3":9}],104:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288,"../../traces/pie/helpers":320,"../../traces/pie/style_one":326,"../../traces/scatter/subtypes":353,"../color":74,"../colorscale/helpers":85,"../drawing":96,"./constants":125,"d3":9}],133:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29542,7 +30859,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":154,"../../lib":171,"../../plots/cartesian/axis_ids":218,"../../plots/plots":249,"../../registry":257,"../shapes/draw":126}],105:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":184,"../../lib":201,"../../plots/cartesian/axis_ids":249,"../../plots/plots":280,"../../registry":288,"../shapes/draw":155}],134:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29556,7 +30873,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":106}],106:[function(_dereq_,module,exports){ +},{"./manage":135}],135:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29852,7 +31169,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":218,"../../registry":257,"../../traces/scatter/subtypes":321,"../fx/helpers":81,"./buttons":104,"./modebar":107}],107:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":249,"../../registry":288,"../../traces/scatter/subtypes":353,"../fx/helpers":110,"./buttons":133,"./modebar":136}],136:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30198,7 +31515,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":154,"../../lib":171,"d3":9,"fast-isnumeric":11}],108:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":184,"../../lib":201,"d3":9,"fast-isnumeric":11}],137:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30334,7 +31651,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":205,"../../plots/font_attributes":243,"../color/attributes":44}],109:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":235,"../../plots/font_attributes":274,"../color/attributes":73}],138:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30363,7 +31680,7 @@ module.exports = { darkAmount: 10 }; -},{}],110:[function(_dereq_,module,exports){ +},{}],139:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30455,7 +31772,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":171,"../../plot_api/plot_template":205,"../../plots/array_container_defaults":211,"../color":45,"./attributes":108,"./constants":109}],111:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plot_api/plot_template":235,"../../plots/array_container_defaults":241,"../color":74,"./attributes":137,"./constants":138}],140:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30473,6 +31790,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -30602,8 +31920,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -30654,9 +31971,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -30709,10 +32024,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":147,"../../lib":171,"../../lib/svg_text_utils":192,"../../plots/cartesian/axis_ids":218,"../../plots/plots":249,"../../registry":257,"../color":45,"../drawing":67,"./constants":109,"./get_update_object":112,"d3":9}],112:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176,"../../lib":201,"../../lib/svg_text_utils":222,"../../plots/cartesian/axis_ids":249,"../../plots/plots":280,"../../registry":288,"../color":74,"../drawing":96,"./constants":138,"./get_update_object":141,"d3":9}],141:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30766,7 +32081,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":9}],113:[function(_dereq_,module,exports){ +},{"d3":9}],142:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30793,7 +32108,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":108,"./defaults":110,"./draw":111}],114:[function(_dereq_,module,exports){ +},{"./attributes":137,"./defaults":139,"./draw":140}],143:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30867,7 +32182,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":44}],115:[function(_dereq_,module,exports){ +},{"../color/attributes":73}],144:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30901,7 +32216,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":214,"../../plots/cartesian/axis_ids":218,"./constants":116}],116:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":245,"../../plots/cartesian/axis_ids":249,"./constants":145}],145:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30957,7 +32272,7 @@ module.exports = { extraPad: 15 }; -},{}],117:[function(_dereq_,module,exports){ +},{}],146:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31043,7 +32358,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":171,"../../plot_api/plot_template":205,"../../plots/cartesian/axis_ids":218,"./attributes":114,"./oppaxis_attributes":121}],118:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plot_api/plot_template":235,"../../plots/cartesian/axis_ids":249,"./attributes":143,"./oppaxis_attributes":150}],147:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31060,6 +32375,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -31165,7 +32481,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -31278,6 +32594,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -31424,10 +32742,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -31449,7 +32767,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -31665,14 +32983,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -31686,7 +33002,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":171,"../../lib/setcursor":190,"../../plots/cartesian":228,"../../plots/cartesian/axis_ids":218,"../../plots/plots":249,"../../registry":257,"../color":45,"../dragelement":64,"../drawing":67,"../titles":140,"./constants":116,"d3":9}],119:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../lib/setcursor":220,"../../plots/cartesian":259,"../../plots/cartesian/axis_ids":249,"../../plots/plots":280,"../../registry":288,"../color":74,"../dragelement":93,"../drawing":96,"../titles":169,"./constants":145,"d3":9}],148:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31761,7 +33077,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":147,"../../lib/svg_text_utils":192,"../../plots/cartesian/axis_ids":218,"./constants":116}],120:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176,"../../lib/svg_text_utils":222,"../../plots/cartesian/axis_ids":249,"./constants":145}],149:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31800,7 +33116,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":171,"./attributes":114,"./calc_autorange":115,"./defaults":117,"./draw":118,"./helpers":119,"./oppaxis_attributes":121}],121:[function(_dereq_,module,exports){ +},{"../../lib":201,"./attributes":143,"./calc_autorange":144,"./defaults":146,"./draw":147,"./helpers":148,"./oppaxis_attributes":150}],150:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31838,7 +33154,7 @@ module.exports = { editType: 'calc' }; -},{}],122:[function(_dereq_,module,exports){ +},{}],151:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31854,6 +33170,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -31990,7 +33307,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":165,"../../plot_api/plot_template":205,"../../traces/scatter/attributes":297,"../annotations/attributes":30,"../drawing/attributes":66}],123:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":177,"../../lib/extend":195,"../../plot_api/plot_template":235,"../../traces/scatter/attributes":328,"../annotations/attributes":59,"../drawing/attributes":95}],152:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32018,9 +33335,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -32031,7 +33351,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -32107,7 +33427,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":171,"../../plots/cartesian/axes":215,"./constants":124,"./helpers":133}],124:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/cartesian/axes":246,"./constants":153,"./helpers":162}],153:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32171,7 +33491,7 @@ module.exports = { } }; -},{}],125:[function(_dereq_,module,exports){ +},{}],154:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32237,9 +33557,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -32300,7 +33622,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":171,"../../plots/array_container_defaults":211,"../../plots/cartesian/axes":215,"./attributes":122,"./helpers":133}],126:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/array_container_defaults":241,"../../plots/cartesian/axes":246,"./attributes":151,"./helpers":162}],155:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32486,7 +33808,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -32512,11 +33837,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -32887,6 +34214,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -32894,15 +34223,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -33059,7 +34396,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":171,"../../lib/setcursor":190,"../../plot_api/plot_template":205,"../../plots/cartesian/axes":215,"../../plots/cartesian/handle_outline":225,"../../registry":257,"../color":45,"../dragelement":64,"../drawing":67,"./constants":124,"./draw_newshape/display_outlines":130,"./draw_newshape/helpers":131,"./helpers":133}],127:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../lib/setcursor":220,"../../plot_api/plot_template":235,"../../plots/cartesian/axes":246,"../../plots/cartesian/handle_outline":256,"../../registry":288,"../color":74,"../dragelement":93,"../drawing":96,"./constants":153,"./draw_newshape/display_outlines":159,"./draw_newshape/helpers":160,"./helpers":162}],156:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33162,7 +34499,7 @@ module.exports = { } }; -},{"../../../lib/extend":165,"../../drawing/attributes":66}],128:[function(_dereq_,module,exports){ +},{"../../../lib/extend":195,"../../drawing/attributes":95}],157:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33186,7 +34523,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],129:[function(_dereq_,module,exports){ +},{}],158:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33218,7 +34555,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":45}],130:[function(_dereq_,module,exports){ +},{"../../color":74}],159:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33513,7 +34850,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":225,"../../../registry":257,"../../dragelement":64,"../../dragelement/helpers":63,"./constants":128,"./helpers":131,"./newshapes":132}],131:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":256,"../../../registry":288,"../../dragelement":93,"../../dragelement/helpers":92,"./constants":157,"./helpers":160,"./newshapes":161}],160:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33851,7 +35188,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":226,"./constants":128,"parse-svg-path":18}],132:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":257,"./constants":157,"parse-svg-path":47}],161:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34110,7 +35447,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":225,"../../../plots/cartesian/helpers":226,"../../dragelement/helpers":63,"./constants":128,"./helpers":131}],133:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":256,"../../../plots/cartesian/helpers":257,"../../dragelement/helpers":92,"./constants":157,"./helpers":160}],162:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34171,18 +35508,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -34192,13 +35535,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -34255,7 +35605,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":171,"./constants":124}],134:[function(_dereq_,module,exports){ +},{"../../lib":201,"./constants":153}],163:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34283,7 +35633,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":227,"./attributes":122,"./calc_autorange":123,"./defaults":125,"./draw":126,"./draw_newshape/defaults":129}],135:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":258,"./attributes":151,"./calc_autorange":152,"./defaults":154,"./draw":155,"./draw_newshape/defaults":158}],164:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34526,7 +35876,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":165,"../../plot_api/edit_types":198,"../../plot_api/plot_template":205,"../../plots/animation_attributes":210,"../../plots/font_attributes":243,"../../plots/pad_attributes":248,"./constants":136}],136:[function(_dereq_,module,exports){ +},{"../../lib/extend":195,"../../plot_api/edit_types":228,"../../plot_api/plot_template":235,"../../plots/animation_attributes":240,"../../plots/font_attributes":274,"../../plots/pad_attributes":279,"./constants":165}],165:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34620,7 +35970,7 @@ module.exports = { currentValueInset: 0, }; -},{}],137:[function(_dereq_,module,exports){ +},{}],166:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34735,7 +36085,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":171,"../../plots/array_container_defaults":211,"./attributes":135,"./constants":136}],138:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/array_container_defaults":241,"./attributes":164,"./constants":165}],167:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34752,6 +36102,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -35040,11 +36391,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -35095,11 +36445,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -35312,7 +36661,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -35367,7 +36716,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":147,"../../lib":171,"../../lib/svg_text_utils":192,"../../plot_api/plot_template":205,"../../plots/plots":249,"../color":45,"../drawing":67,"./constants":136,"d3":9}],139:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176,"../../lib":201,"../../lib/svg_text_utils":222,"../../plot_api/plot_template":235,"../../plots/plots":280,"../color":74,"../drawing":96,"./constants":165,"d3":9}],168:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35390,7 +36739,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":135,"./constants":136,"./defaults":137,"./draw":138}],140:[function(_dereq_,module,exports){ +},{"./attributes":164,"./constants":165,"./defaults":166,"./draw":167}],169:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35408,6 +36757,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -35528,7 +36878,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -35606,7 +36956,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -35657,7 +37007,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":147,"../../constants/interactions":149,"../../lib":171,"../../lib/svg_text_utils":192,"../../plots/plots":249,"../../registry":257,"../color":45,"../drawing":67,"d3":9,"fast-isnumeric":11}],141:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176,"../../constants/interactions":179,"../../lib":201,"../../lib/svg_text_utils":222,"../../plots/plots":280,"../../registry":288,"../color":74,"../drawing":96,"d3":9,"fast-isnumeric":11}],170:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35826,7 +37176,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":165,"../../plot_api/edit_types":198,"../../plot_api/plot_template":205,"../../plots/font_attributes":243,"../../plots/pad_attributes":248,"../color/attributes":44}],142:[function(_dereq_,module,exports){ +},{"../../lib/extend":195,"../../plot_api/edit_types":228,"../../plot_api/plot_template":235,"../../plots/font_attributes":274,"../../plots/pad_attributes":279,"../color/attributes":73}],171:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35907,7 +37257,7 @@ module.exports = { } }; -},{}],143:[function(_dereq_,module,exports){ +},{}],172:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35990,7 +37340,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":171,"../../plots/array_container_defaults":211,"./attributes":141,"./constants":142}],144:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/array_container_defaults":241,"./attributes":170,"./constants":171}],173:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36188,8 +37538,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -36428,11 +37777,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -36643,9 +37991,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":147,"../../lib":171,"../../lib/svg_text_utils":192,"../../plot_api/plot_template":205,"../../plots/plots":249,"../color":45,"../drawing":67,"./constants":142,"./scrollbox":146,"d3":9}],145:[function(_dereq_,module,exports){ -arguments[4][139][0].apply(exports,arguments) -},{"./attributes":141,"./constants":142,"./defaults":143,"./draw":144,"dup":139}],146:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176,"../../lib":201,"../../lib/svg_text_utils":222,"../../plot_api/plot_template":235,"../../plots/plots":280,"../color":74,"../drawing":96,"./constants":171,"./scrollbox":175,"d3":9}],174:[function(_dereq_,module,exports){ +arguments[4][168][0].apply(exports,arguments) +},{"./attributes":170,"./constants":171,"./defaults":172,"./draw":173,"dup":168}],175:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37110,7 +38458,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":171,"../color":45,"../drawing":67,"d3":9}],147:[function(_dereq_,module,exports){ +},{"../../lib":201,"../color":74,"../drawing":96,"d3":9}],176:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37175,7 +38523,39 @@ module.exports = { } }; -},{}],148:[function(_dereq_,module,exports){ +},{}],177:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],178:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37191,7 +38571,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],149:[function(_dereq_,module,exports){ +},{}],179:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37214,7 +38594,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],150:[function(_dereq_,module,exports){ +},{}],180:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37287,7 +38667,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],151:[function(_dereq_,module,exports){ +},{}],181:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37311,7 +38691,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],152:[function(_dereq_,module,exports){ +},{}],182:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37397,7 +38777,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":38,"./components/annotations3d":43,"./components/colorbar":51,"./components/colorscale":57,"./components/errorbars":73,"./components/fx":85,"./components/grid":89,"./components/images":94,"./components/legend":102,"./components/rangeselector":113,"./components/rangeslider":120,"./components/shapes":134,"./components/sliders":139,"./components/updatemenus":145,"./fonts/mathjax_config":153,"./fonts/ploticon":154,"./lib/queue":185,"./locale-en":196,"./locale-en-us":195,"./plot_api":200,"./plot_api/plot_schema":204,"./plots/plots":249,"./registry":257,"./snapshot":262,"./traces/scatter":309,"./version":324,"d3":9,"es6-promise":10}],153:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":67,"./components/annotations3d":72,"./components/colorbar":80,"./components/colorscale":86,"./components/errorbars":102,"./components/fx":114,"./components/grid":118,"./components/images":123,"./components/legend":131,"./components/rangeselector":142,"./components/rangeslider":149,"./components/shapes":163,"./components/sliders":168,"./components/updatemenus":174,"./fonts/mathjax_config":183,"./fonts/ploticon":184,"./lib/queue":215,"./locale-en":226,"./locale-en-us":225,"./plot_api":230,"./plot_api/plot_schema":234,"./plots/plots":280,"./registry":288,"./snapshot":293,"./traces/scatter":340,"./version":356,"d3":9,"es6-promise":10}],183:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37428,7 +38808,7 @@ module.exports = function() { } }; -},{}],154:[function(_dereq_,module,exports){ +},{}],184:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37608,7 +38988,7 @@ module.exports = { } }; -},{}],155:[function(_dereq_,module,exports){ +},{}],185:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37672,7 +39052,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],156:[function(_dereq_,module,exports){ +},{}],186:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37913,7 +39293,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":178}],157:[function(_dereq_,module,exports){ +},{"./mod":208}],187:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38070,7 +39450,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],158:[function(_dereq_,module,exports){ +},{}],188:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38103,7 +39483,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":150,"fast-isnumeric":11}],159:[function(_dereq_,module,exports){ +},{"../constants/numerical":180,"fast-isnumeric":11}],189:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38131,7 +39511,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],160:[function(_dereq_,module,exports){ +},{}],190:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38154,7 +39534,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],161:[function(_dereq_,module,exports){ +},{}],191:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38618,7 +39998,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":60,"../constants/interactions":149,"../plots/attributes":212,"./array":157,"./mod":178,"./nested_property":179,"./regex":186,"fast-isnumeric":11,"tinycolor2":28}],162:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":89,"../constants/interactions":179,"../plots/attributes":242,"./array":187,"./mod":208,"./nested_property":209,"./regex":216,"fast-isnumeric":11,"tinycolor2":57}],192:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38666,9 +40046,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -38676,7 +40070,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -39205,7 +40599,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":150,"../registry":257,"./loggers":175,"./mod":178,"d3-time-format":7,"fast-isnumeric":11}],163:[function(_dereq_,module,exports){ +},{"../constants/numerical":180,"../registry":288,"./loggers":205,"./mod":208,"d3-time-format":7,"fast-isnumeric":11}],193:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39218,6 +40612,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -39299,16 +40695,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":175,"d3":9}],164:[function(_dereq_,module,exports){ +},{"./loggers":205,"./matrix":207,"d3":9,"gl-mat4":27}],194:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39481,7 +40950,7 @@ var Events = { module.exports = Events; -},{"events":6}],165:[function(_dereq_,module,exports){ +},{"events":6}],195:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39595,7 +41064,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":172}],166:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":202}],196:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39646,7 +41115,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],167:[function(_dereq_,module,exports){ +},{}],197:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39694,7 +41163,7 @@ function isCalcData(cont) { ); } -},{}],168:[function(_dereq_,module,exports){ +},{}],198:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39938,7 +41407,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":178}],169:[function(_dereq_,module,exports){ +},{"./mod":208}],199:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39954,7 +41423,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { module.exports = function identity(d) { return d; }; -},{}],170:[function(_dereq_,module,exports){ +},{}],200:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39996,7 +41465,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],171:[function(_dereq_,module,exports){ +},{}],201:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40087,8 +41556,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -40144,6 +41616,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -41194,6 +42670,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -41220,13 +42708,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -41244,7 +42730,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":150,"./anchor_utils":155,"./angles":156,"./array":157,"./clean_number":158,"./clear_responsive":160,"./coerce":161,"./dates":162,"./dom":163,"./extend":165,"./filter_unique":166,"./filter_visible":167,"./geometry2d":168,"./identity":169,"./increment":170,"./is_plain_object":172,"./keyed_container":173,"./localize":174,"./loggers":175,"./make_trace_groups":176,"./matrix":177,"./mod":178,"./nested_property":179,"./noop":180,"./notifier":181,"./push_unique":184,"./regex":186,"./relative_attr":187,"./relink_private":188,"./search":189,"./stats":191,"./throttle":193,"./to_log_range":194,"d3":9,"d3-time-format":7,"fast-isnumeric":11}],172:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":180,"./anchor_utils":185,"./angles":186,"./array":187,"./clean_number":188,"./clear_responsive":190,"./coerce":191,"./dates":192,"./dom":193,"./extend":195,"./filter_unique":196,"./filter_visible":197,"./geometry2d":198,"./identity":199,"./increment":200,"./is_plain_object":202,"./keyed_container":203,"./localize":204,"./loggers":205,"./make_trace_groups":206,"./matrix":207,"./mod":208,"./nested_property":209,"./noop":210,"./notifier":211,"./push_unique":214,"./regex":216,"./relative_attr":217,"./relink_private":218,"./search":219,"./stats":221,"./throttle":223,"./to_log_range":224,"d3":9,"d3-time-format":7,"fast-isnumeric":11}],202:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41272,7 +42775,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],173:[function(_dereq_,module,exports){ +},{}],203:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41465,7 +42968,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":179}],174:[function(_dereq_,module,exports){ +},{"./nested_property":209}],204:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41521,7 +43024,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":257}],175:[function(_dereq_,module,exports){ +},{"../registry":288}],205:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41631,7 +43134,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":203,"./notifier":181}],176:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":233,"./notifier":211}],206:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41674,7 +43177,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":9}],177:[function(_dereq_,module,exports){ +},{"d3":9}],207:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41686,6 +43189,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -41761,13 +43265,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -41781,7 +43295,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],178:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":27}],208:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41816,7 +43364,7 @@ module.exports = { modHalf: modHalf }; -},{}],179:[function(_dereq_,module,exports){ +},{}],209:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42062,7 +43610,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":157,"fast-isnumeric":11}],180:[function(_dereq_,module,exports){ +},{"./array":187,"fast-isnumeric":11}],210:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42078,7 +43626,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],181:[function(_dereq_,module,exports){ +},{}],211:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42166,7 +43714,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":9,"fast-isnumeric":11}],182:[function(_dereq_,module,exports){ +},{"d3":9,"fast-isnumeric":11}],212:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42214,7 +43762,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":190}],183:[function(_dereq_,module,exports){ +},{"./setcursor":220}],213:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42466,7 +44014,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":150,"./matrix":177}],184:[function(_dereq_,module,exports){ +},{"../constants/numerical":180,"./matrix":207}],214:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42504,7 +44052,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],185:[function(_dereq_,module,exports){ +},{}],215:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42712,7 +44260,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":171,"../plot_api/plot_config":203}],186:[function(_dereq_,module,exports){ +},{"../lib":201,"../plot_api/plot_config":233}],216:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42742,7 +44290,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],187:[function(_dereq_,module,exports){ +},{}],217:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42795,7 +44343,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],188:[function(_dereq_,module,exports){ +},{}],218:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42852,7 +44400,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":157,"./is_plain_object":172}],189:[function(_dereq_,module,exports){ +},{"./array":187,"./is_plain_object":202}],219:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43057,7 +44605,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":150,"./identity":169,"./loggers":175,"fast-isnumeric":11}],190:[function(_dereq_,module,exports){ +},{"../constants/numerical":180,"./identity":199,"./loggers":205,"fast-isnumeric":11}],220:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43080,7 +44628,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],191:[function(_dereq_,module,exports){ +},{}],221:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43190,7 +44738,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":157,"fast-isnumeric":11}],192:[function(_dereq_,module,exports){ +},{"./array":187,"fast-isnumeric":11}],222:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43207,6 +44755,7 @@ exports.interp = function(arr, n) { var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -43321,7 +44870,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -43936,9 +45485,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -44069,7 +45629,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":147,"../constants/xmlns_namespaces":151,"../lib":171,"d3":9}],193:[function(_dereq_,module,exports){ +},{"../constants/alignment":176,"../constants/xmlns_namespaces":181,"../lib":201,"d3":9}],223:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44172,7 +45732,7 @@ function _clearTimeout(cache) { } } -},{}],194:[function(_dereq_,module,exports){ +},{}],224:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44200,7 +45760,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":11}],195:[function(_dereq_,module,exports){ +},{"fast-isnumeric":11}],225:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44222,7 +45782,7 @@ module.exports = { } }; -},{}],196:[function(_dereq_,module,exports){ +},{}],226:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44265,7 +45825,7 @@ module.exports = { } }; -},{}],197:[function(_dereq_,module,exports){ +},{}],227:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44323,7 +45883,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":257}],198:[function(_dereq_,module,exports){ +},{"../registry":288}],228:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44448,7 +46008,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":171}],199:[function(_dereq_,module,exports){ +},{"../lib":201}],229:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44625,6 +46185,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -44669,7 +46239,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -45140,7 +46710,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":45,"../lib":171,"../plots/cartesian/axis_ids":218,"../plots/plots":249,"../registry":257,"fast-isnumeric":11,"gl-mat4/fromQuat":12}],200:[function(_dereq_,module,exports){ +},{"../components/color":74,"../lib":201,"../plots/cartesian/axis_ids":249,"../plots/plots":280,"../registry":288,"fast-isnumeric":11,"gl-mat4/fromQuat":17}],230:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45183,7 +46753,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":259,"./plot_api":202,"./template_api":207,"./to_image":208,"./validate":209}],201:[function(_dereq_,module,exports){ +},{"../snapshot/download":290,"./plot_api":232,"./template_api":237,"./to_image":238,"./validate":239}],231:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45396,7 +46966,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":172,"../lib/loggers":175,"../lib/noop":180,"../lib/search":189,"../registry":257,"./container_array_match":197}],202:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":202,"../lib/loggers":205,"../lib/noop":210,"../lib/search":219,"../registry":288,"./container_array_match":227}],232:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45766,7 +47336,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -45780,9 +47361,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -47360,6 +48948,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -47454,7 +49048,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -47544,7 +49138,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -47682,21 +49276,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -49107,6 +50699,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -49114,15 +50719,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -49148,6 +50758,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -49281,7 +50892,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":45,"../components/drawing":67,"../constants/xmlns_namespaces":151,"../lib":171,"../lib/events":164,"../lib/queue":185,"../lib/svg_text_utils":192,"../plots/cartesian/axes":215,"../plots/cartesian/constants":221,"../plots/cartesian/graph_interact":224,"../plots/cartesian/select":234,"../plots/plots":249,"../plots/polar/legacy":252,"../registry":257,"./edit_types":198,"./helpers":199,"./manage_arrays":201,"./plot_config":203,"./plot_schema":204,"./subroutines":206,"d3":9,"fast-isnumeric":11,"has-hover":13}],203:[function(_dereq_,module,exports){ +},{"../components/color":74,"../components/drawing":96,"../constants/xmlns_namespaces":181,"../lib":201,"../lib/events":194,"../lib/queue":215,"../lib/svg_text_utils":222,"../plots/cartesian/axes":246,"../plots/cartesian/constants":252,"../plots/cartesian/graph_interact":255,"../plots/cartesian/select":265,"../plots/plots":280,"../plots/polar/legacy":283,"../registry":288,"./edit_types":228,"./helpers":229,"./manage_arrays":231,"./plot_config":233,"./plot_schema":234,"./subroutines":236,"d3":9,"fast-isnumeric":11,"has-hover":42}],233:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -49596,7 +51207,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],204:[function(_dereq_,module,exports){ +},{}],234:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50307,7 +51918,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":171,"../plots/animation_attributes":210,"../plots/attributes":212,"../plots/frame_attributes":244,"../plots/layout_attributes":247,"../plots/polar/legacy/area_attributes":250,"../plots/polar/legacy/axis_attributes":251,"../registry":257,"./edit_types":198,"./plot_config":203}],205:[function(_dereq_,module,exports){ +},{"../lib":201,"../plots/animation_attributes":240,"../plots/attributes":242,"../plots/frame_attributes":275,"../plots/layout_attributes":278,"../plots/polar/legacy/area_attributes":281,"../plots/polar/legacy/axis_attributes":282,"../registry":288,"./edit_types":228,"./plot_config":233}],235:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50619,7 +52230,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":171,"../plots/attributes":212}],206:[function(_dereq_,module,exports){ +},{"../lib":201,"../plots/attributes":242}],236:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50800,7 +52411,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -51289,57 +52900,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - - enforceAxisConstraints(gd); - - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); + + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -51365,7 +52954,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":45,"../components/drawing":67,"../components/modebar":105,"../components/titles":140,"../constants/alignment":147,"../lib":171,"../lib/clear_gl_canvases":159,"../plots/cartesian/autorange":214,"../plots/cartesian/axes":215,"../plots/cartesian/constraints":222,"../plots/plots":249,"../registry":257,"d3":9}],207:[function(_dereq_,module,exports){ +},{"../components/color":74,"../components/drawing":96,"../components/modebar":134,"../components/titles":169,"../constants/alignment":176,"../lib":201,"../lib/clear_gl_canvases":189,"../plots/cartesian/autorange":245,"../plots/cartesian/axes":246,"../plots/cartesian/constraints":253,"../plots/plots":280,"../registry":288,"d3":9}],237:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51827,7 +53416,7 @@ function format(opts) { return opts; } -},{"../lib":171,"../plots/attributes":212,"../plots/plots":249,"./plot_config":203,"./plot_schema":204,"./plot_template":205}],208:[function(_dereq_,module,exports){ +},{"../lib":201,"../plots/attributes":242,"../plots/plots":280,"./plot_config":233,"./plot_schema":234,"./plot_template":235}],238:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51924,7 +53513,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -52048,7 +53637,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":171,"../plots/plots":249,"../snapshot/helpers":261,"../snapshot/svgtoimg":263,"../snapshot/tosvg":265,"../version":324,"./plot_api":202,"fast-isnumeric":11}],209:[function(_dereq_,module,exports){ +},{"../lib":201,"../plots/plots":280,"../snapshot/helpers":292,"../snapshot/svgtoimg":294,"../snapshot/tosvg":296,"../version":356,"./plot_api":232,"fast-isnumeric":11}],239:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52479,7 +54068,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":171,"../plots/plots":249,"./plot_config":203,"./plot_schema":204}],210:[function(_dereq_,module,exports){ +},{"../lib":201,"../plots/plots":280,"./plot_config":233,"./plot_schema":234}],240:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52591,7 +54180,7 @@ module.exports = { } }; -},{}],211:[function(_dereq_,module,exports){ +},{}],241:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52686,7 +54275,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":171,"../plot_api/plot_template":205}],212:[function(_dereq_,module,exports){ +},{"../lib":201,"../plot_api/plot_template":235}],242:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52827,7 +54416,99 @@ module.exports = { } }; -},{"../components/fx/attributes":76}],213:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":105}],243:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":180,"../../lib":201,"fast-isnumeric":11}],244:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52856,7 +54537,7 @@ module.exports = { } }; -},{}],214:[function(_dereq_,module,exports){ +},{}],245:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52873,6 +54554,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -52913,7 +54596,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -52954,19 +54638,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -52974,9 +54645,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -52994,8 +54665,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -53009,7 +54680,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -53030,7 +54701,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -53039,12 +54710,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -53054,13 +54725,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -53072,7 +54771,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -53101,14 +54890,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -53368,7 +55177,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":150,"../../lib":171,"../../registry":257,"fast-isnumeric":11}],215:[function(_dereq_,module,exports){ +},{"../../constants/numerical":180,"../../lib":201,"../../registry":288,"./axis_ids":249,"fast-isnumeric":11}],246:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53385,6 +55194,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -53418,6 +55228,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -53462,14 +55274,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -53477,6 +55292,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -53501,8 +55331,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -53511,7 +55341,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -53570,7 +55399,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -53892,6 +55723,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -53916,7 +55750,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -53926,6 +55760,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -53939,6 +55777,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -53951,15 +55973,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -53971,85 +55998,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } + var flip = ax._id.charAt(0) === 'y'; - var pos = ax.c2p(tickVal.value); + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -54070,180 +56093,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; - - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -54336,7 +56211,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -54353,15 +56229,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -54474,7 +56352,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -54957,6 +56836,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -55229,21 +57109,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -55344,23 +57226,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -55391,13 +57274,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -55418,7 +57301,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -55434,7 +57317,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -55454,7 +57337,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -55486,7 +57369,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -55498,7 +57381,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -55513,7 +57396,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -55769,21 +57652,81 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; +}; + +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; -}; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} /** * Make axis tick path string @@ -55830,24 +57773,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -55855,42 +57819,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } + + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } - out.xFn = function(d) { return d.dx + x0; }; + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } + + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -56142,6 +58165,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -56159,22 +58184,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -56242,11 +58311,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -56286,6 +58368,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -56767,7 +58869,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":45,"../../components/drawing":67,"../../components/titles":140,"../../constants/alignment":147,"../../constants/numerical":150,"../../lib":171,"../../lib/svg_text_utils":192,"../../plots/plots":249,"../../registry":257,"./autorange":214,"./axis_autotype":216,"./axis_ids":218,"./clean_ticks":220,"./layout_attributes":229,"./set_convert":235,"d3":9,"fast-isnumeric":11}],216:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/drawing":96,"../../components/titles":169,"../../constants/alignment":176,"../../constants/numerical":180,"../../lib":201,"../../lib/svg_text_utils":222,"../../plots/plots":280,"../../registry":288,"./autorange":245,"./axis_autotype":247,"./axis_ids":249,"./clean_ticks":251,"./layout_attributes":260,"./set_convert":266,"d3":9,"fast-isnumeric":11}],247:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56784,23 +58886,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; + + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } + + if(moreDates(a, calendar)) return 'date'; - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -56813,56 +58941,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":150,"../../lib":171,"fast-isnumeric":11}],217:[function(_dereq_,module,exports){ +},{"../../constants/numerical":180,"../../lib":201,"fast-isnumeric":11}],248:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56919,9 +59057,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -56979,7 +59141,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -56991,8 +59156,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -57145,7 +59308,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":171,"../../registry":257,"../array_container_defaults":211,"./category_order_defaults":219,"./constants":221,"./layout_attributes":229,"./line_grid_defaults":231,"./set_convert":235,"./tick_label_defaults":236,"./tick_mark_defaults":237,"./tick_value_defaults":238,"fast-isnumeric":11}],218:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288,"../array_container_defaults":241,"./category_order_defaults":250,"./constants":252,"./layout_attributes":260,"./line_grid_defaults":262,"./set_convert":266,"./tick_label_defaults":267,"./tick_mark_defaults":268,"./tick_value_defaults":269,"fast-isnumeric":11}],249:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57166,7 +59329,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -57178,13 +59341,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -57230,6 +59400,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -57262,17 +59434,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":257,"./constants":221}],219:[function(_dereq_,module,exports){ +},{"../../registry":288,"./constants":252}],250:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57366,7 +59542,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],220:[function(_dereq_,module,exports){ +},{}],251:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57379,7 +59555,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -57444,7 +59622,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -57454,7 +59634,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":150,"../../lib":171,"fast-isnumeric":11}],221:[function(_dereq_,module,exports){ +},{"../../constants/numerical":180,"../../lib":201,"fast-isnumeric":11}],252:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57469,8 +59649,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -57482,7 +59662,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -57546,7 +59726,7 @@ module.exports = { } }; -},{"../../lib/regex":186}],222:[function(_dereq_,module,exports){ +},{"../../lib/regex":216}],253:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57558,74 +59738,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; + + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } + + var canLink = linkableAxes.length; + + var matches, scaleanchor; + + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -57636,64 +60022,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; +} - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -57702,12 +60063,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -57720,38 +60083,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); + } + } + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } } + + out[key] = val; } - thisGroup[scaleanchor] = 1; + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -57860,25 +60294,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -57900,6 +60335,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -57932,7 +60377,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":147,"../../constants/numerical":150,"../../lib":171,"./autorange":214,"./axis_ids":218,"./scale_zoom":233}],223:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176,"../../constants/numerical":180,"../../lib":201,"./autorange":245,"./axis_ids":249,"./layout_attributes":260,"./scale_zoom":264,"./set_convert":266}],254:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57949,6 +60394,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -58025,6 +60471,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -58056,10 +60505,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -58096,6 +60546,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -58261,6 +60714,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -58278,8 +60737,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -58479,6 +60938,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -58488,6 +60949,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -58496,7 +60973,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -58527,15 +61004,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -58544,12 +61023,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -58559,7 +61042,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -58569,9 +61052,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -58771,15 +61269,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -58795,7 +61293,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -59007,7 +61505,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -59020,7 +61518,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -59085,11 +61583,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -59100,14 +61600,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -59117,7 +61625,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -59204,7 +61715,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":45,"../../components/dragelement":64,"../../components/dragelement/helpers":63,"../../components/drawing":67,"../../components/fx":85,"../../constants/alignment":147,"../../lib":171,"../../lib/clear_gl_canvases":159,"../../lib/setcursor":190,"../../lib/svg_text_utils":192,"../../plot_api/subroutines":206,"../../registry":257,"../plots":249,"./axes":215,"./axis_ids":218,"./constants":221,"./scale_zoom":233,"./select":234,"d3":9,"has-passive-events":14,"tinycolor2":28}],224:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/dragelement":93,"../../components/dragelement/helpers":92,"../../components/drawing":96,"../../components/fx":114,"../../constants/alignment":176,"../../lib":201,"../../lib/clear_gl_canvases":189,"../../lib/setcursor":220,"../../lib/svg_text_utils":222,"../../plot_api/subroutines":236,"../../registry":288,"../plots":280,"./axes":246,"./axis_ids":249,"./constants":252,"./scale_zoom":264,"./select":265,"d3":9,"has-passive-events":43,"tinycolor2":57}],255:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59372,7 +61883,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":64,"../../components/fx":85,"../../lib/setcursor":190,"./constants":221,"./dragbox":223,"d3":9}],225:[function(_dereq_,module,exports){ +},{"../../components/dragelement":93,"../../components/fx":114,"../../lib/setcursor":220,"./constants":252,"./dragbox":254,"d3":9}],256:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59408,7 +61919,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],226:[function(_dereq_,module,exports){ +},{}],257:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59420,6 +61931,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -59450,9 +61963,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -59462,7 +61976,7 @@ module.exports = { getTransform: getTransform }; -},{}],227:[function(_dereq_,module,exports){ +},{"../../lib":201}],258:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59476,6 +61990,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -59505,8 +62020,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -59537,7 +62054,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":171,"../../registry":257}],228:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288,"./axis_ids":249}],259:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59875,6 +62392,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -60154,7 +62672,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":67,"../../constants/xmlns_namespaces":151,"../../lib":171,"../../registry":257,"../get_data":245,"../plots":249,"./attributes":213,"./axis_ids":218,"./constants":221,"./graph_interact":224,"./layout_attributes":229,"./layout_defaults":230,"./transition_axes":239,"d3":9}],229:[function(_dereq_,module,exports){ +},{"../../components/drawing":96,"../../constants/xmlns_namespaces":181,"../../lib":201,"../../registry":288,"../get_data":276,"../plots":280,"./attributes":244,"./axis_ids":249,"./constants":252,"./graph_interact":255,"./layout_attributes":260,"./layout_defaults":261,"./transition_axes":270,"d3":9}],260:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60227,6 +62745,14 @@ module.exports = { // type in the template explicitly it will be honored as the default. _noTemplating: true, + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, autorange: { valType: 'enumerated', @@ -60287,7 +62813,6 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', editType: 'plot', @@ -60451,6 +62976,22 @@ module.exports = { editType: 'ticks', + }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + editType: 'calc', + }, mirror: { valType: 'enumerated', @@ -60591,6 +63132,14 @@ module.exports = { editType: 'ticks', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'ticks', + }, separatethousands: { valType: 'boolean', @@ -60843,7 +63392,7 @@ module.exports = { } }; -},{"../../components/color/attributes":44,"../../components/drawing/attributes":66,"../../constants/docs":148,"../../constants/numerical":150,"../../lib/extend":165,"../../plot_api/plot_template":205,"../font_attributes":243,"./constants":221}],230:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":73,"../../components/drawing/attributes":95,"../../constants/docs":178,"../../constants/numerical":180,"../../lib/extend":195,"../../plot_api/plot_template":235,"../font_attributes":274,"./constants":252}],261:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60865,7 +63414,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -60884,6 +63433,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -61092,6 +63643,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -61156,6 +63708,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -61220,101 +63773,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":45,"../../components/fx/helpers":81,"../../components/fx/hovermode_defaults":84,"../../lib":171,"../../plot_api/plot_template":205,"../../registry":257,"../layout_attributes":247,"./axis_defaults":217,"./axis_ids":218,"./constants":221,"./constraints":222,"./layout_attributes":229,"./position_defaults":232,"./type_defaults":240}],231:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/fx/helpers":110,"../../components/fx/hovermode_defaults":113,"../../lib":201,"../../plot_api/plot_template":235,"../../registry":288,"../layout_attributes":278,"./axis_defaults":248,"./axis_ids":249,"./constants":252,"./constraints":253,"./layout_attributes":260,"./position_defaults":263,"./type_defaults":271}],262:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61379,7 +63844,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":44,"../../lib":171,"tinycolor2":28}],232:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":73,"../../lib":201,"tinycolor2":57}],263:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61467,7 +63932,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":171,"fast-isnumeric":11}],233:[function(_dereq_,module,exports){ +},{"../../lib":201,"fast-isnumeric":11}],264:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61493,9 +63958,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":147}],234:[function(_dereq_,module,exports){ +},{"../../constants/alignment":176}],265:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61565,6 +64031,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -61654,8 +64128,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -62430,7 +64904,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":45,"../../components/dragelement/helpers":63,"../../components/drawing":67,"../../components/fx":85,"../../components/fx/helpers":81,"../../components/shapes/draw_newshape/display_outlines":130,"../../components/shapes/draw_newshape/helpers":131,"../../components/shapes/draw_newshape/newshapes":132,"../../lib":171,"../../lib/clear_gl_canvases":159,"../../lib/polygon":183,"../../lib/throttle":193,"../../plot_api/subroutines":206,"../../registry":257,"./axis_ids":218,"./constants":221,"./handle_outline":225,"./helpers":226,"polybooljs":19}],235:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/dragelement/helpers":92,"../../components/drawing":96,"../../components/fx":114,"../../components/fx/helpers":110,"../../components/shapes/draw_newshape/display_outlines":159,"../../components/shapes/draw_newshape/helpers":160,"../../components/shapes/draw_newshape/newshapes":161,"../../lib":201,"../../lib/clear_gl_canvases":189,"../../lib/polygon":213,"../../lib/throttle":223,"../../plot_api/subroutines":236,"../../registry":288,"./axis_ids":249,"./constants":252,"./handle_outline":256,"./helpers":257,"polybooljs":48}],266:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62463,7 +64937,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -62619,6 +65092,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -62750,12 +65227,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -62798,17 +65275,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -63312,38 +65784,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -63402,7 +65862,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":150,"../../lib":171,"./axis_ids":218,"./constants":221,"d3":9,"d3-time-format":7,"fast-isnumeric":11}],236:[function(_dereq_,module,exports){ +},{"../../constants/numerical":180,"../../lib":201,"./axis_ids":249,"./constants":252,"d3":9,"d3-time-format":7,"fast-isnumeric":11}],267:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63415,6 +65875,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -63451,10 +65912,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -63477,6 +65942,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -63523,7 +65989,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":171,"../array_container_defaults":211,"./layout_attributes":229}],237:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../lib":201,"../array_container_defaults":241,"./layout_attributes":260}],268:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63556,7 +66022,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":171,"./layout_attributes":229}],238:[function(_dereq_,module,exports){ +},{"../../lib":201,"./layout_attributes":260}],269:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63603,7 +66069,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":171,"./clean_ticks":220}],239:[function(_dereq_,module,exports){ +},{"../../lib":201,"./clean_ticks":251}],270:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63816,7 +66282,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":67,"../../lib":171,"../../registry":257,"./axes":215,"d3":9}],240:[function(_dereq_,module,exports){ +},{"../../components/drawing":96,"../../lib":201,"../../registry":288,"./axes":246,"d3":9}],271:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63835,6 +66301,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -63887,6 +66354,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -63953,7 +66422,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":257,"./axis_autotype":216}],241:[function(_dereq_,module,exports){ +},{"../../registry":288,"./axis_autotype":247}],272:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64380,7 +66849,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":171,"../registry":257}],242:[function(_dereq_,module,exports){ +},{"../lib":201,"../registry":288}],273:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64492,7 +66961,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":165}],243:[function(_dereq_,module,exports){ +},{"../lib/extend":195}],274:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64557,7 +67026,7 @@ module.exports = function(opts) { return attrs; }; -},{}],244:[function(_dereq_,module,exports){ +},{}],275:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64603,7 +67072,7 @@ module.exports = { } }; -},{}],245:[function(_dereq_,module,exports){ +},{}],276:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64732,7 +67201,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":257,"./cartesian/constants":221}],246:[function(_dereq_,module,exports){ +},{"../registry":288,"./cartesian/constants":252}],277:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64766,7 +67235,7 @@ function project(camera, v) { module.exports = project; -},{}],247:[function(_dereq_,module,exports){ +},{}],278:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64954,6 +67423,12 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + + editType: 'none', + + }, paper_bgcolor: { valType: 'color', @@ -64969,6 +67444,14 @@ module.exports = { dflt: colorAttrs.background, editType: 'layoutstyle', + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, separators: { valType: 'string', @@ -65093,7 +67576,7 @@ module.exports = { } }; -},{"../components/color/attributes":44,"../components/shapes/draw_newshape/attributes":127,"../lib/extend":165,"./animation_attributes":210,"./font_attributes":243,"./pad_attributes":248}],248:[function(_dereq_,module,exports){ +},{"../components/color/attributes":73,"../components/shapes/draw_newshape/attributes":156,"../lib/extend":195,"./animation_attributes":240,"./font_attributes":274,"./pad_attributes":279}],279:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65148,7 +67631,7 @@ module.exports = function(opts) { }; }; -},{}],249:[function(_dereq_,module,exports){ +},{}],280:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65818,7 +68301,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -66627,6 +69110,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -67015,6 +69500,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -67032,6 +69520,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -67051,13 +69543,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -67082,6 +69576,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -67096,8 +69595,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -67129,11 +69626,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -67143,11 +69639,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -67157,6 +69652,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -67183,11 +69690,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -67311,7 +69831,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -68211,6 +70744,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -68221,7 +70757,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -68231,27 +70766,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -68260,18 +70796,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -68294,16 +70826,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -68345,12 +70880,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -68359,13 +70890,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -68487,7 +71019,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":45,"../constants/numerical":150,"../lib":171,"../plot_api/plot_schema":204,"../plot_api/plot_template":205,"../plots/get_data":245,"../registry":257,"./animation_attributes":210,"./attributes":212,"./cartesian/axis_ids":218,"./cartesian/handle_outline":225,"./command":241,"./font_attributes":243,"./frame_attributes":244,"./layout_attributes":247,"d3":9,"d3-time-format":7,"fast-isnumeric":11}],250:[function(_dereq_,module,exports){ +},{"../components/color":74,"../constants/numerical":180,"../lib":201,"../plot_api/plot_schema":234,"../plot_api/plot_template":235,"../plots/get_data":276,"../registry":288,"./animation_attributes":240,"./attributes":242,"./cartesian/axis_ids":249,"./cartesian/handle_outline":256,"./command":272,"./font_attributes":274,"./frame_attributes":275,"./layout_attributes":278,"d3":9,"d3-time-format":7,"fast-isnumeric":11}],281:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68531,7 +71063,7 @@ module.exports = { } }; -},{"../../../lib/extend":165,"../../../traces/scatter/attributes":297}],251:[function(_dereq_,module,exports){ +},{"../../../lib/extend":195,"../../../traces/scatter/attributes":328}],282:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68653,7 +71185,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":165,"../../../plot_api/edit_types":198,"../../cartesian/layout_attributes":229}],252:[function(_dereq_,module,exports){ +},{"../../../lib/extend":195,"../../../plot_api/edit_types":228,"../../cartesian/layout_attributes":260}],283:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68668,7 +71200,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":253,"./micropolar_manager":254}],253:[function(_dereq_,module,exports){ +},{"./micropolar":284,"./micropolar_manager":285}],284:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70088,7 +72620,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":147,"../../../lib":171,"d3":9}],254:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":176,"../../../lib":201,"d3":9}],285:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70174,7 +72706,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":45,"../../../lib":171,"./micropolar":253,"./undo_manager":255,"d3":9}],255:[function(_dereq_,module,exports){ +},{"../../../components/color":74,"../../../lib":201,"./micropolar":284,"./undo_manager":286,"d3":9}],286:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70240,7 +72772,7 @@ module.exports = function UndoManager() { }; }; -},{}],256:[function(_dereq_,module,exports){ +},{}],287:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70323,7 +72855,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":148}],257:[function(_dereq_,module,exports){ +},{"../constants/docs":178}],288:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70789,7 +73321,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":163,"./lib/extend":165,"./lib/is_plain_object":172,"./lib/loggers":175,"./lib/noop":180,"./lib/push_unique":184,"./plots/attributes":212,"./plots/layout_attributes":247}],258:[function(_dereq_,module,exports){ +},{"./lib/dom":193,"./lib/extend":195,"./lib/is_plain_object":202,"./lib/loggers":205,"./lib/noop":210,"./lib/push_unique":214,"./plots/attributes":242,"./plots/layout_attributes":278}],289:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70962,7 +73494,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":171,"../registry":257}],259:[function(_dereq_,module,exports){ +},{"../lib":201,"../registry":288}],290:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70996,6 +73528,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -71032,7 +73566,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":171,"../plot_api/to_image":208,"./filesaver":260,"./helpers":261}],260:[function(_dereq_,module,exports){ +},{"../lib":201,"../plot_api/to_image":238,"./filesaver":291,"./helpers":292}],291:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71112,7 +73646,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":171,"./helpers":261}],261:[function(_dereq_,module,exports){ +},{"../lib":201,"./helpers":292}],292:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71195,7 +73729,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":257}],262:[function(_dereq_,module,exports){ +},{"../registry":288}],293:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71221,7 +73755,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":258,"./download":259,"./helpers":261,"./svgtoimg":263,"./toimage":264,"./tosvg":265}],263:[function(_dereq_,module,exports){ +},{"./cloneplot":289,"./download":290,"./helpers":292,"./svgtoimg":294,"./toimage":295,"./tosvg":296}],294:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71348,7 +73882,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":171,"./helpers":261,"events":6}],264:[function(_dereq_,module,exports){ +},{"../lib":201,"./helpers":292,"events":6}],295:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71425,7 +73959,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":171,"../registry":257,"./cloneplot":258,"./helpers":261,"./svgtoimg":263,"./tosvg":265,"events":6}],265:[function(_dereq_,module,exports){ +},{"../lib":201,"../registry":288,"./cloneplot":289,"./helpers":292,"./svgtoimg":294,"./tosvg":296,"events":6}],296:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71614,7 +74148,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":45,"../components/drawing":67,"../constants/xmlns_namespaces":151,"../lib":171,"d3":9}],266:[function(_dereq_,module,exports){ +},{"../components/color":74,"../components/drawing":96,"../constants/xmlns_namespaces":181,"../lib":201,"d3":9}],297:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71647,7 +74181,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":171}],267:[function(_dereq_,module,exports){ +},{"../../lib":201}],298:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71709,6 +74243,13 @@ module.exports = { y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, texttemplate: texttemplateAttrs({editType: 'plot'}, { keys: constants.eventDataKeys @@ -71856,7 +74397,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":52,"../../lib/extend":165,"../../plots/font_attributes":243,"../../plots/template_attributes":256,"../scatter/attributes":297,"./constants":269}],268:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":81,"../../lib/extend":195,"../../plots/font_attributes":274,"../../plots/template_attributes":287,"../scatter/attributes":328,"./constants":300}],299:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71868,6 +74409,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; var colorscaleCalc = _dereq_('../../components/colorscale/calc'); var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); @@ -71876,18 +74418,23 @@ var calcSelection = _dereq_('../scatter/calc_selection'); module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; var sizeOpts = { msUTC: !!(trace.base || trace.base === 0) }; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x', sizeOpts); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y', sizeOpts); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -71898,6 +74445,10 @@ module.exports = function calc(gd, trace) { for(var i = 0; i < serieslen; i++) { cd[i] = { p: pos[i], s: size[i] }; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cd[i].id = String(trace.ids[i]); } @@ -71925,7 +74476,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":53,"../../components/colorscale/helpers":56,"../../plots/cartesian/axes":215,"../scatter/calc_selection":299,"./arrays_to_calcdata":266}],269:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":82,"../../components/colorscale/helpers":85,"../../plots/cartesian/align_period":243,"../../plots/cartesian/axes":246,"../scatter/calc_selection":330,"./arrays_to_calcdata":297}],300:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71947,7 +74498,7 @@ module.exports = { eventDataKeys: ['value', 'label'] }; -},{}],270:[function(_dereq_,module,exports){ +},{}],301:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71964,7 +74515,7 @@ var BADNUM = _dereq_('../../constants/numerical').BADNUM; var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var Sieve = _dereq_('./sieve.js'); /* @@ -72727,7 +75278,7 @@ module.exports = { setGroupPositions: setGroupPositions }; -},{"../../constants/numerical":150,"../../lib":171,"../../plots/cartesian/axes":215,"../../plots/cartesian/axis_ids":218,"../../registry":257,"./sieve.js":280,"fast-isnumeric":11}],271:[function(_dereq_,module,exports){ +},{"../../constants/numerical":180,"../../lib":201,"../../plots/cartesian/axes":246,"../../plots/cartesian/constraints":253,"../../registry":288,"./sieve.js":311,"fast-isnumeric":11}],302:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72743,8 +75294,9 @@ var Color = _dereq_('../../components/color'); var Registry = _dereq_('../../registry'); var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var attributes = _dereq_('./attributes'); var coerceFont = Lib.coerceFont; @@ -72760,6 +75312,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); coerce('base'); coerce('offset'); @@ -72909,7 +75463,7 @@ module.exports = { handleText: handleText }; -},{"../../components/color":45,"../../lib":171,"../../plots/cartesian/axis_ids":218,"../../registry":257,"../scatter/xy_defaults":323,"./attributes":267,"./style_defaults":282}],272:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../lib":201,"../../plots/cartesian/constraints":253,"../../registry":288,"../scatter/period_defaults":348,"../scatter/xy_defaults":355,"./attributes":298,"./style_defaults":313}],303:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72938,7 +75492,7 @@ module.exports = function eventData(out, pt, trace) { return out; }; -},{}],273:[function(_dereq_,module,exports){ +},{}],304:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73016,7 +75570,7 @@ exports.getLineWidth = function(trace, di) { return w; }; -},{"../../lib":171,"fast-isnumeric":11,"tinycolor2":28}],274:[function(_dereq_,module,exports){ +},{"../../lib":201,"fast-isnumeric":11,"tinycolor2":57}],305:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73177,10 +75731,13 @@ function hoverOnBars(pointData, xval, yval, hovermode) { var extent = t.extents[t.extents.round(di.p)]; pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true); pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true); - pointData[posLetter + 'LabelVal'] = di.p; + + var hasPeriod = di.orig_p !== undefined; + pointData[posLetter + 'LabelVal'] = hasPeriod ? di.orig_p : di.p; pointData.labelLabel = hoverLabelText(pa, pointData[posLetter + 'LabelVal']); pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + 'LabelVal']); + pointData.baseLabel = hoverLabelText(sa, di.b); // spikelines always want "closest" distance regardless of hovermode pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 - maxHoverDistance; @@ -73209,7 +75766,7 @@ module.exports = { getTraceColor: getTraceColor }; -},{"../../components/color":45,"../../components/fx":85,"../../constants/numerical":150,"../../lib":171,"../../plots/cartesian/axes":215,"../../registry":257,"./helpers":273}],275:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/fx":114,"../../constants/numerical":180,"../../lib":201,"../../plots/cartesian/axes":246,"../../registry":288,"./helpers":304}],306:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73247,7 +75804,7 @@ module.exports = { } }; -},{"../../plots/cartesian":228,"../scatter/marker_colorbar":315,"./arrays_to_calcdata":266,"./attributes":267,"./calc":268,"./cross_trace_calc":270,"./defaults":271,"./event_data":272,"./hover":274,"./layout_attributes":276,"./layout_defaults":277,"./plot":278,"./select":279,"./style":281}],276:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":259,"../scatter/marker_colorbar":346,"./arrays_to_calcdata":297,"./attributes":298,"./calc":299,"./cross_trace_calc":301,"./defaults":302,"./event_data":303,"./hover":305,"./layout_attributes":307,"./layout_defaults":308,"./plot":309,"./select":310,"./style":312}],307:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73295,7 +75852,7 @@ module.exports = { } }; -},{}],277:[function(_dereq_,module,exports){ +},{}],308:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73355,7 +75912,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":171,"../../plots/cartesian/axes":215,"../../registry":257,"./layout_attributes":276}],278:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/cartesian/axes":246,"../../registry":288,"./layout_attributes":307}],309:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73600,7 +76157,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback); sel .style('vector-effect', 'non-scaling-stroke') - .attr('d', isNaN((x1 - x0) * (y1 - y0)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') + .attr('d', (isNaN((x1 - x0) * (y1 - y0)) || (isBlank && gd._context.staticPlot)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') .call(Drawing.setClipUrl, plotinfo.layerClipId, gd); if(!fullLayout.uniformtext.mode && withTransition) { @@ -74140,7 +76697,7 @@ module.exports = { toMoveInsideBar: toMoveInsideBar }; -},{"../../components/color":45,"../../components/drawing":67,"../../components/fx/helpers":81,"../../lib":171,"../../lib/svg_text_utils":192,"../../plots/cartesian/axes":215,"../../registry":257,"./attributes":267,"./constants":269,"./helpers":273,"./style":281,"./uniform_text":283,"d3":9,"fast-isnumeric":11}],279:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/drawing":96,"../../components/fx/helpers":110,"../../lib":201,"../../lib/svg_text_utils":222,"../../plots/cartesian/axes":246,"../../registry":288,"./attributes":298,"./constants":300,"./helpers":304,"./style":312,"./uniform_text":314,"d3":9,"fast-isnumeric":11}],310:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74204,7 +76761,7 @@ function getCentroid(d, xa, ya, isHorizontal, isFunnel) { } } -},{}],280:[function(_dereq_,module,exports){ +},{}],311:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74318,7 +76875,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":150,"../../lib":171}],281:[function(_dereq_,module,exports){ +},{"../../constants/numerical":180,"../../lib":201}],312:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74500,7 +77057,7 @@ module.exports = { resizeText: resizeText }; -},{"../../components/color":45,"../../components/drawing":67,"../../lib":171,"../../registry":257,"./attributes":267,"./helpers":273,"./uniform_text":283,"d3":9}],282:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/drawing":96,"../../lib":201,"../../registry":288,"./attributes":298,"./helpers":304,"./uniform_text":314,"d3":9}],313:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74538,7 +77095,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('unselected.marker.color'); }; -},{"../../components/color":45,"../../components/colorscale/defaults":55,"../../components/colorscale/helpers":56}],283:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/colorscale/defaults":84,"../../components/colorscale/helpers":85}],314:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74624,7 +77181,7 @@ module.exports = { resizeText: resizeText }; -},{"../../lib":171,"d3":9}],284:[function(_dereq_,module,exports){ +},{"../../lib":201,"d3":9}],315:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74895,7 +77452,7 @@ module.exports = { } }; -},{"../../components/color/attributes":44,"../../lib/extend":165,"../../plots/attributes":212,"../../plots/domain":242,"../../plots/font_attributes":243,"../../plots/template_attributes":256}],285:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":73,"../../lib/extend":195,"../../plots/attributes":242,"../../plots/domain":273,"../../plots/font_attributes":274,"../../plots/template_attributes":287}],316:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74918,7 +77475,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":249}],286:[function(_dereq_,module,exports){ +},{"../../plots/plots":280}],317:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75101,7 +77658,7 @@ module.exports = { generateExtendedColors: generateExtendedColors }; -},{"../../components/color":45,"fast-isnumeric":11,"tinycolor2":28}],287:[function(_dereq_,module,exports){ +},{"../../components/color":74,"fast-isnumeric":11,"tinycolor2":57}],318:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75232,7 +77789,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":171,"../../plots/domain":242,"../bar/defaults":271,"./attributes":284,"fast-isnumeric":11}],288:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../plots/domain":273,"../bar/defaults":302,"./attributes":315,"fast-isnumeric":11}],319:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75281,7 +77838,7 @@ module.exports = function eventData(pt, trace) { return out; }; -},{"../../components/fx/helpers":81}],289:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":110}],320:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75294,19 +77851,21 @@ module.exports = function eventData(pt, trace) { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -75323,7 +77882,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":171}],290:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":201}],321:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75356,7 +77919,7 @@ module.exports = { } }; -},{"./attributes":284,"./base_plot":285,"./calc":286,"./defaults":287,"./layout_attributes":291,"./layout_defaults":292,"./plot":293,"./style":294,"./style_one":295}],291:[function(_dereq_,module,exports){ +},{"./attributes":315,"./base_plot":316,"./calc":317,"./defaults":318,"./layout_attributes":322,"./layout_defaults":323,"./plot":324,"./style":325,"./style_one":326}],322:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75389,7 +77952,7 @@ module.exports = { } }; -},{}],292:[function(_dereq_,module,exports){ +},{}],323:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75414,7 +77977,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendpiecolors'); }; -},{"../../lib":171,"./layout_attributes":291}],293:[function(_dereq_,module,exports){ +},{"../../lib":201,"./layout_attributes":322}],324:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75432,6 +77995,8 @@ var Fx = _dereq_('../../components/fx'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var uniformText = _dereq_('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; @@ -75661,9 +78226,9 @@ function plot(gd, cdModule) { } titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); // now make sure no labels overlap (at least within one pie) @@ -76462,7 +79027,7 @@ function setCoords(cd) { var cd0 = cd[0]; var r = cd0.r; var trace = cd0.trace; - var currentAngle = trace.rotation * Math.PI / 180; + var currentAngle = helpers.getRotationAngle(trace.rotation); var angleFactor = 2 * Math.PI / cd0.vTotal; var firstPt = 'px0'; var lastPt = 'px1'; @@ -76592,7 +79157,7 @@ module.exports = { computeTransform: computeTransform }; -},{"../../components/color":45,"../../components/drawing":67,"../../components/fx":85,"../../lib":171,"../../lib/svg_text_utils":192,"../../plots/plots":249,"../bar/constants":269,"../bar/uniform_text":283,"./event_data":288,"./helpers":289,"d3":9}],294:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/drawing":96,"../../components/fx":114,"../../lib":201,"../../lib/svg_text_utils":222,"../../plots/plots":280,"../bar/constants":300,"../bar/uniform_text":314,"./event_data":319,"./helpers":320,"d3":9}],325:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76625,7 +79190,7 @@ module.exports = function style(gd) { }); }; -},{"../bar/uniform_text":283,"./style_one":295,"d3":9}],295:[function(_dereq_,module,exports){ +},{"../bar/uniform_text":314,"./style_one":326,"d3":9}],326:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76649,7 +79214,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":45,"./helpers":289}],296:[function(_dereq_,module,exports){ +},{"../../components/color":74,"./helpers":320}],327:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76701,7 +79266,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":171}],297:[function(_dereq_,module,exports){ +},{"../../lib":201}],328:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76720,8 +79285,41 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + + editType: 'calc', + + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + + editType: 'calc', + + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + + editType: 'calc', + + }; +} + module.exports = { x: { valType: 'data_array', @@ -76768,6 +79366,13 @@ module.exports = { }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', @@ -77115,7 +79720,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":52,"../../components/drawing":67,"../../components/drawing/attributes":66,"../../lib/extend":165,"../../plots/font_attributes":243,"../../plots/template_attributes":256,"./constants":301}],298:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":81,"../../components/drawing":96,"../../components/drawing/attributes":95,"../../lib/extend":195,"../../plots/font_attributes":274,"../../plots/template_attributes":287,"./constants":332}],329:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77130,6 +79735,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -77141,8 +79747,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -77173,6 +79782,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -77180,6 +79792,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -77400,7 +80019,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":150,"../../lib":171,"../../plots/cartesian/axes":215,"./arrays_to_calcdata":296,"./calc_selection":299,"./colorscale_calc":300,"./subtypes":321,"fast-isnumeric":11}],299:[function(_dereq_,module,exports){ +},{"../../constants/numerical":180,"../../lib":201,"../../plots/cartesian/align_period":243,"../../plots/cartesian/axes":246,"./arrays_to_calcdata":327,"./calc_selection":330,"./colorscale_calc":331,"./subtypes":353,"fast-isnumeric":11}],330:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77419,7 +80038,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":171}],300:[function(_dereq_,module,exports){ +},{"../../lib":201}],331:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77462,7 +80081,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":53,"../../components/colorscale/helpers":56,"./subtypes":321}],301:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":82,"../../components/colorscale/helpers":85,"./subtypes":353}],332:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77491,7 +80110,7 @@ module.exports = { eventDataKeys: [] }; -},{}],302:[function(_dereq_,module,exports){ +},{}],333:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77672,7 +80291,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":298}],303:[function(_dereq_,module,exports){ +},{"./calc":329}],334:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77711,7 +80330,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],304:[function(_dereq_,module,exports){ +},{}],335:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77729,6 +80348,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -77746,6 +80366,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -77801,7 +80423,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":171,"../../registry":257,"./attributes":297,"./constants":301,"./fillcolor_defaults":305,"./line_defaults":310,"./line_shape_defaults":312,"./marker_defaults":316,"./stack_defaults":319,"./subtypes":321,"./text_defaults":322,"./xy_defaults":323}],305:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288,"./attributes":328,"./constants":332,"./fillcolor_defaults":336,"./line_defaults":341,"./line_shape_defaults":343,"./marker_defaults":347,"./period_defaults":348,"./stack_defaults":351,"./subtypes":353,"./text_defaults":354,"./xy_defaults":355}],336:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77838,7 +80460,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":45,"../../lib":171}],306:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../lib":201}],337:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77864,7 +80486,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":215}],307:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":246}],338:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77913,7 +80535,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":45,"./subtypes":321}],308:[function(_dereq_,module,exports){ +},{"../../components/color":74,"./subtypes":353}],339:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77994,8 +80616,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -78108,7 +80730,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":45,"../../components/fx":85,"../../lib":171,"../../registry":257,"./get_trace_color":307}],309:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/fx":114,"../../lib":201,"../../registry":288,"./get_trace_color":338}],340:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78154,7 +80776,7 @@ module.exports = { } }; -},{"../../plots/cartesian":228,"./arrays_to_calcdata":296,"./attributes":297,"./calc":298,"./cross_trace_calc":302,"./cross_trace_defaults":303,"./defaults":304,"./format_labels":306,"./hover":308,"./marker_colorbar":315,"./plot":317,"./select":318,"./style":320,"./subtypes":321}],310:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":259,"./arrays_to_calcdata":327,"./attributes":328,"./calc":329,"./cross_trace_calc":333,"./cross_trace_defaults":334,"./defaults":335,"./format_labels":337,"./hover":339,"./marker_colorbar":346,"./plot":349,"./select":350,"./style":352,"./subtypes":353}],341:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78185,7 +80807,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":55,"../../components/colorscale/helpers":56,"../../lib":171}],311:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":84,"../../components/colorscale/helpers":85,"../../lib":201}],342:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78646,7 +81268,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":150,"../../lib":171,"./constants":301}],312:[function(_dereq_,module,exports){ +},{"../../constants/numerical":180,"../../lib":201,"./constants":332}],343:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78665,7 +81287,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],313:[function(_dereq_,module,exports){ +},{}],344:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78755,7 +81377,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],314:[function(_dereq_,module,exports){ +},{}],345:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78797,7 +81419,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":11}],315:[function(_dereq_,module,exports){ +},{"fast-isnumeric":11}],346:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78815,7 +81437,7 @@ module.exports = { max: 'cmax' }; -},{}],316:[function(_dereq_,module,exports){ +},{}],347:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78896,7 +81518,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":45,"../../components/colorscale/defaults":55,"../../components/colorscale/helpers":56,"./subtypes":321}],317:[function(_dereq_,module,exports){ +},{"../../components/color":74,"../../components/colorscale/defaults":84,"../../components/colorscale/helpers":85,"./subtypes":353}],348:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":180,"../../lib":201}],349:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79457,7 +82126,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":67,"../../lib":171,"../../lib/polygon":183,"../../registry":257,"./line_points":311,"./link_traces":313,"./subtypes":321,"d3":9}],318:[function(_dereq_,module,exports){ +},{"../../components/drawing":96,"../../lib":201,"../../lib/polygon":213,"../../registry":288,"./line_points":342,"./link_traces":344,"./subtypes":353,"d3":9}],350:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79511,7 +82180,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":321}],319:[function(_dereq_,module,exports){ +},{"./subtypes":353}],351:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79616,7 +82285,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],320:[function(_dereq_,module,exports){ +},{}],352:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79687,7 +82356,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":67,"../../registry":257,"d3":9}],321:[function(_dereq_,module,exports){ +},{"../../components/drawing":96,"../../registry":288,"d3":9}],353:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79726,7 +82395,7 @@ module.exports = { } }; -},{"../../lib":171}],322:[function(_dereq_,module,exports){ +},{"../../lib":201}],354:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79756,7 +82425,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":171}],323:[function(_dereq_,module,exports){ +},{"../../lib":201}],355:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79800,7 +82469,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":171,"../../registry":257}],324:[function(_dereq_,module,exports){ +},{"../../lib":201,"../../registry":288}],356:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79812,7 +82481,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[4])(4) }); diff --git a/dist/plotly-basic.min.js b/dist/plotly-basic.min.js index 5b05c5f9654..c795dbb9556 100644 --- a/dist/plotly-basic.min.js +++ b/dist/plotly-basic.min.js @@ -1,10 +1,10 @@ /** -* plotly.js (basic - minified) v1.55.2 +* plotly.js (basic - minified) v1.58.0 * Copyright 2012-2020, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=e()}}((function(){return function e(t,r,n){function a(o,l){if(!r[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":171}],2:[function(e,t,r){"use strict";t.exports=e("../src/traces/bar")},{"../src/traces/bar":275}],3:[function(e,t,r){"use strict";t.exports=e("../src/core")},{"../src/core":152}],4:[function(e,t,r){"use strict";var n=e("./core");n.register([e("./bar"),e("./pie")]),t.exports=n},{"./bar":2,"./core":3,"./pie":5}],5:[function(e,t,r){"use strict";t.exports=e("../src/traces/pie")},{"../src/traces/pie":290}],6:[function(e,t,r){var n=Object.create||function(e){var t=function(){};return t.prototype=e,new t},a=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var l,s=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),l=0===c.x}catch(e){l=!1}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r){if(t)e.call(r);else for(var n=e.length,a=_(e,n),i=0;i0&&l.length>i){l.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else l=o[t]=r,++e._eventsCount;return e}function m(){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 e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var s=new Error('Unhandled "error" event. ('+t+")");throw s.context=t,s}if(!(r=o[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:f(r,c,this);break;case 2:d(r,c,this,arguments[1]);break;case 3:p(r,c,this,arguments[1],arguments[2]);break;case 4:h(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(a=new Array(n-1),i=1;i=0;o--)if(r[o]===t||r[o].listener===t){l=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(var r=t,n=r+1,a=e.length;n=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return x(this,e,!0)},o.prototype.rawListeners=function(e){return x(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},o.prototype.listenerCount=b,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],7:[function(e,t,r){!function(n,a){"object"==typeof r&&"undefined"!=typeof t?a(r,e("d3-time")):a((n=n||self).d3=n.d3||{},n.d3)}(this,(function(e,t){"use strict";function r(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function n(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function a(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,o=e.date,s=e.time,c=e.periods,u=e.days,f=e.shortDays,d=e.months,ye=e.shortMonths,xe=p(c),be=h(c),_e=p(u),we=h(u),Te=p(f),ke=h(f),Me=p(d),Ae=h(d),Le=p(ye),Se=h(ye),Ce={a:function(e){return f[e.getDay()]},A:function(e){return u[e.getDay()]},b:function(e){return ye[e.getMonth()]},B:function(e){return d[e.getMonth()]},c:null,d:R,e:R,f:B,H:I,I:F,j:N,L:H,m:j,M:U,p:function(e){return c[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:ve,s:me,S:V,u:q,U:G,V:Z,w:Y,W:X,x:null,X:null,y:W,Y:Q,Z:J,"%":ge},Oe={a:function(e){return f[e.getUTCDay()]},A:function(e){return u[e.getUTCDay()]},b:function(e){return ye[e.getUTCMonth()]},B:function(e){return d[e.getUTCMonth()]},c:null,d:$,e:$,f:ne,H:K,I:ee,j:te,L:re,m:ae,M:ie,p:function(e){return c[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:ve,s:me,S:oe,u:le,U:se,V:ce,w:ue,W:fe,x:null,X:null,y:de,Y:pe,Z:he,"%":ge},De={a:function(e,t,r){var n=Te.exec(t.slice(r));return n?(e.w=ke[n[0].toLowerCase()],r+n[0].length):-1},A:function(e,t,r){var n=_e.exec(t.slice(r));return n?(e.w=we[n[0].toLowerCase()],r+n[0].length):-1},b:function(e,t,r){var n=Le.exec(t.slice(r));return n?(e.m=Se[n[0].toLowerCase()],r+n[0].length):-1},B:function(e,t,r){var n=Me.exec(t.slice(r));return n?(e.m=Ae[n[0].toLowerCase()],r+n[0].length):-1},c:function(e,t,r){return Ee(e,i,t,r)},d:M,e:M,f:D,H:L,I:L,j:A,L:O,m:k,M:S,p:function(e,t,r){var n=xe.exec(t.slice(r));return n?(e.p=be[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:z,s:E,S:C,u:v,U:m,V:y,w:g,W:x,x:function(e,t,r){return Ee(e,o,t,r)},X:function(e,t,r){return Ee(e,s,t,r)},y:_,Y:b,Z:w,"%":P};function Pe(e,t){return function(r){var n,a,i,o=[],s=-1,c=0,u=e.length;for(r instanceof Date||(r=new Date(+r));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(l=n(a(c.y,0,1))).getUTCDay(),l=s>4||0===s?t.utcMonday.ceil(l):t.utcMonday(l),l=t.utcDay.offset(l,7*(c.V-1)),c.y=l.getUTCFullYear(),c.m=l.getUTCMonth(),c.d=l.getUTCDate()+(c.w+6)%7):(s=(l=r(a(c.y,0,1))).getDay(),l=s>4||0===s?t.timeMonday.ceil(l):t.timeMonday(l),l=t.timeDay.offset(l,7*(c.V-1)),c.y=l.getFullYear(),c.m=l.getMonth(),c.d=l.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?n(a(c.y,0,1)).getUTCDay():r(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Ee(e,t,r,n){for(var a,i,o=0,s=t.length,c=r.length;o=c)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=De[a in l?t.charAt(o++):a])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ce.x=Pe(o,Ce),Ce.X=Pe(s,Ce),Ce.c=Pe(i,Ce),Oe.x=Pe(o,Oe),Oe.X=Pe(s,Oe),Oe.c=Pe(i,Oe),{format:function(e){var t=Pe(e+="",Ce);return t.toString=function(){return e},t},parse:function(e){var t=ze(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=Pe(e+="",Oe);return t.toString=function(){return e},t},utcParse:function(e){var t=ze(e+="",!0);return t.toString=function(){return e},t}}}var o,l={"-":"",_:" ",0:"0"},s=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(e,t,r){var n=s.exec(t.slice(r,r+1));return n?(e.q=3*n[0]-3,r+n[0].length):-1}function k(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function M(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function A(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function L(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function S(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function C(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function O(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function D(e,t,r){var n=s.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function P(e,t,r){var n=c.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function z(e,t,r){var n=s.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function E(e,t,r){var n=s.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function R(e,t){return f(e.getDate(),t,2)}function I(e,t){return f(e.getHours(),t,2)}function F(e,t){return f(e.getHours()%12||12,t,2)}function N(e,r){return f(1+t.timeDay.count(t.timeYear(e),e),r,3)}function H(e,t){return f(e.getMilliseconds(),t,3)}function B(e,t){return H(e,t)+"000"}function j(e,t){return f(e.getMonth()+1,t,2)}function U(e,t){return f(e.getMinutes(),t,2)}function V(e,t){return f(e.getSeconds(),t,2)}function q(e){var t=e.getDay();return 0===t?7:t}function G(e,r){return f(t.timeSunday.count(t.timeYear(e)-1,e),r,2)}function Z(e,r){var n=e.getDay();return e=n>=4||0===n?t.timeThursday(e):t.timeThursday.ceil(e),f(t.timeThursday.count(t.timeYear(e),e)+(4===t.timeYear(e).getDay()),r,2)}function Y(e){return e.getDay()}function X(e,r){return f(t.timeMonday.count(t.timeYear(e)-1,e),r,2)}function W(e,t){return f(e.getFullYear()%100,t,2)}function Q(e,t){return f(e.getFullYear()%1e4,t,4)}function J(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+f(t/60|0,"0",2)+f(t%60,"0",2)}function $(e,t){return f(e.getUTCDate(),t,2)}function K(e,t){return f(e.getUTCHours(),t,2)}function ee(e,t){return f(e.getUTCHours()%12||12,t,2)}function te(e,r){return f(1+t.utcDay.count(t.utcYear(e),e),r,3)}function re(e,t){return f(e.getUTCMilliseconds(),t,3)}function ne(e,t){return re(e,t)+"000"}function ae(e,t){return f(e.getUTCMonth()+1,t,2)}function ie(e,t){return f(e.getUTCMinutes(),t,2)}function oe(e,t){return f(e.getUTCSeconds(),t,2)}function le(e){var t=e.getUTCDay();return 0===t?7:t}function se(e,r){return f(t.utcSunday.count(t.utcYear(e)-1,e),r,2)}function ce(e,r){var n=e.getUTCDay();return e=n>=4||0===n?t.utcThursday(e):t.utcThursday.ceil(e),f(t.utcThursday.count(t.utcYear(e),e)+(4===t.utcYear(e).getUTCDay()),r,2)}function ue(e){return e.getUTCDay()}function fe(e,r){return f(t.utcMonday.count(t.utcYear(e)-1,e),r,2)}function de(e,t){return f(e.getUTCFullYear()%100,t,2)}function pe(e,t){return f(e.getUTCFullYear()%1e4,t,4)}function he(){return"+0000"}function ge(){return"%"}function ve(e){return+e}function me(e){return Math.floor(+e/1e3)}function ye(t){return o=i(t),e.timeFormat=o.format,e.timeParse=o.parse,e.utcFormat=o.utcFormat,e.utcParse=o.utcParse,o}ye({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xe=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var be=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=xe,e.isoParse=be,e.timeFormatDefaultLocale=ye,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})}))},{"d3-time":8}],8:[function(e,t,r){!function(e,n){"object"==typeof r&&"undefined"!=typeof t?n(r):n((e=e||self).d3=e.d3||{})}(this,(function(e){"use strict";var t=new Date,r=new Date;function n(e,a,i,o){function l(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return l.floor=function(t){return e(t=new Date(+t)),t},l.ceil=function(t){return e(t=new Date(t-1)),a(t,1),e(t),t},l.round=function(e){var t=l(e),r=l.ceil(e);return e-t0))return o;do{o.push(i=new Date(+t)),a(t,n),e(t)}while(i=r)for(;e(r),!t(r);)r.setTime(r-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;a(e,-1),!t(e););else for(;--r>=0;)for(;a(e,1),!t(e););}))},i&&(l.count=function(n,a){return t.setTime(+n),r.setTime(+a),e(t),e(r),Math.floor(i(t,r))},l.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?l.filter(o?function(t){return o(t)%e==0}:function(t){return l.count(0,t)%e==0}):l:null}),l}var a=n((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?n((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,r){t.setTime(+t+r*e)}),(function(t,r){return(r-t)/e})):a:null};var i=a.range,o=n((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()})),l=o.range,s=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()})),c=s.range,u=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()})),f=u.range,d=n((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1})),p=d.range;function h(e){return n((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var g=h(0),v=h(1),m=h(2),y=h(3),x=h(4),b=h(5),_=h(6),w=g.range,T=v.range,k=m.range,M=y.range,A=x.range,L=b.range,S=_.range,C=n((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),O=C.range,D=n((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));D.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,r){t.setFullYear(t.getFullYear()+r*e)})):null};var P=D.range,z=n((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()})),E=z.range,R=n((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()})),I=R.range,F=n((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1})),N=F.range;function H(e){return n((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var B=H(0),j=H(1),U=H(2),V=H(3),q=H(4),G=H(5),Z=H(6),Y=B.range,X=j.range,W=U.range,Q=V.range,J=q.range,$=G.range,K=Z.range,ee=n((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),te=ee.range,re=n((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));re.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,r){t.setUTCFullYear(t.getUTCFullYear()+r*e)})):null};var ne=re.range;e.timeDay=d,e.timeDays=p,e.timeFriday=b,e.timeFridays=L,e.timeHour=u,e.timeHours=f,e.timeInterval=n,e.timeMillisecond=a,e.timeMilliseconds=i,e.timeMinute=s,e.timeMinutes=c,e.timeMonday=v,e.timeMondays=T,e.timeMonth=C,e.timeMonths=O,e.timeSaturday=_,e.timeSaturdays=S,e.timeSecond=o,e.timeSeconds=l,e.timeSunday=g,e.timeSundays=w,e.timeThursday=x,e.timeThursdays=A,e.timeTuesday=m,e.timeTuesdays=k,e.timeWednesday=y,e.timeWednesdays=M,e.timeWeek=g,e.timeWeeks=w,e.timeYear=D,e.timeYears=P,e.utcDay=F,e.utcDays=N,e.utcFriday=G,e.utcFridays=$,e.utcHour=R,e.utcHours=I,e.utcMillisecond=a,e.utcMilliseconds=i,e.utcMinute=z,e.utcMinutes=E,e.utcMonday=j,e.utcMondays=X,e.utcMonth=ee,e.utcMonths=te,e.utcSaturday=Z,e.utcSaturdays=K,e.utcSecond=o,e.utcSeconds=l,e.utcSunday=B,e.utcSundays=Y,e.utcThursday=q,e.utcThursdays=J,e.utcTuesday=U,e.utcTuesdays=W,e.utcWednesday=V,e.utcWednesdays=Q,e.utcWeek=B,e.utcWeeks=Y,e.utcYear=re,e.utcYears=ne,Object.defineProperty(e,"__esModule",{value:!0})}))},{}],9:[function(e,t,r){!function(){var e={version:"3.5.17"},r=[].slice,n=function(e){return r.call(e)},a=this.document;function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(e){n=function(e){for(var t=e.length,r=new Array(t);t--;)r[t]=e[t];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(e,t){s.call(this,e,t+"")},l.setAttributeNS=function(e,t,r){c.call(this,e,t,r+"")},u.setProperty=function(e,t,r){f.call(this,e,t+"",r)}}function d(e,t){return et?1:e>=t?0:NaN}function p(e){return null===e?NaN:+e}function h(e){return!isNaN(e)}function g(e){return{left:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)<0?n=i+1:a=i}return n},right:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)>0?a=i:n=i+1}return n}}}e.ascending=d,e.descending=function(e,t){return te?1:t>=e?0:NaN},e.min=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},e.max=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},e.extent=function(e,t){var r,n,a,i=-1,o=e.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var v=g(d);function m(e){return e.length}e.bisectLeft=v.left,e.bisect=e.bisectRight=v.right,e.bisector=function(e){return g(1===e.length?function(t,r){return d(e(t),r)}:e)},e.shuffle=function(e,t,r){(i=arguments.length)<3&&(r=e.length,i<2&&(t=0));for(var n,a,i=r-t;i;)a=Math.random()*i--|0,n=e[i+t],e[i+t]=e[a+t],e[a+t]=n;return e},e.permute=function(e,t){for(var r=t.length,n=new Array(r);r--;)n[r]=e[t[r]];return n},e.pairs=function(e){for(var t=0,r=e.length-1,n=e[0],a=new Array(r<0?0:r);t=0;)for(t=(n=e[a]).length;--t>=0;)r[--o]=n[t];return r};var y=Math.abs;function x(e){for(var t=1;e*t%1;)t*=10;return t}function b(e,t){for(var r in t)Object.defineProperty(e.prototype,r,{value:t[r],enumerable:!1})}function _(){this._=Object.create(null)}e.range=function(e,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=e,e=0)),(t-e)/r==1/0)throw new Error("infinite range");var n,a=[],i=x(y(r)),o=-1;if(e*=i,t*=i,(r*=i)<0)for(;(n=e+r*++o)>t;)a.push(n/i);else for(;(n=e+r*++o)=a.length)return r?r.call(n,i):t?i.sort(t):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return t;var n=[],o=i[r++];return t.forEach((function(t,a){n.push({key:t,values:e(a,r)})})),o?n.sort((function(e,t){return o(e.key,t.key)})):n}(o(e.map,t,0),0)},n.key=function(e){return a.push(e),n},n.sortKeys=function(e){return i[a.length-1]=e,n},n.sortValues=function(e){return t=e,n},n.rollup=function(e){return r=e,n},n},e.set=function(e){var t=new C;if(e)for(var r=0,n=e.length;r=0&&(n=e.slice(r+1),e=e.slice(0,r)),e)return arguments.length<2?this[e].on(n):this[e].on(n,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(n,null);return this}},e.event=null,e.requote=function(e){return e.replace(B,"\\$&")};var B=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,j={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)e[r]=t[r]};function U(e){return j(e,Z),e}var V=function(e,t){return t.querySelector(e)},q=function(e,t){return t.querySelectorAll(e)},G=function(e,t){var r=e.matches||e[P(e,"matchesSelector")];return(G=function(e,t){return r.call(e,t)})(e,t)};"function"==typeof Sizzle&&(V=function(e,t){return Sizzle(e,t)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),e.selection=function(){return e.select(a.documentElement)};var Z=e.selection.prototype=[];function Y(e){return"function"==typeof e?e:function(){return V(e,this)}}function X(e){return"function"==typeof e?e:function(){return q(e,this)}}Z.select=function(e){var t,r,n,a,i=[];e=Y(e);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=e.slice(0,t))&&(e=e.slice(t+1)),Q.hasOwnProperty(r)?{space:Q[r],local:e}:e}},Z.attr=function(t,r){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=e.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(r in t)this.each(J(r,t[r]));return this}return this.each(J(t,r))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node(),n=(e=ee(e)).length,a=-1;if(t=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(e){e=ce.apply(this,arguments);for(var t=-1,r=this.length;++t=t&&(t=a+1);!(o=l[t])&&++t0&&(t=t.slice(0,o));var s=ge.get(t);function c(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return s&&(t=s,l=me),o?r?function(){var e=l(r,n(arguments));c.call(this),this.addEventListener(t,this[i]=e,e.$=a),e._=r}:c:r?E:function(){var r,n=new RegExp("^__on([^.]+)"+e.requote(t)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}e.selection.enter=fe,e.selection.enter.prototype=de,de.append=Z.append,de.empty=Z.empty,de.node=Z.node,de.call=Z.call,de.size=Z.size,de.select=function(e){for(var t,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:e<0?-1:0}function ze(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(t[1]-e[1])*(r[0]-e[0])}function Ee(e){return e>1?0:e<-1?Ae:Math.acos(e)}function Re(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function Ie(e){return((e=Math.exp(e))+1/e)/2}function Fe(e){return(e=Math.sin(e/2))*e}var Ne=Math.SQRT2;e.interpolateZoom=function(e,t){var r,n,a=e[0],i=e[1],o=e[2],l=t[0],s=t[1],c=t[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(t=t.transition().duration(g)),t.call(w.event)}function L(){c&&c.domain(s.range().map((function(e){return(e-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(e){return(e-d.y)/d.k})).map(u.invert))}function S(e){v++||e({type:"zoomstart"})}function C(e){L(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function O(e){--v||(e({type:"zoomend"}),r=null)}function D(){var t=this,r=_.of(t,arguments),n=0,a=e.select(o(t)).on(y,s).on(x,c),i=T(e.mouse(t)),l=be(t);function s(){n=1,M(e.mouse(t),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),O(r)}ml.call(t),S(r)}function P(){var t,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+e.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=e.select(r),p=be(r);function h(){var n=e.touches(r);return t=d.k,n.forEach((function(e){e.identifier in a&&(a[e.identifier]=T(e))})),n}function g(){var t=e.event.target;e.select(t).on(s,v).on(c,y),u.push(t);for(var n=e.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=e.touches(r);ml.call(r);for(var d=0,p=f.length;d360?e-=360:e<0&&(e+=360),e<60?n+(a-n)*e/60:e<180?a:e<240?n+(a-n)*(240-e)/60:n}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+t):r+t-r*t),new nt(i(e+120),i(e),i(e-120))}function Ze(t,r,n){return this instanceof Ze?(this.h=+t,this.c=+r,void(this.l=+n)):arguments.length<2?t instanceof Ze?new Ze(t.h,t.c,t.l):Ke(t instanceof We?t.l:(t=ut((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Ze(t,r,n)}qe.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new Ve(this.h,this.s,this.l/e)},qe.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new Ve(this.h,this.s,e*this.l)},qe.rgb=function(){return Ge(this.h,this.s,this.l)},e.hcl=Ze;var Ye=Ze.prototype=new Ue;function Xe(e,t,r){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new We(r,Math.cos(e*=Oe)*t,Math.sin(e)*t)}function We(e,t,r){return this instanceof We?(this.l=+e,this.a=+t,void(this.b=+r)):arguments.length<2?e instanceof We?new We(e.l,e.a,e.b):e instanceof Ze?Xe(e.h,e.c,e.l):ut((e=nt(e)).r,e.g,e.b):new We(e,t,r)}Ye.brighter=function(e){return new Ze(this.h,this.c,Math.min(100,this.l+Qe*(arguments.length?e:1)))},Ye.darker=function(e){return new Ze(this.h,this.c,Math.max(0,this.l-Qe*(arguments.length?e:1)))},Ye.rgb=function(){return Xe(this.h,this.c,this.l).rgb()},e.lab=We;var Qe=18,Je=We.prototype=new Ue;function $e(e,t,r){var n=(e+16)/116,a=n+t/500,i=n-r/200;return new nt(rt(3.2404542*(a=.95047*et(a))-1.5371385*(n=1*et(n))-.4985314*(i=1.08883*et(i))),rt(-.969266*a+1.8760108*n+.041556*i),rt(.0556434*a-.2040259*n+1.0572252*i))}function Ke(e,t,r){return e>0?new Ze(Math.atan2(r,t)*De,Math.sqrt(t*t+r*r),e):new Ze(NaN,NaN,e)}function et(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function tt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function rt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function nt(e,t,r){return this instanceof nt?(this.r=~~e,this.g=~~t,void(this.b=~~r)):arguments.length<2?e instanceof nt?new nt(e.r,e.g,e.b):st(""+e,nt,Ge):new nt(e,t,r)}function at(e){return new nt(e>>16,e>>8&255,255&e)}function it(e){return at(e)+""}Je.brighter=function(e){return new We(Math.min(100,this.l+Qe*(arguments.length?e:1)),this.a,this.b)},Je.darker=function(e){return new We(Math.max(0,this.l-Qe*(arguments.length?e:1)),this.a,this.b)},Je.rgb=function(){return $e(this.l,this.a,this.b)},e.rgb=nt;var ot=nt.prototype=new Ue;function lt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function st(e,t,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return t(dt(a[0]),dt(a[1]),dt(a[2]))}return(i=pt.get(e))?t(i.r,i.g,i.b):(null==e||"#"!==e.charAt(0)||isNaN(i=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===e.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),t(o,l,s))}function ct(e,t,r){var n,a,i=Math.min(e/=255,t/=255,r/=255),o=Math.max(e,t,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=e==o?(t-r)/l+(t0&&s<1?0:n),new Ve(n,a,s)}function ut(e,t,r){var n=tt((.4124564*(e=ft(e))+.3575761*(t=ft(t))+.1804375*(r=ft(r)))/.95047),a=tt((.2126729*e+.7151522*t+.072175*r)/1);return We(116*a-16,500*(n-a),200*(a-tt((.0193339*e+.119192*t+.9503041*r)/1.08883)))}function ft(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ot.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,r=this.g,n=this.b,a=30;return t||r||n?(t&&t=200&&t<300||304===t){try{e=a.call(o,c)}catch(e){return void l.error.call(o,e)}l.load.call(o,e)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var r=e.event;e.event=t;try{l.progress.call(o,c)}finally{e.event=r}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(r=null==e?null:e+"",o):r},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return a=e,o},["get","post"].forEach((function(e){o[e]=function(){return o.send.apply(o,[e].concat(n(arguments)))}})),o.send=function(e,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(e,t,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(e){a(null,e)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},e.rebind(o,l,"on"),null==i?o:o.get(function(e){return 1===e.length?function(t,r){e(null==t?r:null)}:e}(i))}pt.forEach((function(e,t){pt.set(e,at(t))})),e.functor=ht,e.xhr=gt(O),e.dsv=function(e,t){var r=new RegExp('["'+e+"\n]"),n=e.charCodeAt(0);function a(e,r,n){arguments.length<3&&(n=r,r=null);var a=vt(e,t,null==r?i:o(r),n);return a.row=function(e){return arguments.length?a.response(null==(r=e)?i:o(e)):r},a}function i(e){return a.parse(e.responseText)}function o(e){return function(t){return a.parse(t.responseText,e)}}function l(t){return t.map(s).join(e)}function s(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return a.parse=function(e,t){var r;return a.parseRows(e,(function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");r=t?function(e,r){return t(a(e),r)}:a}))},a.parseRows=function(e,t){var r,a,i={},o={},l=[],s=e.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var t=c;if(34===e.charCodeAt(t)){for(var r=t;r++24?(isFinite(t)&&(clearTimeout(bt),bt=setTimeout(Tt,t)),xt=0):(xt=1,_t(Tt))}function kt(){for(var e=Date.now(),t=mt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Mt(){for(var e,t=mt,r=1/0;t;)t.c?(t.t8?function(e){return e/r}:function(e){return e*r},symbol:e}}));function St(t){var r=t.decimal,n=t.thousands,a=t.grouping,i=t.currency,o=a&&n?function(e,t){for(var r=e.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>t&&(l=Math.max(1,t-s)),i.push(e.substring(r-=l,r+l)),!((s+=l+1)>t));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:O;return function(t){var n=Ct.exec(t),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Ot.get(h)||Dt;var b=u&&d;return function(t){var n=m;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(g<0){var c=e.formatPrefix(t,p);t=c.scale(t),n=c.symbol+m}else t*=g;var _,w,T=(t=h(t,p)).lastIndexOf(".");if(T<0){var k=x?t.lastIndexOf("e"):-1;k<0?(_=t,w=""):(_=t.substring(0,k),w=t.substring(k))}else _=t.substring(0,T),w=r+t.substring(T+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+t:"^"===l?A.substring(0,M>>=1)+i+t+A.substring(M):i+(b?t:A+t))+n}}}e.formatPrefix=function(t,r){var n=0;return(t=+t)&&(t<0&&(t*=-1),r&&(t=e.round(t,At(t,r))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Lt[8+n/3]};var Ct=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ot=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,r){return(t=e.round(t,At(t,r))).toFixed(Math.max(0,Math.min(20,At(t*(1+1e-15),r))))}});function Dt(e){return e+""}var Pt=e.time={},zt=Date;function Et(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Et.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(){Rt.setUTCDate.apply(this._,arguments)},setDay:function(){Rt.setUTCDay.apply(this._,arguments)},setFullYear:function(){Rt.setUTCFullYear.apply(this._,arguments)},setHours:function(){Rt.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Rt.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Rt.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Rt.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Rt.setUTCSeconds.apply(this._,arguments)},setTime:function(){Rt.setTime.apply(this._,arguments)}};var Rt=Date.prototype;function It(e,t,r){function n(t){var r=e(t),n=i(r,1);return t-r1)for(;o=c)return-1;if(37===(a=t.charCodeAt(l++))){if(o=t.charAt(l++),!(i=w[o in Ht?t.charAt(l++):o])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(e){var t=u(e);function r(e){try{var r=new(zt=Et);return r._=e,t(r)}finally{zt=Date}}return r.parse=function(e){try{zt=Et;var r=t.parse(e);return r&&r._}finally{zt=Date}},r.toString=t.toString,r},u.multi=u.utc.multi=or;var d=e.map(),p=Vt(o),h=qt(o),g=Vt(l),v=qt(l),m=Vt(s),y=qt(s),x=Vt(c),b=qt(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var _={a:function(e){return l[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:u(r),d:function(e,t){return Ut(e.getDate(),t,2)},e:function(e,t){return Ut(e.getDate(),t,2)},H:function(e,t){return Ut(e.getHours(),t,2)},I:function(e,t){return Ut(e.getHours()%12||12,t,2)},j:function(e,t){return Ut(1+Pt.dayOfYear(e),t,3)},L:function(e,t){return Ut(e.getMilliseconds(),t,3)},m:function(e,t){return Ut(e.getMonth()+1,t,2)},M:function(e,t){return Ut(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Ut(e.getSeconds(),t,2)},U:function(e,t){return Ut(Pt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Ut(Pt.mondayOfYear(e),t,2)},x:u(n),X:u(a),y:function(e,t){return Ut(e.getFullYear()%100,t,2)},Y:function(e,t){return Ut(e.getFullYear()%1e4,t,4)},Z:ar,"%":function(){return"%"}},w={a:function(e,t,r){g.lastIndex=0;var n=g.exec(t.slice(r));return n?(e.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){p.lastIndex=0;var n=p.exec(t.slice(r));return n?(e.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){x.lastIndex=0;var n=x.exec(t.slice(r));return n?(e.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){m.lastIndex=0;var n=m.exec(t.slice(r));return n?(e.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,t,r){return f(e,_.c.toString(),t,r)},d:$t,e:$t,H:er,I:er,j:Kt,L:nr,m:Jt,M:tr,p:function(e,t,r){var n=d.get(t.slice(r,r+=2).toLowerCase());return null==n?-1:(e.p=n,r)},S:rr,U:Zt,w:Gt,W:Yt,x:function(e,t,r){return f(e,_.x.toString(),t,r)},X:function(e,t,r){return f(e,_.X.toString(),t,r)},y:Wt,Y:Xt,Z:Qt,"%":ir};return u}Pt.year=It((function(e){return(e=Pt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Pt.years=Pt.year.range,Pt.years.utc=Pt.year.utc.range,Pt.day=It((function(e){var t=new zt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Pt.days=Pt.day.range,Pt.days.utc=Pt.day.utc.range,Pt.dayOfYear=function(e){var t=Pt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var r=Pt[e]=It((function(e){return(e=Pt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)-(r!==t)}));Pt[e+"s"]=r.range,Pt[e+"s"].utc=r.utc.range,Pt[e+"OfYear"]=function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)}})),Pt.week=Pt.sunday,Pt.weeks=Pt.sunday.range,Pt.weeks.utc=Pt.sunday.utc.range,Pt.weekOfYear=Pt.sundayOfYear;var Ht={"-":"",_:" ",0:"0"},Bt=/^\s*\d+/,jt=/^%/;function Ut(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Qt(e,t,r){return/^[+-]\d{4}$/.test(t=t.slice(r,r+5))?(e.Z=-t,r+5):-1}function Jt(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function $t(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Kt(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+3));return n?(e.j=+n[0],r+n[0].length):-1}function er(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ar(e){var t=e.getTimezoneOffset(),r=t>0?"-":"+",n=y(t)/60|0,a=y(t)%60;return r+Ut(n,"0",2)+Ut(a,"0",2)}function ir(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function or(e){for(var t=e.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(t),c=Math.sin(t),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=e,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(e=o)*Oe,n=Math.cos(l=(t=l)*Oe/2+Ae/4),a=Math.sin(l)},Cr.lineEnd=function(){i(e,t)}}function Dr(e){var t=e[0],r=e[1],n=Math.cos(r);return[n*Math.cos(t),n*Math.sin(t),Math.sin(r)]}function Pr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zr(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Er(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Rr(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ir(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Fr(e){return[Math.atan2(e[1],e[0]),Re(e[2])]}function Nr(e,t){return y(e[0]-t[0])ke?a=90:c<-ke&&(r=-90),f[0]=t,f[1]=n}};function p(e,i){u.push(f=[t=e,n=e]),ia&&(a=i)}function h(e,o){var l=Dr([e*Oe,o*Oe]);if(s){var c=zr(s,l),u=zr([c[1],-c[0],0],c);Ir(u),u=Fr(u);var f=e-i,d=f>0?1:-1,h=u[0]*De*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?e_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e):n>=t?(en&&(n=e)):e>i?_(t,e)>_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e)}else p(e,o);s=l,i=e}function g(){d.point=h}function v(){f[0]=t,f[1]=n,d.point=p,s=null}function m(e,t){if(s){var r=e-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=e,l=t;Cr.point(e,t),h(e,t)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>ke&&(t=-(n=180)),f[0]=t,f[1]=n,s=null}function _(e,t){return(t-=e)<0?t+360:t}function w(e,t){return e[0]-t[0]}function T(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,t=p[0],n=g[1])}return u=f=null,t===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,r],[n,a]]}}(),e.geo.centroid=function(t){mr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Lr=0,e.geo.stream(t,Hr);var r=Mr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Xr(e){if(t=e.length){for(var t,r,n=0,a=e[0];++n=0?1:-1,T=w*_,k=T>Ae,M=h*x;if(Sr.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*Le:_,k^d>=r^m>=r){var A=zr(Dr(f),Dr(e));Ir(A);var L=zr(a,A);Ir(L);var S=(k^_>=0?-1:1)*Re(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=e}}return(i<-ke||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&t&&r.push(r.pop().concat(r.shift())),l.push(r.filter(Jr))}return u}}function Jr(e){return e.length>1}function $r(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,r){e.push([t,r])},lineEnd:E,buffer:function(){var r=t;return t=[],e=null,r},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Kr(e,t){return((e=e.x)[0]<0?e[1]-Ce-ke:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-ke:Ce-t[1])}var en=Qr(Zr,(function(e){var t,r=NaN,n=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var l=i>0?Ae:-Ae,s=y(i-r);y(s-Ae)0?Ce:-Ce),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),e.point(i,n),t=0):a!==l&&s>=Ae&&(y(r-a)ke?Math.atan((Math.sin(t)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(t))*Math.sin(e))/(a*i*o)):(t+n)/2}(r,n,i,o),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),t=0),e.point(r=i,n=o),a=l},lineEnd:function(){e.lineEnd(),r=n=NaN},clean:function(){return 2-t}}}),(function(e,t,r,n){var a;if(null==e)a=r*Ce,n.point(-Ae,a),n.point(0,a),n.point(Ae,a),n.point(Ae,0),n.point(Ae,-a),n.point(0,-a),n.point(-Ae,-a),n.point(-Ae,0),n.point(-Ae,a);else if(y(e[0]-t[0])>ke){var i=e[0]0,n=y(t)>ke;return Qr(a,(function(e){var t,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?Ae:-Ae),d):0;if(!t&&(c=s=g)&&e.lineStart(),g!==s&&(p=i(t,h),(Nr(t,p)||Nr(h,p))&&(h[0]+=ke,h[1]+=ke,g=a(h[0],h[1]))),g!==s)u=0,g?(e.lineStart(),p=i(h,t),e.point(p[0],p[1])):(p=i(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(n&&t&&r^g){var m;v&l||!(m=i(h,t,!0))||(u=0,r?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!g||t&&Nr(t,h)||e.point(h[0],h[1]),t=h,s=g,l=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(c&&s)<<1}}}),Nn(e,6*Oe),r?[0,-e]:[-Ae,e-Ae]);function a(e,r){return Math.cos(e)*Math.cos(r)>t}function i(e,r,n){var a=[1,0,0],i=zr(Dr(e),Dr(r)),o=Pr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&e;var c=t*o/s,u=-t*l/s,f=zr(a,i),d=Rr(a,c);Er(d,Rr(i,u));var p=f,h=Pr(d,p),g=Pr(p,p),v=h*h-g*(Pr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Rr(p,(-h-m)/g);if(Er(x,d),x=Fr(x),!n)return x;var b,_=e[0],w=r[0],T=e[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-Ae)0^x[1]<(y(x[0]-_)Ae^(_<=x[0]&&x[0]<=w)){var L=Rr(p,(-h+m)/g);return Er(L,d),[x,Fr(L)]}}}function o(t,n){var a=r?e:Ae-e,i=0;return t<-a?i|=1:t>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(e,t,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=e-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(t,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=$r(),w=rn(t,r,n,a),T={point:A,lineStart:function(){T.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));T.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=e.merge(c);var r=function(e){for(var t=0,r=u.length,n=e[1],a=0;an&&ze(c,i,e)>0&&++t:i[1]<=n&&ze(c,i,e)<0&&--t,c=i;return 0!==t}([t,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),i&&Yr(c,o,r,k,s),s.polygonEnd()),c=u=f=null}};function k(e,o,s,c){var u=0,f=0;if(null==e||(u=i(e,s))!==(f=i(o,s))||l(e,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(e,i){return t<=e&&e<=n&&r<=i&&i<=a}function A(e,t){M(e,t)&&s.point(e,t)}function L(e,t){var r=M(e=Math.max(-1e9,Math.min(1e9,e)),t=Math.max(-1e9,Math.min(1e9,t)));if(u&&f.push([e,t]),y)d=e,p=t,h=r,y=!1,r&&(s.lineStart(),s.point(e,t));else if(r&&m)s.point(e,t);else{var n={a:{x:g,y:v},b:{x:e,y:t}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(e,t),x=!1)}g=e,v=t,m=r}return T};function i(e,a){return y(e[0]-t)0?0:3:y(e[0]-n)0?2:1:y(e[1]-r)0?1:0:a>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var r=i(e,1),n=i(t,1);return r!==n?r-n:0===r?t[1]-e[1]:1===r?e[0]-t[0]:2===r?e[1]-t[1]:t[0]-e[0]}}function an(e){var t=0,r=Ae/3,n=On(e),a=n(t,r);return a.parallels=function(e){return arguments.length?n(t=e[0]*Ae/180,r=e[1]*Ae/180):[t/Ae*180,r/Ae*180]},a}function on(e,t){var r=Math.sin(e),n=(r+Math.sin(t))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(e,t){var r=Math.sqrt(a-2*n*Math.sin(t))/n;return[r*Math.sin(e*=n),i-r*Math.cos(e)]}return o.invert=function(e,t){var r=i-t;return[Math.atan2(e,r)/n,Re((a-(e*e+r*r)*n*n)/(2*n))]},o}e.geo.clipExtent=function(){var e,t,r,n,a,i,o={stream:function(e){return a&&(a.valid=!1),(a=i(e)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(e=+l[0][0],t=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=null),o):[[e,t],[r,n]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return an(on)}).raw=on,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){var t,r,n,a,i=e.geo.albers(),o=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(e,r){t=[e,r]}};function c(e){var i=e[0],o=e[1];return t=null,r(i,o),t||(n(i,o),t)||a(i,o),t}return c.invert=function(e){var t=i.scale(),r=i.translate(),n=(e[0]-r[0])/t,a=(e[1]-r[1])/t;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(e)},c.stream=function(e){var t=i.stream(e),r=o.stream(e),n=l.stream(e);return{point:function(e,a){t.point(e,a),r.point(e,a),n.point(e,a)},sphere:function(){t.sphere(),r.sphere(),n.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),l.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),l.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var t=i.scale(),u=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[u-.455*t,f-.238*t],[u+.455*t,f+.238*t]]).stream(s).point,n=o.translate([u-.307*t,f+.201*t]).clipExtent([[u-.425*t+ke,f+.12*t+ke],[u-.214*t-ke,f+.234*t-ke]]).stream(s).point,a=l.translate([u-.205*t,f+.212*t]).clipExtent([[u-.214*t+ke,f+.166*t+ke],[u-.115*t-ke,f+.234*t-ke]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:E,lineStart:E,lineEnd:E,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=E,ln+=y(sn/2)}};function hn(){var e,t,r,n;function a(e,t){sn+=n*e-r*t,r=e,n=t}pn.point=function(i,o){pn.point=a,e=r=i,t=n=o},pn.lineEnd=function(){a(e,t)}}var gn={point:function(e,t){efn&&(fn=e);tdn&&(dn=t)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E};function vn(){var e=mn(4.5),t=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=mn(t),r},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function n(r,n){t.push("M",r,",",n,e)}function a(e,n){t.push("M",e,",",n),r.point=i}function i(e,r){t.push("L",e,",",r)}function o(){r.point=n}function l(){t.push("Z")}return r}function mn(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var yn,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(e,t){xr+=e,br+=t,++_r}function _n(){var e,t;function r(r,n){var a=r-e,i=n-t,o=Math.sqrt(a*a+i*i);wr+=o*(e+r)/2,Tr+=o*(t+n)/2,kr+=o,bn(e=r,t=n)}xn.point=function(n,a){xn.point=r,bn(e=n,t=a)}}function wn(){xn.point=bn}function Tn(){var e,t,r,n;function a(e,t){var a=e-r,i=t-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+e)/2,Tr+=o*(n+t)/2,kr+=o,Mr+=(o=n*e-r*t)*(r+e),Ar+=o*(n+t),Lr+=3*o,bn(r=e,n=t)}xn.point=function(i,o){xn.point=a,bn(e=r=i,t=n=o)},xn.lineEnd=function(){a(e,t)}}function kn(e){var t=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=e,r},result:E};function n(r,n){e.moveTo(r+t,n),e.arc(r,n,t,0,Le)}function a(t,n){e.moveTo(t,n),r.point=i}function i(t,r){e.lineTo(t,r)}function o(){r.point=n}function l(){e.closePath()}return r}function Mn(e){var t=.5,r=Math.cos(30*Oe),n=16;function a(e){return(n?o:i)(e)}function i(t){return Sn(t,(function(r,n){r=e(r,n),t.point(r[0],r[1])}))}function o(t){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),v.lineStart=_},polygonEnd:function(){t.polygonEnd(),v.lineStart=y}};function m(r,n){r=e(r,n),t.point(r[0],r[1])}function y(){f=NaN,v.point=x,t.lineStart()}function x(r,a){var i=Dr([r,a]),o=e(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,t),t.point(f,d)}function b(){v.point=m,t.lineEnd()}function _(){y(),v.point=w,v.lineEnd=T}function w(e,t){x(r=e,t),a=f,i=d,o=p,s=h,c=g,v.point=x}function T(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,t),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*t&&v--){var w=o+p,T=s+h,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),L=y(y(k)-1)t||y((x*D+b*P)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(t)},a}function An(e){var t=Mn((function(t,r){return e([t*De,r*De])}));return function(e){return Dn(t(e))}}function Ln(e){this.stream=e}function Sn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Cn(e){return On((function(){return e}))()}function On(t){var r,n,a,i,o,l,s=Mn((function(e,t){return[(e=r(e,t))[0]*c+i,o-e[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=en,y=O,x=null,b=null;function _(e){return[(e=a(e[0]*Oe,e[1]*Oe))[0]*c+i,o-e[1]*c]}function w(e){return(e=a.invert((e[0]-i)/c,(o-e[1])/c))&&[e[0]*De,e[1]*De]}function T(){a=Gr(n=En(h,g,v),r);var e=r(d,p);return i=u-e[0]*c,o=f+e[1]*c,k()}function k(){return l&&(l.valid=!1,l=null),_}return _.stream=function(e){return l&&(l.valid=!1),(l=Dn(m(n,s(y(e))))).valid=!0,l},_.clipAngle=function(e){return arguments.length?(m=null==e?(x=e,en):tn((x=+e)*Oe),k()):x},_.clipExtent=function(e){return arguments.length?(b=e,y=e?nn(e[0][0],e[0][1],e[1][0],e[1][1]):O,k()):b},_.scale=function(e){return arguments.length?(c=+e,T()):c},_.translate=function(e){return arguments.length?(u=+e[0],f=+e[1],T()):[u,f]},_.center=function(e){return arguments.length?(d=e[0]%360*Oe,p=e[1]%360*Oe,T()):[d*De,p*De]},_.rotate=function(e){return arguments.length?(h=e[0]%360*Oe,g=e[1]%360*Oe,v=e.length>2?e[2]%360*Oe:0,T()):[h*De,g*De,v*De]},e.rebind(_,s,"precision"),function(){return r=t.apply(this,arguments),_.invert=r.invert&&w,T()}}function Dn(e){return Sn(e,(function(t,r){e.point(t*Oe,r*Oe)}))}function Pn(e,t){return[e,t]}function zn(e,t){return[e>Ae?e-Le:e<-Ae?e+Le:e,t]}function En(e,t,r){return e?t||r?Gr(In(e),Fn(t,r)):In(e):t||r?Fn(t,r):zn}function Rn(e){return function(t,r){return[(t+=e)>Ae?t-Le:t<-Ae?t+Le:t,r]}}function In(e){var t=Rn(e);return t.invert=Rn(-e),t}function Fn(e,t){var r=Math.cos(e),n=Math.sin(e),a=Math.cos(t),i=Math.sin(t);function o(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),Re(u*a+s*i)]}return o.invert=function(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),Re(u*r-l*n)]},o}function Nn(e,t){var r=Math.cos(e),n=Math.sin(e);return function(a,i,o,l){var s=o*t;null!=a?(a=Hn(r,a),i=Hn(r,i),(o>0?ai)&&(a+=o*Le)):(a=e+o*Le,i=e-.5*s);for(var c,u=a;o>0?u>i:u2?e[2]*Oe:0),t.invert=function(t){return(t=e.invert(t[0]*Oe,t[1]*Oe))[0]*=De,t[1]*=De,t},t},zn.invert=Pn,e.geo.circle=function(){var e,t,r=[0,0],n=6;function a(){var e="function"==typeof r?r.apply(this,arguments):r,n=En(-e[0]*Oe,-e[1]*Oe,0).invert,a=[];return t(null,null,1,{point:function(e,t){a.push(e=n(e,t)),e[0]*=De,e[1]*=De}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(e){return arguments.length?(r=e,a):r},a.angle=function(r){return arguments.length?(t=Nn((e=+r)*Oe,n*Oe),a):e},a.precision=function(r){return arguments.length?(t=Nn(e*Oe,(n=+r)*Oe),a):n},a.angle(90)},e.geo.distance=function(e,t){var r,n=(t[0]-e[0])*Oe,a=e[1]*Oe,i=t[1]*Oe,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},e.geo.graticule=function(){var t,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(a/g)*g,n,g).map(f).concat(e.range(Math.ceil(s/v)*v,l,v).map(d)).concat(e.range(Math.ceil(r/p)*p,t,p).filter((function(e){return y(e%g)>ke})).map(c)).concat(e.range(Math.ceil(o/h)*h,i,h).filter((function(e){return y(e%v)>ke})).map(u))}return x.lines=function(){return b().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(a=+e[0][0],n=+e[1][0],s=+e[0][1],l=+e[1][1],a>n&&(e=a,a=n,n=e),s>l&&(e=s,s=l,l=e),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(e){return arguments.length?(r=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],r>t&&(e=r,r=t,t=e),o>i&&(e=o,o=i,i=e),x.precision(m)):[[r,o],[t,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],x):[g,v]},x.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],x):[p,h]},x.precision=function(e){return arguments.length?(m=+e,c=Bn(o,i,90),u=jn(r,t,m),f=Bn(s,l,90),d=jn(a,n,m),x):m},x.majorExtent([[-180,-90+ke],[180,90-ke]]).minorExtent([[-180,-80-ke],[180,80+ke]])},e.geo.greatArc=function(){var t,r,n=Un,a=Vn;function i(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return e.geo.distance(t||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,i):n},i.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,i):a},i.precision=function(){return arguments.length?i:0},i},e.geo.interpolate=function(e,t){return r=e[0]*Oe,n=e[1]*Oe,a=t[0]*Oe,i=t[1]*Oe,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Fe(i-n)+o*s*Fe(a-r))),g=1/Math.sin(h),(v=h?function(e){var t=Math.sin(e*=h)*g,r=Math.sin(h-e)*g,n=r*u+t*d,a=r*f+t*p,i=r*l+t*c;return[Math.atan2(a,n)*De,Math.atan2(i,Math.sqrt(n*n+a*a))*De]}:function(){return[r*De,n*De]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},e.geo.length=function(t){return yn=0,e.geo.stream(t,qn),yn};var qn={sphere:E,point:E,lineStart:function(){var e,t,r;function n(n,a){var i=Math.sin(a*=Oe),o=Math.cos(a),l=y((n*=Oe)-e),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-t*o*s)*l),t*i+r*o*s),e=n,t=i,r=o}qn.point=function(a,i){e=a*Oe,t=Math.sin(i*=Oe),r=Math.cos(i),qn.point=n},qn.lineEnd=function(){qn.point=qn.lineEnd=E}},lineEnd:E,polygonStart:E,polygonEnd:E};function Gn(e,t){function r(t,r){var n=Math.cos(t),a=Math.cos(r),i=e(n*a);return[i*a*Math.sin(t),i*Math.sin(r)]}return r.invert=function(e,r){var n=Math.sqrt(e*e+r*r),a=t(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(e*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(e.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Yn=Gn((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),O);function Xn(e,t){var r=Math.cos(e),n=function(e){return Math.tan(Ae/4+e/2)},a=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(n(t)/n(e)),i=r*Math.pow(n(e),a)/a;if(!a)return Jn;function o(e,t){i>0?t<-Ce+ke&&(t=-Ce+ke):t>Ce-ke&&(t=Ce-ke);var r=i/Math.pow(n(t),a);return[r*Math.sin(a*e),i-r*Math.cos(a*e)]}return o.invert=function(e,t){var r=i-t,n=Pe(a)*Math.sqrt(e*e+r*r);return[Math.atan2(e,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ce]},o}function Wn(e,t){var r=Math.cos(e),n=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),a=r/n+e;if(y(n)1&&ze(e[r[n-2]],e[r[n-1]],e[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(e,t){return e[0]-t[0]||e[1]-t[1]}(e.geo.stereographic=function(){return Cn(ea)}).raw=ea,ta.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ce]},(e.geo.transverseMercator=function(){var e=$n(ta),t=e.center,r=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?r([e[0],e[1],e.length>2?e[2]+90:90]):[(e=r())[0],e[1],e[2]-90]},r([0,0,90])}).raw=ta,e.geom={},e.geom.hull=function(e){var t=ra,r=na;if(arguments.length)return n(e);function n(e){if(e.length<3)return[];var n,a=ht(t),i=ht(r),o=e.length,l=[],s=[];for(n=0;n=0;--n)p.push(e[l[c[n]][2]]);for(n=+f;nke)l=l.L;else{if(!((a=i-Ta(l,o))>ke)){n>-ke?(t=l.P,r=l):a>-ke?(t=l,r=l.N):t=r=l;break}if(!l.R){t=l;break}l=l.R}var s=ya(e);if(da.insert(t,s),t||r){if(t===r)return Sa(t),r=ya(t.site),da.insert(s,r),s.edge=r.edge=Da(t.site,s.site),La(t),void La(r);if(r){Sa(t),Sa(r);var c=t.site,u=c.x,f=c.y,d=e.x-u,p=e.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};za(r.edge,c,h,b),s.edge=Da(c,e,null,b),r.edge=Da(e,h,null,b),La(t),La(r)}else s.edge=Da(t.site,s.site)}}function wa(e,t){var r=e.site,n=r.x,a=r.y,i=a-t;if(!i)return n;var o=e.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-t;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function Ta(e,t){var r=e.N;if(r)return wa(r,t);var n=e.site;return n.y===t?n.x:1/0}function ka(e){this.site=e,this.edges=[]}function Ma(e,t){return t.angle-e.angle}function Aa(){Ia(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(e){var t=e.P,r=e.N;if(t&&r){var n=t.site,a=e.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Me)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=e,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,e.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xke||y(a-r)>ke)&&(l.splice(o,0,new Ea(Pa(i.site,u,y(n-f)ke?{x:f,y:y(t-f)ke?{x:y(r-h)ke?{x:d,y:y(t-d)ke?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=e[l]})),t}function l(e){return e.map((function(e,t){return{x:Math.round(n(e,t)/ke)*ke,y:Math.round(a(e,t)/ke)*ke,i:t}}))}return o.links=function(e){return Ba(l(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return Ba(l(e)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|t>=b,T=w+4;wi&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=$a.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,T=v-h;function k(e,t,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(e.leaf){var s=e.x,c=e.y;if(null!=s)if(y(s-r)+y(c-n)<.01)M(e,t,r,n,a,i,o,l);else{var u=e.point;e.x=e.y=e.point=null,M(e,u,s,c,a,i,o,l),M(e,t,r,n,a,i,o,l)}else e.x=r,e.y=n,e.point=t}else M(e,t,r,n,a,i,o,l)}function M(e,t,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;e.leaf=!1,u?a=s:o=s,f?i=c:l=c,k(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,r,n,a,i,o,l)}w>T?v=h+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){k(A,e,+m(e,++f),+x(e,f),p,h,g,v)},visit:function(e){Ga(e,A,p,h,g,v)},find:function(e){return Za(A,e[0],e[1],p,h,g,v)}};if(f=-1,null==t){for(;++f=0&&!(n=e.interpolators[a](t,r)););return n}function ei(e,t){var r,n=[],a=[],i=e.length,o=t.length,l=Math.min(e.length,t.length);for(r=0;r=1?1:e(t)}}function ii(e){return function(t){return 1-e(1-t)}}function oi(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function li(e){return e*e}function si(e){return e*e*e}function ci(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function ui(e){return 1-Math.cos(e*Ce)}function fi(e){return Math.pow(2,10*(e-1))}function di(e){return 1-Math.sqrt(1-e*e)}function pi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function hi(e,t){return t-=e,function(r){return Math.round(e+t*r)}}function gi(e){var t,r,n,a=[e.a,e.b],i=[e.c,e.d],o=mi(a),l=vi(a,i),s=mi(((t=i)[0]+=(n=-l)*(r=a)[0],t[1]+=n*r[1],t))||0;a[0]*i[1]=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):"in";return n=ri.get(n)||ti,ai((a=ni.get(a)||O)(n.apply(null,r.call(arguments,1))))},e.interpolateHcl=function(t,r){t=e.hcl(t),r=e.hcl(r);var n=t.h,a=t.c,i=t.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Xe(n+o*e,a+l*e,i+s*e)+""}},e.interpolateHsl=function(t,r){t=e.hsl(t),r=e.hsl(r);var n=t.h,a=t.s,i=t.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ge(n+o*e,a+l*e,i+s*e)+""}},e.interpolateLab=function(t,r){t=e.lab(t),r=e.lab(r);var n=t.l,a=t.a,i=t.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(e){return $e(n+o*e,a+l*e,i+s*e)+""}},e.interpolateRound=hi,e.transform=function(t){var r=a.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(null!=e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate()}return new gi(t?t.matrix:yi)})(t)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(e){return e.length?e.pop()+",":""}function bi(t,r){var n=[],a=[];return t=e.transform(t),r=e.transform(r),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}(t.translate,r.translate,n,a),function(e,t,r,n){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(e,t)})):t&&r.push(xi(r)+"rotate("+t+")")}(t.rotate,r.rotate,n,a),function(e,t,r,n){e!==t?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(e,t)}):t&&r.push(xi(r)+"skewX("+t+")")}(t.skew,r.skew,n,a),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else 1===t[0]&&1===t[1]||r.push(xi(r)+"scale("+t+")")}(t.scale,r.scale,n,a),t=r=null,function(e){for(var t,r=-1,i=a.length;++r0?n=e:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:n=0})):e>0&&(s.start({type:"start",alpha:n=e}),t=wt(l.tick)),l):n},l.start=function(){var e,t,r,n=m.length,s=y.length,u=c[0],h=c[1];for(e=0;e=0;)r.push(a[n])}function Ei(e,t){for(var r=[e],n=[];null!=(e=r.pop());)if(n.push(e),(i=e.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ei(a,(function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)})),l}return n.sort=function(t){return arguments.length?(e=t,n):e},n.children=function(e){return arguments.length?(t=e,n):t},n.value=function(e){return arguments.length?(r=e,n):r},n.revalue=function(e){return r&&(zi(e,(function(e){e.children&&(e.value=0)})),Ei(e,(function(e){var t;e.children||(e.value=+r.call(n,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},n},e.layout.partition=function(){var t=e.layout.hierarchy(),r=[1,1];function n(e,n){var a=t.call(this,e,n);return function e(t,r,n,a){var i=t.children;if(t.x=r,t.y=t.depth*a,t.dx=n,t.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=t.value?n/t.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=t);return n}function Xi(e){return e.reduce(Wi,0)}function Wi(e,t){return e+t[1]}function Qi(e,t){return Ji(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Ji(e,t){for(var r=-1,n=+e[0],a=(e[1]-n)/t,i=[];++r<=t;)i[r]=a*r+n;return i}function $i(t){return[e.min(t),e.max(t)]}function Ki(e,t){return e.value-t.value}function eo(e,t){var r=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=r,r._pack_prev=t}function to(e,t){e._pack_next=t,t._pack_prev=e}function ro(e,t){var r=t.x-e.x,n=t.y-e.y,a=e.r+t.r;return.999*a*a>r*r+n*n}function no(e){if((t=e.children)&&(s=t.length)){var t,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(t.forEach(ao),(r=t[0]).x=-r.r,r.y=0,x(r),s>1&&((n=t[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=t[2]),x(a),eo(r,a),r._pack_prev=a,eo(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[e.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(e){return arguments.length?(r=e,i):r},i.range=function(e){return arguments.length?(n=ht(e),i):n},i.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return Ji(t,e)}:ht(e),i):a},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},e.layout.pack=function(){var t,r=e.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(e,i){var o=r.call(this,e,i),l=o[0],s=a[0],c=a[1],u=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(l.x=l.y=0,Ei(l,(function(e){e.r=+u(e.value)})),Ei(l,no),n){var f=n*(t?1:Math.max(2*l.r/s,2*l.r/c))/2;Ei(l,(function(e){e.r+=f})),Ei(l,no),Ei(l,(function(e){e.r-=f}))}return function e(t,r,n,a){var i=t.children;if(t.x=r+=a*t.x,t.y=n+=a*t.y,t.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);zi(u,(function(e){e.x=(e.x+g)*v,e.y=e.depth*m}))}return c}function o(e){var t=e.children,n=e.parent.children,a=e.i?n[e.i-1]:null;if(t.length){!function(e){var t,r=0,n=0,a=e.children,i=a.length;for(;--i>=0;)(t=a[i]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;a?(e.z=a.z+r(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+r(e._,a._));e.parent.A=function(e,t,n){if(t){for(var a,i=e,o=e,l=t,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=e,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,e,n),e,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=e)}return n}(e,a,e.parent.A||n[0])}function l(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e)?s:null,i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null==(n=e)?null:s,i):a?n:null},Pi(i,t)},e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=t.call(this,i,o),c=s[0],u=0;Ei(c,(function(t){var n=t.children;n&&n.length?(t.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),t.y=function(t){return 1+e.max(t,(function(e){return e.y}))}(n)):(t.x=l?u+=r(t,l):0,t.y=0,l=t)}));var f=function e(t){var r=t.children;return r&&r.length?e(r[0]):t}(c),d=function e(t){var r,n=t.children;return n&&(r=n.length)?e(n[r-1]):t}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return Ei(c,a?function(e){e.x=(e.x-c.x)*n[0],e.y=(c.y-e.y)*n[1]}:function(e){e.x=(e.x-p)/(h-p)*n[0],e.y=(1-(c.y?e.y/c.y:1))*n[1]}),s}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e),i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null!=(n=e),i):a?n:null},Pi(i,t)},e.layout.treemap=function(){var t,r=e.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(e,t){for(var r,n,a=-1,i=e.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var r,n=o(e),a=t.slice(),i=[];for(u(a,n.dx*n.dy/e.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);t.forEach(d)}}function p(e,t){for(var r,n=e.area,a=0,i=1/0,o=-1,l=e.length;++oa&&(a=r));return t*=t,(n*=n)?Math.max(t*a*c/n,n/(t*i*c)):1/0}function h(e,t,r,a){var i,o=-1,l=e.length,s=r.x,c=r.y,u=t?n(e.area/t):0;if(t==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return e+t*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var r=e.random.irwinHall(t);return function(){return r()/t}},irwinHall:function(e){return function(){for(var t=0,r=0;r2?_o:mo,l=a?wi:_i;return i=e(t,r,l,n),o=e(r,t,l,Ka),s}function s(e){return i(e)}return s.invert=function(e){return o(e)},s.domain=function(e){return arguments.length?(t=e.map(Number),l()):t},s.range=function(e){return arguments.length?(r=e,l()):r},s.rangeRound=function(e){return s.range(e).interpolate(hi)},s.clamp=function(e){return arguments.length?(a=e,l()):a},s.interpolate=function(e){return arguments.length?(n=e,l()):n},s.ticks=function(e){return Mo(t,e)},s.tickFormat=function(e,r){return Ao(t,e,r)},s.nice=function(e){return To(t,e),l()},s.copy=function(){return e(t,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}e.scale.log=function(){return function t(r,n,a,i){function o(e){return(a?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function l(e){return a?Math.pow(n,e):-Math.pow(n,-e)}function s(e){return r(o(e))}return s.invert=function(e){return l(r.invert(e))},s.domain=function(e){return arguments.length?(a=e[0]>=0,r.domain((i=e.map(Number)).map(o)),s):i},s.base=function(e){return arguments.length?(n=+e,r.domain(i.map(o)),s):n},s.nice=function(){var e=yo(i.map(o),a?Math:Oo);return r.domain(e),i=e.map(l),s},s.ticks=function(){var e=go(i),t=[],r=e[0],s=e[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)t.push(l(c)*d);for(c=0;t[c]s;u--);t=t.slice(c,u)}return t},s.tickFormat=function(t,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=e.format(r));var a=Math.max(1,n*t/s.ticks().length);return function(e){var t=e/l(Math.round(o(e)));return t*n0?a[e-1]:r[0],ef?0:1;if(c=Se)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,T,k,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=Re(v/c*Math.sin(m))),l&&(A=Re(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Ae?0:1;if(L&&Vo(y,x,b,_)===p^C){var O=(u+f)/2;y=c*Math.cos(O),x=c*Math.sin(O),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),T=l*Math.sin(f-A),k=l*Math.cos(u+A),M=l*Math.sin(u+A);var D=Math.abs(u-f+2*A)<=Ae?0:1;if(A&&Vo(w,T,k,M)===1-p^D){var P=(u+f)/2;w=l*Math.cos(P),T=l*Math.sin(P),k=M=null}}else w=T=0;if(d>ke&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function qo(e,t,r,n,a){var i=e[0]-t[0],o=e[1]-t[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=e[0]+s,f=e[1]+c,d=t[0]+s,p=t[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,T=(-b*v-m*_)/y,k=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=T-g,S=k-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=k,T=M),[[w-s,T-c],[w*r/x,T*r/x]]}function Go(e){var t=ra,r=na,n=Zr,a=Yo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=ht(t),p=ht(r);function h(){s.push("M",a(e(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Qo,basis:Ko,"basis-open":function(e){if(e.length<4)return Yo(e);var t,r=[],n=-1,a=e.length,i=[0],o=[0];for(;++n<3;)t=e[n],i.push(t[0]),o.push(t[1]);r.push(el(nl,i)+","+el(nl,o)),--n;for(;++n9&&(a=3*t/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(e[Math.min(s,l+1)][0]-e[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(e))}});function Yo(e){return e.length>1?e.join("L"):e+"Z"}function Xo(e){return e.join("L")+"Z"}function Wo(e){for(var t=0,r=e.length,n=e[0],a=[n[0],",",n[1]];++t1){l=t[1],i=e[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAe)+",1 "+t}function s(e,t,r,n){return"Q 0,0 "+n}return i.radius=function(e){return arguments.length?(r=ht(e),i):r},i.source=function(t){return arguments.length?(e=ht(t),i):e},i.target=function(e){return arguments.length?(t=ht(e),i):t},i.startAngle=function(e){return arguments.length?(n=ht(e),i):n},i.endAngle=function(e){return arguments.length?(a=ht(e),i):a},i},e.svg.diagonal=function(){var e=Un,t=Vn,r=cl;function n(n,a){var i=e.call(this,n,a),o=t.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(t){return arguments.length?(e=ht(t),n):e},n.target=function(e){return arguments.length?(t=ht(e),n):t},n.projection=function(e){return arguments.length?(r=e,n):r},n},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),r=cl,n=t.projection;return t.projection=function(e){return arguments.length?n(ul(r=e)):r},t},e.svg.symbol=function(){var e=dl,t=fl;function r(r,n){return(hl.get(e.call(this,r,n))||pl)(t.call(this,r,n))}return r.type=function(t){return arguments.length?(e=ht(t),r):e},r.size=function(e){return arguments.length?(t=ht(e),r):t},r};var hl=e.map({circle:pl,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vl)),r=t*vl;return"M0,"+-t+"L"+r+",0 0,"+t+" "+-r+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});e.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Oe);Z.transition=function(e){for(var t,r,n=bl||++Tl,a=Al(e),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(e,o);if(i>=1)return f.event&&f.event.end.call(e,e.__data__,t),--u.count?delete u[n]:delete e[r],1}f||(i=a.time,o=wt((function(e){var t=f.delay;if(o.t=t+i,t<=e)return d(e-t);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:t},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,e.transition=function(t,r){return t&&t.transition?bl?t.transition(r):t:e.selection().transition(t)},e.transition.prototype=wl,wl.select=function(e){var t,r,n,a=this.id,i=this.namespace,o=[];e=Y(e);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=e.select(e.event.target),x=n.of(m,arguments),b=e.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=be(m),A=e.mouse(m),L=e.select(o(m)).on("keydown.brush",O).on("keyup.brush",D);if(e.event.changedTouches?L.on("touchmove.brush",P).on("touchend.brush",E):L.on("mousemove.brush",P).on("mouseup.brush",E),b.interrupt().selectAll("*").interrupt(),k)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else e.event.altKey&&(f=A.slice());function O(){32==e.event.keyCode&&(k||(f=null,A[0]-=l[1],A[1]-=s[1],k=2),F())}function D(){32==e.event.keyCode&&2==k&&(A[0]+=l[1],A[1]+=s[1],k=0,F())}function P(){var t=e.mouse(m),r=!1;v&&(t[0]+=v[0],t[1]+=v[1]),k||(e.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(t[0]1?{floor:function(t){for(;l(t=e.floor(t));)t=Hl(t-1);return t},ceil:function(t){for(;l(t=e.ceil(t));)t=Hl(+t+1);return t}}:e))},a.ticks=function(e,t){var r=go(a.domain()),n=null==e?i(r,10):"number"==typeof e?i(r,e):!e.range&&[{range:e},t];return n&&(e=n[0],t=n[1]),e.range(r[0],Hl(+r[1]+1),t<1?1:t)},a.tickFormat=function(){return n},a.copy=function(){return Nl(t.copy(),r,n)},wo(a,t)}function Hl(e){return new Date(e)}El.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Il,Fl.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Fl.toString=Il.toString,Pt.second=It((function(e){return new zt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Pt.seconds=Pt.second.range,Pt.seconds.utc=Pt.second.utc.range,Pt.minute=It((function(e){return new zt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Pt.minutes=Pt.minute.range,Pt.minutes.utc=Pt.minute.utc.range,Pt.hour=It((function(e){var t=e.getTimezoneOffset()/60;return new zt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Pt.hours=Pt.hour.range,Pt.hours.utc=Pt.hour.utc.range,Pt.month=It((function(e){return(e=Pt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Pt.months=Pt.month.range,Pt.months.utc=Pt.month.utc.range;var Bl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],jl=[[Pt.second,1],[Pt.second,5],[Pt.second,15],[Pt.second,30],[Pt.minute,1],[Pt.minute,5],[Pt.minute,15],[Pt.minute,30],[Pt.hour,1],[Pt.hour,3],[Pt.hour,6],[Pt.hour,12],[Pt.day,1],[Pt.day,2],[Pt.week,1],[Pt.month,1],[Pt.month,3],[Pt.year,1]],Ul=El.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Zr]]),Vl={range:function(t,r,n){return e.range(Math.ceil(t/n)*n,+r,n).map(Hl)},floor:O,ceil:O};jl.year=Pt.year,Pt.scale=function(){return Nl(e.scale.linear(),jl,Ul)};var ql=jl.map((function(e){return[e[0].utc,e[1]]})),Gl=Rl.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Zr]]);function Zl(e){return JSON.parse(e.responseText)}function Yl(e){var t=a.createRange();return t.selectNode(a.body),t.createContextualFragment(e.responseText)}ql.year=Pt.year.utc,Pt.scale.utc=function(){return Nl(e.scale.linear(),ql,Gl)},e.text=gt((function(e){return e.responseText})),e.json=function(e,t){return vt(e,"application/json",Zl,t)},e.html=function(e,t){return vt(e,"text/html",Yl,t)},e.xml=gt((function(e){return e.responseXML})),"object"==typeof t&&t.exports?t.exports=e:this.d3=e}()},{}],10:[function(e,t,r){(function(n,a){ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=e()}}((function(){return function e(t,r,n){function a(o,l){if(!r[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":201}],2:[function(e,t,r){"use strict";t.exports=e("../src/traces/bar")},{"../src/traces/bar":306}],3:[function(e,t,r){"use strict";t.exports=e("../src/core")},{"../src/core":182}],4:[function(e,t,r){"use strict";var n=e("./core");n.register([e("./bar"),e("./pie")]),t.exports=n},{"./bar":2,"./core":3,"./pie":5}],5:[function(e,t,r){"use strict";t.exports=e("../src/traces/pie")},{"../src/traces/pie":321}],6:[function(e,t,r){"use strict";var n,a="object"==typeof Reflect?Reflect:null,i=a&&"function"==typeof a.apply?a.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=a&&"function"==typeof a.ownKeys?a.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function l(){l.init.call(this)}t.exports=l,t.exports.once=function(e,t){return new Promise((function(r,n){function a(){void 0!==i&&e.removeListener("error",i),r([].slice.call(arguments))}var i;"error"!==t&&(i=function(r){e.removeListener(t,a),n(r)},e.once("error",i)),e.once(t,a)}))},l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var s=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var a,i,o,l;if(c(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),void 0===o)o=i[t]=r,++e._eventsCount;else if("function"==typeof o?o=i[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(a=u(e))>0&&o.length>a&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=o.length,l=s,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},a=d.bind(n);return a.listener=r,n.wrapFn=a,a}function h(e,t,r){var n=e._events;if(void 0===n)return[];var a=n[t];return void 0===a?[]:"function"==typeof a?r?[a.listener||a]:[a]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(o=t[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var s=a[e];if(void 0===s)return!1;if("function"==typeof s)i(s,this,t);else{var c=s.length,u=v(s,c);for(r=0;r=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,a=i;break}if(a<0)return this;0===a?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},l.prototype.listeners=function(e){return h(this,e,!0)},l.prototype.rawListeners=function(e){return h(this,e,!1)},l.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},l.prototype.listenerCount=g,l.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],7:[function(e,t,r){!function(n,a){"object"==typeof r&&"undefined"!=typeof t?a(r,e("d3-time")):a((n=n||self).d3=n.d3||{},n.d3)}(this,(function(e,t){"use strict";function r(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function n(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function a(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,o=e.date,s=e.time,c=e.periods,u=e.days,f=e.shortDays,d=e.months,ye=e.shortMonths,xe=p(c),be=h(c),_e=p(u),we=h(u),Te=p(f),ke=h(f),Me=p(d),Ae=h(d),Le=p(ye),Se=h(ye),Ce={a:function(e){return f[e.getDay()]},A:function(e){return u[e.getDay()]},b:function(e){return ye[e.getMonth()]},B:function(e){return d[e.getMonth()]},c:null,d:E,e:E,f:j,H:I,I:F,j:N,L:H,m:B,M:V,p:function(e){return c[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:ve,s:me,S:U,u:q,U:G,V:Z,w:Y,W:X,x:null,X:null,y:W,Y:Q,Z:J,"%":ge},Oe={a:function(e){return f[e.getUTCDay()]},A:function(e){return u[e.getUTCDay()]},b:function(e){return ye[e.getUTCMonth()]},B:function(e){return d[e.getUTCMonth()]},c:null,d:$,e:$,f:ne,H:K,I:ee,j:te,L:re,m:ae,M:ie,p:function(e){return c[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:ve,s:me,S:oe,u:le,U:se,V:ce,w:ue,W:fe,x:null,X:null,y:de,Y:pe,Z:he,"%":ge},De={a:function(e,t,r){var n=Te.exec(t.slice(r));return n?(e.w=ke[n[0].toLowerCase()],r+n[0].length):-1},A:function(e,t,r){var n=_e.exec(t.slice(r));return n?(e.w=we[n[0].toLowerCase()],r+n[0].length):-1},b:function(e,t,r){var n=Le.exec(t.slice(r));return n?(e.m=Se[n[0].toLowerCase()],r+n[0].length):-1},B:function(e,t,r){var n=Me.exec(t.slice(r));return n?(e.m=Ae[n[0].toLowerCase()],r+n[0].length):-1},c:function(e,t,r){return Re(e,i,t,r)},d:M,e:M,f:D,H:L,I:L,j:A,L:O,m:k,M:S,p:function(e,t,r){var n=xe.exec(t.slice(r));return n?(e.p=be[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:z,s:R,S:C,u:v,U:m,V:y,w:g,W:x,x:function(e,t,r){return Re(e,o,t,r)},X:function(e,t,r){return Re(e,s,t,r)},y:_,Y:b,Z:w,"%":P};function Pe(e,t){return function(r){var n,a,i,o=[],s=-1,c=0,u=e.length;for(r instanceof Date||(r=new Date(+r));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(l=n(a(c.y,0,1))).getUTCDay(),l=s>4||0===s?t.utcMonday.ceil(l):t.utcMonday(l),l=t.utcDay.offset(l,7*(c.V-1)),c.y=l.getUTCFullYear(),c.m=l.getUTCMonth(),c.d=l.getUTCDate()+(c.w+6)%7):(s=(l=r(a(c.y,0,1))).getDay(),l=s>4||0===s?t.timeMonday.ceil(l):t.timeMonday(l),l=t.timeDay.offset(l,7*(c.V-1)),c.y=l.getFullYear(),c.m=l.getMonth(),c.d=l.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?n(a(c.y,0,1)).getUTCDay():r(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Re(e,t,r,n){for(var a,i,o=0,s=t.length,c=r.length;o=c)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=De[a in l?t.charAt(o++):a])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ce.x=Pe(o,Ce),Ce.X=Pe(s,Ce),Ce.c=Pe(i,Ce),Oe.x=Pe(o,Oe),Oe.X=Pe(s,Oe),Oe.c=Pe(i,Oe),{format:function(e){var t=Pe(e+="",Ce);return t.toString=function(){return e},t},parse:function(e){var t=ze(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=Pe(e+="",Oe);return t.toString=function(){return e},t},utcParse:function(e){var t=ze(e+="",!0);return t.toString=function(){return e},t}}}var o,l={"-":"",_:" ",0:"0"},s=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(e,t,r){var n=s.exec(t.slice(r,r+1));return n?(e.q=3*n[0]-3,r+n[0].length):-1}function k(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function M(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function A(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function L(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function S(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function C(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function O(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function D(e,t,r){var n=s.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function P(e,t,r){var n=c.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function z(e,t,r){var n=s.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function R(e,t,r){var n=s.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function E(e,t){return f(e.getDate(),t,2)}function I(e,t){return f(e.getHours(),t,2)}function F(e,t){return f(e.getHours()%12||12,t,2)}function N(e,r){return f(1+t.timeDay.count(t.timeYear(e),e),r,3)}function H(e,t){return f(e.getMilliseconds(),t,3)}function j(e,t){return H(e,t)+"000"}function B(e,t){return f(e.getMonth()+1,t,2)}function V(e,t){return f(e.getMinutes(),t,2)}function U(e,t){return f(e.getSeconds(),t,2)}function q(e){var t=e.getDay();return 0===t?7:t}function G(e,r){return f(t.timeSunday.count(t.timeYear(e)-1,e),r,2)}function Z(e,r){var n=e.getDay();return e=n>=4||0===n?t.timeThursday(e):t.timeThursday.ceil(e),f(t.timeThursday.count(t.timeYear(e),e)+(4===t.timeYear(e).getDay()),r,2)}function Y(e){return e.getDay()}function X(e,r){return f(t.timeMonday.count(t.timeYear(e)-1,e),r,2)}function W(e,t){return f(e.getFullYear()%100,t,2)}function Q(e,t){return f(e.getFullYear()%1e4,t,4)}function J(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+f(t/60|0,"0",2)+f(t%60,"0",2)}function $(e,t){return f(e.getUTCDate(),t,2)}function K(e,t){return f(e.getUTCHours(),t,2)}function ee(e,t){return f(e.getUTCHours()%12||12,t,2)}function te(e,r){return f(1+t.utcDay.count(t.utcYear(e),e),r,3)}function re(e,t){return f(e.getUTCMilliseconds(),t,3)}function ne(e,t){return re(e,t)+"000"}function ae(e,t){return f(e.getUTCMonth()+1,t,2)}function ie(e,t){return f(e.getUTCMinutes(),t,2)}function oe(e,t){return f(e.getUTCSeconds(),t,2)}function le(e){var t=e.getUTCDay();return 0===t?7:t}function se(e,r){return f(t.utcSunday.count(t.utcYear(e)-1,e),r,2)}function ce(e,r){var n=e.getUTCDay();return e=n>=4||0===n?t.utcThursday(e):t.utcThursday.ceil(e),f(t.utcThursday.count(t.utcYear(e),e)+(4===t.utcYear(e).getUTCDay()),r,2)}function ue(e){return e.getUTCDay()}function fe(e,r){return f(t.utcMonday.count(t.utcYear(e)-1,e),r,2)}function de(e,t){return f(e.getUTCFullYear()%100,t,2)}function pe(e,t){return f(e.getUTCFullYear()%1e4,t,4)}function he(){return"+0000"}function ge(){return"%"}function ve(e){return+e}function me(e){return Math.floor(+e/1e3)}function ye(t){return o=i(t),e.timeFormat=o.format,e.timeParse=o.parse,e.utcFormat=o.utcFormat,e.utcParse=o.utcParse,o}ye({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xe=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var be=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=xe,e.isoParse=be,e.timeFormatDefaultLocale=ye,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})}))},{"d3-time":8}],8:[function(e,t,r){!function(e,n){"object"==typeof r&&"undefined"!=typeof t?n(r):n((e=e||self).d3=e.d3||{})}(this,(function(e){"use strict";var t=new Date,r=new Date;function n(e,a,i,o){function l(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return l.floor=function(t){return e(t=new Date(+t)),t},l.ceil=function(t){return e(t=new Date(t-1)),a(t,1),e(t),t},l.round=function(e){var t=l(e),r=l.ceil(e);return e-t0))return o;do{o.push(i=new Date(+t)),a(t,n),e(t)}while(i=r)for(;e(r),!t(r);)r.setTime(r-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;a(e,-1),!t(e););else for(;--r>=0;)for(;a(e,1),!t(e););}))},i&&(l.count=function(n,a){return t.setTime(+n),r.setTime(+a),e(t),e(r),Math.floor(i(t,r))},l.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?l.filter(o?function(t){return o(t)%e==0}:function(t){return l.count(0,t)%e==0}):l:null}),l}var a=n((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?n((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,r){t.setTime(+t+r*e)}),(function(t,r){return(r-t)/e})):a:null};var i=a.range,o=n((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()})),l=o.range,s=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()})),c=s.range,u=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()})),f=u.range,d=n((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1})),p=d.range;function h(e){return n((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var g=h(0),v=h(1),m=h(2),y=h(3),x=h(4),b=h(5),_=h(6),w=g.range,T=v.range,k=m.range,M=y.range,A=x.range,L=b.range,S=_.range,C=n((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),O=C.range,D=n((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));D.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,r){t.setFullYear(t.getFullYear()+r*e)})):null};var P=D.range,z=n((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()})),R=z.range,E=n((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()})),I=E.range,F=n((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1})),N=F.range;function H(e){return n((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var j=H(0),B=H(1),V=H(2),U=H(3),q=H(4),G=H(5),Z=H(6),Y=j.range,X=B.range,W=V.range,Q=U.range,J=q.range,$=G.range,K=Z.range,ee=n((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),te=ee.range,re=n((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));re.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,r){t.setUTCFullYear(t.getUTCFullYear()+r*e)})):null};var ne=re.range;e.timeDay=d,e.timeDays=p,e.timeFriday=b,e.timeFridays=L,e.timeHour=u,e.timeHours=f,e.timeInterval=n,e.timeMillisecond=a,e.timeMilliseconds=i,e.timeMinute=s,e.timeMinutes=c,e.timeMonday=v,e.timeMondays=T,e.timeMonth=C,e.timeMonths=O,e.timeSaturday=_,e.timeSaturdays=S,e.timeSecond=o,e.timeSeconds=l,e.timeSunday=g,e.timeSundays=w,e.timeThursday=x,e.timeThursdays=A,e.timeTuesday=m,e.timeTuesdays=k,e.timeWednesday=y,e.timeWednesdays=M,e.timeWeek=g,e.timeWeeks=w,e.timeYear=D,e.timeYears=P,e.utcDay=F,e.utcDays=N,e.utcFriday=G,e.utcFridays=$,e.utcHour=E,e.utcHours=I,e.utcMillisecond=a,e.utcMilliseconds=i,e.utcMinute=z,e.utcMinutes=R,e.utcMonday=B,e.utcMondays=X,e.utcMonth=ee,e.utcMonths=te,e.utcSaturday=Z,e.utcSaturdays=K,e.utcSecond=o,e.utcSeconds=l,e.utcSunday=j,e.utcSundays=Y,e.utcThursday=q,e.utcThursdays=J,e.utcTuesday=V,e.utcTuesdays=W,e.utcWednesday=U,e.utcWednesdays=Q,e.utcWeek=j,e.utcWeeks=Y,e.utcYear=re,e.utcYears=ne,Object.defineProperty(e,"__esModule",{value:!0})}))},{}],9:[function(e,t,r){!function(){var e={version:"3.5.17"},r=[].slice,n=function(e){return r.call(e)},a=this.document;function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(e){n=function(e){for(var t=e.length,r=new Array(t);t--;)r[t]=e[t];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(e,t){s.call(this,e,t+"")},l.setAttributeNS=function(e,t,r){c.call(this,e,t,r+"")},u.setProperty=function(e,t,r){f.call(this,e,t+"",r)}}function d(e,t){return et?1:e>=t?0:NaN}function p(e){return null===e?NaN:+e}function h(e){return!isNaN(e)}function g(e){return{left:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)<0?n=i+1:a=i}return n},right:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)>0?a=i:n=i+1}return n}}}e.ascending=d,e.descending=function(e,t){return te?1:t>=e?0:NaN},e.min=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},e.max=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},e.extent=function(e,t){var r,n,a,i=-1,o=e.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var v=g(d);function m(e){return e.length}e.bisectLeft=v.left,e.bisect=e.bisectRight=v.right,e.bisector=function(e){return g(1===e.length?function(t,r){return d(e(t),r)}:e)},e.shuffle=function(e,t,r){(i=arguments.length)<3&&(r=e.length,i<2&&(t=0));for(var n,a,i=r-t;i;)a=Math.random()*i--|0,n=e[i+t],e[i+t]=e[a+t],e[a+t]=n;return e},e.permute=function(e,t){for(var r=t.length,n=new Array(r);r--;)n[r]=e[t[r]];return n},e.pairs=function(e){for(var t=0,r=e.length-1,n=e[0],a=new Array(r<0?0:r);t=0;)for(t=(n=e[a]).length;--t>=0;)r[--o]=n[t];return r};var y=Math.abs;function x(e){for(var t=1;e*t%1;)t*=10;return t}function b(e,t){for(var r in t)Object.defineProperty(e.prototype,r,{value:t[r],enumerable:!1})}function _(){this._=Object.create(null)}e.range=function(e,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=e,e=0)),(t-e)/r==1/0)throw new Error("infinite range");var n,a=[],i=x(y(r)),o=-1;if(e*=i,t*=i,(r*=i)<0)for(;(n=e+r*++o)>t;)a.push(n/i);else for(;(n=e+r*++o)=a.length)return r?r.call(n,i):t?i.sort(t):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return t;var n=[],o=i[r++];return t.forEach((function(t,a){n.push({key:t,values:e(a,r)})})),o?n.sort((function(e,t){return o(e.key,t.key)})):n}(o(e.map,t,0),0)},n.key=function(e){return a.push(e),n},n.sortKeys=function(e){return i[a.length-1]=e,n},n.sortValues=function(e){return t=e,n},n.rollup=function(e){return r=e,n},n},e.set=function(e){var t=new C;if(e)for(var r=0,n=e.length;r=0&&(n=e.slice(r+1),e=e.slice(0,r)),e)return arguments.length<2?this[e].on(n):this[e].on(n,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(n,null);return this}},e.event=null,e.requote=function(e){return e.replace(j,"\\$&")};var j=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,B={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)e[r]=t[r]};function V(e){return B(e,Z),e}var U=function(e,t){return t.querySelector(e)},q=function(e,t){return t.querySelectorAll(e)},G=function(e,t){var r=e.matches||e[P(e,"matchesSelector")];return(G=function(e,t){return r.call(e,t)})(e,t)};"function"==typeof Sizzle&&(U=function(e,t){return Sizzle(e,t)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),e.selection=function(){return e.select(a.documentElement)};var Z=e.selection.prototype=[];function Y(e){return"function"==typeof e?e:function(){return U(e,this)}}function X(e){return"function"==typeof e?e:function(){return q(e,this)}}Z.select=function(e){var t,r,n,a,i=[];e=Y(e);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=e.slice(0,t))&&(e=e.slice(t+1)),Q.hasOwnProperty(r)?{space:Q[r],local:e}:e}},Z.attr=function(t,r){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=e.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(r in t)this.each(J(r,t[r]));return this}return this.each(J(t,r))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node(),n=(e=ee(e)).length,a=-1;if(t=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(e){e=ce.apply(this,arguments);for(var t=-1,r=this.length;++t=t&&(t=a+1);!(o=l[t])&&++t0&&(t=t.slice(0,o));var s=ge.get(t);function c(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return s&&(t=s,l=me),o?r?function(){var e=l(r,n(arguments));c.call(this),this.addEventListener(t,this[i]=e,e.$=a),e._=r}:c:r?R:function(){var r,n=new RegExp("^__on([^.]+)"+e.requote(t)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}e.selection.enter=fe,e.selection.enter.prototype=de,de.append=Z.append,de.empty=Z.empty,de.node=Z.node,de.call=Z.call,de.size=Z.size,de.select=function(e){for(var t,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:e<0?-1:0}function ze(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(t[1]-e[1])*(r[0]-e[0])}function Re(e){return e>1?0:e<-1?Ae:Math.acos(e)}function Ee(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function Ie(e){return((e=Math.exp(e))+1/e)/2}function Fe(e){return(e=Math.sin(e/2))*e}var Ne=Math.SQRT2;e.interpolateZoom=function(e,t){var r,n,a=e[0],i=e[1],o=e[2],l=t[0],s=t[1],c=t[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(t=t.transition().duration(g)),t.call(w.event)}function L(){c&&c.domain(s.range().map((function(e){return(e-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(e){return(e-d.y)/d.k})).map(u.invert))}function S(e){v++||e({type:"zoomstart"})}function C(e){L(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function O(e){--v||(e({type:"zoomend"}),r=null)}function D(){var t=this,r=_.of(t,arguments),n=0,a=e.select(o(t)).on(y,s).on(x,c),i=T(e.mouse(t)),l=be(t);function s(){n=1,M(e.mouse(t),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),O(r)}ml.call(t),S(r)}function P(){var t,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+e.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=e.select(r),p=be(r);function h(){var n=e.touches(r);return t=d.k,n.forEach((function(e){e.identifier in a&&(a[e.identifier]=T(e))})),n}function g(){var t=e.event.target;e.select(t).on(s,v).on(c,y),u.push(t);for(var n=e.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=e.touches(r);ml.call(r);for(var d=0,p=f.length;d360?e-=360:e<0&&(e+=360),e<60?n+(a-n)*e/60:e<180?a:e<240?n+(a-n)*(240-e)/60:n}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+t):r+t-r*t),new nt(i(e+120),i(e),i(e-120))}function Ze(t,r,n){return this instanceof Ze?(this.h=+t,this.c=+r,void(this.l=+n)):arguments.length<2?t instanceof Ze?new Ze(t.h,t.c,t.l):Ke(t instanceof We?t.l:(t=ut((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Ze(t,r,n)}qe.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new Ue(this.h,this.s,this.l/e)},qe.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new Ue(this.h,this.s,e*this.l)},qe.rgb=function(){return Ge(this.h,this.s,this.l)},e.hcl=Ze;var Ye=Ze.prototype=new Ve;function Xe(e,t,r){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new We(r,Math.cos(e*=Oe)*t,Math.sin(e)*t)}function We(e,t,r){return this instanceof We?(this.l=+e,this.a=+t,void(this.b=+r)):arguments.length<2?e instanceof We?new We(e.l,e.a,e.b):e instanceof Ze?Xe(e.h,e.c,e.l):ut((e=nt(e)).r,e.g,e.b):new We(e,t,r)}Ye.brighter=function(e){return new Ze(this.h,this.c,Math.min(100,this.l+Qe*(arguments.length?e:1)))},Ye.darker=function(e){return new Ze(this.h,this.c,Math.max(0,this.l-Qe*(arguments.length?e:1)))},Ye.rgb=function(){return Xe(this.h,this.c,this.l).rgb()},e.lab=We;var Qe=18,Je=We.prototype=new Ve;function $e(e,t,r){var n=(e+16)/116,a=n+t/500,i=n-r/200;return new nt(rt(3.2404542*(a=.95047*et(a))-1.5371385*(n=1*et(n))-.4985314*(i=1.08883*et(i))),rt(-.969266*a+1.8760108*n+.041556*i),rt(.0556434*a-.2040259*n+1.0572252*i))}function Ke(e,t,r){return e>0?new Ze(Math.atan2(r,t)*De,Math.sqrt(t*t+r*r),e):new Ze(NaN,NaN,e)}function et(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function tt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function rt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function nt(e,t,r){return this instanceof nt?(this.r=~~e,this.g=~~t,void(this.b=~~r)):arguments.length<2?e instanceof nt?new nt(e.r,e.g,e.b):st(""+e,nt,Ge):new nt(e,t,r)}function at(e){return new nt(e>>16,e>>8&255,255&e)}function it(e){return at(e)+""}Je.brighter=function(e){return new We(Math.min(100,this.l+Qe*(arguments.length?e:1)),this.a,this.b)},Je.darker=function(e){return new We(Math.max(0,this.l-Qe*(arguments.length?e:1)),this.a,this.b)},Je.rgb=function(){return $e(this.l,this.a,this.b)},e.rgb=nt;var ot=nt.prototype=new Ve;function lt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function st(e,t,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return t(dt(a[0]),dt(a[1]),dt(a[2]))}return(i=pt.get(e))?t(i.r,i.g,i.b):(null==e||"#"!==e.charAt(0)||isNaN(i=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===e.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),t(o,l,s))}function ct(e,t,r){var n,a,i=Math.min(e/=255,t/=255,r/=255),o=Math.max(e,t,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=e==o?(t-r)/l+(t0&&s<1?0:n),new Ue(n,a,s)}function ut(e,t,r){var n=tt((.4124564*(e=ft(e))+.3575761*(t=ft(t))+.1804375*(r=ft(r)))/.95047),a=tt((.2126729*e+.7151522*t+.072175*r)/1);return We(116*a-16,500*(n-a),200*(a-tt((.0193339*e+.119192*t+.9503041*r)/1.08883)))}function ft(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ot.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,r=this.g,n=this.b,a=30;return t||r||n?(t&&t=200&&t<300||304===t){try{e=a.call(o,c)}catch(e){return void l.error.call(o,e)}l.load.call(o,e)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var r=e.event;e.event=t;try{l.progress.call(o,c)}finally{e.event=r}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(r=null==e?null:e+"",o):r},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return a=e,o},["get","post"].forEach((function(e){o[e]=function(){return o.send.apply(o,[e].concat(n(arguments)))}})),o.send=function(e,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(e,t,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(e){a(null,e)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},e.rebind(o,l,"on"),null==i?o:o.get(function(e){return 1===e.length?function(t,r){e(null==t?r:null)}:e}(i))}pt.forEach((function(e,t){pt.set(e,at(t))})),e.functor=ht,e.xhr=gt(O),e.dsv=function(e,t){var r=new RegExp('["'+e+"\n]"),n=e.charCodeAt(0);function a(e,r,n){arguments.length<3&&(n=r,r=null);var a=vt(e,t,null==r?i:o(r),n);return a.row=function(e){return arguments.length?a.response(null==(r=e)?i:o(e)):r},a}function i(e){return a.parse(e.responseText)}function o(e){return function(t){return a.parse(t.responseText,e)}}function l(t){return t.map(s).join(e)}function s(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return a.parse=function(e,t){var r;return a.parseRows(e,(function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");r=t?function(e,r){return t(a(e),r)}:a}))},a.parseRows=function(e,t){var r,a,i={},o={},l=[],s=e.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var t=c;if(34===e.charCodeAt(t)){for(var r=t;r++24?(isFinite(t)&&(clearTimeout(bt),bt=setTimeout(Tt,t)),xt=0):(xt=1,_t(Tt))}function kt(){for(var e=Date.now(),t=mt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Mt(){for(var e,t=mt,r=1/0;t;)t.c?(t.t8?function(e){return e/r}:function(e){return e*r},symbol:e}}));function St(t){var r=t.decimal,n=t.thousands,a=t.grouping,i=t.currency,o=a&&n?function(e,t){for(var r=e.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>t&&(l=Math.max(1,t-s)),i.push(e.substring(r-=l,r+l)),!((s+=l+1)>t));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:O;return function(t){var n=Ct.exec(t),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Ot.get(h)||Dt;var b=u&&d;return function(t){var n=m;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(g<0){var c=e.formatPrefix(t,p);t=c.scale(t),n=c.symbol+m}else t*=g;var _,w,T=(t=h(t,p)).lastIndexOf(".");if(T<0){var k=x?t.lastIndexOf("e"):-1;k<0?(_=t,w=""):(_=t.substring(0,k),w=t.substring(k))}else _=t.substring(0,T),w=r+t.substring(T+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+t:"^"===l?A.substring(0,M>>=1)+i+t+A.substring(M):i+(b?t:A+t))+n}}}e.formatPrefix=function(t,r){var n=0;return(t=+t)&&(t<0&&(t*=-1),r&&(t=e.round(t,At(t,r))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Lt[8+n/3]};var Ct=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ot=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,r){return(t=e.round(t,At(t,r))).toFixed(Math.max(0,Math.min(20,At(t*(1+1e-15),r))))}});function Dt(e){return e+""}var Pt=e.time={},zt=Date;function Rt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Rt.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(){Et.setUTCDate.apply(this._,arguments)},setDay:function(){Et.setUTCDay.apply(this._,arguments)},setFullYear:function(){Et.setUTCFullYear.apply(this._,arguments)},setHours:function(){Et.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Et.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Et.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Et.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Et.setUTCSeconds.apply(this._,arguments)},setTime:function(){Et.setTime.apply(this._,arguments)}};var Et=Date.prototype;function It(e,t,r){function n(t){var r=e(t),n=i(r,1);return t-r1)for(;o=c)return-1;if(37===(a=t.charCodeAt(l++))){if(o=t.charAt(l++),!(i=w[o in Ht?t.charAt(l++):o])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(e){var t=u(e);function r(e){try{var r=new(zt=Rt);return r._=e,t(r)}finally{zt=Date}}return r.parse=function(e){try{zt=Rt;var r=t.parse(e);return r&&r._}finally{zt=Date}},r.toString=t.toString,r},u.multi=u.utc.multi=or;var d=e.map(),p=Ut(o),h=qt(o),g=Ut(l),v=qt(l),m=Ut(s),y=qt(s),x=Ut(c),b=qt(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var _={a:function(e){return l[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:u(r),d:function(e,t){return Vt(e.getDate(),t,2)},e:function(e,t){return Vt(e.getDate(),t,2)},H:function(e,t){return Vt(e.getHours(),t,2)},I:function(e,t){return Vt(e.getHours()%12||12,t,2)},j:function(e,t){return Vt(1+Pt.dayOfYear(e),t,3)},L:function(e,t){return Vt(e.getMilliseconds(),t,3)},m:function(e,t){return Vt(e.getMonth()+1,t,2)},M:function(e,t){return Vt(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Vt(e.getSeconds(),t,2)},U:function(e,t){return Vt(Pt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Vt(Pt.mondayOfYear(e),t,2)},x:u(n),X:u(a),y:function(e,t){return Vt(e.getFullYear()%100,t,2)},Y:function(e,t){return Vt(e.getFullYear()%1e4,t,4)},Z:ar,"%":function(){return"%"}},w={a:function(e,t,r){g.lastIndex=0;var n=g.exec(t.slice(r));return n?(e.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){p.lastIndex=0;var n=p.exec(t.slice(r));return n?(e.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){x.lastIndex=0;var n=x.exec(t.slice(r));return n?(e.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){m.lastIndex=0;var n=m.exec(t.slice(r));return n?(e.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,t,r){return f(e,_.c.toString(),t,r)},d:$t,e:$t,H:er,I:er,j:Kt,L:nr,m:Jt,M:tr,p:function(e,t,r){var n=d.get(t.slice(r,r+=2).toLowerCase());return null==n?-1:(e.p=n,r)},S:rr,U:Zt,w:Gt,W:Yt,x:function(e,t,r){return f(e,_.x.toString(),t,r)},X:function(e,t,r){return f(e,_.X.toString(),t,r)},y:Wt,Y:Xt,Z:Qt,"%":ir};return u}Pt.year=It((function(e){return(e=Pt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Pt.years=Pt.year.range,Pt.years.utc=Pt.year.utc.range,Pt.day=It((function(e){var t=new zt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Pt.days=Pt.day.range,Pt.days.utc=Pt.day.utc.range,Pt.dayOfYear=function(e){var t=Pt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var r=Pt[e]=It((function(e){return(e=Pt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)-(r!==t)}));Pt[e+"s"]=r.range,Pt[e+"s"].utc=r.utc.range,Pt[e+"OfYear"]=function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)}})),Pt.week=Pt.sunday,Pt.weeks=Pt.sunday.range,Pt.weeks.utc=Pt.sunday.utc.range,Pt.weekOfYear=Pt.sundayOfYear;var Ht={"-":"",_:" ",0:"0"},jt=/^\s*\d+/,Bt=/^%/;function Vt(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Qt(e,t,r){return/^[+-]\d{4}$/.test(t=t.slice(r,r+5))?(e.Z=-t,r+5):-1}function Jt(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function $t(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Kt(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+3));return n?(e.j=+n[0],r+n[0].length):-1}function er(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tr(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rr(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nr(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ar(e){var t=e.getTimezoneOffset(),r=t>0?"-":"+",n=y(t)/60|0,a=y(t)%60;return r+Vt(n,"0",2)+Vt(a,"0",2)}function ir(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function or(e){for(var t=e.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(t),c=Math.sin(t),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=e,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(e=o)*Oe,n=Math.cos(l=(t=l)*Oe/2+Ae/4),a=Math.sin(l)},Cr.lineEnd=function(){i(e,t)}}function Dr(e){var t=e[0],r=e[1],n=Math.cos(r);return[n*Math.cos(t),n*Math.sin(t),Math.sin(r)]}function Pr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zr(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Rr(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Er(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ir(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Fr(e){return[Math.atan2(e[1],e[0]),Ee(e[2])]}function Nr(e,t){return y(e[0]-t[0])ke?a=90:c<-ke&&(r=-90),f[0]=t,f[1]=n}};function p(e,i){u.push(f=[t=e,n=e]),ia&&(a=i)}function h(e,o){var l=Dr([e*Oe,o*Oe]);if(s){var c=zr(s,l),u=zr([c[1],-c[0],0],c);Ir(u),u=Fr(u);var f=e-i,d=f>0?1:-1,h=u[0]*De*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?e_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e):n>=t?(en&&(n=e)):e>i?_(t,e)>_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e)}else p(e,o);s=l,i=e}function g(){d.point=h}function v(){f[0]=t,f[1]=n,d.point=p,s=null}function m(e,t){if(s){var r=e-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=e,l=t;Cr.point(e,t),h(e,t)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>ke&&(t=-(n=180)),f[0]=t,f[1]=n,s=null}function _(e,t){return(t-=e)<0?t+360:t}function w(e,t){return e[0]-t[0]}function T(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,t=p[0],n=g[1])}return u=f=null,t===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,r],[n,a]]}}(),e.geo.centroid=function(t){mr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Lr=0,e.geo.stream(t,Hr);var r=Mr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Xr(e){if(t=e.length){for(var t,r,n=0,a=e[0];++n=0?1:-1,T=w*_,k=T>Ae,M=h*x;if(Sr.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*Le:_,k^d>=r^m>=r){var A=zr(Dr(f),Dr(e));Ir(A);var L=zr(a,A);Ir(L);var S=(k^_>=0?-1:1)*Ee(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=e}}return(i<-ke||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&t&&r.push(r.pop().concat(r.shift())),l.push(r.filter(Jr))}return u}}function Jr(e){return e.length>1}function $r(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,r){e.push([t,r])},lineEnd:R,buffer:function(){var r=t;return t=[],e=null,r},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Kr(e,t){return((e=e.x)[0]<0?e[1]-Ce-ke:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-ke:Ce-t[1])}var en=Qr(Zr,(function(e){var t,r=NaN,n=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var l=i>0?Ae:-Ae,s=y(i-r);y(s-Ae)0?Ce:-Ce),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),e.point(i,n),t=0):a!==l&&s>=Ae&&(y(r-a)ke?Math.atan((Math.sin(t)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(t))*Math.sin(e))/(a*i*o)):(t+n)/2}(r,n,i,o),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),t=0),e.point(r=i,n=o),a=l},lineEnd:function(){e.lineEnd(),r=n=NaN},clean:function(){return 2-t}}}),(function(e,t,r,n){var a;if(null==e)a=r*Ce,n.point(-Ae,a),n.point(0,a),n.point(Ae,a),n.point(Ae,0),n.point(Ae,-a),n.point(0,-a),n.point(-Ae,-a),n.point(-Ae,0),n.point(-Ae,a);else if(y(e[0]-t[0])>ke){var i=e[0]0,n=y(t)>ke;return Qr(a,(function(e){var t,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?Ae:-Ae),d):0;if(!t&&(c=s=g)&&e.lineStart(),g!==s&&(p=i(t,h),(Nr(t,p)||Nr(h,p))&&(h[0]+=ke,h[1]+=ke,g=a(h[0],h[1]))),g!==s)u=0,g?(e.lineStart(),p=i(h,t),e.point(p[0],p[1])):(p=i(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(n&&t&&r^g){var m;v&l||!(m=i(h,t,!0))||(u=0,r?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!g||t&&Nr(t,h)||e.point(h[0],h[1]),t=h,s=g,l=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(c&&s)<<1}}}),Nn(e,6*Oe),r?[0,-e]:[-Ae,e-Ae]);function a(e,r){return Math.cos(e)*Math.cos(r)>t}function i(e,r,n){var a=[1,0,0],i=zr(Dr(e),Dr(r)),o=Pr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&e;var c=t*o/s,u=-t*l/s,f=zr(a,i),d=Er(a,c);Rr(d,Er(i,u));var p=f,h=Pr(d,p),g=Pr(p,p),v=h*h-g*(Pr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Er(p,(-h-m)/g);if(Rr(x,d),x=Fr(x),!n)return x;var b,_=e[0],w=r[0],T=e[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-Ae)0^x[1]<(y(x[0]-_)Ae^(_<=x[0]&&x[0]<=w)){var L=Er(p,(-h+m)/g);return Rr(L,d),[x,Fr(L)]}}}function o(t,n){var a=r?e:Ae-e,i=0;return t<-a?i|=1:t>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(e,t,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=e-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(t,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=$r(),w=rn(t,r,n,a),T={point:A,lineStart:function(){T.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));T.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=e.merge(c);var r=function(e){for(var t=0,r=u.length,n=e[1],a=0;an&&ze(c,i,e)>0&&++t:i[1]<=n&&ze(c,i,e)<0&&--t,c=i;return 0!==t}([t,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),i&&Yr(c,o,r,k,s),s.polygonEnd()),c=u=f=null}};function k(e,o,s,c){var u=0,f=0;if(null==e||(u=i(e,s))!==(f=i(o,s))||l(e,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(e,i){return t<=e&&e<=n&&r<=i&&i<=a}function A(e,t){M(e,t)&&s.point(e,t)}function L(e,t){var r=M(e=Math.max(-1e9,Math.min(1e9,e)),t=Math.max(-1e9,Math.min(1e9,t)));if(u&&f.push([e,t]),y)d=e,p=t,h=r,y=!1,r&&(s.lineStart(),s.point(e,t));else if(r&&m)s.point(e,t);else{var n={a:{x:g,y:v},b:{x:e,y:t}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(e,t),x=!1)}g=e,v=t,m=r}return T};function i(e,a){return y(e[0]-t)0?0:3:y(e[0]-n)0?2:1:y(e[1]-r)0?1:0:a>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var r=i(e,1),n=i(t,1);return r!==n?r-n:0===r?t[1]-e[1]:1===r?e[0]-t[0]:2===r?e[1]-t[1]:t[0]-e[0]}}function an(e){var t=0,r=Ae/3,n=On(e),a=n(t,r);return a.parallels=function(e){return arguments.length?n(t=e[0]*Ae/180,r=e[1]*Ae/180):[t/Ae*180,r/Ae*180]},a}function on(e,t){var r=Math.sin(e),n=(r+Math.sin(t))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(e,t){var r=Math.sqrt(a-2*n*Math.sin(t))/n;return[r*Math.sin(e*=n),i-r*Math.cos(e)]}return o.invert=function(e,t){var r=i-t;return[Math.atan2(e,r)/n,Ee((a-(e*e+r*r)*n*n)/(2*n))]},o}e.geo.clipExtent=function(){var e,t,r,n,a,i,o={stream:function(e){return a&&(a.valid=!1),(a=i(e)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(e=+l[0][0],t=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=null),o):[[e,t],[r,n]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return an(on)}).raw=on,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){var t,r,n,a,i=e.geo.albers(),o=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(e,r){t=[e,r]}};function c(e){var i=e[0],o=e[1];return t=null,r(i,o),t||(n(i,o),t)||a(i,o),t}return c.invert=function(e){var t=i.scale(),r=i.translate(),n=(e[0]-r[0])/t,a=(e[1]-r[1])/t;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(e)},c.stream=function(e){var t=i.stream(e),r=o.stream(e),n=l.stream(e);return{point:function(e,a){t.point(e,a),r.point(e,a),n.point(e,a)},sphere:function(){t.sphere(),r.sphere(),n.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),l.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),l.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var t=i.scale(),u=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[u-.455*t,f-.238*t],[u+.455*t,f+.238*t]]).stream(s).point,n=o.translate([u-.307*t,f+.201*t]).clipExtent([[u-.425*t+ke,f+.12*t+ke],[u-.214*t-ke,f+.234*t-ke]]).stream(s).point,a=l.translate([u-.205*t,f+.212*t]).clipExtent([[u-.214*t+ke,f+.166*t+ke],[u-.115*t-ke,f+.234*t-ke]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:R,lineStart:R,lineEnd:R,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=R,ln+=y(sn/2)}};function hn(){var e,t,r,n;function a(e,t){sn+=n*e-r*t,r=e,n=t}pn.point=function(i,o){pn.point=a,e=r=i,t=n=o},pn.lineEnd=function(){a(e,t)}}var gn={point:function(e,t){efn&&(fn=e);tdn&&(dn=t)},lineStart:R,lineEnd:R,polygonStart:R,polygonEnd:R};function vn(){var e=mn(4.5),t=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=mn(t),r},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function n(r,n){t.push("M",r,",",n,e)}function a(e,n){t.push("M",e,",",n),r.point=i}function i(e,r){t.push("L",e,",",r)}function o(){r.point=n}function l(){t.push("Z")}return r}function mn(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var yn,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(e,t){xr+=e,br+=t,++_r}function _n(){var e,t;function r(r,n){var a=r-e,i=n-t,o=Math.sqrt(a*a+i*i);wr+=o*(e+r)/2,Tr+=o*(t+n)/2,kr+=o,bn(e=r,t=n)}xn.point=function(n,a){xn.point=r,bn(e=n,t=a)}}function wn(){xn.point=bn}function Tn(){var e,t,r,n;function a(e,t){var a=e-r,i=t-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+e)/2,Tr+=o*(n+t)/2,kr+=o,Mr+=(o=n*e-r*t)*(r+e),Ar+=o*(n+t),Lr+=3*o,bn(r=e,n=t)}xn.point=function(i,o){xn.point=a,bn(e=r=i,t=n=o)},xn.lineEnd=function(){a(e,t)}}function kn(e){var t=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=e,r},result:R};function n(r,n){e.moveTo(r+t,n),e.arc(r,n,t,0,Le)}function a(t,n){e.moveTo(t,n),r.point=i}function i(t,r){e.lineTo(t,r)}function o(){r.point=n}function l(){e.closePath()}return r}function Mn(e){var t=.5,r=Math.cos(30*Oe),n=16;function a(e){return(n?o:i)(e)}function i(t){return Sn(t,(function(r,n){r=e(r,n),t.point(r[0],r[1])}))}function o(t){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),v.lineStart=_},polygonEnd:function(){t.polygonEnd(),v.lineStart=y}};function m(r,n){r=e(r,n),t.point(r[0],r[1])}function y(){f=NaN,v.point=x,t.lineStart()}function x(r,a){var i=Dr([r,a]),o=e(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,t),t.point(f,d)}function b(){v.point=m,t.lineEnd()}function _(){y(),v.point=w,v.lineEnd=T}function w(e,t){x(r=e,t),a=f,i=d,o=p,s=h,c=g,v.point=x}function T(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,t),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*t&&v--){var w=o+p,T=s+h,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),L=y(y(k)-1)t||y((x*D+b*P)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(t)},a}function An(e){var t=Mn((function(t,r){return e([t*De,r*De])}));return function(e){return Dn(t(e))}}function Ln(e){this.stream=e}function Sn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Cn(e){return On((function(){return e}))()}function On(t){var r,n,a,i,o,l,s=Mn((function(e,t){return[(e=r(e,t))[0]*c+i,o-e[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=en,y=O,x=null,b=null;function _(e){return[(e=a(e[0]*Oe,e[1]*Oe))[0]*c+i,o-e[1]*c]}function w(e){return(e=a.invert((e[0]-i)/c,(o-e[1])/c))&&[e[0]*De,e[1]*De]}function T(){a=Gr(n=Rn(h,g,v),r);var e=r(d,p);return i=u-e[0]*c,o=f+e[1]*c,k()}function k(){return l&&(l.valid=!1,l=null),_}return _.stream=function(e){return l&&(l.valid=!1),(l=Dn(m(n,s(y(e))))).valid=!0,l},_.clipAngle=function(e){return arguments.length?(m=null==e?(x=e,en):tn((x=+e)*Oe),k()):x},_.clipExtent=function(e){return arguments.length?(b=e,y=e?nn(e[0][0],e[0][1],e[1][0],e[1][1]):O,k()):b},_.scale=function(e){return arguments.length?(c=+e,T()):c},_.translate=function(e){return arguments.length?(u=+e[0],f=+e[1],T()):[u,f]},_.center=function(e){return arguments.length?(d=e[0]%360*Oe,p=e[1]%360*Oe,T()):[d*De,p*De]},_.rotate=function(e){return arguments.length?(h=e[0]%360*Oe,g=e[1]%360*Oe,v=e.length>2?e[2]%360*Oe:0,T()):[h*De,g*De,v*De]},e.rebind(_,s,"precision"),function(){return r=t.apply(this,arguments),_.invert=r.invert&&w,T()}}function Dn(e){return Sn(e,(function(t,r){e.point(t*Oe,r*Oe)}))}function Pn(e,t){return[e,t]}function zn(e,t){return[e>Ae?e-Le:e<-Ae?e+Le:e,t]}function Rn(e,t,r){return e?t||r?Gr(In(e),Fn(t,r)):In(e):t||r?Fn(t,r):zn}function En(e){return function(t,r){return[(t+=e)>Ae?t-Le:t<-Ae?t+Le:t,r]}}function In(e){var t=En(e);return t.invert=En(-e),t}function Fn(e,t){var r=Math.cos(e),n=Math.sin(e),a=Math.cos(t),i=Math.sin(t);function o(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),Ee(u*a+s*i)]}return o.invert=function(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),Ee(u*r-l*n)]},o}function Nn(e,t){var r=Math.cos(e),n=Math.sin(e);return function(a,i,o,l){var s=o*t;null!=a?(a=Hn(r,a),i=Hn(r,i),(o>0?ai)&&(a+=o*Le)):(a=e+o*Le,i=e-.5*s);for(var c,u=a;o>0?u>i:u2?e[2]*Oe:0),t.invert=function(t){return(t=e.invert(t[0]*Oe,t[1]*Oe))[0]*=De,t[1]*=De,t},t},zn.invert=Pn,e.geo.circle=function(){var e,t,r=[0,0],n=6;function a(){var e="function"==typeof r?r.apply(this,arguments):r,n=Rn(-e[0]*Oe,-e[1]*Oe,0).invert,a=[];return t(null,null,1,{point:function(e,t){a.push(e=n(e,t)),e[0]*=De,e[1]*=De}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(e){return arguments.length?(r=e,a):r},a.angle=function(r){return arguments.length?(t=Nn((e=+r)*Oe,n*Oe),a):e},a.precision=function(r){return arguments.length?(t=Nn(e*Oe,(n=+r)*Oe),a):n},a.angle(90)},e.geo.distance=function(e,t){var r,n=(t[0]-e[0])*Oe,a=e[1]*Oe,i=t[1]*Oe,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},e.geo.graticule=function(){var t,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(a/g)*g,n,g).map(f).concat(e.range(Math.ceil(s/v)*v,l,v).map(d)).concat(e.range(Math.ceil(r/p)*p,t,p).filter((function(e){return y(e%g)>ke})).map(c)).concat(e.range(Math.ceil(o/h)*h,i,h).filter((function(e){return y(e%v)>ke})).map(u))}return x.lines=function(){return b().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(a=+e[0][0],n=+e[1][0],s=+e[0][1],l=+e[1][1],a>n&&(e=a,a=n,n=e),s>l&&(e=s,s=l,l=e),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(e){return arguments.length?(r=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],r>t&&(e=r,r=t,t=e),o>i&&(e=o,o=i,i=e),x.precision(m)):[[r,o],[t,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],x):[g,v]},x.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],x):[p,h]},x.precision=function(e){return arguments.length?(m=+e,c=jn(o,i,90),u=Bn(r,t,m),f=jn(s,l,90),d=Bn(a,n,m),x):m},x.majorExtent([[-180,-90+ke],[180,90-ke]]).minorExtent([[-180,-80-ke],[180,80+ke]])},e.geo.greatArc=function(){var t,r,n=Vn,a=Un;function i(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return e.geo.distance(t||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,i):n},i.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,i):a},i.precision=function(){return arguments.length?i:0},i},e.geo.interpolate=function(e,t){return r=e[0]*Oe,n=e[1]*Oe,a=t[0]*Oe,i=t[1]*Oe,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Fe(i-n)+o*s*Fe(a-r))),g=1/Math.sin(h),(v=h?function(e){var t=Math.sin(e*=h)*g,r=Math.sin(h-e)*g,n=r*u+t*d,a=r*f+t*p,i=r*l+t*c;return[Math.atan2(a,n)*De,Math.atan2(i,Math.sqrt(n*n+a*a))*De]}:function(){return[r*De,n*De]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},e.geo.length=function(t){return yn=0,e.geo.stream(t,qn),yn};var qn={sphere:R,point:R,lineStart:function(){var e,t,r;function n(n,a){var i=Math.sin(a*=Oe),o=Math.cos(a),l=y((n*=Oe)-e),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-t*o*s)*l),t*i+r*o*s),e=n,t=i,r=o}qn.point=function(a,i){e=a*Oe,t=Math.sin(i*=Oe),r=Math.cos(i),qn.point=n},qn.lineEnd=function(){qn.point=qn.lineEnd=R}},lineEnd:R,polygonStart:R,polygonEnd:R};function Gn(e,t){function r(t,r){var n=Math.cos(t),a=Math.cos(r),i=e(n*a);return[i*a*Math.sin(t),i*Math.sin(r)]}return r.invert=function(e,r){var n=Math.sqrt(e*e+r*r),a=t(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(e*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(e.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Yn=Gn((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),O);function Xn(e,t){var r=Math.cos(e),n=function(e){return Math.tan(Ae/4+e/2)},a=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(n(t)/n(e)),i=r*Math.pow(n(e),a)/a;if(!a)return Jn;function o(e,t){i>0?t<-Ce+ke&&(t=-Ce+ke):t>Ce-ke&&(t=Ce-ke);var r=i/Math.pow(n(t),a);return[r*Math.sin(a*e),i-r*Math.cos(a*e)]}return o.invert=function(e,t){var r=i-t,n=Pe(a)*Math.sqrt(e*e+r*r);return[Math.atan2(e,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ce]},o}function Wn(e,t){var r=Math.cos(e),n=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),a=r/n+e;if(y(n)1&&ze(e[r[n-2]],e[r[n-1]],e[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(e,t){return e[0]-t[0]||e[1]-t[1]}(e.geo.stereographic=function(){return Cn(ea)}).raw=ea,ta.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ce]},(e.geo.transverseMercator=function(){var e=$n(ta),t=e.center,r=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?r([e[0],e[1],e.length>2?e[2]+90:90]):[(e=r())[0],e[1],e[2]-90]},r([0,0,90])}).raw=ta,e.geom={},e.geom.hull=function(e){var t=ra,r=na;if(arguments.length)return n(e);function n(e){if(e.length<3)return[];var n,a=ht(t),i=ht(r),o=e.length,l=[],s=[];for(n=0;n=0;--n)p.push(e[l[c[n]][2]]);for(n=+f;nke)l=l.L;else{if(!((a=i-Ta(l,o))>ke)){n>-ke?(t=l.P,r=l):a>-ke?(t=l,r=l.N):t=r=l;break}if(!l.R){t=l;break}l=l.R}var s=ya(e);if(da.insert(t,s),t||r){if(t===r)return Sa(t),r=ya(t.site),da.insert(s,r),s.edge=r.edge=Da(t.site,s.site),La(t),void La(r);if(r){Sa(t),Sa(r);var c=t.site,u=c.x,f=c.y,d=e.x-u,p=e.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};za(r.edge,c,h,b),s.edge=Da(c,e,null,b),r.edge=Da(e,h,null,b),La(t),La(r)}else s.edge=Da(t.site,s.site)}}function wa(e,t){var r=e.site,n=r.x,a=r.y,i=a-t;if(!i)return n;var o=e.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-t;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function Ta(e,t){var r=e.N;if(r)return wa(r,t);var n=e.site;return n.y===t?n.x:1/0}function ka(e){this.site=e,this.edges=[]}function Ma(e,t){return t.angle-e.angle}function Aa(){Ia(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(e){var t=e.P,r=e.N;if(t&&r){var n=t.site,a=e.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Me)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=e,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,e.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xke||y(a-r)>ke)&&(l.splice(o,0,new Ra(Pa(i.site,u,y(n-f)ke?{x:f,y:y(t-f)ke?{x:y(r-h)ke?{x:d,y:y(t-d)ke?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=e[l]})),t}function l(e){return e.map((function(e,t){return{x:Math.round(n(e,t)/ke)*ke,y:Math.round(a(e,t)/ke)*ke,i:t}}))}return o.links=function(e){return ja(l(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return ja(l(e)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|t>=b,T=w+4;wi&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=$a.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,T=v-h;function k(e,t,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(e.leaf){var s=e.x,c=e.y;if(null!=s)if(y(s-r)+y(c-n)<.01)M(e,t,r,n,a,i,o,l);else{var u=e.point;e.x=e.y=e.point=null,M(e,u,s,c,a,i,o,l),M(e,t,r,n,a,i,o,l)}else e.x=r,e.y=n,e.point=t}else M(e,t,r,n,a,i,o,l)}function M(e,t,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;e.leaf=!1,u?a=s:o=s,f?i=c:l=c,k(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,r,n,a,i,o,l)}w>T?v=h+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){k(A,e,+m(e,++f),+x(e,f),p,h,g,v)},visit:function(e){Ga(e,A,p,h,g,v)},find:function(e){return Za(A,e[0],e[1],p,h,g,v)}};if(f=-1,null==t){for(;++f=0&&!(n=e.interpolators[a](t,r)););return n}function ei(e,t){var r,n=[],a=[],i=e.length,o=t.length,l=Math.min(e.length,t.length);for(r=0;r=1?1:e(t)}}function ii(e){return function(t){return 1-e(1-t)}}function oi(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function li(e){return e*e}function si(e){return e*e*e}function ci(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function ui(e){return 1-Math.cos(e*Ce)}function fi(e){return Math.pow(2,10*(e-1))}function di(e){return 1-Math.sqrt(1-e*e)}function pi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function hi(e,t){return t-=e,function(r){return Math.round(e+t*r)}}function gi(e){var t,r,n,a=[e.a,e.b],i=[e.c,e.d],o=mi(a),l=vi(a,i),s=mi(((t=i)[0]+=(n=-l)*(r=a)[0],t[1]+=n*r[1],t))||0;a[0]*i[1]=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):"in";return n=ri.get(n)||ti,ai((a=ni.get(a)||O)(n.apply(null,r.call(arguments,1))))},e.interpolateHcl=function(t,r){t=e.hcl(t),r=e.hcl(r);var n=t.h,a=t.c,i=t.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Xe(n+o*e,a+l*e,i+s*e)+""}},e.interpolateHsl=function(t,r){t=e.hsl(t),r=e.hsl(r);var n=t.h,a=t.s,i=t.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ge(n+o*e,a+l*e,i+s*e)+""}},e.interpolateLab=function(t,r){t=e.lab(t),r=e.lab(r);var n=t.l,a=t.a,i=t.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(e){return $e(n+o*e,a+l*e,i+s*e)+""}},e.interpolateRound=hi,e.transform=function(t){var r=a.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(null!=e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate()}return new gi(t?t.matrix:yi)})(t)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(e){return e.length?e.pop()+",":""}function bi(t,r){var n=[],a=[];return t=e.transform(t),r=e.transform(r),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}(t.translate,r.translate,n,a),function(e,t,r,n){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(e,t)})):t&&r.push(xi(r)+"rotate("+t+")")}(t.rotate,r.rotate,n,a),function(e,t,r,n){e!==t?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(e,t)}):t&&r.push(xi(r)+"skewX("+t+")")}(t.skew,r.skew,n,a),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else 1===t[0]&&1===t[1]||r.push(xi(r)+"scale("+t+")")}(t.scale,r.scale,n,a),t=r=null,function(e){for(var t,r=-1,i=a.length;++r0?n=e:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:n=0})):e>0&&(s.start({type:"start",alpha:n=e}),t=wt(l.tick)),l):n},l.start=function(){var e,t,r,n=m.length,s=y.length,u=c[0],h=c[1];for(e=0;e=0;)r.push(a[n])}function Ri(e,t){for(var r=[e],n=[];null!=(e=r.pop());)if(n.push(e),(i=e.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ri(a,(function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)})),l}return n.sort=function(t){return arguments.length?(e=t,n):e},n.children=function(e){return arguments.length?(t=e,n):t},n.value=function(e){return arguments.length?(r=e,n):r},n.revalue=function(e){return r&&(zi(e,(function(e){e.children&&(e.value=0)})),Ri(e,(function(e){var t;e.children||(e.value=+r.call(n,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},n},e.layout.partition=function(){var t=e.layout.hierarchy(),r=[1,1];function n(e,n){var a=t.call(this,e,n);return function e(t,r,n,a){var i=t.children;if(t.x=r,t.y=t.depth*a,t.dx=n,t.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=t.value?n/t.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=t);return n}function Xi(e){return e.reduce(Wi,0)}function Wi(e,t){return e+t[1]}function Qi(e,t){return Ji(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Ji(e,t){for(var r=-1,n=+e[0],a=(e[1]-n)/t,i=[];++r<=t;)i[r]=a*r+n;return i}function $i(t){return[e.min(t),e.max(t)]}function Ki(e,t){return e.value-t.value}function eo(e,t){var r=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=r,r._pack_prev=t}function to(e,t){e._pack_next=t,t._pack_prev=e}function ro(e,t){var r=t.x-e.x,n=t.y-e.y,a=e.r+t.r;return.999*a*a>r*r+n*n}function no(e){if((t=e.children)&&(s=t.length)){var t,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(t.forEach(ao),(r=t[0]).x=-r.r,r.y=0,x(r),s>1&&((n=t[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=t[2]),x(a),eo(r,a),r._pack_prev=a,eo(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[e.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(e){return arguments.length?(r=e,i):r},i.range=function(e){return arguments.length?(n=ht(e),i):n},i.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return Ji(t,e)}:ht(e),i):a},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},e.layout.pack=function(){var t,r=e.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(e,i){var o=r.call(this,e,i),l=o[0],s=a[0],c=a[1],u=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(l.x=l.y=0,Ri(l,(function(e){e.r=+u(e.value)})),Ri(l,no),n){var f=n*(t?1:Math.max(2*l.r/s,2*l.r/c))/2;Ri(l,(function(e){e.r+=f})),Ri(l,no),Ri(l,(function(e){e.r-=f}))}return function e(t,r,n,a){var i=t.children;if(t.x=r+=a*t.x,t.y=n+=a*t.y,t.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);zi(u,(function(e){e.x=(e.x+g)*v,e.y=e.depth*m}))}return c}function o(e){var t=e.children,n=e.parent.children,a=e.i?n[e.i-1]:null;if(t.length){!function(e){var t,r=0,n=0,a=e.children,i=a.length;for(;--i>=0;)(t=a[i]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;a?(e.z=a.z+r(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+r(e._,a._));e.parent.A=function(e,t,n){if(t){for(var a,i=e,o=e,l=t,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=e,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,e,n),e,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=e)}return n}(e,a,e.parent.A||n[0])}function l(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e)?s:null,i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null==(n=e)?null:s,i):a?n:null},Pi(i,t)},e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=t.call(this,i,o),c=s[0],u=0;Ri(c,(function(t){var n=t.children;n&&n.length?(t.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),t.y=function(t){return 1+e.max(t,(function(e){return e.y}))}(n)):(t.x=l?u+=r(t,l):0,t.y=0,l=t)}));var f=function e(t){var r=t.children;return r&&r.length?e(r[0]):t}(c),d=function e(t){var r,n=t.children;return n&&(r=n.length)?e(n[r-1]):t}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return Ri(c,a?function(e){e.x=(e.x-c.x)*n[0],e.y=(c.y-e.y)*n[1]}:function(e){e.x=(e.x-p)/(h-p)*n[0],e.y=(1-(c.y?e.y/c.y:1))*n[1]}),s}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e),i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null!=(n=e),i):a?n:null},Pi(i,t)},e.layout.treemap=function(){var t,r=e.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(e,t){for(var r,n,a=-1,i=e.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var r,n=o(e),a=t.slice(),i=[];for(u(a,n.dx*n.dy/e.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);t.forEach(d)}}function p(e,t){for(var r,n=e.area,a=0,i=1/0,o=-1,l=e.length;++oa&&(a=r));return t*=t,(n*=n)?Math.max(t*a*c/n,n/(t*i*c)):1/0}function h(e,t,r,a){var i,o=-1,l=e.length,s=r.x,c=r.y,u=t?n(e.area/t):0;if(t==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return e+t*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var r=e.random.irwinHall(t);return function(){return r()/t}},irwinHall:function(e){return function(){for(var t=0,r=0;r2?_o:mo,l=a?wi:_i;return i=e(t,r,l,n),o=e(r,t,l,Ka),s}function s(e){return i(e)}return s.invert=function(e){return o(e)},s.domain=function(e){return arguments.length?(t=e.map(Number),l()):t},s.range=function(e){return arguments.length?(r=e,l()):r},s.rangeRound=function(e){return s.range(e).interpolate(hi)},s.clamp=function(e){return arguments.length?(a=e,l()):a},s.interpolate=function(e){return arguments.length?(n=e,l()):n},s.ticks=function(e){return Mo(t,e)},s.tickFormat=function(e,r){return Ao(t,e,r)},s.nice=function(e){return To(t,e),l()},s.copy=function(){return e(t,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}e.scale.log=function(){return function t(r,n,a,i){function o(e){return(a?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function l(e){return a?Math.pow(n,e):-Math.pow(n,-e)}function s(e){return r(o(e))}return s.invert=function(e){return l(r.invert(e))},s.domain=function(e){return arguments.length?(a=e[0]>=0,r.domain((i=e.map(Number)).map(o)),s):i},s.base=function(e){return arguments.length?(n=+e,r.domain(i.map(o)),s):n},s.nice=function(){var e=yo(i.map(o),a?Math:Oo);return r.domain(e),i=e.map(l),s},s.ticks=function(){var e=go(i),t=[],r=e[0],s=e[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)t.push(l(c)*d);for(c=0;t[c]s;u--);t=t.slice(c,u)}return t},s.tickFormat=function(t,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=e.format(r));var a=Math.max(1,n*t/s.ticks().length);return function(e){var t=e/l(Math.round(o(e)));return t*n0?a[e-1]:r[0],ef?0:1;if(c=Se)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,T,k,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=Ee(v/c*Math.sin(m))),l&&(A=Ee(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Ae?0:1;if(L&&Uo(y,x,b,_)===p^C){var O=(u+f)/2;y=c*Math.cos(O),x=c*Math.sin(O),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),T=l*Math.sin(f-A),k=l*Math.cos(u+A),M=l*Math.sin(u+A);var D=Math.abs(u-f+2*A)<=Ae?0:1;if(A&&Uo(w,T,k,M)===1-p^D){var P=(u+f)/2;w=l*Math.cos(P),T=l*Math.sin(P),k=M=null}}else w=T=0;if(d>ke&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function qo(e,t,r,n,a){var i=e[0]-t[0],o=e[1]-t[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=e[0]+s,f=e[1]+c,d=t[0]+s,p=t[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,T=(-b*v-m*_)/y,k=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=T-g,S=k-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=k,T=M),[[w-s,T-c],[w*r/x,T*r/x]]}function Go(e){var t=ra,r=na,n=Zr,a=Yo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=ht(t),p=ht(r);function h(){s.push("M",a(e(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Qo,basis:Ko,"basis-open":function(e){if(e.length<4)return Yo(e);var t,r=[],n=-1,a=e.length,i=[0],o=[0];for(;++n<3;)t=e[n],i.push(t[0]),o.push(t[1]);r.push(el(nl,i)+","+el(nl,o)),--n;for(;++n9&&(a=3*t/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(e[Math.min(s,l+1)][0]-e[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(e))}});function Yo(e){return e.length>1?e.join("L"):e+"Z"}function Xo(e){return e.join("L")+"Z"}function Wo(e){for(var t=0,r=e.length,n=e[0],a=[n[0],",",n[1]];++t1){l=t[1],i=e[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAe)+",1 "+t}function s(e,t,r,n){return"Q 0,0 "+n}return i.radius=function(e){return arguments.length?(r=ht(e),i):r},i.source=function(t){return arguments.length?(e=ht(t),i):e},i.target=function(e){return arguments.length?(t=ht(e),i):t},i.startAngle=function(e){return arguments.length?(n=ht(e),i):n},i.endAngle=function(e){return arguments.length?(a=ht(e),i):a},i},e.svg.diagonal=function(){var e=Vn,t=Un,r=cl;function n(n,a){var i=e.call(this,n,a),o=t.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(t){return arguments.length?(e=ht(t),n):e},n.target=function(e){return arguments.length?(t=ht(e),n):t},n.projection=function(e){return arguments.length?(r=e,n):r},n},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),r=cl,n=t.projection;return t.projection=function(e){return arguments.length?n(ul(r=e)):r},t},e.svg.symbol=function(){var e=dl,t=fl;function r(r,n){return(hl.get(e.call(this,r,n))||pl)(t.call(this,r,n))}return r.type=function(t){return arguments.length?(e=ht(t),r):e},r.size=function(e){return arguments.length?(t=ht(e),r):t},r};var hl=e.map({circle:pl,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vl)),r=t*vl;return"M0,"+-t+"L"+r+",0 0,"+t+" "+-r+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});e.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Oe);Z.transition=function(e){for(var t,r,n=bl||++Tl,a=Al(e),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(e,o);if(i>=1)return f.event&&f.event.end.call(e,e.__data__,t),--u.count?delete u[n]:delete e[r],1}f||(i=a.time,o=wt((function(e){var t=f.delay;if(o.t=t+i,t<=e)return d(e-t);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:t},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,e.transition=function(t,r){return t&&t.transition?bl?t.transition(r):t:e.selection().transition(t)},e.transition.prototype=wl,wl.select=function(e){var t,r,n,a=this.id,i=this.namespace,o=[];e=Y(e);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=e.select(e.event.target),x=n.of(m,arguments),b=e.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=be(m),A=e.mouse(m),L=e.select(o(m)).on("keydown.brush",O).on("keyup.brush",D);if(e.event.changedTouches?L.on("touchmove.brush",P).on("touchend.brush",R):L.on("mousemove.brush",P).on("mouseup.brush",R),b.interrupt().selectAll("*").interrupt(),k)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else e.event.altKey&&(f=A.slice());function O(){32==e.event.keyCode&&(k||(f=null,A[0]-=l[1],A[1]-=s[1],k=2),F())}function D(){32==e.event.keyCode&&2==k&&(A[0]+=l[1],A[1]+=s[1],k=0,F())}function P(){var t=e.mouse(m),r=!1;v&&(t[0]+=v[0],t[1]+=v[1]),k||(e.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(t[0]1?{floor:function(t){for(;l(t=e.floor(t));)t=Hl(t-1);return t},ceil:function(t){for(;l(t=e.ceil(t));)t=Hl(+t+1);return t}}:e))},a.ticks=function(e,t){var r=go(a.domain()),n=null==e?i(r,10):"number"==typeof e?i(r,e):!e.range&&[{range:e},t];return n&&(e=n[0],t=n[1]),e.range(r[0],Hl(+r[1]+1),t<1?1:t)},a.tickFormat=function(){return n},a.copy=function(){return Nl(t.copy(),r,n)},wo(a,t)}function Hl(e){return new Date(e)}Rl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Il,Fl.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Fl.toString=Il.toString,Pt.second=It((function(e){return new zt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Pt.seconds=Pt.second.range,Pt.seconds.utc=Pt.second.utc.range,Pt.minute=It((function(e){return new zt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Pt.minutes=Pt.minute.range,Pt.minutes.utc=Pt.minute.utc.range,Pt.hour=It((function(e){var t=e.getTimezoneOffset()/60;return new zt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Pt.hours=Pt.hour.range,Pt.hours.utc=Pt.hour.utc.range,Pt.month=It((function(e){return(e=Pt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Pt.months=Pt.month.range,Pt.months.utc=Pt.month.utc.range;var jl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Bl=[[Pt.second,1],[Pt.second,5],[Pt.second,15],[Pt.second,30],[Pt.minute,1],[Pt.minute,5],[Pt.minute,15],[Pt.minute,30],[Pt.hour,1],[Pt.hour,3],[Pt.hour,6],[Pt.hour,12],[Pt.day,1],[Pt.day,2],[Pt.week,1],[Pt.month,1],[Pt.month,3],[Pt.year,1]],Vl=Rl.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Zr]]),Ul={range:function(t,r,n){return e.range(Math.ceil(t/n)*n,+r,n).map(Hl)},floor:O,ceil:O};Bl.year=Pt.year,Pt.scale=function(){return Nl(e.scale.linear(),Bl,Vl)};var ql=Bl.map((function(e){return[e[0].utc,e[1]]})),Gl=El.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Zr]]);function Zl(e){return JSON.parse(e.responseText)}function Yl(e){var t=a.createRange();return t.selectNode(a.body),t.createContextualFragment(e.responseText)}ql.year=Pt.year.utc,Pt.scale.utc=function(){return Nl(e.scale.linear(),ql,Gl)},e.text=gt((function(e){return e.responseText})),e.json=function(e,t){return vt(e,"application/json",Zl,t)},e.html=function(e,t){return vt(e,"text/html",Yl,t)},e.xml=gt((function(e){return e.responseXML})),"object"==typeof t&&t.exports?t.exports=e:this.d3=e}()},{}],10:[function(e,t,r){(function(n,a){(function(){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -12,10 +12,10 @@ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ -!function(e,n){"object"==typeof r&&"undefined"!=typeof t?t.exports=n():e.ES6Promise=n()}(this,(function(){"use strict";function t(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,o=void 0,l=void 0,s=function(e,t){g[i]=e,g[i+1]=t,2===(i+=2)&&(l?l(v):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},f=u.MutationObserver||u.WebKitMutationObserver,d="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(v,1)}}var g=new Array(1e3);function v(){for(var e=0;e13)&&32!==t&&133!==t&&160!==t&&5760!==t&&6158!==t&&(t<8192||t>8205)&&8232!==t&&8233!==t&&8239!==t&&8287!==t&&8288!==t&&12288!==t&&65279!==t)return!1;return!0}},{}],17:[function(e,t,r){var n={left:0,top:0};t.exports=function(e,t,r){t=t||e.currentTarget||e.srcElement,Array.isArray(r)||(r=[0,0]);var a=e.clientX||0,i=e.clientY||0,o=(l=t,l===window||l===document||l===document.body?n:l.getBoundingClientRect());var l;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],18:[function(e,t,r){t.exports=function(e){var t=[];return e.replace(a,(function(e,r,a){var o=r.toLowerCase();for(a=function(e){var t=e.match(i);return t?t.map(Number):[]}(a),"m"==o&&a.length>2&&(t.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),t.push(a);if(a.length13)&&32!==t&&133!==t&&160!==t&&5760!==t&&6158!==t&&(t<8192||t>8205)&&8232!==t&&8233!==t&&8239!==t&&8287!==t&&8288!==t&&12288!==t&&65279!==t)return!1;return!0}},{}],46:[function(e,t,r){var n={left:0,top:0};t.exports=function(e,t,r){t=t||e.currentTarget||e.srcElement,Array.isArray(r)||(r=[0,0]);var a=e.clientX||0,i=e.clientY||0,o=(l=t,l===window||l===document||l===document.body?n:l.getBoundingClientRect());var l;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],47:[function(e,t,r){t.exports=function(e){var t=[];return e.replace(a,(function(e,r,a){var o=r.toLowerCase();for(a=function(e){var t=e.match(i);return t?t.map(Number):[]}(a),"m"==o&&a.length>2&&(t.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),t.push(a);if(a.length=-e},pointBetween:function(t,r,n){var a=t[1]-r[1],i=n[0]-r[0],o=t[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-e)},pointsSameX:function(t,r){return Math.abs(t[0]-r[0])e!=o-a>e&&(i-c)*(a-u)/(o-u)+c-n>e&&(l=!l),i=c,o=u}return l}};return t}},{}],22:[function(e,t,r){var n={toPolygon:function(e,t){function r(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function r(t){var r=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[r]})}for(var n=r(t[0]),a=1;a0}))}function u(e,n){var a=e.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=t.linesIntersect(o,l,c,u);if(!1===f){if(!t.pointsCollinear(o,l,c))return!1;if(t.pointsSame(o,u)||t.pointsSame(l,c))return!1;var d=t.pointsSame(o,c),p=t.pointsSame(l,u);if(d&&p)return n;var h=!d&&t.pointBetween(o,c,u),g=!p&&t.pointBetween(l,c,u);if(d)return g?s(n,l):s(e,u),n;h&&(p||(g?s(n,l):s(e,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(e,c):0===f.alongB?s(e,f.pt):1===f.alongB&&s(e,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var e=u(d,h);if(e)return e}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(e)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(e)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return e?{addRegion:function(e){for(var n,a,i,o=e[e.length-1],s=0;s1)for(var r=1;r1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=O(e,360),t=O(t,100),r=O(r,100),0===t)n=a=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,s=2*r-l;n=o(s,l,e+1/3),a=o(s,l,e),i=o(s,l,e-1/3)}return{r:255*n,g:255*a,b:255*i}}(t.h,s,u),f=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,h,g;return i=C(i),{ok:f,format:t.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(e,t,r){e=O(e,255),t=O(t,255),r=O(r,255);var n,a,i=l(e,t,r),s=o(e,t,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case e:n=(t-r)/u+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/t;t--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.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 e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,n,a=this.toRgb();return t=a.r/255,r=a.g/255,n=a.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[z(i(e).toString(16)),z(i(t).toString(16)),z(i(r).toString(16)),z(R(n))];if(a&&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,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=c(e);r="#"+p(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));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(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:E(e[n]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),a=c(t).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(t,r){var n=c(t),a=c(r);return(e.max(n.getLuminance(),a.getLuminance())+.05)/(e.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,a,i=c.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(e,t,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(t[u]));return c.isReadable(e,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],r))};var L=c.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=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(L);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function O(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,l(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function D(e){return o(1,l(0,e))}function P(e){return parseInt(e,16)}function z(e){return 1==e.length?"0"+e:""+e}function E(e){return e<=1&&(e=100*e+"%"),e}function R(t){return e.round(255*parseFloat(t)).toString(16)}function I(e){return P(e)/255}var F,N,H,B=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",H="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+H),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+H),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+H),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 j(e){return!!B.CSS_UNIT.exec(e)}"undefined"!=typeof t&&t.exports?t.exports=c:window.tinycolor=c}(Math)},{}],29:[function(e,t,r){"use strict";t.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}]},{}],30:[function(e,t,r){"use strict";var n=e("./arrow_paths"),a=e("../../plots/font_attributes"),i=e("../../plots/cartesian/constants"),o=e("../../plot_api/plot_template").templatedArray;t.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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":205,"../../plots/cartesian/constants":221,"../../plots/font_attributes":243,"./arrow_paths":29}],31:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("./draw").draw;function o(e){var t=e._fullLayout;n.filterVisible(t.annotations).forEach((function(t){var r=a.getFromId(e,t.xref),n=a.getFromId(e,t.yref);t._extremes={},r&&l(t,r),n&&l(t,n)}))}function l(e,t){var r,n=t._id,i=n.charAt(0),o=e[i],l=e["a"+i],s=e[i+"ref"],c=e["a"+i+"ref"],u=e["_"+i+"padplus"],f=e["_"+i+"padminus"],d={x:1,y:-1}[i]*e[i+"shift"],p=3*e.arrowsize*e.arrowwidth||0,h=p+d,g=p-d,v=3*e.startarrowsize*e.arrowwidth||0,m=v+d,y=v-d;if(c===s){var x=a.findExtremes(t,[t.r2c(o)],{ppadplus:h,ppadminus:g}),b=a.findExtremes(t,[t.r2c(l)],{ppadplus:Math.max(u,m),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else m=l?m+l:m,y=l?y-l:y,r=a.findExtremes(t,[t.r2c(o)],{ppadplus:Math.max(u,h,m),ppadminus:Math.max(f,g,y)});e._extremes[n]=r}t.exports=function(e){var t=e._fullLayout;if(n.filterVisible(t.annotations).length&&e._fullData.length)return n.syncOrAsync([i,o],e)}},{"../../lib":171,"../../plots/cartesian/axes":215,"./draw":36}],32:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("../../plot_api/plot_template").arrayEditor;function o(e,t){var r,n,a,i,o,s,c,u=e._fullLayout.annotations,f=[],d=[],p=[],h=(t||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(e,t){var r,l,s=o(e,t),c=s.on,u=s.off.concat(s.explicitOff),f={},d=e._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[t]}for(var q=!1,G=["x","y"],Z=0;Z1)&&(ee===K?((ce=te.r2fraction(t["a"+$]))<0||ce>1)&&(q=!0):q=!0),Y=te._offset+te.r2p(t[$]),Q=.5}else"x"===$?(W=t[$],Y=b.l+b.w*W):(W=1-t[$],Y=b.t+b.h*W),Q=t.showarrow?.5:W;if(t.showarrow){se.head=Y;var ue=t["a"+$];J=ne*j(.5,t.xanchor)-ae*j(.5,t.yanchor),ee===K?(se.tail=te._offset+te.r2p(ue),X=J):(se.tail=Y+ue,X=J+ue),se.text=se.tail+J;var fe=x["x"===$?"width":"height"];if("paper"===K&&(se.head=o.constrain(se.head,1,fe-1)),"pixel"===ee){var de=-Math.max(se.tail-3,se.text),pe=Math.min(se.tail+3,se.text)-fe;de>0?(se.tail+=de,se.text+=de):pe>0&&(se.tail-=pe,se.text-=pe)}se.tail+=le,se.head+=le}else X=J=ie*j(Q,oe),se.text=Y+J;se.text+=le,J+=le,X+=le,t["_"+$+"padplus"]=ie/2+X,t["_"+$+"padminus"]=ie/2-X,t["_"+$+"size"]=ie,t["_"+$+"shift"]=J}if(q)z.remove();else{var he=0,ge=0;if("left"!==t.align&&(he=(w-m)*("center"===t.align?.5:1)),"top"!==t.valign&&(ge=(P-y)*("middle"===t.valign?.5:1)),u)n.select("svg").attr({x:I+he-1,y:I+ge}).call(c.setClipUrl,N?A:null,e);else{var ve=I+ge-h.top,me=I+he-h.left;U.call(f.positionText,me,ve).call(c.setClipUrl,N?A:null,e)}H.select("rect").call(c.setRect,I,I,w,P),F.call(c.setRect,E/2,E/2,R-E,B-E),z.call(c.setTranslate,Math.round(L.x.text-R/2),Math.round(L.y.text-B/2)),O.attr({transform:"rotate("+S+","+L.x.text+","+L.y.text+")"});var ye,xe=function(r,n){C.selectAll(".annotation-arrow-g").remove();var u=L.x.head,f=L.y.head,d=L.x.tail+r,h=L.y.tail+n,m=L.x.text+r,y=L.y.text+n,x=o.rotationXYMatrix(S,m,y),w=o.apply2DTransform(x),A=o.apply2DTransform2(x),D=+F.attr("width"),P=+F.attr("height"),E=m-.5*D,R=E+D,I=y-.5*P,N=I+P,H=[[E,I,E,N],[E,N,R,N],[R,N,R,I],[R,I,E,I]].map(A);if(!H.reduce((function(e,t){return e^!!o.segmentsIntersect(u,f,u+1e6,f+1e6,t[0],t[1],t[2],t[3])}),!1)){H.forEach((function(e){var t=o.segmentsIntersect(d,h,u,f,e[0],e[1],e[2],e[3]);t&&(d=t.x,h=t.y)}));var B=t.arrowwidth,j=t.arrowcolor,U=t.arrowside,V=C.append("g").style({opacity:s.opacity(j)}).classed("annotation-arrow-g",!0),q=V.append("path").attr("d","M"+d+","+h+"L"+u+","+f).style("stroke-width",B+"px").call(s.stroke,s.rgb(j));if(g(q,U,t),_.annotationPosition&&q.node().parentNode&&!i){var G=u,Z=f;if(t.standoff){var Y=Math.sqrt(Math.pow(u-d,2)+Math.pow(f-h,2));G+=t.standoff*(d-u)/Y,Z+=t.standoff*(h-f)/Y}var X,W,Q=V.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-G)+","+(h-Z),transform:"translate("+G+","+Z+")"}).style("stroke-width",B+6+"px").call(s.stroke,"rgba(0,0,0,0)").call(s.fill,"rgba(0,0,0,0)");p.init({element:Q.node(),gd:e,prepFn:function(){var e=c.getTranslate(z);X=e.x,W=e.y,l&&l.autorange&&T(l._name+".autorange",!0),v&&v.autorange&&T(v._name+".autorange",!0)},moveFn:function(e,r){var n=w(X,W),a=n[0]+e,i=n[1]+r;z.call(c.setTranslate,a,i),k("x",l?l.p2r(l.r2p(t.x)+e):t.x+e/b.w),k("y",v?v.p2r(v.r2p(t.y)+r):t.y-r/b.h),t.axref===t.xref&&k("ax",l.p2r(l.r2p(t.ax)+e)),t.ayref===t.yref&&k("ay",v.p2r(v.r2p(t.ay)+r)),V.attr("transform","translate("+e+","+r+")"),O.attr({transform:"rotate("+S+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",e,M());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}};if(t.showarrow&&xe(0,0),D)p.init({element:z.node(),gd:e,prepFn:function(){ye=O.attr("transform")},moveFn:function(e,r){var n="pointer";if(t.showarrow)t.axref===t.xref?k("ax",l.p2r(l.r2p(t.ax)+e)):k("ax",t.ax+e),t.ayref===t.yref?k("ay",v.p2r(v.r2p(t.ay)+r)):k("ay",t.ay+r),xe(e,r);else{if(i)return;var a,o;if(l)a=l.p2r(l.r2p(t.x)+e);else{var s=t._xsize/b.w,c=t.x+(t._xshift-t.xshift)/b.w-s/2;a=p.align(c+e/b.w,s,0,1,t.xanchor)}if(v)o=v.p2r(v.r2p(t.y)+r);else{var u=t._ysize/b.h,f=t.y-(t._yshift+t.yshift)/b.h-u/2;o=p.align(f-r/b.h,u,0,1,t.yanchor)}k("x",a),k("y",o),l&&v||(n=p.getCursor(l?.5:a,v?.5:o,t.xanchor,t.yanchor))}O.attr({transform:"translate("+e+","+r+")"+ye}),d(z,n)},clickFn:function(r,n){t.captureevents&&e.emit("plotly_clickannotation",V(n))},doneFn:function(){d(z),a.call("_guiRelayout",e,M());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}}t.exports={draw:function(e){var t=e._fullLayout;t._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,v=t.indexOf("end")>=0,m=f.backoff*p+r.standoff,y=d.backoff*h+r.startstandoff;if("line"===u.nodeName){o={x:+e.attr("x1"),y:+e.attr("y1")},l={x:+e.attr("x2"),y:+e.attr("y2")};var x=o.x-l.x,b=o.y-l.y;if(c=(s=Math.atan2(b,x))+Math.PI,m&&y&&m+y>Math.sqrt(x*x+b*b))return void D();if(m){if(m*m>x*x+b*b)return void D();var _=m*Math.cos(s),w=m*Math.sin(s);l.x+=_,l.y+=w,e.attr({x2:l.x,y2:l.y})}if(y){if(y*y>x*x+b*b)return void D();var T=y*Math.cos(s),k=y*Math.sin(s);o.x-=T,o.y-=k,e.attr({x1:o.x,y1:o.y})}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(M1){c=!0;break}}c?e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove():(s._pdata=a(e.glplot.cameraParams,[t.xaxis.r2l(s.x)*r[0],t.yaxis.r2l(s.y)*r[1],t.zaxis.r2l(s.z)*r[2]]),n(e.graphDiv,s,l,e.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":246,"../annotations/draw":36}],43:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:e("./attributes")}}},layoutAttributes:e("./attributes"),handleDefaults:e("./defaults"),includeBasePlot:function(e,t){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var i=r.attrRegex,o=Object.keys(e),l=0;l=0))return e;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return e}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(e){var t=e.toRgb();return"rgb("+Math.round(t.r)+", "+Math.round(t.g)+", "+Math.round(t.b)+")"},i.rgb=function(e){return i.tinyRGB(n(e))},i.opacity=function(e){return e?n(e).getAlpha():0},i.addOpacity=function(e,t){var r=n(e).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+t+")"},i.combine=function(e,t){var r=n(e).toRgb();if(1===r.a)return n(e).toRgbString();var a=n(t||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(e,t,r){var a=n(e);return 1!==a.getAlpha()&&(a=n(i.combine(e,s))),(a.isDark()?t?a.lighten(t):s:r?a.darken(r):l).toString()},i.stroke=function(e,t){var r=n(t);e.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(e,t){var r=n(t);e.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(e){if(e&&"object"==typeof e){var t,r,n,a,o=Object.keys(e);for(t=0;t0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var W=Math.pow(10,Math.floor(Math.log(X)/Math.LN10));Z*=W*c.roundUp(X/W,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=Z}G.domain=[U+H,U+I-H],G.setScale(),e.attr("transform","translate("+Math.round(s.l)+","+Math.round(s.t)+")");var Q,J=e.select("."+k.cbtitleunshift).attr("transform","translate(-"+Math.round(s.l)+",-"+Math.round(s.t)+")"),$=e.select("."+k.cbaxis),K=0;function ee(n,a){var i={propContainer:G,propName:t._propPrefix+"title",traceIndex:t._traceIndex,_meta:t._meta,placeholder:o._dfltTitle.colorbar,containerGroup:e.select("."+k.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;e.selectAll("."+l+",."+l+"-math-group").remove(),h.draw(r,n,u(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(M)){var e,r=s.l+(t.x+F)*s.w,n=G.title.font.size;e="top"===M?(1-(U+I-H))*s.h+s.t+3+.75*n:(1-(U+H))*s.h+s.t-3-.25*n,ee(G._id+"title",{attributes:{x:r,y:e,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(M)){var i=e.select("."+k.cbtitle),o=i.select("text"),u=[-t.outlinewidth/2,t.outlinewidth/2],f=i.select(".h"+G._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*_),f?(K=d.bBox(f).height)>p&&(u[1]-=(K-p)/2):o.node()&&!o.classed(k.jsPlaceholder)&&(K=d.bBox(o.node()).height),K){if(K+=5,"top"===M)G.domain[1]-=K/s.h,u[1]*=-1;else{G.domain[0]+=K/s.h;var h=g.lineCount(o);u[1]+=(1-h)*p}i.attr("transform","translate("+u+")"),G.setScale()}}e.selectAll("."+k.cbfills+",."+k.cblines).attr("transform","translate(0,"+Math.round(s.h*(1-G.domain[1]))+")"),$.attr("transform","translate(0,"+Math.round(-s.t)+")");var m=e.select("."+k.cbfills).selectAll("rect."+k.cbfill).data(D);m.enter().append("rect").classed(k.cbfill,!0).style("stroke","none"),m.exit().remove();var y=A.map(G.c2p).map(Math.round).sort((function(e,t){return e-t}));m.each((function(e,i){var o=[0===i?A[0]:(D[i]+D[i-1])/2,i===D.length-1?A[1]:(D[i]+D[i+1])/2].map(G.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var l=n.select(this).attr({x:B,width:Math.max(z,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(t._fillgradient)d.gradient(l,r,t._id,"vertical",t._fillgradient,"fill");else{var s=S(e).replace("e-","");l.attr("fill",a(s).toHexString())}}));var x=e.select("."+k.cblines).selectAll("path."+k.cbline).data(v.color&&v.width?P:[]);x.enter().append("path").classed(k.cbline,!0),x.exit().remove(),x.each((function(e){n.select(this).attr("d","M"+B+","+(Math.round(G.c2p(e))+v.width/2%1)+"h"+z).call(d.lineGroupStyle,v.width,L(e),v.dash)})),$.selectAll("g."+G._id+"tick,path").remove();var b=B+z+(t.outlinewidth||0)/2-("outside"===t.ticks?1:0),w=l.calcTicks(G),T=l.makeTransFn(G),C=l.getTickSigns(G)[2];return l.drawTicks(r,G,{vals:"inside"===G.ticks?l.clipEnds(G,w):w,layer:$,path:l.makeTickPath(G,b,C),transFn:T}),l.drawLabels(r,G,{vals:w,layer:$,transFn:T,labelFns:l.makeLabelFns(G,b)})},function(){if(-1===["top","bottom"].indexOf(M)){var e=G.title.font.size,t=G._offset+G._length/2,a=s.l+(G.position||0)*s.w+("right"===G.side?10+e*(G.showticklabels?1:.5):-10-e*(G.showticklabels?.5:0));ee("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:M,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:t,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=z+t.outlinewidth/2+d.bBox($.node()).width;if((Q=J.select("text")).node()&&!Q.classed(k.jsPlaceholder)){var a,o=J.select(".h"+G._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(M)?d.bBox(o).width:d.bBox(J.node()).right-B-s.l,n=Math.max(n,a)}var l=2*t.xpad+n+t.borderwidth+t.outlinewidth/2,c=V-q;e.select("."+k.cbbg).attr({x:B-t.xpad-(t.borderwidth+t.outlinewidth)/2,y:q-N,width:Math.max(l,2),height:Math.max(c+2*N,2)}).call(p.fill,t.bgcolor).call(p.stroke,t.bordercolor).style("stroke-width",t.borderwidth),e.selectAll("."+k.cboutline).attr({x:B,y:q+t.ypad+("top"===M?K:0),width:Math.max(z,2),height:Math.max(c-2*t.ypad-K,2)}).call(p.stroke,t.outlinecolor).style({fill:"none","stroke-width":t.outlinewidth});var u=({center:.5,right:1}[t.xanchor]||0)*l;e.attr("transform","translate("+(s.l-u)+","+s.t+")");var f={},h=w[t.yanchor],g=T[t.yanchor];"pixels"===t.lenmode?(f.y=t.y,f.t=c*h,f.b=c*g):(f.t=f.b=0,f.yt=t.y+t.len*h,f.yb=t.y-t.len*g);var v=w[t.xanchor],m=T[t.xanchor];if("pixels"===t.thicknessmode)f.x=t.x,f.l=l*v,f.r=l*m;else{var y=l-z;f.l=y*v,f.r=y*m,f.xl=t.x-t.thickness*v,f.xr=t.x+t.thickness*m}i.autoMargin(r,t._id,f)}],r)}(r,t,e);v&&v.then&&(e._promises||[]).push(v),e._context.edits.colorbarPosition&&function(e,t,r){var n,a,i,l=r._fullLayout._size;s.init({element:e.node(),gd:r,prepFn:function(){n=e.attr("transform"),f(e)},moveFn:function(r,o){e.attr("transform",n+" translate("+r+","+o+")"),a=s.align(t._xLeftFrac+r/l.w,t._thickFrac,0,1,t.xanchor),i=s.align(t._yBottomFrac-o/l.h,t._lenFrac,0,1,t.yanchor);var c=s.getCursor(a,i,t.xanchor,t.yanchor);f(e,c)},doneFn:function(){if(f(e),void 0!==a&&void 0!==i){var n={};n[t._propPrefix+"x"]=a,n[t._propPrefix+"y"]=i,void 0!==t._traceIndex?o.call("_guiRestyle",r,n,t._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,t,e)})),t.exit().each((function(t){i.autoMargin(e,t._id)})).remove(),t.order()}}},{"../../constants/alignment":147,"../../lib":171,"../../lib/extend":165,"../../lib/setcursor":190,"../../lib/svg_text_utils":192,"../../plots/cartesian/axes":215,"../../plots/cartesian/axis_defaults":217,"../../plots/cartesian/layout_attributes":229,"../../plots/cartesian/position_defaults":232,"../../plots/plots":249,"../../registry":257,"../color":45,"../colorscale/helpers":56,"../dragelement":64,"../drawing":67,"../titles":140,"./constants":47,d3:9,tinycolor2:28}],50:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e){return n.isPlainObject(e.colorbar)}},{"../../lib":171}],51:[function(e,t,r){"use strict";t.exports={moduleType:"component",name:"colorbar",attributes:e("./attributes"),supplyDefaults:e("./defaults"),draw:e("./draw").draw,hasColorbar:e("./has_colorbar")}},{"./attributes":46,"./defaults":48,"./draw":49,"./has_colorbar":50}],52:[function(e,t,r){"use strict";var n=e("../colorbar/attributes"),a=e("../../lib/regex").counter,i=e("./scales.js").scales;Object.keys(i);function o(e){return"`"+e+"`"}t.exports=function(e,t){e=e||"";var r,l=(t=t||{}).cLetter||"c",s=("onlyIfNumerical"in t?t.onlyIfNumerical:Boolean(e),"noScale"in t?t.noScale:"marker.line"===e),c="showScaleDflt"in t?t.showScaleDflt:"z"===l,u="string"==typeof t.colorscaleDflt?i[t.colorscaleDflt]:null,f=t.editTypeOverride||"",d=e?e+".":"";"colorAttr"in t?(r=t.colorAttr,t.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},t.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==t.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),t.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":186,"../colorbar/attributes":46,"./scales.js":60}],53:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("./helpers").extractOpts;t.exports=function(e,t,r){var o,l=e._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(t,c).get():t,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":171,"./helpers":56,"fast-isnumeric":11}],54:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./helpers").hasColorscale,i=e("./helpers").extractOpts;t.exports=function(e,t){function r(e,t){var r=e["_"+t];void 0!==r&&(e[t]=r)}function o(e,a){var o=a.container?n.nestedProperty(e,a.container).get():e;if(o)if(o.coloraxis)o._colorAx=t[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=e[n];r[a]=[1-i[0],i[1]]}return r}function h(e,t){t=t||{};for(var r=e.domain,o=e.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],62:[function(e,t,r){"use strict";var n=e("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];t.exports=function(e,t,r,i){return e="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*e),0,2),t="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*t),0,2),a[t][e]}},{"../../lib":171}],63:[function(e,t,r){"use strict";r.selectMode=function(e){return"lasso"===e||"select"===e},r.drawMode=function(e){return"drawclosedpath"===e||"drawopenpath"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.openMode=function(e){return"drawline"===e||"drawopenpath"===e},r.rectMode=function(e){return"select"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.freeMode=function(e){return"lasso"===e||"drawclosedpath"===e||"drawopenpath"===e},r.selectingOrDrawing=function(e){return r.freeMode(e)||r.rectMode(e)}},{}],64:[function(e,t,r){"use strict";var n=e("mouse-event-offset"),a=e("has-hover"),i=e("has-passive-events"),o=e("../../lib").removeElement,l=e("../../plots/cartesian/constants"),s=t.exports={};s.align=e("./align"),s.getCursor=e("./cursor");var c=e("./unhover");function u(){var e=document.createElement("div");e.className="dragcover";var t=e.style;return t.position="fixed",t.left=0,t.right=0,t.top=0,t.bottom=0,t.zIndex=999999999,t.background="none",document.body.appendChild(e),e}function f(e){return n(e.changedTouches?e.changedTouches[0]:e,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(e){var t,r,n,c,d,p,h,g,v=e.gd,m=1,y=v._context.doubleClickDelay,x=e.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=e.clampFn||function(e,t,r){return Math.abs(e)y&&(m=Math.max(m-1,1)),v._dragged)e.doneFn&&e.doneFn();else if(e.clickFn&&e.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",t)}catch(e){var n=f(t);(r=document.createEvent("MouseEvents")).initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,n[0],n[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":171,"../../plots/cartesian/constants":221,"./align":61,"./cursor":62,"./unhover":65,"has-hover":13,"has-passive-events":14,"mouse-event-offset":17}],65:[function(e,t,r){"use strict";var n=e("../../lib/events"),a=e("../../lib/throttle"),i=e("../../lib/dom").getGraphDiv,o=e("../fx/constants"),l=t.exports={};l.wrapped=function(e,t,r){(e=i(e))._fullLayout&&a.clear(e._fullLayout._uid+o.HOVERID),l.raw(e,t,r)},l.raw=function(e,t){var r=e._fullLayout,a=e._hoverdata;t||(t={}),t.target&&!1===n.triggerHandler(e,"plotly_beforehover",t)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,t.target&&a&&e.emit("plotly_unhover",{event:t,points:a}))}},{"../../lib/dom":163,"../../lib/events":164,"../../lib/throttle":193,"../fx/constants":79}],66:[function(e,t,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],67:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("tinycolor2"),o=e("../../registry"),l=e("../color"),s=e("../colorscale"),c=e("../../lib"),u=e("../../lib/svg_text_utils"),f=e("../../constants/xmlns_namespaces"),d=e("../../constants/alignment").LINE_SPACING,p=e("../../constants/interactions").DESELECTDIM,h=e("../../traces/scatter/subtypes"),g=e("../../traces/scatter/make_bubble_size_func"),v=e("../../components/fx/helpers").appendArrayPointValue,m=t.exports={};m.font=function(e,t,r,n){c.isPlainObject(t)&&(n=t.color,r=t.size,t=t.family),t&&e.style("font-family",t),r+1&&e.style("font-size",r+"px"),n&&e.call(l.fill,n)},m.setPosition=function(e,t,r){e.attr("x",t).attr("y",r)},m.setSize=function(e,t,r){e.attr("width",t).attr("height",r)},m.setRect=function(e,t,r,n,a){e.call(m.setPosition,t,r).call(m.setSize,n,a)},m.translatePoint=function(e,t,r,n){var i=r.c2p(e.x),o=n.c2p(e.y);return!!(a(i)&&a(o)&&t.node())&&("text"===t.node().nodeName?t.attr("x",i).attr("y",o):t.attr("transform","translate("+i+","+o+")"),!0)},m.translatePoints=function(e,t,r){e.each((function(e){var a=n.select(this);m.translatePoint(e,a,t,r)}))},m.hideOutsideRangePoint=function(e,t,r,n,a,i){t.attr("display",r.isPtWithinRange(e,a)&&n.isPtWithinRange(e,i)?null:"none")},m.hideOutsideRangePoints=function(e,t){if(t._hasClipOnAxisFalse){var r=t.xaxis,a=t.yaxis;e.each((function(t){var i=t[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";e.selectAll(c).each((function(e){m.hideOutsideRangePoint(e,n.select(this),r,a,l,s)}))}))}},m.crispRound=function(e,t,r){return t&&a(t)?e._context.staticPlot?t:t<1?1:Math.round(t):r||0},m.singleLineStyle=function(e,t,r,n,a){t.style("fill","none");var i=(((e||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(t,n||i.color),m.dashLine(t,s,o)},m.lineGroupStyle=function(e,t,r,a){e.style("fill","none").each((function(e){var i=(((e||[])[0]||{}).trace||{}).line||{},o=t||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(m.dashLine,s,o)}))},m.dashLine=function(e,t,r){r=+r||0,t=m.dashStyle(t,r),e.style({"stroke-dasharray":t,"stroke-width":r+"px"})},m.dashStyle=function(e,t){t=+t||1;var r=Math.max(t,3);return"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),e},m.singleFillStyle=function(e){var t=(((n.select(e.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;t&&e.call(l.fill,t)},m.fillGroupStyle=function(e){e.style("stroke-width",0).each((function(e){var t=n.select(this);e[0].trace&&t.call(l.fill,e[0].trace.fillcolor)}))};var y=e("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(y).forEach((function(e){var t=y[e],r=t.n;m.symbolList.push(r,String(r),e,r+100,String(r+100),e+"-open"),m.symbolNames[r]=e,m.symbolFuncs[r]=t.f,t.needLine&&(m.symbolNeedLines[r]=!0),t.noDot?m.symbolNoDot[r]=!0:m.symbolList.push(r+200,String(r+200),e+"-dot",r+300,String(r+300),e+"-open-dot"),t.noFill&&(m.symbolNoFill[r]=!0)}));var x=m.symbolNames.length;function b(e,t){var r=e%100;return m.symbolFuncs[r](t)+(e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}m.symbolNumber=function(e){if(a(e))e=+e;else if("string"==typeof e){var t=0;e.indexOf("-open")>0&&(t=100,e=e.replace("-open","")),e.indexOf("-dot")>0&&(t+=200,e=e.replace("-dot","")),(e=m.symbolNames.indexOf(e))>=0&&(e+=t)}return e%100>=x||e>=400?0:Math.floor(Math.max(e,0))};var _={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0},T=n.format("~.1f"),k={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}};m.gradient=function(e,t,r,a,o,s){for(var u=o.length,f=k[a],d=new Array(u),p=0;p"+m(e);h._gradientUrlQueryParts[y]=1},m.initGradients=function(e){var t=e._fullLayout;c.ensureSingle(t._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),t._gradientUrlQueryParts={}},m.pointStyle=function(e,t,r){if(e.size()){var a=m.makePointStyleFns(t);e.each((function(e){m.singlePointStyle(e,n.select(this),t,a,r)}))}},m.singlePointStyle=function(e,t,r,n,a){var i=r.marker,o=i.line;if(t.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(e):void 0===e.mo?i.opacity:e.mo),n.ms2mrc){var s;s="various"===e.ms||"various"===i.size?3:n.ms2mrc(e.ms),e.mrc=s,n.selectedSizeFn&&(s=e.mrc=n.selectedSizeFn(e));var u=m.symbolNumber(e.mx||i.symbol)||0;e.om=u%200>=100,t.attr("d",b(u,s))}var f,d,p,h=!1;if(e.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(e.mlw+1||g+1||(e.trace?(e.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in e?e.mlcc=n.lineScale(e.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in e?e.mcc=n.markerScale(e.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(e))}if(e.om)t.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{t.style("stroke-width",(e.isBlank?0:p)+"px");var v=i.gradient,y=e.mgt;if(y?h=!0:y=v&&v.type,Array.isArray(y)&&(y=y[0],k[y]||(y=0)),y&&"none"!==y){var x=e.mgc;x?h=!0:x=v.color;var _=r.uid;h&&(_+="-"+e.i),m.gradient(t,a,_,y,[[0,x],[1,f]],"fill")}else l.fill(t,f);p&&l.stroke(t,d)}},m.makePointStyleFns=function(e){var t={},r=e.marker;return t.markerScale=m.tryColorscale(r,""),t.lineScale=m.tryColorscale(r,"line"),o.traceIs(e,"symbols")&&(t.ms2mrc=h.isBubble(e)?g(e):function(){return(r.size||6)/2}),e.selectedpoints&&c.extendFlat(t,m.makeSelectedPointStyleFns(e)),t},m.makeSelectedPointStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,h=void 0!==f;(c.isArrayOrTypedArray(s)||d||h)&&(t.selectedOpacityFn=function(e){var t=void 0===e.mo?a.opacity:e.mo;return e.selected?d?u:t:h?f:p*t});var g=a.color,v=i.color,m=l.color;(v||m)&&(t.selectedColorFn=function(e){var t=e.mcc||g;return e.selected?v||t:m||t});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(e,"symbols")&&(_||w)&&(t.selectedSizeFn=function(e){var t=e.mrc||y/2;return e.selected?_?x/2:t:w?b/2:t}),t},m.makeSelectedTextStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return t.selectedTextColorFn=function(e){var t=e.tc||s;return e.selected?c||t:u||(c?t:l.addOpacity(t,p))},t},m.selectedPointStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedPointStyleFns(t),a=t.marker||{},i=[];r.selectedOpacityFn&&i.push((function(e,t){e.style("opacity",r.selectedOpacityFn(t))})),r.selectedColorFn&&i.push((function(e,t){l.fill(e,r.selectedColorFn(t))})),r.selectedSizeFn&&i.push((function(e,t){var n=t.mx||a.symbol||0,i=r.selectedSizeFn(t);e.attr("d",b(m.symbolNumber(n),i)),t.mrc2=i})),i.length&&e.each((function(e){for(var t=n.select(this),r=0;r0?r:0}m.textPointStyle=function(e,t,r){if(e.size()){var a;if(t.selectedpoints){var i=m.makeSelectedTextStyleFns(t);a=i.selectedTextColorFn}var o=t.texttemplate,l=r._fullLayout;e.each((function(e){var i=n.select(this),s=o?c.extractOption(e,t,"txt","texttemplate"):c.extractOption(e,t,"tx","text");if(s||0===s){if(o){var f=t._module.formatLabels?t._module.formatLabels(e,t,l):{},d={};v(d,t,e.i);var p=t._meta||{};s=c.texttemplateString(s,f,l._d3locale,d,e,p)}var h=e.tp||t.textposition,g=L(e,t),y=a?a(e):e.tc||t.textfont.color;i.call(m.font,e.tf||t.textfont.family,g,y).text(s).call(u.convertToTspans,r).call(A,h,g,e.mrc)}else i.remove()}))}},m.selectedTextStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedTextStyleFns(t);e.each((function(e){var a=n.select(this),i=r.selectedTextColorFn(e),o=e.tp||t.textposition,s=L(e,t);l.fill(a,i),A(a,o,s,e.mrc2||e.mrc)}))}};function S(e,t,r,a){var i=e[0]-t[0],o=e[1]-t[1],l=r[0]-t[0],s=r[1]-t[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(t[0]+(p&&f/p),2),n.round(t[1]+(p&&d/p),2)],[n.round(t[0]-(h&&f/h),2),n.round(t[1]-(h&&d/h),2)]]}m.smoothopen=function(e,t){if(e.length<3)return"M"+e.join("L");var r,n="M"+e[0],a=[];for(r=1;r=1e4&&(m.savedBBoxes={},D=0),r&&(m.savedBBoxes[r]=v),D++,c.extendFlat({},v)},m.setClipUrl=function(e,t,r){e.attr("clip-path",z(t,r))},m.getTranslate=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||0,y:+t[1]||0}},m.setTranslate=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=" translate("+t+", "+r+")").trim(),e[a]("transform",i),i},m.getScale=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||1,y:+t[1]||1}},m.setScale=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+=" scale("+t+", "+r+")").trim(),e[a]("transform",i),i};var E=/\s*sc.*/;m.setPointGroupScale=function(e,t,r){if(t=t||1,r=r||1,e){var n=1===t&&1===r?"":" scale("+t+","+r+")";e.each((function(){var e=(this.getAttribute("transform")||"").replace(E,"");e=(e+=n).trim(),this.setAttribute("transform",e)}))}};var R=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(e,t,r){e&&e.each((function(){var e,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(R);e=1===t&&1===r?[]:["translate("+o+","+l+")","scale("+t+","+r+")","translate("+-o+","+-l+")"],s&&e.push(s),a.attr("transform",e.join(" "))}}))}},{"../../components/fx/helpers":81,"../../constants/alignment":147,"../../constants/interactions":149,"../../constants/xmlns_namespaces":151,"../../lib":171,"../../lib/svg_text_utils":192,"../../registry":257,"../../traces/scatter/make_bubble_size_func":314,"../../traces/scatter/subtypes":321,"../color":45,"../colorscale":57,"./symbol_defs":68,d3:9,"fast-isnumeric":11,tinycolor2:28}],68:[function(e,t,r){"use strict";var n=e("d3");t.exports={circle:{n:0,f:function(e){var t=n.round(e,2);return"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"}},square:{n:1,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"}},diamond:{n:2,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"Z"}},cross:{n:3,f:function(e){var t=n.round(.4*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H"+t+"V"+r+"H-"+t+"V"+t+"H-"+r+"V-"+t+"H-"+t+"V-"+r+"H"+t+"V-"+t+"H"+r+"Z"}},x:{n:4,f:function(e){var t=n.round(.8*e/Math.sqrt(2),2),r="l"+t+","+t,a="l"+t+",-"+t,i="l-"+t+",-"+t,o="l-"+t+","+t;return"M0,"+t+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+","+n.round(e/2,2)+"H"+t+"L0,-"+n.round(e,2)+"Z"}},"triangle-down":{n:6,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+",-"+n.round(e/2,2)+"H"+t+"L0,"+n.round(e,2)+"Z"}},"triangle-left":{n:7,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M"+n.round(e/2,2)+",-"+t+"V"+t+"L-"+n.round(e,2)+",0Z"}},"triangle-right":{n:8,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+n.round(e/2,2)+",-"+t+"V"+t+"L"+n.round(e,2)+",0Z"}},"triangle-ne":{n:9,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+r+",-"+t+"H"+t+"V"+r+"Z"}},"triangle-se":{n:10,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+t+",-"+r+"V"+t+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H-"+t+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+t+","+r+"V-"+t+"H"+r+"Z"}},pentagon:{n:13,f:function(e){var t=n.round(.951*e,2),r=n.round(.588*e,2),a=n.round(-e,2),i=n.round(-.309*e,2);return"M"+t+","+i+"L"+r+","+n.round(.809*e,2)+"H-"+r+"L-"+t+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+t+"L-"+a+","+r+"V-"+r+"L0,-"+t+"Z"}},hexagon2:{n:15,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+t+",0L"+r+",-"+a+"H-"+r+"L-"+t+",0Z"}},octagon:{n:16,f:function(e){var t=n.round(.924*e,2),r=n.round(.383*e,2);return"M-"+r+",-"+t+"H"+r+"L"+t+",-"+r+"V"+r+"L"+r+","+t+"H-"+r+"L-"+t+","+r+"V-"+r+"Z"}},star:{n:17,f:function(e){var t=1.4*e,r=n.round(.225*t,2),a=n.round(.951*t,2),i=n.round(.363*t,2),o=n.round(.588*t,2),l=n.round(-t,2),s=n.round(-.309*t,2),c=n.round(.118*t,2),u=n.round(.809*t,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*t,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(e){var t=n.round(.66*e,2),r=n.round(.38*e,2),a=n.round(.76*e,2);return"M-"+a+",0l-"+r+",-"+t+"h"+a+"l"+r+",-"+t+"l"+r+","+t+"h"+a+"l-"+r+","+t+"l"+r+","+t+"h-"+a+"l-"+r+","+t+"l-"+r+",-"+t+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+t+","+r+o+t+","+r+o+"0,-"+a+o+"-"+t+","+r+"Z"}},"star-triangle-down":{n:20,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M"+t+",-"+r+o+"-"+t+",-"+r+o+"0,"+a+o+t+",-"+r+"Z"}},"star-square":{n:21,f:function(e){var t=n.round(1.1*e,2),r=n.round(2*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",-"+t+a+"-"+t+","+t+a+t+","+t+a+t+",-"+t+a+"-"+t+",-"+t+"Z"}},"star-diamond":{n:22,f:function(e){var t=n.round(1.4*e,2),r=n.round(1.9*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",0"+a+"0,"+t+a+t+",0"+a+"0,-"+t+a+"-"+t+",0Z"}},"diamond-tall":{n:23,f:function(e){var t=n.round(.7*e,2),r=n.round(1.4*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},"diamond-wide":{n:24,f:function(e){var t=n.round(1.4*e,2),r=n.round(.7*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},hourglass:{n:25,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"L"+t+",-"+t+"H-"+t+"Z"},noDot:!0},bowtie:{n:26,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"V-"+t+"L-"+t+","+t+"V-"+t+"Z"},noDot:!0},"circle-cross":{n:27,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(e){var t=n.round(e,2),r=n.round(e/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM0,-"+t+"V"+t+"M-"+t+",0H"+t},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(e){var t=n.round(1.3*e,2),r=n.round(.65*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(e){var t=n.round(1.2*e,2),r=n.round(.85*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(e){var t=n.round(e/2,2),r=n.round(e,2);return"M"+t+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+t+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+","+a+"L0,0M"+t+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+",-"+a+"L0,0M"+t+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M"+a+","+t+"L0,0M"+a+",-"+t+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+a+","+t+"L0,0M-"+a+",-"+t+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(e){var t=n.round(1.4*e,2);return"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(e){var t=n.round(e,2);return"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t},needLine:!0,noDot:!0,noFill:!0},"arrow-up":{n:45,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-down":{n:46,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-left":{n:47,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L-"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L-"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:9}],69:[function(e,t,r){"use strict";t.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"}}}},{}],70:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../registry"),i=e("../../plots/cartesian/axes"),o=e("../../lib"),l=e("./compute_error");function s(e,t,r,a){var s=t["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;t.each((function(t){var f,d=t[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(e){return e.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(t=[]);var v=n.select(this).selectAll("g.errorbar").data(t,f);if(v.exit().remove(),t.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.setClipUrl(v,r.layerClipId,e),v.each((function(e){var t=n.select(this),r=function(e,t,r){var n={x:t.c2p(e.x),y:r.c2p(e.y)};void 0!==e.yh&&(n.yh=r.c2p(e.yh),n.ys=r.c2p(e.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(e.ys,!0)));void 0!==e.xh&&(n.xh=t.c2p(e.xh),n.xs=t.c2p(e.xs),a(n.xs)||(n.noXS=!0,n.xs=t.c2p(e.xs,!0)));return n}(e,s,c);if(!g||e.vis){var i,o=t.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=t.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=t.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=t.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":321,"../drawing":67,d3:9,"fast-isnumeric":11}],75:[function(e,t,r){"use strict";var n=e("d3"),a=e("../color");t.exports=function(e){e.each((function(e){var t=e[0].trace,r=t.error_y||{},i=t.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":45,d3:9}],76:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("./layout_attributes").hoverlabel,i=e("../../lib/extend").extendFlat;t.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":165,"../../plots/font_attributes":243,"./layout_attributes":86}],77:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry");function i(e,t,r,a){a=a||n.identity,Array.isArray(e)&&(t[0][r]=a(e))}t.exports=function(e){var t=e.calcdata,r=e._fullLayout;function o(e){return function(t){return n.coerceHoverinfo({hoverinfo:t},{_module:e._module},r)}}for(var l=0;l=0&&r.indexb[0]._length||ee<0||ee>w[0]._length)return d.unhoverRaw(e,t)}if(t.pointerX=K+b[0]._offset,t.pointerY=ee+w[0]._offset,E="xval"in t?g.flat(s,t.xval):g.p2c(b,K),R="yval"in t?g.flat(s,t.yval):g.p2c(w,ee),!a(E[0])||!a(R[0]))return o.warn("Fx.hover failed",t,e),d.unhoverRaw(e,t)}var re=1/0;function ne(e,r){for(F=0;FZ&&(W.splice(0,Z),re=W[0].distance),m&&0!==X&&0===W.length){G.distance=X,G.index=!1;var d=H._module.hoverPoints(G,V,q,"closest",u._hoverlayer);if(d&&(d=d.filter((function(e){return e.spikeDistance<=X}))),d&&d.length){var p,h=d.filter((function(e){return e.xa.showspikes&&"hovered data"!==e.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(p=ie(v),(!J.vLinePoint||J.vLinePoint.spikeDistance>p.spikeDistance)&&(J.vLinePoint=p))}var y=d.filter((function(e){return e.ya.showspikes&&"hovered data"!==e.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(p=ie(x),(!J.hLinePoint||J.hLinePoint.spikeDistance>p.spikeDistance)&&(J.hLinePoint=p))}}}}}function ae(e,t){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===C&&$&&W.length>1,Me=f.combine(u.plot_bgcolor||f.background,u.paper_bgcolor),Ae={hovermode:C,rotateLabels:ke,bgColor:Me,container:u._hoverlayer,outerContainer:u._paperdiv,commonLabelOpts:u.hoverlabel,hoverdistance:u.hoverdistance},Le=S(W,Ae,e);g.isUnifiedHover(C)||(!function(e,t,r){var n,a,i,o,l,s,c,u=0,f=1,d=e.size(),p=new Array(d),h=0;function g(e){var t=e[0],r=e[e.length-1];if(a=t.pmin-t.pos-t.dp+t.size,i=r.pos+r.dp+r.size-t.pmax,a>.01){for(l=e.length-1;l>=0;l--)e[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=e.length-1;l>=0;l--)e[l].dp-=i;n=!1}if(n){var c=0;for(o=0;ot.pmax&&c++;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos>t.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)e[l].dp-=i;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos+s.dp+s.size>t.pmax&&(s.del=!0,c--)}}}e.each((function(e){var n=e[t],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:e,traceIndex:e.trace.index,dp:0,pos:e.pos,posref:e.posref,size:e.by*(a?_:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(e,t){return e[0].posref-t[0].posref||f*(t[0].traceIndex-e[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var w=b[l],T=w.datum;T.offset=w.dp,T.del=w.del}}}(Le,ke?"xa":"ya",u),O(Le,ke));if(t.target&&t.target.tagName){var Se=h.getComponentMethod("annotations","hasClickToShow")(e,be);c(n.select(t.target),Se?"pointer":"")}if(!t.target||i||!function(e,t,r){if(!r||r.length!==e._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=e._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(e,0,xe))return;xe&&e.emit("plotly_unhover",{event:t,points:xe});e.emit("plotly_hover",{event:t,points:e._hoverdata,xaxes:b,yaxes:w,xvals:E,yvals:R})}(e,t,r,i)}))},r.loneHover=function(e,t){var r=!0;Array.isArray(e)||(r=!1,e=[e]);var a=e.map((function(e){return{color:e.color||f.defaultLine,x0:e.x0||e.x||0,x1:e.x1||e.x||0,y0:e.y0||e.y||0,y1:e.y1||e.y||0,xLabel:e.xLabel,yLabel:e.yLabel,zLabel:e.zLabel,text:e.text,name:e.name,idealAlign:e.idealAlign,borderColor:e.borderColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontColor:e.fontColor,nameLength:e.nameLength,textAlign:e.textAlign,trace:e.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:e.hovertemplate||!1,eventData:e.eventData||!1,hovertemplateLabels:e.hovertemplateLabels||!1}})),i=n.select(t.container),o=t.outerContainer?n.select(t.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:t.bgColor||f.background,container:i,outerContainer:o},s=S(a,l,t.gd),c=0,u=0;return s.sort((function(e,t){return e.y0-t.y0})).each((function(e,r){var n=e.y0-e.by/2;e.offset=n-5([\s\S]*)<\/extra>/;function S(e,t,r){var a=r._fullLayout,i=t.hovermode,l=t.rotateLabels,c=t.bgColor,d=t.container,p=t.outerContainer,h=t.commonLabelOpts||{},b=t.fontFamily||v.HOVERFONT,_=t.fontSize||v.HOVERFONTSIZE,w=e[0],T=w.xa,L=w.ya,S="y"===i.charAt(0)?"yLabel":"xLabel",O=w[S],D=(String(O)||"").split(" ")[0],P=p.node().getBoundingClientRect(),z=P.top,E=P.width,R=P.height,I=void 0!==O&&w.distance<=t.hoverdistance&&("x"===i||"y"===i);if(I){var F,N,H=!0;for(F=0;Fa.width-S?(m=a.width-S,l.attr("d","M"+(S-k)+",0L"+S+","+A+k+"v"+A+(2*M+x.height)+"H-"+S+"V"+A+k+"H"+(S-2*k)+"Z")):l.attr("d","M0,0L"+k+","+A+k+"H"+(M+x.width/2)+"v"+A+(2*M+x.height)+"H-"+(M+x.width/2)+"V"+A+k+"H-"+k+"Z")}else{var C,D,P;"right"===L.side?(C="start",D=1,P="",m=T._offset+T._length):(C="end",D=-1,P="-",m=T._offset),y=L._offset+(w.y0+w.y1)/2,c.attr("text-anchor",C),l.attr("d","M0,0L"+P+k+","+k+"V"+(M+x.height/2)+"h"+P+(2*M+x.width)+"V-"+(M+x.height/2)+"H"+P+k+"V-"+k+"Z");var E,R=x.height/2,I=z-x.top-R,F="clip"+a._uid+"commonlabel"+L._id;if(m=0?K-=re:K+=2*M;var ne=te.height+2*M,ae=$+ne>=R;return ne<=R&&($<=z?$=L._offset+2*M:ae&&($=R-ne)),ee.attr("transform","translate("+K+","+$+")"),ee}var ie=d.selectAll("g.hovertext").data(e,(function(e){return A(e)}));return ie.enter().append("g").classed("hovertext",!0).each((function(){var e=n.select(this);e.append("rect").call(f.fill,f.addOpacity(c,.8)),e.append("text").classed("name",!0),e.append("path").style("stroke-width","1px"),e.append("text").classed("nums",!0).call(u.font,b,_)})),ie.exit().remove(),ie.each((function(e){var t=n.select(this).attr("transform",""),o=e.bgcolor||e.color,d=f.combine(f.opacity(o)?o:f.defaultLine,c),p=f.combine(f.opacity(e.color)?e.color:f.defaultLine,c),h=e.borderColor||f.contrast(d),g=C(e,I,i,a,O,t),v=g[0],m=g[1],y=t.select("text.nums").call(u.font,e.fontFamily||b,e.fontSize||_,e.fontColor||h).text(v).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r),w=t.select("text.name"),T=0,A=0;if(m&&m!==v){w.call(u.font,e.fontFamily||b,e.fontSize||_,p).text(m).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r);var L=w.node().getBoundingClientRect();T=L.width+2*M,A=L.height+2*M}else w.remove(),t.select("rect").remove();t.select("path").style({fill:d,stroke:h});var S,D,P=y.node().getBoundingClientRect(),F=e.xa._offset+(e.x0+e.x1)/2,N=e.ya._offset+(e.y0+e.y1)/2,H=Math.abs(e.x1-e.x0),B=Math.abs(e.y1-e.y0),j=P.width+k+M+T;if(e.ty0=z-P.top,e.bx=P.width+2*M,e.by=Math.max(P.height+2*M,A),e.anchor="start",e.txwidth=P.width,e.tx2width=T,e.offset=0,l)e.pos=F,S=N+B/2+j<=R,D=N-B/2-j>=0,"top"!==e.idealAlign&&S||!D?S?(N+=B/2,e.anchor="start"):e.anchor="middle":(N-=B/2,e.anchor="end");else if(e.pos=N,S=F+H/2+j<=E,D=F-H/2-j>=0,"left"!==e.idealAlign&&S||!D)if(S)F+=H/2,e.anchor="start";else{e.anchor="middle";var U=j/2,V=F+U-E,q=F-U;V>0&&(F-=V),q<0&&(F+=-q)}else F-=H/2,e.anchor="end";y.attr("text-anchor",e.anchor),T&&w.attr("text-anchor",e.anchor),t.attr("transform","translate("+F+","+N+")"+(l?"rotate("+x+")":""))})),ie}function C(e,t,r,n,a,i){var l="",s="";void 0!==e.nameOverride&&(e.name=e.nameOverride),e.name&&(e.trace._meta&&(e.name=o.templateString(e.name,e.trace._meta)),l=E(e.name,e.nameLength)),void 0!==e.zLabel?(void 0!==e.xLabel&&(s+="x: "+e.xLabel+"
"),void 0!==e.yLabel&&(s+="y: "+e.yLabel+"
"),"choropleth"!==e.trace.type&&"choroplethmapbox"!==e.trace.type&&(s+=(s?"z: ":"")+e.zLabel)):t&&e[r.charAt(0)+"Label"]===a?s=e[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===e.xLabel?void 0!==e.yLabel&&"scattercarpet"!==e.trace.type&&(s=e.yLabel):s=void 0===e.yLabel?e.xLabel:"("+e.xLabel+", "+e.yLabel+")",!e.text&&0!==e.text||Array.isArray(e.text)||(s+=(s?"
":"")+e.text),void 0!==e.extraText&&(s+=(s?"
":"")+e.extraText),i&&""===s&&!e.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=e.hovertemplate||!1,f=e.hovertemplateLabels||e,d=e.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,e.trace._meta)).replace(L,(function(t,r){return l=E(r,e.nameLength),""}))),[s,l]}function O(e,t){e.each((function(e){var r=n.select(this);if(e.del)return r.remove();var a=r.select("text.nums"),i=e.anchor,o="end"===i?-1:1,l={start:1,end:-1,middle:0}[i],c=l*(k+M),f=c+l*(e.txwidth+M),d=0,p=e.offset;"middle"===i&&(c-=e.tx2width/2,f+=e.txwidth/2+M),t&&(p*=-T,d=e.offset*w),r.select("path").attr("d","middle"===i?"M-"+(e.bx/2+e.tx2width/2)+","+(p-e.by/2)+"h"+e.bx+"v"+e.by+"h-"+e.bx+"Z":"M0,0L"+(o*k+d)+","+(k+p)+"v"+(e.by/2-k)+"h"+o*e.bx+"v-"+e.by+"H"+(o*k+d)+"V"+(p-k)+"Z");var h=c+d,g=p+e.ty0-e.by/2+M,v=e.textAlign||"auto";"auto"!==v&&("left"===v&&"start"!==i?(a.attr("text-anchor","start"),h="middle"===i?-e.bx/2-e.tx2width/2+M:-e.bx-M):"right"===v&&"end"!==i&&(a.attr("text-anchor","end"),h="middle"===i?e.bx/2-e.tx2width/2-M:e.bx+M)),a.call(s.positionText,h,g),e.tx2width&&(r.select("text.name").call(s.positionText,f+l*M+d,p+e.ty0-e.by/2+M),r.select("rect").call(u.setRect,f+(l-1)*e.tx2width/2+d,p-e.by/2-1,e.tx2width,e.by+2))}))}function D(e,t){var r=e.index,n=e.trace||{},i=e.cd[0],l=e.cd[r]||{};function s(e){return e||a(e)&&0===e}var c=Array.isArray(r)?function(e,t){var a=o.castOption(i,r,e);return s(a)?a:o.extractOption({},n,"",t)}:function(e,t){return o.extractOption(l,n,e,t)};function u(t,r,n){var a=c(r,n);s(a)&&(e[t]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),e.posref="y"===t||"closest"===t&&"h"===n.orientation?e.xa._offset+(e.x0+e.x1)/2:e.ya._offset+(e.y0+e.y1)/2,e.x0=o.constrain(e.x0,0,e.xa._length),e.x1=o.constrain(e.x1,0,e.xa._length),e.y0=o.constrain(e.y0,0,e.ya._length),e.y1=o.constrain(e.y1,0,e.ya._length),void 0!==e.xLabelVal&&(e.xLabel="xLabel"in e?e.xLabel:p.hoverLabelText(e.xa,e.xLabelVal),e.xVal=e.xa.c2d(e.xLabelVal)),void 0!==e.yLabelVal&&(e.yLabel="yLabel"in e?e.yLabel:p.hoverLabelText(e.ya,e.yLabelVal),e.yVal=e.ya.c2d(e.yLabelVal)),void 0!==e.zLabelVal&&void 0===e.zLabel&&(e.zLabel=String(e.zLabelVal)),!(isNaN(e.xerr)||"log"===e.xa.type&&e.xerr<=0)){var f=p.tickText(e.xa,e.xa.c2l(e.xerr),"hover").text;void 0!==e.xerrneg?e.xLabel+=" +"+f+" / -"+p.tickText(e.xa,e.xa.c2l(e.xerrneg),"hover").text:e.xLabel+=" \xb1 "+f,"x"===t&&(e.distance+=1)}if(!(isNaN(e.yerr)||"log"===e.ya.type&&e.yerr<=0)){var d=p.tickText(e.ya,e.ya.c2l(e.yerr),"hover").text;void 0!==e.yerrneg?e.yLabel+=" +"+d+" / -"+p.tickText(e.ya,e.ya.c2l(e.yerrneg),"hover").text:e.yLabel+=" \xb1 "+d,"y"===t&&(e.distance+=1)}var h=e.hoverinfo||e.trace.hoverinfo;return h&&"all"!==h&&(-1===(h=Array.isArray(h)?h:h.split("+")).indexOf("x")&&(e.xLabel=void 0),-1===h.indexOf("y")&&(e.yLabel=void 0),-1===h.indexOf("z")&&(e.zLabel=void 0),-1===h.indexOf("text")&&(e.text=void 0),-1===h.indexOf("name")&&(e.name=void 0)),e}function P(e,t,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,d=!!t.hLinePoint,h=!!t.vLinePoint;if(o.selectAll(".spikeline").remove(),h||d){var g=f.combine(l.plot_bgcolor,l.paper_bgcolor);if(d){var v,m,y=t.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,g)<1.5?f.contrast(g):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=p.getPxPosition(e,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T,stroke:k,"stroke-dasharray":u.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:m,r:T,fill:k}).classed("spikeline",!0)}if(h){var S,C,O=t.vLinePoint;n=O&&O.xa,a=O&&O.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+O.x,C=a._offset+O.y);var D,P,z=i.readability(O.color,g)<1.5?f.contrast(g):O.color,E=n.spikemode,R=n.spikethickness,I=n.spikecolor||z,F=p.getPxPosition(e,n);if(-1!==E.indexOf("toaxis")||-1!==E.indexOf("across")){if(-1!==E.indexOf("toaxis")&&(D=F,P=C),-1!==E.indexOf("across")){var N=n._counterDomainMin,H=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),H=Math.max(H,n.position)),D=s.t+(1-H)*s.h,P=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:P,"stroke-width":R,stroke:I,"stroke-dasharray":u.dashStyle(n.spikedash,R)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:P,"stroke-width":R+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==E.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?R:-R),r:R,fill:I}).classed("spikeline",!0)}}}function z(e,t){return!t||(t.vLinePoint!==e._spikepoints.vLinePoint||t.hLinePoint!==e._spikepoints.hLinePoint)}function E(e,t){return s.plainText(e||"",{len:t,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":171,"../../lib/events":164,"../../lib/override_cursor":182,"../../lib/svg_text_utils":192,"../../plots/cartesian/axes":215,"../../registry":257,"../color":45,"../dragelement":64,"../drawing":67,"../legend/defaults":97,"../legend/draw":98,"./constants":79,"./helpers":81,d3:9,"fast-isnumeric":11,tinycolor2:28}],83:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../color"),i=e("./helpers").isUnifiedHover;t.exports=function(e,t,r,o){function l(e){o.font[e]||(o.font[e]=t.legend?t.legend.font[e]:t.font[e])}o=o||{},t&&i(t.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),t.legend?(o.bgcolor||(o.bgcolor=a.combine(t.legend.bgcolor,t.paper_bgcolor)),o.bordercolor||(o.bordercolor=t.legend.bordercolor)):o.bgcolor||(o.bgcolor=t.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":171,"../color":45,"./helpers":81}],84:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){function i(r,i){return void 0!==t[r]?t[r]:n.coerce(e,t,a,r,i)}var o,l=i("clickmode");return t._has("cartesian")?l.indexOf("select")>-1?o="closest":(t._isHoriz=function(e,t){for(var r=t._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===k("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===k("roworder"),w=d?.2:.1,T=d?.3:.1;g&&t._splomGridDflt&&(x=t._splomGridDflt.xside,b=t._splomGridDflt.yside),v._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,m,_)}}else delete t.grid}function k(e,t){return n.coerce(r,v,s,e,t)}},contentDefaults:function(e,t){var r=t.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=e.grid||{},p=t._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(t,"legend");if(_("uirevision",t.uirevision),!1!==g){_("bgcolor",t.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",t.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(e.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(t.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",t.font))}}function _(e,t){return a.coerce(c,v,o,e,t)}}},{"../../lib":171,"../../plot_api/plot_template":205,"../../plots/layout_attributes":247,"../../registry":257,"./attributes":95,"./helpers":101}],98:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib/events"),s=e("../dragelement"),c=e("../drawing"),u=e("../color"),f=e("../../lib/svg_text_utils"),d=e("./handle_click"),p=e("./constants"),h=e("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=e("./get_legend_data"),x=e("./style"),b=e("./helpers");function _(e,t,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:e.data,layout:e.layout,frames:e._transitionData._frames,config:e._context,fullData:e._fullData,fullLayout:e._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(e,"plotly_legendclick",s))if(1===n)t._clickTimeout=setTimeout((function(){d(r,e,n)}),e._context.doubleClickDelay);else if(2===n){t._clickTimeout&&clearTimeout(t._clickTimeout),e._legendMouseDownTime=0,!1!==l.triggerHandler(e,"plotly_legenddoubleclick",s)&&d(r,e,n)}}function w(e,t,r){var n,i=e.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&t._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(e,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,r.font).text(d?T(n,h):n),f.positionText(g,p.textGap,0),d?g.call(f.makeEditable,{gd:t,text:n}).call(M,e,t,r).on("edit",(function(n){this.text(T(n,h)).call(M,e,t,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",t,s,u)})):M(g,e,t,r)}function T(e,t){var r=Math.max(4,t);if(e&&e.trim().length>=r/2)return e;for(var n=r-(e=e||"").length;n>0;n--)e+=" ";return e}function k(e,t){var r,i=t._context.doubleClickDelay,o=1,l=a.ensureSingle(e,"rect","legendtoggle",(function(e){e.style("cursor","pointer").attr("pointer-events","all").call(u.fill,"rgba(0,0,0,0)")}));l.on("mousedown",(function(){(r=(new Date).getTime())-t._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(t,r,e,o,n.event)}}))}function M(e,t,r,n){n._main||e.attr("data-notex",!0),f.convertToTspans(e,r,(function(){!function(e,t,r){var n=e.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void e.remove();var a=e.select("g[class*=math-group]"),i=a.node();r||(r=t._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=e.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);n?f.positionText(h,p.textGap,-y):f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(t,r,n)}))}function A(e){return a.isRightAnchor(e)?"right":a.isCenterAnchor(e)?"center":"left"}function L(e){return a.isBottomAnchor(e)?"bottom":a.isMiddleAnchor(e)?"middle":"top"}t.exports=function(e,t){var r,l=e._fullLayout,f="legend"+l._uid;if(t?(r=t.layer,f+="-hover"):((t=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(e._legendMouseDownTime||(e._legendMouseDownTime=0),t._main){if(!e.calcdata)return;d=l.showlegend&&y(e.calcdata,t)}else{if(!t.entries)return;d=y(t.entries,t)}var h=l.hiddenlabels||[];if(t._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(e,"legend");var g=a.ensureSingle(r,"g","legend",(function(e){t._main&&e.attr("pointer-events","all")})),T=a.ensureSingleById(l._topdefs,"clipPath",f,(function(e){e.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(e){e.attr("shape-rendering","crispEdges")}));S.call(u.stroke,t.bordercolor).call(u.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),O=t.title;if(t._titleWidth=0,t._titleHeight=0,O.text){var D=a.ensureSingle(C,"text","legendtitletext");D.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,O.font).text(O.text),M(D,C,e,t)}else C.selectAll(".legendtitletext").remove();var P=a.ensureSingle(g,"rect","scrollbar",(function(e){e.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),z=C.selectAll("g.groups").data(d);z.enter().append("g").attr("class","groups"),z.exit().remove();var E=z.selectAll("g.traces").data(a.identity);E.enter().append("g").attr("class","traces"),E.exit().remove(),E.style("opacity",(function(e){var t=e[0].trace;return o.traceIs(t,"pie-like")?-1!==h.indexOf(e[0].label)?.5:1:"legendonly"===t.visible?.5:1})).each((function(){n.select(this).call(w,e,t)})).call(x,e,t).each((function(){t._main&&n.select(this).call(k,e)})),a.syncOrAsync([i.previousPromises,function(){return function(e,t,r,a){var i=e._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.textGap,h=p.itemGap,g=2*(u+h),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(e){var t=0,r=0,n=e.title.side;n&&(-1!==n.indexOf("left")&&(t=e._titleWidth),-1!==n.indexOf("top")&&(r=e._titleHeight));return[t,r]}(a);if(l)r.each((function(e){var t=e[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+t/2+h),a._height+=t,a._width=Math.max(a._width,e[0].width)})),x=d+a._width,a._width+=h+d+f,a._height+=g,s&&(t.each((function(e,t){c.setTranslate(this,0,t*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:S:k?M&&"right"===w?o.r+o.w:S:o.w,2*d);var C=0,O=0;r.each((function(e){var t=e[0].width+d;C=Math.max(C,t),O+=t})),x=null;var D=0;if(s){var P=0,z=0,E=0;t.each((function(){var e=0,t=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+h+n/2+t),t+=n,e=Math.max(e,d+r[0].width)})),P=Math.max(P,t);var r=e+h;r+u+z>a._maxWidth&&(D=Math.max(D,z),z=0,E+=P+a.tracegroupgap,P=t),c.setTranslate(this,z,E),z+=r})),a._width=Math.max(D,z)+u,a._height=E+P+g}else{var R=r.size(),I=O+f+(R-1)*ha._maxWidth&&(D=Math.max(D,B),N=0,H+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+H+t/2+h),B=N+r+h,N+=n,F=Math.max(F,t)})),I?(a._width=N+f,a._height=F+g):(a._width=Math.max(D,B)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var j=e._context.edits,U=j.legendText||j.legendPosition;r.each((function(e){var t=n.select(this).select(".legendtoggle"),r=e[0].height,a=U?d:x||d+e[0].width;l||(a+=h/2),c.setRect(t,0,-r/2,a,r)}))}(e,z,E,t)},function(){if(!t._main||!function(e){var t=e._fullLayout.legend,r=A(t),n=L(t);return i.autoMargin(e,"legend",{x:t.x,y:t.y,l:t._width*v[r],r:t._width*m[r],b:t._effHeight*m[n],t:t._effHeight*v[n]})}(e)){var u,d,h,y,x=l._size,b=t.borderwidth,w=x.l+x.w*t.x-v[A(t)]*t._width,k=x.t+x.h*(1-t.y)-v[L(t)]*t._effHeight;if(t._main&&l.margin.autoexpand){var M=w,O=k;w=a.constrain(w,0,l.width-t._width),k=a.constrain(k,0,l.height-t._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==O&&a.log("Constrain legend.y to make legend fit inside graph")}if(t._main&&c.setTranslate(g,w,k),P.on(".drag",null),g.on("wheel",null),!t._main||t._height<=t._maxHeight||e._context.staticPlot){var D=t._effHeight;t._main||(D=t._height),S.attr({width:t._width-b,height:D-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:t._width-2*b,height:D-2*b,x:b,y:b}),c.setClipUrl(C,f,e),c.setRect(P,0,0,0,0),delete t._scrollY}else{var z,E,R,I=Math.max(p.scrollBarMinHeight,t._effHeight*t._effHeight/t._height),F=t._effHeight-I-2*p.scrollBarMargin,N=t._height-t._effHeight,H=F/N,B=Math.min(t._scrollY||0,N);S.attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-2*b,x:b,y:b+B}),c.setClipUrl(C,f,e),V(B,I,H),g.on("wheel",(function(){V(B=a.constrain(t._scrollY+n.event.deltaY/F*N,0,N),I,H),0!==B&&B!==N&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;z="touchstart"===e.type?e.changedTouches[0].clientY:e.clientY,R=B})).on("drag",(function(){var e=n.event.sourceEvent;2===e.buttons||e.ctrlKey||(E="touchmove"===e.type?e.changedTouches[0].clientY:e.clientY,V(B=function(e,t,r){var n=(r-t)/H+e;return a.constrain(n,0,N)}(R,z,E),I,H))}));P.call(j);var U=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;"touchstart"===e.type&&(z=e.changedTouches[0].clientY,R=B)})).on("drag",(function(){var e=n.event.sourceEvent;"touchmove"===e.type&&(E=e.changedTouches[0].clientY,V(B=function(e,t,r){var n=(t-r)/H+e;return a.constrain(n,0,N)}(R,z,E),I,H))}));C.call(U)}if(e._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:e,prepFn:function(){var e=c.getTranslate(g);h=e.x,y=e.y},moveFn:function(e,r){var n=h+e,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,t.xanchor),d=s.align(a,0,x.t+x.h,x.t,t.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",e,{"legend.x":u,"legend.y":d})},clickFn:function(t,n){var a=r.selectAll("g.traces").filter((function(){var e=this.getBoundingClientRect();return n.clientX>=e.left&&n.clientX<=e.right&&n.clientY>=e.top&&n.clientY<=e.bottom}));a.size()>0&&_(e,g,a,t,n)}})}function V(r,n,a){t._scrollY=e._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(P,t._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],e)}}},{"../../constants/alignment":147,"../../lib":171,"../../lib/events":164,"../../lib/svg_text_utils":192,"../../plots/plots":249,"../../registry":257,"../color":45,"../dragelement":64,"../drawing":67,"./constants":96,"./get_legend_data":99,"./handle_click":100,"./helpers":101,"./style":103,d3:9}],99:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("./helpers");t.exports=function(e,t){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=t._main;function p(e,r){if(""!==e&&a.isGrouped(t))-1===l.indexOf(e)?(l.push(e),s=!0,o[e]=[[r]]):o[e].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=t.width}return h?n:Math.min(a,r)};function v(e,t,r){var i=e[0].trace,o=i.marker||{},s=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(c?[e]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.each((function(e){var t=n.select(this),r=e[0],a=g(r.mlw,o.line,5,2);t.style("stroke-width",a+"px").call(l.fill,r.mc||o.color),a&&l.stroke(t,r.mlc||s.color)}))}function m(e,t,r){var o=e[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(s?[e]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.size()){var d=(l.marker||{}).line,p=g(f(d.width,o.pts),d,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=d.color;var v=i.minExtend(o,{trace:h});u(c,v,h)}}e.each((function(e){var t=n.select(this),a=i.ensureSingle(t,"g","layers");a.style("opacity",e[0].trace.opacity);var o=r.valign,l=e[0].lineHeight,s=e[0].height;if("middle"!==o&&l&&s){var c={top:1,bottom:-1}[o]*(.5*(l-s+3));a.attr("transform","translate(0,"+c+")")}else a.attr("transform",null);a.selectAll("g.legendfill").data([e]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([e]).enter().append("g").classed("legendlines",!0);var u=a.selectAll("g.legendsymbols").data([e]);u.enter().append("g").classed("legendsymbols",!0),u.selectAll("g.legendpoints").data([e]).enter().append("g").classed("legendpoints",!0)})).each((function(e){var r,a=e[0].trace,c=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":c=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":c=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":c=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":c=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":c=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":c=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(c);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),u.exit().remove(),u.each((function(e,c){var u,f=n.select(this),p=s(a),h=p.colorscale,g=p.reversescale;if(h){if(!r){var v=h.length;u=0===c?h[g?v-1:0][1]:1===c?h[g?0:v-1][1]:h[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[c]||m[0]:m}f.attr("d",e[0]),u?f.call(l.fill,u):f.call((function(e){if(e.size()){var n="legendfill-"+a.uid;o.gradient(e,t,n,d(g,"radial"===r),h,"fill")}}))}))})).each((function(e){var t=e[0].trace,r="waterfall"===t.type;if(e[0]._distinct&&r){var a=e[0].trace[e[0].dir].marker;return e[0].mc=a.color,e[0].mlw=a.line.width,e[0].mlc=a.line.color,v(e,this,"waterfall")}var i=[];t.visible&&r&&(i=e[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(e){var r=n.select(this),a=t[e[0]].marker,i=g(void 0,a.line,5,2);r.attr("d",e[1]).style("stroke-width",i+"px").call(l.fill,a.color),i&&r.call(l.stroke,a.line.color)}))})).each((function(e){v(e,this,"funnel")})).each((function(e){v(e,this)})).each((function(e){var r=e[0].trace,s=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[e]:[]);s.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),s.exit().remove(),s.each((function(){var e=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var a=g(void 0,r.line,5,2);e.style("stroke-width",a+"px").call(l.fill,r.fillcolor),a&&l.stroke(e,r.line.color)}else{var c=i.minExtend(r,{marker:{size:h?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});s.call(o.pointStyle,c,t)}}))})).each((function(e){m(e,this,"funnelarea")})).each((function(e){m(e,this,"pie")})).each((function(e){var r,a,l=e[0],u=l.trace,f=u.visible&&u.fill&&"none"!==u.fill,p=c.hasLines(u),h=u.contours,v=!1,m=!1,y=s(u),x=y.colorscale,b=y.reversescale;if(h){var _=h.coloring;"lines"===_?v=!0:p="none"===_||"heatmap"===_||h.showlines,"constraint"===h.type?f="="!==h._operation:"fill"!==_&&"heatmap"!==_||(m=!0)}var w=c.hasMarkers(u)||c.hasText(u),T=f||m,k=p||v,M=w||!T?"M5,0":k?"M5,-2":"M5,-3",A=n.select(this),L=A.select(".legendfill").selectAll("path").data(f||m?[e]:[]);if(L.enter().append("path").classed("js-fill",!0),L.exit().remove(),L.attr("d",M+"h30v6h-30z").call(f?o.fillGroupStyle:function(e){if(e.size()){var r="legendfill-"+u.uid;o.gradient(e,t,r,d(b),x,"fill")}}),p||v){var S=g(void 0,u.line,10,5);a=i.minExtend(u,{line:{width:S}}),r=[i.minExtend(l,{trace:a})]}var C=A.select(".legendlines").selectAll("path").data(p||v?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",M+(v?"l30,0.0001":"h30")).call(p?o.lineGroupStyle:function(e){if(e.size()){var r="legendline-"+u.uid;o.lineGroupStyle(e),o.gradient(e,t,r,d(b),x,"stroke")}})})).each((function(e){var r,a,l=e[0],s=l.trace,u=c.hasMarkers(s),f=c.hasText(s),d=c.hasLines(s);function p(e,t,r,n){var a=i.nestedProperty(s,e).get(),o=i.isArrayOrTypedArray(a)&&t?t(a):a;if(h&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(e){return l._distinct&&l.index&&e[l.index]?e[l.index]:e[0]}if(u||f||d){var v={},m={};if(u){v.mc=p("marker.color",g),v.mx=p("marker.symbol",g),v.mo=p("marker.opacity",i.mean,[.2,1]),v.mlc=p("marker.line.color",g),v.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);v.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",g,[0,10],5)}),f&&(v.tx="Aa",v.tp=p("textposition",g),v.ts=10,v.tc=p("textfont.color",g),v.tf=p("textfont.family",g)),r=[i.minExtend(l,v)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var x=n.select(this).select("g.legendpoints"),b=x.selectAll("path.scatterpts").data(u?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),b.exit().remove(),b.call(o.pointStyle,a,t),u&&(r[0].mrc=3);var _=x.selectAll("g.pointtext").data(f?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.selectAll("text").call(o.textPointStyle,a,t)})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(t.visible&&"candlestick"===t.type?[e,e]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",(function(e,t){return t?"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(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=g(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(l.fill,i.fillcolor),o&&l.stroke(a,i.line.color)}))})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(t.visible&&"ohlc"===t.type?[e,e]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",(function(e,t){return t?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"})).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],s=g(void 0,i.line,5,2);a.style("fill","none").call(o.dashLine,i.line.dash,s),s&&l.stroke(a,i.line.color)}))}))}},{"../../lib":171,"../../registry":257,"../../traces/pie/helpers":289,"../../traces/pie/style_one":295,"../../traces/scatter/subtypes":321,"../color":45,"../colorscale/helpers":56,"../drawing":67,d3:9}],104:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/plots"),i=e("../../plots/cartesian/axis_ids"),o=e("../../fonts/ploticon"),l=e("../shapes/draw").eraseActiveShape,s=e("../../lib"),c=s._,u=t.exports={};function f(e,t){var r,a,o=t.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=e._fullLayout,u={},f=i.list(e,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(e){for(var t=0;t0)){var g=function(e,t,r){for(var n=r.filter((function(r){return t[r].anchor===e._id})),a=0,i=0;i=n.max)t=I[r+1];else if(e=n.pmax)t=I[r+1];else if(e0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(e,t,r,n,a){var l="category"===e.type||"multicategory"===e.type?e.r2c:e.d2c;if(void 0!==t)return[l(t),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===e.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]:void 0}}t.exports=function(e){var t=e._fullLayout,r=n.filterVisible(t.shapes);if(r.length&&e._fullData.length)for(var o=0;oy?(k=f,S="y0",M=y,C="y1"):(k=y,S="y1",M=f,C="y0");Y(n),Q(l,r),function(e,t,r){var n=t.xref,a=t.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(e,s?"clip"+r._fullLayout._uid+s:null,r)}(t,r,e),Z.moveFn="move"===z?X:W,Z.altKey=n.altKey},doneFn:function(){if(m(e))return;p(t),J(l),b(t,e,r),n.call("_guiRelayout",e,s.getUpdateObj())},clickFn:function(){if(m(e))return;J(l)}};function Y(r){if(m(e))z=null;else if(I)z="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=Z.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(t,s),z=s.split("-")[0]}}function X(n,a){if("path"===r.type){var i=function(e){return e},o=i,s=i;E?N("xanchor",r.xanchor=V(x+n)):(o=function(e){return V(j(e)+n)},H&&"date"===H.type&&(o=g.encodeDate(o))),R?N("yanchor",r.yanchor=q(T+a)):(s=function(e){return q(U(e)+a)},B&&"date"===B.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else E?N("xanchor",r.xanchor=V(x+n)):(N("x0",r.x0=V(c+n)),N("x1",r.x1=V(v+n))),R?N("yanchor",r.yanchor=q(T+a)):(N("y0",r.y0=q(f+a)),N("y1",r.y1=q(y+a)));t.attr("d",_(e,r)),Q(l,r)}function W(n,a){if(F){var i=function(e){return e},o=i,s=i;E?N("xanchor",r.xanchor=V(x+n)):(o=function(e){return V(j(e)+n)},H&&"date"===H.type&&(o=g.encodeDate(o))),R?N("yanchor",r.yanchor=q(T+a)):(s=function(e){return q(U(e)+a)},B&&"date"===B.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else if(I){if("resize-over-start-point"===z){var u=c+n,d=R?f-a:f+a;N("x0",r.x0=E?u:V(u)),N("y0",r.y0=R?d:q(d))}else if("resize-over-end-point"===z){var p=v+n,h=R?y-a:y+a;N("x1",r.x1=E?p:V(p)),N("y1",r.y1=R?h:q(h))}}else{var m=function(e){return-1!==z.indexOf(e)},b=m("n"),G=m("s"),Z=m("w"),Y=m("e"),X=b?k+a:k,W=G?M+a:M,J=Z?A+n:A,$=Y?L+n:L;R&&(b&&(X=k-a),G&&(W=M-a)),(!R&&W-X>10||R&&X-W>10)&&(N(S,r[S]=R?X:q(X)),N(C,r[C]=R?W:q(W))),$-J>10&&(N(O,r[O]=E?J:V(J)),N(D,r[D]=E?$:V($)))}t.attr("d",_(e,r)),Q(l,r)}function Q(e,t){(E||R)&&function(){var r="path"!==t.type,n=e.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 i=j(E?t.xanchor:a.midRange(r?[t.x0,t.x1]:g.extractPathCoords(t.path,h.paramIsX))),o=U(R?t.yanchor:a.midRange(r?[t.y0,t.y1]:g.extractPathCoords(t.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),E&&R){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(E){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function J(e){e.selectAll(".visual-cue").remove()}d.init(Z),G.node().onmousemove=Y}(e,E,s,t,r,z):!0===s.editable&&E.style("pointer-events",D||c.opacity(L)*A<=.5?"stroke":"all");E.node().addEventListener("click",(function(){return function(e,t){if(!y(e))return;var r=+t.node().getAttribute("data-index");if(r>=0){if(r===e._fullLayout._activeShapeIndex)return void T(e);e._fullLayout._activeShapeIndex=r,e._fullLayout._deactivateShape=T,v(e)}}(e,E)}))}}function b(e,t,r){var n=(r.xref+r.yref).replace(/paper/g,"");u.setClipUrl(e,n?"clip"+t._fullLayout._uid+n:null,t)}function _(e,t){var r,n,o,l,s,c,u,f,d=t.type,p=i.getFromId(e,t.xref),v=i.getFromId(e,t.yref),m=e._fullLayout._size;if(p?(r=g.shapePositionToRange(p),n=function(e){return p._offset+p.r2p(r(e,!0))}):n=function(e){return m.l+m.w*e},v?(o=g.shapePositionToRange(v),l=function(e){return v._offset+v.r2p(o(e,!0))}):l=function(e){return m.t+m.h*(1-e)},"path"===d)return p&&"date"===p.type&&(n=g.decodeDate(n)),v&&"date"===v.type&&(l=g.decodeDate(l)),function(e,t,r){var n=e.path,i=e.xsizemode,o=e.ysizemode,l=e.xanchor,s=e.yanchor;return n.replace(h.segmentRE,(function(e){var n=0,c=e.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=e.substr(1).replace(h.paramRE,(function(e){return u[n]?e="pixel"===i?t(l)+Number(e):t(e):f[n]&&(e="pixel"===o?r(s)-Number(e):r(e)),++n>d&&(e="X"),e}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+e)),c+p}))}(t,n,l);if("pixel"===t.xsizemode){var y=n(t.xanchor);s=y+t.x0,c=y+t.x1}else s=n(t.x0),c=n(t.x1);if("pixel"===t.ysizemode){var x=l(t.yanchor);u=x-t.y0,f=x-t.y1}else u=l(t.y0),f=l(t.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var b=(s+c)/2,_=(u+f)/2,w=Math.abs(b-s),T=Math.abs(_-u),k="A"+w+","+T,M=b+w+","+_;return"M"+M+k+" 0 1,1 "+(b+","+(_-T))+k+" 0 0,1 "+M+"Z"}function w(e,t,r){return e.replace(h.segmentRE,(function(e){var n=0,a=e.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+e.substr(1).replace(h.paramRE,(function(e){return n>=l||(i[n]?e=t(e):o[n]&&(e=r(e)),n++),e}))}))}function T(e){y(e)&&(e._fullLayout._activeShapeIndex>=0&&(s(e),delete e._fullLayout._activeShapeIndex,v(e)))}t.exports={draw:v,drawOne:x,eraseActiveShape:function(e){if(!y(e))return;s(e);var t=e._fullLayout._activeShapeIndex,r=(e.layout||{}).shapes||[];if(t=0&&f(m),r.attr("d",g(t)),M&&!d)&&(k=function(e,t){for(var r=0;r1&&(2!==e.length||"Z"!==e[1][0])&&(0===T&&(e[0][0]="M"),t[w]=e,y(),x())}}()}}function P(e,r){!function(e,r){if(t.length)for(var n=0;n0&&s0&&(l=l.transition().duration(t.transition.duration).ease(t.transition.easing)),l.attr("transform","translate("+(o-.5*u.gripWidth)+","+t._dims.currentValueTotalHeight+")")}}function L(e,t){var r=e._dims;return r.inputAreaStart+u.stepInset+(r.inputAreaLength-2*u.stepInset)*Math.min(1,Math.max(0,t))}function S(e,t){var r=e._dims;return Math.min(1,Math.max(0,(t-u.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*u.stepInset-2*r.inputAreaStart)))}function C(e,t,r){var n=r._dims,a=l.ensureSingle(e,"rect",u.railTouchRectClass,(function(n){n.call(k,t,e,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,u.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function O(e,t){var r=t._dims,n=r.inputAreaLength-2*u.railInset,a=l.ensureSingle(e,"rect",u.railRectClass);a.attr({width:n,height:u.railWidth,rx:u.railRadius,ry:u.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,t.bordercolor).call(i.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px"),o.setTranslate(a,u.railInset,.5*(r.inputAreaWidth-u.railWidth)+r.currentValueTotalHeight)}t.exports=function(e){var t=e._fullLayout,r=function(e,t){for(var r=e[u.name],n=[],a=0;a0?[0]:[]);function l(t){t._commandObserver&&(t._commandObserver.remove(),delete t._commandObserver),a.autoMargin(e,g(t))}if(i.enter().append("g").classed(u.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+u.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+u.groupClassName).data(r,v);s.enter().append("g").classed(u.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||f<0){var v={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];t.attr("transform","translate("+v+")")}}}return E.call(R),P&&(L?E.on(".opacity",null):(k=0,M=!0,E.text(m).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)}))),E.call(u.makeEditable,{gd:e}).on("edit",(function(t){void 0!==y?o.call("_guiRestyle",e,v,t,y):o.call("_guiRelayout",e,v,t)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(R)})).on("input",(function(e){this.text(e||" ").call(u.positionText,b.x,b.y)}))),E.classed("js-placeholder",M),w}}},{"../../constants/alignment":147,"../../constants/interactions":149,"../../lib":171,"../../lib/svg_text_utils":192,"../../plots/plots":249,"../../registry":257,"../color":45,"../drawing":67,d3:9,"fast-isnumeric":11}],141:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("../color/attributes"),i=e("../../lib/extend").extendFlat,o=e("../../plot_api/edit_types").overrideAll,l=e("../../plots/pad_attributes"),s=e("../../plot_api/plot_template").templatedArray,c=s("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"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});t.exports=o(s("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:c,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:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":165,"../../plot_api/edit_types":198,"../../plot_api/plot_template":205,"../../plots/font_attributes":243,"../../plots/pad_attributes":248,"../color/attributes":44}],142:[function(e,t,r){"use strict";t.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"}}},{}],143:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/array_container_defaults"),i=e("./attributes"),o=e("./constants").name,l=i.buttons;function s(e,t,r){function o(r,a){return n.coerce(e,t,i,r,a)}o("visible",a(e,t,{name:"buttons",handleItemDefaults:c}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),n.noneOrAll(e,t,["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 c(e,t){function r(r,a){return n.coerce(e,t,l,r,a)}r("visible","skip"===e.method||Array.isArray(e.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}t.exports=function(e,t){a(e,t,{name:o,handleItemDefaults:s})}},{"../../lib":171,"../../plots/array_container_defaults":211,"./attributes":141,"./constants":142}],144:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../plots/plots"),i=e("../color"),o=e("../drawing"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../plot_api/plot_template").arrayEditor,u=e("../../constants/alignment").LINE_SPACING,f=e("./constants"),d=e("./scrollbox");function p(e){return e._index}function h(e,t){return+e.attr(f.menuIndexAttrName)===t._index}function g(e,t,r,n,a,i,o,l){t.active=o,c(e.layout,f.name,t).applyUpdate("active",o),"buttons"===t.type?m(e,n,null,null,t):"dropdown"===t.type&&(a.attr(f.menuIndexAttrName,"-1"),v(e,n,a,i,t),l||m(e,n,a,i,t))}function v(e,t,r,n,a){var i=l.ensureSingle(t,"g",f.headerClassName,(function(e){e.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,e).call(A,a,d,p),l.ensureSingle(t,"text",f.headerArrowClassName,(function(e){e.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(e,t,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(t,s.lx,s.ly)}function m(e,t,r,i,o){r||(r=t).attr("pointer-events","all");var s=function(e){return-1==+e.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,e).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(e,o,0,t,r,i,-1),a.executeAPICommand(e,l.method,l.args2)):(g(e,o,0,t,r,i,s),a.executeAPICommand(e,l.method,l.args))),e.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(m.openWidth,m.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(m.openHeight,m.headerHeight)),k.direction=o.direction,i&&(u.size()?function(e,t,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[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(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(e){e.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),k?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>T,D=l.barWidth+2*l.barPad,P=l.barLength+2*l.barPad,z=h+g,E=v;z+D>s&&(z=s-D);var R=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),O?(this.vbar=R.attr({rx:l.barRadius,ry:l.barRadius,x:z,y:E,width:D,height:P}),this._vbarYMin=E+P/2,this._vbarTranslateMax=T-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,F=u-.5,N=O?f+D+.5:f+.5,H=d-.5,B=k?p+A+.5:p+.5,j=o._topdefs.selectAll("#"+I).data(k||O?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",I).append("rect"),k||O?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(H),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(B)-Math.floor(H)}),this.container.call(i.setClipUrl,I,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||O){var U=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(U);var V=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(V),O&&this.vbar.on(".drag",null).call(V)}this.setTranslate(t,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.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)},l.prototype._onBoxDrag=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e-=n.event.dx),this.vbar&&(t-=n.event.dy),this.setTranslate(e,t)},l.prototype._onBoxWheel=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e+=n.event.deltaY),this.vbar&&(t+=n.event.deltaY),this.setTranslate(e,t)},l.prototype._onBarDrag=function(){var e=this.translateX,t=this.translateY;if(this.hbar){var r=e+this._hbarXMin,a=r+this._hbarTranslateMax;e=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=t+this._vbarYMin,l=i+this._vbarTranslateMax;t=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(e,t)},l.prototype.setTranslate=function(e,t){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(e=o.constrain(e||0,0,r),t=o.constrain(t||0,0,n),this.translateX=e,this.translateY=t,this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-t),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+t-.5)}),this.hbar){var a=e/r;this.hbar.call(i.setTranslate,e+a*this._hbarTranslateMax,t)}if(this.vbar){var l=t/n;this.vbar.call(i.setTranslate,e,t+l*this._vbarTranslateMax)}}},{"../../lib":171,"../color":45,"../drawing":67,d3:9}],147:[function(e,t,r){"use strict";t.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"}}},{}],148:[function(e,t,r){"use strict";t.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],149:[function(e,t,r){"use strict";t.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],150:[function(e,t,r){"use strict";t.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],151:[function(e,t,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}},{}],152:[function(e,t,r){"use strict";r.version=e("./version").version,e("es6-promise").polyfill(),e("../build/plotcss"),e("./fonts/mathjax_config")();for(var n=e("./registry"),a=r.register=n.register,i=e("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],155:[function(e,t,r){"use strict";r.isLeftAnchor=function(e){return"left"===e.xanchor||"auto"===e.xanchor&&e.x<=1/3},r.isCenterAnchor=function(e){return"center"===e.xanchor||"auto"===e.xanchor&&e.x>1/3&&e.x<2/3},r.isRightAnchor=function(e){return"right"===e.xanchor||"auto"===e.xanchor&&e.x>=2/3},r.isTopAnchor=function(e){return"top"===e.yanchor||"auto"===e.yanchor&&e.y>=2/3},r.isMiddleAnchor=function(e){return"middle"===e.yanchor||"auto"===e.yanchor&&e.y>1/3&&e.y<2/3},r.isBottomAnchor=function(e){return"bottom"===e.yanchor||"auto"===e.yanchor&&e.y<=1/3}},{}],156:[function(e,t,r){"use strict";var n=e("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(e){return Math.abs(e[1]-e[0])>l-1e-14}function c(e,t){return i(t-e,l)}function u(e,t){if(s(t))return!0;var r,n;t[0](n=a(n,l))&&(n+=l);var i=a(e,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(e,t,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(e,t){return[e*Math.cos(t)+a,i-e*Math.sin(t)]}g?(u=0,f=o,d=l):r=a&&e<=i);var a,i},pathArc:function(e,t,r,n,a){return f(null,e,t,r,n,a,0)},pathSector:function(e,t,r,n,a){return f(null,e,t,r,n,a,1)},pathAnnulus:function(e,t,r,n,a,i){return f(e,t,r,n,a,i,1)}}},{"./mod":178}],157:[function(e,t,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(e){return a.isView(e)&&!(e instanceof i)}function l(e){return n(e)||o(e)}function s(e,t,r){if(l(e)){if(l(e[0])){for(var n=r,a=0;aa.max?t.set(r):t.set(+e)}},integer:{coerceFunction:function(e,t,r,a){e%1||!n(e)||void 0!==a.min&&ea.max?t.set(r):t.set(+e)}},string:{coerceFunction:function(e,t,r,n){if("string"!=typeof e){var a="number"==typeof e;!0!==n.strict&&a?t.set(String(e)):t.set(r)}else n.noBlank&&!e?t.set(r):t.set(e)}},color:{coerceFunction:function(e,t,r){a(e).isValid()?t.set(e):t.set(r)}},colorlist:{coerceFunction:function(e,t,r){Array.isArray(e)&&e.length&&e.every((function(e){return a(e).isValid()}))?t.set(e):t.set(r)}},colorscale:{coerceFunction:function(e,t,r){t.set(o.get(e,r))}},angle:{coerceFunction:function(e,t,r){"auto"===e?t.set("auto"):n(e)?t.set(u(+e,360)):t.set(r)}},subplotid:{coerceFunction:function(e,t,r,n){var a=n.regex||c(r);"string"==typeof e&&a.test(e)?t.set(e):t.set(r)},validateFunction:function(e,t){var r=t.dflt;return e===r||"string"==typeof e&&!!c(r).test(e)}},flaglist:{coerceFunction:function(e,t,r,n){if("string"==typeof e)if(-1===(n.extras||[]).indexOf(e)){for(var a=e.split("+"),i=0;i=n&&e<=a?e:u}if("string"!=typeof e&&"number"!=typeof e)return u;e=String(e);var c=_(t),m=e.charAt(0);!c||"G"!==m&&"g"!==m||(e=e.substr(1),t="");var w=c&&"chinese"===t.substr(0,7),T=e.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),L=Number(T[7]||0),S=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var O;k=Number(k);try{var D=v.getComponentMethod("calendars","getCal")(t);if(w){var P="i"===M.charAt(M.length-1);M=parseInt(M,10),O=D.newDate(k,D.toMonthIndex(k,M,P),A)}else O=D.newDate(k,Number(M),A)}catch(e){return u}return O?(O.toJD()-g)*f+L*d+S*p+C*h:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var z=new Date(Date.UTC(2e3,M,A,L,S));return z.setUTCFullYear(k),z.getUTCMonth()!==M||z.getUTCDate()!==A?u:z.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(e,t){return r.dateTime2ms(e,t)!==u};var T=90*f,k=3*d,M=5*p;function A(e,t,r,n,a){if((t||r||n||a)&&(e+=" "+w(t,2)+":"+w(r,2),(n||a)&&(e+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;e+="."+w(a,i)}return e}r.ms2DateTime=function(e,t,r){if("number"!=typeof e||!(e>=n&&e<=a))return u;t||(t=0);var i,o,l,c,y,x,b=Math.floor(10*s(e+.05,1)),w=Math.round(e-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(e,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(e){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=t=n+f&&e<=a-f))return u;var t=Math.floor(10*s(e+.05,1)),r=new Date(Math.round(e-t/10));return A(i("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+t)},r.cleanDate=function(e,t,n){if(e===u)return t;if(r.isJSDate(e)||"number"==typeof e&&isFinite(e)){if(_(n))return l.error("JS Dates and milliseconds are incompatible with world calendars",e),t;if(!(e=r.ms2DateTimeLocal(+e))&&void 0!==t)return t}else if(!r.isDateTime(e,n))return l.error("unrecognized date",e),t;return e};var L=/%\d?f/g;function S(e,t,r,n){e=e.replace(L,(function(e){var r=Math.min(+e.charAt(1)||6,6);return(t/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(t+.05));if(_(n))try{e=v.getComponentMethod("calendars","worldCalFmt")(e,t,n)}catch(e){return"Invalid"}return r(e)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(e,t,r,n,a,i){if(a=_(a)&&a,!t)if("y"===r)t=i.year;else if("m"===r)t=i.month;else{if("d"!==r)return function(e,t){var r=s(e+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==t){o(t)||(t=0);var a=(100+Math.min(s(e/h,60),C[t])).toFixed(t).substr(1);t>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(e,r)+"\n"+S(i.dayMonthYear,e,n,a);t=i.dayMonth+"\n"+i.year}return S(t,e,n,a)};var O=3*f;r.incrementMonth=function(e,t,r){r=_(r)&&r;var n=s(e,f);if(e=Math.round(e-n),r)try{var a=Math.round(e/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return t%12?i.add(o,t,"m"):i.add(o,t/12,"y"),(o.toJD()-g)*f+n}catch(t){l.error("invalid ms "+e+" in calendar "+r)}var c=new Date(e+O);return c.setUTCMonth(c.getUTCMonth()+t)+n-O},r.findExactDates=function(e,t){for(var r,n,a=0,i=0,l=0,s=0,c=_(t)&&v.getComponentMethod("calendars","getCal")(t),u=0;u1||g<0||g>1?null:{x:e+s*g,y:t+f*g}}function s(e,t,r,n,a){var i=n*e+a*t;if(i<0)return n*n+a*a;if(i>r){var o=n-e,l=a-t;return o*o+l*l}var s=n*t-a*e;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(e,t,r,n,a,i,o,c){if(l(e,t,r,n,a,i,o,c))return 0;var u=r-e,f=n-t,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-e,i-t),s(u,f,h,o-e,c-t),s(d,p,g,e-a,t-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(e,t,r,l){if(e===a&&l===i||(n={},a=e,i=l),n[r])return n[r];var s=e.getPointAtLength(o(r-l/2,t)),c=e.getPointAtLength(o(r+l/2,t)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=e.getPointAtLength(o(r,t)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(e,t,r){var n,a,i=t.left,o=t.right,l=t.top,s=t.bottom,c=0,u=e.getTotalLength(),f=u;function d(t){var r=e.getPointAtLength(t);0===t?n=r:t===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(e,t,r,n){for(var a,i,o,l=(n=n||{}).pathLength||e.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=e.getPointAtLength(0)[r]>e.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":178}],169:[function(e,t,r){"use strict";t.exports=function(e){return e}},{}],170:[function(e,t,r){"use strict";t.exports=function(e,t){if(!t)return e;var r=1/Math.abs(t),n=r>1?(r*e+r*t)/r:e+t,a=String(n).length;if(a>16){var i=String(t).length;if(a>=String(e).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],171:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../constants/numerical"),l=o.FP_SAFE,s=o.BADNUM,c=t.exports={};c.nestedProperty=e("./nested_property"),c.keyedContainer=e("./keyed_container"),c.relativeAttr=e("./relative_attr"),c.isPlainObject=e("./is_plain_object"),c.toLogRange=e("./to_log_range"),c.relinkPrivateKeys=e("./relink_private");var u=e("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=e("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var d=e("./coerce");c.valObjectMeta=d.valObjectMeta,c.coerce=d.coerce,c.coerce2=d.coerce2,c.coerceFont=d.coerceFont,c.coerceHoverinfo=d.coerceHoverinfo,c.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,c.validate=d.validate;var p=e("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var h=e("./search");c.findBin=h.findBin,c.sorterAsc=h.sorterAsc,c.sorterDes=h.sorterDes,c.distinctVals=h.distinctVals,c.roundUp=h.roundUp,c.sort=h.sort,c.findIndexOfMin=h.findIndexOfMin;var g=e("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var v=e("./matrix");c.init2dArray=v.init2dArray,c.transposeRagged=v.transposeRagged,c.dot=v.dot,c.translationMatrix=v.translationMatrix,c.rotationMatrix=v.rotationMatrix,c.rotationXYMatrix=v.rotationXYMatrix,c.apply2DTransform=v.apply2DTransform,c.apply2DTransform2=v.apply2DTransform2;var m=e("./angles");c.deg2rad=m.deg2rad,c.rad2deg=m.rad2deg,c.angleDelta=m.angleDelta,c.angleDist=m.angleDist,c.isFullCircle=m.isFullCircle,c.isAngleInsideSector=m.isAngleInsideSector,c.isPtInsideSector=m.isPtInsideSector,c.pathArc=m.pathArc,c.pathSector=m.pathSector,c.pathAnnulus=m.pathAnnulus;var y=e("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=e("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=e("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=e("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=e("./regex");c.counterRegex=w.counter;var T=e("./throttle");c.throttle=T.throttle,c.throttleDone=T.done,c.clearThrottle=T.clear;var k=e("./dom");function M(e){var t={};for(var r in e)for(var n=e[r],a=0;al?s:i(e)?Number(e):s:s},c.isIndex=function(e,t){return!(void 0!==t&&e>=t)&&(i(e)&&e>=0&&e%1==0)},c.noop=e("./noop"),c.identity=e("./identity"),c.repeat=function(e,t){for(var r=new Array(t),n=0;nr?Math.max(r,Math.min(t,e)):Math.max(t,Math.min(r,e))},c.bBoxIntersect=function(e,t,r){return r=r||0,e.left<=t.right+r&&t.left<=e.right+r&&e.top<=t.bottom+r&&t.top<=e.bottom+r},c.simpleMap=function(e,t,r,n,a){for(var i=e.length,o=new Array(i),l=0;l=Math.pow(2,r)?a>10?(c.warn("randstr failed uniqueness"),s):e(t,r,n,(a||0)+1):s},c.OptionControl=function(e,t){e||(e={}),t||(t="opt");var r={optionList:[],_newoption:function(n){n[t]=e,r[n.name]=n,r.optionList.push(n)}};return r["_"+t]=e,r},c.smooth=function(e,t){if((t=Math.round(t)||0)<2)return e;var r,n,a,i,o=e.length,l=2*o,s=2*t-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=e[a]*c[n];u[r]=i}return u},c.syncOrAsync=function(e,t,r){var n;function a(){return c.syncOrAsync(e,t,r)}for(;e.length;)if((n=(0,e.splice(0,1)[0])(t))&&n.then)return n.then(a).then(void 0,c.promiseError);return r&&r(t)},c.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},c.noneOrAll=function(e,t,r){if(e){var n,a=!1,i=!0;for(n=0;n0?t:0}))},c.fillArray=function(e,t,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(e))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var D=/^\w*$/;c.templateString=function(e,t){var r={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,n){var a;return D.test(n)?a=t[n]:(r[n]=r[n]||c.nestedProperty(t,n).get,a=r[n]()),c.isValidTextValue(a)?a:""}))};var P={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return R.apply(P,arguments)};var z={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return R.apply(z,arguments)};var E=/^[:|\|]/;function R(e,t,r){var i=this,o=arguments;t||(t={});var l={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,s,u){var f,d,p,h;for(p=3;p=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var I=2e9;c.seedPseudoRandom=function(){I=2e9},c.pseudoRandom=function(){var e=I;return I=(69069*I+1)%4294967296,Math.abs(I-e)<429496729?c.pseudoRandom():I/4294967296},c.fillText=function(e,t,r){var n=Array.isArray(r)?function(e){r.push(e)}:function(e){r.text=e},a=c.extractOption(e,t,"htx","hovertext");if(c.isValidTextValue(a))return n(a);var i=c.extractOption(e,t,"tx","text");return c.isValidTextValue(i)?n(i):void 0},c.isValidTextValue=function(e){return e||0===e},c.formatPercent=function(e,t){t=t||0;for(var r=(Math.round(100*e*Math.pow(10,t))*Math.pow(.1,t)).toFixed(t)+"%",n=0;n1&&(c=1):c=0,"translate("+(a-c*(r+o))+","+(i-c*(n+l))+")"+(c<1?"scale("+c+")":"")+(s?"rotate("+s+(t?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(e,t){var r=c.extendFlat({},t);return r.size=Math.max(t.size,e._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":150,"./anchor_utils":155,"./angles":156,"./array":157,"./clean_number":158,"./clear_responsive":160,"./coerce":161,"./dates":162,"./dom":163,"./extend":165,"./filter_unique":166,"./filter_visible":167,"./geometry2d":168,"./identity":169,"./increment":170,"./is_plain_object":172,"./keyed_container":173,"./localize":174,"./loggers":175,"./make_trace_groups":176,"./matrix":177,"./mod":178,"./nested_property":179,"./noop":180,"./notifier":181,"./push_unique":184,"./regex":186,"./relative_attr":187,"./relink_private":188,"./search":189,"./stats":191,"./throttle":193,"./to_log_range":194,d3:9,"d3-time-format":7,"fast-isnumeric":11}],172:[function(e,t,r){"use strict";t.exports=function(e){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(e):"[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.prototype}},{}],173:[function(e,t,r){"use strict";var n=e("./nested_property"),a=/^\w*$/;t.exports=function(e,t,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};t&&t.length?(s=n(e,t),l=s.get()):l=e,t=t||"";var u={};if(l)for(o=0;o2)return c[t]=2|c[t],d.set(e,null);if(f){for(o=t;o1){var t=["LOG:"];for(e=0;e1){var r=[];for(e=0;e"),"long")}},i.warn=function(){var e;if(n.logging>0){var t=["WARN:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}},i.error=function(){var e;if(n.logging>0){var t=["ERROR:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}}},{"../plot_api/plot_config":203,"./notifier":181}],176:[function(e,t,r){"use strict";var n=e("d3");t.exports=function(e,t,r){var a=e.selectAll("g."+r.replace(/\s/g,".")).data(t,(function(e){return e[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=e.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(e){e[0][i]=n.select(this)})),a}},{d3:9}],177:[function(e,t,r){"use strict";r.init2dArray=function(e,t){for(var r=new Array(e),n=0;nt/2?e-Math.round(e/t)*t:e}}},{}],179:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./array").isArrayOrTypedArray;function i(e,t){return function(){var r,n,o,l,s,c=e;for(l=0;l/g),s=0;si||c===a||cl)&&(!t||!s(e))}:function(e,t){var s=e[0],c=e[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(e,t){var r=[e[0]],n=0,a=0;function o(o){e.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(e.pop());return{addPt:o,raw:e,filtered:r}}},{"../constants/numerical":150,"./matrix":177}],184:[function(e,t,r){"use strict";t.exports=function(e,t){if(t instanceof RegExp){for(var r=t.toString(),n=0;na.queueLength&&(e.undoQueue.queue.shift(),e.undoQueue.index--))},startSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!0,e.undoQueue.beginSequence=!0},stopSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!1,e.undoQueue.beginSequence=!1},undo:function(e){var t,r;if(e.framework&&e.framework.isPolar)e.framework.undo();else if(!(void 0===e.undoQueue||isNaN(e.undoQueue.index)||e.undoQueue.index<=0)){for(e.undoQueue.index--,t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;r=e.undoQueue.queue.length)){for(t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;rt}function u(e,t){return e>=t}r.findBin=function(e,t,r){if(n(t.start))return r?Math.ceil((e-t.start)/t.size-1e-9)-1:Math.floor((e-t.start)/t.size+1e-9);var i,o,f=0,d=t.length,p=0,h=d>1?(t[d-1]-t[0])/(d-1):1;for(o=h>=0?r?l:s:r?u:c,e+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.log("Long binary search..."),f-1},r.sorterAsc=function(e,t){return e-t},r.sorterDes=function(e,t){return t-e},r.distinctVals=function(e,t){var n,a=(t||{}).unitMinDiff,i=e.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var l=1;a||(l=i[n]-i[0]||1);for(var s,c=l/(n||1)/1e4,u=[],f=0;f<=n;f++){var d=i[f],p=d-s;void 0===s?(u.push(d),s=d):p>c&&(l=Math.min(l,p),u.push(d),s=d)}return{vals:u,minDiff:l}},r.roundUp=function(e,t,r){for(var n,a=0,i=t.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()},r.findIndexOfMin=function(e,t){t=t||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(t)||(t=!1),a(i[0])){for(s=new Array(o),l=0;le.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}},{"./array":157,"fast-isnumeric":11}],192:[function(e,t,r){"use strict";var n=e("d3"),a=e("../lib"),i=e("../constants/xmlns_namespaces"),o=e("../constants/alignment").LINE_SPACING;function l(e,t){return e.node().getBoundingClientRect()[t]}var s=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(e,t,M){var A=e.text(),S=!e.attr("data-notex")&&"undefined"!=typeof MathJax&&A.match(s),C=n.select(e.node().parentNode);if(!C.empty()){var O=e.attr("class")?e.attr("class").split(" ")[0]:"text";return O+="-math",C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove(),e.style("display",null).attr({"data-unformatted":A,"data-math":"N"}),S?(t&&t._promises||[]).push(new Promise((function(t){e.style("display","none");var r=parseInt(e.node().style.fontSize,10),i={fontSize:r};!function(e,t,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":t.fontSize+"px"}).text(e.replace(c,"\\lt ").replace(u,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var t=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",e),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),t,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(S[2],i,(function(n,a,i){C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return D(),void t();var s=C.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":A,"data-math":"Y"});s.node().appendChild(o.node()),a&&a.node()&&o.node().insertBefore(a.node().cloneNode(!0),o.node().firstChild),o.attr({class:O,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=e.node().style.fill||"black",u=o.select("g");u.attr({fill:c,stroke:c});var f=l(u,"width"),d=l(u,"height"),p=+e.attr("x")-f*{start:0,middle:.5,end:1}[e.attr("text-anchor")||"start"],h=-(r||l(e,"height"))/4;"y"===O[0]?(s.attr({transform:"rotate("+[-90,+e.attr("x"),+e.attr("y")]+") translate("+[-f/2,h-d/2]+")"}),o.attr({x:+e.attr("x"),y:+e.attr("y")})):"l"===O[0]?o.attr({x:e.attr("x"),y:h-d/2}):"a"===O[0]&&0!==O.indexOf("atitle")?o.attr({x:0,y:h}):o.attr({x:p,y:+e.attr("y")+h-d/2}),M&&M.call(e,s),t(s)}))}))):D(),e}function D(){C.empty()||(O=e.attr("class")+"-math",C.select("svg."+O).remove()),e.text("").style("white-space","pre"),function(e,t){t=t.replace(g," ");var r,l=!1,s=[],c=-1;function u(){c++;var t=document.createElementNS(i.svg,"tspan");n.select(t).attr({class:"line",dy:c*o+"em"}),e.appendChild(t),r=t;var a=s;if(s=[{node:t}],a.length>1)for(var l=1;l doesnt match end tag <"+e+">. Pretending it did match.",t),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",t)}y.test(t)?u():(r=e,s=[{node:e}]);for(var C=t.split(v),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"},d={sub:"0.3em",sup:"-0.6em"},p={sub:"-0.21em",sup:"0.42em"},h=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,m=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,b=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(e,t){if(!e)return null;var r=e.match(t),n=r&&(r[3]||r[4]);return n&&L(n)}var k=/(^|;)\s*color:/;r.plainText=function(e,t){for(var r=void 0!==(t=t||{}).len&&-1!==t.len?t.len:1/0,n=void 0!==t.allowedTags?t.allowedTags:["br"],a="...".length,i=e.split(v),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var M={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},A=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function L(e){return e.replace(A,(function(e,t){return("#"===t.charAt(0)?function(e){if(e>1114111)return;var t=String.fromCodePoint;if(t)return t(e);var r=String.fromCharCode;return e<=65535?r(e):r(55232+(e>>10),e%1024+56320)}("x"===t.charAt(1)?parseInt(t.substr(2),16):parseInt(t.substr(1),10)):M[t])||e}))}function S(e,t,r){var n,a,i,o=r.horizontalAlign,l=r.verticalAlign||"top",s=e.node().getBoundingClientRect(),c=t.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},i="right"===o?function(){return s.right-n.width}:"center"===o?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:i()-c.left+"px","z-index":1e3}),this}}r.convertEntities=L,r.sanitizeHTML=function(e){e=e.replace(g," ");for(var t=document.createElement("p"),r=t,a=[],i=e.split(v),o=0;oi.ts+t?s():i.timer=setTimeout((function(){s(),i.timer=null}),t)},r.done=function(e){var t=n[e];return t&&t.timer?new Promise((function(e){var r=t.onDone;t.onDone=function(){r&&r(),e(),t.onDone=null}})):Promise.resolve()},r.clear=function(e){if(e)a(n[e]),delete n[e];else for(var t in n)r.clear(t)}},{}],194:[function(e,t,r){"use strict";var n=e("fast-isnumeric");t.exports=function(e,t){if(e>0)return Math.log(e)/Math.LN10;var r=Math.log(Math.min(t[0],t[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(t[0],t[1]))/Math.LN10-6),r}},{"fast-isnumeric":11}],195:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],196:[function(e,t,r){"use strict";t.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"}}},{}],197:[function(e,t,r){"use strict";var n=e("../registry");t.exports=function(e){for(var t,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=e.split("[")[0],l=0;l0&&o.log("Clearing previous rejected promises from queue."),e._promises=[]},r.cleanLayout=function(e){var t,n;e||(e={}),e.xaxis1&&(e.xaxis||(e.xaxis=e.xaxis1),delete e.xaxis1),e.yaxis1&&(e.yaxis||(e.yaxis=e.yaxis1),delete e.yaxis1),e.scene1&&(e.scene||(e.scene=e.scene1),delete e.scene1);var i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(e);for(t=0;t3?(D.x=1.02,D.xanchor="left"):D.x<-2&&(D.x=-.02,D.xanchor="right"),D.y>3?(D.y=1.02,D.yanchor="bottom"):D.y<-2&&(D.y=-.02,D.yanchor="top")),h(e),"rotate"===e.dragmode&&(e.dragmode="orbit"),c.clean(e),e.template&&e.template.layout&&r.cleanLayout(e.template.layout),e},r.cleanData=function(e){for(var t=0;t0)return e.substr(0,t)}r.hasParent=function(e,t){for(var r=b(t);r;){if(r in e)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(e,t,r){for(var n=0;n1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))t.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;t.set(y)}return!g&&(d(v,m),p(e),!0)}var x,b,_,w,T,k,M,A,L=Object.keys(r).map(Number).sort(o),S=t.get(),C=S||[],O=u(m,f).get(),D=[],P=-1,z=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?D.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),O&&O.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,k),-1===P&&(P=_);else for(b=0;b=0;x--)C.splice(D[x],1),O&&O.splice(D[x],1);if(C.length?S||t.set(C):t.set(null),g)return!1;if(d(v,m),h!==a){var E;if(-1===P)E=L;else{for(z=Math.max(C.length,z),E=[],x=0;x=P);x++)E.push(_);for(x=P;x=e.data.length||a<-e.data.length)throw new Error(r+" must be valid indices for gd.data.");if(t.indexOf(a,n+1)>-1||a>=0&&t.indexOf(-e.data.length+a)>-1||a<0&&t.indexOf(e.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function E(e,t,r){if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("currentIndices is a required argument.");if(Array.isArray(t)||(t=[t]),z(e,t,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&z(e,r,"newIndices"),"undefined"!=typeof r&&t.length!==r.length)throw new Error("current and new indices must be of equal length.")}function R(e,t,r,n,i){!function(e,t,r,n){var a=o.isPlainObject(n);if(!Array.isArray(e.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(t))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 i in z(e,r,"indices"),t){if(!Array.isArray(t[i])||t[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==t[i].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")}}(e,t,r,n);for(var s=function(e,t,r,n){var i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=P(r,e.data.length-1),t)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(t,r){e[r]=e[t],delete e[t]}}function V(e,t,r){if(e=o.getGraphDiv(e),T.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var n={};if("string"==typeof t)n[t]=r;else{if(!o.isPlainObject(t))return o.warn("Relayout fail.",t,r),Promise.reject();n=o.extendFlat({},t)}Object.keys(n).length&&(e.changed=!0);var a=W(e,n),i=a.flags;i.calc&&(e.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(k.layoutReplot):Object.keys(n).length&&(q(e,i,a)||d.supplyDefaults(e),i.legend&&l.push(k.doLegend),i.layoutstyle&&l.push(k.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(k.doTicksRelayout),i.modebar&&l.push(k.doModeBar),i.camera&&l.push(k.doCamera),i.colorbars&&l.push(k.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(e,V,[e,a.undoit],V,[e,a.redoit]);var s=o.syncOrAsync(l,e);return s&&s.then||(s=Promise.resolve(e)),s.then((function(){return e.emit("plotly_relayout",a.eventData),e}))}function q(e,t,r){var n=e._fullLayout;if(!t.axrange)return!1;for(var a in t)if("axrange"!==a&&t[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=e.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(e,t){var r=t?function(e){var r=[],n=!0;for(var a in t){var i=h.getFromId(e,a);if(r.push(a),i._matchGroup)for(var o in i._matchGroup)t[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(e,r,{skipTitle:n})}:function(e){return h.draw(e,"redraw")};e.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(e,t){var r,n,a,i=e.layout,s=e._fullLayout,c=s._guiEditing,d=H(s._preGUI,c),p=Object.keys(t),g=h.list(e),v=o.extendDeepAll({},t),m={};for(U(t),p=Object.keys(t),n=0;n0&&"string"!=typeof z.parts[R];)R--;var I=z.parts[R],F=z.parts[R-1]+"."+I,B=z.parts.slice(0,R).join("."),j=l(e.layout,B).get(),V=l(s,B).get(),q=z.get();if(void 0!==E){k[P]=E,L[P]="reverse"===I?E:N(q);var G=f.getLayoutValObject(s,z.parts);if(G&&G.impliedEdits&&null!==E)for(var W in G.impliedEdits)S(o.relativeAttr(P,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(P))if(E){S("autosize",null);var J="height"===P?"width":"height";S(J,s[J])}else s[P]=e._initialAutoSize[P];else if("autosize"===P)S("width",E?null:s.width),S("height",E?null:s.height);else if(F.match(Z))D(F),l(s,B+"._inputRange").set(null);else if(F.match(Y)){D(F),l(s,B+"._inputRange").set(null);var $=l(s,B).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else F.match(X)&&l(s,B+"._inputDomain").set(null);if("type"===I){var K=j,ee="linear"===V.type&&"log"===E,te="log"===V.type&&"linear"===E;if(ee||te){if(K&&K.range)if(V.autorange)ee&&(K.range=K.range[1]>K.range[0]?[1,2]:[2,1]);else{var re=K.range[0],ne=K.range[1];ee?(re<=0&&ne<=0&&S(B+".autorange",!0),re<=0?re=ne/1e6:ne<=0&&(ne=re/1e6),S(B+".range[0]",Math.log(re)/Math.LN10),S(B+".range[1]",Math.log(ne)/Math.LN10)):(S(B+".range[0]",Math.pow(10,re)),S(B+".range[1]",Math.pow(10,ne)))}else S(B+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[z.parts[0]]&&"radialaxis"===z.parts[1]&&delete s[z.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(e,V,E,S),u.getComponentMethod("images","convertCoords")(e,V,E,S)}else S(B+".autorange",!0),S(B+".range",null);l(s,B+"._inputRange").set(null)}else if(I.match(A)){var ae=l(s,P).get(),ie=(E||{}).type;ie&&"-"!==ie||(ie="linear"),u.getComponentMethod("annotations","convertCoords")(e,ae,ie,S),u.getComponentMethod("images","convertCoords")(e,ae,ie,S)}var oe=w.containerArrayMatch(P);if(oe){r=oe.array,n=oe.index;var le=oe.property,se=G||{editType:"calc"};""!==n&&""===le&&(w.isAddVal(E)?L[P]=null:w.isRemoveVal(E)?L[P]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",t)),M.update(_,se),m[r]||(m[r]={});var ce=m[r][n];ce||(ce=m[r][n]={}),ce[le]=E,delete t[P]}else"reverse"===I?(j.range?j.range.reverse():(S(B+".autorange",!0),j.range=[1,0]),V.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===P&&("lasso"===E||"select"===E)&&"lasso"!==q&&"select"!==q||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,z.set(E))}}for(r in m){w.applyContainerArrayChanges(e,d(i,r),m[r],_,d)||(_.plot=!0)}var ue=s._axisConstraintGroups||[];for(C in O)for(n=0;n1;)if(n.pop(),void 0!==(r=l(t,n.join(".")+".uirevision").get()))return r;return t.uirevision}function ne(e,t){for(var r=0;r=a.length?a[0]:a[e]:a}function s(e){return Array.isArray(i)?e>=i.length?i[0]:i[e]:i}function c(e,t){var r=0;return function(){if(e&&++r===t)return e()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){function f(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var t=n._currentFrame=n._frameQueue.shift();if(t){var r=t.name?t.name.toString():null;e._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=t.frameOpts.duration,d.transition(e,t.frame.data,t.frame.layout,T.coerceTraceIndices(e,t.frame.traces),t.frameOpts,t.transitionOpts).then((function(){t.onComplete&&t.onComplete()})),e.emit("plotly_animatingframe",{name:r,frame:t.frame,animation:{frame:t.frameOpts,transition:t.transitionOpts}})}else e.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function p(){e.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var t=function(){n._animationRaf=window.requestAnimationFrame(t),Date.now()-n._lastFrameAt>n._timeToNext&&f()};t()}var h,g,v=0;function m(e){return Array.isArray(a)?v>=a.length?e.transitionOpts=a[v]:e.transitionOpts=a[0]:e.transitionOpts=a,v++,e}var y=[],x=null==t,b=Array.isArray(t);if(!x&&!b&&o.isPlainObject(t))y.push({type:"object",data:m(o.extendFlat({},t))});else if(x||-1!==["string","number"].indexOf(typeof t))for(h=0;h0&&kk)&&M.push(g);y=M}}y.length>0?function(t){if(0!==t.length){for(var a=0;a=0;n--)if(o.isPlainObject(t[n])){var g=t[n].name,v=(u[g]||h[g]||{}).name,m=t[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[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.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(t[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(e,t){return e.index>t.index?-1:e.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+e._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=t[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[e,l],p=[e,i];return c&&c.add(e,s,f,u,p),d.modifyFrames(e,i)},r.addTraces=function e(t,n,a){t=o.getGraphDiv(t);var i,l,s=[],u=r.deleteTraces,f=e,d=[t,s],p=[t,n];for(function(e,t,r){var n,a;if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("traces must be defined.");for(Array.isArray(t)||(t=[t]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===e.dimensions){if(r++,t.length===r)return e;var o=t[r];if(!_(o))return!1;e=i[a][o]}else e=i[a]}else e=i}}return e}function _(e){return e===Math.round(e)&&e>=0}function w(){var e,t,r={};for(e in h(r,o),n.subplotsRegistry){if((t=n.subplotsRegistry[e]).layoutAttributes)if(Array.isArray(t.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[t[2]],l=3}else if("area"===e.type)a=u[o];else{var f=e._module;if(f||(f=(n.modules[e.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,t,l)},r.getLayoutValObject=function(e,t){return b(function(e,t){var r,a,i,l,s=e._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=t+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(e,t){o?n.nestedProperty(l[s],e).set(t):l[s+"."+e]=t}function f(){var e=l;return c(),e}return c(),{modifyBase:function(e,t){l[e]=t},modifyItem:u,getUpdateObj:f,applyUpdate:function(t,r){t&&u(t,r);var a=f();for(var i in a)n.nestedProperty(e,i).set(a[i])}}}},{"../lib":171,"../plots/attributes":212}],206:[function(e,t,r){"use strict";var n=e("d3"),a=e("../registry"),i=e("../plots/plots"),o=e("../lib"),l=e("../lib/clear_gl_canvases"),s=e("../components/color"),c=e("../components/drawing"),u=e("../components/titles"),f=e("../components/modebar"),d=e("../plots/cartesian/axes"),p=e("../constants/alignment"),h=e("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=e("../plots/cartesian/autorange").doAutoRange;function y(e,t,r){for(var n=0;n=e[1]||a[1]<=e[0])&&(i[0]t[0]))return!0}return!1}function x(e){var t,a,l,u,h,g,v=e._fullLayout,m=v._size,x=m.p,_=d.list(e,"",!0);if(v._paperdiv.style({width:e._context.responsive&&v.autosize&&!e._context._hasZeroWidth&&!e.layout.width?"100%":v.width+"px",height:e._context.responsive&&v.autosize&&!e._context._hasZeroHeight&&!e.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),e._context.setBackground(e,v.paper_bgcolor),r.drawMainTitle(e),f.manage(e),!v._has("cartesian"))return i.previousPromises(e);function T(e,t,r){var n=e._lw/2;return"x"===e._id.charAt(0)?t?"top"===r?t._offset-x-n:t._offset+t._length+x+n:m.t+m.h*(1-(e.position||0))+n%1:t?"right"===r?t._offset+t._length+x+n:t._offset-x-n:m.l+m.w*(e.position||0)+n%1}for(t=0;t<_.length;t++){var k=(u=_[t])._anchorAxis;u._linepositions={},u._lw=c.crispRound(e,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,O=l.yaxis.domain,D=l.plotgroup;if(y(C,O,L)){var P=D.node(),z=l.bg=o.ensureSingle(D,"rect","bg");P.insertBefore(z.node(),P.childNodes[0]),A.push(a)}else D.select("rect.bg").remove(),L.push([C,O]),S||(M.push(a),A.push(a))}var E,R,I,F,N,H,B,j,U,V,q,G,Z,Y=v._bgLayer.selectAll(".bg").data(M);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(e){v._plots[e].bg=n.select(this)})),t=0;tT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function e(t,r){for(var n in t)if("_"!==n.charAt(0)){var i=t[n],o=g(t,n,r);a(i)?(Array.isArray(t)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),e(i,o)):Array.isArray(i)&&v(i)&&e(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":171,"../plots/attributes":212,"../plots/plots":249,"./plot_config":203,"./plot_schema":204,"./plot_template":205}],208:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./plot_api"),i=e("../plots/plots"),o=e("../lib"),l=e("../snapshot/helpers"),s=e("../snapshot/tosvg"),c=e("../snapshot/svgtoimg"),u=e("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};t.exports=function(e,t){var r,d,p,h;function g(e){return!(e in t)||o.validate(t[e],f[e])}if(t=t||{},o.isPlainObject(e)?(r=e.data||[],d=e.layout||{},p=e.config||{},h={}):(e=o.getGraphDiv(e),r=o.extendDeep([],e.data),d=o.extendDeep({},e.layout),p=e._context,h=e._fullLayout||{}),!g("width")&&null!==t.width||!g("height")&&null!==t.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var v={};function m(e,r){return o.coerce(t,v,f,e,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),T=m("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},d);x?M.width=x:null===t.width&&n(h.width)&&(M.width=h.width),b?M.height=b:null===t.height&&n(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(k);function S(){return new Promise((function(e){setTimeout(e,l.getDelay(k._fullLayout))}))}function C(){return new Promise((function(e,t){var r=s(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function d(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),e(T?p:l.encodeJSON(p))}if(d(),"svg"===y)return e(T?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(e).catch(t)}))}return new Promise((function(e,t){a.plot(k,r,M,A).then(L).then(S).then(C).then((function(t){e(function(e){return T?e.replace(l.IMAGE_URL_PREFIX,""):e}(t))})).catch((function(e){t(e)}))}))}},{"../lib":171,"../plots/plots":249,"../snapshot/helpers":261,"../snapshot/svgtoimg":263,"../snapshot/tosvg":265,"../version":324,"./plot_api":202,"fast-isnumeric":11}],209:[function(e,t,r){"use strict";var n=e("../lib"),a=e("../plots/plots"),i=e("./plot_schema"),o=e("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(e,t,r,a,i,o){o=o||[];for(var f=Object.keys(e),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,O=x.length,D=Array.isArray(k);if(D&&(O=Math.min(O,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var P=x[A].length;for(M=0;M<(D?Math.min(P,k[A].length):P);M++)L=D?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&((b=M-o(v)-o(m))>A?_/b>S&&(y=v,x=m,S=_/b):_/M>S&&(y={val:v.val,pad:0},x={val:m.val,pad:0},S=_/M));if(d===p){var C=d-1,O=d+1;if(T)if(0===d)i=[0,1];else{var D=(d>0?f:u).reduce((function(e,t){return Math.max(e,o(t))}),0),P=d/(1-Math.min(.5,D/M));i=d>0?[0,P]:[P,0]}else i=k?[Math.max(0,C),Math.max(1,O)]:[C,O]}else T?(y.val>=0&&(y={val:0,pad:0}),x.val<=0&&(x={val:0,pad:0})):k&&(y.val-S*o(y)<0&&(y={val:0,pad:0}),x.val<=0&&(x={val:1,pad:0})),S=(x.val-y.val-L(v.val,m.val))/(M-o(y)-o(x)),i=[y.val-S*o(y),x.val+S*o(x)];return h&&i.reverse(),a.simpleMap(i,t.l2r||Number)}function s(e){var t=e._length/20;return"domain"===e.constrain&&e._inputDomain&&(t*=(e._inputDomain[1]-e._inputDomain[0])/(e.domain[1]-e.domain[0])),function(e){return e.pad+(e.extrapad?t:0)}}function c(e,t){var r,n,a,i=t._id,o=e._fullData,l=e._fullLayout,s=[],c=[];function d(e,t){for(r=0;r=r&&(c.extrapad||!o)){l=!1;break}a(t,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(e.splice(s,1),s--)}if(l){var u=i&&0===t;e.push({val:t,pad:u?0:r,extrapad:!u&&o})}}function p(e){return n(e)&&Math.abs(e)=t}t.exports={getAutoRange:l,makePadFn:s,doAutoRange:function(e,t){if(t.setScale(),t.autorange){t.range=l(e,t),t._r=t.range.slice(),t._rl=a.simpleMap(t._r,t.r2l);var r=t._input,n={};n[t._attr+".range"]=t.range,n[t._attr+".autorange"]=t.autorange,o.call("_storeDirectGUIEdit",e.layout,e._fullLayout._preGUI,n),r.range=t.range.slice(),r.autorange=t.autorange}var i=t._anchorAxis;if(i&&i.rangeslider){var s=i.rangeslider[t._name];s&&"auto"===s.rangemode&&(s.range=l(e,t)),i._input.rangeslider[t._name]=a.extendFlat({},s)}},findExtremes:function(e,t,r){r||(r={});e._m||e.setScale();var a,o,l,s,c,d,h,g,v,m=[],y=[],x=t.length,b=r.padded||!1,_=r.tozero&&("linear"===e.type||"-"===e.type),w="log"===e.type,T=!1,k=r.vpadLinearized||!1;function M(e){if(Array.isArray(e))return T=!0,function(t){return Math.max(Number(e[t]||0),0)};var t=Math.max(Number(e||0),0);return function(){return t}}var A=M((e._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),L=M((e._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(g=1/0,v=-1/0,w)for(a=0;a0&&(g=o),o>v&&o-i&&(g=o),o>v&&o=P;a--)D(a);return{min:m,max:y,opts:r}},concatExtremes:c}},{"../../constants/numerical":150,"../../lib":171,"../../registry":257,"fast-isnumeric":11}],215:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../components/titles"),u=e("../../components/color"),f=e("../../components/drawing"),d=e("./layout_attributes"),p=e("./clean_ticks"),h=e("../../constants/numerical"),g=h.ONEMAXYEAR,v=h.ONEAVGYEAR,m=h.ONEMINYEAR,y=h.ONEMAXQUARTER,x=h.ONEAVGQUARTER,b=h.ONEMINQUARTER,_=h.ONEMAXMONTH,w=h.ONEAVGMONTH,T=h.ONEMINMONTH,k=h.ONEWEEK,M=h.ONEDAY,A=M/2,L=h.ONEHOUR,S=h.ONEMIN,C=h.ONESEC,O=h.MINUS_SIGN,D=h.BADNUM,P=e("../../constants/alignment"),z=P.MID_SHIFT,E=P.CAP_SHIFT,R=P.LINE_SPACING,I=P.OPPOSITE_SIDE,F=t.exports={};F.setConvert=e("./set_convert");var N=e("./axis_autotype"),H=e("./axis_ids");F.id2name=H.id2name,F.name2id=H.name2id,F.cleanId=H.cleanId,F.list=H.list,F.listIds=H.listIds,F.getFromId=H.getFromId,F.getFromTrace=H.getFromTrace;var B=e("./autorange");F.getAutoRange=B.getAutoRange,F.findExtremes=B.findExtremes;function j(e){var t=1e-4*(e[1]-e[0]);return[e[0]-t,e[1]+t]}F.coerceRef=function(e,t,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||i),i||(i=a),u[c]={valType:"enumerated",values:s.concat(i?[i]:[]),dflt:a},l.coerce(e,t,u,c)},F.coercePosition=function(e,t,r,n,a,i){var o,s;if("paper"===n||"pixel"===n)o=l.ensureNumber,s=r(a,i);else{var c=F.getFromId(t,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}e[a]=o(s)},F.cleanPosition=function(e,t,r){return("paper"===r||"pixel"===r?l.ensureNumber:F.getFromId(t,r).cleanPos)(e)},F.redrawComponents=function(e,t){t=t||F.listIds(e);var r=e._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-e._forceTick0)/e._minDtick%1+1.000001)%1>2e-6)&&(e._minDtick=0)):e._minDtick=0},F.saveRangeInitial=function(e,t){for(var r=F.list(e,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;e+=e+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?e=F.tickIncrement(e,"M6","reverse")+1.5*M:i.exactMonths>.8?e=F.tickIncrement(e,"M1","reverse")+15.5*M:e-=A;var s=F.tickIncrement(e,r);if(s<=n)return s}return e}(y,e,m,c,i)),v=y,0;v<=u;)v=F.tickIncrement(v,m,!1,i);return{start:t.c2r(y,0,i),end:t.c2r(v,0,i),size:m,_dataSpan:u-c}},F.prepTicks=function(e,t){var r=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if("auto"===e.tickmode||!e.dtick){var n,a=e.nticks;a||("category"===e.type||"multicategory"===e.type?(n=e.tickfont?1.2*(e.tickfont.size||12):15,a=e._length/n):(n="y"===e._id.charAt(0)?40:80,a=l.constrain(e._length/n,4,9)+1),"radialaxis"===e._name&&(a*=2)),"array"===e.tickmode&&(a*=100),e._roughDTick=(Math.abs(r[1]-r[0])-(e._lBreaks||0))/a,F.autoTicks(e,e._roughDTick),e._minDtick>0&&e.dtick<2*e._minDtick&&(e.dtick=e._minDtick,e.tick0=e.l2r(e._forceTick0))}e.tick0||(e.tick0="date"===e.type?"2000-01-01":0),"date"===e.type&&e.dtick<.1&&(e.dtick=.1),K(e)},F.calcTicks=function(e,t){F.prepTicks(e,t);var r=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if("array"===e.tickmode)return function(e){var t=e.tickvals,r=e.ticktext,n=new Array(t.length),a=j(l.simpleMap(e.range,e.r2l)),i=Math.min(a[0],a[1]),o=Math.max(a[0],a[1]),s=0;Array.isArray(r)||(r=[]);var c="category"===e.type?e.d2l_noadd:e.d2l;"log"===e.type&&"L"!==String(e.dtick).charAt(0)&&(e.dtick="L"+Math.pow(10,Math.floor(Math.min(e.range[0],e.range[1]))-1));for(var u=0;ui&&f=o:n<=o)&&!(c.length>r||n===t);n=F.tickIncrement(n,e.dtick,s,e.calendar)){t=n;var a=!1;u&&n!==(0|n)&&(a=!0),c.push({minor:a,value:n})}}();var f="period"===e.ticklabelmode;if(f&&c.unshift({minor:!1,value:F.tickIncrement(c[0].value,e.dtick,!s,e.caldendar)}),e.rangebreaks){var d=c.length;if(d){var p=0;"auto"===e.tickmode&&(p=("y"===e._id.charAt(0)?2:6)*(e.tickfont?e.tickfont.size:12));for(var h,S=[],C=s?1:-1,O=s?d-1:0,P=s?0:d-1;C*P<=C*O;P+=C){var z=c[P];if(e.maskBreaks(z.value)!==D||(z.value=me(z.value,e),!e._rl||e._rl[0]!==z.value&&e._rl[1]!==z.value)){var E=e.c2p(z.value);E===h?S[S.length-1].valuep)&&(h=E,S.push(z))}}c=S.reverse()}}ve(e)&&360===Math.abs(r[1]-r[0])&&c.pop(),e._tmax=(c[c.length-1]||{}).value,e._prevDateHead="",e._inCalcTicks=!0;var R,I=Math.min(r[0],r[1]),N=Math.max(r[0],r[1]),H=F.getTickFormat(e);f&&H&&(/%[fLQsSMX]/.test(H)||(/%[HI]/.test(H)?R=L:/%p/.test(H)?R=A:/%[Aadejuwx]/.test(H)?R=M:/%[UVW]/.test(H)?R=k:/%[Bbm]/.test(H)?R=w:/%[q]/.test(H)?R=x:/%[Yy]/.test(H)&&(R=v)));var B,U,V=[];for(B=0;B0?(W=B-1,Q=B):(W=B,Q=B);var J=V[W].x,$=V[Q].x,K=Math.abs($-J),te=R||K,re=0;if(te>=m?re=K>=m&&K<=g?K:v:R===x&&te>=b?re=K>=b&&K<=y?K:x:te>=T?re=K>=T&&K<=_?K:w:R===k&&te>=k?re=k:te>=M?re=M:R===A&&te>=A?re=A:R===L&&te>=L&&(re=L),re&&e.rangebreaks){for(var ne=0,ae=0,ie=0;ie<42;ie++){var oe=ie/42;e.maskBreaks(J*(1-oe)+$*oe)!==D&&(oe<.5?ne++:ae++)}ae&&(re*=(ne+ae)/42)}re<=K&&(X+=re/2),V[B].periodX=X,(X>N||X=I){e._prevDateHead="",V[B].text=F.tickText(e,V[B].x).text;break}}return e._inCalcTicks=!1,V};var G=[2,5,10],Z=[1,2,3,6,12],Y=[1,2,5,10,15,30],X=[1,2,3,7,14],W=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],Q=[-.301,0,.301,.699,1],J=[15,30,45,90,180];function $(e,t,r){return t*l.roundUp(e/t,r)}function K(e){var t=e.dtick;if(e._tickexponent=0,a(t)||"string"==typeof t||(t=1),"category"!==e.type&&"multicategory"!==e.type||(e._tickround=null),"date"===e.type){var r=e.r2l(e.tick0),n=e.l2r(r).replace(/(^-|i)/g,""),i=n.length;if("M"===String(t).charAt(0))i>10||"01-01"!==n.substr(5)?e._tickround="d":e._tickround=+t.substr(1)%12==0?"y":"m";else if(t>=M&&i<=10||t>=15*M)e._tickround="d";else if(t>=S&&i<=16||t>=L)e._tickround="M";else if(t>=C&&i<=19||t>=S)e._tickround="S";else{var o=e.l2r(r+t).replace(/^-/,"").length;e._tickround=Math.max(i,o)-20,e._tickround<0&&(e._tickround=4)}}else if(a(t)||"L"===t.charAt(0)){var l=e.range.map(e.r2d||Number);a(t)||(t=Number(t.substr(1))),e._tickround=2-Math.floor(Math.log(t)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(c)>3&&(re(e.exponentformat)&&!ne(c)?e._tickexponent=3*Math.round((c-1)/3):e._tickexponent=c)}else e._tickround=null}function ee(e,t,r){var n=e.tickfont||{};return{x:t,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}F.autoTicks=function(e,t){var r;function n(e){return Math.pow(e,Math.floor(Math.log(t)/Math.LN10))}if("date"===e.type){e.tick0=l.dateTick0(e.calendar);var i=2*t;if(i>v)t/=v,r=n(10),e.dtick="M"+12*$(t,r,G);else if(i>w)t/=w,e.dtick="M"+$(t,1,Z);else if(i>M){e.dtick=$(t,M,e._hasDayOfWeekBreaks?[1,2,7,14]:X),e.tick0=l.dateTick0(e.calendar,!0);var o=F.getTickFormat(e);if(/%[uVW]/.test(o)){var s=e.tick0.length,c=+e.tick0[s-1];e.tick0=e.tick0.substring(0,s-2)+String(c+1)}}else i>L?e.dtick=$(t,L,Z):i>S?e.dtick=$(t,S,Y):i>C?e.dtick=$(t,C,Y):(r=n(10),e.dtick=$(t,r,G))}else if("log"===e.type){e.tick0=0;var u=l.simpleMap(e.range,e.r2l);if(t>.7)e.dtick=Math.ceil(t);else if(Math.abs(u[1]-u[0])<1){var f=1.5*Math.abs((u[1]-u[0])/t);t=Math.abs(Math.pow(10,u[1])-Math.pow(10,u[0]))/f,r=n(10),e.dtick="L"+$(t,r,G)}else e.dtick=t>.3?"D2":"D1"}else"category"===e.type||"multicategory"===e.type?(e.tick0=0,e.dtick=Math.ceil(Math.max(t,1))):ve(e)?(e.tick0=0,r=1,e.dtick=$(t,r,J)):(e.tick0=0,r=n(10),e.dtick=$(t,r,G));if(0===e.dtick&&(e.dtick=1),!a(e.dtick)&&"string"!=typeof e.dtick){var d=e.dtick;throw e.dtick=1,"ax.dtick error: "+String(d)}},F.tickIncrement=function(e,t,r,i){var o=r?-1:1;if(a(t))return l.increment(e,o*t);var s=t.charAt(0),c=o*Number(t.substr(1));if("M"===s)return l.incrementMonth(e,c,i);if("L"===s)return Math.log(Math.pow(10,e)+c)/Math.LN10;if("D"===s){var u="D2"===t?Q:W,f=e+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(t)},F.tickFirst=function(e,t){var r=e.r2l||Number,i=l.simpleMap(e.range,r,void 0,void 0,t),o=i[1]"+s,e._prevDateHead=s));t.text=c}(e,o,r,c):"log"===u?function(e,t,r,n,i){var o=e.dtick,s=t.x,c=e.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)t.text=ae(Math.pow(10,s),e,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=e.exponentformat;"power"===p||re(p)&&ne(f)?(t.text=0===f?1:1===f?"10":"10"+(f>1?"":O)+d+"",t.fontSize*=1.25):("e"===p||"E"===p)&&d>2?t.text="1"+p+(f>0?"+":O)+d:(t.text=ae(Math.pow(10,s),e,"","fakehover"),"D1"===o&&"y"===e._id.charAt(0)&&(t.dy-=t.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);t.text=String(Math.round(Math.pow(10,l.mod(s,1)))),t.fontSize*=.75}if("D1"===e.dtick){var h=String(t.text).charAt(0);"0"!==h&&"1"!==h||("y"===e._id.charAt(0)?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(s<0?.5:.25)))}}(e,o,0,c,g):"category"===u?function(e,t){var r=e._categories[Math.round(t.x)];void 0===r&&(r="");t.text=String(r)}(e,o):"multicategory"===u?function(e,t,r){var n=Math.round(t.x),a=e._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?t.text=o+" - "+i:(t.text=i,t.text2=o)}(e,o,r):ve(e)?function(e,t,r,n,a){if("radians"!==e.thetaunit||r)t.text=ae(t.x,e,a,n);else{var i=t.x/180;if(0===i)t.text="0";else{var o=function(e){function t(e,t){return Math.abs(e-t)<=1e-6}var r=function(e){for(var r=1;!t(Math.round(e*r)/r,e);)r*=10;return r}(e),n=e*r,a=Math.abs(function e(r,n){return t(n,0)?r:e(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)t.text=ae(l.deg2rad(t.x),e,a,n);else{var s=t.x<0;1===o[1]?1===o[0]?t.text="\u03c0":t.text=o[0]+"\u03c0":t.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(t.text=O+t.text)}}}}(e,o,r,c,g):function(e,t,r,n,a){"never"===a?a="":"all"===e.showexponent&&Math.abs(t.x/e.dtick)<1e-6&&(a="hide");t.text=ae(t.x,e,a,n)}(e,o,0,c,g),n||(e.tickprefix&&!h(e.showtickprefix)&&(o.text=e.tickprefix+o.text),e.ticksuffix&&!h(e.showticksuffix)&&(o.text+=e.ticksuffix)),"boundaries"===e.tickson||e.showdividers){var v=function(t){var r=e.l2p(t);return r>=0&&r<=e._length?t:null};o.xbnd=[v(o.x-.5),v(o.x+e.dtick-.5)]}return o},F.hoverLabelText=function(e,t,r){if(r!==D&&r!==t)return F.hoverLabelText(e,t)+" - "+F.hoverLabelText(e,r);var n="log"===e.type&&t<=0,a=F.tickText(e,e.c2l(n?-t:t),"hover").text;return n?0===t?"0":O+a:a};var te=["f","p","n","\u03bc","m","","k","M","G","T"];function re(e){return"SI"===e||"B"===e}function ne(e){return e>14||e<-15}function ae(e,t,r,n){var i=e<0,o=t._tickround,s=r||t.exponentformat||"B",c=t._tickexponent,u=F.getTickFormat(t),f=t.separatethousands;if(n){var d={exponentformat:s,dtick:"none"===t.showexponent?t.dtick:a(e)&&Math.abs(e)||1,range:"none"===t.showexponent?t.range.map(t.r2d):[0,e||1]};K(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,t.hoverformat&&(u=t.hoverformat)}if(u)return t._numFormat(u)(e).replace(/-/g,O);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(e=Math.abs(e))"+p+"":"B"===s&&9===c?e+="B":re(s)&&(e+=te[c/3+5]));return i?O+e:e}function ie(e,t){for(var r=[],n={},a=0;a1&&r=a.min&&e=0,i=u(e,t[1])<=0;return(r||a)&&(n||i)}if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":for(t=0;t=o(a)))){r=n;break}break;case"log":for(t=0;t0?r.bottom-u:0,f)))),t.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=t._depth:(n[s]=t._depth=Math.max(r.width>0?u-r.top:0,f),p.reverse()),r.width>0){var v=r.right-(t._offset+t._length);v>0&&(n.xr=1,n.r=v);var m=t._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=t._depth=Math.max(r.height>0?u-r.left:0,f):(n[s]=t._depth=Math.max(r.height>0?r.right-u:0,f),p.reverse()),r.height>0){var y=r.bottom-(t._offset+t._length);y>0&&(n.yb=0,n.b=y);var x=t._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===t.anchor?t.position:t._anchorAxis.domain[p[0]],t.title.text!==d._dfltTitle[h]&&(n[s]+=le(t)+(t.title.standoff||0)),t.mirror&&"free"!==t.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[c]=t.linewidth,t.mirror&&!0!==t.mirror&&(a[c]+=f),!0===t.mirror||"ticks"===t.mirror?a[g]=t._anchorAxis.domain[p[1]]:"all"!==t.mirror&&"allticks"!==t.mirror||(a[g]=[t._counterDomainMin,t._counterDomainMax][p[1]]))}W&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(e,t)),i.autoMargin(e,ue(t),n),i.autoMargin(e,fe(t),a),i.autoMargin(e,de(t),l)})),r.skipTitle||W&&"bottom"===t.side||Y.push((function(){return function(e,t){var r,n=e._fullLayout,a=t._id,i=a.charAt(0),o=t.title.font.size;if(t.title.hasOwnProperty("standoff"))r=t._depth+t.title.standoff+le(t);else{if("multicategory"===t.type)r=t._depth;else{r=10+1.5*o+(t.linewidth?t.linewidth-1:0)}r+="x"===i?"top"===t.side?o*(t.showticklabels?1:0):o*(t.showticklabels?1.5:.5):"right"===t.side?o*(t.showticklabels?1:.5):o*(t.showticklabels?.5:0)}var l,s,u,d,p=F.getPxPosition(e,t);"x"===i?(s=t._offset+t._length/2,u="top"===t.side?p-r:p+r):(u=t._offset+t._length/2,s="right"===t.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==t.type){var h=t._selections[t._id+"tick"];if(d={selection:h,side:t.side},h&&h.node()&&h.node().parentNode){var g=f.getTranslate(h.node().parentNode);d.offsetLeft=g.x,d.offsetTop=g.y}t.title.hasOwnProperty("standoff")&&(d.pad=0)}return c.draw(e,a+"title",{propContainer:t,propName:t._name+".title.text",placeholder:n._dfltTitle[i],avoid:d,transform:l,attributes:{x:s,y:u,"text-anchor":"middle"}})}(e,t)})),l.syncOrAsync(Y)}}function Q(e){var r=p+(e||"tick");return w[r]||(w[r]=function(e,t){var r,n,a,i;e._selections[t].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,e._selections[t].each((function(){var e=ce(this),t=f.bBox(e.node().parentNode);r=Math.min(r,t.top),n=Math.max(n,t.bottom),a=Math.min(a,t.left),i=Math.max(i,t.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(t,r)),w[r]}},F.getTickSigns=function(e){var t=e._id.charAt(0),r={x:"top",y:"right"}[t],n=e.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==e.ticks==("x"===t)&&(a=a.map((function(e){return-e}))),e.side&&a.push({l:-1,t:-1,r:1,b:1}[e.side.charAt(0)]),a},F.makeTransFn=function(e){var t=e._id.charAt(0),r=e._offset;return"x"===t?function(t){return"translate("+(r+e.l2p(t.x))+",0)"}:function(t){return"translate(0,"+(r+e.l2p(t.x))+")"}},F.makeTransPeriodFn=function(e){var t=e._id.charAt(0),r=e._offset;return"x"===t?function(t){return"translate("+(r+e.l2p(t.periodX))+",0)"}:function(t){return"translate(0,"+(r+e.l2p(t.periodX))+")"}},F.makeTickPath=function(e,t,r,n){n=void 0!==n?n:e.ticklen;var a=e._id.charAt(0),i=(e.linewidth||1)/2;return"x"===a?"M0,"+(t+i*r)+"v"+n*r:"M"+(t+i*r)+",0h"+n*r},F.makeLabelFns=function(e,t,r){var n=e._id.charAt(0),i="boundaries"!==e.tickson&&"outside"===e.ticks,o=0,s=0;if(i&&(o+=e.ticklen),r&&"outside"===e.ticks){var c=l.deg2rad(r);o=e.ticklen*Math.cos(c)+1,s=e.ticklen*Math.sin(c)}e.showticklabels&&(i||e.showline)&&(o+=.2*e.tickfont.size);var u,f,d,p,h={labelStandoff:o+=(e.linewidth||1)/2,labelShift:s};return"x"===n?(p="bottom"===e.side?1:-1,u=s*p,f=t+o*p,d="bottom"===e.side?1:-.2,h.xFn=function(e){return e.dx+u},h.yFn=function(e){return e.dy+f+e.fontSize*d},h.anchorFn=function(e,t){return a(t)&&0!==t&&180!==t?t*p<0?"end":"start":"middle"},h.heightFn=function(t,r,n){return r<-60||r>60?-.5*n:"top"===e.side?-n:0}):"y"===n&&(p="right"===e.side?1:-1,u=o,f=-s*p,d=90===Math.abs(e.tickangle)?.5:0,h.xFn=function(e){return e.dx+t+(u+e.fontSize*d)*p},h.yFn=function(e){return e.dy+f+e.fontSize*z},h.anchorFn=function(t,r){return a(r)&&90===Math.abs(r)?"middle":"right"===e.side?"start":"end"},h.heightFn=function(t,r,n){return(r*="left"===e.side?1:-1)<-30?-n:r<30?-.5*n:0}),h},F.drawTicks=function(e,t,r){r=r||{};var n=t._id+"tick",a=r.vals;"period"===t.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(t.ticks?a:[],oe);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(u.stroke,t.tickcolor).style("stroke-width",f.crispRound(e,t.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},F.drawGrid=function(e,t,r){r=r||{};var n=t._id+"grid",a=r.vals,i=r.counterAxis;if(!1===t.showgrid)a=[];else if(i&&F.shouldShowZeroLine(e,t,i))for(var o="array"===t.tickmode,l=0;l1)for(n=1;n2*o}(e,t)?"date":function(e){for(var t=Math.max(1,(e.length-1)/1e3),r=0,n=0,o={},l=0;l2*r}(e)?"category":function(e){if(!e)return!1;for(var t=0;t=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(t.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(t.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(t.enabled=!1);t.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(t.enabled=!1);if((c=+c)<0||c>24)return void(t.enabled=!1);t.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(t.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(e.substr(1)||1)-+(t.substr(1)||1)},r.getAxisGroup=function(e,t){for(var r=e._axisMatchGroups,n=0;n0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=t.categoryorder="trace"),"trace"===s?t._initialCategories=[]:"array"===s?t._initialCategories=l.slice():(l=function(e,t){var r,n,a,i=t.dataAttr||e._id.charAt(0),o={};if(t.axData)r=t.axData;else for(r=[],n=0;ns*x)||T)for(r=0;rz&&ID&&(D=I);p/=(D-O)/(2*P),O=c.l2r(O),D=c.l2r(D),c.range=c._input.range=L=0?Math.min(e,.9):1/(1/Math.max(e,-.3)+3.222))}function F(e,t,r,n,a){return e.append("path").attr("class","zoombox").style({fill:t>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function N(e,t,r){return e.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+t+", "+r+")").attr("d","M0,0Z")}function H(e,t,r,n,a,i){e.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),B(e,t,a,i)}function B(e,t,r,n){r||(e.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),t.transition().style("opacity",1).duration(200))}function j(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function U(e){O&&e.data&&e._context.showTips&&(l.notifier(l._(e,"Double-click to zoom back out"),"long"),O=!1)}function V(e){var t=Math.floor(Math.min(e.b-e.t,e.r-e.l,C)/2);return"M"+(e.l-3.5)+","+(e.t-.5+t)+"h3v"+-t+"h"+t+"v-3h-"+(t+3)+"ZM"+(e.r+3.5)+","+(e.t-.5+t)+"h-3v"+-t+"h"+-t+"v-3h"+(t+3)+"ZM"+(e.r+3.5)+","+(e.b+.5-t)+"h-3v"+t+"h"+-t+"v3h"+(t+3)+"ZM"+(e.l-3.5)+","+(e.b+.5-t)+"h3v"+t+"h"+t+"v3h-"+(t+3)+"Z"}function q(e,t,r,n){for(var a,i,o,s,c=!1,u={},f={},d=0;d=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(j(a),2!==e||he||je(),pe)i.indexOf("select")>-1&&M(r,a,W,Q,t.id,Se),i.indexOf("event")>-1&&f.click(a,r,t.id);else if(1===e&&he){var l=g?B:D,c="s"===g||"w"===O?0:1,u=l._name+".range["+c+"]",d=function(e,t){var r,a=e.range[t],i=Math.abs(a-e.range[1-t]);return"date"===e.type?a:"log"===e.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,c),p="left",h="middle";if(l.fixedrange)return;g?(h="n"===g?"top":"bottom","right"===l.side&&(p="right")):"e"===O&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(me).call(s.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(d),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:h}).on("edit",(function(e){var t=l.d2r(e);void 0!==t&&o.call("_guiRelayout",a,u,t)}))}}}function De(t,r){if(e._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,t+ye)),a=Math.max(0,Math.min(ee,r+xe)),i=Math.abs(n-ye),o=Math.abs(a-xe);function l(){ke="",be.r=be.l,be.t=be.b,Ae.attr("d","M0,0Z")}if(be.l=Math.min(ye,n),be.r=Math.max(ye,n),be.t=Math.min(xe,a),be.b=Math.max(xe,a),te.isSubplotConstrained)i>C||o>C?(ke="xy",i/K>o/ee?(o=i*ee/K,xe>a?be.t=xe-o:be.b=xe+o):(i=o*K/ee,ye>n?be.l=ye-i:be.r=ye+i),Ae.attr("d",V(be))):l();else if(re.isSubplotConstrained)if(i>C||o>C){ke="xy";var s=Math.min(be.l/K,(ee-be.b)/ee),c=Math.max(be.r/K,(ee-be.t)/ee);be.l=s*K,be.r=c*K,be.b=(1-s)*ee,be.t=(1-c)*ee,Ae.attr("d",V(be))}else l();else!ae||og[1]-1/4096&&(t.domain=l),a.noneOrAll(e.domain,t.domain,l)}return r("layer"),t}},{"../../lib":171,"fast-isnumeric":11}],233:[function(e,t,r){"use strict";var n=e("../../constants/alignment").FROM_BL;t.exports=function(e,t,r){void 0===r&&(r=n[e.constraintoward||"center"]);var a=[e.r2l(e.range[0]),e.r2l(e.range[1])],i=a[0]+(a[1]-a[0])*r;e.range=e._input.range=[e.l2r(i+(a[0]-i)*t),e.l2r(i+(a[1]-i)*t)]}},{"../../constants/alignment":147}],234:[function(e,t,r){"use strict";var n=e("polybooljs"),a=e("../../registry"),i=e("../../components/drawing").dashStyle,o=e("../../components/color"),l=e("../../components/fx"),s=e("../../components/fx/helpers").makeEventData,c=e("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=e("../../components/shapes/draw_newshape/display_outlines"),v=e("../../components/shapes/draw_newshape/helpers").handleEllipse,m=e("../../components/shapes/draw_newshape/newshapes"),y=e("../../lib"),x=e("../../lib/polygon"),b=e("../../lib/throttle"),_=e("./axis_ids").getFromId,w=e("../../lib/clear_gl_canvases"),T=e("../../plot_api/subroutines").redrawReglTraces,k=e("./constants"),M=k.MINSELECT,A=x.filter,L=x.tester,S=e("./handle_outline").clearSelect,C=e("./helpers"),O=C.p2r,D=C.axValue,P=C.getTransform;function z(e,t,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=t._hoverdata,x=t._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(e){return e&&Array.isArray(e)&&!0!==e[0].hoverOnBox}(y)){F(e,t,i);var _=function(e,t){var r,n,a=e[0],i=-1,o=[];for(n=0;n0?function(e,t){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===t.searchInfo&&(n=t.searchInfo.cd[0].trace).selectedpoints.length===t.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=B(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(t)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,e);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=e.selectionDefs=[],r.selection.mergedPolygons=e.mergedPolygons=[]}function H(e,t,r,n){var a,i,o,l=[],s=t.map((function(e){return e._id})),c=r.map((function(e){return e._id}));for(o=0;o0?n[0]:r;return!!t.selectedpoints&&t.selectedpoints.indexOf(a)>-1}function j(e,t,r){var n,i,o,l;for(n=0;n=0)Y._fullLayout._deactivateShape(Y);else if(!B){var r=X.clickmode;b.done(de).then((function(){if(b.clear(de),2===e){for(se.remove(),w=0;w-1&&z(t,Y,a.xaxes,a.yaxes,a.subplot,a,se),"event"===r&&Y.emit("plotly_selected",void 0);l.click(Y,t)})).catch(y.error)}},a.doneFn=function(){fe.remove(),b.done(de).then((function(){b.clear(de),a.gd.emit("plotly_selected",S),_&&a.selectionDefs&&(_.subtract=le,a.selectionDefs.push(_),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,x)),a.doneFnCompleted&&a.doneFnCompleted(pe)})).catch(y.error),B&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:z}},{"../../components/color":45,"../../components/dragelement/helpers":63,"../../components/drawing":67,"../../components/fx":85,"../../components/fx/helpers":81,"../../components/shapes/draw_newshape/display_outlines":130,"../../components/shapes/draw_newshape/helpers":131,"../../components/shapes/draw_newshape/newshapes":132,"../../lib":171,"../../lib/clear_gl_canvases":159,"../../lib/polygon":183,"../../lib/throttle":193,"../../plot_api/subroutines":206,"../../registry":257,"./axis_ids":218,"./constants":221,"./handle_outline":225,"./helpers":226,polybooljs:19}],235:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../../lib"),l=o.cleanNumber,s=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,d=e("../../constants/numerical"),p=d.FP_SAFE,h=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,x=d.ONEMIN,b=d.ONESEC,_=e("./axis_ids"),w=e("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function M(e){return Math.pow(10,e)}function A(e){return null!=e}t.exports=function(e,t){t=t||{};var r=e._id||"x",d=r.charAt(0);function L(t,r){if(t>0)return Math.log(t)/Math.LN10;if(t<=0&&r&&e.range&&2===e.range.length){var n=e.range[0],a=e.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return h}function S(t,r,n,a){if((a||{}).msUTC&&i(t))return+t;var l=c(t,n||e.calendar);if(l===h){if(!i(t))return h;t=+t;var s=Math.floor(10*o.mod(t+.05,1)),u=Math.round(t-s/10);l=c(new Date(u))+s/10}return l}function C(t,r,n){return s(t,r,n||e.calendar)}function O(t){return e._categories[Math.round(t)]}function D(t){if(A(t)){if(void 0===e._categoriesMap&&(e._categoriesMap={}),void 0!==e._categoriesMap[t])return e._categoriesMap[t];e._categories.push("number"==typeof t?String(t):t);var r=e._categories.length-1;return e._categoriesMap[t]=r,r}return h}function P(t){if(e._categoriesMap)return e._categoriesMap[t]}function z(e){var t=P(e);return void 0!==t?t:i(e)?+e:void 0}function E(e,t,r){return n.round(r+t*e,2)}function R(e,t,r){return(e-r)/t}var I=function(t){return i(t)?E(t,e._m,e._b):h},F=function(t){return R(t,e._m,e._b)};if(e.rangebreaks){var N="y"===d;I=function(t){if(!i(t))return h;var r=e._rangebreaks.length;if(!r)return E(t,e._m,e._b);var n=N;e.range[0]>e.range[1]&&(n=!n);for(var a=n?-1:1,o=a*t,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=e._B[l]||0;return isFinite(f)?E(t,e._m2,f):0},F=function(t){var r=e._rangebreaks.length;if(!r)return R(t,e._m,e._b);for(var n=0,a=0;ae._rangebreaks[a].pmax&&(n=a+1);return R(t,e._m2,e._B[n])}}e.c2l="log"===e.type?L:u,e.l2c="log"===e.type?M:u,e.l2p=I,e.p2l=F,e.c2p="log"===e.type?function(e,t){return I(L(e,t))}:I,e.p2c="log"===e.type?function(e){return M(F(e))}:F,-1!==["linear","-"].indexOf(e.type)?(e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=l,e.c2d=e.c2r=e.l2d=e.l2r=u,e.d2p=e.r2p=function(t){return e.l2p(l(t))},e.p2d=e.p2r=F,e.cleanPos=u):"log"===e.type?(e.d2r=e.d2l=function(e,t){return L(l(e),t)},e.r2d=e.r2c=function(e){return M(l(e))},e.d2c=e.r2l=l,e.c2d=e.l2r=u,e.c2r=L,e.l2d=M,e.d2p=function(t,r){return e.l2p(e.d2r(t,r))},e.p2d=function(e){return M(F(e))},e.r2p=function(t){return e.l2p(l(t))},e.p2r=F,e.cleanPos=u):"date"===e.type?(e.d2r=e.r2d=o.identity,e.d2c=e.r2c=e.d2l=e.r2l=S,e.c2d=e.c2r=e.l2d=e.l2r=C,e.d2p=e.r2p=function(t,r,n){return e.l2p(S(t,0,n))},e.p2d=e.p2r=function(e,t,r){return C(F(e),t,r)},e.cleanPos=function(t){return o.cleanDate(t,h,e.calendar)}):"category"===e.type?(e.d2c=e.d2l=D,e.r2d=e.c2d=e.l2d=O,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.l2r=e.c2r=u,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return O(F(e))},e.r2p=e.d2p,e.p2r=F,e.cleanPos=function(e){return"string"==typeof e&&""!==e?e:u(e)}):"multicategory"===e.type&&(e.r2d=e.c2d=e.l2d=O,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.r2c_just_indices=P,e.l2r=e.c2r=u,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return O(F(e))},e.r2p=e.d2p,e.p2r=F,e.cleanPos=function(e){return Array.isArray(e)||"string"==typeof e&&""!==e?e:u(e)},e.setupMultiCategory=function(n){var a,i,l=e._traceIndices,s=t._axisMatchGroups;if(s&&s.length&&0===e._categories.length)for(a=0;ap&&(l[n]=p),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else o.nestedProperty(e,t).set(a)},e.setScale=function(r){var n=t._size;if(e.overlaying){var a=_.getFromId({_fullLayout:t},e.overlaying);e.domain=a.domain}var i=r&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var l,s,c=e.r2l(e[i][0],o),u=e.r2l(e[i][1],o),f="y"===d;if((f?(e._offset=n.t+(1-e.domain[1])*n.h,e._length=n.h*(e.domain[1]-e.domain[0]),e._m=e._length/(c-u),e._b=-e._m*u):(e._offset=n.l+e.domain[0]*n.w,e._length=n.w*(e.domain[1]-e.domain[0]),e._m=e._length/(u-c),e._b=-e._m*c),e._rangebreaks=[],e._lBreaks=0,e._m2=0,e._B=[],e.rangebreaks)&&(e._rangebreaks=e.locateBreaks(Math.min(c,u),Math.max(c,u)),e._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&e._rangebreaks.reverse();var h=p?-1:1;for(e._m2=h*e._length/(Math.abs(u-c)-e._lBreaks),e._B.push(-e._m2*(f?u:c)),l=0;la&&(a+=7,ia&&(a+=24,i=n&&i=n&&t=l.min&&(el.max&&(l.max=n),a=!1)}a&&c.push({min:e,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),e.plot.call(o.setTranslate,t._offset,r._offset).call(o.setScale,1,1);var n=e.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,e)}function v(t,r){var n=t.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!t.xr1,d=!!t.yr1,p=[];if(f){var h=i.simpleMap(t.xr0,a.r2l),g=i.simpleMap(t.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(t.yr0,s.r2l),x=i.simpleMap(t.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(e,a,{skipTitle:!0}),l.drawOne(e,s,{skipTitle:!0}),l.redrawComponents(e,[a._id,s._id]);var w=f?c/p[2]:1,T=d?u/p[3]:1,k=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}l.redrawComponents(e)}},{"../../components/drawing":67,"../../lib":171,"../../registry":257,"./axes":215,d3:9}],240:[function(e,t,r){"use strict";var n=e("../../registry").traceIs,a=e("./axis_autotype");function i(e){return{v:"x",h:"y"}[e.orientation||"v"]}function o(e,t){var r=i(e),a=n(e,"box-violin"),o=n(e._fullInput||{},"candlestick");return a&&!o&&t===r&&void 0===e[r]&&void 0===e[r+"0"]}t.exports=function(e,t,r,l){"-"===r("type",(l.splomStash||{}).type)&&(!function(e,t){if("-"!==e.type)return;var r,l=e._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(e,t,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[t])return a;if((a[r+"axis"]||r)===t){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(t,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(e.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,t,l,n+1):t(l,i,o)}}))}r.manageCommandObserver=function(e,t,n,o){var l={},s=!0;t&&t._commandObserver&&(l=t._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(e,n,l.lookupTable);if(t&&t._commandObserver){if(c)return l;if(t._commandObserver.remove)return t._commandObserver.remove(),t._commandObserver=null,l}if(c){i(e,c,l.cache),l.check=function(){if(s){var t=i(e,c,l.cache);return t.changed&&o&&void 0!==l.lookupTable[t.value]&&(l.disable(),Promise.resolve(o({value:t.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[t.value]})).then(l.enable,l.enable)),t.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=t.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=t._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),s=r.select(".js-sourcelinks");e._context.showSources&&e._context.showSources(e),e._context.showLink&&function(e,t){t.text("");var r=t.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(e._context.linkText+" "+String.fromCharCode(187));if(e._context.sendData)r.on("click",(function(){x.sendDataToCloud(e)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(e,o),l.text(o.text()&&s.text()?" - ":"")}},x.sendDataToCloud=function(e){var t=(window.PLOTLYENV||{}).BASE_URL||e._context.plotlyServerURL;if(t){e.emit("plotly_beforeexport");var r=n.select(e).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:t+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(e,!1,"keepdata"),a.node().submit(),r.remove(),e.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(e,t){var r=e._context.locale,n=!1,a={};function i(e){for(var r=!0,i=0;i1&&E.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,s),l=0;l15&&E.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"),x.linkSubplots(d,s,f,i),x.cleanPlot(d,s,f,i);var H=!(!i._has||!i._has("gl2d")),B=!(!s._has||!s._has("gl2d")),j=!(!i._has||!i._has("cartesian"))||H,U=!(!s._has||!s._has("cartesian"))||B;j&&!U?i._bgLayer.remove():U&&!j&&(s._shouldCreateBgLayer=!0),i._zoomlayer&&!e._dragging&&p({_fullLayout:i}),function(e,t){var r,n=[];t.meta&&(r=t._meta={meta:t.meta,layout:{meta:t.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),a=Math.round(f*a)}}var d=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!t.height&&Math.abs(r.height-a)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=a)),e._initialAutoSize||(e._initialAutoSize={width:n,height:a}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(e,t,r,n){var a,i,l,s=o.componentsRegistry,u=t._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in s)(l=s[a]).includeBasePlot&&l.includeBasePlot(e,t);for(var d in u.length||u.push(f),t._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(e,t),f.finalizeSubplots(e,t)),t._subplots)t._subplots[d].sort(c.subplotSort);for(i=0;i.5*n.width&&(c.log("Margin push",t,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(c.log("Margin push",t,"is too big in y, dropping"),r.b=r.t=0);var s=void 0!==r.xl?r.xl:r.x,u=void 0!==r.xr?r.xr:r.x,f=void 0!==r.yt?r.yt:r.y,d=void 0!==r.yb?r.yb:r.y;a[t]={l:{val:s,size:r.l+o},r:{val:u,size:r.r+o},b:{val:d,size:r.b+o},t:{val:f,size:r.t+o}},i[t]=1}else delete a[t],delete i[t];if(!n._replotting)return x.doAutoMargin(e)}},x.doAutoMargin=function(e){var t=e._fullLayout;t._size||(t._size={}),C(t);var r=t._size,n=t.margin,a=c.extendFlat({},r),l=n.l,s=n.r,u=n.t,f=n.b,d=t.width,p=t.height,h=t._pushmargin,g=t._pushmarginIds;if(!1!==t.margin.autoexpand){for(var v in h)g[v]||delete h[v];for(var m in h.base={l:{val:0,size:l},r:{val:1,size:s},t:{val:1,size:u},b:{val:0,size:f}},h){var y=h[m].l||{},b=h[m].b||{},_=y.val,w=y.size,T=b.val,k=b.size;for(var M in h){if(i(w)&&h[M].r){var A=h[M].r.val,L=h[M].r.size;if(A>_){var S=(w*A+(L-d)*_)/(A-_),O=(L*(1-_)+(w-d)*(1-A))/(A-_);S>=0&&O>=0&&d-(S+O)>0&&S+O>l+s&&(l=S,s=O)}}if(i(k)&&h[M].t){var D=h[M].t.val,P=h[M].t.size;if(D>T){var z=(k*D+(P-p)*T)/(D-T),E=(P*(1-T)+(k-p)*(1-D))/(D-T);z>=0&&E>=0&&p-(E+z)>0&&z+E>f+u&&(f=z,u=E)}}}}}if(r.l=Math.round(l),r.r=Math.round(s),r.t=Math.round(u),r.b=Math.round(f),r.p=Math.round(n.pad),r.w=Math.round(d)-r.l-r.r,r.h=Math.round(p)-r.t-r.b,!t._replotting&&x.didMarginChange(a,r)){"_redrawFromAutoMarginCount"in t?t._redrawFromAutoMarginCount++:t._redrawFromAutoMarginCount=1;var R=3*(1+Object.keys(g).length);if(t._redrawFromAutoMarginCount0&&(e._transitioningWithDuration=!0),e._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&e._transitionData._interruptCallbacks.push((function(){return o.call("redraw",e)})),e._transitionData._interruptCallbacks.push((function(){e.emit("plotly_transitioninterrupted",[])}));var i=0,l=0;function s(){return i++,function(){l++,n||l!==i||function(t){if(!e._transitionData)return;(function(e){if(e)for(;e.length;)e.shift()})(e._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",e)})).then((function(){e._transitioning=!1,e._transitioningWithDuration=!1,e.emit("plotly_transitioned",[])})).then(t)}(a)}}r.runFn(s),setTimeout(s())}))}],i=c.syncOrAsync(a,e);return i&&i.then||(i=Promise.resolve()),i.then((function(){return e}))}x.didMarginChange=function(e,t){for(var r=0;r1)return!0}return!1},x.graphJson=function(e,t,r,n,a,i){(a&&t&&!e._fullData||a&&!t&&!e._fullLayout)&&x.supplyDefaults(e);var o=a?e._fullData:e.data,l=a?e._fullLayout:e.layout,s=(e._transitionData||{})._frames;function u(e,t){if("function"==typeof e)return t?"_function_":null;if(c.isPlainObject(e)){var n,a={};return Object.keys(e).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof e[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(e.stream))return}else if("keepall"!==r&&"string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(e[i],t)}else t&&(a[i]="_function")})),a}return Array.isArray(e)?e.map((function(e){return u(e,t)})):c.isTypedArray(e)?c.simpleMap(e,c.identity):c.isJSDate(e)?c.ms2DateTimeLocal(+e):e}var f={data:(o||[]).map((function(e){var r=u(e);return t&&delete r.fit,r}))};return t||(f.layout=u(l)),e.framework&&e.framework.isPolar&&(f=e.framework.getConfig()),s&&(f.frames=u(s)),i&&(f.config=u(e._context,!0)),"object"===n?f:JSON.stringify(f)},x.modifyFrames=function(e,t){var r,n,a,i=e._transitionData._frames,o=e._transitionData._frameHash;for(r=0;r=0;i--)if(l[i].enabled){r._indexToPoints=l[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(e,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,h[t]=o}}for(z(s,u,p),a=0;a=0?d.angularAxis.domain:n.extent(T),S=Math.abs(T[1]-T[0]);M&&!k&&(S=0);var C=L.slice();A&&k&&(C[1]+=S);var O=d.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),d.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var D=d.angularAxis.ticksStep||(C[1]-C[0])/(O*(d.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),C[2]||(C[2]=D);var P=n.range.apply(this,C);if(P=P.map((function(e,t){return parseFloat(e.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(e=n.select(this).select("svg.chart-root"))||e.empty()){var z=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),E=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=n.select(E)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var R,I=e.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(e,t){return" "+e+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){R=e.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var H=p.map((function(e,t){var r=o.util.cloneJson(e);return r.symbol="DotPlot"===e.geometry?e.dotType||"circle":"LinePlot"!=e.geometry?"square":"line",r.visibleInLegend="undefined"==typeof e.visibleInLegend||e.visibleInLegend,r.color="LinePlot"===e.geometry?e.strokeColor:e.color,r}));o.Legend().config({data:p.map((function(e,t){return e.name||"Element"+t})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:R,elements:H,reverseOrder:d.legend.reverseOrder})})();var B=R.node().getBBox();x=Math.min(d.width-B.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),R.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else R=e.select(".legend-group").style({display:"none"});e.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),I.attr("transform","translate("+_+")").style({cursor:"crosshair"});var j=[(d.width-(d.margin.left+d.margin.right+2*x+(B?B.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),e.select(".outer-group").attr("transform","translate("+j+")"),d.title&&d.title.text){var U=e.select("g.title-group text").style(N).text(d.title.text),V=U.node().getBBox();U.attr({x:_[0]-V.width/2,y:_[1]-x-20})}var q=e.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function Y(e,t){return l(e)%360+d.orientation}if(d.radialAxis.visible){var X=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(X).attr({transform:"rotate("+d.radialAxis.orientation+")"}),q.selectAll(".domain").style(F),q.selectAll("g>text").text((function(e,t){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(e,t){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(e,t){return"rotate("+Y(e)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",(function(e,t){return t%(d.minorTicks+1)==0})).classed("minor",(function(e,t){return!(t%(d.minorTicks+1)==0)})).style(F),Q.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var J=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(e,t){var r=Y(e),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(e,t){return t%(d.minorTicks+1)!=0?"":w?w[e]+d.angularAxis.ticksSuffix:e+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&J.text((function(e,t){return t%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,t)}));var $=n.max(I.selectAll(".angular-tick text")[0].map((function(e,t){return e.getCTM().e+e.getBBox().width})));R.attr({transform:"translate("+[x+$,d.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,ee=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(ee.enter().append("g").attr({class:function(e,t){return"geometry geometry"+t}}),ee.exit().remove(),p[0]||K){var te=[];p.forEach((function(e,t){var n={};n.radialScale=r,n.angularScale=l,n.container=ee.filter((function(e,r){return r==t})),n.geometry=e.geometry,n.orientation=d.orientation,n.direction=d.direction,n.index=t,te.push({data:e,geometryConfig:n})}));var re=n.nest().key((function(e,t){return"undefined"!=typeof e.data.groupId||"unstacked"})).entries(te),ne=[];re.forEach((function(e,t){"unstacked"===e.key?ne=ne.concat(e.values.map((function(e,t){return[e]}))):ne.push(e.values)})),ne.forEach((function(e,t){var r;r=Array.isArray(e)?e[0].geometryConfig.geometry:e.geometryConfig.geometry;var n=e.map((function(e,t){return a(o[r].defaultConfig(),e)}));o[r]().config(n)()}))}var ae,ie,oe=e.select(".guides-group"),le=e.select(".tooltips-group"),se=o.tooltipPanel().config({container:le,fontSize:8})(),ce=o.tooltipPanel().config({container:le,fontSize:8})(),ue=o.tooltipPanel().config({container:le,hasTick:!0})();if(!k){var fe=oe.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});I.on("mousemove.angular-guide",(function(e,t){var r=o.util.getMousePos(Z).angle;fe.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;ae=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);se.text(o.util.round(ae)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(e,t){oe.select("line").style({opacity:0})}))}var de=oe.select("circle").style({stroke:"grey",fill:"none"});I.on("mousemove.radial-guide",(function(e,t){var n=o.util.getMousePos(Z).radius;de.attr({r:n}).style({opacity:.5}),ie=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ce.text(o.util.round(ie)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(e,t){de.style({opacity:0}),ue.hide(),se.hide(),ce.hide()})),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(t,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),p=[f.left+f.width/2-j[0]-d.left,f.top+f.height/2-j[1]-d.top];ue.config({color:l}).text(u),ue.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(e,t){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ue.show()})).on("mouseout.tooltip",(function(e,t){ue.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(e){if(!arguments.length)return s;var t=o.util.cloneJson(e);return t.data.forEach((function(e,t){s.data[t]||(s.data[t]={}),a(s.data[t],o.Axis.defaultConfig().data[0]),a(s.data[t],e)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,t.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(e){return r},d.angularScale=function(e){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(e,t){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(e,t){for(var r in e)r in t&&(t[r]=e[r])},o.util._extend=function(e,t){for(var r in e)t[r]=e[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(e,t){var r=t||6;return n.range(0,360+r,r).map((function(t,r){var n=t*Math.PI/180;return[t,e(n)]}))},o.util.dataFromEquation=function(e,t,r){var a=t||6,i=[],o=[];n.range(0,360+a,a).forEach((function(t,r){var n=t*Math.PI/180,a=e(n);i.push(t),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},o.util.ensureArray=function(e,t){if("undefined"==typeof e)return null;var r=[].concat(e);return n.range(t).map((function(e,t){return r[t]||r[0]}))},o.util.fillArrays=function(e,t,r){return t.forEach((function(t,n){e[t]=o.util.ensureArray(e[t],r)})),e},o.util.cloneJson=function(e){return JSON.parse(JSON.stringify(e))},o.util.validateKeys=function(e,t){"string"==typeof t&&(t=t.split("."));var r=t.shift();return e[r]&&(!t.length||objHasKeys(e[r],t))},o.util.sumArrays=function(e,t){return n.zip(e,t).map((function(e,t){return n.sum(e)}))},o.util.arrayLast=function(e){return e[e.length-1]},o.util.arrayEqual=function(e,t){for(var r=Math.max(e.length,t.length,1);r-- >=0&&e[r]===t[r];);return-2===r},o.util.flattenArray=function(e){for(var t=[];!o.util.arrayEqual(t,e);)t=e,e=[].concat.apply([],e);return e},o.util.deduplicate=function(e){return e.filter((function(e,t,r){return r.indexOf(e)==t}))},o.util.convertToCartesian=function(e,t){var r=t*Math.PI/180;return[e*Math.cos(r),e*Math.sin(r)]},o.util.round=function(e,t){var r=t||2,n=Math.pow(10,r);return Math.round(e*n)/n},o.util.getMousePos=function(e){var t=n.mouse(e.node()),r=t[0],a=t[1],i={};return i.x=r,i.y=a,i.pos=t,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(e){for(var t,r={},n={},a=0,i=e.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(e,t){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(e,t){return h.stroke(r,a,i)},"stroke-width":function(e,t){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(e,t){return h["stroke-dasharray"](r,a,i)},opacity:function(e,t){return h.opacity(r,a,i)},display:function(e,t){return h.display(r,a,i)}})}};var f=t.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(e){return-d/2})).endAngle((function(e){return d/2})).innerRadius((function(e){return t.radialScale(s+(e[2]||0))})).outerRadius((function(e){return t.radialScale(s+(e[2]||0))+t.radialScale(e[1])}));c.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(e,r){return"rotate("+(t.orientation+l(e[0])+90)+")"}})};var h={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,n,a){return r[e[a].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[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(e,t){return e}));v.enter().append("path").attr({class:"mark"}),v.style(h).each(c[t.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(t){return arguments.length?(t.forEach((function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)})),this):e},i.getColorScale=function(){},n.rebind(i,t,"on"),i},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 e=o.Legend.defaultConfig(),t=n.dispatch("hover");function r(){var t=e.legendConfig,i=e.data.map((function(e,r){return[].concat(e).map((function(e,n){var i=a({},t.elements[r]);return i.name=e,i.color=[].concat(t.elements[r].color)[n],i}))})),o=n.merge(i);o=o.filter((function(e,r){return t.elements[r]&&(t.elements[r].visibleInLegend||"undefined"==typeof t.elements[r].visibleInLegend)})),t.reverseOrder&&(o=o.reverse());var l=t.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(e,t){return e.color})),c=t.fontSize,u=null==t.isContinuous?"number"==typeof o[0]:t.isContinuous,f=u?t.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(e,t){return t/(s.length-1)*100+"%"}}).style({"stop-color":function(e,t){return e}}),d.append("rect").classed("legend-mark",!0).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(e,t){return"translate("+[c/2,v(t)+c/2]+")"},d:function(e,t){var r,a,i,o=e.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(e,t){return g(t)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?t.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?t.textColor:"none"}),b.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text((function(e,t){return o[t].name})),r}return r.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(r,t,"on"),r},o.Legend.defaultConfig=function(e,t){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 e,t,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(e=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),t=n.append("text").attr({dx:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";t.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=t.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),e.attr({transform:"translate("+[s,-v/2+2*d]+")"}),e.style({display:"block"}),c},c.move=function(t){if(e)return e.attr({transform:"translate("+[t[0],t[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(e)return e.style({display:"none"}),c},c.show=function(){if(e)return e.style({display:"block"}),c},c.config=function(e){return a(i,e),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var e={convert:function(e,t){var r={};if(e.data&&(r.data=e.data.map((function(e,r){var n=a({},e);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(e,r){o.util.translator.apply(null,e.concat(t))})),t||delete n.marker,t&&delete n.groupId,t?("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})),!t&&e.layout&&"stack"===e.layout.barmode)){var i=o.util.duplicates(r.data.map((function(e,t){return e.geometry})));r.data.forEach((function(e,t){var n=i.indexOf(e.geometry);-1!=n&&(r.data[t].groupId=n)}))}if(e.layout){var l=a({},e.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(e,t){u[c[s.indexOf(e.key)]]=e.value})),l.margin=u}t&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return e}},{"../../../constants/alignment":147,"../../../lib":171,d3:9}],254:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../../lib"),i=e("../../../components/color"),o=e("./micropolar"),l=e("./undo_manager"),s=a.extendDeepAll,c=t.exports={};c.framework=function(e){var t,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),t=t?s(t,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(t),a.config(i).render(u),e.data=t.data,e.layout=t.layout,c.fillLayout(e),t}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return t},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var e,n,a=this,i=o.util.cloneJson(t);e=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(e)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(e){var t=n.select(e).selectAll(".plot-container"),r=t.selectAll(".svg-container"),a=e.framework&&e.framework.svg&&e.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:t,_paperdiv:r,_paper:a};e._fullLayout=s(o,e.layout)}},{"../../../components/color":45,"../../../lib":171,"./micropolar":253,"./undo_manager":255,d3:9}],255:[function(e,t,r){"use strict";t.exports=function(){var e,t=[],r=-1,n=!1;function a(e,t){return e?(n=!0,e[t](),n=!1,this):this}return{add:function(e){return n||(t.splice(r+1,t.length-r),t.push(e),r=t.length-1),this},setCallback:function(t){e=t},undo:function(){var n=t[r];return n?(a(n,"undo"),r-=1,e&&e(n.undo),this):this},redo:function(){var n=t[r+1];return n?(a(n,"redo"),r+=1,e&&e(n.redo),this):this},clear:function(){t=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a-1&&(f[p[r]].title={text:""});for(r=0;r")?"":t.html(e).text()}));return t.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":45,"../components/drawing":67,"../constants/xmlns_namespaces":151,"../lib":171,d3:9}],266:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rf+c||!n(u))}for(var p=0;pi))return t}return void 0!==r?r:e.dflt},r.coerceColor=function(e,t,r){return a(t).isValid()?t:void 0!==r?r:e.dflt},r.coerceEnumerated=function(e,t,r){return e.coerceNumber&&(t=+t),-1!==e.values.indexOf(t)?t:void 0!==r?r:e.dflt},r.getValue=function(e,t){var r;return Array.isArray(e)?t0?a+=i:t<0&&(a-=i)}return n.inbox(r-t,a-t,b+(a-t)/(a-r)-1)}"h"===v.orientation?(i=r,l=t,u="y",f="x",d=L,p=A):(i=t,l=r,u="x",f="y",p=L,d=A);var S=e[u+"a"],C=e[f+"a"];h=Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0]));var O=n.getDistanceFunction(a,d,p,(function(e){return(d(e)+p(e))/2}));if(n.getClosest(g,O,e),!1!==e.index&&g[e.index].p!==c){y||(T=function(e){return Math.min(_(e),e.p-m.bargroupwidth/2)},k=function(e){return Math.max(w(e),e.p+m.bargroupwidth/2)});var D=g[e.index],P=v.base?D.b+D.s:D.s;e[f+"0"]=e[f+"1"]=C.c2p(D[f],!0),e[f+"LabelVal"]=P;var z=m.extents[m.extents.round(D.p)];return e[u+"0"]=S.c2p(y?T(D):z[0],!0),e[u+"1"]=S.c2p(y?k(D):z[1],!0),e[u+"LabelVal"]=D.p,e.labelLabel=s(S,e[u+"LabelVal"]),e.valueLabel=s(C,e[f+"LabelVal"]),e.spikeDistance=(L(D)+function(e){return M(_(e),w(e))}(D))/2-b,e[u+"Spike"]=S.c2p(D.p,!0),o(D,v,e),e.hovertemplate=v.hovertemplate,e}}function f(e,t){var r=t.mcc||e.marker.color,n=t.mlcc||e.marker.line.color,a=l(e,t);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}t.exports={hoverPoints:function(e,t,r,n){var i=u(e,t,r,n);if(i){var o=i.cd,l=o[0].trace,s=o[i.index];return i.color=f(l,s),a.getComponentMethod("errorbars","hoverInfo")(s,l,i),[i]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":45,"../../components/fx":85,"../../constants/numerical":150,"../../lib":171,"../../plots/cartesian/axes":215,"../../registry":257,"./helpers":273}],275:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc").crossTraceCalc,colorbar:e("../scatter/marker_colorbar"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot").plot,style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover").hoverPoints,eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"bar",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":228,"../scatter/marker_colorbar":315,"./arrays_to_calcdata":266,"./attributes":267,"./calc":268,"./cross_trace_calc":270,"./defaults":271,"./event_data":272,"./hover":274,"./layout_attributes":276,"./layout_defaults":277,"./plot":278,"./select":279,"./style":281}],276:[function(e,t,r){"use strict";t.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],277:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/cartesian/axes"),i=e("../../lib"),o=e("./layout_attributes");t.exports=function(e,t,r){function l(r,n){return i.coerce(e,t,o,r,n)}for(var s=!1,c=!1,u=!1,f={},d=l("barmode"),p=0;p0}function L(e){return"auto"===e?0:e}function S(e,t){var r=Math.PI/180*t,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:e.width*a+e.height*n,y:e.width*n+e.height*a}}function C(e,t,r,n,a,i){var o=!!i.isHorizontal,l=!!i.constrained,s=i.angle||0,c=i.anchor||"end",u="end"===c,f="start"===c,d=((i.leftToRight||0)+1)/2,p=1-d,h=a.width,g=a.height,v=Math.abs(t-e),m=Math.abs(n-r),y=v>2*_&&m>2*_?_:0;v-=2*y,m-=2*y;var x=L(s);"auto"!==s||h<=v&&g<=m||!(h>v||g>m)||(h>m||g>v)&&h.01?q:function(e,t,r){return r&&e===t?e:Math.abs(e-t)>=2?q(e):e>t?Math.ceil(e):Math.floor(e)};N=G(N,H,R),H=G(H,N,R),B=G(B,j,!R),j=G(j,B,!R)}var Z=M(i.ensureSingle(P,"path"),D,v,m);if(Z.style("vector-effect","non-scaling-stroke").attr("d",isNaN((H-N)*(j-B))?"M0,0Z":"M"+N+","+B+"V"+j+"H"+H+"V"+B+"Z").call(s.setClipUrl,t.layerClipId,e),!D.uniformtext.mode&&I){var Y=s.makePointStyleFns(f);s.singlePointStyle(c,Z,f,Y,e)}!function(e,t,r,n,a,l,c,f,p,v,m){var w,T=t.xaxis,A=t.yaxis,O=e._fullLayout;function D(t,r,n){return i.ensureSingle(t,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(s.font,n).call(o.convertToTspans,e)}var P=n[0].trace,z="h"===P.orientation,E=function(e,t,r,n,a){var o,l=t[0].trace;o=l.texttemplate?function(e,t,r,n,a){var o=t[0].trace,l=i.castOption(o,r,"texttemplate");if(!l)return"";var s,c,f,d,p="waterfall"===o.type,h="funnel"===o.type;"h"===o.orientation?(s="y",c=a,f="x",d=n):(s="x",c=n,f="y",d=a);function g(e){return u(d,+e,!0).text}var v=t[r],m={};m.label=v.p,m.labelLabel=m[s+"Label"]=(y=v.p,u(c,y,!0).text);var y;var x=i.castOption(o,v.i,"text");(0===x||x)&&(m.text=x);m.value=v.s,m.valueLabel=m[f+"Label"]=g(v.s);var _={};b(_,o,v.i),p&&(m.delta=+v.rawS||v.s,m.deltaLabel=g(m.delta),m.final=v.v,m.finalLabel=g(m.final),m.initial=m.final-m.delta,m.initialLabel=g(m.initial));h&&(m.value=v.s,m.valueLabel=g(m.value),m.percentInitial=v.begR,m.percentInitialLabel=i.formatPercent(v.begR),m.percentPrevious=v.difR,m.percentPreviousLabel=i.formatPercent(v.difR),m.percentTotal=v.sumR,m.percenTotalLabel=i.formatPercent(v.sumR));var w=i.castOption(o,v.i,"customdata");w&&(m.customdata=w);return i.texttemplateString(l,m,e._d3locale,_,m,o._meta||{})}(e,t,r,n,a):l.textinfo?function(e,t,r,n){var a=e[0].trace,o="h"===a.orientation,l="waterfall"===a.type,s="funnel"===a.type;function c(e){return u(o?r:n,+e,!0).text}var f,d=a.textinfo,p=e[t],h=d.split("+"),g=[],v=function(e){return-1!==h.indexOf(e)};v("label")&&g.push((m=e[t].p,u(o?n:r,m,!0).text));var m;v("text")&&(0===(f=i.castOption(a,p.i,"text"))||f)&&g.push(f);if(l){var y=+p.rawS||p.s,x=p.v,b=x-y;v("initial")&&g.push(c(b)),v("delta")&&g.push(c(y)),v("final")&&g.push(c(x))}if(s){v("value")&&g.push(c(p.s));var _=0;v("percent initial")&&_++,v("percent previous")&&_++,v("percent total")&&_++;var w=_>1;v("percent initial")&&(f=i.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),v("percent previous")&&(f=i.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),v("percent total")&&(f=i.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(t,r,n,a):g.getValue(l.text,r);return g.coerceString(y,o)}(O,n,a,T,A);w=function(e,t){var r=g.getValue(e.textposition,t);return g.coerceEnumerated(x,r)}(P,a);var R="stack"===v.mode||"relative"===v.mode,I=n[a],F=!R||I._outmost;if(!E||"none"===w||(I.isBlank||l===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var N=O.font,H=h.getBarColor(n[a],P),B=h.getInsideTextFont(P,a,N,H),j=h.getOutsideTextFont(P,a,N),U=r.datum();z?"log"===T.type&&U.s0<=0&&(l=T.range[0]=G*(W/Z):W>=Z*(X/G);G>0&&Z>0&&(Q||J||$)?w="inside":(w="outside",V.remove(),V=null)}else w="inside";if(!V){Y=i.ensureUniformFontSize(e,"outside"===w?j:B);var K=(V=D(r,E,Y)).attr("transform");if(V.attr("transform",""),q=s.bBox(V.node()),G=q.width,Z=q.height,V.attr("transform",K),G<=0||Z<=0)return void V.remove()}var ee,te,re=P.textangle;"outside"===w?(te="both"===P.constraintext||"outside"===P.constraintext,ee=function(e,t,r,n,a,i){var o,l=!!i.isHorizontal,s=!!i.constrained,c=i.angle||0,u=a.width,f=a.height,d=Math.abs(t-e),p=Math.abs(n-r);o=l?p>2*_?_:0:d>2*_?_:0;var h=1;s&&(h=l?Math.min(1,p/f):Math.min(1,d/u));var g=L(c),v=S(a,g),m=(l?v.x:v.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(e+t)/2,w=(r+n)/2,T=0,M=0,A=l?k(t,e):k(r,n);l?(b=t-A*o,T=A*m):(w=n+A*o,M=-A*m);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:h,rotate:g}}(l,c,f,p,q,{isHorizontal:z,constrained:te,angle:re})):(te="both"===P.constraintext||"inside"===P.constraintext,ee=C(l,c,f,p,q,{isHorizontal:z,constrained:te,angle:re,anchor:P.insidetextanchor}));ee.fontSize=Y.size,d(P.type,ee,O),I.transform=ee,M(V,O,v,m).attr("transform",i.getTextTransform(ee))}(e,t,P,r,p,N,H,B,j,v,m),t.layerClipId&&s.hideOutsideRangePoint(c,P.select("text"),w,O,f.xcalendar,f.ycalendar)}));var B=!1===f.cliponaxis;s.setClipUrl(c,B?null:t.layerClipId,e)}));c.getComponentMethod("errorbars","plot")(e,P,t,v)},toMoveInsideBar:C}},{"../../components/color":45,"../../components/drawing":67,"../../components/fx/helpers":81,"../../lib":171,"../../lib/svg_text_utils":192,"../../plots/cartesian/axes":215,"../../registry":257,"./attributes":267,"./constants":269,"./helpers":273,"./style":281,"./uniform_text":283,d3:9,"fast-isnumeric":11}],279:[function(e,t,r){"use strict";function n(e,t,r,n,a){var i=t.c2p(n?e.s0:e.p0,!0),o=t.c2p(n?e.s1:e.p1,!0),l=r.c2p(n?e.p0:e.s0,!0),s=r.c2p(n?e.p1:e.s1,!0);return a?[(i+o)/2,(l+s)/2]:n?[o,(l+s)/2]:[(i+o)/2,s]}t.exports=function(e,t){var r,a=e.cd,i=e.xaxis,o=e.yaxis,l=a[0].trace,s="funnel"===l.type,c="h"===l.orientation,u=[];if(!1===t)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!e[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),t.selectAll("g.points").each((function(t){h(n.select(this),t[0].trace,e)})),l.getComponentMethod("errorbars","style")(t)},styleTextPoints:g,styleOnSelect:function(e,t,r){var a=t[0].trace;a.selectedpoints?function(e,t,r){i.selectedPointStyle(e.selectAll("path"),t),function(e,t,r){e.each((function(e){var a,l=n.select(this);if(e.selected){a=o.ensureUniformFontSize(r,v(l,e,t,r));var s=t.selected.textfont&&t.selected.textfont.color;s&&(a.color=s),i.font(l,a)}else i.selectedTextStyle(l,t)}))}(e.selectAll("text"),t,r)}(r,a,e):(h(r,a,e),l.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:s}},{"../../components/color":45,"../../components/drawing":67,"../../lib":171,"../../registry":257,"./attributes":267,"./helpers":273,"./uniform_text":283,d3:9}],282:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l){r("marker.color",o),a(e,"marker")&&i(e,t,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(e,"marker.line")&&i(e,t,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":45,"../../components/colorscale/defaults":55,"../../components/colorscale/helpers":56}],283:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib");function i(e){return"_"+e+"Text_minsize"}t.exports={recordMinTextSize:function(e,t,r){if(r.uniformtext.mode){var n=i(e),a=r.uniformtext.minsize,o=t.scale*t.fontSize;t.hide=o0){l=!0;break}}l||(o=0)}return{hasLabels:r,hasValues:i,len:o}}t.exports={handleLabelsAndValues:s,supplyDefaults:function(e,t,r,n){function c(r,n){return a.coerce(e,t,i,r,n)}var u=s(c("labels"),c("values")),f=u.len;if(t._hasLabels=u.hasLabels,t._hasValues=u.hasValues,!t._hasLabels&&t._hasValues&&(c("label0"),c("dlabel")),f){t._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var d,p=c("text"),h=c("texttemplate");if(h||(d=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),h||d&&"none"!==d){var g=c("textposition");l(e,t,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(t,n,c);var v=c("hole");if(c("title.text")){var m=c("title.position",v?"middle center":"top center");v||"middle center"!==m||(t.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else t.visible=!1}}},{"../../lib":171,"../../plots/domain":242,"../bar/defaults":271,"./attributes":284,"fast-isnumeric":11}],288:[function(e,t,r){"use strict";var n=e("../../components/fx/helpers").appendArrayMultiPointValues;t.exports=function(e,t){var r={curveNumber:t.index,pointNumbers:e.pts,data:t._input,fullData:t,label:e.label,color:e.color,value:e.v,percent:e.percent,text:e.text,v:e.v};return 1===e.pts.length&&(r.pointNumber=r.i=e.pts[0]),n(r,t,e.pts),"funnelarea"===t.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":81}],289:[function(e,t,r){"use strict";var n=e("../../lib");r.formatPiePercent=function(e,t){var r=(100*e).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,t)+"%"},r.formatPieValue=function(e,t){var r=e.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,t)},r.getFirstFilled=function(e,t){if(Array.isArray(e))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:h.castOption(b.bgcolor,e.pts)||e.color,borderColor:h.castOption(b.bordercolor,e.pts),fontFamily:h.castOption(_.family,e.pts),fontSize:h.castOption(_.size,e.pts),fontColor:h.castOption(_.color,e.pts),nameLength:h.castOption(b.namelength,e.pts),textAlign:h.castOption(b.align,e.pts),hovertemplate:h.castOption(u.hovertemplate,e.pts),hovertemplateLabels:e,eventData:[g(e,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,t.emit("plotly_hover",{points:[g(e,u)],event:n.event})}})),e.on("mouseout",(function(e){var r=t._fullLayout,a=t._fullData[o.index],l=n.select(this).datum();o._hasHoverEvent&&(e.originalEvent=n.event,t.emit("plotly_unhover",{points:[g(l,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),e.on("click",(function(e){var r=t._fullLayout,a=t._fullData[o.index];t._dragging||!1===r.hovermode||(t._hoverdata=[g(e,a)],i.click(t,n.event))}))}function y(e,t,r){var n=h.castOption(e.insidetextfont.color,t.pts);!n&&e._input.textfont&&(n=h.castOption(e._input.textfont.color,t.pts));var a=h.castOption(e.insidetextfont.family,t.pts)||h.castOption(e.textfont.family,t.pts)||r.family,i=h.castOption(e.insidetextfont.size,t.pts)||h.castOption(e.textfont.size,t.pts)||r.size;return{color:n||o.contrast(t.color),family:a,size:i}}function x(e,t){for(var r,n,a=0;at&&t>n||r=-4;v-=2)m(Math.PI*v,"tan");for(v=4;v>=-4;v-=2)m(Math.PI*(v+1),"tan")}if(f||p){for(v=4;v>=-4;v-=2)m(Math.PI*(v+1.5),"rad");for(v=4;v>=-4;v-=2)m(Math.PI*(v+.5),"rad")}}if(l||h||f){var y=Math.sqrt(e.width*e.width+e.height*e.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(t.startangle+t.stopangle)/2,i.scale>=1)return i;g.push(i)}(h||p)&&((i=_(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i)),(h||d)&&((i=w(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i));for(var x=0,b=0,T=0;T=1)break}return g[x]}function _(e,t,r,n,a){t=Math.max(0,t-2*p);var i=e.width/e.height,o=M(i,n,t,r);return{scale:2*o/e.height,rCenter:T(i,o/t),rotate:k(a)}}function w(e,t,r,n,a){t=Math.max(0,t-2*p);var i=e.height/e.width,o=M(i,n,t,r);return{scale:2*o/e.width,rCenter:T(i,o/t),rotate:k(a+Math.PI/2)}}function T(e,t){return Math.cos(t)-e*t}function k(e){return(180/Math.PI*e+720)%180-90}function M(e,t,r,n){var a=e+1/(2*Math.tan(t));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(e*e+n/2)+e))}function A(e,t){return e.v!==t.vTotal||t.trace.hole?Math.min(1/(1+1/Math.sin(e.halfangle)),e.ring/2):1}function L(e,t){var r=t.pxmid[0],n=t.pxmid[1],a=e.width/2,i=e.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function S(e,t){var r,n,a,i=e.trace,o={x:e.cx,y:e.cy},l={tx:0,ty:0};l.ty+=i.title.font.size,a=O(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*e.r,l.ty-=e.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*e.r);var s,c,u=(s=e.r,c=e.trace.aspectratio,s/(void 0===c?1:c)),f=t.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(f+=u,o.x-=(1+a)*u,l.tx+=e.titleBox.width/2):-1!==i.title.position.indexOf("center")?f*=2:-1!==i.title.position.indexOf("right")&&(f+=u,o.x+=(1+a)*u,l.tx-=e.titleBox.width/2),r=f/e.titleBox.width,n=C(e,t)/e.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:l.tx,ty:l.ty}}function C(e,t){var r=e.trace,n=t.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(e.titleBox.height,n/2)}function O(e){var t,r=e.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,t=0;tr&&(r=e.pull[t]);return r}function D(e,t){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,s=c*u}o=Math.min(o,s/r.vTotal)}for(n=0;n")}if(i){var x=s.castOption(a,t.i,"texttemplate");if(x){var b=function(e){return{label:e.label,value:e.v,valueLabel:h.formatPieValue(e.v,n.separators),percent:e.v/r.vTotal,percentLabel:h.formatPiePercent(e.v/r.vTotal,n.separators),color:e.color,text:e.text,customdata:s.castOption(a,e.i,"customdata")}}(t),_=h.getFirstFilled(a.text,t.pts);(v(_)||""===_)&&(b.text=_),t.text=s.texttemplateString(x,b,e._fullLayout._d3locale,b,a._meta||{})}else t.text=""}}function E(e,t){var r=e.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(t.left+t.right)/2,o=(t.top+t.bottom)/2;e.textX=i*n-o*a,e.textY=i*a+o*n,e.noCenter=!0}t.exports={plot:function(e,t){var r=e._fullLayout,i=r._size;d("pie",r),x(t,e),D(t,i);var u=s.makeTraceGroups(r._pielayer,t,"trace").each((function(t){var u=n.select(this),d=t[0],p=d.trace;!function(e){var t,r,n,a=e[0],i=a.r,o=a.trace,l=o.rotation*Math.PI/180,s=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(t=0;ta.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=A(r,a))}(t),u.attr("stroke-linejoin","round"),u.each((function(){var g=n.select(this).selectAll("g.slice").data(t);g.enter().append("g").classed("slice",!0),g.exit().remove();var v=[[[],[]],[[],[]]],x=!1;g.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=p.index,v[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=d.cx,u=d.cy,g=n.select(this),_=g.selectAll("path.surface").data([a]);if(_.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),g.call(m,e,t),p.pull){var w=+h.castOption(p.pull,a.pts)||0;w>0&&(o+=w*a.pxmid[0],u+=w*a.pxmid[1])}a.cxFinal=o,a.cyFinal=u;var T=p.hole;if(a.v===d.vTotal){var k="M"+(o+a.px0[0])+","+(u+a.px0[1])+O(a.px0,a.pxmid,!0,1)+O(a.pxmid,a.px0,!0,1)+"Z";T?_.attr("d","M"+(o+T*a.px0[0])+","+(u+T*a.px0[1])+O(a.px0,a.pxmid,!1,T)+O(a.pxmid,a.px0,!1,T)+"Z"+k):_.attr("d",k)}else{var M=O(a.px0,a.px1,!0,1);if(T){var A=1-T;_.attr("d","M"+(o+T*a.px1[0])+","+(u+T*a.px1[1])+O(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else _.attr("d","M"+o+","+u+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}z(e,a,d);var S=h.castOption(p.textposition,a.pts),C=g.selectAll("g.slicetext").data(a.text&&"none"!==S?[0]:[]);C.enter().append("g").classed("slicetext",!0),C.exit().remove(),C.each((function(){var g=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),v=s.ensureUniformFontSize(e,"outside"===S?function(e,t,r){var n=h.castOption(e.outsidetextfont.color,t.pts)||h.castOption(e.textfont.color,t.pts)||r.color,a=h.castOption(e.outsidetextfont.family,t.pts)||h.castOption(e.textfont.family,t.pts)||r.family,i=h.castOption(e.outsidetextfont.size,t.pts)||h.castOption(e.textfont.size,t.pts)||r.size;return{color:n,family:a,size:i}}(p,a,r.font):y(p,a,r.font));g.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,v).call(c.convertToTspans,e);var m,_=l.bBox(g.node());if("outside"===S)m=L(_,a);else if(m=b(_,a,d),"auto"===S&&m.scale<1){var w=s.ensureUniformFontSize(e,p.outsidetextfont);g.call(l.font,w),m=L(_=l.bBox(g.node()),a)}var T=m.textPosAngle,k=void 0===T?a.pxmid:P(d.r,T);if(m.targetX=o+k[0]*m.rCenter+(m.x||0),m.targetY=u+k[1]*m.rCenter+(m.y||0),E(m,_),m.outside){var M=m.targetY;a.yLabelMin=M-_.height/2,a.yLabelMid=M,a.yLabelMax=M+_.height/2,a.labelExtraX=0,a.labelExtraY=0,x=!0}m.fontSize=v.size,f(p.type,m,r),t[i].transform=m,g.attr("transform",s.getTextTransform(m))}))}function O(e,t,r,n){var i=n*(t[0]-e[0]),o=n*(t[1]-e[1]);return"a"+n*d.r+","+n*d.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var _=n.select(this).selectAll("g.titletext").data(p.title.text?[0]:[]);if(_.enter().append("g").classed("titletext",!0),_.exit().remove(),_.each((function(){var t,r=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),a=p.title.text;p._meta&&(a=s.templateString(a,p._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(l.font,p.title.font).call(c.convertToTspans,e),t="middle center"===p.title.position?function(e){var t=Math.sqrt(e.titleBox.width*e.titleBox.width+e.titleBox.height*e.titleBox.height);return{x:e.cx,y:e.cy,scale:e.trace.hole*e.r*2/t,tx:0,ty:-e.titleBox.height/2+e.trace.title.font.size}}(d):S(d,i),r.attr("transform","translate("+t.x+","+t.y+")"+(t.scale<1?"scale("+t.scale+")":"")+"translate("+t.tx+","+t.ty+")")})),x&&function(e,t){var r,n,a,i,o,l,s,c,u,f,d,p,g;function v(e,t){return e.pxmid[1]-t.pxmid[1]}function m(e,t){return t.pxmid[1]-e.pxmid[1]}function y(e,r){r||(r={});var a,c,u,d,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),g=n?e.yLabelMin:e.yLabelMax,v=n?e.yLabelMax:e.yLabelMin,m=e.cyFinal+o(e.px0[1],e.px1[1]),y=p-g;if(y*s>0&&(e.labelExtraY=y),Array.isArray(t.pull))for(c=0;c=(h.castOption(t.pull,u.pts)||0)||((e.pxmid[1]-u.pxmid[1])*s>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-g-e.labelExtraY)*s>0&&(e.labelExtraY+=y):(v+e.labelExtraY-m)*s>0&&(a=3*l*Math.abs(c-f.indexOf(e)),(d=u.cxFinal+i(u.px0[0],u.px1[0])+a-(e.cxFinal+e.pxmid[0])-e.labelExtraX)*l>0&&(e.labelExtraX+=d)))}for(n=0;n<2;n++)for(a=n?v:m,o=n?Math.max:Math.min,s=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,l=r?1:-1,(c=e[n][r]).sort(a),u=e[1-n][r],f=u.concat(c),p=[],d=0;dMath.abs(f)?l+="l"+f*e.pxmid[0]/e.pxmid[1]+","+f+"H"+(i+e.labelExtraX+c):l+="l"+e.labelExtraX+","+u+"v"+(f-u)+"h"+c}else l+="V"+(e.yLabelMid+e.labelExtraY)+"h"+c;s.ensureSingle(r,"path","textline").call(o.stroke,t.outsidetextfont.color).attr({"stroke-width":Math.min(2,t.outsidetextfont.size/8),d:l,fill:"none"})}else r.select("path.textline").remove()}))}(g,p),x&&p.automargin){var w=l.bBox(u.node()),T=p.domain,k=i.w*(T.x[1]-T.x[0]),M=i.h*(T.y[1]-T.y[0]),A=(.5*k-d.r)/i.w,C=(.5*M-d.r)/i.h;a.autoMargin(e,"pie."+p.uid+".automargin",{xl:T.x[0]-A,xr:T.x[1]+A,yb:T.y[0]-C,yt:T.y[1]+C,l:Math.max(d.cx-d.r-w.left,0),r:Math.max(w.right-(d.cx+d.r),0),b:Math.max(w.bottom-(d.cy+d.r),0),t:Math.max(d.cy-d.r-w.top,0),pad:5})}}))}));setTimeout((function(){u.selectAll("tspan").each((function(){var e=n.select(this);e.attr("dy")&&e.attr("dy",e.attr("dy"))}))}),0)},formatSliceLabel:z,transformInsideText:b,determineInsideTextFont:y,positionTitleOutside:S,prerenderTitles:x,layoutAreas:D,attachFxHandlers:m,computeTransform:E}},{"../../components/color":45,"../../components/drawing":67,"../../components/fx":85,"../../lib":171,"../../lib/svg_text_utils":192,"../../plots/plots":249,"../bar/constants":269,"../bar/uniform_text":283,"./event_data":288,"./helpers":289,d3:9}],294:[function(e,t,r){"use strict";var n=e("d3"),a=e("./style_one"),i=e("../bar/uniform_text").resizeText;t.exports=function(e){var t=e._fullLayout._pielayer.selectAll(".trace");i(e,t,"pie"),t.each((function(e){var t=e[0].trace,r=n.select(this);r.style({opacity:t.opacity}),r.selectAll("path.surface").each((function(e){n.select(this).call(a,e,t)}))}))}},{"../bar/uniform_text":283,"./style_one":295,d3:9}],295:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("./helpers").castOption;t.exports=function(e,t,r){var i=r.marker.line,o=a(i.color,t.pts)||n.defaultLine,l=a(i.width,t.pts)||0;e.style("stroke-width",l).call(n.fill,t.color).call(n.stroke,o)}},{"../../components/color":45,"./helpers":289}],296:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rl&&M[v].gap;)v--;for(y=M[v].s,h=M.length-1;h>v;h--)M[h].s=y;for(;lA[u]&&u=0;a--){var i=e[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],304:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("./attributes"),o=e("./constants"),l=e("./subtypes"),s=e("./xy_defaults"),c=e("./stack_defaults"),u=e("./marker_defaults"),f=e("./line_defaults"),d=e("./line_shape_defaults"),p=e("./text_defaults"),h=e("./fillcolor_defaults");t.exports=function(e,t,r,g){function v(r,a){return n.coerce(e,t,i,r,a)}var m=s(e,t,g,v);if(m||(t.visible=!1),t.visible){var y=c(e,t,g,v),x=!y&&mG!=(F=P[O][1])>=G&&(E=P[O-1][0],R=P[O][0],F-I&&(z=E+(R-E)*(G-I)/(F-I),j=Math.min(j,z),U=Math.max(U,z)));j=Math.max(j,0),U=Math.min(U,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(e,{distance:e.maxHoverDistance,x0:j,x1:U,y0:G,y1:G,color:Z,hovertemplate:!1}),delete e.index,f.text&&!Array.isArray(f.text)?e.text=String(f.text):e.text=f.name,[e]}}}},{"../../components/color":45,"../../components/fx":85,"../../lib":171,"../../registry":257,"./get_trace_color":307}],309:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:e("./attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("./cross_trace_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./cross_trace_calc"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot"),colorbar:e("./marker_colorbar"),formatLabels:e("./format_labels"),style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":228,"./arrays_to_calcdata":296,"./attributes":297,"./calc":298,"./cross_trace_calc":302,"./cross_trace_defaults":303,"./defaults":304,"./format_labels":306,"./hover":308,"./marker_colorbar":315,"./plot":317,"./select":318,"./style":320,"./subtypes":321}],310:[function(e,t,r){"use strict";var n=e("../../lib").isArrayOrTypedArray,a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l,s){var c=(e.marker||{}).color;(l("line.color",r),a(e,"line"))?i(e,t,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":55,"../../components/colorscale/helpers":56,"../../lib":171}],311:[function(e,t,r){"use strict";var n=e("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=e("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=e("./constants");t.exports=function(e,t){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,T,k,M,A,L=t.xaxis,S=t.yaxis,C="log"===L.type,O="log"===S.type,D=L._length,P=S._length,z=t.connectGaps,E=t.baseTolerance,R=t.shape,I="linear"===R,F=t.fill&&"none"!==t.fill,N=[],H=f.minTolerance,B=e.length,j=new Array(B),U=0;function V(r){var n=e[r];if(!n)return!1;var i=t.linearized?L.l2p(n.x):L.c2p(n.x),s=t.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;O&&s===a&&(i*=Math.abs(L._m*P*(L._m>0?o:l)/(S._m*D*(S._m>0?o:l)))),i*=1e3}if(s===a){if(O&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function q(e,t,r,n){var a=r-e,i=n-t,o=.5-e,l=.5-t,s=a*a+i*i,c=a*o+i*l;if(c>0&&cre||e[1]ae)return[u(e[0],te,re),u(e[1],ne,ae)]}function le(e,t){return e[0]===t[0]&&(e[0]===te||e[0]===re)||(e[1]===t[1]&&(e[1]===ne||e[1]===ae)||void 0)}function se(e,t,r){return function(n,a){var i=oe(n),o=oe(a),l=[];if(i&&o&&le(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[e]+a[e])/2,t,r)-((i||n)[e]+(o||a)[e]);c&&((i&&o?c>0==i[e]>o[e]?i:o:i||o)[e]+=c);return l}}function ce(e){var t=e[0],r=e[1],n=t===j[U-1][0],a=r===j[U-1][1];if(!n||!a)if(U>1){var i=t===j[U-2][0],o=r===j[U-2][1];n&&(t===te||t===re)&&i?o?U--:j[U-1]=e:a&&(r===ne||r===ae)&&o?i?U--:j[U-1]=e:j[U++]=e}else j[U++]=e}function ue(e){j[U-1][0]!==e[0]&&j[U-1][1]!==e[1]&&ce([W,Q]),ce(e),J=null,W=Q=0}function fe(e){if(M=e[0]/D,A=e[1]/P,Y=e[0]re?re:0,X=e[1]ae?ae:0,Y||X){if(U)if(J){var t=K(J,e);t.length>1&&(ue(t[0]),j[U++]=t[1])}else $=K(j[U-1],e)[0],j[U++]=$;else j[U++]=[Y||e[0],X||e[1]];var r=j[U-1];Y&&X&&(r[0]!==Y||r[1]!==X)?(J&&(W!==Y&&Q!==X?ce(W&&Q?(n=J,i=(a=e)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?te:re,ae]:[o>0?re:te,ne]):[W||Y,Q||X]):W&&Q&&ce([W,Q])),ce([Y,X])):W-Y&&Q-X&&ce([Y||W,X||Q]),J=e,W=Y,Q=X}else J&&ue(K(J,e)[0]),j[U++]=e;var n,a,i,o}for("linear"===R||"spline"===R?K=function(e,t){for(var r=[],n=0,a=0;a<4;a++){var i=ie[a],o=c(e[0],e[1],t[0],t[1],i[0],i[1],i[2],i[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&&Z(o,e)G(h,de))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=e.length||!h)break;fe(h),n=h}}else fe(d)}J&&ce([W||J[0],Q||J[1]]),N.push(j.slice(0,U))}return N}},{"../../constants/numerical":150,"../../lib":171,"./constants":301}],312:[function(e,t,r){"use strict";t.exports=function(e,t,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],313:[function(e,t,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};t.exports=function(e,t,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(t,a):0}}},{"fast-isnumeric":11}],315:[function(e,t,r){"use strict";t.exports={container:"marker",min:"cmin",max:"cmax"}},{}],316:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults"),o=e("./subtypes");t.exports=function(e,t,r,l,s,c){var u=o.isBubble(e),f=(e.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(e,"marker")&&i(e,t,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&t.marker.color!==f?f:u?n.background:n.defaultLine),a(e,"marker.line")&&i(e,t,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":45,"../../components/colorscale/defaults":55,"../../components/colorscale/helpers":56,"./subtypes":321}],317:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../registry"),i=e("../../lib"),o=i.ensureSingle,l=i.identity,s=e("../../components/drawing"),c=e("./subtypes"),u=e("./line_points"),f=e("./link_traces"),d=e("../../lib/polygon").tester;function p(e,t,r,f,p,h,g){var v;!function(e,t,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(e){return e.x>=u[0]&&e.x<=u[1]&&e.y>=f[0]&&e.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(e,r){var n=e[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(e){return m?e.transition():e}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(h),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),L=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(e,k,r,g),!0===_.visible){var S,C;y(T).style("opacity",_.opacity);var O=_.fill.charAt(_.fill.length-1);"x"!==O&&"y"!==O&&(O=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var D,P,z="",E=[],R=_._prevtrace;R&&(z=R._prevRevpath||"",C=R._nextFill,E=R._polygons);var I,F,N,H,B,j,U,V="",q="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(I=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):I=F="spline"===w.shape?function(e){var t=e[e.length-1];return e.length>1&&e[0][0]===t[0]&&e[0][1]===t[1]?s.smoothclosed(e.slice(1),w.smoothing):s.smoothopen(e,w.smoothing)}:function(e){return"M"+e.join("L")},N=function(e){return F(e.reverse())},G=u(f,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),U=_._polygons=new Array(G.length),v=0;v1){var r=n.select(this);if(r.datum(f),e)y(r.style("opacity",0).attr("d",D).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",D),s.singleLineStyle(f,a)}}}}}var Y=M.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(Z(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(Y,r.layerClipId,e),G.length?(S?(S.datum(f),H&&j&&(O?("y"===O?H[1]=j[1]=b.c2p(0,!0):"x"===O&&(H[0]=j[0]=x.c2p(0,!0)),y(S).attr("d","M"+j+"L"+H+"L"+V.substr(1)).call(s.singleFillStyle)):y(S).attr("d",V+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&V&&z?("tonext"===_.fill?y(C).attr("d",V+"Z"+z+"Z").call(s.singleFillStyle):y(C).attr("d",V+"L"+z.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(E)):(W(C),_._polygons=null)),_._prevRevpath=q,_._prevPolygons=U):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(t,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=ee(u),h=te,g=te;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===e._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?J:Q:_&&!w&&(v=$),f&&(h=v),d&&(g=v)}var T,k=(o=t.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&k.call(s.pointStyle,u,e).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=s.makePointStyleFns(u)),o.each((function(t){var a=n.select(this),i=y(a);s.translatePoint(t,i,x,b)?(s.singlePointStyle(t,i,u,T,e),r.layerClipId&&s.hideOutsideRangePoint(t,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==t.data&&void 0!==t.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(e){var t=n.select(this),a=y(t.select("text"));s.translatePoint(e,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(e,t,x,b,u.xcalendar,u.ycalendar):t.remove()})),o.selectAll("text").call(s.textPointStyle,u,e).each((function(e){var t=x.c2p(e.x),r=b.c2p(e.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:t,y:r})}))})),o.exit().remove()}(A,L,f);var X=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,X,e),s.setClipUrl(L,X,e)}function W(e){y(e).attr("d","M0,0Z")}function Q(e){return e.filter((function(e){return!e.gap&&e.vis}))}function J(e){return e.filter((function(e){return e.vis}))}function $(e){return e.filter((function(e){return!e.gap}))}function K(e){return e.id}function ee(e){if(e.ids)return K}function te(){return!1}}t.exports=function(e,t,r,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(e,t,r);((u=a.selectAll("g.trace").data(v,(function(e){return e[0].trace.uid}))).enter().append("g").attr("class",(function(e){return"trace scatter trace"+e[0].trace.uid})).style("stroke-miterlimit",2),u.order(),function(e,t,r){t.each((function(t){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,e);var i=t[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(e){i[e]=null})).remove(),u.order().each((function(e){i[e]=o(n.select(this),"path","js-fill")}))}))}(e,u,t),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(e,n,t,r,v,this,i)}))}))):u.each((function(r,n){p(e,n,t,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":67,"../../lib":171,"../../lib/polygon":183,"../../registry":257,"./line_points":311,"./link_traces":313,"./subtypes":321,d3:9}],318:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports=function(e,t){var r,a,i,o,l=e.cd,s=e.xaxis,c=e.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===t)for(r=0;r=-e},pointBetween:function(t,r,n){var a=t[1]-r[1],i=n[0]-r[0],o=t[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-e)},pointsSameX:function(t,r){return Math.abs(t[0]-r[0])e!=o-a>e&&(i-c)*(a-u)/(o-u)+c-n>e&&(l=!l),i=c,o=u}return l}};return t}},{}],51:[function(e,t,r){var n={toPolygon:function(e,t){function r(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function r(t){var r=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[r]})}for(var n=r(t[0]),a=1;a0}))}function u(e,n){var a=e.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=t.linesIntersect(o,l,c,u);if(!1===f){if(!t.pointsCollinear(o,l,c))return!1;if(t.pointsSame(o,u)||t.pointsSame(l,c))return!1;var d=t.pointsSame(o,c),p=t.pointsSame(l,u);if(d&&p)return n;var h=!d&&t.pointBetween(o,c,u),g=!p&&t.pointBetween(l,c,u);if(d)return g?s(n,l):s(e,u),n;h&&(p||(g?s(n,l):s(e,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(e,c):0===f.alongB?s(e,f.pt):1===f.alongB&&s(e,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var e=u(d,h);if(e)return e}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(e)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(e)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return e?{addRegion:function(e){for(var n,a,i,o=e[e.length-1],s=0;s1)for(var r=1;r1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=O(e,360),t=O(t,100),r=O(r,100),0===t)n=a=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,s=2*r-l;n=o(s,l,e+1/3),a=o(s,l,e),i=o(s,l,e-1/3)}return{r:255*n,g:255*a,b:255*i}}(t.h,s,u),f=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,h,g;return i=C(i),{ok:f,format:t.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(e,t,r){e=O(e,255),t=O(t,255),r=O(r,255);var n,a,i=l(e,t,r),s=o(e,t,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case e:n=(t-r)/u+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/t;t--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.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 e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,n,a=this.toRgb();return t=a.r/255,r=a.g/255,n=a.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[z(i(e).toString(16)),z(i(t).toString(16)),z(i(r).toString(16)),z(E(n))];if(a&&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,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=c(e);r="#"+p(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));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(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:R(e[n]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),a=c(t).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(t,r){var n=c(t),a=c(r);return(e.max(n.getLuminance(),a.getLuminance())+.05)/(e.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,a,i=c.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(e,t,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(t[u]));return c.isReadable(e,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],r))};var L=c.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=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(L);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function O(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,l(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function D(e){return o(1,l(0,e))}function P(e){return parseInt(e,16)}function z(e){return 1==e.length?"0"+e:""+e}function R(e){return e<=1&&(e=100*e+"%"),e}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(e){return P(e)/255}var F,N,H,j=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",H="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+H),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+H),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+H),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 B(e){return!!j.CSS_UNIT.exec(e)}"undefined"!=typeof t&&t.exports?t.exports=c:window.tinycolor=c}(Math)},{}],58:[function(e,t,r){"use strict";t.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}]},{}],59:[function(e,t,r){"use strict";var n=e("./arrow_paths"),a=e("../../plots/font_attributes"),i=e("../../plots/cartesian/constants"),o=e("../../plot_api/plot_template").templatedArray;e("../../constants/axis_placeable_objects");t.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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../constants/axis_placeable_objects":177,"../../plot_api/plot_template":235,"../../plots/cartesian/constants":252,"../../plots/font_attributes":274,"./arrow_paths":58}],60:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("./draw").draw;function o(e){var t=e._fullLayout;n.filterVisible(t.annotations).forEach((function(t){var r=a.getFromId(e,t.xref),n=a.getFromId(e,t.yref),i=a.getRefType(t.xref),o=a.getRefType(t.yref);t._extremes={},"range"===i&&l(t,r),"range"===o&&l(t,n)}))}function l(e,t){var r,n=t._id,i=n.charAt(0),o=e[i],l=e["a"+i],s=e[i+"ref"],c=e["a"+i+"ref"],u=e["_"+i+"padplus"],f=e["_"+i+"padminus"],d={x:1,y:-1}[i]*e[i+"shift"],p=3*e.arrowsize*e.arrowwidth||0,h=p+d,g=p-d,v=3*e.startarrowsize*e.arrowwidth||0,m=v+d,y=v-d;if(c===s){var x=a.findExtremes(t,[t.r2c(o)],{ppadplus:h,ppadminus:g}),b=a.findExtremes(t,[t.r2c(l)],{ppadplus:Math.max(u,m),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else m=l?m+l:m,y=l?y-l:y,r=a.findExtremes(t,[t.r2c(o)],{ppadplus:Math.max(u,h,m),ppadminus:Math.max(f,g,y)});e._extremes[n]=r}t.exports=function(e){var t=e._fullLayout;if(n.filterVisible(t.annotations).length&&e._fullData.length)return n.syncOrAsync([i,o],e)}},{"../../lib":201,"../../plots/cartesian/axes":246,"./draw":65}],61:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("../../plot_api/plot_template").arrayEditor;function o(e,t){var r,n,a,i,o,s,c,u=e._fullLayout.annotations,f=[],d=[],p=[],h=(t||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(e,t){var r,l,s=o(e,t),c=s.on,u=s.off.concat(s.explicitOff),f={},d=e._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[t]}for(var Y=!1,X=["x","y"],W=0;W1)&&(ne===re?((pe=ae.r2fraction(t["a"+te]))<0||pe>1)&&(Y=!0):Y=!0),Q=ae._offset+ae.r2p(t[te]),K=.5}else{var he="domain"===de;"x"===te?($=t[te],Q=he?ae._offset+ae._length*$:Q=T.l+T.w*$):($=1-t[te],Q=he?ae._offset+ae._length*$:Q=T.t+T.h*$),K=t.showarrow?.5:$}if(t.showarrow){fe.head=Q;var ge=t["a"+te];if(ee=oe*q(.5,t.xanchor)-le*q(.5,t.yanchor),ne===re){var ve=s.getRefType(ne);"domain"===ve?("y"===te&&(ge=1-ge),fe.tail=ae._offset+ae._length*ge):"paper"===ve?"y"===te?(ge=1-ge,fe.tail=T.t+T.h*ge):fe.tail=T.l+T.w*ge:fe.tail=ae._offset+ae.r2p(ge),J=ee}else fe.tail=Q+ge,J=ee+ge;fe.text=fe.tail+ee;var me=w["x"===te?"width":"height"];if("paper"===re&&(fe.head=o.constrain(fe.head,1,me-1)),"pixel"===ne){var ye=-Math.max(fe.tail-3,fe.text),xe=Math.min(fe.tail+3,fe.text)-me;ye>0?(fe.tail+=ye,fe.text+=ye):xe>0&&(fe.tail-=xe,fe.text-=xe)}fe.tail+=ue,fe.head+=ue}else J=ee=se*q(K,ce),fe.text=Q+ee;fe.text+=ue,ee+=ue,J+=ue,t["_"+te+"padplus"]=se/2+J,t["_"+te+"padminus"]=se/2-J,t["_"+te+"size"]=se,t["_"+te+"shift"]=ee}if(Y)I.remove();else{var be=0,_e=0;if("left"!==t.align&&(be=(M-b)*("center"===t.align?.5:1)),"top"!==t.valign&&(_e=(E-_)*("middle"===t.valign?.5:1)),f)n.select("svg").attr({x:H+be-1,y:H+_e}).call(u.setClipUrl,B?C:null,e);else{var we=H+_e-g.top,Te=H+be-g.left;G.call(d.positionText,Te,we).call(u.setClipUrl,B?C:null,e)}V.select("rect").call(u.setRect,H,H,M,E),j.call(u.setRect,F/2,F/2,N-F,U-F),I.call(u.setTranslate,Math.round(O.x.text-N/2),Math.round(O.y.text-U/2)),z.attr({transform:"rotate("+D+","+O.x.text+","+O.y.text+")"});var ke,Me=function(r,n){P.selectAll(".annotation-arrow-g").remove();var s=O.x.head,f=O.y.head,d=O.x.tail+r,p=O.y.tail+n,g=O.x.text+r,b=O.y.text+n,_=o.rotationXYMatrix(D,g,b),w=o.apply2DTransform(_),M=o.apply2DTransform2(_),C=+j.attr("width"),R=+j.attr("height"),E=g-.5*C,F=E+C,N=b-.5*R,H=N+R,B=[[E,N,E,H],[E,H,F,H],[F,H,F,N],[F,N,E,N]].map(M);if(!B.reduce((function(e,t){return e^!!o.segmentsIntersect(s,f,s+1e6,f+1e6,t[0],t[1],t[2],t[3])}),!1)){B.forEach((function(e){var t=o.segmentsIntersect(d,p,s,f,e[0],e[1],e[2],e[3]);t&&(d=t.x,p=t.y)}));var V=t.arrowwidth,U=t.arrowcolor,q=t.arrowside,G=P.append("g").style({opacity:c.opacity(U)}).classed("annotation-arrow-g",!0),Z=G.append("path").attr("d","M"+d+","+p+"L"+s+","+f).style("stroke-width",V+"px").call(c.stroke,c.rgb(U));if(v(Z,q,t),k.annotationPosition&&Z.node().parentNode&&!i){var Y=s,X=f;if(t.standoff){var W=Math.sqrt(Math.pow(s-d,2)+Math.pow(f-p,2));Y+=t.standoff*(d-s)/W,X+=t.standoff*(p-f)/W}var Q,J,$=G.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-Y)+","+(p-X),transform:l(Y,X)}).style("stroke-width",V+6+"px").call(c.stroke,"rgba(0,0,0,0)").call(c.fill,"rgba(0,0,0,0)");h.init({element:$.node(),gd:e,prepFn:function(){var e=u.getTranslate(I);Q=e.x,J=e.y,m&&m.autorange&&A(m._name+".autorange",!0),x&&x.autorange&&A(x._name+".autorange",!0)},moveFn:function(e,r){var n=w(Q,J),a=n[0]+e,i=n[1]+r;I.call(u.setTranslate,a,i),L("x",y(m,e,"x",T,t)),L("y",y(x,r,"y",T,t)),t.axref===t.xref&&L("ax",y(m,e,"ax",T,t)),t.ayref===t.yref&&L("ay",y(x,r,"ay",T,t)),G.attr("transform",l(e,r)),z.attr({transform:"rotate("+D+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",e,S());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}};if(t.showarrow&&Me(0,0),R)h.init({element:I.node(),gd:e,prepFn:function(){ke=z.attr("transform")},moveFn:function(e,r){var n="pointer";if(t.showarrow)t.axref===t.xref?L("ax",y(m,e,"ax",T,t)):L("ax",t.ax+e),t.ayref===t.yref?L("ay",y(x,r,"ay",T.w,t)):L("ay",t.ay+r),Me(e,r);else{if(i)return;var a,o;if(m)a=y(m,e,"x",T,t);else{var s=t._xsize/T.w,c=t.x+(t._xshift-t.xshift)/T.w-s/2;a=h.align(c+e/T.w,s,0,1,t.xanchor)}if(x)o=y(x,r,"y",T,t);else{var u=t._ysize/T.h,f=t.y-(t._yshift+t.yshift)/T.h-u/2;o=h.align(f-r/T.h,u,0,1,t.yanchor)}L("x",a),L("y",o),m&&x||(n=h.getCursor(m?.5:a,x?.5:o,t.xanchor,t.yanchor))}z.attr({transform:l(e,r)+ke}),p(I,n)},clickFn:function(r,n){t.captureevents&&e.emit("plotly_clickannotation",Z(n))},doneFn:function(){p(I),a.call("_guiRelayout",e,S());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}}t.exports={draw:function(e){var t=e._fullLayout;t._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,x=t.indexOf("end")>=0,b=h.backoff*v+r.standoff,_=g.backoff*m+r.startstandoff;if("line"===p.nodeName){o={x:+e.attr("x1"),y:+e.attr("y1")},u={x:+e.attr("x2"),y:+e.attr("y2")};var w=o.x-u.x,T=o.y-u.y;if(d=(f=Math.atan2(T,w))+Math.PI,b&&_&&b+_>Math.sqrt(w*w+T*T))return void R();if(b){if(b*b>w*w+T*T)return void R();var k=b*Math.cos(f),M=b*Math.sin(f);u.x+=k,u.y+=M,e.attr({x2:u.x,y2:u.y})}if(_){if(_*_>w*w+T*T)return void R();var A=_*Math.cos(f),L=_*Math.sin(f);o.x-=A,o.y-=L,e.attr({x1:o.x,y1:o.y})}}else if("path"===p.nodeName){var S=p.getTotalLength(),C="";if(S1){c=!0;break}}c?e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove():(s._pdata=a(e.glplot.cameraParams,[t.xaxis.r2l(s.x)*r[0],t.yaxis.r2l(s.y)*r[1],t.zaxis.r2l(s.z)*r[2]]),n(e.graphDiv,s,l,e.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":277,"../annotations/draw":65}],72:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:e("./attributes")}}},layoutAttributes:e("./attributes"),handleDefaults:e("./defaults"),includeBasePlot:function(e,t){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var i=r.attrRegex,o=Object.keys(e),l=0;l=0))return e;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return e}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(e){var t=e.toRgb();return"rgb("+Math.round(t.r)+", "+Math.round(t.g)+", "+Math.round(t.b)+")"},i.rgb=function(e){return i.tinyRGB(n(e))},i.opacity=function(e){return e?n(e).getAlpha():0},i.addOpacity=function(e,t){var r=n(e).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+t+")"},i.combine=function(e,t){var r=n(e).toRgb();if(1===r.a)return n(e).toRgbString();var a=n(t||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(e,t,r){var a=n(e);return 1!==a.getAlpha()&&(a=n(i.combine(e,s))),(a.isDark()?t?a.lighten(t):s:r?a.darken(r):l).toString()},i.stroke=function(e,t){var r=n(t);e.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(e,t){var r=n(t);e.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(e){if(e&&"object"==typeof e){var t,r,n,a,o=Object.keys(e);for(t=0;t0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var Q=Math.pow(10,Math.floor(Math.log(W)/Math.LN10));Y*=Q*c.roundUp(W/Q,[2,5,10]),(Math.abs(O.start)/O.size+1e-6)%1<2e-6&&(Z.tick0=0)}Z.dtick=Y}Z.domain=[U+j,U+F-j],Z.setScale(),e.attr("transform",u(Math.round(s.l),Math.round(s.t)));var J,$=e.select("."+M.cbtitleunshift).attr("transform",u(-Math.round(s.l),-Math.round(s.t))),K=e.select("."+M.cbaxis),ee=0;function te(n,a){var i={propContainer:Z,propName:t._propPrefix+"title",traceIndex:t._traceIndex,_meta:t._meta,placeholder:o._dfltTitle.colorbar,containerGroup:e.select("."+M.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;e.selectAll("."+l+",."+l+"-math-group").remove(),g.draw(r,n,f(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(A)){var e,r=s.l+(t.x+N)*s.w,n=Z.title.font.size;e="top"===A?(1-(U+F-j))*s.h+s.t+3+.75*n:(1-(U+j))*s.h+s.t-3-.25*n,te(Z._id+"title",{attributes:{x:r,y:e,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(A)){var i=e.select("."+M.cbtitle),o=i.select("text"),f=[-t.outlinewidth/2,t.outlinewidth/2],d=i.select(".h"+Z._id+"title-math-group").node(),h=15.6;if(o.node()&&(h=parseInt(o.node().style.fontSize,10)*w),d?(ee=p.bBox(d).height)>h&&(f[1]-=(ee-h)/2):o.node()&&!o.classed(M.jsPlaceholder)&&(ee=p.bBox(o.node()).height),ee){if(ee+=5,"top"===A)Z.domain[1]-=ee/s.h,f[1]*=-1;else{Z.domain[0]+=ee/s.h;var g=v.lineCount(o);f[1]+=(1-g)*h}i.attr("transform",u(f[0],f[1])),Z.setScale()}}e.selectAll("."+M.cbfills+",."+M.cblines).attr("transform",u(0,Math.round(s.h*(1-Z.domain[1])))),K.attr("transform",u(0,Math.round(-s.t)));var y=e.select("."+M.cbfills).selectAll("rect."+M.cbfill).attr("style","").data(P);y.enter().append("rect").classed(M.cbfill,!0).style("stroke","none"),y.exit().remove();var x=L.map(Z.c2p).map(Math.round).sort((function(e,t){return e-t}));y.each((function(e,i){var o=[0===i?L[0]:(P[i]+P[i-1])/2,i===P.length-1?L[1]:(P[i]+P[i+1])/2].map(Z.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,x[0],x[1]);var l=n.select(this).attr({x:B,width:Math.max(R,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(t._fillgradient)p.gradient(l,r,t._id,"vertical",t._fillgradient,"fill");else{var s=C(e).replace("e-","");l.attr("fill",a(s).toHexString())}}));var b=e.select("."+M.cblines).selectAll("path."+M.cbline).data(m.color&&m.width?z:[]);b.enter().append("path").classed(M.cbline,!0),b.exit().remove(),b.each((function(e){n.select(this).attr("d","M"+B+","+(Math.round(Z.c2p(e))+m.width/2%1)+"h"+R).call(p.lineGroupStyle,m.width,S(e),m.dash)})),K.selectAll("g."+Z._id+"tick,path").remove();var _=B+R+(t.outlinewidth||0)/2-("outside"===t.ticks?1:0),T=l.calcTicks(Z),k=l.getTickSigns(Z)[2];return l.drawTicks(r,Z,{vals:"inside"===Z.ticks?l.clipEnds(Z,T):T,layer:K,path:l.makeTickPath(Z,_,k),transFn:l.makeTransTickFn(Z)}),l.drawLabels(r,Z,{vals:T,layer:K,transFn:l.makeTransTickLabelFn(Z),labelFns:l.makeLabelFns(Z,_)})},function(){if(-1===["top","bottom"].indexOf(A)){var e=Z.title.font.size,t=Z._offset+Z._length/2,a=s.l+(Z.position||0)*s.w+("right"===Z.side?10+e*(Z.showticklabels?1:.5):-10-e*(Z.showticklabels?.5:0));te("h"+Z._id+"title",{avoid:{selection:n.select(r).selectAll("g."+Z._id+"tick"),side:A,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:t,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=R+t.outlinewidth/2;if(-1===Z.ticklabelposition.indexOf("inside")&&(n+=p.bBox(K.node()).width),(J=$.select("text")).node()&&!J.classed(M.jsPlaceholder)){var a,o=$.select(".h"+Z._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(A)?p.bBox(o).width:p.bBox($.node()).right-B-s.l,n=Math.max(n,a)}var l=2*t.xpad+n+t.borderwidth+t.outlinewidth/2,c=q-G;e.select("."+M.cbbg).attr({x:B-t.xpad-(t.borderwidth+t.outlinewidth)/2,y:G-H,width:Math.max(l,2),height:Math.max(c+2*H,2)}).call(h.fill,t.bgcolor).call(h.stroke,t.bordercolor).style("stroke-width",t.borderwidth),e.selectAll("."+M.cboutline).attr({x:B,y:G+t.ypad+("top"===A?ee:0),width:Math.max(R,2),height:Math.max(c-2*t.ypad-ee,2)}).call(h.stroke,t.outlinecolor).style({fill:"none","stroke-width":t.outlinewidth});var f=({center:.5,right:1}[t.xanchor]||0)*l;e.attr("transform",u(s.l-f,s.t));var d={},g=T[t.yanchor],v=k[t.yanchor];"pixels"===t.lenmode?(d.y=t.y,d.t=c*g,d.b=c*v):(d.t=d.b=0,d.yt=t.y+t.len*g,d.yb=t.y-t.len*v);var m=T[t.xanchor],y=k[t.xanchor];if("pixels"===t.thicknessmode)d.x=t.x,d.l=l*m,d.r=l*y;else{var x=l-R;d.l=x*m,d.r=x*y,d.xl=t.x-t.thickness*m,d.xr=t.x+t.thickness*y}i.autoMargin(r,t._id,d)}],r)}(r,t,e);m&&m.then&&(e._promises||[]).push(m),e._context.edits.colorbarPosition&&function(e,t,r){var n,a,i,l=r._fullLayout._size;s.init({element:e.node(),gd:r,prepFn:function(){n=e.attr("transform"),d(e)},moveFn:function(r,o){e.attr("transform",n+u(r,o)),a=s.align(t._xLeftFrac+r/l.w,t._thickFrac,0,1,t.xanchor),i=s.align(t._yBottomFrac-o/l.h,t._lenFrac,0,1,t.yanchor);var c=s.getCursor(a,i,t.xanchor,t.yanchor);d(e,c)},doneFn:function(){if(d(e),void 0!==a&&void 0!==i){var n={};n[t._propPrefix+"x"]=a,n[t._propPrefix+"y"]=i,void 0!==t._traceIndex?o.call("_guiRestyle",r,n,t._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,t,e)})),t.exit().each((function(t){i.autoMargin(e,t._id)})).remove(),t.order()}}},{"../../constants/alignment":176,"../../lib":201,"../../lib/extend":195,"../../lib/setcursor":220,"../../lib/svg_text_utils":222,"../../plots/cartesian/axes":246,"../../plots/cartesian/axis_defaults":248,"../../plots/cartesian/layout_attributes":260,"../../plots/cartesian/position_defaults":263,"../../plots/plots":280,"../../registry":288,"../color":74,"../colorscale/helpers":85,"../dragelement":93,"../drawing":96,"../titles":169,"./constants":76,d3:9,tinycolor2:57}],79:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e){return n.isPlainObject(e.colorbar)}},{"../../lib":201}],80:[function(e,t,r){"use strict";t.exports={moduleType:"component",name:"colorbar",attributes:e("./attributes"),supplyDefaults:e("./defaults"),draw:e("./draw").draw,hasColorbar:e("./has_colorbar")}},{"./attributes":75,"./defaults":77,"./draw":78,"./has_colorbar":79}],81:[function(e,t,r){"use strict";var n=e("../colorbar/attributes"),a=e("../../lib/regex").counter,i=e("./scales.js").scales;Object.keys(i);function o(e){return"`"+e+"`"}t.exports=function(e,t){e=e||"";var r,l=(t=t||{}).cLetter||"c",s=("onlyIfNumerical"in t?t.onlyIfNumerical:Boolean(e),"noScale"in t?t.noScale:"marker.line"===e),c="showScaleDflt"in t?t.showScaleDflt:"z"===l,u="string"==typeof t.colorscaleDflt?i[t.colorscaleDflt]:null,f=t.editTypeOverride||"",d=e?e+".":"";"colorAttr"in t?(r=t.colorAttr,t.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},t.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==t.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),t.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":216,"../colorbar/attributes":75,"./scales.js":89}],82:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("./helpers").extractOpts;t.exports=function(e,t,r){var o,l=e._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(t,c).get():t,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":201,"./helpers":85,"fast-isnumeric":11}],83:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./helpers").hasColorscale,i=e("./helpers").extractOpts;t.exports=function(e,t){function r(e,t){var r=e["_"+t];void 0!==r&&(e[t]=r)}function o(e,a){var o=a.container?n.nestedProperty(e,a.container).get():e;if(o)if(o.coloraxis)o._colorAx=t[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=e[n];r[a]=[1-i[0],i[1]]}return r}function h(e,t){t=t||{};for(var r=e.domain,o=e.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],91:[function(e,t,r){"use strict";var n=e("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];t.exports=function(e,t,r,i){return e="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*e),0,2),t="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*t),0,2),a[t][e]}},{"../../lib":201}],92:[function(e,t,r){"use strict";r.selectMode=function(e){return"lasso"===e||"select"===e},r.drawMode=function(e){return"drawclosedpath"===e||"drawopenpath"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.openMode=function(e){return"drawline"===e||"drawopenpath"===e},r.rectMode=function(e){return"select"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.freeMode=function(e){return"lasso"===e||"drawclosedpath"===e||"drawopenpath"===e},r.selectingOrDrawing=function(e){return r.freeMode(e)||r.rectMode(e)}},{}],93:[function(e,t,r){"use strict";var n=e("mouse-event-offset"),a=e("has-hover"),i=e("has-passive-events"),o=e("../../lib").removeElement,l=e("../../plots/cartesian/constants"),s=t.exports={};s.align=e("./align"),s.getCursor=e("./cursor");var c=e("./unhover");function u(){var e=document.createElement("div");e.className="dragcover";var t=e.style;return t.position="fixed",t.left=0,t.right=0,t.top=0,t.bottom=0,t.zIndex=999999999,t.background="none",document.body.appendChild(e),e}function f(e){return n(e.changedTouches?e.changedTouches[0]:e,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(e){var t,r,n,c,d,p,h,g,v=e.gd,m=1,y=v._context.doubleClickDelay,x=e.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=e.clampFn||function(e,t,r){return Math.abs(e)y&&(m=Math.max(m-1,1)),v._dragged)e.doneFn&&e.doneFn();else if(e.clickFn&&e.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",t)}catch(e){var n=f(t);(r=document.createEvent("MouseEvents")).initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,n[0],n[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":201,"../../plots/cartesian/constants":252,"./align":90,"./cursor":91,"./unhover":94,"has-hover":42,"has-passive-events":43,"mouse-event-offset":46}],94:[function(e,t,r){"use strict";var n=e("../../lib/events"),a=e("../../lib/throttle"),i=e("../../lib/dom").getGraphDiv,o=e("../fx/constants"),l=t.exports={};l.wrapped=function(e,t,r){(e=i(e))._fullLayout&&a.clear(e._fullLayout._uid+o.HOVERID),l.raw(e,t,r)},l.raw=function(e,t){var r=e._fullLayout,a=e._hoverdata;t||(t={}),t.target&&!1===n.triggerHandler(e,"plotly_beforehover",t)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,t.target&&a&&e.emit("plotly_unhover",{event:t,points:a}))}},{"../../lib/dom":193,"../../lib/events":194,"../../lib/throttle":223,"../fx/constants":108}],95:[function(e,t,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],96:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("tinycolor2"),o=e("../../registry"),l=e("../color"),s=e("../colorscale"),c=e("../../lib"),u=c.strTranslate,f=e("../../lib/svg_text_utils"),d=e("../../constants/xmlns_namespaces"),p=e("../../constants/alignment").LINE_SPACING,h=e("../../constants/interactions").DESELECTDIM,g=e("../../traces/scatter/subtypes"),v=e("../../traces/scatter/make_bubble_size_func"),m=e("../../components/fx/helpers").appendArrayPointValue,y=t.exports={};y.font=function(e,t,r,n){c.isPlainObject(t)&&(n=t.color,r=t.size,t=t.family),t&&e.style("font-family",t),r+1&&e.style("font-size",r+"px"),n&&e.call(l.fill,n)},y.setPosition=function(e,t,r){e.attr("x",t).attr("y",r)},y.setSize=function(e,t,r){e.attr("width",t).attr("height",r)},y.setRect=function(e,t,r,n,a){e.call(y.setPosition,t,r).call(y.setSize,n,a)},y.translatePoint=function(e,t,r,n){var i=r.c2p(e.x),o=n.c2p(e.y);return!!(a(i)&&a(o)&&t.node())&&("text"===t.node().nodeName?t.attr("x",i).attr("y",o):t.attr("transform",u(i,o)),!0)},y.translatePoints=function(e,t,r){e.each((function(e){var a=n.select(this);y.translatePoint(e,a,t,r)}))},y.hideOutsideRangePoint=function(e,t,r,n,a,i){t.attr("display",r.isPtWithinRange(e,a)&&n.isPtWithinRange(e,i)?null:"none")},y.hideOutsideRangePoints=function(e,t){if(t._hasClipOnAxisFalse){var r=t.xaxis,a=t.yaxis;e.each((function(t){var i=t[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";e.selectAll(c).each((function(e){y.hideOutsideRangePoint(e,n.select(this),r,a,l,s)}))}))}},y.crispRound=function(e,t,r){return t&&a(t)?e._context.staticPlot?t:t<1?1:Math.round(t):r||0},y.singleLineStyle=function(e,t,r,n,a){t.style("fill","none");var i=(((e||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(t,n||i.color),y.dashLine(t,s,o)},y.lineGroupStyle=function(e,t,r,a){e.style("fill","none").each((function(e){var i=(((e||[])[0]||{}).trace||{}).line||{},o=t||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(y.dashLine,s,o)}))},y.dashLine=function(e,t,r){r=+r||0,t=y.dashStyle(t,r),e.style({"stroke-dasharray":t,"stroke-width":r+"px"})},y.dashStyle=function(e,t){t=+t||1;var r=Math.max(t,3);return"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),e},y.singleFillStyle=function(e){var t=(((n.select(e.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;t&&e.call(l.fill,t)},y.fillGroupStyle=function(e){e.style("stroke-width",0).each((function(e){var t=n.select(this);e[0].trace&&t.call(l.fill,e[0].trace.fillcolor)}))};var x=e("./symbol_defs");y.symbolNames=[],y.symbolFuncs=[],y.symbolNeedLines={},y.symbolNoDot={},y.symbolNoFill={},y.symbolList=[],Object.keys(x).forEach((function(e){var t=x[e],r=t.n;y.symbolList.push(r,String(r),e,r+100,String(r+100),e+"-open"),y.symbolNames[r]=e,y.symbolFuncs[r]=t.f,t.needLine&&(y.symbolNeedLines[r]=!0),t.noDot?y.symbolNoDot[r]=!0:y.symbolList.push(r+200,String(r+200),e+"-dot",r+300,String(r+300),e+"-open-dot"),t.noFill&&(y.symbolNoFill[r]=!0)}));var b=y.symbolNames.length;function _(e,t){var r=e%100;return y.symbolFuncs[r](t)+(e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}y.symbolNumber=function(e){if(a(e))e=+e;else if("string"==typeof e){var t=0;e.indexOf("-open")>0&&(t=100,e=e.replace("-open","")),e.indexOf("-dot")>0&&(t+=200,e=e.replace("-dot","")),(e=y.symbolNames.indexOf(e))>=0&&(e+=t)}return e%100>=b||e>=400?0:Math.floor(Math.max(e,0))};var w={x1:1,x2:0,y1:0,y2:0},T={x1:0,x2:0,y1:1,y2:0},k=n.format("~.1f"),M={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:w},horizontalreversed:{node:"linearGradient",attrs:w,reversed:!0},vertical:{node:"linearGradient",attrs:T},verticalreversed:{node:"linearGradient",attrs:T,reversed:!0}};y.gradient=function(e,t,r,a,o,s){for(var u=o.length,f=M[a],d=new Array(u),p=0;p"+m(e);h._gradientUrlQueryParts[y]=1},y.initGradients=function(e){var t=e._fullLayout;c.ensureSingle(t._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),t._gradientUrlQueryParts={}},y.pointStyle=function(e,t,r){if(e.size()){var a=y.makePointStyleFns(t);e.each((function(e){y.singlePointStyle(e,n.select(this),t,a,r)}))}},y.singlePointStyle=function(e,t,r,n,a){var i=r.marker,o=i.line;if(t.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(e):void 0===e.mo?i.opacity:e.mo),n.ms2mrc){var s;s="various"===e.ms||"various"===i.size?3:n.ms2mrc(e.ms),e.mrc=s,n.selectedSizeFn&&(s=e.mrc=n.selectedSizeFn(e));var u=y.symbolNumber(e.mx||i.symbol)||0;e.om=u%200>=100,t.attr("d",_(u,s))}var f,d,p,h=!1;if(e.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(e.mlw+1||g+1||(e.trace?(e.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in e?e.mlcc=n.lineScale(e.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in e?e.mcc=n.markerScale(e.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(e))}if(e.om)t.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{t.style("stroke-width",(e.isBlank?0:p)+"px");var v=i.gradient,m=e.mgt;if(m?h=!0:m=v&&v.type,Array.isArray(m)&&(m=m[0],M[m]||(m=0)),m&&"none"!==m){var x=e.mgc;x?h=!0:x=v.color;var b=r.uid;h&&(b+="-"+e.i),y.gradient(t,a,b,m,[[0,x],[1,f]],"fill")}else l.fill(t,f);p&&l.stroke(t,d)}},y.makePointStyleFns=function(e){var t={},r=e.marker;return t.markerScale=y.tryColorscale(r,""),t.lineScale=y.tryColorscale(r,"line"),o.traceIs(e,"symbols")&&(t.ms2mrc=g.isBubble(e)?v(e):function(){return(r.size||6)/2}),e.selectedpoints&&c.extendFlat(t,y.makeSelectedPointStyleFns(e)),t},y.makeSelectedPointStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,p=void 0!==f;(c.isArrayOrTypedArray(s)||d||p)&&(t.selectedOpacityFn=function(e){var t=void 0===e.mo?a.opacity:e.mo;return e.selected?d?u:t:p?f:h*t});var g=a.color,v=i.color,m=l.color;(v||m)&&(t.selectedColorFn=function(e){var t=e.mcc||g;return e.selected?v||t:m||t});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(e,"symbols")&&(_||w)&&(t.selectedSizeFn=function(e){var t=e.mrc||y/2;return e.selected?_?x/2:t:w?b/2:t}),t},y.makeSelectedTextStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return t.selectedTextColorFn=function(e){var t=e.tc||s;return e.selected?c||t:u||(c?t:l.addOpacity(t,h))},t},y.selectedPointStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=y.makeSelectedPointStyleFns(t),a=t.marker||{},i=[];r.selectedOpacityFn&&i.push((function(e,t){e.style("opacity",r.selectedOpacityFn(t))})),r.selectedColorFn&&i.push((function(e,t){l.fill(e,r.selectedColorFn(t))})),r.selectedSizeFn&&i.push((function(e,t){var n=t.mx||a.symbol||0,i=r.selectedSizeFn(t);e.attr("d",_(y.symbolNumber(n),i)),t.mrc2=i})),i.length&&e.each((function(e){for(var t=n.select(this),r=0;r0?r:0}y.textPointStyle=function(e,t,r){if(e.size()){var a;if(t.selectedpoints){var i=y.makeSelectedTextStyleFns(t);a=i.selectedTextColorFn}var o=t.texttemplate,l=r._fullLayout;e.each((function(e){var i=n.select(this),s=o?c.extractOption(e,t,"txt","texttemplate"):c.extractOption(e,t,"tx","text");if(s||0===s){if(o){var u=t._module.formatLabels?t._module.formatLabels(e,t,l):{},d={};m(d,t,e.i);var p=t._meta||{};s=c.texttemplateString(s,u,l._d3locale,d,e,p)}var h=e.tp||t.textposition,g=S(e,t),v=a?a(e):e.tc||t.textfont.color;i.call(y.font,e.tf||t.textfont.family,g,v).text(s).call(f.convertToTspans,r).call(L,h,g,e.mrc)}else i.remove()}))}},y.selectedTextStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=y.makeSelectedTextStyleFns(t);e.each((function(e){var a=n.select(this),i=r.selectedTextColorFn(e),o=e.tp||t.textposition,s=S(e,t);l.fill(a,i),L(a,o,s,e.mrc2||e.mrc)}))}};function C(e,t,r,a){var i=e[0]-t[0],o=e[1]-t[1],l=r[0]-t[0],s=r[1]-t[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(t[0]+(p&&f/p),2),n.round(t[1]+(p&&d/p),2)],[n.round(t[0]-(h&&f/h),2),n.round(t[1]-(h&&d/h),2)]]}y.smoothopen=function(e,t){if(e.length<3)return"M"+e.join("L");var r,n="M"+e[0],a=[];for(r=1;r=1e4&&(y.savedBBoxes={},P=0),r&&(y.savedBBoxes[r]=v),P++,c.extendFlat({},v)},y.setClipUrl=function(e,t,r){e.attr("clip-path",R(t,r))},y.getTranslate=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||0,y:+t[1]||0}},y.setTranslate=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=u(t,r)).trim(),e[a]("transform",i),i},y.getScale=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||1,y:+t[1]||1}},y.setScale=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+="scale("+t+","+r+")").trim(),e[a]("transform",i),i};var E=/\s*sc.*/;y.setPointGroupScale=function(e,t,r){if(t=t||1,r=r||1,e){var n=1===t&&1===r?"":"scale("+t+","+r+")";e.each((function(){var e=(this.getAttribute("transform")||"").replace(E,"");e=(e+=n).trim(),this.setAttribute("transform",e)}))}};var I=/translate\([^)]*\)\s*$/;y.setTextPointsScale=function(e,t,r){e&&e.each((function(){var e,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(I);e=1===t&&1===r?[]:[u(o,l),"scale("+t+","+r+")",u(-o,-l)],s&&e.push(s),a.attr("transform",e.join(""))}}))}},{"../../components/fx/helpers":110,"../../constants/alignment":176,"../../constants/interactions":179,"../../constants/xmlns_namespaces":181,"../../lib":201,"../../lib/svg_text_utils":222,"../../registry":288,"../../traces/scatter/make_bubble_size_func":345,"../../traces/scatter/subtypes":353,"../color":74,"../colorscale":86,"./symbol_defs":97,d3:9,"fast-isnumeric":11,tinycolor2:57}],97:[function(e,t,r){"use strict";var n=e("d3");t.exports={circle:{n:0,f:function(e){var t=n.round(e,2);return"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"}},square:{n:1,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"}},diamond:{n:2,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"Z"}},cross:{n:3,f:function(e){var t=n.round(.4*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H"+t+"V"+r+"H-"+t+"V"+t+"H-"+r+"V-"+t+"H-"+t+"V-"+r+"H"+t+"V-"+t+"H"+r+"Z"}},x:{n:4,f:function(e){var t=n.round(.8*e/Math.sqrt(2),2),r="l"+t+","+t,a="l"+t+",-"+t,i="l-"+t+",-"+t,o="l-"+t+","+t;return"M0,"+t+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+","+n.round(e/2,2)+"H"+t+"L0,-"+n.round(e,2)+"Z"}},"triangle-down":{n:6,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+",-"+n.round(e/2,2)+"H"+t+"L0,"+n.round(e,2)+"Z"}},"triangle-left":{n:7,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M"+n.round(e/2,2)+",-"+t+"V"+t+"L-"+n.round(e,2)+",0Z"}},"triangle-right":{n:8,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+n.round(e/2,2)+",-"+t+"V"+t+"L"+n.round(e,2)+",0Z"}},"triangle-ne":{n:9,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+r+",-"+t+"H"+t+"V"+r+"Z"}},"triangle-se":{n:10,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+t+",-"+r+"V"+t+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H-"+t+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+t+","+r+"V-"+t+"H"+r+"Z"}},pentagon:{n:13,f:function(e){var t=n.round(.951*e,2),r=n.round(.588*e,2),a=n.round(-e,2),i=n.round(-.309*e,2);return"M"+t+","+i+"L"+r+","+n.round(.809*e,2)+"H-"+r+"L-"+t+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+t+"L-"+a+","+r+"V-"+r+"L0,-"+t+"Z"}},hexagon2:{n:15,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+t+",0L"+r+",-"+a+"H-"+r+"L-"+t+",0Z"}},octagon:{n:16,f:function(e){var t=n.round(.924*e,2),r=n.round(.383*e,2);return"M-"+r+",-"+t+"H"+r+"L"+t+",-"+r+"V"+r+"L"+r+","+t+"H-"+r+"L-"+t+","+r+"V-"+r+"Z"}},star:{n:17,f:function(e){var t=1.4*e,r=n.round(.225*t,2),a=n.round(.951*t,2),i=n.round(.363*t,2),o=n.round(.588*t,2),l=n.round(-t,2),s=n.round(-.309*t,2),c=n.round(.118*t,2),u=n.round(.809*t,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*t,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(e){var t=n.round(.66*e,2),r=n.round(.38*e,2),a=n.round(.76*e,2);return"M-"+a+",0l-"+r+",-"+t+"h"+a+"l"+r+",-"+t+"l"+r+","+t+"h"+a+"l-"+r+","+t+"l"+r+","+t+"h-"+a+"l-"+r+","+t+"l-"+r+",-"+t+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+t+","+r+o+t+","+r+o+"0,-"+a+o+"-"+t+","+r+"Z"}},"star-triangle-down":{n:20,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M"+t+",-"+r+o+"-"+t+",-"+r+o+"0,"+a+o+t+",-"+r+"Z"}},"star-square":{n:21,f:function(e){var t=n.round(1.1*e,2),r=n.round(2*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",-"+t+a+"-"+t+","+t+a+t+","+t+a+t+",-"+t+a+"-"+t+",-"+t+"Z"}},"star-diamond":{n:22,f:function(e){var t=n.round(1.4*e,2),r=n.round(1.9*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",0"+a+"0,"+t+a+t+",0"+a+"0,-"+t+a+"-"+t+",0Z"}},"diamond-tall":{n:23,f:function(e){var t=n.round(.7*e,2),r=n.round(1.4*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},"diamond-wide":{n:24,f:function(e){var t=n.round(1.4*e,2),r=n.round(.7*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},hourglass:{n:25,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"L"+t+",-"+t+"H-"+t+"Z"},noDot:!0},bowtie:{n:26,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"V-"+t+"L-"+t+","+t+"V-"+t+"Z"},noDot:!0},"circle-cross":{n:27,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(e){var t=n.round(e,2),r=n.round(e/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM0,-"+t+"V"+t+"M-"+t+",0H"+t},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(e){var t=n.round(1.3*e,2),r=n.round(.65*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(e){var t=n.round(1.2*e,2),r=n.round(.85*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(e){var t=n.round(e/2,2),r=n.round(e,2);return"M"+t+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+t+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+","+a+"L0,0M"+t+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+",-"+a+"L0,0M"+t+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M"+a+","+t+"L0,0M"+a+",-"+t+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+a+","+t+"L0,0M-"+a+",-"+t+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(e){var t=n.round(1.4*e,2);return"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(e){var t=n.round(e,2);return"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t},needLine:!0,noDot:!0,noFill:!0},"arrow-up":{n:45,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-down":{n:46,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-left":{n:47,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L-"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L-"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:9}],98:[function(e,t,r){"use strict";t.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"}}}},{}],99:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../registry"),i=e("../../plots/cartesian/axes"),o=e("../../lib"),l=e("./compute_error");function s(e,t,r,a){var s=t["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;t.each((function(t){var f,d=t[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(e){return e.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(t=[]);var v=n.select(this).selectAll("g.errorbar").data(t,f);if(v.exit().remove(),t.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.setClipUrl(v,r.layerClipId,e),v.each((function(e){var t=n.select(this),r=function(e,t,r){var n={x:t.c2p(e.x),y:r.c2p(e.y)};void 0!==e.yh&&(n.yh=r.c2p(e.yh),n.ys=r.c2p(e.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(e.ys,!0)));void 0!==e.xh&&(n.xh=t.c2p(e.xh),n.xs=t.c2p(e.xs),a(n.xs)||(n.noXS=!0,n.xs=t.c2p(e.xs,!0)));return n}(e,s,c);if(!g||e.vis){var i,o=t.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=t.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=t.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=t.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":353,"../drawing":96,d3:9,"fast-isnumeric":11}],104:[function(e,t,r){"use strict";var n=e("d3"),a=e("../color");t.exports=function(e){e.each((function(e){var t=e[0].trace,r=t.error_y||{},i=t.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":74,d3:9}],105:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("./layout_attributes").hoverlabel,i=e("../../lib/extend").extendFlat;t.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":195,"../../plots/font_attributes":274,"./layout_attributes":115}],106:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry");function i(e,t,r,a){a=a||n.identity,Array.isArray(e)&&(t[0][r]=a(e))}t.exports=function(e){var t=e.calcdata,r=e._fullLayout;function o(e){return function(t){return n.coerceHoverinfo({hoverinfo:t},{_module:e._module},r)}}for(var l=0;l=0&&r.indexb[0]._length||ee<0||ee>_[0]._length)return h.unhoverRaw(e,t)}if(t.pointerX=K+b[0]._offset,t.pointerY=ee+_[0]._offset,C="xval"in t?m.flat(l,t.xval):m.p2c(b,K),D="yval"in t?m.flat(l,t.yval):m.p2c(_,ee),!a(C[0])||!a(D[0]))return o.warn("Fx.hover failed",t,e),h.unhoverRaw(e,t)}var ne=1/0;function ae(e,r){for(F=0;FZ&&(W.splice(0,Z),ne=W[0].distance),g&&0!==X&&0===W.length){G.distance=X,G.index=!1;var f=H._module.hoverPoints(G,U,q,"closest",s._hoverlayer);if(f&&(f=f.filter((function(e){return e.spikeDistance<=X}))),f&&f.length){var d,h=f.filter((function(e){return e.xa.showspikes&&"hovered data"!==e.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(d=oe(v),(!J.vLinePoint||J.vLinePoint.spikeDistance>d.spikeDistance)&&(J.vLinePoint=d))}var y=f.filter((function(e){return e.ya.showspikes&&"hovered data"!==e.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(d=oe(x),(!J.hLinePoint||J.hLinePoint.spikeDistance>d.spikeDistance)&&(J.hLinePoint=d))}}}}}function ie(e,t){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===L&&$&&W.length>1,Ae=p.combine(s.plot_bgcolor||p.background,s.paper_bgcolor),Le={hovermode:L,rotateLabels:Me,bgColor:Ae,container:s._hoverlayer,outerContainer:s._paperdiv,commonLabelOpts:s.hoverlabel,hoverdistance:s.hoverdistance},Se=O(W,Le,e);m.isUnifiedHover(L)||(!function(e,t,r){var n,a,i,o,l,s,c,u=0,f=1,d=e.size(),p=new Array(d),h=0;function g(e){var t=e[0],r=e[e.length-1];if(a=t.pmin-t.pos-t.dp+t.size,i=r.pos+r.dp+r.size-t.pmax,a>.01){for(l=e.length-1;l>=0;l--)e[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=e.length-1;l>=0;l--)e[l].dp-=i;n=!1}if(n){var c=0;for(o=0;ot.pmax&&c++;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos>t.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)e[l].dp-=i;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos+s.dp+s.size>t.pmax&&(s.del=!0,c--)}}}e.each((function(e){var n=e[t],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:e,traceIndex:e.trace.index,dp:0,pos:e.pos,posref:e.posref,size:e.by*(a?T:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(e,t){return e[0].posref-t[0].posref||f*(t[0].traceIndex-e[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var _=b[l],w=_.datum;w.offset=_.dp,w.del=_.del}}}(Se,Me?"xa":"ya",s),P(Se,Me,s._invScaleX,s._invScaleY));if(t.target&&t.target.tagName){var Ce=v.getComponentMethod("annotations","hasClickToShow")(e,_e);f(n.select(t.target),Ce?"pointer":"")}if(!t.target||i||!function(e,t,r){if(!r||r.length!==e._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=e._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(e,0,be))return;be&&e.emit("plotly_unhover",{event:t,points:be});e.emit("plotly_hover",{event:t,points:e._hoverdata,xaxes:b,yaxes:_,xvals:C,yvals:D})}(e,t,r,i)}))},r.loneHover=function(e,t){var r=!0;Array.isArray(e)||(r=!1,e=[e]);var a=e.map((function(e){return{color:e.color||p.defaultLine,x0:e.x0||e.x||0,x1:e.x1||e.x||0,y0:e.y0||e.y||0,y1:e.y1||e.y||0,xLabel:e.xLabel,yLabel:e.yLabel,zLabel:e.zLabel,text:e.text,name:e.name,idealAlign:e.idealAlign,borderColor:e.borderColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontColor:e.fontColor,nameLength:e.nameLength,textAlign:e.textAlign,trace:e.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:e.hovertemplate||!1,eventData:e.eventData||!1,hovertemplateLabels:e.hovertemplateLabels||!1}})),i=n.select(t.container),o=t.outerContainer?n.select(t.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:t.bgColor||p.background,container:i,outerContainer:o},s=O(a,l,t.gd),c=0,u=0;s.sort((function(e,t){return e.y0-t.y0})).each((function(e,r){var n=e.y0-e.by/2;e.offset=n-5([\s\S]*)<\/extra>/;function O(e,t,r){var a=r._fullLayout,i=t.hovermode,c=t.rotateLabels,f=t.bgColor,h=t.container,g=t.outerContainer,v=t.commonLabelOpts||{},w=t.fontFamily||y.HOVERFONT,T=t.fontSize||y.HOVERFONTSIZE,k=e[0],M=k.xa,C=k.ya,O="y"===i.charAt(0)?"yLabel":"xLabel",P=k[O],z=(String(P)||"").split(" ")[0],R=g.node().getBoundingClientRect(),E=R.top,I=R.width,F=R.height,N=void 0!==P&&k.distance<=t.hoverdistance&&("x"===i||"y"===i);if(N){var H,j,B=!0;for(H=0;Ha.width-S?(y=a.width-S,s.attr("d","M"+(S-A)+",0L"+S+","+_+A+"v"+_+(2*L+b.height)+"H-"+S+"V"+_+A+"H"+(S-2*A)+"Z")):s.attr("d","M0,0L"+A+","+_+A+"H"+(L+b.width/2)+"v"+_+(2*L+b.height)+"H-"+(L+b.width/2)+"V"+_+A+"H-"+A+"Z")}else{var O,D,z;"right"===C.side?(O="start",D=1,z="",y=M._offset+M._length):(O="end",D=-1,z="-",y=M._offset),x=C._offset+(k.y0+k.y1)/2,c.attr("text-anchor",O),s.attr("d","M0,0L"+z+A+","+A+"V"+(L+b.height/2)+"h"+z+(2*L+b.width)+"V-"+(L+b.height/2)+"H"+z+A+"V-"+A+"Z");var R,I=b.height/2,F=E-b.top-I,N="clip"+a._uid+"commonlabel"+C._id;if(y=0?te-=ae:te+=2*L;var ie=ne.height+2*L,oe=ee+ie>=F;return ie<=F&&(ee<=E?ee=C._offset+2*L:oe&&(ee=F-ie)),re.attr("transform",l(te,ee)),re}var le=h.selectAll("g.hovertext").data(e,(function(e){return S(e)}));return le.enter().append("g").classed("hovertext",!0).each((function(){var e=n.select(this);e.append("rect").call(p.fill,p.addOpacity(f,.8)),e.append("text").classed("name",!0),e.append("path").style("stroke-width","1px"),e.append("text").classed("nums",!0).call(d.font,w,T)})),le.exit().remove(),le.each((function(e){var t=n.select(this).attr("transform",""),o=e.color;Array.isArray(o)&&(o=o[e.eventData[0].pointNumber]);var h=e.bgcolor||o,g=p.combine(p.opacity(h)?h:p.defaultLine,f),v=p.combine(p.opacity(o)?o:p.defaultLine,f),m=e.borderColor||p.contrast(g),y=D(e,N,i,a,P,t),x=y[0],b=y[1],k=t.select("text.nums").call(d.font,e.fontFamily||w,e.fontSize||T,e.fontColor||m).text(x).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,r),M=t.select("text.name"),S=0,C=0;if(b&&b!==x){M.call(d.font,e.fontFamily||w,e.fontSize||T,v).text(b).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,r);var O=M.node().getBoundingClientRect();S=O.width+2*L,C=O.height+2*L}else M.remove(),t.select("rect").remove();t.select("path").style({fill:g,stroke:m});var z,R,H=k.node().getBoundingClientRect(),j=e.xa._offset+(e.x0+e.x1)/2,B=e.ya._offset+(e.y0+e.y1)/2,V=Math.abs(e.x1-e.x0),U=Math.abs(e.y1-e.y0),q=H.width+A+L+S;if(e.ty0=E-H.top,e.bx=H.width+2*L,e.by=Math.max(H.height+2*L,C),e.anchor="start",e.txwidth=H.width,e.tx2width=S,e.offset=0,c)e.pos=j,z=B+U/2+q<=F,R=B-U/2-q>=0,"top"!==e.idealAlign&&z||!R?z?(B+=U/2,e.anchor="start"):e.anchor="middle":(B-=U/2,e.anchor="end");else if(e.pos=B,z=j+V/2+q<=I,R=j-V/2-q>=0,"left"!==e.idealAlign&&z||!R)if(z)j+=V/2,e.anchor="start";else{e.anchor="middle";var G=q/2,Z=j+G-I,Y=j-G;Z>0&&(j-=Z),Y<0&&(j+=-Y)}else j-=V/2,e.anchor="end";k.attr("text-anchor",e.anchor),S&&M.attr("text-anchor",e.anchor),t.attr("transform",l(j,B)+(c?s(_):""))})),le}function D(e,t,r,n,a,i){var l="",s="";void 0!==e.nameOverride&&(e.name=e.nameOverride),e.name&&(e.trace._meta&&(e.name=o.templateString(e.name,e.trace._meta)),l=I(e.name,e.nameLength)),void 0!==e.zLabel?(void 0!==e.xLabel&&(s+="x: "+e.xLabel+"
"),void 0!==e.yLabel&&(s+="y: "+e.yLabel+"
"),"choropleth"!==e.trace.type&&"choroplethmapbox"!==e.trace.type&&(s+=(s?"z: ":"")+e.zLabel)):t&&e[r.charAt(0)+"Label"]===a?s=e[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===e.xLabel?void 0!==e.yLabel&&"scattercarpet"!==e.trace.type&&(s=e.yLabel):s=void 0===e.yLabel?e.xLabel:"("+e.xLabel+", "+e.yLabel+")",!e.text&&0!==e.text||Array.isArray(e.text)||(s+=(s?"
":"")+e.text),void 0!==e.extraText&&(s+=(s?"
":"")+e.extraText),i&&""===s&&!e.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=e.hovertemplate||!1,f=e.hovertemplateLabels||e,d=e.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,e.trace._meta)).replace(C,(function(t,r){return l=I(r,e.nameLength),""}))),[s,l]}function P(e,t,r,a){var i=function(e){return e*r},o=function(e){return e*a};e.each((function(e){var r=n.select(this);if(e.del)return r.remove();var a=r.select("text.nums"),l=e.anchor,s="end"===l?-1:1,c={start:1,end:-1,middle:0}[l],f=c*(A+L),p=f+c*(e.txwidth+L),h=0,g=e.offset,v="middle"===l;v&&(f-=e.tx2width/2,p+=e.txwidth/2+L),t&&(g*=-M,h=e.offset*k),r.select("path").attr("d",v?"M-"+i(e.bx/2+e.tx2width/2)+","+o(g-e.by/2)+"h"+i(e.bx)+"v"+o(e.by)+"h-"+i(e.bx)+"Z":"M0,0L"+i(s*A+h)+","+o(A+g)+"v"+o(e.by/2-A)+"h"+i(s*e.bx)+"v-"+o(e.by)+"H"+i(s*A+h)+"V"+o(g-A)+"Z");var m=h+f,y=g+e.ty0-e.by/2+L,x=e.textAlign||"auto";"auto"!==x&&("left"===x&&"start"!==l?(a.attr("text-anchor","start"),m=v?-e.bx/2-e.tx2width/2+L:-e.bx-L):"right"===x&&"end"!==l&&(a.attr("text-anchor","end"),m=v?e.bx/2-e.tx2width/2-L:e.bx+L)),a.call(u.positionText,i(m),o(y)),e.tx2width&&(r.select("text.name").call(u.positionText,i(p+c*L+h),o(g+e.ty0-e.by/2+L)),r.select("rect").call(d.setRect,i(p+(c-1)*e.tx2width/2+h),o(g-e.by/2-1),i(e.tx2width),o(e.by+2)))}))}function z(e,t){var r=e.index,n=e.trace||{},i=e.cd[0],l=e.cd[r]||{};function s(e){return e||a(e)&&0===e}var c=Array.isArray(r)?function(e,t){var a=o.castOption(i,r,e);return s(a)?a:o.extractOption({},n,"",t)}:function(e,t){return o.extractOption(l,n,e,t)};function u(t,r,n){var a=c(r,n);s(a)&&(e[t]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),e.posref="y"===t||"closest"===t&&"h"===n.orientation?e.xa._offset+(e.x0+e.x1)/2:e.ya._offset+(e.y0+e.y1)/2,e.x0=o.constrain(e.x0,0,e.xa._length),e.x1=o.constrain(e.x1,0,e.xa._length),e.y0=o.constrain(e.y0,0,e.ya._length),e.y1=o.constrain(e.y1,0,e.ya._length),void 0!==e.xLabelVal&&(e.xLabel="xLabel"in e?e.xLabel:g.hoverLabelText(e.xa,e.xLabelVal),e.xVal=e.xa.c2d(e.xLabelVal)),void 0!==e.yLabelVal&&(e.yLabel="yLabel"in e?e.yLabel:g.hoverLabelText(e.ya,e.yLabelVal),e.yVal=e.ya.c2d(e.yLabelVal)),void 0!==e.zLabelVal&&void 0===e.zLabel&&(e.zLabel=String(e.zLabelVal)),!(isNaN(e.xerr)||"log"===e.xa.type&&e.xerr<=0)){var f=g.tickText(e.xa,e.xa.c2l(e.xerr),"hover").text;void 0!==e.xerrneg?e.xLabel+=" +"+f+" / -"+g.tickText(e.xa,e.xa.c2l(e.xerrneg),"hover").text:e.xLabel+=" \xb1 "+f,"x"===t&&(e.distance+=1)}if(!(isNaN(e.yerr)||"log"===e.ya.type&&e.yerr<=0)){var d=g.tickText(e.ya,e.ya.c2l(e.yerr),"hover").text;void 0!==e.yerrneg?e.yLabel+=" +"+d+" / -"+g.tickText(e.ya,e.ya.c2l(e.yerrneg),"hover").text:e.yLabel+=" \xb1 "+d,"y"===t&&(e.distance+=1)}var p=e.hoverinfo||e.trace.hoverinfo;return p&&"all"!==p&&(-1===(p=Array.isArray(p)?p:p.split("+")).indexOf("x")&&(e.xLabel=void 0),-1===p.indexOf("y")&&(e.yLabel=void 0),-1===p.indexOf("z")&&(e.zLabel=void 0),-1===p.indexOf("text")&&(e.text=void 0),-1===p.indexOf("name")&&(e.name=void 0)),e}function R(e,t,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,u=!!t.hLinePoint,f=!!t.vLinePoint;if(o.selectAll(".spikeline").remove(),f||u){var h=p.combine(l.plot_bgcolor,l.paper_bgcolor);if(u){var v,m,y=t.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,h)<1.5?p.contrast(h):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=g.getPxPosition(e,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T,stroke:k,"stroke-dasharray":d.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T+2,stroke:h}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:m,r:T,fill:k}).classed("spikeline",!0)}if(f){var S,C,O=t.vLinePoint;n=O&&O.xa,a=O&&O.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+O.x,C=a._offset+O.y);var D,P,z=i.readability(O.color,h)<1.5?p.contrast(h):O.color,R=n.spikemode,E=n.spikethickness,I=n.spikecolor||z,F=g.getPxPosition(e,n);if(-1!==R.indexOf("toaxis")||-1!==R.indexOf("across")){if(-1!==R.indexOf("toaxis")&&(D=F,P=C),-1!==R.indexOf("across")){var N=n._counterDomainMin,H=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),H=Math.max(H,n.position)),D=s.t+(1-H)*s.h,P=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:P,"stroke-width":E,stroke:I,"stroke-dasharray":d.dashStyle(n.spikedash,E)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:P,"stroke-width":E+2,stroke:h}).classed("spikeline",!0).classed("crisp",!0)}-1!==R.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?E:-E),r:E,fill:I}).classed("spikeline",!0)}}}function E(e,t){return!t||(t.vLinePoint!==e._spikepoints.vLinePoint||t.hLinePoint!==e._spikepoints.hLinePoint)}function I(e,t){return u.plainText(e||"",{len:t,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":201,"../../lib/events":194,"../../lib/override_cursor":212,"../../lib/svg_text_utils":222,"../../plots/cartesian/axes":246,"../../registry":288,"../color":74,"../dragelement":93,"../drawing":96,"../legend/defaults":126,"../legend/draw":127,"./constants":108,"./helpers":110,d3:9,"fast-isnumeric":11,tinycolor2:57}],112:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../color"),i=e("./helpers").isUnifiedHover;t.exports=function(e,t,r,o){function l(e){o.font[e]||(o.font[e]=t.legend?t.legend.font[e]:t.font[e])}o=o||{},t&&i(t.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),t.legend?(o.bgcolor||(o.bgcolor=a.combine(t.legend.bgcolor,t.paper_bgcolor)),o.bordercolor||(o.bordercolor=t.legend.bordercolor)):o.bgcolor||(o.bgcolor=t.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":201,"../color":74,"./helpers":110}],113:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){function i(r,i){return void 0!==t[r]?t[r]:n.coerce(e,t,a,r,i)}var o,l=i("clickmode");return t._has("cartesian")?l.indexOf("select")>-1?o="closest":(t._isHoriz=function(e,t){for(var r=t._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===k("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===k("roworder"),w=d?.2:.1,T=d?.3:.1;g&&t._splomGridDflt&&(x=t._splomGridDflt.xside,b=t._splomGridDflt.yside),v._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,m,_)}}else delete t.grid}function k(e,t){return n.coerce(r,v,s,e,t)}},contentDefaults:function(e,t){var r=t.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=e.grid||{},p=t._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(t,"legend");if(_("uirevision",t.uirevision),!1!==g){_("bgcolor",t.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",t.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(e.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(t.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemwidth"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",t.font))}}function _(e,t){return a.coerce(c,v,o,e,t)}}},{"../../lib":201,"../../plot_api/plot_template":235,"../../plots/layout_attributes":278,"../../registry":288,"./attributes":124,"./helpers":130}],127:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib/events"),s=e("../dragelement"),c=e("../drawing"),u=e("../color"),f=e("../../lib/svg_text_utils"),d=e("./handle_click"),p=e("./constants"),h=e("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=e("./get_legend_data"),x=e("./style"),b=e("./helpers");function _(e,t,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:e.data,layout:e.layout,frames:e._transitionData._frames,config:e._context,fullData:e._fullData,fullLayout:e._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(e,"plotly_legendclick",s))if(1===n)t._clickTimeout=setTimeout((function(){d(r,e,n)}),e._context.doubleClickDelay);else if(2===n){t._clickTimeout&&clearTimeout(t._clickTimeout),e._legendMouseDownTime=0,!1!==l.triggerHandler(e,"plotly_legenddoubleclick",s)&&d(r,e,n)}}function w(e,t,r){var n,i=e.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&t._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(e,"text","legendtext");g.attr("text-anchor","start").call(c.font,r.font).text(d?T(n,h):n);var v=r.itemwidth+2*p.itemGap;f.positionText(g,v,0),d?g.call(f.makeEditable,{gd:t,text:n}).call(M,e,t,r).on("edit",(function(n){this.text(T(n,h)).call(M,e,t,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",t,s,u)})):M(g,e,t,r)}function T(e,t){var r=Math.max(4,t);if(e&&e.trim().length>=r/2)return e;for(var n=r-(e=e||"").length;n>0;n--)e+=" ";return e}function k(e,t){var r,i=t._context.doubleClickDelay,o=1,l=a.ensureSingle(e,"rect","legendtoggle",(function(e){t._context.staticPlot||e.style("cursor","pointer").attr("pointer-events","all"),e.call(u.fill,"rgba(0,0,0,0)")}));t._context.staticPlot||(l.on("mousedown",(function(){(r=(new Date).getTime())-t._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(t,r,e,o,n.event)}})))}function M(e,t,r,n){n._main||e.attr("data-notex",!0),f.convertToTspans(e,r,(function(){!function(e,t,r){var n=e.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void e.remove();var a=e.select("g[class*=math-group]"),i=a.node();r||(r=t._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=e.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);if(n){var x=r.itemwidth+2*p.itemGap;f.positionText(h,x,-y)}else f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(t,r,n)}))}function A(e){return a.isRightAnchor(e)?"right":a.isCenterAnchor(e)?"center":"left"}function L(e){return a.isBottomAnchor(e)?"bottom":a.isMiddleAnchor(e)?"middle":"top"}t.exports=function(e,t){var r,l=e._fullLayout,f="legend"+l._uid;if(t?(r=t.layer,f+="-hover"):((t=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(e._legendMouseDownTime||(e._legendMouseDownTime=0),t._main){if(!e.calcdata)return;d=l.showlegend&&y(e.calcdata,t)}else{if(!t.entries)return;d=y(t.entries,t)}var h=l.hiddenlabels||[];if(t._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(e,"legend");var g=a.ensureSingle(r,"g","legend",(function(e){t._main&&e.attr("pointer-events","all")})),T=a.ensureSingleById(l._topdefs,"clipPath",f,(function(e){e.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(e){e.attr("shape-rendering","crispEdges")}));S.call(u.stroke,t.bordercolor).call(u.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),O=t.title;if(t._titleWidth=0,t._titleHeight=0,O.text){var D=a.ensureSingle(C,"text","legendtitletext");D.attr("text-anchor","start").call(c.font,O.font).text(O.text),M(D,C,e,t)}else C.selectAll(".legendtitletext").remove();var P=a.ensureSingle(g,"rect","scrollbar",(function(e){e.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),z=C.selectAll("g.groups").data(d);z.enter().append("g").attr("class","groups"),z.exit().remove();var R=z.selectAll("g.traces").data(a.identity);R.enter().append("g").attr("class","traces"),R.exit().remove(),R.style("opacity",(function(e){var t=e[0].trace;return o.traceIs(t,"pie-like")?-1!==h.indexOf(e[0].label)?.5:1:"legendonly"===t.visible?.5:1})).each((function(){n.select(this).call(w,e,t)})).call(x,e,t).each((function(){t._main&&n.select(this).call(k,e)})),a.syncOrAsync([i.previousPromises,function(){return function(e,t,r,a){var i=e._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.itemGap,h=a.itemwidth+2*d,g=2*(u+d),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(e){var t=0,r=0,n=e.title.side;n&&(-1!==n.indexOf("left")&&(t=e._titleWidth),-1!==n.indexOf("top")&&(r=e._titleHeight));return[t,r]}(a);if(l)r.each((function(e){var t=e[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+t/2+d),a._height+=t,a._width=Math.max(a._width,e[0].width)})),x=h+a._width,a._width+=d+h+f,a._height+=g,s&&(t.each((function(e,t){c.setTranslate(this,0,t*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:S:k?M&&"right"===w?o.r+o.w:S:o.w,2*h);var C=0,O=0;r.each((function(e){var t=e[0].width+h;C=Math.max(C,t),O+=t})),x=null;var D=0;if(s){var P=0,z=0,R=0;t.each((function(){var e=0,t=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+d+n/2+t),t+=n,e=Math.max(e,h+r[0].width)})),P=Math.max(P,t);var r=e+d;r+u+z>a._maxWidth&&(D=Math.max(D,z),z=0,R+=P+a.tracegroupgap,P=t),c.setTranslate(this,z,R),z+=r})),a._width=Math.max(D,z)+u,a._height=R+P+g}else{var E=r.size(),I=O+f+(E-1)*d=a._maxWidth&&(D=Math.max(D,j),N=0,H+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+H+t/2+d),j=N+r+d,N+=n,F=Math.max(F,t)})),I?(a._width=N+f,a._height=F+g):(a._width=Math.max(D,j)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var B=e._context.edits,V=B.legendText||B.legendPosition;r.each((function(e){var t=n.select(this).select(".legendtoggle"),r=e[0].height,a=V?h:x||h+e[0].width;l||(a+=d/2),c.setRect(t,0,-r/2,a,r)}))}(e,z,R,t)},function(){if(!t._main||!function(e){var t=e._fullLayout.legend,r=A(t),n=L(t);return i.autoMargin(e,"legend",{x:t.x,y:t.y,l:t._width*v[r],r:t._width*m[r],b:t._effHeight*m[n],t:t._effHeight*v[n]})}(e)){var u,d,h,y,x=l._size,b=t.borderwidth,w=x.l+x.w*t.x-v[A(t)]*t._width,k=x.t+x.h*(1-t.y)-v[L(t)]*t._effHeight;if(t._main&&l.margin.autoexpand){var M=w,O=k;w=a.constrain(w,0,l.width-t._width),k=a.constrain(k,0,l.height-t._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==O&&a.log("Constrain legend.y to make legend fit inside graph")}if(t._main&&c.setTranslate(g,w,k),P.on(".drag",null),g.on("wheel",null),!t._main||t._height<=t._maxHeight||e._context.staticPlot){var D=t._effHeight;t._main||(D=t._height),S.attr({width:t._width-b,height:D-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:t._width-2*b,height:D-2*b,x:b,y:b}),c.setClipUrl(C,f,e),c.setRect(P,0,0,0,0),delete t._scrollY}else{var z,R,E,I=Math.max(p.scrollBarMinHeight,t._effHeight*t._effHeight/t._height),F=t._effHeight-I-2*p.scrollBarMargin,N=t._height-t._effHeight,H=F/N,j=Math.min(t._scrollY||0,N);S.attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-2*b,x:b,y:b+j}),c.setClipUrl(C,f,e),U(j,I,H),g.on("wheel",(function(){U(j=a.constrain(t._scrollY+n.event.deltaY/F*N,0,N),I,H),0!==j&&j!==N&&n.event.preventDefault()}));var B=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;z="touchstart"===e.type?e.changedTouches[0].clientY:e.clientY,E=j})).on("drag",(function(){var e=n.event.sourceEvent;2===e.buttons||e.ctrlKey||(R="touchmove"===e.type?e.changedTouches[0].clientY:e.clientY,U(j=function(e,t,r){var n=(r-t)/H+e;return a.constrain(n,0,N)}(E,z,R),I,H))}));P.call(B);var V=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;"touchstart"===e.type&&(z=e.changedTouches[0].clientY,E=j)})).on("drag",(function(){var e=n.event.sourceEvent;"touchmove"===e.type&&(R=e.changedTouches[0].clientY,U(j=function(e,t,r){var n=(t-r)/H+e;return a.constrain(n,0,N)}(E,z,R),I,H))}));C.call(V)}if(e._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:e,prepFn:function(){var e=c.getTranslate(g);h=e.x,y=e.y},moveFn:function(e,r){var n=h+e,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,t.xanchor),d=s.align(a,0,x.t+x.h,x.t,t.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",e,{"legend.x":u,"legend.y":d})},clickFn:function(t,n){var a=r.selectAll("g.traces").filter((function(){var e=this.getBoundingClientRect();return n.clientX>=e.left&&n.clientX<=e.right&&n.clientY>=e.top&&n.clientY<=e.bottom}));a.size()>0&&_(e,g,a,t,n)}})}function U(r,n,a){t._scrollY=e._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(P,t._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],e)}}},{"../../constants/alignment":176,"../../lib":201,"../../lib/events":194,"../../lib/svg_text_utils":222,"../../plots/plots":280,"../../registry":288,"../color":74,"../dragelement":93,"../drawing":96,"./constants":125,"./get_legend_data":128,"./handle_click":129,"./helpers":130,"./style":132,d3:9}],128:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("./helpers");t.exports=function(e,t){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=t._main;function p(e,r){if(""!==e&&a.isGrouped(t))-1===l.indexOf(e)?(l.push(e),s=!0,o[e]=[[r]]):o[e].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=t.width}return v?n:Math.min(a,r)};function _(e,t,r){var i=e[0].trace,o=i.marker||{},l=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(c?[e]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),u.exit().remove(),u.each((function(e){var t=n.select(this),r=e[0],a=b(r.mlw,o.line,5,2);t.style("stroke-width",a+"px").call(s.fill,r.mc||o.color),a&&s.stroke(t,r.mlc||l.color)}))}function w(e,t,r){var o=e[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(s?[e]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),c.exit().remove(),c.size()){var u=(l.marker||{}).line,p=b(d(u.width,o.pts),u,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=u.color;var g=i.minExtend(o,{trace:h});f(c,g,h)}}e.each((function(e){var t=n.select(this),a=i.ensureSingle(t,"g","layers");a.style("opacity",e[0].trace.opacity);var l=r.valign,s=e[0].lineHeight,c=e[0].height;if("middle"!==l&&s&&c){var u={top:1,bottom:-1}[l]*(.5*(s-c+3));a.attr("transform",o(0,u))}else a.attr("transform",null);a.selectAll("g.legendfill").data([e]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([e]).enter().append("g").classed("legendlines",!0);var f=a.selectAll("g.legendsymbols").data([e]);f.enter().append("g").classed("legendsymbols",!0),f.selectAll("g.legendpoints").data([e]).enter().append("g").classed("legendpoints",!0)})).each((function(e){var r,a=e[0].trace,o=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":o=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":o=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":o=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":o=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":o=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":o=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(o);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform",x).style("stroke-miterlimit",1),u.exit().remove(),u.each((function(e,o){var u,f=n.select(this),d=c(a),p=d.colorscale,g=d.reversescale;if(p){if(!r){var v=p.length;u=0===o?p[g?v-1:0][1]:1===o?p[g?0:v-1][1]:p[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[o]||m[0]:m}f.attr("d",e[0]),u?f.call(s.fill,u):f.call((function(e){if(e.size()){var n="legendfill-"+a.uid;l.gradient(e,t,n,h(g,"radial"===r),p,"fill")}}))}))})).each((function(e){var t=e[0].trace,r="waterfall"===t.type;if(e[0]._distinct&&r){var a=e[0].trace[e[0].dir].marker;return e[0].mc=a.color,e[0].mlw=a.line.width,e[0].mlc=a.line.color,_(e,this,"waterfall")}var i=[];t.visible&&r&&(i=e[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform",x).style("stroke-miterlimit",1),o.exit().remove(),o.each((function(e){var r=n.select(this),a=t[e[0]].marker,i=b(void 0,a.line,5,2);r.attr("d",e[1]).style("stroke-width",i+"px").call(s.fill,a.color),i&&r.call(s.stroke,a.line.color)}))})).each((function(e){_(e,this,"funnel")})).each((function(e){_(e,this)})).each((function(e){var r=e[0].trace,o=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[e]:[]);o.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),o.exit().remove(),o.each((function(){var e=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==s.opacity(r.fillcolor)||0!==s.opacity((r.line||{}).color)){var a=b(void 0,r.line,5,2);e.style("stroke-width",a+"px").call(s.fill,r.fillcolor),a&&s.stroke(e,r.line.color)}else{var c=i.minExtend(r,{marker:{size:v?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});o.call(l.pointStyle,c,t)}}))})).each((function(e){w(e,this,"funnelarea")})).each((function(e){w(e,this,"pie")})).each((function(e){var r,a,o=e[0],s=o.trace,f=s.visible&&s.fill&&"none"!==s.fill,d=u.hasLines(s),p=s.contours,g=!1,v=!1,y=c(s),x=y.colorscale,_=y.reversescale;if(p){var w=p.coloring;"lines"===w?g=!0:d="none"===w||"heatmap"===w||p.showlines,"constraint"===p.type?f="="!==p._operation:"fill"!==w&&"heatmap"!==w||(v=!0)}var T=u.hasMarkers(s)||u.hasText(s),k=f||v,M=d||g,A=T||!k?"M5,0":M?"M5,-2":"M5,-3",L=n.select(this),S=L.select(".legendfill").selectAll("path").data(f||v?[e]:[]);if(S.enter().append("path").classed("js-fill",!0),S.exit().remove(),S.attr("d",A+"h"+m+"v6h-"+m+"z").call(f?l.fillGroupStyle:function(e){if(e.size()){var r="legendfill-"+s.uid;l.gradient(e,t,r,h(_),x,"fill")}}),d||g){var C=b(void 0,s.line,10,5);a=i.minExtend(s,{line:{width:C}}),r=[i.minExtend(o,{trace:a})]}var O=L.select(".legendlines").selectAll("path").data(d||g?[r]:[]);O.enter().append("path").classed("js-line",!0),O.exit().remove(),O.attr("d",A+(g?"l"+m+",0.0001":"h"+m)).call(d?l.lineGroupStyle:function(e){if(e.size()){var r="legendline-"+s.uid;l.lineGroupStyle(e),l.gradient(e,t,r,h(_),x,"stroke")}})})).each((function(e){var r,a,o=e[0],s=o.trace,c=u.hasMarkers(s),f=u.hasText(s),d=u.hasLines(s);function p(e,t,r,n){var a=i.nestedProperty(s,e).get(),o=i.isArrayOrTypedArray(a)&&t?t(a):a;if(v&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function h(e){return o._distinct&&o.index&&e[o.index]?e[o.index]:e[0]}if(c||f||d){var g={},m={};if(c){g.mc=p("marker.color",h),g.mx=p("marker.symbol",h),g.mo=p("marker.opacity",i.mean,[.2,1]),g.mlc=p("marker.line.color",h),g.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);g.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",h,[0,10],5)}),f&&(g.tx="Aa",g.tp=p("textposition",h),g.ts=10,g.tc=p("textfont.color",h),g.tf=p("textfont.family",h)),r=[i.minExtend(o,g)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var b=n.select(this).select("g.legendpoints"),_=b.selectAll("path.scatterpts").data(c?r:[]);_.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",x),_.exit().remove(),_.call(l.pointStyle,a,t),c&&(r[0].mrc=3);var w=b.selectAll("g.pointtext").data(f?r:[]);w.enter().append("g").classed("pointtext",!0).append("text").attr("transform",x),w.exit().remove(),w.selectAll("text").call(l.textPointStyle,a,t)})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(t.visible&&"candlestick"===t.type?[e,e]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",(function(e,t){return t?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"})).attr("transform",x).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=b(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(s.fill,i.fillcolor),o&&s.stroke(a,i.line.color)}))})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(t.visible&&"ohlc"===t.type?[e,e]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",(function(e,t){return t?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"})).attr("transform",x).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=b(void 0,i.line,5,2);a.style("fill","none").call(l.dashLine,i.line.dash,o),o&&s.stroke(a,i.line.color)}))}))}},{"../../lib":201,"../../registry":288,"../../traces/pie/helpers":320,"../../traces/pie/style_one":326,"../../traces/scatter/subtypes":353,"../color":74,"../colorscale/helpers":85,"../drawing":96,"./constants":125,d3:9}],133:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/plots"),i=e("../../plots/cartesian/axis_ids"),o=e("../../fonts/ploticon"),l=e("../shapes/draw").eraseActiveShape,s=e("../../lib"),c=s._,u=t.exports={};function f(e,t){var r,a,o=t.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=e._fullLayout,u={},f=i.list(e,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(e){for(var t=0;t0)){var g=function(e,t,r){for(var n=r.filter((function(r){return t[r].anchor===e._id})),a=0,i=0;i=n.max)t=F[r+1];else if(e=n.pmax)t=F[r+1];else if(e0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(e,t,r,n,a){var l="category"===e.type||"multicategory"===e.type?e.r2c:e.d2c;if(void 0!==t)return[l(t),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===e.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]:void 0}}t.exports=function(e){var t=e._fullLayout,r=n.filterVisible(t.shapes);if(r.length&&e._fullData.length)for(var o=0;oy?(k=f,S="y0",M=y,C="y1"):(k=y,S="y1",M=f,C="y0");W(n),$(l,r),function(e,t,r){var n=t.xref,a=t.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(e,s?"clip"+r._fullLayout._uid+s:null,r)}(t,r,e),X.moveFn="move"===z?Q:J,X.altKey=n.altKey},doneFn:function(){if(m(e))return;p(t),K(l),b(t,e,r),n.call("_guiRelayout",e,s.getUpdateObj())},clickFn:function(){if(m(e))return;K(l)}};function W(r){if(m(e))z=null;else if(I)z="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=X.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(t,s),z=s.split("-")[0]}}function Q(n,a){if("path"===r.type){var i=function(e){return e},o=i,s=i;R?N("xanchor",r.xanchor=G(x+n)):(o=function(e){return G(U(e)+n)},H&&"date"===H.type&&(o=g.encodeDate(o))),E?N("yanchor",r.yanchor=Z(T+a)):(s=function(e){return Z(q(e)+a)},B&&"date"===B.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else R?N("xanchor",r.xanchor=G(x+n)):(N("x0",r.x0=G(c+n)),N("x1",r.x1=G(v+n))),E?N("yanchor",r.yanchor=Z(T+a)):(N("y0",r.y0=Z(f+a)),N("y1",r.y1=Z(y+a)));t.attr("d",_(e,r)),$(l,r)}function J(n,a){if(F){var i=function(e){return e},o=i,s=i;R?N("xanchor",r.xanchor=G(x+n)):(o=function(e){return G(U(e)+n)},H&&"date"===H.type&&(o=g.encodeDate(o))),E?N("yanchor",r.yanchor=Z(T+a)):(s=function(e){return Z(q(e)+a)},B&&"date"===B.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else if(I){if("resize-over-start-point"===z){var u=c+n,d=E?f-a:f+a;N("x0",r.x0=R?u:G(u)),N("y0",r.y0=E?d:Z(d))}else if("resize-over-end-point"===z){var p=v+n,h=E?y-a:y+a;N("x1",r.x1=R?p:G(p)),N("y1",r.y1=E?h:Z(h))}}else{var m=function(e){return-1!==z.indexOf(e)},b=m("n"),j=m("s"),V=m("w"),Y=m("e"),X=b?k+a:k,W=j?M+a:M,Q=V?A+n:A,J=Y?L+n:L;E&&(b&&(X=k-a),j&&(W=M-a)),(!E&&W-X>10||E&&X-W>10)&&(N(S,r[S]=E?X:Z(X)),N(C,r[C]=E?W:Z(W))),J-Q>10&&(N(O,r[O]=R?Q:G(Q)),N(D,r[D]=R?J:G(J)))}t.attr("d",_(e,r)),$(l,r)}function $(e,t){(R||E)&&function(){var r="path"!==t.type,n=e.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 i=U(R?t.xanchor:a.midRange(r?[t.x0,t.x1]:g.extractPathCoords(t.path,h.paramIsX))),o=q(E?t.yanchor:a.midRange(r?[t.y0,t.y1]:g.extractPathCoords(t.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),R&&E){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(R){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function K(e){e.selectAll(".visual-cue").remove()}d.init(X),Y.node().onmousemove=W}(e,R,s,t,r,z):!0===s.editable&&R.style("pointer-events",D||c.opacity(L)*A<=.5?"stroke":"all");R.node().addEventListener("click",(function(){return function(e,t){if(!y(e))return;var r=+t.node().getAttribute("data-index");if(r>=0){if(r===e._fullLayout._activeShapeIndex)return void T(e);e._fullLayout._activeShapeIndex=r,e._fullLayout._deactivateShape=T,v(e)}}(e,R)}))}}function b(e,t,r){var n=(r.xref+r.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");u.setClipUrl(e,n?"clip"+t._fullLayout._uid+n:null,t)}function _(e,t){var r,n,o,l,s,c,u,f,d=t.type,p=i.getRefType(t.xref),v=i.getRefType(t.yref),m=i.getFromId(e,t.xref),y=i.getFromId(e,t.yref),x=e._fullLayout._size;if(m?"domain"===p?n=function(e){return m._offset+m._length*e}:(r=g.shapePositionToRange(m),n=function(e){return m._offset+m.r2p(r(e,!0))}):n=function(e){return x.l+x.w*e},y?"domain"===v?l=function(e){return y._offset+y._length*(1-e)}:(o=g.shapePositionToRange(y),l=function(e){return y._offset+y.r2p(o(e,!0))}):l=function(e){return x.t+x.h*(1-e)},"path"===d)return m&&"date"===m.type&&(n=g.decodeDate(n)),y&&"date"===y.type&&(l=g.decodeDate(l)),function(e,t,r){var n=e.path,i=e.xsizemode,o=e.ysizemode,l=e.xanchor,s=e.yanchor;return n.replace(h.segmentRE,(function(e){var n=0,c=e.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=e.substr(1).replace(h.paramRE,(function(e){return u[n]?e="pixel"===i?t(l)+Number(e):t(e):f[n]&&(e="pixel"===o?r(s)-Number(e):r(e)),++n>d&&(e="X"),e}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+e)),c+p}))}(t,n,l);if("pixel"===t.xsizemode){var b=n(t.xanchor);s=b+t.x0,c=b+t.x1}else s=n(t.x0),c=n(t.x1);if("pixel"===t.ysizemode){var _=l(t.yanchor);u=_-t.y0,f=_-t.y1}else u=l(t.y0),f=l(t.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var w=(s+c)/2,T=(u+f)/2,k=Math.abs(w-s),M=Math.abs(T-u),A="A"+k+","+M,L=w+k+","+T;return"M"+L+A+" 0 1,1 "+(w+","+(T-M))+A+" 0 0,1 "+L+"Z"}function w(e,t,r){return e.replace(h.segmentRE,(function(e){var n=0,a=e.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+e.substr(1).replace(h.paramRE,(function(e){return n>=l||(i[n]?e=t(e):o[n]&&(e=r(e)),n++),e}))}))}function T(e){y(e)&&(e._fullLayout._activeShapeIndex>=0&&(s(e),delete e._fullLayout._activeShapeIndex,v(e)))}t.exports={draw:v,drawOne:x,eraseActiveShape:function(e){if(!y(e))return;s(e);var t=e._fullLayout._activeShapeIndex,r=(e.layout||{}).shapes||[];if(t=0&&f(m),r.attr("d",g(t)),M&&!d)&&(k=function(e,t){for(var r=0;r1&&(2!==e.length||"Z"!==e[1][0])&&(0===T&&(e[0][0]="M"),t[w]=e,y(),x())}}()}}function P(e,r){!function(e,r){if(t.length)for(var n=0;n0&&s0&&(l=l.transition().duration(t.transition.duration).ease(t.transition.easing)),l.attr("transform",s(o-.5*f.gripWidth,t._dims.currentValueTotalHeight))}}function S(e,t){var r=e._dims;return r.inputAreaStart+f.stepInset+(r.inputAreaLength-2*f.stepInset)*Math.min(1,Math.max(0,t))}function C(e,t){var r=e._dims;return Math.min(1,Math.max(0,(t-f.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*f.stepInset-2*r.inputAreaStart)))}function O(e,t,r){var n=r._dims,a=l.ensureSingle(e,"rect",f.railTouchRectClass,(function(n){n.call(M,t,e,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,f.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function D(e,t){var r=t._dims,n=r.inputAreaLength-2*f.railInset,a=l.ensureSingle(e,"rect",f.railRectClass);a.attr({width:n,height:f.railWidth,rx:f.railRadius,ry:f.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,t.bordercolor).call(i.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px"),o.setTranslate(a,f.railInset,.5*(r.inputAreaWidth-f.railWidth)+r.currentValueTotalHeight)}t.exports=function(e){var t=e._fullLayout,r=function(e,t){for(var r=e[f.name],n=[],a=0;a0?[0]:[]);function l(t){t._commandObserver&&(t._commandObserver.remove(),delete t._commandObserver),a.autoMargin(e,v(t))}if(i.enter().append("g").classed(f.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+f.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+f.groupClassName).data(r,m);s.enter().append("g").classed(f.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||d<0){var m={left:[-h,0],right:[h,0],top:[0,-h],bottom:[0,h]}[b.side];t.attr("transform",s(m[0],m[1]))}}}return E.call(I),z&&(S?E.on(".opacity",null):(M=0,A=!0,E.text(y).on("mouseover.opacity",(function(){n.select(this).transition().duration(d.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(d.HIDE_PLACEHOLDER).style("opacity",0)}))),E.call(f.makeEditable,{gd:e}).on("edit",(function(t){void 0!==x?o.call("_guiRestyle",e,m,t,x):o.call("_guiRelayout",e,m,t)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(I)})).on("input",(function(e){this.text(e||" ").call(f.positionText,_.x,_.y)}))),E.classed("js-placeholder",A),T}}},{"../../constants/alignment":176,"../../constants/interactions":179,"../../lib":201,"../../lib/svg_text_utils":222,"../../plots/plots":280,"../../registry":288,"../color":74,"../drawing":96,d3:9,"fast-isnumeric":11}],170:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("../color/attributes"),i=e("../../lib/extend").extendFlat,o=e("../../plot_api/edit_types").overrideAll,l=e("../../plots/pad_attributes"),s=e("../../plot_api/plot_template").templatedArray,c=s("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"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});t.exports=o(s("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:c,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:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":195,"../../plot_api/edit_types":228,"../../plot_api/plot_template":235,"../../plots/font_attributes":274,"../../plots/pad_attributes":279,"../color/attributes":73}],171:[function(e,t,r){"use strict";t.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"}}},{}],172:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/array_container_defaults"),i=e("./attributes"),o=e("./constants").name,l=i.buttons;function s(e,t,r){function o(r,a){return n.coerce(e,t,i,r,a)}o("visible",a(e,t,{name:"buttons",handleItemDefaults:c}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),n.noneOrAll(e,t,["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 c(e,t){function r(r,a){return n.coerce(e,t,l,r,a)}r("visible","skip"===e.method||Array.isArray(e.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}t.exports=function(e,t){a(e,t,{name:o,handleItemDefaults:s})}},{"../../lib":201,"../../plots/array_container_defaults":241,"./attributes":170,"./constants":171}],173:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../plots/plots"),i=e("../color"),o=e("../drawing"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../plot_api/plot_template").arrayEditor,u=e("../../constants/alignment").LINE_SPACING,f=e("./constants"),d=e("./scrollbox");function p(e){return e._index}function h(e,t){return+e.attr(f.menuIndexAttrName)===t._index}function g(e,t,r,n,a,i,o,l){t.active=o,c(e.layout,f.name,t).applyUpdate("active",o),"buttons"===t.type?m(e,n,null,null,t):"dropdown"===t.type&&(a.attr(f.menuIndexAttrName,"-1"),v(e,n,a,i,t),l||m(e,n,a,i,t))}function v(e,t,r,n,a){var i=l.ensureSingle(t,"g",f.headerClassName,(function(e){e.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,e).call(A,a,d,p),l.ensureSingle(t,"text",f.headerArrowClassName,(function(e){e.attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(e,t,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(t,s.lx,s.ly)}function m(e,t,r,i,o){r||(r=t).attr("pointer-events","all");var s=function(e){return-1==+e.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,e).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(e,o,0,t,r,i,-1),a.executeAPICommand(e,l.method,l.args2)):(g(e,o,0,t,r,i,s),a.executeAPICommand(e,l.method,l.args))),e.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(m.openWidth,m.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(m.openHeight,m.headerHeight)),k.direction=o.direction,i&&(u.size()?function(e,t,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[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(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(e){e.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),k?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>T,D=l.barWidth+2*l.barPad,P=l.barLength+2*l.barPad,z=h+g,R=v;z+D>s&&(z=s-D);var E=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);E.exit().on(".drag",null).remove(),E.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),O?(this.vbar=E.attr({rx:l.barRadius,ry:l.barRadius,x:z,y:R,width:D,height:P}),this._vbarYMin=R+P/2,this._vbarTranslateMax=T-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,F=u-.5,N=O?f+D+.5:f+.5,H=d-.5,j=k?p+A+.5:p+.5,B=o._topdefs.selectAll("#"+I).data(k||O?[0]:[]);if(B.exit().remove(),B.enter().append("clipPath").attr("id",I).append("rect"),k||O?(this._clipRect=B.select("rect").attr({x:Math.floor(F),y:Math.floor(H),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(j)-Math.floor(H)}),this.container.call(i.setClipUrl,I,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||O){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 U=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(t,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.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)},l.prototype._onBoxDrag=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e-=n.event.dx),this.vbar&&(t-=n.event.dy),this.setTranslate(e,t)},l.prototype._onBoxWheel=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e+=n.event.deltaY),this.vbar&&(t+=n.event.deltaY),this.setTranslate(e,t)},l.prototype._onBarDrag=function(){var e=this.translateX,t=this.translateY;if(this.hbar){var r=e+this._hbarXMin,a=r+this._hbarTranslateMax;e=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=t+this._vbarYMin,l=i+this._vbarTranslateMax;t=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(e,t)},l.prototype.setTranslate=function(e,t){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(e=o.constrain(e||0,0,r),t=o.constrain(t||0,0,n),this.translateX=e,this.translateY=t,this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-t),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+t-.5)}),this.hbar){var a=e/r;this.hbar.call(i.setTranslate,e+a*this._hbarTranslateMax,t)}if(this.vbar){var l=t/n;this.vbar.call(i.setTranslate,e,t+l*this._vbarTranslateMax)}}},{"../../lib":201,"../color":74,"../drawing":96,d3:9}],176:[function(e,t,r){"use strict";t.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"}}},{}],177:[function(e,t,r){"use strict";t.exports={axisRefDescription:function(e,t,r){return["If set to a",e,"axis id (e.g. *"+e+"* or","*"+e+"2*), the `"+e+"` position refers to a",e,"coordinate. If set to *paper*, the `"+e+"`","position refers to the distance from the",t,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",t,"("+r+"). If set to a",e,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",t,"of the domain of that axis: e.g.,","*"+e+"2 domain* refers to the domain of the second",e," axis and a",e,"position of 0.5 refers to the","point between the",t,"and the",r,"of the domain of the","second",e,"axis."].join(" ")}}},{}],178:[function(e,t,r){"use strict";t.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],179:[function(e,t,r){"use strict";t.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],180:[function(e,t,r){"use strict";t.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],181:[function(e,t,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}},{}],182:[function(e,t,r){"use strict";r.version=e("./version").version,e("es6-promise").polyfill(),e("../build/plotcss"),e("./fonts/mathjax_config")();for(var n=e("./registry"),a=r.register=n.register,i=e("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],185:[function(e,t,r){"use strict";r.isLeftAnchor=function(e){return"left"===e.xanchor||"auto"===e.xanchor&&e.x<=1/3},r.isCenterAnchor=function(e){return"center"===e.xanchor||"auto"===e.xanchor&&e.x>1/3&&e.x<2/3},r.isRightAnchor=function(e){return"right"===e.xanchor||"auto"===e.xanchor&&e.x>=2/3},r.isTopAnchor=function(e){return"top"===e.yanchor||"auto"===e.yanchor&&e.y>=2/3},r.isMiddleAnchor=function(e){return"middle"===e.yanchor||"auto"===e.yanchor&&e.y>1/3&&e.y<2/3},r.isBottomAnchor=function(e){return"bottom"===e.yanchor||"auto"===e.yanchor&&e.y<=1/3}},{}],186:[function(e,t,r){"use strict";var n=e("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(e){return Math.abs(e[1]-e[0])>l-1e-14}function c(e,t){return i(t-e,l)}function u(e,t){if(s(t))return!0;var r,n;t[0](n=a(n,l))&&(n+=l);var i=a(e,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(e,t,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(e,t){return[e*Math.cos(t)+a,i-e*Math.sin(t)]}g?(u=0,f=o,d=l):r=a&&e<=i);var a,i},pathArc:function(e,t,r,n,a){return f(null,e,t,r,n,a,0)},pathSector:function(e,t,r,n,a){return f(null,e,t,r,n,a,1)},pathAnnulus:function(e,t,r,n,a,i){return f(e,t,r,n,a,i,1)}}},{"./mod":208}],187:[function(e,t,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(e){return a.isView(e)&&!(e instanceof i)}function l(e){return n(e)||o(e)}function s(e,t,r){if(l(e)){if(l(e[0])){for(var n=r,a=0;aa.max?t.set(r):t.set(+e)}},integer:{coerceFunction:function(e,t,r,a){e%1||!n(e)||void 0!==a.min&&ea.max?t.set(r):t.set(+e)}},string:{coerceFunction:function(e,t,r,n){if("string"!=typeof e){var a="number"==typeof e;!0!==n.strict&&a?t.set(String(e)):t.set(r)}else n.noBlank&&!e?t.set(r):t.set(e)}},color:{coerceFunction:function(e,t,r){a(e).isValid()?t.set(e):t.set(r)}},colorlist:{coerceFunction:function(e,t,r){Array.isArray(e)&&e.length&&e.every((function(e){return a(e).isValid()}))?t.set(e):t.set(r)}},colorscale:{coerceFunction:function(e,t,r){t.set(o.get(e,r))}},angle:{coerceFunction:function(e,t,r){"auto"===e?t.set("auto"):n(e)?t.set(u(+e,360)):t.set(r)}},subplotid:{coerceFunction:function(e,t,r,n){var a=n.regex||c(r);"string"==typeof e&&a.test(e)?t.set(e):t.set(r)},validateFunction:function(e,t){var r=t.dflt;return e===r||"string"==typeof e&&!!c(r).test(e)}},flaglist:{coerceFunction:function(e,t,r,n){if("string"==typeof e)if(-1===(n.extras||[]).indexOf(e)){for(var a=e.split("+"),i=0;i=n&&e<=a?e:u}if("string"!=typeof e&&"number"!=typeof e)return u;e=String(e);var c=_(t),m=e.charAt(0);!c||"G"!==m&&"g"!==m||(e=e.substr(1),t="");var w=c&&"chinese"===t.substr(0,7),T=e.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),L=Number(T[7]||0),S=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var O;k=Number(k);try{var D=v.getComponentMethod("calendars","getCal")(t);if(w){var P="i"===M.charAt(M.length-1);M=parseInt(M,10),O=D.newDate(k,D.toMonthIndex(k,M,P),A)}else O=D.newDate(k,Number(M),A)}catch(e){return u}return O?(O.toJD()-g)*f+L*d+S*p+C*h:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var z=new Date(Date.UTC(2e3,M,A,L,S));return z.setUTCFullYear(k),z.getUTCMonth()!==M||z.getUTCDate()!==A?u:z.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(e,t){return r.dateTime2ms(e,t)!==u};var T=90*f,k=3*d,M=5*p;function A(e,t,r,n,a){if((t||r||n||a)&&(e+=" "+w(t,2)+":"+w(r,2),(n||a)&&(e+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;e+="."+w(a,i)}return e}r.ms2DateTime=function(e,t,r){if("number"!=typeof e||!(e>=n&&e<=a))return u;t||(t=0);var i,o,l,c,y,x,b=Math.floor(10*s(e+.05,1)),w=Math.round(e-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(e,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(e){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=t=n+f&&e<=a-f))return u;var t=Math.floor(10*s(e+.05,1)),r=new Date(Math.round(e-t/10));return A(i("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+t)},r.cleanDate=function(e,t,n){if(e===u)return t;if(r.isJSDate(e)||"number"==typeof e&&isFinite(e)){if(_(n))return l.error("JS Dates and milliseconds are incompatible with world calendars",e),t;if(!(e=r.ms2DateTimeLocal(+e))&&void 0!==t)return t}else if(!r.isDateTime(e,n))return l.error("unrecognized date",e),t;return e};var L=/%\d?f/g;function S(e,t,r,n){e=e.replace(L,(function(e){var r=Math.min(+e.charAt(1)||6,6);return(t/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(t+.05));if(_(n))try{e=v.getComponentMethod("calendars","worldCalFmt")(e,t,n)}catch(e){return"Invalid"}return r(e)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(e,t,r,n,a,i){if(a=_(a)&&a,!t)if("y"===r)t=i.year;else if("m"===r)t=i.month;else{if("d"!==r)return function(e,t){var r=s(e+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==t){o(t)||(t=0);var a=(100+Math.min(s(e/h,60),C[t])).toFixed(t).substr(1);t>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(e,r)+"\n"+S(i.dayMonthYear,e,n,a);t=i.dayMonth+"\n"+i.year}return S(t,e,n,a)};var O=3*f;r.incrementMonth=function(e,t,r){r=_(r)&&r;var n=s(e,f);if(e=Math.round(e-n),r)try{var a=Math.round(e/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return t%12?i.add(o,t,"m"):i.add(o,t/12,"y"),(o.toJD()-g)*f+n}catch(t){l.error("invalid ms "+e+" in calendar "+r)}var c=new Date(e+O);return c.setUTCMonth(c.getUTCMonth()+t)+n-O},r.findExactDates=function(e,t){for(var r,n,a=0,i=0,l=0,s=0,c=_(t)&&v.getComponentMethod("calendars","getCal")(t),u=0;u1||g<0||g>1?null:{x:e+s*g,y:t+f*g}}function s(e,t,r,n,a){var i=n*e+a*t;if(i<0)return n*n+a*a;if(i>r){var o=n-e,l=a-t;return o*o+l*l}var s=n*t-a*e;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(e,t,r,n,a,i,o,c){if(l(e,t,r,n,a,i,o,c))return 0;var u=r-e,f=n-t,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-e,i-t),s(u,f,h,o-e,c-t),s(d,p,g,e-a,t-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(e,t,r,l){if(e===a&&l===i||(n={},a=e,i=l),n[r])return n[r];var s=e.getPointAtLength(o(r-l/2,t)),c=e.getPointAtLength(o(r+l/2,t)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=e.getPointAtLength(o(r,t)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(e,t,r){var n,a,i=t.left,o=t.right,l=t.top,s=t.bottom,c=0,u=e.getTotalLength(),f=u;function d(t){var r=e.getPointAtLength(t);0===t?n=r:t===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(e,t,r,n){for(var a,i,o,l=(n=n||{}).pathLength||e.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=e.getPointAtLength(0)[r]>e.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":208}],199:[function(e,t,r){"use strict";t.exports=function(e){return e}},{}],200:[function(e,t,r){"use strict";t.exports=function(e,t){if(!t)return e;var r=1/Math.abs(t),n=r>1?(r*e+r*t)/r:e+t,a=String(n).length;if(a>16){var i=String(t).length;if(a>=String(e).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],201:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../constants/numerical"),l=o.FP_SAFE,s=o.BADNUM,c=t.exports={};c.nestedProperty=e("./nested_property"),c.keyedContainer=e("./keyed_container"),c.relativeAttr=e("./relative_attr"),c.isPlainObject=e("./is_plain_object"),c.toLogRange=e("./to_log_range"),c.relinkPrivateKeys=e("./relink_private");var u=e("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=e("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var d=e("./coerce");c.valObjectMeta=d.valObjectMeta,c.coerce=d.coerce,c.coerce2=d.coerce2,c.coerceFont=d.coerceFont,c.coerceHoverinfo=d.coerceHoverinfo,c.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,c.validate=d.validate;var p=e("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var h=e("./search");c.findBin=h.findBin,c.sorterAsc=h.sorterAsc,c.sorterDes=h.sorterDes,c.distinctVals=h.distinctVals,c.roundUp=h.roundUp,c.sort=h.sort,c.findIndexOfMin=h.findIndexOfMin;var g=e("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var v=e("./matrix");c.init2dArray=v.init2dArray,c.transposeRagged=v.transposeRagged,c.dot=v.dot,c.translationMatrix=v.translationMatrix,c.rotationMatrix=v.rotationMatrix,c.rotationXYMatrix=v.rotationXYMatrix,c.apply3DTransform=v.apply3DTransform,c.apply2DTransform=v.apply2DTransform,c.apply2DTransform2=v.apply2DTransform2,c.convertCssMatrix=v.convertCssMatrix,c.inverseTransformMatrix=v.inverseTransformMatrix;var m=e("./angles");c.deg2rad=m.deg2rad,c.rad2deg=m.rad2deg,c.angleDelta=m.angleDelta,c.angleDist=m.angleDist,c.isFullCircle=m.isFullCircle,c.isAngleInsideSector=m.isAngleInsideSector,c.isPtInsideSector=m.isPtInsideSector,c.pathArc=m.pathArc,c.pathSector=m.pathSector,c.pathAnnulus=m.pathAnnulus;var y=e("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=e("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=e("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=e("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=e("./regex");c.counterRegex=w.counter;var T=e("./throttle");c.throttle=T.throttle,c.throttleDone=T.done,c.clearThrottle=T.clear;var k=e("./dom");function M(e){var t={};for(var r in e)for(var n=e[r],a=0;al?s:i(e)?Number(e):s:s},c.isIndex=function(e,t){return!(void 0!==t&&e>=t)&&(i(e)&&e>=0&&e%1==0)},c.noop=e("./noop"),c.identity=e("./identity"),c.repeat=function(e,t){for(var r=new Array(t),n=0;nr?Math.max(r,Math.min(t,e)):Math.max(t,Math.min(r,e))},c.bBoxIntersect=function(e,t,r){return r=r||0,e.left<=t.right+r&&t.left<=e.right+r&&e.top<=t.bottom+r&&t.top<=e.bottom+r},c.simpleMap=function(e,t,r,n,a){for(var i=e.length,o=new Array(i),l=0;l=Math.pow(2,r)?a>10?(c.warn("randstr failed uniqueness"),s):e(t,r,n,(a||0)+1):s},c.OptionControl=function(e,t){e||(e={}),t||(t="opt");var r={optionList:[],_newoption:function(n){n[t]=e,r[n.name]=n,r.optionList.push(n)}};return r["_"+t]=e,r},c.smooth=function(e,t){if((t=Math.round(t)||0)<2)return e;var r,n,a,i,o=e.length,l=2*o,s=2*t-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=e[a]*c[n];u[r]=i}return u},c.syncOrAsync=function(e,t,r){var n;function a(){return c.syncOrAsync(e,t,r)}for(;e.length;)if((n=(0,e.splice(0,1)[0])(t))&&n.then)return n.then(a).then(void 0,c.promiseError);return r&&r(t)},c.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},c.noneOrAll=function(e,t,r){if(e){var n,a=!1,i=!0;for(n=0;n0?t:0}))},c.fillArray=function(e,t,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(e))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var D=/^\w*$/;c.templateString=function(e,t){var r={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,n){var a;return D.test(n)?a=t[n]:(r[n]=r[n]||c.nestedProperty(t,n).get,a=r[n]()),c.isValidTextValue(a)?a:""}))};var P={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return E.apply(P,arguments)};var z={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return E.apply(z,arguments)};var R=/^[:|\|]/;function E(e,t,r){var i=this,o=arguments;t||(t={});var l={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,s,u){var f,d,p,h;for(p=3;p=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var I=2e9;c.seedPseudoRandom=function(){I=2e9},c.pseudoRandom=function(){var e=I;return I=(69069*I+1)%4294967296,Math.abs(I-e)<429496729?c.pseudoRandom():I/4294967296},c.fillText=function(e,t,r){var n=Array.isArray(r)?function(e){r.push(e)}:function(e){r.text=e},a=c.extractOption(e,t,"htx","hovertext");if(c.isValidTextValue(a))return n(a);var i=c.extractOption(e,t,"tx","text");return c.isValidTextValue(i)?n(i):void 0},c.isValidTextValue=function(e){return e||0===e},c.formatPercent=function(e,t){t=t||0;for(var r=(Math.round(100*e*Math.pow(10,t))*Math.pow(.1,t)).toFixed(t)+"%",n=0;n1&&(u=1):u=0,c.strTranslate(a-u*(r+o),i-u*(n+l))+c.strScale(u)+(s?"rotate("+s+(t?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(e,t){var r=c.extendFlat({},t);return r.size=Math.max(t.size,e._fullLayout.uniformtext.minsize||0),r},c.join2=function(e,t,r){var n=e.length;return n>1?e.slice(0,-1).join(t)+r+e[n-1]:e.join(t)}},{"../constants/numerical":180,"./anchor_utils":185,"./angles":186,"./array":187,"./clean_number":188,"./clear_responsive":190,"./coerce":191,"./dates":192,"./dom":193,"./extend":195,"./filter_unique":196,"./filter_visible":197,"./geometry2d":198,"./identity":199,"./increment":200,"./is_plain_object":202,"./keyed_container":203,"./localize":204,"./loggers":205,"./make_trace_groups":206,"./matrix":207,"./mod":208,"./nested_property":209,"./noop":210,"./notifier":211,"./push_unique":214,"./regex":216,"./relative_attr":217,"./relink_private":218,"./search":219,"./stats":221,"./throttle":223,"./to_log_range":224,d3:9,"d3-time-format":7,"fast-isnumeric":11}],202:[function(e,t,r){"use strict";t.exports=function(e){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(e):"[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.prototype}},{}],203:[function(e,t,r){"use strict";var n=e("./nested_property"),a=/^\w*$/;t.exports=function(e,t,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};t&&t.length?(s=n(e,t),l=s.get()):l=e,t=t||"";var u={};if(l)for(o=0;o2)return c[t]=2|c[t],d.set(e,null);if(f){for(o=t;o1){var t=["LOG:"];for(e=0;e1){var r=[];for(e=0;e"),"long")}},i.warn=function(){var e;if(n.logging>0){var t=["WARN:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}},i.error=function(){var e;if(n.logging>0){var t=["ERROR:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}}},{"../plot_api/plot_config":233,"./notifier":211}],206:[function(e,t,r){"use strict";var n=e("d3");t.exports=function(e,t,r){var a=e.selectAll("g."+r.replace(/\s/g,".")).data(t,(function(e){return e[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=e.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(e){e[0][i]=n.select(this)})),a}},{d3:9}],207:[function(e,t,r){"use strict";var n=e("gl-mat4");r.init2dArray=function(e,t){for(var r=new Array(e),n=0;nt/2?e-Math.round(e/t)*t:e}}},{}],209:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./array").isArrayOrTypedArray;function i(e,t){return function(){var r,n,o,l,s,c=e;for(l=0;l/g),s=0;si||c===a||cl)&&(!t||!s(e))}:function(e,t){var s=e[0],c=e[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(e,t){var r=[e[0]],n=0,a=0;function o(o){e.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(e.pop());return{addPt:o,raw:e,filtered:r}}},{"../constants/numerical":180,"./matrix":207}],214:[function(e,t,r){"use strict";t.exports=function(e,t){if(t instanceof RegExp){for(var r=t.toString(),n=0;na.queueLength&&(e.undoQueue.queue.shift(),e.undoQueue.index--))},startSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!0,e.undoQueue.beginSequence=!0},stopSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!1,e.undoQueue.beginSequence=!1},undo:function(e){var t,r;if(e.framework&&e.framework.isPolar)e.framework.undo();else if(!(void 0===e.undoQueue||isNaN(e.undoQueue.index)||e.undoQueue.index<=0)){for(e.undoQueue.index--,t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;r=e.undoQueue.queue.length)){for(t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;rt}function u(e,t){return e>=t}r.findBin=function(e,t,r){if(n(t.start))return r?Math.ceil((e-t.start)/t.size-1e-9)-1:Math.floor((e-t.start)/t.size+1e-9);var i,o,f=0,d=t.length,p=0,h=d>1?(t[d-1]-t[0])/(d-1):1;for(o=h>=0?r?l:s:r?u:c,e+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.log("Long binary search..."),f-1},r.sorterAsc=function(e,t){return e-t},r.sorterDes=function(e,t){return t-e},r.distinctVals=function(e,t){var n,a=(t||{}).unitMinDiff,i=e.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var l=1;a||(l=i[n]-i[0]||1);for(var s,c=l/(n||1)/1e4,u=[],f=0;f<=n;f++){var d=i[f],p=d-s;void 0===s?(u.push(d),s=d):p>c&&(l=Math.min(l,p),u.push(d),s=d)}return{vals:u,minDiff:l}},r.roundUp=function(e,t,r){for(var n,a=0,i=t.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()},r.findIndexOfMin=function(e,t){t=t||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(t)||(t=!1),a(i[0])){for(s=new Array(o),l=0;le.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}},{"./array":187,"fast-isnumeric":11}],222:[function(e,t,r){"use strict";var n=e("d3"),a=e("../lib"),i=a.strTranslate,o=e("../constants/xmlns_namespaces"),l=e("../constants/alignment").LINE_SPACING;function s(e,t){return e.node().getBoundingClientRect()[t]}var c=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(e,t,A){var L=e.text(),C=!e.attr("data-notex")&&"undefined"!=typeof MathJax&&L.match(c),O=n.select(e.node().parentNode);if(!O.empty()){var D=e.attr("class")?e.attr("class").split(" ")[0]:"text";return D+="-math",O.selectAll("svg."+D).remove(),O.selectAll("g."+D+"-group").remove(),e.style("display",null).attr({"data-unformatted":L,"data-math":"N"}),C?(t&&t._promises||[]).push(new Promise((function(t){e.style("display","none");var r=parseInt(e.node().style.fontSize,10),o={fontSize:r};!function(e,t,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":t.fontSize+"px"}).text(e.replace(u,"\\lt ").replace(f,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var t=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",e),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),t,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(C[2],o,(function(n,a,o){O.selectAll("svg."+D).remove(),O.selectAll("g."+D+"-group").remove();var l=n&&n.select("svg");if(!l||!l.node())return P(),void t();var c=O.append("g").classed(D+"-group",!0).attr({"pointer-events":"none","data-unformatted":L,"data-math":"Y"});c.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:D,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=e.node().style.fill||"black",f=l.select("g");f.attr({fill:u,stroke:u});var d=s(f,"width"),p=s(f,"height"),h=+e.attr("x")-d*{start:0,middle:.5,end:1}[e.attr("text-anchor")||"start"],g=-(r||s(e,"height"))/4;"y"===D[0]?(c.attr({transform:"rotate("+[-90,+e.attr("x"),+e.attr("y")]+")"+i(-d/2,g-p/2)}),l.attr({x:+e.attr("x"),y:+e.attr("y")})):"l"===D[0]?l.attr({x:e.attr("x"),y:g-p/2}):"a"===D[0]&&0!==D.indexOf("atitle")?l.attr({x:0,y:g}):l.attr({x:h,y:+e.attr("y")+g-p/2}),A&&A.call(e,c),t(c)}))}))):P(),e}function P(){O.empty()||(D=e.attr("class")+"-math",O.select("svg."+D).remove()),e.text("").style("white-space","pre"),function(e,t){t=t.replace(v," ");var r,i=!1,s=[],c=-1;function u(){c++;var t=document.createElementNS(o.svg,"tspan");n.select(t).attr({class:"line",dy:c*l+"em"}),e.appendChild(t),r=t;var a=s;if(s=[{node:t}],a.length>1)for(var i=1;i doesnt match end tag <"+e+">. Pretending it did match.",t),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",t)}x.test(t)?u():(r=e,s=[{node:e}]);for(var C=t.split(m),O=0;O|>|>)/g;var d={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"},p={sub:"0.3em",sup:"-0.6em"},h={sub:"-0.21em",sup:"0.42em"},g=["http:","https:","mailto:","",void 0,":"],v=r.NEWLINES=/(\r\n?|\n)/g,m=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,x=//i;r.BR_TAG_ALL=//gi;var b=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,_=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,T=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function k(e,t){if(!e)return null;var r=e.match(t),n=r&&(r[3]||r[4]);return n&&S(n)}var M=/(^|;)\s*color:/;r.plainText=function(e,t){for(var r=void 0!==(t=t||{}).len&&-1!==t.len?t.len:1/0,n=void 0!==t.allowedTags?t.allowedTags:["br"],a="...".length,i=e.split(m),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var A={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},L=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function S(e){return e.replace(L,(function(e,t){return("#"===t.charAt(0)?function(e){if(e>1114111)return;var t=String.fromCodePoint;if(t)return t(e);var r=String.fromCharCode;return e<=65535?r(e):r(55232+(e>>10),e%1024+56320)}("x"===t.charAt(1)?parseInt(t.substr(2),16):parseInt(t.substr(1),10)):A[t])||e}))}function C(e,t,r){var n,i,o,l=r.horizontalAlign,s=r.verticalAlign||"top",c=e.node().getBoundingClientRect(),u=t.node().getBoundingClientRect();return i="bottom"===s?function(){return c.bottom-n.height}:"middle"===s?function(){return c.top+(c.height-n.height)/2}:function(){return c.top},o="right"===l?function(){return c.right-n.width}:"center"===l?function(){return c.left+(c.width-n.width)/2}:function(){return c.left},function(){n=this.node().getBoundingClientRect();var e=o()-u.left,t=i()-u.top,l=r.gd||{};if(r.gd){l._fullLayout._calcInverseTransform(l);var s=a.apply3DTransform(l._fullLayout._invTransform)(e,t);e=s[0],t=s[1]}return this.style({top:t+"px",left:e+"px","z-index":1e3}),this}}r.convertEntities=S,r.sanitizeHTML=function(e){e=e.replace(v," ");for(var t=document.createElement("p"),r=t,a=[],i=e.split(m),o=0;oi.ts+t?s():i.timer=setTimeout((function(){s(),i.timer=null}),t)},r.done=function(e){var t=n[e];return t&&t.timer?new Promise((function(e){var r=t.onDone;t.onDone=function(){r&&r(),e(),t.onDone=null}})):Promise.resolve()},r.clear=function(e){if(e)a(n[e]),delete n[e];else for(var t in n)r.clear(t)}},{}],224:[function(e,t,r){"use strict";var n=e("fast-isnumeric");t.exports=function(e,t){if(e>0)return Math.log(e)/Math.LN10;var r=Math.log(Math.min(t[0],t[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(t[0],t[1]))/Math.LN10-6),r}},{"fast-isnumeric":11}],225:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],226:[function(e,t,r){"use strict";t.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"}}},{}],227:[function(e,t,r){"use strict";var n=e("../registry");t.exports=function(e){for(var t,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=e.split("[")[0],l=0;l0&&o.log("Clearing previous rejected promises from queue."),e._promises=[]},r.cleanLayout=function(e){var t,n;e||(e={}),e.xaxis1&&(e.xaxis||(e.xaxis=e.xaxis1),delete e.xaxis1),e.yaxis1&&(e.yaxis||(e.yaxis=e.yaxis1),delete e.yaxis1),e.scene1&&(e.scene||(e.scene=e.scene1),delete e.scene1);var i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(e);for(t=0;t3?(z.x=1.02,z.xanchor="left"):z.x<-2&&(z.x=-.02,z.xanchor="right"),z.y>3?(z.y=1.02,z.yanchor="bottom"):z.y<-2&&(z.y=-.02,z.yanchor="top")),h(e),"rotate"===e.dragmode&&(e.dragmode="orbit"),c.clean(e),e.template&&e.template.layout&&r.cleanLayout(e.template.layout),e},r.cleanData=function(e){for(var t=0;t0)return e.substr(0,t)}r.hasParent=function(e,t){for(var r=b(t);r;){if(r in e)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(e,t,r){for(var n=0;n1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))t.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;t.set(y)}return!g&&(d(v,m),p(e),!0)}var x,b,_,w,T,k,M,A,L=Object.keys(r).map(Number).sort(o),S=t.get(),C=S||[],O=u(m,f).get(),D=[],P=-1,z=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?D.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),O&&O.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,k),-1===P&&(P=_);else for(b=0;b=0;x--)C.splice(D[x],1),O&&O.splice(D[x],1);if(C.length?S||t.set(C):t.set(null),g)return!1;if(d(v,m),h!==a){var R;if(-1===P)R=L;else{for(z=Math.max(C.length,z),R=[],x=0;x=P);x++)R.push(_);for(x=P;x=e.data.length||a<-e.data.length)throw new Error(r+" must be valid indices for gd.data.");if(t.indexOf(a,n+1)>-1||a>=0&&t.indexOf(-e.data.length+a)>-1||a<0&&t.indexOf(e.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function R(e,t,r){if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("currentIndices is a required argument.");if(Array.isArray(t)||(t=[t]),z(e,t,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&z(e,r,"newIndices"),"undefined"!=typeof r&&t.length!==r.length)throw new Error("current and new indices must be of equal length.")}function E(e,t,r,n,i){!function(e,t,r,n){var a=o.isPlainObject(n);if(!Array.isArray(e.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(t))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 i in z(e,r,"indices"),t){if(!Array.isArray(t[i])||t[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==t[i].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")}}(e,t,r,n);for(var s=function(e,t,r,n){var i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=P(r,e.data.length-1),t)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(t,r){e[r]=e[t],delete e[t]}}function U(e,t,r){if(e=o.getGraphDiv(e),T.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var n={};if("string"==typeof t)n[t]=r;else{if(!o.isPlainObject(t))return o.warn("Relayout fail.",t,r),Promise.reject();n=o.extendFlat({},t)}Object.keys(n).length&&(e.changed=!0);var a=W(e,n),i=a.flags;i.calc&&(e.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(k.layoutReplot):Object.keys(n).length&&(q(e,i,a)||d.supplyDefaults(e),i.legend&&l.push(k.doLegend),i.layoutstyle&&l.push(k.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(k.doTicksRelayout),i.modebar&&l.push(k.doModeBar),i.camera&&l.push(k.doCamera),i.colorbars&&l.push(k.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(e,U,[e,a.undoit],U,[e,a.redoit]);var s=o.syncOrAsync(l,e);return s&&s.then||(s=Promise.resolve(e)),s.then((function(){return e.emit("plotly_relayout",a.eventData),e}))}function q(e,t,r){var n=e._fullLayout;if(!t.axrange)return!1;for(var a in t)if("axrange"!==a&&t[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=e.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(e,t){var r=t?function(e){var r=[],n=!0;for(var a in t){var i=h.getFromId(e,a);if(r.push(a),-1!==(i.ticklabelposition||"").indexOf("inside")&&i._anchorAxis&&r.push(i._anchorAxis._id),i._matchGroup)for(var o in i._matchGroup)t[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(e,r,{skipTitle:n})}:function(e){return h.draw(e,"redraw")};e.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(e,t){var r,n,a,i=e.layout,s=e._fullLayout,c=s._guiEditing,d=H(s._preGUI,c),p=Object.keys(t),g=h.list(e),v=o.extendDeepAll({},t),m={};for(V(t),p=Object.keys(t),n=0;n0&&"string"!=typeof z.parts[E];)E--;var I=z.parts[E],F=z.parts[E-1]+"."+I,j=z.parts.slice(0,E).join("."),B=l(e.layout,j).get(),U=l(s,j).get(),q=z.get();if(void 0!==R){k[P]=R,L[P]="reverse"===I?R:N(q);var G=f.getLayoutValObject(s,z.parts);if(G&&G.impliedEdits&&null!==R)for(var W in G.impliedEdits)S(o.relativeAttr(P,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(P))if(R){S("autosize",null);var J="height"===P?"width":"height";S(J,s[J])}else s[P]=e._initialAutoSize[P];else if("autosize"===P)S("width",R?null:s.width),S("height",R?null:s.height);else if(F.match(Z))D(F),l(s,j+"._inputRange").set(null);else if(F.match(Y)){D(F),l(s,j+"._inputRange").set(null);var $=l(s,j).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else F.match(X)&&l(s,j+"._inputDomain").set(null);if("type"===I){C=B;var K="linear"===U.type&&"log"===R,ee="log"===U.type&&"linear"===R;if(K||ee){if(C&&C.range)if(U.autorange)K&&(C.range=C.range[1]>C.range[0]?[1,2]:[2,1]);else{var te=C.range[0],re=C.range[1];K?(te<=0&&re<=0&&S(j+".autorange",!0),te<=0?te=re/1e6:re<=0&&(re=te/1e6),S(j+".range[0]",Math.log(te)/Math.LN10),S(j+".range[1]",Math.log(re)/Math.LN10)):(S(j+".range[0]",Math.pow(10,te)),S(j+".range[1]",Math.pow(10,re)))}else S(j+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[z.parts[0]]&&"radialaxis"===z.parts[1]&&delete s[z.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(e,U,R,S),u.getComponentMethod("images","convertCoords")(e,U,R,S)}else S(j+".autorange",!0),S(j+".range",null);l(s,j+"._inputRange").set(null)}else if(I.match(A)){var ne=l(s,P).get(),ae=(R||{}).type;ae&&"-"!==ae||(ae="linear"),u.getComponentMethod("annotations","convertCoords")(e,ne,ae,S),u.getComponentMethod("images","convertCoords")(e,ne,ae,S)}var ie=w.containerArrayMatch(P);if(ie){r=ie.array,n=ie.index;var oe=ie.property,le=G||{editType:"calc"};""!==n&&""===oe&&(w.isAddVal(R)?L[P]=null:w.isRemoveVal(R)?L[P]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",t)),M.update(_,le),m[r]||(m[r]={});var se=m[r][n];se||(se=m[r][n]={}),se[oe]=R,delete t[P]}else"reverse"===I?(B.range?B.range.reverse():(S(j+".autorange",!0),B.range=[1,0]),U.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===P&&("lasso"===R||"select"===R)&&"lasso"!==q&&"select"!==q||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,z.set(R))}}for(r in m){w.applyContainerArrayChanges(e,d(i,r),m[r],_,d)||(_.plot=!0)}for(var ce in O){var ue=(C=h.getFromId(e,ce))&&C._constraintGroup;if(ue)for(var fe in _.calc=!0,ue)O[fe]||(h.getFromId(e,fe)._constraintShrinkable=!0)}return(Q(e)||t.height||t.width)&&(_.plot=!0),(_.plot||_.calc)&&(_.layoutReplot=!0),{flags:_,rangesAltered:O,undoit:L,redoit:k,eventData:v}}function Q(e){var t=e._fullLayout,r=t.width,n=t.height;return e.layout.autosize&&d.plotAutoSize(e,e.layout,t),t.width!==r||t.height!==n}function J(e,t,n,a){if(e=o.getGraphDiv(e),T.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);o.isPlainObject(t)||(t={}),o.isPlainObject(n)||(n={}),Object.keys(t).length&&(e.changed=!0),Object.keys(n).length&&(e.changed=!0);var i=T.coerceTraceIndices(e,a),l=B(e,o.extendFlat({},t),i),s=l.flags,u=W(e,o.extendFlat({},n)),f=u.flags;(s.calc||f.calc)&&(e.calcdata=void 0),s.clearAxisTypes&&T.clearAxisTypes(e,i,n);var p=[];f.layoutReplot?p.push(k.layoutReplot):s.fullReplot?p.push(r.plot):(p.push(d.previousPromises),q(e,f,u)||d.supplyDefaults(e),s.style&&p.push(k.doTraceStyle),(s.colorbars||f.colorbars)&&p.push(k.doColorBars),f.legend&&p.push(k.doLegend),f.layoutstyle&&p.push(k.layoutStyles),f.axrange&&G(p,u.rangesAltered),f.ticks&&p.push(k.doTicksRelayout),f.modebar&&p.push(k.doModeBar),f.camera&&p.push(k.doCamera),p.push(S)),p.push(d.rehover,d.redrag),c.add(e,J,[e,l.undoit,u.undoit,l.traces],J,[e,l.redoit,u.redoit,l.traces]);var h=o.syncOrAsync(p,e);return h&&h.then||(h=Promise.resolve(e)),h.then((function(){return e.emit("plotly_update",{data:l.eventData,layout:u.eventData}),e}))}function $(e){return function(t){t._fullLayout._guiEditing=!0;var r=e.apply(null,arguments);return t._fullLayout._guiEditing=!1,r}}var K=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],ee=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function te(e,t){for(var r=0;r1;)if(n.pop(),void 0!==(r=l(t,n.join(".")+".uirevision").get()))return r;return t.uirevision}function ne(e,t){for(var r=0;r=a.length?a[0]:a[e]:a}function s(e){return Array.isArray(i)?e>=i.length?i[0]:i[e]:i}function c(e,t){var r=0;return function(){if(e&&++r===t)return e()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){function f(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var t=n._currentFrame=n._frameQueue.shift();if(t){var r=t.name?t.name.toString():null;e._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=t.frameOpts.duration,d.transition(e,t.frame.data,t.frame.layout,T.coerceTraceIndices(e,t.frame.traces),t.frameOpts,t.transitionOpts).then((function(){t.onComplete&&t.onComplete()})),e.emit("plotly_animatingframe",{name:r,frame:t.frame,animation:{frame:t.frameOpts,transition:t.transitionOpts}})}else e.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function p(){e.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var t=function(){n._animationRaf=window.requestAnimationFrame(t),Date.now()-n._lastFrameAt>n._timeToNext&&f()};t()}var h,g,v=0;function m(e){return Array.isArray(a)?v>=a.length?e.transitionOpts=a[v]:e.transitionOpts=a[0]:e.transitionOpts=a,v++,e}var y=[],x=null==t,b=Array.isArray(t);if(!x&&!b&&o.isPlainObject(t))y.push({type:"object",data:m(o.extendFlat({},t))});else if(x||-1!==["string","number"].indexOf(typeof t))for(h=0;h0&&kk)&&M.push(g);y=M}}y.length>0?function(t){if(0!==t.length){for(var a=0;a=0;n--)if(o.isPlainObject(t[n])){var g=t[n].name,v=(u[g]||h[g]||{}).name,m=t[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[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.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(t[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(e,t){return e.index>t.index?-1:e.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+e._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=t[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[e,l],p=[e,i];return c&&c.add(e,s,f,u,p),d.modifyFrames(e,i)},r.addTraces=function e(t,n,a){t=o.getGraphDiv(t);var i,l,s=[],u=r.deleteTraces,f=e,d=[t,s],p=[t,n];for(function(e,t,r){var n,a;if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("traces must be defined.");for(Array.isArray(t)||(t=[t]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===e.dimensions){if(r++,t.length===r)return e;var o=t[r];if(!_(o))return!1;e=i[a][o]}else e=i[a]}else e=i}}return e}function _(e){return e===Math.round(e)&&e>=0}function w(){var e,t,r={};for(e in h(r,o),n.subplotsRegistry){if((t=n.subplotsRegistry[e]).layoutAttributes)if(Array.isArray(t.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[t[2]],l=3}else if("area"===e.type)a=u[o];else{var f=e._module;if(f||(f=(n.modules[e.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,t,l)},r.getLayoutValObject=function(e,t){return b(function(e,t){var r,a,i,l,s=e._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=t+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(e,t){o?n.nestedProperty(l[s],e).set(t):l[s+"."+e]=t}function f(){var e=l;return c(),e}return c(),{modifyBase:function(e,t){l[e]=t},modifyItem:u,getUpdateObj:f,applyUpdate:function(t,r){t&&u(t,r);var a=f();for(var i in a)n.nestedProperty(e,i).set(a[i])}}}},{"../lib":201,"../plots/attributes":242}],236:[function(e,t,r){"use strict";var n=e("d3"),a=e("../registry"),i=e("../plots/plots"),o=e("../lib"),l=e("../lib/clear_gl_canvases"),s=e("../components/color"),c=e("../components/drawing"),u=e("../components/titles"),f=e("../components/modebar"),d=e("../plots/cartesian/axes"),p=e("../constants/alignment"),h=e("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=e("../plots/cartesian/autorange").doAutoRange;function y(e,t,r){for(var n=0;n=e[1]||a[1]<=e[0])&&(i[0]t[0]))return!0}return!1}function x(e){var t,a,l,u,h,g,v=e._fullLayout,m=v._size,x=m.p,_=d.list(e,"",!0);if(v._paperdiv.style({width:e._context.responsive&&v.autosize&&!e._context._hasZeroWidth&&!e.layout.width?"100%":v.width+"px",height:e._context.responsive&&v.autosize&&!e._context._hasZeroHeight&&!e.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),e._context.setBackground(e,v.paper_bgcolor),r.drawMainTitle(e),f.manage(e),!v._has("cartesian"))return i.previousPromises(e);function T(e,t,r){var n=e._lw/2;return"x"===e._id.charAt(0)?t?"top"===r?t._offset-x-n:t._offset+t._length+x+n:m.t+m.h*(1-(e.position||0))+n%1:t?"right"===r?t._offset+t._length+x+n:t._offset-x-n:m.l+m.w*(e.position||0)+n%1}for(t=0;t<_.length;t++){var k=(u=_[t])._anchorAxis;u._linepositions={},u._lw=c.crispRound(e,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,O=l.yaxis.domain,D=l.plotgroup;if(y(C,O,L)){var P=D.node(),z=l.bg=o.ensureSingle(D,"rect","bg");P.insertBefore(z.node(),P.childNodes[0]),A.push(a)}else D.select("rect.bg").remove(),L.push([C,O]),S||(M.push(a),A.push(a))}var R,E,I,F,N,H,j,B,V,U,q,G,Z,Y=v._bgLayer.selectAll(".bg").data(M);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(e){v._plots[e].bg=n.select(this)})),t=0;tT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function e(t,r){for(var n in t)if("_"!==n.charAt(0)){var i=t[n],o=g(t,n,r);a(i)?(Array.isArray(t)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),e(i,o)):Array.isArray(i)&&v(i)&&e(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":201,"../plots/attributes":242,"../plots/plots":280,"./plot_config":233,"./plot_schema":234,"./plot_template":235}],238:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./plot_api"),i=e("../plots/plots"),o=e("../lib"),l=e("../snapshot/helpers"),s=e("../snapshot/tosvg"),c=e("../snapshot/svgtoimg"),u=e("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};t.exports=function(e,t){var r,d,p,h;function g(e){return!(e in t)||o.validate(t[e],f[e])}if(t=t||{},o.isPlainObject(e)?(r=e.data||[],d=e.layout||{},p=e.config||{},h={}):(e=o.getGraphDiv(e),r=o.extendDeep([],e.data),d=o.extendDeep({},e.layout),p=e._context,h=e._fullLayout||{}),!g("width")&&null!==t.width||!g("height")&&null!==t.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Export format is not "+o.join2(f.format.values,", "," or ")+".");var v={};function m(e,r){return o.coerce(t,v,f,e,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),T=m("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},d);x?M.width=x:null===t.width&&n(h.width)&&(M.width=h.width),b?M.height=b:null===t.height&&n(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(k);function S(){return new Promise((function(e){setTimeout(e,l.getDelay(k._fullLayout))}))}function C(){return new Promise((function(e,t){var r=s(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function d(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),e(T?p:l.encodeJSON(p))}if(d(),"svg"===y)return e(T?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(e).catch(t)}))}return new Promise((function(e,t){a.plot(k,r,M,A).then(L).then(S).then(C).then((function(t){e(function(e){return T?e.replace(l.IMAGE_URL_PREFIX,""):e}(t))})).catch((function(e){t(e)}))}))}},{"../lib":201,"../plots/plots":280,"../snapshot/helpers":292,"../snapshot/svgtoimg":294,"../snapshot/tosvg":296,"../version":356,"./plot_api":232,"fast-isnumeric":11}],239:[function(e,t,r){"use strict";var n=e("../lib"),a=e("../plots/plots"),i=e("./plot_schema"),o=e("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(e,t,r,a,i,o){o=o||[];for(var f=Object.keys(e),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,O=x.length,D=Array.isArray(k);if(D&&(O=Math.min(O,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var P=x[A].length;for(M=0;M<(D?Math.min(P,k[A].length):P);M++)L=D?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&Math.round(f)===f))return a;c=f}for(var d=t.calendar,p="start"===s,h="end"===s,g=e[r+"period0"],v=i(g,d)||0,m=[],y=a.length,x=0;xT;)w=o(w,-c,d);for(;w<=T;)w=o(w,c,d);_=o(w,-c,d)}else{for(w=v+(b=Math.round((T-v)/u))*u;w>T;)w-=u;for(;w<=T;)w+=u;_=w-u}m[x]=p?_:h?w:(_+w)/2}return m}},{"../../constants/numerical":180,"../../lib":201,"fast-isnumeric":11}],244:[function(e,t,r){"use strict";t.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],245:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("../../constants/numerical").FP_SAFE,o=e("../../registry"),l=e("./axis_ids").getFromId;function s(e,t){var r,n,i=[],o=u(t,0),l=u(t,1),s=f(e,t),d=s.min,p=s.max;if(0===d.length||0===p.length)return a.simpleMap(t.range,t.r2l);var h=d[0].val,g=p[0].val;for(r=1;r0&&((w=L-o(y)-l(x))>S?T/w>C&&(b=y,_=x,C=T/w):T/L>C&&(b={val:y.val,pad:0},_={val:x.val,pad:0},C=T/L));if(h===g){var O=h-1,D=h+1;if(M)if(0===h)i=[0,1];else{var P=(h>0?p:d).reduce((function(e,t){return Math.max(e,l(t))}),0),z=h/(1-Math.min(.5,P/L));i=h>0?[0,z]:[z,0]}else i=A?[Math.max(0,O),Math.max(1,D)]:[O,D]}else M?(b.val>=0&&(b={val:0,pad:0}),_.val<=0&&(_={val:0,pad:0})):A&&(b.val-C*o(b)<0&&(b={val:0,pad:0}),_.val<=0&&(_={val:1,pad:0})),C=(_.val-b.val-c(t,y.val,x.val))/(L-o(b)-l(_)),i=[b.val-C*o(b),_.val+C*l(_)];return v&&i.reverse(),a.simpleMap(i,t.l2r||Number)}function c(e,t,r){var n=0;if(e.rangebreaks)for(var a=e.locateBreaks(t,r),i=0;i0?r.ppadplus:r.ppadminus)||r.ppad||0),L=M((e._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(h=1/0,v=-1/0,w)for(a=0;a0&&(h=o),o>v&&o-i&&(h=o),o>v&&o=P;a--)D(a);return{min:m,max:y,opts:r}},concatExtremes:f};function f(e,t,r){var n,a,i,o=t._id,s=e._fullData,c=e._fullLayout,u=[],h=[];function g(e,t){for(n=0;n=r&&(c.extrapad||!o)){l=!1;break}a(t,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(e.splice(s,1),s--)}if(l){var u=i&&0===t;e.push({val:t,pad:u?0:r,extrapad:!u&&o})}}function g(e){return n(e)&&Math.abs(e)=t}},{"../../constants/numerical":180,"../../lib":201,"../../registry":288,"./axis_ids":249,"fast-isnumeric":11}],246:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib"),s=l.strTranslate,c=e("../../lib/svg_text_utils"),u=e("../../components/titles"),f=e("../../components/color"),d=e("../../components/drawing"),p=e("./layout_attributes"),h=e("./clean_ticks"),g=e("../../constants/numerical"),v=g.ONEMAXYEAR,m=g.ONEAVGYEAR,y=g.ONEMINYEAR,x=g.ONEMAXQUARTER,b=g.ONEAVGQUARTER,_=g.ONEMINQUARTER,w=g.ONEMAXMONTH,T=g.ONEAVGMONTH,k=g.ONEMINMONTH,M=g.ONEWEEK,A=g.ONEDAY,L=A/2,S=g.ONEHOUR,C=g.ONEMIN,O=g.ONESEC,D=g.MINUS_SIGN,P=g.BADNUM,z=e("../../constants/alignment"),R=z.MID_SHIFT,E=z.CAP_SHIFT,I=z.LINE_SPACING,F=z.OPPOSITE_SIDE,N=t.exports={};N.setConvert=e("./set_convert");var H=e("./axis_autotype"),j=e("./axis_ids");N.id2name=j.id2name,N.name2id=j.name2id,N.cleanId=j.cleanId,N.list=j.list,N.listIds=j.listIds,N.getFromId=j.getFromId,N.getFromTrace=j.getFromTrace;var B=e("./autorange");N.getAutoRange=B.getAutoRange,N.findExtremes=B.findExtremes;function V(e){var t=1e-4*(e[1]-e[0]);return[e[0]-t,e[1]+t]}N.coerceRef=function(e,t,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||("string"==typeof i?i:i[0])),i||(i=a),s=s.concat(s.map((function(e){return e+" domain"}))),u[c]={valType:"enumerated",values:s.concat(i?"string"==typeof i?[i]:i:[]),dflt:a},l.coerce(e,t,u,c)},N.getRefType=function(e){return void 0===e?e:"paper"===e?"paper":"pixel"===e?"pixel":/( domain)$/.test(e)?"domain":"range"},N.coercePosition=function(e,t,r,n,a,i){var o,s;if("range"!==N.getRefType(n))o=l.ensureNumber,s=r(a,i);else{var c=N.getFromId(t,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}e[a]=o(s)},N.cleanPosition=function(e,t,r){return("paper"===r||"pixel"===r?l.ensureNumber:N.getFromId(t,r).cleanPos)(e)},N.redrawComponents=function(e,t){t=t||N.listIds(e);var r=e._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-e._forceTick0)/e._minDtick%1+1.000001)%1>2e-6)&&(e._minDtick=0)):e._minDtick=0},N.saveRangeInitial=function(e,t){for(var r=N.list(e,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;e+=e+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?e=N.tickIncrement(e,"M6","reverse")+1.5*A:i.exactMonths>.8?e=N.tickIncrement(e,"M1","reverse")+15.5*A:e-=L;var s=N.tickIncrement(e,r);if(s<=n)return s}return e}(y,e,m,c,i)),v=y,0;v<=u;)v=N.tickIncrement(v,m,!1,i);return{start:t.c2r(y,0,i),end:t.c2r(v,0,i),size:m,_dataSpan:u-c}},N.prepTicks=function(e,t){var r=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if(e._dtickInit=e.dtick,e._tick0Init=e.tick0,"auto"===e.tickmode||!e.dtick){var n,i=e.nticks;i||("category"===e.type||"multicategory"===e.type?(n=e.tickfont?1.2*(e.tickfont.size||12):15,i=e._length/n):(n="y"===e._id.charAt(0)?40:80,i=l.constrain(e._length/n,4,9)+1),"radialaxis"===e._name&&(i*=2)),"array"===e.tickmode&&(i*=100),e._roughDTick=Math.abs(r[1]-r[0])/i,N.autoTicks(e,e._roughDTick),e._minDtick>0&&e.dtick<2*e._minDtick&&(e.dtick=e._minDtick,e.tick0=e.l2r(e._forceTick0))}"period"===e.ticklabelmode&&function(e){var t;function r(){return!(a(e.dtick)||"M"!==e.dtick.charAt(0))}var n=r(),i=N.getTickFormat(e);if(i){var o=e._dtickInit!==e.dtick;/%[fLQsSMX]/.test(i)||(/%[HI]/.test(i)?(t=S,o&&!n&&e.dticki&&f=o:p<=o;p=N.tickIncrement(p,e.dtick,s,e.calendar)){if(e.rangebreaks&&!s){if(p=u)break}if(C.length>g||p===O)break;O=p;var D=!1;f&&p!==(0|p)&&(D=!0),C.push({minor:D,value:p})}if(d&&function(e,t,r){for(var n=0;n0?(i=n-1,o=n):(i=n,o=n);var l,s=e[i].value,c=e[o].value,u=Math.abs(c-s),f=r||u,d=0;f>=y?d=u>=y&&u<=v?u:m:r===b&&f>=_?d=u>=_&&u<=x?u:b:f>=k?d=u>=k&&u<=w?u:T:r===M&&f>=M?d=M:f>=A?d=A:r===L&&f>=L?d=L:r===S&&f>=S&&(d=S),d>=u&&(d=u,l=!0);var p=a+d;if(t.rangebreaks&&d>0){for(var h=0,g=0;g<84;g++){var C=(g+.5)/84;t.maskBreaks(a*(1-C)+C*p)!==P&&h++}(d*=h/84)||(e[n].drop=!0),l&&u>M&&(d=u)}(d>0||0===n)&&(e[n].periodX=a+d/2)}}(C,e,e._definedDelta),e.rangebreaks){var z="y"===e._id.charAt(0),R=1;"auto"===e.tickmode&&(R=e.tickfont?e.tickfont.size:12);var E=NaN;for(h=C.length-1;h>-1;h--)if(C[h].drop)C.splice(h,1);else{C[h].value=be(C[h].value,e);var I=e.c2p(C[h].value);(z?E>I-R:Eu||Hu&&(F.periodX=u),H10||"01-01"!==n.substr(5)?e._tickround="d":e._tickround=+t.substr(1)%12==0?"y":"m";else if(t>=A&&i<=10||t>=15*A)e._tickround="d";else if(t>=C&&i<=16||t>=S)e._tickround="M";else if(t>=O&&i<=19||t>=C)e._tickround="S";else{var o=e.l2r(r+t).replace(/^-/,"").length;e._tickround=Math.max(i,o)-20,e._tickround<0&&(e._tickround=4)}}else if(a(t)||"L"===t.charAt(0)){var l=e.range.map(e.r2d||Number);a(t)||(t=Number(t.substr(1))),e._tickround=2-Math.floor(Math.log(t)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01),u=void 0===e.minexponent?3:e.minexponent;Math.abs(c)>u&&(ae(e.exponentformat)&&!ie(c)?e._tickexponent=3*Math.round((c-1)/3):e._tickexponent=c)}else e._tickround=null}function re(e,t,r){var n=e.tickfont||{};return{x:t,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}N.autoTicks=function(e,t){var r;function n(e){return Math.pow(e,Math.floor(Math.log(t)/Math.LN10))}if("date"===e.type){e.tick0=l.dateTick0(e.calendar,0);var i=2*t;if(i>m)t/=m,r=n(10),e.dtick="M"+12*ee(t,r,Y);else if(i>T)t/=T,e.dtick="M"+ee(t,1,X);else if(i>A){e.dtick=ee(t,A,e._hasDayOfWeekBreaks?[1,2,7,14]:Q);var o=N.getTickFormat(e),s="period"===e.ticklabelmode;s&&(e._rawTick0=e.tick0),/%[uVW]/.test(o)?e.tick0=l.dateTick0(e.calendar,2):e.tick0=l.dateTick0(e.calendar,1),s&&(e._dowTick0=e.tick0)}else i>S?e.dtick=ee(t,S,X):i>C?e.dtick=ee(t,C,W):i>O?e.dtick=ee(t,O,W):(r=n(10),e.dtick=ee(t,r,Y))}else if("log"===e.type){e.tick0=0;var c=l.simpleMap(e.range,e.r2l);if(t>.7)e.dtick=Math.ceil(t);else if(Math.abs(c[1]-c[0])<1){var u=1.5*Math.abs((c[1]-c[0])/t);t=Math.abs(Math.pow(10,c[1])-Math.pow(10,c[0]))/u,r=n(10),e.dtick="L"+ee(t,r,Y)}else e.dtick=t>.3?"D2":"D1"}else"category"===e.type||"multicategory"===e.type?(e.tick0=0,e.dtick=Math.ceil(Math.max(t,1))):xe(e)?(e.tick0=0,r=1,e.dtick=ee(t,r,K)):(e.tick0=0,r=n(10),e.dtick=ee(t,r,Y));if(0===e.dtick&&(e.dtick=1),!a(e.dtick)&&"string"!=typeof e.dtick){var f=e.dtick;throw e.dtick=1,"ax.dtick error: "+String(f)}},N.tickIncrement=function(e,t,r,i){var o=r?-1:1;if(a(t))return l.increment(e,o*t);var s=t.charAt(0),c=o*Number(t.substr(1));if("M"===s)return l.incrementMonth(e,c,i);if("L"===s)return Math.log(Math.pow(10,e)+c)/Math.LN10;if("D"===s){var u="D2"===t?$:J,f=e+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(t)},N.tickFirst=function(e,t){var r=e.r2l||Number,i=l.simpleMap(e.range,r,void 0,void 0,t),o=i[1]"+s,e._prevDateHead=s));t.text=c}(e,o,r,c):"log"===u?function(e,t,r,n,i){var o=e.dtick,s=t.x,c=e.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)t.text=oe(Math.pow(10,s),e,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=e.exponentformat;"power"===p||ae(p)&&ie(f)?(t.text=0===f?1:1===f?"10":"10"+(f>1?"":D)+d+"",t.fontSize*=1.25):("e"===p||"E"===p)&&d>2?t.text="1"+p+(f>0?"+":D)+d:(t.text=oe(Math.pow(10,s),e,"","fakehover"),"D1"===o&&"y"===e._id.charAt(0)&&(t.dy-=t.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);t.text=String(Math.round(Math.pow(10,l.mod(s,1)))),t.fontSize*=.75}if("D1"===e.dtick){var h=String(t.text).charAt(0);"0"!==h&&"1"!==h||("y"===e._id.charAt(0)?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(s<0?.5:.25)))}}(e,o,0,c,g):"category"===u?function(e,t){var r=e._categories[Math.round(t.x)];void 0===r&&(r="");t.text=String(r)}(e,o):"multicategory"===u?function(e,t,r){var n=Math.round(t.x),a=e._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?t.text=o+" - "+i:(t.text=i,t.text2=o)}(e,o,r):xe(e)?function(e,t,r,n,a){if("radians"!==e.thetaunit||r)t.text=oe(t.x,e,a,n);else{var i=t.x/180;if(0===i)t.text="0";else{var o=function(e){function t(e,t){return Math.abs(e-t)<=1e-6}var r=function(e){for(var r=1;!t(Math.round(e*r)/r,e);)r*=10;return r}(e),n=e*r,a=Math.abs(function e(r,n){return t(n,0)?r:e(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)t.text=oe(l.deg2rad(t.x),e,a,n);else{var s=t.x<0;1===o[1]?1===o[0]?t.text="\u03c0":t.text=o[0]+"\u03c0":t.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(t.text=D+t.text)}}}}(e,o,r,c,g):function(e,t,r,n,a){"never"===a?a="":"all"===e.showexponent&&Math.abs(t.x/e.dtick)<1e-6&&(a="hide");t.text=oe(t.x,e,a,n)}(e,o,0,c,g),n||(e.tickprefix&&!h(e.showtickprefix)&&(o.text=e.tickprefix+o.text),e.ticksuffix&&!h(e.showticksuffix)&&(o.text+=e.ticksuffix)),"boundaries"===e.tickson||e.showdividers){var v=function(t){var r=e.l2p(t);return r>=0&&r<=e._length?t:null};o.xbnd=[v(o.x-.5),v(o.x+e.dtick-.5)]}return o},N.hoverLabelText=function(e,t,r){if(r!==P&&r!==t)return N.hoverLabelText(e,t)+" - "+N.hoverLabelText(e,r);var n="log"===e.type&&t<=0,a=N.tickText(e,e.c2l(n?-t:t),"hover").text;return n?0===t?"0":D+a:a};var ne=["f","p","n","\u03bc","m","","k","M","G","T"];function ae(e){return"SI"===e||"B"===e}function ie(e){return e>14||e<-15}function oe(e,t,r,n){var i=e<0,o=t._tickround,s=r||t.exponentformat||"B",c=t._tickexponent,u=N.getTickFormat(t),f=t.separatethousands;if(n){var d={exponentformat:s,minexponent:t.minexponent,dtick:"none"===t.showexponent?t.dtick:a(e)&&Math.abs(e)||1,range:"none"===t.showexponent?t.range.map(t.r2d):[0,e||1]};te(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,t.hoverformat&&(u=t.hoverformat)}if(u)return t._numFormat(u)(e).replace(/-/g,D);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(e=Math.abs(e))"+p+"":"B"===s&&9===c?e+="B":ae(s)&&(e+=ne[c/3+5]));return i?D+e:e}function le(e,t){for(var r=[],n={},a=0;a1&&r=a.min&&e=0,i=u(e,t[1])<=0;return(r||a)&&(n||i)}if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":for(t=0;t=o(a)))){r=n;break}break;case"log":for(t=0;t0?r.bottom-f:0,d)))),t.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=t._depth:(n[s]=t._depth=Math.max(r.width>0?f-r.top:0,d),p.reverse()),r.width>0){var v=r.right-(t._offset+t._length);v>0&&(n.xr=1,n.r=v);var m=t._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=t._depth=Math.max(r.height>0?f-r.left:0,d):(n[s]=t._depth=Math.max(r.height>0?r.right-f:0,d),p.reverse()),r.height>0){var y=r.bottom-(t._offset+t._length);y>0&&(n.yb=0,n.b=y);var x=t._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===t.anchor?t.position:t._anchorAxis.domain[p[0]],t.title.text!==c._dfltTitle[h]&&(n[s]+=ue(t)+(t.title.standoff||0)),t.mirror&&"free"!==t.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[u]=t.linewidth,t.mirror&&!0!==t.mirror&&(a[u]+=d),!0===t.mirror||"ticks"===t.mirror?a[g]=t._anchorAxis.domain[p[1]]:"all"!==t.mirror&&"allticks"!==t.mirror||(a[g]=[t._counterDomainMin,t._counterDomainMax][p[1]]))}J&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(e,t)),i.autoMargin(e,pe(t),n),i.autoMargin(e,he(t),a),i.autoMargin(e,ge(t),l)})),r.skipTitle||J&&"bottom"===t.side||W.push((function(){return function(e,t){var r,n=e._fullLayout,a=t._id,i=a.charAt(0),o=t.title.font.size;if(t.title.hasOwnProperty("standoff"))r=t._depth+t.title.standoff+ue(t);else{if("multicategory"===t.type)r=t._depth;else{r=10+1.5*o+(t.linewidth?t.linewidth-1:0)}r+="x"===i?"top"===t.side?o*(t.showticklabels?1:0):o*(t.showticklabels?1.5:.5):"right"===t.side?o*(t.showticklabels?1:.5):o*(t.showticklabels?.5:0)}var l,s,c,f,p=N.getPxPosition(e,t);"x"===i?(s=t._offset+t._length/2,c="top"===t.side?p-r:p+r):(c=t._offset+t._length/2,s="right"===t.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==t.type){var h=t._selections[t._id+"tick"];if(f={selection:h,side:t.side},h&&h.node()&&h.node().parentNode){var g=d.getTranslate(h.node().parentNode);f.offsetLeft=g.x,f.offsetTop=g.y}t.title.hasOwnProperty("standoff")&&(f.pad=0)}return u.draw(e,a+"title",{propContainer:t,propName:t._name+".title.text",placeholder:n._dfltTitle[i],avoid:f,transform:l,attributes:{x:s,y:c,"text-anchor":"middle"}})}(e,t)})),l.syncOrAsync(W)}}function $(e){var r=p+(e||"tick");return w[r]||(w[r]=function(e,t){var r,n,a,i;e._selections[t].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,e._selections[t].each((function(){var e=de(this),t=d.bBox(e.node().parentNode);r=Math.min(r,t.top),n=Math.max(n,t.bottom),a=Math.min(a,t.left),i=Math.max(i,t.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(t,r)),w[r]}},N.getTickSigns=function(e){var t=e._id.charAt(0),r={x:"top",y:"right"}[t],n=e.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==e.ticks==("x"===t)&&(a=a.map((function(e){return-e}))),e.side&&a.push({l:-1,t:-1,r:1,b:1}[e.side.charAt(0)]),a},N.makeTransTickFn=function(e){return"x"===e._id.charAt(0)?function(t){return s(e._offset+e.l2p(t.x),0)}:function(t){return s(0,e._offset+e.l2p(t.x))}},N.makeTransTickLabelFn=function(e){var t=function(e){var t=e.ticklabelposition||"",r=function(e){return-1!==t.indexOf(e)},n=r("top"),a=r("left"),i=r("right"),o=r("bottom"),l=r("inside"),s=o||a||n||i;if(!s&&!l)return[0,0];var c=e.side,u=s?(e.tickwidth||0)/2:0,f=3,d=e.tickfont?e.tickfont.size:12;(o||n)&&(u+=d*E,f+=(e.linewidth||0)/2);(a||i)&&(u+=(e.linewidth||0)/2,f+=3);l&&"top"===c&&(f-=d*(1-E));(a||n)&&(u=-u);"bottom"!==c&&"right"!==c||(f=-f);return[s?u:0,l?f:0]}(e),r=t[0],n=t[1];return"x"===e._id.charAt(0)?function(t){return s(r+e._offset+e.l2p(se(t)),n)}:function(t){return s(n,r+e._offset+e.l2p(se(t)))}},N.makeTickPath=function(e,t,r,n){n=void 0!==n?n:e.ticklen;var a=e._id.charAt(0),i=(e.linewidth||1)/2;return"x"===a?"M0,"+(t+i*r)+"v"+n*r:"M"+(t+i*r)+",0h"+n*r},N.makeLabelFns=function(e,t,r){var n=e.ticklabelposition||"",i=function(e){return-1!==n.indexOf(e)},o=i("top"),s=i("left"),c=i("right"),u=i("bottom")||s||o||c,f=i("inside"),d="inside"===n&&"inside"===e.ticks||!f&&"outside"===e.ticks&&"boundaries"!==e.tickson,p=0,h=0,g=d?e.ticklen:0;if(f?g*=-1:u&&(g=0),d&&(p+=g,r)){var v=l.deg2rad(r);p=g*Math.cos(v)+1,h=g*Math.sin(v)}e.showticklabels&&(d||e.showline)&&(p+=.2*e.tickfont.size);var m,y,x,b,_,w={labelStandoff:p+=(e.linewidth||1)/2*(f?-1:1),labelShift:h},T=0,k=e.side,M=e._id.charAt(0),A=e.tickangle;if("x"===M)b=(_=!f&&"bottom"===k||f&&"top"===k)?1:-1,f&&(b*=-1),m=h*b,y=t+p*b,x=_?1:-.2,90===Math.abs(A)&&(f?x+=R:x=-90===A&&"bottom"===k?E:90===A&&"top"===k?R:.5,T=R/2*(A/90)),w.xFn=function(e){return e.dx+m+T*e.fontSize},w.yFn=function(e){return e.dy+y+e.fontSize*x},w.anchorFn=function(e,t){if(u){if(s)return"end";if(c)return"start"}return a(t)&&0!==t&&180!==t?t*b<0!==f?"end":"start":"middle"},w.heightFn=function(t,r,n){return r<-60||r>60?-.5*n:"top"===e.side!==f?-n:0};else if("y"===M){if(b=(_=!f&&"left"===k||f&&"right"===k)?1:-1,f&&(b*=-1),m=p,y=h*b,x=0,f||90!==Math.abs(A)||(x=-90===A&&"left"===k||90===A&&"right"===k?E:.5),f){var L=a(A)?+A:0;if(0!==L){var S=l.deg2rad(L);T=Math.abs(Math.sin(S))*E*b,x=0}}w.xFn=function(e){return e.dx+t-(m+e.fontSize*x)*b+T*e.fontSize},w.yFn=function(e){return e.dy+y+e.fontSize*R},w.anchorFn=function(e,t){return a(t)&&90===Math.abs(t)?"middle":_?"end":"start"},w.heightFn=function(t,r,n){return"right"===e.side&&(r*=-1),r<-30?-n:r<30?-.5*n:0}}return w},N.drawTicks=function(e,t,r){r=r||{};var n=t._id+"tick",a=r.vals;"period"===t.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(t.ticks?a:[],ce);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(f.stroke,t.tickcolor).style("stroke-width",d.crispRound(e,t.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},N.drawGrid=function(e,t,r){r=r||{};var n=t._id+"grid",a=r.vals,i=r.counterAxis;if(!1===t.showgrid)a=[];else if(i&&N.shouldShowZeroLine(e,t,i))for(var o="array"===t.tickmode,l=0;lo||a.lefto||a.top+(t.tickangle?0:e.fontSize/4)1)for(n=1;n2*o}(a,t))return"date";var v="strict"!==r.autotypenumbers;return function(e,t){for(var r=e.length,n=f(r),a=0,o=0,l={},u=0;u2*a}(a,v)?"category":function(e,t){for(var r=e.length,n=0;n=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(t.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(t.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(t.enabled=!1);t.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(t.enabled=!1);if((c=+c)<0||c>24)return void(t.enabled=!1);t.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(t.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(e.substr(1)||1)-+(t.substr(1)||1)},r.ref2id=function(e){return!!/^[xyz]/.test(e)&&e.split(" ")[0]}},{"../../registry":288,"./constants":252}],250:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){if("category"===t.type){var a,i=e.categoryarray,o=Array.isArray(i)&&i.length>0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=t.categoryorder="trace"),"trace"===s?t._initialCategories=[]:"array"===s?t._initialCategories=l.slice():(l=function(e,t){var r,n,a,i=t.dataAttr||e._id.charAt(0),o={};if(t.axData)r=t.axData;else for(r=[],n=0;nn?a.substr(n):i.substr(r))+o:a+i+e*t:o}function v(e,t){for(var r=t._size,n=r.h/r.w,a={},i=Object.keys(e),o=0;oc*x)||T)for(r=0;rz&&FD&&(D=F);d/=(D-O)/(2*P),O=s.l2r(O),D=s.l2r(D),s.range=s._input.range=L=0?Math.min(e,.9):1/(1/Math.max(e,-.3)+3.222))}function N(e,t,r,n,a){return e.append("path").attr("class","zoombox").style({fill:t>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform",s(r,n)).attr("d",a+"Z")}function H(e,t,r){return e.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("transform",s(t,r)).attr("d","M0,0Z")}function j(e,t,r,n,a,i){e.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),B(e,t,a,i)}function B(e,t,r,n){r||(e.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),t.transition().style("opacity",1).duration(200))}function V(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function U(e){D&&e.data&&e._context.showTips&&(l.notifier(l._(e,"Double-click to zoom back out"),"long"),D=!1)}function q(e){var t=Math.floor(Math.min(e.b-e.t,e.r-e.l,O)/2);return"M"+(e.l-3.5)+","+(e.t-.5+t)+"h3v"+-t+"h"+t+"v-3h-"+(t+3)+"ZM"+(e.r+3.5)+","+(e.t-.5+t)+"h-3v"+-t+"h"+-t+"v-3h"+(t+3)+"ZM"+(e.r+3.5)+","+(e.b+.5-t)+"h-3v"+t+"h"+-t+"v3h"+(t+3)+"ZM"+(e.l-3.5)+","+(e.b+.5-t)+"h3v"+t+"h"+t+"v3h-"+(t+3)+"Z"}function G(e,t,r,n,a){for(var i,o,s,c,u=!1,f={},d={},p=(a||{}).xaHash,h=(a||{}).yaHash,g=0;g=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(V(a),2!==e||ve||Ue(),ge)i.indexOf("select")>-1&&A(r,a,W,Q,t.id,Oe),i.indexOf("event")>-1&&d.click(a,r,t.id);else if(1===e&&ve){var l=h?P:D,s="s"===h||"w"===v?0:1,u=l._name+".range["+s+"]",f=function(e,t){var r,a=e.range[t],i=Math.abs(a-e.range[1-t]);return"date"===e.type?a:"log"===e.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,s),p="left",g="middle";if(l.fixedrange)return;h?(g="n"===h?"top":"bottom","right"===l.side&&(p="right")):"e"===v&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(xe).call(c.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(f),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:g}).on("edit",(function(e){var t=l.d2r(e);void 0!==t&&o.call("_guiRelayout",a,u,t)}))}}}function ze(t,r){if(e._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,de*t+be)),a=Math.max(0,Math.min(ee,pe*r+_e)),i=Math.abs(n-be),o=Math.abs(a-_e);function l(){Ae="",we.r=we.l,we.t=we.b,Se.attr("d","M0,0Z")}if(we.l=Math.min(be,n),we.r=Math.max(be,n),we.t=Math.min(_e,a),we.b=Math.max(_e,a),te.isSubplotConstrained)i>O||o>O?(Ae="xy",i/K>o/ee?(o=i*ee/K,_e>a?we.t=_e-o:we.b=_e+o):(i=o*K/ee,be>n?we.l=be-i:we.r=be+i),Se.attr("d",q(we))):l();else if(re.isSubplotConstrained)if(i>O||o>O){Ae="xy";var s=Math.min(we.l/K,(ee-we.b)/ee),c=Math.max(we.r/K,(ee-we.t)/ee);we.l=s*K,we.r=c*K,we.b=(1-s)*ee,we.t=(1-c)*ee,Se.attr("d",q(we))}else l();else!ae||o0){var u;if(re.isSubplotConstrained||!ne&&1===ae.length){for(u=0;ug[1]-1/4096&&(t.domain=l),a.noneOrAll(e.domain,t.domain,l)}return r("layer"),t}},{"../../lib":201,"fast-isnumeric":11}],264:[function(e,t,r){"use strict";var n=e("../../constants/alignment").FROM_BL;t.exports=function(e,t,r){void 0===r&&(r=n[e.constraintoward||"center"]);var a=[e.r2l(e.range[0]),e.r2l(e.range[1])],i=a[0]+(a[1]-a[0])*r;e.range=e._input.range=[e.l2r(i+(a[0]-i)*t),e.l2r(i+(a[1]-i)*t)],e.setScale()}},{"../../constants/alignment":176}],265:[function(e,t,r){"use strict";var n=e("polybooljs"),a=e("../../registry"),i=e("../../components/drawing").dashStyle,o=e("../../components/color"),l=e("../../components/fx"),s=e("../../components/fx/helpers").makeEventData,c=e("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=e("../../components/shapes/draw_newshape/display_outlines"),v=e("../../components/shapes/draw_newshape/helpers").handleEllipse,m=e("../../components/shapes/draw_newshape/newshapes"),y=e("../../lib"),x=e("../../lib/polygon"),b=e("../../lib/throttle"),_=e("./axis_ids").getFromId,w=e("../../lib/clear_gl_canvases"),T=e("../../plot_api/subroutines").redrawReglTraces,k=e("./constants"),M=k.MINSELECT,A=x.filter,L=x.tester,S=e("./handle_outline").clearSelect,C=e("./helpers"),O=C.p2r,D=C.axValue,P=C.getTransform;function z(e,t,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=t._hoverdata,x=t._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(e){return e&&Array.isArray(e)&&!0!==e[0].hoverOnBox}(y)){F(e,t,i);var _=function(e,t){var r,n,a=e[0],i=-1,o=[];for(n=0;n0?function(e,t){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===t.searchInfo&&(n=t.searchInfo.cd[0].trace).selectedpoints.length===t.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=j(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(t)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,e);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=e.selectionDefs=[],r.selection.mergedPolygons=e.mergedPolygons=[]}function H(e,t,r,n){var a,i,o,l=[],s=t.map((function(e){return e._id})),c=r.map((function(e){return e._id}));for(o=0;o0?n[0]:r;return!!t.selectedpoints&&t.selectedpoints.indexOf(a)>-1}function B(e,t,r){var n,i,o,l;for(n=0;n=0)C._fullLayout._deactivateShape(C);else if(!_){var r=R.clickmode;b.done(ge).then((function(){if(b.clear(ge),2===e){for(fe.remove(),K=0;K-1&&z(t,C,a.xaxes,a.yaxes,a.subplot,a,fe),"event"===r&&C.emit("plotly_selected",void 0);l.click(C,t)})).catch(y.error)}},a.doneFn=function(){he.remove(),b.done(ge).then((function(){b.clear(ge),a.gd.emit("plotly_selected",te),$&&a.selectionDefs&&($.subtract=ue,a.selectionDefs.push($),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,J)),a.doneFnCompleted&&a.doneFnCompleted(ve)})).catch(y.error),_&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:z}},{"../../components/color":74,"../../components/dragelement/helpers":92,"../../components/drawing":96,"../../components/fx":114,"../../components/fx/helpers":110,"../../components/shapes/draw_newshape/display_outlines":159,"../../components/shapes/draw_newshape/helpers":160,"../../components/shapes/draw_newshape/newshapes":161,"../../lib":201,"../../lib/clear_gl_canvases":189,"../../lib/polygon":213,"../../lib/throttle":223,"../../plot_api/subroutines":236,"../../registry":288,"./axis_ids":249,"./constants":252,"./handle_outline":256,"./helpers":257,polybooljs:48}],266:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../../lib"),l=o.cleanNumber,s=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,d=e("../../constants/numerical"),p=d.FP_SAFE,h=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,x=d.ONEMIN,b=d.ONESEC,_=e("./axis_ids"),w=e("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function M(e){return Math.pow(10,e)}function A(e){return null!=e}t.exports=function(e,t){t=t||{};var r=e._id||"x",d=r.charAt(0);function L(t,r){if(t>0)return Math.log(t)/Math.LN10;if(t<=0&&r&&e.range&&2===e.range.length){var n=e.range[0],a=e.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return h}function S(t,r,n,a){if((a||{}).msUTC&&i(t))return+t;var l=c(t,n||e.calendar);if(l===h){if(!i(t))return h;t=+t;var s=Math.floor(10*o.mod(t+.05,1)),u=Math.round(t-s/10);l=c(new Date(u))+s/10}return l}function C(t,r,n){return s(t,r,n||e.calendar)}function O(t){return e._categories[Math.round(t)]}function D(t){if(A(t)){if(void 0===e._categoriesMap&&(e._categoriesMap={}),void 0!==e._categoriesMap[t])return e._categoriesMap[t];e._categories.push("number"==typeof t?String(t):t);var r=e._categories.length-1;return e._categoriesMap[t]=r,r}return h}function P(t){if(e._categoriesMap)return e._categoriesMap[t]}function z(e){var t=P(e);return void 0!==t?t:i(e)?+e:void 0}function R(e){return i(e)?+e:P(e)}function E(e,t,r){return n.round(r+t*e,2)}function I(e,t,r){return(e-r)/t}var F=function(t){return i(t)?E(t,e._m,e._b):h},N=function(t){return I(t,e._m,e._b)};if(e.rangebreaks){var H="y"===d;F=function(t){if(!i(t))return h;var r=e._rangebreaks.length;if(!r)return E(t,e._m,e._b);var n=H;e.range[0]>e.range[1]&&(n=!n);for(var a=n?-1:1,o=a*t,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=e._B[l]||0;return isFinite(f)?E(t,e._m2,f):0},N=function(t){var r=e._rangebreaks.length;if(!r)return I(t,e._m,e._b);for(var n=0,a=0;ae._rangebreaks[a].pmax&&(n=a+1);return I(t,e._m2,e._B[n])}}e.c2l="log"===e.type?L:u,e.l2c="log"===e.type?M:u,e.l2p=F,e.p2l=N,e.c2p="log"===e.type?function(e,t){return F(L(e,t))}:F,e.p2c="log"===e.type?function(e){return M(N(e))}:N,-1!==["linear","-"].indexOf(e.type)?(e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=l,e.c2d=e.c2r=e.l2d=e.l2r=u,e.d2p=e.r2p=function(t){return e.l2p(l(t))},e.p2d=e.p2r=N,e.cleanPos=u):"log"===e.type?(e.d2r=e.d2l=function(e,t){return L(l(e),t)},e.r2d=e.r2c=function(e){return M(l(e))},e.d2c=e.r2l=l,e.c2d=e.l2r=u,e.c2r=L,e.l2d=M,e.d2p=function(t,r){return e.l2p(e.d2r(t,r))},e.p2d=function(e){return M(N(e))},e.r2p=function(t){return e.l2p(l(t))},e.p2r=N,e.cleanPos=u):"date"===e.type?(e.d2r=e.r2d=o.identity,e.d2c=e.r2c=e.d2l=e.r2l=S,e.c2d=e.c2r=e.l2d=e.l2r=C,e.d2p=e.r2p=function(t,r,n){return e.l2p(S(t,0,n))},e.p2d=e.p2r=function(e,t,r){return C(N(e),t,r)},e.cleanPos=function(t){return o.cleanDate(t,h,e.calendar)}):"category"===e.type?(e.d2c=e.d2l=D,e.r2d=e.c2d=e.l2d=O,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=R(t);return void 0!==r?r:e.fraction2r(.5)},e.l2r=e.c2r=u,e.r2l=R,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return O(N(e))},e.r2p=e.d2p,e.p2r=N,e.cleanPos=function(e){return"string"==typeof e&&""!==e?e:u(e)}):"multicategory"===e.type&&(e.r2d=e.c2d=e.l2d=O,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.r2c_just_indices=P,e.l2r=e.c2r=u,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return O(N(e))},e.r2p=e.d2p,e.p2r=N,e.cleanPos=function(e){return Array.isArray(e)||"string"==typeof e&&""!==e?e:u(e)},e.setupMultiCategory=function(n){var a,i,l=e._traceIndices,s=e._matchGroup;if(s&&0===e._categories.length)for(var c in s)if(c!==r){var u=t[_.id2name(c)];l=l.concat(u._traceIndices)}var p=[[0,{}],[0,{}]],h=[];for(a=0;ap&&(l[n]=p),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else o.nestedProperty(e,t).set(a)},e.setScale=function(r){var n=t._size;if(e.overlaying){var a=_.getFromId({_fullLayout:t},e.overlaying);e.domain=a.domain}var i=r&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var l,s,c=e.r2l(e[i][0],o),u=e.r2l(e[i][1],o),f="y"===d;if((f?(e._offset=n.t+(1-e.domain[1])*n.h,e._length=n.h*(e.domain[1]-e.domain[0]),e._m=e._length/(c-u),e._b=-e._m*u):(e._offset=n.l+e.domain[0]*n.w,e._length=n.w*(e.domain[1]-e.domain[0]),e._m=e._length/(u-c),e._b=-e._m*c),e._rangebreaks=[],e._lBreaks=0,e._m2=0,e._B=[],e.rangebreaks)&&(e._rangebreaks=e.locateBreaks(Math.min(c,u),Math.max(c,u)),e._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&e._rangebreaks.reverse();var h=p?-1:1;for(e._m2=h*e._length/(Math.abs(u-c)-e._lBreaks),e._B.push(-e._m2*(f?u:c)),l=0;la&&(a+=7,ia&&(a+=24,i=n&&i=n&&t=l.min&&(el.max&&(l.max=n),a=!1)}a&&c.push({min:e,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),e.plot.call(o.setTranslate,t._offset,r._offset).call(o.setScale,1,1);var n=e.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,e)}function v(t,r){var n=t.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!t.xr1,d=!!t.yr1,p=[];if(f){var h=i.simpleMap(t.xr0,a.r2l),g=i.simpleMap(t.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(t.yr0,s.r2l),x=i.simpleMap(t.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(e,a,{skipTitle:!0}),l.drawOne(e,s,{skipTitle:!0}),l.redrawComponents(e,[a._id,s._id]);var w=f?c/p[2]:1,T=d?u/p[3]:1,k=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}l.redrawComponents(e)}},{"../../components/drawing":96,"../../lib":201,"../../registry":288,"./axes":246,d3:9}],271:[function(e,t,r){"use strict";var n=e("../../registry").traceIs,a=e("./axis_autotype");function i(e){return{v:"x",h:"y"}[e.orientation||"v"]}function o(e,t){var r=i(e),a=n(e,"box-violin"),o=n(e._fullInput||{},"candlestick");return a&&!o&&t===r&&void 0===e[r]&&void 0===e[r+"0"]}t.exports=function(e,t,r,l){r("autotypenumbers",l.autotypenumbersDflt),"-"===r("type",(l.splomStash||{}).type)&&(!function(e,t){if("-"!==e.type)return;var r,l=e._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(e,t,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[t])return a;if((a[r+"axis"]||r)===t){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(t,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(e.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(d.autotypenumbers=e.autotypenumbers,o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,t,l,n+1):t(l,i,o)}}))}r.manageCommandObserver=function(e,t,n,o){var l={},s=!0;t&&t._commandObserver&&(l=t._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(e,n,l.lookupTable);if(t&&t._commandObserver){if(c)return l;if(t._commandObserver.remove)return t._commandObserver.remove(),t._commandObserver=null,l}if(c){i(e,c,l.cache),l.check=function(){if(s){var t=i(e,c,l.cache);return t.changed&&o&&void 0!==l.lookupTable[t.value]&&(l.disable(),Promise.resolve(o({value:t.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[t.value]})).then(l.enable,l.enable)),t.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=t.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=t._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),s=r.select(".js-sourcelinks");e._context.showSources&&e._context.showSources(e),e._context.showLink&&function(e,t){t.text("");var r=t.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(e._context.linkText+" "+String.fromCharCode(187));if(e._context.sendData)r.on("click",(function(){x.sendDataToCloud(e)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(e,o),l.text(o.text()&&s.text()?" - ":"")}},x.sendDataToCloud=function(e){var t=(window.PLOTLYENV||{}).BASE_URL||e._context.plotlyServerURL;if(t){e.emit("plotly_beforeexport");var r=n.select(e).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:t+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(e,!1,"keepdata"),a.node().submit(),r.remove(),e.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(e,t){var r=e._context.locale;r||(r="en-US");var n=!1,a={};function i(e){for(var r=!0,i=0;i1&&R.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,s),l=0;l15&&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"),x.linkSubplots(d,s,f,i),x.cleanPlot(d,s,f,i);var H=!(!i._has||!i._has("gl2d")),j=!(!s._has||!s._has("gl2d")),B=!(!i._has||!i._has("cartesian"))||H,V=!(!s._has||!s._has("cartesian"))||j;B&&!V?i._bgLayer.remove():V&&!B&&(s._shouldCreateBgLayer=!0),i._zoomlayer&&!e._dragging&&p({_fullLayout:i}),function(e,t){var r,n=[];t.meta&&(r=t._meta={meta:t.meta,layout:{meta:t.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),a=Math.round(f*a)}}var d=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!t.height&&Math.abs(r.height-a)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=a)),e._initialAutoSize||(e._initialAutoSize={width:n,height:a}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(e,t,r,n){var a,i,l,s=o.componentsRegistry,u=t._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in s)(l=s[a]).includeBasePlot&&l.includeBasePlot(e,t);for(var d in u.length||u.push(f),t._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(e,t),f.finalizeSubplots(e,t)),t._subplots)t._subplots[d].sort(c.subplotSort);for(i=0;i1&&(r.l/=d,r.r/=d);var p=(r.t+r.b)/l;p>1&&(r.t/=p,r.b/=p);var h=void 0!==r.xl?r.xl:r.x,g=void 0!==r.xr?r.xr:r.x,v=void 0!==r.yt?r.yt:r.y,m=void 0!==r.yb?r.yb:r.y;s[t]={l:{val:h,size:r.l+u},r:{val:g,size:r.r+u},b:{val:m,size:r.b+u},t:{val:v,size:r.t+u}},c[t]=1}else delete s[t],delete c[t];if(!n._replotting)return x.doAutoMargin(e)}},x.doAutoMargin=function(e){var t=e._fullLayout,r=t.width,n=t.height,a=Math.max(0,r-64),l=Math.max(0,n-64);t._size||(t._size={}),C(t);var s=t._size,u=t.margin,f=c.extendFlat({},s),p=u.l,h=u.r,g=u.t,v=u.b,m=t._pushmargin,y=t._pushmarginIds;if(!1!==t.margin.autoexpand){for(var b in m)y[b]||delete m[b];for(var _ in m.base={l:{val:0,size:p},r:{val:1,size:h},t:{val:1,size:g},b:{val:0,size:v}},m){var w=m[_].l||{},T=m[_].b||{},k=w.val,M=w.size,A=T.val,L=T.size;for(var S in m){if(i(M)&&m[S].r){var O=m[S].r.val,D=m[S].r.size;if(O>k){var P=(M*O+(D-r)*k)/(O-k),z=(D*(1-k)+(M-r)*(1-O))/(O-k);P+z>p+h&&(p=P,h=z)}}if(i(L)&&m[S].t){var R=m[S].t.val,E=m[S].t.size;if(R>A){var I=(L*R+(E-n)*A)/(R-A),F=(E*(1-A)+(L-n)*(1-R))/(R-A);I+F>v+g&&(v=I,g=F)}}}}}var N=(p+h)/a;N>1&&(p/=N,h/=N);var H=(v+g)/l;if(H>1&&(v/=H,g/=H),s.l=Math.round(p),s.r=Math.round(h),s.t=Math.round(g),s.b=Math.round(v),s.p=Math.round(u.pad),s.w=Math.round(r)-s.l-s.r,s.h=Math.round(n)-s.t-s.b,!t._replotting&&x.didMarginChange(f,s)){"_redrawFromAutoMarginCount"in t?t._redrawFromAutoMarginCount++:t._redrawFromAutoMarginCount=1;var j=3*(1+Object.keys(y).length);if(t._redrawFromAutoMarginCount0&&(e._transitioningWithDuration=!0),e._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&e._transitionData._interruptCallbacks.push((function(){return o.call("redraw",e)})),e._transitionData._interruptCallbacks.push((function(){e.emit("plotly_transitioninterrupted",[])}));var i=0,l=0;function s(){return i++,function(){l++,n||l!==i||function(t){if(!e._transitionData)return;(function(e){if(e)for(;e.length;)e.shift()})(e._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",e)})).then((function(){e._transitioning=!1,e._transitioningWithDuration=!1,e.emit("plotly_transitioned",[])})).then(t)}(a)}}r.runFn(s),setTimeout(s())}))}],i=c.syncOrAsync(a,e);return i&&i.then||(i=Promise.resolve()),i.then((function(){return e}))}x.didMarginChange=function(e,t){for(var r=0;r1)return!0}return!1},x.graphJson=function(e,t,r,n,a,i){(a&&t&&!e._fullData||a&&!t&&!e._fullLayout)&&x.supplyDefaults(e);var o=a?e._fullData:e.data,l=a?e._fullLayout:e.layout,s=(e._transitionData||{})._frames;function u(e,t){if("function"==typeof e)return t?"_function_":null;if(c.isPlainObject(e)){var n,a={};return Object.keys(e).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof e[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(e.stream))return}else if("keepall"!==r&&"string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(e[i],t)}else t&&(a[i]="_function")})),a}return Array.isArray(e)?e.map((function(e){return u(e,t)})):c.isTypedArray(e)?c.simpleMap(e,c.identity):c.isJSDate(e)?c.ms2DateTimeLocal(+e):e}var f={data:(o||[]).map((function(e){var r=u(e);return t&&delete r.fit,r}))};if(!t&&(f.layout=u(l),a)){var d=l._size;f.layout.computed={margin:{b:d.b,l:d.l,r:d.r,t:d.t}}}return e.framework&&e.framework.isPolar&&(f=e.framework.getConfig()),s&&(f.frames=u(s)),i&&(f.config=u(e._context,!0)),"object"===n?f:JSON.stringify(f)},x.modifyFrames=function(e,t){var r,n,a,i=e._transitionData._frames,o=e._transitionData._frameHash;for(r=0;r=0;i--)if(l[i].enabled){r._indexToPoints=l[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(e,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,h[t]=o}}for(z(s,u,p),a=0;a=0?d.angularAxis.domain:n.extent(T),S=Math.abs(T[1]-T[0]);M&&!k&&(S=0);var C=L.slice();A&&k&&(C[1]+=S);var O=d.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),d.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var D=d.angularAxis.ticksStep||(C[1]-C[0])/(O*(d.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),C[2]||(C[2]=D);var P=n.range.apply(this,C);if(P=P.map((function(e,t){return parseFloat(e.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(e=n.select(this).select("svg.chart-root"))||e.empty()){var z=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),R=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=n.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var E,I=e.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(e,t){return" "+e+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){E=e.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var H=p.map((function(e,t){var r=o.util.cloneJson(e);return r.symbol="DotPlot"===e.geometry?e.dotType||"circle":"LinePlot"!=e.geometry?"square":"line",r.visibleInLegend="undefined"==typeof e.visibleInLegend||e.visibleInLegend,r.color="LinePlot"===e.geometry?e.strokeColor:e.color,r}));o.Legend().config({data:p.map((function(e,t){return e.name||"Element"+t})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:E,elements:H,reverseOrder:d.legend.reverseOrder})})();var j=E.node().getBBox();x=Math.min(d.width-j.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),E.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else E=e.select(".legend-group").style({display:"none"});e.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),I.attr("transform","translate("+_+")").style({cursor:"crosshair"});var B=[(d.width-(d.margin.left+d.margin.right+2*x+(j?j.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(B[0]=Math.max(0,B[0]),B[1]=Math.max(0,B[1]),e.select(".outer-group").attr("transform","translate("+B+")"),d.title&&d.title.text){var V=e.select("g.title-group text").style(N).text(d.title.text),U=V.node().getBBox();V.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var q=e.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function Y(e,t){return l(e)%360+d.orientation}if(d.radialAxis.visible){var X=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(X).attr({transform:"rotate("+d.radialAxis.orientation+")"}),q.selectAll(".domain").style(F),q.selectAll("g>text").text((function(e,t){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(e,t){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(e,t){return"rotate("+Y(e)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",(function(e,t){return t%(d.minorTicks+1)==0})).classed("minor",(function(e,t){return!(t%(d.minorTicks+1)==0)})).style(F),Q.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var J=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(e,t){var r=Y(e),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(e,t){return t%(d.minorTicks+1)!=0?"":w?w[e]+d.angularAxis.ticksSuffix:e+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&J.text((function(e,t){return t%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,t)}));var $=n.max(I.selectAll(".angular-tick text")[0].map((function(e,t){return e.getCTM().e+e.getBBox().width})));E.attr({transform:"translate("+[x+$,d.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,ee=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(ee.enter().append("g").attr({class:function(e,t){return"geometry geometry"+t}}),ee.exit().remove(),p[0]||K){var te=[];p.forEach((function(e,t){var n={};n.radialScale=r,n.angularScale=l,n.container=ee.filter((function(e,r){return r==t})),n.geometry=e.geometry,n.orientation=d.orientation,n.direction=d.direction,n.index=t,te.push({data:e,geometryConfig:n})}));var re=n.nest().key((function(e,t){return"undefined"!=typeof e.data.groupId||"unstacked"})).entries(te),ne=[];re.forEach((function(e,t){"unstacked"===e.key?ne=ne.concat(e.values.map((function(e,t){return[e]}))):ne.push(e.values)})),ne.forEach((function(e,t){var r;r=Array.isArray(e)?e[0].geometryConfig.geometry:e.geometryConfig.geometry;var n=e.map((function(e,t){return a(o[r].defaultConfig(),e)}));o[r]().config(n)()}))}var ae,ie,oe=e.select(".guides-group"),le=e.select(".tooltips-group"),se=o.tooltipPanel().config({container:le,fontSize:8})(),ce=o.tooltipPanel().config({container:le,fontSize:8})(),ue=o.tooltipPanel().config({container:le,hasTick:!0})();if(!k){var fe=oe.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});I.on("mousemove.angular-guide",(function(e,t){var r=o.util.getMousePos(Z).angle;fe.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;ae=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);se.text(o.util.round(ae)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(e,t){oe.select("line").style({opacity:0})}))}var de=oe.select("circle").style({stroke:"grey",fill:"none"});I.on("mousemove.radial-guide",(function(e,t){var n=o.util.getMousePos(Z).radius;de.attr({r:n}).style({opacity:.5}),ie=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ce.text(o.util.round(ie)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(e,t){de.style({opacity:0}),ue.hide(),se.hide(),ce.hide()})),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(t,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),p=[f.left+f.width/2-B[0]-d.left,f.top+f.height/2-B[1]-d.top];ue.config({color:l}).text(u),ue.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(e,t){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ue.show()})).on("mouseout.tooltip",(function(e,t){ue.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(e){if(!arguments.length)return s;var t=o.util.cloneJson(e);return t.data.forEach((function(e,t){s.data[t]||(s.data[t]={}),a(s.data[t],o.Axis.defaultConfig().data[0]),a(s.data[t],e)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,t.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(e){return r},d.angularScale=function(e){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(e,t){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(e,t){for(var r in e)r in t&&(t[r]=e[r])},o.util._extend=function(e,t){for(var r in e)t[r]=e[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(e,t){var r=t||6;return n.range(0,360+r,r).map((function(t,r){var n=t*Math.PI/180;return[t,e(n)]}))},o.util.dataFromEquation=function(e,t,r){var a=t||6,i=[],o=[];n.range(0,360+a,a).forEach((function(t,r){var n=t*Math.PI/180,a=e(n);i.push(t),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},o.util.ensureArray=function(e,t){if("undefined"==typeof e)return null;var r=[].concat(e);return n.range(t).map((function(e,t){return r[t]||r[0]}))},o.util.fillArrays=function(e,t,r){return t.forEach((function(t,n){e[t]=o.util.ensureArray(e[t],r)})),e},o.util.cloneJson=function(e){return JSON.parse(JSON.stringify(e))},o.util.validateKeys=function(e,t){"string"==typeof t&&(t=t.split("."));var r=t.shift();return e[r]&&(!t.length||objHasKeys(e[r],t))},o.util.sumArrays=function(e,t){return n.zip(e,t).map((function(e,t){return n.sum(e)}))},o.util.arrayLast=function(e){return e[e.length-1]},o.util.arrayEqual=function(e,t){for(var r=Math.max(e.length,t.length,1);r-- >=0&&e[r]===t[r];);return-2===r},o.util.flattenArray=function(e){for(var t=[];!o.util.arrayEqual(t,e);)t=e,e=[].concat.apply([],e);return e},o.util.deduplicate=function(e){return e.filter((function(e,t,r){return r.indexOf(e)==t}))},o.util.convertToCartesian=function(e,t){var r=t*Math.PI/180;return[e*Math.cos(r),e*Math.sin(r)]},o.util.round=function(e,t){var r=t||2,n=Math.pow(10,r);return Math.round(e*n)/n},o.util.getMousePos=function(e){var t=n.mouse(e.node()),r=t[0],a=t[1],i={};return i.x=r,i.y=a,i.pos=t,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(e){for(var t,r={},n={},a=0,i=e.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(e,t){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(e,t){return h.stroke(r,a,i)},"stroke-width":function(e,t){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(e,t){return h["stroke-dasharray"](r,a,i)},opacity:function(e,t){return h.opacity(r,a,i)},display:function(e,t){return h.display(r,a,i)}})}};var f=t.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(e){return-d/2})).endAngle((function(e){return d/2})).innerRadius((function(e){return t.radialScale(s+(e[2]||0))})).outerRadius((function(e){return t.radialScale(s+(e[2]||0))+t.radialScale(e[1])}));c.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(e,r){return"rotate("+(t.orientation+l(e[0])+90)+")"}})};var h={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,n,a){return r[e[a].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[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(e,t){return e}));v.enter().append("path").attr({class:"mark"}),v.style(h).each(c[t.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(t){return arguments.length?(t.forEach((function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)})),this):e},i.getColorScale=function(){},n.rebind(i,t,"on"),i},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 e=o.Legend.defaultConfig(),t=n.dispatch("hover");function r(){var t=e.legendConfig,i=e.data.map((function(e,r){return[].concat(e).map((function(e,n){var i=a({},t.elements[r]);return i.name=e,i.color=[].concat(t.elements[r].color)[n],i}))})),o=n.merge(i);o=o.filter((function(e,r){return t.elements[r]&&(t.elements[r].visibleInLegend||"undefined"==typeof t.elements[r].visibleInLegend)})),t.reverseOrder&&(o=o.reverse());var l=t.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(e,t){return e.color})),c=t.fontSize,u=null==t.isContinuous?"number"==typeof o[0]:t.isContinuous,f=u?t.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(e,t){return t/(s.length-1)*100+"%"}}).style({"stop-color":function(e,t){return e}}),d.append("rect").classed("legend-mark",!0).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(e,t){return"translate("+[c/2,v(t)+c/2]+")"},d:function(e,t){var r,a,i,o=e.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(e,t){return g(t)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?t.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?t.textColor:"none"}),b.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text((function(e,t){return o[t].name})),r}return r.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(r,t,"on"),r},o.Legend.defaultConfig=function(e,t){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 e,t,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(e=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),t=n.append("text").attr({dx:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";t.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=t.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),e.attr({transform:"translate("+[s,-v/2+2*d]+")"}),e.style({display:"block"}),c},c.move=function(t){if(e)return e.attr({transform:"translate("+[t[0],t[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(e)return e.style({display:"none"}),c},c.show=function(){if(e)return e.style({display:"block"}),c},c.config=function(e){return a(i,e),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var e={convert:function(e,t){var r={};if(e.data&&(r.data=e.data.map((function(e,r){var n=a({},e);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(e,r){o.util.translator.apply(null,e.concat(t))})),t||delete n.marker,t&&delete n.groupId,t?("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})),!t&&e.layout&&"stack"===e.layout.barmode)){var i=o.util.duplicates(r.data.map((function(e,t){return e.geometry})));r.data.forEach((function(e,t){var n=i.indexOf(e.geometry);-1!=n&&(r.data[t].groupId=n)}))}if(e.layout){var l=a({},e.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(e,t){u[c[s.indexOf(e.key)]]=e.value})),l.margin=u}t&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return e}},{"../../../constants/alignment":176,"../../../lib":201,d3:9}],285:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../../lib"),i=e("../../../components/color"),o=e("./micropolar"),l=e("./undo_manager"),s=a.extendDeepAll,c=t.exports={};c.framework=function(e){var t,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),t=t?s(t,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(t),a.config(i).render(u),e.data=t.data,e.layout=t.layout,c.fillLayout(e),t}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return t},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var e,n,a=this,i=o.util.cloneJson(t);e=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(e)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(e){var t=n.select(e).selectAll(".plot-container"),r=t.selectAll(".svg-container"),a=e.framework&&e.framework.svg&&e.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:t,_paperdiv:r,_paper:a};e._fullLayout=s(o,e.layout)}},{"../../../components/color":74,"../../../lib":201,"./micropolar":284,"./undo_manager":286,d3:9}],286:[function(e,t,r){"use strict";t.exports=function(){var e,t=[],r=-1,n=!1;function a(e,t){return e?(n=!0,e[t](),n=!1,this):this}return{add:function(e){return n||(t.splice(r+1,t.length-r),t.push(e),r=t.length-1),this},setCallback:function(t){e=t},undo:function(){var n=t[r];return n?(a(n,"undo"),r-=1,e&&e(n.undo),this):this},redo:function(){var n=t[r+1];return n?(a(n,"redo"),r+=1,e&&e(n.redo),this):this},clear:function(){t=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a-1&&(f[p[r]].title={text:""});for(r=0;r")?"":t.html(e).text()}));return t.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":74,"../components/drawing":96,"../constants/xmlns_namespaces":181,"../lib":201,d3:9}],297:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rf+c||!n(u))}for(var p=0;pi))return t}return void 0!==r?r:e.dflt},r.coerceColor=function(e,t,r){return a(t).isValid()?t:void 0!==r?r:e.dflt},r.coerceEnumerated=function(e,t,r){return e.coerceNumber&&(t=+t),-1!==e.values.indexOf(t)?t:void 0!==r?r:e.dflt},r.getValue=function(e,t){var r;return Array.isArray(e)?t0?a+=i:t<0&&(a-=i)}return n.inbox(r-t,a-t,b+(a-t)/(a-r)-1)}"h"===v.orientation?(i=r,l=t,u="y",f="x",d=L,p=A):(i=t,l=r,u="x",f="y",p=L,d=A);var S=e[u+"a"],C=e[f+"a"];h=Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0]));var O=n.getDistanceFunction(a,d,p,(function(e){return(d(e)+p(e))/2}));if(n.getClosest(g,O,e),!1!==e.index&&g[e.index].p!==c){y||(T=function(e){return Math.min(_(e),e.p-m.bargroupwidth/2)},k=function(e){return Math.max(w(e),e.p+m.bargroupwidth/2)});var D=g[e.index],P=v.base?D.b+D.s:D.s;e[f+"0"]=e[f+"1"]=C.c2p(D[f],!0),e[f+"LabelVal"]=P;var z=m.extents[m.extents.round(D.p)];e[u+"0"]=S.c2p(y?T(D):z[0],!0),e[u+"1"]=S.c2p(y?k(D):z[1],!0);var R=void 0!==D.orig_p;return e[u+"LabelVal"]=R?D.orig_p:D.p,e.labelLabel=s(S,e[u+"LabelVal"]),e.valueLabel=s(C,e[f+"LabelVal"]),e.baseLabel=s(C,D.b),e.spikeDistance=(L(D)+function(e){return M(_(e),w(e))}(D))/2-b,e[u+"Spike"]=S.c2p(D.p,!0),o(D,v,e),e.hovertemplate=v.hovertemplate,e}}function f(e,t){var r=t.mcc||e.marker.color,n=t.mlcc||e.marker.line.color,a=l(e,t);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}t.exports={hoverPoints:function(e,t,r,n){var i=u(e,t,r,n);if(i){var o=i.cd,l=o[0].trace,s=o[i.index];return i.color=f(l,s),a.getComponentMethod("errorbars","hoverInfo")(s,l,i),[i]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":74,"../../components/fx":114,"../../constants/numerical":180,"../../lib":201,"../../plots/cartesian/axes":246,"../../registry":288,"./helpers":304}],306:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc").crossTraceCalc,colorbar:e("../scatter/marker_colorbar"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot").plot,style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover").hoverPoints,eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"bar",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":259,"../scatter/marker_colorbar":346,"./arrays_to_calcdata":297,"./attributes":298,"./calc":299,"./cross_trace_calc":301,"./defaults":302,"./event_data":303,"./hover":305,"./layout_attributes":307,"./layout_defaults":308,"./plot":309,"./select":310,"./style":312}],307:[function(e,t,r){"use strict";t.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],308:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/cartesian/axes"),i=e("../../lib"),o=e("./layout_attributes");t.exports=function(e,t,r){function l(r,n){return i.coerce(e,t,o,r,n)}for(var s=!1,c=!1,u=!1,f={},d=l("barmode"),p=0;p0}function L(e){return"auto"===e?0:e}function S(e,t){var r=Math.PI/180*t,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:e.width*a+e.height*n,y:e.width*n+e.height*a}}function C(e,t,r,n,a,i){var o=!!i.isHorizontal,l=!!i.constrained,s=i.angle||0,c=i.anchor||"end",u="end"===c,f="start"===c,d=((i.leftToRight||0)+1)/2,p=1-d,h=a.width,g=a.height,v=Math.abs(t-e),m=Math.abs(n-r),y=v>2*_&&m>2*_?_:0;v-=2*y,m-=2*y;var x=L(s);"auto"!==s||h<=v&&g<=m||!(h>v||g>m)||(h>m||g>v)&&h.01?q:function(e,t,r){return r&&e===t?e:Math.abs(e-t)>=2?q(e):e>t?Math.ceil(e):Math.floor(e)};N=G(N,H,E),H=G(H,N,E),j=G(j,B,!E),B=G(B,j,!E)}var Z=M(i.ensureSingle(P,"path"),D,v,m);if(Z.style("vector-effect","non-scaling-stroke").attr("d",isNaN((H-N)*(B-j))||V&&e._context.staticPlot?"M0,0Z":"M"+N+","+j+"V"+B+"H"+H+"V"+j+"Z").call(s.setClipUrl,t.layerClipId,e),!D.uniformtext.mode&&I){var Y=s.makePointStyleFns(f);s.singlePointStyle(c,Z,f,Y,e)}!function(e,t,r,n,a,l,c,f,p,v,m){var w,T=t.xaxis,A=t.yaxis,O=e._fullLayout;function D(t,r,n){return i.ensureSingle(t,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(s.font,n).call(o.convertToTspans,e)}var P=n[0].trace,z="h"===P.orientation,R=function(e,t,r,n,a){var o,l=t[0].trace;o=l.texttemplate?function(e,t,r,n,a){var o=t[0].trace,l=i.castOption(o,r,"texttemplate");if(!l)return"";var s,c,f,d,p="waterfall"===o.type,h="funnel"===o.type;"h"===o.orientation?(s="y",c=a,f="x",d=n):(s="x",c=n,f="y",d=a);function g(e){return u(d,+e,!0).text}var v=t[r],m={};m.label=v.p,m.labelLabel=m[s+"Label"]=(y=v.p,u(c,y,!0).text);var y;var x=i.castOption(o,v.i,"text");(0===x||x)&&(m.text=x);m.value=v.s,m.valueLabel=m[f+"Label"]=g(v.s);var _={};b(_,o,v.i),p&&(m.delta=+v.rawS||v.s,m.deltaLabel=g(m.delta),m.final=v.v,m.finalLabel=g(m.final),m.initial=m.final-m.delta,m.initialLabel=g(m.initial));h&&(m.value=v.s,m.valueLabel=g(m.value),m.percentInitial=v.begR,m.percentInitialLabel=i.formatPercent(v.begR),m.percentPrevious=v.difR,m.percentPreviousLabel=i.formatPercent(v.difR),m.percentTotal=v.sumR,m.percenTotalLabel=i.formatPercent(v.sumR));var w=i.castOption(o,v.i,"customdata");w&&(m.customdata=w);return i.texttemplateString(l,m,e._d3locale,_,m,o._meta||{})}(e,t,r,n,a):l.textinfo?function(e,t,r,n){var a=e[0].trace,o="h"===a.orientation,l="waterfall"===a.type,s="funnel"===a.type;function c(e){return u(o?r:n,+e,!0).text}var f,d=a.textinfo,p=e[t],h=d.split("+"),g=[],v=function(e){return-1!==h.indexOf(e)};v("label")&&g.push((m=e[t].p,u(o?n:r,m,!0).text));var m;v("text")&&(0===(f=i.castOption(a,p.i,"text"))||f)&&g.push(f);if(l){var y=+p.rawS||p.s,x=p.v,b=x-y;v("initial")&&g.push(c(b)),v("delta")&&g.push(c(y)),v("final")&&g.push(c(x))}if(s){v("value")&&g.push(c(p.s));var _=0;v("percent initial")&&_++,v("percent previous")&&_++,v("percent total")&&_++;var w=_>1;v("percent initial")&&(f=i.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),v("percent previous")&&(f=i.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),v("percent total")&&(f=i.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(t,r,n,a):g.getValue(l.text,r);return g.coerceString(y,o)}(O,n,a,T,A);w=function(e,t){var r=g.getValue(e.textposition,t);return g.coerceEnumerated(x,r)}(P,a);var E="stack"===v.mode||"relative"===v.mode,I=n[a],F=!E||I._outmost;if(!R||"none"===w||(I.isBlank||l===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var N=O.font,H=h.getBarColor(n[a],P),j=h.getInsideTextFont(P,a,N,H),B=h.getOutsideTextFont(P,a,N),V=r.datum();z?"log"===T.type&&V.s0<=0&&(l=T.range[0]=G*(W/Z):W>=Z*(X/G);G>0&&Z>0&&(Q||J||$)?w="inside":(w="outside",U.remove(),U=null)}else w="inside";if(!U){Y=i.ensureUniformFontSize(e,"outside"===w?B:j);var K=(U=D(r,R,Y)).attr("transform");if(U.attr("transform",""),q=s.bBox(U.node()),G=q.width,Z=q.height,U.attr("transform",K),G<=0||Z<=0)return void U.remove()}var ee,te,re=P.textangle;"outside"===w?(te="both"===P.constraintext||"outside"===P.constraintext,ee=function(e,t,r,n,a,i){var o,l=!!i.isHorizontal,s=!!i.constrained,c=i.angle||0,u=a.width,f=a.height,d=Math.abs(t-e),p=Math.abs(n-r);o=l?p>2*_?_:0:d>2*_?_:0;var h=1;s&&(h=l?Math.min(1,p/f):Math.min(1,d/u));var g=L(c),v=S(a,g),m=(l?v.x:v.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(e+t)/2,w=(r+n)/2,T=0,M=0,A=l?k(t,e):k(r,n);l?(b=t-A*o,T=A*m):(w=n+A*o,M=-A*m);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:h,rotate:g}}(l,c,f,p,q,{isHorizontal:z,constrained:te,angle:re})):(te="both"===P.constraintext||"inside"===P.constraintext,ee=C(l,c,f,p,q,{isHorizontal:z,constrained:te,angle:re,anchor:P.insidetextanchor}));ee.fontSize=Y.size,d(P.type,ee,O),I.transform=ee,M(U,O,v,m).attr("transform",i.getTextTransform(ee))}(e,t,P,r,p,N,H,j,B,v,m),t.layerClipId&&s.hideOutsideRangePoint(c,P.select("text"),w,O,f.xcalendar,f.ycalendar)}));var j=!1===f.cliponaxis;s.setClipUrl(c,j?null:t.layerClipId,e)}));c.getComponentMethod("errorbars","plot")(e,P,t,v)},toMoveInsideBar:C}},{"../../components/color":74,"../../components/drawing":96,"../../components/fx/helpers":110,"../../lib":201,"../../lib/svg_text_utils":222,"../../plots/cartesian/axes":246,"../../registry":288,"./attributes":298,"./constants":300,"./helpers":304,"./style":312,"./uniform_text":314,d3:9,"fast-isnumeric":11}],310:[function(e,t,r){"use strict";function n(e,t,r,n,a){var i=t.c2p(n?e.s0:e.p0,!0),o=t.c2p(n?e.s1:e.p1,!0),l=r.c2p(n?e.p0:e.s0,!0),s=r.c2p(n?e.p1:e.s1,!0);return a?[(i+o)/2,(l+s)/2]:n?[o,(l+s)/2]:[(i+o)/2,s]}t.exports=function(e,t){var r,a=e.cd,i=e.xaxis,o=e.yaxis,l=a[0].trace,s="funnel"===l.type,c="h"===l.orientation,u=[];if(!1===t)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!e[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),t.selectAll("g.points").each((function(t){h(n.select(this),t[0].trace,e)})),l.getComponentMethod("errorbars","style")(t)},styleTextPoints:g,styleOnSelect:function(e,t,r){var a=t[0].trace;a.selectedpoints?function(e,t,r){i.selectedPointStyle(e.selectAll("path"),t),function(e,t,r){e.each((function(e){var a,l=n.select(this);if(e.selected){a=o.ensureUniformFontSize(r,v(l,e,t,r));var s=t.selected.textfont&&t.selected.textfont.color;s&&(a.color=s),i.font(l,a)}else i.selectedTextStyle(l,t)}))}(e.selectAll("text"),t,r)}(r,a,e):(h(r,a,e),l.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:s}},{"../../components/color":74,"../../components/drawing":96,"../../lib":201,"../../registry":288,"./attributes":298,"./helpers":304,"./uniform_text":314,d3:9}],313:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l){r("marker.color",o),a(e,"marker")&&i(e,t,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(e,"marker.line")&&i(e,t,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":74,"../../components/colorscale/defaults":84,"../../components/colorscale/helpers":85}],314:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib");function i(e){return"_"+e+"Text_minsize"}t.exports={recordMinTextSize:function(e,t,r){if(r.uniformtext.mode){var n=i(e),a=r.uniformtext.minsize,o=t.scale*t.fontSize;t.hide=o0){l=!0;break}}l||(o=0)}return{hasLabels:r,hasValues:i,len:o}}t.exports={handleLabelsAndValues:s,supplyDefaults:function(e,t,r,n){function c(r,n){return a.coerce(e,t,i,r,n)}var u=s(c("labels"),c("values")),f=u.len;if(t._hasLabels=u.hasLabels,t._hasValues=u.hasValues,!t._hasLabels&&t._hasValues&&(c("label0"),c("dlabel")),f){t._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var d,p=c("text"),h=c("texttemplate");if(h||(d=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),h||d&&"none"!==d){var g=c("textposition");l(e,t,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(t,n,c);var v=c("hole");if(c("title.text")){var m=c("title.position",v?"middle center":"top center");v||"middle center"!==m||(t.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else t.visible=!1}}},{"../../lib":201,"../../plots/domain":273,"../bar/defaults":302,"./attributes":315,"fast-isnumeric":11}],319:[function(e,t,r){"use strict";var n=e("../../components/fx/helpers").appendArrayMultiPointValues;t.exports=function(e,t){var r={curveNumber:t.index,pointNumbers:e.pts,data:t._input,fullData:t,label:e.label,color:e.color,value:e.v,percent:e.percent,text:e.text,v:e.v};return 1===e.pts.length&&(r.pointNumber=r.i=e.pts[0]),n(r,t,e.pts),"funnelarea"===t.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":110}],320:[function(e,t,r){"use strict";var n=e("../../lib");function a(e){return-1!==e.indexOf("e")?e.replace(/[.]?0+e/,"e"):-1!==e.indexOf(".")?e.replace(/[.]?0+$/,""):e}r.formatPiePercent=function(e,t){var r=a((100*e).toPrecision(3));return n.numSeparate(r,t)+"%"},r.formatPieValue=function(e,t){var r=a(e.toPrecision(10));return n.numSeparate(r,t)},r.getFirstFilled=function(e,t){if(Array.isArray(e))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:v.castOption(b.bgcolor,e.pts)||e.color,borderColor:v.castOption(b.bordercolor,e.pts),fontFamily:v.castOption(_.family,e.pts),fontSize:v.castOption(_.size,e.pts),fontColor:v.castOption(_.color,e.pts),nameLength:v.castOption(b.namelength,e.pts),textAlign:v.castOption(b.align,e.pts),hovertemplate:v.castOption(u.hovertemplate,e.pts),hovertemplateLabels:e,eventData:[m(e,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,t.emit("plotly_hover",{points:[m(e,u)],event:n.event})}})),e.on("mouseout",(function(e){var r=t._fullLayout,a=t._fullData[o.index],l=n.select(this).datum();o._hasHoverEvent&&(e.originalEvent=n.event,t.emit("plotly_unhover",{points:[m(l,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),e.on("click",(function(e){var r=t._fullLayout,a=t._fullData[o.index];t._dragging||!1===r.hovermode||(t._hoverdata=[m(e,a)],i.click(t,n.event))}))}function b(e,t,r){var n=v.castOption(e.insidetextfont.color,t.pts);!n&&e._input.textfont&&(n=v.castOption(e._input.textfont.color,t.pts));var a=v.castOption(e.insidetextfont.family,t.pts)||v.castOption(e.textfont.family,t.pts)||r.family,i=v.castOption(e.insidetextfont.size,t.pts)||v.castOption(e.textfont.size,t.pts)||r.size;return{color:n||o.contrast(t.color),family:a,size:i}}function _(e,t){for(var r,n,a=0;at&&t>n||r=-4;v-=2)m(Math.PI*v,"tan");for(v=4;v>=-4;v-=2)m(Math.PI*(v+1),"tan")}if(f||p){for(v=4;v>=-4;v-=2)m(Math.PI*(v+1.5),"rad");for(v=4;v>=-4;v-=2)m(Math.PI*(v+.5),"rad")}}if(l||h||f){var y=Math.sqrt(e.width*e.width+e.height*e.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(t.startangle+t.stopangle)/2,i.scale>=1)return i;g.push(i)}(h||p)&&((i=T(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i)),(h||d)&&((i=k(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i));for(var x=0,b=0,_=0;_=1)break}return g[x]}function T(e,t,r,n,a){t=Math.max(0,t-2*g);var i=e.width/e.height,o=L(i,n,t,r);return{scale:2*o/e.height,rCenter:M(i,o/t),rotate:A(a)}}function k(e,t,r,n,a){t=Math.max(0,t-2*g);var i=e.height/e.width,o=L(i,n,t,r);return{scale:2*o/e.width,rCenter:M(i,o/t),rotate:A(a+Math.PI/2)}}function M(e,t){return Math.cos(t)-e*t}function A(e){return(180/Math.PI*e+720)%180-90}function L(e,t,r,n){var a=e+1/(2*Math.tan(t));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(e*e+n/2)+e))}function S(e,t){return e.v!==t.vTotal||t.trace.hole?Math.min(1/(1+1/Math.sin(e.halfangle)),e.ring/2):1}function C(e,t){var r=t.pxmid[0],n=t.pxmid[1],a=e.width/2,i=e.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function O(e,t){var r,n,a,i=e.trace,o={x:e.cx,y:e.cy},l={tx:0,ty:0};l.ty+=i.title.font.size,a=P(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*e.r,l.ty-=e.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*e.r);var s,c,u=(s=e.r,c=e.trace.aspectratio,s/(void 0===c?1:c)),f=t.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(f+=u,o.x-=(1+a)*u,l.tx+=e.titleBox.width/2):-1!==i.title.position.indexOf("center")?f*=2:-1!==i.title.position.indexOf("right")&&(f+=u,o.x+=(1+a)*u,l.tx-=e.titleBox.width/2),r=f/e.titleBox.width,n=D(e,t)/e.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:l.tx,ty:l.ty}}function D(e,t){var r=e.trace,n=t.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(e.titleBox.height,n/2)}function P(e){var t,r=e.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,t=0;tr&&(r=e.pull[t]);return r}function z(e,t){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,s=c*u}o=Math.min(o,s/r.vTotal)}for(n=0;n")}if(i){var x=s.castOption(a,t.i,"texttemplate");if(x){var b=function(e){return{label:e.label,value:e.v,valueLabel:v.formatPieValue(e.v,n.separators),percent:e.v/r.vTotal,percentLabel:v.formatPiePercent(e.v/r.vTotal,n.separators),color:e.color,text:e.text,customdata:s.castOption(a,e.i,"customdata")}}(t),_=v.getFirstFilled(a.text,t.pts);(y(_)||""===_)&&(b.text=_),t.text=s.texttemplateString(x,b,e._fullLayout._d3locale,b,a._meta||{})}else t.text=""}}function I(e,t){var r=e.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(t.left+t.right)/2,o=(t.top+t.bottom)/2;e.textX=i*n-o*a,e.textY=i*a+o*n,e.noCenter=!0}t.exports={plot:function(e,t){var r=e._fullLayout,i=r._size;h("pie",r),_(t,e),z(t,i);var d=s.makeTraceGroups(r._pielayer,t,"trace").each((function(t){var d=n.select(this),h=t[0],g=h.trace;!function(e){var t,r,n,a=e[0],i=a.r,o=a.trace,l=v.getRotationAngle(o.rotation),s=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(t=0;ta.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=S(r,a))}(t),d.attr("stroke-linejoin","round"),d.each((function(){var m=n.select(this).selectAll("g.slice").data(t);m.enter().append("g").classed("slice",!0),m.exit().remove();var y=[[[],[]],[[],[]]],_=!1;m.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=g.index,y[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=h.cx,c=h.cy,u=n.select(this),d=u.selectAll("path.surface").data([a]);if(d.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),u.call(x,e,t),g.pull){var m=+v.castOption(g.pull,a.pts)||0;m>0&&(o+=m*a.pxmid[0],c+=m*a.pxmid[1])}a.cxFinal=o,a.cyFinal=c;var T=g.hole;if(a.v===h.vTotal){var k="M"+(o+a.px0[0])+","+(c+a.px0[1])+O(a.px0,a.pxmid,!0,1)+O(a.pxmid,a.px0,!0,1)+"Z";T?d.attr("d","M"+(o+T*a.px0[0])+","+(c+T*a.px0[1])+O(a.px0,a.pxmid,!1,T)+O(a.pxmid,a.px0,!1,T)+"Z"+k):d.attr("d",k)}else{var M=O(a.px0,a.px1,!0,1);if(T){var A=1-T;d.attr("d","M"+(o+T*a.px1[0])+","+(c+T*a.px1[1])+O(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else d.attr("d","M"+o+","+c+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}E(e,a,h);var L=v.castOption(g.textposition,a.pts),S=u.selectAll("g.slicetext").data(a.text&&"none"!==L?[0]:[]);S.enter().append("g").classed("slicetext",!0),S.exit().remove(),S.each((function(){var u=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),d=s.ensureUniformFontSize(e,"outside"===L?function(e,t,r){var n=v.castOption(e.outsidetextfont.color,t.pts)||v.castOption(e.textfont.color,t.pts)||r.color,a=v.castOption(e.outsidetextfont.family,t.pts)||v.castOption(e.textfont.family,t.pts)||r.family,i=v.castOption(e.outsidetextfont.size,t.pts)||v.castOption(e.textfont.size,t.pts)||r.size;return{color:n,family:a,size:i}}(g,a,r.font):b(g,a,r.font));u.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,d).call(f.convertToTspans,e);var m,y=l.bBox(u.node());if("outside"===L)m=C(y,a);else if(m=w(y,a,h),"auto"===L&&m.scale<1){var x=s.ensureUniformFontSize(e,g.outsidetextfont);u.call(l.font,x),m=C(y=l.bBox(u.node()),a)}var T=m.textPosAngle,k=void 0===T?a.pxmid:R(h.r,T);if(m.targetX=o+k[0]*m.rCenter+(m.x||0),m.targetY=c+k[1]*m.rCenter+(m.y||0),I(m,y),m.outside){var M=m.targetY;a.yLabelMin=M-y.height/2,a.yLabelMid=M,a.yLabelMax=M+y.height/2,a.labelExtraX=0,a.labelExtraY=0,_=!0}m.fontSize=d.size,p(g.type,m,r),t[i].transform=m,u.attr("transform",s.getTextTransform(m))}))}function O(e,t,r,n){var i=n*(t[0]-e[0]),o=n*(t[1]-e[1]);return"a"+n*h.r+","+n*h.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var T=n.select(this).selectAll("g.titletext").data(g.title.text?[0]:[]);if(T.enter().append("g").classed("titletext",!0),T.exit().remove(),T.each((function(){var t,r=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),a=g.title.text;g._meta&&(a=s.templateString(a,g._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(l.font,g.title.font).call(f.convertToTspans,e),t="middle center"===g.title.position?function(e){var t=Math.sqrt(e.titleBox.width*e.titleBox.width+e.titleBox.height*e.titleBox.height);return{x:e.cx,y:e.cy,scale:e.trace.hole*e.r*2/t,tx:0,ty:-e.titleBox.height/2+e.trace.title.font.size}}(h):O(h,i),r.attr("transform",u(t.x,t.y)+c(Math.min(1,t.scale))+u(t.tx,t.ty))})),_&&function(e,t){var r,n,a,i,o,l,s,c,u,f,d,p,h;function g(e,t){return e.pxmid[1]-t.pxmid[1]}function m(e,t){return t.pxmid[1]-e.pxmid[1]}function y(e,r){r||(r={});var a,c,u,d,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),h=n?e.yLabelMin:e.yLabelMax,g=n?e.yLabelMax:e.yLabelMin,m=e.cyFinal+o(e.px0[1],e.px1[1]),y=p-h;if(y*s>0&&(e.labelExtraY=y),Array.isArray(t.pull))for(c=0;c=(v.castOption(t.pull,u.pts)||0)||((e.pxmid[1]-u.pxmid[1])*s>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-h-e.labelExtraY)*s>0&&(e.labelExtraY+=y):(g+e.labelExtraY-m)*s>0&&(a=3*l*Math.abs(c-f.indexOf(e)),(d=u.cxFinal+i(u.px0[0],u.px1[0])+a-(e.cxFinal+e.pxmid[0])-e.labelExtraX)*l>0&&(e.labelExtraX+=d)))}for(n=0;n<2;n++)for(a=n?g:m,o=n?Math.max:Math.min,s=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,l=r?1:-1,(c=e[n][r]).sort(a),u=e[1-n][r],f=u.concat(c),p=[],d=0;dMath.abs(f)?l+="l"+f*e.pxmid[0]/e.pxmid[1]+","+f+"H"+(i+e.labelExtraX+c):l+="l"+e.labelExtraX+","+u+"v"+(f-u)+"h"+c}else l+="V"+(e.yLabelMid+e.labelExtraY)+"h"+c;s.ensureSingle(r,"path","textline").call(o.stroke,t.outsidetextfont.color).attr({"stroke-width":Math.min(2,t.outsidetextfont.size/8),d:l,fill:"none"})}else r.select("path.textline").remove()}))}(m,g),_&&g.automargin){var k=l.bBox(d.node()),M=g.domain,A=i.w*(M.x[1]-M.x[0]),L=i.h*(M.y[1]-M.y[0]),S=(.5*A-h.r)/i.w,D=(.5*L-h.r)/i.h;a.autoMargin(e,"pie."+g.uid+".automargin",{xl:M.x[0]-S,xr:M.x[1]+S,yb:M.y[0]-D,yt:M.y[1]+D,l:Math.max(h.cx-h.r-k.left,0),r:Math.max(k.right-(h.cx+h.r),0),b:Math.max(k.bottom-(h.cy+h.r),0),t:Math.max(h.cy-h.r-k.top,0),pad:5})}}))}));setTimeout((function(){d.selectAll("tspan").each((function(){var e=n.select(this);e.attr("dy")&&e.attr("dy",e.attr("dy"))}))}),0)},formatSliceLabel:E,transformInsideText:w,determineInsideTextFont:b,positionTitleOutside:O,prerenderTitles:_,layoutAreas:z,attachFxHandlers:x,computeTransform:I}},{"../../components/color":74,"../../components/drawing":96,"../../components/fx":114,"../../lib":201,"../../lib/svg_text_utils":222,"../../plots/plots":280,"../bar/constants":300,"../bar/uniform_text":314,"./event_data":319,"./helpers":320,d3:9}],325:[function(e,t,r){"use strict";var n=e("d3"),a=e("./style_one"),i=e("../bar/uniform_text").resizeText;t.exports=function(e){var t=e._fullLayout._pielayer.selectAll(".trace");i(e,t,"pie"),t.each((function(e){var t=e[0].trace,r=n.select(this);r.style({opacity:t.opacity}),r.selectAll("path.surface").each((function(e){n.select(this).call(a,e,t)}))}))}},{"../bar/uniform_text":314,"./style_one":326,d3:9}],326:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("./helpers").castOption;t.exports=function(e,t,r){var i=r.marker.line,o=a(i.color,t.pts)||n.defaultLine,l=a(i.width,t.pts)||0;e.style("stroke-width",l).call(n.fill,t.color).call(n.stroke,o)}},{"../../components/color":74,"./helpers":320}],327:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rs&&S[m].gap;)m--;for(x=S[m].s,g=S.length-1;g>m;g--)S[g].s=x;for(;sA[u]&&u=0;a--){var i=e[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],335:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("./attributes"),o=e("./constants"),l=e("./subtypes"),s=e("./xy_defaults"),c=e("./period_defaults"),u=e("./stack_defaults"),f=e("./marker_defaults"),d=e("./line_defaults"),p=e("./line_shape_defaults"),h=e("./text_defaults"),g=e("./fillcolor_defaults");t.exports=function(e,t,r,v){function m(r,a){return n.coerce(e,t,i,r,a)}var y=s(e,t,v,m);if(y||(t.visible=!1),t.visible){c(e,t,v,m);var x=u(e,t,v,m),b=!x&&yG!=(F=P[O][1])>=G&&(R=P[O-1][0],E=P[O][0],F-I&&(z=R+(E-R)*(G-I)/(F-I),B=Math.min(B,z),V=Math.max(V,z)));B=Math.max(B,0),V=Math.min(V,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(e,{distance:e.maxHoverDistance,x0:B,x1:V,y0:G,y1:G,color:Z,hovertemplate:!1}),delete e.index,f.text&&!Array.isArray(f.text)?e.text=String(f.text):e.text=f.name,[e]}}}},{"../../components/color":74,"../../components/fx":114,"../../lib":201,"../../registry":288,"./get_trace_color":338}],340:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:e("./attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("./cross_trace_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./cross_trace_calc"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot"),colorbar:e("./marker_colorbar"),formatLabels:e("./format_labels"),style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":259,"./arrays_to_calcdata":327,"./attributes":328,"./calc":329,"./cross_trace_calc":333,"./cross_trace_defaults":334,"./defaults":335,"./format_labels":337,"./hover":339,"./marker_colorbar":346,"./plot":349,"./select":350,"./style":352,"./subtypes":353}],341:[function(e,t,r){"use strict";var n=e("../../lib").isArrayOrTypedArray,a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l,s){var c=(e.marker||{}).color;(l("line.color",r),a(e,"line"))?i(e,t,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":84,"../../components/colorscale/helpers":85,"../../lib":201}],342:[function(e,t,r){"use strict";var n=e("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=e("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=e("./constants");t.exports=function(e,t){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,T,k,M,A,L=t.xaxis,S=t.yaxis,C="log"===L.type,O="log"===S.type,D=L._length,P=S._length,z=t.connectGaps,R=t.baseTolerance,E=t.shape,I="linear"===E,F=t.fill&&"none"!==t.fill,N=[],H=f.minTolerance,j=e.length,B=new Array(j),V=0;function U(r){var n=e[r];if(!n)return!1;var i=t.linearized?L.l2p(n.x):L.c2p(n.x),s=t.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;O&&s===a&&(i*=Math.abs(L._m*P*(L._m>0?o:l)/(S._m*D*(S._m>0?o:l)))),i*=1e3}if(s===a){if(O&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function q(e,t,r,n){var a=r-e,i=n-t,o=.5-e,l=.5-t,s=a*a+i*i,c=a*o+i*l;if(c>0&&cre||e[1]ae)return[u(e[0],te,re),u(e[1],ne,ae)]}function le(e,t){return e[0]===t[0]&&(e[0]===te||e[0]===re)||(e[1]===t[1]&&(e[1]===ne||e[1]===ae)||void 0)}function se(e,t,r){return function(n,a){var i=oe(n),o=oe(a),l=[];if(i&&o&&le(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[e]+a[e])/2,t,r)-((i||n)[e]+(o||a)[e]);c&&((i&&o?c>0==i[e]>o[e]?i:o:i||o)[e]+=c);return l}}function ce(e){var t=e[0],r=e[1],n=t===B[V-1][0],a=r===B[V-1][1];if(!n||!a)if(V>1){var i=t===B[V-2][0],o=r===B[V-2][1];n&&(t===te||t===re)&&i?o?V--:B[V-1]=e:a&&(r===ne||r===ae)&&o?i?V--:B[V-1]=e:B[V++]=e}else B[V++]=e}function ue(e){B[V-1][0]!==e[0]&&B[V-1][1]!==e[1]&&ce([W,Q]),ce(e),J=null,W=Q=0}function fe(e){if(M=e[0]/D,A=e[1]/P,Y=e[0]re?re:0,X=e[1]ae?ae:0,Y||X){if(V)if(J){var t=K(J,e);t.length>1&&(ue(t[0]),B[V++]=t[1])}else $=K(B[V-1],e)[0],B[V++]=$;else B[V++]=[Y||e[0],X||e[1]];var r=B[V-1];Y&&X&&(r[0]!==Y||r[1]!==X)?(J&&(W!==Y&&Q!==X?ce(W&&Q?(n=J,i=(a=e)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?te:re,ae]:[o>0?re:te,ne]):[W||Y,Q||X]):W&&Q&&ce([W,Q])),ce([Y,X])):W-Y&&Q-X&&ce([Y||W,X||Q]),J=e,W=Y,Q=X}else J&&ue(K(J,e)[0]),B[V++]=e;var n,a,i,o}for("linear"===E||"spline"===E?K=function(e,t){for(var r=[],n=0,a=0;a<4;a++){var i=ie[a],o=c(e[0],e[1],t[0],t[1],i[0],i[1],i[2],i[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&&Z(o,e)G(h,de))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=e.length||!h)break;fe(h),n=h}}else fe(d)}J&&ce([W||J[0],Q||J[1]]),N.push(B.slice(0,V))}return N}},{"../../constants/numerical":180,"../../lib":201,"./constants":332}],343:[function(e,t,r){"use strict";t.exports=function(e,t,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],344:[function(e,t,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};t.exports=function(e,t,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(t,a):0}}},{"fast-isnumeric":11}],346:[function(e,t,r){"use strict";t.exports={container:"marker",min:"cmin",max:"cmax"}},{}],347:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults"),o=e("./subtypes");t.exports=function(e,t,r,l,s,c){var u=o.isBubble(e),f=(e.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(e,"marker")&&i(e,t,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&t.marker.color!==f?f:u?n.background:n.defaultLine),a(e,"marker.line")&&i(e,t,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":74,"../../components/colorscale/defaults":84,"../../components/colorscale/helpers":85,"./subtypes":353}],348:[function(e,t,r){"use strict";var n=e("../../lib").dateTick0,a=e("../../constants/numerical").ONEWEEK;function i(e,t){return n(t,e%a==0?1:0)}t.exports=function(e,t,r,n,a){if(a||(a={x:!0,y:!0}),a.x){var o=n("xperiod");o&&(n("xperiod0",i(o,t.xcalendar)),n("xperiodalignment"))}if(a.y){var l=n("yperiod");l&&(n("yperiod0",i(l,t.ycalendar)),n("yperiodalignment"))}}},{"../../constants/numerical":180,"../../lib":201}],349:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../registry"),i=e("../../lib"),o=i.ensureSingle,l=i.identity,s=e("../../components/drawing"),c=e("./subtypes"),u=e("./line_points"),f=e("./link_traces"),d=e("../../lib/polygon").tester;function p(e,t,r,f,p,h,g){var v;!function(e,t,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(e){return e.x>=u[0]&&e.x<=u[1]&&e.y>=f[0]&&e.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(e,r){var n=e[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(e){return m?e.transition():e}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(h),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),L=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(e,k,r,g),!0===_.visible){var S,C;y(T).style("opacity",_.opacity);var O=_.fill.charAt(_.fill.length-1);"x"!==O&&"y"!==O&&(O=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var D,P,z="",R=[],E=_._prevtrace;E&&(z=E._prevRevpath||"",C=E._nextFill,R=E._polygons);var I,F,N,H,j,B,V,U="",q="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(I=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):I=F="spline"===w.shape?function(e){var t=e[e.length-1];return e.length>1&&e[0][0]===t[0]&&e[0][1]===t[1]?s.smoothclosed(e.slice(1),w.smoothing):s.smoothopen(e,w.smoothing)}:function(e){return"M"+e.join("L")},N=function(e){return F(e.reverse())},G=u(f,{xaxis:x,yaxis:b,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),e)y(r.style("opacity",0).attr("d",D).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",D),s.singleLineStyle(f,a)}}}}}var Y=M.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(Z(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(Y,r.layerClipId,e),G.length?(S?(S.datum(f),H&&B&&(O?("y"===O?H[1]=B[1]=b.c2p(0,!0):"x"===O&&(H[0]=B[0]=x.c2p(0,!0)),y(S).attr("d","M"+B+"L"+H+"L"+U.substr(1)).call(s.singleFillStyle)):y(S).attr("d",U+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&U&&z?("tonext"===_.fill?y(C).attr("d",U+"Z"+z+"Z").call(s.singleFillStyle):y(C).attr("d",U+"L"+z.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(R)):(W(C),_._polygons=null)),_._prevRevpath=q,_._prevPolygons=V):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(t,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=ee(u),h=te,g=te;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===e._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?J:Q:_&&!w&&(v=$),f&&(h=v),d&&(g=v)}var T,k=(o=t.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&k.call(s.pointStyle,u,e).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=s.makePointStyleFns(u)),o.each((function(t){var a=n.select(this),i=y(a);s.translatePoint(t,i,x,b)?(s.singlePointStyle(t,i,u,T,e),r.layerClipId&&s.hideOutsideRangePoint(t,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==t.data&&void 0!==t.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(e){var t=n.select(this),a=y(t.select("text"));s.translatePoint(e,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(e,t,x,b,u.xcalendar,u.ycalendar):t.remove()})),o.selectAll("text").call(s.textPointStyle,u,e).each((function(e){var t=x.c2p(e.x),r=b.c2p(e.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:t,y:r})}))})),o.exit().remove()}(A,L,f);var X=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,X,e),s.setClipUrl(L,X,e)}function W(e){y(e).attr("d","M0,0Z")}function Q(e){return e.filter((function(e){return!e.gap&&e.vis}))}function J(e){return e.filter((function(e){return e.vis}))}function $(e){return e.filter((function(e){return!e.gap}))}function K(e){return e.id}function ee(e){if(e.ids)return K}function te(){return!1}}t.exports=function(e,t,r,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(e,t,r);((u=a.selectAll("g.trace").data(v,(function(e){return e[0].trace.uid}))).enter().append("g").attr("class",(function(e){return"trace scatter trace"+e[0].trace.uid})).style("stroke-miterlimit",2),u.order(),function(e,t,r){t.each((function(t){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,e);var i=t[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(e){i[e]=null})).remove(),u.order().each((function(e){i[e]=o(n.select(this),"path","js-fill")}))}))}(e,u,t),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(e,n,t,r,v,this,i)}))}))):u.each((function(r,n){p(e,n,t,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":96,"../../lib":201,"../../lib/polygon":213,"../../registry":288,"./line_points":342,"./link_traces":344,"./subtypes":353,d3:9}],350:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports=function(e,t){var r,a,i,o,l=e.cd,s=e.xaxis,c=e.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===t)for(r=0;r 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -621,19 +582,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -642,7 +602,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -650,33 +610,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -698,44 +654,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -745,20 +686,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -780,35 +720,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -817,7 +760,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -825,7 +768,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -834,7 +777,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -847,17 +790,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -880,12 +824,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -894,16 +838,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -911,6 +848,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -919,27 +862,37 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],18:[function(_dereq_,module,exports){ -(function (Buffer){ +(function (Buffer){(function (){ /*! * The buffer module from node.js, for the browser. * @@ -2718,8 +2671,8 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -}).call(this,_dereq_("buffer").Buffer) -},{"base64-js":15,"buffer":18,"ieee754":27}],19:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"base64-js":15,"buffer":18,"ieee754":56}],19:[function(_dereq_,module,exports){ // https://d3js.org/d3-time-format/ v2.2.3 Copyright 2019 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-time')) : @@ -13359,7 +13312,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); },{}],22:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -14535,8 +14488,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":57}],23:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":86}],23:[function(_dereq_,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -14562,7 +14515,158 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":45}],24:[function(_dereq_,module,exports){ +},{"is-string-blank":74}],24:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],25:[function(_dereq_,module,exports){ +module.exports = clone; + +/** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param {mat4} a matrix to clone + * @returns {mat4} a new 4x4 matrix + */ +function clone(a) { + var out = new Float32Array(16); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],26:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],27:[function(_dereq_,module,exports){ +module.exports = create; + +/** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ +function create() { + var out = new Float32Array(16); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],28:[function(_dereq_,module,exports){ +module.exports = determinant; + +/** + * Calculates the determinant of a mat4 + * + * @param {mat4} a the source matrix + * @returns {Number} determinant of a + */ +function determinant(a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; +}; +},{}],29:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -14610,8 +14714,1033 @@ function fromQuat(out, q) { return out; }; -},{}],25:[function(_dereq_,module,exports){ -(function (global){ +},{}],30:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],31:[function(_dereq_,module,exports){ +module.exports = fromRotationTranslation; + +/** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat4} q Rotation quaternion + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; +}; +},{}],32:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],33:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],34:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],35:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],36:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],37:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],38:[function(_dereq_,module,exports){ +module.exports = identity; + +/** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ +function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],39:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":24,"./clone":25,"./copy":26,"./create":27,"./determinant":28,"./fromQuat":29,"./fromRotation":30,"./fromRotationTranslation":31,"./fromScaling":32,"./fromTranslation":33,"./fromXRotation":34,"./fromYRotation":35,"./fromZRotation":36,"./frustum":37,"./identity":38,"./invert":40,"./lookAt":41,"./multiply":42,"./ortho":43,"./perspective":44,"./perspectiveFromFieldOfView":45,"./rotate":46,"./rotateX":47,"./rotateY":48,"./rotateZ":49,"./scale":50,"./str":51,"./translate":52,"./transpose":53}],40:[function(_dereq_,module,exports){ +module.exports = invert; + +/** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; +}; +},{}],41:[function(_dereq_,module,exports){ +var identity = _dereq_('./identity'); + +module.exports = lookAt; + +/** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {vec3} eye Position of the viewer + * @param {vec3} center Point the viewer is looking at + * @param {vec3} up vec3 pointing up + * @returns {mat4} out + */ +function lookAt(out, eye, center, up) { + var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, + eyex = eye[0], + eyey = eye[1], + eyez = eye[2], + upx = up[0], + upy = up[1], + upz = up[2], + centerx = center[0], + centery = center[1], + centerz = center[2]; + + if (Math.abs(eyex - centerx) < 0.000001 && + Math.abs(eyey - centery) < 0.000001 && + Math.abs(eyez - centerz) < 0.000001) { + return identity(out); + } + + z0 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + + x0 = upy * z2 - upz * z1; + x1 = upz * z0 - upx * z2; + x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + y0 = z1 * x2 - z2 * x1; + y1 = z2 * x0 - z0 * x2; + y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + + return out; +}; +},{"./identity":38}],42:[function(_dereq_,module,exports){ +module.exports = multiply; + +/** + * Multiplies two mat4's + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ +function multiply(out, a, b) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + // Cache only the current line of the second matrix + var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; + out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; + out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; + out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + return out; +}; +},{}],43:[function(_dereq_,module,exports){ +module.exports = ortho; + +/** + * Generates a orthogonal projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} left Left bound of the frustum + * @param {number} right Right bound of the frustum + * @param {number} bottom Bottom bound of the frustum + * @param {number} top Top bound of the frustum + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function ortho(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; +},{}],44:[function(_dereq_,module,exports){ +module.exports = perspective; + +/** + * Generates a perspective projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspective(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2), + nf = 1 / (near - far); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + return out; +}; +},{}],45:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],46:[function(_dereq_,module,exports){ +module.exports = rotate; + +/** + * Rotates a mat4 by the given angle + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function rotate(out, a, rad, axis) { + var x = axis[0], y = axis[1], z = axis[2], + len = Math.sqrt(x * x + y * y + z * z), + s, c, t, + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23, + b00, b01, b02, + b10, b11, b12, + b20, b21, b22; + + if (Math.abs(len) < 0.000001) { return null; } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + s = Math.sin(rad); + c = Math.cos(rad); + t = 1 - c; + + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + // Construct the elements of the rotation matrix + b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; + b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; + b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; +}; +},{}],47:[function(_dereq_,module,exports){ +module.exports = rotateX; + +/** + * Rotates a matrix by the given angle around the X axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateX(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; +}; +},{}],48:[function(_dereq_,module,exports){ +module.exports = rotateY; + +/** + * Rotates a matrix by the given angle around the Y axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateY(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; +}; +},{}],49:[function(_dereq_,module,exports){ +module.exports = rotateZ; + +/** + * Rotates a matrix by the given angle around the Z axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateZ(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; +}; +},{}],50:[function(_dereq_,module,exports){ +module.exports = scale; + +/** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to scale + * @param {vec3} v the vec3 to scale the matrix by + * @returns {mat4} out + **/ +function scale(out, a, v) { + var x = v[0], y = v[1], z = v[2]; + + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],51:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],52:[function(_dereq_,module,exports){ +module.exports = translate; + +/** + * Translate a mat4 by the given vector + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to translate + * @param {vec3} v vector to translate by + * @returns {mat4} out + */ +function translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; +}; +},{}],53:[function(_dereq_,module,exports){ +module.exports = transpose; + +/** + * Transpose the values of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function transpose(out, a) { + // If we are transposing ourselves we can skip a few steps but have to cache some values + if (out === a) { + var a01 = a[1], a02 = a[2], a03 = a[3], + a12 = a[6], a13 = a[7], + a23 = a[11]; + + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + + return out; +}; +},{}],54:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -14626,8 +15755,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":44}],26:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":73}],55:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -14653,7 +15782,7 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":44}],27:[function(_dereq_,module,exports){ +},{"is-browser":73}],56:[function(_dereq_,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -14739,7 +15868,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],28:[function(_dereq_,module,exports){ +},{}],57:[function(_dereq_,module,exports){ 'use strict'; var typeHandlers = _dereq_('./types'); @@ -14754,8 +15883,8 @@ module.exports = function (buffer, filepath) { } }; -},{"./types":31}],29:[function(_dereq_,module,exports){ -(function (Buffer){ +},{"./types":60}],58:[function(_dereq_,module,exports){ +(function (Buffer){(function (){ 'use strict'; var fs = _dereq_('fs'); @@ -14883,8 +16012,8 @@ module.exports = function (input, callback) { module.exports.types = Object.keys(typeHandlers); -}).call(this,_dereq_("buffer").Buffer) -},{"./detector":28,"./types":31,"buffer":18,"fs":16,"path":48}],30:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"./detector":57,"./types":60,"buffer":18,"fs":16,"path":77}],59:[function(_dereq_,module,exports){ 'use strict'; // Abstract reading multi-byte unsigned integers @@ -14897,7 +16026,7 @@ function readUInt (buffer, bits, offset, isBigEndian) { module.exports = readUInt; -},{}],31:[function(_dereq_,module,exports){ +},{}],60:[function(_dereq_,module,exports){ 'use strict'; // load all available handlers for browserify support @@ -14918,7 +16047,7 @@ var typeHandlers = { module.exports = typeHandlers; -},{"./types/bmp":32,"./types/cur":33,"./types/dds":34,"./types/gif":35,"./types/icns":36,"./types/ico":37,"./types/jpg":38,"./types/png":39,"./types/psd":40,"./types/svg":41,"./types/tiff":42,"./types/webp":43}],32:[function(_dereq_,module,exports){ +},{"./types/bmp":61,"./types/cur":62,"./types/dds":63,"./types/gif":64,"./types/icns":65,"./types/ico":66,"./types/jpg":67,"./types/png":68,"./types/psd":69,"./types/svg":70,"./types/tiff":71,"./types/webp":72}],61:[function(_dereq_,module,exports){ 'use strict'; function isBMP (buffer) { @@ -14937,7 +16066,7 @@ module.exports = { 'calculate': calculate }; -},{}],33:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ 'use strict'; var TYPE_CURSOR = 2; @@ -14956,7 +16085,7 @@ module.exports = { 'calculate': _dereq_('./ico').calculate }; -},{"./ico":37}],34:[function(_dereq_,module,exports){ +},{"./ico":66}],63:[function(_dereq_,module,exports){ 'use strict'; function isDDS(buffer){ @@ -14976,7 +16105,7 @@ module.exports = { 'calculate': calculate }; -},{}],35:[function(_dereq_,module,exports){ +},{}],64:[function(_dereq_,module,exports){ 'use strict'; var gifRegexp = /^GIF8[79]a/; @@ -14997,7 +16126,7 @@ module.exports = { 'calculate': calculate }; -},{}],36:[function(_dereq_,module,exports){ +},{}],65:[function(_dereq_,module,exports){ 'use strict'; /** @@ -15121,7 +16250,7 @@ module.exports = { 'calculate': calculate }; -},{}],37:[function(_dereq_,module,exports){ +},{}],66:[function(_dereq_,module,exports){ 'use strict'; var TYPE_ICON = 1; @@ -15204,7 +16333,7 @@ module.exports = { 'calculate': calculate }; -},{}],38:[function(_dereq_,module,exports){ +},{}],67:[function(_dereq_,module,exports){ 'use strict'; var readUInt = _dereq_('../readUInt'); @@ -15363,7 +16492,7 @@ module.exports = { 'calculate': calculate }; -},{"../readUInt":30}],39:[function(_dereq_,module,exports){ +},{"../readUInt":59}],68:[function(_dereq_,module,exports){ 'use strict'; var pngSignature = 'PNG\r\n\x1a\n'; @@ -15403,7 +16532,7 @@ module.exports = { 'calculate': calculate }; -},{}],40:[function(_dereq_,module,exports){ +},{}],69:[function(_dereq_,module,exports){ 'use strict'; function isPSD (buffer) { @@ -15422,7 +16551,7 @@ module.exports = { 'calculate': calculate }; -},{}],41:[function(_dereq_,module,exports){ +},{}],70:[function(_dereq_,module,exports){ 'use strict'; var svgReg = /"']|"[^"]*"|'[^']*')*>/; @@ -15520,8 +16649,8 @@ module.exports = { 'calculate': calculate }; -},{}],42:[function(_dereq_,module,exports){ -(function (Buffer){ +},{}],71:[function(_dereq_,module,exports){ +(function (Buffer){(function (){ 'use strict'; // based on http://www.compix.com/fileformattif.htm @@ -15643,8 +16772,8 @@ module.exports = { 'calculate': calculate }; -}).call(this,_dereq_("buffer").Buffer) -},{"../readUInt":30,"buffer":18,"fs":16}],43:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"../readUInt":59,"buffer":18,"fs":16}],72:[function(_dereq_,module,exports){ 'use strict'; // based on https://developers.google.com/speed/webp/docs/riff_container @@ -15717,9 +16846,9 @@ module.exports = { 'calculate': calculate }; -},{}],44:[function(_dereq_,module,exports){ +},{}],73:[function(_dereq_,module,exports){ module.exports = true; -},{}],45:[function(_dereq_,module,exports){ +},{}],74:[function(_dereq_,module,exports){ 'use strict'; /** @@ -15756,7 +16885,7 @@ module.exports = function(str){ return true; } -},{}],46:[function(_dereq_,module,exports){ +},{}],75:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -15783,7 +16912,7 @@ function getBoundingClientOffset (element) { } } -},{}],47:[function(_dereq_,module,exports){ +},{}],76:[function(_dereq_,module,exports){ module.exports = parse @@ -15842,10 +16971,10 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],48:[function(_dereq_,module,exports){ -(function (process){ -// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, -// backported and transplited with Babel, with backwards-compat fixes +},{}],77:[function(_dereq_,module,exports){ +(function (process){(function (){ +// 'path' module extracted from Node.js v8.11.1 (only the posix part) +// transplited with Babel // Copyright Joyent, Inc. and other Node contributors. // @@ -15868,287 +16997,514 @@ function parseValues(args) { // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } +'use strict'; + +function assertPath(path) { + if (typeof path !== 'string') { + throw new TypeError('Path must be a string. Received ' + JSON.stringify(path)); } +} - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); +// Resolves . and .. elements in a path with directory names +function normalizeStringPosix(path, allowAboveRoot) { + var res = ''; + var lastSegmentLength = 0; + var lastSlash = -1; + var dots = 0; + var code; + for (var i = 0; i <= path.length; ++i) { + if (i < path.length) + code = path.charCodeAt(i); + else if (code === 47 /*/*/) + break; + else + code = 47 /*/*/; + if (code === 47 /*/*/) { + if (lastSlash === i - 1 || dots === 1) { + // NOOP + } else if (lastSlash !== i - 1 && dots === 2) { + if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) { + if (res.length > 2) { + var lastSlashIndex = res.lastIndexOf('/'); + if (lastSlashIndex !== res.length - 1) { + if (lastSlashIndex === -1) { + res = ''; + lastSegmentLength = 0; + } else { + res = res.slice(0, lastSlashIndex); + lastSegmentLength = res.length - 1 - res.lastIndexOf('/'); + } + lastSlash = i; + dots = 0; + continue; + } + } else if (res.length === 2 || res.length === 1) { + res = ''; + lastSegmentLength = 0; + lastSlash = i; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + if (res.length > 0) + res += '/..'; + else + res = '..'; + lastSegmentLength = 2; + } + } else { + if (res.length > 0) + res += '/' + path.slice(lastSlash + 1, i); + else + res = path.slice(lastSlash + 1, i); + lastSegmentLength = i - lastSlash - 1; + } + lastSlash = i; + dots = 0; + } else if (code === 46 /*.*/ && dots !== -1) { + ++dots; + } else { + dots = -1; } } + return res; +} - return parts; +function _format(sep, pathObject) { + var dir = pathObject.dir || pathObject.root; + var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || ''); + if (!dir) { + return base; + } + if (dir === pathObject.root) { + return dir + base; + } + return dir + sep + base; } -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; +var posix = { + // path.resolve([from ...], to) + resolve: function resolve() { + var resolvedPath = ''; + var resolvedAbsolute = false; + var cwd; - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path; + if (i >= 0) + path = arguments[i]; + else { + if (cwd === undefined) + cwd = process.cwd(); + path = cwd; + } - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } + assertPath(path); - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } + // Skip empty entries + if (path.length === 0) { + continue; + } - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/; + } - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; + // Normalize the path + resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute); -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; + if (resolvedAbsolute) { + if (resolvedPath.length > 0) + return '/' + resolvedPath; + else + return '/'; + } else if (resolvedPath.length > 0) { + return resolvedPath; + } else { + return '.'; + } + }, - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); + normalize: function normalize(path) { + assertPath(path); - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } + if (path.length === 0) return '.'; - return (isAbsolute ? '/' : '') + path; -}; + var isAbsolute = path.charCodeAt(0) === 47 /*/*/; + var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/; -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; + // Normalize the path + path = normalizeStringPosix(path, !isAbsolute); + + if (path.length === 0 && !isAbsolute) path = '.'; + if (path.length > 0 && trailingSeparator) path += '/'; -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); + if (isAbsolute) return '/' + path; + return path; + }, + + isAbsolute: function isAbsolute(path) { + assertPath(path); + return path.length > 0 && path.charCodeAt(0) === 47 /*/*/; + }, + + join: function join() { + if (arguments.length === 0) + return '.'; + var joined; + for (var i = 0; i < arguments.length; ++i) { + var arg = arguments[i]; + assertPath(arg); + if (arg.length > 0) { + if (joined === undefined) + joined = arg; + else + joined += '/' + arg; + } } - return p; - }).join('/')); -}; + if (joined === undefined) + return '.'; + return posix.normalize(joined); + }, + relative: function relative(from, to) { + assertPath(from); + assertPath(to); -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); + if (from === to) return ''; - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; + from = posix.resolve(from); + to = posix.resolve(to); + + if (from === to) return ''; + + // Trim any leading backslashes + var fromStart = 1; + for (; fromStart < from.length; ++fromStart) { + if (from.charCodeAt(fromStart) !== 47 /*/*/) + break; } + var fromEnd = from.length; + var fromLen = fromEnd - fromStart; - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; + // Trim any leading backslashes + var toStart = 1; + for (; toStart < to.length; ++toStart) { + if (to.charCodeAt(toStart) !== 47 /*/*/) + break; } + var toEnd = to.length; + var toLen = toEnd - toStart; - if (start > end) return []; - return arr.slice(start, end - start + 1); - } + // Compare paths to find the longest common path from root + var length = fromLen < toLen ? fromLen : toLen; + var lastCommonSep = -1; + var i = 0; + for (; i <= length; ++i) { + if (i === length) { + if (toLen > length) { + if (to.charCodeAt(toStart + i) === 47 /*/*/) { + // We get here if `from` is the exact base path for `to`. + // For example: from='/foo/bar'; to='/foo/bar/baz' + return to.slice(toStart + i + 1); + } else if (i === 0) { + // We get here if `from` is the root + // For example: from='/'; to='/foo' + return to.slice(toStart + i); + } + } else if (fromLen > length) { + if (from.charCodeAt(fromStart + i) === 47 /*/*/) { + // We get here if `to` is the exact base path for `from`. + // For example: from='/foo/bar/baz'; to='/foo/bar' + lastCommonSep = i; + } else if (i === 0) { + // We get here if `to` is the root. + // For example: from='/foo'; to='/' + lastCommonSep = 0; + } + } + break; + } + var fromCode = from.charCodeAt(fromStart + i); + var toCode = to.charCodeAt(toStart + i); + if (fromCode !== toCode) + break; + else if (fromCode === 47 /*/*/) + lastCommonSep = i; + } - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); + var out = ''; + // Generate the relative path based on the path difference between `to` + // and `from` + for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { + if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) { + if (out.length === 0) + out += '..'; + else + out += '/..'; + } + } - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; + // Lastly, append the rest of the destination (`to`) path that comes after + // the common path parts + if (out.length > 0) + return out + to.slice(toStart + lastCommonSep); + else { + toStart += lastCommonSep; + if (to.charCodeAt(toStart) === 47 /*/*/) + ++toStart; + return to.slice(toStart); } - } + }, - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } + _makeLong: function _makeLong(path) { + return path; + }, + + dirname: function dirname(path) { + assertPath(path); + if (path.length === 0) return '.'; + var code = path.charCodeAt(0); + var hasRoot = code === 47 /*/*/; + var end = -1; + var matchedSlash = true; + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47 /*/*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } + } - outputParts = outputParts.concat(toParts.slice(samePartsLength)); + if (end === -1) return hasRoot ? '/' : '.'; + if (hasRoot && end === 1) return '//'; + return path.slice(0, end); + }, - return outputParts.join('/'); -}; + basename: function basename(path, ext) { + if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string'); + assertPath(path); -exports.sep = '/'; -exports.delimiter = ':'; + var start = 0; + var end = -1; + var matchedSlash = true; + var i; -exports.dirname = function (path) { - if (typeof path !== 'string') path = path + ''; - if (path.length === 0) return '.'; - var code = path.charCodeAt(0); - var hasRoot = code === 47 /*/*/; - var end = -1; - var matchedSlash = true; - for (var i = path.length - 1; i >= 1; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - if (!matchedSlash) { - end = i; - break; + if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { + if (ext.length === path.length && ext === path) return ''; + var extIdx = ext.length - 1; + var firstNonSlashEnd = -1; + for (i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false; + firstNonSlashEnd = i + 1; + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === ext.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i; + } + } else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1; + end = firstNonSlashEnd; + } + } } - } else { - // We saw the first non-path separator - matchedSlash = false; + } + + if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length; + return path.slice(start, end); + } else { + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } + + if (end === -1) return ''; + return path.slice(start, end); + } + }, + + extname: function extname(path) { + assertPath(path); + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + startDot = i; + else if (preDotState !== 1) + preDotState = 1; + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } } - } - if (end === -1) return hasRoot ? '/' : '.'; - if (hasRoot && end === 1) { - // return '//'; - // Backwards-compat fix: - return '/'; - } - return path.slice(0, end); -}; + if (startDot === -1 || end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ''; + } + return path.slice(startDot, end); + }, -function basename(path) { - if (typeof path !== 'string') path = path + ''; + format: function format(pathObject) { + if (pathObject === null || typeof pathObject !== 'object') { + throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject); + } + return _format('/', pathObject); + }, - var start = 0; - var end = -1; - var matchedSlash = true; - var i; + parse: function parse(path) { + assertPath(path); - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; + var ret = { root: '', dir: '', base: '', ext: '', name: '' }; + if (path.length === 0) return ret; + var code = path.charCodeAt(0); + var isAbsolute = code === 47 /*/*/; + var start; + if (isAbsolute) { + ret.root = '/'; + start = 1; + } else { + start = 0; + } + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + var i = path.length - 1; + + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + + // Get non-dir info + for (; i >= start; --i) { + code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1; + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } } - } - if (end === -1) return ''; - return path.slice(start, end); -} + if (startDot === -1 || end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + if (end !== -1) { + if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end); + } + } else { + if (startPart === 0 && isAbsolute) { + ret.name = path.slice(1, startDot); + ret.base = path.slice(1, end); + } else { + ret.name = path.slice(startPart, startDot); + ret.base = path.slice(startPart, end); + } + ret.ext = path.slice(startDot, end); + } -// Uses a mixed approach for backwards-compatibility, as ext behavior changed -// in new Node.js versions, so only basename() above is backported here -exports.basename = function (path, ext) { - var f = basename(path); - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; + if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/'; -exports.extname = function (path) { - if (typeof path !== 'string') path = path + ''; - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) - startDot = i; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ''; - } - return path.slice(startDot, end); + return ret; + }, + + sep: '/', + delimiter: ':', + win32: null, + posix: null }; -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} +posix.posix = posix; -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; +module.exports = posix; -}).call(this,_dereq_('_process')) -},{"_process":57}],49:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":86}],78:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -16276,7 +17632,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":50,"./lib/epsilon":51,"./lib/geojson":52,"./lib/intersecter":53,"./lib/segment-chainer":55,"./lib/segment-selector":56}],50:[function(_dereq_,module,exports){ +},{"./lib/build-log":79,"./lib/epsilon":80,"./lib/geojson":81,"./lib/intersecter":82,"./lib/segment-chainer":84,"./lib/segment-selector":85}],79:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16391,7 +17747,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],51:[function(_dereq_,module,exports){ +},{}],80:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16563,7 +17919,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],52:[function(_dereq_,module,exports){ +},{}],81:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16753,7 +18109,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],53:[function(_dereq_,module,exports){ +},{}],82:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -17260,7 +18616,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":54}],54:[function(_dereq_,module,exports){ +},{"./linked-list":83}],83:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -17343,7 +18699,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],55:[function(_dereq_,module,exports){ +},{}],84:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -17597,7 +18953,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],56:[function(_dereq_,module,exports){ +},{}],85:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -17765,7 +19121,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],57:[function(_dereq_,module,exports){ +},{}],86:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -17951,8 +19307,8 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],58:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +},{}],87:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -19148,7 +20504,7 @@ else { })(Math); -},{}],59:[function(_dereq_,module,exports){ +},{}],88:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19219,7 +20575,7 @@ module.exports = [ } ]; -},{}],60:[function(_dereq_,module,exports){ +},{}],89:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19234,7 +20590,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -19574,7 +20957,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":236,"../../plots/cartesian/constants":252,"../../plots/font_attributes":274,"./arrow_paths":59}],61:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":207,"../../plot_api/plot_template":266,"../../plots/cartesian/constants":283,"../../plots/font_attributes":305,"./arrow_paths":88}],90:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19611,10 +20994,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -19663,7 +21048,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":202,"../../plots/cartesian/axes":246,"./draw":66}],62:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"./draw":95}],91:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19801,7 +21186,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":202,"../../plot_api/plot_template":236,"../../registry":293}],63:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plot_api/plot_template":266,"../../registry":324}],92:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19880,7 +21265,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":202,"../color":75}],64:[function(_dereq_,module,exports){ +},{"../../lib":232,"../color":104}],93:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19943,7 +21328,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":225,"fast-isnumeric":23}],65:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":255,"fast-isnumeric":23}],94:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20006,7 +21391,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -20050,7 +21436,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":202,"../../plots/array_container_defaults":242,"../../plots/cartesian/axes":246,"./attributes":60,"./common_defaults":63}],66:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/array_container_defaults":272,"../../plots/cartesian/axes":277,"./attributes":89,"./common_defaults":92}],95:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20066,6 +21452,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -20126,6 +21513,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -20349,13 +21761,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -20371,12 +21784,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -20393,8 +21811,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -20584,7 +22023,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -20615,22 +22054,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -20662,14 +22102,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -20678,7 +22121,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -20688,7 +22133,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -20708,7 +22155,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -20750,7 +22197,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":202,"../../lib/setcursor":221,"../../lib/svg_text_utils":223,"../../plot_api/plot_template":236,"../../plots/cartesian/axes":246,"../../plots/plots":280,"../../registry":293,"../color":75,"../dragelement":94,"../drawing":97,"../fx":115,"./draw_arrow_head":67,"d3":21}],67:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../lib/setcursor":251,"../../lib/svg_text_utils":253,"../../plot_api/plot_template":266,"../../plots/cartesian/axes":277,"../../plots/plots":311,"../../registry":324,"../color":104,"../dragelement":123,"../drawing":126,"../fx":144,"./draw_arrow_head":96,"d3":21}],96:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20768,6 +22215,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -20887,9 +22339,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -20901,7 +22353,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":75,"./arrow_paths":59,"d3":21}],68:[function(_dereq_,module,exports){ +},{"../../lib":232,"../color":104,"./arrow_paths":88,"d3":21}],97:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20935,7 +22387,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":258,"./attributes":60,"./calc_autorange":61,"./click":62,"./convert_coords":64,"./defaults":65,"./draw":66}],69:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":289,"./attributes":89,"./calc_autorange":90,"./click":91,"./convert_coords":93,"./defaults":94,"./draw":95}],98:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21023,7 +22475,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":229,"../../plot_api/plot_template":236,"../annotations/attributes":60}],70:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":259,"../../plot_api/plot_template":266,"../annotations/attributes":89}],99:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21088,7 +22540,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":202,"../../plots/cartesian/axes":246}],71:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277}],100:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21164,7 +22616,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":202,"../../plots/array_container_defaults":242,"../../plots/cartesian/axes":246,"../annotations/common_defaults":63,"./attributes":69}],72:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/array_container_defaults":272,"../../plots/cartesian/axes":277,"../annotations/common_defaults":92,"./attributes":98}],101:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21216,7 +22668,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":277,"../annotations/draw":66}],73:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":308,"../annotations/draw":95}],102:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21264,7 +22716,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":202,"../../registry":293,"./attributes":69,"./convert":70,"./defaults":71,"./draw":72}],74:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324,"./attributes":98,"./convert":99,"./defaults":100,"./draw":101}],103:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21304,7 +22756,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],75:[function(_dereq_,module,exports){ +},{}],104:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21478,7 +22930,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":74,"fast-isnumeric":23,"tinycolor2":58}],76:[function(_dereq_,module,exports){ +},{"./attributes":103,"fast-isnumeric":23,"tinycolor2":87}],105:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21603,6 +23055,17 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -21619,6 +23082,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -21657,7 +23121,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":196,"../../plot_api/edit_types":229,"../../plots/cartesian/layout_attributes":260,"../../plots/font_attributes":274}],77:[function(_dereq_,module,exports){ +},{"../../lib/extend":226,"../../plot_api/edit_types":259,"../../plots/cartesian/layout_attributes":291,"../../plots/font_attributes":305}],106:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21685,7 +23149,7 @@ module.exports = { } }; -},{}],78:[function(_dereq_,module,exports){ +},{}],107:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21739,10 +23203,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -21751,7 +23219,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":202,"../../plot_api/plot_template":236,"../../plots/cartesian/tick_label_defaults":267,"../../plots/cartesian/tick_mark_defaults":268,"../../plots/cartesian/tick_value_defaults":269,"./attributes":76}],79:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plot_api/plot_template":266,"../../plots/cartesian/tick_label_defaults":298,"../../plots/cartesian/tick_mark_defaults":299,"../../plots/cartesian/tick_value_defaults":300,"./attributes":105}],108:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21770,6 +23238,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -22024,10 +23493,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -22139,18 +23608,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -22214,20 +23684,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -22237,7 +23706,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -22282,7 +23755,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -22338,7 +23811,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -22433,10 +23906,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -22478,7 +23953,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":177,"../../lib":202,"../../lib/extend":196,"../../lib/setcursor":221,"../../lib/svg_text_utils":223,"../../plots/cartesian/axes":246,"../../plots/cartesian/axis_defaults":248,"../../plots/cartesian/layout_attributes":260,"../../plots/cartesian/position_defaults":263,"../../plots/plots":280,"../../registry":293,"../color":75,"../colorscale/helpers":86,"../dragelement":94,"../drawing":97,"../titles":170,"./constants":77,"d3":21,"tinycolor2":58}],80:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206,"../../lib":232,"../../lib/extend":226,"../../lib/setcursor":251,"../../lib/svg_text_utils":253,"../../plots/cartesian/axes":277,"../../plots/cartesian/axis_defaults":279,"../../plots/cartesian/layout_attributes":291,"../../plots/cartesian/position_defaults":294,"../../plots/plots":311,"../../registry":324,"../color":104,"../colorscale/helpers":115,"../dragelement":123,"../drawing":126,"../titles":199,"./constants":106,"d3":21,"tinycolor2":87}],109:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22497,7 +23972,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":202}],81:[function(_dereq_,module,exports){ +},{"../../lib":232}],110:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22519,7 +23994,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":76,"./defaults":78,"./draw":79,"./has_colorbar":80}],82:[function(_dereq_,module,exports){ +},{"./attributes":105,"./defaults":107,"./draw":108,"./has_colorbar":109}],111:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22727,7 +24202,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":217,"../colorbar/attributes":76,"./scales.js":90}],83:[function(_dereq_,module,exports){ +},{"../../lib/regex":247,"../colorbar/attributes":105,"./scales.js":119}],112:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22806,7 +24281,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":202,"./helpers":86,"fast-isnumeric":23}],84:[function(_dereq_,module,exports){ +},{"../../lib":232,"./helpers":115,"fast-isnumeric":23}],113:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22883,7 +24358,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":202,"./helpers":86}],85:[function(_dereq_,module,exports){ +},{"../../lib":232,"./helpers":115}],114:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23008,7 +24483,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":202,"../../registry":293,"../colorbar/defaults":78,"../colorbar/has_colorbar":80,"./scales":90,"fast-isnumeric":23}],86:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324,"../colorbar/defaults":107,"../colorbar/has_colorbar":109,"./scales":119,"fast-isnumeric":23}],115:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23248,7 +24723,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":202,"../color":75,"./scales":90,"d3":21,"fast-isnumeric":23,"tinycolor2":58}],87:[function(_dereq_,module,exports){ +},{"../../lib":232,"../color":104,"./scales":119,"d3":21,"fast-isnumeric":23,"tinycolor2":87}],116:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23290,7 +24765,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":82,"./calc":83,"./cross_trace_defaults":84,"./defaults":85,"./helpers":86,"./layout_attributes":88,"./layout_defaults":89,"./scales":90}],88:[function(_dereq_,module,exports){ +},{"./attributes":111,"./calc":112,"./cross_trace_defaults":113,"./defaults":114,"./helpers":115,"./layout_attributes":117,"./layout_defaults":118,"./scales":119}],117:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23351,7 +24826,7 @@ module.exports = { })) }; -},{"../../lib/extend":196,"./attributes":82,"./scales":90}],89:[function(_dereq_,module,exports){ +},{"../../lib/extend":226,"./attributes":111,"./scales":119}],118:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23402,7 +24877,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":202,"../../plot_api/plot_template":236,"./defaults":85,"./layout_attributes":88}],90:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plot_api/plot_template":266,"./defaults":114,"./layout_attributes":117}],119:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23606,7 +25081,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":58}],91:[function(_dereq_,module,exports){ +},{"tinycolor2":87}],120:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23639,7 +25114,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],92:[function(_dereq_,module,exports){ +},{}],121:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23677,7 +25152,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":202}],93:[function(_dereq_,module,exports){ +},{"../../lib":232}],122:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23736,7 +25211,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],94:[function(_dereq_,module,exports){ +},{}],123:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -24028,7 +25503,7 @@ function pointerOffset(e) { ); } -},{"../../lib":202,"../../plots/cartesian/constants":252,"./align":91,"./cursor":92,"./unhover":95,"has-hover":25,"has-passive-events":26,"mouse-event-offset":46}],95:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/constants":283,"./align":120,"./cursor":121,"./unhover":124,"has-hover":54,"has-passive-events":55,"mouse-event-offset":75}],124:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -24083,7 +25558,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":194,"../../lib/events":195,"../../lib/throttle":224,"../fx/constants":109}],96:[function(_dereq_,module,exports){ +},{"../../lib/dom":224,"../../lib/events":225,"../../lib/throttle":254,"../fx/constants":138}],125:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -24108,7 +25583,7 @@ exports.dash = { }; -},{}],97:[function(_dereq_,module,exports){ +},{}],126:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -24128,6 +25603,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -24189,7 +25665,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -24815,7 +26291,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -25206,7 +26682,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -25240,7 +26716,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -25259,7 +26735,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -25290,9 +26766,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -25300,11 +26776,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":111,"../../constants/alignment":177,"../../constants/interactions":180,"../../constants/xmlns_namespaces":182,"../../lib":202,"../../lib/svg_text_utils":223,"../../registry":293,"../../traces/scatter/make_bubble_size_func":430,"../../traces/scatter/subtypes":437,"../color":75,"../colorscale":87,"./symbol_defs":98,"d3":21,"fast-isnumeric":23,"tinycolor2":58}],98:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":140,"../../constants/alignment":206,"../../constants/interactions":210,"../../constants/xmlns_namespaces":212,"../../lib":232,"../../lib/svg_text_utils":253,"../../registry":324,"../../traces/scatter/make_bubble_size_func":462,"../../traces/scatter/subtypes":470,"../color":104,"../colorscale":116,"./symbol_defs":127,"d3":21,"fast-isnumeric":23,"tinycolor2":87}],127:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25868,7 +27344,7 @@ module.exports = { } }; -},{"d3":21}],99:[function(_dereq_,module,exports){ +},{"d3":21}],128:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25983,7 +27459,7 @@ module.exports = { } }; -},{}],100:[function(_dereq_,module,exports){ +},{}],129:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26069,7 +27545,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":202,"../../plots/cartesian/axes":246,"../../registry":293,"./compute_error":101,"fast-isnumeric":23}],101:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"../../registry":324,"./compute_error":130,"fast-isnumeric":23}],130:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26170,7 +27646,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],102:[function(_dereq_,module,exports){ +},{}],131:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26245,7 +27721,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":202,"../../plot_api/plot_template":236,"../../registry":293,"./attributes":99,"fast-isnumeric":23}],103:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plot_api/plot_template":266,"../../registry":324,"./attributes":128,"fast-isnumeric":23}],132:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26314,7 +27790,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":202,"../../plot_api/edit_types":229,"./attributes":99,"./calc":100,"./compute_error":101,"./defaults":102,"./plot":104,"./style":105}],104:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plot_api/edit_types":259,"./attributes":128,"./calc":129,"./compute_error":130,"./defaults":131,"./plot":133,"./style":134}],133:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26486,7 +27962,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":437,"../drawing":97,"d3":21,"fast-isnumeric":23}],105:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":470,"../drawing":126,"d3":21,"fast-isnumeric":23}],134:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26523,7 +27999,7 @@ module.exports = function style(traces) { }); }; -},{"../color":75,"d3":21}],106:[function(_dereq_,module,exports){ +},{"../color":104,"d3":21}],135:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26559,7 +28035,7 @@ module.exports = { } }; -},{"../../lib/extend":196,"../../plots/font_attributes":274,"./layout_attributes":116}],107:[function(_dereq_,module,exports){ +},{"../../lib/extend":226,"../../plots/font_attributes":305,"./layout_attributes":145}],136:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26618,7 +28094,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":202,"../../registry":293}],108:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324}],137:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26655,7 +28131,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":293,"./hover":112}],109:[function(_dereq_,module,exports){ +},{"../../registry":324,"./hover":141}],138:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26687,7 +28163,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],110:[function(_dereq_,module,exports){ +},{}],139:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26713,7 +28189,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":202,"./attributes":106,"./hoverlabel_defaults":113}],111:[function(_dereq_,module,exports){ +},{"../../lib":232,"./attributes":135,"./hoverlabel_defaults":142}],140:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26975,7 +28451,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":202}],112:[function(_dereq_,module,exports){ +},{"../../lib":232}],141:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26991,6 +28467,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -27170,7 +28648,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -27314,6 +28794,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -27694,10 +29180,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -27938,7 +29422,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -28046,7 +29530,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -28081,8 +29565,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -28090,7 +29579,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -28190,8 +29679,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -28450,7 +29939,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -28466,7 +29958,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -28475,49 +29968,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -28829,7 +30323,7 @@ function plainText(s, len) { }); } -},{"../../lib":202,"../../lib/events":195,"../../lib/override_cursor":213,"../../lib/svg_text_utils":223,"../../plots/cartesian/axes":246,"../../registry":293,"../color":75,"../dragelement":94,"../drawing":97,"../legend/defaults":127,"../legend/draw":128,"./constants":109,"./helpers":111,"d3":21,"fast-isnumeric":23,"tinycolor2":58}],113:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../lib/events":225,"../../lib/override_cursor":243,"../../lib/svg_text_utils":253,"../../plots/cartesian/axes":277,"../../registry":324,"../color":104,"../dragelement":123,"../drawing":126,"../legend/defaults":156,"../legend/draw":157,"./constants":138,"./helpers":140,"d3":21,"fast-isnumeric":23,"tinycolor2":87}],142:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28875,7 +30369,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":202,"../color":75,"./helpers":111}],114:[function(_dereq_,module,exports){ +},{"../../lib":232,"../color":104,"./helpers":140}],143:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28931,7 +30425,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":202,"./layout_attributes":116}],115:[function(_dereq_,module,exports){ +},{"../../lib":232,"./layout_attributes":145}],144:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29010,7 +30504,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":202,"../dragelement":94,"./attributes":106,"./calc":107,"./click":108,"./constants":109,"./defaults":110,"./helpers":111,"./hover":112,"./layout_attributes":116,"./layout_defaults":117,"./layout_global_defaults":118,"d3":21}],116:[function(_dereq_,module,exports){ +},{"../../lib":232,"../dragelement":123,"./attributes":135,"./calc":136,"./click":137,"./constants":138,"./defaults":139,"./helpers":140,"./hover":141,"./layout_attributes":145,"./layout_defaults":146,"./layout_global_defaults":147,"d3":21}],145:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29126,7 +30620,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":274,"./constants":109}],117:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":305,"./constants":138}],146:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29174,7 +30668,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":202,"./helpers":111,"./hoverlabel_defaults":113,"./hovermode_defaults":114,"./layout_attributes":116}],118:[function(_dereq_,module,exports){ +},{"../../lib":232,"./helpers":140,"./hoverlabel_defaults":142,"./hovermode_defaults":143,"./layout_attributes":145}],147:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29197,7 +30691,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":202,"./hoverlabel_defaults":113,"./layout_attributes":116}],119:[function(_dereq_,module,exports){ +},{"../../lib":232,"./hoverlabel_defaults":142,"./layout_attributes":145}],148:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29571,7 +31065,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":202,"../../lib/regex":217,"../../plot_api/plot_template":236,"../../plots/cartesian/constants":252,"../../plots/domain":273}],120:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../lib/regex":247,"../../plot_api/plot_template":266,"../../plots/cartesian/constants":283,"../../plots/domain":304}],149:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29584,6 +31078,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -29706,7 +31201,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw' }); -},{"../../plot_api/plot_template":236,"../../plots/cartesian/constants":252}],121:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":207,"../../plot_api/plot_template":266,"../../plots/cartesian/constants":283}],150:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29787,7 +31282,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":225,"fast-isnumeric":23}],122:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":255,"fast-isnumeric":23}],151:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29839,7 +31334,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -29852,7 +31347,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":202,"../../plots/array_container_defaults":242,"../../plots/cartesian/axes":246,"./attributes":120}],123:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/array_container_defaults":272,"../../plots/cartesian/axes":277,"./attributes":149}],152:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29866,6 +31361,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -29882,7 +31378,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -29985,10 +31481,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -29997,8 +31508,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -30022,8 +31550,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -30077,7 +31605,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":182,"../../plots/cartesian/axes":246,"../drawing":97,"d3":21}],124:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":212,"../../plots/cartesian/axes":277,"../../plots/cartesian/axis_ids":280,"../drawing":126,"d3":21}],153:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30101,7 +31629,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":258,"./attributes":120,"./convert_coords":121,"./defaults":122,"./draw":123}],125:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":289,"./attributes":149,"./convert_coords":150,"./defaults":151,"./draw":152}],154:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30173,6 +31701,14 @@ module.exports = { editType: 'legend', + }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + + editType: 'legend', + }, itemclick: { @@ -30262,7 +31798,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":274,"../color/attributes":74}],126:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":305,"../color/attributes":103}],155:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30282,13 +31818,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],127:[function(_dereq_,module,exports){ +},{}],156:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30404,6 +31938,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -30422,7 +31957,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":202,"../../plot_api/plot_template":236,"../../plots/layout_attributes":278,"../../registry":293,"./attributes":125,"./helpers":131}],128:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plot_api/plot_template":266,"../../plots/layout_attributes":309,"../../registry":324,"./attributes":154,"./helpers":160}],157:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30514,7 +32049,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -30835,11 +32369,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -30892,11 +32426,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -30966,7 +32503,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -31019,8 +32557,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -31133,7 +32671,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -31216,7 +32754,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":177,"../../lib":202,"../../lib/events":195,"../../lib/svg_text_utils":223,"../../plots/plots":280,"../../registry":293,"../color":75,"../dragelement":94,"../drawing":97,"./constants":126,"./get_legend_data":129,"./handle_click":130,"./helpers":131,"./style":133,"d3":21}],129:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206,"../../lib":232,"../../lib/events":225,"../../lib/svg_text_utils":253,"../../plots/plots":311,"../../registry":324,"../color":104,"../dragelement":123,"../drawing":126,"./constants":155,"./get_legend_data":158,"./handle_click":159,"./helpers":160,"./style":162,"d3":21}],158:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31325,7 +32863,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":293,"./helpers":131}],130:[function(_dereq_,module,exports){ +},{"../../registry":324,"./helpers":160}],159:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31564,7 +33102,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":202,"../../registry":293}],131:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324}],160:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31588,7 +33126,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],132:[function(_dereq_,module,exports){ +},{}],161:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31612,7 +33150,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":125,"./defaults":127,"./draw":128,"./style":133}],133:[function(_dereq_,module,exports){ +},{"./attributes":154,"./defaults":156,"./draw":157,"./style":162}],162:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31627,6 +33165,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -31635,6 +33174,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -31645,6 +33186,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -31673,7 +33217,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -31776,7 +33320,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -31796,7 +33340,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -31886,7 +33430,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -31898,7 +33442,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -31926,7 +33470,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -31966,7 +33510,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -31990,7 +33534,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -32030,7 +33574,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -32057,7 +33601,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -32093,7 +33637,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -32191,7 +33735,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -32239,7 +33783,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":202,"../../registry":293,"../../traces/pie/helpers":405,"../../traces/pie/style_one":411,"../../traces/scatter/subtypes":437,"../color":75,"../colorscale/helpers":86,"../drawing":97,"d3":21}],134:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324,"../../traces/pie/helpers":437,"../../traces/pie/style_one":443,"../../traces/scatter/subtypes":470,"../color":104,"../colorscale/helpers":115,"../drawing":126,"./constants":155,"d3":21}],163:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32975,7 +34519,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":185,"../../lib":202,"../../plots/cartesian/axis_ids":249,"../../plots/plots":280,"../../registry":293,"../shapes/draw":156}],135:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":215,"../../lib":232,"../../plots/cartesian/axis_ids":280,"../../plots/plots":311,"../../registry":324,"../shapes/draw":185}],164:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32989,7 +34533,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":136}],136:[function(_dereq_,module,exports){ +},{"./manage":165}],165:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33285,7 +34829,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":249,"../../registry":293,"../../traces/scatter/subtypes":437,"../fx/helpers":111,"./buttons":134,"./modebar":137}],137:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":280,"../../registry":324,"../../traces/scatter/subtypes":470,"../fx/helpers":140,"./buttons":163,"./modebar":166}],166:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33631,7 +35175,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":185,"../../lib":202,"d3":21,"fast-isnumeric":23}],138:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":215,"../../lib":232,"d3":21,"fast-isnumeric":23}],167:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33767,7 +35311,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":236,"../../plots/font_attributes":274,"../color/attributes":74}],139:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":266,"../../plots/font_attributes":305,"../color/attributes":103}],168:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33796,7 +35340,7 @@ module.exports = { darkAmount: 10 }; -},{}],140:[function(_dereq_,module,exports){ +},{}],169:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33888,7 +35432,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":202,"../../plot_api/plot_template":236,"../../plots/array_container_defaults":242,"../color":75,"./attributes":138,"./constants":139}],141:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plot_api/plot_template":266,"../../plots/array_container_defaults":272,"../color":104,"./attributes":167,"./constants":168}],170:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33906,6 +35450,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -34035,8 +35580,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -34087,9 +35631,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -34142,10 +35684,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":177,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/cartesian/axis_ids":249,"../../plots/plots":280,"../../registry":293,"../color":75,"../drawing":97,"./constants":139,"./get_update_object":142,"d3":21}],142:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/cartesian/axis_ids":280,"../../plots/plots":311,"../../registry":324,"../color":104,"../drawing":126,"./constants":168,"./get_update_object":171,"d3":21}],171:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34199,7 +35741,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":21}],143:[function(_dereq_,module,exports){ +},{"d3":21}],172:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34226,7 +35768,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":138,"./defaults":140,"./draw":141}],144:[function(_dereq_,module,exports){ +},{"./attributes":167,"./defaults":169,"./draw":170}],173:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34300,7 +35842,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":74}],145:[function(_dereq_,module,exports){ +},{"../color/attributes":103}],174:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34334,7 +35876,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":245,"../../plots/cartesian/axis_ids":249,"./constants":146}],146:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":276,"../../plots/cartesian/axis_ids":280,"./constants":175}],175:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34390,7 +35932,7 @@ module.exports = { extraPad: 15 }; -},{}],147:[function(_dereq_,module,exports){ +},{}],176:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34476,7 +36018,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":202,"../../plot_api/plot_template":236,"../../plots/cartesian/axis_ids":249,"./attributes":144,"./oppaxis_attributes":151}],148:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plot_api/plot_template":266,"../../plots/cartesian/axis_ids":280,"./attributes":173,"./oppaxis_attributes":180}],177:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34493,6 +36035,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -34598,7 +36141,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -34711,6 +36254,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -34857,10 +36402,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -34882,7 +36427,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -35098,14 +36643,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -35119,7 +36662,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":202,"../../lib/setcursor":221,"../../plots/cartesian":259,"../../plots/cartesian/axis_ids":249,"../../plots/plots":280,"../../registry":293,"../color":75,"../dragelement":94,"../drawing":97,"../titles":170,"./constants":146,"d3":21}],149:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../lib/setcursor":251,"../../plots/cartesian":290,"../../plots/cartesian/axis_ids":280,"../../plots/plots":311,"../../registry":324,"../color":104,"../dragelement":123,"../drawing":126,"../titles":199,"./constants":175,"d3":21}],178:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35194,7 +36737,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":177,"../../lib/svg_text_utils":223,"../../plots/cartesian/axis_ids":249,"./constants":146}],150:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206,"../../lib/svg_text_utils":253,"../../plots/cartesian/axis_ids":280,"./constants":175}],179:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35233,7 +36776,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":202,"./attributes":144,"./calc_autorange":145,"./defaults":147,"./draw":148,"./helpers":149,"./oppaxis_attributes":151}],151:[function(_dereq_,module,exports){ +},{"../../lib":232,"./attributes":173,"./calc_autorange":174,"./defaults":176,"./draw":177,"./helpers":178,"./oppaxis_attributes":180}],180:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35271,7 +36814,7 @@ module.exports = { editType: 'calc' }; -},{}],152:[function(_dereq_,module,exports){ +},{}],181:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35287,6 +36830,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -35423,7 +36967,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":196,"../../plot_api/plot_template":236,"../../traces/scatter/attributes":413,"../annotations/attributes":60,"../drawing/attributes":96}],153:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":207,"../../lib/extend":226,"../../plot_api/plot_template":266,"../../traces/scatter/attributes":445,"../annotations/attributes":89,"../drawing/attributes":125}],182:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35451,9 +36995,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -35464,7 +37011,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -35540,7 +37087,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":202,"../../plots/cartesian/axes":246,"./constants":154,"./helpers":163}],154:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"./constants":183,"./helpers":192}],183:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35604,7 +37151,7 @@ module.exports = { } }; -},{}],155:[function(_dereq_,module,exports){ +},{}],184:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35670,9 +37217,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -35733,7 +37282,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":202,"../../plots/array_container_defaults":242,"../../plots/cartesian/axes":246,"./attributes":152,"./helpers":163}],156:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/array_container_defaults":272,"../../plots/cartesian/axes":277,"./attributes":181,"./helpers":192}],185:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35919,7 +37468,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -35945,11 +37497,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -36320,6 +37874,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -36327,15 +37883,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -36492,7 +38056,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":202,"../../lib/setcursor":221,"../../plot_api/plot_template":236,"../../plots/cartesian/axes":246,"../../plots/cartesian/handle_outline":256,"../../registry":293,"../color":75,"../dragelement":94,"../drawing":97,"./constants":154,"./draw_newshape/display_outlines":160,"./draw_newshape/helpers":161,"./helpers":163}],157:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../lib/setcursor":251,"../../plot_api/plot_template":266,"../../plots/cartesian/axes":277,"../../plots/cartesian/handle_outline":287,"../../registry":324,"../color":104,"../dragelement":123,"../drawing":126,"./constants":183,"./draw_newshape/display_outlines":189,"./draw_newshape/helpers":190,"./helpers":192}],186:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36595,7 +38159,7 @@ module.exports = { } }; -},{"../../../lib/extend":196,"../../drawing/attributes":96}],158:[function(_dereq_,module,exports){ +},{"../../../lib/extend":226,"../../drawing/attributes":125}],187:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36619,7 +38183,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],159:[function(_dereq_,module,exports){ +},{}],188:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36651,7 +38215,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":75}],160:[function(_dereq_,module,exports){ +},{"../../color":104}],189:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36946,7 +38510,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":256,"../../../registry":293,"../../dragelement":94,"../../dragelement/helpers":93,"./constants":158,"./helpers":161,"./newshapes":162}],161:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":287,"../../../registry":324,"../../dragelement":123,"../../dragelement/helpers":122,"./constants":187,"./helpers":190,"./newshapes":191}],190:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37284,7 +38848,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":257,"./constants":158,"parse-svg-path":47}],162:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":288,"./constants":187,"parse-svg-path":76}],191:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37543,7 +39107,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":256,"../../../plots/cartesian/helpers":257,"../../dragelement/helpers":93,"./constants":158,"./helpers":161}],163:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":287,"../../../plots/cartesian/helpers":288,"../../dragelement/helpers":122,"./constants":187,"./helpers":190}],192:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37604,18 +39168,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -37625,13 +39195,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -37688,7 +39265,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":202,"./constants":154}],164:[function(_dereq_,module,exports){ +},{"../../lib":232,"./constants":183}],193:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37716,7 +39293,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":258,"./attributes":152,"./calc_autorange":153,"./defaults":155,"./draw":156,"./draw_newshape/defaults":159}],165:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":289,"./attributes":181,"./calc_autorange":182,"./defaults":184,"./draw":185,"./draw_newshape/defaults":188}],194:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37959,7 +39536,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":196,"../../plot_api/edit_types":229,"../../plot_api/plot_template":236,"../../plots/animation_attributes":241,"../../plots/font_attributes":274,"../../plots/pad_attributes":279,"./constants":166}],166:[function(_dereq_,module,exports){ +},{"../../lib/extend":226,"../../plot_api/edit_types":259,"../../plot_api/plot_template":266,"../../plots/animation_attributes":271,"../../plots/font_attributes":305,"../../plots/pad_attributes":310,"./constants":195}],195:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38053,7 +39630,7 @@ module.exports = { currentValueInset: 0, }; -},{}],167:[function(_dereq_,module,exports){ +},{}],196:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38168,7 +39745,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":202,"../../plots/array_container_defaults":242,"./attributes":165,"./constants":166}],168:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/array_container_defaults":272,"./attributes":194,"./constants":195}],197:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38185,6 +39762,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -38473,11 +40051,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -38528,11 +40105,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -38745,7 +40321,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -38800,7 +40376,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":177,"../../lib":202,"../../lib/svg_text_utils":223,"../../plot_api/plot_template":236,"../../plots/plots":280,"../color":75,"../drawing":97,"./constants":166,"d3":21}],169:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206,"../../lib":232,"../../lib/svg_text_utils":253,"../../plot_api/plot_template":266,"../../plots/plots":311,"../color":104,"../drawing":126,"./constants":195,"d3":21}],198:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38823,7 +40399,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":165,"./constants":166,"./defaults":167,"./draw":168}],170:[function(_dereq_,module,exports){ +},{"./attributes":194,"./constants":195,"./defaults":196,"./draw":197}],199:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38841,6 +40417,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -38961,7 +40538,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -39039,7 +40616,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -39090,7 +40667,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":177,"../../constants/interactions":180,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/plots":280,"../../registry":293,"../color":75,"../drawing":97,"d3":21,"fast-isnumeric":23}],171:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206,"../../constants/interactions":210,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/plots":311,"../../registry":324,"../color":104,"../drawing":126,"d3":21,"fast-isnumeric":23}],200:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39259,7 +40836,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":196,"../../plot_api/edit_types":229,"../../plot_api/plot_template":236,"../../plots/font_attributes":274,"../../plots/pad_attributes":279,"../color/attributes":74}],172:[function(_dereq_,module,exports){ +},{"../../lib/extend":226,"../../plot_api/edit_types":259,"../../plot_api/plot_template":266,"../../plots/font_attributes":305,"../../plots/pad_attributes":310,"../color/attributes":103}],201:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39340,7 +40917,7 @@ module.exports = { } }; -},{}],173:[function(_dereq_,module,exports){ +},{}],202:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39423,7 +41000,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":202,"../../plots/array_container_defaults":242,"./attributes":171,"./constants":172}],174:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/array_container_defaults":272,"./attributes":200,"./constants":201}],203:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39621,8 +41198,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -39861,11 +41437,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -40076,9 +41651,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":177,"../../lib":202,"../../lib/svg_text_utils":223,"../../plot_api/plot_template":236,"../../plots/plots":280,"../color":75,"../drawing":97,"./constants":172,"./scrollbox":176,"d3":21}],175:[function(_dereq_,module,exports){ -arguments[4][169][0].apply(exports,arguments) -},{"./attributes":171,"./constants":172,"./defaults":173,"./draw":174,"dup":169}],176:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206,"../../lib":232,"../../lib/svg_text_utils":253,"../../plot_api/plot_template":266,"../../plots/plots":311,"../color":104,"../drawing":126,"./constants":201,"./scrollbox":205,"d3":21}],204:[function(_dereq_,module,exports){ +arguments[4][198][0].apply(exports,arguments) +},{"./attributes":200,"./constants":201,"./defaults":202,"./draw":203,"dup":198}],205:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40543,7 +42118,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":202,"../color":75,"../drawing":97,"d3":21}],177:[function(_dereq_,module,exports){ +},{"../../lib":232,"../color":104,"../drawing":126,"d3":21}],206:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40608,7 +42183,39 @@ module.exports = { } }; -},{}],178:[function(_dereq_,module,exports){ +},{}],207:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],208:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40624,7 +42231,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],179:[function(_dereq_,module,exports){ +},{}],209:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40662,7 +42269,7 @@ module.exports = { } }; -},{}],180:[function(_dereq_,module,exports){ +},{}],210:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40685,7 +42292,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],181:[function(_dereq_,module,exports){ +},{}],211:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40758,7 +42365,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],182:[function(_dereq_,module,exports){ +},{}],212:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40782,7 +42389,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],183:[function(_dereq_,module,exports){ +},{}],213:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40868,7 +42475,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":68,"./components/annotations3d":73,"./components/colorbar":81,"./components/colorscale":87,"./components/errorbars":103,"./components/fx":115,"./components/grid":119,"./components/images":124,"./components/legend":132,"./components/rangeselector":143,"./components/rangeslider":150,"./components/shapes":164,"./components/sliders":169,"./components/updatemenus":175,"./fonts/mathjax_config":184,"./fonts/ploticon":185,"./lib/queue":216,"./locale-en":227,"./locale-en-us":226,"./plot_api":231,"./plot_api/plot_schema":235,"./plots/plots":280,"./registry":293,"./snapshot":298,"./traces/scatter":425,"./version":459,"d3":21,"es6-promise":22}],184:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":97,"./components/annotations3d":102,"./components/colorbar":110,"./components/colorscale":116,"./components/errorbars":132,"./components/fx":144,"./components/grid":148,"./components/images":153,"./components/legend":161,"./components/rangeselector":172,"./components/rangeslider":179,"./components/shapes":193,"./components/sliders":198,"./components/updatemenus":204,"./fonts/mathjax_config":214,"./fonts/ploticon":215,"./lib/queue":246,"./locale-en":257,"./locale-en-us":256,"./plot_api":261,"./plot_api/plot_schema":265,"./plots/plots":311,"./registry":324,"./snapshot":329,"./traces/scatter":457,"./version":492,"d3":21,"es6-promise":22}],214:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40899,7 +42506,7 @@ module.exports = function() { } }; -},{}],185:[function(_dereq_,module,exports){ +},{}],215:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41079,7 +42686,7 @@ module.exports = { } }; -},{}],186:[function(_dereq_,module,exports){ +},{}],216:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41143,7 +42750,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],187:[function(_dereq_,module,exports){ +},{}],217:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41384,7 +42991,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":209}],188:[function(_dereq_,module,exports){ +},{"./mod":239}],218:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41541,7 +43148,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],189:[function(_dereq_,module,exports){ +},{}],219:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41574,7 +43181,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":181,"fast-isnumeric":23}],190:[function(_dereq_,module,exports){ +},{"../constants/numerical":211,"fast-isnumeric":23}],220:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41602,7 +43209,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],191:[function(_dereq_,module,exports){ +},{}],221:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41625,7 +43232,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],192:[function(_dereq_,module,exports){ +},{}],222:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42089,7 +43696,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":90,"../constants/interactions":180,"../plots/attributes":243,"./array":188,"./mod":209,"./nested_property":210,"./regex":217,"fast-isnumeric":23,"tinycolor2":58}],193:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":119,"../constants/interactions":210,"../plots/attributes":273,"./array":218,"./mod":239,"./nested_property":240,"./regex":247,"fast-isnumeric":23,"tinycolor2":87}],223:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42137,9 +43744,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -42147,7 +43768,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -42676,7 +44297,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":181,"../registry":293,"./loggers":206,"./mod":209,"d3-time-format":19,"fast-isnumeric":23}],194:[function(_dereq_,module,exports){ +},{"../constants/numerical":211,"../registry":324,"./loggers":236,"./mod":239,"d3-time-format":19,"fast-isnumeric":23}],224:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42689,6 +44310,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -42770,16 +44393,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":206,"d3":21}],195:[function(_dereq_,module,exports){ +},{"./loggers":236,"./matrix":238,"d3":21,"gl-mat4":39}],225:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42952,7 +44648,7 @@ var Events = { module.exports = Events; -},{"events":17}],196:[function(_dereq_,module,exports){ +},{"events":17}],226:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43066,7 +44762,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":203}],197:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":233}],227:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43117,7 +44813,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],198:[function(_dereq_,module,exports){ +},{}],228:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43165,7 +44861,7 @@ function isCalcData(cont) { ); } -},{}],199:[function(_dereq_,module,exports){ +},{}],229:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43409,7 +45105,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":209}],200:[function(_dereq_,module,exports){ +},{"./mod":239}],230:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43425,7 +45121,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { module.exports = function identity(d) { return d; }; -},{}],201:[function(_dereq_,module,exports){ +},{}],231:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43467,7 +45163,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],202:[function(_dereq_,module,exports){ +},{}],232:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43558,8 +45254,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -43615,6 +45314,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -44665,6 +46368,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -44691,13 +46406,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -44715,7 +46428,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":181,"./anchor_utils":186,"./angles":187,"./array":188,"./clean_number":189,"./clear_responsive":191,"./coerce":192,"./dates":193,"./dom":194,"./extend":196,"./filter_unique":197,"./filter_visible":198,"./geometry2d":199,"./identity":200,"./increment":201,"./is_plain_object":203,"./keyed_container":204,"./localize":205,"./loggers":206,"./make_trace_groups":207,"./matrix":208,"./mod":209,"./nested_property":210,"./noop":211,"./notifier":212,"./push_unique":215,"./regex":217,"./relative_attr":218,"./relink_private":219,"./search":220,"./stats":222,"./throttle":224,"./to_log_range":225,"d3":21,"d3-time-format":19,"fast-isnumeric":23}],203:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":211,"./anchor_utils":216,"./angles":217,"./array":218,"./clean_number":219,"./clear_responsive":221,"./coerce":222,"./dates":223,"./dom":224,"./extend":226,"./filter_unique":227,"./filter_visible":228,"./geometry2d":229,"./identity":230,"./increment":231,"./is_plain_object":233,"./keyed_container":234,"./localize":235,"./loggers":236,"./make_trace_groups":237,"./matrix":238,"./mod":239,"./nested_property":240,"./noop":241,"./notifier":242,"./push_unique":245,"./regex":247,"./relative_attr":248,"./relink_private":249,"./search":250,"./stats":252,"./throttle":254,"./to_log_range":255,"d3":21,"d3-time-format":19,"fast-isnumeric":23}],233:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44743,7 +46473,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],204:[function(_dereq_,module,exports){ +},{}],234:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44936,7 +46666,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":210}],205:[function(_dereq_,module,exports){ +},{"./nested_property":240}],235:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44992,7 +46722,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":293}],206:[function(_dereq_,module,exports){ +},{"../registry":324}],236:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45102,7 +46832,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":234,"./notifier":212}],207:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":264,"./notifier":242}],237:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45145,7 +46875,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":21}],208:[function(_dereq_,module,exports){ +},{"d3":21}],238:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45157,6 +46887,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -45232,13 +46963,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -45252,7 +46993,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],209:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":39}],239:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45287,7 +47062,7 @@ module.exports = { modHalf: modHalf }; -},{}],210:[function(_dereq_,module,exports){ +},{}],240:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45533,7 +47308,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":188,"fast-isnumeric":23}],211:[function(_dereq_,module,exports){ +},{"./array":218,"fast-isnumeric":23}],241:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45549,7 +47324,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],212:[function(_dereq_,module,exports){ +},{}],242:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45637,7 +47412,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":21,"fast-isnumeric":23}],213:[function(_dereq_,module,exports){ +},{"d3":21,"fast-isnumeric":23}],243:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45685,7 +47460,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":221}],214:[function(_dereq_,module,exports){ +},{"./setcursor":251}],244:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45937,7 +47712,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":181,"./matrix":208}],215:[function(_dereq_,module,exports){ +},{"../constants/numerical":211,"./matrix":238}],245:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45975,7 +47750,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],216:[function(_dereq_,module,exports){ +},{}],246:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46183,7 +47958,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":202,"../plot_api/plot_config":234}],217:[function(_dereq_,module,exports){ +},{"../lib":232,"../plot_api/plot_config":264}],247:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46213,7 +47988,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],218:[function(_dereq_,module,exports){ +},{}],248:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46266,7 +48041,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],219:[function(_dereq_,module,exports){ +},{}],249:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46323,7 +48098,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":188,"./is_plain_object":203}],220:[function(_dereq_,module,exports){ +},{"./array":218,"./is_plain_object":233}],250:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46528,7 +48303,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":181,"./identity":200,"./loggers":206,"fast-isnumeric":23}],221:[function(_dereq_,module,exports){ +},{"../constants/numerical":211,"./identity":230,"./loggers":236,"fast-isnumeric":23}],251:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46551,7 +48326,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],222:[function(_dereq_,module,exports){ +},{}],252:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46661,7 +48436,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":188,"fast-isnumeric":23}],223:[function(_dereq_,module,exports){ +},{"./array":218,"fast-isnumeric":23}],253:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46678,6 +48453,7 @@ exports.interp = function(arr, n) { var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -46792,7 +48568,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -47407,9 +49183,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -47540,7 +49327,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":177,"../constants/xmlns_namespaces":182,"../lib":202,"d3":21}],224:[function(_dereq_,module,exports){ +},{"../constants/alignment":206,"../constants/xmlns_namespaces":212,"../lib":232,"d3":21}],254:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47643,7 +49430,7 @@ function _clearTimeout(cache) { } } -},{}],225:[function(_dereq_,module,exports){ +},{}],255:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47671,7 +49458,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":23}],226:[function(_dereq_,module,exports){ +},{"fast-isnumeric":23}],256:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47693,7 +49480,7 @@ module.exports = { } }; -},{}],227:[function(_dereq_,module,exports){ +},{}],257:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47736,7 +49523,7 @@ module.exports = { } }; -},{}],228:[function(_dereq_,module,exports){ +},{}],258:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47794,7 +49581,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":293}],229:[function(_dereq_,module,exports){ +},{"../registry":324}],259:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47919,7 +49706,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":202}],230:[function(_dereq_,module,exports){ +},{"../lib":232}],260:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -48096,6 +49883,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -48140,7 +49937,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -48611,7 +50408,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":75,"../lib":202,"../plots/cartesian/axis_ids":249,"../plots/plots":280,"../registry":293,"fast-isnumeric":23,"gl-mat4/fromQuat":24}],231:[function(_dereq_,module,exports){ +},{"../components/color":104,"../lib":232,"../plots/cartesian/axis_ids":280,"../plots/plots":311,"../registry":324,"fast-isnumeric":23,"gl-mat4/fromQuat":29}],261:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -48654,7 +50451,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":295,"./plot_api":233,"./template_api":238,"./to_image":239,"./validate":240}],232:[function(_dereq_,module,exports){ +},{"../snapshot/download":326,"./plot_api":263,"./template_api":268,"./to_image":269,"./validate":270}],262:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -48867,7 +50664,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":203,"../lib/loggers":206,"../lib/noop":211,"../lib/search":220,"../registry":293,"./container_array_match":228}],233:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":233,"../lib/loggers":236,"../lib/noop":241,"../lib/search":250,"../registry":324,"./container_array_match":258}],263:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -49237,7 +51034,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -49251,9 +51059,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -50831,6 +52646,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -50925,7 +52746,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -51015,7 +52836,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -51153,21 +52974,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -52578,6 +54397,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -52585,15 +54417,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -52619,6 +54456,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -52752,7 +54590,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":75,"../components/drawing":97,"../constants/xmlns_namespaces":182,"../lib":202,"../lib/events":195,"../lib/queue":216,"../lib/svg_text_utils":223,"../plots/cartesian/axes":246,"../plots/cartesian/constants":252,"../plots/cartesian/graph_interact":255,"../plots/cartesian/select":265,"../plots/plots":280,"../plots/polar/legacy":283,"../registry":293,"./edit_types":229,"./helpers":230,"./manage_arrays":232,"./plot_config":234,"./plot_schema":235,"./subroutines":237,"d3":21,"fast-isnumeric":23,"has-hover":25}],234:[function(_dereq_,module,exports){ +},{"../components/color":104,"../components/drawing":126,"../constants/xmlns_namespaces":212,"../lib":232,"../lib/events":225,"../lib/queue":246,"../lib/svg_text_utils":253,"../plots/cartesian/axes":277,"../plots/cartesian/constants":283,"../plots/cartesian/graph_interact":286,"../plots/cartesian/select":296,"../plots/plots":311,"../plots/polar/legacy":314,"../registry":324,"./edit_types":259,"./helpers":260,"./manage_arrays":262,"./plot_config":264,"./plot_schema":265,"./subroutines":267,"d3":21,"fast-isnumeric":23,"has-hover":54}],264:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53067,7 +54905,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],235:[function(_dereq_,module,exports){ +},{}],265:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53778,7 +55616,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":202,"../plots/animation_attributes":241,"../plots/attributes":243,"../plots/frame_attributes":275,"../plots/layout_attributes":278,"../plots/polar/legacy/area_attributes":281,"../plots/polar/legacy/axis_attributes":282,"../registry":293,"./edit_types":229,"./plot_config":234}],236:[function(_dereq_,module,exports){ +},{"../lib":232,"../plots/animation_attributes":271,"../plots/attributes":273,"../plots/frame_attributes":306,"../plots/layout_attributes":309,"../plots/polar/legacy/area_attributes":312,"../plots/polar/legacy/axis_attributes":313,"../registry":324,"./edit_types":259,"./plot_config":264}],266:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54090,7 +55928,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":202,"../plots/attributes":243}],237:[function(_dereq_,module,exports){ +},{"../lib":232,"../plots/attributes":273}],267:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54271,7 +56109,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -54760,57 +56598,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - - enforceAxisConstraints(gd); - - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); + + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -54836,7 +56652,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":75,"../components/drawing":97,"../components/modebar":135,"../components/titles":170,"../constants/alignment":177,"../lib":202,"../lib/clear_gl_canvases":190,"../plots/cartesian/autorange":245,"../plots/cartesian/axes":246,"../plots/cartesian/constraints":253,"../plots/plots":280,"../registry":293,"d3":21}],238:[function(_dereq_,module,exports){ +},{"../components/color":104,"../components/drawing":126,"../components/modebar":164,"../components/titles":199,"../constants/alignment":206,"../lib":232,"../lib/clear_gl_canvases":220,"../plots/cartesian/autorange":276,"../plots/cartesian/axes":277,"../plots/cartesian/constraints":284,"../plots/plots":311,"../registry":324,"d3":21}],268:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55298,7 +57114,7 @@ function format(opts) { return opts; } -},{"../lib":202,"../plots/attributes":243,"../plots/plots":280,"./plot_config":234,"./plot_schema":235,"./plot_template":236}],239:[function(_dereq_,module,exports){ +},{"../lib":232,"../plots/attributes":273,"../plots/plots":311,"./plot_config":264,"./plot_schema":265,"./plot_template":266}],269:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55395,7 +57211,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -55519,7 +57335,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":202,"../plots/plots":280,"../snapshot/helpers":297,"../snapshot/svgtoimg":299,"../snapshot/tosvg":301,"../version":459,"./plot_api":233,"fast-isnumeric":23}],240:[function(_dereq_,module,exports){ +},{"../lib":232,"../plots/plots":311,"../snapshot/helpers":328,"../snapshot/svgtoimg":330,"../snapshot/tosvg":332,"../version":492,"./plot_api":263,"fast-isnumeric":23}],270:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55950,7 +57766,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":202,"../plots/plots":280,"./plot_config":234,"./plot_schema":235}],241:[function(_dereq_,module,exports){ +},{"../lib":232,"../plots/plots":311,"./plot_config":264,"./plot_schema":265}],271:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56062,7 +57878,7 @@ module.exports = { } }; -},{}],242:[function(_dereq_,module,exports){ +},{}],272:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56157,7 +57973,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":202,"../plot_api/plot_template":236}],243:[function(_dereq_,module,exports){ +},{"../lib":232,"../plot_api/plot_template":266}],273:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56298,7 +58114,99 @@ module.exports = { } }; -},{"../components/fx/attributes":106}],244:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":135}],274:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":211,"../../lib":232,"fast-isnumeric":23}],275:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56327,7 +58235,7 @@ module.exports = { } }; -},{}],245:[function(_dereq_,module,exports){ +},{}],276:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56344,6 +58252,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -56384,7 +58294,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -56425,19 +58336,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -56445,9 +58343,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -56465,8 +58363,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -56480,7 +58378,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -56501,7 +58399,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -56510,12 +58408,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -56525,13 +58423,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -56543,7 +58469,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -56572,14 +58588,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -56839,7 +58875,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":181,"../../lib":202,"../../registry":293,"fast-isnumeric":23}],246:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"../../registry":324,"./axis_ids":280,"fast-isnumeric":23}],277:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56856,6 +58892,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -56889,6 +58926,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -56933,14 +58972,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -56948,6 +58990,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -56972,8 +59029,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -56982,7 +59039,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -57041,7 +59097,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -57363,6 +59421,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -57387,7 +59448,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -57397,6 +59458,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -57410,6 +59475,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -57422,15 +59671,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -57442,85 +59696,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } + var flip = ax._id.charAt(0) === 'y'; - var pos = ax.c2p(tickVal.value); + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -57541,180 +59791,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; - - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } - - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -57807,7 +59909,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -57824,15 +59927,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -57945,7 +60050,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -58428,6 +60534,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -58700,21 +60807,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -58815,23 +60924,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -58862,13 +60972,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -58889,7 +60999,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -58905,7 +61015,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -58925,7 +61035,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -58957,7 +61067,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -58969,7 +61079,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -58984,7 +61094,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -59240,21 +61350,81 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; +}; + +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; -}; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} /** * Make axis tick path string @@ -59301,24 +61471,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -59326,42 +61517,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } + + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } - out.xFn = function(d) { return d.dx + x0; }; + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } + + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -59613,6 +61863,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -59630,22 +61882,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -59713,11 +62009,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -59757,6 +62066,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -60238,7 +62567,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":75,"../../components/drawing":97,"../../components/titles":170,"../../constants/alignment":177,"../../constants/numerical":181,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/plots":280,"../../registry":293,"./autorange":245,"./axis_autotype":247,"./axis_ids":249,"./clean_ticks":251,"./layout_attributes":260,"./set_convert":266,"d3":21,"fast-isnumeric":23}],247:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/drawing":126,"../../components/titles":199,"../../constants/alignment":206,"../../constants/numerical":211,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/plots":311,"../../registry":324,"./autorange":276,"./axis_autotype":278,"./axis_ids":280,"./clean_ticks":282,"./layout_attributes":291,"./set_convert":297,"d3":21,"fast-isnumeric":23}],278:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60255,23 +62584,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; + + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + if(moreDates(a, calendar)) return 'date'; + + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -60284,56 +62639,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":181,"../../lib":202,"fast-isnumeric":23}],248:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"fast-isnumeric":23}],279:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60390,9 +62755,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -60450,7 +62839,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -60462,8 +62854,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -60616,7 +63006,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":202,"../../registry":293,"../array_container_defaults":242,"./category_order_defaults":250,"./constants":252,"./layout_attributes":260,"./line_grid_defaults":262,"./set_convert":266,"./tick_label_defaults":267,"./tick_mark_defaults":268,"./tick_value_defaults":269,"fast-isnumeric":23}],249:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324,"../array_container_defaults":272,"./category_order_defaults":281,"./constants":283,"./layout_attributes":291,"./line_grid_defaults":293,"./set_convert":297,"./tick_label_defaults":298,"./tick_mark_defaults":299,"./tick_value_defaults":300,"fast-isnumeric":23}],280:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60637,7 +63027,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -60649,13 +63039,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -60701,6 +63098,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -60733,17 +63132,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":293,"./constants":252}],250:[function(_dereq_,module,exports){ +},{"../../registry":324,"./constants":283}],281:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60837,7 +63240,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],251:[function(_dereq_,module,exports){ +},{}],282:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60850,7 +63253,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -60915,7 +63320,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -60925,7 +63332,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":181,"../../lib":202,"fast-isnumeric":23}],252:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"fast-isnumeric":23}],283:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60940,8 +63347,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -60953,7 +63360,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -61017,7 +63424,7 @@ module.exports = { } }; -},{"../../lib/regex":217}],253:[function(_dereq_,module,exports){ +},{"../../lib/regex":247}],284:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61029,74 +63436,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; + + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } + + var canLink = linkableAxes.length; + + var matches, scaleanchor; + + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -61107,64 +63720,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; +} - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -61173,12 +63761,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -61191,38 +63781,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); + } + } + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } } + + out[key] = val; } - thisGroup[scaleanchor] = 1; + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -61331,25 +63992,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -61371,6 +64033,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -61403,7 +64075,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":177,"../../constants/numerical":181,"../../lib":202,"./autorange":245,"./axis_ids":249,"./scale_zoom":264}],254:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206,"../../constants/numerical":211,"../../lib":232,"./autorange":276,"./axis_ids":280,"./layout_attributes":291,"./scale_zoom":295,"./set_convert":297}],285:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61420,6 +64092,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -61496,6 +64169,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -61527,10 +64203,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -61567,6 +64244,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -61732,6 +64412,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -61749,8 +64435,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -61950,6 +64636,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -61959,6 +64647,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -61967,7 +64671,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -61998,15 +64702,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -62015,12 +64721,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -62030,7 +64740,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -62040,9 +64750,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -62242,15 +64967,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -62266,7 +64991,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -62478,7 +65203,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -62491,7 +65216,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -62556,11 +65281,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -62571,14 +65298,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -62588,7 +65323,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -62675,7 +65413,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":75,"../../components/dragelement":94,"../../components/dragelement/helpers":93,"../../components/drawing":97,"../../components/fx":115,"../../constants/alignment":177,"../../lib":202,"../../lib/clear_gl_canvases":190,"../../lib/setcursor":221,"../../lib/svg_text_utils":223,"../../plot_api/subroutines":237,"../../registry":293,"../plots":280,"./axes":246,"./axis_ids":249,"./constants":252,"./scale_zoom":264,"./select":265,"d3":21,"has-passive-events":26,"tinycolor2":58}],255:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/dragelement":123,"../../components/dragelement/helpers":122,"../../components/drawing":126,"../../components/fx":144,"../../constants/alignment":206,"../../lib":232,"../../lib/clear_gl_canvases":220,"../../lib/setcursor":251,"../../lib/svg_text_utils":253,"../../plot_api/subroutines":267,"../../registry":324,"../plots":311,"./axes":277,"./axis_ids":280,"./constants":283,"./scale_zoom":295,"./select":296,"d3":21,"has-passive-events":55,"tinycolor2":87}],286:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62843,7 +65581,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":94,"../../components/fx":115,"../../lib/setcursor":221,"./constants":252,"./dragbox":254,"d3":21}],256:[function(_dereq_,module,exports){ +},{"../../components/dragelement":123,"../../components/fx":144,"../../lib/setcursor":251,"./constants":283,"./dragbox":285,"d3":21}],287:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62879,7 +65617,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],257:[function(_dereq_,module,exports){ +},{}],288:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62891,6 +65629,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -62921,9 +65661,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -62933,7 +65674,7 @@ module.exports = { getTransform: getTransform }; -},{}],258:[function(_dereq_,module,exports){ +},{"../../lib":232}],289:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62947,6 +65688,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -62976,8 +65718,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -63008,7 +65752,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":202,"../../registry":293}],259:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324,"./axis_ids":280}],290:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63346,6 +66090,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -63625,7 +66370,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":97,"../../constants/xmlns_namespaces":182,"../../lib":202,"../../registry":293,"../get_data":276,"../plots":280,"./attributes":244,"./axis_ids":249,"./constants":252,"./graph_interact":255,"./layout_attributes":260,"./layout_defaults":261,"./transition_axes":270,"d3":21}],260:[function(_dereq_,module,exports){ +},{"../../components/drawing":126,"../../constants/xmlns_namespaces":212,"../../lib":232,"../../registry":324,"../get_data":307,"../plots":311,"./attributes":275,"./axis_ids":280,"./constants":283,"./graph_interact":286,"./layout_attributes":291,"./layout_defaults":292,"./transition_axes":301,"d3":21}],291:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63698,6 +66443,14 @@ module.exports = { // type in the template explicitly it will be honored as the default. _noTemplating: true, + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, autorange: { valType: 'enumerated', @@ -63758,7 +66511,6 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', editType: 'plot', @@ -63922,6 +66674,22 @@ module.exports = { editType: 'ticks', + }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + editType: 'calc', + }, mirror: { valType: 'enumerated', @@ -64062,6 +66830,14 @@ module.exports = { editType: 'ticks', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'ticks', + }, separatethousands: { valType: 'boolean', @@ -64314,7 +67090,7 @@ module.exports = { } }; -},{"../../components/color/attributes":74,"../../components/drawing/attributes":96,"../../constants/docs":178,"../../constants/numerical":181,"../../lib/extend":196,"../../plot_api/plot_template":236,"../font_attributes":274,"./constants":252}],261:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":103,"../../components/drawing/attributes":125,"../../constants/docs":208,"../../constants/numerical":211,"../../lib/extend":226,"../../plot_api/plot_template":266,"../font_attributes":305,"./constants":283}],292:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64336,7 +67112,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -64355,6 +67131,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -64563,6 +67341,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -64627,6 +67406,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -64691,101 +67471,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":75,"../../components/fx/helpers":111,"../../components/fx/hovermode_defaults":114,"../../lib":202,"../../plot_api/plot_template":236,"../../registry":293,"../layout_attributes":278,"./axis_defaults":248,"./axis_ids":249,"./constants":252,"./constraints":253,"./layout_attributes":260,"./position_defaults":263,"./type_defaults":271}],262:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/fx/helpers":140,"../../components/fx/hovermode_defaults":143,"../../lib":232,"../../plot_api/plot_template":266,"../../registry":324,"../layout_attributes":309,"./axis_defaults":279,"./axis_ids":280,"./constants":283,"./constraints":284,"./layout_attributes":291,"./position_defaults":294,"./type_defaults":302}],293:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64850,7 +67542,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":74,"../../lib":202,"tinycolor2":58}],263:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":103,"../../lib":232,"tinycolor2":87}],294:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64938,7 +67630,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":202,"fast-isnumeric":23}],264:[function(_dereq_,module,exports){ +},{"../../lib":232,"fast-isnumeric":23}],295:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64964,9 +67656,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":177}],265:[function(_dereq_,module,exports){ +},{"../../constants/alignment":206}],296:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65036,6 +67729,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -65125,8 +67826,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -65901,7 +68602,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":75,"../../components/dragelement/helpers":93,"../../components/drawing":97,"../../components/fx":115,"../../components/fx/helpers":111,"../../components/shapes/draw_newshape/display_outlines":160,"../../components/shapes/draw_newshape/helpers":161,"../../components/shapes/draw_newshape/newshapes":162,"../../lib":202,"../../lib/clear_gl_canvases":190,"../../lib/polygon":214,"../../lib/throttle":224,"../../plot_api/subroutines":237,"../../registry":293,"./axis_ids":249,"./constants":252,"./handle_outline":256,"./helpers":257,"polybooljs":49}],266:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/dragelement/helpers":122,"../../components/drawing":126,"../../components/fx":144,"../../components/fx/helpers":140,"../../components/shapes/draw_newshape/display_outlines":189,"../../components/shapes/draw_newshape/helpers":190,"../../components/shapes/draw_newshape/newshapes":191,"../../lib":232,"../../lib/clear_gl_canvases":220,"../../lib/polygon":244,"../../lib/throttle":254,"../../plot_api/subroutines":267,"../../registry":324,"./axis_ids":280,"./constants":283,"./handle_outline":287,"./helpers":288,"polybooljs":78}],297:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65934,7 +68635,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -66090,6 +68790,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -66221,12 +68925,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -66269,17 +68973,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -66783,38 +69482,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -66873,7 +69560,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":181,"../../lib":202,"./axis_ids":249,"./constants":252,"d3":21,"d3-time-format":19,"fast-isnumeric":23}],267:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"./axis_ids":280,"./constants":283,"d3":21,"d3-time-format":19,"fast-isnumeric":23}],298:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66886,6 +69573,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -66922,10 +69610,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -66948,6 +69640,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -66994,7 +69687,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":202,"../array_container_defaults":242,"./layout_attributes":260}],268:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../lib":232,"../array_container_defaults":272,"./layout_attributes":291}],299:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67027,7 +69720,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":202,"./layout_attributes":260}],269:[function(_dereq_,module,exports){ +},{"../../lib":232,"./layout_attributes":291}],300:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67074,7 +69767,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":202,"./clean_ticks":251}],270:[function(_dereq_,module,exports){ +},{"../../lib":232,"./clean_ticks":282}],301:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67287,7 +69980,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":97,"../../lib":202,"../../registry":293,"./axes":246,"d3":21}],271:[function(_dereq_,module,exports){ +},{"../../components/drawing":126,"../../lib":232,"../../registry":324,"./axes":277,"d3":21}],302:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67306,6 +69999,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -67358,6 +70052,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -67424,7 +70120,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":293,"./axis_autotype":247}],272:[function(_dereq_,module,exports){ +},{"../../registry":324,"./axis_autotype":278}],303:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67851,7 +70547,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":202,"../registry":293}],273:[function(_dereq_,module,exports){ +},{"../lib":232,"../registry":324}],304:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67963,7 +70659,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":196}],274:[function(_dereq_,module,exports){ +},{"../lib/extend":226}],305:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68028,7 +70724,7 @@ module.exports = function(opts) { return attrs; }; -},{}],275:[function(_dereq_,module,exports){ +},{}],306:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68074,7 +70770,7 @@ module.exports = { } }; -},{}],276:[function(_dereq_,module,exports){ +},{}],307:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68203,7 +70899,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":293,"./cartesian/constants":252}],277:[function(_dereq_,module,exports){ +},{"../registry":324,"./cartesian/constants":283}],308:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68237,7 +70933,7 @@ function project(camera, v) { module.exports = project; -},{}],278:[function(_dereq_,module,exports){ +},{}],309:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68425,6 +71121,12 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + + editType: 'none', + + }, paper_bgcolor: { valType: 'color', @@ -68440,6 +71142,14 @@ module.exports = { dflt: colorAttrs.background, editType: 'layoutstyle', + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, separators: { valType: 'string', @@ -68564,7 +71274,7 @@ module.exports = { } }; -},{"../components/color/attributes":74,"../components/shapes/draw_newshape/attributes":157,"../lib/extend":196,"./animation_attributes":241,"./font_attributes":274,"./pad_attributes":279}],279:[function(_dereq_,module,exports){ +},{"../components/color/attributes":103,"../components/shapes/draw_newshape/attributes":186,"../lib/extend":226,"./animation_attributes":271,"./font_attributes":305,"./pad_attributes":310}],310:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68619,7 +71329,7 @@ module.exports = function(opts) { }; }; -},{}],280:[function(_dereq_,module,exports){ +},{}],311:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69289,7 +71999,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -70098,6 +72808,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -70486,6 +73198,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -70503,6 +73218,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -70522,13 +73241,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -70553,6 +73274,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -70567,8 +73293,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -70600,11 +73324,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -70614,11 +73337,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -70628,6 +73350,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -70654,11 +73388,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -70782,7 +73529,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -71682,6 +74442,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -71692,7 +74455,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -71702,27 +74464,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -71731,18 +74494,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -71765,16 +74524,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -71816,12 +74578,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -71830,13 +74588,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -71958,7 +74717,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":75,"../constants/numerical":181,"../lib":202,"../plot_api/plot_schema":235,"../plot_api/plot_template":236,"../plots/get_data":276,"../registry":293,"./animation_attributes":241,"./attributes":243,"./cartesian/axis_ids":249,"./cartesian/handle_outline":256,"./command":272,"./font_attributes":274,"./frame_attributes":275,"./layout_attributes":278,"d3":21,"d3-time-format":19,"fast-isnumeric":23}],281:[function(_dereq_,module,exports){ +},{"../components/color":104,"../constants/numerical":211,"../lib":232,"../plot_api/plot_schema":265,"../plot_api/plot_template":266,"../plots/get_data":307,"../registry":324,"./animation_attributes":271,"./attributes":273,"./cartesian/axis_ids":280,"./cartesian/handle_outline":287,"./command":303,"./font_attributes":305,"./frame_attributes":306,"./layout_attributes":309,"d3":21,"d3-time-format":19,"fast-isnumeric":23}],312:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72002,7 +74761,7 @@ module.exports = { } }; -},{"../../../lib/extend":196,"../../../traces/scatter/attributes":413}],282:[function(_dereq_,module,exports){ +},{"../../../lib/extend":226,"../../../traces/scatter/attributes":445}],313:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72124,7 +74883,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":196,"../../../plot_api/edit_types":229,"../../cartesian/layout_attributes":260}],283:[function(_dereq_,module,exports){ +},{"../../../lib/extend":226,"../../../plot_api/edit_types":259,"../../cartesian/layout_attributes":291}],314:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72139,7 +74898,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":284,"./micropolar_manager":285}],284:[function(_dereq_,module,exports){ +},{"./micropolar":315,"./micropolar_manager":316}],315:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73559,7 +76318,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":177,"../../../lib":202,"d3":21}],285:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":206,"../../../lib":232,"d3":21}],316:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73645,7 +76404,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":75,"../../../lib":202,"./micropolar":284,"./undo_manager":286,"d3":21}],286:[function(_dereq_,module,exports){ +},{"../../../components/color":104,"../../../lib":232,"./micropolar":315,"./undo_manager":317,"d3":21}],317:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73711,7 +76470,7 @@ module.exports = function UndoManager() { }; }; -},{}],287:[function(_dereq_,module,exports){ +},{}],318:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73796,7 +76555,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":202,"../plot_api/plot_template":236,"./domain":273}],288:[function(_dereq_,module,exports){ +},{"../lib":232,"../plot_api/plot_template":266,"./domain":304}],319:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73879,7 +76638,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":178}],289:[function(_dereq_,module,exports){ +},{"../constants/docs":208}],320:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73963,7 +76722,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../lib":202,"../../plots/get_data":276,"./layout_attributes":290,"./layout_defaults":291,"./ternary":292}],290:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/get_data":307,"./layout_attributes":321,"./layout_defaults":322,"./ternary":323}],321:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74006,6 +76765,7 @@ var ternaryAxesAttrs = { ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, @@ -74070,7 +76830,7 @@ attrs.aaxis.uirevision = attrs.baxis.uirevision = attrs.caxis.uirevision = { }; -},{"../../components/color/attributes":74,"../../lib/extend":196,"../../plot_api/edit_types":229,"../cartesian/layout_attributes":260,"../domain":273}],291:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":103,"../../lib/extend":226,"../../plot_api/edit_types":259,"../cartesian/layout_attributes":291,"../domain":304}],322:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74202,7 +76962,7 @@ function handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut coerce('layer'); } -},{"../../components/color":75,"../../lib":202,"../../plot_api/plot_template":236,"../cartesian/line_grid_defaults":262,"../cartesian/tick_label_defaults":267,"../cartesian/tick_mark_defaults":268,"../cartesian/tick_value_defaults":269,"../subplot_defaults":287,"./layout_attributes":290}],292:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../lib":232,"../../plot_api/plot_template":266,"../cartesian/line_grid_defaults":293,"../cartesian/tick_label_defaults":298,"../cartesian/tick_mark_defaults":299,"../cartesian/tick_value_defaults":300,"../subplot_defaults":318,"./layout_attributes":321}],323:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74219,6 +76979,7 @@ var tinycolor = _dereq_('tinycolor2'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var _ = Lib._; var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -74506,7 +77267,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { var triangleClipRelative = 'M0,' + h + 'h' + w + 'l-' + (w / 2) + ',-' + h + 'Z'; _this.clipDefRelative.select('path').attr('d', triangleClipRelative); - var plotTransform = 'translate(' + x0 + ',' + y0 + ')'; + var plotTransform = strTranslate(x0, y0); _this.plotContainer.selectAll('.scatterlayer,.maplayer') .attr('transform', plotTransform); @@ -74515,18 +77276,18 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { // TODO: shift axes to accommodate linewidth*sin(30) tick mark angle // TODO: there's probably an easier way to handle these translations/offsets now... - var bTransform = 'translate(' + (x0 - baxis._offset) + ',' + (y0 + h) + ')'; + var bTransform = strTranslate(x0 - baxis._offset, y0 + h); _this.layers.baxis.attr('transform', bTransform); _this.layers.bgrid.attr('transform', bTransform); - var aTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(30)translate(0,' + -aaxis._offset + ')'; + var aTransform = strTranslate(x0 + w / 2, y0) + + 'rotate(30)' + strTranslate(0, -aaxis._offset); _this.layers.aaxis.attr('transform', aTransform); _this.layers.agrid.attr('transform', aTransform); - var cTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(-30)translate(0,' + -caxis._offset + ')'; + var cTransform = strTranslate(x0 + w / 2, y0) + + 'rotate(-30)' + strTranslate(0, -caxis._offset); _this.layers.caxis.attr('transform', cTransform); _this.layers.cgrid.attr('transform', cTransform); @@ -74632,7 +77393,7 @@ proto.drawAx = function(ax) { var vals = Axes.calcTicks(ax); var valsClipped = Axes.clipEnds(ax, vals); - var transFn = Axes.makeTransFn(ax); + var transFn = Axes.makeTransTickFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; var caRad = Lib.deg2rad(counterAngle); @@ -74707,6 +77468,8 @@ proto.initInteractions = function() { var dragger = _this.layers.plotbg.select('path').node(); var gd = _this.graphDiv; var zoomLayer = gd._fullLayout._zoomlayer; + var scaleX; + var scaleY; // use plotbg for the main interactions this.dragOptions = { @@ -74725,6 +77488,9 @@ proto.initInteractions = function() { _this.dragOptions.xaxes = [_this.xaxis]; _this.dragOptions.yaxes = [_this.yaxis]; + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + var dragModeNow = _this.dragOptions.dragmode = gd._fullLayout.dragmode; if(freeMode(dragModeNow)) _this.dragOptions.minDrag = 1; @@ -74780,6 +77546,13 @@ proto.initInteractions = function() { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var inverse = gd._fullLayout._invTransform; + var transformedCoords = Lib.apply3DTransform(inverse)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + mins0 = { a: _this.aaxis.range[0], b: _this.baxis.range[1], @@ -74793,7 +77566,7 @@ proto.initInteractions = function() { zb = zoomLayer.append('path') .attr('class', 'zoombox') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') + .attr('transform', strTranslate(_this.x0, _this.y0)) .style({ 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 @@ -74802,7 +77575,7 @@ proto.initInteractions = function() { corners = zoomLayer.append('path') .attr('class', 'zoombox-corners') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') + .attr('transform', strTranslate(_this.x0, _this.y0)) .style({ fill: Color.background, stroke: Color.defaultLine, @@ -74819,8 +77592,8 @@ proto.initInteractions = function() { function getCFrac(x, y) { return ((x - (_this.h - y) / Math.sqrt(3)) / _this.w); } function zoomMove(dx0, dy0) { - var x1 = x0 + dx0; - var y1 = y0 + dy0; + var x1 = x0 + dx0 * scaleX; + var y1 = y0 + dy0 * scaleY; var afrac = Math.max(0, Math.min(1, getAFrac(x0, y0), getAFrac(x1, y1))); var bfrac = Math.max(0, Math.min(1, getBFrac(x0, y0), getBFrac(x1, y1))); var cfrac = Math.max(0, Math.min(1, getCFrac(x0, y0), getCFrac(x1, y1))); @@ -74919,11 +77692,11 @@ proto.initInteractions = function() { } // move the data (translate, don't redraw) - var plotTransform = 'translate(' + (_this.x0 + dx) + ',' + (_this.y0 + dy) + ')'; + var plotTransform = strTranslate(_this.x0 + dx, _this.y0 + dy); _this.plotContainer.selectAll('.scatterlayer,.maplayer') .attr('transform', plotTransform); - var plotTransform2 = 'translate(' + -dx + ',' + -dy + ')'; + var plotTransform2 = strTranslate(-dx, -dy); _this.clipDefRelative.select('path').attr('transform', plotTransform2); // move the ticks @@ -74970,7 +77743,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":75,"../../components/dragelement":94,"../../components/dragelement/helpers":93,"../../components/drawing":97,"../../components/fx":115,"../../components/titles":170,"../../lib":202,"../../lib/extend":196,"../../registry":293,"../cartesian/axes":246,"../cartesian/constants":252,"../cartesian/select":265,"../cartesian/set_convert":266,"../plots":280,"d3":21,"tinycolor2":58}],293:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/dragelement":123,"../../components/dragelement/helpers":122,"../../components/drawing":126,"../../components/fx":144,"../../components/titles":199,"../../lib":232,"../../lib/extend":226,"../../registry":324,"../cartesian/axes":277,"../cartesian/constants":283,"../cartesian/select":296,"../cartesian/set_convert":297,"../plots":311,"d3":21,"tinycolor2":87}],324:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75436,7 +78209,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":194,"./lib/extend":196,"./lib/is_plain_object":203,"./lib/loggers":206,"./lib/noop":211,"./lib/push_unique":215,"./plots/attributes":243,"./plots/layout_attributes":278}],294:[function(_dereq_,module,exports){ +},{"./lib/dom":224,"./lib/extend":226,"./lib/is_plain_object":233,"./lib/loggers":236,"./lib/noop":241,"./lib/push_unique":245,"./plots/attributes":273,"./plots/layout_attributes":309}],325:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75609,7 +78382,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":202,"../registry":293}],295:[function(_dereq_,module,exports){ +},{"../lib":232,"../registry":324}],326:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75643,6 +78416,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -75679,7 +78454,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":202,"../plot_api/to_image":239,"./filesaver":296,"./helpers":297}],296:[function(_dereq_,module,exports){ +},{"../lib":232,"../plot_api/to_image":269,"./filesaver":327,"./helpers":328}],327:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75759,7 +78534,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":202,"./helpers":297}],297:[function(_dereq_,module,exports){ +},{"../lib":232,"./helpers":328}],328:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75842,7 +78617,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":293}],298:[function(_dereq_,module,exports){ +},{"../registry":324}],329:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75868,7 +78643,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":294,"./download":295,"./helpers":297,"./svgtoimg":299,"./toimage":300,"./tosvg":301}],299:[function(_dereq_,module,exports){ +},{"./cloneplot":325,"./download":326,"./helpers":328,"./svgtoimg":330,"./toimage":331,"./tosvg":332}],330:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75995,7 +78770,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":202,"./helpers":297,"events":17}],300:[function(_dereq_,module,exports){ +},{"../lib":232,"./helpers":328,"events":17}],331:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76072,7 +78847,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":202,"../registry":293,"./cloneplot":294,"./helpers":297,"./svgtoimg":299,"./tosvg":301,"events":17}],301:[function(_dereq_,module,exports){ +},{"../lib":232,"../registry":324,"./cloneplot":325,"./helpers":328,"./svgtoimg":330,"./tosvg":332,"events":17}],332:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76261,7 +79036,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":75,"../components/drawing":97,"../constants/xmlns_namespaces":182,"../lib":202,"d3":21}],302:[function(_dereq_,module,exports){ +},{"../components/color":104,"../components/drawing":126,"../constants/xmlns_namespaces":212,"../lib":232,"d3":21}],333:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76294,7 +79069,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":202}],303:[function(_dereq_,module,exports){ +},{"../../lib":232}],334:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76356,6 +79131,13 @@ module.exports = { y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, texttemplate: texttemplateAttrs({editType: 'plot'}, { keys: constants.eventDataKeys @@ -76503,7 +79285,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":82,"../../lib/extend":196,"../../plots/font_attributes":274,"../../plots/template_attributes":288,"../scatter/attributes":413,"./constants":305}],304:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":111,"../../lib/extend":226,"../../plots/font_attributes":305,"../../plots/template_attributes":319,"../scatter/attributes":445,"./constants":336}],335:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76515,6 +79297,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; var colorscaleCalc = _dereq_('../../components/colorscale/calc'); var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); @@ -76523,18 +79306,23 @@ var calcSelection = _dereq_('../scatter/calc_selection'); module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; var sizeOpts = { msUTC: !!(trace.base || trace.base === 0) }; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x', sizeOpts); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y', sizeOpts); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -76545,6 +79333,10 @@ module.exports = function calc(gd, trace) { for(var i = 0; i < serieslen; i++) { cd[i] = { p: pos[i], s: size[i] }; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cd[i].id = String(trace.ids[i]); } @@ -76572,7 +79364,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":83,"../../components/colorscale/helpers":86,"../../plots/cartesian/axes":246,"../scatter/calc_selection":415,"./arrays_to_calcdata":302}],305:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":112,"../../components/colorscale/helpers":115,"../../plots/cartesian/align_period":274,"../../plots/cartesian/axes":277,"../scatter/calc_selection":447,"./arrays_to_calcdata":333}],336:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76594,7 +79386,7 @@ module.exports = { eventDataKeys: ['value', 'label'] }; -},{}],306:[function(_dereq_,module,exports){ +},{}],337:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76611,7 +79403,7 @@ var BADNUM = _dereq_('../../constants/numerical').BADNUM; var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var Sieve = _dereq_('./sieve.js'); /* @@ -77374,7 +80166,7 @@ module.exports = { setGroupPositions: setGroupPositions }; -},{"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"../../plots/cartesian/axis_ids":249,"../../registry":293,"./sieve.js":316,"fast-isnumeric":23}],307:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/axes":277,"../../plots/cartesian/constraints":284,"../../registry":324,"./sieve.js":347,"fast-isnumeric":23}],338:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77390,8 +80182,9 @@ var Color = _dereq_('../../components/color'); var Registry = _dereq_('../../registry'); var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var attributes = _dereq_('./attributes'); var coerceFont = Lib.coerceFont; @@ -77407,6 +80200,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); coerce('base'); coerce('offset'); @@ -77556,7 +80351,7 @@ module.exports = { handleText: handleText }; -},{"../../components/color":75,"../../lib":202,"../../plots/cartesian/axis_ids":249,"../../registry":293,"../scatter/xy_defaults":439,"./attributes":303,"./style_defaults":318}],308:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../lib":232,"../../plots/cartesian/constraints":284,"../../registry":324,"../scatter/period_defaults":465,"../scatter/xy_defaults":472,"./attributes":334,"./style_defaults":349}],339:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77585,7 +80380,7 @@ module.exports = function eventData(out, pt, trace) { return out; }; -},{}],309:[function(_dereq_,module,exports){ +},{}],340:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77663,7 +80458,7 @@ exports.getLineWidth = function(trace, di) { return w; }; -},{"../../lib":202,"fast-isnumeric":23,"tinycolor2":58}],310:[function(_dereq_,module,exports){ +},{"../../lib":232,"fast-isnumeric":23,"tinycolor2":87}],341:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77824,10 +80619,13 @@ function hoverOnBars(pointData, xval, yval, hovermode) { var extent = t.extents[t.extents.round(di.p)]; pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true); pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true); - pointData[posLetter + 'LabelVal'] = di.p; + + var hasPeriod = di.orig_p !== undefined; + pointData[posLetter + 'LabelVal'] = hasPeriod ? di.orig_p : di.p; pointData.labelLabel = hoverLabelText(pa, pointData[posLetter + 'LabelVal']); pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + 'LabelVal']); + pointData.baseLabel = hoverLabelText(sa, di.b); // spikelines always want "closest" distance regardless of hovermode pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 - maxHoverDistance; @@ -77856,7 +80654,7 @@ module.exports = { getTraceColor: getTraceColor }; -},{"../../components/color":75,"../../components/fx":115,"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"../../registry":293,"./helpers":309}],311:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/fx":144,"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/axes":277,"../../registry":324,"./helpers":340}],342:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77894,7 +80692,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"../scatter/marker_colorbar":431,"./arrays_to_calcdata":302,"./attributes":303,"./calc":304,"./cross_trace_calc":306,"./defaults":307,"./event_data":308,"./hover":310,"./layout_attributes":312,"./layout_defaults":313,"./plot":314,"./select":315,"./style":317}],312:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"../scatter/marker_colorbar":463,"./arrays_to_calcdata":333,"./attributes":334,"./calc":335,"./cross_trace_calc":337,"./defaults":338,"./event_data":339,"./hover":341,"./layout_attributes":343,"./layout_defaults":344,"./plot":345,"./select":346,"./style":348}],343:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77942,7 +80740,7 @@ module.exports = { } }; -},{}],313:[function(_dereq_,module,exports){ +},{}],344:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78002,7 +80800,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":202,"../../plots/cartesian/axes":246,"../../registry":293,"./layout_attributes":312}],314:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"../../registry":324,"./layout_attributes":343}],345:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78247,7 +81045,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback); sel .style('vector-effect', 'non-scaling-stroke') - .attr('d', isNaN((x1 - x0) * (y1 - y0)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') + .attr('d', (isNaN((x1 - x0) * (y1 - y0)) || (isBlank && gd._context.staticPlot)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') .call(Drawing.setClipUrl, plotinfo.layerClipId, gd); if(!fullLayout.uniformtext.mode && withTransition) { @@ -78787,7 +81585,7 @@ module.exports = { toMoveInsideBar: toMoveInsideBar }; -},{"../../components/color":75,"../../components/drawing":97,"../../components/fx/helpers":111,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/cartesian/axes":246,"../../registry":293,"./attributes":303,"./constants":305,"./helpers":309,"./style":317,"./uniform_text":319,"d3":21,"fast-isnumeric":23}],315:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/drawing":126,"../../components/fx/helpers":140,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/cartesian/axes":277,"../../registry":324,"./attributes":334,"./constants":336,"./helpers":340,"./style":348,"./uniform_text":350,"d3":21,"fast-isnumeric":23}],346:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78851,7 +81649,7 @@ function getCentroid(d, xa, ya, isHorizontal, isFunnel) { } } -},{}],316:[function(_dereq_,module,exports){ +},{}],347:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78965,7 +81763,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":181,"../../lib":202}],317:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232}],348:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79147,7 +81945,7 @@ module.exports = { resizeText: resizeText }; -},{"../../components/color":75,"../../components/drawing":97,"../../lib":202,"../../registry":293,"./attributes":303,"./helpers":309,"./uniform_text":319,"d3":21}],318:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/drawing":126,"../../lib":232,"../../registry":324,"./attributes":334,"./helpers":340,"./uniform_text":350,"d3":21}],349:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79185,7 +81983,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('unselected.marker.color'); }; -},{"../../components/color":75,"../../components/colorscale/defaults":85,"../../components/colorscale/helpers":86}],319:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/colorscale/defaults":114,"../../components/colorscale/helpers":115}],350:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79271,7 +82069,7 @@ module.exports = { resizeText: resizeText }; -},{"../../lib":202,"d3":21}],320:[function(_dereq_,module,exports){ +},{"../../lib":232,"d3":21}],351:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79328,6 +82126,13 @@ module.exports = { }, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + name: { valType: 'string', @@ -79567,7 +82372,7 @@ module.exports = { } }; -},{"../../components/color/attributes":74,"../../lib/extend":196,"../../plots/template_attributes":288,"../bar/attributes":303,"../scatter/attributes":413}],321:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":103,"../../lib/extend":226,"../../plots/template_attributes":319,"../bar/attributes":334,"../scatter/attributes":445}],352:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79581,6 +82386,7 @@ module.exports = { var isNumeric = _dereq_('fast-isnumeric'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -79599,19 +82405,24 @@ module.exports = function calc(gd, trace) { var valAxis, valLetter; var posAxis, posLetter; + var hasPeriod; if(trace.orientation === 'h') { valAxis = xa; valLetter = 'x'; posAxis = ya; posLetter = 'y'; + hasPeriod = !!trace.yperiodalignment; } else { valAxis = ya; valLetter = 'y'; posAxis = xa; posLetter = 'x'; + hasPeriod = !!trace.xperiodalignment; } - var posArray = getPos(trace, posLetter, posAxis, fullLayout[numKey]); + var allPosArrays = getPosArrays(trace, posLetter, posAxis, fullLayout[numKey]); + var posArray = allPosArrays[0]; + var origPos = allPosArrays[1]; var dv = Lib.distinctVals(posArray); var posDistinct = dv.vals; var dPos = dv.minDiff / 2; @@ -79647,6 +82458,9 @@ module.exports = function calc(gd, trace) { cdi = {}; cdi.pos = cdi[posLetter] = posi; + if(hasPeriod && origPos) { + cdi.orig_p = origPos[i]; // used by hover + } cdi.q1 = d2c('q1'); cdi.med = d2c('median'); @@ -79873,13 +82687,15 @@ module.exports = function calc(gd, trace) { // so if you want one box // per trace, set x0 (y0) to the x (y) value or category for this trace // (or set x (y) to a constant array matching y (x)) -function getPos(trace, posLetter, posAxis, num) { +function getPosArrays(trace, posLetter, posAxis, num) { var hasPosArray = posLetter in trace; var hasPos0 = posLetter + '0' in trace; var hasPosStep = 'd' + posLetter in trace; if(hasPosArray || (hasPos0 && hasPosStep)) { - return posAxis.makeCalcdata(trace, posLetter); + var origPos = posAxis.makeCalcdata(trace, posLetter); + var pos = alignPeriod(trace, posAxis, posLetter, origPos); + return [pos, origPos]; } var pos0; @@ -79907,7 +82723,7 @@ function getPos(trace, posLetter, posAxis, num) { var out = new Array(len); for(var i = 0; i < len; i++) out[i] = pos0c; - return out; + return [out]; } function makeBins(x, dx) { @@ -80010,7 +82826,7 @@ function computeNotchSpan(cdi, N) { return 1.57 * (cdi.q3 - cdi.q1) / Math.sqrt(N); } -},{"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"fast-isnumeric":23}],322:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/align_period":274,"../../plots/cartesian/axes":277,"fast-isnumeric":23}],353:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80023,7 +82839,7 @@ function computeNotchSpan(cdi, N) { var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var orientations = ['v', 'h']; @@ -80242,7 +83058,7 @@ module.exports = { setPositionOffset: setPositionOffset }; -},{"../../lib":202,"../../plots/cartesian/axes":246,"../../plots/cartesian/axis_ids":249}],323:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"../../plots/cartesian/constraints":284}],354:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80256,6 +83072,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var Registry = _dereq_('../../registry'); var Color = _dereq_('../../components/color'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var autoType = _dereq_('../../plots/cartesian/axis_autotype'); var attributes = _dereq_('./attributes'); @@ -80268,6 +83085,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { handleSampleDefaults(traceIn, traceOut, coerce, layout); if(traceOut.visible === false) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var hasPreCompStats = traceOut._hasPreCompStats; if(hasPreCompStats) { @@ -80351,6 +83170,11 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { var yLen = yDims && Lib.minRowLength(y); var xLen = xDims && Lib.minRowLength(x); + var calendar = layout.calendar; + var opts = { + autotypenumbers: layout.autotypenumbers + }; + var defaultOrientation, len; if(traceOut._hasPreCompStats) { switch(String(xDims) + String(yDims)) { @@ -80402,7 +83226,7 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { var hasCategories = false; var i; for(i = 0; i < x.length; i++) { - if(autoType(x[i]) === 'category') { + if(autoType(x[i], calendar, opts) === 'category') { hasCategories = true; break; } @@ -80413,7 +83237,7 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { len = Math.min(sLen, xLen, y.length); } else { for(i = 0; i < y.length; i++) { - if(autoType(y[i]) === 'category') { + if(autoType(y[i], calendar, opts) === 'category') { hasCategories = true; break; } @@ -80550,7 +83374,7 @@ module.exports = { handlePointsDefaults: handlePointsDefaults }; -},{"../../components/color":75,"../../lib":202,"../../plots/cartesian/axis_autotype":247,"../../registry":293,"../bar/defaults":307,"./attributes":320}],324:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../lib":232,"../../plots/cartesian/axis_autotype":278,"../../registry":324,"../bar/defaults":338,"../scatter/period_defaults":465,"./attributes":351}],355:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80575,7 +83399,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],325:[function(_dereq_,module,exports){ +},{}],356:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80721,7 +83545,7 @@ function hoverOnBoxes(pointData, xval, yval, hovermode) { pointData[pLetter + '0'] = pAxis.c2p(di.pos + t.bPos - boxDeltaNeg, true); pointData[pLetter + '1'] = pAxis.c2p(di.pos + t.bPos + boxDeltaPos, true); - pointData[pLetter + 'LabelVal'] = di.pos; + pointData[pLetter + 'LabelVal'] = di.orig_p !== undefined ? di.orig_p : di.pos; var spikePosAttr = pLetter + 'Spike'; pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; @@ -80835,14 +83659,16 @@ function hoverOnPoints(pointData, xval, yval) { hovertemplate: trace.hovertemplate }); + var origPos = di.orig_p; + var pos = origPos !== undefined ? origPos : di.pos; var pa; if(trace.orientation === 'h') { pa = ya; closePtData.xLabelVal = pt.x; - closePtData.yLabelVal = di.pos; + closePtData.yLabelVal = pos; } else { pa = xa; - closePtData.xLabelVal = di.pos; + closePtData.xLabelVal = pos; closePtData.yLabelVal = pt.y; } @@ -80860,7 +83686,7 @@ module.exports = { hoverOnPoints: hoverOnPoints }; -},{"../../components/color":75,"../../components/fx":115,"../../lib":202,"../../plots/cartesian/axes":246}],326:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/fx":144,"../../lib":232,"../../plots/cartesian/axes":277}],357:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80895,7 +83721,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"./attributes":320,"./calc":321,"./cross_trace_calc":322,"./defaults":323,"./event_data":324,"./hover":325,"./layout_attributes":327,"./layout_defaults":328,"./plot":329,"./select":330,"./style":331}],327:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"./attributes":351,"./calc":352,"./cross_trace_calc":353,"./defaults":354,"./event_data":355,"./hover":356,"./layout_attributes":358,"./layout_defaults":359,"./plot":360,"./select":361,"./style":362}],358:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80936,7 +83762,7 @@ module.exports = { } }; -},{}],328:[function(_dereq_,module,exports){ +},{}],359:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80982,7 +83808,7 @@ module.exports = { _supply: _supply }; -},{"../../lib":202,"../../registry":293,"./layout_attributes":327}],329:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324,"./layout_attributes":358}],360:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81332,7 +84158,7 @@ module.exports = { plotBoxMean: plotBoxMean }; -},{"../../components/drawing":97,"../../lib":202,"d3":21}],330:[function(_dereq_,module,exports){ +},{"../../components/drawing":126,"../../lib":232,"d3":21}],361:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81381,7 +84207,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],331:[function(_dereq_,module,exports){ +},{}],362:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81455,7 +84281,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/color":75,"../../components/drawing":97,"d3":21}],332:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/drawing":126,"d3":21}],363:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81489,6 +84315,14 @@ module.exports = extendFlat({ y: heatmapAttrs.y, y0: heatmapAttrs.y0, dy: heatmapAttrs.dy, + + xperiod: heatmapAttrs.xperiod, + yperiod: heatmapAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: heatmapAttrs.xperiodalignment, + yperiodalignment: heatmapAttrs.yperiodalignment, + text: heatmapAttrs.text, hovertext: heatmapAttrs.hovertext, transpose: heatmapAttrs.transpose, @@ -81642,7 +84476,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":82,"../../components/drawing/attributes":96,"../../constants/docs":178,"../../constants/filter_ops":179,"../../lib/extend":196,"../../plots/font_attributes":274,"../heatmap/attributes":354,"../scatter/attributes":413}],333:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":111,"../../components/drawing/attributes":125,"../../constants/docs":208,"../../constants/filter_ops":209,"../../lib/extend":226,"../../plots/font_attributes":305,"../heatmap/attributes":385,"../scatter/attributes":445}],364:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81695,7 +84529,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale":87,"../heatmap/calc":355,"./end_plus":343,"./set_contours":351}],334:[function(_dereq_,module,exports){ +},{"../../components/colorscale":116,"../heatmap/calc":386,"./end_plus":374,"./set_contours":382}],365:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81785,7 +84619,7 @@ module.exports = function(pathinfo, contours) { } }; -},{}],335:[function(_dereq_,module,exports){ +},{}],366:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81836,7 +84670,7 @@ module.exports = { calc: calc }; -},{"../../components/colorscale":87,"./end_plus":343,"./make_color_map":348}],336:[function(_dereq_,module,exports){ +},{"../../components/colorscale":116,"./end_plus":374,"./make_color_map":379}],367:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81914,7 +84748,7 @@ module.exports = { } }; -},{}],337:[function(_dereq_,module,exports){ +},{}],368:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82008,7 +84842,7 @@ function handleConstraintValueDefaults(coerce, contours) { } } -},{"../../components/color":75,"../../constants/filter_ops":179,"./label_defaults":347,"fast-isnumeric":23}],338:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../constants/filter_ops":209,"./label_defaults":378,"fast-isnumeric":23}],369:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82087,7 +84921,7 @@ function makeInequalitySettings(operation) { }; } -},{"../../constants/filter_ops":179,"fast-isnumeric":23}],339:[function(_dereq_,module,exports){ +},{"../../constants/filter_ops":209,"fast-isnumeric":23}],370:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82116,7 +84950,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce, coerc if(autoContour || !contourSize) coerce('ncontours'); }; -},{}],340:[function(_dereq_,module,exports){ +},{}],371:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82216,7 +85050,7 @@ function copyPathinfo(pi) { }); } -},{"../../lib":202}],341:[function(_dereq_,module,exports){ +},{"../../lib":232}],372:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82230,6 +85064,7 @@ function copyPathinfo(pi) { var Lib = _dereq_('../../lib'); var handleXYZDefaults = _dereq_('../heatmap/xyz_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleConstraintDefaults = _dereq_('./constraint_defaults'); var handleContoursDefaults = _dereq_('./contours_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); @@ -82251,6 +85086,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); @@ -82267,7 +85104,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../lib":202,"../heatmap/xyz_defaults":368,"./attributes":332,"./constraint_defaults":337,"./contours_defaults":339,"./style_defaults":353}],342:[function(_dereq_,module,exports){ +},{"../../lib":232,"../heatmap/xyz_defaults":399,"../scatter/period_defaults":465,"./attributes":363,"./constraint_defaults":368,"./contours_defaults":370,"./style_defaults":384}],373:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82331,7 +85168,7 @@ module.exports = function emptyPathinfo(contours, plotinfo, cd0) { return pathinfo; }; -},{"../../lib":202,"./constraint_mapping":338,"./end_plus":343}],343:[function(_dereq_,module,exports){ +},{"../../lib":232,"./constraint_mapping":369,"./end_plus":374}],374:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82351,7 +85188,7 @@ module.exports = function endPlus(contours) { return contours.end + contours.size / 1e6; }; -},{}],344:[function(_dereq_,module,exports){ +},{}],375:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82645,7 +85482,7 @@ function getInterpPx(pi, loc, step) { } } -},{"../../lib":202,"./constants":336}],345:[function(_dereq_,module,exports){ +},{"../../lib":232,"./constants":367}],376:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82680,7 +85517,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return hoverData; }; -},{"../../components/color":75,"../heatmap/hover":361}],346:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../heatmap/hover":392}],377:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82709,7 +85546,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"./attributes":332,"./calc":333,"./colorbar":335,"./defaults":341,"./hover":345,"./plot":350,"./style":352}],347:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"./attributes":363,"./calc":364,"./colorbar":366,"./defaults":372,"./hover":376,"./plot":381,"./style":383}],378:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82739,7 +85576,7 @@ module.exports = function handleLabelDefaults(coerce, layout, lineColor, opts) { if(opts.hasHover !== false) coerce('zhoverformat'); }; -},{"../../lib":202}],348:[function(_dereq_,module,exports){ +},{"../../lib":232}],379:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82823,7 +85660,7 @@ module.exports = function makeColorMap(trace) { ); }; -},{"../../components/colorscale":87,"./end_plus":343,"d3":21}],349:[function(_dereq_,module,exports){ +},{"../../components/colorscale":116,"./end_plus":374,"d3":21}],380:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82915,7 +85752,7 @@ function getMarchingIndex(val, corners) { return (mi === 15) ? 0 : mi; } -},{"./constants":336}],350:[function(_dereq_,module,exports){ +},{"./constants":367}],381:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83606,7 +86443,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/colorscale":87,"../../components/drawing":97,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/cartesian/axes":246,"../../plots/cartesian/set_convert":266,"../heatmap/plot":365,"./close_boundaries":334,"./constants":336,"./convert_to_constraints":340,"./empty_pathinfo":342,"./find_all_paths":344,"./make_crossings":349,"d3":21}],351:[function(_dereq_,module,exports){ +},{"../../components/colorscale":116,"../../components/drawing":126,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/cartesian/axes":277,"../../plots/cartesian/set_convert":297,"../heatmap/plot":396,"./close_boundaries":365,"./constants":367,"./convert_to_constraints":371,"./empty_pathinfo":373,"./find_all_paths":375,"./make_crossings":380,"d3":21}],382:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83710,7 +86547,7 @@ function autoContours(start, end, ncontours) { return dummyAx; } -},{"../../lib":202,"../../plots/cartesian/axes":246}],352:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277}],383:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83791,7 +86628,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":97,"../heatmap/style":366,"./make_color_map":348,"d3":21}],353:[function(_dereq_,module,exports){ +},{"../../components/drawing":126,"../heatmap/style":397,"./make_color_map":379,"d3":21}],384:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83836,7 +86673,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, handleLabelDefaults(coerce, layout, lineColor, opts); }; -},{"../../components/colorscale/defaults":85,"./label_defaults":347}],354:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":114,"./label_defaults":378}],385:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83868,6 +86705,13 @@ module.exports = extendFlat({ y0: extendFlat({}, scatterAttrs.y0, {impliedEdits: {ytype: 'scaled'}}), dy: extendFlat({}, scatterAttrs.dy, {impliedEdits: {ytype: 'scaled'}}), + xperiod: extendFlat({}, scatterAttrs.xperiod, {impliedEdits: {xtype: 'scaled'}}), + yperiod: extendFlat({}, scatterAttrs.yperiod, {impliedEdits: {ytype: 'scaled'}}), + xperiod0: extendFlat({}, scatterAttrs.xperiod0, {impliedEdits: {xtype: 'scaled'}}), + yperiod0: extendFlat({}, scatterAttrs.yperiod0, {impliedEdits: {ytype: 'scaled'}}), + xperiodalignment: extendFlat({}, scatterAttrs.xperiodalignment, {impliedEdits: {xtype: 'scaled'}}), + yperiodalignment: extendFlat({}, scatterAttrs.yperiodalignment, {impliedEdits: {ytype: 'scaled'}}), + text: { valType: 'data_array', editType: 'calc', @@ -83951,7 +86795,7 @@ module.exports = extendFlat({ colorScaleAttrs('', {cLetter: 'z', autoColorDflt: false}) ); -},{"../../components/colorscale/attributes":82,"../../constants/docs":178,"../../lib/extend":196,"../../plots/attributes":243,"../../plots/template_attributes":288,"../scatter/attributes":413}],355:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":111,"../../constants/docs":208,"../../lib/extend":226,"../../plots/attributes":273,"../../plots/template_attributes":319,"../scatter/attributes":445}],386:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83965,6 +86809,7 @@ module.exports = extendFlat({ var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var histogram2dCalc = _dereq_('../histogram2d/calc'); var colorscaleCalc = _dereq_('../../components/colorscale/calc'); @@ -83984,15 +86829,9 @@ module.exports = function calc(gd, trace) { var isHist = Registry.traceIs(trace, 'histogram'); var isGL2D = Registry.traceIs(trace, 'gl2d'); var zsmooth = isContour ? 'best' : trace.zsmooth; - var x; - var x0; - var dx; - var y; - var y0; - var dy; - var z; - var i; - var binned; + var x, x0, dx, origX; + var y, y0, dy, origY; + var z, i, binned; // cancel minimum tick spacings (only applies to bars and boxes) xa._minDtick = 0; @@ -84000,12 +86839,16 @@ module.exports = function calc(gd, trace) { if(isHist) { binned = histogram2dCalc(gd, trace); + origX = binned.orig_x; x = binned.x; x0 = binned.x0; dx = binned.dx; + + origY = binned.orig_y; y = binned.y; y0 = binned.y0; dy = binned.dy; + z = binned.z; } else { var zIn = trace.z; @@ -84015,8 +86858,12 @@ module.exports = function calc(gd, trace) { y = trace._y; zIn = trace._z; } else { - x = trace._x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace._y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + origX = trace.x ? xa.makeCalcdata(trace, 'x') : []; + origY = trace.y ? ya.makeCalcdata(trace, 'y') : []; + x = alignPeriod(trace, xa, 'x', origX); + y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; } x0 = trace.x0; @@ -84098,6 +86945,13 @@ module.exports = function calc(gd, trace) { hovertext: trace._hovertext || trace.hovertext }; + if(trace.xperiodalignment && origX) { + cd0.orig_x = origX; + } + if(trace.yperiodalignment && origY) { + cd0.orig_y = origY; + } + if(xIn && xIn.length === xArray.length - 1) cd0.xCenter = xIn; if(yIn && yIn.length === yArray.length - 1) cd0.yCenter = yIn; @@ -84150,7 +87004,7 @@ function dropZonBreaks(x, y, z) { return newZ; } -},{"../../components/colorscale/calc":83,"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"../../registry":293,"../histogram2d/calc":383,"./clean_2d_array":356,"./convert_column_xyz":358,"./find_empties":360,"./interp2d":363,"./make_bound_array":364}],356:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":112,"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/align_period":274,"../../plots/cartesian/axes":277,"../../registry":324,"../histogram2d/calc":414,"./clean_2d_array":387,"./convert_column_xyz":389,"./find_empties":391,"./interp2d":394,"./make_bound_array":395}],387:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84227,7 +87081,7 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) { return zNew; }; -},{"../../constants/numerical":181,"../../lib":202,"fast-isnumeric":23}],357:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"fast-isnumeric":23}],388:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84243,7 +87097,7 @@ module.exports = { max: 'zmax' }; -},{}],358:[function(_dereq_,module,exports){ +},{}],389:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84257,11 +87111,15 @@ module.exports = { var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, arrayVarNames) { var colLen = trace._length; var col1 = ax1.makeCalcdata(trace, var1Name); var col2 = ax2.makeCalcdata(trace, var2Name); + col1 = alignPeriod(trace, ax1, var1Name, col1); + col2 = alignPeriod(trace, ax2, var2Name, col2); + var textCol = trace.text; var hasColumnText = (textCol !== undefined && Lib.isArray1D(textCol)); var hoverTextCol = trace.hovertext; @@ -84329,7 +87187,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, trace._after2before = after2before; }; -},{"../../constants/numerical":181,"../../lib":202}],359:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/align_period":274}],390:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84344,6 +87202,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, var Lib = _dereq_('../../lib'); var handleXYZDefaults = _dereq_('./xyz_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); var attributes = _dereq_('./attributes'); @@ -84360,6 +87219,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); @@ -84372,7 +87233,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":85,"../../lib":202,"./attributes":354,"./style_defaults":367,"./xyz_defaults":368}],360:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":114,"../../lib":232,"../scatter/period_defaults":465,"./attributes":385,"./style_defaults":398,"./xyz_defaults":399}],391:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84477,7 +87338,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"../../lib":202}],361:[function(_dereq_,module,exports){ +},{"../../lib":232}],392:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84550,14 +87411,21 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay var y0 = ya.c2p(y[ny]); var y1 = ya.c2p(y[ny + 1]); + var _x, _y; if(contour) { + _x = cd0.orig_x || x; + _y = cd0.orig_y || y; + x1 = x0; - xl = x[nx]; + xl = _x[nx]; y1 = y0; - yl = y[ny]; + yl = _y[ny]; } else { - xl = xc ? xc[nx] : ((x[nx] + x[nx + 1]) / 2); - yl = yc ? yc[ny] : ((y[ny] + y[ny + 1]) / 2); + _x = cd0.orig_x || xc || x; + _y = cd0.orig_y || yc || y; + + xl = xc ? _x[nx] : ((_x[nx] + _x[nx + 1]) / 2); + yl = yc ? _y[ny] : ((_y[ny] + _y[ny + 1]) / 2); if(xa && xa.type === 'category') xl = x[nx]; if(ya && ya.type === 'category') yl = y[ny]; @@ -84608,7 +87476,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay })]; }; -},{"../../components/colorscale":87,"../../components/fx":115,"../../lib":202,"../../plots/cartesian/axes":246}],362:[function(_dereq_,module,exports){ +},{"../../components/colorscale":116,"../../components/fx":144,"../../lib":232,"../../plots/cartesian/axes":277}],393:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84637,7 +87505,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"./attributes":354,"./calc":355,"./colorbar":357,"./defaults":359,"./hover":361,"./plot":365,"./style":366}],363:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"./attributes":385,"./calc":386,"./colorbar":388,"./defaults":390,"./hover":392,"./plot":396,"./style":397}],394:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84770,7 +87638,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":202}],364:[function(_dereq_,module,exports){ +},{"../../lib":232}],395:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84858,7 +87726,7 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, return arrayOut; }; -},{"../../lib":202,"../../registry":293}],365:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324}],396:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85263,7 +88131,7 @@ function putColor(pixels, pxIndex, c) { pixels[pxIndex + 3] = Math.round(c[3] * 255); } -},{"../../components/colorscale":87,"../../constants/xmlns_namespaces":182,"../../lib":202,"../../registry":293,"d3":21,"tinycolor2":58}],366:[function(_dereq_,module,exports){ +},{"../../components/colorscale":116,"../../constants/xmlns_namespaces":212,"../../lib":232,"../../registry":324,"d3":21,"tinycolor2":87}],397:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85284,7 +88152,7 @@ module.exports = function style(gd) { }); }; -},{"d3":21}],367:[function(_dereq_,module,exports){ +},{"d3":21}],398:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85307,7 +88175,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce) { coerce('zhoverformat'); }; -},{}],368:[function(_dereq_,module,exports){ +},{}],399:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85409,7 +88277,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../lib":202,"../../registry":293,"fast-isnumeric":23}],369:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324,"fast-isnumeric":23}],400:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85550,7 +88418,7 @@ module.exports = { } }; -},{"../../lib/extend":196,"../../plots/template_attributes":288,"../bar/attributes":303,"./bin_attributes":371,"./constants":375}],370:[function(_dereq_,module,exports){ +},{"../../lib/extend":226,"../../plots/template_attributes":319,"../bar/attributes":334,"./bin_attributes":402,"./constants":406}],401:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85575,7 +88443,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],371:[function(_dereq_,module,exports){ +},{}],402:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85610,7 +88478,7 @@ module.exports = function makeBinAttrs(axLetter, match) { }; }; -},{}],372:[function(_dereq_,module,exports){ +},{}],403:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85684,7 +88552,7 @@ module.exports = { } }; -},{"fast-isnumeric":23}],373:[function(_dereq_,module,exports){ +},{"fast-isnumeric":23}],404:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85860,7 +88728,7 @@ function dateParts(v, pa, calendar) { return parts; } -},{"../../constants/numerical":181,"../../plots/cartesian/axes":246}],374:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../plots/cartesian/axes":277}],405:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86439,7 +89307,7 @@ module.exports = { calcAllAutoBins: calcAllAutoBins }; -},{"../../lib":202,"../../plots/cartesian/axes":246,"../../registry":293,"../bar/arrays_to_calcdata":302,"./average":370,"./bin_functions":372,"./bin_label_vals":373,"./norm_functions":381,"fast-isnumeric":23}],375:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"../../registry":324,"../bar/arrays_to_calcdata":333,"./average":401,"./bin_functions":403,"./bin_label_vals":404,"./norm_functions":412,"fast-isnumeric":23}],406:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86455,7 +89323,7 @@ module.exports = { eventDataKeys: ['binNumber'] }; -},{}],376:[function(_dereq_,module,exports){ +},{}],407:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86473,7 +89341,7 @@ var traceIs = _dereq_('../../registry').traceIs; var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var nestedProperty = Lib.nestedProperty; -var getAxisGroup = axisIds.getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var BINATTRS = [ {aStr: {x: 'xbins.start', y: 'ybins.start'}, name: 'start'}, @@ -86632,10 +89500,9 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } var binGroupFound = false; - for(i = 0; i < traces.length; i++) { - traceOut = traces[i]; + if(traces.length) { + traceOut = traces[0]; binGroupFound = coerce('bingroup'); - break; } groupName = binGroupFound || groupName; @@ -86733,7 +89600,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":202,"../../plots/cartesian/axis_ids":249,"../../registry":293,"../bar/defaults":307}],377:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axis_ids":280,"../../plots/cartesian/constraints":284,"../../registry":324,"../bar/defaults":338}],408:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86807,7 +89674,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":75,"../../lib":202,"../../registry":293,"../bar/style_defaults":318,"./attributes":369}],378:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../lib":232,"../../registry":324,"../bar/style_defaults":349,"./attributes":400}],409:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86856,7 +89723,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],379:[function(_dereq_,module,exports){ +},{}],410:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86889,7 +89756,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return pts; }; -},{"../../plots/cartesian/axes":246,"../bar/hover":310}],380:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":277,"../bar/hover":341}],411:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86939,7 +89806,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"../bar/cross_trace_calc":306,"../bar/layout_attributes":312,"../bar/layout_defaults":313,"../bar/plot":314,"../bar/select":315,"../bar/style":317,"../scatter/marker_colorbar":431,"./attributes":369,"./calc":374,"./cross_trace_defaults":376,"./defaults":377,"./event_data":378,"./hover":379}],381:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"../bar/cross_trace_calc":337,"../bar/layout_attributes":343,"../bar/layout_defaults":344,"../bar/plot":345,"../bar/select":346,"../bar/style":348,"../scatter/marker_colorbar":463,"./attributes":400,"./calc":405,"./cross_trace_defaults":407,"./defaults":408,"./event_data":409,"./hover":410}],412:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86974,7 +89841,7 @@ module.exports = { } }; -},{}],382:[function(_dereq_,module,exports){ +},{}],413:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87042,7 +89909,7 @@ module.exports = extendFlat( colorScaleAttrs('', {cLetter: 'z', autoColorDflt: false}) ); -},{"../../components/colorscale/attributes":82,"../../lib/extend":196,"../../plots/attributes":243,"../../plots/template_attributes":288,"../heatmap/attributes":354,"../histogram/attributes":369,"../histogram/bin_attributes":371}],383:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":111,"../../lib/extend":226,"../../plots/attributes":273,"../../plots/template_attributes":319,"../heatmap/attributes":385,"../histogram/attributes":400,"../histogram/bin_attributes":402}],414:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87261,7 +90128,7 @@ function getRanges(edges, uniqueVals, gapLow, gapHigh, ax, calendar) { return out; } -},{"../../lib":202,"../../plots/cartesian/axes":246,"../histogram/average":370,"../histogram/bin_functions":372,"../histogram/bin_label_vals":373,"../histogram/calc":374,"../histogram/norm_functions":381}],384:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"../histogram/average":401,"../histogram/bin_functions":403,"../histogram/bin_label_vals":404,"../histogram/calc":405,"../histogram/norm_functions":412}],415:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87294,7 +90161,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hovertemplate'); }; -},{"../../components/colorscale/defaults":85,"../../lib":202,"../heatmap/style_defaults":367,"./attributes":382,"./sample_defaults":387}],385:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":114,"../../lib":232,"../heatmap/style_defaults":398,"./attributes":413,"./sample_defaults":418}],416:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87328,7 +90195,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return pts; }; -},{"../../plots/cartesian/axes":246,"../heatmap/hover":361}],386:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":277,"../heatmap/hover":392}],417:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87361,7 +90228,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"../heatmap/calc":355,"../heatmap/colorbar":357,"../heatmap/plot":365,"../heatmap/style":366,"../histogram/cross_trace_defaults":376,"../histogram/event_data":378,"./attributes":382,"./defaults":384,"./hover":385}],387:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"../heatmap/calc":386,"../heatmap/colorbar":388,"../heatmap/plot":396,"../heatmap/style":397,"../histogram/cross_trace_defaults":407,"../histogram/event_data":409,"./attributes":413,"./defaults":415,"./hover":416}],418:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87406,7 +90273,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout coerce('autobiny'); }; -},{"../../lib":202,"../../registry":293}],388:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324}],419:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87464,7 +90331,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":82,"../../lib/extend":196,"../contour/attributes":332,"../histogram2d/attributes":382}],389:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":111,"../../lib/extend":226,"../contour/attributes":363,"../histogram2d/attributes":413}],420:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87501,7 +90368,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hovertemplate'); }; -},{"../../lib":202,"../contour/contours_defaults":339,"../contour/style_defaults":353,"../histogram2d/sample_defaults":387,"./attributes":388}],390:[function(_dereq_,module,exports){ +},{"../../lib":232,"../contour/contours_defaults":370,"../contour/style_defaults":384,"../histogram2d/sample_defaults":418,"./attributes":419}],421:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87533,7 +90400,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"../contour/calc":333,"../contour/colorbar":335,"../contour/hover":345,"../contour/plot":350,"../contour/style":352,"../histogram/cross_trace_defaults":376,"./attributes":388,"./defaults":389}],391:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"../contour/calc":364,"../contour/colorbar":366,"../contour/hover":376,"../contour/plot":381,"../contour/style":383,"../histogram/cross_trace_defaults":407,"./attributes":419,"./defaults":420}],422:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87651,7 +90518,7 @@ module.exports = extendFlat({ transforms: undefined }); -},{"../../lib/extend":196,"../../plots/attributes":243,"../../plots/template_attributes":288,"./constants":393}],392:[function(_dereq_,module,exports){ +},{"../../lib/extend":226,"../../plots/attributes":273,"../../plots/template_attributes":319,"./constants":424}],423:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87667,9 +90534,7 @@ var constants = _dereq_('./constants'); var isNumeric = _dereq_('fast-isnumeric'); var Axes = _dereq_('../../plots/cartesian/axes'); var maxRowLength = _dereq_('../../lib').maxRowLength; -var sizeOf = _dereq_('image-size'); -var dataUri = _dereq_('../../snapshot/helpers').IMAGE_URL_PREFIX; -var Buffer = _dereq_('buffer/').Buffer; // note: the trailing slash is important! +var getImageSize = _dereq_('./helpers').getImageSize; module.exports = function calc(gd, trace) { var h; @@ -87751,14 +90616,7 @@ function makeScaler(trace) { }; } -// Get image size -function getImageSize(src) { - var data = src.replace(dataUri, ''); - var buff = new Buffer(data, 'base64'); - return sizeOf(buff); -} - -},{"../../lib":202,"../../plots/cartesian/axes":246,"../../snapshot/helpers":297,"./constants":393,"buffer/":18,"fast-isnumeric":23,"image-size":29}],393:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"./constants":424,"./helpers":427,"fast-isnumeric":23}],424:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87819,7 +90677,7 @@ module.exports = { } }; -},{}],394:[function(_dereq_,module,exports){ +},{}],425:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87876,7 +90734,7 @@ module.exports = function supplyDefaults(traceIn, traceOut) { traceOut._length = null; }; -},{"../../lib":202,"../../snapshot/helpers":297,"./attributes":391,"./constants":393}],395:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../snapshot/helpers":328,"./attributes":422,"./constants":424}],426:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87898,7 +90756,28 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],396:[function(_dereq_,module,exports){ +},{}],427:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var sizeOf = _dereq_('image-size'); +var dataUri = _dereq_('../../snapshot/helpers').IMAGE_URL_PREFIX; +var Buffer = _dereq_('buffer/').Buffer; // note: the trailing slash is important! + +exports.getImageSize = function(src) { + var data = src.replace(dataUri, ''); + var buff = new Buffer(data, 'base64'); + return sizeOf(buff); +}; + +},{"../../snapshot/helpers":328,"buffer/":18,"image-size":58}],428:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87998,7 +90877,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { })]; }; -},{"../../components/fx":115,"../../lib":202,"./constants":393}],397:[function(_dereq_,module,exports){ +},{"../../components/fx":144,"../../lib":232,"./constants":424}],429:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88028,7 +90907,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"./attributes":391,"./calc":392,"./defaults":394,"./event_data":395,"./hover":396,"./plot":398,"./style":399}],398:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"./attributes":422,"./calc":423,"./defaults":425,"./event_data":426,"./hover":428,"./plot":430,"./style":431}],430:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88041,17 +90920,12 @@ module.exports = { var d3 = _dereq_('d3'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); var constants = _dereq_('./constants'); var unsupportedBrowsers = Lib.isIOS() || Lib.isSafari() || Lib.isIE(); -function compatibleAxis(ax) { - return ax.type === 'linear' && - // y axis must be reversed but x axis mustn't be - ((ax.range[1] > ax.range[0]) === (ax._id.charAt(0) === 'x')); -} - module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { var xa = plotinfo.xaxis; var ya = plotinfo.yaxis; @@ -88062,7 +90936,7 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { var plotGroup = d3.select(this); var cd0 = cd[0]; var trace = cd0.trace; - var fastImage = supportsPixelatedImage && !trace._hasZ && trace._hasSource && compatibleAxis(xa) && compatibleAxis(ya); + var fastImage = supportsPixelatedImage && !trace._hasZ && trace._hasSource && xa.type === 'linear' && ya.type === 'linear'; trace._fastImage = fastImage; var z = cd0.z; @@ -88175,8 +91049,23 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { // Pixelated image rendering // http://phrogz.net/tmp/canvas_image_zoom.html // https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering - image3 - .attr('style', 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;'); + var style = 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;'; + if(fastImage) { + var xRange = Lib.simpleMap(xa.range, xa.r2l); + var yRange = Lib.simpleMap(ya.range, ya.r2l); + + var flipX = xRange[1] < xRange[0]; + var flipY = yRange[1] > yRange[0]; + if(flipX || flipY) { + var tx = left + imageWidth / 2; + var ty = top + imageHeight / 2; + style += 'transform:' + + strTranslate(tx + 'px', ty + 'px') + + 'scale(' + (flipX ? -1 : 1) + ',' + (flipY ? -1 : 1) + ')' + + strTranslate(-tx + 'px', -ty + 'px') + ';'; + } + } + image3.attr('style', style); var p = new Promise(function(resolve) { if(trace._hasZ) { @@ -88248,7 +91137,7 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { }); }; -},{"../../constants/xmlns_namespaces":182,"../../lib":202,"./constants":393,"d3":21}],399:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":212,"../../lib":232,"./constants":424,"d3":21}],431:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88268,7 +91157,7 @@ module.exports = function style(gd) { }); }; -},{"d3":21}],400:[function(_dereq_,module,exports){ +},{"d3":21}],432:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88539,7 +91428,7 @@ module.exports = { } }; -},{"../../components/color/attributes":74,"../../lib/extend":196,"../../plots/attributes":243,"../../plots/domain":273,"../../plots/font_attributes":274,"../../plots/template_attributes":288}],401:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":103,"../../lib/extend":226,"../../plots/attributes":273,"../../plots/domain":304,"../../plots/font_attributes":305,"../../plots/template_attributes":319}],433:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88562,7 +91451,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":280}],402:[function(_dereq_,module,exports){ +},{"../../plots/plots":311}],434:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88745,7 +91634,7 @@ module.exports = { generateExtendedColors: generateExtendedColors }; -},{"../../components/color":75,"fast-isnumeric":23,"tinycolor2":58}],403:[function(_dereq_,module,exports){ +},{"../../components/color":104,"fast-isnumeric":23,"tinycolor2":87}],435:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88876,7 +91765,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":202,"../../plots/domain":273,"../bar/defaults":307,"./attributes":400,"fast-isnumeric":23}],404:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/domain":304,"../bar/defaults":338,"./attributes":432,"fast-isnumeric":23}],436:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88925,7 +91814,7 @@ module.exports = function eventData(pt, trace) { return out; }; -},{"../../components/fx/helpers":111}],405:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":140}],437:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88938,19 +91827,21 @@ module.exports = function eventData(pt, trace) { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -88967,7 +91858,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":202}],406:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":232}],438:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89000,7 +91895,7 @@ module.exports = { } }; -},{"./attributes":400,"./base_plot":401,"./calc":402,"./defaults":403,"./layout_attributes":407,"./layout_defaults":408,"./plot":409,"./style":410,"./style_one":411}],407:[function(_dereq_,module,exports){ +},{"./attributes":432,"./base_plot":433,"./calc":434,"./defaults":435,"./layout_attributes":439,"./layout_defaults":440,"./plot":441,"./style":442,"./style_one":443}],439:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89033,7 +91928,7 @@ module.exports = { } }; -},{}],408:[function(_dereq_,module,exports){ +},{}],440:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89058,7 +91953,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendpiecolors'); }; -},{"../../lib":202,"./layout_attributes":407}],409:[function(_dereq_,module,exports){ +},{"../../lib":232,"./layout_attributes":439}],441:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89076,6 +91971,8 @@ var Fx = _dereq_('../../components/fx'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var uniformText = _dereq_('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; @@ -89305,9 +92202,9 @@ function plot(gd, cdModule) { } titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); // now make sure no labels overlap (at least within one pie) @@ -90106,7 +93003,7 @@ function setCoords(cd) { var cd0 = cd[0]; var r = cd0.r; var trace = cd0.trace; - var currentAngle = trace.rotation * Math.PI / 180; + var currentAngle = helpers.getRotationAngle(trace.rotation); var angleFactor = 2 * Math.PI / cd0.vTotal; var firstPt = 'px0'; var lastPt = 'px1'; @@ -90236,7 +93133,7 @@ module.exports = { computeTransform: computeTransform }; -},{"../../components/color":75,"../../components/drawing":97,"../../components/fx":115,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/plots":280,"../bar/constants":305,"../bar/uniform_text":319,"./event_data":404,"./helpers":405,"d3":21}],410:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/drawing":126,"../../components/fx":144,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/plots":311,"../bar/constants":336,"../bar/uniform_text":350,"./event_data":436,"./helpers":437,"d3":21}],442:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90269,7 +93166,7 @@ module.exports = function style(gd) { }); }; -},{"../bar/uniform_text":319,"./style_one":411,"d3":21}],411:[function(_dereq_,module,exports){ +},{"../bar/uniform_text":350,"./style_one":443,"d3":21}],443:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90293,7 +93190,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":75,"./helpers":405}],412:[function(_dereq_,module,exports){ +},{"../../components/color":104,"./helpers":437}],444:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90345,7 +93242,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":202}],413:[function(_dereq_,module,exports){ +},{"../../lib":232}],445:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90364,8 +93261,41 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + + editType: 'calc', + + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + + editType: 'calc', + + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + + editType: 'calc', + + }; +} + module.exports = { x: { valType: 'data_array', @@ -90412,6 +93342,13 @@ module.exports = { }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', @@ -90759,7 +93696,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":82,"../../components/drawing":97,"../../components/drawing/attributes":96,"../../lib/extend":196,"../../plots/font_attributes":274,"../../plots/template_attributes":288,"./constants":417}],414:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":111,"../../components/drawing":126,"../../components/drawing/attributes":125,"../../lib/extend":226,"../../plots/font_attributes":305,"../../plots/template_attributes":319,"./constants":449}],446:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90774,6 +93711,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -90785,8 +93723,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -90817,6 +93758,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -90824,6 +93768,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -91044,7 +93995,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"./arrays_to_calcdata":412,"./calc_selection":415,"./colorscale_calc":416,"./subtypes":437,"fast-isnumeric":23}],415:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/align_period":274,"../../plots/cartesian/axes":277,"./arrays_to_calcdata":444,"./calc_selection":447,"./colorscale_calc":448,"./subtypes":470,"fast-isnumeric":23}],447:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91063,7 +94014,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":202}],416:[function(_dereq_,module,exports){ +},{"../../lib":232}],448:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91106,7 +94057,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":83,"../../components/colorscale/helpers":86,"./subtypes":437}],417:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":112,"../../components/colorscale/helpers":115,"./subtypes":470}],449:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91135,7 +94086,7 @@ module.exports = { eventDataKeys: [] }; -},{}],418:[function(_dereq_,module,exports){ +},{}],450:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91316,7 +94267,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":414}],419:[function(_dereq_,module,exports){ +},{"./calc":446}],451:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91355,7 +94306,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],420:[function(_dereq_,module,exports){ +},{}],452:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91373,6 +94324,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -91390,6 +94342,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -91445,7 +94399,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":202,"../../registry":293,"./attributes":413,"./constants":417,"./fillcolor_defaults":421,"./line_defaults":426,"./line_shape_defaults":428,"./marker_defaults":432,"./stack_defaults":435,"./subtypes":437,"./text_defaults":438,"./xy_defaults":439}],421:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324,"./attributes":445,"./constants":449,"./fillcolor_defaults":453,"./line_defaults":458,"./line_shape_defaults":460,"./marker_defaults":464,"./period_defaults":465,"./stack_defaults":468,"./subtypes":470,"./text_defaults":471,"./xy_defaults":472}],453:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91482,7 +94436,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":75,"../../lib":202}],422:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../lib":232}],454:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91508,7 +94462,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":246}],423:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":277}],455:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91557,7 +94511,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":75,"./subtypes":437}],424:[function(_dereq_,module,exports){ +},{"../../components/color":104,"./subtypes":470}],456:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91638,8 +94592,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -91752,7 +94706,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":75,"../../components/fx":115,"../../lib":202,"../../registry":293,"./get_trace_color":423}],425:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/fx":144,"../../lib":232,"../../registry":324,"./get_trace_color":455}],457:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91798,7 +94752,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"./arrays_to_calcdata":412,"./attributes":413,"./calc":414,"./cross_trace_calc":418,"./cross_trace_defaults":419,"./defaults":420,"./format_labels":422,"./hover":424,"./marker_colorbar":431,"./plot":433,"./select":434,"./style":436,"./subtypes":437}],426:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"./arrays_to_calcdata":444,"./attributes":445,"./calc":446,"./cross_trace_calc":450,"./cross_trace_defaults":451,"./defaults":452,"./format_labels":454,"./hover":456,"./marker_colorbar":463,"./plot":466,"./select":467,"./style":469,"./subtypes":470}],458:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91829,7 +94783,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":85,"../../components/colorscale/helpers":86,"../../lib":202}],427:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":114,"../../components/colorscale/helpers":115,"../../lib":232}],459:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92290,7 +95244,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":181,"../../lib":202,"./constants":417}],428:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"./constants":449}],460:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92309,7 +95263,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],429:[function(_dereq_,module,exports){ +},{}],461:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92399,7 +95353,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],430:[function(_dereq_,module,exports){ +},{}],462:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92441,7 +95395,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":23}],431:[function(_dereq_,module,exports){ +},{"fast-isnumeric":23}],463:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92459,7 +95413,7 @@ module.exports = { max: 'cmax' }; -},{}],432:[function(_dereq_,module,exports){ +},{}],464:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92540,7 +95494,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":75,"../../components/colorscale/defaults":85,"../../components/colorscale/helpers":86,"./subtypes":437}],433:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../components/colorscale/defaults":114,"../../components/colorscale/helpers":115,"./subtypes":470}],465:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":211,"../../lib":232}],466:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93101,7 +96102,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":97,"../../lib":202,"../../lib/polygon":214,"../../registry":293,"./line_points":427,"./link_traces":429,"./subtypes":437,"d3":21}],434:[function(_dereq_,module,exports){ +},{"../../components/drawing":126,"../../lib":232,"../../lib/polygon":244,"../../registry":324,"./line_points":459,"./link_traces":461,"./subtypes":470,"d3":21}],467:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93155,7 +96156,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":437}],435:[function(_dereq_,module,exports){ +},{"./subtypes":470}],468:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93260,7 +96261,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],436:[function(_dereq_,module,exports){ +},{}],469:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93331,7 +96332,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":97,"../../registry":293,"d3":21}],437:[function(_dereq_,module,exports){ +},{"../../components/drawing":126,"../../registry":324,"d3":21}],470:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93370,7 +96371,7 @@ module.exports = { } }; -},{"../../lib":202}],438:[function(_dereq_,module,exports){ +},{"../../lib":232}],471:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93400,7 +96401,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":202}],439:[function(_dereq_,module,exports){ +},{"../../lib":232}],472:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93444,7 +96445,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":202,"../../registry":293}],440:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../registry":324}],473:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93552,7 +96553,7 @@ module.exports = { hovertemplate: hovertemplateAttrs(), }; -},{"../../components/colorscale/attributes":82,"../../components/drawing/attributes":96,"../../lib/extend":196,"../../plots/attributes":243,"../../plots/template_attributes":288,"../scatter/attributes":413}],441:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":111,"../../components/drawing/attributes":125,"../../lib/extend":226,"../../plots/attributes":273,"../../plots/template_attributes":319,"../scatter/attributes":445}],474:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93633,7 +96634,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":412,"../scatter/calc":414,"../scatter/calc_selection":415,"../scatter/colorscale_calc":416,"fast-isnumeric":23}],442:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":444,"../scatter/calc":446,"../scatter/calc_selection":447,"../scatter/colorscale_calc":448,"fast-isnumeric":23}],475:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93737,7 +96738,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":202,"../scatter/constants":417,"../scatter/fillcolor_defaults":421,"../scatter/line_defaults":426,"../scatter/line_shape_defaults":428,"../scatter/marker_defaults":432,"../scatter/subtypes":437,"../scatter/text_defaults":438,"./attributes":440}],443:[function(_dereq_,module,exports){ +},{"../../lib":232,"../scatter/constants":449,"../scatter/fillcolor_defaults":453,"../scatter/line_defaults":458,"../scatter/line_shape_defaults":460,"../scatter/marker_defaults":464,"../scatter/subtypes":470,"../scatter/text_defaults":471,"./attributes":473}],476:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93769,7 +96770,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],444:[function(_dereq_,module,exports){ +},{}],477:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93793,7 +96794,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":246}],445:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":277}],478:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93867,7 +96868,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../scatter/hover":424}],446:[function(_dereq_,module,exports){ +},{"../scatter/hover":456}],479:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93901,7 +96902,7 @@ module.exports = { } }; -},{"../../plots/ternary":289,"../scatter/marker_colorbar":431,"../scatter/select":434,"../scatter/style":436,"./attributes":440,"./calc":441,"./defaults":442,"./event_data":443,"./format_labels":444,"./hover":445,"./plot":447}],447:[function(_dereq_,module,exports){ +},{"../../plots/ternary":320,"../scatter/marker_colorbar":463,"../scatter/select":467,"../scatter/style":469,"./attributes":473,"./calc":474,"./defaults":475,"./event_data":476,"./format_labels":477,"./hover":478,"./plot":480}],480:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93934,7 +96935,7 @@ module.exports = function plot(gd, ternary, moduleCalcData) { scatterPlot(gd, plotinfo, moduleCalcData, scatterLayer); }; -},{"../scatter/plot":433}],448:[function(_dereq_,module,exports){ +},{"../scatter/plot":466}],481:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93953,6 +96954,7 @@ module.exports = { x: boxAttrs.x, x0: boxAttrs.x0, y0: boxAttrs.y0, + name: extendFlat({}, boxAttrs.name, { }), @@ -94133,7 +97135,7 @@ module.exports = { } }; -},{"../../lib/extend":196,"../box/attributes":320}],449:[function(_dereq_,module,exports){ +},{"../../lib/extend":226,"../box/attributes":351}],482:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94309,7 +97311,7 @@ function calcSpan(trace, cdi, valAxis, bandwidth) { return spanOut; } -},{"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"../box/calc":321,"./helpers":452}],450:[function(_dereq_,module,exports){ +},{"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/axes":277,"../box/calc":352,"./helpers":485}],483:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94352,7 +97354,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../box/cross_trace_calc":322}],451:[function(_dereq_,module,exports){ +},{"../box/cross_trace_calc":353}],484:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94413,7 +97415,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!meanLineVisible) traceOut.meanline = {visible: false}; }; -},{"../../components/color":75,"../../lib":202,"../box/defaults":323,"./attributes":448}],452:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../../lib":232,"../box/defaults":354,"./attributes":481}],485:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94486,7 +97488,7 @@ exports.getKdeValue = function(calcItem, trace, valueDist) { exports.extractVal = function(o) { return o.v; }; -},{"../../lib":202}],453:[function(_dereq_,module,exports){ +},{"../../lib":232}],486:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94598,7 +97600,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return closeData; }; -},{"../../lib":202,"../../plots/cartesian/axes":246,"../box/hover":325,"./helpers":452}],454:[function(_dereq_,module,exports){ +},{"../../lib":232,"../../plots/cartesian/axes":277,"../box/hover":356,"./helpers":485}],487:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94632,7 +97634,7 @@ module.exports = { } }; -},{"../../plots/cartesian":259,"../box/defaults":323,"../box/select":330,"../scatter/style":436,"./attributes":448,"./calc":449,"./cross_trace_calc":450,"./defaults":451,"./hover":453,"./layout_attributes":455,"./layout_defaults":456,"./plot":457,"./style":458}],455:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":290,"../box/defaults":354,"../box/select":361,"../scatter/style":469,"./attributes":481,"./calc":482,"./cross_trace_calc":483,"./defaults":484,"./hover":486,"./layout_attributes":488,"./layout_defaults":489,"./plot":490,"./style":491}],488:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94658,7 +97660,7 @@ module.exports = { }) }; -},{"../../lib":202,"../box/layout_attributes":327}],456:[function(_dereq_,module,exports){ +},{"../../lib":232,"../box/layout_attributes":358}],489:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94680,7 +97682,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { boxLayoutDefaults._supply(layoutIn, layoutOut, fullData, coerce, 'violin'); }; -},{"../../lib":202,"../box/layout_defaults":328,"./layout_attributes":455}],457:[function(_dereq_,module,exports){ +},{"../../lib":232,"../box/layout_defaults":359,"./layout_attributes":488}],490:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94870,7 +97872,7 @@ module.exports = function plot(gd, plotinfo, cdViolins, violinLayer) { }); }; -},{"../../components/drawing":97,"../../lib":202,"../box/plot":329,"../scatter/line_points":427,"./helpers":452,"d3":21}],458:[function(_dereq_,module,exports){ +},{"../../components/drawing":126,"../../lib":232,"../box/plot":360,"../scatter/line_points":459,"./helpers":485,"d3":21}],491:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94925,7 +97927,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":75,"../scatter/style":436,"d3":21}],459:[function(_dereq_,module,exports){ +},{"../../components/color":104,"../scatter/style":469,"d3":21}],492:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94937,7 +97939,7 @@ module.exports = function style(gd) { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[11])(11) }); diff --git a/dist/plotly-cartesian.min.js b/dist/plotly-cartesian.min.js index 48a3b48704e..9ac9f465b4e 100644 --- a/dist/plotly-cartesian.min.js +++ b/dist/plotly-cartesian.min.js @@ -1,17 +1,17 @@ /** -* plotly.js (cartesian - minified) v1.55.2 +* plotly.js (cartesian - minified) v1.58.0 * Copyright 2012-2020, 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 t(e,r,n){function a(o,l){if(!r[o]){if(!e[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return a(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":202}],2:[function(t,e,r){"use strict";e.exports=t("../src/traces/bar")},{"../src/traces/bar":311}],3:[function(t,e,r){"use strict";e.exports=t("../src/traces/box")},{"../src/traces/box":326}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/contour")},{"../src/traces/contour":346}],5:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":183}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":362}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":380}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":386}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":390}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/image")},{"../src/traces/image":397}],11:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./bar"),t("./box"),t("./heatmap"),t("./histogram"),t("./histogram2d"),t("./histogram2dcontour"),t("./image"),t("./pie"),t("./contour"),t("./scatterternary"),t("./violin")]),e.exports=n},{"./bar":2,"./box":3,"./contour":4,"./core":5,"./heatmap":6,"./histogram":7,"./histogram2d":8,"./histogram2dcontour":9,"./image":10,"./pie":12,"./scatterternary":13,"./violin":14}],12:[function(t,e,r){"use strict";e.exports=t("../src/traces/pie")},{"../src/traces/pie":406}],13:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":446}],14:[function(t,e,r){"use strict";e.exports=t("../src/traces/violin")},{"../src/traces/violin":454}],15:[function(t,e,r){"use strict";r.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=c(t),o=n[0],l=n[1],s=new i(function(t,e,r){return 3*(e+r)/4-r}(0,o,l)),u=0,f=l>0?o-4:o;for(r=0;r>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===l&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,s[u++]=255&e);1===l&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,a=r%3,i=[],o=0,l=r-a;ol?l:o+16383));1===a?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===a&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,s=o.length;l0)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 u(t,e,r){for(var a,i,o=[],l=e;l>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],16:[function(t,e,r){},{}],17:[function(t,e,r){var n=Object.create||function(t){var e=function(){};return e.prototype=t,new e},a=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return r},i=Function.prototype.bind||function(t){var e=this;return function(){return e.apply(t,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var l,s=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),l=0===c.x}catch(t){l=!1}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,r){if(e)t.call(r);else for(var n=t.length,a=_(t,n),i=0;i0&&l.length>i){l.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else l=o[e]=r,++t._eventsCount;return t}function m(){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 s=new Error('Unhandled "error" event. ('+e+")");throw s.context=e,s}if(!(r=o[t]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:f(r,c,this);break;case 2:d(r,c,this,arguments[1]);break;case 3:p(r,c,this,arguments[1],arguments[2]);break;case 4:h(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(a=new Array(n-1),i=1;i=0;o--)if(r[o]===e||r[o].listener===e){l=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(var r=e,n=r+1,a=t.length;n=0;i--)this.removeListener(t,e[i]);return this},o.prototype.listeners=function(t){return x(this,t,!0)},o.prototype.rawListeners=function(t){return x(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):b.call(t,e)},o.prototype.listenerCount=b,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],18:[function(t,e,r){(function(e){ +!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 t(e,r,n){function a(o,l){if(!r[o]){if(!e[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return a(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":232}],2:[function(t,e,r){"use strict";e.exports=t("../src/traces/bar")},{"../src/traces/bar":342}],3:[function(t,e,r){"use strict";e.exports=t("../src/traces/box")},{"../src/traces/box":357}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/contour")},{"../src/traces/contour":377}],5:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":213}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":393}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":411}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":417}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":421}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/image")},{"../src/traces/image":429}],11:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./bar"),t("./box"),t("./heatmap"),t("./histogram"),t("./histogram2d"),t("./histogram2dcontour"),t("./image"),t("./pie"),t("./contour"),t("./scatterternary"),t("./violin")]),e.exports=n},{"./bar":2,"./box":3,"./contour":4,"./core":5,"./heatmap":6,"./histogram":7,"./histogram2d":8,"./histogram2dcontour":9,"./image":10,"./pie":12,"./scatterternary":13,"./violin":14}],12:[function(t,e,r){"use strict";e.exports=t("../src/traces/pie")},{"../src/traces/pie":438}],13:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":479}],14:[function(t,e,r){"use strict";e.exports=t("../src/traces/violin")},{"../src/traces/violin":487}],15:[function(t,e,r){"use strict";r.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=c(t),o=n[0],l=n[1],s=new i(function(t,e,r){return 3*(e+r)/4-r}(0,o,l)),u=0,f=l>0?o-4:o;for(r=0;r>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===l&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,s[u++]=255&e);1===l&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,a=r%3,i=[],o=0,l=r-a;ol?l:o+16383));1===a?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===a&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,s=o.length;l0)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 u(t,e,r){for(var a,i,o=[],l=e;l>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],16:[function(t,e,r){},{}],17:[function(t,e,r){"use strict";var n,a="object"==typeof Reflect?Reflect:null,i=a&&"function"==typeof a.apply?a.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=a&&"function"==typeof a.ownKeys?a.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function l(){l.init.call(this)}e.exports=l,e.exports.once=function(t,e){return new Promise((function(r,n){function a(){void 0!==i&&t.removeListener("error",i),r([].slice.call(arguments))}var i;"error"!==e&&(i=function(r){t.removeListener(e,a),n(r)},t.once("error",i)),t.once(e,a)}))},l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var s=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?l.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var a,i,o,l;if(c(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),o=i[e]),void 0===o)o=i[e]=r,++t._eventsCount;else if("function"==typeof o?o=i[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(a=u(t))>0&&o.length>a&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=o.length,l=s,console&&console.warn&&console.warn(l)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},a=d.bind(n);return a.listener=r,n.wrapFn=a,a}function h(t,e,r){var n=t._events;if(void 0===n)return[];var a=n[e];return void 0===a?[]:"function"==typeof a?r?[a.listener||a]:[a]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var s=a[t];if(void 0===s)return!1;if("function"==typeof s)i(s,this,e);else{var c=s.length,u=v(s,c);for(r=0;r=0;i--)if(r[i]===e||r[i].listener===e){o=r[i].listener,a=i;break}if(a<0)return this;0===a?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},l.prototype.listeners=function(t){return h(this,t,!0)},l.prototype.rawListeners=function(t){return h(this,t,!1)},l.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},l.prototype.listenerCount=g,l.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],18:[function(t,e,r){(function(e){(function(){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -"use strict";var n=t("base64-js"),a=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(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 s(t)}return o(t,e,r)}function o(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|f(t,r),a=i(n),o=a.write(t,r);o!==n&&(a=a.slice(0,o));return a}(t,r);if(ArrayBuffer.isView(t))return c(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(N(t,ArrayBuffer)||t&&N(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||N(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 n=t.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return I(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return R(t).length;default:if(i)return a?-1:I(t).length;r=(""+r).toLowerCase(),i=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 A(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return w(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}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function h(t,r,n,a,i){if(0===t.length)return-1;if("string"==typeof n?(a=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),B(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof r&&(r=e.from(r,a)),e.isBuffer(r))return 0===r.length?-1:g(t,r,n,a,i);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):g(t,[r],n,a,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,a){var i,o=1,l=t.length,s=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,l/=2,s/=2,r/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(a){var u=-1;for(i=r;il&&(r=l-s),i=r;i>=0;i--){for(var f=!0,d=0;da&&(n=a):n=a;var i=e.length;n>i/2&&(n=i/2);for(var o=0;o>8,a=r%256,i.push(a),i.push(n);return i}(e,t.length-r),t,r,n)}function w(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],a=e;a239?4:c>223?3:c>191?2:1;if(a+f<=r)switch(f){case 1:c<128&&(u=c);break;case 2:128==(192&(i=t[a+1]))&&(s=(31&c)<<6|63&i)>127&&(u=s);break;case 3:i=t[a+1],o=t[a+2],128==(192&i)&&128==(192&o)&&(s=(15&c)<<12|(63&i)<<6|63&o)>2047&&(s<55296||s>57343)&&(u=s);break;case 4:i=t[a+1],o=t[a+2],l=t[a+3],128==(192&i)&&128==(192&o)&&128==(192&l)&&(s=(15&c)<<18|(63&i)<<12|(63&o)<<6|63&l)>65535&&s<1114112&&(u=s)}null===u?(u=65533,f=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),a+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,a,i){if(N(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===a&&(a=0),void 0===i&&(i=this.length),r<0||n>t.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&r>=n)return 0;if(a>=i)return-1;if(r>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(a>>>=0),l=(n>>>=0)-(r>>>=0),s=Math.min(o,l),c=this.slice(a,i),u=t.slice(r,n),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-e;if((void 0===r||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;an)&&(r=n);for(var a="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function C(t,r,n,a,i,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||rt.length)throw new RangeError("Index out of range")}function O(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return e=+e,r>>>=0,i||O(t,0,r,4),a.write(t,e,r,n,23,4),r+4}function z(t,e,r,n,i){return e=+e,r>>>=0,i||O(t,0,r,8),a.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],a=1,i=0;++i>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t+--e],a=1;e>0&&(a*=256);)n+=this[t+--e]*a;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],a=1,i=0;++i=(a*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=e,a=1,i=this[t+--n];n>0&&(a*=256);)i+=this[t+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*e)),i},e.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),a.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),a.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),a.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),a.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=r-1,i=1;for(this[e+a]=255&t;--a>=0&&(i*=256);)this[e+a]=t/i&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=0,o=1,l=0;for(this[e]=255&t;++i>0)-l&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=r-1,o=1,l=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===l&&0!==this[e+i+1]&&(l=1),this[e+i]=(t/o>>0)-l&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return z(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return z(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,a){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),a||0===a||(a=this.length),r>=t.length&&(r=t.length),r||(r=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,a),r);return i},e.prototype.fill=function(t,r,n,a){if("string"==typeof t){if("string"==typeof r?(a=r,r=0,n=this.length):"string"==typeof n&&(a=n,n=this.length),void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("string"==typeof a&&!e.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(1===t.length){var i=t.charCodeAt(0);("utf8"===a&&i<128||"latin1"===a)&&(t=i)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function R(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var a=0;a=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function N(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function B(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":15,buffer:18,ieee754:27}],19:[function(t,e,r){!function(n,a){"object"==typeof r&&"undefined"!=typeof e?a(r,t("d3-time")):a((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function n(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function a(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function i(t){var i=t.dateTime,o=t.date,s=t.time,c=t.periods,u=t.days,f=t.shortDays,d=t.months,yt=t.shortMonths,xt=p(c),bt=h(c),_t=p(u),wt=h(u),Tt=p(f),kt=h(f),Mt=p(d),At=h(d),Lt=p(yt),St=h(yt),Ct={a:function(t){return f[t.getDay()]},A:function(t){return u[t.getDay()]},b:function(t){return yt[t.getMonth()]},B:function(t){return d[t.getMonth()]},c:null,d:I,e:I,f:H,H:R,I:F,j:N,L:B,m:j,M:U,p:function(t){return c[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:vt,s:mt,S:V,u:q,U:G,V:Z,w:Y,W:X,x:null,X:null,y:W,Y:Q,Z:J,"%":gt},Ot={a:function(t){return f[t.getUTCDay()]},A:function(t){return u[t.getUTCDay()]},b:function(t){return yt[t.getUTCMonth()]},B:function(t){return d[t.getUTCMonth()]},c:null,d:$,e:$,f:nt,H:K,I:tt,j:et,L:rt,m:at,M:it,p:function(t){return c[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:vt,s:mt,S:ot,u:lt,U:st,V:ct,w:ut,W:ft,x:null,X:null,y:dt,Y:pt,Z:ht,"%":gt},Dt={a:function(t,e,r){var n=Tt.exec(e.slice(r));return n?(t.w=kt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=Lt.exec(e.slice(r));return n?(t.m=St[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=Mt.exec(e.slice(r));return n?(t.m=At[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return Et(t,i,e,r)},d:M,e:M,f:D,H:L,I:L,j:A,L:O,m:k,M:S,p:function(t,e,r){var n=xt.exec(e.slice(r));return n?(t.p=bt[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:P,s:E,S:C,u:v,U:m,V:y,w:g,W:x,x:function(t,e,r){return Et(t,o,e,r)},X:function(t,e,r){return Et(t,s,e,r)},y:_,Y:b,Z:w,"%":z};function zt(t,e){return function(r){var n,a,i,o=[],s=-1,c=0,u=t.length;for(r instanceof Date||(r=new Date(+r));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(l=n(a(c.y,0,1))).getUTCDay(),l=s>4||0===s?e.utcMonday.ceil(l):e.utcMonday(l),l=e.utcDay.offset(l,7*(c.V-1)),c.y=l.getUTCFullYear(),c.m=l.getUTCMonth(),c.d=l.getUTCDate()+(c.w+6)%7):(s=(l=r(a(c.y,0,1))).getDay(),l=s>4||0===s?e.timeMonday.ceil(l):e.timeMonday(l),l=e.timeDay.offset(l,7*(c.V-1)),c.y=l.getFullYear(),c.m=l.getMonth(),c.d=l.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?n(a(c.y,0,1)).getUTCDay():r(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Et(t,e,r,n){for(var a,i,o=0,s=e.length,c=r.length;o=c)return-1;if(37===(a=e.charCodeAt(o++))){if(a=e.charAt(o++),!(i=Dt[a in l?e.charAt(o++):a])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ct.x=zt(o,Ct),Ct.X=zt(s,Ct),Ct.c=zt(i,Ct),Ot.x=zt(o,Ot),Ot.X=zt(s,Ot),Ot.c=zt(i,Ot),{format:function(t){var e=zt(t+="",Ct);return e.toString=function(){return t},e},parse:function(t){var e=Pt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=zt(t+="",Ot);return e.toString=function(){return t},e},utcParse:function(t){var e=Pt(t+="",!0);return e.toString=function(){return t},e}}}var o,l={"-":"",_:" ",0:"0"},s=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(t,e,r){var n=s.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function k(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function M(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function A(t,e,r){var n=s.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function L(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function S(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function C(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function O(t,e,r){var n=s.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function D(t,e,r){var n=s.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function z(t,e,r){var n=c.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function P(t,e,r){var n=s.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function E(t,e,r){var n=s.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function I(t,e){return f(t.getDate(),e,2)}function R(t,e){return f(t.getHours(),e,2)}function F(t,e){return f(t.getHours()%12||12,e,2)}function N(t,r){return f(1+e.timeDay.count(e.timeYear(t),t),r,3)}function B(t,e){return f(t.getMilliseconds(),e,3)}function H(t,e){return B(t,e)+"000"}function j(t,e){return f(t.getMonth()+1,e,2)}function U(t,e){return f(t.getMinutes(),e,2)}function V(t,e){return f(t.getSeconds(),e,2)}function q(t){var e=t.getDay();return 0===e?7:e}function G(t,r){return f(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function Z(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function Y(t){return t.getDay()}function X(t,r){return f(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function W(t,e){return f(t.getFullYear()%100,e,2)}function Q(t,e){return f(t.getFullYear()%1e4,e,4)}function J(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+f(e/60|0,"0",2)+f(e%60,"0",2)}function $(t,e){return f(t.getUTCDate(),e,2)}function K(t,e){return f(t.getUTCHours(),e,2)}function tt(t,e){return f(t.getUTCHours()%12||12,e,2)}function et(t,r){return f(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return f(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function at(t,e){return f(t.getUTCMonth()+1,e,2)}function it(t,e){return f(t.getUTCMinutes(),e,2)}function ot(t,e){return f(t.getUTCSeconds(),e,2)}function lt(t){var e=t.getUTCDay();return 0===e?7:e}function st(t,r){return f(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ct(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ut(t){return t.getUTCDay()}function ft(t,r){return f(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function dt(t,e){return f(t.getUTCFullYear()%100,e,2)}function pt(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function ht(){return"+0000"}function gt(){return"%"}function vt(t){return+t}function mt(t){return Math.floor(+t/1e3)}function yt(e){return o=i(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var bt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=xt,t.isoParse=bt,t.timeFormatDefaultLocale=yt,t.timeFormatLocale=i,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":20}],20:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,a,i,o){function l(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return l.floor=function(e){return t(e=new Date(+e)),e},l.ceil=function(e){return t(e=new Date(e-1)),a(e,1),t(e),e},l.round=function(t){var e=l(t),r=l.ceil(t);return t-e0))return o;do{o.push(i=new Date(+e)),a(e,n),t(e)}while(i=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;a(t,-1),!e(t););else for(;--r>=0;)for(;a(t,1),!e(t););}))},i&&(l.count=function(n,a){return e.setTime(+n),r.setTime(+a),t(e),t(r),Math.floor(i(e,r))},l.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?l.filter(o?function(e){return o(e)%t==0}:function(e){return l.count(0,e)%t==0}):l:null}),l}var a=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));a.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):a:null};var i=a.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),l=o.range,s=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),c=s.range,u=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),f=u.range,d=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),p=d.range;function h(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var g=h(0),v=h(1),m=h(2),y=h(3),x=h(4),b=h(5),_=h(6),w=g.range,T=v.range,k=m.range,M=y.range,A=x.range,L=b.range,S=_.range,C=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),O=C.range,D=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));D.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var z=D.range,P=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),E=P.range,I=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),R=I.range,F=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),N=F.range;function B(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var H=B(0),j=B(1),U=B(2),V=B(3),q=B(4),G=B(5),Z=B(6),Y=H.range,X=j.range,W=U.range,Q=V.range,J=q.range,$=G.range,K=Z.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=d,t.timeDays=p,t.timeFriday=b,t.timeFridays=L,t.timeHour=u,t.timeHours=f,t.timeInterval=n,t.timeMillisecond=a,t.timeMilliseconds=i,t.timeMinute=s,t.timeMinutes=c,t.timeMonday=v,t.timeMondays=T,t.timeMonth=C,t.timeMonths=O,t.timeSaturday=_,t.timeSaturdays=S,t.timeSecond=o,t.timeSeconds=l,t.timeSunday=g,t.timeSundays=w,t.timeThursday=x,t.timeThursdays=A,t.timeTuesday=m,t.timeTuesdays=k,t.timeWednesday=y,t.timeWednesdays=M,t.timeWeek=g,t.timeWeeks=w,t.timeYear=D,t.timeYears=z,t.utcDay=F,t.utcDays=N,t.utcFriday=G,t.utcFridays=$,t.utcHour=I,t.utcHours=R,t.utcMillisecond=a,t.utcMilliseconds=i,t.utcMinute=P,t.utcMinutes=E,t.utcMonday=j,t.utcMondays=X,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=Z,t.utcSaturdays=K,t.utcSecond=o,t.utcSeconds=l,t.utcSunday=H,t.utcSundays=Y,t.utcThursday=q,t.utcThursdays=J,t.utcTuesday=U,t.utcTuesdays=W,t.utcWednesday=V,t.utcWednesdays=Q,t.utcWeek=H,t.utcWeeks=Y,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],21:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},a=this.document;function i(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(t,e){s.call(this,t,e+"")},l.setAttributeNS=function(t,e,r){c.call(this,t,e,r+"")},u.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function d(t,e){return te?1:t>=e?0:NaN}function p(t){return null===t?NaN:+t}function h(t){return!isNaN(t)}function g(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+1}return n}}}t.ascending=d,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},t.max=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},t.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var v=g(d);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 d(t(e),r)}:t)},t.shuffle=function(t,e,r){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+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],a=new Array(r<0?0:r);e=0;)for(e=(n=t[a]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function x(t){for(var e=1;t*e%1;)e*=10;return e}function b(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){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,a=[],i=x(y(r)),o=-1;if(t*=i,e*=i,(r*=i)<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=a.length)return r?r.call(n,i):e?i.sort(e):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return e;var n=[],o=i[r++];return e.forEach((function(e,a){n.push({key:e,values:t(a,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 a.push(t),n},n.sortKeys=function(t){return i[a.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(H,"\\$&")};var H=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,j={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function U(t){return j(t,Z),t}var V=function(t,e){return e.querySelector(t)},q=function(t,e){return e.querySelectorAll(t)},G=function(t,e){var r=t.matches||t[z(t,"matchesSelector")];return(G=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(V=function(t,e){return Sizzle(t,e)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),t.selection=function(){return t.select(a.documentElement)};var Z=t.selection.prototype=[];function Y(t){return"function"==typeof t?t:function(){return V(t,this)}}function X(t){return"function"==typeof t?t:function(){return q(t,this)}}Z.select=function(t){var e,r,n,a,i=[];t=Y(t);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Q.hasOwnProperty(r)?{space:Q[r],local:t}:t}},Z.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))},Z.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(t){t=ct.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=a+1);!(o=l[e])&&++e0&&(e=e.slice(0,o));var s=gt.get(e);function c(){var t=this[i];t&&(this.removeEventListener(e,t,t.$),delete this[i])}return s&&(e=s,l=mt),o?r?function(){var t=l(r,n(arguments));c.call(this),this.addEventListener(e,this[i]=t,t.$=a),t._=r}:c:r?E:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}t.selection.enter=ft,t.selection.enter.prototype=dt,dt.append=Z.append,dt.empty=Z.empty,dt.node=Z.node,dt.call=Z.call,dt.size=Z.size,dt.select=function(t){for(var e,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:t<0?-1:0}function Pt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Et(t){return t>1?0:t<-1?At:Math.acos(t)}function It(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Rt(t){return((t=Math.exp(t))+1/t)/2}function Ft(t){return(t=Math.sin(t/2))*t}var Nt=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,a=t[0],i=t[1],o=t[2],l=e[0],s=e[1],c=e[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(e=e.transition().duration(g)),e.call(w.event)}function L(){c&&c.domain(s.range().map((function(t){return(t-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(t){return(t-d.y)/d.k})).map(u.invert))}function S(t){v++||t({type:"zoomstart"})}function C(t){L(),t({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function O(t){--v||(t({type:"zoomend"}),r=null)}function D(){var e=this,r=_.of(e,arguments),n=0,a=t.select(o(e)).on(y,s).on(x,c),i=T(t.mouse(e)),l=bt(e);function s(){n=1,M(t.mouse(e),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),O(r)}ml.call(e),S(r)}function z(){var e,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+t.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=t.select(r),p=bt(r);function h(){var n=t.touches(r);return e=d.k,n.forEach((function(t){t.identifier in a&&(a[t.identifier]=T(t))})),n}function g(){var e=t.event.target;t.select(e).on(s,v).on(c,y),u.push(e);for(var n=t.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=t.touches(r);ml.call(r);for(var d=0,p=f.length;d360?t-=360:t<0&&(t+=360),t<60?n+(a-n)*t/60:t<180?a:t<240?n+(a-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)||e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+e):r+e-r*e),new ne(i(t+120),i(t),i(t-120))}function Zt(e,r,n){return this instanceof Zt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Zt?new Zt(e.h,e.c,e.l):Kt(e instanceof Wt?e.l:(e=ue((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Zt(e,r,n)}qt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Vt(this.h,this.s,this.l/t)},qt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Vt(this.h,this.s,t*this.l)},qt.rgb=function(){return Gt(this.h,this.s,this.l)},t.hcl=Zt;var Yt=Zt.prototype=new Ut;function Xt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Wt(r,Math.cos(t*=Ot)*e,Math.sin(t)*e)}function Wt(t,e,r){return this instanceof Wt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Wt?new Wt(t.l,t.a,t.b):t instanceof Zt?Xt(t.h,t.c,t.l):ue((t=ne(t)).r,t.g,t.b):new Wt(t,e,r)}Yt.brighter=function(t){return new Zt(this.h,this.c,Math.min(100,this.l+Qt*(arguments.length?t:1)))},Yt.darker=function(t){return new Zt(this.h,this.c,Math.max(0,this.l-Qt*(arguments.length?t:1)))},Yt.rgb=function(){return Xt(this.h,this.c,this.l).rgb()},t.lab=Wt;var Qt=18,Jt=Wt.prototype=new Ut;function $t(t,e,r){var n=(t+16)/116,a=n+e/500,i=n-r/200;return new ne(re(3.2404542*(a=.95047*te(a))-1.5371385*(n=1*te(n))-.4985314*(i=1.08883*te(i))),re(-.969266*a+1.8760108*n+.041556*i),re(.0556434*a-.2040259*n+1.0572252*i))}function Kt(t,e,r){return t>0?new Zt(Math.atan2(r,e)*Dt,Math.sqrt(e*e+r*r),t):new Zt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):se(""+t,ne,Gt):new ne(t,e,r)}function ae(t){return new ne(t>>16,t>>8&255,255&t)}function ie(t){return ae(t)+""}Jt.brighter=function(t){return new Wt(Math.min(100,this.l+Qt*(arguments.length?t:1)),this.a,this.b)},Jt.darker=function(t){return new Wt(Math.max(0,this.l-Qt*(arguments.length?t:1)),this.a,this.b)},Jt.rgb=function(){return $t(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Ut;function le(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function se(t,e,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(de(a[0]),de(a[1]),de(a[2]))}return(i=pe.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===t.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),e(o,l,s))}function ce(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=t==o?(e-r)/l+(e0&&s<1?0:n),new Vt(n,a,s)}function ue(t,e,r){var n=ee((.4124564*(t=fe(t))+.3575761*(e=fe(e))+.1804375*(r=fe(r)))/.95047),a=ee((.2126729*t+.7151522*e+.072175*r)/1);return Wt(116*a-16,500*(n-a),200*(a-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function de(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,a=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=a.call(o,c)}catch(t){return void l.error.call(o,t)}l.load.call(o,t)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(e)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(e){var r=t.event;t.event=e;try{l.progress.call(o,c)}finally{t.event=r}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",o):r},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return a=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}})),o.send=function(t,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(t,e,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(t){a(null,t)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},t.rebind(o,l,"on"),null==i?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(i))}pe.forEach((function(t,e){pe.set(t,ae(e))})),t.functor=he,t.xhr=ge(O),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function a(t,r,n){arguments.length<3&&(n=r,r=null);var a=ve(t,e,null==r?i:o(r),n);return a.row=function(t){return arguments.length?a.response(null==(r=t)?i:o(t)):r},a}function i(t){return a.parse(t.responseText)}function o(t){return function(e){return a.parse(e.responseText,t)}}function l(e){return e.map(s).join(t)}function s(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return a.parse=function(t,e){var r;return a.parseRows(t,(function(t,n){if(r)return r(t,n-1);var a=new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+"]"})).join(",")+"}");r=e?function(t,r){return e(a(t),r)}:a}))},a.parseRows=function(t,e){var r,a,i={},o={},l=[],s=t.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(be),be=setTimeout(Te,e)),xe=0):(xe=1,_e(Te))}function ke(){for(var t=Date.now(),e=me;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Me(){for(var t,e=me,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Se(e){var r=e.decimal,n=e.thousands,a=e.grouping,i=e.currency,o=a&&n?function(t,e){for(var r=t.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),i.push(t.substring(r-=l,r+l)),!((s+=l+1)>e));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:O;return function(e){var n=Ce.exec(e),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Oe.get(h)||De;var b=u&&d;return function(e){var n=m;if(y&&e%1)return"";var i=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===s?"":s;if(g<0){var c=t.formatPrefix(e,p);e=c.scale(e),n=c.symbol+m}else e*=g;var _,w,T=(e=h(e,p)).lastIndexOf(".");if(T<0){var k=x?e.lastIndexOf("e"):-1;k<0?(_=e,w=""):(_=e.substring(0,k),w=e.substring(k))}else _=e.substring(0,T),w=r+e.substring(T+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+e:"^"===l?A.substring(0,M>>=1)+i+e+A.substring(M):i+(b?e:A+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Ae(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,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,Ae(e,r))).toFixed(Math.max(0,Math.min(20,Ae(e*(1+1e-15),r))))}});function De(t){return t+""}var ze=t.time={},Pe=Date;function Ee(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Ee.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(){Ie.setUTCDate.apply(this._,arguments)},setDay:function(){Ie.setUTCDay.apply(this._,arguments)},setFullYear:function(){Ie.setUTCFullYear.apply(this._,arguments)},setHours:function(){Ie.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Ie.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Ie.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Ie.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Ie.setUTCSeconds.apply(this._,arguments)},setTime:function(){Ie.setTime.apply(this._,arguments)}};var Ie=Date.prototype;function Re(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=c)return-1;if(37===(a=e.charCodeAt(l++))){if(o=e.charAt(l++),!(i=w[o in Be?e.charAt(l++):o])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(t){var e=u(t);function r(t){try{var r=new(Pe=Ee);return r._=t,e(r)}finally{Pe=Date}}return r.parse=function(t){try{Pe=Ee;var r=e.parse(t);return r&&r._}finally{Pe=Date}},r.toString=e.toString,r},u.multi=u.utc.multi=or;var d=t.map(),p=Ve(o),h=qe(o),g=Ve(l),v=qe(l),m=Ve(s),y=qe(s),x=Ve(c),b=qe(c);i.forEach((function(t,e){d.set(t.toLowerCase(),e)}));var _={a:function(t){return l[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:u(r),d:function(t,e){return Ue(t.getDate(),e,2)},e:function(t,e){return Ue(t.getDate(),e,2)},H:function(t,e){return Ue(t.getHours(),e,2)},I:function(t,e){return Ue(t.getHours()%12||12,e,2)},j:function(t,e){return Ue(1+ze.dayOfYear(t),e,3)},L:function(t,e){return Ue(t.getMilliseconds(),e,3)},m:function(t,e){return Ue(t.getMonth()+1,e,2)},M:function(t,e){return Ue(t.getMinutes(),e,2)},p:function(t){return i[+(t.getHours()>=12)]},S:function(t,e){return Ue(t.getSeconds(),e,2)},U:function(t,e){return Ue(ze.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ue(ze.mondayOfYear(t),e,2)},x:u(n),X:u(a),y:function(t,e){return Ue(t.getFullYear()%100,e,2)},Y:function(t,e){return Ue(t.getFullYear()%1e4,e,4)},Z:ar,"%":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){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.m=b.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:$e,e:$e,H:tr,I:tr,j:Ke,L:nr,m:Je,M:er,p:function(t,e,r){var n=d.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:Ze,w:Ge,W:Ye,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:We,Y:Xe,Z:Qe,"%":ir};return u}ze.year=Re((function(t){return(t=ze.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),ze.years=ze.year.range,ze.years.utc=ze.year.utc.range,ze.day=Re((function(t){var e=new Pe(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),ze.days=ze.day.range,ze.days.utc=ze.day.utc.range,ze.dayOfYear=function(t){var e=ze.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=ze[t]=Re((function(t){return(t=ze.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=ze.year(t).getDay();return Math.floor((ze.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));ze[t+"s"]=r.range,ze[t+"s"].utc=r.utc.range,ze[t+"OfYear"]=function(t){var r=ze.year(t).getDay();return Math.floor((ze.dayOfYear(t)+(r+e)%7)/7)}})),ze.week=ze.sunday,ze.weeks=ze.sunday.range,ze.weeks.utc=ze.sunday.utc.range,ze.weekOfYear=ze.sundayOfYear;var Be={"-":"",_:" ",0:"0"},He=/^\s*\d+/,je=/^%/;function Ue(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+a[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){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function $e(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Ke(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ar(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,a=y(e)%60;return r+Ue(n,"0",2)+Ue(a,"0",2)}function ir(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(t){for(var e=t.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(e),c=Math.sin(e),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=t,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(t=o)*Ot,n=Math.cos(l=(e=l)*Ot/2+At/4),a=Math.sin(l)},Cr.lineEnd=function(){i(t,e)}}function Dr(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 zr(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 Er(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 Rr(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 Fr(t){return[Math.atan2(t[1],t[0]),It(t[2])]}function Nr(t,e){return y(t[0]-e[0])kt?a=90:c<-kt&&(r=-90),f[0]=e,f[1]=n}};function p(t,i){u.push(f=[e=t,n=t]),ia&&(a=i)}function h(t,o){var l=Dr([t*Ot,o*Ot]);if(s){var c=Pr(s,l),u=Pr([c[1],-c[0],0],c);Rr(u),u=Fr(u);var f=t-i,d=f>0?1:-1,h=u[0]*Dt*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>i?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else p(t,o);s=l,i=t}function g(){d.point=h}function v(){f[0]=e,f[1]=n,d.point=p,s=null}function m(t,e){if(s){var r=t-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=t,l=e;Cr.point(t,e),h(t,e)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>kt&&(e=-(n=180)),f[0]=e,f[1]=n,s=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function T(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,e=p[0],n=g[1])}return u=f=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,a]]}}(),t.geo.centroid=function(e){mr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Lr=0,t.geo.stream(e,Br);var r=Mr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Xr(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n=0?1:-1,T=w*_,k=T>At,M=h*x;if(Sr.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*Lt:_,k^d>=r^m>=r){var A=Pr(Dr(f),Dr(t));Rr(A);var L=Pr(a,A);Rr(L);var S=(k^_>=0?-1:1)*It(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=t}}return(i<-kt||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&e&&r.push(r.pop().concat(r.shift())),l.push(r.filter(Jr))}return u}}function Jr(t){return t.length>1}function $r(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:E,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]-Ct-kt:Ct-t[1])-((e=e.x)[0]<0?e[1]-Ct-kt:Ct-e[1])}var tn=Qr(Zr,(function(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var l=i>0?At:-At,s=y(i-r);y(s-At)0?Ct:-Ct),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(i,n),e=0):a!==l&&s>=At&&(y(r-a)kt?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}(r,n,i,o),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(l,n),e=0),t.point(r=i,n=o),a=l},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var a;if(null==t)a=r*Ct,n.point(-At,a),n.point(0,a),n.point(At,a),n.point(At,0),n.point(At,-a),n.point(0,-a),n.point(-At,-a),n.point(-At,0),n.point(-At,a);else if(y(t[0]-e[0])>kt){var i=t[0]0,n=y(e)>kt;return Qr(a,(function(t){var e,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?At:-At),d):0;if(!e&&(c=s=g)&&t.lineStart(),g!==s&&(p=i(e,h),(Nr(e,p)||Nr(h,p))&&(h[0]+=kt,h[1]+=kt,g=a(h[0],h[1]))),g!==s)u=0,g?(t.lineStart(),p=i(h,e),t.point(p[0],p[1])):(p=i(e,h),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(n&&e&&r^g){var m;v&l||!(m=i(h,e,!0))||(u=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&&Nr(e,h)||t.point(h[0],h[1]),e=h,s=g,l=v},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return u|(c&&s)<<1}}}),Nn(t,6*Ot),r?[0,-t]:[-At,t-At]);function a(t,r){return Math.cos(t)*Math.cos(r)>e}function i(t,r,n){var a=[1,0,0],i=Pr(Dr(t),Dr(r)),o=zr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&t;var c=e*o/s,u=-e*l/s,f=Pr(a,i),d=Ir(a,c);Er(d,Ir(i,u));var p=f,h=zr(d,p),g=zr(p,p),v=h*h-g*(zr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Ir(p,(-h-m)/g);if(Er(x,d),x=Fr(x),!n)return x;var b,_=t[0],w=r[0],T=t[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-At)0^x[1]<(y(x[0]-_)At^(_<=x[0]&&x[0]<=w)){var L=Ir(p,(-h+m)/g);return Er(L,d),[x,Fr(L)]}}}function o(e,n){var a=r?t:At-t,i=0;return e<-a?i|=1:e>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(t,e,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=t-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(e,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=$r(),w=rn(e,r,n,a),T={point:A,lineStart:function(){T.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));T.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=t.merge(c);var r=function(t){for(var e=0,r=u.length,n=t[1],a=0;an&&Pt(c,i,t)>0&&++e:i[1]<=n&&Pt(c,i,t)<0&&--e,c=i;return 0!==e}([e,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),i&&Yr(c,o,r,k,s),s.polygonEnd()),c=u=f=null}};function k(t,o,s,c){var u=0,f=0;if(null==t||(u=i(t,s))!==(f=i(o,s))||l(t,o)<0^s>0)do{c.point(0===u||3===u?e:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(t,i){return e<=t&&t<=n&&r<=i&&i<=a}function A(t,e){M(t,e)&&s.point(t,e)}function L(t,e){var r=M(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(u&&f.push([t,e]),y)d=t,p=e,h=r,y=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&m)s.point(t,e);else{var n={a:{x:g,y:v},b:{x:t,y:e}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(t,e),x=!1)}g=t,v=e,m=r}return T};function i(t,a){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:a>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var r=i(t,1),n=i(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=At/3,n=On(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*At/180,r=t[1]*At/180):[e/At*180,r/At*180]},a}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(t,e){var r=Math.sqrt(a-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),i-r*Math.cos(t)]}return o.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/n,It((a-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,a,i,o={stream:function(t){return a&&(a.valid=!1),(a=i(t)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(t=+l[0][0],e=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=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,a,i=t.geo.albers(),o=t.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=t.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(t,r){e=[t,r]}};function c(t){var i=t[0],o=t[1];return e=null,r(i,o),e||(n(i,o),e)||a(i,o),e}return c.invert=function(t){var e=i.scale(),r=i.translate(),n=(t[0]-r[0])/e,a=(t[1]-r[1])/e;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(t)},c.stream=function(t){var e=i.stream(t),r=o.stream(t),n=l.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},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()}}},c.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),l.precision(t),c):i.precision()},c.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),l.scale(t),c.translate(i.translate())):i.scale()},c.translate=function(t){if(!arguments.length)return i.translate();var e=i.scale(),u=+t[0],f=+t[1];return r=i.translate(t).clipExtent([[u-.455*e,f-.238*e],[u+.455*e,f+.238*e]]).stream(s).point,n=o.translate([u-.307*e,f+.201*e]).clipExtent([[u-.425*e+kt,f+.12*e+kt],[u-.214*e-kt,f+.234*e-kt]]).stream(s).point,a=l.translate([u-.205*e,f+.212*e]).clipExtent([[u-.214*e+kt,f+.166*e+kt],[u-.115*e-kt,f+.234*e-kt]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:E,lineStart:E,lineEnd:E,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=E,ln+=y(sn/2)}};function hn(){var t,e,r,n;function a(t,e){sn+=n*t-r*e,r=t,n=e}pn.point=function(i,o){pn.point=a,t=r=i,e=n=o},pn.lineEnd=function(){a(t,e)}}var gn={point:function(t,e){tfn&&(fn=t);edn&&(dn=e)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E};function vn(){var t=mn(4.5),e=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},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 a(t,n){e.push("M",t,",",n),r.point=i}function i(t,r){e.push("L",t,",",r)}function o(){r.point=n}function l(){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,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(t,e){xr+=t,br+=e,++_r}function _n(){var t,e;function r(r,n){var a=r-t,i=n-e,o=Math.sqrt(a*a+i*i);wr+=o*(t+r)/2,Tr+=o*(e+n)/2,kr+=o,bn(t=r,e=n)}xn.point=function(n,a){xn.point=r,bn(t=n,e=a)}}function wn(){xn.point=bn}function Tn(){var t,e,r,n;function a(t,e){var a=t-r,i=e-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+t)/2,Tr+=o*(n+e)/2,kr+=o,Mr+=(o=n*t-r*e)*(r+t),Ar+=o*(n+e),Lr+=3*o,bn(r=t,n=e)}xn.point=function(i,o){xn.point=a,bn(t=r=i,e=n=o)},xn.lineEnd=function(){a(t,e)}}function kn(t){var e=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=t,r},result:E};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,Lt)}function a(e,n){t.moveTo(e,n),r.point=i}function i(e,r){t.lineTo(e,r)}function o(){r.point=n}function l(){t.closePath()}return r}function Mn(t){var e=.5,r=Math.cos(30*Ot),n=16;function a(t){return(n?o:i)(t)}function i(e){return Sn(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,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=x,e.lineStart()}function x(r,a){var i=Dr([r,a]),o=t(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,e),e.point(f,d)}function b(){v.point=m,e.lineEnd()}function _(){y(),v.point=w,v.lineEnd=T}function w(t,e){x(r=t,e),a=f,i=d,o=p,s=h,c=g,v.point=x}function T(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,e),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*e&&v--){var w=o+p,T=s+h,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),L=y(y(k)-1)e||y((x*D+b*z)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(e)},a}function An(t){var e=Mn((function(e,r){return t([e*Dt,r*Dt])}));return function(t){return Dn(e(t))}}function Ln(t){this.stream=t}function Sn(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 Cn(t){return On((function(){return t}))()}function On(e){var r,n,a,i,o,l,s=Mn((function(t,e){return[(t=r(t,e))[0]*c+i,o-t[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=tn,y=O,x=null,b=null;function _(t){return[(t=a(t[0]*Ot,t[1]*Ot))[0]*c+i,o-t[1]*c]}function w(t){return(t=a.invert((t[0]-i)/c,(o-t[1])/c))&&[t[0]*Dt,t[1]*Dt]}function T(){a=Gr(n=En(h,g,v),r);var t=r(d,p);return i=u-t[0]*c,o=f+t[1]*c,k()}function k(){return l&&(l.valid=!1,l=null),_}return _.stream=function(t){return l&&(l.valid=!1),(l=Dn(m(n,s(y(t))))).valid=!0,l},_.clipAngle=function(t){return arguments.length?(m=null==t?(x=t,tn):en((x=+t)*Ot),k()):x},_.clipExtent=function(t){return arguments.length?(b=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):O,k()):b},_.scale=function(t){return arguments.length?(c=+t,T()):c},_.translate=function(t){return arguments.length?(u=+t[0],f=+t[1],T()):[u,f]},_.center=function(t){return arguments.length?(d=t[0]%360*Ot,p=t[1]%360*Ot,T()):[d*Dt,p*Dt]},_.rotate=function(t){return arguments.length?(h=t[0]%360*Ot,g=t[1]%360*Ot,v=t.length>2?t[2]%360*Ot:0,T()):[h*Dt,g*Dt,v*Dt]},t.rebind(_,s,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,T()}}function Dn(t){return Sn(t,(function(e,r){t.point(e*Ot,r*Ot)}))}function zn(t,e){return[t,e]}function Pn(t,e){return[t>At?t-Lt:t<-At?t+Lt:t,e]}function En(t,e,r){return t?e||r?Gr(Rn(t),Fn(e,r)):Rn(t):e||r?Fn(e,r):Pn}function In(t){return function(e,r){return[(e+=t)>At?e-Lt:e<-At?e+Lt:e,r]}}function Rn(t){var e=In(t);return e.invert=In(-t),e}function Fn(t,e){var r=Math.cos(t),n=Math.sin(t),a=Math.cos(e),i=Math.sin(e);function o(t,e){var o=Math.cos(e),l=Math.cos(t)*o,s=Math.sin(t)*o,c=Math.sin(e),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),It(u*a+s*i)]}return o.invert=function(t,e){var o=Math.cos(e),l=Math.cos(t)*o,s=Math.sin(t)*o,c=Math.sin(e),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),It(u*r-l*n)]},o}function Nn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,l){var s=o*e;null!=a?(a=Bn(r,a),i=Bn(r,i),(o>0?ai)&&(a+=o*Lt)):(a=t+o*Lt,i=t-.5*s);for(var c,u=a;o>0?u>i:u2?t[2]*Ot:0),e.invert=function(e){return(e=t.invert(e[0]*Ot,e[1]*Ot))[0]*=Dt,e[1]*=Dt,e},e},Pn.invert=zn,t.geo.circle=function(){var t,e,r=[0,0],n=6;function a(){var t="function"==typeof r?r.apply(this,arguments):r,n=En(-t[0]*Ot,-t[1]*Ot,0).invert,a=[];return e(null,null,1,{point:function(t,e){a.push(t=n(t,e)),t[0]*=Dt,t[1]*=Dt}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(t){return arguments.length?(r=t,a):r},a.angle=function(r){return arguments.length?(e=Nn((t=+r)*Ot,n*Ot),a):t},a.precision=function(r){return arguments.length?(e=Nn(t*Ot,(n=+r)*Ot),a):n},a.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ot,a=t[1]*Ot,i=e[1]*Ot,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},t.geo.graticule=function(){var e,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return t.range(Math.ceil(a/g)*g,n,g).map(f).concat(t.range(Math.ceil(s/v)*v,l,v).map(d)).concat(t.range(Math.ceil(r/p)*p,e,p).filter((function(t){return y(t%g)>kt})).map(c)).concat(t.range(Math.ceil(o/h)*h,i,h).filter((function(t){return y(t%v)>kt})).map(u))}return x.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(a=+t[0][0],n=+t[1][0],s=+t[0][1],l=+t[1][1],a>n&&(t=a,a=n,n=t),s>l&&(t=s,s=l,l=t),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],i=+t[1][1],r>e&&(t=r,r=e,e=t),o>i&&(t=o,o=i,i=t),x.precision(m)):[[r,o],[e,i]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],x):[g,v]},x.minorStep=function(t){return arguments.length?(p=+t[0],h=+t[1],x):[p,h]},x.precision=function(t){return arguments.length?(m=+t,c=Hn(o,i,90),u=jn(r,e,m),f=Hn(s,l,90),d=jn(a,n,m),x):m},x.majorExtent([[-180,-90+kt],[180,90-kt]]).minorExtent([[-180,-80-kt],[180,80+kt]])},t.geo.greatArc=function(){var e,r,n=Un,a=Vn;function i(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,i):n},i.target=function(t){return arguments.length?(a=t,r="function"==typeof t?null:t,i):a},i.precision=function(){return arguments.length?i:0},i},t.geo.interpolate=function(t,e){return r=t[0]*Ot,n=t[1]*Ot,a=e[0]*Ot,i=e[1]*Ot,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Ft(i-n)+o*s*Ft(a-r))),g=1/Math.sin(h),(v=h?function(t){var e=Math.sin(t*=h)*g,r=Math.sin(h-t)*g,n=r*u+e*d,a=r*f+e*p,i=r*l+e*c;return[Math.atan2(a,n)*Dt,Math.atan2(i,Math.sqrt(n*n+a*a))*Dt]}:function(){return[r*Dt,n*Dt]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},t.geo.length=function(e){return yn=0,t.geo.stream(e,qn),yn};var qn={sphere:E,point:E,lineStart:function(){var t,e,r;function n(n,a){var i=Math.sin(a*=Ot),o=Math.cos(a),l=y((n*=Ot)-t),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-e*o*s)*l),e*i+r*o*s),t=n,e=i,r=o}qn.point=function(a,i){t=a*Ot,e=Math.sin(i*=Ot),r=Math.cos(i),qn.point=n},qn.lineEnd=function(){qn.point=qn.lineEnd=E}},lineEnd:E,polygonStart:E,polygonEnd:E};function Gn(t,e){function r(e,r){var n=Math.cos(e),a=Math.cos(r),i=t(n*a);return[i*a*Math.sin(e),i*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),a=e(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(t*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Yn=Gn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),O);function Xn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(At/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),i=r*Math.pow(n(t),a)/a;if(!a)return Jn;function o(t,e){i>0?e<-Ct+kt&&(e=-Ct+kt):e>Ct-kt&&(e=Ct-kt);var r=i/Math.pow(n(e),a);return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}return o.invert=function(t,e){var r=i-e,n=zt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ct]},o}function Wn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/n+t;if(y(n)1&&Pt(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Cn(ta)}).raw=ta,ea.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=$n(ea),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=ea,t.geom={},t.geom.hull=function(t){var e=ra,r=na;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,a=he(e),i=he(r),o=t.length,l=[],s=[];for(n=0;n=0;--n)p.push(t[l[c[n]][2]]);for(n=+f;nkt)l=l.L;else{if(!((a=i-Ta(l,o))>kt)){n>-kt?(e=l.P,r=l):a>-kt?(e=l,r=l.N):e=r=l;break}if(!l.R){e=l;break}l=l.R}var s=ya(t);if(da.insert(e,s),e||r){if(e===r)return Sa(e),r=ya(e.site),da.insert(s,r),s.edge=r.edge=Da(e.site,s.site),La(e),void La(r);if(r){Sa(e),Sa(r);var c=e.site,u=c.x,f=c.y,d=t.x-u,p=t.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};Pa(r.edge,c,h,b),s.edge=Da(c,t,null,b),r.edge=Da(t,h,null,b),La(e),La(r)}else s.edge=Da(e.site,s.site)}}function wa(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)return n;var o=t.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-e;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function Ta(t,e){var r=t.N;if(r)return wa(r,e);var n=t.site;return n.y===e?n.x:1/0}function ka(t){this.site=t,this.edges=[]}function Ma(t,e){return e.angle-t.angle}function Aa(){Ra(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,a=t.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Mt)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=t,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,t.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xkt||y(a-r)>kt)&&(l.splice(o,0,new Ea(za(i.site,u,y(n-f)kt?{x:f,y:y(e-f)kt?{x:y(r-h)kt?{x:d,y:y(e-d)kt?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=t[l]})),e}function l(t){return t.map((function(t,e){return{x:Math.round(n(t,e)/kt)*kt,y:Math.round(a(t,e)/kt)*kt,i:e}}))}return o.links=function(t){return Ha(l(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 Ha(l(t)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|e>=b,T=w+4;wi&&(a=e.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=$a.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,T=v-h;function k(t,e,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var s=t.x,c=t.y;if(null!=s)if(y(s-r)+y(c-n)<.01)M(t,e,r,n,a,i,o,l);else{var u=t.point;t.x=t.y=t.point=null,M(t,u,s,c,a,i,o,l),M(t,e,r,n,a,i,o,l)}else t.x=r,t.y=n,t.point=e}else M(t,e,r,n,a,i,o,l)}function M(t,e,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;t.leaf=!1,u?a=s:o=s,f?i=c:l=c,k(t=t.nodes[d]||(t.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,a,i,o,l)}w>T?v=h+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(A,t,+m(t,++f),+x(t,f),p,h,g,v)},visit:function(t){Ga(t,A,p,h,g,v)},find:function(t){return Za(A,t[0],t[1],p,h,g,v)}};if(f=-1,null==e){for(;++f=0&&!(n=t.interpolators[a](e,r)););return n}function ti(t,e){var r,n=[],a=[],i=t.length,o=e.length,l=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function ii(t){return function(e){return 1-t(1-e)}}function oi(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function li(t){return t*t}function si(t){return t*t*t}function ci(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ui(t){return 1-Math.cos(t*Ct)}function fi(t){return Math.pow(2,10*(t-1))}function di(t){return 1-Math.sqrt(1-t*t)}function pi(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 hi(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function gi(t){var e,r,n,a=[t.a,t.b],i=[t.c,t.d],o=mi(a),l=vi(a,i),s=mi(((e=i)[0]+=(n=-l)*(r=a)[0],e[1]+=n*r[1],e))||0;a[0]*i[1]=0?t.slice(0,e):t,a=e>=0?t.slice(e+1):"in";return n=ri.get(n)||ei,ai((a=ni.get(a)||O)(n.apply(null,r.call(arguments,1))))},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,a=e.c,i=e.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Xt(n+o*t,a+l*t,i+s*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,a=e.s,i=e.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Gt(n+o*t,a+l*t,i+s*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,a=e.a,i=e.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(t){return $t(n+o*t,a+l*t,i+s*t)+""}},t.interpolateRound=hi,t.transform=function(e){var r=a.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 gi(e?e.matrix:yi)})(e)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(t){return t.length?t.pop()+",":""}function bi(e,r){var n=[],a=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(t[0],e[0])},{i:a-2,x:Wa(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,a),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(t,e)})):e&&r.push(xi(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,a),function(t,e,r,n){t!==e?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(t,e)}):e&&r.push(xi(r)+"skewX("+e+")")}(e.skew,r.skew,n,a),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(t[0],e[0])},{i:a-2,x:Wa(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(xi(r)+"scale("+e+")")}(e.scale,r.scale,n,a),e=r=null,function(t){for(var e,r=-1,i=a.length;++r0?n=t:(e.c=null,e.t=NaN,e=null,s.end({type:"end",alpha:n=0})):t>0&&(s.start({type:"start",alpha:n=t}),e=we(l.tick)),l):n},l.start=function(){var t,e,r,n=m.length,s=y.length,u=c[0],h=c[1];for(t=0;t=0;)r.push(a[n])}function Ei(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ei(a,(function(e){var n,a;t&&(n=e.children)&&n.sort(t),r&&(a=e.parent)&&(a.value+=e.value)})),l}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&&(Pi(t,(function(t){t.children&&(t.value=0)})),Ei(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 a=e.call(this,t,n);return function t(e,r,n,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=e.value?n/e.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=e);return n}function Xi(t){return t.reduce(Wi,0)}function Wi(t,e){return t+e[1]}function Qi(t,e){return Ji(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ji(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,i=[];++r<=e;)i[r]=a*r+n;return i}function $i(e){return[t.min(e),t.max(e)]}function Ki(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(t,e){var r=e.x-t.x,n=e.y-t.y,a=t.r+e.r;return.999*a*a>r*r+n*n}function no(t){if((e=t.children)&&(s=e.length)){var e,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(e.forEach(ao),(r=e[0]).x=-r.r,r.y=0,x(r),s>1&&((n=e[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=e[2]),x(a),to(r,a),r._pack_prev=a,to(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[t.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(t){return arguments.length?(r=t,i):r},i.range=function(t){return arguments.length?(n=he(t),i):n},i.bins=function(t){return arguments.length?(a="number"==typeof t?function(e){return Ji(e,t)}:he(t),i):a},i.frequency=function(t){return arguments.length?(e=!!t,i):e},i},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(t,i){var o=r.call(this,t,i),l=o[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,Ei(l,(function(t){t.r=+u(t.value)})),Ei(l,no),n){var f=n*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;Ei(l,(function(t){t.r+=f})),Ei(l,no),Ei(l,(function(t){t.r-=f}))}return function t(e,r,n,a){var i=e.children;if(e.x=r+=a*e.x,e.y=n+=a*e.y,e.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=t),t.depth>h.depth&&(h=t)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);Pi(u,(function(t){t.x=(t.x+g)*v,t.y=t.depth*m}))}return c}function o(t){var e=t.children,n=t.parent.children,a=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,a=t.children,i=a.length;for(;--i>=0;)(e=a[i]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var i=(e[0].z+e[e.length-1].z)/2;a?(t.z=a.z+r(t._,a._),t.m=t.z-i):t.z=i}else a&&(t.z=a.z+r(t._,a._));t.parent.A=function(t,e,n){if(e){for(var a,i=t,o=t,l=e,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=t,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,t,n),t,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=t)}return n}(t,a,t.parent.A||n[0])}function l(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=n[0],t.y=t.depth*n[1]}return i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t)?s:null,i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null==(n=t)?null:s,i):a?n:null},zi(i,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=e.call(this,i,o),c=s[0],u=0;Ei(c,(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=l?u+=r(e,l):0,e.y=0,l=e)}));var f=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(c),d=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return Ei(c,a?function(t){t.x=(t.x-c.x)*n[0],t.y=(c.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(h-p)*n[0],t.y=(1-(c.y?t.y/c.y:1))*n[1]}),s}return i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t),i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null!=(n=t),i):a?n:null},zi(i,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(t,e){for(var r,n,a=-1,i=t.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),e.forEach(f)}}function d(t){var e=t.children;if(e&&e.length){var r,n=o(t),a=e.slice(),i=[];for(u(a,n.dx*n.dy/t.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);e.forEach(d)}}function p(t,e){for(var r,n=t.area,a=0,i=1/0,o=-1,l=t.length;++oa&&(a=r));return e*=e,(n*=n)?Math.max(e*a*c/n,n/(e*i*c)):1/0}function h(t,e,r,a){var i,o=-1,l=t.length,s=r.x,c=r.y,u=e?n(t.area/e):0;if(e==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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?_o:mo,l=a?wi:_i;return i=t(e,r,l,n),o=t(r,e,l,Ka),s}function s(t){return i(t)}return s.invert=function(t){return o(t)},s.domain=function(t){return arguments.length?(e=t.map(Number),l()):e},s.range=function(t){return arguments.length?(r=t,l()):r},s.rangeRound=function(t){return s.range(t).interpolate(hi)},s.clamp=function(t){return arguments.length?(a=t,l()):a},s.interpolate=function(t){return arguments.length?(n=t,l()):n},s.ticks=function(t){return Mo(e,t)},s.tickFormat=function(t,r){return Ao(e,t,r)},s.nice=function(t){return To(e,t),l()},s.copy=function(){return t(e,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,a,i){function o(t){return(a?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function l(t){return a?Math.pow(n,t):-Math.pow(n,-t)}function s(t){return r(o(t))}return s.invert=function(t){return l(r.invert(t))},s.domain=function(t){return arguments.length?(a=t[0]>=0,r.domain((i=t.map(Number)).map(o)),s):i},s.base=function(t){return arguments.length?(n=+t,r.domain(i.map(o)),s):n},s.nice=function(){var t=yo(i.map(o),a?Math:Oo);return r.domain(t),i=t.map(l),s},s.ticks=function(){var t=go(i),e=[],r=t[0],s=t[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)e.push(l(c)*d);for(c=0;e[c]s;u--);e=e.slice(c,u)}return e},s.tickFormat=function(e,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=t.format(r));var a=Math.max(1,n*e/s.ticks().length);return function(t){var e=t/l(Math.round(o(t)));return e*n0?a[t-1]:r[0],tf?0:1;if(c=St)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,T,k,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=It(v/c*Math.sin(m))),l&&(A=It(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=At?0:1;if(L&&Vo(y,x,b,_)===p^C){var O=(u+f)/2;y=c*Math.cos(O),x=c*Math.sin(O),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),T=l*Math.sin(f-A),k=l*Math.cos(u+A),M=l*Math.sin(u+A);var D=Math.abs(u-f+2*A)<=At?0:1;if(A&&Vo(w,T,k,M)===1-p^D){var z=(u+f)/2;w=l*Math.cos(z),T=l*Math.sin(z),k=M=null}}else w=T=0;if(d>kt&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function qo(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=t[0]+s,f=t[1]+c,d=e[0]+s,p=e[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,T=(-b*v-m*_)/y,k=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=T-g,S=k-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=k,T=M),[[w-s,T-c],[w*r/x,T*r/x]]}function Go(t){var e=ra,r=na,n=Zr,a=Yo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=he(e),p=he(r);function h(){s.push("M",a(t(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Qo,basis:Ko,"basis-open":function(t){if(t.length<4)return Yo(t);var e,r=[],n=-1,a=t.length,i=[0],o=[0];for(;++n<3;)e=t[n],i.push(e[0]),o.push(e[1]);r.push(tl(nl,i)+","+tl(nl,o)),--n;for(;++n9&&(a=3*e/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(t))}});function Yo(t){return t.length>1?t.join("L"):t+"Z"}function Xo(t){return t.join("L")+"Z"}function Wo(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){l=e[1],i=t[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAt)+",1 "+e}function s(t,e,r,n){return"Q 0,0 "+n}return i.radius=function(t){return arguments.length?(r=he(t),i):r},i.source=function(e){return arguments.length?(t=he(e),i):t},i.target=function(t){return arguments.length?(e=he(t),i):e},i.startAngle=function(t){return arguments.length?(n=he(t),i):n},i.endAngle=function(t){return arguments.length?(a=he(t),i):a},i},t.svg.diagonal=function(){var t=Un,e=Vn,r=cl;function n(n,a){var i=t.call(this,n,a),o=e.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(e){return arguments.length?(t=he(e),n):t},n.target=function(t){return arguments.length?(e=he(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=cl,n=e.projection;return e.projection=function(t){return arguments.length?n(ul(r=t)):r},e},t.svg.symbol=function(){var t=dl,e=fl;function r(r,n){return(hl.get(t.call(this,r,n))||pl)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=he(e),r):t},r.size=function(t){return arguments.length?(e=he(t),r):e},r};var hl=t.map({circle:pl,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*vl)),r=e*vl;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/gl),r=e*gl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/gl),r=e*gl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Ot);Z.transition=function(t){for(var e,r,n=bl||++Tl,a=Al(t),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(t,o);if(i>=1)return f.event&&f.event.end.call(t,t.__data__,e),--u.count?delete u[n]:delete t[r],1}f||(i=a.time,o=we((function(t){var e=f.delay;if(o.t=e+i,e<=t)return d(t-e);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,t.transition=function(e,r){return e&&e.transition?bl?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=wl,wl.select=function(t){var e,r,n,a=this.id,i=this.namespace,o=[];t=Y(t);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(t){t.select(".extent").attr("y",s[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=t.select(t.event.target),x=n.of(m,arguments),b=t.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=bt(m),A=t.mouse(m),L=t.select(o(m)).on("keydown.brush",O).on("keyup.brush",D);if(t.event.changedTouches?L.on("touchmove.brush",z).on("touchend.brush",E):L.on("mousemove.brush",z).on("mouseup.brush",E),b.interrupt().selectAll("*").interrupt(),k)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else t.event.altKey&&(f=A.slice());function O(){32==t.event.keyCode&&(k||(f=null,A[0]-=l[1],A[1]-=s[1],k=2),F())}function D(){32==t.event.keyCode&&2==k&&(A[0]+=l[1],A[1]+=s[1],k=0,F())}function z(){var e=t.mouse(m),r=!1;v&&(e[0]+=v[0],e[1]+=v[1]),k||(t.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(e[0]1?{floor:function(e){for(;l(e=t.floor(e));)e=Bl(e-1);return e},ceil:function(e){for(;l(e=t.ceil(e));)e=Bl(+e+1);return e}}:t))},a.ticks=function(t,e){var r=go(a.domain()),n=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Bl(+r[1]+1),e<1?1:e)},a.tickFormat=function(){return n},a.copy=function(){return Nl(e.copy(),r,n)},wo(a,e)}function Bl(t){return new Date(t)}El.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Rl,Fl.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Fl.toString=Rl.toString,ze.second=Re((function(t){return new Pe(1e3*Math.floor(t/1e3))}),(function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))}),(function(t){return t.getSeconds()})),ze.seconds=ze.second.range,ze.seconds.utc=ze.second.utc.range,ze.minute=Re((function(t){return new Pe(6e4*Math.floor(t/6e4))}),(function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))}),(function(t){return t.getMinutes()})),ze.minutes=ze.minute.range,ze.minutes.utc=ze.minute.utc.range,ze.hour=Re((function(t){var e=t.getTimezoneOffset()/60;return new Pe(36e5*(Math.floor(t/36e5-e)+e))}),(function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))}),(function(t){return t.getHours()})),ze.hours=ze.hour.range,ze.hours.utc=ze.hour.utc.range,ze.month=Re((function(t){return(t=ze.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),ze.months=ze.month.range,ze.months.utc=ze.month.utc.range;var Hl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],jl=[[ze.second,1],[ze.second,5],[ze.second,15],[ze.second,30],[ze.minute,1],[ze.minute,5],[ze.minute,15],[ze.minute,30],[ze.hour,1],[ze.hour,3],[ze.hour,6],[ze.hour,12],[ze.day,1],[ze.day,2],[ze.week,1],[ze.month,1],[ze.month,3],[ze.year,1]],Ul=El.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",Zr]]),Vl={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Bl)},floor:O,ceil:O};jl.year=ze.year,ze.scale=function(){return Nl(t.scale.linear(),jl,Ul)};var ql=jl.map((function(t){return[t[0].utc,t[1]]})),Gl=Il.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",Zr]]);function Zl(t){return JSON.parse(t.responseText)}function Yl(t){var e=a.createRange();return e.selectNode(a.body),e.createContextualFragment(t.responseText)}ql.year=ze.year.utc,ze.scale.utc=function(){return Nl(t.scale.linear(),ql,Gl)},t.text=ge((function(t){return t.responseText})),t.json=function(t,e){return ve(t,"application/json",Zl,e)},t.html=function(t,e){return ve(t,"text/html",Yl,e)},t.xml=ge((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],22:[function(t,e,r){(function(n,a){ +"use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){+t!=t&&(t=0);return i.alloc(+t)},r.INSPECT_MAX_BYTES=50;function a(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(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 s(t)}return o(t,e,r)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|f(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(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(N(t,ArrayBuffer)||t&&N(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||N(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 a=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return I(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return R(t).length;default:if(a)return n?-1:I(t).length;e=(""+e).toLowerCase(),a=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 A(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return w(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}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function h(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),B(r=+r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:g(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,a){var i,o=1,l=t.length,s=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,l/=2,s/=2,r/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(a){var u=-1;for(i=r;il&&(r=l-s),i=r;i>=0;i--){for(var f=!0,d=0;da&&(n=a):n=a;var i=e.length;n>i/2&&(n=i/2);for(var o=0;o>8,a=r%256,i.push(a),i.push(n);return i}(e,t.length-r),t,r,n)}function w(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],a=e;a239?4:c>223?3:c>191?2:1;if(a+f<=r)switch(f){case 1:c<128&&(u=c);break;case 2:128==(192&(i=t[a+1]))&&(s=(31&c)<<6|63&i)>127&&(u=s);break;case 3:i=t[a+1],o=t[a+2],128==(192&i)&&128==(192&o)&&(s=(15&c)<<12|(63&i)<<6|63&o)>2047&&(s<55296||s>57343)&&(u=s);break;case 4:i=t[a+1],o=t[a+2],l=t[a+3],128==(192&i)&&128==(192&o)&&128==(192&l)&&(s=(15&c)<<18|(63&i)<<12|(63&o)<<6|63&l)>65535&&s<1114112&&(u=s)}null===u?(u=65533,f=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),a+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},i.prototype.compare=function(t,e,r,n,a){if(N(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.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===a&&(a=this.length),e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(a>>>=0)-(n>>>=0),l=(r>>>=0)-(e>>>=0),s=Math.min(o,l),c=this.slice(n,a),u=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-e;if((void 0===r||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;an)&&(r=n);for(var a="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}function O(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,a,i){return e=+e,r>>>=0,i||O(t,0,r,4),n.write(t,e,r,a,23,4),r+4}function z(t,e,r,a,i){return e=+e,r>>>=0,i||O(t,0,r,8),n.write(t,e,r,a,52,8),r+8}i.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||S(t,e,this.length);for(var n=this[t],a=1,i=0;++i>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t+--e],a=1;e>0&&(a*=256);)n+=this[t+--e]*a;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],a=1,i=0;++i=(a*=128)&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=e,a=1,i=this[t+--n];n>0&&(a*=256);)i+=this[t+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),n.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),n.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),n.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),n.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=r-1,i=1;for(this[e+a]=255&t;--a>=0&&(i*=256);)this[e+a]=t/i&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=0,o=1,l=0;for(this[e]=255&t;++i>0)-l&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=r-1,o=1,l=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===l&&0!==this[e+i+1]&&(l=1),this[e+i]=(t/o>>0)-l&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},i.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return z(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return z(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.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;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return a},i.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&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var a=t.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(t=a)}}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(o=e;o55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function R(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var a=0;a=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function N(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function B(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":15,buffer:18,ieee754:56}],19:[function(t,e,r){!function(n,a){"object"==typeof r&&"undefined"!=typeof e?a(r,t("d3-time")):a((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function n(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function a(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function i(t){var i=t.dateTime,o=t.date,s=t.time,c=t.periods,u=t.days,f=t.shortDays,d=t.months,yt=t.shortMonths,xt=p(c),bt=h(c),_t=p(u),wt=h(u),Tt=p(f),kt=h(f),Mt=p(d),At=h(d),Lt=p(yt),St=h(yt),Ct={a:function(t){return f[t.getDay()]},A:function(t){return u[t.getDay()]},b:function(t){return yt[t.getMonth()]},B:function(t){return d[t.getMonth()]},c:null,d:I,e:I,f:H,H:R,I:F,j:N,L:B,m:j,M:U,p:function(t){return c[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:vt,s:mt,S:V,u:q,U:G,V:Z,w:Y,W:X,x:null,X:null,y:W,Y:Q,Z:J,"%":gt},Ot={a:function(t){return f[t.getUTCDay()]},A:function(t){return u[t.getUTCDay()]},b:function(t){return yt[t.getUTCMonth()]},B:function(t){return d[t.getUTCMonth()]},c:null,d:$,e:$,f:nt,H:K,I:tt,j:et,L:rt,m:at,M:it,p:function(t){return c[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:vt,s:mt,S:ot,u:lt,U:st,V:ct,w:ut,W:ft,x:null,X:null,y:dt,Y:pt,Z:ht,"%":gt},Dt={a:function(t,e,r){var n=Tt.exec(e.slice(r));return n?(t.w=kt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=Lt.exec(e.slice(r));return n?(t.m=St[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=Mt.exec(e.slice(r));return n?(t.m=At[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return Et(t,i,e,r)},d:M,e:M,f:D,H:L,I:L,j:A,L:O,m:k,M:S,p:function(t,e,r){var n=xt.exec(e.slice(r));return n?(t.p=bt[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:P,s:E,S:C,u:v,U:m,V:y,w:g,W:x,x:function(t,e,r){return Et(t,o,e,r)},X:function(t,e,r){return Et(t,s,e,r)},y:_,Y:b,Z:w,"%":z};function zt(t,e){return function(r){var n,a,i,o=[],s=-1,c=0,u=t.length;for(r instanceof Date||(r=new Date(+r));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(l=n(a(c.y,0,1))).getUTCDay(),l=s>4||0===s?e.utcMonday.ceil(l):e.utcMonday(l),l=e.utcDay.offset(l,7*(c.V-1)),c.y=l.getUTCFullYear(),c.m=l.getUTCMonth(),c.d=l.getUTCDate()+(c.w+6)%7):(s=(l=r(a(c.y,0,1))).getDay(),l=s>4||0===s?e.timeMonday.ceil(l):e.timeMonday(l),l=e.timeDay.offset(l,7*(c.V-1)),c.y=l.getFullYear(),c.m=l.getMonth(),c.d=l.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?n(a(c.y,0,1)).getUTCDay():r(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Et(t,e,r,n){for(var a,i,o=0,s=e.length,c=r.length;o=c)return-1;if(37===(a=e.charCodeAt(o++))){if(a=e.charAt(o++),!(i=Dt[a in l?e.charAt(o++):a])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ct.x=zt(o,Ct),Ct.X=zt(s,Ct),Ct.c=zt(i,Ct),Ot.x=zt(o,Ot),Ot.X=zt(s,Ot),Ot.c=zt(i,Ot),{format:function(t){var e=zt(t+="",Ct);return e.toString=function(){return t},e},parse:function(t){var e=Pt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=zt(t+="",Ot);return e.toString=function(){return t},e},utcParse:function(t){var e=Pt(t+="",!0);return e.toString=function(){return t},e}}}var o,l={"-":"",_:" ",0:"0"},s=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(t,e,r){var n=s.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function k(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function M(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function A(t,e,r){var n=s.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function L(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function S(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function C(t,e,r){var n=s.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function O(t,e,r){var n=s.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function D(t,e,r){var n=s.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function z(t,e,r){var n=c.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function P(t,e,r){var n=s.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function E(t,e,r){var n=s.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function I(t,e){return f(t.getDate(),e,2)}function R(t,e){return f(t.getHours(),e,2)}function F(t,e){return f(t.getHours()%12||12,e,2)}function N(t,r){return f(1+e.timeDay.count(e.timeYear(t),t),r,3)}function B(t,e){return f(t.getMilliseconds(),e,3)}function H(t,e){return B(t,e)+"000"}function j(t,e){return f(t.getMonth()+1,e,2)}function U(t,e){return f(t.getMinutes(),e,2)}function V(t,e){return f(t.getSeconds(),e,2)}function q(t){var e=t.getDay();return 0===e?7:e}function G(t,r){return f(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function Z(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function Y(t){return t.getDay()}function X(t,r){return f(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function W(t,e){return f(t.getFullYear()%100,e,2)}function Q(t,e){return f(t.getFullYear()%1e4,e,4)}function J(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+f(e/60|0,"0",2)+f(e%60,"0",2)}function $(t,e){return f(t.getUTCDate(),e,2)}function K(t,e){return f(t.getUTCHours(),e,2)}function tt(t,e){return f(t.getUTCHours()%12||12,e,2)}function et(t,r){return f(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return f(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function at(t,e){return f(t.getUTCMonth()+1,e,2)}function it(t,e){return f(t.getUTCMinutes(),e,2)}function ot(t,e){return f(t.getUTCSeconds(),e,2)}function lt(t){var e=t.getUTCDay();return 0===e?7:e}function st(t,r){return f(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ct(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ut(t){return t.getUTCDay()}function ft(t,r){return f(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function dt(t,e){return f(t.getUTCFullYear()%100,e,2)}function pt(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function ht(){return"+0000"}function gt(){return"%"}function vt(t){return+t}function mt(t){return Math.floor(+t/1e3)}function yt(e){return o=i(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var bt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=xt,t.isoParse=bt,t.timeFormatDefaultLocale=yt,t.timeFormatLocale=i,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":20}],20:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,a,i,o){function l(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return l.floor=function(e){return t(e=new Date(+e)),e},l.ceil=function(e){return t(e=new Date(e-1)),a(e,1),t(e),e},l.round=function(t){var e=l(t),r=l.ceil(t);return t-e0))return o;do{o.push(i=new Date(+e)),a(e,n),t(e)}while(i=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;a(t,-1),!e(t););else for(;--r>=0;)for(;a(t,1),!e(t););}))},i&&(l.count=function(n,a){return e.setTime(+n),r.setTime(+a),t(e),t(r),Math.floor(i(e,r))},l.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?l.filter(o?function(e){return o(e)%t==0}:function(e){return l.count(0,e)%t==0}):l:null}),l}var a=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));a.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):a:null};var i=a.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),l=o.range,s=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),c=s.range,u=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),f=u.range,d=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),p=d.range;function h(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var g=h(0),v=h(1),m=h(2),y=h(3),x=h(4),b=h(5),_=h(6),w=g.range,T=v.range,k=m.range,M=y.range,A=x.range,L=b.range,S=_.range,C=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),O=C.range,D=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));D.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var z=D.range,P=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),E=P.range,I=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),R=I.range,F=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),N=F.range;function B(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var H=B(0),j=B(1),U=B(2),V=B(3),q=B(4),G=B(5),Z=B(6),Y=H.range,X=j.range,W=U.range,Q=V.range,J=q.range,$=G.range,K=Z.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=d,t.timeDays=p,t.timeFriday=b,t.timeFridays=L,t.timeHour=u,t.timeHours=f,t.timeInterval=n,t.timeMillisecond=a,t.timeMilliseconds=i,t.timeMinute=s,t.timeMinutes=c,t.timeMonday=v,t.timeMondays=T,t.timeMonth=C,t.timeMonths=O,t.timeSaturday=_,t.timeSaturdays=S,t.timeSecond=o,t.timeSeconds=l,t.timeSunday=g,t.timeSundays=w,t.timeThursday=x,t.timeThursdays=A,t.timeTuesday=m,t.timeTuesdays=k,t.timeWednesday=y,t.timeWednesdays=M,t.timeWeek=g,t.timeWeeks=w,t.timeYear=D,t.timeYears=z,t.utcDay=F,t.utcDays=N,t.utcFriday=G,t.utcFridays=$,t.utcHour=I,t.utcHours=R,t.utcMillisecond=a,t.utcMilliseconds=i,t.utcMinute=P,t.utcMinutes=E,t.utcMonday=j,t.utcMondays=X,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=Z,t.utcSaturdays=K,t.utcSecond=o,t.utcSeconds=l,t.utcSunday=H,t.utcSundays=Y,t.utcThursday=q,t.utcThursdays=J,t.utcTuesday=U,t.utcTuesdays=W,t.utcWednesday=V,t.utcWednesdays=Q,t.utcWeek=H,t.utcWeeks=Y,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],21:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},a=this.document;function i(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(t,e){s.call(this,t,e+"")},l.setAttributeNS=function(t,e,r){c.call(this,t,e,r+"")},u.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function d(t,e){return te?1:t>=e?0:NaN}function p(t){return null===t?NaN:+t}function h(t){return!isNaN(t)}function g(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+1}return n}}}t.ascending=d,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},t.max=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},t.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var v=g(d);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 d(t(e),r)}:t)},t.shuffle=function(t,e,r){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+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],a=new Array(r<0?0:r);e=0;)for(e=(n=t[a]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function x(t){for(var e=1;t*e%1;)e*=10;return e}function b(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){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,a=[],i=x(y(r)),o=-1;if(t*=i,e*=i,(r*=i)<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=a.length)return r?r.call(n,i):e?i.sort(e):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return e;var n=[],o=i[r++];return e.forEach((function(e,a){n.push({key:e,values:t(a,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 a.push(t),n},n.sortKeys=function(t){return i[a.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(H,"\\$&")};var H=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,j={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function U(t){return j(t,Z),t}var V=function(t,e){return e.querySelector(t)},q=function(t,e){return e.querySelectorAll(t)},G=function(t,e){var r=t.matches||t[z(t,"matchesSelector")];return(G=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(V=function(t,e){return Sizzle(t,e)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),t.selection=function(){return t.select(a.documentElement)};var Z=t.selection.prototype=[];function Y(t){return"function"==typeof t?t:function(){return V(t,this)}}function X(t){return"function"==typeof t?t:function(){return q(t,this)}}Z.select=function(t){var e,r,n,a,i=[];t=Y(t);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Q.hasOwnProperty(r)?{space:Q[r],local:t}:t}},Z.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))},Z.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(t){t=ct.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=a+1);!(o=l[e])&&++e0&&(e=e.slice(0,o));var s=gt.get(e);function c(){var t=this[i];t&&(this.removeEventListener(e,t,t.$),delete this[i])}return s&&(e=s,l=mt),o?r?function(){var t=l(r,n(arguments));c.call(this),this.addEventListener(e,this[i]=t,t.$=a),t._=r}:c:r?E:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}t.selection.enter=ft,t.selection.enter.prototype=dt,dt.append=Z.append,dt.empty=Z.empty,dt.node=Z.node,dt.call=Z.call,dt.size=Z.size,dt.select=function(t){for(var e,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:t<0?-1:0}function Pt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Et(t){return t>1?0:t<-1?At:Math.acos(t)}function It(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Rt(t){return((t=Math.exp(t))+1/t)/2}function Ft(t){return(t=Math.sin(t/2))*t}var Nt=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,a=t[0],i=t[1],o=t[2],l=e[0],s=e[1],c=e[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(e=e.transition().duration(g)),e.call(w.event)}function L(){c&&c.domain(s.range().map((function(t){return(t-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(t){return(t-d.y)/d.k})).map(u.invert))}function S(t){v++||t({type:"zoomstart"})}function C(t){L(),t({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function O(t){--v||(t({type:"zoomend"}),r=null)}function D(){var e=this,r=_.of(e,arguments),n=0,a=t.select(o(e)).on(y,s).on(x,c),i=T(t.mouse(e)),l=bt(e);function s(){n=1,M(t.mouse(e),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),O(r)}ml.call(e),S(r)}function z(){var e,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+t.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=t.select(r),p=bt(r);function h(){var n=t.touches(r);return e=d.k,n.forEach((function(t){t.identifier in a&&(a[t.identifier]=T(t))})),n}function g(){var e=t.event.target;t.select(e).on(s,v).on(c,y),u.push(e);for(var n=t.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=t.touches(r);ml.call(r);for(var d=0,p=f.length;d360?t-=360:t<0&&(t+=360),t<60?n+(a-n)*t/60:t<180?a:t<240?n+(a-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)||e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+e):r+e-r*e),new ne(i(t+120),i(t),i(t-120))}function Zt(e,r,n){return this instanceof Zt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Zt?new Zt(e.h,e.c,e.l):Kt(e instanceof Wt?e.l:(e=ue((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Zt(e,r,n)}qt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Vt(this.h,this.s,this.l/t)},qt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Vt(this.h,this.s,t*this.l)},qt.rgb=function(){return Gt(this.h,this.s,this.l)},t.hcl=Zt;var Yt=Zt.prototype=new Ut;function Xt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Wt(r,Math.cos(t*=Ot)*e,Math.sin(t)*e)}function Wt(t,e,r){return this instanceof Wt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Wt?new Wt(t.l,t.a,t.b):t instanceof Zt?Xt(t.h,t.c,t.l):ue((t=ne(t)).r,t.g,t.b):new Wt(t,e,r)}Yt.brighter=function(t){return new Zt(this.h,this.c,Math.min(100,this.l+Qt*(arguments.length?t:1)))},Yt.darker=function(t){return new Zt(this.h,this.c,Math.max(0,this.l-Qt*(arguments.length?t:1)))},Yt.rgb=function(){return Xt(this.h,this.c,this.l).rgb()},t.lab=Wt;var Qt=18,Jt=Wt.prototype=new Ut;function $t(t,e,r){var n=(t+16)/116,a=n+e/500,i=n-r/200;return new ne(re(3.2404542*(a=.95047*te(a))-1.5371385*(n=1*te(n))-.4985314*(i=1.08883*te(i))),re(-.969266*a+1.8760108*n+.041556*i),re(.0556434*a-.2040259*n+1.0572252*i))}function Kt(t,e,r){return t>0?new Zt(Math.atan2(r,e)*Dt,Math.sqrt(e*e+r*r),t):new Zt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):se(""+t,ne,Gt):new ne(t,e,r)}function ae(t){return new ne(t>>16,t>>8&255,255&t)}function ie(t){return ae(t)+""}Jt.brighter=function(t){return new Wt(Math.min(100,this.l+Qt*(arguments.length?t:1)),this.a,this.b)},Jt.darker=function(t){return new Wt(Math.max(0,this.l-Qt*(arguments.length?t:1)),this.a,this.b)},Jt.rgb=function(){return $t(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Ut;function le(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function se(t,e,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(de(a[0]),de(a[1]),de(a[2]))}return(i=pe.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===t.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),e(o,l,s))}function ce(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=t==o?(e-r)/l+(e0&&s<1?0:n),new Vt(n,a,s)}function ue(t,e,r){var n=ee((.4124564*(t=fe(t))+.3575761*(e=fe(e))+.1804375*(r=fe(r)))/.95047),a=ee((.2126729*t+.7151522*e+.072175*r)/1);return Wt(116*a-16,500*(n-a),200*(a-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function de(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,a=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=a.call(o,c)}catch(t){return void l.error.call(o,t)}l.load.call(o,t)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(e)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(e){var r=t.event;t.event=e;try{l.progress.call(o,c)}finally{t.event=r}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",o):r},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return a=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}})),o.send=function(t,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(t,e,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(t){a(null,t)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},t.rebind(o,l,"on"),null==i?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(i))}pe.forEach((function(t,e){pe.set(t,ae(e))})),t.functor=he,t.xhr=ge(O),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function a(t,r,n){arguments.length<3&&(n=r,r=null);var a=ve(t,e,null==r?i:o(r),n);return a.row=function(t){return arguments.length?a.response(null==(r=t)?i:o(t)):r},a}function i(t){return a.parse(t.responseText)}function o(t){return function(e){return a.parse(e.responseText,t)}}function l(e){return e.map(s).join(t)}function s(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return a.parse=function(t,e){var r;return a.parseRows(t,(function(t,n){if(r)return r(t,n-1);var a=new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+"]"})).join(",")+"}");r=e?function(t,r){return e(a(t),r)}:a}))},a.parseRows=function(t,e){var r,a,i={},o={},l=[],s=t.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(be),be=setTimeout(Te,e)),xe=0):(xe=1,_e(Te))}function ke(){for(var t=Date.now(),e=me;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Me(){for(var t,e=me,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Se(e){var r=e.decimal,n=e.thousands,a=e.grouping,i=e.currency,o=a&&n?function(t,e){for(var r=t.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>e&&(l=Math.max(1,e-s)),i.push(t.substring(r-=l,r+l)),!((s+=l+1)>e));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:O;return function(e){var n=Ce.exec(e),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Oe.get(h)||De;var b=u&&d;return function(e){var n=m;if(y&&e%1)return"";var i=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===s?"":s;if(g<0){var c=t.formatPrefix(e,p);e=c.scale(e),n=c.symbol+m}else e*=g;var _,w,T=(e=h(e,p)).lastIndexOf(".");if(T<0){var k=x?e.lastIndexOf("e"):-1;k<0?(_=e,w=""):(_=e.substring(0,k),w=e.substring(k))}else _=e.substring(0,T),w=r+e.substring(T+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+e:"^"===l?A.substring(0,M>>=1)+i+e+A.substring(M):i+(b?e:A+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Ae(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,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,Ae(e,r))).toFixed(Math.max(0,Math.min(20,Ae(e*(1+1e-15),r))))}});function De(t){return t+""}var ze=t.time={},Pe=Date;function Ee(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Ee.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(){Ie.setUTCDate.apply(this._,arguments)},setDay:function(){Ie.setUTCDay.apply(this._,arguments)},setFullYear:function(){Ie.setUTCFullYear.apply(this._,arguments)},setHours:function(){Ie.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Ie.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Ie.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Ie.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Ie.setUTCSeconds.apply(this._,arguments)},setTime:function(){Ie.setTime.apply(this._,arguments)}};var Ie=Date.prototype;function Re(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=c)return-1;if(37===(a=e.charCodeAt(l++))){if(o=e.charAt(l++),!(i=w[o in Be?e.charAt(l++):o])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(t){var e=u(t);function r(t){try{var r=new(Pe=Ee);return r._=t,e(r)}finally{Pe=Date}}return r.parse=function(t){try{Pe=Ee;var r=e.parse(t);return r&&r._}finally{Pe=Date}},r.toString=e.toString,r},u.multi=u.utc.multi=or;var d=t.map(),p=Ve(o),h=qe(o),g=Ve(l),v=qe(l),m=Ve(s),y=qe(s),x=Ve(c),b=qe(c);i.forEach((function(t,e){d.set(t.toLowerCase(),e)}));var _={a:function(t){return l[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:u(r),d:function(t,e){return Ue(t.getDate(),e,2)},e:function(t,e){return Ue(t.getDate(),e,2)},H:function(t,e){return Ue(t.getHours(),e,2)},I:function(t,e){return Ue(t.getHours()%12||12,e,2)},j:function(t,e){return Ue(1+ze.dayOfYear(t),e,3)},L:function(t,e){return Ue(t.getMilliseconds(),e,3)},m:function(t,e){return Ue(t.getMonth()+1,e,2)},M:function(t,e){return Ue(t.getMinutes(),e,2)},p:function(t){return i[+(t.getHours()>=12)]},S:function(t,e){return Ue(t.getSeconds(),e,2)},U:function(t,e){return Ue(ze.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ue(ze.mondayOfYear(t),e,2)},x:u(n),X:u(a),y:function(t,e){return Ue(t.getFullYear()%100,e,2)},Y:function(t,e){return Ue(t.getFullYear()%1e4,e,4)},Z:ar,"%":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){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.m=b.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:$e,e:$e,H:tr,I:tr,j:Ke,L:nr,m:Je,M:er,p:function(t,e,r){var n=d.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:Ze,w:Ge,W:Ye,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:We,Y:Xe,Z:Qe,"%":ir};return u}ze.year=Re((function(t){return(t=ze.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),ze.years=ze.year.range,ze.years.utc=ze.year.utc.range,ze.day=Re((function(t){var e=new Pe(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),ze.days=ze.day.range,ze.days.utc=ze.day.utc.range,ze.dayOfYear=function(t){var e=ze.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=ze[t]=Re((function(t){return(t=ze.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=ze.year(t).getDay();return Math.floor((ze.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));ze[t+"s"]=r.range,ze[t+"s"].utc=r.utc.range,ze[t+"OfYear"]=function(t){var r=ze.year(t).getDay();return Math.floor((ze.dayOfYear(t)+(r+e)%7)/7)}})),ze.week=ze.sunday,ze.weeks=ze.sunday.range,ze.weeks.utc=ze.sunday.utc.range,ze.weekOfYear=ze.sundayOfYear;var Be={"-":"",_:" ",0:"0"},He=/^\s*\d+/,je=/^%/;function Ue(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+a[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){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function $e(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Ke(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){He.lastIndex=0;var n=He.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ar(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,a=y(e)%60;return r+Ue(n,"0",2)+Ue(a,"0",2)}function ir(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(t){for(var e=t.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(e),c=Math.sin(e),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=t,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(t=o)*Ot,n=Math.cos(l=(e=l)*Ot/2+At/4),a=Math.sin(l)},Cr.lineEnd=function(){i(t,e)}}function Dr(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 zr(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 Er(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 Rr(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 Fr(t){return[Math.atan2(t[1],t[0]),It(t[2])]}function Nr(t,e){return y(t[0]-e[0])kt?a=90:c<-kt&&(r=-90),f[0]=e,f[1]=n}};function p(t,i){u.push(f=[e=t,n=t]),ia&&(a=i)}function h(t,o){var l=Dr([t*Ot,o*Ot]);if(s){var c=Pr(s,l),u=Pr([c[1],-c[0],0],c);Rr(u),u=Fr(u);var f=t-i,d=f>0?1:-1,h=u[0]*Dt*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>i?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else p(t,o);s=l,i=t}function g(){d.point=h}function v(){f[0]=e,f[1]=n,d.point=p,s=null}function m(t,e){if(s){var r=t-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=t,l=e;Cr.point(t,e),h(t,e)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>kt&&(e=-(n=180)),f[0]=e,f[1]=n,s=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function T(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,e=p[0],n=g[1])}return u=f=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,a]]}}(),t.geo.centroid=function(e){mr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Lr=0,t.geo.stream(e,Br);var r=Mr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Xr(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n=0?1:-1,T=w*_,k=T>At,M=h*x;if(Sr.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*Lt:_,k^d>=r^m>=r){var A=Pr(Dr(f),Dr(t));Rr(A);var L=Pr(a,A);Rr(L);var S=(k^_>=0?-1:1)*It(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=t}}return(i<-kt||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&e&&r.push(r.pop().concat(r.shift())),l.push(r.filter(Jr))}return u}}function Jr(t){return t.length>1}function $r(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:E,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]-Ct-kt:Ct-t[1])-((e=e.x)[0]<0?e[1]-Ct-kt:Ct-e[1])}var tn=Qr(Zr,(function(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var l=i>0?At:-At,s=y(i-r);y(s-At)0?Ct:-Ct),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(l,n),t.point(i,n),e=0):a!==l&&s>=At&&(y(r-a)kt?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}(r,n,i,o),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(l,n),e=0),t.point(r=i,n=o),a=l},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var a;if(null==t)a=r*Ct,n.point(-At,a),n.point(0,a),n.point(At,a),n.point(At,0),n.point(At,-a),n.point(0,-a),n.point(-At,-a),n.point(-At,0),n.point(-At,a);else if(y(t[0]-e[0])>kt){var i=t[0]0,n=y(e)>kt;return Qr(a,(function(t){var e,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?At:-At),d):0;if(!e&&(c=s=g)&&t.lineStart(),g!==s&&(p=i(e,h),(Nr(e,p)||Nr(h,p))&&(h[0]+=kt,h[1]+=kt,g=a(h[0],h[1]))),g!==s)u=0,g?(t.lineStart(),p=i(h,e),t.point(p[0],p[1])):(p=i(e,h),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(n&&e&&r^g){var m;v&l||!(m=i(h,e,!0))||(u=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&&Nr(e,h)||t.point(h[0],h[1]),e=h,s=g,l=v},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return u|(c&&s)<<1}}}),Nn(t,6*Ot),r?[0,-t]:[-At,t-At]);function a(t,r){return Math.cos(t)*Math.cos(r)>e}function i(t,r,n){var a=[1,0,0],i=Pr(Dr(t),Dr(r)),o=zr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&t;var c=e*o/s,u=-e*l/s,f=Pr(a,i),d=Ir(a,c);Er(d,Ir(i,u));var p=f,h=zr(d,p),g=zr(p,p),v=h*h-g*(zr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Ir(p,(-h-m)/g);if(Er(x,d),x=Fr(x),!n)return x;var b,_=t[0],w=r[0],T=t[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-At)0^x[1]<(y(x[0]-_)At^(_<=x[0]&&x[0]<=w)){var L=Ir(p,(-h+m)/g);return Er(L,d),[x,Fr(L)]}}}function o(e,n){var a=r?t:At-t,i=0;return e<-a?i|=1:e>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(t,e,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=t-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(e,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=$r(),w=rn(e,r,n,a),T={point:A,lineStart:function(){T.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));T.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=t.merge(c);var r=function(t){for(var e=0,r=u.length,n=t[1],a=0;an&&Pt(c,i,t)>0&&++e:i[1]<=n&&Pt(c,i,t)<0&&--e,c=i;return 0!==e}([e,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),i&&Yr(c,o,r,k,s),s.polygonEnd()),c=u=f=null}};function k(t,o,s,c){var u=0,f=0;if(null==t||(u=i(t,s))!==(f=i(o,s))||l(t,o)<0^s>0)do{c.point(0===u||3===u?e:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(t,i){return e<=t&&t<=n&&r<=i&&i<=a}function A(t,e){M(t,e)&&s.point(t,e)}function L(t,e){var r=M(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(u&&f.push([t,e]),y)d=t,p=e,h=r,y=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&m)s.point(t,e);else{var n={a:{x:g,y:v},b:{x:t,y:e}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(t,e),x=!1)}g=t,v=e,m=r}return T};function i(t,a){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:a>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var r=i(t,1),n=i(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=At/3,n=On(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*At/180,r=t[1]*At/180):[e/At*180,r/At*180]},a}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(t,e){var r=Math.sqrt(a-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),i-r*Math.cos(t)]}return o.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/n,It((a-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,a,i,o={stream:function(t){return a&&(a.valid=!1),(a=i(t)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(t=+l[0][0],e=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=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,a,i=t.geo.albers(),o=t.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=t.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(t,r){e=[t,r]}};function c(t){var i=t[0],o=t[1];return e=null,r(i,o),e||(n(i,o),e)||a(i,o),e}return c.invert=function(t){var e=i.scale(),r=i.translate(),n=(t[0]-r[0])/e,a=(t[1]-r[1])/e;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(t)},c.stream=function(t){var e=i.stream(t),r=o.stream(t),n=l.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},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()}}},c.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),l.precision(t),c):i.precision()},c.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),l.scale(t),c.translate(i.translate())):i.scale()},c.translate=function(t){if(!arguments.length)return i.translate();var e=i.scale(),u=+t[0],f=+t[1];return r=i.translate(t).clipExtent([[u-.455*e,f-.238*e],[u+.455*e,f+.238*e]]).stream(s).point,n=o.translate([u-.307*e,f+.201*e]).clipExtent([[u-.425*e+kt,f+.12*e+kt],[u-.214*e-kt,f+.234*e-kt]]).stream(s).point,a=l.translate([u-.205*e,f+.212*e]).clipExtent([[u-.214*e+kt,f+.166*e+kt],[u-.115*e-kt,f+.234*e-kt]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:E,lineStart:E,lineEnd:E,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=E,ln+=y(sn/2)}};function hn(){var t,e,r,n;function a(t,e){sn+=n*t-r*e,r=t,n=e}pn.point=function(i,o){pn.point=a,t=r=i,e=n=o},pn.lineEnd=function(){a(t,e)}}var gn={point:function(t,e){tfn&&(fn=t);edn&&(dn=e)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E};function vn(){var t=mn(4.5),e=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},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 a(t,n){e.push("M",t,",",n),r.point=i}function i(t,r){e.push("L",t,",",r)}function o(){r.point=n}function l(){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,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(t,e){xr+=t,br+=e,++_r}function _n(){var t,e;function r(r,n){var a=r-t,i=n-e,o=Math.sqrt(a*a+i*i);wr+=o*(t+r)/2,Tr+=o*(e+n)/2,kr+=o,bn(t=r,e=n)}xn.point=function(n,a){xn.point=r,bn(t=n,e=a)}}function wn(){xn.point=bn}function Tn(){var t,e,r,n;function a(t,e){var a=t-r,i=e-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+t)/2,Tr+=o*(n+e)/2,kr+=o,Mr+=(o=n*t-r*e)*(r+t),Ar+=o*(n+e),Lr+=3*o,bn(r=t,n=e)}xn.point=function(i,o){xn.point=a,bn(t=r=i,e=n=o)},xn.lineEnd=function(){a(t,e)}}function kn(t){var e=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=t,r},result:E};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,Lt)}function a(e,n){t.moveTo(e,n),r.point=i}function i(e,r){t.lineTo(e,r)}function o(){r.point=n}function l(){t.closePath()}return r}function Mn(t){var e=.5,r=Math.cos(30*Ot),n=16;function a(t){return(n?o:i)(t)}function i(e){return Sn(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,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=x,e.lineStart()}function x(r,a){var i=Dr([r,a]),o=t(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,e),e.point(f,d)}function b(){v.point=m,e.lineEnd()}function _(){y(),v.point=w,v.lineEnd=T}function w(t,e){x(r=t,e),a=f,i=d,o=p,s=h,c=g,v.point=x}function T(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,e),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*e&&v--){var w=o+p,T=s+h,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),L=y(y(k)-1)e||y((x*D+b*z)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(e)},a}function An(t){var e=Mn((function(e,r){return t([e*Dt,r*Dt])}));return function(t){return Dn(e(t))}}function Ln(t){this.stream=t}function Sn(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 Cn(t){return On((function(){return t}))()}function On(e){var r,n,a,i,o,l,s=Mn((function(t,e){return[(t=r(t,e))[0]*c+i,o-t[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=tn,y=O,x=null,b=null;function _(t){return[(t=a(t[0]*Ot,t[1]*Ot))[0]*c+i,o-t[1]*c]}function w(t){return(t=a.invert((t[0]-i)/c,(o-t[1])/c))&&[t[0]*Dt,t[1]*Dt]}function T(){a=Gr(n=En(h,g,v),r);var t=r(d,p);return i=u-t[0]*c,o=f+t[1]*c,k()}function k(){return l&&(l.valid=!1,l=null),_}return _.stream=function(t){return l&&(l.valid=!1),(l=Dn(m(n,s(y(t))))).valid=!0,l},_.clipAngle=function(t){return arguments.length?(m=null==t?(x=t,tn):en((x=+t)*Ot),k()):x},_.clipExtent=function(t){return arguments.length?(b=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):O,k()):b},_.scale=function(t){return arguments.length?(c=+t,T()):c},_.translate=function(t){return arguments.length?(u=+t[0],f=+t[1],T()):[u,f]},_.center=function(t){return arguments.length?(d=t[0]%360*Ot,p=t[1]%360*Ot,T()):[d*Dt,p*Dt]},_.rotate=function(t){return arguments.length?(h=t[0]%360*Ot,g=t[1]%360*Ot,v=t.length>2?t[2]%360*Ot:0,T()):[h*Dt,g*Dt,v*Dt]},t.rebind(_,s,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,T()}}function Dn(t){return Sn(t,(function(e,r){t.point(e*Ot,r*Ot)}))}function zn(t,e){return[t,e]}function Pn(t,e){return[t>At?t-Lt:t<-At?t+Lt:t,e]}function En(t,e,r){return t?e||r?Gr(Rn(t),Fn(e,r)):Rn(t):e||r?Fn(e,r):Pn}function In(t){return function(e,r){return[(e+=t)>At?e-Lt:e<-At?e+Lt:e,r]}}function Rn(t){var e=In(t);return e.invert=In(-t),e}function Fn(t,e){var r=Math.cos(t),n=Math.sin(t),a=Math.cos(e),i=Math.sin(e);function o(t,e){var o=Math.cos(e),l=Math.cos(t)*o,s=Math.sin(t)*o,c=Math.sin(e),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),It(u*a+s*i)]}return o.invert=function(t,e){var o=Math.cos(e),l=Math.cos(t)*o,s=Math.sin(t)*o,c=Math.sin(e),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),It(u*r-l*n)]},o}function Nn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,l){var s=o*e;null!=a?(a=Bn(r,a),i=Bn(r,i),(o>0?ai)&&(a+=o*Lt)):(a=t+o*Lt,i=t-.5*s);for(var c,u=a;o>0?u>i:u2?t[2]*Ot:0),e.invert=function(e){return(e=t.invert(e[0]*Ot,e[1]*Ot))[0]*=Dt,e[1]*=Dt,e},e},Pn.invert=zn,t.geo.circle=function(){var t,e,r=[0,0],n=6;function a(){var t="function"==typeof r?r.apply(this,arguments):r,n=En(-t[0]*Ot,-t[1]*Ot,0).invert,a=[];return e(null,null,1,{point:function(t,e){a.push(t=n(t,e)),t[0]*=Dt,t[1]*=Dt}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(t){return arguments.length?(r=t,a):r},a.angle=function(r){return arguments.length?(e=Nn((t=+r)*Ot,n*Ot),a):t},a.precision=function(r){return arguments.length?(e=Nn(t*Ot,(n=+r)*Ot),a):n},a.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ot,a=t[1]*Ot,i=e[1]*Ot,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},t.geo.graticule=function(){var e,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return t.range(Math.ceil(a/g)*g,n,g).map(f).concat(t.range(Math.ceil(s/v)*v,l,v).map(d)).concat(t.range(Math.ceil(r/p)*p,e,p).filter((function(t){return y(t%g)>kt})).map(c)).concat(t.range(Math.ceil(o/h)*h,i,h).filter((function(t){return y(t%v)>kt})).map(u))}return x.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(a=+t[0][0],n=+t[1][0],s=+t[0][1],l=+t[1][1],a>n&&(t=a,a=n,n=t),s>l&&(t=s,s=l,l=t),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],i=+t[1][1],r>e&&(t=r,r=e,e=t),o>i&&(t=o,o=i,i=t),x.precision(m)):[[r,o],[e,i]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],x):[g,v]},x.minorStep=function(t){return arguments.length?(p=+t[0],h=+t[1],x):[p,h]},x.precision=function(t){return arguments.length?(m=+t,c=Hn(o,i,90),u=jn(r,e,m),f=Hn(s,l,90),d=jn(a,n,m),x):m},x.majorExtent([[-180,-90+kt],[180,90-kt]]).minorExtent([[-180,-80-kt],[180,80+kt]])},t.geo.greatArc=function(){var e,r,n=Un,a=Vn;function i(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,i):n},i.target=function(t){return arguments.length?(a=t,r="function"==typeof t?null:t,i):a},i.precision=function(){return arguments.length?i:0},i},t.geo.interpolate=function(t,e){return r=t[0]*Ot,n=t[1]*Ot,a=e[0]*Ot,i=e[1]*Ot,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Ft(i-n)+o*s*Ft(a-r))),g=1/Math.sin(h),(v=h?function(t){var e=Math.sin(t*=h)*g,r=Math.sin(h-t)*g,n=r*u+e*d,a=r*f+e*p,i=r*l+e*c;return[Math.atan2(a,n)*Dt,Math.atan2(i,Math.sqrt(n*n+a*a))*Dt]}:function(){return[r*Dt,n*Dt]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},t.geo.length=function(e){return yn=0,t.geo.stream(e,qn),yn};var qn={sphere:E,point:E,lineStart:function(){var t,e,r;function n(n,a){var i=Math.sin(a*=Ot),o=Math.cos(a),l=y((n*=Ot)-t),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-e*o*s)*l),e*i+r*o*s),t=n,e=i,r=o}qn.point=function(a,i){t=a*Ot,e=Math.sin(i*=Ot),r=Math.cos(i),qn.point=n},qn.lineEnd=function(){qn.point=qn.lineEnd=E}},lineEnd:E,polygonStart:E,polygonEnd:E};function Gn(t,e){function r(e,r){var n=Math.cos(e),a=Math.cos(r),i=t(n*a);return[i*a*Math.sin(e),i*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),a=e(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(t*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Yn=Gn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),O);function Xn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(At/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),i=r*Math.pow(n(t),a)/a;if(!a)return Jn;function o(t,e){i>0?e<-Ct+kt&&(e=-Ct+kt):e>Ct-kt&&(e=Ct-kt);var r=i/Math.pow(n(e),a);return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}return o.invert=function(t,e){var r=i-e,n=zt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ct]},o}function Wn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/n+t;if(y(n)1&&Pt(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Cn(ta)}).raw=ta,ea.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=$n(ea),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=ea,t.geom={},t.geom.hull=function(t){var e=ra,r=na;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,a=he(e),i=he(r),o=t.length,l=[],s=[];for(n=0;n=0;--n)p.push(t[l[c[n]][2]]);for(n=+f;nkt)l=l.L;else{if(!((a=i-Ta(l,o))>kt)){n>-kt?(e=l.P,r=l):a>-kt?(e=l,r=l.N):e=r=l;break}if(!l.R){e=l;break}l=l.R}var s=ya(t);if(da.insert(e,s),e||r){if(e===r)return Sa(e),r=ya(e.site),da.insert(s,r),s.edge=r.edge=Da(e.site,s.site),La(e),void La(r);if(r){Sa(e),Sa(r);var c=e.site,u=c.x,f=c.y,d=t.x-u,p=t.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};Pa(r.edge,c,h,b),s.edge=Da(c,t,null,b),r.edge=Da(t,h,null,b),La(e),La(r)}else s.edge=Da(e.site,s.site)}}function wa(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)return n;var o=t.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-e;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function Ta(t,e){var r=t.N;if(r)return wa(r,e);var n=t.site;return n.y===e?n.x:1/0}function ka(t){this.site=t,this.edges=[]}function Ma(t,e){return e.angle-t.angle}function Aa(){Ra(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,a=t.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Mt)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=t,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,t.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xkt||y(a-r)>kt)&&(l.splice(o,0,new Ea(za(i.site,u,y(n-f)kt?{x:f,y:y(e-f)kt?{x:y(r-h)kt?{x:d,y:y(e-d)kt?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=t[l]})),e}function l(t){return t.map((function(t,e){return{x:Math.round(n(t,e)/kt)*kt,y:Math.round(a(t,e)/kt)*kt,i:e}}))}return o.links=function(t){return Ha(l(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 Ha(l(t)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|e>=b,T=w+4;wi&&(a=e.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=$a.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,T=v-h;function k(t,e,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var s=t.x,c=t.y;if(null!=s)if(y(s-r)+y(c-n)<.01)M(t,e,r,n,a,i,o,l);else{var u=t.point;t.x=t.y=t.point=null,M(t,u,s,c,a,i,o,l),M(t,e,r,n,a,i,o,l)}else t.x=r,t.y=n,t.point=e}else M(t,e,r,n,a,i,o,l)}function M(t,e,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;t.leaf=!1,u?a=s:o=s,f?i=c:l=c,k(t=t.nodes[d]||(t.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,a,i,o,l)}w>T?v=h+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(A,t,+m(t,++f),+x(t,f),p,h,g,v)},visit:function(t){Ga(t,A,p,h,g,v)},find:function(t){return Za(A,t[0],t[1],p,h,g,v)}};if(f=-1,null==e){for(;++f=0&&!(n=t.interpolators[a](e,r)););return n}function ti(t,e){var r,n=[],a=[],i=t.length,o=e.length,l=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function ii(t){return function(e){return 1-t(1-e)}}function oi(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function li(t){return t*t}function si(t){return t*t*t}function ci(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ui(t){return 1-Math.cos(t*Ct)}function fi(t){return Math.pow(2,10*(t-1))}function di(t){return 1-Math.sqrt(1-t*t)}function pi(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 hi(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function gi(t){var e,r,n,a=[t.a,t.b],i=[t.c,t.d],o=mi(a),l=vi(a,i),s=mi(((e=i)[0]+=(n=-l)*(r=a)[0],e[1]+=n*r[1],e))||0;a[0]*i[1]=0?t.slice(0,e):t,a=e>=0?t.slice(e+1):"in";return n=ri.get(n)||ei,ai((a=ni.get(a)||O)(n.apply(null,r.call(arguments,1))))},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,a=e.c,i=e.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Xt(n+o*t,a+l*t,i+s*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,a=e.s,i=e.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Gt(n+o*t,a+l*t,i+s*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,a=e.a,i=e.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(t){return $t(n+o*t,a+l*t,i+s*t)+""}},t.interpolateRound=hi,t.transform=function(e){var r=a.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 gi(e?e.matrix:yi)})(e)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(t){return t.length?t.pop()+",":""}function bi(e,r){var n=[],a=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(t[0],e[0])},{i:a-2,x:Wa(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,a),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(t,e)})):e&&r.push(xi(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,a),function(t,e,r,n){t!==e?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(t,e)}):e&&r.push(xi(r)+"skewX("+e+")")}(e.skew,r.skew,n,a),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(t[0],e[0])},{i:a-2,x:Wa(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(xi(r)+"scale("+e+")")}(e.scale,r.scale,n,a),e=r=null,function(t){for(var e,r=-1,i=a.length;++r0?n=t:(e.c=null,e.t=NaN,e=null,s.end({type:"end",alpha:n=0})):t>0&&(s.start({type:"start",alpha:n=t}),e=we(l.tick)),l):n},l.start=function(){var t,e,r,n=m.length,s=y.length,u=c[0],h=c[1];for(t=0;t=0;)r.push(a[n])}function Ei(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ei(a,(function(e){var n,a;t&&(n=e.children)&&n.sort(t),r&&(a=e.parent)&&(a.value+=e.value)})),l}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&&(Pi(t,(function(t){t.children&&(t.value=0)})),Ei(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 a=e.call(this,t,n);return function t(e,r,n,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=e.value?n/e.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=e);return n}function Xi(t){return t.reduce(Wi,0)}function Wi(t,e){return t+e[1]}function Qi(t,e){return Ji(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ji(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,i=[];++r<=e;)i[r]=a*r+n;return i}function $i(e){return[t.min(e),t.max(e)]}function Ki(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(t,e){var r=e.x-t.x,n=e.y-t.y,a=t.r+e.r;return.999*a*a>r*r+n*n}function no(t){if((e=t.children)&&(s=e.length)){var e,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(e.forEach(ao),(r=e[0]).x=-r.r,r.y=0,x(r),s>1&&((n=e[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=e[2]),x(a),to(r,a),r._pack_prev=a,to(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[t.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(t){return arguments.length?(r=t,i):r},i.range=function(t){return arguments.length?(n=he(t),i):n},i.bins=function(t){return arguments.length?(a="number"==typeof t?function(e){return Ji(e,t)}:he(t),i):a},i.frequency=function(t){return arguments.length?(e=!!t,i):e},i},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(t,i){var o=r.call(this,t,i),l=o[0],s=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(l.x=l.y=0,Ei(l,(function(t){t.r=+u(t.value)})),Ei(l,no),n){var f=n*(e?1:Math.max(2*l.r/s,2*l.r/c))/2;Ei(l,(function(t){t.r+=f})),Ei(l,no),Ei(l,(function(t){t.r-=f}))}return function t(e,r,n,a){var i=e.children;if(e.x=r+=a*e.x,e.y=n+=a*e.y,e.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=t),t.depth>h.depth&&(h=t)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);Pi(u,(function(t){t.x=(t.x+g)*v,t.y=t.depth*m}))}return c}function o(t){var e=t.children,n=t.parent.children,a=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,a=t.children,i=a.length;for(;--i>=0;)(e=a[i]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var i=(e[0].z+e[e.length-1].z)/2;a?(t.z=a.z+r(t._,a._),t.m=t.z-i):t.z=i}else a&&(t.z=a.z+r(t._,a._));t.parent.A=function(t,e,n){if(e){for(var a,i=t,o=t,l=e,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=t,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,t,n),t,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=t)}return n}(t,a,t.parent.A||n[0])}function l(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=n[0],t.y=t.depth*n[1]}return i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t)?s:null,i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null==(n=t)?null:s,i):a?n:null},zi(i,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=e.call(this,i,o),c=s[0],u=0;Ei(c,(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=l?u+=r(e,l):0,e.y=0,l=e)}));var f=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(c),d=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return Ei(c,a?function(t){t.x=(t.x-c.x)*n[0],t.y=(c.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(h-p)*n[0],t.y=(1-(c.y?t.y/c.y:1))*n[1]}),s}return i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t),i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null!=(n=t),i):a?n:null},zi(i,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(t,e){for(var r,n,a=-1,i=t.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),e.forEach(f)}}function d(t){var e=t.children;if(e&&e.length){var r,n=o(t),a=e.slice(),i=[];for(u(a,n.dx*n.dy/t.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);e.forEach(d)}}function p(t,e){for(var r,n=t.area,a=0,i=1/0,o=-1,l=t.length;++oa&&(a=r));return e*=e,(n*=n)?Math.max(e*a*c/n,n/(e*i*c)):1/0}function h(t,e,r,a){var i,o=-1,l=t.length,s=r.x,c=r.y,u=e?n(t.area/e):0;if(e==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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?_o:mo,l=a?wi:_i;return i=t(e,r,l,n),o=t(r,e,l,Ka),s}function s(t){return i(t)}return s.invert=function(t){return o(t)},s.domain=function(t){return arguments.length?(e=t.map(Number),l()):e},s.range=function(t){return arguments.length?(r=t,l()):r},s.rangeRound=function(t){return s.range(t).interpolate(hi)},s.clamp=function(t){return arguments.length?(a=t,l()):a},s.interpolate=function(t){return arguments.length?(n=t,l()):n},s.ticks=function(t){return Mo(e,t)},s.tickFormat=function(t,r){return Ao(e,t,r)},s.nice=function(t){return To(e,t),l()},s.copy=function(){return t(e,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,a,i){function o(t){return(a?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function l(t){return a?Math.pow(n,t):-Math.pow(n,-t)}function s(t){return r(o(t))}return s.invert=function(t){return l(r.invert(t))},s.domain=function(t){return arguments.length?(a=t[0]>=0,r.domain((i=t.map(Number)).map(o)),s):i},s.base=function(t){return arguments.length?(n=+t,r.domain(i.map(o)),s):n},s.nice=function(){var t=yo(i.map(o),a?Math:Oo);return r.domain(t),i=t.map(l),s},s.ticks=function(){var t=go(i),e=[],r=t[0],s=t[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)e.push(l(c)*d);for(c=0;e[c]s;u--);e=e.slice(c,u)}return e},s.tickFormat=function(e,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=t.format(r));var a=Math.max(1,n*e/s.ticks().length);return function(t){var e=t/l(Math.round(o(t)));return e*n0?a[t-1]:r[0],tf?0:1;if(c=St)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,T,k,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=It(v/c*Math.sin(m))),l&&(A=It(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=At?0:1;if(L&&Vo(y,x,b,_)===p^C){var O=(u+f)/2;y=c*Math.cos(O),x=c*Math.sin(O),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),T=l*Math.sin(f-A),k=l*Math.cos(u+A),M=l*Math.sin(u+A);var D=Math.abs(u-f+2*A)<=At?0:1;if(A&&Vo(w,T,k,M)===1-p^D){var z=(u+f)/2;w=l*Math.cos(z),T=l*Math.sin(z),k=M=null}}else w=T=0;if(d>kt&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function qo(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=t[0]+s,f=t[1]+c,d=e[0]+s,p=e[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,T=(-b*v-m*_)/y,k=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=T-g,S=k-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=k,T=M),[[w-s,T-c],[w*r/x,T*r/x]]}function Go(t){var e=ra,r=na,n=Zr,a=Yo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=he(e),p=he(r);function h(){s.push("M",a(t(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Qo,basis:Ko,"basis-open":function(t){if(t.length<4)return Yo(t);var e,r=[],n=-1,a=t.length,i=[0],o=[0];for(;++n<3;)e=t[n],i.push(e[0]),o.push(e[1]);r.push(tl(nl,i)+","+tl(nl,o)),--n;for(;++n9&&(a=3*e/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(t[Math.min(s,l+1)][0]-t[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(t))}});function Yo(t){return t.length>1?t.join("L"):t+"Z"}function Xo(t){return t.join("L")+"Z"}function Wo(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){l=e[1],i=t[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAt)+",1 "+e}function s(t,e,r,n){return"Q 0,0 "+n}return i.radius=function(t){return arguments.length?(r=he(t),i):r},i.source=function(e){return arguments.length?(t=he(e),i):t},i.target=function(t){return arguments.length?(e=he(t),i):e},i.startAngle=function(t){return arguments.length?(n=he(t),i):n},i.endAngle=function(t){return arguments.length?(a=he(t),i):a},i},t.svg.diagonal=function(){var t=Un,e=Vn,r=cl;function n(n,a){var i=t.call(this,n,a),o=e.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(e){return arguments.length?(t=he(e),n):t},n.target=function(t){return arguments.length?(e=he(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=cl,n=e.projection;return e.projection=function(t){return arguments.length?n(ul(r=t)):r},e},t.svg.symbol=function(){var t=dl,e=fl;function r(r,n){return(hl.get(t.call(this,r,n))||pl)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=he(e),r):t},r.size=function(t){return arguments.length?(e=he(t),r):e},r};var hl=t.map({circle:pl,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*vl)),r=e*vl;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/gl),r=e*gl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/gl),r=e*gl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Ot);Z.transition=function(t){for(var e,r,n=bl||++Tl,a=Al(t),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(t,o);if(i>=1)return f.event&&f.event.end.call(t,t.__data__,e),--u.count?delete u[n]:delete t[r],1}f||(i=a.time,o=we((function(t){var e=f.delay;if(o.t=e+i,e<=t)return d(t-e);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,t.transition=function(e,r){return e&&e.transition?bl?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=wl,wl.select=function(t){var e,r,n,a=this.id,i=this.namespace,o=[];t=Y(t);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(t){t.select(".extent").attr("y",s[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=t.select(t.event.target),x=n.of(m,arguments),b=t.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=bt(m),A=t.mouse(m),L=t.select(o(m)).on("keydown.brush",O).on("keyup.brush",D);if(t.event.changedTouches?L.on("touchmove.brush",z).on("touchend.brush",E):L.on("mousemove.brush",z).on("mouseup.brush",E),b.interrupt().selectAll("*").interrupt(),k)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else t.event.altKey&&(f=A.slice());function O(){32==t.event.keyCode&&(k||(f=null,A[0]-=l[1],A[1]-=s[1],k=2),F())}function D(){32==t.event.keyCode&&2==k&&(A[0]+=l[1],A[1]+=s[1],k=0,F())}function z(){var e=t.mouse(m),r=!1;v&&(e[0]+=v[0],e[1]+=v[1]),k||(t.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(e[0]1?{floor:function(e){for(;l(e=t.floor(e));)e=Bl(e-1);return e},ceil:function(e){for(;l(e=t.ceil(e));)e=Bl(+e+1);return e}}:t))},a.ticks=function(t,e){var r=go(a.domain()),n=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Bl(+r[1]+1),e<1?1:e)},a.tickFormat=function(){return n},a.copy=function(){return Nl(e.copy(),r,n)},wo(a,e)}function Bl(t){return new Date(t)}El.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Rl,Fl.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Fl.toString=Rl.toString,ze.second=Re((function(t){return new Pe(1e3*Math.floor(t/1e3))}),(function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))}),(function(t){return t.getSeconds()})),ze.seconds=ze.second.range,ze.seconds.utc=ze.second.utc.range,ze.minute=Re((function(t){return new Pe(6e4*Math.floor(t/6e4))}),(function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))}),(function(t){return t.getMinutes()})),ze.minutes=ze.minute.range,ze.minutes.utc=ze.minute.utc.range,ze.hour=Re((function(t){var e=t.getTimezoneOffset()/60;return new Pe(36e5*(Math.floor(t/36e5-e)+e))}),(function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))}),(function(t){return t.getHours()})),ze.hours=ze.hour.range,ze.hours.utc=ze.hour.utc.range,ze.month=Re((function(t){return(t=ze.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),ze.months=ze.month.range,ze.months.utc=ze.month.utc.range;var Hl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],jl=[[ze.second,1],[ze.second,5],[ze.second,15],[ze.second,30],[ze.minute,1],[ze.minute,5],[ze.minute,15],[ze.minute,30],[ze.hour,1],[ze.hour,3],[ze.hour,6],[ze.hour,12],[ze.day,1],[ze.day,2],[ze.week,1],[ze.month,1],[ze.month,3],[ze.year,1]],Ul=El.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",Zr]]),Vl={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Bl)},floor:O,ceil:O};jl.year=ze.year,ze.scale=function(){return Nl(t.scale.linear(),jl,Ul)};var ql=jl.map((function(t){return[t[0].utc,t[1]]})),Gl=Il.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",Zr]]);function Zl(t){return JSON.parse(t.responseText)}function Yl(t){var e=a.createRange();return e.selectNode(a.body),e.createContextualFragment(t.responseText)}ql.year=ze.year.utc,ze.scale.utc=function(){return Nl(t.scale.linear(),ql,Gl)},t.text=ge((function(t){return t.responseText})),t.json=function(t,e){return ve(t,"application/json",Zl,e)},t.html=function(t,e){return ve(t,"text/html",Yl,e)},t.xml=ge((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],22:[function(t,e,r){(function(n,a){(function(){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -19,10 +19,10 @@ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ -!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():t.ES6Promise=n()}(this,(function(){"use strict";function e(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,o=void 0,l=void 0,s=function(t,e){g[i]=t,g[i+1]=e,2===(i+=2)&&(l?l(v):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},f=u.MutationObserver||u.WebKitMutationObserver,d="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var t=setTimeout;return function(){return t(v,1)}}var g=new Array(1e3);function v(){for(var t=0;t>1,u=-7,f=r?a-1:0,d=r?-1:1,p=t[e+f];for(f+=d,i=p&(1<<-u)-1,p>>=-u,u+=l;u>0;i=256*i+t[e+f],f+=d,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=n;u>0;o=256*o+t[e+f],f+=d,u-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),i-=c}return(p?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,l,s,c=8*i-a-1,u=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,h=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-o))<1&&(o--,s*=2),(e+=o+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(o++,s/=2),o+f>=u?(l=0,o=u):o+f>=1?(l=(e*s-1)*Math.pow(2,a),o+=f):(l=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+p]=255&l,p+=h,l/=256,a-=8);for(o=o<0;t[r+p]=255&o,p+=h,o/=256,c-=8);t[r+p-h]|=128*g}},{}],28:[function(t,e,r){"use strict";var n=t("./types");e.exports=function(t,e){var r;for(r in n)if(n[r].detect(t,e))return r}},{"./types":31}],29:[function(t,e,r){(function(r){"use strict";var n=t("fs"),a=t("path"),i=t("./types"),o=t("./detector");function l(t,e){var r=o(t,e);if(r in i){var n=i[r].calculate(t,e);if(!1!==n)return n.type=r,n}throw new TypeError("unsupported file type: "+r+" (file: "+e+")")}e.exports=function(t,e){if(r.isBuffer(t))return l(t);if("string"!=typeof t)throw new TypeError("invalid invocation");var i=a.resolve(t);if("function"!=typeof e)return l(function(t){var e=n.openSync(t,"r"),a=n.fstatSync(e).size,i=Math.min(a,524288),o=r.alloc(i);return n.readSync(e,o,0,i,0),n.closeSync(e),o}(i),i);!function(t,e){n.open(t,"r",(function(a,i){if(a)return e(a);n.fstat(i,(function(a,o){if(a)return e(a);var l=o.size;if(l<=0)return e(new Error("File size is not greater than 0 \u2014\u2014 "+t));var s=Math.min(l,524288),c=r.alloc(s);n.read(i,c,0,s,0,(function(t){if(t)return e(t);n.close(i,(function(t){e(t,c)}))}))}))}))}(i,(function(t,r){if(t)return e(t);var n;try{n=l(r,i)}catch(e){t=e}e(t,n)}))},e.exports.types=Object.keys(i)}).call(this,t("buffer").Buffer)},{"./detector":28,"./types":31,buffer:18,fs:16,path:48}],30:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r=r||0,t["readUInt"+e+(n?"BE":"LE")].call(t,r)}},{}],31:[function(t,e,r){"use strict";var n={bmp:t("./types/bmp"),cur:t("./types/cur"),dds:t("./types/dds"),gif:t("./types/gif"),icns:t("./types/icns"),ico:t("./types/ico"),jpg:t("./types/jpg"),png:t("./types/png"),psd:t("./types/psd"),svg:t("./types/svg"),tiff:t("./types/tiff"),webp:t("./types/webp")};e.exports=n},{"./types/bmp":32,"./types/cur":33,"./types/dds":34,"./types/gif":35,"./types/icns":36,"./types/ico":37,"./types/jpg":38,"./types/png":39,"./types/psd":40,"./types/svg":41,"./types/tiff":42,"./types/webp":43}],32:[function(t,e,r){"use strict";e.exports={detect:function(t){return"BM"===t.toString("ascii",0,2)},calculate:function(t){return{width:t.readUInt32LE(18),height:Math.abs(t.readInt32LE(22))}}}},{}],33:[function(t,e,r){"use strict";e.exports={detect:function(t){return 0===t.readUInt16LE(0)&&2===t.readUInt16LE(2)},calculate:t("./ico").calculate}},{"./ico":37}],34:[function(t,e,r){"use strict";e.exports={detect:function(t){return 542327876===t.readUInt32LE(0)},calculate:function(t){return{height:t.readUInt32LE(12),width:t.readUInt32LE(16)}}}},{}],35:[function(t,e,r){"use strict";var n=/^GIF8[79]a/;e.exports={detect:function(t){var e=t.toString("ascii",0,6);return n.test(e)},calculate:function(t){return{width:t.readUInt16LE(6),height:t.readUInt16LE(8)}}}},{}],36:[function(t,e,r){"use strict";var n={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function a(t,e){var r=e+4;return[t.toString("ascii",e,r),t.readUInt32BE(r)]}function i(t){var e=n[t];return{width:e,height:e,type:t}}e.exports={detect:function(t){return"icns"===t.toString("ascii",0,4)},calculate:function(t){var e,r,n,o=t.length,l=8,s=t.readUInt32BE(4);if(r=i((e=a(t,l))[0]),(l+=e[1])===s)return r;for(n={width:r.width,height:r.height,images:[r]};lt.length)return;var l=t.slice(r,a);if(274===n(l,16,0,e)){if(3!==n(l,16,2,e))return;if(1!==n(l,32,4,e))return;return n(l,16,8,e)}}}(r,i)}function l(t,e){if(e>t.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(255!==t[e])throw new TypeError("Invalid JPG, marker table corrupted")}e.exports={detect:function(t){return"ffd8"===t.toString("hex",0,2)},calculate:function(t){var e,r,n;for(t=t.slice(4);t.length;){if(r=t.readUInt16BE(0),a(t)&&(e=o(t,r)),l(t,r),192===(n=t[r+1])||193===n||194===n){var s=i(t,r+5);return e?{width:s.width,height:s.height,orientation:e}:s}t=t.slice(r+2)}throw new TypeError("Invalid JPG, no size found")}}},{"../readUInt":30}],39:[function(t,e,r){"use strict";e.exports={detect:function(t){if("PNG\r\n\x1a\n"===t.toString("ascii",1,8)){var e=t.toString("ascii",12,16);if("CgBI"===e&&(e=t.toString("ascii",28,32)),"IHDR"!==e)throw new TypeError("invalid png");return!0}},calculate:function(t){return"CgBI"===t.toString("ascii",12,16)?{width:t.readUInt32BE(32),height:t.readUInt32BE(36)}:{width:t.readUInt32BE(16),height:t.readUInt32BE(20)}}}},{}],40:[function(t,e,r){"use strict";e.exports={detect:function(t){return"8BPS"===t.toString("ascii",0,4)},calculate:function(t){return{width:t.readUInt32BE(18),height:t.readUInt32BE(14)}}}},{}],41:[function(t,e,r){"use strict";var n=/"']|"[^"]*"|'[^']*')*>/;var a={root:n,width:/\swidth=(['"])([^%]+?)\1/,height:/\sheight=(['"])([^%]+?)\1/,viewbox:/\sviewBox=(['"])(.+?)\1/},i={cm:96/2.54,mm:96/2.54/10,m:96/2.54*100,pt:96/72,pc:96/72/12,em:16,ex:8};function o(t){var e=/([0-9.]+)([a-z]*)/.exec(t);if(e)return Math.round(parseFloat(e[1])*(i[e[2]]||1))}function l(t){var e=t.split(" ");return{width:o(e[2]),height:o(e[3])}}e.exports={detect:function(t){return n.test(t)},calculate:function(t){var e=t.toString("utf8").match(a.root);if(e){var r=function(t){var e=t.match(a.width),r=t.match(a.height),n=t.match(a.viewbox);return{width:e&&o(e[2]),height:r&&o(r[2]),viewbox:n&&l(n[2])}}(e[0]);if(r.width&&r.height)return function(t){return{width:t.width,height:t.height}}(r);if(r.viewbox)return function(t){var e=t.viewbox.width/t.viewbox.height;return t.width?{width:t.width,height:Math.floor(t.width/e)}:t.height?{width:Math.floor(t.height*e),height:t.height}:{width:t.viewbox.width,height:t.viewbox.height}}(r)}throw new TypeError("invalid svg")}}},{}],42:[function(t,e,r){(function(r){"use strict";var n=t("fs"),a=t("../readUInt");function i(t,e){var r=a(t,16,8,e);return(a(t,16,10,e)<<16)+r}function o(t){if(t.length>24)return t.slice(12)}e.exports={detect:function(t){var e=t.toString("hex",0,4);return"49492a00"===e||"4d4d002a"===e},calculate:function(t,e){if(!e)throw new TypeError("Tiff doesn't support buffer");var l="BE"===function(t){var e=t.toString("ascii",0,2);return"II"===e?"LE":"MM"===e?"BE":void 0}(t),s=function(t,e){for(var r,n,l,s={};t&&t.length&&(r=a(t,16,0,e),n=a(t,16,2,e),l=a(t,32,4,e),0!==r);)1!==l||3!==n&&4!==n||(s[r]=i(t,e)),t=o(t);return s}(function(t,e,i){var o=a(t,32,4,i),l=1024,s=n.statSync(e).size;o+l>s&&(l=s-o-10);var c=r.alloc(l),u=n.openSync(e,"r");return n.readSync(u,c,0,l,o),c.slice(2)}(t,e,l),l),c=s[256],u=s[257];if(!c||!u)throw new TypeError("Invalid Tiff, missing tags");return{width:c,height:u}}}}).call(this,t("buffer").Buffer)},{"../readUInt":30,buffer:18,fs:16}],43:[function(t,e,r){"use strict";e.exports={detect:function(t){var e="RIFF"===t.toString("ascii",0,4),r="WEBP"===t.toString("ascii",8,12),n="VP8"===t.toString("ascii",12,15);return e&&r&&n},calculate:function(t){var e=t.toString("ascii",12,16);if(t=t.slice(20,30),"VP8X"===e){var r=t[0];return!(!(0==(192&r))||!(0==(1&r)))&&function(t){return{width:1+t.readUIntLE(4,3),height:1+t.readUIntLE(7,3)}}(t)}if("VP8 "===e&&47!==t[0])return function(t){return{width:16383&t.readInt16LE(6),height:16383&t.readInt16LE(8)}}(t);var n=t.toString("hex",3,6);return"VP8L"===e&&"9d012a"!==n&&function(t){return{width:1+((63&t[2])<<8|t[1]),height:1+((15&t[4])<<10|t[3]<<2|(192&t[2])>>6)}}(t)}}},{}],44:[function(t,e,r){e.exports=!0},{}],45:[function(t,e,r){"use strict";e.exports=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}},{}],46:[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 a=t.clientX||0,i=t.clientY||0,o=(l=e,l===window||l===document||l===document.body?n:l.getBoundingClientRect());var l;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],47:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(a,(function(t,r,a){var o=r.toLowerCase();for(a=function(t){var e=t.match(i);return e?e.map(Number):[]}(a),"m"==o&&a.length>2&&(e.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),e.push(a);if(a.length=0;n--){var a=t[n];"."===a?t.splice(n,1):".."===a?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!a;i--){var o=i>=0?arguments[i]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(r=o+"/"+r,a="/"===o.charAt(0))}return(a?"/":"")+(r=e(n(r.split("/"),(function(t){return!!t})),!a).join("/"))||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===a(t,-1);return(t=e(n(t.split("/"),(function(t){return!!t})),!i).join("/"))||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var a=n(t.split("/")),i=n(e.split("/")),o=Math.min(a.length,i.length),l=o,s=0;s=1;--i)if(47===(e=t.charCodeAt(i))){if(!a){n=i;break}}else a=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)},r.basename=function(t,e){var r=function(t){"string"!=typeof t&&(t+="");var e,r=0,n=-1,a=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!a){r=e+1;break}}else-1===n&&(a=!1,n=e+1);return-1===n?"":t.slice(r,n)}(t);return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},r.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,r=0,n=-1,a=!0,i=0,o=t.length-1;o>=0;--o){var l=t.charCodeAt(o);if(47!==l)-1===n&&(a=!1,n=o+1),46===l?-1===e?e=o:1!==i&&(i=1):-1!==e&&(i=-1);else if(!a){r=o+1;break}}return-1===e||-1===n||0===i||1===i&&e===n-1&&e===r+1?"":t.slice(e,n)};var a="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:57}],49:[function(t,e,r){ +!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():t.ES6Promise=n()}(this,(function(){"use strict";function e(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,o=void 0,l=void 0,s=function(t,e){g[i]=t,g[i+1]=e,2===(i+=2)&&(l?l(v):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},f=u.MutationObserver||u.WebKitMutationObserver,d="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var t=setTimeout;return function(){return t(v,1)}}var g=new Array(1e3);function v(){for(var t=0;t>1,u=-7,f=r?a-1:0,d=r?-1:1,p=t[e+f];for(f+=d,i=p&(1<<-u)-1,p>>=-u,u+=l;u>0;i=256*i+t[e+f],f+=d,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=n;u>0;o=256*o+t[e+f],f+=d,u-=8);if(0===i)i=1-c;else{if(i===s)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),i-=c}return(p?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,l,s,c=8*i-a-1,u=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,h=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-o))<1&&(o--,s*=2),(e+=o+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(o++,s/=2),o+f>=u?(l=0,o=u):o+f>=1?(l=(e*s-1)*Math.pow(2,a),o+=f):(l=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+p]=255&l,p+=h,l/=256,a-=8);for(o=o<0;t[r+p]=255&o,p+=h,o/=256,c-=8);t[r+p-h]|=128*g}},{}],57:[function(t,e,r){"use strict";var n=t("./types");e.exports=function(t,e){var r;for(r in n)if(n[r].detect(t,e))return r}},{"./types":60}],58:[function(t,e,r){(function(r){(function(){"use strict";var n=t("fs"),a=t("path"),i=t("./types"),o=t("./detector");function l(t,e){var r=o(t,e);if(r in i){var n=i[r].calculate(t,e);if(!1!==n)return n.type=r,n}throw new TypeError("unsupported file type: "+r+" (file: "+e+")")}e.exports=function(t,e){if(r.isBuffer(t))return l(t);if("string"!=typeof t)throw new TypeError("invalid invocation");var i=a.resolve(t);if("function"!=typeof e)return l(function(t){var e=n.openSync(t,"r"),a=n.fstatSync(e).size,i=Math.min(a,524288),o=r.alloc(i);return n.readSync(e,o,0,i,0),n.closeSync(e),o}(i),i);!function(t,e){n.open(t,"r",(function(a,i){if(a)return e(a);n.fstat(i,(function(a,o){if(a)return e(a);var l=o.size;if(l<=0)return e(new Error("File size is not greater than 0 \u2014\u2014 "+t));var s=Math.min(l,524288),c=r.alloc(s);n.read(i,c,0,s,0,(function(t){if(t)return e(t);n.close(i,(function(t){e(t,c)}))}))}))}))}(i,(function(t,r){if(t)return e(t);var n;try{n=l(r,i)}catch(e){t=e}e(t,n)}))},e.exports.types=Object.keys(i)}).call(this)}).call(this,t("buffer").Buffer)},{"./detector":57,"./types":60,buffer:18,fs:16,path:77}],59:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r=r||0,t["readUInt"+e+(n?"BE":"LE")].call(t,r)}},{}],60:[function(t,e,r){"use strict";var n={bmp:t("./types/bmp"),cur:t("./types/cur"),dds:t("./types/dds"),gif:t("./types/gif"),icns:t("./types/icns"),ico:t("./types/ico"),jpg:t("./types/jpg"),png:t("./types/png"),psd:t("./types/psd"),svg:t("./types/svg"),tiff:t("./types/tiff"),webp:t("./types/webp")};e.exports=n},{"./types/bmp":61,"./types/cur":62,"./types/dds":63,"./types/gif":64,"./types/icns":65,"./types/ico":66,"./types/jpg":67,"./types/png":68,"./types/psd":69,"./types/svg":70,"./types/tiff":71,"./types/webp":72}],61:[function(t,e,r){"use strict";e.exports={detect:function(t){return"BM"===t.toString("ascii",0,2)},calculate:function(t){return{width:t.readUInt32LE(18),height:Math.abs(t.readInt32LE(22))}}}},{}],62:[function(t,e,r){"use strict";e.exports={detect:function(t){return 0===t.readUInt16LE(0)&&2===t.readUInt16LE(2)},calculate:t("./ico").calculate}},{"./ico":66}],63:[function(t,e,r){"use strict";e.exports={detect:function(t){return 542327876===t.readUInt32LE(0)},calculate:function(t){return{height:t.readUInt32LE(12),width:t.readUInt32LE(16)}}}},{}],64:[function(t,e,r){"use strict";var n=/^GIF8[79]a/;e.exports={detect:function(t){var e=t.toString("ascii",0,6);return n.test(e)},calculate:function(t){return{width:t.readUInt16LE(6),height:t.readUInt16LE(8)}}}},{}],65:[function(t,e,r){"use strict";var n={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function a(t,e){var r=e+4;return[t.toString("ascii",e,r),t.readUInt32BE(r)]}function i(t){var e=n[t];return{width:e,height:e,type:t}}e.exports={detect:function(t){return"icns"===t.toString("ascii",0,4)},calculate:function(t){var e,r,n,o=t.length,l=8,s=t.readUInt32BE(4);if(r=i((e=a(t,l))[0]),(l+=e[1])===s)return r;for(n={width:r.width,height:r.height,images:[r]};lt.length)return;var l=t.slice(r,a);if(274===n(l,16,0,e)){if(3!==n(l,16,2,e))return;if(1!==n(l,32,4,e))return;return n(l,16,8,e)}}}(r,i)}function l(t,e){if(e>t.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(255!==t[e])throw new TypeError("Invalid JPG, marker table corrupted")}e.exports={detect:function(t){return"ffd8"===t.toString("hex",0,2)},calculate:function(t){var e,r,n;for(t=t.slice(4);t.length;){if(r=t.readUInt16BE(0),a(t)&&(e=o(t,r)),l(t,r),192===(n=t[r+1])||193===n||194===n){var s=i(t,r+5);return e?{width:s.width,height:s.height,orientation:e}:s}t=t.slice(r+2)}throw new TypeError("Invalid JPG, no size found")}}},{"../readUInt":59}],68:[function(t,e,r){"use strict";e.exports={detect:function(t){if("PNG\r\n\x1a\n"===t.toString("ascii",1,8)){var e=t.toString("ascii",12,16);if("CgBI"===e&&(e=t.toString("ascii",28,32)),"IHDR"!==e)throw new TypeError("invalid png");return!0}},calculate:function(t){return"CgBI"===t.toString("ascii",12,16)?{width:t.readUInt32BE(32),height:t.readUInt32BE(36)}:{width:t.readUInt32BE(16),height:t.readUInt32BE(20)}}}},{}],69:[function(t,e,r){"use strict";e.exports={detect:function(t){return"8BPS"===t.toString("ascii",0,4)},calculate:function(t){return{width:t.readUInt32BE(18),height:t.readUInt32BE(14)}}}},{}],70:[function(t,e,r){"use strict";var n=/"']|"[^"]*"|'[^']*')*>/;var a={root:n,width:/\swidth=(['"])([^%]+?)\1/,height:/\sheight=(['"])([^%]+?)\1/,viewbox:/\sviewBox=(['"])(.+?)\1/},i={cm:96/2.54,mm:96/2.54/10,m:96/2.54*100,pt:96/72,pc:96/72/12,em:16,ex:8};function o(t){var e=/([0-9.]+)([a-z]*)/.exec(t);if(e)return Math.round(parseFloat(e[1])*(i[e[2]]||1))}function l(t){var e=t.split(" ");return{width:o(e[2]),height:o(e[3])}}e.exports={detect:function(t){return n.test(t)},calculate:function(t){var e=t.toString("utf8").match(a.root);if(e){var r=function(t){var e=t.match(a.width),r=t.match(a.height),n=t.match(a.viewbox);return{width:e&&o(e[2]),height:r&&o(r[2]),viewbox:n&&l(n[2])}}(e[0]);if(r.width&&r.height)return function(t){return{width:t.width,height:t.height}}(r);if(r.viewbox)return function(t){var e=t.viewbox.width/t.viewbox.height;return t.width?{width:t.width,height:Math.floor(t.width/e)}:t.height?{width:Math.floor(t.height*e),height:t.height}:{width:t.viewbox.width,height:t.viewbox.height}}(r)}throw new TypeError("invalid svg")}}},{}],71:[function(t,e,r){(function(r){(function(){"use strict";var n=t("fs"),a=t("../readUInt");function i(t,e){var r=a(t,16,8,e);return(a(t,16,10,e)<<16)+r}function o(t){if(t.length>24)return t.slice(12)}e.exports={detect:function(t){var e=t.toString("hex",0,4);return"49492a00"===e||"4d4d002a"===e},calculate:function(t,e){if(!e)throw new TypeError("Tiff doesn't support buffer");var l="BE"===function(t){var e=t.toString("ascii",0,2);return"II"===e?"LE":"MM"===e?"BE":void 0}(t),s=function(t,e){for(var r,n,l,s={};t&&t.length&&(r=a(t,16,0,e),n=a(t,16,2,e),l=a(t,32,4,e),0!==r);)1!==l||3!==n&&4!==n||(s[r]=i(t,e)),t=o(t);return s}(function(t,e,i){var o=a(t,32,4,i),l=1024,s=n.statSync(e).size;o+l>s&&(l=s-o-10);var c=r.alloc(l),u=n.openSync(e,"r");return n.readSync(u,c,0,l,o),c.slice(2)}(t,e,l),l),c=s[256],u=s[257];if(!c||!u)throw new TypeError("Invalid Tiff, missing tags");return{width:c,height:u}}}}).call(this)}).call(this,t("buffer").Buffer)},{"../readUInt":59,buffer:18,fs:16}],72:[function(t,e,r){"use strict";e.exports={detect:function(t){var e="RIFF"===t.toString("ascii",0,4),r="WEBP"===t.toString("ascii",8,12),n="VP8"===t.toString("ascii",12,15);return e&&r&&n},calculate:function(t){var e=t.toString("ascii",12,16);if(t=t.slice(20,30),"VP8X"===e){var r=t[0];return!(!(0==(192&r))||!(0==(1&r)))&&function(t){return{width:1+t.readUIntLE(4,3),height:1+t.readUIntLE(7,3)}}(t)}if("VP8 "===e&&47!==t[0])return function(t){return{width:16383&t.readInt16LE(6),height:16383&t.readInt16LE(8)}}(t);var n=t.toString("hex",3,6);return"VP8L"===e&&"9d012a"!==n&&function(t){return{width:1+((63&t[2])<<8|t[1]),height:1+((15&t[4])<<10|t[3]<<2|(192&t[2])>>6)}}(t)}}},{}],73:[function(t,e,r){e.exports=!0},{}],74:[function(t,e,r){"use strict";e.exports=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}},{}],75:[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 a=t.clientX||0,i=t.clientY||0,o=(l=e,l===window||l===document||l===document.body?n:l.getBoundingClientRect());var l;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],76:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(a,(function(t,r,a){var o=r.toLowerCase();for(a=function(t){var e=t.match(i);return e?e.map(Number):[]}(a),"m"==o&&a.length>2&&(e.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),e.push(a);if(a.length2){var s=n.lastIndexOf("/");if(s!==n.length-1){-1===s?(n="",a=0):a=(n=n.slice(0,s)).length-1-n.lastIndexOf("/"),i=l,o=0;continue}}else if(2===n.length||1===n.length){n="",a=0,i=l,o=0;continue}e&&(n.length>0?n+="/..":n="..",a=2)}else n.length>0?n+="/"+t.slice(i+1,l):n=t.slice(i+1,l),a=l-i-1;i=l,o=0}else 46===r&&-1!==o?++o:o=-1}return n}var a={resolve:function(){for(var e,a="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var l;o>=0?l=arguments[o]:(void 0===e&&(e=t.cwd()),l=e),r(l),0!==l.length&&(a=l+"/"+a,i=47===l.charCodeAt(0))}return a=n(a,!i),i?a.length>0?"/"+a:"/":a.length>0?a:"."},normalize:function(t){if(r(t),0===t.length)return".";var e=47===t.charCodeAt(0),a=47===t.charCodeAt(t.length-1);return 0!==(t=n(t,!e)).length||e||(t="."),t.length>0&&a&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return r(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=n:t+="/"+n)}return void 0===t?".":a.normalize(t)},relative:function(t,e){if(r(t),r(e),t===e)return"";if((t=a.resolve(t))===(e=a.resolve(e)))return"";for(var n=1;nc){if(47===e.charCodeAt(l+f))return e.slice(l+f+1);if(0===f)return e.slice(l+f)}else o>c&&(47===t.charCodeAt(n+f)?u=f:0===f&&(u=0));break}var d=t.charCodeAt(n+f);if(d!==e.charCodeAt(l+f))break;47===d&&(u=f)}var p="";for(f=n+u+1;f<=i;++f)f!==i&&47!==t.charCodeAt(f)||(0===p.length?p+="..":p+="/..");return p.length>0?p+e.slice(l+u):(l+=u,47===e.charCodeAt(l)&&++l,e.slice(l))},_makeLong:function(t){return t},dirname:function(t){if(r(t),0===t.length)return".";for(var e=t.charCodeAt(0),n=47===e,a=-1,i=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!i){a=o;break}}else i=!1;return-1===a?n?"/":".":n&&1===a?"//":t.slice(0,a)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');r(t);var n,a=0,i=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var l=e.length-1,s=-1;for(n=t.length-1;n>=0;--n){var c=t.charCodeAt(n);if(47===c){if(!o){a=n+1;break}}else-1===s&&(o=!1,s=n+1),l>=0&&(c===e.charCodeAt(l)?-1==--l&&(i=n):(l=-1,i=s))}return a===i?i=s:-1===i&&(i=t.length),t.slice(a,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!o){a=n+1;break}}else-1===i&&(o=!1,i=n+1);return-1===i?"":t.slice(a,i)},extname:function(t){r(t);for(var e=-1,n=0,a=-1,i=!0,o=0,l=t.length-1;l>=0;--l){var s=t.charCodeAt(l);if(47!==s)-1===a&&(i=!1,a=l+1),46===s?-1===e?e=l:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){n=l+1;break}}return-1===e||-1===a||0===o||1===o&&e===a-1&&e===n+1?"":t.slice(e,a)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+t+n:n}("/",t)},parse:function(t){r(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var n,a=t.charCodeAt(0),i=47===a;i?(e.root="/",n=1):n=0;for(var o=-1,l=0,s=-1,c=!0,u=t.length-1,f=0;u>=n;--u)if(47!==(a=t.charCodeAt(u)))-1===s&&(c=!1,s=u+1),46===a?-1===o?o=u:1!==f&&(f=1):-1!==o&&(f=-1);else if(!c){l=u+1;break}return-1===o||-1===s||0===f||1===f&&o===s-1&&o===l+1?-1!==s&&(e.base=e.name=0===l&&i?t.slice(1,s):t.slice(l,s)):(0===l&&i?(e.name=t.slice(1,o),e.base=t.slice(1,s)):(e.name=t.slice(l,o),e.base=t.slice(l,s)),e.ext=t.slice(o,s)),l>0?e.dir=t.slice(0,l-1):i&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,e.exports=a}).call(this)}).call(this,t("_process"))},{_process:86}],78:[function(t,e,r){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT * @preserve Project Home: https://github.com/voidqk/polybooljs */ -var n,a=t("./lib/build-log"),i=t("./lib/epsilon"),o=t("./lib/intersecter"),l=t("./lib/segment-chainer"),s=t("./lib/segment-selector"),c=t("./lib/geojson"),u=!1,f=i();function d(t,e,r){var a=n.segments(t),i=n.segments(e),o=r(n.combine(a,i));return n.polygon(o)}n={buildLog:function(t){return!0===t?u=a():!1===t&&(u=!1),!1!==u&&u.list},epsilon:function(t){return f.epsilon(t)},segments:function(t){var e=o(!0,f,u);return t.regions.forEach(e.addRegion),{segments:e.calculate(t.inverted),inverted:t.inverted}},combine:function(t,e){return{combined:o(!1,f,u).calculate(t.segments,t.inverted,e.segments,e.inverted),inverted1:t.inverted,inverted2:e.inverted}},selectUnion:function(t){return{segments:s.union(t.combined,u),inverted:t.inverted1||t.inverted2}},selectIntersect:function(t){return{segments:s.intersect(t.combined,u),inverted:t.inverted1&&t.inverted2}},selectDifference:function(t){return{segments:s.difference(t.combined,u),inverted:t.inverted1&&!t.inverted2}},selectDifferenceRev:function(t){return{segments:s.differenceRev(t.combined,u),inverted:!t.inverted1&&t.inverted2}},selectXor:function(t){return{segments:s.xor(t.combined,u),inverted:t.inverted1!==t.inverted2}},polygon:function(t){return{regions:l(t.segments,f,u),inverted:t.inverted}},polygonFromGeoJSON:function(t){return c.toPolygon(n,t)},polygonToGeoJSON:function(t){return c.fromPolygon(n,f,t)},union:function(t,e){return d(t,e,n.selectUnion)},intersect:function(t,e){return d(t,e,n.selectIntersect)},difference:function(t,e){return d(t,e,n.selectDifference)},differenceRev:function(t,e){return d(t,e,n.selectDifferenceRev)},xor:function(t,e){return d(t,e,n.selectXor)}},"object"==typeof window&&(window.PolyBool=n),e.exports=n},{"./lib/build-log":50,"./lib/epsilon":51,"./lib/geojson":52,"./lib/intersecter":53,"./lib/segment-chainer":55,"./lib/segment-selector":56}],50:[function(t,e,r){e.exports=function(){var t,e=0,r=!1;function n(e,r){return t.list.push({type:e,data:r?JSON.parse(JSON.stringify(r)):void 0}),t}return t={list:[],segmentId:function(){return e++},checkIntersection:function(t,e){return n("check",{seg1:t,seg2:e})},segmentChop:function(t,e){return n("div_seg",{seg:t,pt:e}),n("chop",{seg:t,pt:e})},statusRemove:function(t){return n("pop_seg",{seg:t})},segmentUpdate:function(t){return n("seg_update",{seg:t})},segmentNew:function(t,e){return n("new_seg",{seg:t,primary:e})},segmentRemove:function(t){return n("rem_seg",{seg:t})},tempStatus:function(t,e,r){return n("temp_status",{seg:t,above:e,below:r})},rewind:function(t){return n("rewind",{seg:t})},status:function(t,e,r){return n("status",{seg:t,above:e,below:r})},vert:function(e){return e===r?t:(r=e,n("vert",{x:e}))},log:function(t){return"string"!=typeof t&&(t=JSON.stringify(t,!1," ")),n("log",{txt:t})},reset:function(){return n("reset")},selected:function(t){return n("selected",{segs:t})},chainStart:function(t){return n("chain_start",{seg:t})},chainRemoveHead:function(t,e){return n("chain_rem_head",{index:t,pt:e})},chainRemoveTail:function(t,e){return n("chain_rem_tail",{index:t,pt:e})},chainNew:function(t,e){return n("chain_new",{pt1:t,pt2:e})},chainMatch:function(t){return n("chain_match",{index:t})},chainClose:function(t){return n("chain_close",{index:t})},chainAddHead:function(t,e){return n("chain_add_head",{index:t,pt:e})},chainAddTail:function(t,e){return n("chain_add_tail",{index:t,pt:e})},chainConnect:function(t,e){return n("chain_con",{index1:t,index2:e})},chainReverse:function(t){return n("chain_rev",{index:t})},chainJoin:function(t,e){return n("chain_join",{index1:t,index2:e})},done:function(){return n("done")}}}},{}],51:[function(t,e,r){e.exports=function(t){"number"!=typeof t&&(t=1e-10);var e={epsilon:function(e){return"number"==typeof e&&(t=e),t},pointAboveOrOnLine:function(e,r,n){var a=r[0],i=r[1],o=n[0],l=n[1],s=e[0];return(o-a)*(e[1]-i)-(l-i)*(s-a)>=-t},pointBetween:function(e,r,n){var a=e[1]-r[1],i=n[0]-r[0],o=e[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-a>t&&(i-c)*(a-u)/(o-u)+c-n>t&&(l=!l),i=c,o=u}return l}};return e}},{}],52:[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]),a=1;a0}))}function u(t,n){var a=t.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=e.linesIntersect(o,l,c,u);if(!1===f){if(!e.pointsCollinear(o,l,c))return!1;if(e.pointsSame(o,u)||e.pointsSame(l,c))return!1;var d=e.pointsSame(o,c),p=e.pointsSame(l,u);if(d&&p)return n;var h=!d&&e.pointBetween(o,c,u),g=!p&&e.pointBetween(l,c,u);if(d)return g?s(n,l):s(t,u),n;h&&(p||(g?s(n,l):s(t,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(t,c):0===f.alongB?s(t,f.pt):1===f.alongB&&s(t,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var t=u(d,h);if(t)return t}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(t)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(t)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return t?{addRegion:function(t){for(var n,a,i,o=t[t.length-1],s=0;s1)for(var r=1;r1&&(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=O(t,360),e=O(e,100),r=O(r,100),0===e)n=a=i=r;else{var l=r<.5?r*(1+e):r+e-r*e,s=2*r-l;n=o(s,l,t+1/3),a=o(s,l,t),i=o(s,l,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(e.h,s,u),f=!0,d="hsl"),e.hasOwnProperty("a")&&(i=e.a));var p,h,g;return i=C(i),{ok:f,format:e.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(e);this._originalInput=e,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(t,e,r){t=O(t,255),e=O(e,255),r=O(r,255);var n,a,i=l(t,e,r),s=o(t,e,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case t:n=(e-r)/u+(e>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(t,e){e=e||6;for(var r=c(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/e;e--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.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,a=this.toRgb();return e=a.r/255,r=a.g/255,n=a.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=C(t),this._roundA=i(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=i(360*t.h),r=i(100*t.s),n=i(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=u(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=u(this._r,this._g,this._b),e=i(360*t.h),r=i(100*t.s),n=i(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return d(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,a){var o=[P(i(t).toString(16)),P(i(e).toString(16)),P(i(r).toString(16)),P(I(n))];if(a&&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:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+p(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=c(t);r="#"+p(a._r,a._g,a._b,a._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 c(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(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:E(t[n]));t=r}return c(t,e)},c.equals=function(t,e){return!(!t||!e)&&c(t).toRgbString()==c(e).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(t,e,r){r=0===r?0:r||50;var n=c(t).toRgb(),a=c(e).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(e,r){var n=c(e),a=c(r);return(t.max(n.getLuminance(),a.getLuminance())+.05)/(t.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(t,e,r){var n,a,i=c.readability(t,e);switch(a=!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":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(t,e,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(e[u]));return c.isReadable(t,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(t,["#fff","#000"],r))};var L=c.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=c.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(L);function C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function O(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,l(0,parseFloat(e))),n&&(e=parseInt(e*r,10)/100),t.abs(e-r)<1e-6?1:e%r/parseFloat(r)}function D(t){return o(1,l(0,t))}function z(t){return parseInt(t,16)}function P(t){return 1==t.length?"0"+t:""+t}function E(t){return t<=1&&(t=100*t+"%"),t}function I(e){return t.round(255*parseFloat(e)).toString(16)}function R(t){return z(t)/255}var F,N,B,H=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",B="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+B),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 j(t){return!!H.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=c:window.tinycolor=c}(Math)},{}],59:[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}]},{}],60:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":236,"../../plots/cartesian/constants":252,"../../plots/font_attributes":274,"./arrow_paths":59}],61:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./draw").draw;function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach((function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);e._extremes={},r&&l(e,r),n&&l(e,n)}))}function l(t,e){var r,n=e._id,i=n.charAt(0),o=t[i],l=t["a"+i],s=t[i+"ref"],c=t["a"+i+"ref"],u=t["_"+i+"padplus"],f=t["_"+i+"padminus"],d={x:1,y:-1}[i]*t[i+"shift"],p=3*t.arrowsize*t.arrowwidth||0,h=p+d,g=p-d,v=3*t.startarrowsize*t.arrowwidth||0,m=v+d,y=v-d;if(c===s){var x=a.findExtremes(e,[e.r2c(o)],{ppadplus:h,ppadminus:g}),b=a.findExtremes(e,[e.r2c(l)],{ppadplus:Math.max(u,m),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else m=l?m+l:m,y=l?y-l:y,r=a.findExtremes(e,[e.r2c(o)],{ppadplus:Math.max(u,h,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([i,o],t)}},{"../../lib":202,"../../plots/cartesian/axes":246,"./draw":66}],62:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("../../plot_api/plot_template").arrayEditor;function o(t,e){var r,n,a,i,o,s,c,u=t._fullLayout.annotations,f=[],d=[],p=[],h=(e||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(t,e){var r,l,s=o(t,e),c=s.on,u=s.off.concat(s.explicitOff),f={},d=t._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}for(var q=!1,G=["x","y"],Z=0;Z1)&&(tt===K?((ct=et.r2fraction(e["a"+$]))<0||ct>1)&&(q=!0):q=!0),Y=et._offset+et.r2p(e[$]),Q=.5}else"x"===$?(W=e[$],Y=b.l+b.w*W):(W=1-e[$],Y=b.t+b.h*W),Q=e.showarrow?.5:W;if(e.showarrow){st.head=Y;var ut=e["a"+$];J=nt*j(.5,e.xanchor)-at*j(.5,e.yanchor),tt===K?(st.tail=et._offset+et.r2p(ut),X=J):(st.tail=Y+ut,X=J+ut),st.text=st.tail+J;var ft=x["x"===$?"width":"height"];if("paper"===K&&(st.head=o.constrain(st.head,1,ft-1)),"pixel"===tt){var dt=-Math.max(st.tail-3,st.text),pt=Math.min(st.tail+3,st.text)-ft;dt>0?(st.tail+=dt,st.text+=dt):pt>0&&(st.tail-=pt,st.text-=pt)}st.tail+=lt,st.head+=lt}else X=J=it*j(Q,ot),st.text=Y+J;st.text+=lt,J+=lt,X+=lt,e["_"+$+"padplus"]=it/2+X,e["_"+$+"padminus"]=it/2-X,e["_"+$+"size"]=it,e["_"+$+"shift"]=J}if(q)P.remove();else{var ht=0,gt=0;if("left"!==e.align&&(ht=(w-m)*("center"===e.align?.5:1)),"top"!==e.valign&&(gt=(z-y)*("middle"===e.valign?.5:1)),u)n.select("svg").attr({x:R+ht-1,y:R+gt}).call(c.setClipUrl,N?A:null,t);else{var vt=R+gt-h.top,mt=R+ht-h.left;U.call(f.positionText,mt,vt).call(c.setClipUrl,N?A:null,t)}B.select("rect").call(c.setRect,R,R,w,z),F.call(c.setRect,E/2,E/2,I-E,H-E),P.call(c.setTranslate,Math.round(L.x.text-I/2),Math.round(L.y.text-H/2)),O.attr({transform:"rotate("+S+","+L.x.text+","+L.y.text+")"});var yt,xt=function(r,n){C.selectAll(".annotation-arrow-g").remove();var u=L.x.head,f=L.y.head,d=L.x.tail+r,h=L.y.tail+n,m=L.x.text+r,y=L.y.text+n,x=o.rotationXYMatrix(S,m,y),w=o.apply2DTransform(x),A=o.apply2DTransform2(x),D=+F.attr("width"),z=+F.attr("height"),E=m-.5*D,I=E+D,R=y-.5*z,N=R+z,B=[[E,R,E,N],[E,N,I,N],[I,N,I,R],[I,R,E,R]].map(A);if(!B.reduce((function(t,e){return t^!!o.segmentsIntersect(u,f,u+1e6,f+1e6,e[0],e[1],e[2],e[3])}),!1)){B.forEach((function(t){var e=o.segmentsIntersect(d,h,u,f,t[0],t[1],t[2],t[3]);e&&(d=e.x,h=e.y)}));var H=e.arrowwidth,j=e.arrowcolor,U=e.arrowside,V=C.append("g").style({opacity:s.opacity(j)}).classed("annotation-arrow-g",!0),q=V.append("path").attr("d","M"+d+","+h+"L"+u+","+f).style("stroke-width",H+"px").call(s.stroke,s.rgb(j));if(g(q,U,e),_.annotationPosition&&q.node().parentNode&&!i){var G=u,Z=f;if(e.standoff){var Y=Math.sqrt(Math.pow(u-d,2)+Math.pow(f-h,2));G+=e.standoff*(d-u)/Y,Z+=e.standoff*(h-f)/Y}var X,W,Q=V.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-G)+","+(h-Z),transform:"translate("+G+","+Z+")"}).style("stroke-width",H+6+"px").call(s.stroke,"rgba(0,0,0,0)").call(s.fill,"rgba(0,0,0,0)");p.init({element:Q.node(),gd:t,prepFn:function(){var t=c.getTranslate(P);X=t.x,W=t.y,l&&l.autorange&&T(l._name+".autorange",!0),v&&v.autorange&&T(v._name+".autorange",!0)},moveFn:function(t,r){var n=w(X,W),a=n[0]+t,i=n[1]+r;P.call(c.setTranslate,a,i),k("x",l?l.p2r(l.r2p(e.x)+t):e.x+t/b.w),k("y",v?v.p2r(v.r2p(e.y)+r):e.y-r/b.h),e.axref===e.xref&&k("ax",l.p2r(l.r2p(e.ax)+t)),e.ayref===e.yref&&k("ay",v.p2r(v.r2p(e.ay)+r)),V.attr("transform","translate("+t+","+r+")"),O.attr({transform:"rotate("+S+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",t,M());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&xt(0,0),D)p.init({element:P.node(),gd:t,prepFn:function(){yt=O.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?k("ax",l.p2r(l.r2p(e.ax)+t)):k("ax",e.ax+t),e.ayref===e.yref?k("ay",v.p2r(v.r2p(e.ay)+r)):k("ay",e.ay+r),xt(t,r);else{if(i)return;var a,o;if(l)a=l.p2r(l.r2p(e.x)+t);else{var s=e._xsize/b.w,c=e.x+(e._xshift-e.xshift)/b.w-s/2;a=p.align(c+t/b.w,s,0,1,e.xanchor)}if(v)o=v.p2r(v.r2p(e.y)+r);else{var u=e._ysize/b.h,f=e.y-(e._yshift+e.yshift)/b.h-u/2;o=p.align(f-r/b.h,u,0,1,e.yanchor)}k("x",a),k("y",o),l&&v||(n=p.getCursor(l?.5:a,v?.5:o,e.xanchor,e.yanchor))}O.attr({transform:"translate("+t+","+r+")"+yt}),d(P,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",V(n))},doneFn:function(){d(P),a.call("_guiRelayout",t,M());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*p+r.standoff,y=d.backoff*h+r.startstandoff;if("line"===u.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},l={x:+t.attr("x2"),y:+t.attr("y2")};var x=o.x-l.x,b=o.y-l.y;if(c=(s=Math.atan2(b,x))+Math.PI,m&&y&&m+y>Math.sqrt(x*x+b*b))return void D();if(m){if(m*m>x*x+b*b)return void D();var _=m*Math.cos(s),w=m*Math.sin(s);l.x+=_,l.y+=w,t.attr({x2:l.x,y2:l.y})}if(y){if(y*y>x*x+b*b)return void D();var T=y*Math.cos(s),k=y*Math.sin(s);o.x-=T,o.y-=k,t.attr({x1:o.x,y1:o.y})}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(M1){c=!0;break}}c?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+l+'"]').remove():(s._pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(s.x)*r[0],e.yaxis.r2l(s.y)*r[1],e.zaxis.r2l(s.z)*r[2]]),n(t.graphDiv,s,l,t.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":277,"../annotations/draw":66}],73:[function(t,e,r){"use strict";var n=t("../../registry"),a=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 i=r.attrRegex,o=Object.keys(t),l=0;l=0))return t;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return t}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(n(t))},i.opacity=function(t){return t?n(t).getAlpha():0},i.addOpacity=function(t,e){var r=n(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},i.combine=function(t,e){var r=n(t).toRgb();if(1===r.a)return n(t).toRgbString();var a=n(e||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(t,e,r){var a=n(t);return 1!==a.getAlpha()&&(a=n(i.combine(t,s))),(a.isDark()?e?a.lighten(e):s:r?a.darken(r):l).toString()},i.stroke=function(t,e){var r=n(e);t.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(t,e){var r=n(e);t.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,r,n,a,o=Object.keys(t);for(e=0;e0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var W=Math.pow(10,Math.floor(Math.log(X)/Math.LN10));Z*=W*c.roundUp(X/W,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=Z}G.domain=[U+B,U+R-B],G.setScale(),t.attr("transform","translate("+Math.round(s.l)+","+Math.round(s.t)+")");var Q,J=t.select("."+k.cbtitleunshift).attr("transform","translate(-"+Math.round(s.l)+",-"+Math.round(s.t)+")"),$=t.select("."+k.cbaxis),K=0;function tt(n,a){var i={propContainer:G,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+k.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+l+",."+l+"-math-group").remove(),h.draw(r,n,u(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(M)){var t,r=s.l+(e.x+F)*s.w,n=G.title.font.size;t="top"===M?(1-(U+R-B))*s.h+s.t+3+.75*n:(1-(U+B))*s.h+s.t-3-.25*n,tt(G._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(M)){var i=t.select("."+k.cbtitle),o=i.select("text"),u=[-e.outlinewidth/2,e.outlinewidth/2],f=i.select(".h"+G._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*_),f?(K=d.bBox(f).height)>p&&(u[1]-=(K-p)/2):o.node()&&!o.classed(k.jsPlaceholder)&&(K=d.bBox(o.node()).height),K){if(K+=5,"top"===M)G.domain[1]-=K/s.h,u[1]*=-1;else{G.domain[0]+=K/s.h;var h=g.lineCount(o);u[1]+=(1-h)*p}i.attr("transform","translate("+u+")"),G.setScale()}}t.selectAll("."+k.cbfills+",."+k.cblines).attr("transform","translate(0,"+Math.round(s.h*(1-G.domain[1]))+")"),$.attr("transform","translate(0,"+Math.round(-s.t)+")");var m=t.select("."+k.cbfills).selectAll("rect."+k.cbfill).data(D);m.enter().append("rect").classed(k.cbfill,!0).style("stroke","none"),m.exit().remove();var y=A.map(G.c2p).map(Math.round).sort((function(t,e){return t-e}));m.each((function(t,i){var o=[0===i?A[0]:(D[i]+D[i-1])/2,i===D.length-1?A[1]:(D[i]+D[i+1])/2].map(G.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var l=n.select(this).attr({x:H,width:Math.max(P,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)d.gradient(l,r,e._id,"vertical",e._fillgradient,"fill");else{var s=S(t).replace("e-","");l.attr("fill",a(s).toHexString())}}));var x=t.select("."+k.cblines).selectAll("path."+k.cbline).data(v.color&&v.width?z:[]);x.enter().append("path").classed(k.cbline,!0),x.exit().remove(),x.each((function(t){n.select(this).attr("d","M"+H+","+(Math.round(G.c2p(t))+v.width/2%1)+"h"+P).call(d.lineGroupStyle,v.width,L(t),v.dash)})),$.selectAll("g."+G._id+"tick,path").remove();var b=H+P+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),w=l.calcTicks(G),T=l.makeTransFn(G),C=l.getTickSigns(G)[2];return l.drawTicks(r,G,{vals:"inside"===G.ticks?l.clipEnds(G,w):w,layer:$,path:l.makeTickPath(G,b,C),transFn:T}),l.drawLabels(r,G,{vals:w,layer:$,transFn:T,labelFns:l.makeLabelFns(G,b)})},function(){if(-1===["top","bottom"].indexOf(M)){var t=G.title.font.size,e=G._offset+G._length/2,a=s.l+(G.position||0)*s.w+("right"===G.side?10+t*(G.showticklabels?1:.5):-10-t*(G.showticklabels?.5:0));tt("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:M,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=P+e.outlinewidth/2+d.bBox($.node()).width;if((Q=J.select("text")).node()&&!Q.classed(k.jsPlaceholder)){var a,o=J.select(".h"+G._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(M)?d.bBox(o).width:d.bBox(J.node()).right-H-s.l,n=Math.max(n,a)}var l=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,c=V-q;t.select("."+k.cbbg).attr({x:H-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:q-N,width:Math.max(l,2),height:Math.max(c+2*N,2)}).call(p.fill,e.bgcolor).call(p.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+k.cboutline).attr({x:H,y:q+e.ypad+("top"===M?K:0),width:Math.max(P,2),height:Math.max(c-2*e.ypad-K,2)}).call(p.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var u=({center:.5,right:1}[e.xanchor]||0)*l;t.attr("transform","translate("+(s.l-u)+","+s.t+")");var f={},h=w[e.yanchor],g=T[e.yanchor];"pixels"===e.lenmode?(f.y=e.y,f.t=c*h,f.b=c*g):(f.t=f.b=0,f.yt=e.y+e.len*h,f.yb=e.y-e.len*g);var v=w[e.xanchor],m=T[e.xanchor];if("pixels"===e.thicknessmode)f.x=e.x,f.l=l*v,f.r=l*m;else{var y=l-P;f.l=y*v,f.r=y*m,f.xl=e.x-e.thickness*v,f.xr=e.x+e.thickness*m}i.autoMargin(r,e._id,f)}],r)}(r,e,t);v&&v.then&&(t._promises||[]).push(v),t._context.edits.colorbarPosition&&function(t,e,r){var n,a,i,l=r._fullLayout._size;s.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),f(t)},moveFn:function(r,o){t.attr("transform",n+" translate("+r+","+o+")"),a=s.align(e._xLeftFrac+r/l.w,e._thickFrac,0,1,e.xanchor),i=s.align(e._yBottomFrac-o/l.h,e._lenFrac,0,1,e.yanchor);var c=s.getCursor(a,i,e.xanchor,e.yanchor);f(t,c)},doneFn:function(){if(f(t),void 0!==a&&void 0!==i){var n={};n[e._propPrefix+"x"]=a,n[e._propPrefix+"y"]=i,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){i.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":177,"../../lib":202,"../../lib/extend":196,"../../lib/setcursor":221,"../../lib/svg_text_utils":223,"../../plots/cartesian/axes":246,"../../plots/cartesian/axis_defaults":248,"../../plots/cartesian/layout_attributes":260,"../../plots/cartesian/position_defaults":263,"../../plots/plots":280,"../../registry":293,"../color":75,"../colorscale/helpers":86,"../dragelement":94,"../drawing":97,"../titles":170,"./constants":77,d3:21,tinycolor2:58}],80:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":202}],81:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":76,"./defaults":78,"./draw":79,"./has_colorbar":80}],82:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),a=t("../../lib/regex").counter,i=t("./scales.js").scales;Object.keys(i);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,l=(e=e||{}).cLetter||"c",s=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),c="showScaleDflt"in e?e.showScaleDflt:"z"===l,u="string"==typeof e.colorscaleDflt?i[e.colorscaleDflt]:null,f=e.editTypeOverride||"",d=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},e.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),e.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":217,"../colorbar/attributes":76,"./scales.js":90}],83:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,l=t._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(e,c).get():e,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":202,"./helpers":86,"fast-isnumeric":23}],84:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./helpers").hasColorscale,i=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,a){var o=a.container?n.nestedProperty(t,a.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=t[n];r[a]=[1-i[0],i[1]]}return r}function h(t,e){e=e||{};for(var r=t.domain,o=t.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],92:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":202}],93:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],94:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),a=t("has-hover"),i=t("has-passive-events"),o=t("../../lib").removeElement,l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");function u(){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 f(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){var e,r,n,c,d,p,h,g,v=t.gd,m=1,y=v._context.doubleClickDelay,x=t.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=t.clampFn||function(t,e,r){return Math.abs(t)y&&(m=Math.max(m-1,1)),v._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",e)}catch(t){var n=f(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)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":202,"../../plots/cartesian/constants":252,"./align":91,"./cursor":92,"./unhover":95,"has-hover":25,"has-passive-events":26,"mouse-event-offset":46}],95:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=t("../../lib/throttle"),i=t("../../lib/dom").getGraphDiv,o=t("../fx/constants"),l=e.exports={};l.wrapped=function(t,e,r){(t=i(t))._fullLayout&&a.clear(t._fullLayout._uid+o.HOVERID),l.raw(t,e,r)},l.raw=function(t,e){var r=t._fullLayout,a=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&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/dom":194,"../../lib/events":195,"../../lib/throttle":224,"../fx/constants":109}],96:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],97:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("tinycolor2"),o=t("../../registry"),l=t("../color"),s=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../constants/alignment").LINE_SPACING,p=t("../../constants/interactions").DESELECTDIM,h=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),v=t("../../components/fx/helpers").appendArrayPointValue,m=e.exports={};m.font=function(t,e,r,n){c.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(l.fill,n)},m.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},m.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},m.setRect=function(t,e,r,n,a){t.call(m.setPosition,e,r).call(m.setSize,n,a)},m.translatePoint=function(t,e,r,n){var i=r.c2p(t.x),o=n.c2p(t.y);return!!(a(i)&&a(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",o):e.attr("transform","translate("+i+","+o+")"),!0)},m.translatePoints=function(t,e,r){t.each((function(t){var a=n.select(this);m.translatePoint(t,a,e,r)}))},m.hideOutsideRangePoint=function(t,e,r,n,a,i){e.attr("display",r.isPtWithinRange(t,a)&&n.isPtWithinRange(t,i)?null:"none")},m.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,a=e.yaxis;t.each((function(e){var i=e[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";t.selectAll(c).each((function(t){m.hideOutsideRangePoint(t,n.select(this),r,a,l,s)}))}))}},m.crispRound=function(t,e,r){return e&&a(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},m.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(e,n||i.color),m.dashLine(e,s,o)},m.lineGroupStyle=function(t,e,r,a){t.style("fill","none").each((function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(m.dashLine,s,o)}))},m.dashLine=function(t,e,r){r=+r||0,e=m.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},m.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},m.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(l.fill,e)},m.fillGroupStyle=function(t){t.style("stroke-width",0).each((function(t){var e=n.select(this);t[0].trace&&e.call(l.fill,t[0].trace.fillcolor)}))};var y=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(y).forEach((function(t){var e=y[t],r=e.n;m.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),m.symbolNames[r]=t,m.symbolFuncs[r]=e.f,e.needLine&&(m.symbolNeedLines[r]=!0),e.noDot?m.symbolNoDot[r]=!0:m.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(m.symbolNoFill[r]=!0)}));var x=m.symbolNames.length;function b(t,e){var r=t%100;return m.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}m.symbolNumber=function(t){if(a(t))t=+t;else 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=m.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=x||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},T=n.format("~.1f"),k={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}};m.gradient=function(t,e,r,a,o,s){for(var u=o.length,f=k[a],d=new Array(u),p=0;p"+m(t);h._gradientUrlQueryParts[y]=1},m.initGradients=function(t){var e=t._fullLayout;c.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},m.pointStyle=function(t,e,r){if(t.size()){var a=m.makePointStyleFns(e);t.each((function(t){m.singlePointStyle(t,n.select(this),e,a,r)}))}},m.singlePointStyle=function(t,e,r,n,a){var i=r.marker,o=i.line;if(e.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(t):void 0===t.mo?i.opacity:t.mo),n.ms2mrc){var s;s="various"===t.ms||"various"===i.size?3:n.ms2mrc(t.ms),t.mrc=s,n.selectedSizeFn&&(s=t.mrc=n.selectedSizeFn(t));var u=m.symbolNumber(t.mx||i.symbol)||0;t.om=u%200>=100,e.attr("d",b(u,s))}var f,d,p,h=!1;if(t.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(t.mlw+1||g+1||(t.trace?(t.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in t?t.mlcc=n.lineScale(t.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in t?t.mcc=n.markerScale(t.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(t))}if(t.om)e.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{e.style("stroke-width",(t.isBlank?0:p)+"px");var v=i.gradient,y=t.mgt;if(y?h=!0:y=v&&v.type,Array.isArray(y)&&(y=y[0],k[y]||(y=0)),y&&"none"!==y){var x=t.mgc;x?h=!0:x=v.color;var _=r.uid;h&&(_+="-"+t.i),m.gradient(e,a,_,y,[[0,x],[1,f]],"fill")}else l.fill(e,f);p&&l.stroke(e,d)}},m.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=m.tryColorscale(r,""),e.lineScale=m.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=h.isBubble(t)?g(t):function(){return(r.size||6)/2}),t.selectedpoints&&c.extendFlat(e,m.makeSelectedPointStyleFns(t)),e},m.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,h=void 0!==f;(c.isArrayOrTypedArray(s)||d||h)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?a.opacity:t.mo;return t.selected?d?u:e:h?f:p*e});var g=a.color,v=i.color,m=l.color;(v||m)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?v||e:m||e});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(t,"symbols")&&(_||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||y/2;return t.selected?_?x/2:e:w?b/2:e}),e},m.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return e.selectedTextColorFn=function(t){var e=t.tc||s;return t.selected?c||e:u||(c?e:l.addOpacity(e,p))},e},m.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=m.makeSelectedPointStyleFns(e),a=e.marker||{},i=[];r.selectedOpacityFn&&i.push((function(t,e){t.style("opacity",r.selectedOpacityFn(e))})),r.selectedColorFn&&i.push((function(t,e){l.fill(t,r.selectedColorFn(e))})),r.selectedSizeFn&&i.push((function(t,e){var n=e.mx||a.symbol||0,i=r.selectedSizeFn(e);t.attr("d",b(m.symbolNumber(n),i)),e.mrc2=i})),i.length&&t.each((function(t){for(var e=n.select(this),r=0;r0?r:0}m.textPointStyle=function(t,e,r){if(t.size()){var a;if(e.selectedpoints){var i=m.makeSelectedTextStyleFns(e);a=i.selectedTextColorFn}var o=e.texttemplate,l=r._fullLayout;t.each((function(t){var i=n.select(this),s=o?c.extractOption(t,e,"txt","texttemplate"):c.extractOption(t,e,"tx","text");if(s||0===s){if(o){var f=e._module.formatLabels?e._module.formatLabels(t,e,l):{},d={};v(d,e,t.i);var p=e._meta||{};s=c.texttemplateString(s,f,l._d3locale,d,t,p)}var h=t.tp||e.textposition,g=L(t,e),y=a?a(t):t.tc||e.textfont.color;i.call(m.font,t.tf||e.textfont.family,g,y).text(s).call(u.convertToTspans,r).call(A,h,g,t.mrc)}else i.remove()}))}},m.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=m.makeSelectedTextStyleFns(e);t.each((function(t){var a=n.select(this),i=r.selectedTextColorFn(t),o=t.tp||e.textposition,s=L(t,e);l.fill(a,i),A(a,o,s,t.mrc2||t.mrc)}))}};function S(t,e,r,a){var i=t[0]-e[0],o=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(e[0]+(p&&f/p),2),n.round(e[1]+(p&&d/p),2)],[n.round(e[0]-(h&&f/h),2),n.round(e[1]-(h&&d/h),2)]]}m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(m.savedBBoxes={},D=0),r&&(m.savedBBoxes[r]=v),D++,c.extendFlat({},v)},m.setClipUrl=function(t,e,r){t.attr("clip-path",P(e,r))},m.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}},m.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=" translate("+e+", "+r+")").trim(),t[a]("transform",i),i},m.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}},m.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+=" scale("+e+", "+r+")").trim(),t[a]("transform",i),i};var E=/\s*sc.*/;m.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(E,"");t=(t+=n).trim(),this.setAttribute("transform",t)}))}};var I=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(t,e,r){t&&t.each((function(){var t,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(I);t=1===e&&1===r?[]:["translate("+o+","+l+")","scale("+e+","+r+")","translate("+-o+","+-l+")"],s&&t.push(s),a.attr("transform",t.join(" "))}}))}},{"../../components/fx/helpers":111,"../../constants/alignment":177,"../../constants/interactions":180,"../../constants/xmlns_namespaces":182,"../../lib":202,"../../lib/svg_text_utils":223,"../../registry":293,"../../traces/scatter/make_bubble_size_func":430,"../../traces/scatter/subtypes":437,"../color":75,"../colorscale":87,"./symbol_defs":98,d3:21,"fast-isnumeric":23,tinycolor2:58}],98:[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,a="l"+e+",-"+e,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+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),a=n.round(-t,2),i=n.round(-.309*t,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"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),a=n.round(.951*e,2),i=n.round(.363*e,2),o=n.round(.588*e,2),l=n.round(-e,2),s=n.round(-.309*e,2),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*e,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),a=n.round(.76*t,2);return"M-"+a+",0l-"+r+",-"+e+"h"+a+"l"+r+",-"+e+"l"+r+","+e+"h"+a+"l-"+r+","+e+"l"+r+","+e+"h-"+a+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+a+"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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+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),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"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),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"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),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+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),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:21}],99:[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"}}}},{}],100:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../registry"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),l=t("./compute_error");function s(t,e,r,a){var s=e["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;e.each((function(e){var f,d=e[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(t){return t.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(e=[]);var v=n.select(this).selectAll("g.errorbar").data(e,f);if(v.exit().remove(),e.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.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),a(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),a(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0)));return n}(t,s,c);if(!g||t.vis){var i,o=e.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=e.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":437,"../drawing":97,d3:21,"fast-isnumeric":23}],105:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each((function(t){var e=t[0].trace,r=e.error_y||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":75,d3:21}],106:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("./layout_attributes").hoverlabel,i=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":196,"../../plots/font_attributes":274,"./layout_attributes":116}],107:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry");function i(t,e,r,a){a=a||n.identity,Array.isArray(t)&&(e[0][r]=a(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 l=0;l=0&&r.indexb[0]._length||tt<0||tt>w[0]._length)return d.unhoverRaw(t,e)}if(e.pointerX=K+b[0]._offset,e.pointerY=tt+w[0]._offset,E="xval"in e?g.flat(s,e.xval):g.p2c(b,K),I="yval"in e?g.flat(s,e.yval):g.p2c(w,tt),!a(E[0])||!a(I[0]))return o.warn("Fx.hover failed",e,t),d.unhoverRaw(t,e)}var rt=1/0;function nt(t,r){for(F=0;FZ&&(W.splice(0,Z),rt=W[0].distance),m&&0!==X&&0===W.length){G.distance=X,G.index=!1;var d=B._module.hoverPoints(G,V,q,"closest",u._hoverlayer);if(d&&(d=d.filter((function(t){return t.spikeDistance<=X}))),d&&d.length){var p,h=d.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(p=it(v),(!J.vLinePoint||J.vLinePoint.spikeDistance>p.spikeDistance)&&(J.vLinePoint=p))}var y=d.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(p=it(x),(!J.hLinePoint||J.hLinePoint.spikeDistance>p.spikeDistance)&&(J.hLinePoint=p))}}}}}function at(t,e){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===C&&$&&W.length>1,Mt=f.combine(u.plot_bgcolor||f.background,u.paper_bgcolor),At={hovermode:C,rotateLabels:kt,bgColor:Mt,container:u._hoverlayer,outerContainer:u._paperdiv,commonLabelOpts:u.hoverlabel,hoverdistance:u.hoverdistance},Lt=S(W,At,t);g.isUnifiedHover(C)||(!function(t,e,r){var n,a,i,o,l,s,c,u=0,f=1,d=t.size(),p=new Array(d),h=0;function g(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=i;n=!1}if(n){var c=0;for(o=0;oe.pmax&&c++;for(o=t.length-1;o>=0&&!(c<=0);o--)(s=t[o]).pos>e.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)t[l].dp-=i;for(o=t.length-1;o>=0&&!(c<=0);o--)(s=t[o]).pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}t.each((function(t){var n=t[e],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(a?_:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(t,e){return t[0].posref-e[0].posref||f*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var w=b[l],T=w.datum;T.offset=w.dp,T.del=w.del}}}(Lt,kt?"xa":"ya",u),O(Lt,kt));if(e.target&&e.target.tagName){var St=h.getComponentMethod("annotations","hasClickToShow")(t,bt);c(n.select(e.target),St?"pointer":"")}if(!e.target||i||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(t,0,xt))return;xt&&t.emit("plotly_unhover",{event:e,points:xt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:b,yaxes:w,xvals:E,yvals:I})}(t,e,r,i)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var a=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,nameLength:t.nameLength,textAlign:t.textAlign,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),o=e.outerContainer?n.select(e.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||f.background,container:i,outerContainer:o},s=S(a,l,e.gd),c=0,u=0;return s.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function S(t,e,r){var a=r._fullLayout,i=e.hovermode,l=e.rotateLabels,c=e.bgColor,d=e.container,p=e.outerContainer,h=e.commonLabelOpts||{},b=e.fontFamily||v.HOVERFONT,_=e.fontSize||v.HOVERFONTSIZE,w=t[0],T=w.xa,L=w.ya,S="y"===i.charAt(0)?"yLabel":"xLabel",O=w[S],D=(String(O)||"").split(" ")[0],z=p.node().getBoundingClientRect(),P=z.top,E=z.width,I=z.height,R=void 0!==O&&w.distance<=e.hoverdistance&&("x"===i||"y"===i);if(R){var F,N,B=!0;for(F=0;Fa.width-S?(m=a.width-S,l.attr("d","M"+(S-k)+",0L"+S+","+A+k+"v"+A+(2*M+x.height)+"H-"+S+"V"+A+k+"H"+(S-2*k)+"Z")):l.attr("d","M0,0L"+k+","+A+k+"H"+(M+x.width/2)+"v"+A+(2*M+x.height)+"H-"+(M+x.width/2)+"V"+A+k+"H-"+k+"Z")}else{var C,D,z;"right"===L.side?(C="start",D=1,z="",m=T._offset+T._length):(C="end",D=-1,z="-",m=T._offset),y=L._offset+(w.y0+w.y1)/2,c.attr("text-anchor",C),l.attr("d","M0,0L"+z+k+","+k+"V"+(M+x.height/2)+"h"+z+(2*M+x.width)+"V-"+(M+x.height/2)+"H"+z+k+"V-"+k+"Z");var E,I=x.height/2,R=P-x.top-I,F="clip"+a._uid+"commonlabel"+L._id;if(m=0?K-=rt:K+=2*M;var nt=et.height+2*M,at=$+nt>=I;return nt<=I&&($<=P?$=L._offset+2*M:at&&($=I-nt)),tt.attr("transform","translate("+K+","+$+")"),tt}var it=d.selectAll("g.hovertext").data(t,(function(t){return A(t)}));return it.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(f.fill,f.addOpacity(c,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(u.font,b,_)})),it.exit().remove(),it.each((function(t){var e=n.select(this).attr("transform",""),o=t.bgcolor||t.color,d=f.combine(f.opacity(o)?o:f.defaultLine,c),p=f.combine(f.opacity(t.color)?t.color:f.defaultLine,c),h=t.borderColor||f.contrast(d),g=C(t,R,i,a,O,e),v=g[0],m=g[1],y=e.select("text.nums").call(u.font,t.fontFamily||b,t.fontSize||_,t.fontColor||h).text(v).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r),w=e.select("text.name"),T=0,A=0;if(m&&m!==v){w.call(u.font,t.fontFamily||b,t.fontSize||_,p).text(m).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r);var L=w.node().getBoundingClientRect();T=L.width+2*M,A=L.height+2*M}else w.remove(),e.select("rect").remove();e.select("path").style({fill:d,stroke:h});var S,D,z=y.node().getBoundingClientRect(),F=t.xa._offset+(t.x0+t.x1)/2,N=t.ya._offset+(t.y0+t.y1)/2,B=Math.abs(t.x1-t.x0),H=Math.abs(t.y1-t.y0),j=z.width+k+M+T;if(t.ty0=P-z.top,t.bx=z.width+2*M,t.by=Math.max(z.height+2*M,A),t.anchor="start",t.txwidth=z.width,t.tx2width=T,t.offset=0,l)t.pos=F,S=N+H/2+j<=I,D=N-H/2-j>=0,"top"!==t.idealAlign&&S||!D?S?(N+=H/2,t.anchor="start"):t.anchor="middle":(N-=H/2,t.anchor="end");else if(t.pos=N,S=F+B/2+j<=E,D=F-B/2-j>=0,"left"!==t.idealAlign&&S||!D)if(S)F+=B/2,t.anchor="start";else{t.anchor="middle";var U=j/2,V=F+U-E,q=F-U;V>0&&(F-=V),q<0&&(F+=-q)}else F-=B/2,t.anchor="end";y.attr("text-anchor",t.anchor),T&&w.attr("text-anchor",t.anchor),e.attr("transform","translate("+F+","+N+")"+(l?"rotate("+x+")":""))})),it}function C(t,e,r,n,a,i){var l="",s="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),l=E(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(s+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(s+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(s+=(s?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===a?s=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(s=t.yLabel):s=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(s+=(s?"
":"")+t.text),void 0!==t.extraText&&(s+=(s?"
":"")+t.extraText),i&&""===s&&!t.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=t.hovertemplate||!1,f=t.hovertemplateLabels||t,d=t.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,t.trace._meta)).replace(L,(function(e,r){return l=E(r,t.nameLength),""}))),[s,l]}function O(t,e){t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var a=r.select("text.nums"),i=t.anchor,o="end"===i?-1:1,l={start:1,end:-1,middle:0}[i],c=l*(k+M),f=c+l*(t.txwidth+M),d=0,p=t.offset;"middle"===i&&(c-=t.tx2width/2,f+=t.txwidth/2+M),e&&(p*=-T,d=t.offset*w),r.select("path").attr("d","middle"===i?"M-"+(t.bx/2+t.tx2width/2)+","+(p-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(o*k+d)+","+(k+p)+"v"+(t.by/2-k)+"h"+o*t.bx+"v-"+t.by+"H"+(o*k+d)+"V"+(p-k)+"Z");var h=c+d,g=p+t.ty0-t.by/2+M,v=t.textAlign||"auto";"auto"!==v&&("left"===v&&"start"!==i?(a.attr("text-anchor","start"),h="middle"===i?-t.bx/2-t.tx2width/2+M:-t.bx-M):"right"===v&&"end"!==i&&(a.attr("text-anchor","end"),h="middle"===i?t.bx/2-t.tx2width/2-M:t.bx+M)),a.call(s.positionText,h,g),t.tx2width&&(r.select("text.name").call(s.positionText,f+l*M+d,p+t.ty0-t.by/2+M),r.select("rect").call(u.setRect,f+(l-1)*t.tx2width/2+d,p-t.by/2-1,t.tx2width,t.by+2))}))}function D(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],l=t.cd[r]||{};function s(t){return t||a(t)&&0===t}var c=Array.isArray(r)?function(t,e){var a=o.castOption(i,r,t);return s(a)?a:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(l,n,t,e)};function u(e,r,n){var a=c(r,n);s(a)&&(t[e]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),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:p.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:p.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 f=p.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+f+" / -"+p.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+f,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var d=p.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+d+" / -"+p.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+d,"y"===e&&(t.distance+=1)}var h=t.hoverinfo||t.trace.hoverinfo;return h&&"all"!==h&&(-1===(h=Array.isArray(h)?h:h.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===h.indexOf("y")&&(t.yLabel=void 0),-1===h.indexOf("z")&&(t.zLabel=void 0),-1===h.indexOf("text")&&(t.text=void 0),-1===h.indexOf("name")&&(t.name=void 0)),t}function z(t,e,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,d=!!e.hLinePoint,h=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),h||d){var g=f.combine(l.plot_bgcolor,l.paper_bgcolor);if(d){var v,m,y=e.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,g)<1.5?f.contrast(g):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=p.getPxPosition(t,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T,stroke:k,"stroke-dasharray":u.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:m,r:T,fill:k}).classed("spikeline",!0)}if(h){var S,C,O=e.vLinePoint;n=O&&O.xa,a=O&&O.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+O.x,C=a._offset+O.y);var D,z,P=i.readability(O.color,g)<1.5?f.contrast(g):O.color,E=n.spikemode,I=n.spikethickness,R=n.spikecolor||P,F=p.getPxPosition(t,n);if(-1!==E.indexOf("toaxis")||-1!==E.indexOf("across")){if(-1!==E.indexOf("toaxis")&&(D=F,z=C),-1!==E.indexOf("across")){var N=n._counterDomainMin,B=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),B=Math.max(B,n.position)),D=s.t+(1-B)*s.h,z=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:z,"stroke-width":I,stroke:R,"stroke-dasharray":u.dashStyle(n.spikedash,I)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:z,"stroke-width":I+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==E.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?I:-I),r:I,fill:R}).classed("spikeline",!0)}}}function P(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function E(t,e){return s.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":202,"../../lib/events":195,"../../lib/override_cursor":213,"../../lib/svg_text_utils":223,"../../plots/cartesian/axes":246,"../../registry":293,"../color":75,"../dragelement":94,"../drawing":97,"../legend/defaults":127,"../legend/draw":128,"./constants":109,"./helpers":111,d3:21,"fast-isnumeric":23,tinycolor2:58}],113:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),i=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function l(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&i(e.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),e.legend?(o.bgcolor||(o.bgcolor=a.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":202,"../color":75,"./helpers":111}],114:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function i(r,i){return void 0!==e[r]?e[r]:n.coerce(t,e,a,r,i)}var o,l=i("clickmode");return e._has("cartesian")?l.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===k("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===k("roworder"),w=d?.2:.1,T=d?.3:.1;g&&e._splomGridDflt&&(x=e._splomGridDflt.xside,b=e._splomGridDflt.yside),v._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,m,_)}}else delete e.grid}function k(t,e){return n.coerce(r,v,s,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=t.grid||{},p=e._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(e,"legend");if(_("uirevision",e.uirevision),!1!==g){_("bgcolor",e.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",e.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(e.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",e.font))}}function _(t,e){return a.coerce(c,v,o,t,e)}}},{"../../lib":202,"../../plot_api/plot_template":236,"../../plots/layout_attributes":278,"../../registry":293,"./attributes":125,"./helpers":131}],128:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../registry"),l=t("../../lib/events"),s=t("../dragelement"),c=t("../drawing"),u=t("../color"),f=t("../../lib/svg_text_utils"),d=t("./handle_click"),p=t("./constants"),h=t("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=t("./get_legend_data"),x=t("./style"),b=t("./helpers");function _(t,e,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(t,"plotly_legendclick",s))if(1===n)e._clickTimeout=setTimeout((function(){d(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==l.triggerHandler(t,"plotly_legenddoubleclick",s)&&d(r,t,n)}}function w(t,e,r){var n,i=t.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&e._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(t,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,r.font).text(d?T(n,h):n),f.positionText(g,p.textGap,0),d?g.call(f.makeEditable,{gd:e,text:n}).call(M,t,e,r).on("edit",(function(n){this.text(T(n,h)).call(M,t,e,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",e,s,u)})):M(g,t,e,r)}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,i=e._context.doubleClickDelay,o=1,l=a.ensureSingle(t,"rect","legendtoggle",(function(t){t.style("cursor","pointer").attr("pointer-events","all").call(u.fill,"rgba(0,0,0,0)")}));l.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(e,r,t,o,n.event)}}))}function M(t,e,r,n){n._main||t.attr("data-notex",!0),f.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var a=t.select("g[class*=math-group]"),i=a.node();r||(r=e._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=t.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);n?f.positionText(h,p.textGap,-y):f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(e,r,n)}))}function A(t){return a.isRightAnchor(t)?"right":a.isCenterAnchor(t)?"center":"left"}function L(t){return a.isBottomAnchor(t)?"bottom":a.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,l=t._fullLayout,f="legend"+l._uid;if(e?(r=e.layer,f+="-hover"):((e=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;d=l.showlegend&&y(t.calcdata,e)}else{if(!e.entries)return;d=y(e.entries,e)}var h=l.hiddenlabels||[];if(e._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(t,"legend");var g=a.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),T=a.ensureSingleById(l._topdefs,"clipPath",f,(function(t){t.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));S.call(u.stroke,e.bordercolor).call(u.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),O=e.title;if(e._titleWidth=0,e._titleHeight=0,O.text){var D=a.ensureSingle(C,"text","legendtitletext");D.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,O.font).text(O.text),M(D,C,t,e)}else C.selectAll(".legendtitletext").remove();var z=a.ensureSingle(g,"rect","scrollbar",(function(t){t.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),P=C.selectAll("g.groups").data(d);P.enter().append("g").attr("class","groups"),P.exit().remove();var E=P.selectAll("g.traces").data(a.identity);E.enter().append("g").attr("class","traces"),E.exit().remove(),E.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==h.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(x,t,e).each((function(){e._main&&n.select(this).call(k,t)})),a.syncOrAsync([i.previousPromises,function(){return function(t,e,r,a){var i=t._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.textGap,h=p.itemGap,g=2*(u+h),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(a);if(l)r.each((function(t){var e=t[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+e/2+h),a._height+=e,a._width=Math.max(a._width,t[0].width)})),x=d+a._width,a._width+=h+d+f,a._height+=g,s&&(e.each((function(t,e){c.setTranslate(this,0,e*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:S:k?M&&"right"===w?o.r+o.w:S:o.w,2*d);var C=0,O=0;r.each((function(t){var e=t[0].width+d;C=Math.max(C,e),O+=e})),x=null;var D=0;if(s){var z=0,P=0,E=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+h+n/2+e),e+=n,t=Math.max(t,d+r[0].width)})),z=Math.max(z,e);var r=t+h;r+u+P>a._maxWidth&&(D=Math.max(D,P),P=0,E+=z+a.tracegroupgap,z=e),c.setTranslate(this,P,E),P+=r})),a._width=Math.max(D,P)+u,a._height=E+z+g}else{var I=r.size(),R=O+f+(I-1)*ha._maxWidth&&(D=Math.max(D,H),N=0,B+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+B+e/2+h),H=N+r+h,N+=n,F=Math.max(F,e)})),R?(a._width=N+f,a._height=F+g):(a._width=Math.max(D,H)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var j=t._context.edits,U=j.legendText||j.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,a=U?d:x||d+t[0].width;l||(a+=h/2),c.setRect(e,0,-r/2,a,r)}))}(t,P,E,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=A(e),n=L(e);return i.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*v[r],r:e._width*m[r],b:e._effHeight*m[n],t:e._effHeight*v[n]})}(t)){var u,d,h,y,x=l._size,b=e.borderwidth,w=x.l+x.w*e.x-v[A(e)]*e._width,k=x.t+x.h*(1-e.y)-v[L(e)]*e._effHeight;if(e._main&&l.margin.autoexpand){var M=w,O=k;w=a.constrain(w,0,l.width-e._width),k=a.constrain(k,0,l.height-e._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==O&&a.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&c.setTranslate(g,w,k),z.on(".drag",null),g.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var D=e._effHeight;e._main||(D=e._height),S.attr({width:e._width-b,height:D-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:e._width-2*b,height:D-2*b,x:b,y:b}),c.setClipUrl(C,f,t),c.setRect(z,0,0,0,0),delete e._scrollY}else{var P,E,I,R=Math.max(p.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),F=e._effHeight-R-2*p.scrollBarMargin,N=e._height-e._effHeight,B=F/N,H=Math.min(e._scrollY||0,N);S.attr({width:e._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:e._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:e._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:e._effHeight-2*b,x:b,y:b+H}),c.setClipUrl(C,f,t),V(H,R,B),g.on("wheel",(function(){V(H=a.constrain(e._scrollY+n.event.deltaY/F*N,0,N),R,B),0!==H&&H!==N&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;P="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,I=H})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(E="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,V(H=function(t,e,r){var n=(r-e)/B+t;return a.constrain(n,0,N)}(I,P,E),R,B))}));z.call(j);var U=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(P=t.changedTouches[0].clientY,I=H)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(E=t.changedTouches[0].clientY,V(H=function(t,e,r){var n=(e-r)/B+t;return a.constrain(n,0,N)}(I,P,E),R,B))}));C.call(U)}if(t._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:t,prepFn:function(){var t=c.getTranslate(g);h=t.x,y=t.y},moveFn:function(t,r){var n=h+t,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,e.xanchor),d=s.align(a,0,x.t+x.h,x.t,e.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",t,{"legend.x":u,"legend.y":d})},clickFn:function(e,n){var a=r.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}));a.size()>0&&_(t,g,a,e,n)}})}function V(r,n,a){e._scrollY=t._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(z,e._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],t)}}},{"../../constants/alignment":177,"../../lib":202,"../../lib/events":195,"../../lib/svg_text_utils":223,"../../plots/plots":280,"../../registry":293,"../color":75,"../dragelement":94,"../drawing":97,"./constants":126,"./get_legend_data":129,"./handle_click":130,"./helpers":131,"./style":133,d3:21}],129:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=e._main;function p(t,r){if(""!==t&&a.isGrouped(e))-1===l.indexOf(t)?(l.push(t),s=!0,o[t]=[[r]]):o[t].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=e.width}return h?n:Math.min(a,r)};function v(t,e,r){var i=t[0].trace,o=i.marker||{},s=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(c?[t]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.each((function(t){var e=n.select(this),r=t[0],a=g(r.mlw,o.line,5,2);e.style("stroke-width",a+"px").call(l.fill,r.mc||o.color),a&&l.stroke(e,r.mlc||s.color)}))}function m(t,e,r){var o=t[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(s?[t]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.size()){var d=(l.marker||{}).line,p=g(f(d.width,o.pts),d,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=d.color;var v=i.minExtend(o,{trace:h});u(c,v,h)}}t.each((function(t){var e=n.select(this),a=i.ensureSingle(e,"g","layers");a.style("opacity",t[0].trace.opacity);var o=r.valign,l=t[0].lineHeight,s=t[0].height;if("middle"!==o&&l&&s){var c={top:1,bottom:-1}[o]*(.5*(l-s+3));a.attr("transform","translate(0,"+c+")")}else a.attr("transform",null);a.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var u=a.selectAll("g.legendsymbols").data([t]);u.enter().append("g").classed("legendsymbols",!0),u.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,a=t[0].trace,c=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":c=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":c=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":c=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":c=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":c=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":c=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(c);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),u.exit().remove(),u.each((function(t,c){var u,f=n.select(this),p=s(a),h=p.colorscale,g=p.reversescale;if(h){if(!r){var v=h.length;u=0===c?h[g?v-1:0][1]:1===c?h[g?0:v-1][1]:h[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[c]||m[0]:m}f.attr("d",t[0]),u?f.call(l.fill,u):f.call((function(t){if(t.size()){var n="legendfill-"+a.uid;o.gradient(t,e,n,d(g,"radial"===r),h,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var a=t[0].trace[t[0].dir].marker;return t[0].mc=a.color,t[0].mlw=a.line.width,t[0].mlc=a.line.color,v(t,this,"waterfall")}var i=[];e.visible&&r&&(i=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),a=e[t[0]].marker,i=g(void 0,a.line,5,2);r.attr("d",t[1]).style("stroke-width",i+"px").call(l.fill,a.color),i&&r.call(l.stroke,a.line.color)}))})).each((function(t){v(t,this,"funnel")})).each((function(t){v(t,this)})).each((function(t){var r=t[0].trace,s=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[t]:[]);s.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),s.exit().remove(),s.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var a=g(void 0,r.line,5,2);t.style("stroke-width",a+"px").call(l.fill,r.fillcolor),a&&l.stroke(t,r.line.color)}else{var c=i.minExtend(r,{marker:{size:h?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});s.call(o.pointStyle,c,e)}}))})).each((function(t){m(t,this,"funnelarea")})).each((function(t){m(t,this,"pie")})).each((function(t){var r,a,l=t[0],u=l.trace,f=u.visible&&u.fill&&"none"!==u.fill,p=c.hasLines(u),h=u.contours,v=!1,m=!1,y=s(u),x=y.colorscale,b=y.reversescale;if(h){var _=h.coloring;"lines"===_?v=!0:p="none"===_||"heatmap"===_||h.showlines,"constraint"===h.type?f="="!==h._operation:"fill"!==_&&"heatmap"!==_||(m=!0)}var w=c.hasMarkers(u)||c.hasText(u),T=f||m,k=p||v,M=w||!T?"M5,0":k?"M5,-2":"M5,-3",A=n.select(this),L=A.select(".legendfill").selectAll("path").data(f||m?[t]:[]);if(L.enter().append("path").classed("js-fill",!0),L.exit().remove(),L.attr("d",M+"h30v6h-30z").call(f?o.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+u.uid;o.gradient(t,e,r,d(b),x,"fill")}}),p||v){var S=g(void 0,u.line,10,5);a=i.minExtend(u,{line:{width:S}}),r=[i.minExtend(l,{trace:a})]}var C=A.select(".legendlines").selectAll("path").data(p||v?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",M+(v?"l30,0.0001":"h30")).call(p?o.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+u.uid;o.lineGroupStyle(t),o.gradient(t,e,r,d(b),x,"stroke")}})})).each((function(t){var r,a,l=t[0],s=l.trace,u=c.hasMarkers(s),f=c.hasText(s),d=c.hasLines(s);function p(t,e,r,n){var a=i.nestedProperty(s,t).get(),o=i.isArrayOrTypedArray(a)&&e?e(a):a;if(h&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(t){return l._distinct&&l.index&&t[l.index]?t[l.index]:t[0]}if(u||f||d){var v={},m={};if(u){v.mc=p("marker.color",g),v.mx=p("marker.symbol",g),v.mo=p("marker.opacity",i.mean,[.2,1]),v.mlc=p("marker.line.color",g),v.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);v.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",g,[0,10],5)}),f&&(v.tx="Aa",v.tp=p("textposition",g),v.ts=10,v.tc=p("textfont.color",g),v.tf=p("textfont.family",g)),r=[i.minExtend(l,v)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var x=n.select(this).select("g.legendpoints"),b=x.selectAll("path.scatterpts").data(u?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),b.exit().remove(),b.call(o.pointStyle,a,e),u&&(r[0].mrc=3);var _=x.selectAll("g.pointtext").data(f?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.selectAll("text").call(o.textPointStyle,a,e)})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.visible&&"candlestick"===e.type?[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 a=n.select(this),i=e[r?"increasing":"decreasing"],o=g(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(l.fill,i.fillcolor),o&&l.stroke(a,i.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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 a=n.select(this),i=e[r?"increasing":"decreasing"],s=g(void 0,i.line,5,2);a.style("fill","none").call(o.dashLine,i.line.dash,s),s&&l.stroke(a,i.line.color)}))}))}},{"../../lib":202,"../../registry":293,"../../traces/pie/helpers":405,"../../traces/pie/style_one":411,"../../traces/scatter/subtypes":437,"../color":75,"../colorscale/helpers":86,"../drawing":97,d3:21}],134:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/plots"),i=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),l=t("../shapes/draw").eraseActiveShape,s=t("../../lib"),c=s._,u=e.exports={};function f(t,e){var r,a,o=e.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=t._fullLayout,u={},f=i.list(t,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var g=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),a=0,i=0;i=n.max)e=R[r+1];else if(t=n.pmax)e=R[r+1];else if(t0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(t,e,r,n,a){var l="category"===t.type||"multicategory"===t.type?t.r2c:t.d2c;if(void 0!==e)return[l(e),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===t.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]: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;oy?(k=f,S="y0",M=y,C="y1"):(k=y,S="y1",M=f,C="y0");Y(n),Q(l,r),function(t,e,r){var n=e.xref,a=e.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(t,s?"clip"+r._fullLayout._uid+s:null,r)}(e,r,t),Z.moveFn="move"===P?X:W,Z.altKey=n.altKey},doneFn:function(){if(m(t))return;p(e),J(l),b(e,t,r),n.call("_guiRelayout",t,s.getUpdateObj())},clickFn:function(){if(m(t))return;J(l)}};function Y(r){if(m(t))P=null;else if(R)P="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=Z.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(e,s),P=s.split("-")[0]}}function X(n,a){if("path"===r.type){var i=function(t){return t},o=i,s=i;E?N("xanchor",r.xanchor=V(x+n)):(o=function(t){return V(j(t)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),I?N("yanchor",r.yanchor=q(T+a)):(s=function(t){return q(U(t)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",r.path=w(z,o,s))}else E?N("xanchor",r.xanchor=V(x+n)):(N("x0",r.x0=V(c+n)),N("x1",r.x1=V(v+n))),I?N("yanchor",r.yanchor=q(T+a)):(N("y0",r.y0=q(f+a)),N("y1",r.y1=q(y+a)));e.attr("d",_(t,r)),Q(l,r)}function W(n,a){if(F){var i=function(t){return t},o=i,s=i;E?N("xanchor",r.xanchor=V(x+n)):(o=function(t){return V(j(t)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),I?N("yanchor",r.yanchor=q(T+a)):(s=function(t){return q(U(t)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",r.path=w(z,o,s))}else if(R){if("resize-over-start-point"===P){var u=c+n,d=I?f-a:f+a;N("x0",r.x0=E?u:V(u)),N("y0",r.y0=I?d:q(d))}else if("resize-over-end-point"===P){var p=v+n,h=I?y-a:y+a;N("x1",r.x1=E?p:V(p)),N("y1",r.y1=I?h:q(h))}}else{var m=function(t){return-1!==P.indexOf(t)},b=m("n"),G=m("s"),Z=m("w"),Y=m("e"),X=b?k+a:k,W=G?M+a:M,J=Z?A+n:A,$=Y?L+n:L;I&&(b&&(X=k-a),G&&(W=M-a)),(!I&&W-X>10||I&&X-W>10)&&(N(S,r[S]=I?X:q(X)),N(C,r[C]=I?W:q(W))),$-J>10&&(N(O,r[O]=E?J:V(J)),N(D,r[D]=E?$:V($)))}e.attr("d",_(t,r)),Q(l,r)}function Q(t,e){(E||I)&&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 i=j(E?e.xanchor:a.midRange(r?[e.x0,e.x1]:g.extractPathCoords(e.path,h.paramIsX))),o=U(I?e.yanchor:a.midRange(r?[e.y0,e.y1]:g.extractPathCoords(e.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),E&&I){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(E){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function J(t){t.selectAll(".visual-cue").remove()}d.init(Z),G.node().onmousemove=Y}(t,E,s,e,r,P):!0===s.editable&&E.style("pointer-events",D||c.opacity(L)*A<=.5?"stroke":"all");E.node().addEventListener("click",(function(){return function(t,e){if(!y(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void T(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=T,v(t)}}(t,E)}))}}function b(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"");u.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function _(t,e){var r,n,o,l,s,c,u,f,d=e.type,p=i.getFromId(t,e.xref),v=i.getFromId(t,e.yref),m=t._fullLayout._size;if(p?(r=g.shapePositionToRange(p),n=function(t){return p._offset+p.r2p(r(t,!0))}):n=function(t){return m.l+m.w*t},v?(o=g.shapePositionToRange(v),l=function(t){return v._offset+v.r2p(o(t,!0))}):l=function(t){return m.t+m.h*(1-t)},"path"===d)return p&&"date"===p.type&&(n=g.decodeDate(n)),v&&"date"===v.type&&(l=g.decodeDate(l)),function(t,e,r){var n=t.path,i=t.xsizemode,o=t.ysizemode,l=t.xanchor,s=t.yanchor;return n.replace(h.segmentRE,(function(t){var n=0,c=t.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=t.substr(1).replace(h.paramRE,(function(t){return u[n]?t="pixel"===i?e(l)+Number(t):e(t):f[n]&&(t="pixel"===o?r(s)-Number(t):r(t)),++n>d&&(t="X"),t}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+t)),c+p}))}(e,n,l);if("pixel"===e.xsizemode){var y=n(e.xanchor);s=y+e.x0,c=y+e.x1}else s=n(e.x0),c=n(e.x1);if("pixel"===e.ysizemode){var x=l(e.yanchor);u=x-e.y0,f=x-e.y1}else u=l(e.y0),f=l(e.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var b=(s+c)/2,_=(u+f)/2,w=Math.abs(b-s),T=Math.abs(_-u),k="A"+w+","+T,M=b+w+","+_;return"M"+M+k+" 0 1,1 "+(b+","+(_-T))+k+" 0 0,1 "+M+"Z"}function w(t,e,r){return t.replace(h.segmentRE,(function(t){var n=0,a=t.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+t.substr(1).replace(h.paramRE,(function(t){return n>=l||(i[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function T(t){y(t)&&(t._fullLayout._activeShapeIndex>=0&&(s(t),delete t._fullLayout._activeShapeIndex,v(t)))}e.exports={draw:v,drawOne:x,eraseActiveShape:function(t){if(!y(t))return;s(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&f(m),r.attr("d",g(e)),M&&!d)&&(k=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===T&&(t[0][0]="M"),e[w]=t,y(),x())}}()}}function z(t,r){!function(t,r){if(e.length)for(var n=0;n0&&s0&&(l=l.transition().duration(e.transition.duration).ease(e.transition.easing)),l.attr("transform","translate("+(o-.5*u.gripWidth)+","+e._dims.currentValueTotalHeight+")")}}function L(t,e){var r=t._dims;return r.inputAreaStart+u.stepInset+(r.inputAreaLength-2*u.stepInset)*Math.min(1,Math.max(0,e))}function S(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-u.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*u.stepInset-2*r.inputAreaStart)))}function C(t,e,r){var n=r._dims,a=l.ensureSingle(t,"rect",u.railTouchRectClass,(function(n){n.call(k,e,t,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,u.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function O(t,e){var r=e._dims,n=r.inputAreaLength-2*u.railInset,a=l.ensureSingle(t,"rect",u.railRectClass);a.attr({width:n,height:u.railWidth,rx:u.railRadius,ry:u.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,e.bordercolor).call(i.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(a,u.railInset,.5*(r.inputAreaWidth-u.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[u.name],n=[],a=0;a0?[0]:[]);function l(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),a.autoMargin(t,g(e))}if(i.enter().append("g").classed(u.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+u.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+u.groupClassName).data(r,v);s.enter().append("g").classed(u.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||f<0){var v={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];e.attr("transform","translate("+v+")")}}}return E.call(I),z&&(L?E.on(".opacity",null):(k=0,M=!0,E.text(m).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)}))),E.call(u.makeEditable,{gd:t}).on("edit",(function(e){void 0!==y?o.call("_guiRestyle",t,v,e,y):o.call("_guiRelayout",t,v,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(I)})).on("input",(function(t){this.text(t||" ").call(u.positionText,b.x,b.y)}))),E.classed("js-placeholder",M),w}}},{"../../constants/alignment":177,"../../constants/interactions":180,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/plots":280,"../../registry":293,"../color":75,"../drawing":97,d3:21,"fast-isnumeric":23}],171:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll,l=t("../../plots/pad_attributes"),s=t("../../plot_api/plot_template").templatedArray,c=s("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"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});e.exports=o(s("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:c,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:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":196,"../../plot_api/edit_types":229,"../../plot_api/plot_template":236,"../../plots/font_attributes":274,"../../plots/pad_attributes":279,"../color/attributes":74}],172:[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"}}},{}],173:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/array_container_defaults"),i=t("./attributes"),o=t("./constants").name,l=i.buttons;function s(t,e,r){function o(r,a){return n.coerce(t,e,i,r,a)}o("visible",a(t,e,{name:"buttons",handleItemDefaults:c}).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 c(t,e){function r(r,a){return n.coerce(t,e,l,r,a)}r("visible","skip"===t.method||Array.isArray(t.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}e.exports=function(t,e){a(t,e,{name:o,handleItemDefaults:s})}},{"../../lib":202,"../../plots/array_container_defaults":242,"./attributes":171,"./constants":172}],174:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=t("../color"),o=t("../drawing"),l=t("../../lib"),s=t("../../lib/svg_text_utils"),c=t("../../plot_api/plot_template").arrayEditor,u=t("../../constants/alignment").LINE_SPACING,f=t("./constants"),d=t("./scrollbox");function p(t){return t._index}function h(t,e){return+t.attr(f.menuIndexAttrName)===e._index}function g(t,e,r,n,a,i,o,l){e.active=o,c(t.layout,f.name,e).applyUpdate("active",o),"buttons"===e.type?m(t,n,null,null,e):"dropdown"===e.type&&(a.attr(f.menuIndexAttrName,"-1"),v(t,n,a,i,e),l||m(t,n,a,i,e))}function v(t,e,r,n,a){var i=l.ensureSingle(e,"g",f.headerClassName,(function(t){t.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,t).call(A,a,d,p),l.ensureSingle(e,"text",f.headerArrowClassName,(function(t){t.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(t,e,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(e,s.lx,s.ly)}function m(t,e,r,i,o){r||(r=e).attr("pointer-events","all");var s=function(t){return-1==+t.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,t).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(t,o,0,e,r,i,-1),a.executeAPICommand(t,l.method,l.args2)):(g(t,o,0,e,r,i,s),a.executeAPICommand(t,l.method,l.args))),t.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(m.openWidth,m.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(m.openHeight,m.headerHeight)),k.direction=o.direction,i&&(u.size()?function(t,e,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[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(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(t){t.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),k?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>T,D=l.barWidth+2*l.barPad,z=l.barLength+2*l.barPad,P=h+g,E=v;P+D>s&&(P=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),O?(this.vbar=I.attr({rx:l.barRadius,ry:l.barRadius,x:P,y:E,width:D,height:z}),this._vbarYMin=E+z/2,this._vbarTranslateMax=T-z):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,N=O?f+D+.5:f+.5,B=d-.5,H=k?p+A+.5:p+.5,j=o._topdefs.selectAll("#"+R).data(k||O?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",R).append("rect"),k||O?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||O){var U=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(U);var V=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(V),O&&this.vbar.on(".drag",null).call(V)}this.setTranslate(e,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.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)},l.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)},l.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)},l.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,a=r+this._hbarTranslateMax;t=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,l=i+this._vbarTranslateMax;e=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(t,e)},l.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(i.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 a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var l=e/n;this.vbar.call(i.setTranslate,t,e+l*this._vbarTranslateMax)}}},{"../../lib":202,"../color":75,"../drawing":97,d3:21}],177:[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"}}},{}],178:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],179:[function(t,e,r){"use strict";e.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],180:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],181:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],182:[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}},{}],183:[function(t,e,r){"use strict";r.version=t("./version").version,t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config")();for(var n=t("./registry"),a=r.register=n.register,i=t("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],186:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],187:[function(t,e,r){"use strict";var n=t("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(t){return Math.abs(t[1]-t[0])>l-1e-14}function c(t,e){return i(e-t,l)}function u(t,e){if(s(e))return!0;var r,n;e[0](n=a(n,l))&&(n+=l);var i=a(t,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(t,e,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(t,e){return[t*Math.cos(e)+a,i-t*Math.sin(e)]}g?(u=0,f=o,d=l):r=a&&t<=i);var a,i},pathArc:function(t,e,r,n,a){return f(null,t,e,r,n,a,0)},pathSector:function(t,e,r,n,a){return f(null,t,e,r,n,a,1)},pathAnnulus:function(t,e,r,n,a,i){return f(t,e,r,n,a,i,1)}}},{"./mod":209}],188:[function(t,e,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(t){return a.isView(t)&&!(t instanceof i)}function l(t){return n(t)||o(t)}function s(t,e,r){if(l(t)){if(l(t[0])){for(var n=r,a=0;aa.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every((function(t){return a(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(u(+t,360)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r,n){var a=n.regex||c(r);"string"==typeof t&&a.test(t)?e.set(t):e.set(r)},validateFunction:function(t,e){var r=e.dflt;return t===r||"string"==typeof t&&!!c(r).test(t)}},flaglist:{coerceFunction:function(t,e,r,n){if("string"==typeof t)if(-1===(n.extras||[]).indexOf(t)){for(var a=t.split("+"),i=0;i=n&&t<=a?t:u}if("string"!=typeof t&&"number"!=typeof t)return u;t=String(t);var c=_(e),m=t.charAt(0);!c||"G"!==m&&"g"!==m||(t=t.substr(1),e="");var w=c&&"chinese"===e.substr(0,7),T=t.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),L=Number(T[7]||0),S=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var O;k=Number(k);try{var D=v.getComponentMethod("calendars","getCal")(e);if(w){var z="i"===M.charAt(M.length-1);M=parseInt(M,10),O=D.newDate(k,D.toMonthIndex(k,M,z),A)}else O=D.newDate(k,Number(M),A)}catch(t){return u}return O?(O.toJD()-g)*f+L*d+S*p+C*h:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var P=new Date(Date.UTC(2e3,M,A,L,S));return P.setUTCFullYear(k),P.getUTCMonth()!==M||P.getUTCDate()!==A?u:P.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==u};var T=90*f,k=3*d,M=5*p;function A(t,e,r,n,a){if((e||r||n||a)&&(t+=" "+w(e,2)+":"+w(r,2),(n||a)&&(t+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;t+="."+w(a,i)}return t}r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=n&&t<=a))return u;e||(e=0);var i,o,l,c,y,x,b=Math.floor(10*s(t+.05,1)),w=Math.round(t-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(t,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(t){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=n+f&&t<=a-f))return u;var e=Math.floor(10*s(t+.05,1)),r=new Date(Math.round(t-e/10));return A(i("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,n){if(t===u)return e;if(r.isJSDate(t)||"number"==typeof t&&isFinite(t)){if(_(n))return l.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 l.error("unrecognized date",t),e;return t};var L=/%\d?f/g;function S(t,e,r,n){t=t.replace(L,(function(t){var r=Math.min(+t.charAt(1)||6,6);return(e/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(e+.05));if(_(n))try{t=v.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,n,a,i){if(a=_(a)&&a,!e)if("y"===r)e=i.year;else if("m"===r)e=i.month;else{if("d"!==r)return function(t,e){var r=s(t+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==e){o(e)||(e=0);var a=(100+Math.min(s(t/h,60),C[e])).toFixed(e).substr(1);e>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(t,r)+"\n"+S(i.dayMonthYear,t,n,a);e=i.dayMonth+"\n"+i.year}return S(e,t,n,a)};var O=3*f;r.incrementMonth=function(t,e,r){r=_(r)&&r;var n=s(t,f);if(t=Math.round(t-n),r)try{var a=Math.round(t/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return e%12?i.add(o,e,"m"):i.add(o,e/12,"y"),(o.toJD()-g)*f+n}catch(e){l.error("invalid ms "+t+" in calendar "+r)}var c=new Date(t+O);return c.setUTCMonth(c.getUTCMonth()+e)+n-O},r.findExactDates=function(t,e){for(var r,n,a=0,i=0,l=0,s=0,c=_(e)&&v.getComponentMethod("calendars","getCal")(e),u=0;u1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}function s(t,e,r,n,a){var i=n*t+a*e;if(i<0)return n*n+a*a;if(i>r){var o=n-t,l=a-e;return o*o+l*l}var s=n*e-a*t;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(t,e,r,n,a,i,o,c){if(l(t,e,r,n,a,i,o,c))return 0;var u=r-t,f=n-e,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-t,i-e),s(u,f,h,o-t,c-e),s(d,p,g,t-a,e-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(t,e,r,l){if(t===a&&l===i||(n={},a=t,i=l),n[r])return n[r];var s=t.getPointAtLength(o(r-l/2,e)),c=t.getPointAtLength(o(r+l/2,e)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=t.getPointAtLength(o(r,e)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(t,e,r){var n,a,i=e.left,o=e.right,l=e.top,s=e.bottom,c=0,u=t.getTotalLength(),f=u;function d(e){var r=t.getPointAtLength(e);0===e?n=r:e===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(t,e,r,n){for(var a,i,o,l=(n=n||{}).pathLength||t.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=t.getPointAtLength(0)[r]>t.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":209}],200:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],201:[function(t,e,r){"use strict";e.exports=function(t,e){if(!e)return t;var r=1/Math.abs(e),n=r>1?(r*t+r*e)/r:t+e,a=String(n).length;if(a>16){var i=String(e).length;if(a>=String(t).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],202:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../constants/numerical"),l=o.FP_SAFE,s=o.BADNUM,c=e.exports={};c.nestedProperty=t("./nested_property"),c.keyedContainer=t("./keyed_container"),c.relativeAttr=t("./relative_attr"),c.isPlainObject=t("./is_plain_object"),c.toLogRange=t("./to_log_range"),c.relinkPrivateKeys=t("./relink_private");var u=t("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=t("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var d=t("./coerce");c.valObjectMeta=d.valObjectMeta,c.coerce=d.coerce,c.coerce2=d.coerce2,c.coerceFont=d.coerceFont,c.coerceHoverinfo=d.coerceHoverinfo,c.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,c.validate=d.validate;var p=t("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var h=t("./search");c.findBin=h.findBin,c.sorterAsc=h.sorterAsc,c.sorterDes=h.sorterDes,c.distinctVals=h.distinctVals,c.roundUp=h.roundUp,c.sort=h.sort,c.findIndexOfMin=h.findIndexOfMin;var g=t("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var v=t("./matrix");c.init2dArray=v.init2dArray,c.transposeRagged=v.transposeRagged,c.dot=v.dot,c.translationMatrix=v.translationMatrix,c.rotationMatrix=v.rotationMatrix,c.rotationXYMatrix=v.rotationXYMatrix,c.apply2DTransform=v.apply2DTransform,c.apply2DTransform2=v.apply2DTransform2;var m=t("./angles");c.deg2rad=m.deg2rad,c.rad2deg=m.rad2deg,c.angleDelta=m.angleDelta,c.angleDist=m.angleDist,c.isFullCircle=m.isFullCircle,c.isAngleInsideSector=m.isAngleInsideSector,c.isPtInsideSector=m.isPtInsideSector,c.pathArc=m.pathArc,c.pathSector=m.pathSector,c.pathAnnulus=m.pathAnnulus;var y=t("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=t("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=t("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=t("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=t("./regex");c.counterRegex=w.counter;var T=t("./throttle");c.throttle=T.throttle,c.throttleDone=T.done,c.clearThrottle=T.clear;var k=t("./dom");function M(t){var e={};for(var r in t)for(var n=t[r],a=0;al?s:i(t)?Number(t):s:s},c.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(i(t)&&t>=0&&t%1==0)},c.noop=t("./noop"),c.identity=t("./identity"),c.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))},c.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},c.simpleMap=function(t,e,r,n,a){for(var i=t.length,o=new Array(i),l=0;l=Math.pow(2,r)?a>10?(c.warn("randstr failed uniqueness"),s):t(e,r,n,(a||0)+1):s},c.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},c.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,i,o=t.length,l=2*o,s=2*e-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=t[a]*c[n];u[r]=i}return u},c.syncOrAsync=function(t,e,r){var n;function a(){return c.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(a).then(void 0,c.promiseError);return r&&r(e)},c.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},c.noneOrAll=function(t,e,r){if(t){var n,a=!1,i=!0;for(n=0;n0?e:0}))},c.fillArray=function(t,e,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(t))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var D=/^\w*$/;c.templateString=function(t,e){var r={};return t.replace(c.TEMPLATE_STRING_REGEX,(function(t,n){var a;return D.test(n)?a=e[n]:(r[n]=r[n]||c.nestedProperty(e,n).get,a=r[n]()),c.isValidTextValue(a)?a:""}))};var z={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return I.apply(z,arguments)};var P={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return I.apply(P,arguments)};var E=/^[:|\|]/;function I(t,e,r){var i=this,o=arguments;e||(e={});var l={};return t.replace(c.TEMPLATE_STRING_REGEX,(function(t,s,u){var f,d,p,h;for(p=3;p=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var R=2e9;c.seedPseudoRandom=function(){R=2e9},c.pseudoRandom=function(){var t=R;return R=(69069*R+1)%4294967296,Math.abs(R-t)<429496729?c.pseudoRandom():R/4294967296},c.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},a=c.extractOption(t,e,"htx","hovertext");if(c.isValidTextValue(a))return n(a);var i=c.extractOption(t,e,"tx","text");return c.isValidTextValue(i)?n(i):void 0},c.isValidTextValue=function(t){return t||0===t},c.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(c=1):c=0,"translate("+(a-c*(r+o))+","+(i-c*(n+l))+")"+(c<1?"scale("+c+")":"")+(s?"rotate("+s+(e?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(t,e){var r=c.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":181,"./anchor_utils":186,"./angles":187,"./array":188,"./clean_number":189,"./clear_responsive":191,"./coerce":192,"./dates":193,"./dom":194,"./extend":196,"./filter_unique":197,"./filter_visible":198,"./geometry2d":199,"./identity":200,"./increment":201,"./is_plain_object":203,"./keyed_container":204,"./localize":205,"./loggers":206,"./make_trace_groups":207,"./matrix":208,"./mod":209,"./nested_property":210,"./noop":211,"./notifier":212,"./push_unique":215,"./regex":217,"./relative_attr":218,"./relink_private":219,"./search":220,"./stats":222,"./throttle":224,"./to_log_range":225,d3:21,"d3-time-format":19,"fast-isnumeric":23}],203:[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}},{}],204:[function(t,e,r){"use strict";var n=t("./nested_property"),a=/^\w*$/;e.exports=function(t,e,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};e&&e.length?(s=n(t,e),l=s.get()):l=t,e=e||"";var u={};if(l)for(o=0;o2)return c[e]=2|c[e],d.set(t,null);if(f){for(o=e;o1){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},i.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},i.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":234,"./notifier":212}],207:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var a=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=t.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(t){t[0][i]=n.select(this)})),a}},{d3:21}],208:[function(t,e,r){"use strict";r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],210:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./array").isArrayOrTypedArray;function i(t,e){return function(){var r,n,o,l,s,c=t;for(l=0;l/g),s=0;si||c===a||cl)&&(!e||!s(t))}:function(t,e){var s=t[0],c=t[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(t,e){var r=[t[0]],n=0,a=0;function o(o){t.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":181,"./matrix":208}],215:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){for(var r=e.toString(),n=0;na.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 i,o,f=0,d=e.length,p=0,h=d>1?(e[d-1]-e[0])/(d-1):1;for(o=h>=0?r?l:s:r?u:c,t+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.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,e){var n,a=(e||{}).unitMinDiff,i=t.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var l=1;a||(l=i[n]-i[0]||1);for(var s,c=l/(n||1)/1e4,u=[],f=0;f<=n;f++){var d=i[f],p=d-s;void 0===s?(u.push(d),s=d):p>c&&(l=Math.min(l,p),u.push(d),s=d)}return{vals:u,minDiff:l}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return t.sort(e)}return n?t:t.reverse()},r.findIndexOfMin=function(t,e){e=e||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(e)||(e=!1),a(i[0])){for(s=new Array(o),l=0;lt.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"./array":188,"fast-isnumeric":23}],223:[function(t,e,r){"use strict";var n=t("d3"),a=t("../lib"),i=t("../constants/xmlns_namespaces"),o=t("../constants/alignment").LINE_SPACING;function l(t,e){return t.node().getBoundingClientRect()[e]}var s=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,M){var A=t.text(),S=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&A.match(s),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":A,"data-math":"N"}),S?(e&&e._promises||[]).push(new Promise((function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),i={fontSize:r};!function(t,e,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(t.replace(c,"\\lt ").replace(u,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var e=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",t),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),e,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(S[2],i,(function(n,a,i){C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return D(),void e();var s=C.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":A,"data-math":"Y"});s.node().appendChild(o.node()),a&&a.node()&&o.node().insertBefore(a.node().cloneNode(!0),o.node().firstChild),o.attr({class:O,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=t.node().style.fill||"black",u=o.select("g");u.attr({fill:c,stroke:c});var f=l(u,"width"),d=l(u,"height"),p=+t.attr("x")-f*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],h=-(r||l(t,"height"))/4;"y"===O[0]?(s.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-f/2,h-d/2]+")"}),o.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===O[0]?o.attr({x:t.attr("x"),y:h-d/2}):"a"===O[0]&&0!==O.indexOf("atitle")?o.attr({x:0,y:h}):o.attr({x:p,y:+t.attr("y")+h-d/2}),M&&M.call(t,s),e(s)}))}))):D(),t}function D(){C.empty()||(O=t.attr("class")+"-math",C.select("svg."+O).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(g," ");var r,l=!1,s=[],c=-1;function u(){c++;var e=document.createElementNS(i.svg,"tspan");n.select(e).attr({class:"line",dy:c*o+"em"}),t.appendChild(e),r=e;var a=s;if(s=[{node:e}],a.length>1)for(var l=1;l doesnt match end tag <"+t+">. Pretending it did match.",e),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",e)}y.test(e)?u():(r=t,s=[{node:t}]);for(var C=e.split(v),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"},d={sub:"0.3em",sup:"-0.6em"},p={sub:"-0.21em",sup:"0.42em"},h=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,m=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,b=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&L(n)}var k=/(^|;)\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"],a="...".length,i=t.split(v),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var M={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},A=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function L(t){return t.replace(A,(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)):M[e])||t}))}function S(t,e,r){var n,a,i,o=r.horizontalAlign,l=r.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},i="right"===o?function(){return s.right-n.width}:"center"===o?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:i()-c.left+"px","z-index":1e3}),this}}r.convertEntities=L,r.sanitizeHTML=function(t){t=t.replace(g," ");for(var e=document.createElement("p"),r=e,a=[],i=t.split(v),o=0;oi.ts+e?s():i.timer=setTimeout((function(){s(),i.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)a(n[t]),delete n[t];else for(var e in n)r.clear(e)}},{}],225:[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":23}],226:[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"}}},{}],227:[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"}}},{}],228:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=t.split("[")[0],l=0;l0&&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 i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(t);for(e=0;e3?(D.x=1.02,D.xanchor="left"):D.x<-2&&(D.x=-.02,D.xanchor="right"),D.y>3?(D.y=1.02,D.yanchor="bottom"):D.y<-2&&(D.y=-.02,D.yanchor="top")),h(t),"rotate"===t.dragmode&&(t.dragmode="orbit"),c.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=b(e);r;){if(r in t)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1&&i.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 i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),p(t),!0)}var x,b,_,w,T,k,M,A,L=Object.keys(r).map(Number).sort(o),S=e.get(),C=S||[],O=u(m,f).get(),D=[],z=-1,P=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?D.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),O&&O.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,k),-1===z&&(z=_);else for(b=0;b=0;x--)C.splice(D[x],1),O&&O.splice(D[x],1);if(C.length?S||e.set(C):e.set(null),g)return!1;if(d(v,m),h!==a){var E;if(-1===z)E=L;else{for(P=Math.max(C.length,P),E=[],x=0;x=z);x++)E.push(_);for(x=z;x=t.data.length||a<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function E(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]),P(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&P(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function I(t,e,r,n,i){!function(t,e,r,n){var a=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 i in P(t,r,"indices"),e){if(!Array.isArray(e[i])||e[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==e[i].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 i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=z(r,t.data.length-1),e)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(e,r){t[r]=t[e],delete t[e]}}function V(t,e,r){if(t=o.getGraphDiv(t),T.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 a=W(t,n),i=a.flags;i.calc&&(t.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(k.layoutReplot):Object.keys(n).length&&(q(t,i,a)||d.supplyDefaults(t),i.legend&&l.push(k.doLegend),i.layoutstyle&&l.push(k.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(k.doTicksRelayout),i.modebar&&l.push(k.doModeBar),i.camera&&l.push(k.doCamera),i.colorbars&&l.push(k.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(t,V,[t,a.undoit],V,[t,a.redoit]);var s=o.syncOrAsync(l,t);return s&&s.then||(s=Promise.resolve(t)),s.then((function(){return t.emit("plotly_relayout",a.eventData),t}))}function q(t,e,r){var n=t._fullLayout;if(!e.axrange)return!1;for(var a in e)if("axrange"!==a&&e[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=t.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(t,e){var r=e?function(t){var r=[],n=!0;for(var a in e){var i=h.getFromId(t,a);if(r.push(a),i._matchGroup)for(var o in i._matchGroup)e[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(t,r,{skipTitle:n})}:function(t){return h.draw(t,"redraw")};t.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(t,e){var r,n,a,i=t.layout,s=t._fullLayout,c=s._guiEditing,d=B(s._preGUI,c),p=Object.keys(e),g=h.list(t),v=o.extendDeepAll({},e),m={};for(U(e),p=Object.keys(e),n=0;n0&&"string"!=typeof P.parts[I];)I--;var R=P.parts[I],F=P.parts[I-1]+"."+R,H=P.parts.slice(0,I).join("."),j=l(t.layout,H).get(),V=l(s,H).get(),q=P.get();if(void 0!==E){k[z]=E,L[z]="reverse"===R?E:N(q);var G=f.getLayoutValObject(s,P.parts);if(G&&G.impliedEdits&&null!==E)for(var W in G.impliedEdits)S(o.relativeAttr(z,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(z))if(E){S("autosize",null);var J="height"===z?"width":"height";S(J,s[J])}else s[z]=t._initialAutoSize[z];else if("autosize"===z)S("width",E?null:s.width),S("height",E?null:s.height);else if(F.match(Z))D(F),l(s,H+"._inputRange").set(null);else if(F.match(Y)){D(F),l(s,H+"._inputRange").set(null);var $=l(s,H).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else F.match(X)&&l(s,H+"._inputDomain").set(null);if("type"===R){var K=j,tt="linear"===V.type&&"log"===E,et="log"===V.type&&"linear"===E;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&&S(H+".autorange",!0),rt<=0?rt=nt/1e6:nt<=0&&(nt=rt/1e6),S(H+".range[0]",Math.log(rt)/Math.LN10),S(H+".range[1]",Math.log(nt)/Math.LN10)):(S(H+".range[0]",Math.pow(10,rt)),S(H+".range[1]",Math.pow(10,nt)))}else S(H+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[P.parts[0]]&&"radialaxis"===P.parts[1]&&delete s[P.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(t,V,E,S),u.getComponentMethod("images","convertCoords")(t,V,E,S)}else S(H+".autorange",!0),S(H+".range",null);l(s,H+"._inputRange").set(null)}else if(R.match(A)){var at=l(s,z).get(),it=(E||{}).type;it&&"-"!==it||(it="linear"),u.getComponentMethod("annotations","convertCoords")(t,at,it,S),u.getComponentMethod("images","convertCoords")(t,at,it,S)}var ot=w.containerArrayMatch(z);if(ot){r=ot.array,n=ot.index;var lt=ot.property,st=G||{editType:"calc"};""!==n&&""===lt&&(w.isAddVal(E)?L[z]=null:w.isRemoveVal(E)?L[z]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",e)),M.update(_,st),m[r]||(m[r]={});var ct=m[r][n];ct||(ct=m[r][n]={}),ct[lt]=E,delete e[z]}else"reverse"===R?(j.range?j.range.reverse():(S(H+".autorange",!0),j.range=[1,0]),V.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===z&&("lasso"===E||"select"===E)&&"lasso"!==q&&"select"!==q||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,P.set(E))}}for(r in m){w.applyContainerArrayChanges(t,d(i,r),m[r],_,d)||(_.plot=!0)}var ut=s._axisConstraintGroups||[];for(C in O)for(n=0;n1;)if(n.pop(),void 0!==(r=l(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(t,e){for(var r=0;r=a.length?a[0]:a[t]:a}function s(t){return Array.isArray(i)?t>=i.length?i[0]:i[t]:i}function c(t,e){var r=0;return function(){if(t&&++r===e)return t()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){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,d.transition(t,e.frame.data,e.frame.layout,T.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 p(){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 h,g,v=0;function m(t){return Array.isArray(a)?v>=a.length?t.transitionOpts=a[v]:t.transitionOpts=a[0]:t.transitionOpts=a,v++,t}var y=[],x=null==e,b=Array.isArray(e);if(!x&&!b&&o.isPlainObject(e))y.push({type:"object",data:m(o.extendFlat({},e))});else if(x||-1!==["string","number"].indexOf(typeof e))for(h=0;h0&&kk)&&M.push(g);y=M}}y.length>0?function(e){if(0!==e.length){for(var a=0;a=0;n--)if(o.isPlainObject(e[n])){var g=e[n].name,v=(u[g]||h[g]||{}).name,m=e[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[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.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=e[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[t,l],p=[t,i];return c&&c.add(t,s,f,u,p),d.modifyFrames(t,i)},r.addTraces=function t(e,n,a){e=o.getGraphDiv(e);var i,l,s=[],u=r.deleteTraces,f=t,d=[e,s],p=[e,n];for(function(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!_(o))return!1;t=i[a][o]}else t=i[a]}else t=i}}return t}function _(t){return t===Math.round(t)&&t>=0}function w(){var t,e,r={};for(t in h(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[e[2]],l=3}else if("area"===t.type)a=u[o];else{var f=t._module;if(f||(f=(n.modules[t.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,e,l)},r.getLayoutValObject=function(t,e){return b(function(t,e){var r,a,i,l,s=t._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=e+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(t,e){o?n.nestedProperty(l[s],t).set(e):l[s+"."+t]=e}function f(){var t=l;return c(),t}return c(),{modifyBase:function(t,e){l[t]=e},modifyItem:u,getUpdateObj:f,applyUpdate:function(e,r){e&&u(e,r);var a=f();for(var i in a)n.nestedProperty(t,i).set(a[i])}}}},{"../lib":202,"../plots/attributes":243}],237:[function(t,e,r){"use strict";var n=t("d3"),a=t("../registry"),i=t("../plots/plots"),o=t("../lib"),l=t("../lib/clear_gl_canvases"),s=t("../components/color"),c=t("../components/drawing"),u=t("../components/titles"),f=t("../components/modebar"),d=t("../plots/cartesian/axes"),p=t("../constants/alignment"),h=t("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=t("../plots/cartesian/autorange").doAutoRange;function y(t,e,r){for(var n=0;n=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}function x(t){var e,a,l,u,h,g,v=t._fullLayout,m=v._size,x=m.p,_=d.list(t,"",!0);if(v._paperdiv.style({width:t._context.responsive&&v.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":v.width+"px",height:t._context.responsive&&v.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),t._context.setBackground(t,v.paper_bgcolor),r.drawMainTitle(t),f.manage(t),!v._has("cartesian"))return i.previousPromises(t);function T(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-x-n:e._offset+e._length+x+n:m.t+m.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+x+n:e._offset-x-n:m.l+m.w*(t.position||0)+n%1}for(e=0;e<_.length;e++){var k=(u=_[e])._anchorAxis;u._linepositions={},u._lw=c.crispRound(t,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,O=l.yaxis.domain,D=l.plotgroup;if(y(C,O,L)){var z=D.node(),P=l.bg=o.ensureSingle(D,"rect","bg");z.insertBefore(P.node(),z.childNodes[0]),A.push(a)}else D.select("rect.bg").remove(),L.push([C,O]),S||(M.push(a),A.push(a))}var E,I,R,F,N,B,H,j,U,V,q,G,Z,Y=v._bgLayer.selectAll(".bg").data(M);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(t){v._plots[t].bg=n.select(this)})),e=0;eT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var i=e[n],o=g(e,n,r);a(i)?(Array.isArray(e)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),t(i,o)):Array.isArray(i)&&v(i)&&t(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":202,"../plots/attributes":243,"../plots/plots":280,"./plot_config":234,"./plot_schema":235,"./plot_template":236}],239:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./plot_api"),i=t("../plots/plots"),o=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg"),u=t("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,d,p,h;function g(t){return!(t in e)||o.validate(e[t],f[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],d=t.layout||{},p=t.config||{},h={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),d=o.extendDeep({},t.layout),p=t._context,h=t._fullLayout||{}),!g("width")&&null!==e.width||!g("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var v={};function m(t,r){return o.coerce(e,v,f,t,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),T=m("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},d);x?M.width=x:null===e.width&&n(h.width)&&(M.width=h.width),b?M.height=b:null===e.height&&n(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(k);function S(){return new Promise((function(t){setTimeout(t,l.getDelay(k._fullLayout))}))}function C(){return new Promise((function(t,e){var r=s(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function d(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),t(T?p:l.encodeJSON(p))}if(d(),"svg"===y)return t(T?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){a.plot(k,r,M,A).then(L).then(S).then(C).then((function(e){t(function(t){return T?t.replace(l.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":202,"../plots/plots":280,"../snapshot/helpers":297,"../snapshot/svgtoimg":299,"../snapshot/tosvg":301,"../version":459,"./plot_api":233,"fast-isnumeric":23}],240:[function(t,e,r){"use strict";var n=t("../lib"),a=t("../plots/plots"),i=t("./plot_schema"),o=t("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(t,e,r,a,i,o){o=o||[];for(var f=Object.keys(t),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,O=x.length,D=Array.isArray(k);if(D&&(O=Math.min(O,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var z=x[A].length;for(M=0;M<(D?Math.min(z,k[A].length):z);M++)L=D?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&((b=M-o(v)-o(m))>A?_/b>S&&(y=v,x=m,S=_/b):_/M>S&&(y={val:v.val,pad:0},x={val:m.val,pad:0},S=_/M));if(d===p){var C=d-1,O=d+1;if(T)if(0===d)i=[0,1];else{var D=(d>0?f:u).reduce((function(t,e){return Math.max(t,o(e))}),0),z=d/(1-Math.min(.5,D/M));i=d>0?[0,z]:[z,0]}else i=k?[Math.max(0,C),Math.max(1,O)]:[C,O]}else T?(y.val>=0&&(y={val:0,pad:0}),x.val<=0&&(x={val:0,pad:0})):k&&(y.val-S*o(y)<0&&(y={val:0,pad:0}),x.val<=0&&(x={val:1,pad:0})),S=(x.val-y.val-L(v.val,m.val))/(M-o(y)-o(x)),i=[y.val-S*o(y),x.val+S*o(x)];return h&&i.reverse(),a.simpleMap(i,e.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 c(t,e){var r,n,a,i=e._id,o=t._fullData,l=t._fullLayout,s=[],c=[];function d(t,e){for(r=0;r=r&&(c.extrapad||!o)){l=!1;break}a(e,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(t.splice(s,1),s--)}if(l){var u=i&&0===e;t.push({val:e,pad:u?0:r,extrapad:!u&&o})}}function p(t){return n(t)&&Math.abs(t)=e}e.exports={getAutoRange:l,makePadFn:s,doAutoRange:function(t,e){if(e.setScale(),e.autorange){e.range=l(t,e),e._r=e.range.slice(),e._rl=a.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 i=e._anchorAxis;if(i&&i.rangeslider){var s=i.rangeslider[e._name];s&&"auto"===s.rangemode&&(s.range=l(t,e)),i._input.rangeslider[e._name]=a.extendFlat({},s)}},findExtremes:function(t,e,r){r||(r={});t._m||t.setScale();var a,o,l,s,c,d,h,g,v,m=[],y=[],x=e.length,b=r.padded||!1,_=r.tozero&&("linear"===t.type||"-"===t.type),w="log"===t.type,T=!1,k=r.vpadLinearized||!1;function M(t){if(Array.isArray(t))return T=!0,function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}var A=M((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),L=M((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(g=1/0,v=-1/0,w)for(a=0;a0&&(g=o),o>v&&o-i&&(g=o),o>v&&o=z;a--)D(a);return{min:m,max:y,opts:r}},concatExtremes:c}},{"../../constants/numerical":181,"../../lib":202,"../../registry":293,"fast-isnumeric":23}],246:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../registry"),l=t("../../lib"),s=t("../../lib/svg_text_utils"),c=t("../../components/titles"),u=t("../../components/color"),f=t("../../components/drawing"),d=t("./layout_attributes"),p=t("./clean_ticks"),h=t("../../constants/numerical"),g=h.ONEMAXYEAR,v=h.ONEAVGYEAR,m=h.ONEMINYEAR,y=h.ONEMAXQUARTER,x=h.ONEAVGQUARTER,b=h.ONEMINQUARTER,_=h.ONEMAXMONTH,w=h.ONEAVGMONTH,T=h.ONEMINMONTH,k=h.ONEWEEK,M=h.ONEDAY,A=M/2,L=h.ONEHOUR,S=h.ONEMIN,C=h.ONESEC,O=h.MINUS_SIGN,D=h.BADNUM,z=t("../../constants/alignment"),P=z.MID_SHIFT,E=z.CAP_SHIFT,I=z.LINE_SPACING,R=z.OPPOSITE_SIDE,F=e.exports={};F.setConvert=t("./set_convert");var N=t("./axis_autotype"),B=t("./axis_ids");F.id2name=B.id2name,F.name2id=B.name2id,F.cleanId=B.cleanId,F.list=B.list,F.listIds=B.listIds,F.getFromId=B.getFromId,F.getFromTrace=B.getFromTrace;var H=t("./autorange");F.getAutoRange=H.getAutoRange,F.findExtremes=H.findExtremes;function j(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}F.coerceRef=function(t,e,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||i),i||(i=a),u[c]={valType:"enumerated",values:s.concat(i?[i]:[]),dflt:a},l.coerce(t,e,u,c)},F.coercePosition=function(t,e,r,n,a,i){var o,s;if("paper"===n||"pixel"===n)o=l.ensureNumber,s=r(a,i);else{var c=F.getFromId(e,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}t[a]=o(s)},F.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?l.ensureNumber:F.getFromId(e,r).cleanPos)(t)},F.redrawComponents=function(t,e){e=e||F.listIds(t);var r=t._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},F.saveRangeInitial=function(t,e){for(var r=F.list(t,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;t+=t+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=F.tickIncrement(t,"M6","reverse")+1.5*M:i.exactMonths>.8?t=F.tickIncrement(t,"M1","reverse")+15.5*M:t-=A;var s=F.tickIncrement(t,r);if(s<=n)return s}return t}(y,t,m,c,i)),v=y,0;v<=u;)v=F.tickIncrement(v,m,!1,i);return{start:e.c2r(y,0,i),end:e.c2r(v,0,i),size:m,_dataSpan:u-c}},F.prepTicks=function(t,e){var r=l.simpleMap(t.range,t.r2l,void 0,void 0,e);if("auto"===t.tickmode||!t.dtick){var n,a=t.nticks;a||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,a=t._length/n):(n="y"===t._id.charAt(0)?40:80,a=l.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(a*=2)),"array"===t.tickmode&&(a*=100),t._roughDTick=(Math.abs(r[1]-r[0])-(t._lBreaks||0))/a,F.autoTicks(t,t._roughDTick),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),K(t)},F.calcTicks=function(t,e){F.prepTicks(t,e);var r=l.simpleMap(t.range,t.r2l,void 0,void 0,e);if("array"===t.tickmode)return function(t){var e=t.tickvals,r=t.ticktext,n=new Array(e.length),a=j(l.simpleMap(t.range,t.r2l)),i=Math.min(a[0],a[1]),o=Math.max(a[0],a[1]),s=0;Array.isArray(r)||(r=[]);var c="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 u=0;ui&&f=o:n<=o)&&!(c.length>r||n===e);n=F.tickIncrement(n,t.dtick,s,t.calendar)){e=n;var a=!1;u&&n!==(0|n)&&(a=!0),c.push({minor:a,value:n})}}();var f="period"===t.ticklabelmode;if(f&&c.unshift({minor:!1,value:F.tickIncrement(c[0].value,t.dtick,!s,t.caldendar)}),t.rangebreaks){var d=c.length;if(d){var p=0;"auto"===t.tickmode&&(p=("y"===t._id.charAt(0)?2:6)*(t.tickfont?t.tickfont.size:12));for(var h,S=[],C=s?1:-1,O=s?d-1:0,z=s?0:d-1;C*z<=C*O;z+=C){var P=c[z];if(t.maskBreaks(P.value)!==D||(P.value=mt(P.value,t),!t._rl||t._rl[0]!==P.value&&t._rl[1]!==P.value)){var E=t.c2p(P.value);E===h?S[S.length-1].valuep)&&(h=E,S.push(P))}}c=S.reverse()}}vt(t)&&360===Math.abs(r[1]-r[0])&&c.pop(),t._tmax=(c[c.length-1]||{}).value,t._prevDateHead="",t._inCalcTicks=!0;var I,R=Math.min(r[0],r[1]),N=Math.max(r[0],r[1]),B=F.getTickFormat(t);f&&B&&(/%[fLQsSMX]/.test(B)||(/%[HI]/.test(B)?I=L:/%p/.test(B)?I=A:/%[Aadejuwx]/.test(B)?I=M:/%[UVW]/.test(B)?I=k:/%[Bbm]/.test(B)?I=w:/%[q]/.test(B)?I=x:/%[Yy]/.test(B)&&(I=v)));var H,U,V=[];for(H=0;H0?(W=H-1,Q=H):(W=H,Q=H);var J=V[W].x,$=V[Q].x,K=Math.abs($-J),et=I||K,rt=0;if(et>=m?rt=K>=m&&K<=g?K:v:I===x&&et>=b?rt=K>=b&&K<=y?K:x:et>=T?rt=K>=T&&K<=_?K:w:I===k&&et>=k?rt=k:et>=M?rt=M:I===A&&et>=A?rt=A:I===L&&et>=L&&(rt=L),rt&&t.rangebreaks){for(var nt=0,at=0,it=0;it<42;it++){var ot=it/42;t.maskBreaks(J*(1-ot)+$*ot)!==D&&(ot<.5?nt++:at++)}at&&(rt*=(nt+at)/42)}rt<=K&&(X+=rt/2),V[H].periodX=X,(X>N||X=R){t._prevDateHead="",V[H].text=F.tickText(t,V[H].x).text;break}}return t._inCalcTicks=!1,V};var G=[2,5,10],Z=[1,2,3,6,12],Y=[1,2,5,10,15,30],X=[1,2,3,7,14],W=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],Q=[-.301,0,.301,.699,1],J=[15,30,45,90,180];function $(t,e,r){return e*l.roundUp(t/e,r)}function K(t){var e=t.dtick;if(t._tickexponent=0,a(e)||"string"==typeof e||(e=1),"category"!==t.type&&"multicategory"!==t.type||(t._tickround=null),"date"===t.type){var r=t.r2l(t.tick0),n=t.l2r(r).replace(/(^-|i)/g,""),i=n.length;if("M"===String(e).charAt(0))i>10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=M&&i<=10||e>=15*M)t._tickround="d";else if(e>=S&&i<=16||e>=L)t._tickround="M";else if(e>=C&&i<=19||e>=S)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,o)-20,t._tickround<0&&(t._tickround=4)}}else if(a(e)||"L"===e.charAt(0)){var l=t.range.map(t.r2d||Number);a(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(c)>3&&(rt(t.exponentformat)&&!nt(c)?t._tickexponent=3*Math.round((c-1)/3):t._tickexponent=c)}else t._tickround=null}function tt(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}}F.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=l.dateTick0(t.calendar);var i=2*e;if(i>v)e/=v,r=n(10),t.dtick="M"+12*$(e,r,G);else if(i>w)e/=w,t.dtick="M"+$(e,1,Z);else if(i>M){t.dtick=$(e,M,t._hasDayOfWeekBreaks?[1,2,7,14]:X),t.tick0=l.dateTick0(t.calendar,!0);var o=F.getTickFormat(t);if(/%[uVW]/.test(o)){var s=t.tick0.length,c=+t.tick0[s-1];t.tick0=t.tick0.substring(0,s-2)+String(c+1)}}else i>L?t.dtick=$(e,L,Z):i>S?t.dtick=$(e,S,Y):i>C?t.dtick=$(e,C,Y):(r=n(10),t.dtick=$(e,r,G))}else if("log"===t.type){t.tick0=0;var u=l.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(u[1]-u[0])<1){var f=1.5*Math.abs((u[1]-u[0])/e);e=Math.abs(Math.pow(10,u[1])-Math.pow(10,u[0]))/f,r=n(10),t.dtick="L"+$(e,r,G)}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))):vt(t)?(t.tick0=0,r=1,t.dtick=$(e,r,J)):(t.tick0=0,r=n(10),t.dtick=$(e,r,G));if(0===t.dtick&&(t.dtick=1),!a(t.dtick)&&"string"!=typeof t.dtick){var d=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(d)}},F.tickIncrement=function(t,e,r,i){var o=r?-1:1;if(a(e))return l.increment(t,o*e);var s=e.charAt(0),c=o*Number(e.substr(1));if("M"===s)return l.incrementMonth(t,c,i);if("L"===s)return Math.log(Math.pow(10,t)+c)/Math.LN10;if("D"===s){var u="D2"===e?Q:W,f=t+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(e)},F.tickFirst=function(t,e){var r=t.r2l||Number,i=l.simpleMap(t.range,r,void 0,void 0,e),o=i[1]"+s,t._prevDateHead=s));e.text=c}(t,o,r,c):"log"===u?function(t,e,r,n,i){var o=t.dtick,s=e.x,c=t.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)e.text=at(Math.pow(10,s),t,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=t.exponentformat;"power"===p||rt(p)&&nt(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":O)+d+"",e.fontSize*=1.25):("e"===p||"E"===p)&&d>2?e.text="1"+p+(f>0?"+":O)+d:(e.text=at(Math.pow(10,s),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,l.mod(s,1)))),e.fontSize*=.75}if("D1"===t.dtick){var h=String(e.text).charAt(0);"0"!==h&&"1"!==h||("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*(s<0?.5:.25)))}}(t,o,0,c,g):"category"===u?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===u?function(t,e,r){var n=Math.round(e.x),a=t._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?e.text=o+" - "+i:(e.text=i,e.text2=o)}(t,o,r):vt(t)?function(t,e,r,n,a){if("radians"!==t.thetaunit||r)e.text=at(e.x,t,a,n);else{var i=e.x/180;if(0===i)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){for(var r=1;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,a=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)e.text=at(l.deg2rad(e.x),t,a,n);else{var s=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(""),s&&(e.text=O+e.text)}}}}(t,o,r,c,g):function(t,e,r,n,a){"never"===a?a="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide");e.text=at(e.x,t,a,n)}(t,o,0,c,g),n||(t.tickprefix&&!h(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!h(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var v=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[v(o.x-.5),v(o.x+t.dtick-.5)]}return o},F.hoverLabelText=function(t,e,r){if(r!==D&&r!==e)return F.hoverLabelText(t,e)+" - "+F.hoverLabelText(t,r);var n="log"===t.type&&e<=0,a=F.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":O+a:a};var et=["f","p","n","\u03bc","m","","k","M","G","T"];function rt(t){return"SI"===t||"B"===t}function nt(t){return t>14||t<-15}function at(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",c=e._tickexponent,u=F.getTickFormat(e),f=e.separatethousands;if(n){var d={exponentformat:s,dtick:"none"===e.showexponent?e.dtick:a(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};K(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return e._numFormat(u)(t).replace(/-/g,O);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(t=Math.abs(t))"+p+"":"B"===s&&9===c?t+="B":rt(s)&&(t+=et[c/3+5]));return i?O+t:t}function it(t,e){for(var r=[],n={},a=0;a1&&r=a.min&&t=0,i=u(t,e[1])<=0;return(r||a)&&(n||i)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=o(a)))){r=n;break}break;case"log":for(e=0;e0?r.bottom-u:0,f)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=e._depth:(n[s]=e._depth=Math.max(r.width>0?u-r.top:0,f),p.reverse()),r.width>0){var v=r.right-(e._offset+e._length);v>0&&(n.xr=1,n.r=v);var m=e._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=e._depth=Math.max(r.height>0?u-r.left:0,f):(n[s]=e._depth=Math.max(r.height>0?r.right-u:0,f),p.reverse()),r.height>0){var y=r.bottom-(e._offset+e._length);y>0&&(n.yb=0,n.b=y);var x=e._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===e.anchor?e.position:e._anchorAxis.domain[p[0]],e.title.text!==d._dfltTitle[h]&&(n[s]+=lt(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[c]=e.linewidth,e.mirror&&!0!==e.mirror&&(a[c]+=f),!0===e.mirror||"ticks"===e.mirror?a[g]=e._anchorAxis.domain[p[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(a[g]=[e._counterDomainMin,e._counterDomainMax][p[1]]))}W&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),i.autoMargin(t,ut(e),n),i.autoMargin(t,ft(e),a),i.autoMargin(t,dt(e),l)})),r.skipTitle||W&&"bottom"===e.side||Y.push((function(){return function(t,e){var r,n=t._fullLayout,a=e._id,i=a.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+lt(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===i?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var l,s,u,d,p=F.getPxPosition(t,e);"x"===i?(s=e._offset+e._length/2,u="top"===e.side?p-r:p+r):(u=e._offset+e._length/2,s="right"===e.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==e.type){var h=e._selections[e._id+"tick"];if(d={selection:h,side:e.side},h&&h.node()&&h.node().parentNode){var g=f.getTranslate(h.node().parentNode);d.offsetLeft=g.x,d.offsetTop=g.y}e.title.hasOwnProperty("standoff")&&(d.pad=0)}return c.draw(t,a+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[i],avoid:d,transform:l,attributes:{x:s,y:u,"text-anchor":"middle"}})}(t,e)})),l.syncOrAsync(Y)}}function Q(t){var r=p+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,a,i;t._selections[e].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,t._selections[e].each((function(){var t=ct(this),e=f.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),a=Math.min(a,e.left),i=Math.max(i,e.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(e,r)),w[r]}},F.getTickSigns=function(t){var e=t._id.charAt(0),r={x:"top",y:"right"}[e],n=t.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==t.ticks==("x"===e)&&(a=a.map((function(t){return-t}))),t.side&&a.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),a},F.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))+")"}},F.makeTransPeriodFn=function(t){var e=t._id.charAt(0),r=t._offset;return"x"===e?function(e){return"translate("+(r+t.l2p(e.periodX))+",0)"}:function(e){return"translate(0,"+(r+t.l2p(e.periodX))+")"}},F.makeTickPath=function(t,e,r,n){n=void 0!==n?n:t.ticklen;var a=t._id.charAt(0),i=(t.linewidth||1)/2;return"x"===a?"M0,"+(e+i*r)+"v"+n*r:"M"+(e+i*r)+",0h"+n*r},F.makeLabelFns=function(t,e,r){var n=t._id.charAt(0),i="boundaries"!==t.tickson&&"outside"===t.ticks,o=0,s=0;if(i&&(o+=t.ticklen),r&&"outside"===t.ticks){var c=l.deg2rad(r);o=t.ticklen*Math.cos(c)+1,s=t.ticklen*Math.sin(c)}t.showticklabels&&(i||t.showline)&&(o+=.2*t.tickfont.size);var u,f,d,p,h={labelStandoff:o+=(t.linewidth||1)/2,labelShift:s};return"x"===n?(p="bottom"===t.side?1:-1,u=s*p,f=e+o*p,d="bottom"===t.side?1:-.2,h.xFn=function(t){return t.dx+u},h.yFn=function(t){return t.dy+f+t.fontSize*d},h.anchorFn=function(t,e){return a(e)&&0!==e&&180!==e?e*p<0?"end":"start":"middle"},h.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side?-n:0}):"y"===n&&(p="right"===t.side?1:-1,u=o,f=-s*p,d=90===Math.abs(t.tickangle)?.5:0,h.xFn=function(t){return t.dx+e+(u+t.fontSize*d)*p},h.yFn=function(t){return t.dy+f+t.fontSize*P},h.anchorFn=function(e,r){return a(r)&&90===Math.abs(r)?"middle":"right"===t.side?"start":"end"},h.heightFn=function(e,r,n){return(r*="left"===t.side?1:-1)<-30?-n:r<30?-.5*n:0}),h},F.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",a=r.vals;"period"===e.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(e.ticks?a:[],ot);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(u.stroke,e.tickcolor).style("stroke-width",f.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},F.drawGrid=function(t,e,r){r=r||{};var n=e._id+"grid",a=r.vals,i=r.counterAxis;if(!1===e.showgrid)a=[];else if(i&&F.shouldShowZeroLine(t,e,i))for(var o="array"===e.tickmode,l=0;l1)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={},l=0;l2*r}(t)?"category":function(t){if(!t)return!1;for(var e=0;e=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(e.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(e.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(e.enabled=!1);e.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(e.enabled=!1);if((c=+c)<0||c>24)return void(e.enabled=!1);e.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(e.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.getAxisGroup=function(t,e){for(var r=t._axisMatchGroups,n=0;n0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=e.categoryorder="trace"),"trace"===s?e._initialCategories=[]:"array"===s?e._initialCategories=l.slice():(l=function(t,e){var r,n,a,i=e.dataAttr||t._id.charAt(0),o={};if(e.axData)r=e.axData;else for(r=[],n=0;ns*x)||T)for(r=0;rP&&RD&&(D=R);p/=(D-O)/(2*z),O=c.l2r(O),D=c.l2r(D),c.range=c._input.range=L=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function F(t,e,r,n,a){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",a+"Z")}function N(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 B(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),H(t,e,a,i)}function H(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 j(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function U(t){O&&t.data&&t._context.showTips&&(l.notifier(l._(t,"Double-click to zoom back out"),"long"),O=!1)}function V(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,C)/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 q(t,e,r,n){for(var a,i,o,s,c=!1,u={},f={},d=0;d=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(j(a),2!==t||ht||jt(),pt)i.indexOf("select")>-1&&M(r,a,W,Q,e.id,St),i.indexOf("event")>-1&&f.click(a,r,e.id);else if(1===t&&ht){var l=g?H:D,c="s"===g||"w"===O?0:1,u=l._name+".range["+c+"]",d=function(t,e){var r,a=t.range[e],i=Math.abs(a-t.range[1-e]);return"date"===t.type?a:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,c),p="left",h="middle";if(l.fixedrange)return;g?(h="n"===g?"top":"bottom","right"===l.side&&(p="right")):"e"===O&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(mt).call(s.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(d),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:h}).on("edit",(function(t){var e=l.d2r(t);void 0!==e&&o.call("_guiRelayout",a,u,e)}))}}}function Dt(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,e+yt)),a=Math.max(0,Math.min(tt,r+xt)),i=Math.abs(n-yt),o=Math.abs(a-xt);function l(){kt="",bt.r=bt.l,bt.t=bt.b,At.attr("d","M0,0Z")}if(bt.l=Math.min(yt,n),bt.r=Math.max(yt,n),bt.t=Math.min(xt,a),bt.b=Math.max(xt,a),et.isSubplotConstrained)i>C||o>C?(kt="xy",i/K>o/tt?(o=i*tt/K,xt>a?bt.t=xt-o:bt.b=xt+o):(i=o*K/tt,yt>n?bt.l=yt-i:bt.r=yt+i),At.attr("d",V(bt))):l();else if(rt.isSubplotConstrained)if(i>C||o>C){kt="xy";var s=Math.min(bt.l/K,(tt-bt.b)/tt),c=Math.max(bt.r/K,(tt-bt.t)/tt);bt.l=s*K,bt.r=c*K,bt.b=(1-s)*tt,bt.t=(1-c)*tt,At.attr("d",V(bt))}else l();else!at||og[1]-1/4096&&(e.domain=l),a.noneOrAll(t.domain,e.domain,l)}return r("layer"),e}},{"../../lib":202,"fast-isnumeric":23}],264:[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 a=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(i+(a[0]-i)*e),t.l2r(i+(a[1]-i)*e)]}},{"../../constants/alignment":177}],265:[function(t,e,r){"use strict";var n=t("polybooljs"),a=t("../../registry"),i=t("../../components/drawing").dashStyle,o=t("../../components/color"),l=t("../../components/fx"),s=t("../../components/fx/helpers").makeEventData,c=t("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=t("../../components/shapes/draw_newshape/display_outlines"),v=t("../../components/shapes/draw_newshape/helpers").handleEllipse,m=t("../../components/shapes/draw_newshape/newshapes"),y=t("../../lib"),x=t("../../lib/polygon"),b=t("../../lib/throttle"),_=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),T=t("../../plot_api/subroutines").redrawReglTraces,k=t("./constants"),M=k.MINSELECT,A=x.filter,L=x.tester,S=t("./handle_outline").clearSelect,C=t("./helpers"),O=C.p2r,D=C.axValue,z=C.getTransform;function P(t,e,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=e._hoverdata,x=e._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(y)){F(t,e,i);var _=function(t,e){var r,n,a=t[0],i=-1,o=[];for(n=0;n0?function(t,e){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===e.searchInfo&&(n=e.searchInfo.cd[0].trace).selectedpoints.length===e.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=H(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(e)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,t);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function B(t,e,r,n){var a,i,o,l=[],s=e.map((function(t){return t._id})),c=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(a)>-1}function j(t,e,r){var n,i,o,l;for(n=0;n=0)Y._fullLayout._deactivateShape(Y);else if(!H){var r=X.clickmode;b.done(dt).then((function(){if(b.clear(dt),2===t){for(st.remove(),w=0;w-1&&P(e,Y,a.xaxes,a.yaxes,a.subplot,a,st),"event"===r&&Y.emit("plotly_selected",void 0);l.click(Y,e)})).catch(y.error)}},a.doneFn=function(){ft.remove(),b.done(dt).then((function(){b.clear(dt),a.gd.emit("plotly_selected",S),_&&a.selectionDefs&&(_.subtract=lt,a.selectionDefs.push(_),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,x)),a.doneFnCompleted&&a.doneFnCompleted(pt)})).catch(y.error),H&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:P}},{"../../components/color":75,"../../components/dragelement/helpers":93,"../../components/drawing":97,"../../components/fx":115,"../../components/fx/helpers":111,"../../components/shapes/draw_newshape/display_outlines":160,"../../components/shapes/draw_newshape/helpers":161,"../../components/shapes/draw_newshape/newshapes":162,"../../lib":202,"../../lib/clear_gl_canvases":190,"../../lib/polygon":214,"../../lib/throttle":224,"../../plot_api/subroutines":237,"../../registry":293,"./axis_ids":249,"./constants":252,"./handle_outline":256,"./helpers":257,polybooljs:49}],266:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../../lib"),l=o.cleanNumber,s=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,d=t("../../constants/numerical"),p=d.FP_SAFE,h=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,x=d.ONEMIN,b=d.ONESEC,_=t("./axis_ids"),w=t("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function M(t){return Math.pow(10,t)}function A(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",d=r.charAt(0);function L(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],a=t.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return h}function S(e,r,n,a){if((a||{}).msUTC&&i(e))return+e;var l=c(e,n||t.calendar);if(l===h){if(!i(e))return h;e=+e;var s=Math.floor(10*o.mod(e+.05,1)),u=Math.round(e-s/10);l=c(new Date(u))+s/10}return l}function C(e,r,n){return s(e,r,n||t.calendar)}function O(e){return t._categories[Math.round(e)]}function D(e){if(A(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h}function z(e){if(t._categoriesMap)return t._categoriesMap[e]}function P(t){var e=z(t);return void 0!==e?e:i(t)?+t:void 0}function E(t,e,r){return n.round(r+e*t,2)}function I(t,e,r){return(t-r)/e}var R=function(e){return i(e)?E(e,t._m,t._b):h},F=function(e){return I(e,t._m,t._b)};if(t.rangebreaks){var N="y"===d;R=function(e){if(!i(e))return h;var r=t._rangebreaks.length;if(!r)return E(e,t._m,t._b);var n=N;t.range[0]>t.range[1]&&(n=!n);for(var a=n?-1:1,o=a*e,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=t._B[l]||0;return isFinite(f)?E(e,t._m2,f):0},F=function(e){var r=t._rangebreaks.length;if(!r)return I(e,t._m,t._b);for(var n=0,a=0;at._rangebreaks[a].pmax&&(n=a+1);return I(e,t._m2,t._B[n])}}t.c2l="log"===t.type?L:u,t.l2c="log"===t.type?M:u,t.l2p=R,t.p2l=F,t.c2p="log"===t.type?function(t,e){return R(L(t,e))}:R,t.p2c="log"===t.type?function(t){return M(F(t))}:F,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(l(e))},t.p2d=t.p2r=F,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return L(l(t),e)},t.r2d=t.r2c=function(t){return M(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=u,t.c2r=L,t.l2d=M,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return M(F(t))},t.r2p=function(e){return t.l2p(l(e))},t.p2r=F,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=S,t.c2d=t.c2r=t.l2d=t.l2r=C,t.d2p=t.r2p=function(e,r,n){return t.l2p(S(e,0,n))},t.p2d=t.p2r=function(t,e,r){return C(F(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,h,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=D,t.r2d=t.c2d=t.l2d=O,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return O(F(t))},t.r2p=t.d2p,t.p2r=F,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=O,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=z,t.l2r=t.c2r=u,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return O(F(t))},t.r2p=t.d2p,t.p2r=F,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:u(t)},t.setupMultiCategory=function(n){var a,i,l=t._traceIndices,s=e._axisMatchGroups;if(s&&s.length&&0===t._categories.length)for(a=0;ap&&(l[n]=p),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else o.nestedProperty(t,e).set(a)},t.setScale=function(r){var n=e._size;if(t.overlaying){var a=_.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var i=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(i);var l,s,c=t.r2l(t[i][0],o),u=t.r2l(t[i][1],o),f="y"===d;if((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/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(c,u),Math.max(c,u)),t._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&t._rangebreaks.reverse();var h=p?-1:1;for(t._m2=h*t._length/(Math.abs(u-c)-t._lBreaks),t._B.push(-t._m2*(f?u:c)),l=0;la&&(a+=7,ia&&(a+=24,i=n&&i=n&&e=l.min&&(tl.max&&(l.max=n),a=!1)}a&&c.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function v(e,r){var n=e.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!e.xr1,d=!!e.yr1,p=[];if(f){var h=i.simpleMap(e.xr0,a.r2l),g=i.simpleMap(e.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(e.yr0,s.r2l),x=i.simpleMap(e.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(t,a,{skipTitle:!0}),l.drawOne(t,s,{skipTitle:!0}),l.redrawComponents(t,[a._id,s._id]);var w=f?c/p[2]:1,T=d?u/p[3]:1,k=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}l.redrawComponents(t)}},{"../../components/drawing":97,"../../lib":202,"../../registry":293,"./axes":246,d3:21}],271:[function(t,e,r){"use strict";var n=t("../../registry").traceIs,a=t("./axis_autotype");function i(t){return{v:"x",h:"y"}[t.orientation||"v"]}function o(t,e){var r=i(t),a=n(t,"box-violin"),o=n(t._fullInput||{},"candlestick");return a&&!o&&e===r&&void 0===t[r]&&void 0===t[r+"0"]}e.exports=function(t,e,r,l){"-"===r("type",(l.splomStash||{}).type)&&(!function(t,e){if("-"!==t.type)return;var r,l=t._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(t,e,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[e])return a;if((a[r+"axis"]||r)===e){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(e,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,e,l,n+1):e(l,i,o)}}))}r.manageCommandObserver=function(t,e,n,o){var l={},s=!0;e&&e._commandObserver&&(l=e._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(t,n,l.lookupTable);if(e&&e._commandObserver){if(c)return l;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,l}if(c){i(t,c,l.cache),l.check=function(){if(s){var e=i(t,c,l.cache);return e.changed&&o&&void 0!==l.lookupTable[e.value]&&(l.disable(),Promise.resolve(o({value:e.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[e.value]})).then(l.enable,l.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),s=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(){x.sendDataToCloud(t)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(t,o),l.text(o.text()&&s.text()?" - ":"")}},x.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var r=n.select(t).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(t,!1,"keepdata"),a.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(t,e){var r=t._context.locale,n=!1,a={};function i(t){for(var r=!0,i=0;i1&&E.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,s),l=0;l15&&E.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"),x.linkSubplots(d,s,f,i),x.cleanPlot(d,s,f,i);var B=!(!i._has||!i._has("gl2d")),H=!(!s._has||!s._has("gl2d")),j=!(!i._has||!i._has("cartesian"))||B,U=!(!s._has||!s._has("cartesian"))||H;j&&!U?i._bgLayer.remove():U&&!j&&(s._shouldCreateBgLayer=!0),i._zoomlayer&&!t._dragging&&p({_fullLayout:i}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),a=Math.round(f*a)}}var d=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!e.height&&Math.abs(r.height-a)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(t,e,r,n){var a,i,l,s=o.componentsRegistry,u=e._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in s)(l=s[a]).includeBasePlot&&l.includeBasePlot(t,e);for(var d in u.length||u.push(f),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[d].sort(c.subplotSort);for(i=0;i.5*n.width&&(c.log("Margin push",e,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(c.log("Margin push",e,"is too big in y, dropping"),r.b=r.t=0);var s=void 0!==r.xl?r.xl:r.x,u=void 0!==r.xr?r.xr:r.x,f=void 0!==r.yt?r.yt:r.y,d=void 0!==r.yb?r.yb:r.y;a[e]={l:{val:s,size:r.l+o},r:{val:u,size:r.r+o},b:{val:d,size:r.b+o},t:{val:f,size:r.t+o}},i[e]=1}else delete a[e],delete i[e];if(!n._replotting)return x.doAutoMargin(t)}},x.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),C(e);var r=e._size,n=e.margin,a=c.extendFlat({},r),l=n.l,s=n.r,u=n.t,f=n.b,d=e.width,p=e.height,h=e._pushmargin,g=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var v in h)g[v]||delete h[v];for(var m in h.base={l:{val:0,size:l},r:{val:1,size:s},t:{val:1,size:u},b:{val:0,size:f}},h){var y=h[m].l||{},b=h[m].b||{},_=y.val,w=y.size,T=b.val,k=b.size;for(var M in h){if(i(w)&&h[M].r){var A=h[M].r.val,L=h[M].r.size;if(A>_){var S=(w*A+(L-d)*_)/(A-_),O=(L*(1-_)+(w-d)*(1-A))/(A-_);S>=0&&O>=0&&d-(S+O)>0&&S+O>l+s&&(l=S,s=O)}}if(i(k)&&h[M].t){var D=h[M].t.val,z=h[M].t.size;if(D>T){var P=(k*D+(z-p)*T)/(D-T),E=(z*(1-T)+(k-p)*(1-D))/(D-T);P>=0&&E>=0&&p-(E+P)>0&&P+E>f+u&&(f=P,u=E)}}}}}if(r.l=Math.round(l),r.r=Math.round(s),r.t=Math.round(u),r.b=Math.round(f),r.p=Math.round(n.pad),r.w=Math.round(d)-r.l-r.r,r.h=Math.round(p)-r.t-r.b,!e._replotting&&x.didMarginChange(a,r)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var I=3*(1+Object.keys(g).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var i=0,l=0;function s(){return i++,function(){l++,n||l!==i||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(a)}}r.runFn(s),setTimeout(s())}))}],i=c.syncOrAsync(a,t);return i&&i.then||(i=Promise.resolve()),i.then((function(){return t}))}x.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},x.graphJson=function(t,e,r,n,a,i){(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&x.supplyDefaults(t);var o=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s=(t._transitionData||{})._frames;function u(t,e){if("function"==typeof t)return e?"_function_":null;if(c.isPlainObject(t)){var n,a={};return Object.keys(t).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof t[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(t[i],e)}else e&&(a[i]="_function")})),a}return Array.isArray(t)?t.map((function(t){return u(t,e)})):c.isTypedArray(t)?c.simpleMap(t,c.identity):c.isJSDate(t)?c.ms2DateTimeLocal(+t):t}var f={data:(o||[]).map((function(t){var r=u(t);return e&&delete r.fit,r}))};return e||(f.layout=u(l)),t.framework&&t.framework.isPolar&&(f=t.framework.getConfig()),s&&(f.frames=u(s)),i&&(f.config=u(t._context,!0)),"object"===n?f:JSON.stringify(f)},x.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;i--)if(l[i].enabled){r._indexToPoints=l[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,h[e]=o}}for(P(s,u,p),a=0;a=0?d.angularAxis.domain:n.extent(T),S=Math.abs(T[1]-T[0]);M&&!k&&(S=0);var C=L.slice();A&&k&&(C[1]+=S);var O=d.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),d.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var D=d.angularAxis.ticksStep||(C[1]-C[0])/(O*(d.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),C[2]||(C[2]=D);var z=n.range.apply(this,C);if(z=z.map((function(t,e){return parseFloat(t.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(t=n.select(this).select("svg.chart-root"))||t.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),E=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));t=n.select(E)}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,R=t.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(t,e){return" "+t+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){I=t.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var B=p.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:p.map((function(t,e){return t.name||"Element"+e})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:I,elements:B,reverseOrder:d.legend.reverseOrder})})();var H=I.node().getBBox();x=Math.min(d.width-H.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),I.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else I=t.select(".legend-group").style({display:"none"});t.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var j=[(d.width-(d.margin.left+d.margin.right+2*x+(H?H.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),t.select(".outer-group").attr("transform","translate("+j+")"),d.title&&d.title.text){var U=t.select("g.title-group text").style(N).text(d.title.text),V=U.node().getBBox();U.attr({x:_[0]-V.width/2,y:_[1]-x-20})}var q=t.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:x}).style(F);var Z=t.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function Y(t,e){return l(t)%360+d.orientation}if(d.radialAxis.visible){var X=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(X).attr({transform:"rotate("+d.radialAxis.orientation+")"}),q.selectAll(".domain").style(F),q.selectAll("g>text").text((function(t,e){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var W=t.select(".angular.axis-group").selectAll("g.angular-tick").data(z),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+Y(t)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",(function(t,e){return e%(d.minorTicks+1)==0})).classed("minor",(function(t,e){return!(e%(d.minorTicks+1)==0)})).style(F),Q.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var J=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(t,e){var r=Y(t),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(t,e){return e%(d.minorTicks+1)!=0?"":w?w[t]+d.angularAxis.ticksSuffix:t+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&J.text((function(t,e){return e%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,e)}));var $=n.max(R.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));I.attr({transform:"translate("+[x+$,d.margin.top]+")"});var K=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(p);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),p[0]||K){var et=[];p.forEach((function(t,e){var n={};n.radialScale=r,n.angularScale=l,n.container=tt.filter((function(t,r){return r==e})),n.geometry=t.geometry,n.orientation=d.orientation,n.direction=d.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 a(o[r].defaultConfig(),t)}));o[r]().config(n)()}))}var at,it,ot=t.select(".guides-group"),lt=t.select(".tooltips-group"),st=o.tooltipPanel().config({container:lt,fontSize:8})(),ct=o.tooltipPanel().config({container:lt,fontSize:8})(),ut=o.tooltipPanel().config({container:lt,hasTick:!0})();if(!k){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",(function(t,e){var r=o.util.getMousePos(Z).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;at=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);st.text(o.util.round(at)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(t,e){ot.select("line").style({opacity:0})}))}var dt=ot.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",(function(t,e){var n=o.util.getMousePos(Z).radius;dt.attr({r:n}).style({opacity:.5}),it=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ct.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.hide()})),t.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(e,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(e[0]),r:o.util.round(e[1])};k&&(c.t=w[e[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=t.node().getBoundingClientRect(),p=[f.left+f.width/2-j[0]-d.left,f.top+f.height/2-j[1]-d.top];ut.config({color:l}).text(u),ut.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()})).on("mouseout.tooltip",(function(t,e){ut.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(t){if(!arguments.length)return s;var e=o.util.cloneJson(t);return e.data.forEach((function(t,e){s.data[e]||(s.data[e]={}),a(s.data[e],o.Axis.defaultConfig().data[0]),a(s.data[e],t)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return r},d.angularScale=function(t){return l},d.svg=function(){return t},n.rebind(d,f,"on"),d},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 a=e||6,i=[],o=[];n.range(0,360+a,a).forEach((function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},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],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(t,r){return"rotate("+(e.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(t,e){return h.stroke(r,a,i)},"stroke-width":function(t,e){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return h["stroke-dasharray"](r,a,i)},opacity:function(t,e){return h.opacity(r,a,i)},display:function(t,e){return h.display(r,a,i)}})}};var f=e.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(t){return-d/2})).endAngle((function(t){return d/2})).innerRadius((function(t){return e.radialScale(s+(t[2]||0))})).outerRadius((function(t){return e.radialScale(s+(t[2]||0))+e.radialScale(t[1])}));c.arc=function(t,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(t,r){return"rotate("+(e.orientation+l(t[0])+90)+")"}})};var h={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,a){return r[t[a].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(h).each(c[e.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(e){return arguments.length?(e.forEach((function(e,r){t[r]||(t[r]={}),a(t[r],o.PolyChart.defaultConfig()),a(t[r],e)})),this):t},i.getColorScale=function(){},n.rebind(i,e,"on"),i},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,i=t.data.map((function(t,r){return[].concat(t).map((function(t,n){var i=a({},e.elements[r]);return i.name=t,i.color=[].concat(e.elements[r].color)[n],i}))})),o=n.merge(i);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 l=e.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(t,e){return t.color})),c=e.fontSize,u=null==e.isContinuous?"number"==typeof o[0]:e.isContinuous,f=u?e.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:e.height,width:e.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.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("+[c/2,v(e)+c/2]+")"},d:function(t,e){var r,a,i,o=t.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(t,e){return g(e)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?e.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?e.textColor:"none"}),b.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?(a(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,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(t=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!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:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=e.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(t)return t.style({display:"none"}),c},c.show=function(){if(t)return t.style({display:"block"}),c},c.config=function(t){return a(i,t),c},c},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=a({},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 i=o.util.duplicates(r.data.map((function(t,e){return t.geometry})));r.data.forEach((function(t,e){var n=i.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)}))}if(t.layout){var l=a({},t.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(t,r){o.util.translator.apply(null,t.concat(e))})),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(t,e){u[c[s.indexOf(t.key)]]=t.value})),l.margin=u}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return t}},{"../../../constants/alignment":177,"../../../lib":202,d3:21}],285:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../../lib"),i=t("../../../components/color"),o=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){var e,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),e=e?s(e,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(e),a.config(i).render(u),t.data=e.data,t.layout=e.layout,c.fillLayout(t),e}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return e},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var t,n,a=this,i=o.util.cloneJson(e);t=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(t)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(t){var e=n.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=s(o,t.layout)}},{"../../../components/color":75,"../../../lib":202,"./micropolar":284,"./undo_manager":286,d3:21}],286:[function(t,e,r){"use strict";e.exports=function(){var t,e=[],r=-1,n=!1;function a(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n||(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?(a(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(a(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a=u&&(p.min=0,g.min=0,v.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}function h(t,e,r,n){var a=f[e._name];function o(r,n){return i.coerce(t,e,a,r,n)}o("uirevision",n.uirevision),e.type="linear";var d=o("color"),p=d!==a.color.dflt?d:r.font.color,h=e._name.charAt(0).toUpperCase(),g="Component "+h,v=o("title.text",g);e._hovertitle=v===g?v:h,i.coerceFont(o,"title.font",{family:r.font.family,size:Math.round(1.2*r.font.size),color:p}),o("min"),c(t,e,o,"linear"),l(t,e,o,"linear",{}),s(t,e,o,{outerTicks:!0}),o("showticklabels")&&(i.coerceFont(o,"tickfont",{family:r.font.family,size:r.font.size,color:p}),o("tickangle"),o("tickformat")),u(t,e,o,{dfltColor:d,bgColor:r.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:a}),o("hoverformat"),o("layer")}e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:f,handleDefaults:p,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../components/color":75,"../../lib":202,"../../plot_api/plot_template":236,"../cartesian/line_grid_defaults":262,"../cartesian/tick_label_defaults":267,"../cartesian/tick_mark_defaults":268,"../cartesian/tick_value_defaults":269,"../subplot_defaults":287,"./layout_attributes":290}],292:[function(t,e,r){"use strict";var n=t("d3"),a=t("tinycolor2"),i=t("../../registry"),o=t("../../lib"),l=o._,s=t("../../components/color"),c=t("../../components/drawing"),u=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,d=t("../plots"),p=t("../cartesian/axes"),h=t("../../components/dragelement"),g=t("../../components/fx"),v=t("../../components/dragelement/helpers"),m=v.freeMode,y=v.rectMode,x=t("../../components/titles"),b=t("../cartesian/select").prepSelect,_=t("../cartesian/select").selectOnClick,w=t("../cartesian/select").clearSelect,T=t("../cartesian/select").clearSelectionsCache,k=t("../cartesian/constants");function M(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework(e),this.aTickLayout=null,this.bTickLayout=null,this.cTickLayout=null}e.exports=M;var A=M.prototype;A.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={},this.layers={}},A.plot=function(t,e){var r=e[this.id],n=e._size;this._hasClipOnAxisFalse=!1;for(var a=0;aL*x?a=(i=x)*L:i=(a=y)/L,o=v*a/y,l=m*i/x,r=e.l+e.w*h-a/2,n=e.t+e.h*(1-g)-i/2,d.x0=r,d.y0=n,d.w=a,d.h=i,d.sum=b,d.xaxis={type:"linear",range:[_+2*T-b,b-_-2*w],domain:[h-o/2,h+o/2],_id:"x"},u(d.xaxis,d.graphDiv._fullLayout),d.xaxis.setScale(),d.xaxis.isPtWithinRange=function(t){return t.a>=d.aaxis.range[0]&&t.a<=d.aaxis.range[1]&&t.b>=d.baxis.range[1]&&t.b<=d.baxis.range[0]&&t.c>=d.caxis.range[1]&&t.c<=d.caxis.range[0]},d.yaxis={type:"linear",range:[_,b-w-T],domain:[g-l/2,g+l/2],_id:"y"},u(d.yaxis,d.graphDiv._fullLayout),d.yaxis.setScale(),d.yaxis.isPtWithinRange=function(){return!0};var k=d.yaxis.domain[0],M=d.aaxis=f({},t.aaxis,{range:[_,b-w-T],side:"left",tickangle:(+t.aaxis.tickangle||0)-30,domain:[k,k+l*L],anchor:"free",position:0,_id:"y",_length:a});u(M,d.graphDiv._fullLayout),M.setScale();var A=d.baxis=f({},t.baxis,{range:[b-_-T,w],side:"bottom",domain:d.xaxis.domain,anchor:"free",position:0,_id:"x",_length:a});u(A,d.graphDiv._fullLayout),A.setScale();var S=d.caxis=f({},t.caxis,{range:[b-_-w,T],side:"right",tickangle:(+t.caxis.tickangle||0)+30,domain:[k,k+l*L],anchor:"free",position:0,_id:"y",_length:a});u(S,d.graphDiv._fullLayout),S.setScale();var C="M"+r+","+(n+i)+"h"+a+"l-"+a/2+",-"+i+"Z";d.clipDef.select("path").attr("d",C),d.layers.plotbg.select("path").attr("d",C);var O="M0,"+i+"h"+a+"l-"+a/2+",-"+i+"Z";d.clipDefRelative.select("path").attr("d",O);var D="translate("+r+","+n+")";d.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",D),d.clipDefRelative.select("path").attr("transform",null);var z="translate("+(r-A._offset)+","+(n+i)+")";d.layers.baxis.attr("transform",z),d.layers.bgrid.attr("transform",z);var P="translate("+(r+a/2)+","+n+")rotate(30)translate(0,"+-M._offset+")";d.layers.aaxis.attr("transform",P),d.layers.agrid.attr("transform",P);var E="translate("+(r+a/2)+","+n+")rotate(-30)translate(0,"+-S._offset+")";d.layers.caxis.attr("transform",E),d.layers.cgrid.attr("transform",E),d.drawAxes(!0),d.layers.aline.select("path").attr("d",M.showline?"M"+r+","+(n+i)+"l"+a/2+",-"+i:"M0,0").call(s.stroke,M.linecolor||"#000").style("stroke-width",(M.linewidth||0)+"px"),d.layers.bline.select("path").attr("d",A.showline?"M"+r+","+(n+i)+"h"+a:"M0,0").call(s.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),d.layers.cline.select("path").attr("d",S.showline?"M"+(r+a/2)+","+n+"l"+a/2+","+i:"M0,0").call(s.stroke,S.linecolor||"#000").style("stroke-width",(S.linewidth||0)+"px"),d.graphDiv._context.staticPlot||d.initInteractions(),c.setClipUrl(d.layers.frontplot,d._hasClipOnAxisFalse?null:d.clipId,d.graphDiv)},A.drawAxes=function(t){var e=this.graphDiv,r=this.id.substr(7)+"title",n=this.layers,a=this.aaxis,i=this.baxis,o=this.caxis;if(this.drawAx(a),this.drawAx(i),this.drawAx(o),t){var s=Math.max(a.showticklabels?a.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0)),c=(i.showticklabels?i.tickfont.size:0)+("outside"===i.ticks?i.ticklen:0)+3;n["a-title"]=x.draw(e,"a"+r,{propContainer:a,propName:this.id+".aaxis.title",placeholder:l(e,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-a.title.font.size/3-s,"text-anchor":"middle"}}),n["b-title"]=x.draw(e,"b"+r,{propContainer:i,propName:this.id+".baxis.title",placeholder:l(e,"Click to enter Component B title"),attributes:{x:this.x0-c,y:this.y0+this.h+.83*i.title.font.size+c,"text-anchor":"middle"}}),n["c-title"]=x.draw(e,"c"+r,{propContainer:o,propName:this.id+".caxis.title",placeholder:l(e,"Click to enter Component C title"),attributes:{x:this.x0+this.w+c,y:this.y0+this.h+.83*o.title.font.size+c,"text-anchor":"middle"}})}},A.drawAx=function(t){var e,r=this.graphDiv,n=t._name,a=n.charAt(0),i=t._id,l=this.layers[n],s=a+"tickLayout",c=(e=t).ticks+String(e.ticklen)+String(e.showticklabels);this[s]!==c&&(l.selectAll("."+i+"tick").remove(),this[s]=c),t.setScale();var u=p.calcTicks(t),f=p.clipEnds(t,u),d=p.makeTransFn(t),h=p.getTickSigns(t)[2],g=o.deg2rad(30),v=h*(t.linewidth||1)/2,m=h*t.ticklen,y=this.w,x=this.h,b="b"===a?"M0,"+v+"l"+Math.sin(g)*m+","+Math.cos(g)*m:"M"+v+",0l"+Math.cos(g)*m+","+-Math.sin(g)*m,_={a:"M0,0l"+x+",-"+y/2,b:"M0,0l-"+y/2+",-"+x,c:"M0,0l-"+x+","+y/2}[a];p.drawTicks(r,t,{vals:"inside"===t.ticks?f:u,layer:l,path:b,transFn:d,crisp:!1}),p.drawGrid(r,t,{vals:f,layer:this.layers[a+"grid"],path:_,transFn:d,crisp:!1}),p.drawLabels(r,t,{vals:u,layer:l,transFn:d,labelFns:p.makeLabelFns(t,0,30)})};var S=k.MINZOOM/2+.87,C="m-0.87,.5h"+S+"v3h-"+(S+5.2)+"l"+(S/2+2.6)+",-"+(.87*S+4.5)+"l2.6,1.5l-"+S/2+","+.87*S+"Z",O="m0.87,.5h-"+S+"v3h"+(S+5.2)+"l-"+(S/2+2.6)+",-"+(.87*S+4.5)+"l-2.6,1.5l"+S/2+","+.87*S+"Z",D="m0,1l"+S/2+","+.87*S+"l2.6,-1.5l-"+(S/2+2.6)+",-"+(.87*S+4.5)+"l-"+(S/2+2.6)+","+(.87*S+4.5)+"l2.6,1.5l"+S/2+",-"+.87*S+"Z",z=!0;function P(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}A.clearSelect=function(){T(this.dragOptions),w(this.dragOptions.gd)},A.initInteractions=function(){var t,e,r,n,u,f,d,p,v,x,w=this,T=w.layers.plotbg.select("path").node(),M=w.graphDiv,A=M._fullLayout._zoomlayer;function S(t){var e={};return e[w.id+".aaxis.min"]=t.a,e[w.id+".baxis.min"]=t.b,e[w.id+".caxis.min"]=t.c,e}function E(t,e){var r=M._fullLayout.clickmode;P(M),2===t&&(M.emit("plotly_doubleclick",null),i.call("_guiRelayout",M,S({a:0,b:0,c:0}))),r.indexOf("select")>-1&&1===t&&_(e,M,[w.xaxis],[w.yaxis],w.id,w.dragOptions),r.indexOf("event")>-1&&g.click(M,e,w.id)}function I(t,e){return 1-e/w.h}function R(t,e){return 1-(t+(w.h-e)/Math.sqrt(3))/w.w}function F(t,e){return(t-(w.h-e)/Math.sqrt(3))/w.w}function N(a,i){var o=t+a,l=e+i,s=Math.max(0,Math.min(1,I(0,e),I(0,l))),c=Math.max(0,Math.min(1,R(t,e),R(o,l))),h=Math.max(0,Math.min(1,F(t,e),F(o,l))),g=(s/2+h)*w.w,m=(1-s/2-c)*w.w,y=(g+m)/2,b=m-g,_=(1-s)*w.h,T=_-b/L;b.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),x.transition().style("opacity",1).duration(200),p=!0),M.emit("plotly_relayouting",S(u))}function B(){P(M),u!==r&&(i.call("_guiRelayout",M,S(u)),z&&M.data&&M._context.showTips&&(o.notifier(l(M,"Double-click to zoom back out"),"long"),z=!1))}function H(t,e){var n=t/w.xaxis._m,a=e/w.yaxis._m,i=[(u={a:r.a-a,b:r.b+(n+a)/2,c:r.c-(n-a)/2}).a,u.b,u.c].sort(o.sorterAsc),l=i.indexOf(u.a),s=i.indexOf(u.b),f=i.indexOf(u.c);i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),u={a:i[l],b:i[s],c:i[f]},e=(r.a-u.a)*w.yaxis._m,t=(r.c-u.c-r.b+u.b)*w.xaxis._m);var d="translate("+(w.x0+t)+","+(w.y0+e)+")";w.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",d);var p="translate("+-t+","+-e+")";w.clipDefRelative.select("path").attr("transform",p),w.aaxis.range=[u.a,w.sum-u.b-u.c],w.baxis.range=[w.sum-u.a-u.c,u.b],w.caxis.range=[w.sum-u.a-u.b,u.c],w.drawAxes(!1),w._hasClipOnAxisFalse&&w.plotContainer.select(".scatterlayer").selectAll(".trace").call(c.hideOutsideRangePoints,w),M.emit("plotly_relayouting",S(u))}function j(){i.call("_guiRelayout",M,S(u))}this.dragOptions={element:T,gd:M,plotinfo:{id:w.id,domain:M._fullLayout[w.id].domain,xaxis:w.xaxis,yaxis:w.yaxis},subplot:w.id,prepFn:function(i,o,l){w.dragOptions.xaxes=[w.xaxis],w.dragOptions.yaxes=[w.yaxis];var c=w.dragOptions.dragmode=M._fullLayout.dragmode;m(c)?w.dragOptions.minDrag=1:w.dragOptions.minDrag=void 0,"zoom"===c?(w.dragOptions.moveFn=N,w.dragOptions.clickFn=E,w.dragOptions.doneFn=B,function(i,o,l){var c=T.getBoundingClientRect();t=o-c.left,e=l-c.top,r={a:w.aaxis.range[0],b:w.baxis.range[1],c:w.caxis.range[1]},u=r,n=w.aaxis.range[1]-r.a,f=a(w.graphDiv._fullLayout[w.id].bgcolor).getLuminance(),d="M0,"+w.h+"L"+w.w/2+", 0L"+w.w+","+w.h+"Z",p=!1,v=A.append("path").attr("class","zoombox").attr("transform","translate("+w.x0+", "+w.y0+")").style({fill:f>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",d),x=A.append("path").attr("class","zoombox-corners").attr("transform","translate("+w.x0+", "+w.y0+")").style({fill:s.background,stroke:s.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),w.clearSelect(M)}(0,o,l)):"pan"===c?(w.dragOptions.moveFn=H,w.dragOptions.clickFn=E,w.dragOptions.doneFn=j,r={a:w.aaxis.range[0],b:w.baxis.range[1],c:w.caxis.range[1]},u=r,w.clearSelect(M)):(y(c)||m(c))&&b(i,o,l,w.dragOptions,c)}},T.onmousemove=function(t){g.hover(M,t,w.id),M._fullLayout._lasthover=T,M._fullLayout._hoversubplot=w.id},T.onmouseout=function(t){M._dragging||h.unhover(M,t)},h.init(this.dragOptions)}},{"../../components/color":75,"../../components/dragelement":94,"../../components/dragelement/helpers":93,"../../components/drawing":97,"../../components/fx":115,"../../components/titles":170,"../../lib":202,"../../lib/extend":196,"../../registry":293,"../cartesian/axes":246,"../cartesian/constants":252,"../cartesian/select":265,"../cartesian/set_convert":266,"../plots":280,d3:21,tinycolor2:58}],293:[function(t,e,r){"use strict";var n=t("./lib/loggers"),a=t("./lib/noop"),i=t("./lib/push_unique"),o=t("./lib/is_plain_object"),l=t("./lib/dom").addStyleRule,s=t("./lib/extend"),c=t("./plots/attributes"),u=t("./plots/layout_attributes"),f=s.extendFlat,d=s.extendDeepAll;function p(t){var e=t.name,a=t.categories,i=t.meta;if(r.modules[e])n.log("Type "+e+" already registered");else{r.subplotsRegistry[t.basePlotModule.name]||function(t){var e=t.name;if(r.subplotsRegistry[e])return void n.log("Plot type "+e+" already registered.");for(var a in m(t),r.subplotsRegistry[e]=t,r.componentsRegistry)b(a,t.name)}(t.basePlotModule);for(var o={},s=0;s-1&&(f[p[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":75,"../components/drawing":97,"../constants/xmlns_namespaces":182,"../lib":202,d3:21}],302:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rf+c||!n(u))}for(var p=0;pi))return e}return void 0!==r?r:t.dflt},r.coerceColor=function(t,e,r){return a(e).isValid()?e:void 0!==r?r:t.dflt},r.coerceEnumerated=function(t,e,r){return t.coerceNumber&&(e=+e),-1!==t.values.indexOf(e)?e:void 0!==r?r:t.dflt},r.getValue=function(t,e){var r;return Array.isArray(t)?e0?a+=i:e<0&&(a-=i)}return n.inbox(r-e,a-e,b+(a-e)/(a-r)-1)}"h"===v.orientation?(i=r,l=e,u="y",f="x",d=L,p=A):(i=e,l=r,u="x",f="y",p=L,d=A);var S=t[u+"a"],C=t[f+"a"];h=Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0]));var O=n.getDistanceFunction(a,d,p,(function(t){return(d(t)+p(t))/2}));if(n.getClosest(g,O,t),!1!==t.index&&g[t.index].p!==c){y||(T=function(t){return Math.min(_(t),t.p-m.bargroupwidth/2)},k=function(t){return Math.max(w(t),t.p+m.bargroupwidth/2)});var D=g[t.index],z=v.base?D.b+D.s:D.s;t[f+"0"]=t[f+"1"]=C.c2p(D[f],!0),t[f+"LabelVal"]=z;var P=m.extents[m.extents.round(D.p)];return t[u+"0"]=S.c2p(y?T(D):P[0],!0),t[u+"1"]=S.c2p(y?k(D):P[1],!0),t[u+"LabelVal"]=D.p,t.labelLabel=s(S,t[u+"LabelVal"]),t.valueLabel=s(C,t[f+"LabelVal"]),t.spikeDistance=(L(D)+function(t){return M(_(t),w(t))}(D))/2-b,t[u+"Spike"]=S.c2p(D.p,!0),o(D,v,t),t.hovertemplate=v.hovertemplate,t}}function f(t,e){var r=e.mcc||t.marker.color,n=e.mlcc||t.marker.line.color,a=l(t,e);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}e.exports={hoverPoints:function(t,e,r,n){var i=u(t,e,r,n);if(i){var o=i.cd,l=o[0].trace,s=o[i.index];return i.color=f(l,s),a.getComponentMethod("errorbars","hoverInfo")(s,l,i),[i]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":75,"../../components/fx":115,"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"../../registry":293,"./helpers":309}],311:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc").crossTraceCalc,colorbar:t("../scatter/marker_colorbar"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot").plot,style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"bar",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":259,"../scatter/marker_colorbar":431,"./arrays_to_calcdata":302,"./attributes":303,"./calc":304,"./cross_trace_calc":306,"./defaults":307,"./event_data":308,"./hover":310,"./layout_attributes":312,"./layout_defaults":313,"./plot":314,"./select":315,"./style":317}],312:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],313:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/cartesian/axes"),i=t("../../lib"),o=t("./layout_attributes");e.exports=function(t,e,r){function l(r,n){return i.coerce(t,e,o,r,n)}for(var s=!1,c=!1,u=!1,f={},d=l("barmode"),p=0;p0}function L(t){return"auto"===t?0:t}function S(t,e){var r=Math.PI/180*e,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:t.width*a+t.height*n,y:t.width*n+t.height*a}}function C(t,e,r,n,a,i){var o=!!i.isHorizontal,l=!!i.constrained,s=i.angle||0,c=i.anchor||"end",u="end"===c,f="start"===c,d=((i.leftToRight||0)+1)/2,p=1-d,h=a.width,g=a.height,v=Math.abs(e-t),m=Math.abs(n-r),y=v>2*_&&m>2*_?_:0;v-=2*y,m-=2*y;var x=L(s);"auto"!==s||h<=v&&g<=m||!(h>v||g>m)||(h>m||g>v)&&h.01?q:function(t,e,r){return r&&t===e?t:Math.abs(t-e)>=2?q(t):t>e?Math.ceil(t):Math.floor(t)};N=G(N,B,I),B=G(B,N,I),H=G(H,j,!I),j=G(j,H,!I)}var Z=M(i.ensureSingle(z,"path"),D,v,m);if(Z.style("vector-effect","non-scaling-stroke").attr("d",isNaN((B-N)*(j-H))?"M0,0Z":"M"+N+","+H+"V"+j+"H"+B+"V"+H+"Z").call(s.setClipUrl,e.layerClipId,t),!D.uniformtext.mode&&R){var Y=s.makePointStyleFns(f);s.singlePointStyle(c,Z,f,Y,t)}!function(t,e,r,n,a,l,c,f,p,v,m){var w,T=e.xaxis,A=e.yaxis,O=t._fullLayout;function D(e,r,n){return i.ensureSingle(e,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(s.font,n).call(o.convertToTspans,t)}var z=n[0].trace,P="h"===z.orientation,E=function(t,e,r,n,a){var o,l=e[0].trace;o=l.texttemplate?function(t,e,r,n,a){var o=e[0].trace,l=i.castOption(o,r,"texttemplate");if(!l)return"";var s,c,f,d,p="waterfall"===o.type,h="funnel"===o.type;"h"===o.orientation?(s="y",c=a,f="x",d=n):(s="x",c=n,f="y",d=a);function g(t){return u(d,+t,!0).text}var v=e[r],m={};m.label=v.p,m.labelLabel=m[s+"Label"]=(y=v.p,u(c,y,!0).text);var y;var x=i.castOption(o,v.i,"text");(0===x||x)&&(m.text=x);m.value=v.s,m.valueLabel=m[f+"Label"]=g(v.s);var _={};b(_,o,v.i),p&&(m.delta=+v.rawS||v.s,m.deltaLabel=g(m.delta),m.final=v.v,m.finalLabel=g(m.final),m.initial=m.final-m.delta,m.initialLabel=g(m.initial));h&&(m.value=v.s,m.valueLabel=g(m.value),m.percentInitial=v.begR,m.percentInitialLabel=i.formatPercent(v.begR),m.percentPrevious=v.difR,m.percentPreviousLabel=i.formatPercent(v.difR),m.percentTotal=v.sumR,m.percenTotalLabel=i.formatPercent(v.sumR));var w=i.castOption(o,v.i,"customdata");w&&(m.customdata=w);return i.texttemplateString(l,m,t._d3locale,_,m,o._meta||{})}(t,e,r,n,a):l.textinfo?function(t,e,r,n){var a=t[0].trace,o="h"===a.orientation,l="waterfall"===a.type,s="funnel"===a.type;function c(t){return u(o?r:n,+t,!0).text}var f,d=a.textinfo,p=t[e],h=d.split("+"),g=[],v=function(t){return-1!==h.indexOf(t)};v("label")&&g.push((m=t[e].p,u(o?n:r,m,!0).text));var m;v("text")&&(0===(f=i.castOption(a,p.i,"text"))||f)&&g.push(f);if(l){var y=+p.rawS||p.s,x=p.v,b=x-y;v("initial")&&g.push(c(b)),v("delta")&&g.push(c(y)),v("final")&&g.push(c(x))}if(s){v("value")&&g.push(c(p.s));var _=0;v("percent initial")&&_++,v("percent previous")&&_++,v("percent total")&&_++;var w=_>1;v("percent initial")&&(f=i.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),v("percent previous")&&(f=i.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),v("percent total")&&(f=i.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(e,r,n,a):g.getValue(l.text,r);return g.coerceString(y,o)}(O,n,a,T,A);w=function(t,e){var r=g.getValue(t.textposition,e);return g.coerceEnumerated(x,r)}(z,a);var I="stack"===v.mode||"relative"===v.mode,R=n[a],F=!I||R._outmost;if(!E||"none"===w||(R.isBlank||l===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var N=O.font,B=h.getBarColor(n[a],z),H=h.getInsideTextFont(z,a,N,B),j=h.getOutsideTextFont(z,a,N),U=r.datum();P?"log"===T.type&&U.s0<=0&&(l=T.range[0]=G*(W/Z):W>=Z*(X/G);G>0&&Z>0&&(Q||J||$)?w="inside":(w="outside",V.remove(),V=null)}else w="inside";if(!V){Y=i.ensureUniformFontSize(t,"outside"===w?j:H);var K=(V=D(r,E,Y)).attr("transform");if(V.attr("transform",""),q=s.bBox(V.node()),G=q.width,Z=q.height,V.attr("transform",K),G<=0||Z<=0)return void V.remove()}var tt,et,rt=z.textangle;"outside"===w?(et="both"===z.constraintext||"outside"===z.constraintext,tt=function(t,e,r,n,a,i){var o,l=!!i.isHorizontal,s=!!i.constrained,c=i.angle||0,u=a.width,f=a.height,d=Math.abs(e-t),p=Math.abs(n-r);o=l?p>2*_?_:0:d>2*_?_:0;var h=1;s&&(h=l?Math.min(1,p/f):Math.min(1,d/u));var g=L(c),v=S(a,g),m=(l?v.x:v.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(t+e)/2,w=(r+n)/2,T=0,M=0,A=l?k(e,t):k(r,n);l?(b=e-A*o,T=A*m):(w=n+A*o,M=-A*m);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:h,rotate:g}}(l,c,f,p,q,{isHorizontal:P,constrained:et,angle:rt})):(et="both"===z.constraintext||"inside"===z.constraintext,tt=C(l,c,f,p,q,{isHorizontal:P,constrained:et,angle:rt,anchor:z.insidetextanchor}));tt.fontSize=Y.size,d(z.type,tt,O),R.transform=tt,M(V,O,v,m).attr("transform",i.getTextTransform(tt))}(t,e,z,r,p,N,B,H,j,v,m),e.layerClipId&&s.hideOutsideRangePoint(c,z.select("text"),w,O,f.xcalendar,f.ycalendar)}));var H=!1===f.cliponaxis;s.setClipUrl(c,H?null:e.layerClipId,t)}));c.getComponentMethod("errorbars","plot")(t,z,e,v)},toMoveInsideBar:C}},{"../../components/color":75,"../../components/drawing":97,"../../components/fx/helpers":111,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/cartesian/axes":246,"../../registry":293,"./attributes":303,"./constants":305,"./helpers":309,"./style":317,"./uniform_text":319,d3:21,"fast-isnumeric":23}],315:[function(t,e,r){"use strict";function n(t,e,r,n,a){var i=e.c2p(n?t.s0:t.p0,!0),o=e.c2p(n?t.s1:t.p1,!0),l=r.c2p(n?t.p0:t.s0,!0),s=r.c2p(n?t.p1:t.s1,!0);return a?[(i+o)/2,(l+s)/2]:n?[o,(l+s)/2]:[(i+o)/2,s]}e.exports=function(t,e){var r,a=t.cd,i=t.xaxis,o=t.yaxis,l=a[0].trace,s="funnel"===l.type,c="h"===l.orientation,u=[];if(!1===e)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),e.selectAll("g.points").each((function(e){h(n.select(this),e[0].trace,t)})),l.getComponentMethod("errorbars","style")(e)},styleTextPoints:g,styleOnSelect:function(t,e,r){var a=e[0].trace;a.selectedpoints?function(t,e,r){i.selectedPointStyle(t.selectAll("path"),e),function(t,e,r){t.each((function(t){var a,l=n.select(this);if(t.selected){a=o.ensureUniformFontSize(r,v(l,t,e,r));var s=e.selected.textfont&&e.selected.textfont.color;s&&(a.color=s),i.font(l,a)}else i.selectedTextStyle(l,e)}))}(t.selectAll("text"),e,r)}(r,a,t):(h(r,a,t),l.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:s}},{"../../components/color":75,"../../components/drawing":97,"../../lib":202,"../../registry":293,"./attributes":303,"./helpers":309,"./uniform_text":319,d3:21}],318:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,l){r("marker.color",o),a(t,"marker")&&i(t,e,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(t,"marker.line")&&i(t,e,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":75,"../../components/colorscale/defaults":85,"../../components/colorscale/helpers":86}],319:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib");function i(t){return"_"+t+"Text_minsize"}e.exports={recordMinTextSize:function(t,e,r){if(r.uniformtext.mode){var n=i(t),a=r.uniformtext.minsize,o=e.scale*e.fontSize;e.hide=oA.uf};if(e._hasPreCompStats){var F=e[y],N=function(t){return m.d2c((e[t]||[])[r])},B=1/0,H=-1/0;for(r=0;r=A.q1&&A.q3>=A.med){var U=N("lowerfence");A.lf=U!==o&&U<=A.q1?U:d(A,S,C);var V=N("upperfence");A.uf=V!==o&&V>=A.q3?V:p(A,S,C);var q=N("mean");A.mean=q!==o?q:C?i.mean(S,C):(A.q1+A.q3)/2;var G=N("sd");A.sd=q!==o&&G>=0?G:C?i.stdev(S,C,A.mean):A.q3-A.q1,A.lo=h(A),A.uo=g(A);var Z=N("notchspan");Z=Z!==o&&Z>0?Z:v(A,C),A.ln=A.med-Z,A.un=A.med+Z;var Y=A.lf,X=A.uf;e.boxpoints&&S.length&&(Y=Math.min(Y,S[0]),X=Math.max(X,S[C-1])),e.notched&&(Y=Math.min(Y,A.ln),X=Math.max(X,A.un)),A.min=Y,A.max=X}else{var W;i.warn(["Invalid input - make sure that q1 <= median <= q3","q1 = "+A.q1,"median = "+A.med,"q3 = "+A.q3].join("\n")),W=A.med!==o?A.med:A.q1!==o?A.q3!==o?(A.q1+A.q3)/2:A.q1:A.q3!==o?A.q3:0,A.med=W,A.q1=A.q3=W,A.lf=A.uf=W,A.mean=A.sd=W,A.ln=A.un=W,A.min=A.max=W}B=Math.min(B,A.min),H=Math.max(H,A.max),A.pts2=L.filter(R),k.push(A)}}e._extremes[m._id]=a.findExtremes(m,[B,H],{padded:!0})}else{var Q=m.makeCalcdata(e,y),J=function(t,e){for(var r=t.length,n=new Array(r+1),a=0;a=0&&tt<$&&(c(O={v:D,i:r},e,r),K[tt].push(O))}var et=1/0,rt=-1/0,nt=e.quartilemethod,at="exclusive"===nt,it="inclusive"===nt;for(r=0;r<$;r++)if(K[r].length>0){var ot,lt;if((A={}).pos=A[b]=E[r],L=A.pts=K[r].sort(u),C=(S=A[y]=L.map(f)).length,A.min=S[0],A.max=S[C-1],A.mean=i.mean(S,C),A.sd=i.stdev(S,C,A.mean),A.med=i.interp(S,.5),C%2&&(at||it))at?(ot=S.slice(0,C/2),lt=S.slice(C/2+1)):it&&(ot=S.slice(0,C/2+1),lt=S.slice(C/2)),A.q1=i.interp(ot,.5),A.q3=i.interp(lt,.5);else A.q1=i.interp(S,.25),A.q3=i.interp(S,.75);A.lf=d(A,S,C),A.uf=p(A,S,C),A.lo=h(A),A.uo=g(A);var st=v(A,C);A.ln=A.med-st,A.un=A.med+st,et=Math.min(et,A.ln),rt=Math.max(rt,A.un),A.pts2=L.filter(R),k.push(A)}e._extremes[m._id]=a.findExtremes(m,e.notched?Q.concat([et,rt]):Q,{padded:!0})}return function(t,e){if(i.isArrayOrTypedArray(e.selectedpoints))for(var r=0;r0?(k[0].t={num:_[M],dPos:I,posLetter:b,valLetter:y,labels:{med:l(t,"median:"),min:l(t,"min:"),q1:l(t,"q1:"),q3:l(t,"q3:"),max:l(t,"max:"),mean:"sd"===e.boxmean?l(t,"mean \xb1 \u03c3:"):l(t,"mean:"),lf:l(t,"lower fence:"),uf:l(t,"upper fence:")}},_[M]++,k):[{t:{empty:!0}}]};var s={text:"tx",hovertext:"htx"};function c(t,e,r){for(var n in s)i.isArrayOrTypedArray(e[n])&&(Array.isArray(r)?i.isArrayOrTypedArray(e[n][r[0]])&&(t[s[n]]=e[n][r[0]][r[1]]):t[s[n]]=e[n][r])}function u(t,e){return t.v-e.v}function f(t){return t.v}function d(t,e,r){return 0===r?t.q1:Math.min(t.q1,e[Math.min(i.findBin(2.5*t.q1-1.5*t.q3,e,!0)+1,r-1)])}function p(t,e,r){return 0===r?t.q3:Math.max(t.q3,e[Math.max(i.findBin(2.5*t.q3-1.5*t.q1,e),0)])}function h(t){return 4*t.q1-3*t.q3}function g(t){return 4*t.q3-3*t.q1}function v(t,e){return 0===e?0:1.57*(t.q3-t.q1)/Math.sqrt(e)}},{"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"fast-isnumeric":23}],322:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),a=t("../../lib"),i=t("../../plots/cartesian/axis_ids").getAxisGroup,o=["v","h"];function l(t,e,r,o){var l,s,c,u=e.calcdata,f=e._fullLayout,d=o._id,p=d.charAt(0),h=[],g=0;for(l=0;l1,b=1-f[t+"gap"],_=1-f[t+"groupgap"];for(l=0;l0){var q=S.pointpos,G=S.jitter,Z=S.marker.size/2,Y=0;q+G>=0&&((Y=U*(q+G))>A?(V=!0,H=Z,N=Y):Y>R&&(H=Z,N=A)),Y<=A&&(N=A);var X=0;q-G<=0&&((X=-U*(q-G))>L?(V=!0,j=Z,B=X):X>F&&(j=Z,B=L)),X<=L&&(B=L)}else N=A,B=L;var W=new Array(c.length);for(s=0;s0?(v="v",m=x>0?Math.min(_,b):Math.min(b)):x>0?(v="h",m=Math.min(_)):m=0;if(m){e._length=m;var M=r("orientation",v);e._hasPreCompStats?"v"===M&&0===x?(r("x0",0),r("dx",1)):"h"===M&&0===y&&(r("y0",0),r("dy",1)):"v"===M&&0===x?r("x0"):"h"===M&&0===y&&r("y0"),a.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],i)}else e.visible=!1}function u(t,e,r,a){var i=a.prefix,o=n.coerce2(t,e,s,"marker.outliercolor"),l=r("marker.line.outliercolor"),c="outliers";e._hasPreCompStats?c="all":(o||l)&&(c="suspectedoutliers");var u=r(i+"points",c);u?(r("jitter","all"===u?.3:0),r("pointpos","all"===u?-1.5:0),r("marker.symbol"),r("marker.opacity"),r("marker.size"),r("marker.color",e.line.color),r("marker.line.color"),r("marker.line.width"),"suspectedoutliers"===u&&(r("marker.line.outliercolor",e.marker.color),r("marker.line.outlierwidth")),r("selected.marker.color"),r("unselected.marker.color"),r("selected.marker.size"),r("unselected.marker.size"),r("text"),r("hovertext")):delete e.marker;var f=r("hoveron");"all"!==f&&-1===f.indexOf("points")||r("hovertemplate"),n.coerceSelectionMarkerOpacity(e,r)}e.exports={supplyDefaults:function(t,e,r,a){function o(r,a){return n.coerce(t,e,s,r,a)}if(c(t,e,o,a),!1!==e.visible){var l=e._hasPreCompStats;l&&(o("lowerfence"),o("upperfence")),o("line.color",(t.marker||{}).color||r),o("line.width"),o("fillcolor",i.addOpacity(e.line.color,.5));var f=!1;if(l){var d=o("mean"),p=o("sd");d&&d.length&&(f=!0,p&&p.length&&(f="sd"))}o("boxmean",f),o("whiskerwidth"),o("width"),o("quartilemethod");var h=!1;if(l){var g=o("notchspan");g&&g.length&&(h=!0)}else n.validate(t.notchwidth,s.notchwidth)&&(h=!0);o("notched",h)&&o("notchwidth"),u(t,e,o,{prefix:"box"})}},crossTraceDefaults:function(t,e){var r,a;function i(t){return n.coerce(a._input,a,s,t)}for(var l=0;lt.lo&&(x.so=!0)}return i}));d.enter().append("path").classed("point",!0),d.exit().remove(),d.call(i.translatePoints,o,l)}function s(t,e,r,i){var o,l,s=e.val,c=e.pos,u=!!c.rangebreaks,f=i.bPos,d=i.bPosPxOffset||0,p=r.boxmean||(r.meanline||{}).visible;Array.isArray(i.bdPos)?(o=i.bdPos[0],l=i.bdPos[1]):(o=i.bdPos,l=i.bdPos);var h=t.selectAll("path.mean").data("box"===r.type&&r.boxmean||"violin"===r.type&&r.box.visible&&r.meanline.visible?a.identity:[]);h.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),h.exit().remove(),h.each((function(t){var e=c.c2l(t.pos+f,!0),a=c.l2p(e-o)+d,i=c.l2p(e+l)+d,h=u?(a+i)/2:c.l2p(e)+d,g=s.c2p(t.mean,!0),v=s.c2p(t.mean-t.sd,!0),m=s.c2p(t.mean+t.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+g+","+a+"V"+i+("sd"===p?"m0,0L"+v+","+h+"L"+g+","+a+"L"+m+","+h+"Z":"")):n.select(this).attr("d","M"+a+","+g+"H"+i+("sd"===p?"m0,0L"+h+","+v+"L"+a+","+g+"L"+h+","+m+"Z":""))}))}e.exports={plot:function(t,e,r,i){var c=e.xaxis,u=e.yaxis;a.makeTraceGroups(i,r,"trace boxes").each((function(t){var e,r,a=n.select(this),i=t[0],f=i.t,d=i.trace;(f.wdPos=f.bdPos*d.whiskerwidth,!0!==d.visible||f.empty)?a.remove():("h"===d.orientation?(e=u,r=c):(e=c,r=u),o(a,{pos:e,val:r},d,f),l(a,{x:c,y:u},d,f),s(a,{pos:e,val:r},d,f))}))},plotBoxAndWhiskers:o,plotPoints:l,plotBoxMean:s}},{"../../components/drawing":97,"../../lib":202,d3:21}],330:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,a=t.cd,i=t.xaxis,o=t.yaxis,l=[];if(!1===e)for(r=0;ro.level||o.starts.length&&i===o.level)}break;case"constraint":if(n.prefixBoundary=!1,n.edgepaths.length)return;var l=n.x.length,s=n.y.length,c=-1/0,u=1/0;for(r=0;r":p>c&&(n.prefixBoundary=!0);break;case"<":(pc||n.starts.length&&d===u)&&(n.prefixBoundary=!0);break;case"][":f=Math.min(p[0],p[1]),d=Math.max(p[0],p[1]),fc&&(n.prefixBoundary=!0)}}}},{}],335:[function(t,e,r){"use strict";var n=t("../../components/colorscale"),a=t("./make_color_map"),i=t("./end_plus");e.exports={min:"zmin",max:"zmax",calc:function(t,e,r){var o=e.contours,l=e.line,s=o.size||1,c=o.coloring,u=a(e,{isColorbar:!0});if("heatmap"===c){var f=n.extractOpts(e);r._fillgradient=f.reversescale?n.flipScale(f.colorscale):f.colorscale,r._zrange=[f.min,f.max]}else"fill"===c&&(r._fillcolor=u);r._line={color:"lines"===c?u:l.color,width:!1!==o.showlines?l.width:0,dash:l.dash},r._levels={start:o.start,end:i(o),size:s}}}},{"../../components/colorscale":87,"./end_plus":343,"./make_color_map":348}],336:[function(t,e,r){"use strict";e.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],337:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./label_defaults"),i=t("../../components/color"),o=i.addOpacity,l=i.opacity,s=t("../../constants/filter_ops"),c=s.CONSTRAINT_REDUCTION,u=s.COMPARISON_OPS2;e.exports=function(t,e,r,i,s,f){var d,p,h,g=e.contours,v=r("contours.operation");(g._operation=c[v],function(t,e){var r;-1===u.indexOf(e.operation)?(t("contours.value",[0,1]),Array.isArray(e.value)?e.value.length>2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:n(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),n(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0))}(r,g),"="===v?d=g.showlines=!0:(d=r("contours.showlines"),h=r("fillcolor",o((t.line||{}).color||s,.5))),d)&&(p=r("line.color",h&&l(h)?o(e.fillcolor,1):s),r("line.width",2),r("line.dash"));r("line.smoothing"),a(r,i,p,f)}},{"../../components/color":75,"../../constants/filter_ops":179,"./label_defaults":347,"fast-isnumeric":23}],338:[function(t,e,r){"use strict";var n=t("../../constants/filter_ops"),a=t("fast-isnumeric");function i(t,e){var r,i=Array.isArray(e);function o(t){return a(t)?+t:null}return-1!==n.COMPARISON_OPS2.indexOf(t)?r=o(i?e[0]:e):-1!==n.INTERVAL_OPS.indexOf(t)?r=i?[o(e[0]),o(e[1])]:[o(e),o(e)]:-1!==n.SET_OPS.indexOf(t)&&(r=i?e.map(o):[o(e)]),r}function o(t){return function(e){e=i(t,e);var r=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return{start:r,end:n,size:n-r}}}function l(t){return function(e){return{start:e=i(t,e),end:1/0,size:1/0}}}e.exports={"[]":o("[]"),"][":o("]["),">":l(">"),"<":l("<"),"=":l("=")}},{"../../constants/filter_ops":179,"fast-isnumeric":23}],339:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=n("contours.start"),i=n("contours.end"),o=!1===a||!1===i,l=r("contours.size");!(o?e.autocontour=!0:r("autocontour",!1))&&l||r("ncontours")}},{}],340:[function(t,e,r){"use strict";var n=t("../../lib");function a(t){return n.extendFlat({},t,{edgepaths:n.extendDeep([],t.edgepaths),paths:n.extendDeep([],t.paths),starts:n.extendDeep([],t.starts)})}e.exports=function(t,e){var r,i,o,l=function(t){return t.reverse()},s=function(t){return t};switch(e){case"=":case"<":return t;case">":for(1!==t.length&&n.warn("Contour data invalid for the specified inequality operation."),i=t[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",t);break}return s}},{"../../lib":202,"./constraint_mapping":338,"./end_plus":343}],343:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],344:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./constants");function i(t,e,r,n){return Math.abs(t[0]-e[0])20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==a.BOTTOMSTART.indexOf(t)?i=1:-1!==a.LEFTSTART.indexOf(t)?n=1:-1!==a.TOPSTART.indexOf(t)?i=-1:n=-1;return[n,i]}(f,r,e),p=[l(t,e,[-d[0],-d[1]])],h=t.z.length,g=t.z[0].length,v=e.slice(),m=d.slice();for(c=0;c<1e4;c++){if(f>20?(f=a.CHOOSESADDLE[f][(d[0]||d[1])<0?0:1],t.crossings[u]=a.SADDLEREMAINDER[f]):delete t.crossings[u],!(d=a.NEWDELTA[f])){n.log("Found bad marching index:",f,e,t.level);break}p.push(l(t,e,d)),e[0]+=d[0],e[1]+=d[1],u=e.join(","),i(p[p.length-1],p[p.length-2],o,s)&&p.pop();var y=d[0]&&(e[0]<0||e[0]>g-2)||d[1]&&(e[1]<0||e[1]>h-2);if(e[0]===v[0]&&e[1]===v[1]&&d[0]===m[0]&&d[1]===m[1]||r&&y)break;f=t.crossings[u]}1e4===c&&n.log("Infinite loop in contour?");var x,b,_,w,T,k,M,A,L,S,C,O,D,z,P,E=i(p[0],p[p.length-1],o,s),I=0,R=.2*t.smoothing,F=[],N=0;for(c=1;c=N;c--)if((x=F[c])=N&&x+F[b]A&&L--,t.edgepaths[L]=C.concat(p,S));break}U||(t.edgepaths[A]=p.concat(S))}for(A=0;At?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);return 5===r||10===r?t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208:15===r?0:r}e.exports=function(t){var e,r,i,o,l,s,c,u,f,d=t[0].z,p=d.length,h=d[0].length,g=2===p||2===h;for(r=0;r=0&&(n=y,l=s):Math.abs(r[1]-n[1])<.01?Math.abs(r[1]-y[1])<.01&&(y[0]-r[0])*(n[0]-y[0])>=0&&(n=y,l=s):a.log("endpt to newendpt is not vert. or horz.",r,n,y)}if(r=n,l>=0)break;f+="L"+n}if(l===t.edgepaths.length){a.log("unclosed perimeter path");break}d=l,(h=-1===p.indexOf(d))&&(d=p[0],f+="Z")}for(d=0;dn.center?n.right-l:l-n.left)/(u+Math.abs(Math.sin(c)*o)),p=(s>n.middle?n.bottom-s:s-n.top)/(Math.abs(f)+Math.cos(c)*o);if(d<1||p<1)return 1/0;var h=m.EDGECOST*(1/(d-1)+1/(p-1));h+=m.ANGLECOST*c*c;for(var g=l-u,v=s-f,y=l+u,x=s+f,b=0;b2*m.MAXCOST)break;p&&(l/=2),s=(o=c-l/2)+1.5*l}if(d<=m.MAXCOST)return u},r.addLabelData=function(t,e,r,n){var a=e.fontSize,i=e.width+a/3,o=Math.max(0,e.height-a/3),l=t.x,s=t.y,c=t.theta,u=Math.sin(c),f=Math.cos(c),d=function(t,e){return[l+t*f-e*u,s+t*u+e*f]},p=[d(-i/2,-o/2),d(-i/2,o/2),d(i/2,o/2),d(i/2,-o/2)];r.push({text:e.text,x:l,y:s,dy:e.dy,theta:c,level:e.level,width:i,height:o}),n.push(p)},r.drawLabels=function(t,e,r,i,o){var s=t.selectAll("text").data(e,(function(t){return t.text+","+t.x+","+t.y+","+t.theta}));if(s.exit().remove(),s.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each((function(t){var e=t.x+Math.sin(t.theta)*t.dy,a=t.y-Math.cos(t.theta)*t.dy;n.select(this).text(t.text).attr({x:e,y:a,transform:"rotate("+180*t.theta/Math.PI+" "+e+" "+a+")"}).call(l.convertToTspans,r)})),o){for(var c="",u=0;ur.end&&(r.start=r.end=(r.start+r.end)/2),t._input.contours||(t._input.contours={}),a.extendFlat(t._input.contours,{start:r.start,end:r.end,size:r.size}),t._input.autocontour=!0}else if("constraint"!==r.type){var c,u=r.start,f=r.end,d=t._input.contours;if(u>f&&(r.start=d.start=f,f=r.end=d.end=u,u=r.start),!(r.size>0))c=u===f?1:i(u,f,t.ncontours).dtick,d.size=r.size=c}}},{"../../lib":202,"../../plots/cartesian/axes":246}],352:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/drawing"),i=t("../heatmap/style"),o=t("./make_color_map");e.exports=function(t){var e=n.select(t).selectAll("g.contour");e.style("opacity",(function(t){return t[0].trace.opacity})),e.each((function(t){var e=n.select(this),r=t[0].trace,i=r.contours,l=r.line,s=i.size||1,c=i.start,u="constraint"===i.type,f=!u&&"lines"===i.coloring,d=!u&&"fill"===i.coloring,p=f||d?o(r):null;e.selectAll("g.contourlevel").each((function(t){n.select(this).selectAll("path").call(a.lineGroupStyle,l.width,f?p(t.level):l.color,l.dash)}));var h=i.labelfont;if(e.selectAll("g.contourlabels text").each((function(t){a.font(n.select(this),{family:h.family,size:h.size,color:h.color||(f?p(t.level):l.color)})})),u)e.selectAll("g.contourfill path").style("fill",r.fillcolor);else if(d){var g;e.selectAll("g.contourfill path").style("fill",(function(t){return void 0===g&&(g=t.level),p(t.level+.5*s)})),void 0===g&&(g=c),e.selectAll("g.contourbg path").style("fill",p(g-.5*s))}})),i(t)}},{"../../components/drawing":97,"../heatmap/style":366,"./make_color_map":348,d3:21}],353:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults"),a=t("./label_defaults");e.exports=function(t,e,r,i,o){var l,s=r("contours.coloring"),c="";"fill"===s&&(l=r("contours.showlines")),!1!==l&&("lines"!==s&&(c=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==s&&(!0!==t.showlegend&&(e.showlegend=!1),e._dfltShowLegend=!1,n(t,e,i,r,{prefix:"",cLetter:"z"})),r("line.smoothing"),a(r,i,c,o)}},{"../../components/colorscale/defaults":85,"./label_defaults":347}],354:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../plots/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../../components/colorscale/attributes"),l=(t("../../constants/docs").FORMAT_LINK,t("../../lib/extend").extendFlat);e.exports=l({z:{valType:"data_array",editType:"calc"},x:l({},n.x,{impliedEdits:{xtype:"array"}}),x0:l({},n.x0,{impliedEdits:{xtype:"scaled"}}),dx:l({},n.dx,{impliedEdits:{xtype:"scaled"}}),y:l({},n.y,{impliedEdits:{ytype:"array"}}),y0:l({},n.y0,{impliedEdits:{ytype:"scaled"}}),dy:l({},n.dy,{impliedEdits:{ytype:"scaled"}}),text:{valType:"data_array",editType:"calc"},hovertext:{valType:"data_array",editType:"calc"},transpose:{valType:"boolean",dflt:!1,editType:"calc"},xtype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},ytype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,editType:"calc"},hoverongaps:{valType:"boolean",dflt:!0,editType:"none"},connectgaps:{valType:"boolean",editType:"calc"},xgap:{valType:"number",dflt:0,min:0,editType:"plot"},ygap:{valType:"number",dflt:0,min:0,editType:"plot"},zhoverformat:{valType:"string",dflt:"",editType:"none"},hovertemplate:i(),showlegend:l({},a.showlegend,{dflt:!1})},{transforms:void 0},o("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":82,"../../constants/docs":178,"../../lib/extend":196,"../../plots/attributes":243,"../../plots/template_attributes":288,"../scatter/attributes":413}],355:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../histogram2d/calc"),l=t("../../components/colorscale/calc"),s=t("./convert_column_xyz"),c=t("./clean_2d_array"),u=t("./interp2d"),f=t("./find_empties"),d=t("./make_bound_array"),p=t("../../constants/numerical").BADNUM;function h(t){for(var e=[],r=t.length,n=0;nz){O("x scale is not linear");break}}if(m.length&&"fast"===S){var P=(m[m.length-1]-m[0])/(m.length-1),E=Math.abs(P/100);for(_=0;_E){O("y scale is not linear");break}}}var I=a.maxRowLength(b),R="scaled"===e.xtype?"":r,F=d(e,R,g,v,I,T),N="scaled"===e.ytype?"":m,B=d(e,N,y,x,b.length,k);L||(e._extremes[T._id]=i.findExtremes(T,F),e._extremes[k._id]=i.findExtremes(k,B));var H={x:F,y:B,z:b,text:e._text||e.text,hovertext:e._hovertext||e.hovertext};if(R&&R.length===F.length-1&&(H.xCenter=R),N&&N.length===B.length-1&&(H.yCenter=N),A&&(H.xRanges=w.xRanges,H.yRanges=w.yRanges,H.pts=w.pts),M||l(t,e,{vals:b,cLetter:"z"}),M&&e.contours&&"heatmap"===e.contours.coloring){var j={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};H.xfill=d(j,R,g,v,I,T),H.yfill=d(j,N,y,x,b.length,k)}return[H]}},{"../../components/colorscale/calc":83,"../../constants/numerical":181,"../../lib":202,"../../plots/cartesian/axes":246,"../../registry":293,"../histogram2d/calc":383,"./clean_2d_array":356,"./convert_column_xyz":358,"./find_empties":360,"./interp2d":363,"./make_bound_array":364}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r,o){var l,s,c,u,f,d;function p(t){if(n(t))return+t}if(e&&e.transpose){for(l=0,f=0;f=0;o--)(l=((f[[(r=(i=d[o])[0])-1,a=i[1]]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(s[i]=[r,a,l],d.splice(o,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(i in s)f[i]=s[i],u.push(s[i])}return u.sort((function(t,e){return e[2]-t[2]}))}},{"../../lib":202}],361:[function(t,e,r){"use strict";var n=t("../../components/fx"),a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../../components/colorscale").extractOpts;e.exports=function(t,e,r,l,s,c){var u,f,d,p,h=t.cd[0],g=h.trace,v=t.xa,m=t.ya,y=h.x,x=h.y,b=h.z,_=h.xCenter,w=h.yCenter,T=h.zmask,k=g.zhoverformat,M=y,A=x;if(!1!==t.index){try{d=Math.round(t.index[1]),p=Math.round(t.index[0])}catch(e){return void a.error("Error hovering on heatmap, pointNumber must be [row,col], found:",t.index)}if(d<0||d>=b[0].length||p<0||p>b.length)return}else{if(n.inbox(e-y[0],e-y[y.length-1],0)>0||n.inbox(r-x[0],r-x[x.length-1],0)>0)return;if(c){var L;for(M=[2*y[0]-y[1]],L=1;Lg&&(m=Math.max(m,Math.abs(t[i][o]-h)/(v-g))))}return m}e.exports=function(t,e){var r,a=1;for(o(t,e),r=0;r.01;r++)a=o(t,e,i(a));return a>.01&&n.log("interp2d didn't converge quickly",a),t}},{"../../lib":202}],364:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib").isArrayOrTypedArray;e.exports=function(t,e,r,i,o,l){var s,c,u,f=[],d=n.traceIs(t,"contour"),p=n.traceIs(t,"histogram"),h=n.traceIs(t,"gl2d");if(a(e)&&e.length>1&&!p&&"category"!==l.type){var g=e.length;if(!(g<=o))return d?e.slice(0,o):e.slice(0,o+1);if(d||h)f=e.slice(0,o);else if(1===o)f=[e[0]-.5,e[0]+.5];else{for(f=[1.5*e[0]-.5*e[1]],u=1;u0;)d=p.c2p(T[y]),y--;for(d0;)m=h.c2p(k[y]),y--;if(m0&&(i=!0);for(var s=0;si){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]c?t>o?t>1.1*a?a:t>1.1*i?i:o:t>l?l:t>s?s:c:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function p(t,e,r,n,i,l){if(n&&t>o){var s=h(e,i,l),c=h(r,i,l),u=t===a?0:1;return s[u]!==c[u]}return Math.floor(r/t)-Math.floor(e/t)>.1}function h(t,e,r){var n=e.c2d(t,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}e.exports=function(t,e,r,n,i){var l,s,c=-1.1*e,d=-.1*e,p=t-d,h=r[0],g=r[1],v=Math.min(f(h+d,h+p,n,i),f(g+d,g+p,n,i)),m=Math.min(f(h+c,h+d,n,i),f(g+c,g+d,n,i));if(v>m&&mo){var y=l===a?1:6,x=l===a?"M12":"M1";return function(e,r){var o=n.c2d(e,a,i),l=o.indexOf("-",y);l>0&&(o=o.substr(0,l));var c=n.d2c(o,0,i);if(cr.r2l(N)&&(H=o.tickIncrement(H,b.size,!0,p)),E.start=r.l2r(H),F||a.nestedProperty(e,m+".start").set(E.start)}var j=b.end,U=r.r2l(P.end),V=void 0!==U;if((b.endFound||V)&&U!==r.r2l(j)){var q=V?U:a.aggNums(Math.max,null,h);E.end=r.l2r(q),V||a.nestedProperty(e,m+".start").set(E.end)}var G="autobin"+l;return!1===e._input[G]&&(e._input[m]=a.extendFlat({},e[m]||{}),delete e._input[G],delete e[G]),[E,h]}e.exports={calc:function(t,e){var r,i,p,h,g=[],v=[],m=o.getFromId(t,"h"===e.orientation?e.yaxis:e.xaxis),y="h"===e.orientation?"y":"x",x={x:"y",y:"x"}[y],b=e[y+"calendar"],_=e.cumulative,w=d(t,e,m,y),T=w[0],k=w[1],M="string"==typeof T.size,A=[],L=M?A:T,S=[],C=[],O=[],D=0,z=e.histnorm,P=e.histfunc,E=-1!==z.indexOf("density");_.enabled&&E&&(z=z.replace(/ ?density$/,""),E=!1);var I,R="max"===P||"min"===P?null:0,F=s.count,N=c[z],B=!1,H=function(t){return m.r2c(t,0,b)};for(a.isArrayOrTypedArray(e[x])&&"count"!==P&&(I=e[x],B="avg"===P,F=s[P]),r=H(T.start),p=H(T.end)+(r-o.tickIncrement(r,T.size,!1,b))/1e6;r=0&&h=0;n--)l(n);else if("increasing"===e){for(n=1;n=0;n--)t[n]+=t[n+1];"exclude"===r&&(t.push(0),t.shift())}}(v,_.direction,_.currentbin);var Q=Math.min(g.length,v.length),J=[],$=0,K=Q-1;for(r=0;r=$;r--)if(v[r]){K=r;break}for(r=$;r<=K;r++)if(n(g[r])&&n(v[r])){var tt={p:g[r],s:v[r],b:0};_.enabled||(tt.pts=O[r],G?tt.ph0=tt.ph1=O[r].length?k[O[r][0]]:g[r]:(e._computePh=!0,tt.ph0=V(A[r]),tt.ph1=V(A[r+1],!0))),J.push(tt)}return 1===J.length&&(J[0].width1=o.tickIncrement(J[0].p,T.size,!1,b)-J[0].p),l(J,e),a.isArrayOrTypedArray(e.selectedpoints)&&a.tagSelected(J,e,X),J},calcAllAutoBins:d}},{"../../lib":202,"../../plots/cartesian/axes":246,"../../registry":293,"../bar/arrays_to_calcdata":302,"./average":370,"./bin_functions":372,"./bin_label_vals":373,"./norm_functions":381,"fast-isnumeric":23}],375:[function(t,e,r){"use strict";e.exports={eventDataKeys:["binNumber"]}},{}],376:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axis_ids"),i=t("../../registry").traceIs,o=t("../bar/defaults").handleGroupingDefaults,l=n.nestedProperty,s=a.getAxisGroup,c=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],u=["x","y"];e.exports=function(t,e){var r,f,d,p,h,g,v,m=e._histogramBinOpts={},y=[],x={},b=[];function _(t,e){return n.coerce(r._input,r,r._module.attributes,t,e)}function w(t){return"v"===t.orientation?"x":"y"}function T(t,r,i){var o=t.uid+"__"+i;r||(r=o);var l=function(t,r){return a.getFromTrace({_fullLayout:e},t,r).type}(t,i),s=t[i+"calendar"]||"",c=m[r],u=!0;c&&(l===c.axType&&s===c.calendar?(u=!1,c.traces.push(t),c.dirs.push(i)):(r=o,l!==c.axType&&n.warn(["Attempted to group the bins of trace",t.index,"set on a","type:"+l,"axis","with bins on","type:"+c.axType,"axis."].join(" ")),s!==c.calendar&&n.warn(["Attempted to group the bins of trace",t.index,"set with a",s,"calendar","with bins",c.calendar?"on a "+c.calendar+" calendar":"w/o a set calendar"].join(" ")))),u&&(m[r]={traces:[t],dirs:[i],axType:l,calendar:t[i+"calendar"]||""}),t["_"+i+"bingroup"]=r}for(h=0;hL&&T.splice(L,T.length-L),A.length>L&&A.splice(L,A.length-L);var S=[],C=[],O=[],D="string"==typeof w.size,z="string"==typeof M.size,P=[],E=[],I=D?P:w,R=z?E:M,F=0,N=[],B=[],H=e.histnorm,j=e.histfunc,U=-1!==H.indexOf("density"),V="max"===j||"min"===j?null:0,q=i.count,G=o[H],Z=!1,Y=[],X=[],W="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";W&&"count"!==j&&(Z="avg"===j,q=i[j]);var Q=w.size,J=x(w.start),$=x(w.end)+(J-a.tickIncrement(J,Q,!1,m))/1e6;for(r=J;r<$;r=a.tickIncrement(r,Q,!1,m))C.push(V),P.push(r),Z&&O.push(0);P.push(r);var K,tt=C.length,et=(r-J)/tt,rt=(K=J+et/2,g.c2r(K,0,m)),nt=M.size,at=b(M.start),it=b(M.end)+(at-a.tickIncrement(at,nt,!1,y))/1e6;for(r=at;r=0&&p=0&&h0||n.inbox(r-o.y0,r-(o.y0+o.h*l.dy),0)>0)){var u,f=Math.floor((e-o.x0)/l.dx),d=Math.floor(Math.abs(r-o.y0)/l.dy);if(l._hasZ?u=o.z[d][f]:l._hasSource&&(u=l._canvas.el.getContext("2d").getImageData(f,d,1,1).data),u){var p,h=o.hi||l.hoverinfo;if(h){var g=h.split("+");-1!==g.indexOf("all")&&(g=["color"]),-1!==g.indexOf("color")&&(p=!0)}var v,m=i.colormodel[l.colormodel],y=m.colormodel||l.colormodel,x=y.length,b=l._scaler(u),_=m.suffix,w=[];(l.hovertemplate||p)&&(w.push("["+[b[0]+_[0],b[1]+_[1],b[2]+_[2]].join(", ")),4===x&&w.push(", "+b[3]+_[3]),w.push("]"),w=w.join(""),t.extraText=y.toUpperCase()+": "+w),Array.isArray(l.hovertext)&&Array.isArray(l.hovertext[d])?v=l.hovertext[d][f]:Array.isArray(l.text)&&Array.isArray(l.text[d])&&(v=l.text[d][f]);var T=c.c2p(o.y0+(d+.5)*l.dy),k=o.x0+(f+.5)*l.dx,M=o.y0+(d+.5)*l.dy,A="["+u.slice(0,l.colormodel.length).join(", ")+"]";return[a.extendFlat(t,{index:[d,f],x0:s.c2p(o.x0+f*l.dx),x1:s.c2p(o.x0+(f+1)*l.dx),y0:T,y1:T,color:b,xVal:k,xLabelVal:k,yVal:M,yLabelVal:M,zLabelVal:A,text:v,hovertemplateLabels:{zLabel:A,colorLabel:w,"color[0]Label":b[0]+_[0],"color[1]Label":b[1]+_[1],"color[2]Label":b[2]+_[2],"color[3]Label":b[3]+_[3]}})]}}}},{"../../components/fx":115,"../../lib":202,"./constants":393}],397:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover"),eventData:t("./event_data"),moduleType:"trace",name:"image",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","2dMap","noSortingByValue"],animatable:!1,meta:{}}},{"../../plots/cartesian":259,"./attributes":391,"./calc":392,"./defaults":394,"./event_data":395,"./hover":396,"./plot":398,"./style":399}],398:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../constants/xmlns_namespaces"),o=t("./constants"),l=a.isIOS()||a.isSafari()||a.isIE();function s(t){return"linear"===t.type&&t.range[1]>t.range[0]==("x"===t._id.charAt(0))}e.exports=function(t,e,r,c){var u=e.xaxis,f=e.yaxis,d=!(l||t._context._exportedPlot);a.makeTraceGroups(c,r,"im").each((function(e){var r=n.select(this),l=e[0],c=l.trace,p=d&&!c._hasZ&&c._hasSource&&s(u)&&s(f);c._fastImage=p;var h,g,v,m,y,x,b=l.z,_=l.x0,w=l.y0,T=l.w,k=l.h,M=c.dx,A=c.dy;for(x=0;void 0===h&&x0;)g=u.c2p(_+x*M),x--;for(x=0;void 0===m&&x0;)y=f.c2p(w+x*A),x--;if(g0){l=!0;break}}l||(o=0)}return{hasLabels:r,hasValues:i,len:o}}e.exports={handleLabelsAndValues:s,supplyDefaults:function(t,e,r,n){function c(r,n){return a.coerce(t,e,i,r,n)}var u=s(c("labels"),c("values")),f=u.len;if(e._hasLabels=u.hasLabels,e._hasValues=u.hasValues,!e._hasLabels&&e._hasValues&&(c("label0"),c("dlabel")),f){e._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var d,p=c("text"),h=c("texttemplate");if(h||(d=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),h||d&&"none"!==d){var g=c("textposition");l(t,e,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(e,n,c);var v=c("hole");if(c("title.text")){var m=c("title.position",v?"middle center":"top center");v||"middle center"!==m||(e.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else e.visible=!1}}},{"../../lib":202,"../../plots/domain":273,"../bar/defaults":307,"./attributes":400,"fast-isnumeric":23}],404:[function(t,e,r){"use strict";var n=t("../../components/fx/helpers").appendArrayMultiPointValues;e.exports=function(t,e){var r={curveNumber:e.index,pointNumbers:t.pts,data:e._input,fullData:e,label:t.label,color:t.color,value:t.v,percent:t.percent,text:t.text,v:t.v};return 1===t.pts.length&&(r.pointNumber=r.i=t.pts[0]),n(r,e,t.pts),"funnelarea"===e.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":111}],405:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:t.pxmid[0]<0?"left":"right",color:h.castOption(b.bgcolor,t.pts)||t.color,borderColor:h.castOption(b.bordercolor,t.pts),fontFamily:h.castOption(_.family,t.pts),fontSize:h.castOption(_.size,t.pts),fontColor:h.castOption(_.color,t.pts),nameLength:h.castOption(b.namelength,t.pts),textAlign:h.castOption(b.align,t.pts),hovertemplate:h.castOption(u.hovertemplate,t.pts),hovertemplateLabels:t,eventData:[g(t,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:e}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,e.emit("plotly_hover",{points:[g(t,u)],event:n.event})}})),t.on("mouseout",(function(t){var r=e._fullLayout,a=e._fullData[o.index],l=n.select(this).datum();o._hasHoverEvent&&(t.originalEvent=n.event,e.emit("plotly_unhover",{points:[g(l,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),t.on("click",(function(t){var r=e._fullLayout,a=e._fullData[o.index];e._dragging||!1===r.hovermode||(e._hoverdata=[g(t,a)],i.click(e,n.event))}))}function y(t,e,r){var n=h.castOption(t.insidetextfont.color,e.pts);!n&&t._input.textfont&&(n=h.castOption(t._input.textfont.color,e.pts));var a=h.castOption(t.insidetextfont.family,e.pts)||h.castOption(t.textfont.family,e.pts)||r.family,i=h.castOption(t.insidetextfont.size,e.pts)||h.castOption(t.textfont.size,e.pts)||r.size;return{color:n||o.contrast(e.color),family:a,size:i}}function x(t,e){for(var r,n,a=0;ae&&e>n||r=-4;v-=2)m(Math.PI*v,"tan");for(v=4;v>=-4;v-=2)m(Math.PI*(v+1),"tan")}if(f||p){for(v=4;v>=-4;v-=2)m(Math.PI*(v+1.5),"rad");for(v=4;v>=-4;v-=2)m(Math.PI*(v+.5),"rad")}}if(l||h||f){var y=Math.sqrt(t.width*t.width+t.height*t.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(e.startangle+e.stopangle)/2,i.scale>=1)return i;g.push(i)}(h||p)&&((i=_(t,n,o,s,c)).textPosAngle=(e.startangle+e.stopangle)/2,g.push(i)),(h||d)&&((i=w(t,n,o,s,c)).textPosAngle=(e.startangle+e.stopangle)/2,g.push(i));for(var x=0,b=0,T=0;T=1)break}return g[x]}function _(t,e,r,n,a){e=Math.max(0,e-2*p);var i=t.width/t.height,o=M(i,n,e,r);return{scale:2*o/t.height,rCenter:T(i,o/e),rotate:k(a)}}function w(t,e,r,n,a){e=Math.max(0,e-2*p);var i=t.height/t.width,o=M(i,n,e,r);return{scale:2*o/t.width,rCenter:T(i,o/e),rotate:k(a+Math.PI/2)}}function T(t,e){return Math.cos(e)-t*e}function k(t){return(180/Math.PI*t+720)%180-90}function M(t,e,r,n){var a=t+1/(2*Math.tan(e));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(t*t+n/2)+t))}function A(t,e){return t.v!==e.vTotal||e.trace.hole?Math.min(1/(1+1/Math.sin(t.halfangle)),t.ring/2):1}function L(t,e){var r=e.pxmid[0],n=e.pxmid[1],a=t.width/2,i=t.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function S(t,e){var r,n,a,i=t.trace,o={x:t.cx,y:t.cy},l={tx:0,ty:0};l.ty+=i.title.font.size,a=O(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*t.r,l.ty-=t.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*t.r);var s,c,u=(s=t.r,c=t.trace.aspectratio,s/(void 0===c?1:c)),f=e.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(f+=u,o.x-=(1+a)*u,l.tx+=t.titleBox.width/2):-1!==i.title.position.indexOf("center")?f*=2:-1!==i.title.position.indexOf("right")&&(f+=u,o.x+=(1+a)*u,l.tx-=t.titleBox.width/2),r=f/t.titleBox.width,n=C(t,e)/t.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:l.tx,ty:l.ty}}function C(t,e){var r=t.trace,n=e.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(t.titleBox.height,n/2)}function O(t){var e,r=t.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,e=0;er&&(r=t.pull[e]);return r}function D(t,e){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,s=c*u}o=Math.min(o,s/r.vTotal)}for(n=0;n")}if(i){var x=s.castOption(a,e.i,"texttemplate");if(x){var b=function(t){return{label:t.label,value:t.v,valueLabel:h.formatPieValue(t.v,n.separators),percent:t.v/r.vTotal,percentLabel:h.formatPiePercent(t.v/r.vTotal,n.separators),color:t.color,text:t.text,customdata:s.castOption(a,t.i,"customdata")}}(e),_=h.getFirstFilled(a.text,e.pts);(v(_)||""===_)&&(b.text=_),e.text=s.texttemplateString(x,b,t._fullLayout._d3locale,b,a._meta||{})}else e.text=""}}function E(t,e){var r=t.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(e.left+e.right)/2,o=(e.top+e.bottom)/2;t.textX=i*n-o*a,t.textY=i*a+o*n,t.noCenter=!0}e.exports={plot:function(t,e){var r=t._fullLayout,i=r._size;d("pie",r),x(e,t),D(e,i);var u=s.makeTraceGroups(r._pielayer,e,"trace").each((function(e){var u=n.select(this),d=e[0],p=d.trace;!function(t){var e,r,n,a=t[0],i=a.r,o=a.trace,l=o.rotation*Math.PI/180,s=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(e=0;ea.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=A(r,a))}(e),u.attr("stroke-linejoin","round"),u.each((function(){var g=n.select(this).selectAll("g.slice").data(e);g.enter().append("g").classed("slice",!0),g.exit().remove();var v=[[[],[]],[[],[]]],x=!1;g.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=p.index,v[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=d.cx,u=d.cy,g=n.select(this),_=g.selectAll("path.surface").data([a]);if(_.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),g.call(m,t,e),p.pull){var w=+h.castOption(p.pull,a.pts)||0;w>0&&(o+=w*a.pxmid[0],u+=w*a.pxmid[1])}a.cxFinal=o,a.cyFinal=u;var T=p.hole;if(a.v===d.vTotal){var k="M"+(o+a.px0[0])+","+(u+a.px0[1])+O(a.px0,a.pxmid,!0,1)+O(a.pxmid,a.px0,!0,1)+"Z";T?_.attr("d","M"+(o+T*a.px0[0])+","+(u+T*a.px0[1])+O(a.px0,a.pxmid,!1,T)+O(a.pxmid,a.px0,!1,T)+"Z"+k):_.attr("d",k)}else{var M=O(a.px0,a.px1,!0,1);if(T){var A=1-T;_.attr("d","M"+(o+T*a.px1[0])+","+(u+T*a.px1[1])+O(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else _.attr("d","M"+o+","+u+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}P(t,a,d);var S=h.castOption(p.textposition,a.pts),C=g.selectAll("g.slicetext").data(a.text&&"none"!==S?[0]:[]);C.enter().append("g").classed("slicetext",!0),C.exit().remove(),C.each((function(){var g=s.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),v=s.ensureUniformFontSize(t,"outside"===S?function(t,e,r){var n=h.castOption(t.outsidetextfont.color,e.pts)||h.castOption(t.textfont.color,e.pts)||r.color,a=h.castOption(t.outsidetextfont.family,e.pts)||h.castOption(t.textfont.family,e.pts)||r.family,i=h.castOption(t.outsidetextfont.size,e.pts)||h.castOption(t.textfont.size,e.pts)||r.size;return{color:n,family:a,size:i}}(p,a,r.font):y(p,a,r.font));g.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,v).call(c.convertToTspans,t);var m,_=l.bBox(g.node());if("outside"===S)m=L(_,a);else if(m=b(_,a,d),"auto"===S&&m.scale<1){var w=s.ensureUniformFontSize(t,p.outsidetextfont);g.call(l.font,w),m=L(_=l.bBox(g.node()),a)}var T=m.textPosAngle,k=void 0===T?a.pxmid:z(d.r,T);if(m.targetX=o+k[0]*m.rCenter+(m.x||0),m.targetY=u+k[1]*m.rCenter+(m.y||0),E(m,_),m.outside){var M=m.targetY;a.yLabelMin=M-_.height/2,a.yLabelMid=M,a.yLabelMax=M+_.height/2,a.labelExtraX=0,a.labelExtraY=0,x=!0}m.fontSize=v.size,f(p.type,m,r),e[i].transform=m,g.attr("transform",s.getTextTransform(m))}))}function O(t,e,r,n){var i=n*(e[0]-t[0]),o=n*(e[1]-t[1]);return"a"+n*d.r+","+n*d.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var _=n.select(this).selectAll("g.titletext").data(p.title.text?[0]:[]);if(_.enter().append("g").classed("titletext",!0),_.exit().remove(),_.each((function(){var e,r=s.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),a=p.title.text;p._meta&&(a=s.templateString(a,p._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(l.font,p.title.font).call(c.convertToTspans,t),e="middle center"===p.title.position?function(t){var e=Math.sqrt(t.titleBox.width*t.titleBox.width+t.titleBox.height*t.titleBox.height);return{x:t.cx,y:t.cy,scale:t.trace.hole*t.r*2/e,tx:0,ty:-t.titleBox.height/2+t.trace.title.font.size}}(d):S(d,i),r.attr("transform","translate("+e.x+","+e.y+")"+(e.scale<1?"scale("+e.scale+")":"")+"translate("+e.tx+","+e.ty+")")})),x&&function(t,e){var r,n,a,i,o,l,s,c,u,f,d,p,g;function v(t,e){return t.pxmid[1]-e.pxmid[1]}function m(t,e){return e.pxmid[1]-t.pxmid[1]}function y(t,r){r||(r={});var a,c,u,d,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),g=n?t.yLabelMin:t.yLabelMax,v=n?t.yLabelMax:t.yLabelMin,m=t.cyFinal+o(t.px0[1],t.px1[1]),y=p-g;if(y*s>0&&(t.labelExtraY=y),Array.isArray(e.pull))for(c=0;c=(h.castOption(e.pull,u.pts)||0)||((t.pxmid[1]-u.pxmid[1])*s>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-g-t.labelExtraY)*s>0&&(t.labelExtraY+=y):(v+t.labelExtraY-m)*s>0&&(a=3*l*Math.abs(c-f.indexOf(t)),(d=u.cxFinal+i(u.px0[0],u.px1[0])+a-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*l>0&&(t.labelExtraX+=d)))}for(n=0;n<2;n++)for(a=n?v:m,o=n?Math.max:Math.min,s=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,l=r?1:-1,(c=t[n][r]).sort(a),u=t[1-n][r],f=u.concat(c),p=[],d=0;dMath.abs(f)?l+="l"+f*t.pxmid[0]/t.pxmid[1]+","+f+"H"+(i+t.labelExtraX+c):l+="l"+t.labelExtraX+","+u+"v"+(f-u)+"h"+c}else l+="V"+(t.yLabelMid+t.labelExtraY)+"h"+c;s.ensureSingle(r,"path","textline").call(o.stroke,e.outsidetextfont.color).attr({"stroke-width":Math.min(2,e.outsidetextfont.size/8),d:l,fill:"none"})}else r.select("path.textline").remove()}))}(g,p),x&&p.automargin){var w=l.bBox(u.node()),T=p.domain,k=i.w*(T.x[1]-T.x[0]),M=i.h*(T.y[1]-T.y[0]),A=(.5*k-d.r)/i.w,C=(.5*M-d.r)/i.h;a.autoMargin(t,"pie."+p.uid+".automargin",{xl:T.x[0]-A,xr:T.x[1]+A,yb:T.y[0]-C,yt:T.y[1]+C,l:Math.max(d.cx-d.r-w.left,0),r:Math.max(w.right-(d.cx+d.r),0),b:Math.max(w.bottom-(d.cy+d.r),0),t:Math.max(d.cy-d.r-w.top,0),pad:5})}}))}));setTimeout((function(){u.selectAll("tspan").each((function(){var t=n.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))}))}),0)},formatSliceLabel:P,transformInsideText:b,determineInsideTextFont:y,positionTitleOutside:S,prerenderTitles:x,layoutAreas:D,attachFxHandlers:m,computeTransform:E}},{"../../components/color":75,"../../components/drawing":97,"../../components/fx":115,"../../lib":202,"../../lib/svg_text_utils":223,"../../plots/plots":280,"../bar/constants":305,"../bar/uniform_text":319,"./event_data":404,"./helpers":405,d3:21}],410:[function(t,e,r){"use strict";var n=t("d3"),a=t("./style_one"),i=t("../bar/uniform_text").resizeText;e.exports=function(t){var e=t._fullLayout._pielayer.selectAll(".trace");i(t,e,"pie"),e.each((function(t){var e=t[0].trace,r=n.select(this);r.style({opacity:e.opacity}),r.selectAll("path.surface").each((function(t){n.select(this).call(a,t,e)}))}))}},{"../bar/uniform_text":319,"./style_one":411,d3:21}],411:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("./helpers").castOption;e.exports=function(t,e,r){var i=r.marker.line,o=a(i.color,e.pts)||n.defaultLine,l=a(i.width,e.pts)||0;t.style("stroke-width",l).call(n.fill,e.color).call(n.stroke,o)}},{"../../components/color":75,"./helpers":405}],412:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rl&&M[v].gap;)v--;for(y=M[v].s,h=M.length-1;h>v;h--)M[h].s=y;for(;lA[u]&&u=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],420:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("./attributes"),o=t("./constants"),l=t("./subtypes"),s=t("./xy_defaults"),c=t("./stack_defaults"),u=t("./marker_defaults"),f=t("./line_defaults"),d=t("./line_shape_defaults"),p=t("./text_defaults"),h=t("./fillcolor_defaults");e.exports=function(t,e,r,g){function v(r,a){return n.coerce(t,e,i,r,a)}var m=s(t,e,g,v);if(m||(e.visible=!1),e.visible){var y=c(t,e,g,v),x=!y&&mG!=(F=z[O][1])>=G&&(E=z[O-1][0],I=z[O][0],F-R&&(P=E+(I-E)*(G-R)/(F-R),j=Math.min(j,P),U=Math.max(U,P)));j=Math.max(j,0),U=Math.min(U,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:j,x1:U,y0:G,y1:G,color:Z,hovertemplate:!1}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":75,"../../components/fx":115,"../../lib":202,"../../registry":293,"./get_trace_color":423}],425:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":259,"./arrays_to_calcdata":412,"./attributes":413,"./calc":414,"./cross_trace_calc":418,"./cross_trace_defaults":419,"./defaults":420,"./format_labels":422,"./hover":424,"./marker_colorbar":431,"./plot":433,"./select":434,"./style":436,"./subtypes":437}],426:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,l,s){var c=(t.marker||{}).color;(l("line.color",r),a(t,"line"))?i(t,e,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":85,"../../components/colorscale/helpers":86,"../../lib":202}],427:[function(t,e,r){"use strict";var n=t("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=t("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=t("./constants");e.exports=function(t,e){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,T,k,M,A,L=e.xaxis,S=e.yaxis,C="log"===L.type,O="log"===S.type,D=L._length,z=S._length,P=e.connectGaps,E=e.baseTolerance,I=e.shape,R="linear"===I,F=e.fill&&"none"!==e.fill,N=[],B=f.minTolerance,H=t.length,j=new Array(H),U=0;function V(r){var n=t[r];if(!n)return!1;var i=e.linearized?L.l2p(n.x):L.c2p(n.x),s=e.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;O&&s===a&&(i*=Math.abs(L._m*z*(L._m>0?o:l)/(S._m*D*(S._m>0?o:l)))),i*=1e3}if(s===a){if(O&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function q(t,e,r,n){var a=r-t,i=n-e,o=.5-t,l=.5-e,s=a*a+i*i,c=a*o+i*l;if(c>0&&crt||t[1]at)return[u(t[0],et,rt),u(t[1],nt,at)]}function lt(t,e){return t[0]===e[0]&&(t[0]===et||t[0]===rt)||(t[1]===e[1]&&(t[1]===nt||t[1]===at)||void 0)}function st(t,e,r){return function(n,a){var i=ot(n),o=ot(a),l=[];if(i&&o&<(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[t]+a[t])/2,e,r)-((i||n)[t]+(o||a)[t]);c&&((i&&o?c>0==i[t]>o[t]?i:o:i||o)[t]+=c);return l}}function ct(t){var e=t[0],r=t[1],n=e===j[U-1][0],a=r===j[U-1][1];if(!n||!a)if(U>1){var i=e===j[U-2][0],o=r===j[U-2][1];n&&(e===et||e===rt)&&i?o?U--:j[U-1]=t:a&&(r===nt||r===at)&&o?i?U--:j[U-1]=t:j[U++]=t}else j[U++]=t}function ut(t){j[U-1][0]!==t[0]&&j[U-1][1]!==t[1]&&ct([W,Q]),ct(t),J=null,W=Q=0}function ft(t){if(M=t[0]/D,A=t[1]/z,Y=t[0]rt?rt:0,X=t[1]at?at:0,Y||X){if(U)if(J){var e=K(J,t);e.length>1&&(ut(e[0]),j[U++]=e[1])}else $=K(j[U-1],t)[0],j[U++]=$;else j[U++]=[Y||t[0],X||t[1]];var r=j[U-1];Y&&X&&(r[0]!==Y||r[1]!==X)?(J&&(W!==Y&&Q!==X?ct(W&&Q?(n=J,i=(a=t)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?et:rt,at]:[o>0?rt:et,nt]):[W||Y,Q||X]):W&&Q&&ct([W,Q])),ct([Y,X])):W-Y&&Q-X&&ct([Y||W,X||Q]),J=t,W=Y,Q=X}else J&&ut(K(J,t)[0]),j[U++]=t;var n,a,i,o}for("linear"===I||"spline"===I?K=function(t,e){for(var r=[],n=0,a=0;a<4;a++){var i=it[a],o=c(t[0],t[1],e[0],e[1],i[0],i[1],i[2],i[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&&Z(o,t)G(h,dt))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=t.length||!h)break;ft(h),n=h}}else ft(d)}J&&ct([W||J[0],Q||J[1]]),N.push(j.slice(0,U))}return N}},{"../../constants/numerical":181,"../../lib":202,"./constants":417}],428:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],429:[function(t,e,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};e.exports=function(t,e,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(e,a):0}}},{"fast-isnumeric":23}],431:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],432:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,l,s,c){var u=o.isBubble(t),f=(t.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&i(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&e.marker.color!==f?f:u?n.background:n.defaultLine),a(t,"marker.line")&&i(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":75,"../../components/colorscale/defaults":85,"../../components/colorscale/helpers":86,"./subtypes":437}],433:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../registry"),i=t("../../lib"),o=i.ensureSingle,l=i.identity,s=t("../../components/drawing"),c=t("./subtypes"),u=t("./line_points"),f=t("./link_traces"),d=t("../../lib/polygon").tester;function p(t,e,r,f,p,h,g){var v;!function(t,e,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(t){return m?t.transition():t}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(h),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),L=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(t,k,r,g),!0===_.visible){var S,C;y(T).style("opacity",_.opacity);var O=_.fill.charAt(_.fill.length-1);"x"!==O&&"y"!==O&&(O=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var D,z,P="",E=[],I=_._prevtrace;I&&(P=I._prevRevpath||"",C=I._nextFill,E=I._polygons);var R,F,N,B,H,j,U,V="",q="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(R=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):R=F="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]?s.smoothclosed(t.slice(1),w.smoothing):s.smoothopen(t,w.smoothing)}:function(t){return"M"+t.join("L")},N=function(t){return F(t.reverse())},G=u(f,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),U=_._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",D).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",D),s.singleLineStyle(f,a)}}}}}var Y=M.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(Z(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(Y,r.layerClipId,t),G.length?(S?(S.datum(f),B&&j&&(O?("y"===O?B[1]=j[1]=b.c2p(0,!0):"x"===O&&(B[0]=j[0]=x.c2p(0,!0)),y(S).attr("d","M"+j+"L"+B+"L"+V.substr(1)).call(s.singleFillStyle)):y(S).attr("d",V+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&V&&P?("tonext"===_.fill?y(C).attr("d",V+"Z"+P+"Z").call(s.singleFillStyle):y(C).attr("d",V+"L"+P.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(E)):(W(C),_._polygons=null)),_._prevRevpath=q,_._prevPolygons=U):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(e,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=tt(u),h=et,g=et;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===t._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?J:Q:_&&!w&&(v=$),f&&(h=v),d&&(g=v)}var T,k=(o=e.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&k.call(s.pointStyle,u,t).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=s.makePointStyleFns(u)),o.each((function(e){var a=n.select(this),i=y(a);s.translatePoint(e,i,x,b)?(s.singlePointStyle(e,i,u,T,t),r.layerClipId&&s.hideOutsideRangePoint(e,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(t){var e=n.select(this),a=y(e.select("text"));s.translatePoint(t,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(t,e,x,b,u.xcalendar,u.ycalendar):e.remove()})),o.selectAll("text").call(s.textPointStyle,u,t).each((function(t){var e=x.c2p(t.x),r=b.c2p(t.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:e,y:r})}))})),o.exit().remove()}(A,L,f);var X=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,X,t),s.setClipUrl(L,X,t)}function W(t){y(t).attr("d","M0,0Z")}function Q(t){return t.filter((function(t){return!t.gap&&t.vis}))}function J(t){return t.filter((function(t){return t.vis}))}function $(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,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(t,e,r);((u=a.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),u.order(),function(t,e,r){e.each((function(e){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,t);var i=e[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(t){i[t]=null})).remove(),u.order().each((function(t){i[t]=o(n.select(this),"path","js-fill")}))}))}(t,u,e),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(t,n,e,r,v,this,i)}))}))):u.each((function(r,n){p(t,n,e,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":97,"../../lib":202,"../../lib/polygon":214,"../../registry":293,"./line_points":427,"./link_traces":429,"./subtypes":437,d3:21}],434:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,i,o,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===e)for(r=0;r"),o.hovertemplate=d.hovertemplate,i}function x(t,e){m.push(t._hovertitle+": "+e)}}},{"../scatter/hover":424}],446:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../scatter/select"),eventData:t("./event_data"),moduleType:"trace",name:"scatterternary",basePlotModule:t("../../plots/ternary"),categories:["ternary","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/ternary":289,"../scatter/marker_colorbar":431,"../scatter/select":434,"../scatter/style":436,"./attributes":440,"./calc":441,"./defaults":442,"./event_data":443,"./format_labels":444,"./hover":445,"./plot":447}],447:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e,r){var a=e.plotContainer;a.select(".scatterlayer").selectAll("*").remove();var i={xaxis:e.xaxis,yaxis:e.yaxis,plot:a,layerClipId:e._hasClipOnAxisFalse?e.clipIdRelative:null},o=e.layers.frontplot.select("g.scatterlayer");n(t,i,r,o)}},{"../scatter/plot":433}],448:[function(t,e,r){"use strict";var n=t("../box/attributes"),a=t("../../lib/extend").extendFlat;e.exports={y:n.y,x:n.x,x0:n.x0,y0:n.y0,name:a({},n.name,{}),orientation:a({},n.orientation,{}),bandwidth:{valType:"number",min:0,editType:"calc"},scalegroup:{valType:"string",dflt:"",editType:"calc"},scalemode:{valType:"enumerated",values:["width","count"],dflt:"width",editType:"calc"},spanmode:{valType:"enumerated",values:["soft","hard","manual"],dflt:"soft",editType:"calc"},span:{valType:"info_array",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}],editType:"calc"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:n.fillcolor,points:a({},n.boxpoints,{}),jitter:a({},n.jitter,{}),pointpos:a({},n.pointpos,{}),width:a({},n.width,{}),marker:n.marker,text:n.text,hovertext:n.hovertext,hovertemplate:n.hovertemplate,box:{visible:{valType:"boolean",dflt:!1,editType:"plot"},width:{valType:"number",min:0,max:1,dflt:.25,editType:"plot"},fillcolor:{valType:"color",editType:"style"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"plot"},meanline:{visible:{valType:"boolean",dflt:!1,editType:"plot"},color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"plot"},side:{valType:"enumerated",values:["both","positive","negative"],dflt:"both",editType:"calc"},offsetgroup:n.offsetgroup,alignmentgroup:n.alignmentgroup,selected:n.selected,unselected:n.unselected,hoveron:{valType:"flaglist",flags:["violins","points","kde"],dflt:"violins+points+kde",extras:["all"],editType:"style"}}},{"../../lib/extend":196,"../box/attributes":320}],449:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("../box/calc"),o=t("./helpers"),l=t("../../constants/numerical").BADNUM;function s(t,e,r){var a=e.max-e.min;if(!a)return t.bandwidth?t.bandwidth:0;if(t.bandwidth)return Math.max(t.bandwidth,a/1e4);var i=r.length,o=n.stdev(r,i-1,e.mean);return Math.max(function(t,e,r){return 1.059*Math.min(e,r/1.349)*Math.pow(t,-.2)}(i,o,e.q3-e.q1),a/100)}function c(t,e,r,n){var i,o=t.spanmode,s=t.span||[],c=[e.min,e.max],u=[e.min-2*n,e.max+2*n];function f(n){var a=s[n],i="multicategory"===r.type?r.r2c(a):r.d2c(a,0,t[e.valLetter+"calendar"]);return i===l?u[n]:i}var d={type:"linear",range:i="soft"===o?u:"hard"===o?c:[f(0),f(1)]};return a.setConvert(d),d.cleanRange(),i}e.exports=function(t,e){var r=i(t,e);if(r[0].t.empty)return r;for(var l=t._fullLayout,u=a.getFromId(t,e["h"===e.orientation?"xaxis":"yaxis"]),f=1/0,d=-1/0,p=0,h=0,g=0;g0){var y,x,b,_,w,T=t.xa,k=t.ya;"h"===d.orientation?(w=e,y="y",b=k,x="x",_=T):(w=r,y="x",b=T,x="y",_=k);var M=f[t.index];if(w>=M.span[0]&&w<=M.span[1]){var A=n.extendFlat({},t),L=_.c2p(w,!0),S=o.getKdeValue(M,d,w),C=o.getPositionOnKdePath(M,d,L),O=b._offset,D=b._length;A[y+"0"]=C[0],A[y+"1"]=C[1],A[x+"0"]=A[x+"1"]=L,A[x+"Label"]=x+": "+a.hoverLabelText(_,w)+", "+f[0].t.labels.kde+" "+S.toFixed(3),A.spikeDistance=m[0].spikeDistance;var z=y+"Spike";A[z]=m[0][z],m[0].spikeDistance=void 0,m[0][z]=void 0,A.hovertemplate=!1,v.push(A),(u={stroke:t.color})[y+"1"]=n.constrain(O+C[0],O,O+D),u[y+"2"]=n.constrain(O+C[1],O,O+D),u[x+"1"]=u[x+"2"]=_._offset+L}}h&&(v=v.concat(m))}-1!==p.indexOf("points")&&(c=i.hoverOnPoints(t,e,r));var P=s.selectAll(".violinline-"+d.uid).data(u?[0]:[]);return P.enter().append("line").classed("violinline-"+d.uid,!0).attr("stroke-width",1.5),P.exit().remove(),P.attr(u),"closest"===l?c?[c]:v:c?(v.push(c),v):v}},{"../../lib":202,"../../plots/cartesian/axes":246,"../box/hover":325,"./helpers":452}],454:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("../box/defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../box/select"),moduleType:"trace",name:"violin",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":259,"../box/defaults":323,"../box/select":330,"../scatter/style":436,"./attributes":448,"./calc":449,"./cross_trace_calc":450,"./defaults":451,"./hover":453,"./layout_attributes":455,"./layout_defaults":456,"./plot":457,"./style":458}],455:[function(t,e,r){"use strict";var n=t("../box/layout_attributes"),a=t("../../lib").extendFlat;e.exports={violinmode:a({},n.boxmode,{}),violingap:a({},n.boxgap,{}),violingroupgap:a({},n.boxgroupgap,{})}},{"../../lib":202,"../box/layout_attributes":327}],456:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes"),i=t("../box/layout_defaults");e.exports=function(t,e,r){i._supply(t,e,r,(function(r,i){return n.coerce(t,e,a,r,i)}),"violin")}},{"../../lib":202,"../box/layout_defaults":328,"./layout_attributes":455}],457:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/drawing"),o=t("../box/plot"),l=t("../scatter/line_points"),s=t("./helpers");e.exports=function(t,e,r,c){var u=t._fullLayout,f=e.xaxis,d=e.yaxis;function p(t){var e=l(t,{xaxis:f,yaxis:d,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0,linearized:!0});return i.smoothopen(e[0],1)}a.makeTraceGroups(c,r,"trace violins").each((function(t){var r=n.select(this),i=t[0],l=i.t,c=i.trace;if(!0!==c.visible||l.empty)r.remove();else{var h=l.bPos,g=l.bdPos,v=e[l.valLetter+"axis"],m=e[l.posLetter+"axis"],y="both"===c.side,x=y||"positive"===c.side,b=y||"negative"===c.side,_=r.selectAll("path.violin").data(a.identity);_.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin"),_.exit().remove(),_.each((function(t){var e,r,a,i,o,s,f,d,_=n.select(this),w=t.density,T=w.length,k=m.c2l(t.pos+h,!0),M=m.l2p(k);if(c.width)e=l.maxKDE/g;else{var A=u._violinScaleGroupStats[c.scalegroup];e="count"===c.scalemode?A.maxKDE/g*(A.maxCount/t.pts.length):A.maxKDE/g}if(x){for(f=new Array(T),o=0;o=-t},pointBetween:function(e,r,n){var a=e[1]-r[1],i=n[0]-r[0],o=e[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-a>t&&(i-c)*(a-u)/(o-u)+c-n>t&&(l=!l),i=c,o=u}return l}};return e}},{}],81:[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]),a=1;a0}))}function u(t,n){var a=t.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=e.linesIntersect(o,l,c,u);if(!1===f){if(!e.pointsCollinear(o,l,c))return!1;if(e.pointsSame(o,u)||e.pointsSame(l,c))return!1;var d=e.pointsSame(o,c),p=e.pointsSame(l,u);if(d&&p)return n;var h=!d&&e.pointBetween(o,c,u),g=!p&&e.pointBetween(l,c,u);if(d)return g?s(n,l):s(t,u),n;h&&(p||(g?s(n,l):s(t,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(t,c):0===f.alongB?s(t,f.pt):1===f.alongB&&s(t,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var t=u(d,h);if(t)return t}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(t)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(t)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return t?{addRegion:function(t){for(var n,a,i,o=t[t.length-1],s=0;s1)for(var r=1;r1&&(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=O(t,360),e=O(e,100),r=O(r,100),0===e)n=a=i=r;else{var l=r<.5?r*(1+e):r+e-r*e,s=2*r-l;n=o(s,l,t+1/3),a=o(s,l,t),i=o(s,l,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(e.h,s,u),f=!0,d="hsl"),e.hasOwnProperty("a")&&(i=e.a));var p,h,g;return i=C(i),{ok:f,format:e.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(e);this._originalInput=e,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(t,e,r){t=O(t,255),e=O(e,255),r=O(r,255);var n,a,i=l(t,e,r),s=o(t,e,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case t:n=(e-r)/u+(e>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(t,e){e=e||6;for(var r=c(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/e;e--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.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,a=this.toRgb();return e=a.r/255,r=a.g/255,n=a.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=C(t),this._roundA=i(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=i(360*t.h),r=i(100*t.s),n=i(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=u(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=u(this._r,this._g,this._b),e=i(360*t.h),r=i(100*t.s),n=i(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return d(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,a){var o=[P(i(t).toString(16)),P(i(e).toString(16)),P(i(r).toString(16)),P(I(n))];if(a&&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:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+p(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=c(t);r="#"+p(a._r,a._g,a._b,a._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 c(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(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:E(t[n]));t=r}return c(t,e)},c.equals=function(t,e){return!(!t||!e)&&c(t).toRgbString()==c(e).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(t,e,r){r=0===r?0:r||50;var n=c(t).toRgb(),a=c(e).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(e,r){var n=c(e),a=c(r);return(t.max(n.getLuminance(),a.getLuminance())+.05)/(t.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(t,e,r){var n,a,i=c.readability(t,e);switch(a=!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":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(t,e,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(e[u]));return c.isReadable(t,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(t,["#fff","#000"],r))};var L=c.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=c.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(L);function C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function O(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,l(0,parseFloat(e))),n&&(e=parseInt(e*r,10)/100),t.abs(e-r)<1e-6?1:e%r/parseFloat(r)}function D(t){return o(1,l(0,t))}function z(t){return parseInt(t,16)}function P(t){return 1==t.length?"0"+t:""+t}function E(t){return t<=1&&(t=100*t+"%"),t}function I(e){return t.round(255*parseFloat(e)).toString(16)}function R(t){return z(t)/255}var F,N,B,H=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",B="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+B),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 j(t){return!!H.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=c:window.tinycolor=c}(Math)},{}],88:[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}]},{}],89:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=t("../../plots/cartesian/constants"),o=t("../../plot_api/plot_template").templatedArray;t("../../constants/axis_placeable_objects");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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../constants/axis_placeable_objects":207,"../../plot_api/plot_template":266,"../../plots/cartesian/constants":283,"../../plots/font_attributes":305,"./arrow_paths":88}],90:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./draw").draw;function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach((function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref),i=a.getRefType(e.xref),o=a.getRefType(e.yref);e._extremes={},"range"===i&&l(e,r),"range"===o&&l(e,n)}))}function l(t,e){var r,n=e._id,i=n.charAt(0),o=t[i],l=t["a"+i],s=t[i+"ref"],c=t["a"+i+"ref"],u=t["_"+i+"padplus"],f=t["_"+i+"padminus"],d={x:1,y:-1}[i]*t[i+"shift"],p=3*t.arrowsize*t.arrowwidth||0,h=p+d,g=p-d,v=3*t.startarrowsize*t.arrowwidth||0,m=v+d,y=v-d;if(c===s){var x=a.findExtremes(e,[e.r2c(o)],{ppadplus:h,ppadminus:g}),b=a.findExtremes(e,[e.r2c(l)],{ppadplus:Math.max(u,m),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else m=l?m+l:m,y=l?y-l:y,r=a.findExtremes(e,[e.r2c(o)],{ppadplus:Math.max(u,h,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([i,o],t)}},{"../../lib":232,"../../plots/cartesian/axes":277,"./draw":95}],91:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("../../plot_api/plot_template").arrayEditor;function o(t,e){var r,n,a,i,o,s,c,u=t._fullLayout.annotations,f=[],d=[],p=[],h=(e||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(t,e){var r,l,s=o(t,e),c=s.on,u=s.off.concat(s.explicitOff),f={},d=t._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}for(var Y=!1,X=["x","y"],W=0;W1)&&(nt===rt?((pt=at.r2fraction(e["a"+et]))<0||pt>1)&&(Y=!0):Y=!0),Q=at._offset+at.r2p(e[et]),K=.5}else{var ht="domain"===dt;"x"===et?($=e[et],Q=ht?at._offset+at._length*$:Q=T.l+T.w*$):($=1-e[et],Q=ht?at._offset+at._length*$:Q=T.t+T.h*$),K=e.showarrow?.5:$}if(e.showarrow){ft.head=Q;var gt=e["a"+et];if(tt=ot*q(.5,e.xanchor)-lt*q(.5,e.yanchor),nt===rt){var vt=s.getRefType(nt);"domain"===vt?("y"===et&&(gt=1-gt),ft.tail=at._offset+at._length*gt):"paper"===vt?"y"===et?(gt=1-gt,ft.tail=T.t+T.h*gt):ft.tail=T.l+T.w*gt:ft.tail=at._offset+at.r2p(gt),J=tt}else ft.tail=Q+gt,J=tt+gt;ft.text=ft.tail+tt;var mt=w["x"===et?"width":"height"];if("paper"===rt&&(ft.head=o.constrain(ft.head,1,mt-1)),"pixel"===nt){var yt=-Math.max(ft.tail-3,ft.text),xt=Math.min(ft.tail+3,ft.text)-mt;yt>0?(ft.tail+=yt,ft.text+=yt):xt>0&&(ft.tail-=xt,ft.text-=xt)}ft.tail+=ut,ft.head+=ut}else J=tt=st*q(K,ct),ft.text=Q+tt;ft.text+=ut,tt+=ut,J+=ut,e["_"+et+"padplus"]=st/2+J,e["_"+et+"padminus"]=st/2-J,e["_"+et+"size"]=st,e["_"+et+"shift"]=tt}if(Y)R.remove();else{var bt=0,_t=0;if("left"!==e.align&&(bt=(M-b)*("center"===e.align?.5:1)),"top"!==e.valign&&(_t=(I-_)*("middle"===e.valign?.5:1)),f)n.select("svg").attr({x:B+bt-1,y:B+_t}).call(u.setClipUrl,j?C:null,t);else{var wt=B+_t-g.top,Tt=B+bt-g.left;G.call(d.positionText,Tt,wt).call(u.setClipUrl,j?C:null,t)}U.select("rect").call(u.setRect,B,B,M,I),H.call(u.setRect,F/2,F/2,N-F,V-F),R.call(u.setTranslate,Math.round(O.x.text-N/2),Math.round(O.y.text-V/2)),P.attr({transform:"rotate("+D+","+O.x.text+","+O.y.text+")"});var kt,Mt=function(r,n){z.selectAll(".annotation-arrow-g").remove();var s=O.x.head,f=O.y.head,d=O.x.tail+r,p=O.y.tail+n,g=O.x.text+r,b=O.y.text+n,_=o.rotationXYMatrix(D,g,b),w=o.apply2DTransform(_),M=o.apply2DTransform2(_),C=+H.attr("width"),E=+H.attr("height"),I=g-.5*C,F=I+C,N=b-.5*E,B=N+E,j=[[I,N,I,B],[I,B,F,B],[F,B,F,N],[F,N,I,N]].map(M);if(!j.reduce((function(t,e){return t^!!o.segmentsIntersect(s,f,s+1e6,f+1e6,e[0],e[1],e[2],e[3])}),!1)){j.forEach((function(t){var e=o.segmentsIntersect(d,p,s,f,t[0],t[1],t[2],t[3]);e&&(d=e.x,p=e.y)}));var U=e.arrowwidth,V=e.arrowcolor,q=e.arrowside,G=z.append("g").style({opacity:c.opacity(V)}).classed("annotation-arrow-g",!0),Z=G.append("path").attr("d","M"+d+","+p+"L"+s+","+f).style("stroke-width",U+"px").call(c.stroke,c.rgb(V));if(v(Z,q,e),k.annotationPosition&&Z.node().parentNode&&!i){var Y=s,X=f;if(e.standoff){var W=Math.sqrt(Math.pow(s-d,2)+Math.pow(f-p,2));Y+=e.standoff*(d-s)/W,X+=e.standoff*(p-f)/W}var Q,J,$=G.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-Y)+","+(p-X),transform:l(Y,X)}).style("stroke-width",U+6+"px").call(c.stroke,"rgba(0,0,0,0)").call(c.fill,"rgba(0,0,0,0)");h.init({element:$.node(),gd:t,prepFn:function(){var t=u.getTranslate(R);Q=t.x,J=t.y,m&&m.autorange&&A(m._name+".autorange",!0),x&&x.autorange&&A(x._name+".autorange",!0)},moveFn:function(t,r){var n=w(Q,J),a=n[0]+t,i=n[1]+r;R.call(u.setTranslate,a,i),L("x",y(m,t,"x",T,e)),L("y",y(x,r,"y",T,e)),e.axref===e.xref&&L("ax",y(m,t,"ax",T,e)),e.ayref===e.yref&&L("ay",y(x,r,"ay",T,e)),G.attr("transform",l(t,r)),P.attr({transform:"rotate("+D+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",t,S());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&Mt(0,0),E)h.init({element:R.node(),gd:t,prepFn:function(){kt=P.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?L("ax",y(m,t,"ax",T,e)):L("ax",e.ax+t),e.ayref===e.yref?L("ay",y(x,r,"ay",T.w,e)):L("ay",e.ay+r),Mt(t,r);else{if(i)return;var a,o;if(m)a=y(m,t,"x",T,e);else{var s=e._xsize/T.w,c=e.x+(e._xshift-e.xshift)/T.w-s/2;a=h.align(c+t/T.w,s,0,1,e.xanchor)}if(x)o=y(x,r,"y",T,e);else{var u=e._ysize/T.h,f=e.y-(e._yshift+e.yshift)/T.h-u/2;o=h.align(f-r/T.h,u,0,1,e.yanchor)}L("x",a),L("y",o),m&&x||(n=h.getCursor(m?.5:a,x?.5:o,e.xanchor,e.yanchor))}P.attr({transform:l(t,r)+kt}),p(R,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",Z(n))},doneFn:function(){p(R),a.call("_guiRelayout",t,S());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,x=e.indexOf("end")>=0,b=h.backoff*v+r.standoff,_=g.backoff*m+r.startstandoff;if("line"===p.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")};var w=o.x-u.x,T=o.y-u.y;if(d=(f=Math.atan2(T,w))+Math.PI,b&&_&&b+_>Math.sqrt(w*w+T*T))return void E();if(b){if(b*b>w*w+T*T)return void E();var k=b*Math.cos(f),M=b*Math.sin(f);u.x+=k,u.y+=M,t.attr({x2:u.x,y2:u.y})}if(_){if(_*_>w*w+T*T)return void E();var A=_*Math.cos(f),L=_*Math.sin(f);o.x-=A,o.y-=L,t.attr({x1:o.x,y1:o.y})}}else if("path"===p.nodeName){var S=p.getTotalLength(),C="";if(S1){c=!0;break}}c?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+l+'"]').remove():(s._pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(s.x)*r[0],e.yaxis.r2l(s.y)*r[1],e.zaxis.r2l(s.z)*r[2]]),n(t.graphDiv,s,l,t.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":308,"../annotations/draw":95}],102:[function(t,e,r){"use strict";var n=t("../../registry"),a=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 i=r.attrRegex,o=Object.keys(t),l=0;l=0))return t;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return t}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(n(t))},i.opacity=function(t){return t?n(t).getAlpha():0},i.addOpacity=function(t,e){var r=n(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},i.combine=function(t,e){var r=n(t).toRgb();if(1===r.a)return n(t).toRgbString();var a=n(e||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(t,e,r){var a=n(t);return 1!==a.getAlpha()&&(a=n(i.combine(t,s))),(a.isDark()?e?a.lighten(e):s:r?a.darken(r):l).toString()},i.stroke=function(t,e){var r=n(e);t.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(t,e){var r=n(e);t.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,r,n,a,o=Object.keys(t);for(e=0;e0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var Q=Math.pow(10,Math.floor(Math.log(W)/Math.LN10));Y*=Q*c.roundUp(W/Q,[2,5,10]),(Math.abs(O.start)/O.size+1e-6)%1<2e-6&&(Z.tick0=0)}Z.dtick=Y}Z.domain=[V+H,V+F-H],Z.setScale(),t.attr("transform",u(Math.round(s.l),Math.round(s.t)));var J,$=t.select("."+M.cbtitleunshift).attr("transform",u(-Math.round(s.l),-Math.round(s.t))),K=t.select("."+M.cbaxis),tt=0;function et(n,a){var i={propContainer:Z,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+M.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+l+",."+l+"-math-group").remove(),g.draw(r,n,f(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(A)){var t,r=s.l+(e.x+N)*s.w,n=Z.title.font.size;t="top"===A?(1-(V+F-H))*s.h+s.t+3+.75*n:(1-(V+H))*s.h+s.t-3-.25*n,et(Z._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(A)){var i=t.select("."+M.cbtitle),o=i.select("text"),f=[-e.outlinewidth/2,e.outlinewidth/2],d=i.select(".h"+Z._id+"title-math-group").node(),h=15.6;if(o.node()&&(h=parseInt(o.node().style.fontSize,10)*w),d?(tt=p.bBox(d).height)>h&&(f[1]-=(tt-h)/2):o.node()&&!o.classed(M.jsPlaceholder)&&(tt=p.bBox(o.node()).height),tt){if(tt+=5,"top"===A)Z.domain[1]-=tt/s.h,f[1]*=-1;else{Z.domain[0]+=tt/s.h;var g=v.lineCount(o);f[1]+=(1-g)*h}i.attr("transform",u(f[0],f[1])),Z.setScale()}}t.selectAll("."+M.cbfills+",."+M.cblines).attr("transform",u(0,Math.round(s.h*(1-Z.domain[1])))),K.attr("transform",u(0,Math.round(-s.t)));var y=t.select("."+M.cbfills).selectAll("rect."+M.cbfill).attr("style","").data(z);y.enter().append("rect").classed(M.cbfill,!0).style("stroke","none"),y.exit().remove();var x=L.map(Z.c2p).map(Math.round).sort((function(t,e){return t-e}));y.each((function(t,i){var o=[0===i?L[0]:(z[i]+z[i-1])/2,i===z.length-1?L[1]:(z[i]+z[i+1])/2].map(Z.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,x[0],x[1]);var l=n.select(this).attr({x:j,width:Math.max(E,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)p.gradient(l,r,e._id,"vertical",e._fillgradient,"fill");else{var s=C(t).replace("e-","");l.attr("fill",a(s).toHexString())}}));var b=t.select("."+M.cblines).selectAll("path."+M.cbline).data(m.color&&m.width?P:[]);b.enter().append("path").classed(M.cbline,!0),b.exit().remove(),b.each((function(t){n.select(this).attr("d","M"+j+","+(Math.round(Z.c2p(t))+m.width/2%1)+"h"+E).call(p.lineGroupStyle,m.width,S(t),m.dash)})),K.selectAll("g."+Z._id+"tick,path").remove();var _=j+E+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),T=l.calcTicks(Z),k=l.getTickSigns(Z)[2];return l.drawTicks(r,Z,{vals:"inside"===Z.ticks?l.clipEnds(Z,T):T,layer:K,path:l.makeTickPath(Z,_,k),transFn:l.makeTransTickFn(Z)}),l.drawLabels(r,Z,{vals:T,layer:K,transFn:l.makeTransTickLabelFn(Z),labelFns:l.makeLabelFns(Z,_)})},function(){if(-1===["top","bottom"].indexOf(A)){var t=Z.title.font.size,e=Z._offset+Z._length/2,a=s.l+(Z.position||0)*s.w+("right"===Z.side?10+t*(Z.showticklabels?1:.5):-10-t*(Z.showticklabels?.5:0));et("h"+Z._id+"title",{avoid:{selection:n.select(r).selectAll("g."+Z._id+"tick"),side:A,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=E+e.outlinewidth/2;if(-1===Z.ticklabelposition.indexOf("inside")&&(n+=p.bBox(K.node()).width),(J=$.select("text")).node()&&!J.classed(M.jsPlaceholder)){var a,o=$.select(".h"+Z._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(A)?p.bBox(o).width:p.bBox($.node()).right-j-s.l,n=Math.max(n,a)}var l=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,c=q-G;t.select("."+M.cbbg).attr({x:j-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:G-B,width:Math.max(l,2),height:Math.max(c+2*B,2)}).call(h.fill,e.bgcolor).call(h.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+M.cboutline).attr({x:j,y:G+e.ypad+("top"===A?tt:0),width:Math.max(E,2),height:Math.max(c-2*e.ypad-tt,2)}).call(h.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var f=({center:.5,right:1}[e.xanchor]||0)*l;t.attr("transform",u(s.l-f,s.t));var d={},g=T[e.yanchor],v=k[e.yanchor];"pixels"===e.lenmode?(d.y=e.y,d.t=c*g,d.b=c*v):(d.t=d.b=0,d.yt=e.y+e.len*g,d.yb=e.y-e.len*v);var m=T[e.xanchor],y=k[e.xanchor];if("pixels"===e.thicknessmode)d.x=e.x,d.l=l*m,d.r=l*y;else{var x=l-E;d.l=x*m,d.r=x*y,d.xl=e.x-e.thickness*m,d.xr=e.x+e.thickness*y}i.autoMargin(r,e._id,d)}],r)}(r,e,t);m&&m.then&&(t._promises||[]).push(m),t._context.edits.colorbarPosition&&function(t,e,r){var n,a,i,l=r._fullLayout._size;s.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),d(t)},moveFn:function(r,o){t.attr("transform",n+u(r,o)),a=s.align(e._xLeftFrac+r/l.w,e._thickFrac,0,1,e.xanchor),i=s.align(e._yBottomFrac-o/l.h,e._lenFrac,0,1,e.yanchor);var c=s.getCursor(a,i,e.xanchor,e.yanchor);d(t,c)},doneFn:function(){if(d(t),void 0!==a&&void 0!==i){var n={};n[e._propPrefix+"x"]=a,n[e._propPrefix+"y"]=i,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){i.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":206,"../../lib":232,"../../lib/extend":226,"../../lib/setcursor":251,"../../lib/svg_text_utils":253,"../../plots/cartesian/axes":277,"../../plots/cartesian/axis_defaults":279,"../../plots/cartesian/layout_attributes":291,"../../plots/cartesian/position_defaults":294,"../../plots/plots":311,"../../registry":324,"../color":104,"../colorscale/helpers":115,"../dragelement":123,"../drawing":126,"../titles":199,"./constants":106,d3:21,tinycolor2:87}],109:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":232}],110:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":105,"./defaults":107,"./draw":108,"./has_colorbar":109}],111:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),a=t("../../lib/regex").counter,i=t("./scales.js").scales;Object.keys(i);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,l=(e=e||{}).cLetter||"c",s=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),c="showScaleDflt"in e?e.showScaleDflt:"z"===l,u="string"==typeof e.colorscaleDflt?i[e.colorscaleDflt]:null,f=e.editTypeOverride||"",d=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},e.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),e.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":247,"../colorbar/attributes":105,"./scales.js":119}],112:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,l=t._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(e,c).get():e,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":232,"./helpers":115,"fast-isnumeric":23}],113:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./helpers").hasColorscale,i=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,a){var o=a.container?n.nestedProperty(t,a.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=t[n];r[a]=[1-i[0],i[1]]}return r}function h(t,e){e=e||{};for(var r=t.domain,o=t.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],121:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":232}],122:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],123:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),a=t("has-hover"),i=t("has-passive-events"),o=t("../../lib").removeElement,l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");function u(){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 f(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){var e,r,n,c,d,p,h,g,v=t.gd,m=1,y=v._context.doubleClickDelay,x=t.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=t.clampFn||function(t,e,r){return Math.abs(t)y&&(m=Math.max(m-1,1)),v._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",e)}catch(t){var n=f(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)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":232,"../../plots/cartesian/constants":283,"./align":120,"./cursor":121,"./unhover":124,"has-hover":54,"has-passive-events":55,"mouse-event-offset":75}],124:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=t("../../lib/throttle"),i=t("../../lib/dom").getGraphDiv,o=t("../fx/constants"),l=e.exports={};l.wrapped=function(t,e,r){(t=i(t))._fullLayout&&a.clear(t._fullLayout._uid+o.HOVERID),l.raw(t,e,r)},l.raw=function(t,e){var r=t._fullLayout,a=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&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/dom":224,"../../lib/events":225,"../../lib/throttle":254,"../fx/constants":138}],125:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],126:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("tinycolor2"),o=t("../../registry"),l=t("../color"),s=t("../colorscale"),c=t("../../lib"),u=c.strTranslate,f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),p=t("../../constants/alignment").LINE_SPACING,h=t("../../constants/interactions").DESELECTDIM,g=t("../../traces/scatter/subtypes"),v=t("../../traces/scatter/make_bubble_size_func"),m=t("../../components/fx/helpers").appendArrayPointValue,y=e.exports={};y.font=function(t,e,r,n){c.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(l.fill,n)},y.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},y.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},y.setRect=function(t,e,r,n,a){t.call(y.setPosition,e,r).call(y.setSize,n,a)},y.translatePoint=function(t,e,r,n){var i=r.c2p(t.x),o=n.c2p(t.y);return!!(a(i)&&a(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",o):e.attr("transform",u(i,o)),!0)},y.translatePoints=function(t,e,r){t.each((function(t){var a=n.select(this);y.translatePoint(t,a,e,r)}))},y.hideOutsideRangePoint=function(t,e,r,n,a,i){e.attr("display",r.isPtWithinRange(t,a)&&n.isPtWithinRange(t,i)?null:"none")},y.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,a=e.yaxis;t.each((function(e){var i=e[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";t.selectAll(c).each((function(t){y.hideOutsideRangePoint(t,n.select(this),r,a,l,s)}))}))}},y.crispRound=function(t,e,r){return e&&a(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},y.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(e,n||i.color),y.dashLine(e,s,o)},y.lineGroupStyle=function(t,e,r,a){t.style("fill","none").each((function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(y.dashLine,s,o)}))},y.dashLine=function(t,e,r){r=+r||0,e=y.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},y.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},y.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(l.fill,e)},y.fillGroupStyle=function(t){t.style("stroke-width",0).each((function(t){var e=n.select(this);t[0].trace&&e.call(l.fill,t[0].trace.fillcolor)}))};var x=t("./symbol_defs");y.symbolNames=[],y.symbolFuncs=[],y.symbolNeedLines={},y.symbolNoDot={},y.symbolNoFill={},y.symbolList=[],Object.keys(x).forEach((function(t){var e=x[t],r=e.n;y.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),y.symbolNames[r]=t,y.symbolFuncs[r]=e.f,e.needLine&&(y.symbolNeedLines[r]=!0),e.noDot?y.symbolNoDot[r]=!0:y.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(y.symbolNoFill[r]=!0)}));var b=y.symbolNames.length;function _(t,e){var r=t%100;return y.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}y.symbolNumber=function(t){if(a(t))t=+t;else 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=y.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=b||t>=400?0:Math.floor(Math.max(t,0))};var w={x1:1,x2:0,y1:0,y2:0},T={x1:0,x2:0,y1:1,y2:0},k=n.format("~.1f"),M={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:w},horizontalreversed:{node:"linearGradient",attrs:w,reversed:!0},vertical:{node:"linearGradient",attrs:T},verticalreversed:{node:"linearGradient",attrs:T,reversed:!0}};y.gradient=function(t,e,r,a,o,s){for(var u=o.length,f=M[a],d=new Array(u),p=0;p"+m(t);h._gradientUrlQueryParts[y]=1},y.initGradients=function(t){var e=t._fullLayout;c.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},y.pointStyle=function(t,e,r){if(t.size()){var a=y.makePointStyleFns(e);t.each((function(t){y.singlePointStyle(t,n.select(this),e,a,r)}))}},y.singlePointStyle=function(t,e,r,n,a){var i=r.marker,o=i.line;if(e.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(t):void 0===t.mo?i.opacity:t.mo),n.ms2mrc){var s;s="various"===t.ms||"various"===i.size?3:n.ms2mrc(t.ms),t.mrc=s,n.selectedSizeFn&&(s=t.mrc=n.selectedSizeFn(t));var u=y.symbolNumber(t.mx||i.symbol)||0;t.om=u%200>=100,e.attr("d",_(u,s))}var f,d,p,h=!1;if(t.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(t.mlw+1||g+1||(t.trace?(t.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in t?t.mlcc=n.lineScale(t.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in t?t.mcc=n.markerScale(t.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(t))}if(t.om)e.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{e.style("stroke-width",(t.isBlank?0:p)+"px");var v=i.gradient,m=t.mgt;if(m?h=!0:m=v&&v.type,Array.isArray(m)&&(m=m[0],M[m]||(m=0)),m&&"none"!==m){var x=t.mgc;x?h=!0:x=v.color;var b=r.uid;h&&(b+="-"+t.i),y.gradient(e,a,b,m,[[0,x],[1,f]],"fill")}else l.fill(e,f);p&&l.stroke(e,d)}},y.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=y.tryColorscale(r,""),e.lineScale=y.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=g.isBubble(t)?v(t):function(){return(r.size||6)/2}),t.selectedpoints&&c.extendFlat(e,y.makeSelectedPointStyleFns(t)),e},y.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,p=void 0!==f;(c.isArrayOrTypedArray(s)||d||p)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?a.opacity:t.mo;return t.selected?d?u:e:p?f:h*e});var g=a.color,v=i.color,m=l.color;(v||m)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?v||e:m||e});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(t,"symbols")&&(_||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||y/2;return t.selected?_?x/2:e:w?b/2:e}),e},y.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return e.selectedTextColorFn=function(t){var e=t.tc||s;return t.selected?c||e:u||(c?e:l.addOpacity(e,h))},e},y.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.makeSelectedPointStyleFns(e),a=e.marker||{},i=[];r.selectedOpacityFn&&i.push((function(t,e){t.style("opacity",r.selectedOpacityFn(e))})),r.selectedColorFn&&i.push((function(t,e){l.fill(t,r.selectedColorFn(e))})),r.selectedSizeFn&&i.push((function(t,e){var n=e.mx||a.symbol||0,i=r.selectedSizeFn(e);t.attr("d",_(y.symbolNumber(n),i)),e.mrc2=i})),i.length&&t.each((function(t){for(var e=n.select(this),r=0;r0?r:0}y.textPointStyle=function(t,e,r){if(t.size()){var a;if(e.selectedpoints){var i=y.makeSelectedTextStyleFns(e);a=i.selectedTextColorFn}var o=e.texttemplate,l=r._fullLayout;t.each((function(t){var i=n.select(this),s=o?c.extractOption(t,e,"txt","texttemplate"):c.extractOption(t,e,"tx","text");if(s||0===s){if(o){var u=e._module.formatLabels?e._module.formatLabels(t,e,l):{},d={};m(d,e,t.i);var p=e._meta||{};s=c.texttemplateString(s,u,l._d3locale,d,t,p)}var h=t.tp||e.textposition,g=S(t,e),v=a?a(t):t.tc||e.textfont.color;i.call(y.font,t.tf||e.textfont.family,g,v).text(s).call(f.convertToTspans,r).call(L,h,g,t.mrc)}else i.remove()}))}},y.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.makeSelectedTextStyleFns(e);t.each((function(t){var a=n.select(this),i=r.selectedTextColorFn(t),o=t.tp||e.textposition,s=S(t,e);l.fill(a,i),L(a,o,s,t.mrc2||t.mrc)}))}};function C(t,e,r,a){var i=t[0]-e[0],o=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(e[0]+(p&&f/p),2),n.round(e[1]+(p&&d/p),2)],[n.round(e[0]-(h&&f/h),2),n.round(e[1]-(h&&d/h),2)]]}y.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(y.savedBBoxes={},z=0),r&&(y.savedBBoxes[r]=v),z++,c.extendFlat({},v)},y.setClipUrl=function(t,e,r){t.attr("clip-path",E(e,r))},y.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}},y.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=u(e,r)).trim(),t[a]("transform",i),i},y.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}},y.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+="scale("+e+","+r+")").trim(),t[a]("transform",i),i};var I=/\s*sc.*/;y.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(I,"");t=(t+=n).trim(),this.setAttribute("transform",t)}))}};var R=/translate\([^)]*\)\s*$/;y.setTextPointsScale=function(t,e,r){t&&t.each((function(){var t,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(R);t=1===e&&1===r?[]:[u(o,l),"scale("+e+","+r+")",u(-o,-l)],s&&t.push(s),a.attr("transform",t.join(""))}}))}},{"../../components/fx/helpers":140,"../../constants/alignment":206,"../../constants/interactions":210,"../../constants/xmlns_namespaces":212,"../../lib":232,"../../lib/svg_text_utils":253,"../../registry":324,"../../traces/scatter/make_bubble_size_func":462,"../../traces/scatter/subtypes":470,"../color":104,"../colorscale":116,"./symbol_defs":127,d3:21,"fast-isnumeric":23,tinycolor2:87}],127:[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,a="l"+e+",-"+e,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+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),a=n.round(-t,2),i=n.round(-.309*t,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"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),a=n.round(.951*e,2),i=n.round(.363*e,2),o=n.round(.588*e,2),l=n.round(-e,2),s=n.round(-.309*e,2),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*e,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),a=n.round(.76*t,2);return"M-"+a+",0l-"+r+",-"+e+"h"+a+"l"+r+",-"+e+"l"+r+","+e+"h"+a+"l-"+r+","+e+"l"+r+","+e+"h-"+a+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+a+"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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+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),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"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),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"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),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+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),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:21}],128:[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"}}}},{}],129:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../registry"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),l=t("./compute_error");function s(t,e,r,a){var s=e["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;e.each((function(e){var f,d=e[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(t){return t.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(e=[]);var v=n.select(this).selectAll("g.errorbar").data(e,f);if(v.exit().remove(),e.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.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),a(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),a(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0)));return n}(t,s,c);if(!g||t.vis){var i,o=e.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=e.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":470,"../drawing":126,d3:21,"fast-isnumeric":23}],134:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each((function(t){var e=t[0].trace,r=e.error_y||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":104,d3:21}],135:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("./layout_attributes").hoverlabel,i=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":226,"../../plots/font_attributes":305,"./layout_attributes":145}],136:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry");function i(t,e,r,a){a=a||n.identity,Array.isArray(t)&&(e[0][r]=a(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 l=0;l=0&&r.indexb[0]._length||tt<0||tt>_[0]._length)return h.unhoverRaw(t,e)}if(e.pointerX=K+b[0]._offset,e.pointerY=tt+_[0]._offset,C="xval"in e?m.flat(l,e.xval):m.p2c(b,K),D="yval"in e?m.flat(l,e.yval):m.p2c(_,tt),!a(C[0])||!a(D[0]))return o.warn("Fx.hover failed",e,t),h.unhoverRaw(t,e)}var nt=1/0;function at(t,r){for(F=0;FZ&&(W.splice(0,Z),nt=W[0].distance),g&&0!==X&&0===W.length){G.distance=X,G.index=!1;var f=B._module.hoverPoints(G,V,q,"closest",s._hoverlayer);if(f&&(f=f.filter((function(t){return t.spikeDistance<=X}))),f&&f.length){var d,h=f.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(d=ot(v),(!J.vLinePoint||J.vLinePoint.spikeDistance>d.spikeDistance)&&(J.vLinePoint=d))}var y=f.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(d=ot(x),(!J.hLinePoint||J.hLinePoint.spikeDistance>d.spikeDistance)&&(J.hLinePoint=d))}}}}}function it(t,e){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===L&&$&&W.length>1,At=p.combine(s.plot_bgcolor||p.background,s.paper_bgcolor),Lt={hovermode:L,rotateLabels:Mt,bgColor:At,container:s._hoverlayer,outerContainer:s._paperdiv,commonLabelOpts:s.hoverlabel,hoverdistance:s.hoverdistance},St=O(W,Lt,t);m.isUnifiedHover(L)||(!function(t,e,r){var n,a,i,o,l,s,c,u=0,f=1,d=t.size(),p=new Array(d),h=0;function g(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=i;n=!1}if(n){var c=0;for(o=0;oe.pmax&&c++;for(o=t.length-1;o>=0&&!(c<=0);o--)(s=t[o]).pos>e.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)t[l].dp-=i;for(o=t.length-1;o>=0&&!(c<=0);o--)(s=t[o]).pos+s.dp+s.size>e.pmax&&(s.del=!0,c--)}}}t.each((function(t){var n=t[e],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(a?T:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(t,e){return t[0].posref-e[0].posref||f*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var _=b[l],w=_.datum;w.offset=_.dp,w.del=_.del}}}(St,Mt?"xa":"ya",s),z(St,Mt,s._invScaleX,s._invScaleY));if(e.target&&e.target.tagName){var Ct=v.getComponentMethod("annotations","hasClickToShow")(t,_t);f(n.select(e.target),Ct?"pointer":"")}if(!e.target||i||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(t,0,bt))return;bt&&t.emit("plotly_unhover",{event:e,points:bt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:b,yaxes:_,xvals:C,yvals:D})}(t,e,r,i)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var a=t.map((function(t){return{color:t.color||p.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,nameLength:t.nameLength,textAlign:t.textAlign,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),o=e.outerContainer?n.select(e.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||p.background,container:i,outerContainer:o},s=O(a,l,e.gd),c=0,u=0;s.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function O(t,e,r){var a=r._fullLayout,i=e.hovermode,c=e.rotateLabels,f=e.bgColor,h=e.container,g=e.outerContainer,v=e.commonLabelOpts||{},w=e.fontFamily||y.HOVERFONT,T=e.fontSize||y.HOVERFONTSIZE,k=t[0],M=k.xa,C=k.ya,O="y"===i.charAt(0)?"yLabel":"xLabel",z=k[O],P=(String(z)||"").split(" ")[0],E=g.node().getBoundingClientRect(),I=E.top,R=E.width,F=E.height,N=void 0!==z&&k.distance<=e.hoverdistance&&("x"===i||"y"===i);if(N){var B,H,j=!0;for(B=0;Ba.width-S?(y=a.width-S,s.attr("d","M"+(S-A)+",0L"+S+","+_+A+"v"+_+(2*L+b.height)+"H-"+S+"V"+_+A+"H"+(S-2*A)+"Z")):s.attr("d","M0,0L"+A+","+_+A+"H"+(L+b.width/2)+"v"+_+(2*L+b.height)+"H-"+(L+b.width/2)+"V"+_+A+"H-"+A+"Z")}else{var O,D,P;"right"===C.side?(O="start",D=1,P="",y=M._offset+M._length):(O="end",D=-1,P="-",y=M._offset),x=C._offset+(k.y0+k.y1)/2,c.attr("text-anchor",O),s.attr("d","M0,0L"+P+A+","+A+"V"+(L+b.height/2)+"h"+P+(2*L+b.width)+"V-"+(L+b.height/2)+"H"+P+A+"V-"+A+"Z");var E,R=b.height/2,F=I-b.top-R,N="clip"+a._uid+"commonlabel"+C._id;if(y=0?et-=at:et+=2*L;var it=nt.height+2*L,ot=tt+it>=F;return it<=F&&(tt<=I?tt=C._offset+2*L:ot&&(tt=F-it)),rt.attr("transform",l(et,tt)),rt}var lt=h.selectAll("g.hovertext").data(t,(function(t){return S(t)}));return lt.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(p.fill,p.addOpacity(f,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(d.font,w,T)})),lt.exit().remove(),lt.each((function(t){var e=n.select(this).attr("transform",""),o=t.color;Array.isArray(o)&&(o=o[t.eventData[0].pointNumber]);var h=t.bgcolor||o,g=p.combine(p.opacity(h)?h:p.defaultLine,f),v=p.combine(p.opacity(o)?o:p.defaultLine,f),m=t.borderColor||p.contrast(g),y=D(t,N,i,a,z,e),x=y[0],b=y[1],k=e.select("text.nums").call(d.font,t.fontFamily||w,t.fontSize||T,t.fontColor||m).text(x).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,r),M=e.select("text.name"),S=0,C=0;if(b&&b!==x){M.call(d.font,t.fontFamily||w,t.fontSize||T,v).text(b).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,r);var O=M.node().getBoundingClientRect();S=O.width+2*L,C=O.height+2*L}else M.remove(),e.select("rect").remove();e.select("path").style({fill:g,stroke:m});var P,E,B=k.node().getBoundingClientRect(),H=t.xa._offset+(t.x0+t.x1)/2,j=t.ya._offset+(t.y0+t.y1)/2,U=Math.abs(t.x1-t.x0),V=Math.abs(t.y1-t.y0),q=B.width+A+L+S;if(t.ty0=I-B.top,t.bx=B.width+2*L,t.by=Math.max(B.height+2*L,C),t.anchor="start",t.txwidth=B.width,t.tx2width=S,t.offset=0,c)t.pos=H,P=j+V/2+q<=F,E=j-V/2-q>=0,"top"!==t.idealAlign&&P||!E?P?(j+=V/2,t.anchor="start"):t.anchor="middle":(j-=V/2,t.anchor="end");else if(t.pos=j,P=H+U/2+q<=R,E=H-U/2-q>=0,"left"!==t.idealAlign&&P||!E)if(P)H+=U/2,t.anchor="start";else{t.anchor="middle";var G=q/2,Z=H+G-R,Y=H-G;Z>0&&(H-=Z),Y<0&&(H+=-Y)}else H-=U/2,t.anchor="end";k.attr("text-anchor",t.anchor),S&&M.attr("text-anchor",t.anchor),e.attr("transform",l(H,j)+(c?s(_):""))})),lt}function D(t,e,r,n,a,i){var l="",s="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),l=R(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(s+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(s+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(s+=(s?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===a?s=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(s=t.yLabel):s=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(s+=(s?"
":"")+t.text),void 0!==t.extraText&&(s+=(s?"
":"")+t.extraText),i&&""===s&&!t.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=t.hovertemplate||!1,f=t.hovertemplateLabels||t,d=t.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,t.trace._meta)).replace(C,(function(e,r){return l=R(r,t.nameLength),""}))),[s,l]}function z(t,e,r,a){var i=function(t){return t*r},o=function(t){return t*a};t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var a=r.select("text.nums"),l=t.anchor,s="end"===l?-1:1,c={start:1,end:-1,middle:0}[l],f=c*(A+L),p=f+c*(t.txwidth+L),h=0,g=t.offset,v="middle"===l;v&&(f-=t.tx2width/2,p+=t.txwidth/2+L),e&&(g*=-M,h=t.offset*k),r.select("path").attr("d",v?"M-"+i(t.bx/2+t.tx2width/2)+","+o(g-t.by/2)+"h"+i(t.bx)+"v"+o(t.by)+"h-"+i(t.bx)+"Z":"M0,0L"+i(s*A+h)+","+o(A+g)+"v"+o(t.by/2-A)+"h"+i(s*t.bx)+"v-"+o(t.by)+"H"+i(s*A+h)+"V"+o(g-A)+"Z");var m=h+f,y=g+t.ty0-t.by/2+L,x=t.textAlign||"auto";"auto"!==x&&("left"===x&&"start"!==l?(a.attr("text-anchor","start"),m=v?-t.bx/2-t.tx2width/2+L:-t.bx-L):"right"===x&&"end"!==l&&(a.attr("text-anchor","end"),m=v?t.bx/2-t.tx2width/2-L:t.bx+L)),a.call(u.positionText,i(m),o(y)),t.tx2width&&(r.select("text.name").call(u.positionText,i(p+c*L+h),o(g+t.ty0-t.by/2+L)),r.select("rect").call(d.setRect,i(p+(c-1)*t.tx2width/2+h),o(g-t.by/2-1),i(t.tx2width),o(t.by+2)))}))}function P(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],l=t.cd[r]||{};function s(t){return t||a(t)&&0===t}var c=Array.isArray(r)?function(t,e){var a=o.castOption(i,r,t);return s(a)?a:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(l,n,t,e)};function u(e,r,n){var a=c(r,n);s(a)&&(t[e]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),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:g.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:g.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 f=g.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+f+" / -"+g.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+f,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var d=g.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+d+" / -"+g.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+d,"y"===e&&(t.distance+=1)}var p=t.hoverinfo||t.trace.hoverinfo;return p&&"all"!==p&&(-1===(p=Array.isArray(p)?p:p.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===p.indexOf("y")&&(t.yLabel=void 0),-1===p.indexOf("z")&&(t.zLabel=void 0),-1===p.indexOf("text")&&(t.text=void 0),-1===p.indexOf("name")&&(t.name=void 0)),t}function E(t,e,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,u=!!e.hLinePoint,f=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),f||u){var h=p.combine(l.plot_bgcolor,l.paper_bgcolor);if(u){var v,m,y=e.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,h)<1.5?p.contrast(h):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=g.getPxPosition(t,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T,stroke:k,"stroke-dasharray":d.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T+2,stroke:h}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:m,r:T,fill:k}).classed("spikeline",!0)}if(f){var S,C,O=e.vLinePoint;n=O&&O.xa,a=O&&O.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+O.x,C=a._offset+O.y);var D,z,P=i.readability(O.color,h)<1.5?p.contrast(h):O.color,E=n.spikemode,I=n.spikethickness,R=n.spikecolor||P,F=g.getPxPosition(t,n);if(-1!==E.indexOf("toaxis")||-1!==E.indexOf("across")){if(-1!==E.indexOf("toaxis")&&(D=F,z=C),-1!==E.indexOf("across")){var N=n._counterDomainMin,B=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),B=Math.max(B,n.position)),D=s.t+(1-B)*s.h,z=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:z,"stroke-width":I,stroke:R,"stroke-dasharray":d.dashStyle(n.spikedash,I)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:z,"stroke-width":I+2,stroke:h}).classed("spikeline",!0).classed("crisp",!0)}-1!==E.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?I:-I),r:I,fill:R}).classed("spikeline",!0)}}}function I(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function R(t,e){return u.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":232,"../../lib/events":225,"../../lib/override_cursor":243,"../../lib/svg_text_utils":253,"../../plots/cartesian/axes":277,"../../registry":324,"../color":104,"../dragelement":123,"../drawing":126,"../legend/defaults":156,"../legend/draw":157,"./constants":138,"./helpers":140,d3:21,"fast-isnumeric":23,tinycolor2:87}],142:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),i=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function l(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&i(e.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),e.legend?(o.bgcolor||(o.bgcolor=a.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":232,"../color":104,"./helpers":140}],143:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function i(r,i){return void 0!==e[r]?e[r]:n.coerce(t,e,a,r,i)}var o,l=i("clickmode");return e._has("cartesian")?l.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===k("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===k("roworder"),w=d?.2:.1,T=d?.3:.1;g&&e._splomGridDflt&&(x=e._splomGridDflt.xside,b=e._splomGridDflt.yside),v._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,m,_)}}else delete e.grid}function k(t,e){return n.coerce(r,v,s,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=t.grid||{},p=e._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(e,"legend");if(_("uirevision",e.uirevision),!1!==g){_("bgcolor",e.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",e.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(e.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemwidth"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",e.font))}}function _(t,e){return a.coerce(c,v,o,t,e)}}},{"../../lib":232,"../../plot_api/plot_template":266,"../../plots/layout_attributes":309,"../../registry":324,"./attributes":154,"./helpers":160}],157:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../registry"),l=t("../../lib/events"),s=t("../dragelement"),c=t("../drawing"),u=t("../color"),f=t("../../lib/svg_text_utils"),d=t("./handle_click"),p=t("./constants"),h=t("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=t("./get_legend_data"),x=t("./style"),b=t("./helpers");function _(t,e,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(t,"plotly_legendclick",s))if(1===n)e._clickTimeout=setTimeout((function(){d(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==l.triggerHandler(t,"plotly_legenddoubleclick",s)&&d(r,t,n)}}function w(t,e,r){var n,i=t.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&e._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(t,"text","legendtext");g.attr("text-anchor","start").call(c.font,r.font).text(d?T(n,h):n);var v=r.itemwidth+2*p.itemGap;f.positionText(g,v,0),d?g.call(f.makeEditable,{gd:e,text:n}).call(M,t,e,r).on("edit",(function(n){this.text(T(n,h)).call(M,t,e,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",e,s,u)})):M(g,t,e,r)}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,i=e._context.doubleClickDelay,o=1,l=a.ensureSingle(t,"rect","legendtoggle",(function(t){e._context.staticPlot||t.style("cursor","pointer").attr("pointer-events","all"),t.call(u.fill,"rgba(0,0,0,0)")}));e._context.staticPlot||(l.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(e,r,t,o,n.event)}})))}function M(t,e,r,n){n._main||t.attr("data-notex",!0),f.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var a=t.select("g[class*=math-group]"),i=a.node();r||(r=e._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=t.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);if(n){var x=r.itemwidth+2*p.itemGap;f.positionText(h,x,-y)}else f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(e,r,n)}))}function A(t){return a.isRightAnchor(t)?"right":a.isCenterAnchor(t)?"center":"left"}function L(t){return a.isBottomAnchor(t)?"bottom":a.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,l=t._fullLayout,f="legend"+l._uid;if(e?(r=e.layer,f+="-hover"):((e=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;d=l.showlegend&&y(t.calcdata,e)}else{if(!e.entries)return;d=y(e.entries,e)}var h=l.hiddenlabels||[];if(e._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(t,"legend");var g=a.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),T=a.ensureSingleById(l._topdefs,"clipPath",f,(function(t){t.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));S.call(u.stroke,e.bordercolor).call(u.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),O=e.title;if(e._titleWidth=0,e._titleHeight=0,O.text){var D=a.ensureSingle(C,"text","legendtitletext");D.attr("text-anchor","start").call(c.font,O.font).text(O.text),M(D,C,t,e)}else C.selectAll(".legendtitletext").remove();var z=a.ensureSingle(g,"rect","scrollbar",(function(t){t.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),P=C.selectAll("g.groups").data(d);P.enter().append("g").attr("class","groups"),P.exit().remove();var E=P.selectAll("g.traces").data(a.identity);E.enter().append("g").attr("class","traces"),E.exit().remove(),E.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==h.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(x,t,e).each((function(){e._main&&n.select(this).call(k,t)})),a.syncOrAsync([i.previousPromises,function(){return function(t,e,r,a){var i=t._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.itemGap,h=a.itemwidth+2*d,g=2*(u+d),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(a);if(l)r.each((function(t){var e=t[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+e/2+d),a._height+=e,a._width=Math.max(a._width,t[0].width)})),x=h+a._width,a._width+=d+h+f,a._height+=g,s&&(e.each((function(t,e){c.setTranslate(this,0,e*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:S:k?M&&"right"===w?o.r+o.w:S:o.w,2*h);var C=0,O=0;r.each((function(t){var e=t[0].width+h;C=Math.max(C,e),O+=e})),x=null;var D=0;if(s){var z=0,P=0,E=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+d+n/2+e),e+=n,t=Math.max(t,h+r[0].width)})),z=Math.max(z,e);var r=t+d;r+u+P>a._maxWidth&&(D=Math.max(D,P),P=0,E+=z+a.tracegroupgap,z=e),c.setTranslate(this,P,E),P+=r})),a._width=Math.max(D,P)+u,a._height=E+z+g}else{var I=r.size(),R=O+f+(I-1)*d=a._maxWidth&&(D=Math.max(D,H),N=0,B+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+B+e/2+d),H=N+r+d,N+=n,F=Math.max(F,e)})),R?(a._width=N+f,a._height=F+g):(a._width=Math.max(D,H)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var j=t._context.edits,U=j.legendText||j.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,a=U?h:x||h+t[0].width;l||(a+=d/2),c.setRect(e,0,-r/2,a,r)}))}(t,P,E,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=A(e),n=L(e);return i.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*v[r],r:e._width*m[r],b:e._effHeight*m[n],t:e._effHeight*v[n]})}(t)){var u,d,h,y,x=l._size,b=e.borderwidth,w=x.l+x.w*e.x-v[A(e)]*e._width,k=x.t+x.h*(1-e.y)-v[L(e)]*e._effHeight;if(e._main&&l.margin.autoexpand){var M=w,O=k;w=a.constrain(w,0,l.width-e._width),k=a.constrain(k,0,l.height-e._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==O&&a.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&c.setTranslate(g,w,k),z.on(".drag",null),g.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var D=e._effHeight;e._main||(D=e._height),S.attr({width:e._width-b,height:D-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:e._width-2*b,height:D-2*b,x:b,y:b}),c.setClipUrl(C,f,t),c.setRect(z,0,0,0,0),delete e._scrollY}else{var P,E,I,R=Math.max(p.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),F=e._effHeight-R-2*p.scrollBarMargin,N=e._height-e._effHeight,B=F/N,H=Math.min(e._scrollY||0,N);S.attr({width:e._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:e._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:e._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:e._effHeight-2*b,x:b,y:b+H}),c.setClipUrl(C,f,t),V(H,R,B),g.on("wheel",(function(){V(H=a.constrain(e._scrollY+n.event.deltaY/F*N,0,N),R,B),0!==H&&H!==N&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;P="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,I=H})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(E="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,V(H=function(t,e,r){var n=(r-e)/B+t;return a.constrain(n,0,N)}(I,P,E),R,B))}));z.call(j);var U=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(P=t.changedTouches[0].clientY,I=H)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(E=t.changedTouches[0].clientY,V(H=function(t,e,r){var n=(e-r)/B+t;return a.constrain(n,0,N)}(I,P,E),R,B))}));C.call(U)}if(t._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:t,prepFn:function(){var t=c.getTranslate(g);h=t.x,y=t.y},moveFn:function(t,r){var n=h+t,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,e.xanchor),d=s.align(a,0,x.t+x.h,x.t,e.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",t,{"legend.x":u,"legend.y":d})},clickFn:function(e,n){var a=r.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}));a.size()>0&&_(t,g,a,e,n)}})}function V(r,n,a){e._scrollY=t._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(z,e._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],t)}}},{"../../constants/alignment":206,"../../lib":232,"../../lib/events":225,"../../lib/svg_text_utils":253,"../../plots/plots":311,"../../registry":324,"../color":104,"../dragelement":123,"../drawing":126,"./constants":155,"./get_legend_data":158,"./handle_click":159,"./helpers":160,"./style":162,d3:21}],158:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=e._main;function p(t,r){if(""!==t&&a.isGrouped(e))-1===l.indexOf(t)?(l.push(t),s=!0,o[t]=[[r]]):o[t].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=e.width}return v?n:Math.min(a,r)};function _(t,e,r){var i=t[0].trace,o=i.marker||{},l=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(c?[t]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),u.exit().remove(),u.each((function(t){var e=n.select(this),r=t[0],a=b(r.mlw,o.line,5,2);e.style("stroke-width",a+"px").call(s.fill,r.mc||o.color),a&&s.stroke(e,r.mlc||l.color)}))}function w(t,e,r){var o=t[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(s?[t]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),c.exit().remove(),c.size()){var u=(l.marker||{}).line,p=b(d(u.width,o.pts),u,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=u.color;var g=i.minExtend(o,{trace:h});f(c,g,h)}}t.each((function(t){var e=n.select(this),a=i.ensureSingle(e,"g","layers");a.style("opacity",t[0].trace.opacity);var l=r.valign,s=t[0].lineHeight,c=t[0].height;if("middle"!==l&&s&&c){var u={top:1,bottom:-1}[l]*(.5*(s-c+3));a.attr("transform",o(0,u))}else a.attr("transform",null);a.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var f=a.selectAll("g.legendsymbols").data([t]);f.enter().append("g").classed("legendsymbols",!0),f.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,a=t[0].trace,o=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":o=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":o=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":o=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":o=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":o=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":o=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(o);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform",x).style("stroke-miterlimit",1),u.exit().remove(),u.each((function(t,o){var u,f=n.select(this),d=c(a),p=d.colorscale,g=d.reversescale;if(p){if(!r){var v=p.length;u=0===o?p[g?v-1:0][1]:1===o?p[g?0:v-1][1]:p[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[o]||m[0]:m}f.attr("d",t[0]),u?f.call(s.fill,u):f.call((function(t){if(t.size()){var n="legendfill-"+a.uid;l.gradient(t,e,n,h(g,"radial"===r),p,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var a=t[0].trace[t[0].dir].marker;return t[0].mc=a.color,t[0].mlw=a.line.width,t[0].mlc=a.line.color,_(t,this,"waterfall")}var i=[];e.visible&&r&&(i=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform",x).style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),a=e[t[0]].marker,i=b(void 0,a.line,5,2);r.attr("d",t[1]).style("stroke-width",i+"px").call(s.fill,a.color),i&&r.call(s.stroke,a.line.color)}))})).each((function(t){_(t,this,"funnel")})).each((function(t){_(t,this)})).each((function(t){var r=t[0].trace,o=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[t]:[]);o.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),o.exit().remove(),o.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==s.opacity(r.fillcolor)||0!==s.opacity((r.line||{}).color)){var a=b(void 0,r.line,5,2);t.style("stroke-width",a+"px").call(s.fill,r.fillcolor),a&&s.stroke(t,r.line.color)}else{var c=i.minExtend(r,{marker:{size:v?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});o.call(l.pointStyle,c,e)}}))})).each((function(t){w(t,this,"funnelarea")})).each((function(t){w(t,this,"pie")})).each((function(t){var r,a,o=t[0],s=o.trace,f=s.visible&&s.fill&&"none"!==s.fill,d=u.hasLines(s),p=s.contours,g=!1,v=!1,y=c(s),x=y.colorscale,_=y.reversescale;if(p){var w=p.coloring;"lines"===w?g=!0:d="none"===w||"heatmap"===w||p.showlines,"constraint"===p.type?f="="!==p._operation:"fill"!==w&&"heatmap"!==w||(v=!0)}var T=u.hasMarkers(s)||u.hasText(s),k=f||v,M=d||g,A=T||!k?"M5,0":M?"M5,-2":"M5,-3",L=n.select(this),S=L.select(".legendfill").selectAll("path").data(f||v?[t]:[]);if(S.enter().append("path").classed("js-fill",!0),S.exit().remove(),S.attr("d",A+"h"+m+"v6h-"+m+"z").call(f?l.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+s.uid;l.gradient(t,e,r,h(_),x,"fill")}}),d||g){var C=b(void 0,s.line,10,5);a=i.minExtend(s,{line:{width:C}}),r=[i.minExtend(o,{trace:a})]}var O=L.select(".legendlines").selectAll("path").data(d||g?[r]:[]);O.enter().append("path").classed("js-line",!0),O.exit().remove(),O.attr("d",A+(g?"l"+m+",0.0001":"h"+m)).call(d?l.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+s.uid;l.lineGroupStyle(t),l.gradient(t,e,r,h(_),x,"stroke")}})})).each((function(t){var r,a,o=t[0],s=o.trace,c=u.hasMarkers(s),f=u.hasText(s),d=u.hasLines(s);function p(t,e,r,n){var a=i.nestedProperty(s,t).get(),o=i.isArrayOrTypedArray(a)&&e?e(a):a;if(v&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function h(t){return o._distinct&&o.index&&t[o.index]?t[o.index]:t[0]}if(c||f||d){var g={},m={};if(c){g.mc=p("marker.color",h),g.mx=p("marker.symbol",h),g.mo=p("marker.opacity",i.mean,[.2,1]),g.mlc=p("marker.line.color",h),g.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);g.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",h,[0,10],5)}),f&&(g.tx="Aa",g.tp=p("textposition",h),g.ts=10,g.tc=p("textfont.color",h),g.tf=p("textfont.family",h)),r=[i.minExtend(o,g)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var b=n.select(this).select("g.legendpoints"),_=b.selectAll("path.scatterpts").data(c?r:[]);_.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",x),_.exit().remove(),_.call(l.pointStyle,a,e),c&&(r[0].mrc=3);var w=b.selectAll("g.pointtext").data(f?r:[]);w.enter().append("g").classed("pointtext",!0).append("text").attr("transform",x),w.exit().remove(),w.selectAll("text").call(l.textPointStyle,a,e)})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.visible&&"candlestick"===e.type?[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",x).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var a=n.select(this),i=e[r?"increasing":"decreasing"],o=b(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(s.fill,i.fillcolor),o&&s.stroke(a,i.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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",x).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var a=n.select(this),i=e[r?"increasing":"decreasing"],o=b(void 0,i.line,5,2);a.style("fill","none").call(l.dashLine,i.line.dash,o),o&&s.stroke(a,i.line.color)}))}))}},{"../../lib":232,"../../registry":324,"../../traces/pie/helpers":437,"../../traces/pie/style_one":443,"../../traces/scatter/subtypes":470,"../color":104,"../colorscale/helpers":115,"../drawing":126,"./constants":155,d3:21}],163:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/plots"),i=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),l=t("../shapes/draw").eraseActiveShape,s=t("../../lib"),c=s._,u=e.exports={};function f(t,e){var r,a,o=e.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=t._fullLayout,u={},f=i.list(t,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var g=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),a=0,i=0;i=n.max)e=F[r+1];else if(t=n.pmax)e=F[r+1];else if(t0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(t,e,r,n,a){var l="category"===t.type||"multicategory"===t.type?t.r2c:t.d2c;if(void 0!==e)return[l(e),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===t.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]: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;oy?(k=f,S="y0",M=y,C="y1"):(k=y,S="y1",M=f,C="y0");W(n),$(l,r),function(t,e,r){var n=e.xref,a=e.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(t,s?"clip"+r._fullLayout._uid+s:null,r)}(e,r,t),X.moveFn="move"===P?Q:J,X.altKey=n.altKey},doneFn:function(){if(m(t))return;p(e),K(l),b(e,t,r),n.call("_guiRelayout",t,s.getUpdateObj())},clickFn:function(){if(m(t))return;K(l)}};function W(r){if(m(t))P=null;else if(R)P="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=X.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(e,s),P=s.split("-")[0]}}function Q(n,a){if("path"===r.type){var i=function(t){return t},o=i,s=i;E?N("xanchor",r.xanchor=G(x+n)):(o=function(t){return G(V(t)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),I?N("yanchor",r.yanchor=Z(T+a)):(s=function(t){return Z(q(t)+a)},j&&"date"===j.type&&(s=g.encodeDate(s))),N("path",r.path=w(z,o,s))}else E?N("xanchor",r.xanchor=G(x+n)):(N("x0",r.x0=G(c+n)),N("x1",r.x1=G(v+n))),I?N("yanchor",r.yanchor=Z(T+a)):(N("y0",r.y0=Z(f+a)),N("y1",r.y1=Z(y+a)));e.attr("d",_(t,r)),$(l,r)}function J(n,a){if(F){var i=function(t){return t},o=i,s=i;E?N("xanchor",r.xanchor=G(x+n)):(o=function(t){return G(V(t)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),I?N("yanchor",r.yanchor=Z(T+a)):(s=function(t){return Z(q(t)+a)},j&&"date"===j.type&&(s=g.encodeDate(s))),N("path",r.path=w(z,o,s))}else if(R){if("resize-over-start-point"===P){var u=c+n,d=I?f-a:f+a;N("x0",r.x0=E?u:G(u)),N("y0",r.y0=I?d:Z(d))}else if("resize-over-end-point"===P){var p=v+n,h=I?y-a:y+a;N("x1",r.x1=E?p:G(p)),N("y1",r.y1=I?h:Z(h))}}else{var m=function(t){return-1!==P.indexOf(t)},b=m("n"),H=m("s"),U=m("w"),Y=m("e"),X=b?k+a:k,W=H?M+a:M,Q=U?A+n:A,J=Y?L+n:L;I&&(b&&(X=k-a),H&&(W=M-a)),(!I&&W-X>10||I&&X-W>10)&&(N(S,r[S]=I?X:Z(X)),N(C,r[C]=I?W:Z(W))),J-Q>10&&(N(O,r[O]=E?Q:G(Q)),N(D,r[D]=E?J:G(J)))}e.attr("d",_(t,r)),$(l,r)}function $(t,e){(E||I)&&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 i=V(E?e.xanchor:a.midRange(r?[e.x0,e.x1]:g.extractPathCoords(e.path,h.paramIsX))),o=q(I?e.yanchor:a.midRange(r?[e.y0,e.y1]:g.extractPathCoords(e.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),E&&I){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(E){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function K(t){t.selectAll(".visual-cue").remove()}d.init(X),Y.node().onmousemove=W}(t,E,s,e,r,P):!0===s.editable&&E.style("pointer-events",D||c.opacity(L)*A<=.5?"stroke":"all");E.node().addEventListener("click",(function(){return function(t,e){if(!y(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void T(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=T,v(t)}}(t,E)}))}}function b(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");u.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function _(t,e){var r,n,o,l,s,c,u,f,d=e.type,p=i.getRefType(e.xref),v=i.getRefType(e.yref),m=i.getFromId(t,e.xref),y=i.getFromId(t,e.yref),x=t._fullLayout._size;if(m?"domain"===p?n=function(t){return m._offset+m._length*t}:(r=g.shapePositionToRange(m),n=function(t){return m._offset+m.r2p(r(t,!0))}):n=function(t){return x.l+x.w*t},y?"domain"===v?l=function(t){return y._offset+y._length*(1-t)}:(o=g.shapePositionToRange(y),l=function(t){return y._offset+y.r2p(o(t,!0))}):l=function(t){return x.t+x.h*(1-t)},"path"===d)return m&&"date"===m.type&&(n=g.decodeDate(n)),y&&"date"===y.type&&(l=g.decodeDate(l)),function(t,e,r){var n=t.path,i=t.xsizemode,o=t.ysizemode,l=t.xanchor,s=t.yanchor;return n.replace(h.segmentRE,(function(t){var n=0,c=t.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=t.substr(1).replace(h.paramRE,(function(t){return u[n]?t="pixel"===i?e(l)+Number(t):e(t):f[n]&&(t="pixel"===o?r(s)-Number(t):r(t)),++n>d&&(t="X"),t}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+t)),c+p}))}(e,n,l);if("pixel"===e.xsizemode){var b=n(e.xanchor);s=b+e.x0,c=b+e.x1}else s=n(e.x0),c=n(e.x1);if("pixel"===e.ysizemode){var _=l(e.yanchor);u=_-e.y0,f=_-e.y1}else u=l(e.y0),f=l(e.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var w=(s+c)/2,T=(u+f)/2,k=Math.abs(w-s),M=Math.abs(T-u),A="A"+k+","+M,L=w+k+","+T;return"M"+L+A+" 0 1,1 "+(w+","+(T-M))+A+" 0 0,1 "+L+"Z"}function w(t,e,r){return t.replace(h.segmentRE,(function(t){var n=0,a=t.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+t.substr(1).replace(h.paramRE,(function(t){return n>=l||(i[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function T(t){y(t)&&(t._fullLayout._activeShapeIndex>=0&&(s(t),delete t._fullLayout._activeShapeIndex,v(t)))}e.exports={draw:v,drawOne:x,eraseActiveShape:function(t){if(!y(t))return;s(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&f(m),r.attr("d",g(e)),M&&!d)&&(k=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===T&&(t[0][0]="M"),e[w]=t,y(),x())}}()}}function z(t,r){!function(t,r){if(e.length)for(var n=0;n0&&s0&&(l=l.transition().duration(e.transition.duration).ease(e.transition.easing)),l.attr("transform",s(o-.5*f.gripWidth,e._dims.currentValueTotalHeight))}}function S(t,e){var r=t._dims;return r.inputAreaStart+f.stepInset+(r.inputAreaLength-2*f.stepInset)*Math.min(1,Math.max(0,e))}function C(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-f.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*f.stepInset-2*r.inputAreaStart)))}function O(t,e,r){var n=r._dims,a=l.ensureSingle(t,"rect",f.railTouchRectClass,(function(n){n.call(M,e,t,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,f.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function D(t,e){var r=e._dims,n=r.inputAreaLength-2*f.railInset,a=l.ensureSingle(t,"rect",f.railRectClass);a.attr({width:n,height:f.railWidth,rx:f.railRadius,ry:f.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,e.bordercolor).call(i.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(a,f.railInset,.5*(r.inputAreaWidth-f.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[f.name],n=[],a=0;a0?[0]:[]);function l(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),a.autoMargin(t,v(e))}if(i.enter().append("g").classed(f.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+f.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+f.groupClassName).data(r,m);s.enter().append("g").classed(f.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||d<0){var m={left:[-h,0],right:[h,0],top:[0,-h],bottom:[0,h]}[b.side];e.attr("transform",s(m[0],m[1]))}}}return I.call(R),P&&(S?I.on(".opacity",null):(M=0,A=!0,I.text(y).on("mouseover.opacity",(function(){n.select(this).transition().duration(d.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(d.HIDE_PLACEHOLDER).style("opacity",0)}))),I.call(f.makeEditable,{gd:t}).on("edit",(function(e){void 0!==x?o.call("_guiRestyle",t,m,e,x):o.call("_guiRelayout",t,m,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(R)})).on("input",(function(t){this.text(t||" ").call(f.positionText,_.x,_.y)}))),I.classed("js-placeholder",A),T}}},{"../../constants/alignment":206,"../../constants/interactions":210,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/plots":311,"../../registry":324,"../color":104,"../drawing":126,d3:21,"fast-isnumeric":23}],200:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll,l=t("../../plots/pad_attributes"),s=t("../../plot_api/plot_template").templatedArray,c=s("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"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});e.exports=o(s("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:c,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:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":226,"../../plot_api/edit_types":259,"../../plot_api/plot_template":266,"../../plots/font_attributes":305,"../../plots/pad_attributes":310,"../color/attributes":103}],201:[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"}}},{}],202:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/array_container_defaults"),i=t("./attributes"),o=t("./constants").name,l=i.buttons;function s(t,e,r){function o(r,a){return n.coerce(t,e,i,r,a)}o("visible",a(t,e,{name:"buttons",handleItemDefaults:c}).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 c(t,e){function r(r,a){return n.coerce(t,e,l,r,a)}r("visible","skip"===t.method||Array.isArray(t.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}e.exports=function(t,e){a(t,e,{name:o,handleItemDefaults:s})}},{"../../lib":232,"../../plots/array_container_defaults":272,"./attributes":200,"./constants":201}],203:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=t("../color"),o=t("../drawing"),l=t("../../lib"),s=t("../../lib/svg_text_utils"),c=t("../../plot_api/plot_template").arrayEditor,u=t("../../constants/alignment").LINE_SPACING,f=t("./constants"),d=t("./scrollbox");function p(t){return t._index}function h(t,e){return+t.attr(f.menuIndexAttrName)===e._index}function g(t,e,r,n,a,i,o,l){e.active=o,c(t.layout,f.name,e).applyUpdate("active",o),"buttons"===e.type?m(t,n,null,null,e):"dropdown"===e.type&&(a.attr(f.menuIndexAttrName,"-1"),v(t,n,a,i,e),l||m(t,n,a,i,e))}function v(t,e,r,n,a){var i=l.ensureSingle(e,"g",f.headerClassName,(function(t){t.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,t).call(A,a,d,p),l.ensureSingle(e,"text",f.headerArrowClassName,(function(t){t.attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(t,e,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(e,s.lx,s.ly)}function m(t,e,r,i,o){r||(r=e).attr("pointer-events","all");var s=function(t){return-1==+t.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,t).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(t,o,0,e,r,i,-1),a.executeAPICommand(t,l.method,l.args2)):(g(t,o,0,e,r,i,s),a.executeAPICommand(t,l.method,l.args))),t.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(m.openWidth,m.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(m.openHeight,m.headerHeight)),k.direction=o.direction,i&&(u.size()?function(t,e,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[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(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(t){t.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),k?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>T,D=l.barWidth+2*l.barPad,z=l.barLength+2*l.barPad,P=h+g,E=v;P+D>s&&(P=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),O?(this.vbar=I.attr({rx:l.barRadius,ry:l.barRadius,x:P,y:E,width:D,height:z}),this._vbarYMin=E+z/2,this._vbarTranslateMax=T-z):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,N=O?f+D+.5:f+.5,B=d-.5,H=k?p+A+.5:p+.5,j=o._topdefs.selectAll("#"+R).data(k||O?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",R).append("rect"),k||O?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||O){var U=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(U);var V=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(V),O&&this.vbar.on(".drag",null).call(V)}this.setTranslate(e,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.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)},l.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)},l.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)},l.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,a=r+this._hbarTranslateMax;t=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,l=i+this._vbarTranslateMax;e=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(t,e)},l.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(i.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 a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var l=e/n;this.vbar.call(i.setTranslate,t,e+l*this._vbarTranslateMax)}}},{"../../lib":232,"../color":104,"../drawing":126,d3:21}],206:[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"}}},{}],207:[function(t,e,r){"use strict";e.exports={axisRefDescription:function(t,e,r){return["If set to a",t,"axis id (e.g. *"+t+"* or","*"+t+"2*), the `"+t+"` position refers to a",t,"coordinate. If set to *paper*, the `"+t+"`","position refers to the distance from the",e,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",e,"("+r+"). If set to a",t,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",e,"of the domain of that axis: e.g.,","*"+t+"2 domain* refers to the domain of the second",t," axis and a",t,"position of 0.5 refers to the","point between the",e,"and the",r,"of the domain of the","second",t,"axis."].join(" ")}}},{}],208:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],209:[function(t,e,r){"use strict";e.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],210:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],211:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],212:[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}},{}],213:[function(t,e,r){"use strict";r.version=t("./version").version,t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config")();for(var n=t("./registry"),a=r.register=n.register,i=t("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],216:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],217:[function(t,e,r){"use strict";var n=t("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(t){return Math.abs(t[1]-t[0])>l-1e-14}function c(t,e){return i(e-t,l)}function u(t,e){if(s(e))return!0;var r,n;e[0](n=a(n,l))&&(n+=l);var i=a(t,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(t,e,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(t,e){return[t*Math.cos(e)+a,i-t*Math.sin(e)]}g?(u=0,f=o,d=l):r=a&&t<=i);var a,i},pathArc:function(t,e,r,n,a){return f(null,t,e,r,n,a,0)},pathSector:function(t,e,r,n,a){return f(null,t,e,r,n,a,1)},pathAnnulus:function(t,e,r,n,a,i){return f(t,e,r,n,a,i,1)}}},{"./mod":239}],218:[function(t,e,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(t){return a.isView(t)&&!(t instanceof i)}function l(t){return n(t)||o(t)}function s(t,e,r){if(l(t)){if(l(t[0])){for(var n=r,a=0;aa.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every((function(t){return a(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(u(+t,360)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r,n){var a=n.regex||c(r);"string"==typeof t&&a.test(t)?e.set(t):e.set(r)},validateFunction:function(t,e){var r=e.dflt;return t===r||"string"==typeof t&&!!c(r).test(t)}},flaglist:{coerceFunction:function(t,e,r,n){if("string"==typeof t)if(-1===(n.extras||[]).indexOf(t)){for(var a=t.split("+"),i=0;i=n&&t<=a?t:u}if("string"!=typeof t&&"number"!=typeof t)return u;t=String(t);var c=_(e),m=t.charAt(0);!c||"G"!==m&&"g"!==m||(t=t.substr(1),e="");var w=c&&"chinese"===e.substr(0,7),T=t.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),L=Number(T[7]||0),S=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var O;k=Number(k);try{var D=v.getComponentMethod("calendars","getCal")(e);if(w){var z="i"===M.charAt(M.length-1);M=parseInt(M,10),O=D.newDate(k,D.toMonthIndex(k,M,z),A)}else O=D.newDate(k,Number(M),A)}catch(t){return u}return O?(O.toJD()-g)*f+L*d+S*p+C*h:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var P=new Date(Date.UTC(2e3,M,A,L,S));return P.setUTCFullYear(k),P.getUTCMonth()!==M||P.getUTCDate()!==A?u:P.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==u};var T=90*f,k=3*d,M=5*p;function A(t,e,r,n,a){if((e||r||n||a)&&(t+=" "+w(e,2)+":"+w(r,2),(n||a)&&(t+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;t+="."+w(a,i)}return t}r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=n&&t<=a))return u;e||(e=0);var i,o,l,c,y,x,b=Math.floor(10*s(t+.05,1)),w=Math.round(t-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(t,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(t){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=n+f&&t<=a-f))return u;var e=Math.floor(10*s(t+.05,1)),r=new Date(Math.round(t-e/10));return A(i("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,n){if(t===u)return e;if(r.isJSDate(t)||"number"==typeof t&&isFinite(t)){if(_(n))return l.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 l.error("unrecognized date",t),e;return t};var L=/%\d?f/g;function S(t,e,r,n){t=t.replace(L,(function(t){var r=Math.min(+t.charAt(1)||6,6);return(e/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(e+.05));if(_(n))try{t=v.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,n,a,i){if(a=_(a)&&a,!e)if("y"===r)e=i.year;else if("m"===r)e=i.month;else{if("d"!==r)return function(t,e){var r=s(t+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==e){o(e)||(e=0);var a=(100+Math.min(s(t/h,60),C[e])).toFixed(e).substr(1);e>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(t,r)+"\n"+S(i.dayMonthYear,t,n,a);e=i.dayMonth+"\n"+i.year}return S(e,t,n,a)};var O=3*f;r.incrementMonth=function(t,e,r){r=_(r)&&r;var n=s(t,f);if(t=Math.round(t-n),r)try{var a=Math.round(t/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return e%12?i.add(o,e,"m"):i.add(o,e/12,"y"),(o.toJD()-g)*f+n}catch(e){l.error("invalid ms "+t+" in calendar "+r)}var c=new Date(t+O);return c.setUTCMonth(c.getUTCMonth()+e)+n-O},r.findExactDates=function(t,e){for(var r,n,a=0,i=0,l=0,s=0,c=_(e)&&v.getComponentMethod("calendars","getCal")(e),u=0;u1||g<0||g>1?null:{x:t+s*g,y:e+f*g}}function s(t,e,r,n,a){var i=n*t+a*e;if(i<0)return n*n+a*a;if(i>r){var o=n-t,l=a-e;return o*o+l*l}var s=n*e-a*t;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(t,e,r,n,a,i,o,c){if(l(t,e,r,n,a,i,o,c))return 0;var u=r-t,f=n-e,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-t,i-e),s(u,f,h,o-t,c-e),s(d,p,g,t-a,e-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(t,e,r,l){if(t===a&&l===i||(n={},a=t,i=l),n[r])return n[r];var s=t.getPointAtLength(o(r-l/2,e)),c=t.getPointAtLength(o(r+l/2,e)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=t.getPointAtLength(o(r,e)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(t,e,r){var n,a,i=e.left,o=e.right,l=e.top,s=e.bottom,c=0,u=t.getTotalLength(),f=u;function d(e){var r=t.getPointAtLength(e);0===e?n=r:e===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(t,e,r,n){for(var a,i,o,l=(n=n||{}).pathLength||t.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=t.getPointAtLength(0)[r]>t.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":239}],230:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],231:[function(t,e,r){"use strict";e.exports=function(t,e){if(!e)return t;var r=1/Math.abs(e),n=r>1?(r*t+r*e)/r:t+e,a=String(n).length;if(a>16){var i=String(e).length;if(a>=String(t).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],232:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../constants/numerical"),l=o.FP_SAFE,s=o.BADNUM,c=e.exports={};c.nestedProperty=t("./nested_property"),c.keyedContainer=t("./keyed_container"),c.relativeAttr=t("./relative_attr"),c.isPlainObject=t("./is_plain_object"),c.toLogRange=t("./to_log_range"),c.relinkPrivateKeys=t("./relink_private");var u=t("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=t("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var d=t("./coerce");c.valObjectMeta=d.valObjectMeta,c.coerce=d.coerce,c.coerce2=d.coerce2,c.coerceFont=d.coerceFont,c.coerceHoverinfo=d.coerceHoverinfo,c.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,c.validate=d.validate;var p=t("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var h=t("./search");c.findBin=h.findBin,c.sorterAsc=h.sorterAsc,c.sorterDes=h.sorterDes,c.distinctVals=h.distinctVals,c.roundUp=h.roundUp,c.sort=h.sort,c.findIndexOfMin=h.findIndexOfMin;var g=t("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var v=t("./matrix");c.init2dArray=v.init2dArray,c.transposeRagged=v.transposeRagged,c.dot=v.dot,c.translationMatrix=v.translationMatrix,c.rotationMatrix=v.rotationMatrix,c.rotationXYMatrix=v.rotationXYMatrix,c.apply3DTransform=v.apply3DTransform,c.apply2DTransform=v.apply2DTransform,c.apply2DTransform2=v.apply2DTransform2,c.convertCssMatrix=v.convertCssMatrix,c.inverseTransformMatrix=v.inverseTransformMatrix;var m=t("./angles");c.deg2rad=m.deg2rad,c.rad2deg=m.rad2deg,c.angleDelta=m.angleDelta,c.angleDist=m.angleDist,c.isFullCircle=m.isFullCircle,c.isAngleInsideSector=m.isAngleInsideSector,c.isPtInsideSector=m.isPtInsideSector,c.pathArc=m.pathArc,c.pathSector=m.pathSector,c.pathAnnulus=m.pathAnnulus;var y=t("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=t("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=t("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=t("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=t("./regex");c.counterRegex=w.counter;var T=t("./throttle");c.throttle=T.throttle,c.throttleDone=T.done,c.clearThrottle=T.clear;var k=t("./dom");function M(t){var e={};for(var r in t)for(var n=t[r],a=0;al?s:i(t)?Number(t):s:s},c.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(i(t)&&t>=0&&t%1==0)},c.noop=t("./noop"),c.identity=t("./identity"),c.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))},c.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},c.simpleMap=function(t,e,r,n,a){for(var i=t.length,o=new Array(i),l=0;l=Math.pow(2,r)?a>10?(c.warn("randstr failed uniqueness"),s):t(e,r,n,(a||0)+1):s},c.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},c.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,i,o=t.length,l=2*o,s=2*e-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=t[a]*c[n];u[r]=i}return u},c.syncOrAsync=function(t,e,r){var n;function a(){return c.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(a).then(void 0,c.promiseError);return r&&r(e)},c.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},c.noneOrAll=function(t,e,r){if(t){var n,a=!1,i=!0;for(n=0;n0?e:0}))},c.fillArray=function(t,e,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(t))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var D=/^\w*$/;c.templateString=function(t,e){var r={};return t.replace(c.TEMPLATE_STRING_REGEX,(function(t,n){var a;return D.test(n)?a=e[n]:(r[n]=r[n]||c.nestedProperty(e,n).get,a=r[n]()),c.isValidTextValue(a)?a:""}))};var z={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return I.apply(z,arguments)};var P={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return I.apply(P,arguments)};var E=/^[:|\|]/;function I(t,e,r){var i=this,o=arguments;e||(e={});var l={};return t.replace(c.TEMPLATE_STRING_REGEX,(function(t,s,u){var f,d,p,h;for(p=3;p=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var R=2e9;c.seedPseudoRandom=function(){R=2e9},c.pseudoRandom=function(){var t=R;return R=(69069*R+1)%4294967296,Math.abs(R-t)<429496729?c.pseudoRandom():R/4294967296},c.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},a=c.extractOption(t,e,"htx","hovertext");if(c.isValidTextValue(a))return n(a);var i=c.extractOption(t,e,"tx","text");return c.isValidTextValue(i)?n(i):void 0},c.isValidTextValue=function(t){return t||0===t},c.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(u=1):u=0,c.strTranslate(a-u*(r+o),i-u*(n+l))+c.strScale(u)+(s?"rotate("+s+(e?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(t,e){var r=c.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r},c.join2=function(t,e,r){var n=t.length;return n>1?t.slice(0,-1).join(e)+r+t[n-1]:t.join(e)}},{"../constants/numerical":211,"./anchor_utils":216,"./angles":217,"./array":218,"./clean_number":219,"./clear_responsive":221,"./coerce":222,"./dates":223,"./dom":224,"./extend":226,"./filter_unique":227,"./filter_visible":228,"./geometry2d":229,"./identity":230,"./increment":231,"./is_plain_object":233,"./keyed_container":234,"./localize":235,"./loggers":236,"./make_trace_groups":237,"./matrix":238,"./mod":239,"./nested_property":240,"./noop":241,"./notifier":242,"./push_unique":245,"./regex":247,"./relative_attr":248,"./relink_private":249,"./search":250,"./stats":252,"./throttle":254,"./to_log_range":255,d3:21,"d3-time-format":19,"fast-isnumeric":23}],233:[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}},{}],234:[function(t,e,r){"use strict";var n=t("./nested_property"),a=/^\w*$/;e.exports=function(t,e,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};e&&e.length?(s=n(t,e),l=s.get()):l=t,e=e||"";var u={};if(l)for(o=0;o2)return c[e]=2|c[e],d.set(t,null);if(f){for(o=e;o1){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},i.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},i.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":264,"./notifier":242}],237:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var a=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=t.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(t){t[0][i]=n.select(this)})),a}},{d3:21}],238:[function(t,e,r){"use strict";var n=t("gl-mat4");r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],240:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./array").isArrayOrTypedArray;function i(t,e){return function(){var r,n,o,l,s,c=t;for(l=0;l/g),s=0;si||c===a||cl)&&(!e||!s(t))}:function(t,e){var s=t[0],c=t[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(t,e){var r=[t[0]],n=0,a=0;function o(o){t.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":211,"./matrix":238}],245:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){for(var r=e.toString(),n=0;na.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 i,o,f=0,d=e.length,p=0,h=d>1?(e[d-1]-e[0])/(d-1):1;for(o=h>=0?r?l:s:r?u:c,t+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.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,e){var n,a=(e||{}).unitMinDiff,i=t.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var l=1;a||(l=i[n]-i[0]||1);for(var s,c=l/(n||1)/1e4,u=[],f=0;f<=n;f++){var d=i[f],p=d-s;void 0===s?(u.push(d),s=d):p>c&&(l=Math.min(l,p),u.push(d),s=d)}return{vals:u,minDiff:l}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return t.sort(e)}return n?t:t.reverse()},r.findIndexOfMin=function(t,e){e=e||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(e)||(e=!1),a(i[0])){for(s=new Array(o),l=0;lt.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"./array":218,"fast-isnumeric":23}],253:[function(t,e,r){"use strict";var n=t("d3"),a=t("../lib"),i=a.strTranslate,o=t("../constants/xmlns_namespaces"),l=t("../constants/alignment").LINE_SPACING;function s(t,e){return t.node().getBoundingClientRect()[e]}var c=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,A){var L=t.text(),C=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&L.match(c),O=n.select(t.node().parentNode);if(!O.empty()){var D=t.attr("class")?t.attr("class").split(" ")[0]:"text";return D+="-math",O.selectAll("svg."+D).remove(),O.selectAll("g."+D+"-group").remove(),t.style("display",null).attr({"data-unformatted":L,"data-math":"N"}),C?(e&&e._promises||[]).push(new Promise((function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),o={fontSize:r};!function(t,e,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=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(f,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var e=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",t),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),e,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(C[2],o,(function(n,a,o){O.selectAll("svg."+D).remove(),O.selectAll("g."+D+"-group").remove();var l=n&&n.select("svg");if(!l||!l.node())return z(),void e();var c=O.append("g").classed(D+"-group",!0).attr({"pointer-events":"none","data-unformatted":L,"data-math":"Y"});c.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:D,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=t.node().style.fill||"black",f=l.select("g");f.attr({fill:u,stroke:u});var d=s(f,"width"),p=s(f,"height"),h=+t.attr("x")-d*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],g=-(r||s(t,"height"))/4;"y"===D[0]?(c.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+")"+i(-d/2,g-p/2)}),l.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===D[0]?l.attr({x:t.attr("x"),y:g-p/2}):"a"===D[0]&&0!==D.indexOf("atitle")?l.attr({x:0,y:g}):l.attr({x:h,y:+t.attr("y")+g-p/2}),A&&A.call(t,c),e(c)}))}))):z(),t}function z(){O.empty()||(D=t.attr("class")+"-math",O.select("svg."+D).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(v," ");var r,i=!1,s=[],c=-1;function u(){c++;var e=document.createElementNS(o.svg,"tspan");n.select(e).attr({class:"line",dy:c*l+"em"}),t.appendChild(e),r=e;var a=s;if(s=[{node:e}],a.length>1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",e)}x.test(e)?u():(r=t,s=[{node:t}]);for(var C=e.split(m),O=0;O|>|>)/g;var d={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"},p={sub:"0.3em",sup:"-0.6em"},h={sub:"-0.21em",sup:"0.42em"},g=["http:","https:","mailto:","",void 0,":"],v=r.NEWLINES=/(\r\n?|\n)/g,m=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,x=//i;r.BR_TAG_ALL=//gi;var b=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,_=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,T=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function k(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&S(n)}var M=/(^|;)\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"],a="...".length,i=t.split(m),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var A={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},L=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function S(t){return t.replace(L,(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)):A[e])||t}))}function C(t,e,r){var n,i,o,l=r.horizontalAlign,s=r.verticalAlign||"top",c=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return c.bottom-n.height}:"middle"===s?function(){return c.top+(c.height-n.height)/2}:function(){return c.top},o="right"===l?function(){return c.right-n.width}:"center"===l?function(){return c.left+(c.width-n.width)/2}:function(){return c.left},function(){n=this.node().getBoundingClientRect();var t=o()-u.left,e=i()-u.top,l=r.gd||{};if(r.gd){l._fullLayout._calcInverseTransform(l);var s=a.apply3DTransform(l._fullLayout._invTransform)(t,e);t=s[0],e=s[1]}return this.style({top:e+"px",left:t+"px","z-index":1e3}),this}}r.convertEntities=S,r.sanitizeHTML=function(t){t=t.replace(v," ");for(var e=document.createElement("p"),r=e,a=[],i=t.split(m),o=0;oi.ts+e?s():i.timer=setTimeout((function(){s(),i.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)a(n[t]),delete n[t];else for(var e in n)r.clear(e)}},{}],255:[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":23}],256:[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"}}},{}],257:[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"}}},{}],258:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=t.split("[")[0],l=0;l0&&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 i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(t);for(e=0;e3?(P.x=1.02,P.xanchor="left"):P.x<-2&&(P.x=-.02,P.xanchor="right"),P.y>3?(P.y=1.02,P.yanchor="bottom"):P.y<-2&&(P.y=-.02,P.yanchor="top")),h(t),"rotate"===t.dragmode&&(t.dragmode="orbit"),c.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=b(e);r;){if(r in t)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1&&i.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 i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),p(t),!0)}var x,b,_,w,T,k,M,A,L=Object.keys(r).map(Number).sort(o),S=e.get(),C=S||[],O=u(m,f).get(),D=[],z=-1,P=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?D.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),O&&O.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,k),-1===z&&(z=_);else for(b=0;b=0;x--)C.splice(D[x],1),O&&O.splice(D[x],1);if(C.length?S||e.set(C):e.set(null),g)return!1;if(d(v,m),h!==a){var E;if(-1===z)E=L;else{for(P=Math.max(C.length,P),E=[],x=0;x=z);x++)E.push(_);for(x=z;x=t.data.length||a<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function E(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]),P(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&P(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function I(t,e,r,n,i){!function(t,e,r,n){var a=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 i in P(t,r,"indices"),e){if(!Array.isArray(e[i])||e[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==e[i].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 i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=z(r,t.data.length-1),e)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(e,r){t[r]=t[e],delete t[e]}}function V(t,e,r){if(t=o.getGraphDiv(t),T.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 a=W(t,n),i=a.flags;i.calc&&(t.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(k.layoutReplot):Object.keys(n).length&&(q(t,i,a)||d.supplyDefaults(t),i.legend&&l.push(k.doLegend),i.layoutstyle&&l.push(k.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(k.doTicksRelayout),i.modebar&&l.push(k.doModeBar),i.camera&&l.push(k.doCamera),i.colorbars&&l.push(k.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(t,V,[t,a.undoit],V,[t,a.redoit]);var s=o.syncOrAsync(l,t);return s&&s.then||(s=Promise.resolve(t)),s.then((function(){return t.emit("plotly_relayout",a.eventData),t}))}function q(t,e,r){var n=t._fullLayout;if(!e.axrange)return!1;for(var a in e)if("axrange"!==a&&e[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=t.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(t,e){var r=e?function(t){var r=[],n=!0;for(var a in e){var i=h.getFromId(t,a);if(r.push(a),-1!==(i.ticklabelposition||"").indexOf("inside")&&i._anchorAxis&&r.push(i._anchorAxis._id),i._matchGroup)for(var o in i._matchGroup)e[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(t,r,{skipTitle:n})}:function(t){return h.draw(t,"redraw")};t.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(t,e){var r,n,a,i=t.layout,s=t._fullLayout,c=s._guiEditing,d=B(s._preGUI,c),p=Object.keys(e),g=h.list(t),v=o.extendDeepAll({},e),m={};for(U(e),p=Object.keys(e),n=0;n0&&"string"!=typeof P.parts[I];)I--;var R=P.parts[I],F=P.parts[I-1]+"."+R,H=P.parts.slice(0,I).join("."),j=l(t.layout,H).get(),V=l(s,H).get(),q=P.get();if(void 0!==E){k[z]=E,L[z]="reverse"===R?E:N(q);var G=f.getLayoutValObject(s,P.parts);if(G&&G.impliedEdits&&null!==E)for(var W in G.impliedEdits)S(o.relativeAttr(z,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(z))if(E){S("autosize",null);var J="height"===z?"width":"height";S(J,s[J])}else s[z]=t._initialAutoSize[z];else if("autosize"===z)S("width",E?null:s.width),S("height",E?null:s.height);else if(F.match(Z))D(F),l(s,H+"._inputRange").set(null);else if(F.match(Y)){D(F),l(s,H+"._inputRange").set(null);var $=l(s,H).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else F.match(X)&&l(s,H+"._inputDomain").set(null);if("type"===R){C=j;var K="linear"===V.type&&"log"===E,tt="log"===V.type&&"linear"===E;if(K||tt){if(C&&C.range)if(V.autorange)K&&(C.range=C.range[1]>C.range[0]?[1,2]:[2,1]);else{var et=C.range[0],rt=C.range[1];K?(et<=0&&rt<=0&&S(H+".autorange",!0),et<=0?et=rt/1e6:rt<=0&&(rt=et/1e6),S(H+".range[0]",Math.log(et)/Math.LN10),S(H+".range[1]",Math.log(rt)/Math.LN10)):(S(H+".range[0]",Math.pow(10,et)),S(H+".range[1]",Math.pow(10,rt)))}else S(H+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[P.parts[0]]&&"radialaxis"===P.parts[1]&&delete s[P.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(t,V,E,S),u.getComponentMethod("images","convertCoords")(t,V,E,S)}else S(H+".autorange",!0),S(H+".range",null);l(s,H+"._inputRange").set(null)}else if(R.match(A)){var nt=l(s,z).get(),at=(E||{}).type;at&&"-"!==at||(at="linear"),u.getComponentMethod("annotations","convertCoords")(t,nt,at,S),u.getComponentMethod("images","convertCoords")(t,nt,at,S)}var it=w.containerArrayMatch(z);if(it){r=it.array,n=it.index;var ot=it.property,lt=G||{editType:"calc"};""!==n&&""===ot&&(w.isAddVal(E)?L[z]=null:w.isRemoveVal(E)?L[z]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",e)),M.update(_,lt),m[r]||(m[r]={});var st=m[r][n];st||(st=m[r][n]={}),st[ot]=E,delete e[z]}else"reverse"===R?(j.range?j.range.reverse():(S(H+".autorange",!0),j.range=[1,0]),V.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===z&&("lasso"===E||"select"===E)&&"lasso"!==q&&"select"!==q||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,P.set(E))}}for(r in m){w.applyContainerArrayChanges(t,d(i,r),m[r],_,d)||(_.plot=!0)}for(var ct in O){var ut=(C=h.getFromId(t,ct))&&C._constraintGroup;if(ut)for(var ft in _.calc=!0,ut)O[ft]||(h.getFromId(t,ft)._constraintShrinkable=!0)}return(Q(t)||e.height||e.width)&&(_.plot=!0),(_.plot||_.calc)&&(_.layoutReplot=!0),{flags:_,rangesAltered:O,undoit:L,redoit:k,eventData:v}}function Q(t){var e=t._fullLayout,r=e.width,n=e.height;return t.layout.autosize&&d.plotAutoSize(t,t.layout,e),e.width!==r||e.height!==n}function J(t,e,n,a){if(t=o.getGraphDiv(t),T.clearPromiseQueue(t),t.framework&&t.framework.isPolar)return Promise.resolve(t);o.isPlainObject(e)||(e={}),o.isPlainObject(n)||(n={}),Object.keys(e).length&&(t.changed=!0),Object.keys(n).length&&(t.changed=!0);var i=T.coerceTraceIndices(t,a),l=j(t,o.extendFlat({},e),i),s=l.flags,u=W(t,o.extendFlat({},n)),f=u.flags;(s.calc||f.calc)&&(t.calcdata=void 0),s.clearAxisTypes&&T.clearAxisTypes(t,i,n);var p=[];f.layoutReplot?p.push(k.layoutReplot):s.fullReplot?p.push(r.plot):(p.push(d.previousPromises),q(t,f,u)||d.supplyDefaults(t),s.style&&p.push(k.doTraceStyle),(s.colorbars||f.colorbars)&&p.push(k.doColorBars),f.legend&&p.push(k.doLegend),f.layoutstyle&&p.push(k.layoutStyles),f.axrange&&G(p,u.rangesAltered),f.ticks&&p.push(k.doTicksRelayout),f.modebar&&p.push(k.doModeBar),f.camera&&p.push(k.doCamera),p.push(S)),p.push(d.rehover,d.redrag),c.add(t,J,[t,l.undoit,u.undoit,l.traces],J,[t,l.redoit,u.redoit,l.traces]);var h=o.syncOrAsync(p,t);return h&&h.then||(h=Promise.resolve(t)),h.then((function(){return t.emit("plotly_update",{data:l.eventData,layout:u.eventData}),t}))}function $(t){return function(e){e._fullLayout._guiEditing=!0;var r=t.apply(null,arguments);return e._fullLayout._guiEditing=!1,r}}var K=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],tt=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function et(t,e){for(var r=0;r1;)if(n.pop(),void 0!==(r=l(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(t,e){for(var r=0;r=a.length?a[0]:a[t]:a}function s(t){return Array.isArray(i)?t>=i.length?i[0]:i[t]:i}function c(t,e){var r=0;return function(){if(t&&++r===e)return t()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){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,d.transition(t,e.frame.data,e.frame.layout,T.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 p(){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 h,g,v=0;function m(t){return Array.isArray(a)?v>=a.length?t.transitionOpts=a[v]:t.transitionOpts=a[0]:t.transitionOpts=a,v++,t}var y=[],x=null==e,b=Array.isArray(e);if(!x&&!b&&o.isPlainObject(e))y.push({type:"object",data:m(o.extendFlat({},e))});else if(x||-1!==["string","number"].indexOf(typeof e))for(h=0;h0&&kk)&&M.push(g);y=M}}y.length>0?function(e){if(0!==e.length){for(var a=0;a=0;n--)if(o.isPlainObject(e[n])){var g=e[n].name,v=(u[g]||h[g]||{}).name,m=e[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[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.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=e[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[t,l],p=[t,i];return c&&c.add(t,s,f,u,p),d.modifyFrames(t,i)},r.addTraces=function t(e,n,a){e=o.getGraphDiv(e);var i,l,s=[],u=r.deleteTraces,f=t,d=[e,s],p=[e,n];for(function(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!_(o))return!1;t=i[a][o]}else t=i[a]}else t=i}}return t}function _(t){return t===Math.round(t)&&t>=0}function w(){var t,e,r={};for(t in h(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[e[2]],l=3}else if("area"===t.type)a=u[o];else{var f=t._module;if(f||(f=(n.modules[t.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,e,l)},r.getLayoutValObject=function(t,e){return b(function(t,e){var r,a,i,l,s=t._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=e+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(t,e){o?n.nestedProperty(l[s],t).set(e):l[s+"."+t]=e}function f(){var t=l;return c(),t}return c(),{modifyBase:function(t,e){l[t]=e},modifyItem:u,getUpdateObj:f,applyUpdate:function(e,r){e&&u(e,r);var a=f();for(var i in a)n.nestedProperty(t,i).set(a[i])}}}},{"../lib":232,"../plots/attributes":273}],267:[function(t,e,r){"use strict";var n=t("d3"),a=t("../registry"),i=t("../plots/plots"),o=t("../lib"),l=t("../lib/clear_gl_canvases"),s=t("../components/color"),c=t("../components/drawing"),u=t("../components/titles"),f=t("../components/modebar"),d=t("../plots/cartesian/axes"),p=t("../constants/alignment"),h=t("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=t("../plots/cartesian/autorange").doAutoRange;function y(t,e,r){for(var n=0;n=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}function x(t){var e,a,l,u,h,g,v=t._fullLayout,m=v._size,x=m.p,_=d.list(t,"",!0);if(v._paperdiv.style({width:t._context.responsive&&v.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":v.width+"px",height:t._context.responsive&&v.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),t._context.setBackground(t,v.paper_bgcolor),r.drawMainTitle(t),f.manage(t),!v._has("cartesian"))return i.previousPromises(t);function T(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-x-n:e._offset+e._length+x+n:m.t+m.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+x+n:e._offset-x-n:m.l+m.w*(t.position||0)+n%1}for(e=0;e<_.length;e++){var k=(u=_[e])._anchorAxis;u._linepositions={},u._lw=c.crispRound(t,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,O=l.yaxis.domain,D=l.plotgroup;if(y(C,O,L)){var z=D.node(),P=l.bg=o.ensureSingle(D,"rect","bg");z.insertBefore(P.node(),z.childNodes[0]),A.push(a)}else D.select("rect.bg").remove(),L.push([C,O]),S||(M.push(a),A.push(a))}var E,I,R,F,N,B,H,j,U,V,q,G,Z,Y=v._bgLayer.selectAll(".bg").data(M);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(t){v._plots[t].bg=n.select(this)})),e=0;eT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var i=e[n],o=g(e,n,r);a(i)?(Array.isArray(e)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),t(i,o)):Array.isArray(i)&&v(i)&&t(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":232,"../plots/attributes":273,"../plots/plots":311,"./plot_config":264,"./plot_schema":265,"./plot_template":266}],269:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./plot_api"),i=t("../plots/plots"),o=t("../lib"),l=t("../snapshot/helpers"),s=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg"),u=t("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,d,p,h;function g(t){return!(t in e)||o.validate(e[t],f[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],d=t.layout||{},p=t.config||{},h={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),d=o.extendDeep({},t.layout),p=t._context,h=t._fullLayout||{}),!g("width")&&null!==e.width||!g("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Export format is not "+o.join2(f.format.values,", "," or ")+".");var v={};function m(t,r){return o.coerce(e,v,f,t,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),T=m("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},d);x?M.width=x:null===e.width&&n(h.width)&&(M.width=h.width),b?M.height=b:null===e.height&&n(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(k);function S(){return new Promise((function(t){setTimeout(t,l.getDelay(k._fullLayout))}))}function C(){return new Promise((function(t,e){var r=s(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function d(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),t(T?p:l.encodeJSON(p))}if(d(),"svg"===y)return t(T?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){a.plot(k,r,M,A).then(L).then(S).then(C).then((function(e){t(function(t){return T?t.replace(l.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":232,"../plots/plots":311,"../snapshot/helpers":328,"../snapshot/svgtoimg":330,"../snapshot/tosvg":332,"../version":492,"./plot_api":263,"fast-isnumeric":23}],270:[function(t,e,r){"use strict";var n=t("../lib"),a=t("../plots/plots"),i=t("./plot_schema"),o=t("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(t,e,r,a,i,o){o=o||[];for(var f=Object.keys(t),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,O=x.length,D=Array.isArray(k);if(D&&(O=Math.min(O,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var z=x[A].length;for(M=0;M<(D?Math.min(z,k[A].length):z);M++)L=D?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&Math.round(f)===f))return a;c=f}for(var d=e.calendar,p="start"===s,h="end"===s,g=t[r+"period0"],v=i(g,d)||0,m=[],y=a.length,x=0;xT;)w=o(w,-c,d);for(;w<=T;)w=o(w,c,d);_=o(w,-c,d)}else{for(w=v+(b=Math.round((T-v)/u))*u;w>T;)w-=u;for(;w<=T;)w+=u;_=w-u}m[x]=p?_:h?w:(_+w)/2}return m}},{"../../constants/numerical":211,"../../lib":232,"fast-isnumeric":23}],275:[function(t,e,r){"use strict";e.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],276:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").FP_SAFE,o=t("../../registry"),l=t("./axis_ids").getFromId;function s(t,e){var r,n,i=[],o=u(e,0),l=u(e,1),s=f(t,e),d=s.min,p=s.max;if(0===d.length||0===p.length)return a.simpleMap(e.range,e.r2l);var h=d[0].val,g=p[0].val;for(r=1;r0&&((w=L-o(y)-l(x))>S?T/w>C&&(b=y,_=x,C=T/w):T/L>C&&(b={val:y.val,pad:0},_={val:x.val,pad:0},C=T/L));if(h===g){var O=h-1,D=h+1;if(M)if(0===h)i=[0,1];else{var z=(h>0?p:d).reduce((function(t,e){return Math.max(t,l(e))}),0),P=h/(1-Math.min(.5,z/L));i=h>0?[0,P]:[P,0]}else i=A?[Math.max(0,O),Math.max(1,D)]:[O,D]}else M?(b.val>=0&&(b={val:0,pad:0}),_.val<=0&&(_={val:0,pad:0})):A&&(b.val-C*o(b)<0&&(b={val:0,pad:0}),_.val<=0&&(_={val:1,pad:0})),C=(_.val-b.val-c(e,y.val,x.val))/(L-o(b)-l(_)),i=[b.val-C*o(b),_.val+C*l(_)];return v&&i.reverse(),a.simpleMap(i,e.l2r||Number)}function c(t,e,r){var n=0;if(t.rangebreaks)for(var a=t.locateBreaks(e,r),i=0;i0?r.ppadplus:r.ppadminus)||r.ppad||0),L=M((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(h=1/0,v=-1/0,w)for(a=0;a0&&(h=o),o>v&&o-i&&(h=o),o>v&&o=z;a--)D(a);return{min:m,max:y,opts:r}},concatExtremes:f};function f(t,e,r){var n,a,i,o=e._id,s=t._fullData,c=t._fullLayout,u=[],h=[];function g(t,e){for(n=0;n=r&&(c.extrapad||!o)){l=!1;break}a(e,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(t.splice(s,1),s--)}if(l){var u=i&&0===e;t.push({val:e,pad:u?0:r,extrapad:!u&&o})}}function g(t){return n(t)&&Math.abs(t)=e}},{"../../constants/numerical":211,"../../lib":232,"../../registry":324,"./axis_ids":280,"fast-isnumeric":23}],277:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../registry"),l=t("../../lib"),s=l.strTranslate,c=t("../../lib/svg_text_utils"),u=t("../../components/titles"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("./layout_attributes"),h=t("./clean_ticks"),g=t("../../constants/numerical"),v=g.ONEMAXYEAR,m=g.ONEAVGYEAR,y=g.ONEMINYEAR,x=g.ONEMAXQUARTER,b=g.ONEAVGQUARTER,_=g.ONEMINQUARTER,w=g.ONEMAXMONTH,T=g.ONEAVGMONTH,k=g.ONEMINMONTH,M=g.ONEWEEK,A=g.ONEDAY,L=A/2,S=g.ONEHOUR,C=g.ONEMIN,O=g.ONESEC,D=g.MINUS_SIGN,z=g.BADNUM,P=t("../../constants/alignment"),E=P.MID_SHIFT,I=P.CAP_SHIFT,R=P.LINE_SPACING,F=P.OPPOSITE_SIDE,N=e.exports={};N.setConvert=t("./set_convert");var B=t("./axis_autotype"),H=t("./axis_ids");N.id2name=H.id2name,N.name2id=H.name2id,N.cleanId=H.cleanId,N.list=H.list,N.listIds=H.listIds,N.getFromId=H.getFromId,N.getFromTrace=H.getFromTrace;var j=t("./autorange");N.getAutoRange=j.getAutoRange,N.findExtremes=j.findExtremes;function U(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}N.coerceRef=function(t,e,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||("string"==typeof i?i:i[0])),i||(i=a),s=s.concat(s.map((function(t){return t+" domain"}))),u[c]={valType:"enumerated",values:s.concat(i?"string"==typeof i?[i]:i:[]),dflt:a},l.coerce(t,e,u,c)},N.getRefType=function(t){return void 0===t?t:"paper"===t?"paper":"pixel"===t?"pixel":/( domain)$/.test(t)?"domain":"range"},N.coercePosition=function(t,e,r,n,a,i){var o,s;if("range"!==N.getRefType(n))o=l.ensureNumber,s=r(a,i);else{var c=N.getFromId(e,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}t[a]=o(s)},N.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?l.ensureNumber:N.getFromId(e,r).cleanPos)(t)},N.redrawComponents=function(t,e){e=e||N.listIds(t);var r=t._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.saveRangeInitial=function(t,e){for(var r=N.list(t,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;t+=t+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=N.tickIncrement(t,"M6","reverse")+1.5*A:i.exactMonths>.8?t=N.tickIncrement(t,"M1","reverse")+15.5*A:t-=L;var s=N.tickIncrement(t,r);if(s<=n)return s}return t}(y,t,m,c,i)),v=y,0;v<=u;)v=N.tickIncrement(v,m,!1,i);return{start:e.c2r(y,0,i),end:e.c2r(v,0,i),size:m,_dataSpan:u-c}},N.prepTicks=function(t,e){var r=l.simpleMap(t.range,t.r2l,void 0,void 0,e);if(t._dtickInit=t.dtick,t._tick0Init=t.tick0,"auto"===t.tickmode||!t.dtick){var n,i=t.nticks;i||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,i=t._length/n):(n="y"===t._id.charAt(0)?40:80,i=l.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(i*=2)),"array"===t.tickmode&&(i*=100),t._roughDTick=Math.abs(r[1]-r[0])/i,N.autoTicks(t,t._roughDTick),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}"period"===t.ticklabelmode&&function(t){var e;function r(){return!(a(t.dtick)||"M"!==t.dtick.charAt(0))}var n=r(),i=N.getTickFormat(t);if(i){var o=t._dtickInit!==t.dtick;/%[fLQsSMX]/.test(i)||(/%[HI]/.test(i)?(e=S,o&&!n&&t.dticki&&f=o:p<=o;p=N.tickIncrement(p,t.dtick,s,t.calendar)){if(t.rangebreaks&&!s){if(p=u)break}if(C.length>g||p===O)break;O=p;var D=!1;f&&p!==(0|p)&&(D=!0),C.push({minor:D,value:p})}if(d&&function(t,e,r){for(var n=0;n0?(i=n-1,o=n):(i=n,o=n);var l,s=t[i].value,c=t[o].value,u=Math.abs(c-s),f=r||u,d=0;f>=y?d=u>=y&&u<=v?u:m:r===b&&f>=_?d=u>=_&&u<=x?u:b:f>=k?d=u>=k&&u<=w?u:T:r===M&&f>=M?d=M:f>=A?d=A:r===L&&f>=L?d=L:r===S&&f>=S&&(d=S),d>=u&&(d=u,l=!0);var p=a+d;if(e.rangebreaks&&d>0){for(var h=0,g=0;g<84;g++){var C=(g+.5)/84;e.maskBreaks(a*(1-C)+C*p)!==z&&h++}(d*=h/84)||(t[n].drop=!0),l&&u>M&&(d=u)}(d>0||0===n)&&(t[n].periodX=a+d/2)}}(C,t,t._definedDelta),t.rangebreaks){var P="y"===t._id.charAt(0),E=1;"auto"===t.tickmode&&(E=t.tickfont?t.tickfont.size:12);var I=NaN;for(h=C.length-1;h>-1;h--)if(C[h].drop)C.splice(h,1);else{C[h].value=bt(C[h].value,t);var R=t.c2p(C[h].value);(P?I>R-E:Iu||Bu&&(F.periodX=u),B10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=A&&i<=10||e>=15*A)t._tickround="d";else if(e>=C&&i<=16||e>=S)t._tickround="M";else if(e>=O&&i<=19||e>=C)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,o)-20,t._tickround<0&&(t._tickround=4)}}else if(a(e)||"L"===e.charAt(0)){var l=t.range.map(t.r2d||Number);a(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01),u=void 0===t.minexponent?3:t.minexponent;Math.abs(c)>u&&(at(t.exponentformat)&&!it(c)?t._tickexponent=3*Math.round((c-1)/3):t._tickexponent=c)}else t._tickround=null}function rt(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}}N.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=l.dateTick0(t.calendar,0);var i=2*e;if(i>m)e/=m,r=n(10),t.dtick="M"+12*tt(e,r,Y);else if(i>T)e/=T,t.dtick="M"+tt(e,1,X);else if(i>A){t.dtick=tt(e,A,t._hasDayOfWeekBreaks?[1,2,7,14]:Q);var o=N.getTickFormat(t),s="period"===t.ticklabelmode;s&&(t._rawTick0=t.tick0),/%[uVW]/.test(o)?t.tick0=l.dateTick0(t.calendar,2):t.tick0=l.dateTick0(t.calendar,1),s&&(t._dowTick0=t.tick0)}else i>S?t.dtick=tt(e,S,X):i>C?t.dtick=tt(e,C,W):i>O?t.dtick=tt(e,O,W):(r=n(10),t.dtick=tt(e,r,Y))}else if("log"===t.type){t.tick0=0;var c=l.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(c[1]-c[0])<1){var u=1.5*Math.abs((c[1]-c[0])/e);e=Math.abs(Math.pow(10,c[1])-Math.pow(10,c[0]))/u,r=n(10),t.dtick="L"+tt(e,r,Y)}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))):xt(t)?(t.tick0=0,r=1,t.dtick=tt(e,r,K)):(t.tick0=0,r=n(10),t.dtick=tt(e,r,Y));if(0===t.dtick&&(t.dtick=1),!a(t.dtick)&&"string"!=typeof t.dtick){var f=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(f)}},N.tickIncrement=function(t,e,r,i){var o=r?-1:1;if(a(e))return l.increment(t,o*e);var s=e.charAt(0),c=o*Number(e.substr(1));if("M"===s)return l.incrementMonth(t,c,i);if("L"===s)return Math.log(Math.pow(10,t)+c)/Math.LN10;if("D"===s){var u="D2"===e?$:J,f=t+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t,e){var r=t.r2l||Number,i=l.simpleMap(t.range,r,void 0,void 0,e),o=i[1]"+s,t._prevDateHead=s));e.text=c}(t,o,r,c):"log"===u?function(t,e,r,n,i){var o=t.dtick,s=e.x,c=t.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)e.text=ot(Math.pow(10,s),t,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=t.exponentformat;"power"===p||at(p)&&it(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":D)+d+"",e.fontSize*=1.25):("e"===p||"E"===p)&&d>2?e.text="1"+p+(f>0?"+":D)+d:(e.text=ot(Math.pow(10,s),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,l.mod(s,1)))),e.fontSize*=.75}if("D1"===t.dtick){var h=String(e.text).charAt(0);"0"!==h&&"1"!==h||("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*(s<0?.5:.25)))}}(t,o,0,c,g):"category"===u?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===u?function(t,e,r){var n=Math.round(e.x),a=t._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?e.text=o+" - "+i:(e.text=i,e.text2=o)}(t,o,r):xt(t)?function(t,e,r,n,a){if("radians"!==t.thetaunit||r)e.text=ot(e.x,t,a,n);else{var i=e.x/180;if(0===i)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){for(var r=1;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,a=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)e.text=ot(l.deg2rad(e.x),t,a,n);else{var s=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(""),s&&(e.text=D+e.text)}}}}(t,o,r,c,g):function(t,e,r,n,a){"never"===a?a="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide");e.text=ot(e.x,t,a,n)}(t,o,0,c,g),n||(t.tickprefix&&!h(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!h(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var v=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[v(o.x-.5),v(o.x+t.dtick-.5)]}return o},N.hoverLabelText=function(t,e,r){if(r!==z&&r!==e)return N.hoverLabelText(t,e)+" - "+N.hoverLabelText(t,r);var n="log"===t.type&&e<=0,a=N.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":D+a:a};var nt=["f","p","n","\u03bc","m","","k","M","G","T"];function at(t){return"SI"===t||"B"===t}function it(t){return t>14||t<-15}function ot(t,e,r,n){var i=t<0,o=e._tickround,s=r||e.exponentformat||"B",c=e._tickexponent,u=N.getTickFormat(e),f=e.separatethousands;if(n){var d={exponentformat:s,minexponent:e.minexponent,dtick:"none"===e.showexponent?e.dtick:a(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};et(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return e._numFormat(u)(t).replace(/-/g,D);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(t=Math.abs(t))"+p+"":"B"===s&&9===c?t+="B":at(s)&&(t+=nt[c/3+5]));return i?D+t:t}function lt(t,e){for(var r=[],n={},a=0;a1&&r=a.min&&t=0,i=u(t,e[1])<=0;return(r||a)&&(n||i)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=o(a)))){r=n;break}break;case"log":for(e=0;e0?r.bottom-f:0,d)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=e._depth:(n[s]=e._depth=Math.max(r.width>0?f-r.top:0,d),p.reverse()),r.width>0){var v=r.right-(e._offset+e._length);v>0&&(n.xr=1,n.r=v);var m=e._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=e._depth=Math.max(r.height>0?f-r.left:0,d):(n[s]=e._depth=Math.max(r.height>0?r.right-f:0,d),p.reverse()),r.height>0){var y=r.bottom-(e._offset+e._length);y>0&&(n.yb=0,n.b=y);var x=e._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===e.anchor?e.position:e._anchorAxis.domain[p[0]],e.title.text!==c._dfltTitle[h]&&(n[s]+=ut(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[u]=e.linewidth,e.mirror&&!0!==e.mirror&&(a[u]+=d),!0===e.mirror||"ticks"===e.mirror?a[g]=e._anchorAxis.domain[p[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(a[g]=[e._counterDomainMin,e._counterDomainMax][p[1]]))}J&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),i.autoMargin(t,pt(e),n),i.autoMargin(t,ht(e),a),i.autoMargin(t,gt(e),l)})),r.skipTitle||J&&"bottom"===e.side||W.push((function(){return function(t,e){var r,n=t._fullLayout,a=e._id,i=a.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+ut(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===i?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var l,s,c,f,p=N.getPxPosition(t,e);"x"===i?(s=e._offset+e._length/2,c="top"===e.side?p-r:p+r):(c=e._offset+e._length/2,s="right"===e.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==e.type){var h=e._selections[e._id+"tick"];if(f={selection:h,side:e.side},h&&h.node()&&h.node().parentNode){var g=d.getTranslate(h.node().parentNode);f.offsetLeft=g.x,f.offsetTop=g.y}e.title.hasOwnProperty("standoff")&&(f.pad=0)}return u.draw(t,a+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[i],avoid:f,transform:l,attributes:{x:s,y:c,"text-anchor":"middle"}})}(t,e)})),l.syncOrAsync(W)}}function $(t){var r=p+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,a,i;t._selections[e].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,t._selections[e].each((function(){var t=dt(this),e=d.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),a=Math.min(a,e.left),i=Math.max(i,e.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(e,r)),w[r]}},N.getTickSigns=function(t){var e=t._id.charAt(0),r={x:"top",y:"right"}[e],n=t.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==t.ticks==("x"===e)&&(a=a.map((function(t){return-t}))),t.side&&a.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),a},N.makeTransTickFn=function(t){return"x"===t._id.charAt(0)?function(e){return s(t._offset+t.l2p(e.x),0)}:function(e){return s(0,t._offset+t.l2p(e.x))}},N.makeTransTickLabelFn=function(t){var e=function(t){var e=t.ticklabelposition||"",r=function(t){return-1!==e.indexOf(t)},n=r("top"),a=r("left"),i=r("right"),o=r("bottom"),l=r("inside"),s=o||a||n||i;if(!s&&!l)return[0,0];var c=t.side,u=s?(t.tickwidth||0)/2:0,f=3,d=t.tickfont?t.tickfont.size:12;(o||n)&&(u+=d*I,f+=(t.linewidth||0)/2);(a||i)&&(u+=(t.linewidth||0)/2,f+=3);l&&"top"===c&&(f-=d*(1-I));(a||n)&&(u=-u);"bottom"!==c&&"right"!==c||(f=-f);return[s?u:0,l?f:0]}(t),r=e[0],n=e[1];return"x"===t._id.charAt(0)?function(e){return s(r+t._offset+t.l2p(st(e)),n)}:function(e){return s(n,r+t._offset+t.l2p(st(e)))}},N.makeTickPath=function(t,e,r,n){n=void 0!==n?n:t.ticklen;var a=t._id.charAt(0),i=(t.linewidth||1)/2;return"x"===a?"M0,"+(e+i*r)+"v"+n*r:"M"+(e+i*r)+",0h"+n*r},N.makeLabelFns=function(t,e,r){var n=t.ticklabelposition||"",i=function(t){return-1!==n.indexOf(t)},o=i("top"),s=i("left"),c=i("right"),u=i("bottom")||s||o||c,f=i("inside"),d="inside"===n&&"inside"===t.ticks||!f&&"outside"===t.ticks&&"boundaries"!==t.tickson,p=0,h=0,g=d?t.ticklen:0;if(f?g*=-1:u&&(g=0),d&&(p+=g,r)){var v=l.deg2rad(r);p=g*Math.cos(v)+1,h=g*Math.sin(v)}t.showticklabels&&(d||t.showline)&&(p+=.2*t.tickfont.size);var m,y,x,b,_,w={labelStandoff:p+=(t.linewidth||1)/2*(f?-1:1),labelShift:h},T=0,k=t.side,M=t._id.charAt(0),A=t.tickangle;if("x"===M)b=(_=!f&&"bottom"===k||f&&"top"===k)?1:-1,f&&(b*=-1),m=h*b,y=e+p*b,x=_?1:-.2,90===Math.abs(A)&&(f?x+=E:x=-90===A&&"bottom"===k?I:90===A&&"top"===k?E:.5,T=E/2*(A/90)),w.xFn=function(t){return t.dx+m+T*t.fontSize},w.yFn=function(t){return t.dy+y+t.fontSize*x},w.anchorFn=function(t,e){if(u){if(s)return"end";if(c)return"start"}return a(e)&&0!==e&&180!==e?e*b<0!==f?"end":"start":"middle"},w.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side!==f?-n:0};else if("y"===M){if(b=(_=!f&&"left"===k||f&&"right"===k)?1:-1,f&&(b*=-1),m=p,y=h*b,x=0,f||90!==Math.abs(A)||(x=-90===A&&"left"===k||90===A&&"right"===k?I:.5),f){var L=a(A)?+A:0;if(0!==L){var S=l.deg2rad(L);T=Math.abs(Math.sin(S))*I*b,x=0}}w.xFn=function(t){return t.dx+e-(m+t.fontSize*x)*b+T*t.fontSize},w.yFn=function(t){return t.dy+y+t.fontSize*E},w.anchorFn=function(t,e){return a(e)&&90===Math.abs(e)?"middle":_?"end":"start"},w.heightFn=function(e,r,n){return"right"===t.side&&(r*=-1),r<-30?-n:r<30?-.5*n:0}}return w},N.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",a=r.vals;"period"===e.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(e.ticks?a:[],ct);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(f.stroke,e.tickcolor).style("stroke-width",d.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},N.drawGrid=function(t,e,r){r=r||{};var n=e._id+"grid",a=r.vals,i=r.counterAxis;if(!1===e.showgrid)a=[];else if(i&&N.shouldShowZeroLine(t,e,i))for(var o="array"===e.tickmode,l=0;lo||a.lefto||a.top+(e.tickangle?0:t.fontSize/4)1)for(n=1;n2*o}(a,e))return"date";var v="strict"!==r.autotypenumbers;return function(t,e){for(var r=t.length,n=f(r),a=0,o=0,l={},u=0;u2*a}(a,v)?"category":function(t,e){for(var r=t.length,n=0;n=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(e.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(e.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(e.enabled=!1);e.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(e.enabled=!1);if((c=+c)<0||c>24)return void(e.enabled=!1);e.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(e.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.ref2id=function(t){return!!/^[xyz]/.test(t)&&t.split(" ")[0]}},{"../../registry":324,"./constants":283}],281:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){if("category"===e.type){var a,i=t.categoryarray,o=Array.isArray(i)&&i.length>0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=e.categoryorder="trace"),"trace"===s?e._initialCategories=[]:"array"===s?e._initialCategories=l.slice():(l=function(t,e){var r,n,a,i=e.dataAttr||t._id.charAt(0),o={};if(e.axData)r=e.axData;else for(r=[],n=0;nn?a.substr(n):i.substr(r))+o:a+i+t*e:o}function v(t,e){for(var r=e._size,n=r.h/r.w,a={},i=Object.keys(t),o=0;oc*x)||T)for(r=0;rP&&FD&&(D=F);d/=(D-O)/(2*z),O=s.l2r(O),D=s.l2r(D),s.range=s._input.range=L=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function N(t,e,r,n,a){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",s(r,n)).attr("d",a+"Z")}function B(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",s(e,r)).attr("d","M0,0Z")}function H(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),j(t,e,a,i)}function j(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 U(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function V(t){D&&t.data&&t._context.showTips&&(l.notifier(l._(t,"Double-click to zoom back out"),"long"),D=!1)}function q(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,O)/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 G(t,e,r,n,a){for(var i,o,s,c,u=!1,f={},d={},p=(a||{}).xaHash,h=(a||{}).yaHash,g=0;g=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(U(a),2!==t||vt||Vt(),gt)i.indexOf("select")>-1&&A(r,a,W,Q,e.id,Ot),i.indexOf("event")>-1&&d.click(a,r,e.id);else if(1===t&&vt){var l=h?z:D,s="s"===h||"w"===v?0:1,u=l._name+".range["+s+"]",f=function(t,e){var r,a=t.range[e],i=Math.abs(a-t.range[1-e]);return"date"===t.type?a:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,s),p="left",g="middle";if(l.fixedrange)return;h?(g="n"===h?"top":"bottom","right"===l.side&&(p="right")):"e"===v&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(xt).call(c.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(f),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:g}).on("edit",(function(t){var e=l.d2r(t);void 0!==e&&o.call("_guiRelayout",a,u,e)}))}}}function Pt(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,dt*e+bt)),a=Math.max(0,Math.min(tt,pt*r+_t)),i=Math.abs(n-bt),o=Math.abs(a-_t);function l(){At="",wt.r=wt.l,wt.t=wt.b,St.attr("d","M0,0Z")}if(wt.l=Math.min(bt,n),wt.r=Math.max(bt,n),wt.t=Math.min(_t,a),wt.b=Math.max(_t,a),et.isSubplotConstrained)i>O||o>O?(At="xy",i/K>o/tt?(o=i*tt/K,_t>a?wt.t=_t-o:wt.b=_t+o):(i=o*K/tt,bt>n?wt.l=bt-i:wt.r=bt+i),St.attr("d",q(wt))):l();else if(rt.isSubplotConstrained)if(i>O||o>O){At="xy";var s=Math.min(wt.l/K,(tt-wt.b)/tt),c=Math.max(wt.r/K,(tt-wt.t)/tt);wt.l=s*K,wt.r=c*K,wt.b=(1-s)*tt,wt.t=(1-c)*tt,St.attr("d",q(wt))}else l();else!at||o0){var u;if(rt.isSubplotConstrained||!nt&&1===at.length){for(u=0;ug[1]-1/4096&&(e.domain=l),a.noneOrAll(t.domain,e.domain,l)}return r("layer"),e}},{"../../lib":232,"fast-isnumeric":23}],295:[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 a=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(i+(a[0]-i)*e),t.l2r(i+(a[1]-i)*e)],t.setScale()}},{"../../constants/alignment":206}],296:[function(t,e,r){"use strict";var n=t("polybooljs"),a=t("../../registry"),i=t("../../components/drawing").dashStyle,o=t("../../components/color"),l=t("../../components/fx"),s=t("../../components/fx/helpers").makeEventData,c=t("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=t("../../components/shapes/draw_newshape/display_outlines"),v=t("../../components/shapes/draw_newshape/helpers").handleEllipse,m=t("../../components/shapes/draw_newshape/newshapes"),y=t("../../lib"),x=t("../../lib/polygon"),b=t("../../lib/throttle"),_=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),T=t("../../plot_api/subroutines").redrawReglTraces,k=t("./constants"),M=k.MINSELECT,A=x.filter,L=x.tester,S=t("./handle_outline").clearSelect,C=t("./helpers"),O=C.p2r,D=C.axValue,z=C.getTransform;function P(t,e,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=e._hoverdata,x=e._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(y)){F(t,e,i);var _=function(t,e){var r,n,a=t[0],i=-1,o=[];for(n=0;n0?function(t,e){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===e.searchInfo&&(n=e.searchInfo.cd[0].trace).selectedpoints.length===e.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=H(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(e)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,t);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function B(t,e,r,n){var a,i,o,l=[],s=e.map((function(t){return t._id})),c=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(a)>-1}function j(t,e,r){var n,i,o,l;for(n=0;n=0)C._fullLayout._deactivateShape(C);else if(!_){var r=E.clickmode;b.done(gt).then((function(){if(b.clear(gt),2===t){for(ft.remove(),K=0;K-1&&P(e,C,a.xaxes,a.yaxes,a.subplot,a,ft),"event"===r&&C.emit("plotly_selected",void 0);l.click(C,e)})).catch(y.error)}},a.doneFn=function(){ht.remove(),b.done(gt).then((function(){b.clear(gt),a.gd.emit("plotly_selected",et),$&&a.selectionDefs&&($.subtract=ut,a.selectionDefs.push($),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,J)),a.doneFnCompleted&&a.doneFnCompleted(vt)})).catch(y.error),_&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:P}},{"../../components/color":104,"../../components/dragelement/helpers":122,"../../components/drawing":126,"../../components/fx":144,"../../components/fx/helpers":140,"../../components/shapes/draw_newshape/display_outlines":189,"../../components/shapes/draw_newshape/helpers":190,"../../components/shapes/draw_newshape/newshapes":191,"../../lib":232,"../../lib/clear_gl_canvases":220,"../../lib/polygon":244,"../../lib/throttle":254,"../../plot_api/subroutines":267,"../../registry":324,"./axis_ids":280,"./constants":283,"./handle_outline":287,"./helpers":288,polybooljs:78}],297:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../../lib"),l=o.cleanNumber,s=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,d=t("../../constants/numerical"),p=d.FP_SAFE,h=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,x=d.ONEMIN,b=d.ONESEC,_=t("./axis_ids"),w=t("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function M(t){return Math.pow(10,t)}function A(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",d=r.charAt(0);function L(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],a=t.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return h}function S(e,r,n,a){if((a||{}).msUTC&&i(e))return+e;var l=c(e,n||t.calendar);if(l===h){if(!i(e))return h;e=+e;var s=Math.floor(10*o.mod(e+.05,1)),u=Math.round(e-s/10);l=c(new Date(u))+s/10}return l}function C(e,r,n){return s(e,r,n||t.calendar)}function O(e){return t._categories[Math.round(e)]}function D(e){if(A(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h}function z(e){if(t._categoriesMap)return t._categoriesMap[e]}function P(t){var e=z(t);return void 0!==e?e:i(t)?+t:void 0}function E(t){return i(t)?+t:z(t)}function I(t,e,r){return n.round(r+e*t,2)}function R(t,e,r){return(t-r)/e}var F=function(e){return i(e)?I(e,t._m,t._b):h},N=function(e){return R(e,t._m,t._b)};if(t.rangebreaks){var B="y"===d;F=function(e){if(!i(e))return h;var r=t._rangebreaks.length;if(!r)return I(e,t._m,t._b);var n=B;t.range[0]>t.range[1]&&(n=!n);for(var a=n?-1:1,o=a*e,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=t._B[l]||0;return isFinite(f)?I(e,t._m2,f):0},N=function(e){var r=t._rangebreaks.length;if(!r)return R(e,t._m,t._b);for(var n=0,a=0;at._rangebreaks[a].pmax&&(n=a+1);return R(e,t._m2,t._B[n])}}t.c2l="log"===t.type?L:u,t.l2c="log"===t.type?M:u,t.l2p=F,t.p2l=N,t.c2p="log"===t.type?function(t,e){return F(L(t,e))}:F,t.p2c="log"===t.type?function(t){return M(N(t))}:N,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(l(e))},t.p2d=t.p2r=N,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return L(l(t),e)},t.r2d=t.r2c=function(t){return M(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=u,t.c2r=L,t.l2d=M,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return M(N(t))},t.r2p=function(e){return t.l2p(l(e))},t.p2r=N,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=S,t.c2d=t.c2r=t.l2d=t.l2r=C,t.d2p=t.r2p=function(e,r,n){return t.l2p(S(e,0,n))},t.p2d=t.p2r=function(t,e,r){return C(N(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,h,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=D,t.r2d=t.c2d=t.l2d=O,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=E(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=E,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return O(N(t))},t.r2p=t.d2p,t.p2r=N,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=O,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=z,t.l2r=t.c2r=u,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return O(N(t))},t.r2p=t.d2p,t.p2r=N,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:u(t)},t.setupMultiCategory=function(n){var a,i,l=t._traceIndices,s=t._matchGroup;if(s&&0===t._categories.length)for(var c in s)if(c!==r){var u=e[_.id2name(c)];l=l.concat(u._traceIndices)}var p=[[0,{}],[0,{}]],h=[];for(a=0;ap&&(l[n]=p),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else o.nestedProperty(t,e).set(a)},t.setScale=function(r){var n=e._size;if(t.overlaying){var a=_.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var i=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(i);var l,s,c=t.r2l(t[i][0],o),u=t.r2l(t[i][1],o),f="y"===d;if((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/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(c,u),Math.max(c,u)),t._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&t._rangebreaks.reverse();var h=p?-1:1;for(t._m2=h*t._length/(Math.abs(u-c)-t._lBreaks),t._B.push(-t._m2*(f?u:c)),l=0;la&&(a+=7,ia&&(a+=24,i=n&&i=n&&e=l.min&&(tl.max&&(l.max=n),a=!1)}a&&c.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function v(e,r){var n=e.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!e.xr1,d=!!e.yr1,p=[];if(f){var h=i.simpleMap(e.xr0,a.r2l),g=i.simpleMap(e.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(e.yr0,s.r2l),x=i.simpleMap(e.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(t,a,{skipTitle:!0}),l.drawOne(t,s,{skipTitle:!0}),l.redrawComponents(t,[a._id,s._id]);var w=f?c/p[2]:1,T=d?u/p[3]:1,k=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}l.redrawComponents(t)}},{"../../components/drawing":126,"../../lib":232,"../../registry":324,"./axes":277,d3:21}],302:[function(t,e,r){"use strict";var n=t("../../registry").traceIs,a=t("./axis_autotype");function i(t){return{v:"x",h:"y"}[t.orientation||"v"]}function o(t,e){var r=i(t),a=n(t,"box-violin"),o=n(t._fullInput||{},"candlestick");return a&&!o&&e===r&&void 0===t[r]&&void 0===t[r+"0"]}e.exports=function(t,e,r,l){r("autotypenumbers",l.autotypenumbersDflt),"-"===r("type",(l.splomStash||{}).type)&&(!function(t,e){if("-"!==t.type)return;var r,l=t._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(t,e,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[e])return a;if((a[r+"axis"]||r)===e){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(e,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(d.autotypenumbers=t.autotypenumbers,o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,e,l,n+1):e(l,i,o)}}))}r.manageCommandObserver=function(t,e,n,o){var l={},s=!0;e&&e._commandObserver&&(l=e._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(t,n,l.lookupTable);if(e&&e._commandObserver){if(c)return l;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,l}if(c){i(t,c,l.cache),l.check=function(){if(s){var e=i(t,c,l.cache);return e.changed&&o&&void 0!==l.lookupTable[e.value]&&(l.disable(),Promise.resolve(o({value:e.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[e.value]})).then(l.enable,l.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),s=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(){x.sendDataToCloud(t)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(t,o),l.text(o.text()&&s.text()?" - ":"")}},x.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var r=n.select(t).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(t,!1,"keepdata"),a.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(t,e){var r=t._context.locale;r||(r="en-US");var n=!1,a={};function i(t){for(var r=!0,i=0;i1&&E.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,s),l=0;l15&&E.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"),x.linkSubplots(d,s,f,i),x.cleanPlot(d,s,f,i);var B=!(!i._has||!i._has("gl2d")),H=!(!s._has||!s._has("gl2d")),j=!(!i._has||!i._has("cartesian"))||B,U=!(!s._has||!s._has("cartesian"))||H;j&&!U?i._bgLayer.remove():U&&!j&&(s._shouldCreateBgLayer=!0),i._zoomlayer&&!t._dragging&&p({_fullLayout:i}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),a=Math.round(f*a)}}var d=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!e.height&&Math.abs(r.height-a)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(t,e,r,n){var a,i,l,s=o.componentsRegistry,u=e._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in s)(l=s[a]).includeBasePlot&&l.includeBasePlot(t,e);for(var d in u.length||u.push(f),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[d].sort(c.subplotSort);for(i=0;i1&&(r.l/=d,r.r/=d);var p=(r.t+r.b)/l;p>1&&(r.t/=p,r.b/=p);var h=void 0!==r.xl?r.xl:r.x,g=void 0!==r.xr?r.xr:r.x,v=void 0!==r.yt?r.yt:r.y,m=void 0!==r.yb?r.yb:r.y;s[e]={l:{val:h,size:r.l+u},r:{val:g,size:r.r+u},b:{val:m,size:r.b+u},t:{val:v,size:r.t+u}},c[e]=1}else delete s[e],delete c[e];if(!n._replotting)return x.doAutoMargin(t)}},x.doAutoMargin=function(t){var e=t._fullLayout,r=e.width,n=e.height,a=Math.max(0,r-64),l=Math.max(0,n-64);e._size||(e._size={}),C(e);var s=e._size,u=e.margin,f=c.extendFlat({},s),p=u.l,h=u.r,g=u.t,v=u.b,m=e._pushmargin,y=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var b in m)y[b]||delete m[b];for(var _ in m.base={l:{val:0,size:p},r:{val:1,size:h},t:{val:1,size:g},b:{val:0,size:v}},m){var w=m[_].l||{},T=m[_].b||{},k=w.val,M=w.size,A=T.val,L=T.size;for(var S in m){if(i(M)&&m[S].r){var O=m[S].r.val,D=m[S].r.size;if(O>k){var z=(M*O+(D-r)*k)/(O-k),P=(D*(1-k)+(M-r)*(1-O))/(O-k);z+P>p+h&&(p=z,h=P)}}if(i(L)&&m[S].t){var E=m[S].t.val,I=m[S].t.size;if(E>A){var R=(L*E+(I-n)*A)/(E-A),F=(I*(1-A)+(L-n)*(1-E))/(E-A);R+F>v+g&&(v=R,g=F)}}}}}var N=(p+h)/a;N>1&&(p/=N,h/=N);var B=(v+g)/l;if(B>1&&(v/=B,g/=B),s.l=Math.round(p),s.r=Math.round(h),s.t=Math.round(g),s.b=Math.round(v),s.p=Math.round(u.pad),s.w=Math.round(r)-s.l-s.r,s.h=Math.round(n)-s.t-s.b,!e._replotting&&x.didMarginChange(f,s)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var H=3*(1+Object.keys(y).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var i=0,l=0;function s(){return i++,function(){l++,n||l!==i||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(a)}}r.runFn(s),setTimeout(s())}))}],i=c.syncOrAsync(a,t);return i&&i.then||(i=Promise.resolve()),i.then((function(){return t}))}x.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},x.graphJson=function(t,e,r,n,a,i){(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&x.supplyDefaults(t);var o=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s=(t._transitionData||{})._frames;function u(t,e){if("function"==typeof t)return e?"_function_":null;if(c.isPlainObject(t)){var n,a={};return Object.keys(t).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof t[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(t[i],e)}else e&&(a[i]="_function")})),a}return Array.isArray(t)?t.map((function(t){return u(t,e)})):c.isTypedArray(t)?c.simpleMap(t,c.identity):c.isJSDate(t)?c.ms2DateTimeLocal(+t):t}var f={data:(o||[]).map((function(t){var r=u(t);return e&&delete r.fit,r}))};if(!e&&(f.layout=u(l),a)){var d=l._size;f.layout.computed={margin:{b:d.b,l:d.l,r:d.r,t:d.t}}}return t.framework&&t.framework.isPolar&&(f=t.framework.getConfig()),s&&(f.frames=u(s)),i&&(f.config=u(t._context,!0)),"object"===n?f:JSON.stringify(f)},x.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;i--)if(l[i].enabled){r._indexToPoints=l[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,h[e]=o}}for(P(s,u,p),a=0;a=0?d.angularAxis.domain:n.extent(T),S=Math.abs(T[1]-T[0]);M&&!k&&(S=0);var C=L.slice();A&&k&&(C[1]+=S);var O=d.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),d.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var D=d.angularAxis.ticksStep||(C[1]-C[0])/(O*(d.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),C[2]||(C[2]=D);var z=n.range.apply(this,C);if(z=z.map((function(t,e){return parseFloat(t.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(t=n.select(this).select("svg.chart-root"))||t.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),E=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));t=n.select(E)}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,R=t.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(t,e){return" "+t+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){I=t.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var B=p.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:p.map((function(t,e){return t.name||"Element"+e})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:I,elements:B,reverseOrder:d.legend.reverseOrder})})();var H=I.node().getBBox();x=Math.min(d.width-H.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),I.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else I=t.select(".legend-group").style({display:"none"});t.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var j=[(d.width-(d.margin.left+d.margin.right+2*x+(H?H.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),t.select(".outer-group").attr("transform","translate("+j+")"),d.title&&d.title.text){var U=t.select("g.title-group text").style(N).text(d.title.text),V=U.node().getBBox();U.attr({x:_[0]-V.width/2,y:_[1]-x-20})}var q=t.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:x}).style(F);var Z=t.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function Y(t,e){return l(t)%360+d.orientation}if(d.radialAxis.visible){var X=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(X).attr({transform:"rotate("+d.radialAxis.orientation+")"}),q.selectAll(".domain").style(F),q.selectAll("g>text").text((function(t,e){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var W=t.select(".angular.axis-group").selectAll("g.angular-tick").data(z),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+Y(t)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",(function(t,e){return e%(d.minorTicks+1)==0})).classed("minor",(function(t,e){return!(e%(d.minorTicks+1)==0)})).style(F),Q.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var J=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(t,e){var r=Y(t),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(t,e){return e%(d.minorTicks+1)!=0?"":w?w[t]+d.angularAxis.ticksSuffix:t+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&J.text((function(t,e){return e%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,e)}));var $=n.max(R.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));I.attr({transform:"translate("+[x+$,d.margin.top]+")"});var K=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(p);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),p[0]||K){var et=[];p.forEach((function(t,e){var n={};n.radialScale=r,n.angularScale=l,n.container=tt.filter((function(t,r){return r==e})),n.geometry=t.geometry,n.orientation=d.orientation,n.direction=d.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 a(o[r].defaultConfig(),t)}));o[r]().config(n)()}))}var at,it,ot=t.select(".guides-group"),lt=t.select(".tooltips-group"),st=o.tooltipPanel().config({container:lt,fontSize:8})(),ct=o.tooltipPanel().config({container:lt,fontSize:8})(),ut=o.tooltipPanel().config({container:lt,hasTick:!0})();if(!k){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",(function(t,e){var r=o.util.getMousePos(Z).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;at=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);st.text(o.util.round(at)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(t,e){ot.select("line").style({opacity:0})}))}var dt=ot.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",(function(t,e){var n=o.util.getMousePos(Z).radius;dt.attr({r:n}).style({opacity:.5}),it=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ct.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.hide()})),t.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(e,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(e[0]),r:o.util.round(e[1])};k&&(c.t=w[e[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=t.node().getBoundingClientRect(),p=[f.left+f.width/2-j[0]-d.left,f.top+f.height/2-j[1]-d.top];ut.config({color:l}).text(u),ut.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()})).on("mouseout.tooltip",(function(t,e){ut.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(t){if(!arguments.length)return s;var e=o.util.cloneJson(t);return e.data.forEach((function(t,e){s.data[e]||(s.data[e]={}),a(s.data[e],o.Axis.defaultConfig().data[0]),a(s.data[e],t)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return r},d.angularScale=function(t){return l},d.svg=function(){return t},n.rebind(d,f,"on"),d},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 a=e||6,i=[],o=[];n.range(0,360+a,a).forEach((function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},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],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(t,r){return"rotate("+(e.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(t,e){return h.stroke(r,a,i)},"stroke-width":function(t,e){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return h["stroke-dasharray"](r,a,i)},opacity:function(t,e){return h.opacity(r,a,i)},display:function(t,e){return h.display(r,a,i)}})}};var f=e.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(t){return-d/2})).endAngle((function(t){return d/2})).innerRadius((function(t){return e.radialScale(s+(t[2]||0))})).outerRadius((function(t){return e.radialScale(s+(t[2]||0))+e.radialScale(t[1])}));c.arc=function(t,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(t,r){return"rotate("+(e.orientation+l(t[0])+90)+")"}})};var h={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,a){return r[t[a].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(h).each(c[e.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(e){return arguments.length?(e.forEach((function(e,r){t[r]||(t[r]={}),a(t[r],o.PolyChart.defaultConfig()),a(t[r],e)})),this):t},i.getColorScale=function(){},n.rebind(i,e,"on"),i},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,i=t.data.map((function(t,r){return[].concat(t).map((function(t,n){var i=a({},e.elements[r]);return i.name=t,i.color=[].concat(e.elements[r].color)[n],i}))})),o=n.merge(i);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 l=e.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(t,e){return t.color})),c=e.fontSize,u=null==e.isContinuous?"number"==typeof o[0]:e.isContinuous,f=u?e.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:e.height,width:e.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.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("+[c/2,v(e)+c/2]+")"},d:function(t,e){var r,a,i,o=t.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(t,e){return g(e)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?e.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?e.textColor:"none"}),b.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?(a(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,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(t=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!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:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=e.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[s,-v/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(t)return t.style({display:"none"}),c},c.show=function(){if(t)return t.style({display:"block"}),c},c.config=function(t){return a(i,t),c},c},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=a({},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 i=o.util.duplicates(r.data.map((function(t,e){return t.geometry})));r.data.forEach((function(t,e){var n=i.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)}))}if(t.layout){var l=a({},t.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(t,r){o.util.translator.apply(null,t.concat(e))})),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(t,e){u[c[s.indexOf(t.key)]]=t.value})),l.margin=u}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return t}},{"../../../constants/alignment":206,"../../../lib":232,d3:21}],316:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../../lib"),i=t("../../../components/color"),o=t("./micropolar"),l=t("./undo_manager"),s=a.extendDeepAll,c=e.exports={};c.framework=function(t){var e,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),e=e?s(e,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(e),a.config(i).render(u),t.data=e.data,t.layout=e.layout,c.fillLayout(t),e}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return e},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var t,n,a=this,i=o.util.cloneJson(e);t=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(t)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(t){var e=n.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=s(o,t.layout)}},{"../../../components/color":104,"../../../lib":232,"./micropolar":315,"./undo_manager":317,d3:21}],317:[function(t,e,r){"use strict";e.exports=function(){var t,e=[],r=-1,n=!1;function a(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n||(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?(a(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(a(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a=u&&(p.min=0,g.min=0,v.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}function h(t,e,r,n){var a=f[e._name];function o(r,n){return i.coerce(t,e,a,r,n)}o("uirevision",n.uirevision),e.type="linear";var d=o("color"),p=d!==a.color.dflt?d:r.font.color,h=e._name.charAt(0).toUpperCase(),g="Component "+h,v=o("title.text",g);e._hovertitle=v===g?v:h,i.coerceFont(o,"title.font",{family:r.font.family,size:Math.round(1.2*r.font.size),color:p}),o("min"),c(t,e,o,"linear"),l(t,e,o,"linear",{}),s(t,e,o,{outerTicks:!0}),o("showticklabels")&&(i.coerceFont(o,"tickfont",{family:r.font.family,size:r.font.size,color:p}),o("tickangle"),o("tickformat")),u(t,e,o,{dfltColor:d,bgColor:r.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:a}),o("hoverformat"),o("layer")}e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:f,handleDefaults:p,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../components/color":104,"../../lib":232,"../../plot_api/plot_template":266,"../cartesian/line_grid_defaults":293,"../cartesian/tick_label_defaults":298,"../cartesian/tick_mark_defaults":299,"../cartesian/tick_value_defaults":300,"../subplot_defaults":318,"./layout_attributes":321}],323:[function(t,e,r){"use strict";var n=t("d3"),a=t("tinycolor2"),i=t("../../registry"),o=t("../../lib"),l=o.strTranslate,s=o._,c=t("../../components/color"),u=t("../../components/drawing"),f=t("../cartesian/set_convert"),d=t("../../lib/extend").extendFlat,p=t("../plots"),h=t("../cartesian/axes"),g=t("../../components/dragelement"),v=t("../../components/fx"),m=t("../../components/dragelement/helpers"),y=m.freeMode,x=m.rectMode,b=t("../../components/titles"),_=t("../cartesian/select").prepSelect,w=t("../cartesian/select").selectOnClick,T=t("../cartesian/select").clearSelect,k=t("../cartesian/select").clearSelectionsCache,M=t("../cartesian/constants");function A(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework(e),this.aTickLayout=null,this.bTickLayout=null,this.cTickLayout=null}e.exports=A;var L=A.prototype;L.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={},this.layers={}},L.plot=function(t,e){var r=e[this.id],n=e._size;this._hasClipOnAxisFalse=!1;for(var a=0;aS*b?a=(i=b)*S:i=(a=x)/S,o=m*a/x,s=y*i/b,r=e.l+e.w*g-a/2,n=e.t+e.h*(1-v)-i/2,p.x0=r,p.y0=n,p.w=a,p.h=i,p.sum=_,p.xaxis={type:"linear",range:[w+2*k-_,_-w-2*T],domain:[g-o/2,g+o/2],_id:"x"},f(p.xaxis,p.graphDiv._fullLayout),p.xaxis.setScale(),p.xaxis.isPtWithinRange=function(t){return t.a>=p.aaxis.range[0]&&t.a<=p.aaxis.range[1]&&t.b>=p.baxis.range[1]&&t.b<=p.baxis.range[0]&&t.c>=p.caxis.range[1]&&t.c<=p.caxis.range[0]},p.yaxis={type:"linear",range:[w,_-T-k],domain:[v-s/2,v+s/2],_id:"y"},f(p.yaxis,p.graphDiv._fullLayout),p.yaxis.setScale(),p.yaxis.isPtWithinRange=function(){return!0};var M=p.yaxis.domain[0],A=p.aaxis=d({},t.aaxis,{range:[w,_-T-k],side:"left",tickangle:(+t.aaxis.tickangle||0)-30,domain:[M,M+s*S],anchor:"free",position:0,_id:"y",_length:a});f(A,p.graphDiv._fullLayout),A.setScale();var L=p.baxis=d({},t.baxis,{range:[_-w-k,T],side:"bottom",domain:p.xaxis.domain,anchor:"free",position:0,_id:"x",_length:a});f(L,p.graphDiv._fullLayout),L.setScale();var C=p.caxis=d({},t.caxis,{range:[_-w-T,k],side:"right",tickangle:(+t.caxis.tickangle||0)+30,domain:[M,M+s*S],anchor:"free",position:0,_id:"y",_length:a});f(C,p.graphDiv._fullLayout),C.setScale();var O="M"+r+","+(n+i)+"h"+a+"l-"+a/2+",-"+i+"Z";p.clipDef.select("path").attr("d",O),p.layers.plotbg.select("path").attr("d",O);var D="M0,"+i+"h"+a+"l-"+a/2+",-"+i+"Z";p.clipDefRelative.select("path").attr("d",D);var z=l(r,n);p.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",z),p.clipDefRelative.select("path").attr("transform",null);var P=l(r-L._offset,n+i);p.layers.baxis.attr("transform",P),p.layers.bgrid.attr("transform",P);var E=l(r+a/2,n)+"rotate(30)"+l(0,-A._offset);p.layers.aaxis.attr("transform",E),p.layers.agrid.attr("transform",E);var I=l(r+a/2,n)+"rotate(-30)"+l(0,-C._offset);p.layers.caxis.attr("transform",I),p.layers.cgrid.attr("transform",I),p.drawAxes(!0),p.layers.aline.select("path").attr("d",A.showline?"M"+r+","+(n+i)+"l"+a/2+",-"+i:"M0,0").call(c.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),p.layers.bline.select("path").attr("d",L.showline?"M"+r+","+(n+i)+"h"+a:"M0,0").call(c.stroke,L.linecolor||"#000").style("stroke-width",(L.linewidth||0)+"px"),p.layers.cline.select("path").attr("d",C.showline?"M"+(r+a/2)+","+n+"l"+a/2+","+i:"M0,0").call(c.stroke,C.linecolor||"#000").style("stroke-width",(C.linewidth||0)+"px"),p.graphDiv._context.staticPlot||p.initInteractions(),u.setClipUrl(p.layers.frontplot,p._hasClipOnAxisFalse?null:p.clipId,p.graphDiv)},L.drawAxes=function(t){var e=this.graphDiv,r=this.id.substr(7)+"title",n=this.layers,a=this.aaxis,i=this.baxis,o=this.caxis;if(this.drawAx(a),this.drawAx(i),this.drawAx(o),t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0)),c=(i.showticklabels?i.tickfont.size:0)+("outside"===i.ticks?i.ticklen:0)+3;n["a-title"]=b.draw(e,"a"+r,{propContainer:a,propName:this.id+".aaxis.title",placeholder:s(e,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-a.title.font.size/3-l,"text-anchor":"middle"}}),n["b-title"]=b.draw(e,"b"+r,{propContainer:i,propName:this.id+".baxis.title",placeholder:s(e,"Click to enter Component B title"),attributes:{x:this.x0-c,y:this.y0+this.h+.83*i.title.font.size+c,"text-anchor":"middle"}}),n["c-title"]=b.draw(e,"c"+r,{propContainer:o,propName:this.id+".caxis.title",placeholder:s(e,"Click to enter Component C title"),attributes:{x:this.x0+this.w+c,y:this.y0+this.h+.83*o.title.font.size+c,"text-anchor":"middle"}})}},L.drawAx=function(t){var e,r=this.graphDiv,n=t._name,a=n.charAt(0),i=t._id,l=this.layers[n],s=a+"tickLayout",c=(e=t).ticks+String(e.ticklen)+String(e.showticklabels);this[s]!==c&&(l.selectAll("."+i+"tick").remove(),this[s]=c),t.setScale();var u=h.calcTicks(t),f=h.clipEnds(t,u),d=h.makeTransTickFn(t),p=h.getTickSigns(t)[2],g=o.deg2rad(30),v=p*(t.linewidth||1)/2,m=p*t.ticklen,y=this.w,x=this.h,b="b"===a?"M0,"+v+"l"+Math.sin(g)*m+","+Math.cos(g)*m:"M"+v+",0l"+Math.cos(g)*m+","+-Math.sin(g)*m,_={a:"M0,0l"+x+",-"+y/2,b:"M0,0l-"+y/2+",-"+x,c:"M0,0l-"+x+","+y/2}[a];h.drawTicks(r,t,{vals:"inside"===t.ticks?f:u,layer:l,path:b,transFn:d,crisp:!1}),h.drawGrid(r,t,{vals:f,layer:this.layers[a+"grid"],path:_,transFn:d,crisp:!1}),h.drawLabels(r,t,{vals:u,layer:l,transFn:d,labelFns:h.makeLabelFns(t,0,30)})};var C=M.MINZOOM/2+.87,O="m-0.87,.5h"+C+"v3h-"+(C+5.2)+"l"+(C/2+2.6)+",-"+(.87*C+4.5)+"l2.6,1.5l-"+C/2+","+.87*C+"Z",D="m0.87,.5h-"+C+"v3h"+(C+5.2)+"l-"+(C/2+2.6)+",-"+(.87*C+4.5)+"l-2.6,1.5l"+C/2+","+.87*C+"Z",z="m0,1l"+C/2+","+.87*C+"l2.6,-1.5l-"+(C/2+2.6)+",-"+(.87*C+4.5)+"l-"+(C/2+2.6)+","+(.87*C+4.5)+"l2.6,1.5l"+C/2+",-"+.87*C+"Z",P=!0;function E(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}L.clearSelect=function(){k(this.dragOptions),T(this.dragOptions.gd)},L.initInteractions=function(){var t,e,r,n,f,d,p,h,m,b,T,k,A=this,L=A.layers.plotbg.select("path").node(),C=A.graphDiv,I=C._fullLayout._zoomlayer;function R(t){var e={};return e[A.id+".aaxis.min"]=t.a,e[A.id+".baxis.min"]=t.b,e[A.id+".caxis.min"]=t.c,e}function F(t,e){var r=C._fullLayout.clickmode;E(C),2===t&&(C.emit("plotly_doubleclick",null),i.call("_guiRelayout",C,R({a:0,b:0,c:0}))),r.indexOf("select")>-1&&1===t&&w(e,C,[A.xaxis],[A.yaxis],A.id,A.dragOptions),r.indexOf("event")>-1&&v.click(C,e,A.id)}function N(t,e){return 1-e/A.h}function B(t,e){return 1-(t+(A.h-e)/Math.sqrt(3))/A.w}function H(t,e){return(t-(A.h-e)/Math.sqrt(3))/A.w}function j(a,i){var o=r+a*t,l=n+i*e,s=Math.max(0,Math.min(1,N(0,n),N(0,l))),c=Math.max(0,Math.min(1,B(r,n),B(o,l))),u=Math.max(0,Math.min(1,H(r,n),H(o,l))),g=(s/2+u)*A.w,v=(1-s/2-c)*A.w,y=(g+v)/2,x=v-g,_=(1-s)*A.h,w=_-x/S;x.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),k.transition().style("opacity",1).duration(200),b=!0),C.emit("plotly_relayouting",R(p))}function U(){E(C),p!==f&&(i.call("_guiRelayout",C,R(p)),P&&C.data&&C._context.showTips&&(o.notifier(s(C,"Double-click to zoom back out"),"long"),P=!1))}function V(t,e){var r=t/A.xaxis._m,n=e/A.yaxis._m,a=[(p={a:f.a-n,b:f.b+(r+n)/2,c:f.c-(r-n)/2}).a,p.b,p.c].sort(o.sorterAsc),i=a.indexOf(p.a),s=a.indexOf(p.b),c=a.indexOf(p.c);a[0]<0&&(a[1]+a[0]/2<0?(a[2]+=a[0]+a[1],a[0]=a[1]=0):(a[2]+=a[0]/2,a[1]+=a[0]/2,a[0]=0),p={a:a[i],b:a[s],c:a[c]},e=(f.a-p.a)*A.yaxis._m,t=(f.c-p.c-f.b+p.b)*A.xaxis._m);var d=l(A.x0+t,A.y0+e);A.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",d);var h=l(-t,-e);A.clipDefRelative.select("path").attr("transform",h),A.aaxis.range=[p.a,A.sum-p.b-p.c],A.baxis.range=[A.sum-p.a-p.c,p.b],A.caxis.range=[A.sum-p.a-p.b,p.c],A.drawAxes(!1),A._hasClipOnAxisFalse&&A.plotContainer.select(".scatterlayer").selectAll(".trace").call(u.hideOutsideRangePoints,A),C.emit("plotly_relayouting",R(p))}function q(){i.call("_guiRelayout",C,R(p))}this.dragOptions={element:L,gd:C,plotinfo:{id:A.id,domain:C._fullLayout[A.id].domain,xaxis:A.xaxis,yaxis:A.yaxis},subplot:A.id,prepFn:function(i,s,u){A.dragOptions.xaxes=[A.xaxis],A.dragOptions.yaxes=[A.yaxis],t=C._fullLayout._invScaleX,e=C._fullLayout._invScaleY;var g=A.dragOptions.dragmode=C._fullLayout.dragmode;y(g)?A.dragOptions.minDrag=1:A.dragOptions.minDrag=void 0,"zoom"===g?(A.dragOptions.moveFn=j,A.dragOptions.clickFn=F,A.dragOptions.doneFn=U,function(t,e,i){var s=L.getBoundingClientRect();r=e-s.left,n=i-s.top,C._fullLayout._calcInverseTransform(C);var u=C._fullLayout._invTransform,g=o.apply3DTransform(u)(r,n);r=g[0],n=g[1],f={a:A.aaxis.range[0],b:A.baxis.range[1],c:A.caxis.range[1]},p=f,d=A.aaxis.range[1]-f.a,h=a(A.graphDiv._fullLayout[A.id].bgcolor).getLuminance(),m="M0,"+A.h+"L"+A.w/2+", 0L"+A.w+","+A.h+"Z",b=!1,T=I.append("path").attr("class","zoombox").attr("transform",l(A.x0,A.y0)).style({fill:h>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",m),k=I.append("path").attr("class","zoombox-corners").attr("transform",l(A.x0,A.y0)).style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),A.clearSelect(C)}(0,s,u)):"pan"===g?(A.dragOptions.moveFn=V,A.dragOptions.clickFn=F,A.dragOptions.doneFn=q,f={a:A.aaxis.range[0],b:A.baxis.range[1],c:A.caxis.range[1]},p=f,A.clearSelect(C)):(x(g)||y(g))&&_(i,s,u,A.dragOptions,g)}},L.onmousemove=function(t){v.hover(C,t,A.id),C._fullLayout._lasthover=L,C._fullLayout._hoversubplot=A.id},L.onmouseout=function(t){C._dragging||g.unhover(C,t)},g.init(this.dragOptions)}},{"../../components/color":104,"../../components/dragelement":123,"../../components/dragelement/helpers":122,"../../components/drawing":126,"../../components/fx":144,"../../components/titles":199,"../../lib":232,"../../lib/extend":226,"../../registry":324,"../cartesian/axes":277,"../cartesian/constants":283,"../cartesian/select":296,"../cartesian/set_convert":297,"../plots":311,d3:21,tinycolor2:87}],324:[function(t,e,r){"use strict";var n=t("./lib/loggers"),a=t("./lib/noop"),i=t("./lib/push_unique"),o=t("./lib/is_plain_object"),l=t("./lib/dom").addStyleRule,s=t("./lib/extend"),c=t("./plots/attributes"),u=t("./plots/layout_attributes"),f=s.extendFlat,d=s.extendDeepAll;function p(t){var e=t.name,a=t.categories,i=t.meta;if(r.modules[e])n.log("Type "+e+" already registered");else{r.subplotsRegistry[t.basePlotModule.name]||function(t){var e=t.name;if(r.subplotsRegistry[e])return void n.log("Plot type "+e+" already registered.");for(var a in m(t),r.subplotsRegistry[e]=t,r.componentsRegistry)b(a,t.name)}(t.basePlotModule);for(var o={},s=0;s-1&&(f[p[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":104,"../components/drawing":126,"../constants/xmlns_namespaces":212,"../lib":232,d3:21}],333:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rf+c||!n(u))}for(var p=0;pi))return e}return void 0!==r?r:t.dflt},r.coerceColor=function(t,e,r){return a(e).isValid()?e:void 0!==r?r:t.dflt},r.coerceEnumerated=function(t,e,r){return t.coerceNumber&&(e=+e),-1!==t.values.indexOf(e)?e:void 0!==r?r:t.dflt},r.getValue=function(t,e){var r;return Array.isArray(t)?e0?a+=i:e<0&&(a-=i)}return n.inbox(r-e,a-e,b+(a-e)/(a-r)-1)}"h"===v.orientation?(i=r,l=e,u="y",f="x",d=L,p=A):(i=e,l=r,u="x",f="y",p=L,d=A);var S=t[u+"a"],C=t[f+"a"];h=Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0]));var O=n.getDistanceFunction(a,d,p,(function(t){return(d(t)+p(t))/2}));if(n.getClosest(g,O,t),!1!==t.index&&g[t.index].p!==c){y||(T=function(t){return Math.min(_(t),t.p-m.bargroupwidth/2)},k=function(t){return Math.max(w(t),t.p+m.bargroupwidth/2)});var D=g[t.index],z=v.base?D.b+D.s:D.s;t[f+"0"]=t[f+"1"]=C.c2p(D[f],!0),t[f+"LabelVal"]=z;var P=m.extents[m.extents.round(D.p)];t[u+"0"]=S.c2p(y?T(D):P[0],!0),t[u+"1"]=S.c2p(y?k(D):P[1],!0);var E=void 0!==D.orig_p;return t[u+"LabelVal"]=E?D.orig_p:D.p,t.labelLabel=s(S,t[u+"LabelVal"]),t.valueLabel=s(C,t[f+"LabelVal"]),t.baseLabel=s(C,D.b),t.spikeDistance=(L(D)+function(t){return M(_(t),w(t))}(D))/2-b,t[u+"Spike"]=S.c2p(D.p,!0),o(D,v,t),t.hovertemplate=v.hovertemplate,t}}function f(t,e){var r=e.mcc||t.marker.color,n=e.mlcc||t.marker.line.color,a=l(t,e);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}e.exports={hoverPoints:function(t,e,r,n){var i=u(t,e,r,n);if(i){var o=i.cd,l=o[0].trace,s=o[i.index];return i.color=f(l,s),a.getComponentMethod("errorbars","hoverInfo")(s,l,i),[i]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":104,"../../components/fx":144,"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/axes":277,"../../registry":324,"./helpers":340}],342:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc").crossTraceCalc,colorbar:t("../scatter/marker_colorbar"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot").plot,style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"bar",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":290,"../scatter/marker_colorbar":463,"./arrays_to_calcdata":333,"./attributes":334,"./calc":335,"./cross_trace_calc":337,"./defaults":338,"./event_data":339,"./hover":341,"./layout_attributes":343,"./layout_defaults":344,"./plot":345,"./select":346,"./style":348}],343:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],344:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/cartesian/axes"),i=t("../../lib"),o=t("./layout_attributes");e.exports=function(t,e,r){function l(r,n){return i.coerce(t,e,o,r,n)}for(var s=!1,c=!1,u=!1,f={},d=l("barmode"),p=0;p0}function L(t){return"auto"===t?0:t}function S(t,e){var r=Math.PI/180*e,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:t.width*a+t.height*n,y:t.width*n+t.height*a}}function C(t,e,r,n,a,i){var o=!!i.isHorizontal,l=!!i.constrained,s=i.angle||0,c=i.anchor||"end",u="end"===c,f="start"===c,d=((i.leftToRight||0)+1)/2,p=1-d,h=a.width,g=a.height,v=Math.abs(e-t),m=Math.abs(n-r),y=v>2*_&&m>2*_?_:0;v-=2*y,m-=2*y;var x=L(s);"auto"!==s||h<=v&&g<=m||!(h>v||g>m)||(h>m||g>v)&&h.01?q:function(t,e,r){return r&&t===e?t:Math.abs(t-e)>=2?q(t):t>e?Math.ceil(t):Math.floor(t)};N=G(N,B,I),B=G(B,N,I),H=G(H,j,!I),j=G(j,H,!I)}var Z=M(i.ensureSingle(z,"path"),D,v,m);if(Z.style("vector-effect","non-scaling-stroke").attr("d",isNaN((B-N)*(j-H))||U&&t._context.staticPlot?"M0,0Z":"M"+N+","+H+"V"+j+"H"+B+"V"+H+"Z").call(s.setClipUrl,e.layerClipId,t),!D.uniformtext.mode&&R){var Y=s.makePointStyleFns(f);s.singlePointStyle(c,Z,f,Y,t)}!function(t,e,r,n,a,l,c,f,p,v,m){var w,T=e.xaxis,A=e.yaxis,O=t._fullLayout;function D(e,r,n){return i.ensureSingle(e,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(s.font,n).call(o.convertToTspans,t)}var z=n[0].trace,P="h"===z.orientation,E=function(t,e,r,n,a){var o,l=e[0].trace;o=l.texttemplate?function(t,e,r,n,a){var o=e[0].trace,l=i.castOption(o,r,"texttemplate");if(!l)return"";var s,c,f,d,p="waterfall"===o.type,h="funnel"===o.type;"h"===o.orientation?(s="y",c=a,f="x",d=n):(s="x",c=n,f="y",d=a);function g(t){return u(d,+t,!0).text}var v=e[r],m={};m.label=v.p,m.labelLabel=m[s+"Label"]=(y=v.p,u(c,y,!0).text);var y;var x=i.castOption(o,v.i,"text");(0===x||x)&&(m.text=x);m.value=v.s,m.valueLabel=m[f+"Label"]=g(v.s);var _={};b(_,o,v.i),p&&(m.delta=+v.rawS||v.s,m.deltaLabel=g(m.delta),m.final=v.v,m.finalLabel=g(m.final),m.initial=m.final-m.delta,m.initialLabel=g(m.initial));h&&(m.value=v.s,m.valueLabel=g(m.value),m.percentInitial=v.begR,m.percentInitialLabel=i.formatPercent(v.begR),m.percentPrevious=v.difR,m.percentPreviousLabel=i.formatPercent(v.difR),m.percentTotal=v.sumR,m.percenTotalLabel=i.formatPercent(v.sumR));var w=i.castOption(o,v.i,"customdata");w&&(m.customdata=w);return i.texttemplateString(l,m,t._d3locale,_,m,o._meta||{})}(t,e,r,n,a):l.textinfo?function(t,e,r,n){var a=t[0].trace,o="h"===a.orientation,l="waterfall"===a.type,s="funnel"===a.type;function c(t){return u(o?r:n,+t,!0).text}var f,d=a.textinfo,p=t[e],h=d.split("+"),g=[],v=function(t){return-1!==h.indexOf(t)};v("label")&&g.push((m=t[e].p,u(o?n:r,m,!0).text));var m;v("text")&&(0===(f=i.castOption(a,p.i,"text"))||f)&&g.push(f);if(l){var y=+p.rawS||p.s,x=p.v,b=x-y;v("initial")&&g.push(c(b)),v("delta")&&g.push(c(y)),v("final")&&g.push(c(x))}if(s){v("value")&&g.push(c(p.s));var _=0;v("percent initial")&&_++,v("percent previous")&&_++,v("percent total")&&_++;var w=_>1;v("percent initial")&&(f=i.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),v("percent previous")&&(f=i.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),v("percent total")&&(f=i.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(e,r,n,a):g.getValue(l.text,r);return g.coerceString(y,o)}(O,n,a,T,A);w=function(t,e){var r=g.getValue(t.textposition,e);return g.coerceEnumerated(x,r)}(z,a);var I="stack"===v.mode||"relative"===v.mode,R=n[a],F=!I||R._outmost;if(!E||"none"===w||(R.isBlank||l===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var N=O.font,B=h.getBarColor(n[a],z),H=h.getInsideTextFont(z,a,N,B),j=h.getOutsideTextFont(z,a,N),U=r.datum();P?"log"===T.type&&U.s0<=0&&(l=T.range[0]=G*(W/Z):W>=Z*(X/G);G>0&&Z>0&&(Q||J||$)?w="inside":(w="outside",V.remove(),V=null)}else w="inside";if(!V){Y=i.ensureUniformFontSize(t,"outside"===w?j:H);var K=(V=D(r,E,Y)).attr("transform");if(V.attr("transform",""),q=s.bBox(V.node()),G=q.width,Z=q.height,V.attr("transform",K),G<=0||Z<=0)return void V.remove()}var tt,et,rt=z.textangle;"outside"===w?(et="both"===z.constraintext||"outside"===z.constraintext,tt=function(t,e,r,n,a,i){var o,l=!!i.isHorizontal,s=!!i.constrained,c=i.angle||0,u=a.width,f=a.height,d=Math.abs(e-t),p=Math.abs(n-r);o=l?p>2*_?_:0:d>2*_?_:0;var h=1;s&&(h=l?Math.min(1,p/f):Math.min(1,d/u));var g=L(c),v=S(a,g),m=(l?v.x:v.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(t+e)/2,w=(r+n)/2,T=0,M=0,A=l?k(e,t):k(r,n);l?(b=e-A*o,T=A*m):(w=n+A*o,M=-A*m);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:h,rotate:g}}(l,c,f,p,q,{isHorizontal:P,constrained:et,angle:rt})):(et="both"===z.constraintext||"inside"===z.constraintext,tt=C(l,c,f,p,q,{isHorizontal:P,constrained:et,angle:rt,anchor:z.insidetextanchor}));tt.fontSize=Y.size,d(z.type,tt,O),R.transform=tt,M(V,O,v,m).attr("transform",i.getTextTransform(tt))}(t,e,z,r,p,N,B,H,j,v,m),e.layerClipId&&s.hideOutsideRangePoint(c,z.select("text"),w,O,f.xcalendar,f.ycalendar)}));var H=!1===f.cliponaxis;s.setClipUrl(c,H?null:e.layerClipId,t)}));c.getComponentMethod("errorbars","plot")(t,z,e,v)},toMoveInsideBar:C}},{"../../components/color":104,"../../components/drawing":126,"../../components/fx/helpers":140,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/cartesian/axes":277,"../../registry":324,"./attributes":334,"./constants":336,"./helpers":340,"./style":348,"./uniform_text":350,d3:21,"fast-isnumeric":23}],346:[function(t,e,r){"use strict";function n(t,e,r,n,a){var i=e.c2p(n?t.s0:t.p0,!0),o=e.c2p(n?t.s1:t.p1,!0),l=r.c2p(n?t.p0:t.s0,!0),s=r.c2p(n?t.p1:t.s1,!0);return a?[(i+o)/2,(l+s)/2]:n?[o,(l+s)/2]:[(i+o)/2,s]}e.exports=function(t,e){var r,a=t.cd,i=t.xaxis,o=t.yaxis,l=a[0].trace,s="funnel"===l.type,c="h"===l.orientation,u=[];if(!1===e)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),e.selectAll("g.points").each((function(e){h(n.select(this),e[0].trace,t)})),l.getComponentMethod("errorbars","style")(e)},styleTextPoints:g,styleOnSelect:function(t,e,r){var a=e[0].trace;a.selectedpoints?function(t,e,r){i.selectedPointStyle(t.selectAll("path"),e),function(t,e,r){t.each((function(t){var a,l=n.select(this);if(t.selected){a=o.ensureUniformFontSize(r,v(l,t,e,r));var s=e.selected.textfont&&e.selected.textfont.color;s&&(a.color=s),i.font(l,a)}else i.selectedTextStyle(l,e)}))}(t.selectAll("text"),e,r)}(r,a,t):(h(r,a,t),l.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:s}},{"../../components/color":104,"../../components/drawing":126,"../../lib":232,"../../registry":324,"./attributes":334,"./helpers":340,"./uniform_text":350,d3:21}],349:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,l){r("marker.color",o),a(t,"marker")&&i(t,e,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(t,"marker.line")&&i(t,e,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":104,"../../components/colorscale/defaults":114,"../../components/colorscale/helpers":115}],350:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib");function i(t){return"_"+t+"Text_minsize"}e.exports={recordMinTextSize:function(t,e,r){if(r.uniformtext.mode){var n=i(t),a=r.uniformtext.minsize,o=e.scale*e.fontSize;e.hide=oS.uf};if(e._hasPreCompStats){var j=e[x],U=function(t){return y.d2c((e[t]||[])[r])},V=1/0,q=-1/0;for(r=0;r=S.q1&&S.q3>=S.med){var Z=U("lowerfence");S.lf=Z!==l&&Z<=S.q1?Z:p(S,O,D);var Y=U("upperfence");S.uf=Y!==l&&Y>=S.q3?Y:h(S,O,D);var X=U("mean");S.mean=X!==l?X:D?o.mean(O,D):(S.q1+S.q3)/2;var W=U("sd");S.sd=X!==l&&W>=0?W:D?o.stdev(O,D,S.mean):S.q3-S.q1,S.lo=g(S),S.uo=v(S);var Q=U("notchspan");Q=Q!==l&&Q>0?Q:m(S,D),S.ln=S.med-Q,S.un=S.med+Q;var J=S.lf,$=S.uf;e.boxpoints&&O.length&&(J=Math.min(J,O[0]),$=Math.max($,O[D-1])),e.notched&&(J=Math.min(J,S.ln),$=Math.max($,S.un)),S.min=J,S.max=$}else{var K;o.warn(["Invalid input - make sure that q1 <= median <= q3","q1 = "+S.q1,"median = "+S.med,"q3 = "+S.q3].join("\n")),K=S.med!==l?S.med:S.q1!==l?S.q3!==l?(S.q1+S.q3)/2:S.q1:S.q3!==l?S.q3:0,S.med=K,S.q1=S.q3=K,S.lf=S.uf=K,S.mean=S.sd=K,S.ln=S.un=K,S.min=S.max=K}V=Math.min(V,S.min),q=Math.max(q,S.max),S.pts2=C.filter(H),A.push(S)}}e._extremes[y._id]=a.findExtremes(y,[V,q],{padded:!0})}else{var tt=y.makeCalcdata(e,x),et=function(t,e){for(var r=t.length,n=new Array(r+1),a=0;a=0&&at0){var ut,ft;if((S={}).pos=S[_]=N[r],C=S.pts=nt[r].sort(f),D=(O=S[x]=C.map(d)).length,S.min=O[0],S.max=O[D-1],S.mean=o.mean(O,D),S.sd=o.stdev(O,D,S.mean),S.med=o.interp(O,.5),D%2&&(st||ct))st?(ut=O.slice(0,D/2),ft=O.slice(D/2+1)):ct&&(ut=O.slice(0,D/2+1),ft=O.slice(D/2)),S.q1=o.interp(ut,.5),S.q3=o.interp(ft,.5);else S.q1=o.interp(O,.25),S.q3=o.interp(O,.75);S.lf=p(S,O,D),S.uf=h(S,O,D),S.lo=g(S),S.uo=v(S);var dt=m(S,D);S.ln=S.med-dt,S.un=S.med+dt,it=Math.min(it,S.ln),ot=Math.max(ot,S.un),S.pts2=C.filter(H),A.push(S)}e._extremes[y._id]=a.findExtremes(y,e.notched?tt.concat([it,ot]):tt,{padded:!0})}return function(t,e){if(o.isArrayOrTypedArray(e.selectedpoints))for(var r=0;r0?(A[0].t={num:T[L],dPos:B,posLetter:_,valLetter:x,labels:{med:s(t,"median:"),min:s(t,"min:"),q1:s(t,"q1:"),q3:s(t,"q3:"),max:s(t,"max:"),mean:"sd"===e.boxmean?s(t,"mean \xb1 \u03c3:"):s(t,"mean:"),lf:s(t,"lower fence:"),uf:s(t,"upper fence:")}},T[L]++,A):[{t:{empty:!0}}]};var c={text:"tx",hovertext:"htx"};function u(t,e,r){for(var n in c)o.isArrayOrTypedArray(e[n])&&(Array.isArray(r)?o.isArrayOrTypedArray(e[n][r[0]])&&(t[c[n]]=e[n][r[0]][r[1]]):t[c[n]]=e[n][r])}function f(t,e){return t.v-e.v}function d(t){return t.v}function p(t,e,r){return 0===r?t.q1:Math.min(t.q1,e[Math.min(o.findBin(2.5*t.q1-1.5*t.q3,e,!0)+1,r-1)])}function h(t,e,r){return 0===r?t.q3:Math.max(t.q3,e[Math.max(o.findBin(2.5*t.q3-1.5*t.q1,e),0)])}function g(t){return 4*t.q1-3*t.q3}function v(t){return 4*t.q3-3*t.q1}function m(t,e){return 0===e?0:1.57*(t.q3-t.q1)/Math.sqrt(e)}},{"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/align_period":274,"../../plots/cartesian/axes":277,"fast-isnumeric":23}],353:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),a=t("../../lib"),i=t("../../plots/cartesian/constraints").getAxisGroup,o=["v","h"];function l(t,e,r,o){var l,s,c,u=e.calcdata,f=e._fullLayout,d=o._id,p=d.charAt(0),h=[],g=0;for(l=0;l1,b=1-f[t+"gap"],_=1-f[t+"groupgap"];for(l=0;l0){var q=S.pointpos,G=S.jitter,Z=S.marker.size/2,Y=0;q+G>=0&&((Y=U*(q+G))>A?(V=!0,H=Z,N=Y):Y>R&&(H=Z,N=A)),Y<=A&&(N=A);var X=0;q-G<=0&&((X=-U*(q-G))>L?(V=!0,j=Z,B=X):X>F&&(j=Z,B=L)),X<=L&&(B=L)}else N=A,B=L;var W=new Array(c.length);for(s=0;s0?(v="v",m=x>0?Math.min(_,b):Math.min(b)):x>0?(v="h",m=Math.min(_)):m=0;if(m){e._length=m;var L=r("orientation",v);e._hasPreCompStats?"v"===L&&0===x?(r("x0",0),r("dx",1)):"h"===L&&0===y&&(r("y0",0),r("dy",1)):"v"===L&&0===x?r("x0"):"h"===L&&0===y&&r("y0"),a.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],i)}else e.visible=!1}function f(t,e,r,a){var i=a.prefix,o=n.coerce2(t,e,c,"marker.outliercolor"),l=r("marker.line.outliercolor"),s="outliers";e._hasPreCompStats?s="all":(o||l)&&(s="suspectedoutliers");var u=r(i+"points",s);u?(r("jitter","all"===u?.3:0),r("pointpos","all"===u?-1.5:0),r("marker.symbol"),r("marker.opacity"),r("marker.size"),r("marker.color",e.line.color),r("marker.line.color"),r("marker.line.width"),"suspectedoutliers"===u&&(r("marker.line.outliercolor",e.marker.color),r("marker.line.outlierwidth")),r("selected.marker.color"),r("unselected.marker.color"),r("selected.marker.size"),r("unselected.marker.size"),r("text"),r("hovertext")):delete e.marker;var f=r("hoveron");"all"!==f&&-1===f.indexOf("points")||r("hovertemplate"),n.coerceSelectionMarkerOpacity(e,r)}e.exports={supplyDefaults:function(t,e,r,a){function l(r,a){return n.coerce(t,e,c,r,a)}if(u(t,e,l,a),!1!==e.visible){o(t,e,a,l);var s=e._hasPreCompStats;s&&(l("lowerfence"),l("upperfence")),l("line.color",(t.marker||{}).color||r),l("line.width"),l("fillcolor",i.addOpacity(e.line.color,.5));var d=!1;if(s){var p=l("mean"),h=l("sd");p&&p.length&&(d=!0,h&&h.length&&(d="sd"))}l("boxmean",d),l("whiskerwidth"),l("width"),l("quartilemethod");var g=!1;if(s){var v=l("notchspan");v&&v.length&&(g=!0)}else n.validate(t.notchwidth,c.notchwidth)&&(g=!0);l("notched",g)&&l("notchwidth"),f(t,e,l,{prefix:"box"})}},crossTraceDefaults:function(t,e){var r,a;function i(t){return n.coerce(a._input,a,c,t)}for(var o=0;ot.lo&&(x.so=!0)}return i}));d.enter().append("path").classed("point",!0),d.exit().remove(),d.call(i.translatePoints,o,l)}function s(t,e,r,i){var o,l,s=e.val,c=e.pos,u=!!c.rangebreaks,f=i.bPos,d=i.bPosPxOffset||0,p=r.boxmean||(r.meanline||{}).visible;Array.isArray(i.bdPos)?(o=i.bdPos[0],l=i.bdPos[1]):(o=i.bdPos,l=i.bdPos);var h=t.selectAll("path.mean").data("box"===r.type&&r.boxmean||"violin"===r.type&&r.box.visible&&r.meanline.visible?a.identity:[]);h.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),h.exit().remove(),h.each((function(t){var e=c.c2l(t.pos+f,!0),a=c.l2p(e-o)+d,i=c.l2p(e+l)+d,h=u?(a+i)/2:c.l2p(e)+d,g=s.c2p(t.mean,!0),v=s.c2p(t.mean-t.sd,!0),m=s.c2p(t.mean+t.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+g+","+a+"V"+i+("sd"===p?"m0,0L"+v+","+h+"L"+g+","+a+"L"+m+","+h+"Z":"")):n.select(this).attr("d","M"+a+","+g+"H"+i+("sd"===p?"m0,0L"+h+","+v+"L"+a+","+g+"L"+h+","+m+"Z":""))}))}e.exports={plot:function(t,e,r,i){var c=e.xaxis,u=e.yaxis;a.makeTraceGroups(i,r,"trace boxes").each((function(t){var e,r,a=n.select(this),i=t[0],f=i.t,d=i.trace;(f.wdPos=f.bdPos*d.whiskerwidth,!0!==d.visible||f.empty)?a.remove():("h"===d.orientation?(e=u,r=c):(e=c,r=u),o(a,{pos:e,val:r},d,f),l(a,{x:c,y:u},d,f),s(a,{pos:e,val:r},d,f))}))},plotBoxAndWhiskers:o,plotPoints:l,plotBoxMean:s}},{"../../components/drawing":126,"../../lib":232,d3:21}],361:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,a=t.cd,i=t.xaxis,o=t.yaxis,l=[];if(!1===e)for(r=0;ro.level||o.starts.length&&i===o.level)}break;case"constraint":if(n.prefixBoundary=!1,n.edgepaths.length)return;var l=n.x.length,s=n.y.length,c=-1/0,u=1/0;for(r=0;r":p>c&&(n.prefixBoundary=!0);break;case"<":(pc||n.starts.length&&d===u)&&(n.prefixBoundary=!0);break;case"][":f=Math.min(p[0],p[1]),d=Math.max(p[0],p[1]),fc&&(n.prefixBoundary=!0)}}}},{}],366:[function(t,e,r){"use strict";var n=t("../../components/colorscale"),a=t("./make_color_map"),i=t("./end_plus");e.exports={min:"zmin",max:"zmax",calc:function(t,e,r){var o=e.contours,l=e.line,s=o.size||1,c=o.coloring,u=a(e,{isColorbar:!0});if("heatmap"===c){var f=n.extractOpts(e);r._fillgradient=f.reversescale?n.flipScale(f.colorscale):f.colorscale,r._zrange=[f.min,f.max]}else"fill"===c&&(r._fillcolor=u);r._line={color:"lines"===c?u:l.color,width:!1!==o.showlines?l.width:0,dash:l.dash},r._levels={start:o.start,end:i(o),size:s}}}},{"../../components/colorscale":116,"./end_plus":374,"./make_color_map":379}],367:[function(t,e,r){"use strict";e.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],368:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./label_defaults"),i=t("../../components/color"),o=i.addOpacity,l=i.opacity,s=t("../../constants/filter_ops"),c=s.CONSTRAINT_REDUCTION,u=s.COMPARISON_OPS2;e.exports=function(t,e,r,i,s,f){var d,p,h,g=e.contours,v=r("contours.operation");(g._operation=c[v],function(t,e){var r;-1===u.indexOf(e.operation)?(t("contours.value",[0,1]),Array.isArray(e.value)?e.value.length>2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:n(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),n(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0))}(r,g),"="===v?d=g.showlines=!0:(d=r("contours.showlines"),h=r("fillcolor",o((t.line||{}).color||s,.5))),d)&&(p=r("line.color",h&&l(h)?o(e.fillcolor,1):s),r("line.width",2),r("line.dash"));r("line.smoothing"),a(r,i,p,f)}},{"../../components/color":104,"../../constants/filter_ops":209,"./label_defaults":378,"fast-isnumeric":23}],369:[function(t,e,r){"use strict";var n=t("../../constants/filter_ops"),a=t("fast-isnumeric");function i(t,e){var r,i=Array.isArray(e);function o(t){return a(t)?+t:null}return-1!==n.COMPARISON_OPS2.indexOf(t)?r=o(i?e[0]:e):-1!==n.INTERVAL_OPS.indexOf(t)?r=i?[o(e[0]),o(e[1])]:[o(e),o(e)]:-1!==n.SET_OPS.indexOf(t)&&(r=i?e.map(o):[o(e)]),r}function o(t){return function(e){e=i(t,e);var r=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return{start:r,end:n,size:n-r}}}function l(t){return function(e){return{start:e=i(t,e),end:1/0,size:1/0}}}e.exports={"[]":o("[]"),"][":o("]["),">":l(">"),"<":l("<"),"=":l("=")}},{"../../constants/filter_ops":209,"fast-isnumeric":23}],370:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=n("contours.start"),i=n("contours.end"),o=!1===a||!1===i,l=r("contours.size");!(o?e.autocontour=!0:r("autocontour",!1))&&l||r("ncontours")}},{}],371:[function(t,e,r){"use strict";var n=t("../../lib");function a(t){return n.extendFlat({},t,{edgepaths:n.extendDeep([],t.edgepaths),paths:n.extendDeep([],t.paths),starts:n.extendDeep([],t.starts)})}e.exports=function(t,e){var r,i,o,l=function(t){return t.reverse()},s=function(t){return t};switch(e){case"=":case"<":return t;case">":for(1!==t.length&&n.warn("Contour data invalid for the specified inequality operation."),i=t[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",t);break}return s}},{"../../lib":232,"./constraint_mapping":369,"./end_plus":374}],374:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],375:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./constants");function i(t,e,r,n){return Math.abs(t[0]-e[0])20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==a.BOTTOMSTART.indexOf(t)?i=1:-1!==a.LEFTSTART.indexOf(t)?n=1:-1!==a.TOPSTART.indexOf(t)?i=-1:n=-1;return[n,i]}(f,r,e),p=[l(t,e,[-d[0],-d[1]])],h=t.z.length,g=t.z[0].length,v=e.slice(),m=d.slice();for(c=0;c<1e4;c++){if(f>20?(f=a.CHOOSESADDLE[f][(d[0]||d[1])<0?0:1],t.crossings[u]=a.SADDLEREMAINDER[f]):delete t.crossings[u],!(d=a.NEWDELTA[f])){n.log("Found bad marching index:",f,e,t.level);break}p.push(l(t,e,d)),e[0]+=d[0],e[1]+=d[1],u=e.join(","),i(p[p.length-1],p[p.length-2],o,s)&&p.pop();var y=d[0]&&(e[0]<0||e[0]>g-2)||d[1]&&(e[1]<0||e[1]>h-2);if(e[0]===v[0]&&e[1]===v[1]&&d[0]===m[0]&&d[1]===m[1]||r&&y)break;f=t.crossings[u]}1e4===c&&n.log("Infinite loop in contour?");var x,b,_,w,T,k,M,A,L,S,C,O,D,z,P,E=i(p[0],p[p.length-1],o,s),I=0,R=.2*t.smoothing,F=[],N=0;for(c=1;c=N;c--)if((x=F[c])=N&&x+F[b]A&&L--,t.edgepaths[L]=C.concat(p,S));break}U||(t.edgepaths[A]=p.concat(S))}for(A=0;At?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);return 5===r||10===r?t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208:15===r?0:r}e.exports=function(t){var e,r,i,o,l,s,c,u,f,d=t[0].z,p=d.length,h=d[0].length,g=2===p||2===h;for(r=0;r=0&&(n=y,l=s):Math.abs(r[1]-n[1])<.01?Math.abs(r[1]-y[1])<.01&&(y[0]-r[0])*(n[0]-y[0])>=0&&(n=y,l=s):a.log("endpt to newendpt is not vert. or horz.",r,n,y)}if(r=n,l>=0)break;f+="L"+n}if(l===t.edgepaths.length){a.log("unclosed perimeter path");break}d=l,(h=-1===p.indexOf(d))&&(d=p[0],f+="Z")}for(d=0;dn.center?n.right-l:l-n.left)/(u+Math.abs(Math.sin(c)*o)),p=(s>n.middle?n.bottom-s:s-n.top)/(Math.abs(f)+Math.cos(c)*o);if(d<1||p<1)return 1/0;var h=m.EDGECOST*(1/(d-1)+1/(p-1));h+=m.ANGLECOST*c*c;for(var g=l-u,v=s-f,y=l+u,x=s+f,b=0;b2*m.MAXCOST)break;p&&(l/=2),s=(o=c-l/2)+1.5*l}if(d<=m.MAXCOST)return u},r.addLabelData=function(t,e,r,n){var a=e.fontSize,i=e.width+a/3,o=Math.max(0,e.height-a/3),l=t.x,s=t.y,c=t.theta,u=Math.sin(c),f=Math.cos(c),d=function(t,e){return[l+t*f-e*u,s+t*u+e*f]},p=[d(-i/2,-o/2),d(-i/2,o/2),d(i/2,o/2),d(i/2,-o/2)];r.push({text:e.text,x:l,y:s,dy:e.dy,theta:c,level:e.level,width:i,height:o}),n.push(p)},r.drawLabels=function(t,e,r,i,o){var s=t.selectAll("text").data(e,(function(t){return t.text+","+t.x+","+t.y+","+t.theta}));if(s.exit().remove(),s.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each((function(t){var e=t.x+Math.sin(t.theta)*t.dy,a=t.y-Math.cos(t.theta)*t.dy;n.select(this).text(t.text).attr({x:e,y:a,transform:"rotate("+180*t.theta/Math.PI+" "+e+" "+a+")"}).call(l.convertToTspans,r)})),o){for(var c="",u=0;ur.end&&(r.start=r.end=(r.start+r.end)/2),t._input.contours||(t._input.contours={}),a.extendFlat(t._input.contours,{start:r.start,end:r.end,size:r.size}),t._input.autocontour=!0}else if("constraint"!==r.type){var c,u=r.start,f=r.end,d=t._input.contours;if(u>f&&(r.start=d.start=f,f=r.end=d.end=u,u=r.start),!(r.size>0))c=u===f?1:i(u,f,t.ncontours).dtick,d.size=r.size=c}}},{"../../lib":232,"../../plots/cartesian/axes":277}],383:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/drawing"),i=t("../heatmap/style"),o=t("./make_color_map");e.exports=function(t){var e=n.select(t).selectAll("g.contour");e.style("opacity",(function(t){return t[0].trace.opacity})),e.each((function(t){var e=n.select(this),r=t[0].trace,i=r.contours,l=r.line,s=i.size||1,c=i.start,u="constraint"===i.type,f=!u&&"lines"===i.coloring,d=!u&&"fill"===i.coloring,p=f||d?o(r):null;e.selectAll("g.contourlevel").each((function(t){n.select(this).selectAll("path").call(a.lineGroupStyle,l.width,f?p(t.level):l.color,l.dash)}));var h=i.labelfont;if(e.selectAll("g.contourlabels text").each((function(t){a.font(n.select(this),{family:h.family,size:h.size,color:h.color||(f?p(t.level):l.color)})})),u)e.selectAll("g.contourfill path").style("fill",r.fillcolor);else if(d){var g;e.selectAll("g.contourfill path").style("fill",(function(t){return void 0===g&&(g=t.level),p(t.level+.5*s)})),void 0===g&&(g=c),e.selectAll("g.contourbg path").style("fill",p(g-.5*s))}})),i(t)}},{"../../components/drawing":126,"../heatmap/style":397,"./make_color_map":379,d3:21}],384:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults"),a=t("./label_defaults");e.exports=function(t,e,r,i,o){var l,s=r("contours.coloring"),c="";"fill"===s&&(l=r("contours.showlines")),!1!==l&&("lines"!==s&&(c=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==s&&(!0!==t.showlegend&&(e.showlegend=!1),e._dfltShowLegend=!1,n(t,e,i,r,{prefix:"",cLetter:"z"})),r("line.smoothing"),a(r,i,c,o)}},{"../../components/colorscale/defaults":114,"./label_defaults":378}],385:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../plots/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../../components/colorscale/attributes"),l=(t("../../constants/docs").FORMAT_LINK,t("../../lib/extend").extendFlat);e.exports=l({z:{valType:"data_array",editType:"calc"},x:l({},n.x,{impliedEdits:{xtype:"array"}}),x0:l({},n.x0,{impliedEdits:{xtype:"scaled"}}),dx:l({},n.dx,{impliedEdits:{xtype:"scaled"}}),y:l({},n.y,{impliedEdits:{ytype:"array"}}),y0:l({},n.y0,{impliedEdits:{ytype:"scaled"}}),dy:l({},n.dy,{impliedEdits:{ytype:"scaled"}}),xperiod:l({},n.xperiod,{impliedEdits:{xtype:"scaled"}}),yperiod:l({},n.yperiod,{impliedEdits:{ytype:"scaled"}}),xperiod0:l({},n.xperiod0,{impliedEdits:{xtype:"scaled"}}),yperiod0:l({},n.yperiod0,{impliedEdits:{ytype:"scaled"}}),xperiodalignment:l({},n.xperiodalignment,{impliedEdits:{xtype:"scaled"}}),yperiodalignment:l({},n.yperiodalignment,{impliedEdits:{ytype:"scaled"}}),text:{valType:"data_array",editType:"calc"},hovertext:{valType:"data_array",editType:"calc"},transpose:{valType:"boolean",dflt:!1,editType:"calc"},xtype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},ytype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,editType:"calc"},hoverongaps:{valType:"boolean",dflt:!0,editType:"none"},connectgaps:{valType:"boolean",editType:"calc"},xgap:{valType:"number",dflt:0,min:0,editType:"plot"},ygap:{valType:"number",dflt:0,min:0,editType:"plot"},zhoverformat:{valType:"string",dflt:"",editType:"none"},hovertemplate:i(),showlegend:l({},a.showlegend,{dflt:!1})},{transforms:void 0},o("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":111,"../../constants/docs":208,"../../lib/extend":226,"../../plots/attributes":273,"../../plots/template_attributes":319,"../scatter/attributes":445}],386:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../../plots/cartesian/align_period"),l=t("../histogram2d/calc"),s=t("../../components/colorscale/calc"),c=t("./convert_column_xyz"),u=t("./clean_2d_array"),f=t("./interp2d"),d=t("./find_empties"),p=t("./make_bound_array"),h=t("../../constants/numerical").BADNUM;function g(t){for(var e=[],r=t.length,n=0;nI){P("x scale is not linear");break}}if(x.length&&"fast"===D){var R=(x[x.length-1]-x[0])/(x.length-1),F=Math.abs(R/100);for(k=0;kF){P("y scale is not linear");break}}}var N=a.maxRowLength(T),B="scaled"===e.xtype?"":r,H=p(e,B,v,m,N,A),j="scaled"===e.ytype?"":x,U=p(e,j,b,_,T.length,L);O||(e._extremes[A._id]=i.findExtremes(A,H),e._extremes[L._id]=i.findExtremes(L,U));var V={x:H,y:U,z:T,text:e._text||e.text,hovertext:e._hovertext||e.hovertext};if(e.xperiodalignment&&y&&(V.orig_x=y),e.yperiodalignment&&w&&(V.orig_y=w),B&&B.length===H.length-1&&(V.xCenter=B),j&&j.length===U.length-1&&(V.yCenter=j),C&&(V.xRanges=M.xRanges,V.yRanges=M.yRanges,V.pts=M.pts),S||s(t,e,{vals:T,cLetter:"z"}),S&&e.contours&&"heatmap"===e.contours.coloring){var q={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};V.xfill=p(q,B,v,m,N,A),V.yfill=p(q,j,b,_,T.length,L)}return[V]}},{"../../components/colorscale/calc":112,"../../constants/numerical":211,"../../lib":232,"../../plots/cartesian/align_period":274,"../../plots/cartesian/axes":277,"../../registry":324,"../histogram2d/calc":414,"./clean_2d_array":387,"./convert_column_xyz":389,"./find_empties":391,"./interp2d":394,"./make_bound_array":395}],387:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r,o){var l,s,c,u,f,d;function p(t){if(n(t))return+t}if(e&&e.transpose){for(l=0,f=0;f=0;o--)(l=((f[[(r=(i=d[o])[0])-1,a=i[1]]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(s[i]=[r,a,l],d.splice(o,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(i in s)f[i]=s[i],u.push(s[i])}return u.sort((function(t,e){return e[2]-t[2]}))}},{"../../lib":232}],392:[function(t,e,r){"use strict";var n=t("../../components/fx"),a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../../components/colorscale").extractOpts;e.exports=function(t,e,r,l,s,c){var u,f,d,p,h=t.cd[0],g=h.trace,v=t.xa,m=t.ya,y=h.x,x=h.y,b=h.z,_=h.xCenter,w=h.yCenter,T=h.zmask,k=g.zhoverformat,M=y,A=x;if(!1!==t.index){try{d=Math.round(t.index[1]),p=Math.round(t.index[0])}catch(e){return void a.error("Error hovering on heatmap, pointNumber must be [row,col], found:",t.index)}if(d<0||d>=b[0].length||p<0||p>b.length)return}else{if(n.inbox(e-y[0],e-y[y.length-1],0)>0||n.inbox(r-x[0],r-x[x.length-1],0)>0)return;if(c){var L;for(M=[2*y[0]-y[1]],L=1;Lg&&(m=Math.max(m,Math.abs(t[i][o]-h)/(v-g))))}return m}e.exports=function(t,e){var r,a=1;for(o(t,e),r=0;r.01;r++)a=o(t,e,i(a));return a>.01&&n.log("interp2d didn't converge quickly",a),t}},{"../../lib":232}],395:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib").isArrayOrTypedArray;e.exports=function(t,e,r,i,o,l){var s,c,u,f=[],d=n.traceIs(t,"contour"),p=n.traceIs(t,"histogram"),h=n.traceIs(t,"gl2d");if(a(e)&&e.length>1&&!p&&"category"!==l.type){var g=e.length;if(!(g<=o))return d?e.slice(0,o):e.slice(0,o+1);if(d||h)f=e.slice(0,o);else if(1===o)f=[e[0]-.5,e[0]+.5];else{for(f=[1.5*e[0]-.5*e[1]],u=1;u0;)d=p.c2p(T[y]),y--;for(d0;)m=h.c2p(k[y]),y--;if(m0&&(i=!0);for(var s=0;si){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]c?t>o?t>1.1*a?a:t>1.1*i?i:o:t>l?l:t>s?s:c:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function p(t,e,r,n,i,l){if(n&&t>o){var s=h(e,i,l),c=h(r,i,l),u=t===a?0:1;return s[u]!==c[u]}return Math.floor(r/t)-Math.floor(e/t)>.1}function h(t,e,r){var n=e.c2d(t,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}e.exports=function(t,e,r,n,i){var l,s,c=-1.1*e,d=-.1*e,p=t-d,h=r[0],g=r[1],v=Math.min(f(h+d,h+p,n,i),f(g+d,g+p,n,i)),m=Math.min(f(h+c,h+d,n,i),f(g+c,g+d,n,i));if(v>m&&mo){var y=l===a?1:6,x=l===a?"M12":"M1";return function(e,r){var o=n.c2d(e,a,i),l=o.indexOf("-",y);l>0&&(o=o.substr(0,l));var c=n.d2c(o,0,i);if(cr.r2l(N)&&(H=o.tickIncrement(H,b.size,!0,p)),E.start=r.l2r(H),F||a.nestedProperty(e,m+".start").set(E.start)}var j=b.end,U=r.r2l(P.end),V=void 0!==U;if((b.endFound||V)&&U!==r.r2l(j)){var q=V?U:a.aggNums(Math.max,null,h);E.end=r.l2r(q),V||a.nestedProperty(e,m+".start").set(E.end)}var G="autobin"+l;return!1===e._input[G]&&(e._input[m]=a.extendFlat({},e[m]||{}),delete e._input[G],delete e[G]),[E,h]}e.exports={calc:function(t,e){var r,i,p,h,g=[],v=[],m=o.getFromId(t,"h"===e.orientation?e.yaxis:e.xaxis),y="h"===e.orientation?"y":"x",x={x:"y",y:"x"}[y],b=e[y+"calendar"],_=e.cumulative,w=d(t,e,m,y),T=w[0],k=w[1],M="string"==typeof T.size,A=[],L=M?A:T,S=[],C=[],O=[],D=0,z=e.histnorm,P=e.histfunc,E=-1!==z.indexOf("density");_.enabled&&E&&(z=z.replace(/ ?density$/,""),E=!1);var I,R="max"===P||"min"===P?null:0,F=s.count,N=c[z],B=!1,H=function(t){return m.r2c(t,0,b)};for(a.isArrayOrTypedArray(e[x])&&"count"!==P&&(I=e[x],B="avg"===P,F=s[P]),r=H(T.start),p=H(T.end)+(r-o.tickIncrement(r,T.size,!1,b))/1e6;r=0&&h=0;n--)l(n);else if("increasing"===e){for(n=1;n=0;n--)t[n]+=t[n+1];"exclude"===r&&(t.push(0),t.shift())}}(v,_.direction,_.currentbin);var Q=Math.min(g.length,v.length),J=[],$=0,K=Q-1;for(r=0;r=$;r--)if(v[r]){K=r;break}for(r=$;r<=K;r++)if(n(g[r])&&n(v[r])){var tt={p:g[r],s:v[r],b:0};_.enabled||(tt.pts=O[r],G?tt.ph0=tt.ph1=O[r].length?k[O[r][0]]:g[r]:(e._computePh=!0,tt.ph0=V(A[r]),tt.ph1=V(A[r+1],!0))),J.push(tt)}return 1===J.length&&(J[0].width1=o.tickIncrement(J[0].p,T.size,!1,b)-J[0].p),l(J,e),a.isArrayOrTypedArray(e.selectedpoints)&&a.tagSelected(J,e,X),J},calcAllAutoBins:d}},{"../../lib":232,"../../plots/cartesian/axes":277,"../../registry":324,"../bar/arrays_to_calcdata":333,"./average":401,"./bin_functions":403,"./bin_label_vals":404,"./norm_functions":412,"fast-isnumeric":23}],406:[function(t,e,r){"use strict";e.exports={eventDataKeys:["binNumber"]}},{}],407:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axis_ids"),i=t("../../registry").traceIs,o=t("../bar/defaults").handleGroupingDefaults,l=n.nestedProperty,s=t("../../plots/cartesian/constraints").getAxisGroup,c=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],u=["x","y"];e.exports=function(t,e){var r,f,d,p,h,g,v,m=e._histogramBinOpts={},y=[],x={},b=[];function _(t,e){return n.coerce(r._input,r,r._module.attributes,t,e)}function w(t){return"v"===t.orientation?"x":"y"}function T(t,r,i){var o=t.uid+"__"+i;r||(r=o);var l=function(t,r){return a.getFromTrace({_fullLayout:e},t,r).type}(t,i),s=t[i+"calendar"]||"",c=m[r],u=!0;c&&(l===c.axType&&s===c.calendar?(u=!1,c.traces.push(t),c.dirs.push(i)):(r=o,l!==c.axType&&n.warn(["Attempted to group the bins of trace",t.index,"set on a","type:"+l,"axis","with bins on","type:"+c.axType,"axis."].join(" ")),s!==c.calendar&&n.warn(["Attempted to group the bins of trace",t.index,"set with a",s,"calendar","with bins",c.calendar?"on a "+c.calendar+" calendar":"w/o a set calendar"].join(" ")))),u&&(m[r]={traces:[t],dirs:[i],axType:l,calendar:t[i+"calendar"]||""}),t["_"+i+"bingroup"]=r}for(h=0;hL&&T.splice(L,T.length-L),A.length>L&&A.splice(L,A.length-L);var S=[],C=[],O=[],D="string"==typeof w.size,z="string"==typeof M.size,P=[],E=[],I=D?P:w,R=z?E:M,F=0,N=[],B=[],H=e.histnorm,j=e.histfunc,U=-1!==H.indexOf("density"),V="max"===j||"min"===j?null:0,q=i.count,G=o[H],Z=!1,Y=[],X=[],W="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";W&&"count"!==j&&(Z="avg"===j,q=i[j]);var Q=w.size,J=x(w.start),$=x(w.end)+(J-a.tickIncrement(J,Q,!1,m))/1e6;for(r=J;r<$;r=a.tickIncrement(r,Q,!1,m))C.push(V),P.push(r),Z&&O.push(0);P.push(r);var K,tt=C.length,et=(r-J)/tt,rt=(K=J+et/2,g.c2r(K,0,m)),nt=M.size,at=b(M.start),it=b(M.end)+(at-a.tickIncrement(at,nt,!1,y))/1e6;for(r=at;r=0&&p=0&&h0||n.inbox(r-o.y0,r-(o.y0+o.h*l.dy),0)>0)){var u,f=Math.floor((e-o.x0)/l.dx),d=Math.floor(Math.abs(r-o.y0)/l.dy);if(l._hasZ?u=o.z[d][f]:l._hasSource&&(u=l._canvas.el.getContext("2d").getImageData(f,d,1,1).data),u){var p,h=o.hi||l.hoverinfo;if(h){var g=h.split("+");-1!==g.indexOf("all")&&(g=["color"]),-1!==g.indexOf("color")&&(p=!0)}var v,m=i.colormodel[l.colormodel],y=m.colormodel||l.colormodel,x=y.length,b=l._scaler(u),_=m.suffix,w=[];(l.hovertemplate||p)&&(w.push("["+[b[0]+_[0],b[1]+_[1],b[2]+_[2]].join(", ")),4===x&&w.push(", "+b[3]+_[3]),w.push("]"),w=w.join(""),t.extraText=y.toUpperCase()+": "+w),Array.isArray(l.hovertext)&&Array.isArray(l.hovertext[d])?v=l.hovertext[d][f]:Array.isArray(l.text)&&Array.isArray(l.text[d])&&(v=l.text[d][f]);var T=c.c2p(o.y0+(d+.5)*l.dy),k=o.x0+(f+.5)*l.dx,M=o.y0+(d+.5)*l.dy,A="["+u.slice(0,l.colormodel.length).join(", ")+"]";return[a.extendFlat(t,{index:[d,f],x0:s.c2p(o.x0+f*l.dx),x1:s.c2p(o.x0+(f+1)*l.dx),y0:T,y1:T,color:b,xVal:k,xLabelVal:k,yVal:M,yLabelVal:M,zLabelVal:A,text:v,hovertemplateLabels:{zLabel:A,colorLabel:w,"color[0]Label":b[0]+_[0],"color[1]Label":b[1]+_[1],"color[2]Label":b[2]+_[2],"color[3]Label":b[3]+_[3]}})]}}}},{"../../components/fx":144,"../../lib":232,"./constants":424}],429:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover"),eventData:t("./event_data"),moduleType:"trace",name:"image",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","2dMap","noSortingByValue"],animatable:!1,meta:{}}},{"../../plots/cartesian":290,"./attributes":422,"./calc":423,"./defaults":425,"./event_data":426,"./hover":428,"./plot":430,"./style":431}],430:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=a.strTranslate,o=t("../../constants/xmlns_namespaces"),l=t("./constants"),s=a.isIOS()||a.isSafari()||a.isIE();e.exports=function(t,e,r,c){var u=e.xaxis,f=e.yaxis,d=!(s||t._context._exportedPlot);a.makeTraceGroups(c,r,"im").each((function(e){var r=n.select(this),s=e[0],c=s.trace,p=d&&!c._hasZ&&c._hasSource&&"linear"===u.type&&"linear"===f.type;c._fastImage=p;var h,g,v,m,y,x,b=s.z,_=s.x0,w=s.y0,T=s.w,k=s.h,M=c.dx,A=c.dy;for(x=0;void 0===h&&x0;)g=u.c2p(_+x*M),x--;for(x=0;void 0===m&&x0;)y=f.c2p(w+x*A),x--;if(gz[0];if(P||E){var I=h+L/2,R=m+S/2;O+="transform:"+i(I+"px",R+"px")+"scale("+(P?-1:1)+","+(E?-1:1)+")"+i(-I+"px",-R+"px")+";"}}C.attr("style",O);var F=new Promise((function(t){if(c._hasZ)t();else if(c._hasSource)if(c._canvas&&c._canvas.el.width===T&&c._canvas.el.height===k&&c._canvas.source===c.source)t();else{var e=document.createElement("canvas");e.width=T,e.height=k;var r=e.getContext("2d");c._image=c._image||new Image;var n=c._image;n.onload=function(){r.drawImage(n,0,0),c._canvas={el:e,source:c.source},t()},n.setAttribute("src",c.source)}})).then((function(){var t;if(c._hasZ)t=N((function(t,e){return b[e][t]})).toDataURL("image/png");else if(c._hasSource)if(p)t=c.source;else{var e=c._canvas.el.getContext("2d").getImageData(0,0,T,k).data;t=N((function(t,r){var n=4*(r*T+t);return[e[n],e[n+1],e[n+2],e[n+3]]})).toDataURL("image/png")}C.attr({"xlink:href":t,height:S,width:L,x:h,y:m})}));t._promises.push(F)}function N(t){var e=document.createElement("canvas");e.width=L,e.height=S;var r,n=e.getContext("2d"),i=function(t){return a.constrain(Math.round(u.c2p(_+t*M)-h),0,L)},o=function(t){return a.constrain(Math.round(f.c2p(w+t*A)-m),0,S)},d=l.colormodel[c.colormodel],p=d.colormodel||c.colormodel,g=d.fmt;for(x=0;x0){l=!0;break}}l||(o=0)}return{hasLabels:r,hasValues:i,len:o}}e.exports={handleLabelsAndValues:s,supplyDefaults:function(t,e,r,n){function c(r,n){return a.coerce(t,e,i,r,n)}var u=s(c("labels"),c("values")),f=u.len;if(e._hasLabels=u.hasLabels,e._hasValues=u.hasValues,!e._hasLabels&&e._hasValues&&(c("label0"),c("dlabel")),f){e._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var d,p=c("text"),h=c("texttemplate");if(h||(d=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),h||d&&"none"!==d){var g=c("textposition");l(t,e,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(e,n,c);var v=c("hole");if(c("title.text")){var m=c("title.position",v?"middle center":"top center");v||"middle center"!==m||(e.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else e.visible=!1}}},{"../../lib":232,"../../plots/domain":304,"../bar/defaults":338,"./attributes":432,"fast-isnumeric":23}],436:[function(t,e,r){"use strict";var n=t("../../components/fx/helpers").appendArrayMultiPointValues;e.exports=function(t,e){var r={curveNumber:e.index,pointNumbers:t.pts,data:e._input,fullData:e,label:t.label,color:t.color,value:t.v,percent:t.percent,text:t.text,v:t.v};return 1===t.pts.length&&(r.pointNumber=r.i=t.pts[0]),n(r,e,t.pts),"funnelarea"===e.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":140}],437:[function(t,e,r){"use strict";var n=t("../../lib");function a(t){return-1!==t.indexOf("e")?t.replace(/[.]?0+e/,"e"):-1!==t.indexOf(".")?t.replace(/[.]?0+$/,""):t}r.formatPiePercent=function(t,e){var r=a((100*t).toPrecision(3));return n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=a(t.toPrecision(10));return n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:t.pxmid[0]<0?"left":"right",color:v.castOption(b.bgcolor,t.pts)||t.color,borderColor:v.castOption(b.bordercolor,t.pts),fontFamily:v.castOption(_.family,t.pts),fontSize:v.castOption(_.size,t.pts),fontColor:v.castOption(_.color,t.pts),nameLength:v.castOption(b.namelength,t.pts),textAlign:v.castOption(b.align,t.pts),hovertemplate:v.castOption(u.hovertemplate,t.pts),hovertemplateLabels:t,eventData:[m(t,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:e}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,e.emit("plotly_hover",{points:[m(t,u)],event:n.event})}})),t.on("mouseout",(function(t){var r=e._fullLayout,a=e._fullData[o.index],l=n.select(this).datum();o._hasHoverEvent&&(t.originalEvent=n.event,e.emit("plotly_unhover",{points:[m(l,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),t.on("click",(function(t){var r=e._fullLayout,a=e._fullData[o.index];e._dragging||!1===r.hovermode||(e._hoverdata=[m(t,a)],i.click(e,n.event))}))}function b(t,e,r){var n=v.castOption(t.insidetextfont.color,e.pts);!n&&t._input.textfont&&(n=v.castOption(t._input.textfont.color,e.pts));var a=v.castOption(t.insidetextfont.family,e.pts)||v.castOption(t.textfont.family,e.pts)||r.family,i=v.castOption(t.insidetextfont.size,e.pts)||v.castOption(t.textfont.size,e.pts)||r.size;return{color:n||o.contrast(e.color),family:a,size:i}}function _(t,e){for(var r,n,a=0;ae&&e>n||r=-4;v-=2)m(Math.PI*v,"tan");for(v=4;v>=-4;v-=2)m(Math.PI*(v+1),"tan")}if(f||p){for(v=4;v>=-4;v-=2)m(Math.PI*(v+1.5),"rad");for(v=4;v>=-4;v-=2)m(Math.PI*(v+.5),"rad")}}if(l||h||f){var y=Math.sqrt(t.width*t.width+t.height*t.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(e.startangle+e.stopangle)/2,i.scale>=1)return i;g.push(i)}(h||p)&&((i=T(t,n,o,s,c)).textPosAngle=(e.startangle+e.stopangle)/2,g.push(i)),(h||d)&&((i=k(t,n,o,s,c)).textPosAngle=(e.startangle+e.stopangle)/2,g.push(i));for(var x=0,b=0,_=0;_=1)break}return g[x]}function T(t,e,r,n,a){e=Math.max(0,e-2*g);var i=t.width/t.height,o=L(i,n,e,r);return{scale:2*o/t.height,rCenter:M(i,o/e),rotate:A(a)}}function k(t,e,r,n,a){e=Math.max(0,e-2*g);var i=t.height/t.width,o=L(i,n,e,r);return{scale:2*o/t.width,rCenter:M(i,o/e),rotate:A(a+Math.PI/2)}}function M(t,e){return Math.cos(e)-t*e}function A(t){return(180/Math.PI*t+720)%180-90}function L(t,e,r,n){var a=t+1/(2*Math.tan(e));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(t*t+n/2)+t))}function S(t,e){return t.v!==e.vTotal||e.trace.hole?Math.min(1/(1+1/Math.sin(t.halfangle)),t.ring/2):1}function C(t,e){var r=e.pxmid[0],n=e.pxmid[1],a=t.width/2,i=t.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function O(t,e){var r,n,a,i=t.trace,o={x:t.cx,y:t.cy},l={tx:0,ty:0};l.ty+=i.title.font.size,a=z(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*t.r,l.ty-=t.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*t.r);var s,c,u=(s=t.r,c=t.trace.aspectratio,s/(void 0===c?1:c)),f=e.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(f+=u,o.x-=(1+a)*u,l.tx+=t.titleBox.width/2):-1!==i.title.position.indexOf("center")?f*=2:-1!==i.title.position.indexOf("right")&&(f+=u,o.x+=(1+a)*u,l.tx-=t.titleBox.width/2),r=f/t.titleBox.width,n=D(t,e)/t.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:l.tx,ty:l.ty}}function D(t,e){var r=t.trace,n=e.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(t.titleBox.height,n/2)}function z(t){var e,r=t.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,e=0;er&&(r=t.pull[e]);return r}function P(t,e){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,s=c*u}o=Math.min(o,s/r.vTotal)}for(n=0;n")}if(i){var x=s.castOption(a,e.i,"texttemplate");if(x){var b=function(t){return{label:t.label,value:t.v,valueLabel:v.formatPieValue(t.v,n.separators),percent:t.v/r.vTotal,percentLabel:v.formatPiePercent(t.v/r.vTotal,n.separators),color:t.color,text:t.text,customdata:s.castOption(a,t.i,"customdata")}}(e),_=v.getFirstFilled(a.text,e.pts);(y(_)||""===_)&&(b.text=_),e.text=s.texttemplateString(x,b,t._fullLayout._d3locale,b,a._meta||{})}else e.text=""}}function R(t,e){var r=t.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(e.left+e.right)/2,o=(e.top+e.bottom)/2;t.textX=i*n-o*a,t.textY=i*a+o*n,t.noCenter=!0}e.exports={plot:function(t,e){var r=t._fullLayout,i=r._size;h("pie",r),_(e,t),P(e,i);var d=s.makeTraceGroups(r._pielayer,e,"trace").each((function(e){var d=n.select(this),h=e[0],g=h.trace;!function(t){var e,r,n,a=t[0],i=a.r,o=a.trace,l=v.getRotationAngle(o.rotation),s=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(e=0;ea.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=S(r,a))}(e),d.attr("stroke-linejoin","round"),d.each((function(){var m=n.select(this).selectAll("g.slice").data(e);m.enter().append("g").classed("slice",!0),m.exit().remove();var y=[[[],[]],[[],[]]],_=!1;m.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=g.index,y[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=h.cx,c=h.cy,u=n.select(this),d=u.selectAll("path.surface").data([a]);if(d.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),u.call(x,t,e),g.pull){var m=+v.castOption(g.pull,a.pts)||0;m>0&&(o+=m*a.pxmid[0],c+=m*a.pxmid[1])}a.cxFinal=o,a.cyFinal=c;var T=g.hole;if(a.v===h.vTotal){var k="M"+(o+a.px0[0])+","+(c+a.px0[1])+O(a.px0,a.pxmid,!0,1)+O(a.pxmid,a.px0,!0,1)+"Z";T?d.attr("d","M"+(o+T*a.px0[0])+","+(c+T*a.px0[1])+O(a.px0,a.pxmid,!1,T)+O(a.pxmid,a.px0,!1,T)+"Z"+k):d.attr("d",k)}else{var M=O(a.px0,a.px1,!0,1);if(T){var A=1-T;d.attr("d","M"+(o+T*a.px1[0])+","+(c+T*a.px1[1])+O(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else d.attr("d","M"+o+","+c+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}I(t,a,h);var L=v.castOption(g.textposition,a.pts),S=u.selectAll("g.slicetext").data(a.text&&"none"!==L?[0]:[]);S.enter().append("g").classed("slicetext",!0),S.exit().remove(),S.each((function(){var u=s.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),d=s.ensureUniformFontSize(t,"outside"===L?function(t,e,r){var n=v.castOption(t.outsidetextfont.color,e.pts)||v.castOption(t.textfont.color,e.pts)||r.color,a=v.castOption(t.outsidetextfont.family,e.pts)||v.castOption(t.textfont.family,e.pts)||r.family,i=v.castOption(t.outsidetextfont.size,e.pts)||v.castOption(t.textfont.size,e.pts)||r.size;return{color:n,family:a,size:i}}(g,a,r.font):b(g,a,r.font));u.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,d).call(f.convertToTspans,t);var m,y=l.bBox(u.node());if("outside"===L)m=C(y,a);else if(m=w(y,a,h),"auto"===L&&m.scale<1){var x=s.ensureUniformFontSize(t,g.outsidetextfont);u.call(l.font,x),m=C(y=l.bBox(u.node()),a)}var T=m.textPosAngle,k=void 0===T?a.pxmid:E(h.r,T);if(m.targetX=o+k[0]*m.rCenter+(m.x||0),m.targetY=c+k[1]*m.rCenter+(m.y||0),R(m,y),m.outside){var M=m.targetY;a.yLabelMin=M-y.height/2,a.yLabelMid=M,a.yLabelMax=M+y.height/2,a.labelExtraX=0,a.labelExtraY=0,_=!0}m.fontSize=d.size,p(g.type,m,r),e[i].transform=m,u.attr("transform",s.getTextTransform(m))}))}function O(t,e,r,n){var i=n*(e[0]-t[0]),o=n*(e[1]-t[1]);return"a"+n*h.r+","+n*h.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var T=n.select(this).selectAll("g.titletext").data(g.title.text?[0]:[]);if(T.enter().append("g").classed("titletext",!0),T.exit().remove(),T.each((function(){var e,r=s.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),a=g.title.text;g._meta&&(a=s.templateString(a,g._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(l.font,g.title.font).call(f.convertToTspans,t),e="middle center"===g.title.position?function(t){var e=Math.sqrt(t.titleBox.width*t.titleBox.width+t.titleBox.height*t.titleBox.height);return{x:t.cx,y:t.cy,scale:t.trace.hole*t.r*2/e,tx:0,ty:-t.titleBox.height/2+t.trace.title.font.size}}(h):O(h,i),r.attr("transform",u(e.x,e.y)+c(Math.min(1,e.scale))+u(e.tx,e.ty))})),_&&function(t,e){var r,n,a,i,o,l,s,c,u,f,d,p,h;function g(t,e){return t.pxmid[1]-e.pxmid[1]}function m(t,e){return e.pxmid[1]-t.pxmid[1]}function y(t,r){r||(r={});var a,c,u,d,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),h=n?t.yLabelMin:t.yLabelMax,g=n?t.yLabelMax:t.yLabelMin,m=t.cyFinal+o(t.px0[1],t.px1[1]),y=p-h;if(y*s>0&&(t.labelExtraY=y),Array.isArray(e.pull))for(c=0;c=(v.castOption(e.pull,u.pts)||0)||((t.pxmid[1]-u.pxmid[1])*s>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-h-t.labelExtraY)*s>0&&(t.labelExtraY+=y):(g+t.labelExtraY-m)*s>0&&(a=3*l*Math.abs(c-f.indexOf(t)),(d=u.cxFinal+i(u.px0[0],u.px1[0])+a-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*l>0&&(t.labelExtraX+=d)))}for(n=0;n<2;n++)for(a=n?g:m,o=n?Math.max:Math.min,s=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,l=r?1:-1,(c=t[n][r]).sort(a),u=t[1-n][r],f=u.concat(c),p=[],d=0;dMath.abs(f)?l+="l"+f*t.pxmid[0]/t.pxmid[1]+","+f+"H"+(i+t.labelExtraX+c):l+="l"+t.labelExtraX+","+u+"v"+(f-u)+"h"+c}else l+="V"+(t.yLabelMid+t.labelExtraY)+"h"+c;s.ensureSingle(r,"path","textline").call(o.stroke,e.outsidetextfont.color).attr({"stroke-width":Math.min(2,e.outsidetextfont.size/8),d:l,fill:"none"})}else r.select("path.textline").remove()}))}(m,g),_&&g.automargin){var k=l.bBox(d.node()),M=g.domain,A=i.w*(M.x[1]-M.x[0]),L=i.h*(M.y[1]-M.y[0]),S=(.5*A-h.r)/i.w,D=(.5*L-h.r)/i.h;a.autoMargin(t,"pie."+g.uid+".automargin",{xl:M.x[0]-S,xr:M.x[1]+S,yb:M.y[0]-D,yt:M.y[1]+D,l:Math.max(h.cx-h.r-k.left,0),r:Math.max(k.right-(h.cx+h.r),0),b:Math.max(k.bottom-(h.cy+h.r),0),t:Math.max(h.cy-h.r-k.top,0),pad:5})}}))}));setTimeout((function(){d.selectAll("tspan").each((function(){var t=n.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))}))}),0)},formatSliceLabel:I,transformInsideText:w,determineInsideTextFont:b,positionTitleOutside:O,prerenderTitles:_,layoutAreas:P,attachFxHandlers:x,computeTransform:R}},{"../../components/color":104,"../../components/drawing":126,"../../components/fx":144,"../../lib":232,"../../lib/svg_text_utils":253,"../../plots/plots":311,"../bar/constants":336,"../bar/uniform_text":350,"./event_data":436,"./helpers":437,d3:21}],442:[function(t,e,r){"use strict";var n=t("d3"),a=t("./style_one"),i=t("../bar/uniform_text").resizeText;e.exports=function(t){var e=t._fullLayout._pielayer.selectAll(".trace");i(t,e,"pie"),e.each((function(t){var e=t[0].trace,r=n.select(this);r.style({opacity:e.opacity}),r.selectAll("path.surface").each((function(t){n.select(this).call(a,t,e)}))}))}},{"../bar/uniform_text":350,"./style_one":443,d3:21}],443:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("./helpers").castOption;e.exports=function(t,e,r){var i=r.marker.line,o=a(i.color,e.pts)||n.defaultLine,l=a(i.width,e.pts)||0;t.style("stroke-width",l).call(n.fill,e.color).call(n.stroke,o)}},{"../../components/color":104,"./helpers":437}],444:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rs&&S[m].gap;)m--;for(x=S[m].s,g=S.length-1;g>m;g--)S[g].s=x;for(;sA[u]&&u=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],452:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("./attributes"),o=t("./constants"),l=t("./subtypes"),s=t("./xy_defaults"),c=t("./period_defaults"),u=t("./stack_defaults"),f=t("./marker_defaults"),d=t("./line_defaults"),p=t("./line_shape_defaults"),h=t("./text_defaults"),g=t("./fillcolor_defaults");e.exports=function(t,e,r,v){function m(r,a){return n.coerce(t,e,i,r,a)}var y=s(t,e,v,m);if(y||(e.visible=!1),e.visible){c(t,e,v,m);var x=u(t,e,v,m),b=!x&&yG!=(F=z[O][1])>=G&&(E=z[O-1][0],I=z[O][0],F-R&&(P=E+(I-E)*(G-R)/(F-R),j=Math.min(j,P),U=Math.max(U,P)));j=Math.max(j,0),U=Math.min(U,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:j,x1:U,y0:G,y1:G,color:Z,hovertemplate:!1}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":104,"../../components/fx":144,"../../lib":232,"../../registry":324,"./get_trace_color":455}],457:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":290,"./arrays_to_calcdata":444,"./attributes":445,"./calc":446,"./cross_trace_calc":450,"./cross_trace_defaults":451,"./defaults":452,"./format_labels":454,"./hover":456,"./marker_colorbar":463,"./plot":466,"./select":467,"./style":469,"./subtypes":470}],458:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,l,s){var c=(t.marker||{}).color;(l("line.color",r),a(t,"line"))?i(t,e,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":114,"../../components/colorscale/helpers":115,"../../lib":232}],459:[function(t,e,r){"use strict";var n=t("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=t("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=t("./constants");e.exports=function(t,e){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,T,k,M,A,L=e.xaxis,S=e.yaxis,C="log"===L.type,O="log"===S.type,D=L._length,z=S._length,P=e.connectGaps,E=e.baseTolerance,I=e.shape,R="linear"===I,F=e.fill&&"none"!==e.fill,N=[],B=f.minTolerance,H=t.length,j=new Array(H),U=0;function V(r){var n=t[r];if(!n)return!1;var i=e.linearized?L.l2p(n.x):L.c2p(n.x),s=e.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;O&&s===a&&(i*=Math.abs(L._m*z*(L._m>0?o:l)/(S._m*D*(S._m>0?o:l)))),i*=1e3}if(s===a){if(O&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function q(t,e,r,n){var a=r-t,i=n-e,o=.5-t,l=.5-e,s=a*a+i*i,c=a*o+i*l;if(c>0&&crt||t[1]at)return[u(t[0],et,rt),u(t[1],nt,at)]}function lt(t,e){return t[0]===e[0]&&(t[0]===et||t[0]===rt)||(t[1]===e[1]&&(t[1]===nt||t[1]===at)||void 0)}function st(t,e,r){return function(n,a){var i=ot(n),o=ot(a),l=[];if(i&&o&<(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[t]+a[t])/2,e,r)-((i||n)[t]+(o||a)[t]);c&&((i&&o?c>0==i[t]>o[t]?i:o:i||o)[t]+=c);return l}}function ct(t){var e=t[0],r=t[1],n=e===j[U-1][0],a=r===j[U-1][1];if(!n||!a)if(U>1){var i=e===j[U-2][0],o=r===j[U-2][1];n&&(e===et||e===rt)&&i?o?U--:j[U-1]=t:a&&(r===nt||r===at)&&o?i?U--:j[U-1]=t:j[U++]=t}else j[U++]=t}function ut(t){j[U-1][0]!==t[0]&&j[U-1][1]!==t[1]&&ct([W,Q]),ct(t),J=null,W=Q=0}function ft(t){if(M=t[0]/D,A=t[1]/z,Y=t[0]rt?rt:0,X=t[1]at?at:0,Y||X){if(U)if(J){var e=K(J,t);e.length>1&&(ut(e[0]),j[U++]=e[1])}else $=K(j[U-1],t)[0],j[U++]=$;else j[U++]=[Y||t[0],X||t[1]];var r=j[U-1];Y&&X&&(r[0]!==Y||r[1]!==X)?(J&&(W!==Y&&Q!==X?ct(W&&Q?(n=J,i=(a=t)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?et:rt,at]:[o>0?rt:et,nt]):[W||Y,Q||X]):W&&Q&&ct([W,Q])),ct([Y,X])):W-Y&&Q-X&&ct([Y||W,X||Q]),J=t,W=Y,Q=X}else J&&ut(K(J,t)[0]),j[U++]=t;var n,a,i,o}for("linear"===I||"spline"===I?K=function(t,e){for(var r=[],n=0,a=0;a<4;a++){var i=it[a],o=c(t[0],t[1],e[0],e[1],i[0],i[1],i[2],i[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&&Z(o,t)G(h,dt))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=t.length||!h)break;ft(h),n=h}}else ft(d)}J&&ct([W||J[0],Q||J[1]]),N.push(j.slice(0,U))}return N}},{"../../constants/numerical":211,"../../lib":232,"./constants":449}],460:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],461:[function(t,e,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};e.exports=function(t,e,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(e,a):0}}},{"fast-isnumeric":23}],463:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],464:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,l,s,c){var u=o.isBubble(t),f=(t.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&i(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&e.marker.color!==f?f:u?n.background:n.defaultLine),a(t,"marker.line")&&i(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":104,"../../components/colorscale/defaults":114,"../../components/colorscale/helpers":115,"./subtypes":470}],465:[function(t,e,r){"use strict";var n=t("../../lib").dateTick0,a=t("../../constants/numerical").ONEWEEK;function i(t,e){return n(e,t%a==0?1:0)}e.exports=function(t,e,r,n,a){if(a||(a={x:!0,y:!0}),a.x){var o=n("xperiod");o&&(n("xperiod0",i(o,e.xcalendar)),n("xperiodalignment"))}if(a.y){var l=n("yperiod");l&&(n("yperiod0",i(l,e.ycalendar)),n("yperiodalignment"))}}},{"../../constants/numerical":211,"../../lib":232}],466:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../registry"),i=t("../../lib"),o=i.ensureSingle,l=i.identity,s=t("../../components/drawing"),c=t("./subtypes"),u=t("./line_points"),f=t("./link_traces"),d=t("../../lib/polygon").tester;function p(t,e,r,f,p,h,g){var v;!function(t,e,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(t){return m?t.transition():t}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(h),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),L=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(t,k,r,g),!0===_.visible){var S,C;y(T).style("opacity",_.opacity);var O=_.fill.charAt(_.fill.length-1);"x"!==O&&"y"!==O&&(O=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var D,z,P="",E=[],I=_._prevtrace;I&&(P=I._prevRevpath||"",C=I._nextFill,E=I._polygons);var R,F,N,B,H,j,U,V="",q="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(R=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):R=F="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]?s.smoothclosed(t.slice(1),w.smoothing):s.smoothopen(t,w.smoothing)}:function(t){return"M"+t.join("L")},N=function(t){return F(t.reverse())},G=u(f,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),U=_._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",D).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",D),s.singleLineStyle(f,a)}}}}}var Y=M.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(Z(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(Y,r.layerClipId,t),G.length?(S?(S.datum(f),B&&j&&(O?("y"===O?B[1]=j[1]=b.c2p(0,!0):"x"===O&&(B[0]=j[0]=x.c2p(0,!0)),y(S).attr("d","M"+j+"L"+B+"L"+V.substr(1)).call(s.singleFillStyle)):y(S).attr("d",V+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&V&&P?("tonext"===_.fill?y(C).attr("d",V+"Z"+P+"Z").call(s.singleFillStyle):y(C).attr("d",V+"L"+P.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(E)):(W(C),_._polygons=null)),_._prevRevpath=q,_._prevPolygons=U):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(e,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=tt(u),h=et,g=et;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===t._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?J:Q:_&&!w&&(v=$),f&&(h=v),d&&(g=v)}var T,k=(o=e.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&k.call(s.pointStyle,u,t).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=s.makePointStyleFns(u)),o.each((function(e){var a=n.select(this),i=y(a);s.translatePoint(e,i,x,b)?(s.singlePointStyle(e,i,u,T,t),r.layerClipId&&s.hideOutsideRangePoint(e,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(t){var e=n.select(this),a=y(e.select("text"));s.translatePoint(t,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(t,e,x,b,u.xcalendar,u.ycalendar):e.remove()})),o.selectAll("text").call(s.textPointStyle,u,t).each((function(t){var e=x.c2p(t.x),r=b.c2p(t.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:e,y:r})}))})),o.exit().remove()}(A,L,f);var X=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,X,t),s.setClipUrl(L,X,t)}function W(t){y(t).attr("d","M0,0Z")}function Q(t){return t.filter((function(t){return!t.gap&&t.vis}))}function J(t){return t.filter((function(t){return t.vis}))}function $(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,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(t,e,r);((u=a.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),u.order(),function(t,e,r){e.each((function(e){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,t);var i=e[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(t){i[t]=null})).remove(),u.order().each((function(t){i[t]=o(n.select(this),"path","js-fill")}))}))}(t,u,e),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(t,n,e,r,v,this,i)}))}))):u.each((function(r,n){p(t,n,e,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":126,"../../lib":232,"../../lib/polygon":244,"../../registry":324,"./line_points":459,"./link_traces":461,"./subtypes":470,d3:21}],467:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,i,o,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===e)for(r=0;r"),o.hovertemplate=d.hovertemplate,i}function x(t,e){m.push(t._hovertitle+": "+e)}}},{"../scatter/hover":456}],479:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../scatter/select"),eventData:t("./event_data"),moduleType:"trace",name:"scatterternary",basePlotModule:t("../../plots/ternary"),categories:["ternary","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/ternary":320,"../scatter/marker_colorbar":463,"../scatter/select":467,"../scatter/style":469,"./attributes":473,"./calc":474,"./defaults":475,"./event_data":476,"./format_labels":477,"./hover":478,"./plot":480}],480:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e,r){var a=e.plotContainer;a.select(".scatterlayer").selectAll("*").remove();var i={xaxis:e.xaxis,yaxis:e.yaxis,plot:a,layerClipId:e._hasClipOnAxisFalse?e.clipIdRelative:null},o=e.layers.frontplot.select("g.scatterlayer");n(t,i,r,o)}},{"../scatter/plot":466}],481:[function(t,e,r){"use strict";var n=t("../box/attributes"),a=t("../../lib/extend").extendFlat;e.exports={y:n.y,x:n.x,x0:n.x0,y0:n.y0,name:a({},n.name,{}),orientation:a({},n.orientation,{}),bandwidth:{valType:"number",min:0,editType:"calc"},scalegroup:{valType:"string",dflt:"",editType:"calc"},scalemode:{valType:"enumerated",values:["width","count"],dflt:"width",editType:"calc"},spanmode:{valType:"enumerated",values:["soft","hard","manual"],dflt:"soft",editType:"calc"},span:{valType:"info_array",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}],editType:"calc"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:n.fillcolor,points:a({},n.boxpoints,{}),jitter:a({},n.jitter,{}),pointpos:a({},n.pointpos,{}),width:a({},n.width,{}),marker:n.marker,text:n.text,hovertext:n.hovertext,hovertemplate:n.hovertemplate,box:{visible:{valType:"boolean",dflt:!1,editType:"plot"},width:{valType:"number",min:0,max:1,dflt:.25,editType:"plot"},fillcolor:{valType:"color",editType:"style"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"plot"},meanline:{visible:{valType:"boolean",dflt:!1,editType:"plot"},color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"plot"},side:{valType:"enumerated",values:["both","positive","negative"],dflt:"both",editType:"calc"},offsetgroup:n.offsetgroup,alignmentgroup:n.alignmentgroup,selected:n.selected,unselected:n.unselected,hoveron:{valType:"flaglist",flags:["violins","points","kde"],dflt:"violins+points+kde",extras:["all"],editType:"style"}}},{"../../lib/extend":226,"../box/attributes":351}],482:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("../box/calc"),o=t("./helpers"),l=t("../../constants/numerical").BADNUM;function s(t,e,r){var a=e.max-e.min;if(!a)return t.bandwidth?t.bandwidth:0;if(t.bandwidth)return Math.max(t.bandwidth,a/1e4);var i=r.length,o=n.stdev(r,i-1,e.mean);return Math.max(function(t,e,r){return 1.059*Math.min(e,r/1.349)*Math.pow(t,-.2)}(i,o,e.q3-e.q1),a/100)}function c(t,e,r,n){var i,o=t.spanmode,s=t.span||[],c=[e.min,e.max],u=[e.min-2*n,e.max+2*n];function f(n){var a=s[n],i="multicategory"===r.type?r.r2c(a):r.d2c(a,0,t[e.valLetter+"calendar"]);return i===l?u[n]:i}var d={type:"linear",range:i="soft"===o?u:"hard"===o?c:[f(0),f(1)]};return a.setConvert(d),d.cleanRange(),i}e.exports=function(t,e){var r=i(t,e);if(r[0].t.empty)return r;for(var l=t._fullLayout,u=a.getFromId(t,e["h"===e.orientation?"xaxis":"yaxis"]),f=1/0,d=-1/0,p=0,h=0,g=0;g0){var y,x,b,_,w,T=t.xa,k=t.ya;"h"===d.orientation?(w=e,y="y",b=k,x="x",_=T):(w=r,y="x",b=T,x="y",_=k);var M=f[t.index];if(w>=M.span[0]&&w<=M.span[1]){var A=n.extendFlat({},t),L=_.c2p(w,!0),S=o.getKdeValue(M,d,w),C=o.getPositionOnKdePath(M,d,L),O=b._offset,D=b._length;A[y+"0"]=C[0],A[y+"1"]=C[1],A[x+"0"]=A[x+"1"]=L,A[x+"Label"]=x+": "+a.hoverLabelText(_,w)+", "+f[0].t.labels.kde+" "+S.toFixed(3),A.spikeDistance=m[0].spikeDistance;var z=y+"Spike";A[z]=m[0][z],m[0].spikeDistance=void 0,m[0][z]=void 0,A.hovertemplate=!1,v.push(A),(u={stroke:t.color})[y+"1"]=n.constrain(O+C[0],O,O+D),u[y+"2"]=n.constrain(O+C[1],O,O+D),u[x+"1"]=u[x+"2"]=_._offset+L}}h&&(v=v.concat(m))}-1!==p.indexOf("points")&&(c=i.hoverOnPoints(t,e,r));var P=s.selectAll(".violinline-"+d.uid).data(u?[0]:[]);return P.enter().append("line").classed("violinline-"+d.uid,!0).attr("stroke-width",1.5),P.exit().remove(),P.attr(u),"closest"===l?c?[c]:v:c?(v.push(c),v):v}},{"../../lib":232,"../../plots/cartesian/axes":277,"../box/hover":356,"./helpers":485}],487:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("../box/defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../box/select"),moduleType:"trace",name:"violin",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":290,"../box/defaults":354,"../box/select":361,"../scatter/style":469,"./attributes":481,"./calc":482,"./cross_trace_calc":483,"./defaults":484,"./hover":486,"./layout_attributes":488,"./layout_defaults":489,"./plot":490,"./style":491}],488:[function(t,e,r){"use strict";var n=t("../box/layout_attributes"),a=t("../../lib").extendFlat;e.exports={violinmode:a({},n.boxmode,{}),violingap:a({},n.boxgap,{}),violingroupgap:a({},n.boxgroupgap,{})}},{"../../lib":232,"../box/layout_attributes":358}],489:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes"),i=t("../box/layout_defaults");e.exports=function(t,e,r){i._supply(t,e,r,(function(r,i){return n.coerce(t,e,a,r,i)}),"violin")}},{"../../lib":232,"../box/layout_defaults":359,"./layout_attributes":488}],490:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/drawing"),o=t("../box/plot"),l=t("../scatter/line_points"),s=t("./helpers");e.exports=function(t,e,r,c){var u=t._fullLayout,f=e.xaxis,d=e.yaxis;function p(t){var e=l(t,{xaxis:f,yaxis:d,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0,linearized:!0});return i.smoothopen(e[0],1)}a.makeTraceGroups(c,r,"trace violins").each((function(t){var r=n.select(this),i=t[0],l=i.t,c=i.trace;if(!0!==c.visible||l.empty)r.remove();else{var h=l.bPos,g=l.bdPos,v=e[l.valLetter+"axis"],m=e[l.posLetter+"axis"],y="both"===c.side,x=y||"positive"===c.side,b=y||"negative"===c.side,_=r.selectAll("path.violin").data(a.identity);_.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin"),_.exit().remove(),_.each((function(t){var e,r,a,i,o,s,f,d,_=n.select(this),w=t.density,T=w.length,k=m.c2l(t.pos+h,!0),M=m.l2p(k);if(c.width)e=l.maxKDE/g;else{var A=u._violinScaleGroupStats[c.scalegroup];e="count"===c.scalemode?A.maxKDE/g*(A.maxCount/t.pts.length):A.maxKDE/g}if(x){for(f=new Array(T),o=0;o 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -437,19 +398,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -458,7 +418,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -466,33 +426,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -514,44 +470,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -561,20 +502,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -596,35 +536,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -633,7 +576,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -641,7 +584,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -650,7 +593,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -663,17 +606,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -696,12 +640,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -710,16 +654,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -727,6 +664,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -735,23 +678,33 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],14:[function(_dereq_,module,exports){ @@ -11394,7 +11347,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); },{}],17:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -12570,8 +12523,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":34}],18:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":63}],18:[function(_dereq_,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -12597,7 +12550,158 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":23}],19:[function(_dereq_,module,exports){ +},{"is-string-blank":52}],19:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],20:[function(_dereq_,module,exports){ +module.exports = clone; + +/** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param {mat4} a matrix to clone + * @returns {mat4} a new 4x4 matrix + */ +function clone(a) { + var out = new Float32Array(16); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],21:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],22:[function(_dereq_,module,exports){ +module.exports = create; + +/** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ +function create() { + var out = new Float32Array(16); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],23:[function(_dereq_,module,exports){ +module.exports = determinant; + +/** + * Calculates the determinant of a mat4 + * + * @param {mat4} a the source matrix + * @returns {Number} determinant of a + */ +function determinant(a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; +}; +},{}],24:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -12645,8 +12749,1033 @@ function fromQuat(out, q) { return out; }; -},{}],20:[function(_dereq_,module,exports){ -(function (global){ +},{}],25:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],26:[function(_dereq_,module,exports){ +module.exports = fromRotationTranslation; + +/** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat4} q Rotation quaternion + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; +}; +},{}],27:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],28:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],29:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],30:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],31:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],32:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],33:[function(_dereq_,module,exports){ +module.exports = identity; + +/** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ +function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],34:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":19,"./clone":20,"./copy":21,"./create":22,"./determinant":23,"./fromQuat":24,"./fromRotation":25,"./fromRotationTranslation":26,"./fromScaling":27,"./fromTranslation":28,"./fromXRotation":29,"./fromYRotation":30,"./fromZRotation":31,"./frustum":32,"./identity":33,"./invert":35,"./lookAt":36,"./multiply":37,"./ortho":38,"./perspective":39,"./perspectiveFromFieldOfView":40,"./rotate":41,"./rotateX":42,"./rotateY":43,"./rotateZ":44,"./scale":45,"./str":46,"./translate":47,"./transpose":48}],35:[function(_dereq_,module,exports){ +module.exports = invert; + +/** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; +}; +},{}],36:[function(_dereq_,module,exports){ +var identity = _dereq_('./identity'); + +module.exports = lookAt; + +/** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {vec3} eye Position of the viewer + * @param {vec3} center Point the viewer is looking at + * @param {vec3} up vec3 pointing up + * @returns {mat4} out + */ +function lookAt(out, eye, center, up) { + var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, + eyex = eye[0], + eyey = eye[1], + eyez = eye[2], + upx = up[0], + upy = up[1], + upz = up[2], + centerx = center[0], + centery = center[1], + centerz = center[2]; + + if (Math.abs(eyex - centerx) < 0.000001 && + Math.abs(eyey - centery) < 0.000001 && + Math.abs(eyez - centerz) < 0.000001) { + return identity(out); + } + + z0 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + + x0 = upy * z2 - upz * z1; + x1 = upz * z0 - upx * z2; + x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + y0 = z1 * x2 - z2 * x1; + y1 = z2 * x0 - z0 * x2; + y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + + return out; +}; +},{"./identity":33}],37:[function(_dereq_,module,exports){ +module.exports = multiply; + +/** + * Multiplies two mat4's + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ +function multiply(out, a, b) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + // Cache only the current line of the second matrix + var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; + out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; + out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; + out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + return out; +}; +},{}],38:[function(_dereq_,module,exports){ +module.exports = ortho; + +/** + * Generates a orthogonal projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} left Left bound of the frustum + * @param {number} right Right bound of the frustum + * @param {number} bottom Bottom bound of the frustum + * @param {number} top Top bound of the frustum + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function ortho(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; +},{}],39:[function(_dereq_,module,exports){ +module.exports = perspective; + +/** + * Generates a perspective projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspective(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2), + nf = 1 / (near - far); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + return out; +}; +},{}],40:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],41:[function(_dereq_,module,exports){ +module.exports = rotate; + +/** + * Rotates a mat4 by the given angle + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function rotate(out, a, rad, axis) { + var x = axis[0], y = axis[1], z = axis[2], + len = Math.sqrt(x * x + y * y + z * z), + s, c, t, + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23, + b00, b01, b02, + b10, b11, b12, + b20, b21, b22; + + if (Math.abs(len) < 0.000001) { return null; } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + s = Math.sin(rad); + c = Math.cos(rad); + t = 1 - c; + + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + // Construct the elements of the rotation matrix + b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; + b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; + b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; +}; +},{}],42:[function(_dereq_,module,exports){ +module.exports = rotateX; + +/** + * Rotates a matrix by the given angle around the X axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateX(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; +}; +},{}],43:[function(_dereq_,module,exports){ +module.exports = rotateY; + +/** + * Rotates a matrix by the given angle around the Y axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateY(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; +}; +},{}],44:[function(_dereq_,module,exports){ +module.exports = rotateZ; + +/** + * Rotates a matrix by the given angle around the Z axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateZ(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; +}; +},{}],45:[function(_dereq_,module,exports){ +module.exports = scale; + +/** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to scale + * @param {vec3} v the vec3 to scale the matrix by + * @returns {mat4} out + **/ +function scale(out, a, v) { + var x = v[0], y = v[1], z = v[2]; + + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],46:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],47:[function(_dereq_,module,exports){ +module.exports = translate; + +/** + * Translate a mat4 by the given vector + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to translate + * @param {vec3} v vector to translate by + * @returns {mat4} out + */ +function translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; +}; +},{}],48:[function(_dereq_,module,exports){ +module.exports = transpose; + +/** + * Transpose the values of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function transpose(out, a) { + // If we are transposing ourselves we can skip a few steps but have to cache some values + if (out === a) { + var a01 = a[1], a02 = a[2], a03 = a[3], + a12 = a[6], a13 = a[7], + a23 = a[11]; + + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + + return out; +}; +},{}],49:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -12661,8 +13790,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":22}],21:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":51}],50:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -12688,9 +13817,9 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":22}],22:[function(_dereq_,module,exports){ +},{"is-browser":51}],51:[function(_dereq_,module,exports){ module.exports = true; -},{}],23:[function(_dereq_,module,exports){ +},{}],52:[function(_dereq_,module,exports){ 'use strict'; /** @@ -12727,7 +13856,7 @@ module.exports = function(str){ return true; } -},{}],24:[function(_dereq_,module,exports){ +},{}],53:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -12754,7 +13883,7 @@ function getBoundingClientOffset (element) { } } -},{}],25:[function(_dereq_,module,exports){ +},{}],54:[function(_dereq_,module,exports){ module.exports = parse @@ -12813,7 +13942,7 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],26:[function(_dereq_,module,exports){ +},{}],55:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -12941,7 +14070,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":27,"./lib/epsilon":28,"./lib/geojson":29,"./lib/intersecter":30,"./lib/segment-chainer":32,"./lib/segment-selector":33}],27:[function(_dereq_,module,exports){ +},{"./lib/build-log":56,"./lib/epsilon":57,"./lib/geojson":58,"./lib/intersecter":59,"./lib/segment-chainer":61,"./lib/segment-selector":62}],56:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -13056,7 +14185,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],28:[function(_dereq_,module,exports){ +},{}],57:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -13228,7 +14357,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],29:[function(_dereq_,module,exports){ +},{}],58:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -13418,7 +14547,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],30:[function(_dereq_,module,exports){ +},{}],59:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -13925,7 +15054,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":31}],31:[function(_dereq_,module,exports){ +},{"./linked-list":60}],60:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -14008,7 +15137,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],32:[function(_dereq_,module,exports){ +},{}],61:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -14262,7 +15391,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],33:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -14430,7 +15559,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],34:[function(_dereq_,module,exports){ +},{}],63:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -14616,8 +15745,8 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],35:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +},{}],64:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -15813,7 +16942,7 @@ else { })(Math); -},{}],36:[function(_dereq_,module,exports){ +},{}],65:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -15884,7 +17013,7 @@ module.exports = [ } ]; -},{}],37:[function(_dereq_,module,exports){ +},{}],66:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -15899,7 +17028,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -16239,7 +17395,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":213,"../../plots/cartesian/constants":229,"../../plots/font_attributes":251,"./arrow_paths":36}],38:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":184,"../../plot_api/plot_template":243,"../../plots/cartesian/constants":260,"../../plots/font_attributes":282,"./arrow_paths":65}],67:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16276,10 +17432,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -16328,7 +17486,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":179,"../../plots/cartesian/axes":223,"./draw":43}],39:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/axes":254,"./draw":72}],68:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16466,7 +17624,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":179,"../../plot_api/plot_template":213,"../../registry":265}],40:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/plot_template":243,"../../registry":296}],69:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16545,7 +17703,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":179,"../color":52}],41:[function(_dereq_,module,exports){ +},{"../../lib":209,"../color":81}],70:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16608,7 +17766,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":202,"fast-isnumeric":18}],42:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":232,"fast-isnumeric":18}],71:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16671,7 +17829,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -16715,7 +17874,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":179,"../../plots/array_container_defaults":219,"../../plots/cartesian/axes":223,"./attributes":37,"./common_defaults":40}],43:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/array_container_defaults":249,"../../plots/cartesian/axes":254,"./attributes":66,"./common_defaults":69}],72:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -16731,6 +17890,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -16791,6 +17951,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -17014,13 +18199,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -17036,12 +18222,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -17058,8 +18249,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -17249,7 +18461,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -17280,22 +18492,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -17327,14 +18540,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -17343,7 +18559,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -17353,7 +18571,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -17373,7 +18593,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -17415,7 +18635,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":179,"../../lib/setcursor":198,"../../lib/svg_text_utils":200,"../../plot_api/plot_template":213,"../../plots/cartesian/axes":223,"../../plots/plots":257,"../../registry":265,"../color":52,"../dragelement":71,"../drawing":74,"../fx":92,"./draw_arrow_head":44,"d3":16}],44:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../lib/setcursor":228,"../../lib/svg_text_utils":230,"../../plot_api/plot_template":243,"../../plots/cartesian/axes":254,"../../plots/plots":288,"../../registry":296,"../color":81,"../dragelement":100,"../drawing":103,"../fx":121,"./draw_arrow_head":73,"d3":16}],73:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17433,6 +18653,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -17552,9 +18777,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -17566,7 +18791,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":52,"./arrow_paths":36,"d3":16}],45:[function(_dereq_,module,exports){ +},{"../../lib":209,"../color":81,"./arrow_paths":65,"d3":16}],74:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17600,7 +18825,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":235,"./attributes":37,"./calc_autorange":38,"./click":39,"./convert_coords":41,"./defaults":42,"./draw":43}],46:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":266,"./attributes":66,"./calc_autorange":67,"./click":68,"./convert_coords":70,"./defaults":71,"./draw":72}],75:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17688,7 +18913,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":206,"../../plot_api/plot_template":213,"../annotations/attributes":37}],47:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":236,"../../plot_api/plot_template":243,"../annotations/attributes":66}],76:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17753,7 +18978,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":179,"../../plots/cartesian/axes":223}],48:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/axes":254}],77:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17829,7 +19054,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":179,"../../plots/array_container_defaults":219,"../../plots/cartesian/axes":223,"../annotations/common_defaults":40,"./attributes":46}],49:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/array_container_defaults":249,"../../plots/cartesian/axes":254,"../annotations/common_defaults":69,"./attributes":75}],78:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17881,7 +19106,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":254,"../annotations/draw":43}],50:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":285,"../annotations/draw":72}],79:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17929,7 +19154,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":179,"../../registry":265,"./attributes":46,"./convert":47,"./defaults":48,"./draw":49}],51:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296,"./attributes":75,"./convert":76,"./defaults":77,"./draw":78}],80:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -17969,7 +19194,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],52:[function(_dereq_,module,exports){ +},{}],81:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18143,7 +19368,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":51,"fast-isnumeric":18,"tinycolor2":35}],53:[function(_dereq_,module,exports){ +},{"./attributes":80,"fast-isnumeric":18,"tinycolor2":64}],82:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18268,6 +19493,17 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -18284,6 +19520,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -18322,7 +19559,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":173,"../../plot_api/edit_types":206,"../../plots/cartesian/layout_attributes":237,"../../plots/font_attributes":251}],54:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plot_api/edit_types":236,"../../plots/cartesian/layout_attributes":268,"../../plots/font_attributes":282}],83:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18350,7 +19587,7 @@ module.exports = { } }; -},{}],55:[function(_dereq_,module,exports){ +},{}],84:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18404,10 +19641,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -18416,7 +19657,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":179,"../../plot_api/plot_template":213,"../../plots/cartesian/tick_label_defaults":244,"../../plots/cartesian/tick_mark_defaults":245,"../../plots/cartesian/tick_value_defaults":246,"./attributes":53}],56:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/plot_template":243,"../../plots/cartesian/tick_label_defaults":275,"../../plots/cartesian/tick_mark_defaults":276,"../../plots/cartesian/tick_value_defaults":277,"./attributes":82}],85:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18435,6 +19676,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -18689,10 +19931,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -18804,18 +20046,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -18879,20 +20122,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -18902,7 +20144,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -18947,7 +20193,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -19003,7 +20249,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -19098,10 +20344,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -19143,7 +20391,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":154,"../../lib":179,"../../lib/extend":173,"../../lib/setcursor":198,"../../lib/svg_text_utils":200,"../../plots/cartesian/axes":223,"../../plots/cartesian/axis_defaults":225,"../../plots/cartesian/layout_attributes":237,"../../plots/cartesian/position_defaults":240,"../../plots/plots":257,"../../registry":265,"../color":52,"../colorscale/helpers":63,"../dragelement":71,"../drawing":74,"../titles":147,"./constants":54,"d3":16,"tinycolor2":35}],57:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":209,"../../lib/extend":203,"../../lib/setcursor":228,"../../lib/svg_text_utils":230,"../../plots/cartesian/axes":254,"../../plots/cartesian/axis_defaults":256,"../../plots/cartesian/layout_attributes":268,"../../plots/cartesian/position_defaults":271,"../../plots/plots":288,"../../registry":296,"../color":81,"../colorscale/helpers":92,"../dragelement":100,"../drawing":103,"../titles":176,"./constants":83,"d3":16,"tinycolor2":64}],86:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19162,7 +20410,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":179}],58:[function(_dereq_,module,exports){ +},{"../../lib":209}],87:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19184,7 +20432,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":53,"./defaults":55,"./draw":56,"./has_colorbar":57}],59:[function(_dereq_,module,exports){ +},{"./attributes":82,"./defaults":84,"./draw":85,"./has_colorbar":86}],88:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19392,7 +20640,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":194,"../colorbar/attributes":53,"./scales.js":67}],60:[function(_dereq_,module,exports){ +},{"../../lib/regex":224,"../colorbar/attributes":82,"./scales.js":96}],89:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19471,7 +20719,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":179,"./helpers":63,"fast-isnumeric":18}],61:[function(_dereq_,module,exports){ +},{"../../lib":209,"./helpers":92,"fast-isnumeric":18}],90:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19548,7 +20796,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":179,"./helpers":63}],62:[function(_dereq_,module,exports){ +},{"../../lib":209,"./helpers":92}],91:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19673,7 +20921,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":179,"../../registry":265,"../colorbar/defaults":55,"../colorbar/has_colorbar":57,"./scales":67,"fast-isnumeric":18}],63:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296,"../colorbar/defaults":84,"../colorbar/has_colorbar":86,"./scales":96,"fast-isnumeric":18}],92:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19913,7 +21161,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":179,"../color":52,"./scales":67,"d3":16,"fast-isnumeric":18,"tinycolor2":35}],64:[function(_dereq_,module,exports){ +},{"../../lib":209,"../color":81,"./scales":96,"d3":16,"fast-isnumeric":18,"tinycolor2":64}],93:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19955,7 +21203,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":59,"./calc":60,"./cross_trace_defaults":61,"./defaults":62,"./helpers":63,"./layout_attributes":65,"./layout_defaults":66,"./scales":67}],65:[function(_dereq_,module,exports){ +},{"./attributes":88,"./calc":89,"./cross_trace_defaults":90,"./defaults":91,"./helpers":92,"./layout_attributes":94,"./layout_defaults":95,"./scales":96}],94:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20016,7 +21264,7 @@ module.exports = { })) }; -},{"../../lib/extend":173,"./attributes":59,"./scales":67}],66:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"./attributes":88,"./scales":96}],95:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20067,7 +21315,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":179,"../../plot_api/plot_template":213,"./defaults":62,"./layout_attributes":65}],67:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/plot_template":243,"./defaults":91,"./layout_attributes":94}],96:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20271,7 +21519,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":35}],68:[function(_dereq_,module,exports){ +},{"tinycolor2":64}],97:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20304,7 +21552,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],69:[function(_dereq_,module,exports){ +},{}],98:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20342,7 +21590,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":179}],70:[function(_dereq_,module,exports){ +},{"../../lib":209}],99:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20401,7 +21649,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],71:[function(_dereq_,module,exports){ +},{}],100:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20693,7 +21941,7 @@ function pointerOffset(e) { ); } -},{"../../lib":179,"../../plots/cartesian/constants":229,"./align":68,"./cursor":69,"./unhover":72,"has-hover":20,"has-passive-events":21,"mouse-event-offset":24}],72:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/constants":260,"./align":97,"./cursor":98,"./unhover":101,"has-hover":49,"has-passive-events":50,"mouse-event-offset":53}],101:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20748,7 +21996,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":171,"../../lib/events":172,"../../lib/throttle":201,"../fx/constants":86}],73:[function(_dereq_,module,exports){ +},{"../../lib/dom":201,"../../lib/events":202,"../../lib/throttle":231,"../fx/constants":115}],102:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20773,7 +22021,7 @@ exports.dash = { }; -},{}],74:[function(_dereq_,module,exports){ +},{}],103:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20793,6 +22041,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -20854,7 +22103,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -21480,7 +22729,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -21871,7 +23120,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -21905,7 +23154,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -21924,7 +23173,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -21955,9 +23204,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -21965,11 +23214,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":88,"../../constants/alignment":154,"../../constants/interactions":157,"../../constants/xmlns_namespaces":159,"../../lib":179,"../../lib/svg_text_utils":200,"../../registry":265,"../../traces/scatter/make_bubble_size_func":383,"../../traces/scatter/subtypes":390,"../color":52,"../colorscale":64,"./symbol_defs":75,"d3":16,"fast-isnumeric":18,"tinycolor2":35}],75:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":117,"../../constants/alignment":183,"../../constants/interactions":187,"../../constants/xmlns_namespaces":189,"../../lib":209,"../../lib/svg_text_utils":230,"../../registry":296,"../../traces/scatter/make_bubble_size_func":414,"../../traces/scatter/subtypes":422,"../color":81,"../colorscale":93,"./symbol_defs":104,"d3":16,"fast-isnumeric":18,"tinycolor2":64}],104:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22533,7 +23782,7 @@ module.exports = { } }; -},{"d3":16}],76:[function(_dereq_,module,exports){ +},{"d3":16}],105:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22648,7 +23897,7 @@ module.exports = { } }; -},{}],77:[function(_dereq_,module,exports){ +},{}],106:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22734,7 +23983,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":179,"../../plots/cartesian/axes":223,"../../registry":265,"./compute_error":78,"fast-isnumeric":18}],78:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/axes":254,"../../registry":296,"./compute_error":107,"fast-isnumeric":18}],107:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22835,7 +24084,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],79:[function(_dereq_,module,exports){ +},{}],108:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22910,7 +24159,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":179,"../../plot_api/plot_template":213,"../../registry":265,"./attributes":76,"fast-isnumeric":18}],80:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/plot_template":243,"../../registry":296,"./attributes":105,"fast-isnumeric":18}],109:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22979,7 +24228,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":179,"../../plot_api/edit_types":206,"./attributes":76,"./calc":77,"./compute_error":78,"./defaults":79,"./plot":81,"./style":82}],81:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/edit_types":236,"./attributes":105,"./calc":106,"./compute_error":107,"./defaults":108,"./plot":110,"./style":111}],110:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23151,7 +24400,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":390,"../drawing":74,"d3":16,"fast-isnumeric":18}],82:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":422,"../drawing":103,"d3":16,"fast-isnumeric":18}],111:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23188,7 +24437,7 @@ module.exports = function style(traces) { }); }; -},{"../color":52,"d3":16}],83:[function(_dereq_,module,exports){ +},{"../color":81,"d3":16}],112:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23224,7 +24473,7 @@ module.exports = { } }; -},{"../../lib/extend":173,"../../plots/font_attributes":251,"./layout_attributes":93}],84:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plots/font_attributes":282,"./layout_attributes":122}],113:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23283,7 +24532,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":179,"../../registry":265}],85:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296}],114:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23320,7 +24569,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":265,"./hover":89}],86:[function(_dereq_,module,exports){ +},{"../../registry":296,"./hover":118}],115:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23352,7 +24601,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],87:[function(_dereq_,module,exports){ +},{}],116:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23378,7 +24627,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":179,"./attributes":83,"./hoverlabel_defaults":90}],88:[function(_dereq_,module,exports){ +},{"../../lib":209,"./attributes":112,"./hoverlabel_defaults":119}],117:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23640,7 +24889,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":179}],89:[function(_dereq_,module,exports){ +},{"../../lib":209}],118:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23656,6 +24905,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -23835,7 +25086,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -23979,6 +25232,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -24359,10 +25618,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -24603,7 +25860,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -24711,7 +25968,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -24746,8 +26003,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -24755,7 +26017,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -24855,8 +26117,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -25115,7 +26377,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -25131,7 +26396,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -25140,49 +26406,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -25494,7 +26761,7 @@ function plainText(s, len) { }); } -},{"../../lib":179,"../../lib/events":172,"../../lib/override_cursor":190,"../../lib/svg_text_utils":200,"../../plots/cartesian/axes":223,"../../registry":265,"../color":52,"../dragelement":71,"../drawing":74,"../legend/defaults":104,"../legend/draw":105,"./constants":86,"./helpers":88,"d3":16,"fast-isnumeric":18,"tinycolor2":35}],90:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../lib/events":202,"../../lib/override_cursor":220,"../../lib/svg_text_utils":230,"../../plots/cartesian/axes":254,"../../registry":296,"../color":81,"../dragelement":100,"../drawing":103,"../legend/defaults":133,"../legend/draw":134,"./constants":115,"./helpers":117,"d3":16,"fast-isnumeric":18,"tinycolor2":64}],119:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25540,7 +26807,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":179,"../color":52,"./helpers":88}],91:[function(_dereq_,module,exports){ +},{"../../lib":209,"../color":81,"./helpers":117}],120:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25596,7 +26863,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":179,"./layout_attributes":93}],92:[function(_dereq_,module,exports){ +},{"../../lib":209,"./layout_attributes":122}],121:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25675,7 +26942,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":179,"../dragelement":71,"./attributes":83,"./calc":84,"./click":85,"./constants":86,"./defaults":87,"./helpers":88,"./hover":89,"./layout_attributes":93,"./layout_defaults":94,"./layout_global_defaults":95,"d3":16}],93:[function(_dereq_,module,exports){ +},{"../../lib":209,"../dragelement":100,"./attributes":112,"./calc":113,"./click":114,"./constants":115,"./defaults":116,"./helpers":117,"./hover":118,"./layout_attributes":122,"./layout_defaults":123,"./layout_global_defaults":124,"d3":16}],122:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25791,7 +27058,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":251,"./constants":86}],94:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":282,"./constants":115}],123:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25839,7 +27106,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":179,"./helpers":88,"./hoverlabel_defaults":90,"./hovermode_defaults":91,"./layout_attributes":93}],95:[function(_dereq_,module,exports){ +},{"../../lib":209,"./helpers":117,"./hoverlabel_defaults":119,"./hovermode_defaults":120,"./layout_attributes":122}],124:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25862,7 +27129,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":179,"./hoverlabel_defaults":90,"./layout_attributes":93}],96:[function(_dereq_,module,exports){ +},{"../../lib":209,"./hoverlabel_defaults":119,"./layout_attributes":122}],125:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26236,7 +27503,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":179,"../../lib/regex":194,"../../plot_api/plot_template":213,"../../plots/cartesian/constants":229,"../../plots/domain":250}],97:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../lib/regex":224,"../../plot_api/plot_template":243,"../../plots/cartesian/constants":260,"../../plots/domain":281}],126:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26249,6 +27516,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -26371,7 +27639,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw' }); -},{"../../plot_api/plot_template":213,"../../plots/cartesian/constants":229}],98:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":184,"../../plot_api/plot_template":243,"../../plots/cartesian/constants":260}],127:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26452,7 +27720,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":202,"fast-isnumeric":18}],99:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":232,"fast-isnumeric":18}],128:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26504,7 +27772,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -26517,7 +27785,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":179,"../../plots/array_container_defaults":219,"../../plots/cartesian/axes":223,"./attributes":97}],100:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/array_container_defaults":249,"../../plots/cartesian/axes":254,"./attributes":126}],129:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26531,6 +27799,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -26547,7 +27816,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -26650,10 +27919,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -26662,8 +27946,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -26687,8 +27988,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -26742,7 +28043,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":159,"../../plots/cartesian/axes":223,"../drawing":74,"d3":16}],101:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":189,"../../plots/cartesian/axes":254,"../../plots/cartesian/axis_ids":257,"../drawing":103,"d3":16}],130:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26766,7 +28067,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":235,"./attributes":97,"./convert_coords":98,"./defaults":99,"./draw":100}],102:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":266,"./attributes":126,"./convert_coords":127,"./defaults":128,"./draw":129}],131:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26838,6 +28139,14 @@ module.exports = { editType: 'legend', + }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + + editType: 'legend', + }, itemclick: { @@ -26927,7 +28236,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":251,"../color/attributes":51}],103:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":282,"../color/attributes":80}],132:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26947,13 +28256,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],104:[function(_dereq_,module,exports){ +},{}],133:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -27069,6 +28376,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -27087,7 +28395,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":179,"../../plot_api/plot_template":213,"../../plots/layout_attributes":255,"../../registry":265,"./attributes":102,"./helpers":108}],105:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/plot_template":243,"../../plots/layout_attributes":286,"../../registry":296,"./attributes":131,"./helpers":137}],134:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -27179,7 +28487,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -27500,11 +28807,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -27557,11 +28864,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -27631,7 +28941,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -27684,8 +28995,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -27798,7 +29109,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -27881,7 +29192,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":154,"../../lib":179,"../../lib/events":172,"../../lib/svg_text_utils":200,"../../plots/plots":257,"../../registry":265,"../color":52,"../dragelement":71,"../drawing":74,"./constants":103,"./get_legend_data":106,"./handle_click":107,"./helpers":108,"./style":110,"d3":16}],106:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":209,"../../lib/events":202,"../../lib/svg_text_utils":230,"../../plots/plots":288,"../../registry":296,"../color":81,"../dragelement":100,"../drawing":103,"./constants":132,"./get_legend_data":135,"./handle_click":136,"./helpers":137,"./style":139,"d3":16}],135:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -27990,7 +29301,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":265,"./helpers":108}],107:[function(_dereq_,module,exports){ +},{"../../registry":296,"./helpers":137}],136:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28229,7 +29540,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":179,"../../registry":265}],108:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296}],137:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28253,7 +29564,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],109:[function(_dereq_,module,exports){ +},{}],138:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28277,7 +29588,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":102,"./defaults":104,"./draw":105,"./style":110}],110:[function(_dereq_,module,exports){ +},{"./attributes":131,"./defaults":133,"./draw":134,"./style":139}],139:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28292,6 +29603,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -28300,6 +29612,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -28310,6 +29624,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -28338,7 +29655,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -28441,7 +29758,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -28461,7 +29778,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -28551,7 +29868,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -28563,7 +29880,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -28591,7 +29908,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -28631,7 +29948,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -28655,7 +29972,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -28695,7 +30012,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -28722,7 +30039,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -28758,7 +30075,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -28856,7 +30173,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -28904,7 +30221,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":179,"../../registry":265,"../../traces/pie/helpers":358,"../../traces/pie/style_one":364,"../../traces/scatter/subtypes":390,"../color":52,"../colorscale/helpers":63,"../drawing":74,"d3":16}],111:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296,"../../traces/pie/helpers":389,"../../traces/pie/style_one":395,"../../traces/scatter/subtypes":422,"../color":81,"../colorscale/helpers":92,"../drawing":103,"./constants":132,"d3":16}],140:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29640,7 +30957,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":162,"../../lib":179,"../../plots/cartesian/axis_ids":226,"../../plots/plots":257,"../../registry":265,"../shapes/draw":133}],112:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":192,"../../lib":209,"../../plots/cartesian/axis_ids":257,"../../plots/plots":288,"../../registry":296,"../shapes/draw":162}],141:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29654,7 +30971,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":113}],113:[function(_dereq_,module,exports){ +},{"./manage":142}],142:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29950,7 +31267,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":226,"../../registry":265,"../../traces/scatter/subtypes":390,"../fx/helpers":88,"./buttons":111,"./modebar":114}],114:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":257,"../../registry":296,"../../traces/scatter/subtypes":422,"../fx/helpers":117,"./buttons":140,"./modebar":143}],143:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30296,7 +31613,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":162,"../../lib":179,"d3":16,"fast-isnumeric":18}],115:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":192,"../../lib":209,"d3":16,"fast-isnumeric":18}],144:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30432,7 +31749,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":213,"../../plots/font_attributes":251,"../color/attributes":51}],116:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":243,"../../plots/font_attributes":282,"../color/attributes":80}],145:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30461,7 +31778,7 @@ module.exports = { darkAmount: 10 }; -},{}],117:[function(_dereq_,module,exports){ +},{}],146:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30553,7 +31870,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":179,"../../plot_api/plot_template":213,"../../plots/array_container_defaults":219,"../color":52,"./attributes":115,"./constants":116}],118:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/plot_template":243,"../../plots/array_container_defaults":249,"../color":81,"./attributes":144,"./constants":145}],147:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30571,6 +31888,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -30700,8 +32018,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -30752,9 +32069,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -30807,10 +32122,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":154,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/cartesian/axis_ids":226,"../../plots/plots":257,"../../registry":265,"../color":52,"../drawing":74,"./constants":116,"./get_update_object":119,"d3":16}],119:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/cartesian/axis_ids":257,"../../plots/plots":288,"../../registry":296,"../color":81,"../drawing":103,"./constants":145,"./get_update_object":148,"d3":16}],148:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30864,7 +32179,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":16}],120:[function(_dereq_,module,exports){ +},{"d3":16}],149:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30891,7 +32206,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":115,"./defaults":117,"./draw":118}],121:[function(_dereq_,module,exports){ +},{"./attributes":144,"./defaults":146,"./draw":147}],150:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30965,7 +32280,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":51}],122:[function(_dereq_,module,exports){ +},{"../color/attributes":80}],151:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30999,7 +32314,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":222,"../../plots/cartesian/axis_ids":226,"./constants":123}],123:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":253,"../../plots/cartesian/axis_ids":257,"./constants":152}],152:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31055,7 +32370,7 @@ module.exports = { extraPad: 15 }; -},{}],124:[function(_dereq_,module,exports){ +},{}],153:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31141,7 +32456,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":179,"../../plot_api/plot_template":213,"../../plots/cartesian/axis_ids":226,"./attributes":121,"./oppaxis_attributes":128}],125:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/plot_template":243,"../../plots/cartesian/axis_ids":257,"./attributes":150,"./oppaxis_attributes":157}],154:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31158,6 +32473,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -31263,7 +32579,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -31376,6 +32692,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -31522,10 +32840,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -31547,7 +32865,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -31763,14 +33081,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -31784,7 +33100,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":179,"../../lib/setcursor":198,"../../plots/cartesian":236,"../../plots/cartesian/axis_ids":226,"../../plots/plots":257,"../../registry":265,"../color":52,"../dragelement":71,"../drawing":74,"../titles":147,"./constants":123,"d3":16}],126:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../lib/setcursor":228,"../../plots/cartesian":267,"../../plots/cartesian/axis_ids":257,"../../plots/plots":288,"../../registry":296,"../color":81,"../dragelement":100,"../drawing":103,"../titles":176,"./constants":152,"d3":16}],155:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31859,7 +33175,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":154,"../../lib/svg_text_utils":200,"../../plots/cartesian/axis_ids":226,"./constants":123}],127:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib/svg_text_utils":230,"../../plots/cartesian/axis_ids":257,"./constants":152}],156:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31898,7 +33214,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":179,"./attributes":121,"./calc_autorange":122,"./defaults":124,"./draw":125,"./helpers":126,"./oppaxis_attributes":128}],128:[function(_dereq_,module,exports){ +},{"../../lib":209,"./attributes":150,"./calc_autorange":151,"./defaults":153,"./draw":154,"./helpers":155,"./oppaxis_attributes":157}],157:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31936,7 +33252,7 @@ module.exports = { editType: 'calc' }; -},{}],129:[function(_dereq_,module,exports){ +},{}],158:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31952,6 +33268,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -32088,7 +33405,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":173,"../../plot_api/plot_template":213,"../../traces/scatter/attributes":366,"../annotations/attributes":37,"../drawing/attributes":73}],130:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":184,"../../lib/extend":203,"../../plot_api/plot_template":243,"../../traces/scatter/attributes":397,"../annotations/attributes":66,"../drawing/attributes":102}],159:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32116,9 +33433,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -32129,7 +33449,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -32205,7 +33525,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":179,"../../plots/cartesian/axes":223,"./constants":131,"./helpers":140}],131:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/axes":254,"./constants":160,"./helpers":169}],160:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32269,7 +33589,7 @@ module.exports = { } }; -},{}],132:[function(_dereq_,module,exports){ +},{}],161:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32335,9 +33655,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -32398,7 +33720,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":179,"../../plots/array_container_defaults":219,"../../plots/cartesian/axes":223,"./attributes":129,"./helpers":140}],133:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/array_container_defaults":249,"../../plots/cartesian/axes":254,"./attributes":158,"./helpers":169}],162:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32584,7 +33906,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -32610,11 +33935,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -32985,6 +34312,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -32992,15 +34321,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -33157,7 +34494,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":179,"../../lib/setcursor":198,"../../plot_api/plot_template":213,"../../plots/cartesian/axes":223,"../../plots/cartesian/handle_outline":233,"../../registry":265,"../color":52,"../dragelement":71,"../drawing":74,"./constants":131,"./draw_newshape/display_outlines":137,"./draw_newshape/helpers":138,"./helpers":140}],134:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../lib/setcursor":228,"../../plot_api/plot_template":243,"../../plots/cartesian/axes":254,"../../plots/cartesian/handle_outline":264,"../../registry":296,"../color":81,"../dragelement":100,"../drawing":103,"./constants":160,"./draw_newshape/display_outlines":166,"./draw_newshape/helpers":167,"./helpers":169}],163:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33260,7 +34597,7 @@ module.exports = { } }; -},{"../../../lib/extend":173,"../../drawing/attributes":73}],135:[function(_dereq_,module,exports){ +},{"../../../lib/extend":203,"../../drawing/attributes":102}],164:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33284,7 +34621,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],136:[function(_dereq_,module,exports){ +},{}],165:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33316,7 +34653,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":52}],137:[function(_dereq_,module,exports){ +},{"../../color":81}],166:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33611,7 +34948,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":233,"../../../registry":265,"../../dragelement":71,"../../dragelement/helpers":70,"./constants":135,"./helpers":138,"./newshapes":139}],138:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":264,"../../../registry":296,"../../dragelement":100,"../../dragelement/helpers":99,"./constants":164,"./helpers":167,"./newshapes":168}],167:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33949,7 +35286,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":234,"./constants":135,"parse-svg-path":25}],139:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":265,"./constants":164,"parse-svg-path":54}],168:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34208,7 +35545,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":233,"../../../plots/cartesian/helpers":234,"../../dragelement/helpers":70,"./constants":135,"./helpers":138}],140:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":264,"../../../plots/cartesian/helpers":265,"../../dragelement/helpers":99,"./constants":164,"./helpers":167}],169:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34269,18 +35606,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -34290,13 +35633,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -34353,7 +35703,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":179,"./constants":131}],141:[function(_dereq_,module,exports){ +},{"../../lib":209,"./constants":160}],170:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34381,7 +35731,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":235,"./attributes":129,"./calc_autorange":130,"./defaults":132,"./draw":133,"./draw_newshape/defaults":136}],142:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":266,"./attributes":158,"./calc_autorange":159,"./defaults":161,"./draw":162,"./draw_newshape/defaults":165}],171:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34624,7 +35974,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":173,"../../plot_api/edit_types":206,"../../plot_api/plot_template":213,"../../plots/animation_attributes":218,"../../plots/font_attributes":251,"../../plots/pad_attributes":256,"./constants":143}],143:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plot_api/edit_types":236,"../../plot_api/plot_template":243,"../../plots/animation_attributes":248,"../../plots/font_attributes":282,"../../plots/pad_attributes":287,"./constants":172}],172:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34718,7 +36068,7 @@ module.exports = { currentValueInset: 0, }; -},{}],144:[function(_dereq_,module,exports){ +},{}],173:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34833,7 +36183,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":179,"../../plots/array_container_defaults":219,"./attributes":142,"./constants":143}],145:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/array_container_defaults":249,"./attributes":171,"./constants":172}],174:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34850,6 +36200,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -35138,11 +36489,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -35193,11 +36543,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -35410,7 +36759,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -35465,7 +36814,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":154,"../../lib":179,"../../lib/svg_text_utils":200,"../../plot_api/plot_template":213,"../../plots/plots":257,"../color":52,"../drawing":74,"./constants":143,"d3":16}],146:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":209,"../../lib/svg_text_utils":230,"../../plot_api/plot_template":243,"../../plots/plots":288,"../color":81,"../drawing":103,"./constants":172,"d3":16}],175:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35488,7 +36837,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":142,"./constants":143,"./defaults":144,"./draw":145}],147:[function(_dereq_,module,exports){ +},{"./attributes":171,"./constants":172,"./defaults":173,"./draw":174}],176:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35506,6 +36855,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -35626,7 +36976,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -35704,7 +37054,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -35755,7 +37105,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":154,"../../constants/interactions":157,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/plots":257,"../../registry":265,"../color":52,"../drawing":74,"d3":16,"fast-isnumeric":18}],148:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../constants/interactions":187,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/plots":288,"../../registry":296,"../color":81,"../drawing":103,"d3":16,"fast-isnumeric":18}],177:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35924,7 +37274,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":173,"../../plot_api/edit_types":206,"../../plot_api/plot_template":213,"../../plots/font_attributes":251,"../../plots/pad_attributes":256,"../color/attributes":51}],149:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plot_api/edit_types":236,"../../plot_api/plot_template":243,"../../plots/font_attributes":282,"../../plots/pad_attributes":287,"../color/attributes":80}],178:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36005,7 +37355,7 @@ module.exports = { } }; -},{}],150:[function(_dereq_,module,exports){ +},{}],179:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36088,7 +37438,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":179,"../../plots/array_container_defaults":219,"./attributes":148,"./constants":149}],151:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/array_container_defaults":249,"./attributes":177,"./constants":178}],180:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36286,8 +37636,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -36526,11 +37875,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -36741,9 +38089,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":154,"../../lib":179,"../../lib/svg_text_utils":200,"../../plot_api/plot_template":213,"../../plots/plots":257,"../color":52,"../drawing":74,"./constants":149,"./scrollbox":153,"d3":16}],152:[function(_dereq_,module,exports){ -arguments[4][146][0].apply(exports,arguments) -},{"./attributes":148,"./constants":149,"./defaults":150,"./draw":151,"dup":146}],153:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":209,"../../lib/svg_text_utils":230,"../../plot_api/plot_template":243,"../../plots/plots":288,"../color":81,"../drawing":103,"./constants":178,"./scrollbox":182,"d3":16}],181:[function(_dereq_,module,exports){ +arguments[4][175][0].apply(exports,arguments) +},{"./attributes":177,"./constants":178,"./defaults":179,"./draw":180,"dup":175}],182:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37208,7 +38556,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":179,"../color":52,"../drawing":74,"d3":16}],154:[function(_dereq_,module,exports){ +},{"../../lib":209,"../color":81,"../drawing":103,"d3":16}],183:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37273,7 +38621,39 @@ module.exports = { } }; -},{}],155:[function(_dereq_,module,exports){ +},{}],184:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],185:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37295,7 +38675,7 @@ module.exports = { } }; -},{}],156:[function(_dereq_,module,exports){ +},{}],186:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37311,7 +38691,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],157:[function(_dereq_,module,exports){ +},{}],187:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37334,7 +38714,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],158:[function(_dereq_,module,exports){ +},{}],188:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37407,7 +38787,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],159:[function(_dereq_,module,exports){ +},{}],189:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37431,7 +38811,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],160:[function(_dereq_,module,exports){ +},{}],190:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37517,7 +38897,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":45,"./components/annotations3d":50,"./components/colorbar":58,"./components/colorscale":64,"./components/errorbars":80,"./components/fx":92,"./components/grid":96,"./components/images":101,"./components/legend":109,"./components/rangeselector":120,"./components/rangeslider":127,"./components/shapes":141,"./components/sliders":146,"./components/updatemenus":152,"./fonts/mathjax_config":161,"./fonts/ploticon":162,"./lib/queue":193,"./locale-en":204,"./locale-en-us":203,"./plot_api":208,"./plot_api/plot_schema":212,"./plots/plots":257,"./registry":265,"./snapshot":270,"./traces/scatter":378,"./version":405,"d3":16,"es6-promise":17}],161:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":74,"./components/annotations3d":79,"./components/colorbar":87,"./components/colorscale":93,"./components/errorbars":109,"./components/fx":121,"./components/grid":125,"./components/images":130,"./components/legend":138,"./components/rangeselector":149,"./components/rangeslider":156,"./components/shapes":170,"./components/sliders":175,"./components/updatemenus":181,"./fonts/mathjax_config":191,"./fonts/ploticon":192,"./lib/queue":223,"./locale-en":234,"./locale-en-us":233,"./plot_api":238,"./plot_api/plot_schema":242,"./plots/plots":288,"./registry":296,"./snapshot":301,"./traces/scatter":409,"./version":437,"d3":16,"es6-promise":17}],191:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37548,7 +38928,7 @@ module.exports = function() { } }; -},{}],162:[function(_dereq_,module,exports){ +},{}],192:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37728,7 +39108,7 @@ module.exports = { } }; -},{}],163:[function(_dereq_,module,exports){ +},{}],193:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37792,7 +39172,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],164:[function(_dereq_,module,exports){ +},{}],194:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38033,7 +39413,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":186}],165:[function(_dereq_,module,exports){ +},{"./mod":216}],195:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38190,7 +39570,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],166:[function(_dereq_,module,exports){ +},{}],196:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38223,7 +39603,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":158,"fast-isnumeric":18}],167:[function(_dereq_,module,exports){ +},{"../constants/numerical":188,"fast-isnumeric":18}],197:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38251,7 +39631,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],168:[function(_dereq_,module,exports){ +},{}],198:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38274,7 +39654,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],169:[function(_dereq_,module,exports){ +},{}],199:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38738,7 +40118,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":67,"../constants/interactions":157,"../plots/attributes":220,"./array":165,"./mod":186,"./nested_property":187,"./regex":194,"fast-isnumeric":18,"tinycolor2":35}],170:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":96,"../constants/interactions":187,"../plots/attributes":250,"./array":195,"./mod":216,"./nested_property":217,"./regex":224,"fast-isnumeric":18,"tinycolor2":64}],200:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38786,9 +40166,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -38796,7 +40190,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -39325,7 +40719,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":158,"../registry":265,"./loggers":183,"./mod":186,"d3-time-format":14,"fast-isnumeric":18}],171:[function(_dereq_,module,exports){ +},{"../constants/numerical":188,"../registry":296,"./loggers":213,"./mod":216,"d3-time-format":14,"fast-isnumeric":18}],201:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39338,6 +40732,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -39419,16 +40815,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":183,"d3":16}],172:[function(_dereq_,module,exports){ +},{"./loggers":213,"./matrix":215,"d3":16,"gl-mat4":34}],202:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39601,7 +41070,7 @@ var Events = { module.exports = Events; -},{"events":13}],173:[function(_dereq_,module,exports){ +},{"events":13}],203:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39715,7 +41184,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":180}],174:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":210}],204:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39766,7 +41235,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],175:[function(_dereq_,module,exports){ +},{}],205:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39814,7 +41283,7 @@ function isCalcData(cont) { ); } -},{}],176:[function(_dereq_,module,exports){ +},{}],206:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40058,7 +41527,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":186}],177:[function(_dereq_,module,exports){ +},{"./mod":216}],207:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40074,7 +41543,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { module.exports = function identity(d) { return d; }; -},{}],178:[function(_dereq_,module,exports){ +},{}],208:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40116,7 +41585,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],179:[function(_dereq_,module,exports){ +},{}],209:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40207,8 +41676,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -40264,6 +41736,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -41314,6 +42790,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -41340,13 +42828,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -41364,7 +42850,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":158,"./anchor_utils":163,"./angles":164,"./array":165,"./clean_number":166,"./clear_responsive":168,"./coerce":169,"./dates":170,"./dom":171,"./extend":173,"./filter_unique":174,"./filter_visible":175,"./geometry2d":176,"./identity":177,"./increment":178,"./is_plain_object":180,"./keyed_container":181,"./localize":182,"./loggers":183,"./make_trace_groups":184,"./matrix":185,"./mod":186,"./nested_property":187,"./noop":188,"./notifier":189,"./push_unique":192,"./regex":194,"./relative_attr":195,"./relink_private":196,"./search":197,"./stats":199,"./throttle":201,"./to_log_range":202,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],180:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":188,"./anchor_utils":193,"./angles":194,"./array":195,"./clean_number":196,"./clear_responsive":198,"./coerce":199,"./dates":200,"./dom":201,"./extend":203,"./filter_unique":204,"./filter_visible":205,"./geometry2d":206,"./identity":207,"./increment":208,"./is_plain_object":210,"./keyed_container":211,"./localize":212,"./loggers":213,"./make_trace_groups":214,"./matrix":215,"./mod":216,"./nested_property":217,"./noop":218,"./notifier":219,"./push_unique":222,"./regex":224,"./relative_attr":225,"./relink_private":226,"./search":227,"./stats":229,"./throttle":231,"./to_log_range":232,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],210:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41392,7 +42895,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],181:[function(_dereq_,module,exports){ +},{}],211:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41585,7 +43088,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":187}],182:[function(_dereq_,module,exports){ +},{"./nested_property":217}],212:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41641,7 +43144,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":265}],183:[function(_dereq_,module,exports){ +},{"../registry":296}],213:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41751,7 +43254,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":211,"./notifier":189}],184:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":241,"./notifier":219}],214:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41794,7 +43297,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":16}],185:[function(_dereq_,module,exports){ +},{"d3":16}],215:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41806,6 +43309,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -41881,13 +43385,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -41901,7 +43415,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],186:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":34}],216:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41936,7 +43484,7 @@ module.exports = { modHalf: modHalf }; -},{}],187:[function(_dereq_,module,exports){ +},{}],217:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42182,7 +43730,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":165,"fast-isnumeric":18}],188:[function(_dereq_,module,exports){ +},{"./array":195,"fast-isnumeric":18}],218:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42198,7 +43746,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],189:[function(_dereq_,module,exports){ +},{}],219:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42286,7 +43834,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":16,"fast-isnumeric":18}],190:[function(_dereq_,module,exports){ +},{"d3":16,"fast-isnumeric":18}],220:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42334,7 +43882,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":198}],191:[function(_dereq_,module,exports){ +},{"./setcursor":228}],221:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42586,7 +44134,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":158,"./matrix":185}],192:[function(_dereq_,module,exports){ +},{"../constants/numerical":188,"./matrix":215}],222:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42624,7 +44172,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],193:[function(_dereq_,module,exports){ +},{}],223:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42832,7 +44380,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":179,"../plot_api/plot_config":211}],194:[function(_dereq_,module,exports){ +},{"../lib":209,"../plot_api/plot_config":241}],224:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42862,7 +44410,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],195:[function(_dereq_,module,exports){ +},{}],225:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42915,7 +44463,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],196:[function(_dereq_,module,exports){ +},{}],226:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42972,7 +44520,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":165,"./is_plain_object":180}],197:[function(_dereq_,module,exports){ +},{"./array":195,"./is_plain_object":210}],227:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43177,7 +44725,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":158,"./identity":177,"./loggers":183,"fast-isnumeric":18}],198:[function(_dereq_,module,exports){ +},{"../constants/numerical":188,"./identity":207,"./loggers":213,"fast-isnumeric":18}],228:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43200,7 +44748,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],199:[function(_dereq_,module,exports){ +},{}],229:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43310,7 +44858,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":165,"fast-isnumeric":18}],200:[function(_dereq_,module,exports){ +},{"./array":195,"fast-isnumeric":18}],230:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43327,6 +44875,7 @@ exports.interp = function(arr, n) { var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -43441,7 +44990,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -44056,9 +45605,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -44189,7 +45749,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":154,"../constants/xmlns_namespaces":159,"../lib":179,"d3":16}],201:[function(_dereq_,module,exports){ +},{"../constants/alignment":183,"../constants/xmlns_namespaces":189,"../lib":209,"d3":16}],231:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44292,7 +45852,7 @@ function _clearTimeout(cache) { } } -},{}],202:[function(_dereq_,module,exports){ +},{}],232:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44320,7 +45880,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":18}],203:[function(_dereq_,module,exports){ +},{"fast-isnumeric":18}],233:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44342,7 +45902,7 @@ module.exports = { } }; -},{}],204:[function(_dereq_,module,exports){ +},{}],234:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44385,7 +45945,7 @@ module.exports = { } }; -},{}],205:[function(_dereq_,module,exports){ +},{}],235:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44443,7 +46003,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":265}],206:[function(_dereq_,module,exports){ +},{"../registry":296}],236:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44568,7 +46128,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":179}],207:[function(_dereq_,module,exports){ +},{"../lib":209}],237:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44745,6 +46305,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -44789,7 +46359,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -45260,7 +46830,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":52,"../lib":179,"../plots/cartesian/axis_ids":226,"../plots/plots":257,"../registry":265,"fast-isnumeric":18,"gl-mat4/fromQuat":19}],208:[function(_dereq_,module,exports){ +},{"../components/color":81,"../lib":209,"../plots/cartesian/axis_ids":257,"../plots/plots":288,"../registry":296,"fast-isnumeric":18,"gl-mat4/fromQuat":24}],238:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45303,7 +46873,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":267,"./plot_api":210,"./template_api":215,"./to_image":216,"./validate":217}],209:[function(_dereq_,module,exports){ +},{"../snapshot/download":298,"./plot_api":240,"./template_api":245,"./to_image":246,"./validate":247}],239:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45516,7 +47086,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":180,"../lib/loggers":183,"../lib/noop":188,"../lib/search":197,"../registry":265,"./container_array_match":205}],210:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":210,"../lib/loggers":213,"../lib/noop":218,"../lib/search":227,"../registry":296,"./container_array_match":235}],240:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45886,7 +47456,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -45900,9 +47481,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -47480,6 +49068,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -47574,7 +49168,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -47664,7 +49258,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -47802,21 +49396,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -49227,6 +50819,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -49234,15 +50839,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -49268,6 +50878,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -49401,7 +51012,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":52,"../components/drawing":74,"../constants/xmlns_namespaces":159,"../lib":179,"../lib/events":172,"../lib/queue":193,"../lib/svg_text_utils":200,"../plots/cartesian/axes":223,"../plots/cartesian/constants":229,"../plots/cartesian/graph_interact":232,"../plots/cartesian/select":242,"../plots/plots":257,"../plots/polar/legacy":260,"../registry":265,"./edit_types":206,"./helpers":207,"./manage_arrays":209,"./plot_config":211,"./plot_schema":212,"./subroutines":214,"d3":16,"fast-isnumeric":18,"has-hover":20}],211:[function(_dereq_,module,exports){ +},{"../components/color":81,"../components/drawing":103,"../constants/xmlns_namespaces":189,"../lib":209,"../lib/events":202,"../lib/queue":223,"../lib/svg_text_utils":230,"../plots/cartesian/axes":254,"../plots/cartesian/constants":260,"../plots/cartesian/graph_interact":263,"../plots/cartesian/select":273,"../plots/plots":288,"../plots/polar/legacy":291,"../registry":296,"./edit_types":236,"./helpers":237,"./manage_arrays":239,"./plot_config":241,"./plot_schema":242,"./subroutines":244,"d3":16,"fast-isnumeric":18,"has-hover":49}],241:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -49716,7 +51327,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],212:[function(_dereq_,module,exports){ +},{}],242:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50427,7 +52038,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":179,"../plots/animation_attributes":218,"../plots/attributes":220,"../plots/frame_attributes":252,"../plots/layout_attributes":255,"../plots/polar/legacy/area_attributes":258,"../plots/polar/legacy/axis_attributes":259,"../registry":265,"./edit_types":206,"./plot_config":211}],213:[function(_dereq_,module,exports){ +},{"../lib":209,"../plots/animation_attributes":248,"../plots/attributes":250,"../plots/frame_attributes":283,"../plots/layout_attributes":286,"../plots/polar/legacy/area_attributes":289,"../plots/polar/legacy/axis_attributes":290,"../registry":296,"./edit_types":236,"./plot_config":241}],243:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50739,7 +52350,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":179,"../plots/attributes":220}],214:[function(_dereq_,module,exports){ +},{"../lib":209,"../plots/attributes":250}],244:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50920,7 +52531,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -51409,57 +53020,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - enforceAxisConstraints(gd); - - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; - - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); + + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -51485,7 +53074,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":52,"../components/drawing":74,"../components/modebar":112,"../components/titles":147,"../constants/alignment":154,"../lib":179,"../lib/clear_gl_canvases":167,"../plots/cartesian/autorange":222,"../plots/cartesian/axes":223,"../plots/cartesian/constraints":230,"../plots/plots":257,"../registry":265,"d3":16}],215:[function(_dereq_,module,exports){ +},{"../components/color":81,"../components/drawing":103,"../components/modebar":141,"../components/titles":176,"../constants/alignment":183,"../lib":209,"../lib/clear_gl_canvases":197,"../plots/cartesian/autorange":253,"../plots/cartesian/axes":254,"../plots/cartesian/constraints":261,"../plots/plots":288,"../registry":296,"d3":16}],245:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51947,7 +53536,7 @@ function format(opts) { return opts; } -},{"../lib":179,"../plots/attributes":220,"../plots/plots":257,"./plot_config":211,"./plot_schema":212,"./plot_template":213}],216:[function(_dereq_,module,exports){ +},{"../lib":209,"../plots/attributes":250,"../plots/plots":288,"./plot_config":241,"./plot_schema":242,"./plot_template":243}],246:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52044,7 +53633,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -52168,7 +53757,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":179,"../plots/plots":257,"../snapshot/helpers":269,"../snapshot/svgtoimg":271,"../snapshot/tosvg":273,"../version":405,"./plot_api":210,"fast-isnumeric":18}],217:[function(_dereq_,module,exports){ +},{"../lib":209,"../plots/plots":288,"../snapshot/helpers":300,"../snapshot/svgtoimg":302,"../snapshot/tosvg":304,"../version":437,"./plot_api":240,"fast-isnumeric":18}],247:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52599,7 +54188,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":179,"../plots/plots":257,"./plot_config":211,"./plot_schema":212}],218:[function(_dereq_,module,exports){ +},{"../lib":209,"../plots/plots":288,"./plot_config":241,"./plot_schema":242}],248:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52711,7 +54300,7 @@ module.exports = { } }; -},{}],219:[function(_dereq_,module,exports){ +},{}],249:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52806,7 +54395,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":179,"../plot_api/plot_template":213}],220:[function(_dereq_,module,exports){ +},{"../lib":209,"../plot_api/plot_template":243}],250:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52947,7 +54536,99 @@ module.exports = { } }; -},{"../components/fx/attributes":83}],221:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":112}],251:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":188,"../../lib":209,"fast-isnumeric":18}],252:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52976,7 +54657,7 @@ module.exports = { } }; -},{}],222:[function(_dereq_,module,exports){ +},{}],253:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52993,6 +54674,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -53033,7 +54716,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -53074,19 +54758,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -53094,9 +54765,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -53114,8 +54785,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -53129,7 +54800,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -53150,7 +54821,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -53159,12 +54830,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -53174,13 +54845,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -53192,7 +54891,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -53221,14 +55010,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -53488,7 +55297,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":158,"../../lib":179,"../../registry":265,"fast-isnumeric":18}],223:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"../../registry":296,"./axis_ids":257,"fast-isnumeric":18}],254:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53505,6 +55314,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -53538,6 +55348,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -53582,14 +55394,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -53597,6 +55412,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -53621,8 +55451,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -53631,7 +55461,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -53690,7 +55519,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -54012,6 +55843,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -54036,7 +55870,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -54046,6 +55880,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -54059,6 +55897,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -54071,15 +56093,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -54091,85 +56118,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } + var flip = ax._id.charAt(0) === 'y'; - var pos = ax.c2p(tickVal.value); + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -54190,180 +56213,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; - - ticksOut.push(t); - } + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } - - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -54456,7 +56331,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -54473,15 +56349,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -54594,7 +56472,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -55077,6 +56956,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -55349,21 +57229,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -55464,23 +57346,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -55511,13 +57394,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -55538,7 +57421,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -55554,7 +57437,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -55574,7 +57457,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -55606,7 +57489,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -55618,7 +57501,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -55633,7 +57516,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -55889,21 +57772,81 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; +}; + +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; -}; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} /** * Make axis tick path string @@ -55950,24 +57893,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -55975,42 +57939,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } + + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } - out.xFn = function(d) { return d.dx + x0; }; + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } + + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -56262,6 +58285,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -56279,22 +58304,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -56362,11 +58431,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -56406,6 +58488,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -56887,7 +58989,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":52,"../../components/drawing":74,"../../components/titles":147,"../../constants/alignment":154,"../../constants/numerical":158,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/plots":257,"../../registry":265,"./autorange":222,"./axis_autotype":224,"./axis_ids":226,"./clean_ticks":228,"./layout_attributes":237,"./set_convert":243,"d3":16,"fast-isnumeric":18}],224:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../../components/titles":176,"../../constants/alignment":183,"../../constants/numerical":188,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/plots":288,"../../registry":296,"./autorange":253,"./axis_autotype":255,"./axis_ids":257,"./clean_ticks":259,"./layout_attributes":268,"./set_convert":274,"d3":16,"fast-isnumeric":18}],255:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56904,23 +59006,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; + + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } + + if(moreDates(a, calendar)) return 'date'; + + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -56933,56 +59061,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":158,"../../lib":179,"fast-isnumeric":18}],225:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"fast-isnumeric":18}],256:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57039,9 +59177,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -57099,7 +59261,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -57111,8 +59276,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -57265,7 +59428,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":179,"../../registry":265,"../array_container_defaults":219,"./category_order_defaults":227,"./constants":229,"./layout_attributes":237,"./line_grid_defaults":239,"./set_convert":243,"./tick_label_defaults":244,"./tick_mark_defaults":245,"./tick_value_defaults":246,"fast-isnumeric":18}],226:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296,"../array_container_defaults":249,"./category_order_defaults":258,"./constants":260,"./layout_attributes":268,"./line_grid_defaults":270,"./set_convert":274,"./tick_label_defaults":275,"./tick_mark_defaults":276,"./tick_value_defaults":277,"fast-isnumeric":18}],257:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57286,7 +59449,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -57298,13 +59461,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -57350,6 +59520,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -57382,17 +59554,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":265,"./constants":229}],227:[function(_dereq_,module,exports){ +},{"../../registry":296,"./constants":260}],258:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57486,7 +59662,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],228:[function(_dereq_,module,exports){ +},{}],259:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57499,7 +59675,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -57564,7 +59742,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -57574,7 +59754,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":158,"../../lib":179,"fast-isnumeric":18}],229:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"fast-isnumeric":18}],260:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57589,8 +59769,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -57602,7 +59782,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -57666,7 +59846,7 @@ module.exports = { } }; -},{"../../lib/regex":194}],230:[function(_dereq_,module,exports){ +},{"../../lib/regex":224}],261:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57678,74 +59858,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; + + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; + + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } + + var canLink = linkableAxes.length; + + var matches, scaleanchor; - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -57756,64 +60142,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; +} - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -57822,12 +60183,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -57840,38 +60203,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); + } + } + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } } + + out[key] = val; } - thisGroup[scaleanchor] = 1; + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -57980,25 +60414,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -58020,6 +60455,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -58052,7 +60497,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":154,"../../constants/numerical":158,"../../lib":179,"./autorange":222,"./axis_ids":226,"./scale_zoom":241}],231:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../constants/numerical":188,"../../lib":209,"./autorange":253,"./axis_ids":257,"./layout_attributes":268,"./scale_zoom":272,"./set_convert":274}],262:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58069,6 +60514,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -58145,6 +60591,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -58176,10 +60625,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -58216,6 +60666,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -58381,6 +60834,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -58398,8 +60857,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -58599,6 +61058,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -58608,6 +61069,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -58616,7 +61093,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -58647,15 +61124,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -58664,12 +61143,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -58679,7 +61162,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -58689,9 +61172,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -58891,15 +61389,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -58915,7 +61413,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -59127,7 +61625,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -59140,7 +61638,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -59205,11 +61703,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -59220,14 +61720,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -59237,7 +61745,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -59324,7 +61835,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":52,"../../components/dragelement":71,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../constants/alignment":154,"../../lib":179,"../../lib/clear_gl_canvases":167,"../../lib/setcursor":198,"../../lib/svg_text_utils":200,"../../plot_api/subroutines":214,"../../registry":265,"../plots":257,"./axes":223,"./axis_ids":226,"./constants":229,"./scale_zoom":241,"./select":242,"d3":16,"has-passive-events":21,"tinycolor2":35}],232:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/dragelement":100,"../../components/dragelement/helpers":99,"../../components/drawing":103,"../../components/fx":121,"../../constants/alignment":183,"../../lib":209,"../../lib/clear_gl_canvases":197,"../../lib/setcursor":228,"../../lib/svg_text_utils":230,"../../plot_api/subroutines":244,"../../registry":296,"../plots":288,"./axes":254,"./axis_ids":257,"./constants":260,"./scale_zoom":272,"./select":273,"d3":16,"has-passive-events":50,"tinycolor2":64}],263:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59492,7 +62003,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":71,"../../components/fx":92,"../../lib/setcursor":198,"./constants":229,"./dragbox":231,"d3":16}],233:[function(_dereq_,module,exports){ +},{"../../components/dragelement":100,"../../components/fx":121,"../../lib/setcursor":228,"./constants":260,"./dragbox":262,"d3":16}],264:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59528,7 +62039,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],234:[function(_dereq_,module,exports){ +},{}],265:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59540,6 +62051,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -59570,9 +62083,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -59582,7 +62096,7 @@ module.exports = { getTransform: getTransform }; -},{}],235:[function(_dereq_,module,exports){ +},{"../../lib":209}],266:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59596,6 +62110,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -59625,8 +62140,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -59657,7 +62174,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":179,"../../registry":265}],236:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296,"./axis_ids":257}],267:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59995,6 +62512,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -60274,7 +62792,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":74,"../../constants/xmlns_namespaces":159,"../../lib":179,"../../registry":265,"../get_data":253,"../plots":257,"./attributes":221,"./axis_ids":226,"./constants":229,"./graph_interact":232,"./layout_attributes":237,"./layout_defaults":238,"./transition_axes":247,"d3":16}],237:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../constants/xmlns_namespaces":189,"../../lib":209,"../../registry":296,"../get_data":284,"../plots":288,"./attributes":252,"./axis_ids":257,"./constants":260,"./graph_interact":263,"./layout_attributes":268,"./layout_defaults":269,"./transition_axes":278,"d3":16}],268:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60347,6 +62865,14 @@ module.exports = { // type in the template explicitly it will be honored as the default. _noTemplating: true, + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, autorange: { valType: 'enumerated', @@ -60407,7 +62933,6 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', editType: 'plot', @@ -60571,6 +63096,22 @@ module.exports = { editType: 'ticks', + }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + editType: 'calc', + }, mirror: { valType: 'enumerated', @@ -60711,6 +63252,14 @@ module.exports = { editType: 'ticks', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'ticks', + }, separatethousands: { valType: 'boolean', @@ -60963,7 +63512,7 @@ module.exports = { } }; -},{"../../components/color/attributes":51,"../../components/drawing/attributes":73,"../../constants/docs":156,"../../constants/numerical":158,"../../lib/extend":173,"../../plot_api/plot_template":213,"../font_attributes":251,"./constants":229}],238:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../components/drawing/attributes":102,"../../constants/docs":186,"../../constants/numerical":188,"../../lib/extend":203,"../../plot_api/plot_template":243,"../font_attributes":282,"./constants":260}],269:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60985,7 +63534,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -61004,6 +63553,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -61212,6 +63763,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -61276,6 +63828,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -61340,101 +63893,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":52,"../../components/fx/helpers":88,"../../components/fx/hovermode_defaults":91,"../../lib":179,"../../plot_api/plot_template":213,"../../registry":265,"../layout_attributes":255,"./axis_defaults":225,"./axis_ids":226,"./constants":229,"./constraints":230,"./layout_attributes":237,"./position_defaults":240,"./type_defaults":248}],239:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/fx/helpers":117,"../../components/fx/hovermode_defaults":120,"../../lib":209,"../../plot_api/plot_template":243,"../../registry":296,"../layout_attributes":286,"./axis_defaults":256,"./axis_ids":257,"./constants":260,"./constraints":261,"./layout_attributes":268,"./position_defaults":271,"./type_defaults":279}],270:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61499,7 +63964,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":51,"../../lib":179,"tinycolor2":35}],240:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../lib":209,"tinycolor2":64}],271:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61587,7 +64052,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":179,"fast-isnumeric":18}],241:[function(_dereq_,module,exports){ +},{"../../lib":209,"fast-isnumeric":18}],272:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61613,9 +64078,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":154}],242:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183}],273:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61685,6 +64151,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -61774,8 +64248,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -62550,7 +65024,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":52,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../components/fx/helpers":88,"../../components/shapes/draw_newshape/display_outlines":137,"../../components/shapes/draw_newshape/helpers":138,"../../components/shapes/draw_newshape/newshapes":139,"../../lib":179,"../../lib/clear_gl_canvases":167,"../../lib/polygon":191,"../../lib/throttle":201,"../../plot_api/subroutines":214,"../../registry":265,"./axis_ids":226,"./constants":229,"./handle_outline":233,"./helpers":234,"polybooljs":26}],243:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/dragelement/helpers":99,"../../components/drawing":103,"../../components/fx":121,"../../components/fx/helpers":117,"../../components/shapes/draw_newshape/display_outlines":166,"../../components/shapes/draw_newshape/helpers":167,"../../components/shapes/draw_newshape/newshapes":168,"../../lib":209,"../../lib/clear_gl_canvases":197,"../../lib/polygon":221,"../../lib/throttle":231,"../../plot_api/subroutines":244,"../../registry":296,"./axis_ids":257,"./constants":260,"./handle_outline":264,"./helpers":265,"polybooljs":55}],274:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62583,7 +65057,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -62739,6 +65212,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -62870,12 +65347,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -62918,17 +65395,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -63432,38 +65904,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -63522,7 +65982,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":158,"../../lib":179,"./axis_ids":226,"./constants":229,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],244:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"./axis_ids":257,"./constants":260,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],275:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63535,6 +65995,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -63571,10 +66032,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -63597,6 +66062,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -63643,7 +66109,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":179,"../array_container_defaults":219,"./layout_attributes":237}],245:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":209,"../array_container_defaults":249,"./layout_attributes":268}],276:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63676,7 +66142,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":179,"./layout_attributes":237}],246:[function(_dereq_,module,exports){ +},{"../../lib":209,"./layout_attributes":268}],277:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63723,7 +66189,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":179,"./clean_ticks":228}],247:[function(_dereq_,module,exports){ +},{"../../lib":209,"./clean_ticks":259}],278:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63936,7 +66402,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":74,"../../lib":179,"../../registry":265,"./axes":223,"d3":16}],248:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../lib":209,"../../registry":296,"./axes":254,"d3":16}],279:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63955,6 +66421,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -64007,6 +66474,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -64073,7 +66542,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":265,"./axis_autotype":224}],249:[function(_dereq_,module,exports){ +},{"../../registry":296,"./axis_autotype":255}],280:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64500,7 +66969,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":179,"../registry":265}],250:[function(_dereq_,module,exports){ +},{"../lib":209,"../registry":296}],281:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64612,7 +67081,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":173}],251:[function(_dereq_,module,exports){ +},{"../lib/extend":203}],282:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64677,7 +67146,7 @@ module.exports = function(opts) { return attrs; }; -},{}],252:[function(_dereq_,module,exports){ +},{}],283:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64723,7 +67192,7 @@ module.exports = { } }; -},{}],253:[function(_dereq_,module,exports){ +},{}],284:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64852,7 +67321,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":265,"./cartesian/constants":229}],254:[function(_dereq_,module,exports){ +},{"../registry":296,"./cartesian/constants":260}],285:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64886,7 +67355,7 @@ function project(camera, v) { module.exports = project; -},{}],255:[function(_dereq_,module,exports){ +},{}],286:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65074,6 +67543,12 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + + editType: 'none', + + }, paper_bgcolor: { valType: 'color', @@ -65089,6 +67564,14 @@ module.exports = { dflt: colorAttrs.background, editType: 'layoutstyle', + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, separators: { valType: 'string', @@ -65213,7 +67696,7 @@ module.exports = { } }; -},{"../components/color/attributes":51,"../components/shapes/draw_newshape/attributes":134,"../lib/extend":173,"./animation_attributes":218,"./font_attributes":251,"./pad_attributes":256}],256:[function(_dereq_,module,exports){ +},{"../components/color/attributes":80,"../components/shapes/draw_newshape/attributes":163,"../lib/extend":203,"./animation_attributes":248,"./font_attributes":282,"./pad_attributes":287}],287:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65268,7 +67751,7 @@ module.exports = function(opts) { }; }; -},{}],257:[function(_dereq_,module,exports){ +},{}],288:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65938,7 +68421,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -66747,6 +69230,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -67135,6 +69620,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -67152,6 +69640,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -67171,13 +69663,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -67202,6 +69696,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -67216,8 +69715,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -67249,11 +69746,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -67263,11 +69759,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -67277,6 +69772,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -67303,11 +69810,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -67431,7 +69951,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -68331,6 +70864,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -68341,7 +70877,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -68351,27 +70886,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -68380,18 +70916,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -68414,16 +70946,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -68465,12 +71000,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -68479,13 +71010,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -68607,7 +71139,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":52,"../constants/numerical":158,"../lib":179,"../plot_api/plot_schema":212,"../plot_api/plot_template":213,"../plots/get_data":253,"../registry":265,"./animation_attributes":218,"./attributes":220,"./cartesian/axis_ids":226,"./cartesian/handle_outline":233,"./command":249,"./font_attributes":251,"./frame_attributes":252,"./layout_attributes":255,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],258:[function(_dereq_,module,exports){ +},{"../components/color":81,"../constants/numerical":188,"../lib":209,"../plot_api/plot_schema":242,"../plot_api/plot_template":243,"../plots/get_data":284,"../registry":296,"./animation_attributes":248,"./attributes":250,"./cartesian/axis_ids":257,"./cartesian/handle_outline":264,"./command":280,"./font_attributes":282,"./frame_attributes":283,"./layout_attributes":286,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],289:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68651,7 +71183,7 @@ module.exports = { } }; -},{"../../../lib/extend":173,"../../../traces/scatter/attributes":366}],259:[function(_dereq_,module,exports){ +},{"../../../lib/extend":203,"../../../traces/scatter/attributes":397}],290:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68773,7 +71305,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":173,"../../../plot_api/edit_types":206,"../../cartesian/layout_attributes":237}],260:[function(_dereq_,module,exports){ +},{"../../../lib/extend":203,"../../../plot_api/edit_types":236,"../../cartesian/layout_attributes":268}],291:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68788,7 +71320,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":261,"./micropolar_manager":262}],261:[function(_dereq_,module,exports){ +},{"./micropolar":292,"./micropolar_manager":293}],292:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70208,7 +72740,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":154,"../../../lib":179,"d3":16}],262:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":183,"../../../lib":209,"d3":16}],293:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70294,7 +72826,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":52,"../../../lib":179,"./micropolar":261,"./undo_manager":263,"d3":16}],263:[function(_dereq_,module,exports){ +},{"../../../components/color":81,"../../../lib":209,"./micropolar":292,"./undo_manager":294,"d3":16}],294:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70360,7 +72892,7 @@ module.exports = function UndoManager() { }; }; -},{}],264:[function(_dereq_,module,exports){ +},{}],295:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70443,7 +72975,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":156}],265:[function(_dereq_,module,exports){ +},{"../constants/docs":186}],296:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70909,7 +73441,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":171,"./lib/extend":173,"./lib/is_plain_object":180,"./lib/loggers":183,"./lib/noop":188,"./lib/push_unique":192,"./plots/attributes":220,"./plots/layout_attributes":255}],266:[function(_dereq_,module,exports){ +},{"./lib/dom":201,"./lib/extend":203,"./lib/is_plain_object":210,"./lib/loggers":213,"./lib/noop":218,"./lib/push_unique":222,"./plots/attributes":250,"./plots/layout_attributes":286}],297:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71082,7 +73614,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":179,"../registry":265}],267:[function(_dereq_,module,exports){ +},{"../lib":209,"../registry":296}],298:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71116,6 +73648,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -71152,7 +73686,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":179,"../plot_api/to_image":216,"./filesaver":268,"./helpers":269}],268:[function(_dereq_,module,exports){ +},{"../lib":209,"../plot_api/to_image":246,"./filesaver":299,"./helpers":300}],299:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71232,7 +73766,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":179,"./helpers":269}],269:[function(_dereq_,module,exports){ +},{"../lib":209,"./helpers":300}],300:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71315,7 +73849,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":265}],270:[function(_dereq_,module,exports){ +},{"../registry":296}],301:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71341,7 +73875,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":266,"./download":267,"./helpers":269,"./svgtoimg":271,"./toimage":272,"./tosvg":273}],271:[function(_dereq_,module,exports){ +},{"./cloneplot":297,"./download":298,"./helpers":300,"./svgtoimg":302,"./toimage":303,"./tosvg":304}],302:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71468,7 +74002,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":179,"./helpers":269,"events":13}],272:[function(_dereq_,module,exports){ +},{"../lib":209,"./helpers":300,"events":13}],303:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71545,7 +74079,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":179,"../registry":265,"./cloneplot":266,"./helpers":269,"./svgtoimg":271,"./tosvg":273,"events":13}],273:[function(_dereq_,module,exports){ +},{"../lib":209,"../registry":296,"./cloneplot":297,"./helpers":300,"./svgtoimg":302,"./tosvg":304,"events":13}],304:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71734,7 +74268,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":52,"../components/drawing":74,"../constants/xmlns_namespaces":159,"../lib":179,"d3":16}],274:[function(_dereq_,module,exports){ +},{"../components/color":81,"../components/drawing":103,"../constants/xmlns_namespaces":189,"../lib":209,"d3":16}],305:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71767,7 +74301,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":179}],275:[function(_dereq_,module,exports){ +},{"../../lib":209}],306:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71829,6 +74363,13 @@ module.exports = { y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, texttemplate: texttemplateAttrs({editType: 'plot'}, { keys: constants.eventDataKeys @@ -71976,7 +74517,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":59,"../../lib/extend":173,"../../plots/font_attributes":251,"../../plots/template_attributes":264,"../scatter/attributes":366,"./constants":277}],276:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":88,"../../lib/extend":203,"../../plots/font_attributes":282,"../../plots/template_attributes":295,"../scatter/attributes":397,"./constants":308}],307:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71988,6 +74529,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; var colorscaleCalc = _dereq_('../../components/colorscale/calc'); var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); @@ -71996,18 +74538,23 @@ var calcSelection = _dereq_('../scatter/calc_selection'); module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; var sizeOpts = { msUTC: !!(trace.base || trace.base === 0) }; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x', sizeOpts); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y', sizeOpts); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -72018,6 +74565,10 @@ module.exports = function calc(gd, trace) { for(var i = 0; i < serieslen; i++) { cd[i] = { p: pos[i], s: size[i] }; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cd[i].id = String(trace.ids[i]); } @@ -72045,7 +74596,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":60,"../../components/colorscale/helpers":63,"../../plots/cartesian/axes":223,"../scatter/calc_selection":368,"./arrays_to_calcdata":274}],277:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":89,"../../components/colorscale/helpers":92,"../../plots/cartesian/align_period":251,"../../plots/cartesian/axes":254,"../scatter/calc_selection":399,"./arrays_to_calcdata":305}],308:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72067,7 +74618,7 @@ module.exports = { eventDataKeys: ['value', 'label'] }; -},{}],278:[function(_dereq_,module,exports){ +},{}],309:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72084,7 +74635,7 @@ var BADNUM = _dereq_('../../constants/numerical').BADNUM; var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var Sieve = _dereq_('./sieve.js'); /* @@ -72847,7 +75398,7 @@ module.exports = { setGroupPositions: setGroupPositions }; -},{"../../constants/numerical":158,"../../lib":179,"../../plots/cartesian/axes":223,"../../plots/cartesian/axis_ids":226,"../../registry":265,"./sieve.js":288,"fast-isnumeric":18}],279:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"../../plots/cartesian/axes":254,"../../plots/cartesian/constraints":261,"../../registry":296,"./sieve.js":319,"fast-isnumeric":18}],310:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72863,8 +75414,9 @@ var Color = _dereq_('../../components/color'); var Registry = _dereq_('../../registry'); var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var attributes = _dereq_('./attributes'); var coerceFont = Lib.coerceFont; @@ -72880,6 +75432,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); coerce('base'); coerce('offset'); @@ -73029,7 +75583,7 @@ module.exports = { handleText: handleText }; -},{"../../components/color":52,"../../lib":179,"../../plots/cartesian/axis_ids":226,"../../registry":265,"../scatter/xy_defaults":392,"./attributes":275,"./style_defaults":290}],280:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":209,"../../plots/cartesian/constraints":261,"../../registry":296,"../scatter/period_defaults":417,"../scatter/xy_defaults":424,"./attributes":306,"./style_defaults":321}],311:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73058,7 +75612,7 @@ module.exports = function eventData(out, pt, trace) { return out; }; -},{}],281:[function(_dereq_,module,exports){ +},{}],312:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73136,7 +75690,7 @@ exports.getLineWidth = function(trace, di) { return w; }; -},{"../../lib":179,"fast-isnumeric":18,"tinycolor2":35}],282:[function(_dereq_,module,exports){ +},{"../../lib":209,"fast-isnumeric":18,"tinycolor2":64}],313:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73297,10 +75851,13 @@ function hoverOnBars(pointData, xval, yval, hovermode) { var extent = t.extents[t.extents.round(di.p)]; pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true); pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true); - pointData[posLetter + 'LabelVal'] = di.p; + + var hasPeriod = di.orig_p !== undefined; + pointData[posLetter + 'LabelVal'] = hasPeriod ? di.orig_p : di.p; pointData.labelLabel = hoverLabelText(pa, pointData[posLetter + 'LabelVal']); pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + 'LabelVal']); + pointData.baseLabel = hoverLabelText(sa, di.b); // spikelines always want "closest" distance regardless of hovermode pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 - maxHoverDistance; @@ -73329,7 +75886,7 @@ module.exports = { getTraceColor: getTraceColor }; -},{"../../components/color":52,"../../components/fx":92,"../../constants/numerical":158,"../../lib":179,"../../plots/cartesian/axes":223,"../../registry":265,"./helpers":281}],283:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/fx":121,"../../constants/numerical":188,"../../lib":209,"../../plots/cartesian/axes":254,"../../registry":296,"./helpers":312}],314:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73367,7 +75924,7 @@ module.exports = { } }; -},{"../../plots/cartesian":236,"../scatter/marker_colorbar":384,"./arrays_to_calcdata":274,"./attributes":275,"./calc":276,"./cross_trace_calc":278,"./defaults":279,"./event_data":280,"./hover":282,"./layout_attributes":284,"./layout_defaults":285,"./plot":286,"./select":287,"./style":289}],284:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":267,"../scatter/marker_colorbar":415,"./arrays_to_calcdata":305,"./attributes":306,"./calc":307,"./cross_trace_calc":309,"./defaults":310,"./event_data":311,"./hover":313,"./layout_attributes":315,"./layout_defaults":316,"./plot":317,"./select":318,"./style":320}],315:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73415,7 +75972,7 @@ module.exports = { } }; -},{}],285:[function(_dereq_,module,exports){ +},{}],316:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73475,7 +76032,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":179,"../../plots/cartesian/axes":223,"../../registry":265,"./layout_attributes":284}],286:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/axes":254,"../../registry":296,"./layout_attributes":315}],317:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73720,7 +76277,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback); sel .style('vector-effect', 'non-scaling-stroke') - .attr('d', isNaN((x1 - x0) * (y1 - y0)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') + .attr('d', (isNaN((x1 - x0) * (y1 - y0)) || (isBlank && gd._context.staticPlot)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') .call(Drawing.setClipUrl, plotinfo.layerClipId, gd); if(!fullLayout.uniformtext.mode && withTransition) { @@ -74260,7 +76817,7 @@ module.exports = { toMoveInsideBar: toMoveInsideBar }; -},{"../../components/color":52,"../../components/drawing":74,"../../components/fx/helpers":88,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/cartesian/axes":223,"../../registry":265,"./attributes":275,"./constants":277,"./helpers":281,"./style":289,"./uniform_text":291,"d3":16,"fast-isnumeric":18}],287:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../../components/fx/helpers":117,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/cartesian/axes":254,"../../registry":296,"./attributes":306,"./constants":308,"./helpers":312,"./style":320,"./uniform_text":322,"d3":16,"fast-isnumeric":18}],318:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74324,7 +76881,7 @@ function getCentroid(d, xa, ya, isHorizontal, isFunnel) { } } -},{}],288:[function(_dereq_,module,exports){ +},{}],319:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74438,7 +76995,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":158,"../../lib":179}],289:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209}],320:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74620,7 +77177,7 @@ module.exports = { resizeText: resizeText }; -},{"../../components/color":52,"../../components/drawing":74,"../../lib":179,"../../registry":265,"./attributes":275,"./helpers":281,"./uniform_text":291,"d3":16}],290:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../../lib":209,"../../registry":296,"./attributes":306,"./helpers":312,"./uniform_text":322,"d3":16}],321:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74658,7 +77215,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('unselected.marker.color'); }; -},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63}],291:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92}],322:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74744,7 +77301,7 @@ module.exports = { resizeText: resizeText }; -},{"../../lib":179,"d3":16}],292:[function(_dereq_,module,exports){ +},{"../../lib":209,"d3":16}],323:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74801,6 +77358,13 @@ module.exports = { }, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + name: { valType: 'string', @@ -75040,7 +77604,7 @@ module.exports = { } }; -},{"../../components/color/attributes":51,"../../lib/extend":173,"../../plots/template_attributes":264,"../bar/attributes":275,"../scatter/attributes":366}],293:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../lib/extend":203,"../../plots/template_attributes":295,"../bar/attributes":306,"../scatter/attributes":397}],324:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75053,7 +77617,7 @@ module.exports = { var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var orientations = ['v', 'h']; @@ -75272,7 +77836,7 @@ module.exports = { setPositionOffset: setPositionOffset }; -},{"../../lib":179,"../../plots/cartesian/axes":223,"../../plots/cartesian/axis_ids":226}],294:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/axes":254,"../../plots/cartesian/constraints":261}],325:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75313,7 +77877,7 @@ module.exports = { } }; -},{}],295:[function(_dereq_,module,exports){ +},{}],326:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75359,7 +77923,7 @@ module.exports = { _supply: _supply }; -},{"../../lib":179,"../../registry":265,"./layout_attributes":294}],296:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296,"./layout_attributes":325}],327:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75709,7 +78273,7 @@ module.exports = { plotBoxMean: plotBoxMean }; -},{"../../components/drawing":74,"../../lib":179,"d3":16}],297:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../lib":209,"d3":16}],328:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75783,7 +78347,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/color":52,"../../components/drawing":74,"d3":16}],298:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"d3":16}],329:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75813,6 +78377,10 @@ function directionAttrs(lineColorDefault) { } module.exports = { + xperiod: OHLCattrs.xperiod, + xperiod0: OHLCattrs.xperiod0, + xperiodalignment: OHLCattrs.xperiodalignment, + x: OHLCattrs.x, open: OHLCattrs.open, high: OHLCattrs.high, @@ -75837,7 +78405,7 @@ module.exports = { hoverlabel: OHLCattrs.hoverlabel, }; -},{"../../lib":179,"../box/attributes":292,"../ohlc/attributes":344}],299:[function(_dereq_,module,exports){ +},{"../../lib":209,"../box/attributes":323,"../ohlc/attributes":375}],330:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75850,6 +78418,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var calcCommon = _dereq_('../ohlc/calc').calcCommon; @@ -75858,9 +78427,10 @@ module.exports = function(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis); var ya = Axes.getFromId(gd, trace.yaxis); - var x = xa.makeCalcdata(trace, 'x'); + var origX = xa.makeCalcdata(trace, 'x'); + var x = alignPeriod(trace, xa, 'x', origX); - var cd = calcCommon(gd, trace, x, ya, ptFunc); + var cd = calcCommon(gd, trace, origX, x, ya, ptFunc); if(cd.length) { Lib.extendFlat(cd[0].t, { @@ -75887,7 +78457,7 @@ function ptFunc(o, h, l, c) { }; } -},{"../../lib":179,"../../plots/cartesian/axes":223,"../ohlc/calc":345}],300:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/align_period":251,"../../plots/cartesian/axes":254,"../ohlc/calc":376}],331:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75902,6 +78472,7 @@ function ptFunc(o, h, l, c) { var Lib = _dereq_('../../lib'); var Color = _dereq_('../../components/color'); var handleOHLC = _dereq_('../ohlc/ohlc_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -75915,6 +78486,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce, {x: true}); + coerce('line.width'); handleDirection(traceIn, traceOut, coerce, 'increasing'); @@ -75933,7 +78506,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor', Color.addOpacity(lineColor, 0.5)); } -},{"../../components/color":52,"../../lib":179,"../ohlc/ohlc_defaults":349,"./attributes":298}],301:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":209,"../ohlc/ohlc_defaults":380,"../scatter/period_defaults":417,"./attributes":329}],332:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75966,7 +78539,7 @@ module.exports = { selectPoints: _dereq_('../ohlc/select') }; -},{"../../plots/cartesian":236,"../box/cross_trace_calc":293,"../box/layout_attributes":294,"../box/layout_defaults":295,"../box/plot":296,"../box/style":297,"../ohlc/hover":347,"../ohlc/select":351,"./attributes":298,"./calc":299,"./defaults":300}],302:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":267,"../box/cross_trace_calc":324,"../box/layout_attributes":325,"../box/layout_defaults":326,"../box/plot":327,"../box/style":328,"../ohlc/hover":378,"../ohlc/select":382,"./attributes":329,"./calc":330,"./defaults":331}],333:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75999,7 +78572,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":179}],303:[function(_dereq_,module,exports){ +},{"../../lib":209}],334:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76027,6 +78600,13 @@ module.exports = { y0: barAttrs.y0, dy: barAttrs.dy, + xperiod: barAttrs.xperiod, + yperiod: barAttrs.yperiod, + xperiod0: barAttrs.xperiod0, + yperiod0: barAttrs.yperiod0, + xperiodalignment: barAttrs.xperiodalignment, + yperiodalignment: barAttrs.yperiodalignment, + hovertext: barAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys @@ -76099,7 +78679,7 @@ module.exports = { alignmentgroup: barAttrs.alignmentgroup }; -},{"../../components/color":52,"../../lib/extend":173,"../../plots/attributes":220,"../../plots/template_attributes":264,"../bar/attributes":275,"../scatter/attributes":366,"./constants":305}],304:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib/extend":203,"../../plots/attributes":250,"../../plots/template_attributes":295,"../bar/attributes":306,"../scatter/attributes":397,"./constants":336}],335:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76111,6 +78691,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); var calcSelection = _dereq_('../scatter/calc_selection'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -76118,14 +78699,19 @@ var BADNUM = _dereq_('../../constants/numerical').BADNUM; module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos, i, cdi; + var size, pos, origPos, i, cdi; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -76157,6 +78743,10 @@ module.exports = function calc(gd, trace) { trace._base[i] = -0.5 * cdi.s; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cdi.id = String(trace.ids[i]); } @@ -76193,7 +78783,7 @@ function fixNum(a) { return (a === BADNUM) ? 0 : a; } -},{"../../constants/numerical":158,"../../plots/cartesian/axes":223,"../scatter/calc_selection":368,"./arrays_to_calcdata":302}],305:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../plots/cartesian/align_period":251,"../../plots/cartesian/axes":254,"../scatter/calc_selection":399,"./arrays_to_calcdata":333}],336:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76212,7 +78802,7 @@ module.exports = { ] }; -},{}],306:[function(_dereq_,module,exports){ +},{}],337:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76283,7 +78873,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../bar/cross_trace_calc":278}],307:[function(_dereq_,module,exports){ +},{"../bar/cross_trace_calc":309}],338:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76299,6 +78889,7 @@ var Lib = _dereq_('../../lib'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var handleText = _dereq_('../bar/defaults').handleText; var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); var Color = _dereq_('../../components/color'); @@ -76313,6 +78904,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.y && !traceOut.x) ? 'v' : 'h'); coerce('offset'); coerce('width'); @@ -76380,7 +78973,7 @@ module.exports = { crossTraceDefaults: crossTraceDefaults }; -},{"../../components/color":52,"../../lib":179,"../bar/defaults":279,"../scatter/xy_defaults":392,"./attributes":303}],308:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":209,"../bar/defaults":310,"../scatter/period_defaults":417,"../scatter/xy_defaults":424,"./attributes":334}],339:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76407,7 +79000,7 @@ module.exports = function eventData(out, pt /* , trace, cd, pointNumber */) { return out; }; -},{}],309:[function(_dereq_,module,exports){ +},{}],340:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76480,7 +79073,7 @@ function getTraceColor(trace, di) { else if(opacity(mlc) && mlw) return mlc; } -},{"../../components/color":52,"../../lib":179,"../bar/hover":282}],310:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":209,"../bar/hover":313}],341:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76515,7 +79108,7 @@ module.exports = { } }; -},{"../../plots/cartesian":236,"../bar/select":287,"./attributes":303,"./calc":304,"./cross_trace_calc":306,"./defaults":307,"./event_data":308,"./hover":309,"./layout_attributes":311,"./layout_defaults":312,"./plot":313,"./style":314}],311:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":267,"../bar/select":318,"./attributes":334,"./calc":335,"./cross_trace_calc":337,"./defaults":338,"./event_data":339,"./hover":340,"./layout_attributes":342,"./layout_defaults":343,"./plot":344,"./style":345}],342:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76554,7 +79147,7 @@ module.exports = { } }; -},{}],312:[function(_dereq_,module,exports){ +},{}],343:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76591,7 +79184,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":179,"./layout_attributes":311}],313:[function(_dereq_,module,exports){ +},{"../../lib":209,"./layout_attributes":342}],344:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76760,7 +79353,7 @@ function getXY(di, xa, ya, isHorizontal) { return isHorizontal ? [s, p] : [p, s]; } -},{"../../components/drawing":74,"../../constants/numerical":158,"../../lib":179,"../bar/plot":286,"../bar/uniform_text":291,"d3":16}],314:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../constants/numerical":188,"../../lib":209,"../bar/plot":317,"../bar/uniform_text":322,"d3":16}],345:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76825,7 +79418,7 @@ module.exports = { style: style }; -},{"../../components/color":52,"../../components/drawing":74,"../../constants/interactions":157,"../bar/style":289,"../bar/uniform_text":291,"d3":16}],315:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../../constants/interactions":187,"../bar/style":320,"../bar/uniform_text":322,"d3":16}],346:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76927,7 +79520,7 @@ module.exports = { } }; -},{"../../lib/extend":173,"../../plots/attributes":220,"../../plots/domain":250,"../../plots/template_attributes":264,"../pie/attributes":353}],316:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plots/attributes":250,"../../plots/domain":281,"../../plots/template_attributes":295,"../pie/attributes":384}],347:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76950,7 +79543,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":257}],317:[function(_dereq_,module,exports){ +},{"../../plots/plots":288}],348:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76976,7 +79569,7 @@ module.exports = { crossTraceCalc: crossTraceCalc }; -},{"../pie/calc":355}],318:[function(_dereq_,module,exports){ +},{"../pie/calc":386}],349:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77058,7 +79651,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('baseratio'); }; -},{"../../lib":179,"../../plots/domain":250,"../bar/defaults":279,"../pie/defaults":356,"./attributes":315}],319:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/domain":281,"../bar/defaults":310,"../pie/defaults":387,"./attributes":346}],350:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77092,7 +79685,7 @@ module.exports = { } }; -},{"../pie/style_one":364,"./attributes":315,"./base_plot":316,"./calc":317,"./defaults":318,"./layout_attributes":320,"./layout_defaults":321,"./plot":322,"./style":323}],320:[function(_dereq_,module,exports){ +},{"../pie/style_one":395,"./attributes":346,"./base_plot":347,"./calc":348,"./defaults":349,"./layout_attributes":351,"./layout_defaults":352,"./plot":353,"./style":354}],351:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77123,7 +79716,7 @@ module.exports = { } }; -},{"../pie/layout_attributes":360}],321:[function(_dereq_,module,exports){ +},{"../pie/layout_attributes":391}],352:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77148,7 +79741,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendfunnelareacolors'); }; -},{"../../lib":179,"./layout_attributes":320}],322:[function(_dereq_,module,exports){ +},{"../../lib":209,"./layout_attributes":351}],353:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77163,6 +79756,8 @@ var d3 = _dereq_('d3'); var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var barPlot = _dereq_('../bar/plot'); @@ -77318,9 +79913,9 @@ module.exports = function plot(gd, cdModule) { var transform = positionTitleOutside(cd0, fullLayout._size); titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); }); }); @@ -77444,7 +80039,7 @@ function setCoords(cd) { } } -},{"../../components/drawing":74,"../../lib":179,"../../lib/svg_text_utils":200,"../bar/plot":286,"../bar/uniform_text":291,"../pie/helpers":358,"../pie/plot":362,"d3":16}],323:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../lib":209,"../../lib/svg_text_utils":230,"../bar/plot":317,"../bar/uniform_text":322,"../pie/helpers":389,"../pie/plot":393,"d3":16}],354:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77477,7 +80072,7 @@ module.exports = function style(gd) { }); }; -},{"../bar/uniform_text":291,"../pie/style_one":364,"d3":16}],324:[function(_dereq_,module,exports){ +},{"../bar/uniform_text":322,"../pie/style_one":395,"d3":16}],355:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77618,7 +80213,7 @@ module.exports = { } }; -},{"../../lib/extend":173,"../../plots/template_attributes":264,"../bar/attributes":275,"./bin_attributes":326,"./constants":330}],325:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plots/template_attributes":295,"../bar/attributes":306,"./bin_attributes":357,"./constants":361}],356:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77643,7 +80238,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],326:[function(_dereq_,module,exports){ +},{}],357:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77678,7 +80273,7 @@ module.exports = function makeBinAttrs(axLetter, match) { }; }; -},{}],327:[function(_dereq_,module,exports){ +},{}],358:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77752,7 +80347,7 @@ module.exports = { } }; -},{"fast-isnumeric":18}],328:[function(_dereq_,module,exports){ +},{"fast-isnumeric":18}],359:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77928,7 +80523,7 @@ function dateParts(v, pa, calendar) { return parts; } -},{"../../constants/numerical":158,"../../plots/cartesian/axes":223}],329:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../plots/cartesian/axes":254}],360:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78507,7 +81102,7 @@ module.exports = { calcAllAutoBins: calcAllAutoBins }; -},{"../../lib":179,"../../plots/cartesian/axes":223,"../../registry":265,"../bar/arrays_to_calcdata":274,"./average":325,"./bin_functions":327,"./bin_label_vals":328,"./norm_functions":336,"fast-isnumeric":18}],330:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/axes":254,"../../registry":296,"../bar/arrays_to_calcdata":305,"./average":356,"./bin_functions":358,"./bin_label_vals":359,"./norm_functions":367,"fast-isnumeric":18}],361:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78523,7 +81118,7 @@ module.exports = { eventDataKeys: ['binNumber'] }; -},{}],331:[function(_dereq_,module,exports){ +},{}],362:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78541,7 +81136,7 @@ var traceIs = _dereq_('../../registry').traceIs; var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var nestedProperty = Lib.nestedProperty; -var getAxisGroup = axisIds.getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var BINATTRS = [ {aStr: {x: 'xbins.start', y: 'ybins.start'}, name: 'start'}, @@ -78700,10 +81295,9 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } var binGroupFound = false; - for(i = 0; i < traces.length; i++) { - traceOut = traces[i]; + if(traces.length) { + traceOut = traces[0]; binGroupFound = coerce('bingroup'); - break; } groupName = binGroupFound || groupName; @@ -78801,7 +81395,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":179,"../../plots/cartesian/axis_ids":226,"../../registry":265,"../bar/defaults":279}],332:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/cartesian/axis_ids":257,"../../plots/cartesian/constraints":261,"../../registry":296,"../bar/defaults":310}],363:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78875,7 +81469,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":52,"../../lib":179,"../../registry":265,"../bar/style_defaults":290,"./attributes":324}],333:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":209,"../../registry":296,"../bar/style_defaults":321,"./attributes":355}],364:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78924,7 +81518,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],334:[function(_dereq_,module,exports){ +},{}],365:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78957,7 +81551,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return pts; }; -},{"../../plots/cartesian/axes":223,"../bar/hover":282}],335:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":254,"../bar/hover":313}],366:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79007,7 +81601,7 @@ module.exports = { } }; -},{"../../plots/cartesian":236,"../bar/cross_trace_calc":278,"../bar/layout_attributes":284,"../bar/layout_defaults":285,"../bar/plot":286,"../bar/select":287,"../bar/style":289,"../scatter/marker_colorbar":384,"./attributes":324,"./calc":329,"./cross_trace_defaults":331,"./defaults":332,"./event_data":333,"./hover":334}],336:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":267,"../bar/cross_trace_calc":309,"../bar/layout_attributes":315,"../bar/layout_defaults":316,"../bar/plot":317,"../bar/select":318,"../bar/style":320,"../scatter/marker_colorbar":415,"./attributes":355,"./calc":360,"./cross_trace_defaults":362,"./defaults":363,"./event_data":364,"./hover":365}],367:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79042,7 +81636,7 @@ module.exports = { } }; -},{}],337:[function(_dereq_,module,exports){ +},{}],368:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79326,6 +81920,7 @@ module.exports = { showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, editType: 'plot' }, 'plot'), @@ -79361,7 +81956,7 @@ module.exports = { } }; -},{"../../components/color/attributes":51,"../../constants/delta.js":155,"../../constants/docs":156,"../../lib/extend":173,"../../plot_api/edit_types":206,"../../plot_api/plot_template":213,"../../plots/cartesian/layout_attributes":237,"../../plots/domain":250,"../../plots/font_attributes":251}],338:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../constants/delta.js":185,"../../constants/docs":186,"../../lib/extend":203,"../../plot_api/edit_types":236,"../../plot_api/plot_template":243,"../../plots/cartesian/layout_attributes":268,"../../plots/domain":281,"../../plots/font_attributes":282}],369:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79384,7 +81979,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":257}],339:[function(_dereq_,module,exports){ +},{"../../plots/plots":288}],370:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79421,7 +82016,7 @@ module.exports = { calc: calc }; -},{}],340:[function(_dereq_,module,exports){ +},{}],371:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79443,7 +82038,7 @@ module.exports = { horizontalPadding: 10 }; -},{}],341:[function(_dereq_,module,exports){ +},{}],372:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79610,7 +82205,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":179,"../../plot_api/plot_template":213,"../../plots/array_container_defaults":219,"../../plots/cartesian/tick_label_defaults":244,"../../plots/cartesian/tick_mark_defaults":245,"../../plots/cartesian/tick_value_defaults":246,"../../plots/domain":250,"./attributes":337,"./constants.js":340}],342:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plot_api/plot_template":243,"../../plots/array_container_defaults":249,"../../plots/cartesian/tick_label_defaults":275,"../../plots/cartesian/tick_mark_defaults":276,"../../plots/cartesian/tick_value_defaults":277,"../../plots/domain":281,"./attributes":368,"./constants.js":371}],373:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79640,7 +82235,7 @@ module.exports = { } }; -},{"./attributes":337,"./base_plot":338,"./calc":339,"./defaults":341,"./plot":343}],343:[function(_dereq_,module,exports){ +},{"./attributes":368,"./base_plot":369,"./calc":370,"./defaults":372,"./plot":374}],374:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79654,6 +82249,8 @@ module.exports = { var d3 = _dereq_('d3'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var rad2deg = Lib.rad2deg; var MID_SHIFT = _dereq_('../../constants/alignment').MID_SHIFT; var Drawing = _dereq_('../../components/drawing'); @@ -79886,7 +82483,7 @@ function drawBulletGauge(gd, plotGroup, cd, opts) { // Enter bullet, axis bullet.enter().append('g').classed('bullet', true); - bullet.attr('transform', 'translate(' + size.l + ', ' + size.t + ')'); + bullet.attr('transform', strTranslate(size.l, size.t)); axisLayer.enter().append('g') .classed('bulletaxis', true) @@ -79905,7 +82502,7 @@ function drawBulletGauge(gd, plotGroup, cd, opts) { ax.setScale(); vals = Axes.calcTicks(ax); - transFn = Axes.makeTransFn(ax); + transFn = Axes.makeTransTickFn(ax); tickSign = Axes.getTickSigns(ax)[2]; shift = size.t + size.h; @@ -80423,7 +83020,7 @@ function drawNumbers(gd, plotGroup, cd, opts) { // Stash translateX translateX = cache(trace, 'numbersTranslate', 0, translateX, key, Math.max); - return strTranslate(translateX, translateY) + ' scale(' + scaleRatio + ')'; + return strTranslate(translateX, translateY) + strScale(scaleRatio); }); } } @@ -80480,10 +83077,6 @@ function mockAxis(gd, opts, zrange) { return axisOut; } -function strTranslate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - function fitTextInsideBox(textBB, width, height) { // compute scaling ratio to have text fit within specified width and height var ratio = Math.min(width / textBB.width, height / textBB.height); @@ -80521,7 +83114,7 @@ function cache(trace, name, initialValue, value, key, fn) { return v; } -},{"../../components/color":52,"../../components/drawing":74,"../../constants/alignment":154,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/cartesian/axes":223,"../../plots/cartesian/axis_defaults":225,"../../plots/cartesian/layout_attributes":237,"../../plots/cartesian/position_defaults":240,"./constants":340,"d3":16}],344:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../../constants/alignment":183,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/cartesian/axes":254,"../../plots/cartesian/axis_defaults":256,"../../plots/cartesian/layout_attributes":268,"../../plots/cartesian/position_defaults":271,"./constants":371,"d3":16}],375:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80558,6 +83151,10 @@ function directionAttrs(lineColorDefault) { module.exports = { + xperiod: scatterAttrs.xperiod, + xperiod0: scatterAttrs.xperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + x: { valType: 'data_array', editType: 'calc+clearAxisTypes', @@ -80640,7 +83237,7 @@ module.exports = { }), }; -},{"../../components/drawing/attributes":73,"../../components/fx/attributes":83,"../../constants/delta.js":155,"../../lib":179,"../scatter/attributes":366}],345:[function(_dereq_,module,exports){ +},{"../../components/drawing/attributes":102,"../../components/fx/attributes":112,"../../constants/delta.js":185,"../../lib":209,"../scatter/attributes":397}],376:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80654,6 +83251,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var _ = Lib._; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; function calc(gd, trace) { @@ -80663,10 +83261,12 @@ function calc(gd, trace) { var tickLen = convertTickWidth(gd, xa, trace); var minDiff = trace._minDiff; trace._minDiff = null; + var origX = trace._origX; + trace._origX = null; var x = trace._xcalc; trace._xcalc = null; - var cd = calcCommon(gd, trace, x, ya, ptFunc); + var cd = calcCommon(gd, trace, origX, x, ya, ptFunc); trace._extremes[xa._id] = Axes.findExtremes(xa, x, {vpad: minDiff / 2}); if(cd.length) { @@ -80692,7 +83292,7 @@ function ptFunc(o, h, l, c) { // shared between OHLC and candlestick // ptFunc makes a calcdata point specific to each trace type, from oi, hi, li, ci -function calcCommon(gd, trace, x, ya, ptFunc) { +function calcCommon(gd, trace, origX, x, ya, ptFunc) { var o = ya.makeCalcdata(trace, 'open'); var h = ya.makeCalcdata(trace, 'high'); var l = ya.makeCalcdata(trace, 'low'); @@ -80705,6 +83305,8 @@ function calcCommon(gd, trace, x, ya, ptFunc) { var increasing = true; var cPrev = null; + var hasPeriod = !!trace.xperiodalignment; + var cd = []; for(var i = 0; i < x.length; i++) { var xi = x[i]; @@ -80733,6 +83335,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) { pt.x = pt.pos; pt.y = [li, hi]; + if(hasPeriod) pt.orig_p = origX[i]; // used by hover if(hasTextArray) pt.tx = trace.text[i]; if(hasHovertextArray) pt.htx = trace.hovertext[i]; @@ -80764,7 +83367,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) { * in all traces; when a trace uses this in its * calc step it deletes _minDiff, so that next calc this is * done again in case the data changed. - * also since we need it here, stash _xcalc on the trace + * also since we need it here, stash _xcalc (and _origX) on the trace */ function convertTickWidth(gd, xa, trace) { var minDiff = trace._minDiff; @@ -80786,7 +83389,10 @@ function convertTickWidth(gd, xa, trace) { ) { ohlcTracesOnThisXaxis.push(tracei); - var xcalc = xa.makeCalcdata(tracei, 'x'); + var origX = xa.makeCalcdata(tracei, 'x'); + tracei._origX = origX; + + var xcalc = alignPeriod(trace, xa, 'x', origX); tracei._xcalc = xcalc; var _minDiff = Lib.distinctVals(xcalc).minDiff; @@ -80812,7 +83418,7 @@ module.exports = { calcCommon: calcCommon }; -},{"../../constants/numerical":158,"../../lib":179,"../../plots/cartesian/axes":223}],346:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"../../plots/cartesian/align_period":251,"../../plots/cartesian/axes":254}],377:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80826,6 +83432,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var handleOHLC = _dereq_('./ohlc_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -80839,6 +83446,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce, {x: true}); + coerce('line.width'); coerce('line.dash'); @@ -80858,7 +83467,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":179,"./attributes":344,"./ohlc_defaults":349}],347:[function(_dereq_,module,exports){ +},{"../../lib":209,"../scatter/period_defaults":417,"./attributes":375,"./ohlc_defaults":380}],378:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80949,7 +83558,7 @@ function getClosestPoint(pointData, xval, yval, hovermode) { pointData.x0 = xa.c2p(di.pos + centerShift - displayHalfWidth, true); pointData.x1 = xa.c2p(di.pos + centerShift + displayHalfWidth, true); - pointData.xLabelVal = di.pos; + pointData.xLabelVal = di.orig_p !== undefined ? di.orig_p : di.pos; pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; pointData.xSpike = xa.c2p(di.pos, true); @@ -81065,7 +83674,7 @@ module.exports = { hoverOnPoints: hoverOnPoints }; -},{"../../components/color":52,"../../components/fx":92,"../../constants/delta.js":155,"../../lib":179,"../../plots/cartesian/axes":223}],348:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/fx":121,"../../constants/delta.js":185,"../../lib":209,"../../plots/cartesian/axes":254}],379:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81094,7 +83703,7 @@ module.exports = { selectPoints: _dereq_('./select') }; -},{"../../plots/cartesian":236,"./attributes":344,"./calc":345,"./defaults":346,"./hover":347,"./plot":350,"./select":351,"./style":352}],349:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":267,"./attributes":375,"./calc":376,"./defaults":377,"./hover":378,"./plot":381,"./select":382,"./style":383}],380:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81129,7 +83738,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { return len; }; -},{"../../lib":179,"../../registry":265}],350:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296}],381:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81187,7 +83796,7 @@ module.exports = function plot(gd, plotinfo, cdOHLC, ohlcLayer) { }); }; -},{"../../lib":179,"d3":16}],351:[function(_dereq_,module,exports){ +},{"../../lib":209,"d3":16}],382:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81232,7 +83841,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],352:[function(_dereq_,module,exports){ +},{}],383:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81271,7 +83880,7 @@ module.exports = function style(gd, cd, sel) { }); }; -},{"../../components/color":52,"../../components/drawing":74,"d3":16}],353:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"d3":16}],384:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81542,7 +84151,7 @@ module.exports = { } }; -},{"../../components/color/attributes":51,"../../lib/extend":173,"../../plots/attributes":220,"../../plots/domain":250,"../../plots/font_attributes":251,"../../plots/template_attributes":264}],354:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../lib/extend":203,"../../plots/attributes":250,"../../plots/domain":281,"../../plots/font_attributes":282,"../../plots/template_attributes":295}],385:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81565,7 +84174,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":257}],355:[function(_dereq_,module,exports){ +},{"../../plots/plots":288}],386:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81748,7 +84357,7 @@ module.exports = { generateExtendedColors: generateExtendedColors }; -},{"../../components/color":52,"fast-isnumeric":18,"tinycolor2":35}],356:[function(_dereq_,module,exports){ +},{"../../components/color":81,"fast-isnumeric":18,"tinycolor2":64}],387:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81879,7 +84488,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":179,"../../plots/domain":250,"../bar/defaults":279,"./attributes":353,"fast-isnumeric":18}],357:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../plots/domain":281,"../bar/defaults":310,"./attributes":384,"fast-isnumeric":18}],388:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81928,7 +84537,7 @@ module.exports = function eventData(pt, trace) { return out; }; -},{"../../components/fx/helpers":88}],358:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":117}],389:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81941,19 +84550,21 @@ module.exports = function eventData(pt, trace) { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -81970,7 +84581,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":179}],359:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":209}],390:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82003,7 +84618,7 @@ module.exports = { } }; -},{"./attributes":353,"./base_plot":354,"./calc":355,"./defaults":356,"./layout_attributes":360,"./layout_defaults":361,"./plot":362,"./style":363,"./style_one":364}],360:[function(_dereq_,module,exports){ +},{"./attributes":384,"./base_plot":385,"./calc":386,"./defaults":387,"./layout_attributes":391,"./layout_defaults":392,"./plot":393,"./style":394,"./style_one":395}],391:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82036,7 +84651,7 @@ module.exports = { } }; -},{}],361:[function(_dereq_,module,exports){ +},{}],392:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82061,7 +84676,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendpiecolors'); }; -},{"../../lib":179,"./layout_attributes":360}],362:[function(_dereq_,module,exports){ +},{"../../lib":209,"./layout_attributes":391}],393:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82079,6 +84694,8 @@ var Fx = _dereq_('../../components/fx'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var uniformText = _dereq_('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; @@ -82308,9 +84925,9 @@ function plot(gd, cdModule) { } titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); // now make sure no labels overlap (at least within one pie) @@ -83109,7 +85726,7 @@ function setCoords(cd) { var cd0 = cd[0]; var r = cd0.r; var trace = cd0.trace; - var currentAngle = trace.rotation * Math.PI / 180; + var currentAngle = helpers.getRotationAngle(trace.rotation); var angleFactor = 2 * Math.PI / cd0.vTotal; var firstPt = 'px0'; var lastPt = 'px1'; @@ -83239,7 +85856,7 @@ module.exports = { computeTransform: computeTransform }; -},{"../../components/color":52,"../../components/drawing":74,"../../components/fx":92,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/plots":257,"../bar/constants":277,"../bar/uniform_text":291,"./event_data":357,"./helpers":358,"d3":16}],363:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../../components/fx":121,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/plots":288,"../bar/constants":308,"../bar/uniform_text":322,"./event_data":388,"./helpers":389,"d3":16}],394:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83272,7 +85889,7 @@ module.exports = function style(gd) { }); }; -},{"../bar/uniform_text":291,"./style_one":364,"d3":16}],364:[function(_dereq_,module,exports){ +},{"../bar/uniform_text":322,"./style_one":395,"d3":16}],395:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83296,7 +85913,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":52,"./helpers":358}],365:[function(_dereq_,module,exports){ +},{"../../components/color":81,"./helpers":389}],396:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83348,7 +85965,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":179}],366:[function(_dereq_,module,exports){ +},{"../../lib":209}],397:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83367,8 +85984,41 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + + editType: 'calc', + + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + + editType: 'calc', + + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + + editType: 'calc', + + }; +} + module.exports = { x: { valType: 'data_array', @@ -83415,6 +86065,13 @@ module.exports = { }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', @@ -83762,7 +86419,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":59,"../../components/drawing":74,"../../components/drawing/attributes":73,"../../lib/extend":173,"../../plots/font_attributes":251,"../../plots/template_attributes":264,"./constants":370}],367:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":88,"../../components/drawing":103,"../../components/drawing/attributes":102,"../../lib/extend":203,"../../plots/font_attributes":282,"../../plots/template_attributes":295,"./constants":401}],398:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83777,6 +86434,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -83788,8 +86446,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -83820,6 +86481,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -83827,6 +86491,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -84047,7 +86718,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":158,"../../lib":179,"../../plots/cartesian/axes":223,"./arrays_to_calcdata":365,"./calc_selection":368,"./colorscale_calc":369,"./subtypes":390,"fast-isnumeric":18}],368:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"../../plots/cartesian/align_period":251,"../../plots/cartesian/axes":254,"./arrays_to_calcdata":396,"./calc_selection":399,"./colorscale_calc":400,"./subtypes":422,"fast-isnumeric":18}],399:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84066,7 +86737,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":179}],369:[function(_dereq_,module,exports){ +},{"../../lib":209}],400:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84109,7 +86780,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":60,"../../components/colorscale/helpers":63,"./subtypes":390}],370:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":89,"../../components/colorscale/helpers":92,"./subtypes":422}],401:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84138,7 +86809,7 @@ module.exports = { eventDataKeys: [] }; -},{}],371:[function(_dereq_,module,exports){ +},{}],402:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84319,7 +86990,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":367}],372:[function(_dereq_,module,exports){ +},{"./calc":398}],403:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84358,7 +87029,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],373:[function(_dereq_,module,exports){ +},{}],404:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84376,6 +87047,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -84393,6 +87065,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -84448,7 +87122,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":179,"../../registry":265,"./attributes":366,"./constants":370,"./fillcolor_defaults":374,"./line_defaults":379,"./line_shape_defaults":381,"./marker_defaults":385,"./stack_defaults":388,"./subtypes":390,"./text_defaults":391,"./xy_defaults":392}],374:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296,"./attributes":397,"./constants":401,"./fillcolor_defaults":405,"./line_defaults":410,"./line_shape_defaults":412,"./marker_defaults":416,"./period_defaults":417,"./stack_defaults":420,"./subtypes":422,"./text_defaults":423,"./xy_defaults":424}],405:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84485,7 +87159,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":52,"../../lib":179}],375:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":209}],406:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84511,7 +87185,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":223}],376:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":254}],407:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84560,7 +87234,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":52,"./subtypes":390}],377:[function(_dereq_,module,exports){ +},{"../../components/color":81,"./subtypes":422}],408:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84641,8 +87315,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -84755,7 +87429,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":52,"../../components/fx":92,"../../lib":179,"../../registry":265,"./get_trace_color":376}],378:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/fx":121,"../../lib":209,"../../registry":296,"./get_trace_color":407}],409:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84801,7 +87475,7 @@ module.exports = { } }; -},{"../../plots/cartesian":236,"./arrays_to_calcdata":365,"./attributes":366,"./calc":367,"./cross_trace_calc":371,"./cross_trace_defaults":372,"./defaults":373,"./format_labels":375,"./hover":377,"./marker_colorbar":384,"./plot":386,"./select":387,"./style":389,"./subtypes":390}],379:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":267,"./arrays_to_calcdata":396,"./attributes":397,"./calc":398,"./cross_trace_calc":402,"./cross_trace_defaults":403,"./defaults":404,"./format_labels":406,"./hover":408,"./marker_colorbar":415,"./plot":418,"./select":419,"./style":421,"./subtypes":422}],410:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84832,7 +87506,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"../../lib":179}],380:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92,"../../lib":209}],411:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85293,7 +87967,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":158,"../../lib":179,"./constants":370}],381:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"./constants":401}],412:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85312,7 +87986,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],382:[function(_dereq_,module,exports){ +},{}],413:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85402,7 +88076,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],383:[function(_dereq_,module,exports){ +},{}],414:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85444,7 +88118,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":18}],384:[function(_dereq_,module,exports){ +},{"fast-isnumeric":18}],415:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85462,7 +88136,7 @@ module.exports = { max: 'cmax' }; -},{}],385:[function(_dereq_,module,exports){ +},{}],416:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85543,7 +88217,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"./subtypes":390}],386:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92,"./subtypes":422}],417:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":188,"../../lib":209}],418:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86104,7 +88825,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":74,"../../lib":179,"../../lib/polygon":191,"../../registry":265,"./line_points":380,"./link_traces":382,"./subtypes":390,"d3":16}],387:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../lib":209,"../../lib/polygon":221,"../../registry":296,"./line_points":411,"./link_traces":413,"./subtypes":422,"d3":16}],419:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86158,7 +88879,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":390}],388:[function(_dereq_,module,exports){ +},{"./subtypes":422}],420:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86263,7 +88984,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],389:[function(_dereq_,module,exports){ +},{}],421:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86334,7 +89055,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":74,"../../registry":265,"d3":16}],390:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../registry":296,"d3":16}],422:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86373,7 +89094,7 @@ module.exports = { } }; -},{"../../lib":179}],391:[function(_dereq_,module,exports){ +},{"../../lib":209}],423:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86403,7 +89124,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":179}],392:[function(_dereq_,module,exports){ +},{"../../lib":209}],424:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86447,7 +89168,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":179,"../../registry":265}],393:[function(_dereq_,module,exports){ +},{"../../lib":209,"../../registry":296}],425:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86519,6 +89240,13 @@ module.exports = { y0: barAttrs.y0, dy: barAttrs.dy, + xperiod: barAttrs.xperiod, + yperiod: barAttrs.yperiod, + xperiod0: barAttrs.xperiod0, + yperiod0: barAttrs.yperiod0, + xperiodalignment: barAttrs.xperiodalignment, + yperiodalignment: barAttrs.yperiodalignment, + hovertext: barAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys @@ -86591,7 +89319,7 @@ module.exports = { alignmentgroup: barAttrs.alignmentgroup }; -},{"../../components/color":52,"../../lib/extend":173,"../../plots/attributes":220,"../../plots/template_attributes":264,"../bar/attributes":275,"../scatter/attributes":366,"./constants":395}],394:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib/extend":203,"../../plots/attributes":250,"../../plots/template_attributes":295,"../bar/attributes":306,"../scatter/attributes":397,"./constants":427}],426:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86603,6 +89331,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var mergeArray = _dereq_('../../lib').mergeArray; var calcSelection = _dereq_('../scatter/calc_selection'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -86618,14 +89347,19 @@ function isTotal(a) { module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -86679,6 +89413,10 @@ module.exports = function calc(gd, trace) { hasTotals = true; } + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cdi.id = String(trace.ids[i]); } @@ -86695,7 +89433,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":158,"../../lib":179,"../../plots/cartesian/axes":223,"../scatter/calc_selection":368}],395:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":209,"../../plots/cartesian/align_period":251,"../../plots/cartesian/axes":254,"../scatter/calc_selection":399}],427:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86714,7 +89452,7 @@ module.exports = { ] }; -},{}],396:[function(_dereq_,module,exports){ +},{}],428:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86787,7 +89525,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../bar/cross_trace_calc":278}],397:[function(_dereq_,module,exports){ +},{"../bar/cross_trace_calc":309}],429:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86803,6 +89541,7 @@ var Lib = _dereq_('../../lib'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var handleText = _dereq_('../bar/defaults').handleText; var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); var Color = _dereq_('../../components/color'); var delta = _dereq_('../../constants/delta.js'); @@ -86828,6 +89567,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('measure'); coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); @@ -86893,7 +89634,7 @@ module.exports = { crossTraceDefaults: crossTraceDefaults }; -},{"../../components/color":52,"../../constants/delta.js":155,"../../lib":179,"../bar/defaults":279,"../scatter/xy_defaults":392,"./attributes":393}],398:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../constants/delta.js":185,"../../lib":209,"../bar/defaults":310,"../scatter/period_defaults":417,"../scatter/xy_defaults":424,"./attributes":425}],430:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86920,7 +89661,7 @@ module.exports = function eventData(out, pt /* , trace, cd, pointNumber */) { return out; }; -},{}],399:[function(_dereq_,module,exports){ +},{}],431:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87015,7 +89756,7 @@ function getTraceColor(trace, di) { else if(opacity(mlc) && mlw) return mlc; } -},{"../../components/color":52,"../../constants/delta.js":155,"../../plots/cartesian/axes":223,"../bar/hover":282}],400:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../constants/delta.js":185,"../../plots/cartesian/axes":254,"../bar/hover":313}],432:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87050,7 +89791,7 @@ module.exports = { } }; -},{"../../plots/cartesian":236,"../bar/select":287,"./attributes":393,"./calc":394,"./cross_trace_calc":396,"./defaults":397,"./event_data":398,"./hover":399,"./layout_attributes":401,"./layout_defaults":402,"./plot":403,"./style":404}],401:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":267,"../bar/select":318,"./attributes":425,"./calc":426,"./cross_trace_calc":428,"./defaults":429,"./event_data":430,"./hover":431,"./layout_attributes":433,"./layout_defaults":434,"./plot":435,"./style":436}],433:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87089,7 +89830,7 @@ module.exports = { } }; -},{}],402:[function(_dereq_,module,exports){ +},{}],434:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87126,7 +89867,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":179,"./layout_attributes":401}],403:[function(_dereq_,module,exports){ +},{"../../lib":209,"./layout_attributes":433}],435:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87257,7 +89998,7 @@ function getXY(di, xa, ya, isHorizontal) { return isHorizontal ? [s, p] : [p, s]; } -},{"../../components/drawing":74,"../../constants/numerical":158,"../../lib":179,"../bar/plot":286,"../bar/uniform_text":291,"d3":16}],404:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../constants/numerical":188,"../../lib":209,"../bar/plot":317,"../bar/uniform_text":322,"d3":16}],436:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87318,7 +90059,7 @@ module.exports = { style: style }; -},{"../../components/color":52,"../../components/drawing":74,"../../constants/interactions":157,"../bar/style":289,"../bar/uniform_text":291,"d3":16}],405:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../../constants/interactions":187,"../bar/style":320,"../bar/uniform_text":322,"d3":16}],437:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87330,7 +90071,7 @@ module.exports = { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[8])(8) }); diff --git a/dist/plotly-finance.min.js b/dist/plotly-finance.min.js index ec02ea99b0f..861a45f1ebd 100644 --- a/dist/plotly-finance.min.js +++ b/dist/plotly-finance.min.js @@ -1,10 +1,10 @@ /** -* plotly.js (finance - minified) v1.55.2 +* plotly.js (finance - minified) v1.58.0 * Copyright 2012-2020, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=e()}}((function(){return function e(t,r,n){function a(o,l){if(!r[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":179}],2:[function(e,t,r){"use strict";t.exports=e("../src/traces/bar")},{"../src/traces/bar":283}],3:[function(e,t,r){"use strict";t.exports=e("../src/traces/candlestick")},{"../src/traces/candlestick":301}],4:[function(e,t,r){"use strict";t.exports=e("../src/core")},{"../src/core":160}],5:[function(e,t,r){"use strict";t.exports=e("../src/traces/funnel")},{"../src/traces/funnel":310}],6:[function(e,t,r){"use strict";t.exports=e("../src/traces/funnelarea")},{"../src/traces/funnelarea":319}],7:[function(e,t,r){"use strict";t.exports=e("../src/traces/histogram")},{"../src/traces/histogram":335}],8:[function(e,t,r){"use strict";var n=e("./core");n.register([e("./bar"),e("./histogram"),e("./pie"),e("./funnelarea"),e("./ohlc"),e("./candlestick"),e("./funnel"),e("./waterfall"),e("./indicator")]),t.exports=n},{"./bar":2,"./candlestick":3,"./core":4,"./funnel":5,"./funnelarea":6,"./histogram":7,"./indicator":9,"./ohlc":10,"./pie":11,"./waterfall":12}],9:[function(e,t,r){"use strict";t.exports=e("../src/traces/indicator")},{"../src/traces/indicator":342}],10:[function(e,t,r){"use strict";t.exports=e("../src/traces/ohlc")},{"../src/traces/ohlc":348}],11:[function(e,t,r){"use strict";t.exports=e("../src/traces/pie")},{"../src/traces/pie":359}],12:[function(e,t,r){"use strict";t.exports=e("../src/traces/waterfall")},{"../src/traces/waterfall":400}],13:[function(e,t,r){var n=Object.create||function(e){var t=function(){};return t.prototype=e,new t},a=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},i=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var l,s=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),l=0===c.x}catch(e){l=!1}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r){if(t)e.call(r);else for(var n=e.length,a=_(e,n),i=0;i0&&l.length>i){l.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else l=o[t]=r,++e._eventsCount;return e}function m(){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 e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var s=new Error('Unhandled "error" event. ('+t+")");throw s.context=t,s}if(!(r=o[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:f(r,c,this);break;case 2:d(r,c,this,arguments[1]);break;case 3:p(r,c,this,arguments[1],arguments[2]);break;case 4:h(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(a=new Array(n-1),i=1;i=0;o--)if(r[o]===t||r[o].listener===t){l=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(var r=t,n=r+1,a=e.length;n=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return x(this,e,!0)},o.prototype.rawListeners=function(e){return x(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},o.prototype.listenerCount=b,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],14:[function(e,t,r){!function(n,a){"object"==typeof r&&"undefined"!=typeof t?a(r,e("d3-time")):a((n=n||self).d3=n.d3||{},n.d3)}(this,(function(e,t){"use strict";function r(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function n(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function a(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,o=e.date,s=e.time,c=e.periods,u=e.days,f=e.shortDays,d=e.months,ye=e.shortMonths,xe=p(c),be=h(c),_e=p(u),we=h(u),Te=p(f),ke=h(f),Me=p(d),Ae=h(d),Le=p(ye),Se=h(ye),Ce={a:function(e){return f[e.getDay()]},A:function(e){return u[e.getDay()]},b:function(e){return ye[e.getMonth()]},B:function(e){return d[e.getMonth()]},c:null,d:R,e:R,f:B,H:I,I:F,j:N,L:H,m:j,M:V,p:function(e){return c[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:ve,s:me,S:U,u:q,U:G,V:Z,w:Y,W:X,x:null,X:null,y:W,Y:Q,Z:J,"%":ge},Oe={a:function(e){return f[e.getUTCDay()]},A:function(e){return u[e.getUTCDay()]},b:function(e){return ye[e.getUTCMonth()]},B:function(e){return d[e.getUTCMonth()]},c:null,d:$,e:$,f:ne,H:K,I:ee,j:te,L:re,m:ae,M:ie,p:function(e){return c[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:ve,s:me,S:oe,u:le,U:se,V:ce,w:ue,W:fe,x:null,X:null,y:de,Y:pe,Z:he,"%":ge},De={a:function(e,t,r){var n=Te.exec(t.slice(r));return n?(e.w=ke[n[0].toLowerCase()],r+n[0].length):-1},A:function(e,t,r){var n=_e.exec(t.slice(r));return n?(e.w=we[n[0].toLowerCase()],r+n[0].length):-1},b:function(e,t,r){var n=Le.exec(t.slice(r));return n?(e.m=Se[n[0].toLowerCase()],r+n[0].length):-1},B:function(e,t,r){var n=Me.exec(t.slice(r));return n?(e.m=Ae[n[0].toLowerCase()],r+n[0].length):-1},c:function(e,t,r){return Ee(e,i,t,r)},d:M,e:M,f:D,H:L,I:L,j:A,L:O,m:k,M:S,p:function(e,t,r){var n=xe.exec(t.slice(r));return n?(e.p=be[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:z,s:E,S:C,u:v,U:m,V:y,w:g,W:x,x:function(e,t,r){return Ee(e,o,t,r)},X:function(e,t,r){return Ee(e,s,t,r)},y:_,Y:b,Z:w,"%":P};function Pe(e,t){return function(r){var n,a,i,o=[],s=-1,c=0,u=e.length;for(r instanceof Date||(r=new Date(+r));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(l=n(a(c.y,0,1))).getUTCDay(),l=s>4||0===s?t.utcMonday.ceil(l):t.utcMonday(l),l=t.utcDay.offset(l,7*(c.V-1)),c.y=l.getUTCFullYear(),c.m=l.getUTCMonth(),c.d=l.getUTCDate()+(c.w+6)%7):(s=(l=r(a(c.y,0,1))).getDay(),l=s>4||0===s?t.timeMonday.ceil(l):t.timeMonday(l),l=t.timeDay.offset(l,7*(c.V-1)),c.y=l.getFullYear(),c.m=l.getMonth(),c.d=l.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?n(a(c.y,0,1)).getUTCDay():r(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Ee(e,t,r,n){for(var a,i,o=0,s=t.length,c=r.length;o=c)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=De[a in l?t.charAt(o++):a])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ce.x=Pe(o,Ce),Ce.X=Pe(s,Ce),Ce.c=Pe(i,Ce),Oe.x=Pe(o,Oe),Oe.X=Pe(s,Oe),Oe.c=Pe(i,Oe),{format:function(e){var t=Pe(e+="",Ce);return t.toString=function(){return e},t},parse:function(e){var t=ze(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=Pe(e+="",Oe);return t.toString=function(){return e},t},utcParse:function(e){var t=ze(e+="",!0);return t.toString=function(){return e},t}}}var o,l={"-":"",_:" ",0:"0"},s=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(e,t,r){var n=s.exec(t.slice(r,r+1));return n?(e.q=3*n[0]-3,r+n[0].length):-1}function k(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function M(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function A(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function L(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function S(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function C(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function O(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function D(e,t,r){var n=s.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function P(e,t,r){var n=c.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function z(e,t,r){var n=s.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function E(e,t,r){var n=s.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function R(e,t){return f(e.getDate(),t,2)}function I(e,t){return f(e.getHours(),t,2)}function F(e,t){return f(e.getHours()%12||12,t,2)}function N(e,r){return f(1+t.timeDay.count(t.timeYear(e),e),r,3)}function H(e,t){return f(e.getMilliseconds(),t,3)}function B(e,t){return H(e,t)+"000"}function j(e,t){return f(e.getMonth()+1,t,2)}function V(e,t){return f(e.getMinutes(),t,2)}function U(e,t){return f(e.getSeconds(),t,2)}function q(e){var t=e.getDay();return 0===t?7:t}function G(e,r){return f(t.timeSunday.count(t.timeYear(e)-1,e),r,2)}function Z(e,r){var n=e.getDay();return e=n>=4||0===n?t.timeThursday(e):t.timeThursday.ceil(e),f(t.timeThursday.count(t.timeYear(e),e)+(4===t.timeYear(e).getDay()),r,2)}function Y(e){return e.getDay()}function X(e,r){return f(t.timeMonday.count(t.timeYear(e)-1,e),r,2)}function W(e,t){return f(e.getFullYear()%100,t,2)}function Q(e,t){return f(e.getFullYear()%1e4,t,4)}function J(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+f(t/60|0,"0",2)+f(t%60,"0",2)}function $(e,t){return f(e.getUTCDate(),t,2)}function K(e,t){return f(e.getUTCHours(),t,2)}function ee(e,t){return f(e.getUTCHours()%12||12,t,2)}function te(e,r){return f(1+t.utcDay.count(t.utcYear(e),e),r,3)}function re(e,t){return f(e.getUTCMilliseconds(),t,3)}function ne(e,t){return re(e,t)+"000"}function ae(e,t){return f(e.getUTCMonth()+1,t,2)}function ie(e,t){return f(e.getUTCMinutes(),t,2)}function oe(e,t){return f(e.getUTCSeconds(),t,2)}function le(e){var t=e.getUTCDay();return 0===t?7:t}function se(e,r){return f(t.utcSunday.count(t.utcYear(e)-1,e),r,2)}function ce(e,r){var n=e.getUTCDay();return e=n>=4||0===n?t.utcThursday(e):t.utcThursday.ceil(e),f(t.utcThursday.count(t.utcYear(e),e)+(4===t.utcYear(e).getUTCDay()),r,2)}function ue(e){return e.getUTCDay()}function fe(e,r){return f(t.utcMonday.count(t.utcYear(e)-1,e),r,2)}function de(e,t){return f(e.getUTCFullYear()%100,t,2)}function pe(e,t){return f(e.getUTCFullYear()%1e4,t,4)}function he(){return"+0000"}function ge(){return"%"}function ve(e){return+e}function me(e){return Math.floor(+e/1e3)}function ye(t){return o=i(t),e.timeFormat=o.format,e.timeParse=o.parse,e.utcFormat=o.utcFormat,e.utcParse=o.utcParse,o}ye({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xe=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var be=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=xe,e.isoParse=be,e.timeFormatDefaultLocale=ye,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})}))},{"d3-time":15}],15:[function(e,t,r){!function(e,n){"object"==typeof r&&"undefined"!=typeof t?n(r):n((e=e||self).d3=e.d3||{})}(this,(function(e){"use strict";var t=new Date,r=new Date;function n(e,a,i,o){function l(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return l.floor=function(t){return e(t=new Date(+t)),t},l.ceil=function(t){return e(t=new Date(t-1)),a(t,1),e(t),t},l.round=function(e){var t=l(e),r=l.ceil(e);return e-t0))return o;do{o.push(i=new Date(+t)),a(t,n),e(t)}while(i=r)for(;e(r),!t(r);)r.setTime(r-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;a(e,-1),!t(e););else for(;--r>=0;)for(;a(e,1),!t(e););}))},i&&(l.count=function(n,a){return t.setTime(+n),r.setTime(+a),e(t),e(r),Math.floor(i(t,r))},l.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?l.filter(o?function(t){return o(t)%e==0}:function(t){return l.count(0,t)%e==0}):l:null}),l}var a=n((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?n((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,r){t.setTime(+t+r*e)}),(function(t,r){return(r-t)/e})):a:null};var i=a.range,o=n((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()})),l=o.range,s=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()})),c=s.range,u=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()})),f=u.range,d=n((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1})),p=d.range;function h(e){return n((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var g=h(0),v=h(1),m=h(2),y=h(3),x=h(4),b=h(5),_=h(6),w=g.range,T=v.range,k=m.range,M=y.range,A=x.range,L=b.range,S=_.range,C=n((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),O=C.range,D=n((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));D.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,r){t.setFullYear(t.getFullYear()+r*e)})):null};var P=D.range,z=n((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()})),E=z.range,R=n((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()})),I=R.range,F=n((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1})),N=F.range;function H(e){return n((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var B=H(0),j=H(1),V=H(2),U=H(3),q=H(4),G=H(5),Z=H(6),Y=B.range,X=j.range,W=V.range,Q=U.range,J=q.range,$=G.range,K=Z.range,ee=n((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),te=ee.range,re=n((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));re.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,r){t.setUTCFullYear(t.getUTCFullYear()+r*e)})):null};var ne=re.range;e.timeDay=d,e.timeDays=p,e.timeFriday=b,e.timeFridays=L,e.timeHour=u,e.timeHours=f,e.timeInterval=n,e.timeMillisecond=a,e.timeMilliseconds=i,e.timeMinute=s,e.timeMinutes=c,e.timeMonday=v,e.timeMondays=T,e.timeMonth=C,e.timeMonths=O,e.timeSaturday=_,e.timeSaturdays=S,e.timeSecond=o,e.timeSeconds=l,e.timeSunday=g,e.timeSundays=w,e.timeThursday=x,e.timeThursdays=A,e.timeTuesday=m,e.timeTuesdays=k,e.timeWednesday=y,e.timeWednesdays=M,e.timeWeek=g,e.timeWeeks=w,e.timeYear=D,e.timeYears=P,e.utcDay=F,e.utcDays=N,e.utcFriday=G,e.utcFridays=$,e.utcHour=R,e.utcHours=I,e.utcMillisecond=a,e.utcMilliseconds=i,e.utcMinute=z,e.utcMinutes=E,e.utcMonday=j,e.utcMondays=X,e.utcMonth=ee,e.utcMonths=te,e.utcSaturday=Z,e.utcSaturdays=K,e.utcSecond=o,e.utcSeconds=l,e.utcSunday=B,e.utcSundays=Y,e.utcThursday=q,e.utcThursdays=J,e.utcTuesday=V,e.utcTuesdays=W,e.utcWednesday=U,e.utcWednesdays=Q,e.utcWeek=B,e.utcWeeks=Y,e.utcYear=re,e.utcYears=ne,Object.defineProperty(e,"__esModule",{value:!0})}))},{}],16:[function(e,t,r){!function(){var e={version:"3.5.17"},r=[].slice,n=function(e){return r.call(e)},a=this.document;function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(e){n=function(e){for(var t=e.length,r=new Array(t);t--;)r[t]=e[t];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(e,t){s.call(this,e,t+"")},l.setAttributeNS=function(e,t,r){c.call(this,e,t,r+"")},u.setProperty=function(e,t,r){f.call(this,e,t+"",r)}}function d(e,t){return et?1:e>=t?0:NaN}function p(e){return null===e?NaN:+e}function h(e){return!isNaN(e)}function g(e){return{left:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)<0?n=i+1:a=i}return n},right:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)>0?a=i:n=i+1}return n}}}e.ascending=d,e.descending=function(e,t){return te?1:t>=e?0:NaN},e.min=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},e.max=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},e.extent=function(e,t){var r,n,a,i=-1,o=e.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var v=g(d);function m(e){return e.length}e.bisectLeft=v.left,e.bisect=e.bisectRight=v.right,e.bisector=function(e){return g(1===e.length?function(t,r){return d(e(t),r)}:e)},e.shuffle=function(e,t,r){(i=arguments.length)<3&&(r=e.length,i<2&&(t=0));for(var n,a,i=r-t;i;)a=Math.random()*i--|0,n=e[i+t],e[i+t]=e[a+t],e[a+t]=n;return e},e.permute=function(e,t){for(var r=t.length,n=new Array(r);r--;)n[r]=e[t[r]];return n},e.pairs=function(e){for(var t=0,r=e.length-1,n=e[0],a=new Array(r<0?0:r);t=0;)for(t=(n=e[a]).length;--t>=0;)r[--o]=n[t];return r};var y=Math.abs;function x(e){for(var t=1;e*t%1;)t*=10;return t}function b(e,t){for(var r in t)Object.defineProperty(e.prototype,r,{value:t[r],enumerable:!1})}function _(){this._=Object.create(null)}e.range=function(e,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=e,e=0)),(t-e)/r==1/0)throw new Error("infinite range");var n,a=[],i=x(y(r)),o=-1;if(e*=i,t*=i,(r*=i)<0)for(;(n=e+r*++o)>t;)a.push(n/i);else for(;(n=e+r*++o)=a.length)return r?r.call(n,i):t?i.sort(t):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return t;var n=[],o=i[r++];return t.forEach((function(t,a){n.push({key:t,values:e(a,r)})})),o?n.sort((function(e,t){return o(e.key,t.key)})):n}(o(e.map,t,0),0)},n.key=function(e){return a.push(e),n},n.sortKeys=function(e){return i[a.length-1]=e,n},n.sortValues=function(e){return t=e,n},n.rollup=function(e){return r=e,n},n},e.set=function(e){var t=new C;if(e)for(var r=0,n=e.length;r=0&&(n=e.slice(r+1),e=e.slice(0,r)),e)return arguments.length<2?this[e].on(n):this[e].on(n,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(n,null);return this}},e.event=null,e.requote=function(e){return e.replace(B,"\\$&")};var B=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,j={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)e[r]=t[r]};function V(e){return j(e,Z),e}var U=function(e,t){return t.querySelector(e)},q=function(e,t){return t.querySelectorAll(e)},G=function(e,t){var r=e.matches||e[P(e,"matchesSelector")];return(G=function(e,t){return r.call(e,t)})(e,t)};"function"==typeof Sizzle&&(U=function(e,t){return Sizzle(e,t)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),e.selection=function(){return e.select(a.documentElement)};var Z=e.selection.prototype=[];function Y(e){return"function"==typeof e?e:function(){return U(e,this)}}function X(e){return"function"==typeof e?e:function(){return q(e,this)}}Z.select=function(e){var t,r,n,a,i=[];e=Y(e);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=e.slice(0,t))&&(e=e.slice(t+1)),Q.hasOwnProperty(r)?{space:Q[r],local:e}:e}},Z.attr=function(t,r){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=e.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(r in t)this.each(J(r,t[r]));return this}return this.each(J(t,r))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node(),n=(e=ee(e)).length,a=-1;if(t=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(e){e=ce.apply(this,arguments);for(var t=-1,r=this.length;++t=t&&(t=a+1);!(o=l[t])&&++t0&&(t=t.slice(0,o));var s=ge.get(t);function c(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return s&&(t=s,l=me),o?r?function(){var e=l(r,n(arguments));c.call(this),this.addEventListener(t,this[i]=e,e.$=a),e._=r}:c:r?E:function(){var r,n=new RegExp("^__on([^.]+)"+e.requote(t)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}e.selection.enter=fe,e.selection.enter.prototype=de,de.append=Z.append,de.empty=Z.empty,de.node=Z.node,de.call=Z.call,de.size=Z.size,de.select=function(e){for(var t,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:e<0?-1:0}function ze(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(t[1]-e[1])*(r[0]-e[0])}function Ee(e){return e>1?0:e<-1?Ae:Math.acos(e)}function Re(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function Ie(e){return((e=Math.exp(e))+1/e)/2}function Fe(e){return(e=Math.sin(e/2))*e}var Ne=Math.SQRT2;e.interpolateZoom=function(e,t){var r,n,a=e[0],i=e[1],o=e[2],l=t[0],s=t[1],c=t[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(t=t.transition().duration(g)),t.call(w.event)}function L(){c&&c.domain(s.range().map((function(e){return(e-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(e){return(e-d.y)/d.k})).map(u.invert))}function S(e){v++||e({type:"zoomstart"})}function C(e){L(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function O(e){--v||(e({type:"zoomend"}),r=null)}function D(){var t=this,r=_.of(t,arguments),n=0,a=e.select(o(t)).on(y,s).on(x,c),i=T(e.mouse(t)),l=be(t);function s(){n=1,M(e.mouse(t),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),O(r)}ml.call(t),S(r)}function P(){var t,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+e.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=e.select(r),p=be(r);function h(){var n=e.touches(r);return t=d.k,n.forEach((function(e){e.identifier in a&&(a[e.identifier]=T(e))})),n}function g(){var t=e.event.target;e.select(t).on(s,v).on(c,y),u.push(t);for(var n=e.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=e.touches(r);ml.call(r);for(var d=0,p=f.length;d360?e-=360:e<0&&(e+=360),e<60?n+(a-n)*e/60:e<180?a:e<240?n+(a-n)*(240-e)/60:n}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+t):r+t-r*t),new nt(i(e+120),i(e),i(e-120))}function Ze(t,r,n){return this instanceof Ze?(this.h=+t,this.c=+r,void(this.l=+n)):arguments.length<2?t instanceof Ze?new Ze(t.h,t.c,t.l):Ke(t instanceof We?t.l:(t=ut((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Ze(t,r,n)}qe.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new Ue(this.h,this.s,this.l/e)},qe.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new Ue(this.h,this.s,e*this.l)},qe.rgb=function(){return Ge(this.h,this.s,this.l)},e.hcl=Ze;var Ye=Ze.prototype=new Ve;function Xe(e,t,r){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new We(r,Math.cos(e*=Oe)*t,Math.sin(e)*t)}function We(e,t,r){return this instanceof We?(this.l=+e,this.a=+t,void(this.b=+r)):arguments.length<2?e instanceof We?new We(e.l,e.a,e.b):e instanceof Ze?Xe(e.h,e.c,e.l):ut((e=nt(e)).r,e.g,e.b):new We(e,t,r)}Ye.brighter=function(e){return new Ze(this.h,this.c,Math.min(100,this.l+Qe*(arguments.length?e:1)))},Ye.darker=function(e){return new Ze(this.h,this.c,Math.max(0,this.l-Qe*(arguments.length?e:1)))},Ye.rgb=function(){return Xe(this.h,this.c,this.l).rgb()},e.lab=We;var Qe=18,Je=We.prototype=new Ve;function $e(e,t,r){var n=(e+16)/116,a=n+t/500,i=n-r/200;return new nt(rt(3.2404542*(a=.95047*et(a))-1.5371385*(n=1*et(n))-.4985314*(i=1.08883*et(i))),rt(-.969266*a+1.8760108*n+.041556*i),rt(.0556434*a-.2040259*n+1.0572252*i))}function Ke(e,t,r){return e>0?new Ze(Math.atan2(r,t)*De,Math.sqrt(t*t+r*r),e):new Ze(NaN,NaN,e)}function et(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function tt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function rt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function nt(e,t,r){return this instanceof nt?(this.r=~~e,this.g=~~t,void(this.b=~~r)):arguments.length<2?e instanceof nt?new nt(e.r,e.g,e.b):st(""+e,nt,Ge):new nt(e,t,r)}function at(e){return new nt(e>>16,e>>8&255,255&e)}function it(e){return at(e)+""}Je.brighter=function(e){return new We(Math.min(100,this.l+Qe*(arguments.length?e:1)),this.a,this.b)},Je.darker=function(e){return new We(Math.max(0,this.l-Qe*(arguments.length?e:1)),this.a,this.b)},Je.rgb=function(){return $e(this.l,this.a,this.b)},e.rgb=nt;var ot=nt.prototype=new Ve;function lt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function st(e,t,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return t(dt(a[0]),dt(a[1]),dt(a[2]))}return(i=pt.get(e))?t(i.r,i.g,i.b):(null==e||"#"!==e.charAt(0)||isNaN(i=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===e.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),t(o,l,s))}function ct(e,t,r){var n,a,i=Math.min(e/=255,t/=255,r/=255),o=Math.max(e,t,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=e==o?(t-r)/l+(t0&&s<1?0:n),new Ue(n,a,s)}function ut(e,t,r){var n=tt((.4124564*(e=ft(e))+.3575761*(t=ft(t))+.1804375*(r=ft(r)))/.95047),a=tt((.2126729*e+.7151522*t+.072175*r)/1);return We(116*a-16,500*(n-a),200*(a-tt((.0193339*e+.119192*t+.9503041*r)/1.08883)))}function ft(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ot.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,r=this.g,n=this.b,a=30;return t||r||n?(t&&t=200&&t<300||304===t){try{e=a.call(o,c)}catch(e){return void l.error.call(o,e)}l.load.call(o,e)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var r=e.event;e.event=t;try{l.progress.call(o,c)}finally{e.event=r}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(r=null==e?null:e+"",o):r},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return a=e,o},["get","post"].forEach((function(e){o[e]=function(){return o.send.apply(o,[e].concat(n(arguments)))}})),o.send=function(e,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(e,t,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(e){a(null,e)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},e.rebind(o,l,"on"),null==i?o:o.get(function(e){return 1===e.length?function(t,r){e(null==t?r:null)}:e}(i))}pt.forEach((function(e,t){pt.set(e,at(t))})),e.functor=ht,e.xhr=gt(O),e.dsv=function(e,t){var r=new RegExp('["'+e+"\n]"),n=e.charCodeAt(0);function a(e,r,n){arguments.length<3&&(n=r,r=null);var a=vt(e,t,null==r?i:o(r),n);return a.row=function(e){return arguments.length?a.response(null==(r=e)?i:o(e)):r},a}function i(e){return a.parse(e.responseText)}function o(e){return function(t){return a.parse(t.responseText,e)}}function l(t){return t.map(s).join(e)}function s(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return a.parse=function(e,t){var r;return a.parseRows(e,(function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");r=t?function(e,r){return t(a(e),r)}:a}))},a.parseRows=function(e,t){var r,a,i={},o={},l=[],s=e.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var t=c;if(34===e.charCodeAt(t)){for(var r=t;r++24?(isFinite(t)&&(clearTimeout(bt),bt=setTimeout(Tt,t)),xt=0):(xt=1,_t(Tt))}function kt(){for(var e=Date.now(),t=mt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Mt(){for(var e,t=mt,r=1/0;t;)t.c?(t.t8?function(e){return e/r}:function(e){return e*r},symbol:e}}));function St(t){var r=t.decimal,n=t.thousands,a=t.grouping,i=t.currency,o=a&&n?function(e,t){for(var r=e.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>t&&(l=Math.max(1,t-s)),i.push(e.substring(r-=l,r+l)),!((s+=l+1)>t));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:O;return function(t){var n=Ct.exec(t),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Ot.get(h)||Dt;var b=u&&d;return function(t){var n=m;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(g<0){var c=e.formatPrefix(t,p);t=c.scale(t),n=c.symbol+m}else t*=g;var _,w,T=(t=h(t,p)).lastIndexOf(".");if(T<0){var k=x?t.lastIndexOf("e"):-1;k<0?(_=t,w=""):(_=t.substring(0,k),w=t.substring(k))}else _=t.substring(0,T),w=r+t.substring(T+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+t:"^"===l?A.substring(0,M>>=1)+i+t+A.substring(M):i+(b?t:A+t))+n}}}e.formatPrefix=function(t,r){var n=0;return(t=+t)&&(t<0&&(t*=-1),r&&(t=e.round(t,At(t,r))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Lt[8+n/3]};var Ct=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ot=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,r){return(t=e.round(t,At(t,r))).toFixed(Math.max(0,Math.min(20,At(t*(1+1e-15),r))))}});function Dt(e){return e+""}var Pt=e.time={},zt=Date;function Et(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Et.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(){Rt.setUTCDate.apply(this._,arguments)},setDay:function(){Rt.setUTCDay.apply(this._,arguments)},setFullYear:function(){Rt.setUTCFullYear.apply(this._,arguments)},setHours:function(){Rt.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Rt.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Rt.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Rt.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Rt.setUTCSeconds.apply(this._,arguments)},setTime:function(){Rt.setTime.apply(this._,arguments)}};var Rt=Date.prototype;function It(e,t,r){function n(t){var r=e(t),n=i(r,1);return t-r1)for(;o=c)return-1;if(37===(a=t.charCodeAt(l++))){if(o=t.charAt(l++),!(i=w[o in Ht?t.charAt(l++):o])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(e){var t=u(e);function r(e){try{var r=new(zt=Et);return r._=e,t(r)}finally{zt=Date}}return r.parse=function(e){try{zt=Et;var r=t.parse(e);return r&&r._}finally{zt=Date}},r.toString=t.toString,r},u.multi=u.utc.multi=or;var d=e.map(),p=Ut(o),h=qt(o),g=Ut(l),v=qt(l),m=Ut(s),y=qt(s),x=Ut(c),b=qt(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var _={a:function(e){return l[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:u(r),d:function(e,t){return Vt(e.getDate(),t,2)},e:function(e,t){return Vt(e.getDate(),t,2)},H:function(e,t){return Vt(e.getHours(),t,2)},I:function(e,t){return Vt(e.getHours()%12||12,t,2)},j:function(e,t){return Vt(1+Pt.dayOfYear(e),t,3)},L:function(e,t){return Vt(e.getMilliseconds(),t,3)},m:function(e,t){return Vt(e.getMonth()+1,t,2)},M:function(e,t){return Vt(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Vt(e.getSeconds(),t,2)},U:function(e,t){return Vt(Pt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Vt(Pt.mondayOfYear(e),t,2)},x:u(n),X:u(a),y:function(e,t){return Vt(e.getFullYear()%100,t,2)},Y:function(e,t){return Vt(e.getFullYear()%1e4,t,4)},Z:ar,"%":function(){return"%"}},w={a:function(e,t,r){g.lastIndex=0;var n=g.exec(t.slice(r));return n?(e.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){p.lastIndex=0;var n=p.exec(t.slice(r));return n?(e.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){x.lastIndex=0;var n=x.exec(t.slice(r));return n?(e.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){m.lastIndex=0;var n=m.exec(t.slice(r));return n?(e.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,t,r){return f(e,_.c.toString(),t,r)},d:$t,e:$t,H:er,I:er,j:Kt,L:nr,m:Jt,M:tr,p:function(e,t,r){var n=d.get(t.slice(r,r+=2).toLowerCase());return null==n?-1:(e.p=n,r)},S:rr,U:Zt,w:Gt,W:Yt,x:function(e,t,r){return f(e,_.x.toString(),t,r)},X:function(e,t,r){return f(e,_.X.toString(),t,r)},y:Wt,Y:Xt,Z:Qt,"%":ir};return u}Pt.year=It((function(e){return(e=Pt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Pt.years=Pt.year.range,Pt.years.utc=Pt.year.utc.range,Pt.day=It((function(e){var t=new zt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Pt.days=Pt.day.range,Pt.days.utc=Pt.day.utc.range,Pt.dayOfYear=function(e){var t=Pt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var r=Pt[e]=It((function(e){return(e=Pt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)-(r!==t)}));Pt[e+"s"]=r.range,Pt[e+"s"].utc=r.utc.range,Pt[e+"OfYear"]=function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)}})),Pt.week=Pt.sunday,Pt.weeks=Pt.sunday.range,Pt.weeks.utc=Pt.sunday.utc.range,Pt.weekOfYear=Pt.sundayOfYear;var Ht={"-":"",_:" ",0:"0"},Bt=/^\s*\d+/,jt=/^%/;function Vt(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Qt(e,t,r){return/^[+-]\d{4}$/.test(t=t.slice(r,r+5))?(e.Z=-t,r+5):-1}function Jt(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function $t(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Kt(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+3));return n?(e.j=+n[0],r+n[0].length):-1}function er(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ar(e){var t=e.getTimezoneOffset(),r=t>0?"-":"+",n=y(t)/60|0,a=y(t)%60;return r+Vt(n,"0",2)+Vt(a,"0",2)}function ir(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function or(e){for(var t=e.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(t),c=Math.sin(t),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=e,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(e=o)*Oe,n=Math.cos(l=(t=l)*Oe/2+Ae/4),a=Math.sin(l)},Cr.lineEnd=function(){i(e,t)}}function Dr(e){var t=e[0],r=e[1],n=Math.cos(r);return[n*Math.cos(t),n*Math.sin(t),Math.sin(r)]}function Pr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zr(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Er(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Rr(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ir(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Fr(e){return[Math.atan2(e[1],e[0]),Re(e[2])]}function Nr(e,t){return y(e[0]-t[0])ke?a=90:c<-ke&&(r=-90),f[0]=t,f[1]=n}};function p(e,i){u.push(f=[t=e,n=e]),ia&&(a=i)}function h(e,o){var l=Dr([e*Oe,o*Oe]);if(s){var c=zr(s,l),u=zr([c[1],-c[0],0],c);Ir(u),u=Fr(u);var f=e-i,d=f>0?1:-1,h=u[0]*De*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?e_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e):n>=t?(en&&(n=e)):e>i?_(t,e)>_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e)}else p(e,o);s=l,i=e}function g(){d.point=h}function v(){f[0]=t,f[1]=n,d.point=p,s=null}function m(e,t){if(s){var r=e-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=e,l=t;Cr.point(e,t),h(e,t)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>ke&&(t=-(n=180)),f[0]=t,f[1]=n,s=null}function _(e,t){return(t-=e)<0?t+360:t}function w(e,t){return e[0]-t[0]}function T(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,t=p[0],n=g[1])}return u=f=null,t===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,r],[n,a]]}}(),e.geo.centroid=function(t){mr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Lr=0,e.geo.stream(t,Hr);var r=Mr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Xr(e){if(t=e.length){for(var t,r,n=0,a=e[0];++n=0?1:-1,T=w*_,k=T>Ae,M=h*x;if(Sr.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*Le:_,k^d>=r^m>=r){var A=zr(Dr(f),Dr(e));Ir(A);var L=zr(a,A);Ir(L);var S=(k^_>=0?-1:1)*Re(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=e}}return(i<-ke||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&t&&r.push(r.pop().concat(r.shift())),l.push(r.filter(Jr))}return u}}function Jr(e){return e.length>1}function $r(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,r){e.push([t,r])},lineEnd:E,buffer:function(){var r=t;return t=[],e=null,r},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Kr(e,t){return((e=e.x)[0]<0?e[1]-Ce-ke:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-ke:Ce-t[1])}var en=Qr(Zr,(function(e){var t,r=NaN,n=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var l=i>0?Ae:-Ae,s=y(i-r);y(s-Ae)0?Ce:-Ce),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),e.point(i,n),t=0):a!==l&&s>=Ae&&(y(r-a)ke?Math.atan((Math.sin(t)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(t))*Math.sin(e))/(a*i*o)):(t+n)/2}(r,n,i,o),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),t=0),e.point(r=i,n=o),a=l},lineEnd:function(){e.lineEnd(),r=n=NaN},clean:function(){return 2-t}}}),(function(e,t,r,n){var a;if(null==e)a=r*Ce,n.point(-Ae,a),n.point(0,a),n.point(Ae,a),n.point(Ae,0),n.point(Ae,-a),n.point(0,-a),n.point(-Ae,-a),n.point(-Ae,0),n.point(-Ae,a);else if(y(e[0]-t[0])>ke){var i=e[0]0,n=y(t)>ke;return Qr(a,(function(e){var t,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?Ae:-Ae),d):0;if(!t&&(c=s=g)&&e.lineStart(),g!==s&&(p=i(t,h),(Nr(t,p)||Nr(h,p))&&(h[0]+=ke,h[1]+=ke,g=a(h[0],h[1]))),g!==s)u=0,g?(e.lineStart(),p=i(h,t),e.point(p[0],p[1])):(p=i(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(n&&t&&r^g){var m;v&l||!(m=i(h,t,!0))||(u=0,r?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!g||t&&Nr(t,h)||e.point(h[0],h[1]),t=h,s=g,l=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(c&&s)<<1}}}),Nn(e,6*Oe),r?[0,-e]:[-Ae,e-Ae]);function a(e,r){return Math.cos(e)*Math.cos(r)>t}function i(e,r,n){var a=[1,0,0],i=zr(Dr(e),Dr(r)),o=Pr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&e;var c=t*o/s,u=-t*l/s,f=zr(a,i),d=Rr(a,c);Er(d,Rr(i,u));var p=f,h=Pr(d,p),g=Pr(p,p),v=h*h-g*(Pr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Rr(p,(-h-m)/g);if(Er(x,d),x=Fr(x),!n)return x;var b,_=e[0],w=r[0],T=e[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-Ae)0^x[1]<(y(x[0]-_)Ae^(_<=x[0]&&x[0]<=w)){var L=Rr(p,(-h+m)/g);return Er(L,d),[x,Fr(L)]}}}function o(t,n){var a=r?e:Ae-e,i=0;return t<-a?i|=1:t>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(e,t,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=e-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(t,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=$r(),w=rn(t,r,n,a),T={point:A,lineStart:function(){T.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));T.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=e.merge(c);var r=function(e){for(var t=0,r=u.length,n=e[1],a=0;an&&ze(c,i,e)>0&&++t:i[1]<=n&&ze(c,i,e)<0&&--t,c=i;return 0!==t}([t,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),i&&Yr(c,o,r,k,s),s.polygonEnd()),c=u=f=null}};function k(e,o,s,c){var u=0,f=0;if(null==e||(u=i(e,s))!==(f=i(o,s))||l(e,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(e,i){return t<=e&&e<=n&&r<=i&&i<=a}function A(e,t){M(e,t)&&s.point(e,t)}function L(e,t){var r=M(e=Math.max(-1e9,Math.min(1e9,e)),t=Math.max(-1e9,Math.min(1e9,t)));if(u&&f.push([e,t]),y)d=e,p=t,h=r,y=!1,r&&(s.lineStart(),s.point(e,t));else if(r&&m)s.point(e,t);else{var n={a:{x:g,y:v},b:{x:e,y:t}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(e,t),x=!1)}g=e,v=t,m=r}return T};function i(e,a){return y(e[0]-t)0?0:3:y(e[0]-n)0?2:1:y(e[1]-r)0?1:0:a>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var r=i(e,1),n=i(t,1);return r!==n?r-n:0===r?t[1]-e[1]:1===r?e[0]-t[0]:2===r?e[1]-t[1]:t[0]-e[0]}}function an(e){var t=0,r=Ae/3,n=On(e),a=n(t,r);return a.parallels=function(e){return arguments.length?n(t=e[0]*Ae/180,r=e[1]*Ae/180):[t/Ae*180,r/Ae*180]},a}function on(e,t){var r=Math.sin(e),n=(r+Math.sin(t))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(e,t){var r=Math.sqrt(a-2*n*Math.sin(t))/n;return[r*Math.sin(e*=n),i-r*Math.cos(e)]}return o.invert=function(e,t){var r=i-t;return[Math.atan2(e,r)/n,Re((a-(e*e+r*r)*n*n)/(2*n))]},o}e.geo.clipExtent=function(){var e,t,r,n,a,i,o={stream:function(e){return a&&(a.valid=!1),(a=i(e)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(e=+l[0][0],t=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=null),o):[[e,t],[r,n]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return an(on)}).raw=on,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){var t,r,n,a,i=e.geo.albers(),o=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(e,r){t=[e,r]}};function c(e){var i=e[0],o=e[1];return t=null,r(i,o),t||(n(i,o),t)||a(i,o),t}return c.invert=function(e){var t=i.scale(),r=i.translate(),n=(e[0]-r[0])/t,a=(e[1]-r[1])/t;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(e)},c.stream=function(e){var t=i.stream(e),r=o.stream(e),n=l.stream(e);return{point:function(e,a){t.point(e,a),r.point(e,a),n.point(e,a)},sphere:function(){t.sphere(),r.sphere(),n.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),l.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),l.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var t=i.scale(),u=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[u-.455*t,f-.238*t],[u+.455*t,f+.238*t]]).stream(s).point,n=o.translate([u-.307*t,f+.201*t]).clipExtent([[u-.425*t+ke,f+.12*t+ke],[u-.214*t-ke,f+.234*t-ke]]).stream(s).point,a=l.translate([u-.205*t,f+.212*t]).clipExtent([[u-.214*t+ke,f+.166*t+ke],[u-.115*t-ke,f+.234*t-ke]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:E,lineStart:E,lineEnd:E,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=E,ln+=y(sn/2)}};function hn(){var e,t,r,n;function a(e,t){sn+=n*e-r*t,r=e,n=t}pn.point=function(i,o){pn.point=a,e=r=i,t=n=o},pn.lineEnd=function(){a(e,t)}}var gn={point:function(e,t){efn&&(fn=e);tdn&&(dn=t)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E};function vn(){var e=mn(4.5),t=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=mn(t),r},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function n(r,n){t.push("M",r,",",n,e)}function a(e,n){t.push("M",e,",",n),r.point=i}function i(e,r){t.push("L",e,",",r)}function o(){r.point=n}function l(){t.push("Z")}return r}function mn(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var yn,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(e,t){xr+=e,br+=t,++_r}function _n(){var e,t;function r(r,n){var a=r-e,i=n-t,o=Math.sqrt(a*a+i*i);wr+=o*(e+r)/2,Tr+=o*(t+n)/2,kr+=o,bn(e=r,t=n)}xn.point=function(n,a){xn.point=r,bn(e=n,t=a)}}function wn(){xn.point=bn}function Tn(){var e,t,r,n;function a(e,t){var a=e-r,i=t-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+e)/2,Tr+=o*(n+t)/2,kr+=o,Mr+=(o=n*e-r*t)*(r+e),Ar+=o*(n+t),Lr+=3*o,bn(r=e,n=t)}xn.point=function(i,o){xn.point=a,bn(e=r=i,t=n=o)},xn.lineEnd=function(){a(e,t)}}function kn(e){var t=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=e,r},result:E};function n(r,n){e.moveTo(r+t,n),e.arc(r,n,t,0,Le)}function a(t,n){e.moveTo(t,n),r.point=i}function i(t,r){e.lineTo(t,r)}function o(){r.point=n}function l(){e.closePath()}return r}function Mn(e){var t=.5,r=Math.cos(30*Oe),n=16;function a(e){return(n?o:i)(e)}function i(t){return Sn(t,(function(r,n){r=e(r,n),t.point(r[0],r[1])}))}function o(t){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),v.lineStart=_},polygonEnd:function(){t.polygonEnd(),v.lineStart=y}};function m(r,n){r=e(r,n),t.point(r[0],r[1])}function y(){f=NaN,v.point=x,t.lineStart()}function x(r,a){var i=Dr([r,a]),o=e(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,t),t.point(f,d)}function b(){v.point=m,t.lineEnd()}function _(){y(),v.point=w,v.lineEnd=T}function w(e,t){x(r=e,t),a=f,i=d,o=p,s=h,c=g,v.point=x}function T(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,t),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*t&&v--){var w=o+p,T=s+h,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),L=y(y(k)-1)t||y((x*D+b*P)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(t)},a}function An(e){var t=Mn((function(t,r){return e([t*De,r*De])}));return function(e){return Dn(t(e))}}function Ln(e){this.stream=e}function Sn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Cn(e){return On((function(){return e}))()}function On(t){var r,n,a,i,o,l,s=Mn((function(e,t){return[(e=r(e,t))[0]*c+i,o-e[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=en,y=O,x=null,b=null;function _(e){return[(e=a(e[0]*Oe,e[1]*Oe))[0]*c+i,o-e[1]*c]}function w(e){return(e=a.invert((e[0]-i)/c,(o-e[1])/c))&&[e[0]*De,e[1]*De]}function T(){a=Gr(n=En(h,g,v),r);var e=r(d,p);return i=u-e[0]*c,o=f+e[1]*c,k()}function k(){return l&&(l.valid=!1,l=null),_}return _.stream=function(e){return l&&(l.valid=!1),(l=Dn(m(n,s(y(e))))).valid=!0,l},_.clipAngle=function(e){return arguments.length?(m=null==e?(x=e,en):tn((x=+e)*Oe),k()):x},_.clipExtent=function(e){return arguments.length?(b=e,y=e?nn(e[0][0],e[0][1],e[1][0],e[1][1]):O,k()):b},_.scale=function(e){return arguments.length?(c=+e,T()):c},_.translate=function(e){return arguments.length?(u=+e[0],f=+e[1],T()):[u,f]},_.center=function(e){return arguments.length?(d=e[0]%360*Oe,p=e[1]%360*Oe,T()):[d*De,p*De]},_.rotate=function(e){return arguments.length?(h=e[0]%360*Oe,g=e[1]%360*Oe,v=e.length>2?e[2]%360*Oe:0,T()):[h*De,g*De,v*De]},e.rebind(_,s,"precision"),function(){return r=t.apply(this,arguments),_.invert=r.invert&&w,T()}}function Dn(e){return Sn(e,(function(t,r){e.point(t*Oe,r*Oe)}))}function Pn(e,t){return[e,t]}function zn(e,t){return[e>Ae?e-Le:e<-Ae?e+Le:e,t]}function En(e,t,r){return e?t||r?Gr(In(e),Fn(t,r)):In(e):t||r?Fn(t,r):zn}function Rn(e){return function(t,r){return[(t+=e)>Ae?t-Le:t<-Ae?t+Le:t,r]}}function In(e){var t=Rn(e);return t.invert=Rn(-e),t}function Fn(e,t){var r=Math.cos(e),n=Math.sin(e),a=Math.cos(t),i=Math.sin(t);function o(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),Re(u*a+s*i)]}return o.invert=function(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),Re(u*r-l*n)]},o}function Nn(e,t){var r=Math.cos(e),n=Math.sin(e);return function(a,i,o,l){var s=o*t;null!=a?(a=Hn(r,a),i=Hn(r,i),(o>0?ai)&&(a+=o*Le)):(a=e+o*Le,i=e-.5*s);for(var c,u=a;o>0?u>i:u2?e[2]*Oe:0),t.invert=function(t){return(t=e.invert(t[0]*Oe,t[1]*Oe))[0]*=De,t[1]*=De,t},t},zn.invert=Pn,e.geo.circle=function(){var e,t,r=[0,0],n=6;function a(){var e="function"==typeof r?r.apply(this,arguments):r,n=En(-e[0]*Oe,-e[1]*Oe,0).invert,a=[];return t(null,null,1,{point:function(e,t){a.push(e=n(e,t)),e[0]*=De,e[1]*=De}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(e){return arguments.length?(r=e,a):r},a.angle=function(r){return arguments.length?(t=Nn((e=+r)*Oe,n*Oe),a):e},a.precision=function(r){return arguments.length?(t=Nn(e*Oe,(n=+r)*Oe),a):n},a.angle(90)},e.geo.distance=function(e,t){var r,n=(t[0]-e[0])*Oe,a=e[1]*Oe,i=t[1]*Oe,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},e.geo.graticule=function(){var t,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(a/g)*g,n,g).map(f).concat(e.range(Math.ceil(s/v)*v,l,v).map(d)).concat(e.range(Math.ceil(r/p)*p,t,p).filter((function(e){return y(e%g)>ke})).map(c)).concat(e.range(Math.ceil(o/h)*h,i,h).filter((function(e){return y(e%v)>ke})).map(u))}return x.lines=function(){return b().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(a=+e[0][0],n=+e[1][0],s=+e[0][1],l=+e[1][1],a>n&&(e=a,a=n,n=e),s>l&&(e=s,s=l,l=e),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(e){return arguments.length?(r=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],r>t&&(e=r,r=t,t=e),o>i&&(e=o,o=i,i=e),x.precision(m)):[[r,o],[t,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],x):[g,v]},x.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],x):[p,h]},x.precision=function(e){return arguments.length?(m=+e,c=Bn(o,i,90),u=jn(r,t,m),f=Bn(s,l,90),d=jn(a,n,m),x):m},x.majorExtent([[-180,-90+ke],[180,90-ke]]).minorExtent([[-180,-80-ke],[180,80+ke]])},e.geo.greatArc=function(){var t,r,n=Vn,a=Un;function i(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return e.geo.distance(t||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,i):n},i.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,i):a},i.precision=function(){return arguments.length?i:0},i},e.geo.interpolate=function(e,t){return r=e[0]*Oe,n=e[1]*Oe,a=t[0]*Oe,i=t[1]*Oe,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Fe(i-n)+o*s*Fe(a-r))),g=1/Math.sin(h),(v=h?function(e){var t=Math.sin(e*=h)*g,r=Math.sin(h-e)*g,n=r*u+t*d,a=r*f+t*p,i=r*l+t*c;return[Math.atan2(a,n)*De,Math.atan2(i,Math.sqrt(n*n+a*a))*De]}:function(){return[r*De,n*De]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},e.geo.length=function(t){return yn=0,e.geo.stream(t,qn),yn};var qn={sphere:E,point:E,lineStart:function(){var e,t,r;function n(n,a){var i=Math.sin(a*=Oe),o=Math.cos(a),l=y((n*=Oe)-e),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-t*o*s)*l),t*i+r*o*s),e=n,t=i,r=o}qn.point=function(a,i){e=a*Oe,t=Math.sin(i*=Oe),r=Math.cos(i),qn.point=n},qn.lineEnd=function(){qn.point=qn.lineEnd=E}},lineEnd:E,polygonStart:E,polygonEnd:E};function Gn(e,t){function r(t,r){var n=Math.cos(t),a=Math.cos(r),i=e(n*a);return[i*a*Math.sin(t),i*Math.sin(r)]}return r.invert=function(e,r){var n=Math.sqrt(e*e+r*r),a=t(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(e*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(e.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Yn=Gn((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),O);function Xn(e,t){var r=Math.cos(e),n=function(e){return Math.tan(Ae/4+e/2)},a=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(n(t)/n(e)),i=r*Math.pow(n(e),a)/a;if(!a)return Jn;function o(e,t){i>0?t<-Ce+ke&&(t=-Ce+ke):t>Ce-ke&&(t=Ce-ke);var r=i/Math.pow(n(t),a);return[r*Math.sin(a*e),i-r*Math.cos(a*e)]}return o.invert=function(e,t){var r=i-t,n=Pe(a)*Math.sqrt(e*e+r*r);return[Math.atan2(e,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ce]},o}function Wn(e,t){var r=Math.cos(e),n=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),a=r/n+e;if(y(n)1&&ze(e[r[n-2]],e[r[n-1]],e[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(e,t){return e[0]-t[0]||e[1]-t[1]}(e.geo.stereographic=function(){return Cn(ea)}).raw=ea,ta.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ce]},(e.geo.transverseMercator=function(){var e=$n(ta),t=e.center,r=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?r([e[0],e[1],e.length>2?e[2]+90:90]):[(e=r())[0],e[1],e[2]-90]},r([0,0,90])}).raw=ta,e.geom={},e.geom.hull=function(e){var t=ra,r=na;if(arguments.length)return n(e);function n(e){if(e.length<3)return[];var n,a=ht(t),i=ht(r),o=e.length,l=[],s=[];for(n=0;n=0;--n)p.push(e[l[c[n]][2]]);for(n=+f;nke)l=l.L;else{if(!((a=i-Ta(l,o))>ke)){n>-ke?(t=l.P,r=l):a>-ke?(t=l,r=l.N):t=r=l;break}if(!l.R){t=l;break}l=l.R}var s=ya(e);if(da.insert(t,s),t||r){if(t===r)return Sa(t),r=ya(t.site),da.insert(s,r),s.edge=r.edge=Da(t.site,s.site),La(t),void La(r);if(r){Sa(t),Sa(r);var c=t.site,u=c.x,f=c.y,d=e.x-u,p=e.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};za(r.edge,c,h,b),s.edge=Da(c,e,null,b),r.edge=Da(e,h,null,b),La(t),La(r)}else s.edge=Da(t.site,s.site)}}function wa(e,t){var r=e.site,n=r.x,a=r.y,i=a-t;if(!i)return n;var o=e.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-t;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function Ta(e,t){var r=e.N;if(r)return wa(r,t);var n=e.site;return n.y===t?n.x:1/0}function ka(e){this.site=e,this.edges=[]}function Ma(e,t){return t.angle-e.angle}function Aa(){Ia(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(e){var t=e.P,r=e.N;if(t&&r){var n=t.site,a=e.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Me)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=e,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,e.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xke||y(a-r)>ke)&&(l.splice(o,0,new Ea(Pa(i.site,u,y(n-f)ke?{x:f,y:y(t-f)ke?{x:y(r-h)ke?{x:d,y:y(t-d)ke?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=e[l]})),t}function l(e){return e.map((function(e,t){return{x:Math.round(n(e,t)/ke)*ke,y:Math.round(a(e,t)/ke)*ke,i:t}}))}return o.links=function(e){return Ba(l(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return Ba(l(e)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|t>=b,T=w+4;wi&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=$a.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,T=v-h;function k(e,t,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(e.leaf){var s=e.x,c=e.y;if(null!=s)if(y(s-r)+y(c-n)<.01)M(e,t,r,n,a,i,o,l);else{var u=e.point;e.x=e.y=e.point=null,M(e,u,s,c,a,i,o,l),M(e,t,r,n,a,i,o,l)}else e.x=r,e.y=n,e.point=t}else M(e,t,r,n,a,i,o,l)}function M(e,t,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;e.leaf=!1,u?a=s:o=s,f?i=c:l=c,k(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,r,n,a,i,o,l)}w>T?v=h+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){k(A,e,+m(e,++f),+x(e,f),p,h,g,v)},visit:function(e){Ga(e,A,p,h,g,v)},find:function(e){return Za(A,e[0],e[1],p,h,g,v)}};if(f=-1,null==t){for(;++f=0&&!(n=e.interpolators[a](t,r)););return n}function ei(e,t){var r,n=[],a=[],i=e.length,o=t.length,l=Math.min(e.length,t.length);for(r=0;r=1?1:e(t)}}function ii(e){return function(t){return 1-e(1-t)}}function oi(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function li(e){return e*e}function si(e){return e*e*e}function ci(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function ui(e){return 1-Math.cos(e*Ce)}function fi(e){return Math.pow(2,10*(e-1))}function di(e){return 1-Math.sqrt(1-e*e)}function pi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function hi(e,t){return t-=e,function(r){return Math.round(e+t*r)}}function gi(e){var t,r,n,a=[e.a,e.b],i=[e.c,e.d],o=mi(a),l=vi(a,i),s=mi(((t=i)[0]+=(n=-l)*(r=a)[0],t[1]+=n*r[1],t))||0;a[0]*i[1]=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):"in";return n=ri.get(n)||ti,ai((a=ni.get(a)||O)(n.apply(null,r.call(arguments,1))))},e.interpolateHcl=function(t,r){t=e.hcl(t),r=e.hcl(r);var n=t.h,a=t.c,i=t.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Xe(n+o*e,a+l*e,i+s*e)+""}},e.interpolateHsl=function(t,r){t=e.hsl(t),r=e.hsl(r);var n=t.h,a=t.s,i=t.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ge(n+o*e,a+l*e,i+s*e)+""}},e.interpolateLab=function(t,r){t=e.lab(t),r=e.lab(r);var n=t.l,a=t.a,i=t.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(e){return $e(n+o*e,a+l*e,i+s*e)+""}},e.interpolateRound=hi,e.transform=function(t){var r=a.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(null!=e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate()}return new gi(t?t.matrix:yi)})(t)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(e){return e.length?e.pop()+",":""}function bi(t,r){var n=[],a=[];return t=e.transform(t),r=e.transform(r),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}(t.translate,r.translate,n,a),function(e,t,r,n){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(e,t)})):t&&r.push(xi(r)+"rotate("+t+")")}(t.rotate,r.rotate,n,a),function(e,t,r,n){e!==t?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(e,t)}):t&&r.push(xi(r)+"skewX("+t+")")}(t.skew,r.skew,n,a),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else 1===t[0]&&1===t[1]||r.push(xi(r)+"scale("+t+")")}(t.scale,r.scale,n,a),t=r=null,function(e){for(var t,r=-1,i=a.length;++r0?n=e:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:n=0})):e>0&&(s.start({type:"start",alpha:n=e}),t=wt(l.tick)),l):n},l.start=function(){var e,t,r,n=m.length,s=y.length,u=c[0],h=c[1];for(e=0;e=0;)r.push(a[n])}function Ei(e,t){for(var r=[e],n=[];null!=(e=r.pop());)if(n.push(e),(i=e.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ei(a,(function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)})),l}return n.sort=function(t){return arguments.length?(e=t,n):e},n.children=function(e){return arguments.length?(t=e,n):t},n.value=function(e){return arguments.length?(r=e,n):r},n.revalue=function(e){return r&&(zi(e,(function(e){e.children&&(e.value=0)})),Ei(e,(function(e){var t;e.children||(e.value=+r.call(n,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},n},e.layout.partition=function(){var t=e.layout.hierarchy(),r=[1,1];function n(e,n){var a=t.call(this,e,n);return function e(t,r,n,a){var i=t.children;if(t.x=r,t.y=t.depth*a,t.dx=n,t.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=t.value?n/t.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=t);return n}function Xi(e){return e.reduce(Wi,0)}function Wi(e,t){return e+t[1]}function Qi(e,t){return Ji(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Ji(e,t){for(var r=-1,n=+e[0],a=(e[1]-n)/t,i=[];++r<=t;)i[r]=a*r+n;return i}function $i(t){return[e.min(t),e.max(t)]}function Ki(e,t){return e.value-t.value}function eo(e,t){var r=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=r,r._pack_prev=t}function to(e,t){e._pack_next=t,t._pack_prev=e}function ro(e,t){var r=t.x-e.x,n=t.y-e.y,a=e.r+t.r;return.999*a*a>r*r+n*n}function no(e){if((t=e.children)&&(s=t.length)){var t,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(t.forEach(ao),(r=t[0]).x=-r.r,r.y=0,x(r),s>1&&((n=t[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=t[2]),x(a),eo(r,a),r._pack_prev=a,eo(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[e.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(e){return arguments.length?(r=e,i):r},i.range=function(e){return arguments.length?(n=ht(e),i):n},i.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return Ji(t,e)}:ht(e),i):a},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},e.layout.pack=function(){var t,r=e.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(e,i){var o=r.call(this,e,i),l=o[0],s=a[0],c=a[1],u=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(l.x=l.y=0,Ei(l,(function(e){e.r=+u(e.value)})),Ei(l,no),n){var f=n*(t?1:Math.max(2*l.r/s,2*l.r/c))/2;Ei(l,(function(e){e.r+=f})),Ei(l,no),Ei(l,(function(e){e.r-=f}))}return function e(t,r,n,a){var i=t.children;if(t.x=r+=a*t.x,t.y=n+=a*t.y,t.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);zi(u,(function(e){e.x=(e.x+g)*v,e.y=e.depth*m}))}return c}function o(e){var t=e.children,n=e.parent.children,a=e.i?n[e.i-1]:null;if(t.length){!function(e){var t,r=0,n=0,a=e.children,i=a.length;for(;--i>=0;)(t=a[i]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;a?(e.z=a.z+r(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+r(e._,a._));e.parent.A=function(e,t,n){if(t){for(var a,i=e,o=e,l=t,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=e,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,e,n),e,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=e)}return n}(e,a,e.parent.A||n[0])}function l(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e)?s:null,i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null==(n=e)?null:s,i):a?n:null},Pi(i,t)},e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=t.call(this,i,o),c=s[0],u=0;Ei(c,(function(t){var n=t.children;n&&n.length?(t.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),t.y=function(t){return 1+e.max(t,(function(e){return e.y}))}(n)):(t.x=l?u+=r(t,l):0,t.y=0,l=t)}));var f=function e(t){var r=t.children;return r&&r.length?e(r[0]):t}(c),d=function e(t){var r,n=t.children;return n&&(r=n.length)?e(n[r-1]):t}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return Ei(c,a?function(e){e.x=(e.x-c.x)*n[0],e.y=(c.y-e.y)*n[1]}:function(e){e.x=(e.x-p)/(h-p)*n[0],e.y=(1-(c.y?e.y/c.y:1))*n[1]}),s}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e),i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null!=(n=e),i):a?n:null},Pi(i,t)},e.layout.treemap=function(){var t,r=e.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(e,t){for(var r,n,a=-1,i=e.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var r,n=o(e),a=t.slice(),i=[];for(u(a,n.dx*n.dy/e.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);t.forEach(d)}}function p(e,t){for(var r,n=e.area,a=0,i=1/0,o=-1,l=e.length;++oa&&(a=r));return t*=t,(n*=n)?Math.max(t*a*c/n,n/(t*i*c)):1/0}function h(e,t,r,a){var i,o=-1,l=e.length,s=r.x,c=r.y,u=t?n(e.area/t):0;if(t==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return e+t*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var r=e.random.irwinHall(t);return function(){return r()/t}},irwinHall:function(e){return function(){for(var t=0,r=0;r2?_o:mo,l=a?wi:_i;return i=e(t,r,l,n),o=e(r,t,l,Ka),s}function s(e){return i(e)}return s.invert=function(e){return o(e)},s.domain=function(e){return arguments.length?(t=e.map(Number),l()):t},s.range=function(e){return arguments.length?(r=e,l()):r},s.rangeRound=function(e){return s.range(e).interpolate(hi)},s.clamp=function(e){return arguments.length?(a=e,l()):a},s.interpolate=function(e){return arguments.length?(n=e,l()):n},s.ticks=function(e){return Mo(t,e)},s.tickFormat=function(e,r){return Ao(t,e,r)},s.nice=function(e){return To(t,e),l()},s.copy=function(){return e(t,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}e.scale.log=function(){return function t(r,n,a,i){function o(e){return(a?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function l(e){return a?Math.pow(n,e):-Math.pow(n,-e)}function s(e){return r(o(e))}return s.invert=function(e){return l(r.invert(e))},s.domain=function(e){return arguments.length?(a=e[0]>=0,r.domain((i=e.map(Number)).map(o)),s):i},s.base=function(e){return arguments.length?(n=+e,r.domain(i.map(o)),s):n},s.nice=function(){var e=yo(i.map(o),a?Math:Oo);return r.domain(e),i=e.map(l),s},s.ticks=function(){var e=go(i),t=[],r=e[0],s=e[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)t.push(l(c)*d);for(c=0;t[c]s;u--);t=t.slice(c,u)}return t},s.tickFormat=function(t,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=e.format(r));var a=Math.max(1,n*t/s.ticks().length);return function(e){var t=e/l(Math.round(o(e)));return t*n0?a[e-1]:r[0],ef?0:1;if(c=Se)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,T,k,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=Re(v/c*Math.sin(m))),l&&(A=Re(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Ae?0:1;if(L&&Uo(y,x,b,_)===p^C){var O=(u+f)/2;y=c*Math.cos(O),x=c*Math.sin(O),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),T=l*Math.sin(f-A),k=l*Math.cos(u+A),M=l*Math.sin(u+A);var D=Math.abs(u-f+2*A)<=Ae?0:1;if(A&&Uo(w,T,k,M)===1-p^D){var P=(u+f)/2;w=l*Math.cos(P),T=l*Math.sin(P),k=M=null}}else w=T=0;if(d>ke&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function qo(e,t,r,n,a){var i=e[0]-t[0],o=e[1]-t[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=e[0]+s,f=e[1]+c,d=t[0]+s,p=t[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,T=(-b*v-m*_)/y,k=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=T-g,S=k-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=k,T=M),[[w-s,T-c],[w*r/x,T*r/x]]}function Go(e){var t=ra,r=na,n=Zr,a=Yo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=ht(t),p=ht(r);function h(){s.push("M",a(e(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Qo,basis:Ko,"basis-open":function(e){if(e.length<4)return Yo(e);var t,r=[],n=-1,a=e.length,i=[0],o=[0];for(;++n<3;)t=e[n],i.push(t[0]),o.push(t[1]);r.push(el(nl,i)+","+el(nl,o)),--n;for(;++n9&&(a=3*t/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(e[Math.min(s,l+1)][0]-e[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(e))}});function Yo(e){return e.length>1?e.join("L"):e+"Z"}function Xo(e){return e.join("L")+"Z"}function Wo(e){for(var t=0,r=e.length,n=e[0],a=[n[0],",",n[1]];++t1){l=t[1],i=e[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAe)+",1 "+t}function s(e,t,r,n){return"Q 0,0 "+n}return i.radius=function(e){return arguments.length?(r=ht(e),i):r},i.source=function(t){return arguments.length?(e=ht(t),i):e},i.target=function(e){return arguments.length?(t=ht(e),i):t},i.startAngle=function(e){return arguments.length?(n=ht(e),i):n},i.endAngle=function(e){return arguments.length?(a=ht(e),i):a},i},e.svg.diagonal=function(){var e=Vn,t=Un,r=cl;function n(n,a){var i=e.call(this,n,a),o=t.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(t){return arguments.length?(e=ht(t),n):e},n.target=function(e){return arguments.length?(t=ht(e),n):t},n.projection=function(e){return arguments.length?(r=e,n):r},n},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),r=cl,n=t.projection;return t.projection=function(e){return arguments.length?n(ul(r=e)):r},t},e.svg.symbol=function(){var e=dl,t=fl;function r(r,n){return(hl.get(e.call(this,r,n))||pl)(t.call(this,r,n))}return r.type=function(t){return arguments.length?(e=ht(t),r):e},r.size=function(e){return arguments.length?(t=ht(e),r):t},r};var hl=e.map({circle:pl,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vl)),r=t*vl;return"M0,"+-t+"L"+r+",0 0,"+t+" "+-r+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});e.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Oe);Z.transition=function(e){for(var t,r,n=bl||++Tl,a=Al(e),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(e,o);if(i>=1)return f.event&&f.event.end.call(e,e.__data__,t),--u.count?delete u[n]:delete e[r],1}f||(i=a.time,o=wt((function(e){var t=f.delay;if(o.t=t+i,t<=e)return d(e-t);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:t},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,e.transition=function(t,r){return t&&t.transition?bl?t.transition(r):t:e.selection().transition(t)},e.transition.prototype=wl,wl.select=function(e){var t,r,n,a=this.id,i=this.namespace,o=[];e=Y(e);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=e.select(e.event.target),x=n.of(m,arguments),b=e.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=be(m),A=e.mouse(m),L=e.select(o(m)).on("keydown.brush",O).on("keyup.brush",D);if(e.event.changedTouches?L.on("touchmove.brush",P).on("touchend.brush",E):L.on("mousemove.brush",P).on("mouseup.brush",E),b.interrupt().selectAll("*").interrupt(),k)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else e.event.altKey&&(f=A.slice());function O(){32==e.event.keyCode&&(k||(f=null,A[0]-=l[1],A[1]-=s[1],k=2),F())}function D(){32==e.event.keyCode&&2==k&&(A[0]+=l[1],A[1]+=s[1],k=0,F())}function P(){var t=e.mouse(m),r=!1;v&&(t[0]+=v[0],t[1]+=v[1]),k||(e.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(t[0]1?{floor:function(t){for(;l(t=e.floor(t));)t=Hl(t-1);return t},ceil:function(t){for(;l(t=e.ceil(t));)t=Hl(+t+1);return t}}:e))},a.ticks=function(e,t){var r=go(a.domain()),n=null==e?i(r,10):"number"==typeof e?i(r,e):!e.range&&[{range:e},t];return n&&(e=n[0],t=n[1]),e.range(r[0],Hl(+r[1]+1),t<1?1:t)},a.tickFormat=function(){return n},a.copy=function(){return Nl(t.copy(),r,n)},wo(a,t)}function Hl(e){return new Date(e)}El.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Il,Fl.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Fl.toString=Il.toString,Pt.second=It((function(e){return new zt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Pt.seconds=Pt.second.range,Pt.seconds.utc=Pt.second.utc.range,Pt.minute=It((function(e){return new zt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Pt.minutes=Pt.minute.range,Pt.minutes.utc=Pt.minute.utc.range,Pt.hour=It((function(e){var t=e.getTimezoneOffset()/60;return new zt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Pt.hours=Pt.hour.range,Pt.hours.utc=Pt.hour.utc.range,Pt.month=It((function(e){return(e=Pt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Pt.months=Pt.month.range,Pt.months.utc=Pt.month.utc.range;var Bl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],jl=[[Pt.second,1],[Pt.second,5],[Pt.second,15],[Pt.second,30],[Pt.minute,1],[Pt.minute,5],[Pt.minute,15],[Pt.minute,30],[Pt.hour,1],[Pt.hour,3],[Pt.hour,6],[Pt.hour,12],[Pt.day,1],[Pt.day,2],[Pt.week,1],[Pt.month,1],[Pt.month,3],[Pt.year,1]],Vl=El.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Zr]]),Ul={range:function(t,r,n){return e.range(Math.ceil(t/n)*n,+r,n).map(Hl)},floor:O,ceil:O};jl.year=Pt.year,Pt.scale=function(){return Nl(e.scale.linear(),jl,Vl)};var ql=jl.map((function(e){return[e[0].utc,e[1]]})),Gl=Rl.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Zr]]);function Zl(e){return JSON.parse(e.responseText)}function Yl(e){var t=a.createRange();return t.selectNode(a.body),t.createContextualFragment(e.responseText)}ql.year=Pt.year.utc,Pt.scale.utc=function(){return Nl(e.scale.linear(),ql,Gl)},e.text=gt((function(e){return e.responseText})),e.json=function(e,t){return vt(e,"application/json",Zl,t)},e.html=function(e,t){return vt(e,"text/html",Yl,t)},e.xml=gt((function(e){return e.responseXML})),"object"==typeof t&&t.exports?t.exports=e:this.d3=e}()},{}],17:[function(e,t,r){(function(n,a){ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=e()}}((function(){return function e(t,r,n){function a(o,l){if(!r[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":209}],2:[function(e,t,r){"use strict";t.exports=e("../src/traces/bar")},{"../src/traces/bar":314}],3:[function(e,t,r){"use strict";t.exports=e("../src/traces/candlestick")},{"../src/traces/candlestick":332}],4:[function(e,t,r){"use strict";t.exports=e("../src/core")},{"../src/core":190}],5:[function(e,t,r){"use strict";t.exports=e("../src/traces/funnel")},{"../src/traces/funnel":341}],6:[function(e,t,r){"use strict";t.exports=e("../src/traces/funnelarea")},{"../src/traces/funnelarea":350}],7:[function(e,t,r){"use strict";t.exports=e("../src/traces/histogram")},{"../src/traces/histogram":366}],8:[function(e,t,r){"use strict";var n=e("./core");n.register([e("./bar"),e("./histogram"),e("./pie"),e("./funnelarea"),e("./ohlc"),e("./candlestick"),e("./funnel"),e("./waterfall"),e("./indicator")]),t.exports=n},{"./bar":2,"./candlestick":3,"./core":4,"./funnel":5,"./funnelarea":6,"./histogram":7,"./indicator":9,"./ohlc":10,"./pie":11,"./waterfall":12}],9:[function(e,t,r){"use strict";t.exports=e("../src/traces/indicator")},{"../src/traces/indicator":373}],10:[function(e,t,r){"use strict";t.exports=e("../src/traces/ohlc")},{"../src/traces/ohlc":379}],11:[function(e,t,r){"use strict";t.exports=e("../src/traces/pie")},{"../src/traces/pie":390}],12:[function(e,t,r){"use strict";t.exports=e("../src/traces/waterfall")},{"../src/traces/waterfall":432}],13:[function(e,t,r){"use strict";var n,a="object"==typeof Reflect?Reflect:null,i=a&&"function"==typeof a.apply?a.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=a&&"function"==typeof a.ownKeys?a.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function l(){l.init.call(this)}t.exports=l,t.exports.once=function(e,t){return new Promise((function(r,n){function a(){void 0!==i&&e.removeListener("error",i),r([].slice.call(arguments))}var i;"error"!==t&&(i=function(r){e.removeListener(t,a),n(r)},e.once("error",i)),e.once(t,a)}))},l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var s=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var a,i,o,l;if(c(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),o=i[t]),void 0===o)o=i[t]=r,++e._eventsCount;else if("function"==typeof o?o=i[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(a=u(e))>0&&o.length>a&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=o.length,l=s,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},a=d.bind(n);return a.listener=r,n.wrapFn=a,a}function h(e,t,r){var n=e._events;if(void 0===n)return[];var a=n[t];return void 0===a?[]:"function"==typeof a?r?[a.listener||a]:[a]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(o=t[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var s=a[e];if(void 0===s)return!1;if("function"==typeof s)i(s,this,t);else{var c=s.length,u=v(s,c);for(r=0;r=0;i--)if(r[i]===t||r[i].listener===t){o=r[i].listener,a=i;break}if(a<0)return this;0===a?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},l.prototype.listeners=function(e){return h(this,e,!0)},l.prototype.rawListeners=function(e){return h(this,e,!1)},l.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},l.prototype.listenerCount=g,l.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],14:[function(e,t,r){!function(n,a){"object"==typeof r&&"undefined"!=typeof t?a(r,e("d3-time")):a((n=n||self).d3=n.d3||{},n.d3)}(this,(function(e,t){"use strict";function r(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function n(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function a(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,o=e.date,s=e.time,c=e.periods,u=e.days,f=e.shortDays,d=e.months,ye=e.shortMonths,xe=p(c),be=h(c),_e=p(u),we=h(u),Te=p(f),ke=h(f),Me=p(d),Ae=h(d),Le=p(ye),Se=h(ye),Ce={a:function(e){return f[e.getDay()]},A:function(e){return u[e.getDay()]},b:function(e){return ye[e.getMonth()]},B:function(e){return d[e.getMonth()]},c:null,d:E,e:E,f:B,H:I,I:F,j:N,L:H,m:j,M:V,p:function(e){return c[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:ve,s:me,S:U,u:q,U:G,V:Z,w:Y,W:X,x:null,X:null,y:W,Y:Q,Z:J,"%":ge},Oe={a:function(e){return f[e.getUTCDay()]},A:function(e){return u[e.getUTCDay()]},b:function(e){return ye[e.getUTCMonth()]},B:function(e){return d[e.getUTCMonth()]},c:null,d:$,e:$,f:ne,H:K,I:ee,j:te,L:re,m:ae,M:ie,p:function(e){return c[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:ve,s:me,S:oe,u:le,U:se,V:ce,w:ue,W:fe,x:null,X:null,y:de,Y:pe,Z:he,"%":ge},De={a:function(e,t,r){var n=Te.exec(t.slice(r));return n?(e.w=ke[n[0].toLowerCase()],r+n[0].length):-1},A:function(e,t,r){var n=_e.exec(t.slice(r));return n?(e.w=we[n[0].toLowerCase()],r+n[0].length):-1},b:function(e,t,r){var n=Le.exec(t.slice(r));return n?(e.m=Se[n[0].toLowerCase()],r+n[0].length):-1},B:function(e,t,r){var n=Me.exec(t.slice(r));return n?(e.m=Ae[n[0].toLowerCase()],r+n[0].length):-1},c:function(e,t,r){return Re(e,i,t,r)},d:M,e:M,f:D,H:L,I:L,j:A,L:O,m:k,M:S,p:function(e,t,r){var n=xe.exec(t.slice(r));return n?(e.p=be[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:z,s:R,S:C,u:v,U:m,V:y,w:g,W:x,x:function(e,t,r){return Re(e,o,t,r)},X:function(e,t,r){return Re(e,s,t,r)},y:_,Y:b,Z:w,"%":P};function Pe(e,t){return function(r){var n,a,i,o=[],s=-1,c=0,u=e.length;for(r instanceof Date||(r=new Date(+r));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(l=n(a(c.y,0,1))).getUTCDay(),l=s>4||0===s?t.utcMonday.ceil(l):t.utcMonday(l),l=t.utcDay.offset(l,7*(c.V-1)),c.y=l.getUTCFullYear(),c.m=l.getUTCMonth(),c.d=l.getUTCDate()+(c.w+6)%7):(s=(l=r(a(c.y,0,1))).getDay(),l=s>4||0===s?t.timeMonday.ceil(l):t.timeMonday(l),l=t.timeDay.offset(l,7*(c.V-1)),c.y=l.getFullYear(),c.m=l.getMonth(),c.d=l.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?n(a(c.y,0,1)).getUTCDay():r(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Re(e,t,r,n){for(var a,i,o=0,s=t.length,c=r.length;o=c)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=De[a in l?t.charAt(o++):a])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ce.x=Pe(o,Ce),Ce.X=Pe(s,Ce),Ce.c=Pe(i,Ce),Oe.x=Pe(o,Oe),Oe.X=Pe(s,Oe),Oe.c=Pe(i,Oe),{format:function(e){var t=Pe(e+="",Ce);return t.toString=function(){return e},t},parse:function(e){var t=ze(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=Pe(e+="",Oe);return t.toString=function(){return e},t},utcParse:function(e){var t=ze(e+="",!0);return t.toString=function(){return e},t}}}var o,l={"-":"",_:" ",0:"0"},s=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(e,t,r){var n=s.exec(t.slice(r,r+1));return n?(e.q=3*n[0]-3,r+n[0].length):-1}function k(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function M(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function A(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function L(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function S(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function C(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function O(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function D(e,t,r){var n=s.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function P(e,t,r){var n=c.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function z(e,t,r){var n=s.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function R(e,t,r){var n=s.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function E(e,t){return f(e.getDate(),t,2)}function I(e,t){return f(e.getHours(),t,2)}function F(e,t){return f(e.getHours()%12||12,t,2)}function N(e,r){return f(1+t.timeDay.count(t.timeYear(e),e),r,3)}function H(e,t){return f(e.getMilliseconds(),t,3)}function B(e,t){return H(e,t)+"000"}function j(e,t){return f(e.getMonth()+1,t,2)}function V(e,t){return f(e.getMinutes(),t,2)}function U(e,t){return f(e.getSeconds(),t,2)}function q(e){var t=e.getDay();return 0===t?7:t}function G(e,r){return f(t.timeSunday.count(t.timeYear(e)-1,e),r,2)}function Z(e,r){var n=e.getDay();return e=n>=4||0===n?t.timeThursday(e):t.timeThursday.ceil(e),f(t.timeThursday.count(t.timeYear(e),e)+(4===t.timeYear(e).getDay()),r,2)}function Y(e){return e.getDay()}function X(e,r){return f(t.timeMonday.count(t.timeYear(e)-1,e),r,2)}function W(e,t){return f(e.getFullYear()%100,t,2)}function Q(e,t){return f(e.getFullYear()%1e4,t,4)}function J(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+f(t/60|0,"0",2)+f(t%60,"0",2)}function $(e,t){return f(e.getUTCDate(),t,2)}function K(e,t){return f(e.getUTCHours(),t,2)}function ee(e,t){return f(e.getUTCHours()%12||12,t,2)}function te(e,r){return f(1+t.utcDay.count(t.utcYear(e),e),r,3)}function re(e,t){return f(e.getUTCMilliseconds(),t,3)}function ne(e,t){return re(e,t)+"000"}function ae(e,t){return f(e.getUTCMonth()+1,t,2)}function ie(e,t){return f(e.getUTCMinutes(),t,2)}function oe(e,t){return f(e.getUTCSeconds(),t,2)}function le(e){var t=e.getUTCDay();return 0===t?7:t}function se(e,r){return f(t.utcSunday.count(t.utcYear(e)-1,e),r,2)}function ce(e,r){var n=e.getUTCDay();return e=n>=4||0===n?t.utcThursday(e):t.utcThursday.ceil(e),f(t.utcThursday.count(t.utcYear(e),e)+(4===t.utcYear(e).getUTCDay()),r,2)}function ue(e){return e.getUTCDay()}function fe(e,r){return f(t.utcMonday.count(t.utcYear(e)-1,e),r,2)}function de(e,t){return f(e.getUTCFullYear()%100,t,2)}function pe(e,t){return f(e.getUTCFullYear()%1e4,t,4)}function he(){return"+0000"}function ge(){return"%"}function ve(e){return+e}function me(e){return Math.floor(+e/1e3)}function ye(t){return o=i(t),e.timeFormat=o.format,e.timeParse=o.parse,e.utcFormat=o.utcFormat,e.utcParse=o.utcParse,o}ye({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xe=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var be=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=xe,e.isoParse=be,e.timeFormatDefaultLocale=ye,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})}))},{"d3-time":15}],15:[function(e,t,r){!function(e,n){"object"==typeof r&&"undefined"!=typeof t?n(r):n((e=e||self).d3=e.d3||{})}(this,(function(e){"use strict";var t=new Date,r=new Date;function n(e,a,i,o){function l(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return l.floor=function(t){return e(t=new Date(+t)),t},l.ceil=function(t){return e(t=new Date(t-1)),a(t,1),e(t),t},l.round=function(e){var t=l(e),r=l.ceil(e);return e-t0))return o;do{o.push(i=new Date(+t)),a(t,n),e(t)}while(i=r)for(;e(r),!t(r);)r.setTime(r-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;a(e,-1),!t(e););else for(;--r>=0;)for(;a(e,1),!t(e););}))},i&&(l.count=function(n,a){return t.setTime(+n),r.setTime(+a),e(t),e(r),Math.floor(i(t,r))},l.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?l.filter(o?function(t){return o(t)%e==0}:function(t){return l.count(0,t)%e==0}):l:null}),l}var a=n((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?n((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,r){t.setTime(+t+r*e)}),(function(t,r){return(r-t)/e})):a:null};var i=a.range,o=n((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()})),l=o.range,s=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()})),c=s.range,u=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()})),f=u.range,d=n((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1})),p=d.range;function h(e){return n((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var g=h(0),v=h(1),m=h(2),y=h(3),x=h(4),b=h(5),_=h(6),w=g.range,T=v.range,k=m.range,M=y.range,A=x.range,L=b.range,S=_.range,C=n((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),O=C.range,D=n((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));D.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,r){t.setFullYear(t.getFullYear()+r*e)})):null};var P=D.range,z=n((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()})),R=z.range,E=n((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()})),I=E.range,F=n((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1})),N=F.range;function H(e){return n((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var B=H(0),j=H(1),V=H(2),U=H(3),q=H(4),G=H(5),Z=H(6),Y=B.range,X=j.range,W=V.range,Q=U.range,J=q.range,$=G.range,K=Z.range,ee=n((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),te=ee.range,re=n((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));re.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,r){t.setUTCFullYear(t.getUTCFullYear()+r*e)})):null};var ne=re.range;e.timeDay=d,e.timeDays=p,e.timeFriday=b,e.timeFridays=L,e.timeHour=u,e.timeHours=f,e.timeInterval=n,e.timeMillisecond=a,e.timeMilliseconds=i,e.timeMinute=s,e.timeMinutes=c,e.timeMonday=v,e.timeMondays=T,e.timeMonth=C,e.timeMonths=O,e.timeSaturday=_,e.timeSaturdays=S,e.timeSecond=o,e.timeSeconds=l,e.timeSunday=g,e.timeSundays=w,e.timeThursday=x,e.timeThursdays=A,e.timeTuesday=m,e.timeTuesdays=k,e.timeWednesday=y,e.timeWednesdays=M,e.timeWeek=g,e.timeWeeks=w,e.timeYear=D,e.timeYears=P,e.utcDay=F,e.utcDays=N,e.utcFriday=G,e.utcFridays=$,e.utcHour=E,e.utcHours=I,e.utcMillisecond=a,e.utcMilliseconds=i,e.utcMinute=z,e.utcMinutes=R,e.utcMonday=j,e.utcMondays=X,e.utcMonth=ee,e.utcMonths=te,e.utcSaturday=Z,e.utcSaturdays=K,e.utcSecond=o,e.utcSeconds=l,e.utcSunday=B,e.utcSundays=Y,e.utcThursday=q,e.utcThursdays=J,e.utcTuesday=V,e.utcTuesdays=W,e.utcWednesday=U,e.utcWednesdays=Q,e.utcWeek=B,e.utcWeeks=Y,e.utcYear=re,e.utcYears=ne,Object.defineProperty(e,"__esModule",{value:!0})}))},{}],16:[function(e,t,r){!function(){var e={version:"3.5.17"},r=[].slice,n=function(e){return r.call(e)},a=this.document;function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(e){n=function(e){for(var t=e.length,r=new Array(t);t--;)r[t]=e[t];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(e,t){s.call(this,e,t+"")},l.setAttributeNS=function(e,t,r){c.call(this,e,t,r+"")},u.setProperty=function(e,t,r){f.call(this,e,t+"",r)}}function d(e,t){return et?1:e>=t?0:NaN}function p(e){return null===e?NaN:+e}function h(e){return!isNaN(e)}function g(e){return{left:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)<0?n=i+1:a=i}return n},right:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)>0?a=i:n=i+1}return n}}}e.ascending=d,e.descending=function(e,t){return te?1:t>=e?0:NaN},e.min=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},e.max=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},e.extent=function(e,t){var r,n,a,i=-1,o=e.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var v=g(d);function m(e){return e.length}e.bisectLeft=v.left,e.bisect=e.bisectRight=v.right,e.bisector=function(e){return g(1===e.length?function(t,r){return d(e(t),r)}:e)},e.shuffle=function(e,t,r){(i=arguments.length)<3&&(r=e.length,i<2&&(t=0));for(var n,a,i=r-t;i;)a=Math.random()*i--|0,n=e[i+t],e[i+t]=e[a+t],e[a+t]=n;return e},e.permute=function(e,t){for(var r=t.length,n=new Array(r);r--;)n[r]=e[t[r]];return n},e.pairs=function(e){for(var t=0,r=e.length-1,n=e[0],a=new Array(r<0?0:r);t=0;)for(t=(n=e[a]).length;--t>=0;)r[--o]=n[t];return r};var y=Math.abs;function x(e){for(var t=1;e*t%1;)t*=10;return t}function b(e,t){for(var r in t)Object.defineProperty(e.prototype,r,{value:t[r],enumerable:!1})}function _(){this._=Object.create(null)}e.range=function(e,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=e,e=0)),(t-e)/r==1/0)throw new Error("infinite range");var n,a=[],i=x(y(r)),o=-1;if(e*=i,t*=i,(r*=i)<0)for(;(n=e+r*++o)>t;)a.push(n/i);else for(;(n=e+r*++o)=a.length)return r?r.call(n,i):t?i.sort(t):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return t;var n=[],o=i[r++];return t.forEach((function(t,a){n.push({key:t,values:e(a,r)})})),o?n.sort((function(e,t){return o(e.key,t.key)})):n}(o(e.map,t,0),0)},n.key=function(e){return a.push(e),n},n.sortKeys=function(e){return i[a.length-1]=e,n},n.sortValues=function(e){return t=e,n},n.rollup=function(e){return r=e,n},n},e.set=function(e){var t=new C;if(e)for(var r=0,n=e.length;r=0&&(n=e.slice(r+1),e=e.slice(0,r)),e)return arguments.length<2?this[e].on(n):this[e].on(n,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(n,null);return this}},e.event=null,e.requote=function(e){return e.replace(B,"\\$&")};var B=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,j={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)e[r]=t[r]};function V(e){return j(e,Z),e}var U=function(e,t){return t.querySelector(e)},q=function(e,t){return t.querySelectorAll(e)},G=function(e,t){var r=e.matches||e[P(e,"matchesSelector")];return(G=function(e,t){return r.call(e,t)})(e,t)};"function"==typeof Sizzle&&(U=function(e,t){return Sizzle(e,t)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),e.selection=function(){return e.select(a.documentElement)};var Z=e.selection.prototype=[];function Y(e){return"function"==typeof e?e:function(){return U(e,this)}}function X(e){return"function"==typeof e?e:function(){return q(e,this)}}Z.select=function(e){var t,r,n,a,i=[];e=Y(e);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=e.slice(0,t))&&(e=e.slice(t+1)),Q.hasOwnProperty(r)?{space:Q[r],local:e}:e}},Z.attr=function(t,r){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=e.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(r in t)this.each(J(r,t[r]));return this}return this.each(J(t,r))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node(),n=(e=ee(e)).length,a=-1;if(t=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(e){e=ce.apply(this,arguments);for(var t=-1,r=this.length;++t=t&&(t=a+1);!(o=l[t])&&++t0&&(t=t.slice(0,o));var s=ge.get(t);function c(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return s&&(t=s,l=me),o?r?function(){var e=l(r,n(arguments));c.call(this),this.addEventListener(t,this[i]=e,e.$=a),e._=r}:c:r?R:function(){var r,n=new RegExp("^__on([^.]+)"+e.requote(t)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}e.selection.enter=fe,e.selection.enter.prototype=de,de.append=Z.append,de.empty=Z.empty,de.node=Z.node,de.call=Z.call,de.size=Z.size,de.select=function(e){for(var t,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:e<0?-1:0}function ze(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(t[1]-e[1])*(r[0]-e[0])}function Re(e){return e>1?0:e<-1?Ae:Math.acos(e)}function Ee(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function Ie(e){return((e=Math.exp(e))+1/e)/2}function Fe(e){return(e=Math.sin(e/2))*e}var Ne=Math.SQRT2;e.interpolateZoom=function(e,t){var r,n,a=e[0],i=e[1],o=e[2],l=t[0],s=t[1],c=t[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(t=t.transition().duration(g)),t.call(w.event)}function L(){c&&c.domain(s.range().map((function(e){return(e-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(e){return(e-d.y)/d.k})).map(u.invert))}function S(e){v++||e({type:"zoomstart"})}function C(e){L(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function O(e){--v||(e({type:"zoomend"}),r=null)}function D(){var t=this,r=_.of(t,arguments),n=0,a=e.select(o(t)).on(y,s).on(x,c),i=T(e.mouse(t)),l=be(t);function s(){n=1,M(e.mouse(t),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),O(r)}ml.call(t),S(r)}function P(){var t,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+e.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=e.select(r),p=be(r);function h(){var n=e.touches(r);return t=d.k,n.forEach((function(e){e.identifier in a&&(a[e.identifier]=T(e))})),n}function g(){var t=e.event.target;e.select(t).on(s,v).on(c,y),u.push(t);for(var n=e.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=e.touches(r);ml.call(r);for(var d=0,p=f.length;d360?e-=360:e<0&&(e+=360),e<60?n+(a-n)*e/60:e<180?a:e<240?n+(a-n)*(240-e)/60:n}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+t):r+t-r*t),new nt(i(e+120),i(e),i(e-120))}function Ze(t,r,n){return this instanceof Ze?(this.h=+t,this.c=+r,void(this.l=+n)):arguments.length<2?t instanceof Ze?new Ze(t.h,t.c,t.l):Ke(t instanceof We?t.l:(t=ut((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Ze(t,r,n)}qe.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new Ue(this.h,this.s,this.l/e)},qe.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new Ue(this.h,this.s,e*this.l)},qe.rgb=function(){return Ge(this.h,this.s,this.l)},e.hcl=Ze;var Ye=Ze.prototype=new Ve;function Xe(e,t,r){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new We(r,Math.cos(e*=Oe)*t,Math.sin(e)*t)}function We(e,t,r){return this instanceof We?(this.l=+e,this.a=+t,void(this.b=+r)):arguments.length<2?e instanceof We?new We(e.l,e.a,e.b):e instanceof Ze?Xe(e.h,e.c,e.l):ut((e=nt(e)).r,e.g,e.b):new We(e,t,r)}Ye.brighter=function(e){return new Ze(this.h,this.c,Math.min(100,this.l+Qe*(arguments.length?e:1)))},Ye.darker=function(e){return new Ze(this.h,this.c,Math.max(0,this.l-Qe*(arguments.length?e:1)))},Ye.rgb=function(){return Xe(this.h,this.c,this.l).rgb()},e.lab=We;var Qe=18,Je=We.prototype=new Ve;function $e(e,t,r){var n=(e+16)/116,a=n+t/500,i=n-r/200;return new nt(rt(3.2404542*(a=.95047*et(a))-1.5371385*(n=1*et(n))-.4985314*(i=1.08883*et(i))),rt(-.969266*a+1.8760108*n+.041556*i),rt(.0556434*a-.2040259*n+1.0572252*i))}function Ke(e,t,r){return e>0?new Ze(Math.atan2(r,t)*De,Math.sqrt(t*t+r*r),e):new Ze(NaN,NaN,e)}function et(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function tt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function rt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function nt(e,t,r){return this instanceof nt?(this.r=~~e,this.g=~~t,void(this.b=~~r)):arguments.length<2?e instanceof nt?new nt(e.r,e.g,e.b):st(""+e,nt,Ge):new nt(e,t,r)}function at(e){return new nt(e>>16,e>>8&255,255&e)}function it(e){return at(e)+""}Je.brighter=function(e){return new We(Math.min(100,this.l+Qe*(arguments.length?e:1)),this.a,this.b)},Je.darker=function(e){return new We(Math.max(0,this.l-Qe*(arguments.length?e:1)),this.a,this.b)},Je.rgb=function(){return $e(this.l,this.a,this.b)},e.rgb=nt;var ot=nt.prototype=new Ve;function lt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function st(e,t,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return t(dt(a[0]),dt(a[1]),dt(a[2]))}return(i=pt.get(e))?t(i.r,i.g,i.b):(null==e||"#"!==e.charAt(0)||isNaN(i=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===e.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),t(o,l,s))}function ct(e,t,r){var n,a,i=Math.min(e/=255,t/=255,r/=255),o=Math.max(e,t,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=e==o?(t-r)/l+(t0&&s<1?0:n),new Ue(n,a,s)}function ut(e,t,r){var n=tt((.4124564*(e=ft(e))+.3575761*(t=ft(t))+.1804375*(r=ft(r)))/.95047),a=tt((.2126729*e+.7151522*t+.072175*r)/1);return We(116*a-16,500*(n-a),200*(a-tt((.0193339*e+.119192*t+.9503041*r)/1.08883)))}function ft(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ot.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,r=this.g,n=this.b,a=30;return t||r||n?(t&&t=200&&t<300||304===t){try{e=a.call(o,c)}catch(e){return void l.error.call(o,e)}l.load.call(o,e)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var r=e.event;e.event=t;try{l.progress.call(o,c)}finally{e.event=r}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(r=null==e?null:e+"",o):r},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return a=e,o},["get","post"].forEach((function(e){o[e]=function(){return o.send.apply(o,[e].concat(n(arguments)))}})),o.send=function(e,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(e,t,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(e){a(null,e)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},e.rebind(o,l,"on"),null==i?o:o.get(function(e){return 1===e.length?function(t,r){e(null==t?r:null)}:e}(i))}pt.forEach((function(e,t){pt.set(e,at(t))})),e.functor=ht,e.xhr=gt(O),e.dsv=function(e,t){var r=new RegExp('["'+e+"\n]"),n=e.charCodeAt(0);function a(e,r,n){arguments.length<3&&(n=r,r=null);var a=vt(e,t,null==r?i:o(r),n);return a.row=function(e){return arguments.length?a.response(null==(r=e)?i:o(e)):r},a}function i(e){return a.parse(e.responseText)}function o(e){return function(t){return a.parse(t.responseText,e)}}function l(t){return t.map(s).join(e)}function s(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return a.parse=function(e,t){var r;return a.parseRows(e,(function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");r=t?function(e,r){return t(a(e),r)}:a}))},a.parseRows=function(e,t){var r,a,i={},o={},l=[],s=e.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var t=c;if(34===e.charCodeAt(t)){for(var r=t;r++24?(isFinite(t)&&(clearTimeout(bt),bt=setTimeout(Tt,t)),xt=0):(xt=1,_t(Tt))}function kt(){for(var e=Date.now(),t=mt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Mt(){for(var e,t=mt,r=1/0;t;)t.c?(t.t8?function(e){return e/r}:function(e){return e*r},symbol:e}}));function St(t){var r=t.decimal,n=t.thousands,a=t.grouping,i=t.currency,o=a&&n?function(e,t){for(var r=e.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>t&&(l=Math.max(1,t-s)),i.push(e.substring(r-=l,r+l)),!((s+=l+1)>t));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:O;return function(t){var n=Ct.exec(t),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Ot.get(h)||Dt;var b=u&&d;return function(t){var n=m;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(g<0){var c=e.formatPrefix(t,p);t=c.scale(t),n=c.symbol+m}else t*=g;var _,w,T=(t=h(t,p)).lastIndexOf(".");if(T<0){var k=x?t.lastIndexOf("e"):-1;k<0?(_=t,w=""):(_=t.substring(0,k),w=t.substring(k))}else _=t.substring(0,T),w=r+t.substring(T+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+t:"^"===l?A.substring(0,M>>=1)+i+t+A.substring(M):i+(b?t:A+t))+n}}}e.formatPrefix=function(t,r){var n=0;return(t=+t)&&(t<0&&(t*=-1),r&&(t=e.round(t,At(t,r))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Lt[8+n/3]};var Ct=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ot=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,r){return(t=e.round(t,At(t,r))).toFixed(Math.max(0,Math.min(20,At(t*(1+1e-15),r))))}});function Dt(e){return e+""}var Pt=e.time={},zt=Date;function Rt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Rt.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(){Et.setUTCDate.apply(this._,arguments)},setDay:function(){Et.setUTCDay.apply(this._,arguments)},setFullYear:function(){Et.setUTCFullYear.apply(this._,arguments)},setHours:function(){Et.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Et.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Et.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Et.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Et.setUTCSeconds.apply(this._,arguments)},setTime:function(){Et.setTime.apply(this._,arguments)}};var Et=Date.prototype;function It(e,t,r){function n(t){var r=e(t),n=i(r,1);return t-r1)for(;o=c)return-1;if(37===(a=t.charCodeAt(l++))){if(o=t.charAt(l++),!(i=w[o in Ht?t.charAt(l++):o])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(e){var t=u(e);function r(e){try{var r=new(zt=Rt);return r._=e,t(r)}finally{zt=Date}}return r.parse=function(e){try{zt=Rt;var r=t.parse(e);return r&&r._}finally{zt=Date}},r.toString=t.toString,r},u.multi=u.utc.multi=or;var d=e.map(),p=Ut(o),h=qt(o),g=Ut(l),v=qt(l),m=Ut(s),y=qt(s),x=Ut(c),b=qt(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var _={a:function(e){return l[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:u(r),d:function(e,t){return Vt(e.getDate(),t,2)},e:function(e,t){return Vt(e.getDate(),t,2)},H:function(e,t){return Vt(e.getHours(),t,2)},I:function(e,t){return Vt(e.getHours()%12||12,t,2)},j:function(e,t){return Vt(1+Pt.dayOfYear(e),t,3)},L:function(e,t){return Vt(e.getMilliseconds(),t,3)},m:function(e,t){return Vt(e.getMonth()+1,t,2)},M:function(e,t){return Vt(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Vt(e.getSeconds(),t,2)},U:function(e,t){return Vt(Pt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Vt(Pt.mondayOfYear(e),t,2)},x:u(n),X:u(a),y:function(e,t){return Vt(e.getFullYear()%100,t,2)},Y:function(e,t){return Vt(e.getFullYear()%1e4,t,4)},Z:ar,"%":function(){return"%"}},w={a:function(e,t,r){g.lastIndex=0;var n=g.exec(t.slice(r));return n?(e.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){p.lastIndex=0;var n=p.exec(t.slice(r));return n?(e.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){x.lastIndex=0;var n=x.exec(t.slice(r));return n?(e.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){m.lastIndex=0;var n=m.exec(t.slice(r));return n?(e.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,t,r){return f(e,_.c.toString(),t,r)},d:$t,e:$t,H:er,I:er,j:Kt,L:nr,m:Jt,M:tr,p:function(e,t,r){var n=d.get(t.slice(r,r+=2).toLowerCase());return null==n?-1:(e.p=n,r)},S:rr,U:Zt,w:Gt,W:Yt,x:function(e,t,r){return f(e,_.x.toString(),t,r)},X:function(e,t,r){return f(e,_.X.toString(),t,r)},y:Wt,Y:Xt,Z:Qt,"%":ir};return u}Pt.year=It((function(e){return(e=Pt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Pt.years=Pt.year.range,Pt.years.utc=Pt.year.utc.range,Pt.day=It((function(e){var t=new zt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Pt.days=Pt.day.range,Pt.days.utc=Pt.day.utc.range,Pt.dayOfYear=function(e){var t=Pt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var r=Pt[e]=It((function(e){return(e=Pt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)-(r!==t)}));Pt[e+"s"]=r.range,Pt[e+"s"].utc=r.utc.range,Pt[e+"OfYear"]=function(e){var r=Pt.year(e).getDay();return Math.floor((Pt.dayOfYear(e)+(r+t)%7)/7)}})),Pt.week=Pt.sunday,Pt.weeks=Pt.sunday.range,Pt.weeks.utc=Pt.sunday.utc.range,Pt.weekOfYear=Pt.sundayOfYear;var Ht={"-":"",_:" ",0:"0"},Bt=/^\s*\d+/,jt=/^%/;function Vt(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Qt(e,t,r){return/^[+-]\d{4}$/.test(t=t.slice(r,r+5))?(e.Z=-t,r+5):-1}function Jt(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function $t(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Kt(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+3));return n?(e.j=+n[0],r+n[0].length):-1}function er(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nr(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ar(e){var t=e.getTimezoneOffset(),r=t>0?"-":"+",n=y(t)/60|0,a=y(t)%60;return r+Vt(n,"0",2)+Vt(a,"0",2)}function ir(e,t,r){jt.lastIndex=0;var n=jt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function or(e){for(var t=e.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(t),c=Math.sin(t),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=e,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(e=o)*Oe,n=Math.cos(l=(t=l)*Oe/2+Ae/4),a=Math.sin(l)},Cr.lineEnd=function(){i(e,t)}}function Dr(e){var t=e[0],r=e[1],n=Math.cos(r);return[n*Math.cos(t),n*Math.sin(t),Math.sin(r)]}function Pr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zr(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Rr(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Er(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ir(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Fr(e){return[Math.atan2(e[1],e[0]),Ee(e[2])]}function Nr(e,t){return y(e[0]-t[0])ke?a=90:c<-ke&&(r=-90),f[0]=t,f[1]=n}};function p(e,i){u.push(f=[t=e,n=e]),ia&&(a=i)}function h(e,o){var l=Dr([e*Oe,o*Oe]);if(s){var c=zr(s,l),u=zr([c[1],-c[0],0],c);Ir(u),u=Fr(u);var f=e-i,d=f>0?1:-1,h=u[0]*De*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?e_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e):n>=t?(en&&(n=e)):e>i?_(t,e)>_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e)}else p(e,o);s=l,i=e}function g(){d.point=h}function v(){f[0]=t,f[1]=n,d.point=p,s=null}function m(e,t){if(s){var r=e-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=e,l=t;Cr.point(e,t),h(e,t)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>ke&&(t=-(n=180)),f[0]=t,f[1]=n,s=null}function _(e,t){return(t-=e)<0?t+360:t}function w(e,t){return e[0]-t[0]}function T(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,t=p[0],n=g[1])}return u=f=null,t===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,r],[n,a]]}}(),e.geo.centroid=function(t){mr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Lr=0,e.geo.stream(t,Hr);var r=Mr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Xr(e){if(t=e.length){for(var t,r,n=0,a=e[0];++n=0?1:-1,T=w*_,k=T>Ae,M=h*x;if(Sr.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*Le:_,k^d>=r^m>=r){var A=zr(Dr(f),Dr(e));Ir(A);var L=zr(a,A);Ir(L);var S=(k^_>=0?-1:1)*Ee(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=e}}return(i<-ke||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&t&&r.push(r.pop().concat(r.shift())),l.push(r.filter(Jr))}return u}}function Jr(e){return e.length>1}function $r(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,r){e.push([t,r])},lineEnd:R,buffer:function(){var r=t;return t=[],e=null,r},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Kr(e,t){return((e=e.x)[0]<0?e[1]-Ce-ke:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-ke:Ce-t[1])}var en=Qr(Zr,(function(e){var t,r=NaN,n=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var l=i>0?Ae:-Ae,s=y(i-r);y(s-Ae)0?Ce:-Ce),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),e.point(i,n),t=0):a!==l&&s>=Ae&&(y(r-a)ke?Math.atan((Math.sin(t)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(t))*Math.sin(e))/(a*i*o)):(t+n)/2}(r,n,i,o),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),t=0),e.point(r=i,n=o),a=l},lineEnd:function(){e.lineEnd(),r=n=NaN},clean:function(){return 2-t}}}),(function(e,t,r,n){var a;if(null==e)a=r*Ce,n.point(-Ae,a),n.point(0,a),n.point(Ae,a),n.point(Ae,0),n.point(Ae,-a),n.point(0,-a),n.point(-Ae,-a),n.point(-Ae,0),n.point(-Ae,a);else if(y(e[0]-t[0])>ke){var i=e[0]0,n=y(t)>ke;return Qr(a,(function(e){var t,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?Ae:-Ae),d):0;if(!t&&(c=s=g)&&e.lineStart(),g!==s&&(p=i(t,h),(Nr(t,p)||Nr(h,p))&&(h[0]+=ke,h[1]+=ke,g=a(h[0],h[1]))),g!==s)u=0,g?(e.lineStart(),p=i(h,t),e.point(p[0],p[1])):(p=i(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(n&&t&&r^g){var m;v&l||!(m=i(h,t,!0))||(u=0,r?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!g||t&&Nr(t,h)||e.point(h[0],h[1]),t=h,s=g,l=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(c&&s)<<1}}}),Nn(e,6*Oe),r?[0,-e]:[-Ae,e-Ae]);function a(e,r){return Math.cos(e)*Math.cos(r)>t}function i(e,r,n){var a=[1,0,0],i=zr(Dr(e),Dr(r)),o=Pr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&e;var c=t*o/s,u=-t*l/s,f=zr(a,i),d=Er(a,c);Rr(d,Er(i,u));var p=f,h=Pr(d,p),g=Pr(p,p),v=h*h-g*(Pr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Er(p,(-h-m)/g);if(Rr(x,d),x=Fr(x),!n)return x;var b,_=e[0],w=r[0],T=e[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-Ae)0^x[1]<(y(x[0]-_)Ae^(_<=x[0]&&x[0]<=w)){var L=Er(p,(-h+m)/g);return Rr(L,d),[x,Fr(L)]}}}function o(t,n){var a=r?e:Ae-e,i=0;return t<-a?i|=1:t>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(e,t,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=e-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(t,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=$r(),w=rn(t,r,n,a),T={point:A,lineStart:function(){T.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));T.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=e.merge(c);var r=function(e){for(var t=0,r=u.length,n=e[1],a=0;an&&ze(c,i,e)>0&&++t:i[1]<=n&&ze(c,i,e)<0&&--t,c=i;return 0!==t}([t,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),i&&Yr(c,o,r,k,s),s.polygonEnd()),c=u=f=null}};function k(e,o,s,c){var u=0,f=0;if(null==e||(u=i(e,s))!==(f=i(o,s))||l(e,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(e,i){return t<=e&&e<=n&&r<=i&&i<=a}function A(e,t){M(e,t)&&s.point(e,t)}function L(e,t){var r=M(e=Math.max(-1e9,Math.min(1e9,e)),t=Math.max(-1e9,Math.min(1e9,t)));if(u&&f.push([e,t]),y)d=e,p=t,h=r,y=!1,r&&(s.lineStart(),s.point(e,t));else if(r&&m)s.point(e,t);else{var n={a:{x:g,y:v},b:{x:e,y:t}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(e,t),x=!1)}g=e,v=t,m=r}return T};function i(e,a){return y(e[0]-t)0?0:3:y(e[0]-n)0?2:1:y(e[1]-r)0?1:0:a>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var r=i(e,1),n=i(t,1);return r!==n?r-n:0===r?t[1]-e[1]:1===r?e[0]-t[0]:2===r?e[1]-t[1]:t[0]-e[0]}}function an(e){var t=0,r=Ae/3,n=On(e),a=n(t,r);return a.parallels=function(e){return arguments.length?n(t=e[0]*Ae/180,r=e[1]*Ae/180):[t/Ae*180,r/Ae*180]},a}function on(e,t){var r=Math.sin(e),n=(r+Math.sin(t))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(e,t){var r=Math.sqrt(a-2*n*Math.sin(t))/n;return[r*Math.sin(e*=n),i-r*Math.cos(e)]}return o.invert=function(e,t){var r=i-t;return[Math.atan2(e,r)/n,Ee((a-(e*e+r*r)*n*n)/(2*n))]},o}e.geo.clipExtent=function(){var e,t,r,n,a,i,o={stream:function(e){return a&&(a.valid=!1),(a=i(e)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(e=+l[0][0],t=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=null),o):[[e,t],[r,n]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return an(on)}).raw=on,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){var t,r,n,a,i=e.geo.albers(),o=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(e,r){t=[e,r]}};function c(e){var i=e[0],o=e[1];return t=null,r(i,o),t||(n(i,o),t)||a(i,o),t}return c.invert=function(e){var t=i.scale(),r=i.translate(),n=(e[0]-r[0])/t,a=(e[1]-r[1])/t;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(e)},c.stream=function(e){var t=i.stream(e),r=o.stream(e),n=l.stream(e);return{point:function(e,a){t.point(e,a),r.point(e,a),n.point(e,a)},sphere:function(){t.sphere(),r.sphere(),n.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),l.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),l.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var t=i.scale(),u=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[u-.455*t,f-.238*t],[u+.455*t,f+.238*t]]).stream(s).point,n=o.translate([u-.307*t,f+.201*t]).clipExtent([[u-.425*t+ke,f+.12*t+ke],[u-.214*t-ke,f+.234*t-ke]]).stream(s).point,a=l.translate([u-.205*t,f+.212*t]).clipExtent([[u-.214*t+ke,f+.166*t+ke],[u-.115*t-ke,f+.234*t-ke]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:R,lineStart:R,lineEnd:R,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=R,ln+=y(sn/2)}};function hn(){var e,t,r,n;function a(e,t){sn+=n*e-r*t,r=e,n=t}pn.point=function(i,o){pn.point=a,e=r=i,t=n=o},pn.lineEnd=function(){a(e,t)}}var gn={point:function(e,t){efn&&(fn=e);tdn&&(dn=t)},lineStart:R,lineEnd:R,polygonStart:R,polygonEnd:R};function vn(){var e=mn(4.5),t=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=mn(t),r},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function n(r,n){t.push("M",r,",",n,e)}function a(e,n){t.push("M",e,",",n),r.point=i}function i(e,r){t.push("L",e,",",r)}function o(){r.point=n}function l(){t.push("Z")}return r}function mn(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var yn,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(e,t){xr+=e,br+=t,++_r}function _n(){var e,t;function r(r,n){var a=r-e,i=n-t,o=Math.sqrt(a*a+i*i);wr+=o*(e+r)/2,Tr+=o*(t+n)/2,kr+=o,bn(e=r,t=n)}xn.point=function(n,a){xn.point=r,bn(e=n,t=a)}}function wn(){xn.point=bn}function Tn(){var e,t,r,n;function a(e,t){var a=e-r,i=t-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+e)/2,Tr+=o*(n+t)/2,kr+=o,Mr+=(o=n*e-r*t)*(r+e),Ar+=o*(n+t),Lr+=3*o,bn(r=e,n=t)}xn.point=function(i,o){xn.point=a,bn(e=r=i,t=n=o)},xn.lineEnd=function(){a(e,t)}}function kn(e){var t=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=e,r},result:R};function n(r,n){e.moveTo(r+t,n),e.arc(r,n,t,0,Le)}function a(t,n){e.moveTo(t,n),r.point=i}function i(t,r){e.lineTo(t,r)}function o(){r.point=n}function l(){e.closePath()}return r}function Mn(e){var t=.5,r=Math.cos(30*Oe),n=16;function a(e){return(n?o:i)(e)}function i(t){return Sn(t,(function(r,n){r=e(r,n),t.point(r[0],r[1])}))}function o(t){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),v.lineStart=_},polygonEnd:function(){t.polygonEnd(),v.lineStart=y}};function m(r,n){r=e(r,n),t.point(r[0],r[1])}function y(){f=NaN,v.point=x,t.lineStart()}function x(r,a){var i=Dr([r,a]),o=e(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,t),t.point(f,d)}function b(){v.point=m,t.lineEnd()}function _(){y(),v.point=w,v.lineEnd=T}function w(e,t){x(r=e,t),a=f,i=d,o=p,s=h,c=g,v.point=x}function T(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,t),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*t&&v--){var w=o+p,T=s+h,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),L=y(y(k)-1)t||y((x*D+b*P)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(t)},a}function An(e){var t=Mn((function(t,r){return e([t*De,r*De])}));return function(e){return Dn(t(e))}}function Ln(e){this.stream=e}function Sn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Cn(e){return On((function(){return e}))()}function On(t){var r,n,a,i,o,l,s=Mn((function(e,t){return[(e=r(e,t))[0]*c+i,o-e[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=en,y=O,x=null,b=null;function _(e){return[(e=a(e[0]*Oe,e[1]*Oe))[0]*c+i,o-e[1]*c]}function w(e){return(e=a.invert((e[0]-i)/c,(o-e[1])/c))&&[e[0]*De,e[1]*De]}function T(){a=Gr(n=Rn(h,g,v),r);var e=r(d,p);return i=u-e[0]*c,o=f+e[1]*c,k()}function k(){return l&&(l.valid=!1,l=null),_}return _.stream=function(e){return l&&(l.valid=!1),(l=Dn(m(n,s(y(e))))).valid=!0,l},_.clipAngle=function(e){return arguments.length?(m=null==e?(x=e,en):tn((x=+e)*Oe),k()):x},_.clipExtent=function(e){return arguments.length?(b=e,y=e?nn(e[0][0],e[0][1],e[1][0],e[1][1]):O,k()):b},_.scale=function(e){return arguments.length?(c=+e,T()):c},_.translate=function(e){return arguments.length?(u=+e[0],f=+e[1],T()):[u,f]},_.center=function(e){return arguments.length?(d=e[0]%360*Oe,p=e[1]%360*Oe,T()):[d*De,p*De]},_.rotate=function(e){return arguments.length?(h=e[0]%360*Oe,g=e[1]%360*Oe,v=e.length>2?e[2]%360*Oe:0,T()):[h*De,g*De,v*De]},e.rebind(_,s,"precision"),function(){return r=t.apply(this,arguments),_.invert=r.invert&&w,T()}}function Dn(e){return Sn(e,(function(t,r){e.point(t*Oe,r*Oe)}))}function Pn(e,t){return[e,t]}function zn(e,t){return[e>Ae?e-Le:e<-Ae?e+Le:e,t]}function Rn(e,t,r){return e?t||r?Gr(In(e),Fn(t,r)):In(e):t||r?Fn(t,r):zn}function En(e){return function(t,r){return[(t+=e)>Ae?t-Le:t<-Ae?t+Le:t,r]}}function In(e){var t=En(e);return t.invert=En(-e),t}function Fn(e,t){var r=Math.cos(e),n=Math.sin(e),a=Math.cos(t),i=Math.sin(t);function o(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),Ee(u*a+s*i)]}return o.invert=function(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),Ee(u*r-l*n)]},o}function Nn(e,t){var r=Math.cos(e),n=Math.sin(e);return function(a,i,o,l){var s=o*t;null!=a?(a=Hn(r,a),i=Hn(r,i),(o>0?ai)&&(a+=o*Le)):(a=e+o*Le,i=e-.5*s);for(var c,u=a;o>0?u>i:u2?e[2]*Oe:0),t.invert=function(t){return(t=e.invert(t[0]*Oe,t[1]*Oe))[0]*=De,t[1]*=De,t},t},zn.invert=Pn,e.geo.circle=function(){var e,t,r=[0,0],n=6;function a(){var e="function"==typeof r?r.apply(this,arguments):r,n=Rn(-e[0]*Oe,-e[1]*Oe,0).invert,a=[];return t(null,null,1,{point:function(e,t){a.push(e=n(e,t)),e[0]*=De,e[1]*=De}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(e){return arguments.length?(r=e,a):r},a.angle=function(r){return arguments.length?(t=Nn((e=+r)*Oe,n*Oe),a):e},a.precision=function(r){return arguments.length?(t=Nn(e*Oe,(n=+r)*Oe),a):n},a.angle(90)},e.geo.distance=function(e,t){var r,n=(t[0]-e[0])*Oe,a=e[1]*Oe,i=t[1]*Oe,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},e.geo.graticule=function(){var t,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(a/g)*g,n,g).map(f).concat(e.range(Math.ceil(s/v)*v,l,v).map(d)).concat(e.range(Math.ceil(r/p)*p,t,p).filter((function(e){return y(e%g)>ke})).map(c)).concat(e.range(Math.ceil(o/h)*h,i,h).filter((function(e){return y(e%v)>ke})).map(u))}return x.lines=function(){return b().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(a=+e[0][0],n=+e[1][0],s=+e[0][1],l=+e[1][1],a>n&&(e=a,a=n,n=e),s>l&&(e=s,s=l,l=e),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(e){return arguments.length?(r=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],r>t&&(e=r,r=t,t=e),o>i&&(e=o,o=i,i=e),x.precision(m)):[[r,o],[t,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],x):[g,v]},x.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],x):[p,h]},x.precision=function(e){return arguments.length?(m=+e,c=Bn(o,i,90),u=jn(r,t,m),f=Bn(s,l,90),d=jn(a,n,m),x):m},x.majorExtent([[-180,-90+ke],[180,90-ke]]).minorExtent([[-180,-80-ke],[180,80+ke]])},e.geo.greatArc=function(){var t,r,n=Vn,a=Un;function i(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return e.geo.distance(t||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,i):n},i.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,i):a},i.precision=function(){return arguments.length?i:0},i},e.geo.interpolate=function(e,t){return r=e[0]*Oe,n=e[1]*Oe,a=t[0]*Oe,i=t[1]*Oe,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Fe(i-n)+o*s*Fe(a-r))),g=1/Math.sin(h),(v=h?function(e){var t=Math.sin(e*=h)*g,r=Math.sin(h-e)*g,n=r*u+t*d,a=r*f+t*p,i=r*l+t*c;return[Math.atan2(a,n)*De,Math.atan2(i,Math.sqrt(n*n+a*a))*De]}:function(){return[r*De,n*De]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},e.geo.length=function(t){return yn=0,e.geo.stream(t,qn),yn};var qn={sphere:R,point:R,lineStart:function(){var e,t,r;function n(n,a){var i=Math.sin(a*=Oe),o=Math.cos(a),l=y((n*=Oe)-e),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-t*o*s)*l),t*i+r*o*s),e=n,t=i,r=o}qn.point=function(a,i){e=a*Oe,t=Math.sin(i*=Oe),r=Math.cos(i),qn.point=n},qn.lineEnd=function(){qn.point=qn.lineEnd=R}},lineEnd:R,polygonStart:R,polygonEnd:R};function Gn(e,t){function r(t,r){var n=Math.cos(t),a=Math.cos(r),i=e(n*a);return[i*a*Math.sin(t),i*Math.sin(r)]}return r.invert=function(e,r){var n=Math.sqrt(e*e+r*r),a=t(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(e*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(e.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Yn=Gn((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),O);function Xn(e,t){var r=Math.cos(e),n=function(e){return Math.tan(Ae/4+e/2)},a=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(n(t)/n(e)),i=r*Math.pow(n(e),a)/a;if(!a)return Jn;function o(e,t){i>0?t<-Ce+ke&&(t=-Ce+ke):t>Ce-ke&&(t=Ce-ke);var r=i/Math.pow(n(t),a);return[r*Math.sin(a*e),i-r*Math.cos(a*e)]}return o.invert=function(e,t){var r=i-t,n=Pe(a)*Math.sqrt(e*e+r*r);return[Math.atan2(e,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ce]},o}function Wn(e,t){var r=Math.cos(e),n=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),a=r/n+e;if(y(n)1&&ze(e[r[n-2]],e[r[n-1]],e[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(e,t){return e[0]-t[0]||e[1]-t[1]}(e.geo.stereographic=function(){return Cn(ea)}).raw=ea,ta.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ce]},(e.geo.transverseMercator=function(){var e=$n(ta),t=e.center,r=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?r([e[0],e[1],e.length>2?e[2]+90:90]):[(e=r())[0],e[1],e[2]-90]},r([0,0,90])}).raw=ta,e.geom={},e.geom.hull=function(e){var t=ra,r=na;if(arguments.length)return n(e);function n(e){if(e.length<3)return[];var n,a=ht(t),i=ht(r),o=e.length,l=[],s=[];for(n=0;n=0;--n)p.push(e[l[c[n]][2]]);for(n=+f;nke)l=l.L;else{if(!((a=i-Ta(l,o))>ke)){n>-ke?(t=l.P,r=l):a>-ke?(t=l,r=l.N):t=r=l;break}if(!l.R){t=l;break}l=l.R}var s=ya(e);if(da.insert(t,s),t||r){if(t===r)return Sa(t),r=ya(t.site),da.insert(s,r),s.edge=r.edge=Da(t.site,s.site),La(t),void La(r);if(r){Sa(t),Sa(r);var c=t.site,u=c.x,f=c.y,d=e.x-u,p=e.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};za(r.edge,c,h,b),s.edge=Da(c,e,null,b),r.edge=Da(e,h,null,b),La(t),La(r)}else s.edge=Da(t.site,s.site)}}function wa(e,t){var r=e.site,n=r.x,a=r.y,i=a-t;if(!i)return n;var o=e.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-t;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function Ta(e,t){var r=e.N;if(r)return wa(r,t);var n=e.site;return n.y===t?n.x:1/0}function ka(e){this.site=e,this.edges=[]}function Ma(e,t){return t.angle-e.angle}function Aa(){Ia(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(e){var t=e.P,r=e.N;if(t&&r){var n=t.site,a=e.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Me)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=e,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,e.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xke||y(a-r)>ke)&&(l.splice(o,0,new Ra(Pa(i.site,u,y(n-f)ke?{x:f,y:y(t-f)ke?{x:y(r-h)ke?{x:d,y:y(t-d)ke?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=e[l]})),t}function l(e){return e.map((function(e,t){return{x:Math.round(n(e,t)/ke)*ke,y:Math.round(a(e,t)/ke)*ke,i:t}}))}return o.links=function(e){return Ba(l(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return Ba(l(e)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|t>=b,T=w+4;wi&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=$a.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,T=v-h;function k(e,t,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(e.leaf){var s=e.x,c=e.y;if(null!=s)if(y(s-r)+y(c-n)<.01)M(e,t,r,n,a,i,o,l);else{var u=e.point;e.x=e.y=e.point=null,M(e,u,s,c,a,i,o,l),M(e,t,r,n,a,i,o,l)}else e.x=r,e.y=n,e.point=t}else M(e,t,r,n,a,i,o,l)}function M(e,t,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;e.leaf=!1,u?a=s:o=s,f?i=c:l=c,k(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,r,n,a,i,o,l)}w>T?v=h+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){k(A,e,+m(e,++f),+x(e,f),p,h,g,v)},visit:function(e){Ga(e,A,p,h,g,v)},find:function(e){return Za(A,e[0],e[1],p,h,g,v)}};if(f=-1,null==t){for(;++f=0&&!(n=e.interpolators[a](t,r)););return n}function ei(e,t){var r,n=[],a=[],i=e.length,o=t.length,l=Math.min(e.length,t.length);for(r=0;r=1?1:e(t)}}function ii(e){return function(t){return 1-e(1-t)}}function oi(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function li(e){return e*e}function si(e){return e*e*e}function ci(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function ui(e){return 1-Math.cos(e*Ce)}function fi(e){return Math.pow(2,10*(e-1))}function di(e){return 1-Math.sqrt(1-e*e)}function pi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function hi(e,t){return t-=e,function(r){return Math.round(e+t*r)}}function gi(e){var t,r,n,a=[e.a,e.b],i=[e.c,e.d],o=mi(a),l=vi(a,i),s=mi(((t=i)[0]+=(n=-l)*(r=a)[0],t[1]+=n*r[1],t))||0;a[0]*i[1]=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):"in";return n=ri.get(n)||ti,ai((a=ni.get(a)||O)(n.apply(null,r.call(arguments,1))))},e.interpolateHcl=function(t,r){t=e.hcl(t),r=e.hcl(r);var n=t.h,a=t.c,i=t.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Xe(n+o*e,a+l*e,i+s*e)+""}},e.interpolateHsl=function(t,r){t=e.hsl(t),r=e.hsl(r);var n=t.h,a=t.s,i=t.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ge(n+o*e,a+l*e,i+s*e)+""}},e.interpolateLab=function(t,r){t=e.lab(t),r=e.lab(r);var n=t.l,a=t.a,i=t.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(e){return $e(n+o*e,a+l*e,i+s*e)+""}},e.interpolateRound=hi,e.transform=function(t){var r=a.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(null!=e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate()}return new gi(t?t.matrix:yi)})(t)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(e){return e.length?e.pop()+",":""}function bi(t,r){var n=[],a=[];return t=e.transform(t),r=e.transform(r),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}(t.translate,r.translate,n,a),function(e,t,r,n){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(e,t)})):t&&r.push(xi(r)+"rotate("+t+")")}(t.rotate,r.rotate,n,a),function(e,t,r,n){e!==t?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(e,t)}):t&&r.push(xi(r)+"skewX("+t+")")}(t.skew,r.skew,n,a),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else 1===t[0]&&1===t[1]||r.push(xi(r)+"scale("+t+")")}(t.scale,r.scale,n,a),t=r=null,function(e){for(var t,r=-1,i=a.length;++r0?n=e:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:n=0})):e>0&&(s.start({type:"start",alpha:n=e}),t=wt(l.tick)),l):n},l.start=function(){var e,t,r,n=m.length,s=y.length,u=c[0],h=c[1];for(e=0;e=0;)r.push(a[n])}function Ri(e,t){for(var r=[e],n=[];null!=(e=r.pop());)if(n.push(e),(i=e.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ri(a,(function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)})),l}return n.sort=function(t){return arguments.length?(e=t,n):e},n.children=function(e){return arguments.length?(t=e,n):t},n.value=function(e){return arguments.length?(r=e,n):r},n.revalue=function(e){return r&&(zi(e,(function(e){e.children&&(e.value=0)})),Ri(e,(function(e){var t;e.children||(e.value=+r.call(n,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},n},e.layout.partition=function(){var t=e.layout.hierarchy(),r=[1,1];function n(e,n){var a=t.call(this,e,n);return function e(t,r,n,a){var i=t.children;if(t.x=r,t.y=t.depth*a,t.dx=n,t.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=t.value?n/t.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=t);return n}function Xi(e){return e.reduce(Wi,0)}function Wi(e,t){return e+t[1]}function Qi(e,t){return Ji(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Ji(e,t){for(var r=-1,n=+e[0],a=(e[1]-n)/t,i=[];++r<=t;)i[r]=a*r+n;return i}function $i(t){return[e.min(t),e.max(t)]}function Ki(e,t){return e.value-t.value}function eo(e,t){var r=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=r,r._pack_prev=t}function to(e,t){e._pack_next=t,t._pack_prev=e}function ro(e,t){var r=t.x-e.x,n=t.y-e.y,a=e.r+t.r;return.999*a*a>r*r+n*n}function no(e){if((t=e.children)&&(s=t.length)){var t,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(t.forEach(ao),(r=t[0]).x=-r.r,r.y=0,x(r),s>1&&((n=t[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=t[2]),x(a),eo(r,a),r._pack_prev=a,eo(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[e.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(e){return arguments.length?(r=e,i):r},i.range=function(e){return arguments.length?(n=ht(e),i):n},i.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return Ji(t,e)}:ht(e),i):a},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},e.layout.pack=function(){var t,r=e.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(e,i){var o=r.call(this,e,i),l=o[0],s=a[0],c=a[1],u=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(l.x=l.y=0,Ri(l,(function(e){e.r=+u(e.value)})),Ri(l,no),n){var f=n*(t?1:Math.max(2*l.r/s,2*l.r/c))/2;Ri(l,(function(e){e.r+=f})),Ri(l,no),Ri(l,(function(e){e.r-=f}))}return function e(t,r,n,a){var i=t.children;if(t.x=r+=a*t.x,t.y=n+=a*t.y,t.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);zi(u,(function(e){e.x=(e.x+g)*v,e.y=e.depth*m}))}return c}function o(e){var t=e.children,n=e.parent.children,a=e.i?n[e.i-1]:null;if(t.length){!function(e){var t,r=0,n=0,a=e.children,i=a.length;for(;--i>=0;)(t=a[i]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;a?(e.z=a.z+r(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+r(e._,a._));e.parent.A=function(e,t,n){if(t){for(var a,i=e,o=e,l=t,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=e,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,e,n),e,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=e)}return n}(e,a,e.parent.A||n[0])}function l(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e)?s:null,i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null==(n=e)?null:s,i):a?n:null},Pi(i,t)},e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=t.call(this,i,o),c=s[0],u=0;Ri(c,(function(t){var n=t.children;n&&n.length?(t.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),t.y=function(t){return 1+e.max(t,(function(e){return e.y}))}(n)):(t.x=l?u+=r(t,l):0,t.y=0,l=t)}));var f=function e(t){var r=t.children;return r&&r.length?e(r[0]):t}(c),d=function e(t){var r,n=t.children;return n&&(r=n.length)?e(n[r-1]):t}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return Ri(c,a?function(e){e.x=(e.x-c.x)*n[0],e.y=(c.y-e.y)*n[1]}:function(e){e.x=(e.x-p)/(h-p)*n[0],e.y=(1-(c.y?e.y/c.y:1))*n[1]}),s}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e),i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null!=(n=e),i):a?n:null},Pi(i,t)},e.layout.treemap=function(){var t,r=e.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(e,t){for(var r,n,a=-1,i=e.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var r,n=o(e),a=t.slice(),i=[];for(u(a,n.dx*n.dy/e.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);t.forEach(d)}}function p(e,t){for(var r,n=e.area,a=0,i=1/0,o=-1,l=e.length;++oa&&(a=r));return t*=t,(n*=n)?Math.max(t*a*c/n,n/(t*i*c)):1/0}function h(e,t,r,a){var i,o=-1,l=e.length,s=r.x,c=r.y,u=t?n(e.area/t):0;if(t==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return e+t*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var r=e.random.irwinHall(t);return function(){return r()/t}},irwinHall:function(e){return function(){for(var t=0,r=0;r2?_o:mo,l=a?wi:_i;return i=e(t,r,l,n),o=e(r,t,l,Ka),s}function s(e){return i(e)}return s.invert=function(e){return o(e)},s.domain=function(e){return arguments.length?(t=e.map(Number),l()):t},s.range=function(e){return arguments.length?(r=e,l()):r},s.rangeRound=function(e){return s.range(e).interpolate(hi)},s.clamp=function(e){return arguments.length?(a=e,l()):a},s.interpolate=function(e){return arguments.length?(n=e,l()):n},s.ticks=function(e){return Mo(t,e)},s.tickFormat=function(e,r){return Ao(t,e,r)},s.nice=function(e){return To(t,e),l()},s.copy=function(){return e(t,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}e.scale.log=function(){return function t(r,n,a,i){function o(e){return(a?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function l(e){return a?Math.pow(n,e):-Math.pow(n,-e)}function s(e){return r(o(e))}return s.invert=function(e){return l(r.invert(e))},s.domain=function(e){return arguments.length?(a=e[0]>=0,r.domain((i=e.map(Number)).map(o)),s):i},s.base=function(e){return arguments.length?(n=+e,r.domain(i.map(o)),s):n},s.nice=function(){var e=yo(i.map(o),a?Math:Oo);return r.domain(e),i=e.map(l),s},s.ticks=function(){var e=go(i),t=[],r=e[0],s=e[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)t.push(l(c)*d);for(c=0;t[c]s;u--);t=t.slice(c,u)}return t},s.tickFormat=function(t,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=e.format(r));var a=Math.max(1,n*t/s.ticks().length);return function(e){var t=e/l(Math.round(o(e)));return t*n0?a[e-1]:r[0],ef?0:1;if(c=Se)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,T,k,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=Ee(v/c*Math.sin(m))),l&&(A=Ee(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Ae?0:1;if(L&&Uo(y,x,b,_)===p^C){var O=(u+f)/2;y=c*Math.cos(O),x=c*Math.sin(O),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),T=l*Math.sin(f-A),k=l*Math.cos(u+A),M=l*Math.sin(u+A);var D=Math.abs(u-f+2*A)<=Ae?0:1;if(A&&Uo(w,T,k,M)===1-p^D){var P=(u+f)/2;w=l*Math.cos(P),T=l*Math.sin(P),k=M=null}}else w=T=0;if(d>ke&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function qo(e,t,r,n,a){var i=e[0]-t[0],o=e[1]-t[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=e[0]+s,f=e[1]+c,d=t[0]+s,p=t[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,T=(-b*v-m*_)/y,k=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=T-g,S=k-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=k,T=M),[[w-s,T-c],[w*r/x,T*r/x]]}function Go(e){var t=ra,r=na,n=Zr,a=Yo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=ht(t),p=ht(r);function h(){s.push("M",a(e(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Qo,basis:Ko,"basis-open":function(e){if(e.length<4)return Yo(e);var t,r=[],n=-1,a=e.length,i=[0],o=[0];for(;++n<3;)t=e[n],i.push(t[0]),o.push(t[1]);r.push(el(nl,i)+","+el(nl,o)),--n;for(;++n9&&(a=3*t/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(e[Math.min(s,l+1)][0]-e[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(e))}});function Yo(e){return e.length>1?e.join("L"):e+"Z"}function Xo(e){return e.join("L")+"Z"}function Wo(e){for(var t=0,r=e.length,n=e[0],a=[n[0],",",n[1]];++t1){l=t[1],i=e[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAe)+",1 "+t}function s(e,t,r,n){return"Q 0,0 "+n}return i.radius=function(e){return arguments.length?(r=ht(e),i):r},i.source=function(t){return arguments.length?(e=ht(t),i):e},i.target=function(e){return arguments.length?(t=ht(e),i):t},i.startAngle=function(e){return arguments.length?(n=ht(e),i):n},i.endAngle=function(e){return arguments.length?(a=ht(e),i):a},i},e.svg.diagonal=function(){var e=Vn,t=Un,r=cl;function n(n,a){var i=e.call(this,n,a),o=t.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(t){return arguments.length?(e=ht(t),n):e},n.target=function(e){return arguments.length?(t=ht(e),n):t},n.projection=function(e){return arguments.length?(r=e,n):r},n},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),r=cl,n=t.projection;return t.projection=function(e){return arguments.length?n(ul(r=e)):r},t},e.svg.symbol=function(){var e=dl,t=fl;function r(r,n){return(hl.get(e.call(this,r,n))||pl)(t.call(this,r,n))}return r.type=function(t){return arguments.length?(e=ht(t),r):e},r.size=function(e){return arguments.length?(t=ht(e),r):t},r};var hl=e.map({circle:pl,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vl)),r=t*vl;return"M0,"+-t+"L"+r+",0 0,"+t+" "+-r+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});e.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Oe);Z.transition=function(e){for(var t,r,n=bl||++Tl,a=Al(e),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(e,o);if(i>=1)return f.event&&f.event.end.call(e,e.__data__,t),--u.count?delete u[n]:delete e[r],1}f||(i=a.time,o=wt((function(e){var t=f.delay;if(o.t=t+i,t<=e)return d(e-t);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:t},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,e.transition=function(t,r){return t&&t.transition?bl?t.transition(r):t:e.selection().transition(t)},e.transition.prototype=wl,wl.select=function(e){var t,r,n,a=this.id,i=this.namespace,o=[];e=Y(e);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=e.select(e.event.target),x=n.of(m,arguments),b=e.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=be(m),A=e.mouse(m),L=e.select(o(m)).on("keydown.brush",O).on("keyup.brush",D);if(e.event.changedTouches?L.on("touchmove.brush",P).on("touchend.brush",R):L.on("mousemove.brush",P).on("mouseup.brush",R),b.interrupt().selectAll("*").interrupt(),k)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else e.event.altKey&&(f=A.slice());function O(){32==e.event.keyCode&&(k||(f=null,A[0]-=l[1],A[1]-=s[1],k=2),F())}function D(){32==e.event.keyCode&&2==k&&(A[0]+=l[1],A[1]+=s[1],k=0,F())}function P(){var t=e.mouse(m),r=!1;v&&(t[0]+=v[0],t[1]+=v[1]),k||(e.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(t[0]1?{floor:function(t){for(;l(t=e.floor(t));)t=Hl(t-1);return t},ceil:function(t){for(;l(t=e.ceil(t));)t=Hl(+t+1);return t}}:e))},a.ticks=function(e,t){var r=go(a.domain()),n=null==e?i(r,10):"number"==typeof e?i(r,e):!e.range&&[{range:e},t];return n&&(e=n[0],t=n[1]),e.range(r[0],Hl(+r[1]+1),t<1?1:t)},a.tickFormat=function(){return n},a.copy=function(){return Nl(t.copy(),r,n)},wo(a,t)}function Hl(e){return new Date(e)}Rl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Il,Fl.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Fl.toString=Il.toString,Pt.second=It((function(e){return new zt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Pt.seconds=Pt.second.range,Pt.seconds.utc=Pt.second.utc.range,Pt.minute=It((function(e){return new zt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Pt.minutes=Pt.minute.range,Pt.minutes.utc=Pt.minute.utc.range,Pt.hour=It((function(e){var t=e.getTimezoneOffset()/60;return new zt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Pt.hours=Pt.hour.range,Pt.hours.utc=Pt.hour.utc.range,Pt.month=It((function(e){return(e=Pt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Pt.months=Pt.month.range,Pt.months.utc=Pt.month.utc.range;var Bl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],jl=[[Pt.second,1],[Pt.second,5],[Pt.second,15],[Pt.second,30],[Pt.minute,1],[Pt.minute,5],[Pt.minute,15],[Pt.minute,30],[Pt.hour,1],[Pt.hour,3],[Pt.hour,6],[Pt.hour,12],[Pt.day,1],[Pt.day,2],[Pt.week,1],[Pt.month,1],[Pt.month,3],[Pt.year,1]],Vl=Rl.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Zr]]),Ul={range:function(t,r,n){return e.range(Math.ceil(t/n)*n,+r,n).map(Hl)},floor:O,ceil:O};jl.year=Pt.year,Pt.scale=function(){return Nl(e.scale.linear(),jl,Vl)};var ql=jl.map((function(e){return[e[0].utc,e[1]]})),Gl=El.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Zr]]);function Zl(e){return JSON.parse(e.responseText)}function Yl(e){var t=a.createRange();return t.selectNode(a.body),t.createContextualFragment(e.responseText)}ql.year=Pt.year.utc,Pt.scale.utc=function(){return Nl(e.scale.linear(),ql,Gl)},e.text=gt((function(e){return e.responseText})),e.json=function(e,t){return vt(e,"application/json",Zl,t)},e.html=function(e,t){return vt(e,"text/html",Yl,t)},e.xml=gt((function(e){return e.responseXML})),"object"==typeof t&&t.exports?t.exports=e:this.d3=e}()},{}],17:[function(e,t,r){(function(n,a){(function(){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -12,10 +12,10 @@ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ -!function(e,n){"object"==typeof r&&"undefined"!=typeof t?t.exports=n():e.ES6Promise=n()}(this,(function(){"use strict";function t(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,o=void 0,l=void 0,s=function(e,t){g[i]=e,g[i+1]=t,2===(i+=2)&&(l?l(v):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},f=u.MutationObserver||u.WebKitMutationObserver,d="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(v,1)}}var g=new Array(1e3);function v(){for(var e=0;e13)&&32!==t&&133!==t&&160!==t&&5760!==t&&6158!==t&&(t<8192||t>8205)&&8232!==t&&8233!==t&&8239!==t&&8287!==t&&8288!==t&&12288!==t&&65279!==t)return!1;return!0}},{}],24:[function(e,t,r){var n={left:0,top:0};t.exports=function(e,t,r){t=t||e.currentTarget||e.srcElement,Array.isArray(r)||(r=[0,0]);var a=e.clientX||0,i=e.clientY||0,o=(l=t,l===window||l===document||l===document.body?n:l.getBoundingClientRect());var l;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],25:[function(e,t,r){t.exports=function(e){var t=[];return e.replace(a,(function(e,r,a){var o=r.toLowerCase();for(a=function(e){var t=e.match(i);return t?t.map(Number):[]}(a),"m"==o&&a.length>2&&(t.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),t.push(a);if(a.length13)&&32!==t&&133!==t&&160!==t&&5760!==t&&6158!==t&&(t<8192||t>8205)&&8232!==t&&8233!==t&&8239!==t&&8287!==t&&8288!==t&&12288!==t&&65279!==t)return!1;return!0}},{}],53:[function(e,t,r){var n={left:0,top:0};t.exports=function(e,t,r){t=t||e.currentTarget||e.srcElement,Array.isArray(r)||(r=[0,0]);var a=e.clientX||0,i=e.clientY||0,o=(l=t,l===window||l===document||l===document.body?n:l.getBoundingClientRect());var l;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],54:[function(e,t,r){t.exports=function(e){var t=[];return e.replace(a,(function(e,r,a){var o=r.toLowerCase();for(a=function(e){var t=e.match(i);return t?t.map(Number):[]}(a),"m"==o&&a.length>2&&(t.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),t.push(a);if(a.length=-e},pointBetween:function(t,r,n){var a=t[1]-r[1],i=n[0]-r[0],o=t[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-e)},pointsSameX:function(t,r){return Math.abs(t[0]-r[0])e!=o-a>e&&(i-c)*(a-u)/(o-u)+c-n>e&&(l=!l),i=c,o=u}return l}};return t}},{}],29:[function(e,t,r){var n={toPolygon:function(e,t){function r(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function r(t){var r=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[r]})}for(var n=r(t[0]),a=1;a0}))}function u(e,n){var a=e.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=t.linesIntersect(o,l,c,u);if(!1===f){if(!t.pointsCollinear(o,l,c))return!1;if(t.pointsSame(o,u)||t.pointsSame(l,c))return!1;var d=t.pointsSame(o,c),p=t.pointsSame(l,u);if(d&&p)return n;var h=!d&&t.pointBetween(o,c,u),g=!p&&t.pointBetween(l,c,u);if(d)return g?s(n,l):s(e,u),n;h&&(p||(g?s(n,l):s(e,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(e,c):0===f.alongB?s(e,f.pt):1===f.alongB&&s(e,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var e=u(d,h);if(e)return e}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(e)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(e)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return e?{addRegion:function(e){for(var n,a,i,o=e[e.length-1],s=0;s1)for(var r=1;r1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=O(e,360),t=O(t,100),r=O(r,100),0===t)n=a=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,s=2*r-l;n=o(s,l,e+1/3),a=o(s,l,e),i=o(s,l,e-1/3)}return{r:255*n,g:255*a,b:255*i}}(t.h,s,u),f=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,h,g;return i=C(i),{ok:f,format:t.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(e,t,r){e=O(e,255),t=O(t,255),r=O(r,255);var n,a,i=l(e,t,r),s=o(e,t,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case e:n=(t-r)/u+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/t;t--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.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 e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,n,a=this.toRgb();return t=a.r/255,r=a.g/255,n=a.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[z(i(e).toString(16)),z(i(t).toString(16)),z(i(r).toString(16)),z(R(n))];if(a&&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,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=c(e);r="#"+p(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));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(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:E(e[n]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),a=c(t).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(t,r){var n=c(t),a=c(r);return(e.max(n.getLuminance(),a.getLuminance())+.05)/(e.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,a,i=c.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(e,t,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(t[u]));return c.isReadable(e,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],r))};var L=c.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=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(L);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function O(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,l(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function D(e){return o(1,l(0,e))}function P(e){return parseInt(e,16)}function z(e){return 1==e.length?"0"+e:""+e}function E(e){return e<=1&&(e=100*e+"%"),e}function R(t){return e.round(255*parseFloat(t)).toString(16)}function I(e){return P(e)/255}var F,N,H,B=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",H="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+H),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+H),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+H),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 j(e){return!!B.CSS_UNIT.exec(e)}"undefined"!=typeof t&&t.exports?t.exports=c:window.tinycolor=c}(Math)},{}],36:[function(e,t,r){"use strict";t.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}]},{}],37:[function(e,t,r){"use strict";var n=e("./arrow_paths"),a=e("../../plots/font_attributes"),i=e("../../plots/cartesian/constants"),o=e("../../plot_api/plot_template").templatedArray;t.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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":213,"../../plots/cartesian/constants":229,"../../plots/font_attributes":251,"./arrow_paths":36}],38:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("./draw").draw;function o(e){var t=e._fullLayout;n.filterVisible(t.annotations).forEach((function(t){var r=a.getFromId(e,t.xref),n=a.getFromId(e,t.yref);t._extremes={},r&&l(t,r),n&&l(t,n)}))}function l(e,t){var r,n=t._id,i=n.charAt(0),o=e[i],l=e["a"+i],s=e[i+"ref"],c=e["a"+i+"ref"],u=e["_"+i+"padplus"],f=e["_"+i+"padminus"],d={x:1,y:-1}[i]*e[i+"shift"],p=3*e.arrowsize*e.arrowwidth||0,h=p+d,g=p-d,v=3*e.startarrowsize*e.arrowwidth||0,m=v+d,y=v-d;if(c===s){var x=a.findExtremes(t,[t.r2c(o)],{ppadplus:h,ppadminus:g}),b=a.findExtremes(t,[t.r2c(l)],{ppadplus:Math.max(u,m),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else m=l?m+l:m,y=l?y-l:y,r=a.findExtremes(t,[t.r2c(o)],{ppadplus:Math.max(u,h,m),ppadminus:Math.max(f,g,y)});e._extremes[n]=r}t.exports=function(e){var t=e._fullLayout;if(n.filterVisible(t.annotations).length&&e._fullData.length)return n.syncOrAsync([i,o],e)}},{"../../lib":179,"../../plots/cartesian/axes":223,"./draw":43}],39:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("../../plot_api/plot_template").arrayEditor;function o(e,t){var r,n,a,i,o,s,c,u=e._fullLayout.annotations,f=[],d=[],p=[],h=(t||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(e,t){var r,l,s=o(e,t),c=s.on,u=s.off.concat(s.explicitOff),f={},d=e._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[t]}for(var q=!1,G=["x","y"],Z=0;Z1)&&(ee===K?((ce=te.r2fraction(t["a"+$]))<0||ce>1)&&(q=!0):q=!0),Y=te._offset+te.r2p(t[$]),Q=.5}else"x"===$?(W=t[$],Y=b.l+b.w*W):(W=1-t[$],Y=b.t+b.h*W),Q=t.showarrow?.5:W;if(t.showarrow){se.head=Y;var ue=t["a"+$];J=ne*j(.5,t.xanchor)-ae*j(.5,t.yanchor),ee===K?(se.tail=te._offset+te.r2p(ue),X=J):(se.tail=Y+ue,X=J+ue),se.text=se.tail+J;var fe=x["x"===$?"width":"height"];if("paper"===K&&(se.head=o.constrain(se.head,1,fe-1)),"pixel"===ee){var de=-Math.max(se.tail-3,se.text),pe=Math.min(se.tail+3,se.text)-fe;de>0?(se.tail+=de,se.text+=de):pe>0&&(se.tail-=pe,se.text-=pe)}se.tail+=le,se.head+=le}else X=J=ie*j(Q,oe),se.text=Y+J;se.text+=le,J+=le,X+=le,t["_"+$+"padplus"]=ie/2+X,t["_"+$+"padminus"]=ie/2-X,t["_"+$+"size"]=ie,t["_"+$+"shift"]=J}if(q)z.remove();else{var he=0,ge=0;if("left"!==t.align&&(he=(w-m)*("center"===t.align?.5:1)),"top"!==t.valign&&(ge=(P-y)*("middle"===t.valign?.5:1)),u)n.select("svg").attr({x:I+he-1,y:I+ge}).call(c.setClipUrl,N?A:null,e);else{var ve=I+ge-h.top,me=I+he-h.left;V.call(f.positionText,me,ve).call(c.setClipUrl,N?A:null,e)}H.select("rect").call(c.setRect,I,I,w,P),F.call(c.setRect,E/2,E/2,R-E,B-E),z.call(c.setTranslate,Math.round(L.x.text-R/2),Math.round(L.y.text-B/2)),O.attr({transform:"rotate("+S+","+L.x.text+","+L.y.text+")"});var ye,xe=function(r,n){C.selectAll(".annotation-arrow-g").remove();var u=L.x.head,f=L.y.head,d=L.x.tail+r,h=L.y.tail+n,m=L.x.text+r,y=L.y.text+n,x=o.rotationXYMatrix(S,m,y),w=o.apply2DTransform(x),A=o.apply2DTransform2(x),D=+F.attr("width"),P=+F.attr("height"),E=m-.5*D,R=E+D,I=y-.5*P,N=I+P,H=[[E,I,E,N],[E,N,R,N],[R,N,R,I],[R,I,E,I]].map(A);if(!H.reduce((function(e,t){return e^!!o.segmentsIntersect(u,f,u+1e6,f+1e6,t[0],t[1],t[2],t[3])}),!1)){H.forEach((function(e){var t=o.segmentsIntersect(d,h,u,f,e[0],e[1],e[2],e[3]);t&&(d=t.x,h=t.y)}));var B=t.arrowwidth,j=t.arrowcolor,V=t.arrowside,U=C.append("g").style({opacity:s.opacity(j)}).classed("annotation-arrow-g",!0),q=U.append("path").attr("d","M"+d+","+h+"L"+u+","+f).style("stroke-width",B+"px").call(s.stroke,s.rgb(j));if(g(q,V,t),_.annotationPosition&&q.node().parentNode&&!i){var G=u,Z=f;if(t.standoff){var Y=Math.sqrt(Math.pow(u-d,2)+Math.pow(f-h,2));G+=t.standoff*(d-u)/Y,Z+=t.standoff*(h-f)/Y}var X,W,Q=U.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-G)+","+(h-Z),transform:"translate("+G+","+Z+")"}).style("stroke-width",B+6+"px").call(s.stroke,"rgba(0,0,0,0)").call(s.fill,"rgba(0,0,0,0)");p.init({element:Q.node(),gd:e,prepFn:function(){var e=c.getTranslate(z);X=e.x,W=e.y,l&&l.autorange&&T(l._name+".autorange",!0),v&&v.autorange&&T(v._name+".autorange",!0)},moveFn:function(e,r){var n=w(X,W),a=n[0]+e,i=n[1]+r;z.call(c.setTranslate,a,i),k("x",l?l.p2r(l.r2p(t.x)+e):t.x+e/b.w),k("y",v?v.p2r(v.r2p(t.y)+r):t.y-r/b.h),t.axref===t.xref&&k("ax",l.p2r(l.r2p(t.ax)+e)),t.ayref===t.yref&&k("ay",v.p2r(v.r2p(t.ay)+r)),U.attr("transform","translate("+e+","+r+")"),O.attr({transform:"rotate("+S+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",e,M());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}};if(t.showarrow&&xe(0,0),D)p.init({element:z.node(),gd:e,prepFn:function(){ye=O.attr("transform")},moveFn:function(e,r){var n="pointer";if(t.showarrow)t.axref===t.xref?k("ax",l.p2r(l.r2p(t.ax)+e)):k("ax",t.ax+e),t.ayref===t.yref?k("ay",v.p2r(v.r2p(t.ay)+r)):k("ay",t.ay+r),xe(e,r);else{if(i)return;var a,o;if(l)a=l.p2r(l.r2p(t.x)+e);else{var s=t._xsize/b.w,c=t.x+(t._xshift-t.xshift)/b.w-s/2;a=p.align(c+e/b.w,s,0,1,t.xanchor)}if(v)o=v.p2r(v.r2p(t.y)+r);else{var u=t._ysize/b.h,f=t.y-(t._yshift+t.yshift)/b.h-u/2;o=p.align(f-r/b.h,u,0,1,t.yanchor)}k("x",a),k("y",o),l&&v||(n=p.getCursor(l?.5:a,v?.5:o,t.xanchor,t.yanchor))}O.attr({transform:"translate("+e+","+r+")"+ye}),d(z,n)},clickFn:function(r,n){t.captureevents&&e.emit("plotly_clickannotation",U(n))},doneFn:function(){d(z),a.call("_guiRelayout",e,M());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}}t.exports={draw:function(e){var t=e._fullLayout;t._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,v=t.indexOf("end")>=0,m=f.backoff*p+r.standoff,y=d.backoff*h+r.startstandoff;if("line"===u.nodeName){o={x:+e.attr("x1"),y:+e.attr("y1")},l={x:+e.attr("x2"),y:+e.attr("y2")};var x=o.x-l.x,b=o.y-l.y;if(c=(s=Math.atan2(b,x))+Math.PI,m&&y&&m+y>Math.sqrt(x*x+b*b))return void D();if(m){if(m*m>x*x+b*b)return void D();var _=m*Math.cos(s),w=m*Math.sin(s);l.x+=_,l.y+=w,e.attr({x2:l.x,y2:l.y})}if(y){if(y*y>x*x+b*b)return void D();var T=y*Math.cos(s),k=y*Math.sin(s);o.x-=T,o.y-=k,e.attr({x1:o.x,y1:o.y})}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(M1){c=!0;break}}c?e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove():(s._pdata=a(e.glplot.cameraParams,[t.xaxis.r2l(s.x)*r[0],t.yaxis.r2l(s.y)*r[1],t.zaxis.r2l(s.z)*r[2]]),n(e.graphDiv,s,l,e.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":254,"../annotations/draw":43}],50:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:e("./attributes")}}},layoutAttributes:e("./attributes"),handleDefaults:e("./defaults"),includeBasePlot:function(e,t){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var i=r.attrRegex,o=Object.keys(e),l=0;l=0))return e;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return e}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(e){var t=e.toRgb();return"rgb("+Math.round(t.r)+", "+Math.round(t.g)+", "+Math.round(t.b)+")"},i.rgb=function(e){return i.tinyRGB(n(e))},i.opacity=function(e){return e?n(e).getAlpha():0},i.addOpacity=function(e,t){var r=n(e).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+t+")"},i.combine=function(e,t){var r=n(e).toRgb();if(1===r.a)return n(e).toRgbString();var a=n(t||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(e,t,r){var a=n(e);return 1!==a.getAlpha()&&(a=n(i.combine(e,s))),(a.isDark()?t?a.lighten(t):s:r?a.darken(r):l).toString()},i.stroke=function(e,t){var r=n(t);e.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(e,t){var r=n(t);e.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(e){if(e&&"object"==typeof e){var t,r,n,a,o=Object.keys(e);for(t=0;t0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var W=Math.pow(10,Math.floor(Math.log(X)/Math.LN10));Z*=W*c.roundUp(X/W,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=Z}G.domain=[V+H,V+I-H],G.setScale(),e.attr("transform","translate("+Math.round(s.l)+","+Math.round(s.t)+")");var Q,J=e.select("."+k.cbtitleunshift).attr("transform","translate(-"+Math.round(s.l)+",-"+Math.round(s.t)+")"),$=e.select("."+k.cbaxis),K=0;function ee(n,a){var i={propContainer:G,propName:t._propPrefix+"title",traceIndex:t._traceIndex,_meta:t._meta,placeholder:o._dfltTitle.colorbar,containerGroup:e.select("."+k.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;e.selectAll("."+l+",."+l+"-math-group").remove(),h.draw(r,n,u(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(M)){var e,r=s.l+(t.x+F)*s.w,n=G.title.font.size;e="top"===M?(1-(V+I-H))*s.h+s.t+3+.75*n:(1-(V+H))*s.h+s.t-3-.25*n,ee(G._id+"title",{attributes:{x:r,y:e,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(M)){var i=e.select("."+k.cbtitle),o=i.select("text"),u=[-t.outlinewidth/2,t.outlinewidth/2],f=i.select(".h"+G._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*_),f?(K=d.bBox(f).height)>p&&(u[1]-=(K-p)/2):o.node()&&!o.classed(k.jsPlaceholder)&&(K=d.bBox(o.node()).height),K){if(K+=5,"top"===M)G.domain[1]-=K/s.h,u[1]*=-1;else{G.domain[0]+=K/s.h;var h=g.lineCount(o);u[1]+=(1-h)*p}i.attr("transform","translate("+u+")"),G.setScale()}}e.selectAll("."+k.cbfills+",."+k.cblines).attr("transform","translate(0,"+Math.round(s.h*(1-G.domain[1]))+")"),$.attr("transform","translate(0,"+Math.round(-s.t)+")");var m=e.select("."+k.cbfills).selectAll("rect."+k.cbfill).data(D);m.enter().append("rect").classed(k.cbfill,!0).style("stroke","none"),m.exit().remove();var y=A.map(G.c2p).map(Math.round).sort((function(e,t){return e-t}));m.each((function(e,i){var o=[0===i?A[0]:(D[i]+D[i-1])/2,i===D.length-1?A[1]:(D[i]+D[i+1])/2].map(G.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var l=n.select(this).attr({x:B,width:Math.max(z,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(t._fillgradient)d.gradient(l,r,t._id,"vertical",t._fillgradient,"fill");else{var s=S(e).replace("e-","");l.attr("fill",a(s).toHexString())}}));var x=e.select("."+k.cblines).selectAll("path."+k.cbline).data(v.color&&v.width?P:[]);x.enter().append("path").classed(k.cbline,!0),x.exit().remove(),x.each((function(e){n.select(this).attr("d","M"+B+","+(Math.round(G.c2p(e))+v.width/2%1)+"h"+z).call(d.lineGroupStyle,v.width,L(e),v.dash)})),$.selectAll("g."+G._id+"tick,path").remove();var b=B+z+(t.outlinewidth||0)/2-("outside"===t.ticks?1:0),w=l.calcTicks(G),T=l.makeTransFn(G),C=l.getTickSigns(G)[2];return l.drawTicks(r,G,{vals:"inside"===G.ticks?l.clipEnds(G,w):w,layer:$,path:l.makeTickPath(G,b,C),transFn:T}),l.drawLabels(r,G,{vals:w,layer:$,transFn:T,labelFns:l.makeLabelFns(G,b)})},function(){if(-1===["top","bottom"].indexOf(M)){var e=G.title.font.size,t=G._offset+G._length/2,a=s.l+(G.position||0)*s.w+("right"===G.side?10+e*(G.showticklabels?1:.5):-10-e*(G.showticklabels?.5:0));ee("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:M,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:t,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=z+t.outlinewidth/2+d.bBox($.node()).width;if((Q=J.select("text")).node()&&!Q.classed(k.jsPlaceholder)){var a,o=J.select(".h"+G._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(M)?d.bBox(o).width:d.bBox(J.node()).right-B-s.l,n=Math.max(n,a)}var l=2*t.xpad+n+t.borderwidth+t.outlinewidth/2,c=U-q;e.select("."+k.cbbg).attr({x:B-t.xpad-(t.borderwidth+t.outlinewidth)/2,y:q-N,width:Math.max(l,2),height:Math.max(c+2*N,2)}).call(p.fill,t.bgcolor).call(p.stroke,t.bordercolor).style("stroke-width",t.borderwidth),e.selectAll("."+k.cboutline).attr({x:B,y:q+t.ypad+("top"===M?K:0),width:Math.max(z,2),height:Math.max(c-2*t.ypad-K,2)}).call(p.stroke,t.outlinecolor).style({fill:"none","stroke-width":t.outlinewidth});var u=({center:.5,right:1}[t.xanchor]||0)*l;e.attr("transform","translate("+(s.l-u)+","+s.t+")");var f={},h=w[t.yanchor],g=T[t.yanchor];"pixels"===t.lenmode?(f.y=t.y,f.t=c*h,f.b=c*g):(f.t=f.b=0,f.yt=t.y+t.len*h,f.yb=t.y-t.len*g);var v=w[t.xanchor],m=T[t.xanchor];if("pixels"===t.thicknessmode)f.x=t.x,f.l=l*v,f.r=l*m;else{var y=l-z;f.l=y*v,f.r=y*m,f.xl=t.x-t.thickness*v,f.xr=t.x+t.thickness*m}i.autoMargin(r,t._id,f)}],r)}(r,t,e);v&&v.then&&(e._promises||[]).push(v),e._context.edits.colorbarPosition&&function(e,t,r){var n,a,i,l=r._fullLayout._size;s.init({element:e.node(),gd:r,prepFn:function(){n=e.attr("transform"),f(e)},moveFn:function(r,o){e.attr("transform",n+" translate("+r+","+o+")"),a=s.align(t._xLeftFrac+r/l.w,t._thickFrac,0,1,t.xanchor),i=s.align(t._yBottomFrac-o/l.h,t._lenFrac,0,1,t.yanchor);var c=s.getCursor(a,i,t.xanchor,t.yanchor);f(e,c)},doneFn:function(){if(f(e),void 0!==a&&void 0!==i){var n={};n[t._propPrefix+"x"]=a,n[t._propPrefix+"y"]=i,void 0!==t._traceIndex?o.call("_guiRestyle",r,n,t._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,t,e)})),t.exit().each((function(t){i.autoMargin(e,t._id)})).remove(),t.order()}}},{"../../constants/alignment":154,"../../lib":179,"../../lib/extend":173,"../../lib/setcursor":198,"../../lib/svg_text_utils":200,"../../plots/cartesian/axes":223,"../../plots/cartesian/axis_defaults":225,"../../plots/cartesian/layout_attributes":237,"../../plots/cartesian/position_defaults":240,"../../plots/plots":257,"../../registry":265,"../color":52,"../colorscale/helpers":63,"../dragelement":71,"../drawing":74,"../titles":147,"./constants":54,d3:16,tinycolor2:35}],57:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e){return n.isPlainObject(e.colorbar)}},{"../../lib":179}],58:[function(e,t,r){"use strict";t.exports={moduleType:"component",name:"colorbar",attributes:e("./attributes"),supplyDefaults:e("./defaults"),draw:e("./draw").draw,hasColorbar:e("./has_colorbar")}},{"./attributes":53,"./defaults":55,"./draw":56,"./has_colorbar":57}],59:[function(e,t,r){"use strict";var n=e("../colorbar/attributes"),a=e("../../lib/regex").counter,i=e("./scales.js").scales;Object.keys(i);function o(e){return"`"+e+"`"}t.exports=function(e,t){e=e||"";var r,l=(t=t||{}).cLetter||"c",s=("onlyIfNumerical"in t?t.onlyIfNumerical:Boolean(e),"noScale"in t?t.noScale:"marker.line"===e),c="showScaleDflt"in t?t.showScaleDflt:"z"===l,u="string"==typeof t.colorscaleDflt?i[t.colorscaleDflt]:null,f=t.editTypeOverride||"",d=e?e+".":"";"colorAttr"in t?(r=t.colorAttr,t.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},t.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==t.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),t.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":194,"../colorbar/attributes":53,"./scales.js":67}],60:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("./helpers").extractOpts;t.exports=function(e,t,r){var o,l=e._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(t,c).get():t,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":179,"./helpers":63,"fast-isnumeric":18}],61:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./helpers").hasColorscale,i=e("./helpers").extractOpts;t.exports=function(e,t){function r(e,t){var r=e["_"+t];void 0!==r&&(e[t]=r)}function o(e,a){var o=a.container?n.nestedProperty(e,a.container).get():e;if(o)if(o.coloraxis)o._colorAx=t[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=e[n];r[a]=[1-i[0],i[1]]}return r}function h(e,t){t=t||{};for(var r=e.domain,o=e.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],69:[function(e,t,r){"use strict";var n=e("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];t.exports=function(e,t,r,i){return e="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*e),0,2),t="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*t),0,2),a[t][e]}},{"../../lib":179}],70:[function(e,t,r){"use strict";r.selectMode=function(e){return"lasso"===e||"select"===e},r.drawMode=function(e){return"drawclosedpath"===e||"drawopenpath"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.openMode=function(e){return"drawline"===e||"drawopenpath"===e},r.rectMode=function(e){return"select"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.freeMode=function(e){return"lasso"===e||"drawclosedpath"===e||"drawopenpath"===e},r.selectingOrDrawing=function(e){return r.freeMode(e)||r.rectMode(e)}},{}],71:[function(e,t,r){"use strict";var n=e("mouse-event-offset"),a=e("has-hover"),i=e("has-passive-events"),o=e("../../lib").removeElement,l=e("../../plots/cartesian/constants"),s=t.exports={};s.align=e("./align"),s.getCursor=e("./cursor");var c=e("./unhover");function u(){var e=document.createElement("div");e.className="dragcover";var t=e.style;return t.position="fixed",t.left=0,t.right=0,t.top=0,t.bottom=0,t.zIndex=999999999,t.background="none",document.body.appendChild(e),e}function f(e){return n(e.changedTouches?e.changedTouches[0]:e,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(e){var t,r,n,c,d,p,h,g,v=e.gd,m=1,y=v._context.doubleClickDelay,x=e.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=e.clampFn||function(e,t,r){return Math.abs(e)y&&(m=Math.max(m-1,1)),v._dragged)e.doneFn&&e.doneFn();else if(e.clickFn&&e.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",t)}catch(e){var n=f(t);(r=document.createEvent("MouseEvents")).initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,n[0],n[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":179,"../../plots/cartesian/constants":229,"./align":68,"./cursor":69,"./unhover":72,"has-hover":20,"has-passive-events":21,"mouse-event-offset":24}],72:[function(e,t,r){"use strict";var n=e("../../lib/events"),a=e("../../lib/throttle"),i=e("../../lib/dom").getGraphDiv,o=e("../fx/constants"),l=t.exports={};l.wrapped=function(e,t,r){(e=i(e))._fullLayout&&a.clear(e._fullLayout._uid+o.HOVERID),l.raw(e,t,r)},l.raw=function(e,t){var r=e._fullLayout,a=e._hoverdata;t||(t={}),t.target&&!1===n.triggerHandler(e,"plotly_beforehover",t)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,t.target&&a&&e.emit("plotly_unhover",{event:t,points:a}))}},{"../../lib/dom":171,"../../lib/events":172,"../../lib/throttle":201,"../fx/constants":86}],73:[function(e,t,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],74:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("tinycolor2"),o=e("../../registry"),l=e("../color"),s=e("../colorscale"),c=e("../../lib"),u=e("../../lib/svg_text_utils"),f=e("../../constants/xmlns_namespaces"),d=e("../../constants/alignment").LINE_SPACING,p=e("../../constants/interactions").DESELECTDIM,h=e("../../traces/scatter/subtypes"),g=e("../../traces/scatter/make_bubble_size_func"),v=e("../../components/fx/helpers").appendArrayPointValue,m=t.exports={};m.font=function(e,t,r,n){c.isPlainObject(t)&&(n=t.color,r=t.size,t=t.family),t&&e.style("font-family",t),r+1&&e.style("font-size",r+"px"),n&&e.call(l.fill,n)},m.setPosition=function(e,t,r){e.attr("x",t).attr("y",r)},m.setSize=function(e,t,r){e.attr("width",t).attr("height",r)},m.setRect=function(e,t,r,n,a){e.call(m.setPosition,t,r).call(m.setSize,n,a)},m.translatePoint=function(e,t,r,n){var i=r.c2p(e.x),o=n.c2p(e.y);return!!(a(i)&&a(o)&&t.node())&&("text"===t.node().nodeName?t.attr("x",i).attr("y",o):t.attr("transform","translate("+i+","+o+")"),!0)},m.translatePoints=function(e,t,r){e.each((function(e){var a=n.select(this);m.translatePoint(e,a,t,r)}))},m.hideOutsideRangePoint=function(e,t,r,n,a,i){t.attr("display",r.isPtWithinRange(e,a)&&n.isPtWithinRange(e,i)?null:"none")},m.hideOutsideRangePoints=function(e,t){if(t._hasClipOnAxisFalse){var r=t.xaxis,a=t.yaxis;e.each((function(t){var i=t[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";e.selectAll(c).each((function(e){m.hideOutsideRangePoint(e,n.select(this),r,a,l,s)}))}))}},m.crispRound=function(e,t,r){return t&&a(t)?e._context.staticPlot?t:t<1?1:Math.round(t):r||0},m.singleLineStyle=function(e,t,r,n,a){t.style("fill","none");var i=(((e||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(t,n||i.color),m.dashLine(t,s,o)},m.lineGroupStyle=function(e,t,r,a){e.style("fill","none").each((function(e){var i=(((e||[])[0]||{}).trace||{}).line||{},o=t||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(m.dashLine,s,o)}))},m.dashLine=function(e,t,r){r=+r||0,t=m.dashStyle(t,r),e.style({"stroke-dasharray":t,"stroke-width":r+"px"})},m.dashStyle=function(e,t){t=+t||1;var r=Math.max(t,3);return"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),e},m.singleFillStyle=function(e){var t=(((n.select(e.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;t&&e.call(l.fill,t)},m.fillGroupStyle=function(e){e.style("stroke-width",0).each((function(e){var t=n.select(this);e[0].trace&&t.call(l.fill,e[0].trace.fillcolor)}))};var y=e("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(y).forEach((function(e){var t=y[e],r=t.n;m.symbolList.push(r,String(r),e,r+100,String(r+100),e+"-open"),m.symbolNames[r]=e,m.symbolFuncs[r]=t.f,t.needLine&&(m.symbolNeedLines[r]=!0),t.noDot?m.symbolNoDot[r]=!0:m.symbolList.push(r+200,String(r+200),e+"-dot",r+300,String(r+300),e+"-open-dot"),t.noFill&&(m.symbolNoFill[r]=!0)}));var x=m.symbolNames.length;function b(e,t){var r=e%100;return m.symbolFuncs[r](t)+(e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}m.symbolNumber=function(e){if(a(e))e=+e;else if("string"==typeof e){var t=0;e.indexOf("-open")>0&&(t=100,e=e.replace("-open","")),e.indexOf("-dot")>0&&(t+=200,e=e.replace("-dot","")),(e=m.symbolNames.indexOf(e))>=0&&(e+=t)}return e%100>=x||e>=400?0:Math.floor(Math.max(e,0))};var _={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0},T=n.format("~.1f"),k={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}};m.gradient=function(e,t,r,a,o,s){for(var u=o.length,f=k[a],d=new Array(u),p=0;p"+m(e);h._gradientUrlQueryParts[y]=1},m.initGradients=function(e){var t=e._fullLayout;c.ensureSingle(t._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),t._gradientUrlQueryParts={}},m.pointStyle=function(e,t,r){if(e.size()){var a=m.makePointStyleFns(t);e.each((function(e){m.singlePointStyle(e,n.select(this),t,a,r)}))}},m.singlePointStyle=function(e,t,r,n,a){var i=r.marker,o=i.line;if(t.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(e):void 0===e.mo?i.opacity:e.mo),n.ms2mrc){var s;s="various"===e.ms||"various"===i.size?3:n.ms2mrc(e.ms),e.mrc=s,n.selectedSizeFn&&(s=e.mrc=n.selectedSizeFn(e));var u=m.symbolNumber(e.mx||i.symbol)||0;e.om=u%200>=100,t.attr("d",b(u,s))}var f,d,p,h=!1;if(e.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(e.mlw+1||g+1||(e.trace?(e.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in e?e.mlcc=n.lineScale(e.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in e?e.mcc=n.markerScale(e.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(e))}if(e.om)t.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{t.style("stroke-width",(e.isBlank?0:p)+"px");var v=i.gradient,y=e.mgt;if(y?h=!0:y=v&&v.type,Array.isArray(y)&&(y=y[0],k[y]||(y=0)),y&&"none"!==y){var x=e.mgc;x?h=!0:x=v.color;var _=r.uid;h&&(_+="-"+e.i),m.gradient(t,a,_,y,[[0,x],[1,f]],"fill")}else l.fill(t,f);p&&l.stroke(t,d)}},m.makePointStyleFns=function(e){var t={},r=e.marker;return t.markerScale=m.tryColorscale(r,""),t.lineScale=m.tryColorscale(r,"line"),o.traceIs(e,"symbols")&&(t.ms2mrc=h.isBubble(e)?g(e):function(){return(r.size||6)/2}),e.selectedpoints&&c.extendFlat(t,m.makeSelectedPointStyleFns(e)),t},m.makeSelectedPointStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,h=void 0!==f;(c.isArrayOrTypedArray(s)||d||h)&&(t.selectedOpacityFn=function(e){var t=void 0===e.mo?a.opacity:e.mo;return e.selected?d?u:t:h?f:p*t});var g=a.color,v=i.color,m=l.color;(v||m)&&(t.selectedColorFn=function(e){var t=e.mcc||g;return e.selected?v||t:m||t});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(e,"symbols")&&(_||w)&&(t.selectedSizeFn=function(e){var t=e.mrc||y/2;return e.selected?_?x/2:t:w?b/2:t}),t},m.makeSelectedTextStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return t.selectedTextColorFn=function(e){var t=e.tc||s;return e.selected?c||t:u||(c?t:l.addOpacity(t,p))},t},m.selectedPointStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedPointStyleFns(t),a=t.marker||{},i=[];r.selectedOpacityFn&&i.push((function(e,t){e.style("opacity",r.selectedOpacityFn(t))})),r.selectedColorFn&&i.push((function(e,t){l.fill(e,r.selectedColorFn(t))})),r.selectedSizeFn&&i.push((function(e,t){var n=t.mx||a.symbol||0,i=r.selectedSizeFn(t);e.attr("d",b(m.symbolNumber(n),i)),t.mrc2=i})),i.length&&e.each((function(e){for(var t=n.select(this),r=0;r0?r:0}m.textPointStyle=function(e,t,r){if(e.size()){var a;if(t.selectedpoints){var i=m.makeSelectedTextStyleFns(t);a=i.selectedTextColorFn}var o=t.texttemplate,l=r._fullLayout;e.each((function(e){var i=n.select(this),s=o?c.extractOption(e,t,"txt","texttemplate"):c.extractOption(e,t,"tx","text");if(s||0===s){if(o){var f=t._module.formatLabels?t._module.formatLabels(e,t,l):{},d={};v(d,t,e.i);var p=t._meta||{};s=c.texttemplateString(s,f,l._d3locale,d,e,p)}var h=e.tp||t.textposition,g=L(e,t),y=a?a(e):e.tc||t.textfont.color;i.call(m.font,e.tf||t.textfont.family,g,y).text(s).call(u.convertToTspans,r).call(A,h,g,e.mrc)}else i.remove()}))}},m.selectedTextStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedTextStyleFns(t);e.each((function(e){var a=n.select(this),i=r.selectedTextColorFn(e),o=e.tp||t.textposition,s=L(e,t);l.fill(a,i),A(a,o,s,e.mrc2||e.mrc)}))}};function S(e,t,r,a){var i=e[0]-t[0],o=e[1]-t[1],l=r[0]-t[0],s=r[1]-t[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(t[0]+(p&&f/p),2),n.round(t[1]+(p&&d/p),2)],[n.round(t[0]-(h&&f/h),2),n.round(t[1]-(h&&d/h),2)]]}m.smoothopen=function(e,t){if(e.length<3)return"M"+e.join("L");var r,n="M"+e[0],a=[];for(r=1;r=1e4&&(m.savedBBoxes={},D=0),r&&(m.savedBBoxes[r]=v),D++,c.extendFlat({},v)},m.setClipUrl=function(e,t,r){e.attr("clip-path",z(t,r))},m.getTranslate=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||0,y:+t[1]||0}},m.setTranslate=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=" translate("+t+", "+r+")").trim(),e[a]("transform",i),i},m.getScale=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||1,y:+t[1]||1}},m.setScale=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+=" scale("+t+", "+r+")").trim(),e[a]("transform",i),i};var E=/\s*sc.*/;m.setPointGroupScale=function(e,t,r){if(t=t||1,r=r||1,e){var n=1===t&&1===r?"":" scale("+t+","+r+")";e.each((function(){var e=(this.getAttribute("transform")||"").replace(E,"");e=(e+=n).trim(),this.setAttribute("transform",e)}))}};var R=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(e,t,r){e&&e.each((function(){var e,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(R);e=1===t&&1===r?[]:["translate("+o+","+l+")","scale("+t+","+r+")","translate("+-o+","+-l+")"],s&&e.push(s),a.attr("transform",e.join(" "))}}))}},{"../../components/fx/helpers":88,"../../constants/alignment":154,"../../constants/interactions":157,"../../constants/xmlns_namespaces":159,"../../lib":179,"../../lib/svg_text_utils":200,"../../registry":265,"../../traces/scatter/make_bubble_size_func":383,"../../traces/scatter/subtypes":390,"../color":52,"../colorscale":64,"./symbol_defs":75,d3:16,"fast-isnumeric":18,tinycolor2:35}],75:[function(e,t,r){"use strict";var n=e("d3");t.exports={circle:{n:0,f:function(e){var t=n.round(e,2);return"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"}},square:{n:1,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"}},diamond:{n:2,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"Z"}},cross:{n:3,f:function(e){var t=n.round(.4*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H"+t+"V"+r+"H-"+t+"V"+t+"H-"+r+"V-"+t+"H-"+t+"V-"+r+"H"+t+"V-"+t+"H"+r+"Z"}},x:{n:4,f:function(e){var t=n.round(.8*e/Math.sqrt(2),2),r="l"+t+","+t,a="l"+t+",-"+t,i="l-"+t+",-"+t,o="l-"+t+","+t;return"M0,"+t+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+","+n.round(e/2,2)+"H"+t+"L0,-"+n.round(e,2)+"Z"}},"triangle-down":{n:6,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+",-"+n.round(e/2,2)+"H"+t+"L0,"+n.round(e,2)+"Z"}},"triangle-left":{n:7,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M"+n.round(e/2,2)+",-"+t+"V"+t+"L-"+n.round(e,2)+",0Z"}},"triangle-right":{n:8,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+n.round(e/2,2)+",-"+t+"V"+t+"L"+n.round(e,2)+",0Z"}},"triangle-ne":{n:9,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+r+",-"+t+"H"+t+"V"+r+"Z"}},"triangle-se":{n:10,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+t+",-"+r+"V"+t+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H-"+t+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+t+","+r+"V-"+t+"H"+r+"Z"}},pentagon:{n:13,f:function(e){var t=n.round(.951*e,2),r=n.round(.588*e,2),a=n.round(-e,2),i=n.round(-.309*e,2);return"M"+t+","+i+"L"+r+","+n.round(.809*e,2)+"H-"+r+"L-"+t+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+t+"L-"+a+","+r+"V-"+r+"L0,-"+t+"Z"}},hexagon2:{n:15,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+t+",0L"+r+",-"+a+"H-"+r+"L-"+t+",0Z"}},octagon:{n:16,f:function(e){var t=n.round(.924*e,2),r=n.round(.383*e,2);return"M-"+r+",-"+t+"H"+r+"L"+t+",-"+r+"V"+r+"L"+r+","+t+"H-"+r+"L-"+t+","+r+"V-"+r+"Z"}},star:{n:17,f:function(e){var t=1.4*e,r=n.round(.225*t,2),a=n.round(.951*t,2),i=n.round(.363*t,2),o=n.round(.588*t,2),l=n.round(-t,2),s=n.round(-.309*t,2),c=n.round(.118*t,2),u=n.round(.809*t,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*t,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(e){var t=n.round(.66*e,2),r=n.round(.38*e,2),a=n.round(.76*e,2);return"M-"+a+",0l-"+r+",-"+t+"h"+a+"l"+r+",-"+t+"l"+r+","+t+"h"+a+"l-"+r+","+t+"l"+r+","+t+"h-"+a+"l-"+r+","+t+"l-"+r+",-"+t+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+t+","+r+o+t+","+r+o+"0,-"+a+o+"-"+t+","+r+"Z"}},"star-triangle-down":{n:20,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M"+t+",-"+r+o+"-"+t+",-"+r+o+"0,"+a+o+t+",-"+r+"Z"}},"star-square":{n:21,f:function(e){var t=n.round(1.1*e,2),r=n.round(2*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",-"+t+a+"-"+t+","+t+a+t+","+t+a+t+",-"+t+a+"-"+t+",-"+t+"Z"}},"star-diamond":{n:22,f:function(e){var t=n.round(1.4*e,2),r=n.round(1.9*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",0"+a+"0,"+t+a+t+",0"+a+"0,-"+t+a+"-"+t+",0Z"}},"diamond-tall":{n:23,f:function(e){var t=n.round(.7*e,2),r=n.round(1.4*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},"diamond-wide":{n:24,f:function(e){var t=n.round(1.4*e,2),r=n.round(.7*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},hourglass:{n:25,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"L"+t+",-"+t+"H-"+t+"Z"},noDot:!0},bowtie:{n:26,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"V-"+t+"L-"+t+","+t+"V-"+t+"Z"},noDot:!0},"circle-cross":{n:27,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(e){var t=n.round(e,2),r=n.round(e/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM0,-"+t+"V"+t+"M-"+t+",0H"+t},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(e){var t=n.round(1.3*e,2),r=n.round(.65*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(e){var t=n.round(1.2*e,2),r=n.round(.85*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(e){var t=n.round(e/2,2),r=n.round(e,2);return"M"+t+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+t+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+","+a+"L0,0M"+t+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+",-"+a+"L0,0M"+t+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M"+a+","+t+"L0,0M"+a+",-"+t+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+a+","+t+"L0,0M-"+a+",-"+t+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(e){var t=n.round(1.4*e,2);return"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(e){var t=n.round(e,2);return"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t},needLine:!0,noDot:!0,noFill:!0},"arrow-up":{n:45,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-down":{n:46,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-left":{n:47,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L-"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L-"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:16}],76:[function(e,t,r){"use strict";t.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"}}}},{}],77:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../registry"),i=e("../../plots/cartesian/axes"),o=e("../../lib"),l=e("./compute_error");function s(e,t,r,a){var s=t["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;t.each((function(t){var f,d=t[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(e){return e.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(t=[]);var v=n.select(this).selectAll("g.errorbar").data(t,f);if(v.exit().remove(),t.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.setClipUrl(v,r.layerClipId,e),v.each((function(e){var t=n.select(this),r=function(e,t,r){var n={x:t.c2p(e.x),y:r.c2p(e.y)};void 0!==e.yh&&(n.yh=r.c2p(e.yh),n.ys=r.c2p(e.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(e.ys,!0)));void 0!==e.xh&&(n.xh=t.c2p(e.xh),n.xs=t.c2p(e.xs),a(n.xs)||(n.noXS=!0,n.xs=t.c2p(e.xs,!0)));return n}(e,s,c);if(!g||e.vis){var i,o=t.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=t.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=t.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=t.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":390,"../drawing":74,d3:16,"fast-isnumeric":18}],82:[function(e,t,r){"use strict";var n=e("d3"),a=e("../color");t.exports=function(e){e.each((function(e){var t=e[0].trace,r=t.error_y||{},i=t.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":52,d3:16}],83:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("./layout_attributes").hoverlabel,i=e("../../lib/extend").extendFlat;t.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":173,"../../plots/font_attributes":251,"./layout_attributes":93}],84:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry");function i(e,t,r,a){a=a||n.identity,Array.isArray(e)&&(t[0][r]=a(e))}t.exports=function(e){var t=e.calcdata,r=e._fullLayout;function o(e){return function(t){return n.coerceHoverinfo({hoverinfo:t},{_module:e._module},r)}}for(var l=0;l=0&&r.indexb[0]._length||ee<0||ee>w[0]._length)return d.unhoverRaw(e,t)}if(t.pointerX=K+b[0]._offset,t.pointerY=ee+w[0]._offset,E="xval"in t?g.flat(s,t.xval):g.p2c(b,K),R="yval"in t?g.flat(s,t.yval):g.p2c(w,ee),!a(E[0])||!a(R[0]))return o.warn("Fx.hover failed",t,e),d.unhoverRaw(e,t)}var re=1/0;function ne(e,r){for(F=0;FZ&&(W.splice(0,Z),re=W[0].distance),m&&0!==X&&0===W.length){G.distance=X,G.index=!1;var d=H._module.hoverPoints(G,U,q,"closest",u._hoverlayer);if(d&&(d=d.filter((function(e){return e.spikeDistance<=X}))),d&&d.length){var p,h=d.filter((function(e){return e.xa.showspikes&&"hovered data"!==e.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(p=ie(v),(!J.vLinePoint||J.vLinePoint.spikeDistance>p.spikeDistance)&&(J.vLinePoint=p))}var y=d.filter((function(e){return e.ya.showspikes&&"hovered data"!==e.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(p=ie(x),(!J.hLinePoint||J.hLinePoint.spikeDistance>p.spikeDistance)&&(J.hLinePoint=p))}}}}}function ae(e,t){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===C&&$&&W.length>1,Me=f.combine(u.plot_bgcolor||f.background,u.paper_bgcolor),Ae={hovermode:C,rotateLabels:ke,bgColor:Me,container:u._hoverlayer,outerContainer:u._paperdiv,commonLabelOpts:u.hoverlabel,hoverdistance:u.hoverdistance},Le=S(W,Ae,e);g.isUnifiedHover(C)||(!function(e,t,r){var n,a,i,o,l,s,c,u=0,f=1,d=e.size(),p=new Array(d),h=0;function g(e){var t=e[0],r=e[e.length-1];if(a=t.pmin-t.pos-t.dp+t.size,i=r.pos+r.dp+r.size-t.pmax,a>.01){for(l=e.length-1;l>=0;l--)e[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=e.length-1;l>=0;l--)e[l].dp-=i;n=!1}if(n){var c=0;for(o=0;ot.pmax&&c++;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos>t.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)e[l].dp-=i;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos+s.dp+s.size>t.pmax&&(s.del=!0,c--)}}}e.each((function(e){var n=e[t],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:e,traceIndex:e.trace.index,dp:0,pos:e.pos,posref:e.posref,size:e.by*(a?_:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(e,t){return e[0].posref-t[0].posref||f*(t[0].traceIndex-e[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var w=b[l],T=w.datum;T.offset=w.dp,T.del=w.del}}}(Le,ke?"xa":"ya",u),O(Le,ke));if(t.target&&t.target.tagName){var Se=h.getComponentMethod("annotations","hasClickToShow")(e,be);c(n.select(t.target),Se?"pointer":"")}if(!t.target||i||!function(e,t,r){if(!r||r.length!==e._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=e._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(e,0,xe))return;xe&&e.emit("plotly_unhover",{event:t,points:xe});e.emit("plotly_hover",{event:t,points:e._hoverdata,xaxes:b,yaxes:w,xvals:E,yvals:R})}(e,t,r,i)}))},r.loneHover=function(e,t){var r=!0;Array.isArray(e)||(r=!1,e=[e]);var a=e.map((function(e){return{color:e.color||f.defaultLine,x0:e.x0||e.x||0,x1:e.x1||e.x||0,y0:e.y0||e.y||0,y1:e.y1||e.y||0,xLabel:e.xLabel,yLabel:e.yLabel,zLabel:e.zLabel,text:e.text,name:e.name,idealAlign:e.idealAlign,borderColor:e.borderColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontColor:e.fontColor,nameLength:e.nameLength,textAlign:e.textAlign,trace:e.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:e.hovertemplate||!1,eventData:e.eventData||!1,hovertemplateLabels:e.hovertemplateLabels||!1}})),i=n.select(t.container),o=t.outerContainer?n.select(t.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:t.bgColor||f.background,container:i,outerContainer:o},s=S(a,l,t.gd),c=0,u=0;return s.sort((function(e,t){return e.y0-t.y0})).each((function(e,r){var n=e.y0-e.by/2;e.offset=n-5([\s\S]*)<\/extra>/;function S(e,t,r){var a=r._fullLayout,i=t.hovermode,l=t.rotateLabels,c=t.bgColor,d=t.container,p=t.outerContainer,h=t.commonLabelOpts||{},b=t.fontFamily||v.HOVERFONT,_=t.fontSize||v.HOVERFONTSIZE,w=e[0],T=w.xa,L=w.ya,S="y"===i.charAt(0)?"yLabel":"xLabel",O=w[S],D=(String(O)||"").split(" ")[0],P=p.node().getBoundingClientRect(),z=P.top,E=P.width,R=P.height,I=void 0!==O&&w.distance<=t.hoverdistance&&("x"===i||"y"===i);if(I){var F,N,H=!0;for(F=0;Fa.width-S?(m=a.width-S,l.attr("d","M"+(S-k)+",0L"+S+","+A+k+"v"+A+(2*M+x.height)+"H-"+S+"V"+A+k+"H"+(S-2*k)+"Z")):l.attr("d","M0,0L"+k+","+A+k+"H"+(M+x.width/2)+"v"+A+(2*M+x.height)+"H-"+(M+x.width/2)+"V"+A+k+"H-"+k+"Z")}else{var C,D,P;"right"===L.side?(C="start",D=1,P="",m=T._offset+T._length):(C="end",D=-1,P="-",m=T._offset),y=L._offset+(w.y0+w.y1)/2,c.attr("text-anchor",C),l.attr("d","M0,0L"+P+k+","+k+"V"+(M+x.height/2)+"h"+P+(2*M+x.width)+"V-"+(M+x.height/2)+"H"+P+k+"V-"+k+"Z");var E,R=x.height/2,I=z-x.top-R,F="clip"+a._uid+"commonlabel"+L._id;if(m=0?K-=re:K+=2*M;var ne=te.height+2*M,ae=$+ne>=R;return ne<=R&&($<=z?$=L._offset+2*M:ae&&($=R-ne)),ee.attr("transform","translate("+K+","+$+")"),ee}var ie=d.selectAll("g.hovertext").data(e,(function(e){return A(e)}));return ie.enter().append("g").classed("hovertext",!0).each((function(){var e=n.select(this);e.append("rect").call(f.fill,f.addOpacity(c,.8)),e.append("text").classed("name",!0),e.append("path").style("stroke-width","1px"),e.append("text").classed("nums",!0).call(u.font,b,_)})),ie.exit().remove(),ie.each((function(e){var t=n.select(this).attr("transform",""),o=e.bgcolor||e.color,d=f.combine(f.opacity(o)?o:f.defaultLine,c),p=f.combine(f.opacity(e.color)?e.color:f.defaultLine,c),h=e.borderColor||f.contrast(d),g=C(e,I,i,a,O,t),v=g[0],m=g[1],y=t.select("text.nums").call(u.font,e.fontFamily||b,e.fontSize||_,e.fontColor||h).text(v).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r),w=t.select("text.name"),T=0,A=0;if(m&&m!==v){w.call(u.font,e.fontFamily||b,e.fontSize||_,p).text(m).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r);var L=w.node().getBoundingClientRect();T=L.width+2*M,A=L.height+2*M}else w.remove(),t.select("rect").remove();t.select("path").style({fill:d,stroke:h});var S,D,P=y.node().getBoundingClientRect(),F=e.xa._offset+(e.x0+e.x1)/2,N=e.ya._offset+(e.y0+e.y1)/2,H=Math.abs(e.x1-e.x0),B=Math.abs(e.y1-e.y0),j=P.width+k+M+T;if(e.ty0=z-P.top,e.bx=P.width+2*M,e.by=Math.max(P.height+2*M,A),e.anchor="start",e.txwidth=P.width,e.tx2width=T,e.offset=0,l)e.pos=F,S=N+B/2+j<=R,D=N-B/2-j>=0,"top"!==e.idealAlign&&S||!D?S?(N+=B/2,e.anchor="start"):e.anchor="middle":(N-=B/2,e.anchor="end");else if(e.pos=N,S=F+H/2+j<=E,D=F-H/2-j>=0,"left"!==e.idealAlign&&S||!D)if(S)F+=H/2,e.anchor="start";else{e.anchor="middle";var V=j/2,U=F+V-E,q=F-V;U>0&&(F-=U),q<0&&(F+=-q)}else F-=H/2,e.anchor="end";y.attr("text-anchor",e.anchor),T&&w.attr("text-anchor",e.anchor),t.attr("transform","translate("+F+","+N+")"+(l?"rotate("+x+")":""))})),ie}function C(e,t,r,n,a,i){var l="",s="";void 0!==e.nameOverride&&(e.name=e.nameOverride),e.name&&(e.trace._meta&&(e.name=o.templateString(e.name,e.trace._meta)),l=E(e.name,e.nameLength)),void 0!==e.zLabel?(void 0!==e.xLabel&&(s+="x: "+e.xLabel+"
"),void 0!==e.yLabel&&(s+="y: "+e.yLabel+"
"),"choropleth"!==e.trace.type&&"choroplethmapbox"!==e.trace.type&&(s+=(s?"z: ":"")+e.zLabel)):t&&e[r.charAt(0)+"Label"]===a?s=e[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===e.xLabel?void 0!==e.yLabel&&"scattercarpet"!==e.trace.type&&(s=e.yLabel):s=void 0===e.yLabel?e.xLabel:"("+e.xLabel+", "+e.yLabel+")",!e.text&&0!==e.text||Array.isArray(e.text)||(s+=(s?"
":"")+e.text),void 0!==e.extraText&&(s+=(s?"
":"")+e.extraText),i&&""===s&&!e.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=e.hovertemplate||!1,f=e.hovertemplateLabels||e,d=e.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,e.trace._meta)).replace(L,(function(t,r){return l=E(r,e.nameLength),""}))),[s,l]}function O(e,t){e.each((function(e){var r=n.select(this);if(e.del)return r.remove();var a=r.select("text.nums"),i=e.anchor,o="end"===i?-1:1,l={start:1,end:-1,middle:0}[i],c=l*(k+M),f=c+l*(e.txwidth+M),d=0,p=e.offset;"middle"===i&&(c-=e.tx2width/2,f+=e.txwidth/2+M),t&&(p*=-T,d=e.offset*w),r.select("path").attr("d","middle"===i?"M-"+(e.bx/2+e.tx2width/2)+","+(p-e.by/2)+"h"+e.bx+"v"+e.by+"h-"+e.bx+"Z":"M0,0L"+(o*k+d)+","+(k+p)+"v"+(e.by/2-k)+"h"+o*e.bx+"v-"+e.by+"H"+(o*k+d)+"V"+(p-k)+"Z");var h=c+d,g=p+e.ty0-e.by/2+M,v=e.textAlign||"auto";"auto"!==v&&("left"===v&&"start"!==i?(a.attr("text-anchor","start"),h="middle"===i?-e.bx/2-e.tx2width/2+M:-e.bx-M):"right"===v&&"end"!==i&&(a.attr("text-anchor","end"),h="middle"===i?e.bx/2-e.tx2width/2-M:e.bx+M)),a.call(s.positionText,h,g),e.tx2width&&(r.select("text.name").call(s.positionText,f+l*M+d,p+e.ty0-e.by/2+M),r.select("rect").call(u.setRect,f+(l-1)*e.tx2width/2+d,p-e.by/2-1,e.tx2width,e.by+2))}))}function D(e,t){var r=e.index,n=e.trace||{},i=e.cd[0],l=e.cd[r]||{};function s(e){return e||a(e)&&0===e}var c=Array.isArray(r)?function(e,t){var a=o.castOption(i,r,e);return s(a)?a:o.extractOption({},n,"",t)}:function(e,t){return o.extractOption(l,n,e,t)};function u(t,r,n){var a=c(r,n);s(a)&&(e[t]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),e.posref="y"===t||"closest"===t&&"h"===n.orientation?e.xa._offset+(e.x0+e.x1)/2:e.ya._offset+(e.y0+e.y1)/2,e.x0=o.constrain(e.x0,0,e.xa._length),e.x1=o.constrain(e.x1,0,e.xa._length),e.y0=o.constrain(e.y0,0,e.ya._length),e.y1=o.constrain(e.y1,0,e.ya._length),void 0!==e.xLabelVal&&(e.xLabel="xLabel"in e?e.xLabel:p.hoverLabelText(e.xa,e.xLabelVal),e.xVal=e.xa.c2d(e.xLabelVal)),void 0!==e.yLabelVal&&(e.yLabel="yLabel"in e?e.yLabel:p.hoverLabelText(e.ya,e.yLabelVal),e.yVal=e.ya.c2d(e.yLabelVal)),void 0!==e.zLabelVal&&void 0===e.zLabel&&(e.zLabel=String(e.zLabelVal)),!(isNaN(e.xerr)||"log"===e.xa.type&&e.xerr<=0)){var f=p.tickText(e.xa,e.xa.c2l(e.xerr),"hover").text;void 0!==e.xerrneg?e.xLabel+=" +"+f+" / -"+p.tickText(e.xa,e.xa.c2l(e.xerrneg),"hover").text:e.xLabel+=" \xb1 "+f,"x"===t&&(e.distance+=1)}if(!(isNaN(e.yerr)||"log"===e.ya.type&&e.yerr<=0)){var d=p.tickText(e.ya,e.ya.c2l(e.yerr),"hover").text;void 0!==e.yerrneg?e.yLabel+=" +"+d+" / -"+p.tickText(e.ya,e.ya.c2l(e.yerrneg),"hover").text:e.yLabel+=" \xb1 "+d,"y"===t&&(e.distance+=1)}var h=e.hoverinfo||e.trace.hoverinfo;return h&&"all"!==h&&(-1===(h=Array.isArray(h)?h:h.split("+")).indexOf("x")&&(e.xLabel=void 0),-1===h.indexOf("y")&&(e.yLabel=void 0),-1===h.indexOf("z")&&(e.zLabel=void 0),-1===h.indexOf("text")&&(e.text=void 0),-1===h.indexOf("name")&&(e.name=void 0)),e}function P(e,t,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,d=!!t.hLinePoint,h=!!t.vLinePoint;if(o.selectAll(".spikeline").remove(),h||d){var g=f.combine(l.plot_bgcolor,l.paper_bgcolor);if(d){var v,m,y=t.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,g)<1.5?f.contrast(g):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=p.getPxPosition(e,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T,stroke:k,"stroke-dasharray":u.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:m,r:T,fill:k}).classed("spikeline",!0)}if(h){var S,C,O=t.vLinePoint;n=O&&O.xa,a=O&&O.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+O.x,C=a._offset+O.y);var D,P,z=i.readability(O.color,g)<1.5?f.contrast(g):O.color,E=n.spikemode,R=n.spikethickness,I=n.spikecolor||z,F=p.getPxPosition(e,n);if(-1!==E.indexOf("toaxis")||-1!==E.indexOf("across")){if(-1!==E.indexOf("toaxis")&&(D=F,P=C),-1!==E.indexOf("across")){var N=n._counterDomainMin,H=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),H=Math.max(H,n.position)),D=s.t+(1-H)*s.h,P=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:P,"stroke-width":R,stroke:I,"stroke-dasharray":u.dashStyle(n.spikedash,R)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:P,"stroke-width":R+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==E.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?R:-R),r:R,fill:I}).classed("spikeline",!0)}}}function z(e,t){return!t||(t.vLinePoint!==e._spikepoints.vLinePoint||t.hLinePoint!==e._spikepoints.hLinePoint)}function E(e,t){return s.plainText(e||"",{len:t,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":179,"../../lib/events":172,"../../lib/override_cursor":190,"../../lib/svg_text_utils":200,"../../plots/cartesian/axes":223,"../../registry":265,"../color":52,"../dragelement":71,"../drawing":74,"../legend/defaults":104,"../legend/draw":105,"./constants":86,"./helpers":88,d3:16,"fast-isnumeric":18,tinycolor2:35}],90:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../color"),i=e("./helpers").isUnifiedHover;t.exports=function(e,t,r,o){function l(e){o.font[e]||(o.font[e]=t.legend?t.legend.font[e]:t.font[e])}o=o||{},t&&i(t.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),t.legend?(o.bgcolor||(o.bgcolor=a.combine(t.legend.bgcolor,t.paper_bgcolor)),o.bordercolor||(o.bordercolor=t.legend.bordercolor)):o.bgcolor||(o.bgcolor=t.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":179,"../color":52,"./helpers":88}],91:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){function i(r,i){return void 0!==t[r]?t[r]:n.coerce(e,t,a,r,i)}var o,l=i("clickmode");return t._has("cartesian")?l.indexOf("select")>-1?o="closest":(t._isHoriz=function(e,t){for(var r=t._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===k("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===k("roworder"),w=d?.2:.1,T=d?.3:.1;g&&t._splomGridDflt&&(x=t._splomGridDflt.xside,b=t._splomGridDflt.yside),v._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,m,_)}}else delete t.grid}function k(e,t){return n.coerce(r,v,s,e,t)}},contentDefaults:function(e,t){var r=t.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=e.grid||{},p=t._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(t,"legend");if(_("uirevision",t.uirevision),!1!==g){_("bgcolor",t.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",t.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(e.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(t.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",t.font))}}function _(e,t){return a.coerce(c,v,o,e,t)}}},{"../../lib":179,"../../plot_api/plot_template":213,"../../plots/layout_attributes":255,"../../registry":265,"./attributes":102,"./helpers":108}],105:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib/events"),s=e("../dragelement"),c=e("../drawing"),u=e("../color"),f=e("../../lib/svg_text_utils"),d=e("./handle_click"),p=e("./constants"),h=e("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=e("./get_legend_data"),x=e("./style"),b=e("./helpers");function _(e,t,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:e.data,layout:e.layout,frames:e._transitionData._frames,config:e._context,fullData:e._fullData,fullLayout:e._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(e,"plotly_legendclick",s))if(1===n)t._clickTimeout=setTimeout((function(){d(r,e,n)}),e._context.doubleClickDelay);else if(2===n){t._clickTimeout&&clearTimeout(t._clickTimeout),e._legendMouseDownTime=0,!1!==l.triggerHandler(e,"plotly_legenddoubleclick",s)&&d(r,e,n)}}function w(e,t,r){var n,i=e.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&t._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(e,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,r.font).text(d?T(n,h):n),f.positionText(g,p.textGap,0),d?g.call(f.makeEditable,{gd:t,text:n}).call(M,e,t,r).on("edit",(function(n){this.text(T(n,h)).call(M,e,t,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",t,s,u)})):M(g,e,t,r)}function T(e,t){var r=Math.max(4,t);if(e&&e.trim().length>=r/2)return e;for(var n=r-(e=e||"").length;n>0;n--)e+=" ";return e}function k(e,t){var r,i=t._context.doubleClickDelay,o=1,l=a.ensureSingle(e,"rect","legendtoggle",(function(e){e.style("cursor","pointer").attr("pointer-events","all").call(u.fill,"rgba(0,0,0,0)")}));l.on("mousedown",(function(){(r=(new Date).getTime())-t._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(t,r,e,o,n.event)}}))}function M(e,t,r,n){n._main||e.attr("data-notex",!0),f.convertToTspans(e,r,(function(){!function(e,t,r){var n=e.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void e.remove();var a=e.select("g[class*=math-group]"),i=a.node();r||(r=t._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=e.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);n?f.positionText(h,p.textGap,-y):f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(t,r,n)}))}function A(e){return a.isRightAnchor(e)?"right":a.isCenterAnchor(e)?"center":"left"}function L(e){return a.isBottomAnchor(e)?"bottom":a.isMiddleAnchor(e)?"middle":"top"}t.exports=function(e,t){var r,l=e._fullLayout,f="legend"+l._uid;if(t?(r=t.layer,f+="-hover"):((t=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(e._legendMouseDownTime||(e._legendMouseDownTime=0),t._main){if(!e.calcdata)return;d=l.showlegend&&y(e.calcdata,t)}else{if(!t.entries)return;d=y(t.entries,t)}var h=l.hiddenlabels||[];if(t._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(e,"legend");var g=a.ensureSingle(r,"g","legend",(function(e){t._main&&e.attr("pointer-events","all")})),T=a.ensureSingleById(l._topdefs,"clipPath",f,(function(e){e.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(e){e.attr("shape-rendering","crispEdges")}));S.call(u.stroke,t.bordercolor).call(u.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),O=t.title;if(t._titleWidth=0,t._titleHeight=0,O.text){var D=a.ensureSingle(C,"text","legendtitletext");D.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,O.font).text(O.text),M(D,C,e,t)}else C.selectAll(".legendtitletext").remove();var P=a.ensureSingle(g,"rect","scrollbar",(function(e){e.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),z=C.selectAll("g.groups").data(d);z.enter().append("g").attr("class","groups"),z.exit().remove();var E=z.selectAll("g.traces").data(a.identity);E.enter().append("g").attr("class","traces"),E.exit().remove(),E.style("opacity",(function(e){var t=e[0].trace;return o.traceIs(t,"pie-like")?-1!==h.indexOf(e[0].label)?.5:1:"legendonly"===t.visible?.5:1})).each((function(){n.select(this).call(w,e,t)})).call(x,e,t).each((function(){t._main&&n.select(this).call(k,e)})),a.syncOrAsync([i.previousPromises,function(){return function(e,t,r,a){var i=e._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.textGap,h=p.itemGap,g=2*(u+h),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(e){var t=0,r=0,n=e.title.side;n&&(-1!==n.indexOf("left")&&(t=e._titleWidth),-1!==n.indexOf("top")&&(r=e._titleHeight));return[t,r]}(a);if(l)r.each((function(e){var t=e[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+t/2+h),a._height+=t,a._width=Math.max(a._width,e[0].width)})),x=d+a._width,a._width+=h+d+f,a._height+=g,s&&(t.each((function(e,t){c.setTranslate(this,0,t*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:S:k?M&&"right"===w?o.r+o.w:S:o.w,2*d);var C=0,O=0;r.each((function(e){var t=e[0].width+d;C=Math.max(C,t),O+=t})),x=null;var D=0;if(s){var P=0,z=0,E=0;t.each((function(){var e=0,t=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+h+n/2+t),t+=n,e=Math.max(e,d+r[0].width)})),P=Math.max(P,t);var r=e+h;r+u+z>a._maxWidth&&(D=Math.max(D,z),z=0,E+=P+a.tracegroupgap,P=t),c.setTranslate(this,z,E),z+=r})),a._width=Math.max(D,z)+u,a._height=E+P+g}else{var R=r.size(),I=O+f+(R-1)*ha._maxWidth&&(D=Math.max(D,B),N=0,H+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+H+t/2+h),B=N+r+h,N+=n,F=Math.max(F,t)})),I?(a._width=N+f,a._height=F+g):(a._width=Math.max(D,B)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var j=e._context.edits,V=j.legendText||j.legendPosition;r.each((function(e){var t=n.select(this).select(".legendtoggle"),r=e[0].height,a=V?d:x||d+e[0].width;l||(a+=h/2),c.setRect(t,0,-r/2,a,r)}))}(e,z,E,t)},function(){if(!t._main||!function(e){var t=e._fullLayout.legend,r=A(t),n=L(t);return i.autoMargin(e,"legend",{x:t.x,y:t.y,l:t._width*v[r],r:t._width*m[r],b:t._effHeight*m[n],t:t._effHeight*v[n]})}(e)){var u,d,h,y,x=l._size,b=t.borderwidth,w=x.l+x.w*t.x-v[A(t)]*t._width,k=x.t+x.h*(1-t.y)-v[L(t)]*t._effHeight;if(t._main&&l.margin.autoexpand){var M=w,O=k;w=a.constrain(w,0,l.width-t._width),k=a.constrain(k,0,l.height-t._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==O&&a.log("Constrain legend.y to make legend fit inside graph")}if(t._main&&c.setTranslate(g,w,k),P.on(".drag",null),g.on("wheel",null),!t._main||t._height<=t._maxHeight||e._context.staticPlot){var D=t._effHeight;t._main||(D=t._height),S.attr({width:t._width-b,height:D-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:t._width-2*b,height:D-2*b,x:b,y:b}),c.setClipUrl(C,f,e),c.setRect(P,0,0,0,0),delete t._scrollY}else{var z,E,R,I=Math.max(p.scrollBarMinHeight,t._effHeight*t._effHeight/t._height),F=t._effHeight-I-2*p.scrollBarMargin,N=t._height-t._effHeight,H=F/N,B=Math.min(t._scrollY||0,N);S.attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-2*b,x:b,y:b+B}),c.setClipUrl(C,f,e),U(B,I,H),g.on("wheel",(function(){U(B=a.constrain(t._scrollY+n.event.deltaY/F*N,0,N),I,H),0!==B&&B!==N&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;z="touchstart"===e.type?e.changedTouches[0].clientY:e.clientY,R=B})).on("drag",(function(){var e=n.event.sourceEvent;2===e.buttons||e.ctrlKey||(E="touchmove"===e.type?e.changedTouches[0].clientY:e.clientY,U(B=function(e,t,r){var n=(r-t)/H+e;return a.constrain(n,0,N)}(R,z,E),I,H))}));P.call(j);var V=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;"touchstart"===e.type&&(z=e.changedTouches[0].clientY,R=B)})).on("drag",(function(){var e=n.event.sourceEvent;"touchmove"===e.type&&(E=e.changedTouches[0].clientY,U(B=function(e,t,r){var n=(t-r)/H+e;return a.constrain(n,0,N)}(R,z,E),I,H))}));C.call(V)}if(e._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:e,prepFn:function(){var e=c.getTranslate(g);h=e.x,y=e.y},moveFn:function(e,r){var n=h+e,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,t.xanchor),d=s.align(a,0,x.t+x.h,x.t,t.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",e,{"legend.x":u,"legend.y":d})},clickFn:function(t,n){var a=r.selectAll("g.traces").filter((function(){var e=this.getBoundingClientRect();return n.clientX>=e.left&&n.clientX<=e.right&&n.clientY>=e.top&&n.clientY<=e.bottom}));a.size()>0&&_(e,g,a,t,n)}})}function U(r,n,a){t._scrollY=e._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(P,t._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],e)}}},{"../../constants/alignment":154,"../../lib":179,"../../lib/events":172,"../../lib/svg_text_utils":200,"../../plots/plots":257,"../../registry":265,"../color":52,"../dragelement":71,"../drawing":74,"./constants":103,"./get_legend_data":106,"./handle_click":107,"./helpers":108,"./style":110,d3:16}],106:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("./helpers");t.exports=function(e,t){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=t._main;function p(e,r){if(""!==e&&a.isGrouped(t))-1===l.indexOf(e)?(l.push(e),s=!0,o[e]=[[r]]):o[e].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=t.width}return h?n:Math.min(a,r)};function v(e,t,r){var i=e[0].trace,o=i.marker||{},s=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(c?[e]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.each((function(e){var t=n.select(this),r=e[0],a=g(r.mlw,o.line,5,2);t.style("stroke-width",a+"px").call(l.fill,r.mc||o.color),a&&l.stroke(t,r.mlc||s.color)}))}function m(e,t,r){var o=e[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(s?[e]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.size()){var d=(l.marker||{}).line,p=g(f(d.width,o.pts),d,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=d.color;var v=i.minExtend(o,{trace:h});u(c,v,h)}}e.each((function(e){var t=n.select(this),a=i.ensureSingle(t,"g","layers");a.style("opacity",e[0].trace.opacity);var o=r.valign,l=e[0].lineHeight,s=e[0].height;if("middle"!==o&&l&&s){var c={top:1,bottom:-1}[o]*(.5*(l-s+3));a.attr("transform","translate(0,"+c+")")}else a.attr("transform",null);a.selectAll("g.legendfill").data([e]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([e]).enter().append("g").classed("legendlines",!0);var u=a.selectAll("g.legendsymbols").data([e]);u.enter().append("g").classed("legendsymbols",!0),u.selectAll("g.legendpoints").data([e]).enter().append("g").classed("legendpoints",!0)})).each((function(e){var r,a=e[0].trace,c=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":c=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":c=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":c=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":c=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":c=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":c=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(c);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),u.exit().remove(),u.each((function(e,c){var u,f=n.select(this),p=s(a),h=p.colorscale,g=p.reversescale;if(h){if(!r){var v=h.length;u=0===c?h[g?v-1:0][1]:1===c?h[g?0:v-1][1]:h[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[c]||m[0]:m}f.attr("d",e[0]),u?f.call(l.fill,u):f.call((function(e){if(e.size()){var n="legendfill-"+a.uid;o.gradient(e,t,n,d(g,"radial"===r),h,"fill")}}))}))})).each((function(e){var t=e[0].trace,r="waterfall"===t.type;if(e[0]._distinct&&r){var a=e[0].trace[e[0].dir].marker;return e[0].mc=a.color,e[0].mlw=a.line.width,e[0].mlc=a.line.color,v(e,this,"waterfall")}var i=[];t.visible&&r&&(i=e[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(e){var r=n.select(this),a=t[e[0]].marker,i=g(void 0,a.line,5,2);r.attr("d",e[1]).style("stroke-width",i+"px").call(l.fill,a.color),i&&r.call(l.stroke,a.line.color)}))})).each((function(e){v(e,this,"funnel")})).each((function(e){v(e,this)})).each((function(e){var r=e[0].trace,s=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[e]:[]);s.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),s.exit().remove(),s.each((function(){var e=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var a=g(void 0,r.line,5,2);e.style("stroke-width",a+"px").call(l.fill,r.fillcolor),a&&l.stroke(e,r.line.color)}else{var c=i.minExtend(r,{marker:{size:h?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});s.call(o.pointStyle,c,t)}}))})).each((function(e){m(e,this,"funnelarea")})).each((function(e){m(e,this,"pie")})).each((function(e){var r,a,l=e[0],u=l.trace,f=u.visible&&u.fill&&"none"!==u.fill,p=c.hasLines(u),h=u.contours,v=!1,m=!1,y=s(u),x=y.colorscale,b=y.reversescale;if(h){var _=h.coloring;"lines"===_?v=!0:p="none"===_||"heatmap"===_||h.showlines,"constraint"===h.type?f="="!==h._operation:"fill"!==_&&"heatmap"!==_||(m=!0)}var w=c.hasMarkers(u)||c.hasText(u),T=f||m,k=p||v,M=w||!T?"M5,0":k?"M5,-2":"M5,-3",A=n.select(this),L=A.select(".legendfill").selectAll("path").data(f||m?[e]:[]);if(L.enter().append("path").classed("js-fill",!0),L.exit().remove(),L.attr("d",M+"h30v6h-30z").call(f?o.fillGroupStyle:function(e){if(e.size()){var r="legendfill-"+u.uid;o.gradient(e,t,r,d(b),x,"fill")}}),p||v){var S=g(void 0,u.line,10,5);a=i.minExtend(u,{line:{width:S}}),r=[i.minExtend(l,{trace:a})]}var C=A.select(".legendlines").selectAll("path").data(p||v?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",M+(v?"l30,0.0001":"h30")).call(p?o.lineGroupStyle:function(e){if(e.size()){var r="legendline-"+u.uid;o.lineGroupStyle(e),o.gradient(e,t,r,d(b),x,"stroke")}})})).each((function(e){var r,a,l=e[0],s=l.trace,u=c.hasMarkers(s),f=c.hasText(s),d=c.hasLines(s);function p(e,t,r,n){var a=i.nestedProperty(s,e).get(),o=i.isArrayOrTypedArray(a)&&t?t(a):a;if(h&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(e){return l._distinct&&l.index&&e[l.index]?e[l.index]:e[0]}if(u||f||d){var v={},m={};if(u){v.mc=p("marker.color",g),v.mx=p("marker.symbol",g),v.mo=p("marker.opacity",i.mean,[.2,1]),v.mlc=p("marker.line.color",g),v.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);v.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",g,[0,10],5)}),f&&(v.tx="Aa",v.tp=p("textposition",g),v.ts=10,v.tc=p("textfont.color",g),v.tf=p("textfont.family",g)),r=[i.minExtend(l,v)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var x=n.select(this).select("g.legendpoints"),b=x.selectAll("path.scatterpts").data(u?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),b.exit().remove(),b.call(o.pointStyle,a,t),u&&(r[0].mrc=3);var _=x.selectAll("g.pointtext").data(f?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.selectAll("text").call(o.textPointStyle,a,t)})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(t.visible&&"candlestick"===t.type?[e,e]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",(function(e,t){return t?"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(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=g(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(l.fill,i.fillcolor),o&&l.stroke(a,i.line.color)}))})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(t.visible&&"ohlc"===t.type?[e,e]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",(function(e,t){return t?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"})).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],s=g(void 0,i.line,5,2);a.style("fill","none").call(o.dashLine,i.line.dash,s),s&&l.stroke(a,i.line.color)}))}))}},{"../../lib":179,"../../registry":265,"../../traces/pie/helpers":358,"../../traces/pie/style_one":364,"../../traces/scatter/subtypes":390,"../color":52,"../colorscale/helpers":63,"../drawing":74,d3:16}],111:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/plots"),i=e("../../plots/cartesian/axis_ids"),o=e("../../fonts/ploticon"),l=e("../shapes/draw").eraseActiveShape,s=e("../../lib"),c=s._,u=t.exports={};function f(e,t){var r,a,o=t.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=e._fullLayout,u={},f=i.list(e,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(e){for(var t=0;t0)){var g=function(e,t,r){for(var n=r.filter((function(r){return t[r].anchor===e._id})),a=0,i=0;i=n.max)t=I[r+1];else if(e=n.pmax)t=I[r+1];else if(e0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(e,t,r,n,a){var l="category"===e.type||"multicategory"===e.type?e.r2c:e.d2c;if(void 0!==t)return[l(t),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===e.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]:void 0}}t.exports=function(e){var t=e._fullLayout,r=n.filterVisible(t.shapes);if(r.length&&e._fullData.length)for(var o=0;oy?(k=f,S="y0",M=y,C="y1"):(k=y,S="y1",M=f,C="y0");Y(n),Q(l,r),function(e,t,r){var n=t.xref,a=t.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(e,s?"clip"+r._fullLayout._uid+s:null,r)}(t,r,e),Z.moveFn="move"===z?X:W,Z.altKey=n.altKey},doneFn:function(){if(m(e))return;p(t),J(l),b(t,e,r),n.call("_guiRelayout",e,s.getUpdateObj())},clickFn:function(){if(m(e))return;J(l)}};function Y(r){if(m(e))z=null;else if(I)z="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=Z.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(t,s),z=s.split("-")[0]}}function X(n,a){if("path"===r.type){var i=function(e){return e},o=i,s=i;E?N("xanchor",r.xanchor=U(x+n)):(o=function(e){return U(j(e)+n)},H&&"date"===H.type&&(o=g.encodeDate(o))),R?N("yanchor",r.yanchor=q(T+a)):(s=function(e){return q(V(e)+a)},B&&"date"===B.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else E?N("xanchor",r.xanchor=U(x+n)):(N("x0",r.x0=U(c+n)),N("x1",r.x1=U(v+n))),R?N("yanchor",r.yanchor=q(T+a)):(N("y0",r.y0=q(f+a)),N("y1",r.y1=q(y+a)));t.attr("d",_(e,r)),Q(l,r)}function W(n,a){if(F){var i=function(e){return e},o=i,s=i;E?N("xanchor",r.xanchor=U(x+n)):(o=function(e){return U(j(e)+n)},H&&"date"===H.type&&(o=g.encodeDate(o))),R?N("yanchor",r.yanchor=q(T+a)):(s=function(e){return q(V(e)+a)},B&&"date"===B.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else if(I){if("resize-over-start-point"===z){var u=c+n,d=R?f-a:f+a;N("x0",r.x0=E?u:U(u)),N("y0",r.y0=R?d:q(d))}else if("resize-over-end-point"===z){var p=v+n,h=R?y-a:y+a;N("x1",r.x1=E?p:U(p)),N("y1",r.y1=R?h:q(h))}}else{var m=function(e){return-1!==z.indexOf(e)},b=m("n"),G=m("s"),Z=m("w"),Y=m("e"),X=b?k+a:k,W=G?M+a:M,J=Z?A+n:A,$=Y?L+n:L;R&&(b&&(X=k-a),G&&(W=M-a)),(!R&&W-X>10||R&&X-W>10)&&(N(S,r[S]=R?X:q(X)),N(C,r[C]=R?W:q(W))),$-J>10&&(N(O,r[O]=E?J:U(J)),N(D,r[D]=E?$:U($)))}t.attr("d",_(e,r)),Q(l,r)}function Q(e,t){(E||R)&&function(){var r="path"!==t.type,n=e.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 i=j(E?t.xanchor:a.midRange(r?[t.x0,t.x1]:g.extractPathCoords(t.path,h.paramIsX))),o=V(R?t.yanchor:a.midRange(r?[t.y0,t.y1]:g.extractPathCoords(t.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),E&&R){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(E){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function J(e){e.selectAll(".visual-cue").remove()}d.init(Z),G.node().onmousemove=Y}(e,E,s,t,r,z):!0===s.editable&&E.style("pointer-events",D||c.opacity(L)*A<=.5?"stroke":"all");E.node().addEventListener("click",(function(){return function(e,t){if(!y(e))return;var r=+t.node().getAttribute("data-index");if(r>=0){if(r===e._fullLayout._activeShapeIndex)return void T(e);e._fullLayout._activeShapeIndex=r,e._fullLayout._deactivateShape=T,v(e)}}(e,E)}))}}function b(e,t,r){var n=(r.xref+r.yref).replace(/paper/g,"");u.setClipUrl(e,n?"clip"+t._fullLayout._uid+n:null,t)}function _(e,t){var r,n,o,l,s,c,u,f,d=t.type,p=i.getFromId(e,t.xref),v=i.getFromId(e,t.yref),m=e._fullLayout._size;if(p?(r=g.shapePositionToRange(p),n=function(e){return p._offset+p.r2p(r(e,!0))}):n=function(e){return m.l+m.w*e},v?(o=g.shapePositionToRange(v),l=function(e){return v._offset+v.r2p(o(e,!0))}):l=function(e){return m.t+m.h*(1-e)},"path"===d)return p&&"date"===p.type&&(n=g.decodeDate(n)),v&&"date"===v.type&&(l=g.decodeDate(l)),function(e,t,r){var n=e.path,i=e.xsizemode,o=e.ysizemode,l=e.xanchor,s=e.yanchor;return n.replace(h.segmentRE,(function(e){var n=0,c=e.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=e.substr(1).replace(h.paramRE,(function(e){return u[n]?e="pixel"===i?t(l)+Number(e):t(e):f[n]&&(e="pixel"===o?r(s)-Number(e):r(e)),++n>d&&(e="X"),e}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+e)),c+p}))}(t,n,l);if("pixel"===t.xsizemode){var y=n(t.xanchor);s=y+t.x0,c=y+t.x1}else s=n(t.x0),c=n(t.x1);if("pixel"===t.ysizemode){var x=l(t.yanchor);u=x-t.y0,f=x-t.y1}else u=l(t.y0),f=l(t.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var b=(s+c)/2,_=(u+f)/2,w=Math.abs(b-s),T=Math.abs(_-u),k="A"+w+","+T,M=b+w+","+_;return"M"+M+k+" 0 1,1 "+(b+","+(_-T))+k+" 0 0,1 "+M+"Z"}function w(e,t,r){return e.replace(h.segmentRE,(function(e){var n=0,a=e.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+e.substr(1).replace(h.paramRE,(function(e){return n>=l||(i[n]?e=t(e):o[n]&&(e=r(e)),n++),e}))}))}function T(e){y(e)&&(e._fullLayout._activeShapeIndex>=0&&(s(e),delete e._fullLayout._activeShapeIndex,v(e)))}t.exports={draw:v,drawOne:x,eraseActiveShape:function(e){if(!y(e))return;s(e);var t=e._fullLayout._activeShapeIndex,r=(e.layout||{}).shapes||[];if(t=0&&f(m),r.attr("d",g(t)),M&&!d)&&(k=function(e,t){for(var r=0;r1&&(2!==e.length||"Z"!==e[1][0])&&(0===T&&(e[0][0]="M"),t[w]=e,y(),x())}}()}}function P(e,r){!function(e,r){if(t.length)for(var n=0;n0&&s0&&(l=l.transition().duration(t.transition.duration).ease(t.transition.easing)),l.attr("transform","translate("+(o-.5*u.gripWidth)+","+t._dims.currentValueTotalHeight+")")}}function L(e,t){var r=e._dims;return r.inputAreaStart+u.stepInset+(r.inputAreaLength-2*u.stepInset)*Math.min(1,Math.max(0,t))}function S(e,t){var r=e._dims;return Math.min(1,Math.max(0,(t-u.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*u.stepInset-2*r.inputAreaStart)))}function C(e,t,r){var n=r._dims,a=l.ensureSingle(e,"rect",u.railTouchRectClass,(function(n){n.call(k,t,e,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,u.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function O(e,t){var r=t._dims,n=r.inputAreaLength-2*u.railInset,a=l.ensureSingle(e,"rect",u.railRectClass);a.attr({width:n,height:u.railWidth,rx:u.railRadius,ry:u.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,t.bordercolor).call(i.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px"),o.setTranslate(a,u.railInset,.5*(r.inputAreaWidth-u.railWidth)+r.currentValueTotalHeight)}t.exports=function(e){var t=e._fullLayout,r=function(e,t){for(var r=e[u.name],n=[],a=0;a0?[0]:[]);function l(t){t._commandObserver&&(t._commandObserver.remove(),delete t._commandObserver),a.autoMargin(e,g(t))}if(i.enter().append("g").classed(u.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+u.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+u.groupClassName).data(r,v);s.enter().append("g").classed(u.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||f<0){var v={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];t.attr("transform","translate("+v+")")}}}return E.call(R),P&&(L?E.on(".opacity",null):(k=0,M=!0,E.text(m).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)}))),E.call(u.makeEditable,{gd:e}).on("edit",(function(t){void 0!==y?o.call("_guiRestyle",e,v,t,y):o.call("_guiRelayout",e,v,t)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(R)})).on("input",(function(e){this.text(e||" ").call(u.positionText,b.x,b.y)}))),E.classed("js-placeholder",M),w}}},{"../../constants/alignment":154,"../../constants/interactions":157,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/plots":257,"../../registry":265,"../color":52,"../drawing":74,d3:16,"fast-isnumeric":18}],148:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("../color/attributes"),i=e("../../lib/extend").extendFlat,o=e("../../plot_api/edit_types").overrideAll,l=e("../../plots/pad_attributes"),s=e("../../plot_api/plot_template").templatedArray,c=s("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"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});t.exports=o(s("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:c,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:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":173,"../../plot_api/edit_types":206,"../../plot_api/plot_template":213,"../../plots/font_attributes":251,"../../plots/pad_attributes":256,"../color/attributes":51}],149:[function(e,t,r){"use strict";t.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"}}},{}],150:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/array_container_defaults"),i=e("./attributes"),o=e("./constants").name,l=i.buttons;function s(e,t,r){function o(r,a){return n.coerce(e,t,i,r,a)}o("visible",a(e,t,{name:"buttons",handleItemDefaults:c}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),n.noneOrAll(e,t,["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 c(e,t){function r(r,a){return n.coerce(e,t,l,r,a)}r("visible","skip"===e.method||Array.isArray(e.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}t.exports=function(e,t){a(e,t,{name:o,handleItemDefaults:s})}},{"../../lib":179,"../../plots/array_container_defaults":219,"./attributes":148,"./constants":149}],151:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../plots/plots"),i=e("../color"),o=e("../drawing"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../plot_api/plot_template").arrayEditor,u=e("../../constants/alignment").LINE_SPACING,f=e("./constants"),d=e("./scrollbox");function p(e){return e._index}function h(e,t){return+e.attr(f.menuIndexAttrName)===t._index}function g(e,t,r,n,a,i,o,l){t.active=o,c(e.layout,f.name,t).applyUpdate("active",o),"buttons"===t.type?m(e,n,null,null,t):"dropdown"===t.type&&(a.attr(f.menuIndexAttrName,"-1"),v(e,n,a,i,t),l||m(e,n,a,i,t))}function v(e,t,r,n,a){var i=l.ensureSingle(t,"g",f.headerClassName,(function(e){e.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,e).call(A,a,d,p),l.ensureSingle(t,"text",f.headerArrowClassName,(function(e){e.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(e,t,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(t,s.lx,s.ly)}function m(e,t,r,i,o){r||(r=t).attr("pointer-events","all");var s=function(e){return-1==+e.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,e).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(e,o,0,t,r,i,-1),a.executeAPICommand(e,l.method,l.args2)):(g(e,o,0,t,r,i,s),a.executeAPICommand(e,l.method,l.args))),e.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(m.openWidth,m.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(m.openHeight,m.headerHeight)),k.direction=o.direction,i&&(u.size()?function(e,t,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[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(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(e){e.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),k?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>T,D=l.barWidth+2*l.barPad,P=l.barLength+2*l.barPad,z=h+g,E=v;z+D>s&&(z=s-D);var R=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),O?(this.vbar=R.attr({rx:l.barRadius,ry:l.barRadius,x:z,y:E,width:D,height:P}),this._vbarYMin=E+P/2,this._vbarTranslateMax=T-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,F=u-.5,N=O?f+D+.5:f+.5,H=d-.5,B=k?p+A+.5:p+.5,j=o._topdefs.selectAll("#"+I).data(k||O?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",I).append("rect"),k||O?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(H),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(B)-Math.floor(H)}),this.container.call(i.setClipUrl,I,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||O){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 U=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(t,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.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)},l.prototype._onBoxDrag=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e-=n.event.dx),this.vbar&&(t-=n.event.dy),this.setTranslate(e,t)},l.prototype._onBoxWheel=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e+=n.event.deltaY),this.vbar&&(t+=n.event.deltaY),this.setTranslate(e,t)},l.prototype._onBarDrag=function(){var e=this.translateX,t=this.translateY;if(this.hbar){var r=e+this._hbarXMin,a=r+this._hbarTranslateMax;e=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=t+this._vbarYMin,l=i+this._vbarTranslateMax;t=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(e,t)},l.prototype.setTranslate=function(e,t){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(e=o.constrain(e||0,0,r),t=o.constrain(t||0,0,n),this.translateX=e,this.translateY=t,this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-t),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+t-.5)}),this.hbar){var a=e/r;this.hbar.call(i.setTranslate,e+a*this._hbarTranslateMax,t)}if(this.vbar){var l=t/n;this.vbar.call(i.setTranslate,e,t+l*this._vbarTranslateMax)}}},{"../../lib":179,"../color":52,"../drawing":74,d3:16}],154:[function(e,t,r){"use strict";t.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"}}},{}],155:[function(e,t,r){"use strict";t.exports={INCREASING:{COLOR:"#3D9970",SYMBOL:"\u25b2"},DECREASING:{COLOR:"#FF4136",SYMBOL:"\u25bc"}}},{}],156:[function(e,t,r){"use strict";t.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],157:[function(e,t,r){"use strict";t.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],158:[function(e,t,r){"use strict";t.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],159:[function(e,t,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}},{}],160:[function(e,t,r){"use strict";r.version=e("./version").version,e("es6-promise").polyfill(),e("../build/plotcss"),e("./fonts/mathjax_config")();for(var n=e("./registry"),a=r.register=n.register,i=e("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],163:[function(e,t,r){"use strict";r.isLeftAnchor=function(e){return"left"===e.xanchor||"auto"===e.xanchor&&e.x<=1/3},r.isCenterAnchor=function(e){return"center"===e.xanchor||"auto"===e.xanchor&&e.x>1/3&&e.x<2/3},r.isRightAnchor=function(e){return"right"===e.xanchor||"auto"===e.xanchor&&e.x>=2/3},r.isTopAnchor=function(e){return"top"===e.yanchor||"auto"===e.yanchor&&e.y>=2/3},r.isMiddleAnchor=function(e){return"middle"===e.yanchor||"auto"===e.yanchor&&e.y>1/3&&e.y<2/3},r.isBottomAnchor=function(e){return"bottom"===e.yanchor||"auto"===e.yanchor&&e.y<=1/3}},{}],164:[function(e,t,r){"use strict";var n=e("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(e){return Math.abs(e[1]-e[0])>l-1e-14}function c(e,t){return i(t-e,l)}function u(e,t){if(s(t))return!0;var r,n;t[0](n=a(n,l))&&(n+=l);var i=a(e,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(e,t,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(e,t){return[e*Math.cos(t)+a,i-e*Math.sin(t)]}g?(u=0,f=o,d=l):r=a&&e<=i);var a,i},pathArc:function(e,t,r,n,a){return f(null,e,t,r,n,a,0)},pathSector:function(e,t,r,n,a){return f(null,e,t,r,n,a,1)},pathAnnulus:function(e,t,r,n,a,i){return f(e,t,r,n,a,i,1)}}},{"./mod":186}],165:[function(e,t,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(e){return a.isView(e)&&!(e instanceof i)}function l(e){return n(e)||o(e)}function s(e,t,r){if(l(e)){if(l(e[0])){for(var n=r,a=0;aa.max?t.set(r):t.set(+e)}},integer:{coerceFunction:function(e,t,r,a){e%1||!n(e)||void 0!==a.min&&ea.max?t.set(r):t.set(+e)}},string:{coerceFunction:function(e,t,r,n){if("string"!=typeof e){var a="number"==typeof e;!0!==n.strict&&a?t.set(String(e)):t.set(r)}else n.noBlank&&!e?t.set(r):t.set(e)}},color:{coerceFunction:function(e,t,r){a(e).isValid()?t.set(e):t.set(r)}},colorlist:{coerceFunction:function(e,t,r){Array.isArray(e)&&e.length&&e.every((function(e){return a(e).isValid()}))?t.set(e):t.set(r)}},colorscale:{coerceFunction:function(e,t,r){t.set(o.get(e,r))}},angle:{coerceFunction:function(e,t,r){"auto"===e?t.set("auto"):n(e)?t.set(u(+e,360)):t.set(r)}},subplotid:{coerceFunction:function(e,t,r,n){var a=n.regex||c(r);"string"==typeof e&&a.test(e)?t.set(e):t.set(r)},validateFunction:function(e,t){var r=t.dflt;return e===r||"string"==typeof e&&!!c(r).test(e)}},flaglist:{coerceFunction:function(e,t,r,n){if("string"==typeof e)if(-1===(n.extras||[]).indexOf(e)){for(var a=e.split("+"),i=0;i=n&&e<=a?e:u}if("string"!=typeof e&&"number"!=typeof e)return u;e=String(e);var c=_(t),m=e.charAt(0);!c||"G"!==m&&"g"!==m||(e=e.substr(1),t="");var w=c&&"chinese"===t.substr(0,7),T=e.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),L=Number(T[7]||0),S=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var O;k=Number(k);try{var D=v.getComponentMethod("calendars","getCal")(t);if(w){var P="i"===M.charAt(M.length-1);M=parseInt(M,10),O=D.newDate(k,D.toMonthIndex(k,M,P),A)}else O=D.newDate(k,Number(M),A)}catch(e){return u}return O?(O.toJD()-g)*f+L*d+S*p+C*h:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var z=new Date(Date.UTC(2e3,M,A,L,S));return z.setUTCFullYear(k),z.getUTCMonth()!==M||z.getUTCDate()!==A?u:z.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(e,t){return r.dateTime2ms(e,t)!==u};var T=90*f,k=3*d,M=5*p;function A(e,t,r,n,a){if((t||r||n||a)&&(e+=" "+w(t,2)+":"+w(r,2),(n||a)&&(e+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;e+="."+w(a,i)}return e}r.ms2DateTime=function(e,t,r){if("number"!=typeof e||!(e>=n&&e<=a))return u;t||(t=0);var i,o,l,c,y,x,b=Math.floor(10*s(e+.05,1)),w=Math.round(e-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(e,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(e){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=t=n+f&&e<=a-f))return u;var t=Math.floor(10*s(e+.05,1)),r=new Date(Math.round(e-t/10));return A(i("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+t)},r.cleanDate=function(e,t,n){if(e===u)return t;if(r.isJSDate(e)||"number"==typeof e&&isFinite(e)){if(_(n))return l.error("JS Dates and milliseconds are incompatible with world calendars",e),t;if(!(e=r.ms2DateTimeLocal(+e))&&void 0!==t)return t}else if(!r.isDateTime(e,n))return l.error("unrecognized date",e),t;return e};var L=/%\d?f/g;function S(e,t,r,n){e=e.replace(L,(function(e){var r=Math.min(+e.charAt(1)||6,6);return(t/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(t+.05));if(_(n))try{e=v.getComponentMethod("calendars","worldCalFmt")(e,t,n)}catch(e){return"Invalid"}return r(e)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(e,t,r,n,a,i){if(a=_(a)&&a,!t)if("y"===r)t=i.year;else if("m"===r)t=i.month;else{if("d"!==r)return function(e,t){var r=s(e+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==t){o(t)||(t=0);var a=(100+Math.min(s(e/h,60),C[t])).toFixed(t).substr(1);t>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(e,r)+"\n"+S(i.dayMonthYear,e,n,a);t=i.dayMonth+"\n"+i.year}return S(t,e,n,a)};var O=3*f;r.incrementMonth=function(e,t,r){r=_(r)&&r;var n=s(e,f);if(e=Math.round(e-n),r)try{var a=Math.round(e/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return t%12?i.add(o,t,"m"):i.add(o,t/12,"y"),(o.toJD()-g)*f+n}catch(t){l.error("invalid ms "+e+" in calendar "+r)}var c=new Date(e+O);return c.setUTCMonth(c.getUTCMonth()+t)+n-O},r.findExactDates=function(e,t){for(var r,n,a=0,i=0,l=0,s=0,c=_(t)&&v.getComponentMethod("calendars","getCal")(t),u=0;u1||g<0||g>1?null:{x:e+s*g,y:t+f*g}}function s(e,t,r,n,a){var i=n*e+a*t;if(i<0)return n*n+a*a;if(i>r){var o=n-e,l=a-t;return o*o+l*l}var s=n*t-a*e;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(e,t,r,n,a,i,o,c){if(l(e,t,r,n,a,i,o,c))return 0;var u=r-e,f=n-t,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-e,i-t),s(u,f,h,o-e,c-t),s(d,p,g,e-a,t-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(e,t,r,l){if(e===a&&l===i||(n={},a=e,i=l),n[r])return n[r];var s=e.getPointAtLength(o(r-l/2,t)),c=e.getPointAtLength(o(r+l/2,t)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=e.getPointAtLength(o(r,t)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(e,t,r){var n,a,i=t.left,o=t.right,l=t.top,s=t.bottom,c=0,u=e.getTotalLength(),f=u;function d(t){var r=e.getPointAtLength(t);0===t?n=r:t===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(e,t,r,n){for(var a,i,o,l=(n=n||{}).pathLength||e.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=e.getPointAtLength(0)[r]>e.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":186}],177:[function(e,t,r){"use strict";t.exports=function(e){return e}},{}],178:[function(e,t,r){"use strict";t.exports=function(e,t){if(!t)return e;var r=1/Math.abs(t),n=r>1?(r*e+r*t)/r:e+t,a=String(n).length;if(a>16){var i=String(t).length;if(a>=String(e).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],179:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../constants/numerical"),l=o.FP_SAFE,s=o.BADNUM,c=t.exports={};c.nestedProperty=e("./nested_property"),c.keyedContainer=e("./keyed_container"),c.relativeAttr=e("./relative_attr"),c.isPlainObject=e("./is_plain_object"),c.toLogRange=e("./to_log_range"),c.relinkPrivateKeys=e("./relink_private");var u=e("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=e("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var d=e("./coerce");c.valObjectMeta=d.valObjectMeta,c.coerce=d.coerce,c.coerce2=d.coerce2,c.coerceFont=d.coerceFont,c.coerceHoverinfo=d.coerceHoverinfo,c.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,c.validate=d.validate;var p=e("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var h=e("./search");c.findBin=h.findBin,c.sorterAsc=h.sorterAsc,c.sorterDes=h.sorterDes,c.distinctVals=h.distinctVals,c.roundUp=h.roundUp,c.sort=h.sort,c.findIndexOfMin=h.findIndexOfMin;var g=e("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var v=e("./matrix");c.init2dArray=v.init2dArray,c.transposeRagged=v.transposeRagged,c.dot=v.dot,c.translationMatrix=v.translationMatrix,c.rotationMatrix=v.rotationMatrix,c.rotationXYMatrix=v.rotationXYMatrix,c.apply2DTransform=v.apply2DTransform,c.apply2DTransform2=v.apply2DTransform2;var m=e("./angles");c.deg2rad=m.deg2rad,c.rad2deg=m.rad2deg,c.angleDelta=m.angleDelta,c.angleDist=m.angleDist,c.isFullCircle=m.isFullCircle,c.isAngleInsideSector=m.isAngleInsideSector,c.isPtInsideSector=m.isPtInsideSector,c.pathArc=m.pathArc,c.pathSector=m.pathSector,c.pathAnnulus=m.pathAnnulus;var y=e("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=e("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=e("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=e("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=e("./regex");c.counterRegex=w.counter;var T=e("./throttle");c.throttle=T.throttle,c.throttleDone=T.done,c.clearThrottle=T.clear;var k=e("./dom");function M(e){var t={};for(var r in e)for(var n=e[r],a=0;al?s:i(e)?Number(e):s:s},c.isIndex=function(e,t){return!(void 0!==t&&e>=t)&&(i(e)&&e>=0&&e%1==0)},c.noop=e("./noop"),c.identity=e("./identity"),c.repeat=function(e,t){for(var r=new Array(t),n=0;nr?Math.max(r,Math.min(t,e)):Math.max(t,Math.min(r,e))},c.bBoxIntersect=function(e,t,r){return r=r||0,e.left<=t.right+r&&t.left<=e.right+r&&e.top<=t.bottom+r&&t.top<=e.bottom+r},c.simpleMap=function(e,t,r,n,a){for(var i=e.length,o=new Array(i),l=0;l=Math.pow(2,r)?a>10?(c.warn("randstr failed uniqueness"),s):e(t,r,n,(a||0)+1):s},c.OptionControl=function(e,t){e||(e={}),t||(t="opt");var r={optionList:[],_newoption:function(n){n[t]=e,r[n.name]=n,r.optionList.push(n)}};return r["_"+t]=e,r},c.smooth=function(e,t){if((t=Math.round(t)||0)<2)return e;var r,n,a,i,o=e.length,l=2*o,s=2*t-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=e[a]*c[n];u[r]=i}return u},c.syncOrAsync=function(e,t,r){var n;function a(){return c.syncOrAsync(e,t,r)}for(;e.length;)if((n=(0,e.splice(0,1)[0])(t))&&n.then)return n.then(a).then(void 0,c.promiseError);return r&&r(t)},c.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},c.noneOrAll=function(e,t,r){if(e){var n,a=!1,i=!0;for(n=0;n0?t:0}))},c.fillArray=function(e,t,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(e))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var D=/^\w*$/;c.templateString=function(e,t){var r={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,n){var a;return D.test(n)?a=t[n]:(r[n]=r[n]||c.nestedProperty(t,n).get,a=r[n]()),c.isValidTextValue(a)?a:""}))};var P={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return R.apply(P,arguments)};var z={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return R.apply(z,arguments)};var E=/^[:|\|]/;function R(e,t,r){var i=this,o=arguments;t||(t={});var l={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,s,u){var f,d,p,h;for(p=3;p=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var I=2e9;c.seedPseudoRandom=function(){I=2e9},c.pseudoRandom=function(){var e=I;return I=(69069*I+1)%4294967296,Math.abs(I-e)<429496729?c.pseudoRandom():I/4294967296},c.fillText=function(e,t,r){var n=Array.isArray(r)?function(e){r.push(e)}:function(e){r.text=e},a=c.extractOption(e,t,"htx","hovertext");if(c.isValidTextValue(a))return n(a);var i=c.extractOption(e,t,"tx","text");return c.isValidTextValue(i)?n(i):void 0},c.isValidTextValue=function(e){return e||0===e},c.formatPercent=function(e,t){t=t||0;for(var r=(Math.round(100*e*Math.pow(10,t))*Math.pow(.1,t)).toFixed(t)+"%",n=0;n1&&(c=1):c=0,"translate("+(a-c*(r+o))+","+(i-c*(n+l))+")"+(c<1?"scale("+c+")":"")+(s?"rotate("+s+(t?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(e,t){var r=c.extendFlat({},t);return r.size=Math.max(t.size,e._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":158,"./anchor_utils":163,"./angles":164,"./array":165,"./clean_number":166,"./clear_responsive":168,"./coerce":169,"./dates":170,"./dom":171,"./extend":173,"./filter_unique":174,"./filter_visible":175,"./geometry2d":176,"./identity":177,"./increment":178,"./is_plain_object":180,"./keyed_container":181,"./localize":182,"./loggers":183,"./make_trace_groups":184,"./matrix":185,"./mod":186,"./nested_property":187,"./noop":188,"./notifier":189,"./push_unique":192,"./regex":194,"./relative_attr":195,"./relink_private":196,"./search":197,"./stats":199,"./throttle":201,"./to_log_range":202,d3:16,"d3-time-format":14,"fast-isnumeric":18}],180:[function(e,t,r){"use strict";t.exports=function(e){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(e):"[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.prototype}},{}],181:[function(e,t,r){"use strict";var n=e("./nested_property"),a=/^\w*$/;t.exports=function(e,t,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};t&&t.length?(s=n(e,t),l=s.get()):l=e,t=t||"";var u={};if(l)for(o=0;o2)return c[t]=2|c[t],d.set(e,null);if(f){for(o=t;o1){var t=["LOG:"];for(e=0;e1){var r=[];for(e=0;e"),"long")}},i.warn=function(){var e;if(n.logging>0){var t=["WARN:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}},i.error=function(){var e;if(n.logging>0){var t=["ERROR:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}}},{"../plot_api/plot_config":211,"./notifier":189}],184:[function(e,t,r){"use strict";var n=e("d3");t.exports=function(e,t,r){var a=e.selectAll("g."+r.replace(/\s/g,".")).data(t,(function(e){return e[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=e.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(e){e[0][i]=n.select(this)})),a}},{d3:16}],185:[function(e,t,r){"use strict";r.init2dArray=function(e,t){for(var r=new Array(e),n=0;nt/2?e-Math.round(e/t)*t:e}}},{}],187:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./array").isArrayOrTypedArray;function i(e,t){return function(){var r,n,o,l,s,c=e;for(l=0;l/g),s=0;si||c===a||cl)&&(!t||!s(e))}:function(e,t){var s=e[0],c=e[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(e,t){var r=[e[0]],n=0,a=0;function o(o){e.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(e.pop());return{addPt:o,raw:e,filtered:r}}},{"../constants/numerical":158,"./matrix":185}],192:[function(e,t,r){"use strict";t.exports=function(e,t){if(t instanceof RegExp){for(var r=t.toString(),n=0;na.queueLength&&(e.undoQueue.queue.shift(),e.undoQueue.index--))},startSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!0,e.undoQueue.beginSequence=!0},stopSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!1,e.undoQueue.beginSequence=!1},undo:function(e){var t,r;if(e.framework&&e.framework.isPolar)e.framework.undo();else if(!(void 0===e.undoQueue||isNaN(e.undoQueue.index)||e.undoQueue.index<=0)){for(e.undoQueue.index--,t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;r=e.undoQueue.queue.length)){for(t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;rt}function u(e,t){return e>=t}r.findBin=function(e,t,r){if(n(t.start))return r?Math.ceil((e-t.start)/t.size-1e-9)-1:Math.floor((e-t.start)/t.size+1e-9);var i,o,f=0,d=t.length,p=0,h=d>1?(t[d-1]-t[0])/(d-1):1;for(o=h>=0?r?l:s:r?u:c,e+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.log("Long binary search..."),f-1},r.sorterAsc=function(e,t){return e-t},r.sorterDes=function(e,t){return t-e},r.distinctVals=function(e,t){var n,a=(t||{}).unitMinDiff,i=e.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var l=1;a||(l=i[n]-i[0]||1);for(var s,c=l/(n||1)/1e4,u=[],f=0;f<=n;f++){var d=i[f],p=d-s;void 0===s?(u.push(d),s=d):p>c&&(l=Math.min(l,p),u.push(d),s=d)}return{vals:u,minDiff:l}},r.roundUp=function(e,t,r){for(var n,a=0,i=t.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()},r.findIndexOfMin=function(e,t){t=t||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(t)||(t=!1),a(i[0])){for(s=new Array(o),l=0;le.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}},{"./array":165,"fast-isnumeric":18}],200:[function(e,t,r){"use strict";var n=e("d3"),a=e("../lib"),i=e("../constants/xmlns_namespaces"),o=e("../constants/alignment").LINE_SPACING;function l(e,t){return e.node().getBoundingClientRect()[t]}var s=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(e,t,M){var A=e.text(),S=!e.attr("data-notex")&&"undefined"!=typeof MathJax&&A.match(s),C=n.select(e.node().parentNode);if(!C.empty()){var O=e.attr("class")?e.attr("class").split(" ")[0]:"text";return O+="-math",C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove(),e.style("display",null).attr({"data-unformatted":A,"data-math":"N"}),S?(t&&t._promises||[]).push(new Promise((function(t){e.style("display","none");var r=parseInt(e.node().style.fontSize,10),i={fontSize:r};!function(e,t,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":t.fontSize+"px"}).text(e.replace(c,"\\lt ").replace(u,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var t=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",e),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),t,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(S[2],i,(function(n,a,i){C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return D(),void t();var s=C.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":A,"data-math":"Y"});s.node().appendChild(o.node()),a&&a.node()&&o.node().insertBefore(a.node().cloneNode(!0),o.node().firstChild),o.attr({class:O,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=e.node().style.fill||"black",u=o.select("g");u.attr({fill:c,stroke:c});var f=l(u,"width"),d=l(u,"height"),p=+e.attr("x")-f*{start:0,middle:.5,end:1}[e.attr("text-anchor")||"start"],h=-(r||l(e,"height"))/4;"y"===O[0]?(s.attr({transform:"rotate("+[-90,+e.attr("x"),+e.attr("y")]+") translate("+[-f/2,h-d/2]+")"}),o.attr({x:+e.attr("x"),y:+e.attr("y")})):"l"===O[0]?o.attr({x:e.attr("x"),y:h-d/2}):"a"===O[0]&&0!==O.indexOf("atitle")?o.attr({x:0,y:h}):o.attr({x:p,y:+e.attr("y")+h-d/2}),M&&M.call(e,s),t(s)}))}))):D(),e}function D(){C.empty()||(O=e.attr("class")+"-math",C.select("svg."+O).remove()),e.text("").style("white-space","pre"),function(e,t){t=t.replace(g," ");var r,l=!1,s=[],c=-1;function u(){c++;var t=document.createElementNS(i.svg,"tspan");n.select(t).attr({class:"line",dy:c*o+"em"}),e.appendChild(t),r=t;var a=s;if(s=[{node:t}],a.length>1)for(var l=1;l doesnt match end tag <"+e+">. Pretending it did match.",t),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",t)}y.test(t)?u():(r=e,s=[{node:e}]);for(var C=t.split(v),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"},d={sub:"0.3em",sup:"-0.6em"},p={sub:"-0.21em",sup:"0.42em"},h=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,m=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,b=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(e,t){if(!e)return null;var r=e.match(t),n=r&&(r[3]||r[4]);return n&&L(n)}var k=/(^|;)\s*color:/;r.plainText=function(e,t){for(var r=void 0!==(t=t||{}).len&&-1!==t.len?t.len:1/0,n=void 0!==t.allowedTags?t.allowedTags:["br"],a="...".length,i=e.split(v),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var M={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},A=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function L(e){return e.replace(A,(function(e,t){return("#"===t.charAt(0)?function(e){if(e>1114111)return;var t=String.fromCodePoint;if(t)return t(e);var r=String.fromCharCode;return e<=65535?r(e):r(55232+(e>>10),e%1024+56320)}("x"===t.charAt(1)?parseInt(t.substr(2),16):parseInt(t.substr(1),10)):M[t])||e}))}function S(e,t,r){var n,a,i,o=r.horizontalAlign,l=r.verticalAlign||"top",s=e.node().getBoundingClientRect(),c=t.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},i="right"===o?function(){return s.right-n.width}:"center"===o?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:i()-c.left+"px","z-index":1e3}),this}}r.convertEntities=L,r.sanitizeHTML=function(e){e=e.replace(g," ");for(var t=document.createElement("p"),r=t,a=[],i=e.split(v),o=0;oi.ts+t?s():i.timer=setTimeout((function(){s(),i.timer=null}),t)},r.done=function(e){var t=n[e];return t&&t.timer?new Promise((function(e){var r=t.onDone;t.onDone=function(){r&&r(),e(),t.onDone=null}})):Promise.resolve()},r.clear=function(e){if(e)a(n[e]),delete n[e];else for(var t in n)r.clear(t)}},{}],202:[function(e,t,r){"use strict";var n=e("fast-isnumeric");t.exports=function(e,t){if(e>0)return Math.log(e)/Math.LN10;var r=Math.log(Math.min(t[0],t[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(t[0],t[1]))/Math.LN10-6),r}},{"fast-isnumeric":18}],203:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],204:[function(e,t,r){"use strict";t.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"}}},{}],205:[function(e,t,r){"use strict";var n=e("../registry");t.exports=function(e){for(var t,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=e.split("[")[0],l=0;l0&&o.log("Clearing previous rejected promises from queue."),e._promises=[]},r.cleanLayout=function(e){var t,n;e||(e={}),e.xaxis1&&(e.xaxis||(e.xaxis=e.xaxis1),delete e.xaxis1),e.yaxis1&&(e.yaxis||(e.yaxis=e.yaxis1),delete e.yaxis1),e.scene1&&(e.scene||(e.scene=e.scene1),delete e.scene1);var i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(e);for(t=0;t3?(D.x=1.02,D.xanchor="left"):D.x<-2&&(D.x=-.02,D.xanchor="right"),D.y>3?(D.y=1.02,D.yanchor="bottom"):D.y<-2&&(D.y=-.02,D.yanchor="top")),h(e),"rotate"===e.dragmode&&(e.dragmode="orbit"),c.clean(e),e.template&&e.template.layout&&r.cleanLayout(e.template.layout),e},r.cleanData=function(e){for(var t=0;t0)return e.substr(0,t)}r.hasParent=function(e,t){for(var r=b(t);r;){if(r in e)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(e,t,r){for(var n=0;n1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))t.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;t.set(y)}return!g&&(d(v,m),p(e),!0)}var x,b,_,w,T,k,M,A,L=Object.keys(r).map(Number).sort(o),S=t.get(),C=S||[],O=u(m,f).get(),D=[],P=-1,z=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?D.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),O&&O.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,k),-1===P&&(P=_);else for(b=0;b=0;x--)C.splice(D[x],1),O&&O.splice(D[x],1);if(C.length?S||t.set(C):t.set(null),g)return!1;if(d(v,m),h!==a){var E;if(-1===P)E=L;else{for(z=Math.max(C.length,z),E=[],x=0;x=P);x++)E.push(_);for(x=P;x=e.data.length||a<-e.data.length)throw new Error(r+" must be valid indices for gd.data.");if(t.indexOf(a,n+1)>-1||a>=0&&t.indexOf(-e.data.length+a)>-1||a<0&&t.indexOf(e.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function E(e,t,r){if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("currentIndices is a required argument.");if(Array.isArray(t)||(t=[t]),z(e,t,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&z(e,r,"newIndices"),"undefined"!=typeof r&&t.length!==r.length)throw new Error("current and new indices must be of equal length.")}function R(e,t,r,n,i){!function(e,t,r,n){var a=o.isPlainObject(n);if(!Array.isArray(e.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(t))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 i in z(e,r,"indices"),t){if(!Array.isArray(t[i])||t[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==t[i].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")}}(e,t,r,n);for(var s=function(e,t,r,n){var i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=P(r,e.data.length-1),t)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(t,r){e[r]=e[t],delete e[t]}}function U(e,t,r){if(e=o.getGraphDiv(e),T.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var n={};if("string"==typeof t)n[t]=r;else{if(!o.isPlainObject(t))return o.warn("Relayout fail.",t,r),Promise.reject();n=o.extendFlat({},t)}Object.keys(n).length&&(e.changed=!0);var a=W(e,n),i=a.flags;i.calc&&(e.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(k.layoutReplot):Object.keys(n).length&&(q(e,i,a)||d.supplyDefaults(e),i.legend&&l.push(k.doLegend),i.layoutstyle&&l.push(k.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(k.doTicksRelayout),i.modebar&&l.push(k.doModeBar),i.camera&&l.push(k.doCamera),i.colorbars&&l.push(k.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(e,U,[e,a.undoit],U,[e,a.redoit]);var s=o.syncOrAsync(l,e);return s&&s.then||(s=Promise.resolve(e)),s.then((function(){return e.emit("plotly_relayout",a.eventData),e}))}function q(e,t,r){var n=e._fullLayout;if(!t.axrange)return!1;for(var a in t)if("axrange"!==a&&t[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=e.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(e,t){var r=t?function(e){var r=[],n=!0;for(var a in t){var i=h.getFromId(e,a);if(r.push(a),i._matchGroup)for(var o in i._matchGroup)t[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(e,r,{skipTitle:n})}:function(e){return h.draw(e,"redraw")};e.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(e,t){var r,n,a,i=e.layout,s=e._fullLayout,c=s._guiEditing,d=H(s._preGUI,c),p=Object.keys(t),g=h.list(e),v=o.extendDeepAll({},t),m={};for(V(t),p=Object.keys(t),n=0;n0&&"string"!=typeof z.parts[R];)R--;var I=z.parts[R],F=z.parts[R-1]+"."+I,B=z.parts.slice(0,R).join("."),j=l(e.layout,B).get(),U=l(s,B).get(),q=z.get();if(void 0!==E){k[P]=E,L[P]="reverse"===I?E:N(q);var G=f.getLayoutValObject(s,z.parts);if(G&&G.impliedEdits&&null!==E)for(var W in G.impliedEdits)S(o.relativeAttr(P,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(P))if(E){S("autosize",null);var J="height"===P?"width":"height";S(J,s[J])}else s[P]=e._initialAutoSize[P];else if("autosize"===P)S("width",E?null:s.width),S("height",E?null:s.height);else if(F.match(Z))D(F),l(s,B+"._inputRange").set(null);else if(F.match(Y)){D(F),l(s,B+"._inputRange").set(null);var $=l(s,B).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else F.match(X)&&l(s,B+"._inputDomain").set(null);if("type"===I){var K=j,ee="linear"===U.type&&"log"===E,te="log"===U.type&&"linear"===E;if(ee||te){if(K&&K.range)if(U.autorange)ee&&(K.range=K.range[1]>K.range[0]?[1,2]:[2,1]);else{var re=K.range[0],ne=K.range[1];ee?(re<=0&&ne<=0&&S(B+".autorange",!0),re<=0?re=ne/1e6:ne<=0&&(ne=re/1e6),S(B+".range[0]",Math.log(re)/Math.LN10),S(B+".range[1]",Math.log(ne)/Math.LN10)):(S(B+".range[0]",Math.pow(10,re)),S(B+".range[1]",Math.pow(10,ne)))}else S(B+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[z.parts[0]]&&"radialaxis"===z.parts[1]&&delete s[z.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(e,U,E,S),u.getComponentMethod("images","convertCoords")(e,U,E,S)}else S(B+".autorange",!0),S(B+".range",null);l(s,B+"._inputRange").set(null)}else if(I.match(A)){var ae=l(s,P).get(),ie=(E||{}).type;ie&&"-"!==ie||(ie="linear"),u.getComponentMethod("annotations","convertCoords")(e,ae,ie,S),u.getComponentMethod("images","convertCoords")(e,ae,ie,S)}var oe=w.containerArrayMatch(P);if(oe){r=oe.array,n=oe.index;var le=oe.property,se=G||{editType:"calc"};""!==n&&""===le&&(w.isAddVal(E)?L[P]=null:w.isRemoveVal(E)?L[P]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",t)),M.update(_,se),m[r]||(m[r]={});var ce=m[r][n];ce||(ce=m[r][n]={}),ce[le]=E,delete t[P]}else"reverse"===I?(j.range?j.range.reverse():(S(B+".autorange",!0),j.range=[1,0]),U.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===P&&("lasso"===E||"select"===E)&&"lasso"!==q&&"select"!==q||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,z.set(E))}}for(r in m){w.applyContainerArrayChanges(e,d(i,r),m[r],_,d)||(_.plot=!0)}var ue=s._axisConstraintGroups||[];for(C in O)for(n=0;n1;)if(n.pop(),void 0!==(r=l(t,n.join(".")+".uirevision").get()))return r;return t.uirevision}function ne(e,t){for(var r=0;r=a.length?a[0]:a[e]:a}function s(e){return Array.isArray(i)?e>=i.length?i[0]:i[e]:i}function c(e,t){var r=0;return function(){if(e&&++r===t)return e()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){function f(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var t=n._currentFrame=n._frameQueue.shift();if(t){var r=t.name?t.name.toString():null;e._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=t.frameOpts.duration,d.transition(e,t.frame.data,t.frame.layout,T.coerceTraceIndices(e,t.frame.traces),t.frameOpts,t.transitionOpts).then((function(){t.onComplete&&t.onComplete()})),e.emit("plotly_animatingframe",{name:r,frame:t.frame,animation:{frame:t.frameOpts,transition:t.transitionOpts}})}else e.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function p(){e.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var t=function(){n._animationRaf=window.requestAnimationFrame(t),Date.now()-n._lastFrameAt>n._timeToNext&&f()};t()}var h,g,v=0;function m(e){return Array.isArray(a)?v>=a.length?e.transitionOpts=a[v]:e.transitionOpts=a[0]:e.transitionOpts=a,v++,e}var y=[],x=null==t,b=Array.isArray(t);if(!x&&!b&&o.isPlainObject(t))y.push({type:"object",data:m(o.extendFlat({},t))});else if(x||-1!==["string","number"].indexOf(typeof t))for(h=0;h0&&kk)&&M.push(g);y=M}}y.length>0?function(t){if(0!==t.length){for(var a=0;a=0;n--)if(o.isPlainObject(t[n])){var g=t[n].name,v=(u[g]||h[g]||{}).name,m=t[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[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.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(t[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(e,t){return e.index>t.index?-1:e.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+e._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=t[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[e,l],p=[e,i];return c&&c.add(e,s,f,u,p),d.modifyFrames(e,i)},r.addTraces=function e(t,n,a){t=o.getGraphDiv(t);var i,l,s=[],u=r.deleteTraces,f=e,d=[t,s],p=[t,n];for(function(e,t,r){var n,a;if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("traces must be defined.");for(Array.isArray(t)||(t=[t]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===e.dimensions){if(r++,t.length===r)return e;var o=t[r];if(!_(o))return!1;e=i[a][o]}else e=i[a]}else e=i}}return e}function _(e){return e===Math.round(e)&&e>=0}function w(){var e,t,r={};for(e in h(r,o),n.subplotsRegistry){if((t=n.subplotsRegistry[e]).layoutAttributes)if(Array.isArray(t.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[t[2]],l=3}else if("area"===e.type)a=u[o];else{var f=e._module;if(f||(f=(n.modules[e.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,t,l)},r.getLayoutValObject=function(e,t){return b(function(e,t){var r,a,i,l,s=e._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=t+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(e,t){o?n.nestedProperty(l[s],e).set(t):l[s+"."+e]=t}function f(){var e=l;return c(),e}return c(),{modifyBase:function(e,t){l[e]=t},modifyItem:u,getUpdateObj:f,applyUpdate:function(t,r){t&&u(t,r);var a=f();for(var i in a)n.nestedProperty(e,i).set(a[i])}}}},{"../lib":179,"../plots/attributes":220}],214:[function(e,t,r){"use strict";var n=e("d3"),a=e("../registry"),i=e("../plots/plots"),o=e("../lib"),l=e("../lib/clear_gl_canvases"),s=e("../components/color"),c=e("../components/drawing"),u=e("../components/titles"),f=e("../components/modebar"),d=e("../plots/cartesian/axes"),p=e("../constants/alignment"),h=e("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=e("../plots/cartesian/autorange").doAutoRange;function y(e,t,r){for(var n=0;n=e[1]||a[1]<=e[0])&&(i[0]t[0]))return!0}return!1}function x(e){var t,a,l,u,h,g,v=e._fullLayout,m=v._size,x=m.p,_=d.list(e,"",!0);if(v._paperdiv.style({width:e._context.responsive&&v.autosize&&!e._context._hasZeroWidth&&!e.layout.width?"100%":v.width+"px",height:e._context.responsive&&v.autosize&&!e._context._hasZeroHeight&&!e.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),e._context.setBackground(e,v.paper_bgcolor),r.drawMainTitle(e),f.manage(e),!v._has("cartesian"))return i.previousPromises(e);function T(e,t,r){var n=e._lw/2;return"x"===e._id.charAt(0)?t?"top"===r?t._offset-x-n:t._offset+t._length+x+n:m.t+m.h*(1-(e.position||0))+n%1:t?"right"===r?t._offset+t._length+x+n:t._offset-x-n:m.l+m.w*(e.position||0)+n%1}for(t=0;t<_.length;t++){var k=(u=_[t])._anchorAxis;u._linepositions={},u._lw=c.crispRound(e,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,O=l.yaxis.domain,D=l.plotgroup;if(y(C,O,L)){var P=D.node(),z=l.bg=o.ensureSingle(D,"rect","bg");P.insertBefore(z.node(),P.childNodes[0]),A.push(a)}else D.select("rect.bg").remove(),L.push([C,O]),S||(M.push(a),A.push(a))}var E,R,I,F,N,H,B,j,V,U,q,G,Z,Y=v._bgLayer.selectAll(".bg").data(M);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(e){v._plots[e].bg=n.select(this)})),t=0;tT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function e(t,r){for(var n in t)if("_"!==n.charAt(0)){var i=t[n],o=g(t,n,r);a(i)?(Array.isArray(t)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),e(i,o)):Array.isArray(i)&&v(i)&&e(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":179,"../plots/attributes":220,"../plots/plots":257,"./plot_config":211,"./plot_schema":212,"./plot_template":213}],216:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./plot_api"),i=e("../plots/plots"),o=e("../lib"),l=e("../snapshot/helpers"),s=e("../snapshot/tosvg"),c=e("../snapshot/svgtoimg"),u=e("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};t.exports=function(e,t){var r,d,p,h;function g(e){return!(e in t)||o.validate(t[e],f[e])}if(t=t||{},o.isPlainObject(e)?(r=e.data||[],d=e.layout||{},p=e.config||{},h={}):(e=o.getGraphDiv(e),r=o.extendDeep([],e.data),d=o.extendDeep({},e.layout),p=e._context,h=e._fullLayout||{}),!g("width")&&null!==t.width||!g("height")&&null!==t.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var v={};function m(e,r){return o.coerce(t,v,f,e,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),T=m("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},d);x?M.width=x:null===t.width&&n(h.width)&&(M.width=h.width),b?M.height=b:null===t.height&&n(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(k);function S(){return new Promise((function(e){setTimeout(e,l.getDelay(k._fullLayout))}))}function C(){return new Promise((function(e,t){var r=s(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function d(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),e(T?p:l.encodeJSON(p))}if(d(),"svg"===y)return e(T?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(e).catch(t)}))}return new Promise((function(e,t){a.plot(k,r,M,A).then(L).then(S).then(C).then((function(t){e(function(e){return T?e.replace(l.IMAGE_URL_PREFIX,""):e}(t))})).catch((function(e){t(e)}))}))}},{"../lib":179,"../plots/plots":257,"../snapshot/helpers":269,"../snapshot/svgtoimg":271,"../snapshot/tosvg":273,"../version":405,"./plot_api":210,"fast-isnumeric":18}],217:[function(e,t,r){"use strict";var n=e("../lib"),a=e("../plots/plots"),i=e("./plot_schema"),o=e("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(e,t,r,a,i,o){o=o||[];for(var f=Object.keys(e),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,O=x.length,D=Array.isArray(k);if(D&&(O=Math.min(O,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var P=x[A].length;for(M=0;M<(D?Math.min(P,k[A].length):P);M++)L=D?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&((b=M-o(v)-o(m))>A?_/b>S&&(y=v,x=m,S=_/b):_/M>S&&(y={val:v.val,pad:0},x={val:m.val,pad:0},S=_/M));if(d===p){var C=d-1,O=d+1;if(T)if(0===d)i=[0,1];else{var D=(d>0?f:u).reduce((function(e,t){return Math.max(e,o(t))}),0),P=d/(1-Math.min(.5,D/M));i=d>0?[0,P]:[P,0]}else i=k?[Math.max(0,C),Math.max(1,O)]:[C,O]}else T?(y.val>=0&&(y={val:0,pad:0}),x.val<=0&&(x={val:0,pad:0})):k&&(y.val-S*o(y)<0&&(y={val:0,pad:0}),x.val<=0&&(x={val:1,pad:0})),S=(x.val-y.val-L(v.val,m.val))/(M-o(y)-o(x)),i=[y.val-S*o(y),x.val+S*o(x)];return h&&i.reverse(),a.simpleMap(i,t.l2r||Number)}function s(e){var t=e._length/20;return"domain"===e.constrain&&e._inputDomain&&(t*=(e._inputDomain[1]-e._inputDomain[0])/(e.domain[1]-e.domain[0])),function(e){return e.pad+(e.extrapad?t:0)}}function c(e,t){var r,n,a,i=t._id,o=e._fullData,l=e._fullLayout,s=[],c=[];function d(e,t){for(r=0;r=r&&(c.extrapad||!o)){l=!1;break}a(t,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(e.splice(s,1),s--)}if(l){var u=i&&0===t;e.push({val:t,pad:u?0:r,extrapad:!u&&o})}}function p(e){return n(e)&&Math.abs(e)=t}t.exports={getAutoRange:l,makePadFn:s,doAutoRange:function(e,t){if(t.setScale(),t.autorange){t.range=l(e,t),t._r=t.range.slice(),t._rl=a.simpleMap(t._r,t.r2l);var r=t._input,n={};n[t._attr+".range"]=t.range,n[t._attr+".autorange"]=t.autorange,o.call("_storeDirectGUIEdit",e.layout,e._fullLayout._preGUI,n),r.range=t.range.slice(),r.autorange=t.autorange}var i=t._anchorAxis;if(i&&i.rangeslider){var s=i.rangeslider[t._name];s&&"auto"===s.rangemode&&(s.range=l(e,t)),i._input.rangeslider[t._name]=a.extendFlat({},s)}},findExtremes:function(e,t,r){r||(r={});e._m||e.setScale();var a,o,l,s,c,d,h,g,v,m=[],y=[],x=t.length,b=r.padded||!1,_=r.tozero&&("linear"===e.type||"-"===e.type),w="log"===e.type,T=!1,k=r.vpadLinearized||!1;function M(e){if(Array.isArray(e))return T=!0,function(t){return Math.max(Number(e[t]||0),0)};var t=Math.max(Number(e||0),0);return function(){return t}}var A=M((e._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),L=M((e._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(g=1/0,v=-1/0,w)for(a=0;a0&&(g=o),o>v&&o-i&&(g=o),o>v&&o=P;a--)D(a);return{min:m,max:y,opts:r}},concatExtremes:c}},{"../../constants/numerical":158,"../../lib":179,"../../registry":265,"fast-isnumeric":18}],223:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../components/titles"),u=e("../../components/color"),f=e("../../components/drawing"),d=e("./layout_attributes"),p=e("./clean_ticks"),h=e("../../constants/numerical"),g=h.ONEMAXYEAR,v=h.ONEAVGYEAR,m=h.ONEMINYEAR,y=h.ONEMAXQUARTER,x=h.ONEAVGQUARTER,b=h.ONEMINQUARTER,_=h.ONEMAXMONTH,w=h.ONEAVGMONTH,T=h.ONEMINMONTH,k=h.ONEWEEK,M=h.ONEDAY,A=M/2,L=h.ONEHOUR,S=h.ONEMIN,C=h.ONESEC,O=h.MINUS_SIGN,D=h.BADNUM,P=e("../../constants/alignment"),z=P.MID_SHIFT,E=P.CAP_SHIFT,R=P.LINE_SPACING,I=P.OPPOSITE_SIDE,F=t.exports={};F.setConvert=e("./set_convert");var N=e("./axis_autotype"),H=e("./axis_ids");F.id2name=H.id2name,F.name2id=H.name2id,F.cleanId=H.cleanId,F.list=H.list,F.listIds=H.listIds,F.getFromId=H.getFromId,F.getFromTrace=H.getFromTrace;var B=e("./autorange");F.getAutoRange=B.getAutoRange,F.findExtremes=B.findExtremes;function j(e){var t=1e-4*(e[1]-e[0]);return[e[0]-t,e[1]+t]}F.coerceRef=function(e,t,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||i),i||(i=a),u[c]={valType:"enumerated",values:s.concat(i?[i]:[]),dflt:a},l.coerce(e,t,u,c)},F.coercePosition=function(e,t,r,n,a,i){var o,s;if("paper"===n||"pixel"===n)o=l.ensureNumber,s=r(a,i);else{var c=F.getFromId(t,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}e[a]=o(s)},F.cleanPosition=function(e,t,r){return("paper"===r||"pixel"===r?l.ensureNumber:F.getFromId(t,r).cleanPos)(e)},F.redrawComponents=function(e,t){t=t||F.listIds(e);var r=e._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-e._forceTick0)/e._minDtick%1+1.000001)%1>2e-6)&&(e._minDtick=0)):e._minDtick=0},F.saveRangeInitial=function(e,t){for(var r=F.list(e,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;e+=e+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?e=F.tickIncrement(e,"M6","reverse")+1.5*M:i.exactMonths>.8?e=F.tickIncrement(e,"M1","reverse")+15.5*M:e-=A;var s=F.tickIncrement(e,r);if(s<=n)return s}return e}(y,e,m,c,i)),v=y,0;v<=u;)v=F.tickIncrement(v,m,!1,i);return{start:t.c2r(y,0,i),end:t.c2r(v,0,i),size:m,_dataSpan:u-c}},F.prepTicks=function(e,t){var r=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if("auto"===e.tickmode||!e.dtick){var n,a=e.nticks;a||("category"===e.type||"multicategory"===e.type?(n=e.tickfont?1.2*(e.tickfont.size||12):15,a=e._length/n):(n="y"===e._id.charAt(0)?40:80,a=l.constrain(e._length/n,4,9)+1),"radialaxis"===e._name&&(a*=2)),"array"===e.tickmode&&(a*=100),e._roughDTick=(Math.abs(r[1]-r[0])-(e._lBreaks||0))/a,F.autoTicks(e,e._roughDTick),e._minDtick>0&&e.dtick<2*e._minDtick&&(e.dtick=e._minDtick,e.tick0=e.l2r(e._forceTick0))}e.tick0||(e.tick0="date"===e.type?"2000-01-01":0),"date"===e.type&&e.dtick<.1&&(e.dtick=.1),K(e)},F.calcTicks=function(e,t){F.prepTicks(e,t);var r=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if("array"===e.tickmode)return function(e){var t=e.tickvals,r=e.ticktext,n=new Array(t.length),a=j(l.simpleMap(e.range,e.r2l)),i=Math.min(a[0],a[1]),o=Math.max(a[0],a[1]),s=0;Array.isArray(r)||(r=[]);var c="category"===e.type?e.d2l_noadd:e.d2l;"log"===e.type&&"L"!==String(e.dtick).charAt(0)&&(e.dtick="L"+Math.pow(10,Math.floor(Math.min(e.range[0],e.range[1]))-1));for(var u=0;ui&&f=o:n<=o)&&!(c.length>r||n===t);n=F.tickIncrement(n,e.dtick,s,e.calendar)){t=n;var a=!1;u&&n!==(0|n)&&(a=!0),c.push({minor:a,value:n})}}();var f="period"===e.ticklabelmode;if(f&&c.unshift({minor:!1,value:F.tickIncrement(c[0].value,e.dtick,!s,e.caldendar)}),e.rangebreaks){var d=c.length;if(d){var p=0;"auto"===e.tickmode&&(p=("y"===e._id.charAt(0)?2:6)*(e.tickfont?e.tickfont.size:12));for(var h,S=[],C=s?1:-1,O=s?d-1:0,P=s?0:d-1;C*P<=C*O;P+=C){var z=c[P];if(e.maskBreaks(z.value)!==D||(z.value=me(z.value,e),!e._rl||e._rl[0]!==z.value&&e._rl[1]!==z.value)){var E=e.c2p(z.value);E===h?S[S.length-1].valuep)&&(h=E,S.push(z))}}c=S.reverse()}}ve(e)&&360===Math.abs(r[1]-r[0])&&c.pop(),e._tmax=(c[c.length-1]||{}).value,e._prevDateHead="",e._inCalcTicks=!0;var R,I=Math.min(r[0],r[1]),N=Math.max(r[0],r[1]),H=F.getTickFormat(e);f&&H&&(/%[fLQsSMX]/.test(H)||(/%[HI]/.test(H)?R=L:/%p/.test(H)?R=A:/%[Aadejuwx]/.test(H)?R=M:/%[UVW]/.test(H)?R=k:/%[Bbm]/.test(H)?R=w:/%[q]/.test(H)?R=x:/%[Yy]/.test(H)&&(R=v)));var B,V,U=[];for(B=0;B0?(W=B-1,Q=B):(W=B,Q=B);var J=U[W].x,$=U[Q].x,K=Math.abs($-J),te=R||K,re=0;if(te>=m?re=K>=m&&K<=g?K:v:R===x&&te>=b?re=K>=b&&K<=y?K:x:te>=T?re=K>=T&&K<=_?K:w:R===k&&te>=k?re=k:te>=M?re=M:R===A&&te>=A?re=A:R===L&&te>=L&&(re=L),re&&e.rangebreaks){for(var ne=0,ae=0,ie=0;ie<42;ie++){var oe=ie/42;e.maskBreaks(J*(1-oe)+$*oe)!==D&&(oe<.5?ne++:ae++)}ae&&(re*=(ne+ae)/42)}re<=K&&(X+=re/2),U[B].periodX=X,(X>N||X=I){e._prevDateHead="",U[B].text=F.tickText(e,U[B].x).text;break}}return e._inCalcTicks=!1,U};var G=[2,5,10],Z=[1,2,3,6,12],Y=[1,2,5,10,15,30],X=[1,2,3,7,14],W=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],Q=[-.301,0,.301,.699,1],J=[15,30,45,90,180];function $(e,t,r){return t*l.roundUp(e/t,r)}function K(e){var t=e.dtick;if(e._tickexponent=0,a(t)||"string"==typeof t||(t=1),"category"!==e.type&&"multicategory"!==e.type||(e._tickround=null),"date"===e.type){var r=e.r2l(e.tick0),n=e.l2r(r).replace(/(^-|i)/g,""),i=n.length;if("M"===String(t).charAt(0))i>10||"01-01"!==n.substr(5)?e._tickround="d":e._tickround=+t.substr(1)%12==0?"y":"m";else if(t>=M&&i<=10||t>=15*M)e._tickround="d";else if(t>=S&&i<=16||t>=L)e._tickround="M";else if(t>=C&&i<=19||t>=S)e._tickround="S";else{var o=e.l2r(r+t).replace(/^-/,"").length;e._tickround=Math.max(i,o)-20,e._tickround<0&&(e._tickround=4)}}else if(a(t)||"L"===t.charAt(0)){var l=e.range.map(e.r2d||Number);a(t)||(t=Number(t.substr(1))),e._tickround=2-Math.floor(Math.log(t)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(c)>3&&(re(e.exponentformat)&&!ne(c)?e._tickexponent=3*Math.round((c-1)/3):e._tickexponent=c)}else e._tickround=null}function ee(e,t,r){var n=e.tickfont||{};return{x:t,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}F.autoTicks=function(e,t){var r;function n(e){return Math.pow(e,Math.floor(Math.log(t)/Math.LN10))}if("date"===e.type){e.tick0=l.dateTick0(e.calendar);var i=2*t;if(i>v)t/=v,r=n(10),e.dtick="M"+12*$(t,r,G);else if(i>w)t/=w,e.dtick="M"+$(t,1,Z);else if(i>M){e.dtick=$(t,M,e._hasDayOfWeekBreaks?[1,2,7,14]:X),e.tick0=l.dateTick0(e.calendar,!0);var o=F.getTickFormat(e);if(/%[uVW]/.test(o)){var s=e.tick0.length,c=+e.tick0[s-1];e.tick0=e.tick0.substring(0,s-2)+String(c+1)}}else i>L?e.dtick=$(t,L,Z):i>S?e.dtick=$(t,S,Y):i>C?e.dtick=$(t,C,Y):(r=n(10),e.dtick=$(t,r,G))}else if("log"===e.type){e.tick0=0;var u=l.simpleMap(e.range,e.r2l);if(t>.7)e.dtick=Math.ceil(t);else if(Math.abs(u[1]-u[0])<1){var f=1.5*Math.abs((u[1]-u[0])/t);t=Math.abs(Math.pow(10,u[1])-Math.pow(10,u[0]))/f,r=n(10),e.dtick="L"+$(t,r,G)}else e.dtick=t>.3?"D2":"D1"}else"category"===e.type||"multicategory"===e.type?(e.tick0=0,e.dtick=Math.ceil(Math.max(t,1))):ve(e)?(e.tick0=0,r=1,e.dtick=$(t,r,J)):(e.tick0=0,r=n(10),e.dtick=$(t,r,G));if(0===e.dtick&&(e.dtick=1),!a(e.dtick)&&"string"!=typeof e.dtick){var d=e.dtick;throw e.dtick=1,"ax.dtick error: "+String(d)}},F.tickIncrement=function(e,t,r,i){var o=r?-1:1;if(a(t))return l.increment(e,o*t);var s=t.charAt(0),c=o*Number(t.substr(1));if("M"===s)return l.incrementMonth(e,c,i);if("L"===s)return Math.log(Math.pow(10,e)+c)/Math.LN10;if("D"===s){var u="D2"===t?Q:W,f=e+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(t)},F.tickFirst=function(e,t){var r=e.r2l||Number,i=l.simpleMap(e.range,r,void 0,void 0,t),o=i[1]"+s,e._prevDateHead=s));t.text=c}(e,o,r,c):"log"===u?function(e,t,r,n,i){var o=e.dtick,s=t.x,c=e.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)t.text=ae(Math.pow(10,s),e,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=e.exponentformat;"power"===p||re(p)&&ne(f)?(t.text=0===f?1:1===f?"10":"10"+(f>1?"":O)+d+"",t.fontSize*=1.25):("e"===p||"E"===p)&&d>2?t.text="1"+p+(f>0?"+":O)+d:(t.text=ae(Math.pow(10,s),e,"","fakehover"),"D1"===o&&"y"===e._id.charAt(0)&&(t.dy-=t.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);t.text=String(Math.round(Math.pow(10,l.mod(s,1)))),t.fontSize*=.75}if("D1"===e.dtick){var h=String(t.text).charAt(0);"0"!==h&&"1"!==h||("y"===e._id.charAt(0)?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(s<0?.5:.25)))}}(e,o,0,c,g):"category"===u?function(e,t){var r=e._categories[Math.round(t.x)];void 0===r&&(r="");t.text=String(r)}(e,o):"multicategory"===u?function(e,t,r){var n=Math.round(t.x),a=e._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?t.text=o+" - "+i:(t.text=i,t.text2=o)}(e,o,r):ve(e)?function(e,t,r,n,a){if("radians"!==e.thetaunit||r)t.text=ae(t.x,e,a,n);else{var i=t.x/180;if(0===i)t.text="0";else{var o=function(e){function t(e,t){return Math.abs(e-t)<=1e-6}var r=function(e){for(var r=1;!t(Math.round(e*r)/r,e);)r*=10;return r}(e),n=e*r,a=Math.abs(function e(r,n){return t(n,0)?r:e(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)t.text=ae(l.deg2rad(t.x),e,a,n);else{var s=t.x<0;1===o[1]?1===o[0]?t.text="\u03c0":t.text=o[0]+"\u03c0":t.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(t.text=O+t.text)}}}}(e,o,r,c,g):function(e,t,r,n,a){"never"===a?a="":"all"===e.showexponent&&Math.abs(t.x/e.dtick)<1e-6&&(a="hide");t.text=ae(t.x,e,a,n)}(e,o,0,c,g),n||(e.tickprefix&&!h(e.showtickprefix)&&(o.text=e.tickprefix+o.text),e.ticksuffix&&!h(e.showticksuffix)&&(o.text+=e.ticksuffix)),"boundaries"===e.tickson||e.showdividers){var v=function(t){var r=e.l2p(t);return r>=0&&r<=e._length?t:null};o.xbnd=[v(o.x-.5),v(o.x+e.dtick-.5)]}return o},F.hoverLabelText=function(e,t,r){if(r!==D&&r!==t)return F.hoverLabelText(e,t)+" - "+F.hoverLabelText(e,r);var n="log"===e.type&&t<=0,a=F.tickText(e,e.c2l(n?-t:t),"hover").text;return n?0===t?"0":O+a:a};var te=["f","p","n","\u03bc","m","","k","M","G","T"];function re(e){return"SI"===e||"B"===e}function ne(e){return e>14||e<-15}function ae(e,t,r,n){var i=e<0,o=t._tickround,s=r||t.exponentformat||"B",c=t._tickexponent,u=F.getTickFormat(t),f=t.separatethousands;if(n){var d={exponentformat:s,dtick:"none"===t.showexponent?t.dtick:a(e)&&Math.abs(e)||1,range:"none"===t.showexponent?t.range.map(t.r2d):[0,e||1]};K(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,t.hoverformat&&(u=t.hoverformat)}if(u)return t._numFormat(u)(e).replace(/-/g,O);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(e=Math.abs(e))"+p+"":"B"===s&&9===c?e+="B":re(s)&&(e+=te[c/3+5]));return i?O+e:e}function ie(e,t){for(var r=[],n={},a=0;a1&&r=a.min&&e=0,i=u(e,t[1])<=0;return(r||a)&&(n||i)}if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":for(t=0;t=o(a)))){r=n;break}break;case"log":for(t=0;t0?r.bottom-u:0,f)))),t.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=t._depth:(n[s]=t._depth=Math.max(r.width>0?u-r.top:0,f),p.reverse()),r.width>0){var v=r.right-(t._offset+t._length);v>0&&(n.xr=1,n.r=v);var m=t._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=t._depth=Math.max(r.height>0?u-r.left:0,f):(n[s]=t._depth=Math.max(r.height>0?r.right-u:0,f),p.reverse()),r.height>0){var y=r.bottom-(t._offset+t._length);y>0&&(n.yb=0,n.b=y);var x=t._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===t.anchor?t.position:t._anchorAxis.domain[p[0]],t.title.text!==d._dfltTitle[h]&&(n[s]+=le(t)+(t.title.standoff||0)),t.mirror&&"free"!==t.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[c]=t.linewidth,t.mirror&&!0!==t.mirror&&(a[c]+=f),!0===t.mirror||"ticks"===t.mirror?a[g]=t._anchorAxis.domain[p[1]]:"all"!==t.mirror&&"allticks"!==t.mirror||(a[g]=[t._counterDomainMin,t._counterDomainMax][p[1]]))}W&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(e,t)),i.autoMargin(e,ue(t),n),i.autoMargin(e,fe(t),a),i.autoMargin(e,de(t),l)})),r.skipTitle||W&&"bottom"===t.side||Y.push((function(){return function(e,t){var r,n=e._fullLayout,a=t._id,i=a.charAt(0),o=t.title.font.size;if(t.title.hasOwnProperty("standoff"))r=t._depth+t.title.standoff+le(t);else{if("multicategory"===t.type)r=t._depth;else{r=10+1.5*o+(t.linewidth?t.linewidth-1:0)}r+="x"===i?"top"===t.side?o*(t.showticklabels?1:0):o*(t.showticklabels?1.5:.5):"right"===t.side?o*(t.showticklabels?1:.5):o*(t.showticklabels?.5:0)}var l,s,u,d,p=F.getPxPosition(e,t);"x"===i?(s=t._offset+t._length/2,u="top"===t.side?p-r:p+r):(u=t._offset+t._length/2,s="right"===t.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==t.type){var h=t._selections[t._id+"tick"];if(d={selection:h,side:t.side},h&&h.node()&&h.node().parentNode){var g=f.getTranslate(h.node().parentNode);d.offsetLeft=g.x,d.offsetTop=g.y}t.title.hasOwnProperty("standoff")&&(d.pad=0)}return c.draw(e,a+"title",{propContainer:t,propName:t._name+".title.text",placeholder:n._dfltTitle[i],avoid:d,transform:l,attributes:{x:s,y:u,"text-anchor":"middle"}})}(e,t)})),l.syncOrAsync(Y)}}function Q(e){var r=p+(e||"tick");return w[r]||(w[r]=function(e,t){var r,n,a,i;e._selections[t].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,e._selections[t].each((function(){var e=ce(this),t=f.bBox(e.node().parentNode);r=Math.min(r,t.top),n=Math.max(n,t.bottom),a=Math.min(a,t.left),i=Math.max(i,t.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(t,r)),w[r]}},F.getTickSigns=function(e){var t=e._id.charAt(0),r={x:"top",y:"right"}[t],n=e.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==e.ticks==("x"===t)&&(a=a.map((function(e){return-e}))),e.side&&a.push({l:-1,t:-1,r:1,b:1}[e.side.charAt(0)]),a},F.makeTransFn=function(e){var t=e._id.charAt(0),r=e._offset;return"x"===t?function(t){return"translate("+(r+e.l2p(t.x))+",0)"}:function(t){return"translate(0,"+(r+e.l2p(t.x))+")"}},F.makeTransPeriodFn=function(e){var t=e._id.charAt(0),r=e._offset;return"x"===t?function(t){return"translate("+(r+e.l2p(t.periodX))+",0)"}:function(t){return"translate(0,"+(r+e.l2p(t.periodX))+")"}},F.makeTickPath=function(e,t,r,n){n=void 0!==n?n:e.ticklen;var a=e._id.charAt(0),i=(e.linewidth||1)/2;return"x"===a?"M0,"+(t+i*r)+"v"+n*r:"M"+(t+i*r)+",0h"+n*r},F.makeLabelFns=function(e,t,r){var n=e._id.charAt(0),i="boundaries"!==e.tickson&&"outside"===e.ticks,o=0,s=0;if(i&&(o+=e.ticklen),r&&"outside"===e.ticks){var c=l.deg2rad(r);o=e.ticklen*Math.cos(c)+1,s=e.ticklen*Math.sin(c)}e.showticklabels&&(i||e.showline)&&(o+=.2*e.tickfont.size);var u,f,d,p,h={labelStandoff:o+=(e.linewidth||1)/2,labelShift:s};return"x"===n?(p="bottom"===e.side?1:-1,u=s*p,f=t+o*p,d="bottom"===e.side?1:-.2,h.xFn=function(e){return e.dx+u},h.yFn=function(e){return e.dy+f+e.fontSize*d},h.anchorFn=function(e,t){return a(t)&&0!==t&&180!==t?t*p<0?"end":"start":"middle"},h.heightFn=function(t,r,n){return r<-60||r>60?-.5*n:"top"===e.side?-n:0}):"y"===n&&(p="right"===e.side?1:-1,u=o,f=-s*p,d=90===Math.abs(e.tickangle)?.5:0,h.xFn=function(e){return e.dx+t+(u+e.fontSize*d)*p},h.yFn=function(e){return e.dy+f+e.fontSize*z},h.anchorFn=function(t,r){return a(r)&&90===Math.abs(r)?"middle":"right"===e.side?"start":"end"},h.heightFn=function(t,r,n){return(r*="left"===e.side?1:-1)<-30?-n:r<30?-.5*n:0}),h},F.drawTicks=function(e,t,r){r=r||{};var n=t._id+"tick",a=r.vals;"period"===t.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(t.ticks?a:[],oe);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(u.stroke,t.tickcolor).style("stroke-width",f.crispRound(e,t.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},F.drawGrid=function(e,t,r){r=r||{};var n=t._id+"grid",a=r.vals,i=r.counterAxis;if(!1===t.showgrid)a=[];else if(i&&F.shouldShowZeroLine(e,t,i))for(var o="array"===t.tickmode,l=0;l1)for(n=1;n2*o}(e,t)?"date":function(e){for(var t=Math.max(1,(e.length-1)/1e3),r=0,n=0,o={},l=0;l2*r}(e)?"category":function(e){if(!e)return!1;for(var t=0;t=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(t.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(t.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(t.enabled=!1);t.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(t.enabled=!1);if((c=+c)<0||c>24)return void(t.enabled=!1);t.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(t.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(e.substr(1)||1)-+(t.substr(1)||1)},r.getAxisGroup=function(e,t){for(var r=e._axisMatchGroups,n=0;n0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=t.categoryorder="trace"),"trace"===s?t._initialCategories=[]:"array"===s?t._initialCategories=l.slice():(l=function(e,t){var r,n,a,i=t.dataAttr||e._id.charAt(0),o={};if(t.axData)r=t.axData;else for(r=[],n=0;ns*x)||T)for(r=0;rz&&ID&&(D=I);p/=(D-O)/(2*P),O=c.l2r(O),D=c.l2r(D),c.range=c._input.range=L=0?Math.min(e,.9):1/(1/Math.max(e,-.3)+3.222))}function F(e,t,r,n,a){return e.append("path").attr("class","zoombox").style({fill:t>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function N(e,t,r){return e.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+t+", "+r+")").attr("d","M0,0Z")}function H(e,t,r,n,a,i){e.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),B(e,t,a,i)}function B(e,t,r,n){r||(e.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),t.transition().style("opacity",1).duration(200))}function j(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function V(e){O&&e.data&&e._context.showTips&&(l.notifier(l._(e,"Double-click to zoom back out"),"long"),O=!1)}function U(e){var t=Math.floor(Math.min(e.b-e.t,e.r-e.l,C)/2);return"M"+(e.l-3.5)+","+(e.t-.5+t)+"h3v"+-t+"h"+t+"v-3h-"+(t+3)+"ZM"+(e.r+3.5)+","+(e.t-.5+t)+"h-3v"+-t+"h"+-t+"v-3h"+(t+3)+"ZM"+(e.r+3.5)+","+(e.b+.5-t)+"h-3v"+t+"h"+-t+"v3h"+(t+3)+"ZM"+(e.l-3.5)+","+(e.b+.5-t)+"h3v"+t+"h"+t+"v3h-"+(t+3)+"Z"}function q(e,t,r,n){for(var a,i,o,s,c=!1,u={},f={},d=0;d=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(j(a),2!==e||he||je(),pe)i.indexOf("select")>-1&&M(r,a,W,Q,t.id,Se),i.indexOf("event")>-1&&f.click(a,r,t.id);else if(1===e&&he){var l=g?B:D,c="s"===g||"w"===O?0:1,u=l._name+".range["+c+"]",d=function(e,t){var r,a=e.range[t],i=Math.abs(a-e.range[1-t]);return"date"===e.type?a:"log"===e.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,c),p="left",h="middle";if(l.fixedrange)return;g?(h="n"===g?"top":"bottom","right"===l.side&&(p="right")):"e"===O&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(me).call(s.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(d),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:h}).on("edit",(function(e){var t=l.d2r(e);void 0!==t&&o.call("_guiRelayout",a,u,t)}))}}}function De(t,r){if(e._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,t+ye)),a=Math.max(0,Math.min(ee,r+xe)),i=Math.abs(n-ye),o=Math.abs(a-xe);function l(){ke="",be.r=be.l,be.t=be.b,Ae.attr("d","M0,0Z")}if(be.l=Math.min(ye,n),be.r=Math.max(ye,n),be.t=Math.min(xe,a),be.b=Math.max(xe,a),te.isSubplotConstrained)i>C||o>C?(ke="xy",i/K>o/ee?(o=i*ee/K,xe>a?be.t=xe-o:be.b=xe+o):(i=o*K/ee,ye>n?be.l=ye-i:be.r=ye+i),Ae.attr("d",U(be))):l();else if(re.isSubplotConstrained)if(i>C||o>C){ke="xy";var s=Math.min(be.l/K,(ee-be.b)/ee),c=Math.max(be.r/K,(ee-be.t)/ee);be.l=s*K,be.r=c*K,be.b=(1-s)*ee,be.t=(1-c)*ee,Ae.attr("d",U(be))}else l();else!ae||og[1]-1/4096&&(t.domain=l),a.noneOrAll(e.domain,t.domain,l)}return r("layer"),t}},{"../../lib":179,"fast-isnumeric":18}],241:[function(e,t,r){"use strict";var n=e("../../constants/alignment").FROM_BL;t.exports=function(e,t,r){void 0===r&&(r=n[e.constraintoward||"center"]);var a=[e.r2l(e.range[0]),e.r2l(e.range[1])],i=a[0]+(a[1]-a[0])*r;e.range=e._input.range=[e.l2r(i+(a[0]-i)*t),e.l2r(i+(a[1]-i)*t)]}},{"../../constants/alignment":154}],242:[function(e,t,r){"use strict";var n=e("polybooljs"),a=e("../../registry"),i=e("../../components/drawing").dashStyle,o=e("../../components/color"),l=e("../../components/fx"),s=e("../../components/fx/helpers").makeEventData,c=e("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=e("../../components/shapes/draw_newshape/display_outlines"),v=e("../../components/shapes/draw_newshape/helpers").handleEllipse,m=e("../../components/shapes/draw_newshape/newshapes"),y=e("../../lib"),x=e("../../lib/polygon"),b=e("../../lib/throttle"),_=e("./axis_ids").getFromId,w=e("../../lib/clear_gl_canvases"),T=e("../../plot_api/subroutines").redrawReglTraces,k=e("./constants"),M=k.MINSELECT,A=x.filter,L=x.tester,S=e("./handle_outline").clearSelect,C=e("./helpers"),O=C.p2r,D=C.axValue,P=C.getTransform;function z(e,t,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=t._hoverdata,x=t._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(e){return e&&Array.isArray(e)&&!0!==e[0].hoverOnBox}(y)){F(e,t,i);var _=function(e,t){var r,n,a=e[0],i=-1,o=[];for(n=0;n0?function(e,t){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===t.searchInfo&&(n=t.searchInfo.cd[0].trace).selectedpoints.length===t.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=B(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(t)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,e);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=e.selectionDefs=[],r.selection.mergedPolygons=e.mergedPolygons=[]}function H(e,t,r,n){var a,i,o,l=[],s=t.map((function(e){return e._id})),c=r.map((function(e){return e._id}));for(o=0;o0?n[0]:r;return!!t.selectedpoints&&t.selectedpoints.indexOf(a)>-1}function j(e,t,r){var n,i,o,l;for(n=0;n=0)Y._fullLayout._deactivateShape(Y);else if(!B){var r=X.clickmode;b.done(de).then((function(){if(b.clear(de),2===e){for(se.remove(),w=0;w-1&&z(t,Y,a.xaxes,a.yaxes,a.subplot,a,se),"event"===r&&Y.emit("plotly_selected",void 0);l.click(Y,t)})).catch(y.error)}},a.doneFn=function(){fe.remove(),b.done(de).then((function(){b.clear(de),a.gd.emit("plotly_selected",S),_&&a.selectionDefs&&(_.subtract=le,a.selectionDefs.push(_),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,x)),a.doneFnCompleted&&a.doneFnCompleted(pe)})).catch(y.error),B&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:z}},{"../../components/color":52,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../components/fx/helpers":88,"../../components/shapes/draw_newshape/display_outlines":137,"../../components/shapes/draw_newshape/helpers":138,"../../components/shapes/draw_newshape/newshapes":139,"../../lib":179,"../../lib/clear_gl_canvases":167,"../../lib/polygon":191,"../../lib/throttle":201,"../../plot_api/subroutines":214,"../../registry":265,"./axis_ids":226,"./constants":229,"./handle_outline":233,"./helpers":234,polybooljs:26}],243:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../../lib"),l=o.cleanNumber,s=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,d=e("../../constants/numerical"),p=d.FP_SAFE,h=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,x=d.ONEMIN,b=d.ONESEC,_=e("./axis_ids"),w=e("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function M(e){return Math.pow(10,e)}function A(e){return null!=e}t.exports=function(e,t){t=t||{};var r=e._id||"x",d=r.charAt(0);function L(t,r){if(t>0)return Math.log(t)/Math.LN10;if(t<=0&&r&&e.range&&2===e.range.length){var n=e.range[0],a=e.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return h}function S(t,r,n,a){if((a||{}).msUTC&&i(t))return+t;var l=c(t,n||e.calendar);if(l===h){if(!i(t))return h;t=+t;var s=Math.floor(10*o.mod(t+.05,1)),u=Math.round(t-s/10);l=c(new Date(u))+s/10}return l}function C(t,r,n){return s(t,r,n||e.calendar)}function O(t){return e._categories[Math.round(t)]}function D(t){if(A(t)){if(void 0===e._categoriesMap&&(e._categoriesMap={}),void 0!==e._categoriesMap[t])return e._categoriesMap[t];e._categories.push("number"==typeof t?String(t):t);var r=e._categories.length-1;return e._categoriesMap[t]=r,r}return h}function P(t){if(e._categoriesMap)return e._categoriesMap[t]}function z(e){var t=P(e);return void 0!==t?t:i(e)?+e:void 0}function E(e,t,r){return n.round(r+t*e,2)}function R(e,t,r){return(e-r)/t}var I=function(t){return i(t)?E(t,e._m,e._b):h},F=function(t){return R(t,e._m,e._b)};if(e.rangebreaks){var N="y"===d;I=function(t){if(!i(t))return h;var r=e._rangebreaks.length;if(!r)return E(t,e._m,e._b);var n=N;e.range[0]>e.range[1]&&(n=!n);for(var a=n?-1:1,o=a*t,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=e._B[l]||0;return isFinite(f)?E(t,e._m2,f):0},F=function(t){var r=e._rangebreaks.length;if(!r)return R(t,e._m,e._b);for(var n=0,a=0;ae._rangebreaks[a].pmax&&(n=a+1);return R(t,e._m2,e._B[n])}}e.c2l="log"===e.type?L:u,e.l2c="log"===e.type?M:u,e.l2p=I,e.p2l=F,e.c2p="log"===e.type?function(e,t){return I(L(e,t))}:I,e.p2c="log"===e.type?function(e){return M(F(e))}:F,-1!==["linear","-"].indexOf(e.type)?(e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=l,e.c2d=e.c2r=e.l2d=e.l2r=u,e.d2p=e.r2p=function(t){return e.l2p(l(t))},e.p2d=e.p2r=F,e.cleanPos=u):"log"===e.type?(e.d2r=e.d2l=function(e,t){return L(l(e),t)},e.r2d=e.r2c=function(e){return M(l(e))},e.d2c=e.r2l=l,e.c2d=e.l2r=u,e.c2r=L,e.l2d=M,e.d2p=function(t,r){return e.l2p(e.d2r(t,r))},e.p2d=function(e){return M(F(e))},e.r2p=function(t){return e.l2p(l(t))},e.p2r=F,e.cleanPos=u):"date"===e.type?(e.d2r=e.r2d=o.identity,e.d2c=e.r2c=e.d2l=e.r2l=S,e.c2d=e.c2r=e.l2d=e.l2r=C,e.d2p=e.r2p=function(t,r,n){return e.l2p(S(t,0,n))},e.p2d=e.p2r=function(e,t,r){return C(F(e),t,r)},e.cleanPos=function(t){return o.cleanDate(t,h,e.calendar)}):"category"===e.type?(e.d2c=e.d2l=D,e.r2d=e.c2d=e.l2d=O,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.l2r=e.c2r=u,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return O(F(e))},e.r2p=e.d2p,e.p2r=F,e.cleanPos=function(e){return"string"==typeof e&&""!==e?e:u(e)}):"multicategory"===e.type&&(e.r2d=e.c2d=e.l2d=O,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.r2c_just_indices=P,e.l2r=e.c2r=u,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return O(F(e))},e.r2p=e.d2p,e.p2r=F,e.cleanPos=function(e){return Array.isArray(e)||"string"==typeof e&&""!==e?e:u(e)},e.setupMultiCategory=function(n){var a,i,l=e._traceIndices,s=t._axisMatchGroups;if(s&&s.length&&0===e._categories.length)for(a=0;ap&&(l[n]=p),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else o.nestedProperty(e,t).set(a)},e.setScale=function(r){var n=t._size;if(e.overlaying){var a=_.getFromId({_fullLayout:t},e.overlaying);e.domain=a.domain}var i=r&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var l,s,c=e.r2l(e[i][0],o),u=e.r2l(e[i][1],o),f="y"===d;if((f?(e._offset=n.t+(1-e.domain[1])*n.h,e._length=n.h*(e.domain[1]-e.domain[0]),e._m=e._length/(c-u),e._b=-e._m*u):(e._offset=n.l+e.domain[0]*n.w,e._length=n.w*(e.domain[1]-e.domain[0]),e._m=e._length/(u-c),e._b=-e._m*c),e._rangebreaks=[],e._lBreaks=0,e._m2=0,e._B=[],e.rangebreaks)&&(e._rangebreaks=e.locateBreaks(Math.min(c,u),Math.max(c,u)),e._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&e._rangebreaks.reverse();var h=p?-1:1;for(e._m2=h*e._length/(Math.abs(u-c)-e._lBreaks),e._B.push(-e._m2*(f?u:c)),l=0;la&&(a+=7,ia&&(a+=24,i=n&&i=n&&t=l.min&&(el.max&&(l.max=n),a=!1)}a&&c.push({min:e,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),e.plot.call(o.setTranslate,t._offset,r._offset).call(o.setScale,1,1);var n=e.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,e)}function v(t,r){var n=t.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!t.xr1,d=!!t.yr1,p=[];if(f){var h=i.simpleMap(t.xr0,a.r2l),g=i.simpleMap(t.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(t.yr0,s.r2l),x=i.simpleMap(t.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(e,a,{skipTitle:!0}),l.drawOne(e,s,{skipTitle:!0}),l.redrawComponents(e,[a._id,s._id]);var w=f?c/p[2]:1,T=d?u/p[3]:1,k=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}l.redrawComponents(e)}},{"../../components/drawing":74,"../../lib":179,"../../registry":265,"./axes":223,d3:16}],248:[function(e,t,r){"use strict";var n=e("../../registry").traceIs,a=e("./axis_autotype");function i(e){return{v:"x",h:"y"}[e.orientation||"v"]}function o(e,t){var r=i(e),a=n(e,"box-violin"),o=n(e._fullInput||{},"candlestick");return a&&!o&&t===r&&void 0===e[r]&&void 0===e[r+"0"]}t.exports=function(e,t,r,l){"-"===r("type",(l.splomStash||{}).type)&&(!function(e,t){if("-"!==e.type)return;var r,l=e._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(e,t,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[t])return a;if((a[r+"axis"]||r)===t){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(t,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(e.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,t,l,n+1):t(l,i,o)}}))}r.manageCommandObserver=function(e,t,n,o){var l={},s=!0;t&&t._commandObserver&&(l=t._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(e,n,l.lookupTable);if(t&&t._commandObserver){if(c)return l;if(t._commandObserver.remove)return t._commandObserver.remove(),t._commandObserver=null,l}if(c){i(e,c,l.cache),l.check=function(){if(s){var t=i(e,c,l.cache);return t.changed&&o&&void 0!==l.lookupTable[t.value]&&(l.disable(),Promise.resolve(o({value:t.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[t.value]})).then(l.enable,l.enable)),t.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=t.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=t._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),s=r.select(".js-sourcelinks");e._context.showSources&&e._context.showSources(e),e._context.showLink&&function(e,t){t.text("");var r=t.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(e._context.linkText+" "+String.fromCharCode(187));if(e._context.sendData)r.on("click",(function(){x.sendDataToCloud(e)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(e,o),l.text(o.text()&&s.text()?" - ":"")}},x.sendDataToCloud=function(e){var t=(window.PLOTLYENV||{}).BASE_URL||e._context.plotlyServerURL;if(t){e.emit("plotly_beforeexport");var r=n.select(e).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:t+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(e,!1,"keepdata"),a.node().submit(),r.remove(),e.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(e,t){var r=e._context.locale,n=!1,a={};function i(e){for(var r=!0,i=0;i1&&E.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,s),l=0;l15&&E.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"),x.linkSubplots(d,s,f,i),x.cleanPlot(d,s,f,i);var H=!(!i._has||!i._has("gl2d")),B=!(!s._has||!s._has("gl2d")),j=!(!i._has||!i._has("cartesian"))||H,V=!(!s._has||!s._has("cartesian"))||B;j&&!V?i._bgLayer.remove():V&&!j&&(s._shouldCreateBgLayer=!0),i._zoomlayer&&!e._dragging&&p({_fullLayout:i}),function(e,t){var r,n=[];t.meta&&(r=t._meta={meta:t.meta,layout:{meta:t.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),a=Math.round(f*a)}}var d=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!t.height&&Math.abs(r.height-a)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=a)),e._initialAutoSize||(e._initialAutoSize={width:n,height:a}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(e,t,r,n){var a,i,l,s=o.componentsRegistry,u=t._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in s)(l=s[a]).includeBasePlot&&l.includeBasePlot(e,t);for(var d in u.length||u.push(f),t._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(e,t),f.finalizeSubplots(e,t)),t._subplots)t._subplots[d].sort(c.subplotSort);for(i=0;i.5*n.width&&(c.log("Margin push",t,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(c.log("Margin push",t,"is too big in y, dropping"),r.b=r.t=0);var s=void 0!==r.xl?r.xl:r.x,u=void 0!==r.xr?r.xr:r.x,f=void 0!==r.yt?r.yt:r.y,d=void 0!==r.yb?r.yb:r.y;a[t]={l:{val:s,size:r.l+o},r:{val:u,size:r.r+o},b:{val:d,size:r.b+o},t:{val:f,size:r.t+o}},i[t]=1}else delete a[t],delete i[t];if(!n._replotting)return x.doAutoMargin(e)}},x.doAutoMargin=function(e){var t=e._fullLayout;t._size||(t._size={}),C(t);var r=t._size,n=t.margin,a=c.extendFlat({},r),l=n.l,s=n.r,u=n.t,f=n.b,d=t.width,p=t.height,h=t._pushmargin,g=t._pushmarginIds;if(!1!==t.margin.autoexpand){for(var v in h)g[v]||delete h[v];for(var m in h.base={l:{val:0,size:l},r:{val:1,size:s},t:{val:1,size:u},b:{val:0,size:f}},h){var y=h[m].l||{},b=h[m].b||{},_=y.val,w=y.size,T=b.val,k=b.size;for(var M in h){if(i(w)&&h[M].r){var A=h[M].r.val,L=h[M].r.size;if(A>_){var S=(w*A+(L-d)*_)/(A-_),O=(L*(1-_)+(w-d)*(1-A))/(A-_);S>=0&&O>=0&&d-(S+O)>0&&S+O>l+s&&(l=S,s=O)}}if(i(k)&&h[M].t){var D=h[M].t.val,P=h[M].t.size;if(D>T){var z=(k*D+(P-p)*T)/(D-T),E=(P*(1-T)+(k-p)*(1-D))/(D-T);z>=0&&E>=0&&p-(E+z)>0&&z+E>f+u&&(f=z,u=E)}}}}}if(r.l=Math.round(l),r.r=Math.round(s),r.t=Math.round(u),r.b=Math.round(f),r.p=Math.round(n.pad),r.w=Math.round(d)-r.l-r.r,r.h=Math.round(p)-r.t-r.b,!t._replotting&&x.didMarginChange(a,r)){"_redrawFromAutoMarginCount"in t?t._redrawFromAutoMarginCount++:t._redrawFromAutoMarginCount=1;var R=3*(1+Object.keys(g).length);if(t._redrawFromAutoMarginCount0&&(e._transitioningWithDuration=!0),e._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&e._transitionData._interruptCallbacks.push((function(){return o.call("redraw",e)})),e._transitionData._interruptCallbacks.push((function(){e.emit("plotly_transitioninterrupted",[])}));var i=0,l=0;function s(){return i++,function(){l++,n||l!==i||function(t){if(!e._transitionData)return;(function(e){if(e)for(;e.length;)e.shift()})(e._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",e)})).then((function(){e._transitioning=!1,e._transitioningWithDuration=!1,e.emit("plotly_transitioned",[])})).then(t)}(a)}}r.runFn(s),setTimeout(s())}))}],i=c.syncOrAsync(a,e);return i&&i.then||(i=Promise.resolve()),i.then((function(){return e}))}x.didMarginChange=function(e,t){for(var r=0;r1)return!0}return!1},x.graphJson=function(e,t,r,n,a,i){(a&&t&&!e._fullData||a&&!t&&!e._fullLayout)&&x.supplyDefaults(e);var o=a?e._fullData:e.data,l=a?e._fullLayout:e.layout,s=(e._transitionData||{})._frames;function u(e,t){if("function"==typeof e)return t?"_function_":null;if(c.isPlainObject(e)){var n,a={};return Object.keys(e).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof e[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(e.stream))return}else if("keepall"!==r&&"string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(e[i],t)}else t&&(a[i]="_function")})),a}return Array.isArray(e)?e.map((function(e){return u(e,t)})):c.isTypedArray(e)?c.simpleMap(e,c.identity):c.isJSDate(e)?c.ms2DateTimeLocal(+e):e}var f={data:(o||[]).map((function(e){var r=u(e);return t&&delete r.fit,r}))};return t||(f.layout=u(l)),e.framework&&e.framework.isPolar&&(f=e.framework.getConfig()),s&&(f.frames=u(s)),i&&(f.config=u(e._context,!0)),"object"===n?f:JSON.stringify(f)},x.modifyFrames=function(e,t){var r,n,a,i=e._transitionData._frames,o=e._transitionData._frameHash;for(r=0;r=0;i--)if(l[i].enabled){r._indexToPoints=l[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(e,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,h[t]=o}}for(z(s,u,p),a=0;a=0?d.angularAxis.domain:n.extent(T),S=Math.abs(T[1]-T[0]);M&&!k&&(S=0);var C=L.slice();A&&k&&(C[1]+=S);var O=d.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),d.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var D=d.angularAxis.ticksStep||(C[1]-C[0])/(O*(d.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),C[2]||(C[2]=D);var P=n.range.apply(this,C);if(P=P.map((function(e,t){return parseFloat(e.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(e=n.select(this).select("svg.chart-root"))||e.empty()){var z=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),E=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=n.select(E)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var R,I=e.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(e,t){return" "+e+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){R=e.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var H=p.map((function(e,t){var r=o.util.cloneJson(e);return r.symbol="DotPlot"===e.geometry?e.dotType||"circle":"LinePlot"!=e.geometry?"square":"line",r.visibleInLegend="undefined"==typeof e.visibleInLegend||e.visibleInLegend,r.color="LinePlot"===e.geometry?e.strokeColor:e.color,r}));o.Legend().config({data:p.map((function(e,t){return e.name||"Element"+t})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:R,elements:H,reverseOrder:d.legend.reverseOrder})})();var B=R.node().getBBox();x=Math.min(d.width-B.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),R.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else R=e.select(".legend-group").style({display:"none"});e.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),I.attr("transform","translate("+_+")").style({cursor:"crosshair"});var j=[(d.width-(d.margin.left+d.margin.right+2*x+(B?B.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),e.select(".outer-group").attr("transform","translate("+j+")"),d.title&&d.title.text){var V=e.select("g.title-group text").style(N).text(d.title.text),U=V.node().getBBox();V.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var q=e.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function Y(e,t){return l(e)%360+d.orientation}if(d.radialAxis.visible){var X=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(X).attr({transform:"rotate("+d.radialAxis.orientation+")"}),q.selectAll(".domain").style(F),q.selectAll("g>text").text((function(e,t){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(e,t){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(e,t){return"rotate("+Y(e)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",(function(e,t){return t%(d.minorTicks+1)==0})).classed("minor",(function(e,t){return!(t%(d.minorTicks+1)==0)})).style(F),Q.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var J=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(e,t){var r=Y(e),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(e,t){return t%(d.minorTicks+1)!=0?"":w?w[e]+d.angularAxis.ticksSuffix:e+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&J.text((function(e,t){return t%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,t)}));var $=n.max(I.selectAll(".angular-tick text")[0].map((function(e,t){return e.getCTM().e+e.getBBox().width})));R.attr({transform:"translate("+[x+$,d.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,ee=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(ee.enter().append("g").attr({class:function(e,t){return"geometry geometry"+t}}),ee.exit().remove(),p[0]||K){var te=[];p.forEach((function(e,t){var n={};n.radialScale=r,n.angularScale=l,n.container=ee.filter((function(e,r){return r==t})),n.geometry=e.geometry,n.orientation=d.orientation,n.direction=d.direction,n.index=t,te.push({data:e,geometryConfig:n})}));var re=n.nest().key((function(e,t){return"undefined"!=typeof e.data.groupId||"unstacked"})).entries(te),ne=[];re.forEach((function(e,t){"unstacked"===e.key?ne=ne.concat(e.values.map((function(e,t){return[e]}))):ne.push(e.values)})),ne.forEach((function(e,t){var r;r=Array.isArray(e)?e[0].geometryConfig.geometry:e.geometryConfig.geometry;var n=e.map((function(e,t){return a(o[r].defaultConfig(),e)}));o[r]().config(n)()}))}var ae,ie,oe=e.select(".guides-group"),le=e.select(".tooltips-group"),se=o.tooltipPanel().config({container:le,fontSize:8})(),ce=o.tooltipPanel().config({container:le,fontSize:8})(),ue=o.tooltipPanel().config({container:le,hasTick:!0})();if(!k){var fe=oe.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});I.on("mousemove.angular-guide",(function(e,t){var r=o.util.getMousePos(Z).angle;fe.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;ae=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);se.text(o.util.round(ae)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(e,t){oe.select("line").style({opacity:0})}))}var de=oe.select("circle").style({stroke:"grey",fill:"none"});I.on("mousemove.radial-guide",(function(e,t){var n=o.util.getMousePos(Z).radius;de.attr({r:n}).style({opacity:.5}),ie=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ce.text(o.util.round(ie)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(e,t){de.style({opacity:0}),ue.hide(),se.hide(),ce.hide()})),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(t,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),p=[f.left+f.width/2-j[0]-d.left,f.top+f.height/2-j[1]-d.top];ue.config({color:l}).text(u),ue.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(e,t){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ue.show()})).on("mouseout.tooltip",(function(e,t){ue.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(e){if(!arguments.length)return s;var t=o.util.cloneJson(e);return t.data.forEach((function(e,t){s.data[t]||(s.data[t]={}),a(s.data[t],o.Axis.defaultConfig().data[0]),a(s.data[t],e)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,t.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(e){return r},d.angularScale=function(e){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(e,t){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(e,t){for(var r in e)r in t&&(t[r]=e[r])},o.util._extend=function(e,t){for(var r in e)t[r]=e[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(e,t){var r=t||6;return n.range(0,360+r,r).map((function(t,r){var n=t*Math.PI/180;return[t,e(n)]}))},o.util.dataFromEquation=function(e,t,r){var a=t||6,i=[],o=[];n.range(0,360+a,a).forEach((function(t,r){var n=t*Math.PI/180,a=e(n);i.push(t),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},o.util.ensureArray=function(e,t){if("undefined"==typeof e)return null;var r=[].concat(e);return n.range(t).map((function(e,t){return r[t]||r[0]}))},o.util.fillArrays=function(e,t,r){return t.forEach((function(t,n){e[t]=o.util.ensureArray(e[t],r)})),e},o.util.cloneJson=function(e){return JSON.parse(JSON.stringify(e))},o.util.validateKeys=function(e,t){"string"==typeof t&&(t=t.split("."));var r=t.shift();return e[r]&&(!t.length||objHasKeys(e[r],t))},o.util.sumArrays=function(e,t){return n.zip(e,t).map((function(e,t){return n.sum(e)}))},o.util.arrayLast=function(e){return e[e.length-1]},o.util.arrayEqual=function(e,t){for(var r=Math.max(e.length,t.length,1);r-- >=0&&e[r]===t[r];);return-2===r},o.util.flattenArray=function(e){for(var t=[];!o.util.arrayEqual(t,e);)t=e,e=[].concat.apply([],e);return e},o.util.deduplicate=function(e){return e.filter((function(e,t,r){return r.indexOf(e)==t}))},o.util.convertToCartesian=function(e,t){var r=t*Math.PI/180;return[e*Math.cos(r),e*Math.sin(r)]},o.util.round=function(e,t){var r=t||2,n=Math.pow(10,r);return Math.round(e*n)/n},o.util.getMousePos=function(e){var t=n.mouse(e.node()),r=t[0],a=t[1],i={};return i.x=r,i.y=a,i.pos=t,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(e){for(var t,r={},n={},a=0,i=e.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(e,t){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(e,t){return h.stroke(r,a,i)},"stroke-width":function(e,t){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(e,t){return h["stroke-dasharray"](r,a,i)},opacity:function(e,t){return h.opacity(r,a,i)},display:function(e,t){return h.display(r,a,i)}})}};var f=t.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(e){return-d/2})).endAngle((function(e){return d/2})).innerRadius((function(e){return t.radialScale(s+(e[2]||0))})).outerRadius((function(e){return t.radialScale(s+(e[2]||0))+t.radialScale(e[1])}));c.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(e,r){return"rotate("+(t.orientation+l(e[0])+90)+")"}})};var h={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,n,a){return r[e[a].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[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(e,t){return e}));v.enter().append("path").attr({class:"mark"}),v.style(h).each(c[t.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(t){return arguments.length?(t.forEach((function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)})),this):e},i.getColorScale=function(){},n.rebind(i,t,"on"),i},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 e=o.Legend.defaultConfig(),t=n.dispatch("hover");function r(){var t=e.legendConfig,i=e.data.map((function(e,r){return[].concat(e).map((function(e,n){var i=a({},t.elements[r]);return i.name=e,i.color=[].concat(t.elements[r].color)[n],i}))})),o=n.merge(i);o=o.filter((function(e,r){return t.elements[r]&&(t.elements[r].visibleInLegend||"undefined"==typeof t.elements[r].visibleInLegend)})),t.reverseOrder&&(o=o.reverse());var l=t.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(e,t){return e.color})),c=t.fontSize,u=null==t.isContinuous?"number"==typeof o[0]:t.isContinuous,f=u?t.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(e,t){return t/(s.length-1)*100+"%"}}).style({"stop-color":function(e,t){return e}}),d.append("rect").classed("legend-mark",!0).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(e,t){return"translate("+[c/2,v(t)+c/2]+")"},d:function(e,t){var r,a,i,o=e.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(e,t){return g(t)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?t.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?t.textColor:"none"}),b.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text((function(e,t){return o[t].name})),r}return r.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(r,t,"on"),r},o.Legend.defaultConfig=function(e,t){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 e,t,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(e=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),t=n.append("text").attr({dx:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";t.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=t.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),e.attr({transform:"translate("+[s,-v/2+2*d]+")"}),e.style({display:"block"}),c},c.move=function(t){if(e)return e.attr({transform:"translate("+[t[0],t[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(e)return e.style({display:"none"}),c},c.show=function(){if(e)return e.style({display:"block"}),c},c.config=function(e){return a(i,e),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var e={convert:function(e,t){var r={};if(e.data&&(r.data=e.data.map((function(e,r){var n=a({},e);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(e,r){o.util.translator.apply(null,e.concat(t))})),t||delete n.marker,t&&delete n.groupId,t?("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})),!t&&e.layout&&"stack"===e.layout.barmode)){var i=o.util.duplicates(r.data.map((function(e,t){return e.geometry})));r.data.forEach((function(e,t){var n=i.indexOf(e.geometry);-1!=n&&(r.data[t].groupId=n)}))}if(e.layout){var l=a({},e.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(e,t){u[c[s.indexOf(e.key)]]=e.value})),l.margin=u}t&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return e}},{"../../../constants/alignment":154,"../../../lib":179,d3:16}],262:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../../lib"),i=e("../../../components/color"),o=e("./micropolar"),l=e("./undo_manager"),s=a.extendDeepAll,c=t.exports={};c.framework=function(e){var t,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),t=t?s(t,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(t),a.config(i).render(u),e.data=t.data,e.layout=t.layout,c.fillLayout(e),t}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return t},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var e,n,a=this,i=o.util.cloneJson(t);e=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(e)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(e){var t=n.select(e).selectAll(".plot-container"),r=t.selectAll(".svg-container"),a=e.framework&&e.framework.svg&&e.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:t,_paperdiv:r,_paper:a};e._fullLayout=s(o,e.layout)}},{"../../../components/color":52,"../../../lib":179,"./micropolar":261,"./undo_manager":263,d3:16}],263:[function(e,t,r){"use strict";t.exports=function(){var e,t=[],r=-1,n=!1;function a(e,t){return e?(n=!0,e[t](),n=!1,this):this}return{add:function(e){return n||(t.splice(r+1,t.length-r),t.push(e),r=t.length-1),this},setCallback:function(t){e=t},undo:function(){var n=t[r];return n?(a(n,"undo"),r-=1,e&&e(n.undo),this):this},redo:function(){var n=t[r+1];return n?(a(n,"redo"),r+=1,e&&e(n.redo),this):this},clear:function(){t=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a-1&&(f[p[r]].title={text:""});for(r=0;r")?"":t.html(e).text()}));return t.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":52,"../components/drawing":74,"../constants/xmlns_namespaces":159,"../lib":179,d3:16}],274:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rf+c||!n(u))}for(var p=0;pi))return t}return void 0!==r?r:e.dflt},r.coerceColor=function(e,t,r){return a(t).isValid()?t:void 0!==r?r:e.dflt},r.coerceEnumerated=function(e,t,r){return e.coerceNumber&&(t=+t),-1!==e.values.indexOf(t)?t:void 0!==r?r:e.dflt},r.getValue=function(e,t){var r;return Array.isArray(e)?t0?a+=i:t<0&&(a-=i)}return n.inbox(r-t,a-t,b+(a-t)/(a-r)-1)}"h"===v.orientation?(i=r,l=t,u="y",f="x",d=L,p=A):(i=t,l=r,u="x",f="y",p=L,d=A);var S=e[u+"a"],C=e[f+"a"];h=Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0]));var O=n.getDistanceFunction(a,d,p,(function(e){return(d(e)+p(e))/2}));if(n.getClosest(g,O,e),!1!==e.index&&g[e.index].p!==c){y||(T=function(e){return Math.min(_(e),e.p-m.bargroupwidth/2)},k=function(e){return Math.max(w(e),e.p+m.bargroupwidth/2)});var D=g[e.index],P=v.base?D.b+D.s:D.s;e[f+"0"]=e[f+"1"]=C.c2p(D[f],!0),e[f+"LabelVal"]=P;var z=m.extents[m.extents.round(D.p)];return e[u+"0"]=S.c2p(y?T(D):z[0],!0),e[u+"1"]=S.c2p(y?k(D):z[1],!0),e[u+"LabelVal"]=D.p,e.labelLabel=s(S,e[u+"LabelVal"]),e.valueLabel=s(C,e[f+"LabelVal"]),e.spikeDistance=(L(D)+function(e){return M(_(e),w(e))}(D))/2-b,e[u+"Spike"]=S.c2p(D.p,!0),o(D,v,e),e.hovertemplate=v.hovertemplate,e}}function f(e,t){var r=t.mcc||e.marker.color,n=t.mlcc||e.marker.line.color,a=l(e,t);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}t.exports={hoverPoints:function(e,t,r,n){var i=u(e,t,r,n);if(i){var o=i.cd,l=o[0].trace,s=o[i.index];return i.color=f(l,s),a.getComponentMethod("errorbars","hoverInfo")(s,l,i),[i]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":52,"../../components/fx":92,"../../constants/numerical":158,"../../lib":179,"../../plots/cartesian/axes":223,"../../registry":265,"./helpers":281}],283:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc").crossTraceCalc,colorbar:e("../scatter/marker_colorbar"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot").plot,style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover").hoverPoints,eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"bar",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":236,"../scatter/marker_colorbar":384,"./arrays_to_calcdata":274,"./attributes":275,"./calc":276,"./cross_trace_calc":278,"./defaults":279,"./event_data":280,"./hover":282,"./layout_attributes":284,"./layout_defaults":285,"./plot":286,"./select":287,"./style":289}],284:[function(e,t,r){"use strict";t.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],285:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/cartesian/axes"),i=e("../../lib"),o=e("./layout_attributes");t.exports=function(e,t,r){function l(r,n){return i.coerce(e,t,o,r,n)}for(var s=!1,c=!1,u=!1,f={},d=l("barmode"),p=0;p0}function L(e){return"auto"===e?0:e}function S(e,t){var r=Math.PI/180*t,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:e.width*a+e.height*n,y:e.width*n+e.height*a}}function C(e,t,r,n,a,i){var o=!!i.isHorizontal,l=!!i.constrained,s=i.angle||0,c=i.anchor||"end",u="end"===c,f="start"===c,d=((i.leftToRight||0)+1)/2,p=1-d,h=a.width,g=a.height,v=Math.abs(t-e),m=Math.abs(n-r),y=v>2*_&&m>2*_?_:0;v-=2*y,m-=2*y;var x=L(s);"auto"!==s||h<=v&&g<=m||!(h>v||g>m)||(h>m||g>v)&&h.01?q:function(e,t,r){return r&&e===t?e:Math.abs(e-t)>=2?q(e):e>t?Math.ceil(e):Math.floor(e)};N=G(N,H,R),H=G(H,N,R),B=G(B,j,!R),j=G(j,B,!R)}var Z=M(i.ensureSingle(P,"path"),D,v,m);if(Z.style("vector-effect","non-scaling-stroke").attr("d",isNaN((H-N)*(j-B))?"M0,0Z":"M"+N+","+B+"V"+j+"H"+H+"V"+B+"Z").call(s.setClipUrl,t.layerClipId,e),!D.uniformtext.mode&&I){var Y=s.makePointStyleFns(f);s.singlePointStyle(c,Z,f,Y,e)}!function(e,t,r,n,a,l,c,f,p,v,m){var w,T=t.xaxis,A=t.yaxis,O=e._fullLayout;function D(t,r,n){return i.ensureSingle(t,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(s.font,n).call(o.convertToTspans,e)}var P=n[0].trace,z="h"===P.orientation,E=function(e,t,r,n,a){var o,l=t[0].trace;o=l.texttemplate?function(e,t,r,n,a){var o=t[0].trace,l=i.castOption(o,r,"texttemplate");if(!l)return"";var s,c,f,d,p="waterfall"===o.type,h="funnel"===o.type;"h"===o.orientation?(s="y",c=a,f="x",d=n):(s="x",c=n,f="y",d=a);function g(e){return u(d,+e,!0).text}var v=t[r],m={};m.label=v.p,m.labelLabel=m[s+"Label"]=(y=v.p,u(c,y,!0).text);var y;var x=i.castOption(o,v.i,"text");(0===x||x)&&(m.text=x);m.value=v.s,m.valueLabel=m[f+"Label"]=g(v.s);var _={};b(_,o,v.i),p&&(m.delta=+v.rawS||v.s,m.deltaLabel=g(m.delta),m.final=v.v,m.finalLabel=g(m.final),m.initial=m.final-m.delta,m.initialLabel=g(m.initial));h&&(m.value=v.s,m.valueLabel=g(m.value),m.percentInitial=v.begR,m.percentInitialLabel=i.formatPercent(v.begR),m.percentPrevious=v.difR,m.percentPreviousLabel=i.formatPercent(v.difR),m.percentTotal=v.sumR,m.percenTotalLabel=i.formatPercent(v.sumR));var w=i.castOption(o,v.i,"customdata");w&&(m.customdata=w);return i.texttemplateString(l,m,e._d3locale,_,m,o._meta||{})}(e,t,r,n,a):l.textinfo?function(e,t,r,n){var a=e[0].trace,o="h"===a.orientation,l="waterfall"===a.type,s="funnel"===a.type;function c(e){return u(o?r:n,+e,!0).text}var f,d=a.textinfo,p=e[t],h=d.split("+"),g=[],v=function(e){return-1!==h.indexOf(e)};v("label")&&g.push((m=e[t].p,u(o?n:r,m,!0).text));var m;v("text")&&(0===(f=i.castOption(a,p.i,"text"))||f)&&g.push(f);if(l){var y=+p.rawS||p.s,x=p.v,b=x-y;v("initial")&&g.push(c(b)),v("delta")&&g.push(c(y)),v("final")&&g.push(c(x))}if(s){v("value")&&g.push(c(p.s));var _=0;v("percent initial")&&_++,v("percent previous")&&_++,v("percent total")&&_++;var w=_>1;v("percent initial")&&(f=i.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),v("percent previous")&&(f=i.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),v("percent total")&&(f=i.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(t,r,n,a):g.getValue(l.text,r);return g.coerceString(y,o)}(O,n,a,T,A);w=function(e,t){var r=g.getValue(e.textposition,t);return g.coerceEnumerated(x,r)}(P,a);var R="stack"===v.mode||"relative"===v.mode,I=n[a],F=!R||I._outmost;if(!E||"none"===w||(I.isBlank||l===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var N=O.font,H=h.getBarColor(n[a],P),B=h.getInsideTextFont(P,a,N,H),j=h.getOutsideTextFont(P,a,N),V=r.datum();z?"log"===T.type&&V.s0<=0&&(l=T.range[0]=G*(W/Z):W>=Z*(X/G);G>0&&Z>0&&(Q||J||$)?w="inside":(w="outside",U.remove(),U=null)}else w="inside";if(!U){Y=i.ensureUniformFontSize(e,"outside"===w?j:B);var K=(U=D(r,E,Y)).attr("transform");if(U.attr("transform",""),q=s.bBox(U.node()),G=q.width,Z=q.height,U.attr("transform",K),G<=0||Z<=0)return void U.remove()}var ee,te,re=P.textangle;"outside"===w?(te="both"===P.constraintext||"outside"===P.constraintext,ee=function(e,t,r,n,a,i){var o,l=!!i.isHorizontal,s=!!i.constrained,c=i.angle||0,u=a.width,f=a.height,d=Math.abs(t-e),p=Math.abs(n-r);o=l?p>2*_?_:0:d>2*_?_:0;var h=1;s&&(h=l?Math.min(1,p/f):Math.min(1,d/u));var g=L(c),v=S(a,g),m=(l?v.x:v.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(e+t)/2,w=(r+n)/2,T=0,M=0,A=l?k(t,e):k(r,n);l?(b=t-A*o,T=A*m):(w=n+A*o,M=-A*m);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:h,rotate:g}}(l,c,f,p,q,{isHorizontal:z,constrained:te,angle:re})):(te="both"===P.constraintext||"inside"===P.constraintext,ee=C(l,c,f,p,q,{isHorizontal:z,constrained:te,angle:re,anchor:P.insidetextanchor}));ee.fontSize=Y.size,d(P.type,ee,O),I.transform=ee,M(U,O,v,m).attr("transform",i.getTextTransform(ee))}(e,t,P,r,p,N,H,B,j,v,m),t.layerClipId&&s.hideOutsideRangePoint(c,P.select("text"),w,O,f.xcalendar,f.ycalendar)}));var B=!1===f.cliponaxis;s.setClipUrl(c,B?null:t.layerClipId,e)}));c.getComponentMethod("errorbars","plot")(e,P,t,v)},toMoveInsideBar:C}},{"../../components/color":52,"../../components/drawing":74,"../../components/fx/helpers":88,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/cartesian/axes":223,"../../registry":265,"./attributes":275,"./constants":277,"./helpers":281,"./style":289,"./uniform_text":291,d3:16,"fast-isnumeric":18}],287:[function(e,t,r){"use strict";function n(e,t,r,n,a){var i=t.c2p(n?e.s0:e.p0,!0),o=t.c2p(n?e.s1:e.p1,!0),l=r.c2p(n?e.p0:e.s0,!0),s=r.c2p(n?e.p1:e.s1,!0);return a?[(i+o)/2,(l+s)/2]:n?[o,(l+s)/2]:[(i+o)/2,s]}t.exports=function(e,t){var r,a=e.cd,i=e.xaxis,o=e.yaxis,l=a[0].trace,s="funnel"===l.type,c="h"===l.orientation,u=[];if(!1===t)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!e[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),t.selectAll("g.points").each((function(t){h(n.select(this),t[0].trace,e)})),l.getComponentMethod("errorbars","style")(t)},styleTextPoints:g,styleOnSelect:function(e,t,r){var a=t[0].trace;a.selectedpoints?function(e,t,r){i.selectedPointStyle(e.selectAll("path"),t),function(e,t,r){e.each((function(e){var a,l=n.select(this);if(e.selected){a=o.ensureUniformFontSize(r,v(l,e,t,r));var s=t.selected.textfont&&t.selected.textfont.color;s&&(a.color=s),i.font(l,a)}else i.selectedTextStyle(l,t)}))}(e.selectAll("text"),t,r)}(r,a,e):(h(r,a,e),l.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:s}},{"../../components/color":52,"../../components/drawing":74,"../../lib":179,"../../registry":265,"./attributes":275,"./helpers":281,"./uniform_text":291,d3:16}],290:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l){r("marker.color",o),a(e,"marker")&&i(e,t,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(e,"marker.line")&&i(e,t,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63}],291:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib");function i(e){return"_"+e+"Text_minsize"}t.exports={recordMinTextSize:function(e,t,r){if(r.uniformtext.mode){var n=i(e),a=r.uniformtext.minsize,o=t.scale*t.fontSize;t.hide=o1,b=1-f[e+"gap"],_=1-f[e+"groupgap"];for(l=0;l0){var q=S.pointpos,G=S.jitter,Z=S.marker.size/2,Y=0;q+G>=0&&((Y=V*(q+G))>A?(U=!0,B=Z,N=Y):Y>I&&(B=Z,N=A)),Y<=A&&(N=A);var X=0;q-G<=0&&((X=-V*(q-G))>L?(U=!0,j=Z,H=X):X>F&&(j=Z,H=L)),X<=L&&(H=L)}else N=A,H=L;var W=new Array(c.length);for(s=0;se.lo&&(x.so=!0)}return i}));d.enter().append("path").classed("point",!0),d.exit().remove(),d.call(i.translatePoints,o,l)}function s(e,t,r,i){var o,l,s=t.val,c=t.pos,u=!!c.rangebreaks,f=i.bPos,d=i.bPosPxOffset||0,p=r.boxmean||(r.meanline||{}).visible;Array.isArray(i.bdPos)?(o=i.bdPos[0],l=i.bdPos[1]):(o=i.bdPos,l=i.bdPos);var h=e.selectAll("path.mean").data("box"===r.type&&r.boxmean||"violin"===r.type&&r.box.visible&&r.meanline.visible?a.identity:[]);h.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),h.exit().remove(),h.each((function(e){var t=c.c2l(e.pos+f,!0),a=c.l2p(t-o)+d,i=c.l2p(t+l)+d,h=u?(a+i)/2:c.l2p(t)+d,g=s.c2p(e.mean,!0),v=s.c2p(e.mean-e.sd,!0),m=s.c2p(e.mean+e.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+g+","+a+"V"+i+("sd"===p?"m0,0L"+v+","+h+"L"+g+","+a+"L"+m+","+h+"Z":"")):n.select(this).attr("d","M"+a+","+g+"H"+i+("sd"===p?"m0,0L"+h+","+v+"L"+a+","+g+"L"+h+","+m+"Z":""))}))}t.exports={plot:function(e,t,r,i){var c=t.xaxis,u=t.yaxis;a.makeTraceGroups(i,r,"trace boxes").each((function(e){var t,r,a=n.select(this),i=e[0],f=i.t,d=i.trace;(f.wdPos=f.bdPos*d.whiskerwidth,!0!==d.visible||f.empty)?a.remove():("h"===d.orientation?(t=u,r=c):(t=c,r=u),o(a,{pos:t,val:r},d,f),l(a,{x:c,y:u},d,f),s(a,{pos:t,val:r},d,f))}))},plotBoxAndWhiskers:o,plotPoints:l,plotBoxMean:s}},{"../../components/drawing":74,"../../lib":179,d3:16}],297:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../components/color"),i=e("../../components/drawing");t.exports={style:function(e,t,r){var o=r||n.select(e).selectAll("g.trace.boxes");o.style("opacity",(function(e){return e[0].trace.opacity})),o.each((function(t){var r=n.select(this),o=t[0].trace,l=o.line.width;function s(e,t,r,n){e.style("stroke-width",t+"px").call(a.stroke,r).call(a.fill,n)}var c=r.selectAll("path.box");if("candlestick"===o.type)c.each((function(e){if(!e.empty){var t=n.select(this),r=o[e.dir];s(t,r.line.width,r.line.color,r.fillcolor),t.style("opacity",o.selectedpoints&&!e.selected?.3:1)}}));else{s(c,l,o.line.color,o.fillcolor),r.selectAll("path.mean").style({"stroke-width":l,"stroke-dasharray":2*l+"px,"+l+"px"}).call(a.stroke,o.line.color);var u=r.selectAll("path.point");i.pointStyle(u,o,e)}}))},styleOnSelect:function(e,t,r){var n=t[0].trace,a=r.selectAll("path.point");n.selectedpoints?i.selectedPointStyle(a,n):i.pointStyle(a,n,e)}}},{"../../components/color":52,"../../components/drawing":74,d3:16}],298:[function(e,t,r){"use strict";var n=e("../../lib").extendFlat,a=e("../ohlc/attributes"),i=e("../box/attributes");function o(e){return{line:{color:n({},i.line.color,{dflt:e}),width:i.line.width,editType:"style"},fillcolor:i.fillcolor,editType:"style"}}t.exports={x:a.x,open:a.open,high:a.high,low:a.low,close:a.close,line:{width:n({},i.line.width,{}),editType:"style"},increasing:o(a.increasing.line.color.dflt),decreasing:o(a.decreasing.line.color.dflt),text:a.text,hovertext:a.hovertext,whiskerwidth:n({},i.whiskerwidth,{dflt:0}),hoverlabel:a.hoverlabel}},{"../../lib":179,"../box/attributes":292,"../ohlc/attributes":344}],299:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("../ohlc/calc").calcCommon;function o(e,t,r,n){return{min:r,q1:Math.min(e,n),med:n,q3:Math.max(e,n),max:t}}t.exports=function(e,t){var r=e._fullLayout,l=a.getFromId(e,t.xaxis),s=a.getFromId(e,t.yaxis),c=l.makeCalcdata(t,"x"),u=i(e,t,c,s,o);return u.length?(n.extendFlat(u[0].t,{num:r._numBoxes,dPos:n.distinctVals(c).minDiff/2,posLetter:"x",valLetter:"y"}),r._numBoxes++,u):[{t:{empty:!0}}]}},{"../../lib":179,"../../plots/cartesian/axes":223,"../ohlc/calc":345}],300:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../components/color"),i=e("../ohlc/ohlc_defaults"),o=e("./attributes");function l(e,t,r,n){var i=r(n+".line.color");r(n+".line.width",t.line.width),r(n+".fillcolor",a.addOpacity(i,.5))}t.exports=function(e,t,r,a){function s(r,a){return n.coerce(e,t,o,r,a)}i(e,t,s,a)?(s("line.width"),l(e,t,s,"increasing"),l(e,t,s,"decreasing"),s("text"),s("hovertext"),s("whiskerwidth"),a._requestRangeslider[t.xaxis]=!0):t.visible=!1}},{"../../components/color":52,"../../lib":179,"../ohlc/ohlc_defaults":349,"./attributes":298}],301:[function(e,t,r){"use strict";t.exports={moduleType:"trace",name:"candlestick",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","showLegend","candlestick","boxLayout"],meta:{},attributes:e("./attributes"),layoutAttributes:e("../box/layout_attributes"),supplyLayoutDefaults:e("../box/layout_defaults").supplyLayoutDefaults,crossTraceCalc:e("../box/cross_trace_calc").crossTraceCalc,supplyDefaults:e("./defaults"),calc:e("./calc"),plot:e("../box/plot").plot,layerName:"boxlayer",style:e("../box/style").style,hoverPoints:e("../ohlc/hover").hoverPoints,selectPoints:e("../ohlc/select")}},{"../../plots/cartesian":236,"../box/cross_trace_calc":293,"../box/layout_attributes":294,"../box/layout_defaults":295,"../box/plot":296,"../box/style":297,"../ohlc/hover":347,"../ohlc/select":351,"./attributes":298,"./calc":299,"./defaults":300}],302:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;r"),l.color=function(e,t){var r=e.marker,a=t.mc||r.color,i=t.mlc||r.line.color,o=t.mlw||r.line.width;if(n(a))return a;if(n(i)&&o)return i}(c,f),[l]}}},{"../../components/color":52,"../../lib":179,"../bar/hover":282}],310:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc"),plot:e("./plot"),style:e("./style").style,hoverPoints:e("./hover"),eventData:e("./event_data"),selectPoints:e("../bar/select"),moduleType:"trace",name:"funnel",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":236,"../bar/select":287,"./attributes":303,"./calc":304,"./cross_trace_calc":306,"./defaults":307,"./event_data":308,"./hover":309,"./layout_attributes":311,"./layout_defaults":312,"./plot":313,"./style":314}],311:[function(e,t,r){"use strict";t.exports={funnelmode:{valType:"enumerated",values:["stack","group","overlay"],dflt:"stack",editType:"calc"},funnelgap:{valType:"number",min:0,max:1,editType:"calc"},funnelgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],312:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){var i=!1;function o(r,i){return n.coerce(e,t,a,r,i)}for(var l=0;l path").each((function(e){if(!e.isBlank){var t=l.marker;n.select(this).call(i.fill,e.mc||t.color).call(i.stroke,e.mlc||t.line.color).call(a.dashLine,t.line.dash,e.mlw||t.line.width).style("opacity",l.selectedpoints&&!e.selected?o:1)}})),c(r,l,e),r.selectAll(".regions").each((function(){n.select(this).selectAll("path").style("stroke-width",0).call(i.fill,l.connector.fillcolor)})),r.selectAll(".lines").each((function(){var e=l.connector.line;a.lineGroupStyle(n.select(this).selectAll("path"),e.width,e.color,e.dash)}))}))}}},{"../../components/color":52,"../../components/drawing":74,"../../constants/interactions":157,"../bar/style":289,"../bar/uniform_text":291,d3:16}],315:[function(e,t,r){"use strict";var n=e("../pie/attributes"),a=e("../../plots/attributes"),i=e("../../plots/domain").attributes,o=e("../../plots/template_attributes").hovertemplateAttrs,l=e("../../plots/template_attributes").texttemplateAttrs,s=e("../../lib/extend").extendFlat;t.exports={labels:n.labels,label0:n.label0,dlabel:n.dlabel,values:n.values,marker:{colors:n.marker.colors,line:{color:s({},n.marker.line.color,{dflt:null}),width:s({},n.marker.line.width,{dflt:1}),editType:"calc"},editType:"calc"},text:n.text,hovertext:n.hovertext,scalegroup:s({},n.scalegroup,{}),textinfo:s({},n.textinfo,{flags:["label","text","value","percent"]}),texttemplate:l({editType:"plot"},{keys:["label","color","value","text","percent"]}),hoverinfo:s({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:o({},{keys:["label","color","value","text","percent"]}),textposition:s({},n.textposition,{values:["inside","none"],dflt:"inside"}),textfont:n.textfont,insidetextfont:n.insidetextfont,title:{text:n.title.text,font:n.title.font,position:s({},n.title.position,{values:["top left","top center","top right"],dflt:"top center"}),editType:"plot"},domain:i({name:"funnelarea",trace:!0,editType:"calc"}),aspectratio:{valType:"number",min:0,dflt:1,editType:"plot"},baseratio:{valType:"number",min:0,max:1,dflt:.333,editType:"plot"}}},{"../../lib/extend":173,"../../plots/attributes":220,"../../plots/domain":250,"../../plots/template_attributes":264,"../pie/attributes":353}],316:[function(e,t,r){"use strict";var n=e("../../plots/plots");r.name="funnelarea",r.plot=function(e,t,a,i){n.plotBasePlot(r.name,e,t,a,i)},r.clean=function(e,t,a,i){n.cleanBasePlot(r.name,e,t,a,i)}},{"../../plots/plots":257}],317:[function(e,t,r){"use strict";var n=e("../pie/calc");t.exports={calc:function(e,t){return n.calc(e,t)},crossTraceCalc:function(e){n.crossTraceCalc(e,{type:"funnelarea"})}}},{"../pie/calc":355}],318:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./attributes"),i=e("../../plots/domain").defaults,o=e("../bar/defaults").handleText,l=e("../pie/defaults").handleLabelsAndValues;t.exports=function(e,t,r,s){function c(r,i){return n.coerce(e,t,a,r,i)}var u=c("labels"),f=c("values"),d=l(u,f),p=d.len;if(t._hasLabels=d.hasLabels,t._hasValues=d.hasValues,!t._hasLabels&&t._hasValues&&(c("label0"),c("dlabel")),p){t._length=p,c("marker.line.width")&&c("marker.line.color",s.paper_bgcolor),c("marker.colors"),c("scalegroup");var h,g=c("text"),v=c("texttemplate");if(v||(h=c("textinfo",Array.isArray(g)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),v||h&&"none"!==h){var m=c("textposition");o(e,t,s,c,m,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1})}i(t,s,c),c("title.text")&&(c("title.position"),n.coerceFont(c,"title.font",s.font)),c("aspectratio"),c("baseratio")}else t.visible=!1}},{"../../lib":179,"../../plots/domain":250,"../bar/defaults":279,"../pie/defaults":356,"./attributes":315}],319:[function(e,t,r){"use strict";t.exports={moduleType:"trace",name:"funnelarea",basePlotModule:e("./base_plot"),categories:["pie-like","funnelarea","showLegend"],attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults"),supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./calc").crossTraceCalc,plot:e("./plot"),style:e("./style"),styleOne:e("../pie/style_one"),meta:{}}},{"../pie/style_one":364,"./attributes":315,"./base_plot":316,"./calc":317,"./defaults":318,"./layout_attributes":320,"./layout_defaults":321,"./plot":322,"./style":323}],320:[function(e,t,r){"use strict";var n=e("../pie/layout_attributes").hiddenlabels;t.exports={hiddenlabels:n,funnelareacolorway:{valType:"colorlist",editType:"calc"},extendfunnelareacolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{"../pie/layout_attributes":360}],321:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t){function r(r,i){return n.coerce(e,t,a,r,i)}r("hiddenlabels"),r("funnelareacolorway",t.colorway),r("extendfunnelareacolors")}},{"../../lib":179,"./layout_attributes":320}],322:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../components/drawing"),i=e("../../lib"),o=e("../../lib/svg_text_utils"),l=e("../bar/plot").toMoveInsideBar,s=e("../bar/uniform_text"),c=s.recordMinTextSize,u=s.clearMinTextSize,f=e("../pie/helpers"),d=e("../pie/plot"),p=d.attachFxHandlers,h=d.determineInsideTextFont,g=d.layoutAreas,v=d.prerenderTitles,m=d.positionTitleOutside,y=d.formatSliceLabel;function x(e,t){return"l"+(t[0]-e[0])+","+(t[1]-e[1])}t.exports=function(e,t){var r=e._fullLayout;u("funnelarea",r),v(t,e),g(t,r._size),i.makeTraceGroups(r._funnelarealayer,t,"trace").each((function(t){var s=n.select(this),u=t[0],d=u.trace;!function(e){if(!e.length)return;var t=e[0],r=t.trace,n=r.aspectratio,a=r.baseratio;a>.999&&(a=.999);var i,o=Math.pow(a,2),l=t.vTotal,s=l,c=l*o/(1-o)/l;function u(){var e,t={x:e=Math.sqrt(c),y:-e};return[t.x,t.y]}var f,d,p=[];for(p.push(u()),f=e.length-1;f>-1;f--)if(!(d=e[f]).hidden){var h=d.v/s;c+=h,p.push(u())}var g=1/0,v=-1/0;for(f=0;f-1;f--)if(!(d=e[f]).hidden){var M=p[k+=1][0],A=p[k][1];d.TL=[-M,A],d.TR=[M,A],d.BL=w,d.BR=T,d.pxmid=(L=d.TR,S=d.BR,[.5*(L[0]+S[0]),.5*(L[1]+S[1])]),w=d.TL,T=d.TR}var L,S}(t),s.each((function(){var s=n.select(this).selectAll("g.slice").data(t);s.enter().append("g").classed("slice",!0),s.exit().remove(),s.each((function(s,g){if(s.hidden)n.select(this).selectAll("path,g").remove();else{s.pointNumber=s.i,s.curveNumber=d.index;var v=u.cx,m=u.cy,b=n.select(this),_=b.selectAll("path.surface").data([s]);_.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),b.call(p,e,t);var w="M"+(v+s.TR[0])+","+(m+s.TR[1])+x(s.TR,s.BR)+x(s.BR,s.BL)+x(s.BL,s.TL)+"Z";_.attr("d",w),y(e,s,u);var T=f.castOption(d.textposition,s.pts),k=b.selectAll("g.slicetext").data(s.text&&"none"!==T?[0]:[]);k.enter().append("g").classed("slicetext",!0),k.exit().remove(),k.each((function(){var u=i.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),f=i.ensureUniformFontSize(e,h(d,s,r.font));u.text(s.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(a.font,f).call(o.convertToTspans,e);var p,y,x,b=a.bBox(u.node()),_=Math.min(s.BL[1],s.BR[1])+m,w=Math.max(s.TL[1],s.TR[1])+m;y=Math.max(s.TL[0],s.BL[0])+v,x=Math.min(s.TR[0],s.BR[0])+v,(p=l(y,x,_,w,b,{isHorizontal:!0,constrained:!0,angle:0,anchor:"middle"})).fontSize=f.size,c(d.type,p,r),t[g].transform=p,u.attr("transform",i.getTextTransform(p))}))}}));var g=n.select(this).selectAll("g.titletext").data(d.title.text?[0]:[]);g.enter().append("g").classed("titletext",!0),g.exit().remove(),g.each((function(){var t=i.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),l=d.title.text;d._meta&&(l=i.templateString(l,d._meta)),t.text(l).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(a.font,d.title.font).call(o.convertToTspans,e);var s=m(u,r._size);t.attr("transform","translate("+s.x+","+s.y+")"+(s.scale<1?"scale("+s.scale+")":"")+"translate("+s.tx+","+s.ty+")")}))}))}))}},{"../../components/drawing":74,"../../lib":179,"../../lib/svg_text_utils":200,"../bar/plot":286,"../bar/uniform_text":291,"../pie/helpers":358,"../pie/plot":362,d3:16}],323:[function(e,t,r){"use strict";var n=e("d3"),a=e("../pie/style_one"),i=e("../bar/uniform_text").resizeText;t.exports=function(e){var t=e._fullLayout._funnelarealayer.selectAll(".trace");i(e,t,"funnelarea"),t.each((function(e){var t=e[0].trace,r=n.select(this);r.style({opacity:t.opacity}),r.selectAll("path.surface").each((function(e){n.select(this).call(a,e,t)}))}))}},{"../bar/uniform_text":291,"../pie/style_one":364,d3:16}],324:[function(e,t,r){"use strict";var n=e("../bar/attributes"),a=e("../../plots/template_attributes").hovertemplateAttrs,i=e("./bin_attributes"),o=e("./constants"),l=e("../../lib/extend").extendFlat;t.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},text:l({},n.text,{}),hovertext:l({},n.hovertext,{}),orientation:n.orientation,histfunc:{valType:"enumerated",values:["count","sum","avg","min","max"],dflt:"count",editType:"calc"},histnorm:{valType:"enumerated",values:["","percent","probability","density","probability density"],dflt:"",editType:"calc"},cumulative:{enabled:{valType:"boolean",dflt:!1,editType:"calc"},direction:{valType:"enumerated",values:["increasing","decreasing"],dflt:"increasing",editType:"calc"},currentbin:{valType:"enumerated",values:["include","exclude","half"],dflt:"include",editType:"calc"},editType:"calc"},nbinsx:{valType:"integer",min:0,dflt:0,editType:"calc"},xbins:i("x",!0),nbinsy:{valType:"integer",min:0,dflt:0,editType:"calc"},ybins:i("y",!0),autobinx:{valType:"boolean",dflt:null,editType:"calc"},autobiny:{valType:"boolean",dflt:null,editType:"calc"},bingroup:{valType:"string",dflt:"",editType:"calc"},hovertemplate:a({},{keys:o.eventDataKeys}),marker:n.marker,offsetgroup:n.offsetgroup,alignmentgroup:n.alignmentgroup,selected:n.selected,unselected:n.unselected,_deprecated:{bardir:n._deprecated.bardir}}},{"../../lib/extend":173,"../../plots/template_attributes":264,"../bar/attributes":275,"./bin_attributes":326,"./constants":330}],325:[function(e,t,r){"use strict";t.exports=function(e,t){for(var r=e.length,n=0,a=0;ai){var o=i-r[e];return r[e]=i,o}}return 0},max:function(e,t,r,a){var i=a[t];if(n(i)){if(i=Number(i),!n(r[e]))return r[e]=i,i;if(r[e]c?e>o?e>1.1*a?a:e>1.1*i?i:o:e>l?l:e>s?s:c:Math.pow(10,Math.floor(Math.log(e)/Math.LN10))}function p(e,t,r,n,i,l){if(n&&e>o){var s=h(t,i,l),c=h(r,i,l),u=e===a?0:1;return s[u]!==c[u]}return Math.floor(r/e)-Math.floor(t/e)>.1}function h(e,t,r){var n=t.c2d(e,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}t.exports=function(e,t,r,n,i){var l,s,c=-1.1*t,d=-.1*t,p=e-d,h=r[0],g=r[1],v=Math.min(f(h+d,h+p,n,i),f(g+d,g+p,n,i)),m=Math.min(f(h+c,h+d,n,i),f(g+c,g+d,n,i));if(v>m&&mo){var y=l===a?1:6,x=l===a?"M12":"M1";return function(t,r){var o=n.c2d(t,a,i),l=o.indexOf("-",y);l>0&&(o=o.substr(0,l));var c=n.d2c(o,0,i);if(cr.r2l(N)&&(B=o.tickIncrement(B,b.size,!0,p)),E.start=r.l2r(B),F||a.nestedProperty(t,m+".start").set(E.start)}var j=b.end,V=r.r2l(z.end),U=void 0!==V;if((b.endFound||U)&&V!==r.r2l(j)){var q=U?V:a.aggNums(Math.max,null,h);E.end=r.l2r(q),U||a.nestedProperty(t,m+".start").set(E.end)}var G="autobin"+l;return!1===t._input[G]&&(t._input[m]=a.extendFlat({},t[m]||{}),delete t._input[G],delete t[G]),[E,h]}t.exports={calc:function(e,t){var r,i,p,h,g=[],v=[],m=o.getFromId(e,"h"===t.orientation?t.yaxis:t.xaxis),y="h"===t.orientation?"y":"x",x={x:"y",y:"x"}[y],b=t[y+"calendar"],_=t.cumulative,w=d(e,t,m,y),T=w[0],k=w[1],M="string"==typeof T.size,A=[],L=M?A:T,S=[],C=[],O=[],D=0,P=t.histnorm,z=t.histfunc,E=-1!==P.indexOf("density");_.enabled&&E&&(P=P.replace(/ ?density$/,""),E=!1);var R,I="max"===z||"min"===z?null:0,F=s.count,N=c[P],H=!1,B=function(e){return m.r2c(e,0,b)};for(a.isArrayOrTypedArray(t[x])&&"count"!==z&&(R=t[x],H="avg"===z,F=s[z]),r=B(T.start),p=B(T.end)+(r-o.tickIncrement(r,T.size,!1,b))/1e6;r=0&&h=0;n--)l(n);else if("increasing"===t){for(n=1;n=0;n--)e[n]+=e[n+1];"exclude"===r&&(e.push(0),e.shift())}}(v,_.direction,_.currentbin);var Q=Math.min(g.length,v.length),J=[],$=0,K=Q-1;for(r=0;r=$;r--)if(v[r]){K=r;break}for(r=$;r<=K;r++)if(n(g[r])&&n(v[r])){var ee={p:g[r],s:v[r],b:0};_.enabled||(ee.pts=O[r],G?ee.ph0=ee.ph1=O[r].length?k[O[r][0]]:g[r]:(t._computePh=!0,ee.ph0=U(A[r]),ee.ph1=U(A[r+1],!0))),J.push(ee)}return 1===J.length&&(J[0].width1=o.tickIncrement(J[0].p,T.size,!1,b)-J[0].p),l(J,t),a.isArrayOrTypedArray(t.selectedpoints)&&a.tagSelected(J,t,X),J},calcAllAutoBins:d}},{"../../lib":179,"../../plots/cartesian/axes":223,"../../registry":265,"../bar/arrays_to_calcdata":274,"./average":325,"./bin_functions":327,"./bin_label_vals":328,"./norm_functions":336,"fast-isnumeric":18}],330:[function(e,t,r){"use strict";t.exports={eventDataKeys:["binNumber"]}},{}],331:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axis_ids"),i=e("../../registry").traceIs,o=e("../bar/defaults").handleGroupingDefaults,l=n.nestedProperty,s=a.getAxisGroup,c=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],u=["x","y"];t.exports=function(e,t){var r,f,d,p,h,g,v,m=t._histogramBinOpts={},y=[],x={},b=[];function _(e,t){return n.coerce(r._input,r,r._module.attributes,e,t)}function w(e){return"v"===e.orientation?"x":"y"}function T(e,r,i){var o=e.uid+"__"+i;r||(r=o);var l=function(e,r){return a.getFromTrace({_fullLayout:t},e,r).type}(e,i),s=e[i+"calendar"]||"",c=m[r],u=!0;c&&(l===c.axType&&s===c.calendar?(u=!1,c.traces.push(e),c.dirs.push(i)):(r=o,l!==c.axType&&n.warn(["Attempted to group the bins of trace",e.index,"set on a","type:"+l,"axis","with bins on","type:"+c.axType,"axis."].join(" ")),s!==c.calendar&&n.warn(["Attempted to group the bins of trace",e.index,"set with a",s,"calendar","with bins",c.calendar?"on a "+c.calendar+" calendar":"w/o a set calendar"].join(" ")))),u&&(m[r]={traces:[e],dirs:[i],axType:l,calendar:e[i+"calendar"]||""}),e["_"+i+"bingroup"]=r}for(h=0;h0}function x(e){e.each((function(e){h.stroke(n.select(this),e.line.color)})).each((function(e){h.fill(n.select(this),e.color)})).style("stroke-width",(function(e){return e.line.width}))}function b(e,t,r){var n=e._fullLayout,i=a.extendFlat({type:"linear",ticks:"outside",range:r,showline:!0},t),o={type:"linear",_id:"x"+t._id},l={letter:"x",font:n.font,noHover:!0,noTickson:!0};function s(e,t){return a.coerce(i,o,p,e,t)}return f(i,o,s,l,n),d(i,o,s,l),o}function _(e,t){return"translate("+e+","+t+")"}function w(e,t,r){return[Math.min(t/e.width,r/e.height),e,t+"x"+r]}function T(e,t,r,a){var i=document.createElementNS("http://www.w3.org/2000/svg","text"),o=n.select(i);return o.text(e).attr("x",0).attr("y",0).attr("text-anchor",r).attr("data-unformatted",e).call(c.convertToTspans,a).call(l.font,t),l.bBox(o.node())}function k(e,t,r,n,i,o){var l="_cache"+t;e[l]&&e[l].key===i||(e[l]={key:i,value:r});var s=a.aggNums(o,null,[e[l].value,n],2);return e[l].value=s,s}t.exports=function(e,t,r,f){var d,p=e._fullLayout;y(r)&&f&&(d=f()),a.makeTraceGroups(p._indicatorlayer,t,"trace").each((function(t){var f,M,A,L,S,C=t[0].trace,O=n.select(this),D=C._hasGauge,P=C._isAngular,z=C._isBullet,E=C.domain,R={w:p._size.w*(E.x[1]-E.x[0]),h:p._size.h*(E.y[1]-E.y[0]),l:p._size.l+p._size.w*E.x[0],r:p._size.r+p._size.w*(1-E.x[1]),t:p._size.t+p._size.h*(1-E.y[1]),b:p._size.b+p._size.h*E.y[0]},I=R.l+R.w/2,F=R.t+R.h/2,N=Math.min(R.w/2,R.h),H=s.innerRadius*N,B=C.align||"center";if(M=F,D){if(P&&(f=I,M=F+N/2,A=function(e){return function(e,t){var r=Math.sqrt(e.width/2*(e.width/2)+e.height*e.height);return[t/r,e,t]}(e,.9*H)}),z){var j=s.bulletPadding,V=1-s.bulletNumberDomainSize+j;f=R.l+(V+(1-V)*v[B])*R.w,A=function(e){return w(e,(s.bulletNumberDomainSize-j)*R.w,R.h)}}}else f=R.l+v[B]*R.w,A=function(e){return w(e,R.w,R.h)};!function(e,t,r,i){var o,s,f,d=r[0].trace,p=i.numbersX,x=i.numbersY,w=d.align||"center",M=g[w],A=i.transitionOpts,L=i.onComplete,S=a.ensureSingle(t,"g","numbers"),C=[];d._hasNumber&&C.push("number");d._hasDelta&&(C.push("delta"),"left"===d.delta.position&&C.reverse());var O=S.selectAll("text").data(C);function D(t,r,n,a){if(!t.match("s")||n>=0==a>=0||r(n).slice(-1).match(m)||r(a).slice(-1).match(m))return r;var i=t.slice().replace("s","f").replace(/\d+/,(function(e){return parseInt(e)-1})),o=b(e,{tickformat:i});return function(e){return Math.abs(e)<1?u.tickText(o,e).text:r(e)}}O.enter().append("text"),O.attr("text-anchor",(function(){return M})).attr("class",(function(e){return e})).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),O.exit().remove();var P,z=d.mode+d.align;d._hasDelta&&(P=function(){var t=b(e,{tickformat:d.delta.valueformat},d._range);t.setScale(),u.prepTicks(t);var a=function(e){return u.tickText(t,e).text},i=function(e){return d.delta.relative?e.relativeDelta:e.delta},o=function(e,t){return 0===e||"number"!=typeof e||isNaN(e)?"-":(e>0?d.delta.increasing.symbol:d.delta.decreasing.symbol)+t(e)},f=function(e){return e.delta>=0?d.delta.increasing.color:d.delta.decreasing.color};void 0===d._deltaLastValue&&(d._deltaLastValue=i(r[0]));var p=S.select("text.delta");function g(){p.text(o(i(r[0]),a)).call(h.fill,f(r[0])).call(c.convertToTspans,e)}return p.call(l.font,d.delta.font).call(h.fill,f({delta:d._deltaLastValue})),y(A)?p.transition().duration(A.duration).ease(A.easing).tween("text",(function(){var e=n.select(this),t=i(r[0]),l=d._deltaLastValue,s=D(d.delta.valueformat,a,l,t),c=n.interpolateNumber(l,t);return d._deltaLastValue=t,function(t){e.text(o(c(t),s)),e.call(h.fill,f({delta:c(t)}))}})).each("end",(function(){g(),L&&L()})).each("interrupt",(function(){g(),L&&L()})):g(),s=T(o(i(r[0]),a),d.delta.font,M,e),p}(),z+=d.delta.position+d.delta.font.size+d.delta.font.family+d.delta.valueformat,z+=d.delta.increasing.symbol+d.delta.decreasing.symbol,f=s);d._hasNumber&&(!function(){var t=b(e,{tickformat:d.number.valueformat},d._range);t.setScale(),u.prepTicks(t);var a=function(e){return u.tickText(t,e).text},i=d.number.suffix,s=d.number.prefix,f=S.select("text.number");function p(){var t="number"==typeof r[0].y?s+a(r[0].y)+i:"-";f.text(t).call(l.font,d.number.font).call(c.convertToTspans,e)}y(A)?f.transition().duration(A.duration).ease(A.easing).each("end",(function(){p(),L&&L()})).each("interrupt",(function(){p(),L&&L()})).attrTween("text",(function(){var e=n.select(this),t=n.interpolateNumber(r[0].lastY,r[0].y);d._lastValue=r[0].y;var o=D(d.number.valueformat,a,r[0].lastY,r[0].y);return function(r){e.text(s+o(t(r))+i)}})):p(),o=T(s+a(r[0].y)+i,d.number.font,M,e)}(),z+=d.number.font.size+d.number.font.family+d.number.valueformat+d.number.suffix+d.number.prefix,f=o);if(d._hasDelta&&d._hasNumber){var E,R,I=[(o.left+o.right)/2,(o.top+o.bottom)/2],F=[(s.left+s.right)/2,(s.top+s.bottom)/2],N=.75*d.delta.font.size;"left"===d.delta.position&&(E=k(d,"deltaPos",0,-1*(o.width*v[d.align]+s.width*(1-v[d.align])+N),z,Math.min),R=I[1]-F[1],f={width:o.width+s.width+N,height:Math.max(o.height,s.height),left:s.left+E,right:o.right,top:Math.min(o.top,s.top+R),bottom:Math.max(o.bottom,s.bottom+R)}),"right"===d.delta.position&&(E=k(d,"deltaPos",0,o.width*(1-v[d.align])+s.width*v[d.align]+N,z,Math.max),R=I[1]-F[1],f={width:o.width+s.width+N,height:Math.max(o.height,s.height),left:o.left,right:s.right+E,top:Math.min(o.top,s.top+R),bottom:Math.max(o.bottom,s.bottom+R)}),"bottom"===d.delta.position&&(E=null,R=s.height,f={width:Math.max(o.width,s.width),height:o.height+s.height,left:Math.min(o.left,s.left),right:Math.max(o.right,s.right),top:o.bottom-o.height,bottom:o.bottom+s.height}),"top"===d.delta.position&&(E=null,R=o.top,f={width:Math.max(o.width,s.width),height:o.height+s.height,left:Math.min(o.left,s.left),right:Math.max(o.right,s.right),top:o.bottom-o.height-s.height,bottom:o.bottom}),P.attr({dx:E,dy:R})}(d._hasNumber||d._hasDelta)&&S.attr("transform",(function(){var e=i.numbersScaler(f);z+=e[2];var t,r=k(d,"numbersScale",1,e[0],z,Math.min);d._scaleNumbers||(r=1),t=d._isAngular?x-r*f.bottom:x-r*(f.top+f.bottom)/2,d._numbersTop=r*f.top+t;var n=f[w];"center"===w&&(n=(f.left+f.right)/2);var a=p-r*n;return _(a=k(d,"numbersTranslate",0,a,z,Math.max),t)+" scale("+r+")"}))}(e,O,t,{numbersX:f,numbersY:M,numbersScaler:A,transitionOpts:r,onComplete:d}),D&&(L={range:C.gauge.axis.range,color:C.gauge.bgcolor,line:{color:C.gauge.bordercolor,width:0},thickness:1},S={range:C.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:C.gauge.bordercolor,width:C.gauge.borderwidth},thickness:1});var U=O.selectAll("g.angular").data(P?t:[]);U.exit().remove();var q=O.selectAll("g.angularaxis").data(P?t:[]);q.exit().remove(),P&&function(e,t,r,a){var l,s,c,f,d=r[0].trace,p=a.size,h=a.radius,g=a.innerRadius,v=a.gaugeBg,m=a.gaugeOutline,w=[p.l+p.w/2,p.t+p.h/2+h/2],T=a.gauge,k=a.layer,M=a.transitionOpts,A=a.onComplete,L=Math.PI/2;function S(e){var t=d.gauge.axis.range[0],r=(e-t)/(d.gauge.axis.range[1]-t)*Math.PI-L;return r<-L?-L:r>L?L:r}function C(e){return n.svg.arc().innerRadius((g+h)/2-e/2*(h-g)).outerRadius((g+h)/2+e/2*(h-g)).startAngle(-L)}function O(e){e.attr("d",(function(e){return C(e.thickness).startAngle(S(e.range[0])).endAngle(S(e.range[1]))()}))}T.enter().append("g").classed("angular",!0),T.attr("transform",_(w[0],w[1])),k.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),k.selectAll("g.xangularaxistick,path,text").remove(),(l=b(e,d.gauge.axis)).type="linear",l.range=d.gauge.axis.range,l._id="xangularaxis",l.setScale();var D=function(e){return(l.range[0]-e.x)/(l.range[1]-l.range[0])*Math.PI+Math.PI},P={},z=u.makeLabelFns(l,0).labelStandoff;P.xFn=function(e){var t=D(e);return Math.cos(t)*z},P.yFn=function(e){var t=D(e),r=Math.sin(t)>0?.2:1;return-Math.sin(t)*(z+e.fontSize*r)+Math.abs(Math.cos(t))*(e.fontSize*o)},P.anchorFn=function(e){var t=D(e),r=Math.cos(t);return Math.abs(r)<.1?"middle":r>0?"start":"end"},P.heightFn=function(e,t,r){var n=D(e);return-.5*(1+Math.sin(n))*r};var E=function(e){return _(w[0]+h*Math.cos(e),w[1]-h*Math.sin(e))};c=function(e){return E(D(e))};if(s=u.calcTicks(l),f=u.getTickSigns(l)[2],l.visible){f="inside"===l.ticks?-1:1;var R=(l.linewidth||1)/2;u.drawTicks(e,l,{vals:s,layer:k,path:"M"+f*R+",0h"+f*l.ticklen,transFn:function(e){var t=D(e);return E(t)+"rotate("+-i(t)+")"}}),u.drawLabels(e,l,{vals:s,layer:k,transFn:c,labelFns:P})}var I=[v].concat(d.gauge.steps),F=T.selectAll("g.bg-arc").data(I);F.enter().append("g").classed("bg-arc",!0).append("path"),F.select("path").call(O).call(x),F.exit().remove();var N=C(d.gauge.bar.thickness),H=T.selectAll("g.value-arc").data([d.gauge.bar]);H.enter().append("g").classed("value-arc",!0).append("path");var B=H.select("path");y(M)?(B.transition().duration(M.duration).ease(M.easing).each("end",(function(){A&&A()})).each("interrupt",(function(){A&&A()})).attrTween("d",(j=N,V=S(r[0].lastY),U=S(r[0].y),function(){var e=n.interpolate(V,U);return function(t){return j.endAngle(e(t))()}})),d._lastValue=r[0].y):B.attr("d","number"==typeof r[0].y?N.endAngle(S(r[0].y)):"M0,0Z");var j,V,U;B.call(x),H.exit().remove(),I=[];var q=d.gauge.threshold.value;q&&I.push({range:[q,q],color:d.gauge.threshold.color,line:{color:d.gauge.threshold.line.color,width:d.gauge.threshold.line.width},thickness:d.gauge.threshold.thickness});var G=T.selectAll("g.threshold-arc").data(I);G.enter().append("g").classed("threshold-arc",!0).append("path"),G.select("path").call(O).call(x),G.exit().remove();var Z=T.selectAll("g.gauge-outline").data([m]);Z.enter().append("g").classed("gauge-outline",!0).append("path"),Z.select("path").call(O).call(x),Z.exit().remove()}(e,0,t,{radius:N,innerRadius:H,gauge:U,layer:q,size:R,gaugeBg:L,gaugeOutline:S,transitionOpts:r,onComplete:d});var G=O.selectAll("g.bullet").data(z?t:[]);G.exit().remove();var Z=O.selectAll("g.bulletaxis").data(z?t:[]);Z.exit().remove(),z&&function(e,t,r,n){var a,i,o,l,c,f=r[0].trace,d=n.gauge,p=n.layer,g=n.gaugeBg,v=n.gaugeOutline,m=n.size,_=f.domain,w=n.transitionOpts,T=n.onComplete;d.enter().append("g").classed("bullet",!0),d.attr("transform","translate("+m.l+", "+m.t+")"),p.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),p.selectAll("g.xbulletaxistick,path,text").remove();var k=m.h,M=f.gauge.bar.thickness*k,A=_.x[0],L=_.x[0]+(_.x[1]-_.x[0])*(f._hasNumber||f._hasDelta?1-s.bulletNumberDomainSize:1);(a=b(e,f.gauge.axis))._id="xbulletaxis",a.domain=[A,L],a.setScale(),i=u.calcTicks(a),o=u.makeTransFn(a),l=u.getTickSigns(a)[2],c=m.t+m.h,a.visible&&(u.drawTicks(e,a,{vals:"inside"===a.ticks?u.clipEnds(a,i):i,layer:p,path:u.makeTickPath(a,c,l),transFn:o}),u.drawLabels(e,a,{vals:i,layer:p,transFn:o,labelFns:u.makeLabelFns(a,c)}));function S(e){e.attr("width",(function(e){return Math.max(0,a.c2p(e.range[1])-a.c2p(e.range[0]))})).attr("x",(function(e){return a.c2p(e.range[0])})).attr("y",(function(e){return.5*(1-e.thickness)*k})).attr("height",(function(e){return e.thickness*k}))}var C=[g].concat(f.gauge.steps),O=d.selectAll("g.bg-bullet").data(C);O.enter().append("g").classed("bg-bullet",!0).append("rect"),O.select("rect").call(S).call(x),O.exit().remove();var D=d.selectAll("g.value-bullet").data([f.gauge.bar]);D.enter().append("g").classed("value-bullet",!0).append("rect"),D.select("rect").attr("height",M).attr("y",(k-M)/2).call(x),y(w)?D.select("rect").transition().duration(w.duration).ease(w.easing).each("end",(function(){T&&T()})).each("interrupt",(function(){T&&T()})).attr("width",Math.max(0,a.c2p(Math.min(f.gauge.axis.range[1],r[0].y)))):D.select("rect").attr("width","number"==typeof r[0].y?Math.max(0,a.c2p(Math.min(f.gauge.axis.range[1],r[0].y))):0);D.exit().remove();var P=r.filter((function(){return f.gauge.threshold.value})),z=d.selectAll("g.threshold-bullet").data(P);z.enter().append("g").classed("threshold-bullet",!0).append("line"),z.select("line").attr("x1",a.c2p(f.gauge.threshold.value)).attr("x2",a.c2p(f.gauge.threshold.value)).attr("y1",(1-f.gauge.threshold.thickness)/2*k).attr("y2",(1-(1-f.gauge.threshold.thickness)/2)*k).call(h.stroke,f.gauge.threshold.line.color).style("stroke-width",f.gauge.threshold.line.width),z.exit().remove();var E=d.selectAll("g.gauge-outline").data([v]);E.enter().append("g").classed("gauge-outline",!0).append("rect"),E.select("rect").call(S).call(x),E.exit().remove()}(e,0,t,{gauge:G,layer:Z,size:R,gaugeBg:L,gaugeOutline:S,transitionOpts:r,onComplete:d});var Y=O.selectAll("text.title").data(t);Y.exit().remove(),Y.enter().append("text").classed("title",!0),Y.attr("text-anchor",(function(){return z?g.right:g[C.title.align]})).text(C.title.text).call(l.font,C.title.font).call(c.convertToTspans,e),Y.attr("transform",(function(){var e,t=R.l+R.w*v[C.title.align],r=s.titlePadding,n=l.bBox(Y.node());if(D){if(P)if(C.gauge.axis.visible)e=l.bBox(q.node()).top-r-n.bottom;else e=R.t+R.h/2-N/2-n.bottom-r;z&&(e=M-(n.top+n.bottom)/2,t=R.l-s.bulletPadding*R.w)}else e=C._numbersTop-r-n.bottom;return _(t,e)}))}))}},{"../../components/color":52,"../../components/drawing":74,"../../constants/alignment":154,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/cartesian/axes":223,"../../plots/cartesian/axis_defaults":225,"../../plots/cartesian/layout_attributes":237,"../../plots/cartesian/position_defaults":240,"./constants":340,d3:16}],344:[function(e,t,r){"use strict";var n=e("../../lib").extendFlat,a=e("../scatter/attributes"),i=e("../../components/drawing/attributes").dash,o=e("../../components/fx/attributes"),l=e("../../constants/delta.js"),s=l.INCREASING.COLOR,c=l.DECREASING.COLOR,u=a.line;function f(e){return{line:{color:n({},u.color,{dflt:e}),width:u.width,dash:i,editType:"style"},editType:"style"}}t.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes"},open:{valType:"data_array",editType:"calc"},high:{valType:"data_array",editType:"calc"},low:{valType:"data_array",editType:"calc"},close:{valType:"data_array",editType:"calc"},line:{width:n({},u.width,{}),dash:n({},i,{}),editType:"style"},increasing:f(s),decreasing:f(c),text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},tickwidth:{valType:"number",min:0,max:.5,dflt:.3,editType:"calc"},hoverlabel:n({},o.hoverlabel,{split:{valType:"boolean",dflt:!1,editType:"style"}})}},{"../../components/drawing/attributes":73,"../../components/fx/attributes":83,"../../constants/delta.js":155,"../../lib":179,"../scatter/attributes":366}],345:[function(e,t,r){"use strict";var n=e("../../lib"),a=n._,i=e("../../plots/cartesian/axes"),o=e("../../constants/numerical").BADNUM;function l(e,t,r,n){return{o:e,h:t,l:r,c:n}}function s(e,t,r,l,s){for(var c=l.makeCalcdata(t,"open"),u=l.makeCalcdata(t,"high"),f=l.makeCalcdata(t,"low"),d=l.makeCalcdata(t,"close"),p=Array.isArray(t.text),h=Array.isArray(t.hovertext),g=!0,v=null,m=[],y=0;yv):g=T>b,v=T;var k=s(b,_,w,T);k.pos=x,k.yc=(b+T)/2,k.i=y,k.dir=g?"increasing":"decreasing",k.x=k.pos,k.y=[w,_],p&&(k.tx=t.text[y]),h&&(k.htx=t.hovertext[y]),m.push(k)}else m.push({pos:x,empty:!0})}return t._extremes[l._id]=i.findExtremes(l,n.concat(f,u),{padded:!0}),m.length&&(m[0].t={labels:{open:a(e,"open:")+" ",high:a(e,"high:")+" ",low:a(e,"low:")+" ",close:a(e,"close:")+" "}}),m}t.exports={calc:function(e,t){var r=i.getFromId(e,t.xaxis),a=i.getFromId(e,t.yaxis),o=function(e,t,r){var a=r._minDiff;if(!a){var i,o=e._fullData,l=[];for(a=1/0,i=0;i"+c.labels[x]+n.hoverLabelText(l,b):((y=a.extendFlat({},d)).y0=y.y1=_,y.yLabelVal=b,y.yLabel=c.labels[x]+n.hoverLabelText(l,b),y.name="",f.push(y),v[b]=y)}return f}function d(e,t,r,a){var i=e.cd,o=e.ya,s=i[0].trace,f=i[0].t,d=u(e,t,r,a);if(!d)return[];var p=i[d.index],h=d.index=p.i,g=p.dir;function v(e){return f.labels[e]+n.hoverLabelText(o,s[e][h])}var m=p.hi||s.hoverinfo,y=m.split("+"),x="all"===m,b=x||-1!==y.indexOf("y"),_=x||-1!==y.indexOf("text"),w=b?[v("open"),v("high"),v("low"),v("close")+" "+c[g]]:[];return _&&l(p,s,w),d.extraText=w.join("
"),d.y0=d.y1=o.c2p(p.yc,!0),[d]}t.exports={hoverPoints:function(e,t,r,n){return e.cd[0].trace.hoverlabel.split?f(e,t,r,n):d(e,t,r,n)},hoverSplit:f,hoverOnPoints:d}},{"../../components/color":52,"../../components/fx":92,"../../constants/delta.js":155,"../../lib":179,"../../plots/cartesian/axes":223}],348:[function(e,t,r){"use strict";t.exports={moduleType:"trace",name:"ohlc",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","showLegend"],meta:{},attributes:e("./attributes"),supplyDefaults:e("./defaults"),calc:e("./calc").calc,plot:e("./plot"),style:e("./style"),hoverPoints:e("./hover").hoverPoints,selectPoints:e("./select")}},{"../../plots/cartesian":236,"./attributes":344,"./calc":345,"./defaults":346,"./hover":347,"./plot":350,"./select":351,"./style":352}],349:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports=function(e,t,r,i){var o=r("x"),l=r("open"),s=r("high"),c=r("low"),u=r("close");if(r("hoverlabel.split"),n.getComponentMethod("calendars","handleTraceDefaults")(e,t,["x"],i),l&&s&&c&&u){var f=Math.min(l.length,s.length,c.length,u.length);return o&&(f=Math.min(f,a.minRowLength(o))),t._length=f,f}}},{"../../lib":179,"../../registry":265}],350:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib");t.exports=function(e,t,r,i){var o=t.yaxis,l=t.xaxis,s=!!l.rangebreaks;a.makeTraceGroups(i,r,"trace ohlc").each((function(e){var t=n.select(this),r=e[0],i=r.t;if(!0!==r.trace.visible||i.empty)t.remove();else{var c=i.tickLen,u=t.selectAll("path").data(a.identity);u.enter().append("path"),u.exit().remove(),u.attr("d",(function(e){if(e.empty)return"M0,0Z";var t=l.c2p(e.pos-c,!0),r=l.c2p(e.pos+c,!0),n=s?(t+r)/2:l.c2p(e.pos,!0);return"M"+t+","+o.c2p(e.o,!0)+"H"+n+"M"+n+","+o.c2p(e.h,!0)+"V"+o.c2p(e.l,!0)+"M"+r+","+o.c2p(e.c,!0)+"H"+n}))}}))}},{"../../lib":179,d3:16}],351:[function(e,t,r){"use strict";t.exports=function(e,t){var r,n=e.cd,a=e.xaxis,i=e.yaxis,o=[],l=n[0].t.bPos||0;if(!1===t)for(r=0;r0){l=!0;break}}l||(o=0)}return{hasLabels:r,hasValues:i,len:o}}t.exports={handleLabelsAndValues:s,supplyDefaults:function(e,t,r,n){function c(r,n){return a.coerce(e,t,i,r,n)}var u=s(c("labels"),c("values")),f=u.len;if(t._hasLabels=u.hasLabels,t._hasValues=u.hasValues,!t._hasLabels&&t._hasValues&&(c("label0"),c("dlabel")),f){t._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var d,p=c("text"),h=c("texttemplate");if(h||(d=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),h||d&&"none"!==d){var g=c("textposition");l(e,t,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(t,n,c);var v=c("hole");if(c("title.text")){var m=c("title.position",v?"middle center":"top center");v||"middle center"!==m||(t.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else t.visible=!1}}},{"../../lib":179,"../../plots/domain":250,"../bar/defaults":279,"./attributes":353,"fast-isnumeric":18}],357:[function(e,t,r){"use strict";var n=e("../../components/fx/helpers").appendArrayMultiPointValues;t.exports=function(e,t){var r={curveNumber:t.index,pointNumbers:e.pts,data:t._input,fullData:t,label:e.label,color:e.color,value:e.v,percent:e.percent,text:e.text,v:e.v};return 1===e.pts.length&&(r.pointNumber=r.i=e.pts[0]),n(r,t,e.pts),"funnelarea"===t.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":88}],358:[function(e,t,r){"use strict";var n=e("../../lib");r.formatPiePercent=function(e,t){var r=(100*e).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,t)+"%"},r.formatPieValue=function(e,t){var r=e.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,t)},r.getFirstFilled=function(e,t){if(Array.isArray(e))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:h.castOption(b.bgcolor,e.pts)||e.color,borderColor:h.castOption(b.bordercolor,e.pts),fontFamily:h.castOption(_.family,e.pts),fontSize:h.castOption(_.size,e.pts),fontColor:h.castOption(_.color,e.pts),nameLength:h.castOption(b.namelength,e.pts),textAlign:h.castOption(b.align,e.pts),hovertemplate:h.castOption(u.hovertemplate,e.pts),hovertemplateLabels:e,eventData:[g(e,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,t.emit("plotly_hover",{points:[g(e,u)],event:n.event})}})),e.on("mouseout",(function(e){var r=t._fullLayout,a=t._fullData[o.index],l=n.select(this).datum();o._hasHoverEvent&&(e.originalEvent=n.event,t.emit("plotly_unhover",{points:[g(l,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),e.on("click",(function(e){var r=t._fullLayout,a=t._fullData[o.index];t._dragging||!1===r.hovermode||(t._hoverdata=[g(e,a)],i.click(t,n.event))}))}function y(e,t,r){var n=h.castOption(e.insidetextfont.color,t.pts);!n&&e._input.textfont&&(n=h.castOption(e._input.textfont.color,t.pts));var a=h.castOption(e.insidetextfont.family,t.pts)||h.castOption(e.textfont.family,t.pts)||r.family,i=h.castOption(e.insidetextfont.size,t.pts)||h.castOption(e.textfont.size,t.pts)||r.size;return{color:n||o.contrast(t.color),family:a,size:i}}function x(e,t){for(var r,n,a=0;at&&t>n||r=-4;v-=2)m(Math.PI*v,"tan");for(v=4;v>=-4;v-=2)m(Math.PI*(v+1),"tan")}if(f||p){for(v=4;v>=-4;v-=2)m(Math.PI*(v+1.5),"rad");for(v=4;v>=-4;v-=2)m(Math.PI*(v+.5),"rad")}}if(l||h||f){var y=Math.sqrt(e.width*e.width+e.height*e.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(t.startangle+t.stopangle)/2,i.scale>=1)return i;g.push(i)}(h||p)&&((i=_(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i)),(h||d)&&((i=w(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i));for(var x=0,b=0,T=0;T=1)break}return g[x]}function _(e,t,r,n,a){t=Math.max(0,t-2*p);var i=e.width/e.height,o=M(i,n,t,r);return{scale:2*o/e.height,rCenter:T(i,o/t),rotate:k(a)}}function w(e,t,r,n,a){t=Math.max(0,t-2*p);var i=e.height/e.width,o=M(i,n,t,r);return{scale:2*o/e.width,rCenter:T(i,o/t),rotate:k(a+Math.PI/2)}}function T(e,t){return Math.cos(t)-e*t}function k(e){return(180/Math.PI*e+720)%180-90}function M(e,t,r,n){var a=e+1/(2*Math.tan(t));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(e*e+n/2)+e))}function A(e,t){return e.v!==t.vTotal||t.trace.hole?Math.min(1/(1+1/Math.sin(e.halfangle)),e.ring/2):1}function L(e,t){var r=t.pxmid[0],n=t.pxmid[1],a=e.width/2,i=e.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function S(e,t){var r,n,a,i=e.trace,o={x:e.cx,y:e.cy},l={tx:0,ty:0};l.ty+=i.title.font.size,a=O(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*e.r,l.ty-=e.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*e.r);var s,c,u=(s=e.r,c=e.trace.aspectratio,s/(void 0===c?1:c)),f=t.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(f+=u,o.x-=(1+a)*u,l.tx+=e.titleBox.width/2):-1!==i.title.position.indexOf("center")?f*=2:-1!==i.title.position.indexOf("right")&&(f+=u,o.x+=(1+a)*u,l.tx-=e.titleBox.width/2),r=f/e.titleBox.width,n=C(e,t)/e.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:l.tx,ty:l.ty}}function C(e,t){var r=e.trace,n=t.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(e.titleBox.height,n/2)}function O(e){var t,r=e.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,t=0;tr&&(r=e.pull[t]);return r}function D(e,t){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,s=c*u}o=Math.min(o,s/r.vTotal)}for(n=0;n")}if(i){var x=s.castOption(a,t.i,"texttemplate");if(x){var b=function(e){return{label:e.label,value:e.v,valueLabel:h.formatPieValue(e.v,n.separators),percent:e.v/r.vTotal,percentLabel:h.formatPiePercent(e.v/r.vTotal,n.separators),color:e.color,text:e.text,customdata:s.castOption(a,e.i,"customdata")}}(t),_=h.getFirstFilled(a.text,t.pts);(v(_)||""===_)&&(b.text=_),t.text=s.texttemplateString(x,b,e._fullLayout._d3locale,b,a._meta||{})}else t.text=""}}function E(e,t){var r=e.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(t.left+t.right)/2,o=(t.top+t.bottom)/2;e.textX=i*n-o*a,e.textY=i*a+o*n,e.noCenter=!0}t.exports={plot:function(e,t){var r=e._fullLayout,i=r._size;d("pie",r),x(t,e),D(t,i);var u=s.makeTraceGroups(r._pielayer,t,"trace").each((function(t){var u=n.select(this),d=t[0],p=d.trace;!function(e){var t,r,n,a=e[0],i=a.r,o=a.trace,l=o.rotation*Math.PI/180,s=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(t=0;ta.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=A(r,a))}(t),u.attr("stroke-linejoin","round"),u.each((function(){var g=n.select(this).selectAll("g.slice").data(t);g.enter().append("g").classed("slice",!0),g.exit().remove();var v=[[[],[]],[[],[]]],x=!1;g.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=p.index,v[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=d.cx,u=d.cy,g=n.select(this),_=g.selectAll("path.surface").data([a]);if(_.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),g.call(m,e,t),p.pull){var w=+h.castOption(p.pull,a.pts)||0;w>0&&(o+=w*a.pxmid[0],u+=w*a.pxmid[1])}a.cxFinal=o,a.cyFinal=u;var T=p.hole;if(a.v===d.vTotal){var k="M"+(o+a.px0[0])+","+(u+a.px0[1])+O(a.px0,a.pxmid,!0,1)+O(a.pxmid,a.px0,!0,1)+"Z";T?_.attr("d","M"+(o+T*a.px0[0])+","+(u+T*a.px0[1])+O(a.px0,a.pxmid,!1,T)+O(a.pxmid,a.px0,!1,T)+"Z"+k):_.attr("d",k)}else{var M=O(a.px0,a.px1,!0,1);if(T){var A=1-T;_.attr("d","M"+(o+T*a.px1[0])+","+(u+T*a.px1[1])+O(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else _.attr("d","M"+o+","+u+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}z(e,a,d);var S=h.castOption(p.textposition,a.pts),C=g.selectAll("g.slicetext").data(a.text&&"none"!==S?[0]:[]);C.enter().append("g").classed("slicetext",!0),C.exit().remove(),C.each((function(){var g=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),v=s.ensureUniformFontSize(e,"outside"===S?function(e,t,r){var n=h.castOption(e.outsidetextfont.color,t.pts)||h.castOption(e.textfont.color,t.pts)||r.color,a=h.castOption(e.outsidetextfont.family,t.pts)||h.castOption(e.textfont.family,t.pts)||r.family,i=h.castOption(e.outsidetextfont.size,t.pts)||h.castOption(e.textfont.size,t.pts)||r.size;return{color:n,family:a,size:i}}(p,a,r.font):y(p,a,r.font));g.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,v).call(c.convertToTspans,e);var m,_=l.bBox(g.node());if("outside"===S)m=L(_,a);else if(m=b(_,a,d),"auto"===S&&m.scale<1){var w=s.ensureUniformFontSize(e,p.outsidetextfont);g.call(l.font,w),m=L(_=l.bBox(g.node()),a)}var T=m.textPosAngle,k=void 0===T?a.pxmid:P(d.r,T);if(m.targetX=o+k[0]*m.rCenter+(m.x||0),m.targetY=u+k[1]*m.rCenter+(m.y||0),E(m,_),m.outside){var M=m.targetY;a.yLabelMin=M-_.height/2,a.yLabelMid=M,a.yLabelMax=M+_.height/2,a.labelExtraX=0,a.labelExtraY=0,x=!0}m.fontSize=v.size,f(p.type,m,r),t[i].transform=m,g.attr("transform",s.getTextTransform(m))}))}function O(e,t,r,n){var i=n*(t[0]-e[0]),o=n*(t[1]-e[1]);return"a"+n*d.r+","+n*d.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var _=n.select(this).selectAll("g.titletext").data(p.title.text?[0]:[]);if(_.enter().append("g").classed("titletext",!0),_.exit().remove(),_.each((function(){var t,r=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),a=p.title.text;p._meta&&(a=s.templateString(a,p._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(l.font,p.title.font).call(c.convertToTspans,e),t="middle center"===p.title.position?function(e){var t=Math.sqrt(e.titleBox.width*e.titleBox.width+e.titleBox.height*e.titleBox.height);return{x:e.cx,y:e.cy,scale:e.trace.hole*e.r*2/t,tx:0,ty:-e.titleBox.height/2+e.trace.title.font.size}}(d):S(d,i),r.attr("transform","translate("+t.x+","+t.y+")"+(t.scale<1?"scale("+t.scale+")":"")+"translate("+t.tx+","+t.ty+")")})),x&&function(e,t){var r,n,a,i,o,l,s,c,u,f,d,p,g;function v(e,t){return e.pxmid[1]-t.pxmid[1]}function m(e,t){return t.pxmid[1]-e.pxmid[1]}function y(e,r){r||(r={});var a,c,u,d,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),g=n?e.yLabelMin:e.yLabelMax,v=n?e.yLabelMax:e.yLabelMin,m=e.cyFinal+o(e.px0[1],e.px1[1]),y=p-g;if(y*s>0&&(e.labelExtraY=y),Array.isArray(t.pull))for(c=0;c=(h.castOption(t.pull,u.pts)||0)||((e.pxmid[1]-u.pxmid[1])*s>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-g-e.labelExtraY)*s>0&&(e.labelExtraY+=y):(v+e.labelExtraY-m)*s>0&&(a=3*l*Math.abs(c-f.indexOf(e)),(d=u.cxFinal+i(u.px0[0],u.px1[0])+a-(e.cxFinal+e.pxmid[0])-e.labelExtraX)*l>0&&(e.labelExtraX+=d)))}for(n=0;n<2;n++)for(a=n?v:m,o=n?Math.max:Math.min,s=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,l=r?1:-1,(c=e[n][r]).sort(a),u=e[1-n][r],f=u.concat(c),p=[],d=0;dMath.abs(f)?l+="l"+f*e.pxmid[0]/e.pxmid[1]+","+f+"H"+(i+e.labelExtraX+c):l+="l"+e.labelExtraX+","+u+"v"+(f-u)+"h"+c}else l+="V"+(e.yLabelMid+e.labelExtraY)+"h"+c;s.ensureSingle(r,"path","textline").call(o.stroke,t.outsidetextfont.color).attr({"stroke-width":Math.min(2,t.outsidetextfont.size/8),d:l,fill:"none"})}else r.select("path.textline").remove()}))}(g,p),x&&p.automargin){var w=l.bBox(u.node()),T=p.domain,k=i.w*(T.x[1]-T.x[0]),M=i.h*(T.y[1]-T.y[0]),A=(.5*k-d.r)/i.w,C=(.5*M-d.r)/i.h;a.autoMargin(e,"pie."+p.uid+".automargin",{xl:T.x[0]-A,xr:T.x[1]+A,yb:T.y[0]-C,yt:T.y[1]+C,l:Math.max(d.cx-d.r-w.left,0),r:Math.max(w.right-(d.cx+d.r),0),b:Math.max(w.bottom-(d.cy+d.r),0),t:Math.max(d.cy-d.r-w.top,0),pad:5})}}))}));setTimeout((function(){u.selectAll("tspan").each((function(){var e=n.select(this);e.attr("dy")&&e.attr("dy",e.attr("dy"))}))}),0)},formatSliceLabel:z,transformInsideText:b,determineInsideTextFont:y,positionTitleOutside:S,prerenderTitles:x,layoutAreas:D,attachFxHandlers:m,computeTransform:E}},{"../../components/color":52,"../../components/drawing":74,"../../components/fx":92,"../../lib":179,"../../lib/svg_text_utils":200,"../../plots/plots":257,"../bar/constants":277,"../bar/uniform_text":291,"./event_data":357,"./helpers":358,d3:16}],363:[function(e,t,r){"use strict";var n=e("d3"),a=e("./style_one"),i=e("../bar/uniform_text").resizeText;t.exports=function(e){var t=e._fullLayout._pielayer.selectAll(".trace");i(e,t,"pie"),t.each((function(e){var t=e[0].trace,r=n.select(this);r.style({opacity:t.opacity}),r.selectAll("path.surface").each((function(e){n.select(this).call(a,e,t)}))}))}},{"../bar/uniform_text":291,"./style_one":364,d3:16}],364:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("./helpers").castOption;t.exports=function(e,t,r){var i=r.marker.line,o=a(i.color,t.pts)||n.defaultLine,l=a(i.width,t.pts)||0;e.style("stroke-width",l).call(n.fill,t.color).call(n.stroke,o)}},{"../../components/color":52,"./helpers":358}],365:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rl&&M[v].gap;)v--;for(y=M[v].s,h=M.length-1;h>v;h--)M[h].s=y;for(;lA[u]&&u=0;a--){var i=e[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],373:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("./attributes"),o=e("./constants"),l=e("./subtypes"),s=e("./xy_defaults"),c=e("./stack_defaults"),u=e("./marker_defaults"),f=e("./line_defaults"),d=e("./line_shape_defaults"),p=e("./text_defaults"),h=e("./fillcolor_defaults");t.exports=function(e,t,r,g){function v(r,a){return n.coerce(e,t,i,r,a)}var m=s(e,t,g,v);if(m||(t.visible=!1),t.visible){var y=c(e,t,g,v),x=!y&&mG!=(F=P[O][1])>=G&&(E=P[O-1][0],R=P[O][0],F-I&&(z=E+(R-E)*(G-I)/(F-I),j=Math.min(j,z),V=Math.max(V,z)));j=Math.max(j,0),V=Math.min(V,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(e,{distance:e.maxHoverDistance,x0:j,x1:V,y0:G,y1:G,color:Z,hovertemplate:!1}),delete e.index,f.text&&!Array.isArray(f.text)?e.text=String(f.text):e.text=f.name,[e]}}}},{"../../components/color":52,"../../components/fx":92,"../../lib":179,"../../registry":265,"./get_trace_color":376}],378:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:e("./attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("./cross_trace_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./cross_trace_calc"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot"),colorbar:e("./marker_colorbar"),formatLabels:e("./format_labels"),style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":236,"./arrays_to_calcdata":365,"./attributes":366,"./calc":367,"./cross_trace_calc":371,"./cross_trace_defaults":372,"./defaults":373,"./format_labels":375,"./hover":377,"./marker_colorbar":384,"./plot":386,"./select":387,"./style":389,"./subtypes":390}],379:[function(e,t,r){"use strict";var n=e("../../lib").isArrayOrTypedArray,a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l,s){var c=(e.marker||{}).color;(l("line.color",r),a(e,"line"))?i(e,t,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"../../lib":179}],380:[function(e,t,r){"use strict";var n=e("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=e("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=e("./constants");t.exports=function(e,t){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,T,k,M,A,L=t.xaxis,S=t.yaxis,C="log"===L.type,O="log"===S.type,D=L._length,P=S._length,z=t.connectGaps,E=t.baseTolerance,R=t.shape,I="linear"===R,F=t.fill&&"none"!==t.fill,N=[],H=f.minTolerance,B=e.length,j=new Array(B),V=0;function U(r){var n=e[r];if(!n)return!1;var i=t.linearized?L.l2p(n.x):L.c2p(n.x),s=t.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;O&&s===a&&(i*=Math.abs(L._m*P*(L._m>0?o:l)/(S._m*D*(S._m>0?o:l)))),i*=1e3}if(s===a){if(O&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function q(e,t,r,n){var a=r-e,i=n-t,o=.5-e,l=.5-t,s=a*a+i*i,c=a*o+i*l;if(c>0&&cre||e[1]ae)return[u(e[0],te,re),u(e[1],ne,ae)]}function le(e,t){return e[0]===t[0]&&(e[0]===te||e[0]===re)||(e[1]===t[1]&&(e[1]===ne||e[1]===ae)||void 0)}function se(e,t,r){return function(n,a){var i=oe(n),o=oe(a),l=[];if(i&&o&&le(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[e]+a[e])/2,t,r)-((i||n)[e]+(o||a)[e]);c&&((i&&o?c>0==i[e]>o[e]?i:o:i||o)[e]+=c);return l}}function ce(e){var t=e[0],r=e[1],n=t===j[V-1][0],a=r===j[V-1][1];if(!n||!a)if(V>1){var i=t===j[V-2][0],o=r===j[V-2][1];n&&(t===te||t===re)&&i?o?V--:j[V-1]=e:a&&(r===ne||r===ae)&&o?i?V--:j[V-1]=e:j[V++]=e}else j[V++]=e}function ue(e){j[V-1][0]!==e[0]&&j[V-1][1]!==e[1]&&ce([W,Q]),ce(e),J=null,W=Q=0}function fe(e){if(M=e[0]/D,A=e[1]/P,Y=e[0]re?re:0,X=e[1]ae?ae:0,Y||X){if(V)if(J){var t=K(J,e);t.length>1&&(ue(t[0]),j[V++]=t[1])}else $=K(j[V-1],e)[0],j[V++]=$;else j[V++]=[Y||e[0],X||e[1]];var r=j[V-1];Y&&X&&(r[0]!==Y||r[1]!==X)?(J&&(W!==Y&&Q!==X?ce(W&&Q?(n=J,i=(a=e)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?te:re,ae]:[o>0?re:te,ne]):[W||Y,Q||X]):W&&Q&&ce([W,Q])),ce([Y,X])):W-Y&&Q-X&&ce([Y||W,X||Q]),J=e,W=Y,Q=X}else J&&ue(K(J,e)[0]),j[V++]=e;var n,a,i,o}for("linear"===R||"spline"===R?K=function(e,t){for(var r=[],n=0,a=0;a<4;a++){var i=ie[a],o=c(e[0],e[1],t[0],t[1],i[0],i[1],i[2],i[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&&Z(o,e)G(h,de))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=e.length||!h)break;fe(h),n=h}}else fe(d)}J&&ce([W||J[0],Q||J[1]]),N.push(j.slice(0,V))}return N}},{"../../constants/numerical":158,"../../lib":179,"./constants":370}],381:[function(e,t,r){"use strict";t.exports=function(e,t,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],382:[function(e,t,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};t.exports=function(e,t,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(t,a):0}}},{"fast-isnumeric":18}],384:[function(e,t,r){"use strict";t.exports={container:"marker",min:"cmin",max:"cmax"}},{}],385:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults"),o=e("./subtypes");t.exports=function(e,t,r,l,s,c){var u=o.isBubble(e),f=(e.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(e,"marker")&&i(e,t,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&t.marker.color!==f?f:u?n.background:n.defaultLine),a(e,"marker.line")&&i(e,t,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"./subtypes":390}],386:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../registry"),i=e("../../lib"),o=i.ensureSingle,l=i.identity,s=e("../../components/drawing"),c=e("./subtypes"),u=e("./line_points"),f=e("./link_traces"),d=e("../../lib/polygon").tester;function p(e,t,r,f,p,h,g){var v;!function(e,t,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(e){return e.x>=u[0]&&e.x<=u[1]&&e.y>=f[0]&&e.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(e,r){var n=e[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(e){return m?e.transition():e}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(h),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),L=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(e,k,r,g),!0===_.visible){var S,C;y(T).style("opacity",_.opacity);var O=_.fill.charAt(_.fill.length-1);"x"!==O&&"y"!==O&&(O=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var D,P,z="",E=[],R=_._prevtrace;R&&(z=R._prevRevpath||"",C=R._nextFill,E=R._polygons);var I,F,N,H,B,j,V,U="",q="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(I=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):I=F="spline"===w.shape?function(e){var t=e[e.length-1];return e.length>1&&e[0][0]===t[0]&&e[0][1]===t[1]?s.smoothclosed(e.slice(1),w.smoothing):s.smoothopen(e,w.smoothing)}:function(e){return"M"+e.join("L")},N=function(e){return F(e.reverse())},G=u(f,{xaxis:x,yaxis:b,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),e)y(r.style("opacity",0).attr("d",D).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",D),s.singleLineStyle(f,a)}}}}}var Y=M.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(Z(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(Y,r.layerClipId,e),G.length?(S?(S.datum(f),H&&j&&(O?("y"===O?H[1]=j[1]=b.c2p(0,!0):"x"===O&&(H[0]=j[0]=x.c2p(0,!0)),y(S).attr("d","M"+j+"L"+H+"L"+U.substr(1)).call(s.singleFillStyle)):y(S).attr("d",U+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&U&&z?("tonext"===_.fill?y(C).attr("d",U+"Z"+z+"Z").call(s.singleFillStyle):y(C).attr("d",U+"L"+z.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(E)):(W(C),_._polygons=null)),_._prevRevpath=q,_._prevPolygons=V):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(t,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=ee(u),h=te,g=te;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===e._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?J:Q:_&&!w&&(v=$),f&&(h=v),d&&(g=v)}var T,k=(o=t.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&k.call(s.pointStyle,u,e).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=s.makePointStyleFns(u)),o.each((function(t){var a=n.select(this),i=y(a);s.translatePoint(t,i,x,b)?(s.singlePointStyle(t,i,u,T,e),r.layerClipId&&s.hideOutsideRangePoint(t,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==t.data&&void 0!==t.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(e){var t=n.select(this),a=y(t.select("text"));s.translatePoint(e,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(e,t,x,b,u.xcalendar,u.ycalendar):t.remove()})),o.selectAll("text").call(s.textPointStyle,u,e).each((function(e){var t=x.c2p(e.x),r=b.c2p(e.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:t,y:r})}))})),o.exit().remove()}(A,L,f);var X=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,X,e),s.setClipUrl(L,X,e)}function W(e){y(e).attr("d","M0,0Z")}function Q(e){return e.filter((function(e){return!e.gap&&e.vis}))}function J(e){return e.filter((function(e){return e.vis}))}function $(e){return e.filter((function(e){return!e.gap}))}function K(e){return e.id}function ee(e){if(e.ids)return K}function te(){return!1}}t.exports=function(e,t,r,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(e,t,r);((u=a.selectAll("g.trace").data(v,(function(e){return e[0].trace.uid}))).enter().append("g").attr("class",(function(e){return"trace scatter trace"+e[0].trace.uid})).style("stroke-miterlimit",2),u.order(),function(e,t,r){t.each((function(t){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,e);var i=t[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(e){i[e]=null})).remove(),u.order().each((function(e){i[e]=o(n.select(this),"path","js-fill")}))}))}(e,u,t),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(e,n,t,r,v,this,i)}))}))):u.each((function(r,n){p(e,n,t,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":74,"../../lib":179,"../../lib/polygon":191,"../../registry":265,"./line_points":380,"./link_traces":382,"./subtypes":390,d3:16}],387:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports=function(e,t){var r,a,i,o,l=e.cd,s=e.xaxis,c=e.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===t)for(r=0;r")),c.color=function(e,t){var r=e[t.dir].marker,n=r.color,i=r.line.color,o=r.line.width;if(a(n))return n;if(a(i)&&o)return i}(f,h),[c]}function w(e){return n(p,e)}}},{"../../components/color":52,"../../constants/delta.js":155,"../../plots/cartesian/axes":223,"../bar/hover":282}],400:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc"),plot:e("./plot"),style:e("./style").style,hoverPoints:e("./hover"),eventData:e("./event_data"),selectPoints:e("../bar/select"),moduleType:"trace",name:"waterfall",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":236,"../bar/select":287,"./attributes":393,"./calc":394,"./cross_trace_calc":396,"./defaults":397,"./event_data":398,"./hover":399,"./layout_attributes":401,"./layout_defaults":402,"./plot":403,"./style":404}],401:[function(e,t,r){"use strict";t.exports={waterfallmode:{valType:"enumerated",values:["group","overlay"],dflt:"group",editType:"calc"},waterfallgap:{valType:"number",min:0,max:1,editType:"calc"},waterfallgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],402:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){var i=!1;function o(r,i){return n.coerce(e,t,a,r,i)}for(var l=0;l0&&(v+=d?"M"+f[0]+","+h[1]+"V"+h[0]:"M"+f[1]+","+h[0]+"H"+f[0]),"between"!==p&&(r.isSum||l path").each((function(e){if(!e.isBlank){var t=l[e.dir].marker;n.select(this).call(i.fill,t.color).call(i.stroke,t.line.color).call(a.dashLine,t.line.dash,t.line.width).style("opacity",l.selectedpoints&&!e.selected?o:1)}})),c(r,l,e),r.selectAll(".lines").each((function(){var e=l.connector.line;a.lineGroupStyle(n.select(this).selectAll("path"),e.width,e.color,e.dash)}))}))}}},{"../../components/color":52,"../../components/drawing":74,"../../constants/interactions":157,"../bar/style":289,"../bar/uniform_text":291,d3:16}],405:[function(e,t,r){"use strict";r.version="1.55.2"},{}]},{},[8])(8)})); \ No newline at end of file +var n,a=e("./lib/build-log"),i=e("./lib/epsilon"),o=e("./lib/intersecter"),l=e("./lib/segment-chainer"),s=e("./lib/segment-selector"),c=e("./lib/geojson"),u=!1,f=i();function d(e,t,r){var a=n.segments(e),i=n.segments(t),o=r(n.combine(a,i));return n.polygon(o)}n={buildLog:function(e){return!0===e?u=a():!1===e&&(u=!1),!1!==u&&u.list},epsilon:function(e){return f.epsilon(e)},segments:function(e){var t=o(!0,f,u);return e.regions.forEach(t.addRegion),{segments:t.calculate(e.inverted),inverted:e.inverted}},combine:function(e,t){return{combined:o(!1,f,u).calculate(e.segments,e.inverted,t.segments,t.inverted),inverted1:e.inverted,inverted2:t.inverted}},selectUnion:function(e){return{segments:s.union(e.combined,u),inverted:e.inverted1||e.inverted2}},selectIntersect:function(e){return{segments:s.intersect(e.combined,u),inverted:e.inverted1&&e.inverted2}},selectDifference:function(e){return{segments:s.difference(e.combined,u),inverted:e.inverted1&&!e.inverted2}},selectDifferenceRev:function(e){return{segments:s.differenceRev(e.combined,u),inverted:!e.inverted1&&e.inverted2}},selectXor:function(e){return{segments:s.xor(e.combined,u),inverted:e.inverted1!==e.inverted2}},polygon:function(e){return{regions:l(e.segments,f,u),inverted:e.inverted}},polygonFromGeoJSON:function(e){return c.toPolygon(n,e)},polygonToGeoJSON:function(e){return c.fromPolygon(n,f,e)},union:function(e,t){return d(e,t,n.selectUnion)},intersect:function(e,t){return d(e,t,n.selectIntersect)},difference:function(e,t){return d(e,t,n.selectDifference)},differenceRev:function(e,t){return d(e,t,n.selectDifferenceRev)},xor:function(e,t){return d(e,t,n.selectXor)}},"object"==typeof window&&(window.PolyBool=n),t.exports=n},{"./lib/build-log":56,"./lib/epsilon":57,"./lib/geojson":58,"./lib/intersecter":59,"./lib/segment-chainer":61,"./lib/segment-selector":62}],56:[function(e,t,r){t.exports=function(){var e,t=0,r=!1;function n(t,r){return e.list.push({type:t,data:r?JSON.parse(JSON.stringify(r)):void 0}),e}return e={list:[],segmentId:function(){return t++},checkIntersection:function(e,t){return n("check",{seg1:e,seg2:t})},segmentChop:function(e,t){return n("div_seg",{seg:e,pt:t}),n("chop",{seg:e,pt:t})},statusRemove:function(e){return n("pop_seg",{seg:e})},segmentUpdate:function(e){return n("seg_update",{seg:e})},segmentNew:function(e,t){return n("new_seg",{seg:e,primary:t})},segmentRemove:function(e){return n("rem_seg",{seg:e})},tempStatus:function(e,t,r){return n("temp_status",{seg:e,above:t,below:r})},rewind:function(e){return n("rewind",{seg:e})},status:function(e,t,r){return n("status",{seg:e,above:t,below:r})},vert:function(t){return t===r?e:(r=t,n("vert",{x:t}))},log:function(e){return"string"!=typeof e&&(e=JSON.stringify(e,!1," ")),n("log",{txt:e})},reset:function(){return n("reset")},selected:function(e){return n("selected",{segs:e})},chainStart:function(e){return n("chain_start",{seg:e})},chainRemoveHead:function(e,t){return n("chain_rem_head",{index:e,pt:t})},chainRemoveTail:function(e,t){return n("chain_rem_tail",{index:e,pt:t})},chainNew:function(e,t){return n("chain_new",{pt1:e,pt2:t})},chainMatch:function(e){return n("chain_match",{index:e})},chainClose:function(e){return n("chain_close",{index:e})},chainAddHead:function(e,t){return n("chain_add_head",{index:e,pt:t})},chainAddTail:function(e,t){return n("chain_add_tail",{index:e,pt:t})},chainConnect:function(e,t){return n("chain_con",{index1:e,index2:t})},chainReverse:function(e){return n("chain_rev",{index:e})},chainJoin:function(e,t){return n("chain_join",{index1:e,index2:t})},done:function(){return n("done")}}}},{}],57:[function(e,t,r){t.exports=function(e){"number"!=typeof e&&(e=1e-10);var t={epsilon:function(t){return"number"==typeof t&&(e=t),e},pointAboveOrOnLine:function(t,r,n){var a=r[0],i=r[1],o=n[0],l=n[1],s=t[0];return(o-a)*(t[1]-i)-(l-i)*(s-a)>=-e},pointBetween:function(t,r,n){var a=t[1]-r[1],i=n[0]-r[0],o=t[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-e)},pointsSameX:function(t,r){return Math.abs(t[0]-r[0])e!=o-a>e&&(i-c)*(a-u)/(o-u)+c-n>e&&(l=!l),i=c,o=u}return l}};return t}},{}],58:[function(e,t,r){var n={toPolygon:function(e,t){function r(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function r(t){var r=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[r]})}for(var n=r(t[0]),a=1;a0}))}function u(e,n){var a=e.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=t.linesIntersect(o,l,c,u);if(!1===f){if(!t.pointsCollinear(o,l,c))return!1;if(t.pointsSame(o,u)||t.pointsSame(l,c))return!1;var d=t.pointsSame(o,c),p=t.pointsSame(l,u);if(d&&p)return n;var h=!d&&t.pointBetween(o,c,u),g=!p&&t.pointBetween(l,c,u);if(d)return g?s(n,l):s(e,u),n;h&&(p||(g?s(n,l):s(e,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(e,c):0===f.alongB?s(e,f.pt):1===f.alongB&&s(e,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var e=u(d,h);if(e)return e}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(e)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(e)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return e?{addRegion:function(e){for(var n,a,i,o=e[e.length-1],s=0;s1)for(var r=1;r1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=O(e,360),t=O(t,100),r=O(r,100),0===t)n=a=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,s=2*r-l;n=o(s,l,e+1/3),a=o(s,l,e),i=o(s,l,e-1/3)}return{r:255*n,g:255*a,b:255*i}}(t.h,s,u),f=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,h,g;return i=C(i),{ok:f,format:t.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(e,t,r){e=O(e,255),t=O(t,255),r=O(r,255);var n,a,i=l(e,t,r),s=o(e,t,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case e:n=(t-r)/u+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/t;t--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.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 e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,n,a=this.toRgb();return t=a.r/255,r=a.g/255,n=a.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[z(i(e).toString(16)),z(i(t).toString(16)),z(i(r).toString(16)),z(E(n))];if(a&&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,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=c(e);r="#"+p(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));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(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:R(e[n]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),a=c(t).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(t,r){var n=c(t),a=c(r);return(e.max(n.getLuminance(),a.getLuminance())+.05)/(e.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,a,i=c.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(e,t,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(t[u]));return c.isReadable(e,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],r))};var L=c.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=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(L);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function O(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,l(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function D(e){return o(1,l(0,e))}function P(e){return parseInt(e,16)}function z(e){return 1==e.length?"0"+e:""+e}function R(e){return e<=1&&(e=100*e+"%"),e}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(e){return P(e)/255}var F,N,H,B=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",H="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+H),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+H),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+H),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 j(e){return!!B.CSS_UNIT.exec(e)}"undefined"!=typeof t&&t.exports?t.exports=c:window.tinycolor=c}(Math)},{}],65:[function(e,t,r){"use strict";t.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}]},{}],66:[function(e,t,r){"use strict";var n=e("./arrow_paths"),a=e("../../plots/font_attributes"),i=e("../../plots/cartesian/constants"),o=e("../../plot_api/plot_template").templatedArray;e("../../constants/axis_placeable_objects");t.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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../constants/axis_placeable_objects":184,"../../plot_api/plot_template":243,"../../plots/cartesian/constants":260,"../../plots/font_attributes":282,"./arrow_paths":65}],67:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("./draw").draw;function o(e){var t=e._fullLayout;n.filterVisible(t.annotations).forEach((function(t){var r=a.getFromId(e,t.xref),n=a.getFromId(e,t.yref),i=a.getRefType(t.xref),o=a.getRefType(t.yref);t._extremes={},"range"===i&&l(t,r),"range"===o&&l(t,n)}))}function l(e,t){var r,n=t._id,i=n.charAt(0),o=e[i],l=e["a"+i],s=e[i+"ref"],c=e["a"+i+"ref"],u=e["_"+i+"padplus"],f=e["_"+i+"padminus"],d={x:1,y:-1}[i]*e[i+"shift"],p=3*e.arrowsize*e.arrowwidth||0,h=p+d,g=p-d,v=3*e.startarrowsize*e.arrowwidth||0,m=v+d,y=v-d;if(c===s){var x=a.findExtremes(t,[t.r2c(o)],{ppadplus:h,ppadminus:g}),b=a.findExtremes(t,[t.r2c(l)],{ppadplus:Math.max(u,m),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else m=l?m+l:m,y=l?y-l:y,r=a.findExtremes(t,[t.r2c(o)],{ppadplus:Math.max(u,h,m),ppadminus:Math.max(f,g,y)});e._extremes[n]=r}t.exports=function(e){var t=e._fullLayout;if(n.filterVisible(t.annotations).length&&e._fullData.length)return n.syncOrAsync([i,o],e)}},{"../../lib":209,"../../plots/cartesian/axes":254,"./draw":72}],68:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("../../plot_api/plot_template").arrayEditor;function o(e,t){var r,n,a,i,o,s,c,u=e._fullLayout.annotations,f=[],d=[],p=[],h=(t||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(e,t){var r,l,s=o(e,t),c=s.on,u=s.off.concat(s.explicitOff),f={},d=e._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[t]}for(var Y=!1,X=["x","y"],W=0;W1)&&(ne===re?((pe=ae.r2fraction(t["a"+te]))<0||pe>1)&&(Y=!0):Y=!0),Q=ae._offset+ae.r2p(t[te]),K=.5}else{var he="domain"===de;"x"===te?($=t[te],Q=he?ae._offset+ae._length*$:Q=T.l+T.w*$):($=1-t[te],Q=he?ae._offset+ae._length*$:Q=T.t+T.h*$),K=t.showarrow?.5:$}if(t.showarrow){fe.head=Q;var ge=t["a"+te];if(ee=oe*q(.5,t.xanchor)-le*q(.5,t.yanchor),ne===re){var ve=s.getRefType(ne);"domain"===ve?("y"===te&&(ge=1-ge),fe.tail=ae._offset+ae._length*ge):"paper"===ve?"y"===te?(ge=1-ge,fe.tail=T.t+T.h*ge):fe.tail=T.l+T.w*ge:fe.tail=ae._offset+ae.r2p(ge),J=ee}else fe.tail=Q+ge,J=ee+ge;fe.text=fe.tail+ee;var me=w["x"===te?"width":"height"];if("paper"===re&&(fe.head=o.constrain(fe.head,1,me-1)),"pixel"===ne){var ye=-Math.max(fe.tail-3,fe.text),xe=Math.min(fe.tail+3,fe.text)-me;ye>0?(fe.tail+=ye,fe.text+=ye):xe>0&&(fe.tail-=xe,fe.text-=xe)}fe.tail+=ue,fe.head+=ue}else J=ee=se*q(K,ce),fe.text=Q+ee;fe.text+=ue,ee+=ue,J+=ue,t["_"+te+"padplus"]=se/2+J,t["_"+te+"padminus"]=se/2-J,t["_"+te+"size"]=se,t["_"+te+"shift"]=ee}if(Y)I.remove();else{var be=0,_e=0;if("left"!==t.align&&(be=(M-b)*("center"===t.align?.5:1)),"top"!==t.valign&&(_e=(E-_)*("middle"===t.valign?.5:1)),f)n.select("svg").attr({x:H+be-1,y:H+_e}).call(u.setClipUrl,j?C:null,e);else{var we=H+_e-g.top,Te=H+be-g.left;G.call(d.positionText,Te,we).call(u.setClipUrl,j?C:null,e)}V.select("rect").call(u.setRect,H,H,M,E),B.call(u.setRect,F/2,F/2,N-F,U-F),I.call(u.setTranslate,Math.round(O.x.text-N/2),Math.round(O.y.text-U/2)),z.attr({transform:"rotate("+D+","+O.x.text+","+O.y.text+")"});var ke,Me=function(r,n){P.selectAll(".annotation-arrow-g").remove();var s=O.x.head,f=O.y.head,d=O.x.tail+r,p=O.y.tail+n,g=O.x.text+r,b=O.y.text+n,_=o.rotationXYMatrix(D,g,b),w=o.apply2DTransform(_),M=o.apply2DTransform2(_),C=+B.attr("width"),R=+B.attr("height"),E=g-.5*C,F=E+C,N=b-.5*R,H=N+R,j=[[E,N,E,H],[E,H,F,H],[F,H,F,N],[F,N,E,N]].map(M);if(!j.reduce((function(e,t){return e^!!o.segmentsIntersect(s,f,s+1e6,f+1e6,t[0],t[1],t[2],t[3])}),!1)){j.forEach((function(e){var t=o.segmentsIntersect(d,p,s,f,e[0],e[1],e[2],e[3]);t&&(d=t.x,p=t.y)}));var V=t.arrowwidth,U=t.arrowcolor,q=t.arrowside,G=P.append("g").style({opacity:c.opacity(U)}).classed("annotation-arrow-g",!0),Z=G.append("path").attr("d","M"+d+","+p+"L"+s+","+f).style("stroke-width",V+"px").call(c.stroke,c.rgb(U));if(v(Z,q,t),k.annotationPosition&&Z.node().parentNode&&!i){var Y=s,X=f;if(t.standoff){var W=Math.sqrt(Math.pow(s-d,2)+Math.pow(f-p,2));Y+=t.standoff*(d-s)/W,X+=t.standoff*(p-f)/W}var Q,J,$=G.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-Y)+","+(p-X),transform:l(Y,X)}).style("stroke-width",V+6+"px").call(c.stroke,"rgba(0,0,0,0)").call(c.fill,"rgba(0,0,0,0)");h.init({element:$.node(),gd:e,prepFn:function(){var e=u.getTranslate(I);Q=e.x,J=e.y,m&&m.autorange&&A(m._name+".autorange",!0),x&&x.autorange&&A(x._name+".autorange",!0)},moveFn:function(e,r){var n=w(Q,J),a=n[0]+e,i=n[1]+r;I.call(u.setTranslate,a,i),L("x",y(m,e,"x",T,t)),L("y",y(x,r,"y",T,t)),t.axref===t.xref&&L("ax",y(m,e,"ax",T,t)),t.ayref===t.yref&&L("ay",y(x,r,"ay",T,t)),G.attr("transform",l(e,r)),z.attr({transform:"rotate("+D+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",e,S());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}};if(t.showarrow&&Me(0,0),R)h.init({element:I.node(),gd:e,prepFn:function(){ke=z.attr("transform")},moveFn:function(e,r){var n="pointer";if(t.showarrow)t.axref===t.xref?L("ax",y(m,e,"ax",T,t)):L("ax",t.ax+e),t.ayref===t.yref?L("ay",y(x,r,"ay",T.w,t)):L("ay",t.ay+r),Me(e,r);else{if(i)return;var a,o;if(m)a=y(m,e,"x",T,t);else{var s=t._xsize/T.w,c=t.x+(t._xshift-t.xshift)/T.w-s/2;a=h.align(c+e/T.w,s,0,1,t.xanchor)}if(x)o=y(x,r,"y",T,t);else{var u=t._ysize/T.h,f=t.y-(t._yshift+t.yshift)/T.h-u/2;o=h.align(f-r/T.h,u,0,1,t.yanchor)}L("x",a),L("y",o),m&&x||(n=h.getCursor(m?.5:a,x?.5:o,t.xanchor,t.yanchor))}z.attr({transform:l(e,r)+ke}),p(I,n)},clickFn:function(r,n){t.captureevents&&e.emit("plotly_clickannotation",Z(n))},doneFn:function(){p(I),a.call("_guiRelayout",e,S());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}}t.exports={draw:function(e){var t=e._fullLayout;t._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,x=t.indexOf("end")>=0,b=h.backoff*v+r.standoff,_=g.backoff*m+r.startstandoff;if("line"===p.nodeName){o={x:+e.attr("x1"),y:+e.attr("y1")},u={x:+e.attr("x2"),y:+e.attr("y2")};var w=o.x-u.x,T=o.y-u.y;if(d=(f=Math.atan2(T,w))+Math.PI,b&&_&&b+_>Math.sqrt(w*w+T*T))return void R();if(b){if(b*b>w*w+T*T)return void R();var k=b*Math.cos(f),M=b*Math.sin(f);u.x+=k,u.y+=M,e.attr({x2:u.x,y2:u.y})}if(_){if(_*_>w*w+T*T)return void R();var A=_*Math.cos(f),L=_*Math.sin(f);o.x-=A,o.y-=L,e.attr({x1:o.x,y1:o.y})}}else if("path"===p.nodeName){var S=p.getTotalLength(),C="";if(S1){c=!0;break}}c?e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove():(s._pdata=a(e.glplot.cameraParams,[t.xaxis.r2l(s.x)*r[0],t.yaxis.r2l(s.y)*r[1],t.zaxis.r2l(s.z)*r[2]]),n(e.graphDiv,s,l,e.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":285,"../annotations/draw":72}],79:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:e("./attributes")}}},layoutAttributes:e("./attributes"),handleDefaults:e("./defaults"),includeBasePlot:function(e,t){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var i=r.attrRegex,o=Object.keys(e),l=0;l=0))return e;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return e}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(e){var t=e.toRgb();return"rgb("+Math.round(t.r)+", "+Math.round(t.g)+", "+Math.round(t.b)+")"},i.rgb=function(e){return i.tinyRGB(n(e))},i.opacity=function(e){return e?n(e).getAlpha():0},i.addOpacity=function(e,t){var r=n(e).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+t+")"},i.combine=function(e,t){var r=n(e).toRgb();if(1===r.a)return n(e).toRgbString();var a=n(t||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(e,t,r){var a=n(e);return 1!==a.getAlpha()&&(a=n(i.combine(e,s))),(a.isDark()?t?a.lighten(t):s:r?a.darken(r):l).toString()},i.stroke=function(e,t){var r=n(t);e.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(e,t){var r=n(t);e.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(e){if(e&&"object"==typeof e){var t,r,n,a,o=Object.keys(e);for(t=0;t0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var Q=Math.pow(10,Math.floor(Math.log(W)/Math.LN10));Y*=Q*c.roundUp(W/Q,[2,5,10]),(Math.abs(O.start)/O.size+1e-6)%1<2e-6&&(Z.tick0=0)}Z.dtick=Y}Z.domain=[U+B,U+F-B],Z.setScale(),e.attr("transform",u(Math.round(s.l),Math.round(s.t)));var J,$=e.select("."+M.cbtitleunshift).attr("transform",u(-Math.round(s.l),-Math.round(s.t))),K=e.select("."+M.cbaxis),ee=0;function te(n,a){var i={propContainer:Z,propName:t._propPrefix+"title",traceIndex:t._traceIndex,_meta:t._meta,placeholder:o._dfltTitle.colorbar,containerGroup:e.select("."+M.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;e.selectAll("."+l+",."+l+"-math-group").remove(),g.draw(r,n,f(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(A)){var e,r=s.l+(t.x+N)*s.w,n=Z.title.font.size;e="top"===A?(1-(U+F-B))*s.h+s.t+3+.75*n:(1-(U+B))*s.h+s.t-3-.25*n,te(Z._id+"title",{attributes:{x:r,y:e,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(A)){var i=e.select("."+M.cbtitle),o=i.select("text"),f=[-t.outlinewidth/2,t.outlinewidth/2],d=i.select(".h"+Z._id+"title-math-group").node(),h=15.6;if(o.node()&&(h=parseInt(o.node().style.fontSize,10)*w),d?(ee=p.bBox(d).height)>h&&(f[1]-=(ee-h)/2):o.node()&&!o.classed(M.jsPlaceholder)&&(ee=p.bBox(o.node()).height),ee){if(ee+=5,"top"===A)Z.domain[1]-=ee/s.h,f[1]*=-1;else{Z.domain[0]+=ee/s.h;var g=v.lineCount(o);f[1]+=(1-g)*h}i.attr("transform",u(f[0],f[1])),Z.setScale()}}e.selectAll("."+M.cbfills+",."+M.cblines).attr("transform",u(0,Math.round(s.h*(1-Z.domain[1])))),K.attr("transform",u(0,Math.round(-s.t)));var y=e.select("."+M.cbfills).selectAll("rect."+M.cbfill).attr("style","").data(P);y.enter().append("rect").classed(M.cbfill,!0).style("stroke","none"),y.exit().remove();var x=L.map(Z.c2p).map(Math.round).sort((function(e,t){return e-t}));y.each((function(e,i){var o=[0===i?L[0]:(P[i]+P[i-1])/2,i===P.length-1?L[1]:(P[i]+P[i+1])/2].map(Z.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,x[0],x[1]);var l=n.select(this).attr({x:j,width:Math.max(R,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(t._fillgradient)p.gradient(l,r,t._id,"vertical",t._fillgradient,"fill");else{var s=C(e).replace("e-","");l.attr("fill",a(s).toHexString())}}));var b=e.select("."+M.cblines).selectAll("path."+M.cbline).data(m.color&&m.width?z:[]);b.enter().append("path").classed(M.cbline,!0),b.exit().remove(),b.each((function(e){n.select(this).attr("d","M"+j+","+(Math.round(Z.c2p(e))+m.width/2%1)+"h"+R).call(p.lineGroupStyle,m.width,S(e),m.dash)})),K.selectAll("g."+Z._id+"tick,path").remove();var _=j+R+(t.outlinewidth||0)/2-("outside"===t.ticks?1:0),T=l.calcTicks(Z),k=l.getTickSigns(Z)[2];return l.drawTicks(r,Z,{vals:"inside"===Z.ticks?l.clipEnds(Z,T):T,layer:K,path:l.makeTickPath(Z,_,k),transFn:l.makeTransTickFn(Z)}),l.drawLabels(r,Z,{vals:T,layer:K,transFn:l.makeTransTickLabelFn(Z),labelFns:l.makeLabelFns(Z,_)})},function(){if(-1===["top","bottom"].indexOf(A)){var e=Z.title.font.size,t=Z._offset+Z._length/2,a=s.l+(Z.position||0)*s.w+("right"===Z.side?10+e*(Z.showticklabels?1:.5):-10-e*(Z.showticklabels?.5:0));te("h"+Z._id+"title",{avoid:{selection:n.select(r).selectAll("g."+Z._id+"tick"),side:A,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:t,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=R+t.outlinewidth/2;if(-1===Z.ticklabelposition.indexOf("inside")&&(n+=p.bBox(K.node()).width),(J=$.select("text")).node()&&!J.classed(M.jsPlaceholder)){var a,o=$.select(".h"+Z._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(A)?p.bBox(o).width:p.bBox($.node()).right-j-s.l,n=Math.max(n,a)}var l=2*t.xpad+n+t.borderwidth+t.outlinewidth/2,c=q-G;e.select("."+M.cbbg).attr({x:j-t.xpad-(t.borderwidth+t.outlinewidth)/2,y:G-H,width:Math.max(l,2),height:Math.max(c+2*H,2)}).call(h.fill,t.bgcolor).call(h.stroke,t.bordercolor).style("stroke-width",t.borderwidth),e.selectAll("."+M.cboutline).attr({x:j,y:G+t.ypad+("top"===A?ee:0),width:Math.max(R,2),height:Math.max(c-2*t.ypad-ee,2)}).call(h.stroke,t.outlinecolor).style({fill:"none","stroke-width":t.outlinewidth});var f=({center:.5,right:1}[t.xanchor]||0)*l;e.attr("transform",u(s.l-f,s.t));var d={},g=T[t.yanchor],v=k[t.yanchor];"pixels"===t.lenmode?(d.y=t.y,d.t=c*g,d.b=c*v):(d.t=d.b=0,d.yt=t.y+t.len*g,d.yb=t.y-t.len*v);var m=T[t.xanchor],y=k[t.xanchor];if("pixels"===t.thicknessmode)d.x=t.x,d.l=l*m,d.r=l*y;else{var x=l-R;d.l=x*m,d.r=x*y,d.xl=t.x-t.thickness*m,d.xr=t.x+t.thickness*y}i.autoMargin(r,t._id,d)}],r)}(r,t,e);m&&m.then&&(e._promises||[]).push(m),e._context.edits.colorbarPosition&&function(e,t,r){var n,a,i,l=r._fullLayout._size;s.init({element:e.node(),gd:r,prepFn:function(){n=e.attr("transform"),d(e)},moveFn:function(r,o){e.attr("transform",n+u(r,o)),a=s.align(t._xLeftFrac+r/l.w,t._thickFrac,0,1,t.xanchor),i=s.align(t._yBottomFrac-o/l.h,t._lenFrac,0,1,t.yanchor);var c=s.getCursor(a,i,t.xanchor,t.yanchor);d(e,c)},doneFn:function(){if(d(e),void 0!==a&&void 0!==i){var n={};n[t._propPrefix+"x"]=a,n[t._propPrefix+"y"]=i,void 0!==t._traceIndex?o.call("_guiRestyle",r,n,t._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,t,e)})),t.exit().each((function(t){i.autoMargin(e,t._id)})).remove(),t.order()}}},{"../../constants/alignment":183,"../../lib":209,"../../lib/extend":203,"../../lib/setcursor":228,"../../lib/svg_text_utils":230,"../../plots/cartesian/axes":254,"../../plots/cartesian/axis_defaults":256,"../../plots/cartesian/layout_attributes":268,"../../plots/cartesian/position_defaults":271,"../../plots/plots":288,"../../registry":296,"../color":81,"../colorscale/helpers":92,"../dragelement":100,"../drawing":103,"../titles":176,"./constants":83,d3:16,tinycolor2:64}],86:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e){return n.isPlainObject(e.colorbar)}},{"../../lib":209}],87:[function(e,t,r){"use strict";t.exports={moduleType:"component",name:"colorbar",attributes:e("./attributes"),supplyDefaults:e("./defaults"),draw:e("./draw").draw,hasColorbar:e("./has_colorbar")}},{"./attributes":82,"./defaults":84,"./draw":85,"./has_colorbar":86}],88:[function(e,t,r){"use strict";var n=e("../colorbar/attributes"),a=e("../../lib/regex").counter,i=e("./scales.js").scales;Object.keys(i);function o(e){return"`"+e+"`"}t.exports=function(e,t){e=e||"";var r,l=(t=t||{}).cLetter||"c",s=("onlyIfNumerical"in t?t.onlyIfNumerical:Boolean(e),"noScale"in t?t.noScale:"marker.line"===e),c="showScaleDflt"in t?t.showScaleDflt:"z"===l,u="string"==typeof t.colorscaleDflt?i[t.colorscaleDflt]:null,f=t.editTypeOverride||"",d=e?e+".":"";"colorAttr"in t?(r=t.colorAttr,t.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},t.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==t.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),t.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":224,"../colorbar/attributes":82,"./scales.js":96}],89:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("./helpers").extractOpts;t.exports=function(e,t,r){var o,l=e._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(t,c).get():t,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":209,"./helpers":92,"fast-isnumeric":18}],90:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./helpers").hasColorscale,i=e("./helpers").extractOpts;t.exports=function(e,t){function r(e,t){var r=e["_"+t];void 0!==r&&(e[t]=r)}function o(e,a){var o=a.container?n.nestedProperty(e,a.container).get():e;if(o)if(o.coloraxis)o._colorAx=t[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=e[n];r[a]=[1-i[0],i[1]]}return r}function h(e,t){t=t||{};for(var r=e.domain,o=e.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],98:[function(e,t,r){"use strict";var n=e("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];t.exports=function(e,t,r,i){return e="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*e),0,2),t="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*t),0,2),a[t][e]}},{"../../lib":209}],99:[function(e,t,r){"use strict";r.selectMode=function(e){return"lasso"===e||"select"===e},r.drawMode=function(e){return"drawclosedpath"===e||"drawopenpath"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.openMode=function(e){return"drawline"===e||"drawopenpath"===e},r.rectMode=function(e){return"select"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.freeMode=function(e){return"lasso"===e||"drawclosedpath"===e||"drawopenpath"===e},r.selectingOrDrawing=function(e){return r.freeMode(e)||r.rectMode(e)}},{}],100:[function(e,t,r){"use strict";var n=e("mouse-event-offset"),a=e("has-hover"),i=e("has-passive-events"),o=e("../../lib").removeElement,l=e("../../plots/cartesian/constants"),s=t.exports={};s.align=e("./align"),s.getCursor=e("./cursor");var c=e("./unhover");function u(){var e=document.createElement("div");e.className="dragcover";var t=e.style;return t.position="fixed",t.left=0,t.right=0,t.top=0,t.bottom=0,t.zIndex=999999999,t.background="none",document.body.appendChild(e),e}function f(e){return n(e.changedTouches?e.changedTouches[0]:e,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(e){var t,r,n,c,d,p,h,g,v=e.gd,m=1,y=v._context.doubleClickDelay,x=e.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=e.clampFn||function(e,t,r){return Math.abs(e)y&&(m=Math.max(m-1,1)),v._dragged)e.doneFn&&e.doneFn();else if(e.clickFn&&e.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",t)}catch(e){var n=f(t);(r=document.createEvent("MouseEvents")).initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,n[0],n[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":209,"../../plots/cartesian/constants":260,"./align":97,"./cursor":98,"./unhover":101,"has-hover":49,"has-passive-events":50,"mouse-event-offset":53}],101:[function(e,t,r){"use strict";var n=e("../../lib/events"),a=e("../../lib/throttle"),i=e("../../lib/dom").getGraphDiv,o=e("../fx/constants"),l=t.exports={};l.wrapped=function(e,t,r){(e=i(e))._fullLayout&&a.clear(e._fullLayout._uid+o.HOVERID),l.raw(e,t,r)},l.raw=function(e,t){var r=e._fullLayout,a=e._hoverdata;t||(t={}),t.target&&!1===n.triggerHandler(e,"plotly_beforehover",t)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,t.target&&a&&e.emit("plotly_unhover",{event:t,points:a}))}},{"../../lib/dom":201,"../../lib/events":202,"../../lib/throttle":231,"../fx/constants":115}],102:[function(e,t,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],103:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("tinycolor2"),o=e("../../registry"),l=e("../color"),s=e("../colorscale"),c=e("../../lib"),u=c.strTranslate,f=e("../../lib/svg_text_utils"),d=e("../../constants/xmlns_namespaces"),p=e("../../constants/alignment").LINE_SPACING,h=e("../../constants/interactions").DESELECTDIM,g=e("../../traces/scatter/subtypes"),v=e("../../traces/scatter/make_bubble_size_func"),m=e("../../components/fx/helpers").appendArrayPointValue,y=t.exports={};y.font=function(e,t,r,n){c.isPlainObject(t)&&(n=t.color,r=t.size,t=t.family),t&&e.style("font-family",t),r+1&&e.style("font-size",r+"px"),n&&e.call(l.fill,n)},y.setPosition=function(e,t,r){e.attr("x",t).attr("y",r)},y.setSize=function(e,t,r){e.attr("width",t).attr("height",r)},y.setRect=function(e,t,r,n,a){e.call(y.setPosition,t,r).call(y.setSize,n,a)},y.translatePoint=function(e,t,r,n){var i=r.c2p(e.x),o=n.c2p(e.y);return!!(a(i)&&a(o)&&t.node())&&("text"===t.node().nodeName?t.attr("x",i).attr("y",o):t.attr("transform",u(i,o)),!0)},y.translatePoints=function(e,t,r){e.each((function(e){var a=n.select(this);y.translatePoint(e,a,t,r)}))},y.hideOutsideRangePoint=function(e,t,r,n,a,i){t.attr("display",r.isPtWithinRange(e,a)&&n.isPtWithinRange(e,i)?null:"none")},y.hideOutsideRangePoints=function(e,t){if(t._hasClipOnAxisFalse){var r=t.xaxis,a=t.yaxis;e.each((function(t){var i=t[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";e.selectAll(c).each((function(e){y.hideOutsideRangePoint(e,n.select(this),r,a,l,s)}))}))}},y.crispRound=function(e,t,r){return t&&a(t)?e._context.staticPlot?t:t<1?1:Math.round(t):r||0},y.singleLineStyle=function(e,t,r,n,a){t.style("fill","none");var i=(((e||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(t,n||i.color),y.dashLine(t,s,o)},y.lineGroupStyle=function(e,t,r,a){e.style("fill","none").each((function(e){var i=(((e||[])[0]||{}).trace||{}).line||{},o=t||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(y.dashLine,s,o)}))},y.dashLine=function(e,t,r){r=+r||0,t=y.dashStyle(t,r),e.style({"stroke-dasharray":t,"stroke-width":r+"px"})},y.dashStyle=function(e,t){t=+t||1;var r=Math.max(t,3);return"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),e},y.singleFillStyle=function(e){var t=(((n.select(e.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;t&&e.call(l.fill,t)},y.fillGroupStyle=function(e){e.style("stroke-width",0).each((function(e){var t=n.select(this);e[0].trace&&t.call(l.fill,e[0].trace.fillcolor)}))};var x=e("./symbol_defs");y.symbolNames=[],y.symbolFuncs=[],y.symbolNeedLines={},y.symbolNoDot={},y.symbolNoFill={},y.symbolList=[],Object.keys(x).forEach((function(e){var t=x[e],r=t.n;y.symbolList.push(r,String(r),e,r+100,String(r+100),e+"-open"),y.symbolNames[r]=e,y.symbolFuncs[r]=t.f,t.needLine&&(y.symbolNeedLines[r]=!0),t.noDot?y.symbolNoDot[r]=!0:y.symbolList.push(r+200,String(r+200),e+"-dot",r+300,String(r+300),e+"-open-dot"),t.noFill&&(y.symbolNoFill[r]=!0)}));var b=y.symbolNames.length;function _(e,t){var r=e%100;return y.symbolFuncs[r](t)+(e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}y.symbolNumber=function(e){if(a(e))e=+e;else if("string"==typeof e){var t=0;e.indexOf("-open")>0&&(t=100,e=e.replace("-open","")),e.indexOf("-dot")>0&&(t+=200,e=e.replace("-dot","")),(e=y.symbolNames.indexOf(e))>=0&&(e+=t)}return e%100>=b||e>=400?0:Math.floor(Math.max(e,0))};var w={x1:1,x2:0,y1:0,y2:0},T={x1:0,x2:0,y1:1,y2:0},k=n.format("~.1f"),M={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:w},horizontalreversed:{node:"linearGradient",attrs:w,reversed:!0},vertical:{node:"linearGradient",attrs:T},verticalreversed:{node:"linearGradient",attrs:T,reversed:!0}};y.gradient=function(e,t,r,a,o,s){for(var u=o.length,f=M[a],d=new Array(u),p=0;p"+m(e);h._gradientUrlQueryParts[y]=1},y.initGradients=function(e){var t=e._fullLayout;c.ensureSingle(t._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),t._gradientUrlQueryParts={}},y.pointStyle=function(e,t,r){if(e.size()){var a=y.makePointStyleFns(t);e.each((function(e){y.singlePointStyle(e,n.select(this),t,a,r)}))}},y.singlePointStyle=function(e,t,r,n,a){var i=r.marker,o=i.line;if(t.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(e):void 0===e.mo?i.opacity:e.mo),n.ms2mrc){var s;s="various"===e.ms||"various"===i.size?3:n.ms2mrc(e.ms),e.mrc=s,n.selectedSizeFn&&(s=e.mrc=n.selectedSizeFn(e));var u=y.symbolNumber(e.mx||i.symbol)||0;e.om=u%200>=100,t.attr("d",_(u,s))}var f,d,p,h=!1;if(e.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(e.mlw+1||g+1||(e.trace?(e.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in e?e.mlcc=n.lineScale(e.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in e?e.mcc=n.markerScale(e.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(e))}if(e.om)t.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{t.style("stroke-width",(e.isBlank?0:p)+"px");var v=i.gradient,m=e.mgt;if(m?h=!0:m=v&&v.type,Array.isArray(m)&&(m=m[0],M[m]||(m=0)),m&&"none"!==m){var x=e.mgc;x?h=!0:x=v.color;var b=r.uid;h&&(b+="-"+e.i),y.gradient(t,a,b,m,[[0,x],[1,f]],"fill")}else l.fill(t,f);p&&l.stroke(t,d)}},y.makePointStyleFns=function(e){var t={},r=e.marker;return t.markerScale=y.tryColorscale(r,""),t.lineScale=y.tryColorscale(r,"line"),o.traceIs(e,"symbols")&&(t.ms2mrc=g.isBubble(e)?v(e):function(){return(r.size||6)/2}),e.selectedpoints&&c.extendFlat(t,y.makeSelectedPointStyleFns(e)),t},y.makeSelectedPointStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,p=void 0!==f;(c.isArrayOrTypedArray(s)||d||p)&&(t.selectedOpacityFn=function(e){var t=void 0===e.mo?a.opacity:e.mo;return e.selected?d?u:t:p?f:h*t});var g=a.color,v=i.color,m=l.color;(v||m)&&(t.selectedColorFn=function(e){var t=e.mcc||g;return e.selected?v||t:m||t});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(e,"symbols")&&(_||w)&&(t.selectedSizeFn=function(e){var t=e.mrc||y/2;return e.selected?_?x/2:t:w?b/2:t}),t},y.makeSelectedTextStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return t.selectedTextColorFn=function(e){var t=e.tc||s;return e.selected?c||t:u||(c?t:l.addOpacity(t,h))},t},y.selectedPointStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=y.makeSelectedPointStyleFns(t),a=t.marker||{},i=[];r.selectedOpacityFn&&i.push((function(e,t){e.style("opacity",r.selectedOpacityFn(t))})),r.selectedColorFn&&i.push((function(e,t){l.fill(e,r.selectedColorFn(t))})),r.selectedSizeFn&&i.push((function(e,t){var n=t.mx||a.symbol||0,i=r.selectedSizeFn(t);e.attr("d",_(y.symbolNumber(n),i)),t.mrc2=i})),i.length&&e.each((function(e){for(var t=n.select(this),r=0;r0?r:0}y.textPointStyle=function(e,t,r){if(e.size()){var a;if(t.selectedpoints){var i=y.makeSelectedTextStyleFns(t);a=i.selectedTextColorFn}var o=t.texttemplate,l=r._fullLayout;e.each((function(e){var i=n.select(this),s=o?c.extractOption(e,t,"txt","texttemplate"):c.extractOption(e,t,"tx","text");if(s||0===s){if(o){var u=t._module.formatLabels?t._module.formatLabels(e,t,l):{},d={};m(d,t,e.i);var p=t._meta||{};s=c.texttemplateString(s,u,l._d3locale,d,e,p)}var h=e.tp||t.textposition,g=S(e,t),v=a?a(e):e.tc||t.textfont.color;i.call(y.font,e.tf||t.textfont.family,g,v).text(s).call(f.convertToTspans,r).call(L,h,g,e.mrc)}else i.remove()}))}},y.selectedTextStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=y.makeSelectedTextStyleFns(t);e.each((function(e){var a=n.select(this),i=r.selectedTextColorFn(e),o=e.tp||t.textposition,s=S(e,t);l.fill(a,i),L(a,o,s,e.mrc2||e.mrc)}))}};function C(e,t,r,a){var i=e[0]-t[0],o=e[1]-t[1],l=r[0]-t[0],s=r[1]-t[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(t[0]+(p&&f/p),2),n.round(t[1]+(p&&d/p),2)],[n.round(t[0]-(h&&f/h),2),n.round(t[1]-(h&&d/h),2)]]}y.smoothopen=function(e,t){if(e.length<3)return"M"+e.join("L");var r,n="M"+e[0],a=[];for(r=1;r=1e4&&(y.savedBBoxes={},P=0),r&&(y.savedBBoxes[r]=v),P++,c.extendFlat({},v)},y.setClipUrl=function(e,t,r){e.attr("clip-path",R(t,r))},y.getTranslate=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||0,y:+t[1]||0}},y.setTranslate=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=u(t,r)).trim(),e[a]("transform",i),i},y.getScale=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||1,y:+t[1]||1}},y.setScale=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+="scale("+t+","+r+")").trim(),e[a]("transform",i),i};var E=/\s*sc.*/;y.setPointGroupScale=function(e,t,r){if(t=t||1,r=r||1,e){var n=1===t&&1===r?"":"scale("+t+","+r+")";e.each((function(){var e=(this.getAttribute("transform")||"").replace(E,"");e=(e+=n).trim(),this.setAttribute("transform",e)}))}};var I=/translate\([^)]*\)\s*$/;y.setTextPointsScale=function(e,t,r){e&&e.each((function(){var e,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(I);e=1===t&&1===r?[]:[u(o,l),"scale("+t+","+r+")",u(-o,-l)],s&&e.push(s),a.attr("transform",e.join(""))}}))}},{"../../components/fx/helpers":117,"../../constants/alignment":183,"../../constants/interactions":187,"../../constants/xmlns_namespaces":189,"../../lib":209,"../../lib/svg_text_utils":230,"../../registry":296,"../../traces/scatter/make_bubble_size_func":414,"../../traces/scatter/subtypes":422,"../color":81,"../colorscale":93,"./symbol_defs":104,d3:16,"fast-isnumeric":18,tinycolor2:64}],104:[function(e,t,r){"use strict";var n=e("d3");t.exports={circle:{n:0,f:function(e){var t=n.round(e,2);return"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"}},square:{n:1,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"}},diamond:{n:2,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"Z"}},cross:{n:3,f:function(e){var t=n.round(.4*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H"+t+"V"+r+"H-"+t+"V"+t+"H-"+r+"V-"+t+"H-"+t+"V-"+r+"H"+t+"V-"+t+"H"+r+"Z"}},x:{n:4,f:function(e){var t=n.round(.8*e/Math.sqrt(2),2),r="l"+t+","+t,a="l"+t+",-"+t,i="l-"+t+",-"+t,o="l-"+t+","+t;return"M0,"+t+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+","+n.round(e/2,2)+"H"+t+"L0,-"+n.round(e,2)+"Z"}},"triangle-down":{n:6,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+",-"+n.round(e/2,2)+"H"+t+"L0,"+n.round(e,2)+"Z"}},"triangle-left":{n:7,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M"+n.round(e/2,2)+",-"+t+"V"+t+"L-"+n.round(e,2)+",0Z"}},"triangle-right":{n:8,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+n.round(e/2,2)+",-"+t+"V"+t+"L"+n.round(e,2)+",0Z"}},"triangle-ne":{n:9,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+r+",-"+t+"H"+t+"V"+r+"Z"}},"triangle-se":{n:10,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+t+",-"+r+"V"+t+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H-"+t+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+t+","+r+"V-"+t+"H"+r+"Z"}},pentagon:{n:13,f:function(e){var t=n.round(.951*e,2),r=n.round(.588*e,2),a=n.round(-e,2),i=n.round(-.309*e,2);return"M"+t+","+i+"L"+r+","+n.round(.809*e,2)+"H-"+r+"L-"+t+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+t+"L-"+a+","+r+"V-"+r+"L0,-"+t+"Z"}},hexagon2:{n:15,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+t+",0L"+r+",-"+a+"H-"+r+"L-"+t+",0Z"}},octagon:{n:16,f:function(e){var t=n.round(.924*e,2),r=n.round(.383*e,2);return"M-"+r+",-"+t+"H"+r+"L"+t+",-"+r+"V"+r+"L"+r+","+t+"H-"+r+"L-"+t+","+r+"V-"+r+"Z"}},star:{n:17,f:function(e){var t=1.4*e,r=n.round(.225*t,2),a=n.round(.951*t,2),i=n.round(.363*t,2),o=n.round(.588*t,2),l=n.round(-t,2),s=n.round(-.309*t,2),c=n.round(.118*t,2),u=n.round(.809*t,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*t,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(e){var t=n.round(.66*e,2),r=n.round(.38*e,2),a=n.round(.76*e,2);return"M-"+a+",0l-"+r+",-"+t+"h"+a+"l"+r+",-"+t+"l"+r+","+t+"h"+a+"l-"+r+","+t+"l"+r+","+t+"h-"+a+"l-"+r+","+t+"l-"+r+",-"+t+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+t+","+r+o+t+","+r+o+"0,-"+a+o+"-"+t+","+r+"Z"}},"star-triangle-down":{n:20,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M"+t+",-"+r+o+"-"+t+",-"+r+o+"0,"+a+o+t+",-"+r+"Z"}},"star-square":{n:21,f:function(e){var t=n.round(1.1*e,2),r=n.round(2*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",-"+t+a+"-"+t+","+t+a+t+","+t+a+t+",-"+t+a+"-"+t+",-"+t+"Z"}},"star-diamond":{n:22,f:function(e){var t=n.round(1.4*e,2),r=n.round(1.9*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",0"+a+"0,"+t+a+t+",0"+a+"0,-"+t+a+"-"+t+",0Z"}},"diamond-tall":{n:23,f:function(e){var t=n.round(.7*e,2),r=n.round(1.4*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},"diamond-wide":{n:24,f:function(e){var t=n.round(1.4*e,2),r=n.round(.7*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},hourglass:{n:25,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"L"+t+",-"+t+"H-"+t+"Z"},noDot:!0},bowtie:{n:26,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"V-"+t+"L-"+t+","+t+"V-"+t+"Z"},noDot:!0},"circle-cross":{n:27,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(e){var t=n.round(e,2),r=n.round(e/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM0,-"+t+"V"+t+"M-"+t+",0H"+t},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(e){var t=n.round(1.3*e,2),r=n.round(.65*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(e){var t=n.round(1.2*e,2),r=n.round(.85*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(e){var t=n.round(e/2,2),r=n.round(e,2);return"M"+t+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+t+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+","+a+"L0,0M"+t+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+",-"+a+"L0,0M"+t+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M"+a+","+t+"L0,0M"+a+",-"+t+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+a+","+t+"L0,0M-"+a+",-"+t+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(e){var t=n.round(1.4*e,2);return"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(e){var t=n.round(e,2);return"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t},needLine:!0,noDot:!0,noFill:!0},"arrow-up":{n:45,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-down":{n:46,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-left":{n:47,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L-"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L-"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:16}],105:[function(e,t,r){"use strict";t.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"}}}},{}],106:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../registry"),i=e("../../plots/cartesian/axes"),o=e("../../lib"),l=e("./compute_error");function s(e,t,r,a){var s=t["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;t.each((function(t){var f,d=t[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(e){return e.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(t=[]);var v=n.select(this).selectAll("g.errorbar").data(t,f);if(v.exit().remove(),t.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.setClipUrl(v,r.layerClipId,e),v.each((function(e){var t=n.select(this),r=function(e,t,r){var n={x:t.c2p(e.x),y:r.c2p(e.y)};void 0!==e.yh&&(n.yh=r.c2p(e.yh),n.ys=r.c2p(e.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(e.ys,!0)));void 0!==e.xh&&(n.xh=t.c2p(e.xh),n.xs=t.c2p(e.xs),a(n.xs)||(n.noXS=!0,n.xs=t.c2p(e.xs,!0)));return n}(e,s,c);if(!g||e.vis){var i,o=t.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=t.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=t.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=t.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":422,"../drawing":103,d3:16,"fast-isnumeric":18}],111:[function(e,t,r){"use strict";var n=e("d3"),a=e("../color");t.exports=function(e){e.each((function(e){var t=e[0].trace,r=t.error_y||{},i=t.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":81,d3:16}],112:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("./layout_attributes").hoverlabel,i=e("../../lib/extend").extendFlat;t.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":203,"../../plots/font_attributes":282,"./layout_attributes":122}],113:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry");function i(e,t,r,a){a=a||n.identity,Array.isArray(e)&&(t[0][r]=a(e))}t.exports=function(e){var t=e.calcdata,r=e._fullLayout;function o(e){return function(t){return n.coerceHoverinfo({hoverinfo:t},{_module:e._module},r)}}for(var l=0;l=0&&r.indexb[0]._length||ee<0||ee>_[0]._length)return h.unhoverRaw(e,t)}if(t.pointerX=K+b[0]._offset,t.pointerY=ee+_[0]._offset,C="xval"in t?m.flat(l,t.xval):m.p2c(b,K),D="yval"in t?m.flat(l,t.yval):m.p2c(_,ee),!a(C[0])||!a(D[0]))return o.warn("Fx.hover failed",t,e),h.unhoverRaw(e,t)}var ne=1/0;function ae(e,r){for(F=0;FZ&&(W.splice(0,Z),ne=W[0].distance),g&&0!==X&&0===W.length){G.distance=X,G.index=!1;var f=H._module.hoverPoints(G,U,q,"closest",s._hoverlayer);if(f&&(f=f.filter((function(e){return e.spikeDistance<=X}))),f&&f.length){var d,h=f.filter((function(e){return e.xa.showspikes&&"hovered data"!==e.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(d=oe(v),(!J.vLinePoint||J.vLinePoint.spikeDistance>d.spikeDistance)&&(J.vLinePoint=d))}var y=f.filter((function(e){return e.ya.showspikes&&"hovered data"!==e.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(d=oe(x),(!J.hLinePoint||J.hLinePoint.spikeDistance>d.spikeDistance)&&(J.hLinePoint=d))}}}}}function ie(e,t){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===L&&$&&W.length>1,Ae=p.combine(s.plot_bgcolor||p.background,s.paper_bgcolor),Le={hovermode:L,rotateLabels:Me,bgColor:Ae,container:s._hoverlayer,outerContainer:s._paperdiv,commonLabelOpts:s.hoverlabel,hoverdistance:s.hoverdistance},Se=O(W,Le,e);m.isUnifiedHover(L)||(!function(e,t,r){var n,a,i,o,l,s,c,u=0,f=1,d=e.size(),p=new Array(d),h=0;function g(e){var t=e[0],r=e[e.length-1];if(a=t.pmin-t.pos-t.dp+t.size,i=r.pos+r.dp+r.size-t.pmax,a>.01){for(l=e.length-1;l>=0;l--)e[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=e.length-1;l>=0;l--)e[l].dp-=i;n=!1}if(n){var c=0;for(o=0;ot.pmax&&c++;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos>t.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)e[l].dp-=i;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos+s.dp+s.size>t.pmax&&(s.del=!0,c--)}}}e.each((function(e){var n=e[t],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:e,traceIndex:e.trace.index,dp:0,pos:e.pos,posref:e.posref,size:e.by*(a?T:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(e,t){return e[0].posref-t[0].posref||f*(t[0].traceIndex-e[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var _=b[l],w=_.datum;w.offset=_.dp,w.del=_.del}}}(Se,Me?"xa":"ya",s),P(Se,Me,s._invScaleX,s._invScaleY));if(t.target&&t.target.tagName){var Ce=v.getComponentMethod("annotations","hasClickToShow")(e,_e);f(n.select(t.target),Ce?"pointer":"")}if(!t.target||i||!function(e,t,r){if(!r||r.length!==e._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=e._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(e,0,be))return;be&&e.emit("plotly_unhover",{event:t,points:be});e.emit("plotly_hover",{event:t,points:e._hoverdata,xaxes:b,yaxes:_,xvals:C,yvals:D})}(e,t,r,i)}))},r.loneHover=function(e,t){var r=!0;Array.isArray(e)||(r=!1,e=[e]);var a=e.map((function(e){return{color:e.color||p.defaultLine,x0:e.x0||e.x||0,x1:e.x1||e.x||0,y0:e.y0||e.y||0,y1:e.y1||e.y||0,xLabel:e.xLabel,yLabel:e.yLabel,zLabel:e.zLabel,text:e.text,name:e.name,idealAlign:e.idealAlign,borderColor:e.borderColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontColor:e.fontColor,nameLength:e.nameLength,textAlign:e.textAlign,trace:e.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:e.hovertemplate||!1,eventData:e.eventData||!1,hovertemplateLabels:e.hovertemplateLabels||!1}})),i=n.select(t.container),o=t.outerContainer?n.select(t.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:t.bgColor||p.background,container:i,outerContainer:o},s=O(a,l,t.gd),c=0,u=0;s.sort((function(e,t){return e.y0-t.y0})).each((function(e,r){var n=e.y0-e.by/2;e.offset=n-5([\s\S]*)<\/extra>/;function O(e,t,r){var a=r._fullLayout,i=t.hovermode,c=t.rotateLabels,f=t.bgColor,h=t.container,g=t.outerContainer,v=t.commonLabelOpts||{},w=t.fontFamily||y.HOVERFONT,T=t.fontSize||y.HOVERFONTSIZE,k=e[0],M=k.xa,C=k.ya,O="y"===i.charAt(0)?"yLabel":"xLabel",P=k[O],z=(String(P)||"").split(" ")[0],R=g.node().getBoundingClientRect(),E=R.top,I=R.width,F=R.height,N=void 0!==P&&k.distance<=t.hoverdistance&&("x"===i||"y"===i);if(N){var H,B,j=!0;for(H=0;Ha.width-S?(y=a.width-S,s.attr("d","M"+(S-A)+",0L"+S+","+_+A+"v"+_+(2*L+b.height)+"H-"+S+"V"+_+A+"H"+(S-2*A)+"Z")):s.attr("d","M0,0L"+A+","+_+A+"H"+(L+b.width/2)+"v"+_+(2*L+b.height)+"H-"+(L+b.width/2)+"V"+_+A+"H-"+A+"Z")}else{var O,D,z;"right"===C.side?(O="start",D=1,z="",y=M._offset+M._length):(O="end",D=-1,z="-",y=M._offset),x=C._offset+(k.y0+k.y1)/2,c.attr("text-anchor",O),s.attr("d","M0,0L"+z+A+","+A+"V"+(L+b.height/2)+"h"+z+(2*L+b.width)+"V-"+(L+b.height/2)+"H"+z+A+"V-"+A+"Z");var R,I=b.height/2,F=E-b.top-I,N="clip"+a._uid+"commonlabel"+C._id;if(y=0?te-=ae:te+=2*L;var ie=ne.height+2*L,oe=ee+ie>=F;return ie<=F&&(ee<=E?ee=C._offset+2*L:oe&&(ee=F-ie)),re.attr("transform",l(te,ee)),re}var le=h.selectAll("g.hovertext").data(e,(function(e){return S(e)}));return le.enter().append("g").classed("hovertext",!0).each((function(){var e=n.select(this);e.append("rect").call(p.fill,p.addOpacity(f,.8)),e.append("text").classed("name",!0),e.append("path").style("stroke-width","1px"),e.append("text").classed("nums",!0).call(d.font,w,T)})),le.exit().remove(),le.each((function(e){var t=n.select(this).attr("transform",""),o=e.color;Array.isArray(o)&&(o=o[e.eventData[0].pointNumber]);var h=e.bgcolor||o,g=p.combine(p.opacity(h)?h:p.defaultLine,f),v=p.combine(p.opacity(o)?o:p.defaultLine,f),m=e.borderColor||p.contrast(g),y=D(e,N,i,a,P,t),x=y[0],b=y[1],k=t.select("text.nums").call(d.font,e.fontFamily||w,e.fontSize||T,e.fontColor||m).text(x).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,r),M=t.select("text.name"),S=0,C=0;if(b&&b!==x){M.call(d.font,e.fontFamily||w,e.fontSize||T,v).text(b).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,r);var O=M.node().getBoundingClientRect();S=O.width+2*L,C=O.height+2*L}else M.remove(),t.select("rect").remove();t.select("path").style({fill:g,stroke:m});var z,R,H=k.node().getBoundingClientRect(),B=e.xa._offset+(e.x0+e.x1)/2,j=e.ya._offset+(e.y0+e.y1)/2,V=Math.abs(e.x1-e.x0),U=Math.abs(e.y1-e.y0),q=H.width+A+L+S;if(e.ty0=E-H.top,e.bx=H.width+2*L,e.by=Math.max(H.height+2*L,C),e.anchor="start",e.txwidth=H.width,e.tx2width=S,e.offset=0,c)e.pos=B,z=j+U/2+q<=F,R=j-U/2-q>=0,"top"!==e.idealAlign&&z||!R?z?(j+=U/2,e.anchor="start"):e.anchor="middle":(j-=U/2,e.anchor="end");else if(e.pos=j,z=B+V/2+q<=I,R=B-V/2-q>=0,"left"!==e.idealAlign&&z||!R)if(z)B+=V/2,e.anchor="start";else{e.anchor="middle";var G=q/2,Z=B+G-I,Y=B-G;Z>0&&(B-=Z),Y<0&&(B+=-Y)}else B-=V/2,e.anchor="end";k.attr("text-anchor",e.anchor),S&&M.attr("text-anchor",e.anchor),t.attr("transform",l(B,j)+(c?s(_):""))})),le}function D(e,t,r,n,a,i){var l="",s="";void 0!==e.nameOverride&&(e.name=e.nameOverride),e.name&&(e.trace._meta&&(e.name=o.templateString(e.name,e.trace._meta)),l=I(e.name,e.nameLength)),void 0!==e.zLabel?(void 0!==e.xLabel&&(s+="x: "+e.xLabel+"
"),void 0!==e.yLabel&&(s+="y: "+e.yLabel+"
"),"choropleth"!==e.trace.type&&"choroplethmapbox"!==e.trace.type&&(s+=(s?"z: ":"")+e.zLabel)):t&&e[r.charAt(0)+"Label"]===a?s=e[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===e.xLabel?void 0!==e.yLabel&&"scattercarpet"!==e.trace.type&&(s=e.yLabel):s=void 0===e.yLabel?e.xLabel:"("+e.xLabel+", "+e.yLabel+")",!e.text&&0!==e.text||Array.isArray(e.text)||(s+=(s?"
":"")+e.text),void 0!==e.extraText&&(s+=(s?"
":"")+e.extraText),i&&""===s&&!e.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=e.hovertemplate||!1,f=e.hovertemplateLabels||e,d=e.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,e.trace._meta)).replace(C,(function(t,r){return l=I(r,e.nameLength),""}))),[s,l]}function P(e,t,r,a){var i=function(e){return e*r},o=function(e){return e*a};e.each((function(e){var r=n.select(this);if(e.del)return r.remove();var a=r.select("text.nums"),l=e.anchor,s="end"===l?-1:1,c={start:1,end:-1,middle:0}[l],f=c*(A+L),p=f+c*(e.txwidth+L),h=0,g=e.offset,v="middle"===l;v&&(f-=e.tx2width/2,p+=e.txwidth/2+L),t&&(g*=-M,h=e.offset*k),r.select("path").attr("d",v?"M-"+i(e.bx/2+e.tx2width/2)+","+o(g-e.by/2)+"h"+i(e.bx)+"v"+o(e.by)+"h-"+i(e.bx)+"Z":"M0,0L"+i(s*A+h)+","+o(A+g)+"v"+o(e.by/2-A)+"h"+i(s*e.bx)+"v-"+o(e.by)+"H"+i(s*A+h)+"V"+o(g-A)+"Z");var m=h+f,y=g+e.ty0-e.by/2+L,x=e.textAlign||"auto";"auto"!==x&&("left"===x&&"start"!==l?(a.attr("text-anchor","start"),m=v?-e.bx/2-e.tx2width/2+L:-e.bx-L):"right"===x&&"end"!==l&&(a.attr("text-anchor","end"),m=v?e.bx/2-e.tx2width/2-L:e.bx+L)),a.call(u.positionText,i(m),o(y)),e.tx2width&&(r.select("text.name").call(u.positionText,i(p+c*L+h),o(g+e.ty0-e.by/2+L)),r.select("rect").call(d.setRect,i(p+(c-1)*e.tx2width/2+h),o(g-e.by/2-1),i(e.tx2width),o(e.by+2)))}))}function z(e,t){var r=e.index,n=e.trace||{},i=e.cd[0],l=e.cd[r]||{};function s(e){return e||a(e)&&0===e}var c=Array.isArray(r)?function(e,t){var a=o.castOption(i,r,e);return s(a)?a:o.extractOption({},n,"",t)}:function(e,t){return o.extractOption(l,n,e,t)};function u(t,r,n){var a=c(r,n);s(a)&&(e[t]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),e.posref="y"===t||"closest"===t&&"h"===n.orientation?e.xa._offset+(e.x0+e.x1)/2:e.ya._offset+(e.y0+e.y1)/2,e.x0=o.constrain(e.x0,0,e.xa._length),e.x1=o.constrain(e.x1,0,e.xa._length),e.y0=o.constrain(e.y0,0,e.ya._length),e.y1=o.constrain(e.y1,0,e.ya._length),void 0!==e.xLabelVal&&(e.xLabel="xLabel"in e?e.xLabel:g.hoverLabelText(e.xa,e.xLabelVal),e.xVal=e.xa.c2d(e.xLabelVal)),void 0!==e.yLabelVal&&(e.yLabel="yLabel"in e?e.yLabel:g.hoverLabelText(e.ya,e.yLabelVal),e.yVal=e.ya.c2d(e.yLabelVal)),void 0!==e.zLabelVal&&void 0===e.zLabel&&(e.zLabel=String(e.zLabelVal)),!(isNaN(e.xerr)||"log"===e.xa.type&&e.xerr<=0)){var f=g.tickText(e.xa,e.xa.c2l(e.xerr),"hover").text;void 0!==e.xerrneg?e.xLabel+=" +"+f+" / -"+g.tickText(e.xa,e.xa.c2l(e.xerrneg),"hover").text:e.xLabel+=" \xb1 "+f,"x"===t&&(e.distance+=1)}if(!(isNaN(e.yerr)||"log"===e.ya.type&&e.yerr<=0)){var d=g.tickText(e.ya,e.ya.c2l(e.yerr),"hover").text;void 0!==e.yerrneg?e.yLabel+=" +"+d+" / -"+g.tickText(e.ya,e.ya.c2l(e.yerrneg),"hover").text:e.yLabel+=" \xb1 "+d,"y"===t&&(e.distance+=1)}var p=e.hoverinfo||e.trace.hoverinfo;return p&&"all"!==p&&(-1===(p=Array.isArray(p)?p:p.split("+")).indexOf("x")&&(e.xLabel=void 0),-1===p.indexOf("y")&&(e.yLabel=void 0),-1===p.indexOf("z")&&(e.zLabel=void 0),-1===p.indexOf("text")&&(e.text=void 0),-1===p.indexOf("name")&&(e.name=void 0)),e}function R(e,t,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,u=!!t.hLinePoint,f=!!t.vLinePoint;if(o.selectAll(".spikeline").remove(),f||u){var h=p.combine(l.plot_bgcolor,l.paper_bgcolor);if(u){var v,m,y=t.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,h)<1.5?p.contrast(h):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=g.getPxPosition(e,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T,stroke:k,"stroke-dasharray":d.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":T+2,stroke:h}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:m,r:T,fill:k}).classed("spikeline",!0)}if(f){var S,C,O=t.vLinePoint;n=O&&O.xa,a=O&&O.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+O.x,C=a._offset+O.y);var D,P,z=i.readability(O.color,h)<1.5?p.contrast(h):O.color,R=n.spikemode,E=n.spikethickness,I=n.spikecolor||z,F=g.getPxPosition(e,n);if(-1!==R.indexOf("toaxis")||-1!==R.indexOf("across")){if(-1!==R.indexOf("toaxis")&&(D=F,P=C),-1!==R.indexOf("across")){var N=n._counterDomainMin,H=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),H=Math.max(H,n.position)),D=s.t+(1-H)*s.h,P=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:P,"stroke-width":E,stroke:I,"stroke-dasharray":d.dashStyle(n.spikedash,E)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:D,y2:P,"stroke-width":E+2,stroke:h}).classed("spikeline",!0).classed("crisp",!0)}-1!==R.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?E:-E),r:E,fill:I}).classed("spikeline",!0)}}}function E(e,t){return!t||(t.vLinePoint!==e._spikepoints.vLinePoint||t.hLinePoint!==e._spikepoints.hLinePoint)}function I(e,t){return u.plainText(e||"",{len:t,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":209,"../../lib/events":202,"../../lib/override_cursor":220,"../../lib/svg_text_utils":230,"../../plots/cartesian/axes":254,"../../registry":296,"../color":81,"../dragelement":100,"../drawing":103,"../legend/defaults":133,"../legend/draw":134,"./constants":115,"./helpers":117,d3:16,"fast-isnumeric":18,tinycolor2:64}],119:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../color"),i=e("./helpers").isUnifiedHover;t.exports=function(e,t,r,o){function l(e){o.font[e]||(o.font[e]=t.legend?t.legend.font[e]:t.font[e])}o=o||{},t&&i(t.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),t.legend?(o.bgcolor||(o.bgcolor=a.combine(t.legend.bgcolor,t.paper_bgcolor)),o.bordercolor||(o.bordercolor=t.legend.bordercolor)):o.bgcolor||(o.bgcolor=t.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":209,"../color":81,"./helpers":117}],120:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){function i(r,i){return void 0!==t[r]?t[r]:n.coerce(e,t,a,r,i)}var o,l=i("clickmode");return t._has("cartesian")?l.indexOf("select")>-1?o="closest":(t._isHoriz=function(e,t){for(var r=t._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===k("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===k("roworder"),w=d?.2:.1,T=d?.3:.1;g&&t._splomGridDflt&&(x=t._splomGridDflt.xside,b=t._splomGridDflt.yside),v._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,m,_)}}else delete t.grid}function k(e,t){return n.coerce(r,v,s,e,t)}},contentDefaults:function(e,t){var r=t.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=e.grid||{},p=t._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(t,"legend");if(_("uirevision",t.uirevision),!1!==g){_("bgcolor",t.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",t.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(e.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(t.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemwidth"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",t.font))}}function _(e,t){return a.coerce(c,v,o,e,t)}}},{"../../lib":209,"../../plot_api/plot_template":243,"../../plots/layout_attributes":286,"../../registry":296,"./attributes":131,"./helpers":137}],134:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib/events"),s=e("../dragelement"),c=e("../drawing"),u=e("../color"),f=e("../../lib/svg_text_utils"),d=e("./handle_click"),p=e("./constants"),h=e("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=e("./get_legend_data"),x=e("./style"),b=e("./helpers");function _(e,t,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:e.data,layout:e.layout,frames:e._transitionData._frames,config:e._context,fullData:e._fullData,fullLayout:e._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(e,"plotly_legendclick",s))if(1===n)t._clickTimeout=setTimeout((function(){d(r,e,n)}),e._context.doubleClickDelay);else if(2===n){t._clickTimeout&&clearTimeout(t._clickTimeout),e._legendMouseDownTime=0,!1!==l.triggerHandler(e,"plotly_legenddoubleclick",s)&&d(r,e,n)}}function w(e,t,r){var n,i=e.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&t._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(e,"text","legendtext");g.attr("text-anchor","start").call(c.font,r.font).text(d?T(n,h):n);var v=r.itemwidth+2*p.itemGap;f.positionText(g,v,0),d?g.call(f.makeEditable,{gd:t,text:n}).call(M,e,t,r).on("edit",(function(n){this.text(T(n,h)).call(M,e,t,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",t,s,u)})):M(g,e,t,r)}function T(e,t){var r=Math.max(4,t);if(e&&e.trim().length>=r/2)return e;for(var n=r-(e=e||"").length;n>0;n--)e+=" ";return e}function k(e,t){var r,i=t._context.doubleClickDelay,o=1,l=a.ensureSingle(e,"rect","legendtoggle",(function(e){t._context.staticPlot||e.style("cursor","pointer").attr("pointer-events","all"),e.call(u.fill,"rgba(0,0,0,0)")}));t._context.staticPlot||(l.on("mousedown",(function(){(r=(new Date).getTime())-t._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(t,r,e,o,n.event)}})))}function M(e,t,r,n){n._main||e.attr("data-notex",!0),f.convertToTspans(e,r,(function(){!function(e,t,r){var n=e.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void e.remove();var a=e.select("g[class*=math-group]"),i=a.node();r||(r=t._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=e.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);if(n){var x=r.itemwidth+2*p.itemGap;f.positionText(h,x,-y)}else f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(t,r,n)}))}function A(e){return a.isRightAnchor(e)?"right":a.isCenterAnchor(e)?"center":"left"}function L(e){return a.isBottomAnchor(e)?"bottom":a.isMiddleAnchor(e)?"middle":"top"}t.exports=function(e,t){var r,l=e._fullLayout,f="legend"+l._uid;if(t?(r=t.layer,f+="-hover"):((t=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(e._legendMouseDownTime||(e._legendMouseDownTime=0),t._main){if(!e.calcdata)return;d=l.showlegend&&y(e.calcdata,t)}else{if(!t.entries)return;d=y(t.entries,t)}var h=l.hiddenlabels||[];if(t._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(e,"legend");var g=a.ensureSingle(r,"g","legend",(function(e){t._main&&e.attr("pointer-events","all")})),T=a.ensureSingleById(l._topdefs,"clipPath",f,(function(e){e.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(e){e.attr("shape-rendering","crispEdges")}));S.call(u.stroke,t.bordercolor).call(u.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),O=t.title;if(t._titleWidth=0,t._titleHeight=0,O.text){var D=a.ensureSingle(C,"text","legendtitletext");D.attr("text-anchor","start").call(c.font,O.font).text(O.text),M(D,C,e,t)}else C.selectAll(".legendtitletext").remove();var P=a.ensureSingle(g,"rect","scrollbar",(function(e){e.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),z=C.selectAll("g.groups").data(d);z.enter().append("g").attr("class","groups"),z.exit().remove();var R=z.selectAll("g.traces").data(a.identity);R.enter().append("g").attr("class","traces"),R.exit().remove(),R.style("opacity",(function(e){var t=e[0].trace;return o.traceIs(t,"pie-like")?-1!==h.indexOf(e[0].label)?.5:1:"legendonly"===t.visible?.5:1})).each((function(){n.select(this).call(w,e,t)})).call(x,e,t).each((function(){t._main&&n.select(this).call(k,e)})),a.syncOrAsync([i.previousPromises,function(){return function(e,t,r,a){var i=e._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.itemGap,h=a.itemwidth+2*d,g=2*(u+d),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(e){var t=0,r=0,n=e.title.side;n&&(-1!==n.indexOf("left")&&(t=e._titleWidth),-1!==n.indexOf("top")&&(r=e._titleHeight));return[t,r]}(a);if(l)r.each((function(e){var t=e[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+t/2+d),a._height+=t,a._width=Math.max(a._width,e[0].width)})),x=h+a._width,a._width+=d+h+f,a._height+=g,s&&(t.each((function(e,t){c.setTranslate(this,0,t*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:S:k?M&&"right"===w?o.r+o.w:S:o.w,2*h);var C=0,O=0;r.each((function(e){var t=e[0].width+h;C=Math.max(C,t),O+=t})),x=null;var D=0;if(s){var P=0,z=0,R=0;t.each((function(){var e=0,t=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+d+n/2+t),t+=n,e=Math.max(e,h+r[0].width)})),P=Math.max(P,t);var r=e+d;r+u+z>a._maxWidth&&(D=Math.max(D,z),z=0,R+=P+a.tracegroupgap,P=t),c.setTranslate(this,z,R),z+=r})),a._width=Math.max(D,z)+u,a._height=R+P+g}else{var E=r.size(),I=O+f+(E-1)*d=a._maxWidth&&(D=Math.max(D,B),N=0,H+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+H+t/2+d),B=N+r+d,N+=n,F=Math.max(F,t)})),I?(a._width=N+f,a._height=F+g):(a._width=Math.max(D,B)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var j=e._context.edits,V=j.legendText||j.legendPosition;r.each((function(e){var t=n.select(this).select(".legendtoggle"),r=e[0].height,a=V?h:x||h+e[0].width;l||(a+=d/2),c.setRect(t,0,-r/2,a,r)}))}(e,z,R,t)},function(){if(!t._main||!function(e){var t=e._fullLayout.legend,r=A(t),n=L(t);return i.autoMargin(e,"legend",{x:t.x,y:t.y,l:t._width*v[r],r:t._width*m[r],b:t._effHeight*m[n],t:t._effHeight*v[n]})}(e)){var u,d,h,y,x=l._size,b=t.borderwidth,w=x.l+x.w*t.x-v[A(t)]*t._width,k=x.t+x.h*(1-t.y)-v[L(t)]*t._effHeight;if(t._main&&l.margin.autoexpand){var M=w,O=k;w=a.constrain(w,0,l.width-t._width),k=a.constrain(k,0,l.height-t._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==O&&a.log("Constrain legend.y to make legend fit inside graph")}if(t._main&&c.setTranslate(g,w,k),P.on(".drag",null),g.on("wheel",null),!t._main||t._height<=t._maxHeight||e._context.staticPlot){var D=t._effHeight;t._main||(D=t._height),S.attr({width:t._width-b,height:D-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:t._width-2*b,height:D-2*b,x:b,y:b}),c.setClipUrl(C,f,e),c.setRect(P,0,0,0,0),delete t._scrollY}else{var z,R,E,I=Math.max(p.scrollBarMinHeight,t._effHeight*t._effHeight/t._height),F=t._effHeight-I-2*p.scrollBarMargin,N=t._height-t._effHeight,H=F/N,B=Math.min(t._scrollY||0,N);S.attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-2*b,x:b,y:b+B}),c.setClipUrl(C,f,e),U(B,I,H),g.on("wheel",(function(){U(B=a.constrain(t._scrollY+n.event.deltaY/F*N,0,N),I,H),0!==B&&B!==N&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;z="touchstart"===e.type?e.changedTouches[0].clientY:e.clientY,E=B})).on("drag",(function(){var e=n.event.sourceEvent;2===e.buttons||e.ctrlKey||(R="touchmove"===e.type?e.changedTouches[0].clientY:e.clientY,U(B=function(e,t,r){var n=(r-t)/H+e;return a.constrain(n,0,N)}(E,z,R),I,H))}));P.call(j);var V=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;"touchstart"===e.type&&(z=e.changedTouches[0].clientY,E=B)})).on("drag",(function(){var e=n.event.sourceEvent;"touchmove"===e.type&&(R=e.changedTouches[0].clientY,U(B=function(e,t,r){var n=(t-r)/H+e;return a.constrain(n,0,N)}(E,z,R),I,H))}));C.call(V)}if(e._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:e,prepFn:function(){var e=c.getTranslate(g);h=e.x,y=e.y},moveFn:function(e,r){var n=h+e,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,t.xanchor),d=s.align(a,0,x.t+x.h,x.t,t.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",e,{"legend.x":u,"legend.y":d})},clickFn:function(t,n){var a=r.selectAll("g.traces").filter((function(){var e=this.getBoundingClientRect();return n.clientX>=e.left&&n.clientX<=e.right&&n.clientY>=e.top&&n.clientY<=e.bottom}));a.size()>0&&_(e,g,a,t,n)}})}function U(r,n,a){t._scrollY=e._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(P,t._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],e)}}},{"../../constants/alignment":183,"../../lib":209,"../../lib/events":202,"../../lib/svg_text_utils":230,"../../plots/plots":288,"../../registry":296,"../color":81,"../dragelement":100,"../drawing":103,"./constants":132,"./get_legend_data":135,"./handle_click":136,"./helpers":137,"./style":139,d3:16}],135:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("./helpers");t.exports=function(e,t){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=t._main;function p(e,r){if(""!==e&&a.isGrouped(t))-1===l.indexOf(e)?(l.push(e),s=!0,o[e]=[[r]]):o[e].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=t.width}return v?n:Math.min(a,r)};function _(e,t,r){var i=e[0].trace,o=i.marker||{},l=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(c?[e]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),u.exit().remove(),u.each((function(e){var t=n.select(this),r=e[0],a=b(r.mlw,o.line,5,2);t.style("stroke-width",a+"px").call(s.fill,r.mc||o.color),a&&s.stroke(t,r.mlc||l.color)}))}function w(e,t,r){var o=e[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(s?[e]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),c.exit().remove(),c.size()){var u=(l.marker||{}).line,p=b(d(u.width,o.pts),u,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=u.color;var g=i.minExtend(o,{trace:h});f(c,g,h)}}e.each((function(e){var t=n.select(this),a=i.ensureSingle(t,"g","layers");a.style("opacity",e[0].trace.opacity);var l=r.valign,s=e[0].lineHeight,c=e[0].height;if("middle"!==l&&s&&c){var u={top:1,bottom:-1}[l]*(.5*(s-c+3));a.attr("transform",o(0,u))}else a.attr("transform",null);a.selectAll("g.legendfill").data([e]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([e]).enter().append("g").classed("legendlines",!0);var f=a.selectAll("g.legendsymbols").data([e]);f.enter().append("g").classed("legendsymbols",!0),f.selectAll("g.legendpoints").data([e]).enter().append("g").classed("legendpoints",!0)})).each((function(e){var r,a=e[0].trace,o=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":o=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":o=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":o=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":o=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":o=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":o=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(o);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform",x).style("stroke-miterlimit",1),u.exit().remove(),u.each((function(e,o){var u,f=n.select(this),d=c(a),p=d.colorscale,g=d.reversescale;if(p){if(!r){var v=p.length;u=0===o?p[g?v-1:0][1]:1===o?p[g?0:v-1][1]:p[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[o]||m[0]:m}f.attr("d",e[0]),u?f.call(s.fill,u):f.call((function(e){if(e.size()){var n="legendfill-"+a.uid;l.gradient(e,t,n,h(g,"radial"===r),p,"fill")}}))}))})).each((function(e){var t=e[0].trace,r="waterfall"===t.type;if(e[0]._distinct&&r){var a=e[0].trace[e[0].dir].marker;return e[0].mc=a.color,e[0].mlw=a.line.width,e[0].mlc=a.line.color,_(e,this,"waterfall")}var i=[];t.visible&&r&&(i=e[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform",x).style("stroke-miterlimit",1),o.exit().remove(),o.each((function(e){var r=n.select(this),a=t[e[0]].marker,i=b(void 0,a.line,5,2);r.attr("d",e[1]).style("stroke-width",i+"px").call(s.fill,a.color),i&&r.call(s.stroke,a.line.color)}))})).each((function(e){_(e,this,"funnel")})).each((function(e){_(e,this)})).each((function(e){var r=e[0].trace,o=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[e]:[]);o.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),o.exit().remove(),o.each((function(){var e=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==s.opacity(r.fillcolor)||0!==s.opacity((r.line||{}).color)){var a=b(void 0,r.line,5,2);e.style("stroke-width",a+"px").call(s.fill,r.fillcolor),a&&s.stroke(e,r.line.color)}else{var c=i.minExtend(r,{marker:{size:v?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});o.call(l.pointStyle,c,t)}}))})).each((function(e){w(e,this,"funnelarea")})).each((function(e){w(e,this,"pie")})).each((function(e){var r,a,o=e[0],s=o.trace,f=s.visible&&s.fill&&"none"!==s.fill,d=u.hasLines(s),p=s.contours,g=!1,v=!1,y=c(s),x=y.colorscale,_=y.reversescale;if(p){var w=p.coloring;"lines"===w?g=!0:d="none"===w||"heatmap"===w||p.showlines,"constraint"===p.type?f="="!==p._operation:"fill"!==w&&"heatmap"!==w||(v=!0)}var T=u.hasMarkers(s)||u.hasText(s),k=f||v,M=d||g,A=T||!k?"M5,0":M?"M5,-2":"M5,-3",L=n.select(this),S=L.select(".legendfill").selectAll("path").data(f||v?[e]:[]);if(S.enter().append("path").classed("js-fill",!0),S.exit().remove(),S.attr("d",A+"h"+m+"v6h-"+m+"z").call(f?l.fillGroupStyle:function(e){if(e.size()){var r="legendfill-"+s.uid;l.gradient(e,t,r,h(_),x,"fill")}}),d||g){var C=b(void 0,s.line,10,5);a=i.minExtend(s,{line:{width:C}}),r=[i.minExtend(o,{trace:a})]}var O=L.select(".legendlines").selectAll("path").data(d||g?[r]:[]);O.enter().append("path").classed("js-line",!0),O.exit().remove(),O.attr("d",A+(g?"l"+m+",0.0001":"h"+m)).call(d?l.lineGroupStyle:function(e){if(e.size()){var r="legendline-"+s.uid;l.lineGroupStyle(e),l.gradient(e,t,r,h(_),x,"stroke")}})})).each((function(e){var r,a,o=e[0],s=o.trace,c=u.hasMarkers(s),f=u.hasText(s),d=u.hasLines(s);function p(e,t,r,n){var a=i.nestedProperty(s,e).get(),o=i.isArrayOrTypedArray(a)&&t?t(a):a;if(v&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function h(e){return o._distinct&&o.index&&e[o.index]?e[o.index]:e[0]}if(c||f||d){var g={},m={};if(c){g.mc=p("marker.color",h),g.mx=p("marker.symbol",h),g.mo=p("marker.opacity",i.mean,[.2,1]),g.mlc=p("marker.line.color",h),g.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);g.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",h,[0,10],5)}),f&&(g.tx="Aa",g.tp=p("textposition",h),g.ts=10,g.tc=p("textfont.color",h),g.tf=p("textfont.family",h)),r=[i.minExtend(o,g)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var b=n.select(this).select("g.legendpoints"),_=b.selectAll("path.scatterpts").data(c?r:[]);_.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",x),_.exit().remove(),_.call(l.pointStyle,a,t),c&&(r[0].mrc=3);var w=b.selectAll("g.pointtext").data(f?r:[]);w.enter().append("g").classed("pointtext",!0).append("text").attr("transform",x),w.exit().remove(),w.selectAll("text").call(l.textPointStyle,a,t)})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(t.visible&&"candlestick"===t.type?[e,e]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",(function(e,t){return t?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"})).attr("transform",x).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=b(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(s.fill,i.fillcolor),o&&s.stroke(a,i.line.color)}))})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(t.visible&&"ohlc"===t.type?[e,e]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",(function(e,t){return t?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"})).attr("transform",x).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=b(void 0,i.line,5,2);a.style("fill","none").call(l.dashLine,i.line.dash,o),o&&s.stroke(a,i.line.color)}))}))}},{"../../lib":209,"../../registry":296,"../../traces/pie/helpers":389,"../../traces/pie/style_one":395,"../../traces/scatter/subtypes":422,"../color":81,"../colorscale/helpers":92,"../drawing":103,"./constants":132,d3:16}],140:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/plots"),i=e("../../plots/cartesian/axis_ids"),o=e("../../fonts/ploticon"),l=e("../shapes/draw").eraseActiveShape,s=e("../../lib"),c=s._,u=t.exports={};function f(e,t){var r,a,o=t.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=e._fullLayout,u={},f=i.list(e,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(e){for(var t=0;t0)){var g=function(e,t,r){for(var n=r.filter((function(r){return t[r].anchor===e._id})),a=0,i=0;i=n.max)t=F[r+1];else if(e=n.pmax)t=F[r+1];else if(e0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(e,t,r,n,a){var l="category"===e.type||"multicategory"===e.type?e.r2c:e.d2c;if(void 0!==t)return[l(t),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===e.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]:void 0}}t.exports=function(e){var t=e._fullLayout,r=n.filterVisible(t.shapes);if(r.length&&e._fullData.length)for(var o=0;oy?(k=f,S="y0",M=y,C="y1"):(k=y,S="y1",M=f,C="y0");W(n),$(l,r),function(e,t,r){var n=t.xref,a=t.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(e,s?"clip"+r._fullLayout._uid+s:null,r)}(t,r,e),X.moveFn="move"===z?Q:J,X.altKey=n.altKey},doneFn:function(){if(m(e))return;p(t),K(l),b(t,e,r),n.call("_guiRelayout",e,s.getUpdateObj())},clickFn:function(){if(m(e))return;K(l)}};function W(r){if(m(e))z=null;else if(I)z="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=X.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(t,s),z=s.split("-")[0]}}function Q(n,a){if("path"===r.type){var i=function(e){return e},o=i,s=i;R?N("xanchor",r.xanchor=G(x+n)):(o=function(e){return G(U(e)+n)},H&&"date"===H.type&&(o=g.encodeDate(o))),E?N("yanchor",r.yanchor=Z(T+a)):(s=function(e){return Z(q(e)+a)},j&&"date"===j.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else R?N("xanchor",r.xanchor=G(x+n)):(N("x0",r.x0=G(c+n)),N("x1",r.x1=G(v+n))),E?N("yanchor",r.yanchor=Z(T+a)):(N("y0",r.y0=Z(f+a)),N("y1",r.y1=Z(y+a)));t.attr("d",_(e,r)),$(l,r)}function J(n,a){if(F){var i=function(e){return e},o=i,s=i;R?N("xanchor",r.xanchor=G(x+n)):(o=function(e){return G(U(e)+n)},H&&"date"===H.type&&(o=g.encodeDate(o))),E?N("yanchor",r.yanchor=Z(T+a)):(s=function(e){return Z(q(e)+a)},j&&"date"===j.type&&(s=g.encodeDate(s))),N("path",r.path=w(P,o,s))}else if(I){if("resize-over-start-point"===z){var u=c+n,d=E?f-a:f+a;N("x0",r.x0=R?u:G(u)),N("y0",r.y0=E?d:Z(d))}else if("resize-over-end-point"===z){var p=v+n,h=E?y-a:y+a;N("x1",r.x1=R?p:G(p)),N("y1",r.y1=E?h:Z(h))}}else{var m=function(e){return-1!==z.indexOf(e)},b=m("n"),B=m("s"),V=m("w"),Y=m("e"),X=b?k+a:k,W=B?M+a:M,Q=V?A+n:A,J=Y?L+n:L;E&&(b&&(X=k-a),B&&(W=M-a)),(!E&&W-X>10||E&&X-W>10)&&(N(S,r[S]=E?X:Z(X)),N(C,r[C]=E?W:Z(W))),J-Q>10&&(N(O,r[O]=R?Q:G(Q)),N(D,r[D]=R?J:G(J)))}t.attr("d",_(e,r)),$(l,r)}function $(e,t){(R||E)&&function(){var r="path"!==t.type,n=e.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 i=U(R?t.xanchor:a.midRange(r?[t.x0,t.x1]:g.extractPathCoords(t.path,h.paramIsX))),o=q(E?t.yanchor:a.midRange(r?[t.y0,t.y1]:g.extractPathCoords(t.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),R&&E){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(R){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function K(e){e.selectAll(".visual-cue").remove()}d.init(X),Y.node().onmousemove=W}(e,R,s,t,r,z):!0===s.editable&&R.style("pointer-events",D||c.opacity(L)*A<=.5?"stroke":"all");R.node().addEventListener("click",(function(){return function(e,t){if(!y(e))return;var r=+t.node().getAttribute("data-index");if(r>=0){if(r===e._fullLayout._activeShapeIndex)return void T(e);e._fullLayout._activeShapeIndex=r,e._fullLayout._deactivateShape=T,v(e)}}(e,R)}))}}function b(e,t,r){var n=(r.xref+r.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");u.setClipUrl(e,n?"clip"+t._fullLayout._uid+n:null,t)}function _(e,t){var r,n,o,l,s,c,u,f,d=t.type,p=i.getRefType(t.xref),v=i.getRefType(t.yref),m=i.getFromId(e,t.xref),y=i.getFromId(e,t.yref),x=e._fullLayout._size;if(m?"domain"===p?n=function(e){return m._offset+m._length*e}:(r=g.shapePositionToRange(m),n=function(e){return m._offset+m.r2p(r(e,!0))}):n=function(e){return x.l+x.w*e},y?"domain"===v?l=function(e){return y._offset+y._length*(1-e)}:(o=g.shapePositionToRange(y),l=function(e){return y._offset+y.r2p(o(e,!0))}):l=function(e){return x.t+x.h*(1-e)},"path"===d)return m&&"date"===m.type&&(n=g.decodeDate(n)),y&&"date"===y.type&&(l=g.decodeDate(l)),function(e,t,r){var n=e.path,i=e.xsizemode,o=e.ysizemode,l=e.xanchor,s=e.yanchor;return n.replace(h.segmentRE,(function(e){var n=0,c=e.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=e.substr(1).replace(h.paramRE,(function(e){return u[n]?e="pixel"===i?t(l)+Number(e):t(e):f[n]&&(e="pixel"===o?r(s)-Number(e):r(e)),++n>d&&(e="X"),e}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+e)),c+p}))}(t,n,l);if("pixel"===t.xsizemode){var b=n(t.xanchor);s=b+t.x0,c=b+t.x1}else s=n(t.x0),c=n(t.x1);if("pixel"===t.ysizemode){var _=l(t.yanchor);u=_-t.y0,f=_-t.y1}else u=l(t.y0),f=l(t.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var w=(s+c)/2,T=(u+f)/2,k=Math.abs(w-s),M=Math.abs(T-u),A="A"+k+","+M,L=w+k+","+T;return"M"+L+A+" 0 1,1 "+(w+","+(T-M))+A+" 0 0,1 "+L+"Z"}function w(e,t,r){return e.replace(h.segmentRE,(function(e){var n=0,a=e.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+e.substr(1).replace(h.paramRE,(function(e){return n>=l||(i[n]?e=t(e):o[n]&&(e=r(e)),n++),e}))}))}function T(e){y(e)&&(e._fullLayout._activeShapeIndex>=0&&(s(e),delete e._fullLayout._activeShapeIndex,v(e)))}t.exports={draw:v,drawOne:x,eraseActiveShape:function(e){if(!y(e))return;s(e);var t=e._fullLayout._activeShapeIndex,r=(e.layout||{}).shapes||[];if(t=0&&f(m),r.attr("d",g(t)),M&&!d)&&(k=function(e,t){for(var r=0;r1&&(2!==e.length||"Z"!==e[1][0])&&(0===T&&(e[0][0]="M"),t[w]=e,y(),x())}}()}}function P(e,r){!function(e,r){if(t.length)for(var n=0;n0&&s0&&(l=l.transition().duration(t.transition.duration).ease(t.transition.easing)),l.attr("transform",s(o-.5*f.gripWidth,t._dims.currentValueTotalHeight))}}function S(e,t){var r=e._dims;return r.inputAreaStart+f.stepInset+(r.inputAreaLength-2*f.stepInset)*Math.min(1,Math.max(0,t))}function C(e,t){var r=e._dims;return Math.min(1,Math.max(0,(t-f.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*f.stepInset-2*r.inputAreaStart)))}function O(e,t,r){var n=r._dims,a=l.ensureSingle(e,"rect",f.railTouchRectClass,(function(n){n.call(M,t,e,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,f.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function D(e,t){var r=t._dims,n=r.inputAreaLength-2*f.railInset,a=l.ensureSingle(e,"rect",f.railRectClass);a.attr({width:n,height:f.railWidth,rx:f.railRadius,ry:f.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,t.bordercolor).call(i.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px"),o.setTranslate(a,f.railInset,.5*(r.inputAreaWidth-f.railWidth)+r.currentValueTotalHeight)}t.exports=function(e){var t=e._fullLayout,r=function(e,t){for(var r=e[f.name],n=[],a=0;a0?[0]:[]);function l(t){t._commandObserver&&(t._commandObserver.remove(),delete t._commandObserver),a.autoMargin(e,v(t))}if(i.enter().append("g").classed(f.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+f.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+f.groupClassName).data(r,m);s.enter().append("g").classed(f.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||d<0){var m={left:[-h,0],right:[h,0],top:[0,-h],bottom:[0,h]}[b.side];t.attr("transform",s(m[0],m[1]))}}}return E.call(I),z&&(S?E.on(".opacity",null):(M=0,A=!0,E.text(y).on("mouseover.opacity",(function(){n.select(this).transition().duration(d.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(d.HIDE_PLACEHOLDER).style("opacity",0)}))),E.call(f.makeEditable,{gd:e}).on("edit",(function(t){void 0!==x?o.call("_guiRestyle",e,m,t,x):o.call("_guiRelayout",e,m,t)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(I)})).on("input",(function(e){this.text(e||" ").call(f.positionText,_.x,_.y)}))),E.classed("js-placeholder",A),T}}},{"../../constants/alignment":183,"../../constants/interactions":187,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/plots":288,"../../registry":296,"../color":81,"../drawing":103,d3:16,"fast-isnumeric":18}],177:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("../color/attributes"),i=e("../../lib/extend").extendFlat,o=e("../../plot_api/edit_types").overrideAll,l=e("../../plots/pad_attributes"),s=e("../../plot_api/plot_template").templatedArray,c=s("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"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});t.exports=o(s("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:c,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:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":203,"../../plot_api/edit_types":236,"../../plot_api/plot_template":243,"../../plots/font_attributes":282,"../../plots/pad_attributes":287,"../color/attributes":80}],178:[function(e,t,r){"use strict";t.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"}}},{}],179:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/array_container_defaults"),i=e("./attributes"),o=e("./constants").name,l=i.buttons;function s(e,t,r){function o(r,a){return n.coerce(e,t,i,r,a)}o("visible",a(e,t,{name:"buttons",handleItemDefaults:c}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),n.noneOrAll(e,t,["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 c(e,t){function r(r,a){return n.coerce(e,t,l,r,a)}r("visible","skip"===e.method||Array.isArray(e.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}t.exports=function(e,t){a(e,t,{name:o,handleItemDefaults:s})}},{"../../lib":209,"../../plots/array_container_defaults":249,"./attributes":177,"./constants":178}],180:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../plots/plots"),i=e("../color"),o=e("../drawing"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../plot_api/plot_template").arrayEditor,u=e("../../constants/alignment").LINE_SPACING,f=e("./constants"),d=e("./scrollbox");function p(e){return e._index}function h(e,t){return+e.attr(f.menuIndexAttrName)===t._index}function g(e,t,r,n,a,i,o,l){t.active=o,c(e.layout,f.name,t).applyUpdate("active",o),"buttons"===t.type?m(e,n,null,null,t):"dropdown"===t.type&&(a.attr(f.menuIndexAttrName,"-1"),v(e,n,a,i,t),l||m(e,n,a,i,t))}function v(e,t,r,n,a){var i=l.ensureSingle(t,"g",f.headerClassName,(function(e){e.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,e).call(A,a,d,p),l.ensureSingle(t,"text",f.headerArrowClassName,(function(e){e.attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(e,t,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(t,s.lx,s.ly)}function m(e,t,r,i,o){r||(r=t).attr("pointer-events","all");var s=function(e){return-1==+e.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,e).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(e,o,0,t,r,i,-1),a.executeAPICommand(e,l.method,l.args2)):(g(e,o,0,t,r,i,s),a.executeAPICommand(e,l.method,l.args))),e.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(m.openWidth,m.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(m.openHeight,m.headerHeight)),k.direction=o.direction,i&&(u.size()?function(e,t,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[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(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(e){e.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),k?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>T,D=l.barWidth+2*l.barPad,P=l.barLength+2*l.barPad,z=h+g,R=v;z+D>s&&(z=s-D);var E=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);E.exit().on(".drag",null).remove(),E.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),O?(this.vbar=E.attr({rx:l.barRadius,ry:l.barRadius,x:z,y:R,width:D,height:P}),this._vbarYMin=R+P/2,this._vbarTranslateMax=T-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,F=u-.5,N=O?f+D+.5:f+.5,H=d-.5,B=k?p+A+.5:p+.5,j=o._topdefs.selectAll("#"+I).data(k||O?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",I).append("rect"),k||O?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(H),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(B)-Math.floor(H)}),this.container.call(i.setClipUrl,I,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||O){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 U=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(t,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.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)},l.prototype._onBoxDrag=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e-=n.event.dx),this.vbar&&(t-=n.event.dy),this.setTranslate(e,t)},l.prototype._onBoxWheel=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e+=n.event.deltaY),this.vbar&&(t+=n.event.deltaY),this.setTranslate(e,t)},l.prototype._onBarDrag=function(){var e=this.translateX,t=this.translateY;if(this.hbar){var r=e+this._hbarXMin,a=r+this._hbarTranslateMax;e=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=t+this._vbarYMin,l=i+this._vbarTranslateMax;t=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(e,t)},l.prototype.setTranslate=function(e,t){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(e=o.constrain(e||0,0,r),t=o.constrain(t||0,0,n),this.translateX=e,this.translateY=t,this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-t),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+t-.5)}),this.hbar){var a=e/r;this.hbar.call(i.setTranslate,e+a*this._hbarTranslateMax,t)}if(this.vbar){var l=t/n;this.vbar.call(i.setTranslate,e,t+l*this._vbarTranslateMax)}}},{"../../lib":209,"../color":81,"../drawing":103,d3:16}],183:[function(e,t,r){"use strict";t.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"}}},{}],184:[function(e,t,r){"use strict";t.exports={axisRefDescription:function(e,t,r){return["If set to a",e,"axis id (e.g. *"+e+"* or","*"+e+"2*), the `"+e+"` position refers to a",e,"coordinate. If set to *paper*, the `"+e+"`","position refers to the distance from the",t,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",t,"("+r+"). If set to a",e,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",t,"of the domain of that axis: e.g.,","*"+e+"2 domain* refers to the domain of the second",e," axis and a",e,"position of 0.5 refers to the","point between the",t,"and the",r,"of the domain of the","second",e,"axis."].join(" ")}}},{}],185:[function(e,t,r){"use strict";t.exports={INCREASING:{COLOR:"#3D9970",SYMBOL:"\u25b2"},DECREASING:{COLOR:"#FF4136",SYMBOL:"\u25bc"}}},{}],186:[function(e,t,r){"use strict";t.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],187:[function(e,t,r){"use strict";t.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],188:[function(e,t,r){"use strict";t.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],189:[function(e,t,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}},{}],190:[function(e,t,r){"use strict";r.version=e("./version").version,e("es6-promise").polyfill(),e("../build/plotcss"),e("./fonts/mathjax_config")();for(var n=e("./registry"),a=r.register=n.register,i=e("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],193:[function(e,t,r){"use strict";r.isLeftAnchor=function(e){return"left"===e.xanchor||"auto"===e.xanchor&&e.x<=1/3},r.isCenterAnchor=function(e){return"center"===e.xanchor||"auto"===e.xanchor&&e.x>1/3&&e.x<2/3},r.isRightAnchor=function(e){return"right"===e.xanchor||"auto"===e.xanchor&&e.x>=2/3},r.isTopAnchor=function(e){return"top"===e.yanchor||"auto"===e.yanchor&&e.y>=2/3},r.isMiddleAnchor=function(e){return"middle"===e.yanchor||"auto"===e.yanchor&&e.y>1/3&&e.y<2/3},r.isBottomAnchor=function(e){return"bottom"===e.yanchor||"auto"===e.yanchor&&e.y<=1/3}},{}],194:[function(e,t,r){"use strict";var n=e("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(e){return Math.abs(e[1]-e[0])>l-1e-14}function c(e,t){return i(t-e,l)}function u(e,t){if(s(t))return!0;var r,n;t[0](n=a(n,l))&&(n+=l);var i=a(e,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(e,t,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(e,t){return[e*Math.cos(t)+a,i-e*Math.sin(t)]}g?(u=0,f=o,d=l):r=a&&e<=i);var a,i},pathArc:function(e,t,r,n,a){return f(null,e,t,r,n,a,0)},pathSector:function(e,t,r,n,a){return f(null,e,t,r,n,a,1)},pathAnnulus:function(e,t,r,n,a,i){return f(e,t,r,n,a,i,1)}}},{"./mod":216}],195:[function(e,t,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(e){return a.isView(e)&&!(e instanceof i)}function l(e){return n(e)||o(e)}function s(e,t,r){if(l(e)){if(l(e[0])){for(var n=r,a=0;aa.max?t.set(r):t.set(+e)}},integer:{coerceFunction:function(e,t,r,a){e%1||!n(e)||void 0!==a.min&&ea.max?t.set(r):t.set(+e)}},string:{coerceFunction:function(e,t,r,n){if("string"!=typeof e){var a="number"==typeof e;!0!==n.strict&&a?t.set(String(e)):t.set(r)}else n.noBlank&&!e?t.set(r):t.set(e)}},color:{coerceFunction:function(e,t,r){a(e).isValid()?t.set(e):t.set(r)}},colorlist:{coerceFunction:function(e,t,r){Array.isArray(e)&&e.length&&e.every((function(e){return a(e).isValid()}))?t.set(e):t.set(r)}},colorscale:{coerceFunction:function(e,t,r){t.set(o.get(e,r))}},angle:{coerceFunction:function(e,t,r){"auto"===e?t.set("auto"):n(e)?t.set(u(+e,360)):t.set(r)}},subplotid:{coerceFunction:function(e,t,r,n){var a=n.regex||c(r);"string"==typeof e&&a.test(e)?t.set(e):t.set(r)},validateFunction:function(e,t){var r=t.dflt;return e===r||"string"==typeof e&&!!c(r).test(e)}},flaglist:{coerceFunction:function(e,t,r,n){if("string"==typeof e)if(-1===(n.extras||[]).indexOf(e)){for(var a=e.split("+"),i=0;i=n&&e<=a?e:u}if("string"!=typeof e&&"number"!=typeof e)return u;e=String(e);var c=_(t),m=e.charAt(0);!c||"G"!==m&&"g"!==m||(e=e.substr(1),t="");var w=c&&"chinese"===t.substr(0,7),T=e.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),L=Number(T[7]||0),S=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var O;k=Number(k);try{var D=v.getComponentMethod("calendars","getCal")(t);if(w){var P="i"===M.charAt(M.length-1);M=parseInt(M,10),O=D.newDate(k,D.toMonthIndex(k,M,P),A)}else O=D.newDate(k,Number(M),A)}catch(e){return u}return O?(O.toJD()-g)*f+L*d+S*p+C*h:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var z=new Date(Date.UTC(2e3,M,A,L,S));return z.setUTCFullYear(k),z.getUTCMonth()!==M||z.getUTCDate()!==A?u:z.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(e,t){return r.dateTime2ms(e,t)!==u};var T=90*f,k=3*d,M=5*p;function A(e,t,r,n,a){if((t||r||n||a)&&(e+=" "+w(t,2)+":"+w(r,2),(n||a)&&(e+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;e+="."+w(a,i)}return e}r.ms2DateTime=function(e,t,r){if("number"!=typeof e||!(e>=n&&e<=a))return u;t||(t=0);var i,o,l,c,y,x,b=Math.floor(10*s(e+.05,1)),w=Math.round(e-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(e,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(e){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=t=n+f&&e<=a-f))return u;var t=Math.floor(10*s(e+.05,1)),r=new Date(Math.round(e-t/10));return A(i("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+t)},r.cleanDate=function(e,t,n){if(e===u)return t;if(r.isJSDate(e)||"number"==typeof e&&isFinite(e)){if(_(n))return l.error("JS Dates and milliseconds are incompatible with world calendars",e),t;if(!(e=r.ms2DateTimeLocal(+e))&&void 0!==t)return t}else if(!r.isDateTime(e,n))return l.error("unrecognized date",e),t;return e};var L=/%\d?f/g;function S(e,t,r,n){e=e.replace(L,(function(e){var r=Math.min(+e.charAt(1)||6,6);return(t/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(t+.05));if(_(n))try{e=v.getComponentMethod("calendars","worldCalFmt")(e,t,n)}catch(e){return"Invalid"}return r(e)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(e,t,r,n,a,i){if(a=_(a)&&a,!t)if("y"===r)t=i.year;else if("m"===r)t=i.month;else{if("d"!==r)return function(e,t){var r=s(e+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==t){o(t)||(t=0);var a=(100+Math.min(s(e/h,60),C[t])).toFixed(t).substr(1);t>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(e,r)+"\n"+S(i.dayMonthYear,e,n,a);t=i.dayMonth+"\n"+i.year}return S(t,e,n,a)};var O=3*f;r.incrementMonth=function(e,t,r){r=_(r)&&r;var n=s(e,f);if(e=Math.round(e-n),r)try{var a=Math.round(e/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return t%12?i.add(o,t,"m"):i.add(o,t/12,"y"),(o.toJD()-g)*f+n}catch(t){l.error("invalid ms "+e+" in calendar "+r)}var c=new Date(e+O);return c.setUTCMonth(c.getUTCMonth()+t)+n-O},r.findExactDates=function(e,t){for(var r,n,a=0,i=0,l=0,s=0,c=_(t)&&v.getComponentMethod("calendars","getCal")(t),u=0;u1||g<0||g>1?null:{x:e+s*g,y:t+f*g}}function s(e,t,r,n,a){var i=n*e+a*t;if(i<0)return n*n+a*a;if(i>r){var o=n-e,l=a-t;return o*o+l*l}var s=n*t-a*e;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(e,t,r,n,a,i,o,c){if(l(e,t,r,n,a,i,o,c))return 0;var u=r-e,f=n-t,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-e,i-t),s(u,f,h,o-e,c-t),s(d,p,g,e-a,t-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(e,t,r,l){if(e===a&&l===i||(n={},a=e,i=l),n[r])return n[r];var s=e.getPointAtLength(o(r-l/2,t)),c=e.getPointAtLength(o(r+l/2,t)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=e.getPointAtLength(o(r,t)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(e,t,r){var n,a,i=t.left,o=t.right,l=t.top,s=t.bottom,c=0,u=e.getTotalLength(),f=u;function d(t){var r=e.getPointAtLength(t);0===t?n=r:t===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(e,t,r,n){for(var a,i,o,l=(n=n||{}).pathLength||e.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=e.getPointAtLength(0)[r]>e.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":216}],207:[function(e,t,r){"use strict";t.exports=function(e){return e}},{}],208:[function(e,t,r){"use strict";t.exports=function(e,t){if(!t)return e;var r=1/Math.abs(t),n=r>1?(r*e+r*t)/r:e+t,a=String(n).length;if(a>16){var i=String(t).length;if(a>=String(e).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],209:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../constants/numerical"),l=o.FP_SAFE,s=o.BADNUM,c=t.exports={};c.nestedProperty=e("./nested_property"),c.keyedContainer=e("./keyed_container"),c.relativeAttr=e("./relative_attr"),c.isPlainObject=e("./is_plain_object"),c.toLogRange=e("./to_log_range"),c.relinkPrivateKeys=e("./relink_private");var u=e("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=e("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var d=e("./coerce");c.valObjectMeta=d.valObjectMeta,c.coerce=d.coerce,c.coerce2=d.coerce2,c.coerceFont=d.coerceFont,c.coerceHoverinfo=d.coerceHoverinfo,c.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,c.validate=d.validate;var p=e("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var h=e("./search");c.findBin=h.findBin,c.sorterAsc=h.sorterAsc,c.sorterDes=h.sorterDes,c.distinctVals=h.distinctVals,c.roundUp=h.roundUp,c.sort=h.sort,c.findIndexOfMin=h.findIndexOfMin;var g=e("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var v=e("./matrix");c.init2dArray=v.init2dArray,c.transposeRagged=v.transposeRagged,c.dot=v.dot,c.translationMatrix=v.translationMatrix,c.rotationMatrix=v.rotationMatrix,c.rotationXYMatrix=v.rotationXYMatrix,c.apply3DTransform=v.apply3DTransform,c.apply2DTransform=v.apply2DTransform,c.apply2DTransform2=v.apply2DTransform2,c.convertCssMatrix=v.convertCssMatrix,c.inverseTransformMatrix=v.inverseTransformMatrix;var m=e("./angles");c.deg2rad=m.deg2rad,c.rad2deg=m.rad2deg,c.angleDelta=m.angleDelta,c.angleDist=m.angleDist,c.isFullCircle=m.isFullCircle,c.isAngleInsideSector=m.isAngleInsideSector,c.isPtInsideSector=m.isPtInsideSector,c.pathArc=m.pathArc,c.pathSector=m.pathSector,c.pathAnnulus=m.pathAnnulus;var y=e("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=e("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=e("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=e("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=e("./regex");c.counterRegex=w.counter;var T=e("./throttle");c.throttle=T.throttle,c.throttleDone=T.done,c.clearThrottle=T.clear;var k=e("./dom");function M(e){var t={};for(var r in e)for(var n=e[r],a=0;al?s:i(e)?Number(e):s:s},c.isIndex=function(e,t){return!(void 0!==t&&e>=t)&&(i(e)&&e>=0&&e%1==0)},c.noop=e("./noop"),c.identity=e("./identity"),c.repeat=function(e,t){for(var r=new Array(t),n=0;nr?Math.max(r,Math.min(t,e)):Math.max(t,Math.min(r,e))},c.bBoxIntersect=function(e,t,r){return r=r||0,e.left<=t.right+r&&t.left<=e.right+r&&e.top<=t.bottom+r&&t.top<=e.bottom+r},c.simpleMap=function(e,t,r,n,a){for(var i=e.length,o=new Array(i),l=0;l=Math.pow(2,r)?a>10?(c.warn("randstr failed uniqueness"),s):e(t,r,n,(a||0)+1):s},c.OptionControl=function(e,t){e||(e={}),t||(t="opt");var r={optionList:[],_newoption:function(n){n[t]=e,r[n.name]=n,r.optionList.push(n)}};return r["_"+t]=e,r},c.smooth=function(e,t){if((t=Math.round(t)||0)<2)return e;var r,n,a,i,o=e.length,l=2*o,s=2*t-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=e[a]*c[n];u[r]=i}return u},c.syncOrAsync=function(e,t,r){var n;function a(){return c.syncOrAsync(e,t,r)}for(;e.length;)if((n=(0,e.splice(0,1)[0])(t))&&n.then)return n.then(a).then(void 0,c.promiseError);return r&&r(t)},c.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},c.noneOrAll=function(e,t,r){if(e){var n,a=!1,i=!0;for(n=0;n0?t:0}))},c.fillArray=function(e,t,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(e))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var D=/^\w*$/;c.templateString=function(e,t){var r={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,n){var a;return D.test(n)?a=t[n]:(r[n]=r[n]||c.nestedProperty(t,n).get,a=r[n]()),c.isValidTextValue(a)?a:""}))};var P={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return E.apply(P,arguments)};var z={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return E.apply(z,arguments)};var R=/^[:|\|]/;function E(e,t,r){var i=this,o=arguments;t||(t={});var l={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,s,u){var f,d,p,h;for(p=3;p=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var I=2e9;c.seedPseudoRandom=function(){I=2e9},c.pseudoRandom=function(){var e=I;return I=(69069*I+1)%4294967296,Math.abs(I-e)<429496729?c.pseudoRandom():I/4294967296},c.fillText=function(e,t,r){var n=Array.isArray(r)?function(e){r.push(e)}:function(e){r.text=e},a=c.extractOption(e,t,"htx","hovertext");if(c.isValidTextValue(a))return n(a);var i=c.extractOption(e,t,"tx","text");return c.isValidTextValue(i)?n(i):void 0},c.isValidTextValue=function(e){return e||0===e},c.formatPercent=function(e,t){t=t||0;for(var r=(Math.round(100*e*Math.pow(10,t))*Math.pow(.1,t)).toFixed(t)+"%",n=0;n1&&(u=1):u=0,c.strTranslate(a-u*(r+o),i-u*(n+l))+c.strScale(u)+(s?"rotate("+s+(t?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(e,t){var r=c.extendFlat({},t);return r.size=Math.max(t.size,e._fullLayout.uniformtext.minsize||0),r},c.join2=function(e,t,r){var n=e.length;return n>1?e.slice(0,-1).join(t)+r+e[n-1]:e.join(t)}},{"../constants/numerical":188,"./anchor_utils":193,"./angles":194,"./array":195,"./clean_number":196,"./clear_responsive":198,"./coerce":199,"./dates":200,"./dom":201,"./extend":203,"./filter_unique":204,"./filter_visible":205,"./geometry2d":206,"./identity":207,"./increment":208,"./is_plain_object":210,"./keyed_container":211,"./localize":212,"./loggers":213,"./make_trace_groups":214,"./matrix":215,"./mod":216,"./nested_property":217,"./noop":218,"./notifier":219,"./push_unique":222,"./regex":224,"./relative_attr":225,"./relink_private":226,"./search":227,"./stats":229,"./throttle":231,"./to_log_range":232,d3:16,"d3-time-format":14,"fast-isnumeric":18}],210:[function(e,t,r){"use strict";t.exports=function(e){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(e):"[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.prototype}},{}],211:[function(e,t,r){"use strict";var n=e("./nested_property"),a=/^\w*$/;t.exports=function(e,t,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};t&&t.length?(s=n(e,t),l=s.get()):l=e,t=t||"";var u={};if(l)for(o=0;o2)return c[t]=2|c[t],d.set(e,null);if(f){for(o=t;o1){var t=["LOG:"];for(e=0;e1){var r=[];for(e=0;e"),"long")}},i.warn=function(){var e;if(n.logging>0){var t=["WARN:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}},i.error=function(){var e;if(n.logging>0){var t=["ERROR:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}}},{"../plot_api/plot_config":241,"./notifier":219}],214:[function(e,t,r){"use strict";var n=e("d3");t.exports=function(e,t,r){var a=e.selectAll("g."+r.replace(/\s/g,".")).data(t,(function(e){return e[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=e.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(e){e[0][i]=n.select(this)})),a}},{d3:16}],215:[function(e,t,r){"use strict";var n=e("gl-mat4");r.init2dArray=function(e,t){for(var r=new Array(e),n=0;nt/2?e-Math.round(e/t)*t:e}}},{}],217:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./array").isArrayOrTypedArray;function i(e,t){return function(){var r,n,o,l,s,c=e;for(l=0;l/g),s=0;si||c===a||cl)&&(!t||!s(e))}:function(e,t){var s=e[0],c=e[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(e,t){var r=[e[0]],n=0,a=0;function o(o){e.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(e.pop());return{addPt:o,raw:e,filtered:r}}},{"../constants/numerical":188,"./matrix":215}],222:[function(e,t,r){"use strict";t.exports=function(e,t){if(t instanceof RegExp){for(var r=t.toString(),n=0;na.queueLength&&(e.undoQueue.queue.shift(),e.undoQueue.index--))},startSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!0,e.undoQueue.beginSequence=!0},stopSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!1,e.undoQueue.beginSequence=!1},undo:function(e){var t,r;if(e.framework&&e.framework.isPolar)e.framework.undo();else if(!(void 0===e.undoQueue||isNaN(e.undoQueue.index)||e.undoQueue.index<=0)){for(e.undoQueue.index--,t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;r=e.undoQueue.queue.length)){for(t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;rt}function u(e,t){return e>=t}r.findBin=function(e,t,r){if(n(t.start))return r?Math.ceil((e-t.start)/t.size-1e-9)-1:Math.floor((e-t.start)/t.size+1e-9);var i,o,f=0,d=t.length,p=0,h=d>1?(t[d-1]-t[0])/(d-1):1;for(o=h>=0?r?l:s:r?u:c,e+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.log("Long binary search..."),f-1},r.sorterAsc=function(e,t){return e-t},r.sorterDes=function(e,t){return t-e},r.distinctVals=function(e,t){var n,a=(t||{}).unitMinDiff,i=e.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var l=1;a||(l=i[n]-i[0]||1);for(var s,c=l/(n||1)/1e4,u=[],f=0;f<=n;f++){var d=i[f],p=d-s;void 0===s?(u.push(d),s=d):p>c&&(l=Math.min(l,p),u.push(d),s=d)}return{vals:u,minDiff:l}},r.roundUp=function(e,t,r){for(var n,a=0,i=t.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()},r.findIndexOfMin=function(e,t){t=t||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(t)||(t=!1),a(i[0])){for(s=new Array(o),l=0;le.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}},{"./array":195,"fast-isnumeric":18}],230:[function(e,t,r){"use strict";var n=e("d3"),a=e("../lib"),i=a.strTranslate,o=e("../constants/xmlns_namespaces"),l=e("../constants/alignment").LINE_SPACING;function s(e,t){return e.node().getBoundingClientRect()[t]}var c=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(e,t,A){var L=e.text(),C=!e.attr("data-notex")&&"undefined"!=typeof MathJax&&L.match(c),O=n.select(e.node().parentNode);if(!O.empty()){var D=e.attr("class")?e.attr("class").split(" ")[0]:"text";return D+="-math",O.selectAll("svg."+D).remove(),O.selectAll("g."+D+"-group").remove(),e.style("display",null).attr({"data-unformatted":L,"data-math":"N"}),C?(t&&t._promises||[]).push(new Promise((function(t){e.style("display","none");var r=parseInt(e.node().style.fontSize,10),o={fontSize:r};!function(e,t,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":t.fontSize+"px"}).text(e.replace(u,"\\lt ").replace(f,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var t=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",e),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),t,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(C[2],o,(function(n,a,o){O.selectAll("svg."+D).remove(),O.selectAll("g."+D+"-group").remove();var l=n&&n.select("svg");if(!l||!l.node())return P(),void t();var c=O.append("g").classed(D+"-group",!0).attr({"pointer-events":"none","data-unformatted":L,"data-math":"Y"});c.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:D,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=e.node().style.fill||"black",f=l.select("g");f.attr({fill:u,stroke:u});var d=s(f,"width"),p=s(f,"height"),h=+e.attr("x")-d*{start:0,middle:.5,end:1}[e.attr("text-anchor")||"start"],g=-(r||s(e,"height"))/4;"y"===D[0]?(c.attr({transform:"rotate("+[-90,+e.attr("x"),+e.attr("y")]+")"+i(-d/2,g-p/2)}),l.attr({x:+e.attr("x"),y:+e.attr("y")})):"l"===D[0]?l.attr({x:e.attr("x"),y:g-p/2}):"a"===D[0]&&0!==D.indexOf("atitle")?l.attr({x:0,y:g}):l.attr({x:h,y:+e.attr("y")+g-p/2}),A&&A.call(e,c),t(c)}))}))):P(),e}function P(){O.empty()||(D=e.attr("class")+"-math",O.select("svg."+D).remove()),e.text("").style("white-space","pre"),function(e,t){t=t.replace(v," ");var r,i=!1,s=[],c=-1;function u(){c++;var t=document.createElementNS(o.svg,"tspan");n.select(t).attr({class:"line",dy:c*l+"em"}),e.appendChild(t),r=t;var a=s;if(s=[{node:t}],a.length>1)for(var i=1;i doesnt match end tag <"+e+">. Pretending it did match.",t),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",t)}x.test(t)?u():(r=e,s=[{node:e}]);for(var C=t.split(m),O=0;O|>|>)/g;var d={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"},p={sub:"0.3em",sup:"-0.6em"},h={sub:"-0.21em",sup:"0.42em"},g=["http:","https:","mailto:","",void 0,":"],v=r.NEWLINES=/(\r\n?|\n)/g,m=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,x=//i;r.BR_TAG_ALL=//gi;var b=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,_=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,T=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function k(e,t){if(!e)return null;var r=e.match(t),n=r&&(r[3]||r[4]);return n&&S(n)}var M=/(^|;)\s*color:/;r.plainText=function(e,t){for(var r=void 0!==(t=t||{}).len&&-1!==t.len?t.len:1/0,n=void 0!==t.allowedTags?t.allowedTags:["br"],a="...".length,i=e.split(m),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var A={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},L=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function S(e){return e.replace(L,(function(e,t){return("#"===t.charAt(0)?function(e){if(e>1114111)return;var t=String.fromCodePoint;if(t)return t(e);var r=String.fromCharCode;return e<=65535?r(e):r(55232+(e>>10),e%1024+56320)}("x"===t.charAt(1)?parseInt(t.substr(2),16):parseInt(t.substr(1),10)):A[t])||e}))}function C(e,t,r){var n,i,o,l=r.horizontalAlign,s=r.verticalAlign||"top",c=e.node().getBoundingClientRect(),u=t.node().getBoundingClientRect();return i="bottom"===s?function(){return c.bottom-n.height}:"middle"===s?function(){return c.top+(c.height-n.height)/2}:function(){return c.top},o="right"===l?function(){return c.right-n.width}:"center"===l?function(){return c.left+(c.width-n.width)/2}:function(){return c.left},function(){n=this.node().getBoundingClientRect();var e=o()-u.left,t=i()-u.top,l=r.gd||{};if(r.gd){l._fullLayout._calcInverseTransform(l);var s=a.apply3DTransform(l._fullLayout._invTransform)(e,t);e=s[0],t=s[1]}return this.style({top:t+"px",left:e+"px","z-index":1e3}),this}}r.convertEntities=S,r.sanitizeHTML=function(e){e=e.replace(v," ");for(var t=document.createElement("p"),r=t,a=[],i=e.split(m),o=0;oi.ts+t?s():i.timer=setTimeout((function(){s(),i.timer=null}),t)},r.done=function(e){var t=n[e];return t&&t.timer?new Promise((function(e){var r=t.onDone;t.onDone=function(){r&&r(),e(),t.onDone=null}})):Promise.resolve()},r.clear=function(e){if(e)a(n[e]),delete n[e];else for(var t in n)r.clear(t)}},{}],232:[function(e,t,r){"use strict";var n=e("fast-isnumeric");t.exports=function(e,t){if(e>0)return Math.log(e)/Math.LN10;var r=Math.log(Math.min(t[0],t[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(t[0],t[1]))/Math.LN10-6),r}},{"fast-isnumeric":18}],233:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],234:[function(e,t,r){"use strict";t.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"}}},{}],235:[function(e,t,r){"use strict";var n=e("../registry");t.exports=function(e){for(var t,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=e.split("[")[0],l=0;l0&&o.log("Clearing previous rejected promises from queue."),e._promises=[]},r.cleanLayout=function(e){var t,n;e||(e={}),e.xaxis1&&(e.xaxis||(e.xaxis=e.xaxis1),delete e.xaxis1),e.yaxis1&&(e.yaxis||(e.yaxis=e.yaxis1),delete e.yaxis1),e.scene1&&(e.scene||(e.scene=e.scene1),delete e.scene1);var i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(e);for(t=0;t3?(z.x=1.02,z.xanchor="left"):z.x<-2&&(z.x=-.02,z.xanchor="right"),z.y>3?(z.y=1.02,z.yanchor="bottom"):z.y<-2&&(z.y=-.02,z.yanchor="top")),h(e),"rotate"===e.dragmode&&(e.dragmode="orbit"),c.clean(e),e.template&&e.template.layout&&r.cleanLayout(e.template.layout),e},r.cleanData=function(e){for(var t=0;t0)return e.substr(0,t)}r.hasParent=function(e,t){for(var r=b(t);r;){if(r in e)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(e,t,r){for(var n=0;n1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))t.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;t.set(y)}return!g&&(d(v,m),p(e),!0)}var x,b,_,w,T,k,M,A,L=Object.keys(r).map(Number).sort(o),S=t.get(),C=S||[],O=u(m,f).get(),D=[],P=-1,z=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?D.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),O&&O.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,k),-1===P&&(P=_);else for(b=0;b=0;x--)C.splice(D[x],1),O&&O.splice(D[x],1);if(C.length?S||t.set(C):t.set(null),g)return!1;if(d(v,m),h!==a){var R;if(-1===P)R=L;else{for(z=Math.max(C.length,z),R=[],x=0;x=P);x++)R.push(_);for(x=P;x=e.data.length||a<-e.data.length)throw new Error(r+" must be valid indices for gd.data.");if(t.indexOf(a,n+1)>-1||a>=0&&t.indexOf(-e.data.length+a)>-1||a<0&&t.indexOf(e.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function R(e,t,r){if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("currentIndices is a required argument.");if(Array.isArray(t)||(t=[t]),z(e,t,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&z(e,r,"newIndices"),"undefined"!=typeof r&&t.length!==r.length)throw new Error("current and new indices must be of equal length.")}function E(e,t,r,n,i){!function(e,t,r,n){var a=o.isPlainObject(n);if(!Array.isArray(e.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(t))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 i in z(e,r,"indices"),t){if(!Array.isArray(t[i])||t[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==t[i].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")}}(e,t,r,n);for(var s=function(e,t,r,n){var i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=P(r,e.data.length-1),t)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(t,r){e[r]=e[t],delete e[t]}}function U(e,t,r){if(e=o.getGraphDiv(e),T.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var n={};if("string"==typeof t)n[t]=r;else{if(!o.isPlainObject(t))return o.warn("Relayout fail.",t,r),Promise.reject();n=o.extendFlat({},t)}Object.keys(n).length&&(e.changed=!0);var a=W(e,n),i=a.flags;i.calc&&(e.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(k.layoutReplot):Object.keys(n).length&&(q(e,i,a)||d.supplyDefaults(e),i.legend&&l.push(k.doLegend),i.layoutstyle&&l.push(k.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(k.doTicksRelayout),i.modebar&&l.push(k.doModeBar),i.camera&&l.push(k.doCamera),i.colorbars&&l.push(k.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(e,U,[e,a.undoit],U,[e,a.redoit]);var s=o.syncOrAsync(l,e);return s&&s.then||(s=Promise.resolve(e)),s.then((function(){return e.emit("plotly_relayout",a.eventData),e}))}function q(e,t,r){var n=e._fullLayout;if(!t.axrange)return!1;for(var a in t)if("axrange"!==a&&t[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=e.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(e,t){var r=t?function(e){var r=[],n=!0;for(var a in t){var i=h.getFromId(e,a);if(r.push(a),-1!==(i.ticklabelposition||"").indexOf("inside")&&i._anchorAxis&&r.push(i._anchorAxis._id),i._matchGroup)for(var o in i._matchGroup)t[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(e,r,{skipTitle:n})}:function(e){return h.draw(e,"redraw")};e.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(e,t){var r,n,a,i=e.layout,s=e._fullLayout,c=s._guiEditing,d=H(s._preGUI,c),p=Object.keys(t),g=h.list(e),v=o.extendDeepAll({},t),m={};for(V(t),p=Object.keys(t),n=0;n0&&"string"!=typeof z.parts[E];)E--;var I=z.parts[E],F=z.parts[E-1]+"."+I,B=z.parts.slice(0,E).join("."),j=l(e.layout,B).get(),U=l(s,B).get(),q=z.get();if(void 0!==R){k[P]=R,L[P]="reverse"===I?R:N(q);var G=f.getLayoutValObject(s,z.parts);if(G&&G.impliedEdits&&null!==R)for(var W in G.impliedEdits)S(o.relativeAttr(P,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(P))if(R){S("autosize",null);var J="height"===P?"width":"height";S(J,s[J])}else s[P]=e._initialAutoSize[P];else if("autosize"===P)S("width",R?null:s.width),S("height",R?null:s.height);else if(F.match(Z))D(F),l(s,B+"._inputRange").set(null);else if(F.match(Y)){D(F),l(s,B+"._inputRange").set(null);var $=l(s,B).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else F.match(X)&&l(s,B+"._inputDomain").set(null);if("type"===I){C=j;var K="linear"===U.type&&"log"===R,ee="log"===U.type&&"linear"===R;if(K||ee){if(C&&C.range)if(U.autorange)K&&(C.range=C.range[1]>C.range[0]?[1,2]:[2,1]);else{var te=C.range[0],re=C.range[1];K?(te<=0&&re<=0&&S(B+".autorange",!0),te<=0?te=re/1e6:re<=0&&(re=te/1e6),S(B+".range[0]",Math.log(te)/Math.LN10),S(B+".range[1]",Math.log(re)/Math.LN10)):(S(B+".range[0]",Math.pow(10,te)),S(B+".range[1]",Math.pow(10,re)))}else S(B+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[z.parts[0]]&&"radialaxis"===z.parts[1]&&delete s[z.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(e,U,R,S),u.getComponentMethod("images","convertCoords")(e,U,R,S)}else S(B+".autorange",!0),S(B+".range",null);l(s,B+"._inputRange").set(null)}else if(I.match(A)){var ne=l(s,P).get(),ae=(R||{}).type;ae&&"-"!==ae||(ae="linear"),u.getComponentMethod("annotations","convertCoords")(e,ne,ae,S),u.getComponentMethod("images","convertCoords")(e,ne,ae,S)}var ie=w.containerArrayMatch(P);if(ie){r=ie.array,n=ie.index;var oe=ie.property,le=G||{editType:"calc"};""!==n&&""===oe&&(w.isAddVal(R)?L[P]=null:w.isRemoveVal(R)?L[P]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",t)),M.update(_,le),m[r]||(m[r]={});var se=m[r][n];se||(se=m[r][n]={}),se[oe]=R,delete t[P]}else"reverse"===I?(j.range?j.range.reverse():(S(B+".autorange",!0),j.range=[1,0]),U.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===P&&("lasso"===R||"select"===R)&&"lasso"!==q&&"select"!==q||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,z.set(R))}}for(r in m){w.applyContainerArrayChanges(e,d(i,r),m[r],_,d)||(_.plot=!0)}for(var ce in O){var ue=(C=h.getFromId(e,ce))&&C._constraintGroup;if(ue)for(var fe in _.calc=!0,ue)O[fe]||(h.getFromId(e,fe)._constraintShrinkable=!0)}return(Q(e)||t.height||t.width)&&(_.plot=!0),(_.plot||_.calc)&&(_.layoutReplot=!0),{flags:_,rangesAltered:O,undoit:L,redoit:k,eventData:v}}function Q(e){var t=e._fullLayout,r=t.width,n=t.height;return e.layout.autosize&&d.plotAutoSize(e,e.layout,t),t.width!==r||t.height!==n}function J(e,t,n,a){if(e=o.getGraphDiv(e),T.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);o.isPlainObject(t)||(t={}),o.isPlainObject(n)||(n={}),Object.keys(t).length&&(e.changed=!0),Object.keys(n).length&&(e.changed=!0);var i=T.coerceTraceIndices(e,a),l=j(e,o.extendFlat({},t),i),s=l.flags,u=W(e,o.extendFlat({},n)),f=u.flags;(s.calc||f.calc)&&(e.calcdata=void 0),s.clearAxisTypes&&T.clearAxisTypes(e,i,n);var p=[];f.layoutReplot?p.push(k.layoutReplot):s.fullReplot?p.push(r.plot):(p.push(d.previousPromises),q(e,f,u)||d.supplyDefaults(e),s.style&&p.push(k.doTraceStyle),(s.colorbars||f.colorbars)&&p.push(k.doColorBars),f.legend&&p.push(k.doLegend),f.layoutstyle&&p.push(k.layoutStyles),f.axrange&&G(p,u.rangesAltered),f.ticks&&p.push(k.doTicksRelayout),f.modebar&&p.push(k.doModeBar),f.camera&&p.push(k.doCamera),p.push(S)),p.push(d.rehover,d.redrag),c.add(e,J,[e,l.undoit,u.undoit,l.traces],J,[e,l.redoit,u.redoit,l.traces]);var h=o.syncOrAsync(p,e);return h&&h.then||(h=Promise.resolve(e)),h.then((function(){return e.emit("plotly_update",{data:l.eventData,layout:u.eventData}),e}))}function $(e){return function(t){t._fullLayout._guiEditing=!0;var r=e.apply(null,arguments);return t._fullLayout._guiEditing=!1,r}}var K=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],ee=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function te(e,t){for(var r=0;r1;)if(n.pop(),void 0!==(r=l(t,n.join(".")+".uirevision").get()))return r;return t.uirevision}function ne(e,t){for(var r=0;r=a.length?a[0]:a[e]:a}function s(e){return Array.isArray(i)?e>=i.length?i[0]:i[e]:i}function c(e,t){var r=0;return function(){if(e&&++r===t)return e()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){function f(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var t=n._currentFrame=n._frameQueue.shift();if(t){var r=t.name?t.name.toString():null;e._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=t.frameOpts.duration,d.transition(e,t.frame.data,t.frame.layout,T.coerceTraceIndices(e,t.frame.traces),t.frameOpts,t.transitionOpts).then((function(){t.onComplete&&t.onComplete()})),e.emit("plotly_animatingframe",{name:r,frame:t.frame,animation:{frame:t.frameOpts,transition:t.transitionOpts}})}else e.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function p(){e.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var t=function(){n._animationRaf=window.requestAnimationFrame(t),Date.now()-n._lastFrameAt>n._timeToNext&&f()};t()}var h,g,v=0;function m(e){return Array.isArray(a)?v>=a.length?e.transitionOpts=a[v]:e.transitionOpts=a[0]:e.transitionOpts=a,v++,e}var y=[],x=null==t,b=Array.isArray(t);if(!x&&!b&&o.isPlainObject(t))y.push({type:"object",data:m(o.extendFlat({},t))});else if(x||-1!==["string","number"].indexOf(typeof t))for(h=0;h0&&kk)&&M.push(g);y=M}}y.length>0?function(t){if(0!==t.length){for(var a=0;a=0;n--)if(o.isPlainObject(t[n])){var g=t[n].name,v=(u[g]||h[g]||{}).name,m=t[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[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.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(t[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(e,t){return e.index>t.index?-1:e.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+e._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=t[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[e,l],p=[e,i];return c&&c.add(e,s,f,u,p),d.modifyFrames(e,i)},r.addTraces=function e(t,n,a){t=o.getGraphDiv(t);var i,l,s=[],u=r.deleteTraces,f=e,d=[t,s],p=[t,n];for(function(e,t,r){var n,a;if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("traces must be defined.");for(Array.isArray(t)||(t=[t]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===e.dimensions){if(r++,t.length===r)return e;var o=t[r];if(!_(o))return!1;e=i[a][o]}else e=i[a]}else e=i}}return e}function _(e){return e===Math.round(e)&&e>=0}function w(){var e,t,r={};for(e in h(r,o),n.subplotsRegistry){if((t=n.subplotsRegistry[e]).layoutAttributes)if(Array.isArray(t.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[t[2]],l=3}else if("area"===e.type)a=u[o];else{var f=e._module;if(f||(f=(n.modules[e.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,t,l)},r.getLayoutValObject=function(e,t){return b(function(e,t){var r,a,i,l,s=e._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=t+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(e,t){o?n.nestedProperty(l[s],e).set(t):l[s+"."+e]=t}function f(){var e=l;return c(),e}return c(),{modifyBase:function(e,t){l[e]=t},modifyItem:u,getUpdateObj:f,applyUpdate:function(t,r){t&&u(t,r);var a=f();for(var i in a)n.nestedProperty(e,i).set(a[i])}}}},{"../lib":209,"../plots/attributes":250}],244:[function(e,t,r){"use strict";var n=e("d3"),a=e("../registry"),i=e("../plots/plots"),o=e("../lib"),l=e("../lib/clear_gl_canvases"),s=e("../components/color"),c=e("../components/drawing"),u=e("../components/titles"),f=e("../components/modebar"),d=e("../plots/cartesian/axes"),p=e("../constants/alignment"),h=e("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=e("../plots/cartesian/autorange").doAutoRange;function y(e,t,r){for(var n=0;n=e[1]||a[1]<=e[0])&&(i[0]t[0]))return!0}return!1}function x(e){var t,a,l,u,h,g,v=e._fullLayout,m=v._size,x=m.p,_=d.list(e,"",!0);if(v._paperdiv.style({width:e._context.responsive&&v.autosize&&!e._context._hasZeroWidth&&!e.layout.width?"100%":v.width+"px",height:e._context.responsive&&v.autosize&&!e._context._hasZeroHeight&&!e.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),e._context.setBackground(e,v.paper_bgcolor),r.drawMainTitle(e),f.manage(e),!v._has("cartesian"))return i.previousPromises(e);function T(e,t,r){var n=e._lw/2;return"x"===e._id.charAt(0)?t?"top"===r?t._offset-x-n:t._offset+t._length+x+n:m.t+m.h*(1-(e.position||0))+n%1:t?"right"===r?t._offset+t._length+x+n:t._offset-x-n:m.l+m.w*(e.position||0)+n%1}for(t=0;t<_.length;t++){var k=(u=_[t])._anchorAxis;u._linepositions={},u._lw=c.crispRound(e,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,O=l.yaxis.domain,D=l.plotgroup;if(y(C,O,L)){var P=D.node(),z=l.bg=o.ensureSingle(D,"rect","bg");P.insertBefore(z.node(),P.childNodes[0]),A.push(a)}else D.select("rect.bg").remove(),L.push([C,O]),S||(M.push(a),A.push(a))}var R,E,I,F,N,H,B,j,V,U,q,G,Z,Y=v._bgLayer.selectAll(".bg").data(M);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(e){v._plots[e].bg=n.select(this)})),t=0;tT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function e(t,r){for(var n in t)if("_"!==n.charAt(0)){var i=t[n],o=g(t,n,r);a(i)?(Array.isArray(t)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),e(i,o)):Array.isArray(i)&&v(i)&&e(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":209,"../plots/attributes":250,"../plots/plots":288,"./plot_config":241,"./plot_schema":242,"./plot_template":243}],246:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./plot_api"),i=e("../plots/plots"),o=e("../lib"),l=e("../snapshot/helpers"),s=e("../snapshot/tosvg"),c=e("../snapshot/svgtoimg"),u=e("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};t.exports=function(e,t){var r,d,p,h;function g(e){return!(e in t)||o.validate(t[e],f[e])}if(t=t||{},o.isPlainObject(e)?(r=e.data||[],d=e.layout||{},p=e.config||{},h={}):(e=o.getGraphDiv(e),r=o.extendDeep([],e.data),d=o.extendDeep({},e.layout),p=e._context,h=e._fullLayout||{}),!g("width")&&null!==t.width||!g("height")&&null!==t.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Export format is not "+o.join2(f.format.values,", "," or ")+".");var v={};function m(e,r){return o.coerce(t,v,f,e,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),T=m("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},d);x?M.width=x:null===t.width&&n(h.width)&&(M.width=h.width),b?M.height=b:null===t.height&&n(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(k);function S(){return new Promise((function(e){setTimeout(e,l.getDelay(k._fullLayout))}))}function C(){return new Promise((function(e,t){var r=s(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function d(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),e(T?p:l.encodeJSON(p))}if(d(),"svg"===y)return e(T?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(e).catch(t)}))}return new Promise((function(e,t){a.plot(k,r,M,A).then(L).then(S).then(C).then((function(t){e(function(e){return T?e.replace(l.IMAGE_URL_PREFIX,""):e}(t))})).catch((function(e){t(e)}))}))}},{"../lib":209,"../plots/plots":288,"../snapshot/helpers":300,"../snapshot/svgtoimg":302,"../snapshot/tosvg":304,"../version":437,"./plot_api":240,"fast-isnumeric":18}],247:[function(e,t,r){"use strict";var n=e("../lib"),a=e("../plots/plots"),i=e("./plot_schema"),o=e("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(e,t,r,a,i,o){o=o||[];for(var f=Object.keys(e),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,O=x.length,D=Array.isArray(k);if(D&&(O=Math.min(O,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var P=x[A].length;for(M=0;M<(D?Math.min(P,k[A].length):P);M++)L=D?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&Math.round(f)===f))return a;c=f}for(var d=t.calendar,p="start"===s,h="end"===s,g=e[r+"period0"],v=i(g,d)||0,m=[],y=a.length,x=0;xT;)w=o(w,-c,d);for(;w<=T;)w=o(w,c,d);_=o(w,-c,d)}else{for(w=v+(b=Math.round((T-v)/u))*u;w>T;)w-=u;for(;w<=T;)w+=u;_=w-u}m[x]=p?_:h?w:(_+w)/2}return m}},{"../../constants/numerical":188,"../../lib":209,"fast-isnumeric":18}],252:[function(e,t,r){"use strict";t.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],253:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("../../constants/numerical").FP_SAFE,o=e("../../registry"),l=e("./axis_ids").getFromId;function s(e,t){var r,n,i=[],o=u(t,0),l=u(t,1),s=f(e,t),d=s.min,p=s.max;if(0===d.length||0===p.length)return a.simpleMap(t.range,t.r2l);var h=d[0].val,g=p[0].val;for(r=1;r0&&((w=L-o(y)-l(x))>S?T/w>C&&(b=y,_=x,C=T/w):T/L>C&&(b={val:y.val,pad:0},_={val:x.val,pad:0},C=T/L));if(h===g){var O=h-1,D=h+1;if(M)if(0===h)i=[0,1];else{var P=(h>0?p:d).reduce((function(e,t){return Math.max(e,l(t))}),0),z=h/(1-Math.min(.5,P/L));i=h>0?[0,z]:[z,0]}else i=A?[Math.max(0,O),Math.max(1,D)]:[O,D]}else M?(b.val>=0&&(b={val:0,pad:0}),_.val<=0&&(_={val:0,pad:0})):A&&(b.val-C*o(b)<0&&(b={val:0,pad:0}),_.val<=0&&(_={val:1,pad:0})),C=(_.val-b.val-c(t,y.val,x.val))/(L-o(b)-l(_)),i=[b.val-C*o(b),_.val+C*l(_)];return v&&i.reverse(),a.simpleMap(i,t.l2r||Number)}function c(e,t,r){var n=0;if(e.rangebreaks)for(var a=e.locateBreaks(t,r),i=0;i0?r.ppadplus:r.ppadminus)||r.ppad||0),L=M((e._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(h=1/0,v=-1/0,w)for(a=0;a0&&(h=o),o>v&&o-i&&(h=o),o>v&&o=P;a--)D(a);return{min:m,max:y,opts:r}},concatExtremes:f};function f(e,t,r){var n,a,i,o=t._id,s=e._fullData,c=e._fullLayout,u=[],h=[];function g(e,t){for(n=0;n=r&&(c.extrapad||!o)){l=!1;break}a(t,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(e.splice(s,1),s--)}if(l){var u=i&&0===t;e.push({val:t,pad:u?0:r,extrapad:!u&&o})}}function g(e){return n(e)&&Math.abs(e)=t}},{"../../constants/numerical":188,"../../lib":209,"../../registry":296,"./axis_ids":257,"fast-isnumeric":18}],254:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib"),s=l.strTranslate,c=e("../../lib/svg_text_utils"),u=e("../../components/titles"),f=e("../../components/color"),d=e("../../components/drawing"),p=e("./layout_attributes"),h=e("./clean_ticks"),g=e("../../constants/numerical"),v=g.ONEMAXYEAR,m=g.ONEAVGYEAR,y=g.ONEMINYEAR,x=g.ONEMAXQUARTER,b=g.ONEAVGQUARTER,_=g.ONEMINQUARTER,w=g.ONEMAXMONTH,T=g.ONEAVGMONTH,k=g.ONEMINMONTH,M=g.ONEWEEK,A=g.ONEDAY,L=A/2,S=g.ONEHOUR,C=g.ONEMIN,O=g.ONESEC,D=g.MINUS_SIGN,P=g.BADNUM,z=e("../../constants/alignment"),R=z.MID_SHIFT,E=z.CAP_SHIFT,I=z.LINE_SPACING,F=z.OPPOSITE_SIDE,N=t.exports={};N.setConvert=e("./set_convert");var H=e("./axis_autotype"),B=e("./axis_ids");N.id2name=B.id2name,N.name2id=B.name2id,N.cleanId=B.cleanId,N.list=B.list,N.listIds=B.listIds,N.getFromId=B.getFromId,N.getFromTrace=B.getFromTrace;var j=e("./autorange");N.getAutoRange=j.getAutoRange,N.findExtremes=j.findExtremes;function V(e){var t=1e-4*(e[1]-e[0]);return[e[0]-t,e[1]+t]}N.coerceRef=function(e,t,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||("string"==typeof i?i:i[0])),i||(i=a),s=s.concat(s.map((function(e){return e+" domain"}))),u[c]={valType:"enumerated",values:s.concat(i?"string"==typeof i?[i]:i:[]),dflt:a},l.coerce(e,t,u,c)},N.getRefType=function(e){return void 0===e?e:"paper"===e?"paper":"pixel"===e?"pixel":/( domain)$/.test(e)?"domain":"range"},N.coercePosition=function(e,t,r,n,a,i){var o,s;if("range"!==N.getRefType(n))o=l.ensureNumber,s=r(a,i);else{var c=N.getFromId(t,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}e[a]=o(s)},N.cleanPosition=function(e,t,r){return("paper"===r||"pixel"===r?l.ensureNumber:N.getFromId(t,r).cleanPos)(e)},N.redrawComponents=function(e,t){t=t||N.listIds(e);var r=e._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-e._forceTick0)/e._minDtick%1+1.000001)%1>2e-6)&&(e._minDtick=0)):e._minDtick=0},N.saveRangeInitial=function(e,t){for(var r=N.list(e,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;e+=e+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?e=N.tickIncrement(e,"M6","reverse")+1.5*A:i.exactMonths>.8?e=N.tickIncrement(e,"M1","reverse")+15.5*A:e-=L;var s=N.tickIncrement(e,r);if(s<=n)return s}return e}(y,e,m,c,i)),v=y,0;v<=u;)v=N.tickIncrement(v,m,!1,i);return{start:t.c2r(y,0,i),end:t.c2r(v,0,i),size:m,_dataSpan:u-c}},N.prepTicks=function(e,t){var r=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if(e._dtickInit=e.dtick,e._tick0Init=e.tick0,"auto"===e.tickmode||!e.dtick){var n,i=e.nticks;i||("category"===e.type||"multicategory"===e.type?(n=e.tickfont?1.2*(e.tickfont.size||12):15,i=e._length/n):(n="y"===e._id.charAt(0)?40:80,i=l.constrain(e._length/n,4,9)+1),"radialaxis"===e._name&&(i*=2)),"array"===e.tickmode&&(i*=100),e._roughDTick=Math.abs(r[1]-r[0])/i,N.autoTicks(e,e._roughDTick),e._minDtick>0&&e.dtick<2*e._minDtick&&(e.dtick=e._minDtick,e.tick0=e.l2r(e._forceTick0))}"period"===e.ticklabelmode&&function(e){var t;function r(){return!(a(e.dtick)||"M"!==e.dtick.charAt(0))}var n=r(),i=N.getTickFormat(e);if(i){var o=e._dtickInit!==e.dtick;/%[fLQsSMX]/.test(i)||(/%[HI]/.test(i)?(t=S,o&&!n&&e.dticki&&f=o:p<=o;p=N.tickIncrement(p,e.dtick,s,e.calendar)){if(e.rangebreaks&&!s){if(p=u)break}if(C.length>g||p===O)break;O=p;var D=!1;f&&p!==(0|p)&&(D=!0),C.push({minor:D,value:p})}if(d&&function(e,t,r){for(var n=0;n0?(i=n-1,o=n):(i=n,o=n);var l,s=e[i].value,c=e[o].value,u=Math.abs(c-s),f=r||u,d=0;f>=y?d=u>=y&&u<=v?u:m:r===b&&f>=_?d=u>=_&&u<=x?u:b:f>=k?d=u>=k&&u<=w?u:T:r===M&&f>=M?d=M:f>=A?d=A:r===L&&f>=L?d=L:r===S&&f>=S&&(d=S),d>=u&&(d=u,l=!0);var p=a+d;if(t.rangebreaks&&d>0){for(var h=0,g=0;g<84;g++){var C=(g+.5)/84;t.maskBreaks(a*(1-C)+C*p)!==P&&h++}(d*=h/84)||(e[n].drop=!0),l&&u>M&&(d=u)}(d>0||0===n)&&(e[n].periodX=a+d/2)}}(C,e,e._definedDelta),e.rangebreaks){var z="y"===e._id.charAt(0),R=1;"auto"===e.tickmode&&(R=e.tickfont?e.tickfont.size:12);var E=NaN;for(h=C.length-1;h>-1;h--)if(C[h].drop)C.splice(h,1);else{C[h].value=be(C[h].value,e);var I=e.c2p(C[h].value);(z?E>I-R:Eu||Hu&&(F.periodX=u),H10||"01-01"!==n.substr(5)?e._tickround="d":e._tickround=+t.substr(1)%12==0?"y":"m";else if(t>=A&&i<=10||t>=15*A)e._tickround="d";else if(t>=C&&i<=16||t>=S)e._tickround="M";else if(t>=O&&i<=19||t>=C)e._tickround="S";else{var o=e.l2r(r+t).replace(/^-/,"").length;e._tickround=Math.max(i,o)-20,e._tickround<0&&(e._tickround=4)}}else if(a(t)||"L"===t.charAt(0)){var l=e.range.map(e.r2d||Number);a(t)||(t=Number(t.substr(1))),e._tickround=2-Math.floor(Math.log(t)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01),u=void 0===e.minexponent?3:e.minexponent;Math.abs(c)>u&&(ae(e.exponentformat)&&!ie(c)?e._tickexponent=3*Math.round((c-1)/3):e._tickexponent=c)}else e._tickround=null}function re(e,t,r){var n=e.tickfont||{};return{x:t,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}N.autoTicks=function(e,t){var r;function n(e){return Math.pow(e,Math.floor(Math.log(t)/Math.LN10))}if("date"===e.type){e.tick0=l.dateTick0(e.calendar,0);var i=2*t;if(i>m)t/=m,r=n(10),e.dtick="M"+12*ee(t,r,Y);else if(i>T)t/=T,e.dtick="M"+ee(t,1,X);else if(i>A){e.dtick=ee(t,A,e._hasDayOfWeekBreaks?[1,2,7,14]:Q);var o=N.getTickFormat(e),s="period"===e.ticklabelmode;s&&(e._rawTick0=e.tick0),/%[uVW]/.test(o)?e.tick0=l.dateTick0(e.calendar,2):e.tick0=l.dateTick0(e.calendar,1),s&&(e._dowTick0=e.tick0)}else i>S?e.dtick=ee(t,S,X):i>C?e.dtick=ee(t,C,W):i>O?e.dtick=ee(t,O,W):(r=n(10),e.dtick=ee(t,r,Y))}else if("log"===e.type){e.tick0=0;var c=l.simpleMap(e.range,e.r2l);if(t>.7)e.dtick=Math.ceil(t);else if(Math.abs(c[1]-c[0])<1){var u=1.5*Math.abs((c[1]-c[0])/t);t=Math.abs(Math.pow(10,c[1])-Math.pow(10,c[0]))/u,r=n(10),e.dtick="L"+ee(t,r,Y)}else e.dtick=t>.3?"D2":"D1"}else"category"===e.type||"multicategory"===e.type?(e.tick0=0,e.dtick=Math.ceil(Math.max(t,1))):xe(e)?(e.tick0=0,r=1,e.dtick=ee(t,r,K)):(e.tick0=0,r=n(10),e.dtick=ee(t,r,Y));if(0===e.dtick&&(e.dtick=1),!a(e.dtick)&&"string"!=typeof e.dtick){var f=e.dtick;throw e.dtick=1,"ax.dtick error: "+String(f)}},N.tickIncrement=function(e,t,r,i){var o=r?-1:1;if(a(t))return l.increment(e,o*t);var s=t.charAt(0),c=o*Number(t.substr(1));if("M"===s)return l.incrementMonth(e,c,i);if("L"===s)return Math.log(Math.pow(10,e)+c)/Math.LN10;if("D"===s){var u="D2"===t?$:J,f=e+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(t)},N.tickFirst=function(e,t){var r=e.r2l||Number,i=l.simpleMap(e.range,r,void 0,void 0,t),o=i[1]"+s,e._prevDateHead=s));t.text=c}(e,o,r,c):"log"===u?function(e,t,r,n,i){var o=e.dtick,s=t.x,c=e.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)t.text=oe(Math.pow(10,s),e,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=e.exponentformat;"power"===p||ae(p)&&ie(f)?(t.text=0===f?1:1===f?"10":"10"+(f>1?"":D)+d+"",t.fontSize*=1.25):("e"===p||"E"===p)&&d>2?t.text="1"+p+(f>0?"+":D)+d:(t.text=oe(Math.pow(10,s),e,"","fakehover"),"D1"===o&&"y"===e._id.charAt(0)&&(t.dy-=t.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);t.text=String(Math.round(Math.pow(10,l.mod(s,1)))),t.fontSize*=.75}if("D1"===e.dtick){var h=String(t.text).charAt(0);"0"!==h&&"1"!==h||("y"===e._id.charAt(0)?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(s<0?.5:.25)))}}(e,o,0,c,g):"category"===u?function(e,t){var r=e._categories[Math.round(t.x)];void 0===r&&(r="");t.text=String(r)}(e,o):"multicategory"===u?function(e,t,r){var n=Math.round(t.x),a=e._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?t.text=o+" - "+i:(t.text=i,t.text2=o)}(e,o,r):xe(e)?function(e,t,r,n,a){if("radians"!==e.thetaunit||r)t.text=oe(t.x,e,a,n);else{var i=t.x/180;if(0===i)t.text="0";else{var o=function(e){function t(e,t){return Math.abs(e-t)<=1e-6}var r=function(e){for(var r=1;!t(Math.round(e*r)/r,e);)r*=10;return r}(e),n=e*r,a=Math.abs(function e(r,n){return t(n,0)?r:e(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)t.text=oe(l.deg2rad(t.x),e,a,n);else{var s=t.x<0;1===o[1]?1===o[0]?t.text="\u03c0":t.text=o[0]+"\u03c0":t.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(t.text=D+t.text)}}}}(e,o,r,c,g):function(e,t,r,n,a){"never"===a?a="":"all"===e.showexponent&&Math.abs(t.x/e.dtick)<1e-6&&(a="hide");t.text=oe(t.x,e,a,n)}(e,o,0,c,g),n||(e.tickprefix&&!h(e.showtickprefix)&&(o.text=e.tickprefix+o.text),e.ticksuffix&&!h(e.showticksuffix)&&(o.text+=e.ticksuffix)),"boundaries"===e.tickson||e.showdividers){var v=function(t){var r=e.l2p(t);return r>=0&&r<=e._length?t:null};o.xbnd=[v(o.x-.5),v(o.x+e.dtick-.5)]}return o},N.hoverLabelText=function(e,t,r){if(r!==P&&r!==t)return N.hoverLabelText(e,t)+" - "+N.hoverLabelText(e,r);var n="log"===e.type&&t<=0,a=N.tickText(e,e.c2l(n?-t:t),"hover").text;return n?0===t?"0":D+a:a};var ne=["f","p","n","\u03bc","m","","k","M","G","T"];function ae(e){return"SI"===e||"B"===e}function ie(e){return e>14||e<-15}function oe(e,t,r,n){var i=e<0,o=t._tickround,s=r||t.exponentformat||"B",c=t._tickexponent,u=N.getTickFormat(t),f=t.separatethousands;if(n){var d={exponentformat:s,minexponent:t.minexponent,dtick:"none"===t.showexponent?t.dtick:a(e)&&Math.abs(e)||1,range:"none"===t.showexponent?t.range.map(t.r2d):[0,e||1]};te(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,t.hoverformat&&(u=t.hoverformat)}if(u)return t._numFormat(u)(e).replace(/-/g,D);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(e=Math.abs(e))"+p+"":"B"===s&&9===c?e+="B":ae(s)&&(e+=ne[c/3+5]));return i?D+e:e}function le(e,t){for(var r=[],n={},a=0;a1&&r=a.min&&e=0,i=u(e,t[1])<=0;return(r||a)&&(n||i)}if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":for(t=0;t=o(a)))){r=n;break}break;case"log":for(t=0;t0?r.bottom-f:0,d)))),t.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=t._depth:(n[s]=t._depth=Math.max(r.width>0?f-r.top:0,d),p.reverse()),r.width>0){var v=r.right-(t._offset+t._length);v>0&&(n.xr=1,n.r=v);var m=t._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=t._depth=Math.max(r.height>0?f-r.left:0,d):(n[s]=t._depth=Math.max(r.height>0?r.right-f:0,d),p.reverse()),r.height>0){var y=r.bottom-(t._offset+t._length);y>0&&(n.yb=0,n.b=y);var x=t._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===t.anchor?t.position:t._anchorAxis.domain[p[0]],t.title.text!==c._dfltTitle[h]&&(n[s]+=ue(t)+(t.title.standoff||0)),t.mirror&&"free"!==t.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[u]=t.linewidth,t.mirror&&!0!==t.mirror&&(a[u]+=d),!0===t.mirror||"ticks"===t.mirror?a[g]=t._anchorAxis.domain[p[1]]:"all"!==t.mirror&&"allticks"!==t.mirror||(a[g]=[t._counterDomainMin,t._counterDomainMax][p[1]]))}J&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(e,t)),i.autoMargin(e,pe(t),n),i.autoMargin(e,he(t),a),i.autoMargin(e,ge(t),l)})),r.skipTitle||J&&"bottom"===t.side||W.push((function(){return function(e,t){var r,n=e._fullLayout,a=t._id,i=a.charAt(0),o=t.title.font.size;if(t.title.hasOwnProperty("standoff"))r=t._depth+t.title.standoff+ue(t);else{if("multicategory"===t.type)r=t._depth;else{r=10+1.5*o+(t.linewidth?t.linewidth-1:0)}r+="x"===i?"top"===t.side?o*(t.showticklabels?1:0):o*(t.showticklabels?1.5:.5):"right"===t.side?o*(t.showticklabels?1:.5):o*(t.showticklabels?.5:0)}var l,s,c,f,p=N.getPxPosition(e,t);"x"===i?(s=t._offset+t._length/2,c="top"===t.side?p-r:p+r):(c=t._offset+t._length/2,s="right"===t.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==t.type){var h=t._selections[t._id+"tick"];if(f={selection:h,side:t.side},h&&h.node()&&h.node().parentNode){var g=d.getTranslate(h.node().parentNode);f.offsetLeft=g.x,f.offsetTop=g.y}t.title.hasOwnProperty("standoff")&&(f.pad=0)}return u.draw(e,a+"title",{propContainer:t,propName:t._name+".title.text",placeholder:n._dfltTitle[i],avoid:f,transform:l,attributes:{x:s,y:c,"text-anchor":"middle"}})}(e,t)})),l.syncOrAsync(W)}}function $(e){var r=p+(e||"tick");return w[r]||(w[r]=function(e,t){var r,n,a,i;e._selections[t].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,e._selections[t].each((function(){var e=de(this),t=d.bBox(e.node().parentNode);r=Math.min(r,t.top),n=Math.max(n,t.bottom),a=Math.min(a,t.left),i=Math.max(i,t.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(t,r)),w[r]}},N.getTickSigns=function(e){var t=e._id.charAt(0),r={x:"top",y:"right"}[t],n=e.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==e.ticks==("x"===t)&&(a=a.map((function(e){return-e}))),e.side&&a.push({l:-1,t:-1,r:1,b:1}[e.side.charAt(0)]),a},N.makeTransTickFn=function(e){return"x"===e._id.charAt(0)?function(t){return s(e._offset+e.l2p(t.x),0)}:function(t){return s(0,e._offset+e.l2p(t.x))}},N.makeTransTickLabelFn=function(e){var t=function(e){var t=e.ticklabelposition||"",r=function(e){return-1!==t.indexOf(e)},n=r("top"),a=r("left"),i=r("right"),o=r("bottom"),l=r("inside"),s=o||a||n||i;if(!s&&!l)return[0,0];var c=e.side,u=s?(e.tickwidth||0)/2:0,f=3,d=e.tickfont?e.tickfont.size:12;(o||n)&&(u+=d*E,f+=(e.linewidth||0)/2);(a||i)&&(u+=(e.linewidth||0)/2,f+=3);l&&"top"===c&&(f-=d*(1-E));(a||n)&&(u=-u);"bottom"!==c&&"right"!==c||(f=-f);return[s?u:0,l?f:0]}(e),r=t[0],n=t[1];return"x"===e._id.charAt(0)?function(t){return s(r+e._offset+e.l2p(se(t)),n)}:function(t){return s(n,r+e._offset+e.l2p(se(t)))}},N.makeTickPath=function(e,t,r,n){n=void 0!==n?n:e.ticklen;var a=e._id.charAt(0),i=(e.linewidth||1)/2;return"x"===a?"M0,"+(t+i*r)+"v"+n*r:"M"+(t+i*r)+",0h"+n*r},N.makeLabelFns=function(e,t,r){var n=e.ticklabelposition||"",i=function(e){return-1!==n.indexOf(e)},o=i("top"),s=i("left"),c=i("right"),u=i("bottom")||s||o||c,f=i("inside"),d="inside"===n&&"inside"===e.ticks||!f&&"outside"===e.ticks&&"boundaries"!==e.tickson,p=0,h=0,g=d?e.ticklen:0;if(f?g*=-1:u&&(g=0),d&&(p+=g,r)){var v=l.deg2rad(r);p=g*Math.cos(v)+1,h=g*Math.sin(v)}e.showticklabels&&(d||e.showline)&&(p+=.2*e.tickfont.size);var m,y,x,b,_,w={labelStandoff:p+=(e.linewidth||1)/2*(f?-1:1),labelShift:h},T=0,k=e.side,M=e._id.charAt(0),A=e.tickangle;if("x"===M)b=(_=!f&&"bottom"===k||f&&"top"===k)?1:-1,f&&(b*=-1),m=h*b,y=t+p*b,x=_?1:-.2,90===Math.abs(A)&&(f?x+=R:x=-90===A&&"bottom"===k?E:90===A&&"top"===k?R:.5,T=R/2*(A/90)),w.xFn=function(e){return e.dx+m+T*e.fontSize},w.yFn=function(e){return e.dy+y+e.fontSize*x},w.anchorFn=function(e,t){if(u){if(s)return"end";if(c)return"start"}return a(t)&&0!==t&&180!==t?t*b<0!==f?"end":"start":"middle"},w.heightFn=function(t,r,n){return r<-60||r>60?-.5*n:"top"===e.side!==f?-n:0};else if("y"===M){if(b=(_=!f&&"left"===k||f&&"right"===k)?1:-1,f&&(b*=-1),m=p,y=h*b,x=0,f||90!==Math.abs(A)||(x=-90===A&&"left"===k||90===A&&"right"===k?E:.5),f){var L=a(A)?+A:0;if(0!==L){var S=l.deg2rad(L);T=Math.abs(Math.sin(S))*E*b,x=0}}w.xFn=function(e){return e.dx+t-(m+e.fontSize*x)*b+T*e.fontSize},w.yFn=function(e){return e.dy+y+e.fontSize*R},w.anchorFn=function(e,t){return a(t)&&90===Math.abs(t)?"middle":_?"end":"start"},w.heightFn=function(t,r,n){return"right"===e.side&&(r*=-1),r<-30?-n:r<30?-.5*n:0}}return w},N.drawTicks=function(e,t,r){r=r||{};var n=t._id+"tick",a=r.vals;"period"===t.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(t.ticks?a:[],ce);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(f.stroke,t.tickcolor).style("stroke-width",d.crispRound(e,t.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},N.drawGrid=function(e,t,r){r=r||{};var n=t._id+"grid",a=r.vals,i=r.counterAxis;if(!1===t.showgrid)a=[];else if(i&&N.shouldShowZeroLine(e,t,i))for(var o="array"===t.tickmode,l=0;lo||a.lefto||a.top+(t.tickangle?0:e.fontSize/4)1)for(n=1;n2*o}(a,t))return"date";var v="strict"!==r.autotypenumbers;return function(e,t){for(var r=e.length,n=f(r),a=0,o=0,l={},u=0;u2*a}(a,v)?"category":function(e,t){for(var r=e.length,n=0;n=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(t.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(t.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(t.enabled=!1);t.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(t.enabled=!1);if((c=+c)<0||c>24)return void(t.enabled=!1);t.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(t.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(e.substr(1)||1)-+(t.substr(1)||1)},r.ref2id=function(e){return!!/^[xyz]/.test(e)&&e.split(" ")[0]}},{"../../registry":296,"./constants":260}],258:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){if("category"===t.type){var a,i=e.categoryarray,o=Array.isArray(i)&&i.length>0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=t.categoryorder="trace"),"trace"===s?t._initialCategories=[]:"array"===s?t._initialCategories=l.slice():(l=function(e,t){var r,n,a,i=t.dataAttr||e._id.charAt(0),o={};if(t.axData)r=t.axData;else for(r=[],n=0;nn?a.substr(n):i.substr(r))+o:a+i+e*t:o}function v(e,t){for(var r=t._size,n=r.h/r.w,a={},i=Object.keys(e),o=0;oc*x)||T)for(r=0;rz&&FD&&(D=F);d/=(D-O)/(2*P),O=s.l2r(O),D=s.l2r(D),s.range=s._input.range=L=0?Math.min(e,.9):1/(1/Math.max(e,-.3)+3.222))}function N(e,t,r,n,a){return e.append("path").attr("class","zoombox").style({fill:t>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform",s(r,n)).attr("d",a+"Z")}function H(e,t,r){return e.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("transform",s(t,r)).attr("d","M0,0Z")}function B(e,t,r,n,a,i){e.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),j(e,t,a,i)}function j(e,t,r,n){r||(e.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),t.transition().style("opacity",1).duration(200))}function V(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function U(e){D&&e.data&&e._context.showTips&&(l.notifier(l._(e,"Double-click to zoom back out"),"long"),D=!1)}function q(e){var t=Math.floor(Math.min(e.b-e.t,e.r-e.l,O)/2);return"M"+(e.l-3.5)+","+(e.t-.5+t)+"h3v"+-t+"h"+t+"v-3h-"+(t+3)+"ZM"+(e.r+3.5)+","+(e.t-.5+t)+"h-3v"+-t+"h"+-t+"v-3h"+(t+3)+"ZM"+(e.r+3.5)+","+(e.b+.5-t)+"h-3v"+t+"h"+-t+"v3h"+(t+3)+"ZM"+(e.l-3.5)+","+(e.b+.5-t)+"h3v"+t+"h"+t+"v3h-"+(t+3)+"Z"}function G(e,t,r,n,a){for(var i,o,s,c,u=!1,f={},d={},p=(a||{}).xaHash,h=(a||{}).yaHash,g=0;g=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(V(a),2!==e||ve||Ue(),ge)i.indexOf("select")>-1&&A(r,a,W,Q,t.id,Oe),i.indexOf("event")>-1&&d.click(a,r,t.id);else if(1===e&&ve){var l=h?P:D,s="s"===h||"w"===v?0:1,u=l._name+".range["+s+"]",f=function(e,t){var r,a=e.range[t],i=Math.abs(a-e.range[1-t]);return"date"===e.type?a:"log"===e.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,s),p="left",g="middle";if(l.fixedrange)return;h?(g="n"===h?"top":"bottom","right"===l.side&&(p="right")):"e"===v&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(xe).call(c.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(f),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:g}).on("edit",(function(e){var t=l.d2r(e);void 0!==t&&o.call("_guiRelayout",a,u,t)}))}}}function ze(t,r){if(e._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,de*t+be)),a=Math.max(0,Math.min(ee,pe*r+_e)),i=Math.abs(n-be),o=Math.abs(a-_e);function l(){Ae="",we.r=we.l,we.t=we.b,Se.attr("d","M0,0Z")}if(we.l=Math.min(be,n),we.r=Math.max(be,n),we.t=Math.min(_e,a),we.b=Math.max(_e,a),te.isSubplotConstrained)i>O||o>O?(Ae="xy",i/K>o/ee?(o=i*ee/K,_e>a?we.t=_e-o:we.b=_e+o):(i=o*K/ee,be>n?we.l=be-i:we.r=be+i),Se.attr("d",q(we))):l();else if(re.isSubplotConstrained)if(i>O||o>O){Ae="xy";var s=Math.min(we.l/K,(ee-we.b)/ee),c=Math.max(we.r/K,(ee-we.t)/ee);we.l=s*K,we.r=c*K,we.b=(1-s)*ee,we.t=(1-c)*ee,Se.attr("d",q(we))}else l();else!ae||o0){var u;if(re.isSubplotConstrained||!ne&&1===ae.length){for(u=0;ug[1]-1/4096&&(t.domain=l),a.noneOrAll(e.domain,t.domain,l)}return r("layer"),t}},{"../../lib":209,"fast-isnumeric":18}],272:[function(e,t,r){"use strict";var n=e("../../constants/alignment").FROM_BL;t.exports=function(e,t,r){void 0===r&&(r=n[e.constraintoward||"center"]);var a=[e.r2l(e.range[0]),e.r2l(e.range[1])],i=a[0]+(a[1]-a[0])*r;e.range=e._input.range=[e.l2r(i+(a[0]-i)*t),e.l2r(i+(a[1]-i)*t)],e.setScale()}},{"../../constants/alignment":183}],273:[function(e,t,r){"use strict";var n=e("polybooljs"),a=e("../../registry"),i=e("../../components/drawing").dashStyle,o=e("../../components/color"),l=e("../../components/fx"),s=e("../../components/fx/helpers").makeEventData,c=e("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=e("../../components/shapes/draw_newshape/display_outlines"),v=e("../../components/shapes/draw_newshape/helpers").handleEllipse,m=e("../../components/shapes/draw_newshape/newshapes"),y=e("../../lib"),x=e("../../lib/polygon"),b=e("../../lib/throttle"),_=e("./axis_ids").getFromId,w=e("../../lib/clear_gl_canvases"),T=e("../../plot_api/subroutines").redrawReglTraces,k=e("./constants"),M=k.MINSELECT,A=x.filter,L=x.tester,S=e("./handle_outline").clearSelect,C=e("./helpers"),O=C.p2r,D=C.axValue,P=C.getTransform;function z(e,t,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=t._hoverdata,x=t._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(e){return e&&Array.isArray(e)&&!0!==e[0].hoverOnBox}(y)){F(e,t,i);var _=function(e,t){var r,n,a=e[0],i=-1,o=[];for(n=0;n0?function(e,t){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===t.searchInfo&&(n=t.searchInfo.cd[0].trace).selectedpoints.length===t.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=B(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(t)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,e);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=e.selectionDefs=[],r.selection.mergedPolygons=e.mergedPolygons=[]}function H(e,t,r,n){var a,i,o,l=[],s=t.map((function(e){return e._id})),c=r.map((function(e){return e._id}));for(o=0;o0?n[0]:r;return!!t.selectedpoints&&t.selectedpoints.indexOf(a)>-1}function j(e,t,r){var n,i,o,l;for(n=0;n=0)C._fullLayout._deactivateShape(C);else if(!_){var r=R.clickmode;b.done(ge).then((function(){if(b.clear(ge),2===e){for(fe.remove(),K=0;K-1&&z(t,C,a.xaxes,a.yaxes,a.subplot,a,fe),"event"===r&&C.emit("plotly_selected",void 0);l.click(C,t)})).catch(y.error)}},a.doneFn=function(){he.remove(),b.done(ge).then((function(){b.clear(ge),a.gd.emit("plotly_selected",te),$&&a.selectionDefs&&($.subtract=ue,a.selectionDefs.push($),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,J)),a.doneFnCompleted&&a.doneFnCompleted(ve)})).catch(y.error),_&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:z}},{"../../components/color":81,"../../components/dragelement/helpers":99,"../../components/drawing":103,"../../components/fx":121,"../../components/fx/helpers":117,"../../components/shapes/draw_newshape/display_outlines":166,"../../components/shapes/draw_newshape/helpers":167,"../../components/shapes/draw_newshape/newshapes":168,"../../lib":209,"../../lib/clear_gl_canvases":197,"../../lib/polygon":221,"../../lib/throttle":231,"../../plot_api/subroutines":244,"../../registry":296,"./axis_ids":257,"./constants":260,"./handle_outline":264,"./helpers":265,polybooljs:55}],274:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../../lib"),l=o.cleanNumber,s=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,d=e("../../constants/numerical"),p=d.FP_SAFE,h=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,x=d.ONEMIN,b=d.ONESEC,_=e("./axis_ids"),w=e("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function M(e){return Math.pow(10,e)}function A(e){return null!=e}t.exports=function(e,t){t=t||{};var r=e._id||"x",d=r.charAt(0);function L(t,r){if(t>0)return Math.log(t)/Math.LN10;if(t<=0&&r&&e.range&&2===e.range.length){var n=e.range[0],a=e.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return h}function S(t,r,n,a){if((a||{}).msUTC&&i(t))return+t;var l=c(t,n||e.calendar);if(l===h){if(!i(t))return h;t=+t;var s=Math.floor(10*o.mod(t+.05,1)),u=Math.round(t-s/10);l=c(new Date(u))+s/10}return l}function C(t,r,n){return s(t,r,n||e.calendar)}function O(t){return e._categories[Math.round(t)]}function D(t){if(A(t)){if(void 0===e._categoriesMap&&(e._categoriesMap={}),void 0!==e._categoriesMap[t])return e._categoriesMap[t];e._categories.push("number"==typeof t?String(t):t);var r=e._categories.length-1;return e._categoriesMap[t]=r,r}return h}function P(t){if(e._categoriesMap)return e._categoriesMap[t]}function z(e){var t=P(e);return void 0!==t?t:i(e)?+e:void 0}function R(e){return i(e)?+e:P(e)}function E(e,t,r){return n.round(r+t*e,2)}function I(e,t,r){return(e-r)/t}var F=function(t){return i(t)?E(t,e._m,e._b):h},N=function(t){return I(t,e._m,e._b)};if(e.rangebreaks){var H="y"===d;F=function(t){if(!i(t))return h;var r=e._rangebreaks.length;if(!r)return E(t,e._m,e._b);var n=H;e.range[0]>e.range[1]&&(n=!n);for(var a=n?-1:1,o=a*t,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=e._B[l]||0;return isFinite(f)?E(t,e._m2,f):0},N=function(t){var r=e._rangebreaks.length;if(!r)return I(t,e._m,e._b);for(var n=0,a=0;ae._rangebreaks[a].pmax&&(n=a+1);return I(t,e._m2,e._B[n])}}e.c2l="log"===e.type?L:u,e.l2c="log"===e.type?M:u,e.l2p=F,e.p2l=N,e.c2p="log"===e.type?function(e,t){return F(L(e,t))}:F,e.p2c="log"===e.type?function(e){return M(N(e))}:N,-1!==["linear","-"].indexOf(e.type)?(e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=l,e.c2d=e.c2r=e.l2d=e.l2r=u,e.d2p=e.r2p=function(t){return e.l2p(l(t))},e.p2d=e.p2r=N,e.cleanPos=u):"log"===e.type?(e.d2r=e.d2l=function(e,t){return L(l(e),t)},e.r2d=e.r2c=function(e){return M(l(e))},e.d2c=e.r2l=l,e.c2d=e.l2r=u,e.c2r=L,e.l2d=M,e.d2p=function(t,r){return e.l2p(e.d2r(t,r))},e.p2d=function(e){return M(N(e))},e.r2p=function(t){return e.l2p(l(t))},e.p2r=N,e.cleanPos=u):"date"===e.type?(e.d2r=e.r2d=o.identity,e.d2c=e.r2c=e.d2l=e.r2l=S,e.c2d=e.c2r=e.l2d=e.l2r=C,e.d2p=e.r2p=function(t,r,n){return e.l2p(S(t,0,n))},e.p2d=e.p2r=function(e,t,r){return C(N(e),t,r)},e.cleanPos=function(t){return o.cleanDate(t,h,e.calendar)}):"category"===e.type?(e.d2c=e.d2l=D,e.r2d=e.c2d=e.l2d=O,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=R(t);return void 0!==r?r:e.fraction2r(.5)},e.l2r=e.c2r=u,e.r2l=R,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return O(N(e))},e.r2p=e.d2p,e.p2r=N,e.cleanPos=function(e){return"string"==typeof e&&""!==e?e:u(e)}):"multicategory"===e.type&&(e.r2d=e.c2d=e.l2d=O,e.d2r=e.d2l_noadd=z,e.r2c=function(t){var r=z(t);return void 0!==r?r:e.fraction2r(.5)},e.r2c_just_indices=P,e.l2r=e.c2r=u,e.r2l=z,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return O(N(e))},e.r2p=e.d2p,e.p2r=N,e.cleanPos=function(e){return Array.isArray(e)||"string"==typeof e&&""!==e?e:u(e)},e.setupMultiCategory=function(n){var a,i,l=e._traceIndices,s=e._matchGroup;if(s&&0===e._categories.length)for(var c in s)if(c!==r){var u=t[_.id2name(c)];l=l.concat(u._traceIndices)}var p=[[0,{}],[0,{}]],h=[];for(a=0;ap&&(l[n]=p),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else o.nestedProperty(e,t).set(a)},e.setScale=function(r){var n=t._size;if(e.overlaying){var a=_.getFromId({_fullLayout:t},e.overlaying);e.domain=a.domain}var i=r&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var l,s,c=e.r2l(e[i][0],o),u=e.r2l(e[i][1],o),f="y"===d;if((f?(e._offset=n.t+(1-e.domain[1])*n.h,e._length=n.h*(e.domain[1]-e.domain[0]),e._m=e._length/(c-u),e._b=-e._m*u):(e._offset=n.l+e.domain[0]*n.w,e._length=n.w*(e.domain[1]-e.domain[0]),e._m=e._length/(u-c),e._b=-e._m*c),e._rangebreaks=[],e._lBreaks=0,e._m2=0,e._B=[],e.rangebreaks)&&(e._rangebreaks=e.locateBreaks(Math.min(c,u),Math.max(c,u)),e._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&e._rangebreaks.reverse();var h=p?-1:1;for(e._m2=h*e._length/(Math.abs(u-c)-e._lBreaks),e._B.push(-e._m2*(f?u:c)),l=0;la&&(a+=7,ia&&(a+=24,i=n&&i=n&&t=l.min&&(el.max&&(l.max=n),a=!1)}a&&c.push({min:e,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),e.plot.call(o.setTranslate,t._offset,r._offset).call(o.setScale,1,1);var n=e.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,e)}function v(t,r){var n=t.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!t.xr1,d=!!t.yr1,p=[];if(f){var h=i.simpleMap(t.xr0,a.r2l),g=i.simpleMap(t.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(t.yr0,s.r2l),x=i.simpleMap(t.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(e,a,{skipTitle:!0}),l.drawOne(e,s,{skipTitle:!0}),l.redrawComponents(e,[a._id,s._id]);var w=f?c/p[2]:1,T=d?u/p[3]:1,k=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}l.redrawComponents(e)}},{"../../components/drawing":103,"../../lib":209,"../../registry":296,"./axes":254,d3:16}],279:[function(e,t,r){"use strict";var n=e("../../registry").traceIs,a=e("./axis_autotype");function i(e){return{v:"x",h:"y"}[e.orientation||"v"]}function o(e,t){var r=i(e),a=n(e,"box-violin"),o=n(e._fullInput||{},"candlestick");return a&&!o&&t===r&&void 0===e[r]&&void 0===e[r+"0"]}t.exports=function(e,t,r,l){r("autotypenumbers",l.autotypenumbersDflt),"-"===r("type",(l.splomStash||{}).type)&&(!function(e,t){if("-"!==e.type)return;var r,l=e._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(e,t,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[t])return a;if((a[r+"axis"]||r)===t){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(t,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(e.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(d.autotypenumbers=e.autotypenumbers,o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,t,l,n+1):t(l,i,o)}}))}r.manageCommandObserver=function(e,t,n,o){var l={},s=!0;t&&t._commandObserver&&(l=t._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(e,n,l.lookupTable);if(t&&t._commandObserver){if(c)return l;if(t._commandObserver.remove)return t._commandObserver.remove(),t._commandObserver=null,l}if(c){i(e,c,l.cache),l.check=function(){if(s){var t=i(e,c,l.cache);return t.changed&&o&&void 0!==l.lookupTable[t.value]&&(l.disable(),Promise.resolve(o({value:t.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[t.value]})).then(l.enable,l.enable)),t.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f=t.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=t._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),s=r.select(".js-sourcelinks");e._context.showSources&&e._context.showSources(e),e._context.showLink&&function(e,t){t.text("");var r=t.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(e._context.linkText+" "+String.fromCharCode(187));if(e._context.sendData)r.on("click",(function(){x.sendDataToCloud(e)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(e,o),l.text(o.text()&&s.text()?" - ":"")}},x.sendDataToCloud=function(e){var t=(window.PLOTLYENV||{}).BASE_URL||e._context.plotlyServerURL;if(t){e.emit("plotly_beforeexport");var r=n.select(e).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:t+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(e,!1,"keepdata"),a.node().submit(),r.remove(),e.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(e,t){var r=e._context.locale;r||(r="en-US");var n=!1,a={};function i(e){for(var r=!0,i=0;i1&&R.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,s),l=0;l15&&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"),x.linkSubplots(d,s,f,i),x.cleanPlot(d,s,f,i);var H=!(!i._has||!i._has("gl2d")),B=!(!s._has||!s._has("gl2d")),j=!(!i._has||!i._has("cartesian"))||H,V=!(!s._has||!s._has("cartesian"))||B;j&&!V?i._bgLayer.remove():V&&!j&&(s._shouldCreateBgLayer=!0),i._zoomlayer&&!e._dragging&&p({_fullLayout:i}),function(e,t){var r,n=[];t.meta&&(r=t._meta={meta:t.meta,layout:{meta:t.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),a=Math.round(f*a)}}var d=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!t.height&&Math.abs(r.height-a)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=a)),e._initialAutoSize||(e._initialAutoSize={width:n,height:a}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(e,t,r,n){var a,i,l,s=o.componentsRegistry,u=t._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in s)(l=s[a]).includeBasePlot&&l.includeBasePlot(e,t);for(var d in u.length||u.push(f),t._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(e,t),f.finalizeSubplots(e,t)),t._subplots)t._subplots[d].sort(c.subplotSort);for(i=0;i1&&(r.l/=d,r.r/=d);var p=(r.t+r.b)/l;p>1&&(r.t/=p,r.b/=p);var h=void 0!==r.xl?r.xl:r.x,g=void 0!==r.xr?r.xr:r.x,v=void 0!==r.yt?r.yt:r.y,m=void 0!==r.yb?r.yb:r.y;s[t]={l:{val:h,size:r.l+u},r:{val:g,size:r.r+u},b:{val:m,size:r.b+u},t:{val:v,size:r.t+u}},c[t]=1}else delete s[t],delete c[t];if(!n._replotting)return x.doAutoMargin(e)}},x.doAutoMargin=function(e){var t=e._fullLayout,r=t.width,n=t.height,a=Math.max(0,r-64),l=Math.max(0,n-64);t._size||(t._size={}),C(t);var s=t._size,u=t.margin,f=c.extendFlat({},s),p=u.l,h=u.r,g=u.t,v=u.b,m=t._pushmargin,y=t._pushmarginIds;if(!1!==t.margin.autoexpand){for(var b in m)y[b]||delete m[b];for(var _ in m.base={l:{val:0,size:p},r:{val:1,size:h},t:{val:1,size:g},b:{val:0,size:v}},m){var w=m[_].l||{},T=m[_].b||{},k=w.val,M=w.size,A=T.val,L=T.size;for(var S in m){if(i(M)&&m[S].r){var O=m[S].r.val,D=m[S].r.size;if(O>k){var P=(M*O+(D-r)*k)/(O-k),z=(D*(1-k)+(M-r)*(1-O))/(O-k);P+z>p+h&&(p=P,h=z)}}if(i(L)&&m[S].t){var R=m[S].t.val,E=m[S].t.size;if(R>A){var I=(L*R+(E-n)*A)/(R-A),F=(E*(1-A)+(L-n)*(1-R))/(R-A);I+F>v+g&&(v=I,g=F)}}}}}var N=(p+h)/a;N>1&&(p/=N,h/=N);var H=(v+g)/l;if(H>1&&(v/=H,g/=H),s.l=Math.round(p),s.r=Math.round(h),s.t=Math.round(g),s.b=Math.round(v),s.p=Math.round(u.pad),s.w=Math.round(r)-s.l-s.r,s.h=Math.round(n)-s.t-s.b,!t._replotting&&x.didMarginChange(f,s)){"_redrawFromAutoMarginCount"in t?t._redrawFromAutoMarginCount++:t._redrawFromAutoMarginCount=1;var B=3*(1+Object.keys(y).length);if(t._redrawFromAutoMarginCount0&&(e._transitioningWithDuration=!0),e._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&e._transitionData._interruptCallbacks.push((function(){return o.call("redraw",e)})),e._transitionData._interruptCallbacks.push((function(){e.emit("plotly_transitioninterrupted",[])}));var i=0,l=0;function s(){return i++,function(){l++,n||l!==i||function(t){if(!e._transitionData)return;(function(e){if(e)for(;e.length;)e.shift()})(e._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",e)})).then((function(){e._transitioning=!1,e._transitioningWithDuration=!1,e.emit("plotly_transitioned",[])})).then(t)}(a)}}r.runFn(s),setTimeout(s())}))}],i=c.syncOrAsync(a,e);return i&&i.then||(i=Promise.resolve()),i.then((function(){return e}))}x.didMarginChange=function(e,t){for(var r=0;r1)return!0}return!1},x.graphJson=function(e,t,r,n,a,i){(a&&t&&!e._fullData||a&&!t&&!e._fullLayout)&&x.supplyDefaults(e);var o=a?e._fullData:e.data,l=a?e._fullLayout:e.layout,s=(e._transitionData||{})._frames;function u(e,t){if("function"==typeof e)return t?"_function_":null;if(c.isPlainObject(e)){var n,a={};return Object.keys(e).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof e[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(e.stream))return}else if("keepall"!==r&&"string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(e[i],t)}else t&&(a[i]="_function")})),a}return Array.isArray(e)?e.map((function(e){return u(e,t)})):c.isTypedArray(e)?c.simpleMap(e,c.identity):c.isJSDate(e)?c.ms2DateTimeLocal(+e):e}var f={data:(o||[]).map((function(e){var r=u(e);return t&&delete r.fit,r}))};if(!t&&(f.layout=u(l),a)){var d=l._size;f.layout.computed={margin:{b:d.b,l:d.l,r:d.r,t:d.t}}}return e.framework&&e.framework.isPolar&&(f=e.framework.getConfig()),s&&(f.frames=u(s)),i&&(f.config=u(e._context,!0)),"object"===n?f:JSON.stringify(f)},x.modifyFrames=function(e,t){var r,n,a,i=e._transitionData._frames,o=e._transitionData._frameHash;for(r=0;r=0;i--)if(l[i].enabled){r._indexToPoints=l[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(e,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,h[t]=o}}for(z(s,u,p),a=0;a=0?d.angularAxis.domain:n.extent(T),S=Math.abs(T[1]-T[0]);M&&!k&&(S=0);var C=L.slice();A&&k&&(C[1]+=S);var O=d.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),d.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var D=d.angularAxis.ticksStep||(C[1]-C[0])/(O*(d.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),C[2]||(C[2]=D);var P=n.range.apply(this,C);if(P=P.map((function(e,t){return parseFloat(e.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(e=n.select(this).select("svg.chart-root"))||e.empty()){var z=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),R=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));e=n.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var E,I=e.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(e,t){return" "+e+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){E=e.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var H=p.map((function(e,t){var r=o.util.cloneJson(e);return r.symbol="DotPlot"===e.geometry?e.dotType||"circle":"LinePlot"!=e.geometry?"square":"line",r.visibleInLegend="undefined"==typeof e.visibleInLegend||e.visibleInLegend,r.color="LinePlot"===e.geometry?e.strokeColor:e.color,r}));o.Legend().config({data:p.map((function(e,t){return e.name||"Element"+t})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:E,elements:H,reverseOrder:d.legend.reverseOrder})})();var B=E.node().getBBox();x=Math.min(d.width-B.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),E.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else E=e.select(".legend-group").style({display:"none"});e.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),I.attr("transform","translate("+_+")").style({cursor:"crosshair"});var j=[(d.width-(d.margin.left+d.margin.right+2*x+(B?B.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),e.select(".outer-group").attr("transform","translate("+j+")"),d.title&&d.title.text){var V=e.select("g.title-group text").style(N).text(d.title.text),U=V.node().getBBox();V.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var q=e.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function Y(e,t){return l(e)%360+d.orientation}if(d.radialAxis.visible){var X=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(X).attr({transform:"rotate("+d.radialAxis.orientation+")"}),q.selectAll(".domain").style(F),q.selectAll("g>text").text((function(e,t){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(e,t){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(e,t){return"rotate("+Y(e)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.append("line").classed("grid-line",!0).classed("major",(function(e,t){return t%(d.minorTicks+1)==0})).classed("minor",(function(e,t){return!(t%(d.minorTicks+1)==0)})).style(F),Q.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var J=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(e,t){var r=Y(e),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(e,t){return t%(d.minorTicks+1)!=0?"":w?w[e]+d.angularAxis.ticksSuffix:e+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&J.text((function(e,t){return t%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,t)}));var $=n.max(I.selectAll(".angular-tick text")[0].map((function(e,t){return e.getCTM().e+e.getBBox().width})));E.attr({transform:"translate("+[x+$,d.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,ee=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(ee.enter().append("g").attr({class:function(e,t){return"geometry geometry"+t}}),ee.exit().remove(),p[0]||K){var te=[];p.forEach((function(e,t){var n={};n.radialScale=r,n.angularScale=l,n.container=ee.filter((function(e,r){return r==t})),n.geometry=e.geometry,n.orientation=d.orientation,n.direction=d.direction,n.index=t,te.push({data:e,geometryConfig:n})}));var re=n.nest().key((function(e,t){return"undefined"!=typeof e.data.groupId||"unstacked"})).entries(te),ne=[];re.forEach((function(e,t){"unstacked"===e.key?ne=ne.concat(e.values.map((function(e,t){return[e]}))):ne.push(e.values)})),ne.forEach((function(e,t){var r;r=Array.isArray(e)?e[0].geometryConfig.geometry:e.geometryConfig.geometry;var n=e.map((function(e,t){return a(o[r].defaultConfig(),e)}));o[r]().config(n)()}))}var ae,ie,oe=e.select(".guides-group"),le=e.select(".tooltips-group"),se=o.tooltipPanel().config({container:le,fontSize:8})(),ce=o.tooltipPanel().config({container:le,fontSize:8})(),ue=o.tooltipPanel().config({container:le,hasTick:!0})();if(!k){var fe=oe.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});I.on("mousemove.angular-guide",(function(e,t){var r=o.util.getMousePos(Z).angle;fe.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;ae=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);se.text(o.util.round(ae)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(e,t){oe.select("line").style({opacity:0})}))}var de=oe.select("circle").style({stroke:"grey",fill:"none"});I.on("mousemove.radial-guide",(function(e,t){var n=o.util.getMousePos(Z).radius;de.attr({r:n}).style({opacity:.5}),ie=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ce.text(o.util.round(ie)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(e,t){de.style({opacity:0}),ue.hide(),se.hide(),ce.hide()})),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(t,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),p=[f.left+f.width/2-j[0]-d.left,f.top+f.height/2-j[1]-d.top];ue.config({color:l}).text(u),ue.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(e,t){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ue.show()})).on("mouseout.tooltip",(function(e,t){ue.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(e){if(!arguments.length)return s;var t=o.util.cloneJson(e);return t.data.forEach((function(e,t){s.data[t]||(s.data[t]={}),a(s.data[t],o.Axis.defaultConfig().data[0]),a(s.data[t],e)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,t.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(e){return r},d.angularScale=function(e){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(e,t){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(e,t){for(var r in e)r in t&&(t[r]=e[r])},o.util._extend=function(e,t){for(var r in e)t[r]=e[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(e,t){var r=t||6;return n.range(0,360+r,r).map((function(t,r){var n=t*Math.PI/180;return[t,e(n)]}))},o.util.dataFromEquation=function(e,t,r){var a=t||6,i=[],o=[];n.range(0,360+a,a).forEach((function(t,r){var n=t*Math.PI/180,a=e(n);i.push(t),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},o.util.ensureArray=function(e,t){if("undefined"==typeof e)return null;var r=[].concat(e);return n.range(t).map((function(e,t){return r[t]||r[0]}))},o.util.fillArrays=function(e,t,r){return t.forEach((function(t,n){e[t]=o.util.ensureArray(e[t],r)})),e},o.util.cloneJson=function(e){return JSON.parse(JSON.stringify(e))},o.util.validateKeys=function(e,t){"string"==typeof t&&(t=t.split("."));var r=t.shift();return e[r]&&(!t.length||objHasKeys(e[r],t))},o.util.sumArrays=function(e,t){return n.zip(e,t).map((function(e,t){return n.sum(e)}))},o.util.arrayLast=function(e){return e[e.length-1]},o.util.arrayEqual=function(e,t){for(var r=Math.max(e.length,t.length,1);r-- >=0&&e[r]===t[r];);return-2===r},o.util.flattenArray=function(e){for(var t=[];!o.util.arrayEqual(t,e);)t=e,e=[].concat.apply([],e);return e},o.util.deduplicate=function(e){return e.filter((function(e,t,r){return r.indexOf(e)==t}))},o.util.convertToCartesian=function(e,t){var r=t*Math.PI/180;return[e*Math.cos(r),e*Math.sin(r)]},o.util.round=function(e,t){var r=t||2,n=Math.pow(10,r);return Math.round(e*n)/n},o.util.getMousePos=function(e){var t=n.mouse(e.node()),r=t[0],a=t[1],i={};return i.x=r,i.y=a,i.pos=t,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(e){for(var t,r={},n={},a=0,i=e.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(e,t){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(e,t){return h.stroke(r,a,i)},"stroke-width":function(e,t){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(e,t){return h["stroke-dasharray"](r,a,i)},opacity:function(e,t){return h.opacity(r,a,i)},display:function(e,t){return h.display(r,a,i)}})}};var f=t.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(e){return-d/2})).endAngle((function(e){return d/2})).innerRadius((function(e){return t.radialScale(s+(e[2]||0))})).outerRadius((function(e){return t.radialScale(s+(e[2]||0))+t.radialScale(e[1])}));c.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(e,r){return"rotate("+(t.orientation+l(e[0])+90)+")"}})};var h={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,n,a){return r[e[a].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[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(e,t){return e}));v.enter().append("path").attr({class:"mark"}),v.style(h).each(c[t.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(t){return arguments.length?(t.forEach((function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)})),this):e},i.getColorScale=function(){},n.rebind(i,t,"on"),i},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 e=o.Legend.defaultConfig(),t=n.dispatch("hover");function r(){var t=e.legendConfig,i=e.data.map((function(e,r){return[].concat(e).map((function(e,n){var i=a({},t.elements[r]);return i.name=e,i.color=[].concat(t.elements[r].color)[n],i}))})),o=n.merge(i);o=o.filter((function(e,r){return t.elements[r]&&(t.elements[r].visibleInLegend||"undefined"==typeof t.elements[r].visibleInLegend)})),t.reverseOrder&&(o=o.reverse());var l=t.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(e,t){return e.color})),c=t.fontSize,u=null==t.isContinuous?"number"==typeof o[0]:t.isContinuous,f=u?t.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(e,t){return t/(s.length-1)*100+"%"}}).style({"stop-color":function(e,t){return e}}),d.append("rect").classed("legend-mark",!0).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(e,t){return"translate("+[c/2,v(t)+c/2]+")"},d:function(e,t){var r,a,i,o=e.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(e,t){return g(t)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?t.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?t.textColor:"none"}),b.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text((function(e,t){return o[t].name})),r}return r.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(r,t,"on"),r},o.Legend.defaultConfig=function(e,t){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 e,t,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(e=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),t=n.append("text").attr({dx:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";t.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=t.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),e.attr({transform:"translate("+[s,-v/2+2*d]+")"}),e.style({display:"block"}),c},c.move=function(t){if(e)return e.attr({transform:"translate("+[t[0],t[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(e)return e.style({display:"none"}),c},c.show=function(){if(e)return e.style({display:"block"}),c},c.config=function(e){return a(i,e),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var e={convert:function(e,t){var r={};if(e.data&&(r.data=e.data.map((function(e,r){var n=a({},e);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(e,r){o.util.translator.apply(null,e.concat(t))})),t||delete n.marker,t&&delete n.groupId,t?("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})),!t&&e.layout&&"stack"===e.layout.barmode)){var i=o.util.duplicates(r.data.map((function(e,t){return e.geometry})));r.data.forEach((function(e,t){var n=i.indexOf(e.geometry);-1!=n&&(r.data[t].groupId=n)}))}if(e.layout){var l=a({},e.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(e,t){u[c[s.indexOf(e.key)]]=e.value})),l.margin=u}t&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return e}},{"../../../constants/alignment":183,"../../../lib":209,d3:16}],293:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../../lib"),i=e("../../../components/color"),o=e("./micropolar"),l=e("./undo_manager"),s=a.extendDeepAll,c=t.exports={};c.framework=function(e){var t,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),t=t?s(t,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(t),a.config(i).render(u),e.data=t.data,e.layout=t.layout,c.fillLayout(e),t}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return t},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var e,n,a=this,i=o.util.cloneJson(t);e=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(e)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(e){var t=n.select(e).selectAll(".plot-container"),r=t.selectAll(".svg-container"),a=e.framework&&e.framework.svg&&e.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:t,_paperdiv:r,_paper:a};e._fullLayout=s(o,e.layout)}},{"../../../components/color":81,"../../../lib":209,"./micropolar":292,"./undo_manager":294,d3:16}],294:[function(e,t,r){"use strict";t.exports=function(){var e,t=[],r=-1,n=!1;function a(e,t){return e?(n=!0,e[t](),n=!1,this):this}return{add:function(e){return n||(t.splice(r+1,t.length-r),t.push(e),r=t.length-1),this},setCallback:function(t){e=t},undo:function(){var n=t[r];return n?(a(n,"undo"),r-=1,e&&e(n.undo),this):this},redo:function(){var n=t[r+1];return n?(a(n,"redo"),r+=1,e&&e(n.redo),this):this},clear:function(){t=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a-1&&(f[p[r]].title={text:""});for(r=0;r")?"":t.html(e).text()}));return t.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":81,"../components/drawing":103,"../constants/xmlns_namespaces":189,"../lib":209,d3:16}],305:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rf+c||!n(u))}for(var p=0;pi))return t}return void 0!==r?r:e.dflt},r.coerceColor=function(e,t,r){return a(t).isValid()?t:void 0!==r?r:e.dflt},r.coerceEnumerated=function(e,t,r){return e.coerceNumber&&(t=+t),-1!==e.values.indexOf(t)?t:void 0!==r?r:e.dflt},r.getValue=function(e,t){var r;return Array.isArray(e)?t0?a+=i:t<0&&(a-=i)}return n.inbox(r-t,a-t,b+(a-t)/(a-r)-1)}"h"===v.orientation?(i=r,l=t,u="y",f="x",d=L,p=A):(i=t,l=r,u="x",f="y",p=L,d=A);var S=e[u+"a"],C=e[f+"a"];h=Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0]));var O=n.getDistanceFunction(a,d,p,(function(e){return(d(e)+p(e))/2}));if(n.getClosest(g,O,e),!1!==e.index&&g[e.index].p!==c){y||(T=function(e){return Math.min(_(e),e.p-m.bargroupwidth/2)},k=function(e){return Math.max(w(e),e.p+m.bargroupwidth/2)});var D=g[e.index],P=v.base?D.b+D.s:D.s;e[f+"0"]=e[f+"1"]=C.c2p(D[f],!0),e[f+"LabelVal"]=P;var z=m.extents[m.extents.round(D.p)];e[u+"0"]=S.c2p(y?T(D):z[0],!0),e[u+"1"]=S.c2p(y?k(D):z[1],!0);var R=void 0!==D.orig_p;return e[u+"LabelVal"]=R?D.orig_p:D.p,e.labelLabel=s(S,e[u+"LabelVal"]),e.valueLabel=s(C,e[f+"LabelVal"]),e.baseLabel=s(C,D.b),e.spikeDistance=(L(D)+function(e){return M(_(e),w(e))}(D))/2-b,e[u+"Spike"]=S.c2p(D.p,!0),o(D,v,e),e.hovertemplate=v.hovertemplate,e}}function f(e,t){var r=t.mcc||e.marker.color,n=t.mlcc||e.marker.line.color,a=l(e,t);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}t.exports={hoverPoints:function(e,t,r,n){var i=u(e,t,r,n);if(i){var o=i.cd,l=o[0].trace,s=o[i.index];return i.color=f(l,s),a.getComponentMethod("errorbars","hoverInfo")(s,l,i),[i]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":81,"../../components/fx":121,"../../constants/numerical":188,"../../lib":209,"../../plots/cartesian/axes":254,"../../registry":296,"./helpers":312}],314:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc").crossTraceCalc,colorbar:e("../scatter/marker_colorbar"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot").plot,style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover").hoverPoints,eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"bar",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":267,"../scatter/marker_colorbar":415,"./arrays_to_calcdata":305,"./attributes":306,"./calc":307,"./cross_trace_calc":309,"./defaults":310,"./event_data":311,"./hover":313,"./layout_attributes":315,"./layout_defaults":316,"./plot":317,"./select":318,"./style":320}],315:[function(e,t,r){"use strict";t.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],316:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/cartesian/axes"),i=e("../../lib"),o=e("./layout_attributes");t.exports=function(e,t,r){function l(r,n){return i.coerce(e,t,o,r,n)}for(var s=!1,c=!1,u=!1,f={},d=l("barmode"),p=0;p0}function L(e){return"auto"===e?0:e}function S(e,t){var r=Math.PI/180*t,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:e.width*a+e.height*n,y:e.width*n+e.height*a}}function C(e,t,r,n,a,i){var o=!!i.isHorizontal,l=!!i.constrained,s=i.angle||0,c=i.anchor||"end",u="end"===c,f="start"===c,d=((i.leftToRight||0)+1)/2,p=1-d,h=a.width,g=a.height,v=Math.abs(t-e),m=Math.abs(n-r),y=v>2*_&&m>2*_?_:0;v-=2*y,m-=2*y;var x=L(s);"auto"!==s||h<=v&&g<=m||!(h>v||g>m)||(h>m||g>v)&&h.01?q:function(e,t,r){return r&&e===t?e:Math.abs(e-t)>=2?q(e):e>t?Math.ceil(e):Math.floor(e)};N=G(N,H,E),H=G(H,N,E),B=G(B,j,!E),j=G(j,B,!E)}var Z=M(i.ensureSingle(P,"path"),D,v,m);if(Z.style("vector-effect","non-scaling-stroke").attr("d",isNaN((H-N)*(j-B))||V&&e._context.staticPlot?"M0,0Z":"M"+N+","+B+"V"+j+"H"+H+"V"+B+"Z").call(s.setClipUrl,t.layerClipId,e),!D.uniformtext.mode&&I){var Y=s.makePointStyleFns(f);s.singlePointStyle(c,Z,f,Y,e)}!function(e,t,r,n,a,l,c,f,p,v,m){var w,T=t.xaxis,A=t.yaxis,O=e._fullLayout;function D(t,r,n){return i.ensureSingle(t,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(s.font,n).call(o.convertToTspans,e)}var P=n[0].trace,z="h"===P.orientation,R=function(e,t,r,n,a){var o,l=t[0].trace;o=l.texttemplate?function(e,t,r,n,a){var o=t[0].trace,l=i.castOption(o,r,"texttemplate");if(!l)return"";var s,c,f,d,p="waterfall"===o.type,h="funnel"===o.type;"h"===o.orientation?(s="y",c=a,f="x",d=n):(s="x",c=n,f="y",d=a);function g(e){return u(d,+e,!0).text}var v=t[r],m={};m.label=v.p,m.labelLabel=m[s+"Label"]=(y=v.p,u(c,y,!0).text);var y;var x=i.castOption(o,v.i,"text");(0===x||x)&&(m.text=x);m.value=v.s,m.valueLabel=m[f+"Label"]=g(v.s);var _={};b(_,o,v.i),p&&(m.delta=+v.rawS||v.s,m.deltaLabel=g(m.delta),m.final=v.v,m.finalLabel=g(m.final),m.initial=m.final-m.delta,m.initialLabel=g(m.initial));h&&(m.value=v.s,m.valueLabel=g(m.value),m.percentInitial=v.begR,m.percentInitialLabel=i.formatPercent(v.begR),m.percentPrevious=v.difR,m.percentPreviousLabel=i.formatPercent(v.difR),m.percentTotal=v.sumR,m.percenTotalLabel=i.formatPercent(v.sumR));var w=i.castOption(o,v.i,"customdata");w&&(m.customdata=w);return i.texttemplateString(l,m,e._d3locale,_,m,o._meta||{})}(e,t,r,n,a):l.textinfo?function(e,t,r,n){var a=e[0].trace,o="h"===a.orientation,l="waterfall"===a.type,s="funnel"===a.type;function c(e){return u(o?r:n,+e,!0).text}var f,d=a.textinfo,p=e[t],h=d.split("+"),g=[],v=function(e){return-1!==h.indexOf(e)};v("label")&&g.push((m=e[t].p,u(o?n:r,m,!0).text));var m;v("text")&&(0===(f=i.castOption(a,p.i,"text"))||f)&&g.push(f);if(l){var y=+p.rawS||p.s,x=p.v,b=x-y;v("initial")&&g.push(c(b)),v("delta")&&g.push(c(y)),v("final")&&g.push(c(x))}if(s){v("value")&&g.push(c(p.s));var _=0;v("percent initial")&&_++,v("percent previous")&&_++,v("percent total")&&_++;var w=_>1;v("percent initial")&&(f=i.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),v("percent previous")&&(f=i.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),v("percent total")&&(f=i.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(t,r,n,a):g.getValue(l.text,r);return g.coerceString(y,o)}(O,n,a,T,A);w=function(e,t){var r=g.getValue(e.textposition,t);return g.coerceEnumerated(x,r)}(P,a);var E="stack"===v.mode||"relative"===v.mode,I=n[a],F=!E||I._outmost;if(!R||"none"===w||(I.isBlank||l===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var N=O.font,H=h.getBarColor(n[a],P),B=h.getInsideTextFont(P,a,N,H),j=h.getOutsideTextFont(P,a,N),V=r.datum();z?"log"===T.type&&V.s0<=0&&(l=T.range[0]=G*(W/Z):W>=Z*(X/G);G>0&&Z>0&&(Q||J||$)?w="inside":(w="outside",U.remove(),U=null)}else w="inside";if(!U){Y=i.ensureUniformFontSize(e,"outside"===w?j:B);var K=(U=D(r,R,Y)).attr("transform");if(U.attr("transform",""),q=s.bBox(U.node()),G=q.width,Z=q.height,U.attr("transform",K),G<=0||Z<=0)return void U.remove()}var ee,te,re=P.textangle;"outside"===w?(te="both"===P.constraintext||"outside"===P.constraintext,ee=function(e,t,r,n,a,i){var o,l=!!i.isHorizontal,s=!!i.constrained,c=i.angle||0,u=a.width,f=a.height,d=Math.abs(t-e),p=Math.abs(n-r);o=l?p>2*_?_:0:d>2*_?_:0;var h=1;s&&(h=l?Math.min(1,p/f):Math.min(1,d/u));var g=L(c),v=S(a,g),m=(l?v.x:v.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(e+t)/2,w=(r+n)/2,T=0,M=0,A=l?k(t,e):k(r,n);l?(b=t-A*o,T=A*m):(w=n+A*o,M=-A*m);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:h,rotate:g}}(l,c,f,p,q,{isHorizontal:z,constrained:te,angle:re})):(te="both"===P.constraintext||"inside"===P.constraintext,ee=C(l,c,f,p,q,{isHorizontal:z,constrained:te,angle:re,anchor:P.insidetextanchor}));ee.fontSize=Y.size,d(P.type,ee,O),I.transform=ee,M(U,O,v,m).attr("transform",i.getTextTransform(ee))}(e,t,P,r,p,N,H,B,j,v,m),t.layerClipId&&s.hideOutsideRangePoint(c,P.select("text"),w,O,f.xcalendar,f.ycalendar)}));var B=!1===f.cliponaxis;s.setClipUrl(c,B?null:t.layerClipId,e)}));c.getComponentMethod("errorbars","plot")(e,P,t,v)},toMoveInsideBar:C}},{"../../components/color":81,"../../components/drawing":103,"../../components/fx/helpers":117,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/cartesian/axes":254,"../../registry":296,"./attributes":306,"./constants":308,"./helpers":312,"./style":320,"./uniform_text":322,d3:16,"fast-isnumeric":18}],318:[function(e,t,r){"use strict";function n(e,t,r,n,a){var i=t.c2p(n?e.s0:e.p0,!0),o=t.c2p(n?e.s1:e.p1,!0),l=r.c2p(n?e.p0:e.s0,!0),s=r.c2p(n?e.p1:e.s1,!0);return a?[(i+o)/2,(l+s)/2]:n?[o,(l+s)/2]:[(i+o)/2,s]}t.exports=function(e,t){var r,a=e.cd,i=e.xaxis,o=e.yaxis,l=a[0].trace,s="funnel"===l.type,c="h"===l.orientation,u=[];if(!1===t)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!e[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),t.selectAll("g.points").each((function(t){h(n.select(this),t[0].trace,e)})),l.getComponentMethod("errorbars","style")(t)},styleTextPoints:g,styleOnSelect:function(e,t,r){var a=t[0].trace;a.selectedpoints?function(e,t,r){i.selectedPointStyle(e.selectAll("path"),t),function(e,t,r){e.each((function(e){var a,l=n.select(this);if(e.selected){a=o.ensureUniformFontSize(r,v(l,e,t,r));var s=t.selected.textfont&&t.selected.textfont.color;s&&(a.color=s),i.font(l,a)}else i.selectedTextStyle(l,t)}))}(e.selectAll("text"),t,r)}(r,a,e):(h(r,a,e),l.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:s}},{"../../components/color":81,"../../components/drawing":103,"../../lib":209,"../../registry":296,"./attributes":306,"./helpers":312,"./uniform_text":322,d3:16}],321:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l){r("marker.color",o),a(e,"marker")&&i(e,t,l,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(e,"marker.line")&&i(e,t,l,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":81,"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92}],322:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib");function i(e){return"_"+e+"Text_minsize"}t.exports={recordMinTextSize:function(e,t,r){if(r.uniformtext.mode){var n=i(e),a=r.uniformtext.minsize,o=t.scale*t.fontSize;t.hide=o1,b=1-f[e+"gap"],_=1-f[e+"groupgap"];for(l=0;l0){var q=S.pointpos,G=S.jitter,Z=S.marker.size/2,Y=0;q+G>=0&&((Y=V*(q+G))>A?(U=!0,B=Z,N=Y):Y>I&&(B=Z,N=A)),Y<=A&&(N=A);var X=0;q-G<=0&&((X=-V*(q-G))>L?(U=!0,j=Z,H=X):X>F&&(j=Z,H=L)),X<=L&&(H=L)}else N=A,H=L;var W=new Array(c.length);for(s=0;se.lo&&(x.so=!0)}return i}));d.enter().append("path").classed("point",!0),d.exit().remove(),d.call(i.translatePoints,o,l)}function s(e,t,r,i){var o,l,s=t.val,c=t.pos,u=!!c.rangebreaks,f=i.bPos,d=i.bPosPxOffset||0,p=r.boxmean||(r.meanline||{}).visible;Array.isArray(i.bdPos)?(o=i.bdPos[0],l=i.bdPos[1]):(o=i.bdPos,l=i.bdPos);var h=e.selectAll("path.mean").data("box"===r.type&&r.boxmean||"violin"===r.type&&r.box.visible&&r.meanline.visible?a.identity:[]);h.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),h.exit().remove(),h.each((function(e){var t=c.c2l(e.pos+f,!0),a=c.l2p(t-o)+d,i=c.l2p(t+l)+d,h=u?(a+i)/2:c.l2p(t)+d,g=s.c2p(e.mean,!0),v=s.c2p(e.mean-e.sd,!0),m=s.c2p(e.mean+e.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+g+","+a+"V"+i+("sd"===p?"m0,0L"+v+","+h+"L"+g+","+a+"L"+m+","+h+"Z":"")):n.select(this).attr("d","M"+a+","+g+"H"+i+("sd"===p?"m0,0L"+h+","+v+"L"+a+","+g+"L"+h+","+m+"Z":""))}))}t.exports={plot:function(e,t,r,i){var c=t.xaxis,u=t.yaxis;a.makeTraceGroups(i,r,"trace boxes").each((function(e){var t,r,a=n.select(this),i=e[0],f=i.t,d=i.trace;(f.wdPos=f.bdPos*d.whiskerwidth,!0!==d.visible||f.empty)?a.remove():("h"===d.orientation?(t=u,r=c):(t=c,r=u),o(a,{pos:t,val:r},d,f),l(a,{x:c,y:u},d,f),s(a,{pos:t,val:r},d,f))}))},plotBoxAndWhiskers:o,plotPoints:l,plotBoxMean:s}},{"../../components/drawing":103,"../../lib":209,d3:16}],328:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../components/color"),i=e("../../components/drawing");t.exports={style:function(e,t,r){var o=r||n.select(e).selectAll("g.trace.boxes");o.style("opacity",(function(e){return e[0].trace.opacity})),o.each((function(t){var r=n.select(this),o=t[0].trace,l=o.line.width;function s(e,t,r,n){e.style("stroke-width",t+"px").call(a.stroke,r).call(a.fill,n)}var c=r.selectAll("path.box");if("candlestick"===o.type)c.each((function(e){if(!e.empty){var t=n.select(this),r=o[e.dir];s(t,r.line.width,r.line.color,r.fillcolor),t.style("opacity",o.selectedpoints&&!e.selected?.3:1)}}));else{s(c,l,o.line.color,o.fillcolor),r.selectAll("path.mean").style({"stroke-width":l,"stroke-dasharray":2*l+"px,"+l+"px"}).call(a.stroke,o.line.color);var u=r.selectAll("path.point");i.pointStyle(u,o,e)}}))},styleOnSelect:function(e,t,r){var n=t[0].trace,a=r.selectAll("path.point");n.selectedpoints?i.selectedPointStyle(a,n):i.pointStyle(a,n,e)}}},{"../../components/color":81,"../../components/drawing":103,d3:16}],329:[function(e,t,r){"use strict";var n=e("../../lib").extendFlat,a=e("../ohlc/attributes"),i=e("../box/attributes");function o(e){return{line:{color:n({},i.line.color,{dflt:e}),width:i.line.width,editType:"style"},fillcolor:i.fillcolor,editType:"style"}}t.exports={xperiod:a.xperiod,xperiod0:a.xperiod0,xperiodalignment:a.xperiodalignment,x:a.x,open:a.open,high:a.high,low:a.low,close:a.close,line:{width:n({},i.line.width,{}),editType:"style"},increasing:o(a.increasing.line.color.dflt),decreasing:o(a.decreasing.line.color.dflt),text:a.text,hovertext:a.hovertext,whiskerwidth:n({},i.whiskerwidth,{dflt:0}),hoverlabel:a.hoverlabel}},{"../../lib":209,"../box/attributes":323,"../ohlc/attributes":375}],330:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axes"),i=e("../../plots/cartesian/align_period"),o=e("../ohlc/calc").calcCommon;function l(e,t,r,n){return{min:r,q1:Math.min(e,n),med:n,q3:Math.max(e,n),max:t}}t.exports=function(e,t){var r=e._fullLayout,s=a.getFromId(e,t.xaxis),c=a.getFromId(e,t.yaxis),u=s.makeCalcdata(t,"x"),f=i(t,s,"x",u),d=o(e,t,u,f,c,l);return d.length?(n.extendFlat(d[0].t,{num:r._numBoxes,dPos:n.distinctVals(f).minDiff/2,posLetter:"x",valLetter:"y"}),r._numBoxes++,d):[{t:{empty:!0}}]}},{"../../lib":209,"../../plots/cartesian/align_period":251,"../../plots/cartesian/axes":254,"../ohlc/calc":376}],331:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../components/color"),i=e("../ohlc/ohlc_defaults"),o=e("../scatter/period_defaults"),l=e("./attributes");function s(e,t,r,n){var i=r(n+".line.color");r(n+".line.width",t.line.width),r(n+".fillcolor",a.addOpacity(i,.5))}t.exports=function(e,t,r,a){function c(r,a){return n.coerce(e,t,l,r,a)}i(e,t,c,a)?(o(e,t,a,c,{x:!0}),c("line.width"),s(e,t,c,"increasing"),s(e,t,c,"decreasing"),c("text"),c("hovertext"),c("whiskerwidth"),a._requestRangeslider[t.xaxis]=!0):t.visible=!1}},{"../../components/color":81,"../../lib":209,"../ohlc/ohlc_defaults":380,"../scatter/period_defaults":417,"./attributes":329}],332:[function(e,t,r){"use strict";t.exports={moduleType:"trace",name:"candlestick",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","showLegend","candlestick","boxLayout"],meta:{},attributes:e("./attributes"),layoutAttributes:e("../box/layout_attributes"),supplyLayoutDefaults:e("../box/layout_defaults").supplyLayoutDefaults,crossTraceCalc:e("../box/cross_trace_calc").crossTraceCalc,supplyDefaults:e("./defaults"),calc:e("./calc"),plot:e("../box/plot").plot,layerName:"boxlayer",style:e("../box/style").style,hoverPoints:e("../ohlc/hover").hoverPoints,selectPoints:e("../ohlc/select")}},{"../../plots/cartesian":267,"../box/cross_trace_calc":324,"../box/layout_attributes":325,"../box/layout_defaults":326,"../box/plot":327,"../box/style":328,"../ohlc/hover":378,"../ohlc/select":382,"./attributes":329,"./calc":330,"./defaults":331}],333:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;r"),l.color=function(e,t){var r=e.marker,a=t.mc||r.color,i=t.mlc||r.line.color,o=t.mlw||r.line.width;if(n(a))return a;if(n(i)&&o)return i}(c,f),[l]}}},{"../../components/color":81,"../../lib":209,"../bar/hover":313}],341:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc"),plot:e("./plot"),style:e("./style").style,hoverPoints:e("./hover"),eventData:e("./event_data"),selectPoints:e("../bar/select"),moduleType:"trace",name:"funnel",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":267,"../bar/select":318,"./attributes":334,"./calc":335,"./cross_trace_calc":337,"./defaults":338,"./event_data":339,"./hover":340,"./layout_attributes":342,"./layout_defaults":343,"./plot":344,"./style":345}],342:[function(e,t,r){"use strict";t.exports={funnelmode:{valType:"enumerated",values:["stack","group","overlay"],dflt:"stack",editType:"calc"},funnelgap:{valType:"number",min:0,max:1,editType:"calc"},funnelgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],343:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){var i=!1;function o(r,i){return n.coerce(e,t,a,r,i)}for(var l=0;l path").each((function(e){if(!e.isBlank){var t=l.marker;n.select(this).call(i.fill,e.mc||t.color).call(i.stroke,e.mlc||t.line.color).call(a.dashLine,t.line.dash,e.mlw||t.line.width).style("opacity",l.selectedpoints&&!e.selected?o:1)}})),c(r,l,e),r.selectAll(".regions").each((function(){n.select(this).selectAll("path").style("stroke-width",0).call(i.fill,l.connector.fillcolor)})),r.selectAll(".lines").each((function(){var e=l.connector.line;a.lineGroupStyle(n.select(this).selectAll("path"),e.width,e.color,e.dash)}))}))}}},{"../../components/color":81,"../../components/drawing":103,"../../constants/interactions":187,"../bar/style":320,"../bar/uniform_text":322,d3:16}],346:[function(e,t,r){"use strict";var n=e("../pie/attributes"),a=e("../../plots/attributes"),i=e("../../plots/domain").attributes,o=e("../../plots/template_attributes").hovertemplateAttrs,l=e("../../plots/template_attributes").texttemplateAttrs,s=e("../../lib/extend").extendFlat;t.exports={labels:n.labels,label0:n.label0,dlabel:n.dlabel,values:n.values,marker:{colors:n.marker.colors,line:{color:s({},n.marker.line.color,{dflt:null}),width:s({},n.marker.line.width,{dflt:1}),editType:"calc"},editType:"calc"},text:n.text,hovertext:n.hovertext,scalegroup:s({},n.scalegroup,{}),textinfo:s({},n.textinfo,{flags:["label","text","value","percent"]}),texttemplate:l({editType:"plot"},{keys:["label","color","value","text","percent"]}),hoverinfo:s({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:o({},{keys:["label","color","value","text","percent"]}),textposition:s({},n.textposition,{values:["inside","none"],dflt:"inside"}),textfont:n.textfont,insidetextfont:n.insidetextfont,title:{text:n.title.text,font:n.title.font,position:s({},n.title.position,{values:["top left","top center","top right"],dflt:"top center"}),editType:"plot"},domain:i({name:"funnelarea",trace:!0,editType:"calc"}),aspectratio:{valType:"number",min:0,dflt:1,editType:"plot"},baseratio:{valType:"number",min:0,max:1,dflt:.333,editType:"plot"}}},{"../../lib/extend":203,"../../plots/attributes":250,"../../plots/domain":281,"../../plots/template_attributes":295,"../pie/attributes":384}],347:[function(e,t,r){"use strict";var n=e("../../plots/plots");r.name="funnelarea",r.plot=function(e,t,a,i){n.plotBasePlot(r.name,e,t,a,i)},r.clean=function(e,t,a,i){n.cleanBasePlot(r.name,e,t,a,i)}},{"../../plots/plots":288}],348:[function(e,t,r){"use strict";var n=e("../pie/calc");t.exports={calc:function(e,t){return n.calc(e,t)},crossTraceCalc:function(e){n.crossTraceCalc(e,{type:"funnelarea"})}}},{"../pie/calc":386}],349:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./attributes"),i=e("../../plots/domain").defaults,o=e("../bar/defaults").handleText,l=e("../pie/defaults").handleLabelsAndValues;t.exports=function(e,t,r,s){function c(r,i){return n.coerce(e,t,a,r,i)}var u=c("labels"),f=c("values"),d=l(u,f),p=d.len;if(t._hasLabels=d.hasLabels,t._hasValues=d.hasValues,!t._hasLabels&&t._hasValues&&(c("label0"),c("dlabel")),p){t._length=p,c("marker.line.width")&&c("marker.line.color",s.paper_bgcolor),c("marker.colors"),c("scalegroup");var h,g=c("text"),v=c("texttemplate");if(v||(h=c("textinfo",Array.isArray(g)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),v||h&&"none"!==h){var m=c("textposition");o(e,t,s,c,m,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1})}i(t,s,c),c("title.text")&&(c("title.position"),n.coerceFont(c,"title.font",s.font)),c("aspectratio"),c("baseratio")}else t.visible=!1}},{"../../lib":209,"../../plots/domain":281,"../bar/defaults":310,"../pie/defaults":387,"./attributes":346}],350:[function(e,t,r){"use strict";t.exports={moduleType:"trace",name:"funnelarea",basePlotModule:e("./base_plot"),categories:["pie-like","funnelarea","showLegend"],attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults"),supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./calc").crossTraceCalc,plot:e("./plot"),style:e("./style"),styleOne:e("../pie/style_one"),meta:{}}},{"../pie/style_one":395,"./attributes":346,"./base_plot":347,"./calc":348,"./defaults":349,"./layout_attributes":351,"./layout_defaults":352,"./plot":353,"./style":354}],351:[function(e,t,r){"use strict";var n=e("../pie/layout_attributes").hiddenlabels;t.exports={hiddenlabels:n,funnelareacolorway:{valType:"colorlist",editType:"calc"},extendfunnelareacolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{"../pie/layout_attributes":391}],352:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t){function r(r,i){return n.coerce(e,t,a,r,i)}r("hiddenlabels"),r("funnelareacolorway",t.colorway),r("extendfunnelareacolors")}},{"../../lib":209,"./layout_attributes":351}],353:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../components/drawing"),i=e("../../lib"),o=i.strScale,l=i.strTranslate,s=e("../../lib/svg_text_utils"),c=e("../bar/plot").toMoveInsideBar,u=e("../bar/uniform_text"),f=u.recordMinTextSize,d=u.clearMinTextSize,p=e("../pie/helpers"),h=e("../pie/plot"),g=h.attachFxHandlers,v=h.determineInsideTextFont,m=h.layoutAreas,y=h.prerenderTitles,x=h.positionTitleOutside,b=h.formatSliceLabel;function _(e,t){return"l"+(t[0]-e[0])+","+(t[1]-e[1])}t.exports=function(e,t){var r=e._fullLayout;d("funnelarea",r),y(t,e),m(t,r._size),i.makeTraceGroups(r._funnelarealayer,t,"trace").each((function(t){var u=n.select(this),d=t[0],h=d.trace;!function(e){if(!e.length)return;var t=e[0],r=t.trace,n=r.aspectratio,a=r.baseratio;a>.999&&(a=.999);var i,o=Math.pow(a,2),l=t.vTotal,s=l,c=l*o/(1-o)/l;function u(){var e,t={x:e=Math.sqrt(c),y:-e};return[t.x,t.y]}var f,d,p=[];for(p.push(u()),f=e.length-1;f>-1;f--)if(!(d=e[f]).hidden){var h=d.v/s;c+=h,p.push(u())}var g=1/0,v=-1/0;for(f=0;f-1;f--)if(!(d=e[f]).hidden){var M=p[k+=1][0],A=p[k][1];d.TL=[-M,A],d.TR=[M,A],d.BL=w,d.BR=T,d.pxmid=(L=d.TR,S=d.BR,[.5*(L[0]+S[0]),.5*(L[1]+S[1])]),w=d.TL,T=d.TR}var L,S}(t),u.each((function(){var u=n.select(this).selectAll("g.slice").data(t);u.enter().append("g").classed("slice",!0),u.exit().remove(),u.each((function(o,l){if(o.hidden)n.select(this).selectAll("path,g").remove();else{o.pointNumber=o.i,o.curveNumber=h.index;var u=d.cx,m=d.cy,y=n.select(this),x=y.selectAll("path.surface").data([o]);x.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),y.call(g,e,t);var w="M"+(u+o.TR[0])+","+(m+o.TR[1])+_(o.TR,o.BR)+_(o.BR,o.BL)+_(o.BL,o.TL)+"Z";x.attr("d",w),b(e,o,d);var T=p.castOption(h.textposition,o.pts),k=y.selectAll("g.slicetext").data(o.text&&"none"!==T?[0]:[]);k.enter().append("g").classed("slicetext",!0),k.exit().remove(),k.each((function(){var d=i.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),p=i.ensureUniformFontSize(e,v(h,o,r.font));d.text(o.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(a.font,p).call(s.convertToTspans,e);var g,y,x,b=a.bBox(d.node()),_=Math.min(o.BL[1],o.BR[1])+m,w=Math.max(o.TL[1],o.TR[1])+m;y=Math.max(o.TL[0],o.BL[0])+u,x=Math.min(o.TR[0],o.BR[0])+u,(g=c(y,x,_,w,b,{isHorizontal:!0,constrained:!0,angle:0,anchor:"middle"})).fontSize=p.size,f(h.type,g,r),t[l].transform=g,d.attr("transform",i.getTextTransform(g))}))}}));var m=n.select(this).selectAll("g.titletext").data(h.title.text?[0]:[]);m.enter().append("g").classed("titletext",!0),m.exit().remove(),m.each((function(){var t=i.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),c=h.title.text;h._meta&&(c=i.templateString(c,h._meta)),t.text(c).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(a.font,h.title.font).call(s.convertToTspans,e);var u=x(d,r._size);t.attr("transform",l(u.x,u.y)+o(Math.min(1,u.scale))+l(u.tx,u.ty))}))}))}))}},{"../../components/drawing":103,"../../lib":209,"../../lib/svg_text_utils":230,"../bar/plot":317,"../bar/uniform_text":322,"../pie/helpers":389,"../pie/plot":393,d3:16}],354:[function(e,t,r){"use strict";var n=e("d3"),a=e("../pie/style_one"),i=e("../bar/uniform_text").resizeText;t.exports=function(e){var t=e._fullLayout._funnelarealayer.selectAll(".trace");i(e,t,"funnelarea"),t.each((function(e){var t=e[0].trace,r=n.select(this);r.style({opacity:t.opacity}),r.selectAll("path.surface").each((function(e){n.select(this).call(a,e,t)}))}))}},{"../bar/uniform_text":322,"../pie/style_one":395,d3:16}],355:[function(e,t,r){"use strict";var n=e("../bar/attributes"),a=e("../../plots/template_attributes").hovertemplateAttrs,i=e("./bin_attributes"),o=e("./constants"),l=e("../../lib/extend").extendFlat;t.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},text:l({},n.text,{}),hovertext:l({},n.hovertext,{}),orientation:n.orientation,histfunc:{valType:"enumerated",values:["count","sum","avg","min","max"],dflt:"count",editType:"calc"},histnorm:{valType:"enumerated",values:["","percent","probability","density","probability density"],dflt:"",editType:"calc"},cumulative:{enabled:{valType:"boolean",dflt:!1,editType:"calc"},direction:{valType:"enumerated",values:["increasing","decreasing"],dflt:"increasing",editType:"calc"},currentbin:{valType:"enumerated",values:["include","exclude","half"],dflt:"include",editType:"calc"},editType:"calc"},nbinsx:{valType:"integer",min:0,dflt:0,editType:"calc"},xbins:i("x",!0),nbinsy:{valType:"integer",min:0,dflt:0,editType:"calc"},ybins:i("y",!0),autobinx:{valType:"boolean",dflt:null,editType:"calc"},autobiny:{valType:"boolean",dflt:null,editType:"calc"},bingroup:{valType:"string",dflt:"",editType:"calc"},hovertemplate:a({},{keys:o.eventDataKeys}),marker:n.marker,offsetgroup:n.offsetgroup,alignmentgroup:n.alignmentgroup,selected:n.selected,unselected:n.unselected,_deprecated:{bardir:n._deprecated.bardir}}},{"../../lib/extend":203,"../../plots/template_attributes":295,"../bar/attributes":306,"./bin_attributes":357,"./constants":361}],356:[function(e,t,r){"use strict";t.exports=function(e,t){for(var r=e.length,n=0,a=0;ai){var o=i-r[e];return r[e]=i,o}}return 0},max:function(e,t,r,a){var i=a[t];if(n(i)){if(i=Number(i),!n(r[e]))return r[e]=i,i;if(r[e]c?e>o?e>1.1*a?a:e>1.1*i?i:o:e>l?l:e>s?s:c:Math.pow(10,Math.floor(Math.log(e)/Math.LN10))}function p(e,t,r,n,i,l){if(n&&e>o){var s=h(t,i,l),c=h(r,i,l),u=e===a?0:1;return s[u]!==c[u]}return Math.floor(r/e)-Math.floor(t/e)>.1}function h(e,t,r){var n=t.c2d(e,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}t.exports=function(e,t,r,n,i){var l,s,c=-1.1*t,d=-.1*t,p=e-d,h=r[0],g=r[1],v=Math.min(f(h+d,h+p,n,i),f(g+d,g+p,n,i)),m=Math.min(f(h+c,h+d,n,i),f(g+c,g+d,n,i));if(v>m&&mo){var y=l===a?1:6,x=l===a?"M12":"M1";return function(t,r){var o=n.c2d(t,a,i),l=o.indexOf("-",y);l>0&&(o=o.substr(0,l));var c=n.d2c(o,0,i);if(cr.r2l(N)&&(B=o.tickIncrement(B,b.size,!0,p)),R.start=r.l2r(B),F||a.nestedProperty(t,m+".start").set(R.start)}var j=b.end,V=r.r2l(z.end),U=void 0!==V;if((b.endFound||U)&&V!==r.r2l(j)){var q=U?V:a.aggNums(Math.max,null,h);R.end=r.l2r(q),U||a.nestedProperty(t,m+".start").set(R.end)}var G="autobin"+l;return!1===t._input[G]&&(t._input[m]=a.extendFlat({},t[m]||{}),delete t._input[G],delete t[G]),[R,h]}t.exports={calc:function(e,t){var r,i,p,h,g=[],v=[],m=o.getFromId(e,"h"===t.orientation?t.yaxis:t.xaxis),y="h"===t.orientation?"y":"x",x={x:"y",y:"x"}[y],b=t[y+"calendar"],_=t.cumulative,w=d(e,t,m,y),T=w[0],k=w[1],M="string"==typeof T.size,A=[],L=M?A:T,S=[],C=[],O=[],D=0,P=t.histnorm,z=t.histfunc,R=-1!==P.indexOf("density");_.enabled&&R&&(P=P.replace(/ ?density$/,""),R=!1);var E,I="max"===z||"min"===z?null:0,F=s.count,N=c[P],H=!1,B=function(e){return m.r2c(e,0,b)};for(a.isArrayOrTypedArray(t[x])&&"count"!==z&&(E=t[x],H="avg"===z,F=s[z]),r=B(T.start),p=B(T.end)+(r-o.tickIncrement(r,T.size,!1,b))/1e6;r=0&&h=0;n--)l(n);else if("increasing"===t){for(n=1;n=0;n--)e[n]+=e[n+1];"exclude"===r&&(e.push(0),e.shift())}}(v,_.direction,_.currentbin);var Q=Math.min(g.length,v.length),J=[],$=0,K=Q-1;for(r=0;r=$;r--)if(v[r]){K=r;break}for(r=$;r<=K;r++)if(n(g[r])&&n(v[r])){var ee={p:g[r],s:v[r],b:0};_.enabled||(ee.pts=O[r],G?ee.ph0=ee.ph1=O[r].length?k[O[r][0]]:g[r]:(t._computePh=!0,ee.ph0=U(A[r]),ee.ph1=U(A[r+1],!0))),J.push(ee)}return 1===J.length&&(J[0].width1=o.tickIncrement(J[0].p,T.size,!1,b)-J[0].p),l(J,t),a.isArrayOrTypedArray(t.selectedpoints)&&a.tagSelected(J,t,X),J},calcAllAutoBins:d}},{"../../lib":209,"../../plots/cartesian/axes":254,"../../registry":296,"../bar/arrays_to_calcdata":305,"./average":356,"./bin_functions":358,"./bin_label_vals":359,"./norm_functions":367,"fast-isnumeric":18}],361:[function(e,t,r){"use strict";t.exports={eventDataKeys:["binNumber"]}},{}],362:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/cartesian/axis_ids"),i=e("../../registry").traceIs,o=e("../bar/defaults").handleGroupingDefaults,l=n.nestedProperty,s=e("../../plots/cartesian/constraints").getAxisGroup,c=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],u=["x","y"];t.exports=function(e,t){var r,f,d,p,h,g,v,m=t._histogramBinOpts={},y=[],x={},b=[];function _(e,t){return n.coerce(r._input,r,r._module.attributes,e,t)}function w(e){return"v"===e.orientation?"x":"y"}function T(e,r,i){var o=e.uid+"__"+i;r||(r=o);var l=function(e,r){return a.getFromTrace({_fullLayout:t},e,r).type}(e,i),s=e[i+"calendar"]||"",c=m[r],u=!0;c&&(l===c.axType&&s===c.calendar?(u=!1,c.traces.push(e),c.dirs.push(i)):(r=o,l!==c.axType&&n.warn(["Attempted to group the bins of trace",e.index,"set on a","type:"+l,"axis","with bins on","type:"+c.axType,"axis."].join(" ")),s!==c.calendar&&n.warn(["Attempted to group the bins of trace",e.index,"set with a",s,"calendar","with bins",c.calendar?"on a "+c.calendar+" calendar":"w/o a set calendar"].join(" ")))),u&&(m[r]={traces:[e],dirs:[i],axType:l,calendar:e[i+"calendar"]||""}),e["_"+i+"bingroup"]=r}for(h=0;h0}function _(e){e.each((function(e){v.stroke(n.select(this),e.line.color)})).each((function(e){v.fill(n.select(this),e.color)})).style("stroke-width",(function(e){return e.line.width}))}function w(e,t,r){var n=e._fullLayout,i=a.extendFlat({type:"linear",ticks:"outside",range:r,showline:!0},t),o={type:"linear",_id:"x"+t._id},l={letter:"x",font:n.font,noHover:!0,noTickson:!0};function s(e,t){return a.coerce(i,o,g,e,t)}return p(i,o,s,l,n),h(i,o,s,l),o}function T(e,t,r){return[Math.min(t/e.width,r/e.height),e,t+"x"+r]}function k(e,t,r,a){var i=document.createElementNS("http://www.w3.org/2000/svg","text"),o=n.select(i);return o.text(e).attr("x",0).attr("y",0).attr("text-anchor",r).attr("data-unformatted",e).call(f.convertToTspans,a).call(c.font,t),c.bBox(o.node())}function M(e,t,r,n,i,o){var l="_cache"+t;e[l]&&e[l].key===i||(e[l]={key:i,value:r});var s=a.aggNums(o,null,[e[l].value,n],2);return e[l].value=s,s}t.exports=function(e,t,r,p){var h,g=e._fullLayout;b(r)&&p&&(h=p()),a.makeTraceGroups(g._indicatorlayer,t,"trace").each((function(t){var p,A,L,S,C,O=t[0].trace,D=n.select(this),P=O._hasGauge,z=O._isAngular,R=O._isBullet,E=O.domain,I={w:g._size.w*(E.x[1]-E.x[0]),h:g._size.h*(E.y[1]-E.y[0]),l:g._size.l+g._size.w*E.x[0],r:g._size.r+g._size.w*(1-E.x[1]),t:g._size.t+g._size.h*(1-E.y[1]),b:g._size.b+g._size.h*E.y[0]},F=I.l+I.w/2,N=I.t+I.h/2,H=Math.min(I.w/2,I.h),B=u.innerRadius*H,j=O.align||"center";if(A=N,P){if(z&&(p=F,A=N+H/2,L=function(e){return function(e,t){var r=Math.sqrt(e.width/2*(e.width/2)+e.height*e.height);return[t/r,e,t]}(e,.9*B)}),R){var V=u.bulletPadding,U=1-u.bulletNumberDomainSize+V;p=I.l+(U+(1-U)*y[j])*I.w,L=function(e){return T(e,(u.bulletNumberDomainSize-V)*I.w,I.h)}}}else p=I.l+y[j]*I.w,L=function(e){return T(e,I.w,I.h)};!function(e,t,r,l){var s,u,p,h=r[0].trace,g=l.numbersX,_=l.numbersY,T=h.align||"center",A=m[T],L=l.transitionOpts,S=l.onComplete,C=a.ensureSingle(t,"g","numbers"),O=[];h._hasNumber&&O.push("number");h._hasDelta&&(O.push("delta"),"left"===h.delta.position&&O.reverse());var D=C.selectAll("text").data(O);function P(t,r,n,a){if(!t.match("s")||n>=0==a>=0||r(n).slice(-1).match(x)||r(a).slice(-1).match(x))return r;var i=t.slice().replace("s","f").replace(/\d+/,(function(e){return parseInt(e)-1})),o=w(e,{tickformat:i});return function(e){return Math.abs(e)<1?d.tickText(o,e).text:r(e)}}D.enter().append("text"),D.attr("text-anchor",(function(){return A})).attr("class",(function(e){return e})).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),D.exit().remove();var z,R=h.mode+h.align;h._hasDelta&&(z=function(){var t=w(e,{tickformat:h.delta.valueformat},h._range);t.setScale(),d.prepTicks(t);var a=function(e){return d.tickText(t,e).text},i=function(e){return h.delta.relative?e.relativeDelta:e.delta},o=function(e,t){return 0===e||"number"!=typeof e||isNaN(e)?"-":(e>0?h.delta.increasing.symbol:h.delta.decreasing.symbol)+t(e)},l=function(e){return e.delta>=0?h.delta.increasing.color:h.delta.decreasing.color};void 0===h._deltaLastValue&&(h._deltaLastValue=i(r[0]));var s=C.select("text.delta");function p(){s.text(o(i(r[0]),a)).call(v.fill,l(r[0])).call(f.convertToTspans,e)}return s.call(c.font,h.delta.font).call(v.fill,l({delta:h._deltaLastValue})),b(L)?s.transition().duration(L.duration).ease(L.easing).tween("text",(function(){var e=n.select(this),t=i(r[0]),s=h._deltaLastValue,c=P(h.delta.valueformat,a,s,t),u=n.interpolateNumber(s,t);return h._deltaLastValue=t,function(t){e.text(o(u(t),c)),e.call(v.fill,l({delta:u(t)}))}})).each("end",(function(){p(),S&&S()})).each("interrupt",(function(){p(),S&&S()})):p(),u=k(o(i(r[0]),a),h.delta.font,A,e),s}(),R+=h.delta.position+h.delta.font.size+h.delta.font.family+h.delta.valueformat,R+=h.delta.increasing.symbol+h.delta.decreasing.symbol,p=u);h._hasNumber&&(!function(){var t=w(e,{tickformat:h.number.valueformat},h._range);t.setScale(),d.prepTicks(t);var a=function(e){return d.tickText(t,e).text},i=h.number.suffix,o=h.number.prefix,l=C.select("text.number");function u(){var t="number"==typeof r[0].y?o+a(r[0].y)+i:"-";l.text(t).call(c.font,h.number.font).call(f.convertToTspans,e)}b(L)?l.transition().duration(L.duration).ease(L.easing).each("end",(function(){u(),S&&S()})).each("interrupt",(function(){u(),S&&S()})).attrTween("text",(function(){var e=n.select(this),t=n.interpolateNumber(r[0].lastY,r[0].y);h._lastValue=r[0].y;var l=P(h.number.valueformat,a,r[0].lastY,r[0].y);return function(r){e.text(o+l(t(r))+i)}})):u(),s=k(o+a(r[0].y)+i,h.number.font,A,e)}(),R+=h.number.font.size+h.number.font.family+h.number.valueformat+h.number.suffix+h.number.prefix,p=s);if(h._hasDelta&&h._hasNumber){var E,I,F=[(s.left+s.right)/2,(s.top+s.bottom)/2],N=[(u.left+u.right)/2,(u.top+u.bottom)/2],H=.75*h.delta.font.size;"left"===h.delta.position&&(E=M(h,"deltaPos",0,-1*(s.width*y[h.align]+u.width*(1-y[h.align])+H),R,Math.min),I=F[1]-N[1],p={width:s.width+u.width+H,height:Math.max(s.height,u.height),left:u.left+E,right:s.right,top:Math.min(s.top,u.top+I),bottom:Math.max(s.bottom,u.bottom+I)}),"right"===h.delta.position&&(E=M(h,"deltaPos",0,s.width*(1-y[h.align])+u.width*y[h.align]+H,R,Math.max),I=F[1]-N[1],p={width:s.width+u.width+H,height:Math.max(s.height,u.height),left:s.left,right:u.right+E,top:Math.min(s.top,u.top+I),bottom:Math.max(s.bottom,u.bottom+I)}),"bottom"===h.delta.position&&(E=null,I=u.height,p={width:Math.max(s.width,u.width),height:s.height+u.height,left:Math.min(s.left,u.left),right:Math.max(s.right,u.right),top:s.bottom-s.height,bottom:s.bottom+u.height}),"top"===h.delta.position&&(E=null,I=s.top,p={width:Math.max(s.width,u.width),height:s.height+u.height,left:Math.min(s.left,u.left),right:Math.max(s.right,u.right),top:s.bottom-s.height-u.height,bottom:s.bottom}),z.attr({dx:E,dy:I})}(h._hasNumber||h._hasDelta)&&C.attr("transform",(function(){var e=l.numbersScaler(p);R+=e[2];var t,r=M(h,"numbersScale",1,e[0],R,Math.min);h._scaleNumbers||(r=1),t=h._isAngular?_-r*p.bottom:_-r*(p.top+p.bottom)/2,h._numbersTop=r*p.top+t;var n=p[T];"center"===T&&(n=(p.left+p.right)/2);var a=g-r*n;return a=M(h,"numbersTranslate",0,a,R,Math.max),o(a,t)+i(r)}))}(e,D,t,{numbersX:p,numbersY:A,numbersScaler:L,transitionOpts:r,onComplete:h}),P&&(S={range:O.gauge.axis.range,color:O.gauge.bgcolor,line:{color:O.gauge.bordercolor,width:0},thickness:1},C={range:O.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:O.gauge.bordercolor,width:O.gauge.borderwidth},thickness:1});var q=D.selectAll("g.angular").data(z?t:[]);q.exit().remove();var G=D.selectAll("g.angularaxis").data(z?t:[]);G.exit().remove(),z&&function(e,t,r,a){var i,c,u,f,p=r[0].trace,h=a.size,g=a.radius,v=a.innerRadius,m=a.gaugeBg,y=a.gaugeOutline,x=[h.l+h.w/2,h.t+h.h/2+g/2],T=a.gauge,k=a.layer,M=a.transitionOpts,A=a.onComplete,L=Math.PI/2;function S(e){var t=p.gauge.axis.range[0],r=(e-t)/(p.gauge.axis.range[1]-t)*Math.PI-L;return r<-L?-L:r>L?L:r}function C(e){return n.svg.arc().innerRadius((v+g)/2-e/2*(g-v)).outerRadius((v+g)/2+e/2*(g-v)).startAngle(-L)}function O(e){e.attr("d",(function(e){return C(e.thickness).startAngle(S(e.range[0])).endAngle(S(e.range[1]))()}))}T.enter().append("g").classed("angular",!0),T.attr("transform",o(x[0],x[1])),k.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),k.selectAll("g.xangularaxistick,path,text").remove(),(i=w(e,p.gauge.axis)).type="linear",i.range=p.gauge.axis.range,i._id="xangularaxis",i.setScale();var D=function(e){return(i.range[0]-e.x)/(i.range[1]-i.range[0])*Math.PI+Math.PI},P={},z=d.makeLabelFns(i,0).labelStandoff;P.xFn=function(e){var t=D(e);return Math.cos(t)*z},P.yFn=function(e){var t=D(e),r=Math.sin(t)>0?.2:1;return-Math.sin(t)*(z+e.fontSize*r)+Math.abs(Math.cos(t))*(e.fontSize*s)},P.anchorFn=function(e){var t=D(e),r=Math.cos(t);return Math.abs(r)<.1?"middle":r>0?"start":"end"},P.heightFn=function(e,t,r){var n=D(e);return-.5*(1+Math.sin(n))*r};var R=function(e){return o(x[0]+g*Math.cos(e),x[1]-g*Math.sin(e))};u=function(e){return R(D(e))};if(c=d.calcTicks(i),f=d.getTickSigns(i)[2],i.visible){f="inside"===i.ticks?-1:1;var E=(i.linewidth||1)/2;d.drawTicks(e,i,{vals:c,layer:k,path:"M"+f*E+",0h"+f*i.ticklen,transFn:function(e){var t=D(e);return R(t)+"rotate("+-l(t)+")"}}),d.drawLabels(e,i,{vals:c,layer:k,transFn:u,labelFns:P})}var I=[m].concat(p.gauge.steps),F=T.selectAll("g.bg-arc").data(I);F.enter().append("g").classed("bg-arc",!0).append("path"),F.select("path").call(O).call(_),F.exit().remove();var N=C(p.gauge.bar.thickness),H=T.selectAll("g.value-arc").data([p.gauge.bar]);H.enter().append("g").classed("value-arc",!0).append("path");var B=H.select("path");b(M)?(B.transition().duration(M.duration).ease(M.easing).each("end",(function(){A&&A()})).each("interrupt",(function(){A&&A()})).attrTween("d",(j=N,V=S(r[0].lastY),U=S(r[0].y),function(){var e=n.interpolate(V,U);return function(t){return j.endAngle(e(t))()}})),p._lastValue=r[0].y):B.attr("d","number"==typeof r[0].y?N.endAngle(S(r[0].y)):"M0,0Z");var j,V,U;B.call(_),H.exit().remove(),I=[];var q=p.gauge.threshold.value;q&&I.push({range:[q,q],color:p.gauge.threshold.color,line:{color:p.gauge.threshold.line.color,width:p.gauge.threshold.line.width},thickness:p.gauge.threshold.thickness});var G=T.selectAll("g.threshold-arc").data(I);G.enter().append("g").classed("threshold-arc",!0).append("path"),G.select("path").call(O).call(_),G.exit().remove();var Z=T.selectAll("g.gauge-outline").data([y]);Z.enter().append("g").classed("gauge-outline",!0).append("path"),Z.select("path").call(O).call(_),Z.exit().remove()}(e,0,t,{radius:H,innerRadius:B,gauge:q,layer:G,size:I,gaugeBg:S,gaugeOutline:C,transitionOpts:r,onComplete:h});var Z=D.selectAll("g.bullet").data(R?t:[]);Z.exit().remove();var Y=D.selectAll("g.bulletaxis").data(R?t:[]);Y.exit().remove(),R&&function(e,t,r,n){var a,i,l,s,c,f=r[0].trace,p=n.gauge,h=n.layer,g=n.gaugeBg,m=n.gaugeOutline,y=n.size,x=f.domain,T=n.transitionOpts,k=n.onComplete;p.enter().append("g").classed("bullet",!0),p.attr("transform",o(y.l,y.t)),h.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),h.selectAll("g.xbulletaxistick,path,text").remove();var M=y.h,A=f.gauge.bar.thickness*M,L=x.x[0],S=x.x[0]+(x.x[1]-x.x[0])*(f._hasNumber||f._hasDelta?1-u.bulletNumberDomainSize:1);(a=w(e,f.gauge.axis))._id="xbulletaxis",a.domain=[L,S],a.setScale(),i=d.calcTicks(a),l=d.makeTransTickFn(a),s=d.getTickSigns(a)[2],c=y.t+y.h,a.visible&&(d.drawTicks(e,a,{vals:"inside"===a.ticks?d.clipEnds(a,i):i,layer:h,path:d.makeTickPath(a,c,s),transFn:l}),d.drawLabels(e,a,{vals:i,layer:h,transFn:l,labelFns:d.makeLabelFns(a,c)}));function C(e){e.attr("width",(function(e){return Math.max(0,a.c2p(e.range[1])-a.c2p(e.range[0]))})).attr("x",(function(e){return a.c2p(e.range[0])})).attr("y",(function(e){return.5*(1-e.thickness)*M})).attr("height",(function(e){return e.thickness*M}))}var O=[g].concat(f.gauge.steps),D=p.selectAll("g.bg-bullet").data(O);D.enter().append("g").classed("bg-bullet",!0).append("rect"),D.select("rect").call(C).call(_),D.exit().remove();var P=p.selectAll("g.value-bullet").data([f.gauge.bar]);P.enter().append("g").classed("value-bullet",!0).append("rect"),P.select("rect").attr("height",A).attr("y",(M-A)/2).call(_),b(T)?P.select("rect").transition().duration(T.duration).ease(T.easing).each("end",(function(){k&&k()})).each("interrupt",(function(){k&&k()})).attr("width",Math.max(0,a.c2p(Math.min(f.gauge.axis.range[1],r[0].y)))):P.select("rect").attr("width","number"==typeof r[0].y?Math.max(0,a.c2p(Math.min(f.gauge.axis.range[1],r[0].y))):0);P.exit().remove();var z=r.filter((function(){return f.gauge.threshold.value})),R=p.selectAll("g.threshold-bullet").data(z);R.enter().append("g").classed("threshold-bullet",!0).append("line"),R.select("line").attr("x1",a.c2p(f.gauge.threshold.value)).attr("x2",a.c2p(f.gauge.threshold.value)).attr("y1",(1-f.gauge.threshold.thickness)/2*M).attr("y2",(1-(1-f.gauge.threshold.thickness)/2)*M).call(v.stroke,f.gauge.threshold.line.color).style("stroke-width",f.gauge.threshold.line.width),R.exit().remove();var E=p.selectAll("g.gauge-outline").data([m]);E.enter().append("g").classed("gauge-outline",!0).append("rect"),E.select("rect").call(C).call(_),E.exit().remove()}(e,0,t,{gauge:Z,layer:Y,size:I,gaugeBg:S,gaugeOutline:C,transitionOpts:r,onComplete:h});var X=D.selectAll("text.title").data(t);X.exit().remove(),X.enter().append("text").classed("title",!0),X.attr("text-anchor",(function(){return R?m.right:m[O.title.align]})).text(O.title.text).call(c.font,O.title.font).call(f.convertToTspans,e),X.attr("transform",(function(){var e,t=I.l+I.w*y[O.title.align],r=u.titlePadding,n=c.bBox(X.node());if(P){if(z)if(O.gauge.axis.visible)e=c.bBox(G.node()).top-r-n.bottom;else e=I.t+I.h/2-H/2-n.bottom-r;R&&(e=A-(n.top+n.bottom)/2,t=I.l-u.bulletPadding*I.w)}else e=O._numbersTop-r-n.bottom;return o(t,e)}))}))}},{"../../components/color":81,"../../components/drawing":103,"../../constants/alignment":183,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/cartesian/axes":254,"../../plots/cartesian/axis_defaults":256,"../../plots/cartesian/layout_attributes":268,"../../plots/cartesian/position_defaults":271,"./constants":371,d3:16}],375:[function(e,t,r){"use strict";var n=e("../../lib").extendFlat,a=e("../scatter/attributes"),i=e("../../components/drawing/attributes").dash,o=e("../../components/fx/attributes"),l=e("../../constants/delta.js"),s=l.INCREASING.COLOR,c=l.DECREASING.COLOR,u=a.line;function f(e){return{line:{color:n({},u.color,{dflt:e}),width:u.width,dash:i,editType:"style"},editType:"style"}}t.exports={xperiod:a.xperiod,xperiod0:a.xperiod0,xperiodalignment:a.xperiodalignment,x:{valType:"data_array",editType:"calc+clearAxisTypes"},open:{valType:"data_array",editType:"calc"},high:{valType:"data_array",editType:"calc"},low:{valType:"data_array",editType:"calc"},close:{valType:"data_array",editType:"calc"},line:{width:n({},u.width,{}),dash:n({},i,{}),editType:"style"},increasing:f(s),decreasing:f(c),text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},tickwidth:{valType:"number",min:0,max:.5,dflt:.3,editType:"calc"},hoverlabel:n({},o.hoverlabel,{split:{valType:"boolean",dflt:!1,editType:"style"}})}},{"../../components/drawing/attributes":102,"../../components/fx/attributes":112,"../../constants/delta.js":185,"../../lib":209,"../scatter/attributes":397}],376:[function(e,t,r){"use strict";var n=e("../../lib"),a=n._,i=e("../../plots/cartesian/axes"),o=e("../../plots/cartesian/align_period"),l=e("../../constants/numerical").BADNUM;function s(e,t,r,n){return{o:e,h:t,l:r,c:n}}function c(e,t,r,o,s,c){for(var u=s.makeCalcdata(t,"open"),f=s.makeCalcdata(t,"high"),d=s.makeCalcdata(t,"low"),p=s.makeCalcdata(t,"close"),h=Array.isArray(t.text),g=Array.isArray(t.hovertext),v=!0,m=null,y=!!t.xperiodalignment,x=[],b=0;bm):v=M>w,m=M;var A=c(w,T,k,M);A.pos=_,A.yc=(w+M)/2,A.i=b,A.dir=v?"increasing":"decreasing",A.x=A.pos,A.y=[k,T],y&&(A.orig_p=r[b]),h&&(A.tx=t.text[b]),g&&(A.htx=t.hovertext[b]),x.push(A)}else x.push({pos:_,empty:!0})}return t._extremes[s._id]=i.findExtremes(s,n.concat(d,f),{padded:!0}),x.length&&(x[0].t={labels:{open:a(e,"open:")+" ",high:a(e,"high:")+" ",low:a(e,"low:")+" ",close:a(e,"close:")+" "}}),x}t.exports={calc:function(e,t){var r=i.getFromId(e,t.xaxis),a=i.getFromId(e,t.yaxis),l=function(e,t,r){var a=r._minDiff;if(!a){var i,l=e._fullData,s=[];for(a=1/0,i=0;i"+c.labels[x]+n.hoverLabelText(l,b):((y=a.extendFlat({},d)).y0=y.y1=_,y.yLabelVal=b,y.yLabel=c.labels[x]+n.hoverLabelText(l,b),y.name="",f.push(y),v[b]=y)}return f}function d(e,t,r,a){var i=e.cd,o=e.ya,s=i[0].trace,f=i[0].t,d=u(e,t,r,a);if(!d)return[];var p=i[d.index],h=d.index=p.i,g=p.dir;function v(e){return f.labels[e]+n.hoverLabelText(o,s[e][h])}var m=p.hi||s.hoverinfo,y=m.split("+"),x="all"===m,b=x||-1!==y.indexOf("y"),_=x||-1!==y.indexOf("text"),w=b?[v("open"),v("high"),v("low"),v("close")+" "+c[g]]:[];return _&&l(p,s,w),d.extraText=w.join("
"),d.y0=d.y1=o.c2p(p.yc,!0),[d]}t.exports={hoverPoints:function(e,t,r,n){return e.cd[0].trace.hoverlabel.split?f(e,t,r,n):d(e,t,r,n)},hoverSplit:f,hoverOnPoints:d}},{"../../components/color":81,"../../components/fx":121,"../../constants/delta.js":185,"../../lib":209,"../../plots/cartesian/axes":254}],379:[function(e,t,r){"use strict";t.exports={moduleType:"trace",name:"ohlc",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","showLegend"],meta:{},attributes:e("./attributes"),supplyDefaults:e("./defaults"),calc:e("./calc").calc,plot:e("./plot"),style:e("./style"),hoverPoints:e("./hover").hoverPoints,selectPoints:e("./select")}},{"../../plots/cartesian":267,"./attributes":375,"./calc":376,"./defaults":377,"./hover":378,"./plot":381,"./select":382,"./style":383}],380:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports=function(e,t,r,i){var o=r("x"),l=r("open"),s=r("high"),c=r("low"),u=r("close");if(r("hoverlabel.split"),n.getComponentMethod("calendars","handleTraceDefaults")(e,t,["x"],i),l&&s&&c&&u){var f=Math.min(l.length,s.length,c.length,u.length);return o&&(f=Math.min(f,a.minRowLength(o))),t._length=f,f}}},{"../../lib":209,"../../registry":296}],381:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib");t.exports=function(e,t,r,i){var o=t.yaxis,l=t.xaxis,s=!!l.rangebreaks;a.makeTraceGroups(i,r,"trace ohlc").each((function(e){var t=n.select(this),r=e[0],i=r.t;if(!0!==r.trace.visible||i.empty)t.remove();else{var c=i.tickLen,u=t.selectAll("path").data(a.identity);u.enter().append("path"),u.exit().remove(),u.attr("d",(function(e){if(e.empty)return"M0,0Z";var t=l.c2p(e.pos-c,!0),r=l.c2p(e.pos+c,!0),n=s?(t+r)/2:l.c2p(e.pos,!0);return"M"+t+","+o.c2p(e.o,!0)+"H"+n+"M"+n+","+o.c2p(e.h,!0)+"V"+o.c2p(e.l,!0)+"M"+r+","+o.c2p(e.c,!0)+"H"+n}))}}))}},{"../../lib":209,d3:16}],382:[function(e,t,r){"use strict";t.exports=function(e,t){var r,n=e.cd,a=e.xaxis,i=e.yaxis,o=[],l=n[0].t.bPos||0;if(!1===t)for(r=0;r0){l=!0;break}}l||(o=0)}return{hasLabels:r,hasValues:i,len:o}}t.exports={handleLabelsAndValues:s,supplyDefaults:function(e,t,r,n){function c(r,n){return a.coerce(e,t,i,r,n)}var u=s(c("labels"),c("values")),f=u.len;if(t._hasLabels=u.hasLabels,t._hasValues=u.hasValues,!t._hasLabels&&t._hasValues&&(c("label0"),c("dlabel")),f){t._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var d,p=c("text"),h=c("texttemplate");if(h||(d=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),h||d&&"none"!==d){var g=c("textposition");l(e,t,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(t,n,c);var v=c("hole");if(c("title.text")){var m=c("title.position",v?"middle center":"top center");v||"middle center"!==m||(t.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else t.visible=!1}}},{"../../lib":209,"../../plots/domain":281,"../bar/defaults":310,"./attributes":384,"fast-isnumeric":18}],388:[function(e,t,r){"use strict";var n=e("../../components/fx/helpers").appendArrayMultiPointValues;t.exports=function(e,t){var r={curveNumber:t.index,pointNumbers:e.pts,data:t._input,fullData:t,label:e.label,color:e.color,value:e.v,percent:e.percent,text:e.text,v:e.v};return 1===e.pts.length&&(r.pointNumber=r.i=e.pts[0]),n(r,t,e.pts),"funnelarea"===t.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":117}],389:[function(e,t,r){"use strict";var n=e("../../lib");function a(e){return-1!==e.indexOf("e")?e.replace(/[.]?0+e/,"e"):-1!==e.indexOf(".")?e.replace(/[.]?0+$/,""):e}r.formatPiePercent=function(e,t){var r=a((100*e).toPrecision(3));return n.numSeparate(r,t)+"%"},r.formatPieValue=function(e,t){var r=a(e.toPrecision(10));return n.numSeparate(r,t)},r.getFirstFilled=function(e,t){if(Array.isArray(e))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:v.castOption(b.bgcolor,e.pts)||e.color,borderColor:v.castOption(b.bordercolor,e.pts),fontFamily:v.castOption(_.family,e.pts),fontSize:v.castOption(_.size,e.pts),fontColor:v.castOption(_.color,e.pts),nameLength:v.castOption(b.namelength,e.pts),textAlign:v.castOption(b.align,e.pts),hovertemplate:v.castOption(u.hovertemplate,e.pts),hovertemplateLabels:e,eventData:[m(e,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,t.emit("plotly_hover",{points:[m(e,u)],event:n.event})}})),e.on("mouseout",(function(e){var r=t._fullLayout,a=t._fullData[o.index],l=n.select(this).datum();o._hasHoverEvent&&(e.originalEvent=n.event,t.emit("plotly_unhover",{points:[m(l,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),e.on("click",(function(e){var r=t._fullLayout,a=t._fullData[o.index];t._dragging||!1===r.hovermode||(t._hoverdata=[m(e,a)],i.click(t,n.event))}))}function b(e,t,r){var n=v.castOption(e.insidetextfont.color,t.pts);!n&&e._input.textfont&&(n=v.castOption(e._input.textfont.color,t.pts));var a=v.castOption(e.insidetextfont.family,t.pts)||v.castOption(e.textfont.family,t.pts)||r.family,i=v.castOption(e.insidetextfont.size,t.pts)||v.castOption(e.textfont.size,t.pts)||r.size;return{color:n||o.contrast(t.color),family:a,size:i}}function _(e,t){for(var r,n,a=0;at&&t>n||r=-4;v-=2)m(Math.PI*v,"tan");for(v=4;v>=-4;v-=2)m(Math.PI*(v+1),"tan")}if(f||p){for(v=4;v>=-4;v-=2)m(Math.PI*(v+1.5),"rad");for(v=4;v>=-4;v-=2)m(Math.PI*(v+.5),"rad")}}if(l||h||f){var y=Math.sqrt(e.width*e.width+e.height*e.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(t.startangle+t.stopangle)/2,i.scale>=1)return i;g.push(i)}(h||p)&&((i=T(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i)),(h||d)&&((i=k(e,n,o,s,c)).textPosAngle=(t.startangle+t.stopangle)/2,g.push(i));for(var x=0,b=0,_=0;_=1)break}return g[x]}function T(e,t,r,n,a){t=Math.max(0,t-2*g);var i=e.width/e.height,o=L(i,n,t,r);return{scale:2*o/e.height,rCenter:M(i,o/t),rotate:A(a)}}function k(e,t,r,n,a){t=Math.max(0,t-2*g);var i=e.height/e.width,o=L(i,n,t,r);return{scale:2*o/e.width,rCenter:M(i,o/t),rotate:A(a+Math.PI/2)}}function M(e,t){return Math.cos(t)-e*t}function A(e){return(180/Math.PI*e+720)%180-90}function L(e,t,r,n){var a=e+1/(2*Math.tan(t));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(e*e+n/2)+e))}function S(e,t){return e.v!==t.vTotal||t.trace.hole?Math.min(1/(1+1/Math.sin(e.halfangle)),e.ring/2):1}function C(e,t){var r=t.pxmid[0],n=t.pxmid[1],a=e.width/2,i=e.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function O(e,t){var r,n,a,i=e.trace,o={x:e.cx,y:e.cy},l={tx:0,ty:0};l.ty+=i.title.font.size,a=P(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*e.r,l.ty-=e.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*e.r);var s,c,u=(s=e.r,c=e.trace.aspectratio,s/(void 0===c?1:c)),f=t.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(f+=u,o.x-=(1+a)*u,l.tx+=e.titleBox.width/2):-1!==i.title.position.indexOf("center")?f*=2:-1!==i.title.position.indexOf("right")&&(f+=u,o.x+=(1+a)*u,l.tx-=e.titleBox.width/2),r=f/e.titleBox.width,n=D(e,t)/e.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:l.tx,ty:l.ty}}function D(e,t){var r=e.trace,n=t.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(e.titleBox.height,n/2)}function P(e){var t,r=e.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,t=0;tr&&(r=e.pull[t]);return r}function z(e,t){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,s=c*u}o=Math.min(o,s/r.vTotal)}for(n=0;n")}if(i){var x=s.castOption(a,t.i,"texttemplate");if(x){var b=function(e){return{label:e.label,value:e.v,valueLabel:v.formatPieValue(e.v,n.separators),percent:e.v/r.vTotal,percentLabel:v.formatPiePercent(e.v/r.vTotal,n.separators),color:e.color,text:e.text,customdata:s.castOption(a,e.i,"customdata")}}(t),_=v.getFirstFilled(a.text,t.pts);(y(_)||""===_)&&(b.text=_),t.text=s.texttemplateString(x,b,e._fullLayout._d3locale,b,a._meta||{})}else t.text=""}}function I(e,t){var r=e.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(t.left+t.right)/2,o=(t.top+t.bottom)/2;e.textX=i*n-o*a,e.textY=i*a+o*n,e.noCenter=!0}t.exports={plot:function(e,t){var r=e._fullLayout,i=r._size;h("pie",r),_(t,e),z(t,i);var d=s.makeTraceGroups(r._pielayer,t,"trace").each((function(t){var d=n.select(this),h=t[0],g=h.trace;!function(e){var t,r,n,a=e[0],i=a.r,o=a.trace,l=v.getRotationAngle(o.rotation),s=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(t=0;ta.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=S(r,a))}(t),d.attr("stroke-linejoin","round"),d.each((function(){var m=n.select(this).selectAll("g.slice").data(t);m.enter().append("g").classed("slice",!0),m.exit().remove();var y=[[[],[]],[[],[]]],_=!1;m.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=g.index,y[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=h.cx,c=h.cy,u=n.select(this),d=u.selectAll("path.surface").data([a]);if(d.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),u.call(x,e,t),g.pull){var m=+v.castOption(g.pull,a.pts)||0;m>0&&(o+=m*a.pxmid[0],c+=m*a.pxmid[1])}a.cxFinal=o,a.cyFinal=c;var T=g.hole;if(a.v===h.vTotal){var k="M"+(o+a.px0[0])+","+(c+a.px0[1])+O(a.px0,a.pxmid,!0,1)+O(a.pxmid,a.px0,!0,1)+"Z";T?d.attr("d","M"+(o+T*a.px0[0])+","+(c+T*a.px0[1])+O(a.px0,a.pxmid,!1,T)+O(a.pxmid,a.px0,!1,T)+"Z"+k):d.attr("d",k)}else{var M=O(a.px0,a.px1,!0,1);if(T){var A=1-T;d.attr("d","M"+(o+T*a.px1[0])+","+(c+T*a.px1[1])+O(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else d.attr("d","M"+o+","+c+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}E(e,a,h);var L=v.castOption(g.textposition,a.pts),S=u.selectAll("g.slicetext").data(a.text&&"none"!==L?[0]:[]);S.enter().append("g").classed("slicetext",!0),S.exit().remove(),S.each((function(){var u=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),d=s.ensureUniformFontSize(e,"outside"===L?function(e,t,r){var n=v.castOption(e.outsidetextfont.color,t.pts)||v.castOption(e.textfont.color,t.pts)||r.color,a=v.castOption(e.outsidetextfont.family,t.pts)||v.castOption(e.textfont.family,t.pts)||r.family,i=v.castOption(e.outsidetextfont.size,t.pts)||v.castOption(e.textfont.size,t.pts)||r.size;return{color:n,family:a,size:i}}(g,a,r.font):b(g,a,r.font));u.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,d).call(f.convertToTspans,e);var m,y=l.bBox(u.node());if("outside"===L)m=C(y,a);else if(m=w(y,a,h),"auto"===L&&m.scale<1){var x=s.ensureUniformFontSize(e,g.outsidetextfont);u.call(l.font,x),m=C(y=l.bBox(u.node()),a)}var T=m.textPosAngle,k=void 0===T?a.pxmid:R(h.r,T);if(m.targetX=o+k[0]*m.rCenter+(m.x||0),m.targetY=c+k[1]*m.rCenter+(m.y||0),I(m,y),m.outside){var M=m.targetY;a.yLabelMin=M-y.height/2,a.yLabelMid=M,a.yLabelMax=M+y.height/2,a.labelExtraX=0,a.labelExtraY=0,_=!0}m.fontSize=d.size,p(g.type,m,r),t[i].transform=m,u.attr("transform",s.getTextTransform(m))}))}function O(e,t,r,n){var i=n*(t[0]-e[0]),o=n*(t[1]-e[1]);return"a"+n*h.r+","+n*h.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var T=n.select(this).selectAll("g.titletext").data(g.title.text?[0]:[]);if(T.enter().append("g").classed("titletext",!0),T.exit().remove(),T.each((function(){var t,r=s.ensureSingle(n.select(this),"text","",(function(e){e.attr("data-notex",1)})),a=g.title.text;g._meta&&(a=s.templateString(a,g._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(l.font,g.title.font).call(f.convertToTspans,e),t="middle center"===g.title.position?function(e){var t=Math.sqrt(e.titleBox.width*e.titleBox.width+e.titleBox.height*e.titleBox.height);return{x:e.cx,y:e.cy,scale:e.trace.hole*e.r*2/t,tx:0,ty:-e.titleBox.height/2+e.trace.title.font.size}}(h):O(h,i),r.attr("transform",u(t.x,t.y)+c(Math.min(1,t.scale))+u(t.tx,t.ty))})),_&&function(e,t){var r,n,a,i,o,l,s,c,u,f,d,p,h;function g(e,t){return e.pxmid[1]-t.pxmid[1]}function m(e,t){return t.pxmid[1]-e.pxmid[1]}function y(e,r){r||(r={});var a,c,u,d,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),h=n?e.yLabelMin:e.yLabelMax,g=n?e.yLabelMax:e.yLabelMin,m=e.cyFinal+o(e.px0[1],e.px1[1]),y=p-h;if(y*s>0&&(e.labelExtraY=y),Array.isArray(t.pull))for(c=0;c=(v.castOption(t.pull,u.pts)||0)||((e.pxmid[1]-u.pxmid[1])*s>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-h-e.labelExtraY)*s>0&&(e.labelExtraY+=y):(g+e.labelExtraY-m)*s>0&&(a=3*l*Math.abs(c-f.indexOf(e)),(d=u.cxFinal+i(u.px0[0],u.px1[0])+a-(e.cxFinal+e.pxmid[0])-e.labelExtraX)*l>0&&(e.labelExtraX+=d)))}for(n=0;n<2;n++)for(a=n?g:m,o=n?Math.max:Math.min,s=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,l=r?1:-1,(c=e[n][r]).sort(a),u=e[1-n][r],f=u.concat(c),p=[],d=0;dMath.abs(f)?l+="l"+f*e.pxmid[0]/e.pxmid[1]+","+f+"H"+(i+e.labelExtraX+c):l+="l"+e.labelExtraX+","+u+"v"+(f-u)+"h"+c}else l+="V"+(e.yLabelMid+e.labelExtraY)+"h"+c;s.ensureSingle(r,"path","textline").call(o.stroke,t.outsidetextfont.color).attr({"stroke-width":Math.min(2,t.outsidetextfont.size/8),d:l,fill:"none"})}else r.select("path.textline").remove()}))}(m,g),_&&g.automargin){var k=l.bBox(d.node()),M=g.domain,A=i.w*(M.x[1]-M.x[0]),L=i.h*(M.y[1]-M.y[0]),S=(.5*A-h.r)/i.w,D=(.5*L-h.r)/i.h;a.autoMargin(e,"pie."+g.uid+".automargin",{xl:M.x[0]-S,xr:M.x[1]+S,yb:M.y[0]-D,yt:M.y[1]+D,l:Math.max(h.cx-h.r-k.left,0),r:Math.max(k.right-(h.cx+h.r),0),b:Math.max(k.bottom-(h.cy+h.r),0),t:Math.max(h.cy-h.r-k.top,0),pad:5})}}))}));setTimeout((function(){d.selectAll("tspan").each((function(){var e=n.select(this);e.attr("dy")&&e.attr("dy",e.attr("dy"))}))}),0)},formatSliceLabel:E,transformInsideText:w,determineInsideTextFont:b,positionTitleOutside:O,prerenderTitles:_,layoutAreas:z,attachFxHandlers:x,computeTransform:I}},{"../../components/color":81,"../../components/drawing":103,"../../components/fx":121,"../../lib":209,"../../lib/svg_text_utils":230,"../../plots/plots":288,"../bar/constants":308,"../bar/uniform_text":322,"./event_data":388,"./helpers":389,d3:16}],394:[function(e,t,r){"use strict";var n=e("d3"),a=e("./style_one"),i=e("../bar/uniform_text").resizeText;t.exports=function(e){var t=e._fullLayout._pielayer.selectAll(".trace");i(e,t,"pie"),t.each((function(e){var t=e[0].trace,r=n.select(this);r.style({opacity:t.opacity}),r.selectAll("path.surface").each((function(e){n.select(this).call(a,e,t)}))}))}},{"../bar/uniform_text":322,"./style_one":395,d3:16}],395:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("./helpers").castOption;t.exports=function(e,t,r){var i=r.marker.line,o=a(i.color,t.pts)||n.defaultLine,l=a(i.width,t.pts)||0;e.style("stroke-width",l).call(n.fill,t.color).call(n.stroke,o)}},{"../../components/color":81,"./helpers":389}],396:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e,t){for(var r=0;rs&&S[m].gap;)m--;for(x=S[m].s,g=S.length-1;g>m;g--)S[g].s=x;for(;sA[u]&&u=0;a--){var i=e[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],404:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("./attributes"),o=e("./constants"),l=e("./subtypes"),s=e("./xy_defaults"),c=e("./period_defaults"),u=e("./stack_defaults"),f=e("./marker_defaults"),d=e("./line_defaults"),p=e("./line_shape_defaults"),h=e("./text_defaults"),g=e("./fillcolor_defaults");t.exports=function(e,t,r,v){function m(r,a){return n.coerce(e,t,i,r,a)}var y=s(e,t,v,m);if(y||(t.visible=!1),t.visible){c(e,t,v,m);var x=u(e,t,v,m),b=!x&&yG!=(F=P[O][1])>=G&&(R=P[O-1][0],E=P[O][0],F-I&&(z=R+(E-R)*(G-I)/(F-I),j=Math.min(j,z),V=Math.max(V,z)));j=Math.max(j,0),V=Math.min(V,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(e,{distance:e.maxHoverDistance,x0:j,x1:V,y0:G,y1:G,color:Z,hovertemplate:!1}),delete e.index,f.text&&!Array.isArray(f.text)?e.text=String(f.text):e.text=f.name,[e]}}}},{"../../components/color":81,"../../components/fx":121,"../../lib":209,"../../registry":296,"./get_trace_color":407}],409:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:e("./attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("./cross_trace_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./cross_trace_calc"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot"),colorbar:e("./marker_colorbar"),formatLabels:e("./format_labels"),style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":267,"./arrays_to_calcdata":396,"./attributes":397,"./calc":398,"./cross_trace_calc":402,"./cross_trace_defaults":403,"./defaults":404,"./format_labels":406,"./hover":408,"./marker_colorbar":415,"./plot":418,"./select":419,"./style":421,"./subtypes":422}],410:[function(e,t,r){"use strict";var n=e("../../lib").isArrayOrTypedArray,a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l,s){var c=(e.marker||{}).color;(l("line.color",r),a(e,"line"))?i(e,t,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92,"../../lib":209}],411:[function(e,t,r){"use strict";var n=e("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=e("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=e("./constants");t.exports=function(e,t){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,T,k,M,A,L=t.xaxis,S=t.yaxis,C="log"===L.type,O="log"===S.type,D=L._length,P=S._length,z=t.connectGaps,R=t.baseTolerance,E=t.shape,I="linear"===E,F=t.fill&&"none"!==t.fill,N=[],H=f.minTolerance,B=e.length,j=new Array(B),V=0;function U(r){var n=e[r];if(!n)return!1;var i=t.linearized?L.l2p(n.x):L.c2p(n.x),s=t.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;O&&s===a&&(i*=Math.abs(L._m*P*(L._m>0?o:l)/(S._m*D*(S._m>0?o:l)))),i*=1e3}if(s===a){if(O&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function q(e,t,r,n){var a=r-e,i=n-t,o=.5-e,l=.5-t,s=a*a+i*i,c=a*o+i*l;if(c>0&&cre||e[1]ae)return[u(e[0],te,re),u(e[1],ne,ae)]}function le(e,t){return e[0]===t[0]&&(e[0]===te||e[0]===re)||(e[1]===t[1]&&(e[1]===ne||e[1]===ae)||void 0)}function se(e,t,r){return function(n,a){var i=oe(n),o=oe(a),l=[];if(i&&o&&le(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[e]+a[e])/2,t,r)-((i||n)[e]+(o||a)[e]);c&&((i&&o?c>0==i[e]>o[e]?i:o:i||o)[e]+=c);return l}}function ce(e){var t=e[0],r=e[1],n=t===j[V-1][0],a=r===j[V-1][1];if(!n||!a)if(V>1){var i=t===j[V-2][0],o=r===j[V-2][1];n&&(t===te||t===re)&&i?o?V--:j[V-1]=e:a&&(r===ne||r===ae)&&o?i?V--:j[V-1]=e:j[V++]=e}else j[V++]=e}function ue(e){j[V-1][0]!==e[0]&&j[V-1][1]!==e[1]&&ce([W,Q]),ce(e),J=null,W=Q=0}function fe(e){if(M=e[0]/D,A=e[1]/P,Y=e[0]re?re:0,X=e[1]ae?ae:0,Y||X){if(V)if(J){var t=K(J,e);t.length>1&&(ue(t[0]),j[V++]=t[1])}else $=K(j[V-1],e)[0],j[V++]=$;else j[V++]=[Y||e[0],X||e[1]];var r=j[V-1];Y&&X&&(r[0]!==Y||r[1]!==X)?(J&&(W!==Y&&Q!==X?ce(W&&Q?(n=J,i=(a=e)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?te:re,ae]:[o>0?re:te,ne]):[W||Y,Q||X]):W&&Q&&ce([W,Q])),ce([Y,X])):W-Y&&Q-X&&ce([Y||W,X||Q]),J=e,W=Y,Q=X}else J&&ue(K(J,e)[0]),j[V++]=e;var n,a,i,o}for("linear"===E||"spline"===E?K=function(e,t){for(var r=[],n=0,a=0;a<4;a++){var i=ie[a],o=c(e[0],e[1],t[0],t[1],i[0],i[1],i[2],i[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&&Z(o,e)G(h,de))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=e.length||!h)break;fe(h),n=h}}else fe(d)}J&&ce([W||J[0],Q||J[1]]),N.push(j.slice(0,V))}return N}},{"../../constants/numerical":188,"../../lib":209,"./constants":401}],412:[function(e,t,r){"use strict";t.exports=function(e,t,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],413:[function(e,t,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};t.exports=function(e,t,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(t,a):0}}},{"fast-isnumeric":18}],415:[function(e,t,r){"use strict";t.exports={container:"marker",min:"cmin",max:"cmax"}},{}],416:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults"),o=e("./subtypes");t.exports=function(e,t,r,l,s,c){var u=o.isBubble(e),f=(e.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(e,"marker")&&i(e,t,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&t.marker.color!==f?f:u?n.background:n.defaultLine),a(e,"marker.line")&&i(e,t,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":81,"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92,"./subtypes":422}],417:[function(e,t,r){"use strict";var n=e("../../lib").dateTick0,a=e("../../constants/numerical").ONEWEEK;function i(e,t){return n(t,e%a==0?1:0)}t.exports=function(e,t,r,n,a){if(a||(a={x:!0,y:!0}),a.x){var o=n("xperiod");o&&(n("xperiod0",i(o,t.xcalendar)),n("xperiodalignment"))}if(a.y){var l=n("yperiod");l&&(n("yperiod0",i(l,t.ycalendar)),n("yperiodalignment"))}}},{"../../constants/numerical":188,"../../lib":209}],418:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../registry"),i=e("../../lib"),o=i.ensureSingle,l=i.identity,s=e("../../components/drawing"),c=e("./subtypes"),u=e("./line_points"),f=e("./link_traces"),d=e("../../lib/polygon").tester;function p(e,t,r,f,p,h,g){var v;!function(e,t,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(e){return e.x>=u[0]&&e.x<=u[1]&&e.y>=f[0]&&e.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(e,r){var n=e[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(e){return m?e.transition():e}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(h),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),L=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(e,k,r,g),!0===_.visible){var S,C;y(T).style("opacity",_.opacity);var O=_.fill.charAt(_.fill.length-1);"x"!==O&&"y"!==O&&(O=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var D,P,z="",R=[],E=_._prevtrace;E&&(z=E._prevRevpath||"",C=E._nextFill,R=E._polygons);var I,F,N,H,B,j,V,U="",q="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(I=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):I=F="spline"===w.shape?function(e){var t=e[e.length-1];return e.length>1&&e[0][0]===t[0]&&e[0][1]===t[1]?s.smoothclosed(e.slice(1),w.smoothing):s.smoothopen(e,w.smoothing)}:function(e){return"M"+e.join("L")},N=function(e){return F(e.reverse())},G=u(f,{xaxis:x,yaxis:b,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),e)y(r.style("opacity",0).attr("d",D).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",D),s.singleLineStyle(f,a)}}}}}var Y=M.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(Z(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(Y,r.layerClipId,e),G.length?(S?(S.datum(f),H&&j&&(O?("y"===O?H[1]=j[1]=b.c2p(0,!0):"x"===O&&(H[0]=j[0]=x.c2p(0,!0)),y(S).attr("d","M"+j+"L"+H+"L"+U.substr(1)).call(s.singleFillStyle)):y(S).attr("d",U+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&U&&z?("tonext"===_.fill?y(C).attr("d",U+"Z"+z+"Z").call(s.singleFillStyle):y(C).attr("d",U+"L"+z.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(R)):(W(C),_._polygons=null)),_._prevRevpath=q,_._prevPolygons=V):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(t,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=ee(u),h=te,g=te;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===e._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?J:Q:_&&!w&&(v=$),f&&(h=v),d&&(g=v)}var T,k=(o=t.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&k.call(s.pointStyle,u,e).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=s.makePointStyleFns(u)),o.each((function(t){var a=n.select(this),i=y(a);s.translatePoint(t,i,x,b)?(s.singlePointStyle(t,i,u,T,e),r.layerClipId&&s.hideOutsideRangePoint(t,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==t.data&&void 0!==t.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(e){var t=n.select(this),a=y(t.select("text"));s.translatePoint(e,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(e,t,x,b,u.xcalendar,u.ycalendar):t.remove()})),o.selectAll("text").call(s.textPointStyle,u,e).each((function(e){var t=x.c2p(e.x),r=b.c2p(e.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:t,y:r})}))})),o.exit().remove()}(A,L,f);var X=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,X,e),s.setClipUrl(L,X,e)}function W(e){y(e).attr("d","M0,0Z")}function Q(e){return e.filter((function(e){return!e.gap&&e.vis}))}function J(e){return e.filter((function(e){return e.vis}))}function $(e){return e.filter((function(e){return!e.gap}))}function K(e){return e.id}function ee(e){if(e.ids)return K}function te(){return!1}}t.exports=function(e,t,r,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(e,t,r);((u=a.selectAll("g.trace").data(v,(function(e){return e[0].trace.uid}))).enter().append("g").attr("class",(function(e){return"trace scatter trace"+e[0].trace.uid})).style("stroke-miterlimit",2),u.order(),function(e,t,r){t.each((function(t){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,e);var i=t[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(e){i[e]=null})).remove(),u.order().each((function(e){i[e]=o(n.select(this),"path","js-fill")}))}))}(e,u,t),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(e,n,t,r,v,this,i)}))}))):u.each((function(r,n){p(e,n,t,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":103,"../../lib":209,"../../lib/polygon":221,"../../registry":296,"./line_points":411,"./link_traces":413,"./subtypes":422,d3:16}],419:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports=function(e,t){var r,a,i,o,l=e.cd,s=e.xaxis,c=e.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===t)for(r=0;r")),c.color=function(e,t){var r=e[t.dir].marker,n=r.color,i=r.line.color,o=r.line.width;if(a(n))return n;if(a(i)&&o)return i}(f,h),[c]}function w(e){return n(p,e)}}},{"../../components/color":81,"../../constants/delta.js":185,"../../plots/cartesian/axes":254,"../bar/hover":313}],432:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),layoutAttributes:e("./layout_attributes"),supplyDefaults:e("./defaults").supplyDefaults,crossTraceDefaults:e("./defaults").crossTraceDefaults,supplyLayoutDefaults:e("./layout_defaults"),calc:e("./calc"),crossTraceCalc:e("./cross_trace_calc"),plot:e("./plot"),style:e("./style").style,hoverPoints:e("./hover"),eventData:e("./event_data"),selectPoints:e("../bar/select"),moduleType:"trace",name:"waterfall",basePlotModule:e("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":267,"../bar/select":318,"./attributes":425,"./calc":426,"./cross_trace_calc":428,"./defaults":429,"./event_data":430,"./hover":431,"./layout_attributes":433,"./layout_defaults":434,"./plot":435,"./style":436}],433:[function(e,t,r){"use strict";t.exports={waterfallmode:{valType:"enumerated",values:["group","overlay"],dflt:"group",editType:"calc"},waterfallgap:{valType:"number",min:0,max:1,editType:"calc"},waterfallgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],434:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){var i=!1;function o(r,i){return n.coerce(e,t,a,r,i)}for(var l=0;l0&&(v+=d?"M"+f[0]+","+h[1]+"V"+h[0]:"M"+f[1]+","+h[0]+"H"+f[0]),"between"!==p&&(r.isSum||l path").each((function(e){if(!e.isBlank){var t=l[e.dir].marker;n.select(this).call(i.fill,t.color).call(i.stroke,t.line.color).call(a.dashLine,t.line.dash,t.line.width).style("opacity",l.selectedpoints&&!e.selected?o:1)}})),c(r,l,e),r.selectAll(".lines").each((function(){var e=l.connector.line;a.lineGroupStyle(n.select(this).selectAll("path"),e.width,e.color,e.dash)}))}))}}},{"../../components/color":81,"../../components/drawing":103,"../../constants/interactions":187,"../bar/style":320,"../bar/uniform_text":322,d3:16}],437:[function(e,t,r){"use strict";r.version="1.58.0"},{}]},{},[8])(8)})); \ No newline at end of file diff --git a/dist/plotly-geo-assets.js b/dist/plotly-geo-assets.js index 1569b71dc98..3d7e12ff393 100644 --- a/dist/plotly-geo-assets.js +++ b/dist/plotly-geo-assets.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.55.2 +* plotly.js v1.58.0 * Copyright 2012-2020, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -84,7 +84,7 @@ exports.topojson = saneTopojson; 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[16])(16) }); diff --git a/dist/plotly-geo.js b/dist/plotly-geo.js index 21a245415cb..52f040b7ed7 100644 --- a/dist/plotly-geo.js +++ b/dist/plotly-geo.js @@ -1,5 +1,5 @@ /** -* plotly.js (geo) v1.55.2 +* plotly.js (geo) v1.58.0 * Copyright 2012-2020, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -72,7 +72,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":180}],2:[function(_dereq_,module,exports){ +},{"../src/lib":210}],2:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85,7 +85,7 @@ for(var selector in rules) { module.exports = _dereq_('../src/traces/choropleth'); -},{"../src/traces/choropleth":289}],3:[function(_dereq_,module,exports){ +},{"../src/traces/choropleth":320}],3:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98,7 +98,7 @@ module.exports = _dereq_('../src/traces/choropleth'); module.exports = _dereq_('../src/core'); -},{"../src/core":159}],4:[function(_dereq_,module,exports){ +},{"../src/core":189}],4:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -131,7 +131,7 @@ module.exports = Plotly; module.exports = _dereq_('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":330}],6:[function(_dereq_,module,exports){ +},{"../src/traces/scattergeo":362}],6:[function(_dereq_,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var meta_1 = _dereq_("@turf/meta"); @@ -2212,182 +2212,143 @@ exports.findPoint = findPoint; // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -var objectCreate = Object.create || objectCreatePolyfill -var objectKeys = Object.keys || objectKeysPolyfill -var bind = Function.prototype.bind || functionBindPolyfill +'use strict'; -function EventEmitter() { - if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { - this._events = objectCreate(null); - this._eventsCount = 0; +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); } - this._maxListeners = this._maxListeners || undefined; +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); } module.exports = EventEmitter; +module.exports.once = once; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. var defaultMaxListeners = 10; -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; - } - }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } } +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } this._maxListeners = n; return this; }; -function $getMaxListeners(that) { +function _getMaxListeners(that) { if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); -}; - -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); - } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); - } -} + return _getMaxListeners(this); +}; EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); var doError = (type === 'error'); - events = this._events; - if (events) - doError = (doError && events.error == null); + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); else if (!doError) return false; // If there is no 'error' event listener then throw. if (doError) { - if (arguments.length > 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -2398,19 +2359,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -2419,7 +2379,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -2427,33 +2387,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -2475,44 +2431,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -2522,20 +2463,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -2557,35 +2497,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -2594,7 +2537,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -2602,7 +2545,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -2611,7 +2554,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -2624,17 +2567,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -2657,12 +2601,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -2671,16 +2615,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -2688,6 +2625,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -2696,23 +2639,33 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],12:[function(_dereq_,module,exports){ @@ -13614,7 +13567,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); },{}],16:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -14790,8 +14743,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":33}],17:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":62}],17:[function(_dereq_,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -14817,7 +14770,158 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":22}],18:[function(_dereq_,module,exports){ +},{"is-string-blank":51}],18:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],19:[function(_dereq_,module,exports){ +module.exports = clone; + +/** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param {mat4} a matrix to clone + * @returns {mat4} a new 4x4 matrix + */ +function clone(a) { + var out = new Float32Array(16); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],20:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],21:[function(_dereq_,module,exports){ +module.exports = create; + +/** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ +function create() { + var out = new Float32Array(16); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],22:[function(_dereq_,module,exports){ +module.exports = determinant; + +/** + * Calculates the determinant of a mat4 + * + * @param {mat4} a the source matrix + * @returns {Number} determinant of a + */ +function determinant(a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; +}; +},{}],23:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -14865,8 +14969,1033 @@ function fromQuat(out, q) { return out; }; -},{}],19:[function(_dereq_,module,exports){ -(function (global){ +},{}],24:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],25:[function(_dereq_,module,exports){ +module.exports = fromRotationTranslation; + +/** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat4} q Rotation quaternion + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; +}; +},{}],26:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],27:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],28:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],29:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],30:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],31:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],32:[function(_dereq_,module,exports){ +module.exports = identity; + +/** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ +function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],33:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":18,"./clone":19,"./copy":20,"./create":21,"./determinant":22,"./fromQuat":23,"./fromRotation":24,"./fromRotationTranslation":25,"./fromScaling":26,"./fromTranslation":27,"./fromXRotation":28,"./fromYRotation":29,"./fromZRotation":30,"./frustum":31,"./identity":32,"./invert":34,"./lookAt":35,"./multiply":36,"./ortho":37,"./perspective":38,"./perspectiveFromFieldOfView":39,"./rotate":40,"./rotateX":41,"./rotateY":42,"./rotateZ":43,"./scale":44,"./str":45,"./translate":46,"./transpose":47}],34:[function(_dereq_,module,exports){ +module.exports = invert; + +/** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; +}; +},{}],35:[function(_dereq_,module,exports){ +var identity = _dereq_('./identity'); + +module.exports = lookAt; + +/** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {vec3} eye Position of the viewer + * @param {vec3} center Point the viewer is looking at + * @param {vec3} up vec3 pointing up + * @returns {mat4} out + */ +function lookAt(out, eye, center, up) { + var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, + eyex = eye[0], + eyey = eye[1], + eyez = eye[2], + upx = up[0], + upy = up[1], + upz = up[2], + centerx = center[0], + centery = center[1], + centerz = center[2]; + + if (Math.abs(eyex - centerx) < 0.000001 && + Math.abs(eyey - centery) < 0.000001 && + Math.abs(eyez - centerz) < 0.000001) { + return identity(out); + } + + z0 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + + x0 = upy * z2 - upz * z1; + x1 = upz * z0 - upx * z2; + x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + y0 = z1 * x2 - z2 * x1; + y1 = z2 * x0 - z0 * x2; + y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + + return out; +}; +},{"./identity":32}],36:[function(_dereq_,module,exports){ +module.exports = multiply; + +/** + * Multiplies two mat4's + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ +function multiply(out, a, b) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + // Cache only the current line of the second matrix + var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; + out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; + out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; + out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + return out; +}; +},{}],37:[function(_dereq_,module,exports){ +module.exports = ortho; + +/** + * Generates a orthogonal projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} left Left bound of the frustum + * @param {number} right Right bound of the frustum + * @param {number} bottom Bottom bound of the frustum + * @param {number} top Top bound of the frustum + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function ortho(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; +},{}],38:[function(_dereq_,module,exports){ +module.exports = perspective; + +/** + * Generates a perspective projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspective(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2), + nf = 1 / (near - far); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + return out; +}; +},{}],39:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],40:[function(_dereq_,module,exports){ +module.exports = rotate; + +/** + * Rotates a mat4 by the given angle + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function rotate(out, a, rad, axis) { + var x = axis[0], y = axis[1], z = axis[2], + len = Math.sqrt(x * x + y * y + z * z), + s, c, t, + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23, + b00, b01, b02, + b10, b11, b12, + b20, b21, b22; + + if (Math.abs(len) < 0.000001) { return null; } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + s = Math.sin(rad); + c = Math.cos(rad); + t = 1 - c; + + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + // Construct the elements of the rotation matrix + b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; + b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; + b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; +}; +},{}],41:[function(_dereq_,module,exports){ +module.exports = rotateX; + +/** + * Rotates a matrix by the given angle around the X axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateX(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; +}; +},{}],42:[function(_dereq_,module,exports){ +module.exports = rotateY; + +/** + * Rotates a matrix by the given angle around the Y axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateY(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; +}; +},{}],43:[function(_dereq_,module,exports){ +module.exports = rotateZ; + +/** + * Rotates a matrix by the given angle around the Z axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateZ(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; +}; +},{}],44:[function(_dereq_,module,exports){ +module.exports = scale; + +/** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to scale + * @param {vec3} v the vec3 to scale the matrix by + * @returns {mat4} out + **/ +function scale(out, a, v) { + var x = v[0], y = v[1], z = v[2]; + + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],45:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],46:[function(_dereq_,module,exports){ +module.exports = translate; + +/** + * Translate a mat4 by the given vector + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to translate + * @param {vec3} v vector to translate by + * @returns {mat4} out + */ +function translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; +}; +},{}],47:[function(_dereq_,module,exports){ +module.exports = transpose; + +/** + * Transpose the values of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function transpose(out, a) { + // If we are transposing ourselves we can skip a few steps but have to cache some values + if (out === a) { + var a01 = a[1], a02 = a[2], a03 = a[3], + a12 = a[6], a13 = a[7], + a23 = a[11]; + + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + + return out; +}; +},{}],48:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -14881,8 +16010,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":21}],20:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":50}],49:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -14908,9 +16037,9 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":21}],21:[function(_dereq_,module,exports){ +},{"is-browser":50}],50:[function(_dereq_,module,exports){ module.exports = true; -},{}],22:[function(_dereq_,module,exports){ +},{}],51:[function(_dereq_,module,exports){ 'use strict'; /** @@ -14947,7 +16076,7 @@ module.exports = function(str){ return true; } -},{}],23:[function(_dereq_,module,exports){ +},{}],52:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -14974,7 +16103,7 @@ function getBoundingClientOffset (element) { } } -},{}],24:[function(_dereq_,module,exports){ +},{}],53:[function(_dereq_,module,exports){ module.exports = parse @@ -15033,7 +16162,7 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],25:[function(_dereq_,module,exports){ +},{}],54:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -15161,7 +16290,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":26,"./lib/epsilon":27,"./lib/geojson":28,"./lib/intersecter":29,"./lib/segment-chainer":31,"./lib/segment-selector":32}],26:[function(_dereq_,module,exports){ +},{"./lib/build-log":55,"./lib/epsilon":56,"./lib/geojson":57,"./lib/intersecter":58,"./lib/segment-chainer":60,"./lib/segment-selector":61}],55:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -15276,7 +16405,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],27:[function(_dereq_,module,exports){ +},{}],56:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -15448,7 +16577,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],28:[function(_dereq_,module,exports){ +},{}],57:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -15638,7 +16767,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],29:[function(_dereq_,module,exports){ +},{}],58:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16145,7 +17274,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":30}],30:[function(_dereq_,module,exports){ +},{"./linked-list":59}],59:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16228,7 +17357,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],31:[function(_dereq_,module,exports){ +},{}],60:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16482,7 +17611,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],32:[function(_dereq_,module,exports){ +},{}],61:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16650,7 +17779,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],33:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -16836,8 +17965,8 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],34:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +},{}],63:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -18033,7 +19162,7 @@ else { })(Math); -},{}],35:[function(_dereq_,module,exports){ +},{}],64:[function(_dereq_,module,exports){ // https://github.com/topojson/topojson-client v3.1.0 Copyright 2019 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -18543,7 +19672,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); })); -},{}],36:[function(_dereq_,module,exports){ +},{}],65:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18614,7 +19743,7 @@ module.exports = [ } ]; -},{}],37:[function(_dereq_,module,exports){ +},{}],66:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18629,7 +19758,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -18969,7 +20125,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":215,"../../plots/cartesian/constants":231,"../../plots/font_attributes":253,"./arrow_paths":36}],38:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":184,"../../plot_api/plot_template":245,"../../plots/cartesian/constants":262,"../../plots/font_attributes":284,"./arrow_paths":65}],67:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19006,10 +20162,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -19058,7 +20216,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":180,"../../plots/cartesian/axes":225,"./draw":43}],39:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/cartesian/axes":256,"./draw":72}],68:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19196,7 +20354,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":180,"../../plot_api/plot_template":215,"../../registry":275}],40:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plot_api/plot_template":245,"../../registry":306}],69:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19275,7 +20433,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":180,"../color":52}],41:[function(_dereq_,module,exports){ +},{"../../lib":210,"../color":81}],70:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19338,7 +20496,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":203,"fast-isnumeric":17}],42:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":233,"fast-isnumeric":17}],71:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19401,7 +20559,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -19445,7 +20604,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":180,"../../plots/array_container_defaults":221,"../../plots/cartesian/axes":225,"./attributes":37,"./common_defaults":40}],43:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/array_container_defaults":251,"../../plots/cartesian/axes":256,"./attributes":66,"./common_defaults":69}],72:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19461,6 +20620,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -19521,6 +20681,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -19744,13 +20929,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -19766,12 +20952,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -19788,8 +20979,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -19979,7 +21191,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -20010,22 +21222,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -20057,14 +21270,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -20073,7 +21289,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -20083,7 +21301,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -20103,7 +21323,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -20145,7 +21365,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":180,"../../lib/setcursor":199,"../../lib/svg_text_utils":201,"../../plot_api/plot_template":215,"../../plots/cartesian/axes":225,"../../plots/plots":266,"../../registry":275,"../color":52,"../dragelement":71,"../drawing":74,"../fx":92,"./draw_arrow_head":44,"d3":15}],44:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../lib/setcursor":229,"../../lib/svg_text_utils":231,"../../plot_api/plot_template":245,"../../plots/cartesian/axes":256,"../../plots/plots":297,"../../registry":306,"../color":81,"../dragelement":100,"../drawing":103,"../fx":121,"./draw_arrow_head":73,"d3":15}],73:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20163,6 +21383,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -20282,9 +21507,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -20296,7 +21521,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":52,"./arrow_paths":36,"d3":15}],45:[function(_dereq_,module,exports){ +},{"../../lib":210,"../color":81,"./arrow_paths":65,"d3":15}],74:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20330,7 +21555,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":237,"./attributes":37,"./calc_autorange":38,"./click":39,"./convert_coords":41,"./defaults":42,"./draw":43}],46:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":268,"./attributes":66,"./calc_autorange":67,"./click":68,"./convert_coords":70,"./defaults":71,"./draw":72}],75:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20418,7 +21643,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../annotations/attributes":37}],47:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../annotations/attributes":66}],76:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20483,7 +21708,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":180,"../../plots/cartesian/axes":225}],48:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/cartesian/axes":256}],77:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20559,7 +21784,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":180,"../../plots/array_container_defaults":221,"../../plots/cartesian/axes":225,"../annotations/common_defaults":40,"./attributes":46}],49:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/array_container_defaults":251,"../../plots/cartesian/axes":256,"../annotations/common_defaults":69,"./attributes":75}],78:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20611,7 +21836,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":263,"../annotations/draw":43}],50:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":294,"../annotations/draw":72}],79:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20659,7 +21884,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":180,"../../registry":275,"./attributes":46,"./convert":47,"./defaults":48,"./draw":49}],51:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306,"./attributes":75,"./convert":76,"./defaults":77,"./draw":78}],80:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20699,7 +21924,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],52:[function(_dereq_,module,exports){ +},{}],81:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20873,7 +22098,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":51,"fast-isnumeric":17,"tinycolor2":34}],53:[function(_dereq_,module,exports){ +},{"./attributes":80,"fast-isnumeric":17,"tinycolor2":63}],82:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20998,6 +22223,17 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -21014,6 +22250,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -21052,7 +22289,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":172,"../../plot_api/edit_types":208,"../../plots/cartesian/layout_attributes":239,"../../plots/font_attributes":253}],54:[function(_dereq_,module,exports){ +},{"../../lib/extend":202,"../../plot_api/edit_types":238,"../../plots/cartesian/layout_attributes":270,"../../plots/font_attributes":284}],83:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21080,7 +22317,7 @@ module.exports = { } }; -},{}],55:[function(_dereq_,module,exports){ +},{}],84:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21134,10 +22371,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -21146,7 +22387,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":180,"../../plot_api/plot_template":215,"../../plots/cartesian/tick_label_defaults":246,"../../plots/cartesian/tick_mark_defaults":247,"../../plots/cartesian/tick_value_defaults":248,"./attributes":53}],56:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plot_api/plot_template":245,"../../plots/cartesian/tick_label_defaults":277,"../../plots/cartesian/tick_mark_defaults":278,"../../plots/cartesian/tick_value_defaults":279,"./attributes":82}],85:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21165,6 +22406,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -21419,10 +22661,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -21534,18 +22776,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -21609,20 +22852,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -21632,7 +22874,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -21677,7 +22923,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -21733,7 +22979,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -21828,10 +23074,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -21873,7 +23121,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":154,"../../lib":180,"../../lib/extend":172,"../../lib/setcursor":199,"../../lib/svg_text_utils":201,"../../plots/cartesian/axes":225,"../../plots/cartesian/axis_defaults":227,"../../plots/cartesian/layout_attributes":239,"../../plots/cartesian/position_defaults":242,"../../plots/plots":266,"../../registry":275,"../color":52,"../colorscale/helpers":63,"../dragelement":71,"../drawing":74,"../titles":147,"./constants":54,"d3":15,"tinycolor2":34}],57:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":210,"../../lib/extend":202,"../../lib/setcursor":229,"../../lib/svg_text_utils":231,"../../plots/cartesian/axes":256,"../../plots/cartesian/axis_defaults":258,"../../plots/cartesian/layout_attributes":270,"../../plots/cartesian/position_defaults":273,"../../plots/plots":297,"../../registry":306,"../color":81,"../colorscale/helpers":92,"../dragelement":100,"../drawing":103,"../titles":176,"./constants":83,"d3":15,"tinycolor2":63}],86:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21892,7 +23140,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":180}],58:[function(_dereq_,module,exports){ +},{"../../lib":210}],87:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21914,7 +23162,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":53,"./defaults":55,"./draw":56,"./has_colorbar":57}],59:[function(_dereq_,module,exports){ +},{"./attributes":82,"./defaults":84,"./draw":85,"./has_colorbar":86}],88:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22122,7 +23370,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":195,"../colorbar/attributes":53,"./scales.js":67}],60:[function(_dereq_,module,exports){ +},{"../../lib/regex":225,"../colorbar/attributes":82,"./scales.js":96}],89:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22201,7 +23449,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":180,"./helpers":63,"fast-isnumeric":17}],61:[function(_dereq_,module,exports){ +},{"../../lib":210,"./helpers":92,"fast-isnumeric":17}],90:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22278,7 +23526,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":180,"./helpers":63}],62:[function(_dereq_,module,exports){ +},{"../../lib":210,"./helpers":92}],91:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22403,7 +23651,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":180,"../../registry":275,"../colorbar/defaults":55,"../colorbar/has_colorbar":57,"./scales":67,"fast-isnumeric":17}],63:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306,"../colorbar/defaults":84,"../colorbar/has_colorbar":86,"./scales":96,"fast-isnumeric":17}],92:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22643,7 +23891,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":180,"../color":52,"./scales":67,"d3":15,"fast-isnumeric":17,"tinycolor2":34}],64:[function(_dereq_,module,exports){ +},{"../../lib":210,"../color":81,"./scales":96,"d3":15,"fast-isnumeric":17,"tinycolor2":63}],93:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22685,7 +23933,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":59,"./calc":60,"./cross_trace_defaults":61,"./defaults":62,"./helpers":63,"./layout_attributes":65,"./layout_defaults":66,"./scales":67}],65:[function(_dereq_,module,exports){ +},{"./attributes":88,"./calc":89,"./cross_trace_defaults":90,"./defaults":91,"./helpers":92,"./layout_attributes":94,"./layout_defaults":95,"./scales":96}],94:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22746,7 +23994,7 @@ module.exports = { })) }; -},{"../../lib/extend":172,"./attributes":59,"./scales":67}],66:[function(_dereq_,module,exports){ +},{"../../lib/extend":202,"./attributes":88,"./scales":96}],95:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22797,7 +24045,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":180,"../../plot_api/plot_template":215,"./defaults":62,"./layout_attributes":65}],67:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plot_api/plot_template":245,"./defaults":91,"./layout_attributes":94}],96:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23001,7 +24249,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":34}],68:[function(_dereq_,module,exports){ +},{"tinycolor2":63}],97:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23034,7 +24282,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],69:[function(_dereq_,module,exports){ +},{}],98:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23072,7 +24320,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":180}],70:[function(_dereq_,module,exports){ +},{"../../lib":210}],99:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23131,7 +24379,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],71:[function(_dereq_,module,exports){ +},{}],100:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23423,7 +24671,7 @@ function pointerOffset(e) { ); } -},{"../../lib":180,"../../plots/cartesian/constants":231,"./align":68,"./cursor":69,"./unhover":72,"has-hover":19,"has-passive-events":20,"mouse-event-offset":23}],72:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/cartesian/constants":262,"./align":97,"./cursor":98,"./unhover":101,"has-hover":48,"has-passive-events":49,"mouse-event-offset":52}],101:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23478,7 +24726,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":170,"../../lib/events":171,"../../lib/throttle":202,"../fx/constants":86}],73:[function(_dereq_,module,exports){ +},{"../../lib/dom":200,"../../lib/events":201,"../../lib/throttle":232,"../fx/constants":115}],102:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23503,7 +24751,7 @@ exports.dash = { }; -},{}],74:[function(_dereq_,module,exports){ +},{}],103:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23523,6 +24771,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -23584,7 +24833,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -24210,7 +25459,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -24601,7 +25850,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -24635,7 +25884,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -24654,7 +25903,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -24685,9 +25934,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -24695,11 +25944,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":88,"../../constants/alignment":154,"../../constants/interactions":156,"../../constants/xmlns_namespaces":158,"../../lib":180,"../../lib/svg_text_utils":201,"../../registry":275,"../../traces/scatter/make_bubble_size_func":314,"../../traces/scatter/subtypes":321,"../color":52,"../colorscale":64,"./symbol_defs":75,"d3":15,"fast-isnumeric":17,"tinycolor2":34}],75:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":117,"../../constants/alignment":183,"../../constants/interactions":186,"../../constants/xmlns_namespaces":188,"../../lib":210,"../../lib/svg_text_utils":231,"../../registry":306,"../../traces/scatter/make_bubble_size_func":345,"../../traces/scatter/subtypes":353,"../color":81,"../colorscale":93,"./symbol_defs":104,"d3":15,"fast-isnumeric":17,"tinycolor2":63}],104:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25263,7 +26512,7 @@ module.exports = { } }; -},{"d3":15}],76:[function(_dereq_,module,exports){ +},{"d3":15}],105:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25378,7 +26627,7 @@ module.exports = { } }; -},{}],77:[function(_dereq_,module,exports){ +},{}],106:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25464,7 +26713,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":180,"../../plots/cartesian/axes":225,"../../registry":275,"./compute_error":78,"fast-isnumeric":17}],78:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/cartesian/axes":256,"../../registry":306,"./compute_error":107,"fast-isnumeric":17}],107:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25565,7 +26814,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],79:[function(_dereq_,module,exports){ +},{}],108:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25640,7 +26889,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":180,"../../plot_api/plot_template":215,"../../registry":275,"./attributes":76,"fast-isnumeric":17}],80:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plot_api/plot_template":245,"../../registry":306,"./attributes":105,"fast-isnumeric":17}],109:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25709,7 +26958,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":180,"../../plot_api/edit_types":208,"./attributes":76,"./calc":77,"./compute_error":78,"./defaults":79,"./plot":81,"./style":82}],81:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plot_api/edit_types":238,"./attributes":105,"./calc":106,"./compute_error":107,"./defaults":108,"./plot":110,"./style":111}],110:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25881,7 +27130,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":321,"../drawing":74,"d3":15,"fast-isnumeric":17}],82:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":353,"../drawing":103,"d3":15,"fast-isnumeric":17}],111:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25918,7 +27167,7 @@ module.exports = function style(traces) { }); }; -},{"../color":52,"d3":15}],83:[function(_dereq_,module,exports){ +},{"../color":81,"d3":15}],112:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25954,7 +27203,7 @@ module.exports = { } }; -},{"../../lib/extend":172,"../../plots/font_attributes":253,"./layout_attributes":93}],84:[function(_dereq_,module,exports){ +},{"../../lib/extend":202,"../../plots/font_attributes":284,"./layout_attributes":122}],113:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26013,7 +27262,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":180,"../../registry":275}],85:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306}],114:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26050,7 +27299,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":275,"./hover":89}],86:[function(_dereq_,module,exports){ +},{"../../registry":306,"./hover":118}],115:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26082,7 +27331,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],87:[function(_dereq_,module,exports){ +},{}],116:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26108,7 +27357,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":180,"./attributes":83,"./hoverlabel_defaults":90}],88:[function(_dereq_,module,exports){ +},{"../../lib":210,"./attributes":112,"./hoverlabel_defaults":119}],117:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26370,7 +27619,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":180}],89:[function(_dereq_,module,exports){ +},{"../../lib":210}],118:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -26386,6 +27635,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -26565,7 +27816,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -26709,6 +27962,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -27089,10 +28348,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -27333,7 +28590,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -27441,7 +28698,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -27476,8 +28733,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -27485,7 +28747,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -27585,8 +28847,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -27845,7 +29107,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -27861,7 +29126,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -27870,49 +29136,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -28224,7 +29491,7 @@ function plainText(s, len) { }); } -},{"../../lib":180,"../../lib/events":171,"../../lib/override_cursor":191,"../../lib/svg_text_utils":201,"../../plots/cartesian/axes":225,"../../registry":275,"../color":52,"../dragelement":71,"../drawing":74,"../legend/defaults":104,"../legend/draw":105,"./constants":86,"./helpers":88,"d3":15,"fast-isnumeric":17,"tinycolor2":34}],90:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../lib/events":201,"../../lib/override_cursor":221,"../../lib/svg_text_utils":231,"../../plots/cartesian/axes":256,"../../registry":306,"../color":81,"../dragelement":100,"../drawing":103,"../legend/defaults":133,"../legend/draw":134,"./constants":115,"./helpers":117,"d3":15,"fast-isnumeric":17,"tinycolor2":63}],119:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28270,7 +29537,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":180,"../color":52,"./helpers":88}],91:[function(_dereq_,module,exports){ +},{"../../lib":210,"../color":81,"./helpers":117}],120:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28326,7 +29593,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":180,"./layout_attributes":93}],92:[function(_dereq_,module,exports){ +},{"../../lib":210,"./layout_attributes":122}],121:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28405,7 +29672,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":180,"../dragelement":71,"./attributes":83,"./calc":84,"./click":85,"./constants":86,"./defaults":87,"./helpers":88,"./hover":89,"./layout_attributes":93,"./layout_defaults":94,"./layout_global_defaults":95,"d3":15}],93:[function(_dereq_,module,exports){ +},{"../../lib":210,"../dragelement":100,"./attributes":112,"./calc":113,"./click":114,"./constants":115,"./defaults":116,"./helpers":117,"./hover":118,"./layout_attributes":122,"./layout_defaults":123,"./layout_global_defaults":124,"d3":15}],122:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28521,7 +29788,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":253,"./constants":86}],94:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":284,"./constants":115}],123:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28569,7 +29836,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":180,"./helpers":88,"./hoverlabel_defaults":90,"./hovermode_defaults":91,"./layout_attributes":93}],95:[function(_dereq_,module,exports){ +},{"../../lib":210,"./helpers":117,"./hoverlabel_defaults":119,"./hovermode_defaults":120,"./layout_attributes":122}],124:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28592,7 +29859,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":180,"./hoverlabel_defaults":90,"./layout_attributes":93}],96:[function(_dereq_,module,exports){ +},{"../../lib":210,"./hoverlabel_defaults":119,"./layout_attributes":122}],125:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28966,7 +30233,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":180,"../../lib/regex":195,"../../plot_api/plot_template":215,"../../plots/cartesian/constants":231,"../../plots/domain":252}],97:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../lib/regex":225,"../../plot_api/plot_template":245,"../../plots/cartesian/constants":262,"../../plots/domain":283}],126:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28979,6 +30246,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -29101,7 +30369,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw' }); -},{"../../plot_api/plot_template":215,"../../plots/cartesian/constants":231}],98:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":184,"../../plot_api/plot_template":245,"../../plots/cartesian/constants":262}],127:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29182,7 +30450,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":203,"fast-isnumeric":17}],99:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":233,"fast-isnumeric":17}],128:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29234,7 +30502,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -29247,7 +30515,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":180,"../../plots/array_container_defaults":221,"../../plots/cartesian/axes":225,"./attributes":97}],100:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/array_container_defaults":251,"../../plots/cartesian/axes":256,"./attributes":126}],129:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29261,6 +30529,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -29277,7 +30546,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -29380,10 +30649,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -29392,8 +30676,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -29417,8 +30718,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -29472,7 +30773,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":158,"../../plots/cartesian/axes":225,"../drawing":74,"d3":15}],101:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":188,"../../plots/cartesian/axes":256,"../../plots/cartesian/axis_ids":259,"../drawing":103,"d3":15}],130:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29496,7 +30797,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":237,"./attributes":97,"./convert_coords":98,"./defaults":99,"./draw":100}],102:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":268,"./attributes":126,"./convert_coords":127,"./defaults":128,"./draw":129}],131:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29568,6 +30869,14 @@ module.exports = { editType: 'legend', + }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + + editType: 'legend', + }, itemclick: { @@ -29657,7 +30966,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":253,"../color/attributes":51}],103:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":284,"../color/attributes":80}],132:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29677,13 +30986,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],104:[function(_dereq_,module,exports){ +},{}],133:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29799,6 +31106,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -29817,7 +31125,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":180,"../../plot_api/plot_template":215,"../../plots/layout_attributes":264,"../../registry":275,"./attributes":102,"./helpers":108}],105:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plot_api/plot_template":245,"../../plots/layout_attributes":295,"../../registry":306,"./attributes":131,"./helpers":137}],134:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29909,7 +31217,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -30230,11 +31537,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -30287,11 +31594,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -30361,7 +31671,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -30414,8 +31725,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -30528,7 +31839,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -30611,7 +31922,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":154,"../../lib":180,"../../lib/events":171,"../../lib/svg_text_utils":201,"../../plots/plots":266,"../../registry":275,"../color":52,"../dragelement":71,"../drawing":74,"./constants":103,"./get_legend_data":106,"./handle_click":107,"./helpers":108,"./style":110,"d3":15}],106:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":210,"../../lib/events":201,"../../lib/svg_text_utils":231,"../../plots/plots":297,"../../registry":306,"../color":81,"../dragelement":100,"../drawing":103,"./constants":132,"./get_legend_data":135,"./handle_click":136,"./helpers":137,"./style":139,"d3":15}],135:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30720,7 +32031,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":275,"./helpers":108}],107:[function(_dereq_,module,exports){ +},{"../../registry":306,"./helpers":137}],136:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30959,7 +32270,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":180,"../../registry":275}],108:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306}],137:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30983,7 +32294,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],109:[function(_dereq_,module,exports){ +},{}],138:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31007,7 +32318,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":102,"./defaults":104,"./draw":105,"./style":110}],110:[function(_dereq_,module,exports){ +},{"./attributes":131,"./defaults":133,"./draw":134,"./style":139}],139:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31022,6 +32333,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -31030,6 +32342,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -31040,6 +32354,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -31068,7 +32385,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -31171,7 +32488,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -31191,7 +32508,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -31281,7 +32598,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -31293,7 +32610,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -31321,7 +32638,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -31361,7 +32678,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -31385,7 +32702,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -31425,7 +32742,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -31452,7 +32769,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -31488,7 +32805,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -31586,7 +32903,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -31634,7 +32951,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":180,"../../registry":275,"../../traces/pie/helpers":294,"../../traces/pie/style_one":295,"../../traces/scatter/subtypes":321,"../color":52,"../colorscale/helpers":63,"../drawing":74,"d3":15}],111:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306,"../../traces/pie/helpers":325,"../../traces/pie/style_one":326,"../../traces/scatter/subtypes":353,"../color":81,"../colorscale/helpers":92,"../drawing":103,"./constants":132,"d3":15}],140:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32370,7 +33687,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":161,"../../lib":180,"../../plots/cartesian/axis_ids":228,"../../plots/plots":266,"../../registry":275,"../shapes/draw":133}],112:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":191,"../../lib":210,"../../plots/cartesian/axis_ids":259,"../../plots/plots":297,"../../registry":306,"../shapes/draw":162}],141:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32384,7 +33701,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":113}],113:[function(_dereq_,module,exports){ +},{"./manage":142}],142:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32680,7 +33997,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":228,"../../registry":275,"../../traces/scatter/subtypes":321,"../fx/helpers":88,"./buttons":111,"./modebar":114}],114:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":259,"../../registry":306,"../../traces/scatter/subtypes":353,"../fx/helpers":117,"./buttons":140,"./modebar":143}],143:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33026,7 +34343,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":161,"../../lib":180,"d3":15,"fast-isnumeric":17}],115:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":191,"../../lib":210,"d3":15,"fast-isnumeric":17}],144:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33162,7 +34479,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":215,"../../plots/font_attributes":253,"../color/attributes":51}],116:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":245,"../../plots/font_attributes":284,"../color/attributes":80}],145:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33191,7 +34508,7 @@ module.exports = { darkAmount: 10 }; -},{}],117:[function(_dereq_,module,exports){ +},{}],146:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33283,7 +34600,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":180,"../../plot_api/plot_template":215,"../../plots/array_container_defaults":221,"../color":52,"./attributes":115,"./constants":116}],118:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plot_api/plot_template":245,"../../plots/array_container_defaults":251,"../color":81,"./attributes":144,"./constants":145}],147:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33301,6 +34618,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -33430,8 +34748,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -33482,9 +34799,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -33537,10 +34852,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":154,"../../lib":180,"../../lib/svg_text_utils":201,"../../plots/cartesian/axis_ids":228,"../../plots/plots":266,"../../registry":275,"../color":52,"../drawing":74,"./constants":116,"./get_update_object":119,"d3":15}],119:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":210,"../../lib/svg_text_utils":231,"../../plots/cartesian/axis_ids":259,"../../plots/plots":297,"../../registry":306,"../color":81,"../drawing":103,"./constants":145,"./get_update_object":148,"d3":15}],148:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33594,7 +34909,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":15}],120:[function(_dereq_,module,exports){ +},{"d3":15}],149:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33621,7 +34936,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":115,"./defaults":117,"./draw":118}],121:[function(_dereq_,module,exports){ +},{"./attributes":144,"./defaults":146,"./draw":147}],150:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33695,7 +35010,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":51}],122:[function(_dereq_,module,exports){ +},{"../color/attributes":80}],151:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33729,7 +35044,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":224,"../../plots/cartesian/axis_ids":228,"./constants":123}],123:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":255,"../../plots/cartesian/axis_ids":259,"./constants":152}],152:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33785,7 +35100,7 @@ module.exports = { extraPad: 15 }; -},{}],124:[function(_dereq_,module,exports){ +},{}],153:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33871,7 +35186,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":180,"../../plot_api/plot_template":215,"../../plots/cartesian/axis_ids":228,"./attributes":121,"./oppaxis_attributes":128}],125:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plot_api/plot_template":245,"../../plots/cartesian/axis_ids":259,"./attributes":150,"./oppaxis_attributes":157}],154:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33888,6 +35203,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -33993,7 +35309,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -34106,6 +35422,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -34252,10 +35570,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -34277,7 +35595,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -34493,14 +35811,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -34514,7 +35830,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":180,"../../lib/setcursor":199,"../../plots/cartesian":238,"../../plots/cartesian/axis_ids":228,"../../plots/plots":266,"../../registry":275,"../color":52,"../dragelement":71,"../drawing":74,"../titles":147,"./constants":123,"d3":15}],126:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../lib/setcursor":229,"../../plots/cartesian":269,"../../plots/cartesian/axis_ids":259,"../../plots/plots":297,"../../registry":306,"../color":81,"../dragelement":100,"../drawing":103,"../titles":176,"./constants":152,"d3":15}],155:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34589,7 +35905,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":154,"../../lib/svg_text_utils":201,"../../plots/cartesian/axis_ids":228,"./constants":123}],127:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib/svg_text_utils":231,"../../plots/cartesian/axis_ids":259,"./constants":152}],156:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34628,7 +35944,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":180,"./attributes":121,"./calc_autorange":122,"./defaults":124,"./draw":125,"./helpers":126,"./oppaxis_attributes":128}],128:[function(_dereq_,module,exports){ +},{"../../lib":210,"./attributes":150,"./calc_autorange":151,"./defaults":153,"./draw":154,"./helpers":155,"./oppaxis_attributes":157}],157:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34666,7 +35982,7 @@ module.exports = { editType: 'calc' }; -},{}],129:[function(_dereq_,module,exports){ +},{}],158:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34682,6 +35998,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -34818,7 +36135,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":172,"../../plot_api/plot_template":215,"../../traces/scatter/attributes":297,"../annotations/attributes":37,"../drawing/attributes":73}],130:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":184,"../../lib/extend":202,"../../plot_api/plot_template":245,"../../traces/scatter/attributes":328,"../annotations/attributes":66,"../drawing/attributes":102}],159:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34846,9 +36163,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -34859,7 +36179,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -34935,7 +36255,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":180,"../../plots/cartesian/axes":225,"./constants":131,"./helpers":140}],131:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/cartesian/axes":256,"./constants":160,"./helpers":169}],160:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34999,7 +36319,7 @@ module.exports = { } }; -},{}],132:[function(_dereq_,module,exports){ +},{}],161:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35065,9 +36385,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -35128,7 +36450,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":180,"../../plots/array_container_defaults":221,"../../plots/cartesian/axes":225,"./attributes":129,"./helpers":140}],133:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/array_container_defaults":251,"../../plots/cartesian/axes":256,"./attributes":158,"./helpers":169}],162:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35314,7 +36636,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -35340,11 +36665,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -35715,6 +37042,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -35722,15 +37051,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -35887,7 +37224,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":180,"../../lib/setcursor":199,"../../plot_api/plot_template":215,"../../plots/cartesian/axes":225,"../../plots/cartesian/handle_outline":235,"../../registry":275,"../color":52,"../dragelement":71,"../drawing":74,"./constants":131,"./draw_newshape/display_outlines":137,"./draw_newshape/helpers":138,"./helpers":140}],134:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../lib/setcursor":229,"../../plot_api/plot_template":245,"../../plots/cartesian/axes":256,"../../plots/cartesian/handle_outline":266,"../../registry":306,"../color":81,"../dragelement":100,"../drawing":103,"./constants":160,"./draw_newshape/display_outlines":166,"./draw_newshape/helpers":167,"./helpers":169}],163:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35990,7 +37327,7 @@ module.exports = { } }; -},{"../../../lib/extend":172,"../../drawing/attributes":73}],135:[function(_dereq_,module,exports){ +},{"../../../lib/extend":202,"../../drawing/attributes":102}],164:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36014,7 +37351,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],136:[function(_dereq_,module,exports){ +},{}],165:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36046,7 +37383,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":52}],137:[function(_dereq_,module,exports){ +},{"../../color":81}],166:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36341,7 +37678,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":235,"../../../registry":275,"../../dragelement":71,"../../dragelement/helpers":70,"./constants":135,"./helpers":138,"./newshapes":139}],138:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":266,"../../../registry":306,"../../dragelement":100,"../../dragelement/helpers":99,"./constants":164,"./helpers":167,"./newshapes":168}],167:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36679,7 +38016,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":236,"./constants":135,"parse-svg-path":24}],139:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":267,"./constants":164,"parse-svg-path":53}],168:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36938,7 +38275,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":235,"../../../plots/cartesian/helpers":236,"../../dragelement/helpers":70,"./constants":135,"./helpers":138}],140:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":266,"../../../plots/cartesian/helpers":267,"../../dragelement/helpers":99,"./constants":164,"./helpers":167}],169:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36999,18 +38336,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -37020,13 +38363,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -37083,7 +38433,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":180,"./constants":131}],141:[function(_dereq_,module,exports){ +},{"../../lib":210,"./constants":160}],170:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37111,7 +38461,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":237,"./attributes":129,"./calc_autorange":130,"./defaults":132,"./draw":133,"./draw_newshape/defaults":136}],142:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":268,"./attributes":158,"./calc_autorange":159,"./defaults":161,"./draw":162,"./draw_newshape/defaults":165}],171:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37354,7 +38704,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":172,"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../../plots/animation_attributes":220,"../../plots/font_attributes":253,"../../plots/pad_attributes":265,"./constants":143}],143:[function(_dereq_,module,exports){ +},{"../../lib/extend":202,"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../../plots/animation_attributes":250,"../../plots/font_attributes":284,"../../plots/pad_attributes":296,"./constants":172}],172:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37448,7 +38798,7 @@ module.exports = { currentValueInset: 0, }; -},{}],144:[function(_dereq_,module,exports){ +},{}],173:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37563,7 +38913,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":180,"../../plots/array_container_defaults":221,"./attributes":142,"./constants":143}],145:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/array_container_defaults":251,"./attributes":171,"./constants":172}],174:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37580,6 +38930,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -37868,11 +39219,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -37923,11 +39273,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -38140,7 +39489,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -38195,7 +39544,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":154,"../../lib":180,"../../lib/svg_text_utils":201,"../../plot_api/plot_template":215,"../../plots/plots":266,"../color":52,"../drawing":74,"./constants":143,"d3":15}],146:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":210,"../../lib/svg_text_utils":231,"../../plot_api/plot_template":245,"../../plots/plots":297,"../color":81,"../drawing":103,"./constants":172,"d3":15}],175:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38218,7 +39567,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":142,"./constants":143,"./defaults":144,"./draw":145}],147:[function(_dereq_,module,exports){ +},{"./attributes":171,"./constants":172,"./defaults":173,"./draw":174}],176:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38236,6 +39585,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -38356,7 +39706,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -38434,7 +39784,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -38485,7 +39835,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":154,"../../constants/interactions":156,"../../lib":180,"../../lib/svg_text_utils":201,"../../plots/plots":266,"../../registry":275,"../color":52,"../drawing":74,"d3":15,"fast-isnumeric":17}],148:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../constants/interactions":186,"../../lib":210,"../../lib/svg_text_utils":231,"../../plots/plots":297,"../../registry":306,"../color":81,"../drawing":103,"d3":15,"fast-isnumeric":17}],177:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38654,7 +40004,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":172,"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../../plots/font_attributes":253,"../../plots/pad_attributes":265,"../color/attributes":51}],149:[function(_dereq_,module,exports){ +},{"../../lib/extend":202,"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../../plots/font_attributes":284,"../../plots/pad_attributes":296,"../color/attributes":80}],178:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38735,7 +40085,7 @@ module.exports = { } }; -},{}],150:[function(_dereq_,module,exports){ +},{}],179:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38818,7 +40168,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":180,"../../plots/array_container_defaults":221,"./attributes":148,"./constants":149}],151:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/array_container_defaults":251,"./attributes":177,"./constants":178}],180:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39016,8 +40366,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -39256,11 +40605,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -39471,9 +40819,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":154,"../../lib":180,"../../lib/svg_text_utils":201,"../../plot_api/plot_template":215,"../../plots/plots":266,"../color":52,"../drawing":74,"./constants":149,"./scrollbox":153,"d3":15}],152:[function(_dereq_,module,exports){ -arguments[4][146][0].apply(exports,arguments) -},{"./attributes":148,"./constants":149,"./defaults":150,"./draw":151,"dup":146}],153:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../lib":210,"../../lib/svg_text_utils":231,"../../plot_api/plot_template":245,"../../plots/plots":297,"../color":81,"../drawing":103,"./constants":178,"./scrollbox":182,"d3":15}],181:[function(_dereq_,module,exports){ +arguments[4][175][0].apply(exports,arguments) +},{"./attributes":177,"./constants":178,"./defaults":179,"./draw":180,"dup":175}],182:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39938,7 +41286,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":180,"../color":52,"../drawing":74,"d3":15}],154:[function(_dereq_,module,exports){ +},{"../../lib":210,"../color":81,"../drawing":103,"d3":15}],183:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40003,7 +41351,39 @@ module.exports = { } }; -},{}],155:[function(_dereq_,module,exports){ +},{}],184:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],185:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40019,7 +41399,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],156:[function(_dereq_,module,exports){ +},{}],186:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40042,7 +41422,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],157:[function(_dereq_,module,exports){ +},{}],187:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40115,7 +41495,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],158:[function(_dereq_,module,exports){ +},{}],188:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40139,7 +41519,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],159:[function(_dereq_,module,exports){ +},{}],189:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40225,7 +41605,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":45,"./components/annotations3d":50,"./components/colorbar":58,"./components/colorscale":64,"./components/errorbars":80,"./components/fx":92,"./components/grid":96,"./components/images":101,"./components/legend":109,"./components/rangeselector":120,"./components/rangeslider":127,"./components/shapes":141,"./components/sliders":146,"./components/updatemenus":152,"./fonts/mathjax_config":160,"./fonts/ploticon":161,"./lib/queue":194,"./locale-en":206,"./locale-en-us":205,"./plot_api":210,"./plot_api/plot_schema":214,"./plots/plots":266,"./registry":275,"./snapshot":280,"./traces/scatter":309,"./version":334,"d3":15,"es6-promise":16}],160:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":74,"./components/annotations3d":79,"./components/colorbar":87,"./components/colorscale":93,"./components/errorbars":109,"./components/fx":121,"./components/grid":125,"./components/images":130,"./components/legend":138,"./components/rangeselector":149,"./components/rangeslider":156,"./components/shapes":170,"./components/sliders":175,"./components/updatemenus":181,"./fonts/mathjax_config":190,"./fonts/ploticon":191,"./lib/queue":224,"./locale-en":236,"./locale-en-us":235,"./plot_api":240,"./plot_api/plot_schema":244,"./plots/plots":297,"./registry":306,"./snapshot":311,"./traces/scatter":340,"./version":366,"d3":15,"es6-promise":16}],190:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40256,7 +41636,7 @@ module.exports = function() { } }; -},{}],161:[function(_dereq_,module,exports){ +},{}],191:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40436,7 +41816,7 @@ module.exports = { } }; -},{}],162:[function(_dereq_,module,exports){ +},{}],192:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40500,7 +41880,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],163:[function(_dereq_,module,exports){ +},{}],193:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40741,7 +42121,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":187}],164:[function(_dereq_,module,exports){ +},{"./mod":217}],194:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40898,7 +42278,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],165:[function(_dereq_,module,exports){ +},{}],195:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40931,7 +42311,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":157,"fast-isnumeric":17}],166:[function(_dereq_,module,exports){ +},{"../constants/numerical":187,"fast-isnumeric":17}],196:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40959,7 +42339,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],167:[function(_dereq_,module,exports){ +},{}],197:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40982,7 +42362,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],168:[function(_dereq_,module,exports){ +},{}],198:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41446,7 +42826,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":67,"../constants/interactions":156,"../plots/attributes":222,"./array":164,"./mod":187,"./nested_property":188,"./regex":195,"fast-isnumeric":17,"tinycolor2":34}],169:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":96,"../constants/interactions":186,"../plots/attributes":252,"./array":194,"./mod":217,"./nested_property":218,"./regex":225,"fast-isnumeric":17,"tinycolor2":63}],199:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41494,9 +42874,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -41504,7 +42898,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -42033,7 +43427,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":157,"../registry":275,"./loggers":184,"./mod":187,"d3-time-format":13,"fast-isnumeric":17}],170:[function(_dereq_,module,exports){ +},{"../constants/numerical":187,"../registry":306,"./loggers":214,"./mod":217,"d3-time-format":13,"fast-isnumeric":17}],200:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42046,6 +43440,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -42127,16 +43523,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":184,"d3":15}],171:[function(_dereq_,module,exports){ +},{"./loggers":214,"./matrix":216,"d3":15,"gl-mat4":33}],201:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42309,7 +43778,7 @@ var Events = { module.exports = Events; -},{"events":11}],172:[function(_dereq_,module,exports){ +},{"events":11}],202:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42423,7 +43892,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":181}],173:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":211}],203:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42474,7 +43943,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],174:[function(_dereq_,module,exports){ +},{}],204:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42522,7 +43991,7 @@ function isCalcData(cont) { ); } -},{}],175:[function(_dereq_,module,exports){ +},{}],205:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42907,7 +44376,7 @@ module.exports = { computeBbox: computeBbox }; -},{"./identity":178,"./is_plain_object":181,"./loggers":184,"./nested_property":188,"./polygon":192,"@turf/area":6,"@turf/bbox":7,"@turf/centroid":8,"country-regex":12,"d3":15}],176:[function(_dereq_,module,exports){ +},{"./identity":208,"./is_plain_object":211,"./loggers":214,"./nested_property":218,"./polygon":222,"@turf/area":6,"@turf/bbox":7,"@turf/centroid":8,"country-regex":12,"d3":15}],206:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43024,7 +44493,7 @@ exports.makeBlank = function() { }; }; -},{"../constants/numerical":157}],177:[function(_dereq_,module,exports){ +},{"../constants/numerical":187}],207:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43268,7 +44737,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":187}],178:[function(_dereq_,module,exports){ +},{"./mod":217}],208:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43284,7 +44753,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { module.exports = function identity(d) { return d; }; -},{}],179:[function(_dereq_,module,exports){ +},{}],209:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43326,7 +44795,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],180:[function(_dereq_,module,exports){ +},{}],210:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -43417,8 +44886,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -43474,6 +44946,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -44524,6 +46000,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -44550,13 +46038,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -44574,7 +46060,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":157,"./anchor_utils":162,"./angles":163,"./array":164,"./clean_number":165,"./clear_responsive":167,"./coerce":168,"./dates":169,"./dom":170,"./extend":172,"./filter_unique":173,"./filter_visible":174,"./geometry2d":177,"./identity":178,"./increment":179,"./is_plain_object":181,"./keyed_container":182,"./localize":183,"./loggers":184,"./make_trace_groups":185,"./matrix":186,"./mod":187,"./nested_property":188,"./noop":189,"./notifier":190,"./push_unique":193,"./regex":195,"./relative_attr":196,"./relink_private":197,"./search":198,"./stats":200,"./throttle":202,"./to_log_range":203,"d3":15,"d3-time-format":13,"fast-isnumeric":17}],181:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":187,"./anchor_utils":192,"./angles":193,"./array":194,"./clean_number":195,"./clear_responsive":197,"./coerce":198,"./dates":199,"./dom":200,"./extend":202,"./filter_unique":203,"./filter_visible":204,"./geometry2d":207,"./identity":208,"./increment":209,"./is_plain_object":211,"./keyed_container":212,"./localize":213,"./loggers":214,"./make_trace_groups":215,"./matrix":216,"./mod":217,"./nested_property":218,"./noop":219,"./notifier":220,"./push_unique":223,"./regex":225,"./relative_attr":226,"./relink_private":227,"./search":228,"./stats":230,"./throttle":232,"./to_log_range":233,"d3":15,"d3-time-format":13,"fast-isnumeric":17}],211:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44602,7 +46105,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],182:[function(_dereq_,module,exports){ +},{}],212:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44795,7 +46298,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":188}],183:[function(_dereq_,module,exports){ +},{"./nested_property":218}],213:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44851,7 +46354,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":275}],184:[function(_dereq_,module,exports){ +},{"../registry":306}],214:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44961,7 +46464,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":213,"./notifier":190}],185:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":243,"./notifier":220}],215:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45004,7 +46507,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":15}],186:[function(_dereq_,module,exports){ +},{"d3":15}],216:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45016,6 +46519,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -45091,13 +46595,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -45111,7 +46625,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],187:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":33}],217:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45146,7 +46694,7 @@ module.exports = { modHalf: modHalf }; -},{}],188:[function(_dereq_,module,exports){ +},{}],218:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45392,7 +46940,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":164,"fast-isnumeric":17}],189:[function(_dereq_,module,exports){ +},{"./array":194,"fast-isnumeric":17}],219:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45408,7 +46956,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],190:[function(_dereq_,module,exports){ +},{}],220:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45496,7 +47044,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":15,"fast-isnumeric":17}],191:[function(_dereq_,module,exports){ +},{"d3":15,"fast-isnumeric":17}],221:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45544,7 +47092,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":199}],192:[function(_dereq_,module,exports){ +},{"./setcursor":229}],222:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45796,7 +47344,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":157,"./matrix":186}],193:[function(_dereq_,module,exports){ +},{"../constants/numerical":187,"./matrix":216}],223:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45834,7 +47382,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],194:[function(_dereq_,module,exports){ +},{}],224:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46042,7 +47590,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":180,"../plot_api/plot_config":213}],195:[function(_dereq_,module,exports){ +},{"../lib":210,"../plot_api/plot_config":243}],225:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46072,7 +47620,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],196:[function(_dereq_,module,exports){ +},{}],226:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46125,7 +47673,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],197:[function(_dereq_,module,exports){ +},{}],227:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46182,7 +47730,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":164,"./is_plain_object":181}],198:[function(_dereq_,module,exports){ +},{"./array":194,"./is_plain_object":211}],228:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46387,7 +47935,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":157,"./identity":178,"./loggers":184,"fast-isnumeric":17}],199:[function(_dereq_,module,exports){ +},{"../constants/numerical":187,"./identity":208,"./loggers":214,"fast-isnumeric":17}],229:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46410,7 +47958,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],200:[function(_dereq_,module,exports){ +},{}],230:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46520,7 +48068,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":164,"fast-isnumeric":17}],201:[function(_dereq_,module,exports){ +},{"./array":194,"fast-isnumeric":17}],231:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46537,6 +48085,7 @@ exports.interp = function(arr, n) { var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -46651,7 +48200,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -47266,9 +48815,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -47399,7 +48959,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":154,"../constants/xmlns_namespaces":158,"../lib":180,"d3":15}],202:[function(_dereq_,module,exports){ +},{"../constants/alignment":183,"../constants/xmlns_namespaces":188,"../lib":210,"d3":15}],232:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47502,7 +49062,7 @@ function _clearTimeout(cache) { } } -},{}],203:[function(_dereq_,module,exports){ +},{}],233:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47530,7 +49090,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":17}],204:[function(_dereq_,module,exports){ +},{"fast-isnumeric":17}],234:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47564,7 +49124,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":255,"topojson-client":35}],205:[function(_dereq_,module,exports){ +},{"../plots/geo/constants":286,"topojson-client":64}],235:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47586,7 +49146,7 @@ module.exports = { } }; -},{}],206:[function(_dereq_,module,exports){ +},{}],236:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47629,7 +49189,7 @@ module.exports = { } }; -},{}],207:[function(_dereq_,module,exports){ +},{}],237:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47687,7 +49247,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":275}],208:[function(_dereq_,module,exports){ +},{"../registry":306}],238:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47812,7 +49372,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":180}],209:[function(_dereq_,module,exports){ +},{"../lib":210}],239:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47989,6 +49549,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -48033,7 +49603,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -48504,7 +50074,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":52,"../lib":180,"../plots/cartesian/axis_ids":228,"../plots/plots":266,"../registry":275,"fast-isnumeric":17,"gl-mat4/fromQuat":18}],210:[function(_dereq_,module,exports){ +},{"../components/color":81,"../lib":210,"../plots/cartesian/axis_ids":259,"../plots/plots":297,"../registry":306,"fast-isnumeric":17,"gl-mat4/fromQuat":23}],240:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -48547,7 +50117,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":277,"./plot_api":212,"./template_api":217,"./to_image":218,"./validate":219}],211:[function(_dereq_,module,exports){ +},{"../snapshot/download":308,"./plot_api":242,"./template_api":247,"./to_image":248,"./validate":249}],241:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -48760,7 +50330,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":181,"../lib/loggers":184,"../lib/noop":189,"../lib/search":198,"../registry":275,"./container_array_match":207}],212:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":211,"../lib/loggers":214,"../lib/noop":219,"../lib/search":228,"../registry":306,"./container_array_match":237}],242:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -49130,7 +50700,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -49144,9 +50725,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -50724,6 +52312,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -50818,7 +52412,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -50908,7 +52502,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -51046,21 +52640,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -52471,6 +54063,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -52478,15 +54083,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -52512,6 +54122,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -52645,7 +54256,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":52,"../components/drawing":74,"../constants/xmlns_namespaces":158,"../lib":180,"../lib/events":171,"../lib/queue":194,"../lib/svg_text_utils":201,"../plots/cartesian/axes":225,"../plots/cartesian/constants":231,"../plots/cartesian/graph_interact":234,"../plots/cartesian/select":244,"../plots/plots":266,"../plots/polar/legacy":269,"../registry":275,"./edit_types":208,"./helpers":209,"./manage_arrays":211,"./plot_config":213,"./plot_schema":214,"./subroutines":216,"d3":15,"fast-isnumeric":17,"has-hover":19}],213:[function(_dereq_,module,exports){ +},{"../components/color":81,"../components/drawing":103,"../constants/xmlns_namespaces":188,"../lib":210,"../lib/events":201,"../lib/queue":224,"../lib/svg_text_utils":231,"../plots/cartesian/axes":256,"../plots/cartesian/constants":262,"../plots/cartesian/graph_interact":265,"../plots/cartesian/select":275,"../plots/plots":297,"../plots/polar/legacy":300,"../registry":306,"./edit_types":238,"./helpers":239,"./manage_arrays":241,"./plot_config":243,"./plot_schema":244,"./subroutines":246,"d3":15,"fast-isnumeric":17,"has-hover":48}],243:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52960,7 +54571,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],214:[function(_dereq_,module,exports){ +},{}],244:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53671,7 +55282,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":180,"../plots/animation_attributes":220,"../plots/attributes":222,"../plots/frame_attributes":254,"../plots/layout_attributes":264,"../plots/polar/legacy/area_attributes":267,"../plots/polar/legacy/axis_attributes":268,"../registry":275,"./edit_types":208,"./plot_config":213}],215:[function(_dereq_,module,exports){ +},{"../lib":210,"../plots/animation_attributes":250,"../plots/attributes":252,"../plots/frame_attributes":285,"../plots/layout_attributes":295,"../plots/polar/legacy/area_attributes":298,"../plots/polar/legacy/axis_attributes":299,"../registry":306,"./edit_types":238,"./plot_config":243}],245:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53983,7 +55594,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":180,"../plots/attributes":222}],216:[function(_dereq_,module,exports){ +},{"../lib":210,"../plots/attributes":252}],246:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54164,7 +55775,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -54653,57 +56264,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - enforceAxisConstraints(gd); - - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; - - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); + + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -54729,7 +56318,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":52,"../components/drawing":74,"../components/modebar":112,"../components/titles":147,"../constants/alignment":154,"../lib":180,"../lib/clear_gl_canvases":166,"../plots/cartesian/autorange":224,"../plots/cartesian/axes":225,"../plots/cartesian/constraints":232,"../plots/plots":266,"../registry":275,"d3":15}],217:[function(_dereq_,module,exports){ +},{"../components/color":81,"../components/drawing":103,"../components/modebar":141,"../components/titles":176,"../constants/alignment":183,"../lib":210,"../lib/clear_gl_canvases":196,"../plots/cartesian/autorange":255,"../plots/cartesian/axes":256,"../plots/cartesian/constraints":263,"../plots/plots":297,"../registry":306,"d3":15}],247:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55191,7 +56780,7 @@ function format(opts) { return opts; } -},{"../lib":180,"../plots/attributes":222,"../plots/plots":266,"./plot_config":213,"./plot_schema":214,"./plot_template":215}],218:[function(_dereq_,module,exports){ +},{"../lib":210,"../plots/attributes":252,"../plots/plots":297,"./plot_config":243,"./plot_schema":244,"./plot_template":245}],248:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55288,7 +56877,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -55412,7 +57001,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":180,"../plots/plots":266,"../snapshot/helpers":279,"../snapshot/svgtoimg":281,"../snapshot/tosvg":283,"../version":334,"./plot_api":212,"fast-isnumeric":17}],219:[function(_dereq_,module,exports){ +},{"../lib":210,"../plots/plots":297,"../snapshot/helpers":310,"../snapshot/svgtoimg":312,"../snapshot/tosvg":314,"../version":366,"./plot_api":242,"fast-isnumeric":17}],249:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55843,7 +57432,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":180,"../plots/plots":266,"./plot_config":213,"./plot_schema":214}],220:[function(_dereq_,module,exports){ +},{"../lib":210,"../plots/plots":297,"./plot_config":243,"./plot_schema":244}],250:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55955,7 +57544,7 @@ module.exports = { } }; -},{}],221:[function(_dereq_,module,exports){ +},{}],251:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56050,7 +57639,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":180,"../plot_api/plot_template":215}],222:[function(_dereq_,module,exports){ +},{"../lib":210,"../plot_api/plot_template":245}],252:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56191,7 +57780,99 @@ module.exports = { } }; -},{"../components/fx/attributes":83}],223:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":112}],253:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":187,"../../lib":210,"fast-isnumeric":17}],254:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56220,7 +57901,7 @@ module.exports = { } }; -},{}],224:[function(_dereq_,module,exports){ +},{}],255:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56237,6 +57918,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -56277,7 +57960,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -56318,19 +58002,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -56338,9 +58009,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -56358,8 +58029,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -56373,7 +58044,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -56394,7 +58065,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -56403,12 +58074,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -56418,13 +58089,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -56436,7 +58135,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -56465,14 +58254,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -56732,7 +58541,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":157,"../../lib":180,"../../registry":275,"fast-isnumeric":17}],225:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../../lib":210,"../../registry":306,"./axis_ids":259,"fast-isnumeric":17}],256:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56749,6 +58558,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -56782,6 +58592,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -56826,14 +58638,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -56841,6 +58656,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -56865,8 +58695,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -56875,7 +58705,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -56934,7 +58763,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -57256,6 +59087,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -57280,7 +59114,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -57290,6 +59124,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -57303,6 +59141,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -57315,15 +59337,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -57335,85 +59362,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } + var flip = ax._id.charAt(0) === 'y'; - var pos = ax.c2p(tickVal.value); + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -57434,180 +59457,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } - - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -57700,7 +59575,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -57717,15 +59593,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -57838,7 +59716,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -58321,6 +60200,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -58593,21 +60473,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -58708,23 +60590,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -58755,13 +60638,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -58782,7 +60665,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -58798,7 +60681,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -58818,7 +60701,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -58850,7 +60733,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -58862,7 +60745,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -58877,7 +60760,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -59133,21 +61016,81 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; +}; + +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; -}; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} /** * Make axis tick path string @@ -59194,24 +61137,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -59219,42 +61183,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } + + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } - out.xFn = function(d) { return d.dx + x0; }; + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } + + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -59506,6 +61529,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -59523,22 +61548,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -59606,11 +61675,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -59650,6 +61732,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -60131,7 +62233,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":52,"../../components/drawing":74,"../../components/titles":147,"../../constants/alignment":154,"../../constants/numerical":157,"../../lib":180,"../../lib/svg_text_utils":201,"../../plots/plots":266,"../../registry":275,"./autorange":224,"./axis_autotype":226,"./axis_ids":228,"./clean_ticks":230,"./layout_attributes":239,"./set_convert":245,"d3":15,"fast-isnumeric":17}],226:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../../components/titles":176,"../../constants/alignment":183,"../../constants/numerical":187,"../../lib":210,"../../lib/svg_text_utils":231,"../../plots/plots":297,"../../registry":306,"./autorange":255,"./axis_autotype":257,"./axis_ids":259,"./clean_ticks":261,"./layout_attributes":270,"./set_convert":276,"d3":15,"fast-isnumeric":17}],257:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60148,23 +62250,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; + + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } + + if(moreDates(a, calendar)) return 'date'; - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -60177,56 +62305,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":157,"../../lib":180,"fast-isnumeric":17}],227:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../../lib":210,"fast-isnumeric":17}],258:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60283,9 +62421,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -60343,7 +62505,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -60355,8 +62520,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -60509,7 +62672,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":180,"../../registry":275,"../array_container_defaults":221,"./category_order_defaults":229,"./constants":231,"./layout_attributes":239,"./line_grid_defaults":241,"./set_convert":245,"./tick_label_defaults":246,"./tick_mark_defaults":247,"./tick_value_defaults":248,"fast-isnumeric":17}],228:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306,"../array_container_defaults":251,"./category_order_defaults":260,"./constants":262,"./layout_attributes":270,"./line_grid_defaults":272,"./set_convert":276,"./tick_label_defaults":277,"./tick_mark_defaults":278,"./tick_value_defaults":279,"fast-isnumeric":17}],259:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60530,7 +62693,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -60542,13 +62705,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -60594,6 +62764,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -60626,17 +62798,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":275,"./constants":231}],229:[function(_dereq_,module,exports){ +},{"../../registry":306,"./constants":262}],260:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60730,7 +62906,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],230:[function(_dereq_,module,exports){ +},{}],261:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60743,7 +62919,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -60808,7 +62986,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -60818,7 +62998,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":157,"../../lib":180,"fast-isnumeric":17}],231:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../../lib":210,"fast-isnumeric":17}],262:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60833,8 +63013,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -60846,7 +63026,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -60910,7 +63090,7 @@ module.exports = { } }; -},{"../../lib/regex":195}],232:[function(_dereq_,module,exports){ +},{"../../lib/regex":225}],263:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60922,74 +63102,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; + + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; + + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } + + var canLink = linkableAxes.length; + + var matches, scaleanchor; - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -61000,64 +63386,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; +} - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -61066,12 +63427,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -61084,38 +63447,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); + } + } + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } } + + out[key] = val; } - thisGroup[scaleanchor] = 1; + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -61224,25 +63658,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -61264,6 +63699,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -61296,7 +63741,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":154,"../../constants/numerical":157,"../../lib":180,"./autorange":224,"./axis_ids":228,"./scale_zoom":243}],233:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183,"../../constants/numerical":187,"../../lib":210,"./autorange":255,"./axis_ids":259,"./layout_attributes":270,"./scale_zoom":274,"./set_convert":276}],264:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61313,6 +63758,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -61389,6 +63835,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -61420,10 +63869,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -61460,6 +63910,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -61625,6 +64078,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -61642,8 +64101,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -61843,6 +64302,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -61852,6 +64313,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -61860,7 +64337,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -61891,15 +64368,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -61908,12 +64387,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -61923,7 +64406,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -61933,9 +64416,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -62135,15 +64633,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -62159,7 +64657,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -62371,7 +64869,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -62384,7 +64882,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -62449,11 +64947,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -62464,14 +64964,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -62481,7 +64989,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -62568,7 +65079,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":52,"../../components/dragelement":71,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../constants/alignment":154,"../../lib":180,"../../lib/clear_gl_canvases":166,"../../lib/setcursor":199,"../../lib/svg_text_utils":201,"../../plot_api/subroutines":216,"../../registry":275,"../plots":266,"./axes":225,"./axis_ids":228,"./constants":231,"./scale_zoom":243,"./select":244,"d3":15,"has-passive-events":20,"tinycolor2":34}],234:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/dragelement":100,"../../components/dragelement/helpers":99,"../../components/drawing":103,"../../components/fx":121,"../../constants/alignment":183,"../../lib":210,"../../lib/clear_gl_canvases":196,"../../lib/setcursor":229,"../../lib/svg_text_utils":231,"../../plot_api/subroutines":246,"../../registry":306,"../plots":297,"./axes":256,"./axis_ids":259,"./constants":262,"./scale_zoom":274,"./select":275,"d3":15,"has-passive-events":49,"tinycolor2":63}],265:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62736,7 +65247,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":71,"../../components/fx":92,"../../lib/setcursor":199,"./constants":231,"./dragbox":233,"d3":15}],235:[function(_dereq_,module,exports){ +},{"../../components/dragelement":100,"../../components/fx":121,"../../lib/setcursor":229,"./constants":262,"./dragbox":264,"d3":15}],266:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62772,7 +65283,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],236:[function(_dereq_,module,exports){ +},{}],267:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62784,6 +65295,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -62814,9 +65327,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -62826,7 +65340,7 @@ module.exports = { getTransform: getTransform }; -},{}],237:[function(_dereq_,module,exports){ +},{"../../lib":210}],268:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62840,6 +65354,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -62869,8 +65384,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -62901,7 +65418,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":180,"../../registry":275}],238:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306,"./axis_ids":259}],269:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63239,6 +65756,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -63518,7 +66036,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":74,"../../constants/xmlns_namespaces":158,"../../lib":180,"../../registry":275,"../get_data":262,"../plots":266,"./attributes":223,"./axis_ids":228,"./constants":231,"./graph_interact":234,"./layout_attributes":239,"./layout_defaults":240,"./transition_axes":249,"d3":15}],239:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../constants/xmlns_namespaces":188,"../../lib":210,"../../registry":306,"../get_data":293,"../plots":297,"./attributes":254,"./axis_ids":259,"./constants":262,"./graph_interact":265,"./layout_attributes":270,"./layout_defaults":271,"./transition_axes":280,"d3":15}],270:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63591,6 +66109,14 @@ module.exports = { // type in the template explicitly it will be honored as the default. _noTemplating: true, + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, autorange: { valType: 'enumerated', @@ -63651,7 +66177,6 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', editType: 'plot', @@ -63815,6 +66340,22 @@ module.exports = { editType: 'ticks', + }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + editType: 'calc', + }, mirror: { valType: 'enumerated', @@ -63955,6 +66496,14 @@ module.exports = { editType: 'ticks', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'ticks', + }, separatethousands: { valType: 'boolean', @@ -64207,7 +66756,7 @@ module.exports = { } }; -},{"../../components/color/attributes":51,"../../components/drawing/attributes":73,"../../constants/docs":155,"../../constants/numerical":157,"../../lib/extend":172,"../../plot_api/plot_template":215,"../font_attributes":253,"./constants":231}],240:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../components/drawing/attributes":102,"../../constants/docs":185,"../../constants/numerical":187,"../../lib/extend":202,"../../plot_api/plot_template":245,"../font_attributes":284,"./constants":262}],271:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64229,7 +66778,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -64248,6 +66797,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -64456,6 +67007,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -64520,6 +67072,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -64584,101 +67137,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":52,"../../components/fx/helpers":88,"../../components/fx/hovermode_defaults":91,"../../lib":180,"../../plot_api/plot_template":215,"../../registry":275,"../layout_attributes":264,"./axis_defaults":227,"./axis_ids":228,"./constants":231,"./constraints":232,"./layout_attributes":239,"./position_defaults":242,"./type_defaults":250}],241:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/fx/helpers":117,"../../components/fx/hovermode_defaults":120,"../../lib":210,"../../plot_api/plot_template":245,"../../registry":306,"../layout_attributes":295,"./axis_defaults":258,"./axis_ids":259,"./constants":262,"./constraints":263,"./layout_attributes":270,"./position_defaults":273,"./type_defaults":281}],272:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64743,7 +67208,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":51,"../../lib":180,"tinycolor2":34}],242:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../lib":210,"tinycolor2":63}],273:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64831,7 +67296,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":180,"fast-isnumeric":17}],243:[function(_dereq_,module,exports){ +},{"../../lib":210,"fast-isnumeric":17}],274:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64857,9 +67322,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":154}],244:[function(_dereq_,module,exports){ +},{"../../constants/alignment":183}],275:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64929,6 +67395,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -65018,8 +67492,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -65794,7 +68268,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":52,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../components/fx/helpers":88,"../../components/shapes/draw_newshape/display_outlines":137,"../../components/shapes/draw_newshape/helpers":138,"../../components/shapes/draw_newshape/newshapes":139,"../../lib":180,"../../lib/clear_gl_canvases":166,"../../lib/polygon":192,"../../lib/throttle":202,"../../plot_api/subroutines":216,"../../registry":275,"./axis_ids":228,"./constants":231,"./handle_outline":235,"./helpers":236,"polybooljs":25}],245:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/dragelement/helpers":99,"../../components/drawing":103,"../../components/fx":121,"../../components/fx/helpers":117,"../../components/shapes/draw_newshape/display_outlines":166,"../../components/shapes/draw_newshape/helpers":167,"../../components/shapes/draw_newshape/newshapes":168,"../../lib":210,"../../lib/clear_gl_canvases":196,"../../lib/polygon":222,"../../lib/throttle":232,"../../plot_api/subroutines":246,"../../registry":306,"./axis_ids":259,"./constants":262,"./handle_outline":266,"./helpers":267,"polybooljs":54}],276:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65827,7 +68301,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -65983,6 +68456,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -66114,12 +68591,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -66162,17 +68639,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -66676,38 +69148,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -66766,7 +69226,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":157,"../../lib":180,"./axis_ids":228,"./constants":231,"d3":15,"d3-time-format":13,"fast-isnumeric":17}],246:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../../lib":210,"./axis_ids":259,"./constants":262,"d3":15,"d3-time-format":13,"fast-isnumeric":17}],277:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66779,6 +69239,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -66815,10 +69276,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -66841,6 +69306,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -66887,7 +69353,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":180,"../array_container_defaults":221,"./layout_attributes":239}],247:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":210,"../array_container_defaults":251,"./layout_attributes":270}],278:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66920,7 +69386,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":180,"./layout_attributes":239}],248:[function(_dereq_,module,exports){ +},{"../../lib":210,"./layout_attributes":270}],279:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66967,7 +69433,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":180,"./clean_ticks":230}],249:[function(_dereq_,module,exports){ +},{"../../lib":210,"./clean_ticks":261}],280:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67180,7 +69646,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":74,"../../lib":180,"../../registry":275,"./axes":225,"d3":15}],250:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../lib":210,"../../registry":306,"./axes":256,"d3":15}],281:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67199,6 +69665,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -67251,6 +69718,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -67317,7 +69786,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":275,"./axis_autotype":226}],251:[function(_dereq_,module,exports){ +},{"../../registry":306,"./axis_autotype":257}],282:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67744,7 +70213,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":180,"../registry":275}],252:[function(_dereq_,module,exports){ +},{"../lib":210,"../registry":306}],283:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67856,7 +70325,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":172}],253:[function(_dereq_,module,exports){ +},{"../lib/extend":202}],284:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67921,7 +70390,7 @@ module.exports = function(opts) { return attrs; }; -},{}],254:[function(_dereq_,module,exports){ +},{}],285:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67967,7 +70436,7 @@ module.exports = { } }; -},{}],255:[function(_dereq_,module,exports){ +},{}],286:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68142,7 +70611,7 @@ exports.layerNameToAdjective = { frame: 'frame' }; -},{}],256:[function(_dereq_,module,exports){ +},{}],287:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68159,6 +70628,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Fx = _dereq_('../../components/fx'); @@ -68777,7 +71247,7 @@ proto.render = function() { function translatePoints(d) { var lonlatPx = projection(d.lonlat); return lonlatPx ? - 'translate(' + lonlatPx[0] + ',' + lonlatPx[1] + ')' : + strTranslate(lonlatPx[0], lonlatPx[1]) : null; } @@ -68976,7 +71446,7 @@ function makeRangeBox(lon, lat) { }; } -},{"../../components/color":52,"../../components/dragelement":71,"../../components/drawing":74,"../../components/fx":92,"../../lib":180,"../../lib/geo_location_utils":175,"../../lib/topojson_utils":204,"../../registry":275,"../cartesian/autorange":224,"../cartesian/axes":225,"../cartesian/select":244,"../plots":266,"./constants":255,"./projections":260,"./zoom":261,"d3":15,"topojson-client":35}],257:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/dragelement":100,"../../components/drawing":103,"../../components/fx":121,"../../lib":210,"../../lib/geo_location_utils":205,"../../lib/topojson_utils":234,"../../registry":306,"../cartesian/autorange":255,"../cartesian/axes":256,"../cartesian/select":275,"../plots":297,"./constants":286,"./projections":291,"./zoom":292,"d3":15,"topojson-client":64}],288:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69070,7 +71540,7 @@ module.exports = { clean: clean }; -},{"../../lib":180,"../../plots/get_data":262,"./geo":256,"./layout_attributes":258,"./layout_defaults":259}],258:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/get_data":293,"./geo":287,"./layout_attributes":289,"./layout_defaults":290}],289:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69361,7 +71831,7 @@ attrs.uirevision = { }; -},{"../../components/color/attributes":51,"../../plot_api/edit_types":208,"../domain":252,"./constants":255}],259:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../plot_api/edit_types":238,"../domain":283,"./constants":286}],290:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69589,7 +72059,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) { } } -},{"../../lib":180,"../get_data":262,"../subplot_defaults":273,"./constants":255,"./layout_attributes":258}],260:[function(_dereq_,module,exports){ +},{"../../lib":210,"../get_data":293,"../subplot_defaults":304,"./constants":286,"./layout_attributes":289}],291:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70035,7 +72505,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],261:[function(_dereq_,module,exports){ +},{}],292:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70547,7 +73017,7 @@ function d3eventDispatch(target) { return dispatch; } -},{"../../lib":180,"../../registry":275,"d3":15}],262:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306,"d3":15}],293:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70676,7 +73146,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":275,"./cartesian/constants":231}],263:[function(_dereq_,module,exports){ +},{"../registry":306,"./cartesian/constants":262}],294:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70710,7 +73180,7 @@ function project(camera, v) { module.exports = project; -},{}],264:[function(_dereq_,module,exports){ +},{}],295:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70898,6 +73368,12 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + + editType: 'none', + + }, paper_bgcolor: { valType: 'color', @@ -70913,6 +73389,14 @@ module.exports = { dflt: colorAttrs.background, editType: 'layoutstyle', + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, separators: { valType: 'string', @@ -71037,7 +73521,7 @@ module.exports = { } }; -},{"../components/color/attributes":51,"../components/shapes/draw_newshape/attributes":134,"../lib/extend":172,"./animation_attributes":220,"./font_attributes":253,"./pad_attributes":265}],265:[function(_dereq_,module,exports){ +},{"../components/color/attributes":80,"../components/shapes/draw_newshape/attributes":163,"../lib/extend":202,"./animation_attributes":250,"./font_attributes":284,"./pad_attributes":296}],296:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71092,7 +73576,7 @@ module.exports = function(opts) { }; }; -},{}],266:[function(_dereq_,module,exports){ +},{}],297:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71762,7 +74246,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -72571,6 +75055,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -72959,6 +75445,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -72976,6 +75465,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -72995,13 +75488,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -73026,6 +75521,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -73040,8 +75540,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -73073,11 +75571,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -73087,11 +75584,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -73101,6 +75597,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -73127,11 +75635,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -73255,7 +75776,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -74155,6 +76689,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -74165,7 +76702,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -74175,27 +76711,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -74204,18 +76741,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -74238,16 +76771,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -74289,12 +76825,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -74303,13 +76835,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -74431,7 +76964,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":52,"../constants/numerical":157,"../lib":180,"../plot_api/plot_schema":214,"../plot_api/plot_template":215,"../plots/get_data":262,"../registry":275,"./animation_attributes":220,"./attributes":222,"./cartesian/axis_ids":228,"./cartesian/handle_outline":235,"./command":251,"./font_attributes":253,"./frame_attributes":254,"./layout_attributes":264,"d3":15,"d3-time-format":13,"fast-isnumeric":17}],267:[function(_dereq_,module,exports){ +},{"../components/color":81,"../constants/numerical":187,"../lib":210,"../plot_api/plot_schema":244,"../plot_api/plot_template":245,"../plots/get_data":293,"../registry":306,"./animation_attributes":250,"./attributes":252,"./cartesian/axis_ids":259,"./cartesian/handle_outline":266,"./command":282,"./font_attributes":284,"./frame_attributes":285,"./layout_attributes":295,"d3":15,"d3-time-format":13,"fast-isnumeric":17}],298:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74475,7 +77008,7 @@ module.exports = { } }; -},{"../../../lib/extend":172,"../../../traces/scatter/attributes":297}],268:[function(_dereq_,module,exports){ +},{"../../../lib/extend":202,"../../../traces/scatter/attributes":328}],299:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74597,7 +77130,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":172,"../../../plot_api/edit_types":208,"../../cartesian/layout_attributes":239}],269:[function(_dereq_,module,exports){ +},{"../../../lib/extend":202,"../../../plot_api/edit_types":238,"../../cartesian/layout_attributes":270}],300:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74612,7 +77145,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":270,"./micropolar_manager":271}],270:[function(_dereq_,module,exports){ +},{"./micropolar":301,"./micropolar_manager":302}],301:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76032,7 +78565,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":154,"../../../lib":180,"d3":15}],271:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":183,"../../../lib":210,"d3":15}],302:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76118,7 +78651,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":52,"../../../lib":180,"./micropolar":270,"./undo_manager":272,"d3":15}],272:[function(_dereq_,module,exports){ +},{"../../../components/color":81,"../../../lib":210,"./micropolar":301,"./undo_manager":303,"d3":15}],303:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76184,7 +78717,7 @@ module.exports = function UndoManager() { }; }; -},{}],273:[function(_dereq_,module,exports){ +},{}],304:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76269,7 +78802,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":180,"../plot_api/plot_template":215,"./domain":252}],274:[function(_dereq_,module,exports){ +},{"../lib":210,"../plot_api/plot_template":245,"./domain":283}],305:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76352,7 +78885,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":155}],275:[function(_dereq_,module,exports){ +},{"../constants/docs":185}],306:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76818,7 +79351,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":170,"./lib/extend":172,"./lib/is_plain_object":181,"./lib/loggers":184,"./lib/noop":189,"./lib/push_unique":193,"./plots/attributes":222,"./plots/layout_attributes":264}],276:[function(_dereq_,module,exports){ +},{"./lib/dom":200,"./lib/extend":202,"./lib/is_plain_object":211,"./lib/loggers":214,"./lib/noop":219,"./lib/push_unique":223,"./plots/attributes":252,"./plots/layout_attributes":295}],307:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76991,7 +79524,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":180,"../registry":275}],277:[function(_dereq_,module,exports){ +},{"../lib":210,"../registry":306}],308:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77025,6 +79558,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -77061,7 +79596,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":180,"../plot_api/to_image":218,"./filesaver":278,"./helpers":279}],278:[function(_dereq_,module,exports){ +},{"../lib":210,"../plot_api/to_image":248,"./filesaver":309,"./helpers":310}],309:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77141,7 +79676,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":180,"./helpers":279}],279:[function(_dereq_,module,exports){ +},{"../lib":210,"./helpers":310}],310:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77224,7 +79759,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":275}],280:[function(_dereq_,module,exports){ +},{"../registry":306}],311:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77250,7 +79785,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":276,"./download":277,"./helpers":279,"./svgtoimg":281,"./toimage":282,"./tosvg":283}],281:[function(_dereq_,module,exports){ +},{"./cloneplot":307,"./download":308,"./helpers":310,"./svgtoimg":312,"./toimage":313,"./tosvg":314}],312:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77377,7 +79912,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":180,"./helpers":279,"events":11}],282:[function(_dereq_,module,exports){ +},{"../lib":210,"./helpers":310,"events":11}],313:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77454,7 +79989,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":180,"../registry":275,"./cloneplot":276,"./helpers":279,"./svgtoimg":281,"./tosvg":283,"events":11}],283:[function(_dereq_,module,exports){ +},{"../lib":210,"../registry":306,"./cloneplot":307,"./helpers":310,"./svgtoimg":312,"./tosvg":314,"events":11}],314:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77643,7 +80178,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":52,"../components/drawing":74,"../constants/xmlns_namespaces":158,"../lib":180,"d3":15}],284:[function(_dereq_,module,exports){ +},{"../components/color":81,"../components/drawing":103,"../constants/xmlns_namespaces":188,"../lib":210,"d3":15}],315:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77735,7 +80270,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/color/attributes":51,"../../components/colorscale/attributes":59,"../../lib/extend":172,"../../plots/attributes":222,"../../plots/template_attributes":274,"../scattergeo/attributes":324}],285:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":80,"../../components/colorscale/attributes":88,"../../lib/extend":202,"../../plots/attributes":252,"../../plots/template_attributes":305,"../scattergeo/attributes":356}],316:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77796,7 +80331,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/calc":60,"../../constants/numerical":157,"../scatter/arrays_to_calcdata":296,"../scatter/calc_selection":299,"fast-isnumeric":17}],286:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":89,"../../constants/numerical":187,"../scatter/arrays_to_calcdata":327,"../scatter/calc_selection":330,"fast-isnumeric":17}],317:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77852,7 +80387,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../components/colorscale/defaults":62,"../../lib":180,"./attributes":284}],287:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":91,"../../lib":210,"./attributes":315}],318:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77877,7 +80412,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],288:[function(_dereq_,module,exports){ +},{}],319:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77899,17 +80434,20 @@ module.exports = function hoverPoints(pointData, xval, yval) { var pt, i, j, isInside; + var xy = [xval, yval]; + var altXy = [xval + 360, yval]; + for(i = 0; i < cd.length; i++) { pt = cd[i]; isInside = false; if(pt._polygons) { for(j = 0; j < pt._polygons.length; j++) { - if(pt._polygons[j].contains([xval, yval])) { + if(pt._polygons[j].contains(xy)) { isInside = !isInside; } // for polygons that cross antimeridian as xval is in [-180, 180] - if(pt._polygons[j].contains([xval + 360, yval])) { + if(pt._polygons[j].contains(altXy)) { isInside = !isInside; } } @@ -77929,7 +80467,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { pointData.zLabel = Axes.tickText(geo.mockAxis, geo.mockAxis.c2l(pt.z), 'hover').text; pointData.hovertemplate = pt.hovertemplate; - makeHoverInfo(pointData, trace, pt, geo.mockAxis); + makeHoverInfo(pointData, trace, pt); return [pointData]; }; @@ -77969,7 +80507,7 @@ function makeHoverInfo(pointData, trace, pt) { pointData.extraText = text.join('
'); } -},{"../../lib":180,"../../plots/cartesian/axes":225,"./attributes":284}],289:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../plots/cartesian/axes":256,"./attributes":315}],320:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78002,7 +80540,7 @@ module.exports = { } }; -},{"../../plots/geo":257,"../heatmap/colorbar":293,"./attributes":284,"./calc":285,"./defaults":286,"./event_data":287,"./hover":288,"./plot":290,"./select":291,"./style":292}],290:[function(_dereq_,module,exports){ +},{"../../plots/geo":288,"../heatmap/colorbar":324,"./attributes":315,"./calc":316,"./defaults":317,"./event_data":318,"./hover":319,"./plot":321,"./select":322,"./style":323}],321:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78090,7 +80628,7 @@ module.exports = { plot: plot }; -},{"../../lib":180,"../../lib/geo_location_utils":175,"../../lib/topojson_utils":204,"../../plots/cartesian/autorange":224,"./style":292,"d3":15}],291:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../lib/geo_location_utils":205,"../../lib/topojson_utils":234,"../../plots/cartesian/autorange":255,"./style":323,"d3":15}],322:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78139,7 +80677,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],292:[function(_dereq_,module,exports){ +},{}],323:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78195,7 +80733,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/color":52,"../../components/colorscale":64,"../../components/drawing":74,"d3":15}],293:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/colorscale":93,"../../components/drawing":103,"d3":15}],324:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78211,7 +80749,7 @@ module.exports = { max: 'zmax' }; -},{}],294:[function(_dereq_,module,exports){ +},{}],325:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78224,19 +80762,21 @@ module.exports = { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -78253,7 +80793,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":180}],295:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":210}],326:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78277,7 +80821,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":52,"./helpers":294}],296:[function(_dereq_,module,exports){ +},{"../../components/color":81,"./helpers":325}],327:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78329,7 +80873,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":180}],297:[function(_dereq_,module,exports){ +},{"../../lib":210}],328:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78348,8 +80892,41 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + + editType: 'calc', + + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + + editType: 'calc', + + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + + editType: 'calc', + + }; +} + module.exports = { x: { valType: 'data_array', @@ -78396,6 +80973,13 @@ module.exports = { }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', @@ -78743,7 +81327,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":59,"../../components/drawing":74,"../../components/drawing/attributes":73,"../../lib/extend":172,"../../plots/font_attributes":253,"../../plots/template_attributes":274,"./constants":301}],298:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":88,"../../components/drawing":103,"../../components/drawing/attributes":102,"../../lib/extend":202,"../../plots/font_attributes":284,"../../plots/template_attributes":305,"./constants":332}],329:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78758,6 +81342,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -78769,8 +81354,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -78801,6 +81389,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -78808,6 +81399,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -79028,7 +81626,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":157,"../../lib":180,"../../plots/cartesian/axes":225,"./arrays_to_calcdata":296,"./calc_selection":299,"./colorscale_calc":300,"./subtypes":321,"fast-isnumeric":17}],299:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../../lib":210,"../../plots/cartesian/align_period":253,"../../plots/cartesian/axes":256,"./arrays_to_calcdata":327,"./calc_selection":330,"./colorscale_calc":331,"./subtypes":353,"fast-isnumeric":17}],330:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79047,7 +81645,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":180}],300:[function(_dereq_,module,exports){ +},{"../../lib":210}],331:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79090,7 +81688,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":60,"../../components/colorscale/helpers":63,"./subtypes":321}],301:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":89,"../../components/colorscale/helpers":92,"./subtypes":353}],332:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79119,7 +81717,7 @@ module.exports = { eventDataKeys: [] }; -},{}],302:[function(_dereq_,module,exports){ +},{}],333:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79300,7 +81898,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":298}],303:[function(_dereq_,module,exports){ +},{"./calc":329}],334:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79339,7 +81937,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],304:[function(_dereq_,module,exports){ +},{}],335:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79357,6 +81955,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -79374,6 +81973,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -79429,7 +82030,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":180,"../../registry":275,"./attributes":297,"./constants":301,"./fillcolor_defaults":305,"./line_defaults":310,"./line_shape_defaults":312,"./marker_defaults":316,"./stack_defaults":319,"./subtypes":321,"./text_defaults":322,"./xy_defaults":323}],305:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306,"./attributes":328,"./constants":332,"./fillcolor_defaults":336,"./line_defaults":341,"./line_shape_defaults":343,"./marker_defaults":347,"./period_defaults":348,"./stack_defaults":351,"./subtypes":353,"./text_defaults":354,"./xy_defaults":355}],336:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79466,7 +82067,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":52,"../../lib":180}],306:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../lib":210}],337:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79492,7 +82093,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":225}],307:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":256}],338:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79541,7 +82142,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":52,"./subtypes":321}],308:[function(_dereq_,module,exports){ +},{"../../components/color":81,"./subtypes":353}],339:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79622,8 +82223,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -79736,7 +82337,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":52,"../../components/fx":92,"../../lib":180,"../../registry":275,"./get_trace_color":307}],309:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/fx":121,"../../lib":210,"../../registry":306,"./get_trace_color":338}],340:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79782,7 +82383,7 @@ module.exports = { } }; -},{"../../plots/cartesian":238,"./arrays_to_calcdata":296,"./attributes":297,"./calc":298,"./cross_trace_calc":302,"./cross_trace_defaults":303,"./defaults":304,"./format_labels":306,"./hover":308,"./marker_colorbar":315,"./plot":317,"./select":318,"./style":320,"./subtypes":321}],310:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":269,"./arrays_to_calcdata":327,"./attributes":328,"./calc":329,"./cross_trace_calc":333,"./cross_trace_defaults":334,"./defaults":335,"./format_labels":337,"./hover":339,"./marker_colorbar":346,"./plot":349,"./select":350,"./style":352,"./subtypes":353}],341:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79813,7 +82414,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"../../lib":180}],311:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92,"../../lib":210}],342:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80274,7 +82875,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":157,"../../lib":180,"./constants":301}],312:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../../lib":210,"./constants":332}],343:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80293,7 +82894,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],313:[function(_dereq_,module,exports){ +},{}],344:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80383,7 +82984,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],314:[function(_dereq_,module,exports){ +},{}],345:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80425,7 +83026,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":17}],315:[function(_dereq_,module,exports){ +},{"fast-isnumeric":17}],346:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80443,7 +83044,7 @@ module.exports = { max: 'cmax' }; -},{}],316:[function(_dereq_,module,exports){ +},{}],347:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80524,7 +83125,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"./subtypes":321}],317:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92,"./subtypes":353}],348:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":187,"../../lib":210}],349:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81085,7 +83733,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":74,"../../lib":180,"../../lib/polygon":192,"../../registry":275,"./line_points":311,"./link_traces":313,"./subtypes":321,"d3":15}],318:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../lib":210,"../../lib/polygon":222,"../../registry":306,"./line_points":342,"./link_traces":344,"./subtypes":353,"d3":15}],350:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81139,7 +83787,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":321}],319:[function(_dereq_,module,exports){ +},{"./subtypes":353}],351:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81244,7 +83892,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],320:[function(_dereq_,module,exports){ +},{}],352:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81315,7 +83963,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":74,"../../registry":275,"d3":15}],321:[function(_dereq_,module,exports){ +},{"../../components/drawing":103,"../../registry":306,"d3":15}],353:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81354,7 +84002,7 @@ module.exports = { } }; -},{"../../lib":180}],322:[function(_dereq_,module,exports){ +},{"../../lib":210}],354:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81384,7 +84032,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":180}],323:[function(_dereq_,module,exports){ +},{"../../lib":210}],355:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81428,7 +84076,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":180,"../../registry":275}],324:[function(_dereq_,module,exports){ +},{"../../lib":210,"../../registry":306}],356:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81547,7 +84195,7 @@ module.exports = overrideAll({ hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorscale/attributes":59,"../../components/drawing/attributes":73,"../../lib/extend":172,"../../plot_api/edit_types":208,"../../plots/attributes":222,"../../plots/template_attributes":274,"../scatter/attributes":297}],325:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":88,"../../components/drawing/attributes":102,"../../lib/extend":202,"../../plot_api/edit_types":238,"../../plots/attributes":252,"../../plots/template_attributes":305,"../scatter/attributes":328}],357:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81615,7 +84263,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../constants/numerical":157,"../../lib":180,"../scatter/arrays_to_calcdata":296,"../scatter/calc_selection":299,"../scatter/colorscale_calc":300,"fast-isnumeric":17}],326:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../../lib":210,"../scatter/arrays_to_calcdata":327,"../scatter/calc_selection":330,"../scatter/colorscale_calc":331,"fast-isnumeric":17}],358:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81698,7 +84346,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":180,"../scatter/fillcolor_defaults":305,"../scatter/line_defaults":310,"../scatter/marker_defaults":316,"../scatter/subtypes":321,"../scatter/text_defaults":322,"./attributes":324}],327:[function(_dereq_,module,exports){ +},{"../../lib":210,"../scatter/fillcolor_defaults":336,"../scatter/line_defaults":341,"../scatter/marker_defaults":347,"../scatter/subtypes":353,"../scatter/text_defaults":354,"./attributes":356}],359:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81725,7 +84373,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],328:[function(_dereq_,module,exports){ +},{}],360:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81750,7 +84398,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":225}],329:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":256}],361:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81862,7 +84510,7 @@ function getExtraText(trace, pt, pointData, labels) { return text.join('
'); } -},{"../../components/fx":92,"../../constants/numerical":157,"../../lib":180,"../scatter/get_trace_color":307,"./attributes":324}],330:[function(_dereq_,module,exports){ +},{"../../components/fx":121,"../../constants/numerical":187,"../../lib":210,"../scatter/get_trace_color":338,"./attributes":356}],362:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81897,7 +84545,7 @@ module.exports = { } }; -},{"../../plots/geo":257,"../scatter/marker_colorbar":315,"../scatter/style":320,"./attributes":324,"./calc":325,"./defaults":326,"./event_data":327,"./format_labels":328,"./hover":329,"./plot":331,"./select":332,"./style":333}],331:[function(_dereq_,module,exports){ +},{"../../plots/geo":288,"../scatter/marker_colorbar":346,"../scatter/style":352,"./attributes":356,"./calc":357,"./defaults":358,"./event_data":359,"./format_labels":360,"./hover":361,"./plot":363,"./select":364,"./style":365}],363:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82026,7 +84674,7 @@ module.exports = { plot: plot }; -},{"../../constants/numerical":157,"../../lib":180,"../../lib/geo_location_utils":175,"../../lib/geojson_utils":176,"../../lib/topojson_utils":204,"../../plots/cartesian/autorange":224,"../scatter/calc":298,"../scatter/subtypes":321,"./style":333,"d3":15}],332:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../../lib":210,"../../lib/geo_location_utils":205,"../../lib/geojson_utils":206,"../../lib/topojson_utils":234,"../../plots/cartesian/autorange":255,"../scatter/calc":329,"../scatter/subtypes":353,"./style":365,"d3":15}],364:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82083,7 +84731,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"../../constants/numerical":157,"../scatter/subtypes":321}],333:[function(_dereq_,module,exports){ +},{"../../constants/numerical":187,"../scatter/subtypes":353}],365:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82132,7 +84780,7 @@ function styleTrace(gd, calcTrace) { }); } -},{"../../components/color":52,"../../components/drawing":74,"../scatter/style":320,"d3":15}],334:[function(_dereq_,module,exports){ +},{"../../components/color":81,"../../components/drawing":103,"../scatter/style":352,"d3":15}],366:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82144,7 +84792,7 @@ function styleTrace(gd, calcTrace) { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[4])(4) }); diff --git a/dist/plotly-geo.min.js b/dist/plotly-geo.min.js index cdb6377805c..f793e3cbca8 100644 --- a/dist/plotly-geo.min.js +++ b/dist/plotly-geo.min.js @@ -1,10 +1,10 @@ /** -* plotly.js (geo - minified) v1.55.2 +* plotly.js (geo - minified) v1.58.0 * Copyright 2012-2020, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=e()}}((function(){return function e(t,r,n){function a(o,l){if(!r[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":180}],2:[function(e,t,r){"use strict";t.exports=e("../src/traces/choropleth")},{"../src/traces/choropleth":289}],3:[function(e,t,r){"use strict";t.exports=e("../src/core")},{"../src/core":159}],4:[function(e,t,r){"use strict";var n=e("./core");n.register([e("./scattergeo"),e("./choropleth")]),t.exports=n},{"./choropleth":2,"./core":3,"./scattergeo":5}],5:[function(e,t,r){"use strict";t.exports=e("../src/traces/scattergeo")},{"../src/traces/scattergeo":330}],6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("@turf/meta");function a(e){var t=0;if(e&&e.length>0){t+=Math.abs(i(e[0]));for(var r=1;r2){for(l=0;le[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]=0))throw new Error("precision must be a positive number");var r=Math.pow(10,t||0);return Math.round(e*r)/r},r.radiansToLength=f,r.lengthToRadians=d,r.lengthToDegrees=function(e,t){return p(d(e,t))},r.bearingToAzimuth=function(e){var t=e%360;return t<0&&(t+=360),t},r.radiansToDegrees=p,r.degreesToRadians=function(e){return e%360*Math.PI/180},r.convertLength=function(e,t,r){if(void 0===t&&(t="kilometers"),void 0===r&&(r="kilometers"),!(e>=0))throw new Error("length must be a positive number");return f(d(e,t),r)},r.convertArea=function(e,t,n){if(void 0===t&&(t="meters"),void 0===n&&(n="kilometers"),!(e>=0))throw new Error("area must be a positive number");var a=r.areaFactors[t];if(!a)throw new Error("invalid original units");var i=r.areaFactors[n];if(!i)throw new Error("invalid final units");return e/a*i},r.isNumber=h,r.isObject=function(e){return!!e&&e.constructor===Object},r.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!h(e))throw new Error("bbox must only contain numbers")}))},r.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")},r.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},r.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},r.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},r.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},r.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},r.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},r.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},{}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("@turf/helpers");function a(e,t,r){if(null!==e)for(var n,i,o,l,s,c,u,f,d=0,p=0,h=e.type,g="FeatureCollection"===h,v="Feature"===h,m=g?e.features.length:1,y=0;yc||p>u||h>f)return s=a,c=r,u=p,f=h,void(o=0);var g=n.lineString([s,a],e.properties);if(!1===t(g,r,i,h,o))return!1;o++,s=a}))&&void 0}}}))}function u(e,t){if(!e)throw new Error("geojson is required");s(e,(function(e,r,a){if(null!==e.geometry){var i=e.geometry.type,o=e.geometry.coordinates;switch(i){case"LineString":if(!1===t(e,r,a,0,0))return!1;break;case"Polygon":for(var l=0;l0&&l.length>i){l.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else l=o[t]=r,++e._eventsCount;return e}function m(){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 e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var s=new Error('Unhandled "error" event. ('+t+")");throw s.context=t,s}if(!(r=o[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:f(r,c,this);break;case 2:d(r,c,this,arguments[1]);break;case 3:p(r,c,this,arguments[1],arguments[2]);break;case 4:h(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(a=new Array(n-1),i=1;i=0;o--)if(r[o]===t||r[o].listener===t){l=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(var r=t,n=r+1,a=e.length;n=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return x(this,e,!0)},o.prototype.rawListeners=function(e){return x(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):b.call(e,t)},o.prototype.listenerCount=b,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],12:[function(e,t,r){t.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],13:[function(e,t,r){!function(n,a){"object"==typeof r&&"undefined"!=typeof t?a(r,e("d3-time")):a((n=n||self).d3=n.d3||{},n.d3)}(this,(function(e,t){"use strict";function r(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function n(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function a(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,o=e.date,s=e.time,c=e.periods,u=e.days,f=e.shortDays,d=e.months,ye=e.shortMonths,xe=p(c),be=h(c),_e=p(u),we=h(u),ke=p(f),Me=h(f),Te=p(d),Ae=h(d),Le=p(ye),Se=h(ye),Ce={a:function(e){return f[e.getDay()]},A:function(e){return u[e.getDay()]},b:function(e){return ye[e.getMonth()]},B:function(e){return d[e.getMonth()]},c:null,d:R,e:R,f:H,H:I,I:F,j:N,L:j,m:B,M:U,p:function(e){return c[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:ve,s:me,S:q,u:V,U:G,V:Z,w:Y,W:X,x:null,X:null,y:W,Y:J,Z:Q,"%":ge},Pe={a:function(e){return f[e.getUTCDay()]},A:function(e){return u[e.getUTCDay()]},b:function(e){return ye[e.getUTCMonth()]},B:function(e){return d[e.getUTCMonth()]},c:null,d:$,e:$,f:ne,H:K,I:ee,j:te,L:re,m:ae,M:ie,p:function(e){return c[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:ve,s:me,S:oe,u:le,U:se,V:ce,w:ue,W:fe,x:null,X:null,y:de,Y:pe,Z:he,"%":ge},Oe={a:function(e,t,r){var n=ke.exec(t.slice(r));return n?(e.w=Me[n[0].toLowerCase()],r+n[0].length):-1},A:function(e,t,r){var n=_e.exec(t.slice(r));return n?(e.w=we[n[0].toLowerCase()],r+n[0].length):-1},b:function(e,t,r){var n=Le.exec(t.slice(r));return n?(e.m=Se[n[0].toLowerCase()],r+n[0].length):-1},B:function(e,t,r){var n=Te.exec(t.slice(r));return n?(e.m=Ae[n[0].toLowerCase()],r+n[0].length):-1},c:function(e,t,r){return ze(e,i,t,r)},d:T,e:T,f:O,H:L,I:L,j:A,L:P,m:M,M:S,p:function(e,t,r){var n=xe.exec(t.slice(r));return n?(e.p=be[n[0].toLowerCase()],r+n[0].length):-1},q:k,Q:E,s:z,S:C,u:v,U:m,V:y,w:g,W:x,x:function(e,t,r){return ze(e,o,t,r)},X:function(e,t,r){return ze(e,s,t,r)},y:_,Y:b,Z:w,"%":D};function De(e,t){return function(r){var n,a,i,o=[],s=-1,c=0,u=e.length;for(r instanceof Date||(r=new Date(+r));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(l=n(a(c.y,0,1))).getUTCDay(),l=s>4||0===s?t.utcMonday.ceil(l):t.utcMonday(l),l=t.utcDay.offset(l,7*(c.V-1)),c.y=l.getUTCFullYear(),c.m=l.getUTCMonth(),c.d=l.getUTCDate()+(c.w+6)%7):(s=(l=r(a(c.y,0,1))).getDay(),l=s>4||0===s?t.timeMonday.ceil(l):t.timeMonday(l),l=t.timeDay.offset(l,7*(c.V-1)),c.y=l.getFullYear(),c.m=l.getMonth(),c.d=l.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?n(a(c.y,0,1)).getUTCDay():r(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function ze(e,t,r,n){for(var a,i,o=0,s=t.length,c=r.length;o=c)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=Oe[a in l?t.charAt(o++):a])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ce.x=De(o,Ce),Ce.X=De(s,Ce),Ce.c=De(i,Ce),Pe.x=De(o,Pe),Pe.X=De(s,Pe),Pe.c=De(i,Pe),{format:function(e){var t=De(e+="",Ce);return t.toString=function(){return e},t},parse:function(e){var t=Ee(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=De(e+="",Pe);return t.toString=function(){return e},t},utcParse:function(e){var t=Ee(e+="",!0);return t.toString=function(){return e},t}}}var o,l={"-":"",_:" ",0:"0"},s=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function k(e,t,r){var n=s.exec(t.slice(r,r+1));return n?(e.q=3*n[0]-3,r+n[0].length):-1}function M(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function T(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function A(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function L(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function S(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function C(e,t,r){var n=s.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function P(e,t,r){var n=s.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function O(e,t,r){var n=s.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function D(e,t,r){var n=c.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function E(e,t,r){var n=s.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function z(e,t,r){var n=s.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function R(e,t){return f(e.getDate(),t,2)}function I(e,t){return f(e.getHours(),t,2)}function F(e,t){return f(e.getHours()%12||12,t,2)}function N(e,r){return f(1+t.timeDay.count(t.timeYear(e),e),r,3)}function j(e,t){return f(e.getMilliseconds(),t,3)}function H(e,t){return j(e,t)+"000"}function B(e,t){return f(e.getMonth()+1,t,2)}function U(e,t){return f(e.getMinutes(),t,2)}function q(e,t){return f(e.getSeconds(),t,2)}function V(e){var t=e.getDay();return 0===t?7:t}function G(e,r){return f(t.timeSunday.count(t.timeYear(e)-1,e),r,2)}function Z(e,r){var n=e.getDay();return e=n>=4||0===n?t.timeThursday(e):t.timeThursday.ceil(e),f(t.timeThursday.count(t.timeYear(e),e)+(4===t.timeYear(e).getDay()),r,2)}function Y(e){return e.getDay()}function X(e,r){return f(t.timeMonday.count(t.timeYear(e)-1,e),r,2)}function W(e,t){return f(e.getFullYear()%100,t,2)}function J(e,t){return f(e.getFullYear()%1e4,t,4)}function Q(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+f(t/60|0,"0",2)+f(t%60,"0",2)}function $(e,t){return f(e.getUTCDate(),t,2)}function K(e,t){return f(e.getUTCHours(),t,2)}function ee(e,t){return f(e.getUTCHours()%12||12,t,2)}function te(e,r){return f(1+t.utcDay.count(t.utcYear(e),e),r,3)}function re(e,t){return f(e.getUTCMilliseconds(),t,3)}function ne(e,t){return re(e,t)+"000"}function ae(e,t){return f(e.getUTCMonth()+1,t,2)}function ie(e,t){return f(e.getUTCMinutes(),t,2)}function oe(e,t){return f(e.getUTCSeconds(),t,2)}function le(e){var t=e.getUTCDay();return 0===t?7:t}function se(e,r){return f(t.utcSunday.count(t.utcYear(e)-1,e),r,2)}function ce(e,r){var n=e.getUTCDay();return e=n>=4||0===n?t.utcThursday(e):t.utcThursday.ceil(e),f(t.utcThursday.count(t.utcYear(e),e)+(4===t.utcYear(e).getUTCDay()),r,2)}function ue(e){return e.getUTCDay()}function fe(e,r){return f(t.utcMonday.count(t.utcYear(e)-1,e),r,2)}function de(e,t){return f(e.getUTCFullYear()%100,t,2)}function pe(e,t){return f(e.getUTCFullYear()%1e4,t,4)}function he(){return"+0000"}function ge(){return"%"}function ve(e){return+e}function me(e){return Math.floor(+e/1e3)}function ye(t){return o=i(t),e.timeFormat=o.format,e.timeParse=o.parse,e.utcFormat=o.utcFormat,e.utcParse=o.utcParse,o}ye({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xe=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var be=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=xe,e.isoParse=be,e.timeFormatDefaultLocale=ye,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})}))},{"d3-time":14}],14:[function(e,t,r){!function(e,n){"object"==typeof r&&"undefined"!=typeof t?n(r):n((e=e||self).d3=e.d3||{})}(this,(function(e){"use strict";var t=new Date,r=new Date;function n(e,a,i,o){function l(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return l.floor=function(t){return e(t=new Date(+t)),t},l.ceil=function(t){return e(t=new Date(t-1)),a(t,1),e(t),t},l.round=function(e){var t=l(e),r=l.ceil(e);return e-t0))return o;do{o.push(i=new Date(+t)),a(t,n),e(t)}while(i=r)for(;e(r),!t(r);)r.setTime(r-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;a(e,-1),!t(e););else for(;--r>=0;)for(;a(e,1),!t(e););}))},i&&(l.count=function(n,a){return t.setTime(+n),r.setTime(+a),e(t),e(r),Math.floor(i(t,r))},l.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?l.filter(o?function(t){return o(t)%e==0}:function(t){return l.count(0,t)%e==0}):l:null}),l}var a=n((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?n((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,r){t.setTime(+t+r*e)}),(function(t,r){return(r-t)/e})):a:null};var i=a.range,o=n((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()})),l=o.range,s=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()})),c=s.range,u=n((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()})),f=u.range,d=n((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1})),p=d.range;function h(e){return n((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var g=h(0),v=h(1),m=h(2),y=h(3),x=h(4),b=h(5),_=h(6),w=g.range,k=v.range,M=m.range,T=y.range,A=x.range,L=b.range,S=_.range,C=n((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),P=C.range,O=n((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));O.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,r){t.setFullYear(t.getFullYear()+r*e)})):null};var D=O.range,E=n((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()})),z=E.range,R=n((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()})),I=R.range,F=n((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1})),N=F.range;function j(e){return n((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var H=j(0),B=j(1),U=j(2),q=j(3),V=j(4),G=j(5),Z=j(6),Y=H.range,X=B.range,W=U.range,J=q.range,Q=V.range,$=G.range,K=Z.range,ee=n((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),te=ee.range,re=n((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));re.every=function(e){return isFinite(e=Math.floor(e))&&e>0?n((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,r){t.setUTCFullYear(t.getUTCFullYear()+r*e)})):null};var ne=re.range;e.timeDay=d,e.timeDays=p,e.timeFriday=b,e.timeFridays=L,e.timeHour=u,e.timeHours=f,e.timeInterval=n,e.timeMillisecond=a,e.timeMilliseconds=i,e.timeMinute=s,e.timeMinutes=c,e.timeMonday=v,e.timeMondays=k,e.timeMonth=C,e.timeMonths=P,e.timeSaturday=_,e.timeSaturdays=S,e.timeSecond=o,e.timeSeconds=l,e.timeSunday=g,e.timeSundays=w,e.timeThursday=x,e.timeThursdays=A,e.timeTuesday=m,e.timeTuesdays=M,e.timeWednesday=y,e.timeWednesdays=T,e.timeWeek=g,e.timeWeeks=w,e.timeYear=O,e.timeYears=D,e.utcDay=F,e.utcDays=N,e.utcFriday=G,e.utcFridays=$,e.utcHour=R,e.utcHours=I,e.utcMillisecond=a,e.utcMilliseconds=i,e.utcMinute=E,e.utcMinutes=z,e.utcMonday=B,e.utcMondays=X,e.utcMonth=ee,e.utcMonths=te,e.utcSaturday=Z,e.utcSaturdays=K,e.utcSecond=o,e.utcSeconds=l,e.utcSunday=H,e.utcSundays=Y,e.utcThursday=V,e.utcThursdays=Q,e.utcTuesday=U,e.utcTuesdays=W,e.utcWednesday=q,e.utcWednesdays=J,e.utcWeek=H,e.utcWeeks=Y,e.utcYear=re,e.utcYears=ne,Object.defineProperty(e,"__esModule",{value:!0})}))},{}],15:[function(e,t,r){!function(){var e={version:"3.5.17"},r=[].slice,n=function(e){return r.call(e)},a=this.document;function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(e){n=function(e){for(var t=e.length,r=new Array(t);t--;)r[t]=e[t];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(e,t){s.call(this,e,t+"")},l.setAttributeNS=function(e,t,r){c.call(this,e,t,r+"")},u.setProperty=function(e,t,r){f.call(this,e,t+"",r)}}function d(e,t){return et?1:e>=t?0:NaN}function p(e){return null===e?NaN:+e}function h(e){return!isNaN(e)}function g(e){return{left:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)<0?n=i+1:a=i}return n},right:function(t,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=t.length);n>>1;e(t[i],r)>0?a=i:n=i+1}return n}}}e.ascending=d,e.descending=function(e,t){return te?1:t>=e?0:NaN},e.min=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},e.max=function(e,t){var r,n,a=-1,i=e.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},e.extent=function(e,t){var r,n,a,i=-1,o=e.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(s-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var v=g(d);function m(e){return e.length}e.bisectLeft=v.left,e.bisect=e.bisectRight=v.right,e.bisector=function(e){return g(1===e.length?function(t,r){return d(e(t),r)}:e)},e.shuffle=function(e,t,r){(i=arguments.length)<3&&(r=e.length,i<2&&(t=0));for(var n,a,i=r-t;i;)a=Math.random()*i--|0,n=e[i+t],e[i+t]=e[a+t],e[a+t]=n;return e},e.permute=function(e,t){for(var r=t.length,n=new Array(r);r--;)n[r]=e[t[r]];return n},e.pairs=function(e){for(var t=0,r=e.length-1,n=e[0],a=new Array(r<0?0:r);t=0;)for(t=(n=e[a]).length;--t>=0;)r[--o]=n[t];return r};var y=Math.abs;function x(e){for(var t=1;e*t%1;)t*=10;return t}function b(e,t){for(var r in t)Object.defineProperty(e.prototype,r,{value:t[r],enumerable:!1})}function _(){this._=Object.create(null)}e.range=function(e,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=e,e=0)),(t-e)/r==1/0)throw new Error("infinite range");var n,a=[],i=x(y(r)),o=-1;if(e*=i,t*=i,(r*=i)<0)for(;(n=e+r*++o)>t;)a.push(n/i);else for(;(n=e+r*++o)=a.length)return r?r.call(n,i):t?i.sort(t):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return t;var n=[],o=i[r++];return t.forEach((function(t,a){n.push({key:t,values:e(a,r)})})),o?n.sort((function(e,t){return o(e.key,t.key)})):n}(o(e.map,t,0),0)},n.key=function(e){return a.push(e),n},n.sortKeys=function(e){return i[a.length-1]=e,n},n.sortValues=function(e){return t=e,n},n.rollup=function(e){return r=e,n},n},e.set=function(e){var t=new C;if(e)for(var r=0,n=e.length;r=0&&(n=e.slice(r+1),e=e.slice(0,r)),e)return arguments.length<2?this[e].on(n):this[e].on(n,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(n,null);return this}},e.event=null,e.requote=function(e){return e.replace(H,"\\$&")};var H=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,B={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)e[r]=t[r]};function U(e){return B(e,Z),e}var q=function(e,t){return t.querySelector(e)},V=function(e,t){return t.querySelectorAll(e)},G=function(e,t){var r=e.matches||e[D(e,"matchesSelector")];return(G=function(e,t){return r.call(e,t)})(e,t)};"function"==typeof Sizzle&&(q=function(e,t){return Sizzle(e,t)[0]||null},V=Sizzle,G=Sizzle.matchesSelector),e.selection=function(){return e.select(a.documentElement)};var Z=e.selection.prototype=[];function Y(e){return"function"==typeof e?e:function(){return q(e,this)}}function X(e){return"function"==typeof e?e:function(){return V(e,this)}}Z.select=function(e){var t,r,n,a,i=[];e=Y(e);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(r=e.slice(0,t))&&(e=e.slice(t+1)),J.hasOwnProperty(r)?{space:J[r],local:e}:e}},Z.attr=function(t,r){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=e.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(r in t)this.each(Q(r,t[r]));return this}return this.each(Q(t,r))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var r=this.node(),n=(e=ee(e)).length,a=-1;if(t=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Z.sort=function(e){e=ce.apply(this,arguments);for(var t=-1,r=this.length;++t=t&&(t=a+1);!(o=l[t])&&++t0&&(t=t.slice(0,o));var s=ge.get(t);function c(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return s&&(t=s,l=me),o?r?function(){var e=l(r,n(arguments));c.call(this),this.addEventListener(t,this[i]=e,e.$=a),e._=r}:c:r?z:function(){var r,n=new RegExp("^__on([^.]+)"+e.requote(t)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}e.selection.enter=fe,e.selection.enter.prototype=de,de.append=Z.append,de.empty=Z.empty,de.node=Z.node,de.call=Z.call,de.size=Z.size,de.select=function(e){for(var t,r,n,a,i,o=[],l=-1,s=this.length;++l0?1:e<0?-1:0}function Ee(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(t[1]-e[1])*(r[0]-e[0])}function ze(e){return e>1?0:e<-1?Ae:Math.acos(e)}function Re(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function Ie(e){return((e=Math.exp(e))+1/e)/2}function Fe(e){return(e=Math.sin(e/2))*e}var Ne=Math.SQRT2;e.interpolateZoom=function(e,t){var r,n,a=e[0],i=e[1],o=e[2],l=t[0],s=t[1],c=t[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(t=t.transition().duration(g)),t.call(w.event)}function L(){c&&c.domain(s.range().map((function(e){return(e-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(e){return(e-d.y)/d.k})).map(u.invert))}function S(e){v++||e({type:"zoomstart"})}function C(e){L(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function P(e){--v||(e({type:"zoomend"}),r=null)}function O(){var t=this,r=_.of(t,arguments),n=0,a=e.select(o(t)).on(y,s).on(x,c),i=k(e.mouse(t)),l=be(t);function s(){n=1,T(e.mouse(t),i),C(r)}function c(){a.on(y,null).on(x,null),l(n),P(r)}ml.call(t),S(r)}function D(){var t,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+e.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=e.select(r),p=be(r);function h(){var n=e.touches(r);return t=d.k,n.forEach((function(e){e.identifier in a&&(a[e.identifier]=k(e))})),n}function g(){var t=e.event.target;e.select(t).on(s,v).on(c,y),u.push(t);for(var n=e.event.changedTouches,o=0,f=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=e.touches(r);ml.call(r);for(var d=0,p=f.length;d360?e-=360:e<0&&(e+=360),e<60?n+(a-n)*e/60:e<180?a:e<240?n+(a-n)*(240-e)/60:n}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+t):r+t-r*t),new nt(i(e+120),i(e),i(e-120))}function Ze(t,r,n){return this instanceof Ze?(this.h=+t,this.c=+r,void(this.l=+n)):arguments.length<2?t instanceof Ze?new Ze(t.h,t.c,t.l):Ke(t instanceof We?t.l:(t=ut((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Ze(t,r,n)}Ve.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new qe(this.h,this.s,this.l/e)},Ve.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new qe(this.h,this.s,e*this.l)},Ve.rgb=function(){return Ge(this.h,this.s,this.l)},e.hcl=Ze;var Ye=Ze.prototype=new Ue;function Xe(e,t,r){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new We(r,Math.cos(e*=Pe)*t,Math.sin(e)*t)}function We(e,t,r){return this instanceof We?(this.l=+e,this.a=+t,void(this.b=+r)):arguments.length<2?e instanceof We?new We(e.l,e.a,e.b):e instanceof Ze?Xe(e.h,e.c,e.l):ut((e=nt(e)).r,e.g,e.b):new We(e,t,r)}Ye.brighter=function(e){return new Ze(this.h,this.c,Math.min(100,this.l+Je*(arguments.length?e:1)))},Ye.darker=function(e){return new Ze(this.h,this.c,Math.max(0,this.l-Je*(arguments.length?e:1)))},Ye.rgb=function(){return Xe(this.h,this.c,this.l).rgb()},e.lab=We;var Je=18,Qe=We.prototype=new Ue;function $e(e,t,r){var n=(e+16)/116,a=n+t/500,i=n-r/200;return new nt(rt(3.2404542*(a=.95047*et(a))-1.5371385*(n=1*et(n))-.4985314*(i=1.08883*et(i))),rt(-.969266*a+1.8760108*n+.041556*i),rt(.0556434*a-.2040259*n+1.0572252*i))}function Ke(e,t,r){return e>0?new Ze(Math.atan2(r,t)*Oe,Math.sqrt(t*t+r*r),e):new Ze(NaN,NaN,e)}function et(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function tt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function rt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function nt(e,t,r){return this instanceof nt?(this.r=~~e,this.g=~~t,void(this.b=~~r)):arguments.length<2?e instanceof nt?new nt(e.r,e.g,e.b):st(""+e,nt,Ge):new nt(e,t,r)}function at(e){return new nt(e>>16,e>>8&255,255&e)}function it(e){return at(e)+""}Qe.brighter=function(e){return new We(Math.min(100,this.l+Je*(arguments.length?e:1)),this.a,this.b)},Qe.darker=function(e){return new We(Math.max(0,this.l-Je*(arguments.length?e:1)),this.a,this.b)},Qe.rgb=function(){return $e(this.l,this.a,this.b)},e.rgb=nt;var ot=nt.prototype=new Ue;function lt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function st(e,t,r){var n,a,i,o=0,l=0,s=0;if(n=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return t(dt(a[0]),dt(a[1]),dt(a[2]))}return(i=pt.get(e))?t(i.r,i.g,i.b):(null==e||"#"!==e.charAt(0)||isNaN(i=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===e.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),t(o,l,s))}function ct(e,t,r){var n,a,i=Math.min(e/=255,t/=255,r/=255),o=Math.max(e,t,r),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),n=e==o?(t-r)/l+(t0&&s<1?0:n),new qe(n,a,s)}function ut(e,t,r){var n=tt((.4124564*(e=ft(e))+.3575761*(t=ft(t))+.1804375*(r=ft(r)))/.95047),a=tt((.2126729*e+.7151522*t+.072175*r)/1);return We(116*a-16,500*(n-a),200*(a-tt((.0193339*e+.119192*t+.9503041*r)/1.08883)))}function ft(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ot.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,r=this.g,n=this.b,a=30;return t||r||n?(t&&t=200&&t<300||304===t){try{e=a.call(o,c)}catch(e){return void l.error.call(o,e)}l.load.call(o,e)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var r=e.event;e.event=t;try{l.progress.call(o,c)}finally{e.event=r}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(r=null==e?null:e+"",o):r},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return a=e,o},["get","post"].forEach((function(e){o[e]=function(){return o.send.apply(o,[e].concat(n(arguments)))}})),o.send=function(e,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(e,t,!0),null==r||"accept"in s||(s.accept=r+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(e){a(null,e)})),l.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},e.rebind(o,l,"on"),null==i?o:o.get(function(e){return 1===e.length?function(t,r){e(null==t?r:null)}:e}(i))}pt.forEach((function(e,t){pt.set(e,at(t))})),e.functor=ht,e.xhr=gt(P),e.dsv=function(e,t){var r=new RegExp('["'+e+"\n]"),n=e.charCodeAt(0);function a(e,r,n){arguments.length<3&&(n=r,r=null);var a=vt(e,t,null==r?i:o(r),n);return a.row=function(e){return arguments.length?a.response(null==(r=e)?i:o(e)):r},a}function i(e){return a.parse(e.responseText)}function o(e){return function(t){return a.parse(t.responseText,e)}}function l(t){return t.map(s).join(e)}function s(e){return r.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return a.parse=function(e,t){var r;return a.parseRows(e,(function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");r=t?function(e,r){return t(a(e),r)}:a}))},a.parseRows=function(e,t){var r,a,i={},o={},l=[],s=e.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var t=c;if(34===e.charCodeAt(t)){for(var r=t;r++24?(isFinite(t)&&(clearTimeout(bt),bt=setTimeout(kt,t)),xt=0):(xt=1,_t(kt))}function Mt(){for(var e=Date.now(),t=mt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Tt(){for(var e,t=mt,r=1/0;t;)t.c?(t.t8?function(e){return e/r}:function(e){return e*r},symbol:e}}));function St(t){var r=t.decimal,n=t.thousands,a=t.grouping,i=t.currency,o=a&&n?function(e,t){for(var r=e.length,i=[],o=0,l=a[0],s=0;r>0&&l>0&&(s+l+1>t&&(l=Math.max(1,t-s)),i.push(e.substring(r-=l,r+l)),!((s+=l+1)>t));)l=a[o=(o+1)%a.length];return i.reverse().join(n)}:P;return function(t){var n=Ct.exec(t),a=n[1]||" ",l=n[2]||">",s=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],d=n[7],p=n[8],h=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Pt.get(h)||Ot;var b=u&&d;return function(t){var n=m;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(g<0){var c=e.formatPrefix(t,p);t=c.scale(t),n=c.symbol+m}else t*=g;var _,w,k=(t=h(t,p)).lastIndexOf(".");if(k<0){var M=x?t.lastIndexOf("e"):-1;M<0?(_=t,w=""):(_=t.substring(0,M),w=t.substring(M))}else _=t.substring(0,k),w=r+t.substring(k+1);!u&&d&&(_=o(_,1/0));var T=v.length+_.length+w.length+(b?0:i.length),A=T"===l?A+i+t:"^"===l?A.substring(0,T>>=1)+i+t+A.substring(T):i+(b?t:A+t))+n}}}e.formatPrefix=function(t,r){var n=0;return(t=+t)&&(t<0&&(t*=-1),r&&(t=e.round(t,At(t,r))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Lt[8+n/3]};var Ct=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Pt=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,r){return(t=e.round(t,At(t,r))).toFixed(Math.max(0,Math.min(20,At(t*(1+1e-15),r))))}});function Ot(e){return e+""}var Dt=e.time={},Et=Date;function zt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}zt.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(){Rt.setUTCDate.apply(this._,arguments)},setDay:function(){Rt.setUTCDay.apply(this._,arguments)},setFullYear:function(){Rt.setUTCFullYear.apply(this._,arguments)},setHours:function(){Rt.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Rt.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Rt.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Rt.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Rt.setUTCSeconds.apply(this._,arguments)},setTime:function(){Rt.setTime.apply(this._,arguments)}};var Rt=Date.prototype;function It(e,t,r){function n(t){var r=e(t),n=i(r,1);return t-r1)for(;o=c)return-1;if(37===(a=t.charCodeAt(l++))){if(o=t.charAt(l++),!(i=w[o in jt?t.charAt(l++):o])||(n=i(e,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(e){var t=u(e);function r(e){try{var r=new(Et=zt);return r._=e,t(r)}finally{Et=Date}}return r.parse=function(e){try{Et=zt;var r=t.parse(e);return r&&r._}finally{Et=Date}},r.toString=t.toString,r},u.multi=u.utc.multi=or;var d=e.map(),p=qt(o),h=Vt(o),g=qt(l),v=Vt(l),m=qt(s),y=Vt(s),x=qt(c),b=Vt(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var _={a:function(e){return l[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:u(r),d:function(e,t){return Ut(e.getDate(),t,2)},e:function(e,t){return Ut(e.getDate(),t,2)},H:function(e,t){return Ut(e.getHours(),t,2)},I:function(e,t){return Ut(e.getHours()%12||12,t,2)},j:function(e,t){return Ut(1+Dt.dayOfYear(e),t,3)},L:function(e,t){return Ut(e.getMilliseconds(),t,3)},m:function(e,t){return Ut(e.getMonth()+1,t,2)},M:function(e,t){return Ut(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Ut(e.getSeconds(),t,2)},U:function(e,t){return Ut(Dt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Ut(Dt.mondayOfYear(e),t,2)},x:u(n),X:u(a),y:function(e,t){return Ut(e.getFullYear()%100,t,2)},Y:function(e,t){return Ut(e.getFullYear()%1e4,t,4)},Z:ar,"%":function(){return"%"}},w={a:function(e,t,r){g.lastIndex=0;var n=g.exec(t.slice(r));return n?(e.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(e,t,r){p.lastIndex=0;var n=p.exec(t.slice(r));return n?(e.w=h.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(e,t,r){x.lastIndex=0;var n=x.exec(t.slice(r));return n?(e.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(e,t,r){m.lastIndex=0;var n=m.exec(t.slice(r));return n?(e.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(e,t,r){return f(e,_.c.toString(),t,r)},d:$t,e:$t,H:er,I:er,j:Kt,L:nr,m:Qt,M:tr,p:function(e,t,r){var n=d.get(t.slice(r,r+=2).toLowerCase());return null==n?-1:(e.p=n,r)},S:rr,U:Zt,w:Gt,W:Yt,x:function(e,t,r){return f(e,_.x.toString(),t,r)},X:function(e,t,r){return f(e,_.X.toString(),t,r)},y:Wt,Y:Xt,Z:Jt,"%":ir};return u}Dt.year=It((function(e){return(e=Dt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Dt.years=Dt.year.range,Dt.years.utc=Dt.year.utc.range,Dt.day=It((function(e){var t=new Et(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Dt.days=Dt.day.range,Dt.days.utc=Dt.day.utc.range,Dt.dayOfYear=function(e){var t=Dt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var r=Dt[e]=It((function(e){return(e=Dt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var r=Dt.year(e).getDay();return Math.floor((Dt.dayOfYear(e)+(r+t)%7)/7)-(r!==t)}));Dt[e+"s"]=r.range,Dt[e+"s"].utc=r.utc.range,Dt[e+"OfYear"]=function(e){var r=Dt.year(e).getDay();return Math.floor((Dt.dayOfYear(e)+(r+t)%7)/7)}})),Dt.week=Dt.sunday,Dt.weeks=Dt.sunday.range,Dt.weeks.utc=Dt.sunday.utc.range,Dt.weekOfYear=Dt.sundayOfYear;var jt={"-":"",_:" ",0:"0"},Ht=/^\s*\d+/,Bt=/^%/;function Ut(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Jt(e,t,r){return/^[+-]\d{4}$/.test(t=t.slice(r,r+5))?(e.Z=-t,r+5):-1}function Qt(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function $t(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Kt(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+3));return n?(e.j=+n[0],r+n[0].length):-1}function er(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function tr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function rr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function nr(e,t,r){Ht.lastIndex=0;var n=Ht.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ar(e){var t=e.getTimezoneOffset(),r=t>0?"-":"+",n=y(t)/60|0,a=y(t)%60;return r+Ut(n,"0",2)+Ut(a,"0",2)}function ir(e,t,r){Bt.lastIndex=0;var n=Bt.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function or(e){for(var t=e.length,r=-1;++r=0?1:-1,l=o*i,s=Math.cos(t),c=Math.sin(t),u=a*c,f=n*s+u*Math.cos(l),d=u*o*Math.sin(l);Sr.add(Math.atan2(d,f)),r=e,n=s,a=c}Cr.point=function(o,l){Cr.point=i,r=(e=o)*Pe,n=Math.cos(l=(t=l)*Pe/2+Ae/4),a=Math.sin(l)},Cr.lineEnd=function(){i(e,t)}}function Or(e){var t=e[0],r=e[1],n=Math.cos(r);return[n*Math.cos(t),n*Math.sin(t),Math.sin(r)]}function Dr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Er(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function zr(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Rr(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ir(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Fr(e){return[Math.atan2(e[1],e[0]),Re(e[2])]}function Nr(e,t){return y(e[0]-t[0])Me?a=90:c<-Me&&(r=-90),f[0]=t,f[1]=n}};function p(e,i){u.push(f=[t=e,n=e]),ia&&(a=i)}function h(e,o){var l=Or([e*Pe,o*Pe]);if(s){var c=Er(s,l),u=Er([c[1],-c[0],0],c);Ir(u),u=Fr(u);var f=e-i,d=f>0?1:-1,h=u[0]*Oe*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?e_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e):n>=t?(en&&(n=e)):e>i?_(t,e)>_(t,n)&&(n=e):_(e,n)>_(t,n)&&(t=e)}else p(e,o);s=l,i=e}function g(){d.point=h}function v(){f[0]=t,f[1]=n,d.point=p,s=null}function m(e,t){if(s){var r=e-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=e,l=t;Cr.point(e,t),h(e,t)}function x(){Cr.lineStart()}function b(){m(o,l),Cr.lineEnd(),y(c)>Me&&(t=-(n=180)),f[0]=t,f[1]=n,s=null}function _(e,t){return(t-=e)<0?t+360:t}function w(e,t){return e[0]-t[0]}function k(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,t=p[0],n=g[1])}return u=f=null,t===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,r],[n,a]]}}(),e.geo.centroid=function(t){mr=yr=xr=br=_r=wr=kr=Mr=Tr=Ar=Lr=0,e.geo.stream(t,jr);var r=Tr,n=Ar,a=Lr,i=r*r+n*n+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Xr(e){if(t=e.length){for(var t,r,n=0,a=e[0];++n=0?1:-1,k=w*_,M=k>Ae,T=h*x;if(Sr.add(Math.atan2(T*w*Math.sin(k),g*b+T*Math.cos(k))),i+=M?_+w*Le:_,M^d>=r^m>=r){var A=Er(Or(f),Or(e));Ir(A);var L=Er(a,A);Ir(L);var S=(M^_>=0?-1:1)*Re(L[2]);(n>S||n===S&&(A[0]||A[1]))&&(o+=M^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=e}}return(i<-Me||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&t&&r.push(r.pop().concat(r.shift())),l.push(r.filter(Qr))}return u}}function Qr(e){return e.length>1}function $r(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,r){e.push([t,r])},lineEnd:z,buffer:function(){var r=t;return t=[],e=null,r},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Kr(e,t){return((e=e.x)[0]<0?e[1]-Ce-Me:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-Me:Ce-t[1])}var en=Jr(Zr,(function(e){var t,r=NaN,n=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var l=i>0?Ae:-Ae,s=y(i-r);y(s-Ae)0?Ce:-Ce),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),e.point(i,n),t=0):a!==l&&s>=Ae&&(y(r-a)Me?Math.atan((Math.sin(t)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(t))*Math.sin(e))/(a*i*o)):(t+n)/2}(r,n,i,o),e.point(a,n),e.lineEnd(),e.lineStart(),e.point(l,n),t=0),e.point(r=i,n=o),a=l},lineEnd:function(){e.lineEnd(),r=n=NaN},clean:function(){return 2-t}}}),(function(e,t,r,n){var a;if(null==e)a=r*Ce,n.point(-Ae,a),n.point(0,a),n.point(Ae,a),n.point(Ae,0),n.point(Ae,-a),n.point(0,-a),n.point(-Ae,-a),n.point(-Ae,0),n.point(-Ae,a);else if(y(e[0]-t[0])>Me){var i=e[0]0,n=y(t)>Me;return Jr(a,(function(e){var t,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?Ae:-Ae),d):0;if(!t&&(c=s=g)&&e.lineStart(),g!==s&&(p=i(t,h),(Nr(t,p)||Nr(h,p))&&(h[0]+=Me,h[1]+=Me,g=a(h[0],h[1]))),g!==s)u=0,g?(e.lineStart(),p=i(h,t),e.point(p[0],p[1])):(p=i(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(n&&t&&r^g){var m;v&l||!(m=i(h,t,!0))||(u=0,r?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!g||t&&Nr(t,h)||e.point(h[0],h[1]),t=h,s=g,l=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(c&&s)<<1}}}),Nn(e,6*Pe),r?[0,-e]:[-Ae,e-Ae]);function a(e,r){return Math.cos(e)*Math.cos(r)>t}function i(e,r,n){var a=[1,0,0],i=Er(Or(e),Or(r)),o=Dr(i,i),l=i[0],s=o-l*l;if(!s)return!n&&e;var c=t*o/s,u=-t*l/s,f=Er(a,i),d=Rr(a,c);zr(d,Rr(i,u));var p=f,h=Dr(d,p),g=Dr(p,p),v=h*h-g*(Dr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=Rr(p,(-h-m)/g);if(zr(x,d),x=Fr(x),!n)return x;var b,_=e[0],w=r[0],k=e[1],M=r[1];w<_&&(b=_,_=w,w=b);var T=w-_,A=y(T-Ae)0^x[1]<(y(x[0]-_)Ae^(_<=x[0]&&x[0]<=w)){var L=Rr(p,(-h+m)/g);return zr(L,d),[x,Fr(L)]}}}function o(t,n){var a=r?e:Ae-e,i=0;return t<-a?i|=1:t>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(e,t,r,n){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=e-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function nn(t,r,n,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=$r(),w=rn(t,r,n,a),k={point:A,lineStart:function(){k.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));k.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=e.merge(c);var r=function(e){for(var t=0,r=u.length,n=e[1],a=0;an&&Ee(c,i,e)>0&&++t:i[1]<=n&&Ee(c,i,e)<0&&--t,c=i;return 0!==t}([t,a]),n=x&&r,i=c.length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),M(null,null,1,s),s.lineEnd()),i&&Yr(c,o,r,M,s),s.polygonEnd()),c=u=f=null}};function M(e,o,s,c){var u=0,f=0;if(null==e||(u=i(e,s))!==(f=i(o,s))||l(e,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?a:r)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function T(e,i){return t<=e&&e<=n&&r<=i&&i<=a}function A(e,t){T(e,t)&&s.point(e,t)}function L(e,t){var r=T(e=Math.max(-1e9,Math.min(1e9,e)),t=Math.max(-1e9,Math.min(1e9,t)));if(u&&f.push([e,t]),y)d=e,p=t,h=r,y=!1,r&&(s.lineStart(),s.point(e,t));else if(r&&m)s.point(e,t);else{var n={a:{x:g,y:v},b:{x:e,y:t}};w(n)?(m||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),x=!1):r&&(s.lineStart(),s.point(e,t),x=!1)}g=e,v=t,m=r}return k};function i(e,a){return y(e[0]-t)0?0:3:y(e[0]-n)0?2:1:y(e[1]-r)0?1:0:a>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var r=i(e,1),n=i(t,1);return r!==n?r-n:0===r?t[1]-e[1]:1===r?e[0]-t[0]:2===r?e[1]-t[1]:t[0]-e[0]}}function an(e){var t=0,r=Ae/3,n=Pn(e),a=n(t,r);return a.parallels=function(e){return arguments.length?n(t=e[0]*Ae/180,r=e[1]*Ae/180):[t/Ae*180,r/Ae*180]},a}function on(e,t){var r=Math.sin(e),n=(r+Math.sin(t))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(e,t){var r=Math.sqrt(a-2*n*Math.sin(t))/n;return[r*Math.sin(e*=n),i-r*Math.cos(e)]}return o.invert=function(e,t){var r=i-t;return[Math.atan2(e,r)/n,Re((a-(e*e+r*r)*n*n)/(2*n))]},o}e.geo.clipExtent=function(){var e,t,r,n,a,i,o={stream:function(e){return a&&(a.valid=!1),(a=i(e)).valid=!0,a},extent:function(l){return arguments.length?(i=nn(e=+l[0][0],t=+l[0][1],r=+l[1][0],n=+l[1][1]),a&&(a.valid=!1,a=null),o):[[e,t],[r,n]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return an(on)}).raw=on,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){var t,r,n,a,i=e.geo.albers(),o=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(e,r){t=[e,r]}};function c(e){var i=e[0],o=e[1];return t=null,r(i,o),t||(n(i,o),t)||a(i,o),t}return c.invert=function(e){var t=i.scale(),r=i.translate(),n=(e[0]-r[0])/t,a=(e[1]-r[1])/t;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?l:i).invert(e)},c.stream=function(e){var t=i.stream(e),r=o.stream(e),n=l.stream(e);return{point:function(e,a){t.point(e,a),r.point(e,a),n.point(e,a)},sphere:function(){t.sphere(),r.sphere(),n.sphere()},lineStart:function(){t.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){t.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){t.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){t.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),l.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),l.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var t=i.scale(),u=+e[0],f=+e[1];return r=i.translate(e).clipExtent([[u-.455*t,f-.238*t],[u+.455*t,f+.238*t]]).stream(s).point,n=o.translate([u-.307*t,f+.201*t]).clipExtent([[u-.425*t+Me,f+.12*t+Me],[u-.214*t-Me,f+.234*t-Me]]).stream(s).point,a=l.translate([u-.205*t,f+.212*t]).clipExtent([[u-.214*t+Me,f+.166*t+Me],[u-.115*t-Me,f+.234*t-Me]]).stream(s).point,c},c.scale(1070)};var ln,sn,cn,un,fn,dn,pn={point:z,lineStart:z,lineEnd:z,polygonStart:function(){sn=0,pn.lineStart=hn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=z,ln+=y(sn/2)}};function hn(){var e,t,r,n;function a(e,t){sn+=n*e-r*t,r=e,n=t}pn.point=function(i,o){pn.point=a,e=r=i,t=n=o},pn.lineEnd=function(){a(e,t)}}var gn={point:function(e,t){efn&&(fn=e);tdn&&(dn=t)},lineStart:z,lineEnd:z,polygonStart:z,polygonEnd:z};function vn(){var e=mn(4.5),t=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=mn(t),r},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function n(r,n){t.push("M",r,",",n,e)}function a(e,n){t.push("M",e,",",n),r.point=i}function i(e,r){t.push("L",e,",",r)}function o(){r.point=n}function l(){t.push("Z")}return r}function mn(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var yn,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=kn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(e,t){xr+=e,br+=t,++_r}function _n(){var e,t;function r(r,n){var a=r-e,i=n-t,o=Math.sqrt(a*a+i*i);wr+=o*(e+r)/2,kr+=o*(t+n)/2,Mr+=o,bn(e=r,t=n)}xn.point=function(n,a){xn.point=r,bn(e=n,t=a)}}function wn(){xn.point=bn}function kn(){var e,t,r,n;function a(e,t){var a=e-r,i=t-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+e)/2,kr+=o*(n+t)/2,Mr+=o,Tr+=(o=n*e-r*t)*(r+e),Ar+=o*(n+t),Lr+=3*o,bn(r=e,n=t)}xn.point=function(i,o){xn.point=a,bn(e=r=i,t=n=o)},xn.lineEnd=function(){a(e,t)}}function Mn(e){var t=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=l},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=e,r},result:z};function n(r,n){e.moveTo(r+t,n),e.arc(r,n,t,0,Le)}function a(t,n){e.moveTo(t,n),r.point=i}function i(t,r){e.lineTo(t,r)}function o(){r.point=n}function l(){e.closePath()}return r}function Tn(e){var t=.5,r=Math.cos(30*Pe),n=16;function a(e){return(n?o:i)(e)}function i(t){return Sn(t,(function(r,n){r=e(r,n),t.point(r[0],r[1])}))}function o(t){var r,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),v.lineStart=_},polygonEnd:function(){t.polygonEnd(),v.lineStart=y}};function m(r,n){r=e(r,n),t.point(r[0],r[1])}function y(){f=NaN,v.point=x,t.lineStart()}function x(r,a){var i=Or([r,a]),o=e(r,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=r,p=i[0],h=i[1],g=i[2],n,t),t.point(f,d)}function b(){v.point=m,t.lineEnd()}function _(){y(),v.point=w,v.lineEnd=k}function w(e,t){x(r=e,t),a=f,i=d,o=p,s=h,c=g,v.point=x}function k(){l(f,d,u,p,h,g,a,i,r,o,s,c,n,t),v.lineEnd=b,b()}return v}function l(n,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-n,b=f-a,_=x*x+b*b;if(_>4*t&&v--){var w=o+p,k=s+h,M=c+g,T=Math.sqrt(w*w+k*k+M*M),A=Math.asin(M/=T),L=y(y(M)-1)t||y((x*O+b*D)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(t)},a}function An(e){var t=Tn((function(t,r){return e([t*Oe,r*Oe])}));return function(e){return On(t(e))}}function Ln(e){this.stream=e}function Sn(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Cn(e){return Pn((function(){return e}))()}function Pn(t){var r,n,a,i,o,l,s=Tn((function(e,t){return[(e=r(e,t))[0]*c+i,o-e[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=en,y=P,x=null,b=null;function _(e){return[(e=a(e[0]*Pe,e[1]*Pe))[0]*c+i,o-e[1]*c]}function w(e){return(e=a.invert((e[0]-i)/c,(o-e[1])/c))&&[e[0]*Oe,e[1]*Oe]}function k(){a=Gr(n=zn(h,g,v),r);var e=r(d,p);return i=u-e[0]*c,o=f+e[1]*c,M()}function M(){return l&&(l.valid=!1,l=null),_}return _.stream=function(e){return l&&(l.valid=!1),(l=On(m(n,s(y(e))))).valid=!0,l},_.clipAngle=function(e){return arguments.length?(m=null==e?(x=e,en):tn((x=+e)*Pe),M()):x},_.clipExtent=function(e){return arguments.length?(b=e,y=e?nn(e[0][0],e[0][1],e[1][0],e[1][1]):P,M()):b},_.scale=function(e){return arguments.length?(c=+e,k()):c},_.translate=function(e){return arguments.length?(u=+e[0],f=+e[1],k()):[u,f]},_.center=function(e){return arguments.length?(d=e[0]%360*Pe,p=e[1]%360*Pe,k()):[d*Oe,p*Oe]},_.rotate=function(e){return arguments.length?(h=e[0]%360*Pe,g=e[1]%360*Pe,v=e.length>2?e[2]%360*Pe:0,k()):[h*Oe,g*Oe,v*Oe]},e.rebind(_,s,"precision"),function(){return r=t.apply(this,arguments),_.invert=r.invert&&w,k()}}function On(e){return Sn(e,(function(t,r){e.point(t*Pe,r*Pe)}))}function Dn(e,t){return[e,t]}function En(e,t){return[e>Ae?e-Le:e<-Ae?e+Le:e,t]}function zn(e,t,r){return e?t||r?Gr(In(e),Fn(t,r)):In(e):t||r?Fn(t,r):En}function Rn(e){return function(t,r){return[(t+=e)>Ae?t-Le:t<-Ae?t+Le:t,r]}}function In(e){var t=Rn(e);return t.invert=Rn(-e),t}function Fn(e,t){var r=Math.cos(e),n=Math.sin(e),a=Math.cos(t),i=Math.sin(t);function o(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*r+l*n;return[Math.atan2(s*a-u*i,l*r-c*n),Re(u*a+s*i)]}return o.invert=function(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*r+u*n),Re(u*r-l*n)]},o}function Nn(e,t){var r=Math.cos(e),n=Math.sin(e);return function(a,i,o,l){var s=o*t;null!=a?(a=jn(r,a),i=jn(r,i),(o>0?ai)&&(a+=o*Le)):(a=e+o*Le,i=e-.5*s);for(var c,u=a;o>0?u>i:u2?e[2]*Pe:0),t.invert=function(t){return(t=e.invert(t[0]*Pe,t[1]*Pe))[0]*=Oe,t[1]*=Oe,t},t},En.invert=Dn,e.geo.circle=function(){var e,t,r=[0,0],n=6;function a(){var e="function"==typeof r?r.apply(this,arguments):r,n=zn(-e[0]*Pe,-e[1]*Pe,0).invert,a=[];return t(null,null,1,{point:function(e,t){a.push(e=n(e,t)),e[0]*=Oe,e[1]*=Oe}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(e){return arguments.length?(r=e,a):r},a.angle=function(r){return arguments.length?(t=Nn((e=+r)*Pe,n*Pe),a):e},a.precision=function(r){return arguments.length?(t=Nn(e*Pe,(n=+r)*Pe),a):n},a.angle(90)},e.geo.distance=function(e,t){var r,n=(t[0]-e[0])*Pe,a=e[1]*Pe,i=t[1]*Pe,o=Math.sin(n),l=Math.cos(n),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-s*f*l)*r),s*u+c*f*l)},e.geo.graticule=function(){var t,r,n,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(a/g)*g,n,g).map(f).concat(e.range(Math.ceil(s/v)*v,l,v).map(d)).concat(e.range(Math.ceil(r/p)*p,t,p).filter((function(e){return y(e%g)>Me})).map(c)).concat(e.range(Math.ceil(o/h)*h,i,h).filter((function(e){return y(e%v)>Me})).map(u))}return x.lines=function(){return b().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(n).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(a=+e[0][0],n=+e[1][0],s=+e[0][1],l=+e[1][1],a>n&&(e=a,a=n,n=e),s>l&&(e=s,s=l,l=e),x.precision(m)):[[a,s],[n,l]]},x.minorExtent=function(e){return arguments.length?(r=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],r>t&&(e=r,r=t,t=e),o>i&&(e=o,o=i,i=e),x.precision(m)):[[r,o],[t,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],x):[g,v]},x.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],x):[p,h]},x.precision=function(e){return arguments.length?(m=+e,c=Hn(o,i,90),u=Bn(r,t,m),f=Hn(s,l,90),d=Bn(a,n,m),x):m},x.majorExtent([[-180,-90+Me],[180,90-Me]]).minorExtent([[-180,-80-Me],[180,80+Me]])},e.geo.greatArc=function(){var t,r,n=Un,a=qn;function i(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return e.geo.distance(t||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,i):n},i.target=function(e){return arguments.length?(a=e,r="function"==typeof e?null:e,i):a},i.precision=function(){return arguments.length?i:0},i},e.geo.interpolate=function(e,t){return r=e[0]*Pe,n=e[1]*Pe,a=t[0]*Pe,i=t[1]*Pe,o=Math.cos(n),l=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),f=o*Math.sin(r),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Fe(i-n)+o*s*Fe(a-r))),g=1/Math.sin(h),(v=h?function(e){var t=Math.sin(e*=h)*g,r=Math.sin(h-e)*g,n=r*u+t*d,a=r*f+t*p,i=r*l+t*c;return[Math.atan2(a,n)*Oe,Math.atan2(i,Math.sqrt(n*n+a*a))*Oe]}:function(){return[r*Oe,n*Oe]}).distance=h,v;var r,n,a,i,o,l,s,c,u,f,d,p,h,g,v},e.geo.length=function(t){return yn=0,e.geo.stream(t,Vn),yn};var Vn={sphere:z,point:z,lineStart:function(){var e,t,r;function n(n,a){var i=Math.sin(a*=Pe),o=Math.cos(a),l=y((n*=Pe)-e),s=Math.cos(l);yn+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=r*i-t*o*s)*l),t*i+r*o*s),e=n,t=i,r=o}Vn.point=function(a,i){e=a*Pe,t=Math.sin(i*=Pe),r=Math.cos(i),Vn.point=n},Vn.lineEnd=function(){Vn.point=Vn.lineEnd=z}},lineEnd:z,polygonStart:z,polygonEnd:z};function Gn(e,t){function r(t,r){var n=Math.cos(t),a=Math.cos(r),i=e(n*a);return[i*a*Math.sin(t),i*Math.sin(r)]}return r.invert=function(e,r){var n=Math.sqrt(e*e+r*r),a=t(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(e*i,n*o),Math.asin(n&&r*i/n)]},r}var Zn=Gn((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(e.geo.azimuthalEqualArea=function(){return Cn(Zn)}).raw=Zn;var Yn=Gn((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),P);function Xn(e,t){var r=Math.cos(e),n=function(e){return Math.tan(Ae/4+e/2)},a=e===t?Math.sin(e):Math.log(r/Math.cos(t))/Math.log(n(t)/n(e)),i=r*Math.pow(n(e),a)/a;if(!a)return Qn;function o(e,t){i>0?t<-Ce+Me&&(t=-Ce+Me):t>Ce-Me&&(t=Ce-Me);var r=i/Math.pow(n(t),a);return[r*Math.sin(a*e),i-r*Math.cos(a*e)]}return o.invert=function(e,t){var r=i-t,n=De(a)*Math.sqrt(e*e+r*r);return[Math.atan2(e,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ce]},o}function Wn(e,t){var r=Math.cos(e),n=e===t?Math.sin(e):(r-Math.cos(t))/(t-e),a=r/n+e;if(y(n)1&&Ee(e[r[n-2]],e[r[n-1]],e[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(e,t){return e[0]-t[0]||e[1]-t[1]}(e.geo.stereographic=function(){return Cn(ea)}).raw=ea,ta.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ce]},(e.geo.transverseMercator=function(){var e=$n(ta),t=e.center,r=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?r([e[0],e[1],e.length>2?e[2]+90:90]):[(e=r())[0],e[1],e[2]-90]},r([0,0,90])}).raw=ta,e.geom={},e.geom.hull=function(e){var t=ra,r=na;if(arguments.length)return n(e);function n(e){if(e.length<3)return[];var n,a=ht(t),i=ht(r),o=e.length,l=[],s=[];for(n=0;n=0;--n)p.push(e[l[c[n]][2]]);for(n=+f;nMe)l=l.L;else{if(!((a=i-ka(l,o))>Me)){n>-Me?(t=l.P,r=l):a>-Me?(t=l,r=l.N):t=r=l;break}if(!l.R){t=l;break}l=l.R}var s=ya(e);if(da.insert(t,s),t||r){if(t===r)return Sa(t),r=ya(t.site),da.insert(s,r),s.edge=r.edge=Oa(t.site,s.site),La(t),void La(r);if(r){Sa(t),Sa(r);var c=t.site,u=c.x,f=c.y,d=e.x-u,p=e.y-f,h=r.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};Ea(r.edge,c,h,b),s.edge=Oa(c,e,null,b),r.edge=Oa(e,h,null,b),La(t),La(r)}else s.edge=Oa(t.site,s.site)}}function wa(e,t){var r=e.site,n=r.x,a=r.y,i=a-t;if(!i)return n;var o=e.P;if(!o)return-1/0;var l=(r=o.site).x,s=r.y,c=s-t;if(!c)return l;var u=l-n,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+n:(n+l)/2}function ka(e,t){var r=e.N;if(r)return wa(r,t);var n=e.site;return n.y===t?n.x:1/0}function Ma(e){this.site=e,this.edges=[]}function Ta(e,t){return t.angle-e.angle}function Aa(){Ia(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(e){var t=e.P,r=e.N;if(t&&r){var n=t.site,a=e.site,i=r.site;if(n!==i){var o=a.x,l=a.y,s=n.x-o,c=n.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Te)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=e,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,e.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};r={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/n,y:s};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:n*o+a};r={x:l,y:n*l+a}}else{if(i){if(i.xMe||y(a-r)>Me)&&(l.splice(o,0,new za(Da(i.site,u,y(n-f)Me?{x:f,y:y(t-f)Me?{x:y(r-h)Me?{x:d,y:y(t-d)Me?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=e[l]})),t}function l(e){return e.map((function(e,t){return{x:Math.round(n(e,t)/Me)*Me,y:Math.round(a(e,t)/Me)*Me,i:t}}))}return o.links=function(e){return Ha(l(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return Ha(l(e)).cells.forEach((function(r,n){for(var a,i,o,l,s=r.site,c=r.edges.sort(Ta),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|t>=b,k=w+4;wi&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(n=n[0])?l[o]?l[o]+=n:l[++o]=n:(l[++o]=null,s.push({i:o,x:Wa(r,n)})),i=$a.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,k=v-h;function M(e,t,r,n,a,i,o,l){if(!isNaN(r)&&!isNaN(n))if(e.leaf){var s=e.x,c=e.y;if(null!=s)if(y(s-r)+y(c-n)<.01)T(e,t,r,n,a,i,o,l);else{var u=e.point;e.x=e.y=e.point=null,T(e,u,s,c,a,i,o,l),T(e,t,r,n,a,i,o,l)}else e.x=r,e.y=n,e.point=t}else T(e,t,r,n,a,i,o,l)}function T(e,t,r,n,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=r>=s,f=n>=c,d=f<<1|u;e.leaf=!1,u?a=s:o=s,f?i=c:l=c,M(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,r,n,a,i,o,l)}w>k?v=h+w:g=p+k;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){M(A,e,+m(e,++f),+x(e,f),p,h,g,v)},visit:function(e){Ga(e,A,p,h,g,v)},find:function(e){return Za(A,e[0],e[1],p,h,g,v)}};if(f=-1,null==t){for(;++f=0&&!(n=e.interpolators[a](t,r)););return n}function ei(e,t){var r,n=[],a=[],i=e.length,o=t.length,l=Math.min(e.length,t.length);for(r=0;r=1?1:e(t)}}function ii(e){return function(t){return 1-e(1-t)}}function oi(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function li(e){return e*e}function si(e){return e*e*e}function ci(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function ui(e){return 1-Math.cos(e*Ce)}function fi(e){return Math.pow(2,10*(e-1))}function di(e){return 1-Math.sqrt(1-e*e)}function pi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function hi(e,t){return t-=e,function(r){return Math.round(e+t*r)}}function gi(e){var t,r,n,a=[e.a,e.b],i=[e.c,e.d],o=mi(a),l=vi(a,i),s=mi(((t=i)[0]+=(n=-l)*(r=a)[0],t[1]+=n*r[1],t))||0;a[0]*i[1]=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):"in";return n=ri.get(n)||ti,ai((a=ni.get(a)||P)(n.apply(null,r.call(arguments,1))))},e.interpolateHcl=function(t,r){t=e.hcl(t),r=e.hcl(r);var n=t.h,a=t.c,i=t.l,o=r.h-n,l=r.c-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Xe(n+o*e,a+l*e,i+s*e)+""}},e.interpolateHsl=function(t,r){t=e.hsl(t),r=e.hsl(r);var n=t.h,a=t.s,i=t.l,o=r.h-n,l=r.s-a,s=r.l-i;isNaN(l)&&(l=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ge(n+o*e,a+l*e,i+s*e)+""}},e.interpolateLab=function(t,r){t=e.lab(t),r=e.lab(r);var n=t.l,a=t.a,i=t.b,o=r.l-n,l=r.a-a,s=r.b-i;return function(e){return $e(n+o*e,a+l*e,i+s*e)+""}},e.interpolateRound=hi,e.transform=function(t){var r=a.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(null!=e){r.setAttribute("transform",e);var t=r.transform.baseVal.consolidate()}return new gi(t?t.matrix:yi)})(t)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(e){return e.length?e.pop()+",":""}function bi(t,r){var n=[],a=[];return t=e.transform(t),r=e.transform(r),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else(t[0]||t[1])&&r.push("translate("+t+")")}(t.translate,r.translate,n,a),function(e,t,r,n){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Wa(e,t)})):t&&r.push(xi(r)+"rotate("+t+")")}(t.rotate,r.rotate,n,a),function(e,t,r,n){e!==t?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Wa(e,t)}):t&&r.push(xi(r)+"skewX("+t+")")}(t.skew,r.skew,n,a),function(e,t,r,n){if(e[0]!==t[0]||e[1]!==t[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else 1===t[0]&&1===t[1]||r.push(xi(r)+"scale("+t+")")}(t.scale,r.scale,n,a),t=r=null,function(e){for(var t,r=-1,i=a.length;++r0?n=e:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:n=0})):e>0&&(s.start({type:"start",alpha:n=e}),t=wt(l.tick)),l):n},l.start=function(){var e,t,r,n=m.length,s=y.length,u=c[0],h=c[1];for(e=0;e=0;)r.push(a[n])}function zi(e,t){for(var r=[e],n=[];null!=(e=r.pop());)if(n.push(e),(i=e.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return zi(a,(function(t){var n,a;e&&(n=t.children)&&n.sort(e),r&&(a=t.parent)&&(a.value+=t.value)})),l}return n.sort=function(t){return arguments.length?(e=t,n):e},n.children=function(e){return arguments.length?(t=e,n):t},n.value=function(e){return arguments.length?(r=e,n):r},n.revalue=function(e){return r&&(Ei(e,(function(e){e.children&&(e.value=0)})),zi(e,(function(e){var t;e.children||(e.value=+r.call(n,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},n},e.layout.partition=function(){var t=e.layout.hierarchy(),r=[1,1];function n(e,n){var a=t.call(this,e,n);return function e(t,r,n,a){var i=t.children;if(t.x=r,t.y=t.depth*a,t.dx=n,t.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(n=t.value?n/t.value:0;++cl&&(l=n),o.push(n)}for(r=0;ra&&(n=r,a=t);return n}function Xi(e){return e.reduce(Wi,0)}function Wi(e,t){return e+t[1]}function Ji(e,t){return Qi(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Qi(e,t){for(var r=-1,n=+e[0],a=(e[1]-n)/t,i=[];++r<=t;)i[r]=a*r+n;return i}function $i(t){return[e.min(t),e.max(t)]}function Ki(e,t){return e.value-t.value}function eo(e,t){var r=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=r,r._pack_prev=t}function to(e,t){e._pack_next=t,t._pack_prev=e}function ro(e,t){var r=t.x-e.x,n=t.y-e.y,a=e.r+t.r;return.999*a*a>r*r+n*n}function no(e){if((t=e.children)&&(s=t.length)){var t,r,n,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(t.forEach(ao),(r=t[0]).x=-r.r,r.y=0,x(r),s>1&&((n=t[1]).x=n.r,n.y=0,x(n),s>2))for(oo(r,n,a=t[2]),x(a),eo(r,a),r._pack_prev=a,eo(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[e.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(e){return arguments.length?(r=e,i):r},i.range=function(e){return arguments.length?(n=ht(e),i):n},i.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return Qi(t,e)}:ht(e),i):a},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},e.layout.pack=function(){var t,r=e.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(e,i){var o=r.call(this,e,i),l=o[0],s=a[0],c=a[1],u=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(l.x=l.y=0,zi(l,(function(e){e.r=+u(e.value)})),zi(l,no),n){var f=n*(t?1:Math.max(2*l.r/s,2*l.r/c))/2;zi(l,(function(e){e.r+=f})),zi(l,no),zi(l,(function(e){e.r-=f}))}return function e(t,r,n,a){var i=t.children;if(t.x=r+=a*t.x,t.y=n+=a*t.y,t.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=r(d,p)/2-d.x,v=n[0]/(p.x+r(p,d)/2+g),m=n[1]/(h.depth||1);Ei(u,(function(e){e.x=(e.x+g)*v,e.y=e.depth*m}))}return c}function o(e){var t=e.children,n=e.parent.children,a=e.i?n[e.i-1]:null;if(t.length){!function(e){var t,r=0,n=0,a=e.children,i=a.length;for(;--i>=0;)(t=a[i]).z+=r,t.m+=r,r+=t.s+(n+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;a?(e.z=a.z+r(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+r(e._,a._));e.parent.A=function(e,t,n){if(t){for(var a,i=e,o=e,l=t,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=e,(a=l.z+f-i.z-c+r(l._,i._))>0&&(uo(fo(l,e,n),e,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,n=e)}return n}(e,a,e.parent.A||n[0])}function l(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=n[0],e.y=e.depth*n[1]}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e)?s:null,i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null==(n=e)?null:s,i):a?n:null},Di(i,t)},e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),r=lo,n=[1,1],a=!1;function i(i,o){var l,s=t.call(this,i,o),c=s[0],u=0;zi(c,(function(t){var n=t.children;n&&n.length?(t.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(n),t.y=function(t){return 1+e.max(t,(function(e){return e.y}))}(n)):(t.x=l?u+=r(t,l):0,t.y=0,l=t)}));var f=function e(t){var r=t.children;return r&&r.length?e(r[0]):t}(c),d=function e(t){var r,n=t.children;return n&&(r=n.length)?e(n[r-1]):t}(c),p=f.x-r(f,d)/2,h=d.x+r(d,f)/2;return zi(c,a?function(e){e.x=(e.x-c.x)*n[0],e.y=(c.y-e.y)*n[1]}:function(e){e.x=(e.x-p)/(h-p)*n[0],e.y=(1-(c.y?e.y/c.y:1))*n[1]}),s}return i.separation=function(e){return arguments.length?(r=e,i):r},i.size=function(e){return arguments.length?(a=null==(n=e),i):a?null:n},i.nodeSize=function(e){return arguments.length?(a=null!=(n=e),i):a?n:null},Di(i,t)},e.layout.treemap=function(){var t,r=e.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(e,t){for(var r,n,a=-1,i=e.length;++a0;)l.push(r=c[a-1]),l.area+=r.area,"squarify"!==s||(n=p(l,g))<=d?(c.pop(),d=n):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var r,n=o(e),a=t.slice(),i=[];for(u(a,n.dx*n.dy/e.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(h(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);t.forEach(d)}}function p(e,t){for(var r,n=e.area,a=0,i=1/0,o=-1,l=e.length;++oa&&(a=r));return t*=t,(n*=n)?Math.max(t*a*c/n,n/(t*i*c)):1/0}function h(e,t,r,a){var i,o=-1,l=e.length,s=r.x,c=r.y,u=t?n(e.area/t):0;if(t==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return e+t*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var r=e.random.irwinHall(t);return function(){return r()/t}},irwinHall:function(e){return function(){for(var t=0,r=0;r2?_o:mo,l=a?wi:_i;return i=e(t,r,l,n),o=e(r,t,l,Ka),s}function s(e){return i(e)}return s.invert=function(e){return o(e)},s.domain=function(e){return arguments.length?(t=e.map(Number),l()):t},s.range=function(e){return arguments.length?(r=e,l()):r},s.rangeRound=function(e){return s.range(e).interpolate(hi)},s.clamp=function(e){return arguments.length?(a=e,l()):a},s.interpolate=function(e){return arguments.length?(n=e,l()):n},s.ticks=function(e){return To(t,e)},s.tickFormat=function(e,r){return Ao(t,e,r)},s.nice=function(e){return ko(t,e),l()},s.copy=function(){return e(t,r,n,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}e.scale.log=function(){return function t(r,n,a,i){function o(e){return(a?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(n)}function l(e){return a?Math.pow(n,e):-Math.pow(n,-e)}function s(e){return r(o(e))}return s.invert=function(e){return l(r.invert(e))},s.domain=function(e){return arguments.length?(a=e[0]>=0,r.domain((i=e.map(Number)).map(o)),s):i},s.base=function(e){return arguments.length?(n=+e,r.domain(i.map(o)),s):n},s.nice=function(){var e=yo(i.map(o),a?Math:Po);return r.domain(e),i=e.map(l),s},s.ticks=function(){var e=go(i),t=[],r=e[0],s=e[1],c=Math.floor(o(r)),u=Math.ceil(o(s)),f=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;d--)t.push(l(c)*d);for(c=0;t[c]s;u--);t=t.slice(c,u)}return t},s.tickFormat=function(t,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=e.format(r));var a=Math.max(1,n*t/s.ticks().length);return function(e){var t=e/l(Math.round(o(e)));return t*n0?a[e-1]:r[0],ef?0:1;if(c=Se)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,k,M,T,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Fo?Math.sqrt(l*l+c*c):+n.apply(this,arguments),p||(L*=-1),c&&(L=Re(v/c*Math.sin(m))),l&&(A=Re(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Ae?0:1;if(L&&qo(y,x,b,_)===p^C){var P=(u+f)/2;y=c*Math.cos(P),x=c*Math.sin(P),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),k=l*Math.sin(f-A),M=l*Math.cos(u+A),T=l*Math.sin(u+A);var O=Math.abs(u-f+2*A)<=Ae?0:1;if(A&&qo(w,k,M,T)===1-p^O){var D=(u+f)/2;w=l*Math.cos(D),k=l*Math.sin(D),M=T=null}}else w=k=0;if(d>Me&&(h=Math.min(Math.abs(c-l)/2,+r.apply(this,arguments)))>.001){g=l0?0:1}function Vo(e,t,r,n,a){var i=e[0]-t[0],o=e[1]-t[1],l=(a?n:-n)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=e[0]+s,f=e[1]+c,d=t[0]+s,p=t[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=r-n,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,k=(-b*v-m*_)/y,M=(b*m+v*_)/y,T=(-b*v+m*_)/y,A=w-h,L=k-g,S=M-h,C=T-g;return A*A+L*L>S*S+C*C&&(w=M,k=T),[[w-s,k-c],[w*r/x,k*r/x]]}function Go(e){var t=ra,r=na,n=Zr,a=Yo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=ht(t),p=ht(r);function h(){s.push("M",a(e(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Wo,"step-after":Jo,basis:Ko,"basis-open":function(e){if(e.length<4)return Yo(e);var t,r=[],n=-1,a=e.length,i=[0],o=[0];for(;++n<3;)t=e[n],i.push(t[0]),o.push(t[1]);r.push(el(nl,i)+","+el(nl,o)),--n;for(;++n9&&(a=3*t/Math.sqrt(a),o[l]=a*r,o[l+1]=a*n));l=-1;for(;++l<=s;)a=(e[Math.min(s,l+1)][0]-e[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(e))}});function Yo(e){return e.length>1?e.join("L"):e+"Z"}function Xo(e){return e.join("L")+"Z"}function Wo(e){for(var t=0,r=e.length,n=e[0],a=[n[0],",",n[1]];++t1){l=t[1],i=e[s],s++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAe)+",1 "+t}function s(e,t,r,n){return"Q 0,0 "+n}return i.radius=function(e){return arguments.length?(r=ht(e),i):r},i.source=function(t){return arguments.length?(e=ht(t),i):e},i.target=function(e){return arguments.length?(t=ht(e),i):t},i.startAngle=function(e){return arguments.length?(n=ht(e),i):n},i.endAngle=function(e){return arguments.length?(a=ht(e),i):a},i},e.svg.diagonal=function(){var e=Un,t=qn,r=cl;function n(n,a){var i=e.call(this,n,a),o=t.call(this,n,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(r))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return n.source=function(t){return arguments.length?(e=ht(t),n):e},n.target=function(e){return arguments.length?(t=ht(e),n):t},n.projection=function(e){return arguments.length?(r=e,n):r},n},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),r=cl,n=t.projection;return t.projection=function(e){return arguments.length?n(ul(r=e)):r},t},e.svg.symbol=function(){var e=dl,t=fl;function r(r,n){return(hl.get(e.call(this,r,n))||pl)(t.call(this,r,n))}return r.type=function(t){return arguments.length?(e=ht(t),r):e},r.size=function(e){return arguments.length?(t=ht(e),r):t},r};var hl=e.map({circle:pl,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vl)),r=t*vl;return"M0,"+-t+"L"+r+",0 0,"+t+" "+-r+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+r+"L"+t+","+-r+" "+-t+","+-r+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/gl),r=t*gl/2;return"M0,"+-r+"L"+t+","+r+" "+-t+","+r+"Z"}});e.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Pe);Z.transition=function(e){for(var t,r,n=bl||++kl,a=Al(e),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(e,o);if(i>=1)return f.event&&f.event.end.call(e,e.__data__,t),--u.count?delete u[n]:delete e[r],1}f||(i=a.time,o=wt((function(e){var t=f.delay;if(o.t=t+i,t<=e)return d(e-t);o.c=d}),0,i),f=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:t},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,e.transition=function(t,r){return t&&t.transition?bl?t.transition(r):t:e.selection().transition(t)},e.transition.prototype=wl,wl.select=function(e){var t,r,n,a=this.id,i=this.namespace,o=[];e=Y(e);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=e.select(e.event.target),x=n.of(m,arguments),b=e.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,k=!/^(e|w)$/.test(_)&&i,M=y.classed("extent"),T=be(m),A=e.mouse(m),L=e.select(o(m)).on("keydown.brush",P).on("keyup.brush",O);if(e.event.changedTouches?L.on("touchmove.brush",D).on("touchend.brush",z):L.on("mousemove.brush",D).on("mouseup.brush",z),b.interrupt().selectAll("*").interrupt(),M)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else e.event.altKey&&(f=A.slice());function P(){32==e.event.keyCode&&(M||(f=null,A[0]-=l[1],A[1]-=s[1],M=2),F())}function O(){32==e.event.keyCode&&2==M&&(A[0]+=l[1],A[1]+=s[1],M=0,F())}function D(){var t=e.mouse(m),r=!1;v&&(t[0]+=v[0],t[1]+=v[1]),M||(e.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(t[0]1?{floor:function(t){for(;l(t=e.floor(t));)t=jl(t-1);return t},ceil:function(t){for(;l(t=e.ceil(t));)t=jl(+t+1);return t}}:e))},a.ticks=function(e,t){var r=go(a.domain()),n=null==e?i(r,10):"number"==typeof e?i(r,e):!e.range&&[{range:e},t];return n&&(e=n[0],t=n[1]),e.range(r[0],jl(+r[1]+1),t<1?1:t)},a.tickFormat=function(){return n},a.copy=function(){return Nl(t.copy(),r,n)},wo(a,t)}function jl(e){return new Date(e)}zl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Il,Fl.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Fl.toString=Il.toString,Dt.second=It((function(e){return new Et(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Dt.seconds=Dt.second.range,Dt.seconds.utc=Dt.second.utc.range,Dt.minute=It((function(e){return new Et(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Dt.minutes=Dt.minute.range,Dt.minutes.utc=Dt.minute.utc.range,Dt.hour=It((function(e){var t=e.getTimezoneOffset()/60;return new Et(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Dt.hours=Dt.hour.range,Dt.hours.utc=Dt.hour.utc.range,Dt.month=It((function(e){return(e=Dt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Dt.months=Dt.month.range,Dt.months.utc=Dt.month.utc.range;var Hl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Bl=[[Dt.second,1],[Dt.second,5],[Dt.second,15],[Dt.second,30],[Dt.minute,1],[Dt.minute,5],[Dt.minute,15],[Dt.minute,30],[Dt.hour,1],[Dt.hour,3],[Dt.hour,6],[Dt.hour,12],[Dt.day,1],[Dt.day,2],[Dt.week,1],[Dt.month,1],[Dt.month,3],[Dt.year,1]],Ul=zl.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Zr]]),ql={range:function(t,r,n){return e.range(Math.ceil(t/n)*n,+r,n).map(jl)},floor:P,ceil:P};Bl.year=Dt.year,Dt.scale=function(){return Nl(e.scale.linear(),Bl,Ul)};var Vl=Bl.map((function(e){return[e[0].utc,e[1]]})),Gl=Rl.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Zr]]);function Zl(e){return JSON.parse(e.responseText)}function Yl(e){var t=a.createRange();return t.selectNode(a.body),t.createContextualFragment(e.responseText)}Vl.year=Dt.year.utc,Dt.scale.utc=function(){return Nl(e.scale.linear(),Vl,Gl)},e.text=gt((function(e){return e.responseText})),e.json=function(e,t){return vt(e,"application/json",Zl,t)},e.html=function(e,t){return vt(e,"text/html",Yl,t)},e.xml=gt((function(e){return e.responseXML})),"object"==typeof t&&t.exports?t.exports=e:this.d3=e}()},{}],16:[function(e,t,r){(function(n,a){ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=e()}}((function(){return function e(t,n,r){function a(o,l){if(!n[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");r.addStyleRule(o,a[i])}},{"../src/lib":210}],2:[function(e,t,n){"use strict";t.exports=e("../src/traces/choropleth")},{"../src/traces/choropleth":320}],3:[function(e,t,n){"use strict";t.exports=e("../src/core")},{"../src/core":189}],4:[function(e,t,n){"use strict";var r=e("./core");r.register([e("./scattergeo"),e("./choropleth")]),t.exports=r},{"./choropleth":2,"./core":3,"./scattergeo":5}],5:[function(e,t,n){"use strict";t.exports=e("../src/traces/scattergeo")},{"../src/traces/scattergeo":362}],6:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@turf/meta");function a(e){var t=0;if(e&&e.length>0){t+=Math.abs(i(e[0]));for(var n=1;n2){for(l=0;le[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]=0))throw new Error("precision must be a positive number");var n=Math.pow(10,t||0);return Math.round(e*n)/n},n.radiansToLength=f,n.lengthToRadians=d,n.lengthToDegrees=function(e,t){return p(d(e,t))},n.bearingToAzimuth=function(e){var t=e%360;return t<0&&(t+=360),t},n.radiansToDegrees=p,n.degreesToRadians=function(e){return e%360*Math.PI/180},n.convertLength=function(e,t,n){if(void 0===t&&(t="kilometers"),void 0===n&&(n="kilometers"),!(e>=0))throw new Error("length must be a positive number");return f(d(e,t),n)},n.convertArea=function(e,t,r){if(void 0===t&&(t="meters"),void 0===r&&(r="kilometers"),!(e>=0))throw new Error("area must be a positive number");var a=n.areaFactors[t];if(!a)throw new Error("invalid original units");var i=n.areaFactors[r];if(!i)throw new Error("invalid final units");return e/a*i},n.isNumber=h,n.isObject=function(e){return!!e&&e.constructor===Object},n.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!h(e))throw new Error("bbox must only contain numbers")}))},n.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")},n.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},n.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},n.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},n.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},n.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},n.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},n.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},{}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("@turf/helpers");function a(e,t,n){if(null!==e)for(var r,i,o,l,s,c,u,f,d=0,p=0,h=e.type,g="FeatureCollection"===h,v="Feature"===h,m=g?e.features.length:1,y=0;yc||p>u||h>f)return s=a,c=n,u=p,f=h,void(o=0);var g=r.lineString([s,a],e.properties);if(!1===t(g,n,i,h,o))return!1;o++,s=a}))&&void 0}}}))}function u(e,t){if(!e)throw new Error("geojson is required");s(e,(function(e,n,a){if(null!==e.geometry){var i=e.geometry.type,o=e.geometry.coordinates;switch(i){case"LineString":if(!1===t(e,n,a,0,0))return!1;break;case"Polygon":for(var l=0;l0&&o.length>a&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=o.length,l=s,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},a=d.bind(r);return a.listener=n,r.wrapFn=a,a}function h(e,t,n){var r=e._events;if(void 0===r)return[];var a=r[t];return void 0===a?[]:"function"==typeof a?n?[a.listener||a]:[a]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var s=a[e];if(void 0===s)return!1;if("function"==typeof s)i(s,this,t);else{var c=s.length,u=v(s,c);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){o=n[i].listener,a=i;break}if(a<0)return this;0===a?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},l.prototype.listeners=function(e){return h(this,e,!0)},l.prototype.rawListeners=function(e){return h(this,e,!1)},l.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},l.prototype.listenerCount=g,l.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},{}],12:[function(e,t,n){t.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],13:[function(e,t,n){!function(r,a){"object"==typeof n&&"undefined"!=typeof t?a(n,e("d3-time")):a((r=r||self).d3=r.d3||{},r.d3)}(this,(function(e,t){"use strict";function n(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function r(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function a(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,o=e.date,s=e.time,c=e.periods,u=e.days,f=e.shortDays,d=e.months,ye=e.shortMonths,xe=p(c),be=h(c),_e=p(u),we=h(u),ke=p(f),Te=h(f),Me=p(d),Ae=h(d),Le=p(ye),Se=h(ye),Ce={a:function(e){return f[e.getDay()]},A:function(e){return u[e.getDay()]},b:function(e){return ye[e.getMonth()]},B:function(e){return d[e.getMonth()]},c:null,d:z,e:z,f:B,H:I,I:F,j:N,L:j,m:H,M:U,p:function(e){return c[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:ve,s:me,S:q,u:V,U:G,V:Z,w:Y,W:X,x:null,X:null,y:W,Y:J,Z:Q,"%":ge},Pe={a:function(e){return f[e.getUTCDay()]},A:function(e){return u[e.getUTCDay()]},b:function(e){return ye[e.getUTCMonth()]},B:function(e){return d[e.getUTCMonth()]},c:null,d:$,e:$,f:re,H:K,I:ee,j:te,L:ne,m:ae,M:ie,p:function(e){return c[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:ve,s:me,S:oe,u:le,U:se,V:ce,w:ue,W:fe,x:null,X:null,y:de,Y:pe,Z:he,"%":ge},Oe={a:function(e,t,n){var r=ke.exec(t.slice(n));return r?(e.w=Te[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=_e.exec(t.slice(n));return r?(e.w=we[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=Le.exec(t.slice(n));return r?(e.m=Se[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=Me.exec(t.slice(n));return r?(e.m=Ae[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,t,n){return Ee(e,i,t,n)},d:M,e:M,f:O,H:L,I:L,j:A,L:P,m:T,M:S,p:function(e,t,n){var r=xe.exec(t.slice(n));return r?(e.p=be[r[0].toLowerCase()],n+r[0].length):-1},q:k,Q:R,s:E,S:C,u:v,U:m,V:y,w:g,W:x,x:function(e,t,n){return Ee(e,o,t,n)},X:function(e,t,n){return Ee(e,s,t,n)},y:_,Y:b,Z:w,"%":D};function De(e,t){return function(n){var r,a,i,o=[],s=-1,c=0,u=e.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in c||(c.w=1),"Z"in c?(s=(l=r(a(c.y,0,1))).getUTCDay(),l=s>4||0===s?t.utcMonday.ceil(l):t.utcMonday(l),l=t.utcDay.offset(l,7*(c.V-1)),c.y=l.getUTCFullYear(),c.m=l.getUTCMonth(),c.d=l.getUTCDate()+(c.w+6)%7):(s=(l=n(a(c.y,0,1))).getDay(),l=s>4||0===s?t.timeMonday.ceil(l):t.timeMonday(l),l=t.timeDay.offset(l,7*(c.V-1)),c.y=l.getFullYear(),c.m=l.getMonth(),c.d=l.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),s="Z"in c?r(a(c.y,0,1)).getUTCDay():n(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(s+5)%7:c.w+7*c.U-(s+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,r(c)):n(c)}}function Ee(e,t,n,r){for(var a,i,o=0,s=t.length,c=n.length;o=c)return-1;if(37===(a=t.charCodeAt(o++))){if(a=t.charAt(o++),!(i=Oe[a in l?t.charAt(o++):a])||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return Ce.x=De(o,Ce),Ce.X=De(s,Ce),Ce.c=De(i,Ce),Pe.x=De(o,Pe),Pe.X=De(s,Pe),Pe.c=De(i,Pe),{format:function(e){var t=De(e+="",Ce);return t.toString=function(){return e},t},parse:function(e){var t=Re(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=De(e+="",Pe);return t.toString=function(){return e},t},utcParse:function(e){var t=Re(e+="",!0);return t.toString=function(){return e},t}}}var o,l={"-":"",_:" ",0:"0"},s=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i68?1900:2e3),n+r[0].length):-1}function w(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function k(e,t,n){var r=s.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function T(e,t,n){var r=s.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function M(e,t,n){var r=s.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function A(e,t,n){var r=s.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function L(e,t,n){var r=s.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function S(e,t,n){var r=s.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function C(e,t,n){var r=s.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function P(e,t,n){var r=s.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function O(e,t,n){var r=s.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function D(e,t,n){var r=c.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function R(e,t,n){var r=s.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function E(e,t,n){var r=s.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function z(e,t){return f(e.getDate(),t,2)}function I(e,t){return f(e.getHours(),t,2)}function F(e,t){return f(e.getHours()%12||12,t,2)}function N(e,n){return f(1+t.timeDay.count(t.timeYear(e),e),n,3)}function j(e,t){return f(e.getMilliseconds(),t,3)}function B(e,t){return j(e,t)+"000"}function H(e,t){return f(e.getMonth()+1,t,2)}function U(e,t){return f(e.getMinutes(),t,2)}function q(e,t){return f(e.getSeconds(),t,2)}function V(e){var t=e.getDay();return 0===t?7:t}function G(e,n){return f(t.timeSunday.count(t.timeYear(e)-1,e),n,2)}function Z(e,n){var r=e.getDay();return e=r>=4||0===r?t.timeThursday(e):t.timeThursday.ceil(e),f(t.timeThursday.count(t.timeYear(e),e)+(4===t.timeYear(e).getDay()),n,2)}function Y(e){return e.getDay()}function X(e,n){return f(t.timeMonday.count(t.timeYear(e)-1,e),n,2)}function W(e,t){return f(e.getFullYear()%100,t,2)}function J(e,t){return f(e.getFullYear()%1e4,t,4)}function Q(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+f(t/60|0,"0",2)+f(t%60,"0",2)}function $(e,t){return f(e.getUTCDate(),t,2)}function K(e,t){return f(e.getUTCHours(),t,2)}function ee(e,t){return f(e.getUTCHours()%12||12,t,2)}function te(e,n){return f(1+t.utcDay.count(t.utcYear(e),e),n,3)}function ne(e,t){return f(e.getUTCMilliseconds(),t,3)}function re(e,t){return ne(e,t)+"000"}function ae(e,t){return f(e.getUTCMonth()+1,t,2)}function ie(e,t){return f(e.getUTCMinutes(),t,2)}function oe(e,t){return f(e.getUTCSeconds(),t,2)}function le(e){var t=e.getUTCDay();return 0===t?7:t}function se(e,n){return f(t.utcSunday.count(t.utcYear(e)-1,e),n,2)}function ce(e,n){var r=e.getUTCDay();return e=r>=4||0===r?t.utcThursday(e):t.utcThursday.ceil(e),f(t.utcThursday.count(t.utcYear(e),e)+(4===t.utcYear(e).getUTCDay()),n,2)}function ue(e){return e.getUTCDay()}function fe(e,n){return f(t.utcMonday.count(t.utcYear(e)-1,e),n,2)}function de(e,t){return f(e.getUTCFullYear()%100,t,2)}function pe(e,t){return f(e.getUTCFullYear()%1e4,t,4)}function he(){return"+0000"}function ge(){return"%"}function ve(e){return+e}function me(e){return Math.floor(+e/1e3)}function ye(t){return o=i(t),e.timeFormat=o.format,e.timeParse=o.parse,e.utcFormat=o.utcFormat,e.utcParse=o.utcParse,o}ye({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xe=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var be=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=xe,e.isoParse=be,e.timeFormatDefaultLocale=ye,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})}))},{"d3-time":14}],14:[function(e,t,n){!function(e,r){"object"==typeof n&&"undefined"!=typeof t?r(n):r((e=e||self).d3=e.d3||{})}(this,(function(e){"use strict";var t=new Date,n=new Date;function r(e,a,i,o){function l(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return l.floor=function(t){return e(t=new Date(+t)),t},l.ceil=function(t){return e(t=new Date(t-1)),a(t,1),e(t),t},l.round=function(e){var t=l(e),n=l.ceil(e);return e-t0))return o;do{o.push(i=new Date(+t)),a(t,r),e(t)}while(i=n)for(;e(n),!t(n);)n.setTime(n-1)}),(function(e,n){if(e>=e)if(n<0)for(;++n<=0;)for(;a(e,-1),!t(e););else for(;--n>=0;)for(;a(e,1),!t(e););}))},i&&(l.count=function(r,a){return t.setTime(+r),n.setTime(+a),e(t),e(n),Math.floor(i(t,n))},l.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?l.filter(o?function(t){return o(t)%e==0}:function(t){return l.count(0,t)%e==0}):l:null}),l}var a=r((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?r((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,n){t.setTime(+t+n*e)}),(function(t,n){return(n-t)/e})):a:null};var i=a.range,o=r((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()})),l=o.range,s=r((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getMinutes()})),c=s.range,u=r((function(e){e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()})),f=u.range,d=r((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),(function(e){return e.getDate()-1})),p=d.range;function h(e){return r((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5}))}var g=h(0),v=h(1),m=h(2),y=h(3),x=h(4),b=h(5),_=h(6),w=g.range,k=v.range,T=m.range,M=y.range,A=x.range,L=b.range,S=_.range,C=r((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),P=C.range,O=r((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));O.every=function(e){return isFinite(e=Math.floor(e))&&e>0?r((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n*e)})):null};var D=O.range,R=r((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+6e4*t)}),(function(e,t){return(t-e)/6e4}),(function(e){return e.getUTCMinutes()})),E=R.range,z=r((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()})),I=z.range,F=r((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1})),N=F.range;function j(e){return r((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/6048e5}))}var B=j(0),H=j(1),U=j(2),q=j(3),V=j(4),G=j(5),Z=j(6),Y=B.range,X=H.range,W=U.range,J=q.range,Q=V.range,$=G.range,K=Z.range,ee=r((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),te=ee.range,ne=r((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));ne.every=function(e){return isFinite(e=Math.floor(e))&&e>0?r((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null};var re=ne.range;e.timeDay=d,e.timeDays=p,e.timeFriday=b,e.timeFridays=L,e.timeHour=u,e.timeHours=f,e.timeInterval=r,e.timeMillisecond=a,e.timeMilliseconds=i,e.timeMinute=s,e.timeMinutes=c,e.timeMonday=v,e.timeMondays=k,e.timeMonth=C,e.timeMonths=P,e.timeSaturday=_,e.timeSaturdays=S,e.timeSecond=o,e.timeSeconds=l,e.timeSunday=g,e.timeSundays=w,e.timeThursday=x,e.timeThursdays=A,e.timeTuesday=m,e.timeTuesdays=T,e.timeWednesday=y,e.timeWednesdays=M,e.timeWeek=g,e.timeWeeks=w,e.timeYear=O,e.timeYears=D,e.utcDay=F,e.utcDays=N,e.utcFriday=G,e.utcFridays=$,e.utcHour=z,e.utcHours=I,e.utcMillisecond=a,e.utcMilliseconds=i,e.utcMinute=R,e.utcMinutes=E,e.utcMonday=H,e.utcMondays=X,e.utcMonth=ee,e.utcMonths=te,e.utcSaturday=Z,e.utcSaturdays=K,e.utcSecond=o,e.utcSeconds=l,e.utcSunday=B,e.utcSundays=Y,e.utcThursday=V,e.utcThursdays=Q,e.utcTuesday=U,e.utcTuesdays=W,e.utcWednesday=q,e.utcWednesdays=J,e.utcWeek=B,e.utcWeeks=Y,e.utcYear=ne,e.utcYears=re,Object.defineProperty(e,"__esModule",{value:!0})}))},{}],15:[function(e,t,n){!function(){var e={version:"3.5.17"},n=[].slice,r=function(e){return n.call(e)},a=this.document;function i(e){return e&&(e.ownerDocument||e.document||e).documentElement}function o(e){return e&&(e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView)}if(a)try{r(a.documentElement.childNodes)[0].nodeType}catch(e){r=function(e){for(var t=e.length,n=new Array(t);t--;)n[t]=e[t];return n}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(e){var l=this.Element.prototype,s=l.setAttribute,c=l.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;l.setAttribute=function(e,t){s.call(this,e,t+"")},l.setAttributeNS=function(e,t,n){c.call(this,e,t,n+"")},u.setProperty=function(e,t,n){f.call(this,e,t+"",n)}}function d(e,t){return et?1:e>=t?0:NaN}function p(e){return null===e?NaN:+e}function h(e){return!isNaN(e)}function g(e){return{left:function(t,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=t.length);r>>1;e(t[i],n)<0?r=i+1:a=i}return r},right:function(t,n,r,a){for(arguments.length<3&&(r=0),arguments.length<4&&(a=t.length);r>>1;e(t[i],n)>0?a=i:r=i+1}return r}}}e.ascending=d,e.descending=function(e,t){return te?1:t>=e?0:NaN},e.min=function(e,t){var n,r,a=-1,i=e.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++ar&&(n=r)}else{for(;++a=r){n=r;break}for(;++ar&&(n=r)}return n},e.max=function(e,t){var n,r,a=-1,i=e.length;if(1===arguments.length){for(;++a=r){n=r;break}for(;++an&&(n=r)}else{for(;++a=r){n=r;break}for(;++an&&(n=r)}return n},e.extent=function(e,t){var n,r,a,i=-1,o=e.length;if(1===arguments.length){for(;++i=r){n=a=r;break}for(;++ir&&(n=r),a=r){n=a=r;break}for(;++ir&&(n=r),a1)return o/(s-1)},e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};var v=g(d);function m(e){return e.length}e.bisectLeft=v.left,e.bisect=e.bisectRight=v.right,e.bisector=function(e){return g(1===e.length?function(t,n){return d(e(t),n)}:e)},e.shuffle=function(e,t,n){(i=arguments.length)<3&&(n=e.length,i<2&&(t=0));for(var r,a,i=n-t;i;)a=Math.random()*i--|0,r=e[i+t],e[i+t]=e[a+t],e[a+t]=r;return e},e.permute=function(e,t){for(var n=t.length,r=new Array(n);n--;)r[n]=e[t[n]];return r},e.pairs=function(e){for(var t=0,n=e.length-1,r=e[0],a=new Array(n<0?0:n);t=0;)for(t=(r=e[a]).length;--t>=0;)n[--o]=r[t];return n};var y=Math.abs;function x(e){for(var t=1;e*t%1;)t*=10;return t}function b(e,t){for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}function _(){this._=Object.create(null)}e.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("infinite range");var r,a=[],i=x(y(n)),o=-1;if(e*=i,t*=i,(n*=i)<0)for(;(r=e+n*++o)>t;)a.push(r/i);else for(;(r=e+n*++o)=a.length)return n?n.call(r,i):t?i.sort(t):i;for(var s,c,u,f,d=-1,p=i.length,h=a[l++],g=new _;++d=a.length)return t;var r=[],o=i[n++];return t.forEach((function(t,a){r.push({key:t,values:e(a,n)})})),o?r.sort((function(e,t){return o(e.key,t.key)})):r}(o(e.map,t,0),0)},r.key=function(e){return a.push(e),r},r.sortKeys=function(e){return i[a.length-1]=e,r},r.sortValues=function(e){return t=e,r},r.rollup=function(e){return n=e,r},r},e.set=function(e){var t=new C;if(e)for(var n=0,r=e.length;n=0&&(r=e.slice(n+1),e=e.slice(0,n)),e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(2===arguments.length){if(null==t)for(e in this)this.hasOwnProperty(e)&&this[e].on(r,null);return this}},e.event=null,e.requote=function(e){return e.replace(B,"\\$&")};var B=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,H={}.__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};function U(e){return H(e,Z),e}var q=function(e,t){return t.querySelector(e)},V=function(e,t){return t.querySelectorAll(e)},G=function(e,t){var n=e.matches||e[D(e,"matchesSelector")];return(G=function(e,t){return n.call(e,t)})(e,t)};"function"==typeof Sizzle&&(q=function(e,t){return Sizzle(e,t)[0]||null},V=Sizzle,G=Sizzle.matchesSelector),e.selection=function(){return e.select(a.documentElement)};var Z=e.selection.prototype=[];function Y(e){return"function"==typeof e?e:function(){return q(e,this)}}function X(e){return"function"==typeof e?e:function(){return V(e,this)}}Z.select=function(e){var t,n,r,a,i=[];e=Y(e);for(var o=-1,l=this.length;++o=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),J.hasOwnProperty(n)?{space:J[n],local:e}:e}},Z.attr=function(t,n){if(arguments.length<2){if("string"==typeof t){var r=this.node();return(t=e.ns.qualify(t)).local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(n in t)this.each(Q(n,t[n]));return this}return this.each(Q(t,n))},Z.classed=function(e,t){if(arguments.length<2){if("string"==typeof e){var n=this.node(),r=(e=ee(e)).length,a=-1;if(t=n.classList){for(;++a=0;)(n=r[a])&&(i&&i!==n.nextSibling&&i.parentNode.insertBefore(n,i),i=n);return this},Z.sort=function(e){e=ce.apply(this,arguments);for(var t=-1,n=this.length;++t=t&&(t=a+1);!(o=l[t])&&++t0&&(t=t.slice(0,o));var s=ge.get(t);function c(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return s&&(t=s,l=me),o?n?function(){var e=l(n,r(arguments));c.call(this),this.addEventListener(t,this[i]=e,e.$=a),e._=n}:c:n?E:function(){var n,r=new RegExp("^__on([^.]+)"+e.requote(t)+"$");for(var a in this)if(n=a.match(r)){var i=this[a];this.removeEventListener(n[1],i,i.$),delete this[a]}}}e.selection.enter=fe,e.selection.enter.prototype=de,de.append=Z.append,de.empty=Z.empty,de.node=Z.node,de.call=Z.call,de.size=Z.size,de.select=function(e){for(var t,n,r,a,i,o=[],l=-1,s=this.length;++l0?1:e<0?-1:0}function Re(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}function Ee(e){return e>1?0:e<-1?Ae:Math.acos(e)}function ze(e){return e>1?Ce:e<-1?-Ce:Math.asin(e)}function Ie(e){return((e=Math.exp(e))+1/e)/2}function Fe(e){return(e=Math.sin(e/2))*e}var Ne=Math.SQRT2;e.interpolateZoom=function(e,t){var n,r,a=e[0],i=e[1],o=e[2],l=t[0],s=t[1],c=t[2],u=l-a,f=s-i,d=u*u+f*f;if(d0&&(t=t.transition().duration(g)),t.call(w.event)}function L(){c&&c.domain(s.range().map((function(e){return(e-d.x)/d.k})).map(s.invert)),f&&f.domain(u.range().map((function(e){return(e-d.y)/d.k})).map(u.invert))}function S(e){v++||e({type:"zoomstart"})}function C(e){L(),e({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function P(e){--v||(e({type:"zoomend"}),n=null)}function O(){var t=this,n=_.of(t,arguments),r=0,a=e.select(o(t)).on(y,s).on(x,c),i=k(e.mouse(t)),l=be(t);function s(){r=1,M(e.mouse(t),i),C(n)}function c(){a.on(y,null).on(x,null),l(r),P(n)}ml.call(t),S(n)}function D(){var t,n=this,r=_.of(n,arguments),a={},i=0,o=".zoom-"+e.event.changedTouches[0].identifier,s="touchmove"+o,c="touchend"+o,u=[],f=e.select(n),p=be(n);function h(){var r=e.touches(n);return t=d.k,r.forEach((function(e){e.identifier in a&&(a[e.identifier]=k(e))})),r}function g(){var t=e.event.target;e.select(t).on(s,v).on(c,y),u.push(t);for(var r=e.event.changedTouches,o=0,f=r.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];i=b*b+_*_}}function v(){var o,s,c,u,f=e.touches(n);ml.call(n);for(var d=0,p=f.length;d360?e-=360:e<0&&(e+=360),e<60?r+(a-r)*e/60:e<180?a:e<240?r+(a-r)*(240-e)/60:r}(e))}return e=isNaN(e)?0:(e%=360)<0?e+360:e,t=isNaN(t)||t<0?0:t>1?1:t,r=2*(n=n<0?0:n>1?1:n)-(a=n<=.5?n*(1+t):n+t-n*t),new rt(i(e+120),i(e),i(e-120))}function Ze(t,n,r){return this instanceof Ze?(this.h=+t,this.c=+n,void(this.l=+r)):arguments.length<2?t instanceof Ze?new Ze(t.h,t.c,t.l):Ke(t instanceof We?t.l:(t=ut((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Ze(t,n,r)}Ve.brighter=function(e){return e=Math.pow(.7,arguments.length?e:1),new qe(this.h,this.s,this.l/e)},Ve.darker=function(e){return e=Math.pow(.7,arguments.length?e:1),new qe(this.h,this.s,e*this.l)},Ve.rgb=function(){return Ge(this.h,this.s,this.l)},e.hcl=Ze;var Ye=Ze.prototype=new Ue;function Xe(e,t,n){return isNaN(e)&&(e=0),isNaN(t)&&(t=0),new We(n,Math.cos(e*=Pe)*t,Math.sin(e)*t)}function We(e,t,n){return this instanceof We?(this.l=+e,this.a=+t,void(this.b=+n)):arguments.length<2?e instanceof We?new We(e.l,e.a,e.b):e instanceof Ze?Xe(e.h,e.c,e.l):ut((e=rt(e)).r,e.g,e.b):new We(e,t,n)}Ye.brighter=function(e){return new Ze(this.h,this.c,Math.min(100,this.l+Je*(arguments.length?e:1)))},Ye.darker=function(e){return new Ze(this.h,this.c,Math.max(0,this.l-Je*(arguments.length?e:1)))},Ye.rgb=function(){return Xe(this.h,this.c,this.l).rgb()},e.lab=We;var Je=18,Qe=We.prototype=new Ue;function $e(e,t,n){var r=(e+16)/116,a=r+t/500,i=r-n/200;return new rt(nt(3.2404542*(a=.95047*et(a))-1.5371385*(r=1*et(r))-.4985314*(i=1.08883*et(i))),nt(-.969266*a+1.8760108*r+.041556*i),nt(.0556434*a-.2040259*r+1.0572252*i))}function Ke(e,t,n){return e>0?new Ze(Math.atan2(n,t)*Oe,Math.sqrt(t*t+n*n),e):new Ze(NaN,NaN,e)}function et(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function tt(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function nt(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function rt(e,t,n){return this instanceof rt?(this.r=~~e,this.g=~~t,void(this.b=~~n)):arguments.length<2?e instanceof rt?new rt(e.r,e.g,e.b):st(""+e,rt,Ge):new rt(e,t,n)}function at(e){return new rt(e>>16,e>>8&255,255&e)}function it(e){return at(e)+""}Qe.brighter=function(e){return new We(Math.min(100,this.l+Je*(arguments.length?e:1)),this.a,this.b)},Qe.darker=function(e){return new We(Math.max(0,this.l-Je*(arguments.length?e:1)),this.a,this.b)},Qe.rgb=function(){return $e(this.l,this.a,this.b)},e.rgb=rt;var ot=rt.prototype=new Ue;function lt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function st(e,t,n){var r,a,i,o=0,l=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(e=e.toLowerCase()))switch(a=r[2].split(","),r[1]){case"hsl":return n(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return t(dt(a[0]),dt(a[1]),dt(a[2]))}return(i=pt.get(e))?t(i.r,i.g,i.b):(null==e||"#"!==e.charAt(0)||isNaN(i=parseInt(e.slice(1),16))||(4===e.length?(o=(3840&i)>>4,o|=o>>4,l=240&i,l|=l>>4,s=15&i,s|=s<<4):7===e.length&&(o=(16711680&i)>>16,l=(65280&i)>>8,s=255&i)),t(o,l,s))}function ct(e,t,n){var r,a,i=Math.min(e/=255,t/=255,n/=255),o=Math.max(e,t,n),l=o-i,s=(o+i)/2;return l?(a=s<.5?l/(o+i):l/(2-o-i),r=e==o?(t-n)/l+(t0&&s<1?0:r),new qe(r,a,s)}function ut(e,t,n){var r=tt((.4124564*(e=ft(e))+.3575761*(t=ft(t))+.1804375*(n=ft(n)))/.95047),a=tt((.2126729*e+.7151522*t+.072175*n)/1);return We(116*a-16,500*(r-a),200*(a-tt((.0193339*e+.119192*t+.9503041*n)/1.08883)))}function ft(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dt(e){var t=parseFloat(e);return"%"===e.charAt(e.length-1)?Math.round(2.55*t):t}ot.brighter=function(e){e=Math.pow(.7,arguments.length?e:1);var t=this.r,n=this.g,r=this.b,a=30;return t||n||r?(t&&t=200&&t<300||304===t){try{e=a.call(o,c)}catch(e){return void l.error.call(o,e)}l.load.call(o,e)}else l.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var n=e.event;e.event=t;try{l.progress.call(o,c)}finally{e.event=n}},o.header=function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?s[e]:(null==t?delete s[e]:s[e]=t+"",o)},o.mimeType=function(e){return arguments.length?(n=null==e?null:e+"",o):n},o.responseType=function(e){return arguments.length?(u=e,o):u},o.response=function(e){return a=e,o},["get","post"].forEach((function(e){o[e]=function(){return o.send.apply(o,[e].concat(r(arguments)))}})),o.send=function(e,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),c.open(e,t,!0),null==n||"accept"in s||(s.accept=n+",*/*"),c.setRequestHeader)for(var i in s)c.setRequestHeader(i,s[i]);return null!=n&&c.overrideMimeType&&c.overrideMimeType(n),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(e){a(null,e)})),l.beforesend.call(o,c),c.send(null==r?null:r),o},o.abort=function(){return c.abort(),o},e.rebind(o,l,"on"),null==i?o:o.get(function(e){return 1===e.length?function(t,n){e(null==t?n:null)}:e}(i))}pt.forEach((function(e,t){pt.set(e,at(t))})),e.functor=ht,e.xhr=gt(P),e.dsv=function(e,t){var n=new RegExp('["'+e+"\n]"),r=e.charCodeAt(0);function a(e,n,r){arguments.length<3&&(r=n,n=null);var a=vt(e,t,null==n?i:o(n),r);return a.row=function(e){return arguments.length?a.response(null==(n=e)?i:o(e)):n},a}function i(e){return a.parse(e.responseText)}function o(e){return function(t){return a.parse(t.responseText,e)}}function l(t){return t.map(s).join(e)}function s(e){return n.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}return a.parse=function(e,t){var n;return a.parseRows(e,(function(e,r){if(n)return n(e,r-1);var a=new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+"]"})).join(",")+"}");n=t?function(e,n){return t(a(e),n)}:a}))},a.parseRows=function(e,t){var n,a,i={},o={},l=[],s=e.length,c=0,u=0;function f(){if(c>=s)return o;if(a)return a=!1,i;var t=c;if(34===e.charCodeAt(t)){for(var n=t;n++24?(isFinite(t)&&(clearTimeout(bt),bt=setTimeout(kt,t)),xt=0):(xt=1,_t(kt))}function Tt(){for(var e=Date.now(),t=mt;t;)e>=t.t&&t.c(e-t.t)&&(t.c=null),t=t.n;return e}function Mt(){for(var e,t=mt,n=1/0;t;)t.c?(t.t8?function(e){return e/n}:function(e){return e*n},symbol:e}}));function St(t){var n=t.decimal,r=t.thousands,a=t.grouping,i=t.currency,o=a&&r?function(e,t){for(var n=e.length,i=[],o=0,l=a[0],s=0;n>0&&l>0&&(s+l+1>t&&(l=Math.max(1,t-s)),i.push(e.substring(n-=l,n+l)),!((s+=l+1)>t));)l=a[o=(o+1)%a.length];return i.reverse().join(r)}:P;return function(t){var r=Ct.exec(t),a=r[1]||" ",l=r[2]||">",s=r[3]||"-",c=r[4]||"",u=r[5],f=+r[6],d=r[7],p=r[8],h=r[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===l)&&(u=a="0",l="="),h){case"n":d=!0,h="g";break;case"%":g=100,m="%",h="f";break;case"p":g=100,m="%",h="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+h.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,h="r"}"$"===c&&(v=i[0],m=i[1]),"r"!=h||p||(h="g"),null!=p&&("g"==h?p=Math.max(1,Math.min(21,p)):"e"!=h&&"f"!=h||(p=Math.max(0,Math.min(20,p)))),h=Pt.get(h)||Ot;var b=u&&d;return function(t){var r=m;if(y&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(g<0){var c=e.formatPrefix(t,p);t=c.scale(t),r=c.symbol+m}else t*=g;var _,w,k=(t=h(t,p)).lastIndexOf(".");if(k<0){var T=x?t.lastIndexOf("e"):-1;T<0?(_=t,w=""):(_=t.substring(0,T),w=t.substring(T))}else _=t.substring(0,k),w=n+t.substring(k+1);!u&&d&&(_=o(_,1/0));var M=v.length+_.length+w.length+(b?0:i.length),A=M"===l?A+i+t:"^"===l?A.substring(0,M>>=1)+i+t+A.substring(M):i+(b?t:A+t))+r}}}e.formatPrefix=function(t,n){var r=0;return(t=+t)&&(t<0&&(t*=-1),n&&(t=e.round(t,At(t,n))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),Lt[8+r/3]};var Ct=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Pt=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,At(t,n))).toFixed(Math.max(0,Math.min(20,At(t*(1+1e-15),n))))}});function Ot(e){return e+""}var Dt=e.time={},Rt=Date;function Et(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Et.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(){zt.setUTCDate.apply(this._,arguments)},setDay:function(){zt.setUTCDay.apply(this._,arguments)},setFullYear:function(){zt.setUTCFullYear.apply(this._,arguments)},setHours:function(){zt.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){zt.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){zt.setUTCMinutes.apply(this._,arguments)},setMonth:function(){zt.setUTCMonth.apply(this._,arguments)},setSeconds:function(){zt.setUTCSeconds.apply(this._,arguments)},setTime:function(){zt.setTime.apply(this._,arguments)}};var zt=Date.prototype;function It(e,t,n){function r(t){var n=e(t),r=i(n,1);return t-n1)for(;o=c)return-1;if(37===(a=t.charCodeAt(l++))){if(o=t.charAt(l++),!(i=w[o in jt?t.charAt(l++):o])||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}u.utc=function(e){var t=u(e);function n(e){try{var n=new(Rt=Et);return n._=e,t(n)}finally{Rt=Date}}return n.parse=function(e){try{Rt=Et;var n=t.parse(e);return n&&n._}finally{Rt=Date}},n.toString=t.toString,n},u.multi=u.utc.multi=ln;var d=e.map(),p=qt(o),h=Vt(o),g=qt(l),v=Vt(l),m=qt(s),y=Vt(s),x=qt(c),b=Vt(c);i.forEach((function(e,t){d.set(e.toLowerCase(),t)}));var _={a:function(e){return l[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:u(n),d:function(e,t){return Ut(e.getDate(),t,2)},e:function(e,t){return Ut(e.getDate(),t,2)},H:function(e,t){return Ut(e.getHours(),t,2)},I:function(e,t){return Ut(e.getHours()%12||12,t,2)},j:function(e,t){return Ut(1+Dt.dayOfYear(e),t,3)},L:function(e,t){return Ut(e.getMilliseconds(),t,3)},m:function(e,t){return Ut(e.getMonth()+1,t,2)},M:function(e,t){return Ut(e.getMinutes(),t,2)},p:function(e){return i[+(e.getHours()>=12)]},S:function(e,t){return Ut(e.getSeconds(),t,2)},U:function(e,t){return Ut(Dt.sundayOfYear(e),t,2)},w:function(e){return e.getDay()},W:function(e,t){return Ut(Dt.mondayOfYear(e),t,2)},x:u(r),X:u(a),y:function(e,t){return Ut(e.getFullYear()%100,t,2)},Y:function(e,t){return Ut(e.getFullYear()%1e4,t,4)},Z:an,"%":function(){return"%"}},w={a:function(e,t,n){g.lastIndex=0;var r=g.exec(t.slice(n));return r?(e.w=v.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){p.lastIndex=0;var r=p.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){x.lastIndex=0;var r=x.exec(t.slice(n));return r?(e.m=b.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){m.lastIndex=0;var r=m.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,t,n){return f(e,_.c.toString(),t,n)},d:$t,e:$t,H:en,I:en,j:Kt,L:rn,m:Qt,M:tn,p:function(e,t,n){var r=d.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)},S:nn,U:Zt,w:Gt,W:Yt,x:function(e,t,n){return f(e,_.x.toString(),t,n)},X:function(e,t,n){return f(e,_.X.toString(),t,n)},y:Wt,Y:Xt,Z:Jt,"%":on};return u}Dt.year=It((function(e){return(e=Dt.day(e)).setMonth(0,1),e}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e){return e.getFullYear()})),Dt.years=Dt.year.range,Dt.years.utc=Dt.year.utc.range,Dt.day=It((function(e){var t=new Rt(2e3,0);return t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e){return e.getDate()-1})),Dt.days=Dt.day.range,Dt.days.utc=Dt.day.utc.range,Dt.dayOfYear=function(e){var t=Dt.year(e);return Math.floor((e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(e,t){t=7-t;var n=Dt[e]=It((function(e){return(e=Dt.day(e)).setDate(e.getDate()-(e.getDay()+t)%7),e}),(function(e,t){e.setDate(e.getDate()+7*Math.floor(t))}),(function(e){var n=Dt.year(e).getDay();return Math.floor((Dt.dayOfYear(e)+(n+t)%7)/7)-(n!==t)}));Dt[e+"s"]=n.range,Dt[e+"s"].utc=n.utc.range,Dt[e+"OfYear"]=function(e){var n=Dt.year(e).getDay();return Math.floor((Dt.dayOfYear(e)+(n+t)%7)/7)}})),Dt.week=Dt.sunday,Dt.weeks=Dt.sunday.range,Dt.weeks.utc=Dt.sunday.utc.range,Dt.weekOfYear=Dt.sundayOfYear;var jt={"-":"",_:" ",0:"0"},Bt=/^\s*\d+/,Ht=/^%/;function Ut(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",i=a.length;return r+(i68?1900:2e3),n+a[0].length):-1}function Jt(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function Qt(e,t,n){Bt.lastIndex=0;var r=Bt.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function $t(e,t,n){Bt.lastIndex=0;var r=Bt.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Kt(e,t,n){Bt.lastIndex=0;var r=Bt.exec(t.slice(n,n+3));return r?(e.j=+r[0],n+r[0].length):-1}function en(e,t,n){Bt.lastIndex=0;var r=Bt.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function tn(e,t,n){Bt.lastIndex=0;var r=Bt.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function nn(e,t,n){Bt.lastIndex=0;var r=Bt.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function rn(e,t,n){Bt.lastIndex=0;var r=Bt.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function an(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=y(t)/60|0,a=y(t)%60;return n+Ut(r,"0",2)+Ut(a,"0",2)}function on(e,t,n){Ht.lastIndex=0;var r=Ht.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function ln(e){for(var t=e.length,n=-1;++n=0?1:-1,l=o*i,s=Math.cos(t),c=Math.sin(t),u=a*c,f=r*s+u*Math.cos(l),d=u*o*Math.sin(l);Cn.add(Math.atan2(d,f)),n=e,r=s,a=c}Pn.point=function(o,l){Pn.point=i,n=(e=o)*Pe,r=Math.cos(l=(t=l)*Pe/2+Ae/4),a=Math.sin(l)},Pn.lineEnd=function(){i(e,t)}}function Dn(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Rn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function En(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function zn(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function In(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Fn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Nn(e){return[Math.atan2(e[1],e[0]),ze(e[2])]}function jn(e,t){return y(e[0]-t[0])Te?a=90:c<-Te&&(n=-90),f[0]=t,f[1]=r}};function p(e,i){u.push(f=[t=e,r=e]),ia&&(a=i)}function h(e,o){var l=Dn([e*Pe,o*Pe]);if(s){var c=En(s,l),u=En([c[1],-c[0],0],c);Fn(u),u=Nn(u);var f=e-i,d=f>0?1:-1,h=u[0]*Oe*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(h=(h+360)%360-180)&&ha&&(a=o);g?e_(t,r)&&(r=e):_(e,r)>_(t,r)&&(t=e):r>=t?(er&&(r=e)):e>i?_(t,e)>_(t,r)&&(r=e):_(e,r)>_(t,r)&&(t=e)}else p(e,o);s=l,i=e}function g(){d.point=h}function v(){f[0]=t,f[1]=r,d.point=p,s=null}function m(e,t){if(s){var n=e-i;c+=y(n)>180?n+(n>0?360:-360):n}else o=e,l=t;Pn.point(e,t),h(e,t)}function x(){Pn.lineStart()}function b(){m(o,l),Pn.lineEnd(),y(c)>Te&&(t=-(r=180)),f[0]=t,f[1]=r,s=null}function _(e,t){return(t-=e)<0?t+360:t}function w(e,t){return e[0]-t[0]}function k(e,t){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):l.push(g=p);for(var s,c,p,h=-1/0,g=(o=0,l[c=l.length-1]);o<=c;g=p,++o)p=l[o],(s=_(g[1],p[0]))>h&&(h=s,t=p[0],r=g[1])}return u=f=null,t===1/0||n===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,n],[r,a]]}}(),e.geo.centroid=function(t){yn=xn=bn=_n=wn=kn=Tn=Mn=An=Ln=Sn=0,e.geo.stream(t,Bn);var n=An,r=Ln,a=Sn,i=n*n+r*r+a*a;return i=0;--l)a.point((f=u[l])[0],f[1]);else r(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,h=!h}while(!p.v);a.lineEnd()}}}function Wn(e){if(t=e.length){for(var t,n,r=0,a=e[0];++r=0?1:-1,k=w*_,T=k>Ae,M=h*x;if(Cn.add(Math.atan2(M*w*Math.sin(k),g*b+M*Math.cos(k))),i+=T?_+w*Le:_,T^d>=n^m>=n){var A=En(Dn(f),Dn(e));Fn(A);var L=En(a,A);Fn(L);var S=(T^_>=0?-1:1)*ze(L[2]);(r>S||r===S&&(A[0]||A[1]))&&(o+=T^_>=0?1:-1)}if(!v++)break;d=m,h=x,g=b,f=e}}return(i<-Te||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&t&&n.push(n.pop().concat(n.shift())),l.push(n.filter($n))}return u}}function $n(e){return e.length>1}function Kn(){var e,t=[];return{lineStart:function(){t.push(e=[])},point:function(t,n){e.push([t,n])},lineEnd:E,buffer:function(){var n=t;return t=[],e=null,n},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function er(e,t){return((e=e.x)[0]<0?e[1]-Ce-Te:Ce-e[1])-((t=t.x)[0]<0?t[1]-Ce-Te:Ce-t[1])}var tr=Qn(Yn,(function(e){var t,n=NaN,r=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var l=i>0?Ae:-Ae,s=y(i-n);y(s-Ae)0?Ce:-Ce),e.point(a,r),e.lineEnd(),e.lineStart(),e.point(l,r),e.point(i,r),t=0):a!==l&&s>=Ae&&(y(n-a)Te?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(n)-Math.sin(r)*(a=Math.cos(t))*Math.sin(e))/(a*i*o)):(t+r)/2}(n,r,i,o),e.point(a,r),e.lineEnd(),e.lineStart(),e.point(l,r),t=0),e.point(n=i,r=o),a=l},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}),(function(e,t,n,r){var a;if(null==e)a=n*Ce,r.point(-Ae,a),r.point(0,a),r.point(Ae,a),r.point(Ae,0),r.point(Ae,-a),r.point(0,-a),r.point(-Ae,-a),r.point(-Ae,0),r.point(-Ae,a);else if(y(e[0]-t[0])>Te){var i=e[0]0,r=y(t)>Te;return Qn(a,(function(e){var t,l,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var p,h=[f,d],g=a(f,d),v=n?g?0:o(f,d):g?o(f+(f<0?Ae:-Ae),d):0;if(!t&&(c=s=g)&&e.lineStart(),g!==s&&(p=i(t,h),(jn(t,p)||jn(h,p))&&(h[0]+=Te,h[1]+=Te,g=a(h[0],h[1]))),g!==s)u=0,g?(e.lineStart(),p=i(h,t),e.point(p[0],p[1])):(p=i(t,h),e.point(p[0],p[1]),e.lineEnd()),t=p;else if(r&&t&&n^g){var m;v&l||!(m=i(h,t,!0))||(u=0,n?(e.lineStart(),e.point(m[0][0],m[0][1]),e.point(m[1][0],m[1][1]),e.lineEnd()):(e.point(m[1][0],m[1][1]),e.lineEnd(),e.lineStart(),e.point(m[0][0],m[0][1])))}!g||t&&jn(t,h)||e.point(h[0],h[1]),t=h,s=g,l=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(c&&s)<<1}}}),Nr(e,6*Pe),n?[0,-e]:[-Ae,e-Ae]);function a(e,n){return Math.cos(e)*Math.cos(n)>t}function i(e,n,r){var a=[1,0,0],i=En(Dn(e),Dn(n)),o=Rn(i,i),l=i[0],s=o-l*l;if(!s)return!r&&e;var c=t*o/s,u=-t*l/s,f=En(a,i),d=In(a,c);zn(d,In(i,u));var p=f,h=Rn(d,p),g=Rn(p,p),v=h*h-g*(Rn(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),x=In(p,(-h-m)/g);if(zn(x,d),x=Nn(x),!r)return x;var b,_=e[0],w=n[0],k=e[1],T=n[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-Ae)0^x[1]<(y(x[0]-_)Ae^(_<=x[0]&&x[0]<=w)){var L=In(p,(-h+m)/g);return zn(L,d),[x,Nn(L)]}}}function o(t,r){var a=n?e:Ae-e,i=0;return t<-a?i|=1:t>a&&(i|=2),r<-a?i|=4:r>a&&(i|=8),i}}function rr(e,t,n,r){return function(a){var i,o=a.a,l=a.b,s=o.x,c=o.y,u=0,f=1,d=l.x-s,p=l.y-c;if(i=e-s,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=n-s,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>u&&(u=i)}else if(d>0){if(i0)){if(i/=p,p<0){if(i0){if(i>f)return;i>u&&(u=i)}if(i=r-c,p||!(i<0)){if(i/=p,p<0){if(i>f)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:s+u*d,y:c+u*p}),f<1&&(a.b={x:s+f*d,y:c+f*p}),a}}}}}}function ar(t,n,r,a){return function(s){var c,u,f,d,p,h,g,v,m,y,x,b=s,_=Kn(),w=rr(t,n,r,a),k={point:A,lineStart:function(){k.point=L,u&&u.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){c&&(L(d,p),h&&m&&_.rejoin(),c.push(_.buffer()));k.point=A,m&&s.lineEnd()},polygonStart:function(){s=_,c=[],u=[],x=!0},polygonEnd:function(){s=b,c=e.merge(c);var n=function(e){for(var t=0,n=u.length,r=e[1],a=0;ar&&Re(c,i,e)>0&&++t:i[1]<=r&&Re(c,i,e)<0&&--t,c=i;return 0!==t}([t,a]),r=x&&n,i=c.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),T(null,null,1,s),s.lineEnd()),i&&Xn(c,o,n,T,s),s.polygonEnd()),c=u=f=null}};function T(e,o,s,c){var u=0,f=0;if(null==e||(u=i(e,s))!==(f=i(o,s))||l(e,o)<0^s>0)do{c.point(0===u||3===u?t:r,u>1?a:n)}while((u=(u+s+4)%4)!==f);else c.point(o[0],o[1])}function M(e,i){return t<=e&&e<=r&&n<=i&&i<=a}function A(e,t){M(e,t)&&s.point(e,t)}function L(e,t){var n=M(e=Math.max(-1e9,Math.min(1e9,e)),t=Math.max(-1e9,Math.min(1e9,t)));if(u&&f.push([e,t]),y)d=e,p=t,h=n,y=!1,n&&(s.lineStart(),s.point(e,t));else if(n&&m)s.point(e,t);else{var r={a:{x:g,y:v},b:{x:e,y:t}};w(r)?(m||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),n||s.lineEnd(),x=!1):n&&(s.lineStart(),s.point(e,t),x=!1)}g=e,v=t,m=n}return k};function i(e,a){return y(e[0]-t)0?0:3:y(e[0]-r)0?2:1:y(e[1]-n)0?1:0:a>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var n=i(e,1),r=i(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}}function ir(e){var t=0,n=Ae/3,r=Pr(e),a=r(t,n);return a.parallels=function(e){return arguments.length?r(t=e[0]*Ae/180,n=e[1]*Ae/180):[t/Ae*180,n/Ae*180]},a}function or(e,t){var n=Math.sin(e),r=(n+Math.sin(t))/2,a=1+n*(2*r-n),i=Math.sqrt(a)/r;function o(e,t){var n=Math.sqrt(a-2*r*Math.sin(t))/r;return[n*Math.sin(e*=r),i-n*Math.cos(e)]}return o.invert=function(e,t){var n=i-t;return[Math.atan2(e,n)/r,ze((a-(e*e+n*n)*r*r)/(2*r))]},o}e.geo.clipExtent=function(){var e,t,n,r,a,i,o={stream:function(e){return a&&(a.valid=!1),(a=i(e)).valid=!0,a},extent:function(l){return arguments.length?(i=ar(e=+l[0][0],t=+l[0][1],n=+l[1][0],r=+l[1][1]),a&&(a.valid=!1,a=null),o):[[e,t],[n,r]]}};return o.extent([[0,0],[960,500]])},(e.geo.conicEqualArea=function(){return ir(or)}).raw=or,e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},e.geo.albersUsa=function(){var t,n,r,a,i=e.geo.albers(),o=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(e,n){t=[e,n]}};function c(e){var i=e[0],o=e[1];return t=null,n(i,o),t||(r(i,o),t)||a(i,o),t}return c.invert=function(e){var t=i.scale(),n=i.translate(),r=(e[0]-n[0])/t,a=(e[1]-n[1])/t;return(a>=.12&&a<.234&&r>=-.425&&r<-.214?o:a>=.166&&a<.234&&r>=-.214&&r<-.115?l:i).invert(e)},c.stream=function(e){var t=i.stream(e),n=o.stream(e),r=l.stream(e);return{point:function(e,a){t.point(e,a),n.point(e,a),r.point(e,a)},sphere:function(){t.sphere(),n.sphere(),r.sphere()},lineStart:function(){t.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},c.precision=function(e){return arguments.length?(i.precision(e),o.precision(e),l.precision(e),c):i.precision()},c.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),l.scale(e),c.translate(i.translate())):i.scale()},c.translate=function(e){if(!arguments.length)return i.translate();var t=i.scale(),u=+e[0],f=+e[1];return n=i.translate(e).clipExtent([[u-.455*t,f-.238*t],[u+.455*t,f+.238*t]]).stream(s).point,r=o.translate([u-.307*t,f+.201*t]).clipExtent([[u-.425*t+Te,f+.12*t+Te],[u-.214*t-Te,f+.234*t-Te]]).stream(s).point,a=l.translate([u-.205*t,f+.212*t]).clipExtent([[u-.214*t+Te,f+.166*t+Te],[u-.115*t-Te,f+.234*t-Te]]).stream(s).point,c},c.scale(1070)};var lr,sr,cr,ur,fr,dr,pr={point:E,lineStart:E,lineEnd:E,polygonStart:function(){sr=0,pr.lineStart=hr},polygonEnd:function(){pr.lineStart=pr.lineEnd=pr.point=E,lr+=y(sr/2)}};function hr(){var e,t,n,r;function a(e,t){sr+=r*e-n*t,n=e,r=t}pr.point=function(i,o){pr.point=a,e=n=i,t=r=o},pr.lineEnd=function(){a(e,t)}}var gr={point:function(e,t){efr&&(fr=e);tdr&&(dr=t)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E};function vr(){var e=mr(4.5),t=[],n={point:r,lineStart:function(){n.point=a},lineEnd:o,polygonStart:function(){n.lineEnd=l},polygonEnd:function(){n.lineEnd=o,n.point=r},pointRadius:function(t){return e=mr(t),n},result:function(){if(t.length){var e=t.join("");return t=[],e}}};function r(n,r){t.push("M",n,",",r,e)}function a(e,r){t.push("M",e,",",r),n.point=i}function i(e,n){t.push("L",e,",",n)}function o(){n.point=r}function l(){t.push("Z")}return n}function mr(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}var yr,xr={point:br,lineStart:_r,lineEnd:wr,polygonStart:function(){xr.lineStart=kr},polygonEnd:function(){xr.point=br,xr.lineStart=_r,xr.lineEnd=wr}};function br(e,t){bn+=e,_n+=t,++wn}function _r(){var e,t;function n(n,r){var a=n-e,i=r-t,o=Math.sqrt(a*a+i*i);kn+=o*(e+n)/2,Tn+=o*(t+r)/2,Mn+=o,br(e=n,t=r)}xr.point=function(r,a){xr.point=n,br(e=r,t=a)}}function wr(){xr.point=br}function kr(){var e,t,n,r;function a(e,t){var a=e-n,i=t-r,o=Math.sqrt(a*a+i*i);kn+=o*(n+e)/2,Tn+=o*(r+t)/2,Mn+=o,An+=(o=r*e-n*t)*(n+e),Ln+=o*(r+t),Sn+=3*o,br(n=e,r=t)}xr.point=function(i,o){xr.point=a,br(e=n=i,t=r=o)},xr.lineEnd=function(){a(e,t)}}function Tr(e){var t=4.5,n={point:r,lineStart:function(){n.point=a},lineEnd:o,polygonStart:function(){n.lineEnd=l},polygonEnd:function(){n.lineEnd=o,n.point=r},pointRadius:function(e){return t=e,n},result:E};function r(n,r){e.moveTo(n+t,r),e.arc(n,r,t,0,Le)}function a(t,r){e.moveTo(t,r),n.point=i}function i(t,n){e.lineTo(t,n)}function o(){n.point=r}function l(){e.closePath()}return n}function Mr(e){var t=.5,n=Math.cos(30*Pe),r=16;function a(e){return(r?o:i)(e)}function i(t){return Sr(t,(function(n,r){n=e(n,r),t.point(n[0],n[1])}))}function o(t){var n,a,i,o,s,c,u,f,d,p,h,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),v.lineStart=_},polygonEnd:function(){t.polygonEnd(),v.lineStart=y}};function m(n,r){n=e(n,r),t.point(n[0],n[1])}function y(){f=NaN,v.point=x,t.lineStart()}function x(n,a){var i=Dn([n,a]),o=e(n,a);l(f,d,u,p,h,g,f=o[0],d=o[1],u=n,p=i[0],h=i[1],g=i[2],r,t),t.point(f,d)}function b(){v.point=m,t.lineEnd()}function _(){y(),v.point=w,v.lineEnd=k}function w(e,t){x(n=e,t),a=f,i=d,o=p,s=h,c=g,v.point=x}function k(){l(f,d,u,p,h,g,a,i,n,o,s,c,r,t),v.lineEnd=b,b()}return v}function l(r,a,i,o,s,c,u,f,d,p,h,g,v,m){var x=u-r,b=f-a,_=x*x+b*b;if(_>4*t&&v--){var w=o+p,k=s+h,T=c+g,M=Math.sqrt(w*w+k*k+T*T),A=Math.asin(T/=M),L=y(y(T)-1)t||y((x*O+b*D)/_-.5)>.3||o*p+s*h+c*g0&&16,a):Math.sqrt(t)},a}function Ar(e){var t=Mr((function(t,n){return e([t*Oe,n*Oe])}));return function(e){return Or(t(e))}}function Lr(e){this.stream=e}function Sr(e,t){return{point:t,sphere:function(){e.sphere()},lineStart:function(){e.lineStart()},lineEnd:function(){e.lineEnd()},polygonStart:function(){e.polygonStart()},polygonEnd:function(){e.polygonEnd()}}}function Cr(e){return Pr((function(){return e}))()}function Pr(t){var n,r,a,i,o,l,s=Mr((function(e,t){return[(e=n(e,t))[0]*c+i,o-e[1]*c]})),c=150,u=480,f=250,d=0,p=0,h=0,g=0,v=0,m=tr,y=P,x=null,b=null;function _(e){return[(e=a(e[0]*Pe,e[1]*Pe))[0]*c+i,o-e[1]*c]}function w(e){return(e=a.invert((e[0]-i)/c,(o-e[1])/c))&&[e[0]*Oe,e[1]*Oe]}function k(){a=Zn(r=Er(h,g,v),n);var e=n(d,p);return i=u-e[0]*c,o=f+e[1]*c,T()}function T(){return l&&(l.valid=!1,l=null),_}return _.stream=function(e){return l&&(l.valid=!1),(l=Or(m(r,s(y(e))))).valid=!0,l},_.clipAngle=function(e){return arguments.length?(m=null==e?(x=e,tr):nr((x=+e)*Pe),T()):x},_.clipExtent=function(e){return arguments.length?(b=e,y=e?ar(e[0][0],e[0][1],e[1][0],e[1][1]):P,T()):b},_.scale=function(e){return arguments.length?(c=+e,k()):c},_.translate=function(e){return arguments.length?(u=+e[0],f=+e[1],k()):[u,f]},_.center=function(e){return arguments.length?(d=e[0]%360*Pe,p=e[1]%360*Pe,k()):[d*Oe,p*Oe]},_.rotate=function(e){return arguments.length?(h=e[0]%360*Pe,g=e[1]%360*Pe,v=e.length>2?e[2]%360*Pe:0,k()):[h*Oe,g*Oe,v*Oe]},e.rebind(_,s,"precision"),function(){return n=t.apply(this,arguments),_.invert=n.invert&&w,k()}}function Or(e){return Sr(e,(function(t,n){e.point(t*Pe,n*Pe)}))}function Dr(e,t){return[e,t]}function Rr(e,t){return[e>Ae?e-Le:e<-Ae?e+Le:e,t]}function Er(e,t,n){return e?t||n?Zn(Ir(e),Fr(t,n)):Ir(e):t||n?Fr(t,n):Rr}function zr(e){return function(t,n){return[(t+=e)>Ae?t-Le:t<-Ae?t+Le:t,n]}}function Ir(e){var t=zr(e);return t.invert=zr(-e),t}function Fr(e,t){var n=Math.cos(e),r=Math.sin(e),a=Math.cos(t),i=Math.sin(t);function o(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*n+l*r;return[Math.atan2(s*a-u*i,l*n-c*r),ze(u*a+s*i)]}return o.invert=function(e,t){var o=Math.cos(t),l=Math.cos(e)*o,s=Math.sin(e)*o,c=Math.sin(t),u=c*a-s*i;return[Math.atan2(s*a+c*i,l*n+u*r),ze(u*n-l*r)]},o}function Nr(e,t){var n=Math.cos(e),r=Math.sin(e);return function(a,i,o,l){var s=o*t;null!=a?(a=jr(n,a),i=jr(n,i),(o>0?ai)&&(a+=o*Le)):(a=e+o*Le,i=e-.5*s);for(var c,u=a;o>0?u>i:u2?e[2]*Pe:0),t.invert=function(t){return(t=e.invert(t[0]*Pe,t[1]*Pe))[0]*=Oe,t[1]*=Oe,t},t},Rr.invert=Dr,e.geo.circle=function(){var e,t,n=[0,0],r=6;function a(){var e="function"==typeof n?n.apply(this,arguments):n,r=Er(-e[0]*Pe,-e[1]*Pe,0).invert,a=[];return t(null,null,1,{point:function(e,t){a.push(e=r(e,t)),e[0]*=Oe,e[1]*=Oe}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(e){return arguments.length?(n=e,a):n},a.angle=function(n){return arguments.length?(t=Nr((e=+n)*Pe,r*Pe),a):e},a.precision=function(n){return arguments.length?(t=Nr(e*Pe,(r=+n)*Pe),a):r},a.angle(90)},e.geo.distance=function(e,t){var n,r=(t[0]-e[0])*Pe,a=e[1]*Pe,i=t[1]*Pe,o=Math.sin(r),l=Math.cos(r),s=Math.sin(a),c=Math.cos(a),u=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((n=f*o)*n+(n=c*u-s*f*l)*n),s*u+c*f*l)},e.geo.graticule=function(){var t,n,r,a,i,o,l,s,c,u,f,d,p=10,h=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(a/g)*g,r,g).map(f).concat(e.range(Math.ceil(s/v)*v,l,v).map(d)).concat(e.range(Math.ceil(n/p)*p,t,p).filter((function(e){return y(e%g)>Te})).map(c)).concat(e.range(Math.ceil(o/h)*h,i,h).filter((function(e){return y(e%v)>Te})).map(u))}return x.lines=function(){return b().map((function(e){return{type:"LineString",coordinates:e}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(r).reverse().slice(1),d(s).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.majorExtent(e).minorExtent(e):x.minorExtent()},x.majorExtent=function(e){return arguments.length?(a=+e[0][0],r=+e[1][0],s=+e[0][1],l=+e[1][1],a>r&&(e=a,a=r,r=e),s>l&&(e=s,s=l,l=e),x.precision(m)):[[a,s],[r,l]]},x.minorExtent=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),x.precision(m)):[[n,o],[t,i]]},x.step=function(e){return arguments.length?x.majorStep(e).minorStep(e):x.minorStep()},x.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],x):[g,v]},x.minorStep=function(e){return arguments.length?(p=+e[0],h=+e[1],x):[p,h]},x.precision=function(e){return arguments.length?(m=+e,c=Br(o,i,90),u=Hr(n,t,m),f=Br(s,l,90),d=Hr(a,r,m),x):m},x.majorExtent([[-180,-90+Te],[180,90-Te]]).minorExtent([[-180,-80-Te],[180,80+Te]])},e.geo.greatArc=function(){var t,n,r=Ur,a=qr;function i(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),n||a.apply(this,arguments)]}}return i.distance=function(){return e.geo.distance(t||r.apply(this,arguments),n||a.apply(this,arguments))},i.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,i):r},i.target=function(e){return arguments.length?(a=e,n="function"==typeof e?null:e,i):a},i.precision=function(){return arguments.length?i:0},i},e.geo.interpolate=function(e,t){return n=e[0]*Pe,r=e[1]*Pe,a=t[0]*Pe,i=t[1]*Pe,o=Math.cos(r),l=Math.sin(r),s=Math.cos(i),c=Math.sin(i),u=o*Math.cos(n),f=o*Math.sin(n),d=s*Math.cos(a),p=s*Math.sin(a),h=2*Math.asin(Math.sqrt(Fe(i-r)+o*s*Fe(a-n))),g=1/Math.sin(h),(v=h?function(e){var t=Math.sin(e*=h)*g,n=Math.sin(h-e)*g,r=n*u+t*d,a=n*f+t*p,i=n*l+t*c;return[Math.atan2(a,r)*Oe,Math.atan2(i,Math.sqrt(r*r+a*a))*Oe]}:function(){return[n*Oe,r*Oe]}).distance=h,v;var n,r,a,i,o,l,s,c,u,f,d,p,h,g,v},e.geo.length=function(t){return yr=0,e.geo.stream(t,Vr),yr};var Vr={sphere:E,point:E,lineStart:function(){var e,t,n;function r(r,a){var i=Math.sin(a*=Pe),o=Math.cos(a),l=y((r*=Pe)-e),s=Math.cos(l);yr+=Math.atan2(Math.sqrt((l=o*Math.sin(l))*l+(l=n*i-t*o*s)*l),t*i+n*o*s),e=r,t=i,n=o}Vr.point=function(a,i){e=a*Pe,t=Math.sin(i*=Pe),n=Math.cos(i),Vr.point=r},Vr.lineEnd=function(){Vr.point=Vr.lineEnd=E}},lineEnd:E,polygonStart:E,polygonEnd:E};function Gr(e,t){function n(t,n){var r=Math.cos(t),a=Math.cos(n),i=e(r*a);return[i*a*Math.sin(t),i*Math.sin(n)]}return n.invert=function(e,n){var r=Math.sqrt(e*e+n*n),a=t(r),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(e*i,r*o),Math.asin(r&&n*i/r)]},n}var Zr=Gr((function(e){return Math.sqrt(2/(1+e))}),(function(e){return 2*Math.asin(e/2)}));(e.geo.azimuthalEqualArea=function(){return Cr(Zr)}).raw=Zr;var Yr=Gr((function(e){var t=Math.acos(e);return t&&t/Math.sin(t)}),P);function Xr(e,t){var n=Math.cos(e),r=function(e){return Math.tan(Ae/4+e/2)},a=e===t?Math.sin(e):Math.log(n/Math.cos(t))/Math.log(r(t)/r(e)),i=n*Math.pow(r(e),a)/a;if(!a)return Qr;function o(e,t){i>0?t<-Ce+Te&&(t=-Ce+Te):t>Ce-Te&&(t=Ce-Te);var n=i/Math.pow(r(t),a);return[n*Math.sin(a*e),i-n*Math.cos(a*e)]}return o.invert=function(e,t){var n=i-t,r=De(a)*Math.sqrt(e*e+n*n);return[Math.atan2(e,n)/a,2*Math.atan(Math.pow(i/r,1/a))-Ce]},o}function Wr(e,t){var n=Math.cos(e),r=e===t?Math.sin(e):(n-Math.cos(t))/(t-e),a=n/r+e;if(y(r)1&&Re(e[n[r-2]],e[n[r-1]],e[a])<=0;)--r;n[r++]=a}return n.slice(0,r)}function ia(e,t){return e[0]-t[0]||e[1]-t[1]}(e.geo.stereographic=function(){return Cr(ea)}).raw=ea,ta.invert=function(e,t){return[-t,2*Math.atan(Math.exp(e))-Ce]},(e.geo.transverseMercator=function(){var e=$r(ta),t=e.center,n=e.rotate;return e.center=function(e){return e?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return e?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90])}).raw=ta,e.geom={},e.geom.hull=function(e){var t=na,n=ra;if(arguments.length)return r(e);function r(e){if(e.length<3)return[];var r,a=ht(t),i=ht(n),o=e.length,l=[],s=[];for(r=0;r=0;--r)p.push(e[l[c[r]][2]]);for(r=+f;rTe)l=l.L;else{if(!((a=i-ka(l,o))>Te)){r>-Te?(t=l.P,n=l):a>-Te?(t=l,n=l.N):t=n=l;break}if(!l.R){t=l;break}l=l.R}var s=ya(e);if(da.insert(t,s),t||n){if(t===n)return Sa(t),n=ya(t.site),da.insert(s,n),s.edge=n.edge=Oa(t.site,s.site),La(t),void La(n);if(n){Sa(t),Sa(n);var c=t.site,u=c.x,f=c.y,d=e.x-u,p=e.y-f,h=n.site,g=h.x-u,v=h.y-f,m=2*(d*v-p*g),y=d*d+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+u,y:(d*x-g*y)/m+f};Ra(n.edge,c,h,b),s.edge=Oa(c,e,null,b),n.edge=Oa(e,h,null,b),La(t),La(n)}else s.edge=Oa(t.site,s.site)}}function wa(e,t){var n=e.site,r=n.x,a=n.y,i=a-t;if(!i)return r;var o=e.P;if(!o)return-1/0;var l=(n=o.site).x,s=n.y,c=s-t;if(!c)return l;var u=l-r,f=1/i-1/c,d=u/c;return f?(-d+Math.sqrt(d*d-2*f*(u*u/(-2*c)-s+c/2+a-i/2)))/f+r:(r+l)/2}function ka(e,t){var n=e.N;if(n)return wa(n,t);var r=e.site;return r.y===t?r.x:1/0}function Ta(e){this.site=e,this.edges=[]}function Ma(e,t){return t.angle-e.angle}function Aa(){Ia(this),this.x=this.y=this.arc=this.site=this.cy=null}function La(e){var t=e.P,n=e.N;if(t&&n){var r=t.site,a=e.site,i=n.site;if(r!==i){var o=a.x,l=a.y,s=r.x-o,c=r.y-l,u=i.x-o,f=2*(s*(v=i.y-l)-c*u);if(!(f>=-Me)){var d=s*s+c*c,p=u*u+v*v,h=(v*d-c*p)/f,g=(s*p-u*d)/f,v=g+l,m=va.pop()||new Aa;m.arc=e,m.site=a,m.x=h+o,m.y=v+Math.sqrt(h*h+g*g),m.cy=v,e.circle=m;for(var y=null,x=ha._;x;)if(m.y=l)return;if(d>h){if(i){if(i.y>=c)return}else i={x:v,y:s};n={x:v,y:c}}else{if(i){if(i.y1)if(d>h){if(i){if(i.y>=c)return}else i={x:(s-a)/r,y:s};n={x:(c-a)/r,y:c}}else{if(i){if(i.y=l)return}else i={x:o,y:r*o+a};n={x:l,y:r*l+a}}else{if(i){if(i.xTe||y(a-n)>Te)&&(l.splice(o,0,new Ea(Da(i.site,u,y(r-f)Te?{x:f,y:y(t-f)Te?{x:y(n-h)Te?{x:d,y:y(t-d)Te?{x:y(n-p)=n&&c.x<=a&&c.y>=r&&c.y<=o?[[n,o],[a,o],[a,r],[n,r]]:[]).point=e[l]})),t}function l(e){return e.map((function(e,t){return{x:Math.round(r(e,t)/Te)*Te,y:Math.round(a(e,t)/Te)*Te,i:t}}))}return o.links=function(e){return Ba(l(e)).edges.filter((function(e){return e.l&&e.r})).map((function(t){return{source:e[t.l.i],target:e[t.r.i]}}))},o.triangles=function(e){var t=[];return Ba(l(e)).cells.forEach((function(n,r){for(var a,i,o,l,s=n.site,c=n.edges.sort(Ma),u=-1,f=c.length,d=c[f-1].edge,p=d.l===s?d.r:d.l;++ui||f>o||d=_)<<1|t>=b,k=w+4;wi&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(n=n[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,s.push({i:o,x:Wa(n,r)})),i=$a.lastIndex;return ig&&(g=s.x),s.y>v&&(v=s.y),c.push(s.x),u.push(s.y);else for(f=0;fg&&(g=b),_>v&&(v=_),c.push(b),u.push(_)}var w=g-p,k=v-h;function T(e,t,n,r,a,i,o,l){if(!isNaN(n)&&!isNaN(r))if(e.leaf){var s=e.x,c=e.y;if(null!=s)if(y(s-n)+y(c-r)<.01)M(e,t,n,r,a,i,o,l);else{var u=e.point;e.x=e.y=e.point=null,M(e,u,s,c,a,i,o,l),M(e,t,n,r,a,i,o,l)}else e.x=n,e.y=r,e.point=t}else M(e,t,n,r,a,i,o,l)}function M(e,t,n,r,a,i,o,l){var s=.5*(a+o),c=.5*(i+l),u=n>=s,f=r>=c,d=f<<1|u;e.leaf=!1,u?a=s:o=s,f?i=c:l=c,T(e=e.nodes[d]||(e.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),t,n,r,a,i,o,l)}w>k?v=h+w:g=p+k;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(e){T(A,e,+m(e,++f),+x(e,f),p,h,g,v)},visit:function(e){Ga(e,A,p,h,g,v)},find:function(e){return Za(A,e[0],e[1],p,h,g,v)}};if(f=-1,null==t){for(;++f=0&&!(r=e.interpolators[a](t,n)););return r}function ei(e,t){var n,r=[],a=[],i=e.length,o=t.length,l=Math.min(e.length,t.length);for(n=0;n=1?1:e(t)}}function ii(e){return function(t){return 1-e(1-t)}}function oi(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function li(e){return e*e}function si(e){return e*e*e}function ci(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function ui(e){return 1-Math.cos(e*Ce)}function fi(e){return Math.pow(2,10*(e-1))}function di(e){return 1-Math.sqrt(1-e*e)}function pi(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function hi(e,t){return t-=e,function(n){return Math.round(e+t*n)}}function gi(e){var t,n,r,a=[e.a,e.b],i=[e.c,e.d],o=mi(a),l=vi(a,i),s=mi(((t=i)[0]+=(r=-l)*(n=a)[0],t[1]+=r*n[1],t))||0;a[0]*i[1]=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):"in";return r=ni.get(r)||ti,ai((a=ri.get(a)||P)(r.apply(null,n.call(arguments,1))))},e.interpolateHcl=function(t,n){t=e.hcl(t),n=e.hcl(n);var r=t.h,a=t.c,i=t.l,o=n.h-r,l=n.c-a,s=n.l-i;isNaN(l)&&(l=0,a=isNaN(a)?n.c:a);isNaN(o)?(o=0,r=isNaN(r)?n.h:r):o>180?o-=360:o<-180&&(o+=360);return function(e){return Xe(r+o*e,a+l*e,i+s*e)+""}},e.interpolateHsl=function(t,n){t=e.hsl(t),n=e.hsl(n);var r=t.h,a=t.s,i=t.l,o=n.h-r,l=n.s-a,s=n.l-i;isNaN(l)&&(l=0,a=isNaN(a)?n.s:a);isNaN(o)?(o=0,r=isNaN(r)?n.h:r):o>180?o-=360:o<-180&&(o+=360);return function(e){return Ge(r+o*e,a+l*e,i+s*e)+""}},e.interpolateLab=function(t,n){t=e.lab(t),n=e.lab(n);var r=t.l,a=t.a,i=t.b,o=n.l-r,l=n.a-a,s=n.b-i;return function(e){return $e(r+o*e,a+l*e,i+s*e)+""}},e.interpolateRound=hi,e.transform=function(t){var n=a.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(e){if(null!=e){n.setAttribute("transform",e);var t=n.transform.baseVal.consolidate()}return new gi(t?t.matrix:yi)})(t)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(e){return e.length?e.pop()+",":""}function bi(t,n){var r=[],a=[];return t=e.transform(t),n=e.transform(n),function(e,t,n,r){if(e[0]!==t[0]||e[1]!==t[1]){var a=n.push("translate(",null,",",null,")");r.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else(t[0]||t[1])&&n.push("translate("+t+")")}(t.translate,n.translate,r,a),function(e,t,n,r){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),r.push({i:n.push(xi(n)+"rotate(",null,")")-2,x:Wa(e,t)})):t&&n.push(xi(n)+"rotate("+t+")")}(t.rotate,n.rotate,r,a),function(e,t,n,r){e!==t?r.push({i:n.push(xi(n)+"skewX(",null,")")-2,x:Wa(e,t)}):t&&n.push(xi(n)+"skewX("+t+")")}(t.skew,n.skew,r,a),function(e,t,n,r){if(e[0]!==t[0]||e[1]!==t[1]){var a=n.push(xi(n)+"scale(",null,",",null,")");r.push({i:a-4,x:Wa(e[0],t[0])},{i:a-2,x:Wa(e[1],t[1])})}else 1===t[0]&&1===t[1]||n.push(xi(n)+"scale("+t+")")}(t.scale,n.scale,r,a),t=n=null,function(e){for(var t,n=-1,i=a.length;++n0?r=e:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:r=0})):e>0&&(s.start({type:"start",alpha:r=e}),t=wt(l.tick)),l):r},l.start=function(){var e,t,n,r=m.length,s=y.length,u=c[0],h=c[1];for(e=0;e=0;)n.push(a[r])}function Ei(e,t){for(var n=[e],r=[];null!=(e=n.pop());)if(r.push(e),(i=e.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[s]),u.parent=i,u.depth=i.depth+1;n&&(i.value=0),i.children=c}else n&&(i.value=+n.call(r,i,i.depth)||0),delete i.children;return Ei(a,(function(t){var r,a;e&&(r=t.children)&&r.sort(e),n&&(a=t.parent)&&(a.value+=t.value)})),l}return r.sort=function(t){return arguments.length?(e=t,r):e},r.children=function(e){return arguments.length?(t=e,r):t},r.value=function(e){return arguments.length?(n=e,r):n},r.revalue=function(e){return n&&(Ri(e,(function(e){e.children&&(e.value=0)})),Ei(e,(function(e){var t;e.children||(e.value=+n.call(r,e,e.depth)||0),(t=e.parent)&&(t.value+=e.value)}))),e},r},e.layout.partition=function(){var t=e.layout.hierarchy(),n=[1,1];function r(e,r){var a=t.call(this,e,r);return function e(t,n,r,a){var i=t.children;if(t.x=n,t.y=t.depth*a,t.dx=r,t.dy=a,i&&(o=i.length)){var o,l,s,c=-1;for(r=t.value?r/t.value:0;++cl&&(l=r),o.push(r)}for(n=0;na&&(r=n,a=t);return r}function Xi(e){return e.reduce(Wi,0)}function Wi(e,t){return e+t[1]}function Ji(e,t){return Qi(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Qi(e,t){for(var n=-1,r=+e[0],a=(e[1]-r)/t,i=[];++n<=t;)i[n]=a*n+r;return i}function $i(t){return[e.min(t),e.max(t)]}function Ki(e,t){return e.value-t.value}function eo(e,t){var n=e._pack_next;e._pack_next=t,t._pack_prev=e,t._pack_next=n,n._pack_prev=t}function to(e,t){e._pack_next=t,t._pack_prev=e}function no(e,t){var n=t.x-e.x,r=t.y-e.y,a=e.r+t.r;return.999*a*a>n*n+r*r}function ro(e){if((t=e.children)&&(s=t.length)){var t,n,r,a,i,o,l,s,c=1/0,u=-1/0,f=1/0,d=-1/0;if(t.forEach(ao),(n=t[0]).x=-n.r,n.y=0,x(n),s>1&&((r=t[1]).x=r.r,r.y=0,x(r),s>2))for(oo(n,r,a=t[2]),x(a),eo(n,a),n._pack_prev=a,eo(a,r),r=n._pack_next,i=3;i0)for(o=-1;++o=f[0]&&s<=f[1]&&((l=c[e.bisect(d,s,1,h)-1]).y+=g,l.push(i[o]));return c}return i.value=function(e){return arguments.length?(n=e,i):n},i.range=function(e){return arguments.length?(r=ht(e),i):r},i.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return Qi(t,e)}:ht(e),i):a},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},e.layout.pack=function(){var t,n=e.layout.hierarchy().sort(Ki),r=0,a=[1,1];function i(e,i){var o=n.call(this,e,i),l=o[0],s=a[0],c=a[1],u=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(l.x=l.y=0,Ei(l,(function(e){e.r=+u(e.value)})),Ei(l,ro),r){var f=r*(t?1:Math.max(2*l.r/s,2*l.r/c))/2;Ei(l,(function(e){e.r+=f})),Ei(l,ro),Ei(l,(function(e){e.r-=f}))}return function e(t,n,r,a){var i=t.children;if(t.x=n+=a*t.x,t.y=r+=a*t.y,t.r*=a,i)for(var o=-1,l=i.length;++op.x&&(p=e),e.depth>h.depth&&(h=e)}));var g=n(d,p)/2-d.x,v=r[0]/(p.x+n(p,d)/2+g),m=r[1]/(h.depth||1);Ri(u,(function(e){e.x=(e.x+g)*v,e.y=e.depth*m}))}return c}function o(e){var t=e.children,r=e.parent.children,a=e.i?r[e.i-1]:null;if(t.length){!function(e){var t,n=0,r=0,a=e.children,i=a.length;for(;--i>=0;)(t=a[i]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(e);var i=(t[0].z+t[t.length-1].z)/2;a?(e.z=a.z+n(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+n(e._,a._));e.parent.A=function(e,t,r){if(t){for(var a,i=e,o=e,l=t,s=i.parent.children[0],c=i.m,u=o.m,f=l.m,d=s.m;l=co(l),i=so(i),l&&i;)s=so(s),(o=co(o)).a=e,(a=l.z+f-i.z-c+n(l._,i._))>0&&(uo(fo(l,e,r),e,a),c+=a,u+=a),f+=l.m,c+=i.m,d+=s.m,u+=o.m;l&&!co(o)&&(o.t=l,o.m+=f-u),i&&!so(s)&&(s.t=i,s.m+=c-d,r=e)}return r}(e,a,e.parent.A||r[0])}function l(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=r[0],e.y=e.depth*r[1]}return i.separation=function(e){return arguments.length?(n=e,i):n},i.size=function(e){return arguments.length?(a=null==(r=e)?s:null,i):a?null:r},i.nodeSize=function(e){return arguments.length?(a=null==(r=e)?null:s,i):a?r:null},Di(i,t)},e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),n=lo,r=[1,1],a=!1;function i(i,o){var l,s=t.call(this,i,o),c=s[0],u=0;Ei(c,(function(t){var r=t.children;r&&r.length?(t.x=function(e){return e.reduce((function(e,t){return e+t.x}),0)/e.length}(r),t.y=function(t){return 1+e.max(t,(function(e){return e.y}))}(r)):(t.x=l?u+=n(t,l):0,t.y=0,l=t)}));var f=function e(t){var n=t.children;return n&&n.length?e(n[0]):t}(c),d=function e(t){var n,r=t.children;return r&&(n=r.length)?e(r[n-1]):t}(c),p=f.x-n(f,d)/2,h=d.x+n(d,f)/2;return Ei(c,a?function(e){e.x=(e.x-c.x)*r[0],e.y=(c.y-e.y)*r[1]}:function(e){e.x=(e.x-p)/(h-p)*r[0],e.y=(1-(c.y?e.y/c.y:1))*r[1]}),s}return i.separation=function(e){return arguments.length?(n=e,i):n},i.size=function(e){return arguments.length?(a=null==(r=e),i):a?null:r},i.nodeSize=function(e){return arguments.length?(a=null!=(r=e),i):a?r:null},Di(i,t)},e.layout.treemap=function(){var t,n=e.layout.hierarchy(),r=Math.round,a=[1,1],i=null,o=po,l=!1,s="squarify",c=.5*(1+Math.sqrt(5));function u(e,t){for(var n,r,a=-1,i=e.length;++a0;)l.push(n=c[a-1]),l.area+=n.area,"squarify"!==s||(r=p(l,g))<=d?(c.pop(),d=r):(l.area-=l.pop().area,h(l,g,i,!1),g=Math.min(i.dx,i.dy),l.length=l.area=0,d=1/0);l.length&&(h(l,g,i,!0),l.length=l.area=0),t.forEach(f)}}function d(e){var t=e.children;if(t&&t.length){var n,r=o(e),a=t.slice(),i=[];for(u(a,r.dx*r.dy/e.value),i.area=0;n=a.pop();)i.push(n),i.area+=n.area,null!=n.z&&(h(i,n.z?r.dx:r.dy,r,!a.length),i.length=i.area=0);t.forEach(d)}}function p(e,t){for(var n,r=e.area,a=0,i=1/0,o=-1,l=e.length;++oa&&(a=n));return t*=t,(r*=r)?Math.max(t*a*c/r,r/(t*i*c)):1/0}function h(e,t,n,a){var i,o=-1,l=e.length,s=n.x,c=n.y,u=t?r(e.area/t):0;if(t==n.dx){for((a||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++o1);return e+t*n*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=e.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(e){return function(){for(var t=0,n=0;n2?_o:mo,l=a?wi:_i;return i=e(t,n,l,r),o=e(n,t,l,Ka),s}function s(e){return i(e)}return s.invert=function(e){return o(e)},s.domain=function(e){return arguments.length?(t=e.map(Number),l()):t},s.range=function(e){return arguments.length?(n=e,l()):n},s.rangeRound=function(e){return s.range(e).interpolate(hi)},s.clamp=function(e){return arguments.length?(a=e,l()):a},s.interpolate=function(e){return arguments.length?(r=e,l()):r},s.ticks=function(e){return Mo(t,e)},s.tickFormat=function(e,n){return Ao(t,e,n)},s.nice=function(e){return ko(t,e),l()},s.copy=function(){return e(t,n,r,a)},l()}([0,1],[0,1],Ka,!1)};var Lo={s:1,g:1,p:1,r:1,e:1};function So(e){return-Math.floor(Math.log(e)/Math.LN10+.01)}e.scale.log=function(){return function t(n,r,a,i){function o(e){return(a?Math.log(e<0?0:e):-Math.log(e>0?0:-e))/Math.log(r)}function l(e){return a?Math.pow(r,e):-Math.pow(r,-e)}function s(e){return n(o(e))}return s.invert=function(e){return l(n.invert(e))},s.domain=function(e){return arguments.length?(a=e[0]>=0,n.domain((i=e.map(Number)).map(o)),s):i},s.base=function(e){return arguments.length?(r=+e,n.domain(i.map(o)),s):r},s.nice=function(){var e=yo(i.map(o),a?Math:Po);return n.domain(e),i=e.map(l),s},s.ticks=function(){var e=go(i),t=[],n=e[0],s=e[1],c=Math.floor(o(n)),u=Math.ceil(o(s)),f=r%1?2:r;if(isFinite(u-c)){if(a){for(;c0;d--)t.push(l(c)*d);for(c=0;t[c]s;u--);t=t.slice(c,u)}return t},s.tickFormat=function(t,n){if(!arguments.length)return Co;arguments.length<2?n=Co:"function"!=typeof n&&(n=e.format(n));var a=Math.max(1,r*t/s.ticks().length);return function(e){var t=e/l(Math.round(o(e)));return t*r0?a[e-1]:n[0],ef?0:1;if(c=Se)return s(c,p)+(l?s(l,1-p):"")+"Z";var h,g,v,m,y,x,b,_,w,k,T,M,A=0,L=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=r===Fo?Math.sqrt(l*l+c*c):+r.apply(this,arguments),p||(L*=-1),c&&(L=ze(v/c*Math.sin(m))),l&&(A=ze(v/l*Math.sin(m)))),c){y=c*Math.cos(u+L),x=c*Math.sin(u+L),b=c*Math.cos(f-L),_=c*Math.sin(f-L);var C=Math.abs(f-u-2*L)<=Ae?0:1;if(L&&qo(y,x,b,_)===p^C){var P=(u+f)/2;y=c*Math.cos(P),x=c*Math.sin(P),b=_=null}}else y=x=0;if(l){w=l*Math.cos(f-A),k=l*Math.sin(f-A),T=l*Math.cos(u+A),M=l*Math.sin(u+A);var O=Math.abs(u-f+2*A)<=Ae?0:1;if(A&&qo(w,k,T,M)===1-p^O){var D=(u+f)/2;w=l*Math.cos(D),k=l*Math.sin(D),T=M=null}}else w=k=0;if(d>Te&&(h=Math.min(Math.abs(c-l)/2,+n.apply(this,arguments)))>.001){g=l0?0:1}function Vo(e,t,n,r,a){var i=e[0]-t[0],o=e[1]-t[1],l=(a?r:-r)/Math.sqrt(i*i+o*o),s=l*o,c=-l*i,u=e[0]+s,f=e[1]+c,d=t[0]+s,p=t[1]+c,h=(u+d)/2,g=(f+p)/2,v=d-u,m=p-f,y=v*v+m*m,x=n-r,b=u*p-d*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,k=(-b*v-m*_)/y,T=(b*m+v*_)/y,M=(-b*v+m*_)/y,A=w-h,L=k-g,S=T-h,C=M-g;return A*A+L*L>S*S+C*C&&(w=T,k=M),[[w-s,k-c],[w*n/x,k*n/x]]}function Go(e){var t=na,n=ra,r=Yn,a=Yo,i=a.key,o=.7;function l(i){var l,s=[],c=[],u=-1,f=i.length,d=ht(t),p=ht(n);function h(){s.push("M",a(e(c),o))}for(;++u1&&a.push("H",r[0]);return a.join("")},"step-before":Wo,"step-after":Jo,basis:Ko,"basis-open":function(e){if(e.length<4)return Yo(e);var t,n=[],r=-1,a=e.length,i=[0],o=[0];for(;++r<3;)t=e[r],i.push(t[0]),o.push(t[1]);n.push(el(rl,i)+","+el(rl,o)),--r;for(;++r9&&(a=3*t/Math.sqrt(a),o[l]=a*n,o[l+1]=a*r));l=-1;for(;++l<=s;)a=(e[Math.min(s,l+1)][0]-e[Math.max(0,l-1)][0])/(6*(1+o[l]*o[l])),i.push([a||0,o[l]*a||0]);return i}(e))}});function Yo(e){return e.length>1?e.join("L"):e+"Z"}function Xo(e){return e.join("L")+"Z"}function Wo(e){for(var t=0,n=e.length,r=e[0],a=[r[0],",",r[1]];++t1){l=t[1],i=e[s],s++,r+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-l[0])+","+(i[1]-l[1])+","+i[0]+","+i[1];for(var c=2;cAe)+",1 "+t}function s(e,t,n,r){return"Q 0,0 "+r}return i.radius=function(e){return arguments.length?(n=ht(e),i):n},i.source=function(t){return arguments.length?(e=ht(t),i):e},i.target=function(e){return arguments.length?(t=ht(e),i):t},i.startAngle=function(e){return arguments.length?(r=ht(e),i):r},i.endAngle=function(e){return arguments.length?(a=ht(e),i):a},i},e.svg.diagonal=function(){var e=Ur,t=qr,n=cl;function r(r,a){var i=e.call(this,r,a),o=t.call(this,r,a),l=(i.y+o.y)/2,s=[i,{x:i.x,y:l},{x:o.x,y:l},o];return"M"+(s=s.map(n))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return r.source=function(t){return arguments.length?(e=ht(t),r):e},r.target=function(e){return arguments.length?(t=ht(e),r):t},r.projection=function(e){return arguments.length?(n=e,r):n},r},e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),n=cl,r=t.projection;return t.projection=function(e){return arguments.length?r(ul(n=e)):n},t},e.svg.symbol=function(){var e=dl,t=fl;function n(n,r){return(hl.get(e.call(this,n,r))||pl)(t.call(this,n,r))}return n.type=function(t){return arguments.length?(e=ht(t),n):e},n.size=function(e){return arguments.length?(t=ht(e),n):t},n};var hl=e.map({circle:pl,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vl)),n=t*vl;return"M0,"+-t+"L"+n+",0 0,"+t+" "+-n+",0Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/gl),n=t*gl/2;return"M0,"+n+"L"+t+","+-n+" "+-t+","+-n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/gl),n=t*gl/2;return"M0,"+-n+"L"+t+","+n+" "+-t+","+n+"Z"}});e.svg.symbolTypes=hl.keys();var gl=Math.sqrt(3),vl=Math.tan(30*Pe);Z.transition=function(e){for(var t,n,r=bl||++kl,a=Al(e),i=[],o=_l||{time:Date.now(),ease:ci,delay:0,duration:250},l=-1,s=this.length;++l0;)c[--d].call(e,o);if(i>=1)return f.event&&f.event.end.call(e,e.__data__,t),--u.count?delete u[r]:delete e[n],1}f||(i=a.time,o=wt((function(e){var t=f.delay;if(o.t=t+i,t<=e)return d(e-t);o.c=d}),0,i),f=u[r]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:t},a=null,++u.count)}wl.call=Z.call,wl.empty=Z.empty,wl.node=Z.node,wl.size=Z.size,e.transition=function(t,n){return t&&t.transition?bl?t.transition(n):t:e.selection().transition(t)},e.transition.prototype=wl,wl.select=function(e){var t,n,r,a=this.id,i=this.namespace,o=[];e=Y(e);for(var l=-1,s=this.length;++lrect,.s>rect").attr("width",l[1]-l[0])}function g(e){e.select(".extent").attr("y",s[0]),e.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,m=this,y=e.select(e.event.target),x=r.of(m,arguments),b=e.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,k=!/^(e|w)$/.test(_)&&i,T=y.classed("extent"),M=be(m),A=e.mouse(m),L=e.select(o(m)).on("keydown.brush",P).on("keyup.brush",O);if(e.event.changedTouches?L.on("touchmove.brush",D).on("touchend.brush",E):L.on("mousemove.brush",D).on("mouseup.brush",E),b.interrupt().selectAll("*").interrupt(),T)A[0]=l[0]-A[0],A[1]=s[0]-A[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[l[1-S]-A[0],s[1-C]-A[1]],A[0]=l[S],A[1]=s[C]}else e.event.altKey&&(f=A.slice());function P(){32==e.event.keyCode&&(T||(f=null,A[0]-=l[1],A[1]-=s[1],T=2),F())}function O(){32==e.event.keyCode&&2==T&&(A[0]+=l[1],A[1]+=s[1],T=0,F())}function D(){var t=e.mouse(m),n=!1;v&&(t[0]+=v[0],t[1]+=v[1]),T||(e.event.altKey?(f||(f=[(l[0]+l[1])/2,(s[0]+s[1])/2]),A[0]=l[+(t[0]1?{floor:function(t){for(;l(t=e.floor(t));)t=jl(t-1);return t},ceil:function(t){for(;l(t=e.ceil(t));)t=jl(+t+1);return t}}:e))},a.ticks=function(e,t){var n=go(a.domain()),r=null==e?i(n,10):"number"==typeof e?i(n,e):!e.range&&[{range:e},t];return r&&(e=r[0],t=r[1]),e.range(n[0],jl(+n[1]+1),t<1?1:t)},a.tickFormat=function(){return r},a.copy=function(){return Nl(t.copy(),n,r)},wo(a,t)}function jl(e){return new Date(e)}El.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fl:Il,Fl.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},Fl.toString=Il.toString,Dt.second=It((function(e){return new Rt(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(e.getTime()+1e3*Math.floor(t))}),(function(e){return e.getSeconds()})),Dt.seconds=Dt.second.range,Dt.seconds.utc=Dt.second.utc.range,Dt.minute=It((function(e){return new Rt(6e4*Math.floor(e/6e4))}),(function(e,t){e.setTime(e.getTime()+6e4*Math.floor(t))}),(function(e){return e.getMinutes()})),Dt.minutes=Dt.minute.range,Dt.minutes.utc=Dt.minute.utc.range,Dt.hour=It((function(e){var t=e.getTimezoneOffset()/60;return new Rt(36e5*(Math.floor(e/36e5-t)+t))}),(function(e,t){e.setTime(e.getTime()+36e5*Math.floor(t))}),(function(e){return e.getHours()})),Dt.hours=Dt.hour.range,Dt.hours.utc=Dt.hour.utc.range,Dt.month=It((function(e){return(e=Dt.day(e)).setDate(1),e}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e){return e.getMonth()})),Dt.months=Dt.month.range,Dt.months.utc=Dt.month.utc.range;var Bl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Hl=[[Dt.second,1],[Dt.second,5],[Dt.second,15],[Dt.second,30],[Dt.minute,1],[Dt.minute,5],[Dt.minute,15],[Dt.minute,30],[Dt.hour,1],[Dt.hour,3],[Dt.hour,6],[Dt.hour,12],[Dt.day,1],[Dt.day,2],[Dt.week,1],[Dt.month,1],[Dt.month,3],[Dt.year,1]],Ul=El.multi([[".%L",function(e){return e.getMilliseconds()}],[":%S",function(e){return e.getSeconds()}],["%I:%M",function(e){return e.getMinutes()}],["%I %p",function(e){return e.getHours()}],["%a %d",function(e){return e.getDay()&&1!=e.getDate()}],["%b %d",function(e){return 1!=e.getDate()}],["%B",function(e){return e.getMonth()}],["%Y",Yn]]),ql={range:function(t,n,r){return e.range(Math.ceil(t/r)*r,+n,r).map(jl)},floor:P,ceil:P};Hl.year=Dt.year,Dt.scale=function(){return Nl(e.scale.linear(),Hl,Ul)};var Vl=Hl.map((function(e){return[e[0].utc,e[1]]})),Gl=zl.multi([[".%L",function(e){return e.getUTCMilliseconds()}],[":%S",function(e){return e.getUTCSeconds()}],["%I:%M",function(e){return e.getUTCMinutes()}],["%I %p",function(e){return e.getUTCHours()}],["%a %d",function(e){return e.getUTCDay()&&1!=e.getUTCDate()}],["%b %d",function(e){return 1!=e.getUTCDate()}],["%B",function(e){return e.getUTCMonth()}],["%Y",Yn]]);function Zl(e){return JSON.parse(e.responseText)}function Yl(e){var t=a.createRange();return t.selectNode(a.body),t.createContextualFragment(e.responseText)}Vl.year=Dt.year.utc,Dt.scale.utc=function(){return Nl(e.scale.linear(),Vl,Gl)},e.text=gt((function(e){return e.responseText})),e.json=function(e,t){return vt(e,"application/json",Zl,t)},e.html=function(e,t){return vt(e,"text/html",Yl,t)},e.xml=gt((function(e){return e.responseXML})),"object"==typeof t&&t.exports?t.exports=e:this.d3=e}()},{}],16:[function(e,t,n){(function(r,a){(function(){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -12,10 +12,10 @@ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ -!function(e,n){"object"==typeof r&&"undefined"!=typeof t?t.exports=n():e.ES6Promise=n()}(this,(function(){"use strict";function t(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,o=void 0,l=void 0,s=function(e,t){g[i]=e,g[i+1]=t,2===(i+=2)&&(l?l(v):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},f=u.MutationObserver||u.WebKitMutationObserver,d="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(v,1)}}var g=new Array(1e3);function v(){for(var e=0;e13)&&32!==t&&133!==t&&160!==t&&5760!==t&&6158!==t&&(t<8192||t>8205)&&8232!==t&&8233!==t&&8239!==t&&8287!==t&&8288!==t&&12288!==t&&65279!==t)return!1;return!0}},{}],23:[function(e,t,r){var n={left:0,top:0};t.exports=function(e,t,r){t=t||e.currentTarget||e.srcElement,Array.isArray(r)||(r=[0,0]);var a=e.clientX||0,i=e.clientY||0,o=(l=t,l===window||l===document||l===document.body?n:l.getBoundingClientRect());var l;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],24:[function(e,t,r){t.exports=function(e){var t=[];return e.replace(a,(function(e,r,a){var o=r.toLowerCase();for(a=function(e){var t=e.match(i);return t?t.map(Number):[]}(a),"m"==o&&a.length>2&&(t.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),t.push(a);if(a.length13)&&32!==t&&133!==t&&160!==t&&5760!==t&&6158!==t&&(t<8192||t>8205)&&8232!==t&&8233!==t&&8239!==t&&8287!==t&&8288!==t&&12288!==t&&65279!==t)return!1;return!0}},{}],52:[function(e,t,n){var r={left:0,top:0};t.exports=function(e,t,n){t=t||e.currentTarget||e.srcElement,Array.isArray(n)||(n=[0,0]);var a=e.clientX||0,i=e.clientY||0,o=(l=t,l===window||l===document||l===document.body?r:l.getBoundingClientRect());var l;return n[0]=a-o.left,n[1]=i-o.top,n}},{}],53:[function(e,t,n){t.exports=function(e){var t=[];return e.replace(a,(function(e,n,a){var o=n.toLowerCase();for(a=function(e){var t=e.match(i);return t?t.map(Number):[]}(a),"m"==o&&a.length>2&&(t.push([n].concat(a.splice(0,2))),o="l",n="m"==n?"l":"L");;){if(a.length==r[o])return a.unshift(n),t.push(a);if(a.length=-e},pointBetween:function(t,r,n){var a=t[1]-r[1],i=n[0]-r[0],o=t[0]-r[0],l=n[1]-r[1],s=o*i+a*l;return!(s-e)},pointsSameX:function(t,r){return Math.abs(t[0]-r[0])e!=o-a>e&&(i-c)*(a-u)/(o-u)+c-n>e&&(l=!l),i=c,o=u}return l}};return t}},{}],28:[function(e,t,r){var n={toPolygon:function(e,t){function r(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function r(t){var r=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[r]})}for(var n=r(t[0]),a=1;a0}))}function u(e,n){var a=e.seg,i=n.seg,o=a.start,l=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var f=t.linesIntersect(o,l,c,u);if(!1===f){if(!t.pointsCollinear(o,l,c))return!1;if(t.pointsSame(o,u)||t.pointsSame(l,c))return!1;var d=t.pointsSame(o,c),p=t.pointsSame(l,u);if(d&&p)return n;var h=!d&&t.pointBetween(o,c,u),g=!p&&t.pointBetween(l,c,u);if(d)return g?s(n,l):s(e,u),n;h&&(p||(g?s(n,l):s(e,u)),s(n,o))}else 0===f.alongA&&(-1===f.alongB?s(e,c):0===f.alongB?s(e,f.pt):1===f.alongB&&s(e,u)),0===f.alongB&&(-1===f.alongA?s(n,o):0===f.alongA?s(n,f.pt):1===f.alongA&&s(n,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var e=u(d,h);if(e)return e}return!!g&&u(d,g)}r&&r.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(e)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(e)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(n.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return e?{addRegion:function(e){for(var n,a,i,o=e[e.length-1],s=0;s1)for(var r=1;r1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=P(e,360),t=P(t,100),r=P(r,100),0===t)n=a=i=r;else{var l=r<.5?r*(1+t):r+t-r*t,s=2*r-l;n=o(s,l,e+1/3),a=o(s,l,e),i=o(s,l,e-1/3)}return{r:255*n,g:255*a,b:255*i}}(t.h,s,u),f=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,h,g;return i=C(i),{ok:f,format:t.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(e,t,r){e=P(e,255),t=P(t,255),r=P(r,255);var n,a,i=l(e,t,r),s=o(e,t,r),c=(i+s)/2;if(i==s)n=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case e:n=(t-r)/u+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,a=r.s,i=r.v,o=[],l=1/t;t--;)o.push(c({h:n,s:a,v:i})),i=(i+l)%1;return o}c.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 e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,r,n,a=this.toRgb();return t=a.r/255,r=a.g/255,n=a.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=i(360*e.h),r=i(100*e.s),n=i(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[E(i(e).toString(16)),E(i(t).toString(16)),E(i(r).toString(16)),E(R(n))];if(a&&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,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*P(this._r,255))+"%",g:i(100*P(this._g,255))+"%",b:i(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*P(this._r,255))+"%, "+i(100*P(this._g,255))+"%, "+i(100*P(this._b,255))+"%)":"rgba("+i(100*P(this._r,255))+"%, "+i(100*P(this._g,255))+"%, "+i(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=c(e);r="#"+p(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));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(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(T,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(k,arguments)}},c.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:z(e[n]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),a=c(t).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(t,r){var n=c(t),a=c(r);return(e.max(n.getLuminance(),a.getLuminance())+.05)/(e.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,a,i=c.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(e,t,r){var n,a,i,o,l=null,s=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;us&&(s=n,l=c(t[u]));return c.isReadable(e,l,{level:i,size:o})||!a?l:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],r))};var L=c.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=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(L);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function P(t,r){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(r,l(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function O(e){return o(1,l(0,e))}function D(e){return parseInt(e,16)}function E(e){return 1==e.length?"0"+e:""+e}function z(e){return e<=1&&(e=100*e+"%"),e}function R(t){return e.round(255*parseFloat(t)).toString(16)}function I(e){return D(e)/255}var F,N,j,H=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",j="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+j),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+j),hsv:new RegExp("hsv"+N),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 B(e){return!!H.CSS_UNIT.exec(e)}"undefined"!=typeof t&&t.exports?t.exports=c:window.tinycolor=c}(Math)},{}],35:[function(e,t,r){!function(e,n){"object"==typeof r&&"undefined"!=typeof t?n(r):n((e=e||self).topojson=e.topojson||{})}(this,(function(e){"use strict";function t(e){return e}function r(e){if(null==e)return t;var r,n,a=e.scale[0],i=e.scale[1],o=e.translate[0],l=e.translate[1];return function(e,t){t||(r=n=0);var s=2,c=e.length,u=new Array(c);for(u[0]=(r+=e[0])*a+o,u[1]=(n+=e[1])*i+l;so&&(o=e[0]),e[1]l&&(l=e[1])}function c(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(c);break;case"Point":s(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(s)}}for(t in e.arcs.forEach((function(e){for(var t,r=-1,s=e.length;++ro&&(o=t[0]),t[1]l&&(l=t[1])})),e.objects)c(e.objects[t]);return[a,i,o,l]}function a(e,t){var r=t.id,n=t.bbox,a=null==t.properties?{}:t.properties,o=i(e,t);return null==r&&null==n?{type:"Feature",properties:a,geometry:o}:null==n?{type:"Feature",id:r,properties:a,geometry:o}:{type:"Feature",id:r,bbox:n,properties:a,geometry:o}}function i(e,t){var n=r(e.transform),a=e.arcs;function i(e,t){t.length&&t.pop();for(var r=a[e<0?~e:e],i=0,o=r.length;i1)n=s(e,t,r);else for(a=0,n=new Array(i=e.arcs.length);a1)for(var i,l,c=1,u=s(a[0]);cu&&(l=a[0],a[0]=a[c],a[c]=l,u=i);return a})).filter((function(e){return e.length>0}))}}function u(e,t){for(var r=0,n=e.length;r>>1;e[a]=2))throw new Error("n must be \u22652");var r,a=(s=e.bbox||n(e))[0],i=s[1],o=s[2],l=s[3];t={scale:[o-a?(o-a)/(r-1):1,l-i?(l-i)/(r-1):1],translate:[a,i]}}var s,c,u=f(t),d=e.objects,p={};function h(e){return u(e)}function g(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(g)};break;case"Point":t={type:"Point",coordinates:h(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(h)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(c in d)p[c]=g(d[c]);return{type:"Topology",bbox:s,transform:t,objects:p,arcs:e.arcs.map((function(e){var t,r=0,n=1,a=e.length,i=new Array(a);for(i[0]=u(e[0],0);++r0||r.explicitOff.length>0},onClick:function(e,t){var r,l,s=o(e,t),c=s.on,u=s.off.concat(s.explicitOff),f={},d=e._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[t]}for(var V=!1,G=["x","y"],Z=0;Z1)&&(ee===K?((ce=te.r2fraction(t["a"+$]))<0||ce>1)&&(V=!0):V=!0),Y=te._offset+te.r2p(t[$]),J=.5}else"x"===$?(W=t[$],Y=b.l+b.w*W):(W=1-t[$],Y=b.t+b.h*W),J=t.showarrow?.5:W;if(t.showarrow){se.head=Y;var ue=t["a"+$];Q=ne*B(.5,t.xanchor)-ae*B(.5,t.yanchor),ee===K?(se.tail=te._offset+te.r2p(ue),X=Q):(se.tail=Y+ue,X=Q+ue),se.text=se.tail+Q;var fe=x["x"===$?"width":"height"];if("paper"===K&&(se.head=o.constrain(se.head,1,fe-1)),"pixel"===ee){var de=-Math.max(se.tail-3,se.text),pe=Math.min(se.tail+3,se.text)-fe;de>0?(se.tail+=de,se.text+=de):pe>0&&(se.tail-=pe,se.text-=pe)}se.tail+=le,se.head+=le}else X=Q=ie*B(J,oe),se.text=Y+Q;se.text+=le,Q+=le,X+=le,t["_"+$+"padplus"]=ie/2+X,t["_"+$+"padminus"]=ie/2-X,t["_"+$+"size"]=ie,t["_"+$+"shift"]=Q}if(V)E.remove();else{var he=0,ge=0;if("left"!==t.align&&(he=(w-m)*("center"===t.align?.5:1)),"top"!==t.valign&&(ge=(D-y)*("middle"===t.valign?.5:1)),u)n.select("svg").attr({x:I+he-1,y:I+ge}).call(c.setClipUrl,N?A:null,e);else{var ve=I+ge-h.top,me=I+he-h.left;U.call(f.positionText,me,ve).call(c.setClipUrl,N?A:null,e)}j.select("rect").call(c.setRect,I,I,w,D),F.call(c.setRect,z/2,z/2,R-z,H-z),E.call(c.setTranslate,Math.round(L.x.text-R/2),Math.round(L.y.text-H/2)),P.attr({transform:"rotate("+S+","+L.x.text+","+L.y.text+")"});var ye,xe=function(r,n){C.selectAll(".annotation-arrow-g").remove();var u=L.x.head,f=L.y.head,d=L.x.tail+r,h=L.y.tail+n,m=L.x.text+r,y=L.y.text+n,x=o.rotationXYMatrix(S,m,y),w=o.apply2DTransform(x),A=o.apply2DTransform2(x),O=+F.attr("width"),D=+F.attr("height"),z=m-.5*O,R=z+O,I=y-.5*D,N=I+D,j=[[z,I,z,N],[z,N,R,N],[R,N,R,I],[R,I,z,I]].map(A);if(!j.reduce((function(e,t){return e^!!o.segmentsIntersect(u,f,u+1e6,f+1e6,t[0],t[1],t[2],t[3])}),!1)){j.forEach((function(e){var t=o.segmentsIntersect(d,h,u,f,e[0],e[1],e[2],e[3]);t&&(d=t.x,h=t.y)}));var H=t.arrowwidth,B=t.arrowcolor,U=t.arrowside,q=C.append("g").style({opacity:s.opacity(B)}).classed("annotation-arrow-g",!0),V=q.append("path").attr("d","M"+d+","+h+"L"+u+","+f).style("stroke-width",H+"px").call(s.stroke,s.rgb(B));if(g(V,U,t),_.annotationPosition&&V.node().parentNode&&!i){var G=u,Z=f;if(t.standoff){var Y=Math.sqrt(Math.pow(u-d,2)+Math.pow(f-h,2));G+=t.standoff*(d-u)/Y,Z+=t.standoff*(h-f)/Y}var X,W,J=q.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-G)+","+(h-Z),transform:"translate("+G+","+Z+")"}).style("stroke-width",H+6+"px").call(s.stroke,"rgba(0,0,0,0)").call(s.fill,"rgba(0,0,0,0)");p.init({element:J.node(),gd:e,prepFn:function(){var e=c.getTranslate(E);X=e.x,W=e.y,l&&l.autorange&&k(l._name+".autorange",!0),v&&v.autorange&&k(v._name+".autorange",!0)},moveFn:function(e,r){var n=w(X,W),a=n[0]+e,i=n[1]+r;E.call(c.setTranslate,a,i),M("x",l?l.p2r(l.r2p(t.x)+e):t.x+e/b.w),M("y",v?v.p2r(v.r2p(t.y)+r):t.y-r/b.h),t.axref===t.xref&&M("ax",l.p2r(l.r2p(t.ax)+e)),t.ayref===t.yref&&M("ay",v.p2r(v.r2p(t.ay)+r)),q.attr("transform","translate("+e+","+r+")"),P.attr({transform:"rotate("+S+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",e,T());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}};if(t.showarrow&&xe(0,0),O)p.init({element:E.node(),gd:e,prepFn:function(){ye=P.attr("transform")},moveFn:function(e,r){var n="pointer";if(t.showarrow)t.axref===t.xref?M("ax",l.p2r(l.r2p(t.ax)+e)):M("ax",t.ax+e),t.ayref===t.yref?M("ay",v.p2r(v.r2p(t.ay)+r)):M("ay",t.ay+r),xe(e,r);else{if(i)return;var a,o;if(l)a=l.p2r(l.r2p(t.x)+e);else{var s=t._xsize/b.w,c=t.x+(t._xshift-t.xshift)/b.w-s/2;a=p.align(c+e/b.w,s,0,1,t.xanchor)}if(v)o=v.p2r(v.r2p(t.y)+r);else{var u=t._ysize/b.h,f=t.y-(t._yshift+t.yshift)/b.h-u/2;o=p.align(f-r/b.h,u,0,1,t.yanchor)}M("x",a),M("y",o),l&&v||(n=p.getCursor(l?.5:a,v?.5:o,t.xanchor,t.yanchor))}P.attr({transform:"translate("+e+","+r+")"+ye}),d(E,n)},clickFn:function(r,n){t.captureevents&&e.emit("plotly_clickannotation",q(n))},doneFn:function(){d(E),a.call("_guiRelayout",e,T());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}}t.exports={draw:function(e){var t=e._fullLayout;t._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,v=t.indexOf("end")>=0,m=f.backoff*p+r.standoff,y=d.backoff*h+r.startstandoff;if("line"===u.nodeName){o={x:+e.attr("x1"),y:+e.attr("y1")},l={x:+e.attr("x2"),y:+e.attr("y2")};var x=o.x-l.x,b=o.y-l.y;if(c=(s=Math.atan2(b,x))+Math.PI,m&&y&&m+y>Math.sqrt(x*x+b*b))return void O();if(m){if(m*m>x*x+b*b)return void O();var _=m*Math.cos(s),w=m*Math.sin(s);l.x+=_,l.y+=w,e.attr({x2:l.x,y2:l.y})}if(y){if(y*y>x*x+b*b)return void O();var k=y*Math.cos(s),M=y*Math.sin(s);o.x-=k,o.y-=M,e.attr({x1:o.x,y1:o.y})}}else if("path"===u.nodeName){var T=u.getTotalLength(),A="";if(T1){c=!0;break}}c?e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove():(s._pdata=a(e.glplot.cameraParams,[t.xaxis.r2l(s.x)*r[0],t.yaxis.r2l(s.y)*r[1],t.zaxis.r2l(s.z)*r[2]]),n(e.graphDiv,s,l,e.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":263,"../annotations/draw":43}],50:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../lib");t.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:e("./attributes")}}},layoutAttributes:e("./attributes"),handleDefaults:e("./defaults"),includeBasePlot:function(e,t){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var i=r.attrRegex,o=Object.keys(e),l=0;l=0))return e;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return e}var l=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+l+", "+n[3]+")":"rgb("+l+")"}i.tinyRGB=function(e){var t=e.toRgb();return"rgb("+Math.round(t.r)+", "+Math.round(t.g)+", "+Math.round(t.b)+")"},i.rgb=function(e){return i.tinyRGB(n(e))},i.opacity=function(e){return e?n(e).getAlpha():0},i.addOpacity=function(e,t){var r=n(e).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+t+")"},i.combine=function(e,t){var r=n(e).toRgb();if(1===r.a)return n(e).toRgbString();var a=n(t||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(e,t,r){var a=n(e);return 1!==a.getAlpha()&&(a=n(i.combine(e,s))),(a.isDark()?t?a.lighten(t):s:r?a.darken(r):l).toString()},i.stroke=function(e,t){var r=n(t);e.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(e,t){var r=n(t);e.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(e){if(e&&"object"==typeof e){var t,r,n,a,o=Object.keys(e);for(t=0;t0?n>=s:n<=s));a++)n>u&&n0?n>=s:n<=s));a++)n>r[0]&&n1){var W=Math.pow(10,Math.floor(Math.log(X)/Math.LN10));Z*=W*c.roundUp(X/W,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=Z}G.domain=[U+j,U+I-j],G.setScale(),e.attr("transform","translate("+Math.round(s.l)+","+Math.round(s.t)+")");var J,Q=e.select("."+M.cbtitleunshift).attr("transform","translate(-"+Math.round(s.l)+",-"+Math.round(s.t)+")"),$=e.select("."+M.cbaxis),K=0;function ee(n,a){var i={propContainer:G,propName:t._propPrefix+"title",traceIndex:t._traceIndex,_meta:t._meta,placeholder:o._dfltTitle.colorbar,containerGroup:e.select("."+M.cbtitle)},l="h"===n.charAt(0)?n.substr(1):"h"+n;e.selectAll("."+l+",."+l+"-math-group").remove(),h.draw(r,n,u(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(T)){var e,r=s.l+(t.x+F)*s.w,n=G.title.font.size;e="top"===T?(1-(U+I-j))*s.h+s.t+3+.75*n:(1-(U+j))*s.h+s.t-3-.25*n,ee(G._id+"title",{attributes:{x:r,y:e,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(T)){var i=e.select("."+M.cbtitle),o=i.select("text"),u=[-t.outlinewidth/2,t.outlinewidth/2],f=i.select(".h"+G._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*_),f?(K=d.bBox(f).height)>p&&(u[1]-=(K-p)/2):o.node()&&!o.classed(M.jsPlaceholder)&&(K=d.bBox(o.node()).height),K){if(K+=5,"top"===T)G.domain[1]-=K/s.h,u[1]*=-1;else{G.domain[0]+=K/s.h;var h=g.lineCount(o);u[1]+=(1-h)*p}i.attr("transform","translate("+u+")"),G.setScale()}}e.selectAll("."+M.cbfills+",."+M.cblines).attr("transform","translate(0,"+Math.round(s.h*(1-G.domain[1]))+")"),$.attr("transform","translate(0,"+Math.round(-s.t)+")");var m=e.select("."+M.cbfills).selectAll("rect."+M.cbfill).data(O);m.enter().append("rect").classed(M.cbfill,!0).style("stroke","none"),m.exit().remove();var y=A.map(G.c2p).map(Math.round).sort((function(e,t){return e-t}));m.each((function(e,i){var o=[0===i?A[0]:(O[i]+O[i-1])/2,i===O.length-1?A[1]:(O[i]+O[i+1])/2].map(G.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var l=n.select(this).attr({x:H,width:Math.max(E,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(t._fillgradient)d.gradient(l,r,t._id,"vertical",t._fillgradient,"fill");else{var s=S(e).replace("e-","");l.attr("fill",a(s).toHexString())}}));var x=e.select("."+M.cblines).selectAll("path."+M.cbline).data(v.color&&v.width?D:[]);x.enter().append("path").classed(M.cbline,!0),x.exit().remove(),x.each((function(e){n.select(this).attr("d","M"+H+","+(Math.round(G.c2p(e))+v.width/2%1)+"h"+E).call(d.lineGroupStyle,v.width,L(e),v.dash)})),$.selectAll("g."+G._id+"tick,path").remove();var b=H+E+(t.outlinewidth||0)/2-("outside"===t.ticks?1:0),w=l.calcTicks(G),k=l.makeTransFn(G),C=l.getTickSigns(G)[2];return l.drawTicks(r,G,{vals:"inside"===G.ticks?l.clipEnds(G,w):w,layer:$,path:l.makeTickPath(G,b,C),transFn:k}),l.drawLabels(r,G,{vals:w,layer:$,transFn:k,labelFns:l.makeLabelFns(G,b)})},function(){if(-1===["top","bottom"].indexOf(T)){var e=G.title.font.size,t=G._offset+G._length/2,a=s.l+(G.position||0)*s.w+("right"===G.side?10+e*(G.showticklabels?1:.5):-10-e*(G.showticklabels?.5:0));ee("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:T,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:t,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=E+t.outlinewidth/2+d.bBox($.node()).width;if((J=Q.select("text")).node()&&!J.classed(M.jsPlaceholder)){var a,o=Q.select(".h"+G._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(T)?d.bBox(o).width:d.bBox(Q.node()).right-H-s.l,n=Math.max(n,a)}var l=2*t.xpad+n+t.borderwidth+t.outlinewidth/2,c=q-V;e.select("."+M.cbbg).attr({x:H-t.xpad-(t.borderwidth+t.outlinewidth)/2,y:V-N,width:Math.max(l,2),height:Math.max(c+2*N,2)}).call(p.fill,t.bgcolor).call(p.stroke,t.bordercolor).style("stroke-width",t.borderwidth),e.selectAll("."+M.cboutline).attr({x:H,y:V+t.ypad+("top"===T?K:0),width:Math.max(E,2),height:Math.max(c-2*t.ypad-K,2)}).call(p.stroke,t.outlinecolor).style({fill:"none","stroke-width":t.outlinewidth});var u=({center:.5,right:1}[t.xanchor]||0)*l;e.attr("transform","translate("+(s.l-u)+","+s.t+")");var f={},h=w[t.yanchor],g=k[t.yanchor];"pixels"===t.lenmode?(f.y=t.y,f.t=c*h,f.b=c*g):(f.t=f.b=0,f.yt=t.y+t.len*h,f.yb=t.y-t.len*g);var v=w[t.xanchor],m=k[t.xanchor];if("pixels"===t.thicknessmode)f.x=t.x,f.l=l*v,f.r=l*m;else{var y=l-E;f.l=y*v,f.r=y*m,f.xl=t.x-t.thickness*v,f.xr=t.x+t.thickness*m}i.autoMargin(r,t._id,f)}],r)}(r,t,e);v&&v.then&&(e._promises||[]).push(v),e._context.edits.colorbarPosition&&function(e,t,r){var n,a,i,l=r._fullLayout._size;s.init({element:e.node(),gd:r,prepFn:function(){n=e.attr("transform"),f(e)},moveFn:function(r,o){e.attr("transform",n+" translate("+r+","+o+")"),a=s.align(t._xLeftFrac+r/l.w,t._thickFrac,0,1,t.xanchor),i=s.align(t._yBottomFrac-o/l.h,t._lenFrac,0,1,t.yanchor);var c=s.getCursor(a,i,t.xanchor,t.yanchor);f(e,c)},doneFn:function(){if(f(e),void 0!==a&&void 0!==i){var n={};n[t._propPrefix+"x"]=a,n[t._propPrefix+"y"]=i,void 0!==t._traceIndex?o.call("_guiRestyle",r,n,t._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,t,e)})),t.exit().each((function(t){i.autoMargin(e,t._id)})).remove(),t.order()}}},{"../../constants/alignment":154,"../../lib":180,"../../lib/extend":172,"../../lib/setcursor":199,"../../lib/svg_text_utils":201,"../../plots/cartesian/axes":225,"../../plots/cartesian/axis_defaults":227,"../../plots/cartesian/layout_attributes":239,"../../plots/cartesian/position_defaults":242,"../../plots/plots":266,"../../registry":275,"../color":52,"../colorscale/helpers":63,"../dragelement":71,"../drawing":74,"../titles":147,"./constants":54,d3:15,tinycolor2:34}],57:[function(e,t,r){"use strict";var n=e("../../lib");t.exports=function(e){return n.isPlainObject(e.colorbar)}},{"../../lib":180}],58:[function(e,t,r){"use strict";t.exports={moduleType:"component",name:"colorbar",attributes:e("./attributes"),supplyDefaults:e("./defaults"),draw:e("./draw").draw,hasColorbar:e("./has_colorbar")}},{"./attributes":53,"./defaults":55,"./draw":56,"./has_colorbar":57}],59:[function(e,t,r){"use strict";var n=e("../colorbar/attributes"),a=e("../../lib/regex").counter,i=e("./scales.js").scales;Object.keys(i);function o(e){return"`"+e+"`"}t.exports=function(e,t){e=e||"";var r,l=(t=t||{}).cLetter||"c",s=("onlyIfNumerical"in t?t.onlyIfNumerical:Boolean(e),"noScale"in t?t.noScale:"marker.line"===e),c="showScaleDflt"in t?t.showScaleDflt:"z"===l,u="string"==typeof t.colorscaleDflt?i[t.colorscaleDflt]:null,f=t.editTypeOverride||"",d=e?e+".":"";"colorAttr"in t?(r=t.colorAttr,t.colorAttr):o(d+(r={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},t.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==t.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),t.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":195,"../colorbar/attributes":53,"./scales.js":67}],60:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../lib"),i=e("./helpers").extractOpts;t.exports=function(e,t,r){var o,l=e._fullLayout,s=r.vals,c=r.containerStr,u=c?a.nestedProperty(t,c).get():t,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&n(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&n(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":180,"./helpers":63,"fast-isnumeric":17}],61:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./helpers").hasColorscale,i=e("./helpers").extractOpts;t.exports=function(e,t){function r(e,t){var r=e["_"+t];void 0!==r&&(e[t]=r)}function o(e,a){var o=a.container?n.nestedProperty(e,a.container).get():e;if(o)if(o.coloraxis)o._colorAx=t[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&r(o,a.min),(s||void 0===l.max)&&r(o,a.max),l.autocolorscale&&r(o,"colorscale")}}for(var l=0;l=0;n--,a++){var i=e[n];r[a]=[1-i[0],i[1]]}return r}function h(e,t){t=t||{};for(var r=e.domain,o=e.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],69:[function(e,t,r){"use strict";var n=e("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];t.exports=function(e,t,r,i){return e="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*e),0,2),t="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*t),0,2),a[t][e]}},{"../../lib":180}],70:[function(e,t,r){"use strict";r.selectMode=function(e){return"lasso"===e||"select"===e},r.drawMode=function(e){return"drawclosedpath"===e||"drawopenpath"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.openMode=function(e){return"drawline"===e||"drawopenpath"===e},r.rectMode=function(e){return"select"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},r.freeMode=function(e){return"lasso"===e||"drawclosedpath"===e||"drawopenpath"===e},r.selectingOrDrawing=function(e){return r.freeMode(e)||r.rectMode(e)}},{}],71:[function(e,t,r){"use strict";var n=e("mouse-event-offset"),a=e("has-hover"),i=e("has-passive-events"),o=e("../../lib").removeElement,l=e("../../plots/cartesian/constants"),s=t.exports={};s.align=e("./align"),s.getCursor=e("./cursor");var c=e("./unhover");function u(){var e=document.createElement("div");e.className="dragcover";var t=e.style;return t.position="fixed",t.left=0,t.right=0,t.top=0,t.bottom=0,t.zIndex=999999999,t.background="none",document.body.appendChild(e),e}function f(e){return n(e.changedTouches?e.changedTouches[0]:e,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(e){var t,r,n,c,d,p,h,g,v=e.gd,m=1,y=v._context.doubleClickDelay,x=e.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=e.clampFn||function(e,t,r){return Math.abs(e)y&&(m=Math.max(m-1,1)),v._dragged)e.doneFn&&e.doneFn();else if(e.clickFn&&e.clickFn(m,p),!g){var r;try{r=new MouseEvent("click",t)}catch(e){var n=f(t);(r=document.createEvent("MouseEvents")).initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,n[0],n[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}h.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":180,"../../plots/cartesian/constants":231,"./align":68,"./cursor":69,"./unhover":72,"has-hover":19,"has-passive-events":20,"mouse-event-offset":23}],72:[function(e,t,r){"use strict";var n=e("../../lib/events"),a=e("../../lib/throttle"),i=e("../../lib/dom").getGraphDiv,o=e("../fx/constants"),l=t.exports={};l.wrapped=function(e,t,r){(e=i(e))._fullLayout&&a.clear(e._fullLayout._uid+o.HOVERID),l.raw(e,t,r)},l.raw=function(e,t){var r=e._fullLayout,a=e._hoverdata;t||(t={}),t.target&&!1===n.triggerHandler(e,"plotly_beforehover",t)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,t.target&&a&&e.emit("plotly_unhover",{event:t,points:a}))}},{"../../lib/dom":170,"../../lib/events":171,"../../lib/throttle":202,"../fx/constants":86}],73:[function(e,t,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],74:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("tinycolor2"),o=e("../../registry"),l=e("../color"),s=e("../colorscale"),c=e("../../lib"),u=e("../../lib/svg_text_utils"),f=e("../../constants/xmlns_namespaces"),d=e("../../constants/alignment").LINE_SPACING,p=e("../../constants/interactions").DESELECTDIM,h=e("../../traces/scatter/subtypes"),g=e("../../traces/scatter/make_bubble_size_func"),v=e("../../components/fx/helpers").appendArrayPointValue,m=t.exports={};m.font=function(e,t,r,n){c.isPlainObject(t)&&(n=t.color,r=t.size,t=t.family),t&&e.style("font-family",t),r+1&&e.style("font-size",r+"px"),n&&e.call(l.fill,n)},m.setPosition=function(e,t,r){e.attr("x",t).attr("y",r)},m.setSize=function(e,t,r){e.attr("width",t).attr("height",r)},m.setRect=function(e,t,r,n,a){e.call(m.setPosition,t,r).call(m.setSize,n,a)},m.translatePoint=function(e,t,r,n){var i=r.c2p(e.x),o=n.c2p(e.y);return!!(a(i)&&a(o)&&t.node())&&("text"===t.node().nodeName?t.attr("x",i).attr("y",o):t.attr("transform","translate("+i+","+o+")"),!0)},m.translatePoints=function(e,t,r){e.each((function(e){var a=n.select(this);m.translatePoint(e,a,t,r)}))},m.hideOutsideRangePoint=function(e,t,r,n,a,i){t.attr("display",r.isPtWithinRange(e,a)&&n.isPtWithinRange(e,i)?null:"none")},m.hideOutsideRangePoints=function(e,t){if(t._hasClipOnAxisFalse){var r=t.xaxis,a=t.yaxis;e.each((function(t){var i=t[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";e.selectAll(c).each((function(e){m.hideOutsideRangePoint(e,n.select(this),r,a,l,s)}))}))}},m.crispRound=function(e,t,r){return t&&a(t)?e._context.staticPlot?t:t<1?1:Math.round(t):r||0},m.singleLineStyle=function(e,t,r,n,a){t.style("fill","none");var i=(((e||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";l.stroke(t,n||i.color),m.dashLine(t,s,o)},m.lineGroupStyle=function(e,t,r,a){e.style("fill","none").each((function(e){var i=(((e||[])[0]||{}).trace||{}).line||{},o=t||i.width||0,s=a||i.dash||"";n.select(this).call(l.stroke,r||i.color).call(m.dashLine,s,o)}))},m.dashLine=function(e,t,r){r=+r||0,t=m.dashStyle(t,r),e.style({"stroke-dasharray":t,"stroke-width":r+"px"})},m.dashStyle=function(e,t){t=+t||1;var r=Math.max(t,3);return"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),e},m.singleFillStyle=function(e){var t=(((n.select(e.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;t&&e.call(l.fill,t)},m.fillGroupStyle=function(e){e.style("stroke-width",0).each((function(e){var t=n.select(this);e[0].trace&&t.call(l.fill,e[0].trace.fillcolor)}))};var y=e("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(y).forEach((function(e){var t=y[e],r=t.n;m.symbolList.push(r,String(r),e,r+100,String(r+100),e+"-open"),m.symbolNames[r]=e,m.symbolFuncs[r]=t.f,t.needLine&&(m.symbolNeedLines[r]=!0),t.noDot?m.symbolNoDot[r]=!0:m.symbolList.push(r+200,String(r+200),e+"-dot",r+300,String(r+300),e+"-open-dot"),t.noFill&&(m.symbolNoFill[r]=!0)}));var x=m.symbolNames.length;function b(e,t){var r=e%100;return m.symbolFuncs[r](t)+(e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}m.symbolNumber=function(e){if(a(e))e=+e;else if("string"==typeof e){var t=0;e.indexOf("-open")>0&&(t=100,e=e.replace("-open","")),e.indexOf("-dot")>0&&(t+=200,e=e.replace("-dot","")),(e=m.symbolNames.indexOf(e))>=0&&(e+=t)}return e%100>=x||e>=400?0:Math.floor(Math.max(e,0))};var _={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0},k=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}};m.gradient=function(e,t,r,a,o,s){for(var u=o.length,f=M[a],d=new Array(u),p=0;p"+m(e);h._gradientUrlQueryParts[y]=1},m.initGradients=function(e){var t=e._fullLayout;c.ensureSingle(t._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),t._gradientUrlQueryParts={}},m.pointStyle=function(e,t,r){if(e.size()){var a=m.makePointStyleFns(t);e.each((function(e){m.singlePointStyle(e,n.select(this),t,a,r)}))}},m.singlePointStyle=function(e,t,r,n,a){var i=r.marker,o=i.line;if(t.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(e):void 0===e.mo?i.opacity:e.mo),n.ms2mrc){var s;s="various"===e.ms||"various"===i.size?3:n.ms2mrc(e.ms),e.mrc=s,n.selectedSizeFn&&(s=e.mrc=n.selectedSizeFn(e));var u=m.symbolNumber(e.mx||i.symbol)||0;e.om=u%200>=100,t.attr("d",b(u,s))}var f,d,p,h=!1;if(e.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(e.mlw+1||g+1||(e.trace?(e.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in e?e.mlcc=n.lineScale(e.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in e?e.mcc=n.markerScale(e.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(e))}if(e.om)t.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{t.style("stroke-width",(e.isBlank?0:p)+"px");var v=i.gradient,y=e.mgt;if(y?h=!0:y=v&&v.type,Array.isArray(y)&&(y=y[0],M[y]||(y=0)),y&&"none"!==y){var x=e.mgc;x?h=!0:x=v.color;var _=r.uid;h&&(_+="-"+e.i),m.gradient(t,a,_,y,[[0,x],[1,f]],"fill")}else l.fill(t,f);p&&l.stroke(t,d)}},m.makePointStyleFns=function(e){var t={},r=e.marker;return t.markerScale=m.tryColorscale(r,""),t.lineScale=m.tryColorscale(r,"line"),o.traceIs(e,"symbols")&&(t.ms2mrc=h.isBubble(e)?g(e):function(){return(r.size||6)/2}),e.selectedpoints&&c.extendFlat(t,m.makeSelectedPointStyleFns(e)),t},m.makeSelectedPointStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.marker||{},i=r.marker||{},l=n.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,h=void 0!==f;(c.isArrayOrTypedArray(s)||d||h)&&(t.selectedOpacityFn=function(e){var t=void 0===e.mo?a.opacity:e.mo;return e.selected?d?u:t:h?f:p*t});var g=a.color,v=i.color,m=l.color;(v||m)&&(t.selectedColorFn=function(e){var t=e.mcc||g;return e.selected?v||t:m||t});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(e,"symbols")&&(_||w)&&(t.selectedSizeFn=function(e){var t=e.mrc||y/2;return e.selected?_?x/2:t:w?b/2:t}),t},m.makeSelectedTextStyleFns=function(e){var t={},r=e.selected||{},n=e.unselected||{},a=e.textfont||{},i=r.textfont||{},o=n.textfont||{},s=a.color,c=i.color,u=o.color;return t.selectedTextColorFn=function(e){var t=e.tc||s;return e.selected?c||t:u||(c?t:l.addOpacity(t,p))},t},m.selectedPointStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedPointStyleFns(t),a=t.marker||{},i=[];r.selectedOpacityFn&&i.push((function(e,t){e.style("opacity",r.selectedOpacityFn(t))})),r.selectedColorFn&&i.push((function(e,t){l.fill(e,r.selectedColorFn(t))})),r.selectedSizeFn&&i.push((function(e,t){var n=t.mx||a.symbol||0,i=r.selectedSizeFn(t);e.attr("d",b(m.symbolNumber(n),i)),t.mrc2=i})),i.length&&e.each((function(e){for(var t=n.select(this),r=0;r0?r:0}m.textPointStyle=function(e,t,r){if(e.size()){var a;if(t.selectedpoints){var i=m.makeSelectedTextStyleFns(t);a=i.selectedTextColorFn}var o=t.texttemplate,l=r._fullLayout;e.each((function(e){var i=n.select(this),s=o?c.extractOption(e,t,"txt","texttemplate"):c.extractOption(e,t,"tx","text");if(s||0===s){if(o){var f=t._module.formatLabels?t._module.formatLabels(e,t,l):{},d={};v(d,t,e.i);var p=t._meta||{};s=c.texttemplateString(s,f,l._d3locale,d,e,p)}var h=e.tp||t.textposition,g=L(e,t),y=a?a(e):e.tc||t.textfont.color;i.call(m.font,e.tf||t.textfont.family,g,y).text(s).call(u.convertToTspans,r).call(A,h,g,e.mrc)}else i.remove()}))}},m.selectedTextStyle=function(e,t){if(e.size()&&t.selectedpoints){var r=m.makeSelectedTextStyleFns(t);e.each((function(e){var a=n.select(this),i=r.selectedTextColorFn(e),o=e.tp||t.textposition,s=L(e,t);l.fill(a,i),A(a,o,s,e.mrc2||e.mrc)}))}};function S(e,t,r,a){var i=e[0]-t[0],o=e[1]-t[1],l=r[0]-t[0],s=r[1]-t[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[n.round(t[0]+(p&&f/p),2),n.round(t[1]+(p&&d/p),2)],[n.round(t[0]-(h&&f/h),2),n.round(t[1]-(h&&d/h),2)]]}m.smoothopen=function(e,t){if(e.length<3)return"M"+e.join("L");var r,n="M"+e[0],a=[];for(r=1;r=1e4&&(m.savedBBoxes={},O=0),r&&(m.savedBBoxes[r]=v),O++,c.extendFlat({},v)},m.setClipUrl=function(e,t,r){e.attr("clip-path",E(t,r))},m.getTranslate=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||0,y:+t[1]||0}},m.setTranslate=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=" translate("+t+", "+r+")").trim(),e[a]("transform",i),i},m.getScale=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,(function(e,t,r){return[t,r].join(" ")})).split(" ");return{x:+t[0]||1,y:+t[1]||1}},m.setScale=function(e,t,r){var n=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[n]("transform")||"";return t=t||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+=" scale("+t+", "+r+")").trim(),e[a]("transform",i),i};var z=/\s*sc.*/;m.setPointGroupScale=function(e,t,r){if(t=t||1,r=r||1,e){var n=1===t&&1===r?"":" scale("+t+","+r+")";e.each((function(){var e=(this.getAttribute("transform")||"").replace(z,"");e=(e+=n).trim(),this.setAttribute("transform",e)}))}};var R=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(e,t,r){e&&e.each((function(){var e,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(R);e=1===t&&1===r?[]:["translate("+o+","+l+")","scale("+t+","+r+")","translate("+-o+","+-l+")"],s&&e.push(s),a.attr("transform",e.join(" "))}}))}},{"../../components/fx/helpers":88,"../../constants/alignment":154,"../../constants/interactions":156,"../../constants/xmlns_namespaces":158,"../../lib":180,"../../lib/svg_text_utils":201,"../../registry":275,"../../traces/scatter/make_bubble_size_func":314,"../../traces/scatter/subtypes":321,"../color":52,"../colorscale":64,"./symbol_defs":75,d3:15,"fast-isnumeric":17,tinycolor2:34}],75:[function(e,t,r){"use strict";var n=e("d3");t.exports={circle:{n:0,f:function(e){var t=n.round(e,2);return"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"}},square:{n:1,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"}},diamond:{n:2,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"Z"}},cross:{n:3,f:function(e){var t=n.round(.4*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H"+t+"V"+r+"H-"+t+"V"+t+"H-"+r+"V-"+t+"H-"+t+"V-"+r+"H"+t+"V-"+t+"H"+r+"Z"}},x:{n:4,f:function(e){var t=n.round(.8*e/Math.sqrt(2),2),r="l"+t+","+t,a="l"+t+",-"+t,i="l-"+t+",-"+t,o="l-"+t+","+t;return"M0,"+t+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+","+n.round(e/2,2)+"H"+t+"L0,-"+n.round(e,2)+"Z"}},"triangle-down":{n:6,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+t+",-"+n.round(e/2,2)+"H"+t+"L0,"+n.round(e,2)+"Z"}},"triangle-left":{n:7,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M"+n.round(e/2,2)+",-"+t+"V"+t+"L-"+n.round(e,2)+",0Z"}},"triangle-right":{n:8,f:function(e){var t=n.round(2*e/Math.sqrt(3),2);return"M-"+n.round(e/2,2)+",-"+t+"V"+t+"L"+n.round(e,2)+",0Z"}},"triangle-ne":{n:9,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+r+",-"+t+"H"+t+"V"+r+"Z"}},"triangle-se":{n:10,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+t+",-"+r+"V"+t+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M"+r+","+t+"H-"+t+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(e){var t=n.round(.6*e,2),r=n.round(1.2*e,2);return"M-"+t+","+r+"V-"+t+"H"+r+"Z"}},pentagon:{n:13,f:function(e){var t=n.round(.951*e,2),r=n.round(.588*e,2),a=n.round(-e,2),i=n.round(-.309*e,2);return"M"+t+","+i+"L"+r+","+n.round(.809*e,2)+"H-"+r+"L-"+t+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+t+"L-"+a+","+r+"V-"+r+"L0,-"+t+"Z"}},hexagon2:{n:15,f:function(e){var t=n.round(e,2),r=n.round(e/2,2),a=n.round(e*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+t+",0L"+r+",-"+a+"H-"+r+"L-"+t+",0Z"}},octagon:{n:16,f:function(e){var t=n.round(.924*e,2),r=n.round(.383*e,2);return"M-"+r+",-"+t+"H"+r+"L"+t+",-"+r+"V"+r+"L"+r+","+t+"H-"+r+"L-"+t+","+r+"V-"+r+"Z"}},star:{n:17,f:function(e){var t=1.4*e,r=n.round(.225*t,2),a=n.round(.951*t,2),i=n.round(.363*t,2),o=n.round(.588*t,2),l=n.round(-t,2),s=n.round(-.309*t,2),c=n.round(.118*t,2),u=n.round(.809*t,2);return"M"+r+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*t,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+r+"L0,"+l+"Z"}},hexagram:{n:18,f:function(e){var t=n.round(.66*e,2),r=n.round(.38*e,2),a=n.round(.76*e,2);return"M-"+a+",0l-"+r+",-"+t+"h"+a+"l"+r+",-"+t+"l"+r+","+t+"h"+a+"l-"+r+","+t+"l"+r+","+t+"h-"+a+"l-"+r+","+t+"l-"+r+",-"+t+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+t+","+r+o+t+","+r+o+"0,-"+a+o+"-"+t+","+r+"Z"}},"star-triangle-down":{n:20,f:function(e){var t=n.round(e*Math.sqrt(3)*.8,2),r=n.round(.8*e,2),a=n.round(1.6*e,2),i=n.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M"+t+",-"+r+o+"-"+t+",-"+r+o+"0,"+a+o+t+",-"+r+"Z"}},"star-square":{n:21,f:function(e){var t=n.round(1.1*e,2),r=n.round(2*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",-"+t+a+"-"+t+","+t+a+t+","+t+a+t+",-"+t+a+"-"+t+",-"+t+"Z"}},"star-diamond":{n:22,f:function(e){var t=n.round(1.4*e,2),r=n.round(1.9*e,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+t+",0"+a+"0,"+t+a+t+",0"+a+"0,-"+t+a+"-"+t+",0Z"}},"diamond-tall":{n:23,f:function(e){var t=n.round(.7*e,2),r=n.round(1.4*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},"diamond-wide":{n:24,f:function(e){var t=n.round(1.4*e,2),r=n.round(.7*e,2);return"M0,"+r+"L"+t+",0L0,-"+r+"L-"+t+",0Z"}},hourglass:{n:25,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"H-"+t+"L"+t+",-"+t+"H-"+t+"Z"},noDot:!0},bowtie:{n:26,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"V-"+t+"L-"+t+","+t+"V-"+t+"Z"},noDot:!0},"circle-cross":{n:27,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(e){var t=n.round(e,2),r=n.round(e/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(e){var t=n.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(e){var t=n.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM0,-"+t+"V"+t+"M-"+t+",0H"+t},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(e){var t=n.round(1.3*e,2),r=n.round(.65*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(e){var t=n.round(1.2*e,2),r=n.round(.85*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(e){var t=n.round(e/2,2),r=n.round(e,2);return"M"+t+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+t+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+","+a+"L0,0M"+t+","+a+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+t+",-"+a+"L0,0M"+t+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M"+a+","+t+"L0,0M"+a+",-"+t+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(e){var t=n.round(1.2*e,2),r=n.round(1.6*e,2),a=n.round(.8*e,2);return"M-"+a+","+t+"L0,0M-"+a+",-"+t+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(e){var t=n.round(1.4*e,2);return"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(e){var t=n.round(1.4*e,2);return"M0,"+t+"V-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(e){var t=n.round(e,2);return"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(e){var t=n.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t},needLine:!0,noDot:!0,noFill:!0},"arrow-up":{n:45,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-down":{n:46,f:function(e){var t=n.round(e,2);return"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-left":{n:47,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,0L-"+t+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+","+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(e){var t=n.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+",-"+n.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(e){var t=n.round(2*e,2),r=n.round(e,2);return"M0,-"+r+"V"+r+"M0,0L-"+t+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:15}],76:[function(e,t,r){"use strict";t.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"}}}},{}],77:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../registry"),i=e("../../plots/cartesian/axes"),o=e("../../lib"),l=e("./compute_error");function s(e,t,r,a){var s=t["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=l(s),f=0;f0;t.each((function(t){var f,d=t[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(e){return e.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(t=[]);var v=n.select(this).selectAll("g.errorbar").data(t,f);if(v.exit().remove(),t.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.setClipUrl(v,r.layerClipId,e),v.each((function(e){var t=n.select(this),r=function(e,t,r){var n={x:t.c2p(e.x),y:r.c2p(e.y)};void 0!==e.yh&&(n.yh=r.c2p(e.yh),n.ys=r.c2p(e.ys),a(n.ys)||(n.noYS=!0,n.ys=r.c2p(e.ys,!0)));void 0!==e.xh&&(n.xh=t.c2p(e.xh),n.xs=t.c2p(e.xs),a(n.xs)||(n.noXS=!0,n.xs=t.c2p(e.xs,!0)));return n}(e,s,c);if(!g||e.vis){var i,o=t.select("path.yerror");if(h.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=h.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=t.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=t.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=t.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":321,"../drawing":74,d3:15,"fast-isnumeric":17}],82:[function(e,t,r){"use strict";var n=e("d3"),a=e("../color");t.exports=function(e){e.each((function(e){var t=e[0].trace,r=t.error_y||{},i=t.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":52,d3:15}],83:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("./layout_attributes").hoverlabel,i=e("../../lib/extend").extendFlat;t.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":172,"../../plots/font_attributes":253,"./layout_attributes":93}],84:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry");function i(e,t,r,a){a=a||n.identity,Array.isArray(e)&&(t[0][r]=a(e))}t.exports=function(e){var t=e.calcdata,r=e._fullLayout;function o(e){return function(t){return n.coerceHoverinfo({hoverinfo:t},{_module:e._module},r)}}for(var l=0;l=0&&r.indexb[0]._length||ee<0||ee>w[0]._length)return d.unhoverRaw(e,t)}if(t.pointerX=K+b[0]._offset,t.pointerY=ee+w[0]._offset,z="xval"in t?g.flat(s,t.xval):g.p2c(b,K),R="yval"in t?g.flat(s,t.yval):g.p2c(w,ee),!a(z[0])||!a(R[0]))return o.warn("Fx.hover failed",t,e),d.unhoverRaw(e,t)}var re=1/0;function ne(e,r){for(F=0;FZ&&(W.splice(0,Z),re=W[0].distance),m&&0!==X&&0===W.length){G.distance=X,G.index=!1;var d=j._module.hoverPoints(G,q,V,"closest",u._hoverlayer);if(d&&(d=d.filter((function(e){return e.spikeDistance<=X}))),d&&d.length){var p,h=d.filter((function(e){return e.xa.showspikes&&"hovered data"!==e.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(p=ie(v),(!Q.vLinePoint||Q.vLinePoint.spikeDistance>p.spikeDistance)&&(Q.vLinePoint=p))}var y=d.filter((function(e){return e.ya.showspikes&&"hovered data"!==e.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(p=ie(x),(!Q.hLinePoint||Q.hLinePoint.spikeDistance>p.spikeDistance)&&(Q.hLinePoint=p))}}}}}function ae(e,t){for(var r,n=null,a=1/0,i=0;i1||W.length>1)||"closest"===C&&$&&W.length>1,Te=f.combine(u.plot_bgcolor||f.background,u.paper_bgcolor),Ae={hovermode:C,rotateLabels:Me,bgColor:Te,container:u._hoverlayer,outerContainer:u._paperdiv,commonLabelOpts:u.hoverlabel,hoverdistance:u.hoverdistance},Le=S(W,Ae,e);g.isUnifiedHover(C)||(!function(e,t,r){var n,a,i,o,l,s,c,u=0,f=1,d=e.size(),p=new Array(d),h=0;function g(e){var t=e[0],r=e[e.length-1];if(a=t.pmin-t.pos-t.dp+t.size,i=r.pos+r.dp+r.size-t.pmax,a>.01){for(l=e.length-1;l>=0;l--)e[l].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(l=e.length-1;l>=0;l--)e[l].dp-=i;n=!1}if(n){var c=0;for(o=0;ot.pmax&&c++;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos>t.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)e[l].dp-=i;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos+s.dp+s.size>t.pmax&&(s.del=!0,c--)}}}e.each((function(e){var n=e[t],a="x"===n._id.charAt(0),i=n.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:e,traceIndex:e.trace.index,dp:0,pos:e.pos,posref:e.posref,size:e.by*(a?_:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(e,t){return e[0].posref-t[0].posref||f*(t[0].traceIndex-e[0].traceIndex)}));for(;!n&&u<=d;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var w=b[l],k=w.datum;k.offset=w.dp,k.del=w.del}}}(Le,Me?"xa":"ya",u),P(Le,Me));if(t.target&&t.target.tagName){var Se=h.getComponentMethod("annotations","hasClickToShow")(e,be);c(n.select(t.target),Se?"pointer":"")}if(!t.target||i||!function(e,t,r){if(!r||r.length!==e._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=e._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(e,0,xe))return;xe&&e.emit("plotly_unhover",{event:t,points:xe});e.emit("plotly_hover",{event:t,points:e._hoverdata,xaxes:b,yaxes:w,xvals:z,yvals:R})}(e,t,r,i)}))},r.loneHover=function(e,t){var r=!0;Array.isArray(e)||(r=!1,e=[e]);var a=e.map((function(e){return{color:e.color||f.defaultLine,x0:e.x0||e.x||0,x1:e.x1||e.x||0,y0:e.y0||e.y||0,y1:e.y1||e.y||0,xLabel:e.xLabel,yLabel:e.yLabel,zLabel:e.zLabel,text:e.text,name:e.name,idealAlign:e.idealAlign,borderColor:e.borderColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontColor:e.fontColor,nameLength:e.nameLength,textAlign:e.textAlign,trace:e.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:e.hovertemplate||!1,eventData:e.eventData||!1,hovertemplateLabels:e.hovertemplateLabels||!1}})),i=n.select(t.container),o=t.outerContainer?n.select(t.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:t.bgColor||f.background,container:i,outerContainer:o},s=S(a,l,t.gd),c=0,u=0;return s.sort((function(e,t){return e.y0-t.y0})).each((function(e,r){var n=e.y0-e.by/2;e.offset=n-5([\s\S]*)<\/extra>/;function S(e,t,r){var a=r._fullLayout,i=t.hovermode,l=t.rotateLabels,c=t.bgColor,d=t.container,p=t.outerContainer,h=t.commonLabelOpts||{},b=t.fontFamily||v.HOVERFONT,_=t.fontSize||v.HOVERFONTSIZE,w=e[0],k=w.xa,L=w.ya,S="y"===i.charAt(0)?"yLabel":"xLabel",P=w[S],O=(String(P)||"").split(" ")[0],D=p.node().getBoundingClientRect(),E=D.top,z=D.width,R=D.height,I=void 0!==P&&w.distance<=t.hoverdistance&&("x"===i||"y"===i);if(I){var F,N,j=!0;for(F=0;Fa.width-S?(m=a.width-S,l.attr("d","M"+(S-M)+",0L"+S+","+A+M+"v"+A+(2*T+x.height)+"H-"+S+"V"+A+M+"H"+(S-2*M)+"Z")):l.attr("d","M0,0L"+M+","+A+M+"H"+(T+x.width/2)+"v"+A+(2*T+x.height)+"H-"+(T+x.width/2)+"V"+A+M+"H-"+M+"Z")}else{var C,O,D;"right"===L.side?(C="start",O=1,D="",m=k._offset+k._length):(C="end",O=-1,D="-",m=k._offset),y=L._offset+(w.y0+w.y1)/2,c.attr("text-anchor",C),l.attr("d","M0,0L"+D+M+","+M+"V"+(T+x.height/2)+"h"+D+(2*T+x.width)+"V-"+(T+x.height/2)+"H"+D+M+"V-"+M+"Z");var z,R=x.height/2,I=E-x.top-R,F="clip"+a._uid+"commonlabel"+L._id;if(m=0?K-=re:K+=2*T;var ne=te.height+2*T,ae=$+ne>=R;return ne<=R&&($<=E?$=L._offset+2*T:ae&&($=R-ne)),ee.attr("transform","translate("+K+","+$+")"),ee}var ie=d.selectAll("g.hovertext").data(e,(function(e){return A(e)}));return ie.enter().append("g").classed("hovertext",!0).each((function(){var e=n.select(this);e.append("rect").call(f.fill,f.addOpacity(c,.8)),e.append("text").classed("name",!0),e.append("path").style("stroke-width","1px"),e.append("text").classed("nums",!0).call(u.font,b,_)})),ie.exit().remove(),ie.each((function(e){var t=n.select(this).attr("transform",""),o=e.bgcolor||e.color,d=f.combine(f.opacity(o)?o:f.defaultLine,c),p=f.combine(f.opacity(e.color)?e.color:f.defaultLine,c),h=e.borderColor||f.contrast(d),g=C(e,I,i,a,P,t),v=g[0],m=g[1],y=t.select("text.nums").call(u.font,e.fontFamily||b,e.fontSize||_,e.fontColor||h).text(v).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r),w=t.select("text.name"),k=0,A=0;if(m&&m!==v){w.call(u.font,e.fontFamily||b,e.fontSize||_,p).text(m).attr("data-notex",1).call(s.positionText,0,0).call(s.convertToTspans,r);var L=w.node().getBoundingClientRect();k=L.width+2*T,A=L.height+2*T}else w.remove(),t.select("rect").remove();t.select("path").style({fill:d,stroke:h});var S,O,D=y.node().getBoundingClientRect(),F=e.xa._offset+(e.x0+e.x1)/2,N=e.ya._offset+(e.y0+e.y1)/2,j=Math.abs(e.x1-e.x0),H=Math.abs(e.y1-e.y0),B=D.width+M+T+k;if(e.ty0=E-D.top,e.bx=D.width+2*T,e.by=Math.max(D.height+2*T,A),e.anchor="start",e.txwidth=D.width,e.tx2width=k,e.offset=0,l)e.pos=F,S=N+H/2+B<=R,O=N-H/2-B>=0,"top"!==e.idealAlign&&S||!O?S?(N+=H/2,e.anchor="start"):e.anchor="middle":(N-=H/2,e.anchor="end");else if(e.pos=N,S=F+j/2+B<=z,O=F-j/2-B>=0,"left"!==e.idealAlign&&S||!O)if(S)F+=j/2,e.anchor="start";else{e.anchor="middle";var U=B/2,q=F+U-z,V=F-U;q>0&&(F-=q),V<0&&(F+=-V)}else F-=j/2,e.anchor="end";y.attr("text-anchor",e.anchor),k&&w.attr("text-anchor",e.anchor),t.attr("transform","translate("+F+","+N+")"+(l?"rotate("+x+")":""))})),ie}function C(e,t,r,n,a,i){var l="",s="";void 0!==e.nameOverride&&(e.name=e.nameOverride),e.name&&(e.trace._meta&&(e.name=o.templateString(e.name,e.trace._meta)),l=z(e.name,e.nameLength)),void 0!==e.zLabel?(void 0!==e.xLabel&&(s+="x: "+e.xLabel+"
"),void 0!==e.yLabel&&(s+="y: "+e.yLabel+"
"),"choropleth"!==e.trace.type&&"choroplethmapbox"!==e.trace.type&&(s+=(s?"z: ":"")+e.zLabel)):t&&e[r.charAt(0)+"Label"]===a?s=e[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===e.xLabel?void 0!==e.yLabel&&"scattercarpet"!==e.trace.type&&(s=e.yLabel):s=void 0===e.yLabel?e.xLabel:"("+e.xLabel+", "+e.yLabel+")",!e.text&&0!==e.text||Array.isArray(e.text)||(s+=(s?"
":"")+e.text),void 0!==e.extraText&&(s+=(s?"
":"")+e.extraText),i&&""===s&&!e.hovertemplate&&(""===l&&i.remove(),s=l);var c=n._d3locale,u=e.hovertemplate||!1,f=e.hovertemplateLabels||e,d=e.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,e.trace._meta)).replace(L,(function(t,r){return l=z(r,e.nameLength),""}))),[s,l]}function P(e,t){e.each((function(e){var r=n.select(this);if(e.del)return r.remove();var a=r.select("text.nums"),i=e.anchor,o="end"===i?-1:1,l={start:1,end:-1,middle:0}[i],c=l*(M+T),f=c+l*(e.txwidth+T),d=0,p=e.offset;"middle"===i&&(c-=e.tx2width/2,f+=e.txwidth/2+T),t&&(p*=-k,d=e.offset*w),r.select("path").attr("d","middle"===i?"M-"+(e.bx/2+e.tx2width/2)+","+(p-e.by/2)+"h"+e.bx+"v"+e.by+"h-"+e.bx+"Z":"M0,0L"+(o*M+d)+","+(M+p)+"v"+(e.by/2-M)+"h"+o*e.bx+"v-"+e.by+"H"+(o*M+d)+"V"+(p-M)+"Z");var h=c+d,g=p+e.ty0-e.by/2+T,v=e.textAlign||"auto";"auto"!==v&&("left"===v&&"start"!==i?(a.attr("text-anchor","start"),h="middle"===i?-e.bx/2-e.tx2width/2+T:-e.bx-T):"right"===v&&"end"!==i&&(a.attr("text-anchor","end"),h="middle"===i?e.bx/2-e.tx2width/2-T:e.bx+T)),a.call(s.positionText,h,g),e.tx2width&&(r.select("text.name").call(s.positionText,f+l*T+d,p+e.ty0-e.by/2+T),r.select("rect").call(u.setRect,f+(l-1)*e.tx2width/2+d,p-e.by/2-1,e.tx2width,e.by+2))}))}function O(e,t){var r=e.index,n=e.trace||{},i=e.cd[0],l=e.cd[r]||{};function s(e){return e||a(e)&&0===e}var c=Array.isArray(r)?function(e,t){var a=o.castOption(i,r,e);return s(a)?a:o.extractOption({},n,"",t)}:function(e,t){return o.extractOption(l,n,e,t)};function u(t,r,n){var a=c(r,n);s(a)&&(e[t]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),e.posref="y"===t||"closest"===t&&"h"===n.orientation?e.xa._offset+(e.x0+e.x1)/2:e.ya._offset+(e.y0+e.y1)/2,e.x0=o.constrain(e.x0,0,e.xa._length),e.x1=o.constrain(e.x1,0,e.xa._length),e.y0=o.constrain(e.y0,0,e.ya._length),e.y1=o.constrain(e.y1,0,e.ya._length),void 0!==e.xLabelVal&&(e.xLabel="xLabel"in e?e.xLabel:p.hoverLabelText(e.xa,e.xLabelVal),e.xVal=e.xa.c2d(e.xLabelVal)),void 0!==e.yLabelVal&&(e.yLabel="yLabel"in e?e.yLabel:p.hoverLabelText(e.ya,e.yLabelVal),e.yVal=e.ya.c2d(e.yLabelVal)),void 0!==e.zLabelVal&&void 0===e.zLabel&&(e.zLabel=String(e.zLabelVal)),!(isNaN(e.xerr)||"log"===e.xa.type&&e.xerr<=0)){var f=p.tickText(e.xa,e.xa.c2l(e.xerr),"hover").text;void 0!==e.xerrneg?e.xLabel+=" +"+f+" / -"+p.tickText(e.xa,e.xa.c2l(e.xerrneg),"hover").text:e.xLabel+=" \xb1 "+f,"x"===t&&(e.distance+=1)}if(!(isNaN(e.yerr)||"log"===e.ya.type&&e.yerr<=0)){var d=p.tickText(e.ya,e.ya.c2l(e.yerr),"hover").text;void 0!==e.yerrneg?e.yLabel+=" +"+d+" / -"+p.tickText(e.ya,e.ya.c2l(e.yerrneg),"hover").text:e.yLabel+=" \xb1 "+d,"y"===t&&(e.distance+=1)}var h=e.hoverinfo||e.trace.hoverinfo;return h&&"all"!==h&&(-1===(h=Array.isArray(h)?h:h.split("+")).indexOf("x")&&(e.xLabel=void 0),-1===h.indexOf("y")&&(e.yLabel=void 0),-1===h.indexOf("z")&&(e.zLabel=void 0),-1===h.indexOf("text")&&(e.text=void 0),-1===h.indexOf("name")&&(e.name=void 0)),e}function D(e,t,r){var n,a,o=r.container,l=r.fullLayout,s=l._size,c=r.event,d=!!t.hLinePoint,h=!!t.vLinePoint;if(o.selectAll(".spikeline").remove(),h||d){var g=f.combine(l.plot_bgcolor,l.paper_bgcolor);if(d){var v,m,y=t.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,g)<1.5?f.contrast(g):y.color,w=a.spikemode,k=a.spikethickness,M=a.spikecolor||_,T=p.getPxPosition(e,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=T,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":k,stroke:M,"stroke-dasharray":u.dashStyle(a.spikedash,k)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":k+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:T+("right"!==a.side?k:-k),cy:m,r:k,fill:M}).classed("spikeline",!0)}if(h){var S,C,P=t.vLinePoint;n=P&&P.xa,a=P&&P.ya,"cursor"===n.spikesnap?(S=c.pointerX,C=c.pointerY):(S=n._offset+P.x,C=a._offset+P.y);var O,D,E=i.readability(P.color,g)<1.5?f.contrast(g):P.color,z=n.spikemode,R=n.spikethickness,I=n.spikecolor||E,F=p.getPxPosition(e,n);if(-1!==z.indexOf("toaxis")||-1!==z.indexOf("across")){if(-1!==z.indexOf("toaxis")&&(O=F,D=C),-1!==z.indexOf("across")){var N=n._counterDomainMin,j=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),j=Math.max(j,n.position)),O=s.t+(1-j)*s.h,D=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:O,y2:D,"stroke-width":R,stroke:I,"stroke-dasharray":u.dashStyle(n.spikedash,R)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:O,y2:D,"stroke-width":R+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==z.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==n.side?R:-R),r:R,fill:I}).classed("spikeline",!0)}}}function E(e,t){return!t||(t.vLinePoint!==e._spikepoints.vLinePoint||t.hLinePoint!==e._spikepoints.hLinePoint)}function z(e,t){return s.plainText(e||"",{len:t,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":180,"../../lib/events":171,"../../lib/override_cursor":191,"../../lib/svg_text_utils":201,"../../plots/cartesian/axes":225,"../../registry":275,"../color":52,"../dragelement":71,"../drawing":74,"../legend/defaults":104,"../legend/draw":105,"./constants":86,"./helpers":88,d3:15,"fast-isnumeric":17,tinycolor2:34}],90:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../color"),i=e("./helpers").isUnifiedHover;t.exports=function(e,t,r,o){function l(e){o.font[e]||(o.font[e]=t.legend?t.legend.font[e]:t.font[e])}o=o||{},t&&i(t.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),t.legend?(o.bgcolor||(o.bgcolor=a.combine(t.legend.bgcolor,t.paper_bgcolor)),o.bordercolor||(o.bordercolor=t.legend.bordercolor)):o.bgcolor||(o.bgcolor=t.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":180,"../color":52,"./helpers":88}],91:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,r){function i(r,i){return void 0!==t[r]?t[r]:n.coerce(e,t,a,r,i)}var o,l=i("clickmode");return t._has("cartesian")?l.indexOf("select")>-1?o="closest":(t._isHoriz=function(e,t){for(var r=t._scatterStackOpts||{},n=0;n1){if(!d&&!p&&!h)"independent"===M("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===M("roworder"),w=d?.2:.1,k=d?.3:.1;g&&t._splomGridDflt&&(x=t._splomGridDflt.xside,b=t._splomGridDflt.yside),v._domains={x:u("x",M,w,x,y),y:u("y",M,k,b,m,_)}}else delete t.grid}function M(e,t){return n.coerce(r,v,s,e,t)}},contentDefaults:function(e,t){var r=t.grid;if(r&&r._domains){var n,a,i,o,l,s,u,d=e.grid||{},p=t._subplots,h=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(h){var x=d.subplots||[];s=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var v=i.newContainer(t,"legend");if(_("uirevision",t.uirevision),!1!==g){_("bgcolor",t.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",t.font);var m,y,x,b=_("orientation");"h"===b?(m=0,n.getComponentMethod("rangeslider","isVisible")(e.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(t.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",t.font))}}function _(e,t){return a.coerce(c,v,o,e,t)}}},{"../../lib":180,"../../plot_api/plot_template":215,"../../plots/layout_attributes":264,"../../registry":275,"./attributes":102,"./helpers":108}],105:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib/events"),s=e("../dragelement"),c=e("../drawing"),u=e("../color"),f=e("../../lib/svg_text_utils"),d=e("./handle_click"),p=e("./constants"),h=e("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=e("./get_legend_data"),x=e("./style"),b=e("./helpers");function _(e,t,r,n,a){var i=r.data()[0][0].trace,s={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:e.data,layout:e.layout,frames:e._transitionData._frames,config:e._context,fullData:e._fullData,fullLayout:e._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=r.datum()[0].label),!1!==l.triggerHandler(e,"plotly_legendclick",s))if(1===n)t._clickTimeout=setTimeout((function(){d(r,e,n)}),e._context.doubleClickDelay);else if(2===n){t._clickTimeout&&clearTimeout(t._clickTimeout),e._legendMouseDownTime=0,!1!==l.triggerHandler(e,"plotly_legenddoubleclick",s)&&d(r,e,n)}}function w(e,t,r){var n,i=e.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=r._main&&t._context.edits.legendText&&!s,h=r._maxNameLength;r.entries?n=i.text:(n=s?i.label:l.name,l._meta&&(n=a.templateString(n,l._meta)));var g=a.ensureSingle(e,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,r.font).text(d?k(n,h):n),f.positionText(g,p.textGap,0),d?g.call(f.makeEditable,{gd:t,text:n}).call(T,e,t,r).on("edit",(function(n){this.text(k(n,h)).call(T,e,t,r);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),s=d.constructUpdate()}else s.name=n;return o.call("_guiRestyle",t,s,u)})):T(g,e,t,r)}function k(e,t){var r=Math.max(4,t);if(e&&e.trim().length>=r/2)return e;for(var n=r-(e=e||"").length;n>0;n--)e+=" ";return e}function M(e,t){var r,i=t._context.doubleClickDelay,o=1,l=a.ensureSingle(e,"rect","legendtoggle",(function(e){e.style("cursor","pointer").attr("pointer-events","all").call(u.fill,"rgba(0,0,0,0)")}));l.on("mousedown",(function(){(r=(new Date).getTime())-t._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(t,r,e,o,n.event)}}))}function T(e,t,r,n){n._main||e.attr("data-notex",!0),f.convertToTspans(e,r,(function(){!function(e,t,r){var n=e.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void e.remove();var a=e.select("g[class*=math-group]"),i=a.node();r||(r=t._fullLayout.legend);var o,l,s=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=e.select(n?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);n?f.positionText(h,p.textGap,-y):f.positionText(h,p.titlePad+s,u+s)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=l):(r._titleWidth=l,r._titleHeight=o)}(t,r,n)}))}function A(e){return a.isRightAnchor(e)?"right":a.isCenterAnchor(e)?"center":"left"}function L(e){return a.isBottomAnchor(e)?"bottom":a.isMiddleAnchor(e)?"middle":"top"}t.exports=function(e,t){var r,l=e._fullLayout,f="legend"+l._uid;if(t?(r=t.layer,f+="-hover"):((t=l.legend||{})._main=!0,r=l._infolayer),r){var d;if(e._legendMouseDownTime||(e._legendMouseDownTime=0),t._main){if(!e.calcdata)return;d=l.showlegend&&y(e.calcdata,t)}else{if(!t.entries)return;d=y(t.entries,t)}var h=l.hiddenlabels||[];if(t._main&&(!l.showlegend||!d.length))return r.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(e,"legend");var g=a.ensureSingle(r,"g","legend",(function(e){t._main&&e.attr("pointer-events","all")})),k=a.ensureSingleById(l._topdefs,"clipPath",f,(function(e){e.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(e){e.attr("shape-rendering","crispEdges")}));S.call(u.stroke,t.bordercolor).call(u.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),P=t.title;if(t._titleWidth=0,t._titleHeight=0,P.text){var O=a.ensureSingle(C,"text","legendtitletext");O.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,P.font).text(P.text),T(O,C,e,t)}else C.selectAll(".legendtitletext").remove();var D=a.ensureSingle(g,"rect","scrollbar",(function(e){e.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),E=C.selectAll("g.groups").data(d);E.enter().append("g").attr("class","groups"),E.exit().remove();var z=E.selectAll("g.traces").data(a.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.style("opacity",(function(e){var t=e[0].trace;return o.traceIs(t,"pie-like")?-1!==h.indexOf(e[0].label)?.5:1:"legendonly"===t.visible?.5:1})).each((function(){n.select(this).call(w,e,t)})).call(x,e,t).each((function(){t._main&&n.select(this).call(M,e)})),a.syncOrAsync([i.previousPromises,function(){return function(e,t,r,a){var i=e._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.textGap,h=p.itemGap,g=2*(u+h),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(e){var t=0,r=0,n=e.title.side;n&&(-1!==n.indexOf("left")&&(t=e._titleWidth),-1!==n.indexOf("top")&&(r=e._titleHeight));return[t,r]}(a);if(l)r.each((function(e){var t=e[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+t/2+h),a._height+=t,a._width=Math.max(a._width,e[0].width)})),x=d+a._width,a._width+=h+d+f,a._height+=g,s&&(t.each((function(e,t){c.setTranslate(this,0,t*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),k=a.x<0||0===a.x&&"right"===w,M=a.x>1||1===a.x&&"left"===w,T=y||m,S=i.width/2;a._maxWidth=Math.max(k?T&&"left"===w?o.l+o.w:S:M?T&&"right"===w?o.r+o.w:S:o.w,2*d);var C=0,P=0;r.each((function(e){var t=e[0].width+d;C=Math.max(C,t),P+=t})),x=null;var O=0;if(s){var D=0,E=0,z=0;t.each((function(){var e=0,t=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+h+n/2+t),t+=n,e=Math.max(e,d+r[0].width)})),D=Math.max(D,t);var r=e+h;r+u+E>a._maxWidth&&(O=Math.max(O,E),E=0,z+=D+a.tracegroupgap,D=t),c.setTranslate(this,E,z),E+=r})),a._width=Math.max(O,E)+u,a._height=z+D+g}else{var R=r.size(),I=P+f+(R-1)*ha._maxWidth&&(O=Math.max(O,H),N=0,j+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+j+t/2+h),H=N+r+h,N+=n,F=Math.max(F,t)})),I?(a._width=N+f,a._height=F+g):(a._width=Math.max(O,H)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var B=e._context.edits,U=B.legendText||B.legendPosition;r.each((function(e){var t=n.select(this).select(".legendtoggle"),r=e[0].height,a=U?d:x||d+e[0].width;l||(a+=h/2),c.setRect(t,0,-r/2,a,r)}))}(e,E,z,t)},function(){if(!t._main||!function(e){var t=e._fullLayout.legend,r=A(t),n=L(t);return i.autoMargin(e,"legend",{x:t.x,y:t.y,l:t._width*v[r],r:t._width*m[r],b:t._effHeight*m[n],t:t._effHeight*v[n]})}(e)){var u,d,h,y,x=l._size,b=t.borderwidth,w=x.l+x.w*t.x-v[A(t)]*t._width,M=x.t+x.h*(1-t.y)-v[L(t)]*t._effHeight;if(t._main&&l.margin.autoexpand){var T=w,P=M;w=a.constrain(w,0,l.width-t._width),M=a.constrain(M,0,l.height-t._effHeight),w!==T&&a.log("Constrain legend.x to make legend fit inside graph"),M!==P&&a.log("Constrain legend.y to make legend fit inside graph")}if(t._main&&c.setTranslate(g,w,M),D.on(".drag",null),g.on("wheel",null),!t._main||t._height<=t._maxHeight||e._context.staticPlot){var O=t._effHeight;t._main||(O=t._height),S.attr({width:t._width-b,height:O-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),k.select("rect").attr({width:t._width-2*b,height:O-2*b,x:b,y:b}),c.setClipUrl(C,f,e),c.setRect(D,0,0,0,0),delete t._scrollY}else{var E,z,R,I=Math.max(p.scrollBarMinHeight,t._effHeight*t._effHeight/t._height),F=t._effHeight-I-2*p.scrollBarMargin,N=t._height-t._effHeight,j=F/N,H=Math.min(t._scrollY||0,N);S.attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-b,x:b/2,y:b/2}),k.select("rect").attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-2*b,x:b,y:b+H}),c.setClipUrl(C,f,e),q(H,I,j),g.on("wheel",(function(){q(H=a.constrain(t._scrollY+n.event.deltaY/F*N,0,N),I,j),0!==H&&H!==N&&n.event.preventDefault()}));var B=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;E="touchstart"===e.type?e.changedTouches[0].clientY:e.clientY,R=H})).on("drag",(function(){var e=n.event.sourceEvent;2===e.buttons||e.ctrlKey||(z="touchmove"===e.type?e.changedTouches[0].clientY:e.clientY,q(H=function(e,t,r){var n=(r-t)/j+e;return a.constrain(n,0,N)}(R,E,z),I,j))}));D.call(B);var U=n.behavior.drag().on("dragstart",(function(){var e=n.event.sourceEvent;"touchstart"===e.type&&(E=e.changedTouches[0].clientY,R=H)})).on("drag",(function(){var e=n.event.sourceEvent;"touchmove"===e.type&&(z=e.changedTouches[0].clientY,q(H=function(e,t,r){var n=(t-r)/j+e;return a.constrain(n,0,N)}(R,E,z),I,j))}));C.call(U)}if(e._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:e,prepFn:function(){var e=c.getTranslate(g);h=e.x,y=e.y},moveFn:function(e,r){var n=h+e,a=y+r;c.setTranslate(g,n,a),u=s.align(n,0,x.l,x.l+x.w,t.xanchor),d=s.align(a,0,x.t+x.h,x.t,t.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",e,{"legend.x":u,"legend.y":d})},clickFn:function(t,n){var a=r.selectAll("g.traces").filter((function(){var e=this.getBoundingClientRect();return n.clientX>=e.left&&n.clientX<=e.right&&n.clientY>=e.top&&n.clientY<=e.bottom}));a.size()>0&&_(e,g,a,t,n)}})}function q(r,n,a){t._scrollY=e._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(D,t._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),k.select("rect").attr("y",b+r)}}],e)}}},{"../../constants/alignment":154,"../../lib":180,"../../lib/events":171,"../../lib/svg_text_utils":201,"../../plots/plots":266,"../../registry":275,"../color":52,"../dragelement":71,"../drawing":74,"./constants":103,"./get_legend_data":106,"./handle_click":107,"./helpers":108,"./style":110,d3:15}],106:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("./helpers");t.exports=function(e,t){var r,i,o={},l=[],s=!1,c={},u=0,f=0,d=t._main;function p(e,r){if(""!==e&&a.isGrouped(t))-1===l.indexOf(e)?(l.push(e),s=!0,o[e]=[[r]]):o[e].push([r]);else{var n="~~i"+u;l.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=t.width}return h?n:Math.min(a,r)};function v(e,t,r){var i=e[0].trace,o=i.marker||{},s=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(c?[e]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.each((function(e){var t=n.select(this),r=e[0],a=g(r.mlw,o.line,5,2);t.style("stroke-width",a+"px").call(l.fill,r.mc||o.color),a&&l.stroke(t,r.mlc||s.color)}))}function m(e,t,r){var o=e[0],l=o.trace,s=r?l.visible&&l.type===r:a.traceIs(l,r),c=n.select(t).select("g.legendpoints").selectAll("path.legend"+r).data(s?[e]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.size()){var d=(l.marker||{}).line,p=g(f(d.width,o.pts),d,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=d.color;var v=i.minExtend(o,{trace:h});u(c,v,h)}}e.each((function(e){var t=n.select(this),a=i.ensureSingle(t,"g","layers");a.style("opacity",e[0].trace.opacity);var o=r.valign,l=e[0].lineHeight,s=e[0].height;if("middle"!==o&&l&&s){var c={top:1,bottom:-1}[o]*(.5*(l-s+3));a.attr("transform","translate(0,"+c+")")}else a.attr("transform",null);a.selectAll("g.legendfill").data([e]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([e]).enter().append("g").classed("legendlines",!0);var u=a.selectAll("g.legendsymbols").data([e]);u.enter().append("g").classed("legendsymbols",!0),u.selectAll("g.legendpoints").data([e]).enter().append("g").classed("legendpoints",!0)})).each((function(e){var r,a=e[0].trace,c=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":c=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":c=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":c=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":c=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":c=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":c=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(c);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),u.exit().remove(),u.each((function(e,c){var u,f=n.select(this),p=s(a),h=p.colorscale,g=p.reversescale;if(h){if(!r){var v=h.length;u=0===c?h[g?v-1:0][1]:1===c?h[g?0:v-1][1]:h[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[c]||m[0]:m}f.attr("d",e[0]),u?f.call(l.fill,u):f.call((function(e){if(e.size()){var n="legendfill-"+a.uid;o.gradient(e,t,n,d(g,"radial"===r),h,"fill")}}))}))})).each((function(e){var t=e[0].trace,r="waterfall"===t.type;if(e[0]._distinct&&r){var a=e[0].trace[e[0].dir].marker;return e[0].mc=a.color,e[0].mlw=a.line.width,e[0].mlc=a.line.color,v(e,this,"waterfall")}var i=[];t.visible&&r&&(i=e[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(e){var r=n.select(this),a=t[e[0]].marker,i=g(void 0,a.line,5,2);r.attr("d",e[1]).style("stroke-width",i+"px").call(l.fill,a.color),i&&r.call(l.stroke,a.line.color)}))})).each((function(e){v(e,this,"funnel")})).each((function(e){v(e,this)})).each((function(e){var r=e[0].trace,s=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[e]:[]);s.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),s.exit().remove(),s.each((function(){var e=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var a=g(void 0,r.line,5,2);e.style("stroke-width",a+"px").call(l.fill,r.fillcolor),a&&l.stroke(e,r.line.color)}else{var c=i.minExtend(r,{marker:{size:h?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});s.call(o.pointStyle,c,t)}}))})).each((function(e){m(e,this,"funnelarea")})).each((function(e){m(e,this,"pie")})).each((function(e){var r,a,l=e[0],u=l.trace,f=u.visible&&u.fill&&"none"!==u.fill,p=c.hasLines(u),h=u.contours,v=!1,m=!1,y=s(u),x=y.colorscale,b=y.reversescale;if(h){var _=h.coloring;"lines"===_?v=!0:p="none"===_||"heatmap"===_||h.showlines,"constraint"===h.type?f="="!==h._operation:"fill"!==_&&"heatmap"!==_||(m=!0)}var w=c.hasMarkers(u)||c.hasText(u),k=f||m,M=p||v,T=w||!k?"M5,0":M?"M5,-2":"M5,-3",A=n.select(this),L=A.select(".legendfill").selectAll("path").data(f||m?[e]:[]);if(L.enter().append("path").classed("js-fill",!0),L.exit().remove(),L.attr("d",T+"h30v6h-30z").call(f?o.fillGroupStyle:function(e){if(e.size()){var r="legendfill-"+u.uid;o.gradient(e,t,r,d(b),x,"fill")}}),p||v){var S=g(void 0,u.line,10,5);a=i.minExtend(u,{line:{width:S}}),r=[i.minExtend(l,{trace:a})]}var C=A.select(".legendlines").selectAll("path").data(p||v?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",T+(v?"l30,0.0001":"h30")).call(p?o.lineGroupStyle:function(e){if(e.size()){var r="legendline-"+u.uid;o.lineGroupStyle(e),o.gradient(e,t,r,d(b),x,"stroke")}})})).each((function(e){var r,a,l=e[0],s=l.trace,u=c.hasMarkers(s),f=c.hasText(s),d=c.hasLines(s);function p(e,t,r,n){var a=i.nestedProperty(s,e).get(),o=i.isArrayOrTypedArray(a)&&t?t(a):a;if(h&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(e){return l._distinct&&l.index&&e[l.index]?e[l.index]:e[0]}if(u||f||d){var v={},m={};if(u){v.mc=p("marker.color",g),v.mx=p("marker.symbol",g),v.mo=p("marker.opacity",i.mean,[.2,1]),v.mlc=p("marker.line.color",g),v.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);v.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",g,[0,10],5)}),f&&(v.tx="Aa",v.tp=p("textposition",g),v.ts=10,v.tc=p("textfont.color",g),v.tf=p("textfont.family",g)),r=[i.minExtend(l,v)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var x=n.select(this).select("g.legendpoints"),b=x.selectAll("path.scatterpts").data(u?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),b.exit().remove(),b.call(o.pointStyle,a,t),u&&(r[0].mrc=3);var _=x.selectAll("g.pointtext").data(f?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.selectAll("text").call(o.textPointStyle,a,t)})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(t.visible&&"candlestick"===t.type?[e,e]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",(function(e,t){return t?"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(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],o=g(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(l.fill,i.fillcolor),o&&l.stroke(a,i.line.color)}))})).each((function(e){var t=e[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(t.visible&&"ohlc"===t.type?[e,e]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",(function(e,t){return t?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"})).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each((function(e,r){var a=n.select(this),i=t[r?"increasing":"decreasing"],s=g(void 0,i.line,5,2);a.style("fill","none").call(o.dashLine,i.line.dash,s),s&&l.stroke(a,i.line.color)}))}))}},{"../../lib":180,"../../registry":275,"../../traces/pie/helpers":294,"../../traces/pie/style_one":295,"../../traces/scatter/subtypes":321,"../color":52,"../colorscale/helpers":63,"../drawing":74,d3:15}],111:[function(e,t,r){"use strict";var n=e("../../registry"),a=e("../../plots/plots"),i=e("../../plots/cartesian/axis_ids"),o=e("../../fonts/ploticon"),l=e("../shapes/draw").eraseActiveShape,s=e("../../lib"),c=s._,u=t.exports={};function f(e,t){var r,a,o=t.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=e._fullLayout,u={},f=i.list(e,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(e){for(var t=0;t0)){var g=function(e,t,r){for(var n=r.filter((function(r){return t[r].anchor===e._id})),a=0,i=0;i=n.max)t=I[r+1];else if(e=n.pmax)t=I[r+1];else if(e0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(e,t,r,n,a){var l="category"===e.type||"multicategory"===e.type?e.r2c:e.d2c;if(void 0!==t)return[l(t),l(r)];if(n){var s,c,u,f,d=1/0,p=-1/0,h=n.match(i.segmentRE);for("date"===e.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]:void 0}}t.exports=function(e){var t=e._fullLayout,r=n.filterVisible(t.shapes);if(r.length&&e._fullData.length)for(var o=0;oy?(M=f,S="y0",T=y,C="y1"):(M=y,S="y1",T=f,C="y0");Y(n),J(l,r),function(e,t,r){var n=t.xref,a=t.yref,o=i.getFromId(r,n),l=i.getFromId(r,a),s="";"paper"===n||o.autorange||(s+=n);"paper"===a||l.autorange||(s+=a);u.setClipUrl(e,s?"clip"+r._fullLayout._uid+s:null,r)}(t,r,e),Z.moveFn="move"===E?X:W,Z.altKey=n.altKey},doneFn:function(){if(m(e))return;p(t),Q(l),b(t,e,r),n.call("_guiRelayout",e,s.getUpdateObj())},clickFn:function(){if(m(e))return;Q(l)}};function Y(r){if(m(e))E=null;else if(I)E="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=Z.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,l=r.clientY-n.top,s=!F&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-l/i):"move";p(t,s),E=s.split("-")[0]}}function X(n,a){if("path"===r.type){var i=function(e){return e},o=i,s=i;z?N("xanchor",r.xanchor=q(x+n)):(o=function(e){return q(B(e)+n)},j&&"date"===j.type&&(o=g.encodeDate(o))),R?N("yanchor",r.yanchor=V(k+a)):(s=function(e){return V(U(e)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",r.path=w(D,o,s))}else z?N("xanchor",r.xanchor=q(x+n)):(N("x0",r.x0=q(c+n)),N("x1",r.x1=q(v+n))),R?N("yanchor",r.yanchor=V(k+a)):(N("y0",r.y0=V(f+a)),N("y1",r.y1=V(y+a)));t.attr("d",_(e,r)),J(l,r)}function W(n,a){if(F){var i=function(e){return e},o=i,s=i;z?N("xanchor",r.xanchor=q(x+n)):(o=function(e){return q(B(e)+n)},j&&"date"===j.type&&(o=g.encodeDate(o))),R?N("yanchor",r.yanchor=V(k+a)):(s=function(e){return V(U(e)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",r.path=w(D,o,s))}else if(I){if("resize-over-start-point"===E){var u=c+n,d=R?f-a:f+a;N("x0",r.x0=z?u:q(u)),N("y0",r.y0=R?d:V(d))}else if("resize-over-end-point"===E){var p=v+n,h=R?y-a:y+a;N("x1",r.x1=z?p:q(p)),N("y1",r.y1=R?h:V(h))}}else{var m=function(e){return-1!==E.indexOf(e)},b=m("n"),G=m("s"),Z=m("w"),Y=m("e"),X=b?M+a:M,W=G?T+a:T,Q=Z?A+n:A,$=Y?L+n:L;R&&(b&&(X=M-a),G&&(W=T-a)),(!R&&W-X>10||R&&X-W>10)&&(N(S,r[S]=R?X:V(X)),N(C,r[C]=R?W:V(W))),$-Q>10&&(N(P,r[P]=z?Q:q(Q)),N(O,r[O]=z?$:q($)))}t.attr("d",_(e,r)),J(l,r)}function J(e,t){(z||R)&&function(){var r="path"!==t.type,n=e.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 i=B(z?t.xanchor:a.midRange(r?[t.x0,t.x1]:g.extractPathCoords(t.path,h.paramIsX))),o=U(R?t.yanchor:a.midRange(r?[t.y0,t.y1]:g.extractPathCoords(t.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),z&&R){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(z){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function Q(e){e.selectAll(".visual-cue").remove()}d.init(Z),G.node().onmousemove=Y}(e,z,s,t,r,E):!0===s.editable&&z.style("pointer-events",O||c.opacity(L)*A<=.5?"stroke":"all");z.node().addEventListener("click",(function(){return function(e,t){if(!y(e))return;var r=+t.node().getAttribute("data-index");if(r>=0){if(r===e._fullLayout._activeShapeIndex)return void k(e);e._fullLayout._activeShapeIndex=r,e._fullLayout._deactivateShape=k,v(e)}}(e,z)}))}}function b(e,t,r){var n=(r.xref+r.yref).replace(/paper/g,"");u.setClipUrl(e,n?"clip"+t._fullLayout._uid+n:null,t)}function _(e,t){var r,n,o,l,s,c,u,f,d=t.type,p=i.getFromId(e,t.xref),v=i.getFromId(e,t.yref),m=e._fullLayout._size;if(p?(r=g.shapePositionToRange(p),n=function(e){return p._offset+p.r2p(r(e,!0))}):n=function(e){return m.l+m.w*e},v?(o=g.shapePositionToRange(v),l=function(e){return v._offset+v.r2p(o(e,!0))}):l=function(e){return m.t+m.h*(1-e)},"path"===d)return p&&"date"===p.type&&(n=g.decodeDate(n)),v&&"date"===v.type&&(l=g.decodeDate(l)),function(e,t,r){var n=e.path,i=e.xsizemode,o=e.ysizemode,l=e.xanchor,s=e.yanchor;return n.replace(h.segmentRE,(function(e){var n=0,c=e.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=e.substr(1).replace(h.paramRE,(function(e){return u[n]?e="pixel"===i?t(l)+Number(e):t(e):f[n]&&(e="pixel"===o?r(s)-Number(e):r(e)),++n>d&&(e="X"),e}));return n>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+e)),c+p}))}(t,n,l);if("pixel"===t.xsizemode){var y=n(t.xanchor);s=y+t.x0,c=y+t.x1}else s=n(t.x0),c=n(t.x1);if("pixel"===t.ysizemode){var x=l(t.yanchor);u=x-t.y0,f=x-t.y1}else u=l(t.y0),f=l(t.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var b=(s+c)/2,_=(u+f)/2,w=Math.abs(b-s),k=Math.abs(_-u),M="A"+w+","+k,T=b+w+","+_;return"M"+T+M+" 0 1,1 "+(b+","+(_-k))+M+" 0 0,1 "+T+"Z"}function w(e,t,r){return e.replace(h.segmentRE,(function(e){var n=0,a=e.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+e.substr(1).replace(h.paramRE,(function(e){return n>=l||(i[n]?e=t(e):o[n]&&(e=r(e)),n++),e}))}))}function k(e){y(e)&&(e._fullLayout._activeShapeIndex>=0&&(s(e),delete e._fullLayout._activeShapeIndex,v(e)))}t.exports={draw:v,drawOne:x,eraseActiveShape:function(e){if(!y(e))return;s(e);var t=e._fullLayout._activeShapeIndex,r=(e.layout||{}).shapes||[];if(t=0&&f(m),r.attr("d",g(t)),T&&!d)&&(M=function(e,t){for(var r=0;r1&&(2!==e.length||"Z"!==e[1][0])&&(0===k&&(e[0][0]="M"),t[w]=e,y(),x())}}()}}function D(e,r){!function(e,r){if(t.length)for(var n=0;n0&&s0&&(l=l.transition().duration(t.transition.duration).ease(t.transition.easing)),l.attr("transform","translate("+(o-.5*u.gripWidth)+","+t._dims.currentValueTotalHeight+")")}}function L(e,t){var r=e._dims;return r.inputAreaStart+u.stepInset+(r.inputAreaLength-2*u.stepInset)*Math.min(1,Math.max(0,t))}function S(e,t){var r=e._dims;return Math.min(1,Math.max(0,(t-u.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*u.stepInset-2*r.inputAreaStart)))}function C(e,t,r){var n=r._dims,a=l.ensureSingle(e,"rect",u.railTouchRectClass,(function(n){n.call(M,t,e,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,u.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function P(e,t){var r=t._dims,n=r.inputAreaLength-2*u.railInset,a=l.ensureSingle(e,"rect",u.railRectClass);a.attr({width:n,height:u.railWidth,rx:u.railRadius,ry:u.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,t.bordercolor).call(i.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px"),o.setTranslate(a,u.railInset,.5*(r.inputAreaWidth-u.railWidth)+r.currentValueTotalHeight)}t.exports=function(e){var t=e._fullLayout,r=function(e,t){for(var r=e[u.name],n=[],a=0;a0?[0]:[]);function l(t){t._commandObserver&&(t._commandObserver.remove(),delete t._commandObserver),a.autoMargin(e,g(t))}if(i.enter().append("g").classed(u.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+u.groupClassName).each(l)})).remove(),0!==r.length){var s=i.selectAll("g."+u.groupClassName).data(r,v);s.enter().append("g").classed(u.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||f<0){var v={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];t.attr("transform","translate("+v+")")}}}return z.call(R),D&&(L?z.on(".opacity",null):(M=0,T=!0,z.text(m).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)}))),z.call(u.makeEditable,{gd:e}).on("edit",(function(t){void 0!==y?o.call("_guiRestyle",e,v,t,y):o.call("_guiRelayout",e,v,t)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(R)})).on("input",(function(e){this.text(e||" ").call(u.positionText,b.x,b.y)}))),z.classed("js-placeholder",T),w}}},{"../../constants/alignment":154,"../../constants/interactions":156,"../../lib":180,"../../lib/svg_text_utils":201,"../../plots/plots":266,"../../registry":275,"../color":52,"../drawing":74,d3:15,"fast-isnumeric":17}],148:[function(e,t,r){"use strict";var n=e("../../plots/font_attributes"),a=e("../color/attributes"),i=e("../../lib/extend").extendFlat,o=e("../../plot_api/edit_types").overrideAll,l=e("../../plots/pad_attributes"),s=e("../../plot_api/plot_template").templatedArray,c=s("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"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});t.exports=o(s("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:c,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:i(l({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":172,"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../../plots/font_attributes":253,"../../plots/pad_attributes":265,"../color/attributes":51}],149:[function(e,t,r){"use strict";t.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"}}},{}],150:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../plots/array_container_defaults"),i=e("./attributes"),o=e("./constants").name,l=i.buttons;function s(e,t,r){function o(r,a){return n.coerce(e,t,i,r,a)}o("visible",a(e,t,{name:"buttons",handleItemDefaults:c}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),n.noneOrAll(e,t,["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 c(e,t){function r(r,a){return n.coerce(e,t,l,r,a)}r("visible","skip"===e.method||Array.isArray(e.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}t.exports=function(e,t){a(e,t,{name:o,handleItemDefaults:s})}},{"../../lib":180,"../../plots/array_container_defaults":221,"./attributes":148,"./constants":149}],151:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../plots/plots"),i=e("../color"),o=e("../drawing"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../plot_api/plot_template").arrayEditor,u=e("../../constants/alignment").LINE_SPACING,f=e("./constants"),d=e("./scrollbox");function p(e){return e._index}function h(e,t){return+e.attr(f.menuIndexAttrName)===t._index}function g(e,t,r,n,a,i,o,l){t.active=o,c(e.layout,f.name,t).applyUpdate("active",o),"buttons"===t.type?m(e,n,null,null,t):"dropdown"===t.type&&(a.attr(f.menuIndexAttrName,"-1"),v(e,n,a,i,t),l||m(e,n,a,i,t))}function v(e,t,r,n,a){var i=l.ensureSingle(t,"g",f.headerClassName,(function(e){e.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,e).call(A,a,d,p),l.ensureSingle(t,"text",f.headerArrowClassName,(function(e){e.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(L,String(h(r,a)?-1:a._index)),m(e,t,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(k,a)})),o.setTranslate(t,s.lx,s.ly)}function m(e,t,r,i,o){r||(r=t).attr("pointer-events","all");var s=function(e){return-1==+e.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},M={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=n.select(this);c.call(y,o,l,e).call(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(e,o,0,t,r,i,-1),a.executeAPICommand(e,l.method,l.args2)):(g(e,o,0,t,r,i,s),a.executeAPICommand(e,l.method,l.args))),e.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(k,o),u.call(_,o)}))})),u.call(_,o),x?(M.w=Math.max(m.openWidth,m.headerWidth),M.h=b.y-M.t):(M.w=b.x-M.l,M.h=Math.max(m.openHeight,m.headerHeight)),M.direction=o.direction,i&&(u.size()?function(e,t,r,n,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[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(i)})).remove(),0!==r.length){var s=o.selectAll("g."+f.headerGroupClassName).data(r,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(e){e.style("pointer-events","all")})),u=0;uw,T=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(M?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),M?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:T,height:A}),this._hbarXMin=L+T/2,this._hbarTranslateMax=w-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var P=m>k,O=l.barWidth+2*l.barPad,D=l.barLength+2*l.barPad,E=h+g,z=v;E+O>s&&(E=s-O);var R=this.container.selectAll("rect.scrollbar-vertical").data(P?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),P?(this.vbar=R.attr({rx:l.barRadius,ry:l.barRadius,x:E,y:z,width:O,height:D}),this._vbarYMin=z+D/2,this._vbarTranslateMax=k-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,F=u-.5,N=P?f+O+.5:f+.5,j=d-.5,H=M?p+A+.5:p+.5,B=o._topdefs.selectAll("#"+I).data(M||P?[0]:[]);if(B.exit().remove(),B.enter().append("clipPath").attr("id",I).append("rect"),M||P?(this._clipRect=B.select("rect").attr({x:Math.floor(F),y:Math.floor(j),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(H)-Math.floor(j)}),this.container.call(i.setClipUrl,I,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),M||P){var U=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(U);var q=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(q),P&&this.vbar.on(".drag",null).call(q)}this.setTranslate(t,r)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.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)},l.prototype._onBoxDrag=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e-=n.event.dx),this.vbar&&(t-=n.event.dy),this.setTranslate(e,t)},l.prototype._onBoxWheel=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e+=n.event.deltaY),this.vbar&&(t+=n.event.deltaY),this.setTranslate(e,t)},l.prototype._onBarDrag=function(){var e=this.translateX,t=this.translateY;if(this.hbar){var r=e+this._hbarXMin,a=r+this._hbarTranslateMax;e=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=t+this._vbarYMin,l=i+this._vbarTranslateMax;t=(o.constrain(n.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(e,t)},l.prototype.setTranslate=function(e,t){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(e=o.constrain(e||0,0,r),t=o.constrain(t||0,0,n),this.translateX=e,this.translateY=t,this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-t),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+t-.5)}),this.hbar){var a=e/r;this.hbar.call(i.setTranslate,e+a*this._hbarTranslateMax,t)}if(this.vbar){var l=t/n;this.vbar.call(i.setTranslate,e,t+l*this._vbarTranslateMax)}}},{"../../lib":180,"../color":52,"../drawing":74,d3:15}],154:[function(e,t,r){"use strict";t.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"}}},{}],155:[function(e,t,r){"use strict";t.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],156:[function(e,t,r){"use strict";t.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],157:[function(e,t,r){"use strict";t.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],158:[function(e,t,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}},{}],159:[function(e,t,r){"use strict";r.version=e("./version").version,e("es6-promise").polyfill(),e("../build/plotcss"),e("./fonts/mathjax_config")();for(var n=e("./registry"),a=r.register=n.register,i=e("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],162:[function(e,t,r){"use strict";r.isLeftAnchor=function(e){return"left"===e.xanchor||"auto"===e.xanchor&&e.x<=1/3},r.isCenterAnchor=function(e){return"center"===e.xanchor||"auto"===e.xanchor&&e.x>1/3&&e.x<2/3},r.isRightAnchor=function(e){return"right"===e.xanchor||"auto"===e.xanchor&&e.x>=2/3},r.isTopAnchor=function(e){return"top"===e.yanchor||"auto"===e.yanchor&&e.y>=2/3},r.isMiddleAnchor=function(e){return"middle"===e.yanchor||"auto"===e.yanchor&&e.y>1/3&&e.y<2/3},r.isBottomAnchor=function(e){return"bottom"===e.yanchor||"auto"===e.yanchor&&e.y<=1/3}},{}],163:[function(e,t,r){"use strict";var n=e("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,l=2*o;function s(e){return Math.abs(e[1]-e[0])>l-1e-14}function c(e,t){return i(t-e,l)}function u(e,t){if(s(t))return!0;var r,n;t[0](n=a(n,l))&&(n+=l);var i=a(e,l),o=i+l;return i>=r&&i<=n||o>=r&&o<=n}function f(e,t,r,n,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([r,n]);function v(e,t){return[e*Math.cos(t)+a,i-e*Math.sin(t)]}g?(u=0,f=o,d=l):r=a&&e<=i);var a,i},pathArc:function(e,t,r,n,a){return f(null,e,t,r,n,a,0)},pathSector:function(e,t,r,n,a){return f(null,e,t,r,n,a,1)},pathAnnulus:function(e,t,r,n,a,i){return f(e,t,r,n,a,i,1)}}},{"./mod":187}],164:[function(e,t,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(e){return a.isView(e)&&!(e instanceof i)}function l(e){return n(e)||o(e)}function s(e,t,r){if(l(e)){if(l(e[0])){for(var n=r,a=0;aa.max?t.set(r):t.set(+e)}},integer:{coerceFunction:function(e,t,r,a){e%1||!n(e)||void 0!==a.min&&ea.max?t.set(r):t.set(+e)}},string:{coerceFunction:function(e,t,r,n){if("string"!=typeof e){var a="number"==typeof e;!0!==n.strict&&a?t.set(String(e)):t.set(r)}else n.noBlank&&!e?t.set(r):t.set(e)}},color:{coerceFunction:function(e,t,r){a(e).isValid()?t.set(e):t.set(r)}},colorlist:{coerceFunction:function(e,t,r){Array.isArray(e)&&e.length&&e.every((function(e){return a(e).isValid()}))?t.set(e):t.set(r)}},colorscale:{coerceFunction:function(e,t,r){t.set(o.get(e,r))}},angle:{coerceFunction:function(e,t,r){"auto"===e?t.set("auto"):n(e)?t.set(u(+e,360)):t.set(r)}},subplotid:{coerceFunction:function(e,t,r,n){var a=n.regex||c(r);"string"==typeof e&&a.test(e)?t.set(e):t.set(r)},validateFunction:function(e,t){var r=t.dflt;return e===r||"string"==typeof e&&!!c(r).test(e)}},flaglist:{coerceFunction:function(e,t,r,n){if("string"==typeof e)if(-1===(n.extras||[]).indexOf(e)){for(var a=e.split("+"),i=0;i=n&&e<=a?e:u}if("string"!=typeof e&&"number"!=typeof e)return u;e=String(e);var c=_(t),m=e.charAt(0);!c||"G"!==m&&"g"!==m||(e=e.substr(1),t="");var w=c&&"chinese"===t.substr(0,7),k=e.match(w?x:y);if(!k)return u;var M=k[1],T=k[3]||"1",A=Number(k[5]||1),L=Number(k[7]||0),S=Number(k[9]||0),C=Number(k[11]||0);if(c){if(2===M.length)return u;var P;M=Number(M);try{var O=v.getComponentMethod("calendars","getCal")(t);if(w){var D="i"===T.charAt(T.length-1);T=parseInt(T,10),P=O.newDate(M,O.toMonthIndex(M,T,D),A)}else P=O.newDate(M,Number(T),A)}catch(e){return u}return P?(P.toJD()-g)*f+L*d+S*p+C*h:u}M=2===M.length?(Number(M)+2e3-b)%100+b:Number(M),T-=1;var E=new Date(Date.UTC(2e3,T,A,L,S));return E.setUTCFullYear(M),E.getUTCMonth()!==T||E.getUTCDate()!==A?u:E.getTime()+C*h},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(e,t){return r.dateTime2ms(e,t)!==u};var k=90*f,M=3*d,T=5*p;function A(e,t,r,n,a){if((t||r||n||a)&&(e+=" "+w(t,2)+":"+w(r,2),(n||a)&&(e+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;e+="."+w(a,i)}return e}r.ms2DateTime=function(e,t,r){if("number"!=typeof e||!(e>=n&&e<=a))return u;t||(t=0);var i,o,l,c,y,x,b=Math.floor(10*s(e+.05,1)),w=Math.round(e-b/10);if(_(r)){var L=Math.floor(w/f)+g,S=Math.floor(s(e,f));try{i=v.getComponentMethod("calendars","getCal")(r).fromJD(L).formatDate("yyyy-mm-dd")}catch(e){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=t=n+f&&e<=a-f))return u;var t=Math.floor(10*s(e+.05,1)),r=new Date(Math.round(e-t/10));return A(i("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+t)},r.cleanDate=function(e,t,n){if(e===u)return t;if(r.isJSDate(e)||"number"==typeof e&&isFinite(e)){if(_(n))return l.error("JS Dates and milliseconds are incompatible with world calendars",e),t;if(!(e=r.ms2DateTimeLocal(+e))&&void 0!==t)return t}else if(!r.isDateTime(e,n))return l.error("unrecognized date",e),t;return e};var L=/%\d?f/g;function S(e,t,r,n){e=e.replace(L,(function(e){var r=Math.min(+e.charAt(1)||6,6);return(t/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(t+.05));if(_(n))try{e=v.getComponentMethod("calendars","worldCalFmt")(e,t,n)}catch(e){return"Invalid"}return r(e)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(e,t,r,n,a,i){if(a=_(a)&&a,!t)if("y"===r)t=i.year;else if("m"===r)t=i.month;else{if("d"!==r)return function(e,t){var r=s(e+.05,f),n=w(Math.floor(r/d),2)+":"+w(s(Math.floor(r/p),60),2);if("M"!==t){o(t)||(t=0);var a=(100+Math.min(s(e/h,60),C[t])).toFixed(t).substr(1);t>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(e,r)+"\n"+S(i.dayMonthYear,e,n,a);t=i.dayMonth+"\n"+i.year}return S(t,e,n,a)};var P=3*f;r.incrementMonth=function(e,t,r){r=_(r)&&r;var n=s(e,f);if(e=Math.round(e-n),r)try{var a=Math.round(e/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return t%12?i.add(o,t,"m"):i.add(o,t/12,"y"),(o.toJD()-g)*f+n}catch(t){l.error("invalid ms "+e+" in calendar "+r)}var c=new Date(e+P);return c.setUTCMonth(c.getUTCMonth()+t)+n-P},r.findExactDates=function(e,t){for(var r,n,a=0,i=0,l=0,s=0,c=_(t)&&v.getComponentMethod("calendars","getCal")(t),u=0;u0&&e[t+1][0]<0)return t;return null}switch(t="RUS"===l||"FJI"===l?function(e){var t;if(null===c(e))t=e;else for(t=new Array(e.length),a=0;at?r[n++]=[e[a][0]+360,e[a][1]]:a===t?(r[n++]=e[a],r[n++]=[e[a][0],-90]):r[n++]=e[a];var i=d.tester(r);i.pts.pop(),s.push(i)}:function(e){s.push(d.tester(e))},i.type){case"MultiPolygon":for(r=0;ra&&(a=c,t=s)}else t=r;return o.default(t).geometry.coordinates}(u),n.fIn=e,n.fOut=u,l.push(u)}else c.log(["Location",n.loc,"does not have a valid GeoJSON geometry.","Traces with locationmode *geojson-id* only support","*Polygon* and *MultiPolygon* geometries."].join(" "))}delete a[r]}switch(r.type){case"FeatureCollection":var d=r.features;for(n=0;n100?(clearInterval(i),n("Unexpected error while fetching from "+e)):void a++}),50)}))}for(var o=0;o0&&(r.push(a),a=[])}return a.length>0&&r.push(a),r},r.makeLine=function(e){return 1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}},r.makePolygon=function(e){if(1===e.length)return{type:"Polygon",coordinates:e};for(var t=new Array(e.length),r=0;r1||g<0||g>1?null:{x:e+s*g,y:t+f*g}}function s(e,t,r,n,a){var i=n*e+a*t;if(i<0)return n*n+a*a;if(i>r){var o=n-e,l=a-t;return o*o+l*l}var s=n*t-a*e;return s*s/r}r.segmentsIntersect=l,r.segmentDistance=function(e,t,r,n,a,i,o,c){if(l(e,t,r,n,a,i,o,c))return 0;var u=r-e,f=n-t,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-e,i-t),s(u,f,h,o-e,c-t),s(d,p,g,e-a,t-i),s(d,p,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(e,t,r,l){if(e===a&&l===i||(n={},a=e,i=l),n[r])return n[r];var s=e.getPointAtLength(o(r-l/2,t)),c=e.getPointAtLength(o(r+l/2,t)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=e.getPointAtLength(o(r,t)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(e,t,r){var n,a,i=t.left,o=t.right,l=t.top,s=t.bottom,c=0,u=e.getTotalLength(),f=u;function d(t){var r=e.getPointAtLength(t);0===t?n=r:t===u&&(a=r);var c=r.xo?r.x-o:0,f=r.ys?r.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+r)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+r))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(e,t,r,n){for(var a,i,o,l=(n=n||{}).pathLength||e.getTotalLength(),s=n.tolerance||.001,c=n.iterationLimit||30,u=e.getPointAtLength(0)[r]>e.getPointAtLength(l)[r]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":187}],178:[function(e,t,r){"use strict";t.exports=function(e){return e}},{}],179:[function(e,t,r){"use strict";t.exports=function(e,t){if(!t)return e;var r=1/Math.abs(t),n=r>1?(r*e+r*t)/r:e+t,a=String(n).length;if(a>16){var i=String(t).length;if(a>=String(e).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],180:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../constants/numerical"),l=o.FP_SAFE,s=o.BADNUM,c=t.exports={};c.nestedProperty=e("./nested_property"),c.keyedContainer=e("./keyed_container"),c.relativeAttr=e("./relative_attr"),c.isPlainObject=e("./is_plain_object"),c.toLogRange=e("./to_log_range"),c.relinkPrivateKeys=e("./relink_private");var u=e("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=e("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var d=e("./coerce");c.valObjectMeta=d.valObjectMeta,c.coerce=d.coerce,c.coerce2=d.coerce2,c.coerceFont=d.coerceFont,c.coerceHoverinfo=d.coerceHoverinfo,c.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,c.validate=d.validate;var p=e("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var h=e("./search");c.findBin=h.findBin,c.sorterAsc=h.sorterAsc,c.sorterDes=h.sorterDes,c.distinctVals=h.distinctVals,c.roundUp=h.roundUp,c.sort=h.sort,c.findIndexOfMin=h.findIndexOfMin;var g=e("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var v=e("./matrix");c.init2dArray=v.init2dArray,c.transposeRagged=v.transposeRagged,c.dot=v.dot,c.translationMatrix=v.translationMatrix,c.rotationMatrix=v.rotationMatrix,c.rotationXYMatrix=v.rotationXYMatrix,c.apply2DTransform=v.apply2DTransform,c.apply2DTransform2=v.apply2DTransform2;var m=e("./angles");c.deg2rad=m.deg2rad,c.rad2deg=m.rad2deg,c.angleDelta=m.angleDelta,c.angleDist=m.angleDist,c.isFullCircle=m.isFullCircle,c.isAngleInsideSector=m.isAngleInsideSector,c.isPtInsideSector=m.isPtInsideSector,c.pathArc=m.pathArc,c.pathSector=m.pathSector,c.pathAnnulus=m.pathAnnulus;var y=e("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=e("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=e("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=e("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=e("./regex");c.counterRegex=w.counter;var k=e("./throttle");c.throttle=k.throttle,c.throttleDone=k.done,c.clearThrottle=k.clear;var M=e("./dom");function T(e){var t={};for(var r in e)for(var n=e[r],a=0;al?s:i(e)?Number(e):s:s},c.isIndex=function(e,t){return!(void 0!==t&&e>=t)&&(i(e)&&e>=0&&e%1==0)},c.noop=e("./noop"),c.identity=e("./identity"),c.repeat=function(e,t){for(var r=new Array(t),n=0;nr?Math.max(r,Math.min(t,e)):Math.max(t,Math.min(r,e))},c.bBoxIntersect=function(e,t,r){return r=r||0,e.left<=t.right+r&&t.left<=e.right+r&&e.top<=t.bottom+r&&t.top<=e.bottom+r},c.simpleMap=function(e,t,r,n,a){for(var i=e.length,o=new Array(i),l=0;l=Math.pow(2,r)?a>10?(c.warn("randstr failed uniqueness"),s):e(t,r,n,(a||0)+1):s},c.OptionControl=function(e,t){e||(e={}),t||(t="opt");var r={optionList:[],_newoption:function(n){n[t]=e,r[n.name]=n,r.optionList.push(n)}};return r["_"+t]=e,r},c.smooth=function(e,t){if((t=Math.round(t)||0)<2)return e;var r,n,a,i,o=e.length,l=2*o,s=2*t-1,c=new Array(s),u=new Array(o);for(r=0;r=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=e[a]*c[n];u[r]=i}return u},c.syncOrAsync=function(e,t,r){var n;function a(){return c.syncOrAsync(e,t,r)}for(;e.length;)if((n=(0,e.splice(0,1)[0])(t))&&n.then)return n.then(a).then(void 0,c.promiseError);return r&&r(t)},c.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},c.noneOrAll=function(e,t,r){if(e){var n,a=!1,i=!0;for(n=0;n0?t:0}))},c.fillArray=function(e,t,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(e))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||r))for(;n.test(l);)l=l.replace(n,"$1"+i+"$2");return l+s},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var O=/^\w*$/;c.templateString=function(e,t){var r={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,n){var a;return O.test(n)?a=t[n]:(r[n]=r[n]||c.nestedProperty(t,n).get,a=r[n]()),c.isValidTextValue(a)?a:""}))};var D={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return R.apply(D,arguments)};var E={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return R.apply(E,arguments)};var z=/^[:|\|]/;function R(e,t,r){var i=this,o=arguments;t||(t={});var l={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,s,u){var f,d,p,h;for(p=3;p=48&&o<=57,c=l>=48&&l<=57;if(s&&(n=10*n+o-48),c&&(a=10*a+l-48),!s||!c){if(n!==a)return n-a;if(o!==l)return o-l}}return a-n};var I=2e9;c.seedPseudoRandom=function(){I=2e9},c.pseudoRandom=function(){var e=I;return I=(69069*I+1)%4294967296,Math.abs(I-e)<429496729?c.pseudoRandom():I/4294967296},c.fillText=function(e,t,r){var n=Array.isArray(r)?function(e){r.push(e)}:function(e){r.text=e},a=c.extractOption(e,t,"htx","hovertext");if(c.isValidTextValue(a))return n(a);var i=c.extractOption(e,t,"tx","text");return c.isValidTextValue(i)?n(i):void 0},c.isValidTextValue=function(e){return e||0===e},c.formatPercent=function(e,t){t=t||0;for(var r=(Math.round(100*e*Math.pow(10,t))*Math.pow(.1,t)).toFixed(t)+"%",n=0;n1&&(c=1):c=0,"translate("+(a-c*(r+o))+","+(i-c*(n+l))+")"+(c<1?"scale("+c+")":"")+(s?"rotate("+s+(t?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(e,t){var r=c.extendFlat({},t);return r.size=Math.max(t.size,e._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":157,"./anchor_utils":162,"./angles":163,"./array":164,"./clean_number":165,"./clear_responsive":167,"./coerce":168,"./dates":169,"./dom":170,"./extend":172,"./filter_unique":173,"./filter_visible":174,"./geometry2d":177,"./identity":178,"./increment":179,"./is_plain_object":181,"./keyed_container":182,"./localize":183,"./loggers":184,"./make_trace_groups":185,"./matrix":186,"./mod":187,"./nested_property":188,"./noop":189,"./notifier":190,"./push_unique":193,"./regex":195,"./relative_attr":196,"./relink_private":197,"./search":198,"./stats":200,"./throttle":202,"./to_log_range":203,d3:15,"d3-time-format":13,"fast-isnumeric":17}],181:[function(e,t,r){"use strict";t.exports=function(e){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(e):"[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.prototype}},{}],182:[function(e,t,r){"use strict";var n=e("./nested_property"),a=/^\w*$/;t.exports=function(e,t,r,i){var o,l,s;r=r||"name",i=i||"value";var c={};t&&t.length?(s=n(e,t),l=s.get()):l=e,t=t||"";var u={};if(l)for(o=0;o2)return c[t]=2|c[t],d.set(e,null);if(f){for(o=t;o1){var t=["LOG:"];for(e=0;e1){var r=[];for(e=0;e"),"long")}},i.warn=function(){var e;if(n.logging>0){var t=["WARN:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}},i.error=function(){var e;if(n.logging>0){var t=["ERROR:"];for(e=0;e0){var r=[];for(e=0;e"),"stick")}}},{"../plot_api/plot_config":213,"./notifier":190}],185:[function(e,t,r){"use strict";var n=e("d3");t.exports=function(e,t,r){var a=e.selectAll("g."+r.replace(/\s/g,".")).data(t,(function(e){return e[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=e.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(e){e[0][i]=n.select(this)})),a}},{d3:15}],186:[function(e,t,r){"use strict";r.init2dArray=function(e,t){for(var r=new Array(e),n=0;nt/2?e-Math.round(e/t)*t:e}}},{}],188:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./array").isArrayOrTypedArray;function i(e,t){return function(){var r,n,o,l,s,c=e;for(l=0;l/g),s=0;si||c===a||cl)&&(!t||!s(e))}:function(e,t){var s=e[0],c=e[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(e,t){var r=[e[0]],n=0,a=0;function o(o){e.push(o);var l=r.length,s=n;r.splice(a+1);for(var c=s+1;c1&&o(e.pop());return{addPt:o,raw:e,filtered:r}}},{"../constants/numerical":157,"./matrix":186}],193:[function(e,t,r){"use strict";t.exports=function(e,t){if(t instanceof RegExp){for(var r=t.toString(),n=0;na.queueLength&&(e.undoQueue.queue.shift(),e.undoQueue.index--))},startSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!0,e.undoQueue.beginSequence=!0},stopSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!1,e.undoQueue.beginSequence=!1},undo:function(e){var t,r;if(e.framework&&e.framework.isPolar)e.framework.undo();else if(!(void 0===e.undoQueue||isNaN(e.undoQueue.index)||e.undoQueue.index<=0)){for(e.undoQueue.index--,t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;r=e.undoQueue.queue.length)){for(t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,r=0;rt}function u(e,t){return e>=t}r.findBin=function(e,t,r){if(n(t.start))return r?Math.ceil((e-t.start)/t.size-1e-9)-1:Math.floor((e-t.start)/t.size+1e-9);var i,o,f=0,d=t.length,p=0,h=d>1?(t[d-1]-t[0])/(d-1):1;for(o=h>=0?r?l:s:r?u:c,e+=1e-9*h*(r?-1:1)*(h>=0?1:-1);f90&&a.log("Long binary search..."),f-1},r.sorterAsc=function(e,t){return e-t},r.sorterDes=function(e,t){return t-e},r.distinctVals=function(e,t){var n,a=(t||{}).unitMinDiff,i=e.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var l=1;a||(l=i[n]-i[0]||1);for(var s,c=l/(n||1)/1e4,u=[],f=0;f<=n;f++){var d=i[f],p=d-s;void 0===s?(u.push(d),s=d):p>c&&(l=Math.min(l,p),u.push(d),s=d)}return{vals:u,minDiff:l}},r.roundUp=function(e,t,r){for(var n,a=0,i=t.length-1,o=0,l=r?0:1,s=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return e.sort(t)}return n?e:e.reverse()},r.findIndexOfMin=function(e,t){t=t||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(t)||(t=!1),a(i[0])){for(s=new Array(o),l=0;le.length-1)return e[e.length-1];var r=t%1;return r*e[Math.ceil(t)]+(1-r)*e[Math.floor(t)]}},{"./array":164,"fast-isnumeric":17}],201:[function(e,t,r){"use strict";var n=e("d3"),a=e("../lib"),i=e("../constants/xmlns_namespaces"),o=e("../constants/alignment").LINE_SPACING;function l(e,t){return e.node().getBoundingClientRect()[t]}var s=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(e,t,T){var A=e.text(),S=!e.attr("data-notex")&&"undefined"!=typeof MathJax&&A.match(s),C=n.select(e.node().parentNode);if(!C.empty()){var P=e.attr("class")?e.attr("class").split(" ")[0]:"text";return P+="-math",C.selectAll("svg."+P).remove(),C.selectAll("g."+P+"-group").remove(),e.style("display",null).attr({"data-unformatted":A,"data-math":"N"}),S?(t&&t._promises||[]).push(new Promise((function(t){e.style("display","none");var r=parseInt(e.node().style.fontSize,10),i={fontSize:r};!function(e,t,r){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.randstr({},64);return s=n.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":t.fontSize+"px"}).text(e.replace(c,"\\lt ").replace(u,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var t=n.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",e),r();else{var o=s.select("svg").node().getBoundingClientRect();r(s.select(".MathJax_SVG"),t,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(S[2],i,(function(n,a,i){C.selectAll("svg."+P).remove(),C.selectAll("g."+P+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return O(),void t();var s=C.append("g").classed(P+"-group",!0).attr({"pointer-events":"none","data-unformatted":A,"data-math":"Y"});s.node().appendChild(o.node()),a&&a.node()&&o.node().insertBefore(a.node().cloneNode(!0),o.node().firstChild),o.attr({class:P,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=e.node().style.fill||"black",u=o.select("g");u.attr({fill:c,stroke:c});var f=l(u,"width"),d=l(u,"height"),p=+e.attr("x")-f*{start:0,middle:.5,end:1}[e.attr("text-anchor")||"start"],h=-(r||l(e,"height"))/4;"y"===P[0]?(s.attr({transform:"rotate("+[-90,+e.attr("x"),+e.attr("y")]+") translate("+[-f/2,h-d/2]+")"}),o.attr({x:+e.attr("x"),y:+e.attr("y")})):"l"===P[0]?o.attr({x:e.attr("x"),y:h-d/2}):"a"===P[0]&&0!==P.indexOf("atitle")?o.attr({x:0,y:h}):o.attr({x:p,y:+e.attr("y")+h-d/2}),T&&T.call(e,s),t(s)}))}))):O(),e}function O(){C.empty()||(P=e.attr("class")+"-math",C.select("svg."+P).remove()),e.text("").style("white-space","pre"),function(e,t){t=t.replace(g," ");var r,l=!1,s=[],c=-1;function u(){c++;var t=document.createElementNS(i.svg,"tspan");n.select(t).attr({class:"line",dy:c*o+"em"}),e.appendChild(t),r=t;var a=s;if(s=[{node:t}],a.length>1)for(var l=1;l doesnt match end tag <"+e+">. Pretending it did match.",t),r=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",t)}y.test(t)?u():(r=e,s=[{node:e}]);for(var C=t.split(v),P=0;P|>|>)/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"},d={sub:"0.3em",sup:"-0.6em"},p={sub:"-0.21em",sup:"0.42em"},h=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,m=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,b=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function k(e,t){if(!e)return null;var r=e.match(t),n=r&&(r[3]||r[4]);return n&&L(n)}var M=/(^|;)\s*color:/;r.plainText=function(e,t){for(var r=void 0!==(t=t||{}).len&&-1!==t.len?t.len:1/0,n=void 0!==t.allowedTags?t.allowedTags:["br"],a="...".length,i=e.split(v),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var T={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},A=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function L(e){return e.replace(A,(function(e,t){return("#"===t.charAt(0)?function(e){if(e>1114111)return;var t=String.fromCodePoint;if(t)return t(e);var r=String.fromCharCode;return e<=65535?r(e):r(55232+(e>>10),e%1024+56320)}("x"===t.charAt(1)?parseInt(t.substr(2),16):parseInt(t.substr(1),10)):T[t])||e}))}function S(e,t,r){var n,a,i,o=r.horizontalAlign,l=r.verticalAlign||"top",s=e.node().getBoundingClientRect(),c=t.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-n.height}:"middle"===l?function(){return s.top+(s.height-n.height)/2}:function(){return s.top},i="right"===o?function(){return s.right-n.width}:"center"===o?function(){return s.left+(s.width-n.width)/2}:function(){return s.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:i()-c.left+"px","z-index":1e3}),this}}r.convertEntities=L,r.sanitizeHTML=function(e){e=e.replace(g," ");for(var t=document.createElement("p"),r=t,a=[],i=e.split(v),o=0;oi.ts+t?s():i.timer=setTimeout((function(){s(),i.timer=null}),t)},r.done=function(e){var t=n[e];return t&&t.timer?new Promise((function(e){var r=t.onDone;t.onDone=function(){r&&r(),e(),t.onDone=null}})):Promise.resolve()},r.clear=function(e){if(e)a(n[e]),delete n[e];else for(var t in n)r.clear(t)}},{}],203:[function(e,t,r){"use strict";var n=e("fast-isnumeric");t.exports=function(e,t){if(e>0)return Math.log(e)/Math.LN10;var r=Math.log(Math.min(t[0],t[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(t[0],t[1]))/Math.LN10-6),r}},{"fast-isnumeric":17}],204:[function(e,t,r){"use strict";var n=t.exports={},a=e("../plots/geo/constants").locationmodeToLayer,i=e("topojson-client").feature;n.getTopojsonName=function(e){return[e.scope.replace(/ /g,"-"),"_",e.resolution.toString(),"m"].join("")},n.getTopojsonPath=function(e,t){return e+t+".json"},n.getTopojsonFeatures=function(e,t){var r=a[e.locationmode],n=t.objects[r];return i(t,n).features}},{"../plots/geo/constants":255,"topojson-client":35}],205:[function(e,t,r){"use strict";t.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],206:[function(e,t,r){"use strict";t.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"}}},{}],207:[function(e,t,r){"use strict";var n=e("../registry");t.exports=function(e){for(var t,r,a=n.layoutArrayContainers,i=n.layoutArrayRegexes,o=e.split("[")[0],l=0;l0&&o.log("Clearing previous rejected promises from queue."),e._promises=[]},r.cleanLayout=function(e){var t,n;e||(e={}),e.xaxis1&&(e.xaxis||(e.xaxis=e.xaxis1),delete e.xaxis1),e.yaxis1&&(e.yaxis||(e.yaxis=e.yaxis1),delete e.yaxis1),e.scene1&&(e.scene||(e.scene=e.scene1),delete e.scene1);var i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(e);for(t=0;t3?(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")),h(e),"rotate"===e.dragmode&&(e.dragmode="orbit"),c.clean(e),e.template&&e.template.layout&&r.cleanLayout(e.template.layout),e},r.cleanData=function(e){for(var t=0;t0)return e.substr(0,t)}r.hasParent=function(e,t){for(var r=b(t);r;){if(r in e)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(e,t,r){for(var n=0;n1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))t.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;t.set(y)}return!g&&(d(v,m),p(e),!0)}var x,b,_,w,k,M,T,A,L=Object.keys(r).map(Number).sort(o),S=t.get(),C=S||[],P=u(m,f).get(),O=[],D=-1,E=C.length;for(x=0;xC.length-(T?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(M)?O.push(_):T?("add"===M&&(M={}),C.splice(_,0,M),P&&P.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===D&&(D=_);else for(b=0;b=0;x--)C.splice(O[x],1),P&&P.splice(O[x],1);if(C.length?S||t.set(C):t.set(null),g)return!1;if(d(v,m),h!==a){var z;if(-1===D)z=L;else{for(E=Math.max(C.length,E),z=[],x=0;x=D);x++)z.push(_);for(x=D;x=e.data.length||a<-e.data.length)throw new Error(r+" must be valid indices for gd.data.");if(t.indexOf(a,n+1)>-1||a>=0&&t.indexOf(-e.data.length+a)>-1||a<0&&t.indexOf(e.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function z(e,t,r){if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("currentIndices is a required argument.");if(Array.isArray(t)||(t=[t]),E(e,t,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&E(e,r,"newIndices"),"undefined"!=typeof r&&t.length!==r.length)throw new Error("current and new indices must be of equal length.")}function R(e,t,r,n,i){!function(e,t,r,n){var a=o.isPlainObject(n);if(!Array.isArray(e.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(t))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 i in E(e,r,"indices"),t){if(!Array.isArray(t[i])||t[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==t[i].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")}}(e,t,r,n);for(var s=function(e,t,r,n){var i,s,c,u,f,d=o.isPlainObject(n),p=[];for(var h in Array.isArray(r)||(r=[r]),r=D(r,e.data.length-1),t)for(var g=0;g-1?s(r,r.replace("titlefont","title.font")):r.indexOf("titleposition")>-1?s(r,r.replace("titleposition","title.position")):r.indexOf("titleside")>-1?s(r,r.replace("titleside","title.side")):r.indexOf("titleoffset")>-1&&s(r,r.replace("titleoffset","title.offset")):s(r,r.replace("title","title.text"));function s(t,r){e[r]=e[t],delete e[t]}}function q(e,t,r){if(e=o.getGraphDiv(e),k.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var n={};if("string"==typeof t)n[t]=r;else{if(!o.isPlainObject(t))return o.warn("Relayout fail.",t,r),Promise.reject();n=o.extendFlat({},t)}Object.keys(n).length&&(e.changed=!0);var a=W(e,n),i=a.flags;i.calc&&(e.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(M.layoutReplot):Object.keys(n).length&&(V(e,i,a)||d.supplyDefaults(e),i.legend&&l.push(M.doLegend),i.layoutstyle&&l.push(M.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(M.doTicksRelayout),i.modebar&&l.push(M.doModeBar),i.camera&&l.push(M.doCamera),i.colorbars&&l.push(M.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(e,q,[e,a.undoit],q,[e,a.redoit]);var s=o.syncOrAsync(l,e);return s&&s.then||(s=Promise.resolve(e)),s.then((function(){return e.emit("plotly_relayout",a.eventData),e}))}function V(e,t,r){var n=e._fullLayout;if(!t.axrange)return!1;for(var a in t)if("axrange"!==a&&t[a])return!1;for(var i in r.rangesAltered){var o=h.id2name(i),l=e.layout[o],s=n[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=n[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(e,t){var r=t?function(e){var r=[],n=!0;for(var a in t){var i=h.getFromId(e,a);if(r.push(a),i._matchGroup)for(var o in i._matchGroup)t[o]||r.push(o);i.automargin&&(n=!1)}return h.draw(e,r,{skipTitle:n})}:function(e){return h.draw(e,"redraw")};e.push(b,M.doAutoRangeAndConstraints,r,M.drawData,M.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(e,t){var r,n,a,i=e.layout,s=e._fullLayout,c=s._guiEditing,d=j(s._preGUI,c),p=Object.keys(t),g=h.list(e),v=o.extendDeepAll({},t),m={};for(U(t),p=Object.keys(t),n=0;n0&&"string"!=typeof E.parts[R];)R--;var I=E.parts[R],F=E.parts[R-1]+"."+I,H=E.parts.slice(0,R).join("."),B=l(e.layout,H).get(),q=l(s,H).get(),V=E.get();if(void 0!==z){M[D]=z,L[D]="reverse"===I?z:N(V);var G=f.getLayoutValObject(s,E.parts);if(G&&G.impliedEdits&&null!==z)for(var W in G.impliedEdits)S(o.relativeAttr(D,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(D))if(z){S("autosize",null);var Q="height"===D?"width":"height";S(Q,s[Q])}else s[D]=e._initialAutoSize[D];else if("autosize"===D)S("width",z?null:s.width),S("height",z?null:s.height);else if(F.match(Z))O(F),l(s,H+"._inputRange").set(null);else if(F.match(Y)){O(F),l(s,H+"._inputRange").set(null);var $=l(s,H).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else F.match(X)&&l(s,H+"._inputDomain").set(null);if("type"===I){var K=B,ee="linear"===q.type&&"log"===z,te="log"===q.type&&"linear"===z;if(ee||te){if(K&&K.range)if(q.autorange)ee&&(K.range=K.range[1]>K.range[0]?[1,2]:[2,1]);else{var re=K.range[0],ne=K.range[1];ee?(re<=0&&ne<=0&&S(H+".autorange",!0),re<=0?re=ne/1e6:ne<=0&&(ne=re/1e6),S(H+".range[0]",Math.log(re)/Math.LN10),S(H+".range[1]",Math.log(ne)/Math.LN10)):(S(H+".range[0]",Math.pow(10,re)),S(H+".range[1]",Math.pow(10,ne)))}else S(H+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[E.parts[0]]&&"radialaxis"===E.parts[1]&&delete s[E.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(e,q,z,S),u.getComponentMethod("images","convertCoords")(e,q,z,S)}else S(H+".autorange",!0),S(H+".range",null);l(s,H+"._inputRange").set(null)}else if(I.match(A)){var ae=l(s,D).get(),ie=(z||{}).type;ie&&"-"!==ie||(ie="linear"),u.getComponentMethod("annotations","convertCoords")(e,ae,ie,S),u.getComponentMethod("images","convertCoords")(e,ae,ie,S)}var oe=w.containerArrayMatch(D);if(oe){r=oe.array,n=oe.index;var le=oe.property,se=G||{editType:"calc"};""!==n&&""===le&&(w.isAddVal(z)?L[D]=null:w.isRemoveVal(z)?L[D]=(l(i,r).get()||[])[n]:o.warn("unrecognized full object value",t)),T.update(_,se),m[r]||(m[r]={});var ce=m[r][n];ce||(ce=m[r][n]={}),ce[le]=z,delete t[D]}else"reverse"===I?(B.range?B.range.reverse():(S(H+".autorange",!0),B.range=[1,0]),q.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===D&&("lasso"===z||"select"===z)&&"lasso"!==V&&"select"!==V||s._has("gl2d")?_.plot=!0:G?T.update(_,G):_.calc=!0,E.set(z))}}for(r in m){w.applyContainerArrayChanges(e,d(i,r),m[r],_,d)||(_.plot=!0)}var ue=s._axisConstraintGroups||[];for(C in P)for(n=0;n1;)if(n.pop(),void 0!==(r=l(t,n.join(".")+".uirevision").get()))return r;return t.uirevision}function ne(e,t){for(var r=0;r=a.length?a[0]:a[e]:a}function s(e){return Array.isArray(i)?e>=i.length?i[0]:i[e]:i}function c(e,t){var r=0;return function(){if(e&&++r===t)return e()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){function f(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var t=n._currentFrame=n._frameQueue.shift();if(t){var r=t.name?t.name.toString():null;e._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=t.frameOpts.duration,d.transition(e,t.frame.data,t.frame.layout,k.coerceTraceIndices(e,t.frame.traces),t.frameOpts,t.transitionOpts).then((function(){t.onComplete&&t.onComplete()})),e.emit("plotly_animatingframe",{name:r,frame:t.frame,animation:{frame:t.frameOpts,transition:t.transitionOpts}})}else e.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function p(){e.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var t=function(){n._animationRaf=window.requestAnimationFrame(t),Date.now()-n._lastFrameAt>n._timeToNext&&f()};t()}var h,g,v=0;function m(e){return Array.isArray(a)?v>=a.length?e.transitionOpts=a[v]:e.transitionOpts=a[0]:e.transitionOpts=a,v++,e}var y=[],x=null==t,b=Array.isArray(t);if(!x&&!b&&o.isPlainObject(t))y.push({type:"object",data:m(o.extendFlat({},t))});else if(x||-1!==["string","number"].indexOf(typeof t))for(h=0;h0&&MM)&&T.push(g);y=T}}y.length>0?function(t){if(0!==t.length){for(var a=0;a=0;n--)if(o.isPlainObject(t[n])){var g=t[n].name,v=(u[g]||h[g]||{}).name,m=t[n].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[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.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(t[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(e,t){return e.index>t.index?-1:e.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+e._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=t[r],i.push({type:"delete",index:n}),l.unshift({type:"insert",index:n,value:a[n]});var s=d.modifyFrames,u=d.modifyFrames,f=[e,l],p=[e,i];return c&&c.add(e,s,f,u,p),d.modifyFrames(e,i)},r.addTraces=function e(t,n,a){t=o.getGraphDiv(t);var i,l,s=[],u=r.deleteTraces,f=e,d=[t,s],p=[t,n];for(function(e,t,r){var n,a;if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("traces must be defined.");for(Array.isArray(t)||(t=[t]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===e.dimensions){if(r++,t.length===r)return e;var o=t[r];if(!_(o))return!1;e=i[a][o]}else e=i[a]}else e=i}}return e}function _(e){return e===Math.round(e)&&e>=0}function w(){var e,t,r={};for(e in h(r,o),n.subplotsRegistry){if((t=n.subplotsRegistry[e]).layoutAttributes)if(Array.isArray(t.attr))for(var a=0;a=s.length)return!1;a=(r=(n.transformsRegistry[s[c].type]||{}).attributes)&&r[t[2]],l=3}else if("area"===e.type)a=u[o];else{var f=e._module;if(f||(f=(n.modules[e.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,t,l)},r.getLayoutValObject=function(e,t){return b(function(e,t){var r,a,i,l,s=e._basePlotModules;if(s){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var l,s=t+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(e,t){o?n.nestedProperty(l[s],e).set(t):l[s+"."+e]=t}function f(){var e=l;return c(),e}return c(),{modifyBase:function(e,t){l[e]=t},modifyItem:u,getUpdateObj:f,applyUpdate:function(t,r){t&&u(t,r);var a=f();for(var i in a)n.nestedProperty(e,i).set(a[i])}}}},{"../lib":180,"../plots/attributes":222}],216:[function(e,t,r){"use strict";var n=e("d3"),a=e("../registry"),i=e("../plots/plots"),o=e("../lib"),l=e("../lib/clear_gl_canvases"),s=e("../components/color"),c=e("../components/drawing"),u=e("../components/titles"),f=e("../components/modebar"),d=e("../plots/cartesian/axes"),p=e("../constants/alignment"),h=e("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=e("../plots/cartesian/autorange").doAutoRange;function y(e,t,r){for(var n=0;n=e[1]||a[1]<=e[0])&&(i[0]t[0]))return!0}return!1}function x(e){var t,a,l,u,h,g,v=e._fullLayout,m=v._size,x=m.p,_=d.list(e,"",!0);if(v._paperdiv.style({width:e._context.responsive&&v.autosize&&!e._context._hasZeroWidth&&!e.layout.width?"100%":v.width+"px",height:e._context.responsive&&v.autosize&&!e._context._hasZeroHeight&&!e.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),e._context.setBackground(e,v.paper_bgcolor),r.drawMainTitle(e),f.manage(e),!v._has("cartesian"))return i.previousPromises(e);function k(e,t,r){var n=e._lw/2;return"x"===e._id.charAt(0)?t?"top"===r?t._offset-x-n:t._offset+t._length+x+n:m.t+m.h*(1-(e.position||0))+n%1:t?"right"===r?t._offset+t._length+x+n:t._offset-x-n:m.l+m.w*(e.position||0)+n%1}for(t=0;t<_.length;t++){var M=(u=_[t])._anchorAxis;u._linepositions={},u._lw=c.crispRound(e,u.linewidth,1),u._mainLinePosition=k(u,M,u.side),u._mainMirrorPosition=u.mirror&&M?k(u,M,p.OPPOSITE_SIDE[u.side]):null}var T=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,P=l.yaxis.domain,O=l.plotgroup;if(y(C,P,L)){var D=O.node(),E=l.bg=o.ensureSingle(O,"rect","bg");D.insertBefore(E.node(),D.childNodes[0]),A.push(a)}else O.select("rect.bg").remove(),L.push([C,P]),S||(T.push(a),A.push(a))}var z,R,I,F,N,j,H,B,U,q,V,G,Z,Y=v._bgLayer.selectAll(".bg").data(T);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(e){v._plots[e].bg=n.select(this)})),t=0;tk?u.push({code:"unused",traceType:y,templateCount:w,dataCount:k}):k>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:k})}}else u.push({code:"data"});if(function e(t,r){for(var n in t)if("_"!==n.charAt(0)){var i=t[n],o=g(t,n,r);a(i)?(Array.isArray(t)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),e(i,o)):Array.isArray(i)&&v(i)&&e(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":180,"../plots/attributes":222,"../plots/plots":266,"./plot_config":213,"./plot_schema":214,"./plot_template":215}],218:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("./plot_api"),i=e("../plots/plots"),o=e("../lib"),l=e("../snapshot/helpers"),s=e("../snapshot/tosvg"),c=e("../snapshot/svgtoimg"),u=e("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};t.exports=function(e,t){var r,d,p,h;function g(e){return!(e in t)||o.validate(t[e],f[e])}if(t=t||{},o.isPlainObject(e)?(r=e.data||[],d=e.layout||{},p=e.config||{},h={}):(e=o.getGraphDiv(e),r=o.extendDeep([],e.data),d=o.extendDeep({},e.layout),p=e._context,h=e._fullLayout||{}),!g("width")&&null!==t.width||!g("height")&&null!==t.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var v={};function m(e,r){return o.coerce(t,v,f,e,r)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),k=m("imageDataOnly"),M=document.createElement("div");M.style.position="absolute",M.style.left="-5000px",document.body.appendChild(M);var T=o.extendFlat({},d);x?T.width=x:null===t.width&&n(h.width)&&(T.width=h.width),b?T.height=b:null===t.height&&n(h.height)&&(T.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(M);function S(){return new Promise((function(e){setTimeout(e,l.getDelay(M._fullLayout))}))}function C(){return new Promise((function(e,t){var r=s(M,y,_),n=M._fullLayout.width,f=M._fullLayout.height;function d(){a.purge(M),document.body.removeChild(M)}if("full-json"===y){var p=i.graphJson(M,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),e(k?p:l.encodeJSON(p))}if(d(),"svg"===y)return e(k?r:l.encodeSVG(r));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:h,svg:r,promise:!0}).then(e).catch(t)}))}return new Promise((function(e,t){a.plot(M,r,T,A).then(L).then(S).then(C).then((function(t){e(function(e){return k?e.replace(l.IMAGE_URL_PREFIX,""):e}(t))})).catch((function(e){t(e)}))}))}},{"../lib":180,"../plots/plots":266,"../snapshot/helpers":279,"../snapshot/svgtoimg":281,"../snapshot/tosvg":283,"../version":334,"./plot_api":212,"fast-isnumeric":17}],219:[function(e,t,r){"use strict";var n=e("../lib"),a=e("../plots/plots"),i=e("./plot_schema"),o=e("./plot_config").dfltConfig,l=n.isPlainObject,s=Array.isArray,c=n.isArrayOrTypedArray;function u(e,t,r,a,i,o){o=o||[];for(var f=Object.keys(e),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var T,A,L,S,C,P=x.length,O=Array.isArray(M);if(O&&(P=Math.min(P,M.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var D=x[A].length;for(T=0;T<(O?Math.min(D,M[A].length):D);T++)L=O?M[A][T]:M,S=y[A][T],C=x[A][T],n.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,T),S,C)):a.push(h("value",i,m.concat(A,T),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&((b=T-o(v)-o(m))>A?_/b>S&&(y=v,x=m,S=_/b):_/T>S&&(y={val:v.val,pad:0},x={val:m.val,pad:0},S=_/T));if(d===p){var C=d-1,P=d+1;if(k)if(0===d)i=[0,1];else{var O=(d>0?f:u).reduce((function(e,t){return Math.max(e,o(t))}),0),D=d/(1-Math.min(.5,O/T));i=d>0?[0,D]:[D,0]}else i=M?[Math.max(0,C),Math.max(1,P)]:[C,P]}else k?(y.val>=0&&(y={val:0,pad:0}),x.val<=0&&(x={val:0,pad:0})):M&&(y.val-S*o(y)<0&&(y={val:0,pad:0}),x.val<=0&&(x={val:1,pad:0})),S=(x.val-y.val-L(v.val,m.val))/(T-o(y)-o(x)),i=[y.val-S*o(y),x.val+S*o(x)];return h&&i.reverse(),a.simpleMap(i,t.l2r||Number)}function s(e){var t=e._length/20;return"domain"===e.constrain&&e._inputDomain&&(t*=(e._inputDomain[1]-e._inputDomain[0])/(e.domain[1]-e.domain[0])),function(e){return e.pad+(e.extrapad?t:0)}}function c(e,t){var r,n,a,i=t._id,o=e._fullData,l=e._fullLayout,s=[],c=[];function d(e,t){for(r=0;r=r&&(c.extrapad||!o)){l=!1;break}a(t,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(e.splice(s,1),s--)}if(l){var u=i&&0===t;e.push({val:t,pad:u?0:r,extrapad:!u&&o})}}function p(e){return n(e)&&Math.abs(e)=t}t.exports={getAutoRange:l,makePadFn:s,doAutoRange:function(e,t){if(t.setScale(),t.autorange){t.range=l(e,t),t._r=t.range.slice(),t._rl=a.simpleMap(t._r,t.r2l);var r=t._input,n={};n[t._attr+".range"]=t.range,n[t._attr+".autorange"]=t.autorange,o.call("_storeDirectGUIEdit",e.layout,e._fullLayout._preGUI,n),r.range=t.range.slice(),r.autorange=t.autorange}var i=t._anchorAxis;if(i&&i.rangeslider){var s=i.rangeslider[t._name];s&&"auto"===s.rangemode&&(s.range=l(e,t)),i._input.rangeslider[t._name]=a.extendFlat({},s)}},findExtremes:function(e,t,r){r||(r={});e._m||e.setScale();var a,o,l,s,c,d,h,g,v,m=[],y=[],x=t.length,b=r.padded||!1,_=r.tozero&&("linear"===e.type||"-"===e.type),w="log"===e.type,k=!1,M=r.vpadLinearized||!1;function T(e){if(Array.isArray(e))return k=!0,function(t){return Math.max(Number(e[t]||0),0)};var t=Math.max(Number(e||0),0);return function(){return t}}var A=T((e._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),L=T((e._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=T(r.vpadplus||r.vpad),C=T(r.vpadminus||r.vpad);if(!k){if(g=1/0,v=-1/0,w)for(a=0;a0&&(g=o),o>v&&o-i&&(g=o),o>v&&o=D;a--)O(a);return{min:m,max:y,opts:r}},concatExtremes:c}},{"../../constants/numerical":157,"../../lib":180,"../../registry":275,"fast-isnumeric":17}],225:[function(e,t,r){"use strict";var n=e("d3"),a=e("fast-isnumeric"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../components/titles"),u=e("../../components/color"),f=e("../../components/drawing"),d=e("./layout_attributes"),p=e("./clean_ticks"),h=e("../../constants/numerical"),g=h.ONEMAXYEAR,v=h.ONEAVGYEAR,m=h.ONEMINYEAR,y=h.ONEMAXQUARTER,x=h.ONEAVGQUARTER,b=h.ONEMINQUARTER,_=h.ONEMAXMONTH,w=h.ONEAVGMONTH,k=h.ONEMINMONTH,M=h.ONEWEEK,T=h.ONEDAY,A=T/2,L=h.ONEHOUR,S=h.ONEMIN,C=h.ONESEC,P=h.MINUS_SIGN,O=h.BADNUM,D=e("../../constants/alignment"),E=D.MID_SHIFT,z=D.CAP_SHIFT,R=D.LINE_SPACING,I=D.OPPOSITE_SIDE,F=t.exports={};F.setConvert=e("./set_convert");var N=e("./axis_autotype"),j=e("./axis_ids");F.id2name=j.id2name,F.name2id=j.name2id,F.cleanId=j.cleanId,F.list=j.list,F.listIds=j.listIds,F.getFromId=j.getFromId,F.getFromTrace=j.getFromTrace;var H=e("./autorange");F.getAutoRange=H.getAutoRange,F.findExtremes=H.findExtremes;function B(e){var t=1e-4*(e[1]-e[0]);return[e[0]-t,e[1]+t]}F.coerceRef=function(e,t,r,n,a,i){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=s[0]||i),i||(i=a),u[c]={valType:"enumerated",values:s.concat(i?[i]:[]),dflt:a},l.coerce(e,t,u,c)},F.coercePosition=function(e,t,r,n,a,i){var o,s;if("paper"===n||"pixel"===n)o=l.ensureNumber,s=r(a,i);else{var c=F.getFromId(t,n);s=r(a,i=c.fraction2r(i)),o=c.cleanPos}e[a]=o(s)},F.cleanPosition=function(e,t,r){return("paper"===r||"pixel"===r?l.ensureNumber:F.getFromId(t,r).cleanPos)(e)},F.redrawComponents=function(e,t){t=t||F.listIds(e);var r=e._fullLayout;function n(n,a,i,l){for(var s=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-e._forceTick0)/e._minDtick%1+1.000001)%1>2e-6)&&(e._minDtick=0)):e._minDtick=0},F.saveRangeInitial=function(e,t){for(var r=F.list(e,"",!0),n=!1,a=0;a.3*d||u(n)||u(i))){var p=r.dtick/2;e+=e+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?e=F.tickIncrement(e,"M6","reverse")+1.5*T:i.exactMonths>.8?e=F.tickIncrement(e,"M1","reverse")+15.5*T:e-=A;var s=F.tickIncrement(e,r);if(s<=n)return s}return e}(y,e,m,c,i)),v=y,0;v<=u;)v=F.tickIncrement(v,m,!1,i);return{start:t.c2r(y,0,i),end:t.c2r(v,0,i),size:m,_dataSpan:u-c}},F.prepTicks=function(e,t){var r=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if("auto"===e.tickmode||!e.dtick){var n,a=e.nticks;a||("category"===e.type||"multicategory"===e.type?(n=e.tickfont?1.2*(e.tickfont.size||12):15,a=e._length/n):(n="y"===e._id.charAt(0)?40:80,a=l.constrain(e._length/n,4,9)+1),"radialaxis"===e._name&&(a*=2)),"array"===e.tickmode&&(a*=100),e._roughDTick=(Math.abs(r[1]-r[0])-(e._lBreaks||0))/a,F.autoTicks(e,e._roughDTick),e._minDtick>0&&e.dtick<2*e._minDtick&&(e.dtick=e._minDtick,e.tick0=e.l2r(e._forceTick0))}e.tick0||(e.tick0="date"===e.type?"2000-01-01":0),"date"===e.type&&e.dtick<.1&&(e.dtick=.1),K(e)},F.calcTicks=function(e,t){F.prepTicks(e,t);var r=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if("array"===e.tickmode)return function(e){var t=e.tickvals,r=e.ticktext,n=new Array(t.length),a=B(l.simpleMap(e.range,e.r2l)),i=Math.min(a[0],a[1]),o=Math.max(a[0],a[1]),s=0;Array.isArray(r)||(r=[]);var c="category"===e.type?e.d2l_noadd:e.d2l;"log"===e.type&&"L"!==String(e.dtick).charAt(0)&&(e.dtick="L"+Math.pow(10,Math.floor(Math.min(e.range[0],e.range[1]))-1));for(var u=0;ui&&f=o:n<=o)&&!(c.length>r||n===t);n=F.tickIncrement(n,e.dtick,s,e.calendar)){t=n;var a=!1;u&&n!==(0|n)&&(a=!0),c.push({minor:a,value:n})}}();var f="period"===e.ticklabelmode;if(f&&c.unshift({minor:!1,value:F.tickIncrement(c[0].value,e.dtick,!s,e.caldendar)}),e.rangebreaks){var d=c.length;if(d){var p=0;"auto"===e.tickmode&&(p=("y"===e._id.charAt(0)?2:6)*(e.tickfont?e.tickfont.size:12));for(var h,S=[],C=s?1:-1,P=s?d-1:0,D=s?0:d-1;C*D<=C*P;D+=C){var E=c[D];if(e.maskBreaks(E.value)!==O||(E.value=me(E.value,e),!e._rl||e._rl[0]!==E.value&&e._rl[1]!==E.value)){var z=e.c2p(E.value);z===h?S[S.length-1].valuep)&&(h=z,S.push(E))}}c=S.reverse()}}ve(e)&&360===Math.abs(r[1]-r[0])&&c.pop(),e._tmax=(c[c.length-1]||{}).value,e._prevDateHead="",e._inCalcTicks=!0;var R,I=Math.min(r[0],r[1]),N=Math.max(r[0],r[1]),j=F.getTickFormat(e);f&&j&&(/%[fLQsSMX]/.test(j)||(/%[HI]/.test(j)?R=L:/%p/.test(j)?R=A:/%[Aadejuwx]/.test(j)?R=T:/%[UVW]/.test(j)?R=M:/%[Bbm]/.test(j)?R=w:/%[q]/.test(j)?R=x:/%[Yy]/.test(j)&&(R=v)));var H,U,q=[];for(H=0;H0?(W=H-1,J=H):(W=H,J=H);var Q=q[W].x,$=q[J].x,K=Math.abs($-Q),te=R||K,re=0;if(te>=m?re=K>=m&&K<=g?K:v:R===x&&te>=b?re=K>=b&&K<=y?K:x:te>=k?re=K>=k&&K<=_?K:w:R===M&&te>=M?re=M:te>=T?re=T:R===A&&te>=A?re=A:R===L&&te>=L&&(re=L),re&&e.rangebreaks){for(var ne=0,ae=0,ie=0;ie<42;ie++){var oe=ie/42;e.maskBreaks(Q*(1-oe)+$*oe)!==O&&(oe<.5?ne++:ae++)}ae&&(re*=(ne+ae)/42)}re<=K&&(X+=re/2),q[H].periodX=X,(X>N||X=I){e._prevDateHead="",q[H].text=F.tickText(e,q[H].x).text;break}}return e._inCalcTicks=!1,q};var G=[2,5,10],Z=[1,2,3,6,12],Y=[1,2,5,10,15,30],X=[1,2,3,7,14],W=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],J=[-.301,0,.301,.699,1],Q=[15,30,45,90,180];function $(e,t,r){return t*l.roundUp(e/t,r)}function K(e){var t=e.dtick;if(e._tickexponent=0,a(t)||"string"==typeof t||(t=1),"category"!==e.type&&"multicategory"!==e.type||(e._tickround=null),"date"===e.type){var r=e.r2l(e.tick0),n=e.l2r(r).replace(/(^-|i)/g,""),i=n.length;if("M"===String(t).charAt(0))i>10||"01-01"!==n.substr(5)?e._tickround="d":e._tickround=+t.substr(1)%12==0?"y":"m";else if(t>=T&&i<=10||t>=15*T)e._tickround="d";else if(t>=S&&i<=16||t>=L)e._tickround="M";else if(t>=C&&i<=19||t>=S)e._tickround="S";else{var o=e.l2r(r+t).replace(/^-/,"").length;e._tickround=Math.max(i,o)-20,e._tickround<0&&(e._tickround=4)}}else if(a(t)||"L"===t.charAt(0)){var l=e.range.map(e.r2d||Number);a(t)||(t=Number(t.substr(1))),e._tickround=2-Math.floor(Math.log(t)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(c)>3&&(re(e.exponentformat)&&!ne(c)?e._tickexponent=3*Math.round((c-1)/3):e._tickexponent=c)}else e._tickround=null}function ee(e,t,r){var n=e.tickfont||{};return{x:t,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}F.autoTicks=function(e,t){var r;function n(e){return Math.pow(e,Math.floor(Math.log(t)/Math.LN10))}if("date"===e.type){e.tick0=l.dateTick0(e.calendar);var i=2*t;if(i>v)t/=v,r=n(10),e.dtick="M"+12*$(t,r,G);else if(i>w)t/=w,e.dtick="M"+$(t,1,Z);else if(i>T){e.dtick=$(t,T,e._hasDayOfWeekBreaks?[1,2,7,14]:X),e.tick0=l.dateTick0(e.calendar,!0);var o=F.getTickFormat(e);if(/%[uVW]/.test(o)){var s=e.tick0.length,c=+e.tick0[s-1];e.tick0=e.tick0.substring(0,s-2)+String(c+1)}}else i>L?e.dtick=$(t,L,Z):i>S?e.dtick=$(t,S,Y):i>C?e.dtick=$(t,C,Y):(r=n(10),e.dtick=$(t,r,G))}else if("log"===e.type){e.tick0=0;var u=l.simpleMap(e.range,e.r2l);if(t>.7)e.dtick=Math.ceil(t);else if(Math.abs(u[1]-u[0])<1){var f=1.5*Math.abs((u[1]-u[0])/t);t=Math.abs(Math.pow(10,u[1])-Math.pow(10,u[0]))/f,r=n(10),e.dtick="L"+$(t,r,G)}else e.dtick=t>.3?"D2":"D1"}else"category"===e.type||"multicategory"===e.type?(e.tick0=0,e.dtick=Math.ceil(Math.max(t,1))):ve(e)?(e.tick0=0,r=1,e.dtick=$(t,r,Q)):(e.tick0=0,r=n(10),e.dtick=$(t,r,G));if(0===e.dtick&&(e.dtick=1),!a(e.dtick)&&"string"!=typeof e.dtick){var d=e.dtick;throw e.dtick=1,"ax.dtick error: "+String(d)}},F.tickIncrement=function(e,t,r,i){var o=r?-1:1;if(a(t))return l.increment(e,o*t);var s=t.charAt(0),c=o*Number(t.substr(1));if("M"===s)return l.incrementMonth(e,c,i);if("L"===s)return Math.log(Math.pow(10,e)+c)/Math.LN10;if("D"===s){var u="D2"===t?J:W,f=e+.01*o,d=l.roundUp(l.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(t)},F.tickFirst=function(e,t){var r=e.r2l||Number,i=l.simpleMap(e.range,r,void 0,void 0,t),o=i[1]"+s,e._prevDateHead=s));t.text=c}(e,o,r,c):"log"===u?function(e,t,r,n,i){var o=e.dtick,s=t.x,c=e.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)t.text=ae(Math.pow(10,s),e,i,n);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=e.exponentformat;"power"===p||re(p)&&ne(f)?(t.text=0===f?1:1===f?"10":"10"+(f>1?"":P)+d+"",t.fontSize*=1.25):("e"===p||"E"===p)&&d>2?t.text="1"+p+(f>0?"+":P)+d:(t.text=ae(Math.pow(10,s),e,"","fakehover"),"D1"===o&&"y"===e._id.charAt(0)&&(t.dy-=t.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);t.text=String(Math.round(Math.pow(10,l.mod(s,1)))),t.fontSize*=.75}if("D1"===e.dtick){var h=String(t.text).charAt(0);"0"!==h&&"1"!==h||("y"===e._id.charAt(0)?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(s<0?.5:.25)))}}(e,o,0,c,g):"category"===u?function(e,t){var r=e._categories[Math.round(t.x)];void 0===r&&(r="");t.text=String(r)}(e,o):"multicategory"===u?function(e,t,r){var n=Math.round(t.x),a=e._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?t.text=o+" - "+i:(t.text=i,t.text2=o)}(e,o,r):ve(e)?function(e,t,r,n,a){if("radians"!==e.thetaunit||r)t.text=ae(t.x,e,a,n);else{var i=t.x/180;if(0===i)t.text="0";else{var o=function(e){function t(e,t){return Math.abs(e-t)<=1e-6}var r=function(e){for(var r=1;!t(Math.round(e*r)/r,e);)r*=10;return r}(e),n=e*r,a=Math.abs(function e(r,n){return t(n,0)?r:e(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)t.text=ae(l.deg2rad(t.x),e,a,n);else{var s=t.x<0;1===o[1]?1===o[0]?t.text="\u03c0":t.text=o[0]+"\u03c0":t.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(t.text=P+t.text)}}}}(e,o,r,c,g):function(e,t,r,n,a){"never"===a?a="":"all"===e.showexponent&&Math.abs(t.x/e.dtick)<1e-6&&(a="hide");t.text=ae(t.x,e,a,n)}(e,o,0,c,g),n||(e.tickprefix&&!h(e.showtickprefix)&&(o.text=e.tickprefix+o.text),e.ticksuffix&&!h(e.showticksuffix)&&(o.text+=e.ticksuffix)),"boundaries"===e.tickson||e.showdividers){var v=function(t){var r=e.l2p(t);return r>=0&&r<=e._length?t:null};o.xbnd=[v(o.x-.5),v(o.x+e.dtick-.5)]}return o},F.hoverLabelText=function(e,t,r){if(r!==O&&r!==t)return F.hoverLabelText(e,t)+" - "+F.hoverLabelText(e,r);var n="log"===e.type&&t<=0,a=F.tickText(e,e.c2l(n?-t:t),"hover").text;return n?0===t?"0":P+a:a};var te=["f","p","n","\u03bc","m","","k","M","G","T"];function re(e){return"SI"===e||"B"===e}function ne(e){return e>14||e<-15}function ae(e,t,r,n){var i=e<0,o=t._tickround,s=r||t.exponentformat||"B",c=t._tickexponent,u=F.getTickFormat(t),f=t.separatethousands;if(n){var d={exponentformat:s,dtick:"none"===t.showexponent?t.dtick:a(e)&&Math.abs(e)||1,range:"none"===t.showexponent?t.range.map(t.r2d):[0,e||1]};K(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,t.hoverformat&&(u=t.hoverformat)}if(u)return t._numFormat(u)(e).replace(/-/g,P);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(e=Math.abs(e))"+p+"":"B"===s&&9===c?e+="B":re(s)&&(e+=te[c/3+5]));return i?P+e:e}function ie(e,t){for(var r=[],n={},a=0;a1&&r=a.min&&e=0,i=u(e,t[1])<=0;return(r||a)&&(n||i)}if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":for(t=0;t=o(a)))){r=n;break}break;case"log":for(t=0;t0?r.bottom-u:0,f)))),t.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?n[s]=t._depth:(n[s]=t._depth=Math.max(r.width>0?u-r.top:0,f),p.reverse()),r.width>0){var v=r.right-(t._offset+t._length);v>0&&(n.xr=1,n.r=v);var m=t._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===s?n[s]=t._depth=Math.max(r.height>0?u-r.left:0,f):(n[s]=t._depth=Math.max(r.height>0?r.right-u:0,f),p.reverse()),r.height>0){var y=r.bottom-(t._offset+t._length);y>0&&(n.yb=0,n.b=y);var x=t._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===t.anchor?t.position:t._anchorAxis.domain[p[0]],t.title.text!==d._dfltTitle[h]&&(n[s]+=le(t)+(t.title.standoff||0)),t.mirror&&"free"!==t.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[c]=t.linewidth,t.mirror&&!0!==t.mirror&&(a[c]+=f),!0===t.mirror||"ticks"===t.mirror?a[g]=t._anchorAxis.domain[p[1]]:"all"!==t.mirror&&"allticks"!==t.mirror||(a[g]=[t._counterDomainMin,t._counterDomainMax][p[1]]))}W&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(e,t)),i.autoMargin(e,ue(t),n),i.autoMargin(e,fe(t),a),i.autoMargin(e,de(t),l)})),r.skipTitle||W&&"bottom"===t.side||Y.push((function(){return function(e,t){var r,n=e._fullLayout,a=t._id,i=a.charAt(0),o=t.title.font.size;if(t.title.hasOwnProperty("standoff"))r=t._depth+t.title.standoff+le(t);else{if("multicategory"===t.type)r=t._depth;else{r=10+1.5*o+(t.linewidth?t.linewidth-1:0)}r+="x"===i?"top"===t.side?o*(t.showticklabels?1:0):o*(t.showticklabels?1.5:.5):"right"===t.side?o*(t.showticklabels?1:.5):o*(t.showticklabels?.5:0)}var l,s,u,d,p=F.getPxPosition(e,t);"x"===i?(s=t._offset+t._length/2,u="top"===t.side?p-r:p+r):(u=t._offset+t._length/2,s="right"===t.side?p+r:p-r,l={rotate:"-90",offset:0});if("multicategory"!==t.type){var h=t._selections[t._id+"tick"];if(d={selection:h,side:t.side},h&&h.node()&&h.node().parentNode){var g=f.getTranslate(h.node().parentNode);d.offsetLeft=g.x,d.offsetTop=g.y}t.title.hasOwnProperty("standoff")&&(d.pad=0)}return c.draw(e,a+"title",{propContainer:t,propName:t._name+".title.text",placeholder:n._dfltTitle[i],avoid:d,transform:l,attributes:{x:s,y:u,"text-anchor":"middle"}})}(e,t)})),l.syncOrAsync(Y)}}function J(e){var r=p+(e||"tick");return w[r]||(w[r]=function(e,t){var r,n,a,i;e._selections[t].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,e._selections[t].each((function(){var e=ce(this),t=f.bBox(e.node().parentNode);r=Math.min(r,t.top),n=Math.max(n,t.bottom),a=Math.min(a,t.left),i=Math.max(i,t.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(t,r)),w[r]}},F.getTickSigns=function(e){var t=e._id.charAt(0),r={x:"top",y:"right"}[t],n=e.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==e.ticks==("x"===t)&&(a=a.map((function(e){return-e}))),e.side&&a.push({l:-1,t:-1,r:1,b:1}[e.side.charAt(0)]),a},F.makeTransFn=function(e){var t=e._id.charAt(0),r=e._offset;return"x"===t?function(t){return"translate("+(r+e.l2p(t.x))+",0)"}:function(t){return"translate(0,"+(r+e.l2p(t.x))+")"}},F.makeTransPeriodFn=function(e){var t=e._id.charAt(0),r=e._offset;return"x"===t?function(t){return"translate("+(r+e.l2p(t.periodX))+",0)"}:function(t){return"translate(0,"+(r+e.l2p(t.periodX))+")"}},F.makeTickPath=function(e,t,r,n){n=void 0!==n?n:e.ticklen;var a=e._id.charAt(0),i=(e.linewidth||1)/2;return"x"===a?"M0,"+(t+i*r)+"v"+n*r:"M"+(t+i*r)+",0h"+n*r},F.makeLabelFns=function(e,t,r){var n=e._id.charAt(0),i="boundaries"!==e.tickson&&"outside"===e.ticks,o=0,s=0;if(i&&(o+=e.ticklen),r&&"outside"===e.ticks){var c=l.deg2rad(r);o=e.ticklen*Math.cos(c)+1,s=e.ticklen*Math.sin(c)}e.showticklabels&&(i||e.showline)&&(o+=.2*e.tickfont.size);var u,f,d,p,h={labelStandoff:o+=(e.linewidth||1)/2,labelShift:s};return"x"===n?(p="bottom"===e.side?1:-1,u=s*p,f=t+o*p,d="bottom"===e.side?1:-.2,h.xFn=function(e){return e.dx+u},h.yFn=function(e){return e.dy+f+e.fontSize*d},h.anchorFn=function(e,t){return a(t)&&0!==t&&180!==t?t*p<0?"end":"start":"middle"},h.heightFn=function(t,r,n){return r<-60||r>60?-.5*n:"top"===e.side?-n:0}):"y"===n&&(p="right"===e.side?1:-1,u=o,f=-s*p,d=90===Math.abs(e.tickangle)?.5:0,h.xFn=function(e){return e.dx+t+(u+e.fontSize*d)*p},h.yFn=function(e){return e.dy+f+e.fontSize*E},h.anchorFn=function(t,r){return a(r)&&90===Math.abs(r)?"middle":"right"===e.side?"start":"end"},h.heightFn=function(t,r,n){return(r*="left"===e.side?1:-1)<-30?-n:r<30?-.5*n:0}),h},F.drawTicks=function(e,t,r){r=r||{};var n=t._id+"tick",a=r.vals;"period"===t.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(t.ticks?a:[],oe);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(u.stroke,t.tickcolor).style("stroke-width",f.crispRound(e,t.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},F.drawGrid=function(e,t,r){r=r||{};var n=t._id+"grid",a=r.vals,i=r.counterAxis;if(!1===t.showgrid)a=[];else if(i&&F.shouldShowZeroLine(e,t,i))for(var o="array"===t.tickmode,l=0;l1)for(n=1;n2*o}(e,t)?"date":function(e){for(var t=Math.max(1,(e.length-1)/1e3),r=0,n=0,o={},l=0;l2*r}(e)?"category":function(e){if(!e)return!1;for(var t=0;t=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(t.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!n(c))return void(t.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(t.enabled=!1);t.bounds[s]=o[s]=c;break;case g:if(!n(c))return void(t.enabled=!1);if((c=+c)<0||c>24)return void(t.enabled=!1);t.bounds[s]=o[s]=c}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(t.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(e.substr(1)||1)-+(t.substr(1)||1)},r.getAxisGroup=function(e,t){for(var r=e._axisMatchGroups,n=0;n0;o&&(a="array");var l,s=r("categoryorder",a);"array"===s&&(l=r("categoryarray")),o||"array"!==s||(s=t.categoryorder="trace"),"trace"===s?t._initialCategories=[]:"array"===s?t._initialCategories=l.slice():(l=function(e,t){var r,n,a,i=t.dataAttr||e._id.charAt(0),o={};if(t.axData)r=t.axData;else for(r=[],n=0;ns*x)||k)for(r=0;rE&&IO&&(O=I);p/=(O-P)/(2*D),P=c.l2r(P),O=c.l2r(O),c.range=c._input.range=L=0?Math.min(e,.9):1/(1/Math.max(e,-.3)+3.222))}function F(e,t,r,n,a){return e.append("path").attr("class","zoombox").style({fill:t>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function N(e,t,r){return e.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+t+", "+r+")").attr("d","M0,0Z")}function j(e,t,r,n,a,i){e.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),H(e,t,a,i)}function H(e,t,r,n){r||(e.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),t.transition().style("opacity",1).duration(200))}function B(e){n.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function U(e){P&&e.data&&e._context.showTips&&(l.notifier(l._(e,"Double-click to zoom back out"),"long"),P=!1)}function q(e){var t=Math.floor(Math.min(e.b-e.t,e.r-e.l,C)/2);return"M"+(e.l-3.5)+","+(e.t-.5+t)+"h3v"+-t+"h"+t+"v-3h-"+(t+3)+"ZM"+(e.r+3.5)+","+(e.t-.5+t)+"h-3v"+-t+"h"+-t+"v-3h"+(t+3)+"ZM"+(e.r+3.5)+","+(e.b+.5-t)+"h-3v"+t+"h"+-t+"v3h"+(t+3)+"ZM"+(e.l-3.5)+","+(e.b+.5-t)+"h3v"+t+"h"+t+"v3h-"+(t+3)+"Z"}function V(e,t,r,n){for(var a,i,o,s,c=!1,u={},f={},d=0;d=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(B(a),2!==e||he||Be(),pe)i.indexOf("select")>-1&&T(r,a,W,J,t.id,Se),i.indexOf("event")>-1&&f.click(a,r,t.id);else if(1===e&&he){var l=g?H:O,c="s"===g||"w"===P?0:1,u=l._name+".range["+c+"]",d=function(e,t){var r,a=e.range[t],i=Math.abs(a-e.range[1-t]);return"date"===e.type?a:"log"===e.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(l,c),p="left",h="middle";if(l.fixedrange)return;g?(h="n"===g?"top":"bottom","right"===l.side&&(p="right")):"e"===P&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(me).call(s.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(d),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:h}).on("edit",(function(e){var t=l.d2r(e);void 0!==t&&o.call("_guiRelayout",a,u,t)}))}}}function Oe(t,r){if(e._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,t+ye)),a=Math.max(0,Math.min(ee,r+xe)),i=Math.abs(n-ye),o=Math.abs(a-xe);function l(){Me="",be.r=be.l,be.t=be.b,Ae.attr("d","M0,0Z")}if(be.l=Math.min(ye,n),be.r=Math.max(ye,n),be.t=Math.min(xe,a),be.b=Math.max(xe,a),te.isSubplotConstrained)i>C||o>C?(Me="xy",i/K>o/ee?(o=i*ee/K,xe>a?be.t=xe-o:be.b=xe+o):(i=o*K/ee,ye>n?be.l=ye-i:be.r=ye+i),Ae.attr("d",q(be))):l();else if(re.isSubplotConstrained)if(i>C||o>C){Me="xy";var s=Math.min(be.l/K,(ee-be.b)/ee),c=Math.max(be.r/K,(ee-be.t)/ee);be.l=s*K,be.r=c*K,be.b=(1-s)*ee,be.t=(1-c)*ee,Ae.attr("d",q(be))}else l();else!ae||og[1]-1/4096&&(t.domain=l),a.noneOrAll(e.domain,t.domain,l)}return r("layer"),t}},{"../../lib":180,"fast-isnumeric":17}],243:[function(e,t,r){"use strict";var n=e("../../constants/alignment").FROM_BL;t.exports=function(e,t,r){void 0===r&&(r=n[e.constraintoward||"center"]);var a=[e.r2l(e.range[0]),e.r2l(e.range[1])],i=a[0]+(a[1]-a[0])*r;e.range=e._input.range=[e.l2r(i+(a[0]-i)*t),e.l2r(i+(a[1]-i)*t)]}},{"../../constants/alignment":154}],244:[function(e,t,r){"use strict";var n=e("polybooljs"),a=e("../../registry"),i=e("../../components/drawing").dashStyle,o=e("../../components/color"),l=e("../../components/fx"),s=e("../../components/fx/helpers").makeEventData,c=e("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=e("../../components/shapes/draw_newshape/display_outlines"),v=e("../../components/shapes/draw_newshape/helpers").handleEllipse,m=e("../../components/shapes/draw_newshape/newshapes"),y=e("../../lib"),x=e("../../lib/polygon"),b=e("../../lib/throttle"),_=e("./axis_ids").getFromId,w=e("../../lib/clear_gl_canvases"),k=e("../../plot_api/subroutines").redrawReglTraces,M=e("./constants"),T=M.MINSELECT,A=x.filter,L=x.tester,S=e("./handle_outline").clearSelect,C=e("./helpers"),P=C.p2r,O=C.axValue,D=C.getTransform;function E(e,t,r,n,a,i,o){var l,s,c,u,f,d,h,v,m,y=t._hoverdata,x=t._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(e){return e&&Array.isArray(e)&&!0!==e[0].hoverOnBox}(y)){F(e,t,i);var _=function(e,t){var r,n,a=e[0],i=-1,o=[];for(n=0;n0?function(e,t){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===t.searchInfo&&(n=t.searchInfo.cd[0].trace).selectedpoints.length===t.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=H(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(t)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,e);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=e.selectionDefs=[],r.selection.mergedPolygons=e.mergedPolygons=[]}function j(e,t,r,n){var a,i,o,l=[],s=t.map((function(e){return e._id})),c=r.map((function(e){return e._id}));for(o=0;o0?n[0]:r;return!!t.selectedpoints&&t.selectedpoints.indexOf(a)>-1}function B(e,t,r){var n,i,o,l;for(n=0;n=0)Y._fullLayout._deactivateShape(Y);else if(!H){var r=X.clickmode;b.done(de).then((function(){if(b.clear(de),2===e){for(se.remove(),w=0;w-1&&E(t,Y,a.xaxes,a.yaxes,a.subplot,a,se),"event"===r&&Y.emit("plotly_selected",void 0);l.click(Y,t)})).catch(y.error)}},a.doneFn=function(){fe.remove(),b.done(de).then((function(){b.clear(de),a.gd.emit("plotly_selected",S),_&&a.selectionDefs&&(_.subtract=le,a.selectionDefs.push(_),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,x)),a.doneFnCompleted&&a.doneFnCompleted(pe)})).catch(y.error),H&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:E}},{"../../components/color":52,"../../components/dragelement/helpers":70,"../../components/drawing":74,"../../components/fx":92,"../../components/fx/helpers":88,"../../components/shapes/draw_newshape/display_outlines":137,"../../components/shapes/draw_newshape/helpers":138,"../../components/shapes/draw_newshape/newshapes":139,"../../lib":180,"../../lib/clear_gl_canvases":166,"../../lib/polygon":192,"../../lib/throttle":202,"../../plot_api/subroutines":216,"../../registry":275,"./axis_ids":228,"./constants":231,"./handle_outline":235,"./helpers":236,polybooljs:25}],245:[function(e,t,r){"use strict";var n=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../../lib"),l=o.cleanNumber,s=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,d=e("../../constants/numerical"),p=d.FP_SAFE,h=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,x=d.ONEMIN,b=d.ONESEC,_=e("./axis_ids"),w=e("./constants"),k=w.HOUR_PATTERN,M=w.WEEKDAY_PATTERN;function T(e){return Math.pow(10,e)}function A(e){return null!=e}t.exports=function(e,t){t=t||{};var r=e._id||"x",d=r.charAt(0);function L(t,r){if(t>0)return Math.log(t)/Math.LN10;if(t<=0&&r&&e.range&&2===e.range.length){var n=e.range[0],a=e.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return h}function S(t,r,n,a){if((a||{}).msUTC&&i(t))return+t;var l=c(t,n||e.calendar);if(l===h){if(!i(t))return h;t=+t;var s=Math.floor(10*o.mod(t+.05,1)),u=Math.round(t-s/10);l=c(new Date(u))+s/10}return l}function C(t,r,n){return s(t,r,n||e.calendar)}function P(t){return e._categories[Math.round(t)]}function O(t){if(A(t)){if(void 0===e._categoriesMap&&(e._categoriesMap={}),void 0!==e._categoriesMap[t])return e._categoriesMap[t];e._categories.push("number"==typeof t?String(t):t);var r=e._categories.length-1;return e._categoriesMap[t]=r,r}return h}function D(t){if(e._categoriesMap)return e._categoriesMap[t]}function E(e){var t=D(e);return void 0!==t?t:i(e)?+e:void 0}function z(e,t,r){return n.round(r+t*e,2)}function R(e,t,r){return(e-r)/t}var I=function(t){return i(t)?z(t,e._m,e._b):h},F=function(t){return R(t,e._m,e._b)};if(e.rangebreaks){var N="y"===d;I=function(t){if(!i(t))return h;var r=e._rangebreaks.length;if(!r)return z(t,e._m,e._b);var n=N;e.range[0]>e.range[1]&&(n=!n);for(var a=n?-1:1,o=a*t,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=e._B[l]||0;return isFinite(f)?z(t,e._m2,f):0},F=function(t){var r=e._rangebreaks.length;if(!r)return R(t,e._m,e._b);for(var n=0,a=0;ae._rangebreaks[a].pmax&&(n=a+1);return R(t,e._m2,e._B[n])}}e.c2l="log"===e.type?L:u,e.l2c="log"===e.type?T:u,e.l2p=I,e.p2l=F,e.c2p="log"===e.type?function(e,t){return I(L(e,t))}:I,e.p2c="log"===e.type?function(e){return T(F(e))}:F,-1!==["linear","-"].indexOf(e.type)?(e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=l,e.c2d=e.c2r=e.l2d=e.l2r=u,e.d2p=e.r2p=function(t){return e.l2p(l(t))},e.p2d=e.p2r=F,e.cleanPos=u):"log"===e.type?(e.d2r=e.d2l=function(e,t){return L(l(e),t)},e.r2d=e.r2c=function(e){return T(l(e))},e.d2c=e.r2l=l,e.c2d=e.l2r=u,e.c2r=L,e.l2d=T,e.d2p=function(t,r){return e.l2p(e.d2r(t,r))},e.p2d=function(e){return T(F(e))},e.r2p=function(t){return e.l2p(l(t))},e.p2r=F,e.cleanPos=u):"date"===e.type?(e.d2r=e.r2d=o.identity,e.d2c=e.r2c=e.d2l=e.r2l=S,e.c2d=e.c2r=e.l2d=e.l2r=C,e.d2p=e.r2p=function(t,r,n){return e.l2p(S(t,0,n))},e.p2d=e.p2r=function(e,t,r){return C(F(e),t,r)},e.cleanPos=function(t){return o.cleanDate(t,h,e.calendar)}):"category"===e.type?(e.d2c=e.d2l=O,e.r2d=e.c2d=e.l2d=P,e.d2r=e.d2l_noadd=E,e.r2c=function(t){var r=E(t);return void 0!==r?r:e.fraction2r(.5)},e.l2r=e.c2r=u,e.r2l=E,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return P(F(e))},e.r2p=e.d2p,e.p2r=F,e.cleanPos=function(e){return"string"==typeof e&&""!==e?e:u(e)}):"multicategory"===e.type&&(e.r2d=e.c2d=e.l2d=P,e.d2r=e.d2l_noadd=E,e.r2c=function(t){var r=E(t);return void 0!==r?r:e.fraction2r(.5)},e.r2c_just_indices=D,e.l2r=e.c2r=u,e.r2l=E,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return P(F(e))},e.r2p=e.d2p,e.p2r=F,e.cleanPos=function(e){return Array.isArray(e)||"string"==typeof e&&""!==e?e:u(e)},e.setupMultiCategory=function(n){var a,i,l=e._traceIndices,s=t._axisMatchGroups;if(s&&s.length&&0===e._categories.length)for(a=0;ap&&(l[n]=p),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else o.nestedProperty(e,t).set(a)},e.setScale=function(r){var n=t._size;if(e.overlaying){var a=_.getFromId({_fullLayout:t},e.overlaying);e.domain=a.domain}var i=r&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var l,s,c=e.r2l(e[i][0],o),u=e.r2l(e[i][1],o),f="y"===d;if((f?(e._offset=n.t+(1-e.domain[1])*n.h,e._length=n.h*(e.domain[1]-e.domain[0]),e._m=e._length/(c-u),e._b=-e._m*u):(e._offset=n.l+e.domain[0]*n.w,e._length=n.w*(e.domain[1]-e.domain[0]),e._m=e._length/(u-c),e._b=-e._m*c),e._rangebreaks=[],e._lBreaks=0,e._m2=0,e._B=[],e.rangebreaks)&&(e._rangebreaks=e.locateBreaks(Math.min(c,u),Math.max(c,u)),e._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&e._rangebreaks.reverse();var h=p?-1:1;for(e._m2=h*e._length/(Math.abs(u-c)-e._lBreaks),e._B.push(-e._m2*(f?u:c)),l=0;la&&(a+=7,ia&&(a+=24,i=n&&i=n&&t=l.min&&(el.max&&(l.max=n),a=!1)}a&&c.push({min:e,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),e.plot.call(o.setTranslate,t._offset,r._offset).call(o.setScale,1,1);var n=e.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,e)}function v(t,r){var n=t.plotinfo,a=n.xaxis,s=n.yaxis,c=a._length,u=s._length,f=!!t.xr1,d=!!t.yr1,p=[];if(f){var h=i.simpleMap(t.xr0,a.r2l),g=i.simpleMap(t.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-r)+r*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-r+r*m/v),a.range[0]=a.l2r(h[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(h[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(t.yr0,s.r2l),x=i.simpleMap(t.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),s.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),s.range[1]=s.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;l.drawOne(e,a,{skipTitle:!0}),l.drawOne(e,s,{skipTitle:!0}),l.redrawComponents(e,[a._id,s._id]);var w=f?c/p[2]:1,k=d?u/p[3]:1,M=f?p[0]:0,T=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;n.clipRect.call(o.setTranslate,M,T).call(o.setScale,1/w,1/k),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,k),o.setPointGroupScale(n.zoomScalePts,1/w,1/k),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/k)}l.redrawComponents(e)}},{"../../components/drawing":74,"../../lib":180,"../../registry":275,"./axes":225,d3:15}],250:[function(e,t,r){"use strict";var n=e("../../registry").traceIs,a=e("./axis_autotype");function i(e){return{v:"x",h:"y"}[e.orientation||"v"]}function o(e,t){var r=i(e),a=n(e,"box-violin"),o=n(e._fullInput||{},"candlestick");return a&&!o&&t===r&&void 0===e[r]&&void 0===e[r+"0"]}t.exports=function(e,t,r,l){"-"===r("type",(l.splomStash||{}).type)&&(!function(e,t){if("-"!==e.type)return;var r,l=e._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(e,t,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[t])return a;if((a[r+"axis"]||r)===t){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(t,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(e.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(o(c,s)){var p=i(c),h=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?s(o,t,l,n+1):t(l,i,o)}}))}r.manageCommandObserver=function(e,t,n,o){var l={},s=!0;t&&t._commandObserver&&(l=t._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=r.hasSimpleAPICommandBindings(e,n,l.lookupTable);if(t&&t._commandObserver){if(c)return l;if(t._commandObserver.remove)return t._commandObserver.remove(),t._commandObserver=null,l}if(c){i(e,c,l.cache),l.check=function(){if(s){var t=i(e,c,l.cache);return t.changed&&o&&void 0!==l.lookupTable[t.value]&&(l.disable(),Promise.resolve(o({value:t.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[t.value]})).then(l.enable,l.enable)),t.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f0&&a<0&&(a+=360);var l=(a-n)/4;return{type:"Polygon",coordinates:[[[n,i],[n,o],[n+l,o],[n+2*l,o],[n+3*l,o],[a,o],[a,i],[a-l,i],[a-2*l,i],[a-3*l,i],[n,i]]]}}t.exports=function(e){return new _(e)},w.plot=function(e,t,r){var n=this,a=t[this.id],i=[],o=!1;for(var l in m.layerNameToAdjective)if("frame"!==l&&a["show"+l]){o=!0;break}for(var s=0;s0&&i._module.calcGeoJSON(a,t)}if(!this.updateProjection(e,t)){this.viewInitial&&this.scope===r.scope||this.saveViewInitial(r),this.scope=r.scope,this.updateBaseLayers(t,r),this.updateDims(t,r),this.updateFx(t,r),c.generalUpdatePerTraceModule(this.graphDiv,this,e,r);var o=this.layers.frontplot.select(".scatterlayer");this.dataPoints.point=o.selectAll(".point"),this.dataPoints.text=o.selectAll("text"),this.dataPaths.line=o.selectAll(".js-line");var l=this.layers.backplot.select(".choroplethlayer");this.dataPaths.choropleth=l.selectAll("path"),this.render()}},w.updateProjection=function(e,t){var r=this.graphDiv,o=t[this.id],l=t._size,s=o.domain,c=o.projection,u=o.lonaxis,d=o.lataxis,p=u._ax,h=d._ax,g=this.projection=function(e){for(var t=e.projection.type,r=n.geo[m.projNames[t]](),a=e._isClipped?m.lonaxisSpan[t]/2:null,i=["center","rotate","parallels","clipExtent"],o=function(e){return e?r:[]},l=0;la*Math.PI/180}return!1},r.getPath=function(){return n.geo.path().projection(r)},r.getBounds=function(e){return r.getPath().bounds(e)},r.fitExtent=function(e,t){var n=e[1][0]-e[0][0],a=e[1][1]-e[0][1],i=r.clipExtent&&r.clipExtent();r.scale(150).translate([0,0]),i&&r.clipExtent(null);var o=r.getBounds(t),l=Math.min(n/(o[1][0]-o[0][0]),a/(o[1][1]-o[0][1])),s=+e[0][0]+(n-l*(o[1][0]+o[0][0]))/2,c=+e[0][1]+(a-l*(o[1][1]+o[0][1]))/2;return i&&r.clipExtent(i),r.scale(150*l).translate([s,c])},r.precision(m.precision),a&&r.clipAngle(a-m.clipPad);return r}(o),v=[[l.l+l.w*s.x[0],l.t+l.h*(1-s.y[1])],[l.l+l.w*s.x[1],l.t+l.h*(1-s.y[0])]],y=o.center||{},x=c.rotation||{},b=u.range||[],_=d.range||[];if(o.fitbounds){p._length=v[1][0]-v[0][0],h._length=v[1][1]-v[0][1],p.range=f(r,p),h.range=f(r,h);var w=(p.range[0]+p.range[1])/2,M=(h.range[0]+h.range[1])/2;if(o._isScoped)y={lon:w,lat:M};else if(o._isClipped){y={lon:w,lat:M},x={lon:w,lat:M,roll:x.roll};var T=c.type,A=m.lonaxisSpan[T]/2||180,L=m.lataxisSpan[T]/2||90;b=[w-A,w+A],_=[M-L,M+L]}else y={lon:w,lat:M},x={lon:w,lat:x.lat,roll:x.roll}}g.center([y.lon-x.lon,y.lat-x.lat]).rotate([-x.lon,-x.lat,x.roll]).parallels(c.parallels);var S=k(b,_);g.fitExtent(v,S);var C=this.bounds=g.getBounds(S),P=this.fitScale=g.scale(),O=g.translate();if(!isFinite(C[0][0])||!isFinite(C[0][1])||!isFinite(C[1][0])||!isFinite(C[1][1])||isNaN(O[0])||isNaN(O[0])){for(var D=["fitbounds","projection.rotation","center","lonaxis.range","lataxis.range"],E="Invalid geo settings, relayout'ing to default view.",z={},R=0;R-1&&g(n.event,i,[r.xaxis],[r.yaxis],r.id,f),c.indexOf("event")>-1&&s.click(i,n.event))}))}function m(e){return r.projection.invert([e[0]+r.xaxis._offset,e[1]+r.yaxis._offset])}},w.makeFramework=function(){var e=this,t=e.graphDiv,r=t._fullLayout,a="clip"+r._uid+e.id;e.clipDef=r._clips.append("clipPath").attr("id",a),e.clipRect=e.clipDef.append("rect"),e.framework=n.select(e.container).append("g").attr("class","geo "+e.id).call(l.setClipUrl,a,t),e.project=function(t){var r=e.projection(t);return r?[r[0]-e.xaxis._offset,r[1]-e.yaxis._offset]:[null,null]},e.xaxis={_id:"x",c2p:function(t){return e.project(t)[0]}},e.yaxis={_id:"y",c2p:function(t){return e.project(t)[1]}},e.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},u.setConvert(e.mockAxis,r)},w.saveViewInitial=function(e){var t,r=e.center||{},n=e.projection,a=n.rotation||{};this.viewInitial={fitbounds:e.fitbounds,"projection.scale":n.scale},t=e._isScoped?{"center.lon":r.lon,"center.lat":r.lat}:e._isClipped?{"projection.rotation.lon":a.lon,"projection.rotation.lat":a.lat}:{"center.lon":r.lon,"center.lat":r.lat,"projection.rotation.lon":a.lon},i.extendFlat(this.viewInitial,t)},w.render=function(){var e,t=this.projection,r=t.getPath();function n(e){var r=t(e.lonlat);return r?"translate("+r[0]+","+r[1]+")":null}function a(e){return t.isLonLatOverEdges(e.lonlat)?"none":null}for(e in this.basePaths)this.basePaths[e].attr("d",r);for(e in this.dataPaths)this.dataPaths[e].attr("d",(function(e){return r(e.geojson)}));for(e in this.dataPoints)this.dataPoints[e].attr("display",a).attr("transform",n)}},{"../../components/color":52,"../../components/dragelement":71,"../../components/drawing":74,"../../components/fx":92,"../../lib":180,"../../lib/geo_location_utils":175,"../../lib/topojson_utils":204,"../../registry":275,"../cartesian/autorange":224,"../cartesian/axes":225,"../cartesian/select":244,"../plots":266,"./constants":255,"./projections":260,"./zoom":261,d3:15,"topojson-client":35}],257:[function(e,t,r){"use strict";var n=e("../../plots/get_data").getSubplotCalcData,a=e("../../lib").counterRegex,i=e("./geo"),o="geo",l=a(o),s={};s.geo={valType:"subplotid",dflt:o,editType:"calc"},t.exports={attr:o,name:o,idRoot:o,idRegex:l,attrRegex:l,attributes:s,layoutAttributes:e("./layout_attributes"),supplyLayoutDefaults:e("./layout_defaults"),plot:function(e){for(var t=e._fullLayout,r=e.calcdata,a=t._subplots.geo,l=0;l0&&P<0&&(P+=360);var O,D,E,z=(C+P)/2;if(!p){var R=h?f.projRotate:[z,0,0];O=r("projection.rotation.lon",R[0]),r("projection.rotation.lat",R[1]),r("projection.rotation.roll",R[2]),r("showcoastlines",!h&&y)&&(r("coastlinecolor"),r("coastlinewidth")),r("showocean",!!y&&void 0)&&r("oceancolor")}(p?(D=-96.6,E=38.7):(D=h?z:O,E=(S[0]+S[1])/2),r("center.lon",D),r("center.lat",E),g)&&r("projection.parallels",f.projParallels||[0,60]);r("projection.scale"),r("showland",!!y&&void 0)&&r("landcolor"),r("showlakes",!!y&&void 0)&&r("lakecolor"),r("showrivers",!!y&&void 0)&&(r("rivercolor"),r("riverwidth")),r("showcountries",h&&"usa"!==u&&y)&&(r("countrycolor"),r("countrywidth")),("usa"===u||"north america"===u&&50===c)&&(r("showsubunits",y),r("subunitcolor"),r("subunitwidth")),h||r("showframe",y)&&(r("framecolor"),r("framewidth")),r("bgcolor"),r("fitbounds")&&(delete t.projection.scale,h?(delete t.center.lon,delete t.center.lat):v?(delete t.center.lon,delete t.center.lat,delete t.projection.rotation.lon,delete t.projection.rotation.lat,delete t.lonaxis.range,delete t.lataxis.range):(delete t.center.lon,delete t.center.lat,delete t.projection.rotation.lon))}t.exports=function(e,t,r){a(e,t,r,{type:"geo",attributes:l,handleDefaults:c,fullData:r,partition:"y"})}},{"../../lib":180,"../get_data":262,"../subplot_defaults":273,"./constants":255,"./layout_attributes":258}],260:[function(e,t,r){"use strict";t.exports=function(e){function t(e,t){return{type:"Feature",id:e.id,properties:e.properties,geometry:r(e.geometry,t)}}function r(t,n){if(!t)return null;if("GeometryCollection"===t.type)return{type:"GeometryCollection",geometries:object.geometries.map((function(e){return r(e,n)}))};if(!c.hasOwnProperty(t.type))return null;var a=c[t.type];return e.geo.stream(t,n(a)),a.result()}e.geo.project=function(e,t){var a=t.stream;if(!a)throw new Error("not yet supported");return(e&&n.hasOwnProperty(e.type)?n[e.type]:r)(e,a)};var n={Feature:t,FeatureCollection:function(e,r){return{type:"FeatureCollection",features:e.features.map((function(e){return t(e,r)}))}}},a=[],i=[],o={point:function(e,t){a.push([e,t])},result:function(){var e=a.length?a.length<2?{type:"Point",coordinates:a[0]}:{type:"MultiPoint",coordinates:a}:null;return a=[],e}},l={lineStart:u,point:function(e,t){a.push([e,t])},lineEnd:function(){a.length&&(i.push(a),a=[])},result:function(){var e=i.length?i.length<2?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i}:null;return i=[],e}},s={polygonStart:u,lineStart:u,point:function(e,t){a.push([e,t])},lineEnd:function(){var e=a.length;if(e){do{a.push(a[0].slice())}while(++e<4);i.push(a),a=[]}},polygonEnd:u,result:function(){if(!i.length)return null;var e=[],t=[];return i.forEach((function(r){!function(e){if((t=e.length)<4)return!1;var t,r=0,n=e[t-1][1]*e[0][0]-e[t-1][0]*e[0][1];for(;++rn^p>n&&r<(d-c)*(n-u)/(p-u)+c&&(a=!a)}return a}(e[0],r))return e.push(t),!0}))||e.push([t])})),i=[],e.length?e.length>1?{type:"MultiPolygon",coordinates:e}:{type:"Polygon",coordinates:e[0]}:null}},c={Point:o,MultiPoint:o,LineString:l,MultiLineString:l,Polygon:s,MultiPolygon:s,Sphere:s};function u(){}var f=1e-6,d=Math.PI,p=d/2,h=(Math.sqrt(d),d/180),g=180/d;function v(e){return e>1?p:e<-1?-p:Math.asin(e)}function m(e){return e>1?0:e<-1?d:Math.acos(e)}var y=e.geo.projection,x=e.geo.projectionMutator;function b(e,t){var r=(2+p)*Math.sin(t);t/=2;for(var n=0,a=1/0;n<10&&Math.abs(a)>f;n++){var i=Math.cos(t);t-=a=(t+Math.sin(t)*(i+2)-r)/(2*i*(1+i))}return[2/Math.sqrt(d*(4+d))*e*(1+Math.cos(t)),2*Math.sqrt(d/(4+d))*Math.sin(t)]}e.geo.interrupt=function(t){var r,n=[[[[-d,0],[0,p],[d,0]]],[[[-d,0],[0,-p],[d,0]]]];function a(e,r){for(var a=r<0?-1:1,i=n[+(r<0)],o=0,l=i.length-1;oi[o][2][0];++o);var s=t(e-i[o][1][0],r);return s[0]+=t(i[o][1][0],a*r>a*i[o][0][1]?i[o][0][1]:r)[0],s}function i(){r=n.map((function(e){return e.map((function(e){var r,n=t(e[0][0],e[0][1])[0],a=t(e[2][0],e[2][1])[0],i=t(e[1][0],e[0][1])[1],o=t(e[1][0],e[1][1])[1];return i>o&&(r=i,i=o,o=r),[[n,i],[a,o]]}))}))}t.invert&&(a.invert=function(e,i){for(var o=r[+(i<0)],l=n[+(i<0)],s=0,u=o.length;s=0;--a){var p;o=180*(p=n[1][a])[0][0]/d,l=180*p[0][1]/d,c=180*p[1][1]/d,u=180*p[2][0]/d,f=180*p[2][1]/d;r.push(s([[u-t,f-t],[u-t,c+t],[o+t,c+t],[o+t,l-t]],30))}return{type:"Polygon",coordinates:[e.merge(r)]}}(),i)},a},o.lobes=function(e){return arguments.length?(n=e.map((function(e){return e.map((function(e){return[[e[0][0]*d/180,e[0][1]*d/180],[e[1][0]*d/180,e[1][1]*d/180],[e[2][0]*d/180,e[2][1]*d/180]]}))})),i(),o):n.map((function(e){return e.map((function(e){return[[180*e[0][0]/d,180*e[0][1]/d],[180*e[1][0]/d,180*e[1][1]/d],[180*e[2][0]/d,180*e[2][1]/d]]}))}))},o},b.invert=function(e,t){var r=.5*t*Math.sqrt((4+d)/d),n=v(r),a=Math.cos(n);return[e/(2/Math.sqrt(d*(4+d))*(1+a)),v((n+r*(a+2))/(2+p))]},(e.geo.eckert4=function(){return y(b)}).raw=b;var _=e.geo.azimuthalEqualArea.raw;function w(e,t){if(arguments.length<2&&(t=e),1===t)return _;if(t===1/0)return k;function r(r,n){var a=_(r/t,n);return a[0]*=e,a}return r.invert=function(r,n){var a=_.invert(r/e,n);return a[0]*=t,a},r}function k(e,t){return[e*Math.cos(t)/Math.cos(t/=2),2*Math.sin(t)]}function M(e,t){return[3*e/(2*d)*Math.sqrt(d*d/3-t*t),t]}function T(e,t){return[e,1.25*Math.log(Math.tan(d/4+.4*t))]}function A(e){return function(t){var r,n=e*Math.sin(t),a=30;do{t-=r=(t+Math.sin(t)-n)/(1+Math.cos(t))}while(Math.abs(r)>f&&--a>0);return t/2}}k.invert=function(e,t){var r=2*v(t/2);return[e*Math.cos(r/2)/Math.cos(r),r]},(e.geo.hammer=function(){var e=2,t=x(w),r=t(e);return r.coefficient=function(r){return arguments.length?t(e=+r):e},r}).raw=w,M.invert=function(e,t){return[2/3*d*e/Math.sqrt(d*d/3-t*t),t]},(e.geo.kavrayskiy7=function(){return y(M)}).raw=M,T.invert=function(e,t){return[e,2.5*Math.atan(Math.exp(.8*t))-.625*d]},(e.geo.miller=function(){return y(T)}).raw=T,A(d);var L=function(e,t,r){var n=A(r);function a(r,a){return[e*r*Math.cos(a=n(a)),t*Math.sin(a)]}return a.invert=function(n,a){var i=v(a/t);return[n/(e*Math.cos(i)),v((2*i+Math.sin(2*i))/r)]},a}(Math.SQRT2/p,Math.SQRT2,d);function S(e,t){var r=t*t,n=r*r;return[e*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791)),t*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))]}(e.geo.mollweide=function(){return y(L)}).raw=L,S.invert=function(e,t){var r,n=t,a=25;do{var i=n*n,o=i*i;n-=r=(n*(1.007226+i*(.015085+o*(.028874*i-.044475-.005916*o)))-t)/(1.007226+i*(.045255+o*(.259866*i-.311325-.005916*11*o)))}while(Math.abs(r)>f&&--a>0);return[e/(.8707+(i=n*n)*(i*(i*i*i*(.003971-.001529*i)-.013791)-.131979)),n]},(e.geo.naturalEarth=function(){return y(S)}).raw=S;var C=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];function P(e,t){var r,n=Math.min(18,36*Math.abs(t)/d),a=Math.floor(n),i=n-a,o=(r=C[a])[0],l=r[1],s=(r=C[++a])[0],c=r[1],u=(r=C[Math.min(19,++a)])[0],f=r[1];return[e*(s+i*(u-o)/2+i*i*(u-2*s+o)/2),(t>0?p:-p)*(c+i*(f-l)/2+i*i*(f-2*c+l)/2)]}function O(e,t){return[e*Math.cos(t),t]}function D(e,t){var r,n=Math.cos(t),a=(r=m(n*Math.cos(e/=2)))?r/Math.sin(r):1;return[2*n*Math.sin(e)*a,Math.sin(t)*a]}function E(e,t){var r=D(e,t);return[(r[0]+e/p)/2,(r[1]+t)/2]}C.forEach((function(e){e[1]*=1.0144})),P.invert=function(e,t){var r=t/p,n=90*r,a=Math.min(18,Math.abs(n/5)),i=Math.max(0,Math.floor(a));do{var o=C[i][1],l=C[i+1][1],s=C[Math.min(19,i+2)][1],c=s-o,u=s-2*l+o,f=2*(Math.abs(r)-l)/c,d=u/c,v=f*(1-d*f*(1-2*d*f));if(v>=0||1===i){n=(t>=0?5:-5)*(v+a);var m,y=50;do{v=(a=Math.min(18,Math.abs(n)/5))-(i=Math.floor(a)),o=C[i][1],l=C[i+1][1],s=C[Math.min(19,i+2)][1],n-=(m=(t>=0?p:-p)*(l+v*(s-o)/2+v*v*(s-2*l+o)/2)-t)*g}while(Math.abs(m)>1e-12&&--y>0);break}}while(--i>=0);var x=C[i][0],b=C[i+1][0],_=C[Math.min(19,i+2)][0];return[e/(b+v*(_-x)/2+v*v*(_-2*b+x)/2),n*h]},(e.geo.robinson=function(){return y(P)}).raw=P,O.invert=function(e,t){return[e/Math.cos(t),t]},(e.geo.sinusoidal=function(){return y(O)}).raw=O,D.invert=function(e,t){if(!(e*e+4*t*t>d*d+f)){var r=e,n=t,a=25;do{var i,o=Math.sin(r),l=Math.sin(r/2),s=Math.cos(r/2),c=Math.sin(n),u=Math.cos(n),p=Math.sin(2*n),h=c*c,g=u*u,v=l*l,y=1-g*s*s,x=y?m(u*s)*Math.sqrt(i=1/y):i=0,b=2*x*u*l-e,_=x*c-t,w=i*(g*v+x*u*s*h),k=i*(.5*o*p-2*x*c*l),M=.25*i*(p*l-x*c*g*o),T=i*(h*s+x*v*u),A=k*M-T*w;if(!A)break;var L=(_*k-b*T)/A,S=(b*M-_*w)/A;r-=L,n-=S}while((Math.abs(L)>f||Math.abs(S)>f)&&--a>0);return[r,n]}},(e.geo.aitoff=function(){return y(D)}).raw=D,E.invert=function(e,t){var r=e,n=t,a=25;do{var i,o=Math.cos(n),l=Math.sin(n),s=Math.sin(2*n),c=l*l,u=o*o,d=Math.sin(r),h=Math.cos(r/2),g=Math.sin(r/2),v=g*g,y=1-u*h*h,x=y?m(o*h)*Math.sqrt(i=1/y):i=0,b=.5*(2*x*o*g+r/p)-e,_=.5*(x*l+n)-t,w=.5*i*(u*v+x*o*h*c)+.5/p,k=i*(d*s/4-x*l*g),M=.125*i*(s*g-x*l*u*d),T=.5*i*(c*h+x*v*o)+.5,A=k*M-T*w,L=(_*k-b*T)/A,S=(b*M-_*w)/A;r-=L,n-=S}while((Math.abs(L)>f||Math.abs(S)>f)&&--a>0);return[r,n]},(e.geo.winkel3=function(){return y(E)}).raw=E}},{}],261:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../registry"),o=Math.PI/180,l=180/Math.PI,s={cursor:"pointer"},c={cursor:"auto"};function u(e,t){return n.behavior.zoom().translate(t.translate()).scale(t.scale())}function f(e,t,r){var n=e.id,o=e.graphDiv,l=o.layout,s=l[n],c=o._fullLayout,u=c[n],f={},d={};function p(e,t){f[n+"."+e]=a.nestedProperty(s,e).get(),i.call("_storeDirectGUIEdit",l,c._preGUI,f);var r=a.nestedProperty(u,e);r.get()!==t&&(r.set(t),a.nestedProperty(s,e).set(t),d[n+"."+e]=t)}r(p),p("projection.scale",t.scale()/e.fitScale),p("fitbounds",!1),o.emit("plotly_relayout",d)}function d(e,t){var r=u(0,t);function a(r){var n=t.invert(e.midPt);r("center.lon",n[0]),r("center.lat",n[1])}return r.on("zoomstart",(function(){n.select(this).style(s)})).on("zoom",(function(){t.scale(n.event.scale).translate(n.event.translate),e.render();var r=t.invert(e.midPt);e.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":t.scale()/e.fitScale,"geo.center.lon":r[0],"geo.center.lat":r[1]})})).on("zoomend",(function(){n.select(this).style(c),f(e,t,a)})),r}function p(e,t){var r,a,i,o,l,d,p,h,g,v=u(0,t);function m(e){return t.invert(e)}function y(r){var n=t.rotate(),a=t.invert(e.midPt);r("projection.rotation.lon",-n[0]),r("center.lon",a[0]),r("center.lat",a[1])}return v.on("zoomstart",(function(){n.select(this).style(s),r=n.mouse(this),a=t.rotate(),i=t.translate(),o=a,l=m(r)})).on("zoom",(function(){if(d=n.mouse(this),function(e){var r=m(e);if(!r)return!0;var n=t(r);return Math.abs(n[0]-e[0])>2||Math.abs(n[1]-e[1])>2}(r))return v.scale(t.scale()),void v.translate(t.translate());t.scale(n.event.scale),t.translate([i[0],n.event.translate[1]]),l?m(d)&&(h=m(d),p=[o[0]+(h[0]-l[0]),a[1],a[2]],t.rotate(p),o=p):l=m(r=d),g=!0,e.render();var s=t.rotate(),c=t.invert(e.midPt);e.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":t.scale()/e.fitScale,"geo.center.lon":c[0],"geo.center.lat":c[1],"geo.projection.rotation.lon":-s[0]})})).on("zoomend",(function(){n.select(this).style(c),g&&f(e,t,y)})),v}function h(e,t){var r,a={r:t.rotate(),k:t.scale()},i=u(0,t),o=function(e){var t=0,r=arguments.length,a=[];for(;++th?(i=(f>0?90:-90)-p,a=0):(i=Math.asin(f/h)*l-p,a=Math.sqrt(h*h-f*f));var g=180-i-2*p,v=(Math.atan2(d,u)-Math.atan2(c,a))*l,m=(Math.atan2(d,u)-Math.atan2(c,-a))*l;return b(r[0],r[1],i,v)<=b(r[0],r[1],g,m)?[i,v,r[2]]:[g,m,r[2]]}function b(e,t,r,n){var a=_(r-e),i=_(n-t);return Math.sqrt(a*a+i*i)}function _(e){return(e%360+540)%360-180}function w(e,t,r){var n=r*o,a=e.slice(),i=0===t?1:0,l=2===t?1:2,s=Math.cos(n),c=Math.sin(n);return a[i]=e[i]*s-e[l]*c,a[l]=e[l]*s+e[i]*c,a}function k(e){return[Math.atan2(2*(e[0]*e[1]+e[2]*e[3]),1-2*(e[1]*e[1]+e[2]*e[2]))*l,Math.asin(Math.max(-1,Math.min(1,2*(e[0]*e[2]-e[3]*e[1]))))*l,Math.atan2(2*(e[0]*e[3]+e[1]*e[2]),1-2*(e[2]*e[2]+e[3]*e[3]))*l]}function M(e,t){for(var r=0,n=0,a=e.length;n=t.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=t._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),s=r.select(".js-sourcelinks");e._context.showSources&&e._context.showSources(e),e._context.showLink&&function(e,t){t.text("");var r=t.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(e._context.linkText+" "+String.fromCharCode(187));if(e._context.sendData)r.on("click",(function(){x.sendDataToCloud(e)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(e,o),l.text(o.text()&&s.text()?" - ":"")}},x.sendDataToCloud=function(e){var t=(window.PLOTLYENV||{}).BASE_URL||e._context.plotlyServerURL;if(t){e.emit("plotly_beforeexport");var r=n.select(e).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:t+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(e,!1,"keepdata"),a.node().submit(),r.remove(),e.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],k=["year","month","dayMonth","dayMonthYear"];function M(e,t){var r=e._context.locale,n=!1,a={};function i(e){for(var r=!0,i=0;i1&&z.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,s),l=0;l15&&z.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"),x.linkSubplots(d,s,f,i),x.cleanPlot(d,s,f,i);var j=!(!i._has||!i._has("gl2d")),H=!(!s._has||!s._has("gl2d")),B=!(!i._has||!i._has("cartesian"))||j,U=!(!s._has||!s._has("cartesian"))||H;B&&!U?i._bgLayer.remove():U&&!B&&(s._shouldCreateBgLayer=!0),i._zoomlayer&&!e._dragging&&p({_fullLayout:i}),function(e,t){var r,n=[];t.meta&&(r=t._meta={meta:t.meta,layout:{meta:t.meta}});for(var a=0;a0){var f=1-2*l;n=Math.round(f*n),a=Math.round(f*a)}}var d=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!t.height&&Math.abs(r.height-a)>1;(g||h)&&(h&&(r.width=n),g&&(r.height=a)),e._initialAutoSize||(e._initialAutoSize={width:n,height:a}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(e,t,r,n){var a,i,l,s=o.componentsRegistry,u=t._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in s)(l=s[a]).includeBasePlot&&l.includeBasePlot(e,t);for(var d in u.length||u.push(f),t._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(e,t),f.finalizeSubplots(e,t)),t._subplots)t._subplots[d].sort(c.subplotSort);for(i=0;i.5*n.width&&(c.log("Margin push",t,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(c.log("Margin push",t,"is too big in y, dropping"),r.b=r.t=0);var s=void 0!==r.xl?r.xl:r.x,u=void 0!==r.xr?r.xr:r.x,f=void 0!==r.yt?r.yt:r.y,d=void 0!==r.yb?r.yb:r.y;a[t]={l:{val:s,size:r.l+o},r:{val:u,size:r.r+o},b:{val:d,size:r.b+o},t:{val:f,size:r.t+o}},i[t]=1}else delete a[t],delete i[t];if(!n._replotting)return x.doAutoMargin(e)}},x.doAutoMargin=function(e){var t=e._fullLayout;t._size||(t._size={}),C(t);var r=t._size,n=t.margin,a=c.extendFlat({},r),l=n.l,s=n.r,u=n.t,f=n.b,d=t.width,p=t.height,h=t._pushmargin,g=t._pushmarginIds;if(!1!==t.margin.autoexpand){for(var v in h)g[v]||delete h[v];for(var m in h.base={l:{val:0,size:l},r:{val:1,size:s},t:{val:1,size:u},b:{val:0,size:f}},h){var y=h[m].l||{},b=h[m].b||{},_=y.val,w=y.size,k=b.val,M=b.size;for(var T in h){if(i(w)&&h[T].r){var A=h[T].r.val,L=h[T].r.size;if(A>_){var S=(w*A+(L-d)*_)/(A-_),P=(L*(1-_)+(w-d)*(1-A))/(A-_);S>=0&&P>=0&&d-(S+P)>0&&S+P>l+s&&(l=S,s=P)}}if(i(M)&&h[T].t){var O=h[T].t.val,D=h[T].t.size;if(O>k){var E=(M*O+(D-p)*k)/(O-k),z=(D*(1-k)+(M-p)*(1-O))/(O-k);E>=0&&z>=0&&p-(z+E)>0&&E+z>f+u&&(f=E,u=z)}}}}}if(r.l=Math.round(l),r.r=Math.round(s),r.t=Math.round(u),r.b=Math.round(f),r.p=Math.round(n.pad),r.w=Math.round(d)-r.l-r.r,r.h=Math.round(p)-r.t-r.b,!t._replotting&&x.didMarginChange(a,r)){"_redrawFromAutoMarginCount"in t?t._redrawFromAutoMarginCount++:t._redrawFromAutoMarginCount=1;var R=3*(1+Object.keys(g).length);if(t._redrawFromAutoMarginCount0&&(e._transitioningWithDuration=!0),e._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&e._transitionData._interruptCallbacks.push((function(){return o.call("redraw",e)})),e._transitionData._interruptCallbacks.push((function(){e.emit("plotly_transitioninterrupted",[])}));var i=0,l=0;function s(){return i++,function(){l++,n||l!==i||function(t){if(!e._transitionData)return;(function(e){if(e)for(;e.length;)e.shift()})(e._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",e)})).then((function(){e._transitioning=!1,e._transitioningWithDuration=!1,e.emit("plotly_transitioned",[])})).then(t)}(a)}}r.runFn(s),setTimeout(s())}))}],i=c.syncOrAsync(a,e);return i&&i.then||(i=Promise.resolve()),i.then((function(){return e}))}x.didMarginChange=function(e,t){for(var r=0;r1)return!0}return!1},x.graphJson=function(e,t,r,n,a,i){(a&&t&&!e._fullData||a&&!t&&!e._fullLayout)&&x.supplyDefaults(e);var o=a?e._fullData:e.data,l=a?e._fullLayout:e.layout,s=(e._transitionData||{})._frames;function u(e,t){if("function"==typeof e)return t?"_function_":null;if(c.isPlainObject(e)){var n,a={};return Object.keys(e).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof e[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(e.stream))return}else if("keepall"!==r&&"string"==typeof(n=e[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(e[i],t)}else t&&(a[i]="_function")})),a}return Array.isArray(e)?e.map((function(e){return u(e,t)})):c.isTypedArray(e)?c.simpleMap(e,c.identity):c.isJSDate(e)?c.ms2DateTimeLocal(+e):e}var f={data:(o||[]).map((function(e){var r=u(e);return t&&delete r.fit,r}))};return t||(f.layout=u(l)),e.framework&&e.framework.isPolar&&(f=e.framework.getConfig()),s&&(f.frames=u(s)),i&&(f.config=u(e._context,!0)),"object"===n?f:JSON.stringify(f)},x.modifyFrames=function(e,t){var r,n,a,i=e._transitionData._frames,o=e._transitionData._frameHash;for(r=0;r=0;i--)if(l[i].enabled){r._indexToPoints=l[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(e,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,h[t]=o}}for(E(s,u,p),a=0;a=0?d.angularAxis.domain:n.extent(k),S=Math.abs(k[1]-k[0]);T&&!M&&(S=0);var C=L.slice();A&&M&&(C[1]+=S);var P=d.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),d.angularAxis.ticksStep&&(P=(C[1]-C[0])/P);var O=d.angularAxis.ticksStep||(C[1]-C[0])/(P*(d.minorTicks+1));w&&(O=Math.max(Math.round(O),1)),C[2]||(C[2]=O);var D=n.range.apply(this,C);if(D=D.map((function(e,t){return parseFloat(e.toPrecision(12))})),l=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(e=n.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),z=this.appendChild(this.ownerDocument.importNode(E.documentElement,!0));e=n.select(z)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var R,I=e.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(e,t){return" "+e+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){R=e.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var j=p.map((function(e,t){var r=o.util.cloneJson(e);return r.symbol="DotPlot"===e.geometry?e.dotType||"circle":"LinePlot"!=e.geometry?"square":"line",r.visibleInLegend="undefined"==typeof e.visibleInLegend||e.visibleInLegend,r.color="LinePlot"===e.geometry?e.strokeColor:e.color,r}));o.Legend().config({data:p.map((function(e,t){return e.name||"Element"+t})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:R,elements:j,reverseOrder:d.legend.reverseOrder})})();var H=R.node().getBBox();x=Math.min(d.width-H.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),R.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else R=e.select(".legend-group").style({display:"none"});e.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),I.attr("transform","translate("+_+")").style({cursor:"crosshair"});var B=[(d.width-(d.margin.left+d.margin.right+2*x+(H?H.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(B[0]=Math.max(0,B[0]),B[1]=Math.max(0,B[1]),e.select(".outer-group").attr("transform","translate("+B+")"),d.title&&d.title.text){var U=e.select("g.title-group text").style(N).text(d.title.text),q=U.node().getBBox();U.attr({x:_[0]-q.width/2,y:_[1]-x-20})}var V=e.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=V.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}V.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function Y(e,t){return l(e)%360+d.orientation}if(d.radialAxis.visible){var X=n.svg.axis().scale(r).ticks(5).tickSize(5);V.call(X).attr({transform:"rotate("+d.radialAxis.orientation+")"}),V.selectAll(".domain").style(F),V.selectAll("g>text").text((function(e,t){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(e,t){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),V.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),J=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(e,t){return"rotate("+Y(e)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",(function(e,t){return t%(d.minorTicks+1)==0})).classed("minor",(function(e,t){return!(t%(d.minorTicks+1)==0)})).style(F),J.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(N);var Q=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(e,t){var r=Y(e),n=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(e,t){return t%(d.minorTicks+1)!=0?"":w?w[e]+d.angularAxis.ticksSuffix:e+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&Q.text((function(e,t){return t%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,t)}));var $=n.max(I.selectAll(".angular-tick text")[0].map((function(e,t){return e.getCTM().e+e.getBBox().width})));R.attr({transform:"translate("+[x+$,d.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,ee=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(ee.enter().append("g").attr({class:function(e,t){return"geometry geometry"+t}}),ee.exit().remove(),p[0]||K){var te=[];p.forEach((function(e,t){var n={};n.radialScale=r,n.angularScale=l,n.container=ee.filter((function(e,r){return r==t})),n.geometry=e.geometry,n.orientation=d.orientation,n.direction=d.direction,n.index=t,te.push({data:e,geometryConfig:n})}));var re=n.nest().key((function(e,t){return"undefined"!=typeof e.data.groupId||"unstacked"})).entries(te),ne=[];re.forEach((function(e,t){"unstacked"===e.key?ne=ne.concat(e.values.map((function(e,t){return[e]}))):ne.push(e.values)})),ne.forEach((function(e,t){var r;r=Array.isArray(e)?e[0].geometryConfig.geometry:e.geometryConfig.geometry;var n=e.map((function(e,t){return a(o[r].defaultConfig(),e)}));o[r]().config(n)()}))}var ae,ie,oe=e.select(".guides-group"),le=e.select(".tooltips-group"),se=o.tooltipPanel().config({container:le,fontSize:8})(),ce=o.tooltipPanel().config({container:le,fontSize:8})(),ue=o.tooltipPanel().config({container:le,hasTick:!0})();if(!M){var fe=oe.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});I.on("mousemove.angular-guide",(function(e,t){var r=o.util.getMousePos(Z).angle;fe.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-d.orientation)%360;ae=l.invert(n);var a=o.util.convertToCartesian(x+12,r+180);se.text(o.util.round(ae)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(e,t){oe.select("line").style({opacity:0})}))}var de=oe.select("circle").style({stroke:"grey",fill:"none"});I.on("mousemove.radial-guide",(function(e,t){var n=o.util.getMousePos(Z).radius;de.attr({r:n}).style({opacity:.5}),ie=r.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ce.text(o.util.round(ie)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(e,t){de.style({opacity:0}),ue.hide(),se.hide(),ce.hide()})),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(t,r){var a=n.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=n.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),p=[f.left+f.width/2-B[0]-d.left,f.top+f.height/2-B[1]-d.top];ue.config({color:l}).text(u),ue.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=n.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(e,t){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ue.show()})).on("mouseout.tooltip",(function(e,t){ue.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},d.config=function(e){if(!arguments.length)return s;var t=o.util.cloneJson(e);return t.data.forEach((function(e,t){s.data[t]||(s.data[t]={}),a(s.data[t],o.Axis.defaultConfig().data[0]),a(s.data[t],e)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,t.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(e){return r},d.angularScale=function(e){return l},d.svg=function(){return e},n.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(e,t){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(e,t){for(var r in e)r in t&&(t[r]=e[r])},o.util._extend=function(e,t){for(var r in e)t[r]=e[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(e,t){var r=t||6;return n.range(0,360+r,r).map((function(t,r){var n=t*Math.PI/180;return[t,e(n)]}))},o.util.dataFromEquation=function(e,t,r){var a=t||6,i=[],o=[];n.range(0,360+a,a).forEach((function(t,r){var n=t*Math.PI/180,a=e(n);i.push(t),o.push(a)}));var l={t:i,r:o};return r&&(l.name=r),l},o.util.ensureArray=function(e,t){if("undefined"==typeof e)return null;var r=[].concat(e);return n.range(t).map((function(e,t){return r[t]||r[0]}))},o.util.fillArrays=function(e,t,r){return t.forEach((function(t,n){e[t]=o.util.ensureArray(e[t],r)})),e},o.util.cloneJson=function(e){return JSON.parse(JSON.stringify(e))},o.util.validateKeys=function(e,t){"string"==typeof t&&(t=t.split("."));var r=t.shift();return e[r]&&(!t.length||objHasKeys(e[r],t))},o.util.sumArrays=function(e,t){return n.zip(e,t).map((function(e,t){return n.sum(e)}))},o.util.arrayLast=function(e){return e[e.length-1]},o.util.arrayEqual=function(e,t){for(var r=Math.max(e.length,t.length,1);r-- >=0&&e[r]===t[r];);return-2===r},o.util.flattenArray=function(e){for(var t=[];!o.util.arrayEqual(t,e);)t=e,e=[].concat.apply([],e);return e},o.util.deduplicate=function(e){return e.filter((function(e,t,r){return r.indexOf(e)==t}))},o.util.convertToCartesian=function(e,t){var r=t*Math.PI/180;return[e*Math.cos(r),e*Math.sin(r)]},o.util.round=function(e,t){var r=t||2,n=Math.pow(10,r);return Math.round(e*n)/n},o.util.getMousePos=function(e){var t=n.mouse(e.node()),r=t[0],a=t[1],i={};return i.x=r,i.y=a,i.pos=t,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(e){for(var t,r={},n={},a=0,i=e.length;a0)){var s=n.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(e,t){return h.fill(r,a,i)},"fill-opacity":0,stroke:function(e,t){return h.stroke(r,a,i)},"stroke-width":function(e,t){return h["stroke-width"](r,a,i)},"stroke-dasharray":function(e,t){return h["stroke-dasharray"](r,a,i)},opacity:function(e,t){return h.opacity(r,a,i)},display:function(e,t){return h.display(r,a,i)}})}};var f=t.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(e){return-d/2})).endAngle((function(e){return d/2})).innerRadius((function(e){return t.radialScale(s+(e[2]||0))})).outerRadius((function(e){return t.radialScale(s+(e[2]||0))+t.radialScale(e[1])}));c.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(e,r){return"rotate("+(t.orientation+l(e[0])+90)+")"}})};var h={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,n,a){return r[e[a].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[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(e,t){return e}));v.enter().append("path").attr({class:"mark"}),v.style(h).each(c[t.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(t){return arguments.length?(t.forEach((function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)})),this):e},i.getColorScale=function(){},n.rebind(i,t,"on"),i},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 e=o.Legend.defaultConfig(),t=n.dispatch("hover");function r(){var t=e.legendConfig,i=e.data.map((function(e,r){return[].concat(e).map((function(e,n){var i=a({},t.elements[r]);return i.name=e,i.color=[].concat(t.elements[r].color)[n],i}))})),o=n.merge(i);o=o.filter((function(e,r){return t.elements[r]&&(t.elements[r].visibleInLegend||"undefined"==typeof t.elements[r].visibleInLegend)})),t.reverseOrder&&(o=o.reverse());var l=t.container;("string"==typeof l||l.nodeName)&&(l=n.select(l));var s=o.map((function(e,t){return e.color})),c=t.fontSize,u=null==t.isContinuous?"number"==typeof o[0]:t.isContinuous,f=u?t.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(h).range(s),v=n.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(e,t){return t/(s.length-1)*100+"%"}}).style({"stop-color":function(e,t){return e}}),d.append("rect").classed("legend-mark",!0).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(e,t){return"translate("+[c/2,v(t)+c/2]+")"},d:function(e,t){var r,a,i,o=e.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(e,t){return g(t)}}),y.exit().remove()}var x=n.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?t.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?t.textColor:"none"}),b.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text((function(e,t){return o[t].name})),r}return r.config=function(t){return arguments.length?(a(e,t),this):e},n.rebind(r,t,"on"),r},o.Legend.defaultConfig=function(e,t){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 e,t,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var n=(e=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),t=n.append("text").attr({dx:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";t.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=t.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return r.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),e.attr({transform:"translate("+[s,-v/2+2*d]+")"}),e.style({display:"block"}),c},c.move=function(t){if(e)return e.attr({transform:"translate("+[t[0],t[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(e)return e.style({display:"none"}),c},c.show=function(){if(e)return e.style({display:"block"}),c},c.config=function(e){return a(i,e),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var e={convert:function(e,t){var r={};if(e.data&&(r.data=e.data.map((function(e,r){var n=a({},e);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(e,r){o.util.translator.apply(null,e.concat(t))})),t||delete n.marker,t&&delete n.groupId,t?("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})),!t&&e.layout&&"stack"===e.layout.barmode)){var i=o.util.duplicates(r.data.map((function(e,t){return e.geometry})));r.data.forEach((function(e,t){var n=i.indexOf(e.geometry);-1!=n&&(r.data[t].groupId=n)}))}if(e.layout){var l=a({},e.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(e,r){o.util.translator.apply(null,e.concat(t))})),t?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach((function(e,t){u[c[s.indexOf(e.key)]]=e.value})),l.margin=u}t&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),r.layout=l}return r}};return e}},{"../../../constants/alignment":154,"../../../lib":180,d3:15}],271:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../../lib"),i=e("../../../components/color"),o=e("./micropolar"),l=e("./undo_manager"),s=a.extendDeepAll,c=t.exports={};c.framework=function(e){var t,r,a,i,u,f=new l;function d(r,l){return l&&(u=l),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),t=t?s(t,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(t),a.config(i).render(u),e.data=t.data,e.layout=t.layout,c.fillLayout(e),t}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return t},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var e,n,a=this,i=o.util.cloneJson(t);e=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(e)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(e){var t=n.select(e).selectAll(".plot-container"),r=t.selectAll(".svg-container"),a=e.framework&&e.framework.svg&&e.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:t,_paperdiv:r,_paper:a};e._fullLayout=s(o,e.layout)}},{"../../../components/color":52,"../../../lib":180,"./micropolar":270,"./undo_manager":272,d3:15}],272:[function(e,t,r){"use strict";t.exports=function(){var e,t=[],r=-1,n=!1;function a(e,t){return e?(n=!0,e[t](),n=!1,this):this}return{add:function(e){return n||(t.splice(r+1,t.length-r),t.push(e),r=t.length-1),this},setCallback:function(t){e=t},undo:function(){var n=t[r];return n?(a(n,"undo"),r-=1,e&&e(n.undo),this):this},redo:function(){var n=t[r+1];return n?(a(n,"redo"),r+=1,e&&e(n.redo),this):this},clear:function(){t=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a-1&&(f[p[r]].title={text:""});for(r=0;r")?"":t.html(e).text()}));return t.remove(),r}(k),k=(k=k.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(k=(k=(k=k.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),k}},{"../components/color":52,"../components/drawing":74,"../constants/xmlns_namespaces":158,"../lib":180,d3:15}],284:[function(e,t,r){"use strict";var n=e("../../plots/template_attributes").hovertemplateAttrs,a=e("../scattergeo/attributes"),i=e("../../components/colorscale/attributes"),o=e("../../plots/attributes"),l=e("../../components/color/attributes").defaultLine,s=e("../../lib/extend").extendFlat,c=a.marker.line;t.exports=s({locations:{valType:"data_array",editType:"calc"},locationmode:a.locationmode,z:{valType:"data_array",editType:"calc"},geojson:s({},a.geojson,{}),featureidkey:a.featureidkey,text:s({},a.text,{}),hovertext:s({},a.hovertext,{}),marker:{line:{color:s({},c.color,{dflt:l}),width:s({},c.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:a.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:a.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:s({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]}),hovertemplate:n(),showlegend:s({},o.showlegend,{dflt:!1})},i("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/color/attributes":51,"../../components/colorscale/attributes":59,"../../lib/extend":172,"../../plots/attributes":222,"../../plots/template_attributes":274,"../scattergeo/attributes":324}],285:[function(e,t,r){"use strict";var n=e("fast-isnumeric"),a=e("../../constants/numerical").BADNUM,i=e("../../components/colorscale/calc"),o=e("../scatter/arrays_to_calcdata"),l=e("../scatter/calc_selection");function s(e){return e&&"string"==typeof e}t.exports=function(e,t){var r,c=t._length,u=new Array(c);r=t.geojson?function(e){return s(e)||n(e)}:s;for(var f=0;f")}(e,f,o,d.mockAxis),[e]}},{"../../lib":180,"../../plots/cartesian/axes":225,"./attributes":284}],289:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),supplyDefaults:e("./defaults"),colorbar:e("../heatmap/colorbar"),calc:e("./calc"),calcGeoJSON:e("./plot").calcGeoJSON,plot:e("./plot").plot,style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"choropleth",basePlotModule:e("../../plots/geo"),categories:["geo","noOpacity","showLegend"],meta:{}}},{"../../plots/geo":257,"../heatmap/colorbar":293,"./attributes":284,"./calc":285,"./defaults":286,"./event_data":287,"./hover":288,"./plot":290,"./select":291,"./style":292}],290:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../lib/geo_location_utils"),o=e("../../lib/topojson_utils").getTopojsonFeatures,l=e("../../plots/cartesian/autorange").findExtremes,s=e("./style").style;t.exports={calcGeoJSON:function(e,t){for(var r=e[0].trace,n=t[r.geo],a=n._subplot,s=r.locationmode,c=r._length,u="geojson-id"===s?i.extractTraceFeature(e):o(r,a.topojson),f=[],d=[],p=0;pl&&T[v].gap;)v--;for(y=T[v].s,h=T.length-1;h>v;h--)T[h].s=y;for(;lA[u]&&u=0;a--){var i=e[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],304:[function(e,t,r){"use strict";var n=e("../../lib"),a=e("../../registry"),i=e("./attributes"),o=e("./constants"),l=e("./subtypes"),s=e("./xy_defaults"),c=e("./stack_defaults"),u=e("./marker_defaults"),f=e("./line_defaults"),d=e("./line_shape_defaults"),p=e("./text_defaults"),h=e("./fillcolor_defaults");t.exports=function(e,t,r,g){function v(r,a){return n.coerce(e,t,i,r,a)}var m=s(e,t,g,v);if(m||(t.visible=!1),t.visible){var y=c(e,t,g,v),x=!y&&mG!=(F=D[P][1])>=G&&(z=D[P-1][0],R=D[P][0],F-I&&(E=z+(R-z)*(G-I)/(F-I),B=Math.min(B,E),U=Math.max(U,E)));B=Math.max(B,0),U=Math.min(U,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),n.extendFlat(e,{distance:e.maxHoverDistance,x0:B,x1:U,y0:G,y1:G,color:Z,hovertemplate:!1}),delete e.index,f.text&&!Array.isArray(f.text)?e.text=String(f.text):e.text=f.name,[e]}}}},{"../../components/color":52,"../../components/fx":92,"../../lib":180,"../../registry":275,"./get_trace_color":307}],309:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:e("./attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("./cross_trace_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./cross_trace_calc"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot"),colorbar:e("./marker_colorbar"),formatLabels:e("./format_labels"),style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":238,"./arrays_to_calcdata":296,"./attributes":297,"./calc":298,"./cross_trace_calc":302,"./cross_trace_defaults":303,"./defaults":304,"./format_labels":306,"./hover":308,"./marker_colorbar":315,"./plot":317,"./select":318,"./style":320,"./subtypes":321}],310:[function(e,t,r){"use strict";var n=e("../../lib").isArrayOrTypedArray,a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,r,o,l,s){var c=(e.marker||{}).color;(l("line.color",r),a(e,"line"))?i(e,t,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!n(c)&&c||r);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"../../lib":180}],311:[function(e,t,r){"use strict";var n=e("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,l=i-.5,s=e("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=e("./constants");t.exports=function(e,t){var r,n,i,d,p,h,g,v,m,y,x,b,_,w,k,M,T,A,L=t.xaxis,S=t.yaxis,C="log"===L.type,P="log"===S.type,O=L._length,D=S._length,E=t.connectGaps,z=t.baseTolerance,R=t.shape,I="linear"===R,F=t.fill&&"none"!==t.fill,N=[],j=f.minTolerance,H=e.length,B=new Array(H),U=0;function q(r){var n=e[r];if(!n)return!1;var i=t.linearized?L.l2p(n.x):L.c2p(n.x),s=t.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=L.c2p(n.x,!0)),i===a)return!1;P&&s===a&&(i*=Math.abs(L._m*D*(L._m>0?o:l)/(S._m*O*(S._m>0?o:l)))),i*=1e3}if(s===a){if(P&&(s=S.c2p(n.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function V(e,t,r,n){var a=r-e,i=n-t,o=.5-e,l=.5-t,s=a*a+i*i,c=a*o+i*l;if(c>0&&cre||e[1]ae)return[u(e[0],te,re),u(e[1],ne,ae)]}function le(e,t){return e[0]===t[0]&&(e[0]===te||e[0]===re)||(e[1]===t[1]&&(e[1]===ne||e[1]===ae)||void 0)}function se(e,t,r){return function(n,a){var i=oe(n),o=oe(a),l=[];if(i&&o&&le(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((n[e]+a[e])/2,t,r)-((i||n)[e]+(o||a)[e]);c&&((i&&o?c>0==i[e]>o[e]?i:o:i||o)[e]+=c);return l}}function ce(e){var t=e[0],r=e[1],n=t===B[U-1][0],a=r===B[U-1][1];if(!n||!a)if(U>1){var i=t===B[U-2][0],o=r===B[U-2][1];n&&(t===te||t===re)&&i?o?U--:B[U-1]=e:a&&(r===ne||r===ae)&&o?i?U--:B[U-1]=e:B[U++]=e}else B[U++]=e}function ue(e){B[U-1][0]!==e[0]&&B[U-1][1]!==e[1]&&ce([W,J]),ce(e),Q=null,W=J=0}function fe(e){if(T=e[0]/O,A=e[1]/D,Y=e[0]re?re:0,X=e[1]ae?ae:0,Y||X){if(U)if(Q){var t=K(Q,e);t.length>1&&(ue(t[0]),B[U++]=t[1])}else $=K(B[U-1],e)[0],B[U++]=$;else B[U++]=[Y||e[0],X||e[1]];var r=B[U-1];Y&&X&&(r[0]!==Y||r[1]!==X)?(Q&&(W!==Y&&J!==X?ce(W&&J?(n=Q,i=(a=e)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?te:re,ae]:[o>0?re:te,ne]):[W||Y,J||X]):W&&J&&ce([W,J])),ce([Y,X])):W-Y&&J-X&&ce([Y||W,X||J]),Q=e,W=Y,J=X}else Q&&ue(K(Q,e)[0]),B[U++]=e;var n,a,i,o}for("linear"===R||"spline"===R?K=function(e,t){for(var r=[],n=0,a=0;a<4;a++){var i=ie[a],o=c(e[0],e[1],t[0],t[1],i[0],i[1],i[2],i[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&&Z(o,e)G(h,de))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=e.length||!h)break;fe(h),n=h}}else fe(d)}Q&&ce([W||Q[0],J||Q[1]]),N.push(B.slice(0,U))}return N}},{"../../constants/numerical":157,"../../lib":180,"./constants":301}],312:[function(e,t,r){"use strict";t.exports=function(e,t,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],313:[function(e,t,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};t.exports=function(e,t,r){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(t,a):0}}},{"fast-isnumeric":17}],315:[function(e,t,r){"use strict";t.exports={container:"marker",min:"cmin",max:"cmax"}},{}],316:[function(e,t,r){"use strict";var n=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults"),o=e("./subtypes");t.exports=function(e,t,r,l,s,c){var u=o.isBubble(e),f=(e.line||{}).color;(c=c||{},f&&(r=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",r),a(e,"marker")&&i(e,t,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&t.marker.color!==f?f:u?n.background:n.defaultLine),a(e,"marker.line")&&i(e,t,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":52,"../../components/colorscale/defaults":62,"../../components/colorscale/helpers":63,"./subtypes":321}],317:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../registry"),i=e("../../lib"),o=i.ensureSingle,l=i.identity,s=e("../../components/drawing"),c=e("./subtypes"),u=e("./line_points"),f=e("./link_traces"),d=e("../../lib/polygon").tester;function p(e,t,r,f,p,h,g){var v;!function(e,t,r,a,o){var l=r.xaxis,s=r.yaxis,u=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(e){return e.x>=u[0]&&e.x<=u[1]&&e.y>=f[0]&&e.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(e,r){var n=e[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(e){return m?e.transition():e}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,k=n.select(h),M=o(k,"g","errorbars"),T=o(k,"g","lines"),A=o(k,"g","points"),L=o(k,"g","text");if(a.getComponentMethod("errorbars","plot")(e,M,r,g),!0===_.visible){var S,C;y(k).style("opacity",_.opacity);var P=_.fill.charAt(_.fill.length-1);"x"!==P&&"y"!==P&&(P=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=k;var O,D,E="",z=[],R=_._prevtrace;R&&(E=R._prevRevpath||"",C=R._nextFill,z=R._polygons);var I,F,N,j,H,B,U,q="",V="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(I=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):I=F="spline"===w.shape?function(e){var t=e[e.length-1];return e.length>1&&e[0][0]===t[0]&&e[0][1]===t[1]?s.smoothclosed(e.slice(1),w.smoothing):s.smoothopen(e,w.smoothing)}:function(e){return"M"+e.join("L")},N=function(e){return F(e.reverse())},G=u(f,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),U=_._polygons=new Array(G.length),v=0;v1){var r=n.select(this);if(r.datum(f),e)y(r.style("opacity",0).attr("d",O).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",O),s.singleLineStyle(f,a)}}}}}var Y=T.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(Z(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(Y,r.layerClipId,e),G.length?(S?(S.datum(f),j&&B&&(P?("y"===P?j[1]=B[1]=b.c2p(0,!0):"x"===P&&(j[0]=B[0]=x.c2p(0,!0)),y(S).attr("d","M"+B+"L"+j+"L"+q.substr(1)).call(s.singleFillStyle)):y(S).attr("d",q+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&q&&E?("tonext"===_.fill?y(C).attr("d",q+"Z"+E+"Z").call(s.singleFillStyle):y(C).attr("d",q+"L"+E.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(z)):(W(C),_._polygons=null)),_._prevRevpath=V,_._prevPolygons=U):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(t,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=ee(u),h=te,g=te;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===e._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?Q:J:_&&!w&&(v=$),f&&(h=v),d&&(g=v)}var k,M=(o=t.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&M.call(s.pointStyle,u,e).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(k=s.makePointStyleFns(u)),o.each((function(t){var a=n.select(this),i=y(a);s.translatePoint(t,i,x,b)?(s.singlePointStyle(t,i,u,k,e),r.layerClipId&&s.hideOutsideRangePoint(t,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==t.data&&void 0!==t.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(e){var t=n.select(this),a=y(t.select("text"));s.translatePoint(e,a,x,b)?r.layerClipId&&s.hideOutsideRangePoint(e,t,x,b,u.xcalendar,u.ycalendar):t.remove()})),o.selectAll("text").call(s.textPointStyle,u,e).each((function(e){var t=x.c2p(e.x),r=b.c2p(e.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:t,y:r})}))})),o.exit().remove()}(A,L,f);var X=!1===_.cliponaxis?null:r.layerClipId;s.setClipUrl(A,X,e),s.setClipUrl(L,X,e)}function W(e){y(e).attr("d","M0,0Z")}function J(e){return e.filter((function(e){return!e.gap&&e.vis}))}function Q(e){return e.filter((function(e){return e.vis}))}function $(e){return e.filter((function(e){return!e.gap}))}function K(e){return e.id}function ee(e){if(e.ids)return K}function te(){return!1}}t.exports=function(e,t,r,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(e,t,r);((u=a.selectAll("g.trace").data(v,(function(e){return e[0].trace.uid}))).enter().append("g").attr("class",(function(e){return"trace scatter trace"+e[0].trace.uid})).style("stroke-miterlimit",2),u.order(),function(e,t,r){t.each((function(t){var a=o(n.select(this),"g","fills");s.setClipUrl(a,r.layerClipId,e);var i=t[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(e){i[e]=null})).remove(),u.order().each((function(e){i[e]=o(n.select(this),"path","js-fill")}))}))}(e,u,t),g)?(c&&(d=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(e,n,t,r,v,this,i)}))}))):u.each((function(r,n){p(e,n,t,r,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":74,"../../lib":180,"../../lib/polygon":192,"../../registry":275,"./line_points":311,"./link_traces":313,"./subtypes":321,d3:15}],318:[function(e,t,r){"use strict";var n=e("./subtypes");t.exports=function(e,t){var r,a,i,o,l=e.cd,s=e.xaxis,c=e.yaxis,u=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===t)for(r=0;r")}(c,g,e,s[0].t.labels),e.hovertemplate=c.hovertemplate,[e]}}},{"../../components/fx":92,"../../constants/numerical":157,"../../lib":180,"../scatter/get_trace_color":307,"./attributes":324}],330:[function(e,t,r){"use strict";t.exports={attributes:e("./attributes"),supplyDefaults:e("./defaults"),colorbar:e("../scatter/marker_colorbar"),formatLabels:e("./format_labels"),calc:e("./calc"),calcGeoJSON:e("./plot").calcGeoJSON,plot:e("./plot").plot,style:e("./style"),styleOnSelect:e("../scatter/style").styleOnSelect,hoverPoints:e("./hover"),eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"scattergeo",basePlotModule:e("../../plots/geo"),categories:["geo","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/geo":257,"../scatter/marker_colorbar":315,"../scatter/style":320,"./attributes":324,"./calc":325,"./defaults":326,"./event_data":327,"./format_labels":328,"./hover":329,"./plot":331,"./select":332,"./style":333}],331:[function(e,t,r){"use strict";var n=e("d3"),a=e("../../lib"),i=e("../../lib/topojson_utils").getTopojsonFeatures,o=e("../../lib/geojson_utils"),l=e("../../lib/geo_location_utils"),s=e("../../plots/cartesian/autorange").findExtremes,c=e("../../constants/numerical").BADNUM,u=e("../scatter/calc").calcMarkerSize,f=e("../scatter/subtypes"),d=e("./style");t.exports={calcGeoJSON:function(e,t){var r,n,a=e[0].trace,o=t[a.geo],f=o._subplot,d=a._length;if(Array.isArray(a.locations)){var p=a.locationmode,h="geojson-id"===p?l.extractTraceFeature(e):i(a,f.topojson);for(r=0;r=-e},pointBetween:function(t,n,r){var a=t[1]-n[1],i=r[0]-n[0],o=t[0]-n[0],l=r[1]-n[1],s=o*i+a*l;return!(s-e)},pointsSameX:function(t,n){return Math.abs(t[0]-n[0])e!=o-a>e&&(i-c)*(a-u)/(o-u)+c-r>e&&(l=!l),i=c,o=u}return l}};return t}},{}],57:[function(e,t,n){var r={toPolygon:function(e,t){function n(t){if(t.length<=0)return e.segments({inverted:!1,regions:[]});function n(t){var n=t.slice(0,t.length-1);return e.segments({inverted:!1,regions:[n]})}for(var r=n(t[0]),a=1;a0}))}function u(e,r){var a=e.seg,i=r.seg,o=a.start,l=a.end,c=i.start,u=i.end;n&&n.checkIntersection(a,i);var f=t.linesIntersect(o,l,c,u);if(!1===f){if(!t.pointsCollinear(o,l,c))return!1;if(t.pointsSame(o,u)||t.pointsSame(l,c))return!1;var d=t.pointsSame(o,c),p=t.pointsSame(l,u);if(d&&p)return r;var h=!d&&t.pointBetween(o,c,u),g=!p&&t.pointBetween(l,c,u);if(d)return g?s(r,l):s(e,u),r;h&&(p||(g?s(r,l):s(e,u)),s(r,o))}else 0===f.alongA&&(-1===f.alongB?s(e,c):0===f.alongB?s(e,f.pt):1===f.alongB&&s(e,u)),0===f.alongB&&(-1===f.alongA?s(r,o):0===f.alongA?s(r,f.pt):1===f.alongA&&s(r,l));return!1}for(var f=[];!i.isEmpty();){var d=i.getHead();if(n&&n.vert(d.pt[0]),d.isStart){n&&n.segmentNew(d.seg,d.primary);var p=c(d),h=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function v(){if(h){var e=u(d,h);if(e)return e}return!!g&&u(d,g)}n&&n.tempStatus(d.seg,!!h&&h.seg,!!g&&g.seg);var m,y=v();if(y){var x;if(e)(x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;n&&n.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){n&&n.rewind(d.seg);continue}if(e)x=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=x?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};n&&n.status(d.seg,!!h&&h.seg,!!g&&g.seg),d.other.status=p.insert(r.node({ev:d}))}else{var b=d.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(l.exists(b.prev)&&l.exists(b.next)&&u(b.prev.ev,b.next.ev),n&&n.statusRemove(b.ev.seg),b.remove(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return n&&n.done(),f}return e?{addRegion:function(e){for(var r,a,i,o=e[e.length-1],s=0;s1)for(var n=1;n1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(e=P(e,360),t=P(t,100),n=P(n,100),0===t)r=a=i=n;else{var l=n<.5?n*(1+t):n+t-n*t,s=2*n-l;r=o(s,l,e+1/3),a=o(s,l,e),i=o(s,l,e-1/3)}return{r:255*r,g:255*a,b:255*i}}(t.h,s,u),f=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,h,g;return i=C(i),{ok:f,format:t.format||d,r:o(255,l(a.r,0)),g:o(255,l(a.g,0)),b:o(255,l(a.b,0)),a:i}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=s.format||u.format,this._gradientType=s.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(e,t,n){e=P(e,255),t=P(t,255),n=P(n,255);var r,a,i=l(e,t,n),s=o(e,t,n),c=(i+s)/2;if(i==s)r=a=0;else{var u=i-s;switch(a=c>.5?u/(2-i-s):u/(i+s),i){case e:r=(t-n)/u+(t>1)+720)%360;--t;)r.h=(r.h+a)%360,i.push(c(r));return i}function A(e,t){t=t||6;for(var n=c(e).toHsv(),r=n.h,a=n.s,i=n.v,o=[],l=1/t;t--;)o.push(c({h:r,s:a,v:i})),i=(i+l)%1;return o}c.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 e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var t,n,r,a=this.toRgb();return t=a.r/255,n=a.g/255,r=a.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=i(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=i(360*e.h),n=i(100*e.s),r=i(100*e.v);return 1==this._a?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=i(360*e.h),n=i(100*e.s),r=i(100*e.l);return 1==this._a?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,n,r,a){var o=[R(i(e).toString(16)),R(i(t).toString(16)),R(i(n).toString(16)),R(z(r))];if(a&&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,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*P(this._r,255))+"%",g:i(100*P(this._g,255))+"%",b:i(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*P(this._r,255))+"%, "+i(100*P(this._g,255))+"%, "+i(100*P(this._b,255))+"%)":"rgba("+i(100*P(this._r,255))+"%, "+i(100*P(this._g,255))+"%, "+i(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var a=c(e);n="#"+p(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(T,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(k,arguments)}},c.fromRatio=function(e,t){if("object"==typeof e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]="a"===r?e[r]:E(e[r]));e=n}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:s(),g:s(),b:s()})},c.mix=function(e,t,n){n=0===n?0:n||50;var r=c(e).toRgb(),a=c(t).toRgb(),i=n/100;return c({r:(a.r-r.r)*i+r.r,g:(a.g-r.g)*i+r.g,b:(a.b-r.b)*i+r.b,a:(a.a-r.a)*i+r.a})},c.readability=function(t,n){var r=c(t),a=c(n);return(e.max(r.getLuminance(),a.getLuminance())+.05)/(e.min(r.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(e,t,n){var r,a,i=c.readability(e,t);switch(a=!1,(r=function(e){var t,n;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==n&&"large"!==n&&(n="small");return{level:t,size:n}}(n)).level+r.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(e,t,n){var r,a,i,o,l=null,s=0;a=(n=n||{}).includeFallbackColors,i=n.level,o=n.size;for(var u=0;us&&(s=r,l=c(t[u]));return c.isReadable(e,l,{level:i,size:o})||!a?l:(n.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],n))};var L=c.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=c.hexNames=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}(L);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function P(t,n){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(t)&&(t="100%");var r=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(t);return t=o(n,l(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function O(e){return o(1,l(0,e))}function D(e){return parseInt(e,16)}function R(e){return 1==e.length?"0"+e:""+e}function E(e){return e<=1&&(e=100*e+"%"),e}function z(t){return e.round(255*parseFloat(t)).toString(16)}function I(e){return D(e)/255}var F,N,j,B=(N="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",j="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+j),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+j),hsv:new RegExp("hsv"+N),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 H(e){return!!B.CSS_UNIT.exec(e)}"undefined"!=typeof t&&t.exports?t.exports=c:window.tinycolor=c}(Math)},{}],64:[function(e,t,n){!function(e,r){"object"==typeof n&&"undefined"!=typeof t?r(n):r((e=e||self).topojson=e.topojson||{})}(this,(function(e){"use strict";function t(e){return e}function n(e){if(null==e)return t;var n,r,a=e.scale[0],i=e.scale[1],o=e.translate[0],l=e.translate[1];return function(e,t){t||(n=r=0);var s=2,c=e.length,u=new Array(c);for(u[0]=(n+=e[0])*a+o,u[1]=(r+=e[1])*i+l;so&&(o=e[0]),e[1]l&&(l=e[1])}function c(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(c);break;case"Point":s(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(s)}}for(t in e.arcs.forEach((function(e){for(var t,n=-1,s=e.length;++no&&(o=t[0]),t[1]l&&(l=t[1])})),e.objects)c(e.objects[t]);return[a,i,o,l]}function a(e,t){var n=t.id,r=t.bbox,a=null==t.properties?{}:t.properties,o=i(e,t);return null==n&&null==r?{type:"Feature",properties:a,geometry:o}:null==r?{type:"Feature",id:n,properties:a,geometry:o}:{type:"Feature",id:n,bbox:r,properties:a,geometry:o}}function i(e,t){var r=n(e.transform),a=e.arcs;function i(e,t){t.length&&t.pop();for(var n=a[e<0?~e:e],i=0,o=n.length;i1)r=s(e,t,n);else for(a=0,r=new Array(i=e.arcs.length);a1)for(var i,l,c=1,u=s(a[0]);cu&&(l=a[0],a[0]=a[c],a[c]=l,u=i);return a})).filter((function(e){return e.length>0}))}}function u(e,t){for(var n=0,r=e.length;n>>1;e[a]=2))throw new Error("n must be \u22652");var n,a=(s=e.bbox||r(e))[0],i=s[1],o=s[2],l=s[3];t={scale:[o-a?(o-a)/(n-1):1,l-i?(l-i)/(n-1):1],translate:[a,i]}}var s,c,u=f(t),d=e.objects,p={};function h(e){return u(e)}function g(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(g)};break;case"Point":t={type:"Point",coordinates:h(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(h)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(c in d)p[c]=g(d[c]);return{type:"Topology",bbox:s,transform:t,objects:p,arcs:e.arcs.map((function(e){var t,n=0,r=1,a=e.length,i=new Array(a);for(i[0]=u(e[0],0);++n0||n.explicitOff.length>0},onClick:function(e,t){var n,l,s=o(e,t),c=s.on,u=s.off.concat(s.explicitOff),f={},d=e._fullLayout.annotations;if(!c.length&&!u.length)return;for(n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[t]}for(var Y=!1,X=["x","y"],W=0;W1)&&(re===ne?((pe=ae.r2fraction(t["a"+te]))<0||pe>1)&&(Y=!0):Y=!0),J=ae._offset+ae.r2p(t[te]),K=.5}else{var he="domain"===de;"x"===te?($=t[te],J=he?ae._offset+ae._length*$:J=k.l+k.w*$):($=1-t[te],J=he?ae._offset+ae._length*$:J=k.t+k.h*$),K=t.showarrow?.5:$}if(t.showarrow){fe.head=J;var ge=t["a"+te];if(ee=oe*V(.5,t.xanchor)-le*V(.5,t.yanchor),re===ne){var ve=s.getRefType(re);"domain"===ve?("y"===te&&(ge=1-ge),fe.tail=ae._offset+ae._length*ge):"paper"===ve?"y"===te?(ge=1-ge,fe.tail=k.t+k.h*ge):fe.tail=k.l+k.w*ge:fe.tail=ae._offset+ae.r2p(ge),Q=ee}else fe.tail=J+ge,Q=ee+ge;fe.text=fe.tail+ee;var me=w["x"===te?"width":"height"];if("paper"===ne&&(fe.head=o.constrain(fe.head,1,me-1)),"pixel"===re){var ye=-Math.max(fe.tail-3,fe.text),xe=Math.min(fe.tail+3,fe.text)-me;ye>0?(fe.tail+=ye,fe.text+=ye):xe>0&&(fe.tail-=xe,fe.text-=xe)}fe.tail+=ue,fe.head+=ue}else Q=ee=se*V(K,ce),fe.text=J+ee;fe.text+=ue,ee+=ue,Q+=ue,t["_"+te+"padplus"]=se/2+Q,t["_"+te+"padminus"]=se/2-Q,t["_"+te+"size"]=se,t["_"+te+"shift"]=ee}if(Y)I.remove();else{var be=0,_e=0;if("left"!==t.align&&(be=(M-b)*("center"===t.align?.5:1)),"top"!==t.valign&&(_e=(z-_)*("middle"===t.valign?.5:1)),f)r.select("svg").attr({x:j+be-1,y:j+_e}).call(u.setClipUrl,H?C:null,e);else{var we=j+_e-g.top,ke=j+be-g.left;G.call(d.positionText,ke,we).call(u.setClipUrl,H?C:null,e)}U.select("rect").call(u.setRect,j,j,M,z),B.call(u.setRect,F/2,F/2,N-F,q-F),I.call(u.setTranslate,Math.round(P.x.text-N/2),Math.round(P.y.text-q/2)),R.attr({transform:"rotate("+O+","+P.x.text+","+P.y.text+")"});var Te,Me=function(n,r){D.selectAll(".annotation-arrow-g").remove();var s=P.x.head,f=P.y.head,d=P.x.tail+n,p=P.y.tail+r,g=P.x.text+n,b=P.y.text+r,_=o.rotationXYMatrix(O,g,b),w=o.apply2DTransform(_),M=o.apply2DTransform2(_),C=+B.attr("width"),E=+B.attr("height"),z=g-.5*C,F=z+C,N=b-.5*E,j=N+E,H=[[z,N,z,j],[z,j,F,j],[F,j,F,N],[F,N,z,N]].map(M);if(!H.reduce((function(e,t){return e^!!o.segmentsIntersect(s,f,s+1e6,f+1e6,t[0],t[1],t[2],t[3])}),!1)){H.forEach((function(e){var t=o.segmentsIntersect(d,p,s,f,e[0],e[1],e[2],e[3]);t&&(d=t.x,p=t.y)}));var U=t.arrowwidth,q=t.arrowcolor,V=t.arrowside,G=D.append("g").style({opacity:c.opacity(q)}).classed("annotation-arrow-g",!0),Z=G.append("path").attr("d","M"+d+","+p+"L"+s+","+f).style("stroke-width",U+"px").call(c.stroke,c.rgb(q));if(v(Z,V,t),T.annotationPosition&&Z.node().parentNode&&!i){var Y=s,X=f;if(t.standoff){var W=Math.sqrt(Math.pow(s-d,2)+Math.pow(f-p,2));Y+=t.standoff*(d-s)/W,X+=t.standoff*(p-f)/W}var J,Q,$=G.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-Y)+","+(p-X),transform:l(Y,X)}).style("stroke-width",U+6+"px").call(c.stroke,"rgba(0,0,0,0)").call(c.fill,"rgba(0,0,0,0)");h.init({element:$.node(),gd:e,prepFn:function(){var e=u.getTranslate(I);J=e.x,Q=e.y,m&&m.autorange&&A(m._name+".autorange",!0),x&&x.autorange&&A(x._name+".autorange",!0)},moveFn:function(e,n){var r=w(J,Q),a=r[0]+e,i=r[1]+n;I.call(u.setTranslate,a,i),L("x",y(m,e,"x",k,t)),L("y",y(x,n,"y",k,t)),t.axref===t.xref&&L("ax",y(m,e,"ax",k,t)),t.ayref===t.yref&&L("ay",y(x,n,"ay",k,t)),G.attr("transform",l(e,n)),R.attr({transform:"rotate("+O+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",e,S());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}};if(t.showarrow&&Me(0,0),E)h.init({element:I.node(),gd:e,prepFn:function(){Te=R.attr("transform")},moveFn:function(e,n){var r="pointer";if(t.showarrow)t.axref===t.xref?L("ax",y(m,e,"ax",k,t)):L("ax",t.ax+e),t.ayref===t.yref?L("ay",y(x,n,"ay",k.w,t)):L("ay",t.ay+n),Me(e,n);else{if(i)return;var a,o;if(m)a=y(m,e,"x",k,t);else{var s=t._xsize/k.w,c=t.x+(t._xshift-t.xshift)/k.w-s/2;a=h.align(c+e/k.w,s,0,1,t.xanchor)}if(x)o=y(x,n,"y",k,t);else{var u=t._ysize/k.h,f=t.y-(t._yshift+t.yshift)/k.h-u/2;o=h.align(f-n/k.h,u,0,1,t.yanchor)}L("x",a),L("y",o),m&&x||(r=h.getCursor(m?.5:a,x?.5:o,t.xanchor,t.yanchor))}R.attr({transform:l(e,n)+Te}),p(I,r)},clickFn:function(n,r){t.captureevents&&e.emit("plotly_clickannotation",Z(r))},doneFn:function(){p(I),a.call("_guiRelayout",e,S());var t=document.querySelector(".js-notes-box-panel");t&&t.redraw(t.selectedObj)}})}}}t.exports={draw:function(e){var t=e._fullLayout;t._infolayer.selectAll(".annotation").remove();for(var n=0;n=0,x=t.indexOf("end")>=0,b=h.backoff*v+n.standoff,_=g.backoff*m+n.startstandoff;if("line"===p.nodeName){o={x:+e.attr("x1"),y:+e.attr("y1")},u={x:+e.attr("x2"),y:+e.attr("y2")};var w=o.x-u.x,k=o.y-u.y;if(d=(f=Math.atan2(k,w))+Math.PI,b&&_&&b+_>Math.sqrt(w*w+k*k))return void E();if(b){if(b*b>w*w+k*k)return void E();var T=b*Math.cos(f),M=b*Math.sin(f);u.x+=T,u.y+=M,e.attr({x2:u.x,y2:u.y})}if(_){if(_*_>w*w+k*k)return void E();var A=_*Math.cos(f),L=_*Math.sin(f);o.x-=A,o.y-=L,e.attr({x1:o.x,y1:o.y})}}else if("path"===p.nodeName){var S=p.getTotalLength(),C="";if(S1){c=!0;break}}c?e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove():(s._pdata=a(e.glplot.cameraParams,[t.xaxis.r2l(s.x)*n[0],t.yaxis.r2l(s.y)*n[1],t.zaxis.r2l(s.z)*n[2]]),r(e.graphDiv,s,l,e.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":294,"../annotations/draw":72}],79:[function(e,t,n){"use strict";var r=e("../../registry"),a=e("../../lib");t.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:e("./attributes")}}},layoutAttributes:e("./attributes"),handleDefaults:e("./defaults"),includeBasePlot:function(e,t){var n=r.subplotsRegistry.gl3d;if(!n)return;for(var i=n.attrRegex,o=Object.keys(e),l=0;l=0))return e;if(3===o)r[o]>1&&(r[o]=1);else if(r[o]>=1)return e}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return i?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}i.tinyRGB=function(e){var t=e.toRgb();return"rgb("+Math.round(t.r)+", "+Math.round(t.g)+", "+Math.round(t.b)+")"},i.rgb=function(e){return i.tinyRGB(r(e))},i.opacity=function(e){return e?r(e).getAlpha():0},i.addOpacity=function(e,t){var n=r(e).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+t+")"},i.combine=function(e,t){var n=r(e).toRgb();if(1===n.a)return r(e).toRgbString();var a=r(t||s).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-n.a)+n.r*n.a,g:i.g*(1-n.a)+n.g*n.a,b:i.b*(1-n.a)+n.b*n.a};return r(o).toRgbString()},i.contrast=function(e,t,n){var a=r(e);return 1!==a.getAlpha()&&(a=r(i.combine(e,s))),(a.isDark()?t?a.lighten(t):s:n?a.darken(n):l).toString()},i.stroke=function(e,t){var n=r(t);e.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(e,t){var n=r(t);e.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(e){if(e&&"object"==typeof e){var t,n,r,a,o=Object.keys(e);for(t=0;t0?r>=s:r<=s));a++)r>u&&r0?r>=s:r<=s));a++)r>n[0]&&r1){var J=Math.pow(10,Math.floor(Math.log(W)/Math.LN10));Y*=J*c.roundUp(W/J,[2,5,10]),(Math.abs(P.start)/P.size+1e-6)%1<2e-6&&(Z.tick0=0)}Z.dtick=Y}Z.domain=[q+B,q+F-B],Z.setScale(),e.attr("transform",u(Math.round(s.l),Math.round(s.t)));var Q,$=e.select("."+M.cbtitleunshift).attr("transform",u(-Math.round(s.l),-Math.round(s.t))),K=e.select("."+M.cbaxis),ee=0;function te(r,a){var i={propContainer:Z,propName:t._propPrefix+"title",traceIndex:t._traceIndex,_meta:t._meta,placeholder:o._dfltTitle.colorbar,containerGroup:e.select("."+M.cbtitle)},l="h"===r.charAt(0)?r.substr(1):"h"+r;e.selectAll("."+l+",."+l+"-math-group").remove(),g.draw(n,r,f(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(A)){var e,n=s.l+(t.x+N)*s.w,r=Z.title.font.size;e="top"===A?(1-(q+F-B))*s.h+s.t+3+.75*r:(1-(q+B))*s.h+s.t-3-.25*r,te(Z._id+"title",{attributes:{x:n,y:e,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(A)){var i=e.select("."+M.cbtitle),o=i.select("text"),f=[-t.outlinewidth/2,t.outlinewidth/2],d=i.select(".h"+Z._id+"title-math-group").node(),h=15.6;if(o.node()&&(h=parseInt(o.node().style.fontSize,10)*w),d?(ee=p.bBox(d).height)>h&&(f[1]-=(ee-h)/2):o.node()&&!o.classed(M.jsPlaceholder)&&(ee=p.bBox(o.node()).height),ee){if(ee+=5,"top"===A)Z.domain[1]-=ee/s.h,f[1]*=-1;else{Z.domain[0]+=ee/s.h;var g=v.lineCount(o);f[1]+=(1-g)*h}i.attr("transform",u(f[0],f[1])),Z.setScale()}}e.selectAll("."+M.cbfills+",."+M.cblines).attr("transform",u(0,Math.round(s.h*(1-Z.domain[1])))),K.attr("transform",u(0,Math.round(-s.t)));var y=e.select("."+M.cbfills).selectAll("rect."+M.cbfill).attr("style","").data(D);y.enter().append("rect").classed(M.cbfill,!0).style("stroke","none"),y.exit().remove();var x=L.map(Z.c2p).map(Math.round).sort((function(e,t){return e-t}));y.each((function(e,i){var o=[0===i?L[0]:(D[i]+D[i-1])/2,i===D.length-1?L[1]:(D[i]+D[i+1])/2].map(Z.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,x[0],x[1]);var l=r.select(this).attr({x:H,width:Math.max(E,2),y:r.min(o),height:Math.max(r.max(o)-r.min(o),2)});if(t._fillgradient)p.gradient(l,n,t._id,"vertical",t._fillgradient,"fill");else{var s=C(e).replace("e-","");l.attr("fill",a(s).toHexString())}}));var b=e.select("."+M.cblines).selectAll("path."+M.cbline).data(m.color&&m.width?R:[]);b.enter().append("path").classed(M.cbline,!0),b.exit().remove(),b.each((function(e){r.select(this).attr("d","M"+H+","+(Math.round(Z.c2p(e))+m.width/2%1)+"h"+E).call(p.lineGroupStyle,m.width,S(e),m.dash)})),K.selectAll("g."+Z._id+"tick,path").remove();var _=H+E+(t.outlinewidth||0)/2-("outside"===t.ticks?1:0),k=l.calcTicks(Z),T=l.getTickSigns(Z)[2];return l.drawTicks(n,Z,{vals:"inside"===Z.ticks?l.clipEnds(Z,k):k,layer:K,path:l.makeTickPath(Z,_,T),transFn:l.makeTransTickFn(Z)}),l.drawLabels(n,Z,{vals:k,layer:K,transFn:l.makeTransTickLabelFn(Z),labelFns:l.makeLabelFns(Z,_)})},function(){if(-1===["top","bottom"].indexOf(A)){var e=Z.title.font.size,t=Z._offset+Z._length/2,a=s.l+(Z.position||0)*s.w+("right"===Z.side?10+e*(Z.showticklabels?1:.5):-10-e*(Z.showticklabels?.5:0));te("h"+Z._id+"title",{avoid:{selection:r.select(n).selectAll("g."+Z._id+"tick"),side:A,offsetLeft:s.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:t,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var r=E+t.outlinewidth/2;if(-1===Z.ticklabelposition.indexOf("inside")&&(r+=p.bBox(K.node()).width),(Q=$.select("text")).node()&&!Q.classed(M.jsPlaceholder)){var a,o=$.select(".h"+Z._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(A)?p.bBox(o).width:p.bBox($.node()).right-H-s.l,r=Math.max(r,a)}var l=2*t.xpad+r+t.borderwidth+t.outlinewidth/2,c=V-G;e.select("."+M.cbbg).attr({x:H-t.xpad-(t.borderwidth+t.outlinewidth)/2,y:G-j,width:Math.max(l,2),height:Math.max(c+2*j,2)}).call(h.fill,t.bgcolor).call(h.stroke,t.bordercolor).style("stroke-width",t.borderwidth),e.selectAll("."+M.cboutline).attr({x:H,y:G+t.ypad+("top"===A?ee:0),width:Math.max(E,2),height:Math.max(c-2*t.ypad-ee,2)}).call(h.stroke,t.outlinecolor).style({fill:"none","stroke-width":t.outlinewidth});var f=({center:.5,right:1}[t.xanchor]||0)*l;e.attr("transform",u(s.l-f,s.t));var d={},g=k[t.yanchor],v=T[t.yanchor];"pixels"===t.lenmode?(d.y=t.y,d.t=c*g,d.b=c*v):(d.t=d.b=0,d.yt=t.y+t.len*g,d.yb=t.y-t.len*v);var m=k[t.xanchor],y=T[t.xanchor];if("pixels"===t.thicknessmode)d.x=t.x,d.l=l*m,d.r=l*y;else{var x=l-E;d.l=x*m,d.r=x*y,d.xl=t.x-t.thickness*m,d.xr=t.x+t.thickness*y}i.autoMargin(n,t._id,d)}],n)}(n,t,e);m&&m.then&&(e._promises||[]).push(m),e._context.edits.colorbarPosition&&function(e,t,n){var r,a,i,l=n._fullLayout._size;s.init({element:e.node(),gd:n,prepFn:function(){r=e.attr("transform"),d(e)},moveFn:function(n,o){e.attr("transform",r+u(n,o)),a=s.align(t._xLeftFrac+n/l.w,t._thickFrac,0,1,t.xanchor),i=s.align(t._yBottomFrac-o/l.h,t._lenFrac,0,1,t.yanchor);var c=s.getCursor(a,i,t.xanchor,t.yanchor);d(e,c)},doneFn:function(){if(d(e),void 0!==a&&void 0!==i){var r={};r[t._propPrefix+"x"]=a,r[t._propPrefix+"y"]=i,void 0!==t._traceIndex?o.call("_guiRestyle",n,r,t._traceIndex):o.call("_guiRelayout",n,r)}}})}(n,t,e)})),t.exit().each((function(t){i.autoMargin(e,t._id)})).remove(),t.order()}}},{"../../constants/alignment":183,"../../lib":210,"../../lib/extend":202,"../../lib/setcursor":229,"../../lib/svg_text_utils":231,"../../plots/cartesian/axes":256,"../../plots/cartesian/axis_defaults":258,"../../plots/cartesian/layout_attributes":270,"../../plots/cartesian/position_defaults":273,"../../plots/plots":297,"../../registry":306,"../color":81,"../colorscale/helpers":92,"../dragelement":100,"../drawing":103,"../titles":176,"./constants":83,d3:15,tinycolor2:63}],86:[function(e,t,n){"use strict";var r=e("../../lib");t.exports=function(e){return r.isPlainObject(e.colorbar)}},{"../../lib":210}],87:[function(e,t,n){"use strict";t.exports={moduleType:"component",name:"colorbar",attributes:e("./attributes"),supplyDefaults:e("./defaults"),draw:e("./draw").draw,hasColorbar:e("./has_colorbar")}},{"./attributes":82,"./defaults":84,"./draw":85,"./has_colorbar":86}],88:[function(e,t,n){"use strict";var r=e("../colorbar/attributes"),a=e("../../lib/regex").counter,i=e("./scales.js").scales;Object.keys(i);function o(e){return"`"+e+"`"}t.exports=function(e,t){e=e||"";var n,l=(t=t||{}).cLetter||"c",s=("onlyIfNumerical"in t?t.onlyIfNumerical:Boolean(e),"noScale"in t?t.noScale:"marker.line"===e),c="showScaleDflt"in t?t.showScaleDflt:"z"===l,u="string"==typeof t.colorscaleDflt?i[t.colorscaleDflt]:null,f=t.editTypeOverride||"",d=e?e+".":"";"colorAttr"in t?(n=t.colorAttr,t.colorAttr):o(d+(n={z:"z",c:"color"}[l]));var p=l+"auto",h=l+"min",g=l+"max",v=l+"mid",m=(o(d+p),o(d+h),o(d+g),{});m[h]=m[g]=void 0;var y={};y[p]=!1;var x={};return"color"===n&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},t.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},x[h]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==t.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},s||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=r),t.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":225,"../colorbar/attributes":82,"./scales.js":96}],89:[function(e,t,n){"use strict";var r=e("fast-isnumeric"),a=e("../../lib"),i=e("./helpers").extractOpts;t.exports=function(e,t,n){var o,l=e._fullLayout,s=n.vals,c=n.containerStr,u=c?a.nestedProperty(t,c).get():t,f=i(u),d=!1!==f.auto,p=f.min,h=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,s)},m=function(){return a.aggNums(Math.max,null,s)};(void 0===p?p=v():d&&(p=u._colorAx&&r(p)?Math.min(p,v()):v()),void 0===h?h=m():d&&(h=u._colorAx&&r(h)?Math.max(h,m()):m()),d&&void 0!==g&&(h-g>g-p?p=g-(h-g):h-g=0?l.colorscale.sequential:l.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":210,"./helpers":92,"fast-isnumeric":17}],90:[function(e,t,n){"use strict";var r=e("../../lib"),a=e("./helpers").hasColorscale,i=e("./helpers").extractOpts;t.exports=function(e,t){function n(e,t){var n=e["_"+t];void 0!==n&&(e[t]=n)}function o(e,a){var o=a.container?r.nestedProperty(e,a.container).get():e;if(o)if(o.coloraxis)o._colorAx=t[o.coloraxis];else{var l=i(o),s=l.auto;(s||void 0===l.min)&&n(o,a.min),(s||void 0===l.max)&&n(o,a.max),l.autocolorscale&&n(o,"colorscale")}}for(var l=0;l=0;r--,a++){var i=e[r];n[a]=[1-i[0],i[1]]}return n}function h(e,t){t=t||{};for(var n=e.domain,o=e.range,s=o.length,c=new Array(s),u=0;u4/3-l?o:l}},{}],98:[function(e,t,n){"use strict";var r=e("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];t.exports=function(e,t,n,i){return e="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*e),0,2),t="bottom"===i?0:"middle"===i?1:"top"===i?2:r.constrain(Math.floor(3*t),0,2),a[t][e]}},{"../../lib":210}],99:[function(e,t,n){"use strict";n.selectMode=function(e){return"lasso"===e||"select"===e},n.drawMode=function(e){return"drawclosedpath"===e||"drawopenpath"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},n.openMode=function(e){return"drawline"===e||"drawopenpath"===e},n.rectMode=function(e){return"select"===e||"drawline"===e||"drawrect"===e||"drawcircle"===e},n.freeMode=function(e){return"lasso"===e||"drawclosedpath"===e||"drawopenpath"===e},n.selectingOrDrawing=function(e){return n.freeMode(e)||n.rectMode(e)}},{}],100:[function(e,t,n){"use strict";var r=e("mouse-event-offset"),a=e("has-hover"),i=e("has-passive-events"),o=e("../../lib").removeElement,l=e("../../plots/cartesian/constants"),s=t.exports={};s.align=e("./align"),s.getCursor=e("./cursor");var c=e("./unhover");function u(){var e=document.createElement("div");e.className="dragcover";var t=e.style;return t.position="fixed",t.left=0,t.right=0,t.top=0,t.bottom=0,t.zIndex=999999999,t.background="none",document.body.appendChild(e),e}function f(e){return r(e.changedTouches?e.changedTouches[0]:e,document.body)}s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(e){var t,n,r,c,d,p,h,g,v=e.gd,m=1,y=v._context.doubleClickDelay,x=e.element;v._mouseDownTime||(v._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=e.clampFn||function(e,t,n){return Math.abs(e)y&&(m=Math.max(m-1,1)),v._dragged)e.doneFn&&e.doneFn();else if(e.clickFn&&e.clickFn(m,p),!g){var n;try{n=new MouseEvent("click",t)}catch(e){var r=f(t);(n=document.createEvent("MouseEvents")).initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,r[0],r[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}h.dispatchEvent(n)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},s.coverSlip=u},{"../../lib":210,"../../plots/cartesian/constants":262,"./align":97,"./cursor":98,"./unhover":101,"has-hover":48,"has-passive-events":49,"mouse-event-offset":52}],101:[function(e,t,n){"use strict";var r=e("../../lib/events"),a=e("../../lib/throttle"),i=e("../../lib/dom").getGraphDiv,o=e("../fx/constants"),l=t.exports={};l.wrapped=function(e,t,n){(e=i(e))._fullLayout&&a.clear(e._fullLayout._uid+o.HOVERID),l.raw(e,t,n)},l.raw=function(e,t){var n=e._fullLayout,a=e._hoverdata;t||(t={}),t.target&&!1===r.triggerHandler(e,"plotly_beforehover",t)||(n._hoverlayer.selectAll("g").remove(),n._hoverlayer.selectAll("line").remove(),n._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,t.target&&a&&e.emit("plotly_unhover",{event:t,points:a}))}},{"../../lib/dom":200,"../../lib/events":201,"../../lib/throttle":232,"../fx/constants":115}],102:[function(e,t,n){"use strict";n.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],103:[function(e,t,n){"use strict";var r=e("d3"),a=e("fast-isnumeric"),i=e("tinycolor2"),o=e("../../registry"),l=e("../color"),s=e("../colorscale"),c=e("../../lib"),u=c.strTranslate,f=e("../../lib/svg_text_utils"),d=e("../../constants/xmlns_namespaces"),p=e("../../constants/alignment").LINE_SPACING,h=e("../../constants/interactions").DESELECTDIM,g=e("../../traces/scatter/subtypes"),v=e("../../traces/scatter/make_bubble_size_func"),m=e("../../components/fx/helpers").appendArrayPointValue,y=t.exports={};y.font=function(e,t,n,r){c.isPlainObject(t)&&(r=t.color,n=t.size,t=t.family),t&&e.style("font-family",t),n+1&&e.style("font-size",n+"px"),r&&e.call(l.fill,r)},y.setPosition=function(e,t,n){e.attr("x",t).attr("y",n)},y.setSize=function(e,t,n){e.attr("width",t).attr("height",n)},y.setRect=function(e,t,n,r,a){e.call(y.setPosition,t,n).call(y.setSize,r,a)},y.translatePoint=function(e,t,n,r){var i=n.c2p(e.x),o=r.c2p(e.y);return!!(a(i)&&a(o)&&t.node())&&("text"===t.node().nodeName?t.attr("x",i).attr("y",o):t.attr("transform",u(i,o)),!0)},y.translatePoints=function(e,t,n){e.each((function(e){var a=r.select(this);y.translatePoint(e,a,t,n)}))},y.hideOutsideRangePoint=function(e,t,n,r,a,i){t.attr("display",n.isPtWithinRange(e,a)&&r.isPtWithinRange(e,i)?null:"none")},y.hideOutsideRangePoints=function(e,t){if(t._hasClipOnAxisFalse){var n=t.xaxis,a=t.yaxis;e.each((function(t){var i=t[0].trace,l=i.xcalendar,s=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";e.selectAll(c).each((function(e){y.hideOutsideRangePoint(e,r.select(this),n,a,l,s)}))}))}},y.crispRound=function(e,t,n){return t&&a(t)?e._context.staticPlot?t:t<1?1:Math.round(t):n||0},y.singleLineStyle=function(e,t,n,r,a){t.style("fill","none");var i=(((e||[])[0]||{}).trace||{}).line||{},o=n||i.width||0,s=a||i.dash||"";l.stroke(t,r||i.color),y.dashLine(t,s,o)},y.lineGroupStyle=function(e,t,n,a){e.style("fill","none").each((function(e){var i=(((e||[])[0]||{}).trace||{}).line||{},o=t||i.width||0,s=a||i.dash||"";r.select(this).call(l.stroke,n||i.color).call(y.dashLine,s,o)}))},y.dashLine=function(e,t,n){n=+n||0,t=y.dashStyle(t,n),e.style({"stroke-dasharray":t,"stroke-width":n+"px"})},y.dashStyle=function(e,t){t=+t||1;var n=Math.max(t,3);return"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),e},y.singleFillStyle=function(e){var t=(((r.select(e.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;t&&e.call(l.fill,t)},y.fillGroupStyle=function(e){e.style("stroke-width",0).each((function(e){var t=r.select(this);e[0].trace&&t.call(l.fill,e[0].trace.fillcolor)}))};var x=e("./symbol_defs");y.symbolNames=[],y.symbolFuncs=[],y.symbolNeedLines={},y.symbolNoDot={},y.symbolNoFill={},y.symbolList=[],Object.keys(x).forEach((function(e){var t=x[e],n=t.n;y.symbolList.push(n,String(n),e,n+100,String(n+100),e+"-open"),y.symbolNames[n]=e,y.symbolFuncs[n]=t.f,t.needLine&&(y.symbolNeedLines[n]=!0),t.noDot?y.symbolNoDot[n]=!0:y.symbolList.push(n+200,String(n+200),e+"-dot",n+300,String(n+300),e+"-open-dot"),t.noFill&&(y.symbolNoFill[n]=!0)}));var b=y.symbolNames.length;function _(e,t){var n=e%100;return y.symbolFuncs[n](t)+(e>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}y.symbolNumber=function(e){if(a(e))e=+e;else if("string"==typeof e){var t=0;e.indexOf("-open")>0&&(t=100,e=e.replace("-open","")),e.indexOf("-dot")>0&&(t+=200,e=e.replace("-dot","")),(e=y.symbolNames.indexOf(e))>=0&&(e+=t)}return e%100>=b||e>=400?0:Math.floor(Math.max(e,0))};var w={x1:1,x2:0,y1:0,y2:0},k={x1:0,x2:0,y1:1,y2:0},T=r.format("~.1f"),M={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:w},horizontalreversed:{node:"linearGradient",attrs:w,reversed:!0},vertical:{node:"linearGradient",attrs:k},verticalreversed:{node:"linearGradient",attrs:k,reversed:!0}};y.gradient=function(e,t,n,a,o,s){for(var u=o.length,f=M[a],d=new Array(u),p=0;p"+m(e);h._gradientUrlQueryParts[y]=1},y.initGradients=function(e){var t=e._fullLayout;c.ensureSingle(t._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),t._gradientUrlQueryParts={}},y.pointStyle=function(e,t,n){if(e.size()){var a=y.makePointStyleFns(t);e.each((function(e){y.singlePointStyle(e,r.select(this),t,a,n)}))}},y.singlePointStyle=function(e,t,n,r,a){var i=n.marker,o=i.line;if(t.style("opacity",r.selectedOpacityFn?r.selectedOpacityFn(e):void 0===e.mo?i.opacity:e.mo),r.ms2mrc){var s;s="various"===e.ms||"various"===i.size?3:r.ms2mrc(e.ms),e.mrc=s,r.selectedSizeFn&&(s=e.mrc=r.selectedSizeFn(e));var u=y.symbolNumber(e.mx||i.symbol)||0;e.om=u%200>=100,t.attr("d",_(u,s))}var f,d,p,h=!1;if(e.so)p=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;p=(e.mlw+1||g+1||(e.trace?(e.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in e?e.mlcc=r.lineScale(e.mlc):c.isArrayOrTypedArray(o.color)?l.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(f=l.defaultLine,h=!0),f="mc"in e?e.mcc=r.markerScale(e.mc):i.color||"rgba(0,0,0,0)",r.selectedColorFn&&(f=r.selectedColorFn(e))}if(e.om)t.call(l.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{t.style("stroke-width",(e.isBlank?0:p)+"px");var v=i.gradient,m=e.mgt;if(m?h=!0:m=v&&v.type,Array.isArray(m)&&(m=m[0],M[m]||(m=0)),m&&"none"!==m){var x=e.mgc;x?h=!0:x=v.color;var b=n.uid;h&&(b+="-"+e.i),y.gradient(t,a,b,m,[[0,x],[1,f]],"fill")}else l.fill(t,f);p&&l.stroke(t,d)}},y.makePointStyleFns=function(e){var t={},n=e.marker;return t.markerScale=y.tryColorscale(n,""),t.lineScale=y.tryColorscale(n,"line"),o.traceIs(e,"symbols")&&(t.ms2mrc=g.isBubble(e)?v(e):function(){return(n.size||6)/2}),e.selectedpoints&&c.extendFlat(t,y.makeSelectedPointStyleFns(e)),t},y.makeSelectedPointStyleFns=function(e){var t={},n=e.selected||{},r=e.unselected||{},a=e.marker||{},i=n.marker||{},l=r.marker||{},s=a.opacity,u=i.opacity,f=l.opacity,d=void 0!==u,p=void 0!==f;(c.isArrayOrTypedArray(s)||d||p)&&(t.selectedOpacityFn=function(e){var t=void 0===e.mo?a.opacity:e.mo;return e.selected?d?u:t:p?f:h*t});var g=a.color,v=i.color,m=l.color;(v||m)&&(t.selectedColorFn=function(e){var t=e.mcc||g;return e.selected?v||t:m||t});var y=a.size,x=i.size,b=l.size,_=void 0!==x,w=void 0!==b;return o.traceIs(e,"symbols")&&(_||w)&&(t.selectedSizeFn=function(e){var t=e.mrc||y/2;return e.selected?_?x/2:t:w?b/2:t}),t},y.makeSelectedTextStyleFns=function(e){var t={},n=e.selected||{},r=e.unselected||{},a=e.textfont||{},i=n.textfont||{},o=r.textfont||{},s=a.color,c=i.color,u=o.color;return t.selectedTextColorFn=function(e){var t=e.tc||s;return e.selected?c||t:u||(c?t:l.addOpacity(t,h))},t},y.selectedPointStyle=function(e,t){if(e.size()&&t.selectedpoints){var n=y.makeSelectedPointStyleFns(t),a=t.marker||{},i=[];n.selectedOpacityFn&&i.push((function(e,t){e.style("opacity",n.selectedOpacityFn(t))})),n.selectedColorFn&&i.push((function(e,t){l.fill(e,n.selectedColorFn(t))})),n.selectedSizeFn&&i.push((function(e,t){var r=t.mx||a.symbol||0,i=n.selectedSizeFn(t);e.attr("d",_(y.symbolNumber(r),i)),t.mrc2=i})),i.length&&e.each((function(e){for(var t=r.select(this),n=0;n0?n:0}y.textPointStyle=function(e,t,n){if(e.size()){var a;if(t.selectedpoints){var i=y.makeSelectedTextStyleFns(t);a=i.selectedTextColorFn}var o=t.texttemplate,l=n._fullLayout;e.each((function(e){var i=r.select(this),s=o?c.extractOption(e,t,"txt","texttemplate"):c.extractOption(e,t,"tx","text");if(s||0===s){if(o){var u=t._module.formatLabels?t._module.formatLabels(e,t,l):{},d={};m(d,t,e.i);var p=t._meta||{};s=c.texttemplateString(s,u,l._d3locale,d,e,p)}var h=e.tp||t.textposition,g=S(e,t),v=a?a(e):e.tc||t.textfont.color;i.call(y.font,e.tf||t.textfont.family,g,v).text(s).call(f.convertToTspans,n).call(L,h,g,e.mrc)}else i.remove()}))}},y.selectedTextStyle=function(e,t){if(e.size()&&t.selectedpoints){var n=y.makeSelectedTextStyleFns(t);e.each((function(e){var a=r.select(this),i=n.selectedTextColorFn(e),o=e.tp||t.textposition,s=S(e,t);l.fill(a,i),L(a,o,s,e.mrc2||e.mrc)}))}};function C(e,t,n,a){var i=e[0]-t[0],o=e[1]-t[1],l=n[0]-t[0],s=n[1]-t[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(l*l+s*s,.25),f=(u*u*i-c*c*l)*a,d=(u*u*o-c*c*s)*a,p=3*u*(c+u),h=3*c*(c+u);return[[r.round(t[0]+(p&&f/p),2),r.round(t[1]+(p&&d/p),2)],[r.round(t[0]-(h&&f/h),2),r.round(t[1]-(h&&d/h),2)]]}y.smoothopen=function(e,t){if(e.length<3)return"M"+e.join("L");var n,r="M"+e[0],a=[];for(n=1;n=1e4&&(y.savedBBoxes={},D=0),n&&(y.savedBBoxes[n]=v),D++,c.extendFlat({},v)},y.setClipUrl=function(e,t,n){e.attr("clip-path",E(t,n))},y.getTranslate=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,(function(e,t,n){return[t,n].join(" ")})).split(" ");return{x:+t[0]||0,y:+t[1]||0}},y.setTranslate=function(e,t,n){var r=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[r]("transform")||"";return t=t||0,n=n||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=u(t,n)).trim(),e[a]("transform",i),i},y.getScale=function(e){var t=(e[e.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,(function(e,t,n){return[t,n].join(" ")})).split(" ");return{x:+t[0]||1,y:+t[1]||1}},y.setScale=function(e,t,n){var r=e.attr?"attr":"getAttribute",a=e.attr?"attr":"setAttribute",i=e[r]("transform")||"";return t=t||1,n=n||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+="scale("+t+","+n+")").trim(),e[a]("transform",i),i};var z=/\s*sc.*/;y.setPointGroupScale=function(e,t,n){if(t=t||1,n=n||1,e){var r=1===t&&1===n?"":"scale("+t+","+n+")";e.each((function(){var e=(this.getAttribute("transform")||"").replace(z,"");e=(e+=r).trim(),this.setAttribute("transform",e)}))}};var I=/translate\([^)]*\)\s*$/;y.setTextPointsScale=function(e,t,n){e&&e.each((function(){var e,a=r.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),l=parseFloat(i.attr("y")||0),s=(a.attr("transform")||"").match(I);e=1===t&&1===n?[]:[u(o,l),"scale("+t+","+n+")",u(-o,-l)],s&&e.push(s),a.attr("transform",e.join(""))}}))}},{"../../components/fx/helpers":117,"../../constants/alignment":183,"../../constants/interactions":186,"../../constants/xmlns_namespaces":188,"../../lib":210,"../../lib/svg_text_utils":231,"../../registry":306,"../../traces/scatter/make_bubble_size_func":345,"../../traces/scatter/subtypes":353,"../color":81,"../colorscale":93,"./symbol_defs":104,d3:15,"fast-isnumeric":17,tinycolor2:63}],104:[function(e,t,n){"use strict";var r=e("d3");t.exports={circle:{n:0,f:function(e){var t=r.round(e,2);return"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"}},square:{n:1,f:function(e){var t=r.round(e,2);return"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"}},diamond:{n:2,f:function(e){var t=r.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"Z"}},cross:{n:3,f:function(e){var t=r.round(.4*e,2),n=r.round(1.2*e,2);return"M"+n+","+t+"H"+t+"V"+n+"H-"+t+"V"+t+"H-"+n+"V-"+t+"H-"+t+"V-"+n+"H"+t+"V-"+t+"H"+n+"Z"}},x:{n:4,f:function(e){var t=r.round(.8*e/Math.sqrt(2),2),n="l"+t+","+t,a="l"+t+",-"+t,i="l-"+t+",-"+t,o="l-"+t+","+t;return"M0,"+t+n+a+i+a+i+o+i+o+n+o+n+"Z"}},"triangle-up":{n:5,f:function(e){var t=r.round(2*e/Math.sqrt(3),2);return"M-"+t+","+r.round(e/2,2)+"H"+t+"L0,-"+r.round(e,2)+"Z"}},"triangle-down":{n:6,f:function(e){var t=r.round(2*e/Math.sqrt(3),2);return"M-"+t+",-"+r.round(e/2,2)+"H"+t+"L0,"+r.round(e,2)+"Z"}},"triangle-left":{n:7,f:function(e){var t=r.round(2*e/Math.sqrt(3),2);return"M"+r.round(e/2,2)+",-"+t+"V"+t+"L-"+r.round(e,2)+",0Z"}},"triangle-right":{n:8,f:function(e){var t=r.round(2*e/Math.sqrt(3),2);return"M-"+r.round(e/2,2)+",-"+t+"V"+t+"L"+r.round(e,2)+",0Z"}},"triangle-ne":{n:9,f:function(e){var t=r.round(.6*e,2),n=r.round(1.2*e,2);return"M-"+n+",-"+t+"H"+t+"V"+n+"Z"}},"triangle-se":{n:10,f:function(e){var t=r.round(.6*e,2),n=r.round(1.2*e,2);return"M"+t+",-"+n+"V"+t+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(e){var t=r.round(.6*e,2),n=r.round(1.2*e,2);return"M"+n+","+t+"H-"+t+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(e){var t=r.round(.6*e,2),n=r.round(1.2*e,2);return"M-"+t+","+n+"V-"+t+"H"+n+"Z"}},pentagon:{n:13,f:function(e){var t=r.round(.951*e,2),n=r.round(.588*e,2),a=r.round(-e,2),i=r.round(-.309*e,2);return"M"+t+","+i+"L"+n+","+r.round(.809*e,2)+"H-"+n+"L-"+t+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(e){var t=r.round(e,2),n=r.round(e/2,2),a=r.round(e*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+t+"L-"+a+","+n+"V-"+n+"L0,-"+t+"Z"}},hexagon2:{n:15,f:function(e){var t=r.round(e,2),n=r.round(e/2,2),a=r.round(e*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+t+",0L"+n+",-"+a+"H-"+n+"L-"+t+",0Z"}},octagon:{n:16,f:function(e){var t=r.round(.924*e,2),n=r.round(.383*e,2);return"M-"+n+",-"+t+"H"+n+"L"+t+",-"+n+"V"+n+"L"+n+","+t+"H-"+n+"L-"+t+","+n+"V-"+n+"Z"}},star:{n:17,f:function(e){var t=1.4*e,n=r.round(.225*t,2),a=r.round(.951*t,2),i=r.round(.363*t,2),o=r.round(.588*t,2),l=r.round(-t,2),s=r.round(-.309*t,2),c=r.round(.118*t,2),u=r.round(.809*t,2);return"M"+n+","+s+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+r.round(.382*t,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(e){var t=r.round(.66*e,2),n=r.round(.38*e,2),a=r.round(.76*e,2);return"M-"+a+",0l-"+n+",-"+t+"h"+a+"l"+n+",-"+t+"l"+n+","+t+"h"+a+"l-"+n+","+t+"l"+n+","+t+"h-"+a+"l-"+n+","+t+"l-"+n+",-"+t+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(e){var t=r.round(e*Math.sqrt(3)*.8,2),n=r.round(.8*e,2),a=r.round(1.6*e,2),i=r.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+t+","+n+o+t+","+n+o+"0,-"+a+o+"-"+t+","+n+"Z"}},"star-triangle-down":{n:20,f:function(e){var t=r.round(e*Math.sqrt(3)*.8,2),n=r.round(.8*e,2),a=r.round(1.6*e,2),i=r.round(4*e,2),o="A "+i+","+i+" 0 0 1 ";return"M"+t+",-"+n+o+"-"+t+",-"+n+o+"0,"+a+o+t+",-"+n+"Z"}},"star-square":{n:21,f:function(e){var t=r.round(1.1*e,2),n=r.round(2*e,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+t+",-"+t+a+"-"+t+","+t+a+t+","+t+a+t+",-"+t+a+"-"+t+",-"+t+"Z"}},"star-diamond":{n:22,f:function(e){var t=r.round(1.4*e,2),n=r.round(1.9*e,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+t+",0"+a+"0,"+t+a+t+",0"+a+"0,-"+t+a+"-"+t+",0Z"}},"diamond-tall":{n:23,f:function(e){var t=r.round(.7*e,2),n=r.round(1.4*e,2);return"M0,"+n+"L"+t+",0L0,-"+n+"L-"+t+",0Z"}},"diamond-wide":{n:24,f:function(e){var t=r.round(1.4*e,2),n=r.round(.7*e,2);return"M0,"+n+"L"+t+",0L0,-"+n+"L-"+t+",0Z"}},hourglass:{n:25,f:function(e){var t=r.round(e,2);return"M"+t+","+t+"H-"+t+"L"+t+",-"+t+"H-"+t+"Z"},noDot:!0},bowtie:{n:26,f:function(e){var t=r.round(e,2);return"M"+t+","+t+"V-"+t+"L-"+t+","+t+"V-"+t+"Z"},noDot:!0},"circle-cross":{n:27,f:function(e){var t=r.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(e){var t=r.round(e,2),n=r.round(e/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+t+",0A"+t+","+t+" 0 1,1 0,-"+t+"A"+t+","+t+" 0 0,1 "+t+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(e){var t=r.round(e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(e){var t=r.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t+"M"+t+","+t+"H-"+t+"V-"+t+"H"+t+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(e){var t=r.round(1.3*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM0,-"+t+"V"+t+"M-"+t+",0H"+t},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(e){var t=r.round(1.3*e,2),n=r.round(.65*e,2);return"M"+t+",0L0,"+t+"L-"+t+",0L0,-"+t+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(e){var t=r.round(1.4*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(e){var t=r.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t+"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(e){var t=r.round(1.2*e,2),n=r.round(.85*e,2);return"M0,"+t+"V-"+t+"M"+t+",0H-"+t+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(e){var t=r.round(e/2,2),n=r.round(e,2);return"M"+t+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+t+"H-"+n+"m0,-"+n+"H"+n},needLine:!0,noFill:!0},"y-up":{n:37,f:function(e){var t=r.round(1.2*e,2),n=r.round(1.6*e,2),a=r.round(.8*e,2);return"M-"+t+","+a+"L0,0M"+t+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(e){var t=r.round(1.2*e,2),n=r.round(1.6*e,2),a=r.round(.8*e,2);return"M-"+t+",-"+a+"L0,0M"+t+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(e){var t=r.round(1.2*e,2),n=r.round(1.6*e,2),a=r.round(.8*e,2);return"M"+a+","+t+"L0,0M"+a+",-"+t+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(e){var t=r.round(1.2*e,2),n=r.round(1.6*e,2),a=r.round(.8*e,2);return"M-"+a+","+t+"L0,0M-"+a+",-"+t+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(e){var t=r.round(1.4*e,2);return"M"+t+",0H-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(e){var t=r.round(1.4*e,2);return"M0,"+t+"V-"+t},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(e){var t=r.round(e,2);return"M"+t+",-"+t+"L-"+t+","+t},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(e){var t=r.round(e,2);return"M"+t+","+t+"L-"+t+",-"+t},needLine:!0,noDot:!0,noFill:!0},"arrow-up":{n:45,f:function(e){var t=r.round(e,2);return"M0,0L-"+t+","+r.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-down":{n:46,f:function(e){var t=r.round(e,2);return"M0,0L-"+t+",-"+r.round(2*e,2)+"H"+t+"Z"},noDot:!0},"arrow-left":{n:47,f:function(e){var t=r.round(2*e,2),n=r.round(e,2);return"M0,0L"+t+",-"+n+"V"+n+"Z"},noDot:!0},"arrow-right":{n:48,f:function(e){var t=r.round(2*e,2),n=r.round(e,2);return"M0,0L-"+t+",-"+n+"V"+n+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(e){var t=r.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+","+r.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(e){var t=r.round(e,2);return"M-"+t+",0H"+t+"M0,0L-"+t+",-"+r.round(2*e,2)+"H"+t+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(e){var t=r.round(2*e,2),n=r.round(e,2);return"M0,-"+n+"V"+n+"M0,0L"+t+",-"+n+"V"+n+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(e){var t=r.round(2*e,2),n=r.round(e,2);return"M0,-"+n+"V"+n+"M0,0L-"+t+",-"+n+"V"+n+"Z"},needLine:!0,noDot:!0}}},{d3:15}],105:[function(e,t,n){"use strict";t.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"}}}},{}],106:[function(e,t,n){"use strict";var r=e("fast-isnumeric"),a=e("../../registry"),i=e("../../plots/cartesian/axes"),o=e("../../lib"),l=e("./compute_error");function s(e,t,n,a){var s=t["error_"+a]||{},c=[];if(s.visible&&-1!==["linear","log"].indexOf(n.type)){for(var u=l(s),f=0;f0;t.each((function(t){var f,d=t[0].trace,p=d.error_x||{},h=d.error_y||{};d.ids&&(f=function(e){return e.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;h.visible||p.visible||(t=[]);var v=r.select(this).selectAll("g.errorbar").data(t,f);if(v.exit().remove(),t.length){p.visible||v.selectAll("path.xerror").remove(),h.visible||v.selectAll("path.yerror").remove(),v.style("opacity",1);var m=v.enter().append("g").classed("errorbar",!0);u&&m.style("opacity",0).transition().duration(l.duration).style("opacity",1),i.setClipUrl(v,n.layerClipId,e),v.each((function(e){var t=r.select(this),n=function(e,t,n){var r={x:t.c2p(e.x),y:n.c2p(e.y)};void 0!==e.yh&&(r.yh=n.c2p(e.yh),r.ys=n.c2p(e.ys),a(r.ys)||(r.noYS=!0,r.ys=n.c2p(e.ys,!0)));void 0!==e.xh&&(r.xh=t.c2p(e.xh),r.xs=t.c2p(e.xs),a(r.xs)||(r.noXS=!0,r.xs=t.c2p(e.xs,!0)));return r}(e,s,c);if(!g||e.vis){var i,o=t.select("path.yerror");if(h.visible&&a(n.x)&&a(n.yh)&&a(n.ys)){var f=h.width;i="M"+(n.x-f)+","+n.yh+"h"+2*f+"m-"+f+",0V"+n.ys,n.noYS||(i+="m-"+f+",0h"+2*f),!o.size()?o=t.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(l.duration).ease(l.easing)),o.attr("d",i)}else o.remove();var d=t.select("path.xerror");if(p.visible&&a(n.y)&&a(n.xh)&&a(n.xs)){var v=(p.copy_ystyle?h:p).width;i="M"+n.xh+","+(n.y-v)+"v"+2*v+"m0,-"+v+"H"+n.xs,n.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=t.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(d=d.transition().duration(l.duration).ease(l.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":353,"../drawing":103,d3:15,"fast-isnumeric":17}],111:[function(e,t,n){"use strict";var r=e("d3"),a=e("../color");t.exports=function(e){e.each((function(e){var t=e[0].trace,n=t.error_y||{},i=t.error_x||{},o=r.select(this);o.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),i.copy_ystyle&&(i=n),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":81,d3:15}],112:[function(e,t,n){"use strict";var r=e("../../plots/font_attributes"),a=e("./layout_attributes").hoverlabel,i=e("../../lib/extend").extendFlat;t.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:r({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":202,"../../plots/font_attributes":284,"./layout_attributes":122}],113:[function(e,t,n){"use strict";var r=e("../../lib"),a=e("../../registry");function i(e,t,n,a){a=a||r.identity,Array.isArray(e)&&(t[0][n]=a(e))}t.exports=function(e){var t=e.calcdata,n=e._fullLayout;function o(e){return function(t){return r.coerceHoverinfo({hoverinfo:t},{_module:e._module},n)}}for(var l=0;l=0&&n.indexb[0]._length||ee<0||ee>_[0]._length)return h.unhoverRaw(e,t)}if(t.pointerX=K+b[0]._offset,t.pointerY=ee+_[0]._offset,C="xval"in t?m.flat(l,t.xval):m.p2c(b,K),O="yval"in t?m.flat(l,t.yval):m.p2c(_,ee),!a(C[0])||!a(O[0]))return o.warn("Fx.hover failed",t,e),h.unhoverRaw(e,t)}var re=1/0;function ae(e,n){for(F=0;FZ&&(W.splice(0,Z),re=W[0].distance),g&&0!==X&&0===W.length){G.distance=X,G.index=!1;var f=j._module.hoverPoints(G,q,V,"closest",s._hoverlayer);if(f&&(f=f.filter((function(e){return e.spikeDistance<=X}))),f&&f.length){var d,h=f.filter((function(e){return e.xa.showspikes&&"hovered data"!==e.xa.spikesnap}));if(h.length){var v=h[0];a(v.x0)&&a(v.y0)&&(d=oe(v),(!Q.vLinePoint||Q.vLinePoint.spikeDistance>d.spikeDistance)&&(Q.vLinePoint=d))}var y=f.filter((function(e){return e.ya.showspikes&&"hovered data"!==e.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(d=oe(x),(!Q.hLinePoint||Q.hLinePoint.spikeDistance>d.spikeDistance)&&(Q.hLinePoint=d))}}}}}function ie(e,t){for(var n,r=null,a=1/0,i=0;i1||W.length>1)||"closest"===L&&$&&W.length>1,Ae=p.combine(s.plot_bgcolor||p.background,s.paper_bgcolor),Le={hovermode:L,rotateLabels:Me,bgColor:Ae,container:s._hoverlayer,outerContainer:s._paperdiv,commonLabelOpts:s.hoverlabel,hoverdistance:s.hoverdistance},Se=P(W,Le,e);m.isUnifiedHover(L)||(!function(e,t,n){var r,a,i,o,l,s,c,u=0,f=1,d=e.size(),p=new Array(d),h=0;function g(e){var t=e[0],n=e[e.length-1];if(a=t.pmin-t.pos-t.dp+t.size,i=n.pos+n.dp+n.size-t.pmax,a>.01){for(l=e.length-1;l>=0;l--)e[l].dp+=a;r=!1}if(!(i<.01)){if(a<-.01){for(l=e.length-1;l>=0;l--)e[l].dp-=i;r=!1}if(r){var c=0;for(o=0;ot.pmax&&c++;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos>t.pmax-1&&(s.del=!0,c--);for(o=0;o=0;l--)e[l].dp-=i;for(o=e.length-1;o>=0&&!(c<=0);o--)(s=e[o]).pos+s.dp+s.size>t.pmax&&(s.del=!0,c--)}}}e.each((function(e){var r=e[t],a="x"===r._id.charAt(0),i=r.range;0===h&&i&&i[0]>i[1]!==a&&(f=-1),p[h++]=[{datum:e,traceIndex:e.trace.index,dp:0,pos:e.pos,posref:e.posref,size:e.by*(a?k:1)/2,pmin:0,pmax:a?n.width:n.height}]})),p.sort((function(e,t){return e[0].posref-t[0].posref||f*(t[0].traceIndex-e[0].traceIndex)}));for(;!r&&u<=d;){for(u++,r=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(l=m.length-1;l>=0;l--)m[l].dp+=a;for(v.push.apply(v,m),p.splice(o+1,1),c=0,l=v.length-1;l>=0;l--)c+=v[l].dp;for(i=c/v.length,l=v.length-1;l>=0;l--)v[l].dp-=i;r=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(l=b.length-1;l>=0;l--){var _=b[l],w=_.datum;w.offset=_.dp,w.del=_.del}}}(Se,Me?"xa":"ya",s),D(Se,Me,s._invScaleX,s._invScaleY));if(t.target&&t.target.tagName){var Ce=v.getComponentMethod("annotations","hasClickToShow")(e,_e);f(r.select(t.target),Ce?"pointer":"")}if(!t.target||i||!function(e,t,n){if(!n||n.length!==e._hoverdata.length)return!0;for(var r=n.length-1;r>=0;r--){var a=n[r],i=e._hoverdata[r];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(e,0,be))return;be&&e.emit("plotly_unhover",{event:t,points:be});e.emit("plotly_hover",{event:t,points:e._hoverdata,xaxes:b,yaxes:_,xvals:C,yvals:O})}(e,t,n,i)}))},n.loneHover=function(e,t){var n=!0;Array.isArray(e)||(n=!1,e=[e]);var a=e.map((function(e){return{color:e.color||p.defaultLine,x0:e.x0||e.x||0,x1:e.x1||e.x||0,y0:e.y0||e.y||0,y1:e.y1||e.y||0,xLabel:e.xLabel,yLabel:e.yLabel,zLabel:e.zLabel,text:e.text,name:e.name,idealAlign:e.idealAlign,borderColor:e.borderColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontColor:e.fontColor,nameLength:e.nameLength,textAlign:e.textAlign,trace:e.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:e.hovertemplate||!1,eventData:e.eventData||!1,hovertemplateLabels:e.hovertemplateLabels||!1}})),i=r.select(t.container),o=t.outerContainer?r.select(t.outerContainer):i,l={hovermode:"closest",rotateLabels:!1,bgColor:t.bgColor||p.background,container:i,outerContainer:o},s=P(a,l,t.gd),c=0,u=0;s.sort((function(e,t){return e.y0-t.y0})).each((function(e,n){var r=e.y0-e.by/2;e.offset=r-5([\s\S]*)<\/extra>/;function P(e,t,n){var a=n._fullLayout,i=t.hovermode,c=t.rotateLabels,f=t.bgColor,h=t.container,g=t.outerContainer,v=t.commonLabelOpts||{},w=t.fontFamily||y.HOVERFONT,k=t.fontSize||y.HOVERFONTSIZE,T=e[0],M=T.xa,C=T.ya,P="y"===i.charAt(0)?"yLabel":"xLabel",D=T[P],R=(String(D)||"").split(" ")[0],E=g.node().getBoundingClientRect(),z=E.top,I=E.width,F=E.height,N=void 0!==D&&T.distance<=t.hoverdistance&&("x"===i||"y"===i);if(N){var j,B,H=!0;for(j=0;ja.width-S?(y=a.width-S,s.attr("d","M"+(S-A)+",0L"+S+","+_+A+"v"+_+(2*L+b.height)+"H-"+S+"V"+_+A+"H"+(S-2*A)+"Z")):s.attr("d","M0,0L"+A+","+_+A+"H"+(L+b.width/2)+"v"+_+(2*L+b.height)+"H-"+(L+b.width/2)+"V"+_+A+"H-"+A+"Z")}else{var P,O,R;"right"===C.side?(P="start",O=1,R="",y=M._offset+M._length):(P="end",O=-1,R="-",y=M._offset),x=C._offset+(T.y0+T.y1)/2,c.attr("text-anchor",P),s.attr("d","M0,0L"+R+A+","+A+"V"+(L+b.height/2)+"h"+R+(2*L+b.width)+"V-"+(L+b.height/2)+"H"+R+A+"V-"+A+"Z");var E,I=b.height/2,F=z-b.top-I,N="clip"+a._uid+"commonlabel"+C._id;if(y=0?te-=ae:te+=2*L;var ie=re.height+2*L,oe=ee+ie>=F;return ie<=F&&(ee<=z?ee=C._offset+2*L:oe&&(ee=F-ie)),ne.attr("transform",l(te,ee)),ne}var le=h.selectAll("g.hovertext").data(e,(function(e){return S(e)}));return le.enter().append("g").classed("hovertext",!0).each((function(){var e=r.select(this);e.append("rect").call(p.fill,p.addOpacity(f,.8)),e.append("text").classed("name",!0),e.append("path").style("stroke-width","1px"),e.append("text").classed("nums",!0).call(d.font,w,k)})),le.exit().remove(),le.each((function(e){var t=r.select(this).attr("transform",""),o=e.color;Array.isArray(o)&&(o=o[e.eventData[0].pointNumber]);var h=e.bgcolor||o,g=p.combine(p.opacity(h)?h:p.defaultLine,f),v=p.combine(p.opacity(o)?o:p.defaultLine,f),m=e.borderColor||p.contrast(g),y=O(e,N,i,a,D,t),x=y[0],b=y[1],T=t.select("text.nums").call(d.font,e.fontFamily||w,e.fontSize||k,e.fontColor||m).text(x).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,n),M=t.select("text.name"),S=0,C=0;if(b&&b!==x){M.call(d.font,e.fontFamily||w,e.fontSize||k,v).text(b).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,n);var P=M.node().getBoundingClientRect();S=P.width+2*L,C=P.height+2*L}else M.remove(),t.select("rect").remove();t.select("path").style({fill:g,stroke:m});var R,E,j=T.node().getBoundingClientRect(),B=e.xa._offset+(e.x0+e.x1)/2,H=e.ya._offset+(e.y0+e.y1)/2,U=Math.abs(e.x1-e.x0),q=Math.abs(e.y1-e.y0),V=j.width+A+L+S;if(e.ty0=z-j.top,e.bx=j.width+2*L,e.by=Math.max(j.height+2*L,C),e.anchor="start",e.txwidth=j.width,e.tx2width=S,e.offset=0,c)e.pos=B,R=H+q/2+V<=F,E=H-q/2-V>=0,"top"!==e.idealAlign&&R||!E?R?(H+=q/2,e.anchor="start"):e.anchor="middle":(H-=q/2,e.anchor="end");else if(e.pos=H,R=B+U/2+V<=I,E=B-U/2-V>=0,"left"!==e.idealAlign&&R||!E)if(R)B+=U/2,e.anchor="start";else{e.anchor="middle";var G=V/2,Z=B+G-I,Y=B-G;Z>0&&(B-=Z),Y<0&&(B+=-Y)}else B-=U/2,e.anchor="end";T.attr("text-anchor",e.anchor),S&&M.attr("text-anchor",e.anchor),t.attr("transform",l(B,H)+(c?s(_):""))})),le}function O(e,t,n,r,a,i){var l="",s="";void 0!==e.nameOverride&&(e.name=e.nameOverride),e.name&&(e.trace._meta&&(e.name=o.templateString(e.name,e.trace._meta)),l=I(e.name,e.nameLength)),void 0!==e.zLabel?(void 0!==e.xLabel&&(s+="x: "+e.xLabel+"
"),void 0!==e.yLabel&&(s+="y: "+e.yLabel+"
"),"choropleth"!==e.trace.type&&"choroplethmapbox"!==e.trace.type&&(s+=(s?"z: ":"")+e.zLabel)):t&&e[n.charAt(0)+"Label"]===a?s=e[("x"===n.charAt(0)?"y":"x")+"Label"]||"":void 0===e.xLabel?void 0!==e.yLabel&&"scattercarpet"!==e.trace.type&&(s=e.yLabel):s=void 0===e.yLabel?e.xLabel:"("+e.xLabel+", "+e.yLabel+")",!e.text&&0!==e.text||Array.isArray(e.text)||(s+=(s?"
":"")+e.text),void 0!==e.extraText&&(s+=(s?"
":"")+e.extraText),i&&""===s&&!e.hovertemplate&&(""===l&&i.remove(),s=l);var c=r._d3locale,u=e.hovertemplate||!1,f=e.hovertemplateLabels||e,d=e.eventData[0]||{};return u&&(s=(s=o.hovertemplateString(u,f,c,d,e.trace._meta)).replace(C,(function(t,n){return l=I(n,e.nameLength),""}))),[s,l]}function D(e,t,n,a){var i=function(e){return e*n},o=function(e){return e*a};e.each((function(e){var n=r.select(this);if(e.del)return n.remove();var a=n.select("text.nums"),l=e.anchor,s="end"===l?-1:1,c={start:1,end:-1,middle:0}[l],f=c*(A+L),p=f+c*(e.txwidth+L),h=0,g=e.offset,v="middle"===l;v&&(f-=e.tx2width/2,p+=e.txwidth/2+L),t&&(g*=-M,h=e.offset*T),n.select("path").attr("d",v?"M-"+i(e.bx/2+e.tx2width/2)+","+o(g-e.by/2)+"h"+i(e.bx)+"v"+o(e.by)+"h-"+i(e.bx)+"Z":"M0,0L"+i(s*A+h)+","+o(A+g)+"v"+o(e.by/2-A)+"h"+i(s*e.bx)+"v-"+o(e.by)+"H"+i(s*A+h)+"V"+o(g-A)+"Z");var m=h+f,y=g+e.ty0-e.by/2+L,x=e.textAlign||"auto";"auto"!==x&&("left"===x&&"start"!==l?(a.attr("text-anchor","start"),m=v?-e.bx/2-e.tx2width/2+L:-e.bx-L):"right"===x&&"end"!==l&&(a.attr("text-anchor","end"),m=v?e.bx/2-e.tx2width/2-L:e.bx+L)),a.call(u.positionText,i(m),o(y)),e.tx2width&&(n.select("text.name").call(u.positionText,i(p+c*L+h),o(g+e.ty0-e.by/2+L)),n.select("rect").call(d.setRect,i(p+(c-1)*e.tx2width/2+h),o(g-e.by/2-1),i(e.tx2width),o(e.by+2)))}))}function R(e,t){var n=e.index,r=e.trace||{},i=e.cd[0],l=e.cd[n]||{};function s(e){return e||a(e)&&0===e}var c=Array.isArray(n)?function(e,t){var a=o.castOption(i,n,e);return s(a)?a:o.extractOption({},r,"",t)}:function(e,t){return o.extractOption(l,r,e,t)};function u(t,n,r){var a=c(n,r);s(a)&&(e[t]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),e.posref="y"===t||"closest"===t&&"h"===r.orientation?e.xa._offset+(e.x0+e.x1)/2:e.ya._offset+(e.y0+e.y1)/2,e.x0=o.constrain(e.x0,0,e.xa._length),e.x1=o.constrain(e.x1,0,e.xa._length),e.y0=o.constrain(e.y0,0,e.ya._length),e.y1=o.constrain(e.y1,0,e.ya._length),void 0!==e.xLabelVal&&(e.xLabel="xLabel"in e?e.xLabel:g.hoverLabelText(e.xa,e.xLabelVal),e.xVal=e.xa.c2d(e.xLabelVal)),void 0!==e.yLabelVal&&(e.yLabel="yLabel"in e?e.yLabel:g.hoverLabelText(e.ya,e.yLabelVal),e.yVal=e.ya.c2d(e.yLabelVal)),void 0!==e.zLabelVal&&void 0===e.zLabel&&(e.zLabel=String(e.zLabelVal)),!(isNaN(e.xerr)||"log"===e.xa.type&&e.xerr<=0)){var f=g.tickText(e.xa,e.xa.c2l(e.xerr),"hover").text;void 0!==e.xerrneg?e.xLabel+=" +"+f+" / -"+g.tickText(e.xa,e.xa.c2l(e.xerrneg),"hover").text:e.xLabel+=" \xb1 "+f,"x"===t&&(e.distance+=1)}if(!(isNaN(e.yerr)||"log"===e.ya.type&&e.yerr<=0)){var d=g.tickText(e.ya,e.ya.c2l(e.yerr),"hover").text;void 0!==e.yerrneg?e.yLabel+=" +"+d+" / -"+g.tickText(e.ya,e.ya.c2l(e.yerrneg),"hover").text:e.yLabel+=" \xb1 "+d,"y"===t&&(e.distance+=1)}var p=e.hoverinfo||e.trace.hoverinfo;return p&&"all"!==p&&(-1===(p=Array.isArray(p)?p:p.split("+")).indexOf("x")&&(e.xLabel=void 0),-1===p.indexOf("y")&&(e.yLabel=void 0),-1===p.indexOf("z")&&(e.zLabel=void 0),-1===p.indexOf("text")&&(e.text=void 0),-1===p.indexOf("name")&&(e.name=void 0)),e}function E(e,t,n){var r,a,o=n.container,l=n.fullLayout,s=l._size,c=n.event,u=!!t.hLinePoint,f=!!t.vLinePoint;if(o.selectAll(".spikeline").remove(),f||u){var h=p.combine(l.plot_bgcolor,l.paper_bgcolor);if(u){var v,m,y=t.hLinePoint;r=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=c.pointerX,m=c.pointerY):(v=r._offset+y.x,m=a._offset+y.y);var x,b,_=i.readability(y.color,h)<1.5?p.contrast(h):y.color,w=a.spikemode,k=a.spikethickness,T=a.spikecolor||_,M=g.getPxPosition(e,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=v),-1!==w.indexOf("across")){var A=a._counterDomainMin,L=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),L=Math.max(L,a.position)),x=s.l+A*s.w,b=s.l+L*s.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":k,stroke:T,"stroke-dasharray":d.dashStyle(a.spikedash,k)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:m,y2:m,"stroke-width":k+2,stroke:h}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?k:-k),cy:m,r:k,fill:T}).classed("spikeline",!0)}if(f){var S,C,P=t.vLinePoint;r=P&&P.xa,a=P&&P.ya,"cursor"===r.spikesnap?(S=c.pointerX,C=c.pointerY):(S=r._offset+P.x,C=a._offset+P.y);var O,D,R=i.readability(P.color,h)<1.5?p.contrast(h):P.color,E=r.spikemode,z=r.spikethickness,I=r.spikecolor||R,F=g.getPxPosition(e,r);if(-1!==E.indexOf("toaxis")||-1!==E.indexOf("across")){if(-1!==E.indexOf("toaxis")&&(O=F,D=C),-1!==E.indexOf("across")){var N=r._counterDomainMin,j=r._counterDomainMax;"free"===r.anchor&&(N=Math.min(N,r.position),j=Math.max(j,r.position)),O=s.t+(1-j)*s.h,D=s.t+(1-N)*s.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:O,y2:D,"stroke-width":z,stroke:I,"stroke-dasharray":d.dashStyle(r.spikedash,z)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:O,y2:D,"stroke-width":z+2,stroke:h}).classed("spikeline",!0).classed("crisp",!0)}-1!==E.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:F-("top"!==r.side?z:-z),r:z,fill:I}).classed("spikeline",!0)}}}function z(e,t){return!t||(t.vLinePoint!==e._spikepoints.vLinePoint||t.hLinePoint!==e._spikepoints.hLinePoint)}function I(e,t){return u.plainText(e||"",{len:t,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":210,"../../lib/events":201,"../../lib/override_cursor":221,"../../lib/svg_text_utils":231,"../../plots/cartesian/axes":256,"../../registry":306,"../color":81,"../dragelement":100,"../drawing":103,"../legend/defaults":133,"../legend/draw":134,"./constants":115,"./helpers":117,d3:15,"fast-isnumeric":17,tinycolor2:63}],119:[function(e,t,n){"use strict";var r=e("../../lib"),a=e("../color"),i=e("./helpers").isUnifiedHover;t.exports=function(e,t,n,o){function l(e){o.font[e]||(o.font[e]=t.legend?t.legend.font[e]:t.font[e])}o=o||{},t&&i(t.hovermode)&&(o.font||(o.font={}),l("size"),l("family"),l("color"),t.legend?(o.bgcolor||(o.bgcolor=a.combine(t.legend.bgcolor,t.paper_bgcolor)),o.bordercolor||(o.bordercolor=t.legend.bordercolor)):o.bgcolor||(o.bgcolor=t.paper_bgcolor)),n("hoverlabel.bgcolor",o.bgcolor),n("hoverlabel.bordercolor",o.bordercolor),n("hoverlabel.namelength",o.namelength),r.coerceFont(n,"hoverlabel.font",o.font),n("hoverlabel.align",o.align)}},{"../../lib":210,"../color":81,"./helpers":117}],120:[function(e,t,n){"use strict";var r=e("../../lib"),a=e("./layout_attributes");t.exports=function(e,t,n){function i(n,i){return void 0!==t[n]?t[n]:r.coerce(e,t,a,n,i)}var o,l=i("clickmode");return t._has("cartesian")?l.indexOf("select")>-1?o="closest":(t._isHoriz=function(e,t){for(var n=t._scatterStackOpts||{},r=0;r1){if(!d&&!p&&!h)"independent"===T("pattern")&&(d=!0);v._hasSubplotGrid=d;var x,b,_="top to bottom"===T("roworder"),w=d?.2:.1,k=d?.3:.1;g&&t._splomGridDflt&&(x=t._splomGridDflt.xside,b=t._splomGridDflt.yside),v._domains={x:u("x",T,w,x,y),y:u("y",T,k,b,m,_)}}else delete t.grid}function T(e,t){return r.coerce(n,v,s,e,t)}},contentDefaults:function(e,t){var n=t.grid;if(n&&n._domains){var r,a,i,o,l,s,u,d=e.grid||{},p=t._subplots,h=n._hasSubplotGrid,g=n.rows,v=n.columns,m="independent"===n.pattern,y=n._axisMap={};if(h){var x=d.subplots||[];s=n.subplots=new Array(g);var b=1;for(r=0;r1);if(!1!==g||c.uirevision){var v=i.newContainer(t,"legend");if(_("uirevision",t.uirevision),!1!==g){_("bgcolor",t.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",t.font);var m,y,x,b=_("orientation");"h"===b?(m=0,r.getComponentMethod("rangeslider","isVisible")(e.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(m=1.02,y=1,x="auto"),_("traceorder",d),s.isGrouped(t.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemwidth"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,v,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",t.font))}}function _(e,t){return a.coerce(c,v,o,e,t)}}},{"../../lib":210,"../../plot_api/plot_template":245,"../../plots/layout_attributes":295,"../../registry":306,"./attributes":131,"./helpers":137}],134:[function(e,t,n){"use strict";var r=e("d3"),a=e("../../lib"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib/events"),s=e("../dragelement"),c=e("../drawing"),u=e("../color"),f=e("../../lib/svg_text_utils"),d=e("./handle_click"),p=e("./constants"),h=e("../../constants/alignment"),g=h.LINE_SPACING,v=h.FROM_TL,m=h.FROM_BR,y=e("./get_legend_data"),x=e("./style"),b=e("./helpers");function _(e,t,n,r,a){var i=n.data()[0][0].trace,s={event:a,node:n.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:e.data,layout:e.layout,frames:e._transitionData._frames,config:e._context,fullData:e._fullData,fullLayout:e._fullLayout};if(i._group&&(s.group=i._group),o.traceIs(i,"pie-like")&&(s.label=n.datum()[0].label),!1!==l.triggerHandler(e,"plotly_legendclick",s))if(1===r)t._clickTimeout=setTimeout((function(){d(n,e,r)}),e._context.doubleClickDelay);else if(2===r){t._clickTimeout&&clearTimeout(t._clickTimeout),e._legendMouseDownTime=0,!1!==l.triggerHandler(e,"plotly_legenddoubleclick",s)&&d(n,e,r)}}function w(e,t,n){var r,i=e.data()[0][0],l=i.trace,s=o.traceIs(l,"pie-like"),u=l.index,d=n._main&&t._context.edits.legendText&&!s,h=n._maxNameLength;n.entries?r=i.text:(r=s?i.label:l.name,l._meta&&(r=a.templateString(r,l._meta)));var g=a.ensureSingle(e,"text","legendtext");g.attr("text-anchor","start").call(c.font,n.font).text(d?k(r,h):r);var v=n.itemwidth+2*p.itemGap;f.positionText(g,v,0),d?g.call(f.makeEditable,{gd:t,text:r}).call(M,e,t,n).on("edit",(function(r){this.text(k(r,h)).call(M,e,t,n);var l=i.trace._fullInput||{},s={};if(o.hasTransform(l,"groupby")){var c=o.getTransformIndices(l,"groupby"),f=c[c.length-1],d=a.keyedContainer(l,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,r),s=d.constructUpdate()}else s.name=r;return o.call("_guiRestyle",t,s,u)})):M(g,e,t,n)}function k(e,t){var n=Math.max(4,t);if(e&&e.trim().length>=n/2)return e;for(var r=n-(e=e||"").length;r>0;r--)e+=" ";return e}function T(e,t){var n,i=t._context.doubleClickDelay,o=1,l=a.ensureSingle(e,"rect","legendtoggle",(function(e){t._context.staticPlot||e.style("cursor","pointer").attr("pointer-events","all"),e.call(u.fill,"rgba(0,0,0,0)")}));t._context.staticPlot||(l.on("mousedown",(function(){(n=(new Date).getTime())-t._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(t,n,e,o,r.event)}})))}function M(e,t,n,r){r._main||e.attr("data-notex",!0),f.convertToTspans(e,n,(function(){!function(e,t,n){var r=e.data()[0][0];if(n._main&&r&&!r.trace.showlegend)return void e.remove();var a=e.select("g[class*=math-group]"),i=a.node();n||(n=t._fullLayout.legend);var o,l,s=n.borderwidth,u=(r?n:n.title).font.size*g;if(i){var d=c.bBox(i);o=d.height,l=d.width,r?c.setTranslate(a,0,.25*o):c.setTranslate(a,s,.75*o+s)}else{var h=e.select(r?".legendtext":".legendtitletext"),v=f.lineCount(h),m=h.node();o=u*v,l=m?c.bBox(m).width:0;var y=u*((v-1)/2-.3);if(r){var x=n.itemwidth+2*p.itemGap;f.positionText(h,x,-y)}else f.positionText(h,p.titlePad+s,u+s)}r?(r.lineHeight=u,r.height=Math.max(o,16)+3,r.width=l):(n._titleWidth=l,n._titleHeight=o)}(t,n,r)}))}function A(e){return a.isRightAnchor(e)?"right":a.isCenterAnchor(e)?"center":"left"}function L(e){return a.isBottomAnchor(e)?"bottom":a.isMiddleAnchor(e)?"middle":"top"}t.exports=function(e,t){var n,l=e._fullLayout,f="legend"+l._uid;if(t?(n=t.layer,f+="-hover"):((t=l.legend||{})._main=!0,n=l._infolayer),n){var d;if(e._legendMouseDownTime||(e._legendMouseDownTime=0),t._main){if(!e.calcdata)return;d=l.showlegend&&y(e.calcdata,t)}else{if(!t.entries)return;d=y(t.entries,t)}var h=l.hiddenlabels||[];if(t._main&&(!l.showlegend||!d.length))return n.selectAll(".legend").remove(),l._topdefs.select("#"+f).remove(),i.autoMargin(e,"legend");var g=a.ensureSingle(n,"g","legend",(function(e){t._main&&e.attr("pointer-events","all")})),k=a.ensureSingleById(l._topdefs,"clipPath",f,(function(e){e.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(e){e.attr("shape-rendering","crispEdges")}));S.call(u.stroke,t.bordercolor).call(u.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),P=t.title;if(t._titleWidth=0,t._titleHeight=0,P.text){var O=a.ensureSingle(C,"text","legendtitletext");O.attr("text-anchor","start").call(c.font,P.font).text(P.text),M(O,C,e,t)}else C.selectAll(".legendtitletext").remove();var D=a.ensureSingle(g,"rect","scrollbar",(function(e){e.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),R=C.selectAll("g.groups").data(d);R.enter().append("g").attr("class","groups"),R.exit().remove();var E=R.selectAll("g.traces").data(a.identity);E.enter().append("g").attr("class","traces"),E.exit().remove(),E.style("opacity",(function(e){var t=e[0].trace;return o.traceIs(t,"pie-like")?-1!==h.indexOf(e[0].label)?.5:1:"legendonly"===t.visible?.5:1})).each((function(){r.select(this).call(w,e,t)})).call(x,e,t).each((function(){t._main&&r.select(this).call(T,e)})),a.syncOrAsync([i.previousPromises,function(){return function(e,t,n,a){var i=e._fullLayout;a||(a=i.legend);var o=i._size,l=b.isVertical(a),s=b.isGrouped(a),u=a.borderwidth,f=2*u,d=p.itemGap,h=a.itemwidth+2*d,g=2*(u+d),v=L(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(e){var t=0,n=0,r=e.title.side;r&&(-1!==r.indexOf("left")&&(t=e._titleWidth),-1!==r.indexOf("top")&&(n=e._titleHeight));return[t,n]}(a);if(l)n.each((function(e){var t=e[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+t/2+d),a._height+=t,a._width=Math.max(a._width,e[0].width)})),x=h+a._width,a._width+=d+h+f,a._height+=g,s&&(t.each((function(e,t){c.setTranslate(this,0,t*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),k=a.x<0||0===a.x&&"right"===w,T=a.x>1||1===a.x&&"left"===w,M=y||m,S=i.width/2;a._maxWidth=Math.max(k?M&&"left"===w?o.l+o.w:S:T?M&&"right"===w?o.r+o.w:S:o.w,2*h);var C=0,P=0;n.each((function(e){var t=e[0].width+h;C=Math.max(C,t),P+=t})),x=null;var O=0;if(s){var D=0,R=0,E=0;t.each((function(){var e=0,t=0;r.select(this).selectAll("g.traces").each((function(n){var r=n[0].height;c.setTranslate(this,_[0],_[1]+u+d+r/2+t),t+=r,e=Math.max(e,h+n[0].width)})),D=Math.max(D,t);var n=e+d;n+u+R>a._maxWidth&&(O=Math.max(O,R),R=0,E+=D+a.tracegroupgap,D=t),c.setTranslate(this,R,E),R+=n})),a._width=Math.max(O,R)+u,a._height=E+D+g}else{var z=n.size(),I=P+f+(z-1)*d=a._maxWidth&&(O=Math.max(O,B),N=0,j+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+N,_[1]+u+j+t/2+d),B=N+n+d,N+=r,F=Math.max(F,t)})),I?(a._width=N+f,a._height=F+g):(a._width=Math.max(O,B)+f,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var H=e._context.edits,U=H.legendText||H.legendPosition;n.each((function(e){var t=r.select(this).select(".legendtoggle"),n=e[0].height,a=U?h:x||h+e[0].width;l||(a+=d/2),c.setRect(t,0,-n/2,a,n)}))}(e,R,E,t)},function(){if(!t._main||!function(e){var t=e._fullLayout.legend,n=A(t),r=L(t);return i.autoMargin(e,"legend",{x:t.x,y:t.y,l:t._width*v[n],r:t._width*m[n],b:t._effHeight*m[r],t:t._effHeight*v[r]})}(e)){var u,d,h,y,x=l._size,b=t.borderwidth,w=x.l+x.w*t.x-v[A(t)]*t._width,T=x.t+x.h*(1-t.y)-v[L(t)]*t._effHeight;if(t._main&&l.margin.autoexpand){var M=w,P=T;w=a.constrain(w,0,l.width-t._width),T=a.constrain(T,0,l.height-t._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),T!==P&&a.log("Constrain legend.y to make legend fit inside graph")}if(t._main&&c.setTranslate(g,w,T),D.on(".drag",null),g.on("wheel",null),!t._main||t._height<=t._maxHeight||e._context.staticPlot){var O=t._effHeight;t._main||(O=t._height),S.attr({width:t._width-b,height:O-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),k.select("rect").attr({width:t._width-2*b,height:O-2*b,x:b,y:b}),c.setClipUrl(C,f,e),c.setRect(D,0,0,0,0),delete t._scrollY}else{var R,E,z,I=Math.max(p.scrollBarMinHeight,t._effHeight*t._effHeight/t._height),F=t._effHeight-I-2*p.scrollBarMargin,N=t._height-t._effHeight,j=F/N,B=Math.min(t._scrollY||0,N);S.attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-b,x:b/2,y:b/2}),k.select("rect").attr({width:t._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:t._effHeight-2*b,x:b,y:b+B}),c.setClipUrl(C,f,e),q(B,I,j),g.on("wheel",(function(){q(B=a.constrain(t._scrollY+r.event.deltaY/F*N,0,N),I,j),0!==B&&B!==N&&r.event.preventDefault()}));var H=r.behavior.drag().on("dragstart",(function(){var e=r.event.sourceEvent;R="touchstart"===e.type?e.changedTouches[0].clientY:e.clientY,z=B})).on("drag",(function(){var e=r.event.sourceEvent;2===e.buttons||e.ctrlKey||(E="touchmove"===e.type?e.changedTouches[0].clientY:e.clientY,q(B=function(e,t,n){var r=(n-t)/j+e;return a.constrain(r,0,N)}(z,R,E),I,j))}));D.call(H);var U=r.behavior.drag().on("dragstart",(function(){var e=r.event.sourceEvent;"touchstart"===e.type&&(R=e.changedTouches[0].clientY,z=B)})).on("drag",(function(){var e=r.event.sourceEvent;"touchmove"===e.type&&(E=e.changedTouches[0].clientY,q(B=function(e,t,n){var r=(t-n)/j+e;return a.constrain(r,0,N)}(z,R,E),I,j))}));C.call(U)}if(e._context.edits.legendPosition)g.classed("cursor-move",!0),s.init({element:g.node(),gd:e,prepFn:function(){var e=c.getTranslate(g);h=e.x,y=e.y},moveFn:function(e,n){var r=h+e,a=y+n;c.setTranslate(g,r,a),u=s.align(r,0,x.l,x.l+x.w,t.xanchor),d=s.align(a,0,x.t+x.h,x.t,t.yanchor)},doneFn:function(){void 0!==u&&void 0!==d&&o.call("_guiRelayout",e,{"legend.x":u,"legend.y":d})},clickFn:function(t,r){var a=n.selectAll("g.traces").filter((function(){var e=this.getBoundingClientRect();return r.clientX>=e.left&&r.clientX<=e.right&&r.clientY>=e.top&&r.clientY<=e.bottom}));a.size()>0&&_(e,g,a,t,r)}})}function q(n,r,a){t._scrollY=e._fullLayout.legend._scrollY=n,c.setTranslate(C,0,-n),c.setRect(D,t._width,p.scrollBarMargin+n*a,p.scrollBarWidth,r),k.select("rect").attr("y",b+n)}}],e)}}},{"../../constants/alignment":183,"../../lib":210,"../../lib/events":201,"../../lib/svg_text_utils":231,"../../plots/plots":297,"../../registry":306,"../color":81,"../dragelement":100,"../drawing":103,"./constants":132,"./get_legend_data":135,"./handle_click":136,"./helpers":137,"./style":139,d3:15}],135:[function(e,t,n){"use strict";var r=e("../../registry"),a=e("./helpers");t.exports=function(e,t){var n,i,o={},l=[],s=!1,c={},u=0,f=0,d=t._main;function p(e,n){if(""!==e&&a.isGrouped(t))-1===l.indexOf(e)?(l.push(e),s=!0,o[e]=[[n]]):o[e].push([n]);else{var r="~~i"+u;l.push(r),o[r]=[[n]],u++}}for(n=0;n0))return 0;a=t.width}return v?r:Math.min(a,n)};function _(e,t,n){var i=e[0].trace,o=i.marker||{},l=o.line||{},c=n?i.visible&&i.type===n:a.traceIs(i,"bar"),u=r.select(t).select("g.legendpoints").selectAll("path.legend"+n).data(c?[e]:[]);u.enter().append("path").classed("legend"+n,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),u.exit().remove(),u.each((function(e){var t=r.select(this),n=e[0],a=b(n.mlw,o.line,5,2);t.style("stroke-width",a+"px").call(s.fill,n.mc||o.color),a&&s.stroke(t,n.mlc||l.color)}))}function w(e,t,n){var o=e[0],l=o.trace,s=n?l.visible&&l.type===n:a.traceIs(l,n),c=r.select(t).select("g.legendpoints").selectAll("path.legend"+n).data(s?[e]:[]);if(c.enter().append("path").classed("legend"+n,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),c.exit().remove(),c.size()){var u=(l.marker||{}).line,p=b(d(u.width,o.pts),u,5,2),h=i.minExtend(l,{marker:{line:{width:p}}});h.marker.line.color=u.color;var g=i.minExtend(o,{trace:h});f(c,g,h)}}e.each((function(e){var t=r.select(this),a=i.ensureSingle(t,"g","layers");a.style("opacity",e[0].trace.opacity);var l=n.valign,s=e[0].lineHeight,c=e[0].height;if("middle"!==l&&s&&c){var u={top:1,bottom:-1}[l]*(.5*(s-c+3));a.attr("transform",o(0,u))}else a.attr("transform",null);a.selectAll("g.legendfill").data([e]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([e]).enter().append("g").classed("legendlines",!0);var f=a.selectAll("g.legendsymbols").data([e]);f.enter().append("g").classed("legendsymbols",!0),f.selectAll("g.legendpoints").data([e]).enter().append("g").classed("legendpoints",!0)})).each((function(e){var n,a=e[0].trace,o=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":o=[["M-15,-2V4H15V-2Z"]],n=!0;break;case"choropleth":case"choroplethmapbox":o=[["M-6,-6V6H6V-6Z"]],n=!0;break;case"densitymapbox":o=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],n="radial";break;case"cone":o=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],n=!1;break;case"streamtube":o=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],n=!1;break;case"surface":o=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],n=!0;break;case"mesh3d":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],n=!1;break;case"volume":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],n=!0;break;case"isosurface":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],n=!1}var u=r.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(o);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform",x).style("stroke-miterlimit",1),u.exit().remove(),u.each((function(e,o){var u,f=r.select(this),d=c(a),p=d.colorscale,g=d.reversescale;if(p){if(!n){var v=p.length;u=0===o?p[g?v-1:0][1]:1===o?p[g?0:v-1][1]:p[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(m)?m[o]||m[0]:m}f.attr("d",e[0]),u?f.call(s.fill,u):f.call((function(e){if(e.size()){var r="legendfill-"+a.uid;l.gradient(e,t,r,h(g,"radial"===n),p,"fill")}}))}))})).each((function(e){var t=e[0].trace,n="waterfall"===t.type;if(e[0]._distinct&&n){var a=e[0].trace[e[0].dir].marker;return e[0].mc=a.color,e[0].mlw=a.line.width,e[0].mlc=a.line.color,_(e,this,"waterfall")}var i=[];t.visible&&n&&(i=e[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=r.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform",x).style("stroke-miterlimit",1),o.exit().remove(),o.each((function(e){var n=r.select(this),a=t[e[0]].marker,i=b(void 0,a.line,5,2);n.attr("d",e[1]).style("stroke-width",i+"px").call(s.fill,a.color),i&&n.call(s.stroke,a.line.color)}))})).each((function(e){_(e,this,"funnel")})).each((function(e){_(e,this)})).each((function(e){var n=e[0].trace,o=r.select(this).select("g.legendpoints").selectAll("path.legendbox").data(n.visible&&a.traceIs(n,"box-violin")?[e]:[]);o.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),o.exit().remove(),o.each((function(){var e=r.select(this);if("all"!==n.boxpoints&&"all"!==n.points||0!==s.opacity(n.fillcolor)||0!==s.opacity((n.line||{}).color)){var a=b(void 0,n.line,5,2);e.style("stroke-width",a+"px").call(s.fill,n.fillcolor),a&&s.stroke(e,n.line.color)}else{var c=i.minExtend(n,{marker:{size:v?12:i.constrain(n.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});o.call(l.pointStyle,c,t)}}))})).each((function(e){w(e,this,"funnelarea")})).each((function(e){w(e,this,"pie")})).each((function(e){var n,a,o=e[0],s=o.trace,f=s.visible&&s.fill&&"none"!==s.fill,d=u.hasLines(s),p=s.contours,g=!1,v=!1,y=c(s),x=y.colorscale,_=y.reversescale;if(p){var w=p.coloring;"lines"===w?g=!0:d="none"===w||"heatmap"===w||p.showlines,"constraint"===p.type?f="="!==p._operation:"fill"!==w&&"heatmap"!==w||(v=!0)}var k=u.hasMarkers(s)||u.hasText(s),T=f||v,M=d||g,A=k||!T?"M5,0":M?"M5,-2":"M5,-3",L=r.select(this),S=L.select(".legendfill").selectAll("path").data(f||v?[e]:[]);if(S.enter().append("path").classed("js-fill",!0),S.exit().remove(),S.attr("d",A+"h"+m+"v6h-"+m+"z").call(f?l.fillGroupStyle:function(e){if(e.size()){var n="legendfill-"+s.uid;l.gradient(e,t,n,h(_),x,"fill")}}),d||g){var C=b(void 0,s.line,10,5);a=i.minExtend(s,{line:{width:C}}),n=[i.minExtend(o,{trace:a})]}var P=L.select(".legendlines").selectAll("path").data(d||g?[n]:[]);P.enter().append("path").classed("js-line",!0),P.exit().remove(),P.attr("d",A+(g?"l"+m+",0.0001":"h"+m)).call(d?l.lineGroupStyle:function(e){if(e.size()){var n="legendline-"+s.uid;l.lineGroupStyle(e),l.gradient(e,t,n,h(_),x,"stroke")}})})).each((function(e){var n,a,o=e[0],s=o.trace,c=u.hasMarkers(s),f=u.hasText(s),d=u.hasLines(s);function p(e,t,n,r){var a=i.nestedProperty(s,e).get(),o=i.isArrayOrTypedArray(a)&&t?t(a):a;if(v&&o&&void 0!==r&&(o=r),n){if(on[1])return n[1]}return o}function h(e){return o._distinct&&o.index&&e[o.index]?e[o.index]:e[0]}if(c||f||d){var g={},m={};if(c){g.mc=p("marker.color",h),g.mx=p("marker.symbol",h),g.mo=p("marker.opacity",i.mean,[.2,1]),g.mlc=p("marker.line.color",h),g.mlw=p("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);g.ms=y,m.marker.size=y}d&&(m.line={width:p("line.width",h,[0,10],5)}),f&&(g.tx="Aa",g.tp=p("textposition",h),g.ts=10,g.tc=p("textfont.color",h),g.tf=p("textfont.family",h)),n=[i.minExtend(o,g)],(a=i.minExtend(s,m)).selectedpoints=null,a.texttemplate=null}var b=r.select(this).select("g.legendpoints"),_=b.selectAll("path.scatterpts").data(c?n:[]);_.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",x),_.exit().remove(),_.call(l.pointStyle,a,t),c&&(n[0].mrc=3);var w=b.selectAll("g.pointtext").data(f?n:[]);w.enter().append("g").classed("pointtext",!0).append("text").attr("transform",x),w.exit().remove(),w.selectAll("text").call(l.textPointStyle,a,t)})).each((function(e){var t=e[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(t.visible&&"candlestick"===t.type?[e,e]:[]);n.enter().append("path").classed("legendcandle",!0).attr("d",(function(e,t){return t?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"})).attr("transform",x).style("stroke-miterlimit",1),n.exit().remove(),n.each((function(e,n){var a=r.select(this),i=t[n?"increasing":"decreasing"],o=b(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(s.fill,i.fillcolor),o&&s.stroke(a,i.line.color)}))})).each((function(e){var t=e[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(t.visible&&"ohlc"===t.type?[e,e]:[]);n.enter().append("path").classed("legendohlc",!0).attr("d",(function(e,t){return t?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"})).attr("transform",x).style("stroke-miterlimit",1),n.exit().remove(),n.each((function(e,n){var a=r.select(this),i=t[n?"increasing":"decreasing"],o=b(void 0,i.line,5,2);a.style("fill","none").call(l.dashLine,i.line.dash,o),o&&s.stroke(a,i.line.color)}))}))}},{"../../lib":210,"../../registry":306,"../../traces/pie/helpers":325,"../../traces/pie/style_one":326,"../../traces/scatter/subtypes":353,"../color":81,"../colorscale/helpers":92,"../drawing":103,"./constants":132,d3:15}],140:[function(e,t,n){"use strict";var r=e("../../registry"),a=e("../../plots/plots"),i=e("../../plots/cartesian/axis_ids"),o=e("../../fonts/ploticon"),l=e("../shapes/draw").eraseActiveShape,s=e("../../lib"),c=s._,u=t.exports={};function f(e,t){var n,a,o=t.currentTarget,l=o.getAttribute("data-attr"),s=o.getAttribute("data-val")||!0,c=e._fullLayout,u={},f=i.list(e,null,!0),d=c._cartesianSpikesEnabled;if("zoom"===l){var p,h="in"===s?.5:2,g=(1+h)/2,v=(1-h)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):h?(L=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):p?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(L=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(e){for(var t=0;t0)){var g=function(e,t,n){for(var r=n.filter((function(n){return t[n].anchor===e._id})),a=0,i=0;i=r.max)t=F[n+1];else if(e=r.pmax)t=F[n+1];else if(e0?d+c:c;return{ppad:c,ppadplus:u?h:g,ppadminus:u?g:h}}return{ppad:c}}function u(e,t,n,r,a){var l="category"===e.type||"multicategory"===e.type?e.r2c:e.d2c;if(void 0!==t)return[l(t),l(n)];if(r){var s,c,u,f,d=1/0,p=-1/0,h=r.match(i.segmentRE);for("date"===e.type&&(l=o.decodeDate(l)),s=0;sp&&(p=f)));return p>=d?[d,p]:void 0}}t.exports=function(e){var t=e._fullLayout,n=r.filterVisible(t.shapes);if(n.length&&e._fullData.length)for(var o=0;oy?(T=f,S="y0",M=y,C="y1"):(T=y,S="y1",M=f,C="y0");W(r),$(l,n),function(e,t,n){var r=t.xref,a=t.yref,o=i.getFromId(n,r),l=i.getFromId(n,a),s="";"paper"===r||o.autorange||(s+=r);"paper"===a||l.autorange||(s+=a);u.setClipUrl(e,s?"clip"+n._fullLayout._uid+s:null,n)}(t,n,e),X.moveFn="move"===R?J:Q,X.altKey=r.altKey},doneFn:function(){if(m(e))return;p(t),K(l),b(t,e,n),r.call("_guiRelayout",e,s.getUpdateObj())},clickFn:function(){if(m(e))return;K(l)}};function W(n){if(m(e))R=null;else if(I)R="path"===n.target.tagName?"move":"start-point"===n.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var r=X.element.getBoundingClientRect(),a=r.right-r.left,i=r.bottom-r.top,o=n.clientX-r.left,l=n.clientY-r.top,s=!F&&a>10&&i>10&&!n.shiftKey?d.getCursor(o/a,1-l/i):"move";p(t,s),R=s.split("-")[0]}}function J(r,a){if("path"===n.type){var i=function(e){return e},o=i,s=i;E?N("xanchor",n.xanchor=G(x+r)):(o=function(e){return G(q(e)+r)},j&&"date"===j.type&&(o=g.encodeDate(o))),z?N("yanchor",n.yanchor=Z(k+a)):(s=function(e){return Z(V(e)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",n.path=w(D,o,s))}else E?N("xanchor",n.xanchor=G(x+r)):(N("x0",n.x0=G(c+r)),N("x1",n.x1=G(v+r))),z?N("yanchor",n.yanchor=Z(k+a)):(N("y0",n.y0=Z(f+a)),N("y1",n.y1=Z(y+a)));t.attr("d",_(e,n)),$(l,n)}function Q(r,a){if(F){var i=function(e){return e},o=i,s=i;E?N("xanchor",n.xanchor=G(x+r)):(o=function(e){return G(q(e)+r)},j&&"date"===j.type&&(o=g.encodeDate(o))),z?N("yanchor",n.yanchor=Z(k+a)):(s=function(e){return Z(V(e)+a)},H&&"date"===H.type&&(s=g.encodeDate(s))),N("path",n.path=w(D,o,s))}else if(I){if("resize-over-start-point"===R){var u=c+r,d=z?f-a:f+a;N("x0",n.x0=E?u:G(u)),N("y0",n.y0=z?d:Z(d))}else if("resize-over-end-point"===R){var p=v+r,h=z?y-a:y+a;N("x1",n.x1=E?p:G(p)),N("y1",n.y1=z?h:Z(h))}}else{var m=function(e){return-1!==R.indexOf(e)},b=m("n"),B=m("s"),U=m("w"),Y=m("e"),X=b?T+a:T,W=B?M+a:M,J=U?A+r:A,Q=Y?L+r:L;z&&(b&&(X=T-a),B&&(W=M-a)),(!z&&W-X>10||z&&X-W>10)&&(N(S,n[S]=z?X:Z(X)),N(C,n[C]=z?W:Z(W))),Q-J>10&&(N(P,n[P]=E?J:G(J)),N(O,n[O]=E?Q:G(Q)))}t.attr("d",_(e,n)),$(l,n)}function $(e,t){(E||z)&&function(){var n="path"!==t.type,r=e.selectAll(".visual-cue").data([0]);r.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"#000","stroke-width":1}).classed("visual-cue",!0);var i=q(E?t.xanchor:a.midRange(n?[t.x0,t.x1]:g.extractPathCoords(t.path,h.paramIsX))),o=V(z?t.yanchor:a.midRange(n?[t.y0,t.y1]:g.extractPathCoords(t.path,h.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),E&&z){var l="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";r.attr("d",l)}else if(E){var s="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";r.attr("d",s)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";r.attr("d",c)}}()}function K(e){e.selectAll(".visual-cue").remove()}d.init(X),Y.node().onmousemove=W}(e,E,s,t,n,R):!0===s.editable&&E.style("pointer-events",O||c.opacity(L)*A<=.5?"stroke":"all");E.node().addEventListener("click",(function(){return function(e,t){if(!y(e))return;var n=+t.node().getAttribute("data-index");if(n>=0){if(n===e._fullLayout._activeShapeIndex)return void k(e);e._fullLayout._activeShapeIndex=n,e._fullLayout._deactivateShape=k,v(e)}}(e,E)}))}}function b(e,t,n){var r=(n.xref+n.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");u.setClipUrl(e,r?"clip"+t._fullLayout._uid+r:null,t)}function _(e,t){var n,r,o,l,s,c,u,f,d=t.type,p=i.getRefType(t.xref),v=i.getRefType(t.yref),m=i.getFromId(e,t.xref),y=i.getFromId(e,t.yref),x=e._fullLayout._size;if(m?"domain"===p?r=function(e){return m._offset+m._length*e}:(n=g.shapePositionToRange(m),r=function(e){return m._offset+m.r2p(n(e,!0))}):r=function(e){return x.l+x.w*e},y?"domain"===v?l=function(e){return y._offset+y._length*(1-e)}:(o=g.shapePositionToRange(y),l=function(e){return y._offset+y.r2p(o(e,!0))}):l=function(e){return x.t+x.h*(1-e)},"path"===d)return m&&"date"===m.type&&(r=g.decodeDate(r)),y&&"date"===y.type&&(l=g.decodeDate(l)),function(e,t,n){var r=e.path,i=e.xsizemode,o=e.ysizemode,l=e.xanchor,s=e.yanchor;return r.replace(h.segmentRE,(function(e){var r=0,c=e.charAt(0),u=h.paramIsX[c],f=h.paramIsY[c],d=h.numParams[c],p=e.substr(1).replace(h.paramRE,(function(e){return u[r]?e="pixel"===i?t(l)+Number(e):t(e):f[r]&&(e="pixel"===o?n(s)-Number(e):n(e)),++r>d&&(e="X"),e}));return r>d&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+e)),c+p}))}(t,r,l);if("pixel"===t.xsizemode){var b=r(t.xanchor);s=b+t.x0,c=b+t.x1}else s=r(t.x0),c=r(t.x1);if("pixel"===t.ysizemode){var _=l(t.yanchor);u=_-t.y0,f=_-t.y1}else u=l(t.y0),f=l(t.y1);if("line"===d)return"M"+s+","+u+"L"+c+","+f;if("rect"===d)return"M"+s+","+u+"H"+c+"V"+f+"H"+s+"Z";var w=(s+c)/2,k=(u+f)/2,T=Math.abs(w-s),M=Math.abs(k-u),A="A"+T+","+M,L=w+T+","+k;return"M"+L+A+" 0 1,1 "+(w+","+(k-M))+A+" 0 0,1 "+L+"Z"}function w(e,t,n){return e.replace(h.segmentRE,(function(e){var r=0,a=e.charAt(0),i=h.paramIsX[a],o=h.paramIsY[a],l=h.numParams[a];return a+e.substr(1).replace(h.paramRE,(function(e){return r>=l||(i[r]?e=t(e):o[r]&&(e=n(e)),r++),e}))}))}function k(e){y(e)&&(e._fullLayout._activeShapeIndex>=0&&(s(e),delete e._fullLayout._activeShapeIndex,v(e)))}t.exports={draw:v,drawOne:x,eraseActiveShape:function(e){if(!y(e))return;s(e);var t=e._fullLayout._activeShapeIndex,n=(e.layout||{}).shapes||[];if(t=0&&f(m),n.attr("d",g(t)),M&&!d)&&(T=function(e,t){for(var n=0;n1&&(2!==e.length||"Z"!==e[1][0])&&(0===k&&(e[0][0]="M"),t[w]=e,y(),x())}}()}}function D(e,n){!function(e,n){if(t.length)for(var r=0;r0&&s0&&(l=l.transition().duration(t.transition.duration).ease(t.transition.easing)),l.attr("transform",s(o-.5*f.gripWidth,t._dims.currentValueTotalHeight))}}function S(e,t){var n=e._dims;return n.inputAreaStart+f.stepInset+(n.inputAreaLength-2*f.stepInset)*Math.min(1,Math.max(0,t))}function C(e,t){var n=e._dims;return Math.min(1,Math.max(0,(t-f.stepInset-n.inputAreaStart)/(n.inputAreaLength-2*f.stepInset-2*n.inputAreaStart)))}function P(e,t,n){var r=n._dims,a=l.ensureSingle(e,"rect",f.railTouchRectClass,(function(r){r.call(M,t,e,n).style("pointer-events","all")}));a.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,f.tickOffset+n.ticklen+r.labelHeight)}).call(i.fill,n.bgcolor).attr("opacity",0),o.setTranslate(a,0,r.currentValueTotalHeight)}function O(e,t){var n=t._dims,r=n.inputAreaLength-2*f.railInset,a=l.ensureSingle(e,"rect",f.railRectClass);a.attr({width:r,height:f.railWidth,rx:f.railRadius,ry:f.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,t.bordercolor).call(i.fill,t.bgcolor).style("stroke-width",t.borderwidth+"px"),o.setTranslate(a,f.railInset,.5*(n.inputAreaWidth-f.railWidth)+n.currentValueTotalHeight)}t.exports=function(e){var t=e._fullLayout,n=function(e,t){for(var n=e[f.name],r=[],a=0;a0?[0]:[]);function l(t){t._commandObserver&&(t._commandObserver.remove(),delete t._commandObserver),a.autoMargin(e,v(t))}if(i.enter().append("g").classed(f.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){r.select(this).selectAll("g."+f.groupClassName).each(l)})).remove(),0!==n.length){var s=i.selectAll("g."+f.groupClassName).data(n,m);s.enter().append("g").classed(f.groupClassName,!0),s.exit().each(l).remove();for(var c=0;c0||d<0){var m={left:[-h,0],right:[h,0],top:[0,-h],bottom:[0,h]}[b.side];t.attr("transform",s(m[0],m[1]))}}}return z.call(I),R&&(S?z.on(".opacity",null):(M=0,A=!0,z.text(y).on("mouseover.opacity",(function(){r.select(this).transition().duration(d.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){r.select(this).transition().duration(d.HIDE_PLACEHOLDER).style("opacity",0)}))),z.call(f.makeEditable,{gd:e}).on("edit",(function(t){void 0!==x?o.call("_guiRestyle",e,m,t,x):o.call("_guiRelayout",e,m,t)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(I)})).on("input",(function(e){this.text(e||" ").call(f.positionText,_.x,_.y)}))),z.classed("js-placeholder",A),k}}},{"../../constants/alignment":183,"../../constants/interactions":186,"../../lib":210,"../../lib/svg_text_utils":231,"../../plots/plots":297,"../../registry":306,"../color":81,"../drawing":103,d3:15,"fast-isnumeric":17}],177:[function(e,t,n){"use strict";var r=e("../../plots/font_attributes"),a=e("../color/attributes"),i=e("../../lib/extend").extendFlat,o=e("../../plot_api/edit_types").overrideAll,l=e("../../plots/pad_attributes"),s=e("../../plot_api/plot_template").templatedArray,c=s("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"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});t.exports=o(s("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:c,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:i(l({editType:"arraydraw"}),{}),font:r({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":202,"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../../plots/font_attributes":284,"../../plots/pad_attributes":296,"../color/attributes":80}],178:[function(e,t,n){"use strict";t.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"}}},{}],179:[function(e,t,n){"use strict";var r=e("../../lib"),a=e("../../plots/array_container_defaults"),i=e("./attributes"),o=e("./constants").name,l=i.buttons;function s(e,t,n){function o(n,a){return r.coerce(e,t,i,n,a)}o("visible",a(e,t,{name:"buttons",handleItemDefaults:c}).length>0)&&(o("active"),o("direction"),o("type"),o("showactive"),o("x"),o("y"),r.noneOrAll(e,t,["x","y"]),o("xanchor"),o("yanchor"),o("pad.t"),o("pad.r"),o("pad.b"),o("pad.l"),r.coerceFont(o,"font",n.font),o("bgcolor",n.paper_bgcolor),o("bordercolor"),o("borderwidth"))}function c(e,t){function n(n,a){return r.coerce(e,t,l,n,a)}n("visible","skip"===e.method||Array.isArray(e.args))&&(n("method"),n("args"),n("args2"),n("label"),n("execute"))}t.exports=function(e,t){a(e,t,{name:o,handleItemDefaults:s})}},{"../../lib":210,"../../plots/array_container_defaults":251,"./attributes":177,"./constants":178}],180:[function(e,t,n){"use strict";var r=e("d3"),a=e("../../plots/plots"),i=e("../color"),o=e("../drawing"),l=e("../../lib"),s=e("../../lib/svg_text_utils"),c=e("../../plot_api/plot_template").arrayEditor,u=e("../../constants/alignment").LINE_SPACING,f=e("./constants"),d=e("./scrollbox");function p(e){return e._index}function h(e,t){return+e.attr(f.menuIndexAttrName)===t._index}function g(e,t,n,r,a,i,o,l){t.active=o,c(e.layout,f.name,t).applyUpdate("active",o),"buttons"===t.type?m(e,r,null,null,t):"dropdown"===t.type&&(a.attr(f.menuIndexAttrName,"-1"),v(e,r,a,i,t),l||m(e,r,a,i,t))}function v(e,t,n,r,a){var i=l.ensureSingle(t,"g",f.headerClassName,(function(e){e.style("pointer-events","all")})),s=a._dims,c=a.active,u=a.buttons[c]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:s.headerWidth,height:s.headerHeight};i.call(y,a,u,e).call(A,a,d,p),l.ensureSingle(t,"text",f.headerArrowClassName,(function(e){e.attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:s.headerWidth-f.arrowOffsetX+a.pad.l,y:s.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){n.call(L,String(h(n,a)?-1:a._index)),m(e,t,n,r,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(k,a)})),o.setTranslate(t,s.lx,s.ly)}function m(e,t,n,i,o){n||(n=t).attr("pointer-events","all");var s=function(e){return-1==+e.attr(f.menuIndexAttrName)}(n)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=n.selectAll("g."+c).data(l.filterVisible(s)),d=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var h=0,v=0,m=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?v=m.headerHeight+f.gapButtonHeader:h=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(v=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(h=-f.gapButtonHeader+f.gapButton-m.openWidth);var b={x:m.lx+h+o.pad.l,y:m.ly+v+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},T={l:b.x+o.borderwidth,t:b.y+o.borderwidth};u.each((function(l,s){var c=r.select(this);c.call(y,o,l,e).call(A,o,b),c.on("click",(function(){r.event.defaultPrevented||(l.execute&&(l.args2&&o.active===s?(g(e,o,0,t,n,i,-1),a.executeAPICommand(e,l.method,l.args2)):(g(e,o,0,t,n,i,s),a.executeAPICommand(e,l.method,l.args))),e.emit("plotly_buttonclicked",{menu:o,button:l,active:o.active}))})),c.on("mouseover",(function(){c.call(w)})),c.on("mouseout",(function(){c.call(k,o),u.call(_,o)}))})),u.call(_,o),x?(T.w=Math.max(m.openWidth,m.headerWidth),T.h=b.y-T.t):(T.w=b.x-T.l,T.h=Math.max(m.openHeight,m.headerHeight)),T.direction=o.direction,i&&(u.size()?function(e,t,n,r,a,i){var o,l,s,c=a.direction,u="up"===c||"down"===c,d=a._dims,p=a.active;if(u)for(l=0,s=0;s0?[0]:[]);if(o.enter().append("g").classed(f.containerClassName,!0).style("cursor","pointer"),o.exit().each((function(){r.select(this).selectAll("g."+f.headerGroupClassName).each(i)})).remove(),0!==n.length){var s=o.selectAll("g."+f.headerGroupClassName).data(n,p);s.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=l.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(e){e.style("pointer-events","all")})),u=0;uw,M=l.barLength+2*l.barPad,A=l.barWidth+2*l.barPad,L=h,S=v+m;S+A>c&&(S=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(T?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,l.barColor),T?(this.hbar=C.attr({rx:l.barRadius,ry:l.barRadius,x:L,y:S,width:M,height:A}),this._hbarXMin=L+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var P=m>k,O=l.barWidth+2*l.barPad,D=l.barLength+2*l.barPad,R=h+g,E=v;R+O>s&&(R=s-O);var z=this.container.selectAll("rect.scrollbar-vertical").data(P?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,l.barColor),P?(this.vbar=z.attr({rx:l.barRadius,ry:l.barRadius,x:R,y:E,width:O,height:D}),this._vbarYMin=E+D/2,this._vbarTranslateMax=k-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,F=u-.5,N=P?f+O+.5:f+.5,j=d-.5,B=T?p+A+.5:p+.5,H=o._topdefs.selectAll("#"+I).data(T||P?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",I).append("rect"),T||P?(this._clipRect=H.select("rect").attr({x:Math.floor(F),y:Math.floor(j),width:Math.ceil(N)-Math.floor(F),height:Math.ceil(B)-Math.floor(j)}),this.container.call(i.setClipUrl,I,this.gd),this.bg.attr({x:h,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),T||P){var U=r.behavior.drag().on("dragstart",(function(){r.event.sourceEvent.preventDefault()})).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(U);var q=r.behavior.drag().on("dragstart",(function(){r.event.sourceEvent.preventDefault(),r.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));T&&this.hbar.on(".drag",null).call(q),P&&this.vbar.on(".drag",null).call(q)}this.setTranslate(t,n)},l.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.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)},l.prototype._onBoxDrag=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e-=r.event.dx),this.vbar&&(t-=r.event.dy),this.setTranslate(e,t)},l.prototype._onBoxWheel=function(){var e=this.translateX,t=this.translateY;this.hbar&&(e+=r.event.deltaY),this.vbar&&(t+=r.event.deltaY),this.setTranslate(e,t)},l.prototype._onBarDrag=function(){var e=this.translateX,t=this.translateY;if(this.hbar){var n=e+this._hbarXMin,a=n+this._hbarTranslateMax;e=(o.constrain(r.event.x,n,a)-n)/(a-n)*(this.position.w-this._box.w)}if(this.vbar){var i=t+this._vbarYMin,l=i+this._vbarTranslateMax;t=(o.constrain(r.event.y,i,l)-i)/(l-i)*(this.position.h-this._box.h)}this.setTranslate(e,t)},l.prototype.setTranslate=function(e,t){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(e=o.constrain(e||0,0,n),t=o.constrain(t||0,0,r),this.translateX=e,this.translateY=t,this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-t),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+t-.5)}),this.hbar){var a=e/n;this.hbar.call(i.setTranslate,e+a*this._hbarTranslateMax,t)}if(this.vbar){var l=t/r;this.vbar.call(i.setTranslate,e,t+l*this._vbarTranslateMax)}}},{"../../lib":210,"../color":81,"../drawing":103,d3:15}],183:[function(e,t,n){"use strict";t.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"}}},{}],184:[function(e,t,n){"use strict";t.exports={axisRefDescription:function(e,t,n){return["If set to a",e,"axis id (e.g. *"+e+"* or","*"+e+"2*), the `"+e+"` position refers to a",e,"coordinate. If set to *paper*, the `"+e+"`","position refers to the distance from the",t,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",t,"("+n+"). If set to a",e,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",t,"of the domain of that axis: e.g.,","*"+e+"2 domain* refers to the domain of the second",e," axis and a",e,"position of 0.5 refers to the","point between the",t,"and the",n,"of the domain of the","second",e,"axis."].join(" ")}}},{}],185:[function(e,t,n){"use strict";t.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],186:[function(e,t,n){"use strict";t.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],187:[function(e,t,n){"use strict";t.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],188:[function(e,t,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],189:[function(e,t,n){"use strict";n.version=e("./version").version,e("es6-promise").polyfill(),e("../build/plotcss"),e("./fonts/mathjax_config")();for(var r=e("./registry"),a=n.register=r.register,i=e("./plot_api"),o=Object.keys(i),l=0;lplotly-logomark"}}},{}],192:[function(e,t,n){"use strict";n.isLeftAnchor=function(e){return"left"===e.xanchor||"auto"===e.xanchor&&e.x<=1/3},n.isCenterAnchor=function(e){return"center"===e.xanchor||"auto"===e.xanchor&&e.x>1/3&&e.x<2/3},n.isRightAnchor=function(e){return"right"===e.xanchor||"auto"===e.xanchor&&e.x>=2/3},n.isTopAnchor=function(e){return"top"===e.yanchor||"auto"===e.yanchor&&e.y>=2/3},n.isMiddleAnchor=function(e){return"middle"===e.yanchor||"auto"===e.yanchor&&e.y>1/3&&e.y<2/3},n.isBottomAnchor=function(e){return"bottom"===e.yanchor||"auto"===e.yanchor&&e.y<=1/3}},{}],193:[function(e,t,n){"use strict";var r=e("./mod"),a=r.mod,i=r.modHalf,o=Math.PI,l=2*o;function s(e){return Math.abs(e[1]-e[0])>l-1e-14}function c(e,t){return i(t-e,l)}function u(e,t){if(s(t))return!0;var n,r;t[0](r=a(r,l))&&(r+=l);var i=a(e,l),o=i+l;return i>=n&&i<=r||o>=n&&o<=r}function f(e,t,n,r,a,i,c){a=a||0,i=i||0;var u,f,d,p,h,g=s([n,r]);function v(e,t){return[e*Math.cos(t)+a,i-e*Math.sin(t)]}g?(u=0,f=o,d=l):n=a&&e<=i);var a,i},pathArc:function(e,t,n,r,a){return f(null,e,t,n,r,a,0)},pathSector:function(e,t,n,r,a){return f(null,e,t,n,r,a,1)},pathAnnulus:function(e,t,n,r,a,i){return f(e,t,n,r,a,i,1)}}},{"./mod":217}],194:[function(e,t,n){"use strict";var r=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(e){return a.isView(e)&&!(e instanceof i)}function l(e){return r(e)||o(e)}function s(e,t,n){if(l(e)){if(l(e[0])){for(var r=n,a=0;aa.max?t.set(n):t.set(+e)}},integer:{coerceFunction:function(e,t,n,a){e%1||!r(e)||void 0!==a.min&&ea.max?t.set(n):t.set(+e)}},string:{coerceFunction:function(e,t,n,r){if("string"!=typeof e){var a="number"==typeof e;!0!==r.strict&&a?t.set(String(e)):t.set(n)}else r.noBlank&&!e?t.set(n):t.set(e)}},color:{coerceFunction:function(e,t,n){a(e).isValid()?t.set(e):t.set(n)}},colorlist:{coerceFunction:function(e,t,n){Array.isArray(e)&&e.length&&e.every((function(e){return a(e).isValid()}))?t.set(e):t.set(n)}},colorscale:{coerceFunction:function(e,t,n){t.set(o.get(e,n))}},angle:{coerceFunction:function(e,t,n){"auto"===e?t.set("auto"):r(e)?t.set(u(+e,360)):t.set(n)}},subplotid:{coerceFunction:function(e,t,n,r){var a=r.regex||c(n);"string"==typeof e&&a.test(e)?t.set(e):t.set(n)},validateFunction:function(e,t){var n=t.dflt;return e===n||"string"==typeof e&&!!c(n).test(e)}},flaglist:{coerceFunction:function(e,t,n,r){if("string"==typeof e)if(-1===(r.extras||[]).indexOf(e)){for(var a=e.split("+"),i=0;i=r&&e<=a?e:u}if("string"!=typeof e&&"number"!=typeof e)return u;e=String(e);var c=_(t),m=e.charAt(0);!c||"G"!==m&&"g"!==m||(e=e.substr(1),t="");var w=c&&"chinese"===t.substr(0,7),k=e.match(w?x:y);if(!k)return u;var T=k[1],M=k[3]||"1",A=Number(k[5]||1),L=Number(k[7]||0),S=Number(k[9]||0),C=Number(k[11]||0);if(c){if(2===T.length)return u;var P;T=Number(T);try{var O=v.getComponentMethod("calendars","getCal")(t);if(w){var D="i"===M.charAt(M.length-1);M=parseInt(M,10),P=O.newDate(T,O.toMonthIndex(T,M,D),A)}else P=O.newDate(T,Number(M),A)}catch(e){return u}return P?(P.toJD()-g)*f+L*d+S*p+C*h:u}T=2===T.length?(Number(T)+2e3-b)%100+b:Number(T),M-=1;var R=new Date(Date.UTC(2e3,M,A,L,S));return R.setUTCFullYear(T),R.getUTCMonth()!==M||R.getUTCDate()!==A?u:R.getTime()+C*h},r=n.MIN_MS=n.dateTime2ms("-9999"),a=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(e,t){return n.dateTime2ms(e,t)!==u};var k=90*f,T=3*d,M=5*p;function A(e,t,n,r,a){if((t||n||r||a)&&(e+=" "+w(t,2)+":"+w(n,2),(r||a)&&(e+=":"+w(r,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;e+="."+w(a,i)}return e}n.ms2DateTime=function(e,t,n){if("number"!=typeof e||!(e>=r&&e<=a))return u;t||(t=0);var i,o,l,c,y,x,b=Math.floor(10*s(e+.05,1)),w=Math.round(e-b/10);if(_(n)){var L=Math.floor(w/f)+g,S=Math.floor(s(e,f));try{i=v.getComponentMethod("calendars","getCal")(n).fromJD(L).formatDate("yyyy-mm-dd")}catch(e){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=t=r+f&&e<=a-f))return u;var t=Math.floor(10*s(e+.05,1)),n=new Date(Math.round(e-t/10));return A(i("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+t)},n.cleanDate=function(e,t,r){if(e===u)return t;if(n.isJSDate(e)||"number"==typeof e&&isFinite(e)){if(_(r))return l.error("JS Dates and milliseconds are incompatible with world calendars",e),t;if(!(e=n.ms2DateTimeLocal(+e))&&void 0!==t)return t}else if(!n.isDateTime(e,r))return l.error("unrecognized date",e),t;return e};var L=/%\d?f/g;function S(e,t,n,r){e=e.replace(L,(function(e){var n=Math.min(+e.charAt(1)||6,6);return(t/1e3%1+2).toFixed(n).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(t+.05));if(_(r))try{e=v.getComponentMethod("calendars","worldCalFmt")(e,t,r)}catch(e){return"Invalid"}return n(e)(a)}var C=[59,59.9,59.99,59.999,59.9999];n.formatDate=function(e,t,n,r,a,i){if(a=_(a)&&a,!t)if("y"===n)t=i.year;else if("m"===n)t=i.month;else{if("d"!==n)return function(e,t){var n=s(e+.05,f),r=w(Math.floor(n/d),2)+":"+w(s(Math.floor(n/p),60),2);if("M"!==t){o(t)||(t=0);var a=(100+Math.min(s(e/h,60),C[t])).toFixed(t).substr(1);t>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+a}return r}(e,n)+"\n"+S(i.dayMonthYear,e,r,a);t=i.dayMonth+"\n"+i.year}return S(t,e,r,a)};var P=3*f;n.incrementMonth=function(e,t,n){n=_(n)&&n;var r=s(e,f);if(e=Math.round(e-r),n)try{var a=Math.round(e/f)+g,i=v.getComponentMethod("calendars","getCal")(n),o=i.fromJD(a);return t%12?i.add(o,t,"m"):i.add(o,t/12,"y"),(o.toJD()-g)*f+r}catch(t){l.error("invalid ms "+e+" in calendar "+n)}var c=new Date(e+P);return c.setUTCMonth(c.getUTCMonth()+t)+r-P},n.findExactDates=function(e,t){for(var n,r,a=0,i=0,l=0,s=0,c=_(t)&&v.getComponentMethod("calendars","getCal")(t),u=0;u0&&e[t+1][0]<0)return t;return null}switch(t="RUS"===l||"FJI"===l?function(e){var t;if(null===c(e))t=e;else for(t=new Array(e.length),a=0;at?n[r++]=[e[a][0]+360,e[a][1]]:a===t?(n[r++]=e[a],n[r++]=[e[a][0],-90]):n[r++]=e[a];var i=d.tester(n);i.pts.pop(),s.push(i)}:function(e){s.push(d.tester(e))},i.type){case"MultiPolygon":for(n=0;na&&(a=c,t=s)}else t=n;return o.default(t).geometry.coordinates}(u),r.fIn=e,r.fOut=u,l.push(u)}else c.log(["Location",r.loc,"does not have a valid GeoJSON geometry.","Traces with locationmode *geojson-id* only support","*Polygon* and *MultiPolygon* geometries."].join(" "))}delete a[n]}switch(n.type){case"FeatureCollection":var d=n.features;for(r=0;r100?(clearInterval(i),r("Unexpected error while fetching from "+e)):void a++}),50)}))}for(var o=0;o0&&(n.push(a),a=[])}return a.length>0&&n.push(a),n},n.makeLine=function(e){return 1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}},n.makePolygon=function(e){if(1===e.length)return{type:"Polygon",coordinates:e};for(var t=new Array(e.length),n=0;n1||g<0||g>1?null:{x:e+s*g,y:t+f*g}}function s(e,t,n,r,a){var i=r*e+a*t;if(i<0)return r*r+a*a;if(i>n){var o=r-e,l=a-t;return o*o+l*l}var s=r*t-a*e;return s*s/n}n.segmentsIntersect=l,n.segmentDistance=function(e,t,n,r,a,i,o,c){if(l(e,t,n,r,a,i,o,c))return 0;var u=n-e,f=r-t,d=o-a,p=c-i,h=u*u+f*f,g=d*d+p*p,v=Math.min(s(u,f,h,a-e,i-t),s(u,f,h,o-e,c-t),s(d,p,g,e-a,t-i),s(d,p,g,n-a,r-i));return Math.sqrt(v)},n.getTextLocation=function(e,t,n,l){if(e===a&&l===i||(r={},a=e,i=l),r[n])return r[n];var s=e.getPointAtLength(o(n-l/2,t)),c=e.getPointAtLength(o(n+l/2,t)),u=Math.atan((c.y-s.y)/(c.x-s.x)),f=e.getPointAtLength(o(n,t)),d={x:(4*f.x+s.x+c.x)/6,y:(4*f.y+s.y+c.y)/6,theta:u};return r[n]=d,d},n.clearLocationCache=function(){a=null},n.getVisibleSegment=function(e,t,n){var r,a,i=t.left,o=t.right,l=t.top,s=t.bottom,c=0,u=e.getTotalLength(),f=u;function d(t){var n=e.getPointAtLength(t);0===t?r=n:t===u&&(a=n);var c=n.xo?n.x-o:0,f=n.ys?n.y-s:0;return Math.sqrt(c*c+f*f)}for(var p=d(c);p;){if((c+=p+n)>f)return;p=d(c)}for(p=d(f);p;){if(c>(f-=p+n))return;p=d(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(r.x-a.x)<.1&&Math.abs(r.y-a.y)<.1}},n.findPointOnPath=function(e,t,n,r){for(var a,i,o,l=(r=r||{}).pathLength||e.getTotalLength(),s=r.tolerance||.001,c=r.iterationLimit||30,u=e.getPointAtLength(0)[n]>e.getPointAtLength(l)[n]?-1:1,f=0,d=0,p=l;f0?p=a:d=a,f++}return i}},{"./mod":217}],208:[function(e,t,n){"use strict";t.exports=function(e){return e}},{}],209:[function(e,t,n){"use strict";t.exports=function(e,t){if(!t)return e;var n=1/Math.abs(t),r=n>1?(n*e+n*t)/n:e+t,a=String(r).length;if(a>16){var i=String(t).length;if(a>=String(e).length+i){var o=parseFloat(r).toPrecision(12);-1===o.indexOf("e+")&&(r=+o)}}return r}},{}],210:[function(e,t,n){"use strict";var r=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../constants/numerical"),l=o.FP_SAFE,s=o.BADNUM,c=t.exports={};c.nestedProperty=e("./nested_property"),c.keyedContainer=e("./keyed_container"),c.relativeAttr=e("./relative_attr"),c.isPlainObject=e("./is_plain_object"),c.toLogRange=e("./to_log_range"),c.relinkPrivateKeys=e("./relink_private");var u=e("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=e("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var d=e("./coerce");c.valObjectMeta=d.valObjectMeta,c.coerce=d.coerce,c.coerce2=d.coerce2,c.coerceFont=d.coerceFont,c.coerceHoverinfo=d.coerceHoverinfo,c.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,c.validate=d.validate;var p=e("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var h=e("./search");c.findBin=h.findBin,c.sorterAsc=h.sorterAsc,c.sorterDes=h.sorterDes,c.distinctVals=h.distinctVals,c.roundUp=h.roundUp,c.sort=h.sort,c.findIndexOfMin=h.findIndexOfMin;var g=e("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var v=e("./matrix");c.init2dArray=v.init2dArray,c.transposeRagged=v.transposeRagged,c.dot=v.dot,c.translationMatrix=v.translationMatrix,c.rotationMatrix=v.rotationMatrix,c.rotationXYMatrix=v.rotationXYMatrix,c.apply3DTransform=v.apply3DTransform,c.apply2DTransform=v.apply2DTransform,c.apply2DTransform2=v.apply2DTransform2,c.convertCssMatrix=v.convertCssMatrix,c.inverseTransformMatrix=v.inverseTransformMatrix;var m=e("./angles");c.deg2rad=m.deg2rad,c.rad2deg=m.rad2deg,c.angleDelta=m.angleDelta,c.angleDist=m.angleDist,c.isFullCircle=m.isFullCircle,c.isAngleInsideSector=m.isAngleInsideSector,c.isPtInsideSector=m.isPtInsideSector,c.pathArc=m.pathArc,c.pathSector=m.pathSector,c.pathAnnulus=m.pathAnnulus;var y=e("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=e("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=e("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=e("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=e("./regex");c.counterRegex=w.counter;var k=e("./throttle");c.throttle=k.throttle,c.throttleDone=k.done,c.clearThrottle=k.clear;var T=e("./dom");function M(e){var t={};for(var n in e)for(var r=e[n],a=0;al?s:i(e)?Number(e):s:s},c.isIndex=function(e,t){return!(void 0!==t&&e>=t)&&(i(e)&&e>=0&&e%1==0)},c.noop=e("./noop"),c.identity=e("./identity"),c.repeat=function(e,t){for(var n=new Array(t),r=0;rn?Math.max(n,Math.min(t,e)):Math.max(t,Math.min(n,e))},c.bBoxIntersect=function(e,t,n){return n=n||0,e.left<=t.right+n&&t.left<=e.right+n&&e.top<=t.bottom+n&&t.top<=e.bottom+n},c.simpleMap=function(e,t,n,r,a){for(var i=e.length,o=new Array(i),l=0;l=Math.pow(2,n)?a>10?(c.warn("randstr failed uniqueness"),s):e(t,n,r,(a||0)+1):s},c.OptionControl=function(e,t){e||(e={}),t||(t="opt");var n={optionList:[],_newoption:function(r){r[t]=e,n[r.name]=r,n.optionList.push(r)}};return n["_"+t]=e,n},c.smooth=function(e,t){if((t=Math.round(t)||0)<2)return e;var n,r,a,i,o=e.length,l=2*o,s=2*t-1,c=new Array(s),u=new Array(o);for(n=0;n=l&&(a-=l*Math.floor(a/l)),a<0?a=-1-a:a>=o&&(a=l-1-a),i+=e[a]*c[r];u[n]=i}return u},c.syncOrAsync=function(e,t,n){var r;function a(){return c.syncOrAsync(e,t,n)}for(;e.length;)if((r=(0,e.splice(0,1)[0])(t))&&r.then)return r.then(a).then(void 0,c.promiseError);return n&&n(t)},c.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},c.noneOrAll=function(e,t,n){if(e){var r,a=!1,i=!0;for(r=0;r0?t:0}))},c.fillArray=function(e,t,n,r){if(r=r||c.identity,c.isArrayOrTypedArray(e))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||l.length>4||n))for(;r.test(l);)l=l.replace(r,"$1"+i+"$2");return l+s},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var O=/^\w*$/;c.templateString=function(e,t){var n={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,r){var a;return O.test(r)?a=t[r]:(n[r]=n[r]||c.nestedProperty(t,r).get,a=n[r]()),c.isValidTextValue(a)?a:""}))};var D={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return z.apply(D,arguments)};var R={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return z.apply(R,arguments)};var E=/^[:|\|]/;function z(e,t,n){var i=this,o=arguments;t||(t={});var l={};return e.replace(c.TEMPLATE_STRING_REGEX,(function(e,s,u){var f,d,p,h;for(p=3;p=48&&o<=57,c=l>=48&&l<=57;if(s&&(r=10*r+o-48),c&&(a=10*a+l-48),!s||!c){if(r!==a)return r-a;if(o!==l)return o-l}}return a-r};var I=2e9;c.seedPseudoRandom=function(){I=2e9},c.pseudoRandom=function(){var e=I;return I=(69069*I+1)%4294967296,Math.abs(I-e)<429496729?c.pseudoRandom():I/4294967296},c.fillText=function(e,t,n){var r=Array.isArray(n)?function(e){n.push(e)}:function(e){n.text=e},a=c.extractOption(e,t,"htx","hovertext");if(c.isValidTextValue(a))return r(a);var i=c.extractOption(e,t,"tx","text");return c.isValidTextValue(i)?r(i):void 0},c.isValidTextValue=function(e){return e||0===e},c.formatPercent=function(e,t){t=t||0;for(var n=(Math.round(100*e*Math.pow(10,t))*Math.pow(.1,t)).toFixed(t)+"%",r=0;r1&&(u=1):u=0,c.strTranslate(a-u*(n+o),i-u*(r+l))+c.strScale(u)+(s?"rotate("+s+(t?"":" "+n+" "+r)+")":"")},c.ensureUniformFontSize=function(e,t){var n=c.extendFlat({},t);return n.size=Math.max(t.size,e._fullLayout.uniformtext.minsize||0),n},c.join2=function(e,t,n){var r=e.length;return r>1?e.slice(0,-1).join(t)+n+e[r-1]:e.join(t)}},{"../constants/numerical":187,"./anchor_utils":192,"./angles":193,"./array":194,"./clean_number":195,"./clear_responsive":197,"./coerce":198,"./dates":199,"./dom":200,"./extend":202,"./filter_unique":203,"./filter_visible":204,"./geometry2d":207,"./identity":208,"./increment":209,"./is_plain_object":211,"./keyed_container":212,"./localize":213,"./loggers":214,"./make_trace_groups":215,"./matrix":216,"./mod":217,"./nested_property":218,"./noop":219,"./notifier":220,"./push_unique":223,"./regex":225,"./relative_attr":226,"./relink_private":227,"./search":228,"./stats":230,"./throttle":232,"./to_log_range":233,d3:15,"d3-time-format":13,"fast-isnumeric":17}],211:[function(e,t,n){"use strict";t.exports=function(e){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(e):"[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.prototype}},{}],212:[function(e,t,n){"use strict";var r=e("./nested_property"),a=/^\w*$/;t.exports=function(e,t,n,i){var o,l,s;n=n||"name",i=i||"value";var c={};t&&t.length?(s=r(e,t),l=s.get()):l=e,t=t||"";var u={};if(l)for(o=0;o2)return c[t]=2|c[t],d.set(e,null);if(f){for(o=t;o1){var t=["LOG:"];for(e=0;e1){var n=[];for(e=0;e"),"long")}},i.warn=function(){var e;if(r.logging>0){var t=["WARN:"];for(e=0;e0){var n=[];for(e=0;e"),"stick")}},i.error=function(){var e;if(r.logging>0){var t=["ERROR:"];for(e=0;e0){var n=[];for(e=0;e"),"stick")}}},{"../plot_api/plot_config":243,"./notifier":220}],215:[function(e,t,n){"use strict";var r=e("d3");t.exports=function(e,t,n){var a=e.selectAll("g."+n.replace(/\s/g,".")).data(t,(function(e){return e[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",n),a.order();var i=e.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(e){e[0][i]=r.select(this)})),a}},{d3:15}],216:[function(e,t,n){"use strict";var r=e("gl-mat4");n.init2dArray=function(e,t){for(var n=new Array(e),r=0;rt/2?e-Math.round(e/t)*t:e}}},{}],218:[function(e,t,n){"use strict";var r=e("fast-isnumeric"),a=e("./array").isArrayOrTypedArray;function i(e,t){return function(){var n,r,o,l,s,c=e;for(l=0;l/g),s=0;si||c===a||cl)&&(!t||!s(e))}:function(e,t){var s=e[0],c=e[1];if(s===a||si||c===a||cl)return!1;var u,f,d,p,h,g=n.length,v=n[0][0],m=n[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(r(o,d))>a)return!0;return!1},i.filter=function(e,t){var n=[e[0]],r=0,a=0;function o(o){e.push(o);var l=n.length,s=r;n.splice(a+1);for(var c=s+1;c1&&o(e.pop());return{addPt:o,raw:e,filtered:n}}},{"../constants/numerical":187,"./matrix":216}],223:[function(e,t,n){"use strict";t.exports=function(e,t){if(t instanceof RegExp){for(var n=t.toString(),r=0;ra.queueLength&&(e.undoQueue.queue.shift(),e.undoQueue.index--))},startSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!0,e.undoQueue.beginSequence=!0},stopSequence:function(e){e.undoQueue=e.undoQueue||{index:0,queue:[],sequence:!1},e.undoQueue.sequence=!1,e.undoQueue.beginSequence=!1},undo:function(e){var t,n;if(e.framework&&e.framework.isPolar)e.framework.undo();else if(!(void 0===e.undoQueue||isNaN(e.undoQueue.index)||e.undoQueue.index<=0)){for(e.undoQueue.index--,t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,n=0;n=e.undoQueue.queue.length)){for(t=e.undoQueue.queue[e.undoQueue.index],e.undoQueue.inSequence=!0,n=0;nt}function u(e,t){return e>=t}n.findBin=function(e,t,n){if(r(t.start))return n?Math.ceil((e-t.start)/t.size-1e-9)-1:Math.floor((e-t.start)/t.size+1e-9);var i,o,f=0,d=t.length,p=0,h=d>1?(t[d-1]-t[0])/(d-1):1;for(o=h>=0?n?l:s:n?u:c,e+=1e-9*h*(n?-1:1)*(h>=0?1:-1);f90&&a.log("Long binary search..."),f-1},n.sorterAsc=function(e,t){return e-t},n.sorterDes=function(e,t){return t-e},n.distinctVals=function(e,t){var r,a=(t||{}).unitMinDiff,i=e.slice();for(i.sort(n.sorterAsc),r=i.length-1;r>-1&&i[r]===o;r--);var l=1;a||(l=i[r]-i[0]||1);for(var s,c=l/(r||1)/1e4,u=[],f=0;f<=r;f++){var d=i[f],p=d-s;void 0===s?(u.push(d),s=d):p>c&&(l=Math.min(l,p),u.push(d),s=d)}return{vals:u,minDiff:l}},n.roundUp=function(e,t,n){for(var r,a=0,i=t.length-1,o=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;a0&&(r=1),n&&r)return e.sort(t)}return r?e:e.reverse()},n.findIndexOfMin=function(e,t){t=t||i;for(var n,r=1/0,a=0;ai.length)&&(o=i.length),r(t)||(t=!1),a(i[0])){for(s=new Array(o),l=0;le.length-1)return e[e.length-1];var n=t%1;return n*e[Math.ceil(t)]+(1-n)*e[Math.floor(t)]}},{"./array":194,"fast-isnumeric":17}],231:[function(e,t,n){"use strict";var r=e("d3"),a=e("../lib"),i=a.strTranslate,o=e("../constants/xmlns_namespaces"),l=e("../constants/alignment").LINE_SPACING;function s(e,t){return e.node().getBoundingClientRect()[t]}var c=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;n.convertToTspans=function(e,t,A){var L=e.text(),C=!e.attr("data-notex")&&"undefined"!=typeof MathJax&&L.match(c),P=r.select(e.node().parentNode);if(!P.empty()){var O=e.attr("class")?e.attr("class").split(" ")[0]:"text";return O+="-math",P.selectAll("svg."+O).remove(),P.selectAll("g."+O+"-group").remove(),e.style("display",null).attr({"data-unformatted":L,"data-math":"N"}),C?(t&&t._promises||[]).push(new Promise((function(t){e.style("display","none");var n=parseInt(e.node().style.fontSize,10),o={fontSize:n};!function(e,t,n){var i,o,l,s;MathJax.Hub.Queue((function(){return o=a.extendDeepAll({},MathJax.Hub.config),l=MathJax.Hub.processSectionDelay,void 0!==MathJax.Hub.processSectionDelay&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]},displayAlign:"left"})}),(function(){if("SVG"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var n="math-output-"+a.randstr({},64);return s=r.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":t.fontSize+"px"}).text(e.replace(u,"\\lt ").replace(f,"\\gt ")),MathJax.Hub.Typeset(s.node())}),(function(){var t=r.select("body").select("#MathJax_SVG_glyphs");if(s.select(".MathJax_SVG").empty()||!s.select("svg").node())a.log("There was an error in the tex syntax.",e),n();else{var o=s.select("svg").node().getBoundingClientRect();n(s.select(".MathJax_SVG"),t,o)}if(s.remove(),"SVG"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==l&&(MathJax.Hub.processSectionDelay=l),MathJax.Hub.Config(o)}))}(C[2],o,(function(r,a,o){P.selectAll("svg."+O).remove(),P.selectAll("g."+O+"-group").remove();var l=r&&r.select("svg");if(!l||!l.node())return D(),void t();var c=P.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":L,"data-math":"Y"});c.node().appendChild(l.node()),a&&a.node()&&l.node().insertBefore(a.node().cloneNode(!0),l.node().firstChild),l.attr({class:O,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=e.node().style.fill||"black",f=l.select("g");f.attr({fill:u,stroke:u});var d=s(f,"width"),p=s(f,"height"),h=+e.attr("x")-d*{start:0,middle:.5,end:1}[e.attr("text-anchor")||"start"],g=-(n||s(e,"height"))/4;"y"===O[0]?(c.attr({transform:"rotate("+[-90,+e.attr("x"),+e.attr("y")]+")"+i(-d/2,g-p/2)}),l.attr({x:+e.attr("x"),y:+e.attr("y")})):"l"===O[0]?l.attr({x:e.attr("x"),y:g-p/2}):"a"===O[0]&&0!==O.indexOf("atitle")?l.attr({x:0,y:g}):l.attr({x:h,y:+e.attr("y")+g-p/2}),A&&A.call(e,c),t(c)}))}))):D(),e}function D(){P.empty()||(O=e.attr("class")+"-math",P.select("svg."+O).remove()),e.text("").style("white-space","pre"),function(e,t){t=t.replace(v," ");var n,i=!1,s=[],c=-1;function u(){c++;var t=document.createElementNS(o.svg,"tspan");r.select(t).attr({class:"line",dy:c*l+"em"}),e.appendChild(t),n=t;var a=s;if(s=[{node:t}],a.length>1)for(var i=1;i doesnt match end tag <"+e+">. Pretending it did match.",t),n=s[s.length-1].node}else a.log("Ignoring unexpected end tag .",t)}x.test(t)?u():(n=e,s=[{node:e}]);for(var C=t.split(m),P=0;P|>|>)/g;var d={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"},p={sub:"0.3em",sup:"-0.6em"},h={sub:"-0.21em",sup:"0.42em"},g=["http:","https:","mailto:","",void 0,":"],v=n.NEWLINES=/(\r\n?|\n)/g,m=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,x=//i;n.BR_TAG_ALL=//gi;var b=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,_=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,k=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(e,t){if(!e)return null;var n=e.match(t),r=n&&(n[3]||n[4]);return r&&S(r)}var M=/(^|;)\s*color:/;n.plainText=function(e,t){for(var n=void 0!==(t=t||{}).len&&-1!==t.len?t.len:1/0,r=void 0!==t.allowedTags?t.allowedTags:["br"],a="...".length,i=e.split(m),o=[],l="",s=0,c=0;ca?o.push(u.substr(0,h-a)+"..."):o.push(u.substr(0,h));break}l=""}}return o.join("")};var A={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},L=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function S(e){return e.replace(L,(function(e,t){return("#"===t.charAt(0)?function(e){if(e>1114111)return;var t=String.fromCodePoint;if(t)return t(e);var n=String.fromCharCode;return e<=65535?n(e):n(55232+(e>>10),e%1024+56320)}("x"===t.charAt(1)?parseInt(t.substr(2),16):parseInt(t.substr(1),10)):A[t])||e}))}function C(e,t,n){var r,i,o,l=n.horizontalAlign,s=n.verticalAlign||"top",c=e.node().getBoundingClientRect(),u=t.node().getBoundingClientRect();return i="bottom"===s?function(){return c.bottom-r.height}:"middle"===s?function(){return c.top+(c.height-r.height)/2}:function(){return c.top},o="right"===l?function(){return c.right-r.width}:"center"===l?function(){return c.left+(c.width-r.width)/2}:function(){return c.left},function(){r=this.node().getBoundingClientRect();var e=o()-u.left,t=i()-u.top,l=n.gd||{};if(n.gd){l._fullLayout._calcInverseTransform(l);var s=a.apply3DTransform(l._fullLayout._invTransform)(e,t);e=s[0],t=s[1]}return this.style({top:t+"px",left:e+"px","z-index":1e3}),this}}n.convertEntities=S,n.sanitizeHTML=function(e){e=e.replace(v," ");for(var t=document.createElement("p"),n=t,a=[],i=e.split(m),o=0;oi.ts+t?s():i.timer=setTimeout((function(){s(),i.timer=null}),t)},n.done=function(e){var t=r[e];return t&&t.timer?new Promise((function(e){var n=t.onDone;t.onDone=function(){n&&n(),e(),t.onDone=null}})):Promise.resolve()},n.clear=function(e){if(e)a(r[e]),delete r[e];else for(var t in r)n.clear(t)}},{}],233:[function(e,t,n){"use strict";var r=e("fast-isnumeric");t.exports=function(e,t){if(e>0)return Math.log(e)/Math.LN10;var n=Math.log(Math.min(t[0],t[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(t[0],t[1]))/Math.LN10-6),n}},{"fast-isnumeric":17}],234:[function(e,t,n){"use strict";var r=t.exports={},a=e("../plots/geo/constants").locationmodeToLayer,i=e("topojson-client").feature;r.getTopojsonName=function(e){return[e.scope.replace(/ /g,"-"),"_",e.resolution.toString(),"m"].join("")},r.getTopojsonPath=function(e,t){return e+t+".json"},r.getTopojsonFeatures=function(e,t){var n=a[e.locationmode],r=t.objects[n];return i(t,r).features}},{"../plots/geo/constants":286,"topojson-client":64}],235:[function(e,t,n){"use strict";t.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],236:[function(e,t,n){"use strict";t.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"}}},{}],237:[function(e,t,n){"use strict";var r=e("../registry");t.exports=function(e){for(var t,n,a=r.layoutArrayContainers,i=r.layoutArrayRegexes,o=e.split("[")[0],l=0;l0&&o.log("Clearing previous rejected promises from queue."),e._promises=[]},n.cleanLayout=function(e){var t,r;e||(e={}),e.xaxis1&&(e.xaxis||(e.xaxis=e.xaxis1),delete e.xaxis1),e.yaxis1&&(e.yaxis||(e.yaxis=e.yaxis1),delete e.yaxis1),e.scene1&&(e.scene||(e.scene=e.scene1),delete e.scene1);var i=(l.subplotsRegistry.cartesian||{}).attrRegex,s=(l.subplotsRegistry.polar||{}).attrRegex,f=(l.subplotsRegistry.ternary||{}).attrRegex,d=(l.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(e);for(t=0;t3?(R.x=1.02,R.xanchor="left"):R.x<-2&&(R.x=-.02,R.xanchor="right"),R.y>3?(R.y=1.02,R.yanchor="bottom"):R.y<-2&&(R.y=-.02,R.yanchor="top")),h(e),"rotate"===e.dragmode&&(e.dragmode="orbit"),c.clean(e),e.template&&e.template.layout&&n.cleanLayout(e.template.layout),e},n.cleanData=function(e){for(var t=0;t0)return e.substr(0,t)}n.hasParent=function(e,t){for(var n=b(t);n;){if(n in e)return!0;n=b(n)}return!1};var _=["x","y","z"];n.clearAxisTypes=function(e,t,n){for(var r=0;r1&&i.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(c(y))t.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;t.set(y)}return!g&&(d(v,m),p(e),!0)}var x,b,_,w,k,T,M,A,L=Object.keys(n).map(Number).sort(o),S=t.get(),C=S||[],P=u(m,f).get(),O=[],D=-1,R=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",f,_);else if(void 0!==T)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(T)?O.push(_):M?("add"===T&&(T={}),C.splice(_,0,T),P&&P.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,T),-1===D&&(D=_);else for(b=0;b=0;x--)C.splice(O[x],1),P&&P.splice(O[x],1);if(C.length?S||t.set(C):t.set(null),g)return!1;if(d(v,m),h!==a){var E;if(-1===D)E=L;else{for(R=Math.max(C.length,R),E=[],x=0;x=D);x++)E.push(_);for(x=D;x=e.data.length||a<-e.data.length)throw new Error(n+" must be valid indices for gd.data.");if(t.indexOf(a,r+1)>-1||a>=0&&t.indexOf(-e.data.length+a)>-1||a<0&&t.indexOf(e.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function E(e,t,n){if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("currentIndices is a required argument.");if(Array.isArray(t)||(t=[t]),R(e,t,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&R(e,n,"newIndices"),"undefined"!=typeof n&&t.length!==n.length)throw new Error("current and new indices must be of equal length.")}function z(e,t,n,r,i){!function(e,t,n,r){var a=o.isPlainObject(r);if(!Array.isArray(e.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(t))throw new Error("update must be a key:value object");if("undefined"==typeof n)throw new Error("indices must be an integer or array of integers");for(var i in R(e,n,"indices"),t){if(!Array.isArray(t[i])||t[i].length!==n.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in r)||!Array.isArray(r[i])||r[i].length!==t[i].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")}}(e,t,n,r);for(var s=function(e,t,n,r){var i,s,c,u,f,d=o.isPlainObject(r),p=[];for(var h in Array.isArray(n)||(n=[n]),n=D(n,e.data.length-1),t)for(var g=0;g-1?s(n,n.replace("titlefont","title.font")):n.indexOf("titleposition")>-1?s(n,n.replace("titleposition","title.position")):n.indexOf("titleside")>-1?s(n,n.replace("titleside","title.side")):n.indexOf("titleoffset")>-1&&s(n,n.replace("titleoffset","title.offset")):s(n,n.replace("title","title.text"));function s(t,n){e[n]=e[t],delete e[t]}}function q(e,t,n){if(e=o.getGraphDiv(e),k.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var r={};if("string"==typeof t)r[t]=n;else{if(!o.isPlainObject(t))return o.warn("Relayout fail.",t,n),Promise.reject();r=o.extendFlat({},t)}Object.keys(r).length&&(e.changed=!0);var a=W(e,r),i=a.flags;i.calc&&(e.calcdata=void 0);var l=[d.previousPromises];i.layoutReplot?l.push(T.layoutReplot):Object.keys(r).length&&(V(e,i,a)||d.supplyDefaults(e),i.legend&&l.push(T.doLegend),i.layoutstyle&&l.push(T.layoutStyles),i.axrange&&G(l,a.rangesAltered),i.ticks&&l.push(T.doTicksRelayout),i.modebar&&l.push(T.doModeBar),i.camera&&l.push(T.doCamera),i.colorbars&&l.push(T.doColorBars),l.push(S)),l.push(d.rehover,d.redrag),c.add(e,q,[e,a.undoit],q,[e,a.redoit]);var s=o.syncOrAsync(l,e);return s&&s.then||(s=Promise.resolve(e)),s.then((function(){return e.emit("plotly_relayout",a.eventData),e}))}function V(e,t,n){var r=e._fullLayout;if(!t.axrange)return!1;for(var a in t)if("axrange"!==a&&t[a])return!1;for(var i in n.rangesAltered){var o=h.id2name(i),l=e.layout[o],s=r[o];if(s.autorange=l.autorange,s.range=l.range.slice(),s.cleanRange(),s._matchGroup)for(var c in s._matchGroup)if(c!==i){var u=r[h.id2name(c)];u.autorange=s.autorange,u.range=s.range.slice(),u._input.range=s.range.slice()}}return!0}function G(e,t){var n=t?function(e){var n=[],r=!0;for(var a in t){var i=h.getFromId(e,a);if(n.push(a),-1!==(i.ticklabelposition||"").indexOf("inside")&&i._anchorAxis&&n.push(i._anchorAxis._id),i._matchGroup)for(var o in i._matchGroup)t[o]||n.push(o);i.automargin&&(r=!1)}return h.draw(e,n,{skipTitle:r})}:function(e){return h.draw(e,"redraw")};e.push(b,T.doAutoRangeAndConstraints,n,T.drawData,T.finalDraw)}var Z=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function W(e,t){var n,r,a,i=e.layout,s=e._fullLayout,c=s._guiEditing,d=j(s._preGUI,c),p=Object.keys(t),g=h.list(e),v=o.extendDeepAll({},t),m={};for(U(t),p=Object.keys(t),r=0;r0&&"string"!=typeof R.parts[z];)z--;var I=R.parts[z],F=R.parts[z-1]+"."+I,B=R.parts.slice(0,z).join("."),H=l(e.layout,B).get(),q=l(s,B).get(),V=R.get();if(void 0!==E){T[D]=E,L[D]="reverse"===I?E:N(V);var G=f.getLayoutValObject(s,R.parts);if(G&&G.impliedEdits&&null!==E)for(var W in G.impliedEdits)S(o.relativeAttr(D,W),G.impliedEdits[W]);if(-1!==["width","height"].indexOf(D))if(E){S("autosize",null);var Q="height"===D?"width":"height";S(Q,s[Q])}else s[D]=e._initialAutoSize[D];else if("autosize"===D)S("width",E?null:s.width),S("height",E?null:s.height);else if(F.match(Z))O(F),l(s,B+"._inputRange").set(null);else if(F.match(Y)){O(F),l(s,B+"._inputRange").set(null);var $=l(s,B).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else F.match(X)&&l(s,B+"._inputDomain").set(null);if("type"===I){C=H;var K="linear"===q.type&&"log"===E,ee="log"===q.type&&"linear"===E;if(K||ee){if(C&&C.range)if(q.autorange)K&&(C.range=C.range[1]>C.range[0]?[1,2]:[2,1]);else{var te=C.range[0],ne=C.range[1];K?(te<=0&&ne<=0&&S(B+".autorange",!0),te<=0?te=ne/1e6:ne<=0&&(ne=te/1e6),S(B+".range[0]",Math.log(te)/Math.LN10),S(B+".range[1]",Math.log(ne)/Math.LN10)):(S(B+".range[0]",Math.pow(10,te)),S(B+".range[1]",Math.pow(10,ne)))}else S(B+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[R.parts[0]]&&"radialaxis"===R.parts[1]&&delete s[R.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(e,q,E,S),u.getComponentMethod("images","convertCoords")(e,q,E,S)}else S(B+".autorange",!0),S(B+".range",null);l(s,B+"._inputRange").set(null)}else if(I.match(A)){var re=l(s,D).get(),ae=(E||{}).type;ae&&"-"!==ae||(ae="linear"),u.getComponentMethod("annotations","convertCoords")(e,re,ae,S),u.getComponentMethod("images","convertCoords")(e,re,ae,S)}var ie=w.containerArrayMatch(D);if(ie){n=ie.array,r=ie.index;var oe=ie.property,le=G||{editType:"calc"};""!==r&&""===oe&&(w.isAddVal(E)?L[D]=null:w.isRemoveVal(E)?L[D]=(l(i,n).get()||[])[r]:o.warn("unrecognized full object value",t)),M.update(_,le),m[n]||(m[n]={});var se=m[n][r];se||(se=m[n][r]={}),se[oe]=E,delete t[D]}else"reverse"===I?(H.range?H.range.reverse():(S(B+".autorange",!0),H.range=[1,0]),q.autorange?_.calc=!0:_.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===D&&("lasso"===E||"select"===E)&&"lasso"!==V&&"select"!==V||s._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,R.set(E))}}for(n in m){w.applyContainerArrayChanges(e,d(i,n),m[n],_,d)||(_.plot=!0)}for(var ce in P){var ue=(C=h.getFromId(e,ce))&&C._constraintGroup;if(ue)for(var fe in _.calc=!0,ue)P[fe]||(h.getFromId(e,fe)._constraintShrinkable=!0)}return(J(e)||t.height||t.width)&&(_.plot=!0),(_.plot||_.calc)&&(_.layoutReplot=!0),{flags:_,rangesAltered:P,undoit:L,redoit:T,eventData:v}}function J(e){var t=e._fullLayout,n=t.width,r=t.height;return e.layout.autosize&&d.plotAutoSize(e,e.layout,t),t.width!==n||t.height!==r}function Q(e,t,r,a){if(e=o.getGraphDiv(e),k.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);o.isPlainObject(t)||(t={}),o.isPlainObject(r)||(r={}),Object.keys(t).length&&(e.changed=!0),Object.keys(r).length&&(e.changed=!0);var i=k.coerceTraceIndices(e,a),l=H(e,o.extendFlat({},t),i),s=l.flags,u=W(e,o.extendFlat({},r)),f=u.flags;(s.calc||f.calc)&&(e.calcdata=void 0),s.clearAxisTypes&&k.clearAxisTypes(e,i,r);var p=[];f.layoutReplot?p.push(T.layoutReplot):s.fullReplot?p.push(n.plot):(p.push(d.previousPromises),V(e,f,u)||d.supplyDefaults(e),s.style&&p.push(T.doTraceStyle),(s.colorbars||f.colorbars)&&p.push(T.doColorBars),f.legend&&p.push(T.doLegend),f.layoutstyle&&p.push(T.layoutStyles),f.axrange&&G(p,u.rangesAltered),f.ticks&&p.push(T.doTicksRelayout),f.modebar&&p.push(T.doModeBar),f.camera&&p.push(T.doCamera),p.push(S)),p.push(d.rehover,d.redrag),c.add(e,Q,[e,l.undoit,u.undoit,l.traces],Q,[e,l.redoit,u.redoit,l.traces]);var h=o.syncOrAsync(p,e);return h&&h.then||(h=Promise.resolve(e)),h.then((function(){return e.emit("plotly_update",{data:l.eventData,layout:u.eventData}),e}))}function $(e){return function(t){t._fullLayout._guiEditing=!0;var n=e.apply(null,arguments);return t._fullLayout._guiEditing=!1,n}}var K=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],ee=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function te(e,t){for(var n=0;n1;)if(r.pop(),void 0!==(n=l(t,r.join(".")+".uirevision").get()))return n;return t.uirevision}function re(e,t){for(var n=0;n=a.length?a[0]:a[e]:a}function s(e){return Array.isArray(i)?e>=i.length?i[0]:i[e]:i}function c(e,t){var n=0;return function(){if(e&&++n===t)return e()}}return void 0===r._frameWaitingCnt&&(r._frameWaitingCnt=0),new Promise((function(i,u){function f(){r._currentFrame&&r._currentFrame.onComplete&&r._currentFrame.onComplete();var t=r._currentFrame=r._frameQueue.shift();if(t){var n=t.name?t.name.toString():null;e._fullLayout._currentFrame=n,r._lastFrameAt=Date.now(),r._timeToNext=t.frameOpts.duration,d.transition(e,t.frame.data,t.frame.layout,k.coerceTraceIndices(e,t.frame.traces),t.frameOpts,t.transitionOpts).then((function(){t.onComplete&&t.onComplete()})),e.emit("plotly_animatingframe",{name:n,frame:t.frame,animation:{frame:t.frameOpts,transition:t.transitionOpts}})}else e.emit("plotly_animated"),window.cancelAnimationFrame(r._animationRaf),r._animationRaf=null}function p(){e.emit("plotly_animating"),r._lastFrameAt=-1/0,r._timeToNext=0,r._runningTransitions=0,r._currentFrame=null;var t=function(){r._animationRaf=window.requestAnimationFrame(t),Date.now()-r._lastFrameAt>r._timeToNext&&f()};t()}var h,g,v=0;function m(e){return Array.isArray(a)?v>=a.length?e.transitionOpts=a[v]:e.transitionOpts=a[0]:e.transitionOpts=a,v++,e}var y=[],x=null==t,b=Array.isArray(t);if(!x&&!b&&o.isPlainObject(t))y.push({type:"object",data:m(o.extendFlat({},t))});else if(x||-1!==["string","number"].indexOf(typeof t))for(h=0;h0&&TT)&&M.push(g);y=M}}y.length>0?function(t){if(0!==t.length){for(var a=0;a=0;r--)if(o.isPlainObject(t[r])){var g=t[r].name,v=(u[g]||h[g]||{}).name,m=t[r].name,y=u[v]||h[v];v&&m&&"number"==typeof m&&y&&L<5&&(L++,o.warn('addFrames: overwriting frame "'+(u[v]||h[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.")),h[g]={name:g},p.push({frame:d.supplyFrameDefaults(t[r]),index:n&&void 0!==n[r]&&null!==n[r]?n[r]:f+r})}p.sort((function(e,t){return e.index>t.index?-1:e.index=0;r--){if("number"==typeof(a=p[r].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+e._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;n--)r=t[n],i.push({type:"delete",index:r}),l.unshift({type:"insert",index:r,value:a[r]});var s=d.modifyFrames,u=d.modifyFrames,f=[e,l],p=[e,i];return c&&c.add(e,s,f,u,p),d.modifyFrames(e,i)},n.addTraces=function e(t,r,a){t=o.getGraphDiv(t);var i,l,s=[],u=n.deleteTraces,f=e,d=[t,s],p=[t,r];for(function(e,t,n){var r,a;if(!Array.isArray(e.data))throw new Error("gd.data must be an array.");if("undefined"==typeof t)throw new Error("traces must be defined.");for(Array.isArray(t)||(t=[t]),r=0;r=0&&n=0&&n=i.length)return!1;if(2===e.dimensions){if(n++,t.length===n)return e;var o=t[n];if(!_(o))return!1;e=i[a][o]}else e=i[a]}else e=i}}return e}function _(e){return e===Math.round(e)&&e>=0}function w(){var e,t,n={};for(e in h(n,o),r.subplotsRegistry){if((t=r.subplotsRegistry[e]).layoutAttributes)if(Array.isArray(t.attr))for(var a=0;a=s.length)return!1;a=(n=(r.transformsRegistry[s[c].type]||{}).attributes)&&n[t[2]],l=3}else if("area"===e.type)a=u[o];else{var f=e._module;if(f||(f=(r.modules[e.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(n=f.attributes)&&n[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return b(a,t,l)},n.getLayoutValObject=function(e,t){return b(function(e,t){var n,a,i,l,s=e._basePlotModules;if(s){var c;for(n=0;n=a&&(n._input||{})._templateitemname;o&&(i=a);var l,s=t+"["+i+"]";function c(){l={},o&&(l[s]={},l[s].templateitemname=o)}function u(e,t){o?r.nestedProperty(l[s],e).set(t):l[s+"."+e]=t}function f(){var e=l;return c(),e}return c(),{modifyBase:function(e,t){l[e]=t},modifyItem:u,getUpdateObj:f,applyUpdate:function(t,n){t&&u(t,n);var a=f();for(var i in a)r.nestedProperty(e,i).set(a[i])}}}},{"../lib":210,"../plots/attributes":252}],246:[function(e,t,n){"use strict";var r=e("d3"),a=e("../registry"),i=e("../plots/plots"),o=e("../lib"),l=e("../lib/clear_gl_canvases"),s=e("../components/color"),c=e("../components/drawing"),u=e("../components/titles"),f=e("../components/modebar"),d=e("../plots/cartesian/axes"),p=e("../constants/alignment"),h=e("../plots/cartesian/constraints"),g=h.enforce,v=h.clean,m=e("../plots/cartesian/autorange").doAutoRange;function y(e,t,n){for(var r=0;r=e[1]||a[1]<=e[0])&&(i[0]t[0]))return!0}return!1}function x(e){var t,a,l,u,h,g,v=e._fullLayout,m=v._size,x=m.p,_=d.list(e,"",!0);if(v._paperdiv.style({width:e._context.responsive&&v.autosize&&!e._context._hasZeroWidth&&!e.layout.width?"100%":v.width+"px",height:e._context.responsive&&v.autosize&&!e._context._hasZeroHeight&&!e.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(c.setSize,v.width,v.height),e._context.setBackground(e,v.paper_bgcolor),n.drawMainTitle(e),f.manage(e),!v._has("cartesian"))return i.previousPromises(e);function k(e,t,n){var r=e._lw/2;return"x"===e._id.charAt(0)?t?"top"===n?t._offset-x-r:t._offset+t._length+x+r:m.t+m.h*(1-(e.position||0))+r%1:t?"right"===n?t._offset+t._length+x+r:t._offset-x-r:m.l+m.w*(e.position||0)+r%1}for(t=0;t<_.length;t++){var T=(u=_[t])._anchorAxis;u._linepositions={},u._lw=c.crispRound(e,u.linewidth,1),u._mainLinePosition=k(u,T,u.side),u._mainMirrorPosition=u.mirror&&T?k(u,T,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],L=[],S=1===s.opacity(v.paper_bgcolor)&&1===s.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((l=v._plots[a]).mainplot)l.bg&&l.bg.remove(),l.bg=void 0;else{var C=l.xaxis.domain,P=l.yaxis.domain,O=l.plotgroup;if(y(C,P,L)){var D=O.node(),R=l.bg=o.ensureSingle(O,"rect","bg");D.insertBefore(R.node(),D.childNodes[0]),A.push(a)}else O.select("rect.bg").remove(),L.push([C,P]),S||(M.push(a),A.push(a))}var E,z,I,F,N,j,B,H,U,q,V,G,Z,Y=v._bgLayer.selectAll(".bg").data(M);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(e){v._plots[e].bg=r.select(this)})),t=0;tk?u.push({code:"unused",traceType:y,templateCount:w,dataCount:k}):k>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:k})}}else u.push({code:"data"});if(function e(t,n){for(var r in t)if("_"!==r.charAt(0)){var i=t[r],o=g(t,r,n);a(i)?(Array.isArray(t)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),e(i,o)):Array.isArray(i)&&v(i)&&e(i,o)}}({data:p,layout:d},""),u.length)return u.map(m)}},{"../lib":210,"../plots/attributes":252,"../plots/plots":297,"./plot_config":243,"./plot_schema":244,"./plot_template":245}],248:[function(e,t,n){"use strict";var r=e("fast-isnumeric"),a=e("./plot_api"),i=e("../plots/plots"),o=e("../lib"),l=e("../snapshot/helpers"),s=e("../snapshot/tosvg"),c=e("../snapshot/svgtoimg"),u=e("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};t.exports=function(e,t){var n,d,p,h;function g(e){return!(e in t)||o.validate(t[e],f[e])}if(t=t||{},o.isPlainObject(e)?(n=e.data||[],d=e.layout||{},p=e.config||{},h={}):(e=o.getGraphDiv(e),n=o.extendDeep([],e.data),d=o.extendDeep({},e.layout),p=e._context,h=e._fullLayout||{}),!g("width")&&null!==t.width||!g("height")&&null!==t.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Export format is not "+o.join2(f.format.values,", "," or ")+".");var v={};function m(e,n){return o.coerce(t,v,f,e,n)}var y=m("format"),x=m("width"),b=m("height"),_=m("scale"),w=m("setBackground"),k=m("imageDataOnly"),T=document.createElement("div");T.style.position="absolute",T.style.left="-5000px",document.body.appendChild(T);var M=o.extendFlat({},d);x?M.width=x:null===t.width&&r(h.width)&&(M.width=h.width),b?M.height=b:null===t.height&&r(h.height)&&(M.height=h.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),L=l.getRedrawFunc(T);function S(){return new Promise((function(e){setTimeout(e,l.getDelay(T._fullLayout))}))}function C(){return new Promise((function(e,t){var n=s(T,y,_),r=T._fullLayout.width,f=T._fullLayout.height;function d(){a.purge(T),document.body.removeChild(T)}if("full-json"===y){var p=i.graphJson(T,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),d(),e(k?p:l.encodeJSON(p))}if(d(),"svg"===y)return e(k?n:l.encodeSVG(n));var h=document.createElement("canvas");h.id=o.randstr(),c({format:y,width:r,height:f,scale:_,canvas:h,svg:n,promise:!0}).then(e).catch(t)}))}return new Promise((function(e,t){a.plot(T,n,M,A).then(L).then(S).then(C).then((function(t){e(function(e){return k?e.replace(l.IMAGE_URL_PREFIX,""):e}(t))})).catch((function(e){t(e)}))}))}},{"../lib":210,"../plots/plots":297,"../snapshot/helpers":310,"../snapshot/svgtoimg":312,"../snapshot/tosvg":314,"../version":366,"./plot_api":242,"fast-isnumeric":17}],249:[function(e,t,n){"use strict";var r=e("../lib"),a=e("../plots/plots"),i=e("./plot_schema"),o=e("./plot_config").dfltConfig,l=r.isPlainObject,s=Array.isArray,c=r.isArrayOrTypedArray;function u(e,t,n,a,i,o){o=o||[];for(var f=Object.keys(e),d=0;dx.length&&a.push(h("unused",i,m.concat(x.length)));var M,A,L,S,C,P=x.length,O=Array.isArray(T);if(O&&(P=Math.min(P,T.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(h("unused",i,m.concat(A,x[A].length)));var D=x[A].length;for(M=0;M<(O?Math.min(D,T[A].length):D);M++)L=O?T[A][M]:T,S=y[A][M],C=x[A][M],r.validate(S,L)?C!==S&&C!==+S&&a.push(h("dynamic",i,m.concat(A,M),S,C)):a.push(h("value",i,m.concat(A,M),S))}else a.push(h("array",i,m.concat(A),y[A]));else for(A=0;A1&&p.push(h("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=n.length,y=0;y0&&Math.round(f)===f))return a;c=f}for(var d=t.calendar,p="start"===s,h="end"===s,g=e[n+"period0"],v=i(g,d)||0,m=[],y=a.length,x=0;xk;)w=o(w,-c,d);for(;w<=k;)w=o(w,c,d);_=o(w,-c,d)}else{for(w=v+(b=Math.round((k-v)/u))*u;w>k;)w-=u;for(;w<=k;)w+=u;_=w-u}m[x]=p?_:h?w:(_+w)/2}return m}},{"../../constants/numerical":187,"../../lib":210,"fast-isnumeric":17}],254:[function(e,t,n){"use strict";t.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],255:[function(e,t,n){"use strict";var r=e("fast-isnumeric"),a=e("../../lib"),i=e("../../constants/numerical").FP_SAFE,o=e("../../registry"),l=e("./axis_ids").getFromId;function s(e,t){var n,r,i=[],o=u(t,0),l=u(t,1),s=f(e,t),d=s.min,p=s.max;if(0===d.length||0===p.length)return a.simpleMap(t.range,t.r2l);var h=d[0].val,g=p[0].val;for(n=1;n0&&((w=L-o(y)-l(x))>S?k/w>C&&(b=y,_=x,C=k/w):k/L>C&&(b={val:y.val,pad:0},_={val:x.val,pad:0},C=k/L));if(h===g){var P=h-1,O=h+1;if(M)if(0===h)i=[0,1];else{var D=(h>0?p:d).reduce((function(e,t){return Math.max(e,l(t))}),0),R=h/(1-Math.min(.5,D/L));i=h>0?[0,R]:[R,0]}else i=A?[Math.max(0,P),Math.max(1,O)]:[P,O]}else M?(b.val>=0&&(b={val:0,pad:0}),_.val<=0&&(_={val:0,pad:0})):A&&(b.val-C*o(b)<0&&(b={val:0,pad:0}),_.val<=0&&(_={val:1,pad:0})),C=(_.val-b.val-c(t,y.val,x.val))/(L-o(b)-l(_)),i=[b.val-C*o(b),_.val+C*l(_)];return v&&i.reverse(),a.simpleMap(i,t.l2r||Number)}function c(e,t,n){var r=0;if(e.rangebreaks)for(var a=e.locateBreaks(t,n),i=0;i0?n.ppadplus:n.ppadminus)||n.ppad||0),L=M((e._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),S=M(n.vpadplus||n.vpad),C=M(n.vpadminus||n.vpad);if(!k){if(h=1/0,v=-1/0,w)for(a=0;a0&&(h=o),o>v&&o-i&&(h=o),o>v&&o=D;a--)O(a);return{min:m,max:y,opts:n}},concatExtremes:f};function f(e,t,n){var r,a,i,o=t._id,s=e._fullData,c=e._fullLayout,u=[],h=[];function g(e,t){for(r=0;r=n&&(c.extrapad||!o)){l=!1;break}a(t,c.val)&&c.pad<=n&&(o||!c.extrapad)&&(e.splice(s,1),s--)}if(l){var u=i&&0===t;e.push({val:t,pad:u?0:n,extrapad:!u&&o})}}function g(e){return r(e)&&Math.abs(e)=t}},{"../../constants/numerical":187,"../../lib":210,"../../registry":306,"./axis_ids":259,"fast-isnumeric":17}],256:[function(e,t,n){"use strict";var r=e("d3"),a=e("fast-isnumeric"),i=e("../../plots/plots"),o=e("../../registry"),l=e("../../lib"),s=l.strTranslate,c=e("../../lib/svg_text_utils"),u=e("../../components/titles"),f=e("../../components/color"),d=e("../../components/drawing"),p=e("./layout_attributes"),h=e("./clean_ticks"),g=e("../../constants/numerical"),v=g.ONEMAXYEAR,m=g.ONEAVGYEAR,y=g.ONEMINYEAR,x=g.ONEMAXQUARTER,b=g.ONEAVGQUARTER,_=g.ONEMINQUARTER,w=g.ONEMAXMONTH,k=g.ONEAVGMONTH,T=g.ONEMINMONTH,M=g.ONEWEEK,A=g.ONEDAY,L=A/2,S=g.ONEHOUR,C=g.ONEMIN,P=g.ONESEC,O=g.MINUS_SIGN,D=g.BADNUM,R=e("../../constants/alignment"),E=R.MID_SHIFT,z=R.CAP_SHIFT,I=R.LINE_SPACING,F=R.OPPOSITE_SIDE,N=t.exports={};N.setConvert=e("./set_convert");var j=e("./axis_autotype"),B=e("./axis_ids");N.id2name=B.id2name,N.name2id=B.name2id,N.cleanId=B.cleanId,N.list=B.list,N.listIds=B.listIds,N.getFromId=B.getFromId,N.getFromTrace=B.getFromTrace;var H=e("./autorange");N.getAutoRange=H.getAutoRange,N.findExtremes=H.findExtremes;function U(e){var t=1e-4*(e[1]-e[0]);return[e[0]-t,e[1]+t]}N.coerceRef=function(e,t,n,r,a,i){var o=r.charAt(r.length-1),s=n._fullLayout._subplots[o+"axis"],c=r+"ref",u={};return a||(a=s[0]||("string"==typeof i?i:i[0])),i||(i=a),s=s.concat(s.map((function(e){return e+" domain"}))),u[c]={valType:"enumerated",values:s.concat(i?"string"==typeof i?[i]:i:[]),dflt:a},l.coerce(e,t,u,c)},N.getRefType=function(e){return void 0===e?e:"paper"===e?"paper":"pixel"===e?"pixel":/( domain)$/.test(e)?"domain":"range"},N.coercePosition=function(e,t,n,r,a,i){var o,s;if("range"!==N.getRefType(r))o=l.ensureNumber,s=n(a,i);else{var c=N.getFromId(t,r);s=n(a,i=c.fraction2r(i)),o=c.cleanPos}e[a]=o(s)},N.cleanPosition=function(e,t,n){return("paper"===n||"pixel"===n?l.ensureNumber:N.getFromId(t,n).cleanPos)(e)},N.redrawComponents=function(e,t){t=t||N.listIds(e);var n=e._fullLayout;function r(r,a,i,l){for(var s=o.getComponentMethod(r,a),c={},u=0;u2e-6||((n-e._forceTick0)/e._minDtick%1+1.000001)%1>2e-6)&&(e._minDtick=0)):e._minDtick=0},N.saveRangeInitial=function(e,t){for(var n=N.list(e,"",!0),r=!1,a=0;a.3*d||u(r)||u(i))){var p=n.dtick/2;e+=e+p.8){var o=Number(n.substr(1));i.exactYears>.8&&o%12==0?e=N.tickIncrement(e,"M6","reverse")+1.5*A:i.exactMonths>.8?e=N.tickIncrement(e,"M1","reverse")+15.5*A:e-=L;var s=N.tickIncrement(e,n);if(s<=r)return s}return e}(y,e,m,c,i)),v=y,0;v<=u;)v=N.tickIncrement(v,m,!1,i);return{start:t.c2r(y,0,i),end:t.c2r(v,0,i),size:m,_dataSpan:u-c}},N.prepTicks=function(e,t){var n=l.simpleMap(e.range,e.r2l,void 0,void 0,t);if(e._dtickInit=e.dtick,e._tick0Init=e.tick0,"auto"===e.tickmode||!e.dtick){var r,i=e.nticks;i||("category"===e.type||"multicategory"===e.type?(r=e.tickfont?1.2*(e.tickfont.size||12):15,i=e._length/r):(r="y"===e._id.charAt(0)?40:80,i=l.constrain(e._length/r,4,9)+1),"radialaxis"===e._name&&(i*=2)),"array"===e.tickmode&&(i*=100),e._roughDTick=Math.abs(n[1]-n[0])/i,N.autoTicks(e,e._roughDTick),e._minDtick>0&&e.dtick<2*e._minDtick&&(e.dtick=e._minDtick,e.tick0=e.l2r(e._forceTick0))}"period"===e.ticklabelmode&&function(e){var t;function n(){return!(a(e.dtick)||"M"!==e.dtick.charAt(0))}var r=n(),i=N.getTickFormat(e);if(i){var o=e._dtickInit!==e.dtick;/%[fLQsSMX]/.test(i)||(/%[HI]/.test(i)?(t=S,o&&!r&&e.dticki&&f=o:p<=o;p=N.tickIncrement(p,e.dtick,s,e.calendar)){if(e.rangebreaks&&!s){if(p=u)break}if(C.length>g||p===P)break;P=p;var O=!1;f&&p!==(0|p)&&(O=!0),C.push({minor:O,value:p})}if(d&&function(e,t,n){for(var r=0;r0?(i=r-1,o=r):(i=r,o=r);var l,s=e[i].value,c=e[o].value,u=Math.abs(c-s),f=n||u,d=0;f>=y?d=u>=y&&u<=v?u:m:n===b&&f>=_?d=u>=_&&u<=x?u:b:f>=T?d=u>=T&&u<=w?u:k:n===M&&f>=M?d=M:f>=A?d=A:n===L&&f>=L?d=L:n===S&&f>=S&&(d=S),d>=u&&(d=u,l=!0);var p=a+d;if(t.rangebreaks&&d>0){for(var h=0,g=0;g<84;g++){var C=(g+.5)/84;t.maskBreaks(a*(1-C)+C*p)!==D&&h++}(d*=h/84)||(e[r].drop=!0),l&&u>M&&(d=u)}(d>0||0===r)&&(e[r].periodX=a+d/2)}}(C,e,e._definedDelta),e.rangebreaks){var R="y"===e._id.charAt(0),E=1;"auto"===e.tickmode&&(E=e.tickfont?e.tickfont.size:12);var z=NaN;for(h=C.length-1;h>-1;h--)if(C[h].drop)C.splice(h,1);else{C[h].value=be(C[h].value,e);var I=e.c2p(C[h].value);(R?z>I-E:zu||ju&&(F.periodX=u),j10||"01-01"!==r.substr(5)?e._tickround="d":e._tickround=+t.substr(1)%12==0?"y":"m";else if(t>=A&&i<=10||t>=15*A)e._tickround="d";else if(t>=C&&i<=16||t>=S)e._tickround="M";else if(t>=P&&i<=19||t>=C)e._tickround="S";else{var o=e.l2r(n+t).replace(/^-/,"").length;e._tickround=Math.max(i,o)-20,e._tickround<0&&(e._tickround=4)}}else if(a(t)||"L"===t.charAt(0)){var l=e.range.map(e.r2d||Number);a(t)||(t=Number(t.substr(1))),e._tickround=2-Math.floor(Math.log(t)/Math.LN10+.01);var s=Math.max(Math.abs(l[0]),Math.abs(l[1])),c=Math.floor(Math.log(s)/Math.LN10+.01),u=void 0===e.minexponent?3:e.minexponent;Math.abs(c)>u&&(ae(e.exponentformat)&&!ie(c)?e._tickexponent=3*Math.round((c-1)/3):e._tickexponent=c)}else e._tickround=null}function ne(e,t,n){var r=e.tickfont||{};return{x:t,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}N.autoTicks=function(e,t){var n;function r(e){return Math.pow(e,Math.floor(Math.log(t)/Math.LN10))}if("date"===e.type){e.tick0=l.dateTick0(e.calendar,0);var i=2*t;if(i>m)t/=m,n=r(10),e.dtick="M"+12*ee(t,n,Y);else if(i>k)t/=k,e.dtick="M"+ee(t,1,X);else if(i>A){e.dtick=ee(t,A,e._hasDayOfWeekBreaks?[1,2,7,14]:J);var o=N.getTickFormat(e),s="period"===e.ticklabelmode;s&&(e._rawTick0=e.tick0),/%[uVW]/.test(o)?e.tick0=l.dateTick0(e.calendar,2):e.tick0=l.dateTick0(e.calendar,1),s&&(e._dowTick0=e.tick0)}else i>S?e.dtick=ee(t,S,X):i>C?e.dtick=ee(t,C,W):i>P?e.dtick=ee(t,P,W):(n=r(10),e.dtick=ee(t,n,Y))}else if("log"===e.type){e.tick0=0;var c=l.simpleMap(e.range,e.r2l);if(t>.7)e.dtick=Math.ceil(t);else if(Math.abs(c[1]-c[0])<1){var u=1.5*Math.abs((c[1]-c[0])/t);t=Math.abs(Math.pow(10,c[1])-Math.pow(10,c[0]))/u,n=r(10),e.dtick="L"+ee(t,n,Y)}else e.dtick=t>.3?"D2":"D1"}else"category"===e.type||"multicategory"===e.type?(e.tick0=0,e.dtick=Math.ceil(Math.max(t,1))):xe(e)?(e.tick0=0,n=1,e.dtick=ee(t,n,K)):(e.tick0=0,n=r(10),e.dtick=ee(t,n,Y));if(0===e.dtick&&(e.dtick=1),!a(e.dtick)&&"string"!=typeof e.dtick){var f=e.dtick;throw e.dtick=1,"ax.dtick error: "+String(f)}},N.tickIncrement=function(e,t,n,i){var o=n?-1:1;if(a(t))return l.increment(e,o*t);var s=t.charAt(0),c=o*Number(t.substr(1));if("M"===s)return l.incrementMonth(e,c,i);if("L"===s)return Math.log(Math.pow(10,e)+c)/Math.LN10;if("D"===s){var u="D2"===t?$:Q,f=e+.01*o,d=l.roundUp(l.mod(f,1),u,n);return Math.floor(f)+Math.log(r.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(t)},N.tickFirst=function(e,t){var n=e.r2l||Number,i=l.simpleMap(e.range,n,void 0,void 0,t),o=i[1]"+s,e._prevDateHead=s));t.text=c}(e,o,n,c):"log"===u?function(e,t,n,r,i){var o=e.dtick,s=t.x,c=e.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");r&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)t.text=oe(Math.pow(10,s),e,i,r);else if(a(o)||"D"===u&&l.mod(s+.01,1)<.1){var f=Math.round(s),d=Math.abs(f),p=e.exponentformat;"power"===p||ae(p)&&ie(f)?(t.text=0===f?1:1===f?"10":"10"+(f>1?"":O)+d+"",t.fontSize*=1.25):("e"===p||"E"===p)&&d>2?t.text="1"+p+(f>0?"+":O)+d:(t.text=oe(Math.pow(10,s),e,"","fakehover"),"D1"===o&&"y"===e._id.charAt(0)&&(t.dy-=t.fontSize/6))}else{if("D"!==u)throw"unrecognized dtick "+String(o);t.text=String(Math.round(Math.pow(10,l.mod(s,1)))),t.fontSize*=.75}if("D1"===e.dtick){var h=String(t.text).charAt(0);"0"!==h&&"1"!==h||("y"===e._id.charAt(0)?t.dx-=t.fontSize/4:(t.dy+=t.fontSize/2,t.dx+=(e.range[1]>e.range[0]?1:-1)*t.fontSize*(s<0?.5:.25)))}}(e,o,0,c,g):"category"===u?function(e,t){var n=e._categories[Math.round(t.x)];void 0===n&&(n="");t.text=String(n)}(e,o):"multicategory"===u?function(e,t,n){var r=Math.round(t.x),a=e._categories[r]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);n?t.text=o+" - "+i:(t.text=i,t.text2=o)}(e,o,n):xe(e)?function(e,t,n,r,a){if("radians"!==e.thetaunit||n)t.text=oe(t.x,e,a,r);else{var i=t.x/180;if(0===i)t.text="0";else{var o=function(e){function t(e,t){return Math.abs(e-t)<=1e-6}var n=function(e){for(var n=1;!t(Math.round(e*n)/n,e);)n*=10;return n}(e),r=e*n,a=Math.abs(function e(n,r){return t(r,0)?n:e(r,n%r)}(r,n));return[Math.round(r/a),Math.round(n/a)]}(i);if(o[1]>=100)t.text=oe(l.deg2rad(t.x),e,a,r);else{var s=t.x<0;1===o[1]?1===o[0]?t.text="\u03c0":t.text=o[0]+"\u03c0":t.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(t.text=O+t.text)}}}}(e,o,n,c,g):function(e,t,n,r,a){"never"===a?a="":"all"===e.showexponent&&Math.abs(t.x/e.dtick)<1e-6&&(a="hide");t.text=oe(t.x,e,a,r)}(e,o,0,c,g),r||(e.tickprefix&&!h(e.showtickprefix)&&(o.text=e.tickprefix+o.text),e.ticksuffix&&!h(e.showticksuffix)&&(o.text+=e.ticksuffix)),"boundaries"===e.tickson||e.showdividers){var v=function(t){var n=e.l2p(t);return n>=0&&n<=e._length?t:null};o.xbnd=[v(o.x-.5),v(o.x+e.dtick-.5)]}return o},N.hoverLabelText=function(e,t,n){if(n!==D&&n!==t)return N.hoverLabelText(e,t)+" - "+N.hoverLabelText(e,n);var r="log"===e.type&&t<=0,a=N.tickText(e,e.c2l(r?-t:t),"hover").text;return r?0===t?"0":O+a:a};var re=["f","p","n","\u03bc","m","","k","M","G","T"];function ae(e){return"SI"===e||"B"===e}function ie(e){return e>14||e<-15}function oe(e,t,n,r){var i=e<0,o=t._tickround,s=n||t.exponentformat||"B",c=t._tickexponent,u=N.getTickFormat(t),f=t.separatethousands;if(r){var d={exponentformat:s,minexponent:t.minexponent,dtick:"none"===t.showexponent?t.dtick:a(e)&&Math.abs(e)||1,range:"none"===t.showexponent?t.range.map(t.r2d):[0,e||1]};te(d),o=(Number(d._tickround)||0)+4,c=d._tickexponent,t.hoverformat&&(u=t.hoverformat)}if(u)return t._numFormat(u)(e).replace(/-/g,O);var p,h=Math.pow(10,-o)/2;if("none"===s&&(c=0),(e=Math.abs(e))"+p+"":"B"===s&&9===c?e+="B":ae(s)&&(e+=re[c/3+5]));return i?O+e:e}function le(e,t){for(var n=[],r={},a=0;a1&&n=a.min&&e=0,i=u(e,t[1])<=0;return(n||a)&&(r||i)}if(e.tickformatstops&&e.tickformatstops.length>0)switch(e.type){case"date":case"linear":for(t=0;t=o(a)))){n=r;break}break;case"log":for(t=0;t0?n.bottom-f:0,d)))),t.automargin){r={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===h){if("b"===s?r[s]=t._depth:(r[s]=t._depth=Math.max(n.width>0?f-n.top:0,d),p.reverse()),n.width>0){var v=n.right-(t._offset+t._length);v>0&&(r.xr=1,r.r=v);var m=t._offset-n.left;m>0&&(r.xl=0,r.l=m)}}else if("l"===s?r[s]=t._depth=Math.max(n.height>0?f-n.left:0,d):(r[s]=t._depth=Math.max(n.height>0?n.right-f:0,d),p.reverse()),n.height>0){var y=n.bottom-(t._offset+t._length);y>0&&(r.yb=0,r.b=y);var x=t._offset-n.top;x>0&&(r.yt=1,r.t=x)}r[g]="free"===t.anchor?t.position:t._anchorAxis.domain[p[0]],t.title.text!==c._dfltTitle[h]&&(r[s]+=ue(t)+(t.title.standoff||0)),t.mirror&&"free"!==t.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[u]=t.linewidth,t.mirror&&!0!==t.mirror&&(a[u]+=d),!0===t.mirror||"ticks"===t.mirror?a[g]=t._anchorAxis.domain[p[1]]:"all"!==t.mirror&&"allticks"!==t.mirror||(a[g]=[t._counterDomainMin,t._counterDomainMax][p[1]]))}Q&&(l=o.getComponentMethod("rangeslider","autoMarginOpts")(e,t)),i.autoMargin(e,pe(t),r),i.autoMargin(e,he(t),a),i.autoMargin(e,ge(t),l)})),n.skipTitle||Q&&"bottom"===t.side||W.push((function(){return function(e,t){var n,r=e._fullLayout,a=t._id,i=a.charAt(0),o=t.title.font.size;if(t.title.hasOwnProperty("standoff"))n=t._depth+t.title.standoff+ue(t);else{if("multicategory"===t.type)n=t._depth;else{n=10+1.5*o+(t.linewidth?t.linewidth-1:0)}n+="x"===i?"top"===t.side?o*(t.showticklabels?1:0):o*(t.showticklabels?1.5:.5):"right"===t.side?o*(t.showticklabels?1:.5):o*(t.showticklabels?.5:0)}var l,s,c,f,p=N.getPxPosition(e,t);"x"===i?(s=t._offset+t._length/2,c="top"===t.side?p-n:p+n):(c=t._offset+t._length/2,s="right"===t.side?p+n:p-n,l={rotate:"-90",offset:0});if("multicategory"!==t.type){var h=t._selections[t._id+"tick"];if(f={selection:h,side:t.side},h&&h.node()&&h.node().parentNode){var g=d.getTranslate(h.node().parentNode);f.offsetLeft=g.x,f.offsetTop=g.y}t.title.hasOwnProperty("standoff")&&(f.pad=0)}return u.draw(e,a+"title",{propContainer:t,propName:t._name+".title.text",placeholder:r._dfltTitle[i],avoid:f,transform:l,attributes:{x:s,y:c,"text-anchor":"middle"}})}(e,t)})),l.syncOrAsync(W)}}function $(e){var n=p+(e||"tick");return w[n]||(w[n]=function(e,t){var n,r,a,i;e._selections[t].size()?(n=1/0,r=-1/0,a=1/0,i=-1/0,e._selections[t].each((function(){var e=de(this),t=d.bBox(e.node().parentNode);n=Math.min(n,t.top),r=Math.max(r,t.bottom),a=Math.min(a,t.left),i=Math.max(i,t.right)}))):(n=0,r=0,a=0,i=0);return{top:n,bottom:r,left:a,right:i,height:r-n,width:i-a}}(t,n)),w[n]}},N.getTickSigns=function(e){var t=e._id.charAt(0),n={x:"top",y:"right"}[t],r=e.side===n?1:-1,a=[-1,1,r,-r];return"inside"!==e.ticks==("x"===t)&&(a=a.map((function(e){return-e}))),e.side&&a.push({l:-1,t:-1,r:1,b:1}[e.side.charAt(0)]),a},N.makeTransTickFn=function(e){return"x"===e._id.charAt(0)?function(t){return s(e._offset+e.l2p(t.x),0)}:function(t){return s(0,e._offset+e.l2p(t.x))}},N.makeTransTickLabelFn=function(e){var t=function(e){var t=e.ticklabelposition||"",n=function(e){return-1!==t.indexOf(e)},r=n("top"),a=n("left"),i=n("right"),o=n("bottom"),l=n("inside"),s=o||a||r||i;if(!s&&!l)return[0,0];var c=e.side,u=s?(e.tickwidth||0)/2:0,f=3,d=e.tickfont?e.tickfont.size:12;(o||r)&&(u+=d*z,f+=(e.linewidth||0)/2);(a||i)&&(u+=(e.linewidth||0)/2,f+=3);l&&"top"===c&&(f-=d*(1-z));(a||r)&&(u=-u);"bottom"!==c&&"right"!==c||(f=-f);return[s?u:0,l?f:0]}(e),n=t[0],r=t[1];return"x"===e._id.charAt(0)?function(t){return s(n+e._offset+e.l2p(se(t)),r)}:function(t){return s(r,n+e._offset+e.l2p(se(t)))}},N.makeTickPath=function(e,t,n,r){r=void 0!==r?r:e.ticklen;var a=e._id.charAt(0),i=(e.linewidth||1)/2;return"x"===a?"M0,"+(t+i*n)+"v"+r*n:"M"+(t+i*n)+",0h"+r*n},N.makeLabelFns=function(e,t,n){var r=e.ticklabelposition||"",i=function(e){return-1!==r.indexOf(e)},o=i("top"),s=i("left"),c=i("right"),u=i("bottom")||s||o||c,f=i("inside"),d="inside"===r&&"inside"===e.ticks||!f&&"outside"===e.ticks&&"boundaries"!==e.tickson,p=0,h=0,g=d?e.ticklen:0;if(f?g*=-1:u&&(g=0),d&&(p+=g,n)){var v=l.deg2rad(n);p=g*Math.cos(v)+1,h=g*Math.sin(v)}e.showticklabels&&(d||e.showline)&&(p+=.2*e.tickfont.size);var m,y,x,b,_,w={labelStandoff:p+=(e.linewidth||1)/2*(f?-1:1),labelShift:h},k=0,T=e.side,M=e._id.charAt(0),A=e.tickangle;if("x"===M)b=(_=!f&&"bottom"===T||f&&"top"===T)?1:-1,f&&(b*=-1),m=h*b,y=t+p*b,x=_?1:-.2,90===Math.abs(A)&&(f?x+=E:x=-90===A&&"bottom"===T?z:90===A&&"top"===T?E:.5,k=E/2*(A/90)),w.xFn=function(e){return e.dx+m+k*e.fontSize},w.yFn=function(e){return e.dy+y+e.fontSize*x},w.anchorFn=function(e,t){if(u){if(s)return"end";if(c)return"start"}return a(t)&&0!==t&&180!==t?t*b<0!==f?"end":"start":"middle"},w.heightFn=function(t,n,r){return n<-60||n>60?-.5*r:"top"===e.side!==f?-r:0};else if("y"===M){if(b=(_=!f&&"left"===T||f&&"right"===T)?1:-1,f&&(b*=-1),m=p,y=h*b,x=0,f||90!==Math.abs(A)||(x=-90===A&&"left"===T||90===A&&"right"===T?z:.5),f){var L=a(A)?+A:0;if(0!==L){var S=l.deg2rad(L);k=Math.abs(Math.sin(S))*z*b,x=0}}w.xFn=function(e){return e.dx+t-(m+e.fontSize*x)*b+k*e.fontSize},w.yFn=function(e){return e.dy+y+e.fontSize*E},w.anchorFn=function(e,t){return a(t)&&90===Math.abs(t)?"middle":_?"end":"start"},w.heightFn=function(t,n,r){return"right"===e.side&&(n*=-1),n<-30?-r:n<30?-.5*r:0}}return w},N.drawTicks=function(e,t,n){n=n||{};var r=t._id+"tick",a=n.vals;"period"===t.ticklabelmode&&(a=a.slice()).shift();var i=n.layer.selectAll("path."+r).data(t.ticks?a:[],ce);i.exit().remove(),i.enter().append("path").classed(r,1).classed("ticks",1).classed("crisp",!1!==n.crisp).call(f.stroke,t.tickcolor).style("stroke-width",d.crispRound(e,t.tickwidth,1)+"px").attr("d",n.path),i.attr("transform",n.transFn)},N.drawGrid=function(e,t,n){n=n||{};var r=t._id+"grid",a=n.vals,i=n.counterAxis;if(!1===t.showgrid)a=[];else if(i&&N.shouldShowZeroLine(e,t,i))for(var o="array"===t.tickmode,l=0;lo||a.lefto||a.top+(t.tickangle?0:e.fontSize/4)1)for(r=1;r2*o}(a,t))return"date";var v="strict"!==n.autotypenumbers;return function(e,t){for(var n=e.length,r=f(n),a=0,o=0,l={},u=0;u2*a}(a,v)?"category":function(e,t){for(var n=e.length,r=0;r=2){var s,c,u="";if(2===o.length)for(s=0;s<2;s++)if(c=y(o[s])){u=h;break}var f=a("pattern",u);if(f===h)for(s=0;s<2;s++)(c=y(o[s]))&&(t.bounds[s]=o[s]=c-1);if(f)for(s=0;s<2;s++)switch(c=o[s],f){case h:if(!r(c))return void(t.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(t.enabled=!1);t.bounds[s]=o[s]=c;break;case g:if(!r(c))return void(t.enabled=!1);if((c=+c)<0||c>24)return void(t.enabled=!1);t.bounds[s]=o[s]=c}if(!1===n.autorange){var d=n.range;if(d[0]d[1])return void(t.enabled=!1)}else if(o[0]>d[0]&&o[1]r?1:-1:+(e.substr(1)||1)-+(t.substr(1)||1)},n.ref2id=function(e){return!!/^[xyz]/.test(e)&&e.split(" ")[0]}},{"../../registry":306,"./constants":262}],260:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){if("category"===t.type){var a,i=e.categoryarray,o=Array.isArray(i)&&i.length>0;o&&(a="array");var l,s=n("categoryorder",a);"array"===s&&(l=n("categoryarray")),o||"array"!==s||(s=t.categoryorder="trace"),"trace"===s?t._initialCategories=[]:"array"===s?t._initialCategories=l.slice():(l=function(e,t){var n,r,a,i=t.dataAttr||e._id.charAt(0),o={};if(t.axData)n=t.axData;else for(n=[],r=0;rr?a.substr(r):i.substr(n))+o:a+i+e*t:o}function v(e,t){for(var n=t._size,r=n.h/n.w,a={},i=Object.keys(e),o=0;oc*x)||k)for(n=0;nR&&FO&&(O=F);d/=(O-P)/(2*D),P=s.l2r(P),O=s.l2r(O),s.range=s._input.range=L=0?Math.min(e,.9):1/(1/Math.max(e,-.3)+3.222))}function N(e,t,n,r,a){return e.append("path").attr("class","zoombox").style({fill:t>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform",s(n,r)).attr("d",a+"Z")}function j(e,t,n){return e.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("transform",s(t,n)).attr("d","M0,0Z")}function B(e,t,n,r,a,i){e.attr("d",r+"M"+n.l+","+n.t+"v"+n.h+"h"+n.w+"v-"+n.h+"h-"+n.w+"Z"),H(e,t,a,i)}function H(e,t,n,r){n||(e.transition().style("fill",r>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),t.transition().style("opacity",1).duration(200))}function U(e){r.select(e).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function q(e){O&&e.data&&e._context.showTips&&(l.notifier(l._(e,"Double-click to zoom back out"),"long"),O=!1)}function V(e){var t=Math.floor(Math.min(e.b-e.t,e.r-e.l,P)/2);return"M"+(e.l-3.5)+","+(e.t-.5+t)+"h3v"+-t+"h"+t+"v-3h-"+(t+3)+"ZM"+(e.r+3.5)+","+(e.t-.5+t)+"h-3v"+-t+"h"+-t+"v-3h"+(t+3)+"ZM"+(e.r+3.5)+","+(e.b+.5-t)+"h-3v"+t+"h"+-t+"v3h"+(t+3)+"ZM"+(e.l-3.5)+","+(e.b+.5-t)+"h3v"+t+"h"+t+"v3h-"+(t+3)+"Z"}function G(e,t,n,r,a){for(var i,o,s,c,u=!1,f={},d={},p=(a||{}).xaHash,h=(a||{}).yaHash,g=0;g=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(U(a),2!==e||ve||qe(),ge)i.indexOf("select")>-1&&A(n,a,W,J,t.id,Pe),i.indexOf("event")>-1&&d.click(a,n,t.id);else if(1===e&&ve){var l=h?D:O,s="s"===h||"w"===v?0:1,u=l._name+".range["+s+"]",f=function(e,t){var n,a=e.range[t],i=Math.abs(a-e.range[1-t]);return"date"===e.type?a:"log"===e.type?(n=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,r.format("."+n+"g")(Math.pow(10,a))):(n=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,r.format("."+String(n)+"g")(a))}(l,s),p="left",g="middle";if(l.fixedrange)return;h?(g="n"===h?"top":"bottom","right"===l.side&&(p="right")):"e"===v&&(p="right"),a._context.showAxisRangeEntryBoxes&&r.select(xe).call(c.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(f),fill:l.tickfont?l.tickfont.color:"#444",horizontalAlign:p,verticalAlign:g}).on("edit",(function(e){var t=l.d2r(e);void 0!==t&&o.call("_guiRelayout",a,u,t)}))}}}function Re(t,n){if(e._transitioningWithDuration)return!1;var r=Math.max(0,Math.min(K,de*t+be)),a=Math.max(0,Math.min(ee,pe*n+_e)),i=Math.abs(r-be),o=Math.abs(a-_e);function l(){Ae="",we.r=we.l,we.t=we.b,Se.attr("d","M0,0Z")}if(we.l=Math.min(be,r),we.r=Math.max(be,r),we.t=Math.min(_e,a),we.b=Math.max(_e,a),te.isSubplotConstrained)i>P||o>P?(Ae="xy",i/K>o/ee?(o=i*ee/K,_e>a?we.t=_e-o:we.b=_e+o):(i=o*K/ee,be>r?we.l=be-i:we.r=be+i),Se.attr("d",V(we))):l();else if(ne.isSubplotConstrained)if(i>P||o>P){Ae="xy";var s=Math.min(we.l/K,(ee-we.b)/ee),c=Math.max(we.r/K,(ee-we.t)/ee);we.l=s*K,we.r=c*K,we.b=(1-s)*ee,we.t=(1-c)*ee,Se.attr("d",V(we))}else l();else!ae||o0){var u;if(ne.isSubplotConstrained||!re&&1===ae.length){for(u=0;ug[1]-1/4096&&(t.domain=l),a.noneOrAll(e.domain,t.domain,l)}return n("layer"),t}},{"../../lib":210,"fast-isnumeric":17}],274:[function(e,t,n){"use strict";var r=e("../../constants/alignment").FROM_BL;t.exports=function(e,t,n){void 0===n&&(n=r[e.constraintoward||"center"]);var a=[e.r2l(e.range[0]),e.r2l(e.range[1])],i=a[0]+(a[1]-a[0])*n;e.range=e._input.range=[e.l2r(i+(a[0]-i)*t),e.l2r(i+(a[1]-i)*t)],e.setScale()}},{"../../constants/alignment":183}],275:[function(e,t,n){"use strict";var r=e("polybooljs"),a=e("../../registry"),i=e("../../components/drawing").dashStyle,o=e("../../components/color"),l=e("../../components/fx"),s=e("../../components/fx/helpers").makeEventData,c=e("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,d=c.drawMode,p=c.openMode,h=c.selectMode,g=e("../../components/shapes/draw_newshape/display_outlines"),v=e("../../components/shapes/draw_newshape/helpers").handleEllipse,m=e("../../components/shapes/draw_newshape/newshapes"),y=e("../../lib"),x=e("../../lib/polygon"),b=e("../../lib/throttle"),_=e("./axis_ids").getFromId,w=e("../../lib/clear_gl_canvases"),k=e("../../plot_api/subroutines").redrawReglTraces,T=e("./constants"),M=T.MINSELECT,A=x.filter,L=x.tester,S=e("./handle_outline").clearSelect,C=e("./helpers"),P=C.p2r,O=C.axValue,D=C.getTransform;function R(e,t,n,r,a,i,o){var l,s,c,u,f,d,h,v,m,y=t._hoverdata,x=t._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(e){return e&&Array.isArray(e)&&!0!==e[0].hoverOnBox}(y)){F(e,t,i);var _=function(e,t){var n,r,a=e[0],i=-1,o=[];for(r=0;r0?function(e,t){var n,r,a,i=[];for(a=0;a0&&i.push(n);if(1===i.length&&i[0]===t.searchInfo&&(r=t.searchInfo.cd[0].trace).selectedpoints.length===t.pointNumbers.length){for(a=0;a1)return!1;if((a+=n.selectedpoints.length)>1)return!1}return 1===a}(l)&&(d=B(_))){for(o&&o.remove(),m=0;m=0&&r._fullLayout._deactivateShape(r),d(t)){var i=r._fullLayout._zoomlayer.selectAll(".select-outline-"+n.id);if(i&&r._fullLayout._drawing){var o=m(i,e);o&&a.call("_guiRelayout",r,{shapes:o}),r._fullLayout._drawing=!1}}n.selection={},n.selection.selectionDefs=e.selectionDefs=[],n.selection.mergedPolygons=e.mergedPolygons=[]}function j(e,t,n,r){var a,i,o,l=[],s=t.map((function(e){return e._id})),c=n.map((function(e){return e._id}));for(o=0;o0?r[0]:n;return!!t.selectedpoints&&t.selectedpoints.indexOf(a)>-1}function H(e,t,n){var r,i,o,l;for(r=0;r=0)C._fullLayout._deactivateShape(C);else if(!_){var n=E.clickmode;b.done(ge).then((function(){if(b.clear(ge),2===e){for(fe.remove(),K=0;K-1&&R(t,C,a.xaxes,a.yaxes,a.subplot,a,fe),"event"===n&&C.emit("plotly_selected",void 0);l.click(C,t)})).catch(y.error)}},a.doneFn=function(){he.remove(),b.done(ge).then((function(){b.clear(ge),a.gd.emit("plotly_selected",te),$&&a.selectionDefs&&($.subtract=ue,a.selectionDefs.push($),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,Q)),a.doneFnCompleted&&a.doneFnCompleted(ve)})).catch(y.error),_&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:R}},{"../../components/color":81,"../../components/dragelement/helpers":99,"../../components/drawing":103,"../../components/fx":121,"../../components/fx/helpers":117,"../../components/shapes/draw_newshape/display_outlines":166,"../../components/shapes/draw_newshape/helpers":167,"../../components/shapes/draw_newshape/newshapes":168,"../../lib":210,"../../lib/clear_gl_canvases":196,"../../lib/polygon":222,"../../lib/throttle":232,"../../plot_api/subroutines":246,"../../registry":306,"./axis_ids":259,"./constants":262,"./handle_outline":266,"./helpers":267,polybooljs:54}],276:[function(e,t,n){"use strict";var r=e("d3"),a=e("d3-time-format").utcFormat,i=e("fast-isnumeric"),o=e("../../lib"),l=o.cleanNumber,s=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,d=e("../../constants/numerical"),p=d.FP_SAFE,h=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,x=d.ONEMIN,b=d.ONESEC,_=e("./axis_ids"),w=e("./constants"),k=w.HOUR_PATTERN,T=w.WEEKDAY_PATTERN;function M(e){return Math.pow(10,e)}function A(e){return null!=e}t.exports=function(e,t){t=t||{};var n=e._id||"x",d=n.charAt(0);function L(t,n){if(t>0)return Math.log(t)/Math.LN10;if(t<=0&&n&&e.range&&2===e.range.length){var r=e.range[0],a=e.range[1];return.5*(r+a-2*g*Math.abs(r-a))}return h}function S(t,n,r,a){if((a||{}).msUTC&&i(t))return+t;var l=c(t,r||e.calendar);if(l===h){if(!i(t))return h;t=+t;var s=Math.floor(10*o.mod(t+.05,1)),u=Math.round(t-s/10);l=c(new Date(u))+s/10}return l}function C(t,n,r){return s(t,n,r||e.calendar)}function P(t){return e._categories[Math.round(t)]}function O(t){if(A(t)){if(void 0===e._categoriesMap&&(e._categoriesMap={}),void 0!==e._categoriesMap[t])return e._categoriesMap[t];e._categories.push("number"==typeof t?String(t):t);var n=e._categories.length-1;return e._categoriesMap[t]=n,n}return h}function D(t){if(e._categoriesMap)return e._categoriesMap[t]}function R(e){var t=D(e);return void 0!==t?t:i(e)?+e:void 0}function E(e){return i(e)?+e:D(e)}function z(e,t,n){return r.round(n+t*e,2)}function I(e,t,n){return(e-n)/t}var F=function(t){return i(t)?z(t,e._m,e._b):h},N=function(t){return I(t,e._m,e._b)};if(e.rangebreaks){var j="y"===d;F=function(t){if(!i(t))return h;var n=e._rangebreaks.length;if(!n)return z(t,e._m,e._b);var r=j;e.range[0]>e.range[1]&&(r=!r);for(var a=r?-1:1,o=a*t,l=0,s=0;su)){l=o<(c+u)/2?s:s+1;break}l=s+1}var f=e._B[l]||0;return isFinite(f)?z(t,e._m2,f):0},N=function(t){var n=e._rangebreaks.length;if(!n)return I(t,e._m,e._b);for(var r=0,a=0;ae._rangebreaks[a].pmax&&(r=a+1);return I(t,e._m2,e._B[r])}}e.c2l="log"===e.type?L:u,e.l2c="log"===e.type?M:u,e.l2p=F,e.p2l=N,e.c2p="log"===e.type?function(e,t){return F(L(e,t))}:F,e.p2c="log"===e.type?function(e){return M(N(e))}:N,-1!==["linear","-"].indexOf(e.type)?(e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=l,e.c2d=e.c2r=e.l2d=e.l2r=u,e.d2p=e.r2p=function(t){return e.l2p(l(t))},e.p2d=e.p2r=N,e.cleanPos=u):"log"===e.type?(e.d2r=e.d2l=function(e,t){return L(l(e),t)},e.r2d=e.r2c=function(e){return M(l(e))},e.d2c=e.r2l=l,e.c2d=e.l2r=u,e.c2r=L,e.l2d=M,e.d2p=function(t,n){return e.l2p(e.d2r(t,n))},e.p2d=function(e){return M(N(e))},e.r2p=function(t){return e.l2p(l(t))},e.p2r=N,e.cleanPos=u):"date"===e.type?(e.d2r=e.r2d=o.identity,e.d2c=e.r2c=e.d2l=e.r2l=S,e.c2d=e.c2r=e.l2d=e.l2r=C,e.d2p=e.r2p=function(t,n,r){return e.l2p(S(t,0,r))},e.p2d=e.p2r=function(e,t,n){return C(N(e),t,n)},e.cleanPos=function(t){return o.cleanDate(t,h,e.calendar)}):"category"===e.type?(e.d2c=e.d2l=O,e.r2d=e.c2d=e.l2d=P,e.d2r=e.d2l_noadd=R,e.r2c=function(t){var n=E(t);return void 0!==n?n:e.fraction2r(.5)},e.l2r=e.c2r=u,e.r2l=E,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return P(N(e))},e.r2p=e.d2p,e.p2r=N,e.cleanPos=function(e){return"string"==typeof e&&""!==e?e:u(e)}):"multicategory"===e.type&&(e.r2d=e.c2d=e.l2d=P,e.d2r=e.d2l_noadd=R,e.r2c=function(t){var n=R(t);return void 0!==n?n:e.fraction2r(.5)},e.r2c_just_indices=D,e.l2r=e.c2r=u,e.r2l=R,e.d2p=function(t){return e.l2p(e.r2c(t))},e.p2d=function(e){return P(N(e))},e.r2p=e.d2p,e.p2r=N,e.cleanPos=function(e){return Array.isArray(e)||"string"==typeof e&&""!==e?e:u(e)},e.setupMultiCategory=function(r){var a,i,l=e._traceIndices,s=e._matchGroup;if(s&&0===e._categories.length)for(var c in s)if(c!==n){var u=t[_.id2name(c)];l=l.concat(u._traceIndices)}var p=[[0,{}],[0,{}]],h=[];for(a=0;ap&&(l[r]=p),l[0]===l[1]){var c=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=c,l[1]+=c}}else o.nestedProperty(e,t).set(a)},e.setScale=function(n){var r=t._size;if(e.overlaying){var a=_.getFromId({_fullLayout:t},e.overlaying);e.domain=a.domain}var i=n&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var l,s,c=e.r2l(e[i][0],o),u=e.r2l(e[i][1],o),f="y"===d;if((f?(e._offset=r.t+(1-e.domain[1])*r.h,e._length=r.h*(e.domain[1]-e.domain[0]),e._m=e._length/(c-u),e._b=-e._m*u):(e._offset=r.l+e.domain[0]*r.w,e._length=r.w*(e.domain[1]-e.domain[0]),e._m=e._length/(u-c),e._b=-e._m*c),e._rangebreaks=[],e._lBreaks=0,e._m2=0,e._B=[],e.rangebreaks)&&(e._rangebreaks=e.locateBreaks(Math.min(c,u),Math.max(c,u)),e._rangebreaks.length)){for(l=0;lu&&(p=!p),p&&e._rangebreaks.reverse();var h=p?-1:1;for(e._m2=h*e._length/(Math.abs(u-c)-e._lBreaks),e._B.push(-e._m2*(f?u:c)),l=0;la&&(a+=7,ia&&(a+=24,i=r&&i=r&&t=l.min&&(el.max&&(l.max=r),a=!1)}a&&c.push({min:e,max:r})}};for(r=0;rn.duration?(!function(){for(var n={},r=0;r rect").call(o.setTranslate,0,0).call(o.setScale,1,1),e.plot.call(o.setTranslate,t._offset,n._offset).call(o.setScale,1,1);var r=e.plot.selectAll(".scatterlayer .trace");r.selectAll(".point").call(o.setPointGroupScale,1,1),r.selectAll(".textpoint").call(o.setTextPointsScale,1,1),r.call(o.hideOutsideRangePoints,e)}function v(t,n){var r=t.plotinfo,a=r.xaxis,s=r.yaxis,c=a._length,u=s._length,f=!!t.xr1,d=!!t.yr1,p=[];if(f){var h=i.simpleMap(t.xr0,a.r2l),g=i.simpleMap(t.xr1,a.r2l),v=h[1]-h[0],m=g[1]-g[0];p[0]=(h[0]*(1-n)+n*g[0]-h[0])/(h[1]-h[0])*c,p[2]=c*(1-n+n*m/v),a.range[0]=a.l2r(h[0]*(1-n)+n*g[0]),a.range[1]=a.l2r(h[1]*(1-n)+n*g[1])}else p[0]=0,p[2]=c;if(d){var y=i.simpleMap(t.yr0,s.r2l),x=i.simpleMap(t.yr1,s.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-n)+n*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-n+n*_/b),s.range[0]=a.l2r(y[0]*(1-n)+n*x[0]),s.range[1]=s.l2r(y[1]*(1-n)+n*x[1])}else p[1]=0,p[3]=u;l.drawOne(e,a,{skipTitle:!0}),l.drawOne(e,s,{skipTitle:!0}),l.redrawComponents(e,[a._id,s._id]);var w=f?c/p[2]:1,k=d?u/p[3]:1,T=f?p[0]:0,M=d?p[1]:0,A=f?p[0]/p[2]*c:0,L=d?p[1]/p[3]*u:0,S=a._offset-A,C=s._offset-L;r.clipRect.call(o.setTranslate,T,M).call(o.setScale,1/w,1/k),r.plot.call(o.setTranslate,S,C).call(o.setScale,w,k),o.setPointGroupScale(r.zoomScalePts,1/w,1/k),o.setTextPointsScale(r.zoomScaleTxt,1/w,1/k)}l.redrawComponents(e)}},{"../../components/drawing":103,"../../lib":210,"../../registry":306,"./axes":256,d3:15}],281:[function(e,t,n){"use strict";var r=e("../../registry").traceIs,a=e("./axis_autotype");function i(e){return{v:"x",h:"y"}[e.orientation||"v"]}function o(e,t){var n=i(e),a=r(e,"box-violin"),o=r(e._fullInput||{},"candlestick");return a&&!o&&t===n&&void 0===e[n]&&void 0===e[n+"0"]}t.exports=function(e,t,n,l){n("autotypenumbers",l.autotypenumbersDflt),"-"===n("type",(l.splomStash||{}).type)&&(!function(e,t){if("-"!==e.type)return;var n,l=e._id,s=l.charAt(0);-1!==l.indexOf("scene")&&(l=s);var c=function(e,t,n){for(var r=0;r0&&(a["_"+n+"axes"]||{})[t])return a;if((a[n+"axis"]||n)===t){if(o(a,n))return a;if((a[n]||[]).length||a[n+"0"])return a}}}(t,l,s);if(!c)return;if("histogram"===c.type&&s==={v:"y",h:"x"}[c.orientation||"v"])return void(e.type="linear");var u=s+"calendar",f=c[u],d={noMultiCategory:!r(c,"cartesian")||r(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&s==={h:"x",v:"y"}[c.orientation||"v"]&&(d.noMultiCategory=!0);if(d.autotypenumbers=e.autotypenumbers,o(c,s)){var p=i(c),h=[];for(n=0;n0?".":"")+i;a.isPlainObject(o)?s(o,t,l,r+1):t(l,i,o)}}))}n.manageCommandObserver=function(e,t,r,o){var l={},s=!0;t&&t._commandObserver&&(l=t._commandObserver),l.cache||(l.cache={}),l.lookupTable={};var c=n.hasSimpleAPICommandBindings(e,r,l.lookupTable);if(t&&t._commandObserver){if(c)return l;if(t._commandObserver.remove)return t._commandObserver.remove(),t._commandObserver=null,l}if(c){i(e,c,l.cache),l.check=function(){if(s){var t=i(e,c,l.cache);return t.changed&&o&&void 0!==l.lookupTable[t.value]&&(l.disable(),Promise.resolve(o({value:t.value,type:c.type,prop:c.prop,traces:c.traces,index:l.lookupTable[t.value]})).then(l.enable,l.enable)),t.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f0&&a<0&&(a+=360);var l=(a-r)/4;return{type:"Polygon",coordinates:[[[r,i],[r,o],[r+l,o],[r+2*l,o],[r+3*l,o],[a,o],[a,i],[a-l,i],[a-2*l,i],[a-3*l,i],[r,i]]]}}t.exports=function(e){return new w(e)},k.plot=function(e,t,n){var r=this,a=t[this.id],i=[],o=!1;for(var l in y.layerNameToAdjective)if("frame"!==l&&a["show"+l]){o=!0;break}for(var s=0;s0&&i._module.calcGeoJSON(a,t)}if(!this.updateProjection(e,t)){this.viewInitial&&this.scope===n.scope||this.saveViewInitial(n),this.scope=n.scope,this.updateBaseLayers(t,n),this.updateDims(t,n),this.updateFx(t,n),u.generalUpdatePerTraceModule(this.graphDiv,this,e,n);var o=this.layers.frontplot.select(".scatterlayer");this.dataPoints.point=o.selectAll(".point"),this.dataPoints.text=o.selectAll("text"),this.dataPaths.line=o.selectAll(".js-line");var l=this.layers.backplot.select(".choroplethlayer");this.dataPaths.choropleth=l.selectAll("path"),this.render()}},k.updateProjection=function(e,t){var n=this.graphDiv,o=t[this.id],l=t._size,s=o.domain,c=o.projection,u=o.lonaxis,f=o.lataxis,p=u._ax,h=f._ax,g=this.projection=function(e){for(var t=e.projection.type,n=r.geo[y.projNames[t]](),a=e._isClipped?y.lonaxisSpan[t]/2:null,i=["center","rotate","parallels","clipExtent"],o=function(e){return e?n:[]},l=0;la*Math.PI/180}return!1},n.getPath=function(){return r.geo.path().projection(n)},n.getBounds=function(e){return n.getPath().bounds(e)},n.fitExtent=function(e,t){var r=e[1][0]-e[0][0],a=e[1][1]-e[0][1],i=n.clipExtent&&n.clipExtent();n.scale(150).translate([0,0]),i&&n.clipExtent(null);var o=n.getBounds(t),l=Math.min(r/(o[1][0]-o[0][0]),a/(o[1][1]-o[0][1])),s=+e[0][0]+(r-l*(o[1][0]+o[0][0]))/2,c=+e[0][1]+(a-l*(o[1][1]+o[0][1]))/2;return i&&n.clipExtent(i),n.scale(150*l).translate([s,c])},n.precision(y.precision),a&&n.clipAngle(a-y.clipPad);return n}(o),v=[[l.l+l.w*s.x[0],l.t+l.h*(1-s.y[1])],[l.l+l.w*s.x[1],l.t+l.h*(1-s.y[0])]],m=o.center||{},x=c.rotation||{},b=u.range||[],_=f.range||[];if(o.fitbounds){p._length=v[1][0]-v[0][0],h._length=v[1][1]-v[0][1],p.range=d(n,p),h.range=d(n,h);var w=(p.range[0]+p.range[1])/2,k=(h.range[0]+h.range[1])/2;if(o._isScoped)m={lon:w,lat:k};else if(o._isClipped){m={lon:w,lat:k},x={lon:w,lat:k,roll:x.roll};var M=c.type,A=y.lonaxisSpan[M]/2||180,L=y.lataxisSpan[M]/2||90;b=[w-A,w+A],_=[k-L,k+L]}else m={lon:w,lat:k},x={lon:w,lat:x.lat,roll:x.roll}}g.center([m.lon-x.lon,m.lat-x.lat]).rotate([-x.lon,-x.lat,x.roll]).parallels(c.parallels);var S=T(b,_);g.fitExtent(v,S);var C=this.bounds=g.getBounds(S),P=this.fitScale=g.scale(),O=g.translate();if(!isFinite(C[0][0])||!isFinite(C[0][1])||!isFinite(C[1][0])||!isFinite(C[1][1])||isNaN(O[0])||isNaN(O[0])){for(var D=["fitbounds","projection.rotation","center","lonaxis.range","lataxis.range"],R="Invalid geo settings, relayout'ing to default view.",E={},z=0;z-1&&v(r.event,i,[n.xaxis],[n.yaxis],n.id,f),s.indexOf("event")>-1&&c.click(i,r.event))}))}function d(e){return n.projection.invert([e[0]+n.xaxis._offset,e[1]+n.yaxis._offset])}},k.makeFramework=function(){var e=this,t=e.graphDiv,n=t._fullLayout,a="clip"+n._uid+e.id;e.clipDef=n._clips.append("clipPath").attr("id",a),e.clipRect=e.clipDef.append("rect"),e.framework=r.select(e.container).append("g").attr("class","geo "+e.id).call(s.setClipUrl,a,t),e.project=function(t){var n=e.projection(t);return n?[n[0]-e.xaxis._offset,n[1]-e.yaxis._offset]:[null,null]},e.xaxis={_id:"x",c2p:function(t){return e.project(t)[0]}},e.yaxis={_id:"y",c2p:function(t){return e.project(t)[1]}},e.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},f.setConvert(e.mockAxis,n)},k.saveViewInitial=function(e){var t,n=e.center||{},r=e.projection,a=r.rotation||{};this.viewInitial={fitbounds:e.fitbounds,"projection.scale":r.scale},t=e._isScoped?{"center.lon":n.lon,"center.lat":n.lat}:e._isClipped?{"projection.rotation.lon":a.lon,"projection.rotation.lat":a.lat}:{"center.lon":n.lon,"center.lat":n.lat,"projection.rotation.lon":a.lon},i.extendFlat(this.viewInitial,t)},k.render=function(){var e,t=this.projection,n=t.getPath();function r(e){var n=t(e.lonlat);return n?o(n[0],n[1]):null}function a(e){return t.isLonLatOverEdges(e.lonlat)?"none":null}for(e in this.basePaths)this.basePaths[e].attr("d",n);for(e in this.dataPaths)this.dataPaths[e].attr("d",(function(e){return n(e.geojson)}));for(e in this.dataPoints)this.dataPoints[e].attr("display",a).attr("transform",r)}},{"../../components/color":81,"../../components/dragelement":100,"../../components/drawing":103,"../../components/fx":121,"../../lib":210,"../../lib/geo_location_utils":205,"../../lib/topojson_utils":234,"../../registry":306,"../cartesian/autorange":255,"../cartesian/axes":256,"../cartesian/select":275,"../plots":297,"./constants":286,"./projections":291,"./zoom":292,d3:15,"topojson-client":64}],288:[function(e,t,n){"use strict";var r=e("../../plots/get_data").getSubplotCalcData,a=e("../../lib").counterRegex,i=e("./geo"),o="geo",l=a(o),s={};s.geo={valType:"subplotid",dflt:o,editType:"calc"},t.exports={attr:o,name:o,idRoot:o,idRegex:l,attrRegex:l,attributes:s,layoutAttributes:e("./layout_attributes"),supplyLayoutDefaults:e("./layout_defaults"),plot:function(e){for(var t=e._fullLayout,n=e.calcdata,a=t._subplots.geo,l=0;l0&&P<0&&(P+=360);var O,D,R,E=(C+P)/2;if(!p){var z=h?f.projRotate:[E,0,0];O=n("projection.rotation.lon",z[0]),n("projection.rotation.lat",z[1]),n("projection.rotation.roll",z[2]),n("showcoastlines",!h&&y)&&(n("coastlinecolor"),n("coastlinewidth")),n("showocean",!!y&&void 0)&&n("oceancolor")}(p?(D=-96.6,R=38.7):(D=h?E:O,R=(S[0]+S[1])/2),n("center.lon",D),n("center.lat",R),g)&&n("projection.parallels",f.projParallels||[0,60]);n("projection.scale"),n("showland",!!y&&void 0)&&n("landcolor"),n("showlakes",!!y&&void 0)&&n("lakecolor"),n("showrivers",!!y&&void 0)&&(n("rivercolor"),n("riverwidth")),n("showcountries",h&&"usa"!==u&&y)&&(n("countrycolor"),n("countrywidth")),("usa"===u||"north america"===u&&50===c)&&(n("showsubunits",y),n("subunitcolor"),n("subunitwidth")),h||n("showframe",y)&&(n("framecolor"),n("framewidth")),n("bgcolor"),n("fitbounds")&&(delete t.projection.scale,h?(delete t.center.lon,delete t.center.lat):v?(delete t.center.lon,delete t.center.lat,delete t.projection.rotation.lon,delete t.projection.rotation.lat,delete t.lonaxis.range,delete t.lataxis.range):(delete t.center.lon,delete t.center.lat,delete t.projection.rotation.lon))}t.exports=function(e,t,n){a(e,t,n,{type:"geo",attributes:l,handleDefaults:c,fullData:n,partition:"y"})}},{"../../lib":210,"../get_data":293,"../subplot_defaults":304,"./constants":286,"./layout_attributes":289}],291:[function(e,t,n){"use strict";t.exports=function(e){function t(e,t){return{type:"Feature",id:e.id,properties:e.properties,geometry:n(e.geometry,t)}}function n(t,r){if(!t)return null;if("GeometryCollection"===t.type)return{type:"GeometryCollection",geometries:object.geometries.map((function(e){return n(e,r)}))};if(!c.hasOwnProperty(t.type))return null;var a=c[t.type];return e.geo.stream(t,r(a)),a.result()}e.geo.project=function(e,t){var a=t.stream;if(!a)throw new Error("not yet supported");return(e&&r.hasOwnProperty(e.type)?r[e.type]:n)(e,a)};var r={Feature:t,FeatureCollection:function(e,n){return{type:"FeatureCollection",features:e.features.map((function(e){return t(e,n)}))}}},a=[],i=[],o={point:function(e,t){a.push([e,t])},result:function(){var e=a.length?a.length<2?{type:"Point",coordinates:a[0]}:{type:"MultiPoint",coordinates:a}:null;return a=[],e}},l={lineStart:u,point:function(e,t){a.push([e,t])},lineEnd:function(){a.length&&(i.push(a),a=[])},result:function(){var e=i.length?i.length<2?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i}:null;return i=[],e}},s={polygonStart:u,lineStart:u,point:function(e,t){a.push([e,t])},lineEnd:function(){var e=a.length;if(e){do{a.push(a[0].slice())}while(++e<4);i.push(a),a=[]}},polygonEnd:u,result:function(){if(!i.length)return null;var e=[],t=[];return i.forEach((function(n){!function(e){if((t=e.length)<4)return!1;var t,n=0,r=e[t-1][1]*e[0][0]-e[t-1][0]*e[0][1];for(;++nr^p>r&&n<(d-c)*(r-u)/(p-u)+c&&(a=!a)}return a}(e[0],n))return e.push(t),!0}))||e.push([t])})),i=[],e.length?e.length>1?{type:"MultiPolygon",coordinates:e}:{type:"Polygon",coordinates:e[0]}:null}},c={Point:o,MultiPoint:o,LineString:l,MultiLineString:l,Polygon:s,MultiPolygon:s,Sphere:s};function u(){}var f=1e-6,d=Math.PI,p=d/2,h=(Math.sqrt(d),d/180),g=180/d;function v(e){return e>1?p:e<-1?-p:Math.asin(e)}function m(e){return e>1?0:e<-1?d:Math.acos(e)}var y=e.geo.projection,x=e.geo.projectionMutator;function b(e,t){var n=(2+p)*Math.sin(t);t/=2;for(var r=0,a=1/0;r<10&&Math.abs(a)>f;r++){var i=Math.cos(t);t-=a=(t+Math.sin(t)*(i+2)-n)/(2*i*(1+i))}return[2/Math.sqrt(d*(4+d))*e*(1+Math.cos(t)),2*Math.sqrt(d/(4+d))*Math.sin(t)]}e.geo.interrupt=function(t){var n,r=[[[[-d,0],[0,p],[d,0]]],[[[-d,0],[0,-p],[d,0]]]];function a(e,n){for(var a=n<0?-1:1,i=r[+(n<0)],o=0,l=i.length-1;oi[o][2][0];++o);var s=t(e-i[o][1][0],n);return s[0]+=t(i[o][1][0],a*n>a*i[o][0][1]?i[o][0][1]:n)[0],s}function i(){n=r.map((function(e){return e.map((function(e){var n,r=t(e[0][0],e[0][1])[0],a=t(e[2][0],e[2][1])[0],i=t(e[1][0],e[0][1])[1],o=t(e[1][0],e[1][1])[1];return i>o&&(n=i,i=o,o=n),[[r,i],[a,o]]}))}))}t.invert&&(a.invert=function(e,i){for(var o=n[+(i<0)],l=r[+(i<0)],s=0,u=o.length;s=0;--a){var p;o=180*(p=r[1][a])[0][0]/d,l=180*p[0][1]/d,c=180*p[1][1]/d,u=180*p[2][0]/d,f=180*p[2][1]/d;n.push(s([[u-t,f-t],[u-t,c+t],[o+t,c+t],[o+t,l-t]],30))}return{type:"Polygon",coordinates:[e.merge(n)]}}(),i)},a},o.lobes=function(e){return arguments.length?(r=e.map((function(e){return e.map((function(e){return[[e[0][0]*d/180,e[0][1]*d/180],[e[1][0]*d/180,e[1][1]*d/180],[e[2][0]*d/180,e[2][1]*d/180]]}))})),i(),o):r.map((function(e){return e.map((function(e){return[[180*e[0][0]/d,180*e[0][1]/d],[180*e[1][0]/d,180*e[1][1]/d],[180*e[2][0]/d,180*e[2][1]/d]]}))}))},o},b.invert=function(e,t){var n=.5*t*Math.sqrt((4+d)/d),r=v(n),a=Math.cos(r);return[e/(2/Math.sqrt(d*(4+d))*(1+a)),v((r+n*(a+2))/(2+p))]},(e.geo.eckert4=function(){return y(b)}).raw=b;var _=e.geo.azimuthalEqualArea.raw;function w(e,t){if(arguments.length<2&&(t=e),1===t)return _;if(t===1/0)return k;function n(n,r){var a=_(n/t,r);return a[0]*=e,a}return n.invert=function(n,r){var a=_.invert(n/e,r);return a[0]*=t,a},n}function k(e,t){return[e*Math.cos(t)/Math.cos(t/=2),2*Math.sin(t)]}function T(e,t){return[3*e/(2*d)*Math.sqrt(d*d/3-t*t),t]}function M(e,t){return[e,1.25*Math.log(Math.tan(d/4+.4*t))]}function A(e){return function(t){var n,r=e*Math.sin(t),a=30;do{t-=n=(t+Math.sin(t)-r)/(1+Math.cos(t))}while(Math.abs(n)>f&&--a>0);return t/2}}k.invert=function(e,t){var n=2*v(t/2);return[e*Math.cos(n/2)/Math.cos(n),n]},(e.geo.hammer=function(){var e=2,t=x(w),n=t(e);return n.coefficient=function(n){return arguments.length?t(e=+n):e},n}).raw=w,T.invert=function(e,t){return[2/3*d*e/Math.sqrt(d*d/3-t*t),t]},(e.geo.kavrayskiy7=function(){return y(T)}).raw=T,M.invert=function(e,t){return[e,2.5*Math.atan(Math.exp(.8*t))-.625*d]},(e.geo.miller=function(){return y(M)}).raw=M,A(d);var L=function(e,t,n){var r=A(n);function a(n,a){return[e*n*Math.cos(a=r(a)),t*Math.sin(a)]}return a.invert=function(r,a){var i=v(a/t);return[r/(e*Math.cos(i)),v((2*i+Math.sin(2*i))/n)]},a}(Math.SQRT2/p,Math.SQRT2,d);function S(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),t*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}(e.geo.mollweide=function(){return y(L)}).raw=L,S.invert=function(e,t){var n,r=t,a=25;do{var i=r*r,o=i*i;r-=n=(r*(1.007226+i*(.015085+o*(.028874*i-.044475-.005916*o)))-t)/(1.007226+i*(.045255+o*(.259866*i-.311325-.005916*11*o)))}while(Math.abs(n)>f&&--a>0);return[e/(.8707+(i=r*r)*(i*(i*i*i*(.003971-.001529*i)-.013791)-.131979)),r]},(e.geo.naturalEarth=function(){return y(S)}).raw=S;var C=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];function P(e,t){var n,r=Math.min(18,36*Math.abs(t)/d),a=Math.floor(r),i=r-a,o=(n=C[a])[0],l=n[1],s=(n=C[++a])[0],c=n[1],u=(n=C[Math.min(19,++a)])[0],f=n[1];return[e*(s+i*(u-o)/2+i*i*(u-2*s+o)/2),(t>0?p:-p)*(c+i*(f-l)/2+i*i*(f-2*c+l)/2)]}function O(e,t){return[e*Math.cos(t),t]}function D(e,t){var n,r=Math.cos(t),a=(n=m(r*Math.cos(e/=2)))?n/Math.sin(n):1;return[2*r*Math.sin(e)*a,Math.sin(t)*a]}function R(e,t){var n=D(e,t);return[(n[0]+e/p)/2,(n[1]+t)/2]}C.forEach((function(e){e[1]*=1.0144})),P.invert=function(e,t){var n=t/p,r=90*n,a=Math.min(18,Math.abs(r/5)),i=Math.max(0,Math.floor(a));do{var o=C[i][1],l=C[i+1][1],s=C[Math.min(19,i+2)][1],c=s-o,u=s-2*l+o,f=2*(Math.abs(n)-l)/c,d=u/c,v=f*(1-d*f*(1-2*d*f));if(v>=0||1===i){r=(t>=0?5:-5)*(v+a);var m,y=50;do{v=(a=Math.min(18,Math.abs(r)/5))-(i=Math.floor(a)),o=C[i][1],l=C[i+1][1],s=C[Math.min(19,i+2)][1],r-=(m=(t>=0?p:-p)*(l+v*(s-o)/2+v*v*(s-2*l+o)/2)-t)*g}while(Math.abs(m)>1e-12&&--y>0);break}}while(--i>=0);var x=C[i][0],b=C[i+1][0],_=C[Math.min(19,i+2)][0];return[e/(b+v*(_-x)/2+v*v*(_-2*b+x)/2),r*h]},(e.geo.robinson=function(){return y(P)}).raw=P,O.invert=function(e,t){return[e/Math.cos(t),t]},(e.geo.sinusoidal=function(){return y(O)}).raw=O,D.invert=function(e,t){if(!(e*e+4*t*t>d*d+f)){var n=e,r=t,a=25;do{var i,o=Math.sin(n),l=Math.sin(n/2),s=Math.cos(n/2),c=Math.sin(r),u=Math.cos(r),p=Math.sin(2*r),h=c*c,g=u*u,v=l*l,y=1-g*s*s,x=y?m(u*s)*Math.sqrt(i=1/y):i=0,b=2*x*u*l-e,_=x*c-t,w=i*(g*v+x*u*s*h),k=i*(.5*o*p-2*x*c*l),T=.25*i*(p*l-x*c*g*o),M=i*(h*s+x*v*u),A=k*T-M*w;if(!A)break;var L=(_*k-b*M)/A,S=(b*T-_*w)/A;n-=L,r-=S}while((Math.abs(L)>f||Math.abs(S)>f)&&--a>0);return[n,r]}},(e.geo.aitoff=function(){return y(D)}).raw=D,R.invert=function(e,t){var n=e,r=t,a=25;do{var i,o=Math.cos(r),l=Math.sin(r),s=Math.sin(2*r),c=l*l,u=o*o,d=Math.sin(n),h=Math.cos(n/2),g=Math.sin(n/2),v=g*g,y=1-u*h*h,x=y?m(o*h)*Math.sqrt(i=1/y):i=0,b=.5*(2*x*o*g+n/p)-e,_=.5*(x*l+r)-t,w=.5*i*(u*v+x*o*h*c)+.5/p,k=i*(d*s/4-x*l*g),T=.125*i*(s*g-x*l*u*d),M=.5*i*(c*h+x*v*o)+.5,A=k*T-M*w,L=(_*k-b*M)/A,S=(b*T-_*w)/A;n-=L,r-=S}while((Math.abs(L)>f||Math.abs(S)>f)&&--a>0);return[n,r]},(e.geo.winkel3=function(){return y(R)}).raw=R}},{}],292:[function(e,t,n){"use strict";var r=e("d3"),a=e("../../lib"),i=e("../../registry"),o=Math.PI/180,l=180/Math.PI,s={cursor:"pointer"},c={cursor:"auto"};function u(e,t){return r.behavior.zoom().translate(t.translate()).scale(t.scale())}function f(e,t,n){var r=e.id,o=e.graphDiv,l=o.layout,s=l[r],c=o._fullLayout,u=c[r],f={},d={};function p(e,t){f[r+"."+e]=a.nestedProperty(s,e).get(),i.call("_storeDirectGUIEdit",l,c._preGUI,f);var n=a.nestedProperty(u,e);n.get()!==t&&(n.set(t),a.nestedProperty(s,e).set(t),d[r+"."+e]=t)}n(p),p("projection.scale",t.scale()/e.fitScale),p("fitbounds",!1),o.emit("plotly_relayout",d)}function d(e,t){var n=u(0,t);function a(n){var r=t.invert(e.midPt);n("center.lon",r[0]),n("center.lat",r[1])}return n.on("zoomstart",(function(){r.select(this).style(s)})).on("zoom",(function(){t.scale(r.event.scale).translate(r.event.translate),e.render();var n=t.invert(e.midPt);e.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":t.scale()/e.fitScale,"geo.center.lon":n[0],"geo.center.lat":n[1]})})).on("zoomend",(function(){r.select(this).style(c),f(e,t,a)})),n}function p(e,t){var n,a,i,o,l,d,p,h,g,v=u(0,t);function m(e){return t.invert(e)}function y(n){var r=t.rotate(),a=t.invert(e.midPt);n("projection.rotation.lon",-r[0]),n("center.lon",a[0]),n("center.lat",a[1])}return v.on("zoomstart",(function(){r.select(this).style(s),n=r.mouse(this),a=t.rotate(),i=t.translate(),o=a,l=m(n)})).on("zoom",(function(){if(d=r.mouse(this),function(e){var n=m(e);if(!n)return!0;var r=t(n);return Math.abs(r[0]-e[0])>2||Math.abs(r[1]-e[1])>2}(n))return v.scale(t.scale()),void v.translate(t.translate());t.scale(r.event.scale),t.translate([i[0],r.event.translate[1]]),l?m(d)&&(h=m(d),p=[o[0]+(h[0]-l[0]),a[1],a[2]],t.rotate(p),o=p):l=m(n=d),g=!0,e.render();var s=t.rotate(),c=t.invert(e.midPt);e.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":t.scale()/e.fitScale,"geo.center.lon":c[0],"geo.center.lat":c[1],"geo.projection.rotation.lon":-s[0]})})).on("zoomend",(function(){r.select(this).style(c),g&&f(e,t,y)})),v}function h(e,t){var n,a={r:t.rotate(),k:t.scale()},i=u(0,t),o=function(e){var t=0,n=arguments.length,a=[];for(;++th?(i=(f>0?90:-90)-p,a=0):(i=Math.asin(f/h)*l-p,a=Math.sqrt(h*h-f*f));var g=180-i-2*p,v=(Math.atan2(d,u)-Math.atan2(c,a))*l,m=(Math.atan2(d,u)-Math.atan2(c,-a))*l;return b(n[0],n[1],i,v)<=b(n[0],n[1],g,m)?[i,v,n[2]]:[g,m,n[2]]}function b(e,t,n,r){var a=_(n-e),i=_(r-t);return Math.sqrt(a*a+i*i)}function _(e){return(e%360+540)%360-180}function w(e,t,n){var r=n*o,a=e.slice(),i=0===t?1:0,l=2===t?1:2,s=Math.cos(r),c=Math.sin(r);return a[i]=e[i]*s-e[l]*c,a[l]=e[l]*s+e[i]*c,a}function k(e){return[Math.atan2(2*(e[0]*e[1]+e[2]*e[3]),1-2*(e[1]*e[1]+e[2]*e[2]))*l,Math.asin(Math.max(-1,Math.min(1,2*(e[0]*e[2]-e[3]*e[1]))))*l,Math.atan2(2*(e[0]*e[3]+e[1]*e[2]),1-2*(e[2]*e[2]+e[3]*e[3]))*l]}function T(e,t){for(var n=0,r=0,a=e.length;r=t.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=t._paper.attr("width")-7),n.attr(i);var o=n.select(".js-link-to-tool"),l=n.select(".js-link-spacer"),s=n.select(".js-sourcelinks");e._context.showSources&&e._context.showSources(e),e._context.showLink&&function(e,t){t.text("");var n=t.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(e._context.linkText+" "+String.fromCharCode(187));if(e._context.sendData)n.on("click",(function(){x.sendDataToCloud(e)}));else{var r=window.location.pathname.split("/"),a=window.location.search;n.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+r[2].split(".")[0]+"/"+r[1]+a})}}(e,o),l.text(o.text()&&s.text()?" - ":"")}},x.sendDataToCloud=function(e){var t=(window.PLOTLYENV||{}).BASE_URL||e._context.plotlyServerURL;if(t){e.emit("plotly_beforeexport");var n=r.select(e).append("div").attr("id","hiddenform").style("display","none"),a=n.append("form").attr({action:t+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(e,!1,"keepdata"),a.node().submit(),n.remove(),e.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],k=["year","month","dayMonth","dayMonthYear"];function T(e,t){var n=e._context.locale;n||(n="en-US");var r=!1,a={};function i(e){for(var n=!0,i=0;i1&&E.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,s),l=0;l15&&E.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"),x.linkSubplots(d,s,f,i),x.cleanPlot(d,s,f,i);var j=!(!i._has||!i._has("gl2d")),B=!(!s._has||!s._has("gl2d")),H=!(!i._has||!i._has("cartesian"))||j,U=!(!s._has||!s._has("cartesian"))||B;H&&!U?i._bgLayer.remove():U&&!H&&(s._shouldCreateBgLayer=!0),i._zoomlayer&&!e._dragging&&p({_fullLayout:i}),function(e,t){var n,r=[];t.meta&&(n=t._meta={meta:t.meta,layout:{meta:t.meta}});for(var a=0;a0){var f=1-2*l;r=Math.round(f*r),a=Math.round(f*a)}}var d=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;r1,g=!t.height&&Math.abs(n.height-a)>1;(g||h)&&(h&&(n.width=r),g&&(n.height=a)),e._initialAutoSize||(e._initialAutoSize={width:r,height:a}),x.sanitizeMargins(n)},x.supplyLayoutModuleDefaults=function(e,t,n,r){var a,i,l,s=o.componentsRegistry,u=t._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in s)(l=s[a]).includeBasePlot&&l.includeBasePlot(e,t);for(var d in u.length||u.push(f),t._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(e,t),f.finalizeSubplots(e,t)),t._subplots)t._subplots[d].sort(c.subplotSort);for(i=0;i1&&(n.l/=d,n.r/=d);var p=(n.t+n.b)/l;p>1&&(n.t/=p,n.b/=p);var h=void 0!==n.xl?n.xl:n.x,g=void 0!==n.xr?n.xr:n.x,v=void 0!==n.yt?n.yt:n.y,m=void 0!==n.yb?n.yb:n.y;s[t]={l:{val:h,size:n.l+u},r:{val:g,size:n.r+u},b:{val:m,size:n.b+u},t:{val:v,size:n.t+u}},c[t]=1}else delete s[t],delete c[t];if(!r._replotting)return x.doAutoMargin(e)}},x.doAutoMargin=function(e){var t=e._fullLayout,n=t.width,r=t.height,a=Math.max(0,n-64),l=Math.max(0,r-64);t._size||(t._size={}),C(t);var s=t._size,u=t.margin,f=c.extendFlat({},s),p=u.l,h=u.r,g=u.t,v=u.b,m=t._pushmargin,y=t._pushmarginIds;if(!1!==t.margin.autoexpand){for(var b in m)y[b]||delete m[b];for(var _ in m.base={l:{val:0,size:p},r:{val:1,size:h},t:{val:1,size:g},b:{val:0,size:v}},m){var w=m[_].l||{},k=m[_].b||{},T=w.val,M=w.size,A=k.val,L=k.size;for(var S in m){if(i(M)&&m[S].r){var P=m[S].r.val,O=m[S].r.size;if(P>T){var D=(M*P+(O-n)*T)/(P-T),R=(O*(1-T)+(M-n)*(1-P))/(P-T);D+R>p+h&&(p=D,h=R)}}if(i(L)&&m[S].t){var E=m[S].t.val,z=m[S].t.size;if(E>A){var I=(L*E+(z-r)*A)/(E-A),F=(z*(1-A)+(L-r)*(1-E))/(E-A);I+F>v+g&&(v=I,g=F)}}}}}var N=(p+h)/a;N>1&&(p/=N,h/=N);var j=(v+g)/l;if(j>1&&(v/=j,g/=j),s.l=Math.round(p),s.r=Math.round(h),s.t=Math.round(g),s.b=Math.round(v),s.p=Math.round(u.pad),s.w=Math.round(n)-s.l-s.r,s.h=Math.round(r)-s.t-s.b,!t._replotting&&x.didMarginChange(f,s)){"_redrawFromAutoMarginCount"in t?t._redrawFromAutoMarginCount++:t._redrawFromAutoMarginCount=1;var B=3*(1+Object.keys(y).length);if(t._redrawFromAutoMarginCount0&&(e._transitioningWithDuration=!0),e._transitionData._interruptCallbacks.push((function(){r=!0})),n.redraw&&e._transitionData._interruptCallbacks.push((function(){return o.call("redraw",e)})),e._transitionData._interruptCallbacks.push((function(){e.emit("plotly_transitioninterrupted",[])}));var i=0,l=0;function s(){return i++,function(){l++,r||l!==i||function(t){if(!e._transitionData)return;(function(e){if(e)for(;e.length;)e.shift()})(e._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(n.redraw)return o.call("redraw",e)})).then((function(){e._transitioning=!1,e._transitioningWithDuration=!1,e.emit("plotly_transitioned",[])})).then(t)}(a)}}n.runFn(s),setTimeout(s())}))}],i=c.syncOrAsync(a,e);return i&&i.then||(i=Promise.resolve()),i.then((function(){return e}))}x.didMarginChange=function(e,t){for(var n=0;n1)return!0}return!1},x.graphJson=function(e,t,n,r,a,i){(a&&t&&!e._fullData||a&&!t&&!e._fullLayout)&&x.supplyDefaults(e);var o=a?e._fullData:e.data,l=a?e._fullLayout:e.layout,s=(e._transitionData||{})._frames;function u(e,t){if("function"==typeof e)return t?"_function_":null;if(c.isPlainObject(e)){var r,a={};return Object.keys(e).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof e[i]){if("keepdata"===n){if("src"===i.substr(i.length-3))return}else if("keepstream"===n){if("string"==typeof(r=e[i+"src"])&&r.indexOf(":")>0&&!c.isPlainObject(e.stream))return}else if("keepall"!==n&&"string"==typeof(r=e[i+"src"])&&r.indexOf(":")>0)return;a[i]=u(e[i],t)}else t&&(a[i]="_function")})),a}return Array.isArray(e)?e.map((function(e){return u(e,t)})):c.isTypedArray(e)?c.simpleMap(e,c.identity):c.isJSDate(e)?c.ms2DateTimeLocal(+e):e}var f={data:(o||[]).map((function(e){var n=u(e);return t&&delete n.fit,n}))};if(!t&&(f.layout=u(l),a)){var d=l._size;f.layout.computed={margin:{b:d.b,l:d.l,r:d.r,t:d.t}}}return e.framework&&e.framework.isPolar&&(f=e.framework.getConfig()),s&&(f.frames=u(s)),i&&(f.config=u(e._context,!0)),"object"===r?f:JSON.stringify(f)},x.modifyFrames=function(e,t){var n,r,a,i=e._transitionData._frames,o=e._transitionData._frameHash;for(n=0;n=0;i--)if(l[i].enabled){n._indexToPoints=l[i]._indexToPoints;break}r&&r.calc&&(o=r.calc(e,n))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=n,h[t]=o}}for(R(s,u,p),a=0;a=0?d.angularAxis.domain:r.extent(k),S=Math.abs(k[1]-k[0]);M&&!T&&(S=0);var C=L.slice();A&&T&&(C[1]+=S);var P=d.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),d.angularAxis.ticksStep&&(P=(C[1]-C[0])/P);var O=d.angularAxis.ticksStep||(C[1]-C[0])/(P*(d.minorTicks+1));w&&(O=Math.max(Math.round(O),1)),C[2]||(C[2]=O);var D=r.range.apply(this,C);if(D=D.map((function(e,t){return parseFloat(e.toPrecision(12))})),l=r.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=A?S:0,"undefined"==typeof(e=r.select(this).select("svg.chart-root"))||e.empty()){var R=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),E=this.appendChild(this.ownerDocument.importNode(R.documentElement,!0));e=r.select(E)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var z,I=e.select(".chart-group"),F={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(e,t){return" "+e+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){z=e.select(".legend-group").attr({transform:"translate("+[x,d.margin.top]+")"}).style({display:"block"});var j=p.map((function(e,t){var n=o.util.cloneJson(e);return n.symbol="DotPlot"===e.geometry?e.dotType||"circle":"LinePlot"!=e.geometry?"square":"line",n.visibleInLegend="undefined"==typeof e.visibleInLegend||e.visibleInLegend,n.color="LinePlot"===e.geometry?e.strokeColor:e.color,n}));o.Legend().config({data:p.map((function(e,t){return e.name||"Element"+t})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:z,elements:j,reverseOrder:d.legend.reverseOrder})})();var B=z.node().getBBox();x=Math.min(d.width-B.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,x=Math.max(10,x),_=[d.margin.left+x,d.margin.top+x],n.range([0,x]),u.layout.radialAxis.domain=n.domain(),z.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else z=e.select(".legend-group").style({display:"none"});e.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),I.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(d.width-(d.margin.left+d.margin.right+2*x+(B?B.width:0)))/2,(d.height-(d.margin.top+d.margin.bottom+2*x))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),d.title&&d.title.text){var U=e.select("g.title-group text").style(N).text(d.title.text),q=U.node().getBBox();U.attr({x:_[0]-q.width/2,y:_[1]-x-20})}var V=e.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var G=V.selectAll("circle.grid-circle").data(n.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",n),G.exit().remove()}V.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:d.backgroundColor,stroke:d.stroke});function Y(e,t){return l(e)%360+d.orientation}if(d.radialAxis.visible){var X=r.svg.axis().scale(n).ticks(5).tickSize(5);V.call(X).attr({transform:"rotate("+d.radialAxis.orientation+")"}),V.selectAll(".domain").style(F),V.selectAll("g>text").text((function(e,t){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(e,t){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),V.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),J=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(e,t){return"rotate("+Y(e)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),W.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",(function(e,t){return t%(d.minorTicks+1)==0})).classed("minor",(function(e,t){return!(t%(d.minorTicks+1)==0)})).style(F),J.selectAll(".minor").style({stroke:d.minorTickColor}),W.select("line.grid-line").attr({x1:d.tickLength?x-d.tickLength:0,x2:x}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(N);var Q=W.select("text.axis-text").attr({x:x+d.labelOffset,dy:i+"em",transform:function(e,t){var n=Y(e),r=x+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?n<270&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(n<=180&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(e,t){return t%(d.minorTicks+1)!=0?"":w?w[e]+d.angularAxis.ticksSuffix:e+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&Q.text((function(e,t){return t%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,t)}));var $=r.max(I.selectAll(".angular-tick text")[0].map((function(e,t){return e.getCTM().e+e.getBBox().width})));z.attr({transform:"translate("+[x+$,d.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,ee=e.select("g.geometry-group").selectAll("g.geometry").data(p);if(ee.enter().append("g").attr({class:function(e,t){return"geometry geometry"+t}}),ee.exit().remove(),p[0]||K){var te=[];p.forEach((function(e,t){var r={};r.radialScale=n,r.angularScale=l,r.container=ee.filter((function(e,n){return n==t})),r.geometry=e.geometry,r.orientation=d.orientation,r.direction=d.direction,r.index=t,te.push({data:e,geometryConfig:r})}));var ne=r.nest().key((function(e,t){return"undefined"!=typeof e.data.groupId||"unstacked"})).entries(te),re=[];ne.forEach((function(e,t){"unstacked"===e.key?re=re.concat(e.values.map((function(e,t){return[e]}))):re.push(e.values)})),re.forEach((function(e,t){var n;n=Array.isArray(e)?e[0].geometryConfig.geometry:e.geometryConfig.geometry;var r=e.map((function(e,t){return a(o[n].defaultConfig(),e)}));o[n]().config(r)()}))}var ae,ie,oe=e.select(".guides-group"),le=e.select(".tooltips-group"),se=o.tooltipPanel().config({container:le,fontSize:8})(),ce=o.tooltipPanel().config({container:le,fontSize:8})(),ue=o.tooltipPanel().config({container:le,hasTick:!0})();if(!T){var fe=oe.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});I.on("mousemove.angular-guide",(function(e,t){var n=o.util.getMousePos(Z).angle;fe.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-d.orientation)%360;ae=l.invert(r);var a=o.util.convertToCartesian(x+12,n+180);se.text(o.util.round(ae)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(e,t){oe.select("line").style({opacity:0})}))}var de=oe.select("circle").style({stroke:"grey",fill:"none"});I.on("mousemove.radial-guide",(function(e,t){var r=o.util.getMousePos(Z).radius;de.attr({r:r}).style({opacity:.5}),ie=n.invert(o.util.getMousePos(Z).radius);var a=o.util.convertToCartesian(r,d.radialAxis.orientation);ce.text(o.util.round(ie)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(e,t){de.style({opacity:0}),ue.hide(),se.hide(),ce.hide()})),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(t,n){var a=r.select(this),i=this.style.fill,l="black",s=this.style.opacity||1;if(a.attr({"data-opacity":s}),i&&"none"!==i){a.attr({"data-fill":i}),l=r.hsl(i).darker().toString(),a.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};T&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),p=[f.left+f.width/2-H[0]-d.left,f.top+f.height/2-H[1]-d.top];ue.config({color:l}).text(u),ue.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),l=r.hsl(i).darker().toString(),a.style({stroke:l,opacity:1})})).on("mousemove.tooltip",(function(e,t){if(0!=r.event.which)return!1;r.select(this).attr("data-fill")&&ue.show()})).on("mouseout.tooltip",(function(e,t){ue.hide();var n=r.select(this),a=n.attr("data-fill");a?n.style({fill:a,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})}))}))}(c),this},d.config=function(e){if(!arguments.length)return s;var t=o.util.cloneJson(e);return t.data.forEach((function(e,t){s.data[t]||(s.data[t]={}),a(s.data[t],o.Axis.defaultConfig().data[0]),a(s.data[t],e)})),a(s.layout,o.Axis.defaultConfig().layout),a(s.layout,t.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(e){return n},d.angularScale=function(e){return l},d.svg=function(){return e},r.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(e,t){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:r.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(e,t){for(var n in e)n in t&&(t[n]=e[n])},o.util._extend=function(e,t){for(var n in e)t[n]=e[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(e,t){var n=t||6;return r.range(0,360+n,n).map((function(t,n){var r=t*Math.PI/180;return[t,e(r)]}))},o.util.dataFromEquation=function(e,t,n){var a=t||6,i=[],o=[];r.range(0,360+a,a).forEach((function(t,n){var r=t*Math.PI/180,a=e(r);i.push(t),o.push(a)}));var l={t:i,r:o};return n&&(l.name=n),l},o.util.ensureArray=function(e,t){if("undefined"==typeof e)return null;var n=[].concat(e);return r.range(t).map((function(e,t){return n[t]||n[0]}))},o.util.fillArrays=function(e,t,n){return t.forEach((function(t,r){e[t]=o.util.ensureArray(e[t],n)})),e},o.util.cloneJson=function(e){return JSON.parse(JSON.stringify(e))},o.util.validateKeys=function(e,t){"string"==typeof t&&(t=t.split("."));var n=t.shift();return e[n]&&(!t.length||objHasKeys(e[n],t))},o.util.sumArrays=function(e,t){return r.zip(e,t).map((function(e,t){return r.sum(e)}))},o.util.arrayLast=function(e){return e[e.length-1]},o.util.arrayEqual=function(e,t){for(var n=Math.max(e.length,t.length,1);n-- >=0&&e[n]===t[n];);return-2===n},o.util.flattenArray=function(e){for(var t=[];!o.util.arrayEqual(t,e);)t=e,e=[].concat.apply([],e);return e},o.util.deduplicate=function(e){return e.filter((function(e,t,n){return n.indexOf(e)==t}))},o.util.convertToCartesian=function(e,t){var n=t*Math.PI/180;return[e*Math.cos(n),e*Math.sin(n)]},o.util.round=function(e,t){var n=t||2,r=Math.pow(10,n);return Math.round(e*r)/r},o.util.getMousePos=function(e){var t=r.mouse(e.node()),n=t[0],a=t[1],i={};return i.x=n,i.y=a,i.pos=t,i.angle=180*(Math.atan2(a,n)+Math.PI)/Math.PI,i.radius=Math.sqrt(n*n+a*a),i},o.util.duplicatesCount=function(e){for(var t,n={},r={},a=0,i=e.length;a0)){var s=r.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({class:"line",d:u(l),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(e,t){return h.fill(n,a,i)},"fill-opacity":0,stroke:function(e,t){return h.stroke(n,a,i)},"stroke-width":function(e,t){return h["stroke-width"](n,a,i)},"stroke-dasharray":function(e,t){return h["stroke-dasharray"](n,a,i)},opacity:function(e,t){return h.opacity(n,a,i)},display:function(e,t){return h.display(n,a,i)}})}};var f=t.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=r.svg.arc().startAngle((function(e){return-d/2})).endAngle((function(e){return d/2})).innerRadius((function(e){return t.radialScale(s+(e[2]||0))})).outerRadius((function(e){return t.radialScale(s+(e[2]||0))+t.radialScale(e[1])}));c.arc=function(e,n,a){r.select(this).attr({class:"mark arc",d:p,transform:function(e,n){return"rotate("+(t.orientation+l(e[0])+90)+")"}})};var h={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,r,a){return n[e[a].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},g=r.select(this).selectAll("g.layer").data(o);g.enter().append("g").attr({class:"layer"});var v=g.selectAll("path.mark").data((function(e,t){return e}));v.enter().append("path").attr({class:"mark"}),v.style(h).each(c[t.geometryType]),v.exit().remove(),g.exit().remove()}))}return i.config=function(t){return arguments.length?(t.forEach((function(t,n){e[n]||(e[n]={}),a(e[n],o.PolyChart.defaultConfig()),a(e[n],t)})),this):e},i.getColorScale=function(){},r.rebind(i,t,"on"),i},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:r.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 e=o.Legend.defaultConfig(),t=r.dispatch("hover");function n(){var t=e.legendConfig,i=e.data.map((function(e,n){return[].concat(e).map((function(e,r){var i=a({},t.elements[n]);return i.name=e,i.color=[].concat(t.elements[n].color)[r],i}))})),o=r.merge(i);o=o.filter((function(e,n){return t.elements[n]&&(t.elements[n].visibleInLegend||"undefined"==typeof t.elements[n].visibleInLegend)})),t.reverseOrder&&(o=o.reverse());var l=t.container;("string"==typeof l||l.nodeName)&&(l=r.select(l));var s=o.map((function(e,t){return e.color})),c=t.fontSize,u=null==t.isContinuous?"number"==typeof o[0]:t.isContinuous,f=u?t.height:c*o.length,d=l.classed("legend-group",!0).selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var h=r.range(o.length),g=r.scale[u?"linear":"ordinal"]().domain(h).range(s),v=r.scale[u?"linear":"ordinal"]().domain(h)[u?"range":"rangePoints"]([0,f]);if(u){var m=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);m.enter().append("stop"),m.attr({offset:function(e,t){return t/(s.length-1)*100+"%"}}).style({"stop-color":function(e,t){return e}}),d.append("rect").classed("legend-mark",!0).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(e,t){return"translate("+[c/2,v(t)+c/2]+")"},d:function(e,t){var n,a,i,o=e.symbol;return i=3*(a=c),"line"===(n=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=r.svg.symbolTypes.indexOf(n)?r.svg.symbol().type(n).size(i)():r.svg.symbol().type("square").size(i)()},fill:function(e,t){return g(t)}}),y.exit().remove()}var x=r.svg.axis().scale(v).orient("right"),b=d.select("g.legend-axis").attr({transform:"translate("+[u?t.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?t.textColor:"none"}),b.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text((function(e,t){return o[t].name})),n}return n.config=function(t){return arguments.length?(a(e,t),this):e},r.rebind(n,t,"on"),n},o.Legend.defaultConfig=function(e,t){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 e,t,n,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){var r=(e=i.container.selectAll("g."+l).data([0])).enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=r.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),t=r.append("text").attr({dx:i.padding+s,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=r.hsl(i.color).l,l=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=a||"";t.style({fill:u,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,p=t.node().getBBox(),h={fill:i.color,stroke:l,"stroke-width":"2px"},g=p.width+2*d+s,v=p.height+2*d;return n.attr({d:"M"+[[s,-v/2],[s,-v/4],[i.hasTick?0:s,0],[s,v/4],[s,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(h),e.attr({transform:"translate("+[s,-v/2+2*d]+")"}),e.style({display:"block"}),c},c.move=function(t){if(e)return e.attr({transform:"translate("+[t[0],t[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(e)return e.style({display:"none"}),c},c.show=function(){if(e)return e.style({display:"block"}),c},c.config=function(e){return a(i,e),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var e={convert:function(e,t){var n={};if(e.data&&(n.data=e.data.map((function(e,n){var r=a({},e);return[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]].forEach((function(e,n){o.util.translator.apply(null,e.concat(t))})),t||delete r.marker,t&&delete r.groupId,t?("LinePlot"===r.geometry?(r.type="scatter",!0===r.dotVisible?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r})),!t&&e.layout&&"stack"===e.layout.barmode)){var i=o.util.duplicates(n.data.map((function(e,t){return e.geometry})));n.data.forEach((function(e,t){var r=i.indexOf(e.geometry);-1!=r&&(n.data[t].groupId=r)}))}if(e.layout){var l=a({},e.layout);if([[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]].forEach((function(e,n){o.util.translator.apply(null,e.concat(t))})),t?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};r.entries(l.margin).forEach((function(e,t){u[c[s.indexOf(e.key)]]=e.value})),l.margin=u}t&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n}};return e}},{"../../../constants/alignment":183,"../../../lib":210,d3:15}],302:[function(e,t,n){"use strict";var r=e("d3"),a=e("../../../lib"),i=e("../../../components/color"),o=e("./micropolar"),l=e("./undo_manager"),s=a.extendDeepAll,c=t.exports={};c.framework=function(e){var t,n,a,i,u,f=new l;function d(n,l){return l&&(u=l),r.select(r.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),t=t?s(t,n):n,a||(a=o.Axis()),i=o.adapter.plotly().convert(t),a.config(i).render(u),e.data=t.data,e.layout=t.layout,c.fillLayout(e),t}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return t},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var e,r,a=this,i=o.util.cloneJson(t);e=i,r=n,f.add({undo:function(){r&&a(r)},redo:function(){a(e)}}),n=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},c.fillLayout=function(e){var t=r.select(e).selectAll(".plot-container"),n=t.selectAll(".svg-container"),a=e.framework&&e.framework.svg&&e.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:t,_paperdiv:n,_paper:a};e._fullLayout=s(o,e.layout)}},{"../../../components/color":81,"../../../lib":210,"./micropolar":301,"./undo_manager":303,d3:15}],303:[function(e,t,n){"use strict";t.exports=function(){var e,t=[],n=-1,r=!1;function a(e,t){return e?(r=!0,e[t](),r=!1,this):this}return{add:function(e){return r||(t.splice(n+1,t.length-n),t.push(e),n=t.length-1),this},setCallback:function(t){e=t},undo:function(){var r=t[n];return r?(a(r,"undo"),n-=1,e&&e(r.undo),this):this},redo:function(){var r=t[n+1];return r?(a(r,"redo"),n+=1,e&&e(r.redo),this):this},clear:function(){t=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n0){for(var r=[],a=0;a-1&&(f[p[n]].title={text:""});for(n=0;n")?"":t.html(e).text()}));return t.remove(),n}(k),k=(k=k.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(k=(k=(k=k.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),k}},{"../components/color":81,"../components/drawing":103,"../constants/xmlns_namespaces":188,"../lib":210,d3:15}],315:[function(e,t,n){"use strict";var r=e("../../plots/template_attributes").hovertemplateAttrs,a=e("../scattergeo/attributes"),i=e("../../components/colorscale/attributes"),o=e("../../plots/attributes"),l=e("../../components/color/attributes").defaultLine,s=e("../../lib/extend").extendFlat,c=a.marker.line;t.exports=s({locations:{valType:"data_array",editType:"calc"},locationmode:a.locationmode,z:{valType:"data_array",editType:"calc"},geojson:s({},a.geojson,{}),featureidkey:a.featureidkey,text:s({},a.text,{}),hovertext:s({},a.hovertext,{}),marker:{line:{color:s({},c.color,{dflt:l}),width:s({},c.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:a.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:a.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:s({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]}),hovertemplate:r(),showlegend:s({},o.showlegend,{dflt:!1})},i("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/color/attributes":80,"../../components/colorscale/attributes":88,"../../lib/extend":202,"../../plots/attributes":252,"../../plots/template_attributes":305,"../scattergeo/attributes":356}],316:[function(e,t,n){"use strict";var r=e("fast-isnumeric"),a=e("../../constants/numerical").BADNUM,i=e("../../components/colorscale/calc"),o=e("../scatter/arrays_to_calcdata"),l=e("../scatter/calc_selection");function s(e){return e&&"string"==typeof e}t.exports=function(e,t){var n,c=t._length,u=new Array(c);n=t.geojson?function(e){return s(e)||r(e)}:s;for(var f=0;f")}(e,f,o),[e]}},{"../../lib":210,"../../plots/cartesian/axes":256,"./attributes":315}],320:[function(e,t,n){"use strict";t.exports={attributes:e("./attributes"),supplyDefaults:e("./defaults"),colorbar:e("../heatmap/colorbar"),calc:e("./calc"),calcGeoJSON:e("./plot").calcGeoJSON,plot:e("./plot").plot,style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"choropleth",basePlotModule:e("../../plots/geo"),categories:["geo","noOpacity","showLegend"],meta:{}}},{"../../plots/geo":288,"../heatmap/colorbar":324,"./attributes":315,"./calc":316,"./defaults":317,"./event_data":318,"./hover":319,"./plot":321,"./select":322,"./style":323}],321:[function(e,t,n){"use strict";var r=e("d3"),a=e("../../lib"),i=e("../../lib/geo_location_utils"),o=e("../../lib/topojson_utils").getTopojsonFeatures,l=e("../../plots/cartesian/autorange").findExtremes,s=e("./style").style;t.exports={calcGeoJSON:function(e,t){for(var n=e[0].trace,r=t[n.geo],a=r._subplot,s=n.locationmode,c=n._length,u="geojson-id"===s?i.extractTraceFeature(e):o(n,a.topojson),f=[],d=[],p=0;ps&&S[m].gap;)m--;for(x=S[m].s,g=S.length-1;g>m;g--)S[g].s=x;for(;sA[u]&&u=0;a--){var i=e[a];if("scatter"===i.type&&i.xaxis===n.xaxis&&i.yaxis===n.yaxis){i.opacity=void 0;break}}}}}},{}],335:[function(e,t,n){"use strict";var r=e("../../lib"),a=e("../../registry"),i=e("./attributes"),o=e("./constants"),l=e("./subtypes"),s=e("./xy_defaults"),c=e("./period_defaults"),u=e("./stack_defaults"),f=e("./marker_defaults"),d=e("./line_defaults"),p=e("./line_shape_defaults"),h=e("./text_defaults"),g=e("./fillcolor_defaults");t.exports=function(e,t,n,v){function m(n,a){return r.coerce(e,t,i,n,a)}var y=s(e,t,v,m);if(y||(t.visible=!1),t.visible){c(e,t,v,m);var x=u(e,t,v,m),b=!x&&yG!=(F=D[P][1])>=G&&(E=D[P-1][0],z=D[P][0],F-I&&(R=E+(z-E)*(G-I)/(F-I),H=Math.min(H,R),U=Math.max(U,R)));H=Math.max(H,0),U=Math.min(U,d._length);var Z=l.defaultLine;return l.opacity(f.fillcolor)?Z=f.fillcolor:l.opacity((f.line||{}).color)&&(Z=f.line.color),r.extendFlat(e,{distance:e.maxHoverDistance,x0:H,x1:U,y0:G,y1:G,color:Z,hovertemplate:!1}),delete e.index,f.text&&!Array.isArray(f.text)?e.text=String(f.text):e.text=f.name,[e]}}}},{"../../components/color":81,"../../components/fx":121,"../../lib":210,"../../registry":306,"./get_trace_color":338}],340:[function(e,t,n){"use strict";var r=e("./subtypes");t.exports={hasLines:r.hasLines,hasMarkers:r.hasMarkers,hasText:r.hasText,isBubble:r.isBubble,attributes:e("./attributes"),supplyDefaults:e("./defaults"),crossTraceDefaults:e("./cross_trace_defaults"),calc:e("./calc").calc,crossTraceCalc:e("./cross_trace_calc"),arraysToCalcdata:e("./arrays_to_calcdata"),plot:e("./plot"),colorbar:e("./marker_colorbar"),formatLabels:e("./format_labels"),style:e("./style").style,styleOnSelect:e("./style").styleOnSelect,hoverPoints:e("./hover"),selectPoints:e("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:e("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":269,"./arrays_to_calcdata":327,"./attributes":328,"./calc":329,"./cross_trace_calc":333,"./cross_trace_defaults":334,"./defaults":335,"./format_labels":337,"./hover":339,"./marker_colorbar":346,"./plot":349,"./select":350,"./style":352,"./subtypes":353}],341:[function(e,t,n){"use strict";var r=e("../../lib").isArrayOrTypedArray,a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults");t.exports=function(e,t,n,o,l,s){var c=(e.marker||{}).color;(l("line.color",n),a(e,"line"))?i(e,t,o,l,{prefix:"line.",cLetter:"c"}):l("line.color",!r(c)&&c||n);l("line.width"),(s||{}).noDash||l("line.dash")}},{"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92,"../../lib":210}],342:[function(e,t,n){"use strict";var r=e("../../constants/numerical"),a=r.BADNUM,i=r.LOG_CLIP,o=i+.5,l=i-.5,s=e("../../lib"),c=s.segmentsIntersect,u=s.constrain,f=e("./constants");t.exports=function(e,t){var n,r,i,d,p,h,g,v,m,y,x,b,_,w,k,T,M,A,L=t.xaxis,S=t.yaxis,C="log"===L.type,P="log"===S.type,O=L._length,D=S._length,R=t.connectGaps,E=t.baseTolerance,z=t.shape,I="linear"===z,F=t.fill&&"none"!==t.fill,N=[],j=f.minTolerance,B=e.length,H=new Array(B),U=0;function q(n){var r=e[n];if(!r)return!1;var i=t.linearized?L.l2p(r.x):L.c2p(r.x),s=t.linearized?S.l2p(r.y):S.c2p(r.y);if(i===a){if(C&&(i=L.c2p(r.x,!0)),i===a)return!1;P&&s===a&&(i*=Math.abs(L._m*D*(L._m>0?o:l)/(S._m*O*(S._m>0?o:l)))),i*=1e3}if(s===a){if(P&&(s=S.c2p(r.y,!0)),s===a)return!1;s*=1e3}return[i,s]}function V(e,t,n,r){var a=n-e,i=r-t,o=.5-e,l=.5-t,s=a*a+i*i,c=a*o+i*l;if(c>0&&cne||e[1]ae)return[u(e[0],te,ne),u(e[1],re,ae)]}function le(e,t){return e[0]===t[0]&&(e[0]===te||e[0]===ne)||(e[1]===t[1]&&(e[1]===re||e[1]===ae)||void 0)}function se(e,t,n){return function(r,a){var i=oe(r),o=oe(a),l=[];if(i&&o&&le(i,o))return l;i&&l.push(i),o&&l.push(o);var c=2*s.constrain((r[e]+a[e])/2,t,n)-((i||r)[e]+(o||a)[e]);c&&((i&&o?c>0==i[e]>o[e]?i:o:i||o)[e]+=c);return l}}function ce(e){var t=e[0],n=e[1],r=t===H[U-1][0],a=n===H[U-1][1];if(!r||!a)if(U>1){var i=t===H[U-2][0],o=n===H[U-2][1];r&&(t===te||t===ne)&&i?o?U--:H[U-1]=e:a&&(n===re||n===ae)&&o?i?U--:H[U-1]=e:H[U++]=e}else H[U++]=e}function ue(e){H[U-1][0]!==e[0]&&H[U-1][1]!==e[1]&&ce([W,J]),ce(e),Q=null,W=J=0}function fe(e){if(M=e[0]/O,A=e[1]/D,Y=e[0]ne?ne:0,X=e[1]ae?ae:0,Y||X){if(U)if(Q){var t=K(Q,e);t.length>1&&(ue(t[0]),H[U++]=t[1])}else $=K(H[U-1],e)[0],H[U++]=$;else H[U++]=[Y||e[0],X||e[1]];var n=H[U-1];Y&&X&&(n[0]!==Y||n[1]!==X)?(Q&&(W!==Y&&J!==X?ce(W&&J?(r=Q,i=(a=e)[0]-r[0],o=(a[1]-r[1])/i,(r[1]*a[0]-a[1]*r[0])/i>0?[o>0?te:ne,ae]:[o>0?ne:te,re]):[W||Y,J||X]):W&&J&&ce([W,J])),ce([Y,X])):W-Y&&J-X&&ce([Y||W,X||J]),Q=e,W=Y,J=X}else Q&&ue(K(Q,e)[0]),H[U++]=e;var r,a,i,o}for("linear"===z||"spline"===z?K=function(e,t){for(var n=[],r=0,a=0;a<4;a++){var i=ie[a],o=c(e[0],e[1],t[0],t[1],i[0],i[1],i[2],i[3]);o&&(!r||Math.abs(o.x-n[0][0])>1||Math.abs(o.y-n[0][1])>1)&&(o=[o.x,o.y],r&&Z(o,e)G(h,de))break;i=h,(_=m[0]*v[0]+m[1]*v[1])>x?(x=_,d=h,g=!1):_=e.length||!h)break;fe(h),r=h}}else fe(d)}Q&&ce([W||Q[0],J||Q[1]]),N.push(H.slice(0,U))}return N}},{"../../constants/numerical":187,"../../lib":210,"./constants":332}],343:[function(e,t,n){"use strict";t.exports=function(e,t,n){"spline"===n("line.shape")&&n("line.smoothing")}},{}],344:[function(e,t,n){"use strict";var r={tonextx:1,tonexty:1,tonext:1};t.exports=function(e,t,n){var a,i,o,l,s,c={},u=!1,f=-1,d=0,p=-1;for(i=0;i=0?s=p:(s=p=d,d++),s0?Math.max(t,a):0}}},{"fast-isnumeric":17}],346:[function(e,t,n){"use strict";t.exports={container:"marker",min:"cmin",max:"cmax"}},{}],347:[function(e,t,n){"use strict";var r=e("../../components/color"),a=e("../../components/colorscale/helpers").hasColorscale,i=e("../../components/colorscale/defaults"),o=e("./subtypes");t.exports=function(e,t,n,l,s,c){var u=o.isBubble(e),f=(e.line||{}).color;(c=c||{},f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(e,"marker")&&i(e,t,l,s,{prefix:"marker.",cLetter:"c"}),c.noSelect||(s("selected.marker.color"),s("unselected.marker.color"),s("selected.marker.size"),s("unselected.marker.size")),c.noLine||(s("marker.line.color",f&&!Array.isArray(f)&&t.marker.color!==f?f:u?r.background:r.defaultLine),a(e,"marker.line")&&i(e,t,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0)),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient)&&("none"!==s("marker.gradient.type")&&s("marker.gradient.color"))}},{"../../components/color":81,"../../components/colorscale/defaults":91,"../../components/colorscale/helpers":92,"./subtypes":353}],348:[function(e,t,n){"use strict";var r=e("../../lib").dateTick0,a=e("../../constants/numerical").ONEWEEK;function i(e,t){return r(t,e%a==0?1:0)}t.exports=function(e,t,n,r,a){if(a||(a={x:!0,y:!0}),a.x){var o=r("xperiod");o&&(r("xperiod0",i(o,t.xcalendar)),r("xperiodalignment"))}if(a.y){var l=r("yperiod");l&&(r("yperiod0",i(l,t.ycalendar)),r("yperiodalignment"))}}},{"../../constants/numerical":187,"../../lib":210}],349:[function(e,t,n){"use strict";var r=e("d3"),a=e("../../registry"),i=e("../../lib"),o=i.ensureSingle,l=i.identity,s=e("../../components/drawing"),c=e("./subtypes"),u=e("./line_points"),f=e("./link_traces"),d=e("../../lib/polygon").tester;function p(e,t,n,f,p,h,g){var v;!function(e,t,n,a,o){var l=n.xaxis,s=n.yaxis,u=r.extent(i.simpleMap(l.range,l.r2c)),f=r.extent(i.simpleMap(s.range,s.r2c)),d=a[0].trace;if(!c.hasMarkers(d))return;var p=d.marker.maxdisplayed;if(0===p)return;var h=a.filter((function(e){return e.x>=u[0]&&e.x<=u[1]&&e.y>=f[0]&&e.y<=f[1]})),g=Math.ceil(h.length/p),v=0;o.forEach((function(e,n){var r=e[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&n0;function y(e){return m?e.transition():e}var x=n.xaxis,b=n.yaxis,_=f[0].trace,w=_.line,k=r.select(h),T=o(k,"g","errorbars"),M=o(k,"g","lines"),A=o(k,"g","points"),L=o(k,"g","text");if(a.getComponentMethod("errorbars","plot")(e,T,n,g),!0===_.visible){var S,C;y(k).style("opacity",_.opacity);var P=_.fill.charAt(_.fill.length-1);"x"!==P&&"y"!==P&&(P=""),f[0][n.isRangePlot?"nodeRangePlot3":"node3"]=k;var O,D,R="",E=[],z=_._prevtrace;z&&(R=z._prevRevpath||"",C=z._nextFill,E=z._polygons);var I,F,N,j,B,H,U,q="",V="",G=[],Z=i.noop;if(S=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(I=s.steps(w.shape),F=s.steps(w.shape.split("").reverse().join(""))):I=F="spline"===w.shape?function(e){var t=e[e.length-1];return e.length>1&&e[0][0]===t[0]&&e[0][1]===t[1]?s.smoothclosed(e.slice(1),w.smoothing):s.smoothopen(e,w.smoothing)}:function(e){return"M"+e.join("L")},N=function(e){return F(e.reverse())},G=u(f,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),U=_._polygons=new Array(G.length),v=0;v1){var n=r.select(this);if(n.datum(f),e)y(n.style("opacity",0).attr("d",O).call(s.lineGroupStyle)).style("opacity",1);else{var a=y(n);a.attr("d",O),s.singleLineStyle(f,a)}}}}}var Y=M.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(Z(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),s.setClipUrl(Y,n.layerClipId,e),G.length?(S?(S.datum(f),j&&H&&(P?("y"===P?j[1]=H[1]=b.c2p(0,!0):"x"===P&&(j[0]=H[0]=x.c2p(0,!0)),y(S).attr("d","M"+H+"L"+j+"L"+q.substr(1)).call(s.singleFillStyle)):y(S).attr("d",q+"Z").call(s.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&q&&R?("tonext"===_.fill?y(C).attr("d",q+"Z"+R+"Z").call(s.singleFillStyle):y(C).attr("d",q+"L"+R.substr(1)+"Z").call(s.singleFillStyle),_._polygons=_._polygons.concat(E)):(W(C),_._polygons=null)),_._prevRevpath=V,_._prevPolygons=U):(S?W(S):C&&W(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),L.datum(f),function(t,a,i){var o,u=i[0].trace,f=c.hasMarkers(u),d=c.hasText(u),p=ee(u),h=te,g=te;if(f||d){var v=l,_=u.stackgroup,w=_&&"infer zero"===e._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?v=w?Q:J:_&&!w&&(v=$),f&&(h=v),d&&(g=v)}var k,T=(o=t.selectAll("path.point").data(h,p)).enter().append("path").classed("point",!0);m&&T.call(s.pointStyle,u,e).call(s.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(k=s.makePointStyleFns(u)),o.each((function(t){var a=r.select(this),i=y(a);s.translatePoint(t,i,x,b)?(s.singlePointStyle(t,i,u,k,e),n.layerClipId&&s.hideOutsideRangePoint(t,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==t.data&&void 0!==t.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(e){var t=r.select(this),a=y(t.select("text"));s.translatePoint(e,a,x,b)?n.layerClipId&&s.hideOutsideRangePoint(e,t,x,b,u.xcalendar,u.ycalendar):t.remove()})),o.selectAll("text").call(s.textPointStyle,u,e).each((function(e){var t=x.c2p(e.x),n=b.c2p(e.y);r.select(this).selectAll("tspan.line").each((function(){y(r.select(this)).attr({x:t,y:n})}))})),o.exit().remove()}(A,L,f);var X=!1===_.cliponaxis?null:n.layerClipId;s.setClipUrl(A,X,e),s.setClipUrl(L,X,e)}function W(e){y(e).attr("d","M0,0Z")}function J(e){return e.filter((function(e){return!e.gap&&e.vis}))}function Q(e){return e.filter((function(e){return e.vis}))}function $(e){return e.filter((function(e){return!e.gap}))}function K(e){return e.id}function ee(e){if(e.ids)return K}function te(){return!1}}t.exports=function(e,t,n,a,i,c){var u,d,h=!i,g=!!i&&i.duration>0,v=f(e,t,n);((u=a.selectAll("g.trace").data(v,(function(e){return e[0].trace.uid}))).enter().append("g").attr("class",(function(e){return"trace scatter trace"+e[0].trace.uid})).style("stroke-miterlimit",2),u.order(),function(e,t,n){t.each((function(t){var a=o(r.select(this),"g","fills");s.setClipUrl(a,n.layerClipId,e);var i=t[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,l);u.enter().append("g"),u.exit().each((function(e){i[e]=null})).remove(),u.order().each((function(e){i[e]=o(r.select(this),"path","js-fill")}))}))}(e,u,t),g)?(c&&(d=c()),r.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(n,r){p(e,r,t,n,v,this,i)}))}))):u.each((function(n,r){p(e,r,t,n,v,this,i)}));h&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":103,"../../lib":210,"../../lib/polygon":222,"../../registry":306,"./line_points":342,"./link_traces":344,"./subtypes":353,d3:15}],350:[function(e,t,n){"use strict";var r=e("./subtypes");t.exports=function(e,t){var n,a,i,o,l=e.cd,s=e.xaxis,c=e.yaxis,u=[],f=l[0].trace;if(!r.hasMarkers(f)&&!r.hasText(f))return[];if(!1===t)for(n=0;n")}(c,g,e,s[0].t.labels),e.hovertemplate=c.hovertemplate,[e]}}},{"../../components/fx":121,"../../constants/numerical":187,"../../lib":210,"../scatter/get_trace_color":338,"./attributes":356}],362:[function(e,t,n){"use strict";t.exports={attributes:e("./attributes"),supplyDefaults:e("./defaults"),colorbar:e("../scatter/marker_colorbar"),formatLabels:e("./format_labels"),calc:e("./calc"),calcGeoJSON:e("./plot").calcGeoJSON,plot:e("./plot").plot,style:e("./style"),styleOnSelect:e("../scatter/style").styleOnSelect,hoverPoints:e("./hover"),eventData:e("./event_data"),selectPoints:e("./select"),moduleType:"trace",name:"scattergeo",basePlotModule:e("../../plots/geo"),categories:["geo","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/geo":288,"../scatter/marker_colorbar":346,"../scatter/style":352,"./attributes":356,"./calc":357,"./defaults":358,"./event_data":359,"./format_labels":360,"./hover":361,"./plot":363,"./select":364,"./style":365}],363:[function(e,t,n){"use strict";var r=e("d3"),a=e("../../lib"),i=e("../../lib/topojson_utils").getTopojsonFeatures,o=e("../../lib/geojson_utils"),l=e("../../lib/geo_location_utils"),s=e("../../plots/cartesian/autorange").findExtremes,c=e("../../constants/numerical").BADNUM,u=e("../scatter/calc").calcMarkerSize,f=e("../scatter/subtypes"),d=e("./style");t.exports={calcGeoJSON:function(e,t){var n,r,a=e[0].trace,o=t[a.geo],f=o._subplot,d=a._length;if(Array.isArray(a.locations)){var p=a.locationmode,h="geojson-id"===p?l.extractTraceFeature(e):i(a,f.topojson);for(n=0;n 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -7974,19 +7935,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -7995,7 +7955,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -8003,33 +7963,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -8051,44 +8007,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -8098,20 +8039,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -8133,35 +8073,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -8170,7 +8113,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -8178,7 +8121,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -8187,7 +8130,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -8200,17 +8143,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -8233,12 +8177,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -8247,16 +8191,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -8264,6 +8201,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -8272,27 +8215,37 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],52:[function(_dereq_,module,exports){ -(function (Buffer){ +(function (Buffer){(function (){ /*! * The buffer module from node.js, for the browser. * @@ -10071,8 +10024,8 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -}).call(this,_dereq_("buffer").Buffer) -},{"base64-js":22,"buffer":52,"ieee754":205}],53:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"base64-js":22,"buffer":52,"ieee754":239}],53:[function(_dereq_,module,exports){ 'use strict' var monotoneTriangulate = _dereq_('./lib/monotone') @@ -10273,7 +10226,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":39,"robust-in-sphere":262}],55:[function(_dereq_,module,exports){ +},{"binary-search-bounds":39,"robust-in-sphere":298}],55:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -10644,7 +10597,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":39,"robust-orientation":263}],57:[function(_dereq_,module,exports){ +},{"binary-search-bounds":39,"robust-orientation":299}],57:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -11142,7 +11095,7 @@ function cleanPSLG (points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":60,"big-rat":26,"big-rat/cmp":24,"big-rat/to-float":38,"box-intersect":43,"nextafter":225,"rat-vec":253,"robust-segment-intersect":266,"union-find":303}],60:[function(_dereq_,module,exports){ +},{"./lib/rat-seg-intersect":60,"big-rat":26,"big-rat/cmp":24,"big-rat/to-float":38,"box-intersect":43,"nextafter":259,"rat-vec":287,"robust-segment-intersect":302,"union-find":339}],60:[function(_dereq_,module,exports){ 'use strict' module.exports = solveIntersection @@ -11186,7 +11139,7 @@ function solveIntersection (a, b, c, d) { return r } -},{"big-rat/div":25,"big-rat/mul":35,"big-rat/sign":36,"big-rat/sub":37,"rat-vec/add":252,"rat-vec/muls":254,"rat-vec/sub":255}],61:[function(_dereq_,module,exports){ +},{"big-rat/div":25,"big-rat/mul":35,"big-rat/sign":36,"big-rat/sub":37,"rat-vec/add":286,"rat-vec/muls":288,"rat-vec/sub":289}],61:[function(_dereq_,module,exports){ /** @module color-id */ 'use strict' @@ -11463,7 +11416,7 @@ function isInt(color) { } },{"clamp":58,"color-rgba":65,"dtype":91}],64:[function(_dereq_,module,exports){ -(function (global){ +(function (global){(function (){ /** * @module color-parse */ @@ -11640,8 +11593,8 @@ function parse (cstr) { } } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"color-name":62,"defined":87,"is-plain-obj":214}],65:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"color-name":62,"defined":87,"is-plain-obj":248}],65:[function(_dereq_,module,exports){ /** @module color-rgba */ 'use strict' @@ -11883,7 +11836,7 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":263,"robust-product":264,"robust-sum":268,"signum":269,"two-sum":290}],69:[function(_dereq_,module,exports){ +},{"robust-orientation":299,"robust-product":300,"robust-sum":304,"signum":305,"two-sum":326}],69:[function(_dereq_,module,exports){ module.exports=[ "xx-small", "x-small", @@ -12063,7 +12016,7 @@ function parseLineHeight(value) { return value } -},{"./lib/util":74,"css-font-stretch-keywords":70,"css-font-style-keywords":71,"css-font-weight-keywords":72,"css-global-keywords":77,"css-system-font-keywords":78,"string-split-by":278,"unquote":305}],76:[function(_dereq_,module,exports){ +},{"./lib/util":74,"css-font-stretch-keywords":70,"css-font-style-keywords":71,"css-font-weight-keywords":72,"css-global-keywords":77,"css-system-font-keywords":78,"string-split-by":314,"unquote":341}],76:[function(_dereq_,module,exports){ 'use strict' var pick = _dereq_('pick-by-alias') @@ -12167,7 +12120,7 @@ function a2o (a) { return o } -},{"./lib/util":74,"css-font-stretch-keywords":70,"css-font-style-keywords":71,"css-font-weight-keywords":72,"css-global-keywords":77,"css-system-font-keywords":78,"pick-by-alias":236}],77:[function(_dereq_,module,exports){ +},{"./lib/util":74,"css-font-stretch-keywords":70,"css-font-style-keywords":71,"css-font-weight-keywords":72,"css-global-keywords":77,"css-system-font-keywords":78,"pick-by-alias":270}],77:[function(_dereq_,module,exports){ module.exports=[ "inherit", "initial", @@ -12655,7 +12608,7 @@ function generateCWiseOp(proc, typesig) { } module.exports = generateCWiseOp -},{"uniq":304}],81:[function(_dereq_,module,exports){ +},{"uniq":340}],81:[function(_dereq_,module,exports){ "use strict" // The function below is called when constructing a cwise function object, and does the following: @@ -12778,7 +12731,7 @@ module.exports = function (props/*, options*/) { return map(props, function (desc, name) { return define(name, desc, options); }); }; -},{"es5-ext/object/copy":111,"es5-ext/object/map":119,"es5-ext/object/normalize-options":120,"type/plain-function/ensure":296,"type/value/ensure":300,"type/value/is":301}],83:[function(_dereq_,module,exports){ +},{"es5-ext/object/copy":111,"es5-ext/object/map":119,"es5-ext/object/normalize-options":120,"type/plain-function/ensure":332,"type/value/ensure":336,"type/value/is":337}],83:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("type/value/is") @@ -12842,7 +12795,7 @@ d.gs = function (dscr, get, set/*, options*/) { return !options ? desc : assign(normalizeOpts(options), desc); }; -},{"es5-ext/object/assign":108,"es5-ext/object/normalize-options":120,"es5-ext/string/#/contains":127,"type/plain-function/is":297,"type/value/is":301}],84:[function(_dereq_,module,exports){ +},{"es5-ext/object/assign":108,"es5-ext/object/normalize-options":120,"es5-ext/string/#/contains":127,"type/plain-function/is":333,"type/value/is":337}],84:[function(_dereq_,module,exports){ // https://d3js.org/d3-time-format/ v2.2.3 Copyright 2019 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-time')) : @@ -23559,7 +23512,7 @@ function createPairs (range) { } },{}],89:[function(_dereq_,module,exports){ -(function (Buffer){ +(function (Buffer){(function (){ var hasTypedArrays = false if(typeof Float64Array !== "undefined") { var DOUBLE_VIEW = new Float64Array(1) @@ -23661,7 +23614,7 @@ module.exports.denormalized = function(n) { var hi = module.exports.hi(n) return !(hi & 0x7ff00000) } -}).call(this,_dereq_("buffer").Buffer) +}).call(this)}).call(this,_dereq_("buffer").Buffer) },{"buffer":52}],90:[function(_dereq_,module,exports){ var abs = _dereq_('abs-svg-path') var normalize = _dereq_('normalize-svg-path') @@ -23688,7 +23641,7 @@ module.exports = function(context, segments) { context.closePath() } -},{"abs-svg-path":12,"normalize-svg-path":226}],91:[function(_dereq_,module,exports){ +},{"abs-svg-path":12,"normalize-svg-path":260}],91:[function(_dereq_,module,exports){ module.exports = function(dtype) { switch (dtype) { case 'int8': @@ -24479,7 +24432,7 @@ function edgeToAdjacency(edges, numVertices) { } return adj } -},{"uniq":304}],95:[function(_dereq_,module,exports){ +},{"uniq":340}],95:[function(_dereq_,module,exports){ // Inspired by Google Closure: // http://closure-library.googlecode.com/svn/docs/ // closure_goog_array_array.js.html#goog.array.clear @@ -25380,7 +25333,7 @@ module.exports = function (value) { }; },{"./is-iterable":136}],139:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -26556,8 +26509,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":250}],140:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":284}],140:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() @@ -26966,7 +26919,7 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":215}],156:[function(_dereq_,module,exports){ +},{"is-string-blank":249}],156:[function(_dereq_,module,exports){ /*eslint new-cap:0*/ var dtype = _dereq_('dtype') @@ -28532,7 +28485,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":224,"ndarray-ops":223,"typedarray-pool":302}],163:[function(_dereq_,module,exports){ +},{"ndarray":258,"ndarray-ops":257,"typedarray-pool":338}],163:[function(_dereq_,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -29262,7 +29215,7 @@ function createContour2D (plot, options) { return contours } -},{"./lib/shaders":166,"binary-search-bounds":39,"cdt2d":53,"clean-pslg":59,"gl-buffer":162,"gl-shader":183,"iota-array":209,"ndarray":224,"surface-nets":279}],166:[function(_dereq_,module,exports){ +},{"./lib/shaders":166,"binary-search-bounds":39,"cdt2d":53,"clean-pslg":59,"gl-buffer":162,"gl-shader":217,"iota-array":243,"ndarray":258,"surface-nets":315}],166:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -29273,7 +29226,19 @@ module.exports = { fillVertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n fragColor = color;\n vec3 vPosition = viewTransform * vec3(position, 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]) } -},{"glslify":202}],167:[function(_dereq_,module,exports){ +},{"glslify":167}],167:[function(_dereq_,module,exports){ +module.exports = function(strings) { + if (typeof strings === 'string') strings = [strings] + var exprs = [].slice.call(arguments,1) + var parts = [] + for (var i = 0; i < strings.length-1; i++) { + parts.push(strings[i], exprs[i] || '') + } + parts.push(strings[i]) + return parts.join('') +} + +},{}],168:[function(_dereq_,module,exports){ 'use strict' var createTexture = _dereq_('gl-texture2d') @@ -29740,7 +29705,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":192}],168:[function(_dereq_,module,exports){ +},{"gl-texture2d":226}],169:[function(_dereq_,module,exports){ var sprintf = _dereq_('sprintf-js').sprintf; var glConstants = _dereq_('gl-constants/lookup'); @@ -29795,7 +29760,7 @@ function formatCompilerError(errLog, src, type) { } -},{"add-line-numbers":13,"gl-constants/lookup":164,"glsl-shader-name":194,"sprintf-js":277}],169:[function(_dereq_,module,exports){ +},{"add-line-numbers":13,"gl-constants/lookup":164,"glsl-shader-name":228,"sprintf-js":313}],170:[function(_dereq_,module,exports){ 'use strict' module.exports = createHeatmap2D @@ -30147,7 +30112,7 @@ function createHeatmap2D (plot, options) { return heatmap } -},{"./lib/shaders":170,"binary-search-bounds":39,"gl-buffer":162,"gl-shader":183,"iota-array":209,"typedarray-pool":302}],170:[function(_dereq_,module,exports){ +},{"./lib/shaders":171,"binary-search-bounds":39,"gl-buffer":162,"gl-shader":217,"iota-array":243,"typedarray-pool":338}],171:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -30159,7 +30124,160 @@ module.exports = { pickVertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]) } -},{"glslify":202}],171:[function(_dereq_,module,exports){ +},{"glslify":172}],172:[function(_dereq_,module,exports){ +arguments[4][167][0].apply(exports,arguments) +},{"dup":167}],173:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],174:[function(_dereq_,module,exports){ +module.exports = clone; + +/** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param {mat4} a matrix to clone + * @returns {mat4} a new 4x4 matrix + */ +function clone(a) { + var out = new Float32Array(16); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],175:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],176:[function(_dereq_,module,exports){ +module.exports = create; + +/** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ +function create() { + var out = new Float32Array(16); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],177:[function(_dereq_,module,exports){ +module.exports = determinant; + +/** + * Calculates the determinant of a mat4 + * + * @param {mat4} a the source matrix + * @returns {Number} determinant of a + */ +function determinant(a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; +}; +},{}],178:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -30207,7 +30325,1032 @@ function fromQuat(out, q) { return out; }; -},{}],172:[function(_dereq_,module,exports){ +},{}],179:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],180:[function(_dereq_,module,exports){ +module.exports = fromRotationTranslation; + +/** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat4} q Rotation quaternion + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; +}; +},{}],181:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],182:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],183:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],184:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],185:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],186:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],187:[function(_dereq_,module,exports){ +module.exports = identity; + +/** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ +function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],188:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":173,"./clone":174,"./copy":175,"./create":176,"./determinant":177,"./fromQuat":178,"./fromRotation":179,"./fromRotationTranslation":180,"./fromScaling":181,"./fromTranslation":182,"./fromXRotation":183,"./fromYRotation":184,"./fromZRotation":185,"./frustum":186,"./identity":187,"./invert":189,"./lookAt":190,"./multiply":191,"./ortho":192,"./perspective":193,"./perspectiveFromFieldOfView":194,"./rotate":195,"./rotateX":196,"./rotateY":197,"./rotateZ":198,"./scale":199,"./str":200,"./translate":201,"./transpose":202}],189:[function(_dereq_,module,exports){ +module.exports = invert; + +/** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; +}; +},{}],190:[function(_dereq_,module,exports){ +var identity = _dereq_('./identity'); + +module.exports = lookAt; + +/** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {vec3} eye Position of the viewer + * @param {vec3} center Point the viewer is looking at + * @param {vec3} up vec3 pointing up + * @returns {mat4} out + */ +function lookAt(out, eye, center, up) { + var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, + eyex = eye[0], + eyey = eye[1], + eyez = eye[2], + upx = up[0], + upy = up[1], + upz = up[2], + centerx = center[0], + centery = center[1], + centerz = center[2]; + + if (Math.abs(eyex - centerx) < 0.000001 && + Math.abs(eyey - centery) < 0.000001 && + Math.abs(eyez - centerz) < 0.000001) { + return identity(out); + } + + z0 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + + x0 = upy * z2 - upz * z1; + x1 = upz * z0 - upx * z2; + x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + y0 = z1 * x2 - z2 * x1; + y1 = z2 * x0 - z0 * x2; + y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + + return out; +}; +},{"./identity":187}],191:[function(_dereq_,module,exports){ +module.exports = multiply; + +/** + * Multiplies two mat4's + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ +function multiply(out, a, b) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + // Cache only the current line of the second matrix + var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; + out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; + out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; + out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + return out; +}; +},{}],192:[function(_dereq_,module,exports){ +module.exports = ortho; + +/** + * Generates a orthogonal projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} left Left bound of the frustum + * @param {number} right Right bound of the frustum + * @param {number} bottom Bottom bound of the frustum + * @param {number} top Top bound of the frustum + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function ortho(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; +},{}],193:[function(_dereq_,module,exports){ +module.exports = perspective; + +/** + * Generates a perspective projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspective(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2), + nf = 1 / (near - far); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + return out; +}; +},{}],194:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],195:[function(_dereq_,module,exports){ +module.exports = rotate; + +/** + * Rotates a mat4 by the given angle + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function rotate(out, a, rad, axis) { + var x = axis[0], y = axis[1], z = axis[2], + len = Math.sqrt(x * x + y * y + z * z), + s, c, t, + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23, + b00, b01, b02, + b10, b11, b12, + b20, b21, b22; + + if (Math.abs(len) < 0.000001) { return null; } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + s = Math.sin(rad); + c = Math.cos(rad); + t = 1 - c; + + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + // Construct the elements of the rotation matrix + b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; + b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; + b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; +}; +},{}],196:[function(_dereq_,module,exports){ +module.exports = rotateX; + +/** + * Rotates a matrix by the given angle around the X axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateX(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; +}; +},{}],197:[function(_dereq_,module,exports){ +module.exports = rotateY; + +/** + * Rotates a matrix by the given angle around the Y axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateY(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; +}; +},{}],198:[function(_dereq_,module,exports){ +module.exports = rotateZ; + +/** + * Rotates a matrix by the given angle around the Z axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateZ(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; +}; +},{}],199:[function(_dereq_,module,exports){ +module.exports = scale; + +/** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to scale + * @param {vec3} v the vec3 to scale the matrix by + * @returns {mat4} out + **/ +function scale(out, a, v) { + var x = v[0], y = v[1], z = v[2]; + + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],200:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],201:[function(_dereq_,module,exports){ +module.exports = translate; + +/** + * Translate a mat4 by the given vector + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to translate + * @param {vec3} v vector to translate by + * @returns {mat4} out + */ +function translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; +}; +},{}],202:[function(_dereq_,module,exports){ +module.exports = transpose; + +/** + * Transpose the values of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function transpose(out, a) { + // If we are transposing ourselves we can skip a few steps but have to cache some values + if (out === a) { + var a01 = a[1], a02 = a[2], a03 = a[3], + a12 = a[6], a13 = a[7], + a23 = a[11]; + + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + + return out; +}; +},{}],203:[function(_dereq_,module,exports){ 'use strict' module.exports = createBoxes @@ -30270,7 +31413,7 @@ function createBoxes(plot) { return new Boxes(plot, vbo, shader) } -},{"./shaders":175,"gl-buffer":162,"gl-shader":183}],173:[function(_dereq_,module,exports){ +},{"./shaders":206,"gl-buffer":162,"gl-shader":217}],204:[function(_dereq_,module,exports){ 'use strict' module.exports = createGrid @@ -30517,7 +31660,7 @@ function createGrid(plot) { return grid } -},{"./shaders":175,"binary-search-bounds":39,"gl-buffer":162,"gl-shader":183}],174:[function(_dereq_,module,exports){ +},{"./shaders":206,"binary-search-bounds":39,"gl-buffer":162,"gl-shader":217}],205:[function(_dereq_,module,exports){ 'use strict' module.exports = createLines @@ -30582,7 +31725,7 @@ function createLines(plot) { return lines } -},{"./shaders":175,"gl-buffer":162,"gl-shader":183}],175:[function(_dereq_,module,exports){ +},{"./shaders":206,"gl-buffer":162,"gl-shader":217}],206:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -30600,7 +31743,7 @@ module.exports = { tickVert: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"]) } -},{"glslify":202}],176:[function(_dereq_,module,exports){ +},{"glslify":208}],207:[function(_dereq_,module,exports){ 'use strict' module.exports = createTextElements @@ -30878,7 +32021,9 @@ function createTextElements(plot) { return text } -},{"./shaders":175,"binary-search-bounds":39,"gl-buffer":162,"gl-shader":183,"text-cache":284}],177:[function(_dereq_,module,exports){ +},{"./shaders":206,"binary-search-bounds":39,"gl-buffer":162,"gl-shader":217,"text-cache":320}],208:[function(_dereq_,module,exports){ +arguments[4][167][0].apply(exports,arguments) +},{"dup":167}],209:[function(_dereq_,module,exports){ 'use strict' module.exports = createGLPlot2D @@ -31461,7 +32606,7 @@ function createGLPlot2D(options) { return plot } -},{"./lib/box":172,"./lib/grid":173,"./lib/line":174,"./lib/text":176,"gl-select-static":182}],178:[function(_dereq_,module,exports){ +},{"./lib/box":203,"./lib/grid":204,"./lib/line":205,"./lib/text":207,"gl-select-static":216}],210:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') exports.pointVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}"]) @@ -31469,7 +32614,9 @@ exports.pointFragment = glslify(["precision mediump float;\n#define GLSLIFY exports.pickVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]) exports.pickFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"]) -},{"glslify":202}],179:[function(_dereq_,module,exports){ +},{"glslify":211}],211:[function(_dereq_,module,exports){ +arguments[4][167][0].apply(exports,arguments) +},{"dup":167}],212:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -31689,7 +32836,7 @@ function createPointcloud2D(plot, options) { return result } -},{"./lib/shader":178,"gl-buffer":162,"gl-shader":183,"typedarray-pool":302}],180:[function(_dereq_,module,exports){ +},{"./lib/shader":210,"gl-buffer":162,"gl-shader":217,"typedarray-pool":338}],213:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -31697,7 +32844,9 @@ var glslify = _dereq_('glslify') exports.boxVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n"]) exports.boxFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"]) -},{"glslify":202}],181:[function(_dereq_,module,exports){ +},{"glslify":214}],214:[function(_dereq_,module,exports){ +arguments[4][167][0].apply(exports,arguments) +},{"dup":167}],215:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -31823,7 +32972,7 @@ function createSelectBox(plot, options) { return selectBox } -},{"./lib/shaders":180,"gl-buffer":162,"gl-shader":183}],182:[function(_dereq_,module,exports){ +},{"./lib/shaders":213,"gl-buffer":162,"gl-shader":217}],216:[function(_dereq_,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -32008,7 +33157,7 @@ function createSelectBuffer(gl, shape) { return new SelectBuffer(gl, fbo, buffer) } -},{"bit-twiddle":40,"gl-fbo":167,"ndarray":224,"typedarray-pool":302}],183:[function(_dereq_,module,exports){ +},{"bit-twiddle":40,"gl-fbo":168,"ndarray":258,"typedarray-pool":338}],217:[function(_dereq_,module,exports){ 'use strict' var createUniformWrapper = _dereq_('./lib/create-uniforms') @@ -32274,7 +33423,7 @@ function createShader( module.exports = createShader -},{"./lib/GLError":184,"./lib/create-attributes":185,"./lib/create-uniforms":186,"./lib/reflect":187,"./lib/runtime-reflect":188,"./lib/shader-cache":189}],184:[function(_dereq_,module,exports){ +},{"./lib/GLError":218,"./lib/create-attributes":219,"./lib/create-uniforms":220,"./lib/reflect":221,"./lib/runtime-reflect":222,"./lib/shader-cache":223}],218:[function(_dereq_,module,exports){ function GLError (rawError, shortMessage, longMessage) { this.shortMessage = shortMessage || '' this.longMessage = longMessage || '' @@ -32289,7 +33438,7 @@ GLError.prototype.name = 'GLError' GLError.prototype.constructor = GLError module.exports = GLError -},{}],185:[function(_dereq_,module,exports){ +},{}],219:[function(_dereq_,module,exports){ 'use strict' module.exports = createAttributeWrapper @@ -32554,7 +33703,7 @@ function createAttributeWrapper( return obj } -},{"./GLError":184}],186:[function(_dereq_,module,exports){ +},{"./GLError":218}],220:[function(_dereq_,module,exports){ 'use strict' var coallesceUniforms = _dereq_('./reflect') @@ -32747,7 +33896,7 @@ function createUniformWrapper(gl, wrapper, uniforms, locations) { } } -},{"./GLError":184,"./reflect":187}],187:[function(_dereq_,module,exports){ +},{"./GLError":218,"./reflect":221}],221:[function(_dereq_,module,exports){ 'use strict' module.exports = makeReflectTypes @@ -32805,7 +33954,7 @@ function makeReflectTypes(uniforms, useIndex) { } return obj } -},{}],188:[function(_dereq_,module,exports){ +},{}],222:[function(_dereq_,module,exports){ 'use strict' exports.uniforms = runtimeUniforms @@ -32885,7 +34034,7 @@ function runtimeAttributes(gl, program) { return result } -},{}],189:[function(_dereq_,module,exports){ +},{}],223:[function(_dereq_,module,exports){ 'use strict' exports.shader = getShaderReference @@ -33023,7 +34172,7 @@ function createProgram(gl, vref, fref, attribs, locations) { return getCache(gl).getProgram(vref, fref, attribs, locations) } -},{"./GLError":184,"gl-format-compiler-error":168,"weakmap-shim":311}],190:[function(_dereq_,module,exports){ +},{"./GLError":218,"gl-format-compiler-error":169,"weakmap-shim":347}],224:[function(_dereq_,module,exports){ 'use strict' module.exports = createSpikes2D @@ -33111,7 +34260,7 @@ function createSpikes2D(plot, options) { return spikes } -},{}],191:[function(_dereq_,module,exports){ +},{}],225:[function(_dereq_,module,exports){ 'use strict' var Font = _dereq_('css-font') @@ -33839,7 +34988,7 @@ function isRegl (o) { module.exports = GlText -},{"bit-twiddle":40,"color-normalize":63,"css-font":73,"detect-kerning":88,"es6-weak-map":148,"flatten-vertex-data":156,"font-atlas":157,"font-measure":158,"gl-util/context":193,"is-plain-obj":214,"object-assign":227,"parse-rect":230,"parse-unit":232,"pick-by-alias":236,"regl":260,"to-px":287,"typedarray-pool":302}],192:[function(_dereq_,module,exports){ +},{"bit-twiddle":40,"color-normalize":63,"css-font":73,"detect-kerning":88,"es6-weak-map":148,"flatten-vertex-data":156,"font-atlas":157,"font-measure":158,"gl-util/context":227,"is-plain-obj":248,"object-assign":261,"parse-rect":264,"parse-unit":266,"pick-by-alias":270,"regl":296,"to-px":323,"typedarray-pool":338}],226:[function(_dereq_,module,exports){ 'use strict' var ndarray = _dereq_('ndarray') @@ -34402,8 +35551,8 @@ function createTexture2D(gl) { throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":224,"ndarray-ops":223,"typedarray-pool":302}],193:[function(_dereq_,module,exports){ -(function (global){ +},{"ndarray":258,"ndarray-ops":257,"typedarray-pool":338}],227:[function(_dereq_,module,exports){ +(function (global){(function (){ /** @module gl-util/context */ 'use strict' @@ -34533,8 +35682,8 @@ function createCanvas () { return canvas } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"pick-by-alias":236}],194:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"pick-by-alias":270}],228:[function(_dereq_,module,exports){ var tokenize = _dereq_('glsl-tokenizer') var atob = _dereq_('atob-lite') @@ -34559,7 +35708,7 @@ function getName(src) { } } -},{"atob-lite":21,"glsl-tokenizer":201}],195:[function(_dereq_,module,exports){ +},{"atob-lite":21,"glsl-tokenizer":235}],229:[function(_dereq_,module,exports){ module.exports = tokenize var literals100 = _dereq_('./lib/literals') @@ -34936,7 +36085,7 @@ function tokenize(opt) { } } -},{"./lib/builtins":197,"./lib/builtins-300es":196,"./lib/literals":199,"./lib/literals-300es":198,"./lib/operators":200}],196:[function(_dereq_,module,exports){ +},{"./lib/builtins":231,"./lib/builtins-300es":230,"./lib/literals":233,"./lib/literals-300es":232,"./lib/operators":234}],230:[function(_dereq_,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = _dereq_('./builtins') @@ -35007,7 +36156,7 @@ module.exports = v100.concat([ , 'textureProjGradOffset' ]) -},{"./builtins":197}],197:[function(_dereq_,module,exports){ +},{"./builtins":231}],231:[function(_dereq_,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -35159,7 +36308,7 @@ module.exports = [ , 'textureCubeGradEXT' ] -},{}],198:[function(_dereq_,module,exports){ +},{}],232:[function(_dereq_,module,exports){ var v100 = _dereq_('./literals') module.exports = v100.slice().concat([ @@ -35248,7 +36397,7 @@ module.exports = v100.slice().concat([ , 'usampler2DMSArray' ]) -},{"./literals":199}],199:[function(_dereq_,module,exports){ +},{"./literals":233}],233:[function(_dereq_,module,exports){ module.exports = [ // current 'precision' @@ -35344,7 +36493,7 @@ module.exports = [ , 'using' ] -},{}],200:[function(_dereq_,module,exports){ +},{}],234:[function(_dereq_,module,exports){ module.exports = [ '<<=' , '>>=' @@ -35393,7 +36542,7 @@ module.exports = [ , '}' ] -},{}],201:[function(_dereq_,module,exports){ +},{}],235:[function(_dereq_,module,exports){ var tokenize = _dereq_('./index') module.exports = tokenizeString @@ -35408,20 +36557,10 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":195}],202:[function(_dereq_,module,exports){ -module.exports = function(strings) { - if (typeof strings === 'string') strings = [strings] - var exprs = [].slice.call(arguments,1) - var parts = [] - for (var i = 0; i < strings.length-1; i++) { - parts.push(strings[i], exprs[i] || '') - } - parts.push(strings[i]) - return parts.join('') -} - -},{}],203:[function(_dereq_,module,exports){ -(function (global){ +},{"./index":229}],236:[function(_dereq_,module,exports){ +arguments[4][167][0].apply(exports,arguments) +},{"dup":167}],237:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -35436,8 +36575,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":210}],204:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":244}],238:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -35463,7 +36602,7 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":210}],205:[function(_dereq_,module,exports){ +},{"is-browser":244}],239:[function(_dereq_,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -35549,7 +36688,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],206:[function(_dereq_,module,exports){ +},{}],240:[function(_dereq_,module,exports){ "use strict" var bounds = _dereq_("binary-search-bounds") @@ -35916,7 +37055,7 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":207}],207:[function(_dereq_,module,exports){ +},{"binary-search-bounds":241}],241:[function(_dereq_,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, useNdarray, earlyOut) { @@ -35978,7 +37117,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],208:[function(_dereq_,module,exports){ +},{}],242:[function(_dereq_,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -35990,7 +37129,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],209:[function(_dereq_,module,exports){ +},{}],243:[function(_dereq_,module,exports){ "use strict" function iota(n) { @@ -36002,9 +37141,9 @@ function iota(n) { } module.exports = iota -},{}],210:[function(_dereq_,module,exports){ +},{}],244:[function(_dereq_,module,exports){ module.exports = true; -},{}],211:[function(_dereq_,module,exports){ +},{}],245:[function(_dereq_,module,exports){ /*! * Determine if an object is a Buffer * @@ -36027,19 +37166,19 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],212:[function(_dereq_,module,exports){ +},{}],246:[function(_dereq_,module,exports){ 'use strict'; module.exports = typeof navigator !== 'undefined' && (/MSIE/.test(navigator.userAgent) || /Trident\//.test(navigator.appVersion)); -},{}],213:[function(_dereq_,module,exports){ +},{}],247:[function(_dereq_,module,exports){ 'use strict'; module.exports = function (x) { var type = typeof x; return x !== null && (type === 'object' || type === 'function'); }; -},{}],214:[function(_dereq_,module,exports){ +},{}],248:[function(_dereq_,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -36048,7 +37187,7 @@ module.exports = function (x) { return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],215:[function(_dereq_,module,exports){ +},{}],249:[function(_dereq_,module,exports){ 'use strict'; /** @@ -36085,7 +37224,7 @@ module.exports = function(str){ return true; } -},{}],216:[function(_dereq_,module,exports){ +},{}],250:[function(_dereq_,module,exports){ 'use strict' module.exports = function isPath(str) { @@ -36099,13 +37238,13 @@ module.exports = function isPath(str) { return false } -},{}],217:[function(_dereq_,module,exports){ +},{}],251:[function(_dereq_,module,exports){ 'use strict'; module.exports = Math.log2 || function (x) { return Math.log(x) * Math.LOG2E; }; -},{}],218:[function(_dereq_,module,exports){ +},{}],252:[function(_dereq_,module,exports){ 'use strict' module.exports = mouseListen @@ -36312,7 +37451,7 @@ function mouseListen (element, callback) { return result } -},{"mouse-event":220}],219:[function(_dereq_,module,exports){ +},{"mouse-event":254}],253:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -36339,7 +37478,7 @@ function getBoundingClientOffset (element) { } } -},{}],220:[function(_dereq_,module,exports){ +},{}],254:[function(_dereq_,module,exports){ 'use strict' function mouseButtons(ev) { @@ -36401,7 +37540,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],221:[function(_dereq_,module,exports){ +},{}],255:[function(_dereq_,module,exports){ 'use strict' var toPX = _dereq_('to-px') @@ -36443,7 +37582,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":287}],222:[function(_dereq_,module,exports){ +},{"to-px":323}],256:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -36859,7 +37998,7 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":302}],223:[function(_dereq_,module,exports){ +},{"typedarray-pool":338}],257:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("cwise-compiler") @@ -37322,7 +38461,7 @@ exports.equals = compile({ -},{"cwise-compiler":79}],224:[function(_dereq_,module,exports){ +},{"cwise-compiler":79}],258:[function(_dereq_,module,exports){ var iota = _dereq_("iota-array") var isBuffer = _dereq_("is-buffer") @@ -37673,7 +38812,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":209,"is-buffer":211}],225:[function(_dereq_,module,exports){ +},{"iota-array":243,"is-buffer":245}],259:[function(_dereq_,module,exports){ "use strict" var doubleBits = _dereq_("double-bits") @@ -37716,7 +38855,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":89}],226:[function(_dereq_,module,exports){ +},{"double-bits":89}],260:[function(_dereq_,module,exports){ var π = Math.PI var _120 = radians(120) @@ -37918,7 +39057,7 @@ function radians(degress){ return degress * (π / 180) } -},{}],227:[function(_dereq_,module,exports){ +},{}],261:[function(_dereq_,module,exports){ /* object-assign (c) Sindre Sorhus @@ -38010,7 +39149,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],228:[function(_dereq_,module,exports){ +},{}],262:[function(_dereq_,module,exports){ /*! * pad-left * @@ -38026,7 +39165,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":261}],229:[function(_dereq_,module,exports){ +},{"repeat-string":297}],263:[function(_dereq_,module,exports){ 'use strict' /** @@ -38163,7 +39302,7 @@ parenthesis.stringify = stringify module.exports = parenthesis -},{}],230:[function(_dereq_,module,exports){ +},{}],264:[function(_dereq_,module,exports){ 'use strict' var pick = _dereq_('pick-by-alias') @@ -38250,7 +39389,7 @@ function parseRect (arg) { return rect } -},{"pick-by-alias":236}],231:[function(_dereq_,module,exports){ +},{"pick-by-alias":270}],265:[function(_dereq_,module,exports){ module.exports = parse @@ -38309,7 +39448,7 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],232:[function(_dereq_,module,exports){ +},{}],266:[function(_dereq_,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -38320,8 +39459,8 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],233:[function(_dereq_,module,exports){ -(function (process){ +},{}],267:[function(_dereq_,module,exports){ +(function (process){(function (){ // Generated by CoffeeScript 1.12.2 (function() { var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; @@ -38359,8 +39498,8 @@ module.exports = function parseUnit(str, out) { -}).call(this,_dereq_('_process')) -},{"_process":250}],234:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":284}],268:[function(_dereq_,module,exports){ "use strict" module.exports = permutationSign @@ -38412,7 +39551,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":302}],235:[function(_dereq_,module,exports){ +},{"typedarray-pool":338}],269:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -38499,7 +39638,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":208,"typedarray-pool":302}],236:[function(_dereq_,module,exports){ +},{"invert-permutation":242,"typedarray-pool":338}],270:[function(_dereq_,module,exports){ 'use strict' @@ -38578,7 +39717,7 @@ function toList(arg) { return arg } -},{}],237:[function(_dereq_,module,exports){ +},{}],271:[function(_dereq_,module,exports){ "use strict" module.exports = planarDual @@ -38709,7 +39848,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":68}],238:[function(_dereq_,module,exports){ +},{"compare-angle":68}],272:[function(_dereq_,module,exports){ 'use strict' module.exports = trimLeaves @@ -38765,7 +39904,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":94}],239:[function(_dereq_,module,exports){ +},{"edges-to-adjacency-list":94}],273:[function(_dereq_,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -38970,9 +40109,9 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":238,"edges-to-adjacency-list":94,"planar-dual":237,"point-in-big-polygon":241,"robust-sum":268,"two-product":289,"uniq":304}],240:[function(_dereq_,module,exports){ -arguments[4][207][0].apply(exports,arguments) -},{"dup":207}],241:[function(_dereq_,module,exports){ +},{"./lib/trim-leaves":272,"edges-to-adjacency-list":94,"planar-dual":271,"point-in-big-polygon":275,"robust-sum":304,"two-product":325,"uniq":340}],274:[function(_dereq_,module,exports){ +arguments[4][241][0].apply(exports,arguments) +},{"dup":241}],275:[function(_dereq_,module,exports){ module.exports = preprocessPolygon var orient = _dereq_('robust-orientation')[3] @@ -39124,7 +40263,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":240,"interval-tree-1d":206,"robust-orientation":263,"slab-decomposition":276}],242:[function(_dereq_,module,exports){ +},{"binary-search-bounds":274,"interval-tree-1d":240,"robust-orientation":299,"slab-decomposition":312}],276:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -39252,7 +40391,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":243,"./lib/epsilon":244,"./lib/geojson":245,"./lib/intersecter":246,"./lib/segment-chainer":248,"./lib/segment-selector":249}],243:[function(_dereq_,module,exports){ +},{"./lib/build-log":277,"./lib/epsilon":278,"./lib/geojson":279,"./lib/intersecter":280,"./lib/segment-chainer":282,"./lib/segment-selector":283}],277:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -39367,7 +40506,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],244:[function(_dereq_,module,exports){ +},{}],278:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -39539,7 +40678,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],245:[function(_dereq_,module,exports){ +},{}],279:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -39729,7 +40868,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],246:[function(_dereq_,module,exports){ +},{}],280:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -40236,7 +41375,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":247}],247:[function(_dereq_,module,exports){ +},{"./linked-list":281}],281:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -40319,7 +41458,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],248:[function(_dereq_,module,exports){ +},{}],282:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -40573,7 +41712,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],249:[function(_dereq_,module,exports){ +},{}],283:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -40741,7 +41880,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],250:[function(_dereq_,module,exports){ +},{}],284:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -40927,8 +42066,8 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],251:[function(_dereq_,module,exports){ -(function (global){ +},{}],285:[function(_dereq_,module,exports){ +(function (global){(function (){ var now = _dereq_('performance-now') , root = typeof window === 'undefined' ? global : window , vendors = ['moz', 'webkit'] @@ -41005,8 +42144,8 @@ module.exports.polyfill = function(object) { object.cancelAnimationFrame = caf } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"performance-now":233}],252:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"performance-now":267}],286:[function(_dereq_,module,exports){ 'use strict' var bnadd = _dereq_('big-rat/add') @@ -41022,7 +42161,7 @@ function add (a, b) { return r } -},{"big-rat/add":23}],253:[function(_dereq_,module,exports){ +},{"big-rat/add":23}],287:[function(_dereq_,module,exports){ 'use strict' module.exports = float2rat @@ -41037,7 +42176,7 @@ function float2rat(v) { return result } -},{"big-rat":26}],254:[function(_dereq_,module,exports){ +},{"big-rat":26}],288:[function(_dereq_,module,exports){ 'use strict' var rat = _dereq_('big-rat') @@ -41055,7 +42194,7 @@ function muls(a, x) { return r } -},{"big-rat":26,"big-rat/mul":35}],255:[function(_dereq_,module,exports){ +},{"big-rat":26,"big-rat/mul":35}],289:[function(_dereq_,module,exports){ 'use strict' var bnsub = _dereq_('big-rat/sub') @@ -41071,7 +42210,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":37}],256:[function(_dereq_,module,exports){ +},{"big-rat/sub":37}],290:[function(_dereq_,module,exports){ 'use strict' var getBounds = _dereq_('array-bounds') @@ -41558,7 +42697,7 @@ function Error2D (regl, options) { } } -},{"array-bounds":14,"color-normalize":63,"flatten-vertex-data":156,"object-assign":227,"pick-by-alias":236,"to-float32":286,"update-diff":306}],257:[function(_dereq_,module,exports){ +},{"array-bounds":14,"color-normalize":63,"flatten-vertex-data":156,"object-assign":261,"pick-by-alias":270,"to-float32":322,"update-diff":342}],291:[function(_dereq_,module,exports){ 'use strict' @@ -42287,7 +43426,9 @@ Line2D.prototype.destroy = function () { return this } -},{"array-bounds":14,"array-normalize":15,"color-normalize":63,"earcut":93,"es6-weak-map":148,"flatten-vertex-data":156,"glslify":202,"object-assign":227,"parse-rect":230,"pick-by-alias":236,"to-float32":286}],258:[function(_dereq_,module,exports){ +},{"array-bounds":14,"array-normalize":15,"color-normalize":63,"earcut":93,"es6-weak-map":148,"flatten-vertex-data":156,"glslify":292,"object-assign":261,"parse-rect":264,"pick-by-alias":270,"to-float32":322}],292:[function(_dereq_,module,exports){ +arguments[4][167][0].apply(exports,arguments) +},{"dup":167}],293:[function(_dereq_,module,exports){ 'use strict'; function _slicedToArray(arr, i) { @@ -43271,7 +44412,9 @@ var reglScatter2d = function reglScatter2d(regl, options) { module.exports = reglScatter2d; -},{"@plotly/point-cluster":10,"array-bounds":14,"color-id":61,"color-normalize":63,"flatten-vertex-data":156,"glslify":202,"is-iexplorer":212,"object-assign":227,"parse-rect":230,"pick-by-alias":236,"to-float32":286,"update-diff":306}],259:[function(_dereq_,module,exports){ +},{"@plotly/point-cluster":10,"array-bounds":14,"color-id":61,"color-normalize":63,"flatten-vertex-data":156,"glslify":294,"is-iexplorer":246,"object-assign":261,"parse-rect":264,"pick-by-alias":270,"to-float32":322,"update-diff":342}],294:[function(_dereq_,module,exports){ +arguments[4][167][0].apply(exports,arguments) +},{"dup":167}],295:[function(_dereq_,module,exports){ 'use strict' @@ -43693,7 +44836,7 @@ function getPad (arg) { } } -},{"array-bounds":14,"array-range":16,"flatten-vertex-data":156,"parse-rect":230,"pick-by-alias":236,"raf":251,"regl-scatter2d":258}],260:[function(_dereq_,module,exports){ +},{"array-bounds":14,"array-range":16,"flatten-vertex-data":156,"parse-rect":264,"pick-by-alias":270,"raf":285,"regl-scatter2d":293}],296:[function(_dereq_,module,exports){ (function(ja,N){"object"===typeof exports&&"undefined"!==typeof module?module.exports=N():"function"===typeof define&&define.amd?define(N):ja.createREGL=N()})(this,function(){function ja(a,b){this.id=Bb++;this.type=a;this.data=b}function N(a){if(0===a.length)return[];var b=a.charAt(0),c=a.charAt(a.length-1);if(1b;+ b){var c;switch(a){case "frame":return u(b);case "lost":c=V;break;case "restore":c=X;break;case "destroy":c=Y}c.push(b);return{cancel:function(){for(var a=0;a * @@ -43928,7 +45071,7 @@ function repeat(str, num) { return res; } -},{}],262:[function(_dereq_,module,exports){ +},{}],298:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -44096,7 +45239,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":265,"robust-subtract":267,"robust-sum":268,"two-product":289}],263:[function(_dereq_,module,exports){ +},{"robust-scale":301,"robust-subtract":303,"robust-sum":304,"two-product":325}],299:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -44287,7 +45430,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":265,"robust-subtract":267,"robust-sum":268,"two-product":289}],264:[function(_dereq_,module,exports){ +},{"robust-scale":301,"robust-subtract":303,"robust-sum":304,"two-product":325}],300:[function(_dereq_,module,exports){ "use strict" var robustSum = _dereq_("robust-sum") @@ -44317,7 +45460,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":265,"robust-sum":268}],265:[function(_dereq_,module,exports){ +},{"robust-scale":301,"robust-sum":304}],301:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -44368,7 +45511,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":289,"two-sum":290}],266:[function(_dereq_,module,exports){ +},{"two-product":325,"two-sum":326}],302:[function(_dereq_,module,exports){ "use strict" module.exports = segmentsIntersect @@ -44416,7 +45559,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":263}],267:[function(_dereq_,module,exports){ +},{"robust-orientation":299}],303:[function(_dereq_,module,exports){ "use strict" module.exports = robustSubtract @@ -44573,7 +45716,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],268:[function(_dereq_,module,exports){ +},{}],304:[function(_dereq_,module,exports){ "use strict" module.exports = linearExpansionSum @@ -44730,7 +45873,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],269:[function(_dereq_,module,exports){ +},{}],305:[function(_dereq_,module,exports){ "use strict" module.exports = function signum(x) { @@ -44738,9 +45881,9 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],270:[function(_dereq_,module,exports){ +},{}],306:[function(_dereq_,module,exports){ arguments[4][40][0].apply(exports,arguments) -},{"dup":40}],271:[function(_dereq_,module,exports){ +},{"dup":40}],307:[function(_dereq_,module,exports){ "use strict"; "use restrict"; var bits = _dereq_("bit-twiddle") @@ -45084,7 +46227,7 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":270,"union-find":272}],272:[function(_dereq_,module,exports){ +},{"bit-twiddle":306,"union-find":308}],308:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -45141,7 +46284,7 @@ UnionFind.prototype.link = function(x, y) { } -},{}],273:[function(_dereq_,module,exports){ +},{}],309:[function(_dereq_,module,exports){ "use strict" module.exports = simplifyPolygon @@ -45413,7 +46556,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":263,"simplicial-complex":271}],274:[function(_dereq_,module,exports){ +},{"robust-orientation":299,"simplicial-complex":307}],310:[function(_dereq_,module,exports){ "use strict" module.exports = orderSegments @@ -45509,9 +46652,9 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":263}],275:[function(_dereq_,module,exports){ -arguments[4][207][0].apply(exports,arguments) -},{"dup":207}],276:[function(_dereq_,module,exports){ +},{"robust-orientation":299}],311:[function(_dereq_,module,exports){ +arguments[4][241][0].apply(exports,arguments) +},{"dup":241}],312:[function(_dereq_,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -45742,7 +46885,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":274,"binary-search-bounds":275,"functional-red-black-tree":159,"robust-orientation":263}],277:[function(_dereq_,module,exports){ +},{"./lib/order-segments":310,"binary-search-bounds":311,"functional-red-black-tree":159,"robust-orientation":299}],313:[function(_dereq_,module,exports){ /* global window, exports, define */ !function() { @@ -45975,7 +47118,7 @@ function createSlabDecomposition(segments) { /* eslint-enable quote-props */ }(); // eslint-disable-line -},{}],278:[function(_dereq_,module,exports){ +},{}],314:[function(_dereq_,module,exports){ 'use strict' var paren = _dereq_('parenthesis') @@ -46033,7 +47176,7 @@ module.exports = function splitBy (string, separator, o) { return parts } -},{"parenthesis":229}],279:[function(_dereq_,module,exports){ +},{"parenthesis":263}],315:[function(_dereq_,module,exports){ "use strict" module.exports = surfaceNets @@ -46241,7 +47384,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":222,"triangulate-hypercube":288,"zero-crossings":314}],280:[function(_dereq_,module,exports){ +},{"ndarray-extract-contour":256,"triangulate-hypercube":324,"zero-crossings":350}],316:[function(_dereq_,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -46432,7 +47575,7 @@ var arcToBezier = function arcToBezier(_ref2) { exports.default = arcToBezier; module.exports = exports.default; -},{}],281:[function(_dereq_,module,exports){ +},{}],317:[function(_dereq_,module,exports){ 'use strict' var parse = _dereq_('parse-svg-path') @@ -46477,7 +47620,7 @@ function pathBounds(path) { return bounds } -},{"abs-svg-path":12,"assert":17,"is-svg-path":216,"normalize-svg-path":282,"parse-svg-path":231}],282:[function(_dereq_,module,exports){ +},{"abs-svg-path":12,"assert":17,"is-svg-path":250,"normalize-svg-path":318,"parse-svg-path":265}],318:[function(_dereq_,module,exports){ 'use strict' module.exports = normalize @@ -46601,7 +47744,7 @@ function quadratic(x1, y1, cx, cy, x2, y2){ ] } -},{"svg-arc-to-cubic-bezier":280}],283:[function(_dereq_,module,exports){ +},{"svg-arc-to-cubic-bezier":316}],319:[function(_dereq_,module,exports){ 'use strict' var pathBounds = _dereq_('svg-path-bounds') @@ -46704,8 +47847,8 @@ function isPath2DSupported () { return path2DSupported = idata && idata.data && idata.data[3] === 255 } -},{"bitmap-sdf":41,"draw-svg-path":90,"is-svg-path":216,"parse-svg-path":231,"svg-path-bounds":281}],284:[function(_dereq_,module,exports){ -(function (process){ +},{"bitmap-sdf":41,"draw-svg-path":90,"is-svg-path":250,"parse-svg-path":265,"svg-path-bounds":317}],320:[function(_dereq_,module,exports){ +(function (process){(function (){ 'use strict' module.exports = textGet @@ -46800,9 +47943,9 @@ function textGet(font, text, opts) { return mesh } -}).call(this,_dereq_('_process')) -},{"_process":250,"vectorize-text":307}],285:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":284,"vectorize-text":343}],321:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -47998,7 +49141,7 @@ else { })(Math); -},{}],286:[function(_dereq_,module,exports){ +},{}],322:[function(_dereq_,module,exports){ /* @module to-float32 */ 'use strict' @@ -48039,7 +49182,7 @@ function float32 (arr) { return narr[0] } -},{}],287:[function(_dereq_,module,exports){ +},{}],323:[function(_dereq_,module,exports){ 'use strict' var parseUnit = _dereq_('parse-unit') @@ -48100,7 +49243,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":232}],288:[function(_dereq_,module,exports){ +},{"parse-unit":266}],324:[function(_dereq_,module,exports){ "use strict" module.exports = triangulateCube @@ -48134,7 +49277,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":160,"permutation-parity":234,"permutation-rank":235}],289:[function(_dereq_,module,exports){ +},{"gamma":160,"permutation-parity":268,"permutation-rank":269}],325:[function(_dereq_,module,exports){ "use strict" module.exports = twoProduct @@ -48168,7 +49311,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],290:[function(_dereq_,module,exports){ +},{}],326:[function(_dereq_,module,exports){ "use strict" module.exports = fastTwoSum @@ -48186,7 +49329,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],291:[function(_dereq_,module,exports){ +},{}],327:[function(_dereq_,module,exports){ "use strict"; var isPrototype = _dereq_("../prototype/is"); @@ -48207,7 +49350,7 @@ module.exports = function (value) { return !isPrototype(value); }; -},{"../prototype/is":298}],292:[function(_dereq_,module,exports){ +},{"../prototype/is":334}],328:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is") @@ -48230,7 +49373,7 @@ module.exports = function (value, defaultMessage, inputOptions) { throw new TypeError(resolveMessage(errorMessage, value)); }; -},{"../object/is":295,"../string/coerce":299,"../value/is":301,"./to-short-string":294}],293:[function(_dereq_,module,exports){ +},{"../object/is":331,"../string/coerce":335,"../value/is":337,"./to-short-string":330}],329:[function(_dereq_,module,exports){ "use strict"; module.exports = function (value) { @@ -48242,7 +49385,7 @@ module.exports = function (value) { } }; -},{}],294:[function(_dereq_,module,exports){ +},{}],330:[function(_dereq_,module,exports){ "use strict"; var safeToString = _dereq_("./safe-to-string"); @@ -48273,7 +49416,7 @@ module.exports = function (value) { return string; }; -},{"./safe-to-string":293}],295:[function(_dereq_,module,exports){ +},{"./safe-to-string":329}],331:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is"); @@ -48286,7 +49429,7 @@ module.exports = function (value) { return hasOwnProperty.call(possibleTypes, typeof value); }; -},{"../value/is":301}],296:[function(_dereq_,module,exports){ +},{"../value/is":337}],332:[function(_dereq_,module,exports){ "use strict"; var resolveException = _dereq_("../lib/resolve-exception") @@ -48297,7 +49440,7 @@ module.exports = function (value/*, options*/) { return resolveException(value, "%v is not a plain function", arguments[1]); }; -},{"../lib/resolve-exception":292,"./is":297}],297:[function(_dereq_,module,exports){ +},{"../lib/resolve-exception":328,"./is":333}],333:[function(_dereq_,module,exports){ "use strict"; var isFunction = _dereq_("../function/is"); @@ -48310,7 +49453,7 @@ module.exports = function (value) { return true; }; -},{"../function/is":291}],298:[function(_dereq_,module,exports){ +},{"../function/is":327}],334:[function(_dereq_,module,exports){ "use strict"; var isObject = _dereq_("../object/is"); @@ -48325,7 +49468,7 @@ module.exports = function (value) { } }; -},{"../object/is":295}],299:[function(_dereq_,module,exports){ +},{"../object/is":331}],335:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is") @@ -48350,7 +49493,7 @@ module.exports = function (value) { } }; -},{"../object/is":295,"../value/is":301}],300:[function(_dereq_,module,exports){ +},{"../object/is":331,"../value/is":337}],336:[function(_dereq_,module,exports){ "use strict"; var resolveException = _dereq_("../lib/resolve-exception") @@ -48361,7 +49504,7 @@ module.exports = function (value/*, options*/) { return resolveException(value, "Cannot use %v", arguments[1]); }; -},{"../lib/resolve-exception":292,"./is":301}],301:[function(_dereq_,module,exports){ +},{"../lib/resolve-exception":328,"./is":337}],337:[function(_dereq_,module,exports){ "use strict"; // ES3 safe @@ -48369,8 +49512,8 @@ var _undefined = void 0; module.exports = function (value) { return value !== _undefined && value !== null; }; -},{}],302:[function(_dereq_,module,exports){ -(function (global){ +},{}],338:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var bits = _dereq_('bit-twiddle') @@ -48623,8 +49766,8 @@ exports.clearCache = function clearCache() { } } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"bit-twiddle":40,"buffer":52,"dup":92}],303:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"bit-twiddle":40,"buffer":52,"dup":92}],339:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -48687,7 +49830,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],304:[function(_dereq_,module,exports){ +},{}],340:[function(_dereq_,module,exports){ "use strict" function unique_pred(list, compare) { @@ -48746,7 +49889,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],305:[function(_dereq_,module,exports){ +},{}],341:[function(_dereq_,module,exports){ var reg = /[\'\"]/ module.exports = function unquote(str) { @@ -48762,7 +49905,7 @@ module.exports = function unquote(str) { return str } -},{}],306:[function(_dereq_,module,exports){ +},{}],342:[function(_dereq_,module,exports){ /** * @module update-diff */ @@ -48795,7 +49938,7 @@ module.exports = function updateDiff (obj, diff, mappers) { return obj } -},{}],307:[function(_dereq_,module,exports){ +},{}],343:[function(_dereq_,module,exports){ "use strict" module.exports = createText @@ -48822,7 +49965,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":308}],308:[function(_dereq_,module,exports){ +},{"./lib/vtext":344}],344:[function(_dereq_,module,exports){ module.exports = vectorizeText module.exports.processPixels = processPixels @@ -49277,7 +50420,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":53,"clean-pslg":59,"ndarray":224,"planar-graph-to-polyline":239,"simplify-planar-graph":273,"surface-nets":279}],309:[function(_dereq_,module,exports){ +},{"cdt2d":53,"clean-pslg":59,"ndarray":258,"planar-graph-to-polyline":273,"simplify-planar-graph":309,"surface-nets":315}],345:[function(_dereq_,module,exports){ var hiddenStore = _dereq_('./hidden-store.js'); module.exports = createStore; @@ -49298,7 +50441,7 @@ function createStore() { }; } -},{"./hidden-store.js":310}],310:[function(_dereq_,module,exports){ +},{"./hidden-store.js":346}],346:[function(_dereq_,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -49316,7 +50459,7 @@ function hiddenStore(obj, key) { return store; } -},{}],311:[function(_dereq_,module,exports){ +},{}],347:[function(_dereq_,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -49347,14 +50490,14 @@ function weakMap() { } } -},{"./create-store.js":309}],312:[function(_dereq_,module,exports){ +},{"./create-store.js":345}],348:[function(_dereq_,module,exports){ var getContext = _dereq_('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":161}],313:[function(_dereq_,module,exports){ +},{"get-canvas-context":161}],349:[function(_dereq_,module,exports){ module.exports = _dereq_('cwise-compiler')({ args: ['array', { offset: [1], @@ -49406,7 +50549,7 @@ module.exports = _dereq_('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":79}],314:[function(_dereq_,module,exports){ +},{"cwise-compiler":79}],350:[function(_dereq_,module,exports){ "use strict" module.exports = findZeroCrossings @@ -49419,7 +50562,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":313}],315:[function(_dereq_,module,exports){ +},{"./lib/zc-core":349}],351:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -49490,7 +50633,7 @@ module.exports = [ } ]; -},{}],316:[function(_dereq_,module,exports){ +},{}],352:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -49505,7 +50648,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -49845,7 +51015,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":497,"../../plots/cartesian/constants":513,"../../plots/font_attributes":535,"./arrow_paths":315}],317:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":470,"../../plot_api/plot_template":534,"../../plots/cartesian/constants":551,"../../plots/font_attributes":573,"./arrow_paths":351}],353:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -49882,10 +51052,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -49934,7 +51106,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":460,"../../plots/cartesian/axes":507,"./draw":322}],318:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/cartesian/axes":545,"./draw":358}],354:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50072,7 +51244,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":460,"../../plot_api/plot_template":497,"../../registry":553}],319:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plot_api/plot_template":534,"../../registry":591}],355:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50151,7 +51323,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":460,"../color":331}],320:[function(_dereq_,module,exports){ +},{"../../lib":497,"../color":367}],356:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50214,7 +51386,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":486,"fast-isnumeric":155}],321:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":523,"fast-isnumeric":155}],357:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50277,7 +51449,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -50321,7 +51494,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":460,"../../plots/array_container_defaults":503,"../../plots/cartesian/axes":507,"./attributes":316,"./common_defaults":319}],322:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/array_container_defaults":540,"../../plots/cartesian/axes":545,"./attributes":352,"./common_defaults":355}],358:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -50337,6 +51510,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -50397,6 +51571,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -50620,13 +51819,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -50642,12 +51842,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -50664,8 +51869,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -50855,7 +52081,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -50886,22 +52112,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -50933,14 +52160,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -50949,7 +52179,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -50959,7 +52191,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -50979,7 +52213,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -51021,7 +52255,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":460,"../../lib/setcursor":480,"../../lib/svg_text_utils":484,"../../plot_api/plot_template":497,"../../plots/cartesian/axes":507,"../../plots/plots":545,"../../registry":553,"../color":331,"../dragelement":350,"../drawing":353,"../fx":371,"./draw_arrow_head":323,"d3":86}],323:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../lib/setcursor":517,"../../lib/svg_text_utils":521,"../../plot_api/plot_template":534,"../../plots/cartesian/axes":545,"../../plots/plots":583,"../../registry":591,"../color":367,"../dragelement":386,"../drawing":389,"../fx":407,"./draw_arrow_head":359,"d3":86}],359:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51039,6 +52273,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -51158,9 +52397,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -51172,7 +52411,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":331,"./arrow_paths":315,"d3":86}],324:[function(_dereq_,module,exports){ +},{"../../lib":497,"../color":367,"./arrow_paths":351,"d3":86}],360:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51206,7 +52445,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":519,"./attributes":316,"./calc_autorange":317,"./click":318,"./convert_coords":320,"./defaults":321,"./draw":322}],325:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":557,"./attributes":352,"./calc_autorange":353,"./click":354,"./convert_coords":356,"./defaults":357,"./draw":358}],361:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51294,7 +52533,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":490,"../../plot_api/plot_template":497,"../annotations/attributes":316}],326:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":527,"../../plot_api/plot_template":534,"../annotations/attributes":352}],362:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51359,7 +52598,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":460,"../../plots/cartesian/axes":507}],327:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/cartesian/axes":545}],363:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51435,7 +52674,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":460,"../../plots/array_container_defaults":503,"../../plots/cartesian/axes":507,"../annotations/common_defaults":319,"./attributes":325}],328:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/array_container_defaults":540,"../../plots/cartesian/axes":545,"../annotations/common_defaults":355,"./attributes":361}],364:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51487,7 +52726,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":542,"../annotations/draw":322}],329:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":580,"../annotations/draw":358}],365:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51535,7 +52774,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":460,"../../registry":553,"./attributes":325,"./convert":326,"./defaults":327,"./draw":328}],330:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"./attributes":361,"./convert":362,"./defaults":363,"./draw":364}],366:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51575,7 +52814,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],331:[function(_dereq_,module,exports){ +},{}],367:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51749,7 +52988,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":330,"fast-isnumeric":155,"tinycolor2":285}],332:[function(_dereq_,module,exports){ +},{"./attributes":366,"fast-isnumeric":155,"tinycolor2":321}],368:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51874,6 +53113,17 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -51890,6 +53140,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -51928,7 +53179,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":452,"../../plot_api/edit_types":490,"../../plots/cartesian/layout_attributes":521,"../../plots/font_attributes":535}],333:[function(_dereq_,module,exports){ +},{"../../lib/extend":489,"../../plot_api/edit_types":527,"../../plots/cartesian/layout_attributes":559,"../../plots/font_attributes":573}],369:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -51956,7 +53207,7 @@ module.exports = { } }; -},{}],334:[function(_dereq_,module,exports){ +},{}],370:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52010,10 +53261,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -52022,7 +53277,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":460,"../../plot_api/plot_template":497,"../../plots/cartesian/tick_label_defaults":528,"../../plots/cartesian/tick_mark_defaults":529,"../../plots/cartesian/tick_value_defaults":530,"./attributes":332}],335:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plot_api/plot_template":534,"../../plots/cartesian/tick_label_defaults":566,"../../plots/cartesian/tick_mark_defaults":567,"../../plots/cartesian/tick_value_defaults":568,"./attributes":368}],371:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52041,6 +53296,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -52295,10 +53551,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -52410,18 +53666,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -52485,20 +53742,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -52508,7 +53764,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -52553,7 +53813,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -52609,7 +53869,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -52704,10 +53964,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -52749,7 +54011,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":433,"../../lib":460,"../../lib/extend":452,"../../lib/setcursor":480,"../../lib/svg_text_utils":484,"../../plots/cartesian/axes":507,"../../plots/cartesian/axis_defaults":509,"../../plots/cartesian/layout_attributes":521,"../../plots/cartesian/position_defaults":524,"../../plots/plots":545,"../../registry":553,"../color":331,"../colorscale/helpers":342,"../dragelement":350,"../drawing":353,"../titles":426,"./constants":333,"d3":86,"tinycolor2":285}],336:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469,"../../lib":497,"../../lib/extend":489,"../../lib/setcursor":517,"../../lib/svg_text_utils":521,"../../plots/cartesian/axes":545,"../../plots/cartesian/axis_defaults":547,"../../plots/cartesian/layout_attributes":559,"../../plots/cartesian/position_defaults":562,"../../plots/plots":583,"../../registry":591,"../color":367,"../colorscale/helpers":378,"../dragelement":386,"../drawing":389,"../titles":462,"./constants":369,"d3":86,"tinycolor2":321}],372:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52768,7 +54030,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":460}],337:[function(_dereq_,module,exports){ +},{"../../lib":497}],373:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52790,7 +54052,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":332,"./defaults":334,"./draw":335,"./has_colorbar":336}],338:[function(_dereq_,module,exports){ +},{"./attributes":368,"./defaults":370,"./draw":371,"./has_colorbar":372}],374:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52998,7 +54260,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":476,"../colorbar/attributes":332,"./scales.js":346}],339:[function(_dereq_,module,exports){ +},{"../../lib/regex":513,"../colorbar/attributes":368,"./scales.js":382}],375:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53077,7 +54339,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":460,"./helpers":342,"fast-isnumeric":155}],340:[function(_dereq_,module,exports){ +},{"../../lib":497,"./helpers":378,"fast-isnumeric":155}],376:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53154,7 +54416,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":460,"./helpers":342}],341:[function(_dereq_,module,exports){ +},{"../../lib":497,"./helpers":378}],377:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53279,7 +54541,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":460,"../../registry":553,"../colorbar/defaults":334,"../colorbar/has_colorbar":336,"./scales":346,"fast-isnumeric":155}],342:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"../colorbar/defaults":370,"../colorbar/has_colorbar":372,"./scales":382,"fast-isnumeric":155}],378:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53519,7 +54781,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":460,"../color":331,"./scales":346,"d3":86,"fast-isnumeric":155,"tinycolor2":285}],343:[function(_dereq_,module,exports){ +},{"../../lib":497,"../color":367,"./scales":382,"d3":86,"fast-isnumeric":155,"tinycolor2":321}],379:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53561,7 +54823,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":338,"./calc":339,"./cross_trace_defaults":340,"./defaults":341,"./helpers":342,"./layout_attributes":344,"./layout_defaults":345,"./scales":346}],344:[function(_dereq_,module,exports){ +},{"./attributes":374,"./calc":375,"./cross_trace_defaults":376,"./defaults":377,"./helpers":378,"./layout_attributes":380,"./layout_defaults":381,"./scales":382}],380:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53622,7 +54884,7 @@ module.exports = { })) }; -},{"../../lib/extend":452,"./attributes":338,"./scales":346}],345:[function(_dereq_,module,exports){ +},{"../../lib/extend":489,"./attributes":374,"./scales":382}],381:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53673,7 +54935,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":460,"../../plot_api/plot_template":497,"./defaults":341,"./layout_attributes":344}],346:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plot_api/plot_template":534,"./defaults":377,"./layout_attributes":380}],382:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53877,7 +55139,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":285}],347:[function(_dereq_,module,exports){ +},{"tinycolor2":321}],383:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53910,7 +55172,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],348:[function(_dereq_,module,exports){ +},{}],384:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53948,7 +55210,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":460}],349:[function(_dereq_,module,exports){ +},{"../../lib":497}],385:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54007,7 +55269,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],350:[function(_dereq_,module,exports){ +},{}],386:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54299,7 +55561,7 @@ function pointerOffset(e) { ); } -},{"../../lib":460,"../../plots/cartesian/constants":513,"./align":347,"./cursor":348,"./unhover":351,"has-hover":203,"has-passive-events":204,"mouse-event-offset":219}],351:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/cartesian/constants":551,"./align":383,"./cursor":384,"./unhover":387,"has-hover":237,"has-passive-events":238,"mouse-event-offset":253}],387:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54354,7 +55616,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":450,"../../lib/events":451,"../../lib/throttle":485,"../fx/constants":365}],352:[function(_dereq_,module,exports){ +},{"../../lib/dom":487,"../../lib/events":488,"../../lib/throttle":522,"../fx/constants":401}],388:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54379,7 +55641,7 @@ exports.dash = { }; -},{}],353:[function(_dereq_,module,exports){ +},{}],389:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54399,6 +55661,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -54460,7 +55723,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -55086,7 +56349,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -55477,7 +56740,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -55511,7 +56774,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -55530,7 +56793,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -55561,9 +56824,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -55571,11 +56834,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":367,"../../constants/alignment":433,"../../constants/interactions":436,"../../constants/xmlns_namespaces":438,"../../lib":460,"../../lib/svg_text_utils":484,"../../registry":553,"../../traces/scatter/make_bubble_size_func":631,"../../traces/scatter/subtypes":638,"../color":331,"../colorscale":343,"./symbol_defs":354,"d3":86,"fast-isnumeric":155,"tinycolor2":285}],354:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":403,"../../constants/alignment":469,"../../constants/interactions":473,"../../constants/xmlns_namespaces":475,"../../lib":497,"../../lib/svg_text_utils":521,"../../registry":591,"../../traces/scatter/make_bubble_size_func":669,"../../traces/scatter/subtypes":677,"../color":367,"../colorscale":379,"./symbol_defs":390,"d3":86,"fast-isnumeric":155,"tinycolor2":321}],390:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56139,7 +57402,7 @@ module.exports = { } }; -},{"d3":86}],355:[function(_dereq_,module,exports){ +},{"d3":86}],391:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56254,7 +57517,7 @@ module.exports = { } }; -},{}],356:[function(_dereq_,module,exports){ +},{}],392:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56340,7 +57603,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":460,"../../plots/cartesian/axes":507,"../../registry":553,"./compute_error":357,"fast-isnumeric":155}],357:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/cartesian/axes":545,"../../registry":591,"./compute_error":393,"fast-isnumeric":155}],393:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56441,7 +57704,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],358:[function(_dereq_,module,exports){ +},{}],394:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56516,7 +57779,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":460,"../../plot_api/plot_template":497,"../../registry":553,"./attributes":355,"fast-isnumeric":155}],359:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plot_api/plot_template":534,"../../registry":591,"./attributes":391,"fast-isnumeric":155}],395:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56585,7 +57848,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":460,"../../plot_api/edit_types":490,"./attributes":355,"./calc":356,"./compute_error":357,"./defaults":358,"./plot":360,"./style":361}],360:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plot_api/edit_types":527,"./attributes":391,"./calc":392,"./compute_error":393,"./defaults":394,"./plot":396,"./style":397}],396:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56757,7 +58020,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":638,"../drawing":353,"d3":86,"fast-isnumeric":155}],361:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":677,"../drawing":389,"d3":86,"fast-isnumeric":155}],397:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56794,7 +58057,7 @@ module.exports = function style(traces) { }); }; -},{"../color":331,"d3":86}],362:[function(_dereq_,module,exports){ +},{"../color":367,"d3":86}],398:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56830,7 +58093,7 @@ module.exports = { } }; -},{"../../lib/extend":452,"../../plots/font_attributes":535,"./layout_attributes":372}],363:[function(_dereq_,module,exports){ +},{"../../lib/extend":489,"../../plots/font_attributes":573,"./layout_attributes":408}],399:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56889,7 +58152,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":460,"../../registry":553}],364:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591}],400:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56926,7 +58189,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":553,"./hover":368}],365:[function(_dereq_,module,exports){ +},{"../../registry":591,"./hover":404}],401:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56958,7 +58221,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],366:[function(_dereq_,module,exports){ +},{}],402:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56984,7 +58247,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":460,"./attributes":362,"./hoverlabel_defaults":369}],367:[function(_dereq_,module,exports){ +},{"../../lib":497,"./attributes":398,"./hoverlabel_defaults":405}],403:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57246,7 +58509,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":460}],368:[function(_dereq_,module,exports){ +},{"../../lib":497}],404:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57262,6 +58525,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -57441,7 +58706,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -57585,6 +58852,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -57965,10 +59238,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -58209,7 +59480,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -58317,7 +59588,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -58352,8 +59623,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -58361,7 +59637,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -58461,8 +59737,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -58721,7 +59997,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -58737,7 +60016,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -58746,49 +60026,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -59100,7 +60381,7 @@ function plainText(s, len) { }); } -},{"../../lib":460,"../../lib/events":451,"../../lib/override_cursor":471,"../../lib/svg_text_utils":484,"../../plots/cartesian/axes":507,"../../registry":553,"../color":331,"../dragelement":350,"../drawing":353,"../legend/defaults":383,"../legend/draw":384,"./constants":365,"./helpers":367,"d3":86,"fast-isnumeric":155,"tinycolor2":285}],369:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../lib/events":488,"../../lib/override_cursor":508,"../../lib/svg_text_utils":521,"../../plots/cartesian/axes":545,"../../registry":591,"../color":367,"../dragelement":386,"../drawing":389,"../legend/defaults":419,"../legend/draw":420,"./constants":401,"./helpers":403,"d3":86,"fast-isnumeric":155,"tinycolor2":321}],405:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59146,7 +60427,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":460,"../color":331,"./helpers":367}],370:[function(_dereq_,module,exports){ +},{"../../lib":497,"../color":367,"./helpers":403}],406:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59202,7 +60483,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":460,"./layout_attributes":372}],371:[function(_dereq_,module,exports){ +},{"../../lib":497,"./layout_attributes":408}],407:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59281,7 +60562,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":460,"../dragelement":350,"./attributes":362,"./calc":363,"./click":364,"./constants":365,"./defaults":366,"./helpers":367,"./hover":368,"./layout_attributes":372,"./layout_defaults":373,"./layout_global_defaults":374,"d3":86}],372:[function(_dereq_,module,exports){ +},{"../../lib":497,"../dragelement":386,"./attributes":398,"./calc":399,"./click":400,"./constants":401,"./defaults":402,"./helpers":403,"./hover":404,"./layout_attributes":408,"./layout_defaults":409,"./layout_global_defaults":410,"d3":86}],408:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59397,7 +60678,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":535,"./constants":365}],373:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":573,"./constants":401}],409:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59445,7 +60726,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":460,"./helpers":367,"./hoverlabel_defaults":369,"./hovermode_defaults":370,"./layout_attributes":372}],374:[function(_dereq_,module,exports){ +},{"../../lib":497,"./helpers":403,"./hoverlabel_defaults":405,"./hovermode_defaults":406,"./layout_attributes":408}],410:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59468,7 +60749,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":460,"./hoverlabel_defaults":369,"./layout_attributes":372}],375:[function(_dereq_,module,exports){ +},{"../../lib":497,"./hoverlabel_defaults":405,"./layout_attributes":408}],411:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59842,7 +61123,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":460,"../../lib/regex":476,"../../plot_api/plot_template":497,"../../plots/cartesian/constants":513,"../../plots/domain":534}],376:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../lib/regex":513,"../../plot_api/plot_template":534,"../../plots/cartesian/constants":551,"../../plots/domain":572}],412:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59855,6 +61136,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -59977,7 +61259,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw' }); -},{"../../plot_api/plot_template":497,"../../plots/cartesian/constants":513}],377:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":470,"../../plot_api/plot_template":534,"../../plots/cartesian/constants":551}],413:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60058,7 +61340,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":486,"fast-isnumeric":155}],378:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":523,"fast-isnumeric":155}],414:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60110,7 +61392,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -60123,7 +61405,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":460,"../../plots/array_container_defaults":503,"../../plots/cartesian/axes":507,"./attributes":376}],379:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/array_container_defaults":540,"../../plots/cartesian/axes":545,"./attributes":412}],415:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60137,6 +61419,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -60153,7 +61436,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -60256,10 +61539,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -60268,8 +61566,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -60293,8 +61608,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -60348,7 +61663,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":438,"../../plots/cartesian/axes":507,"../drawing":353,"d3":86}],380:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":475,"../../plots/cartesian/axes":545,"../../plots/cartesian/axis_ids":548,"../drawing":389,"d3":86}],416:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60372,7 +61687,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":519,"./attributes":376,"./convert_coords":377,"./defaults":378,"./draw":379}],381:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":557,"./attributes":412,"./convert_coords":413,"./defaults":414,"./draw":415}],417:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60444,6 +61759,14 @@ module.exports = { editType: 'legend', + }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + + editType: 'legend', + }, itemclick: { @@ -60533,7 +61856,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":535,"../color/attributes":330}],382:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":573,"../color/attributes":366}],418:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60553,13 +61876,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],383:[function(_dereq_,module,exports){ +},{}],419:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60675,6 +61996,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -60693,7 +62015,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":460,"../../plot_api/plot_template":497,"../../plots/layout_attributes":543,"../../registry":553,"./attributes":381,"./helpers":387}],384:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plot_api/plot_template":534,"../../plots/layout_attributes":581,"../../registry":591,"./attributes":417,"./helpers":423}],420:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60785,7 +62107,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -61106,11 +62427,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -61163,11 +62484,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -61237,7 +62561,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -61290,8 +62615,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -61404,7 +62729,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -61487,7 +62812,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":433,"../../lib":460,"../../lib/events":451,"../../lib/svg_text_utils":484,"../../plots/plots":545,"../../registry":553,"../color":331,"../dragelement":350,"../drawing":353,"./constants":382,"./get_legend_data":385,"./handle_click":386,"./helpers":387,"./style":389,"d3":86}],385:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469,"../../lib":497,"../../lib/events":488,"../../lib/svg_text_utils":521,"../../plots/plots":583,"../../registry":591,"../color":367,"../dragelement":386,"../drawing":389,"./constants":418,"./get_legend_data":421,"./handle_click":422,"./helpers":423,"./style":425,"d3":86}],421:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61596,7 +62921,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":553,"./helpers":387}],386:[function(_dereq_,module,exports){ +},{"../../registry":591,"./helpers":423}],422:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61835,7 +63160,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":460,"../../registry":553}],387:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591}],423:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61859,7 +63184,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],388:[function(_dereq_,module,exports){ +},{}],424:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61883,7 +63208,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":381,"./defaults":383,"./draw":384,"./style":389}],389:[function(_dereq_,module,exports){ +},{"./attributes":417,"./defaults":419,"./draw":420,"./style":425}],425:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61898,6 +63223,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -61906,6 +63232,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -61916,6 +63244,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -61944,7 +63275,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -62047,7 +63378,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -62067,7 +63398,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -62157,7 +63488,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -62169,7 +63500,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -62197,7 +63528,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -62237,7 +63568,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -62261,7 +63592,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -62301,7 +63632,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -62328,7 +63659,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -62364,7 +63695,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -62462,7 +63793,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -62510,7 +63841,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":460,"../../registry":553,"../../traces/pie/helpers":607,"../../traces/pie/style_one":608,"../../traces/scatter/subtypes":638,"../color":331,"../colorscale/helpers":342,"../drawing":353,"d3":86}],390:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"../../traces/pie/helpers":645,"../../traces/pie/style_one":646,"../../traces/scatter/subtypes":677,"../color":367,"../colorscale/helpers":378,"../drawing":389,"./constants":418,"d3":86}],426:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63246,7 +64577,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":441,"../../lib":460,"../../plots/cartesian/axis_ids":510,"../../plots/plots":545,"../../registry":553,"../shapes/draw":412}],391:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":478,"../../lib":497,"../../plots/cartesian/axis_ids":548,"../../plots/plots":583,"../../registry":591,"../shapes/draw":448}],427:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63260,7 +64591,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":392}],392:[function(_dereq_,module,exports){ +},{"./manage":428}],428:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63556,7 +64887,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":510,"../../registry":553,"../../traces/scatter/subtypes":638,"../fx/helpers":367,"./buttons":390,"./modebar":393}],393:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":548,"../../registry":591,"../../traces/scatter/subtypes":677,"../fx/helpers":403,"./buttons":426,"./modebar":429}],429:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63902,7 +65233,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":441,"../../lib":460,"d3":86,"fast-isnumeric":155}],394:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":478,"../../lib":497,"d3":86,"fast-isnumeric":155}],430:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64038,7 +65369,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":497,"../../plots/font_attributes":535,"../color/attributes":330}],395:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":534,"../../plots/font_attributes":573,"../color/attributes":366}],431:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64067,7 +65398,7 @@ module.exports = { darkAmount: 10 }; -},{}],396:[function(_dereq_,module,exports){ +},{}],432:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64159,7 +65490,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":460,"../../plot_api/plot_template":497,"../../plots/array_container_defaults":503,"../color":331,"./attributes":394,"./constants":395}],397:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plot_api/plot_template":534,"../../plots/array_container_defaults":540,"../color":367,"./attributes":430,"./constants":431}],433:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64177,6 +65508,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -64306,8 +65638,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -64358,9 +65689,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -64413,10 +65742,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":433,"../../lib":460,"../../lib/svg_text_utils":484,"../../plots/cartesian/axis_ids":510,"../../plots/plots":545,"../../registry":553,"../color":331,"../drawing":353,"./constants":395,"./get_update_object":398,"d3":86}],398:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469,"../../lib":497,"../../lib/svg_text_utils":521,"../../plots/cartesian/axis_ids":548,"../../plots/plots":583,"../../registry":591,"../color":367,"../drawing":389,"./constants":431,"./get_update_object":434,"d3":86}],434:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64470,7 +65799,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":86}],399:[function(_dereq_,module,exports){ +},{"d3":86}],435:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64497,7 +65826,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":394,"./defaults":396,"./draw":397}],400:[function(_dereq_,module,exports){ +},{"./attributes":430,"./defaults":432,"./draw":433}],436:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64571,7 +65900,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":330}],401:[function(_dereq_,module,exports){ +},{"../color/attributes":366}],437:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64605,7 +65934,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":506,"../../plots/cartesian/axis_ids":510,"./constants":402}],402:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":544,"../../plots/cartesian/axis_ids":548,"./constants":438}],438:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64661,7 +65990,7 @@ module.exports = { extraPad: 15 }; -},{}],403:[function(_dereq_,module,exports){ +},{}],439:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64747,7 +66076,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":460,"../../plot_api/plot_template":497,"../../plots/cartesian/axis_ids":510,"./attributes":400,"./oppaxis_attributes":407}],404:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plot_api/plot_template":534,"../../plots/cartesian/axis_ids":548,"./attributes":436,"./oppaxis_attributes":443}],440:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64764,6 +66093,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -64869,7 +66199,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -64982,6 +66312,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -65128,10 +66460,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -65153,7 +66485,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -65369,14 +66701,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -65390,7 +66720,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":460,"../../lib/setcursor":480,"../../plots/cartesian":520,"../../plots/cartesian/axis_ids":510,"../../plots/plots":545,"../../registry":553,"../color":331,"../dragelement":350,"../drawing":353,"../titles":426,"./constants":402,"d3":86}],405:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../lib/setcursor":517,"../../plots/cartesian":558,"../../plots/cartesian/axis_ids":548,"../../plots/plots":583,"../../registry":591,"../color":367,"../dragelement":386,"../drawing":389,"../titles":462,"./constants":438,"d3":86}],441:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65465,7 +66795,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":433,"../../lib/svg_text_utils":484,"../../plots/cartesian/axis_ids":510,"./constants":402}],406:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469,"../../lib/svg_text_utils":521,"../../plots/cartesian/axis_ids":548,"./constants":438}],442:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65504,7 +66834,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":460,"./attributes":400,"./calc_autorange":401,"./defaults":403,"./draw":404,"./helpers":405,"./oppaxis_attributes":407}],407:[function(_dereq_,module,exports){ +},{"../../lib":497,"./attributes":436,"./calc_autorange":437,"./defaults":439,"./draw":440,"./helpers":441,"./oppaxis_attributes":443}],443:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65542,7 +66872,7 @@ module.exports = { editType: 'calc' }; -},{}],408:[function(_dereq_,module,exports){ +},{}],444:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65558,6 +66888,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -65694,7 +67025,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":452,"../../plot_api/plot_template":497,"../../traces/scatter/attributes":614,"../annotations/attributes":316,"../drawing/attributes":352}],409:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":470,"../../lib/extend":489,"../../plot_api/plot_template":534,"../../traces/scatter/attributes":652,"../annotations/attributes":352,"../drawing/attributes":388}],445:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65722,9 +67053,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -65735,7 +67069,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -65811,7 +67145,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":460,"../../plots/cartesian/axes":507,"./constants":410,"./helpers":419}],410:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/cartesian/axes":545,"./constants":446,"./helpers":455}],446:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65875,7 +67209,7 @@ module.exports = { } }; -},{}],411:[function(_dereq_,module,exports){ +},{}],447:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65941,9 +67275,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -66004,7 +67340,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":460,"../../plots/array_container_defaults":503,"../../plots/cartesian/axes":507,"./attributes":408,"./helpers":419}],412:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/array_container_defaults":540,"../../plots/cartesian/axes":545,"./attributes":444,"./helpers":455}],448:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66190,7 +67526,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -66216,11 +67555,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -66591,6 +67932,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -66598,15 +67941,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -66763,7 +68114,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":460,"../../lib/setcursor":480,"../../plot_api/plot_template":497,"../../plots/cartesian/axes":507,"../../plots/cartesian/handle_outline":517,"../../registry":553,"../color":331,"../dragelement":350,"../drawing":353,"./constants":410,"./draw_newshape/display_outlines":416,"./draw_newshape/helpers":417,"./helpers":419}],413:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../lib/setcursor":517,"../../plot_api/plot_template":534,"../../plots/cartesian/axes":545,"../../plots/cartesian/handle_outline":555,"../../registry":591,"../color":367,"../dragelement":386,"../drawing":389,"./constants":446,"./draw_newshape/display_outlines":452,"./draw_newshape/helpers":453,"./helpers":455}],449:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66866,7 +68217,7 @@ module.exports = { } }; -},{"../../../lib/extend":452,"../../drawing/attributes":352}],414:[function(_dereq_,module,exports){ +},{"../../../lib/extend":489,"../../drawing/attributes":388}],450:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66890,7 +68241,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],415:[function(_dereq_,module,exports){ +},{}],451:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66922,7 +68273,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":331}],416:[function(_dereq_,module,exports){ +},{"../../color":367}],452:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67217,7 +68568,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":517,"../../../registry":553,"../../dragelement":350,"../../dragelement/helpers":349,"./constants":414,"./helpers":417,"./newshapes":418}],417:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":555,"../../../registry":591,"../../dragelement":386,"../../dragelement/helpers":385,"./constants":450,"./helpers":453,"./newshapes":454}],453:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67555,7 +68906,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":518,"./constants":414,"parse-svg-path":231}],418:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":556,"./constants":450,"parse-svg-path":265}],454:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67814,7 +69165,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":517,"../../../plots/cartesian/helpers":518,"../../dragelement/helpers":349,"./constants":414,"./helpers":417}],419:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":555,"../../../plots/cartesian/helpers":556,"../../dragelement/helpers":385,"./constants":450,"./helpers":453}],455:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67875,18 +69226,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -67896,13 +69253,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -67959,7 +69323,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":460,"./constants":410}],420:[function(_dereq_,module,exports){ +},{"../../lib":497,"./constants":446}],456:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67987,7 +69351,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":519,"./attributes":408,"./calc_autorange":409,"./defaults":411,"./draw":412,"./draw_newshape/defaults":415}],421:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":557,"./attributes":444,"./calc_autorange":445,"./defaults":447,"./draw":448,"./draw_newshape/defaults":451}],457:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68230,7 +69594,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":452,"../../plot_api/edit_types":490,"../../plot_api/plot_template":497,"../../plots/animation_attributes":502,"../../plots/font_attributes":535,"../../plots/pad_attributes":544,"./constants":422}],422:[function(_dereq_,module,exports){ +},{"../../lib/extend":489,"../../plot_api/edit_types":527,"../../plot_api/plot_template":534,"../../plots/animation_attributes":539,"../../plots/font_attributes":573,"../../plots/pad_attributes":582,"./constants":458}],458:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68324,7 +69688,7 @@ module.exports = { currentValueInset: 0, }; -},{}],423:[function(_dereq_,module,exports){ +},{}],459:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68439,7 +69803,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":460,"../../plots/array_container_defaults":503,"./attributes":421,"./constants":422}],424:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/array_container_defaults":540,"./attributes":457,"./constants":458}],460:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68456,6 +69820,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -68744,11 +70109,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -68799,11 +70163,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -69016,7 +70379,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -69071,7 +70434,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":433,"../../lib":460,"../../lib/svg_text_utils":484,"../../plot_api/plot_template":497,"../../plots/plots":545,"../color":331,"../drawing":353,"./constants":422,"d3":86}],425:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469,"../../lib":497,"../../lib/svg_text_utils":521,"../../plot_api/plot_template":534,"../../plots/plots":583,"../color":367,"../drawing":389,"./constants":458,"d3":86}],461:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69094,7 +70457,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":421,"./constants":422,"./defaults":423,"./draw":424}],426:[function(_dereq_,module,exports){ +},{"./attributes":457,"./constants":458,"./defaults":459,"./draw":460}],462:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69112,6 +70475,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -69232,7 +70596,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -69310,7 +70674,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -69361,7 +70725,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":433,"../../constants/interactions":436,"../../lib":460,"../../lib/svg_text_utils":484,"../../plots/plots":545,"../../registry":553,"../color":331,"../drawing":353,"d3":86,"fast-isnumeric":155}],427:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469,"../../constants/interactions":473,"../../lib":497,"../../lib/svg_text_utils":521,"../../plots/plots":583,"../../registry":591,"../color":367,"../drawing":389,"d3":86,"fast-isnumeric":155}],463:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69530,7 +70894,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":452,"../../plot_api/edit_types":490,"../../plot_api/plot_template":497,"../../plots/font_attributes":535,"../../plots/pad_attributes":544,"../color/attributes":330}],428:[function(_dereq_,module,exports){ +},{"../../lib/extend":489,"../../plot_api/edit_types":527,"../../plot_api/plot_template":534,"../../plots/font_attributes":573,"../../plots/pad_attributes":582,"../color/attributes":366}],464:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69611,7 +70975,7 @@ module.exports = { } }; -},{}],429:[function(_dereq_,module,exports){ +},{}],465:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69694,7 +71058,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":460,"../../plots/array_container_defaults":503,"./attributes":427,"./constants":428}],430:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/array_container_defaults":540,"./attributes":463,"./constants":464}],466:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69892,8 +71256,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -70132,11 +71495,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -70347,9 +71709,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":433,"../../lib":460,"../../lib/svg_text_utils":484,"../../plot_api/plot_template":497,"../../plots/plots":545,"../color":331,"../drawing":353,"./constants":428,"./scrollbox":432,"d3":86}],431:[function(_dereq_,module,exports){ -arguments[4][425][0].apply(exports,arguments) -},{"./attributes":427,"./constants":428,"./defaults":429,"./draw":430,"dup":425}],432:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469,"../../lib":497,"../../lib/svg_text_utils":521,"../../plot_api/plot_template":534,"../../plots/plots":583,"../color":367,"../drawing":389,"./constants":464,"./scrollbox":468,"d3":86}],467:[function(_dereq_,module,exports){ +arguments[4][461][0].apply(exports,arguments) +},{"./attributes":463,"./constants":464,"./defaults":465,"./draw":466,"dup":461}],468:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70814,7 +72176,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":460,"../color":331,"../drawing":353,"d3":86}],433:[function(_dereq_,module,exports){ +},{"../../lib":497,"../color":367,"../drawing":389,"d3":86}],469:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70879,7 +72241,39 @@ module.exports = { } }; -},{}],434:[function(_dereq_,module,exports){ +},{}],470:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],471:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70895,7 +72289,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],435:[function(_dereq_,module,exports){ +},{}],472:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70933,7 +72327,7 @@ module.exports = { } }; -},{}],436:[function(_dereq_,module,exports){ +},{}],473:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70956,7 +72350,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],437:[function(_dereq_,module,exports){ +},{}],474:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71029,7 +72423,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],438:[function(_dereq_,module,exports){ +},{}],475:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71053,7 +72447,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],439:[function(_dereq_,module,exports){ +},{}],476:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71139,7 +72533,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":324,"./components/annotations3d":329,"./components/colorbar":337,"./components/colorscale":343,"./components/errorbars":359,"./components/fx":371,"./components/grid":375,"./components/images":380,"./components/legend":388,"./components/rangeselector":399,"./components/rangeslider":406,"./components/shapes":420,"./components/sliders":425,"./components/updatemenus":431,"./fonts/mathjax_config":440,"./fonts/ploticon":441,"./lib/queue":475,"./locale-en":488,"./locale-en-us":487,"./plot_api":492,"./plot_api/plot_schema":496,"./plots/plots":545,"./registry":553,"./snapshot":558,"./traces/scatter":626,"./version":666,"d3":86,"es6-promise":139}],440:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":360,"./components/annotations3d":365,"./components/colorbar":373,"./components/colorscale":379,"./components/errorbars":395,"./components/fx":407,"./components/grid":411,"./components/images":416,"./components/legend":424,"./components/rangeselector":435,"./components/rangeslider":442,"./components/shapes":456,"./components/sliders":461,"./components/updatemenus":467,"./fonts/mathjax_config":477,"./fonts/ploticon":478,"./lib/queue":512,"./locale-en":525,"./locale-en-us":524,"./plot_api":529,"./plot_api/plot_schema":533,"./plots/plots":583,"./registry":591,"./snapshot":596,"./traces/scatter":664,"./version":705,"d3":86,"es6-promise":139}],477:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71170,7 +72564,7 @@ module.exports = function() { } }; -},{}],441:[function(_dereq_,module,exports){ +},{}],478:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71350,7 +72744,7 @@ module.exports = { } }; -},{}],442:[function(_dereq_,module,exports){ +},{}],479:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71414,7 +72808,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],443:[function(_dereq_,module,exports){ +},{}],480:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71655,7 +73049,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":467}],444:[function(_dereq_,module,exports){ +},{"./mod":504}],481:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71812,7 +73206,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],445:[function(_dereq_,module,exports){ +},{}],482:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71845,7 +73239,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":437,"fast-isnumeric":155}],446:[function(_dereq_,module,exports){ +},{"../constants/numerical":474,"fast-isnumeric":155}],483:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71873,7 +73267,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],447:[function(_dereq_,module,exports){ +},{}],484:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71896,7 +73290,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],448:[function(_dereq_,module,exports){ +},{}],485:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72360,7 +73754,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":346,"../constants/interactions":436,"../plots/attributes":504,"./array":444,"./mod":467,"./nested_property":468,"./regex":476,"fast-isnumeric":155,"tinycolor2":285}],449:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":382,"../constants/interactions":473,"../plots/attributes":541,"./array":481,"./mod":504,"./nested_property":505,"./regex":513,"fast-isnumeric":155,"tinycolor2":321}],486:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72408,9 +73802,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -72418,7 +73826,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -72947,7 +74355,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":437,"../registry":553,"./loggers":464,"./mod":467,"d3-time-format":84,"fast-isnumeric":155}],450:[function(_dereq_,module,exports){ +},{"../constants/numerical":474,"../registry":591,"./loggers":501,"./mod":504,"d3-time-format":84,"fast-isnumeric":155}],487:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72960,6 +74368,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -73041,16 +74451,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":464,"d3":86}],451:[function(_dereq_,module,exports){ +},{"./loggers":501,"./matrix":503,"d3":86,"gl-mat4":188}],488:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73223,7 +74706,7 @@ var Events = { module.exports = Events; -},{"events":51}],452:[function(_dereq_,module,exports){ +},{"events":51}],489:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73337,7 +74820,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":461}],453:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":498}],490:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73388,7 +74871,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],454:[function(_dereq_,module,exports){ +},{}],491:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73436,7 +74919,7 @@ function isCalcData(cont) { ); } -},{}],455:[function(_dereq_,module,exports){ +},{}],492:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73680,7 +75163,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":467}],456:[function(_dereq_,module,exports){ +},{"./mod":504}],493:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73759,14 +75242,11 @@ function formatColor(containerIn, opacityIn, len) { return colorOut; } -function parseColorScale(cont, alpha) { - if(alpha === undefined) alpha = 1; - +function parseColorScale(cont) { var cOpts = Colorscale.extractOpts(cont); - var colorscale = cOpts.reversescale ? - Colorscale.flipScale(cOpts.colorscale) : - cOpts.colorscale; + var colorscale = cOpts.colorscale; + if(cOpts.reversescale) colorscale = Colorscale.flipScale(cOpts.colorscale); return colorscale.map(function(elem) { var index = elem[0]; @@ -73774,7 +75254,7 @@ function parseColorScale(cont, alpha) { var rgb = color.toRgb(); return { index: index, - rgb: [rgb.r, rgb.g, rgb.b, alpha] + rgb: [rgb.r, rgb.g, rgb.b, rgb.a] }; }); } @@ -73784,7 +75264,7 @@ module.exports = { parseColorScale: parseColorScale }; -},{"../components/color/attributes":330,"../components/colorscale":343,"./array":444,"color-normalize":63,"fast-isnumeric":155,"tinycolor2":285}],457:[function(_dereq_,module,exports){ +},{"../components/color/attributes":366,"../components/colorscale":379,"./array":481,"color-normalize":63,"fast-isnumeric":155,"tinycolor2":321}],494:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73820,7 +75300,7 @@ module.exports = { unwrap: function(d) {return d[0];} }; -},{"./identity":458}],458:[function(_dereq_,module,exports){ +},{"./identity":495}],495:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73836,7 +75316,7 @@ module.exports = { module.exports = function identity(d) { return d; }; -},{}],459:[function(_dereq_,module,exports){ +},{}],496:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73878,7 +75358,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],460:[function(_dereq_,module,exports){ +},{}],497:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73969,8 +75449,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -74026,6 +75509,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -75076,6 +76563,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -75102,13 +76601,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -75126,7 +76623,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":437,"./anchor_utils":442,"./angles":443,"./array":444,"./clean_number":445,"./clear_responsive":447,"./coerce":448,"./dates":449,"./dom":450,"./extend":452,"./filter_unique":453,"./filter_visible":454,"./geometry2d":455,"./identity":458,"./increment":459,"./is_plain_object":461,"./keyed_container":462,"./localize":463,"./loggers":464,"./make_trace_groups":465,"./matrix":466,"./mod":467,"./nested_property":468,"./noop":469,"./notifier":470,"./push_unique":474,"./regex":476,"./relative_attr":477,"./relink_private":478,"./search":479,"./stats":482,"./throttle":485,"./to_log_range":486,"d3":86,"d3-time-format":84,"fast-isnumeric":155}],461:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":474,"./anchor_utils":479,"./angles":480,"./array":481,"./clean_number":482,"./clear_responsive":484,"./coerce":485,"./dates":486,"./dom":487,"./extend":489,"./filter_unique":490,"./filter_visible":491,"./geometry2d":492,"./identity":495,"./increment":496,"./is_plain_object":498,"./keyed_container":499,"./localize":500,"./loggers":501,"./make_trace_groups":502,"./matrix":503,"./mod":504,"./nested_property":505,"./noop":506,"./notifier":507,"./push_unique":511,"./regex":513,"./relative_attr":514,"./relink_private":515,"./search":516,"./stats":519,"./throttle":522,"./to_log_range":523,"d3":86,"d3-time-format":84,"fast-isnumeric":155}],498:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75154,7 +76668,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],462:[function(_dereq_,module,exports){ +},{}],499:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75347,7 +76861,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":468}],463:[function(_dereq_,module,exports){ +},{"./nested_property":505}],500:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75403,7 +76917,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":553}],464:[function(_dereq_,module,exports){ +},{"../registry":591}],501:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75513,7 +77027,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":495,"./notifier":470}],465:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":532,"./notifier":507}],502:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75556,7 +77070,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":86}],466:[function(_dereq_,module,exports){ +},{"d3":86}],503:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75568,6 +77082,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -75643,13 +77158,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -75663,7 +77188,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],467:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":188}],504:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75698,7 +77257,7 @@ module.exports = { modHalf: modHalf }; -},{}],468:[function(_dereq_,module,exports){ +},{}],505:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75944,7 +77503,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":444,"fast-isnumeric":155}],469:[function(_dereq_,module,exports){ +},{"./array":481,"fast-isnumeric":155}],506:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75960,7 +77519,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],470:[function(_dereq_,module,exports){ +},{}],507:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76048,7 +77607,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":86,"fast-isnumeric":155}],471:[function(_dereq_,module,exports){ +},{"d3":86,"fast-isnumeric":155}],508:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76096,7 +77655,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":480}],472:[function(_dereq_,module,exports){ +},{"./setcursor":517}],509:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76348,8 +77907,8 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":437,"./matrix":466}],473:[function(_dereq_,module,exports){ -(function (global){ +},{"../constants/numerical":474,"./matrix":503}],510:[function(_dereq_,module,exports){ +(function (global){(function (){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76421,8 +77980,8 @@ module.exports = function prepareRegl(gd, extensions) { return success; }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./show_no_webgl_msg":481,"regl":260}],474:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./show_no_webgl_msg":518,"regl":296}],511:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76460,7 +78019,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],475:[function(_dereq_,module,exports){ +},{}],512:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76668,7 +78227,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":460,"../plot_api/plot_config":495}],476:[function(_dereq_,module,exports){ +},{"../lib":497,"../plot_api/plot_config":532}],513:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76698,7 +78257,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],477:[function(_dereq_,module,exports){ +},{}],514:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76751,7 +78310,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],478:[function(_dereq_,module,exports){ +},{}],515:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76808,7 +78367,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":444,"./is_plain_object":461}],479:[function(_dereq_,module,exports){ +},{"./array":481,"./is_plain_object":498}],516:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77013,7 +78572,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":437,"./identity":458,"./loggers":464,"fast-isnumeric":155}],480:[function(_dereq_,module,exports){ +},{"../constants/numerical":474,"./identity":495,"./loggers":501,"fast-isnumeric":155}],517:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77036,7 +78595,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],481:[function(_dereq_,module,exports){ +},{}],518:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77100,7 +78659,7 @@ module.exports = function showNoWebGlMsg(scene) { return false; }; -},{"../components/color":331}],482:[function(_dereq_,module,exports){ +},{"../components/color":367}],519:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77210,7 +78769,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":444,"fast-isnumeric":155}],483:[function(_dereq_,module,exports){ +},{"./array":481,"fast-isnumeric":155}],520:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77231,7 +78790,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"color-normalize":63}],484:[function(_dereq_,module,exports){ +},{"color-normalize":63}],521:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77248,6 +78807,7 @@ module.exports = str2RgbaArray; var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -77362,7 +78922,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -77977,9 +79537,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -78110,7 +79681,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":433,"../constants/xmlns_namespaces":438,"../lib":460,"d3":86}],485:[function(_dereq_,module,exports){ +},{"../constants/alignment":469,"../constants/xmlns_namespaces":475,"../lib":497,"d3":86}],522:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78213,7 +79784,7 @@ function _clearTimeout(cache) { } } -},{}],486:[function(_dereq_,module,exports){ +},{}],523:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78241,7 +79812,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":155}],487:[function(_dereq_,module,exports){ +},{"fast-isnumeric":155}],524:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78263,7 +79834,7 @@ module.exports = { } }; -},{}],488:[function(_dereq_,module,exports){ +},{}],525:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78306,7 +79877,7 @@ module.exports = { } }; -},{}],489:[function(_dereq_,module,exports){ +},{}],526:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78364,7 +79935,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":553}],490:[function(_dereq_,module,exports){ +},{"../registry":591}],527:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78489,7 +80060,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":460}],491:[function(_dereq_,module,exports){ +},{"../lib":497}],528:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78666,6 +80237,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -78710,7 +80291,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -79181,7 +80762,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":331,"../lib":460,"../plots/cartesian/axis_ids":510,"../plots/plots":545,"../registry":553,"fast-isnumeric":155,"gl-mat4/fromQuat":171}],492:[function(_dereq_,module,exports){ +},{"../components/color":367,"../lib":497,"../plots/cartesian/axis_ids":548,"../plots/plots":583,"../registry":591,"fast-isnumeric":155,"gl-mat4/fromQuat":178}],529:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79224,7 +80805,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":555,"./plot_api":494,"./template_api":499,"./to_image":500,"./validate":501}],493:[function(_dereq_,module,exports){ +},{"../snapshot/download":593,"./plot_api":531,"./template_api":536,"./to_image":537,"./validate":538}],530:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79437,7 +81018,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":461,"../lib/loggers":464,"../lib/noop":469,"../lib/search":479,"../registry":553,"./container_array_match":489}],494:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":498,"../lib/loggers":501,"../lib/noop":506,"../lib/search":516,"../registry":591,"./container_array_match":526}],531:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79807,7 +81388,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -79821,9 +81413,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -81401,6 +83000,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -81495,7 +83100,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -81585,7 +83190,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -81723,21 +83328,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -83148,6 +84751,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -83155,15 +84771,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -83189,6 +84810,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -83322,7 +84944,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":331,"../components/drawing":353,"../constants/xmlns_namespaces":438,"../lib":460,"../lib/events":451,"../lib/queue":475,"../lib/svg_text_utils":484,"../plots/cartesian/axes":507,"../plots/cartesian/constants":513,"../plots/cartesian/graph_interact":516,"../plots/cartesian/select":526,"../plots/plots":545,"../plots/polar/legacy":548,"../registry":553,"./edit_types":490,"./helpers":491,"./manage_arrays":493,"./plot_config":495,"./plot_schema":496,"./subroutines":498,"d3":86,"fast-isnumeric":155,"has-hover":203}],495:[function(_dereq_,module,exports){ +},{"../components/color":367,"../components/drawing":389,"../constants/xmlns_namespaces":475,"../lib":497,"../lib/events":488,"../lib/queue":512,"../lib/svg_text_utils":521,"../plots/cartesian/axes":545,"../plots/cartesian/constants":551,"../plots/cartesian/graph_interact":554,"../plots/cartesian/select":564,"../plots/plots":583,"../plots/polar/legacy":586,"../registry":591,"./edit_types":527,"./helpers":528,"./manage_arrays":530,"./plot_config":532,"./plot_schema":533,"./subroutines":535,"d3":86,"fast-isnumeric":155,"has-hover":237}],532:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83637,7 +85259,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],496:[function(_dereq_,module,exports){ +},{}],533:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84348,7 +85970,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":460,"../plots/animation_attributes":502,"../plots/attributes":504,"../plots/frame_attributes":536,"../plots/layout_attributes":543,"../plots/polar/legacy/area_attributes":546,"../plots/polar/legacy/axis_attributes":547,"../registry":553,"./edit_types":490,"./plot_config":495}],497:[function(_dereq_,module,exports){ +},{"../lib":497,"../plots/animation_attributes":539,"../plots/attributes":541,"../plots/frame_attributes":574,"../plots/layout_attributes":581,"../plots/polar/legacy/area_attributes":584,"../plots/polar/legacy/axis_attributes":585,"../registry":591,"./edit_types":527,"./plot_config":532}],534:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84660,7 +86282,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":460,"../plots/attributes":504}],498:[function(_dereq_,module,exports){ +},{"../lib":497,"../plots/attributes":541}],535:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84841,7 +86463,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -85330,57 +86952,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - - enforceAxisConstraints(gd); - - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; - - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); + + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -85406,7 +87006,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":331,"../components/drawing":353,"../components/modebar":391,"../components/titles":426,"../constants/alignment":433,"../lib":460,"../lib/clear_gl_canvases":446,"../plots/cartesian/autorange":506,"../plots/cartesian/axes":507,"../plots/cartesian/constraints":514,"../plots/plots":545,"../registry":553,"d3":86}],499:[function(_dereq_,module,exports){ +},{"../components/color":367,"../components/drawing":389,"../components/modebar":427,"../components/titles":462,"../constants/alignment":469,"../lib":497,"../lib/clear_gl_canvases":483,"../plots/cartesian/autorange":544,"../plots/cartesian/axes":545,"../plots/cartesian/constraints":552,"../plots/plots":583,"../registry":591,"d3":86}],536:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85868,7 +87468,7 @@ function format(opts) { return opts; } -},{"../lib":460,"../plots/attributes":504,"../plots/plots":545,"./plot_config":495,"./plot_schema":496,"./plot_template":497}],500:[function(_dereq_,module,exports){ +},{"../lib":497,"../plots/attributes":541,"../plots/plots":583,"./plot_config":532,"./plot_schema":533,"./plot_template":534}],537:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85965,7 +87565,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -86089,7 +87689,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":460,"../plots/plots":545,"../snapshot/helpers":557,"../snapshot/svgtoimg":559,"../snapshot/tosvg":561,"../version":666,"./plot_api":494,"fast-isnumeric":155}],501:[function(_dereq_,module,exports){ +},{"../lib":497,"../plots/plots":583,"../snapshot/helpers":595,"../snapshot/svgtoimg":597,"../snapshot/tosvg":599,"../version":705,"./plot_api":531,"fast-isnumeric":155}],538:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86520,7 +88120,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":460,"../plots/plots":545,"./plot_config":495,"./plot_schema":496}],502:[function(_dereq_,module,exports){ +},{"../lib":497,"../plots/plots":583,"./plot_config":532,"./plot_schema":533}],539:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86632,7 +88232,7 @@ module.exports = { } }; -},{}],503:[function(_dereq_,module,exports){ +},{}],540:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86727,7 +88327,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":460,"../plot_api/plot_template":497}],504:[function(_dereq_,module,exports){ +},{"../lib":497,"../plot_api/plot_template":534}],541:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86868,7 +88468,99 @@ module.exports = { } }; -},{"../components/fx/attributes":362}],505:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":398}],542:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":474,"../../lib":497,"fast-isnumeric":155}],543:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86897,7 +88589,7 @@ module.exports = { } }; -},{}],506:[function(_dereq_,module,exports){ +},{}],544:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86914,6 +88606,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -86954,7 +88648,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -86995,19 +88690,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -87015,9 +88697,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -87035,8 +88717,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -87050,7 +88732,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -87071,7 +88753,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -87080,12 +88762,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -87095,13 +88777,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -87113,7 +88823,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -87142,14 +88942,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -87409,7 +89229,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":437,"../../lib":460,"../../registry":553,"fast-isnumeric":155}],507:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"../../registry":591,"./axis_ids":548,"fast-isnumeric":155}],545:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87426,6 +89246,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -87459,6 +89280,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -87503,14 +89326,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -87518,6 +89344,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -87542,8 +89383,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -87552,7 +89393,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -87611,7 +89451,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -87933,6 +89775,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -87957,7 +89802,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -87967,6 +89812,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -87980,6 +89829,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -87992,15 +90025,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -88012,85 +90050,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } + var flip = ax._id.charAt(0) === 'y'; - var pos = ax.c2p(tickVal.value); + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -88111,180 +90145,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } - - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -88377,7 +90263,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -88394,15 +90281,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -88515,7 +90404,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -88998,6 +90888,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -89270,21 +91161,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -89385,23 +91278,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -89432,13 +91326,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -89459,7 +91353,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -89475,7 +91369,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -89495,7 +91389,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -89527,7 +91421,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -89539,7 +91433,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -89554,7 +91448,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -89810,21 +91704,81 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; +}; + +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; -}; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} /** * Make axis tick path string @@ -89871,24 +91825,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -89896,42 +91871,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } + + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } - out.xFn = function(d) { return d.dx + x0; }; + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } + + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -90183,6 +92217,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -90200,22 +92236,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -90283,11 +92363,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -90327,6 +92420,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -90808,7 +92921,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":331,"../../components/drawing":353,"../../components/titles":426,"../../constants/alignment":433,"../../constants/numerical":437,"../../lib":460,"../../lib/svg_text_utils":484,"../../plots/plots":545,"../../registry":553,"./autorange":506,"./axis_autotype":508,"./axis_ids":510,"./clean_ticks":512,"./layout_attributes":521,"./set_convert":527,"d3":86,"fast-isnumeric":155}],508:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../components/drawing":389,"../../components/titles":462,"../../constants/alignment":469,"../../constants/numerical":474,"../../lib":497,"../../lib/svg_text_utils":521,"../../plots/plots":583,"../../registry":591,"./autorange":544,"./axis_autotype":546,"./axis_ids":548,"./clean_ticks":550,"./layout_attributes":559,"./set_convert":565,"d3":86,"fast-isnumeric":155}],546:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90825,23 +92938,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; + + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } + + if(moreDates(a, calendar)) return 'date'; - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -90854,56 +92993,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":437,"../../lib":460,"fast-isnumeric":155}],509:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"fast-isnumeric":155}],547:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90960,9 +93109,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -91020,7 +93193,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -91032,8 +93208,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -91186,7 +93360,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":460,"../../registry":553,"../array_container_defaults":503,"./category_order_defaults":511,"./constants":513,"./layout_attributes":521,"./line_grid_defaults":523,"./set_convert":527,"./tick_label_defaults":528,"./tick_mark_defaults":529,"./tick_value_defaults":530,"fast-isnumeric":155}],510:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"../array_container_defaults":540,"./category_order_defaults":549,"./constants":551,"./layout_attributes":559,"./line_grid_defaults":561,"./set_convert":565,"./tick_label_defaults":566,"./tick_mark_defaults":567,"./tick_value_defaults":568,"fast-isnumeric":155}],548:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91207,7 +93381,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -91219,13 +93393,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -91271,6 +93452,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -91303,17 +93486,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":553,"./constants":513}],511:[function(_dereq_,module,exports){ +},{"../../registry":591,"./constants":551}],549:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91407,7 +93594,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],512:[function(_dereq_,module,exports){ +},{}],550:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91420,7 +93607,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -91485,7 +93674,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -91495,7 +93686,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":437,"../../lib":460,"fast-isnumeric":155}],513:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"fast-isnumeric":155}],551:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91510,8 +93701,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -91523,7 +93714,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -91587,7 +93778,7 @@ module.exports = { } }; -},{"../../lib/regex":476}],514:[function(_dereq_,module,exports){ +},{"../../lib/regex":513}],552:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91599,74 +93790,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; + + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } + + var canLink = linkableAxes.length; + + var matches, scaleanchor; + + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -91677,64 +94074,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; +} - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -91743,12 +94115,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -91761,38 +94135,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); } } - thisGroup[scaleanchor] = 1; + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } + } + + out[key] = val; + } + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -91901,25 +94346,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -91941,6 +94387,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -91973,7 +94429,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":433,"../../constants/numerical":437,"../../lib":460,"./autorange":506,"./axis_ids":510,"./scale_zoom":525}],515:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469,"../../constants/numerical":474,"../../lib":497,"./autorange":544,"./axis_ids":548,"./layout_attributes":559,"./scale_zoom":563,"./set_convert":565}],553:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91990,6 +94446,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -92066,6 +94523,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -92097,10 +94557,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -92137,6 +94598,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -92302,6 +94766,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -92319,8 +94789,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -92520,6 +94990,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -92529,6 +95001,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -92537,7 +95025,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -92568,15 +95056,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -92585,12 +95075,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -92600,7 +95094,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -92610,9 +95104,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -92812,15 +95321,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -92836,7 +95345,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -93048,7 +95557,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -93061,7 +95570,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -93126,11 +95635,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -93141,14 +95652,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -93158,7 +95677,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -93245,7 +95767,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":331,"../../components/dragelement":350,"../../components/dragelement/helpers":349,"../../components/drawing":353,"../../components/fx":371,"../../constants/alignment":433,"../../lib":460,"../../lib/clear_gl_canvases":446,"../../lib/setcursor":480,"../../lib/svg_text_utils":484,"../../plot_api/subroutines":498,"../../registry":553,"../plots":545,"./axes":507,"./axis_ids":510,"./constants":513,"./scale_zoom":525,"./select":526,"d3":86,"has-passive-events":204,"tinycolor2":285}],516:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../components/dragelement":386,"../../components/dragelement/helpers":385,"../../components/drawing":389,"../../components/fx":407,"../../constants/alignment":469,"../../lib":497,"../../lib/clear_gl_canvases":483,"../../lib/setcursor":517,"../../lib/svg_text_utils":521,"../../plot_api/subroutines":535,"../../registry":591,"../plots":583,"./axes":545,"./axis_ids":548,"./constants":551,"./scale_zoom":563,"./select":564,"d3":86,"has-passive-events":238,"tinycolor2":321}],554:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93413,7 +95935,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":350,"../../components/fx":371,"../../lib/setcursor":480,"./constants":513,"./dragbox":515,"d3":86}],517:[function(_dereq_,module,exports){ +},{"../../components/dragelement":386,"../../components/fx":407,"../../lib/setcursor":517,"./constants":551,"./dragbox":553,"d3":86}],555:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93449,7 +95971,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],518:[function(_dereq_,module,exports){ +},{}],556:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93461,6 +95983,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -93491,9 +96015,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -93503,7 +96028,7 @@ module.exports = { getTransform: getTransform }; -},{}],519:[function(_dereq_,module,exports){ +},{"../../lib":497}],557:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93517,6 +96042,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -93546,8 +96072,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -93578,7 +96106,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":460,"../../registry":553}],520:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"./axis_ids":548}],558:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93916,6 +96444,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -94195,7 +96724,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":353,"../../constants/xmlns_namespaces":438,"../../lib":460,"../../registry":553,"../get_data":537,"../plots":545,"./attributes":505,"./axis_ids":510,"./constants":513,"./graph_interact":516,"./layout_attributes":521,"./layout_defaults":522,"./transition_axes":531,"d3":86}],521:[function(_dereq_,module,exports){ +},{"../../components/drawing":389,"../../constants/xmlns_namespaces":475,"../../lib":497,"../../registry":591,"../get_data":575,"../plots":583,"./attributes":543,"./axis_ids":548,"./constants":551,"./graph_interact":554,"./layout_attributes":559,"./layout_defaults":560,"./transition_axes":569,"d3":86}],559:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94268,6 +96797,14 @@ module.exports = { // type in the template explicitly it will be honored as the default. _noTemplating: true, + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, autorange: { valType: 'enumerated', @@ -94328,7 +96865,6 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', editType: 'plot', @@ -94492,6 +97028,22 @@ module.exports = { editType: 'ticks', + }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + editType: 'calc', + }, mirror: { valType: 'enumerated', @@ -94632,6 +97184,14 @@ module.exports = { editType: 'ticks', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'ticks', + }, separatethousands: { valType: 'boolean', @@ -94884,7 +97444,7 @@ module.exports = { } }; -},{"../../components/color/attributes":330,"../../components/drawing/attributes":352,"../../constants/docs":434,"../../constants/numerical":437,"../../lib/extend":452,"../../plot_api/plot_template":497,"../font_attributes":535,"./constants":513}],522:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":366,"../../components/drawing/attributes":388,"../../constants/docs":471,"../../constants/numerical":474,"../../lib/extend":489,"../../plot_api/plot_template":534,"../font_attributes":573,"./constants":551}],560:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -94906,7 +97466,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -94925,6 +97485,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -95133,6 +97695,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -95197,6 +97760,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -95261,101 +97825,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":331,"../../components/fx/helpers":367,"../../components/fx/hovermode_defaults":370,"../../lib":460,"../../plot_api/plot_template":497,"../../registry":553,"../layout_attributes":543,"./axis_defaults":509,"./axis_ids":510,"./constants":513,"./constraints":514,"./layout_attributes":521,"./position_defaults":524,"./type_defaults":532}],523:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../components/fx/helpers":403,"../../components/fx/hovermode_defaults":406,"../../lib":497,"../../plot_api/plot_template":534,"../../registry":591,"../layout_attributes":581,"./axis_defaults":547,"./axis_ids":548,"./constants":551,"./constraints":552,"./layout_attributes":559,"./position_defaults":562,"./type_defaults":570}],561:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95420,7 +97896,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":330,"../../lib":460,"tinycolor2":285}],524:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":366,"../../lib":497,"tinycolor2":321}],562:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95508,7 +97984,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":460,"fast-isnumeric":155}],525:[function(_dereq_,module,exports){ +},{"../../lib":497,"fast-isnumeric":155}],563:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95534,9 +98010,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":433}],526:[function(_dereq_,module,exports){ +},{"../../constants/alignment":469}],564:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95606,6 +98083,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -95695,8 +98180,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -96471,7 +98956,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":331,"../../components/dragelement/helpers":349,"../../components/drawing":353,"../../components/fx":371,"../../components/fx/helpers":367,"../../components/shapes/draw_newshape/display_outlines":416,"../../components/shapes/draw_newshape/helpers":417,"../../components/shapes/draw_newshape/newshapes":418,"../../lib":460,"../../lib/clear_gl_canvases":446,"../../lib/polygon":472,"../../lib/throttle":485,"../../plot_api/subroutines":498,"../../registry":553,"./axis_ids":510,"./constants":513,"./handle_outline":517,"./helpers":518,"polybooljs":242}],527:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../components/dragelement/helpers":385,"../../components/drawing":389,"../../components/fx":407,"../../components/fx/helpers":403,"../../components/shapes/draw_newshape/display_outlines":452,"../../components/shapes/draw_newshape/helpers":453,"../../components/shapes/draw_newshape/newshapes":454,"../../lib":497,"../../lib/clear_gl_canvases":483,"../../lib/polygon":509,"../../lib/throttle":522,"../../plot_api/subroutines":535,"../../registry":591,"./axis_ids":548,"./constants":551,"./handle_outline":555,"./helpers":556,"polybooljs":276}],565:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96504,7 +98989,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -96660,6 +99144,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -96791,12 +99279,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -96839,17 +99327,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -97353,38 +99836,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -97443,7 +99914,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":437,"../../lib":460,"./axis_ids":510,"./constants":513,"d3":86,"d3-time-format":84,"fast-isnumeric":155}],528:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"./axis_ids":548,"./constants":551,"d3":86,"d3-time-format":84,"fast-isnumeric":155}],566:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97456,6 +99927,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -97492,10 +99964,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -97518,6 +99994,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -97564,7 +100041,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":460,"../array_container_defaults":503,"./layout_attributes":521}],529:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../lib":497,"../array_container_defaults":540,"./layout_attributes":559}],567:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97597,7 +100074,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":460,"./layout_attributes":521}],530:[function(_dereq_,module,exports){ +},{"../../lib":497,"./layout_attributes":559}],568:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97644,7 +100121,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":460,"./clean_ticks":512}],531:[function(_dereq_,module,exports){ +},{"../../lib":497,"./clean_ticks":550}],569:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97857,7 +100334,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":353,"../../lib":460,"../../registry":553,"./axes":507,"d3":86}],532:[function(_dereq_,module,exports){ +},{"../../components/drawing":389,"../../lib":497,"../../registry":591,"./axes":545,"d3":86}],570:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97876,6 +100353,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -97928,6 +100406,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -97994,7 +100474,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":553,"./axis_autotype":508}],533:[function(_dereq_,module,exports){ +},{"../../registry":591,"./axis_autotype":546}],571:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98421,7 +100901,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":460,"../registry":553}],534:[function(_dereq_,module,exports){ +},{"../lib":497,"../registry":591}],572:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98533,7 +101013,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":452}],535:[function(_dereq_,module,exports){ +},{"../lib/extend":489}],573:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98598,7 +101078,7 @@ module.exports = function(opts) { return attrs; }; -},{}],536:[function(_dereq_,module,exports){ +},{}],574:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98644,7 +101124,7 @@ module.exports = { } }; -},{}],537:[function(_dereq_,module,exports){ +},{}],575:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98773,7 +101253,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":553,"./cartesian/constants":513}],538:[function(_dereq_,module,exports){ +},{"../registry":591,"./cartesian/constants":551}],576:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99068,7 +101548,7 @@ function createCamera(scene) { return result; } -},{"../cartesian/constants":513,"has-passive-events":204,"mouse-change":218,"mouse-event-offset":219,"mouse-wheel":221}],539:[function(_dereq_,module,exports){ +},{"../cartesian/constants":551,"has-passive-events":238,"mouse-change":252,"mouse-event-offset":253,"mouse-wheel":255}],577:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99311,7 +101791,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/str2rgbarray":483,"../cartesian/axes":507}],540:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":520,"../cartesian/axes":545}],578:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99462,7 +101942,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/fx/layout_attributes":372,"../../constants/xmlns_namespaces":438,"../../plot_api/edit_types":490,"../cartesian":520,"../cartesian/attributes":505,"../cartesian/constants":513,"../get_data":537,"../layout_attributes":543,"./scene2d":541}],541:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":408,"../../constants/xmlns_namespaces":475,"../../plot_api/edit_types":527,"../cartesian":558,"../cartesian/attributes":543,"../cartesian/constants":551,"../get_data":575,"../layout_attributes":581,"./scene2d":579}],579:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99610,11 +102090,6 @@ proto.makeFramework = function() { this.updateSize(canvas); - // disabling user select on the canvas - // sanitizes double-clicks interactions - // ref: https://github.com/plotly/plotly.js/issues/744 - canvas.className += ' user-select-none'; - // create SVG container for hover text var svgContainer = this.svgContainer = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -100187,7 +102662,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../components/dragelement/helpers":349,"../../components/fx":371,"../../lib/show_no_webgl_msg":481,"../../plots/cartesian/axes":507,"../../registry":553,"../cartesian/autorange":506,"../cartesian/constants":513,"../cartesian/constraints":514,"./camera":538,"./convert":539,"gl-plot2d":177,"gl-select-box":181,"gl-spikes2d":190,"webgl-context":312}],542:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":385,"../../components/fx":407,"../../lib/show_no_webgl_msg":518,"../../plots/cartesian/axes":545,"../../registry":591,"../cartesian/autorange":544,"../cartesian/constants":551,"../cartesian/constraints":552,"./camera":576,"./convert":577,"gl-plot2d":209,"gl-select-box":215,"gl-spikes2d":224,"webgl-context":348}],580:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100221,7 +102696,7 @@ function project(camera, v) { module.exports = project; -},{}],543:[function(_dereq_,module,exports){ +},{}],581:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100409,6 +102884,12 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + + editType: 'none', + + }, paper_bgcolor: { valType: 'color', @@ -100424,6 +102905,14 @@ module.exports = { dflt: colorAttrs.background, editType: 'layoutstyle', + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, separators: { valType: 'string', @@ -100548,7 +103037,7 @@ module.exports = { } }; -},{"../components/color/attributes":330,"../components/shapes/draw_newshape/attributes":413,"../lib/extend":452,"./animation_attributes":502,"./font_attributes":535,"./pad_attributes":544}],544:[function(_dereq_,module,exports){ +},{"../components/color/attributes":366,"../components/shapes/draw_newshape/attributes":449,"../lib/extend":489,"./animation_attributes":539,"./font_attributes":573,"./pad_attributes":582}],582:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100603,7 +103092,7 @@ module.exports = function(opts) { }; }; -},{}],545:[function(_dereq_,module,exports){ +},{}],583:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101273,7 +103762,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -102082,6 +104571,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -102470,6 +104961,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -102487,6 +104981,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -102506,13 +105004,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -102537,6 +105037,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -102551,8 +105056,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -102584,11 +105087,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -102598,11 +105100,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -102612,6 +105113,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -102638,11 +105151,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -102766,7 +105292,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -103666,6 +106205,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -103676,7 +106218,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -103686,27 +106227,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -103715,18 +106257,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -103749,16 +106287,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -103800,12 +106341,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -103814,13 +106351,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -103942,7 +106480,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":331,"../constants/numerical":437,"../lib":460,"../plot_api/plot_schema":496,"../plot_api/plot_template":497,"../plots/get_data":537,"../registry":553,"./animation_attributes":502,"./attributes":504,"./cartesian/axis_ids":510,"./cartesian/handle_outline":517,"./command":533,"./font_attributes":535,"./frame_attributes":536,"./layout_attributes":543,"d3":86,"d3-time-format":84,"fast-isnumeric":155}],546:[function(_dereq_,module,exports){ +},{"../components/color":367,"../constants/numerical":474,"../lib":497,"../plot_api/plot_schema":533,"../plot_api/plot_template":534,"../plots/get_data":575,"../registry":591,"./animation_attributes":539,"./attributes":541,"./cartesian/axis_ids":548,"./cartesian/handle_outline":555,"./command":571,"./font_attributes":573,"./frame_attributes":574,"./layout_attributes":581,"d3":86,"d3-time-format":84,"fast-isnumeric":155}],584:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103986,7 +106524,7 @@ module.exports = { } }; -},{"../../../lib/extend":452,"../../../traces/scatter/attributes":614}],547:[function(_dereq_,module,exports){ +},{"../../../lib/extend":489,"../../../traces/scatter/attributes":652}],585:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104108,7 +106646,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":452,"../../../plot_api/edit_types":490,"../../cartesian/layout_attributes":521}],548:[function(_dereq_,module,exports){ +},{"../../../lib/extend":489,"../../../plot_api/edit_types":527,"../../cartesian/layout_attributes":559}],586:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104123,7 +106661,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":549,"./micropolar_manager":550}],549:[function(_dereq_,module,exports){ +},{"./micropolar":587,"./micropolar_manager":588}],587:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105543,7 +108081,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":433,"../../../lib":460,"d3":86}],550:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":469,"../../../lib":497,"d3":86}],588:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105629,7 +108167,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":331,"../../../lib":460,"./micropolar":549,"./undo_manager":551,"d3":86}],551:[function(_dereq_,module,exports){ +},{"../../../components/color":367,"../../../lib":497,"./micropolar":587,"./undo_manager":589,"d3":86}],589:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105695,7 +108233,7 @@ module.exports = function UndoManager() { }; }; -},{}],552:[function(_dereq_,module,exports){ +},{}],590:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105778,7 +108316,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":434}],553:[function(_dereq_,module,exports){ +},{"../constants/docs":471}],591:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106244,7 +108782,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":450,"./lib/extend":452,"./lib/is_plain_object":461,"./lib/loggers":464,"./lib/noop":469,"./lib/push_unique":474,"./plots/attributes":504,"./plots/layout_attributes":543}],554:[function(_dereq_,module,exports){ +},{"./lib/dom":487,"./lib/extend":489,"./lib/is_plain_object":498,"./lib/loggers":501,"./lib/noop":506,"./lib/push_unique":511,"./plots/attributes":541,"./plots/layout_attributes":581}],592:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106417,7 +108955,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":460,"../registry":553}],555:[function(_dereq_,module,exports){ +},{"../lib":497,"../registry":591}],593:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106451,6 +108989,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -106487,7 +109027,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":460,"../plot_api/to_image":500,"./filesaver":556,"./helpers":557}],556:[function(_dereq_,module,exports){ +},{"../lib":497,"../plot_api/to_image":537,"./filesaver":594,"./helpers":595}],594:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106567,7 +109107,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":460,"./helpers":557}],557:[function(_dereq_,module,exports){ +},{"../lib":497,"./helpers":595}],595:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106650,7 +109190,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":553}],558:[function(_dereq_,module,exports){ +},{"../registry":591}],596:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106676,7 +109216,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":554,"./download":555,"./helpers":557,"./svgtoimg":559,"./toimage":560,"./tosvg":561}],559:[function(_dereq_,module,exports){ +},{"./cloneplot":592,"./download":593,"./helpers":595,"./svgtoimg":597,"./toimage":598,"./tosvg":599}],597:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106803,7 +109343,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":460,"./helpers":557,"events":51}],560:[function(_dereq_,module,exports){ +},{"../lib":497,"./helpers":595,"events":51}],598:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106880,7 +109420,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":460,"../registry":553,"./cloneplot":554,"./helpers":557,"./svgtoimg":559,"./tosvg":561,"events":51}],561:[function(_dereq_,module,exports){ +},{"../lib":497,"../registry":591,"./cloneplot":592,"./helpers":595,"./svgtoimg":597,"./tosvg":599,"events":51}],599:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107069,7 +109609,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":331,"../components/drawing":353,"../constants/xmlns_namespaces":438,"../lib":460,"d3":86}],562:[function(_dereq_,module,exports){ +},{"../components/color":367,"../components/drawing":389,"../constants/xmlns_namespaces":475,"../lib":497,"d3":86}],600:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107102,7 +109642,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":460}],563:[function(_dereq_,module,exports){ +},{"../../lib":497}],601:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107136,6 +109676,14 @@ module.exports = extendFlat({ y: heatmapAttrs.y, y0: heatmapAttrs.y0, dy: heatmapAttrs.dy, + + xperiod: heatmapAttrs.xperiod, + yperiod: heatmapAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: heatmapAttrs.xperiodalignment, + yperiodalignment: heatmapAttrs.yperiodalignment, + text: heatmapAttrs.text, hovertext: heatmapAttrs.hovertext, transpose: heatmapAttrs.transpose, @@ -107289,7 +109837,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":338,"../../components/drawing/attributes":352,"../../constants/docs":434,"../../constants/filter_ops":435,"../../lib/extend":452,"../../plots/font_attributes":535,"../heatmap/attributes":576,"../scatter/attributes":614}],564:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":374,"../../components/drawing/attributes":388,"../../constants/docs":471,"../../constants/filter_ops":472,"../../lib/extend":489,"../../plots/font_attributes":573,"../heatmap/attributes":614,"../scatter/attributes":652}],602:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107342,7 +109890,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale":343,"../heatmap/calc":577,"./end_plus":569,"./set_contours":572}],565:[function(_dereq_,module,exports){ +},{"../../components/colorscale":379,"../heatmap/calc":615,"./end_plus":607,"./set_contours":610}],603:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107393,7 +109941,7 @@ module.exports = { calc: calc }; -},{"../../components/colorscale":343,"./end_plus":569,"./make_color_map":571}],566:[function(_dereq_,module,exports){ +},{"../../components/colorscale":379,"./end_plus":607,"./make_color_map":609}],604:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107487,7 +110035,7 @@ function handleConstraintValueDefaults(coerce, contours) { } } -},{"../../components/color":331,"../../constants/filter_ops":435,"./label_defaults":570,"fast-isnumeric":155}],567:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../constants/filter_ops":472,"./label_defaults":608,"fast-isnumeric":155}],605:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107516,7 +110064,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce, coerc if(autoContour || !contourSize) coerce('ncontours'); }; -},{}],568:[function(_dereq_,module,exports){ +},{}],606:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107530,6 +110078,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce, coerc var Lib = _dereq_('../../lib'); var handleXYZDefaults = _dereq_('../heatmap/xyz_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleConstraintDefaults = _dereq_('./constraint_defaults'); var handleContoursDefaults = _dereq_('./contours_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); @@ -107551,6 +110100,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); @@ -107567,7 +110118,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../lib":460,"../heatmap/xyz_defaults":584,"./attributes":563,"./constraint_defaults":566,"./contours_defaults":567,"./style_defaults":573}],569:[function(_dereq_,module,exports){ +},{"../../lib":497,"../heatmap/xyz_defaults":622,"../scatter/period_defaults":672,"./attributes":601,"./constraint_defaults":604,"./contours_defaults":605,"./style_defaults":611}],607:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107587,7 +110138,7 @@ module.exports = function endPlus(contours) { return contours.end + contours.size / 1e6; }; -},{}],570:[function(_dereq_,module,exports){ +},{}],608:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107617,7 +110168,7 @@ module.exports = function handleLabelDefaults(coerce, layout, lineColor, opts) { if(opts.hasHover !== false) coerce('zhoverformat'); }; -},{"../../lib":460}],571:[function(_dereq_,module,exports){ +},{"../../lib":497}],609:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107701,7 +110252,7 @@ module.exports = function makeColorMap(trace) { ); }; -},{"../../components/colorscale":343,"./end_plus":569,"d3":86}],572:[function(_dereq_,module,exports){ +},{"../../components/colorscale":379,"./end_plus":607,"d3":86}],610:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107805,7 +110356,7 @@ function autoContours(start, end, ncontours) { return dummyAx; } -},{"../../lib":460,"../../plots/cartesian/axes":507}],573:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/cartesian/axes":545}],611:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107850,7 +110401,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, handleLabelDefaults(coerce, layout, lineColor, opts); }; -},{"../../components/colorscale/defaults":341,"./label_defaults":570}],574:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":377,"./label_defaults":608}],612:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108039,7 +110590,7 @@ function createContour(scene, fullTrace, calcTrace) { module.exports = createContour; -},{"../../lib/str2rgbarray":483,"../../plots/cartesian/axes":507,"../contour/make_color_map":571,"gl-contour2d":165,"gl-heatmap2d":169}],575:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":520,"../../plots/cartesian/axes":545,"../contour/make_color_map":609,"gl-contour2d":165,"gl-heatmap2d":170}],613:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108069,7 +110620,7 @@ module.exports = { } }; -},{"../../plot_api/edit_types":490,"../../plots/gl2d":540,"../contour/attributes":563,"../contour/calc":564,"../contour/colorbar":565,"../contour/defaults":568,"./convert":574}],576:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":527,"../../plots/gl2d":578,"../contour/attributes":601,"../contour/calc":602,"../contour/colorbar":603,"../contour/defaults":606,"./convert":612}],614:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108101,6 +110652,13 @@ module.exports = extendFlat({ y0: extendFlat({}, scatterAttrs.y0, {impliedEdits: {ytype: 'scaled'}}), dy: extendFlat({}, scatterAttrs.dy, {impliedEdits: {ytype: 'scaled'}}), + xperiod: extendFlat({}, scatterAttrs.xperiod, {impliedEdits: {xtype: 'scaled'}}), + yperiod: extendFlat({}, scatterAttrs.yperiod, {impliedEdits: {ytype: 'scaled'}}), + xperiod0: extendFlat({}, scatterAttrs.xperiod0, {impliedEdits: {xtype: 'scaled'}}), + yperiod0: extendFlat({}, scatterAttrs.yperiod0, {impliedEdits: {ytype: 'scaled'}}), + xperiodalignment: extendFlat({}, scatterAttrs.xperiodalignment, {impliedEdits: {xtype: 'scaled'}}), + yperiodalignment: extendFlat({}, scatterAttrs.yperiodalignment, {impliedEdits: {ytype: 'scaled'}}), + text: { valType: 'data_array', editType: 'calc', @@ -108184,7 +110742,7 @@ module.exports = extendFlat({ colorScaleAttrs('', {cLetter: 'z', autoColorDflt: false}) ); -},{"../../components/colorscale/attributes":338,"../../constants/docs":434,"../../lib/extend":452,"../../plots/attributes":504,"../../plots/template_attributes":552,"../scatter/attributes":614}],577:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":374,"../../constants/docs":471,"../../lib/extend":489,"../../plots/attributes":541,"../../plots/template_attributes":590,"../scatter/attributes":652}],615:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108198,6 +110756,7 @@ module.exports = extendFlat({ var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var histogram2dCalc = _dereq_('../histogram2d/calc'); var colorscaleCalc = _dereq_('../../components/colorscale/calc'); @@ -108217,15 +110776,9 @@ module.exports = function calc(gd, trace) { var isHist = Registry.traceIs(trace, 'histogram'); var isGL2D = Registry.traceIs(trace, 'gl2d'); var zsmooth = isContour ? 'best' : trace.zsmooth; - var x; - var x0; - var dx; - var y; - var y0; - var dy; - var z; - var i; - var binned; + var x, x0, dx, origX; + var y, y0, dy, origY; + var z, i, binned; // cancel minimum tick spacings (only applies to bars and boxes) xa._minDtick = 0; @@ -108233,12 +110786,16 @@ module.exports = function calc(gd, trace) { if(isHist) { binned = histogram2dCalc(gd, trace); + origX = binned.orig_x; x = binned.x; x0 = binned.x0; dx = binned.dx; + + origY = binned.orig_y; y = binned.y; y0 = binned.y0; dy = binned.dy; + z = binned.z; } else { var zIn = trace.z; @@ -108248,8 +110805,12 @@ module.exports = function calc(gd, trace) { y = trace._y; zIn = trace._z; } else { - x = trace._x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace._y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + origX = trace.x ? xa.makeCalcdata(trace, 'x') : []; + origY = trace.y ? ya.makeCalcdata(trace, 'y') : []; + x = alignPeriod(trace, xa, 'x', origX); + y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; } x0 = trace.x0; @@ -108331,6 +110892,13 @@ module.exports = function calc(gd, trace) { hovertext: trace._hovertext || trace.hovertext }; + if(trace.xperiodalignment && origX) { + cd0.orig_x = origX; + } + if(trace.yperiodalignment && origY) { + cd0.orig_y = origY; + } + if(xIn && xIn.length === xArray.length - 1) cd0.xCenter = xIn; if(yIn && yIn.length === yArray.length - 1) cd0.yCenter = yIn; @@ -108383,7 +110951,7 @@ function dropZonBreaks(x, y, z) { return newZ; } -},{"../../components/colorscale/calc":339,"../../constants/numerical":437,"../../lib":460,"../../plots/cartesian/axes":507,"../../registry":553,"../histogram2d/calc":594,"./clean_2d_array":578,"./convert_column_xyz":580,"./find_empties":581,"./interp2d":582,"./make_bound_array":583}],578:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":375,"../../constants/numerical":474,"../../lib":497,"../../plots/cartesian/align_period":542,"../../plots/cartesian/axes":545,"../../registry":591,"../histogram2d/calc":632,"./clean_2d_array":616,"./convert_column_xyz":618,"./find_empties":619,"./interp2d":620,"./make_bound_array":621}],616:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108460,7 +111028,7 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) { return zNew; }; -},{"../../constants/numerical":437,"../../lib":460,"fast-isnumeric":155}],579:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"fast-isnumeric":155}],617:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108476,7 +111044,7 @@ module.exports = { max: 'zmax' }; -},{}],580:[function(_dereq_,module,exports){ +},{}],618:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108490,11 +111058,15 @@ module.exports = { var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, arrayVarNames) { var colLen = trace._length; var col1 = ax1.makeCalcdata(trace, var1Name); var col2 = ax2.makeCalcdata(trace, var2Name); + col1 = alignPeriod(trace, ax1, var1Name, col1); + col2 = alignPeriod(trace, ax2, var2Name, col2); + var textCol = trace.text; var hasColumnText = (textCol !== undefined && Lib.isArray1D(textCol)); var hoverTextCol = trace.hovertext; @@ -108562,7 +111134,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, trace._after2before = after2before; }; -},{"../../constants/numerical":437,"../../lib":460}],581:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"../../plots/cartesian/align_period":542}],619:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108667,7 +111239,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"../../lib":460}],582:[function(_dereq_,module,exports){ +},{"../../lib":497}],620:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108800,7 +111372,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":460}],583:[function(_dereq_,module,exports){ +},{"../../lib":497}],621:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108888,7 +111460,7 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, return arrayOut; }; -},{"../../lib":460,"../../registry":553}],584:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591}],622:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108990,7 +111562,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../lib":460,"../../registry":553,"fast-isnumeric":155}],585:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"fast-isnumeric":155}],623:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109038,7 +111610,7 @@ extendFlat( module.exports = overrideAll(attrs, 'calc', 'nested'); -},{"../../components/colorscale/attributes":338,"../../lib/extend":452,"../../plot_api/edit_types":490,"../heatmap/attributes":576}],586:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":374,"../../lib/extend":489,"../../plot_api/edit_types":527,"../heatmap/attributes":614}],624:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109190,7 +111762,7 @@ function createHeatmap(scene, fullTrace, calcTrace) { module.exports = createHeatmap; -},{"../../lib/str2rgbarray":483,"../../plots/cartesian/axes":507,"gl-heatmap2d":169}],587:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":520,"../../plots/cartesian/axes":545,"gl-heatmap2d":170}],625:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109226,7 +111798,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":341,"../../lib":460,"../heatmap/xyz_defaults":584,"./attributes":585}],588:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":377,"../../lib":497,"../heatmap/xyz_defaults":622,"./attributes":623}],626:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109254,7 +111826,7 @@ module.exports = { } }; -},{"../../plots/gl2d":540,"../heatmap/calc":577,"../heatmap/colorbar":579,"./attributes":585,"./convert":586,"./defaults":587}],589:[function(_dereq_,module,exports){ +},{"../../plots/gl2d":578,"../heatmap/calc":615,"../heatmap/colorbar":617,"./attributes":623,"./convert":624,"./defaults":625}],627:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109279,7 +111851,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],590:[function(_dereq_,module,exports){ +},{}],628:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109353,7 +111925,7 @@ module.exports = { } }; -},{"fast-isnumeric":155}],591:[function(_dereq_,module,exports){ +},{"fast-isnumeric":155}],629:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109529,7 +112101,7 @@ function dateParts(v, pa, calendar) { return parts; } -},{"../../constants/numerical":437,"../../plots/cartesian/axes":507}],592:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../plots/cartesian/axes":545}],630:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110108,7 +112680,7 @@ module.exports = { calcAllAutoBins: calcAllAutoBins }; -},{"../../lib":460,"../../plots/cartesian/axes":507,"../../registry":553,"../bar/arrays_to_calcdata":562,"./average":589,"./bin_functions":590,"./bin_label_vals":591,"./norm_functions":593,"fast-isnumeric":155}],593:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/cartesian/axes":545,"../../registry":591,"../bar/arrays_to_calcdata":600,"./average":627,"./bin_functions":628,"./bin_label_vals":629,"./norm_functions":631,"fast-isnumeric":155}],631:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110143,7 +112715,7 @@ module.exports = { } }; -},{}],594:[function(_dereq_,module,exports){ +},{}],632:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110362,7 +112934,7 @@ function getRanges(edges, uniqueVals, gapLow, gapHigh, ax, calendar) { return out; } -},{"../../lib":460,"../../plots/cartesian/axes":507,"../histogram/average":589,"../histogram/bin_functions":590,"../histogram/bin_label_vals":591,"../histogram/calc":592,"../histogram/norm_functions":593}],595:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/cartesian/axes":545,"../histogram/average":627,"../histogram/bin_functions":628,"../histogram/bin_label_vals":629,"../histogram/calc":630,"../histogram/norm_functions":631}],633:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110491,7 +113063,7 @@ module.exports = { ) }; -},{"../../components/colorscale/attributes":338,"../../lib/extend":452,"../../plot_api/plot_template":497,"../../plots/cartesian/layout_attributes":521,"../../plots/domain":534,"../../plots/font_attributes":535}],596:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":374,"../../lib/extend":489,"../../plot_api/plot_template":534,"../../plots/cartesian/layout_attributes":559,"../../plots/domain":572,"../../plots/font_attributes":573}],634:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110507,6 +113079,7 @@ var d3 = _dereq_('d3'); var keyFun = _dereq_('../../lib/gup').keyFun; var repeat = _dereq_('../../lib/gup').repeat; var sortAsc = _dereq_('../../lib').sorterAsc; +var strTranslate = _dereq_('../../lib').strTranslate; var snapRatio = c.bar.snapRatio; function snapOvershoot(v, vAdjacent) { return v * (1 - snapRatio) + vAdjacent * snapRatio; } @@ -110864,7 +113437,7 @@ function renderAxisBrush(axisBrush) { .call(barHorizontalSetup) .call(backgroundBarHorizontalSetup) .style('pointer-events', 'auto') // parent pointer events are disabled; we must have it to register events - .attr('transform', 'translate(0 ' + c.verticalPadding + ')'); + .attr('transform', strTranslate(0, c.verticalPadding)); background .call(attachDragBehavior) @@ -111035,7 +113608,7 @@ module.exports = { cleanRanges: cleanRanges }; -},{"../../lib":460,"../../lib/gup":457,"./constants":599,"d3":86}],597:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../lib/gup":494,"./constants":637,"d3":86}],635:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111102,7 +113675,7 @@ exports.toSVG = function(gd) { }, 60); }; -},{"../../constants/xmlns_namespaces":438,"../../plots/get_data":537,"./plot":606,"d3":86}],598:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":475,"../../plots/get_data":575,"./plot":644,"d3":86}],636:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111146,7 +113719,7 @@ function constHalf(len) { return out; } -},{"../../components/colorscale":343,"../../lib":460,"../../lib/gup":457}],599:[function(_dereq_,module,exports){ +},{"../../components/colorscale":379,"../../lib":497,"../../lib/gup":494}],637:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111208,7 +113781,7 @@ module.exports = { } }; -},{}],600:[function(_dereq_,module,exports){ +},{}],638:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111328,7 +113901,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('labelside'); }; -},{"../../components/colorscale/defaults":341,"../../components/colorscale/helpers":342,"../../lib":460,"../../plots/array_container_defaults":503,"../../plots/cartesian/axes":507,"../../plots/domain":534,"./attributes":595,"./axisbrush":596,"./constants":599,"./merge_length":604}],601:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":377,"../../components/colorscale/helpers":378,"../../lib":497,"../../plots/array_container_defaults":540,"../../plots/cartesian/axes":545,"../../plots/domain":572,"./attributes":633,"./axisbrush":634,"./constants":637,"./merge_length":642}],639:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111353,7 +113926,7 @@ exports.isVisible = function(dimension) { return dimension.visible || !('visible' in dimension); }; -},{"../../lib":460}],602:[function(_dereq_,module,exports){ +},{"../../lib":497}],640:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111384,7 +113957,7 @@ module.exports = { } }; -},{"./attributes":595,"./base_plot":597,"./calc":598,"./defaults":600,"./plot":606}],603:[function(_dereq_,module,exports){ +},{"./attributes":633,"./base_plot":635,"./calc":636,"./defaults":638,"./plot":644}],641:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111914,7 +114487,7 @@ module.exports = function(canvasGL, d) { }; }; -},{"../../lib":460,"./constants":599,"glslify":202}],604:[function(_dereq_,module,exports){ +},{"../../lib":497,"./constants":637,"glslify":236}],642:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111952,7 +114525,7 @@ module.exports = function(traceOut, dimensions, dataAttr, len) { return len; }; -},{}],605:[function(_dereq_,module,exports){ +},{}],643:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111968,6 +114541,8 @@ var rgba = _dereq_('color-rgba'); var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Drawing = _dereq_('../../components/drawing'); var Colorscale = _dereq_('../../components/colorscale'); @@ -112305,8 +114880,7 @@ function styleExtentTexts(selection) { selection .classed(c.cn.axisExtentText, true) .attr('text-anchor', 'middle') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); } function parcoordsInteractionState() { @@ -112474,7 +115048,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .style('pointer-events', 'none'); controlOverlay.attr('transform', function(d) { - return 'translate(' + d.model.translateX + ',' + d.model.translateY + ')'; + return strTranslate(d.model.translateX, d.model.translateY); }); var parcoordsControlView = controlOverlay.selectAll('.' + c.cn.parcoordsControlView) @@ -112485,7 +115059,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.parcoordsControlView, true); parcoordsControlView.attr('transform', function(d) { - return 'translate(' + d.model.pad.l + ',' + d.model.pad.t + ')'; + return strTranslate(d.model.pad.l, d.model.pad.t); }); var yAxis = parcoordsControlView.selectAll('.' + c.cn.yAxis) @@ -112516,7 +115090,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { }); yAxis.attr('transform', function(d) { - return 'translate(' + d.xScale(d.xIndex) + ', 0)'; + return strTranslate(d.xScale(d.xIndex), 0); }); // drag column for reordering columns @@ -112538,8 +115112,8 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { updatePanelLayout(yAxis, p); yAxis.filter(function(e) { return Math.abs(d.xIndex - e.xIndex) !== 0; }) - .attr('transform', function(d) { return 'translate(' + d.xScale(d.xIndex) + ', 0)'; }); - d3.select(this).attr('transform', 'translate(' + d.x + ', 0)'); + .attr('transform', function(d) { return strTranslate(d.xScale(d.xIndex), 0); }); + d3.select(this).attr('transform', strTranslate(d.x, 0)); yAxis.each(function(e, i0, i1) { if(i1 === d.parent.key) p.dimensions[i0] = e; }); p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); p.focusLayer.render && p.focusLayer.render(p.panels); @@ -112550,7 +115124,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { d.canvasX = d.x * d.model.canvasPixelRatio; updatePanelLayout(yAxis, p); d3.select(this) - .attr('transform', function(d) { return 'translate(' + d.x + ', 0)'; }); + .attr('transform', function(d) { return strTranslate(d.x, 0); }); p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); p.focusLayer && p.focusLayer.render(p.panels); p.pickLayer && p.pickLayer.render(p.panels, true); @@ -112610,8 +115184,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axis.selectAll('text') .style('text-shadow', '1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); var axisHeading = axisOverlays.selectAll('.' + c.cn.axisHeading) .data(repeat, keyFun); @@ -112628,7 +115201,6 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisTitle, true) .attr('text-anchor', 'middle') .style('cursor', 'ew-resize') - .style('user-select', 'none') .style('pointer-events', 'auto'); axisTitle @@ -112642,9 +115214,9 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { var tilt = calcTilt(d.model.labelAngle, d.model.labelSide); var r = c.axisTitleOffset; return ( - (tilt.dir > 0 ? '' : 'translate(0,' + (2 * r + d.model.height) + ')') + - 'rotate(' + tilt.degrees + ')' + - 'translate(' + (-r * tilt.dx) + ',' + (-r * tilt.dy) + ')' + (tilt.dir > 0 ? '' : strTranslate(0, 2 * r + d.model.height)) + + strRotate(tilt.degrees) + + strTranslate(-r * tilt.dx, -r * tilt.dy) ); }) .attr('text-anchor', function(d) { @@ -112674,7 +115246,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisExtentTop, true); axisExtentTop - .attr('transform', 'translate(' + 0 + ',' + -c.axisExtentOffset + ')'); + .attr('transform', strTranslate(0, -c.axisExtentOffset)); var axisExtentTopText = axisExtentTop.selectAll('.' + c.cn.axisExtentTopText) .data(repeat, keyFun); @@ -112697,7 +115269,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axisExtentBottom .attr('transform', function(d) { - return 'translate(' + 0 + ',' + (d.model.height + c.axisExtentOffset) + ')'; + return strTranslate(0, d.model.height + c.axisExtentOffset); }); var axisExtentBottomText = axisExtentBottom.selectAll('.' + c.cn.axisExtentBottomText) @@ -112716,7 +115288,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { brush.ensureAxisBrush(axisOverlays); }; -},{"../../components/colorscale":343,"../../components/drawing":353,"../../lib":460,"../../lib/gup":457,"../../lib/svg_text_utils":484,"../../plots/cartesian/axes":507,"./axisbrush":596,"./constants":599,"./helpers":601,"./lines":603,"color-rgba":65,"d3":86}],606:[function(_dereq_,module,exports){ +},{"../../components/colorscale":379,"../../components/drawing":389,"../../lib":497,"../../lib/gup":494,"../../lib/svg_text_utils":521,"../../plots/cartesian/axes":545,"./axisbrush":634,"./constants":637,"./helpers":639,"./lines":641,"color-rgba":65,"d3":86}],644:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112871,7 +115443,7 @@ module.exports = function plot(gd, cdModule) { ); }; -},{"../../lib/prepare_regl":473,"./helpers":601,"./parcoords":605}],607:[function(_dereq_,module,exports){ +},{"../../lib/prepare_regl":510,"./helpers":639,"./parcoords":643}],645:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112884,19 +115456,21 @@ module.exports = function plot(gd, cdModule) { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -112913,7 +115487,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":460}],608:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":497}],646:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112937,7 +115515,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":331,"./helpers":607}],609:[function(_dereq_,module,exports){ +},{"../../components/color":367,"./helpers":645}],647:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113040,7 +115618,7 @@ module.exports = { transforms: undefined }; -},{"../scatter/attributes":614}],610:[function(_dereq_,module,exports){ +},{"../scatter/attributes":652}],648:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113242,7 +115820,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":483,"../../plots/cartesian/autorange":506,"../scatter/get_trace_color":624,"gl-pointcloud2d":179}],611:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":520,"../../plots/cartesian/autorange":544,"../scatter/get_trace_color":662,"gl-pointcloud2d":212}],649:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113290,7 +115868,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { traceOut._length = null; }; -},{"../../lib":460,"./attributes":609}],612:[function(_dereq_,module,exports){ +},{"../../lib":497,"./attributes":647}],650:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113318,7 +115896,7 @@ module.exports = { } }; -},{"../../plots/gl2d":540,"../scatter3d/calc":641,"./attributes":609,"./convert":610,"./defaults":611}],613:[function(_dereq_,module,exports){ +},{"../../plots/gl2d":578,"../scatter3d/calc":680,"./attributes":647,"./convert":648,"./defaults":649}],651:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113370,7 +115948,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":460}],614:[function(_dereq_,module,exports){ +},{"../../lib":497}],652:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113389,8 +115967,41 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + + editType: 'calc', + + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + + editType: 'calc', + + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + + editType: 'calc', + + }; +} + module.exports = { x: { valType: 'data_array', @@ -113437,6 +116048,13 @@ module.exports = { }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', @@ -113784,7 +116402,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":338,"../../components/drawing":353,"../../components/drawing/attributes":352,"../../lib/extend":452,"../../plots/font_attributes":535,"../../plots/template_attributes":552,"./constants":618}],615:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":374,"../../components/drawing":389,"../../components/drawing/attributes":388,"../../lib/extend":489,"../../plots/font_attributes":573,"../../plots/template_attributes":590,"./constants":656}],653:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113799,6 +116417,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -113810,8 +116429,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -113842,6 +116464,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -113849,6 +116474,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -114069,7 +116701,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":437,"../../lib":460,"../../plots/cartesian/axes":507,"./arrays_to_calcdata":613,"./calc_selection":616,"./colorscale_calc":617,"./subtypes":638,"fast-isnumeric":155}],616:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"../../plots/cartesian/align_period":542,"../../plots/cartesian/axes":545,"./arrays_to_calcdata":651,"./calc_selection":654,"./colorscale_calc":655,"./subtypes":677,"fast-isnumeric":155}],654:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114088,7 +116720,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":460}],617:[function(_dereq_,module,exports){ +},{"../../lib":497}],655:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114131,7 +116763,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":339,"../../components/colorscale/helpers":342,"./subtypes":638}],618:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":375,"../../components/colorscale/helpers":378,"./subtypes":677}],656:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114160,7 +116792,7 @@ module.exports = { eventDataKeys: [] }; -},{}],619:[function(_dereq_,module,exports){ +},{}],657:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114341,7 +116973,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":615}],620:[function(_dereq_,module,exports){ +},{"./calc":653}],658:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114380,7 +117012,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],621:[function(_dereq_,module,exports){ +},{}],659:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114398,6 +117030,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -114415,6 +117048,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -114470,7 +117105,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":460,"../../registry":553,"./attributes":614,"./constants":618,"./fillcolor_defaults":622,"./line_defaults":627,"./line_shape_defaults":629,"./marker_defaults":633,"./stack_defaults":636,"./subtypes":638,"./text_defaults":639,"./xy_defaults":640}],622:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"./attributes":652,"./constants":656,"./fillcolor_defaults":660,"./line_defaults":665,"./line_shape_defaults":667,"./marker_defaults":671,"./period_defaults":672,"./stack_defaults":675,"./subtypes":677,"./text_defaults":678,"./xy_defaults":679}],660:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114507,7 +117142,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":331,"../../lib":460}],623:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../lib":497}],661:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114533,7 +117168,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":507}],624:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":545}],662:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114582,7 +117217,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":331,"./subtypes":638}],625:[function(_dereq_,module,exports){ +},{"../../components/color":367,"./subtypes":677}],663:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114663,8 +117298,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -114777,7 +117412,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":331,"../../components/fx":371,"../../lib":460,"../../registry":553,"./get_trace_color":624}],626:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../components/fx":407,"../../lib":497,"../../registry":591,"./get_trace_color":662}],664:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114823,7 +117458,7 @@ module.exports = { } }; -},{"../../plots/cartesian":520,"./arrays_to_calcdata":613,"./attributes":614,"./calc":615,"./cross_trace_calc":619,"./cross_trace_defaults":620,"./defaults":621,"./format_labels":623,"./hover":625,"./marker_colorbar":632,"./plot":634,"./select":635,"./style":637,"./subtypes":638}],627:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":558,"./arrays_to_calcdata":651,"./attributes":652,"./calc":653,"./cross_trace_calc":657,"./cross_trace_defaults":658,"./defaults":659,"./format_labels":661,"./hover":663,"./marker_colorbar":670,"./plot":673,"./select":674,"./style":676,"./subtypes":677}],665:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114854,7 +117489,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":341,"../../components/colorscale/helpers":342,"../../lib":460}],628:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":377,"../../components/colorscale/helpers":378,"../../lib":497}],666:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115315,7 +117950,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":437,"../../lib":460,"./constants":618}],629:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"./constants":656}],667:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115334,7 +117969,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],630:[function(_dereq_,module,exports){ +},{}],668:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115424,7 +118059,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],631:[function(_dereq_,module,exports){ +},{}],669:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115466,7 +118101,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":155}],632:[function(_dereq_,module,exports){ +},{"fast-isnumeric":155}],670:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115484,7 +118119,7 @@ module.exports = { max: 'cmax' }; -},{}],633:[function(_dereq_,module,exports){ +},{}],671:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115565,7 +118200,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":331,"../../components/colorscale/defaults":341,"../../components/colorscale/helpers":342,"./subtypes":638}],634:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../components/colorscale/defaults":377,"../../components/colorscale/helpers":378,"./subtypes":677}],672:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":474,"../../lib":497}],673:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116126,7 +118808,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":353,"../../lib":460,"../../lib/polygon":472,"../../registry":553,"./line_points":628,"./link_traces":630,"./subtypes":638,"d3":86}],635:[function(_dereq_,module,exports){ +},{"../../components/drawing":389,"../../lib":497,"../../lib/polygon":509,"../../registry":591,"./line_points":666,"./link_traces":668,"./subtypes":677,"d3":86}],674:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116180,7 +118862,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":638}],636:[function(_dereq_,module,exports){ +},{"./subtypes":677}],675:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116285,7 +118967,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],637:[function(_dereq_,module,exports){ +},{}],676:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116356,7 +119038,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":353,"../../registry":553,"d3":86}],638:[function(_dereq_,module,exports){ +},{"../../components/drawing":389,"../../registry":591,"d3":86}],677:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116395,7 +119077,7 @@ module.exports = { } }; -},{"../../lib":460}],639:[function(_dereq_,module,exports){ +},{"../../lib":497}],678:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116425,7 +119107,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":460}],640:[function(_dereq_,module,exports){ +},{"../../lib":497}],679:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116469,7 +119151,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":460,"../../registry":553}],641:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591}],680:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116497,7 +119179,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":613,"../scatter/colorscale_calc":617}],642:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":651,"../scatter/colorscale_calc":655}],681:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116528,6 +119210,13 @@ var attrs = module.exports = overrideAll({ y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, hovertext: scatterAttrs.hovertext, @@ -116595,7 +119284,7 @@ attrs.x.editType = attrs.y.editType = attrs.x0.editType = attrs.y0.editType = 'c attrs.hovertemplate = scatterAttrs.hovertemplate; attrs.texttemplate = scatterAttrs.texttemplate; -},{"../../components/colorscale/attributes":338,"../../lib/extend":452,"../../plot_api/edit_types":490,"../../plots/attributes":504,"../scatter/attributes":614,"./constants":644}],643:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":374,"../../lib/extend":489,"../../plot_api/edit_types":527,"../../plots/attributes":541,"../scatter/attributes":652,"./constants":683}],682:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116611,6 +119300,7 @@ var cluster = _dereq_('@plotly/point-cluster'); var Lib = _dereq_('../../lib'); var AxisIDs = _dereq_('../../plots/cartesian/axis_ids'); var findExtremes = _dereq_('../../plots/cartesian/autorange').findExtremes; +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var scatterCalc = _dereq_('../scatter/calc'); var calcMarkerSize = scatterCalc.calcMarkerSize; @@ -116634,8 +119324,15 @@ module.exports = function calc(gd, trace) { var stash = {}; var i, xx, yy; - var x = trace._x = xa.makeCalcdata(trace, 'x'); - var y = trace._y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; + + if(trace.xperiodalignment) trace._origX = origX; + if(trace.yperiodalignment) trace._origY = origY; // we need hi-precision for scatter2d, // regl-scatter2d uses NaNs for bad/missing values @@ -116773,7 +119470,7 @@ function sceneOptions(gd, subplot, trace, positions, x, y) { return opts; } -},{"../../constants/numerical":437,"../../lib":460,"../../plots/cartesian/autorange":506,"../../plots/cartesian/axis_ids":510,"../scatter/calc":615,"../scatter/colorscale_calc":617,"./constants":644,"./convert":645,"./scene_update":653,"@plotly/point-cluster":10}],644:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"../../plots/cartesian/align_period":542,"../../plots/cartesian/autorange":544,"../../plots/cartesian/axis_ids":548,"../scatter/calc":653,"../scatter/colorscale_calc":655,"./constants":683,"./convert":684,"./scene_update":692,"@plotly/point-cluster":10}],683:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116806,7 +119503,7 @@ module.exports = { } }; -},{}],645:[function(_dereq_,module,exports){ +},{}],684:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117457,7 +120154,7 @@ module.exports = { textPosition: convertTextPosition }; -},{"../../components/drawing":353,"../../components/fx/helpers":367,"../../constants/interactions":436,"../../lib":460,"../../lib/gl_format_color":456,"../../plots/cartesian/axis_ids":510,"../../registry":553,"../scatter/make_bubble_size_func":631,"../scatter/subtypes":638,"./constants":644,"./helpers":649,"color-normalize":63,"fast-isnumeric":155,"svg-path-sdf":283}],646:[function(_dereq_,module,exports){ +},{"../../components/drawing":389,"../../components/fx/helpers":403,"../../constants/interactions":473,"../../lib":497,"../../lib/gl_format_color":493,"../../plots/cartesian/axis_ids":548,"../../registry":591,"../scatter/make_bubble_size_func":669,"../scatter/subtypes":677,"./constants":683,"./helpers":688,"color-normalize":63,"fast-isnumeric":155,"svg-path-sdf":319}],685:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117476,6 +120173,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('../scatter/constants'); var subTypes = _dereq_('../scatter/subtypes'); var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); var handleLineDefaults = _dereq_('../scatter/line_defaults'); var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); @@ -117494,6 +120192,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut.visible = false; return; } + + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines'; coerce('text'); @@ -117532,7 +120233,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":460,"../../registry":553,"../scatter/constants":618,"../scatter/fillcolor_defaults":622,"../scatter/line_defaults":627,"../scatter/marker_defaults":633,"../scatter/subtypes":638,"../scatter/text_defaults":639,"../scatter/xy_defaults":640,"./attributes":642,"./helpers":649}],647:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"../scatter/constants":656,"../scatter/fillcolor_defaults":660,"../scatter/line_defaults":665,"../scatter/marker_defaults":671,"../scatter/period_defaults":672,"../scatter/subtypes":677,"../scatter/text_defaults":678,"../scatter/xy_defaults":679,"./attributes":681,"./helpers":688}],686:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117588,7 +120289,7 @@ module.exports = { styleTextSelection: styleTextSelection }; -},{"../../components/color":331,"../../constants/interactions":436,"../../lib":460}],648:[function(_dereq_,module,exports){ +},{"../../components/color":367,"../../constants/interactions":473,"../../lib":497}],687:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117608,7 +120309,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return scatterFormatLabels(cdi, trace, fullLayout); }; -},{"../scatter/format_labels":623}],649:[function(_dereq_,module,exports){ +},{"../scatter/format_labels":661}],688:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117633,7 +120334,7 @@ exports.isDotSymbol = function(symbol) { symbol > 200; }; -},{"./constants":644}],650:[function(_dereq_,module,exports){ +},{"./constants":683}],689:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117797,16 +120498,19 @@ function calcHover(pointData, x, y, trace) { var fakeCd = {}; fakeCd[pointData.index] = di; + var origX = trace._origX; + var origY = trace._origY; + var pointData2 = Lib.extendFlat({}, pointData, { color: getTraceColor(trace, di), x0: xp - rad, x1: xp + rad, - xLabelVal: di.x, + xLabelVal: origX ? origX[id] : di.x, y0: yp - rad, y1: yp + rad, - yLabelVal: di.y, + yLabelVal: origY ? origY[id] : di.y, cd: fakeCd, distance: minDist, @@ -117830,7 +120534,7 @@ module.exports = { calcHover: calcHover }; -},{"../../lib":460,"../../registry":553,"../scatter/get_trace_color":624}],651:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../registry":591,"../scatter/get_trace_color":662}],690:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117865,7 +120569,7 @@ module.exports = { } }; -},{"../../plots/cartesian":520,"../scatter/cross_trace_defaults":620,"../scatter/marker_colorbar":632,"./attributes":642,"./calc":643,"./defaults":646,"./format_labels":648,"./hover":650,"./plot":652,"./select":654}],652:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":558,"../scatter/cross_trace_defaults":658,"../scatter/marker_colorbar":670,"./attributes":681,"./calc":682,"./defaults":685,"./format_labels":687,"./hover":689,"./plot":691,"./select":693}],691:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118234,7 +120938,7 @@ module.exports = function plot(gd, subplot, cdata) { } }; -},{"../../components/dragelement/helpers":349,"../../lib":460,"../../lib/prepare_regl":473,"../scatter/link_traces":630,"../scatter/subtypes":638,"./edit_style":647,"gl-text":191,"regl-error2d":256,"regl-line2d":257,"regl-scatter2d":258}],653:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":385,"../../lib":497,"../../lib/prepare_regl":510,"../scatter/link_traces":668,"../scatter/subtypes":677,"./edit_style":686,"gl-text":225,"regl-error2d":290,"regl-line2d":291,"regl-scatter2d":293}],692:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118392,7 +121096,7 @@ module.exports = function sceneUpdate(gd, subplot) { return scene; }; -},{"../../lib":460}],654:[function(_dereq_,module,exports){ +},{"../../lib":497}],693:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118471,7 +121175,7 @@ module.exports = function select(searchInfo, selectionTester) { return selection; }; -},{"../scatter/subtypes":638,"./edit_style":647}],655:[function(_dereq_,module,exports){ +},{"../scatter/subtypes":677,"./edit_style":686}],694:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118638,7 +121342,7 @@ module.exports = { opacity: scatterGlAttrs.opacity }; -},{"../../components/colorscale/attributes":338,"../../lib/extend":452,"../../plot_api/plot_template":497,"../../plots/cartesian/constants":513,"../../plots/template_attributes":552,"../scatter/attributes":614,"../scattergl/attributes":642}],656:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":374,"../../lib/extend":489,"../../plot_api/plot_template":534,"../../plots/cartesian/constants":551,"../../plots/template_attributes":590,"../scatter/attributes":652,"../scattergl/attributes":681}],695:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118857,7 +121561,7 @@ module.exports = { toSVG: Cartesian.toSVG }; -},{"../../lib/prepare_regl":473,"../../plots/cartesian":520,"../../plots/cartesian/axes":507,"../../plots/cartesian/axis_ids":510,"../../plots/get_data":537,"../../registry":553,"regl-line2d":257}],657:[function(_dereq_,module,exports){ +},{"../../lib/prepare_regl":510,"../../plots/cartesian":558,"../../plots/cartesian/axes":545,"../../plots/cartesian/axis_ids":548,"../../plots/get_data":575,"../../registry":591,"regl-line2d":291}],696:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118968,7 +121672,7 @@ module.exports = function calc(gd, trace) { return [{x: false, y: false, t: {}, trace: trace}]; }; -},{"../../constants/numerical":437,"../../lib":460,"../../plots/cartesian/axis_ids":510,"../scatter/calc":615,"../scatter/colorscale_calc":617,"../scattergl/constants":644,"../scattergl/convert":645,"./scene_update":664}],658:[function(_dereq_,module,exports){ +},{"../../constants/numerical":474,"../../lib":497,"../../plots/cartesian/axis_ids":548,"../scatter/calc":653,"../scatter/colorscale_calc":655,"../scattergl/constants":683,"../scattergl/convert":684,"./scene_update":703}],697:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119145,7 +121849,7 @@ function handleAxisDefaults(traceIn, traceOut, layout, coerce) { } } -},{"../../lib":460,"../../plots/array_container_defaults":503,"../parcoords/merge_length":604,"../scatter/marker_defaults":633,"../scatter/subtypes":638,"../scattergl/helpers":649,"./attributes":655}],659:[function(_dereq_,module,exports){ +},{"../../lib":497,"../../plots/array_container_defaults":540,"../parcoords/merge_length":642,"../scatter/marker_defaults":671,"../scatter/subtypes":677,"../scattergl/helpers":688,"./attributes":694}],698:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119177,7 +121881,7 @@ module.exports = function editStyle(gd, cd0) { } }; -},{"../../lib":460,"../scatter/colorscale_calc":617,"../scattergl/convert":645}],660:[function(_dereq_,module,exports){ +},{"../../lib":497,"../scatter/colorscale_calc":655,"../scattergl/convert":684}],699:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119201,7 +121905,7 @@ exports.getDimIndex = function getDimIndex(trace, ax) { return false; }; -},{}],661:[function(_dereq_,module,exports){ +},{}],700:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119262,7 +121966,7 @@ module.exports = { hoverPoints: hoverPoints }; -},{"../scattergl/hover":650,"./helpers":660}],662:[function(_dereq_,module,exports){ +},{"../scattergl/hover":689,"./helpers":699}],701:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119302,7 +122006,7 @@ module.exports = { // register it here Registry.register(Grid); -},{"../../components/grid":375,"../../registry":553,"../scatter/marker_colorbar":632,"./attributes":655,"./base_plot":656,"./calc":657,"./defaults":658,"./edit_style":659,"./hover":661,"./plot":663,"./select":665}],663:[function(_dereq_,module,exports){ +},{"../../components/grid":411,"../../registry":591,"../scatter/marker_colorbar":670,"./attributes":694,"./base_plot":695,"./calc":696,"./defaults":697,"./edit_style":698,"./hover":700,"./plot":702,"./select":704}],702:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119447,7 +122151,7 @@ function plotOne(gd, cd0) { } } -},{"../../components/dragelement/helpers":349,"../../lib":460,"../../plots/cartesian/axis_ids":510,"regl-splom":259}],664:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":385,"../../lib":497,"../../plots/cartesian/axis_ids":548,"regl-splom":295}],703:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119519,7 +122223,7 @@ module.exports = function sceneUpdate(gd, trace) { return scene; }; -},{"../../lib":460}],665:[function(_dereq_,module,exports){ +},{"../../lib":497}],704:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119594,7 +122298,7 @@ module.exports = function select(searchInfo, selectionTester) { return selection; }; -},{"../../lib":460,"../scatter/subtypes":638,"./helpers":660}],666:[function(_dereq_,module,exports){ +},{"../../lib":497,"../scatter/subtypes":677,"./helpers":699}],705:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119606,7 +122310,7 @@ module.exports = function select(searchInfo, selectionTester) { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[5])(5) }); diff --git a/dist/plotly-gl2d.min.js b/dist/plotly-gl2d.min.js index 5c8f84c7485..9a36323459a 100644 --- a/dist/plotly-gl2d.min.js +++ b/dist/plotly-gl2d.min.js @@ -1,23 +1,23 @@ /** -* plotly.js (gl2d - minified) v1.55.2 +* plotly.js (gl2d - minified) v1.58.0 * Copyright 2012-2020, 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 t(e,r,n){function a(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(i)return i(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){return a(e[o][1][t]||t)}),c,c.exports,t,e,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":460}],2:[function(t,e,r){"use strict";e.exports=t("../src/traces/contourgl")},{"../src/traces/contourgl":575}],3:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":439}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmapgl")},{"../src/traces/heatmapgl":588}],5:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./scattergl"),t("./splom"),t("./pointcloud"),t("./heatmapgl"),t("./contourgl"),t("./parcoords")]),e.exports=n},{"./contourgl":2,"./core":3,"./heatmapgl":4,"./parcoords":6,"./pointcloud":7,"./scattergl":8,"./splom":9}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcoords")},{"../src/traces/parcoords":602}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/pointcloud")},{"../src/traces/pointcloud":612}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":651}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/splom")},{"../src/traces/splom":662}],10:[function(t,e,r){"use strict";e.exports=t("./quad")},{"./quad":11}],11:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),a=t("clamp"),i=t("parse-rect"),o=t("array-bounds"),s=t("pick-by-alias"),l=t("defined"),u=t("flatten-vertex-data"),c=t("is-obj"),f=t("dtype"),h=t("math-log2");function d(t,e){for(var r=e[0],n=e[1],i=1/(e[2]-r),o=1/(e[3]-n),s=new Array(t.length),l=0,u=t.length/2;l>>1;e.dtype||(e.dtype="array"),"string"==typeof e.dtype?p=new(f(e.dtype))(v):e.dtype&&(p=e.dtype,Array.isArray(p)&&(p.length=v));for(var m=0;mr||s>1073741824){for(var h=0;he+n||w>r+n||A=k||i===o)){var s=y[a];void 0===o&&(o=s.length);for(var l=i;l=p&&c<=v&&f>=g&&f<=m&&E.push(u)}var h=b[a],d=h[4*i+0],x=h[4*i+1],M=h[4*i+2],S=h[4*i+3],O=L(h,i+1),D=.5*n,R=a+1;C(e,r,D,R,d,x||M||S||O),C(e,r+D,D,R,x,M||S||O),C(e+D,r,D,R,M,S||O),C(e+D,r+D,D,R,S,O)}}function L(t,e){for(var r=null,n=0;null===r;)if(r=t[4*e+n],++n>t.length)return null;return r}return C(0,0,1,0,0,1),E},p;function S(t,e,r,a,i){for(var o=[],s=0;sa&&(a=t[o]),t[o]: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":497}],2:[function(t,e,r){"use strict";e.exports=t("../src/traces/contourgl")},{"../src/traces/contourgl":613}],3:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":476}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmapgl")},{"../src/traces/heatmapgl":626}],5:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./scattergl"),t("./splom"),t("./pointcloud"),t("./heatmapgl"),t("./contourgl"),t("./parcoords")]),e.exports=n},{"./contourgl":2,"./core":3,"./heatmapgl":4,"./parcoords":6,"./pointcloud":7,"./scattergl":8,"./splom":9}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcoords")},{"../src/traces/parcoords":640}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/pointcloud")},{"../src/traces/pointcloud":650}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":690}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/splom")},{"../src/traces/splom":701}],10:[function(t,e,r){"use strict";e.exports=t("./quad")},{"./quad":11}],11:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),a=t("clamp"),i=t("parse-rect"),o=t("array-bounds"),s=t("pick-by-alias"),l=t("defined"),u=t("flatten-vertex-data"),c=t("is-obj"),f=t("dtype"),d=t("math-log2");function h(t,e){for(var r=e[0],n=e[1],i=1/(e[2]-r),o=1/(e[3]-n),s=new Array(t.length),l=0,u=t.length/2;l>>1;e.dtype||(e.dtype="array"),"string"==typeof e.dtype?p=new(f(e.dtype))(v):e.dtype&&(p=e.dtype,Array.isArray(p)&&(p.length=v));for(var m=0;mr||s>1073741824){for(var d=0;de+n||w>r+n||A=k||i===o)){var s=y[a];void 0===o&&(o=s.length);for(var l=i;l=p&&c<=v&&f>=g&&f<=m&&E.push(u)}var d=b[a],h=d[4*i+0],x=d[4*i+1],M=d[4*i+2],S=d[4*i+3],O=L(d,i+1),D=.5*n,R=a+1;C(e,r,D,R,h,x||M||S||O),C(e,r+D,D,R,x,M||S||O),C(e+D,r,D,R,M,S||O),C(e+D,r+D,D,R,S,O)}}function L(t,e){for(var r=null,n=0;null===r;)if(r=t[4*e+n],++n>t.length)return null;return r}return C(0,0,1,0,0,1),E},p;function S(t,e,r,a,i){for(var o=[],s=0;sa&&(a=t[o]),t[o] * @license MIT - */function a(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,a=0,i=Math.min(r,n);a=0;u--)if(c[u]!==f[u])return!1;for(u=c.length-1;u>=0;u--)if(s=c[u],!b(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function x(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var a;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),a=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!a&&m(a,r,"Missing expected exception"+n);var i="string"==typeof n,s=!t&&a&&!r;if((!t&&o.isError(a)&&i&&_(a,r)||s)&&m(a,r,"Got unwanted exception"+n),t&&a&&r&&!_(a,r)||!t&&a)throw a}h.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(v(t.actual),128)+" "+t.operator+" "+g(v(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,a=p(e),i=n.indexOf("\n"+a);if(i>=0){var o=n.indexOf("\n",i+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(h.AssertionError,Error),h.fail=m,h.ok=y,h.equal=function(t,e,r){t!=e&&m(t,e,r,"==",h.equal)},h.notEqual=function(t,e,r){t==e&&m(t,e,r,"!=",h.notEqual)},h.deepEqual=function(t,e,r){b(t,e,!1)||m(t,e,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(t,e,r){b(t,e,!0)||m(t,e,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){b(t,e,!1)&&m(t,e,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){b(e,r,!0)&&m(e,r,n,"notDeepStrictEqual",t)},h.strictEqual=function(t,e,r){t!==e&&m(t,e,r,"===",h.strictEqual)},h.notStrictEqual=function(t,e,r){t===e&&m(t,e,r,"!==",h.notStrictEqual)},h.throws=function(t,e,r){w(!0,t,e,r)},h.doesNotThrow=function(t,e,r){w(!1,t,e,r)},h.ifError=function(t){if(t)throw t},h.strict=n((function t(e,r){e||m(e,!0,r,"==",t)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var A=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":227,"util/":20}],18:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],19:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],20:[function(t,e,r){(function(e,n){var a=/%[sdj%]/g;r.format=function(t){if(!m(t)){for(var e=[],r=0;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),l=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(e)?n.showHidden=e:e&&r._extend(n,e),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),c(n,t,n.depth)}function l(t,e){var r=s.styles[e];return r?"\x1b["+s.colors[r][0]+"m"+t+"\x1b["+s.colors[r][1]+"m":t}function u(t,e){return t}function c(t,e,n){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var a=e.inspect(n,t);return m(a)||(a=c(t,a,n)),a}var i=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(m(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(v(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),w(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(e);if(0===o.length){if(A(e)){var l=e.name?": "+e.name:"";return t.stylize("[Function"+l+"]","special")}if(b(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(_(e))return t.stylize(Date.prototype.toString.call(e),"date");if(w(e))return f(e)}var u,x="",T=!1,k=["{","}"];(d(e)&&(T=!0,k=["[","]"]),A(e))&&(x=" [Function"+(e.name?": "+e.name:"")+"]");return b(e)&&(x=" "+RegExp.prototype.toString.call(e)),_(e)&&(x=" "+Date.prototype.toUTCString.call(e)),w(e)&&(x=" "+f(e)),0!==o.length||T&&0!=e.length?n<0?b(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),u=T?function(t,e,r,n,a){for(var i=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(u,x,k)):k[0]+x+k[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,a,i){var o,s,l;if((l=Object.getOwnPropertyDescriptor(e,a)||{value:e[a]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),S(n,a)||(o="["+a+"]"),s||(t.seen.indexOf(l.value)<0?(s=g(r)?c(t,l.value,null):c(t,l.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),y(o)){if(i&&a.match(/^\d+$/))return s;(o=JSON.stringify(""+a)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return"number"==typeof t}function m(t){return"string"==typeof t}function y(t){return void 0===t}function b(t){return x(t)&&"[object RegExp]"===T(t)}function x(t){return"object"==typeof t&&null!==t}function _(t){return x(t)&&"[object Date]"===T(t)}function w(t){return x(t)&&("[object Error]"===T(t)||t instanceof Error)}function A(t){return"function"==typeof t}function T(t){return Object.prototype.toString.call(t)}function k(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(y(i)&&(i=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(i)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=d,r.isBoolean=p,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=v,r.isString=m,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=y,r.isRegExp=b,r.isObject=x,r.isDate=_,r.isError=w,r.isFunction=A,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t},r.isBuffer=t("./support/isBuffer");var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(){var t=new Date,e=[k(t.getHours()),k(t.getMinutes()),k(t.getSeconds())].join(":");return[t.getDate(),M[t.getMonth()],e].join(" ")}function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){console.log("%s - %s",E(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!x(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":19,_process:250,inherits:18}],21:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],22:[function(t,e,r){"use strict";r.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=u(t),o=n[0],s=n[1],l=new i(function(t,e,r){return 3*(e+r)/4-r}(0,o,s)),c=0,f=s>0?o-4:o;for(r=0;r>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===s&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,l[c++]=255&e);1===s&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},r.fromByteArray=function(t){for(var e,r=t.length,a=r%3,i=[],o=0,s=r-a;os?s:o+16383));1===a?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===a&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="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 a,i,o=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],23:[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":33}],24:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],25:[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":33}],26:[function(t,e,r){"use strict";var n=t("./is-rat"),a=t("./lib/is-bn"),i=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,c,f=0;if(a(e))u=e.clone();else if("string"==typeof e)u=o(e);else{if(0===e)return[i(0),i(1)];if(e===Math.floor(e))u=i(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),f-=256;u=i(e)}}if(n(r))u.mul(r[1]),c=r[0].clone();else if(a(r))c=r.clone();else if("string"==typeof r)c=o(r);else if(r)if(r===Math.floor(r))c=i(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),f+=256;c=i(r)}else c=i(1);f>0?u=u.ushln(f):f<0&&(c=c.ushln(-f));return s(u,c)}},{"./div":25,"./is-rat":27,"./lib/is-bn":31,"./lib/num-to-bn":32,"./lib/rationalize":33,"./lib/str-to-bn":34}],27:[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":31}],28:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":42}],29:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,a=0;if(1===e)a=r[0];else if(2===e)a=r[0]+67108864*r[1];else for(var i=0;i20)return 52;return r+32}},{"bit-twiddle":40,"double-bits":89}],31:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":42}],32:[function(t,e,r){"use strict";var n=t("bn.js"),a=t("double-bits");e.exports=function(t){var e=a.exponent(t);return e<52?new n(t):new n(t*Math.pow(2,52-e)).ushln(e-52)}},{"bn.js":42,"double-bits":89}],33:[function(t,e,r){"use strict";var n=t("./num-to-bn"),a=t("./bn-sign");e.exports=function(t,e){var r=a(t),i=a(e);if(0===r)return[n(0),n(1)];if(0===i)return[n(0),n(0)];i<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":28,"./num-to-bn":32}],34:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":42}],35:[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":33}],36:[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":28}],37:[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":33}],38:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var i=e.abs().divmod(r.abs()),o=i.div,s=n(o),l=i.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=a(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":29,"./lib/ctz":30}],39:[function(t,e,r){"use strict";function n(t,e,r,n,a){var i=["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[m]"];return a?e.indexOf("c")<0?i.push(";if(x===y){return m}else if(x<=y){"):i.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):i.push(";if(",e,"){i=m;"),r?i.push("l=m+1}else{h=m-1}"):i.push("h=m-1}else{l=m+1}"),i.push("}"),a?i.push("return -1};"):i.push("return i};"),i.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],a),n("P","c(x,y)"+t+"0",e,["y","c"],a),"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:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],40:[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 a=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,a=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--a;t[e]=n<>>8&255]<<16|a[t>>>16&255]<<8|a[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}},{}],41:[function(t,e,r){"use strict";var n=t("clamp");e.exports=function(t,e){e||(e={});var r,o,s,l,u,c,f,h,d,p,g,v=null==e.cutoff?.25:e.cutoff,m=null==e.radius?8:e.radius,y=e.channel||0;if(ArrayBuffer.isView(t)||Array.isArray(t)){if(!e.width||!e.height)throw Error("For raw data width and height should be provided by options");r=e.width,o=e.height,l=t,c=e.stride?e.stride:Math.floor(t.length/r/o)}else window.HTMLCanvasElement&&t instanceof window.HTMLCanvasElement?(f=(h=t).getContext("2d"),r=h.width,o=h.height,d=f.getImageData(0,0,r,o),l=d.data,c=4):window.CanvasRenderingContext2D&&t instanceof window.CanvasRenderingContext2D?(h=t.canvas,f=t,r=h.width,o=h.height,d=f.getImageData(0,0,r,o),l=d.data,c=4):window.ImageData&&t instanceof window.ImageData&&(d=t,r=t.width,o=t.height,l=d.data,c=4);if(s=Math.max(r,o),window.Uint8ClampedArray&&l instanceof window.Uint8ClampedArray||window.Uint8Array&&l instanceof window.Uint8Array)for(u=l,l=Array(r*o),p=0,g=u.length;p=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 a=0,i=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return a}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.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 a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&a++,16===e?this._parseHex(t,a):this._parseBase(t,e,a),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},i.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)},i.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 a=0;a=0;a-=3)o=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[i]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},i.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)a=s(t,r,r+6),this.words[n]|=a<>>26-i&4194303,(i+=24)>=26&&(i-=26,n++);r+6!==e&&(a=s(t,e,r+6),this.words[n]|=a<>>26-i&4194303),this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=e)n++;n--,a=a/e|0;for(var i=t.length-r,o=i%n,s=Math.min(i,i-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.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 a=0|t.words[0],i=0|e.words[0],o=a*i,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=(a=0|t.words[p])*(i=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()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var a=0,i=0,o=0;o>>24-a&16777215)||o!==this.length-1?u[6-l.length]+l+r:l+r,(a+=2)>=26&&(a-=26,o--)}for(0!==i&&(r=i.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")},i.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},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n("undefined"!=typeof o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var a=this.byteLength(),i=r||Math.max(1,a);n(a<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(i),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},i.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},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.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)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.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)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.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 a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,a=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 a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;it.length?this.clone().iadd(t):t.clone().iadd(this)},i.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,a=this.cmp(t);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==i&&o>26,this.words[o]=67108863&e;if(0===i&&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,T=w>>>13,k=0|o[5],M=8191&k,E=k>>>13,S=0|o[6],C=8191&S,L=S>>>13,O=0|o[7],D=8191&O,R=O>>>13,I=0|o[8],P=8191&I,F=I>>>13,z=0|o[9],N=8191&z,B=z>>>13,j=0|s[0],U=8191&j,V=j>>>13,H=0|s[1],G=8191&H,q=H>>>13,W=0|s[2],X=8191&W,Y=W>>>13,Z=0|s[3],J=8191&Z,Q=Z>>>13,$=0|s[4],K=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,at=0|s[6],it=8191&at,ot=at>>>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&(a=(a=Math.imul(f,V))+Math.imul(h,U)|0))<<13)|0;u=((i=Math.imul(h,V))+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),a=(a=Math.imul(p,V))+Math.imul(g,U)|0,i=Math.imul(g,V);var mt=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(a=(a=a+Math.imul(f,q)|0)+Math.imul(h,G)|0))<<13)|0;u=((i=i+Math.imul(h,q)|0)+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,U),a=(a=Math.imul(m,V))+Math.imul(y,U)|0,i=Math.imul(y,V),n=n+Math.imul(p,G)|0,a=(a=a+Math.imul(p,q)|0)+Math.imul(g,G)|0,i=i+Math.imul(g,q)|0;var yt=(u+(n=n+Math.imul(f,X)|0)|0)+((8191&(a=(a=a+Math.imul(f,Y)|0)+Math.imul(h,X)|0))<<13)|0;u=((i=i+Math.imul(h,Y)|0)+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),a=(a=Math.imul(x,V))+Math.imul(_,U)|0,i=Math.imul(_,V),n=n+Math.imul(m,G)|0,a=(a=a+Math.imul(m,q)|0)+Math.imul(y,G)|0,i=i+Math.imul(y,q)|0,n=n+Math.imul(p,X)|0,a=(a=a+Math.imul(p,Y)|0)+Math.imul(g,X)|0,i=i+Math.imul(g,Y)|0;var bt=(u+(n=n+Math.imul(f,J)|0)|0)+((8191&(a=(a=a+Math.imul(f,Q)|0)+Math.imul(h,J)|0))<<13)|0;u=((i=i+Math.imul(h,Q)|0)+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,U),a=(a=Math.imul(A,V))+Math.imul(T,U)|0,i=Math.imul(T,V),n=n+Math.imul(x,G)|0,a=(a=a+Math.imul(x,q)|0)+Math.imul(_,G)|0,i=i+Math.imul(_,q)|0,n=n+Math.imul(m,X)|0,a=(a=a+Math.imul(m,Y)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(p,J)|0,a=(a=a+Math.imul(p,Q)|0)+Math.imul(g,J)|0,i=i+Math.imul(g,Q)|0;var xt=(u+(n=n+Math.imul(f,K)|0)|0)+((8191&(a=(a=a+Math.imul(f,tt)|0)+Math.imul(h,K)|0))<<13)|0;u=((i=i+Math.imul(h,tt)|0)+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(M,U),a=(a=Math.imul(M,V))+Math.imul(E,U)|0,i=Math.imul(E,V),n=n+Math.imul(A,G)|0,a=(a=a+Math.imul(A,q)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,q)|0,n=n+Math.imul(x,X)|0,a=(a=a+Math.imul(x,Y)|0)+Math.imul(_,X)|0,i=i+Math.imul(_,Y)|0,n=n+Math.imul(m,J)|0,a=(a=a+Math.imul(m,Q)|0)+Math.imul(y,J)|0,i=i+Math.imul(y,Q)|0,n=n+Math.imul(p,K)|0,a=(a=a+Math.imul(p,tt)|0)+Math.imul(g,K)|0,i=i+Math.imul(g,tt)|0;var _t=(u+(n=n+Math.imul(f,rt)|0)|0)+((8191&(a=(a=a+Math.imul(f,nt)|0)+Math.imul(h,rt)|0))<<13)|0;u=((i=i+Math.imul(h,nt)|0)+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,U),a=(a=Math.imul(C,V))+Math.imul(L,U)|0,i=Math.imul(L,V),n=n+Math.imul(M,G)|0,a=(a=a+Math.imul(M,q)|0)+Math.imul(E,G)|0,i=i+Math.imul(E,q)|0,n=n+Math.imul(A,X)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(T,X)|0,i=i+Math.imul(T,Y)|0,n=n+Math.imul(x,J)|0,a=(a=a+Math.imul(x,Q)|0)+Math.imul(_,J)|0,i=i+Math.imul(_,Q)|0,n=n+Math.imul(m,K)|0,a=(a=a+Math.imul(m,tt)|0)+Math.imul(y,K)|0,i=i+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,a=(a=a+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,i=i+Math.imul(g,nt)|0;var wt=(u+(n=n+Math.imul(f,it)|0)|0)+((8191&(a=(a=a+Math.imul(f,ot)|0)+Math.imul(h,it)|0))<<13)|0;u=((i=i+Math.imul(h,ot)|0)+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(D,U),a=(a=Math.imul(D,V))+Math.imul(R,U)|0,i=Math.imul(R,V),n=n+Math.imul(C,G)|0,a=(a=a+Math.imul(C,q)|0)+Math.imul(L,G)|0,i=i+Math.imul(L,q)|0,n=n+Math.imul(M,X)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(A,J)|0,a=(a=a+Math.imul(A,Q)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,Q)|0,n=n+Math.imul(x,K)|0,a=(a=a+Math.imul(x,tt)|0)+Math.imul(_,K)|0,i=i+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,a=(a=a+Math.imul(m,nt)|0)+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,n=n+Math.imul(p,it)|0,a=(a=a+Math.imul(p,ot)|0)+Math.imul(g,it)|0,i=i+Math.imul(g,ot)|0;var At=(u+(n=n+Math.imul(f,lt)|0)|0)+((8191&(a=(a=a+Math.imul(f,ut)|0)+Math.imul(h,lt)|0))<<13)|0;u=((i=i+Math.imul(h,ut)|0)+(a>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(P,U),a=(a=Math.imul(P,V))+Math.imul(F,U)|0,i=Math.imul(F,V),n=n+Math.imul(D,G)|0,a=(a=a+Math.imul(D,q)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,q)|0,n=n+Math.imul(C,X)|0,a=(a=a+Math.imul(C,Y)|0)+Math.imul(L,X)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(M,J)|0,a=(a=a+Math.imul(M,Q)|0)+Math.imul(E,J)|0,i=i+Math.imul(E,Q)|0,n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,tt)|0)+Math.imul(T,K)|0,i=i+Math.imul(T,tt)|0,n=n+Math.imul(x,rt)|0,a=(a=a+Math.imul(x,nt)|0)+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,n=n+Math.imul(m,it)|0,a=(a=a+Math.imul(m,ot)|0)+Math.imul(y,it)|0,i=i+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,a=(a=a+Math.imul(p,ut)|0)+Math.imul(g,lt)|0,i=i+Math.imul(g,ut)|0;var Tt=(u+(n=n+Math.imul(f,ft)|0)|0)+((8191&(a=(a=a+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;u=((i=i+Math.imul(h,ht)|0)+(a>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(N,U),a=(a=Math.imul(N,V))+Math.imul(B,U)|0,i=Math.imul(B,V),n=n+Math.imul(P,G)|0,a=(a=a+Math.imul(P,q)|0)+Math.imul(F,G)|0,i=i+Math.imul(F,q)|0,n=n+Math.imul(D,X)|0,a=(a=a+Math.imul(D,Y)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,Y)|0,n=n+Math.imul(C,J)|0,a=(a=a+Math.imul(C,Q)|0)+Math.imul(L,J)|0,i=i+Math.imul(L,Q)|0,n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,tt)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,tt)|0,n=n+Math.imul(A,rt)|0,a=(a=a+Math.imul(A,nt)|0)+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,n=n+Math.imul(x,it)|0,a=(a=a+Math.imul(x,ot)|0)+Math.imul(_,it)|0,i=i+Math.imul(_,ot)|0,n=n+Math.imul(m,lt)|0,a=(a=a+Math.imul(m,ut)|0)+Math.imul(y,lt)|0,i=i+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,a=(a=a+Math.imul(p,ht)|0)+Math.imul(g,ft)|0,i=i+Math.imul(g,ht)|0;var kt=(u+(n=n+Math.imul(f,pt)|0)|0)+((8191&(a=(a=a+Math.imul(f,gt)|0)+Math.imul(h,pt)|0))<<13)|0;u=((i=i+Math.imul(h,gt)|0)+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(N,G),a=(a=Math.imul(N,q))+Math.imul(B,G)|0,i=Math.imul(B,q),n=n+Math.imul(P,X)|0,a=(a=a+Math.imul(P,Y)|0)+Math.imul(F,X)|0,i=i+Math.imul(F,Y)|0,n=n+Math.imul(D,J)|0,a=(a=a+Math.imul(D,Q)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,Q)|0,n=n+Math.imul(C,K)|0,a=(a=a+Math.imul(C,tt)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,tt)|0,n=n+Math.imul(M,rt)|0,a=(a=a+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,n=n+Math.imul(A,it)|0,a=(a=a+Math.imul(A,ot)|0)+Math.imul(T,it)|0,i=i+Math.imul(T,ot)|0,n=n+Math.imul(x,lt)|0,a=(a=a+Math.imul(x,ut)|0)+Math.imul(_,lt)|0,i=i+Math.imul(_,ut)|0,n=n+Math.imul(m,ft)|0,a=(a=a+Math.imul(m,ht)|0)+Math.imul(y,ft)|0,i=i+Math.imul(y,ht)|0;var Mt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(a=(a=a+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;u=((i=i+Math.imul(g,gt)|0)+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(N,X),a=(a=Math.imul(N,Y))+Math.imul(B,X)|0,i=Math.imul(B,Y),n=n+Math.imul(P,J)|0,a=(a=a+Math.imul(P,Q)|0)+Math.imul(F,J)|0,i=i+Math.imul(F,Q)|0,n=n+Math.imul(D,K)|0,a=(a=a+Math.imul(D,tt)|0)+Math.imul(R,K)|0,i=i+Math.imul(R,tt)|0,n=n+Math.imul(C,rt)|0,a=(a=a+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,i=i+Math.imul(L,nt)|0,n=n+Math.imul(M,it)|0,a=(a=a+Math.imul(M,ot)|0)+Math.imul(E,it)|0,i=i+Math.imul(E,ot)|0,n=n+Math.imul(A,lt)|0,a=(a=a+Math.imul(A,ut)|0)+Math.imul(T,lt)|0,i=i+Math.imul(T,ut)|0,n=n+Math.imul(x,ft)|0,a=(a=a+Math.imul(x,ht)|0)+Math.imul(_,ft)|0,i=i+Math.imul(_,ht)|0;var Et=(u+(n=n+Math.imul(m,pt)|0)|0)+((8191&(a=(a=a+Math.imul(m,gt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((i=i+Math.imul(y,gt)|0)+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,J),a=(a=Math.imul(N,Q))+Math.imul(B,J)|0,i=Math.imul(B,Q),n=n+Math.imul(P,K)|0,a=(a=a+Math.imul(P,tt)|0)+Math.imul(F,K)|0,i=i+Math.imul(F,tt)|0,n=n+Math.imul(D,rt)|0,a=(a=a+Math.imul(D,nt)|0)+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,n=n+Math.imul(C,it)|0,a=(a=a+Math.imul(C,ot)|0)+Math.imul(L,it)|0,i=i+Math.imul(L,ot)|0,n=n+Math.imul(M,lt)|0,a=(a=a+Math.imul(M,ut)|0)+Math.imul(E,lt)|0,i=i+Math.imul(E,ut)|0,n=n+Math.imul(A,ft)|0,a=(a=a+Math.imul(A,ht)|0)+Math.imul(T,ft)|0,i=i+Math.imul(T,ht)|0;var St=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(a=(a=a+Math.imul(x,gt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((i=i+Math.imul(_,gt)|0)+(a>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(N,K),a=(a=Math.imul(N,tt))+Math.imul(B,K)|0,i=Math.imul(B,tt),n=n+Math.imul(P,rt)|0,a=(a=a+Math.imul(P,nt)|0)+Math.imul(F,rt)|0,i=i+Math.imul(F,nt)|0,n=n+Math.imul(D,it)|0,a=(a=a+Math.imul(D,ot)|0)+Math.imul(R,it)|0,i=i+Math.imul(R,ot)|0,n=n+Math.imul(C,lt)|0,a=(a=a+Math.imul(C,ut)|0)+Math.imul(L,lt)|0,i=i+Math.imul(L,ut)|0,n=n+Math.imul(M,ft)|0,a=(a=a+Math.imul(M,ht)|0)+Math.imul(E,ft)|0,i=i+Math.imul(E,ht)|0;var Ct=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(a=(a=a+Math.imul(A,gt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((i=i+Math.imul(T,gt)|0)+(a>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(N,rt),a=(a=Math.imul(N,nt))+Math.imul(B,rt)|0,i=Math.imul(B,nt),n=n+Math.imul(P,it)|0,a=(a=a+Math.imul(P,ot)|0)+Math.imul(F,it)|0,i=i+Math.imul(F,ot)|0,n=n+Math.imul(D,lt)|0,a=(a=a+Math.imul(D,ut)|0)+Math.imul(R,lt)|0,i=i+Math.imul(R,ut)|0,n=n+Math.imul(C,ft)|0,a=(a=a+Math.imul(C,ht)|0)+Math.imul(L,ft)|0,i=i+Math.imul(L,ht)|0;var Lt=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(a=(a=a+Math.imul(M,gt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((i=i+Math.imul(E,gt)|0)+(a>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(N,it),a=(a=Math.imul(N,ot))+Math.imul(B,it)|0,i=Math.imul(B,ot),n=n+Math.imul(P,lt)|0,a=(a=a+Math.imul(P,ut)|0)+Math.imul(F,lt)|0,i=i+Math.imul(F,ut)|0,n=n+Math.imul(D,ft)|0,a=(a=a+Math.imul(D,ht)|0)+Math.imul(R,ft)|0,i=i+Math.imul(R,ht)|0;var Ot=(u+(n=n+Math.imul(C,pt)|0)|0)+((8191&(a=(a=a+Math.imul(C,gt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((i=i+Math.imul(L,gt)|0)+(a>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(N,lt),a=(a=Math.imul(N,ut))+Math.imul(B,lt)|0,i=Math.imul(B,ut),n=n+Math.imul(P,ft)|0,a=(a=a+Math.imul(P,ht)|0)+Math.imul(F,ft)|0,i=i+Math.imul(F,ht)|0;var Dt=(u+(n=n+Math.imul(D,pt)|0)|0)+((8191&(a=(a=a+Math.imul(D,gt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((i=i+Math.imul(R,gt)|0)+(a>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(N,ft),a=(a=Math.imul(N,ht))+Math.imul(B,ft)|0,i=Math.imul(B,ht);var Rt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(a=(a=a+Math.imul(P,gt)|0)+Math.imul(F,pt)|0))<<13)|0;u=((i=i+Math.imul(F,gt)|0)+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(u+(n=Math.imul(N,pt))|0)+((8191&(a=(a=Math.imul(N,gt))+Math.imul(B,pt)|0))<<13)|0;return u=((i=Math.imul(B,gt))+(a>>>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]=At,l[8]=Tt,l[9]=kt,l[10]=Mt,l[11]=Et,l[12]=St,l[13]=Ct,l[14]=Lt,l[15]=Ot,l[16]=Dt,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),i.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,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=s,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*e;o>=26,e+=a/67108864|0,e+=i>>>26,this.words[r]=67108863&i}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>a}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,r=t%26,a=(t-r)/26,i=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!==a){for(e=this.length-1;e>=0;e--)this.words[e+a]=this.words[e];for(e=0;e=0),a=e?(e-e%26)/26:0;var i=t%26,o=Math.min((t-i)/26,this.length),s=67108863^67108863>>>i<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=a);u--){var f=0|this.words[u];this.words[u]=c<<26-i|f>>>i,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,a=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 a=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},i.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[a+r]=67108863&i}for(;a>26,this.words[a+r]=67108863&i;if(0===s)return this.strip();for(n(-1===s),s=0,a=0;a>26,this.words[a]=67108863&i;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),a=t,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,l=n.length-a.length;if("mod"!==e){(s=new i(null)).length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[a.length+f])+(0|n.words[a.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(a,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(a,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}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(a=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:a,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(a=s.div.neg()),{div:a,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 i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var a,o,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.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),a=t.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,a=this.length-1;a>=0;a--)r=(e*r+(0|this.words[a]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*e;this.words[r]=a/t|0,e=a%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.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 a=new i(1),o=new i(0),s=new i(0),l=new i(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;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(f)),a.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),a.isub(s),o.isub(l)):(r.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},i.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 a,o=new i(1),s=new i(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(a=0===e.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(t),a},i.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 a=e.cmp(r);if(a<0){var i=e;e=r,r=i}else if(0===a||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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 a=0|this.words[0];e=a===t?0:at.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|t.words[r];if(n!==a){na&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new w(t)},i.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)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.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 i(e,16),this.n=this.p.bitLength(),this.k=new i(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=i._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 i(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 i(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)},a(y,m),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,a=i}a>>>=22,t.words[n-10]=a,0===a&&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]=a,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._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 i(1)).iushrn(2);return this.pow(t,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,a),h=this.pow(t,a.addn(1).iushrn(1)),d=this.pow(t,a),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;a!==r[0]&&(a=this.sqr(a)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}l=26}return a},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},i.mont=function(t){return new A(t)},a(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),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.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:50}],43:[function(t,e,r){"use strict";e.exports=function(t,e,r){switch(arguments.length){case 1:return f(t);case 2:return"function"==typeof e?u(t,t,e,!0):h(t,e);case 3:return u(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}};var n,a=t("typedarray-pool"),i=t("./lib/sweep"),o=t("./lib/intersect");function s(t,e){for(var r=0;r>>1;if(!(c<=0)){var f,h=a.mallocDouble(2*c*s),d=a.mallocInt32(s);if((s=l(t,c,h,d))>0){if(1===c&&n)i.init(s),f=i.sweepComplete(c,r,0,s,h,d,0,s,h,d);else{var p=a.mallocDouble(2*c*u),g=a.mallocInt32(u);(u=l(e,c,p,g))>0&&(i.init(s+u),f=1===c?i.sweepBipartite(c,r,0,s,h,d,0,u,p,g):o(c,r,n,s,h,d,u,p,g),a.free(p),a.free(g))}a.free(h),a.free(d)}return f}}}function c(t,e){n.push([t,e])}function f(t){return n=[],u(t,t,c,!0),n}function h(t,e){return n=[],u(t,e,c,!1),n}},{"./lib/intersect":45,"./lib/sweep":49,"typedarray-pool":302}],44:[function(t,e,r){"use strict";var n=["d","ax","vv","rs","re","rb","ri","bs","be","bb","bi"];function a(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],a=n.slice();t||a.splice(3,0,"fp");var i=["function "+e+"("+a.join()+"){"];function o(e,a){var o=function(t,e,r){var a="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",a,"(",n.join(),"){","var ","es","=2*","d",";"],o="for(var i=rs,rp=es*rs;ibe-bs){"),t?(o(!0,!1),i.push("}else{"),o(!1,!1)):(i.push("if(fp){"),o(!0,!0),i.push("}else{"),o(!0,!1),i.push("}}else{if(fp){"),o(!1,!0),i.push("}else{"),o(!1,!1),i.push("}")),i.push("}}return "+e);var s=r.join("")+i.join("");return new Function(s)()}r.partial=a(!1),r.full=a(!0)},{}],45:[function(t,e,r){"use strict";e.exports=function(t,e,r,i,c,w,A,T,k){!function(t,e){var r=8*a.log2(e+1)*(t+1)|0,i=a.nextPow2(6*r);m.length0;){var C=6*(E-=1),L=m[C],O=m[C+1],D=m[C+2],R=m[C+3],I=m[C+4],P=m[C+5],F=2*E,z=y[F],N=y[F+1],B=1&P,j=!!(16&P),U=c,V=w,H=T,G=k;if(B&&(U=T,V=k,H=c,G=w),!(2&P&&(D=d(t,L,O,D,U,V,N),O>=D)||4&P&&(O=p(t,L,O,D,U,V,z))>=D)){var q=D-O,W=I-R;if(j){if(t*q*(q+W)<1<<22){if(void 0!==(M=l.scanComplete(t,L,e,O,D,U,V,R,I,H,G)))return M;continue}}else{if(t*Math.min(q,W)<128){if(void 0!==(M=o(t,L,e,B,O,D,U,V,R,I,H,G)))return M;continue}if(t*q*W<1<<22){if(void 0!==(M=l.scanBipartite(t,L,e,B,O,D,U,V,R,I,H,G)))return M;continue}}var X=f(t,L,O,D,U,V,z,N);if(O=p0)&&!(p1>=hi)",["p0","p1"]),h=c("lo===p0",["p0"]),d=c("lo>>1,f=2*t,h=c,d=o[f*c+e];for(;l=y?(h=m,d=y):v>=x?(h=g,d=v):(h=b,d=x):y>=x?(h=m,d=y):x>=v?(h=g,d=v):(h=b,d=x);for(var _=f*(u-1),w=f*h,A=0;Ar&&a[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p=0&&n.push("lo=e[k+n]");t.indexOf("hi")>=0&&n.push("hi=e[k+o]");return r.push("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".replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}},{}],48:[function(t,e,r){"use strict";e.exports=function(t,e){e<=128?n(0,e-1,t):function t(e,r,c){var f=(r-e+1)/6|0,h=e+f,d=r-f,p=e+r>>1,g=p-f,v=p+f,m=h,y=g,b=p,x=v,_=d,w=e+1,A=r-1,T=0;l(m,y,c)&&(T=m,m=y,y=T);l(x,_,c)&&(T=x,x=_,_=T);l(m,b,c)&&(T=m,m=b,b=T);l(y,b,c)&&(T=y,y=b,b=T);l(m,x,c)&&(T=m,m=x,x=T);l(b,x,c)&&(T=b,b=x,x=T);l(y,_,c)&&(T=y,y=_,_=T);l(y,b,c)&&(T=y,y=b,b=T);l(x,_,c)&&(T=x,x=_,_=T);for(var k=c[2*y],M=c[2*y+1],E=c[2*x],S=c[2*x+1],C=2*m,L=2*b,O=2*_,D=2*h,R=2*p,I=2*d,P=0;P<2;++P){var F=c[C+P],z=c[L+P],N=c[O+P];c[D+P]=F,c[R+P]=z,c[I+P]=N}i(g,e,c),i(v,r,c);for(var B=w;B<=A;++B)if(u(B,k,M,c))B!==w&&a(B,w,c),++w;else if(!u(B,E,S,c))for(;;){if(u(A,E,S,c)){u(A,k,M,c)?(o(B,w,A,c),++w,--A):(a(B,A,c),--A);break}if(--At;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function u(t,e,r,n){var a=n[t*=2];return a>>1;i(h,M);var E=0,S=0;for(w=0;w=1<<28)d(l,u,S--,C=C-(1<<28)|0);else if(C>=0)d(o,s,E--,C);else if(C<=-(1<<28)){C=-C-(1<<28)|0;for(var L=0;L>>1;i(h,S);var C=0,L=0,O=0;for(T=0;T>1==h[2*T+3]>>1&&(R=2,T+=1),D<0){for(var I=-(D>>1)-1,P=0;P>1)-1;0===R?d(o,s,C--,I):1===R?d(l,u,L--,I):2===R&&d(c,f,O--,I)}}},scanBipartite:function(t,e,r,n,a,l,u,c,f,g,v,m){var y=0,b=2*t,x=e,_=e+t,w=1,A=1;n?A=1<<28:w=1<<28;for(var T=a;T>>1;i(h,S);var C=0;for(T=0;T=1<<28?(O=!n,k-=1<<28):(O=!!n,k-=1),O)p(o,s,C++,k);else{var D=m[k],R=b*k,I=v[R+e+1],P=v[R+e+1+t];t:for(var F=0;F>>1;i(h,w);var A=0;for(y=0;y=1<<28)o[A++]=b-(1<<28);else{var k=d[b-=1],M=g*b,E=f[M+e+1],S=f[M+e+1+t];t:for(var C=0;C=0;--C)if(o[C]===b){for(R=C+1;R0&&s.length>i){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 m(){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:f(r,u,this);break;case 2:h(r,u,this,arguments[1]);break;case 3:d(r,u,this,arguments[1],arguments[2]);break;case 4:p(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(a=new Array(n-1),i=1;i=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(var r=e,n=r+1,a=t.length;n=0;i--)this.removeListener(t,e[i]);return this},o.prototype.listeners=function(t){return b(this,t,!0)},o.prototype.rawListeners=function(t){return b(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):x.call(t,e)},o.prototype.listenerCount=x,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],52:[function(t,e,r){(function(e){ + */function a(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,a=0,i=Math.min(r,n);a=0;u--)if(c[u]!==f[u])return!1;for(u=c.length-1;u>=0;u--)if(s=c[u],!b(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function x(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var a;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),a=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!a&&m(a,r,"Missing expected exception"+n);var i="string"==typeof n,s=!t&&a&&!r;if((!t&&o.isError(a)&&i&&_(a,r)||s)&&m(a,r,"Got unwanted exception"+n),t&&a&&r&&!_(a,r)||!t&&a)throw a}d.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(v(t.actual),128)+" "+t.operator+" "+g(v(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,a=p(e),i=n.indexOf("\n"+a);if(i>=0){var o=n.indexOf("\n",i+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(d.AssertionError,Error),d.fail=m,d.ok=y,d.equal=function(t,e,r){t!=e&&m(t,e,r,"==",d.equal)},d.notEqual=function(t,e,r){t==e&&m(t,e,r,"!=",d.notEqual)},d.deepEqual=function(t,e,r){b(t,e,!1)||m(t,e,r,"deepEqual",d.deepEqual)},d.deepStrictEqual=function(t,e,r){b(t,e,!0)||m(t,e,r,"deepStrictEqual",d.deepStrictEqual)},d.notDeepEqual=function(t,e,r){b(t,e,!1)&&m(t,e,r,"notDeepEqual",d.notDeepEqual)},d.notDeepStrictEqual=function t(e,r,n){b(e,r,!0)&&m(e,r,n,"notDeepStrictEqual",t)},d.strictEqual=function(t,e,r){t!==e&&m(t,e,r,"===",d.strictEqual)},d.notStrictEqual=function(t,e,r){t===e&&m(t,e,r,"!==",d.notStrictEqual)},d.throws=function(t,e,r){w(!0,t,e,r)},d.doesNotThrow=function(t,e,r){w(!1,t,e,r)},d.ifError=function(t){if(t)throw t},d.strict=n((function t(e,r){e||m(e,!0,r,"==",t)}),d,{equal:d.strictEqual,deepEqual:d.deepStrictEqual,notEqual:d.notStrictEqual,notDeepEqual:d.notDeepStrictEqual}),d.strict.strict=d.strict;var A=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":261,"util/":20}],18:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],19:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],20:[function(t,e,r){(function(e,n){(function(){var a=/%[sdj%]/g;r.format=function(t){if(!m(t)){for(var e=[],r=0;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),l=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(e)?n.showHidden=e:e&&r._extend(n,e),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),c(n,t,n.depth)}function l(t,e){var r=s.styles[e];return r?"\x1b["+s.colors[r][0]+"m"+t+"\x1b["+s.colors[r][1]+"m":t}function u(t,e){return t}function c(t,e,n){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var a=e.inspect(n,t);return m(a)||(a=c(t,a,n)),a}var i=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(m(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(v(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),w(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(e);if(0===o.length){if(A(e)){var l=e.name?": "+e.name:"";return t.stylize("[Function"+l+"]","special")}if(b(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(_(e))return t.stylize(Date.prototype.toString.call(e),"date");if(w(e))return f(e)}var u,x="",T=!1,k=["{","}"];(h(e)&&(T=!0,k=["[","]"]),A(e))&&(x=" [Function"+(e.name?": "+e.name:"")+"]");return b(e)&&(x=" "+RegExp.prototype.toString.call(e)),_(e)&&(x=" "+Date.prototype.toUTCString.call(e)),w(e)&&(x=" "+f(e)),0!==o.length||T&&0!=e.length?n<0?b(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),u=T?function(t,e,r,n,a){for(var i=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(u,x,k)):k[0]+x+k[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,n,a,i){var o,s,l;if((l=Object.getOwnPropertyDescriptor(e,a)||{value:e[a]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),S(n,a)||(o="["+a+"]"),s||(t.seen.indexOf(l.value)<0?(s=g(r)?c(t,l.value,null):c(t,l.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),y(o)){if(i&&a.match(/^\d+$/))return s;(o=JSON.stringify(""+a)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function h(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function g(t){return null===t}function v(t){return"number"==typeof t}function m(t){return"string"==typeof t}function y(t){return void 0===t}function b(t){return x(t)&&"[object RegExp]"===T(t)}function x(t){return"object"==typeof t&&null!==t}function _(t){return x(t)&&"[object Date]"===T(t)}function w(t){return x(t)&&("[object Error]"===T(t)||t instanceof Error)}function A(t){return"function"==typeof t}function T(t){return Object.prototype.toString.call(t)}function k(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(y(i)&&(i=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(i)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=h,r.isBoolean=p,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=v,r.isString=m,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=y,r.isRegExp=b,r.isObject=x,r.isDate=_,r.isError=w,r.isFunction=A,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t},r.isBuffer=t("./support/isBuffer");var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(){var t=new Date,e=[k(t.getHours()),k(t.getMinutes()),k(t.getSeconds())].join(":");return[t.getDate(),M[t.getMonth()],e].join(" ")}function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){console.log("%s - %s",E(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!x(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":19,_process:284,inherits:18}],21:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],22:[function(t,e,r){"use strict";r.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=u(t),o=n[0],s=n[1],l=new i(function(t,e,r){return 3*(e+r)/4-r}(0,o,s)),c=0,f=s>0?o-4:o;for(r=0;r>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===s&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,l[c++]=255&e);1===s&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},r.fromByteArray=function(t){for(var e,r=t.length,a=r%3,i=[],o=0,s=r-a;os?s:o+16383));1===a?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===a&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="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 a,i,o=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],23:[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":33}],24:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],25:[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":33}],26:[function(t,e,r){"use strict";var n=t("./is-rat"),a=t("./lib/is-bn"),i=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,c,f=0;if(a(e))u=e.clone();else if("string"==typeof e)u=o(e);else{if(0===e)return[i(0),i(1)];if(e===Math.floor(e))u=i(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),f-=256;u=i(e)}}if(n(r))u.mul(r[1]),c=r[0].clone();else if(a(r))c=r.clone();else if("string"==typeof r)c=o(r);else if(r)if(r===Math.floor(r))c=i(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),f+=256;c=i(r)}else c=i(1);f>0?u=u.ushln(f):f<0&&(c=c.ushln(-f));return s(u,c)}},{"./div":25,"./is-rat":27,"./lib/is-bn":31,"./lib/num-to-bn":32,"./lib/rationalize":33,"./lib/str-to-bn":34}],27:[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":31}],28:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":42}],29:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,a=0;if(1===e)a=r[0];else if(2===e)a=r[0]+67108864*r[1];else for(var i=0;i20)return 52;return r+32}},{"bit-twiddle":40,"double-bits":89}],31:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":42}],32:[function(t,e,r){"use strict";var n=t("bn.js"),a=t("double-bits");e.exports=function(t){var e=a.exponent(t);return e<52?new n(t):new n(t*Math.pow(2,52-e)).ushln(e-52)}},{"bn.js":42,"double-bits":89}],33:[function(t,e,r){"use strict";var n=t("./num-to-bn"),a=t("./bn-sign");e.exports=function(t,e){var r=a(t),i=a(e);if(0===r)return[n(0),n(1)];if(0===i)return[n(0),n(0)];i<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":28,"./num-to-bn":32}],34:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":42}],35:[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":33}],36:[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":28}],37:[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":33}],38:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var i=e.abs().divmod(r.abs()),o=i.div,s=n(o),l=i.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=a(s)+4,f=n(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var d=r.bitLength()-l.bitLength()+53;f=n(l.ushln(d).divRound(r));return d<1023?u*f*Math.pow(2,-d):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-d))}},{"./lib/bn-to-num":29,"./lib/ctz":30}],39:[function(t,e,r){"use strict";function n(t,e,r,n,a){var i=["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[m]"];return a?e.indexOf("c")<0?i.push(";if(x===y){return m}else if(x<=y){"):i.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):i.push(";if(",e,"){i=m;"),r?i.push("l=m+1}else{h=m-1}"):i.push("h=m-1}else{l=m+1}"),i.push("}"),a?i.push("return -1};"):i.push("return i};"),i.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],a),n("P","c(x,y)"+t+"0",e,["y","c"],a),"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:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],40:[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 a=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,a=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--a;t[e]=n<>>8&255]<<16|a[t>>>16&255]<<8|a[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}},{}],41:[function(t,e,r){"use strict";var n=t("clamp");e.exports=function(t,e){e||(e={});var r,o,s,l,u,c,f,d,h,p,g,v=null==e.cutoff?.25:e.cutoff,m=null==e.radius?8:e.radius,y=e.channel||0;if(ArrayBuffer.isView(t)||Array.isArray(t)){if(!e.width||!e.height)throw Error("For raw data width and height should be provided by options");r=e.width,o=e.height,l=t,c=e.stride?e.stride:Math.floor(t.length/r/o)}else window.HTMLCanvasElement&&t instanceof window.HTMLCanvasElement?(f=(d=t).getContext("2d"),r=d.width,o=d.height,h=f.getImageData(0,0,r,o),l=h.data,c=4):window.CanvasRenderingContext2D&&t instanceof window.CanvasRenderingContext2D?(d=t.canvas,f=t,r=d.width,o=d.height,h=f.getImageData(0,0,r,o),l=h.data,c=4):window.ImageData&&t instanceof window.ImageData&&(h=t,r=t.width,o=t.height,l=h.data,c=4);if(s=Math.max(r,o),window.Uint8ClampedArray&&l instanceof window.Uint8ClampedArray||window.Uint8Array&&l instanceof window.Uint8Array)for(u=l,l=Array(r*o),p=0,g=u.length;p=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 a=0,i=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return a}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.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 a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&a++,16===e?this._parseHex(t,a):this._parseBase(t,e,a),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},i.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)},i.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 a=0;a=0;a-=3)o=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[i]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},i.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)a=s(t,r,r+6),this.words[n]|=a<>>26-i&4194303,(i+=24)>=26&&(i-=26,n++);r+6!==e&&(a=s(t,e,r+6),this.words[n]|=a<>>26-i&4194303),this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=e)n++;n--,a=a/e|0;for(var i=t.length-r,o=i%n,s=Math.min(i,i-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.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 d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var a=0|t.words[0],i=0|e.words[0],o=a*i,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,d=Math.min(u,e.length-1),h=Math.max(0,u-t.length+1);h<=d;h++){var p=u-h|0;c+=(o=(a=0|t.words[p])*(i=0|e.words[h])+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()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var a=0,i=0,o=0;o>>24-a&16777215)||o!==this.length-1?u[6-l.length]+l+r:l+r,(a+=2)>=26&&(a-=26,o--)}for(0!==i&&(r=i.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 d=c[t],h=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(h).toString(t);r=(p=p.idivn(h)).isZero()?g+r:u[d-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")},i.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},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n("undefined"!=typeof o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var a=this.byteLength(),i=r||Math.max(1,a);n(a<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(i),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},i.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},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.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)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.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)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.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 a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,a=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 a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;it.length?this.clone().iadd(t):t.clone().iadd(this)},i.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,a=this.cmp(t);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==i&&o>26,this.words[o]=67108863&e;if(0===i&&o>>13,h=0|o[1],p=8191&h,g=h>>>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,T=w>>>13,k=0|o[5],M=8191&k,E=k>>>13,S=0|o[6],C=8191&S,L=S>>>13,O=0|o[7],D=8191&O,R=O>>>13,I=0|o[8],P=8191&I,F=I>>>13,z=0|o[9],N=8191&z,B=z>>>13,j=0|s[0],U=8191&j,V=j>>>13,H=0|s[1],G=8191&H,q=H>>>13,X=0|s[2],W=8191&X,Y=X>>>13,Z=0|s[3],J=8191&Z,Q=Z>>>13,$=0|s[4],K=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,at=0|s[6],it=8191&at,ot=at>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,dt=ct>>>13,ht=0|s[9],pt=8191&ht,gt=ht>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(u+(n=Math.imul(f,U))|0)+((8191&(a=(a=Math.imul(f,V))+Math.imul(d,U)|0))<<13)|0;u=((i=Math.imul(d,V))+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),a=(a=Math.imul(p,V))+Math.imul(g,U)|0,i=Math.imul(g,V);var mt=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(a=(a=a+Math.imul(f,q)|0)+Math.imul(d,G)|0))<<13)|0;u=((i=i+Math.imul(d,q)|0)+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,U),a=(a=Math.imul(m,V))+Math.imul(y,U)|0,i=Math.imul(y,V),n=n+Math.imul(p,G)|0,a=(a=a+Math.imul(p,q)|0)+Math.imul(g,G)|0,i=i+Math.imul(g,q)|0;var yt=(u+(n=n+Math.imul(f,W)|0)|0)+((8191&(a=(a=a+Math.imul(f,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((i=i+Math.imul(d,Y)|0)+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),a=(a=Math.imul(x,V))+Math.imul(_,U)|0,i=Math.imul(_,V),n=n+Math.imul(m,G)|0,a=(a=a+Math.imul(m,q)|0)+Math.imul(y,G)|0,i=i+Math.imul(y,q)|0,n=n+Math.imul(p,W)|0,a=(a=a+Math.imul(p,Y)|0)+Math.imul(g,W)|0,i=i+Math.imul(g,Y)|0;var bt=(u+(n=n+Math.imul(f,J)|0)|0)+((8191&(a=(a=a+Math.imul(f,Q)|0)+Math.imul(d,J)|0))<<13)|0;u=((i=i+Math.imul(d,Q)|0)+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,U),a=(a=Math.imul(A,V))+Math.imul(T,U)|0,i=Math.imul(T,V),n=n+Math.imul(x,G)|0,a=(a=a+Math.imul(x,q)|0)+Math.imul(_,G)|0,i=i+Math.imul(_,q)|0,n=n+Math.imul(m,W)|0,a=(a=a+Math.imul(m,Y)|0)+Math.imul(y,W)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(p,J)|0,a=(a=a+Math.imul(p,Q)|0)+Math.imul(g,J)|0,i=i+Math.imul(g,Q)|0;var xt=(u+(n=n+Math.imul(f,K)|0)|0)+((8191&(a=(a=a+Math.imul(f,tt)|0)+Math.imul(d,K)|0))<<13)|0;u=((i=i+Math.imul(d,tt)|0)+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(M,U),a=(a=Math.imul(M,V))+Math.imul(E,U)|0,i=Math.imul(E,V),n=n+Math.imul(A,G)|0,a=(a=a+Math.imul(A,q)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,q)|0,n=n+Math.imul(x,W)|0,a=(a=a+Math.imul(x,Y)|0)+Math.imul(_,W)|0,i=i+Math.imul(_,Y)|0,n=n+Math.imul(m,J)|0,a=(a=a+Math.imul(m,Q)|0)+Math.imul(y,J)|0,i=i+Math.imul(y,Q)|0,n=n+Math.imul(p,K)|0,a=(a=a+Math.imul(p,tt)|0)+Math.imul(g,K)|0,i=i+Math.imul(g,tt)|0;var _t=(u+(n=n+Math.imul(f,rt)|0)|0)+((8191&(a=(a=a+Math.imul(f,nt)|0)+Math.imul(d,rt)|0))<<13)|0;u=((i=i+Math.imul(d,nt)|0)+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,U),a=(a=Math.imul(C,V))+Math.imul(L,U)|0,i=Math.imul(L,V),n=n+Math.imul(M,G)|0,a=(a=a+Math.imul(M,q)|0)+Math.imul(E,G)|0,i=i+Math.imul(E,q)|0,n=n+Math.imul(A,W)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(T,W)|0,i=i+Math.imul(T,Y)|0,n=n+Math.imul(x,J)|0,a=(a=a+Math.imul(x,Q)|0)+Math.imul(_,J)|0,i=i+Math.imul(_,Q)|0,n=n+Math.imul(m,K)|0,a=(a=a+Math.imul(m,tt)|0)+Math.imul(y,K)|0,i=i+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,a=(a=a+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,i=i+Math.imul(g,nt)|0;var wt=(u+(n=n+Math.imul(f,it)|0)|0)+((8191&(a=(a=a+Math.imul(f,ot)|0)+Math.imul(d,it)|0))<<13)|0;u=((i=i+Math.imul(d,ot)|0)+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(D,U),a=(a=Math.imul(D,V))+Math.imul(R,U)|0,i=Math.imul(R,V),n=n+Math.imul(C,G)|0,a=(a=a+Math.imul(C,q)|0)+Math.imul(L,G)|0,i=i+Math.imul(L,q)|0,n=n+Math.imul(M,W)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(E,W)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(A,J)|0,a=(a=a+Math.imul(A,Q)|0)+Math.imul(T,J)|0,i=i+Math.imul(T,Q)|0,n=n+Math.imul(x,K)|0,a=(a=a+Math.imul(x,tt)|0)+Math.imul(_,K)|0,i=i+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,a=(a=a+Math.imul(m,nt)|0)+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,n=n+Math.imul(p,it)|0,a=(a=a+Math.imul(p,ot)|0)+Math.imul(g,it)|0,i=i+Math.imul(g,ot)|0;var At=(u+(n=n+Math.imul(f,lt)|0)|0)+((8191&(a=(a=a+Math.imul(f,ut)|0)+Math.imul(d,lt)|0))<<13)|0;u=((i=i+Math.imul(d,ut)|0)+(a>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(P,U),a=(a=Math.imul(P,V))+Math.imul(F,U)|0,i=Math.imul(F,V),n=n+Math.imul(D,G)|0,a=(a=a+Math.imul(D,q)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,q)|0,n=n+Math.imul(C,W)|0,a=(a=a+Math.imul(C,Y)|0)+Math.imul(L,W)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(M,J)|0,a=(a=a+Math.imul(M,Q)|0)+Math.imul(E,J)|0,i=i+Math.imul(E,Q)|0,n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,tt)|0)+Math.imul(T,K)|0,i=i+Math.imul(T,tt)|0,n=n+Math.imul(x,rt)|0,a=(a=a+Math.imul(x,nt)|0)+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,n=n+Math.imul(m,it)|0,a=(a=a+Math.imul(m,ot)|0)+Math.imul(y,it)|0,i=i+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,a=(a=a+Math.imul(p,ut)|0)+Math.imul(g,lt)|0,i=i+Math.imul(g,ut)|0;var Tt=(u+(n=n+Math.imul(f,ft)|0)|0)+((8191&(a=(a=a+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;u=((i=i+Math.imul(d,dt)|0)+(a>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(N,U),a=(a=Math.imul(N,V))+Math.imul(B,U)|0,i=Math.imul(B,V),n=n+Math.imul(P,G)|0,a=(a=a+Math.imul(P,q)|0)+Math.imul(F,G)|0,i=i+Math.imul(F,q)|0,n=n+Math.imul(D,W)|0,a=(a=a+Math.imul(D,Y)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,Y)|0,n=n+Math.imul(C,J)|0,a=(a=a+Math.imul(C,Q)|0)+Math.imul(L,J)|0,i=i+Math.imul(L,Q)|0,n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,tt)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,tt)|0,n=n+Math.imul(A,rt)|0,a=(a=a+Math.imul(A,nt)|0)+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,n=n+Math.imul(x,it)|0,a=(a=a+Math.imul(x,ot)|0)+Math.imul(_,it)|0,i=i+Math.imul(_,ot)|0,n=n+Math.imul(m,lt)|0,a=(a=a+Math.imul(m,ut)|0)+Math.imul(y,lt)|0,i=i+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,a=(a=a+Math.imul(p,dt)|0)+Math.imul(g,ft)|0,i=i+Math.imul(g,dt)|0;var kt=(u+(n=n+Math.imul(f,pt)|0)|0)+((8191&(a=(a=a+Math.imul(f,gt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((i=i+Math.imul(d,gt)|0)+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(N,G),a=(a=Math.imul(N,q))+Math.imul(B,G)|0,i=Math.imul(B,q),n=n+Math.imul(P,W)|0,a=(a=a+Math.imul(P,Y)|0)+Math.imul(F,W)|0,i=i+Math.imul(F,Y)|0,n=n+Math.imul(D,J)|0,a=(a=a+Math.imul(D,Q)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,Q)|0,n=n+Math.imul(C,K)|0,a=(a=a+Math.imul(C,tt)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,tt)|0,n=n+Math.imul(M,rt)|0,a=(a=a+Math.imul(M,nt)|0)+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,n=n+Math.imul(A,it)|0,a=(a=a+Math.imul(A,ot)|0)+Math.imul(T,it)|0,i=i+Math.imul(T,ot)|0,n=n+Math.imul(x,lt)|0,a=(a=a+Math.imul(x,ut)|0)+Math.imul(_,lt)|0,i=i+Math.imul(_,ut)|0,n=n+Math.imul(m,ft)|0,a=(a=a+Math.imul(m,dt)|0)+Math.imul(y,ft)|0,i=i+Math.imul(y,dt)|0;var Mt=(u+(n=n+Math.imul(p,pt)|0)|0)+((8191&(a=(a=a+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;u=((i=i+Math.imul(g,gt)|0)+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(N,W),a=(a=Math.imul(N,Y))+Math.imul(B,W)|0,i=Math.imul(B,Y),n=n+Math.imul(P,J)|0,a=(a=a+Math.imul(P,Q)|0)+Math.imul(F,J)|0,i=i+Math.imul(F,Q)|0,n=n+Math.imul(D,K)|0,a=(a=a+Math.imul(D,tt)|0)+Math.imul(R,K)|0,i=i+Math.imul(R,tt)|0,n=n+Math.imul(C,rt)|0,a=(a=a+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,i=i+Math.imul(L,nt)|0,n=n+Math.imul(M,it)|0,a=(a=a+Math.imul(M,ot)|0)+Math.imul(E,it)|0,i=i+Math.imul(E,ot)|0,n=n+Math.imul(A,lt)|0,a=(a=a+Math.imul(A,ut)|0)+Math.imul(T,lt)|0,i=i+Math.imul(T,ut)|0,n=n+Math.imul(x,ft)|0,a=(a=a+Math.imul(x,dt)|0)+Math.imul(_,ft)|0,i=i+Math.imul(_,dt)|0;var Et=(u+(n=n+Math.imul(m,pt)|0)|0)+((8191&(a=(a=a+Math.imul(m,gt)|0)+Math.imul(y,pt)|0))<<13)|0;u=((i=i+Math.imul(y,gt)|0)+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,J),a=(a=Math.imul(N,Q))+Math.imul(B,J)|0,i=Math.imul(B,Q),n=n+Math.imul(P,K)|0,a=(a=a+Math.imul(P,tt)|0)+Math.imul(F,K)|0,i=i+Math.imul(F,tt)|0,n=n+Math.imul(D,rt)|0,a=(a=a+Math.imul(D,nt)|0)+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,n=n+Math.imul(C,it)|0,a=(a=a+Math.imul(C,ot)|0)+Math.imul(L,it)|0,i=i+Math.imul(L,ot)|0,n=n+Math.imul(M,lt)|0,a=(a=a+Math.imul(M,ut)|0)+Math.imul(E,lt)|0,i=i+Math.imul(E,ut)|0,n=n+Math.imul(A,ft)|0,a=(a=a+Math.imul(A,dt)|0)+Math.imul(T,ft)|0,i=i+Math.imul(T,dt)|0;var St=(u+(n=n+Math.imul(x,pt)|0)|0)+((8191&(a=(a=a+Math.imul(x,gt)|0)+Math.imul(_,pt)|0))<<13)|0;u=((i=i+Math.imul(_,gt)|0)+(a>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(N,K),a=(a=Math.imul(N,tt))+Math.imul(B,K)|0,i=Math.imul(B,tt),n=n+Math.imul(P,rt)|0,a=(a=a+Math.imul(P,nt)|0)+Math.imul(F,rt)|0,i=i+Math.imul(F,nt)|0,n=n+Math.imul(D,it)|0,a=(a=a+Math.imul(D,ot)|0)+Math.imul(R,it)|0,i=i+Math.imul(R,ot)|0,n=n+Math.imul(C,lt)|0,a=(a=a+Math.imul(C,ut)|0)+Math.imul(L,lt)|0,i=i+Math.imul(L,ut)|0,n=n+Math.imul(M,ft)|0,a=(a=a+Math.imul(M,dt)|0)+Math.imul(E,ft)|0,i=i+Math.imul(E,dt)|0;var Ct=(u+(n=n+Math.imul(A,pt)|0)|0)+((8191&(a=(a=a+Math.imul(A,gt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((i=i+Math.imul(T,gt)|0)+(a>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(N,rt),a=(a=Math.imul(N,nt))+Math.imul(B,rt)|0,i=Math.imul(B,nt),n=n+Math.imul(P,it)|0,a=(a=a+Math.imul(P,ot)|0)+Math.imul(F,it)|0,i=i+Math.imul(F,ot)|0,n=n+Math.imul(D,lt)|0,a=(a=a+Math.imul(D,ut)|0)+Math.imul(R,lt)|0,i=i+Math.imul(R,ut)|0,n=n+Math.imul(C,ft)|0,a=(a=a+Math.imul(C,dt)|0)+Math.imul(L,ft)|0,i=i+Math.imul(L,dt)|0;var Lt=(u+(n=n+Math.imul(M,pt)|0)|0)+((8191&(a=(a=a+Math.imul(M,gt)|0)+Math.imul(E,pt)|0))<<13)|0;u=((i=i+Math.imul(E,gt)|0)+(a>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(N,it),a=(a=Math.imul(N,ot))+Math.imul(B,it)|0,i=Math.imul(B,ot),n=n+Math.imul(P,lt)|0,a=(a=a+Math.imul(P,ut)|0)+Math.imul(F,lt)|0,i=i+Math.imul(F,ut)|0,n=n+Math.imul(D,ft)|0,a=(a=a+Math.imul(D,dt)|0)+Math.imul(R,ft)|0,i=i+Math.imul(R,dt)|0;var Ot=(u+(n=n+Math.imul(C,pt)|0)|0)+((8191&(a=(a=a+Math.imul(C,gt)|0)+Math.imul(L,pt)|0))<<13)|0;u=((i=i+Math.imul(L,gt)|0)+(a>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(N,lt),a=(a=Math.imul(N,ut))+Math.imul(B,lt)|0,i=Math.imul(B,ut),n=n+Math.imul(P,ft)|0,a=(a=a+Math.imul(P,dt)|0)+Math.imul(F,ft)|0,i=i+Math.imul(F,dt)|0;var Dt=(u+(n=n+Math.imul(D,pt)|0)|0)+((8191&(a=(a=a+Math.imul(D,gt)|0)+Math.imul(R,pt)|0))<<13)|0;u=((i=i+Math.imul(R,gt)|0)+(a>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(N,ft),a=(a=Math.imul(N,dt))+Math.imul(B,ft)|0,i=Math.imul(B,dt);var Rt=(u+(n=n+Math.imul(P,pt)|0)|0)+((8191&(a=(a=a+Math.imul(P,gt)|0)+Math.imul(F,pt)|0))<<13)|0;u=((i=i+Math.imul(F,gt)|0)+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863;var It=(u+(n=Math.imul(N,pt))|0)+((8191&(a=(a=Math.imul(N,gt))+Math.imul(B,pt)|0))<<13)|0;return u=((i=Math.imul(B,gt))+(a>>>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]=At,l[8]=Tt,l[9]=kt,l[10]=Mt,l[11]=Et,l[12]=St,l[13]=Ct,l[14]=Lt,l[15]=Ot,l[16]=Dt,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||(h=d),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?h(this,t,e):r<63?d(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,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=s,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*e;o>=26,e+=a/67108864|0,e+=i>>>26,this.words[r]=67108863&i}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>a}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,r=t%26,a=(t-r)/26,i=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!==a){for(e=this.length-1;e>=0;e--)this.words[e+a]=this.words[e];for(e=0;e=0),a=e?(e-e%26)/26:0;var i=t%26,o=Math.min((t-i)/26,this.length),s=67108863^67108863>>>i<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=a);u--){var f=0|this.words[u];this.words[u]=c<<26-i|f>>>i,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,a=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 a=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},i.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[a+r]=67108863&i}for(;a>26,this.words[a+r]=67108863&i;if(0===s)return this.strip();for(n(-1===s),s=0,a=0;a>26,this.words[a]=67108863&i;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),a=t,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,l=n.length-a.length;if("mod"!==e){(s=new i(null)).length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[a.length+f])+(0|n.words[a.length+f-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(a,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(a,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(a=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:a,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(a=s.div.neg()),{div:a,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 i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var a,o,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.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),a=t.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,a=this.length-1;a>=0;a--)r=(e*r+(0|this.words[a]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*e;this.words[r]=a/t|0,e=a%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.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 a=new i(1),o=new i(0),s=new i(0),l=new i(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 d=0,h=1;0==(e.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(f)),a.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),a.isub(s),o.isub(l)):(r.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},i.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 a,o=new i(1),s=new i(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,d=1;0==(r.words[0]&d)&&f<26;++f,d<<=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(a=0===e.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(t),a},i.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 a=e.cmp(r);if(a<0){var i=e;e=r,r=i}else if(0===a||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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 a=0|this.words[0];e=a===t?0:at.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|t.words[r];if(n!==a){na&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new w(t)},i.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)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.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 i(e,16),this.n=this.p.bitLength(),this.k=new i(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=i._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 i(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 i(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)},a(y,m),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,a=i}a>>>=22,t.words[n-10]=a,0===a&&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]=a,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._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 i(1)).iushrn(2);return this.pow(t,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,a),d=this.pow(t,a.addn(1).iushrn(1)),h=this.pow(t,a),p=o;0!==h.cmp(s);){for(var g=h,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;a!==r[0]&&(a=this.sqr(a)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}l=26}return a},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},i.mont=function(t){return new A(t)},a(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),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.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:50}],43:[function(t,e,r){"use strict";e.exports=function(t,e,r){switch(arguments.length){case 1:return f(t);case 2:return"function"==typeof e?u(t,t,e,!0):d(t,e);case 3:return u(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}};var n,a=t("typedarray-pool"),i=t("./lib/sweep"),o=t("./lib/intersect");function s(t,e){for(var r=0;r>>1;if(!(c<=0)){var f,d=a.mallocDouble(2*c*s),h=a.mallocInt32(s);if((s=l(t,c,d,h))>0){if(1===c&&n)i.init(s),f=i.sweepComplete(c,r,0,s,d,h,0,s,d,h);else{var p=a.mallocDouble(2*c*u),g=a.mallocInt32(u);(u=l(e,c,p,g))>0&&(i.init(s+u),f=1===c?i.sweepBipartite(c,r,0,s,d,h,0,u,p,g):o(c,r,n,s,d,h,u,p,g),a.free(p),a.free(g))}a.free(d),a.free(h)}return f}}}function c(t,e){n.push([t,e])}function f(t){return n=[],u(t,t,c,!0),n}function d(t,e){return n=[],u(t,e,c,!1),n}},{"./lib/intersect":45,"./lib/sweep":49,"typedarray-pool":338}],44:[function(t,e,r){"use strict";var n=["d","ax","vv","rs","re","rb","ri","bs","be","bb","bi"];function a(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],a=n.slice();t||a.splice(3,0,"fp");var i=["function "+e+"("+a.join()+"){"];function o(e,a){var o=function(t,e,r){var a="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",a,"(",n.join(),"){","var ","es","=2*","d",";"],o="for(var i=rs,rp=es*rs;ibe-bs){"),t?(o(!0,!1),i.push("}else{"),o(!1,!1)):(i.push("if(fp){"),o(!0,!0),i.push("}else{"),o(!0,!1),i.push("}}else{if(fp){"),o(!1,!0),i.push("}else{"),o(!1,!1),i.push("}")),i.push("}}return "+e);var s=r.join("")+i.join("");return new Function(s)()}r.partial=a(!1),r.full=a(!0)},{}],45:[function(t,e,r){"use strict";e.exports=function(t,e,r,i,c,w,A,T,k){!function(t,e){var r=8*a.log2(e+1)*(t+1)|0,i=a.nextPow2(6*r);m.length0;){var C=6*(E-=1),L=m[C],O=m[C+1],D=m[C+2],R=m[C+3],I=m[C+4],P=m[C+5],F=2*E,z=y[F],N=y[F+1],B=1&P,j=!!(16&P),U=c,V=w,H=T,G=k;if(B&&(U=T,V=k,H=c,G=w),!(2&P&&(D=h(t,L,O,D,U,V,N),O>=D)||4&P&&(O=p(t,L,O,D,U,V,z))>=D)){var q=D-O,X=I-R;if(j){if(t*q*(q+X)<1<<22){if(void 0!==(M=l.scanComplete(t,L,e,O,D,U,V,R,I,H,G)))return M;continue}}else{if(t*Math.min(q,X)<128){if(void 0!==(M=o(t,L,e,B,O,D,U,V,R,I,H,G)))return M;continue}if(t*q*X<1<<22){if(void 0!==(M=l.scanBipartite(t,L,e,B,O,D,U,V,R,I,H,G)))return M;continue}}var W=f(t,L,O,D,U,V,z,N);if(O=p0)&&!(p1>=hi)",["p0","p1"]),d=c("lo===p0",["p0"]),h=c("lo>>1,f=2*t,d=c,h=o[f*c+e];for(;l=y?(d=m,h=y):v>=x?(d=g,h=v):(d=b,h=x):y>=x?(d=m,h=y):x>=v?(d=g,h=v):(d=b,h=x);for(var _=f*(u-1),w=f*d,A=0;Ar&&a[f+e]>u;--c,f-=o){for(var d=f,h=f+o,p=0;p=0&&n.push("lo=e[k+n]");t.indexOf("hi")>=0&&n.push("hi=e[k+o]");return r.push("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".replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}},{}],48:[function(t,e,r){"use strict";e.exports=function(t,e){e<=128?n(0,e-1,t):function t(e,r,c){var f=(r-e+1)/6|0,d=e+f,h=r-f,p=e+r>>1,g=p-f,v=p+f,m=d,y=g,b=p,x=v,_=h,w=e+1,A=r-1,T=0;l(m,y,c)&&(T=m,m=y,y=T);l(x,_,c)&&(T=x,x=_,_=T);l(m,b,c)&&(T=m,m=b,b=T);l(y,b,c)&&(T=y,y=b,b=T);l(m,x,c)&&(T=m,m=x,x=T);l(b,x,c)&&(T=b,b=x,x=T);l(y,_,c)&&(T=y,y=_,_=T);l(y,b,c)&&(T=y,y=b,b=T);l(x,_,c)&&(T=x,x=_,_=T);for(var k=c[2*y],M=c[2*y+1],E=c[2*x],S=c[2*x+1],C=2*m,L=2*b,O=2*_,D=2*d,R=2*p,I=2*h,P=0;P<2;++P){var F=c[C+P],z=c[L+P],N=c[O+P];c[D+P]=F,c[R+P]=z,c[I+P]=N}i(g,e,c),i(v,r,c);for(var B=w;B<=A;++B)if(u(B,k,M,c))B!==w&&a(B,w,c),++w;else if(!u(B,E,S,c))for(;;){if(u(A,E,S,c)){u(A,k,M,c)?(o(B,w,A,c),++w,--A):(a(B,A,c),--A);break}if(--At;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function u(t,e,r,n){var a=n[t*=2];return a>>1;i(d,M);var E=0,S=0;for(w=0;w=1<<28)h(l,u,S--,C=C-(1<<28)|0);else if(C>=0)h(o,s,E--,C);else if(C<=-(1<<28)){C=-C-(1<<28)|0;for(var L=0;L>>1;i(d,S);var C=0,L=0,O=0;for(T=0;T>1==d[2*T+3]>>1&&(R=2,T+=1),D<0){for(var I=-(D>>1)-1,P=0;P>1)-1;0===R?h(o,s,C--,I):1===R?h(l,u,L--,I):2===R&&h(c,f,O--,I)}}},scanBipartite:function(t,e,r,n,a,l,u,c,f,g,v,m){var y=0,b=2*t,x=e,_=e+t,w=1,A=1;n?A=1<<28:w=1<<28;for(var T=a;T>>1;i(d,S);var C=0;for(T=0;T=1<<28?(O=!n,k-=1<<28):(O=!!n,k-=1),O)p(o,s,C++,k);else{var D=m[k],R=b*k,I=v[R+e+1],P=v[R+e+1+t];t:for(var F=0;F>>1;i(d,w);var A=0;for(y=0;y=1<<28)o[A++]=b-(1<<28);else{var k=h[b-=1],M=g*b,E=f[M+e+1],S=f[M+e+1+t];t:for(var C=0;C=0;--C)if(o[C]===b){for(R=C+1;R0&&o.length>a&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},a=d.bind(n);return a.listener=r,n.wrapFn=a,a}function p(t,e,r){var n=t._events;if(void 0===n)return[];var a=n[e];return void 0===a?[]:"function"==typeof a?r?[a.listener||a]:[a]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=a[t];if(void 0===l)return!1;if("function"==typeof l)i(l,this,e);else{var u=l.length,c=v(l,u);for(r=0;r=0;i--)if(r[i]===e||r[i].listener===e){o=r[i].listener,a=i;break}if(a<0)return this;0===a?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],52:[function(t,e,r){(function(e){(function(){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -"use strict";var n=t("base64-js"),a=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(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 l(t)}return o(t,e,r)}function o(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|f(t,r),a=i(n),o=a.write(t,r);o!==n&&(a=a.slice(0,o));return a}(t,r);if(ArrayBuffer.isView(t))return u(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(N(t,ArrayBuffer)||t&&N(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||N(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 n=t.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return P(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(i)return a?-1:P(t).length;r=(""+r).toLowerCase(),i=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 M(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return w(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function p(t,r,n,a,i){if(0===t.length)return-1;if("string"==typeof n?(a=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),B(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof r&&(r=e.from(r,a)),e.isBuffer(r))return 0===r.length?-1:g(t,r,n,a,i);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):g(t,[r],n,a,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,a){var i,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(a){var c=-1;for(i=r;is&&(r=s-l),i=r;i>=0;i--){for(var f=!0,h=0;ha&&(n=a):n=a;var i=e.length;n>i/2&&(n=i/2);for(var o=0;o>8,a=r%256,i.push(a),i.push(n);return i}(e,t.length-r),t,r,n)}function w(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=[],a=e;a239?4:u>223?3:u>191?2:1;if(a+f<=r)switch(f){case 1:u<128&&(c=u);break;case 2:128==(192&(i=t[a+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=t[a+1],o=t[a+2],128==(192&i)&&128==(192&o)&&(l=(15&u)<<12|(63&i)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=t[a+1],o=t[a+2],s=t[a+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<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),a+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,a,i){if(N(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===a&&(a=0),void 0===i&&(i=this.length),r<0||n>t.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&r>=n)return 0;if(a>=i)return-1;if(r>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(a>>>=0),s=(n>>>=0)-(r>>>=0),l=Math.min(o,s),u=this.slice(a,i),c=t.slice(r,n),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-e;if((void 0===r||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;an)&&(r=n);for(var a="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function C(t,r,n,a,i,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||rt.length)throw new RangeError("Index out of range")}function L(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,4),a.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),a.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],a=1,i=0;++i>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t+--e],a=1;e>0&&(a*=256);)n+=this[t+--e]*a;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],a=1,i=0;++i=(a*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=e,a=1,i=this[t+--n];n>0&&(a*=256);)i+=this[t+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*e)),i},e.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),a.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),a.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),a.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),a.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=r-1,i=1;for(this[e+a]=255&t;--a>=0&&(i*=256);)this[e+a]=t/i&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,a){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),a||0===a||(a=this.length),r>=t.length&&(r=t.length),r||(r=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,a),r);return i},e.prototype.fill=function(t,r,n,a){if("string"==typeof t){if("string"==typeof r?(a=r,r=0,n=this.length):"string"==typeof n&&(a=n,n=this.length),void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("string"==typeof a&&!e.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(1===t.length){var i=t.charCodeAt(0);("utf8"===a&&i<128||"latin1"===a)&&(t=i)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var a=0;a=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function N(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function B(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":22,buffer:52,ieee754:205}],53:[function(t,e,r){"use strict";var n=t("./lib/monotone"),a=t("./lib/triangulation"),i=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=a(t.length,function(t){return t.map(s).sort(l)}(e)),v=0;v0;){for(var d=r.pop(),p=(s=r.pop(),c=-1,f=-1,l=o[s],1);p=0||(e.flip(s,d),a(t,e,r,c,s,f),a(t,e,r,s,f,c),a(t,e,r,f,d,c),a(t,e,r,d,c,f)))}}},{"binary-search-bounds":39,"robust-in-sphere":262}],55:[function(t,e,r){"use strict";var n,a=t("binary-search-bounds");function i(t,e,r,n,a,i,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=a,this.next=i,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,a=0;a0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-a){u[d]=a;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]=a))}}}var v=l;l=s,s=v,l.length=0,a=-a}var m=function(t,e,r){for(var n=0,a=0;a1&&a(r[h[d-2]],r[h[d-1]],i)>0;)t.push([h[d-1],h[d-2],o]),d-=1;h.length=d,h.push(o);var p=f.upperIds;for(d=p.length;d>1&&a(r[p[d-2]],r[p[d-1]],i)<0;)t.push([p[d-2],p[d-1],o]),d-=1;p.length=d,p.push(o)}}function c(t,e){var r;return(r=t.a[0]p[0]&&a.push(new o(p,d,2,l),new o(d,p,1,l))}a.sort(s);for(var g=a[0].a[0]-(1+Math.abs(a[0].a[0]))*Math.pow(2,-52),v=[new i([g,1],[g,0],-1,[],[],[],[])],m=[],y=(l=0,a.length);l=0}}(),i.removeTriangle=function(t,e,r){var n=this.stars;o(n[t],e,r),o(n[e],r,t),o(n[r],t,e)},i.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},i.opposite=function(t,e){for(var r=this.stars[e],n=1,a=r.length;nr?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 a=new Array(e.length),i=0;ie[2]?1:0)}function m(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--i){var b=e[c=(E=n[i])[0]],x=b[0],_=b[1],w=t[x],A=t[_];if((w[0]-A[0]||w[1]-A[1])<0){var T=x;x=_,_=T}b[0]=x;var k,M=b[1]=E[1];for(a&&(k=b[2]);i>0&&n[i-1][0]===c;){var E,S=(E=n[--i])[1];a?e.push([M,S,k]):e.push([M,S]),M=S}a?e.push([M,_,k]):e.push([M,_])}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":26,"big-rat/cmp":24,"big-rat/to-float":38,"box-intersect":43,nextafter:225,"rat-vec":253,"robust-segment-intersect":266,"union-find":303}],60:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=s(e,t),f=s(n,r),h=c(i,f);if(0===o(h))return null;var d=s(t,r),p=c(f,d),g=a(p,h),v=u(i,g);return l(t,v)};var n=t("big-rat/mul"),a=t("big-rat/div"),i=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 i(n(t[0],e[1]),n(t[1],e[0]))}},{"big-rat/div":25,"big-rat/mul":35,"big-rat/sign":36,"big-rat/sub":37,"rat-vec/add":252,"rat-vec/muls":254,"rat-vec/sub":255}],61:[function(t,e,r){"use strict";var n=t("clamp");function a(t,e){null==e&&(e=!0);var r=t[0],a=t[1],i=t[2],o=t[3];return null==o&&(o=e?1:255),e&&(r*=255,a*=255,i*=255,o*=255),16777216*(r=255&n(r,0,255))+((a=255&n(a,0,255))<<16)+((i=255&n(i,0,255))<<8)+(o=255&n(o,0,255))}e.exports=a,e.exports.to=a,e.exports.from=function(t,e){var r=(t=+t)>>>24,n=(16711680&t)>>>16,a=(65280&t)>>>8,i=255&t;return!1===e?[r,n,a,i]:[r/255,n/255,a/255,i/255]}},{clamp:58}],62:[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]}},{}],63:[function(t,e,r){"use strict";var n=t("color-rgba"),a=t("clamp"),i=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(i(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]=a(Math.floor(255*t[0]),0,255),r[1]=a(Math.floor(255*t[1]),0,255),r[2]=a(Math.floor(255*t[2]),0,255),r[3]=null==t[3]?255:a(Math.floor(255*t[3]),0,255)),r)}},{clamp:58,"color-rgba":65,dtype:91}],64:[function(t,e,r){(function(r){"use strict";var n=t("color-name"),a=t("is-plain-obj"),i=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=(d=t.slice(1)).length;u=1,c<=4?(l=[parseInt(d[0]+d[0],16),parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16)],4===c&&(u=parseInt(d[3]+d[3],16)/255)):(l=[parseInt(d[0]+d[1],16),parseInt(d[2]+d[3],16),parseInt(d[4]+d[5],16)],8===c&&(u=parseInt(d[6]+d[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 f=e[1],h="rgb"===f,d=f.replace(/a$/,"");s=d;c="cmyk"===d?4:"gray"===d?1:3;l=e[2].trim().split(/\s*,\s*/).map((function(t,e){if(/%$/.test(t))return e===c?parseFloat(t)/100:"rgb"===d?255*parseFloat(t)/100:parseFloat(t);if("h"===d[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)})),f===d&&l.push(1),u=h||void 0===l[c]?1:l[c],l=l.slice(0,c)}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(a(t)){var p=i(t.r,t.red,t.R,null);null!==p?(s="rgb",l=[p,i(t.g,t.green,t.G),i(t.b,t.blue,t.B)]):(s="hsl",l=[i(t.h,t.hue,t.H),i(t.s,t.saturation,t.S),i(t.l,t.lightness,t.L,t.b,t.brightness)]),u=i(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":62,defined:87,"is-plain-obj":214}],65:[function(t,e,r){"use strict";var n=t("color-parse"),a=t("color-space/hsl"),i=t("clamp");e.exports=function(t){var e,r=n(t);return r.space?((e=Array(3))[0]=i(r.values[0],0,255),e[1]=i(r.values[1],0,255),e[2]=i(r.values[2],0,255),"h"===r.space[0]&&(e=a.rgb(e)),e.push(i(r.alpha,0,1)),e):[]}},{clamp:58,"color-parse":64,"color-space/hsl":66}],66:[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,a,i,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[i=255*l,i,i];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),a=[0,0,0];for(var u=0;u<3;u++)(n=o+1/3*-(u-1))<0?n++:n>1&&n--,i=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[u]=255*i;return a}},n.hsl=function(t){var e,r,n=t[0]/255,a=t[1]/255,i=t[2]/255,o=Math.min(n,a,i),s=Math.max(n,a,i),l=s-o;return s===o?e=0:n===s?e=(a-i)/l:a===s?e=2+(i-n)/l:i===s&&(e=4+(n-a)/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":67}],67:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],68:[function(t,e,r){"use strict";e.exports=function(t,e,r,i){var o=n(e,r,i);if(0===o){var s=a(n(t,e,r)),u=a(n(t,e,i));if(s===u){if(0===s){var c=l(t,e,r),f=l(t,e,i);return c===f?0:c?1:-1}return 0}return 0===u?s>0||l(t,e,i)?-1:1:0===s?u>0||l(t,e,r)?1:-1:a(u-s)}var h=n(t,e,r);return h>0?o>0&&n(t,e,i)>0?1:-1:h<0?o>0||n(t,e,i)>0?1:-1:n(t,e,i)>0||l(t,e,r)?1:-1};var n=t("robust-orientation"),a=t("signum"),i=t("two-sum"),o=t("robust-product"),s=t("robust-sum");function l(t,e,r){var n=i(t[0],-e[0]),a=i(t[1],-e[1]),l=i(r[0],-e[0]),u=i(r[1],-e[1]),c=s(o(n,l),o(a,u));return c[c.length-1]>=0}},{"robust-orientation":263,"robust-product":264,"robust-sum":268,signum:269,"two-sum":290}],69:[function(t,e,r){e.exports=["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]},{}],70:[function(t,e,r){e.exports=["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]},{}],71:[function(t,e,r){e.exports=["normal","italic","oblique"]},{}],72:[function(t,e,r){e.exports=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},{}],73:[function(t,e,r){"use strict";e.exports={parse:t("./parse"),stringify:t("./stringify")}},{"./parse":75,"./stringify":76}],74:[function(t,e,r){"use strict";var n=t("css-font-size-keywords");e.exports={isSize:function(t){return/^[\d\.]/.test(t)||-1!==t.indexOf("/")||-1!==n.indexOf(t)}}},{"css-font-size-keywords":69}],75:[function(t,e,r){"use strict";var n=t("unquote"),a=t("css-global-keywords"),i=t("css-system-font-keywords"),o=t("css-font-weight-keywords"),s=t("css-font-style-keywords"),l=t("css-font-stretch-keywords"),u=t("string-split-by"),c=t("./lib/util").isSize;e.exports=h;var f=h.cache={};function h(t){if("string"!=typeof t)throw new Error("Font argument must be a string.");if(f[t])return f[t];if(""===t)throw new Error("Cannot parse an empty string.");if(-1!==i.indexOf(t))return f[t]={system:t};for(var e,r={style:"normal",variant:"normal",weight:"normal",stretch:"normal",lineHeight:"normal",size:"1rem",family:["serif"]},h=u(t,/\s+/);e=h.shift();){if(-1!==a.indexOf(e))return["style","variant","weight","stretch"].forEach((function(t){r[t]=e})),f[t]=r;if(-1===s.indexOf(e))if("normal"!==e&&"small-caps"!==e)if(-1===l.indexOf(e)){if(-1===o.indexOf(e)){if(c(e)){var p=u(e,"/");if(r.size=p[0],null!=p[1]?r.lineHeight=d(p[1]):"/"===h[0]&&(h.shift(),r.lineHeight=d(h.shift())),!h.length)throw new Error("Missing required font-family.");return r.family=u(h.join(" "),/\s*,\s*/).map(n),f[t]=r}throw new Error("Unknown or unsupported font token: "+e)}r.weight=e}else r.stretch=e;else r.variant=e;else r.style=e}throw new Error("Missing required font-size.")}function d(t){var e=parseFloat(t);return e.toString()===t?e:t}},{"./lib/util":74,"css-font-stretch-keywords":70,"css-font-style-keywords":71,"css-font-weight-keywords":72,"css-global-keywords":77,"css-system-font-keywords":78,"string-split-by":278,unquote:305}],76:[function(t,e,r){"use strict";var n=t("pick-by-alias"),a=t("./lib/util").isSize,i=g(t("css-global-keywords")),o=g(t("css-system-font-keywords")),s=g(t("css-font-weight-keywords")),l=g(t("css-font-style-keywords")),u=g(t("css-font-stretch-keywords")),c={normal:1,"small-caps":1},f={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1},h="1rem",d="serif";function p(t,e){if(t&&!e[t]&&!i[t])throw Error("Unknown keyword `"+t+"`");return t}function g(t){for(var e={},r=0;r0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){if(e.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(i),ir.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":81}],80:[function(t,e,r){"use strict";var n=t("uniq");function a(t,e,r){var n,a,i=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=i-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 i(t,e,r){for(var n=t.body,a=[],i=[],o=0;o0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,s=new Array(t.arrayArgs.length),l=new Array(t.arrayArgs.length),u=0;u0&&b.push("shape=SS.slice(0)"),t.indexArgs.length>0){var x=new Array(r);for(u=0;u0&&y.push("var "+b.join(",")),u=0;u3&&y.push(i(t.pre,t,l));var T=i(t.body,t,l),k=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&&y.push(i(t.post,t,l)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+y.join("\n")+"\n----------");var M=[t.funcName||"unnamed","_cwise_loop_",s[0].join("s"),"m",k,o(l)].join("");return new Function(["function ",M,"(",m.join(","),"){",y.join("\n"),"} return ",M].join(""))()}},{uniq:304}],81:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],a=t.funcName+"_cwise_thunk";e.push(["return function ",a,"(",t.shimArgs.join(","),"){"].join(""));for(var i=[],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;c=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:vt,s:mt,S:H,u:G,U:q,V:W,w:X,W:Y,x:null,X:null,y:Z,Y:J,Z:Q,"%":gt},Lt={a:function(t){return f[t.getUTCDay()]},A:function(t){return c[t.getUTCDay()]},b:function(t){return yt[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:$,e:$,f:nt,H:K,I:tt,j:et,L:rt,m:at,M:it,p:function(t){return u[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:vt,s:mt,S:ot,u:st,U:lt,V:ut,w:ct,W:ft,x:null,X:null,y:ht,Y:dt,Z:pt,"%":gt},Ot={a:function(t,e,r){var n=At.exec(e.slice(r));return n?(t.w=Tt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=Et.exec(e.slice(r));return n?(t.m=St[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=kt.exec(e.slice(r));return n?(t.m=Mt[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return It(t,i,e,r)},d:k,e:k,f:O,H:E,I:E,j:M,L:L,m:T,M:S,p:function(t,e,r){var n=bt.exec(e.slice(r));return n?(t.p=xt[n[0].toLowerCase()],r+n[0].length):-1},q:A,Q:R,s:I,S:C,u:v,U:m,V:y,w:g,W:b,x:function(t,e,r){return It(t,o,e,r)},X:function(t,e,r){return It(t,l,e,r)},y:_,Y:x,Z:w,"%":D};function Dt(t,e){return function(r){var n,a,i,o=[],l=-1,u=0,c=t.length;for(r instanceof Date||(r=new Date(+r));++l53)return null;"w"in u||(u.w=1),"Z"in u?(l=(s=n(a(u.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(u.V-1)),u.y=s.getUTCFullYear(),u.m=s.getUTCMonth(),u.d=s.getUTCDate()+(u.w+6)%7):(l=(s=r(a(u.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(u.V-1)),u.y=s.getFullYear(),u.m=s.getMonth(),u.d=s.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),l="Z"in u?n(a(u.y,0,1)).getUTCDay():r(a(u.y,0,1)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+7*u.W-(l+5)%7:u.w+7*u.U-(l+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,n(u)):r(u)}}function It(t,e,r,n){for(var a,i,o=0,l=e.length,u=r.length;o=u)return-1;if(37===(a=e.charCodeAt(o++))){if(a=e.charAt(o++),!(i=Ot[a in s?e.charAt(o++):a])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ct.x=Dt(o,Ct),Ct.X=Dt(l,Ct),Ct.c=Dt(i,Ct),Lt.x=Dt(o,Lt),Lt.X=Dt(l,Lt),Lt.c=Dt(i,Lt),{format:function(t){var e=Dt(t+="",Ct);return e.toString=function(){return t},e},parse:function(t){var e=Rt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=Dt(t+="",Lt);return e.toString=function(){return t},e},utcParse:function(t){var e=Rt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,u=/^%/,c=/[\\^$*+?|[\]().{}]/g;function f(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function O(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function D(t,e,r){var n=u.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function R(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function I(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function P(t,e){return f(t.getDate(),e,2)}function F(t,e){return f(t.getHours(),e,2)}function z(t,e){return f(t.getHours()%12||12,e,2)}function N(t,r){return f(1+e.timeDay.count(e.timeYear(t),t),r,3)}function B(t,e){return f(t.getMilliseconds(),e,3)}function j(t,e){return B(t,e)+"000"}function U(t,e){return f(t.getMonth()+1,e,2)}function V(t,e){return f(t.getMinutes(),e,2)}function H(t,e){return f(t.getSeconds(),e,2)}function G(t){var e=t.getDay();return 0===e?7:e}function q(t,r){return f(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function W(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function X(t){return t.getDay()}function Y(t,r){return f(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function Z(t,e){return f(t.getFullYear()%100,e,2)}function J(t,e){return f(t.getFullYear()%1e4,e,4)}function Q(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+f(e/60|0,"0",2)+f(e%60,"0",2)}function $(t,e){return f(t.getUTCDate(),e,2)}function K(t,e){return f(t.getUTCHours(),e,2)}function tt(t,e){return f(t.getUTCHours()%12||12,e,2)}function et(t,r){return f(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return f(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function at(t,e){return f(t.getUTCMonth()+1,e,2)}function it(t,e){return f(t.getUTCMinutes(),e,2)}function ot(t,e){return f(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,r){return f(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ut(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ct(t){return t.getUTCDay()}function ft(t,r){return f(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function ht(t,e){return f(t.getUTCFullYear()%100,e,2)}function dt(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function pt(){return"+0000"}function gt(){return"%"}function vt(t){return+t}function mt(t){return Math.floor(+t/1e3)}function yt(e){return o=i(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var bt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var xt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=bt,t.isoParse=xt,t.timeFormatDefaultLocale=yt,t.timeFormatLocale=i,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":85}],85:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,a,i,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),a(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e0))return o;do{o.push(i=new Date(+e)),a(e,n),t(e)}while(i=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;a(t,-1),!e(t););else for(;--r>=0;)for(;a(t,1),!e(t););}))},i&&(s.count=function(n,a){return e.setTime(+n),r.setTime(+a),t(e),t(r),Math.floor(i(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var a=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));a.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):a:null};var i=a.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),u=l.range,c=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),f=c.range,h=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),d=h.range;function p(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var g=p(0),v=p(1),m=p(2),y=p(3),b=p(4),x=p(5),_=p(6),w=g.range,A=v.range,T=m.range,k=y.range,M=b.range,E=x.range,S=_.range,C=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),L=C.range,O=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));O.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var D=O.range,R=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),I=R.range,P=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),F=P.range,z=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),N=z.range;function B(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var j=B(0),U=B(1),V=B(2),H=B(3),G=B(4),q=B(5),W=B(6),X=j.range,Y=U.range,Z=V.range,J=H.range,Q=G.range,$=q.range,K=W.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=h,t.timeDays=d,t.timeFriday=x,t.timeFridays=E,t.timeHour=c,t.timeHours=f,t.timeInterval=n,t.timeMillisecond=a,t.timeMilliseconds=i,t.timeMinute=l,t.timeMinutes=u,t.timeMonday=v,t.timeMondays=A,t.timeMonth=C,t.timeMonths=L,t.timeSaturday=_,t.timeSaturdays=S,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=g,t.timeSundays=w,t.timeThursday=b,t.timeThursdays=M,t.timeTuesday=m,t.timeTuesdays=T,t.timeWednesday=y,t.timeWednesdays=k,t.timeWeek=g,t.timeWeeks=w,t.timeYear=O,t.timeYears=D,t.utcDay=z,t.utcDays=N,t.utcFriday=q,t.utcFridays=$,t.utcHour=P,t.utcHours=F,t.utcMillisecond=a,t.utcMilliseconds=i,t.utcMinute=R,t.utcMinutes=I,t.utcMonday=U,t.utcMondays=Y,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=W,t.utcSaturdays=K,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=j,t.utcSundays=X,t.utcThursday=G,t.utcThursdays=Q,t.utcTuesday=V,t.utcTuesdays=Z,t.utcWednesday=H,t.utcWednesdays=J,t.utcWeek=j,t.utcWeeks=X,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],86:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},a=this.document;function i(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,u=s.setAttributeNS,c=this.CSSStyleDeclaration.prototype,f=c.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){u.call(this,t,e,r+"")},c.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function h(t,e){return te?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,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+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,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},t.max=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},t.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)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){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+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],a=new Array(r<0?0:r);e=0;)for(e=(n=t[a]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function b(t){for(var e=1;t*e%1;)e*=10;return e}function x(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){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,a=[],i=b(y(r)),o=-1;if(t*=i,e*=i,(r*=i)<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=a.length)return r?r.call(n,i):e?i.sort(e):i;for(var l,u,c,f,h=-1,d=i.length,p=a[s++],g=new _;++h=a.length)return e;var n=[],o=i[r++];return e.forEach((function(e,a){n.push({key:e,values:t(a,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 a.push(t),n},n.sortKeys=function(t){return i[a.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(j,"\\$&")};var j=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return U(t,W),t}var H=function(t,e){return e.querySelector(t)},G=function(t,e){return e.querySelectorAll(t)},q=function(t,e){var r=t.matches||t[D(t,"matchesSelector")];return(q=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(H=function(t,e){return Sizzle(t,e)[0]||null},G=Sizzle,q=Sizzle.matchesSelector),t.selection=function(){return t.select(a.documentElement)};var W=t.selection.prototype=[];function X(t){return"function"==typeof t?t:function(){return H(t,this)}}function Y(t){return"function"==typeof t?t:function(){return G(t,this)}}W.select=function(t){var e,r,n,a,i=[];t=X(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(Q(r,e[r]));return this}return this.each(Q(e,r))},W.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},W.sort=function(t){t=ut.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=a+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=gt.get(e);function u(){var t=this[i];t&&(this.removeEventListener(e,t,t.$),delete this[i])}return l&&(e=l,s=mt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[i]=t,t.$=a),t._=r}:u:r?I:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}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,a,i,o=[],s=-1,l=this.length;++s0?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 It(t){return t>1?0:t<-1?Mt:Math.acos(t)}function Pt(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Ft(t){return((t=Math.exp(t))+1/t)/2}function zt(t){return(t=Math.sin(t/2))*t}var Nt=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,a=t[0],i=t[1],o=t[2],s=e[0],l=e[1],u=e[2],c=s-a,f=l-i,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 C(t){E(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function L(t){--v||(t({type:"zoomend"}),r=null)}function O(){var e=this,r=_.of(e,arguments),n=0,a=t.select(o(e)).on(y,l).on(b,u),i=A(t.mouse(e)),s=xt(e);function l(){n=1,k(t.mouse(e),i),C(r)}function u(){a.on(y,null).on(b,null),s(n),L(r)}ms.call(e),S(r)}function D(){var e,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,u="touchend"+o,c=[],f=t.select(r),d=xt(r);function p(){var n=t.touches(r);return e=h.k,n.forEach((function(t){t.identifier in a&&(a[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];i=x*x+_*_}}function v(){var o,l,u,c,f=t.touches(r);ms.call(r);for(var h=0,d=f.length;h360?t-=360:t<0&&(t+=360),t<60?n+(a-n)*t/60:t<180?a:t<240?n+(a-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)||e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+e):r+e-r*e),new ne(i(t+120),i(t),i(t-120))}function Wt(e,r,n){return this instanceof Wt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Wt?new Wt(e.h,e.c,e.l):Kt(e instanceof Zt?e.l:(e=ce((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Wt(e,r,n)}Gt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,this.l/t)},Gt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,t*this.l)},Gt.rgb=function(){return qt(this.h,this.s,this.l)},t.hcl=Wt;var Xt=Wt.prototype=new Vt;function Yt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Zt(r,Math.cos(t*=Lt)*e,Math.sin(t)*e)}function Zt(t,e,r){return this instanceof Zt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Zt?new Zt(t.l,t.a,t.b):t instanceof Wt?Yt(t.h,t.c,t.l):ce((t=ne(t)).r,t.g,t.b):new Zt(t,e,r)}Xt.brighter=function(t){return new Wt(this.h,this.c,Math.min(100,this.l+Jt*(arguments.length?t:1)))},Xt.darker=function(t){return new Wt(this.h,this.c,Math.max(0,this.l-Jt*(arguments.length?t:1)))},Xt.rgb=function(){return Yt(this.h,this.c,this.l).rgb()},t.lab=Zt;var Jt=18,Qt=Zt.prototype=new Vt;function $t(t,e,r){var n=(t+16)/116,a=n+e/500,i=n-r/200;return new ne(re(3.2404542*(a=.95047*te(a))-1.5371385*(n=1*te(n))-.4985314*(i=1.08883*te(i))),re(-.969266*a+1.8760108*n+.041556*i),re(.0556434*a-.2040259*n+1.0572252*i))}function Kt(t,e,r){return t>0?new Wt(Math.atan2(r,e)*Ot,Math.sqrt(e*e+r*r),t):new Wt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,qt):new ne(t,e,r)}function ae(t){return new ne(t>>16,t>>8&255,255&t)}function ie(t){return ae(t)+""}Qt.brighter=function(t){return new Zt(Math.min(100,this.l+Jt*(arguments.length?t:1)),this.a,this.b)},Qt.darker=function(t){return new Zt(Math.max(0,this.l-Jt*(arguments.length?t:1)),this.a,this.b)},Qt.rgb=function(){return $t(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(t,e,r){var n,a,i,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(he(a[0]),he(a[1]),he(a[2]))}return(i=de.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,s=240&i,s|=s>>4,l=15&i,l|=l<<4):7===t.length&&(o=(16711680&i)>>16,s=(65280&i)>>8,l=255&i)),e(o,s,l))}function ue(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-i,l=(o+i)/2;return s?(a=l<.5?s/(o+i):s/(2-o-i),n=t==o?(e-r)/s+(e0&&l<1?0:n),new Ht(n,a,l)}function ce(t,e,r){var n=ee((.4124564*(t=fe(t))+.3575761*(e=fe(e))+.1804375*(r=fe(r)))/.95047),a=ee((.2126729*t+.7151522*e+.072175*r)/1);return Zt(116*a-16,500*(n-a),200*(a-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function he(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,a=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=a.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 a=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}})),o.send=function(t,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),u.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),u.setRequestHeader)for(var i in l)u.setRequestHeader(i,l[i]);return null!=r&&u.overrideMimeType&&u.overrideMimeType(r),null!=c&&(u.responseType=c),null!=a&&o.on("error",a).on("load",(function(t){a(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==i?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(i))}de.forEach((function(t,e){de.set(t,ae(e))})),t.functor=pe,t.xhr=ge(L),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function a(t,r,n){arguments.length<3&&(n=r,r=null);var a=ve(t,e,null==r?i:o(r),n);return a.row=function(t){return arguments.length?a.response(null==(r=t)?i:o(t)):r},a}function i(t){return a.parse(t.responseText)}function o(t){return function(e){return a.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 a.parse=function(t,e){var r;return a.parseRows(t,(function(t,n){if(r)return r(t,n-1);var a=new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+"]"})).join(",")+"}");r=e?function(t,r){return e(a(t),r)}:a}))},a.parseRows=function(t,e){var r,a,i={},o={},s=[],l=t.length,u=0,c=0;function f(){if(u>=l)return o;if(a)return a=!1,i;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(xe),xe=setTimeout(Ae,e)),be=0):(be=1,_e(Ae))}function Te(){for(var t=Date.now(),e=me;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function ke(){for(var t,e=me,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Se(e){var r=e.decimal,n=e.thousands,a=e.grouping,i=e.currency,o=a&&n?function(t,e){for(var r=t.length,i=[],o=0,s=a[0],l=0;r>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),i.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=a[o=(o+1)%a.length];return i.reverse().join(n)}:L;return function(e){var n=Ce.exec(e),a=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"===a&&"="===s)&&(c=a="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=i[0],m=i[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=Le.get(p)||Oe;var x=c&&h;return function(e){var n=m;if(y&&e%1)return"";var i=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 T=b?e.lastIndexOf("e"):-1;T<0?(_=e,w=""):(_=e.substring(0,T),w=e.substring(T))}else _=e.substring(0,A),w=r+e.substring(A+1);!c&&h&&(_=o(_,1/0));var k=v.length+_.length+w.length+(x?0:i.length),M=k"===s?M+i+e:"^"===s?M.substring(0,k>>=1)+i+e+M.substring(k):i+(x?e:M+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Me(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)))),Ee[8+n/3]};var Ce=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Le=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,Me(e,r))).toFixed(Math.max(0,Math.min(20,Me(e*(1+1e-15),r))))}});function Oe(t){return t+""}var De=t.time={},Re=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(){Pe.setUTCDate.apply(this._,arguments)},setDay:function(){Pe.setUTCDay.apply(this._,arguments)},setFullYear:function(){Pe.setUTCFullYear.apply(this._,arguments)},setHours:function(){Pe.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Pe.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Pe.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Pe.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Pe.setUTCSeconds.apply(this._,arguments)},setTime:function(){Pe.setTime.apply(this._,arguments)}};var Pe=Date.prototype;function Fe(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=u)return-1;if(37===(a=e.charCodeAt(s++))){if(o=e.charAt(s++),!(i=w[o in Be?e.charAt(s++):o])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}c.utc=function(t){var e=c(t);function r(t){try{var r=new(Re=Ie);return r._=t,e(r)}finally{Re=Date}}return r.parse=function(t){try{Re=Ie;var r=e.parse(t);return r&&r._}finally{Re=Date}},r.toString=e.toString,r},c.multi=c.utc.multi=or;var h=t.map(),d=He(o),p=Ge(o),g=He(s),v=Ge(s),m=He(l),y=Ge(l),b=He(u),x=Ge(u);i.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+De.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 i[+(t.getHours()>=12)]},S:function(t,e){return Ve(t.getSeconds(),e,2)},U:function(t,e){return Ve(De.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ve(De.mondayOfYear(t),e,2)},x:c(n),X:c(a),y:function(t,e){return Ve(t.getFullYear()%100,e,2)},Y:function(t,e){return Ve(t.getFullYear()%1e4,e,4)},Z:ar,"%":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:$e,e:$e,H:tr,I:tr,j:Ke,L:nr,m:Qe,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:We,w:qe,W:Xe,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:Je,"%":ir};return c}De.year=Fe((function(t){return(t=De.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),De.years=De.year.range,De.years.utc=De.year.utc.range,De.day=Fe((function(t){var e=new Re(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),De.days=De.day.range,De.days.utc=De.day.utc.range,De.dayOfYear=function(t){var e=De.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=De[t]=Fe((function(t){return(t=De.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=De.year(t).getDay();return Math.floor((De.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));De[t+"s"]=r.range,De[t+"s"].utc=r.utc.range,De[t+"OfYear"]=function(t){var r=De.year(t).getDay();return Math.floor((De.dayOfYear(t)+(r+e)%7)/7)}})),De.week=De.sunday,De.weeks=De.sunday.range,De.weeks.utc=De.sunday.utc.range,De.weekOfYear=De.sundayOfYear;var Be={"-":"",_:" ",0:"0"},je=/^\s*\d+/,Ue=/^%/;function Ve(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Je(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Qe(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function $e(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Ke(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ar(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,a=y(e)%60;return r+Ve(n,"0",2)+Ve(a,"0",2)}function ir(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;++r=0?1:-1,s=o*i,l=Math.cos(e),u=Math.sin(e),c=a*u,f=n*l+c*Math.cos(s),h=c*o*Math.sin(s);Sr.add(Math.atan2(h,f)),r=t,n=l,a=u}Cr.point=function(o,s){Cr.point=i,r=(t=o)*Lt,n=Math.cos(s=(e=s)*Lt/2+Mt/4),a=Math.sin(s)},Cr.lineEnd=function(){i(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 Dr(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 Pr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Fr(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 zr(t){return[Math.atan2(t[1],t[0]),Pt(t[2])]}function Nr(t,e){return y(t[0]-e[0])Tt?a=90:u<-Tt&&(r=-90),f[0]=e,f[1]=n}};function d(t,i){c.push(f=[e=t,n=t]),ia&&(a=i)}function p(t,o){var s=Or([t*Lt,o*Lt]);if(l){var u=Rr(l,s),c=Rr([u[1],-u[0],0],u);Fr(c),c=zr(c);var f=t-i,h=f>0?1:-1,p=c[0]*Ot*h,g=y(f)>180;if(g^(h*ia&&(a=v);else if(g^(h*i<(p=(p+360)%360-180)&&pa&&(a=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>i?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else d(t,o);l=s,i=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-i;u+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Cr.point(t,e),p(t,e)}function b(){Cr.lineStart()}function x(){m(o,s),Cr.lineEnd(),y(u)>Tt&&(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,a]]}}(),t.geo.centroid=function(e){mr=yr=br=xr=_r=wr=Ar=Tr=kr=Mr=Er=0,t.geo.stream(e,Br);var r=kr,n=Mr,a=Er,i=r*r+n*n+a*a;return i=0;--s)a.point((f=c[s])[0],f[1]);else n(d.x,d.p.x,-1,a);d=d.p}c=(d=d.o).z,p=!p}while(!d.v);a.lineEnd()}}}function Yr(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n=0?1:-1,A=w*_,T=A>Mt,k=p*b;if(Sr.add(Math.atan2(k*w*Math.sin(A),g*x+k*Math.cos(A))),i+=T?_+w*Et:_,T^h>=r^m>=r){var M=Rr(Or(f),Or(t));Fr(M);var E=Rr(a,M);Fr(E);var S=(T^_>=0?-1:1)*Pt(E[2]);(n>S||n===S&&(M[0]||M[1]))&&(o+=T^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(i<-Tt||i0){for(b||(o.polygonStart(),b=!0),o.lineStart();++i1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter(Qr))}return c}}function Qr(t){return t.length>1}function $r(){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]-Ct-Tt:Ct-t[1])-((e=e.x)[0]<0?e[1]-Ct-Tt:Ct-e[1])}var tn=Jr(Wr,(function(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var s=i>0?Mt:-Mt,l=y(i-r);y(l-Mt)0?Ct:-Ct),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(i,n),e=0):a!==s&&l>=Mt&&(y(r-a)Tt?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}(r,n,i,o),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=i,n=o),a=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var a;if(null==t)a=r*Ct,n.point(-Mt,a),n.point(0,a),n.point(Mt,a),n.point(Mt,0),n.point(Mt,-a),n.point(0,-a),n.point(-Mt,-a),n.point(-Mt,0),n.point(-Mt,a);else if(y(t[0]-e[0])>Tt){var i=t[0]0,n=y(e)>Tt;return Jr(a,(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=a(f,h),v=r?g?0:o(f,h):g?o(f+(f<0?Mt:-Mt),h):0;if(!e&&(u=l=g)&&t.lineStart(),g!==l&&(d=i(e,p),(Nr(e,d)||Nr(p,d))&&(p[0]+=Tt,p[1]+=Tt,g=a(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),d=i(p,e),t.point(d[0],d[1])):(d=i(e,p),t.point(d[0],d[1]),t.lineEnd()),e=d;else if(n&&e&&r^g){var m;v&s||!(m=i(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&&Nr(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}}}),Nn(t,6*Lt),r?[0,-t]:[-Mt,t-Mt]);function a(t,r){return Math.cos(t)*Math.cos(r)>e}function i(t,r,n){var a=[1,0,0],i=Rr(Or(t),Or(r)),o=Dr(i,i),s=i[0],l=o-s*s;if(!l)return!n&&t;var u=e*o/l,c=-e*s/l,f=Rr(a,i),h=Pr(a,u);Ir(h,Pr(i,c));var d=f,p=Dr(h,d),g=Dr(d,d),v=p*p-g*(Dr(h,h)-1);if(!(v<0)){var m=Math.sqrt(v),b=Pr(d,(-p-m)/g);if(Ir(b,h),b=zr(b),!n)return b;var x,_=t[0],w=r[0],A=t[1],T=r[1];w<_&&(x=_,_=w,w=x);var k=w-_,M=y(k-Mt)0^b[1]<(y(b[0]-_)Mt^(_<=b[0]&&b[0]<=w)){var E=Pr(d,(-p+m)/g);return Ir(E,h),[b,zr(E)]}}}function o(e,n){var a=r?t:Mt-t,i=0;return e<-a?i|=1:e>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(t,e,r,n){return function(a){var i,o=a.a,s=a.b,l=o.x,u=o.y,c=0,f=1,h=s.x-l,d=s.y-u;if(i=t-l,h||!(i>0)){if(i/=h,h<0){if(i0){if(i>f)return;i>c&&(c=i)}if(i=r-l,h||!(i<0)){if(i/=h,h<0){if(i>f)return;i>c&&(c=i)}else if(h>0){if(i0)){if(i/=d,d<0){if(i0){if(i>f)return;i>c&&(c=i)}if(i=n-u,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>c&&(c=i)}else if(d>0){if(i0&&(a.a={x:l+c*h,y:u+c*d}),f<1&&(a.b={x:l+f*h,y:u+f*d}),a}}}}}}function nn(e,r,n,a){return function(l){var u,c,f,h,d,p,g,v,m,y,b,x=l,_=$r(),w=rn(e,r,n,a),A={point:M,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=M,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],a=0;an&&Rt(u,i,t)>0&&++e:i[1]<=n&&Rt(u,i,t)<0&&--e,u=i;return 0!==e}([e,a]),n=b&&r,i=u.length;(n||i)&&(l.polygonStart(),n&&(l.lineStart(),T(null,null,1,l),l.lineEnd()),i&&Xr(u,o,r,T,l),l.polygonEnd()),u=c=f=null}};function T(t,o,l,u){var c=0,f=0;if(null==t||(c=i(t,l))!==(f=i(o,l))||s(t,o)<0^l>0)do{u.point(0===c||3===c?e:n,c>1?a:r)}while((c=(c+l+4)%4)!==f);else u.point(o[0],o[1])}function k(t,i){return e<=t&&t<=n&&r<=i&&i<=a}function M(t,e){k(t,e)&&l.point(t,e)}function E(t,e){var r=k(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,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 i(t,a){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:a>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=i(t,1),n=i(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=Mt/3,n=Ln(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*Mt/180,r=t[1]*Mt/180):[e/Mt*180,r/Mt*180]},a}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(t,e){var r=Math.sqrt(a-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),i-r*Math.cos(t)]}return o.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/n,Pt((a-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,a,i,o={stream:function(t){return a&&(a.valid=!1),(a=i(t)).valid=!0,a},extent:function(s){return arguments.length?(i=nn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),a&&(a.valid=!1,a=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,a,i=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 i=t[0],o=t[1];return e=null,r(i,o),e||(n(i,o),e)||a(i,o),e}return u.invert=function(t){var e=i.scale(),r=i.translate(),n=(t[0]-r[0])/e,a=(t[1]-r[1])/e;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?s:i).invert(t)},u.stream=function(t){var e=i.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},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?(i.precision(t),o.precision(t),s.precision(t),u):i.precision()},u.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),s.scale(t),u.translate(i.translate())):i.scale()},u.translate=function(t){if(!arguments.length)return i.translate();var e=i.scale(),c=+t[0],f=+t[1];return r=i.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+Tt,f+.12*e+Tt],[c-.214*e-Tt,f+.234*e-Tt]]).stream(l).point,a=s.translate([c-.205*e,f+.212*e]).clipExtent([[c-.214*e+Tt,f+.166*e+Tt],[c-.115*e-Tt,f+.234*e-Tt]]).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 a(t,e){ln+=n*t-r*e,r=t,n=e}dn.point=function(i,o){dn.point=a,t=r=i,e=n=o},dn.lineEnd=function(){a(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=a},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 a(t,n){e.push("M",t,",",n),r.point=i}function i(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 a=r-t,i=n-e,o=Math.sqrt(a*a+i*i);wr+=o*(t+r)/2,Ar+=o*(e+n)/2,Tr+=o,xn(t=r,e=n)}bn.point=function(n,a){bn.point=r,xn(t=n,e=a)}}function wn(){bn.point=xn}function An(){var t,e,r,n;function a(t,e){var a=t-r,i=e-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+t)/2,Ar+=o*(n+e)/2,Tr+=o,kr+=(o=n*t-r*e)*(r+t),Mr+=o*(n+e),Er+=3*o,xn(r=t,n=e)}bn.point=function(i,o){bn.point=a,xn(t=r=i,e=n=o)},bn.lineEnd=function(){a(t,e)}}function Tn(t){var e=4.5,r={point:n,lineStart:function(){r.point=a},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,Et)}function a(e,n){t.moveTo(e,n),r.point=i}function i(e,r){t.lineTo(e,r)}function o(){r.point=n}function s(){t.closePath()}return r}function kn(t){var e=.5,r=Math.cos(30*Lt),n=16;function a(t){return(n?o:i)(t)}function i(e){return Sn(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,a,i,o,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,a){var i=Or([r,a]),o=t(r,a);s(f,h,c,d,p,g,f=o[0],h=o[1],c=r,d=i[0],p=i[1],g=i[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),a=f,i=h,o=d,l=p,u=g,v.point=b}function A(){s(f,h,c,d,p,g,a,i,r,o,l,u,n,e),v.lineEnd=x,x()}return v}function s(n,a,i,o,l,u,c,f,h,d,p,g,v,m){var b=c-n,x=f-a,_=b*b+x*x;if(_>4*e&&v--){var w=o+d,A=l+p,T=u+g,k=Math.sqrt(w*w+A*A+T*T),M=Math.asin(T/=k),E=y(y(T)-1)e||y((b*O+x*D)/_-.5)>.3||o*d+l*p+u*g0&&16,a):Math.sqrt(e)},a}function Mn(t){var e=kn((function(e,r){return t([e*Ot,r*Ot])}));return function(t){return On(e(t))}}function En(t){this.stream=t}function Sn(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 Cn(t){return Ln((function(){return t}))()}function Ln(e){var r,n,a,i,o,s,l=kn((function(t,e){return[(t=r(t,e))[0]*u+i,o-t[1]*u]})),u=150,c=480,f=250,h=0,d=0,p=0,g=0,v=0,m=tn,y=L,b=null,x=null;function _(t){return[(t=a(t[0]*Lt,t[1]*Lt))[0]*u+i,o-t[1]*u]}function w(t){return(t=a.invert((t[0]-i)/u,(o-t[1])/u))&&[t[0]*Ot,t[1]*Ot]}function A(){a=qr(n=In(p,g,v),r);var t=r(h,d);return i=c-t[0]*u,o=f+t[1]*u,T()}function T(){return s&&(s.valid=!1,s=null),_}return _.stream=function(t){return s&&(s.valid=!1),(s=On(m(n,l(y(t))))).valid=!0,s},_.clipAngle=function(t){return arguments.length?(m=null==t?(b=t,tn):en((b=+t)*Lt),T()):b},_.clipExtent=function(t){return arguments.length?(x=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):L,T()):x},_.scale=function(t){return arguments.length?(u=+t,A()):u},_.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],A()):[c,f]},_.center=function(t){return arguments.length?(h=t[0]%360*Lt,d=t[1]%360*Lt,A()):[h*Ot,d*Ot]},_.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*Ot,g*Ot,v*Ot]},t.rebind(_,l,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,A()}}function On(t){return Sn(t,(function(e,r){t.point(e*Lt,r*Lt)}))}function Dn(t,e){return[t,e]}function Rn(t,e){return[t>Mt?t-Et:t<-Mt?t+Et:t,e]}function In(t,e,r){return t?e||r?qr(Fn(t),zn(e,r)):Fn(t):e||r?zn(e,r):Rn}function Pn(t){return function(e,r){return[(e+=t)>Mt?e-Et:e<-Mt?e+Et:e,r]}}function Fn(t){var e=Pn(t);return e.invert=Pn(-t),e}function zn(t,e){var r=Math.cos(t),n=Math.sin(t),a=Math.cos(e),i=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*a-c*i,s*r-u*n),Pt(c*a+l*i)]}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*a-l*i;return[Math.atan2(l*a+u*i,s*r+c*n),Pt(c*r-s*n)]},o}function Nn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,s){var l=o*e;null!=a?(a=Bn(r,a),i=Bn(r,i),(o>0?ai)&&(a+=o*Et)):(a=t+o*Et,i=t-.5*l);for(var u,c=a;o>0?c>i:c2?t[2]*Lt:0),e.invert=function(e){return(e=t.invert(e[0]*Lt,e[1]*Lt))[0]*=Ot,e[1]*=Ot,e},e},Rn.invert=Dn,t.geo.circle=function(){var t,e,r=[0,0],n=6;function a(){var t="function"==typeof r?r.apply(this,arguments):r,n=In(-t[0]*Lt,-t[1]*Lt,0).invert,a=[];return e(null,null,1,{point:function(t,e){a.push(t=n(t,e)),t[0]*=Ot,t[1]*=Ot}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(t){return arguments.length?(r=t,a):r},a.angle=function(r){return arguments.length?(e=Nn((t=+r)*Lt,n*Lt),a):t},a.precision=function(r){return arguments.length?(e=Nn(t*Lt,(n=+r)*Lt),a):n},a.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Lt,a=t[1]*Lt,i=e[1]*Lt,o=Math.sin(n),s=Math.cos(n),l=Math.sin(a),u=Math.cos(a),c=Math.sin(i),f=Math.cos(i);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,a,i,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(a/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)>Tt})).map(u)).concat(t.range(Math.ceil(o/p)*p,i,p).filter((function(t){return y(t%v)>Tt})).map(c))}return b.lines=function(){return x().map((function(t){return{type:"LineString",coordinates:t}}))},b.outline=function(){return{type:"Polygon",coordinates:[f(a).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?(a=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],a>n&&(t=a,a=n,n=t),l>s&&(t=l,l=s,s=t),b.precision(m)):[[a,l],[n,s]]},b.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],i=+t[1][1],r>e&&(t=r,r=e,e=t),o>i&&(t=o,o=i,i=t),b.precision(m)):[[r,o],[e,i]]},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,i,90),c=Un(r,e,m),f=jn(l,s,90),h=Un(a,n,m),b):m},b.majorExtent([[-180,-90+Tt],[180,90-Tt]]).minorExtent([[-180,-80-Tt],[180,80+Tt]])},t.geo.greatArc=function(){var e,r,n=Vn,a=Hn;function i(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,i):n},i.target=function(t){return arguments.length?(a=t,r="function"==typeof t?null:t,i):a},i.precision=function(){return arguments.length?i:0},i},t.geo.interpolate=function(t,e){return r=t[0]*Lt,n=t[1]*Lt,a=e[0]*Lt,i=e[1]*Lt,o=Math.cos(n),s=Math.sin(n),l=Math.cos(i),u=Math.sin(i),c=o*Math.cos(r),f=o*Math.sin(r),h=l*Math.cos(a),d=l*Math.sin(a),p=2*Math.asin(Math.sqrt(zt(i-n)+o*l*zt(a-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,a=r*f+e*d,i=r*s+e*u;return[Math.atan2(a,n)*Ot,Math.atan2(i,Math.sqrt(n*n+a*a))*Ot]}:function(){return[r*Ot,n*Ot]}).distance=p,v;var r,n,a,i,o,s,l,u,c,f,h,d,p,g,v},t.geo.length=function(e){return yn=0,t.geo.stream(e,Gn),yn};var Gn={sphere:I,point:I,lineStart:function(){var t,e,r;function n(n,a){var i=Math.sin(a*=Lt),o=Math.cos(a),s=y((n*=Lt)-t),l=Math.cos(s);yn+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*i-e*o*l)*s),e*i+r*o*l),t=n,e=i,r=o}Gn.point=function(a,i){t=a*Lt,e=Math.sin(i*=Lt),r=Math.cos(i),Gn.point=n},Gn.lineEnd=function(){Gn.point=Gn.lineEnd=I}},lineEnd:I,polygonStart:I,polygonEnd:I};function qn(t,e){function r(e,r){var n=Math.cos(e),a=Math.cos(r),i=t(n*a);return[i*a*Math.sin(e),i*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),a=e(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(t*i,n*o),Math.asin(n&&r*i/n)]},r}var Wn=qn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Cn(Wn)}).raw=Wn;var Xn=qn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),L);function Yn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(Mt/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),i=r*Math.pow(n(t),a)/a;if(!a)return Qn;function o(t,e){i>0?e<-Ct+Tt&&(e=-Ct+Tt):e>Ct-Tt&&(e=Ct-Tt);var r=i/Math.pow(n(e),a);return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}return o.invert=function(t,e){var r=i-e,n=Dt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ct]},o}function Zn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/n+t;if(y(n)1&&Rt(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Cn(ta)}).raw=ta,ea.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=$n(ea),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=ea,t.geom={},t.geom.hull=function(t){var e=ra,r=na;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,a=pe(e),i=pe(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)d.push(t[s[u[n]][2]]);for(n=+f;nTt)s=s.L;else{if(!((a=i-Aa(s,o))>Tt)){n>-Tt?(e=s.P,r=s):a>-Tt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=ya(t);if(ha.insert(e,l),e||r){if(e===r)return Sa(e),r=ya(e.site),ha.insert(l,r),l.edge=r.edge=Oa(e.site,l.site),Ea(e),void Ea(r);if(r){Sa(e),Sa(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};Ra(r.edge,u,p,x),l.edge=Oa(u,t,null,x),r.edge=Oa(t,p,null,x),Ea(e),Ea(r)}else l.edge=Oa(e.site,l.site)}}function wa(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)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/i-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+a-i/2)))/f+n:(n+s)/2}function Aa(t,e){var r=t.N;if(r)return wa(r,e);var n=t.site;return n.y===e?n.x:1/0}function Ta(t){this.site=t,this.edges=[]}function ka(t,e){return e.angle-t.angle}function Ma(){Fa(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ea(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,a=t.site,i=r.site;if(n!==i){var o=a.x,s=a.y,l=n.x-o,u=n.y-s,c=i.x-o,f=2*(l*(v=i.y-s)-u*c);if(!(f>=-kt)){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=va.pop()||new Ma;m.arc=t,m.site=a,m.x=p+o,m.y=v+Math.sqrt(p*p+g*g),m.cy=v,t.circle=m;for(var y=null,b=pa._;b;)if(m.y=s)return;if(h>p){if(i){if(i.y>=u)return}else i={x:v,y:l};r={x:v,y:u}}else{if(i){if(i.y1)if(h>p){if(i){if(i.y>=u)return}else i={x:(l-a)/n,y:l};r={x:(u-a)/n,y:u}}else{if(i){if(i.y=s)return}else i={x:o,y:n*o+a};r={x:s,y:n*s+a}}else{if(i){if(i.xTt||y(a-r)>Tt)&&(s.splice(o,0,new Ia(Da(i.site,c,y(n-f)Tt?{x:f,y:y(e-f)Tt?{x:y(r-p)Tt?{x:h,y:y(e-h)Tt?{x:y(r-d)=r&&u.x<=a&&u.y>=n&&u.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=t[s]})),e}function s(t){return t.map((function(t,e){return{x:Math.round(n(t,e)/Tt)*Tt,y:Math.round(a(t,e)/Tt)*Tt,i:e}}))}return o.links=function(t){return ja(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 ja(s(t)).cells.forEach((function(r,n){for(var a,i,o,s,l=r.site,u=r.edges.sort(ka),c=-1,f=u.length,h=u[f-1].edge,d=h.l===l?h.r:h.l;++ci||f>o||h=_)<<1|e>=x,A=w+4;wi&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:Za(r,n)})),i=$a.lastIndex;return ig&&(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 T(t,e,r,n,a,i,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)k(t,e,r,n,a,i,o,s);else{var c=t.point;t.x=t.y=t.point=null,k(t,c,l,u,a,i,o,s),k(t,e,r,n,a,i,o,s)}else t.x=r,t.y=n,t.point=e}else k(t,e,r,n,a,i,o,s)}function k(t,e,r,n,a,i,o,s){var l=.5*(a+o),u=.5*(i+s),c=r>=l,f=n>=u,h=f<<1|c;t.leaf=!1,c?a=l:o=l,f?i=u:s=u,T(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,a,i,o,s)}w>A?v=p+w:g=d+A;var M={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){T(M,t,+m(t,++f),+b(t,f),d,p,g,v)},visit:function(t){qa(t,M,d,p,g,v)},find:function(t){return Wa(M,t[0],t[1],d,p,g,v)}};if(f=-1,null==e){for(;++f=0&&!(n=t.interpolators[a](e,r)););return n}function ti(t,e){var r,n=[],a=[],i=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function ii(t){return function(e){return 1-t(1-e)}}function oi(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function si(t){return t*t}function li(t){return t*t*t}function ui(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ci(t){return 1-Math.cos(t*Ct)}function fi(t){return Math.pow(2,10*(t-1))}function hi(t){return 1-Math.sqrt(1-t*t)}function di(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 pi(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function gi(t){var e,r,n,a=[t.a,t.b],i=[t.c,t.d],o=mi(a),s=vi(a,i),l=mi(((e=i)[0]+=(n=-s)*(r=a)[0],e[1]+=n*r[1],e))||0;a[0]*i[1]=0?t.slice(0,e):t,a=e>=0?t.slice(e+1):"in";return n=ri.get(n)||ei,ai((a=ni.get(a)||L)(n.apply(null,r.call(arguments,1))))},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,a=e.c,i=e.l,o=r.h-n,s=r.c-a,l=r.l-i;isNaN(s)&&(s=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Yt(n+o*t,a+s*t,i+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,a=e.s,i=e.l,o=r.h-n,s=r.s-a,l=r.l-i;isNaN(s)&&(s=0,a=isNaN(a)?r.s:a);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,a+s*t,i+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,a=e.a,i=e.b,o=r.l-n,s=r.a-a,l=r.b-i;return function(t){return $t(n+o*t,a+s*t,i+l*t)+""}},t.interpolateRound=pi,t.transform=function(e){var r=a.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 gi(e?e.matrix:yi)})(e)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function bi(t){return t.length?t.pop()+",":""}function xi(e,r){var n=[],a=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Za(t[0],e[0])},{i:a-2,x:Za(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,a),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(bi(r)+"rotate(",null,")")-2,x:Za(t,e)})):e&&r.push(bi(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,a),function(t,e,r,n){t!==e?n.push({i:r.push(bi(r)+"skewX(",null,")")-2,x:Za(t,e)}):e&&r.push(bi(r)+"skewX("+e+")")}(e.skew,r.skew,n,a),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(bi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Za(t[0],e[0])},{i:a-2,x:Za(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(bi(r)+"scale("+e+")")}(e.scale,r.scale,n,a),e=r=null,function(t){for(var e,r=-1,i=a.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=we(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(a[n])}function Ii(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(c=u[l]),c.parent=i,c.depth=i.depth+1;r&&(i.value=0),i.children=u}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ii(a,(function(e){var n,a;t&&(n=e.children)&&n.sort(t),r&&(a=e.parent)&&(a.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&&(Ri(t,(function(t){t.children&&(t.value=0)})),Ii(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 a=e.call(this,t,n);return function t(e,r,n,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.length)){var o,s,l,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;ra&&(n=r,a=e);return n}function Yi(t){return t.reduce(Zi,0)}function Zi(t,e){return t+e[1]}function Ji(t,e){return Qi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Qi(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,i=[];++r<=e;)i[r]=a*r+n;return i}function $i(e){return[t.min(e),t.max(e)]}function Ki(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(t,e){var r=e.x-t.x,n=e.y-t.y,a=t.r+e.r;return.999*a*a>r*r+n*n}function no(t){if((e=t.children)&&(l=e.length)){var e,r,n,a,i,o,s,l,u=1/0,c=-1/0,f=1/0,h=-1/0;if(e.forEach(ao),(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(oo(r,n,a=e[2]),b(a),to(r,a),r._pack_prev=a,to(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&l<=f[1]&&((s=u[t.bisect(h,l,1,p)-1]).y+=g,s.push(i[o]));return u}return i.value=function(t){return arguments.length?(r=t,i):r},i.range=function(t){return arguments.length?(n=pe(t),i):n},i.bins=function(t){return arguments.length?(a="number"==typeof t?function(e){return Qi(e,t)}:pe(t),i):a},i.frequency=function(t){return arguments.length?(e=!!t,i):e},i},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(t,i){var o=r.call(this,t,i),s=o[0],l=a[0],u=a[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,Ii(s,(function(t){t.r=+c(t.value)})),Ii(s,no),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;Ii(s,(function(t){t.r+=f})),Ii(s,no),Ii(s,(function(t){t.r-=f}))}return function t(e,r,n,a){var i=e.children;if(e.x=r+=a*e.x,e.y=n+=a*e.y,e.r*=a,i)for(var o=-1,s=i.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);Ri(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,a=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,a=t.children,i=a.length;for(;--i>=0;)(e=a[i]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var i=(e[0].z+e[e.length-1].z)/2;a?(t.z=a.z+r(t._,a._),t.m=t.z-i):t.z=i}else a&&(t.z=a.z+r(t._,a._));t.parent.A=function(t,e,n){if(e){for(var a,i=t,o=t,s=e,l=i.parent.children[0],u=i.m,c=o.m,f=s.m,h=l.m;s=uo(s),i=lo(i),s&&i;)l=lo(l),(o=uo(o)).a=t,(a=s.z+f-i.z-u+r(s._,i._))>0&&(co(fo(s,t,n),t,a),u+=a,c+=a),f+=s.m,u+=i.m,h+=l.m,c+=o.m;s&&!uo(o)&&(o.t=s,o.m+=f-c),i&&!lo(l)&&(l.t=i,l.m+=u-h,n=t)}return n}(t,a,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 i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t)?l:null,i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null==(n=t)?null:l,i):a?n:null},Di(i,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],a=!1;function i(i,o){var s,l=e.call(this,i,o),u=l[0],c=0;Ii(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 Ii(u,a?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 i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t),i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null!=(n=t),i):a?n:null},Di(i,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=ho,s=!1,l="squarify",u=.5*(1+Math.sqrt(5));function c(t,e){for(var r,n,a=-1,i=t.length;++a0;)s.push(r=u[a-1]),s.area+=r.area,"squarify"!==l||(n=d(s,g))<=h?(u.pop(),h=n):(s.area-=s.pop().area,p(s,g,i,!1),g=Math.min(i.dx,i.dy),s.length=s.area=0,h=1/0);s.length&&(p(s,g,i,!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),a=e.slice(),i=[];for(c(a,n.dx*n.dy/t.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(p(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);e.forEach(h)}}function d(t,e){for(var r,n=t.area,a=0,i=1/0,o=-1,s=t.length;++oa&&(a=r));return e*=e,(n*=n)?Math.max(e*a*u/n,n/(e*i*u)):1/0}function p(t,e,r,a){var i,o=-1,s=t.length,l=r.x,u=r.y,c=e?n(t.area/e):0;if(e==r.dx){for((a||c>r.dy)&&(c=r.dy);++or.dx)&&(c=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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?_o:mo,s=a?wi:_i;return i=t(e,r,s,n),o=t(r,e,s,Ka),l}function l(t){return i(t)}return 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(pi)},l.clamp=function(t){return arguments.length?(a=t,s()):a},l.interpolate=function(t){return arguments.length?(n=t,s()):n},l.ticks=function(t){return ko(e,t)},l.tickFormat=function(t,r){return Mo(e,t,r)},l.nice=function(t){return Ao(e,t),s()},l.copy=function(){return t(e,r,n,a)},s()}([0,1],[0,1],Ka,!1)};var Eo={s:1,g:1,p:1,r:1,e:1};function So(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,a,i){function o(t){return(a?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return a?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return r(o(t))}return l.invert=function(t){return s(r.invert(t))},l.domain=function(t){return arguments.length?(a=t[0]>=0,r.domain((i=t.map(Number)).map(o)),l):i},l.base=function(t){return arguments.length?(n=+t,r.domain(i.map(o)),l):n},l.nice=function(){var t=yo(i.map(o),a?Math:Lo);return r.domain(t),i=t.map(s),l},l.ticks=function(){var t=go(i),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(a){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 Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=t.format(r));var a=Math.max(1,n*e/l.ticks().length);return function(t){var e=t/s(Math.round(o(t)));return e*n0?a[t-1]:r[0],tf?0:1;if(u=St)return l(u,d)+(s?l(s,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,A,T,k,M=0,E=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===zo?Math.sqrt(s*s+u*u):+n.apply(this,arguments),d||(E*=-1),u&&(E=Pt(v/u*Math.sin(m))),s&&(M=Pt(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 C=Math.abs(f-c-2*E)<=Mt?0:1;if(E&&Ho(y,b,x,_)===d^C){var L=(c+f)/2;y=u*Math.cos(L),b=u*Math.sin(L),x=_=null}}else y=b=0;if(s){w=s*Math.cos(f-M),A=s*Math.sin(f-M),T=s*Math.cos(c+M),k=s*Math.sin(c+M);var O=Math.abs(c-f+2*M)<=Mt?0:1;if(M&&Ho(w,A,T,k)===1-d^O){var D=(c+f)/2;w=s*Math.cos(D),A=s*Math.sin(D),T=k=null}}else w=A=0;if(h>Tt&&(p=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function Go(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],s=(a?n:-n)/Math.sqrt(i*i+o*o),l=s*o,u=-s*i,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,T=(x*m+v*_)/y,k=(-x*v+m*_)/y,M=w-p,E=A-g,S=T-p,C=k-g;return M*M+E*E>S*S+C*C&&(w=T,A=k),[[w-l,A-u],[w*r/b,A*r/b]]}function qo(t){var e=ra,r=na,n=Wr,a=Xo,i=a.key,o=.7;function s(i){var s,l=[],u=[],c=-1,f=i.length,h=pe(e),d=pe(r);function p(){l.push("M",a(t(u),o))}for(;++c1&&a.push("H",n[0]);return a.join("")},"step-before":Zo,"step-after":Jo,basis:Ko,"basis-open":function(t){if(t.length<4)return Xo(t);var e,r=[],n=-1,a=t.length,i=[0],o=[0];for(;++n<3;)e=t[n],i.push(e[0]),o.push(e[1]);r.push(ts(ns,i)+","+ts(ns,o)),--n;for(;++n9&&(a=3*e/Math.sqrt(a),o[s]=a*r,o[s+1]=a*n));s=-1;for(;++s<=l;)a=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),i.push([a||0,o[s]*a||0]);return i}(t))}});function Xo(t){return t.length>1?t.join("L"):t+"Z"}function Yo(t){return t.join("L")+"Z"}function Zo(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){s=e[1],i=t[l],l++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-s[0])+","+(i[1]-s[1])+","+i[0]+","+i[1];for(var u=2;uMt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return i.radius=function(t){return arguments.length?(r=pe(t),i):r},i.source=function(e){return arguments.length?(t=pe(e),i):t},i.target=function(t){return arguments.length?(e=pe(t),i):e},i.startAngle=function(t){return arguments.length?(n=pe(t),i):n},i.endAngle=function(t){return arguments.length?(a=pe(t),i):a},i},t.svg.diagonal=function(){var t=Vn,e=Hn,r=us;function n(n,a){var i=t.call(this,n,a),o=e.call(this,n,a),s=(i.y+o.y)/2,l=[i,{x:i.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=pe(e),n):t},n.target=function(t){return arguments.length?(e=pe(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=us,n=e.projection;return e.projection=function(t){return arguments.length?n(cs(r=t)):r},e},t.svg.symbol=function(){var t=hs,e=fs;function r(r,n){return(ps.get(t.call(this,r,n))||ds)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=pe(e),r):t},r.size=function(t){return arguments.length?(e=pe(t),r):e},r};var ps=t.map({circle:ds,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*vs)),r=e*vs;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/gs),r=e*gs/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/gs),r=e*gs/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ps.keys();var gs=Math.sqrt(3),vs=Math.tan(30*Lt);W.transition=function(t){for(var e,r,n=xs||++As,a=Ms(t),i=[],o=_s||{time:Date.now(),ease:ui,delay:0,duration:250},s=-1,l=this.length;++s0;)u[--h].call(t,o);if(i>=1)return f.event&&f.event.end.call(t,t.__data__,e),--c.count?delete c[n]:delete t[r],1}f||(i=a.time,o=we((function(t){var e=f.delay;if(o.t=e+i,e<=t)return h(t-e);o.c=h}),0,i),f=c[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++c.count)}ws.call=W.call,ws.empty=W.empty,ws.node=W.node,ws.size=W.size,t.transition=function(e,r){return e&&e.transition?xs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.select=function(t){var e,r,n,a=this.id,i=this.namespace,o=[];t=X(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(_)&&a,A=!/^(e|w)$/.test(_)&&i,T=y.classed("extent"),k=xt(m),M=t.mouse(m),E=t.select(o(m)).on("keydown.brush",L).on("keyup.brush",O);if(t.event.changedTouches?E.on("touchmove.brush",D).on("touchend.brush",I):E.on("mousemove.brush",D).on("mouseup.brush",I),x.interrupt().selectAll("*").interrupt(),T)M[0]=s[0]-M[0],M[1]=l[0]-M[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[s[1-S]-M[0],l[1-C]-M[1]],M[0]=s[S],M[1]=l[C]}else t.event.altKey&&(f=M.slice());function L(){32==t.event.keyCode&&(T||(f=null,M[0]-=s[1],M[1]-=l[1],T=2),z())}function O(){32==t.event.keyCode&&2==T&&(M[0]+=s[1],M[1]+=l[1],T=0,z())}function D(){var e=t.mouse(m),r=!1;v&&(e[0]+=v[0],e[1]+=v[1]),T||(t.event.altKey?(f||(f=[(s[0]+s[1])/2,(l[0]+l[1])/2]),M[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Bs(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Bs(+e+1);return e}}:t))},a.ticks=function(t,e){var r=go(a.domain()),n=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Bs(+r[1]+1),e<1?1:e)},a.tickFormat=function(){return n},a.copy=function(){return Ns(e.copy(),r,n)},wo(a,e)}function Bs(t){return new Date(t)}Is.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?zs:Fs,zs.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},zs.toString=Fs.toString,De.second=Fe((function(t){return new Re(1e3*Math.floor(t/1e3))}),(function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))}),(function(t){return t.getSeconds()})),De.seconds=De.second.range,De.seconds.utc=De.second.utc.range,De.minute=Fe((function(t){return new Re(6e4*Math.floor(t/6e4))}),(function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))}),(function(t){return t.getMinutes()})),De.minutes=De.minute.range,De.minutes.utc=De.minute.utc.range,De.hour=Fe((function(t){var e=t.getTimezoneOffset()/60;return new Re(36e5*(Math.floor(t/36e5-e)+e))}),(function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))}),(function(t){return t.getHours()})),De.hours=De.hour.range,De.hours.utc=De.hour.utc.range,De.month=Fe((function(t){return(t=De.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),De.months=De.month.range,De.months.utc=De.month.utc.range;var js=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[De.second,1],[De.second,5],[De.second,15],[De.second,30],[De.minute,1],[De.minute,5],[De.minute,15],[De.minute,30],[De.hour,1],[De.hour,3],[De.hour,6],[De.hour,12],[De.day,1],[De.day,2],[De.week,1],[De.month,1],[De.month,3],[De.year,1]],Vs=Is.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",Wr]]),Hs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Bs)},floor:L,ceil:L};Us.year=De.year,De.scale=function(){return Ns(t.scale.linear(),Us,Vs)};var Gs=Us.map((function(t){return[t[0].utc,t[1]]})),qs=Ps.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",Wr]]);function Ws(t){return JSON.parse(t.responseText)}function Xs(t){var e=a.createRange();return e.selectNode(a.body),e.createContextualFragment(t.responseText)}Gs.year=De.year.utc,De.scale.utc=function(){return Ns(t.scale.linear(),Gs,qs)},t.text=ge((function(t){return t.responseText})),t.json=function(t,e){return ve(t,"application/json",Ws,e)},t.html=function(t,e){return ve(t,"text/html",Xs,e)},t.xml=ge((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],87:[function(t,e,r){e.exports=function(){for(var t=0;ts*l){var d=(h-f)/s;i[c]=1e3*d}}return i}function o(t){for(var e=[],r=t[0];r<=t[1];r++)for(var n=String.fromCharCode(r),a=t[0];a>>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),a=1048575&n;return 2146435072&n&&(a+=1<<20),[r,a]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:52}],90:[function(t,e,r){var n=t("abs-svg-path"),a=t("normalize-svg-path"),i={M:"moveTo",C:"bezierCurveTo"};e.exports=function(t,e){t.beginPath(),a(n(e)).forEach((function(e){var r=e[0],n=e.slice(1);t[i[r]].apply(t,n)})),t.closePath()}},{"abs-svg-path":12,"normalize-svg-path":226}],91:[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}}},{}],92:[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;n80*r){n=l=t[0],s=u=t[1];for(var x=r;xl&&(l=c),d>u&&(u=d);p=0!==(p=Math.max(l-n,u-s))?1/p:0}return o(y,b,r,n,s,p),b}function a(t,e,r,n,a){var i,o;if(a===S(t,e,r,n)>0)for(i=e;i=e;i-=n)o=k(i,t[i],t[i+1],o);return o&&b(o,o.next)&&(M(o),o=o.next),o}function i(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!b(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(M(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,a,f,h){if(t){!h&&f&&function(t,e,r,n){var a=t;do{null===a.z&&(a.z=p(a.x,a.y,e,r,n)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==t);a.prevZ.nextZ=null,a.prevZ=null,function(t){var e,r,n,a,i,o,s,l,u=1;do{for(r=t,t=null,i=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(a=r,r=r.nextZ,s--):(a=n,n=n.nextZ,l--),i?i.nextZ=a:t=a,a.prevZ=i,i=a;r=n}i.nextZ=null,u*=2}while(o>1)}(a)}(t,n,a,f);for(var d,g,v=t;t.prev!==t.next;)if(d=t.prev,g=t.next,f?l(t,n,a,f):s(t))e.push(d.i/r),e.push(t.i/r),e.push(g.i/r),M(t),t=g.next,v=g.next;else if((t=g)===v){h?1===h?o(t=u(i(t),e,r),e,r,n,a,f,2):2===h&&c(t,e,r,n,a,f):o(i(t),e,r,n,a,f,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(y(e,r,n)>=0)return!1;for(var a=t.next.next;a!==t.prev;){if(v(e.x,e.y,r.x,r.y,n.x,n.y,a.x,a.y)&&y(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function l(t,e,r,n){var a=t.prev,i=t,o=t.next;if(y(a,i,o)>=0)return!1;for(var s=a.xi.x?a.x>o.x?a.x:o.x:i.x>o.x?i.x:o.x,c=a.y>i.y?a.y>o.y?a.y:o.y:i.y>o.y?i.y:o.y,f=p(s,l,e,r,n),h=p(u,c,e,r,n),d=t.prevZ,g=t.nextZ;d&&d.z>=f&&g&&g.z<=h;){if(d!==t.prev&&d!==t.next&&v(a.x,a.y,i.x,i.y,o.x,o.y,d.x,d.y)&&y(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,g!==t.prev&&g!==t.next&&v(a.x,a.y,i.x,i.y,o.x,o.y,g.x,g.y)&&y(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;d&&d.z>=f;){if(d!==t.prev&&d!==t.next&&v(a.x,a.y,i.x,i.y,o.x,o.y,d.x,d.y)&&y(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;g&&g.z<=h;){if(g!==t.prev&&g!==t.next&&v(a.x,a.y,i.x,i.y,o.x,o.y,g.x,g.y)&&y(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function u(t,e,r){var n=t;do{var a=n.prev,o=n.next.next;!b(a,o)&&x(a,n,n.next,o)&&A(a,o)&&A(o,a)&&(e.push(a.i/r),e.push(n.i/r),e.push(o.i/r),M(n),M(n.next),n=t=o),n=n.next}while(n!==t);return i(n)}function c(t,e,r,n,a,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&m(l,u)){var c=T(l,u);return l=i(l,l.next),c=i(c,c.next),o(l,e,r,n,a,s),void o(c,e,r,n,a,s)}u=u.next}l=l.next}while(l!==t)}function f(t,e){return t.x-e.x}function h(t,e){if(e=function(t,e){var r,n=e,a=t.x,i=t.y,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=a&&s>o){if(o=s,s===a){if(i===n.y)return n;if(i===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&a!==n.x&&v(ir.x||n.x===r.x&&d(r,n)))&&(r=n,h=l)),n=n.next}while(n!==u);return r}(t,e)){var r=T(e,t);i(e,e.next),i(r,r.next)}}function d(t,e){return y(t.prev,t,e.prev)<0&&y(e.next,t,t.next)<0}function p(t,e,r,n,a){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*a)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*a)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function g(t){var e=t,r=t;do{(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(i-s)-(a-o)*(n-s)>=0}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&x(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(A(t,e)&&A(e,t)&&function(t,e){var r=t,n=!1,a=(t.x+e.x)/2,i=(t.y+e.y)/2;do{r.y>i!=r.next.y>i&&r.next.y!==r.y&&a<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(y(t.prev,t,e.prev)||y(t,e.prev,e))||b(t,e)&&y(t.prev,t,t.next)>0&&y(e.prev,e,e.next)>0)}function y(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,r,n){var a=w(y(t,e,r)),i=w(y(t,e,n)),o=w(y(r,n,t)),s=w(y(r,n,e));return a!==i&&o!==s||(!(0!==a||!_(t,r,e))||(!(0!==i||!_(t,n,e))||(!(0!==o||!_(r,t,n))||!(0!==s||!_(r,e,n)))))}function _(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function w(t){return t>0?1:t<0?-1:0}function A(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function T(t,e){var r=new E(t.i,t.x,t.y),n=new E(e.i,e.x,e.y),a=t.next,i=e.prev;return t.next=e,e.prev=t,r.next=a,a.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function k(t,e,r,n){var a=new E(t,e,r);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function M(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function E(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function S(t,e,r,n){for(var a=0,i=e,o=r-n;i0&&(n+=t[a-1].length,r.holes.push(n))}return r}},{}],94:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var a=0;a=55296&&y<=56319&&(w+=t[++r]),w=A?h.call(A,T,w,g):w,e?(d.value=w,p(v,g,d)):v[g]=w,++g;m=g}if(void 0===m)for(m=o(t.length),e&&(v=new e(m)),r=0;r0?1:-1}},{}],105:[function(t,e,r){"use strict";var n=t("../math/sign"),a=Math.abs,i=Math.floor;e.exports=function(t){return isNaN(t)?0:0!==(t=Number(t))&&isFinite(t)?n(t)*i(a(t)):t}},{"../math/sign":102}],106:[function(t,e,r){"use strict";var n=t("./to-integer"),a=Math.max;e.exports=function(t){return a(0,n(t))}},{"./to-integer":105}],107:[function(t,e,r){"use strict";var n=t("./valid-callable"),a=t("./valid-value"),i=Function.prototype.bind,o=Function.prototype.call,s=Object.keys,l=Object.prototype.propertyIsEnumerable;e.exports=function(t,e){return function(r,u){var c,f=arguments[2],h=arguments[3];return r=Object(a(r)),n(u),c=s(r),h&&c.sort("function"==typeof h?i.call(h,r):void 0),"function"!=typeof t&&(t=c[t]),o.call(t,c,(function(t,n){return l.call(r,t)?o.call(u,f,r[t],t,r,n):e}))}}},{"./valid-callable":124,"./valid-value":126}],108:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.assign:t("./shim")},{"./is-implemented":109,"./shim":110}],109:[function(t,e,r){"use strict";e.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},{}],110:[function(t,e,r){"use strict";var n=t("../keys"),a=t("../valid-value"),i=Math.max;e.exports=function(t,e){var r,o,s,l=i(arguments.length,2);for(t=Object(a(t)),s=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},o=1;o-1}},{}],130:[function(t,e,r){"use strict";var n=Object.prototype.toString,a=n.call("");e.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===a)||!1}},{}],131:[function(t,e,r){"use strict";var n=Object.create(null),a=Math.random;e.exports=function(){var t;do{t=a().toString(36).slice(2)}while(n[t]);return t}},{}],132:[function(t,e,r){"use strict";var n,a=t("es5-ext/object/set-prototype-of"),i=t("es5-ext/string/#/contains"),o=t("d"),s=t("es6-symbol"),l=t("./"),u=Object.defineProperty;n=e.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");l.call(this,t),e=e?i.call(e,"key+value")?"key+value":i.call(e,"key")?"key":"value":"value",u(this,"__kind__",o("",e))},a&&a(n,l),delete n.prototype.constructor,n.prototype=Object.create(l.prototype,{_resolve:o((function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t}))}),u(n.prototype,s.toStringTag,o("c","Array Iterator"))},{"./":135,d:83,"es5-ext/object/set-prototype-of":121,"es5-ext/string/#/contains":127,"es6-symbol":140}],133:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/valid-callable"),i=t("es5-ext/string/is-string"),o=t("./get"),s=Array.isArray,l=Function.prototype.call,u=Array.prototype.some;e.exports=function(t,e){var r,c,f,h,d,p,g,v,m=arguments[2];if(s(t)||n(t)?r="array":i(t)?r="string":t=o(t),a(e),f=function(){h=!0},"array"!==r)if("string"!==r)for(c=t.next();!c.done;){if(l.call(e,m,c.value,f),h)return;c=t.next()}else for(p=t.length,d=0;d=55296&&v<=56319&&(g+=t[++d]),l.call(e,m,g,f),!h);++d);else u.call(t,(function(t){return l.call(e,m,t,f),h}))}},{"./get":134,"es5-ext/function/is-arguments":99,"es5-ext/object/valid-callable":124,"es5-ext/string/is-string":130}],134:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/string/is-string"),i=t("./array"),o=t("./string"),s=t("./valid-iterable"),l=t("es6-symbol").iterator;e.exports=function(t){return"function"==typeof s(t)[l]?t[l]():n(t)?new i(t):a(t)?new o(t):new i(t)}},{"./array":132,"./string":137,"./valid-iterable":138,"es5-ext/function/is-arguments":99,"es5-ext/string/is-string":130,"es6-symbol":140}],135:[function(t,e,r){"use strict";var n,a=t("es5-ext/array/#/clear"),i=t("es5-ext/object/assign"),o=t("es5-ext/object/valid-callable"),s=t("es5-ext/object/valid-value"),l=t("d"),u=t("d/auto-bind"),c=t("es6-symbol"),f=Object.defineProperty,h=Object.defineProperties;e.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");h(this,{__list__:l("w",s(t)),__context__:l("w",e),__nextIndex__:l("w",0)}),e&&(o(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,h(n.prototype,i({_next:l((function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach((function(e,r){e>=t&&(this.__redo__[r]=++e)}),this),this.__redo__.push(t)):f(this,"__redo__",l("c",[t])))})),_onDelete:l((function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(e=this.__redo__.indexOf(t))&&this.__redo__.splice(e,1),this.__redo__.forEach((function(e,r){e>t&&(this.__redo__[r]=--e)}),this)))})),_onClear:l((function(){this.__redo__&&a.call(this.__redo__),this.__nextIndex__=0}))}))),f(n.prototype,c.iterator,l((function(){return this})))},{d:83,"d/auto-bind":82,"es5-ext/array/#/clear":95,"es5-ext/object/assign":108,"es5-ext/object/valid-callable":124,"es5-ext/object/valid-value":126,"es6-symbol":140}],136:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/is-value"),i=t("es5-ext/string/is-string"),o=t("es6-symbol").iterator,s=Array.isArray;e.exports=function(t){return!!a(t)&&(!!s(t)||(!!i(t)||(!!n(t)||"function"==typeof t[o])))}},{"es5-ext/function/is-arguments":99,"es5-ext/object/is-value":115,"es5-ext/string/is-string":130,"es6-symbol":140}],137:[function(t,e,r){"use strict";var n,a=t("es5-ext/object/set-prototype-of"),i=t("d"),o=t("es6-symbol"),s=t("./"),l=Object.defineProperty;n=e.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),s.call(this,t),l(this,"__length__",i("",t.length))},a&&a(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:i((function(){if(this.__list__)return this.__nextIndex__=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r}))}),l(n.prototype,o.toStringTag,i("c","String Iterator"))},{"./":135,d:83,"es5-ext/object/set-prototype-of":121,"es6-symbol":140}],138:[function(t,e,r){"use strict";var n=t("./is-iterable");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},{"./is-iterable":136}],139:[function(t,e,r){(function(n,a){ +"use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){+t!=t&&(t=0);return i.alloc(+t)},r.INSPECT_MAX_BYTES=50;function a(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(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 l(t)}return o(t,e,r)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|f(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return u(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(N(t,ArrayBuffer)||t&&N(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||N(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 a=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return P(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(a)return n?-1:P(t).length;e=(""+e).toLowerCase(),a=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 M(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return w(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function h(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function p(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),B(r=+r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:g(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,a){var i,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(a){var c=-1;for(i=r;is&&(r=s-l),i=r;i>=0;i--){for(var f=!0,d=0;da&&(n=a):n=a;var i=e.length;n>i/2&&(n=i/2);for(var o=0;o>8,a=r%256,i.push(a),i.push(n);return i}(e,t.length-r),t,r,n)}function w(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],a=e;a239?4:u>223?3:u>191?2:1;if(a+f<=r)switch(f){case 1:u<128&&(c=u);break;case 2:128==(192&(i=t[a+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=t[a+1],o=t[a+2],128==(192&i)&&128==(192&o)&&(l=(15&u)<<12|(63&i)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=t[a+1],o=t[a+2],s=t[a+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&(l=(15&u)<<18|(63&i)<<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),a+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},i.prototype.compare=function(t,e,r,n,a){if(N(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.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===a&&(a=this.length),e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(a>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),l=Math.min(o,s),u=this.slice(n,a),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-e;if((void 0===r||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;an)&&(r=n);for(var a="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,a,i){return e=+e,r>>>=0,i||L(t,0,r,4),n.write(t,e,r,a,23,4),r+4}function D(t,e,r,a,i){return e=+e,r>>>=0,i||L(t,0,r,8),n.write(t,e,r,a,52,8),r+8}i.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||S(t,e,this.length);for(var n=this[t],a=1,i=0;++i>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t+--e],a=1;e>0&&(a*=256);)n+=this[t+--e]*a;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],a=1,i=0;++i=(a*=128)&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=e,a=1,i=this[t+--n];n>0&&(a*=256);)i+=this[t+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),n.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),n.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),n.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),n.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=r-1,i=1;for(this[e+a]=255&t;--a>=0&&(i*=256);)this[e+a]=t/i&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},i.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.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;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return a},i.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&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var a=t.charCodeAt(0);("utf8"===n&&a<128||"latin1"===n)&&(t=a)}}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(o=e;o55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function F(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var a=0;a=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function N(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function B(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":22,buffer:52,ieee754:239}],53:[function(t,e,r){"use strict";var n=t("./lib/monotone"),a=t("./lib/triangulation"),i=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),d=!!u(r,"exterior",!0),h=!!u(r,"infinity",!1);if(!f&&!d||0===t.length)return[];var p=n(t,e);if(c||f!==d||h){for(var g=a(t.length,function(t){return t.map(s).sort(l)}(e)),v=0;v0;){for(var h=r.pop(),p=(s=r.pop(),c=-1,f=-1,l=o[s],1);p=0||(e.flip(s,h),a(t,e,r,c,s,f),a(t,e,r,s,f,c),a(t,e,r,f,h,c),a(t,e,r,h,c,f)))}}},{"binary-search-bounds":39,"robust-in-sphere":298}],55:[function(t,e,r){"use strict";var n,a=t("binary-search-bounds");function i(t,e,r,n,a,i,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=a,this.next=i,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,a=0;a0||l.length>0;){for(;s.length>0;){var h=s.pop();if(u[h]!==-a){u[h]=a;c[h];for(var p=0;p<3;++p){var g=d[3*h+p];g>=0&&0===u[g]&&(f[3*h+p]?l.push(g):(s.push(g),u[g]=a))}}}var v=l;l=s,s=v,l.length=0,a=-a}var m=function(t,e,r){for(var n=0,a=0;a1&&a(r[d[h-2]],r[d[h-1]],i)>0;)t.push([d[h-1],d[h-2],o]),h-=1;d.length=h,d.push(o);var p=f.upperIds;for(h=p.length;h>1&&a(r[p[h-2]],r[p[h-1]],i)<0;)t.push([p[h-2],p[h-1],o]),h-=1;p.length=h,p.push(o)}}function c(t,e){var r;return(r=t.a[0]p[0]&&a.push(new o(p,h,2,l),new o(h,p,1,l))}a.sort(s);for(var g=a[0].a[0]-(1+Math.abs(a[0].a[0]))*Math.pow(2,-52),v=[new i([g,1],[g,0],-1,[],[],[],[])],m=[],y=(l=0,a.length);l=0}}(),i.removeTriangle=function(t,e,r){var n=this.stars;o(n[t],e,r),o(n[e],r,t),o(n[r],t,e)},i.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},i.opposite=function(t,e){for(var r=this.stars[e],n=1,a=r.length;nr?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 a=new Array(e.length),i=0;ie[2]?1:0)}function m(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--i){var b=e[c=(E=n[i])[0]],x=b[0],_=b[1],w=t[x],A=t[_];if((w[0]-A[0]||w[1]-A[1])<0){var T=x;x=_,_=T}b[0]=x;var k,M=b[1]=E[1];for(a&&(k=b[2]);i>0&&n[i-1][0]===c;){var E,S=(E=n[--i])[1];a?e.push([M,S,k]):e.push([M,S]),M=S}a?e.push([M,_,k]):e.push([M,_])}return d}(t,e,d,v,r));return m(e,y,r),!!y||(d.length>0||v.length>0)}},{"./lib/rat-seg-intersect":60,"big-rat":26,"big-rat/cmp":24,"big-rat/to-float":38,"box-intersect":43,nextafter:259,"rat-vec":287,"robust-segment-intersect":302,"union-find":339}],60:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=s(e,t),f=s(n,r),d=c(i,f);if(0===o(d))return null;var h=s(t,r),p=c(f,h),g=a(p,d),v=u(i,g);return l(t,v)};var n=t("big-rat/mul"),a=t("big-rat/div"),i=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 i(n(t[0],e[1]),n(t[1],e[0]))}},{"big-rat/div":25,"big-rat/mul":35,"big-rat/sign":36,"big-rat/sub":37,"rat-vec/add":286,"rat-vec/muls":288,"rat-vec/sub":289}],61:[function(t,e,r){"use strict";var n=t("clamp");function a(t,e){null==e&&(e=!0);var r=t[0],a=t[1],i=t[2],o=t[3];return null==o&&(o=e?1:255),e&&(r*=255,a*=255,i*=255,o*=255),16777216*(r=255&n(r,0,255))+((a=255&n(a,0,255))<<16)+((i=255&n(i,0,255))<<8)+(o=255&n(o,0,255))}e.exports=a,e.exports.to=a,e.exports.from=function(t,e){var r=(t=+t)>>>24,n=(16711680&t)>>>16,a=(65280&t)>>>8,i=255&t;return!1===e?[r,n,a,i]:[r/255,n/255,a/255,i/255]}},{clamp:58}],62:[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]}},{}],63:[function(t,e,r){"use strict";var n=t("color-rgba"),a=t("clamp"),i=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(i(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]=a(Math.floor(255*t[0]),0,255),r[1]=a(Math.floor(255*t[1]),0,255),r[2]=a(Math.floor(255*t[2]),0,255),r[3]=null==t[3]?255:a(Math.floor(255*t[3]),0,255)),r)}},{clamp:58,"color-rgba":65,dtype:91}],64:[function(t,e,r){(function(r){(function(){"use strict";var n=t("color-name"),a=t("is-plain-obj"),i=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=(h=t.slice(1)).length;u=1,c<=4?(l=[parseInt(h[0]+h[0],16),parseInt(h[1]+h[1],16),parseInt(h[2]+h[2],16)],4===c&&(u=parseInt(h[3]+h[3],16)/255)):(l=[parseInt(h[0]+h[1],16),parseInt(h[2]+h[3],16),parseInt(h[4]+h[5],16)],8===c&&(u=parseInt(h[6]+h[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 f=e[1],d="rgb"===f,h=f.replace(/a$/,"");s=h;c="cmyk"===h?4:"gray"===h?1:3;l=e[2].trim().split(/\s*,\s*/).map((function(t,e){if(/%$/.test(t))return e===c?parseFloat(t)/100:"rgb"===h?255*parseFloat(t)/100:parseFloat(t);if("h"===h[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)})),f===h&&l.push(1),u=d||void 0===l[c]?1:l[c],l=l.slice(0,c)}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(a(t)){var p=i(t.r,t.red,t.R,null);null!==p?(s="rgb",l=[p,i(t.g,t.green,t.G),i(t.b,t.blue,t.B)]):(s="hsl",l=[i(t.h,t.hue,t.H),i(t.s,t.saturation,t.S),i(t.l,t.lightness,t.L,t.b,t.brightness)]),u=i(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)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":62,defined:87,"is-plain-obj":248}],65:[function(t,e,r){"use strict";var n=t("color-parse"),a=t("color-space/hsl"),i=t("clamp");e.exports=function(t){var e,r=n(t);return r.space?((e=Array(3))[0]=i(r.values[0],0,255),e[1]=i(r.values[1],0,255),e[2]=i(r.values[2],0,255),"h"===r.space[0]&&(e=a.rgb(e)),e.push(i(r.alpha,0,1)),e):[]}},{clamp:58,"color-parse":64,"color-space/hsl":66}],66:[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,a,i,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[i=255*l,i,i];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),a=[0,0,0];for(var u=0;u<3;u++)(n=o+1/3*-(u-1))<0?n++:n>1&&n--,i=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[u]=255*i;return a}},n.hsl=function(t){var e,r,n=t[0]/255,a=t[1]/255,i=t[2]/255,o=Math.min(n,a,i),s=Math.max(n,a,i),l=s-o;return s===o?e=0:n===s?e=(a-i)/l:a===s?e=2+(i-n)/l:i===s&&(e=4+(n-a)/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":67}],67:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],68:[function(t,e,r){"use strict";e.exports=function(t,e,r,i){var o=n(e,r,i);if(0===o){var s=a(n(t,e,r)),u=a(n(t,e,i));if(s===u){if(0===s){var c=l(t,e,r),f=l(t,e,i);return c===f?0:c?1:-1}return 0}return 0===u?s>0||l(t,e,i)?-1:1:0===s?u>0||l(t,e,r)?1:-1:a(u-s)}var d=n(t,e,r);return d>0?o>0&&n(t,e,i)>0?1:-1:d<0?o>0||n(t,e,i)>0?1:-1:n(t,e,i)>0||l(t,e,r)?1:-1};var n=t("robust-orientation"),a=t("signum"),i=t("two-sum"),o=t("robust-product"),s=t("robust-sum");function l(t,e,r){var n=i(t[0],-e[0]),a=i(t[1],-e[1]),l=i(r[0],-e[0]),u=i(r[1],-e[1]),c=s(o(n,l),o(a,u));return c[c.length-1]>=0}},{"robust-orientation":299,"robust-product":300,"robust-sum":304,signum:305,"two-sum":326}],69:[function(t,e,r){e.exports=["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]},{}],70:[function(t,e,r){e.exports=["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]},{}],71:[function(t,e,r){e.exports=["normal","italic","oblique"]},{}],72:[function(t,e,r){e.exports=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},{}],73:[function(t,e,r){"use strict";e.exports={parse:t("./parse"),stringify:t("./stringify")}},{"./parse":75,"./stringify":76}],74:[function(t,e,r){"use strict";var n=t("css-font-size-keywords");e.exports={isSize:function(t){return/^[\d\.]/.test(t)||-1!==t.indexOf("/")||-1!==n.indexOf(t)}}},{"css-font-size-keywords":69}],75:[function(t,e,r){"use strict";var n=t("unquote"),a=t("css-global-keywords"),i=t("css-system-font-keywords"),o=t("css-font-weight-keywords"),s=t("css-font-style-keywords"),l=t("css-font-stretch-keywords"),u=t("string-split-by"),c=t("./lib/util").isSize;e.exports=d;var f=d.cache={};function d(t){if("string"!=typeof t)throw new Error("Font argument must be a string.");if(f[t])return f[t];if(""===t)throw new Error("Cannot parse an empty string.");if(-1!==i.indexOf(t))return f[t]={system:t};for(var e,r={style:"normal",variant:"normal",weight:"normal",stretch:"normal",lineHeight:"normal",size:"1rem",family:["serif"]},d=u(t,/\s+/);e=d.shift();){if(-1!==a.indexOf(e))return["style","variant","weight","stretch"].forEach((function(t){r[t]=e})),f[t]=r;if(-1===s.indexOf(e))if("normal"!==e&&"small-caps"!==e)if(-1===l.indexOf(e)){if(-1===o.indexOf(e)){if(c(e)){var p=u(e,"/");if(r.size=p[0],null!=p[1]?r.lineHeight=h(p[1]):"/"===d[0]&&(d.shift(),r.lineHeight=h(d.shift())),!d.length)throw new Error("Missing required font-family.");return r.family=u(d.join(" "),/\s*,\s*/).map(n),f[t]=r}throw new Error("Unknown or unsupported font token: "+e)}r.weight=e}else r.stretch=e;else r.variant=e;else r.style=e}throw new Error("Missing required font-size.")}function h(t){var e=parseFloat(t);return e.toString()===t?e:t}},{"./lib/util":74,"css-font-stretch-keywords":70,"css-font-style-keywords":71,"css-font-weight-keywords":72,"css-global-keywords":77,"css-system-font-keywords":78,"string-split-by":314,unquote:341}],76:[function(t,e,r){"use strict";var n=t("pick-by-alias"),a=t("./lib/util").isSize,i=g(t("css-global-keywords")),o=g(t("css-system-font-keywords")),s=g(t("css-font-weight-keywords")),l=g(t("css-font-style-keywords")),u=g(t("css-font-stretch-keywords")),c={normal:1,"small-caps":1},f={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1},d="1rem",h="serif";function p(t,e){if(t&&!e[t]&&!i[t])throw Error("Unknown keyword `"+t+"`");return t}function g(t){for(var e={},r=0;r0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){if(e.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(i),ir.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":81}],80:[function(t,e,r){"use strict";var n=t("uniq");function a(t,e,r){var n,a,i=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=i-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 i(t,e,r){for(var n=t.body,a=[],i=[],o=0;o0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,s=new Array(t.arrayArgs.length),l=new Array(t.arrayArgs.length),u=0;u0&&b.push("shape=SS.slice(0)"),t.indexArgs.length>0){var x=new Array(r);for(u=0;u0&&y.push("var "+b.join(",")),u=0;u3&&y.push(i(t.pre,t,l));var T=i(t.body,t,l),k=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&&y.push(i(t.post,t,l)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+y.join("\n")+"\n----------");var M=[t.funcName||"unnamed","_cwise_loop_",s[0].join("s"),"m",k,o(l)].join("");return new Function(["function ",M,"(",m.join(","),"){",y.join("\n"),"} return ",M].join(""))()}},{uniq:340}],81:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],a=t.funcName+"_cwise_thunk";e.push(["return function ",a,"(",t.shimArgs.join(","),"){"].join(""));for(var i=[],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;c=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:vt,s:mt,S:H,u:G,U:q,V:X,w:W,W:Y,x:null,X:null,y:Z,Y:J,Z:Q,"%":gt},Lt={a:function(t){return f[t.getUTCDay()]},A:function(t){return c[t.getUTCDay()]},b:function(t){return yt[t.getUTCMonth()]},B:function(t){return d[t.getUTCMonth()]},c:null,d:$,e:$,f:nt,H:K,I:tt,j:et,L:rt,m:at,M:it,p:function(t){return u[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:vt,s:mt,S:ot,u:st,U:lt,V:ut,w:ct,W:ft,x:null,X:null,y:dt,Y:ht,Z:pt,"%":gt},Ot={a:function(t,e,r){var n=At.exec(e.slice(r));return n?(t.w=Tt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=Et.exec(e.slice(r));return n?(t.m=St[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=kt.exec(e.slice(r));return n?(t.m=Mt[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return It(t,i,e,r)},d:k,e:k,f:O,H:E,I:E,j:M,L:L,m:T,M:S,p:function(t,e,r){var n=bt.exec(e.slice(r));return n?(t.p=xt[n[0].toLowerCase()],r+n[0].length):-1},q:A,Q:R,s:I,S:C,u:v,U:m,V:y,w:g,W:b,x:function(t,e,r){return It(t,o,e,r)},X:function(t,e,r){return It(t,l,e,r)},y:_,Y:x,Z:w,"%":D};function Dt(t,e){return function(r){var n,a,i,o=[],l=-1,u=0,c=t.length;for(r instanceof Date||(r=new Date(+r));++l53)return null;"w"in u||(u.w=1),"Z"in u?(l=(s=n(a(u.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(u.V-1)),u.y=s.getUTCFullYear(),u.m=s.getUTCMonth(),u.d=s.getUTCDate()+(u.w+6)%7):(l=(s=r(a(u.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(u.V-1)),u.y=s.getFullYear(),u.m=s.getMonth(),u.d=s.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),l="Z"in u?n(a(u.y,0,1)).getUTCDay():r(a(u.y,0,1)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+7*u.W-(l+5)%7:u.w+7*u.U-(l+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,n(u)):r(u)}}function It(t,e,r,n){for(var a,i,o=0,l=e.length,u=r.length;o=u)return-1;if(37===(a=e.charCodeAt(o++))){if(a=e.charAt(o++),!(i=Ot[a in s?e.charAt(o++):a])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ct.x=Dt(o,Ct),Ct.X=Dt(l,Ct),Ct.c=Dt(i,Ct),Lt.x=Dt(o,Lt),Lt.X=Dt(l,Lt),Lt.c=Dt(i,Lt),{format:function(t){var e=Dt(t+="",Ct);return e.toString=function(){return t},e},parse:function(t){var e=Rt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=Dt(t+="",Lt);return e.toString=function(){return t},e},utcParse:function(t){var e=Rt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,u=/^%/,c=/[\\^$*+?|[\]().{}]/g;function f(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function O(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function D(t,e,r){var n=u.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function R(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function I(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function P(t,e){return f(t.getDate(),e,2)}function F(t,e){return f(t.getHours(),e,2)}function z(t,e){return f(t.getHours()%12||12,e,2)}function N(t,r){return f(1+e.timeDay.count(e.timeYear(t),t),r,3)}function B(t,e){return f(t.getMilliseconds(),e,3)}function j(t,e){return B(t,e)+"000"}function U(t,e){return f(t.getMonth()+1,e,2)}function V(t,e){return f(t.getMinutes(),e,2)}function H(t,e){return f(t.getSeconds(),e,2)}function G(t){var e=t.getDay();return 0===e?7:e}function q(t,r){return f(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function X(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function W(t){return t.getDay()}function Y(t,r){return f(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function Z(t,e){return f(t.getFullYear()%100,e,2)}function J(t,e){return f(t.getFullYear()%1e4,e,4)}function Q(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+f(e/60|0,"0",2)+f(e%60,"0",2)}function $(t,e){return f(t.getUTCDate(),e,2)}function K(t,e){return f(t.getUTCHours(),e,2)}function tt(t,e){return f(t.getUTCHours()%12||12,e,2)}function et(t,r){return f(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return f(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function at(t,e){return f(t.getUTCMonth()+1,e,2)}function it(t,e){return f(t.getUTCMinutes(),e,2)}function ot(t,e){return f(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,r){return f(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ut(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ct(t){return t.getUTCDay()}function ft(t,r){return f(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function dt(t,e){return f(t.getUTCFullYear()%100,e,2)}function ht(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function pt(){return"+0000"}function gt(){return"%"}function vt(t){return+t}function mt(t){return Math.floor(+t/1e3)}function yt(e){return o=i(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var bt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var xt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=bt,t.isoParse=xt,t.timeFormatDefaultLocale=yt,t.timeFormatLocale=i,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":85}],85:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,a,i,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),a(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e0))return o;do{o.push(i=new Date(+e)),a(e,n),t(e)}while(i=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;a(t,-1),!e(t););else for(;--r>=0;)for(;a(t,1),!e(t););}))},i&&(s.count=function(n,a){return e.setTime(+n),r.setTime(+a),t(e),t(r),Math.floor(i(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var a=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));a.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):a:null};var i=a.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),u=l.range,c=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),f=c.range,d=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),h=d.range;function p(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var g=p(0),v=p(1),m=p(2),y=p(3),b=p(4),x=p(5),_=p(6),w=g.range,A=v.range,T=m.range,k=y.range,M=b.range,E=x.range,S=_.range,C=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),L=C.range,O=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));O.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var D=O.range,R=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),I=R.range,P=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),F=P.range,z=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),N=z.range;function B(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var j=B(0),U=B(1),V=B(2),H=B(3),G=B(4),q=B(5),X=B(6),W=j.range,Y=U.range,Z=V.range,J=H.range,Q=G.range,$=q.range,K=X.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=d,t.timeDays=h,t.timeFriday=x,t.timeFridays=E,t.timeHour=c,t.timeHours=f,t.timeInterval=n,t.timeMillisecond=a,t.timeMilliseconds=i,t.timeMinute=l,t.timeMinutes=u,t.timeMonday=v,t.timeMondays=A,t.timeMonth=C,t.timeMonths=L,t.timeSaturday=_,t.timeSaturdays=S,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=g,t.timeSundays=w,t.timeThursday=b,t.timeThursdays=M,t.timeTuesday=m,t.timeTuesdays=T,t.timeWednesday=y,t.timeWednesdays=k,t.timeWeek=g,t.timeWeeks=w,t.timeYear=O,t.timeYears=D,t.utcDay=z,t.utcDays=N,t.utcFriday=q,t.utcFridays=$,t.utcHour=P,t.utcHours=F,t.utcMillisecond=a,t.utcMilliseconds=i,t.utcMinute=R,t.utcMinutes=I,t.utcMonday=U,t.utcMondays=Y,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=X,t.utcSaturdays=K,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=j,t.utcSundays=W,t.utcThursday=G,t.utcThursdays=Q,t.utcTuesday=V,t.utcTuesdays=Z,t.utcWednesday=H,t.utcWednesdays=J,t.utcWeek=j,t.utcWeeks=W,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],86:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},a=this.document;function i(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,u=s.setAttributeNS,c=this.CSSStyleDeclaration.prototype,f=c.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){u.call(this,t,e,r+"")},c.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function d(t,e){return te?1:t>=e?0:NaN}function h(t){return null===t?NaN:+t}function p(t){return!isNaN(t)}function g(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+1}return n}}}t.ascending=d,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},t.max=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},t.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(l-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var v=g(d);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 d(t(e),r)}:t)},t.shuffle=function(t,e,r){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+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],a=new Array(r<0?0:r);e=0;)for(e=(n=t[a]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function b(t){for(var e=1;t*e%1;)e*=10;return e}function x(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){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,a=[],i=b(y(r)),o=-1;if(t*=i,e*=i,(r*=i)<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=a.length)return r?r.call(n,i):e?i.sort(e):i;for(var l,u,c,f,d=-1,h=i.length,p=a[s++],g=new _;++d=a.length)return e;var n=[],o=i[r++];return e.forEach((function(e,a){n.push({key:e,values:t(a,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 a.push(t),n},n.sortKeys=function(t){return i[a.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(j,"\\$&")};var j=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return U(t,X),t}var H=function(t,e){return e.querySelector(t)},G=function(t,e){return e.querySelectorAll(t)},q=function(t,e){var r=t.matches||t[D(t,"matchesSelector")];return(q=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(H=function(t,e){return Sizzle(t,e)[0]||null},G=Sizzle,q=Sizzle.matchesSelector),t.selection=function(){return t.select(a.documentElement)};var X=t.selection.prototype=[];function W(t){return"function"==typeof t?t:function(){return H(t,this)}}function Y(t){return"function"==typeof t?t:function(){return G(t,this)}}X.select=function(t){var e,r,n,a,i=[];t=W(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}},X.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(Q(r,e[r]));return this}return this.each(Q(e,r))},X.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},X.sort=function(t){t=ut.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=a+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=gt.get(e);function u(){var t=this[i];t&&(this.removeEventListener(e,t,t.$),delete this[i])}return l&&(e=l,s=mt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[i]=t,t.$=a),t._=r}:u:r?I:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}t.selection.enter=ft,t.selection.enter.prototype=dt,dt.append=X.append,dt.empty=X.empty,dt.node=X.node,dt.call=X.call,dt.size=X.size,dt.select=function(t){for(var e,r,n,a,i,o=[],s=-1,l=this.length;++s0?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 It(t){return t>1?0:t<-1?Mt:Math.acos(t)}function Pt(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Ft(t){return((t=Math.exp(t))+1/t)/2}function zt(t){return(t=Math.sin(t/2))*t}var Nt=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,a=t[0],i=t[1],o=t[2],s=e[0],l=e[1],u=e[2],c=s-a,f=l-i,d=c*c+f*f;if(d0&&(e=e.transition().duration(g)),e.call(w.event)}function E(){u&&u.domain(l.range().map((function(t){return(t-d.x)/d.k})).map(l.invert)),f&&f.domain(c.range().map((function(t){return(t-d.y)/d.k})).map(c.invert))}function S(t){v++||t({type:"zoomstart"})}function C(t){E(),t({type:"zoom",scale:d.k,translate:[d.x,d.y]})}function L(t){--v||(t({type:"zoomend"}),r=null)}function O(){var e=this,r=_.of(e,arguments),n=0,a=t.select(o(e)).on(y,l).on(b,u),i=A(t.mouse(e)),s=xt(e);function l(){n=1,k(t.mouse(e),i),C(r)}function u(){a.on(y,null).on(b,null),s(n),L(r)}ms.call(e),S(r)}function D(){var e,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,u="touchend"+o,c=[],f=t.select(r),h=xt(r);function p(){var n=t.touches(r);return e=d.k,n.forEach((function(t){t.identifier in a&&(a[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=h[0];var b=h[1],x=m[0]-b[0],_=m[1]-b[1];i=x*x+_*_}}function v(){var o,l,u,c,f=t.touches(r);ms.call(r);for(var d=0,h=f.length;d360?t-=360:t<0&&(t+=360),t<60?n+(a-n)*t/60:t<180?a:t<240?n+(a-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)||e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+e):r+e-r*e),new ne(i(t+120),i(t),i(t-120))}function Xt(e,r,n){return this instanceof Xt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Xt?new Xt(e.h,e.c,e.l):Kt(e instanceof Zt?e.l:(e=ce((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Xt(e,r,n)}Gt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,this.l/t)},Gt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,t*this.l)},Gt.rgb=function(){return qt(this.h,this.s,this.l)},t.hcl=Xt;var Wt=Xt.prototype=new Vt;function Yt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Zt(r,Math.cos(t*=Lt)*e,Math.sin(t)*e)}function Zt(t,e,r){return this instanceof Zt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Zt?new Zt(t.l,t.a,t.b):t instanceof Xt?Yt(t.h,t.c,t.l):ce((t=ne(t)).r,t.g,t.b):new Zt(t,e,r)}Wt.brighter=function(t){return new Xt(this.h,this.c,Math.min(100,this.l+Jt*(arguments.length?t:1)))},Wt.darker=function(t){return new Xt(this.h,this.c,Math.max(0,this.l-Jt*(arguments.length?t:1)))},Wt.rgb=function(){return Yt(this.h,this.c,this.l).rgb()},t.lab=Zt;var Jt=18,Qt=Zt.prototype=new Vt;function $t(t,e,r){var n=(t+16)/116,a=n+e/500,i=n-r/200;return new ne(re(3.2404542*(a=.95047*te(a))-1.5371385*(n=1*te(n))-.4985314*(i=1.08883*te(i))),re(-.969266*a+1.8760108*n+.041556*i),re(.0556434*a-.2040259*n+1.0572252*i))}function Kt(t,e,r){return t>0?new Xt(Math.atan2(r,e)*Ot,Math.sqrt(e*e+r*r),t):new Xt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,qt):new ne(t,e,r)}function ae(t){return new ne(t>>16,t>>8&255,255&t)}function ie(t){return ae(t)+""}Qt.brighter=function(t){return new Zt(Math.min(100,this.l+Jt*(arguments.length?t:1)),this.a,this.b)},Qt.darker=function(t){return new Zt(Math.max(0,this.l-Jt*(arguments.length?t:1)),this.a,this.b)},Qt.rgb=function(){return $t(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(t,e,r){var n,a,i,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(de(a[0]),de(a[1]),de(a[2]))}return(i=he.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,s=240&i,s|=s>>4,l=15&i,l|=l<<4):7===t.length&&(o=(16711680&i)>>16,s=(65280&i)>>8,l=255&i)),e(o,s,l))}function ue(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-i,l=(o+i)/2;return s?(a=l<.5?s/(o+i):s/(2-o-i),n=t==o?(e-r)/s+(e0&&l<1?0:n),new Ht(n,a,l)}function ce(t,e,r){var n=ee((.4124564*(t=fe(t))+.3575761*(e=fe(e))+.1804375*(r=fe(r)))/.95047),a=ee((.2126729*t+.7151522*e+.072175*r)/1);return Zt(116*a-16,500*(n-a),200*(a-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function de(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,a=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=a.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 a=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}})),o.send=function(t,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),u.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),u.setRequestHeader)for(var i in l)u.setRequestHeader(i,l[i]);return null!=r&&u.overrideMimeType&&u.overrideMimeType(r),null!=c&&(u.responseType=c),null!=a&&o.on("error",a).on("load",(function(t){a(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==i?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(i))}he.forEach((function(t,e){he.set(t,ae(e))})),t.functor=pe,t.xhr=ge(L),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function a(t,r,n){arguments.length<3&&(n=r,r=null);var a=ve(t,e,null==r?i:o(r),n);return a.row=function(t){return arguments.length?a.response(null==(r=t)?i:o(t)):r},a}function i(t){return a.parse(t.responseText)}function o(t){return function(e){return a.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 a.parse=function(t,e){var r;return a.parseRows(t,(function(t,n){if(r)return r(t,n-1);var a=new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+"]"})).join(",")+"}");r=e?function(t,r){return e(a(t),r)}:a}))},a.parseRows=function(t,e){var r,a,i={},o={},s=[],l=t.length,u=0,c=0;function f(){if(u>=l)return o;if(a)return a=!1,i;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(xe),xe=setTimeout(Ae,e)),be=0):(be=1,_e(Ae))}function Te(){for(var t=Date.now(),e=me;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function ke(){for(var t,e=me,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Se(e){var r=e.decimal,n=e.thousands,a=e.grouping,i=e.currency,o=a&&n?function(t,e){for(var r=t.length,i=[],o=0,s=a[0],l=0;r>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),i.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=a[o=(o+1)%a.length];return i.reverse().join(n)}:L;return function(e){var n=Ce.exec(e),a=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],f=+n[6],d=n[7],h=n[8],p=n[9],g=1,v="",m="",y=!1,b=!0;switch(h&&(h=+h.substring(1)),(c||"0"===a&&"="===s)&&(c=a="0",s="="),p){case"n":d=!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,h=0;break;case"s":g=-1,p="r"}"$"===u&&(v=i[0],m=i[1]),"r"!=p||h||(p="g"),null!=h&&("g"==p?h=Math.max(1,Math.min(21,h)):"e"!=p&&"f"!=p||(h=Math.max(0,Math.min(20,h)))),p=Le.get(p)||Oe;var x=c&&d;return function(e){var n=m;if(y&&e%1)return"";var i=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(g<0){var u=t.formatPrefix(e,h);e=u.scale(e),n=u.symbol+m}else e*=g;var _,w,A=(e=p(e,h)).lastIndexOf(".");if(A<0){var T=b?e.lastIndexOf("e"):-1;T<0?(_=e,w=""):(_=e.substring(0,T),w=e.substring(T))}else _=e.substring(0,A),w=r+e.substring(A+1);!c&&d&&(_=o(_,1/0));var k=v.length+_.length+w.length+(x?0:i.length),M=k"===s?M+i+e:"^"===s?M.substring(0,k>>=1)+i+e+M.substring(k):i+(x?e:M+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Me(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)))),Ee[8+n/3]};var Ce=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Le=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,Me(e,r))).toFixed(Math.max(0,Math.min(20,Me(e*(1+1e-15),r))))}});function Oe(t){return t+""}var De=t.time={},Re=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(){Pe.setUTCDate.apply(this._,arguments)},setDay:function(){Pe.setUTCDay.apply(this._,arguments)},setFullYear:function(){Pe.setUTCFullYear.apply(this._,arguments)},setHours:function(){Pe.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Pe.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Pe.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Pe.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Pe.setUTCSeconds.apply(this._,arguments)},setTime:function(){Pe.setTime.apply(this._,arguments)}};var Pe=Date.prototype;function Fe(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=u)return-1;if(37===(a=e.charCodeAt(s++))){if(o=e.charAt(s++),!(i=w[o in Be?e.charAt(s++):o])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}c.utc=function(t){var e=c(t);function r(t){try{var r=new(Re=Ie);return r._=t,e(r)}finally{Re=Date}}return r.parse=function(t){try{Re=Ie;var r=e.parse(t);return r&&r._}finally{Re=Date}},r.toString=e.toString,r},c.multi=c.utc.multi=or;var d=t.map(),h=He(o),p=Ge(o),g=He(s),v=Ge(s),m=He(l),y=Ge(l),b=He(u),x=Ge(u);i.forEach((function(t,e){d.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+De.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 i[+(t.getHours()>=12)]},S:function(t,e){return Ve(t.getSeconds(),e,2)},U:function(t,e){return Ve(De.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ve(De.mondayOfYear(t),e,2)},x:c(n),X:c(a),y:function(t,e){return Ve(t.getFullYear()%100,e,2)},Y:function(t,e){return Ve(t.getFullYear()%1e4,e,4)},Z:ar,"%":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){h.lastIndex=0;var n=h.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:$e,e:$e,H:tr,I:tr,j:Ke,L:nr,m:Qe,M:er,p:function(t,e,r){var n=d.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:Xe,w:qe,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:Je,"%":ir};return c}De.year=Fe((function(t){return(t=De.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),De.years=De.year.range,De.years.utc=De.year.utc.range,De.day=Fe((function(t){var e=new Re(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),De.days=De.day.range,De.days.utc=De.day.utc.range,De.dayOfYear=function(t){var e=De.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=De[t]=Fe((function(t){return(t=De.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=De.year(t).getDay();return Math.floor((De.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));De[t+"s"]=r.range,De[t+"s"].utc=r.utc.range,De[t+"OfYear"]=function(t){var r=De.year(t).getDay();return Math.floor((De.dayOfYear(t)+(r+e)%7)/7)}})),De.week=De.sunday,De.weeks=De.sunday.range,De.weeks.utc=De.sunday.utc.range,De.weekOfYear=De.sundayOfYear;var Be={"-":"",_:" ",0:"0"},je=/^\s*\d+/,Ue=/^%/;function Ve(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Je(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Qe(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function $e(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Ke(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ar(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,a=y(e)%60;return r+Ve(n,"0",2)+Ve(a,"0",2)}function ir(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;++r=0?1:-1,s=o*i,l=Math.cos(e),u=Math.sin(e),c=a*u,f=n*l+c*Math.cos(s),d=c*o*Math.sin(s);Sr.add(Math.atan2(d,f)),r=t,n=l,a=u}Cr.point=function(o,s){Cr.point=i,r=(t=o)*Lt,n=Math.cos(s=(e=s)*Lt/2+Mt/4),a=Math.sin(s)},Cr.lineEnd=function(){i(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 Dr(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 Pr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Fr(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 zr(t){return[Math.atan2(t[1],t[0]),Pt(t[2])]}function Nr(t,e){return y(t[0]-e[0])Tt?a=90:u<-Tt&&(r=-90),f[0]=e,f[1]=n}};function h(t,i){c.push(f=[e=t,n=t]),ia&&(a=i)}function p(t,o){var s=Or([t*Lt,o*Lt]);if(l){var u=Rr(l,s),c=Rr([u[1],-u[0],0],u);Fr(c),c=zr(c);var f=t-i,d=f>0?1:-1,p=c[0]*Ot*d,g=y(f)>180;if(g^(d*ia&&(a=v);else if(g^(d*i<(p=(p+360)%360-180)&&pa&&(a=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>i?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else h(t,o);l=s,i=t}function g(){d.point=p}function v(){f[0]=e,f[1]=n,d.point=h,l=null}function m(t,e){if(l){var r=t-i;u+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Cr.point(t,e),p(t,e)}function b(){Cr.lineStart()}function x(){m(o,s),Cr.lineEnd(),y(u)>Tt&&(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]=h[1]),_(h[0],g[1])>_(g[0],g[1])&&(g[0]=h[0])):s.push(g=h);for(var l,u,h,p=-1/0,g=(o=0,s[u=s.length-1]);o<=u;g=h,++o)h=s[o],(l=_(g[1],h[0]))>p&&(p=l,e=h[0],n=g[1])}return c=f=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,a]]}}(),t.geo.centroid=function(e){mr=yr=br=xr=_r=wr=Ar=Tr=kr=Mr=Er=0,t.geo.stream(e,Br);var r=kr,n=Mr,a=Er,i=r*r+n*n+a*a;return i=0;--s)a.point((f=c[s])[0],f[1]);else n(h.x,h.p.x,-1,a);h=h.p}c=(h=h.o).z,p=!p}while(!h.v);a.lineEnd()}}}function Yr(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n=0?1:-1,A=w*_,T=A>Mt,k=p*b;if(Sr.add(Math.atan2(k*w*Math.sin(A),g*x+k*Math.cos(A))),i+=T?_+w*Et:_,T^d>=r^m>=r){var M=Rr(Or(f),Or(t));Fr(M);var E=Rr(a,M);Fr(E);var S=(T^_>=0?-1:1)*Pt(E[2]);(n>S||n===S&&(M[0]||M[1]))&&(o+=T^_>=0?1:-1)}if(!v++)break;d=m,p=b,g=x,f=t}}return(i<-Tt||i0){for(b||(o.polygonStart(),b=!0),o.lineStart();++i1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter(Qr))}return c}}function Qr(t){return t.length>1}function $r(){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]-Ct-Tt:Ct-t[1])-((e=e.x)[0]<0?e[1]-Ct-Tt:Ct-e[1])}var tn=Jr(Xr,(function(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var s=i>0?Mt:-Mt,l=y(i-r);y(l-Mt)0?Ct:-Ct),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(i,n),e=0):a!==s&&l>=Mt&&(y(r-a)Tt?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}(r,n,i,o),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=i,n=o),a=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var a;if(null==t)a=r*Ct,n.point(-Mt,a),n.point(0,a),n.point(Mt,a),n.point(Mt,0),n.point(Mt,-a),n.point(0,-a),n.point(-Mt,-a),n.point(-Mt,0),n.point(-Mt,a);else if(y(t[0]-e[0])>Tt){var i=t[0]0,n=y(e)>Tt;return Jr(a,(function(t){var e,s,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,d){var h,p=[f,d],g=a(f,d),v=r?g?0:o(f,d):g?o(f+(f<0?Mt:-Mt),d):0;if(!e&&(u=l=g)&&t.lineStart(),g!==l&&(h=i(e,p),(Nr(e,h)||Nr(p,h))&&(p[0]+=Tt,p[1]+=Tt,g=a(p[0],p[1]))),g!==l)c=0,g?(t.lineStart(),h=i(p,e),t.point(h[0],h[1])):(h=i(e,p),t.point(h[0],h[1]),t.lineEnd()),e=h;else if(n&&e&&r^g){var m;v&s||!(m=i(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&&Nr(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}}}),Nn(t,6*Lt),r?[0,-t]:[-Mt,t-Mt]);function a(t,r){return Math.cos(t)*Math.cos(r)>e}function i(t,r,n){var a=[1,0,0],i=Rr(Or(t),Or(r)),o=Dr(i,i),s=i[0],l=o-s*s;if(!l)return!n&&t;var u=e*o/l,c=-e*s/l,f=Rr(a,i),d=Pr(a,u);Ir(d,Pr(i,c));var h=f,p=Dr(d,h),g=Dr(h,h),v=p*p-g*(Dr(d,d)-1);if(!(v<0)){var m=Math.sqrt(v),b=Pr(h,(-p-m)/g);if(Ir(b,d),b=zr(b),!n)return b;var x,_=t[0],w=r[0],A=t[1],T=r[1];w<_&&(x=_,_=w,w=x);var k=w-_,M=y(k-Mt)0^b[1]<(y(b[0]-_)Mt^(_<=b[0]&&b[0]<=w)){var E=Pr(h,(-p+m)/g);return Ir(E,d),[b,zr(E)]}}}function o(e,n){var a=r?t:Mt-t,i=0;return e<-a?i|=1:e>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(t,e,r,n){return function(a){var i,o=a.a,s=a.b,l=o.x,u=o.y,c=0,f=1,d=s.x-l,h=s.y-u;if(i=t-l,d||!(i>0)){if(i/=d,d<0){if(i0){if(i>f)return;i>c&&(c=i)}if(i=r-l,d||!(i<0)){if(i/=d,d<0){if(i>f)return;i>c&&(c=i)}else if(d>0){if(i0)){if(i/=h,h<0){if(i0){if(i>f)return;i>c&&(c=i)}if(i=n-u,h||!(i<0)){if(i/=h,h<0){if(i>f)return;i>c&&(c=i)}else if(h>0){if(i0&&(a.a={x:l+c*d,y:u+c*h}),f<1&&(a.b={x:l+f*d,y:u+f*h}),a}}}}}}function nn(e,r,n,a){return function(l){var u,c,f,d,h,p,g,v,m,y,b,x=l,_=$r(),w=rn(e,r,n,a),A={point:M,lineStart:function(){A.point=E,c&&c.push(f=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){u&&(E(d,h),p&&m&&_.rejoin(),u.push(_.buffer()));A.point=M,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],a=0;an&&Rt(u,i,t)>0&&++e:i[1]<=n&&Rt(u,i,t)<0&&--e,u=i;return 0!==e}([e,a]),n=b&&r,i=u.length;(n||i)&&(l.polygonStart(),n&&(l.lineStart(),T(null,null,1,l),l.lineEnd()),i&&Wr(u,o,r,T,l),l.polygonEnd()),u=c=f=null}};function T(t,o,l,u){var c=0,f=0;if(null==t||(c=i(t,l))!==(f=i(o,l))||s(t,o)<0^l>0)do{u.point(0===c||3===c?e:n,c>1?a:r)}while((c=(c+l+4)%4)!==f);else u.point(o[0],o[1])}function k(t,i){return e<=t&&t<=n&&r<=i&&i<=a}function M(t,e){k(t,e)&&l.point(t,e)}function E(t,e){var r=k(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(c&&f.push([t,e]),y)d=t,h=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 i(t,a){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:a>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=i(t,1),n=i(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=Mt/3,n=Ln(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*Mt/180,r=t[1]*Mt/180):[e/Mt*180,r/Mt*180]},a}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(t,e){var r=Math.sqrt(a-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),i-r*Math.cos(t)]}return o.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/n,Pt((a-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,a,i,o={stream:function(t){return a&&(a.valid=!1),(a=i(t)).valid=!0,a},extent:function(s){return arguments.length?(i=nn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),a&&(a.valid=!1,a=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,a,i=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 i=t[0],o=t[1];return e=null,r(i,o),e||(n(i,o),e)||a(i,o),e}return u.invert=function(t){var e=i.scale(),r=i.translate(),n=(t[0]-r[0])/e,a=(t[1]-r[1])/e;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?s:i).invert(t)},u.stream=function(t){var e=i.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},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?(i.precision(t),o.precision(t),s.precision(t),u):i.precision()},u.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),s.scale(t),u.translate(i.translate())):i.scale()},u.translate=function(t){if(!arguments.length)return i.translate();var e=i.scale(),c=+t[0],f=+t[1];return r=i.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+Tt,f+.12*e+Tt],[c-.214*e-Tt,f+.234*e-Tt]]).stream(l).point,a=s.translate([c-.205*e,f+.212*e]).clipExtent([[c-.214*e+Tt,f+.166*e+Tt],[c-.115*e-Tt,f+.234*e-Tt]]).stream(l).point,u},u.scale(1070)};var sn,ln,un,cn,fn,dn,hn={point:I,lineStart:I,lineEnd:I,polygonStart:function(){ln=0,hn.lineStart=pn},polygonEnd:function(){hn.lineStart=hn.lineEnd=hn.point=I,sn+=y(ln/2)}};function pn(){var t,e,r,n;function a(t,e){ln+=n*t-r*e,r=t,n=e}hn.point=function(i,o){hn.point=a,t=r=i,e=n=o},hn.lineEnd=function(){a(t,e)}}var gn={point:function(t,e){tfn&&(fn=t);edn&&(dn=e)},lineStart:I,lineEnd:I,polygonStart:I,polygonEnd:I};function vn(){var t=mn(4.5),e=[],r={point:n,lineStart:function(){r.point=a},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 a(t,n){e.push("M",t,",",n),r.point=i}function i(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 a=r-t,i=n-e,o=Math.sqrt(a*a+i*i);wr+=o*(t+r)/2,Ar+=o*(e+n)/2,Tr+=o,xn(t=r,e=n)}bn.point=function(n,a){bn.point=r,xn(t=n,e=a)}}function wn(){bn.point=xn}function An(){var t,e,r,n;function a(t,e){var a=t-r,i=e-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+t)/2,Ar+=o*(n+e)/2,Tr+=o,kr+=(o=n*t-r*e)*(r+t),Mr+=o*(n+e),Er+=3*o,xn(r=t,n=e)}bn.point=function(i,o){bn.point=a,xn(t=r=i,e=n=o)},bn.lineEnd=function(){a(t,e)}}function Tn(t){var e=4.5,r={point:n,lineStart:function(){r.point=a},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,Et)}function a(e,n){t.moveTo(e,n),r.point=i}function i(e,r){t.lineTo(e,r)}function o(){r.point=n}function s(){t.closePath()}return r}function kn(t){var e=.5,r=Math.cos(30*Lt),n=16;function a(t){return(n?o:i)(t)}function i(e){return Sn(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,a,i,o,l,u,c,f,d,h,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,a){var i=Or([r,a]),o=t(r,a);s(f,d,c,h,p,g,f=o[0],d=o[1],c=r,h=i[0],p=i[1],g=i[2],n,e),e.point(f,d)}function x(){v.point=m,e.lineEnd()}function _(){y(),v.point=w,v.lineEnd=A}function w(t,e){b(r=t,e),a=f,i=d,o=h,l=p,u=g,v.point=b}function A(){s(f,d,c,h,p,g,a,i,r,o,l,u,n,e),v.lineEnd=x,x()}return v}function s(n,a,i,o,l,u,c,f,d,h,p,g,v,m){var b=c-n,x=f-a,_=b*b+x*x;if(_>4*e&&v--){var w=o+h,A=l+p,T=u+g,k=Math.sqrt(w*w+A*A+T*T),M=Math.asin(T/=k),E=y(y(T)-1)e||y((b*O+x*D)/_-.5)>.3||o*h+l*p+u*g0&&16,a):Math.sqrt(e)},a}function Mn(t){var e=kn((function(e,r){return t([e*Ot,r*Ot])}));return function(t){return On(e(t))}}function En(t){this.stream=t}function Sn(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 Cn(t){return Ln((function(){return t}))()}function Ln(e){var r,n,a,i,o,s,l=kn((function(t,e){return[(t=r(t,e))[0]*u+i,o-t[1]*u]})),u=150,c=480,f=250,d=0,h=0,p=0,g=0,v=0,m=tn,y=L,b=null,x=null;function _(t){return[(t=a(t[0]*Lt,t[1]*Lt))[0]*u+i,o-t[1]*u]}function w(t){return(t=a.invert((t[0]-i)/u,(o-t[1])/u))&&[t[0]*Ot,t[1]*Ot]}function A(){a=qr(n=In(p,g,v),r);var t=r(d,h);return i=c-t[0]*u,o=f+t[1]*u,T()}function T(){return s&&(s.valid=!1,s=null),_}return _.stream=function(t){return s&&(s.valid=!1),(s=On(m(n,l(y(t))))).valid=!0,s},_.clipAngle=function(t){return arguments.length?(m=null==t?(b=t,tn):en((b=+t)*Lt),T()):b},_.clipExtent=function(t){return arguments.length?(x=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):L,T()):x},_.scale=function(t){return arguments.length?(u=+t,A()):u},_.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],A()):[c,f]},_.center=function(t){return arguments.length?(d=t[0]%360*Lt,h=t[1]%360*Lt,A()):[d*Ot,h*Ot]},_.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*Ot,g*Ot,v*Ot]},t.rebind(_,l,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,A()}}function On(t){return Sn(t,(function(e,r){t.point(e*Lt,r*Lt)}))}function Dn(t,e){return[t,e]}function Rn(t,e){return[t>Mt?t-Et:t<-Mt?t+Et:t,e]}function In(t,e,r){return t?e||r?qr(Fn(t),zn(e,r)):Fn(t):e||r?zn(e,r):Rn}function Pn(t){return function(e,r){return[(e+=t)>Mt?e-Et:e<-Mt?e+Et:e,r]}}function Fn(t){var e=Pn(t);return e.invert=Pn(-t),e}function zn(t,e){var r=Math.cos(t),n=Math.sin(t),a=Math.cos(e),i=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*a-c*i,s*r-u*n),Pt(c*a+l*i)]}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*a-l*i;return[Math.atan2(l*a+u*i,s*r+c*n),Pt(c*r-s*n)]},o}function Nn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,s){var l=o*e;null!=a?(a=Bn(r,a),i=Bn(r,i),(o>0?ai)&&(a+=o*Et)):(a=t+o*Et,i=t-.5*l);for(var u,c=a;o>0?c>i:c2?t[2]*Lt:0),e.invert=function(e){return(e=t.invert(e[0]*Lt,e[1]*Lt))[0]*=Ot,e[1]*=Ot,e},e},Rn.invert=Dn,t.geo.circle=function(){var t,e,r=[0,0],n=6;function a(){var t="function"==typeof r?r.apply(this,arguments):r,n=In(-t[0]*Lt,-t[1]*Lt,0).invert,a=[];return e(null,null,1,{point:function(t,e){a.push(t=n(t,e)),t[0]*=Ot,t[1]*=Ot}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(t){return arguments.length?(r=t,a):r},a.angle=function(r){return arguments.length?(e=Nn((t=+r)*Lt,n*Lt),a):t},a.precision=function(r){return arguments.length?(e=Nn(t*Lt,(n=+r)*Lt),a):n},a.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Lt,a=t[1]*Lt,i=e[1]*Lt,o=Math.sin(n),s=Math.cos(n),l=Math.sin(a),u=Math.cos(a),c=Math.sin(i),f=Math.cos(i);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,a,i,o,s,l,u,c,f,d,h=10,p=h,g=90,v=360,m=2.5;function b(){return{type:"MultiLineString",coordinates:x()}}function x(){return t.range(Math.ceil(a/g)*g,n,g).map(f).concat(t.range(Math.ceil(l/v)*v,s,v).map(d)).concat(t.range(Math.ceil(r/h)*h,e,h).filter((function(t){return y(t%g)>Tt})).map(u)).concat(t.range(Math.ceil(o/p)*p,i,p).filter((function(t){return y(t%v)>Tt})).map(c))}return b.lines=function(){return x().map((function(t){return{type:"LineString",coordinates:t}}))},b.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(s).slice(1),f(n).reverse().slice(1),d(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?(a=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],a>n&&(t=a,a=n,n=t),l>s&&(t=l,l=s,s=t),b.precision(m)):[[a,l],[n,s]]},b.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],i=+t[1][1],r>e&&(t=r,r=e,e=t),o>i&&(t=o,o=i,i=t),b.precision(m)):[[r,o],[e,i]]},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?(h=+t[0],p=+t[1],b):[h,p]},b.precision=function(t){return arguments.length?(m=+t,u=jn(o,i,90),c=Un(r,e,m),f=jn(l,s,90),d=Un(a,n,m),b):m},b.majorExtent([[-180,-90+Tt],[180,90-Tt]]).minorExtent([[-180,-80-Tt],[180,80+Tt]])},t.geo.greatArc=function(){var e,r,n=Vn,a=Hn;function i(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,i):n},i.target=function(t){return arguments.length?(a=t,r="function"==typeof t?null:t,i):a},i.precision=function(){return arguments.length?i:0},i},t.geo.interpolate=function(t,e){return r=t[0]*Lt,n=t[1]*Lt,a=e[0]*Lt,i=e[1]*Lt,o=Math.cos(n),s=Math.sin(n),l=Math.cos(i),u=Math.sin(i),c=o*Math.cos(r),f=o*Math.sin(r),d=l*Math.cos(a),h=l*Math.sin(a),p=2*Math.asin(Math.sqrt(zt(i-n)+o*l*zt(a-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*d,a=r*f+e*h,i=r*s+e*u;return[Math.atan2(a,n)*Ot,Math.atan2(i,Math.sqrt(n*n+a*a))*Ot]}:function(){return[r*Ot,n*Ot]}).distance=p,v;var r,n,a,i,o,s,l,u,c,f,d,h,p,g,v},t.geo.length=function(e){return yn=0,t.geo.stream(e,Gn),yn};var Gn={sphere:I,point:I,lineStart:function(){var t,e,r;function n(n,a){var i=Math.sin(a*=Lt),o=Math.cos(a),s=y((n*=Lt)-t),l=Math.cos(s);yn+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*i-e*o*l)*s),e*i+r*o*l),t=n,e=i,r=o}Gn.point=function(a,i){t=a*Lt,e=Math.sin(i*=Lt),r=Math.cos(i),Gn.point=n},Gn.lineEnd=function(){Gn.point=Gn.lineEnd=I}},lineEnd:I,polygonStart:I,polygonEnd:I};function qn(t,e){function r(e,r){var n=Math.cos(e),a=Math.cos(r),i=t(n*a);return[i*a*Math.sin(e),i*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),a=e(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(t*i,n*o),Math.asin(n&&r*i/n)]},r}var Xn=qn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Cn(Xn)}).raw=Xn;var Wn=qn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),L);function Yn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(Mt/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),i=r*Math.pow(n(t),a)/a;if(!a)return Qn;function o(t,e){i>0?e<-Ct+Tt&&(e=-Ct+Tt):e>Ct-Tt&&(e=Ct-Tt);var r=i/Math.pow(n(e),a);return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}return o.invert=function(t,e){var r=i-e,n=Dt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ct]},o}function Zn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/n+t;if(y(n)1&&Rt(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Cn(ta)}).raw=ta,ea.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=$n(ea),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=ea,t.geom={},t.geom.hull=function(t){var e=ra,r=na;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,a=pe(e),i=pe(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)h.push(t[s[u[n]][2]]);for(n=+f;nTt)s=s.L;else{if(!((a=i-Aa(s,o))>Tt)){n>-Tt?(e=s.P,r=s):a>-Tt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=ya(t);if(da.insert(e,l),e||r){if(e===r)return Sa(e),r=ya(e.site),da.insert(l,r),l.edge=r.edge=Oa(e.site,l.site),Ea(e),void Ea(r);if(r){Sa(e),Sa(r);var u=e.site,c=u.x,f=u.y,d=t.x-c,h=t.y-f,p=r.site,g=p.x-c,v=p.y-f,m=2*(d*v-h*g),y=d*d+h*h,b=g*g+v*v,x={x:(v*y-h*b)/m+c,y:(d*b-g*y)/m+f};Ra(r.edge,u,p,x),l.edge=Oa(u,t,null,x),r.edge=Oa(t,p,null,x),Ea(e),Ea(r)}else l.edge=Oa(e.site,l.site)}}function wa(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)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/i-1/u,d=c/u;return f?(-d+Math.sqrt(d*d-2*f*(c*c/(-2*u)-l+u/2+a-i/2)))/f+n:(n+s)/2}function Aa(t,e){var r=t.N;if(r)return wa(r,e);var n=t.site;return n.y===e?n.x:1/0}function Ta(t){this.site=t,this.edges=[]}function ka(t,e){return e.angle-t.angle}function Ma(){Fa(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ea(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,a=t.site,i=r.site;if(n!==i){var o=a.x,s=a.y,l=n.x-o,u=n.y-s,c=i.x-o,f=2*(l*(v=i.y-s)-u*c);if(!(f>=-kt)){var d=l*l+u*u,h=c*c+v*v,p=(v*d-u*h)/f,g=(l*h-c*d)/f,v=g+s,m=va.pop()||new Ma;m.arc=t,m.site=a,m.x=p+o,m.y=v+Math.sqrt(p*p+g*g),m.cy=v,t.circle=m;for(var y=null,b=pa._;b;)if(m.y=s)return;if(d>p){if(i){if(i.y>=u)return}else i={x:v,y:l};r={x:v,y:u}}else{if(i){if(i.y1)if(d>p){if(i){if(i.y>=u)return}else i={x:(l-a)/n,y:l};r={x:(u-a)/n,y:u}}else{if(i){if(i.y=s)return}else i={x:o,y:n*o+a};r={x:s,y:n*s+a}}else{if(i){if(i.xTt||y(a-r)>Tt)&&(s.splice(o,0,new Ia(Da(i.site,c,y(n-f)Tt?{x:f,y:y(e-f)Tt?{x:y(r-p)Tt?{x:d,y:y(e-d)Tt?{x:y(r-h)=r&&u.x<=a&&u.y>=n&&u.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=t[s]})),e}function s(t){return t.map((function(t,e){return{x:Math.round(n(t,e)/Tt)*Tt,y:Math.round(a(t,e)/Tt)*Tt,i:e}}))}return o.links=function(t){return ja(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 ja(s(t)).cells.forEach((function(r,n){for(var a,i,o,s,l=r.site,u=r.edges.sort(ka),c=-1,f=u.length,d=u[f-1].edge,h=d.l===l?d.r:d.l;++ci||f>o||d=_)<<1|e>=x,A=w+4;wi&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:Za(r,n)})),i=$a.lastIndex;return ig&&(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-h,A=v-p;function T(t,e,r,n,a,i,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)k(t,e,r,n,a,i,o,s);else{var c=t.point;t.x=t.y=t.point=null,k(t,c,l,u,a,i,o,s),k(t,e,r,n,a,i,o,s)}else t.x=r,t.y=n,t.point=e}else k(t,e,r,n,a,i,o,s)}function k(t,e,r,n,a,i,o,s){var l=.5*(a+o),u=.5*(i+s),c=r>=l,f=n>=u,d=f<<1|c;t.leaf=!1,c?a=l:o=l,f?i=u:s=u,T(t=t.nodes[d]||(t.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,a,i,o,s)}w>A?v=p+w:g=h+A;var M={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){T(M,t,+m(t,++f),+b(t,f),h,p,g,v)},visit:function(t){qa(t,M,h,p,g,v)},find:function(t){return Xa(M,t[0],t[1],h,p,g,v)}};if(f=-1,null==e){for(;++f=0&&!(n=t.interpolators[a](e,r)););return n}function ti(t,e){var r,n=[],a=[],i=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function ii(t){return function(e){return 1-t(1-e)}}function oi(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function si(t){return t*t}function li(t){return t*t*t}function ui(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ci(t){return 1-Math.cos(t*Ct)}function fi(t){return Math.pow(2,10*(t-1))}function di(t){return 1-Math.sqrt(1-t*t)}function hi(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 pi(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function gi(t){var e,r,n,a=[t.a,t.b],i=[t.c,t.d],o=mi(a),s=vi(a,i),l=mi(((e=i)[0]+=(n=-s)*(r=a)[0],e[1]+=n*r[1],e))||0;a[0]*i[1]=0?t.slice(0,e):t,a=e>=0?t.slice(e+1):"in";return n=ri.get(n)||ei,ai((a=ni.get(a)||L)(n.apply(null,r.call(arguments,1))))},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,a=e.c,i=e.l,o=r.h-n,s=r.c-a,l=r.l-i;isNaN(s)&&(s=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Yt(n+o*t,a+s*t,i+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,a=e.s,i=e.l,o=r.h-n,s=r.s-a,l=r.l-i;isNaN(s)&&(s=0,a=isNaN(a)?r.s:a);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,a+s*t,i+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,a=e.a,i=e.b,o=r.l-n,s=r.a-a,l=r.b-i;return function(t){return $t(n+o*t,a+s*t,i+l*t)+""}},t.interpolateRound=pi,t.transform=function(e){var r=a.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 gi(e?e.matrix:yi)})(e)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function bi(t){return t.length?t.pop()+",":""}function xi(e,r){var n=[],a=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Za(t[0],e[0])},{i:a-2,x:Za(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,a),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(bi(r)+"rotate(",null,")")-2,x:Za(t,e)})):e&&r.push(bi(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,a),function(t,e,r,n){t!==e?n.push({i:r.push(bi(r)+"skewX(",null,")")-2,x:Za(t,e)}):e&&r.push(bi(r)+"skewX("+e+")")}(e.skew,r.skew,n,a),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(bi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Za(t[0],e[0])},{i:a-2,x:Za(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(bi(r)+"scale("+e+")")}(e.scale,r.scale,n,a),e=r=null,function(t){for(var e,r=-1,i=a.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=we(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(a[n])}function Ii(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(c=u[l]),c.parent=i,c.depth=i.depth+1;r&&(i.value=0),i.children=u}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Ii(a,(function(e){var n,a;t&&(n=e.children)&&n.sort(t),r&&(a=e.parent)&&(a.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&&(Ri(t,(function(t){t.children&&(t.value=0)})),Ii(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 a=e.call(this,t,n);return function t(e,r,n,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.length)){var o,s,l,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;ra&&(n=r,a=e);return n}function Yi(t){return t.reduce(Zi,0)}function Zi(t,e){return t+e[1]}function Ji(t,e){return Qi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Qi(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,i=[];++r<=e;)i[r]=a*r+n;return i}function $i(e){return[t.min(e),t.max(e)]}function Ki(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(t,e){var r=e.x-t.x,n=e.y-t.y,a=t.r+e.r;return.999*a*a>r*r+n*n}function no(t){if((e=t.children)&&(l=e.length)){var e,r,n,a,i,o,s,l,u=1/0,c=-1/0,f=1/0,d=-1/0;if(e.forEach(ao),(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(oo(r,n,a=e[2]),b(a),to(r,a),r._pack_prev=a,to(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=f[0]&&l<=f[1]&&((s=u[t.bisect(d,l,1,p)-1]).y+=g,s.push(i[o]));return u}return i.value=function(t){return arguments.length?(r=t,i):r},i.range=function(t){return arguments.length?(n=pe(t),i):n},i.bins=function(t){return arguments.length?(a="number"==typeof t?function(e){return Qi(e,t)}:pe(t),i):a},i.frequency=function(t){return arguments.length?(e=!!t,i):e},i},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Ki),n=0,a=[1,1];function i(t,i){var o=r.call(this,t,i),s=o[0],l=a[0],u=a[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,Ii(s,(function(t){t.r=+c(t.value)})),Ii(s,no),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;Ii(s,(function(t){t.r+=f})),Ii(s,no),Ii(s,(function(t){t.r-=f}))}return function t(e,r,n,a){var i=e.children;if(e.x=r+=a*e.x,e.y=n+=a*e.y,e.r*=a,i)for(var o=-1,s=i.length;++oh.x&&(h=t),t.depth>p.depth&&(p=t)}));var g=r(d,h)/2-d.x,v=n[0]/(h.x+r(h,d)/2+g),m=n[1]/(p.depth||1);Ri(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,a=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,a=t.children,i=a.length;for(;--i>=0;)(e=a[i]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var i=(e[0].z+e[e.length-1].z)/2;a?(t.z=a.z+r(t._,a._),t.m=t.z-i):t.z=i}else a&&(t.z=a.z+r(t._,a._));t.parent.A=function(t,e,n){if(e){for(var a,i=t,o=t,s=e,l=i.parent.children[0],u=i.m,c=o.m,f=s.m,d=l.m;s=uo(s),i=lo(i),s&&i;)l=lo(l),(o=uo(o)).a=t,(a=s.z+f-i.z-u+r(s._,i._))>0&&(co(fo(s,t,n),t,a),u+=a,c+=a),f+=s.m,u+=i.m,d+=l.m,c+=o.m;s&&!uo(o)&&(o.t=s,o.m+=f-c),i&&!lo(l)&&(l.t=i,l.m+=u-d,n=t)}return n}(t,a,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 i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t)?l:null,i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null==(n=t)?null:l,i):a?n:null},Di(i,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],a=!1;function i(i,o){var s,l=e.call(this,i,o),u=l[0],c=0;Ii(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),d=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(u),h=f.x-r(f,d)/2,p=d.x+r(d,f)/2;return Ii(u,a?function(t){t.x=(t.x-u.x)*n[0],t.y=(u.y-t.y)*n[1]}:function(t){t.x=(t.x-h)/(p-h)*n[0],t.y=(1-(u.y?t.y/u.y:1))*n[1]}),l}return i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t),i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null!=(n=t),i):a?n:null},Di(i,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=ho,s=!1,l="squarify",u=.5*(1+Math.sqrt(5));function c(t,e){for(var r,n,a=-1,i=t.length;++a0;)s.push(r=u[a-1]),s.area+=r.area,"squarify"!==l||(n=h(s,g))<=d?(u.pop(),d=n):(s.area-=s.pop().area,p(s,g,i,!1),g=Math.min(i.dx,i.dy),s.length=s.area=0,d=1/0);s.length&&(p(s,g,i,!0),s.length=s.area=0),e.forEach(f)}}function d(t){var e=t.children;if(e&&e.length){var r,n=o(t),a=e.slice(),i=[];for(c(a,n.dx*n.dy/t.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(p(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);e.forEach(d)}}function h(t,e){for(var r,n=t.area,a=0,i=1/0,o=-1,s=t.length;++oa&&(a=r));return e*=e,(n*=n)?Math.max(e*a*u/n,n/(e*i*u)):1/0}function p(t,e,r,a){var i,o=-1,s=t.length,l=r.x,u=r.y,c=e?n(t.area/e):0;if(e==r.dx){for((a||c>r.dy)&&(c=r.dy);++or.dx)&&(c=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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?_o:mo,s=a?wi:_i;return i=t(e,r,s,n),o=t(r,e,s,Ka),l}function l(t){return i(t)}return 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(pi)},l.clamp=function(t){return arguments.length?(a=t,s()):a},l.interpolate=function(t){return arguments.length?(n=t,s()):n},l.ticks=function(t){return ko(e,t)},l.tickFormat=function(t,r){return Mo(e,t,r)},l.nice=function(t){return Ao(e,t),s()},l.copy=function(){return t(e,r,n,a)},s()}([0,1],[0,1],Ka,!1)};var Eo={s:1,g:1,p:1,r:1,e:1};function So(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,a,i){function o(t){return(a?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return a?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return r(o(t))}return l.invert=function(t){return s(r.invert(t))},l.domain=function(t){return arguments.length?(a=t[0]>=0,r.domain((i=t.map(Number)).map(o)),l):i},l.base=function(t){return arguments.length?(n=+t,r.domain(i.map(o)),l):n},l.nice=function(){var t=yo(i.map(o),a?Math:Lo);return r.domain(t),i=t.map(s),l},l.ticks=function(){var t=go(i),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(a){for(;u0;d--)e.push(s(u)*d);for(u=0;e[u]l;c--);e=e.slice(u,c)}return e},l.tickFormat=function(e,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=t.format(r));var a=Math.max(1,n*e/l.ticks().length);return function(t){var e=t/s(Math.round(o(t)));return e*n0?a[t-1]:r[0],tf?0:1;if(u=St)return l(u,h)+(s?l(s,1-h):"")+"Z";var p,g,v,m,y,b,x,_,w,A,T,k,M=0,E=0,S=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===zo?Math.sqrt(s*s+u*u):+n.apply(this,arguments),h||(E*=-1),u&&(E=Pt(v/u*Math.sin(m))),s&&(M=Pt(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 C=Math.abs(f-c-2*E)<=Mt?0:1;if(E&&Ho(y,b,x,_)===h^C){var L=(c+f)/2;y=u*Math.cos(L),b=u*Math.sin(L),x=_=null}}else y=b=0;if(s){w=s*Math.cos(f-M),A=s*Math.sin(f-M),T=s*Math.cos(c+M),k=s*Math.sin(c+M);var O=Math.abs(c-f+2*M)<=Mt?0:1;if(M&&Ho(w,A,T,k)===1-h^O){var D=(c+f)/2;w=s*Math.cos(D),A=s*Math.sin(D),T=k=null}}else w=A=0;if(d>Tt&&(p=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function Go(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],s=(a?n:-n)/Math.sqrt(i*i+o*o),l=s*o,u=-s*i,c=t[0]+l,f=t[1]+u,d=e[0]+l,h=e[1]+u,p=(c+d)/2,g=(f+h)/2,v=d-c,m=h-f,y=v*v+m*m,b=r-n,x=c*h-d*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,T=(x*m+v*_)/y,k=(-x*v+m*_)/y,M=w-p,E=A-g,S=T-p,C=k-g;return M*M+E*E>S*S+C*C&&(w=T,A=k),[[w-l,A-u],[w*r/b,A*r/b]]}function qo(t){var e=ra,r=na,n=Xr,a=Wo,i=a.key,o=.7;function s(i){var s,l=[],u=[],c=-1,f=i.length,d=pe(e),h=pe(r);function p(){l.push("M",a(t(u),o))}for(;++c1&&a.push("H",n[0]);return a.join("")},"step-before":Zo,"step-after":Jo,basis:Ko,"basis-open":function(t){if(t.length<4)return Wo(t);var e,r=[],n=-1,a=t.length,i=[0],o=[0];for(;++n<3;)e=t[n],i.push(e[0]),o.push(e[1]);r.push(ts(ns,i)+","+ts(ns,o)),--n;for(;++n9&&(a=3*e/Math.sqrt(a),o[s]=a*r,o[s+1]=a*n));s=-1;for(;++s<=l;)a=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),i.push([a||0,o[s]*a||0]);return i}(t))}});function Wo(t){return t.length>1?t.join("L"):t+"Z"}function Yo(t){return t.join("L")+"Z"}function Zo(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){s=e[1],i=t[l],l++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-s[0])+","+(i[1]-s[1])+","+i[0]+","+i[1];for(var u=2;uMt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return i.radius=function(t){return arguments.length?(r=pe(t),i):r},i.source=function(e){return arguments.length?(t=pe(e),i):t},i.target=function(t){return arguments.length?(e=pe(t),i):e},i.startAngle=function(t){return arguments.length?(n=pe(t),i):n},i.endAngle=function(t){return arguments.length?(a=pe(t),i):a},i},t.svg.diagonal=function(){var t=Vn,e=Hn,r=us;function n(n,a){var i=t.call(this,n,a),o=e.call(this,n,a),s=(i.y+o.y)/2,l=[i,{x:i.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=pe(e),n):t},n.target=function(t){return arguments.length?(e=pe(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=us,n=e.projection;return e.projection=function(t){return arguments.length?n(cs(r=t)):r},e},t.svg.symbol=function(){var t=ds,e=fs;function r(r,n){return(ps.get(t.call(this,r,n))||hs)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=pe(e),r):t},r.size=function(t){return arguments.length?(e=pe(t),r):e},r};var ps=t.map({circle:hs,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*vs)),r=e*vs;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/gs),r=e*gs/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/gs),r=e*gs/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ps.keys();var gs=Math.sqrt(3),vs=Math.tan(30*Lt);X.transition=function(t){for(var e,r,n=xs||++As,a=Ms(t),i=[],o=_s||{time:Date.now(),ease:ui,delay:0,duration:250},s=-1,l=this.length;++s0;)u[--d].call(t,o);if(i>=1)return f.event&&f.event.end.call(t,t.__data__,e),--c.count?delete c[n]:delete t[r],1}f||(i=a.time,o=we((function(t){var e=f.delay;if(o.t=e+i,e<=t)return d(t-e);o.c=d}),0,i),f=c[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++c.count)}ws.call=X.call,ws.empty=X.empty,ws.node=X.node,ws.size=X.size,t.transition=function(e,r){return e&&e.transition?xs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.select=function(t){var e,r,n,a=this.id,i=this.namespace,o=[];t=W(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(_)&&a,A=!/^(e|w)$/.test(_)&&i,T=y.classed("extent"),k=xt(m),M=t.mouse(m),E=t.select(o(m)).on("keydown.brush",L).on("keyup.brush",O);if(t.event.changedTouches?E.on("touchmove.brush",D).on("touchend.brush",I):E.on("mousemove.brush",D).on("mouseup.brush",I),x.interrupt().selectAll("*").interrupt(),T)M[0]=s[0]-M[0],M[1]=l[0]-M[1];else if(_){var S=+/w$/.test(_),C=+/^n/.test(_);v=[s[1-S]-M[0],l[1-C]-M[1]],M[0]=s[S],M[1]=l[C]}else t.event.altKey&&(f=M.slice());function L(){32==t.event.keyCode&&(T||(f=null,M[0]-=s[1],M[1]-=l[1],T=2),z())}function O(){32==t.event.keyCode&&2==T&&(M[0]+=s[1],M[1]+=l[1],T=0,z())}function D(){var e=t.mouse(m),r=!1;v&&(e[0]+=v[0],e[1]+=v[1]),T||(t.event.altKey?(f||(f=[(s[0]+s[1])/2,(l[0]+l[1])/2]),M[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Bs(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Bs(+e+1);return e}}:t))},a.ticks=function(t,e){var r=go(a.domain()),n=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Bs(+r[1]+1),e<1?1:e)},a.tickFormat=function(){return n},a.copy=function(){return Ns(e.copy(),r,n)},wo(a,e)}function Bs(t){return new Date(t)}Is.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?zs:Fs,zs.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},zs.toString=Fs.toString,De.second=Fe((function(t){return new Re(1e3*Math.floor(t/1e3))}),(function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))}),(function(t){return t.getSeconds()})),De.seconds=De.second.range,De.seconds.utc=De.second.utc.range,De.minute=Fe((function(t){return new Re(6e4*Math.floor(t/6e4))}),(function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))}),(function(t){return t.getMinutes()})),De.minutes=De.minute.range,De.minutes.utc=De.minute.utc.range,De.hour=Fe((function(t){var e=t.getTimezoneOffset()/60;return new Re(36e5*(Math.floor(t/36e5-e)+e))}),(function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))}),(function(t){return t.getHours()})),De.hours=De.hour.range,De.hours.utc=De.hour.utc.range,De.month=Fe((function(t){return(t=De.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),De.months=De.month.range,De.months.utc=De.month.utc.range;var js=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[De.second,1],[De.second,5],[De.second,15],[De.second,30],[De.minute,1],[De.minute,5],[De.minute,15],[De.minute,30],[De.hour,1],[De.hour,3],[De.hour,6],[De.hour,12],[De.day,1],[De.day,2],[De.week,1],[De.month,1],[De.month,3],[De.year,1]],Vs=Is.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]]),Hs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Bs)},floor:L,ceil:L};Us.year=De.year,De.scale=function(){return Ns(t.scale.linear(),Us,Vs)};var Gs=Us.map((function(t){return[t[0].utc,t[1]]})),qs=Ps.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 Xs(t){return JSON.parse(t.responseText)}function Ws(t){var e=a.createRange();return e.selectNode(a.body),e.createContextualFragment(t.responseText)}Gs.year=De.year.utc,De.scale.utc=function(){return Ns(t.scale.linear(),Gs,qs)},t.text=ge((function(t){return t.responseText})),t.json=function(t,e){return ve(t,"application/json",Xs,e)},t.html=function(t,e){return ve(t,"text/html",Ws,e)},t.xml=ge((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],87:[function(t,e,r){e.exports=function(){for(var t=0;ts*l){var h=(d-f)/s;i[c]=1e3*h}}return i}function o(t){for(var e=[],r=t[0];r<=t[1];r++)for(var n=String.fromCharCode(r),a=t[0];a>>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),a=1048575&n;return 2146435072&n&&(a+=1<<20),[r,a]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:52}],90:[function(t,e,r){var n=t("abs-svg-path"),a=t("normalize-svg-path"),i={M:"moveTo",C:"bezierCurveTo"};e.exports=function(t,e){t.beginPath(),a(n(e)).forEach((function(e){var r=e[0],n=e.slice(1);t[i[r]].apply(t,n)})),t.closePath()}},{"abs-svg-path":12,"normalize-svg-path":260}],91:[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}}},{}],92:[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;n80*r){n=l=t[0],s=u=t[1];for(var x=r;xl&&(l=c),h>u&&(u=h);p=0!==(p=Math.max(l-n,u-s))?1/p:0}return o(y,b,r,n,s,p),b}function a(t,e,r,n,a){var i,o;if(a===S(t,e,r,n)>0)for(i=e;i=e;i-=n)o=k(i,t[i],t[i+1],o);return o&&b(o,o.next)&&(M(o),o=o.next),o}function i(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!b(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(M(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,a,f,d){if(t){!d&&f&&function(t,e,r,n){var a=t;do{null===a.z&&(a.z=p(a.x,a.y,e,r,n)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==t);a.prevZ.nextZ=null,a.prevZ=null,function(t){var e,r,n,a,i,o,s,l,u=1;do{for(r=t,t=null,i=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(a=r,r=r.nextZ,s--):(a=n,n=n.nextZ,l--),i?i.nextZ=a:t=a,a.prevZ=i,i=a;r=n}i.nextZ=null,u*=2}while(o>1)}(a)}(t,n,a,f);for(var h,g,v=t;t.prev!==t.next;)if(h=t.prev,g=t.next,f?l(t,n,a,f):s(t))e.push(h.i/r),e.push(t.i/r),e.push(g.i/r),M(t),t=g.next,v=g.next;else if((t=g)===v){d?1===d?o(t=u(i(t),e,r),e,r,n,a,f,2):2===d&&c(t,e,r,n,a,f):o(i(t),e,r,n,a,f,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(y(e,r,n)>=0)return!1;for(var a=t.next.next;a!==t.prev;){if(v(e.x,e.y,r.x,r.y,n.x,n.y,a.x,a.y)&&y(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function l(t,e,r,n){var a=t.prev,i=t,o=t.next;if(y(a,i,o)>=0)return!1;for(var s=a.xi.x?a.x>o.x?a.x:o.x:i.x>o.x?i.x:o.x,c=a.y>i.y?a.y>o.y?a.y:o.y:i.y>o.y?i.y:o.y,f=p(s,l,e,r,n),d=p(u,c,e,r,n),h=t.prevZ,g=t.nextZ;h&&h.z>=f&&g&&g.z<=d;){if(h!==t.prev&&h!==t.next&&v(a.x,a.y,i.x,i.y,o.x,o.y,h.x,h.y)&&y(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,g!==t.prev&&g!==t.next&&v(a.x,a.y,i.x,i.y,o.x,o.y,g.x,g.y)&&y(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;h&&h.z>=f;){if(h!==t.prev&&h!==t.next&&v(a.x,a.y,i.x,i.y,o.x,o.y,h.x,h.y)&&y(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;g&&g.z<=d;){if(g!==t.prev&&g!==t.next&&v(a.x,a.y,i.x,i.y,o.x,o.y,g.x,g.y)&&y(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function u(t,e,r){var n=t;do{var a=n.prev,o=n.next.next;!b(a,o)&&x(a,n,n.next,o)&&A(a,o)&&A(o,a)&&(e.push(a.i/r),e.push(n.i/r),e.push(o.i/r),M(n),M(n.next),n=t=o),n=n.next}while(n!==t);return i(n)}function c(t,e,r,n,a,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&m(l,u)){var c=T(l,u);return l=i(l,l.next),c=i(c,c.next),o(l,e,r,n,a,s),void o(c,e,r,n,a,s)}u=u.next}l=l.next}while(l!==t)}function f(t,e){return t.x-e.x}function d(t,e){if(e=function(t,e){var r,n=e,a=t.x,i=t.y,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=a&&s>o){if(o=s,s===a){if(i===n.y)return n;if(i===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&a!==n.x&&v(ir.x||n.x===r.x&&h(r,n)))&&(r=n,d=l)),n=n.next}while(n!==u);return r}(t,e)){var r=T(e,t);i(e,e.next),i(r,r.next)}}function h(t,e){return y(t.prev,t,e.prev)<0&&y(e.next,t,t.next)<0}function p(t,e,r,n,a){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*a)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*a)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function g(t){var e=t,r=t;do{(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(i-s)-(a-o)*(n-s)>=0}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&x(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(A(t,e)&&A(e,t)&&function(t,e){var r=t,n=!1,a=(t.x+e.x)/2,i=(t.y+e.y)/2;do{r.y>i!=r.next.y>i&&r.next.y!==r.y&&a<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(y(t.prev,t,e.prev)||y(t,e.prev,e))||b(t,e)&&y(t.prev,t,t.next)>0&&y(e.prev,e,e.next)>0)}function y(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,r,n){var a=w(y(t,e,r)),i=w(y(t,e,n)),o=w(y(r,n,t)),s=w(y(r,n,e));return a!==i&&o!==s||(!(0!==a||!_(t,r,e))||(!(0!==i||!_(t,n,e))||(!(0!==o||!_(r,t,n))||!(0!==s||!_(r,e,n)))))}function _(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function w(t){return t>0?1:t<0?-1:0}function A(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function T(t,e){var r=new E(t.i,t.x,t.y),n=new E(e.i,e.x,e.y),a=t.next,i=e.prev;return t.next=e,e.prev=t,r.next=a,a.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function k(t,e,r,n){var a=new E(t,e,r);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function M(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function E(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function S(t,e,r,n){for(var a=0,i=e,o=r-n;i0&&(n+=t[a-1].length,r.holes.push(n))}return r}},{}],94:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var a=0;a=55296&&y<=56319&&(w+=t[++r]),w=A?d.call(A,T,w,g):w,e?(h.value=w,p(v,g,h)):v[g]=w,++g;m=g}if(void 0===m)for(m=o(t.length),e&&(v=new e(m)),r=0;r0?1:-1}},{}],105:[function(t,e,r){"use strict";var n=t("../math/sign"),a=Math.abs,i=Math.floor;e.exports=function(t){return isNaN(t)?0:0!==(t=Number(t))&&isFinite(t)?n(t)*i(a(t)):t}},{"../math/sign":102}],106:[function(t,e,r){"use strict";var n=t("./to-integer"),a=Math.max;e.exports=function(t){return a(0,n(t))}},{"./to-integer":105}],107:[function(t,e,r){"use strict";var n=t("./valid-callable"),a=t("./valid-value"),i=Function.prototype.bind,o=Function.prototype.call,s=Object.keys,l=Object.prototype.propertyIsEnumerable;e.exports=function(t,e){return function(r,u){var c,f=arguments[2],d=arguments[3];return r=Object(a(r)),n(u),c=s(r),d&&c.sort("function"==typeof d?i.call(d,r):void 0),"function"!=typeof t&&(t=c[t]),o.call(t,c,(function(t,n){return l.call(r,t)?o.call(u,f,r[t],t,r,n):e}))}}},{"./valid-callable":124,"./valid-value":126}],108:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.assign:t("./shim")},{"./is-implemented":109,"./shim":110}],109:[function(t,e,r){"use strict";e.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},{}],110:[function(t,e,r){"use strict";var n=t("../keys"),a=t("../valid-value"),i=Math.max;e.exports=function(t,e){var r,o,s,l=i(arguments.length,2);for(t=Object(a(t)),s=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},o=1;o-1}},{}],130:[function(t,e,r){"use strict";var n=Object.prototype.toString,a=n.call("");e.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===a)||!1}},{}],131:[function(t,e,r){"use strict";var n=Object.create(null),a=Math.random;e.exports=function(){var t;do{t=a().toString(36).slice(2)}while(n[t]);return t}},{}],132:[function(t,e,r){"use strict";var n,a=t("es5-ext/object/set-prototype-of"),i=t("es5-ext/string/#/contains"),o=t("d"),s=t("es6-symbol"),l=t("./"),u=Object.defineProperty;n=e.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");l.call(this,t),e=e?i.call(e,"key+value")?"key+value":i.call(e,"key")?"key":"value":"value",u(this,"__kind__",o("",e))},a&&a(n,l),delete n.prototype.constructor,n.prototype=Object.create(l.prototype,{_resolve:o((function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t}))}),u(n.prototype,s.toStringTag,o("c","Array Iterator"))},{"./":135,d:83,"es5-ext/object/set-prototype-of":121,"es5-ext/string/#/contains":127,"es6-symbol":140}],133:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/valid-callable"),i=t("es5-ext/string/is-string"),o=t("./get"),s=Array.isArray,l=Function.prototype.call,u=Array.prototype.some;e.exports=function(t,e){var r,c,f,d,h,p,g,v,m=arguments[2];if(s(t)||n(t)?r="array":i(t)?r="string":t=o(t),a(e),f=function(){d=!0},"array"!==r)if("string"!==r)for(c=t.next();!c.done;){if(l.call(e,m,c.value,f),d)return;c=t.next()}else for(p=t.length,h=0;h=55296&&v<=56319&&(g+=t[++h]),l.call(e,m,g,f),!d);++h);else u.call(t,(function(t){return l.call(e,m,t,f),d}))}},{"./get":134,"es5-ext/function/is-arguments":99,"es5-ext/object/valid-callable":124,"es5-ext/string/is-string":130}],134:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/string/is-string"),i=t("./array"),o=t("./string"),s=t("./valid-iterable"),l=t("es6-symbol").iterator;e.exports=function(t){return"function"==typeof s(t)[l]?t[l]():n(t)?new i(t):a(t)?new o(t):new i(t)}},{"./array":132,"./string":137,"./valid-iterable":138,"es5-ext/function/is-arguments":99,"es5-ext/string/is-string":130,"es6-symbol":140}],135:[function(t,e,r){"use strict";var n,a=t("es5-ext/array/#/clear"),i=t("es5-ext/object/assign"),o=t("es5-ext/object/valid-callable"),s=t("es5-ext/object/valid-value"),l=t("d"),u=t("d/auto-bind"),c=t("es6-symbol"),f=Object.defineProperty,d=Object.defineProperties;e.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");d(this,{__list__:l("w",s(t)),__context__:l("w",e),__nextIndex__:l("w",0)}),e&&(o(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,d(n.prototype,i({_next:l((function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach((function(e,r){e>=t&&(this.__redo__[r]=++e)}),this),this.__redo__.push(t)):f(this,"__redo__",l("c",[t])))})),_onDelete:l((function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(e=this.__redo__.indexOf(t))&&this.__redo__.splice(e,1),this.__redo__.forEach((function(e,r){e>t&&(this.__redo__[r]=--e)}),this)))})),_onClear:l((function(){this.__redo__&&a.call(this.__redo__),this.__nextIndex__=0}))}))),f(n.prototype,c.iterator,l((function(){return this})))},{d:83,"d/auto-bind":82,"es5-ext/array/#/clear":95,"es5-ext/object/assign":108,"es5-ext/object/valid-callable":124,"es5-ext/object/valid-value":126,"es6-symbol":140}],136:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/is-value"),i=t("es5-ext/string/is-string"),o=t("es6-symbol").iterator,s=Array.isArray;e.exports=function(t){return!!a(t)&&(!!s(t)||(!!i(t)||(!!n(t)||"function"==typeof t[o])))}},{"es5-ext/function/is-arguments":99,"es5-ext/object/is-value":115,"es5-ext/string/is-string":130,"es6-symbol":140}],137:[function(t,e,r){"use strict";var n,a=t("es5-ext/object/set-prototype-of"),i=t("d"),o=t("es6-symbol"),s=t("./"),l=Object.defineProperty;n=e.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),s.call(this,t),l(this,"__length__",i("",t.length))},a&&a(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:i((function(){if(this.__list__)return this.__nextIndex__=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r}))}),l(n.prototype,o.toStringTag,i("c","String Iterator"))},{"./":135,d:83,"es5-ext/object/set-prototype-of":121,"es6-symbol":140}],138:[function(t,e,r){"use strict";var n=t("./is-iterable");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},{"./is-iterable":136}],139:[function(t,e,r){(function(n,a){(function(){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -25,37 +25,37 @@ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ -!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():t.ES6Promise=n()}(this,(function(){"use strict";function e(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,o=void 0,s=void 0,l=function(t,e){g[i]=t,g[i+1]=e,2===(i+=2)&&(s?s(v):_())};var u="undefined"!=typeof window?window:void 0,c=u||{},f=c.MutationObserver||c.WebKitMutationObserver,h="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(v,1)}}var g=new Array(1e3);function v(){for(var t=0;te[0]-o[0]/2&&(h=o[0]/2,d+=o[1]);return r}},{"css-font/stringify":76}],158:[function(t,e,r){"use strict";function n(t,e){e||(e={}),("string"==typeof t||Array.isArray(t))&&(e.family=t);var r=Array.isArray(e.family)?e.family.join(", "):e.family;if(!r)throw Error("`family` must be defined");var s=e.size||e.fontSize||e.em||48,l=e.weight||e.fontWeight||"",u=(t=[e.style||e.fontStyle||"",l,s].join(" ")+"px "+r,e.origin||"top");if(n.cache[r]&&s<=n.cache[r].em)return a(n.cache[r],u);var c=e.canvas||n.canvas,f=c.getContext("2d"),h={upper:void 0!==e.upper?e.upper:"H",lower:void 0!==e.lower?e.lower:"x",descent:void 0!==e.descent?e.descent:"p",ascent:void 0!==e.ascent?e.ascent:"h",tittle:void 0!==e.tittle?e.tittle:"i",overshoot:void 0!==e.overshoot?e.overshoot:"O"},d=Math.ceil(1.5*s);c.height=d,c.width=.5*d,f.font=t;var p={top:0};f.clearRect(0,0,d,d),f.textBaseline="top",f.fillStyle="black",f.fillText("H",0,0);var g=i(f.getImageData(0,0,d,d));f.clearRect(0,0,d,d),f.textBaseline="bottom",f.fillText("H",0,d);var v=i(f.getImageData(0,0,d,d));p.lineHeight=p.bottom=d-v+g,f.clearRect(0,0,d,d),f.textBaseline="alphabetic",f.fillText("H",0,d);var m=d-i(f.getImageData(0,0,d,d))-1+g;p.baseline=p.alphabetic=m,f.clearRect(0,0,d,d),f.textBaseline="middle",f.fillText("H",0,.5*d);var y=i(f.getImageData(0,0,d,d));p.median=p.middle=d-y-1+g-.5*d,f.clearRect(0,0,d,d),f.textBaseline="hanging",f.fillText("H",0,.5*d);var b=i(f.getImageData(0,0,d,d));p.hanging=d-b-1+g-.5*d,f.clearRect(0,0,d,d),f.textBaseline="ideographic",f.fillText("H",0,d);var x=i(f.getImageData(0,0,d,d));if(p.ideographic=d-x-1+g,h.upper&&(f.clearRect(0,0,d,d),f.textBaseline="top",f.fillText(h.upper,0,0),p.upper=i(f.getImageData(0,0,d,d)),p.capHeight=p.baseline-p.upper),h.lower&&(f.clearRect(0,0,d,d),f.textBaseline="top",f.fillText(h.lower,0,0),p.lower=i(f.getImageData(0,0,d,d)),p.xHeight=p.baseline-p.lower),h.tittle&&(f.clearRect(0,0,d,d),f.textBaseline="top",f.fillText(h.tittle,0,0),p.tittle=i(f.getImageData(0,0,d,d))),h.ascent&&(f.clearRect(0,0,d,d),f.textBaseline="top",f.fillText(h.ascent,0,0),p.ascent=i(f.getImageData(0,0,d,d))),h.descent&&(f.clearRect(0,0,d,d),f.textBaseline="top",f.fillText(h.descent,0,0),p.descent=o(f.getImageData(0,0,d,d))),h.overshoot){f.clearRect(0,0,d,d),f.textBaseline="top",f.fillText(h.overshoot,0,0);var _=o(f.getImageData(0,0,d,d));p.overshoot=_-m}for(var w in p)p[w]/=s;return p.em=s,n.cache[r]=p,a(p,u)}function a(t,e){var r={};for(var n in"string"==typeof e&&(e=t[e]),t)"em"!==n&&(r[n]=t[n]-e);return r}function i(t){for(var e=t.height,r=t.data,n=3;n0;n-=4)if(0!==r[n])return Math.floor(.25*(n-3)/e)}e.exports=n,n.canvas=document.createElement("canvas"),n.cache={}},{}],159:[function(t,e,r){"use strict";e.exports=function(t){return new s(t||g,null)};function n(t,e,r,n,a,i){this._color=t,this.key=e,this.value=r,this.left=n,this.right=a,this._count=i}function a(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function i(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}var l=s.prototype;function u(t,e){var r;if(e.left&&(r=u(t,e.left)))return r;return(r=t(e.key,e.value))||(e.right?u(t,e.right):void 0)}function c(t,e,r,n){if(e(t,n.key)<=0){var a;if(n.left)if(a=c(t,e,r,n.left))return a;if(a=r(n.key,n.value))return a}if(n.right)return c(t,e,r,n.right)}function f(t,e,r,n,a){var i,o=r(t,a.key),s=r(e,a.key);if(o<=0){if(a.left&&(i=f(t,e,r,n,a.left)))return i;if(s>0&&(i=n(a.key,a.value)))return i}if(s>0&&a.right)return f(t,e,r,n,a.right)}function h(t,e){this.tree=t,this._stack=e}Object.defineProperty(l,"keys",{get:function(){var t=[];return this.forEach((function(e,r){t.push(e)})),t}}),Object.defineProperty(l,"values",{get:function(){var t=[];return this.forEach((function(e,r){t.push(r)})),t}}),Object.defineProperty(l,"length",{get:function(){return this.root?this.root._count:0}}),l.insert=function(t,e){for(var r=this._compare,a=this.root,l=[],u=[];a;){var c=r(t,a.key);l.push(a),u.push(c),a=c<=0?a.left:a.right}l.push(new n(0,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){a=l[f];u[f]<=0?l[f]=new n(a._color,a.key,a.value,l[f+1],a.right,a._count+1):l[f]=new n(a._color,a.key,a.value,a.left,l[f+1],a._count+1)}for(f=l.length-1;f>1;--f){var h=l[f-1];a=l[f];if(1===h._color||1===a._color)break;var d=l[f-2];if(d.left===h)if(h.left===a){if(!(p=d.right)||0!==p._color){if(d._color=0,d.left=h.right,h._color=1,h.right=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3)(g=l[f-3]).left===d?g.left=h:g.right=h;break}h._color=1,d.right=i(1,p),d._color=0,f-=1}else{if(!(p=d.right)||0!==p._color){if(h.right=a.left,d._color=0,d.left=a.right,a._color=1,a.left=h,a.right=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3)(g=l[f-3]).left===d?g.left=a:g.right=a;break}h._color=1,d.right=i(1,p),d._color=0,f-=1}else if(h.right===a){if(!(p=d.left)||0!==p._color){if(d._color=0,d.right=h.left,h._color=1,h.left=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3)(g=l[f-3]).right===d?g.right=h:g.left=h;break}h._color=1,d.left=i(1,p),d._color=0,f-=1}else{var p;if(!(p=d.left)||0!==p._color){var g;if(h.left=a.right,d._color=0,d.right=a.left,a._color=1,a.right=h,a.left=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3)(g=l[f-3]).right===d?g.right=a:g.left=a;break}h._color=1,d.left=i(1,p),d._color=0,f-=1}}return l[0]._color=1,new s(r,l[0])},l.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return u(t,this.root);case 2:return c(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return f(e,r,this._compare,t,this.root)}},Object.defineProperty(l,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(l,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),l.at=function(t){if(t<0)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new h(this,[])},l.ge=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<=0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new h(this,n)},l.gt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new h(this,n)},l.lt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new h(this,n)},l.le=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>=0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new h(this,n)},l.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var a=e(t,r.key);if(n.push(r),0===a)return new h(this,n);r=a<=0?r.left:r.right}return new h(this,[])},l.remove=function(t){var e=this.find(t);return e?e.remove():this},l.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 d=h.prototype;function p(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 g(t,e){return te?1:0}Object.defineProperty(d,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(d,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),d.clone=function(){return new h(this.tree,this._stack.slice())},d.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 n(r._color,r.key,r.value,r.left,r.right,r._count);for(var l=t.length-2;l>=0;--l){(r=t[l]).left===t[l+1]?e[l]=new n(r._color,r.key,r.value,e[l+1],r.right,r._count):e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count)}if((r=e[e.length-1]).left&&r.right){var u=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var c=e[u-1];e.push(new n(r._color,c.key,c.value,r.left,r.right,r._count)),e[u-1].key=r.key,e[u-1].value=r.value;for(l=e.length-2;l>=u;--l)r=e[l],e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count);e[u-1].left=e[u]}if(0===(r=e[e.length-1])._color){var f=e[e.length-2];f.left===r?f.left=null:f.right===r&&(f.right=null),e.pop();for(l=0;l=0;--l){if(e=t[l],0===l)return void(e._color=1);if((r=t[l-1]).left===e){if((n=r.right).right&&0===n.right._color){if(s=(n=r.right=a(n)).right=a(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=1,r._color=1,s._color=1,o(r),o(n),l>1)(u=t[l-2]).left===r?u.left=n:u.right=n;return void(t[l-1]=n)}if(n.left&&0===n.left._color){if(s=(n=r.right=a(n)).left=a(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(u=t[l-2]).left===r?u.left=s:u.right=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.right=i(0,n));r.right=i(0,n);continue}n=a(n),r.right=n.left,n.left=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((u=t[l-2]).left===r?u.left=n:u.right=n),t[l-1]=n,t[l]=r,l+11)(u=t[l-2]).right===r?u.right=n:u.left=n;return void(t[l-1]=n)}if(n.right&&0===n.right._color){if(s=(n=r.left=a(n)).right=a(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(u=t[l-2]).right===r?u.right=s:u.left=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.left=i(0,n));r.left=i(0,n);continue}var u;n=a(n),r.left=n.right,n.right=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((u=t[l-2]).right===r?u.right=n:u.left=n),t[l-1]=n,t[l]=r,l+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(d,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(d,"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}),d.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(d,"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}}),d.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),a=e[e.length-1];r[r.length-1]=new n(a._color,a.key,t,a.left,a.right,a._count);for(var i=e.length-2;i>=0;--i)(a=e[i]).left===e[i+1]?r[i]=new n(a._color,a.key,a.value,r[i+1],a.right,a._count):r[i]=new n(a._color,a.key,a.value,a.left,r[i+1],a._count);return new s(this.tree._compare,r[0])},d.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(d,"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}})},{}],160:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],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 i(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+607/128+.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(i(e));e-=1;for(var r=n[0],a=1;a<9;a++)r+=n[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=i},{}],161:[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,a=e;try{var i=[t];0===t.indexOf("webgl")&&i.push("experimental-"+t);for(var o=0;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,i,a),r}function c(t,e){for(var r=n.malloc(t.length,e),a=t.length,i=0;i=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=i(s,t.shape);a.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 a=t.createBuffer(),i=new s(t,r,a,0,n);return i.update(e),i}},{ndarray:224,"ndarray-ops":223,"typedarray-pool":302}],163:[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",34e3:"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"}},{}],164:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":163}],165:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.gl,n=a(r,f.vertex,f.fragment),o=a(r,f.fillVertex,f.fragment),s=i(r),l=i(r),u=i(r),c=i(r),d=i(r),p=new h(t,n,o,s,l,u,c,d);return p.update(e),t.addObject(p),p};var n=t("iota-array"),a=t("gl-shader"),i=t("gl-buffer"),o=t("ndarray"),s=t("surface-nets"),l=t("cdt2d"),u=t("clean-pslg"),c=t("binary-search-bounds"),f=t("./lib/shaders");function h(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=a,this.idBuffer=i,this.fillPositionBuffer=o,this.fillColorBuffer=s,this.fillVerts=0,this.shape=[0,0],this.bounds=[1/0,1/0,-1/0,-1/0],this.numVertices=0,this.lineWidth=1}var d,p,g=h.prototype,v=[1,0,0,0,0,1,1,0,1,1,0,1];function m(t,e){var r=Math.floor(e);if(r<0)return t[0];if(r>=t.length-1)return t[t.length-1];var n=e-r;return(1-n)*t[r]+n*t[r+1]}g.draw=(d=[1,0,0,0,1,0,0,0,1],p=[0,0],function(){var t,e,r=this.plot,n=this.shader,a=this.fillShader,i=this.bounds,o=this.numVertices,s=this.fillVerts,l=r.gl,u=r.viewBox,c=r.dataBox,f=i[2]-i[0],h=i[3]-i[1],g=c[2]-c[0],v=c[3]-c[1];if(d[0]=2*f/g,d[4]=2*h/v,d[6]=2*(i[0]-c[0])/g-1,d[7]=2*(i[1]-c[1])/v-1,p[0]=u[2]-u[0],p[1]=u[3]-u[1],s>0&&(a.bind(),(t=a.uniforms).viewTransform=d,t.screenShape=p,e=n.attributes,this.fillPositionBuffer.bind(),e.position.pointer(),this.fillColorBuffer.bind(),e.color.pointer(l.UNSIGNED_BYTE,!0),l.drawArrays(l.TRIANGLES,0,s)),o>0){n.bind();var m=this.lineWidth*r.pixelRatio;(t=n.uniforms).viewTransform=d,t.screenShape=p,t.lineWidth=m,t.pointSize=1e3,e=n.attributes,this.positionBuffer.bind(),e.position.pointer(l.FLOAT,!1,16,0),e.tangent.pointer(l.FLOAT,!1,16,8),this.colorBuffer.bind(),e.color.pointer(l.UNSIGNED_BYTE,!0),l.drawArrays(l.TRIANGLES,0,o),t.lineWidth=0,t.pointSize=m,this.positionBuffer.bind(),e.position.pointer(l.FLOAT,!1,48,0),e.tangent.pointer(l.FLOAT,!1,48,8),this.colorBuffer.bind(),e.color.pointer(l.UNSIGNED_BYTE,!0,12,0),l.drawArrays(l.POINTS,0,o/3)}}),g.drawPick=function(t){return t},g.pick=function(t,e,r){return null},g.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||n(e[0]),a=t.y||n(e[1]),i=t.z||new Float32Array(e[0]*e[1]),f=t.levels||[],h=t.levelColors||[],d=this.bounds,p=d[0]=r[0],g=d[1]=a[0],y=d[2]=r[r.length-1],b=d[3]=a[a.length-1];p===y&&(d[2]+=1,y+=1),g===b&&(d[3]+=1,b+=1);var x=1/(y-p),_=1/(b-g);this.lineWidth=t.lineWidth||1;var w=o(i,e),A=[],T=[],k=[],M=[],E=[[0,0],[e[0]-1,0],[0,e[1]-1],[e[0]-1,e[1]-1]];function S(t,e,r,n){var a=n-r;return Math.abs(a)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/a))}for(var C=0;C0&&L===f[C-1])){for(var O=s(w,L),D=255*h[4*C]|0,R=255*h[4*C+1]|0,I=255*h[4*C+2]|0,P=255*h[4*C+3]|0,F=O.cells,z=O.positions,N=Array(z.length),B=0;B1)){var H,G=V[0],q=V[1],W=w.get(Math.floor(G),Math.floor(q)),X=w.get(Math.floor(G),Math.ceil(q)),Y=w.get(Math.ceil(G),Math.floor(q)),Z=w.get(Math.ceil(G),Math.ceil(q));0===Math.floor(V[0])&&W<=L!=Xc||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 a,i,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 a:throw new Error("gl-fbo: Framebuffer unsupported");case i: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,a,i,o){if(!a)return null;var s=n(t,e,r,i,a);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,a){var i=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,i),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,a,t.RENDERBUFFER,i),i}function p(t,e,r,n,a,i,o,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(a);for(var p=0;p1&&s.drawBuffersWEBGL(l[o]);var y=r.getExtension("WEBGL_depth_texture");y?p?t.depth=h(r,a,i,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g&&(t.depth=h(r,a,i,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):g&&p?t._depth_rb=d(r,a,i,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g?t._depth_rb=d(r,a,i,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):p&&(t._depth_rb=d(r,a,i,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){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);for(m=0;ma||r<0||r>a)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var i=u(n),o=0;o>8*d&255;this.pickOffset=r,a.bind();var p=a.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var g=a.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,a=this.shape[0]*this.shape[1];if(r=n+a)return null;var i=r-n,o=this.xData,s=this.yData;return{object:this,pointId:i,dataCoord:[o[i%this.shape[0]],s[i/this.shape[0]|0]]}},f.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||a(e[0]),o=t.y||a(e[1]),s=t.z||new Float32Array(e[0]*e[1]),l=!1!==t.zsmooth;this.xData=r,this.yData=o;var u,c,f,d,p=t.colorLevels||[0],g=t.colorValues||[0,0,0,1],v=p.length,m=this.bounds;l?(u=m[0]=r[0],c=m[1]=o[0],f=m[2]=r[r.length-1],d=m[3]=o[o.length-1]):(u=m[0]=r[0]+(r[1]-r[0])/2,c=m[1]=o[0]+(o[1]-o[0])/2,f=m[2]=r[r.length-1]+(r[r.length-1]-r[r.length-2])/2,d=m[3]=o[o.length-1]+(o[o.length-1]-o[o.length-2])/2);var y=1/(f-u),b=1/(d-c),x=e[0],_=e[1];this.shape=[x,_];var w=(l?(x-1)*(_-1):x*_)*(h.length>>>1);this.numVertices=w;for(var A=i.mallocUint8(4*w),T=i.mallocFloat32(2*w),k=i.mallocUint8(2*w),M=i.mallocUint32(w),E=0,S=l?x-1:x,C=l?_-1:_,L=0;La[T]&&(r.uniforms.dataAxis=u,r.uniforms.screenOffset=c,r.uniforms.color=v[t],r.uniforms.angle=m[t],i.drawArrays(i.TRIANGLES,a[T],a[k]-a[T]))),y[t]&&A&&(c[1^t]-=M*d*b[t],r.uniforms.dataAxis=f,r.uniforms.screenOffset=c,r.uniforms.color=x[t],r.uniforms.angle=_[t],i.drawArrays(i.TRIANGLES,w,A)),c[1^t]=M*s[2+(1^t)]-1,p[t+2]&&(c[1^t]+=M*d*g[t+2],Ta[T]&&(r.uniforms.dataAxis=u,r.uniforms.screenOffset=c,r.uniforms.color=v[t+2],r.uniforms.angle=m[t+2],i.drawArrays(i.TRIANGLES,a[T],a[k]-a[T]))),y[t+2]&&A&&(c[1^t]+=M*d*b[t+2],r.uniforms.dataAxis=f,r.uniforms.screenOffset=c,r.uniforms.color=x[t+2],r.uniforms.angle=_[t+2],i.drawArrays(i.TRIANGLES,w,A))}),g.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,a=r.gl,i=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-i[c])/(i[2+c]-i[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,a.drawArrays(a.TRIANGLES,this.titleOffset,this.titleCount)}}}(),g.bind=(h=[0,0],d=[0,0],p=[0,0],function(){var t=this.plot,e=this.shader,r=t._tickBounds,n=t.dataBox,a=t.screenBox,i=t.viewBox;e.bind();for(var o=0;o<2;++o){var s=r[o],l=r[o+2]-s,u=.5*(n[o+2]+n[o]),c=n[o+2]-n[o],f=i[o],g=i[o+2]-f,v=a[o],m=a[o+2]-v;d[o]=2*l/c*g/m,h[o]=2*(s-u)/c*g/m}p[1]=2*t.pixelRatio/(a[3]-a[1]),p[0]=p[1]*(a[3]-a[1])/(a[2]-a[0]),e.uniforms.dataScale=d,e.uniforms.dataShift=h,e.uniforms.textScale=p,this.vbo.bind(),e.attributes.textCoordinate.pointer()}),g.update=function(t){var e,r,n,a,o,s=[],l=t.ticks,u=t.bounds;for(o=0;o<2;++o){var c=[Math.floor(s.length/3)],f=[-1/0],h=l[o];for(e=0;e=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],d[p],h[p]):o.drawLine(e[0],g,e[2],g,d[p],h[p])}}for(p=0;p=0;--t)this.objects[t].dispose();this.objects.length=0;for(t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},u.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},u.removeObject=function(t){for(var e=this.objects,r=0;r 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]),r.pickVertex=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]),r.pickFragment=n(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"])},{glslify:202}],179:[function(t,e,r){"use strict";var n=t("gl-shader"),a=t("gl-buffer"),i=t("typedarray-pool"),o=t("./lib/shader");function s(t,e,r,n,a){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.shader=n,this.pickShader=a,this.sizeMin=.5,this.sizeMinCap=2,this.sizeMax=20,this.areaRatio=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.blend=!1,this.pickOffset=0,this.points=null}e.exports=function(t,e){var r=t.gl,i=a(r),l=a(r),u=n(r,o.pointVertex,o.pointFragment),c=n(r,o.pickVertex,o.pickFragment),f=new s(t,i,l,u,c);return f.update(e),t.addObject(f),f};var l,u,c=s.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){var e;function r(e,r){return e in t?t[e]:r}t=t||{},this.sizeMin=r("sizeMin",.5),this.sizeMax=r("sizeMax",20),this.color=r("color",[1,0,0,1]).slice(),this.areaRatio=r("areaRatio",1),this.borderColor=r("borderColor",[0,0,0,1]).slice(),this.blend=r("blend",!1);var n=t.positions.length>>>1,a=t.positions instanceof Float32Array,o=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,s=t.positions,l=a?s:i.mallocFloat32(s.length),u=o?t.idToIndex:i.mallocInt32(n);if(a||l.set(s),!o)for(l.set(s),e=0;e>>1;for(r=0;r=e[0]&&i<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,a),c=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(s,.33333)));l[0]=2/i,l[4]=2/o,l[6]=-2*a[0]/i-1,l[7]=-2*a[1]/o-1,this.offsetBuffer.bind(),r.bind(),r.attributes.position.pointer(),r.uniforms.matrix=l,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointCloud=c<5,r.uniforms.pointSize=c,r.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),e&&(u[0]=255&t,u[1]=t>>8&255,u[2]=t>>16&255,u[3]=t>>24&255,this.pickBuffer.bind(),r.attributes.pickId.pointer(n.UNSIGNED_BYTE),r.uniforms.pickOffset=u,this.pickOffset=t);var f=n.getParameter(n.BLEND),h=n.getParameter(n.DITHER);return f&&!this.blend&&n.disable(n.BLEND),h&&n.disable(n.DITHER),n.drawArrays(n.POINTS,0,this.pointCount),f&&!this.blend&&n.enable(n.BLEND),h&&n.enable(n.DITHER),t+this.pointCount}),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}}},{"./lib/shader":178,"gl-buffer":162,"gl-shader":183,"typedarray-pool":302}],180:[function(t,e,r){"use strict";var n=t("glslify");r.boxVertex=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n"]),r.boxFragment=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"])},{glslify:202}],181:[function(t,e,r){"use strict";var n=t("gl-shader"),a=t("gl-buffer"),i=t("./lib/shaders");function o(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-1/0,-1/0],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}e.exports=function(t,e){var r=t.gl,s=a(r,[0,0,0,1,1,0,1,1]),l=n(r,i.boxVertex,i.boxFragment),u=new o(t,s,l);return u.update(e),t.addOverlay(u),u};var s=o.prototype;s.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),a=(this.outerFill,this.outerColor),i=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,f=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],h=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(f=Math.max(f,u[0]),h=Math.max(h,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(d0){var m=r*c;o.drawBox(f-m,h-m,d+m,h+m,i),o.drawBox(f-m,p-m,d+m,p+m,i),o.drawBox(f-m,h-m,f+m,p+m,i),o.drawBox(d-m,h-m,d+m,p+m,i)}}}},s.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},s.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":180,"gl-buffer":162,"gl-shader":183}],182:[function(t,e,r){"use strict";e.exports=function(t,e){var r=e[0],i=e[1],o=n(t,r,i,{}),s=a.mallocUint8(r*i*4);return new l(t,o,s)};var n=t("gl-fbo"),a=t("typedarray-pool"),i=t("ndarray"),o=t("bit-twiddle").nextPow2;function s(t,e,r,n,a){this.coord=[t,e],this.id=r,this.value=n,this.distance=a}function l(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}var u=l.prototype;Object.defineProperty(u,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(t){if(this.gl){this.fbo.shape=t;var e=this.fbo.shape[0],r=this.fbo.shape[1];if(r*e*4>this.buffer.length){a.free(this.buffer);for(var n=this.buffer=a.mallocUint8(o(r*e*4)),i=0;ir)for(t=r;te)for(t=e;t=0){for(var A=0|w.type.charAt(w.type.length-1),T=new Array(A),k=0;k=0;)M+=1;_[y]=M}var E=new Array(r.length);function S(){h.program=o.program(d,h._vref,h._fref,x,_);for(var t=0;t=0){if((p=h.charCodeAt(h.length-1)-48)<2||p>4)throw new n("","Invalid data type for attribute "+f+": "+h);o(t,e,d[0],a,p,i,f)}else{if(!(h.indexOf("mat")>=0))throw new n("","Unknown data type for attribute "+f+": "+h);var p;if((p=h.charCodeAt(h.length-1)-48)<2||p>4)throw new n("","Invalid data type for attribute "+f+": "+h);s(t,e,d,a,p,i,f)}}}return i};var n=t("./GLError");function a(t,e,r,n,a,i){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=a,this._constFunc=i}var i=a.prototype;function o(t,e,r,n,i,o,s){for(var l=["gl","v"],u=[],c=0;c4)throw new a("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new a("","Unknown uniform data type for "+name+": "+r)}if((i=r.charCodeAt(r.length-1)-48)<2||i>4)throw new a("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new a("","Unrecognized data type for vector "+name+": "+r)}}}function u(e){for(var n=["return function updateProperty(obj){"],a=function t(e,r){if("object"!=typeof r)return[[e,r]];var n=[];for(var a in r){var i=r[a],o=e;parseInt(a)+""===a?o+="["+a+"]":o+="."+a,"object"==typeof i?n.push.apply(n,t(o,i)):n.push([o,i])}return n}("",e),i=0;i4)throw new a("","Invalid data type");return"b"===t.charAt(0)?o(r,!1):o(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r;if((r=t.charCodeAt(t.length-1)-48)<2||r>4)throw new a("","Invalid uniform dimension type for matrix "+name+": "+t);return o(r*r,0)}throw new a("","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){s[0]in i||(i[s[0]]=[]),i=i[s[0]];for(var l=1;l1)for(var l=0;l halfCharStep + halfCharWidth ||\n\t\t\t\t\tfloor(uv.x) < halfCharStep - halfCharWidth) return;\n\n\t\t\t\tuv += charId * charStep;\n\t\t\t\tuv = uv / atlasSize;\n\n\t\t\t\tvec4 color = fontColor;\n\t\t\t\tvec4 mask = texture2D(atlas, uv);\n\n\t\t\t\tfloat maskY = lightness(mask);\n\t\t\t\t// float colorY = lightness(color);\n\t\t\t\tcolor.a *= maskY;\n\t\t\t\tcolor.a *= opacity;\n\n\t\t\t\t// color.a += .1;\n\n\t\t\t\t// antialiasing, see yiq color space y-channel formula\n\t\t\t\t// color.rgb += (1. - color.rgb) * (1. - mask.rgb);\n\n\t\t\t\tgl_FragColor = color;\n\t\t\t}"});return{regl:t,draw:e,atlas:{}}},A.prototype.update=function(t){var e=this;if("string"==typeof t)t={text:t};else if(!t)return;null!=(t=a(t,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0)).opacity&&(Array.isArray(t.opacity)?this.opacity=t.opacity.map((function(t){return parseFloat(t)})):this.opacity=parseFloat(t.opacity)),null!=t.viewport&&(this.viewport=f(t.viewport),A.normalViewport&&(this.viewport.y=this.canvas.height-this.viewport.y-this.viewport.height),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null==this.viewport&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null!=t.kerning&&(this.kerning=t.kerning),null!=t.offset&&("number"==typeof t.offset&&(t.offset=[t.offset,0]),this.positionOffset=y(t.offset)),t.direction&&(this.direction=t.direction),t.range&&(this.range=t.range,this.scale=[1/(t.range[2]-t.range[0]),1/(t.range[3]-t.range[1])],this.translate=[-t.range[0],-t.range[1]]),t.scale&&(this.scale=t.scale),t.translate&&(this.translate=t.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),this.font.length||t.font||(t.font=A.baseFontSize+"px sans-serif");var r,i=!1,o=!1;if(t.font&&(Array.isArray(t.font)?t.font:[t.font]).forEach((function(t,r){if("string"==typeof t)try{t=n.parse(t)}catch(e){t=n.parse(A.baseFontSize+"px "+t)}else t=n.parse(n.stringify(t));var a=n.stringify({size:A.baseFontSize,family:t.family,stretch:_?t.stretch:void 0,variant:t.variant,weight:t.weight,style:t.style}),s=d(t.size),l=Math.round(s[0]*p(s[1]));if(l!==e.fontSize[r]&&(o=!0,e.fontSize[r]=l),!(e.font[r]&&a==e.font[r].baseString||(i=!0,e.font[r]=A.fonts[a],e.font[r]))){var u=t.family.join(", "),c=[t.style];t.style!=t.variant&&c.push(t.variant),t.variant!=t.weight&&c.push(t.weight),_&&t.weight!=t.stretch&&c.push(t.stretch),e.font[r]={baseString:a,family:u,weight:t.weight,stretch:t.stretch,style:t.style,variant:t.variant,width:{},kerning:{},metrics:m(u,{origin:"top",fontSize:A.baseFontSize,fontStyle:c.join(" ")})},A.fonts[a]=e.font[r]}})),(i||o)&&this.font.forEach((function(r,a){var i=n.stringify({size:e.fontSize[a],family:r.family,stretch:_?r.stretch:void 0,variant:r.variant,weight:r.weight,style:r.style});if(e.fontAtlas[a]=e.shader.atlas[i],!e.fontAtlas[a]){var o=r.metrics;e.shader.atlas[i]=e.fontAtlas[a]={fontString:i,step:2*Math.ceil(e.fontSize[a]*o.bottom*.5),em:e.fontSize[a],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:e.regl.texture()}}null==t.text&&(t.text=e.text)})),"string"==typeof t.text&&t.position&&t.position.length>2){for(var s=Array(.5*t.position.length),h=0;h2){for(var w=!t.position[0].length,T=c.mallocFloat(2*this.count),k=0,M=0;k1?e.align[r]:e.align[0]:e.align;if("number"==typeof n)return n;switch(n){case"right":case"end":return-t;case"center":case"centre":case"middle":return.5*-t}return 0}))),null==this.baseline&&null==t.baseline&&(t.baseline=0),null!=t.baseline&&(this.baseline=t.baseline,Array.isArray(this.baseline)||(this.baseline=[this.baseline]),this.baselineOffset=this.baseline.map((function(t,r){var n=(e.font[r]||e.font[0]).metrics,a=0;return a+=.5*n.bottom,a+="number"==typeof t?t-n.baseline:-n[t],A.normalViewport||(a*=-1),a}))),null!=t.color)if(t.color||(t.color="transparent"),"string"!=typeof t.color&&isNaN(t.color)){var G;if("number"==typeof t.color[0]&&t.color.length>this.counts.length){var q=t.color.length;G=c.mallocUint8(q);for(var W=(t.color.subarray||t.color.slice).bind(t.color),X=0;X4||this.baselineOffset.length>1||this.align&&this.align.length>1||this.fontAtlas.length>1||this.positionOffset.length>2){var J=Math.max(.5*this.position.length||0,.25*this.color.length||0,this.baselineOffset.length||0,this.alignOffset.length||0,this.font.length||0,this.opacity.length||0,.5*this.positionOffset.length||0);this.batch=Array(J);for(var Q=0;Q1?this.counts[Q]:this.counts[0],offset:this.textOffsets.length>1?this.textOffsets[Q]:this.textOffsets[0],color:this.color?this.color.length<=4?this.color:this.color.subarray(4*Q,4*Q+4):[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[Q]:this.opacity,baseline:null!=this.baselineOffset[Q]?this.baselineOffset[Q]:this.baselineOffset[0],align:this.align?null!=this.alignOffset[Q]?this.alignOffset[Q]:this.alignOffset[0]:0,atlas:this.fontAtlas[Q]||this.fontAtlas[0],positionOffset:this.positionOffset.length>2?this.positionOffset.subarray(2*Q,2*Q+2):this.positionOffset}}else this.count?this.batch=[{count:this.count,offset:0,color:this.color||[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[0]:this.opacity,baseline:this.baselineOffset[0],align:this.alignOffset?this.alignOffset[0]:0,atlas:this.fontAtlas[0],positionOffset:this.positionOffset}]:this.batch=[]},A.prototype.destroy=function(){},A.prototype.kerning=!0,A.prototype.position={constant:new Float32Array(2)},A.prototype.translate=null,A.prototype.scale=null,A.prototype.font=null,A.prototype.text="",A.prototype.positionOffset=[0,0],A.prototype.opacity=1,A.prototype.color=new Uint8Array([0,0,0,255]),A.prototype.alignOffset=[0,0],A.normalViewport=!1,A.maxAtlasSize=1024,A.atlasCanvas=document.createElement("canvas"),A.atlasContext=A.atlasCanvas.getContext("2d",{alpha:!1}),A.baseFontSize=64,A.fonts={},e.exports=A},{"bit-twiddle":40,"color-normalize":63,"css-font":73,"detect-kerning":88,"es6-weak-map":148,"flatten-vertex-data":156,"font-atlas":157,"font-measure":158,"gl-util/context":193,"is-plain-obj":214,"object-assign":227,"parse-rect":230,"parse-unit":232,"pick-by-alias":236,regl:260,"to-px":287,"typedarray-pool":302}],192:[function(t,e,r){"use strict";var n=t("ndarray"),a=t("ndarray-ops"),i=t("typedarray-pool");e.exports=function(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");o||u(t);if("number"==typeof arguments[1])return m(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return m(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=c(e)?e:e.raw;if(r)return y(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return b(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var o=null,s=null,l=null;function u(t){o=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],s=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],l=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function c(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 f=function(t,e){a.muls(t,e,255)};function h(t,e,r){var n=t.gl,a=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)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 d(t,e,r,n,a,i){this.gl=t,this.handle=e,this.format=a,this.type=i,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 p=d.prototype;function g(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 v(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 m(t,e,r,n,a){var i=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture shape");if(a===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=v(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,a,null),new d(t,o,e,r,n,a)}function y(t,e,r,n,a,i){var o=v(t);return t.texImage2D(t.TEXTURE_2D,0,a,a,i,e),new d(t,o,r,n,a,i)}function b(t,e){var r=e.dtype,o=e.shape.slice(),s=t.getParameter(t.MAX_TEXTURE_SIZE);if(o[0]<0||o[0]>s||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=g(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 c,h,p=0;if(2===o.length)p=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])p=t.ALPHA;else if(2===o[2])p=t.LUMINANCE_ALPHA;else if(3===o[2])p=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");p=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,l=!1);var m=e.size;if(l)c=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];h=i.malloc(m,r);var b=n(h,o,y,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?a.assign(b,e):f(b,e),c=h.subarray(0,m)}var x=v(t);return t.texImage2D(t.TEXTURE_2D,0,p,o[0],o[1],0,p,u,c),l||i.free(h),new d(t,x,o[0],o[1],p,u)}Object.defineProperties(p,{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 h(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return h(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,h(this,this._shape[0],t),t}}}),p.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},p.dispose=function(){this.gl.deleteTexture(this.handle)},p.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)},p.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=c(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,c){var h=c.dtype,d=c.shape.slice();if(d.length<2||d.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var p=0,v=0,m=g(d,c.stride.slice());"float32"===h?p=t.FLOAT:"float64"===h?(p=t.FLOAT,m=!1,h="float32"):"uint8"===h?p=t.UNSIGNED_BYTE:(p=t.UNSIGNED_BYTE,m=!1,h="uint8");if(2===d.length)v=t.LUMINANCE,d=[d[0],d[1],1],c=n(c.data,d,[c.stride[0],c.stride[1],1],c.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=c.size,b=u.indexOf(o)<0;b&&u.push(o);if(p===l&&m)0===c.offset&&c.data.length===y?b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,c.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,c.data):b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,c.data.subarray(c.offset,c.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,c.data.subarray(c.offset,c.offset+y));else{var x;x=l===t.FLOAT?i.mallocFloat32(y):i.mallocUint8(y);var _=n(x,d,[d[2],d[2]*d[0],1]);p===t.FLOAT&&l===t.UNSIGNED_BYTE?f(_,c):a.assign(_,c),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?i.freeFloat32(x):i.freeUint8(x)}}(s,e,r,o,this.format,this.type,this._mipLevels,t)}}},{ndarray:224,"ndarray-ops":223,"typedarray-pool":302}],193:[function(t,e,r){(function(r){"use strict";var n=t("pick-by-alias");function a(t){if(t.container)if(t.container==document.body)document.body.style.width||(t.canvas.width=t.width||t.pixelRatio*r.innerWidth),document.body.style.height||(t.canvas.height=t.height||t.pixelRatio*r.innerHeight);else{var e=t.container.getBoundingClientRect();t.canvas.width=t.width||e.right-e.left,t.canvas.height=t.height||e.bottom-e.top}}function i(t){return"function"==typeof t.getContext&&"width"in t&&"height"in t}function o(){var t=document.createElement("canvas");return t.style.position="absolute",t.style.top=0,t.style.left=0,t}e.exports=function(t){var e;if(t?"string"==typeof t&&(t={container:t}):t={},i(t)?t={container:t}:t="string"==typeof(e=t).nodeName&&"function"==typeof e.appendChild&&"function"==typeof e.getBoundingClientRect?{container:t}:function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(t)?{gl:t}:n(t,{container:"container target element el canvas holder parent parentNode wrapper use ref root node",gl:"gl context webgl glContext",attrs:"attributes attrs contextAttributes",pixelRatio:"pixelRatio pxRatio px ratio pxratio pixelratio",width:"w width",height:"h height"},!0),t.pixelRatio||(t.pixelRatio=r.pixelRatio||1),t.gl)return t.gl;if(t.canvas&&(t.container=t.canvas.parentNode),t.container){if("string"==typeof t.container){var s=document.querySelector(t.container);if(!s)throw Error("Element "+t.container+" is not found");t.container=s}i(t.container)?(t.canvas=t.container,t.container=t.canvas.parentNode):t.canvas||(t.canvas=o(),t.container.appendChild(t.canvas),a(t))}else if(!t.canvas){if("undefined"==typeof document)throw Error("Not DOM environment. Use headless-gl.");t.container=document.body||document.documentElement,t.canvas=o(),t.container.appendChild(t.canvas),a(t)}if(!t.gl)try{t.gl=t.canvas.getContext("webgl",t.attrs)}catch(e){try{t.gl=t.canvas.getContext("experimental-webgl",t.attrs)}catch(e){t.gl=t.canvas.getContext("webgl-experimental",t.attrs)}}return t.gl}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"pick-by-alias":236}],194:[function(t,e,r){var n=t("glsl-tokenizer"),a=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 k(r),m+=r.length,(d=d.slice(r.length)).length}}function D(){return/[^a-fA-F0-9]/.test(e)?(k(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function R(){return"."===e||/[eE]/.test(e)?(d.push(e),h=5,r=e,c+1):"x"===e&&1===d.length&&"0"===d[0]?(h=11,d.push(e),r=e,c+1):/[^\d]/.test(e)?(k(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function I(){return"f"===e&&(d.push(e),r=e,c+=1),/[eE]/.test(e)?(d.push(e),r=e,c+1):("-"!==e&&"+"!==e||!/[eE]/.test(r))&&/[^\d]/.test(e)?(k(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function P(){if(/[^\d\w_]/.test(e)){var t=d.join("");return h=T[t]?8:A[t]?7:6,k(d.join("")),h=999,c}return d.push(e),r=e,c+1}};var n=t("./lib/literals"),a=t("./lib/operators"),i=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":197,"./lib/builtins-300es":196,"./lib/literals":199,"./lib/literals-300es":198,"./lib/operators":200}],196:[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":197}],197:[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"]},{}],198:[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","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":199}],199:[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","uint","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"]},{}],200:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],201:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),a=[];return a=(a=a.concat(r(t))).concat(r(null))}},{"./index":195}],202:[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?a-1:0,h=r?-1:1,d=t[e+f];for(f+=h,i=d&(1<<-c)-1,d>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=h,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===i)i=1-u;else{if(i===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),i-=u}return(d?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,s,l,u=8*i-a-1,c=(1<>1,h=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-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,a),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+d]=255&s,d+=p,s/=256,a-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],206:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function a(t,e,r,n,a){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=a,this.count=(e?e.count:0)+(r?r.count:0)+n.length}e.exports=function(t){if(!t||0===t.length)return new m(null);return new m(v(t))};var i=a.prototype;function o(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 s(t,e){var r=v(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 l(t,e){var r=t.intervals([]);r.push(e),s(t,r)}function u(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?0:(r.splice(n,1),s(t,r),1)}function c(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var a=r(t[n]);if(a)return a}}function h(t,e){for(var r=0;r>1],i=[],o=[],s=[];for(r=0;r3*(e+1)?l(this,t):this.left.insert(t):this.left=v([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?l(this,t):this.right.insert(t):this.right=v([t]);else{var r=n.ge(this.leftPoints,t,p),a=n.ge(this.rightPoints,t,g);this.leftPoints.splice(r,0,t),this.rightPoints.splice(a,0,t)}},i.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?u(this,t):2===(s=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?u(this,t):2===(s=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,a=this.left;a.right;)r=a,a=a.right;if(r===this)a.right=this.right;else{var i=this.left,s=this.right;r.count-=a.count,r.right=a.left,a.left=i,a.right=s}o(this,a),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?o(this,this.left):o(this,this.right);return 1}for(i=n.ge(this.leftPoints,t,p);ithis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return f(this.rightPoints,t,e)}return h(this.leftPoints,e)},i.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?f(this.rightPoints,t,r):h(this.leftPoints,r)};var y=m.prototype;y.insert=function(t){this.root?this.root.insert(t):this.root=new a(t[0],null,null,[t],[t])},y.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},y.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},y.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(y,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(y,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":207}],207:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",a?".get(m)":"[m]"];return i?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("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],!1,a),n("B","x"+t+"y",e,["y"],!0,a),n("P","c(x,y)"+t+"0",e,["y","c"],!1,a),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,a),"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:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],208:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;re[0]-o[0]/2&&(d=o[0]/2,h+=o[1]);return r}},{"css-font/stringify":76}],158:[function(t,e,r){"use strict";function n(t,e){e||(e={}),("string"==typeof t||Array.isArray(t))&&(e.family=t);var r=Array.isArray(e.family)?e.family.join(", "):e.family;if(!r)throw Error("`family` must be defined");var s=e.size||e.fontSize||e.em||48,l=e.weight||e.fontWeight||"",u=(t=[e.style||e.fontStyle||"",l,s].join(" ")+"px "+r,e.origin||"top");if(n.cache[r]&&s<=n.cache[r].em)return a(n.cache[r],u);var c=e.canvas||n.canvas,f=c.getContext("2d"),d={upper:void 0!==e.upper?e.upper:"H",lower:void 0!==e.lower?e.lower:"x",descent:void 0!==e.descent?e.descent:"p",ascent:void 0!==e.ascent?e.ascent:"h",tittle:void 0!==e.tittle?e.tittle:"i",overshoot:void 0!==e.overshoot?e.overshoot:"O"},h=Math.ceil(1.5*s);c.height=h,c.width=.5*h,f.font=t;var p={top:0};f.clearRect(0,0,h,h),f.textBaseline="top",f.fillStyle="black",f.fillText("H",0,0);var g=i(f.getImageData(0,0,h,h));f.clearRect(0,0,h,h),f.textBaseline="bottom",f.fillText("H",0,h);var v=i(f.getImageData(0,0,h,h));p.lineHeight=p.bottom=h-v+g,f.clearRect(0,0,h,h),f.textBaseline="alphabetic",f.fillText("H",0,h);var m=h-i(f.getImageData(0,0,h,h))-1+g;p.baseline=p.alphabetic=m,f.clearRect(0,0,h,h),f.textBaseline="middle",f.fillText("H",0,.5*h);var y=i(f.getImageData(0,0,h,h));p.median=p.middle=h-y-1+g-.5*h,f.clearRect(0,0,h,h),f.textBaseline="hanging",f.fillText("H",0,.5*h);var b=i(f.getImageData(0,0,h,h));p.hanging=h-b-1+g-.5*h,f.clearRect(0,0,h,h),f.textBaseline="ideographic",f.fillText("H",0,h);var x=i(f.getImageData(0,0,h,h));if(p.ideographic=h-x-1+g,d.upper&&(f.clearRect(0,0,h,h),f.textBaseline="top",f.fillText(d.upper,0,0),p.upper=i(f.getImageData(0,0,h,h)),p.capHeight=p.baseline-p.upper),d.lower&&(f.clearRect(0,0,h,h),f.textBaseline="top",f.fillText(d.lower,0,0),p.lower=i(f.getImageData(0,0,h,h)),p.xHeight=p.baseline-p.lower),d.tittle&&(f.clearRect(0,0,h,h),f.textBaseline="top",f.fillText(d.tittle,0,0),p.tittle=i(f.getImageData(0,0,h,h))),d.ascent&&(f.clearRect(0,0,h,h),f.textBaseline="top",f.fillText(d.ascent,0,0),p.ascent=i(f.getImageData(0,0,h,h))),d.descent&&(f.clearRect(0,0,h,h),f.textBaseline="top",f.fillText(d.descent,0,0),p.descent=o(f.getImageData(0,0,h,h))),d.overshoot){f.clearRect(0,0,h,h),f.textBaseline="top",f.fillText(d.overshoot,0,0);var _=o(f.getImageData(0,0,h,h));p.overshoot=_-m}for(var w in p)p[w]/=s;return p.em=s,n.cache[r]=p,a(p,u)}function a(t,e){var r={};for(var n in"string"==typeof e&&(e=t[e]),t)"em"!==n&&(r[n]=t[n]-e);return r}function i(t){for(var e=t.height,r=t.data,n=3;n0;n-=4)if(0!==r[n])return Math.floor(.25*(n-3)/e)}e.exports=n,n.canvas=document.createElement("canvas"),n.cache={}},{}],159:[function(t,e,r){"use strict";e.exports=function(t){return new s(t||g,null)};function n(t,e,r,n,a,i){this._color=t,this.key=e,this.value=r,this.left=n,this.right=a,this._count=i}function a(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function i(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}var l=s.prototype;function u(t,e){var r;if(e.left&&(r=u(t,e.left)))return r;return(r=t(e.key,e.value))||(e.right?u(t,e.right):void 0)}function c(t,e,r,n){if(e(t,n.key)<=0){var a;if(n.left)if(a=c(t,e,r,n.left))return a;if(a=r(n.key,n.value))return a}if(n.right)return c(t,e,r,n.right)}function f(t,e,r,n,a){var i,o=r(t,a.key),s=r(e,a.key);if(o<=0){if(a.left&&(i=f(t,e,r,n,a.left)))return i;if(s>0&&(i=n(a.key,a.value)))return i}if(s>0&&a.right)return f(t,e,r,n,a.right)}function d(t,e){this.tree=t,this._stack=e}Object.defineProperty(l,"keys",{get:function(){var t=[];return this.forEach((function(e,r){t.push(e)})),t}}),Object.defineProperty(l,"values",{get:function(){var t=[];return this.forEach((function(e,r){t.push(r)})),t}}),Object.defineProperty(l,"length",{get:function(){return this.root?this.root._count:0}}),l.insert=function(t,e){for(var r=this._compare,a=this.root,l=[],u=[];a;){var c=r(t,a.key);l.push(a),u.push(c),a=c<=0?a.left:a.right}l.push(new n(0,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){a=l[f];u[f]<=0?l[f]=new n(a._color,a.key,a.value,l[f+1],a.right,a._count+1):l[f]=new n(a._color,a.key,a.value,a.left,l[f+1],a._count+1)}for(f=l.length-1;f>1;--f){var d=l[f-1];a=l[f];if(1===d._color||1===a._color)break;var h=l[f-2];if(h.left===d)if(d.left===a){if(!(p=h.right)||0!==p._color){if(h._color=0,h.left=d.right,d._color=1,d.right=h,l[f-2]=d,l[f-1]=a,o(h),o(d),f>=3)(g=l[f-3]).left===h?g.left=d:g.right=d;break}d._color=1,h.right=i(1,p),h._color=0,f-=1}else{if(!(p=h.right)||0!==p._color){if(d.right=a.left,h._color=0,h.left=a.right,a._color=1,a.left=d,a.right=h,l[f-2]=a,l[f-1]=d,o(h),o(d),o(a),f>=3)(g=l[f-3]).left===h?g.left=a:g.right=a;break}d._color=1,h.right=i(1,p),h._color=0,f-=1}else if(d.right===a){if(!(p=h.left)||0!==p._color){if(h._color=0,h.right=d.left,d._color=1,d.left=h,l[f-2]=d,l[f-1]=a,o(h),o(d),f>=3)(g=l[f-3]).right===h?g.right=d:g.left=d;break}d._color=1,h.left=i(1,p),h._color=0,f-=1}else{var p;if(!(p=h.left)||0!==p._color){var g;if(d.left=a.right,h._color=0,h.right=a.left,a._color=1,a.right=d,a.left=h,l[f-2]=a,l[f-1]=d,o(h),o(d),o(a),f>=3)(g=l[f-3]).right===h?g.right=a:g.left=a;break}d._color=1,h.left=i(1,p),h._color=0,f-=1}}return l[0]._color=1,new s(r,l[0])},l.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return u(t,this.root);case 2:return c(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return f(e,r,this._compare,t,this.root)}},Object.defineProperty(l,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new d(this,t)}}),Object.defineProperty(l,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new d(this,t)}}),l.at=function(t){if(t<0)return new d(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new d(this,[])},l.ge=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<=0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new d(this,n)},l.gt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new d(this,n)},l.lt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new d(this,n)},l.le=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>=0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new d(this,n)},l.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var a=e(t,r.key);if(n.push(r),0===a)return new d(this,n);r=a<=0?r.left:r.right}return new d(this,[])},l.remove=function(t){var e=this.find(t);return e?e.remove():this},l.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=d.prototype;function p(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 g(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 d(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 n(r._color,r.key,r.value,r.left,r.right,r._count);for(var l=t.length-2;l>=0;--l){(r=t[l]).left===t[l+1]?e[l]=new n(r._color,r.key,r.value,e[l+1],r.right,r._count):e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count)}if((r=e[e.length-1]).left&&r.right){var u=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var c=e[u-1];e.push(new n(r._color,c.key,c.value,r.left,r.right,r._count)),e[u-1].key=r.key,e[u-1].value=r.value;for(l=e.length-2;l>=u;--l)r=e[l],e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count);e[u-1].left=e[u]}if(0===(r=e[e.length-1])._color){var f=e[e.length-2];f.left===r?f.left=null:f.right===r&&(f.right=null),e.pop();for(l=0;l=0;--l){if(e=t[l],0===l)return void(e._color=1);if((r=t[l-1]).left===e){if((n=r.right).right&&0===n.right._color){if(s=(n=r.right=a(n)).right=a(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=1,r._color=1,s._color=1,o(r),o(n),l>1)(u=t[l-2]).left===r?u.left=n:u.right=n;return void(t[l-1]=n)}if(n.left&&0===n.left._color){if(s=(n=r.right=a(n)).left=a(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(u=t[l-2]).left===r?u.left=s:u.right=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.right=i(0,n));r.right=i(0,n);continue}n=a(n),r.right=n.left,n.left=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((u=t[l-2]).left===r?u.left=n:u.right=n),t[l-1]=n,t[l]=r,l+11)(u=t[l-2]).right===r?u.right=n:u.left=n;return void(t[l-1]=n)}if(n.right&&0===n.right._color){if(s=(n=r.left=a(n)).right=a(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(u=t[l-2]).right===r?u.right=s:u.left=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.left=i(0,n));r.left=i(0,n);continue}var u;n=a(n),r.left=n.right,n.right=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((u=t[l-2]).right===r?u.right=n:u.left=n),t[l-1]=n,t[l]=r,l+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),a=e[e.length-1];r[r.length-1]=new n(a._color,a.key,t,a.left,a.right,a._count);for(var i=e.length-2;i>=0;--i)(a=e[i]).left===e[i+1]?r[i]=new n(a._color,a.key,a.value,r[i+1],a.right,a._count):r[i]=new n(a._color,a.key,a.value,a.left,r[i+1],a._count);return new s(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}})},{}],160:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],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 i(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+607/128+.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(i(e));e-=1;for(var r=n[0],a=1;a<9;a++)r+=n[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=i},{}],161:[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,a=e;try{var i=[t];0===t.indexOf("webgl")&&i.push("experimental-"+t);for(var o=0;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,i,a),r}function c(t,e){for(var r=n.malloc(t.length,e),a=t.length,i=0;i=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=i(s,t.shape);a.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 a=t.createBuffer(),i=new s(t,r,a,0,n);return i.update(e),i}},{ndarray:258,"ndarray-ops":257,"typedarray-pool":338}],163:[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",34e3:"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"}},{}],164:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":163}],165:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.gl,n=a(r,f.vertex,f.fragment),o=a(r,f.fillVertex,f.fragment),s=i(r),l=i(r),u=i(r),c=i(r),h=i(r),p=new d(t,n,o,s,l,u,c,h);return p.update(e),t.addObject(p),p};var n=t("iota-array"),a=t("gl-shader"),i=t("gl-buffer"),o=t("ndarray"),s=t("surface-nets"),l=t("cdt2d"),u=t("clean-pslg"),c=t("binary-search-bounds"),f=t("./lib/shaders");function d(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=a,this.idBuffer=i,this.fillPositionBuffer=o,this.fillColorBuffer=s,this.fillVerts=0,this.shape=[0,0],this.bounds=[1/0,1/0,-1/0,-1/0],this.numVertices=0,this.lineWidth=1}var h,p,g=d.prototype,v=[1,0,0,0,0,1,1,0,1,1,0,1];function m(t,e){var r=Math.floor(e);if(r<0)return t[0];if(r>=t.length-1)return t[t.length-1];var n=e-r;return(1-n)*t[r]+n*t[r+1]}g.draw=(h=[1,0,0,0,1,0,0,0,1],p=[0,0],function(){var t,e,r=this.plot,n=this.shader,a=this.fillShader,i=this.bounds,o=this.numVertices,s=this.fillVerts,l=r.gl,u=r.viewBox,c=r.dataBox,f=i[2]-i[0],d=i[3]-i[1],g=c[2]-c[0],v=c[3]-c[1];if(h[0]=2*f/g,h[4]=2*d/v,h[6]=2*(i[0]-c[0])/g-1,h[7]=2*(i[1]-c[1])/v-1,p[0]=u[2]-u[0],p[1]=u[3]-u[1],s>0&&(a.bind(),(t=a.uniforms).viewTransform=h,t.screenShape=p,e=n.attributes,this.fillPositionBuffer.bind(),e.position.pointer(),this.fillColorBuffer.bind(),e.color.pointer(l.UNSIGNED_BYTE,!0),l.drawArrays(l.TRIANGLES,0,s)),o>0){n.bind();var m=this.lineWidth*r.pixelRatio;(t=n.uniforms).viewTransform=h,t.screenShape=p,t.lineWidth=m,t.pointSize=1e3,e=n.attributes,this.positionBuffer.bind(),e.position.pointer(l.FLOAT,!1,16,0),e.tangent.pointer(l.FLOAT,!1,16,8),this.colorBuffer.bind(),e.color.pointer(l.UNSIGNED_BYTE,!0),l.drawArrays(l.TRIANGLES,0,o),t.lineWidth=0,t.pointSize=m,this.positionBuffer.bind(),e.position.pointer(l.FLOAT,!1,48,0),e.tangent.pointer(l.FLOAT,!1,48,8),this.colorBuffer.bind(),e.color.pointer(l.UNSIGNED_BYTE,!0,12,0),l.drawArrays(l.POINTS,0,o/3)}}),g.drawPick=function(t){return t},g.pick=function(t,e,r){return null},g.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||n(e[0]),a=t.y||n(e[1]),i=t.z||new Float32Array(e[0]*e[1]),f=t.levels||[],d=t.levelColors||[],h=this.bounds,p=h[0]=r[0],g=h[1]=a[0],y=h[2]=r[r.length-1],b=h[3]=a[a.length-1];p===y&&(h[2]+=1,y+=1),g===b&&(h[3]+=1,b+=1);var x=1/(y-p),_=1/(b-g);this.lineWidth=t.lineWidth||1;var w=o(i,e),A=[],T=[],k=[],M=[],E=[[0,0],[e[0]-1,0],[0,e[1]-1],[e[0]-1,e[1]-1]];function S(t,e,r,n){var a=n-r;return Math.abs(a)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/a))}for(var C=0;C0&&L===f[C-1])){for(var O=s(w,L),D=255*d[4*C]|0,R=255*d[4*C+1]|0,I=255*d[4*C+2]|0,P=255*d[4*C+3]|0,F=O.cells,z=O.positions,N=Array(z.length),B=0;B1)){var H,G=V[0],q=V[1],X=w.get(Math.floor(G),Math.floor(q)),W=w.get(Math.floor(G),Math.ceil(q)),Y=w.get(Math.ceil(G),Math.floor(q)),Z=w.get(Math.ceil(G),Math.ceil(q));0===Math.floor(V[0])&&X<=L!=Wc||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 d=t.UNSIGNED_BYTE,h=t.getExtension("OES_texture_float");if(n.float&&f>0){if(!h)throw new Error("gl-fbo: Context does not support floating point textures");d=t.FLOAT}else n.preferFloat&&f>0&&h&&(d=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,d,f,g,v,u)};var a,i,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 a:throw new Error("gl-fbo: Framebuffer unsupported");case i: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 d(t,e,r,a,i,o){if(!a)return null;var s=n(t,e,r,i,a);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 h(t,e,r,n,a){var i=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,i),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,a,t.RENDERBUFFER,i),i}function p(t,e,r,n,a,i,o,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(a);for(var p=0;p1&&s.drawBuffersWEBGL(l[o]);var y=r.getExtension("WEBGL_depth_texture");y?p?t.depth=d(r,a,i,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g&&(t.depth=d(r,a,i,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):g&&p?t._depth_rb=h(r,a,i,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g?t._depth_rb=h(r,a,i,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):p&&(t._depth_rb=h(r,a,i,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){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);for(m=0;ma||r<0||r>a)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var i=u(n),o=0;o>8*h&255;this.pickOffset=r,a.bind();var p=a.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var g=a.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,a=this.shape[0]*this.shape[1];if(r=n+a)return null;var i=r-n,o=this.xData,s=this.yData;return{object:this,pointId:i,dataCoord:[o[i%this.shape[0]],s[i/this.shape[0]|0]]}},f.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||a(e[0]),o=t.y||a(e[1]),s=t.z||new Float32Array(e[0]*e[1]),l=!1!==t.zsmooth;this.xData=r,this.yData=o;var u,c,f,h,p=t.colorLevels||[0],g=t.colorValues||[0,0,0,1],v=p.length,m=this.bounds;l?(u=m[0]=r[0],c=m[1]=o[0],f=m[2]=r[r.length-1],h=m[3]=o[o.length-1]):(u=m[0]=r[0]+(r[1]-r[0])/2,c=m[1]=o[0]+(o[1]-o[0])/2,f=m[2]=r[r.length-1]+(r[r.length-1]-r[r.length-2])/2,h=m[3]=o[o.length-1]+(o[o.length-1]-o[o.length-2])/2);var y=1/(f-u),b=1/(h-c),x=e[0],_=e[1];this.shape=[x,_];var w=(l?(x-1)*(_-1):x*_)*(d.length>>>1);this.numVertices=w;for(var A=i.mallocUint8(4*w),T=i.mallocFloat32(2*w),k=i.mallocUint8(2*w),M=i.mallocUint32(w),E=0,S=l?x-1:x,C=l?_-1:_,L=0;La[T]&&(r.uniforms.dataAxis=u,r.uniforms.screenOffset=c,r.uniforms.color=v[t],r.uniforms.angle=m[t],i.drawArrays(i.TRIANGLES,a[T],a[k]-a[T]))),y[t]&&A&&(c[1^t]-=M*h*b[t],r.uniforms.dataAxis=f,r.uniforms.screenOffset=c,r.uniforms.color=x[t],r.uniforms.angle=_[t],i.drawArrays(i.TRIANGLES,w,A)),c[1^t]=M*s[2+(1^t)]-1,p[t+2]&&(c[1^t]+=M*h*g[t+2],Ta[T]&&(r.uniforms.dataAxis=u,r.uniforms.screenOffset=c,r.uniforms.color=v[t+2],r.uniforms.angle=m[t+2],i.drawArrays(i.TRIANGLES,a[T],a[k]-a[T]))),y[t+2]&&A&&(c[1^t]+=M*h*b[t+2],r.uniforms.dataAxis=f,r.uniforms.screenOffset=c,r.uniforms.color=x[t+2],r.uniforms.angle=_[t+2],i.drawArrays(i.TRIANGLES,w,A))}),g.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,a=r.gl,i=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-i[c])/(i[2+c]-i[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,a.drawArrays(a.TRIANGLES,this.titleOffset,this.titleCount)}}}(),g.bind=(d=[0,0],h=[0,0],p=[0,0],function(){var t=this.plot,e=this.shader,r=t._tickBounds,n=t.dataBox,a=t.screenBox,i=t.viewBox;e.bind();for(var o=0;o<2;++o){var s=r[o],l=r[o+2]-s,u=.5*(n[o+2]+n[o]),c=n[o+2]-n[o],f=i[o],g=i[o+2]-f,v=a[o],m=a[o+2]-v;h[o]=2*l/c*g/m,d[o]=2*(s-u)/c*g/m}p[1]=2*t.pixelRatio/(a[3]-a[1]),p[0]=p[1]*(a[3]-a[1])/(a[2]-a[0]),e.uniforms.dataScale=h,e.uniforms.dataShift=d,e.uniforms.textScale=p,this.vbo.bind(),e.attributes.textCoordinate.pointer()}),g.update=function(t){var e,r,n,a,o,s=[],l=t.ticks,u=t.bounds;for(o=0;o<2;++o){var c=[Math.floor(s.length/3)],f=[-1/0],d=l[o];for(e=0;e=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(g,e[1],g,e[3],h[p],d[p]):o.drawLine(e[0],g,e[2],g,h[p],d[p])}}for(p=0;p=0;--t)this.objects[t].dispose();this.objects.length=0;for(t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},u.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},u.removeObject=function(t){for(var e=this.objects,r=0;r 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]),r.pickVertex=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]),r.pickFragment=n(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"])},{glslify:211}],211:[function(t,e,r){arguments[4][167][0].apply(r,arguments)},{dup:167}],212:[function(t,e,r){"use strict";var n=t("gl-shader"),a=t("gl-buffer"),i=t("typedarray-pool"),o=t("./lib/shader");function s(t,e,r,n,a){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.shader=n,this.pickShader=a,this.sizeMin=.5,this.sizeMinCap=2,this.sizeMax=20,this.areaRatio=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.blend=!1,this.pickOffset=0,this.points=null}e.exports=function(t,e){var r=t.gl,i=a(r),l=a(r),u=n(r,o.pointVertex,o.pointFragment),c=n(r,o.pickVertex,o.pickFragment),f=new s(t,i,l,u,c);return f.update(e),t.addObject(f),f};var l,u,c=s.prototype;c.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},c.update=function(t){var e;function r(e,r){return e in t?t[e]:r}t=t||{},this.sizeMin=r("sizeMin",.5),this.sizeMax=r("sizeMax",20),this.color=r("color",[1,0,0,1]).slice(),this.areaRatio=r("areaRatio",1),this.borderColor=r("borderColor",[0,0,0,1]).slice(),this.blend=r("blend",!1);var n=t.positions.length>>>1,a=t.positions instanceof Float32Array,o=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,s=t.positions,l=a?s:i.mallocFloat32(s.length),u=o?t.idToIndex:i.mallocInt32(n);if(a||l.set(s),!o)for(l.set(s),e=0;e>>1;for(r=0;r=e[0]&&i<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,a),c=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(s,.33333)));l[0]=2/i,l[4]=2/o,l[6]=-2*a[0]/i-1,l[7]=-2*a[1]/o-1,this.offsetBuffer.bind(),r.bind(),r.attributes.position.pointer(),r.uniforms.matrix=l,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointCloud=c<5,r.uniforms.pointSize=c,r.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),e&&(u[0]=255&t,u[1]=t>>8&255,u[2]=t>>16&255,u[3]=t>>24&255,this.pickBuffer.bind(),r.attributes.pickId.pointer(n.UNSIGNED_BYTE),r.uniforms.pickOffset=u,this.pickOffset=t);var f=n.getParameter(n.BLEND),d=n.getParameter(n.DITHER);return f&&!this.blend&&n.disable(n.BLEND),d&&n.disable(n.DITHER),n.drawArrays(n.POINTS,0,this.pointCount),f&&!this.blend&&n.enable(n.BLEND),d&&n.enable(n.DITHER),t+this.pointCount}),c.draw=c.unifiedDraw,c.drawPick=c.unifiedDraw,c.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}}},{"./lib/shader":210,"gl-buffer":162,"gl-shader":217,"typedarray-pool":338}],213:[function(t,e,r){"use strict";var n=t("glslify");r.boxVertex=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n"]),r.boxFragment=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"])},{glslify:214}],214:[function(t,e,r){arguments[4][167][0].apply(r,arguments)},{dup:167}],215:[function(t,e,r){"use strict";var n=t("gl-shader"),a=t("gl-buffer"),i=t("./lib/shaders");function o(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-1/0,-1/0],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}e.exports=function(t,e){var r=t.gl,s=a(r,[0,0,0,1,1,0,1,1]),l=n(r,i.boxVertex,i.boxFragment),u=new o(t,s,l);return u.update(e),t.addOverlay(u),u};var s=o.prototype;s.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),a=(this.outerFill,this.outerColor),i=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,f=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],d=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],h=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(f=Math.max(f,u[0]),d=Math.max(d,u[1]),h=Math.min(h,u[2]),p=Math.min(p,u[3]),!(h0){var m=r*c;o.drawBox(f-m,d-m,h+m,d+m,i),o.drawBox(f-m,p-m,h+m,p+m,i),o.drawBox(f-m,d-m,f+m,p+m,i),o.drawBox(h-m,d-m,h+m,p+m,i)}}}},s.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},s.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":213,"gl-buffer":162,"gl-shader":217}],216:[function(t,e,r){"use strict";e.exports=function(t,e){var r=e[0],i=e[1],o=n(t,r,i,{}),s=a.mallocUint8(r*i*4);return new l(t,o,s)};var n=t("gl-fbo"),a=t("typedarray-pool"),i=t("ndarray"),o=t("bit-twiddle").nextPow2;function s(t,e,r,n,a){this.coord=[t,e],this.id=r,this.value=n,this.distance=a}function l(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}var u=l.prototype;Object.defineProperty(u,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(t){if(this.gl){this.fbo.shape=t;var e=this.fbo.shape[0],r=this.fbo.shape[1];if(r*e*4>this.buffer.length){a.free(this.buffer);for(var n=this.buffer=a.mallocUint8(o(r*e*4)),i=0;ir)for(t=r;te)for(t=e;t=0){for(var A=0|w.type.charAt(w.type.length-1),T=new Array(A),k=0;k=0;)M+=1;_[y]=M}var E=new Array(r.length);function S(){d.program=o.program(h,d._vref,d._fref,x,_);for(var t=0;t=0){if((p=d.charCodeAt(d.length-1)-48)<2||p>4)throw new n("","Invalid data type for attribute "+f+": "+d);o(t,e,h[0],a,p,i,f)}else{if(!(d.indexOf("mat")>=0))throw new n("","Unknown data type for attribute "+f+": "+d);var p;if((p=d.charCodeAt(d.length-1)-48)<2||p>4)throw new n("","Invalid data type for attribute "+f+": "+d);s(t,e,h,a,p,i,f)}}}return i};var n=t("./GLError");function a(t,e,r,n,a,i){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=a,this._constFunc=i}var i=a.prototype;function o(t,e,r,n,i,o,s){for(var l=["gl","v"],u=[],c=0;c4)throw new a("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new a("","Unknown uniform data type for "+name+": "+r)}if((i=r.charCodeAt(r.length-1)-48)<2||i>4)throw new a("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new a("","Unrecognized data type for vector "+name+": "+r)}}}function u(e){for(var n=["return function updateProperty(obj){"],a=function t(e,r){if("object"!=typeof r)return[[e,r]];var n=[];for(var a in r){var i=r[a],o=e;parseInt(a)+""===a?o+="["+a+"]":o+="."+a,"object"==typeof i?n.push.apply(n,t(o,i)):n.push([o,i])}return n}("",e),i=0;i4)throw new a("","Invalid data type");return"b"===t.charAt(0)?o(r,!1):o(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r;if((r=t.charCodeAt(t.length-1)-48)<2||r>4)throw new a("","Invalid uniform dimension type for matrix "+name+": "+t);return o(r*r,0)}throw new a("","Unknown uniform data type for "+name+": "+t)}}(r[c].type);var h}function f(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){s[0]in i||(i[s[0]]=[]),i=i[s[0]];for(var l=1;l1)for(var l=0;l halfCharStep + halfCharWidth ||\n\t\t\t\t\tfloor(uv.x) < halfCharStep - halfCharWidth) return;\n\n\t\t\t\tuv += charId * charStep;\n\t\t\t\tuv = uv / atlasSize;\n\n\t\t\t\tvec4 color = fontColor;\n\t\t\t\tvec4 mask = texture2D(atlas, uv);\n\n\t\t\t\tfloat maskY = lightness(mask);\n\t\t\t\t// float colorY = lightness(color);\n\t\t\t\tcolor.a *= maskY;\n\t\t\t\tcolor.a *= opacity;\n\n\t\t\t\t// color.a += .1;\n\n\t\t\t\t// antialiasing, see yiq color space y-channel formula\n\t\t\t\t// color.rgb += (1. - color.rgb) * (1. - mask.rgb);\n\n\t\t\t\tgl_FragColor = color;\n\t\t\t}"});return{regl:t,draw:e,atlas:{}}},A.prototype.update=function(t){var e=this;if("string"==typeof t)t={text:t};else if(!t)return;null!=(t=a(t,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0)).opacity&&(Array.isArray(t.opacity)?this.opacity=t.opacity.map((function(t){return parseFloat(t)})):this.opacity=parseFloat(t.opacity)),null!=t.viewport&&(this.viewport=f(t.viewport),A.normalViewport&&(this.viewport.y=this.canvas.height-this.viewport.y-this.viewport.height),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null==this.viewport&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null!=t.kerning&&(this.kerning=t.kerning),null!=t.offset&&("number"==typeof t.offset&&(t.offset=[t.offset,0]),this.positionOffset=y(t.offset)),t.direction&&(this.direction=t.direction),t.range&&(this.range=t.range,this.scale=[1/(t.range[2]-t.range[0]),1/(t.range[3]-t.range[1])],this.translate=[-t.range[0],-t.range[1]]),t.scale&&(this.scale=t.scale),t.translate&&(this.translate=t.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),this.font.length||t.font||(t.font=A.baseFontSize+"px sans-serif");var r,i=!1,o=!1;if(t.font&&(Array.isArray(t.font)?t.font:[t.font]).forEach((function(t,r){if("string"==typeof t)try{t=n.parse(t)}catch(e){t=n.parse(A.baseFontSize+"px "+t)}else t=n.parse(n.stringify(t));var a=n.stringify({size:A.baseFontSize,family:t.family,stretch:_?t.stretch:void 0,variant:t.variant,weight:t.weight,style:t.style}),s=h(t.size),l=Math.round(s[0]*p(s[1]));if(l!==e.fontSize[r]&&(o=!0,e.fontSize[r]=l),!(e.font[r]&&a==e.font[r].baseString||(i=!0,e.font[r]=A.fonts[a],e.font[r]))){var u=t.family.join(", "),c=[t.style];t.style!=t.variant&&c.push(t.variant),t.variant!=t.weight&&c.push(t.weight),_&&t.weight!=t.stretch&&c.push(t.stretch),e.font[r]={baseString:a,family:u,weight:t.weight,stretch:t.stretch,style:t.style,variant:t.variant,width:{},kerning:{},metrics:m(u,{origin:"top",fontSize:A.baseFontSize,fontStyle:c.join(" ")})},A.fonts[a]=e.font[r]}})),(i||o)&&this.font.forEach((function(r,a){var i=n.stringify({size:e.fontSize[a],family:r.family,stretch:_?r.stretch:void 0,variant:r.variant,weight:r.weight,style:r.style});if(e.fontAtlas[a]=e.shader.atlas[i],!e.fontAtlas[a]){var o=r.metrics;e.shader.atlas[i]=e.fontAtlas[a]={fontString:i,step:2*Math.ceil(e.fontSize[a]*o.bottom*.5),em:e.fontSize[a],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:e.regl.texture()}}null==t.text&&(t.text=e.text)})),"string"==typeof t.text&&t.position&&t.position.length>2){for(var s=Array(.5*t.position.length),d=0;d2){for(var w=!t.position[0].length,T=c.mallocFloat(2*this.count),k=0,M=0;k1?e.align[r]:e.align[0]:e.align;if("number"==typeof n)return n;switch(n){case"right":case"end":return-t;case"center":case"centre":case"middle":return.5*-t}return 0}))),null==this.baseline&&null==t.baseline&&(t.baseline=0),null!=t.baseline&&(this.baseline=t.baseline,Array.isArray(this.baseline)||(this.baseline=[this.baseline]),this.baselineOffset=this.baseline.map((function(t,r){var n=(e.font[r]||e.font[0]).metrics,a=0;return a+=.5*n.bottom,a+="number"==typeof t?t-n.baseline:-n[t],A.normalViewport||(a*=-1),a}))),null!=t.color)if(t.color||(t.color="transparent"),"string"!=typeof t.color&&isNaN(t.color)){var G;if("number"==typeof t.color[0]&&t.color.length>this.counts.length){var q=t.color.length;G=c.mallocUint8(q);for(var X=(t.color.subarray||t.color.slice).bind(t.color),W=0;W4||this.baselineOffset.length>1||this.align&&this.align.length>1||this.fontAtlas.length>1||this.positionOffset.length>2){var J=Math.max(.5*this.position.length||0,.25*this.color.length||0,this.baselineOffset.length||0,this.alignOffset.length||0,this.font.length||0,this.opacity.length||0,.5*this.positionOffset.length||0);this.batch=Array(J);for(var Q=0;Q1?this.counts[Q]:this.counts[0],offset:this.textOffsets.length>1?this.textOffsets[Q]:this.textOffsets[0],color:this.color?this.color.length<=4?this.color:this.color.subarray(4*Q,4*Q+4):[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[Q]:this.opacity,baseline:null!=this.baselineOffset[Q]?this.baselineOffset[Q]:this.baselineOffset[0],align:this.align?null!=this.alignOffset[Q]?this.alignOffset[Q]:this.alignOffset[0]:0,atlas:this.fontAtlas[Q]||this.fontAtlas[0],positionOffset:this.positionOffset.length>2?this.positionOffset.subarray(2*Q,2*Q+2):this.positionOffset}}else this.count?this.batch=[{count:this.count,offset:0,color:this.color||[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[0]:this.opacity,baseline:this.baselineOffset[0],align:this.alignOffset?this.alignOffset[0]:0,atlas:this.fontAtlas[0],positionOffset:this.positionOffset}]:this.batch=[]},A.prototype.destroy=function(){},A.prototype.kerning=!0,A.prototype.position={constant:new Float32Array(2)},A.prototype.translate=null,A.prototype.scale=null,A.prototype.font=null,A.prototype.text="",A.prototype.positionOffset=[0,0],A.prototype.opacity=1,A.prototype.color=new Uint8Array([0,0,0,255]),A.prototype.alignOffset=[0,0],A.normalViewport=!1,A.maxAtlasSize=1024,A.atlasCanvas=document.createElement("canvas"),A.atlasContext=A.atlasCanvas.getContext("2d",{alpha:!1}),A.baseFontSize=64,A.fonts={},e.exports=A},{"bit-twiddle":40,"color-normalize":63,"css-font":73,"detect-kerning":88,"es6-weak-map":148,"flatten-vertex-data":156,"font-atlas":157,"font-measure":158,"gl-util/context":227,"is-plain-obj":248,"object-assign":261,"parse-rect":264,"parse-unit":266,"pick-by-alias":270,regl:296,"to-px":323,"typedarray-pool":338}],226:[function(t,e,r){"use strict";var n=t("ndarray"),a=t("ndarray-ops"),i=t("typedarray-pool");e.exports=function(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");o||u(t);if("number"==typeof arguments[1])return m(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return m(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=c(e)?e:e.raw;if(r)return y(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return b(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var o=null,s=null,l=null;function u(t){o=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],s=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],l=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function c(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 f=function(t,e){a.muls(t,e,255)};function d(t,e,r){var n=t.gl,a=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)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,a,i){this.gl=t,this.handle=e,this.format=a,this.type=i,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 p=h.prototype;function g(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 v(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 m(t,e,r,n,a){var i=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture shape");if(a===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=v(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,a,null),new h(t,o,e,r,n,a)}function y(t,e,r,n,a,i){var o=v(t);return t.texImage2D(t.TEXTURE_2D,0,a,a,i,e),new h(t,o,r,n,a,i)}function b(t,e){var r=e.dtype,o=e.shape.slice(),s=t.getParameter(t.MAX_TEXTURE_SIZE);if(o[0]<0||o[0]>s||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=g(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 c,d,p=0;if(2===o.length)p=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])p=t.ALPHA;else if(2===o[2])p=t.LUMINANCE_ALPHA;else if(3===o[2])p=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");p=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,l=!1);var m=e.size;if(l)c=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=i.malloc(m,r);var b=n(d,o,y,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?a.assign(b,e):f(b,e),c=d.subarray(0,m)}var x=v(t);return t.texImage2D(t.TEXTURE_2D,0,p,o[0],o[1],0,p,u,c),l||i.free(d),new h(t,x,o[0],o[1],p,u)}Object.defineProperties(p,{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 d(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return d(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,d(this,this._shape[0],t),t}}}),p.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},p.dispose=function(){this.gl.deleteTexture(this.handle)},p.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)},p.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=c(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,c){var d=c.dtype,h=c.shape.slice();if(h.length<2||h.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var p=0,v=0,m=g(h,c.stride.slice());"float32"===d?p=t.FLOAT:"float64"===d?(p=t.FLOAT,m=!1,d="float32"):"uint8"===d?p=t.UNSIGNED_BYTE:(p=t.UNSIGNED_BYTE,m=!1,d="uint8");if(2===h.length)v=t.LUMINANCE,h=[h[0],h[1],1],c=n(c.data,h,[c.stride[0],c.stride[1],1],c.offset);else{if(3!==h.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===h[2])v=t.ALPHA;else if(2===h[2])v=t.LUMINANCE_ALPHA;else if(3===h[2])v=t.RGB;else{if(4!==h[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");v=t.RGBA}h[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=c.size,b=u.indexOf(o)<0;b&&u.push(o);if(p===l&&m)0===c.offset&&c.data.length===y?b?t.texImage2D(t.TEXTURE_2D,o,s,h[0],h[1],0,s,l,c.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,h[0],h[1],s,l,c.data):b?t.texImage2D(t.TEXTURE_2D,o,s,h[0],h[1],0,s,l,c.data.subarray(c.offset,c.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,h[0],h[1],s,l,c.data.subarray(c.offset,c.offset+y));else{var x;x=l===t.FLOAT?i.mallocFloat32(y):i.mallocUint8(y);var _=n(x,h,[h[2],h[2]*h[0],1]);p===t.FLOAT&&l===t.UNSIGNED_BYTE?f(_,c):a.assign(_,c),b?t.texImage2D(t.TEXTURE_2D,o,s,h[0],h[1],0,s,l,x.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,h[0],h[1],s,l,x.subarray(0,y)),l===t.FLOAT?i.freeFloat32(x):i.freeUint8(x)}}(s,e,r,o,this.format,this.type,this._mipLevels,t)}}},{ndarray:258,"ndarray-ops":257,"typedarray-pool":338}],227:[function(t,e,r){(function(r){(function(){"use strict";var n=t("pick-by-alias");function a(t){if(t.container)if(t.container==document.body)document.body.style.width||(t.canvas.width=t.width||t.pixelRatio*r.innerWidth),document.body.style.height||(t.canvas.height=t.height||t.pixelRatio*r.innerHeight);else{var e=t.container.getBoundingClientRect();t.canvas.width=t.width||e.right-e.left,t.canvas.height=t.height||e.bottom-e.top}}function i(t){return"function"==typeof t.getContext&&"width"in t&&"height"in t}function o(){var t=document.createElement("canvas");return t.style.position="absolute",t.style.top=0,t.style.left=0,t}e.exports=function(t){var e;if(t?"string"==typeof t&&(t={container:t}):t={},i(t)?t={container:t}:t="string"==typeof(e=t).nodeName&&"function"==typeof e.appendChild&&"function"==typeof e.getBoundingClientRect?{container:t}:function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(t)?{gl:t}:n(t,{container:"container target element el canvas holder parent parentNode wrapper use ref root node",gl:"gl context webgl glContext",attrs:"attributes attrs contextAttributes",pixelRatio:"pixelRatio pxRatio px ratio pxratio pixelratio",width:"w width",height:"h height"},!0),t.pixelRatio||(t.pixelRatio=r.pixelRatio||1),t.gl)return t.gl;if(t.canvas&&(t.container=t.canvas.parentNode),t.container){if("string"==typeof t.container){var s=document.querySelector(t.container);if(!s)throw Error("Element "+t.container+" is not found");t.container=s}i(t.container)?(t.canvas=t.container,t.container=t.canvas.parentNode):t.canvas||(t.canvas=o(),t.container.appendChild(t.canvas),a(t))}else if(!t.canvas){if("undefined"==typeof document)throw Error("Not DOM environment. Use headless-gl.");t.container=document.body||document.documentElement,t.canvas=o(),t.container.appendChild(t.canvas),a(t)}if(!t.gl)try{t.gl=t.canvas.getContext("webgl",t.attrs)}catch(e){try{t.gl=t.canvas.getContext("experimental-webgl",t.attrs)}catch(e){t.gl=t.canvas.getContext("webgl-experimental",t.attrs)}}return t.gl}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"pick-by-alias":270}],228:[function(t,e,r){var n=t("glsl-tokenizer"),a=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 k(r),m+=r.length,(h=h.slice(r.length)).length}}function D(){return/[^a-fA-F0-9]/.test(e)?(k(h.join("")),d=999,c):(h.push(e),r=e,c+1)}function R(){return"."===e||/[eE]/.test(e)?(h.push(e),d=5,r=e,c+1):"x"===e&&1===h.length&&"0"===h[0]?(d=11,h.push(e),r=e,c+1):/[^\d]/.test(e)?(k(h.join("")),d=999,c):(h.push(e),r=e,c+1)}function I(){return"f"===e&&(h.push(e),r=e,c+=1),/[eE]/.test(e)?(h.push(e),r=e,c+1):("-"!==e&&"+"!==e||!/[eE]/.test(r))&&/[^\d]/.test(e)?(k(h.join("")),d=999,c):(h.push(e),r=e,c+1)}function P(){if(/[^\d\w_]/.test(e)){var t=h.join("");return d=T[t]?8:A[t]?7:6,k(h.join("")),d=999,c}return h.push(e),r=e,c+1}};var n=t("./lib/literals"),a=t("./lib/operators"),i=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":231,"./lib/builtins-300es":230,"./lib/literals":233,"./lib/literals-300es":232,"./lib/operators":234}],230:[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":231}],231:[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"]},{}],232:[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","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":233}],233:[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","uint","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"]},{}],234:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],235:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),a=[];return a=(a=a.concat(r(t))).concat(r(null))}},{"./index":229}],236:[function(t,e,r){arguments[4][167][0].apply(r,arguments)},{dup:167}],237:[function(t,e,r){(function(r){(function(){"use strict";var n,a=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:a,e.exports=n}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":244}],238:[function(t,e,r){"use strict";var n=t("is-browser");e.exports=n&&function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){t=!1}return t}()},{"is-browser":244}],239:[function(t,e,r){r.read=function(t,e,r,n,a){var i,o,s=8*a-n-1,l=(1<>1,c=-7,f=r?a-1:0,d=r?-1:1,h=t[e+f];for(f+=d,i=h&(1<<-c)-1,h>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=d,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=d,c-=8);if(0===i)i=1-u;else{if(i===l)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=u}return(h?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,s,l,u=8*i-a-1,c=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-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?d/l:d*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,a),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+h]=255&s,h+=p,s/=256,a-=8);for(o=o<0;t[r+h]=255&o,h+=p,o/=256,u-=8);t[r+h-p]|=128*g}},{}],240:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function a(t,e,r,n,a){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=a,this.count=(e?e.count:0)+(r?r.count:0)+n.length}e.exports=function(t){if(!t||0===t.length)return new m(null);return new m(v(t))};var i=a.prototype;function o(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 s(t,e){var r=v(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 l(t,e){var r=t.intervals([]);r.push(e),s(t,r)}function u(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?0:(r.splice(n,1),s(t,r),1)}function c(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var a=r(t[n]);if(a)return a}}function d(t,e){for(var r=0;r>1],i=[],o=[],s=[];for(r=0;r3*(e+1)?l(this,t):this.left.insert(t):this.left=v([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?l(this,t):this.right.insert(t):this.right=v([t]);else{var r=n.ge(this.leftPoints,t,p),a=n.ge(this.rightPoints,t,g);this.leftPoints.splice(r,0,t),this.rightPoints.splice(a,0,t)}},i.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?u(this,t):2===(s=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?u(this,t):2===(s=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,a=this.left;a.right;)r=a,a=a.right;if(r===this)a.right=this.right;else{var i=this.left,s=this.right;r.count-=a.count,r.right=a.left,a.left=i,a.right=s}o(this,a),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?o(this,this.left):o(this,this.right);return 1}for(i=n.ge(this.leftPoints,t,p);ithis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return f(this.rightPoints,t,e)}return d(this.leftPoints,e)},i.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?f(this.rightPoints,t,r):d(this.leftPoints,r)};var y=m.prototype;y.insert=function(t){this.root?this.root.insert(t):this.root=new a(t[0],null,null,[t],[t])},y.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},y.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},y.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(y,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(y,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":241}],241:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",a?".get(m)":"[m]"];return i?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("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],!1,a),n("B","x"+t+"y",e,["y"],!0,a),n("P","c(x,y)"+t+"0",e,["y","c"],!1,a),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,a),"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:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],242:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r * @license MIT */ -e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],212:[function(t,e,r){"use strict";e.exports="undefined"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion))},{}],213:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],214:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],215:[function(t,e,r){"use strict";e.exports=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}},{}],216:[function(t,e,r){"use strict";e.exports=function(t){return"string"==typeof t&&(t=t.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(t)&&/[\dz]$/i.test(t)&&t.length>4))}},{}],217:[function(t,e,r){"use strict";e.exports=Math.log2||function(t){return Math.log(t)*Math.LOG2E}},{}],218:[function(t,e,r){"use strict";e.exports=function(t,e){e||(e=t,t=window);var r=0,a=0,i=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!==a||c!==i||l(s))&&(r=0|t,a=u||0,i=c||0,e&&e(r,a,i,o))}function c(t){u(0,t)}function f(){(r||a||i||o.shift||o.alt||o.meta||o.control)&&(a=i=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,a,i,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():function(){if(!s)return;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 a},enumerable:!0},y:{get:function(){return i},enumerable:!0},mods:{get:function(){return o},enumerable:!0}}),m};var n=t("mouse-event")},{"mouse-event":220}],219:[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 a=t.clientX||0,i=t.clientY||0,o=(s=e,s===window||s===document||s===document.body?n:s.getBoundingClientRect());var s;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],220:[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 w=t.getters||[],A=new Array(x),T=0;T=0?A[T]=!0:A[T]=!1;return function(t,e,r,x,_,w){var A=w.length,T=_.length;if(T<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var k="extractContour"+_.join("_"),M=[],E=[],S=[],C=0;C0&&R.push(l(C,_[L-1])+"*"+s(_[L-1])),E.push(p(C,_[L])+"=("+R.join("-")+")|0")}for(C=0;C=0;--C)I.push(s(_[C]));E.push("Q=("+I.join("*")+")|0","P=mallocUint32(Q)","V=mallocUint32(Q)","X=0"),E.push(g(0)+"=0");for(L=1;L<1<0;_=_-1&p)b.push("V[X+"+m(_)+"]");b.push(y(0));for(_=0;_=0;--e)B(e,0);var r=[];for(e=0;e0){",d(_[e]),"=1;"),t(e-1,r|1<<_[e]);for(var n=0;n>",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:a,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":79}],224:[function(t,e,r){var n=t("iota-array"),a=t("is-buffer"),i="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&&i.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];}}})")):i.push("ORDER})")),i.push("proto.set=function "+r+"_set("+l.join(",")+",v){"),a?i.push("return this.data.set("+c+",v)}"):i.push("return this.data["+c+"]=v}"),i.push("proto.get=function "+r+"_get("+l.join(",")+"){"),a?i.push("return this.data.get("+c+")}"):i.push("return this.data["+c+"]}"),i.push("proto.index=function "+r+"_index(",l.join(),"){return "+c+"}"),i.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+"]"}));i.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}");i.push("return new "+r+"(this.data,"+o.map((function(t){return"a"+t})).join(",")+","+o.map((function(t){return"c"+t})).join(",")+",b)}"),i.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 i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.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",i.join("\n"))(u[t],s)}var u={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],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){n=0;for(s=0;st==t>0?i===-1>>>0?(r+=1,i=0):i+=1:0===i?(i=-1>>>0,r-=1):i-=1;return n.pack(i,r)}},{"double-bits":89}],226:[function(t,e,r){var n=Math.PI,a=u(120);function i(t,e,r,n){return["C",t,e,r,n,r,n]}function o(t,e,r,n,a,i){return["C",t/3+2/3*r,e/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}function s(t,e,r,i,o,u,c,f,h,d){if(d)A=d[0],T=d[1],_=d[2],w=d[3];else{var p=l(t,e,-o);t=p.x,e=p.y;var g=(t-(f=(p=l(f,h,-o)).x))/2,v=(e-(h=p.y))/2,m=g*g/(r*r)+v*v/(i*i);m>1&&(r*=m=Math.sqrt(m),i*=m);var y=r*r,b=i*i,x=(u==c?-1:1)*Math.sqrt(Math.abs((y*b-y*v*v-b*g*g)/(y*v*v+b*g*g)));x==1/0&&(x=1);var _=x*r*v/i+(t+f)/2,w=x*-i*g/r+(e+h)/2,A=Math.asin(((e-w)/i).toFixed(9)),T=Math.asin(((h-w)/i).toFixed(9));(A=t<_?n-A:A)<0&&(A=2*n+A),(T=f<_?n-T:T)<0&&(T=2*n+T),c&&A>T&&(A-=2*n),!c&&T>A&&(T-=2*n)}if(Math.abs(T-A)>a){var k=T,M=f,E=h;T=A+a*(c&&T>A?1:-1);var S=s(f=_+r*Math.cos(T),h=w+i*Math.sin(T),r,i,o,0,c,M,E,[T,k,_,w])}var C=Math.tan((T-A)/4),L=4/3*r*C,O=4/3*i*C,D=[2*t-(t+L*Math.sin(A)),2*e-(e-O*Math.cos(A)),f+L*Math.sin(T),h-O*Math.cos(T),f,h];if(d)return D;S&&(D=D.concat(S));for(var R=0;R7&&(r.push(m.splice(0,7)),m.unshift("C"));break;case"S":var b=d,x=p;"C"!=e&&"S"!=e||(b+=b-n,x+=x-a),m=["C",b,x,m[1],m[2],m[3],m[4]];break;case"T":"Q"==e||"T"==e?(f=2*d-f,h=2*p-h):(f=d,h=p),m=o(d,p,f,h,m[1],m[2]);break;case"Q":f=m[1],h=m[2],m=o(d,p,m[1],m[2],m[3],m[4]);break;case"L":m=i(d,p,m[1],m[2]);break;case"H":m=i(d,p,m[1],p);break;case"V":m=i(d,p,d,m[1]);break;case"Z":m=i(d,p,l,c)}e=y,d=m[m.length-2],p=m[m.length-1],m.length>4?(n=m[m.length-4],a=m[m.length-3]):(n=d,a=p),r.push(m)}return r}},{}],227:[function(t,e,r){ +e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],246:[function(t,e,r){"use strict";e.exports="undefined"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion))},{}],247:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],248:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],249:[function(t,e,r){"use strict";e.exports=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}},{}],250:[function(t,e,r){"use strict";e.exports=function(t){return"string"==typeof t&&(t=t.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(t)&&/[\dz]$/i.test(t)&&t.length>4))}},{}],251:[function(t,e,r){"use strict";e.exports=Math.log2||function(t){return Math.log(t)*Math.LOG2E}},{}],252:[function(t,e,r){"use strict";e.exports=function(t,e){e||(e=t,t=window);var r=0,a=0,i=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!==a||c!==i||l(s))&&(r=0|t,a=u||0,i=c||0,e&&e(r,a,i,o))}function c(t){u(0,t)}function f(){(r||a||i||o.shift||o.alt||o.meta||o.control)&&(a=i=0,r=0,o.shift=o.alt=o.control=o.meta=!1,e&&e(0,0,0,o))}function d(t){l(t)&&e&&e(r,a,i,o)}function h(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",h),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",d),t.addEventListener("keydown",d),t.addEventListener("keypress",d),t!==window&&(window.addEventListener("blur",f),window.addEventListener("keyup",d),window.addEventListener("keydown",d),window.addEventListener("keypress",d)))}v();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return s},set:function(e){e?v():function(){if(!s)return;s=!1,t.removeEventListener("mousemove",h),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",d),t.removeEventListener("keydown",d),t.removeEventListener("keypress",d),t!==window&&(window.removeEventListener("blur",f),window.removeEventListener("keyup",d),window.removeEventListener("keydown",d),window.removeEventListener("keypress",d))}()},enumerable:!0},buttons:{get:function(){return r},enumerable:!0},x:{get:function(){return a},enumerable:!0},y:{get:function(){return i},enumerable:!0},mods:{get:function(){return o},enumerable:!0}}),m};var n=t("mouse-event")},{"mouse-event":254}],253:[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 a=t.clientX||0,i=t.clientY||0,o=(s=e,s===window||s===document||s===document.body?n:s.getBoundingClientRect());var s;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],254:[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 w=t.getters||[],A=new Array(x),T=0;T=0?A[T]=!0:A[T]=!1;return function(t,e,r,x,_,w){var A=w.length,T=_.length;if(T<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var k="extractContour"+_.join("_"),M=[],E=[],S=[],C=0;C0&&R.push(l(C,_[L-1])+"*"+s(_[L-1])),E.push(p(C,_[L])+"=("+R.join("-")+")|0")}for(C=0;C=0;--C)I.push(s(_[C]));E.push("Q=("+I.join("*")+")|0","P=mallocUint32(Q)","V=mallocUint32(Q)","X=0"),E.push(g(0)+"=0");for(L=1;L<1<0;_=_-1&p)b.push("V[X+"+m(_)+"]");b.push(y(0));for(_=0;_=0;--e)B(e,0);var r=[];for(e=0;e0){",h(_[e]),"=1;"),t(e-1,r|1<<_[e]);for(var n=0;n>",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:a,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":79}],258:[function(t,e,r){var n=t("iota-array"),a=t("is-buffer"),i="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&&i.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];}}})")):i.push("ORDER})")),i.push("proto.set=function "+r+"_set("+l.join(",")+",v){"),a?i.push("return this.data.set("+c+",v)}"):i.push("return this.data["+c+"]=v}"),i.push("proto.get=function "+r+"_get("+l.join(",")+"){"),a?i.push("return this.data.get("+c+")}"):i.push("return this.data["+c+"]}"),i.push("proto.index=function "+r+"_index(",l.join(),"){return "+c+"}"),i.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 h=o.map((function(t){return"a"+t+"=this.shape["+t+"]"})),p=o.map((function(t){return"c"+t+"=this.stride["+t+"]"}));i.push("proto.lo=function "+r+"_lo("+l.join(",")+"){var b=this.offset,d=0,"+h.join(",")+","+p.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");i.push("return new "+r+"(this.data,"+o.map((function(t){return"a"+t})).join(",")+","+o.map((function(t){return"c"+t})).join(",")+",b)}"),i.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 i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.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",i.join("\n"))(u[t],s)}var u={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],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){n=0;for(s=0;st==t>0?i===-1>>>0?(r+=1,i=0):i+=1:0===i?(i=-1>>>0,r-=1):i-=1;return n.pack(i,r)}},{"double-bits":89}],260:[function(t,e,r){var n=Math.PI,a=u(120);function i(t,e,r,n){return["C",t,e,r,n,r,n]}function o(t,e,r,n,a,i){return["C",t/3+2/3*r,e/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}function s(t,e,r,i,o,u,c,f,d,h){if(h)A=h[0],T=h[1],_=h[2],w=h[3];else{var p=l(t,e,-o);t=p.x,e=p.y;var g=(t-(f=(p=l(f,d,-o)).x))/2,v=(e-(d=p.y))/2,m=g*g/(r*r)+v*v/(i*i);m>1&&(r*=m=Math.sqrt(m),i*=m);var y=r*r,b=i*i,x=(u==c?-1:1)*Math.sqrt(Math.abs((y*b-y*v*v-b*g*g)/(y*v*v+b*g*g)));x==1/0&&(x=1);var _=x*r*v/i+(t+f)/2,w=x*-i*g/r+(e+d)/2,A=Math.asin(((e-w)/i).toFixed(9)),T=Math.asin(((d-w)/i).toFixed(9));(A=t<_?n-A:A)<0&&(A=2*n+A),(T=f<_?n-T:T)<0&&(T=2*n+T),c&&A>T&&(A-=2*n),!c&&T>A&&(T-=2*n)}if(Math.abs(T-A)>a){var k=T,M=f,E=d;T=A+a*(c&&T>A?1:-1);var S=s(f=_+r*Math.cos(T),d=w+i*Math.sin(T),r,i,o,0,c,M,E,[T,k,_,w])}var C=Math.tan((T-A)/4),L=4/3*r*C,O=4/3*i*C,D=[2*t-(t+L*Math.sin(A)),2*e-(e-O*Math.cos(A)),f+L*Math.sin(T),d-O*Math.cos(T),f,d];if(h)return D;S&&(D=D.concat(S));for(var R=0;R7&&(r.push(m.splice(0,7)),m.unshift("C"));break;case"S":var b=h,x=p;"C"!=e&&"S"!=e||(b+=b-n,x+=x-a),m=["C",b,x,m[1],m[2],m[3],m[4]];break;case"T":"Q"==e||"T"==e?(f=2*h-f,d=2*p-d):(f=h,d=p),m=o(h,p,f,d,m[1],m[2]);break;case"Q":f=m[1],d=m[2],m=o(h,p,m[1],m[2],m[3],m[4]);break;case"L":m=i(h,p,m[1],m[2]);break;case"H":m=i(h,p,m[1],p);break;case"V":m=i(h,p,h,m[1]);break;case"Z":m=i(h,p,l,c)}e=y,h=m[m.length-2],p=m[m.length-1],m.length>4?(n=m[m.length-4],a=m[m.length-3]):(n=h,a=p),r.push(m)}return r}},{}],261:[function(t,e,r){ /* object-assign (c) Sindre Sorhus @license MIT */ -"use strict";var n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,l=o(t),u=1;u * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT license. */ -"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return n(r="undefined"!=typeof r?r+"":" ",e)+t}},{"repeat-string":261}],229:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)return[t];var r=[t];"string"==typeof e||Array.isArray(e)?e={brackets:e}:e||(e={});var n=e.brackets?Array.isArray(e.brackets)?e.brackets:[e.brackets]:["{}","[]","()"],a=e.escape||"___",i=!!e.flat;n.forEach((function(t){var e=new RegExp(["\\",t[0],"[^\\",t[0],"\\",t[1],"]*\\",t[1]].join("")),n=[];function i(e,i,o){var s=r.push(e.slice(t[0].length,-t[1].length))-1;return n.push(s),a+s+a}r.forEach((function(t,n){for(var a,o=0;t!=a;)if(a=t,t=t.replace(e,i),o++>1e4)throw Error("References have circular dependency. Please, check them.");r[n]=t})),n=n.reverse(),r=r.map((function(e){return n.forEach((function(r){e=e.replace(new RegExp("(\\"+a+r+"\\"+a+")","g"),t[0]+"$1"+t[1])})),e}))}));var o=new RegExp("\\"+a+"([0-9]+)\\"+a);return i?r:function t(e,r,n){for(var a,i=[],s=0;a=o.exec(e);){if(s++>1e4)throw Error("Circular references in parenthesis");i.push(e.slice(0,a.index)),i.push(t(r[a[1]],r)),e=e.slice(a.index+a[0].length)}return i.push(e),i}(r[0],r)}function a(t,e){if(e&&e.flat){var r,n=e&&e.escape||"___",a=t[0];if(!a)return"";for(var i=new RegExp("\\"+n+"([0-9]+)\\"+n),o=0;a!=r;){if(o++>1e4)throw Error("Circular references in "+t);r=a,a=a.replace(i,s)}return a}return t.reduce((function t(e,r){return Array.isArray(r)&&(r=r.reduce(t,"")),e+r}),"");function s(e,r){if(null==t[r])throw Error("Reference "+r+"is undefined");return t[r]}}function i(t,e){return Array.isArray(t)?a(t,e):n(t,e)}i.parse=n,i.stringify=a,e.exports=i},{}],230:[function(t,e,r){"use strict";var n=t("pick-by-alias");e.exports=function(t){var e;arguments.length>1&&(t=arguments);"string"==typeof t?t=t.split(/\s/).map(parseFloat):"number"==typeof t&&(t=[t]);t.length&&"number"==typeof t[0]?e=1===t.length?{width:t[0],height:t[0],x:0,y:0}:2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=n(t,{left:"x l left Left",top:"y t top Top",width:"w width W Width",height:"h height W Width",bottom:"b bottom Bottom",right:"r right Right"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e}},{"pick-by-alias":236}],231:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(a,(function(t,r,a){var o=r.toLowerCase();for(a=function(t){var e=t.match(i);return e?e.map(Number):[]}(a),"m"==o&&a.length>2&&(e.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),e.push(a);if(a.length0;--o)i=l[o],r=s[o],s[o]=s[i],s[i]=r,l[o]=l[r],l[r]=i,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,a,i,o=1;for((r=r||new Array(t))[0]=0,i=1;i0;--i)e=e-(n=e/o|0)*o|0,o=o/i|0,a=0|r[i],r[i]=0|r[n],r[n]=0|a;return r}},{"invert-permutation":208,"typedarray-pool":302}],236:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i,o={};if("string"==typeof e&&(e=a(e)),Array.isArray(e)){var s={};for(i=0;i0){o=i[c][r][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=i[f][r],d=0;d0&&(o=p,s=g,l=f)}return a||o&&u(o,l),s}function f(t,r){var a=i[r][t][0],o=[t];u(a,r);for(var s=a[1^r];;){for(;s!==t;)o.push(s),s=c(o[o.length-2],s,!1);if(i[0][t].length+i[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(o=0;o0;){i[0][o].length;var g=f(o,d);h(0,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}],238:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=n(t,e.length),a=new Array(e.length),i=new Array(e.length),o=[],s=0;s0;){var u=o.pop();a[u]=!1;var c=r[u];for(s=0;s0}))).length,v=new Array(g),m=new Array(g);for(d=0;d0;){var N=F.pop(),B=S[N];l(B,(function(t,e){return t-e}));var j,U=B.length,V=z[N];if(0===V){var H=p[N];j=[H]}for(d=0;d=0))if(z[G]=1^V,F.push(G),0===V)P(H=p[G])||(H.reverse(),j.push(H))}0===V&&r.push(j)}return r};var n=t("edges-to-adjacency-list"),a=t("planar-dual"),i=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[a]===r[0]))return 1;i=t[a-1]}for(var s=1;i;){var l=i.key,u=n(r,l[0],l[1]);if(l[0][0]0))return 0;s=-1,i=i.right}else if(u>0)i=i.left;else{if(!(u<0))return 0;s=1,i=i.right}}return s}}(m.slabs,m.coordinates);return 0===i.length?y:function(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}(l(i),y)};var n=t("robust-orientation")[3],a=t("slab-decomposition"),i=t("interval-tree-1d"),o=t("binary-search-bounds");function s(){return!0}function l(t){for(var e={},r=0;r1e4)throw Error("References have circular dependency. Please, check them.");r[n]=t})),n=n.reverse(),r=r.map((function(e){return n.forEach((function(r){e=e.replace(new RegExp("(\\"+a+r+"\\"+a+")","g"),t[0]+"$1"+t[1])})),e}))}));var o=new RegExp("\\"+a+"([0-9]+)\\"+a);return i?r:function t(e,r,n){for(var a,i=[],s=0;a=o.exec(e);){if(s++>1e4)throw Error("Circular references in parenthesis");i.push(e.slice(0,a.index)),i.push(t(r[a[1]],r)),e=e.slice(a.index+a[0].length)}return i.push(e),i}(r[0],r)}function a(t,e){if(e&&e.flat){var r,n=e&&e.escape||"___",a=t[0];if(!a)return"";for(var i=new RegExp("\\"+n+"([0-9]+)\\"+n),o=0;a!=r;){if(o++>1e4)throw Error("Circular references in "+t);r=a,a=a.replace(i,s)}return a}return t.reduce((function t(e,r){return Array.isArray(r)&&(r=r.reduce(t,"")),e+r}),"");function s(e,r){if(null==t[r])throw Error("Reference "+r+"is undefined");return t[r]}}function i(t,e){return Array.isArray(t)?a(t,e):n(t,e)}i.parse=n,i.stringify=a,e.exports=i},{}],264:[function(t,e,r){"use strict";var n=t("pick-by-alias");e.exports=function(t){var e;arguments.length>1&&(t=arguments);"string"==typeof t?t=t.split(/\s/).map(parseFloat):"number"==typeof t&&(t=[t]);t.length&&"number"==typeof t[0]?e=1===t.length?{width:t[0],height:t[0],x:0,y:0}:2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=n(t,{left:"x l left Left",top:"y t top Top",width:"w width W Width",height:"h height W Width",bottom:"b bottom Bottom",right:"r right Right"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e}},{"pick-by-alias":270}],265:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(a,(function(t,r,a){var o=r.toLowerCase();for(a=function(t){var e=t.match(i);return e?e.map(Number):[]}(a),"m"==o&&a.length>2&&(e.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),e.push(a);if(a.length0;--o)i=l[o],r=s[o],s[o]=s[i],s[i]=r,l[o]=l[r],l[r]=i,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,a,i,o=1;for((r=r||new Array(t))[0]=0,i=1;i0;--i)e=e-(n=e/o|0)*o|0,o=o/i|0,a=0|r[i],r[i]=0|r[n],r[n]=0|a;return r}},{"invert-permutation":242,"typedarray-pool":338}],270:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i,o={};if("string"==typeof e&&(e=a(e)),Array.isArray(e)){var s={};for(i=0;i0){o=i[c][r][0],l=c;break}s=o[1^l];for(var f=0;f<2;++f)for(var d=i[f][r],h=0;h0&&(o=p,s=g,l=f)}return a||o&&u(o,l),s}function f(t,r){var a=i[r][t][0],o=[t];u(a,r);for(var s=a[1^r];;){for(;s!==t;)o.push(s),s=c(o[o.length-2],s,!1);if(i[0][t].length+i[1][t].length===0)break;var l=o[o.length-1],f=t,d=o[1],h=c(l,f,!0);if(n(e[l],e[f],e[d],e[h])<0)break;o.push(t),s=c(l,f)}return o}function d(t,e){return e[1]===e[e.length-1]}for(o=0;o0;){i[0][o].length;var g=f(o,h);d(0,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}],272:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=n(t,e.length),a=new Array(e.length),i=new Array(e.length),o=[],s=0;s0;){var u=o.pop();a[u]=!1;var c=r[u];for(s=0;s0}))).length,v=new Array(g),m=new Array(g);for(h=0;h0;){var N=F.pop(),B=S[N];l(B,(function(t,e){return t-e}));var j,U=B.length,V=z[N];if(0===V){var H=p[N];j=[H]}for(h=0;h=0))if(z[G]=1^V,F.push(G),0===V)P(H=p[G])||(H.reverse(),j.push(H))}0===V&&r.push(j)}return r};var n=t("edges-to-adjacency-list"),a=t("planar-dual"),i=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[a]===r[0]))return 1;i=t[a-1]}for(var s=1;i;){var l=i.key,u=n(r,l[0],l[1]);if(l[0][0]0))return 0;s=-1,i=i.right}else if(u>0)i=i.left;else{if(!(u<0))return 0;s=1,i=i.right}}return s}}(m.slabs,m.coordinates);return 0===i.length?y:function(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}(l(i),y)};var n=t("robust-orientation")[3],a=t("slab-decomposition"),i=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 a=e[1]-r[1],i=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*i+a*s;return!(l-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-a>t&&(i-u)*(a-c)/(o-c)+u-n>t&&(s=!s),i=u,o=c}return s}};return e}},{}],245:[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]),a=1;a0}))}function c(t,n){var a=t.seg,i=n.seg,o=a.start,s=a.end,u=i.start,c=i.end;r&&r.checkIntersection(a,i);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=[];!i.isEmpty();){var h=i.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=v();if(y){var b;if(t)(b=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=h.seg.myFill;r&&r.segmentUpdate(y.seg),h.other.remove(),h.remove()}if(i.getHead()!==h){r&&r.rewind(h.seg);continue}if(t)b=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below,h.seg.myFill.below=g?g.seg.myFill.above:a,h.seg.myFill.above=b?!h.seg.myFill.below:h.seg.myFill.below;else if(null===h.seg.otherFill)m=g?h.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:h.primary?o:a,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)}i.getHead().remove()}return r&&r.done(),f}return t?{addRegion:function(t){for(var n,a,i,o=t[t.length-1],l=0;l1)for(var r=1;r1&&(t.scaleRatio=[t.scale[0]*t.viewport.width,t.scale[1]*t.viewport.height],r(t),t.after&&t.after(t))}function A(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0,r=0;if(x.groups=b=t.map((function(t,u){var c=b[u];return t?("function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),t=o(t,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),c||(b[u]=c={id:u,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},t=s({},y,t)),i(c,t,[{lineWidth:function(t){return.5*+t},capSize:function(t){return.5*+t},opacity:parseFloat,errors:function(t){return t=l(t),r+=t.length,t},positions:function(t,r){return t=l(t,"float64"),r.count=Math.floor(t.length/2),r.bounds=n(t,2),r.offset=e,e+=r.count,t}},{color:function(t,e){var r=e.count;if(t||(t="transparent"),!Array.isArray(t)||"number"==typeof t[0]){var n=t;t=Array(r);for(var i=0;i 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * adjustedScale + translate;\n\tvec2 aBotPosition = (aBotCoord) * adjustedScale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * adjustedScale + translate;\n\tvec2 bBotPosition = (bBotCoord) * adjustedScale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform float dashSize, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:r,divisor:0,stride:8,offset:0},lineTop:{buffer:r,divisor:0,stride:8,offset:4},aColor:{buffer:t.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:t.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},n))}catch(t){e=a}return{fill:t({primitive:"triangle",elements:function(t,e){return e.triangles},offset:0,vert:o(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n\tfragColor.a *= opacity;\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n}\n"]),uniforms:{scale:t.prop("scale"),color:t.prop("fill"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{position:{buffer:t.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:t.prop("positionFractBuffer"),stride:8,offset:8}},blend:n.blend,depth:{enable:!1},scissor:n.scissor,stencil:n.stencil,viewport:n.viewport}),rect:a,miter:e}},v.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null},v.prototype.render=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];e.length&&(t=this).update.apply(t,e),this.draw()},v.prototype.draw=function(){for(var t=this,e=[],r=arguments.length;r--;)e[r]=arguments[r];return(e.length?e:this.passes).forEach((function(e,r){var n;if(e&&Array.isArray(e))return(n=t).draw.apply(n,e);"number"==typeof e&&(e=t.passes[e]),e&&e.count>1&&e.opacity&&(t.regl._refresh(),e.fill&&e.triangles&&e.triangles.length>2&&t.shaders.fill(e),e.thickness&&(e.scale[0]*e.viewport.width>v.precisionThreshold||e.scale[1]*e.viewport.height>v.precisionThreshold||"rect"===e.join||!e.join&&(e.thickness<=2||e.count>=v.maxPoints)?t.shaders.rect(e):t.shaders.miter(e)))})),this},v.prototype.update=function(t){var e=this;if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var r=this.regl,o=this.gl;if(t.forEach((function(t,f){var p=e.passes[f];if(void 0!==t)if(null!==t){if("number"==typeof t[0]&&(t={positions:t}),t=s(t,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color colour stroke colors colours stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow"}),p||(e.passes[f]=p={id:f,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,hole:[],depth:0,dashLength:1,dashTexture:r.texture({channels:1,data:new Uint8Array([255]),width:1,height:1,mag:"linear",min:"linear"}),colorBuffer:r.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array}),positionBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array}),positionFractBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array})},t=i({},v.defaults,t)),null!=t.thickness&&(p.thickness=parseFloat(t.thickness)),null!=t.opacity&&(p.opacity=parseFloat(t.opacity)),null!=t.miterLimit&&(p.miterLimit=parseFloat(t.miterLimit)),null!=t.overlay&&(p.overlay=!!t.overlay,ft.length)&&(e=t.length);for(var r=0,n=new Array(e);r 1.0 + delta) {\n\t\tdiscard;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]),l.vert=h(["precision highp float;\n#define GLSLIFY 1\n\nattribute float x, y, xFract, yFract;\nattribute float size, borderSize;\nattribute vec4 colorId, borderColorId;\nattribute float isActive;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform bool constPointSize;\nuniform sampler2D palette;\nuniform vec2 paletteSize;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nfloat pointSizeScale = (constPointSize) ? 2. : pixelRatio;\n\nbool isDirect = (paletteSize.x < 1.);\n\nvec4 getColor(vec4 id) {\n return isDirect ? id / 255. : texture2D(palette,\n vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n )\n );\n}\n\nvoid main() {\n // ignore inactive points\n if (isActive == 0.) return;\n\n vec2 position = vec2(x, y);\n vec2 positionFract = vec2(xFract, yFract);\n\n vec4 color = getColor(colorId);\n vec4 borderColor = getColor(borderColorId);\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pointSizeScale;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0., 1.);\n\n fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]),v&&(l.frag=l.frag.replace("smoothstep","smoothStep"),s.frag=s.frag.replace("smoothstep","smoothStep")),this.drawCircle=t(l)}x.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4},x.prototype.render=function(){return arguments.length&&this.update.apply(this,arguments),this.draw(),this},x.prototype.draw=function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;nn)?e.tree=c(t,{bounds:f}):n&&n.length&&(e.tree=n),e.tree){var h={primitive:"points",usage:"static",data:e.tree,type:"uint32"};e.elements?e.elements(h):e.elements=o.elements(h)}return a({data:m.float(t),usage:"dynamic"}),i({data:m.fract(t),usage:"dynamic"}),s({data:new Uint8Array(u),type:"uint8",usage:"stream"}),t}},{marker:function(e,r,n){var a=r.activation;if(a.forEach((function(t){return t&&t.destroy&&t.destroy()})),a.length=0,e&&"number"!=typeof e[0]){for(var i=[],s=0,l=Math.min(e.length,r.count);s=0)return i;if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)e=t;else{e=new Uint8Array(t.length);for(var o=0,s=t.length;o4*n&&(this.tooManyColors=!0),this.updatePalette(r),1===a.length?a[0]:a},x.prototype.updatePalette=function(t){if(!this.tooManyColors){var e=this.maxColors,r=this.paletteTexture,n=Math.ceil(.25*t.length/e);if(n>1)for(var a=.25*(t=t.slice()).length%e;a2?(s[0],s[2],n=s[1],a=s[3]):s.length?(n=s[0],a=s[1]):(s.x,n=s.y,s.x+s.width,a=s.y+s.height),l.length>2?(i=l[0],o=l[2],l[1],l[3]):l.length?(i=l[0],o=l[1]):(i=l.x,l.y,o=l.x+l.width,l.y+l.height),[i,n,o,a]}function d(t){if("number"==typeof t)return[t,t,t,t];if(2===t.length)return[t[0],t[1],t[0],t[1]];var e=l(t);return[e.x,e.y,e.x+e.width,e.y+e.height]}e.exports=c,c.prototype.render=function(){for(var t,e=this,r=[],n=arguments.length;n--;)r[n]=arguments[n];return r.length&&(t=this).update.apply(t,r),this.regl.attributes.preserveDrawingBuffer?this.draw():(this.dirty?null==this.planned&&(this.planned=o((function(){e.draw(),e.dirty=!0,e.planned=null}))):(this.draw(),this.dirty=!0,o((function(){e.dirty=!1}))),this)},c.prototype.update=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];if(e.length){for(var n=0;nT))&&(s.lower||!(A>>=e))<<3,(e|=r=(15<(t>>>=r))<<2)|(r=(3<(t>>>=r))<<1)|t>>>r>>1}function s(){function t(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}return 0<(e=r[o(t)>>2]).length?e.pop():new ArrayBuffer(t)}function e(t){r[o(t.byteLength)>>2].push(t)}var r=i(8,(function(){return[]}));return{alloc:t,free:e,allocType:function(e,r){var n=null;switch(e){case 5120:n=new Int8Array(t(r),0,r);break;case 5121:n=new Uint8Array(t(r),0,r);break;case 5122:n=new Int16Array(t(2*r),0,r);break;case 5123:n=new Uint16Array(t(2*r),0,r);break;case 5124:n=new Int32Array(t(4*r),0,r);break;case 5125:n=new Uint32Array(t(4*r),0,r);break;case 5126:n=new Float32Array(t(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(t){e(t.buffer)}}}function l(t){return!!t&&"object"==typeof t&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&"number"==typeof t.offset&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||Y(t.data))}function u(t,e,r,n,a,i){for(var o=0;o(a=s)&&(a=n.buffer.byteLength,5123===f?a>>=1:5125===f&&(a>>=2)),n.vertCount=a,a=o,0>o&&(a=4,1===(o=n.buffer.dimension)&&(a=0),2===o&&(a=1),3===o&&(a=4)),n.primType=a}function o(t){n.elementsCount--,delete s[t.id],t.buffer.destroy(),t.buffer=null}var s={},u=0,c={uint8:5121,uint16:5123};e.oes_element_index_uint&&(c.uint32=5125),a.prototype.bind=function(){this.buffer.bind()};var f=[];return{create:function(t,e){function s(t){if(t)if("number"==typeof t)u(t),f.primType=4,f.vertCount=0|t,f.type=5121;else{var e=null,r=35044,n=-1,a=-1,o=0,h=0;Array.isArray(t)||Y(t)||l(t)?e=t:("data"in t&&(e=t.data),"usage"in t&&(r=K[t.usage]),"primitive"in t&&(n=nt[t.primitive]),"count"in t&&(a=0|t.count),"type"in t&&(h=c[t.type]),"length"in t?o=0|t.length:(o=a,5123===h||5122===h?o*=2:5125!==h&&5124!==h||(o*=4))),i(f,e,r,n,a,o,h)}else u(),f.primType=4,f.vertCount=0,f.type=5121;return s}var u=r.create(null,34963,!0),f=new a(u._buffer);return n.elementsCount++,s(t),s._reglType="elements",s._elements=f,s.subdata=function(t,e){return u.subdata(t,e),s},s.destroy=function(){o(f)},s},createStream:function(t){var e=f.pop();return e||(e=new a(r.create(null,34963,!0,!1)._buffer)),i(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){f.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof a?t._elements:null},clear:function(){Z(s).forEach(o)}}}function g(t){for(var e=W.allocType(5123,t.length),r=0;r>>31<<15,a=(i<<1>>>24)-127,i=i>>13&1023;e[r]=-24>a?n:-14>a?n+(i+1024>>-14-a):15>=a,r.height>>=a,d(r,n[a]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function L(t){for(var e=t.images,r=0;re){for(var r=0;r=--this.refCount&&z(this)}}),o.profile&&(i.getTotalTextureSize=function(){var t=0;return Object.keys(yt).forEach((function(e){t+=yt[e].stats.size})),t}),{create2D:function(e,r){function n(t,e){var r=a.texInfo;O.call(r);var i=C();return"number"==typeof t?M(i,0|t,"number"==typeof e?0|e:0|t):t?(D(r,t),E(i,t)):M(i,1,1),r.genMipmaps&&(i.mipmask=(i.width<<1)-1),a.mipmask=i.mipmask,u(a,i),a.internalformat=i.internalformat,n.width=i.width,n.height=i.height,P(a),S(i,3553),R(r,3553),F(),L(i),o.profile&&(a.stats.size=A(a.internalformat,a.type,i.width,i.height,r.genMipmaps,!1)),n.format=tt[a.internalformat],n.type=et[a.type],n.mag=rt[r.magFilter],n.min=nt[r.minFilter],n.wrapS=at[r.wrapS],n.wrapT=at[r.wrapT],n}var a=new I(3553);return yt[a.id]=a,i.textureCount++,n(e,r),n.subimage=function(t,e,r,i){e|=0,r|=0,i|=0;var o=m();return u(o,a),o.width=0,o.height=0,d(o,t),o.width=o.width||(a.width>>i)-e,o.height=o.height||(a.height>>i)-r,P(a),p(o,3553,e,r,i),F(),T(o),n},n.resize=function(e,r){var i=0|e,s=0|r||i;if(i===a.width&&s===a.height)return n;n.width=a.width=i,n.height=a.height=s,P(a);for(var l=0;a.mipmask>>l;++l){var u=i>>l,c=s>>l;if(!u||!c)break;t.texImage2D(3553,l,a.format,u,c,0,a.format,a.type,null)}return F(),o.profile&&(a.stats.size=A(a.internalformat,a.type,i,s,!1,!1)),n},n._reglType="texture2d",n._texture=a,o.profile&&(n.stats=a.stats),n.destroy=function(){a.decRef()},n},createCube:function(e,r,n,a,s,l){function f(t,e,r,n,a,i){var s,l=h.texInfo;for(O.call(l),s=0;6>s;++s)g[s]=C();if("number"!=typeof t&&t){if("object"==typeof t)if(e)E(g[0],t),E(g[1],e),E(g[2],r),E(g[3],n),E(g[4],a),E(g[5],i);else if(D(l,t),c(h,t),"faces"in t)for(t=t.faces,s=0;6>s;++s)u(g[s],h),E(g[s],t[s]);else for(s=0;6>s;++s)E(g[s],t)}else for(t=0|t||1,s=0;6>s;++s)M(g[s],t,t);for(u(h,g[0]),h.mipmask=l.genMipmaps?(g[0].width<<1)-1:g[0].mipmask,h.internalformat=g[0].internalformat,f.width=g[0].width,f.height=g[0].height,P(h),s=0;6>s;++s)S(g[s],34069+s);for(R(l,34067),F(),o.profile&&(h.stats.size=A(h.internalformat,h.type,f.width,f.height,l.genMipmaps,!0)),f.format=tt[h.internalformat],f.type=et[h.type],f.mag=rt[l.magFilter],f.min=nt[l.minFilter],f.wrapS=at[l.wrapS],f.wrapT=at[l.wrapT],s=0;6>s;++s)L(g[s]);return f}var h=new I(34067);yt[h.id]=h,i.cubeCount++;var g=Array(6);return f(e,r,n,a,s,l),f.subimage=function(t,e,r,n,a){r|=0,n|=0,a|=0;var i=m();return u(i,h),i.width=0,i.height=0,d(i,e),i.width=i.width||(h.width>>a)-r,i.height=i.height||(h.height>>a)-n,P(h),p(i,34069+t,r,n,a),F(),T(i),f},f.resize=function(e){if((e|=0)!==h.width){f.width=h.width=e,f.height=h.height=e,P(h);for(var r=0;6>r;++r)for(var n=0;h.mipmask>>n;++n)t.texImage2D(34069+r,n,h.format,e>>n,e>>n,0,h.format,h.type,null);return F(),o.profile&&(h.stats.size=A(h.internalformat,h.type,f.width,f.height,!1,!0)),f}},f._reglType="textureCube",f._texture=h,o.profile&&(f.stats=h.stats),f.destroy=function(){h.decRef()},f},clear:function(){for(var e=0;er;++r)if(0!=(e.mipmask&1<>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;6>n;++n)t.texImage2D(34069+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);R(e.texInfo,e.target)}))}}}function k(t,e,r,n,a,i){function o(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=t=0;e?(t=e.width,n=e.height):r&&(t=r.width,n=r.height),this.width=t,this.height=n}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){t&&(t.texture?t.texture._texture.refCount+=1:t.renderbuffer._renderbuffer.refCount+=1)}function u(e,r){r&&(r.texture?t.framebufferTexture2D(36160,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,r.renderbuffer._renderbuffer.renderbuffer))}function c(t){var e=3553,r=null,n=null,a=t;return"object"==typeof t&&(a=t.data,"target"in t&&(e=0|t.target)),"texture2d"===(t=a._reglType)||"textureCube"===t?r=a:"renderbuffer"===t&&(n=a,e=36161),new o(e,r,n)}function f(t,e,r,i,s){return r?((t=n.create2D({width:t,height:e,format:i,type:s}))._texture.refCount=0,new o(3553,t,null)):((t=a.create({width:t,height:e,format:i}))._renderbuffer.refCount=0,new o(36161,null,t))}function h(t){return t&&(t.texture||t.renderbuffer)}function d(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r),t.width=e,t.height=r)}function p(){this.id=A++,T[this.id]=this,this.framebuffer=t.createFramebuffer(),this.height=this.width=0,this.colorAttachments=[],this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function g(t){t.colorAttachments.forEach(s),s(t.depthAttachment),s(t.stencilAttachment),s(t.depthStencilAttachment)}function v(e){t.deleteFramebuffer(e.framebuffer),e.framebuffer=null,i.framebufferCount--,delete T[e.id]}function m(e){var n;t.bindFramebuffer(36160,e.framebuffer);var a=e.colorAttachments;for(n=0;na;++a){for(u=0;ut;++t)r[t].resize(n);return e.width=e.height=n,e},_reglType:"framebufferCube",destroy:function(){r.forEach((function(t){t.destroy()}))}})},clear:function(){Z(T).forEach(v)},restore:function(){b.cur=null,b.next=null,b.dirty=!0,Z(T).forEach((function(e){e.framebuffer=t.createFramebuffer(),m(e)}))}})}function M(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function E(t,e,r,n,a){function i(){this.id=++u,this.attributes=[];var t=e.oes_vertex_array_object;this.vao=t?t.createVertexArrayOES():null,c[this.id]=this,this.buffers=[]}var o=r.maxAttributes,s=Array(o);for(r=0;rt&&(t=e.stats.uniformsCount)})),t},r.getMaxAttributesCount=function(){var t=0;return h.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);Z(u).forEach(e),u={},Z(c).forEach(e),c={},h.forEach((function(e){t.deleteProgram(e.program)})),h.length=0,f={},r.shaderCount=0},program:function(t,e,n,a){var i=f[e];i||(i=f[e]={});var o=i[t];return o&&!a?o:(e=new s(e,t),r.shaderCount++,l(e,n,a),o||(i[t]=e),h.push(e),e)},restore:function(){u={},c={};for(var t=0;t"+e+"?"+a+".constant["+e+"]:0;"})).join(""),"}}else{","if(",s,"(",a,".buffer)){",c,"=",i,".createStream(",34962,",",a,".buffer);","}else{",c,"=",i,".getBuffer(",a,".buffer);","}",f,'="type" in ',a,"?",o.glTypes,"[",a,".type]:",c,".dtype;",l.normalized,"=!!",a,".normalized;"),n("size"),n("offset"),n("stride"),n("divisor"),r("}}"),r.exit("if(",l.isStream,"){",i,".destroyStream(",c,");","}"),l}))})),o}function k(t,e,n,a,o){function s(t){var e=u[t];e&&(h[t]=e)}var l=function(t,e){if("string"==typeof(r=t.static).frag&&"string"==typeof r.vert){if(0>1)",s],");")}function e(){r(l,".drawArraysInstancedANGLE(",[p,g,v,s],");")}d?y?t():(r("if(",d,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(c+".drawElements("+[p,v,m,g+"<<(("+m+"-5121)>>1)"]+");")}function e(){r(c+".drawArrays("+[p,g,v]+");")}d?y?t():(r("if(",d,"){"),t(),r("}else{"),e(),r("}")):e()}var s,l,u=t.shared,c=u.gl,f=u.draw,h=n.draw,d=function(){var a=h.elements,i=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(i=r),a=a.append(t,i)):a=i.def(f,".","elements"),a&&i("if("+a+")"+c+".bindBuffer(34963,"+a+".buffer.buffer);"),a}(),p=a("primitive"),g=a("offset"),v=function(){var a=h.count,i=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(i=r),a=a.append(t,i)):a=i.def(f,".","count"),a}();if("number"==typeof v){if(0===v)return}else r("if(",v,"){"),r.exit("}");Q&&(s=a("instances"),l=t.instancing);var m=d+".type",y=h.elements&&F(h.elements);Q&&("number"!=typeof s||0<=s)?"string"==typeof s?(r("if(",s,">0){"),i(),r("}else if(",s,"<0){"),o(),r("}")):i():o()}function V(t,e,r,n,a){return a=(e=x()).proc("body",a),Q&&(e.instancing=a.def(e.shared.extensions,".angle_instanced_arrays")),t(e,a,r,n),e.compile().body}function G(t,e,r,n){L(t,e),r.useVAO?r.drawVAO?e(t.shared.vao,".setVAO(",r.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),B(t,e,r,n.attributes,(function(){return!0}))),j(t,e,r,n.uniforms,(function(){return!0})),U(t,e,e,r)}function q(t,e,r,n){function a(){return!0}t.batchId="a1",L(t,e),B(t,e,r,n.attributes,a),j(t,e,r,n.uniforms,a),U(t,e,e,r)}function W(t,e,r,n){function a(t){return t.contextDep&&o||t.propDep}function i(t){return!a(t)}L(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&M(t,c,r.context),r.needsFramebuffer&&E(t,c,r.framebuffer),C(t,c,r.state,a),r.profile&&a(r.profile)&&O(t,c,r,!1,!0),n?(r.useVAO?r.drawVAO?a(r.drawVAO)?c(t.shared.vao,".setVAO(",r.drawVAO.append(t,c),");"):u(t.shared.vao,".setVAO(",r.drawVAO.append(t,u),");"):u(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(u(t.shared.vao,".setVAO(null);"),B(t,u,r,n.attributes,i),B(t,c,r,n.attributes,a)),j(t,u,r,n.uniforms,i),j(t,c,r,n.uniforms,a),U(t,u,c,r)):(e=t.global.def("{}"),n=r.shader.progVar.append(t,c),l=c.def(n,".id"),u=c.def(e,"[",l,"]"),c(t.shared.gl,".useProgram(",n,".program);","if(!",u,"){",u,"=",e,"[",l,"]=",t.link((function(e){return V(q,t,r,e,2)})),"(",n,");}",u,".call(this,a0[",s,"],",s,");"))}function X(t,r){function n(e){var n=r.shader[e];n&&a.set(i.shader,"."+e,n.append(t,a))}var a=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;M(t,a,r.context),r.framebuffer&&r.framebuffer.append(t,a),I(Object.keys(r.state)).forEach((function(e){var n=r.state[e].append(t,a);v(n)?n.forEach((function(r,n){a.set(t.next[e],"["+n+"]",r)})):a.set(i.next,"."+e,n)})),O(t,a,r,!0,!0),["elements","offset","count","instances","primitive"].forEach((function(e){var n=r.draw[e];n&&a.set(i.draw,"."+e,""+n.append(t,a))})),Object.keys(r.uniforms).forEach((function(n){a.set(i.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,a))})),Object.keys(r.attributes).forEach((function(e){var n=r.attributes[e].append(t,a),i=t.scopeAttrib(e);Object.keys(new Z).forEach((function(t){a.set(i,"."+t,n[t])}))})),r.scopeVAO&&a.set(i.vao,".targetVAO",r.scopeVAO.append(t,a)),n("vert"),n("frag"),0=--this.refCount&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(c).forEach((function(e){t+=c[e].stats.size})),t}),{create:function(e,r){function o(e,r){var n=0,i=0,c=32854;if("object"==typeof e&&e?("shape"in e?(n=0|(i=e.shape)[0],i=0|i[1]):("radius"in e&&(n=i=0|e.radius),"width"in e&&(n=0|e.width),"height"in e&&(i=0|e.height)),"format"in e&&(c=s[e.format])):"number"==typeof e?(n=0|e,i="number"==typeof r?0|r:n):e||(n=i=1),n!==u.width||i!==u.height||c!==u.format)return o.width=u.width=n,o.height=u.height=i,u.format=c,t.bindRenderbuffer(36161,u.renderbuffer),t.renderbufferStorage(36161,c,n,i),a.profile&&(u.stats.size=yt[u.format]*u.width*u.height),o.format=l[u.format],o}var u=new i(t.createRenderbuffer());return c[u.id]=u,n.renderbufferCount++,o(e,r),o.resize=function(e,r){var n=0|e,i=0|r||n;return n===u.width&&i===u.height||(o.width=u.width=n,o.height=u.height=i,t.bindRenderbuffer(36161,u.renderbuffer),t.renderbufferStorage(36161,u.format,n,i),a.profile&&(u.stats.size=yt[u.format]*u.width*u.height)),o},o._reglType="renderbuffer",o._renderbuffer=u,a.profile&&(o.stats=u.stats),o.destroy=function(){u.decRef()},o},clear:function(){Z(c).forEach(o)},restore:function(){Z(c).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)})),t.bindRenderbuffer(36161,null)}}},xt=[];xt[6408]=4,xt[6407]=3;var _t=[];_t[5121]=1,_t[5126]=4,_t[36193]=2;var wt=["x","y","z","w"],At="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),Tt={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},kt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Mt={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Et={cw:2304,ccw:2305},St=new P(!1,!1,!1,(function(){}));return function(t){function e(){if(0===J.length)w&&w.update(),tt=null;else{tt=G.next(e),f();for(var t=J.length-1;0<=t;--t){var r=J[t];r&&r(O,null,0)}v.flush(),w&&w.update()}}function r(){!tt&&0=J.length&&n()}}}}function c(){var t=Y.viewport,e=Y.scissor_box;t[0]=t[1]=e[0]=e[1]=0,O.viewportWidth=O.framebufferWidth=O.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,O.viewportHeight=O.framebufferHeight=O.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function f(){O.tick+=1,O.time=g(),c(),W.procs.poll()}function h(){c(),W.procs.refresh(),w&&w.update()}function g(){return(q()-A)/1e3}if(!(t=a(t)))return null;var v=t.gl,m=v.getContextAttributes();v.isContextLost();var y=function(t,e){function r(e){var r;e=e.toLowerCase();try{r=n[e]=t.getExtension(e)}catch(t){}return!!r}for(var n={},a=0;ae;++e)et(U({framebuffer:t.framebuffer.faces[e]},t),l);else et(t,l);else l(0,t)},prop:H.define.bind(null,1),context:H.define.bind(null,2),this:H.define.bind(null,3),draw:s({}),buffer:function(t){return R.create(t,34962,!1,!1)},elements:function(t){return P.create(t,!1)},texture:z.create2D,cube:z.createCube,renderbuffer:N.create,framebuffer:V.create,framebufferCube:V.createCube,vao:I.createVAO,attributes:m,frame:u,on:function(t,e){var r;switch(t){case"frame":return u(e);case"lost":r=Q;break;case"restore":r=$;break;case"destroy":r=K}return r.push(e),{cancel:function(){for(var t=0;t=-t},pointBetween:function(e,r,n){var a=e[1]-r[1],i=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*i+a*s;return!(l-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-a>t&&(i-u)*(a-c)/(o-c)+u-n>t&&(s=!s),i=u,o=c}return s}};return e}},{}],279:[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]),a=1;a0}))}function c(t,n){var a=t.seg,i=n.seg,o=a.start,s=a.end,u=i.start,c=i.end;r&&r.checkIntersection(a,i);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 d=e.pointsSame(o,u),h=e.pointsSame(s,c);if(d&&h)return n;var p=!d&&e.pointBetween(o,u,c),g=!h&&e.pointBetween(s,u,c);if(d)return g?l(n,s):l(t,c),n;p&&(h||(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=[];!i.isEmpty();){var d=i.getHead();if(r&&r.vert(d.pt[0]),d.isStart){r&&r.segmentNew(d.seg,d.primary);var h=u(d),p=h.before?h.before.ev:null,g=h.after?h.after.ev:null;function v(){if(p){var t=c(d,p);if(t)return t}return!!g&&c(d,g)}r&&r.tempStatus(d.seg,!!p&&p.seg,!!g&&g.seg);var m,y=v();if(y){var b;if(t)(b=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=d.seg.myFill;r&&r.segmentUpdate(y.seg),d.other.remove(),d.remove()}if(i.getHead()!==d){r&&r.rewind(d.seg);continue}if(t)b=null===d.seg.myFill.below||d.seg.myFill.above!==d.seg.myFill.below,d.seg.myFill.below=g?g.seg.myFill.above:a,d.seg.myFill.above=b?!d.seg.myFill.below:d.seg.myFill.below;else if(null===d.seg.otherFill)m=g?d.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:d.primary?o:a,d.seg.otherFill={above:m,below:m};r&&r.status(d.seg,!!p&&p.seg,!!g&&g.seg),d.other.status=h.insert(n.node({ev:d}))}else{var x=d.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(),!d.primary){var _=d.seg.myFill;d.seg.myFill=d.seg.otherFill,d.seg.otherFill=_}f.push(d.seg)}i.getHead().remove()}return r&&r.done(),f}return t?{addRegion:function(t){for(var n,a,i,o=t[t.length-1],l=0;l1)for(var r=1;r1&&(t.scaleRatio=[t.scale[0]*t.viewport.width,t.scale[1]*t.viewport.height],r(t),t.after&&t.after(t))}function A(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0,r=0;if(x.groups=b=t.map((function(t,u){var c=b[u];return t?("function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),t=o(t,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),c||(b[u]=c={id:u,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},t=s({},y,t)),i(c,t,[{lineWidth:function(t){return.5*+t},capSize:function(t){return.5*+t},opacity:parseFloat,errors:function(t){return t=l(t),r+=t.length,t},positions:function(t,r){return t=l(t,"float64"),r.count=Math.floor(t.length/2),r.bounds=n(t,2),r.offset=e,e+=r.count,t}},{color:function(t,e){var r=e.count;if(t||(t="transparent"),!Array.isArray(t)||"number"==typeof t[0]){var n=t;t=Array(r);for(var i=0;i 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * adjustedScale + translate;\n\tvec2 aBotPosition = (aBotCoord) * adjustedScale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * adjustedScale + translate;\n\tvec2 bBotPosition = (bBotCoord) * adjustedScale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform float dashSize, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:r,divisor:0,stride:8,offset:0},lineTop:{buffer:r,divisor:0,stride:8,offset:4},aColor:{buffer:t.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:t.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},n))}catch(t){e=a}return{fill:t({primitive:"triangle",elements:function(t,e){return e.triangles},offset:0,vert:o(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n\tfragColor.a *= opacity;\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n}\n"]),uniforms:{scale:t.prop("scale"),color:t.prop("fill"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{position:{buffer:t.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:t.prop("positionFractBuffer"),stride:8,offset:8}},blend:n.blend,depth:{enable:!1},scissor:n.scissor,stencil:n.stencil,viewport:n.viewport}),rect:a,miter:e}},v.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null},v.prototype.render=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];e.length&&(t=this).update.apply(t,e),this.draw()},v.prototype.draw=function(){for(var t=this,e=[],r=arguments.length;r--;)e[r]=arguments[r];return(e.length?e:this.passes).forEach((function(e,r){var n;if(e&&Array.isArray(e))return(n=t).draw.apply(n,e);"number"==typeof e&&(e=t.passes[e]),e&&e.count>1&&e.opacity&&(t.regl._refresh(),e.fill&&e.triangles&&e.triangles.length>2&&t.shaders.fill(e),e.thickness&&(e.scale[0]*e.viewport.width>v.precisionThreshold||e.scale[1]*e.viewport.height>v.precisionThreshold||"rect"===e.join||!e.join&&(e.thickness<=2||e.count>=v.maxPoints)?t.shaders.rect(e):t.shaders.miter(e)))})),this},v.prototype.update=function(t){var e=this;if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var r=this.regl,o=this.gl;if(t.forEach((function(t,f){var p=e.passes[f];if(void 0!==t)if(null!==t){if("number"==typeof t[0]&&(t={positions:t}),t=s(t,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color colour stroke colors colours stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow"}),p||(e.passes[f]=p={id:f,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,hole:[],depth:0,dashLength:1,dashTexture:r.texture({channels:1,data:new Uint8Array([255]),width:1,height:1,mag:"linear",min:"linear"}),colorBuffer:r.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array}),positionBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array}),positionFractBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array})},t=i({},v.defaults,t)),null!=t.thickness&&(p.thickness=parseFloat(t.thickness)),null!=t.opacity&&(p.opacity=parseFloat(t.opacity)),null!=t.miterLimit&&(p.miterLimit=parseFloat(t.miterLimit)),null!=t.overlay&&(p.overlay=!!t.overlay,ft.length)&&(e=t.length);for(var r=0,n=new Array(e);r 1.0 + delta) {\n\t\tdiscard;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]),l.vert=d(["precision highp float;\n#define GLSLIFY 1\n\nattribute float x, y, xFract, yFract;\nattribute float size, borderSize;\nattribute vec4 colorId, borderColorId;\nattribute float isActive;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform bool constPointSize;\nuniform sampler2D palette;\nuniform vec2 paletteSize;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nfloat pointSizeScale = (constPointSize) ? 2. : pixelRatio;\n\nbool isDirect = (paletteSize.x < 1.);\n\nvec4 getColor(vec4 id) {\n return isDirect ? id / 255. : texture2D(palette,\n vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n )\n );\n}\n\nvoid main() {\n // ignore inactive points\n if (isActive == 0.) return;\n\n vec2 position = vec2(x, y);\n vec2 positionFract = vec2(xFract, yFract);\n\n vec4 color = getColor(colorId);\n vec4 borderColor = getColor(borderColorId);\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pointSizeScale;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0., 1.);\n\n fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]),v&&(l.frag=l.frag.replace("smoothstep","smoothStep"),s.frag=s.frag.replace("smoothstep","smoothStep")),this.drawCircle=t(l)}x.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4},x.prototype.render=function(){return arguments.length&&this.update.apply(this,arguments),this.draw(),this},x.prototype.draw=function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;nn)?e.tree=c(t,{bounds:f}):n&&n.length&&(e.tree=n),e.tree){var d={primitive:"points",usage:"static",data:e.tree,type:"uint32"};e.elements?e.elements(d):e.elements=o.elements(d)}return a({data:m.float(t),usage:"dynamic"}),i({data:m.fract(t),usage:"dynamic"}),s({data:new Uint8Array(u),type:"uint8",usage:"stream"}),t}},{marker:function(e,r,n){var a=r.activation;if(a.forEach((function(t){return t&&t.destroy&&t.destroy()})),a.length=0,e&&"number"!=typeof e[0]){for(var i=[],s=0,l=Math.min(e.length,r.count);s=0)return i;if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)e=t;else{e=new Uint8Array(t.length);for(var o=0,s=t.length;o4*n&&(this.tooManyColors=!0),this.updatePalette(r),1===a.length?a[0]:a},x.prototype.updatePalette=function(t){if(!this.tooManyColors){var e=this.maxColors,r=this.paletteTexture,n=Math.ceil(.25*t.length/e);if(n>1)for(var a=.25*(t=t.slice()).length%e;a2?(s[0],s[2],n=s[1],a=s[3]):s.length?(n=s[0],a=s[1]):(s.x,n=s.y,s.x+s.width,a=s.y+s.height),l.length>2?(i=l[0],o=l[2],l[1],l[3]):l.length?(i=l[0],o=l[1]):(i=l.x,l.y,o=l.x+l.width,l.y+l.height),[i,n,o,a]}function h(t){if("number"==typeof t)return[t,t,t,t];if(2===t.length)return[t[0],t[1],t[0],t[1]];var e=l(t);return[e.x,e.y,e.x+e.width,e.y+e.height]}e.exports=c,c.prototype.render=function(){for(var t,e=this,r=[],n=arguments.length;n--;)r[n]=arguments[n];return r.length&&(t=this).update.apply(t,r),this.regl.attributes.preserveDrawingBuffer?this.draw():(this.dirty?null==this.planned&&(this.planned=o((function(){e.draw(),e.dirty=!0,e.planned=null}))):(this.draw(),this.dirty=!0,o((function(){e.dirty=!1}))),this)},c.prototype.update=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];if(e.length){for(var n=0;nT))&&(s.lower||!(A>>=e))<<3,(e|=r=(15<(t>>>=r))<<2)|(r=(3<(t>>>=r))<<1)|t>>>r>>1}function s(){function t(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}return 0<(e=r[o(t)>>2]).length?e.pop():new ArrayBuffer(t)}function e(t){r[o(t.byteLength)>>2].push(t)}var r=i(8,(function(){return[]}));return{alloc:t,free:e,allocType:function(e,r){var n=null;switch(e){case 5120:n=new Int8Array(t(r),0,r);break;case 5121:n=new Uint8Array(t(r),0,r);break;case 5122:n=new Int16Array(t(2*r),0,r);break;case 5123:n=new Uint16Array(t(2*r),0,r);break;case 5124:n=new Int32Array(t(4*r),0,r);break;case 5125:n=new Uint32Array(t(4*r),0,r);break;case 5126:n=new Float32Array(t(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(t){e(t.buffer)}}}function l(t){return!!t&&"object"==typeof t&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&"number"==typeof t.offset&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||Y(t.data))}function u(t,e,r,n,a,i){for(var o=0;o(a=s)&&(a=n.buffer.byteLength,5123===f?a>>=1:5125===f&&(a>>=2)),n.vertCount=a,a=o,0>o&&(a=4,1===(o=n.buffer.dimension)&&(a=0),2===o&&(a=1),3===o&&(a=4)),n.primType=a}function o(t){n.elementsCount--,delete s[t.id],t.buffer.destroy(),t.buffer=null}var s={},u=0,c={uint8:5121,uint16:5123};e.oes_element_index_uint&&(c.uint32=5125),a.prototype.bind=function(){this.buffer.bind()};var f=[];return{create:function(t,e){function s(t){if(t)if("number"==typeof t)u(t),f.primType=4,f.vertCount=0|t,f.type=5121;else{var e=null,r=35044,n=-1,a=-1,o=0,d=0;Array.isArray(t)||Y(t)||l(t)?e=t:("data"in t&&(e=t.data),"usage"in t&&(r=K[t.usage]),"primitive"in t&&(n=nt[t.primitive]),"count"in t&&(a=0|t.count),"type"in t&&(d=c[t.type]),"length"in t?o=0|t.length:(o=a,5123===d||5122===d?o*=2:5125!==d&&5124!==d||(o*=4))),i(f,e,r,n,a,o,d)}else u(),f.primType=4,f.vertCount=0,f.type=5121;return s}var u=r.create(null,34963,!0),f=new a(u._buffer);return n.elementsCount++,s(t),s._reglType="elements",s._elements=f,s.subdata=function(t,e){return u.subdata(t,e),s},s.destroy=function(){o(f)},s},createStream:function(t){var e=f.pop();return e||(e=new a(r.create(null,34963,!0,!1)._buffer)),i(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){f.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof a?t._elements:null},clear:function(){Z(s).forEach(o)}}}function g(t){for(var e=X.allocType(5123,t.length),r=0;r>>31<<15,a=(i<<1>>>24)-127,i=i>>13&1023;e[r]=-24>a?n:-14>a?n+(i+1024>>-14-a):15>=a,r.height>>=a,h(r,n[a]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function L(t){for(var e=t.images,r=0;re){for(var r=0;r=--this.refCount&&z(this)}}),o.profile&&(i.getTotalTextureSize=function(){var t=0;return Object.keys(yt).forEach((function(e){t+=yt[e].stats.size})),t}),{create2D:function(e,r){function n(t,e){var r=a.texInfo;O.call(r);var i=C();return"number"==typeof t?M(i,0|t,"number"==typeof e?0|e:0|t):t?(D(r,t),E(i,t)):M(i,1,1),r.genMipmaps&&(i.mipmask=(i.width<<1)-1),a.mipmask=i.mipmask,u(a,i),a.internalformat=i.internalformat,n.width=i.width,n.height=i.height,P(a),S(i,3553),R(r,3553),F(),L(i),o.profile&&(a.stats.size=A(a.internalformat,a.type,i.width,i.height,r.genMipmaps,!1)),n.format=tt[a.internalformat],n.type=et[a.type],n.mag=rt[r.magFilter],n.min=nt[r.minFilter],n.wrapS=at[r.wrapS],n.wrapT=at[r.wrapT],n}var a=new I(3553);return yt[a.id]=a,i.textureCount++,n(e,r),n.subimage=function(t,e,r,i){e|=0,r|=0,i|=0;var o=m();return u(o,a),o.width=0,o.height=0,h(o,t),o.width=o.width||(a.width>>i)-e,o.height=o.height||(a.height>>i)-r,P(a),p(o,3553,e,r,i),F(),T(o),n},n.resize=function(e,r){var i=0|e,s=0|r||i;if(i===a.width&&s===a.height)return n;n.width=a.width=i,n.height=a.height=s,P(a);for(var l=0;a.mipmask>>l;++l){var u=i>>l,c=s>>l;if(!u||!c)break;t.texImage2D(3553,l,a.format,u,c,0,a.format,a.type,null)}return F(),o.profile&&(a.stats.size=A(a.internalformat,a.type,i,s,!1,!1)),n},n._reglType="texture2d",n._texture=a,o.profile&&(n.stats=a.stats),n.destroy=function(){a.decRef()},n},createCube:function(e,r,n,a,s,l){function f(t,e,r,n,a,i){var s,l=d.texInfo;for(O.call(l),s=0;6>s;++s)g[s]=C();if("number"!=typeof t&&t){if("object"==typeof t)if(e)E(g[0],t),E(g[1],e),E(g[2],r),E(g[3],n),E(g[4],a),E(g[5],i);else if(D(l,t),c(d,t),"faces"in t)for(t=t.faces,s=0;6>s;++s)u(g[s],d),E(g[s],t[s]);else for(s=0;6>s;++s)E(g[s],t)}else for(t=0|t||1,s=0;6>s;++s)M(g[s],t,t);for(u(d,g[0]),d.mipmask=l.genMipmaps?(g[0].width<<1)-1:g[0].mipmask,d.internalformat=g[0].internalformat,f.width=g[0].width,f.height=g[0].height,P(d),s=0;6>s;++s)S(g[s],34069+s);for(R(l,34067),F(),o.profile&&(d.stats.size=A(d.internalformat,d.type,f.width,f.height,l.genMipmaps,!0)),f.format=tt[d.internalformat],f.type=et[d.type],f.mag=rt[l.magFilter],f.min=nt[l.minFilter],f.wrapS=at[l.wrapS],f.wrapT=at[l.wrapT],s=0;6>s;++s)L(g[s]);return f}var d=new I(34067);yt[d.id]=d,i.cubeCount++;var g=Array(6);return f(e,r,n,a,s,l),f.subimage=function(t,e,r,n,a){r|=0,n|=0,a|=0;var i=m();return u(i,d),i.width=0,i.height=0,h(i,e),i.width=i.width||(d.width>>a)-r,i.height=i.height||(d.height>>a)-n,P(d),p(i,34069+t,r,n,a),F(),T(i),f},f.resize=function(e){if((e|=0)!==d.width){f.width=d.width=e,f.height=d.height=e,P(d);for(var r=0;6>r;++r)for(var n=0;d.mipmask>>n;++n)t.texImage2D(34069+r,n,d.format,e>>n,e>>n,0,d.format,d.type,null);return F(),o.profile&&(d.stats.size=A(d.internalformat,d.type,f.width,f.height,!1,!0)),f}},f._reglType="textureCube",f._texture=d,o.profile&&(f.stats=d.stats),f.destroy=function(){d.decRef()},f},clear:function(){for(var e=0;er;++r)if(0!=(e.mipmask&1<>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;6>n;++n)t.texImage2D(34069+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);R(e.texInfo,e.target)}))}}}function k(t,e,r,n,a,i){function o(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=t=0;e?(t=e.width,n=e.height):r&&(t=r.width,n=r.height),this.width=t,this.height=n}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){t&&(t.texture?t.texture._texture.refCount+=1:t.renderbuffer._renderbuffer.refCount+=1)}function u(e,r){r&&(r.texture?t.framebufferTexture2D(36160,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,r.renderbuffer._renderbuffer.renderbuffer))}function c(t){var e=3553,r=null,n=null,a=t;return"object"==typeof t&&(a=t.data,"target"in t&&(e=0|t.target)),"texture2d"===(t=a._reglType)||"textureCube"===t?r=a:"renderbuffer"===t&&(n=a,e=36161),new o(e,r,n)}function f(t,e,r,i,s){return r?((t=n.create2D({width:t,height:e,format:i,type:s}))._texture.refCount=0,new o(3553,t,null)):((t=a.create({width:t,height:e,format:i}))._renderbuffer.refCount=0,new o(36161,null,t))}function d(t){return t&&(t.texture||t.renderbuffer)}function h(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r),t.width=e,t.height=r)}function p(){this.id=A++,T[this.id]=this,this.framebuffer=t.createFramebuffer(),this.height=this.width=0,this.colorAttachments=[],this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function g(t){t.colorAttachments.forEach(s),s(t.depthAttachment),s(t.stencilAttachment),s(t.depthStencilAttachment)}function v(e){t.deleteFramebuffer(e.framebuffer),e.framebuffer=null,i.framebufferCount--,delete T[e.id]}function m(e){var n;t.bindFramebuffer(36160,e.framebuffer);var a=e.colorAttachments;for(n=0;na;++a){for(u=0;ut;++t)r[t].resize(n);return e.width=e.height=n,e},_reglType:"framebufferCube",destroy:function(){r.forEach((function(t){t.destroy()}))}})},clear:function(){Z(T).forEach(v)},restore:function(){b.cur=null,b.next=null,b.dirty=!0,Z(T).forEach((function(e){e.framebuffer=t.createFramebuffer(),m(e)}))}})}function M(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function E(t,e,r,n,a){function i(){this.id=++u,this.attributes=[];var t=e.oes_vertex_array_object;this.vao=t?t.createVertexArrayOES():null,c[this.id]=this,this.buffers=[]}var o=r.maxAttributes,s=Array(o);for(r=0;rt&&(t=e.stats.uniformsCount)})),t},r.getMaxAttributesCount=function(){var t=0;return d.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);Z(u).forEach(e),u={},Z(c).forEach(e),c={},d.forEach((function(e){t.deleteProgram(e.program)})),d.length=0,f={},r.shaderCount=0},program:function(t,e,n,a){var i=f[e];i||(i=f[e]={});var o=i[t];return o&&!a?o:(e=new s(e,t),r.shaderCount++,l(e,n,a),o||(i[t]=e),d.push(e),e)},restore:function(){u={},c={};for(var t=0;t"+e+"?"+a+".constant["+e+"]:0;"})).join(""),"}}else{","if(",s,"(",a,".buffer)){",c,"=",i,".createStream(",34962,",",a,".buffer);","}else{",c,"=",i,".getBuffer(",a,".buffer);","}",f,'="type" in ',a,"?",o.glTypes,"[",a,".type]:",c,".dtype;",l.normalized,"=!!",a,".normalized;"),n("size"),n("offset"),n("stride"),n("divisor"),r("}}"),r.exit("if(",l.isStream,"){",i,".destroyStream(",c,");","}"),l}))})),o}function k(t,e,n,a,o){function s(t){var e=u[t];e&&(d[t]=e)}var l=function(t,e){if("string"==typeof(r=t.static).frag&&"string"==typeof r.vert){if(0>1)",s],");")}function e(){r(l,".drawArraysInstancedANGLE(",[p,g,v,s],");")}h?y?t():(r("if(",h,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(c+".drawElements("+[p,v,m,g+"<<(("+m+"-5121)>>1)"]+");")}function e(){r(c+".drawArrays("+[p,g,v]+");")}h?y?t():(r("if(",h,"){"),t(),r("}else{"),e(),r("}")):e()}var s,l,u=t.shared,c=u.gl,f=u.draw,d=n.draw,h=function(){var a=d.elements,i=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(i=r),a=a.append(t,i)):a=i.def(f,".","elements"),a&&i("if("+a+")"+c+".bindBuffer(34963,"+a+".buffer.buffer);"),a}(),p=a("primitive"),g=a("offset"),v=function(){var a=d.count,i=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(i=r),a=a.append(t,i)):a=i.def(f,".","count"),a}();if("number"==typeof v){if(0===v)return}else r("if(",v,"){"),r.exit("}");Q&&(s=a("instances"),l=t.instancing);var m=h+".type",y=d.elements&&F(d.elements);Q&&("number"!=typeof s||0<=s)?"string"==typeof s?(r("if(",s,">0){"),i(),r("}else if(",s,"<0){"),o(),r("}")):i():o()}function V(t,e,r,n,a){return a=(e=x()).proc("body",a),Q&&(e.instancing=a.def(e.shared.extensions,".angle_instanced_arrays")),t(e,a,r,n),e.compile().body}function G(t,e,r,n){L(t,e),r.useVAO?r.drawVAO?e(t.shared.vao,".setVAO(",r.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),B(t,e,r,n.attributes,(function(){return!0}))),j(t,e,r,n.uniforms,(function(){return!0})),U(t,e,e,r)}function q(t,e,r,n){function a(){return!0}t.batchId="a1",L(t,e),B(t,e,r,n.attributes,a),j(t,e,r,n.uniforms,a),U(t,e,e,r)}function X(t,e,r,n){function a(t){return t.contextDep&&o||t.propDep}function i(t){return!a(t)}L(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&M(t,c,r.context),r.needsFramebuffer&&E(t,c,r.framebuffer),C(t,c,r.state,a),r.profile&&a(r.profile)&&O(t,c,r,!1,!0),n?(r.useVAO?r.drawVAO?a(r.drawVAO)?c(t.shared.vao,".setVAO(",r.drawVAO.append(t,c),");"):u(t.shared.vao,".setVAO(",r.drawVAO.append(t,u),");"):u(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(u(t.shared.vao,".setVAO(null);"),B(t,u,r,n.attributes,i),B(t,c,r,n.attributes,a)),j(t,u,r,n.uniforms,i),j(t,c,r,n.uniforms,a),U(t,u,c,r)):(e=t.global.def("{}"),n=r.shader.progVar.append(t,c),l=c.def(n,".id"),u=c.def(e,"[",l,"]"),c(t.shared.gl,".useProgram(",n,".program);","if(!",u,"){",u,"=",e,"[",l,"]=",t.link((function(e){return V(q,t,r,e,2)})),"(",n,");}",u,".call(this,a0[",s,"],",s,");"))}function W(t,r){function n(e){var n=r.shader[e];n&&a.set(i.shader,"."+e,n.append(t,a))}var a=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;M(t,a,r.context),r.framebuffer&&r.framebuffer.append(t,a),I(Object.keys(r.state)).forEach((function(e){var n=r.state[e].append(t,a);v(n)?n.forEach((function(r,n){a.set(t.next[e],"["+n+"]",r)})):a.set(i.next,"."+e,n)})),O(t,a,r,!0,!0),["elements","offset","count","instances","primitive"].forEach((function(e){var n=r.draw[e];n&&a.set(i.draw,"."+e,""+n.append(t,a))})),Object.keys(r.uniforms).forEach((function(n){a.set(i.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,a))})),Object.keys(r.attributes).forEach((function(e){var n=r.attributes[e].append(t,a),i=t.scopeAttrib(e);Object.keys(new Z).forEach((function(t){a.set(i,"."+t,n[t])}))})),r.scopeVAO&&a.set(i.vao,".targetVAO",r.scopeVAO.append(t,a)),n("vert"),n("frag"),0=--this.refCount&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(c).forEach((function(e){t+=c[e].stats.size})),t}),{create:function(e,r){function o(e,r){var n=0,i=0,c=32854;if("object"==typeof e&&e?("shape"in e?(n=0|(i=e.shape)[0],i=0|i[1]):("radius"in e&&(n=i=0|e.radius),"width"in e&&(n=0|e.width),"height"in e&&(i=0|e.height)),"format"in e&&(c=s[e.format])):"number"==typeof e?(n=0|e,i="number"==typeof r?0|r:n):e||(n=i=1),n!==u.width||i!==u.height||c!==u.format)return o.width=u.width=n,o.height=u.height=i,u.format=c,t.bindRenderbuffer(36161,u.renderbuffer),t.renderbufferStorage(36161,c,n,i),a.profile&&(u.stats.size=yt[u.format]*u.width*u.height),o.format=l[u.format],o}var u=new i(t.createRenderbuffer());return c[u.id]=u,n.renderbufferCount++,o(e,r),o.resize=function(e,r){var n=0|e,i=0|r||n;return n===u.width&&i===u.height||(o.width=u.width=n,o.height=u.height=i,t.bindRenderbuffer(36161,u.renderbuffer),t.renderbufferStorage(36161,u.format,n,i),a.profile&&(u.stats.size=yt[u.format]*u.width*u.height)),o},o._reglType="renderbuffer",o._renderbuffer=u,a.profile&&(o.stats=u.stats),o.destroy=function(){u.decRef()},o},clear:function(){Z(c).forEach(o)},restore:function(){Z(c).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)})),t.bindRenderbuffer(36161,null)}}},xt=[];xt[6408]=4,xt[6407]=3;var _t=[];_t[5121]=1,_t[5126]=4,_t[36193]=2;var wt=["x","y","z","w"],At="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),Tt={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},kt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Mt={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Et={cw:2304,ccw:2305},St=new P(!1,!1,!1,(function(){}));return function(t){function e(){if(0===J.length)w&&w.update(),tt=null;else{tt=G.next(e),f();for(var t=J.length-1;0<=t;--t){var r=J[t];r&&r(O,null,0)}v.flush(),w&&w.update()}}function r(){!tt&&0=J.length&&n()}}}}function c(){var t=Y.viewport,e=Y.scissor_box;t[0]=t[1]=e[0]=e[1]=0,O.viewportWidth=O.framebufferWidth=O.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,O.viewportHeight=O.framebufferHeight=O.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function f(){O.tick+=1,O.time=g(),c(),X.procs.poll()}function d(){c(),X.procs.refresh(),w&&w.update()}function g(){return(q()-A)/1e3}if(!(t=a(t)))return null;var v=t.gl,m=v.getContextAttributes();v.isContextLost();var y=function(t,e){function r(e){var r;e=e.toLowerCase();try{r=n[e]=t.getExtension(e)}catch(t){}return!!r}for(var n={},a=0;ae;++e)et(U({framebuffer:t.framebuffer.faces[e]},t),l);else et(t,l);else l(0,t)},prop:H.define.bind(null,1),context:H.define.bind(null,2),this:H.define.bind(null,3),draw:s({}),buffer:function(t){return R.create(t,34962,!1,!1)},elements:function(t){return P.create(t,!1)},texture:z.create2D,cube:z.createCube,renderbuffer:N.create,framebuffer:V.create,framebufferCube:V.createCube,vao:I.createVAO,attributes:m,frame:u,on:function(t,e){var r;switch(t){case"frame":return u(e);case"lost":r=Q;break;case"restore":r=$;break;case"destroy":r=K}return r.push(e),{cancel:function(){for(var t=0;t * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */ -"use strict";var n,a="";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,a="";else if(a.length>=r)return a.substr(0,r);for(;r>a.length&&e>1;)1&e&&(a+=t),e>>=1,t+=t;return a=(a+=t).substr(0,r)}},{}],262:[function(t,e,r){"use strict";var n=t("two-product"),a=t("robust-sum"),i=t("robust-subtract"),o=t("robust-scale");function s(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function u(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 u(e,t)}function c(t){if(2===t.length)return[["diff(",u(t[0][0],t[1][1]),",",u(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function u(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(i<=0)return o;n=a+i}else{if(!(a<0))return o;if(i>=0)return o;n=-(a+i)}var s=33306690738754716e-32*n;return o>=s||o<=-s?o:f(t,e,r)},function(t,e,r,n){var a=t[0]-n[0],i=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],d=r[2]-n[2],p=i*u,g=o*l,v=o*s,m=a*u,y=a*l,b=i*s,x=c*(p-g)+f*(v-m)+d*(y-b),_=7771561172376103e-31*((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(d));return x>_||-x>_?x:h(t,e,r,n)}];function p(t){var e=d[t.length];return e||(e=d[t.length]=c(t.length)),e.apply(void 0,t)}!function(){for(;d.length<=5;)d.push(c(d.length));for(var t=[],r=["slow"],n=0;n<=5;++n)t.push("a"+n),r.push("o"+n);var a=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=5;++n)a.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");a.push("}var s=new Array(arguments.length);for(var i=0;i0&&o>0||i<0&&o<0)return!1;var s=n(r,t,e),l=n(a,t,e);if(s>0&&l>0||s<0&&l<0)return!1;if(0===i&&0===o&&0===s&&0===l)return function(t,e,r,n){for(var a=0;a<2;++a){var i=t[a],o=e[a],s=Math.min(i,o),l=Math.max(i,o),u=r[a],c=n[a],f=Math.min(u,c);if(Math.max(u,c)=n?(a=f,(l+=1)=n?(a=f,(l+=1)0?1:0}},{}],270:[function(t,e,r){arguments[4][40][0].apply(r,arguments)},{dup:40}],271:[function(t,e,r){"use strict";var n=t("bit-twiddle"),a=t("union-find");function i(t,e){var r=t.length,n=t.length-e.length,a=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return(s=t[0]+t[1]-e[0]-e[1])||a(t[0],t[1])-a(e[0],e[1]);case 3:var i=t[0]+t[1],o=e[0]+e[1];if(s=i+t[2]-(o+e[2]))return s;var s,l=a(t[0],t[1]),u=a(e[0],e[1]);return(s=a(l,t[2])-a(u,e[2]))||a(l+t[2],i)-a(u+e[2],o);default:var c=t.slice(0);c.sort();var f=e.slice(0);f.sort();for(var h=0;h>1,s=i(t[o],e);s<=0?(0===s&&(a=o),r=o+1):s>0&&(n=o-1)}return a}function c(t,e){for(var r=new Array(t.length),a=0,o=r.length;a=t.length||0!==i(t[v],s)););}return r}function f(t,e){if(e<0)return[];for(var r=[],a=(1<>>c&1&&u.push(a[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,a=2*(t+1),i=t;if(n0;){var r=y(t);if(r>=0)if(e0){var t=T[0];return v(0,M-1),M-=1,b(0),t}return-1}function w(t,e){var r=T[t];return u[r]===e?t:(u[r]=-1/0,x(t),_(),u[r]=e,x((M+=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),k[e]>=0&&w(k[e],g(e)),k[r]>=0&&w(k[r],g(r))}}var T=[],k=new Array(i);for(f=0;f>1;f>=0;--f)b(f);for(;;){var E=_();if(E<0||u[E]>r)break;A(E)}var S=[];for(f=0;f=0&&r>=0&&e!==r){var n=k[e],a=k[r];n!==a&&L.push([n,a])}})),a.unique(a.normalize(L)),{positions:S,edges:L}};var n=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":263,"simplicial-complex":271}],274:[function(t,e,r){"use strict";e.exports=function(t,e){var r,i,o,s;if(e[0][0]e[1][0]))return a(e,t);r=e[1],i=e[0]}if(t[0][0]t[1][0]))return-a(t,e);o=t[1],s=t[0]}var l=n(r,i,s),u=n(r,i,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,i),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 i[0]-s[0]};var n=t("robust-orientation");function a(t,e){var r,a,i,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],a=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),a=-1;if(r&&(a=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,a=c.value):(a=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 a;d=f[h]}}if(d.start)if(s){var p=i(s[0],s[1],[t[0],d.y]);s[0][0]>s[1][0]&&(p=-p),p>0&&(a=d.index)}else a=d.index;else d.y!==t[1]&&(a=d.index)}}}return a}},{"./lib/order-segments":274,"binary-search-bounds":275,"functional-red-black-tree":159,"robust-orientation":263}],277:[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(t){return a(o(t),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}function a(r,n){var a,i,o,s,l,u,c,f,h,d=1,p=r.length,g="";for(i=0;i=0),s.type){case"b":a=parseInt(a,10).toString(2);break;case"c":a=String.fromCharCode(parseInt(a,10));break;case"d":case"i":a=parseInt(a,10);break;case"j":a=JSON.stringify(a,null,s.width?parseInt(s.width):0);break;case"e":a=s.precision?parseFloat(a).toExponential(s.precision):parseFloat(a).toExponential();break;case"f":a=s.precision?parseFloat(a).toFixed(s.precision):parseFloat(a);break;case"g":a=s.precision?String(Number(a.toPrecision(s.precision))):parseFloat(a);break;case"o":a=(parseInt(a,10)>>>0).toString(8);break;case"s":a=String(a),a=s.precision?a.substring(0,s.precision):a;break;case"t":a=String(!!a),a=s.precision?a.substring(0,s.precision):a;break;case"T":a=Object.prototype.toString.call(a).slice(8,-1).toLowerCase(),a=s.precision?a.substring(0,s.precision):a;break;case"u":a=parseInt(a,10)>>>0;break;case"v":a=a.valueOf(),a=s.precision?a.substring(0,s.precision):a;break;case"x":a=(parseInt(a,10)>>>0).toString(16);break;case"X":a=(parseInt(a,10)>>>0).toString(16).toUpperCase()}t.json.test(s.type)?g+=a:(!t.number.test(s.type)||f&&!s.sign?h="":(h=f?"+":"-",a=a.toString().replace(t.sign,"")),u=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",c=s.width-(h+a).length,l=s.width&&c>0?u.repeat(c):"",g+=s.align?h+a+l:"0"===u?h+l+a:l+h+a)}return g}var i=Object.create(null);function o(e){if(i[e])return i[e];for(var r,n=e,a=[],o=0;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}"undefined"!=typeof r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],278:[function(t,e,r){"use strict";var n=t("parenthesis");e.exports=function(t,e,r){if(null==t)throw Error("First argument should be a string");if(null==e)throw Error("Separator should be a string or a RegExp");r?("string"==typeof r||Array.isArray(r))&&(r={ignore:r}):r={},null==r.escape&&(r.escape=!0),null==r.ignore?r.ignore=["[]","()","{}","<>",'""',"''","``","\u201c\u201d","\xab\xbb"]:("string"==typeof r.ignore&&(r.ignore=[r.ignore]),r.ignore=r.ignore.map((function(t){return 1===t.length&&(t+=t),t})));var a=n.parse(t,{flat:!0,brackets:r.ignore}),i=a[0].split(e);if(r.escape){for(var o=[],s=0;s c)|0 },"),"generic"===e&&i.push("getters:[0],");for(var s=[],l=[],u=0;u>>7){");for(u=0;u<1<<(1<128&&u%128==0){f.length>0&&h.push("}}");var d="vExtra"+f.length;i.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&&(k="+"+v[x]+"*c");var M=p[x].length/y*.5,E=.5+m[x]/y*.5;T.push("d"+x+"-"+E+"-"+M+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",T.join(),"]);","break;")}i.push("}},"),f.length>0&&h.push("}}");var S=[];for(u=0;u<1<1&&(a=1),a<-1&&(a=-1),(t*n-e*r<0?-1:1)*Math.acos(a)};r.default=function(t){var e=t.px,r=t.py,l=t.cx,u=t.cy,c=t.rx,f=t.ry,h=t.xAxisRotation,d=void 0===h?0:h,p=t.largeArcFlag,g=void 0===p?0:p,v=t.sweepFlag,m=void 0===v?0:v,y=[];if(0===c||0===f)return[];var b=Math.sin(d*a/360),x=Math.cos(d*a/360),_=x*(e-l)/2+b*(r-u)/2,w=-b*(e-l)/2+x*(r-u)/2;if(0===_&&0===w)return[];c=Math.abs(c),f=Math.abs(f);var A=Math.pow(_,2)/Math.pow(c,2)+Math.pow(w,2)/Math.pow(f,2);A>1&&(c*=Math.sqrt(A),f*=Math.sqrt(A));var T=function(t,e,r,n,i,o,l,u,c,f,h,d){var p=Math.pow(i,2),g=Math.pow(o,2),v=Math.pow(h,2),m=Math.pow(d,2),y=p*g-p*m-g*v;y<0&&(y=0),y/=p*m+g*v;var b=(y=Math.sqrt(y)*(l===u?-1:1))*i/o*d,x=y*-o/i*h,_=f*b-c*x+(t+r)/2,w=c*b+f*x+(e+n)/2,A=(h-b)/i,T=(d-x)/o,k=(-h-b)/i,M=(-d-x)/o,E=s(1,0,A,T),S=s(A,T,k,M);return 0===u&&S>0&&(S-=a),1===u&&S<0&&(S+=a),[_,w,E,S]}(e,r,l,u,c,f,g,m,b,x,_,w),k=n(T,4),M=k[0],E=k[1],S=k[2],C=k[3],L=Math.abs(C)/(a/4);Math.abs(1-L)<1e-7&&(L=1);var O=Math.max(Math.ceil(L),1);C/=O;for(var D=0;De[2]&&(e[2]=u[c+0]),u[c+1]>e[3]&&(e[3]=u[c+1]);return e}},{"abs-svg-path":12,assert:17,"is-svg-path":216,"normalize-svg-path":282,"parse-svg-path":231}],282:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=[],o=0,s=0,l=0,u=0,c=null,f=null,h=0,d=0,p=0,g=t.length;p4?(o=v[v.length-4],s=v[v.length-3]):(o=h,s=d),r.push(v)}return r};var n=t("svg-arc-to-cubic-bezier");function a(t,e,r,n){return["C",t,e,r,n,r,n]}function i(t,e,r,n,a,i){return["C",t/3+2/3*r,e/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}},{"svg-arc-to-cubic-bezier":280}],283:[function(t,e,r){"use strict";var n,a=t("svg-path-bounds"),i=t("parse-svg-path"),o=t("draw-svg-path"),s=t("is-svg-path"),l=t("bitmap-sdf"),u=document.createElement("canvas"),c=u.getContext("2d");e.exports=function(t,e){if(!s(t))throw Error("Argument should be valid svg path string");e||(e={});var r,f;e.shape?(r=e.shape[0],f=e.shape[1]):(r=u.width=e.w||e.width||200,f=u.height=e.h||e.height||200);var h=Math.min(r,f),d=e.stroke||0,p=e.viewbox||e.viewBox||a(t),g=[r/(p[2]-p[0]),f/(p[3]-p[1])],v=Math.min(g[0]||0,g[1]||0)/2;c.fillStyle="black",c.fillRect(0,0,r,f),c.fillStyle="white",d&&("number"!=typeof d&&(d=1),c.strokeStyle=d>0?"white":"black",c.lineWidth=Math.abs(d));if(c.translate(.5*r,.5*f),c.scale(v,v),function(){if(null!=n)return n;var t=document.createElement("canvas").getContext("2d");if(t.canvas.width=t.canvas.height=1,!window.Path2D)return n=!1;var e=new Path2D("M0,0h1v1h-1v-1Z");t.fillStyle="black",t.fill(e);var r=t.getImageData(0,0,1,1);return n=r&&r.data&&255===r.data[3]}()){var m=new Path2D(t);c.fill(m),d&&c.stroke(m)}else{var y=i(t);o(c,y),c.fill(),d&&c.stroke()}return c.setTransform(1,0,0,1,0,0),l(c,{cutoff:null!=e.cutoff?e.cutoff:.5,radius:null!=e.radius?e.radius:.5*h})}},{"bitmap-sdf":41,"draw-svg-path":90,"is-svg-path":216,"parse-svg-path":231,"svg-path-bounds":281}],284:[function(t,e,r){(function(r){"use strict";e.exports=function t(e,r,a){a=a||{};var o=i[e];o||(o=i[e]={" ":{data:new Float32Array(0),shape:.2}});var s=o[r];if(!s)if(r.length<=1||!/\d/.test(r))s=o[r]=function(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),a=0,i=0,o=0;o0&&(f+=.02);var d=new Float32Array(c),p=0,g=-.5*f;for(h=0;h1&&(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=L(t,360),e=L(e,100),r=L(r,100),0===e)n=a=i=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=o(l,s,t+1/3),a=o(l,s,t),i=o(l,s,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(e.h,l,c),f=!0,h="hsl"),e.hasOwnProperty("a")&&(i=e.a));var d,p,g;return i=C(i),{ok:f,format:e.format||h,r:o(255,s(a.r,0)),g:o(255,s(a.g,0)),b:o(255,s(a.b,0)),a:i}}(e);this._originalInput=e,this._r=c.r,this._g=c.g,this._b=c.b,this._a=c.a,this._roundA=i(100*this._a)/100,this._format=l.format||c.format,this._gradientType=l.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=c.ok,this._tc_id=a++}function c(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,a,i=s(t,e,r),l=o(t,e,r),u=(i+l)/2;if(i==l)n=a=0;else{var c=i-l;switch(a=u>.5?c/(2-i-l):c/(i+l),i){case t:n=(e-r)/c+(e>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(u(n));return i}function M(t,e){e=e||6;for(var r=u(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],s=1/e;e--;)o.push(u({h:n,s:a,v:i})),i=(i+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,a=this.toRgb();return e=a.r/255,r=a.g/255,n=a.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=C(t),this._roundA=i(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=i(360*t.h),r=i(100*t.s),n=i(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=i(360*t.h),r=i(100*t.s),n=i(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,a){var o=[R(i(t).toString(16)),R(i(e).toString(16)),R(i(r).toString(16)),R(P(n))];if(a&&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:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*L(this._r,255))+"%",g:i(100*L(this._g,255))+"%",b:i(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*L(this._r,255))+"%, "+i(100*L(this._g,255))+"%, "+i(100*L(this._b,255))+"%)":"rgba("+i(100*L(this._r,255))+"%, "+i(100*L(this._g,255))+"%, "+i(100*L(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 a=u(t);r="#"+d(a._r,a._g,a._b,a._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(k,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(T,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]: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(),a=u(e).toRgb(),i=r/100;return u({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},u.readability=function(e,r){var n=u(e),a=u(r);return(t.max(n.getLuminance(),a.getLuminance())+.05)/(t.min(n.getLuminance(),a.getLuminance())+.05)},u.isReadable=function(t,e,r){var n,a,i=u.readability(t,e);switch(a=!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":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},u.mostReadable=function(t,e,r){var n,a,i,o,s=null,l=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var c=0;cl&&(l=n,s=u(e[c]));return u.isReadable(t,s,{level:i,size:o})||!a?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 C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(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 D(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 P(e){return t.round(255*parseFloat(e)).toString(16)}function F(t){return D(t)/255}var z,N,B,j=(N="[\\s|\\(]+("+(z="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",B="[\\s|\\(]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",{CSS_UNIT:new RegExp(z),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+B),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!!j.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=u:window.tinycolor=u}(Math)},{}],286:[function(t,e,r){"use strict";e.exports=a,e.exports.float32=e.exports.float=a,e.exports.fract32=e.exports.fract=function(t){if(t.length){for(var e=a(t),r=0,n=e.length;r":(e.length>100&&(e=e.slice(0,99)+"\u2026"),e=e.replace(a,(function(t){switch(t){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}})))}},{"./safe-to-string":293}],295:[function(t,e,r){"use strict";var n=t("../value/is"),a={object:!0,function:!0,undefined:!0};e.exports=function(t){return!!n(t)&&hasOwnProperty.call(a,typeof t)}},{"../value/is":301}],296:[function(t,e,r){"use strict";var n=t("../lib/resolve-exception"),a=t("./is");e.exports=function(t){return a(t)?t:n(t,"%v is not a plain function",arguments[1])}},{"../lib/resolve-exception":292,"./is":297}],297:[function(t,e,r){"use strict";var n=t("../function/is"),a=/^\s*class[\s{/}]/,i=Function.prototype.toString;e.exports=function(t){return!!n(t)&&!a.test(i.call(t))}},{"../function/is":291}],298:[function(t,e,r){"use strict";var n=t("../object/is");e.exports=function(t){if(!n(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},{"../object/is":295}],299:[function(t,e,r){"use strict";var n=t("../value/is"),a=t("../object/is"),i=Object.prototype.toString;e.exports=function(t){if(!n(t))return null;if(a(t)){var e=t.toString;if("function"!=typeof e)return null;if(e===i)return null}try{return""+t}catch(t){return null}}},{"../object/is":295,"../value/is":301}],300:[function(t,e,r){"use strict";var n=t("../lib/resolve-exception"),a=t("./is");e.exports=function(t){return a(t)?t:n(t,"Cannot use %v",arguments[1])}},{"../lib/resolve-exception":292,"./is":301}],301:[function(t,e,r){"use strict";e.exports=function(t){return null!=t}},{}],302:[function(t,e,r){(function(e){"use strict";var n=t("bit-twiddle"),a=t("dup"),i=t("buffer").Buffer;e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:a([32,0]),UINT16:a([32,0]),UINT32:a([32,0]),BIGUINT64:a([32,0]),INT8:a([32,0]),INT16:a([32,0]),INT32:a([32,0]),BIGINT64:a([32,0]),FLOAT:a([32,0]),DOUBLE:a([32,0]),DATA:a([32,0]),UINT8C:a([32,0]),BUFFER:a([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s="undefined"!=typeof BigUint64Array,l="undefined"!=typeof BigInt64Array,u=e.__TYPEDARRAY_POOL;u.UINT8C||(u.UINT8C=a([32,0])),u.BIGUINT64||(u.BIGUINT64=a([32,0])),u.BIGINT64||(u.BIGINT64=a([32,0])),u.BUFFER||(u.BUFFER=a([32,0]));var c=u.DATA,f=u.BUFFER;function h(t){if(t){var e=t.length||t.byteLength,r=n.log2(e);c[r].push(t)}}function d(t){t=n.nextPow2(t);var e=n.log2(t),r=c[e];return r.length>0?r.pop():new ArrayBuffer(t)}function p(t){return new Uint8Array(d(t),0,t)}function g(t){return new Uint16Array(d(2*t),0,t)}function v(t){return new Uint32Array(d(4*t),0,t)}function m(t){return new Int8Array(d(t),0,t)}function y(t){return new Int16Array(d(2*t),0,t)}function b(t){return new Int32Array(d(4*t),0,t)}function x(t){return new Float32Array(d(4*t),0,t)}function _(t){return new Float64Array(d(8*t),0,t)}function w(t){return o?new Uint8ClampedArray(d(t),0,t):p(t)}function A(t){return s?new BigUint64Array(d(8*t),0,t):null}function T(t){return l?new BigInt64Array(d(8*t),0,t):null}function k(t){return new DataView(d(t),0,t)}function M(t){t=n.nextPow2(t);var e=n.log2(t),r=f[e];return r.length>0?r.pop():new i(t)}r.free=function(t){if(i.isBuffer(t))f[n.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|n.log2(e);c[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeBigUint64=r.freeInt8=r.freeInt16=r.freeInt32=r.freeBigInt64=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){h(t.buffer)},r.freeArrayBuffer=h,r.freeBuffer=function(t){f[n.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return d(t);switch(e){case"uint8":return p(t);case"uint16":return g(t);case"uint32":return v(t);case"int8":return m(t);case"int16":return y(t);case"int32":return b(t);case"float":case"float32":return x(t);case"double":case"float64":return _(t);case"uint8_clamped":return w(t);case"bigint64":return T(t);case"biguint64":return A(t);case"buffer":return M(t);case"data":case"dataview":return k(t);default:return null}return null},r.mallocArrayBuffer=d,r.mallocUint8=p,r.mallocUint16=g,r.mallocUint32=v,r.mallocInt8=m,r.mallocInt16=y,r.mallocInt32=b,r.mallocFloat32=r.mallocFloat=x,r.mallocFloat64=r.mallocDouble=_,r.mallocUint8Clamped=w,r.mallocBigUint64=A,r.mallocBigInt64=T,r.mallocDataView=k,r.mallocBuffer=M,r.clearCache=function(){for(var t=0;t<32;++t)u.UINT8[t].length=0,u.UINT16[t].length=0,u.UINT32[t].length=0,u.INT8[t].length=0,u.INT16[t].length=0,u.INT32[t].length=0,u.FLOAT[t].length=0,u.DOUBLE[t].length=0,u.BIGUINT64[t].length=0,u.BIGINT64[t].length=0,u.UINT8C[t].length=0,c[t].length=0,f[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":40,buffer:52,dup:92}],303:[function(t,e,r){"use strict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e0&&(i=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,i+"px",n.font].filter((function(t){return t})).join(" "),r.textAlign="start",r.textBaseline="alphabetic",r.direction="ltr",h(function(t,e,r,n,i,o){r=r.replace(/\n/g,""),r=!0===o.breaklines?r.replace(/\/g,"\n"):r.replace(/\/g," ");var s="",l=[];for(d=0;d-1?parseInt(t[1+a]):0,l=i>-1?parseInt(r[1+i]):0;s!==l&&(n=n.replace(E(),"?px "),v*=Math.pow(.75,l-s),n=n.replace("?px ",E())),g+=.25*b*(l-s)}if(!0===o.superscripts){var u=t.indexOf("+"),c=r.indexOf("+"),f=u>-1?parseInt(t[1+u]):0,h=c>-1?parseInt(r[1+c]):0;f!==h&&(n=n.replace(E(),"?px "),v*=Math.pow(.75,h-f),n=n.replace("?px ",E())),g-=.25*b*(h-f)}if(!0===o.bolds){var d=t.indexOf("b|")>-1,p=r.indexOf("b|")>-1;!d&&p&&(n=m?n.replace("italic ","italic bold "):"bold "+n),d&&!p&&(n=n.replace("bold ",""))}if(!0===o.italics){var m=t.indexOf("i|")>-1,y=r.indexOf("i|")>-1;!m&&y&&(n="italic "+n),m&&!y&&(n=n.replace("italic ",""))}e.font=n}for(h=0;h",i="",o=a.length,s=i.length,l="+"===e[0]||"-"===e[0],u=0,c=-s;u>-1&&-1!==(u=r.indexOf(a,u))&&-1!==(c=r.indexOf(i,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,p=r.substr(d,c-d).indexOf(a);u=-1!==p?p:c+s}return n}function c(t,e){var r=n(t,128);return e?i(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function f(t,e,r,n){var a=c(t,n),i=function(t,e,r){for(var n=e.textAlign||"start",a=e.textBaseline||"alphabetic",i=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l= 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":79}],314:[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":313}],315:[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}]},{}],316:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":497,"../../plots/cartesian/constants":513,"../../plots/font_attributes":535,"./arrow_paths":315}],317:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./draw").draw;function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach((function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);e._extremes={},r&&s(e,r),n&&s(e,n)}))}function s(t,e){var r,n=e._id,i=n.charAt(0),o=t[i],s=t["a"+i],l=t[i+"ref"],u=t["a"+i+"ref"],c=t["_"+i+"padplus"],f=t["_"+i+"padminus"],h={x:1,y:-1}[i]*t[i+"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=a.findExtremes(e,[e.r2c(o)],{ppadplus:p,ppadminus:g}),x=a.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=a.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([i,o],t)}},{"../../lib":460,"../../plots/cartesian/axes":507,"./draw":322}],318:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("../../plot_api/plot_template").arrayEditor;function o(t,e){var r,n,a,i,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 G=!1,q=["x","y"],W=0;W1)&&(tt===K?((ut=et.r2fraction(e["a"+$]))<0||ut>1)&&(G=!0):G=!0),X=et._offset+et.r2p(e[$]),J=.5}else"x"===$?(Z=e[$],X=x.l+x.w*Z):(Z=1-e[$],X=x.t+x.h*Z),J=e.showarrow?.5:Z;if(e.showarrow){lt.head=X;var ct=e["a"+$];Q=nt*U(.5,e.xanchor)-at*U(.5,e.yanchor),tt===K?(lt.tail=et._offset+et.r2p(ct),Y=Q):(lt.tail=X+ct,Y=Q+ct),lt.text=lt.tail+Q;var ft=b["x"===$?"width":"height"];if("paper"===K&&(lt.head=o.constrain(lt.head,1,ft-1)),"pixel"===tt){var ht=-Math.max(lt.tail-3,lt.text),dt=Math.min(lt.tail+3,lt.text)-ft;ht>0?(lt.tail+=ht,lt.text+=ht):dt>0&&(lt.tail-=dt,lt.text-=dt)}lt.tail+=st,lt.head+=st}else Y=Q=it*U(J,ot),lt.text=X+Q;lt.text+=st,Q+=st,Y+=st,e["_"+$+"padplus"]=it/2+Y,e["_"+$+"padminus"]=it/2-Y,e["_"+$+"size"]=it,e["_"+$+"shift"]=Q}if(G)R.remove();else{var pt=0,gt=0;if("left"!==e.align&&(pt=(w-m)*("center"===e.align?.5:1)),"top"!==e.valign&&(gt=(D-y)*("middle"===e.valign?.5:1)),c)n.select("svg").attr({x:F+pt-1,y:F+gt}).call(u.setClipUrl,N?M:null,t);else{var vt=F+gt-p.top,mt=F+pt-p.left;V.call(f.positionText,mt,vt).call(u.setClipUrl,N?M:null,t)}B.select("rect").call(u.setRect,F,F,w,D),z.call(u.setRect,I/2,I/2,P-I,j-I),R.call(u.setTranslate,Math.round(E.x.text-P/2),Math.round(E.y.text-j/2)),L.attr({transform:"rotate("+S+","+E.x.text+","+E.y.text+")"});var yt,bt=function(r,n){C.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(S,m,y),w=o.apply2DTransform(b),M=o.apply2DTransform2(b),O=+z.attr("width"),D=+z.attr("height"),I=m-.5*O,P=I+O,F=y-.5*D,N=F+D,B=[[I,F,I,N],[I,N,P,N],[P,N,P,F],[P,F,I,F]].map(M);if(!B.reduce((function(t,e){return t^!!o.segmentsIntersect(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])}),!1)){B.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 j=e.arrowwidth,U=e.arrowcolor,V=e.arrowside,H=C.append("g").style({opacity:l.opacity(U)}).classed("annotation-arrow-g",!0),G=H.append("path").attr("d","M"+h+","+p+"L"+c+","+f).style("stroke-width",j+"px").call(l.stroke,l.rgb(U));if(g(G,V,e),_.annotationPosition&&G.node().parentNode&&!i){var q=c,W=f;if(e.standoff){var X=Math.sqrt(Math.pow(c-h,2)+Math.pow(f-p,2));q+=e.standoff*(h-c)/X,W+=e.standoff*(p-f)/X}var Y,Z,J=H.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-q)+","+(p-W),transform:"translate("+q+","+W+")"}).style("stroke-width",j+6+"px").call(l.stroke,"rgba(0,0,0,0)").call(l.fill,"rgba(0,0,0,0)");d.init({element:J.node(),gd:t,prepFn:function(){var t=u.getTranslate(R);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),a=n[0]+t,i=n[1]+r;R.call(u.setTranslate,a,i),T("x",s?s.p2r(s.r2p(e.x)+t):e.x+t/x.w),T("y",v?v.p2r(v.r2p(e.y)+r):e.y-r/x.h),e.axref===e.xref&&T("ax",s.p2r(s.r2p(e.ax)+t)),e.ayref===e.yref&&T("ay",v.p2r(v.r2p(e.ay)+r)),H.attr("transform","translate("+t+","+r+")"),L.attr({transform:"rotate("+S+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",t,k());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&bt(0,0),O)d.init({element:R.node(),gd:t,prepFn:function(){yt=L.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?T("ax",s.p2r(s.r2p(e.ax)+t)):T("ax",e.ax+t),e.ayref===e.yref?T("ay",v.p2r(v.r2p(e.ay)+r)):T("ay",e.ay+r),bt(t,r);else{if(i)return;var a,o;if(s)a=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;a=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)}T("x",a),T("y",o),s&&v||(n=d.getCursor(s?.5:a,v?.5:o,e.xanchor,e.yanchor))}L.attr({transform:"translate("+t+","+r+")"+yt}),h(R,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",H(n))},doneFn:function(){h(R),a.call("_guiRelayout",t,k());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 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),T=y*Math.sin(l);o.x-=A,o.y-=T,t.attr({x1:o.x,y1:o.y})}}else if("path"===c.nodeName){var k=c.getTotalLength(),M="";if(k1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l._pdata=a(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":542,"../annotations/draw":322}],329:[function(t,e,r){"use strict";var n=t("../../registry"),a=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 i=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(n(t))},i.opacity=function(t){return t?n(t).getAlpha():0},i.addOpacity=function(t,e){var r=n(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},i.combine=function(t,e){var r=n(t).toRgb();if(1===r.a)return n(t).toRgbString();var a=n(e||l).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(t,e,r){var a=n(t);return 1!==a.getAlpha()&&(a=n(i.combine(t,l))),(a.isDark()?e?a.lighten(e):l:r?a.darken(r):s).toString()},i.stroke=function(t,e){var r=n(e);t.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(t,e){var r=n(e);t.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,r,n,a,o=Object.keys(t);for(e=0;e0?n>=l:n<=l));a++)n>c&&n0?n>=l:n<=l));a++)n>r[0]&&n1){var Z=Math.pow(10,Math.floor(Math.log(Y)/Math.LN10));W*=Z*u.roundUp(Y/Z,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(q.tick0=0)}q.dtick=W}q.domain=[V+B,V+F-B],q.setScale(),t.attr("transform","translate("+Math.round(l.l)+","+Math.round(l.t)+")");var J,Q=t.select("."+T.cbtitleunshift).attr("transform","translate(-"+Math.round(l.l)+",-"+Math.round(l.t)+")"),$=t.select("."+T.cbaxis),K=0;function tt(n,a){var i={propContainer:q,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+T.cbtitle)},s="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(r,n,c(i,a||{}))}return u.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(k)){var t,r=l.l+(e.x+z)*l.w,n=q.title.font.size;t="top"===k?(1-(V+F-B))*l.h+l.t+3+.75*n:(1-(V+B))*l.h+l.t-3-.25*n,tt(q._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(k)){var i=t.select("."+T.cbtitle),o=i.select("text"),c=[-e.outlinewidth/2,e.outlinewidth/2],f=i.select(".h"+q._id+"title-math-group").node(),d=15.6;if(o.node()&&(d=parseInt(o.node().style.fontSize,10)*_),f?(K=h.bBox(f).height)>d&&(c[1]-=(K-d)/2):o.node()&&!o.classed(T.jsPlaceholder)&&(K=h.bBox(o.node()).height),K){if(K+=5,"top"===k)q.domain[1]-=K/l.h,c[1]*=-1;else{q.domain[0]+=K/l.h;var p=g.lineCount(o);c[1]+=(1-p)*d}i.attr("transform","translate("+c+")"),q.setScale()}}t.selectAll("."+T.cbfills+",."+T.cblines).attr("transform","translate(0,"+Math.round(l.h*(1-q.domain[1]))+")"),$.attr("transform","translate(0,"+Math.round(-l.t)+")");var m=t.select("."+T.cbfills).selectAll("rect."+T.cbfill).data(O);m.enter().append("rect").classed(T.cbfill,!0).style("stroke","none"),m.exit().remove();var y=M.map(q.c2p).map(Math.round).sort((function(t,e){return t-e}));m.each((function(t,i){var o=[0===i?M[0]:(O[i]+O[i-1])/2,i===O.length-1?M[1]:(O[i]+O[i+1])/2].map(q.c2p).map(Math.round);o[1]=u.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var s=n.select(this).attr({x:j,width:Math.max(R,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)h.gradient(s,r,e._id,"vertical",e._fillgradient,"fill");else{var l=S(t).replace("e-","");s.attr("fill",a(l).toHexString())}}));var b=t.select("."+T.cblines).selectAll("path."+T.cbline).data(v.color&&v.width?D:[]);b.enter().append("path").classed(T.cbline,!0),b.exit().remove(),b.each((function(t){n.select(this).attr("d","M"+j+","+(Math.round(q.c2p(t))+v.width/2%1)+"h"+R).call(h.lineGroupStyle,v.width,E(t),v.dash)})),$.selectAll("g."+q._id+"tick,path").remove();var x=j+R+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),w=s.calcTicks(q),A=s.makeTransFn(q),C=s.getTickSigns(q)[2];return s.drawTicks(r,q,{vals:"inside"===q.ticks?s.clipEnds(q,w):w,layer:$,path:s.makeTickPath(q,x,C),transFn:A}),s.drawLabels(r,q,{vals:w,layer:$,transFn:A,labelFns:s.makeLabelFns(q,x)})},function(){if(-1===["top","bottom"].indexOf(k)){var t=q.title.font.size,e=q._offset+q._length/2,a=l.l+(q.position||0)*l.w+("right"===q.side?10+t*(q.showticklabels?1:.5):-10-t*(q.showticklabels?.5:0));tt("h"+q._id+"title",{avoid:{selection:n.select(r).selectAll("g."+q._id+"tick"),side:k,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=R+e.outlinewidth/2+h.bBox($.node()).width;if((J=Q.select("text")).node()&&!J.classed(T.jsPlaceholder)){var a,o=Q.select(".h"+q._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(k)?h.bBox(o).width:h.bBox(Q.node()).right-j-l.l,n=Math.max(n,a)}var s=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,u=H-G;t.select("."+T.cbbg).attr({x:j-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:G-N,width:Math.max(s,2),height:Math.max(u+2*N,2)}).call(d.fill,e.bgcolor).call(d.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+T.cboutline).attr({x:j,y:G+e.ypad+("top"===k?K:0),width:Math.max(R,2),height:Math.max(u-2*e.ypad-K,2)}).call(d.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var c=({center:.5,right:1}[e.xanchor]||0)*s;t.attr("transform","translate("+(l.l-c)+","+l.t+")");var f={},p=w[e.yanchor],g=A[e.yanchor];"pixels"===e.lenmode?(f.y=e.y,f.t=u*p,f.b=u*g):(f.t=f.b=0,f.yt=e.y+e.len*p,f.yb=e.y-e.len*g);var v=w[e.xanchor],m=A[e.xanchor];if("pixels"===e.thicknessmode)f.x=e.x,f.l=s*v,f.r=s*m;else{var y=s-R;f.l=y*v,f.r=y*m,f.xl=e.x-e.thickness*v,f.xr=e.x+e.thickness*m}i.autoMargin(r,e._id,f)}],r)}(r,e,t);v&&v.then&&(t._promises||[]).push(v),t._context.edits.colorbarPosition&&function(t,e,r){var n,a,i,s=r._fullLayout._size;l.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),f(t)},moveFn:function(r,o){t.attr("transform",n+" translate("+r+","+o+")"),a=l.align(e._xLeftFrac+r/s.w,e._thickFrac,0,1,e.xanchor),i=l.align(e._yBottomFrac-o/s.h,e._lenFrac,0,1,e.yanchor);var u=l.getCursor(a,i,e.xanchor,e.yanchor);f(t,u)},doneFn:function(){if(f(t),void 0!==a&&void 0!==i){var n={};n[e._propPrefix+"x"]=a,n[e._propPrefix+"y"]=i,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){i.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":433,"../../lib":460,"../../lib/extend":452,"../../lib/setcursor":480,"../../lib/svg_text_utils":484,"../../plots/cartesian/axes":507,"../../plots/cartesian/axis_defaults":509,"../../plots/cartesian/layout_attributes":521,"../../plots/cartesian/position_defaults":524,"../../plots/plots":545,"../../registry":553,"../color":331,"../colorscale/helpers":342,"../dragelement":350,"../drawing":353,"../titles":426,"./constants":333,d3:86,tinycolor2:285}],336:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":460}],337:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":332,"./defaults":334,"./draw":335,"./has_colorbar":336}],338:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),a=t("../../lib/regex").counter,i=t("./scales.js").scales;Object.keys(i);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,s=(e=e||{}).cLetter||"c",l=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),u="showScaleDflt"in e?e.showScaleDflt:"z"===s,c="string"==typeof e.colorscaleDflt?i[e.colorscaleDflt]:null,f=e.editTypeOverride||"",h=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(h+(r={z:"z",c:"color"}[s]));var d=s+"auto",p=s+"min",g=s+"max",v=s+"mid",m=(o(h+d),o(h+p),o(h+g),{});m[p]=m[g]=void 0;var y={};y[d]=!1;var b={};return"color"===r&&(b.color={valType:"color",arrayOk:!0,editType:f||"style"},e.anim&&(b.color.anim=!0)),b[d]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},b[p]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},b[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},b[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},b.colorscale={valType:"colorscale",editType:"calc",dflt:c,impliedEdits:{autocolorscale:!1}},b.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},b.reversescale={valType:"boolean",dflt:!1,editType:"plot"},l||(b.showscale={valType:"boolean",dflt:u,editType:"calc"},b.colorbar=n),e.noColorAxis||(b.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),b}},{"../../lib/regex":476,"../colorbar/attributes":332,"./scales.js":346}],339:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,s=t._fullLayout,l=r.vals,u=r.containerStr,c=u?a.nestedProperty(e,u).get():e,f=i(c),h=!1!==f.auto,d=f.min,p=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,l)},m=function(){return a.aggNums(Math.max,null,l)};(void 0===d?d=v():h&&(d=c._colorAx&&n(d)?Math.min(d,v()):v()),void 0===p?p=m():h&&(p=c._colorAx&&n(p)?Math.max(p,m()):m()),h&&void 0!==g&&(p-g>g-d?d=g-(p-g):p-g=0?s.colorscale.sequential:s.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":460,"./helpers":342,"fast-isnumeric":155}],340:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./helpers").hasColorscale,i=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,a){var o=a.container?n.nestedProperty(t,a.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var s=i(o),l=s.auto;(l||void 0===s.min)&&r(o,a.min),(l||void 0===s.max)&&r(o,a.max),s.autocolorscale&&r(o,"colorscale")}}for(var s=0;s=0;n--,a++){var i=t[n];r[a]=[1-i[0],i[1]]}return r}function p(t,e){e=e||{};for(var r=t.domain,o=t.range,l=o.length,u=new Array(l),c=0;c4/3-s?o:s}},{}],348:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":460}],349:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],350:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),a=t("has-hover"),i=t("has-passive-events"),o=t("../../lib").removeElement,s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");function c(){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 f(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){var e,r,n,u,h,d,p,g,v=t.gd,m=1,y=v._context.doubleClickDelay,b=t.element;v._mouseDownTime||(v._mouseDownTime=0),b.style.pointerEvents="all",b.onmousedown=_,i?(b._ontouchstart&&b.removeEventListener("touchstart",b._ontouchstart),b._ontouchstart=_,b.addEventListener("touchstart",_,{passive:!1})):b.ontouchstart=_;var x=t.clampFn||function(t,e,r){return Math.abs(t)y&&(m=Math.max(m-1,1)),v._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(m,d),!g){var r;try{r=new MouseEvent("click",e)}catch(t){var n=f(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)}p.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},l.coverSlip=c},{"../../lib":460,"../../plots/cartesian/constants":513,"./align":347,"./cursor":348,"./unhover":351,"has-hover":203,"has-passive-events":204,"mouse-event-offset":219}],351:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=t("../../lib/throttle"),i=t("../../lib/dom").getGraphDiv,o=t("../fx/constants"),s=e.exports={};s.wrapped=function(t,e,r){(t=i(t))._fullLayout&&a.clear(t._fullLayout._uid+o.HOVERID),s.raw(t,e,r)},s.raw=function(t,e){var r=t._fullLayout,a=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&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/dom":450,"../../lib/events":451,"../../lib/throttle":485,"../fx/constants":365}],352:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],353:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=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=t("../../components/fx/helpers").appendArrayPointValue,m=e.exports={};m.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)},m.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},m.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},m.setRect=function(t,e,r,n,a){t.call(m.setPosition,e,r).call(m.setSize,n,a)},m.translatePoint=function(t,e,r,n){var i=r.c2p(t.x),o=n.c2p(t.y);return!!(a(i)&&a(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",o):e.attr("transform","translate("+i+","+o+")"),!0)},m.translatePoints=function(t,e,r){t.each((function(t){var a=n.select(this);m.translatePoint(t,a,e,r)}))},m.hideOutsideRangePoint=function(t,e,r,n,a,i){e.attr("display",r.isPtWithinRange(t,a)&&n.isPtWithinRange(t,i)?null:"none")},m.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,a=e.yaxis;t.each((function(e){var i=e[0].trace,s=i.xcalendar,l=i.ycalendar,u=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";t.selectAll(u).each((function(t){m.hideOutsideRangePoint(t,n.select(this),r,a,s,l)}))}))}},m.crispRound=function(t,e,r){return e&&a(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},m.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,l=a||i.dash||"";s.stroke(e,n||i.color),m.dashLine(e,l,o)},m.lineGroupStyle=function(t,e,r,a){t.style("fill","none").each((function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,l=a||i.dash||"";n.select(this).call(s.stroke,r||i.color).call(m.dashLine,l,o)}))},m.dashLine=function(t,e,r){r=+r||0,e=m.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},m.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},m.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},m.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 y=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(y).forEach((function(t){var e=y[t],r=e.n;m.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),m.symbolNames[r]=t,m.symbolFuncs[r]=e.f,e.needLine&&(m.symbolNeedLines[r]=!0),e.noDot?m.symbolNoDot[r]=!0:m.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(m.symbolNoFill[r]=!0)}));var b=m.symbolNames.length;function x(t,e){var r=t%100;return m.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}m.symbolNumber=function(t){if(a(t))t=+t;else 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=m.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=b||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"),T={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}};m.gradient=function(t,e,r,a,o,l){for(var c=o.length,f=T[a],h=new Array(c),d=0;d"+m(t);p._gradientUrlQueryParts[y]=1},m.initGradients=function(t){var e=t._fullLayout;u.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},m.pointStyle=function(t,e,r){if(t.size()){var a=m.makePointStyleFns(e);t.each((function(t){m.singlePointStyle(t,n.select(this),e,a,r)}))}},m.singlePointStyle=function(t,e,r,n,a){var i=r.marker,o=i.line;if(e.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(t):void 0===t.mo?i.opacity:t.mo),n.ms2mrc){var l;l="various"===t.ms||"various"===i.size?3:n.ms2mrc(t.ms),t.mrc=l,n.selectedSizeFn&&(l=t.mrc=n.selectedSizeFn(t));var c=m.symbolNumber(t.mx||i.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=i.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(i.color)&&(f=s.defaultLine,p=!0),f="mc"in t?t.mcc=n.markerScale(t.mc):i.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",(t.isBlank?0:d)+"px");var v=i.gradient,y=t.mgt;if(y?p=!0:y=v&&v.type,Array.isArray(y)&&(y=y[0],T[y]||(y=0)),y&&"none"!==y){var b=t.mgc;b?p=!0:b=v.color;var _=r.uid;p&&(_+="-"+t.i),m.gradient(e,a,_,y,[[0,b],[1,f]],"fill")}else s.fill(e,f);d&&s.stroke(e,h)}},m.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=m.tryColorscale(r,""),e.lineScale=m.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,m.makeSelectedPointStyleFns(t)),e},m.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.marker||{},i=r.marker||{},s=n.marker||{},l=a.opacity,c=i.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?a.opacity:t.mo;return t.selected?h?c:e:p?f:d*e});var g=a.color,v=i.color,m=s.color;(v||m)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?v||e:m||e});var y=a.size,b=i.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},m.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.textfont||{},i=r.textfont||{},o=n.textfont||{},l=a.color,u=i.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},m.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=m.makeSelectedPointStyleFns(e),a=e.marker||{},i=[];r.selectedOpacityFn&&i.push((function(t,e){t.style("opacity",r.selectedOpacityFn(e))})),r.selectedColorFn&&i.push((function(t,e){s.fill(t,r.selectedColorFn(e))})),r.selectedSizeFn&&i.push((function(t,e){var n=e.mx||a.symbol||0,i=r.selectedSizeFn(e);t.attr("d",x(m.symbolNumber(n),i)),e.mrc2=i})),i.length&&t.each((function(t){for(var e=n.select(this),r=0;r0?r:0}m.textPointStyle=function(t,e,r){if(t.size()){var a;if(e.selectedpoints){var i=m.makeSelectedTextStyleFns(e);a=i.selectedTextColorFn}var o=e.texttemplate,s=r._fullLayout;t.each((function(t){var i=n.select(this),l=o?u.extractOption(t,e,"txt","texttemplate"):u.extractOption(t,e,"tx","text");if(l||0===l){if(o){var f=e._module.formatLabels?e._module.formatLabels(t,e,s):{},h={};v(h,e,t.i);var d=e._meta||{};l=u.texttemplateString(l,f,s._d3locale,h,t,d)}var p=t.tp||e.textposition,g=E(t,e),y=a?a(t):t.tc||e.textfont.color;i.call(m.font,t.tf||e.textfont.family,g,y).text(l).call(c.convertToTspans,r).call(M,p,g,t.mrc)}else i.remove()}))}},m.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=m.makeSelectedTextStyleFns(e);t.each((function(t){var a=n.select(this),i=r.selectedTextColorFn(t),o=t.tp||e.textposition,l=E(t,e);s.fill(a,i),M(a,o,l,t.mrc2||t.mrc)}))}};function S(t,e,r,a){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,.25),c=Math.pow(s*s+l*l,.25),f=(c*c*i-u*u*s)*a,h=(c*c*o-u*u*l)*a,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)]]}m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(m.savedBBoxes={},O=0),r&&(m.savedBBoxes[r]=v),O++,u.extendFlat({},v)},m.setClipUrl=function(t,e,r){t.attr("clip-path",R(e,r))},m.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}},m.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=" translate("+e+", "+r+")").trim(),t[a]("transform",i),i},m.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}},m.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+=" scale("+e+", "+r+")").trim(),t[a]("transform",i),i};var I=/\s*sc.*/;m.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(I,"");t=(t+=n).trim(),this.setAttribute("transform",t)}))}};var P=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(t,e,r){t&&t.each((function(){var t,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(a.attr("transform")||"").match(P);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),a.attr("transform",t.join(" "))}}))}},{"../../components/fx/helpers":367,"../../constants/alignment":433,"../../constants/interactions":436,"../../constants/xmlns_namespaces":438,"../../lib":460,"../../lib/svg_text_utils":484,"../../registry":553,"../../traces/scatter/make_bubble_size_func":631,"../../traces/scatter/subtypes":638,"../color":331,"../colorscale":343,"./symbol_defs":354,d3:86,"fast-isnumeric":155,tinycolor2:285}],354:[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,a="l"+e+",-"+e,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+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),a=n.round(-t,2),i=n.round(-.309*t,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"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),a=n.round(.951*e,2),i=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"+a+"L"+i+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"L-"+o+","+c+"L-"+i+","+u+"L-"+a+","+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),a=n.round(.76*t,2);return"M-"+a+",0l-"+r+",-"+e+"h"+a+"l"+r+",-"+e+"l"+r+","+e+"h"+a+"l-"+r+","+e+"l"+r+","+e+"h-"+a+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+a+"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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+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),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"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),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"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),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+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),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:86}],355:[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"}}}},{}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../registry"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),s=t("./compute_error");function l(t,e,r,a){var l=e["error_"+a]||{},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),i.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),a(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),a(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0)));return n}(t,l,u);if(!g||t.vis){var i,o=e.select("path.yerror");if(p.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=p.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="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",i)}else o.remove();var h=e.select("path.xerror");if(d.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(d.copy_ystyle?p:d).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="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",i)}else h.remove()}}))}}))}},{"../../traces/scatter/subtypes":638,"../drawing":353,d3:86,"fast-isnumeric":155}],361:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each((function(t){var e=t[0].trace,r=e.error_y||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":331,d3:86}],362:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("./layout_attributes").hoverlabel,i=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":452,"../../plots/font_attributes":535,"./layout_attributes":372}],363:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry");function i(t,e,r,a){a=a||n.identity,Array.isArray(t)&&(e[0][r]=a(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.indexx[0]._length||tt<0||tt>w[0]._length)return h.unhoverRaw(t,e)}if(e.pointerX=K+x[0]._offset,e.pointerY=tt+w[0]._offset,I="xval"in e?g.flat(l,e.xval):g.p2c(x,K),P="yval"in e?g.flat(l,e.yval):g.p2c(w,tt),!a(I[0])||!a(P[0]))return o.warn("Fx.hover failed",e,t),h.unhoverRaw(t,e)}var rt=1/0;function nt(t,r){for(z=0;zW&&(Z.splice(0,W),rt=Z[0].distance),m&&0!==Y&&0===Z.length){q.distance=Y,q.index=!1;var h=B._module.hoverPoints(q,H,G,"closest",c._hoverlayer);if(h&&(h=h.filter((function(t){return t.spikeDistance<=Y}))),h&&h.length){var d,p=h.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(p.length){var v=p[0];a(v.x0)&&a(v.y0)&&(d=it(v),(!Q.vLinePoint||Q.vLinePoint.spikeDistance>d.spikeDistance)&&(Q.vLinePoint=d))}var y=h.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(y.length){var b=y[0];a(b.x0)&&a(b.y0)&&(d=it(b),(!Q.hLinePoint||Q.hLinePoint.spikeDistance>d.spikeDistance)&&(Q.hLinePoint=d))}}}}}function at(t,e){for(var r,n=null,a=1/0,i=0;i1||Z.length>1)||"closest"===C&&$&&Z.length>1,kt=f.combine(c.plot_bgcolor||f.background,c.paper_bgcolor),Mt={hovermode:C,rotateLabels:Tt,bgColor:kt,container:c._hoverlayer,outerContainer:c._paperdiv,commonLabelOpts:c.hoverlabel,hoverdistance:c.hoverdistance},Et=S(Z,Mt,t);g.isUnifiedHover(C)||(!function(t,e,r){var n,a,i,o,s,l,u,c=0,f=1,h=t.size(),d=new Array(h),p=0;function g(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=i;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-=i;for(o=t.length-1;o>=0&&!(u<=0);o--)(l=t[o]).pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}t.each((function(t){var n=t[e],a="x"===n._id.charAt(0),i=n.range;0===p&&i&&i[0]>i[1]!==a&&(f=-1),d[p++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(a?_: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)}));for(;!n&&c<=h;){for(c++,n=!0,o=0;o.01&&y.pmin===b.pmin&&y.pmax===b.pmax){for(s=m.length-1;s>=0;s--)m[s].dp+=a;for(v.push.apply(v,m),d.splice(o+1,1),u=0,s=v.length-1;s>=0;s--)u+=v[s].dp;for(i=u/v.length,s=v.length-1;s>=0;s--)v[s].dp-=i;n=!1}else o++}d.forEach(g)}for(o=d.length-1;o>=0;o--){var x=d[o];for(s=x.length-1;s>=0;s--){var w=x[s],A=w.datum;A.offset=w.dp,A.del=w.del}}}(Et,Tt?"xa":"ya",c),L(Et,Tt));if(e.target&&e.target.tagName){var St=p.getComponentMethod("annotations","hasClickToShow")(t,xt);u(n.select(e.target),St?"pointer":"")}if(!e.target||i||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(t,0,bt))return;bt&&t.emit("plotly_unhover",{event:e,points:bt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:x,yaxes:w,xvals:I,yvals:P})}(t,e,r,i)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var a=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,nameLength:t.nameLength,textAlign:t.textAlign,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),o=e.outerContainer?n.select(e.outerContainer):i,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||f.background,container:i,outerContainer:o},l=S(a,s,e.gd),u=0,c=0;return l.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function S(t,e,r){var a=r._fullLayout,i=e.hovermode,s=e.rotateLabels,u=e.bgColor,h=e.container,d=e.outerContainer,p=e.commonLabelOpts||{},x=e.fontFamily||v.HOVERFONT,_=e.fontSize||v.HOVERFONTSIZE,w=t[0],A=w.xa,E=w.ya,S="y"===i.charAt(0)?"yLabel":"xLabel",L=w[S],O=(String(L)||"").split(" ")[0],D=d.node().getBoundingClientRect(),R=D.top,I=D.width,P=D.height,F=void 0!==L&&w.distance<=e.hoverdistance&&("x"===i||"y"===i);if(F){var z,N,B=!0;for(z=0;za.width-S?(m=a.width-S,s.attr("d","M"+(S-T)+",0L"+S+","+M+T+"v"+M+(2*k+b.height)+"H-"+S+"V"+M+T+"H"+(S-2*T)+"Z")):s.attr("d","M0,0L"+T+","+M+T+"H"+(k+b.width/2)+"v"+M+(2*k+b.height)+"H-"+(k+b.width/2)+"V"+M+T+"H-"+T+"Z")}else{var C,O,D;"right"===E.side?(C="start",O=1,D="",m=A._offset+A._length):(C="end",O=-1,D="-",m=A._offset),y=E._offset+(w.y0+w.y1)/2,u.attr("text-anchor",C),s.attr("d","M0,0L"+D+T+","+T+"V"+(k+b.height/2)+"h"+D+(2*k+b.width)+"V-"+(k+b.height/2)+"H"+D+T+"V-"+T+"Z");var I,P=b.height/2,F=R-b.top-P,z="clip"+a._uid+"commonlabel"+E._id;if(m=0?K-=rt:K+=2*k;var nt=et.height+2*k,at=$+nt>=P;return nt<=P&&($<=R?$=E._offset+2*k:at&&($=P-nt)),tt.attr("transform","translate("+K+","+$+")"),tt}var it=h.selectAll("g.hovertext").data(t,(function(t){return M(t)}));return it.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(f.fill,f.addOpacity(u,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(c.font,x,_)})),it.exit().remove(),it.each((function(t){var e=n.select(this).attr("transform",""),o=t.bgcolor||t.color,h=f.combine(f.opacity(o)?o:f.defaultLine,u),d=f.combine(f.opacity(t.color)?t.color:f.defaultLine,u),p=t.borderColor||f.contrast(h),g=C(t,F,i,a,L,e),v=g[0],m=g[1],y=e.select("text.nums").call(c.font,t.fontFamily||x,t.fontSize||_,t.fontColor||p).text(v).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),w=e.select("text.name"),A=0,M=0;if(m&&m!==v){w.call(c.font,t.fontFamily||x,t.fontSize||_,d).text(m).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r);var E=w.node().getBoundingClientRect();A=E.width+2*k,M=E.height+2*k}else w.remove(),e.select("rect").remove();e.select("path").style({fill:h,stroke:p});var S,O,D=y.node().getBoundingClientRect(),z=t.xa._offset+(t.x0+t.x1)/2,N=t.ya._offset+(t.y0+t.y1)/2,B=Math.abs(t.x1-t.x0),j=Math.abs(t.y1-t.y0),U=D.width+T+k+A;if(t.ty0=R-D.top,t.bx=D.width+2*k,t.by=Math.max(D.height+2*k,M),t.anchor="start",t.txwidth=D.width,t.tx2width=A,t.offset=0,s)t.pos=z,S=N+j/2+U<=P,O=N-j/2-U>=0,"top"!==t.idealAlign&&S||!O?S?(N+=j/2,t.anchor="start"):t.anchor="middle":(N-=j/2,t.anchor="end");else if(t.pos=N,S=z+B/2+U<=I,O=z-B/2-U>=0,"left"!==t.idealAlign&&S||!O)if(S)z+=B/2,t.anchor="start";else{t.anchor="middle";var V=U/2,H=z+V-I,G=z-V;H>0&&(z-=H),G<0&&(z+=-G)}else z-=B/2,t.anchor="end";y.attr("text-anchor",t.anchor),A&&w.attr("text-anchor",t.anchor),e.attr("transform","translate("+z+","+N+")"+(s?"rotate("+b+")":""))})),it}function C(t,e,r,n,a,i){var s="",l="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),s=I(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(l+=(l?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===a?l=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(l+=(l?"
":"")+t.text),void 0!==t.extraText&&(l+=(l?"
":"")+t.extraText),i&&""===l&&!t.hovertemplate&&(""===s&&i.remove(),l=s);var u=n._d3locale,c=t.hovertemplate||!1,f=t.hovertemplateLabels||t,h=t.eventData[0]||{};return c&&(l=(l=o.hovertemplateString(c,f,u,h,t.trace._meta)).replace(E,(function(e,r){return s=I(r,t.nameLength),""}))),[l,s]}function L(t,e){t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var a=r.select("text.nums"),i=t.anchor,o="end"===i?-1:1,s={start:1,end:-1,middle:0}[i],u=s*(T+k),f=u+s*(t.txwidth+k),h=0,d=t.offset;"middle"===i&&(u-=t.tx2width/2,f+=t.txwidth/2+k),e&&(d*=-A,h=t.offset*w),r.select("path").attr("d","middle"===i?"M-"+(t.bx/2+t.tx2width/2)+","+(d-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(o*T+h)+","+(T+d)+"v"+(t.by/2-T)+"h"+o*t.bx+"v-"+t.by+"H"+(o*T+h)+"V"+(d-T)+"Z");var p=u+h,g=d+t.ty0-t.by/2+k,v=t.textAlign||"auto";"auto"!==v&&("left"===v&&"start"!==i?(a.attr("text-anchor","start"),p="middle"===i?-t.bx/2-t.tx2width/2+k:-t.bx-k):"right"===v&&"end"!==i&&(a.attr("text-anchor","end"),p="middle"===i?t.bx/2-t.tx2width/2-k:t.bx+k)),a.call(l.positionText,p,g),t.tx2width&&(r.select("text.name").call(l.positionText,f+s*k+h,d+t.ty0-t.by/2+k),r.select("rect").call(c.setRect,f+(s-1)*t.tx2width/2+h,d-t.by/2-1,t.tx2width,t.by+2))}))}function O(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],s=t.cd[r]||{};function l(t){return t||a(t)&&0===t}var u=Array.isArray(r)?function(t,e){var a=o.castOption(i,r,t);return l(a)?a:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(s,n,t,e)};function c(e,r,n){var a=u(r,n);l(a)&&(t[e]=a)}if(c("hoverinfo","hi","hoverinfo"),c("bgcolor","hbg","hoverlabel.bgcolor"),c("borderColor","hbc","hoverlabel.bordercolor"),c("fontFamily","htf","hoverlabel.font.family"),c("fontSize","hts","hoverlabel.font.size"),c("fontColor","htc","hoverlabel.font.color"),c("nameLength","hnl","hoverlabel.namelength"),c("textAlign","hta","hoverlabel.align"),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 f=d.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+f+" / -"+d.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+f,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var h=d.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+h+" / -"+d.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+h,"y"===e&&(t.distance+=1)}var p=t.hoverinfo||t.trace.hoverinfo;return p&&"all"!==p&&(-1===(p=Array.isArray(p)?p:p.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===p.indexOf("y")&&(t.yLabel=void 0),-1===p.indexOf("z")&&(t.zLabel=void 0),-1===p.indexOf("text")&&(t.text=void 0),-1===p.indexOf("name")&&(t.name=void 0)),t}function D(t,e,r){var n,a,o=r.container,s=r.fullLayout,l=s._size,u=r.event,h=!!e.hLinePoint,p=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),p||h){var g=f.combine(s.plot_bgcolor,s.paper_bgcolor);if(h){var v,m,y=e.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=u.pointerX,m=u.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var b,x,_=i.readability(y.color,g)<1.5?f.contrast(g):y.color,w=a.spikemode,A=a.spikethickness,T=a.spikecolor||_,k=d.getPxPosition(t,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(b=k,x=v),-1!==w.indexOf("across")){var M=a._counterDomainMin,E=a._counterDomainMax;"free"===a.anchor&&(M=Math.min(M,a.position),E=Math.max(E,a.position)),b=l.l+M*l.w,x=l.l+E*l.w}o.insert("line",":first-child").attr({x1:b,x2:x,y1:m,y2:m,"stroke-width":A,stroke:T,"stroke-dasharray":c.dashStyle(a.spikedash,A)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:b,x2:x,y1:m,y2:m,"stroke-width":A+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:k+("right"!==a.side?A:-A),cy:m,r:A,fill:T}).classed("spikeline",!0)}if(p){var S,C,L=e.vLinePoint;n=L&&L.xa,a=L&&L.ya,"cursor"===n.spikesnap?(S=u.pointerX,C=u.pointerY):(S=n._offset+L.x,C=a._offset+L.y);var O,D,R=i.readability(L.color,g)<1.5?f.contrast(g):L.color,I=n.spikemode,P=n.spikethickness,F=n.spikecolor||R,z=d.getPxPosition(t,n);if(-1!==I.indexOf("toaxis")||-1!==I.indexOf("across")){if(-1!==I.indexOf("toaxis")&&(O=z,D=C),-1!==I.indexOf("across")){var N=n._counterDomainMin,B=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),B=Math.max(B,n.position)),O=l.t+(1-B)*l.h,D=l.t+(1-N)*l.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:O,y2:D,"stroke-width":P,stroke:F,"stroke-dasharray":c.dashStyle(n.spikedash,P)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:O,y2:D,"stroke-width":P+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==I.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:z-("top"!==n.side?P:-P),r:P,fill:F}).classed("spikeline",!0)}}}function R(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function I(t,e){return l.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":460,"../../lib/events":451,"../../lib/override_cursor":471,"../../lib/svg_text_utils":484,"../../plots/cartesian/axes":507,"../../registry":553,"../color":331,"../dragelement":350,"../drawing":353,"../legend/defaults":383,"../legend/draw":384,"./constants":365,"./helpers":367,d3:86,"fast-isnumeric":155,tinycolor2:285}],369:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),i=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function s(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&i(e.hovermode)&&(o.font||(o.font={}),s("size"),s("family"),s("color"),e.legend?(o.bgcolor||(o.bgcolor=a.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":460,"../color":331,"./helpers":367}],370:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function i(r,i){return void 0!==e[r]?e[r]:n.coerce(t,e,a,r,i)}var o,s=i("clickmode");return e._has("cartesian")?s.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!h&&!d&&!p)"independent"===T("pattern")&&(h=!0);v._hasSubplotGrid=h;var b,x,_="top to bottom"===T("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",T,w,b,y),y:c("y",T,A,x,m,_)}}else delete e.grid}function T(t,e){return n.coerce(r,v,l,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,a,i,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!==g||u.uirevision){var v=i.newContainer(e,"legend");if(_("uirevision",e.uirevision),!1!==g){_("bgcolor",e.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",e.font);var m,y,b,x=_("orientation");"h"===x?(m=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(y=1.1,b="bottom"):(y=-.1,b="top")):(m=1.02,y=1,b="auto"),_("traceorder",h),l.isGrouped(e.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",b),_("valign"),a.noneOrAll(u,v,["x","y"]),_("title.text")&&(_("title.side","h"===x?"left":"top"),a.coerceFont(_,"title.font",e.font))}}function _(t,e){return a.coerce(u,v,o,t,e)}}},{"../../lib":460,"../../plot_api/plot_template":497,"../../plots/layout_attributes":543,"../../registry":553,"./attributes":381,"./helpers":387}],384:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=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/alignment"),g=p.LINE_SPACING,v=p.FROM_TL,m=p.FROM_BR,y=t("./get_legend_data"),b=t("./style"),x=t("./helpers");function _(t,e,r,n,a){var i=r.data()[0][0].trace,l={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(i._group&&(l.group=i._group),o.traceIs(i,"pie-like")&&(l.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",l))if(1===n)e._clickTimeout=setTimeout((function(){h(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",l)&&h(r,t,n)}}function w(t,e,r){var n,i=t.data()[0][0],s=i.trace,l=o.traceIs(s,"pie-like"),c=s.index,h=r._main&&e._context.edits.legendText&&!l,p=r._maxNameLength;r.entries?n=i.text:(n=l?i.label:s.name,s._meta&&(n=a.templateString(n,s._meta)));var g=a.ensureSingle(t,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(u.font,r.font).text(h?A(n,p):n),f.positionText(g,d.textGap,0),h?g.call(f.makeEditable,{gd:e,text:n}).call(k,t,e,r).on("edit",(function(n){this.text(A(n,p)).call(k,t,e,r);var s=i.trace._fullInput||{},l={};if(o.hasTransform(s,"groupby")){var u=o.getTransformIndices(s,"groupby"),f=u[u.length-1],h=a.keyedContainer(s,"transforms["+f+"].styles","target","value.name");h.set(i.trace._group,n),l=h.constructUpdate()}else l.name=n;return o.call("_guiRestyle",e,l,c)})):k(g,t,e,r)}function A(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 T(t,e){var r,i=e._context.doubleClickDelay,o=1,s=a.ensureSingle(t,"rect","legendtoggle",(function(t){t.style("cursor","pointer").attr("pointer-events","all").call(c.fill,"rgba(0,0,0,0)")}));s.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(e,r,t,o,n.event)}}))}function k(t,e,r,n){n._main||t.attr("data-notex",!0),f.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var a=t.select("g[class*=math-group]"),i=a.node();r||(r=e._fullLayout.legend);var o,s,l=r.borderwidth,c=(n?r:r.title).font.size*g;if(i){var h=u.bBox(i);o=h.height,s=h.width,n?u.setTranslate(a,0,.25*o):u.setTranslate(a,l,.75*o+l)}else{var p=t.select(n?".legendtext":".legendtitletext"),v=f.lineCount(p),m=p.node();o=c*v,s=m?u.bBox(m).width:0;var y=c*((v-1)/2-.3);n?f.positionText(p,d.textGap,-y):f.positionText(p,d.titlePad+l,c+l)}n?(n.lineHeight=c,n.height=Math.max(o,16)+3,n.width=s):(r._titleWidth=s,r._titleHeight=o)}(e,r,n)}))}function M(t){return a.isRightAnchor(t)?"right":a.isCenterAnchor(t)?"center":"left"}function E(t){return a.isBottomAnchor(t)?"bottom":a.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,s=t._fullLayout,f="legend"+s._uid;if(e?(r=e.layer,f+="-hover"):((e=s.legend||{})._main=!0,r=s._infolayer),r){var h;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;h=s.showlegend&&y(t.calcdata,e)}else{if(!e.entries)return;h=y(e.entries,e)}var p=s.hiddenlabels||[];if(e._main&&(!s.showlegend||!h.length))return r.selectAll(".legend").remove(),s._topdefs.select("#"+f).remove(),i.autoMargin(t,"legend");var g=a.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),A=a.ensureSingleById(s._topdefs,"clipPath",f,(function(t){t.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));S.call(c.stroke,e.bordercolor).call(c.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),L=e.title;if(e._titleWidth=0,e._titleHeight=0,L.text){var O=a.ensureSingle(C,"text","legendtitletext");O.attr("text-anchor","start").classed("user-select-none",!0).call(u.font,L.font).text(L.text),k(O,C,t,e)}else C.selectAll(".legendtitletext").remove();var D=a.ensureSingle(g,"rect","scrollbar",(function(t){t.attr(d.scrollBarEnterAttrs).call(c.fill,d.scrollBarColor)})),R=C.selectAll("g.groups").data(h);R.enter().append("g").attr("class","groups"),R.exit().remove();var I=R.selectAll("g.traces").data(a.identity);I.enter().append("g").attr("class","traces"),I.exit().remove(),I.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==p.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(b,t,e).each((function(){e._main&&n.select(this).call(T,t)})),a.syncOrAsync([i.previousPromises,function(){return function(t,e,r,a){var i=t._fullLayout;a||(a=i.legend);var o=i._size,s=x.isVertical(a),l=x.isGrouped(a),c=a.borderwidth,f=2*c,h=d.textGap,p=d.itemGap,g=2*(c+p),v=E(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var b=0;a._width=0,a._height=0;var _=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(a);if(s)r.each((function(t){var e=t[0].height;u.setTranslate(this,c+_[0],c+_[1]+a._height+e/2+p),a._height+=e,a._width=Math.max(a._width,t[0].width)})),b=h+a._width,a._width+=p+h+f,a._height+=g,l&&(e.each((function(t,e){u.setTranslate(this,0,e*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=M(a),A=a.x<0||0===a.x&&"right"===w,T=a.x>1||1===a.x&&"left"===w,k=y||m,S=i.width/2;a._maxWidth=Math.max(A?k&&"left"===w?o.l+o.w:S:T?k&&"right"===w?o.r+o.w:S:o.w,2*h);var C=0,L=0;r.each((function(t){var e=t[0].width+h;C=Math.max(C,e),L+=e})),b=null;var O=0;if(l){var D=0,R=0,I=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;u.setTranslate(this,_[0],_[1]+c+p+n/2+e),e+=n,t=Math.max(t,h+r[0].width)})),D=Math.max(D,e);var r=t+p;r+c+R>a._maxWidth&&(O=Math.max(O,R),R=0,I+=D+a.tracegroupgap,D=e),u.setTranslate(this,R,I),R+=r})),a._width=Math.max(O,R)+c,a._height=I+D+g}else{var P=r.size(),F=L+f+(P-1)*pa._maxWidth&&(O=Math.max(O,j),N=0,B+=z,a._height+=z,z=0),u.setTranslate(this,_[0]+c+N,_[1]+c+B+e/2+p),j=N+r+p,N+=n,z=Math.max(z,e)})),F?(a._width=N+f,a._height=z+g):(a._width=Math.max(O,j)+f,a._height+=z+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(c+d.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(c+d.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var U=t._context.edits,V=U.legendText||U.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,a=V?h:b||h+t[0].width;s||(a+=p/2),u.setRect(e,0,-r/2,a,r)}))}(t,R,I,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=M(e),n=E(e);return i.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*v[r],r:e._width*m[r],b:e._effHeight*m[n],t:e._effHeight*v[n]})}(t)){var c,h,p,y,b=s._size,x=e.borderwidth,w=b.l+b.w*e.x-v[M(e)]*e._width,T=b.t+b.h*(1-e.y)-v[E(e)]*e._effHeight;if(e._main&&s.margin.autoexpand){var k=w,L=T;w=a.constrain(w,0,s.width-e._width),T=a.constrain(T,0,s.height-e._effHeight),w!==k&&a.log("Constrain legend.x to make legend fit inside graph"),T!==L&&a.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&u.setTranslate(g,w,T),D.on(".drag",null),g.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var O=e._effHeight;e._main||(O=e._height),S.attr({width:e._width-x,height:O-x,x:x/2,y:x/2}),u.setTranslate(C,0,0),A.select("rect").attr({width:e._width-2*x,height:O-2*x,x:x,y:x}),u.setClipUrl(C,f,t),u.setRect(D,0,0,0,0),delete e._scrollY}else{var R,I,P,F=Math.max(d.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),z=e._effHeight-F-2*d.scrollBarMargin,N=e._height-e._effHeight,B=z/N,j=Math.min(e._scrollY||0,N);S.attr({width:e._width-2*x+d.scrollBarWidth+d.scrollBarMargin,height:e._effHeight-x,x:x/2,y:x/2}),A.select("rect").attr({width:e._width-2*x+d.scrollBarWidth+d.scrollBarMargin,height:e._effHeight-2*x,x:x,y:x+j}),u.setClipUrl(C,f,t),H(j,F,B),g.on("wheel",(function(){H(j=a.constrain(e._scrollY+n.event.deltaY/z*N,0,N),F,B),0!==j&&j!==N&&n.event.preventDefault()}));var U=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;R="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,P=j})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(I="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,H(j=function(t,e,r){var n=(r-e)/B+t;return a.constrain(n,0,N)}(P,R,I),F,B))}));D.call(U);var V=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(R=t.changedTouches[0].clientY,P=j)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(I=t.changedTouches[0].clientY,H(j=function(t,e,r){var n=(e-r)/B+t;return a.constrain(n,0,N)}(P,R,I),F,B))}));C.call(V)}if(t._context.edits.legendPosition)g.classed("cursor-move",!0),l.init({element:g.node(),gd:t,prepFn:function(){var t=u.getTranslate(g);p=t.x,y=t.y},moveFn:function(t,r){var n=p+t,a=y+r;u.setTranslate(g,n,a),c=l.align(n,0,b.l,b.l+b.w,e.xanchor),h=l.align(a,0,b.t+b.h,b.t,e.yanchor)},doneFn:function(){void 0!==c&&void 0!==h&&o.call("_guiRelayout",t,{"legend.x":c,"legend.y":h})},clickFn:function(e,n){var a=r.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}));a.size()>0&&_(t,g,a,e,n)}})}function H(r,n,a){e._scrollY=t._fullLayout.legend._scrollY=r,u.setTranslate(C,0,-r),u.setRect(D,e._width,d.scrollBarMargin+r*a,d.scrollBarWidth,n),A.select("rect").attr("y",x+r)}}],t)}}},{"../../constants/alignment":433,"../../lib":460,"../../lib/events":451,"../../lib/svg_text_utils":484,"../../plots/plots":545,"../../registry":553,"../color":331,"../dragelement":350,"../drawing":353,"./constants":382,"./get_legend_data":385,"./handle_click":386,"./helpers":387,"./style":389,d3:86}],385:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){var r,i,o={},s=[],l=!1,u={},c=0,f=0,h=e._main;function d(t,r){if(""!==t&&a.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;r0))return 0;a=e.width}return p?n:Math.min(a,r)};function v(t,e,r){var i=t[0].trace,o=i.marker||{},l=o.line||{},u=r?i.visible&&i.type===r:a.traceIs(i,"bar"),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(u?[t]:[]);c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.each((function(t){var e=n.select(this),r=t[0],a=g(r.mlw,o.line,5,2);e.style("stroke-width",a+"px").call(s.fill,r.mc||o.color),a&&s.stroke(e,r.mlc||l.color)}))}function m(t,e,r){var o=t[0],s=o.trace,l=r?s.visible&&s.type===r:a.traceIs(s,r),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(l?[t]:[]);if(u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.size()){var h=(s.marker||{}).line,d=g(f(h.width,o.pts),h,5,2),p=i.minExtend(s,{marker:{line:{width:d}}});p.marker.line.color=h.color;var v=i.minExtend(o,{trace:p});c(u,v,p)}}t.each((function(t){var e=n.select(this),a=i.ensureSingle(e,"g","layers");a.style("opacity",t[0].trace.opacity);var o=r.valign,s=t[0].lineHeight,l=t[0].height;if("middle"!==o&&s&&l){var u={top:1,bottom:-1}[o]*(.5*(s-l+3));a.attr("transform","translate(0,"+u+")")}else a.attr("transform",null);a.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var c=a.selectAll("g.legendsymbols").data([t]);c.enter().append("g").classed("legendsymbols",!0),c.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,a=t[0].trace,u=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":u=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":u=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":u=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":u=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":u=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":u=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var c=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(u);c.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),c.exit().remove(),c.each((function(t,u){var c,f=n.select(this),d=l(a),p=d.colorscale,g=d.reversescale;if(p){if(!r){var v=p.length;c=0===u?p[g?v-1:0][1]:1===u?p[g?0:v-1][1]:p[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;c=i.isArrayOrTypedArray(m)?m[u]||m[0]:m}f.attr("d",t[0]),c?f.call(s.fill,c):f.call((function(t){if(t.size()){var n="legendfill-"+a.uid;o.gradient(t,e,n,h(g,"radial"===r),p,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var a=t[0].trace[t[0].dir].marker;return t[0].mc=a.color,t[0].mlw=a.line.width,t[0].mlc=a.line.color,v(t,this,"waterfall")}var i=[];e.visible&&r&&(i=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),a=e[t[0]].marker,i=g(void 0,a.line,5,2);r.attr("d",t[1]).style("stroke-width",i+"px").call(s.fill,a.color),i&&r.call(s.stroke,a.line.color)}))})).each((function(t){v(t,this,"funnel")})).each((function(t){v(t,this)})).each((function(t){var r=t[0].trace,l=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[t]:[]);l.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),l.exit().remove(),l.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==s.opacity(r.fillcolor)||0!==s.opacity((r.line||{}).color)){var a=g(void 0,r.line,5,2);t.style("stroke-width",a+"px").call(s.fill,r.fillcolor),a&&s.stroke(t,r.line.color)}else{var u=i.minExtend(r,{marker:{size:p?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});l.call(o.pointStyle,u,e)}}))})).each((function(t){m(t,this,"funnelarea")})).each((function(t){m(t,this,"pie")})).each((function(t){var r,a,s=t[0],c=s.trace,f=c.visible&&c.fill&&"none"!==c.fill,d=u.hasLines(c),p=c.contours,v=!1,m=!1,y=l(c),b=y.colorscale,x=y.reversescale;if(p){var _=p.coloring;"lines"===_?v=!0:d="none"===_||"heatmap"===_||p.showlines,"constraint"===p.type?f="="!==p._operation:"fill"!==_&&"heatmap"!==_||(m=!0)}var w=u.hasMarkers(c)||u.hasText(c),A=f||m,T=d||v,k=w||!A?"M5,0":T?"M5,-2":"M5,-3",M=n.select(this),E=M.select(".legendfill").selectAll("path").data(f||m?[t]:[]);if(E.enter().append("path").classed("js-fill",!0),E.exit().remove(),E.attr("d",k+"h30v6h-30z").call(f?o.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+c.uid;o.gradient(t,e,r,h(x),b,"fill")}}),d||v){var S=g(void 0,c.line,10,5);a=i.minExtend(c,{line:{width:S}}),r=[i.minExtend(s,{trace:a})]}var C=M.select(".legendlines").selectAll("path").data(d||v?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",k+(v?"l30,0.0001":"h30")).call(d?o.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+c.uid;o.lineGroupStyle(t),o.gradient(t,e,r,h(x),b,"stroke")}})})).each((function(t){var r,a,s=t[0],l=s.trace,c=u.hasMarkers(l),f=u.hasText(l),h=u.hasLines(l);function d(t,e,r,n){var a=i.nestedProperty(l,t).get(),o=i.isArrayOrTypedArray(a)&&e?e(a):a;if(p&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(t){return s._distinct&&s.index&&t[s.index]?t[s.index]:t[0]}if(c||f||h){var v={},m={};if(c){v.mc=d("marker.color",g),v.mx=d("marker.symbol",g),v.mo=d("marker.opacity",i.mean,[.2,1]),v.mlc=d("marker.line.color",g),v.mlw=d("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=d("marker.size",i.mean,[2,16],12);v.ms=y,m.marker.size=y}h&&(m.line={width:d("line.width",g,[0,10],5)}),f&&(v.tx="Aa",v.tp=d("textposition",g),v.ts=10,v.tc=d("textfont.color",g),v.tf=d("textfont.family",g)),r=[i.minExtend(s,v)],(a=i.minExtend(l,m)).selectedpoints=null,a.texttemplate=null}var b=n.select(this).select("g.legendpoints"),x=b.selectAll("path.scatterpts").data(c?r:[]);x.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),x.exit().remove(),x.call(o.pointStyle,a,e),c&&(r[0].mrc=3);var _=b.selectAll("g.pointtext").data(f?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.selectAll("text").call(o.textPointStyle,a,e)})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.visible&&"candlestick"===e.type?[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 a=n.select(this),i=e[r?"increasing":"decreasing"],o=g(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(s.fill,i.fillcolor),o&&s.stroke(a,i.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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 a=n.select(this),i=e[r?"increasing":"decreasing"],l=g(void 0,i.line,5,2);a.style("fill","none").call(o.dashLine,i.line.dash,l),l&&s.stroke(a,i.line.color)}))}))}},{"../../lib":460,"../../registry":553,"../../traces/pie/helpers":607,"../../traces/pie/style_one":608,"../../traces/scatter/subtypes":638,"../color":331,"../colorscale/helpers":342,"../drawing":353,d3:86}],390:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/plots"),i=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),s=t("../shapes/draw").eraseActiveShape,l=t("../../lib"),u=l._,c=e.exports={};function f(t,e){var r,a,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,u=t._fullLayout,c={},f=i.list(t,null,!0),h=u._cartesianSpikesEnabled;if("zoom"===s){var d,p="in"===l?.5:2,g=(1+p)/2,v=(1-p)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):p?(E=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):d?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):b?(E=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];h&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var g=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),a=0,i=0;i=n.max)e=F[r+1];else if(t=n.pmax)e=F[r+1];else if(t0?h+u:u;return{ppad:u,ppadplus:c?p:g,ppadminus:c?g:p}}return{ppad:u}}function c(t,e,r,n,a){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(i.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;oy?(T=f,S="y0",k=y,C="y1"):(T=y,S="y1",k=f,C="y0");X(n),J(s,r),function(t,e,r){var n=e.xref,a=e.yref,o=i.getFromId(r,n),s=i.getFromId(r,a),l="";"paper"===n||o.autorange||(l+=n);"paper"===a||s.autorange||(l+=a);c.setClipUrl(t,l?"clip"+r._fullLayout._uid+l:null,r)}(e,r,t),W.moveFn="move"===R?Y:Z,W.altKey=n.altKey},doneFn:function(){if(m(t))return;d(e),Q(s),x(e,t,r),n.call("_guiRelayout",t,l.getUpdateObj())},clickFn:function(){if(m(t))return;Q(s)}};function X(r){if(m(t))R=null;else if(F)R="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=W.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,s=r.clientY-n.top,l=!z&&a>10&&i>10&&!r.shiftKey?h.getCursor(o/a,1-s/i):"move";d(e,l),R=l.split("-")[0]}}function Y(n,a){if("path"===r.type){var i=function(t){return t},o=i,l=i;I?N("xanchor",r.xanchor=H(b+n)):(o=function(t){return H(U(t)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),P?N("yanchor",r.yanchor=G(A+a)):(l=function(t){return G(V(t)+a)},j&&"date"===j.type&&(l=g.encodeDate(l))),N("path",r.path=w(D,o,l))}else I?N("xanchor",r.xanchor=H(b+n)):(N("x0",r.x0=H(u+n)),N("x1",r.x1=H(v+n))),P?N("yanchor",r.yanchor=G(A+a)):(N("y0",r.y0=G(f+a)),N("y1",r.y1=G(y+a)));e.attr("d",_(t,r)),J(s,r)}function Z(n,a){if(z){var i=function(t){return t},o=i,l=i;I?N("xanchor",r.xanchor=H(b+n)):(o=function(t){return H(U(t)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),P?N("yanchor",r.yanchor=G(A+a)):(l=function(t){return G(V(t)+a)},j&&"date"===j.type&&(l=g.encodeDate(l))),N("path",r.path=w(D,o,l))}else if(F){if("resize-over-start-point"===R){var c=u+n,h=P?f-a:f+a;N("x0",r.x0=I?c:H(c)),N("y0",r.y0=P?h:G(h))}else if("resize-over-end-point"===R){var d=v+n,p=P?y-a:y+a;N("x1",r.x1=I?d:H(d)),N("y1",r.y1=P?p:G(p))}}else{var m=function(t){return-1!==R.indexOf(t)},x=m("n"),q=m("s"),W=m("w"),X=m("e"),Y=x?T+a:T,Z=q?k+a:k,Q=W?M+n:M,$=X?E+n:E;P&&(x&&(Y=T-a),q&&(Z=k-a)),(!P&&Z-Y>10||P&&Y-Z>10)&&(N(S,r[S]=P?Y:G(Y)),N(C,r[C]=P?Z:G(Z))),$-Q>10&&(N(L,r[L]=I?Q:H(Q)),N(O,r[O]=I?$:H($)))}e.attr("d",_(t,r)),J(s,r)}function J(t,e){(I||P)&&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 i=U(I?e.xanchor:a.midRange(r?[e.x0,e.x1]:g.extractPathCoords(e.path,p.paramIsX))),o=V(P?e.yanchor:a.midRange(r?[e.y0,e.y1]:g.extractPathCoords(e.path,p.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),I&&P){var s="M"+(i-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"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",l)}else{var u="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",u)}}()}function Q(t){t.selectAll(".visual-cue").remove()}h.init(W),q.node().onmousemove=X}(t,I,l,e,r,R):!0===l.editable&&I.style("pointer-events",O||u.opacity(E)*M<=.5?"stroke":"all");I.node().addEventListener("click",(function(){return function(t,e){if(!y(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void A(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=A,v(t)}}(t,I)}))}}function x(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"");c.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function _(t,e){var r,n,o,s,l,u,c,f,h=e.type,d=i.getFromId(t,e.xref),v=i.getFromId(t,e.yref),m=t._fullLayout._size;if(d?(r=g.shapePositionToRange(d),n=function(t){return d._offset+d.r2p(r(t,!0))}):n=function(t){return m.l+m.w*t},v?(o=g.shapePositionToRange(v),s=function(t){return v._offset+v.r2p(o(t,!0))}):s=function(t){return m.t+m.h*(1-t)},"path"===h)return d&&"date"===d.type&&(n=g.decodeDate(n)),v&&"date"===v.type&&(s=g.decodeDate(s)),function(t,e,r){var n=t.path,i=t.xsizemode,o=t.ysizemode,s=t.xanchor,l=t.yanchor;return n.replace(p.segmentRE,(function(t){var n=0,u=t.charAt(0),c=p.paramIsX[u],f=p.paramIsY[u],h=p.numParams[u],d=t.substr(1).replace(p.paramRE,(function(t){return c[n]?t="pixel"===i?e(s)+Number(t):e(t):f[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>h&&(t="X"),t}));return n>h&&(d=d.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+t)),u+d}))}(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,f=b-e.y1}else c=s(e.y0),f=s(e.y1);if("line"===h)return"M"+l+","+c+"L"+u+","+f;if("rect"===h)return"M"+l+","+c+"H"+u+"V"+f+"H"+l+"Z";var x=(l+u)/2,_=(c+f)/2,w=Math.abs(x-l),A=Math.abs(_-c),T="A"+w+","+A,k=x+w+","+_;return"M"+k+T+" 0 1,1 "+(x+","+(_-A))+T+" 0 0,1 "+k+"Z"}function w(t,e,r){return t.replace(p.segmentRE,(function(t){var n=0,a=t.charAt(0),i=p.paramIsX[a],o=p.paramIsY[a],s=p.numParams[a];return a+t.substr(1).replace(p.paramRE,(function(t){return n>=s||(i[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function A(t){y(t)&&(t._fullLayout._activeShapeIndex>=0&&(l(t),delete t._fullLayout._activeShapeIndex,v(t)))}e.exports={draw:v,drawOne:b,eraseActiveShape:function(t){if(!y(t))return;l(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&f(m),r.attr("d",g(e)),k&&!h)&&(T=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===A&&(t[0][0]="M"),e[w]=t,y(),b())}}()}}function D(t,r){!function(t,r){if(e.length)for(var n=0;n0&&l0&&(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 S(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 C(t,e,r){var n=r._dims,a=s.ensureSingle(t,"rect",c.railTouchRectClass,(function(n){n.call(T,e,t,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,c.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function L(t,e){var r=e._dims,n=r.inputAreaLength-2*c.railInset,a=s.ensureSingle(t,"rect",c.railRectClass);a.attr({width:n,height:c.railWidth,rx:c.railRadius,ry:c.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,e.bordercolor).call(i.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(a,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=[],a=0;a0?[0]:[]);function s(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),a.autoMargin(t,g(e))}if(i.enter().append("g").classed(c.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+c.groupClassName).each(s)})).remove(),0!==r.length){var l=i.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||f<0){var v={left:[-d,0],right:[d,0],top:[0,-d],bottom:[0,d]}[b.side];e.attr("transform","translate("+v+")")}}}return I.call(P),D&&(E?I.on(".opacity",null):(T=0,k=!0,I.text(m).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)}))),I.call(c.makeEditable,{gd:t}).on("edit",(function(e){void 0!==y?o.call("_guiRestyle",t,v,e,y):o.call("_guiRelayout",t,v,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(P)})).on("input",(function(t){this.text(t||" ").call(c.positionText,x.x,x.y)}))),I.classed("js-placeholder",k),w}}},{"../../constants/alignment":433,"../../constants/interactions":436,"../../lib":460,"../../lib/svg_text_utils":484,"../../plots/plots":545,"../../registry":553,"../color":331,"../drawing":353,d3:86,"fast-isnumeric":155}],427:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=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"}]},args2:{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:i(s({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":452,"../../plot_api/edit_types":490,"../../plot_api/plot_template":497,"../../plots/font_attributes":535,"../../plots/pad_attributes":544,"../color/attributes":330}],428:[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"}}},{}],429:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/array_container_defaults"),i=t("./attributes"),o=t("./constants").name,s=i.buttons;function l(t,e,r){function o(r,a){return n.coerce(t,e,i,r,a)}o("visible",a(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,a){return n.coerce(t,e,s,r,a)}r("visible","skip"===t.method||Array.isArray(t.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}e.exports=function(t,e){a(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":460,"../../plots/array_container_defaults":503,"./attributes":427,"./constants":428}],430:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=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,a,i,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&&(a.attr(f.menuIndexAttrName,"-1"),v(t,n,a,i,e),s||m(t,n,a,i,e))}function v(t,e,r,n,a){var i=s.ensureSingle(e,"g",f.headerClassName,(function(t){t.style("pointer-events","all")})),l=a._dims,u=a.active,c=a.buttons[u]||f.blankHeaderOpts,h={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},d={width:l.headerWidth,height:l.headerHeight};i.call(y,a,c,t).call(M,a,h,d),s.ensureSingle(e,"text",f.headerArrowClassName,(function(t){t.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:l.headerWidth-f.arrowOffsetX+a.pad.l,y:l.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(E,String(p(r,a)?-1:a._index)),m(t,e,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(A,a)})),o.setTranslate(e,l.lx,l.ly)}function m(t,e,r,i,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},T={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(M,o,x),u.on("click",(function(){n.event.defaultPrevented||(s.execute&&(s.args2&&o.active===l?(g(t,o,0,e,r,i,-1),a.executeAPICommand(t,s.method,s.args2)):(g(t,o,0,e,r,i,l),a.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?(T.w=Math.max(m.openWidth,m.headerWidth),T.h=x.y-T.t):(T.w=x.x-T.l,T.h=Math.max(m.openHeight,m.headerHeight)),T.direction=o.direction,i&&(c.size()?function(t,e,r,n,a,i){var o,s,l,u=a.direction,c="up"===u||"down"===u,h=a._dims,d=a.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(i)})).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,k=s.barLength+2*s.barPad,M=s.barWidth+2*s.barPad,E=p,S=v+m;S+M>u&&(S=u-M);var C=this.container.selectAll("rect.scrollbar-horizontal").data(T?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,s.barColor),T?(this.hbar=C.attr({rx:s.barRadius,ry:s.barRadius,x:E,y:S,width:k,height:M}),this._hbarXMin=E+k/2,this._hbarTranslateMax=w-k):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var L=m>A,O=s.barWidth+2*s.barPad,D=s.barLength+2*s.barPad,R=p+g,I=v;R+O>l&&(R=l-O);var P=this.container.selectAll("rect.scrollbar-vertical").data(L?[0]:[]);P.exit().on(".drag",null).remove(),P.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,s.barColor),L?(this.vbar=P.attr({rx:s.barRadius,ry:s.barRadius,x:R,y:I,width:O,height:D}),this._vbarYMin=I+D/2,this._vbarTranslateMax=A-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var F=this.id,z=c-.5,N=L?f+O+.5:f+.5,B=h-.5,j=T?d+M+.5:d+.5,U=o._topdefs.selectAll("#"+F).data(T||L?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",F).append("rect"),T||L?(this._clipRect=U.select("rect").attr({x:Math.floor(z),y:Math.floor(B),width:Math.ceil(N)-Math.floor(z),height:Math.ceil(j)-Math.floor(B)}),this.container.call(i.setClipUrl,F,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(i.setClipUrl,null),delete this._clipRect),T||L){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));T&&this.hbar.on(".drag",null).call(H),L&&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(i.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,a=r+this._hbarTranslateMax;t=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,s=i+this._vbarTranslateMax;e=(o.constrain(n.event.y,i,s)-i)/(s-i)*(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(i.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 a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var s=e/n;this.vbar.call(i.setTranslate,t,e+s*this._vbarTranslateMax)}}},{"../../lib":460,"../color":331,"../drawing":353,d3:86}],433:[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"}}},{}],434:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],435:[function(t,e,r){"use strict";e.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],436:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],437:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],438:[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}},{}],439:[function(t,e,r){"use strict";r.version=t("./version").version,t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config")();for(var n=t("./registry"),a=r.register=n.register,i=t("./plot_api"),o=Object.keys(i),s=0;splotly-logomark"}}},{}],442:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],443:[function(t,e,r){"use strict";var n=t("./mod"),a=n.mod,i=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 i(e-t,s)}function c(t,e){if(l(e))return!0;var r,n;e[0](n=a(n,s))&&(n+=s);var i=a(t,s),o=i+s;return i>=r&&i<=n||o>=r&&o<=n}function f(t,e,r,n,a,i,u){a=a||0,i=i||0;var c,f,h,d,p,g=l([r,n]);function v(t,e){return[t*Math.cos(e)+a,i-t*Math.sin(e)]}g?(c=0,f=o,h=s):r=a&&t<=i);var a,i},pathArc:function(t,e,r,n,a){return f(null,t,e,r,n,a,0)},pathSector:function(t,e,r,n,a){return f(null,t,e,r,n,a,1)},pathAnnulus:function(t,e,r,n,a,i){return f(t,e,r,n,a,i,1)}}},{"./mod":467}],444:[function(t,e,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(t){return a.isView(t)&&!(t instanceof i)}function s(t){return n(t)||o(t)}function l(t,e,r){if(s(t)){if(s(t[0])){for(var n=r,a=0;aa.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every((function(t){return a(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 a=n.regex||u(r);"string"==typeof t&&a.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 a=t.split("+"),i=0;i=n&&t<=a?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 T=A[1],k=A[3]||"1",M=Number(A[5]||1),E=Number(A[7]||0),S=Number(A[9]||0),C=Number(A[11]||0);if(u){if(2===T.length)return c;var L;T=Number(T);try{var O=v.getComponentMethod("calendars","getCal")(e);if(w){var D="i"===k.charAt(k.length-1);k=parseInt(k,10),L=O.newDate(T,O.toMonthIndex(T,k,D),M)}else L=O.newDate(T,Number(k),M)}catch(t){return c}return L?(L.toJD()-g)*f+E*h+S*d+C*p:c}T=2===T.length?(Number(T)+2e3-x)%100+x:Number(T),k-=1;var R=new Date(Date.UTC(2e3,k,M,E,S));return R.setUTCFullYear(T),R.getUTCMonth()!==k||R.getUTCDate()!==M?c:R.getTime()+C*p},n=r.MIN_MS=r.dateTime2ms("-9999"),a=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,T=3*h,k=5*d;function M(t,e,r,n,a){if((e||r||n||a)&&(t+=" "+w(e,2)+":"+w(r,2),(n||a)&&(t+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;t+="."+w(a,i)}return t}r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=n&&t<=a))return c;e||(e=0);var i,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{i=v.getComponentMethod("calendars","getCal")(r).fromJD(E).formatDate("yyyy-mm-dd")}catch(t){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=n+f&&t<=a-f))return c;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return M(i("%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 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 a=new Date(Math.floor(e+.05));if(_(n))try{t=v.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,n,a,i){if(a=_(a)&&a,!e)if("y"===r)e=i.year;else if("m"===r)e=i.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 a=(100+Math.min(l(t/p,60),C[e])).toFixed(e).substr(1);e>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(t,r)+"\n"+S(i.dayMonthYear,t,n,a);e=i.dayMonth+"\n"+i.year}return S(e,t,n,a)};var L=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 a=Math.round(t/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return e%12?i.add(o,e,"m"):i.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+L);return u.setUTCMonth(u.getUTCMonth()+e)+n-L},r.findExactDates=function(t,e){for(var r,n,a=0,i=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,a){var i=n*t+a*e;if(i<0)return n*n+a*a;if(i>r){var o=n-t,s=a-e;return o*o+s*s}var l=n*e-a*t;return l*l/r}r.segmentsIntersect=s,r.segmentDistance=function(t,e,r,n,a,i,o,u){if(s(t,e,r,n,a,i,o,u))return 0;var c=r-t,f=n-e,h=o-a,d=u-i,p=c*c+f*f,g=h*h+d*d,v=Math.min(l(c,f,p,a-t,i-e),l(c,f,p,o-t,u-e),l(h,d,g,t-a,e-i),l(h,d,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(t,e,r,s){if(t===a&&s===i||(n={},a=t,i=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(){a=null},r.getVisibleSegment=function(t,e,r){var n,a,i=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&&(a=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-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(t,e,r,n){for(var a,i,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=a:h=a,f++}return i}},{"./mod":467}],456:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),i=t("color-normalize"),o=t("../components/colorscale"),s=t("../components/color/attributes").defaultLine,l=t("./array").isArrayOrTypedArray,u=i(s);function c(t,e){var r=t;return r[3]*=e,r}function f(t){if(n(t))return u;var e=i(t);return e.length?e:u}function h(t){return n(t)?t:1}e.exports={formatColor:function(t,e,r){var n,a,s,d,p,g=t.color,v=l(g),m=l(e),y=o.extractOpts(t),b=[];if(n=void 0!==y.colorscale?o.makeColorScaleFuncFromTrace(t):f,a=v?function(t,e){return void 0===t[e]?u:i(n(t[e]))}:f,s=m?function(t,e){return void 0===t[e]?1:h(t[e])}:h,v||m)for(var x=0;x1?(r*t+r*e)/r:t+e,a=String(n).length;if(a>16){var i=String(e).length;if(a>=String(t).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],460:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../constants/numerical"),s=o.FP_SAFE,l=o.BADNUM,u=e.exports={};u.nestedProperty=t("./nested_property"),u.keyedContainer=t("./keyed_container"),u.relativeAttr=t("./relative_attr"),u.isPlainObject=t("./is_plain_object"),u.toLogRange=t("./to_log_range"),u.relinkPrivateKeys=t("./relink_private");var c=t("./array");u.isTypedArray=c.isTypedArray,u.isArrayOrTypedArray=c.isArrayOrTypedArray,u.isArray1D=c.isArray1D,u.ensureArray=c.ensureArray,u.concat=c.concat,u.maxRowLength=c.maxRowLength,u.minRowLength=c.minRowLength;var f=t("./mod");u.mod=f.mod,u.modHalf=f.modHalf;var h=t("./coerce");u.valObjectMeta=h.valObjectMeta,u.coerce=h.coerce,u.coerce2=h.coerce2,u.coerceFont=h.coerceFont,u.coerceHoverinfo=h.coerceHoverinfo,u.coerceSelectionMarkerOpacity=h.coerceSelectionMarkerOpacity,u.validate=h.validate;var d=t("./dates");u.dateTime2ms=d.dateTime2ms,u.isDateTime=d.isDateTime,u.ms2DateTime=d.ms2DateTime,u.ms2DateTimeLocal=d.ms2DateTimeLocal,u.cleanDate=d.cleanDate,u.isJSDate=d.isJSDate,u.formatDate=d.formatDate,u.incrementMonth=d.incrementMonth,u.dateTick0=d.dateTick0,u.dfltRange=d.dfltRange,u.findExactDates=d.findExactDates,u.MIN_MS=d.MIN_MS,u.MAX_MS=d.MAX_MS;var p=t("./search");u.findBin=p.findBin,u.sorterAsc=p.sorterAsc,u.sorterDes=p.sorterDes,u.distinctVals=p.distinctVals,u.roundUp=p.roundUp,u.sort=p.sort,u.findIndexOfMin=p.findIndexOfMin;var g=t("./stats");u.aggNums=g.aggNums,u.len=g.len,u.mean=g.mean,u.median=g.median,u.midRange=g.midRange,u.variance=g.variance,u.stdev=g.stdev,u.interp=g.interp;var v=t("./matrix");u.init2dArray=v.init2dArray,u.transposeRagged=v.transposeRagged,u.dot=v.dot,u.translationMatrix=v.translationMatrix,u.rotationMatrix=v.rotationMatrix,u.rotationXYMatrix=v.rotationXYMatrix,u.apply2DTransform=v.apply2DTransform,u.apply2DTransform2=v.apply2DTransform2;var m=t("./angles");u.deg2rad=m.deg2rad,u.rad2deg=m.rad2deg,u.angleDelta=m.angleDelta,u.angleDist=m.angleDist,u.isFullCircle=m.isFullCircle,u.isAngleInsideSector=m.isAngleInsideSector,u.isPtInsideSector=m.isPtInsideSector,u.pathArc=m.pathArc,u.pathSector=m.pathSector,u.pathAnnulus=m.pathAnnulus;var y=t("./anchor_utils");u.isLeftAnchor=y.isLeftAnchor,u.isCenterAnchor=y.isCenterAnchor,u.isRightAnchor=y.isRightAnchor,u.isTopAnchor=y.isTopAnchor,u.isMiddleAnchor=y.isMiddleAnchor,u.isBottomAnchor=y.isBottomAnchor;var b=t("./geometry2d");u.segmentsIntersect=b.segmentsIntersect,u.segmentDistance=b.segmentDistance,u.getTextLocation=b.getTextLocation,u.clearLocationCache=b.clearLocationCache,u.getVisibleSegment=b.getVisibleSegment,u.findPointOnPath=b.findPointOnPath;var x=t("./extend");u.extendFlat=x.extendFlat,u.extendDeep=x.extendDeep,u.extendDeepAll=x.extendDeepAll,u.extendDeepNoArrays=x.extendDeepNoArrays;var _=t("./loggers");u.log=_.log,u.warn=_.warn,u.error=_.error;var w=t("./regex");u.counterRegex=w.counter;var A=t("./throttle");u.throttle=A.throttle,u.throttleDone=A.done,u.clearThrottle=A.clear;var T=t("./dom");function k(t){var e={};for(var r in t)for(var n=t[r],a=0;as?l:i(t)?Number(t):l:l},u.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(i(t)&&t>=0&&t%1==0)},u.noop=t("./noop"),u.identity=t("./identity"),u.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))},u.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},u.simpleMap=function(t,e,r,n,a){for(var i=t.length,o=new Array(i),s=0;s=Math.pow(2,r)?a>10?(u.warn("randstr failed uniqueness"),l):t(e,r,n,(a||0)+1):l},u.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},u.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,i,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(a-=s*Math.floor(a/s)),a<0?a=-1-a:a>=o&&(a=s-1-a),i+=t[a]*u[n];c[r]=i}return c},u.syncOrAsync=function(t,e,r){var n;function a(){return u.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(a).then(void 0,u.promiseError);return r&&r(e)},u.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},u.noneOrAll=function(t,e,r){if(t){var n,a=!1,i=!0;for(n=0;n0?e:0}))},u.fillArray=function(t,e,r,n){if(n=n||u.identity,u.isArrayOrTypedArray(t))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+i+"$2");return s+l},u.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var O=/^\w*$/;u.templateString=function(t,e){var r={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,n){var a;return O.test(n)?a=e[n]:(r[n]=r[n]||u.nestedProperty(e,n).get,a=r[n]()),u.isValidTextValue(a)?a:""}))};var D={max:10,count:0,name:"hovertemplate"};u.hovertemplateString=function(){return P.apply(D,arguments)};var R={max:10,count:0,name:"texttemplate"};u.texttemplateString=function(){return P.apply(R,arguments)};var I=/^[:|\|]/;function P(t,e,r){var i=this,o=arguments;e||(e={});var s={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,l,c){var f,h,d,p;for(d=3;d=48&&o<=57,u=s>=48&&s<=57;if(l&&(n=10*n+o-48),u&&(a=10*a+s-48),!l||!u){if(n!==a)return n-a;if(o!==s)return o-s}}return a-n};var F=2e9;u.seedPseudoRandom=function(){F=2e9},u.pseudoRandom=function(){var t=F;return F=(69069*F+1)%4294967296,Math.abs(F-t)<429496729?u.pseudoRandom():F/4294967296},u.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},a=u.extractOption(t,e,"htx","hovertext");if(u.isValidTextValue(a))return n(a);var i=u.extractOption(t,e,"tx","text");return u.isValidTextValue(i)?n(i):void 0},u.isValidTextValue=function(t){return t||0===t},u.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(u=1):u=0,"translate("+(a-u*(r+o))+","+(i-u*(n+s))+")"+(u<1?"scale("+u+")":"")+(l?"rotate("+l+(e?"":" "+r+" "+n)+")":"")},u.ensureUniformFontSize=function(t,e){var r=u.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":437,"./anchor_utils":442,"./angles":443,"./array":444,"./clean_number":445,"./clear_responsive":447,"./coerce":448,"./dates":449,"./dom":450,"./extend":452,"./filter_unique":453,"./filter_visible":454,"./geometry2d":455,"./identity":458,"./increment":459,"./is_plain_object":461,"./keyed_container":462,"./localize":463,"./loggers":464,"./make_trace_groups":465,"./matrix":466,"./mod":467,"./nested_property":468,"./noop":469,"./notifier":470,"./push_unique":474,"./regex":476,"./relative_attr":477,"./relink_private":478,"./search":479,"./stats":482,"./throttle":485,"./to_log_range":486,d3:86,"d3-time-format":84,"fast-isnumeric":155}],461:[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}},{}],462:[function(t,e,r){"use strict";var n=t("./nested_property"),a=/^\w*$/;e.exports=function(t,e,r,i){var o,s,l;r=r||"name",i=i||"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){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},i.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},i.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":495,"./notifier":470}],465:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var a=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=t.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(t){t[0][i]=n.select(this)})),a}},{d3:86}],466:[function(t,e,r){"use strict";r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],468:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./array").isArrayOrTypedArray;function i(t,e){return function(){var r,n,o,s,l,u=t;for(s=0;s/g),l=0;li||u===a||us)&&(!e||!l(t))}:function(t,e){var l=t[0],u=t[1];if(l===a||li||u===a||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))>a)return!0;return!1},i.filter=function(t,e){var r=[t[0]],n=0,a=0;function o(o){t.push(o);var s=r.length,l=n;r.splice(a+1);for(var u=l+1;u1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":437,"./matrix":466}],473:[function(t,e,r){(function(r){"use strict";var n=t("./show_no_webgl_msg"),a=t("regl");e.exports=function(t,e){var i=t._fullLayout,o=!0;return i._glcanvas.each((function(n){if(!n.regl&&(!n.pick||i._has("parcoords"))){try{n.regl=a({canvas:this,attributes:{antialias:!n.pick,preserveDrawingBuffer:!0},pixelRatio:t._context.plotGlPixelRatio||r.devicePixelRatio,extensions:e||[]})}catch(t){o=!1}n.regl||(o=!1),o&&this.addEventListener("webglcontextlost",(function(e){t&&t.emit&&t.emit("plotly_webglcontextlost",{event:e,layer:n.key})}),!1)}})),o||n({container:i._glcontainer.node()}),o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./show_no_webgl_msg":481,regl:260}],474:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){for(var r=e.toString(),n=0;na.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 c(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 i,o,f=0,h=e.length,d=0,p=h>1?(e[h-1]-e[0])/(h-1):1;for(o=p>=0?r?s:l:r?c:u,t+=1e-9*p*(r?-1:1)*(p>=0?1:-1);f90&&a.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,e){var n,a=(e||{}).unitMinDiff,i=t.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var s=1;a||(s=i[n]-i[0]||1);for(var l,u=s/(n||1)/1e4,c=[],f=0;f<=n;f++){var h=i[f],d=h-l;void 0===l?(c.push(h),l=h):d>u&&(s=Math.min(s,d),c.push(h),l=h)}return{vals:c,minDiff:s}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return t.sort(e)}return n?t:t.reverse()},r.findIndexOfMin=function(t,e){e=e||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(e)||(e=!1),a(i[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":444,"fast-isnumeric":155}],483:[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":63}],484:[function(t,e,r){"use strict";var n=t("d3"),a=t("../lib"),i=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 M=t.text(),S=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&M.match(l),C=n.select(t.node().parentNode);if(!C.empty()){var L=t.attr("class")?t.attr("class").split(" ")[0]:"text";return L+="-math",C.selectAll("svg."+L).remove(),C.selectAll("g."+L+"-group").remove(),t.style("display",null).attr({"data-unformatted":M,"data-math":"N"}),S?(e&&e._promises||[]).push(new Promise((function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),i={fontSize:r};!function(t,e,r){var i,o,s,l;MathJax.Hub.Queue((function(){return o=a.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"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.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())a.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"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==s&&(MathJax.Hub.processSectionDelay=s),MathJax.Hub.Config(o)}))}(S[2],i,(function(n,a,i){C.selectAll("svg."+L).remove(),C.selectAll("g."+L+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return O(),void e();var l=C.append("g").classed(L+"-group",!0).attr({"pointer-events":"none","data-unformatted":M,"data-math":"Y"});l.node().appendChild(o.node()),a&&a.node()&&o.node().insertBefore(a.node().cloneNode(!0),o.node().firstChild),o.attr({class:L,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=t.node().style.fill||"black",c=o.select("g");c.attr({fill:u,stroke:u});var f=s(c,"width"),h=s(c,"height"),d=+t.attr("x")-f*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],p=-(r||s(t,"height"))/4;"y"===L[0]?(l.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-f/2,p-h/2]+")"}),o.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===L[0]?o.attr({x:t.attr("x"),y:p-h/2}):"a"===L[0]&&0!==L.indexOf("atitle")?o.attr({x:0,y:p}):o.attr({x:d,y:+t.attr("y")+p-h/2}),k&&k.call(t,l),e(l)}))}))):O(),t}function O(){C.empty()||(L=t.attr("class")+"-math",C.select("svg."+L).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(g," ");var r,s=!1,l=[],u=-1;function c(){u++;var e=document.createElementNS(i.svg,"tspan");n.select(e).attr({class:"line",dy:u*o+"em"}),t.appendChild(e),r=e;var a=l;if(l=[{node:e}],a.length>1)for(var s=1;s doesnt match end tag <"+t+">. Pretending it did match.",e),r=l[l.length-1].node}else a.log("Ignoring unexpected end tag .",e)}y.test(e)?c():(r=t,l=[{node:t}]);for(var C=e.split(v),L=0;L|>|>)/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=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,m=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var b=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,x=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function A(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&E(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"],a="...".length,i=t.split(v),o=[],s="",l=0,u=0;ua?o.push(c.substr(0,p-a)+"..."):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"},M=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function E(t){return t.replace(M,(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,a,i,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return a="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},i="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:a()-u.top+"px",left:i()-u.left+"px","z-index":1e3}),this}}r.convertEntities=E,r.sanitizeHTML=function(t){t=t.replace(g," ");for(var e=document.createElement("p"),r=e,a=[],i=t.split(v),o=0;oi.ts+e?l():i.timer=setTimeout((function(){l(),i.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)a(n[t]),delete n[t];else for(var e in n)r.clear(e)}},{}],486:[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":155}],487:[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"}}},{}],488:[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"}}},{}],489:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,i=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 i=(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&&i.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 i.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,T,k,M,E=Object.keys(r).map(Number).sort(o),S=e.get(),C=S||[],L=c(m,f).get(),O=[],D=-1,R=C.length;for(b=0;bC.length-(k?0:1))i.warn("index out of range",f,_);else if(void 0!==T)A.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(T)?O.push(_):k?("add"===T&&(T={}),C.splice(_,0,T),L&&L.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,T),-1===D&&(D=_);else for(x=0;x=0;b--)C.splice(O[b],1),L&&L.splice(O[b],1);if(C.length?S||e.set(C):e.set(null),g)return!1;if(h(v,m),p!==a){var I;if(-1===D)I=E;else{for(R=Math.max(C.length,R),I=[],b=0;b=D);b++)I.push(_);for(b=D;b=t.data.length||a<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-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]),R(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&R(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function P(t,e,r,n,i){!function(t,e,r,n){var a=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 i in R(t,r,"indices"),e){if(!Array.isArray(e[i])||e[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==e[i].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 i,l,u,c,f,h=o.isPlainObject(n),d=[];for(var p in Array.isArray(r)||(r=[r]),r=D(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 H(t,e,r){if(t=o.getGraphDiv(t),A.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 a=Z(t,n),i=a.flags;i.calc&&(t.calcdata=void 0);var s=[h.previousPromises];i.layoutReplot?s.push(T.layoutReplot):Object.keys(n).length&&(G(t,i,a)||h.supplyDefaults(t),i.legend&&s.push(T.doLegend),i.layoutstyle&&s.push(T.layoutStyles),i.axrange&&q(s,a.rangesAltered),i.ticks&&s.push(T.doTicksRelayout),i.modebar&&s.push(T.doModeBar),i.camera&&s.push(T.doCamera),i.colorbars&&s.push(T.doColorBars),s.push(S)),s.push(h.rehover,h.redrag),u.add(t,H,[t,a.undoit],H,[t,a.redoit]);var l=o.syncOrAsync(s,t);return l&&l.then||(l=Promise.resolve(t)),l.then((function(){return t.emit("plotly_relayout",a.eventData),t}))}function G(t,e,r){var n=t._fullLayout;if(!e.axrange)return!1;for(var a in e)if("axrange"!==a&&e[a])return!1;for(var i in r.rangesAltered){var o=p.id2name(i),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!==i){var c=n[p.id2name(u)];c.autorange=l.autorange,c.range=l.range.slice(),c._input.range=l.range.slice()}}return!0}function q(t,e){var r=e?function(t){var r=[],n=!0;for(var a in e){var i=p.getFromId(t,a);if(r.push(a),i._matchGroup)for(var o in i._matchGroup)e[o]||r.push(o);i.automargin&&(n=!1)}return p.draw(t,r,{skipTitle:n})}:function(t){return p.draw(t,"redraw")};t.push(x,T.doAutoRangeAndConstraints,r,T.drawData,T.finalDraw)}var W=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,X=/^[xyz]axis[0-9]*\.autorange$/,Y=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function Z(t,e){var r,n,a,i=t.layout,l=t._fullLayout,u=l._guiEditing,h=B(l._preGUI,u),d=Object.keys(e),g=p.list(t),v=o.extendDeepAll({},e),m={};for(V(e),d=Object.keys(e),n=0;n0&&"string"!=typeof R.parts[P];)P--;var F=R.parts[P],z=R.parts[P-1]+"."+F,j=R.parts.slice(0,P).join("."),U=s(t.layout,j).get(),H=s(l,j).get(),G=R.get();if(void 0!==I){T[D]=I,E[D]="reverse"===F?I:N(G);var q=f.getLayoutValObject(l,R.parts);if(q&&q.impliedEdits&&null!==I)for(var Z in q.impliedEdits)S(o.relativeAttr(D,Z),q.impliedEdits[Z]);if(-1!==["width","height"].indexOf(D))if(I){S("autosize",null);var Q="height"===D?"width":"height";S(Q,l[Q])}else l[D]=t._initialAutoSize[D];else if("autosize"===D)S("width",I?null:l.width),S("height",I?null:l.height);else if(z.match(W))O(z),s(l,j+"._inputRange").set(null);else if(z.match(X)){O(z),s(l,j+"._inputRange").set(null);var $=s(l,j).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else z.match(Y)&&s(l,j+"._inputDomain").set(null);if("type"===F){var K=U,tt="linear"===H.type&&"log"===I,et="log"===H.type&&"linear"===I;if(tt||et){if(K&&K.range)if(H.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&&S(j+".autorange",!0),rt<=0?rt=nt/1e6:nt<=0&&(nt=rt/1e6),S(j+".range[0]",Math.log(rt)/Math.LN10),S(j+".range[1]",Math.log(nt)/Math.LN10)):(S(j+".range[0]",Math.pow(10,rt)),S(j+".range[1]",Math.pow(10,nt)))}else S(j+".autorange",!0);Array.isArray(l._subplots.polar)&&l._subplots.polar.length&&l[R.parts[0]]&&"radialaxis"===R.parts[1]&&delete l[R.parts[0]]._subplot.viewInitial["radialaxis.range"],c.getComponentMethod("annotations","convertCoords")(t,H,I,S),c.getComponentMethod("images","convertCoords")(t,H,I,S)}else S(j+".autorange",!0),S(j+".range",null);s(l,j+"._inputRange").set(null)}else if(F.match(M)){var at=s(l,D).get(),it=(I||{}).type;it&&"-"!==it||(it="linear"),c.getComponentMethod("annotations","convertCoords")(t,at,it,S),c.getComponentMethod("images","convertCoords")(t,at,it,S)}var ot=w.containerArrayMatch(D);if(ot){r=ot.array,n=ot.index;var st=ot.property,lt=q||{editType:"calc"};""!==n&&""===st&&(w.isAddVal(I)?E[D]=null:w.isRemoveVal(I)?E[D]=(s(i,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]=I,delete e[D]}else"reverse"===F?(U.range?U.range.reverse():(S(j+".autorange",!0),U.range=[1,0]),H.autorange?_.calc=!0:_.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===D&&("lasso"===I||"select"===I)&&"lasso"!==G&&"select"!==G||l._has("gl2d")?_.plot=!0:q?k.update(_,q):_.calc=!0,R.set(I))}}for(r in m){w.applyContainerArrayChanges(t,h(i,r),m[r],_,h)||(_.plot=!0)}var ct=l._axisConstraintGroups||[];for(C in L)for(n=0;n1;)if(n.pop(),void 0!==(r=s(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(t,e){for(var r=0;r=a.length?a[0]:a[t]:a}function l(t){return Array.isArray(i)?t>=i.length?i[0]:i[t]:i}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(i,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,A.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(a)?v>=a.length?t.transitionOpts=a[v]:t.transitionOpts=a[0]:t.transitionOpts=a,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&&TT)&&k.push(g);y=k}}y.length>0?function(e){if(0!==e.length){for(var a=0;a=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&&E<5&&(E++,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===E&&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(a=d[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;c[a.name="frame "+t._transitionData._counter++];);if(c[a.name]){for(i=0;i=0;r--)n=e[r],i.push({type:"delete",index:n}),s.unshift({type:"insert",index:n,value:a[n]});var l=h.modifyFrames,c=h.modifyFrames,f=[t,s],d=[t,i];return u&&u.add(t,l,f,c,d),h.modifyFrames(t,i)},r.addTraces=function t(e,n,a){e=o.getGraphDiv(e);var i,s,l=[],c=r.deleteTraces,f=t,h=[e,l],d=[e,n];for(function(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!_(o))return!1;t=i[a][o]}else t=i[a]}else t=i}}return t}function _(t){return t===Math.round(t)&&t>=0}function w(){var t,e,r={};for(t in p(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var a=0;a=l.length)return!1;a=(r=(n.transformsRegistry[l[u].type]||{}).attributes)&&r[e[2]],s=3}else if("area"===t.type)a=c[o];else{var f=t._module;if(f||(f=(n.modules[t.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var h=f.basePlotModule;h&&h.attributes&&(a=h.attributes[o])}a||(a=i[o])}return x(a,e,s)},r.getLayoutValObject=function(t,e){return x(function(t,e){var r,a,i,s,l=t._basePlotModules;if(l){var u;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var s,l=e+"["+i+"]";function u(){s={},o&&(s[l]={},s[l].templateitemname=o)}function c(t,e){o?n.nestedProperty(s[l],t).set(e):s[l+"."+t]=e}function f(){var t=s;return u(),t}return u(),{modifyBase:function(t,e){s[t]=e},modifyItem:c,getUpdateObj:f,applyUpdate:function(e,r){e&&c(e,r);var a=f();for(var i in a)n.nestedProperty(t,i).set(a[i])}}}},{"../lib":460,"../plots/attributes":504}],498:[function(t,e,r){"use strict";var n=t("d3"),a=t("../registry"),i=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;function y(t,e,r){for(var n=0;n=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}function b(t){var e,a,s,c,p,g,v=t._fullLayout,m=v._size,b=m.p,_=h.list(t,"",!0);if(v._paperdiv.style({width:t._context.responsive&&v.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":v.width+"px",height:t._context.responsive&&v.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(u.setSize,v.width,v.height),t._context.setBackground(t,v.paper_bgcolor),r.drawMainTitle(t),f.manage(t),!v._has("cartesian"))return i.previousPromises(t);function A(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-b-n:e._offset+e._length+b+n:m.t+m.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+b+n:e._offset-b-n:m.l+m.w*(t.position||0)+n%1}for(e=0;e<_.length;e++){var T=(c=_[e])._anchorAxis;c._linepositions={},c._lw=u.crispRound(t,c.linewidth,1),c._mainLinePosition=A(c,T,c.side),c._mainMirrorPosition=c.mirror&&T?A(c,T,d.OPPOSITE_SIDE[c.side]):null}var k=[],M=[],E=[],S=1===l.opacity(v.paper_bgcolor)&&1===l.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((s=v._plots[a]).mainplot)s.bg&&s.bg.remove(),s.bg=void 0;else{var C=s.xaxis.domain,L=s.yaxis.domain,O=s.plotgroup;if(y(C,L,E)){var D=O.node(),R=s.bg=o.ensureSingle(O,"rect","bg");D.insertBefore(R.node(),D.childNodes[0]),M.push(a)}else O.select("rect.bg").remove(),E.push([C,L]),S||(k.push(a),M.push(a))}var I,P,F,z,N,B,j,U,V,H,G,q,W,X=v._bgLayer.selectAll(".bg").data(k);for(X.enter().append("rect").classed("bg",!0),X.exit().remove(),X.each((function(t){v._plots[t].bg=n.select(this)})),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 i=e[n],o=g(e,n,r);a(i)?(Array.isArray(e)&&!1===i._template&&i.templateitemname&&c.push({code:"missing",path:o,templateitemname:i.templateitemname}),t(i,o)):Array.isArray(i)&&v(i)&&t(i,o)}}({data:d,layout:h},""),c.length)return c.map(m)}},{"../lib":460,"../plots/attributes":504,"../plots/plots":545,"./plot_config":495,"./plot_schema":496,"./plot_template":497}],500:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./plot_api"),i=t("../plots/plots"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg"),c=t("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,h,d,p;function g(t){return!(t in e)||o.validate(e[t],f[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],h=t.layout||{},d=t.config||{},p={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),h=o.extendDeep({},t.layout),d=t._context,p=t._fullLayout||{}),!g("width")&&null!==e.width||!g("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var v={};function m(t,r){return o.coerce(e,v,f,t,r)}var y=m("format"),b=m("width"),x=m("height"),_=m("scale"),w=m("setBackground"),A=m("imageDataOnly"),T=document.createElement("div");T.style.position="absolute",T.style.left="-5000px",document.body.appendChild(T);var k=o.extendFlat({},h);b?k.width=b:null===e.width&&n(p.width)&&(k.width=p.width),x?k.height=x:null===e.height&&n(p.height)&&(k.height=p.height);var M=o.extendFlat({},d,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),E=s.getRedrawFunc(T);function S(){return new Promise((function(t){setTimeout(t,s.getDelay(T._fullLayout))}))}function C(){return new Promise((function(t,e){var r=l(T,y,_),n=T._fullLayout.width,f=T._fullLayout.height;function h(){a.purge(T),document.body.removeChild(T)}if("full-json"===y){var d=i.graphJson(T,!1,"keepdata","object",!0,!0);return d.version=c,d=JSON.stringify(d),h(),t(A?d:s.encodeJSON(d))}if(h(),"svg"===y)return t(A?r:s.encodeSVG(r));var p=document.createElement("canvas");p.id=o.randstr(),u({format:y,width:n,height:f,scale:_,canvas:p,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){a.plot(T,r,k,M).then(E).then(S).then(C).then((function(e){t(function(t){return A?t.replace(s.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":460,"../plots/plots":545,"../snapshot/helpers":557,"../snapshot/svgtoimg":559,"../snapshot/tosvg":561,"../version":666,"./plot_api":494,"fast-isnumeric":155}],501:[function(t,e,r){"use strict";var n=t("../lib"),a=t("../plots/plots"),i=t("./plot_schema"),o=t("./plot_config").dfltConfig,s=n.isPlainObject,l=Array.isArray,u=n.isArrayOrTypedArray;function c(t,e,r,a,i,o){o=o||[];for(var f=Object.keys(t),h=0;hb.length&&a.push(p("unused",i,m.concat(b.length)));var k,M,E,S,C,L=b.length,O=Array.isArray(T);if(O&&(L=Math.min(L,T.length)),2===x.dimensions)for(M=0;Mb[M].length&&a.push(p("unused",i,m.concat(M,b[M].length)));var D=b[M].length;for(k=0;k<(O?Math.min(D,T[M].length):D);k++)E=O?T[M][k]:T,S=y[M][k],C=b[M][k],n.validate(S,E)?C!==S&&C!==+S&&a.push(p("dynamic",i,m.concat(M,k),S,C)):a.push(p("value",i,m.concat(M,k),S))}else a.push(p("array",i,m.concat(M),y[M]));else for(M=0;M1&&d.push(p("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&((x=k-o(v)-o(m))>M?_/x>S&&(y=v,b=m,S=_/x):_/k>S&&(y={val:v.val,pad:0},b={val:m.val,pad:0},S=_/k));if(h===d){var C=h-1,L=h+1;if(A)if(0===h)i=[0,1];else{var O=(h>0?f:c).reduce((function(t,e){return Math.max(t,o(e))}),0),D=h/(1-Math.min(.5,O/k));i=h>0?[0,D]:[D,0]}else i=T?[Math.max(0,C),Math.max(1,L)]:[C,L]}else A?(y.val>=0&&(y={val:0,pad:0}),b.val<=0&&(b={val:0,pad:0})):T&&(y.val-S*o(y)<0&&(y={val:0,pad:0}),b.val<=0&&(b={val:1,pad:0})),S=(b.val-y.val-E(v.val,m.val))/(k-o(y)-o(b)),i=[y.val-S*o(y),b.val+S*o(b)];return p&&i.reverse(),a.simpleMap(i,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,a,i=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}a(e,u.val)&&u.pad<=r&&(o||!u.extrapad)&&(t.splice(l,1),l--)}if(s){var c=i&&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=a.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 i=e._anchorAxis;if(i&&i.rangeslider){var l=i.rangeslider[e._name];l&&"auto"===l.rangemode&&(l.range=s(t,e)),i._input.rangeslider[e._name]=a.extendFlat({},l)}},findExtremes:function(t,e,r){r||(r={});t._m||t.setScale();var a,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,T=r.vpadLinearized||!1;function k(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 M=k((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),E=k((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=k(r.vpadplus||r.vpad),C=k(r.vpadminus||r.vpad);if(!A){if(g=1/0,v=-1/0,w)for(a=0;a0&&(g=o),o>v&&o-i&&(g=o),o>v&&o=D;a--)O(a);return{min:m,max:y,opts:r}},concatExtremes:u}},{"../../constants/numerical":437,"../../lib":460,"../../registry":553,"fast-isnumeric":155}],507:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=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.ONEMAXYEAR,v=p.ONEAVGYEAR,m=p.ONEMINYEAR,y=p.ONEMAXQUARTER,b=p.ONEAVGQUARTER,x=p.ONEMINQUARTER,_=p.ONEMAXMONTH,w=p.ONEAVGMONTH,A=p.ONEMINMONTH,T=p.ONEWEEK,k=p.ONEDAY,M=k/2,E=p.ONEHOUR,S=p.ONEMIN,C=p.ONESEC,L=p.MINUS_SIGN,O=p.BADNUM,D=t("../../constants/alignment"),R=D.MID_SHIFT,I=D.CAP_SHIFT,P=D.LINE_SPACING,F=D.OPPOSITE_SIDE,z=e.exports={};z.setConvert=t("./set_convert");var N=t("./axis_autotype"),B=t("./axis_ids");z.id2name=B.id2name,z.name2id=B.name2id,z.cleanId=B.cleanId,z.list=B.list,z.listIds=B.listIds,z.getFromId=B.getFromId,z.getFromTrace=B.getFromTrace;var j=t("./autorange");z.getAutoRange=j.getAutoRange,z.findExtremes=j.findExtremes;function U(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}z.coerceRef=function(t,e,r,n,a,i){var o=n.charAt(n.length-1),l=r._fullLayout._subplots[o+"axis"],u=n+"ref",c={};return a||(a=l[0]||i),i||(i=a),c[u]={valType:"enumerated",values:l.concat(i?[i]:[]),dflt:a},s.coerce(t,e,c,u)},z.coercePosition=function(t,e,r,n,a,i){var o,l;if("paper"===n||"pixel"===n)o=s.ensureNumber,l=r(a,i);else{var u=z.getFromId(e,n);l=r(a,i=u.fraction2r(i)),o=u.cleanPos}t[a]=o(l)},z.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:z.getFromId(e,r).cleanPos)(t)},z.redrawComponents=function(t,e){e=e||z.listIds(t);var r=t._fullLayout;function n(n,a,i,s){for(var l=o.getComponentMethod(n,a),u={},c=0;c2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},z.saveRangeInitial=function(t,e){for(var r=z.list(t,"",!0),n=!1,a=0;a.3*h||c(n)||c(i))){var d=r.dtick/2;t+=t+d.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=z.tickIncrement(t,"M6","reverse")+1.5*k:i.exactMonths>.8?t=z.tickIncrement(t,"M1","reverse")+15.5*k:t-=M;var l=z.tickIncrement(t,r);if(l<=n)return l}return t}(y,t,m,u,i)),v=y,0;v<=c;)v=z.tickIncrement(v,m,!1,i);return{start:e.c2r(y,0,i),end:e.c2r(v,0,i),size:m,_dataSpan:c-u}},z.prepTicks=function(t,e){var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if("auto"===t.tickmode||!t.dtick){var n,a=t.nticks;a||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,a=t._length/n):(n="y"===t._id.charAt(0)?40:80,a=s.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(a*=2)),"array"===t.tickmode&&(a*=100),t._roughDTick=(Math.abs(r[1]-r[0])-(t._lBreaks||0))/a,z.autoTicks(t,t._roughDTick),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),K(t)},z.calcTicks=function(t,e){z.prepTicks(t,e);var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if("array"===t.tickmode)return function(t){var e=t.tickvals,r=t.ticktext,n=new Array(e.length),a=U(s.simpleMap(t.range,t.r2l)),i=Math.min(a[0],a[1]),o=Math.max(a[0],a[1]),l=0;Array.isArray(r)||(r=[]);var u="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 c=0;ci&&f=o:n<=o)&&!(u.length>r||n===e);n=z.tickIncrement(n,t.dtick,l,t.calendar)){e=n;var a=!1;c&&n!==(0|n)&&(a=!0),u.push({minor:a,value:n})}}();var f="period"===t.ticklabelmode;if(f&&u.unshift({minor:!1,value:z.tickIncrement(u[0].value,t.dtick,!l,t.caldendar)}),t.rangebreaks){var h=u.length;if(h){var d=0;"auto"===t.tickmode&&(d=("y"===t._id.charAt(0)?2:6)*(t.tickfont?t.tickfont.size:12));for(var p,S=[],C=l?1:-1,L=l?h-1:0,D=l?0:h-1;C*D<=C*L;D+=C){var R=u[D];if(t.maskBreaks(R.value)!==O||(R.value=mt(R.value,t),!t._rl||t._rl[0]!==R.value&&t._rl[1]!==R.value)){var I=t.c2p(R.value);I===p?S[S.length-1].valued)&&(p=I,S.push(R))}}u=S.reverse()}}vt(t)&&360===Math.abs(r[1]-r[0])&&u.pop(),t._tmax=(u[u.length-1]||{}).value,t._prevDateHead="",t._inCalcTicks=!0;var P,F=Math.min(r[0],r[1]),N=Math.max(r[0],r[1]),B=z.getTickFormat(t);f&&B&&(/%[fLQsSMX]/.test(B)||(/%[HI]/.test(B)?P=E:/%p/.test(B)?P=M:/%[Aadejuwx]/.test(B)?P=k:/%[UVW]/.test(B)?P=T:/%[Bbm]/.test(B)?P=w:/%[q]/.test(B)?P=b:/%[Yy]/.test(B)&&(P=v)));var j,V,H=[];for(j=0;j0?(Z=j-1,J=j):(Z=j,J=j);var Q=H[Z].x,$=H[J].x,K=Math.abs($-Q),et=P||K,rt=0;if(et>=m?rt=K>=m&&K<=g?K:v:P===b&&et>=x?rt=K>=x&&K<=y?K:b:et>=A?rt=K>=A&&K<=_?K:w:P===T&&et>=T?rt=T:et>=k?rt=k:P===M&&et>=M?rt=M:P===E&&et>=E&&(rt=E),rt&&t.rangebreaks){for(var nt=0,at=0,it=0;it<42;it++){var ot=it/42;t.maskBreaks(Q*(1-ot)+$*ot)!==O&&(ot<.5?nt++:at++)}at&&(rt*=(nt+at)/42)}rt<=K&&(Y+=rt/2),H[j].periodX=Y,(Y>N||Y=F){t._prevDateHead="",H[j].text=z.tickText(t,H[j].x).text;break}}return t._inCalcTicks=!1,H};var q=[2,5,10],W=[1,2,3,6,12],X=[1,2,5,10,15,30],Y=[1,2,3,7,14],Z=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],J=[-.301,0,.301,.699,1],Q=[15,30,45,90,180];function $(t,e,r){return e*s.roundUp(t/e,r)}function K(t){var e=t.dtick;if(t._tickexponent=0,a(e)||"string"==typeof e||(e=1),"category"!==t.type&&"multicategory"!==t.type||(t._tickround=null),"date"===t.type){var r=t.r2l(t.tick0),n=t.l2r(r).replace(/(^-|i)/g,""),i=n.length;if("M"===String(e).charAt(0))i>10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=k&&i<=10||e>=15*k)t._tickround="d";else if(e>=S&&i<=16||e>=E)t._tickround="M";else if(e>=C&&i<=19||e>=S)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,o)-20,t._tickround<0&&(t._tickround=4)}}else if(a(e)||"L"===e.charAt(0)){var s=t.range.map(t.r2d||Number);a(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&&(rt(t.exponentformat)&&!nt(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function tt(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}}z.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 i=2*e;if(i>v)e/=v,r=n(10),t.dtick="M"+12*$(e,r,q);else if(i>w)e/=w,t.dtick="M"+$(e,1,W);else if(i>k){t.dtick=$(e,k,t._hasDayOfWeekBreaks?[1,2,7,14]:Y),t.tick0=s.dateTick0(t.calendar,!0);var o=z.getTickFormat(t);if(/%[uVW]/.test(o)){var l=t.tick0.length,u=+t.tick0[l-1];t.tick0=t.tick0.substring(0,l-2)+String(u+1)}}else i>E?t.dtick=$(e,E,W):i>S?t.dtick=$(e,S,X):i>C?t.dtick=$(e,C,X):(r=n(10),t.dtick=$(e,r,q))}else if("log"===t.type){t.tick0=0;var c=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(c[1]-c[0])<1){var f=1.5*Math.abs((c[1]-c[0])/e);e=Math.abs(Math.pow(10,c[1])-Math.pow(10,c[0]))/f,r=n(10),t.dtick="L"+$(e,r,q)}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))):vt(t)?(t.tick0=0,r=1,t.dtick=$(e,r,Q)):(t.tick0=0,r=n(10),t.dtick=$(e,r,q));if(0===t.dtick&&(t.dtick=1),!a(t.dtick)&&"string"!=typeof t.dtick){var h=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(h)}},z.tickIncrement=function(t,e,r,i){var o=r?-1:1;if(a(e))return s.increment(t,o*e);var l=e.charAt(0),u=o*Number(e.substr(1));if("M"===l)return s.incrementMonth(t,u,i);if("L"===l)return Math.log(Math.pow(10,t)+u)/Math.LN10;if("D"===l){var c="D2"===e?J:Z,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)},z.tickFirst=function(t,e){var r=t.r2l||Number,i=s.simpleMap(t.range,r,void 0,void 0,e),o=i[1]"+l,t._prevDateHead=l));e.text=u}(t,o,r,u):"log"===c?function(t,e,r,n,i){var o=t.dtick,l=e.x,u=t.tickformat,c="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==c&&(o="L3",c="L");if(u||"L"===c)e.text=at(Math.pow(10,l),t,i,n);else if(a(o)||"D"===c&&s.mod(l+.01,1)<.1){var f=Math.round(l),h=Math.abs(f),d=t.exponentformat;"power"===d||rt(d)&&nt(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":L)+h+"",e.fontSize*=1.25):("e"===d||"E"===d)&&h>2?e.text="1"+d+(f>0?"+":L)+h:(e.text=at(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,o,0,u,g):"category"===c?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===c?function(t,e,r){var n=Math.round(e.x),a=t._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?e.text=o+" - "+i:(e.text=i,e.text2=o)}(t,o,r):vt(t)?function(t,e,r,n,a){if("radians"!==t.thetaunit||r)e.text=at(e.x,t,a,n);else{var i=e.x/180;if(0===i)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){for(var r=1;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,a=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)e.text=at(s.deg2rad(e.x),t,a,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=L+e.text)}}}}(t,o,r,u,g):function(t,e,r,n,a){"never"===a?a="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide");e.text=at(e.x,t,a,n)}(t,o,0,u,g),n||(t.tickprefix&&!p(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!p(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var v=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[v(o.x-.5),v(o.x+t.dtick-.5)]}return o},z.hoverLabelText=function(t,e,r){if(r!==O&&r!==e)return z.hoverLabelText(t,e)+" - "+z.hoverLabelText(t,r);var n="log"===t.type&&e<=0,a=z.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":L+a:a};var et=["f","p","n","\u03bc","m","","k","M","G","T"];function rt(t){return"SI"===t||"B"===t}function nt(t){return t>14||t<-15}function at(t,e,r,n){var i=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=z.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,dtick:"none"===e.showexponent?e.dtick:a(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};K(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,L);var d,p=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))"+d+"":"B"===l&&9===u?t+="B":rt(l)&&(t+=et[u/3+5]));return i?L+t:t}function it(t,e){for(var r=[],n={},a=0;a1&&r=a.min&&t=0,i=c(t,e[1])<=0;return(r||a)&&(n||i)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=o(a)))){r=n;break}break;case"log":for(e=0;e0?r.bottom-c:0,f)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var d=[0,1];if("x"===p){if("b"===l?n[l]=e._depth:(n[l]=e._depth=Math.max(r.width>0?c-r.top:0,f),d.reverse()),r.width>0){var v=r.right-(e._offset+e._length);v>0&&(n.xr=1,n.r=v);var m=e._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===l?n[l]=e._depth=Math.max(r.height>0?c-r.left:0,f):(n[l]=e._depth=Math.max(r.height>0?r.right-c:0,f),d.reverse()),r.height>0){var y=r.bottom-(e._offset+e._length);y>0&&(n.yb=0,n.b=y);var b=e._offset-r.top;b>0&&(n.yt=1,n.t=b)}n[g]="free"===e.anchor?e.position:e._anchorAxis.domain[d[0]],e.title.text!==h._dfltTitle[p]&&(n[l]+=st(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[u]=e.linewidth,e.mirror&&!0!==e.mirror&&(a[u]+=f),!0===e.mirror||"ticks"===e.mirror?a[g]=e._anchorAxis.domain[d[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(a[g]=[e._counterDomainMin,e._counterDomainMax][d[1]]))}Z&&(s=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),i.autoMargin(t,ct(e),n),i.autoMargin(t,ft(e),a),i.autoMargin(t,ht(e),s)})),r.skipTitle||Z&&"bottom"===e.side||X.push((function(){return function(t,e){var r,n=t._fullLayout,a=e._id,i=a.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+st(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===i?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var s,l,c,h,d=z.getPxPosition(t,e);"x"===i?(l=e._offset+e._length/2,c="top"===e.side?d-r:d+r):(c=e._offset+e._length/2,l="right"===e.side?d+r:d-r,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}e.title.hasOwnProperty("standoff")&&(h.pad=0)}return u.draw(t,a+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[i],avoid:h,transform:s,attributes:{x:l,y:c,"text-anchor":"middle"}})}(t,e)})),s.syncOrAsync(X)}}function J(t){var r=d+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,a,i;t._selections[e].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,t._selections[e].each((function(){var t=ut(this),e=f.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),a=Math.min(a,e.left),i=Math.max(i,e.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(e,r)),w[r]}},z.getTickSigns=function(t){var e=t._id.charAt(0),r={x:"top",y:"right"}[e],n=t.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==t.ticks==("x"===e)&&(a=a.map((function(t){return-t}))),t.side&&a.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),a},z.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))+")"}},z.makeTransPeriodFn=function(t){var e=t._id.charAt(0),r=t._offset;return"x"===e?function(e){return"translate("+(r+t.l2p(e.periodX))+",0)"}:function(e){return"translate(0,"+(r+t.l2p(e.periodX))+")"}},z.makeTickPath=function(t,e,r,n){n=void 0!==n?n:t.ticklen;var a=t._id.charAt(0),i=(t.linewidth||1)/2;return"x"===a?"M0,"+(e+i*r)+"v"+n*r:"M"+(e+i*r)+",0h"+n*r},z.makeLabelFns=function(t,e,r){var n=t._id.charAt(0),i="boundaries"!==t.tickson&&"outside"===t.ticks,o=0,l=0;if(i&&(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&&(i||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 a(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*R},p.anchorFn=function(e,r){return a(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},z.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",a=r.vals;"period"===e.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(e.ticks?a:[],ot);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)},z.drawGrid=function(t,e,r){r=r||{};var n=e._id+"grid",a=r.vals,i=r.counterAxis;if(!1===e.showgrid)a=[];else if(i&&z.shouldShowZeroLine(t,e,i))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;e=2){var l,u,c="";if(2===o.length)for(l=0;l<2;l++)if(u=y(o[l])){c=p;break}var f=a("pattern",c);if(f===p)for(l=0;l<2;l++)(u=y(o[l]))&&(e.bounds[l]=o[l]=u-1);if(f)for(l=0;l<2;l++)switch(u=o[l],f){case p:if(!n(u))return void(e.enabled=!1);if((u=+u)!==Math.floor(u)||u<0||u>=7)return void(e.enabled=!1);e.bounds[l]=o[l]=u;break;case g:if(!n(u))return void(e.enabled=!1);if((u=+u)<0||u>24)return void(e.enabled=!1);e.bounds[l]=o[l]=u}if(!1===r.autorange){var h=r.range;if(h[0]h[1])return void(e.enabled=!1)}else if(o[0]>h[0]&&o[1]n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.getAxisGroup=function(t,e){for(var r=t._axisMatchGroups,n=0;n0;o&&(a="array");var s,l=r("categoryorder",a);"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,a,i=e.dataAttr||t._id.charAt(0),o={};if(e.axData)r=e.axData;else for(r=[],n=0;nl*b)||A)for(r=0;rR&&FO&&(O=F);d/=(O-L)/(2*D),L=u.l2r(L),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,a){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",a+"Z")}function N(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 B(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),j(t,e,a,i)}function j(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 U(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function V(t){L&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),L=!1)}function H(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,C)/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 G(t,e,r,n){for(var a,i,o,l,u=!1,c={},f={},h=0;h=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(U(a),2!==t||pt||Ut(),dt)i.indexOf("select")>-1&&k(r,a,Z,J,e.id,St),i.indexOf("event")>-1&&f.click(a,r,e.id);else if(1===t&&pt){var s=g?j:O,u="s"===g||"w"===L?0:1,c=s._name+".range["+u+"]",h=function(t,e){var r,a=t.range[e],i=Math.abs(a-t.range[1-e]);return"date"===t.type?a:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(s,u),d="left",p="middle";if(s.fixedrange)return;g?(p="n"===g?"top":"bottom","right"===s.side&&(d="right")):"e"===L&&(d="right"),a._context.showAxisRangeEntryBoxes&&n.select(mt).call(l.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(h),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:d,verticalAlign:p}).on("edit",(function(t){var e=s.d2r(t);void 0!==e&&o.call("_guiRelayout",a,c,e)}))}}}function Ot(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,e+yt)),a=Math.max(0,Math.min(tt,r+bt)),i=Math.abs(n-yt),o=Math.abs(a-bt);function s(){Tt="",xt.r=xt.l,xt.t=xt.b,Mt.attr("d","M0,0Z")}if(xt.l=Math.min(yt,n),xt.r=Math.max(yt,n),xt.t=Math.min(bt,a),xt.b=Math.max(bt,a),et.isSubplotConstrained)i>C||o>C?(Tt="xy",i/K>o/tt?(o=i*tt/K,bt>a?xt.t=bt-o:xt.b=bt+o):(i=o*K/tt,yt>n?xt.l=yt-i:xt.r=yt+i),Mt.attr("d",H(xt))):s();else if(rt.isSubplotConstrained)if(i>C||o>C){Tt="xy";var l=Math.min(xt.l/K,(tt-xt.b)/tt),u=Math.max(xt.r/K,(tt-xt.t)/tt);xt.l=l*K,xt.r=u*K,xt.b=(1-l)*tt,xt.t=(1-u)*tt,Mt.attr("d",H(xt))}else s();else!at||og[1]-1/4096&&(e.domain=s),a.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":460,"fast-isnumeric":155}],525:[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 a=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(i+(a[0]-i)*e),t.l2r(i+(a[1]-i)*e)]}},{"../../constants/alignment":433}],526:[function(t,e,r){"use strict";var n=t("polybooljs"),a=t("../../registry"),i=t("../../components/drawing").dashStyle,o=t("../../components/color"),s=t("../../components/fx"),l=t("../../components/fx/helpers").makeEventData,u=t("../../components/dragelement/helpers"),c=u.freeMode,f=u.rectMode,h=u.drawMode,d=u.openMode,p=u.selectMode,g=t("../../components/shapes/draw_newshape/display_outlines"),v=t("../../components/shapes/draw_newshape/helpers").handleEllipse,m=t("../../components/shapes/draw_newshape/newshapes"),y=t("../../lib"),b=t("../../lib/polygon"),x=t("../../lib/throttle"),_=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),A=t("../../plot_api/subroutines").redrawReglTraces,T=t("./constants"),k=T.MINSELECT,M=b.filter,E=b.tester,S=t("./handle_outline").clearSelect,C=t("./helpers"),L=C.p2r,O=C.axValue,D=C.getTransform;function R(t,e,r,n,a,i,o){var s,l,u,c,f,h,p,v,m,y=e._hoverdata,b=e._fullLayout.clickmode.indexOf("event")>-1,x=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(y)){z(t,e,i);var _=function(t,e){var r,n,a=t[0],i=-1,o=[];for(n=0;n0?function(t,e){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===e.searchInfo&&(n=e.searchInfo.cd[0].trace).selectedpoints.length===e.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(s)&&(h=j(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),h(e)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,t);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function B(t,e,r,n){var a,i,o,s=[],l=e.map((function(t){return t._id})),u=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(a)>-1}function U(t,e,r){var n,i,o,s;for(n=0;n=0)X._fullLayout._deactivateShape(X);else if(!j){var r=Y.clickmode;x.done(ht).then((function(){if(x.clear(ht),2===t){for(lt.remove(),w=0;w-1&&R(e,X,a.xaxes,a.yaxes,a.subplot,a,lt),"event"===r&&X.emit("plotly_selected",void 0);s.click(X,e)})).catch(y.error)}},a.doneFn=function(){ft.remove(),x.done(ht).then((function(){x.clear(ht),a.gd.emit("plotly_selected",S),_&&a.selectionDefs&&(_.subtract=st,a.selectionDefs.push(_),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,b)),a.doneFnCompleted&&a.doneFnCompleted(dt)})).catch(y.error),j&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:R}},{"../../components/color":331,"../../components/dragelement/helpers":349,"../../components/drawing":353,"../../components/fx":371,"../../components/fx/helpers":367,"../../components/shapes/draw_newshape/display_outlines":416,"../../components/shapes/draw_newshape/helpers":417,"../../components/shapes/draw_newshape/newshapes":418,"../../lib":460,"../../lib/clear_gl_canvases":446,"../../lib/polygon":472,"../../lib/throttle":485,"../../plot_api/subroutines":498,"../../registry":553,"./axis_ids":510,"./constants":513,"./handle_outline":517,"./helpers":518,polybooljs:242}],527:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,u=o.dateTime2ms,c=o.ensureNumber,f=o.isArrayOrTypedArray,h=t("../../constants/numerical"),d=h.FP_SAFE,p=h.BADNUM,g=h.LOG_CLIP,v=h.ONEWEEK,m=h.ONEDAY,y=h.ONEHOUR,b=h.ONEMIN,x=h.ONESEC,_=t("./axis_ids"),w=t("./constants"),A=w.HOUR_PATTERN,T=w.WEEKDAY_PATTERN;function k(t){return Math.pow(10,t)}function M(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",h=r.charAt(0);function E(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],a=t.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return p}function S(e,r,n,a){if((a||{}).msUTC&&i(e))return+e;var s=u(e,n||t.calendar);if(s===p){if(!i(e))return p;e=+e;var l=Math.floor(10*o.mod(e+.05,1)),c=Math.round(e-l/10);s=u(new Date(c))+l/10}return s}function C(e,r,n){return l(e,r,n||t.calendar)}function L(e){return t._categories[Math.round(e)]}function O(e){if(M(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return p}function D(e){if(t._categoriesMap)return t._categoriesMap[e]}function R(t){var e=D(t);return void 0!==e?e:i(t)?+t:void 0}function I(t,e,r){return n.round(r+e*t,2)}function P(t,e,r){return(t-r)/e}var F=function(e){return i(e)?I(e,t._m,t._b):p},z=function(e){return P(e,t._m,t._b)};if(t.rangebreaks){var N="y"===h;F=function(e){if(!i(e))return p;var r=t._rangebreaks.length;if(!r)return I(e,t._m,t._b);var n=N;t.range[0]>t.range[1]&&(n=!n);for(var a=n?-1:1,o=a*e,s=0,l=0;lc)){s=o<(u+c)/2?l:l+1;break}s=l+1}var f=t._B[s]||0;return isFinite(f)?I(e,t._m2,f):0},z=function(e){var r=t._rangebreaks.length;if(!r)return P(e,t._m,t._b);for(var n=0,a=0;at._rangebreaks[a].pmax&&(n=a+1);return P(e,t._m2,t._B[n])}}t.c2l="log"===t.type?E:c,t.l2c="log"===t.type?k:c,t.l2p=F,t.p2l=z,t.c2p="log"===t.type?function(t,e){return F(E(t,e))}:F,t.p2c="log"===t.type?function(t){return k(z(t))}:z,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=z,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return E(s(t),e)},t.r2d=t.r2c=function(t){return k(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=E,t.l2d=k,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return k(z(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=z,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=S,t.c2d=t.c2r=t.l2d=t.l2r=C,t.d2p=t.r2p=function(e,r,n){return t.l2p(S(e,0,n))},t.p2d=t.p2r=function(t,e,r){return C(z(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,p,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=O,t.r2d=t.c2d=t.l2d=L,t.d2r=t.d2l_noadd=R,t.r2c=function(e){var r=R(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=R,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return L(z(t))},t.r2p=t.d2p,t.p2r=z,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=L,t.d2r=t.d2l_noadd=R,t.r2c=function(e){var r=R(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=D,t.l2r=t.c2r=c,t.r2l=R,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return L(z(t))},t.r2p=t.d2p,t.p2r=z,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:c(t)},t.setupMultiCategory=function(n){var a,i,s=t._traceIndices,l=e._axisMatchGroups;if(l&&l.length&&0===t._categories.length)for(a=0;ad&&(s[n]=d),s[0]===s[1]){var u=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=u,s[1]+=u}}else o.nestedProperty(t,e).set(a)},t.setScale=function(r){var n=e._size;if(t.overlaying){var a=_.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var i=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(i);var s,l,u=t.r2l(t[i][0],o),c=t.r2l(t[i][1],o),f="y"===h;if((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/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(u,c),Math.max(u,c)),t._rangebreaks.length)){for(s=0;sc&&(d=!d),d&&t._rangebreaks.reverse();var p=d?-1:1;for(t._m2=p*t._length/(Math.abs(c-u)-t._lBreaks),t._B.push(-t._m2*(f?c:u)),s=0;sa&&(a+=7,ia&&(a+=24,i=n&&i=n&&e=s.min&&(ts.max&&(s.max=n),a=!1)}a&&u.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function v(e,r){var n=e.plotinfo,a=n.xaxis,l=n.yaxis,u=a._length,c=l._length,f=!!e.xr1,h=!!e.yr1,d=[];if(f){var p=i.simpleMap(e.xr0,a.r2l),g=i.simpleMap(e.xr1,a.r2l),v=p[1]-p[0],m=g[1]-g[0];d[0]=(p[0]*(1-r)+r*g[0]-p[0])/(p[1]-p[0])*u,d[2]=u*(1-r+r*m/v),a.range[0]=a.l2r(p[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(p[1]*(1-r)+r*g[1])}else d[0]=0,d[2]=u;if(h){var y=i.simpleMap(e.yr0,l.r2l),b=i.simpleMap(e.yr1,l.r2l),x=y[1]-y[0],_=b[1]-b[0];d[1]=(y[1]*(1-r)+r*b[1]-y[1])/(y[0]-y[1])*c,d[3]=c*(1-r+r*_/x),l.range[0]=a.l2r(y[0]*(1-r)+r*b[0]),l.range[1]=l.l2r(y[1]*(1-r)+r*b[1])}else d[1]=0,d[3]=c;s.drawOne(t,a,{skipTitle:!0}),s.drawOne(t,l,{skipTitle:!0}),s.redrawComponents(t,[a._id,l._id]);var w=f?u/d[2]:1,A=h?c/d[3]:1,T=f?d[0]:0,k=h?d[1]:0,M=f?d[0]/d[2]*u:0,E=h?d[1]/d[3]*c:0,S=a._offset-M,C=l._offset-E;n.clipRect.call(o.setTranslate,T,k).call(o.setScale,1/w,1/A),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,A),o.setPointGroupScale(n.zoomScalePts,1/w,1/A),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/A)}s.redrawComponents(t)}},{"../../components/drawing":353,"../../lib":460,"../../registry":553,"./axes":507,d3:86}],532:[function(t,e,r){"use strict";var n=t("../../registry").traceIs,a=t("./axis_autotype");function i(t){return{v:"x",h:"y"}[t.orientation||"v"]}function o(t,e){var r=i(t),a=n(t,"box-violin"),o=n(t._fullInput||{},"candlestick");return a&&!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,s=t._id,l=s.charAt(0);-1!==s.indexOf("scene")&&(s=l);var u=function(t,e,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[e])return a;if((a[r+"axis"]||r)===e){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(e,s,l);if(!u)return;if("histogram"===u.type&&l==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=l+"calendar",f=u[c],h={noMultiCategory:!n(u,"cartesian")||n(u,"noMultiCategory")};"box"===u.type&&u._hasPreCompStats&&l==={h:"x",v:"y"}[u.orientation||"v"]&&(h.noMultiCategory=!0);if(o(u,l)){var d=i(u),p=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?l(o,e,s,n+1):e(s,i,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){i(t,u,s.cache),s.check=function(){if(l){var e=i(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(s)?(u.boxEnd[1]=u.boxStart[1]+Math.abs(i)*_*(s>=0?1:-1),u.boxEnd[1]l[3]&&(u.boxEnd[1]=l[3],u.boxEnd[0]=u.boxStart[0]+(l[3]-u.boxStart[1])/Math.abs(_))):(u.boxEnd[0]=u.boxStart[0]+Math.abs(s)/_*(i>=0?1:-1),u.boxEnd[0]l[2]&&(u.boxEnd[0]=l[2],u.boxEnd[1]=u.boxStart[1]+(l[2]-u.boxStart[0])*Math.abs(_)))}}else u.boxEnabled?(i=u.boxStart[0]!==u.boxEnd[0],s=u.boxStart[1]!==u.boxEnd[1],i||s?(i&&(v(0,u.boxStart[0],u.boxEnd[0]),t.xaxis.autorange=!1),s&&(v(1,u.boxStart[1],u.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),u.boxEnabled=!1,u.boxInited=!1):u.boxInited&&(u.boxInited=!1);break;case"pan":u.boxEnabled=!1,u.boxInited=!1,e?(u.panning||(u.dragStart[0]=n,u.dragStart[1]=a),Math.abs(u.dragStart[0]-n)=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),l=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(){b.sendDataToCloud(t)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(t,o),s.text(o.text()&&l.text()?" - ":"")}},b.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var r=n.select(t).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=b.graphJson(t,!1,"keepdata"),a.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],A=["year","month","dayMonth","dayMonthYear"];function T(t,e){var r=t._context.locale,n=!1,a={};function i(t){for(var r=!0,i=0;i1&&I.length>1){for(o.getComponentMethod("grid","sizeDefaults")(c,l),s=0;s15&&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"),b.linkSubplots(h,l,f,i),b.cleanPlot(h,l,f,i);var B=!(!i._has||!i._has("gl2d")),j=!(!l._has||!l._has("gl2d")),U=!(!i._has||!i._has("cartesian"))||B,V=!(!l._has||!l._has("cartesian"))||j;U&&!V?i._bgLayer.remove():V&&!U&&(l._shouldCreateBgLayer=!0),i._zoomlayer&&!t._dragging&&d({_fullLayout:i}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var a=0;a0){var f=1-2*s;n=Math.round(f*n),a=Math.round(f*a)}}var h=b.layoutAttributes.width.min,d=b.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}),b.sanitizeMargins(r)},b.supplyLayoutModuleDefaults=function(t,e,r,n){var a,i,s,l=o.componentsRegistry,c=e._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in l)(s=l[a]).includeBasePlot&&s.includeBasePlot(t,e);for(var h in c.length||c.push(f),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(u.subplotSort);for(i=0;i.5*n.width&&(u.log("Margin push",e,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(u.log("Margin push",e,"is too big in y, dropping"),r.b=r.t=0);var l=void 0!==r.xl?r.xl:r.x,c=void 0!==r.xr?r.xr:r.x,f=void 0!==r.yt?r.yt:r.y,h=void 0!==r.yb?r.yb:r.y;a[e]={l:{val:l,size:r.l+o},r:{val:c,size:r.r+o},b:{val:h,size:r.b+o},t:{val:f,size:r.t+o}},i[e]=1}else delete a[e],delete i[e];if(!n._replotting)return b.doAutoMargin(t)}},b.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),C(e);var r=e._size,n=e.margin,a=u.extendFlat({},r),s=n.l,l=n.r,c=n.t,f=n.b,h=e.width,d=e.height,p=e._pushmargin,g=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var v in p)g[v]||delete p[v];for(var m in p.base={l:{val:0,size:s},r:{val:1,size:l},t:{val:1,size:c},b:{val:0,size:f}},p){var y=p[m].l||{},x=p[m].b||{},_=y.val,w=y.size,A=x.val,T=x.size;for(var k in p){if(i(w)&&p[k].r){var M=p[k].r.val,E=p[k].r.size;if(M>_){var S=(w*M+(E-h)*_)/(M-_),L=(E*(1-_)+(w-h)*(1-M))/(M-_);S>=0&&L>=0&&h-(S+L)>0&&S+L>s+l&&(s=S,l=L)}}if(i(T)&&p[k].t){var O=p[k].t.val,D=p[k].t.size;if(O>A){var R=(T*O+(D-d)*A)/(O-A),I=(D*(1-A)+(T-d)*(1-O))/(O-A);R>=0&&I>=0&&d-(I+R)>0&&R+I>f+c&&(f=R,c=I)}}}}}if(r.l=Math.round(s),r.r=Math.round(l),r.t=Math.round(c),r.b=Math.round(f),r.p=Math.round(n.pad),r.w=Math.round(h)-r.l-r.r,r.h=Math.round(d)-r.t-r.b,!e._replotting&&b.didMarginChange(a,r)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var P=3*(1+Object.keys(g).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var i=0,s=0;function l(){return i++,function(){s++,n||s!==i||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(a)}}r.runFn(l),setTimeout(l())}))}],i=u.syncOrAsync(a,t);return i&&i.then||(i=Promise.resolve()),i.then((function(){return t}))}b.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},b.graphJson=function(t,e,r,n,a,i){(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&b.supplyDefaults(t);var o=a?t._fullData:t.data,s=a?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function c(t,e){if("function"==typeof t)return e?"_function_":null;if(u.isPlainObject(t)){var n,a={};return Object.keys(t).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof t[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0&&!u.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0)return;a[i]=c(t[i],e)}else e&&(a[i]="_function")})),a}return Array.isArray(t)?t.map((function(t){return c(t,e)})):u.isTypedArray(t)?u.simpleMap(t,u.identity):u.isJSDate(t)?u.ms2DateTimeLocal(+t):t}var f={data:(o||[]).map((function(t){var r=c(t);return e&&delete r.fit,r}))};return e||(f.layout=c(s)),t.framework&&t.framework.isPolar&&(f=t.framework.getConfig()),l&&(f.frames=c(l)),i&&(f.config=c(t._context,!0)),"object"===n?f:JSON.stringify(f)},b.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;i--)if(s[i].enabled){r._indexToPoints=s[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,p[e]=o}}for(R(l,c,d),a=0;a=0?h.angularAxis.domain:n.extent(A),S=Math.abs(A[1]-A[0]);k&&!T&&(S=0);var C=E.slice();M&&T&&(C[1]+=S);var L=h.angularAxis.ticksCount||4;L>8&&(L=L/(L/8)+L%8),h.angularAxis.ticksStep&&(L=(C[1]-C[0])/L);var O=h.angularAxis.ticksStep||(C[1]-C[0])/(L*(h.minorTicks+1));w&&(O=Math.max(Math.round(O),1)),C[2]||(C[2]=O);var D=n.range.apply(this,C);if(D=D.map((function(t,e){return parseFloat(t.toPrecision(12))})),s=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=M?S:0,"undefined"==typeof(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 P,F=t.select(".chart-group"),z={fill:"none",stroke:h.tickColor},N={"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){P=t.select(".legend-group").attr({transform:"translate("+[b,h.margin.top]+")"}).style({display:"block"});var B=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:a({},o.Legend.defaultConfig().legendConfig,{container:P,elements:B,reverseOrder:h.legend.reverseOrder})})();var j=P.node().getBBox();b=Math.min(h.width-j.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(),P.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else P=t.select(".legend-group").style({display:"none"});t.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(h.width-(h.margin.left+h.margin.right+2*b+(j?j.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(N).text(h.title.text),H=V.node().getBBox();V.attr({x:_[0]-H.width/2,y:_[1]-b-20})}var G=t.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var q=G.selectAll("circle.grid-circle").data(r.ticks(5));q.enter().append("circle").attr({class:"grid-circle"}).style(z),q.attr("r",r),q.exit().remove()}G.select("circle.outside-circle").attr({r:b}).style(z);var W=t.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});function X(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var Y=n.svg.axis().scale(r).ticks(5).tickSize(5);G.call(Y).attr({transform:"rotate("+h.radialAxis.orientation+")"}),G.selectAll(".domain").style(z),G.selectAll("g>text").text((function(t,e){return this.textContent+h.radialAxis.ticksSuffix})).style(N).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,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var Z=t.select(".angular.axis-group").selectAll("g.angular-tick").data(D),J=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+X(t)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Z.exit().remove(),J.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(z),J.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"}),J.append("text").classed("axis-text",!0).style(N);var Q=Z.select("text.axis-text").attr({x:b+h.labelOffset,dy:i+"em",transform:function(t,e){var r=X(t),n=b+h.labelOffset,a=h.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?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(N);h.angularAxis.rewriteTicks&&Q.text((function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)}));var $=n.max(F.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));P.attr({transform:"translate("+[b+$,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 a(o[r].defaultConfig(),t)}));o[r]().config(n)()}))}var at,it,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(!T){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",(function(t,e){var r=o.util.getMousePos(W).angle;ft.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;at=s.invert(n);var a=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(at)).move([a[0]+_[0],a[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"});F.on("mousemove.radial-guide",(function(t,e){var n=o.util.getMousePos(W).radius;ht.attr({r:n}).style({opacity:.5}),it=r.invert(o.util.getMousePos(W).radius);var a=o.util.convertToCartesian(n,h.radialAxis.orientation);ut.text(o.util.round(it)).move([a[0]+_[0],a[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 a=n.select(this),i=this.style.fill,s="black",l=this.style.opacity||1;if(a.attr({"data-opacity":l}),i&&"none"!==i){a.attr({"data-fill":i}),s=n.hsl(i).darker().toString(),a.style({fill:s,opacity:1});var u={t:o.util.round(e[0]),r:o.util.round(e[1])};T&&(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 i=this.style.stroke||"black",a.attr({"data-stroke":i}),s=n.hsl(i).darker().toString(),a.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),a=r.attr("data-fill");a?r.style({fill:a,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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)})),a(l.layout,o.Axis.defaultConfig().layout),a(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 a=e||6,i=[],o=[];n.range(0,360+a,a).forEach((function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)}));var s={t:i,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],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){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,a,i)},"fill-opacity":0,stroke:function(t,e){return p.stroke(r,a,i)},"stroke-width":function(t,e){return p["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return p["stroke-dasharray"](r,a,i)},opacity:function(t,e){return p.opacity(r,a,i)},display:function(t,e){return p.display(r,a,i)}})}};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,a){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,a){return r[t[a].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 i.config=function(e){return arguments.length?(e.forEach((function(e,r){t[r]||(t[r]={}),a(t[r],o.PolyChart.defaultConfig()),a(t[r],e)})),this):t},i.getColorScale=function(){},n.rebind(i,e,"on"),i},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,i=t.data.map((function(t,r){return[].concat(t).map((function(t,n){var i=a({},e.elements[r]);return i.name=t,i.color=[].concat(e.elements[r].color)[n],i}))})),o=n.merge(i);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,a,i,o=t.symbol;return i=3*(a=u),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},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?(a(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,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){var n=(t=i.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var h=i.padding,d=e.node().getBBox(),p={fill:i.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],[i.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 a(i,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=a({},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 i=o.util.duplicates(r.data.map((function(t,e){return t.geometry})));r.data.forEach((function(t,e){var n=i.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)}))}if(t.layout){var s=a({},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":433,"../../../lib":460,d3:86}],550:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../../lib"),i=t("../../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=a.extendDeepAll,u=e.exports={};u.framework=function(t){var e,r,a,i,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,a||(a=o.Axis()),i=o.adapter.plotly().convert(e),a.config(i).render(c),t.data=e.data,t.layout=e.layout,u.fillLayout(t),e}return h.isPolar=!0,h.svg=function(){return a.svg()},h.getConfig=function(){return e},h.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},h.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},h.setUndoPoint=function(){var t,n,a=this,i=o.util.cloneJson(e);t=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(t)}}),r=o.util.cloneJson(i)},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"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=l(o,t.layout)}},{"../../../components/color":331,"../../../lib":460,"./micropolar":549,"./undo_manager":551,d3:86}],551:[function(t,e,r){"use strict";e.exports=function(){var t,e=[],r=-1,n=!1;function a(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n||(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?(a(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(a(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a-1&&(f[d[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(A),A=(A=A.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),a.isIE()&&(A=(A=(A=A.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),A}},{"../components/color":331,"../components/drawing":353,"../constants/xmlns_namespaces":438,"../lib":460,d3:86}],562:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;r2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:n(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),n(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0))}(r,g),"="===v?h=g.showlines=!0:(h=r("contours.showlines"),p=r("fillcolor",o((t.line||{}).color||l,.5))),h)&&(d=r("line.color",p&&s(p)?o(e.fillcolor,1):l),r("line.width",2),r("line.dash"));r("line.smoothing"),a(r,i,d,f)}},{"../../components/color":331,"../../constants/filter_ops":435,"./label_defaults":570,"fast-isnumeric":155}],567:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=n("contours.start"),i=n("contours.end"),o=!1===a||!1===i,s=r("contours.size");!(o?e.autocontour=!0:r("autocontour",!1))&&s||r("ncontours")}},{}],568:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/xyz_defaults"),i=t("./constraint_defaults"),o=t("./contours_defaults"),s=t("./style_defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,a){return n.coerce(t,e,l,r,a)}if(a(t,e,c,u)){c("text"),c("hovertext"),c("hovertemplate"),c("hoverongaps");var f="constraint"===c("contours.type");c("connectgaps",n.isArray1D(e.z)),f?i(t,e,c,u,r):(o(t,e,c,(function(r){return n.coerce2(t,e,l,r)})),s(t,e,c,u))}else e.visible=!1}},{"../../lib":460,"../heatmap/xyz_defaults":584,"./attributes":563,"./constraint_defaults":566,"./contours_defaults":567,"./style_defaults":573}],569:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],570:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){if(a||(a={}),t("contours.showlabels")){var i=e.font;n.coerceFont(t,"contours.labelfont",{family:i.family,size:i.size,color:r}),t("contours.labelformat")}!1!==a.hasHover&&t("zhoverformat")}},{"../../lib":460}],571:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/colorscale"),i=t("./end_plus");e.exports=function(t){var e=t.contours,r=e.start,o=i(e),s=e.size||1,l=Math.floor((o-r)/s)+1,u="lines"===e.coloring?0:1,c=a.extractOpts(t);isFinite(s)||(s=1,l=1);var f,h,d=c.reversescale?a.flipScale(c.colorscale):c.colorscale,p=d.length,g=new Array(p),v=new Array(p);if("heatmap"===e.coloring){var m=c.min,y=c.max;for(h=0;hr.end&&(r.start=r.end=(r.start+r.end)/2),t._input.contours||(t._input.contours={}),a.extendFlat(t._input.contours,{start:r.start,end:r.end,size:r.size}),t._input.autocontour=!0}else if("constraint"!==r.type){var u,c=r.start,f=r.end,h=t._input.contours;if(c>f&&(r.start=h.start=f,f=r.end=h.end=c,c=r.start),!(r.size>0))u=c===f?1:i(c,f,t.ncontours).dtick,h.size=r.size=u}}},{"../../lib":460,"../../plots/cartesian/axes":507}],573:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults"),a=t("./label_defaults");e.exports=function(t,e,r,i,o){var s,l=r("contours.coloring"),u="";"fill"===l&&(s=r("contours.showlines")),!1!==s&&("lines"!==l&&(u=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==l&&(!0!==t.showlegend&&(e.showlegend=!1),e._dfltShowLegend=!1,n(t,e,i,r,{prefix:"",cLetter:"z"})),r("line.smoothing"),a(r,i,u,o)}},{"../../components/colorscale/defaults":341,"./label_defaults":570}],574:[function(t,e,r){"use strict";var n=t("gl-contour2d"),a=t("gl-heatmap2d"),i=t("../../plots/cartesian/axes"),o=t("../contour/make_color_map"),s=t("../../lib/str2rgbarray");function l(t,e){this.scene=t,this.uid=e,this.type="contourgl",this.name="",this.hoverinfo="all",this.xData=[],this.yData=[],this.zData=[],this.textLabels=[],this.idToIndex=[],this.bounds=[0,0,0,0],this.contourOptions={z:new Float32Array(0),x:[],y:[],shape:[0,0],levels:[0],levelColors:[0,0,0,1],lineWidth:1},this.contour=n(t.glplot,this.contourOptions),this.contour._trace=this,this.heatmapOptions={z:new Float32Array(0),x:[],y:[],shape:[0,0],colorLevels:[0],colorValues:[0,0,0,0]},this.heatmap=a(t.glplot,this.heatmapOptions),this.heatmap._trace=this}var u=l.prototype;function c(t,e){for(var r=t.contours,n=r.start,a=r.end,i=r.size||1,l=e.fill,u=o(t),c=Math.floor((a-n)/i)+(l?2:1),f=new Array(c),h=new Array(4*c),d=0;dD){L("x scale is not linear");break}}if(m.length&&"fast"===S){var R=(m[m.length-1]-m[0])/(m.length-1),I=Math.abs(R/100);for(_=0;_I){L("y scale is not linear");break}}}var P=a.maxRowLength(x),F="scaled"===e.xtype?"":r,z=h(e,F,g,v,P,A),N="scaled"===e.ytype?"":m,B=h(e,N,y,b,x.length,T);E||(e._extremes[A._id]=i.findExtremes(A,z),e._extremes[T._id]=i.findExtremes(T,B));var j={x:z,y:B,z:x,text:e._text||e.text,hovertext:e._hovertext||e.hovertext};if(F&&F.length===z.length-1&&(j.xCenter=F),N&&N.length===B.length-1&&(j.yCenter=N),M&&(j.xRanges=w.xRanges,j.yRanges=w.yRanges,j.pts=w.pts),k||s(t,e,{vals:x,cLetter:"z"}),k&&e.contours&&"heatmap"===e.contours.coloring){var U={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};j.xfill=h(U,F,g,v,P,A),j.yfill=h(U,N,y,b,x.length,T)}return[j]}},{"../../components/colorscale/calc":339,"../../constants/numerical":437,"../../lib":460,"../../plots/cartesian/axes":507,"../../registry":553,"../histogram2d/calc":594,"./clean_2d_array":578,"./convert_column_xyz":580,"./find_empties":581,"./interp2d":582,"./make_bound_array":583}],578:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r,o){var s,l,u,c,f,h;function d(t){if(n(t))return+t}if(e&&e.transpose){for(s=0,f=0;f=0;o--)(s=((f[[(r=(i=h[o])[0])-1,a=i[1]]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(l[i]=[r,a,s],h.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(i in l)f[i]=l[i],c.push(l[i])}return c.sort((function(t,e){return e[2]-t[2]}))}},{"../../lib":460}],582:[function(t,e,r){"use strict";var n=t("../../lib"),a=[[-1,0],[1,0],[0,-1],[0,1]];function i(t){return.5-.25*Math.min(1,.5*t)}function o(t,e,r){var n,i,o,s,l,u,c,f,h,d,p,g,v,m=0;for(s=0;sg&&(m=Math.max(m,Math.abs(t[i][o]-p)/(v-g))))}return m}e.exports=function(t,e){var r,a=1;for(o(t,e),r=0;r.01;r++)a=o(t,e,i(a));return a>.01&&n.log("interp2d didn't converge quickly",a),t}},{"../../lib":460}],583:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib").isArrayOrTypedArray;e.exports=function(t,e,r,i,o,s){var l,u,c,f=[],h=n.traceIs(t,"contour"),d=n.traceIs(t,"histogram"),p=n.traceIs(t,"gl2d");if(a(e)&&e.length>1&&!d&&"category"!==s.type){var g=e.length;if(!(g<=o))return h?e.slice(0,o):e.slice(0,o+1);if(h||p)f=e.slice(0,o);else if(1===o)f=[e[0]-.5,e[0]+.5];else{for(f=[1.5*e[0]-.5*e[1]],c=1;c0&&(i=!0);for(var l=0;li){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]u?t>o?t>1.1*a?a:t>1.1*i?i:o:t>s?s:t>l?l:u:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function d(t,e,r,n,i,s){if(n&&t>o){var l=p(e,i,s),u=p(r,i,s),c=t===a?0:1;return l[c]!==u[c]}return Math.floor(r/t)-Math.floor(e/t)>.1}function p(t,e,r){var n=e.c2d(t,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}e.exports=function(t,e,r,n,i){var s,l,u=-1.1*e,h=-.1*e,d=t-h,p=r[0],g=r[1],v=Math.min(f(p+h,p+d,n,i),f(g+h,g+d,n,i)),m=Math.min(f(p+u,p+h,n,i),f(g+u,g+h,n,i));if(v>m&&mo){var y=s===a?1:6,b=s===a?"M12":"M1";return function(e,r){var o=n.c2d(e,a,i),s=o.indexOf("-",y);s>0&&(o=o.substr(0,s));var u=n.d2c(o,0,i);if(ur.r2l(N)&&(j=o.tickIncrement(j,x.size,!0,d)),I.start=r.l2r(j),z||a.nestedProperty(e,m+".start").set(I.start)}var U=x.end,V=r.r2l(R.end),H=void 0!==V;if((x.endFound||H)&&V!==r.r2l(U)){var G=H?V:a.aggNums(Math.max,null,p);I.end=r.l2r(G),H||a.nestedProperty(e,m+".start").set(I.end)}var q="autobin"+s;return!1===e._input[q]&&(e._input[m]=a.extendFlat({},e[m]||{}),delete e._input[q],delete e[q]),[I,p]}e.exports={calc:function(t,e){var r,i,d,p,g=[],v=[],m=o.getFromId(t,"h"===e.orientation?e.yaxis:e.xaxis),y="h"===e.orientation?"y":"x",b={x:"y",y:"x"}[y],x=e[y+"calendar"],_=e.cumulative,w=h(t,e,m,y),A=w[0],T=w[1],k="string"==typeof A.size,M=[],E=k?M:A,S=[],C=[],L=[],O=0,D=e.histnorm,R=e.histfunc,I=-1!==D.indexOf("density");_.enabled&&I&&(D=D.replace(/ ?density$/,""),I=!1);var P,F="max"===R||"min"===R?null:0,z=l.count,N=u[D],B=!1,j=function(t){return m.r2c(t,0,x)};for(a.isArrayOrTypedArray(e[b])&&"count"!==R&&(P=e[b],B="avg"===R,z=l[R]),r=j(A.start),d=j(A.end)+(r-o.tickIncrement(r,A.size,!1,x))/1e6;r=0&&p=0;n--)s(n);else if("increasing"===e){for(n=1;n=0;n--)t[n]+=t[n+1];"exclude"===r&&(t.push(0),t.shift())}}(v,_.direction,_.currentbin);var J=Math.min(g.length,v.length),Q=[],$=0,K=J-1;for(r=0;r=$;r--)if(v[r]){K=r;break}for(r=$;r<=K;r++)if(n(g[r])&&n(v[r])){var tt={p:g[r],s:v[r],b:0};_.enabled||(tt.pts=L[r],q?tt.ph0=tt.ph1=L[r].length?T[L[r][0]]:g[r]:(e._computePh=!0,tt.ph0=H(M[r]),tt.ph1=H(M[r+1],!0))),Q.push(tt)}return 1===Q.length&&(Q[0].width1=o.tickIncrement(Q[0].p,A.size,!1,x)-Q[0].p),s(Q,e),a.isArrayOrTypedArray(e.selectedpoints)&&a.tagSelected(Q,e,Y),Q},calcAllAutoBins:h}},{"../../lib":460,"../../plots/cartesian/axes":507,"../../registry":553,"../bar/arrays_to_calcdata":562,"./average":589,"./bin_functions":590,"./bin_label_vals":591,"./norm_functions":593,"fast-isnumeric":155}],593:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;aE&&A.splice(E,A.length-E),M.length>E&&M.splice(E,M.length-E);var S=[],C=[],L=[],O="string"==typeof w.size,D="string"==typeof k.size,R=[],I=[],P=O?R:w,F=D?I:k,z=0,N=[],B=[],j=e.histnorm,U=e.histfunc,V=-1!==j.indexOf("density"),H="max"===U||"min"===U?null:0,G=i.count,q=o[j],W=!1,X=[],Y=[],Z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";Z&&"count"!==U&&(W="avg"===U,G=i[U]);var J=w.size,Q=b(w.start),$=b(w.end)+(Q-a.tickIncrement(Q,J,!1,m))/1e6;for(r=Q;r<$;r=a.tickIncrement(r,J,!1,m))C.push(H),R.push(r),W&&L.push(0);R.push(r);var K,tt=C.length,et=(r-Q)/tt,rt=(K=Q+et/2,g.c2r(K,0,m)),nt=k.size,at=x(k.start),it=x(k.end)+(at-a.tickIncrement(at,nt,!1,y))/1e6;for(r=at;r=0&&d=0&&p=e[r][0]&&t<=e[r][1])return!0;return!1}(r,n))return r;var a=t?-1:1,i=0,o=e.length-1;if(a<0){var s=i;i=o,o=s}for(var l=e[i],c=l,h=i;a*he){h=r;break}}if(i=c,isNaN(i)&&(i=isNaN(f)||isNaN(h)?isNaN(f)?h:f:e-u[f][1]t[1]+r||e=.9*t[1]+.1*t[0]?"n":e<=.9*t[0]+.1*t[1]?"s":"ns"}(p,e);g&&(o.interval=l[i],o.intervalPix=p,o.region=g)}}if(t.ordinal&&!o.region){var m=t.unitTickvals,y=t.unitToPaddedPx.invert(e);for(r=0;r=b[0]&&y<=b[1]){o.clickableOrdinalRange=b;break}}}return o}function _(t,e){a.event.sourceEvent.stopPropagation();var r=e.height-a.mouse(t)[1]-2*n.verticalPadding,i=e.brush.svgBrush;i.wasDragged=!0,i._dragging=!0,i.grabbingBar?i.newExtent=[r-i.grabPoint,r+i.barLength-i.grabPoint].map(e.unitToPaddedPx.invert):i.newExtent=[i.startExtent,e.unitToPaddedPx.invert(r)].sort(s),e.brush.filterSpecified=!0,i.extent=i.stayingIntervals.concat([i.newExtent]),i.brushCallback(e),b(t.parentNode)}function w(t,e){var r=x(e,e.height-a.mouse(t)[1]-2*n.verticalPadding),i="crosshair";r.clickableOrdinalRange?i="pointer":r.region&&(i=r.region+"-resize"),a.select(document.body).style("cursor",i)}function A(t){t.on("mousemove",(function(t){a.event.preventDefault(),t.parent.inBrushDrag||w(this,t)})).on("mouseleave",(function(t){t.parent.inBrushDrag||m()})).call(a.behavior.drag().on("dragstart",(function(t){!function(t,e){a.event.sourceEvent.stopPropagation();var r=e.height-a.mouse(t)[1]-2*n.verticalPadding,i=e.unitToPaddedPx.invert(r),o=e.brush,s=x(e,r),l=s.interval,u=o.svgBrush;if(u.wasDragged=!1,u.grabbingBar="ns"===s.region,u.grabbingBar){var c=l.map(e.unitToPaddedPx);u.grabPoint=r-c[0]-n.verticalPadding,u.barLength=c[1]-c[0]}u.clickableOrdinalRange=s.clickableOrdinalRange,u.stayingIntervals=e.multiselect&&o.filterSpecified?o.filter.getConsolidated():[],l&&(u.stayingIntervals=u.stayingIntervals.filter((function(t){return t[0]!==l[0]&&t[1]!==l[1]}))),u.startExtent=s.region?l["s"===s.region?1:0]:i,e.parent.inBrushDrag=!0,u.brushStartCallback()}(this,t)})).on("drag",(function(t){_(this,t)})).on("dragend",(function(t){!function(t,e){var r=e.brush,n=r.filter,i=r.svgBrush;i._dragging||(w(t,e),_(t,e),e.brush.svgBrush.wasDragged=!1),i._dragging=!1,a.event.sourceEvent.stopPropagation();var o=i.grabbingBar;if(i.grabbingBar=!1,i.grabLocation=void 0,e.parent.inBrushDrag=!1,m(),!i.wasDragged)return i.wasDragged=void 0,i.clickableOrdinalRange?r.filterSpecified&&e.multiselect?i.extent.push(i.clickableOrdinalRange):(i.extent=[i.clickableOrdinalRange],r.filterSpecified=!0):o?(i.extent=i.stayingIntervals,0===i.extent.length&&k(r)):k(r),i.brushCallback(e),b(t.parentNode),void i.brushEndCallback(r.filterSpecified?n.getConsolidated():[]);var s=function(){n.set(n.getConsolidated())};if(e.ordinal){var l=e.unitTickvals;l[l.length-1]i.newExtent[0];i.extent=i.stayingIntervals.concat(u?[i.newExtent]:[]),i.extent.length||k(r),i.brushCallback(e),u?b(t.parentNode,s):(s(),b(t.parentNode))}else s();i.brushEndCallback(r.filterSpecified?n.getConsolidated():[])}(this,t)})))}function T(t,e){return t[0]-e[0]}function k(t){t.filterSpecified=!1,t.svgBrush.extent=[[-1/0,1/0]]}function M(t){for(var e,r=t.slice(),n=[],a=r.shift();a;){for(e=a.slice();(a=r.shift())&&a[0]<=e[1];)e[1]=Math.max(e[1],a[1]);n.push(e)}return 1===n.length&&n[0][0]>n[0][1]&&(n=[]),n}e.exports={makeBrush:function(t,e,r,n,a,i){var o,l=function(){var t,e,r=[];return{set:function(n){1===(r=n.map((function(t){return t.slice().sort(s)})).sort(T)).length&&r[0][0]===-1/0&&r[0][1]===1/0&&(r=[[0,-1]]),t=M(r),e=r.reduce((function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}),[1/0,-1/0])},get:function(){return r.slice()},getConsolidated:function(){return t},getBounds:function(){return e}}}();return l.set(r),{filter:l,filterSpecified:e,svgBrush:{extent:[],brushStartCallback:n,brushCallback:(o=a,function(t){var e=t.brush,r=function(t){return t.svgBrush.extent.map((function(t){return t.slice()}))}(e).slice();e.filter.set(r),o()}),brushEndCallback:i}}},ensureAxisBrush:function(t){var e=t.selectAll("."+n.cn.axisBrush).data(o,i);e.enter().append("g").classed(n.cn.axisBrush,!0),function(t){var e=t.selectAll(".background").data(o);e.enter().append("rect").classed("background",!0).call(d).call(p).style("pointer-events","auto").attr("transform","translate(0 "+n.verticalPadding+")"),e.call(A).attr("height",(function(t){return t.height-n.verticalPadding}));var r=t.selectAll(".highlight-shadow").data(o);r.enter().append("line").classed("highlight-shadow",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width+n.bar.strokeWidth).attr("stroke",n.bar.strokeColor).attr("opacity",n.bar.strokeOpacity).attr("stroke-linecap","butt"),r.attr("y1",(function(t){return t.height})).call(y);var a=t.selectAll(".highlight").data(o);a.enter().append("line").classed("highlight",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width-n.bar.strokeWidth).attr("stroke",n.bar.fillColor).attr("opacity",n.bar.fillOpacity).attr("stroke-linecap","butt"),a.attr("y1",(function(t){return t.height})).call(y)}(e)},cleanRanges:function(t,e){if(Array.isArray(t[0])?(t=t.map((function(t){return t.sort(s)})),t=e.multiselect?M(t.sort(T)):[t[0]]):t=[t.sort(s)],e.tickvals){var r=e.tickvals.slice().sort(s);if(!(t=t.map((function(t){var e=[h(0,r,t[0],[]),h(1,r,t[1],[])];if(e[1]>e[0])return e})).filter((function(t){return t}))).length)return}return t.length>1?t:t[0]}}},{"../../lib":460,"../../lib/gup":457,"./constants":599,d3:86}],597:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/get_data").getModuleCalcData,i=t("./plot"),o=t("../../constants/xmlns_namespaces");r.name="parcoords",r.plot=function(t){var e=a(t.calcdata,"parcoords")[0];e.length&&i(t,e)},r.clean=function(t,e,r,n){var a=n._has&&n._has("parcoords"),i=e._has&&e._has("parcoords");a&&!i&&(n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){var e=t._fullLayout._glimages,r=n.select(t).selectAll(".svg-container");r.filter((function(t,e){return e===r.size()-1})).selectAll(".gl-canvas-context, .gl-canvas-focus").each((function(){var t=this.toDataURL("image/png");e.append("svg:image").attr({xmlns:o.svg,"xlink:href":t,preserveAspectRatio:"none",x:0,y:0,width:this.width,height:this.height})})),window.setTimeout((function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")}),60)}},{"../../constants/xmlns_namespaces":438,"../../plots/get_data":537,"./plot":606,d3:86}],598:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale"),i=t("../../lib/gup").wrap;e.exports=function(t,e){var r,o;return a.hasColorscale(e,"line")&&n(e.line.color)?(r=e.line.color,o=a.extractOpts(e.line).colorscale,a.calc(t,e,{vals:r,containerStr:"line",cLetter:"c"})):(r=function(t){for(var e=new Array(t),r=0;rf&&(n.log("parcoords traces support up to "+f+" dimensions at the moment"),p.splice(f));var g=s(t,e,{name:"dimensions",layout:l,handleItemDefaults:d}),v=function(t,e,r,o,s){var l=s("line.color",r);if(a(t,"line")&&n.isArrayOrTypedArray(l)){if(l.length)return s("line.colorscale"),i(t,e,o,s,{prefix:"line.",cLetter:"c"}),l.length;e.line.color=r}return 1/0}(t,e,r,l,c);o(e,l,c),Array.isArray(g)&&g.length||(e.visible=!1),h(e,g,"values",v);var m={family:l.font.family,size:Math.round(l.font.size/1.2),color:l.font.color};n.coerceFont(c,"labelfont",m),n.coerceFont(c,"tickfont",m),n.coerceFont(c,"rangefont",m),c("labelangle"),c("labelside")}},{"../../components/colorscale/defaults":341,"../../components/colorscale/helpers":342,"../../lib":460,"../../plots/array_container_defaults":503,"../../plots/cartesian/axes":507,"../../plots/domain":534,"./attributes":595,"./axisbrush":596,"./constants":599,"./merge_length":604}],601:[function(t,e,r){"use strict";var n=t("../../lib").isTypedArray;r.convertTypedArray=function(t){return n(t)?Array.prototype.slice.call(t):t},r.isOrdinal=function(t){return!!t.tickvals},r.isVisible=function(t){return t.visible||!("visible"in t)}},{"../../lib":460}],602:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcoords",basePlotModule:t("./base_plot"),categories:["gl","regl","noOpacity","noHover"],meta:{}}},{"./attributes":595,"./base_plot":597,"./calc":598,"./defaults":600,"./plot":606}],603:[function(t,e,r){"use strict";var n=t("glslify"),a=n(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nattribute vec4 p01_04, p05_08, p09_12, p13_16,\n p17_20, p21_24, p25_28, p29_32,\n p33_36, p37_40, p41_44, p45_48,\n p49_52, p53_56, p57_60, colors;\n\nuniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution, viewBoxPos, viewBoxSize;\nuniform sampler2D mask, palette;\nuniform float maskHeight;\nuniform float drwLayer; // 0: context, 1: focus, 2: pick\nuniform vec4 contextColor;\n\nbool isPick = (drwLayer > 1.5);\nbool isContext = (drwLayer < 0.5);\n\nconst vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0);\nconst vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * UNITS, UNITS);\n}\n\nfloat axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) {\n float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D);\n float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D);\n return y1 * (1.0 - ratio) + y2 * ratio;\n}\n\nint iMod(int a, int b) {\n return a - b * (a / b);\n}\n\nbool fOutside(float p, float lo, float hi) {\n return (lo < hi) && (lo > p || p > hi);\n}\n\nbool vOutside(vec4 p, vec4 lo, vec4 hi) {\n return (\n fOutside(p[0], lo[0], hi[0]) ||\n fOutside(p[1], lo[1], hi[1]) ||\n fOutside(p[2], lo[2], hi[2]) ||\n fOutside(p[3], lo[3], hi[3])\n );\n}\n\nbool mOutside(mat4 p, mat4 lo, mat4 hi) {\n return (\n vOutside(p[0], lo[0], hi[0]) ||\n vOutside(p[1], lo[1], hi[1]) ||\n vOutside(p[2], lo[2], hi[2]) ||\n vOutside(p[3], lo[3], hi[3])\n );\n}\n\nbool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) {\n return mOutside(A, loA, hiA) ||\n mOutside(B, loB, hiB) ||\n mOutside(C, loC, hiC) ||\n mOutside(D, loD, hiD);\n}\n\nbool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) {\n mat4 pnts[4];\n pnts[0] = A;\n pnts[1] = B;\n pnts[2] = C;\n pnts[3] = D;\n\n for(int i = 0; i < 4; ++i) {\n for(int j = 0; j < 4; ++j) {\n for(int k = 0; k < 4; ++k) {\n if(0 == iMod(\n int(255.0 * texture2D(mask,\n vec2(\n (float(i * 2 + j / 2) + 0.5) / 8.0,\n (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight\n ))[3]\n ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))),\n 2\n )) return true;\n }\n }\n }\n return false;\n}\n\nvec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) {\n float x = 0.5 * sign(v) + 0.5;\n float y = axisY(x, A, B, C, D);\n float z = 1.0 - abs(v);\n\n z += isContext ? 0.0 : 2.0 * float(\n outsideBoundingBox(A, B, C, D) ||\n outsideRasterMask(A, B, C, D)\n );\n\n return vec4(\n 2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0,\n z,\n 1.0\n );\n}\n\nvoid main() {\n mat4 A = mat4(p01_04, p05_08, p09_12, p13_16);\n mat4 B = mat4(p17_20, p21_24, p25_28, p29_32);\n mat4 C = mat4(p33_36, p37_40, p41_44, p45_48);\n mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS);\n\n float v = colors[3];\n\n gl_Position = position(isContext, v, A, B, C, D);\n\n fragColor =\n isContext ? vec4(contextColor) :\n isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5));\n}\n"]),i=n(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}\n"]),o=t("./constants").maxDimensionCount,s=t("../../lib"),l=new Uint8Array(4),u=new Uint8Array(4),c={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function f(t,e,r,n,a){var i=t._gl;i.enable(i.SCISSOR_TEST),i.scissor(e,r,n,a),t.clear({color:[0,0,0,0],depth:1})}function h(t,e,r,n,a,i){var o=i.key;r.drawCompleted||(!function(t){t.read({x:0,y:0,width:1,height:1,data:l})}(t),r.drawCompleted=!0),function s(l){var u=Math.min(n,a-l*n);0===l&&(window.cancelAnimationFrame(r.currentRafs[o]),delete r.currentRafs[o],f(t,i.scissorX,i.scissorY,i.scissorWidth,i.viewBoxSize[1])),r.clearOnly||(i.count=2*u,i.offset=2*l*n,e(i),l*n+u>>8*e)%256/255}function g(t,e,r){for(var n=new Array(8*e),a=0,i=0;ic&&(c=t[a].dim1.canvasX,o=a);0===s&&f(A,0,0,r.canvasWidth,r.canvasHeight);var d=function(t){var e,r,n,a=[[],[]];for(n=0;n<64;n++){var i=!t&&na._length&&(E=E.slice(0,a._length));var S,C=a.tickvals;function L(t,e){return{val:t,text:S[e]}}function O(t,e){return t.val-e.val}if(Array.isArray(C)&&C.length){S=a.ticktext,Array.isArray(S)&&S.length?S.length>C.length?S=S.slice(0,C.length):C.length>S.length&&(C=C.slice(0,S.length)):S=C.map(n.format(a.tickformat));for(var D=1;D=r||l>=i)return;var u=t.lineLayer.readPixel(s,i-1-l),c=0!==u[3],f=c?u[2]+256*(u[1]+256*u[0]):null,h={x:s,y:l,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:f};f!==I&&(c?a.hover(h):a.unhover&&a.unhover(h),I=f)}})),R.style("opacity",(function(t){return t.pick?0:1})),c.style("background","rgba(255, 255, 255, 0)");var P=c.selectAll("."+g.cn.parcoords).data(T,f);P.exit().remove(),P.enter().append("g").classed(g.cn.parcoords,!0).style("shape-rendering","crispEdges").style("pointer-events","none"),P.attr("transform",(function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"}));var F=P.selectAll("."+g.cn.parcoordsControlView).data(h,f);F.enter().append("g").classed(g.cn.parcoordsControlView,!0),F.attr("transform",(function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"}));var z=F.selectAll("."+g.cn.yAxis).data((function(t){return t.dimensions}),f);z.enter().append("g").classed(g.cn.yAxis,!0),F.each((function(t){L(z,t)})),R.each((function(t){if(t.viewModel){!t.lineLayer||a?t.lineLayer=m(this,t):t.lineLayer.update(t),(t.key||0===t.key)&&(t.viewModel[t.key]=t.lineLayer);var e=!t.context||a;t.lineLayer.render(t.viewModel.panels,e)}})),z.attr("transform",(function(t){return"translate("+t.xScale(t.xIndex)+", 0)"})),z.call(n.behavior.drag().origin((function(t){return t})).on("drag",(function(t){var e=t.parent;A.linePickActive(!1),t.x=Math.max(-g.overdrag,Math.min(t.model.width+g.overdrag,n.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,z.sort((function(t,e){return t.x-e.x})).each((function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio})),L(z,e),z.filter((function(e){return 0!==Math.abs(t.xIndex-e.xIndex)})).attr("transform",(function(t){return"translate("+t.xScale(t.xIndex)+", 0)"})),n.select(this).attr("transform","translate("+t.x+", 0)"),z.each((function(r,n,a){a===t.parent.key&&(e.dimensions[n]=r)})),e.contextLayer&&e.contextLayer.render(e.panels,!1,!k(e)),e.focusLayer.render&&e.focusLayer.render(e.panels)})).on("dragend",(function(t){var e=t.parent;t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,L(z,e),n.select(this).attr("transform",(function(t){return"translate("+t.x+", 0)"})),e.contextLayer&&e.contextLayer.render(e.panels,!1,!k(e)),e.focusLayer&&e.focusLayer.render(e.panels),e.pickLayer&&e.pickLayer.render(e.panels,!0),A.linePickActive(!0),a&&a.axesMoved&&a.axesMoved(e.key,e.dimensions.map((function(t){return t.crossfilterDimensionIndex})))}))),z.exit().remove();var N=z.selectAll("."+g.cn.axisOverlays).data(h,f);N.enter().append("g").classed(g.cn.axisOverlays,!0),N.selectAll("."+g.cn.axis).remove();var B=N.selectAll("."+g.cn.axis).data(h,f);B.enter().append("g").classed(g.cn.axis,!0),B.each((function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,a=r.domain();n.select(this).call(n.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?a:null).tickFormat((function(e){return p.isOrdinal(t)?e:O(t.model.dimensions[t.visibleIndex],e)})).scale(r)),l.font(B.selectAll("text"),t.model.tickFont)})),B.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),B.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var j=N.selectAll("."+g.cn.axisHeading).data(h,f);j.enter().append("g").classed(g.cn.axisHeading,!0);var U=j.selectAll("."+g.cn.axisTitle).data(h,f);U.enter().append("text").classed(g.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),U.text((function(t){return t.label})).each((function(e){var r=n.select(this);l.font(r,e.model.labelFont),s.convertToTspans(r,t)})).attr("transform",(function(t){var e=C(t.model.labelAngle,t.model.labelSide),r=g.axisTitleOffset;return(e.dir>0?"":"translate(0,"+(2*r+t.model.height)+")")+"rotate("+e.degrees+")translate("+-r*e.dx+","+-r*e.dy+")"})).attr("text-anchor",(function(t){var e=C(t.model.labelAngle,t.model.labelSide);return 2*Math.abs(e.dx)>Math.abs(e.dy)?e.dir*e.dx<0?"start":"end":"middle"}));var V=N.selectAll("."+g.cn.axisExtent).data(h,f);V.enter().append("g").classed(g.cn.axisExtent,!0);var H=V.selectAll("."+g.cn.axisExtentTop).data(h,f);H.enter().append("g").classed(g.cn.axisExtentTop,!0),H.attr("transform","translate(0,"+-g.axisExtentOffset+")");var G=H.selectAll("."+g.cn.axisExtentTopText).data(h,f);G.enter().append("text").classed(g.cn.axisExtentTopText,!0).call(S),G.text((function(t){return D(t,!0)})).each((function(t){l.font(n.select(this),t.model.rangeFont)}));var q=V.selectAll("."+g.cn.axisExtentBottom).data(h,f);q.enter().append("g").classed(g.cn.axisExtentBottom,!0),q.attr("transform",(function(t){return"translate(0,"+(t.model.height+g.axisExtentOffset)+")"}));var W=q.selectAll("."+g.cn.axisExtentBottomText).data(h,f);W.enter().append("text").classed(g.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(S),W.text((function(t){return D(t,!1)})).each((function(t){l.font(n.select(this),t.model.rangeFont)})),v.ensureAxisBrush(N)}},{"../../components/colorscale":343,"../../components/drawing":353,"../../lib":460,"../../lib/gup":457,"../../lib/svg_text_utils":484,"../../plots/cartesian/axes":507,"./axisbrush":596,"./constants":599,"./helpers":601,"./lines":603,"color-rgba":65,d3:86}],606:[function(t,e,r){"use strict";var n=t("./parcoords"),a=t("../../lib/prepare_regl"),i=t("./helpers").isVisible;function o(t,e,r){var n=e.indexOf(r),a=t.indexOf(n);return-1===a&&(a+=e.length),a}e.exports=function(t,e){var r=t._fullLayout;if(a(t)){var s={},l={},u={},c={},f=r._size;e.forEach((function(e,r){var n=e[0].trace;u[r]=n.index;var a=c[r]=n._fullInput.index;s[r]=t.data[a].dimensions,l[r]=t.data[a].dimensions.slice()}));n(t,e,{width:f.w,height:f.h,margin:{t:f.t,r:f.r,b:f.b,l:f.l}},{filterChanged:function(e,n,a){var i=l[e][n],o=a.map((function(t){return t.slice()})),s="dimensions["+n+"].constraintrange",f=r._tracePreGUI[t._fullData[u[e]]._fullInput.uid];if(void 0===f[s]){var h=i.constraintrange;f[s]=h||null}var d=t._fullData[u[e]].dimensions[n];o.length?(1===o.length&&(o=o[0]),i.constraintrange=o,d.constraintrange=o.slice(),o=[o]):(delete i.constraintrange,delete d.constraintrange,o=null);var p={};p[s]=o,t.emit("plotly_restyle",[p,[c[e]]])},hover:function(e){t.emit("plotly_hover",e)},unhover:function(e){t.emit("plotly_unhover",e)},axesMoved:function(e,r){var n=function(t,e){return function(r,n){return o(t,e,r)-o(t,e,n)}}(r,l[e].filter(i));s[e].sort(n),l[e].filter((function(t){return!i(t)})).sort((function(t){return l[e].indexOf(t)})).forEach((function(t){s[e].splice(s[e].indexOf(t),1),s[e].splice(l[e].indexOf(t),0,t)})),t.emit("plotly_restyle",[{dimensions:[s[e]]},[c[e]]])}})}}},{"../../lib/prepare_regl":473,"./helpers":601,"./parcoords":605}],607:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;r>>1,h)p[0]=t.xbounds[0],p[2]=t.xbounds[1],p[1]=t.ybounds[0],p[3]=t.ybounds[1];else for(l=0;lp[2]&&(p[2]=o),sp[3]&&(p[3]=s);if(d)r=d;else for(r=new Int32Array(e),l=0;lp[2]&&(p[2]=o),sp[3]&&(p[3]=s);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var g=a(t.marker.color),v=a(t.marker.border.color),m=t.opacity*t.marker.opacity;g[3]*=m,this.pointcloudOptions.color=g;var y=t.marker.blend;if(null===y){y=u.length<100||c.length<100}this.pointcloudOptions.blend=y,v[3]*=m,this.pointcloudOptions.borderColor=v;var b=t.marker.sizemin,x=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=b,this.pointcloudOptions.sizeMax=x,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions);var _=this.scene.xaxis,w=this.scene.yaxis,A=x/2||.5;t._extremes[_._id]=i(_,[p[0],p[2]],{ppad:A}),t._extremes[w._id]=i(w,[p[1],p[3]],{ppad:A})},l.dispose=function(){this.pointcloud.dispose()},e.exports=function(t,e){var r=new s(t,e.uid);return r.update(e),r}},{"../../lib/str2rgbarray":483,"../../plots/cartesian/autorange":506,"../scatter/get_trace_color":624,"gl-pointcloud2d":179}],611:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}i("x"),i("y"),i("xbounds"),i("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),i("text"),i("marker.color",r),i("marker.opacity"),i("marker.blend"),i("marker.sizemin"),i("marker.sizemax"),i("marker.border.color",r),i("marker.border.arearatio"),e._length=null}},{"../../lib":460,"./attributes":609}],612:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("../scatter3d/calc"),plot:t("./convert"),moduleType:"trace",name:"pointcloud",basePlotModule:t("../../plots/gl2d"),categories:["gl","gl2d","showLegend"],meta:{}}},{"../../plots/gl2d":540,"../scatter3d/calc":641,"./attributes":609,"./convert":610,"./defaults":611}],613:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rs&&k[v].gap;)v--;for(y=k[v].s,p=k.length-1;p>v;p--)k[p].s=y;for(;sM[c]&&c=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],621:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=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,a){return n.coerce(t,e,i,r,a)}var m=l(t,e,g,v);if(m||(e.visible=!1),e.visible){var y=u(t,e,g,v),b=!y&&mq!=(z=D[L][1])>=q&&(I=D[L-1][0],P=D[L][0],z-F&&(R=I+(P-I)*(q-F)/(z-F),U=Math.min(U,R),V=Math.max(V,R)));U=Math.max(U,0),V=Math.min(V,h._length);var W=s.defaultLine;return s.opacity(f.fillcolor)?W=f.fillcolor:s.opacity((f.line||{}).color)&&(W=f.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:U,x1:V,y0:q,y1:q,color:W,hovertemplate:!1}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":331,"../../components/fx":371,"../../lib":460,"../../registry":553,"./get_trace_color":624}],626:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":520,"./arrays_to_calcdata":613,"./attributes":614,"./calc":615,"./cross_trace_calc":619,"./cross_trace_defaults":620,"./defaults":621,"./format_labels":623,"./hover":625,"./marker_colorbar":632,"./plot":634,"./select":635,"./style":637,"./subtypes":638}],627:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s,l){var u=(t.marker||{}).color;(s("line.color",r),a(t,"line"))?i(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":341,"../../components/colorscale/helpers":342,"../../lib":460}],628:[function(t,e,r){"use strict";var n=t("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,s=i-.5,l=t("../../lib"),u=l.segmentsIntersect,c=l.constrain,f=t("./constants");e.exports=function(t,e){var r,n,i,h,d,p,g,v,m,y,b,x,_,w,A,T,k,M,E=e.xaxis,S=e.yaxis,C="log"===E.type,L="log"===S.type,O=E._length,D=S._length,R=e.connectGaps,I=e.baseTolerance,P=e.shape,F="linear"===P,z=e.fill&&"none"!==e.fill,N=[],B=f.minTolerance,j=t.length,U=new Array(j),V=0;function H(r){var n=t[r];if(!n)return!1;var i=e.linearized?E.l2p(n.x):E.c2p(n.x),l=e.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=E.c2p(n.x,!0)),i===a)return!1;L&&l===a&&(i*=Math.abs(E._m*D*(E._m>0?o:s)/(S._m*O*(S._m>0?o:s)))),i*=1e3}if(l===a){if(L&&(l=S.c2p(n.y,!0)),l===a)return!1;l*=1e3}return[i,l]}function G(t,e,r,n){var a=r-t,i=n-e,o=.5-t,s=.5-e,l=a*a+i*i,u=a*o+i*s;if(u>0&&urt||t[1]at)return[c(t[0],et,rt),c(t[1],nt,at)]}function st(t,e){return t[0]===e[0]&&(t[0]===et||t[0]===rt)||(t[1]===e[1]&&(t[1]===nt||t[1]===at)||void 0)}function lt(t,e,r){return function(n,a){var i=ot(n),o=ot(a),s=[];if(i&&o&&st(i,o))return s;i&&s.push(i),o&&s.push(o);var u=2*l.constrain((n[t]+a[t])/2,e,r)-((i||n)[t]+(o||a)[t]);u&&((i&&o?u>0==i[t]>o[t]?i:o:i||o)[t]+=u);return s}}function ut(t){var e=t[0],r=t[1],n=e===U[V-1][0],a=r===U[V-1][1];if(!n||!a)if(V>1){var i=e===U[V-2][0],o=r===U[V-2][1];n&&(e===et||e===rt)&&i?o?V--:U[V-1]=t:a&&(r===nt||r===at)&&o?i?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,J]),ut(t),Q=null,Z=J=0}function ft(t){if(k=t[0]/O,M=t[1]/D,X=t[0]rt?rt:0,Y=t[1]at?at:0,X||Y){if(V)if(Q){var e=K(Q,t);e.length>1&&(ct(e[0]),U[V++]=e[1])}else $=K(U[V-1],t)[0],U[V++]=$;else U[V++]=[X||t[0],Y||t[1]];var r=U[V-1];X&&Y&&(r[0]!==X||r[1]!==Y)?(Q&&(Z!==X&&J!==Y?ut(Z&&J?(n=Q,i=(a=t)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?et:rt,at]:[o>0?rt:et,nt]):[Z||X,J||Y]):Z&&J&&ut([Z,J])),ut([X,Y])):Z-X&&J-Y&&ut([X||Z,Y||J]),Q=t,Z=X,J=Y}else Q&&ct(K(Q,t)[0]),U[V++]=t;var n,a,i,o}for("linear"===P||"spline"===P?K=function(t,e){for(var r=[],n=0,a=0;a<4;a++){var i=it[a],o=u(t[0],t[1],e[0],e[1],i[0],i[1],i[2],i[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&&W(o,t)q(p,ht))break;i=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)}Q&&ut([Z||Q[0],J||Q[1]]),N.push(U.slice(0,V))}return N}},{"../../constants/numerical":437,"../../lib":460,"./constants":618}],629:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],630:[function(t,e,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};e.exports=function(t,e,r){var a,i,o,s,l,u={},c=!1,f=-1,h=0,d=-1;for(i=0;i=0?l=d:(l=d=h,h++),l0?Math.max(e,a):0}}},{"fast-isnumeric":155}],632:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],633:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,i=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),a(t,"marker")&&i(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),a(t,"marker.line")&&i(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":331,"../../components/colorscale/defaults":341,"../../components/colorscale/helpers":342,"./subtypes":638}],634:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../registry"),i=t("../../lib"),o=i.ensureSingle,s=i.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,a,o){var s=r.xaxis,l=r.yaxis,c=n.extent(i.simpleMap(s.range,s.r2c)),f=n.extent(i.simpleMap(l.range,l.r2c)),h=a[0].trace;if(!u.hasMarkers(h))return;var d=h.marker.maxdisplayed;if(0===d)return;var p=a.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),T=o(A,"g","errorbars"),k=o(A,"g","lines"),M=o(A,"g","points"),E=o(A,"g","text");if(a.getComponentMethod("errorbars","plot")(t,T,r,g),!0===_.visible){var S,C;y(A).style("opacity",_.opacity);var L=_.fill.charAt(_.fill.length-1);"x"!==L&&"y"!==L&&(L=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=A;var O,D,R="",I=[],P=_._prevtrace;P&&(R=P._prevRevpath||"",C=P._nextFill,I=P._polygons);var F,z,N,B,j,U,V,H="",G="",q=[],W=i.noop;if(S=_._ownFill,u.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(F=l.steps(w.shape),z=l.steps(w.shape.split("").reverse().join(""))):F=z="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")},N=function(t){return z(t.reverse())},q=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(q.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 a=y(r);a.attr("d",O),l.singleLineStyle(f,a)}}}}}var X=k.selectAll(".js-line").data(q);y(X.exit()).style("opacity",0).remove(),X.each(W(!1)),X.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),l.setClipUrl(X,r.layerClipId,t),q.length?(S?(S.datum(f),B&&U&&(L?("y"===L?B[1]=U[1]=x.c2p(0,!0):"x"===L&&(B[0]=U[0]=b.c2p(0,!0)),y(S).attr("d","M"+U+"L"+B+"L"+H.substr(1)).call(l.singleFillStyle)):y(S).attr("d",H+"Z").call(l.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&H&&R?("tonext"===_.fill?y(C).attr("d",H+"Z"+R+"Z").call(l.singleFillStyle):y(C).attr("d",H+"L"+R.substr(1)+"Z").call(l.singleFillStyle),_._polygons=_._polygons.concat(I)):(Z(C),_._polygons=null)),_._prevRevpath=G,_._prevPolygons=V):(S?Z(S):C&&Z(C),_._polygons=_._prevRevpath=_._prevPolygons=null),M.datum(f),E.datum(f),function(e,a,i){var o,c=i[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:J:_&&!w&&(v=$),f&&(p=v),h&&(g=v)}var A,T=(o=e.selectAll("path.point").data(p,d)).enter().append("path").classed("point",!0);m&&T.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 a=n.select(this),i=y(a);l.translatePoint(e,i,b,x)?(l.singlePointStyle(e,i,c,A,t),r.layerClipId&&l.hideOutsideRangePoint(e,i,b,x,c.xcalendar,c.ycalendar),c.customdata&&a.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,d)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(t){var e=n.select(this),a=y(e.select("text"));l.translatePoint(t,a,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()}(M,E,f);var Y=!1===_.cliponaxis?null:r.layerClipId;l.setClipUrl(M,Y,t),l.setClipUrl(E,Y,t)}function Z(t){y(t).attr("d","M0,0Z")}function J(t){return t.filter((function(t){return!t.gap&&t.vis}))}function Q(t){return t.filter((function(t){return t.vis}))}function $(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,a,i,u){var c,h,p=!i,g=!!i&&i.duration>0,v=f(t,e,r);((c=a.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 a=o(n.select(this),"g","fills");l.setClipUrl(a,r.layerClipId,t);var i=e[0].trace,u=[];i._ownfill&&u.push("_ownFill"),i._nexttrace&&u.push("_nextFill");var c=a.selectAll("g").data(u,s);c.enter().append("g"),c.exit().each((function(t){i[t]=null})).remove(),c.order().each((function(t){i[t]=o(n.select(this),"path","js-fill")}))}))}(t,c,e),g)?(u&&(h=u()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){h&&h()})).each("interrupt",(function(){h&&h()})).each((function(){a.selectAll("g.trace").each((function(r,n){d(t,n,e,r,v,this,i)}))}))):c.each((function(r,n){d(t,n,e,r,v,this,i)}));p&&c.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":353,"../../lib":460,"../../lib/polygon":472,"../../registry":553,"./line_points":628,"./link_traces":630,"./subtypes":638,d3:86}],635:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,i,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=g,A=2*_,T={},k=e._x=y.makeCalcdata(e,"x"),M=e._y=b.makeCalcdata(e,"y"),E=new Array(A);for(r=0;r<_;r++)o=k[r],s=M[r],E[2*r]=o===p?NaN:o,E[2*r+1]=s===p?NaN:s;if("log"===y.type)for(r=0;r1&&a.extendFlat(s.line,h.linePositions(t,r,n));if(s.errorX||s.errorY){var l=h.errorBarPositions(t,r,n,i,o);s.errorX&&a.extendFlat(s.errorX,l.x),s.errorY&&a.extendFlat(s.errorY,l.y)}s.text&&(a.extendFlat(s.text,{positions:n},h.textPosition(t,r,s.text,s.marker)),a.extendFlat(s.textSel,{positions:n},h.textPosition(t,r,s.text,s.markerSel)),a.extendFlat(s.textUnsel,{positions:n},h.textPosition(t,r,s.text,s.markerUnsel)));return s}(t,0,e,E,k,M),O=d(t,x);return c(m,e),w?L.marker&&(C=2*(L.marker.sizeAvg||Math.max(L.marker.size,3))):C=l(e,_),u(t,e,y,b,k,M,C),L.errorX&&v(e,y,L.errorX),L.errorY&&v(e,b,L.errorY),L.fill&&!O.fill2d&&(O.fill2d=!0),L.marker&&!O.scatter2d&&(O.scatter2d=!0),L.line&&!O.line2d&&(O.line2d=!0),!L.errorX&&!L.errorY||O.error2d||(O.error2d=!0),L.text&&!O.glText&&(O.glText=!0),L.marker&&(L.marker.snap=_),O.lineOptions.push(L.line),O.errorXOptions.push(L.errorX),O.errorYOptions.push(L.errorY),O.fillOptions.push(L.fill),O.markerOptions.push(L.marker),O.markerSelectedOptions.push(L.markerSel),O.markerUnselectedOptions.push(L.markerUnsel),O.textOptions.push(L.text),O.textSelectedOptions.push(L.textSel),O.textUnselectedOptions.push(L.textUnsel),O.selectBatch.push([]),O.unselectBatch.push([]),T._scene=O,T.index=O.count,T.x=k,T.y=M,T.positions=E,O.count++,[{x:!1,y:!1,t:T,trace:e}]}},{"../../constants/numerical":437,"../../lib":460,"../../plots/cartesian/autorange":506,"../../plots/cartesian/axis_ids":510,"../scatter/calc":615,"../scatter/colorscale_calc":617,"./constants":644,"./convert":645,"./scene_update":653,"@plotly/point-cluster":10}],644:[function(t,e,r){"use strict";e.exports={TOO_MANY_POINTS:1e5,SYMBOL_SDF_SIZE:200,SYMBOL_SIZE:20,SYMBOL_STROKE:1,DOT_RE:/-dot/,OPEN_RE:/-open/,DASHES:{solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}}},{}],645:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("svg-path-sdf"),i=t("color-normalize"),o=t("../../registry"),s=t("../../lib"),l=t("../../components/drawing"),u=t("../../plots/cartesian/axis_ids"),c=t("../../lib/gl_format_color").formatColor,f=t("../scatter/subtypes"),h=t("../scatter/make_bubble_size_func"),d=t("./helpers"),p=t("./constants"),g=t("../../constants/interactions").DESELECTDIM,v={start:1,left:1,end:-1,right:-1,middle:0,center:0,bottom:1,top:-1},m=t("../../components/fx/helpers").appendArrayPointValue;function y(t,e){var r,a=t._fullLayout,i=e._length,o=e.textfont,l=e.textposition,u=Array.isArray(l)?l:[l],c=o.color,f=o.size,h=o.family,d={},p=e.texttemplate;if(p){d.text=[];var g=a._d3locale,v=Array.isArray(p),y=v?Math.min(p.length,i):i,b=v?function(t){return p[t]}:function(){return p};for(r=0;rp.TOO_MANY_POINTS||f.hasMarkers(e)?"rect":"round";if(u&&e.connectgaps){var h=n[0],d=n[1];for(a=0;a1?l[a]:l[0]:l,p=Array.isArray(u)?u.length>1?u[a]:u[0]:u,g=v[d],m=v[p],y=c?c/.8+1:0,b=-m*y-.5*m;o.offset[a]=[g*y/h,b/h]}}return o}}},{"../../components/drawing":353,"../../components/fx/helpers":367,"../../constants/interactions":436,"../../lib":460,"../../lib/gl_format_color":456,"../../plots/cartesian/axis_ids":510,"../../registry":553,"../scatter/make_bubble_size_func":631,"../scatter/subtypes":638,"./constants":644,"./helpers":649,"color-normalize":63,"fast-isnumeric":155,"svg-path-sdf":283}],646:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("./helpers"),o=t("./attributes"),s=t("../scatter/constants"),l=t("../scatter/subtypes"),u=t("../scatter/xy_defaults"),c=t("../scatter/marker_defaults"),f=t("../scatter/line_defaults"),h=t("../scatter/fillcolor_defaults"),d=t("../scatter/text_defaults");e.exports=function(t,e,r,p){function g(r,a){return n.coerce(t,e,o,r,a)}var v=!!t.marker&&i.isOpenSymbol(t.marker.symbol),m=l.isBubble(t),y=u(t,e,p,g);if(y){var b=y100},r.isDotSymbol=function(t){return"string"==typeof t?n.DOT_RE.test(t):t>200}},{"./constants":644}],650:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("../scatter/get_trace_color");function o(t,e,r,o){var s=t.xa,l=t.ya,u=t.distance,c=t.dxy,f=t.index,h={pointNumber:f,x:e[f],y:r[f]};h.tx=Array.isArray(o.text)?o.text[f]:o.text,h.htx=Array.isArray(o.hovertext)?o.hovertext[f]:o.hovertext,h.data=Array.isArray(o.customdata)?o.customdata[f]:o.customdata,h.tp=Array.isArray(o.textposition)?o.textposition[f]:o.textposition;var d=o.textfont;d&&(h.ts=a.isArrayOrTypedArray(d.size)?d.size[f]:d.size,h.tc=Array.isArray(d.color)?d.color[f]:d.color,h.tf=Array.isArray(d.family)?d.family[f]:d.family);var p=o.marker;p&&(h.ms=a.isArrayOrTypedArray(p.size)?p.size[f]:p.size,h.mo=a.isArrayOrTypedArray(p.opacity)?p.opacity[f]:p.opacity,h.mx=a.isArrayOrTypedArray(p.symbol)?p.symbol[f]:p.symbol,h.mc=a.isArrayOrTypedArray(p.color)?p.color[f]:p.color);var g=p&&p.line;g&&(h.mlc=Array.isArray(g.color)?g.color[f]:g.color,h.mlw=a.isArrayOrTypedArray(g.width)?g.width[f]:g.width);var v=p&&p.gradient;v&&"none"!==v.type&&(h.mgt=Array.isArray(v.type)?v.type[f]:v.type,h.mgc=Array.isArray(v.color)?v.color[f]:v.color);var m=s.c2p(h.x,!0),y=l.c2p(h.y,!0),b=h.mrc||1,x=o.hoverlabel;x&&(h.hbg=Array.isArray(x.bgcolor)?x.bgcolor[f]:x.bgcolor,h.hbc=Array.isArray(x.bordercolor)?x.bordercolor[f]:x.bordercolor,h.hts=a.isArrayOrTypedArray(x.font.size)?x.font.size[f]:x.font.size,h.htc=Array.isArray(x.font.color)?x.font.color[f]:x.font.color,h.htf=Array.isArray(x.font.family)?x.font.family[f]:x.font.family,h.hnl=a.isArrayOrTypedArray(x.namelength)?x.namelength[f]:x.namelength);var _=o.hoverinfo;_&&(h.hi=Array.isArray(_)?_[f]:_);var w=o.hovertemplate;w&&(h.ht=Array.isArray(w)?w[f]:w);var A={};A[t.index]=h;var T=a.extendFlat({},t,{color:i(o,h),x0:m-b,x1:m+b,xLabelVal:h.x,y0:y-b,y1:y+b,yLabelVal:h.y,cd:A,distance:u,spikeDistance:c,hovertemplate:h.ht});return h.htx?T.text=h.htx:h.tx?T.text=h.tx:o.text&&(T.text=o.text),a.fillText(h,o,T),n.getComponentMethod("errorbars","hoverInfo")(h,o,T),T}e.exports={hoverPoints:function(t,e,r,n){var a,i,s,l,u,c,f,h,d,p=t.cd,g=p[0].t,v=p[0].trace,m=t.xa,y=t.ya,b=g.x,x=g.y,_=m.c2p(e),w=y.c2p(r),A=t.distance;if(g.tree){var T=m.p2c(_-A),k=m.p2c(_+A),M=y.p2c(w-A),E=y.p2c(w+A);a="x"===n?g.tree.range(Math.min(T,k),Math.min(y._rl[0],y._rl[1]),Math.max(T,k),Math.max(y._rl[0],y._rl[1])):g.tree.range(Math.min(T,k),Math.min(M,E),Math.max(T,k),Math.max(M,E))}else a=g.ids;var S=A;if("x"===n)for(u=0;u-1;u--)s=b[a[u]],l=x[a[u]],c=m.c2p(s)-_,f=y.c2p(l)-w,(h=Math.sqrt(c*c+f*f))m.glText.length){var w=x-m.glText.length;for(p=0;pr&&(isNaN(e[n])||isNaN(e[n+1]));)n-=2;t.positions=e.slice(r,n+2)}return t})),m.line2d.update(m.lineOptions)),m.error2d){var T=(m.errorXOptions||[]).concat(m.errorYOptions||[]);m.error2d.update(T)}m.scatter2d&&m.scatter2d.update(m.markerOptions),m.fillOrder=s.repeat(null,x),m.fill2d&&(m.fillOptions=m.fillOptions.map((function(t,e){var n=r[e];if(t&&n&&n[0]&&n[0].trace){var a,i,o=n[0],s=o.trace,l=o.t,u=m.lineOptions[e],c=[];s._ownfill&&c.push(e),s._nexttrace&&c.push(e+1),c.length&&(m.fillOrder[e]=c);var f,h,d=[],p=u&&u.positions||l.positions;if("tozeroy"===s.fill){for(f=0;ff&&isNaN(p[h+1]);)h-=2;0!==p[f+1]&&(d=[p[f],0]),d=d.concat(p.slice(f,h+2)),0!==p[h+1]&&(d=d.concat([p[h],0]))}else if("tozerox"===s.fill){for(f=0;ff&&isNaN(p[h]);)h-=2;0!==p[f]&&(d=[0,p[f+1]]),d=d.concat(p.slice(f,h+2)),0!==p[h]&&(d=d.concat([0,p[h+1]]))}else if("toself"===s.fill||"tonext"===s.fill){for(d=[],a=0,i=0;i-1;for(p=0;ph?2*(x.sizeAvg||Math.max(x.size,3)):i(e,b),d=0;di&&l||a-1,M=!0;if(o(b)||!!d.selectedpoints||k){var E=d._length;if(d.selectedpoints){g.selectBatch=d.selectedpoints;var S=d.selectedpoints,C={};for(l=0;l=r)return a.substr(0,r);for(;r>a.length&&e>1;)1&e&&(a+=t),e>>=1,t+=t;return a=(a+=t).substr(0,r)}},{}],298:[function(t,e,r){"use strict";var n=t("two-product"),a=t("robust-sum"),i=t("robust-subtract"),o=t("robust-scale");function s(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function u(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 u(e,t)}function c(t){if(2===t.length)return[["diff(",u(t[0][0],t[1][1]),",",u(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function u(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(i<=0)return o;n=a+i}else{if(!(a<0))return o;if(i>=0)return o;n=-(a+i)}var s=33306690738754716e-32*n;return o>=s||o<=-s?o:f(t,e,r)},function(t,e,r,n){var a=t[0]-n[0],i=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=i*u,g=o*l,v=o*s,m=a*u,y=a*l,b=i*s,x=c*(p-g)+f*(v-m)+h*(y-b),_=7771561172376103e-31*((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 p(t){var e=h[t.length];return e||(e=h[t.length]=c(t.length)),e.apply(void 0,t)}!function(){for(;h.length<=5;)h.push(c(h.length));for(var t=[],r=["slow"],n=0;n<=5;++n)t.push("a"+n),r.push("o"+n);var a=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=5;++n)a.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");a.push("}var s=new Array(arguments.length);for(var i=0;i0&&o>0||i<0&&o<0)return!1;var s=n(r,t,e),l=n(a,t,e);if(s>0&&l>0||s<0&&l<0)return!1;if(0===i&&0===o&&0===s&&0===l)return function(t,e,r,n){for(var a=0;a<2;++a){var i=t[a],o=e[a],s=Math.min(i,o),l=Math.max(i,o),u=r[a],c=n[a],f=Math.min(u,c);if(Math.max(u,c)=n?(a=f,(l+=1)=n?(a=f,(l+=1)0?1:0}},{}],306:[function(t,e,r){arguments[4][40][0].apply(r,arguments)},{dup:40}],307:[function(t,e,r){"use strict";var n=t("bit-twiddle"),a=t("union-find");function i(t,e){var r=t.length,n=t.length-e.length,a=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return(s=t[0]+t[1]-e[0]-e[1])||a(t[0],t[1])-a(e[0],e[1]);case 3:var i=t[0]+t[1],o=e[0]+e[1];if(s=i+t[2]-(o+e[2]))return s;var s,l=a(t[0],t[1]),u=a(e[0],e[1]);return(s=a(l,t[2])-a(u,e[2]))||a(l+t[2],i)-a(u+e[2],o);default:var c=t.slice(0);c.sort();var f=e.slice(0);f.sort();for(var d=0;d>1,s=i(t[o],e);s<=0?(0===s&&(a=o),r=o+1):s>0&&(n=o-1)}return a}function c(t,e){for(var r=new Array(t.length),a=0,o=r.length;a=t.length||0!==i(t[v],s)););}return r}function f(t,e){if(e<0)return[];for(var r=[],a=(1<>>c&1&&u.push(a[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,a=2*(t+1),i=t;if(n0;){var r=y(t);if(r>=0)if(e0){var t=T[0];return v(0,M-1),M-=1,b(0),t}return-1}function w(t,e){var r=T[t];return u[r]===e?t:(u[r]=-1/0,x(t),_(),u[r]=e,x((M+=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),k[e]>=0&&w(k[e],g(e)),k[r]>=0&&w(k[r],g(r))}}var T=[],k=new Array(i);for(f=0;f>1;f>=0;--f)b(f);for(;;){var E=_();if(E<0||u[E]>r)break;A(E)}var S=[];for(f=0;f=0&&r>=0&&e!==r){var n=k[e],a=k[r];n!==a&&L.push([n,a])}})),a.unique(a.normalize(L)),{positions:S,edges:L}};var n=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":299,"simplicial-complex":307}],310:[function(t,e,r){"use strict";e.exports=function(t,e){var r,i,o,s;if(e[0][0]e[1][0]))return a(e,t);r=e[1],i=e[0]}if(t[0][0]t[1][0]))return-a(t,e);o=t[1],s=t[0]}var l=n(r,i,s),u=n(r,i,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,i),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 i[0]-s[0]};var n=t("robust-orientation");function a(t,e){var r,a,i,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],a=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),a=-1;if(r&&(a=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,a=c.value):(a=c.value,s=c.key))}var f=this.horizontal[e];if(f.length>0){var d=n.ge(f,t[1],l);if(d=f.length)return a;h=f[d]}}if(h.start)if(s){var p=i(s[0],s[1],[t[0],h.y]);s[0][0]>s[1][0]&&(p=-p),p>0&&(a=h.index)}else a=h.index;else h.y!==t[1]&&(a=h.index)}}}return a}},{"./lib/order-segments":310,"binary-search-bounds":311,"functional-red-black-tree":159,"robust-orientation":299}],313:[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(t){return a(o(t),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}function a(r,n){var a,i,o,s,l,u,c,f,d,h=1,p=r.length,g="";for(i=0;i=0),s.type){case"b":a=parseInt(a,10).toString(2);break;case"c":a=String.fromCharCode(parseInt(a,10));break;case"d":case"i":a=parseInt(a,10);break;case"j":a=JSON.stringify(a,null,s.width?parseInt(s.width):0);break;case"e":a=s.precision?parseFloat(a).toExponential(s.precision):parseFloat(a).toExponential();break;case"f":a=s.precision?parseFloat(a).toFixed(s.precision):parseFloat(a);break;case"g":a=s.precision?String(Number(a.toPrecision(s.precision))):parseFloat(a);break;case"o":a=(parseInt(a,10)>>>0).toString(8);break;case"s":a=String(a),a=s.precision?a.substring(0,s.precision):a;break;case"t":a=String(!!a),a=s.precision?a.substring(0,s.precision):a;break;case"T":a=Object.prototype.toString.call(a).slice(8,-1).toLowerCase(),a=s.precision?a.substring(0,s.precision):a;break;case"u":a=parseInt(a,10)>>>0;break;case"v":a=a.valueOf(),a=s.precision?a.substring(0,s.precision):a;break;case"x":a=(parseInt(a,10)>>>0).toString(16);break;case"X":a=(parseInt(a,10)>>>0).toString(16).toUpperCase()}t.json.test(s.type)?g+=a:(!t.number.test(s.type)||f&&!s.sign?d="":(d=f?"+":"-",a=a.toString().replace(t.sign,"")),u=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",c=s.width-(d+a).length,l=s.width&&c>0?u.repeat(c):"",g+=s.align?d+a+l:"0"===u?d+l+a:l+d+a)}return g}var i=Object.create(null);function o(e){if(i[e])return i[e];for(var r,n=e,a=[],o=0;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}"undefined"!=typeof r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],314:[function(t,e,r){"use strict";var n=t("parenthesis");e.exports=function(t,e,r){if(null==t)throw Error("First argument should be a string");if(null==e)throw Error("Separator should be a string or a RegExp");r?("string"==typeof r||Array.isArray(r))&&(r={ignore:r}):r={},null==r.escape&&(r.escape=!0),null==r.ignore?r.ignore=["[]","()","{}","<>",'""',"''","``","\u201c\u201d","\xab\xbb"]:("string"==typeof r.ignore&&(r.ignore=[r.ignore]),r.ignore=r.ignore.map((function(t){return 1===t.length&&(t+=t),t})));var a=n.parse(t,{flat:!0,brackets:r.ignore}),i=a[0].split(e);if(r.escape){for(var o=[],s=0;s c)|0 },"),"generic"===e&&i.push("getters:[0],");for(var s=[],l=[],u=0;u>>7){");for(u=0;u<1<<(1<128&&u%128==0){f.length>0&&d.push("}}");var h="vExtra"+f.length;i.push("case ",u>>>7,":",h,"(m&0x7f,",l.join(),");break;"),d=["function ",h,"(m,",l.join(),"){switch(m){"],f.push(d)}d.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&&(k="+"+v[x]+"*c");var M=p[x].length/y*.5,E=.5+m[x]/y*.5;T.push("d"+x+"-"+E+"-"+M+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}d.push("a.push([",T.join(),"]);","break;")}i.push("}},"),f.length>0&&d.push("}}");var S=[];for(u=0;u<1<1&&(a=1),a<-1&&(a=-1),(t*n-e*r<0?-1:1)*Math.acos(a)};r.default=function(t){var e=t.px,r=t.py,l=t.cx,u=t.cy,c=t.rx,f=t.ry,d=t.xAxisRotation,h=void 0===d?0:d,p=t.largeArcFlag,g=void 0===p?0:p,v=t.sweepFlag,m=void 0===v?0:v,y=[];if(0===c||0===f)return[];var b=Math.sin(h*a/360),x=Math.cos(h*a/360),_=x*(e-l)/2+b*(r-u)/2,w=-b*(e-l)/2+x*(r-u)/2;if(0===_&&0===w)return[];c=Math.abs(c),f=Math.abs(f);var A=Math.pow(_,2)/Math.pow(c,2)+Math.pow(w,2)/Math.pow(f,2);A>1&&(c*=Math.sqrt(A),f*=Math.sqrt(A));var T=function(t,e,r,n,i,o,l,u,c,f,d,h){var p=Math.pow(i,2),g=Math.pow(o,2),v=Math.pow(d,2),m=Math.pow(h,2),y=p*g-p*m-g*v;y<0&&(y=0),y/=p*m+g*v;var b=(y=Math.sqrt(y)*(l===u?-1:1))*i/o*h,x=y*-o/i*d,_=f*b-c*x+(t+r)/2,w=c*b+f*x+(e+n)/2,A=(d-b)/i,T=(h-x)/o,k=(-d-b)/i,M=(-h-x)/o,E=s(1,0,A,T),S=s(A,T,k,M);return 0===u&&S>0&&(S-=a),1===u&&S<0&&(S+=a),[_,w,E,S]}(e,r,l,u,c,f,g,m,b,x,_,w),k=n(T,4),M=k[0],E=k[1],S=k[2],C=k[3],L=Math.abs(C)/(a/4);Math.abs(1-L)<1e-7&&(L=1);var O=Math.max(Math.ceil(L),1);C/=O;for(var D=0;De[2]&&(e[2]=u[c+0]),u[c+1]>e[3]&&(e[3]=u[c+1]);return e}},{"abs-svg-path":12,assert:17,"is-svg-path":250,"normalize-svg-path":318,"parse-svg-path":265}],318:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=[],o=0,s=0,l=0,u=0,c=null,f=null,d=0,h=0,p=0,g=t.length;p4?(o=v[v.length-4],s=v[v.length-3]):(o=d,s=h),r.push(v)}return r};var n=t("svg-arc-to-cubic-bezier");function a(t,e,r,n){return["C",t,e,r,n,r,n]}function i(t,e,r,n,a,i){return["C",t/3+2/3*r,e/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}},{"svg-arc-to-cubic-bezier":316}],319:[function(t,e,r){"use strict";var n,a=t("svg-path-bounds"),i=t("parse-svg-path"),o=t("draw-svg-path"),s=t("is-svg-path"),l=t("bitmap-sdf"),u=document.createElement("canvas"),c=u.getContext("2d");e.exports=function(t,e){if(!s(t))throw Error("Argument should be valid svg path string");e||(e={});var r,f;e.shape?(r=e.shape[0],f=e.shape[1]):(r=u.width=e.w||e.width||200,f=u.height=e.h||e.height||200);var d=Math.min(r,f),h=e.stroke||0,p=e.viewbox||e.viewBox||a(t),g=[r/(p[2]-p[0]),f/(p[3]-p[1])],v=Math.min(g[0]||0,g[1]||0)/2;c.fillStyle="black",c.fillRect(0,0,r,f),c.fillStyle="white",h&&("number"!=typeof h&&(h=1),c.strokeStyle=h>0?"white":"black",c.lineWidth=Math.abs(h));if(c.translate(.5*r,.5*f),c.scale(v,v),function(){if(null!=n)return n;var t=document.createElement("canvas").getContext("2d");if(t.canvas.width=t.canvas.height=1,!window.Path2D)return n=!1;var e=new Path2D("M0,0h1v1h-1v-1Z");t.fillStyle="black",t.fill(e);var r=t.getImageData(0,0,1,1);return n=r&&r.data&&255===r.data[3]}()){var m=new Path2D(t);c.fill(m),h&&c.stroke(m)}else{var y=i(t);o(c,y),c.fill(),h&&c.stroke()}return c.setTransform(1,0,0,1,0,0),l(c,{cutoff:null!=e.cutoff?e.cutoff:.5,radius:null!=e.radius?e.radius:.5*d})}},{"bitmap-sdf":41,"draw-svg-path":90,"is-svg-path":250,"parse-svg-path":265,"svg-path-bounds":317}],320:[function(t,e,r){(function(r){(function(){"use strict";e.exports=function t(e,r,a){a=a||{};var o=i[e];o||(o=i[e]={" ":{data:new Float32Array(0),shape:.2}});var s=o[r];if(!s)if(r.length<=1||!/\d/.test(r))s=o[r]=function(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),a=0,i=0,o=0;o0&&(f+=.02);var h=new Float32Array(c),p=0,g=-.5*f;for(d=0;d1&&(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=L(t,360),e=L(e,100),r=L(r,100),0===e)n=a=i=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=o(l,s,t+1/3),a=o(l,s,t),i=o(l,s,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(e.h,l,c),f=!0,d="hsl"),e.hasOwnProperty("a")&&(i=e.a));var h,p,g;return i=C(i),{ok:f,format:e.format||d,r:o(255,s(a.r,0)),g:o(255,s(a.g,0)),b:o(255,s(a.b,0)),a:i}}(e);this._originalInput=e,this._r=c.r,this._g=c.g,this._b=c.b,this._a=c.a,this._roundA=i(100*this._a)/100,this._format=l.format||c.format,this._gradientType=l.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=c.ok,this._tc_id=a++}function c(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,a,i=s(t,e,r),l=o(t,e,r),u=(i+l)/2;if(i==l)n=a=0;else{var c=i-l;switch(a=u>.5?c/(2-i-l):c/(i+l),i){case t:n=(e-r)/c+(e>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(u(n));return i}function M(t,e){e=e||6;for(var r=u(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],s=1/e;e--;)o.push(u({h:n,s:a,v:i})),i=(i+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,a=this.toRgb();return e=a.r/255,r=a.g/255,n=a.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=C(t),this._roundA=i(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=i(360*t.h),r=i(100*t.s),n=i(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=i(360*t.h),r=i(100*t.s),n=i(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return d(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,a){var o=[R(i(t).toString(16)),R(i(e).toString(16)),R(i(r).toString(16)),R(P(n))];if(a&&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:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*L(this._r,255))+"%",g:i(100*L(this._g,255))+"%",b:i(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*L(this._r,255))+"%, "+i(100*L(this._g,255))+"%, "+i(100*L(this._b,255))+"%)":"rgba("+i(100*L(this._r,255))+"%, "+i(100*L(this._g,255))+"%, "+i(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=u(t);r="#"+h(a._r,a._g,a._b,a._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(k,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(T,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]: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(),a=u(e).toRgb(),i=r/100;return u({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},u.readability=function(e,r){var n=u(e),a=u(r);return(t.max(n.getLuminance(),a.getLuminance())+.05)/(t.min(n.getLuminance(),a.getLuminance())+.05)},u.isReadable=function(t,e,r){var n,a,i=u.readability(t,e);switch(a=!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":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},u.mostReadable=function(t,e,r){var n,a,i,o,s=null,l=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var c=0;cl&&(l=n,s=u(e[c]));return u.isReadable(t,s,{level:i,size:o})||!a?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 C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(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 D(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 P(e){return t.round(255*parseFloat(e)).toString(16)}function F(t){return D(t)/255}var z,N,B,j=(N="[\\s|\\(]+("+(z="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",B="[\\s|\\(]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")[,|\\s]+("+z+")\\s*\\)?",{CSS_UNIT:new RegExp(z),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+B),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!!j.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=u:window.tinycolor=u}(Math)},{}],322:[function(t,e,r){"use strict";e.exports=a,e.exports.float32=e.exports.float=a,e.exports.fract32=e.exports.fract=function(t){if(t.length){for(var e=a(t),r=0,n=e.length;r":(e.length>100&&(e=e.slice(0,99)+"\u2026"),e=e.replace(a,(function(t){switch(t){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}})))}},{"./safe-to-string":329}],331:[function(t,e,r){"use strict";var n=t("../value/is"),a={object:!0,function:!0,undefined:!0};e.exports=function(t){return!!n(t)&&hasOwnProperty.call(a,typeof t)}},{"../value/is":337}],332:[function(t,e,r){"use strict";var n=t("../lib/resolve-exception"),a=t("./is");e.exports=function(t){return a(t)?t:n(t,"%v is not a plain function",arguments[1])}},{"../lib/resolve-exception":328,"./is":333}],333:[function(t,e,r){"use strict";var n=t("../function/is"),a=/^\s*class[\s{/}]/,i=Function.prototype.toString;e.exports=function(t){return!!n(t)&&!a.test(i.call(t))}},{"../function/is":327}],334:[function(t,e,r){"use strict";var n=t("../object/is");e.exports=function(t){if(!n(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},{"../object/is":331}],335:[function(t,e,r){"use strict";var n=t("../value/is"),a=t("../object/is"),i=Object.prototype.toString;e.exports=function(t){if(!n(t))return null;if(a(t)){var e=t.toString;if("function"!=typeof e)return null;if(e===i)return null}try{return""+t}catch(t){return null}}},{"../object/is":331,"../value/is":337}],336:[function(t,e,r){"use strict";var n=t("../lib/resolve-exception"),a=t("./is");e.exports=function(t){return a(t)?t:n(t,"Cannot use %v",arguments[1])}},{"../lib/resolve-exception":328,"./is":337}],337:[function(t,e,r){"use strict";e.exports=function(t){return null!=t}},{}],338:[function(t,e,r){(function(e){(function(){"use strict";var n=t("bit-twiddle"),a=t("dup"),i=t("buffer").Buffer;e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:a([32,0]),UINT16:a([32,0]),UINT32:a([32,0]),BIGUINT64:a([32,0]),INT8:a([32,0]),INT16:a([32,0]),INT32:a([32,0]),BIGINT64:a([32,0]),FLOAT:a([32,0]),DOUBLE:a([32,0]),DATA:a([32,0]),UINT8C:a([32,0]),BUFFER:a([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s="undefined"!=typeof BigUint64Array,l="undefined"!=typeof BigInt64Array,u=e.__TYPEDARRAY_POOL;u.UINT8C||(u.UINT8C=a([32,0])),u.BIGUINT64||(u.BIGUINT64=a([32,0])),u.BIGINT64||(u.BIGINT64=a([32,0])),u.BUFFER||(u.BUFFER=a([32,0]));var c=u.DATA,f=u.BUFFER;function d(t){if(t){var e=t.length||t.byteLength,r=n.log2(e);c[r].push(t)}}function h(t){t=n.nextPow2(t);var e=n.log2(t),r=c[e];return r.length>0?r.pop():new ArrayBuffer(t)}function p(t){return new Uint8Array(h(t),0,t)}function g(t){return new Uint16Array(h(2*t),0,t)}function v(t){return new Uint32Array(h(4*t),0,t)}function m(t){return new Int8Array(h(t),0,t)}function y(t){return new Int16Array(h(2*t),0,t)}function b(t){return new Int32Array(h(4*t),0,t)}function x(t){return new Float32Array(h(4*t),0,t)}function _(t){return new Float64Array(h(8*t),0,t)}function w(t){return o?new Uint8ClampedArray(h(t),0,t):p(t)}function A(t){return s?new BigUint64Array(h(8*t),0,t):null}function T(t){return l?new BigInt64Array(h(8*t),0,t):null}function k(t){return new DataView(h(t),0,t)}function M(t){t=n.nextPow2(t);var e=n.log2(t),r=f[e];return r.length>0?r.pop():new i(t)}r.free=function(t){if(i.isBuffer(t))f[n.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|n.log2(e);c[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeBigUint64=r.freeInt8=r.freeInt16=r.freeInt32=r.freeBigInt64=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){d(t.buffer)},r.freeArrayBuffer=d,r.freeBuffer=function(t){f[n.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return h(t);switch(e){case"uint8":return p(t);case"uint16":return g(t);case"uint32":return v(t);case"int8":return m(t);case"int16":return y(t);case"int32":return b(t);case"float":case"float32":return x(t);case"double":case"float64":return _(t);case"uint8_clamped":return w(t);case"bigint64":return T(t);case"biguint64":return A(t);case"buffer":return M(t);case"data":case"dataview":return k(t);default:return null}return null},r.mallocArrayBuffer=h,r.mallocUint8=p,r.mallocUint16=g,r.mallocUint32=v,r.mallocInt8=m,r.mallocInt16=y,r.mallocInt32=b,r.mallocFloat32=r.mallocFloat=x,r.mallocFloat64=r.mallocDouble=_,r.mallocUint8Clamped=w,r.mallocBigUint64=A,r.mallocBigInt64=T,r.mallocDataView=k,r.mallocBuffer=M,r.clearCache=function(){for(var t=0;t<32;++t)u.UINT8[t].length=0,u.UINT16[t].length=0,u.UINT32[t].length=0,u.INT8[t].length=0,u.INT16[t].length=0,u.INT32[t].length=0,u.FLOAT[t].length=0,u.DOUBLE[t].length=0,u.BIGUINT64[t].length=0,u.BIGINT64[t].length=0,u.UINT8C[t].length=0,c[t].length=0,f[t].length=0}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":40,buffer:52,dup:92}],339:[function(t,e,r){"use strict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e0&&(i=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,i+"px",n.font].filter((function(t){return t})).join(" "),r.textAlign="start",r.textBaseline="alphabetic",r.direction="ltr",d(function(t,e,r,n,i,o){r=r.replace(/\n/g,""),r=!0===o.breaklines?r.replace(/\/g,"\n"):r.replace(/\/g," ");var s="",l=[];for(h=0;h-1?parseInt(t[1+a]):0,l=i>-1?parseInt(r[1+i]):0;s!==l&&(n=n.replace(E(),"?px "),v*=Math.pow(.75,l-s),n=n.replace("?px ",E())),g+=.25*b*(l-s)}if(!0===o.superscripts){var u=t.indexOf("+"),c=r.indexOf("+"),f=u>-1?parseInt(t[1+u]):0,d=c>-1?parseInt(r[1+c]):0;f!==d&&(n=n.replace(E(),"?px "),v*=Math.pow(.75,d-f),n=n.replace("?px ",E())),g-=.25*b*(d-f)}if(!0===o.bolds){var h=t.indexOf("b|")>-1,p=r.indexOf("b|")>-1;!h&&p&&(n=m?n.replace("italic ","italic bold "):"bold "+n),h&&!p&&(n=n.replace("bold ",""))}if(!0===o.italics){var m=t.indexOf("i|")>-1,y=r.indexOf("i|")>-1;!m&&y&&(n="italic "+n),m&&!y&&(n=n.replace("italic ",""))}e.font=n}for(d=0;d",i="",o=a.length,s=i.length,l="+"===e[0]||"-"===e[0],u=0,c=-s;u>-1&&-1!==(u=r.indexOf(a,u))&&-1!==(c=r.indexOf(i,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 d=n[f].indexOf(e[0]);-1===d?n[f]+=e:l&&(n[f]=n[f].substr(0,d+1)+(1+parseInt(n[f][d+1]))+n[f].substr(d+2))}var h=u+o,p=r.substr(h,c-h).indexOf(a);u=-1!==p?p:c+s}return n}function c(t,e){var r=n(t,128);return e?i(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function f(t,e,r,n){var a=c(t,n),i=function(t,e,r){for(var n=e.textAlign||"start",a=e.textBaseline||"alphabetic",i=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l= 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":79}],350:[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":349}],351:[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}]},{}],352:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=t("../../plots/cartesian/constants"),o=t("../../plot_api/plot_template").templatedArray;t("../../constants/axis_placeable_objects");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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../constants/axis_placeable_objects":470,"../../plot_api/plot_template":534,"../../plots/cartesian/constants":551,"../../plots/font_attributes":573,"./arrow_paths":351}],353:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./draw").draw;function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach((function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref),i=a.getRefType(e.xref),o=a.getRefType(e.yref);e._extremes={},"range"===i&&s(e,r),"range"===o&&s(e,n)}))}function s(t,e){var r,n=e._id,i=n.charAt(0),o=t[i],s=t["a"+i],l=t[i+"ref"],u=t["a"+i+"ref"],c=t["_"+i+"padplus"],f=t["_"+i+"padminus"],d={x:1,y:-1}[i]*t[i+"shift"],h=3*t.arrowsize*t.arrowwidth||0,p=h+d,g=h-d,v=3*t.startarrowsize*t.arrowwidth||0,m=v+d,y=v-d;if(u===l){var b=a.findExtremes(e,[e.r2c(o)],{ppadplus:p,ppadminus:g}),x=a.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=a.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([i,o],t)}},{"../../lib":497,"../../plots/cartesian/axes":545,"./draw":358}],354:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("../../plot_api/plot_template").arrayEditor;function o(t,e){var r,n,a,i,o,l,u,c=t._fullLayout.annotations,f=[],d=[],h=[],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={},d=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 W=!1,Y=["x","y"],Z=0;Z1)&&(nt===rt?((ht=at.r2fraction(e["a"+et]))<0||ht>1)&&(W=!0):W=!0),J=at._offset+at.r2p(e[et]),K=.5}else{var pt="domain"===dt;"x"===et?($=e[et],J=pt?at._offset+at._length*$:J=A.l+A.w*$):($=1-e[et],J=pt?at._offset+at._length*$:J=A.t+A.h*$),K=e.showarrow?.5:$}if(e.showarrow){ft.head=J;var gt=e["a"+et];if(tt=ot*G(.5,e.xanchor)-st*G(.5,e.yanchor),nt===rt){var vt=l.getRefType(nt);"domain"===vt?("y"===et&&(gt=1-gt),ft.tail=at._offset+at._length*gt):"paper"===vt?"y"===et?(gt=1-gt,ft.tail=A.t+A.h*gt):ft.tail=A.l+A.w*gt:ft.tail=at._offset+at.r2p(gt),Q=tt}else ft.tail=J+gt,Q=tt+gt;ft.text=ft.tail+tt;var mt=w["x"===et?"width":"height"];if("paper"===rt&&(ft.head=o.constrain(ft.head,1,mt-1)),"pixel"===nt){var yt=-Math.max(ft.tail-3,ft.text),bt=Math.min(ft.tail+3,ft.text)-mt;yt>0?(ft.tail+=yt,ft.text+=yt):bt>0&&(ft.tail-=bt,ft.text-=bt)}ft.tail+=ct,ft.head+=ct}else Q=tt=lt*G(K,ut),ft.text=J+tt;ft.text+=ct,tt+=ct,Q+=ct,e["_"+et+"padplus"]=lt/2+Q,e["_"+et+"padminus"]=lt/2-Q,e["_"+et+"size"]=lt,e["_"+et+"shift"]=tt}if(W)F.remove();else{var xt=0,_t=0;if("left"!==e.align&&(xt=(k-x)*("center"===e.align?.5:1)),"top"!==e.valign&&(_t=(P-_)*("middle"===e.valign?.5:1)),f)n.select("svg").attr({x:B+xt-1,y:B+_t}).call(c.setClipUrl,U?C:null,t);else{var wt=B+_t-g.top,At=B+xt-g.left;q.call(d.positionText,At,wt).call(c.setClipUrl,U?C:null,t)}V.select("rect").call(c.setRect,B,B,k,P),j.call(c.setRect,z/2,z/2,N-z,H-z),F.call(c.setTranslate,Math.round(L.x.text-N/2),Math.round(L.y.text-H/2)),R.attr({transform:"rotate("+O+","+L.x.text+","+L.y.text+")"});var Tt,kt=function(r,n){D.selectAll(".annotation-arrow-g").remove();var l=L.x.head,f=L.y.head,d=L.x.tail+r,h=L.y.tail+n,g=L.x.text+r,x=L.y.text+n,_=o.rotationXYMatrix(O,g,x),w=o.apply2DTransform(_),k=o.apply2DTransform2(_),C=+j.attr("width"),I=+j.attr("height"),P=g-.5*C,z=P+C,N=x-.5*I,B=N+I,U=[[P,N,P,B],[P,B,z,B],[z,B,z,N],[z,N,P,N]].map(k);if(!U.reduce((function(t,e){return t^!!o.segmentsIntersect(l,f,l+1e6,f+1e6,e[0],e[1],e[2],e[3])}),!1)){U.forEach((function(t){var e=o.segmentsIntersect(d,h,l,f,t[0],t[1],t[2],t[3]);e&&(d=e.x,h=e.y)}));var V=e.arrowwidth,H=e.arrowcolor,G=e.arrowside,q=D.append("g").style({opacity:u.opacity(H)}).classed("annotation-arrow-g",!0),X=q.append("path").attr("d","M"+d+","+h+"L"+l+","+f).style("stroke-width",V+"px").call(u.stroke,u.rgb(H));if(v(X,G,e),T.annotationPosition&&X.node().parentNode&&!i){var W=l,Y=f;if(e.standoff){var Z=Math.sqrt(Math.pow(l-d,2)+Math.pow(f-h,2));W+=e.standoff*(d-l)/Z,Y+=e.standoff*(h-f)/Z}var J,Q,$=q.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-W)+","+(h-Y),transform:s(W,Y)}).style("stroke-width",V+6+"px").call(u.stroke,"rgba(0,0,0,0)").call(u.fill,"rgba(0,0,0,0)");p.init({element:$.node(),gd:t,prepFn:function(){var t=c.getTranslate(F);J=t.x,Q=t.y,m&&m.autorange&&M(m._name+".autorange",!0),b&&b.autorange&&M(b._name+".autorange",!0)},moveFn:function(t,r){var n=w(J,Q),a=n[0]+t,i=n[1]+r;F.call(c.setTranslate,a,i),E("x",y(m,t,"x",A,e)),E("y",y(b,r,"y",A,e)),e.axref===e.xref&&E("ax",y(m,t,"ax",A,e)),e.ayref===e.yref&&E("ay",y(b,r,"ay",A,e)),q.attr("transform",s(t,r)),R.attr({transform:"rotate("+O+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",t,S());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&kt(0,0),I)p.init({element:F.node(),gd:t,prepFn:function(){Tt=R.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?E("ax",y(m,t,"ax",A,e)):E("ax",e.ax+t),e.ayref===e.yref?E("ay",y(b,r,"ay",A.w,e)):E("ay",e.ay+r),kt(t,r);else{if(i)return;var a,o;if(m)a=y(m,t,"x",A,e);else{var l=e._xsize/A.w,u=e.x+(e._xshift-e.xshift)/A.w-l/2;a=p.align(u+t/A.w,l,0,1,e.xanchor)}if(b)o=y(b,r,"y",A,e);else{var c=e._ysize/A.h,f=e.y-(e._yshift+e.yshift)/A.h-c/2;o=p.align(f-r/A.h,c,0,1,e.yanchor)}E("x",a),E("y",o),m&&b||(n=p.getCursor(m?.5:a,b?.5:o,e.xanchor,e.yanchor))}R.attr({transform:s(t,r)+Tt}),h(F,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",X(n))},doneFn:function(){h(F),a.call("_guiRelayout",t,S());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,b=e.indexOf("end")>=0,x=p.backoff*v+r.standoff,_=g.backoff*m+r.startstandoff;if("line"===h.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},c={x:+t.attr("x2"),y:+t.attr("y2")};var w=o.x-c.x,A=o.y-c.y;if(d=(f=Math.atan2(A,w))+Math.PI,x&&_&&x+_>Math.sqrt(w*w+A*A))return void I();if(x){if(x*x>w*w+A*A)return void I();var T=x*Math.cos(f),k=x*Math.sin(f);c.x+=T,c.y+=k,t.attr({x2:c.x,y2:c.y})}if(_){if(_*_>w*w+A*A)return void I();var M=_*Math.cos(f),E=_*Math.sin(f);o.x-=M,o.y-=E,t.attr({x1:o.x,y1:o.y})}}else if("path"===h.nodeName){var S=h.getTotalLength(),C="";if(S1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l._pdata=a(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":580,"../annotations/draw":358}],365:[function(t,e,r){"use strict";var n=t("../../registry"),a=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 i=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(n(t))},i.opacity=function(t){return t?n(t).getAlpha():0},i.addOpacity=function(t,e){var r=n(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},i.combine=function(t,e){var r=n(t).toRgb();if(1===r.a)return n(t).toRgbString();var a=n(e||l).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(t,e,r){var a=n(t);return 1!==a.getAlpha()&&(a=n(i.combine(t,l))),(a.isDark()?e?a.lighten(e):l:r?a.darken(r):s).toString()},i.stroke=function(t,e){var r=n(e);t.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(t,e){var r=n(e);t.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,r,n,a,o=Object.keys(t);for(e=0;e0?n>=l:n<=l));a++)n>c&&n0?n>=l:n<=l));a++)n>r[0]&&n1){var J=Math.pow(10,Math.floor(Math.log(Z)/Math.LN10));W*=J*u.roundUp(Z/J,[2,5,10]),(Math.abs(L.start)/L.size+1e-6)%1<2e-6&&(X.tick0=0)}X.dtick=W}X.domain=[H+j,H+z-j],X.setScale(),t.attr("transform",c(Math.round(l.l),Math.round(l.t)));var Q,$=t.select("."+k.cbtitleunshift).attr("transform",c(-Math.round(l.l),-Math.round(l.t))),K=t.select("."+k.cbaxis),tt=0;function et(n,a){var i={propContainer:X,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+k.cbtitle)},s="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+s+",."+s+"-math-group").remove(),g.draw(r,n,f(i,a||{}))}return u.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(M)){var t,r=l.l+(e.x+N)*l.w,n=X.title.font.size;t="top"===M?(1-(H+z-j))*l.h+l.t+3+.75*n:(1-(H+j))*l.h+l.t-3-.25*n,et(X._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(M)){var i=t.select("."+k.cbtitle),o=i.select("text"),f=[-e.outlinewidth/2,e.outlinewidth/2],d=i.select(".h"+X._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*w),d?(tt=h.bBox(d).height)>p&&(f[1]-=(tt-p)/2):o.node()&&!o.classed(k.jsPlaceholder)&&(tt=h.bBox(o.node()).height),tt){if(tt+=5,"top"===M)X.domain[1]-=tt/l.h,f[1]*=-1;else{X.domain[0]+=tt/l.h;var g=v.lineCount(o);f[1]+=(1-g)*p}i.attr("transform",c(f[0],f[1])),X.setScale()}}t.selectAll("."+k.cbfills+",."+k.cblines).attr("transform",c(0,Math.round(l.h*(1-X.domain[1])))),K.attr("transform",c(0,Math.round(-l.t)));var y=t.select("."+k.cbfills).selectAll("rect."+k.cbfill).attr("style","").data(D);y.enter().append("rect").classed(k.cbfill,!0).style("stroke","none"),y.exit().remove();var b=E.map(X.c2p).map(Math.round).sort((function(t,e){return t-e}));y.each((function(t,i){var o=[0===i?E[0]:(D[i]+D[i-1])/2,i===D.length-1?E[1]:(D[i]+D[i+1])/2].map(X.c2p).map(Math.round);o[1]=u.constrain(o[1]+(o[1]>o[0])?1:-1,b[0],b[1]);var s=n.select(this).attr({x:U,width:Math.max(I,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)h.gradient(s,r,e._id,"vertical",e._fillgradient,"fill");else{var l=C(t).replace("e-","");s.attr("fill",a(l).toHexString())}}));var x=t.select("."+k.cblines).selectAll("path."+k.cbline).data(m.color&&m.width?R:[]);x.enter().append("path").classed(k.cbline,!0),x.exit().remove(),x.each((function(t){n.select(this).attr("d","M"+U+","+(Math.round(X.c2p(t))+m.width/2%1)+"h"+I).call(h.lineGroupStyle,m.width,S(t),m.dash)})),K.selectAll("g."+X._id+"tick,path").remove();var _=U+I+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),A=s.calcTicks(X),T=s.getTickSigns(X)[2];return s.drawTicks(r,X,{vals:"inside"===X.ticks?s.clipEnds(X,A):A,layer:K,path:s.makeTickPath(X,_,T),transFn:s.makeTransTickFn(X)}),s.drawLabels(r,X,{vals:A,layer:K,transFn:s.makeTransTickLabelFn(X),labelFns:s.makeLabelFns(X,_)})},function(){if(-1===["top","bottom"].indexOf(M)){var t=X.title.font.size,e=X._offset+X._length/2,a=l.l+(X.position||0)*l.w+("right"===X.side?10+t*(X.showticklabels?1:.5):-10-t*(X.showticklabels?.5:0));et("h"+X._id+"title",{avoid:{selection:n.select(r).selectAll("g."+X._id+"tick"),side:M,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=I+e.outlinewidth/2;if(-1===X.ticklabelposition.indexOf("inside")&&(n+=h.bBox(K.node()).width),(Q=$.select("text")).node()&&!Q.classed(k.jsPlaceholder)){var a,o=$.select(".h"+X._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(M)?h.bBox(o).width:h.bBox($.node()).right-U-l.l,n=Math.max(n,a)}var s=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,u=G-q;t.select("."+k.cbbg).attr({x:U-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:q-B,width:Math.max(s,2),height:Math.max(u+2*B,2)}).call(p.fill,e.bgcolor).call(p.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+k.cboutline).attr({x:U,y:q+e.ypad+("top"===M?tt:0),width:Math.max(I,2),height:Math.max(u-2*e.ypad-tt,2)}).call(p.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var f=({center:.5,right:1}[e.xanchor]||0)*s;t.attr("transform",c(l.l-f,l.t));var d={},g=A[e.yanchor],v=T[e.yanchor];"pixels"===e.lenmode?(d.y=e.y,d.t=u*g,d.b=u*v):(d.t=d.b=0,d.yt=e.y+e.len*g,d.yb=e.y-e.len*v);var m=A[e.xanchor],y=T[e.xanchor];if("pixels"===e.thicknessmode)d.x=e.x,d.l=s*m,d.r=s*y;else{var b=s-I;d.l=b*m,d.r=b*y,d.xl=e.x-e.thickness*m,d.xr=e.x+e.thickness*y}i.autoMargin(r,e._id,d)}],r)}(r,e,t);m&&m.then&&(t._promises||[]).push(m),t._context.edits.colorbarPosition&&function(t,e,r){var n,a,i,s=r._fullLayout._size;l.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),d(t)},moveFn:function(r,o){t.attr("transform",n+c(r,o)),a=l.align(e._xLeftFrac+r/s.w,e._thickFrac,0,1,e.xanchor),i=l.align(e._yBottomFrac-o/s.h,e._lenFrac,0,1,e.yanchor);var u=l.getCursor(a,i,e.xanchor,e.yanchor);d(t,u)},doneFn:function(){if(d(t),void 0!==a&&void 0!==i){var n={};n[e._propPrefix+"x"]=a,n[e._propPrefix+"y"]=i,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){i.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":469,"../../lib":497,"../../lib/extend":489,"../../lib/setcursor":517,"../../lib/svg_text_utils":521,"../../plots/cartesian/axes":545,"../../plots/cartesian/axis_defaults":547,"../../plots/cartesian/layout_attributes":559,"../../plots/cartesian/position_defaults":562,"../../plots/plots":583,"../../registry":591,"../color":367,"../colorscale/helpers":378,"../dragelement":386,"../drawing":389,"../titles":462,"./constants":369,d3:86,tinycolor2:321}],372:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":497}],373:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":368,"./defaults":370,"./draw":371,"./has_colorbar":372}],374:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),a=t("../../lib/regex").counter,i=t("./scales.js").scales;Object.keys(i);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,s=(e=e||{}).cLetter||"c",l=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),u="showScaleDflt"in e?e.showScaleDflt:"z"===s,c="string"==typeof e.colorscaleDflt?i[e.colorscaleDflt]:null,f=e.editTypeOverride||"",d=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(d+(r={z:"z",c:"color"}[s]));var h=s+"auto",p=s+"min",g=s+"max",v=s+"mid",m=(o(d+h),o(d+p),o(d+g),{});m[p]=m[g]=void 0;var y={};y[h]=!1;var b={};return"color"===r&&(b.color={valType:"color",arrayOk:!0,editType:f||"style"},e.anim&&(b.color.anim=!0)),b[h]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},b[p]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},b[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},b[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},b.colorscale={valType:"colorscale",editType:"calc",dflt:c,impliedEdits:{autocolorscale:!1}},b.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},b.reversescale={valType:"boolean",dflt:!1,editType:"plot"},l||(b.showscale={valType:"boolean",dflt:u,editType:"calc"},b.colorbar=n),e.noColorAxis||(b.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),b}},{"../../lib/regex":513,"../colorbar/attributes":368,"./scales.js":382}],375:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,s=t._fullLayout,l=r.vals,u=r.containerStr,c=u?a.nestedProperty(e,u).get():e,f=i(c),d=!1!==f.auto,h=f.min,p=f.max,g=f.mid,v=function(){return a.aggNums(Math.min,null,l)},m=function(){return a.aggNums(Math.max,null,l)};(void 0===h?h=v():d&&(h=c._colorAx&&n(h)?Math.min(h,v()):v()),void 0===p?p=m():d&&(p=c._colorAx&&n(p)?Math.max(p,m()):m()),d&&void 0!==g&&(p-g>g-h?h=g-(p-g):p-g=0?s.colorscale.sequential:s.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":497,"./helpers":378,"fast-isnumeric":155}],376:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./helpers").hasColorscale,i=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,a){var o=a.container?n.nestedProperty(t,a.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var s=i(o),l=s.auto;(l||void 0===s.min)&&r(o,a.min),(l||void 0===s.max)&&r(o,a.max),s.autocolorscale&&r(o,"colorscale")}}for(var s=0;s=0;n--,a++){var i=t[n];r[a]=[1-i[0],i[1]]}return r}function p(t,e){e=e||{};for(var r=t.domain,o=t.range,l=o.length,u=new Array(l),c=0;c4/3-s?o:s}},{}],384:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":497}],385:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],386:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),a=t("has-hover"),i=t("has-passive-events"),o=t("../../lib").removeElement,s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");function c(){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 f(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){var e,r,n,u,d,h,p,g,v=t.gd,m=1,y=v._context.doubleClickDelay,b=t.element;v._mouseDownTime||(v._mouseDownTime=0),b.style.pointerEvents="all",b.onmousedown=_,i?(b._ontouchstart&&b.removeEventListener("touchstart",b._ontouchstart),b._ontouchstart=_,b.addEventListener("touchstart",_,{passive:!1})):b.ontouchstart=_;var x=t.clampFn||function(t,e,r){return Math.abs(t)y&&(m=Math.max(m-1,1)),v._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(m,h),!g){var r;try{r=new MouseEvent("click",e)}catch(t){var n=f(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)}p.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},l.coverSlip=c},{"../../lib":497,"../../plots/cartesian/constants":551,"./align":383,"./cursor":384,"./unhover":387,"has-hover":237,"has-passive-events":238,"mouse-event-offset":253}],387:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=t("../../lib/throttle"),i=t("../../lib/dom").getGraphDiv,o=t("../fx/constants"),s=e.exports={};s.wrapped=function(t,e,r){(t=i(t))._fullLayout&&a.clear(t._fullLayout._uid+o.HOVERID),s.raw(t,e,r)},s.raw=function(t,e){var r=t._fullLayout,a=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&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/dom":487,"../../lib/events":488,"../../lib/throttle":522,"../fx/constants":401}],388:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],389:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("tinycolor2"),o=t("../../registry"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=u.strTranslate,f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),h=t("../../constants/alignment").LINE_SPACING,p=t("../../constants/interactions").DESELECTDIM,g=t("../../traces/scatter/subtypes"),v=t("../../traces/scatter/make_bubble_size_func"),m=t("../../components/fx/helpers").appendArrayPointValue,y=e.exports={};y.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)},y.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},y.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},y.setRect=function(t,e,r,n,a){t.call(y.setPosition,e,r).call(y.setSize,n,a)},y.translatePoint=function(t,e,r,n){var i=r.c2p(t.x),o=n.c2p(t.y);return!!(a(i)&&a(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",o):e.attr("transform",c(i,o)),!0)},y.translatePoints=function(t,e,r){t.each((function(t){var a=n.select(this);y.translatePoint(t,a,e,r)}))},y.hideOutsideRangePoint=function(t,e,r,n,a,i){e.attr("display",r.isPtWithinRange(t,a)&&n.isPtWithinRange(t,i)?null:"none")},y.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,a=e.yaxis;t.each((function(e){var i=e[0].trace,s=i.xcalendar,l=i.ycalendar,u=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";t.selectAll(u).each((function(t){y.hideOutsideRangePoint(t,n.select(this),r,a,s,l)}))}))}},y.crispRound=function(t,e,r){return e&&a(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},y.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,l=a||i.dash||"";s.stroke(e,n||i.color),y.dashLine(e,l,o)},y.lineGroupStyle=function(t,e,r,a){t.style("fill","none").each((function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,l=a||i.dash||"";n.select(this).call(s.stroke,r||i.color).call(y.dashLine,l,o)}))},y.dashLine=function(t,e,r){r=+r||0,e=y.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},y.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},y.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},y.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 b=t("./symbol_defs");y.symbolNames=[],y.symbolFuncs=[],y.symbolNeedLines={},y.symbolNoDot={},y.symbolNoFill={},y.symbolList=[],Object.keys(b).forEach((function(t){var e=b[t],r=e.n;y.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),y.symbolNames[r]=t,y.symbolFuncs[r]=e.f,e.needLine&&(y.symbolNeedLines[r]=!0),e.noDot?y.symbolNoDot[r]=!0:y.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(y.symbolNoFill[r]=!0)}));var x=y.symbolNames.length;function _(t,e){var r=t%100;return y.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}y.symbolNumber=function(t){if(a(t))t=+t;else 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=y.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=x||t>=400?0:Math.floor(Math.max(t,0))};var w={x1:1,x2:0,y1:0,y2:0},A={x1:0,x2:0,y1:1,y2:0},T=n.format("~.1f"),k={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:w},horizontalreversed:{node:"linearGradient",attrs:w,reversed:!0},vertical:{node:"linearGradient",attrs:A},verticalreversed:{node:"linearGradient",attrs:A,reversed:!0}};y.gradient=function(t,e,r,a,o,l){for(var c=o.length,f=k[a],d=new Array(c),h=0;h"+m(t);p._gradientUrlQueryParts[y]=1},y.initGradients=function(t){var e=t._fullLayout;u.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},y.pointStyle=function(t,e,r){if(t.size()){var a=y.makePointStyleFns(e);t.each((function(t){y.singlePointStyle(t,n.select(this),e,a,r)}))}},y.singlePointStyle=function(t,e,r,n,a){var i=r.marker,o=i.line;if(e.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(t):void 0===t.mo?i.opacity:t.mo),n.ms2mrc){var l;l="various"===t.ms||"various"===i.size?3:n.ms2mrc(t.ms),t.mrc=l,n.selectedSizeFn&&(l=t.mrc=n.selectedSizeFn(t));var c=y.symbolNumber(t.mx||i.symbol)||0;t.om=c%200>=100,e.attr("d",_(c,l))}var f,d,h,p=!1;if(t.so)h=o.outlierwidth,d=o.outliercolor,f=i.outliercolor;else{var g=(o||{}).width;h=(t.mlw+1||g+1||(t.trace?(t.trace.marker.line||{}).width:0)+1)-1||0,d="mlc"in t?t.mlcc=n.lineScale(t.mlc):u.isArrayOrTypedArray(o.color)?s.defaultLine:o.color,u.isArrayOrTypedArray(i.color)&&(f=s.defaultLine,p=!0),f="mc"in t?t.mcc=n.markerScale(t.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(t))}if(t.om)e.call(s.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",(t.isBlank?0:h)+"px");var v=i.gradient,m=t.mgt;if(m?p=!0:m=v&&v.type,Array.isArray(m)&&(m=m[0],k[m]||(m=0)),m&&"none"!==m){var b=t.mgc;b?p=!0:b=v.color;var x=r.uid;p&&(x+="-"+t.i),y.gradient(e,a,x,m,[[0,b],[1,f]],"fill")}else s.fill(e,f);h&&s.stroke(e,d)}},y.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=y.tryColorscale(r,""),e.lineScale=y.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=g.isBubble(t)?v(t):function(){return(r.size||6)/2}),t.selectedpoints&&u.extendFlat(e,y.makeSelectedPointStyleFns(t)),e},y.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.marker||{},i=r.marker||{},s=n.marker||{},l=a.opacity,c=i.opacity,f=s.opacity,d=void 0!==c,h=void 0!==f;(u.isArrayOrTypedArray(l)||d||h)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?a.opacity:t.mo;return t.selected?d?c:e:h?f:p*e});var g=a.color,v=i.color,m=s.color;(v||m)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?v||e:m||e});var y=a.size,b=i.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},y.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.textfont||{},i=r.textfont||{},o=n.textfont||{},l=a.color,u=i.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,p))},e},y.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.makeSelectedPointStyleFns(e),a=e.marker||{},i=[];r.selectedOpacityFn&&i.push((function(t,e){t.style("opacity",r.selectedOpacityFn(e))})),r.selectedColorFn&&i.push((function(t,e){s.fill(t,r.selectedColorFn(e))})),r.selectedSizeFn&&i.push((function(t,e){var n=e.mx||a.symbol||0,i=r.selectedSizeFn(e);t.attr("d",_(y.symbolNumber(n),i)),e.mrc2=i})),i.length&&t.each((function(t){for(var e=n.select(this),r=0;r0?r:0}y.textPointStyle=function(t,e,r){if(t.size()){var a;if(e.selectedpoints){var i=y.makeSelectedTextStyleFns(e);a=i.selectedTextColorFn}var o=e.texttemplate,s=r._fullLayout;t.each((function(t){var i=n.select(this),l=o?u.extractOption(t,e,"txt","texttemplate"):u.extractOption(t,e,"tx","text");if(l||0===l){if(o){var c=e._module.formatLabels?e._module.formatLabels(t,e,s):{},d={};m(d,e,t.i);var h=e._meta||{};l=u.texttemplateString(l,c,s._d3locale,d,t,h)}var p=t.tp||e.textposition,g=S(t,e),v=a?a(t):t.tc||e.textfont.color;i.call(y.font,t.tf||e.textfont.family,g,v).text(l).call(f.convertToTspans,r).call(E,p,g,t.mrc)}else i.remove()}))}},y.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.makeSelectedTextStyleFns(e);t.each((function(t){var a=n.select(this),i=r.selectedTextColorFn(t),o=t.tp||e.textposition,l=S(t,e);s.fill(a,i),E(a,o,l,t.mrc2||t.mrc)}))}};function C(t,e,r,a){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+o*o,.25),c=Math.pow(s*s+l*l,.25),f=(c*c*i-u*u*s)*a,d=(c*c*o-u*u*l)*a,h=3*c*(u+c),p=3*u*(u+c);return[[n.round(e[0]+(h&&f/h),2),n.round(e[1]+(h&&d/h),2)],[n.round(e[0]-(p&&f/p),2),n.round(e[1]-(p&&d/p),2)]]}y.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(y.savedBBoxes={},D=0),r&&(y.savedBBoxes[r]=v),D++,u.extendFlat({},v)},y.setClipUrl=function(t,e,r){t.attr("clip-path",I(e,r))},y.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}},y.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=c(e,r)).trim(),t[a]("transform",i),i},y.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}},y.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+="scale("+e+","+r+")").trim(),t[a]("transform",i),i};var P=/\s*sc.*/;y.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(P,"");t=(t+=n).trim(),this.setAttribute("transform",t)}))}};var F=/translate\([^)]*\)\s*$/;y.setTextPointsScale=function(t,e,r){t&&t.each((function(){var t,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(a.attr("transform")||"").match(F);t=1===e&&1===r?[]:[c(o,s),"scale("+e+","+r+")",c(-o,-s)],l&&t.push(l),a.attr("transform",t.join(""))}}))}},{"../../components/fx/helpers":403,"../../constants/alignment":469,"../../constants/interactions":473,"../../constants/xmlns_namespaces":475,"../../lib":497,"../../lib/svg_text_utils":521,"../../registry":591,"../../traces/scatter/make_bubble_size_func":669,"../../traces/scatter/subtypes":677,"../color":367,"../colorscale":379,"./symbol_defs":390,d3:86,"fast-isnumeric":155,tinycolor2:321}],390:[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,a="l"+e+",-"+e,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+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),a=n.round(-t,2),i=n.round(-.309*t,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"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),a=n.round(.951*e,2),i=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"+a+"L"+i+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"L-"+o+","+c+"L-"+i+","+u+"L-"+a+","+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),a=n.round(.76*t,2);return"M-"+a+",0l-"+r+",-"+e+"h"+a+"l"+r+",-"+e+"l"+r+","+e+"h"+a+"l-"+r+","+e+"l"+r+","+e+"h-"+a+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+a+"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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+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),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"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),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"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),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+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),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:86}],391:[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"}}}},{}],392:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../registry"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),s=t("./compute_error");function l(t,e,r,a){var l=e["error_"+a]||{},u=[];if(l.visible&&-1!==["linear","log"].indexOf(r.type)){for(var c=s(l),f=0;f0;e.each((function(e){var f,d=e[0].trace,h=d.error_x||{},p=d.error_y||{};d.ids&&(f=function(t){return t.id});var g=o.hasMarkers(d)&&d.marker.maxdisplayed>0;p.visible||h.visible||(e=[]);var v=n.select(this).selectAll("g.errorbar").data(e,f);if(v.exit().remove(),e.length){h.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),i.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),a(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),a(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0)));return n}(t,l,u);if(!g||t.vis){var i,o=e.select("path.yerror");if(p.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var f=p.width;i="M"+(r.x-f)+","+r.yh+"h"+2*f+"m-"+f+",0V"+r.ys,r.noYS||(i+="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",i)}else o.remove();var d=e.select("path.xerror");if(h.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var v=(h.copy_ystyle?p:h).width;i="M"+r.xh+","+(r.y-v)+"v"+2*v+"m0,-"+v+"H"+r.xs,r.noXS||(i+="m0,-"+v+"v"+2*v),!d.size()?d=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):c&&(d=d.transition().duration(s.duration).ease(s.easing)),d.attr("d",i)}else d.remove()}}))}}))}},{"../../traces/scatter/subtypes":677,"../drawing":389,d3:86,"fast-isnumeric":155}],397:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each((function(t){var e=t[0].trace,r=e.error_y||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":367,d3:86}],398:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("./layout_attributes").hoverlabel,i=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":489,"../../plots/font_attributes":573,"./layout_attributes":408}],399:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry");function i(t,e,r,a){a=a||n.identity,Array.isArray(t)&&(e[0][r]=a(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.indexx[0]._length||tt<0||tt>_[0]._length)return p.unhoverRaw(t,e)}if(e.pointerX=K+x[0]._offset,e.pointerY=tt+_[0]._offset,C="xval"in e?m.flat(s,e.xval):m.p2c(x,K),O="yval"in e?m.flat(s,e.yval):m.p2c(_,tt),!a(C[0])||!a(O[0]))return o.warn("Fx.hover failed",e,t),p.unhoverRaw(t,e)}var nt=1/0;function at(t,r){for(z=0;zX&&(Z.splice(0,X),nt=Z[0].distance),g&&0!==Y&&0===Z.length){q.distance=Y,q.index=!1;var f=B._module.hoverPoints(q,H,G,"closest",l._hoverlayer);if(f&&(f=f.filter((function(t){return t.spikeDistance<=Y}))),f&&f.length){var d,p=f.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(p.length){var v=p[0];a(v.x0)&&a(v.y0)&&(d=ot(v),(!Q.vLinePoint||Q.vLinePoint.spikeDistance>d.spikeDistance)&&(Q.vLinePoint=d))}var y=f.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(y.length){var b=y[0];a(b.x0)&&a(b.y0)&&(d=ot(b),(!Q.hLinePoint||Q.hLinePoint.spikeDistance>d.spikeDistance)&&(Q.hLinePoint=d))}}}}}function it(t,e){for(var r,n=null,a=1/0,i=0;i1||Z.length>1)||"closest"===E&&$&&Z.length>1,Mt=h.combine(l.plot_bgcolor||h.background,l.paper_bgcolor),Et={hovermode:E,rotateLabels:kt,bgColor:Mt,container:l._hoverlayer,outerContainer:l._paperdiv,commonLabelOpts:l.hoverlabel,hoverdistance:l.hoverdistance},St=L(Z,Et,t);m.isUnifiedHover(E)||(!function(t,e,r){var n,a,i,o,s,l,u,c=0,f=1,d=t.size(),h=new Array(d),p=0;function g(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=i;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-=i;for(o=t.length-1;o>=0&&!(u<=0);o--)(l=t[o]).pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}t.each((function(t){var n=t[e],a="x"===n._id.charAt(0),i=n.range;0===p&&i&&i[0]>i[1]!==a&&(f=-1),h[p++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(a?A:1)/2,pmin:0,pmax:a?r.width:r.height}]})),h.sort((function(t,e){return t[0].posref-e[0].posref||f*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&c<=d;){for(c++,n=!0,o=0;o.01&&y.pmin===b.pmin&&y.pmax===b.pmax){for(s=m.length-1;s>=0;s--)m[s].dp+=a;for(v.push.apply(v,m),h.splice(o+1,1),u=0,s=v.length-1;s>=0;s--)u+=v[s].dp;for(i=u/v.length,s=v.length-1;s>=0;s--)v[s].dp-=i;n=!1}else o++}h.forEach(g)}for(o=h.length-1;o>=0;o--){var x=h[o];for(s=x.length-1;s>=0;s--){var _=x[s],w=_.datum;w.offset=_.dp,w.del=_.del}}}(St,kt?"xa":"ya",l),D(St,kt,l._invScaleX,l._invScaleY));if(e.target&&e.target.tagName){var Ct=v.getComponentMethod("annotations","hasClickToShow")(t,_t);f(n.select(e.target),Ct?"pointer":"")}if(!e.target||i||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(t,0,xt))return;xt&&t.emit("plotly_unhover",{event:e,points:xt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:x,yaxes:_,xvals:C,yvals:O})}(t,e,r,i)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var a=t.map((function(t){return{color:t.color||h.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,nameLength:t.nameLength,textAlign:t.textAlign,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),o=e.outerContainer?n.select(e.outerContainer):i,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||h.background,container:i,outerContainer:o},l=L(a,s,e.gd),u=0,c=0;l.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function L(t,e,r){var a=r._fullLayout,i=e.hovermode,u=e.rotateLabels,f=e.bgColor,p=e.container,g=e.outerContainer,v=e.commonLabelOpts||{},w=e.fontFamily||y.HOVERFONT,A=e.fontSize||y.HOVERFONTSIZE,T=t[0],k=T.xa,C=T.ya,L="y"===i.charAt(0)?"yLabel":"xLabel",D=T[L],R=(String(D)||"").split(" ")[0],I=g.node().getBoundingClientRect(),P=I.top,F=I.width,z=I.height,N=void 0!==D&&T.distance<=e.hoverdistance&&("x"===i||"y"===i);if(N){var B,j,U=!0;for(B=0;Ba.width-S?(y=a.width-S,l.attr("d","M"+(S-M)+",0L"+S+","+_+M+"v"+_+(2*E+x.height)+"H-"+S+"V"+_+M+"H"+(S-2*M)+"Z")):l.attr("d","M0,0L"+M+","+_+M+"H"+(E+x.width/2)+"v"+_+(2*E+x.height)+"H-"+(E+x.width/2)+"V"+_+M+"H-"+M+"Z")}else{var L,O,R;"right"===C.side?(L="start",O=1,R="",y=k._offset+k._length):(L="end",O=-1,R="-",y=k._offset),b=C._offset+(T.y0+T.y1)/2,u.attr("text-anchor",L),l.attr("d","M0,0L"+R+M+","+M+"V"+(E+x.height/2)+"h"+R+(2*E+x.width)+"V-"+(E+x.height/2)+"H"+R+M+"V-"+M+"Z");var I,F=x.height/2,z=P-x.top-F,N="clip"+a._uid+"commonlabel"+C._id;if(y=0?et-=at:et+=2*E;var it=nt.height+2*E,ot=tt+it>=z;return it<=z&&(tt<=P?tt=C._offset+2*E:ot&&(tt=z-it)),rt.attr("transform",s(et,tt)),rt}var st=p.selectAll("g.hovertext").data(t,(function(t){return S(t)}));return st.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(h.fill,h.addOpacity(f,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(d.font,w,A)})),st.exit().remove(),st.each((function(t){var e=n.select(this).attr("transform",""),o=t.color;Array.isArray(o)&&(o=o[t.eventData[0].pointNumber]);var p=t.bgcolor||o,g=h.combine(h.opacity(p)?p:h.defaultLine,f),v=h.combine(h.opacity(o)?o:h.defaultLine,f),m=t.borderColor||h.contrast(g),y=O(t,N,i,a,D,e),b=y[0],x=y[1],T=e.select("text.nums").call(d.font,t.fontFamily||w,t.fontSize||A,t.fontColor||m).text(b).attr("data-notex",1).call(c.positionText,0,0).call(c.convertToTspans,r),k=e.select("text.name"),S=0,C=0;if(x&&x!==b){k.call(d.font,t.fontFamily||w,t.fontSize||A,v).text(x).attr("data-notex",1).call(c.positionText,0,0).call(c.convertToTspans,r);var L=k.node().getBoundingClientRect();S=L.width+2*E,C=L.height+2*E}else k.remove(),e.select("rect").remove();e.select("path").style({fill:g,stroke:m});var R,I,B=T.node().getBoundingClientRect(),j=t.xa._offset+(t.x0+t.x1)/2,U=t.ya._offset+(t.y0+t.y1)/2,V=Math.abs(t.x1-t.x0),H=Math.abs(t.y1-t.y0),G=B.width+M+E+S;if(t.ty0=P-B.top,t.bx=B.width+2*E,t.by=Math.max(B.height+2*E,C),t.anchor="start",t.txwidth=B.width,t.tx2width=S,t.offset=0,u)t.pos=j,R=U+H/2+G<=z,I=U-H/2-G>=0,"top"!==t.idealAlign&&R||!I?R?(U+=H/2,t.anchor="start"):t.anchor="middle":(U-=H/2,t.anchor="end");else if(t.pos=U,R=j+V/2+G<=F,I=j-V/2-G>=0,"left"!==t.idealAlign&&R||!I)if(R)j+=V/2,t.anchor="start";else{t.anchor="middle";var q=G/2,X=j+q-F,W=j-q;X>0&&(j-=X),W<0&&(j+=-W)}else j-=V/2,t.anchor="end";T.attr("text-anchor",t.anchor),S&&k.attr("text-anchor",t.anchor),e.attr("transform",s(j,U)+(u?l(_):""))})),st}function O(t,e,r,n,a,i){var s="",l="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),s=F(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(l+=(l?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===a?l=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(l+=(l?"
":"")+t.text),void 0!==t.extraText&&(l+=(l?"
":"")+t.extraText),i&&""===l&&!t.hovertemplate&&(""===s&&i.remove(),l=s);var u=n._d3locale,c=t.hovertemplate||!1,f=t.hovertemplateLabels||t,d=t.eventData[0]||{};return c&&(l=(l=o.hovertemplateString(c,f,u,d,t.trace._meta)).replace(C,(function(e,r){return s=F(r,t.nameLength),""}))),[l,s]}function D(t,e,r,a){var i=function(t){return t*r},o=function(t){return t*a};t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var a=r.select("text.nums"),s=t.anchor,l="end"===s?-1:1,u={start:1,end:-1,middle:0}[s],f=u*(M+E),h=f+u*(t.txwidth+E),p=0,g=t.offset,v="middle"===s;v&&(f-=t.tx2width/2,h+=t.txwidth/2+E),e&&(g*=-k,p=t.offset*T),r.select("path").attr("d",v?"M-"+i(t.bx/2+t.tx2width/2)+","+o(g-t.by/2)+"h"+i(t.bx)+"v"+o(t.by)+"h-"+i(t.bx)+"Z":"M0,0L"+i(l*M+p)+","+o(M+g)+"v"+o(t.by/2-M)+"h"+i(l*t.bx)+"v-"+o(t.by)+"H"+i(l*M+p)+"V"+o(g-M)+"Z");var m=p+f,y=g+t.ty0-t.by/2+E,b=t.textAlign||"auto";"auto"!==b&&("left"===b&&"start"!==s?(a.attr("text-anchor","start"),m=v?-t.bx/2-t.tx2width/2+E:-t.bx-E):"right"===b&&"end"!==s&&(a.attr("text-anchor","end"),m=v?t.bx/2-t.tx2width/2-E:t.bx+E)),a.call(c.positionText,i(m),o(y)),t.tx2width&&(r.select("text.name").call(c.positionText,i(h+u*E+p),o(g+t.ty0-t.by/2+E)),r.select("rect").call(d.setRect,i(h+(u-1)*t.tx2width/2+p),o(g-t.by/2-1),i(t.tx2width),o(t.by+2)))}))}function R(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],s=t.cd[r]||{};function l(t){return t||a(t)&&0===t}var u=Array.isArray(r)?function(t,e){var a=o.castOption(i,r,t);return l(a)?a:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(s,n,t,e)};function c(e,r,n){var a=u(r,n);l(a)&&(t[e]=a)}if(c("hoverinfo","hi","hoverinfo"),c("bgcolor","hbg","hoverlabel.bgcolor"),c("borderColor","hbc","hoverlabel.bordercolor"),c("fontFamily","htf","hoverlabel.font.family"),c("fontSize","hts","hoverlabel.font.size"),c("fontColor","htc","hoverlabel.font.color"),c("nameLength","hnl","hoverlabel.namelength"),c("textAlign","hta","hoverlabel.align"),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:g.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:g.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 f=g.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+f+" / -"+g.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+f,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var d=g.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+d+" / -"+g.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+d,"y"===e&&(t.distance+=1)}var h=t.hoverinfo||t.trace.hoverinfo;return h&&"all"!==h&&(-1===(h=Array.isArray(h)?h:h.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===h.indexOf("y")&&(t.yLabel=void 0),-1===h.indexOf("z")&&(t.zLabel=void 0),-1===h.indexOf("text")&&(t.text=void 0),-1===h.indexOf("name")&&(t.name=void 0)),t}function I(t,e,r){var n,a,o=r.container,s=r.fullLayout,l=s._size,u=r.event,c=!!e.hLinePoint,f=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),f||c){var p=h.combine(s.plot_bgcolor,s.paper_bgcolor);if(c){var v,m,y=e.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(v=u.pointerX,m=u.pointerY):(v=n._offset+y.x,m=a._offset+y.y);var b,x,_=i.readability(y.color,p)<1.5?h.contrast(p):y.color,w=a.spikemode,A=a.spikethickness,T=a.spikecolor||_,k=g.getPxPosition(t,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(b=k,x=v),-1!==w.indexOf("across")){var M=a._counterDomainMin,E=a._counterDomainMax;"free"===a.anchor&&(M=Math.min(M,a.position),E=Math.max(E,a.position)),b=l.l+M*l.w,x=l.l+E*l.w}o.insert("line",":first-child").attr({x1:b,x2:x,y1:m,y2:m,"stroke-width":A,stroke:T,"stroke-dasharray":d.dashStyle(a.spikedash,A)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:b,x2:x,y1:m,y2:m,"stroke-width":A+2,stroke:p}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:k+("right"!==a.side?A:-A),cy:m,r:A,fill:T}).classed("spikeline",!0)}if(f){var S,C,L=e.vLinePoint;n=L&&L.xa,a=L&&L.ya,"cursor"===n.spikesnap?(S=u.pointerX,C=u.pointerY):(S=n._offset+L.x,C=a._offset+L.y);var O,D,R=i.readability(L.color,p)<1.5?h.contrast(p):L.color,I=n.spikemode,P=n.spikethickness,F=n.spikecolor||R,z=g.getPxPosition(t,n);if(-1!==I.indexOf("toaxis")||-1!==I.indexOf("across")){if(-1!==I.indexOf("toaxis")&&(O=z,D=C),-1!==I.indexOf("across")){var N=n._counterDomainMin,B=n._counterDomainMax;"free"===n.anchor&&(N=Math.min(N,n.position),B=Math.max(B,n.position)),O=l.t+(1-B)*l.h,D=l.t+(1-N)*l.h}o.insert("line",":first-child").attr({x1:S,x2:S,y1:O,y2:D,"stroke-width":P,stroke:F,"stroke-dasharray":d.dashStyle(n.spikedash,P)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:S,x2:S,y1:O,y2:D,"stroke-width":P+2,stroke:p}).classed("spikeline",!0).classed("crisp",!0)}-1!==I.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:S,cy:z-("top"!==n.side?P:-P),r:P,fill:F}).classed("spikeline",!0)}}}function P(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function F(t,e){return c.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":497,"../../lib/events":488,"../../lib/override_cursor":508,"../../lib/svg_text_utils":521,"../../plots/cartesian/axes":545,"../../registry":591,"../color":367,"../dragelement":386,"../drawing":389,"../legend/defaults":419,"../legend/draw":420,"./constants":401,"./helpers":403,d3:86,"fast-isnumeric":155,tinycolor2:321}],405:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),i=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function s(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&i(e.hovermode)&&(o.font||(o.font={}),s("size"),s("family"),s("color"),e.legend?(o.bgcolor||(o.bgcolor=a.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":497,"../color":367,"./helpers":403}],406:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function i(r,i){return void 0!==e[r]?e[r]:n.coerce(t,e,a,r,i)}var o,s=i("clickmode");return e._has("cartesian")?s.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!d&&!h&&!p)"independent"===T("pattern")&&(d=!0);v._hasSubplotGrid=d;var b,x,_="top to bottom"===T("roworder"),w=d?.2:.1,A=d?.3:.1;g&&e._splomGridDflt&&(b=e._splomGridDflt.xside,x=e._splomGridDflt.yside),v._domains={x:c("x",T,w,b,y),y:c("y",T,A,x,m,_)}}else delete e.grid}function T(t,e){return n.coerce(r,v,l,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,a,i,o,s,l,c,d=t.grid||{},h=e._subplots,p=r._hasSubplotGrid,g=r.rows,v=r.columns,m="independent"===r.pattern,y=r._axisMap={};if(p){var b=d.subplots||[];l=r.subplots=new Array(g);var x=1;for(n=0;n1);if(!1!==g||u.uirevision){var v=i.newContainer(e,"legend");if(_("uirevision",e.uirevision),!1!==g){_("bgcolor",e.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",e.font);var m,y,b,x=_("orientation");"h"===x?(m=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(y=1.1,b="bottom"):(y=-.1,b="top")):(m=1.02,y=1,b="auto"),_("traceorder",d),l.isGrouped(e.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemwidth"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",b),_("valign"),a.noneOrAll(u,v,["x","y"]),_("title.text")&&(_("title.side","h"===x?"left":"top"),a.coerceFont(_,"title.font",e.font))}}function _(t,e){return a.coerce(u,v,o,t,e)}}},{"../../lib":497,"../../plot_api/plot_template":534,"../../plots/layout_attributes":581,"../../registry":591,"./attributes":417,"./helpers":423}],420:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=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"),d=t("./handle_click"),h=t("./constants"),p=t("../../constants/alignment"),g=p.LINE_SPACING,v=p.FROM_TL,m=p.FROM_BR,y=t("./get_legend_data"),b=t("./style"),x=t("./helpers");function _(t,e,r,n,a){var i=r.data()[0][0].trace,l={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(i._group&&(l.group=i._group),o.traceIs(i,"pie-like")&&(l.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",l))if(1===n)e._clickTimeout=setTimeout((function(){d(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",l)&&d(r,t,n)}}function w(t,e,r){var n,i=t.data()[0][0],s=i.trace,l=o.traceIs(s,"pie-like"),c=s.index,d=r._main&&e._context.edits.legendText&&!l,p=r._maxNameLength;r.entries?n=i.text:(n=l?i.label:s.name,s._meta&&(n=a.templateString(n,s._meta)));var g=a.ensureSingle(t,"text","legendtext");g.attr("text-anchor","start").call(u.font,r.font).text(d?A(n,p):n);var v=r.itemwidth+2*h.itemGap;f.positionText(g,v,0),d?g.call(f.makeEditable,{gd:e,text:n}).call(k,t,e,r).on("edit",(function(n){this.text(A(n,p)).call(k,t,e,r);var s=i.trace._fullInput||{},l={};if(o.hasTransform(s,"groupby")){var u=o.getTransformIndices(s,"groupby"),f=u[u.length-1],d=a.keyedContainer(s,"transforms["+f+"].styles","target","value.name");d.set(i.trace._group,n),l=d.constructUpdate()}else l.name=n;return o.call("_guiRestyle",e,l,c)})):k(g,t,e,r)}function A(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 T(t,e){var r,i=e._context.doubleClickDelay,o=1,s=a.ensureSingle(t,"rect","legendtoggle",(function(t){e._context.staticPlot||t.style("cursor","pointer").attr("pointer-events","all"),t.call(c.fill,"rgba(0,0,0,0)")}));e._context.staticPlot||(s.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(e,r,t,o,n.event)}})))}function k(t,e,r,n){n._main||t.attr("data-notex",!0),f.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var a=t.select("g[class*=math-group]"),i=a.node();r||(r=e._fullLayout.legend);var o,s,l=r.borderwidth,c=(n?r:r.title).font.size*g;if(i){var d=u.bBox(i);o=d.height,s=d.width,n?u.setTranslate(a,0,.25*o):u.setTranslate(a,l,.75*o+l)}else{var p=t.select(n?".legendtext":".legendtitletext"),v=f.lineCount(p),m=p.node();o=c*v,s=m?u.bBox(m).width:0;var y=c*((v-1)/2-.3);if(n){var b=r.itemwidth+2*h.itemGap;f.positionText(p,b,-y)}else f.positionText(p,h.titlePad+l,c+l)}n?(n.lineHeight=c,n.height=Math.max(o,16)+3,n.width=s):(r._titleWidth=s,r._titleHeight=o)}(e,r,n)}))}function M(t){return a.isRightAnchor(t)?"right":a.isCenterAnchor(t)?"center":"left"}function E(t){return a.isBottomAnchor(t)?"bottom":a.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,s=t._fullLayout,f="legend"+s._uid;if(e?(r=e.layer,f+="-hover"):((e=s.legend||{})._main=!0,r=s._infolayer),r){var d;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;d=s.showlegend&&y(t.calcdata,e)}else{if(!e.entries)return;d=y(e.entries,e)}var p=s.hiddenlabels||[];if(e._main&&(!s.showlegend||!d.length))return r.selectAll(".legend").remove(),s._topdefs.select("#"+f).remove(),i.autoMargin(t,"legend");var g=a.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),A=a.ensureSingleById(s._topdefs,"clipPath",f,(function(t){t.append("rect")})),S=a.ensureSingle(g,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));S.call(c.stroke,e.bordercolor).call(c.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),L=e.title;if(e._titleWidth=0,e._titleHeight=0,L.text){var O=a.ensureSingle(C,"text","legendtitletext");O.attr("text-anchor","start").call(u.font,L.font).text(L.text),k(O,C,t,e)}else C.selectAll(".legendtitletext").remove();var D=a.ensureSingle(g,"rect","scrollbar",(function(t){t.attr(h.scrollBarEnterAttrs).call(c.fill,h.scrollBarColor)})),R=C.selectAll("g.groups").data(d);R.enter().append("g").attr("class","groups"),R.exit().remove();var I=R.selectAll("g.traces").data(a.identity);I.enter().append("g").attr("class","traces"),I.exit().remove(),I.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==p.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(b,t,e).each((function(){e._main&&n.select(this).call(T,t)})),a.syncOrAsync([i.previousPromises,function(){return function(t,e,r,a){var i=t._fullLayout;a||(a=i.legend);var o=i._size,s=x.isVertical(a),l=x.isGrouped(a),c=a.borderwidth,f=2*c,d=h.itemGap,p=a.itemwidth+2*d,g=2*(c+d),v=E(a),m=a.y<0||0===a.y&&"top"===v,y=a.y>1||1===a.y&&"bottom"===v;a._maxHeight=Math.max(m||y?i.height/2:o.h,30);var b=0;a._width=0,a._height=0;var _=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(a);if(s)r.each((function(t){var e=t[0].height;u.setTranslate(this,c+_[0],c+_[1]+a._height+e/2+d),a._height+=e,a._width=Math.max(a._width,t[0].width)})),b=p+a._width,a._width+=d+p+f,a._height+=g,l&&(e.each((function(t,e){u.setTranslate(this,0,e*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=M(a),A=a.x<0||0===a.x&&"right"===w,T=a.x>1||1===a.x&&"left"===w,k=y||m,S=i.width/2;a._maxWidth=Math.max(A?k&&"left"===w?o.l+o.w:S:T?k&&"right"===w?o.r+o.w:S:o.w,2*p);var C=0,L=0;r.each((function(t){var e=t[0].width+p;C=Math.max(C,e),L+=e})),b=null;var O=0;if(l){var D=0,R=0,I=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;u.setTranslate(this,_[0],_[1]+c+d+n/2+e),e+=n,t=Math.max(t,p+r[0].width)})),D=Math.max(D,e);var r=t+d;r+c+R>a._maxWidth&&(O=Math.max(O,R),R=0,I+=D+a.tracegroupgap,D=e),u.setTranslate(this,R,I),R+=r})),a._width=Math.max(O,R)+c,a._height=I+D+g}else{var P=r.size(),F=L+f+(P-1)*d=a._maxWidth&&(O=Math.max(O,j),N=0,B+=z,a._height+=z,z=0),u.setTranslate(this,_[0]+c+N,_[1]+c+B+e/2+d),j=N+r+d,N+=n,z=Math.max(z,e)})),F?(a._width=N+f,a._height=z+g):(a._width=Math.max(O,j)+f,a._height+=z+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(c+h.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(c+h.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var U=t._context.edits,V=U.legendText||U.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,a=V?p:b||p+t[0].width;s||(a+=d/2),u.setRect(e,0,-r/2,a,r)}))}(t,R,I,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=M(e),n=E(e);return i.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*v[r],r:e._width*m[r],b:e._effHeight*m[n],t:e._effHeight*v[n]})}(t)){var c,d,p,y,b=s._size,x=e.borderwidth,w=b.l+b.w*e.x-v[M(e)]*e._width,T=b.t+b.h*(1-e.y)-v[E(e)]*e._effHeight;if(e._main&&s.margin.autoexpand){var k=w,L=T;w=a.constrain(w,0,s.width-e._width),T=a.constrain(T,0,s.height-e._effHeight),w!==k&&a.log("Constrain legend.x to make legend fit inside graph"),T!==L&&a.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&u.setTranslate(g,w,T),D.on(".drag",null),g.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var O=e._effHeight;e._main||(O=e._height),S.attr({width:e._width-x,height:O-x,x:x/2,y:x/2}),u.setTranslate(C,0,0),A.select("rect").attr({width:e._width-2*x,height:O-2*x,x:x,y:x}),u.setClipUrl(C,f,t),u.setRect(D,0,0,0,0),delete e._scrollY}else{var R,I,P,F=Math.max(h.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),z=e._effHeight-F-2*h.scrollBarMargin,N=e._height-e._effHeight,B=z/N,j=Math.min(e._scrollY||0,N);S.attr({width:e._width-2*x+h.scrollBarWidth+h.scrollBarMargin,height:e._effHeight-x,x:x/2,y:x/2}),A.select("rect").attr({width:e._width-2*x+h.scrollBarWidth+h.scrollBarMargin,height:e._effHeight-2*x,x:x,y:x+j}),u.setClipUrl(C,f,t),H(j,F,B),g.on("wheel",(function(){H(j=a.constrain(e._scrollY+n.event.deltaY/z*N,0,N),F,B),0!==j&&j!==N&&n.event.preventDefault()}));var U=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;R="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,P=j})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(I="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,H(j=function(t,e,r){var n=(r-e)/B+t;return a.constrain(n,0,N)}(P,R,I),F,B))}));D.call(U);var V=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(R=t.changedTouches[0].clientY,P=j)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(I=t.changedTouches[0].clientY,H(j=function(t,e,r){var n=(e-r)/B+t;return a.constrain(n,0,N)}(P,R,I),F,B))}));C.call(V)}if(t._context.edits.legendPosition)g.classed("cursor-move",!0),l.init({element:g.node(),gd:t,prepFn:function(){var t=u.getTranslate(g);p=t.x,y=t.y},moveFn:function(t,r){var n=p+t,a=y+r;u.setTranslate(g,n,a),c=l.align(n,0,b.l,b.l+b.w,e.xanchor),d=l.align(a,0,b.t+b.h,b.t,e.yanchor)},doneFn:function(){void 0!==c&&void 0!==d&&o.call("_guiRelayout",t,{"legend.x":c,"legend.y":d})},clickFn:function(e,n){var a=r.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}));a.size()>0&&_(t,g,a,e,n)}})}function H(r,n,a){e._scrollY=t._fullLayout.legend._scrollY=r,u.setTranslate(C,0,-r),u.setRect(D,e._width,h.scrollBarMargin+r*a,h.scrollBarWidth,n),A.select("rect").attr("y",x+r)}}],t)}}},{"../../constants/alignment":469,"../../lib":497,"../../lib/events":488,"../../lib/svg_text_utils":521,"../../plots/plots":583,"../../registry":591,"../color":367,"../dragelement":386,"../drawing":389,"./constants":418,"./get_legend_data":421,"./handle_click":422,"./helpers":423,"./style":425,d3:86}],421:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){var r,i,o={},s=[],l=!1,u={},c=0,f=0,d=e._main;function h(t,r){if(""!==t&&a.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;r0))return 0;a=e.width}return v?n:Math.min(a,r)};function _(t,e,r){var i=t[0].trace,o=i.marker||{},s=o.line||{},u=r?i.visible&&i.type===r:a.traceIs(i,"bar"),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(u?[t]:[]);c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",b),c.exit().remove(),c.each((function(t){var e=n.select(this),r=t[0],a=x(r.mlw,o.line,5,2);e.style("stroke-width",a+"px").call(l.fill,r.mc||o.color),a&&l.stroke(e,r.mlc||s.color)}))}function w(t,e,r){var o=t[0],s=o.trace,l=r?s.visible&&s.type===r:a.traceIs(s,r),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(l?[t]:[]);if(u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",b),u.exit().remove(),u.size()){var c=(s.marker||{}).line,h=x(d(c.width,o.pts),c,5,2),p=i.minExtend(s,{marker:{line:{width:h}}});p.marker.line.color=c.color;var g=i.minExtend(o,{trace:p});f(u,g,p)}}t.each((function(t){var e=n.select(this),a=i.ensureSingle(e,"g","layers");a.style("opacity",t[0].trace.opacity);var s=r.valign,l=t[0].lineHeight,u=t[0].height;if("middle"!==s&&l&&u){var c={top:1,bottom:-1}[s]*(.5*(l-u+3));a.attr("transform",o(0,c))}else a.attr("transform",null);a.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var f=a.selectAll("g.legendsymbols").data([t]);f.enter().append("g").classed("legendsymbols",!0),f.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,a=t[0].trace,o=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":o=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":o=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":o=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":o=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":o=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":o=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var c=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(o);c.enter().append("path").classed("legend3dandfriends",!0).attr("transform",b).style("stroke-miterlimit",1),c.exit().remove(),c.each((function(t,o){var c,f=n.select(this),d=u(a),h=d.colorscale,g=d.reversescale;if(h){if(!r){var v=h.length;c=0===o?h[g?v-1:0][1]:1===o?h[g?0:v-1][1]:h[Math.floor((v-1)/2)][1]}}else{var m=a.vertexcolor||a.facecolor||a.color;c=i.isArrayOrTypedArray(m)?m[o]||m[0]:m}f.attr("d",t[0]),c?f.call(l.fill,c):f.call((function(t){if(t.size()){var n="legendfill-"+a.uid;s.gradient(t,e,n,p(g,"radial"===r),h,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var a=t[0].trace[t[0].dir].marker;return t[0].mc=a.color,t[0].mlw=a.line.width,t[0].mlc=a.line.color,_(t,this,"waterfall")}var i=[];e.visible&&r&&(i=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform",b).style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),a=e[t[0]].marker,i=x(void 0,a.line,5,2);r.attr("d",t[1]).style("stroke-width",i+"px").call(l.fill,a.color),i&&r.call(l.stroke,a.line.color)}))})).each((function(t){_(t,this,"funnel")})).each((function(t){_(t,this)})).each((function(t){var r=t[0].trace,o=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[t]:[]);o.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",b),o.exit().remove(),o.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var a=x(void 0,r.line,5,2);t.style("stroke-width",a+"px").call(l.fill,r.fillcolor),a&&l.stroke(t,r.line.color)}else{var u=i.minExtend(r,{marker:{size:v?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});o.call(s.pointStyle,u,e)}}))})).each((function(t){w(t,this,"funnelarea")})).each((function(t){w(t,this,"pie")})).each((function(t){var r,a,o=t[0],l=o.trace,f=l.visible&&l.fill&&"none"!==l.fill,d=c.hasLines(l),h=l.contours,g=!1,v=!1,y=u(l),b=y.colorscale,_=y.reversescale;if(h){var w=h.coloring;"lines"===w?g=!0:d="none"===w||"heatmap"===w||h.showlines,"constraint"===h.type?f="="!==h._operation:"fill"!==w&&"heatmap"!==w||(v=!0)}var A=c.hasMarkers(l)||c.hasText(l),T=f||v,k=d||g,M=A||!T?"M5,0":k?"M5,-2":"M5,-3",E=n.select(this),S=E.select(".legendfill").selectAll("path").data(f||v?[t]:[]);if(S.enter().append("path").classed("js-fill",!0),S.exit().remove(),S.attr("d",M+"h"+m+"v6h-"+m+"z").call(f?s.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+l.uid;s.gradient(t,e,r,p(_),b,"fill")}}),d||g){var C=x(void 0,l.line,10,5);a=i.minExtend(l,{line:{width:C}}),r=[i.minExtend(o,{trace:a})]}var L=E.select(".legendlines").selectAll("path").data(d||g?[r]:[]);L.enter().append("path").classed("js-line",!0),L.exit().remove(),L.attr("d",M+(g?"l"+m+",0.0001":"h"+m)).call(d?s.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+l.uid;s.lineGroupStyle(t),s.gradient(t,e,r,p(_),b,"stroke")}})})).each((function(t){var r,a,o=t[0],l=o.trace,u=c.hasMarkers(l),f=c.hasText(l),d=c.hasLines(l);function h(t,e,r,n){var a=i.nestedProperty(l,t).get(),o=i.isArrayOrTypedArray(a)&&e?e(a):a;if(v&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function p(t){return o._distinct&&o.index&&t[o.index]?t[o.index]:t[0]}if(u||f||d){var g={},m={};if(u){g.mc=h("marker.color",p),g.mx=h("marker.symbol",p),g.mo=h("marker.opacity",i.mean,[.2,1]),g.mlc=h("marker.line.color",p),g.mlw=h("marker.line.width",i.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=h("marker.size",i.mean,[2,16],12);g.ms=y,m.marker.size=y}d&&(m.line={width:h("line.width",p,[0,10],5)}),f&&(g.tx="Aa",g.tp=h("textposition",p),g.ts=10,g.tc=h("textfont.color",p),g.tf=h("textfont.family",p)),r=[i.minExtend(o,g)],(a=i.minExtend(l,m)).selectedpoints=null,a.texttemplate=null}var x=n.select(this).select("g.legendpoints"),_=x.selectAll("path.scatterpts").data(u?r:[]);_.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",b),_.exit().remove(),_.call(s.pointStyle,a,e),u&&(r[0].mrc=3);var w=x.selectAll("g.pointtext").data(f?r:[]);w.enter().append("g").classed("pointtext",!0).append("text").attr("transform",b),w.exit().remove(),w.selectAll("text").call(s.textPointStyle,a,e)})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.visible&&"candlestick"===e.type?[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",b).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var a=n.select(this),i=e[r?"increasing":"decreasing"],o=x(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(l.fill,i.fillcolor),o&&l.stroke(a,i.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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",b).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var a=n.select(this),i=e[r?"increasing":"decreasing"],o=x(void 0,i.line,5,2);a.style("fill","none").call(s.dashLine,i.line.dash,o),o&&l.stroke(a,i.line.color)}))}))}},{"../../lib":497,"../../registry":591,"../../traces/pie/helpers":645,"../../traces/pie/style_one":646,"../../traces/scatter/subtypes":677,"../color":367,"../colorscale/helpers":378,"../drawing":389,"./constants":418,d3:86}],426:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/plots"),i=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),s=t("../shapes/draw").eraseActiveShape,l=t("../../lib"),u=l._,c=e.exports={};function f(t,e){var r,a,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,u=t._fullLayout,c={},f=i.list(t,null,!0),d=u._cartesianSpikesEnabled;if("zoom"===s){var h,p="in"===l?.5:2,g=(1+p)/2,v=(1-p)/2;for(a=0;a1?(S=["toggleHover"],C=["resetViews"]):p?(E=["zoomInGeo","zoomOutGeo"],S=["hoverClosestGeo"],C=["resetGeo"]):h?(S=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):b?(E=["zoomInMapbox","zoomOutMapbox"],S=["toggleHover"],C=["resetViewMapbox"]):m?S=["hoverClosestGl2d"]:g?S=["hoverClosestPie"]:_?(S=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):S=["toggleHover"];d&&(S=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var g=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),a=0,i=0;i=n.max)e=z[r+1];else if(t=n.pmax)e=z[r+1];else if(t0?d+u:u;return{ppad:u,ppadplus:c?p:g,ppadminus:c?g:p}}return{ppad:u}}function c(t,e,r,n,a){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,d=1/0,h=-1/0,p=n.match(i.segmentRE);for("date"===t.type&&(s=o.decodeDate(s)),l=0;lh&&(h=f)));return h>=d?[d,h]: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;oy?(T=f,S="y0",k=y,C="y1"):(T=y,S="y1",k=f,C="y0");Z(n),$(s,r),function(t,e,r){var n=e.xref,a=e.yref,o=i.getFromId(r,n),s=i.getFromId(r,a),l="";"paper"===n||o.autorange||(l+=n);"paper"===a||s.autorange||(l+=a);c.setClipUrl(t,l?"clip"+r._fullLayout._uid+l:null,r)}(e,r,t),Y.moveFn="move"===R?J:Q,Y.altKey=n.altKey},doneFn:function(){if(m(t))return;h(e),K(s),x(e,t,r),n.call("_guiRelayout",t,l.getUpdateObj())},clickFn:function(){if(m(t))return;K(s)}};function Z(r){if(m(t))R=null;else if(F)R="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=Y.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,s=r.clientY-n.top,l=!z&&a>10&&i>10&&!r.shiftKey?d.getCursor(o/a,1-s/i):"move";h(e,l),R=l.split("-")[0]}}function J(n,a){if("path"===r.type){var i=function(t){return t},o=i,l=i;I?N("xanchor",r.xanchor=q(b+n)):(o=function(t){return q(H(t)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),P?N("yanchor",r.yanchor=X(A+a)):(l=function(t){return X(G(t)+a)},U&&"date"===U.type&&(l=g.encodeDate(l))),N("path",r.path=w(D,o,l))}else I?N("xanchor",r.xanchor=q(b+n)):(N("x0",r.x0=q(u+n)),N("x1",r.x1=q(v+n))),P?N("yanchor",r.yanchor=X(A+a)):(N("y0",r.y0=X(f+a)),N("y1",r.y1=X(y+a)));e.attr("d",_(t,r)),$(s,r)}function Q(n,a){if(z){var i=function(t){return t},o=i,l=i;I?N("xanchor",r.xanchor=q(b+n)):(o=function(t){return q(H(t)+n)},B&&"date"===B.type&&(o=g.encodeDate(o))),P?N("yanchor",r.yanchor=X(A+a)):(l=function(t){return X(G(t)+a)},U&&"date"===U.type&&(l=g.encodeDate(l))),N("path",r.path=w(D,o,l))}else if(F){if("resize-over-start-point"===R){var c=u+n,d=P?f-a:f+a;N("x0",r.x0=I?c:q(c)),N("y0",r.y0=P?d:X(d))}else if("resize-over-end-point"===R){var h=v+n,p=P?y-a:y+a;N("x1",r.x1=I?h:q(h)),N("y1",r.y1=P?p:X(p))}}else{var m=function(t){return-1!==R.indexOf(t)},x=m("n"),j=m("s"),V=m("w"),W=m("e"),Y=x?T+a:T,Z=j?k+a:k,J=V?M+n:M,Q=W?E+n:E;P&&(x&&(Y=T-a),j&&(Z=k-a)),(!P&&Z-Y>10||P&&Y-Z>10)&&(N(S,r[S]=P?Y:X(Y)),N(C,r[C]=P?Z:X(Z))),Q-J>10&&(N(L,r[L]=I?J:q(J)),N(O,r[O]=I?Q:q(Q)))}e.attr("d",_(t,r)),$(s,r)}function $(t,e){(I||P)&&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 i=H(I?e.xanchor:a.midRange(r?[e.x0,e.x1]:g.extractPathCoords(e.path,p.paramIsX))),o=G(P?e.yanchor:a.midRange(r?[e.y0,e.y1]:g.extractPathCoords(e.path,p.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),I&&P){var s="M"+(i-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"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",l)}else{var u="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",u)}}()}function K(t){t.selectAll(".visual-cue").remove()}d.init(Y),W.node().onmousemove=Z}(t,I,l,e,r,R):!0===l.editable&&I.style("pointer-events",O||u.opacity(E)*M<=.5?"stroke":"all");I.node().addEventListener("click",(function(){return function(t,e){if(!y(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void A(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=A,v(t)}}(t,I)}))}}function x(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");c.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function _(t,e){var r,n,o,s,l,u,c,f,d=e.type,h=i.getRefType(e.xref),v=i.getRefType(e.yref),m=i.getFromId(t,e.xref),y=i.getFromId(t,e.yref),b=t._fullLayout._size;if(m?"domain"===h?n=function(t){return m._offset+m._length*t}:(r=g.shapePositionToRange(m),n=function(t){return m._offset+m.r2p(r(t,!0))}):n=function(t){return b.l+b.w*t},y?"domain"===v?s=function(t){return y._offset+y._length*(1-t)}:(o=g.shapePositionToRange(y),s=function(t){return y._offset+y.r2p(o(t,!0))}):s=function(t){return b.t+b.h*(1-t)},"path"===d)return m&&"date"===m.type&&(n=g.decodeDate(n)),y&&"date"===y.type&&(s=g.decodeDate(s)),function(t,e,r){var n=t.path,i=t.xsizemode,o=t.ysizemode,s=t.xanchor,l=t.yanchor;return n.replace(p.segmentRE,(function(t){var n=0,u=t.charAt(0),c=p.paramIsX[u],f=p.paramIsY[u],d=p.numParams[u],h=t.substr(1).replace(p.paramRE,(function(t){return c[n]?t="pixel"===i?e(s)+Number(t):e(t):f[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>d&&(t="X"),t}));return n>d&&(h=h.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+t)),u+h}))}(e,n,s);if("pixel"===e.xsizemode){var x=n(e.xanchor);l=x+e.x0,u=x+e.x1}else l=n(e.x0),u=n(e.x1);if("pixel"===e.ysizemode){var _=s(e.yanchor);c=_-e.y0,f=_-e.y1}else c=s(e.y0),f=s(e.y1);if("line"===d)return"M"+l+","+c+"L"+u+","+f;if("rect"===d)return"M"+l+","+c+"H"+u+"V"+f+"H"+l+"Z";var w=(l+u)/2,A=(c+f)/2,T=Math.abs(w-l),k=Math.abs(A-c),M="A"+T+","+k,E=w+T+","+A;return"M"+E+M+" 0 1,1 "+(w+","+(A-k))+M+" 0 0,1 "+E+"Z"}function w(t,e,r){return t.replace(p.segmentRE,(function(t){var n=0,a=t.charAt(0),i=p.paramIsX[a],o=p.paramIsY[a],s=p.numParams[a];return a+t.substr(1).replace(p.paramRE,(function(t){return n>=s||(i[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function A(t){y(t)&&(t._fullLayout._activeShapeIndex>=0&&(l(t),delete t._fullLayout._activeShapeIndex,v(t)))}e.exports={draw:v,drawOne:b,eraseActiveShape:function(t){if(!y(t))return;l(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&f(m),r.attr("d",g(e)),k&&!d)&&(T=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===A&&(t[0][0]="M"),e[w]=t,y(),b())}}()}}function D(t,r){!function(t,r){if(e.length)for(var n=0;n0&&l0&&(s=s.transition().duration(e.transition.duration).ease(e.transition.easing)),s.attr("transform",l(o-.5*f.gripWidth,e._dims.currentValueTotalHeight))}}function S(t,e){var r=t._dims;return r.inputAreaStart+f.stepInset+(r.inputAreaLength-2*f.stepInset)*Math.min(1,Math.max(0,e))}function C(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-f.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*f.stepInset-2*r.inputAreaStart)))}function L(t,e,r){var n=r._dims,a=s.ensureSingle(t,"rect",f.railTouchRectClass,(function(n){n.call(k,e,t,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,f.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function O(t,e){var r=e._dims,n=r.inputAreaLength-2*f.railInset,a=s.ensureSingle(t,"rect",f.railRectClass);a.attr({width:n,height:f.railWidth,rx:f.railRadius,ry:f.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,e.bordercolor).call(i.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(a,f.railInset,.5*(r.inputAreaWidth-f.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[f.name],n=[],a=0;a0?[0]:[]);function s(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),a.autoMargin(t,v(e))}if(i.enter().append("g").classed(f.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+f.groupClassName).each(s)})).remove(),0!==r.length){var l=i.selectAll("g."+f.groupClassName).data(r,m);l.enter().append("g").classed(f.groupClassName,!0),l.exit().each(s).remove();for(var u=0;u0||d<0){var m={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];e.attr("transform",l(m[0],m[1]))}}}return P.call(F),R&&(S?P.on(".opacity",null):(k=0,M=!0,P.text(y).on("mouseover.opacity",(function(){n.select(this).transition().duration(d.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(d.HIDE_PLACEHOLDER).style("opacity",0)}))),P.call(f.makeEditable,{gd:t}).on("edit",(function(e){void 0!==b?o.call("_guiRestyle",t,m,e,b):o.call("_guiRelayout",t,m,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(F)})).on("input",(function(t){this.text(t||" ").call(f.positionText,_.x,_.y)}))),P.classed("js-placeholder",M),A}}},{"../../constants/alignment":469,"../../constants/interactions":473,"../../lib":497,"../../lib/svg_text_utils":521,"../../plots/plots":583,"../../registry":591,"../color":367,"../drawing":389,d3:86,"fast-isnumeric":155}],463:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=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"}]},args2:{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:i(s({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":489,"../../plot_api/edit_types":527,"../../plot_api/plot_template":534,"../../plots/font_attributes":573,"../../plots/pad_attributes":582,"../color/attributes":366}],464:[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"}}},{}],465:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/array_container_defaults"),i=t("./attributes"),o=t("./constants").name,s=i.buttons;function l(t,e,r){function o(r,a){return n.coerce(t,e,i,r,a)}o("visible",a(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,a){return n.coerce(t,e,s,r,a)}r("visible","skip"===t.method||Array.isArray(t.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}e.exports=function(t,e){a(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":497,"../../plots/array_container_defaults":540,"./attributes":463,"./constants":464}],466:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=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"),d=t("./scrollbox");function h(t){return t._index}function p(t,e){return+t.attr(f.menuIndexAttrName)===e._index}function g(t,e,r,n,a,i,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&&(a.attr(f.menuIndexAttrName,"-1"),v(t,n,a,i,e),s||m(t,n,a,i,e))}function v(t,e,r,n,a){var i=s.ensureSingle(e,"g",f.headerClassName,(function(t){t.style("pointer-events","all")})),l=a._dims,u=a.active,c=a.buttons[u]||f.blankHeaderOpts,d={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},h={width:l.headerWidth,height:l.headerHeight};i.call(y,a,c,t).call(M,a,d,h),s.ensureSingle(e,"text",f.headerArrowClassName,(function(t){t.attr("text-anchor","end").call(o.font,a.font).text(f.arrowSymbol[a.direction])})).attr({x:l.headerWidth-f.arrowOffsetX+a.pad.l,y:l.headerHeight/2+f.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(E,String(p(r,a)?-1:a._index)),m(t,e,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(A,a)})),o.setTranslate(e,l.lx,l.ly)}function m(t,e,r,i,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)),d=c.enter().append("g").classed(u,!0),h=c.exit();"dropdown"===o.type?(d.attr("opacity","0").transition().attr("opacity","1"),h.transition().attr("opacity","0").remove()):h.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},T={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(M,o,x),u.on("click",(function(){n.event.defaultPrevented||(s.execute&&(s.args2&&o.active===l?(g(t,o,0,e,r,i,-1),a.executeAPICommand(t,s.method,s.args2)):(g(t,o,0,e,r,i,l),a.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?(T.w=Math.max(m.openWidth,m.headerWidth),T.h=x.y-T.t):(T.w=x.x-T.l,T.h=Math.max(m.openHeight,m.headerHeight)),T.direction=o.direction,i&&(c.size()?function(t,e,r,n,a,i){var o,s,l,u=a.direction,c="up"===u||"down"===u,d=a._dims,h=a.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(i)})).remove(),0!==r.length){var l=o.selectAll("g."+f.headerGroupClassName).data(r,h);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,k=s.barLength+2*s.barPad,M=s.barWidth+2*s.barPad,E=p,S=v+m;S+M>u&&(S=u-M);var C=this.container.selectAll("rect.scrollbar-horizontal").data(T?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,s.barColor),T?(this.hbar=C.attr({rx:s.barRadius,ry:s.barRadius,x:E,y:S,width:k,height:M}),this._hbarXMin=E+k/2,this._hbarTranslateMax=w-k):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var L=m>A,O=s.barWidth+2*s.barPad,D=s.barLength+2*s.barPad,R=p+g,I=v;R+O>l&&(R=l-O);var P=this.container.selectAll("rect.scrollbar-vertical").data(L?[0]:[]);P.exit().on(".drag",null).remove(),P.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,s.barColor),L?(this.vbar=P.attr({rx:s.barRadius,ry:s.barRadius,x:R,y:I,width:O,height:D}),this._vbarYMin=I+D/2,this._vbarTranslateMax=A-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var F=this.id,z=c-.5,N=L?f+O+.5:f+.5,B=d-.5,j=T?h+M+.5:h+.5,U=o._topdefs.selectAll("#"+F).data(T||L?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",F).append("rect"),T||L?(this._clipRect=U.select("rect").attr({x:Math.floor(z),y:Math.floor(B),width:Math.ceil(N)-Math.floor(z),height:Math.ceil(j)-Math.floor(B)}),this.container.call(i.setClipUrl,F,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(i.setClipUrl,null),delete this._clipRect),T||L){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));T&&this.hbar.on(".drag",null).call(H),L&&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(i.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,a=r+this._hbarTranslateMax;t=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,s=i+this._vbarTranslateMax;e=(o.constrain(n.event.y,i,s)-i)/(s-i)*(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(i.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 a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var s=e/n;this.vbar.call(i.setTranslate,t,e+s*this._vbarTranslateMax)}}},{"../../lib":497,"../color":367,"../drawing":389,d3:86}],469:[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"}}},{}],470:[function(t,e,r){"use strict";e.exports={axisRefDescription:function(t,e,r){return["If set to a",t,"axis id (e.g. *"+t+"* or","*"+t+"2*), the `"+t+"` position refers to a",t,"coordinate. If set to *paper*, the `"+t+"`","position refers to the distance from the",e,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",e,"("+r+"). If set to a",t,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",e,"of the domain of that axis: e.g.,","*"+t+"2 domain* refers to the domain of the second",t," axis and a",t,"position of 0.5 refers to the","point between the",e,"and the",r,"of the domain of the","second",t,"axis."].join(" ")}}},{}],471:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],472:[function(t,e,r){"use strict";e.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],473:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],474:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],475:[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}},{}],476:[function(t,e,r){"use strict";r.version=t("./version").version,t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config")();for(var n=t("./registry"),a=r.register=n.register,i=t("./plot_api"),o=Object.keys(i),s=0;splotly-logomark"}}},{}],479:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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"),a=n.mod,i=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 i(e-t,s)}function c(t,e){if(l(e))return!0;var r,n;e[0](n=a(n,s))&&(n+=s);var i=a(t,s),o=i+s;return i>=r&&i<=n||o>=r&&o<=n}function f(t,e,r,n,a,i,u){a=a||0,i=i||0;var c,f,d,h,p,g=l([r,n]);function v(t,e){return[t*Math.cos(e)+a,i-t*Math.sin(e)]}g?(c=0,f=o,d=s):r=a&&t<=i);var a,i},pathArc:function(t,e,r,n,a){return f(null,t,e,r,n,a,0)},pathSector:function(t,e,r,n,a){return f(null,t,e,r,n,a,1)},pathAnnulus:function(t,e,r,n,a,i){return f(t,e,r,n,a,i,1)}}},{"./mod":504}],481:[function(t,e,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(t){return a.isView(t)&&!(t instanceof i)}function s(t){return n(t)||o(t)}function l(t,e,r){if(s(t)){if(s(t[0])){for(var n=r,a=0;aa.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every((function(t){return a(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 a=n.regex||u(r);"string"==typeof t&&a.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 a=t.split("+"),i=0;i=n&&t<=a?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 T=A[1],k=A[3]||"1",M=Number(A[5]||1),E=Number(A[7]||0),S=Number(A[9]||0),C=Number(A[11]||0);if(u){if(2===T.length)return c;var L;T=Number(T);try{var O=v.getComponentMethod("calendars","getCal")(e);if(w){var D="i"===k.charAt(k.length-1);k=parseInt(k,10),L=O.newDate(T,O.toMonthIndex(T,k,D),M)}else L=O.newDate(T,Number(k),M)}catch(t){return c}return L?(L.toJD()-g)*f+E*d+S*h+C*p:c}T=2===T.length?(Number(T)+2e3-x)%100+x:Number(T),k-=1;var R=new Date(Date.UTC(2e3,k,M,E,S));return R.setUTCFullYear(T),R.getUTCMonth()!==k||R.getUTCDate()!==M?c:R.getTime()+C*p},n=r.MIN_MS=r.dateTime2ms("-9999"),a=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,T=3*d,k=5*h;function M(t,e,r,n,a){if((e||r||n||a)&&(t+=" "+w(e,2)+":"+w(r,2),(n||a)&&(t+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;t+="."+w(a,i)}return t}r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=n&&t<=a))return c;e||(e=0);var i,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{i=v.getComponentMethod("calendars","getCal")(r).fromJD(E).formatDate("yyyy-mm-dd")}catch(t){i=m("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=n+f&&t<=a-f))return c;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return M(i("%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 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 a=new Date(Math.floor(e+.05));if(_(n))try{t=v.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,n,a,i){if(a=_(a)&&a,!e)if("y"===r)e=i.year;else if("m"===r)e=i.month;else{if("d"!==r)return function(t,e){var r=l(t+.05,f),n=w(Math.floor(r/d),2)+":"+w(l(Math.floor(r/h),60),2);if("M"!==e){o(e)||(e=0);var a=(100+Math.min(l(t/p,60),C[e])).toFixed(e).substr(1);e>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(t,r)+"\n"+S(i.dayMonthYear,t,n,a);e=i.dayMonth+"\n"+i.year}return S(e,t,n,a)};var L=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 a=Math.round(t/f)+g,i=v.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return e%12?i.add(o,e,"m"):i.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+L);return u.setUTCMonth(u.getUTCMonth()+e)+n-L},r.findExactDates=function(t,e){for(var r,n,a=0,i=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,a){var i=n*t+a*e;if(i<0)return n*n+a*a;if(i>r){var o=n-t,s=a-e;return o*o+s*s}var l=n*e-a*t;return l*l/r}r.segmentsIntersect=s,r.segmentDistance=function(t,e,r,n,a,i,o,u){if(s(t,e,r,n,a,i,o,u))return 0;var c=r-t,f=n-e,d=o-a,h=u-i,p=c*c+f*f,g=d*d+h*h,v=Math.min(l(c,f,p,a-t,i-e),l(c,f,p,o-t,u-e),l(d,h,g,t-a,e-i),l(d,h,g,r-a,n-i));return Math.sqrt(v)},r.getTextLocation=function(t,e,r,s){if(t===a&&s===i||(n={},a=t,i=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)),d={x:(4*f.x+l.x+u.x)/6,y:(4*f.y+l.y+u.y)/6,theta:c};return n[r]=d,d},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(t,e,r){var n,a,i=e.left,o=e.right,s=e.top,l=e.bottom,u=0,c=t.getTotalLength(),f=c;function d(e){var r=t.getPointAtLength(e);0===e?n=r:e===c&&(a=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 h=d(u);h;){if((u+=h+r)>f)return;h=d(u)}for(h=d(f);h;){if(u>(f-=h+r))return;h=d(f)}return{min:u,max:f,len:f-u,total:c,isClosed:0===u&&f===c&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(t,e,r,n){for(var a,i,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,d=0,h=s;f0?h=a:d=a,f++}return i}},{"./mod":504}],493:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),i=t("color-normalize"),o=t("../components/colorscale"),s=t("../components/color/attributes").defaultLine,l=t("./array").isArrayOrTypedArray,u=i(s);function c(t,e){var r=t;return r[3]*=e,r}function f(t){if(n(t))return u;var e=i(t);return e.length?e:u}function d(t){return n(t)?t:1}e.exports={formatColor:function(t,e,r){var n,a,s,h,p,g=t.color,v=l(g),m=l(e),y=o.extractOpts(t),b=[];if(n=void 0!==y.colorscale?o.makeColorScaleFuncFromTrace(t):f,a=v?function(t,e){return void 0===t[e]?u:i(n(t[e]))}:f,s=m?function(t,e){return void 0===t[e]?1:d(t[e])}:d,v||m)for(var x=0;x1?(r*t+r*e)/r:t+e,a=String(n).length;if(a>16){var i=String(e).length;if(a>=String(t).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],497:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../constants/numerical"),s=o.FP_SAFE,l=o.BADNUM,u=e.exports={};u.nestedProperty=t("./nested_property"),u.keyedContainer=t("./keyed_container"),u.relativeAttr=t("./relative_attr"),u.isPlainObject=t("./is_plain_object"),u.toLogRange=t("./to_log_range"),u.relinkPrivateKeys=t("./relink_private");var c=t("./array");u.isTypedArray=c.isTypedArray,u.isArrayOrTypedArray=c.isArrayOrTypedArray,u.isArray1D=c.isArray1D,u.ensureArray=c.ensureArray,u.concat=c.concat,u.maxRowLength=c.maxRowLength,u.minRowLength=c.minRowLength;var f=t("./mod");u.mod=f.mod,u.modHalf=f.modHalf;var d=t("./coerce");u.valObjectMeta=d.valObjectMeta,u.coerce=d.coerce,u.coerce2=d.coerce2,u.coerceFont=d.coerceFont,u.coerceHoverinfo=d.coerceHoverinfo,u.coerceSelectionMarkerOpacity=d.coerceSelectionMarkerOpacity,u.validate=d.validate;var h=t("./dates");u.dateTime2ms=h.dateTime2ms,u.isDateTime=h.isDateTime,u.ms2DateTime=h.ms2DateTime,u.ms2DateTimeLocal=h.ms2DateTimeLocal,u.cleanDate=h.cleanDate,u.isJSDate=h.isJSDate,u.formatDate=h.formatDate,u.incrementMonth=h.incrementMonth,u.dateTick0=h.dateTick0,u.dfltRange=h.dfltRange,u.findExactDates=h.findExactDates,u.MIN_MS=h.MIN_MS,u.MAX_MS=h.MAX_MS;var p=t("./search");u.findBin=p.findBin,u.sorterAsc=p.sorterAsc,u.sorterDes=p.sorterDes,u.distinctVals=p.distinctVals,u.roundUp=p.roundUp,u.sort=p.sort,u.findIndexOfMin=p.findIndexOfMin;var g=t("./stats");u.aggNums=g.aggNums,u.len=g.len,u.mean=g.mean,u.median=g.median,u.midRange=g.midRange,u.variance=g.variance,u.stdev=g.stdev,u.interp=g.interp;var v=t("./matrix");u.init2dArray=v.init2dArray,u.transposeRagged=v.transposeRagged,u.dot=v.dot,u.translationMatrix=v.translationMatrix,u.rotationMatrix=v.rotationMatrix,u.rotationXYMatrix=v.rotationXYMatrix,u.apply3DTransform=v.apply3DTransform,u.apply2DTransform=v.apply2DTransform,u.apply2DTransform2=v.apply2DTransform2,u.convertCssMatrix=v.convertCssMatrix,u.inverseTransformMatrix=v.inverseTransformMatrix;var m=t("./angles");u.deg2rad=m.deg2rad,u.rad2deg=m.rad2deg,u.angleDelta=m.angleDelta,u.angleDist=m.angleDist,u.isFullCircle=m.isFullCircle,u.isAngleInsideSector=m.isAngleInsideSector,u.isPtInsideSector=m.isPtInsideSector,u.pathArc=m.pathArc,u.pathSector=m.pathSector,u.pathAnnulus=m.pathAnnulus;var y=t("./anchor_utils");u.isLeftAnchor=y.isLeftAnchor,u.isCenterAnchor=y.isCenterAnchor,u.isRightAnchor=y.isRightAnchor,u.isTopAnchor=y.isTopAnchor,u.isMiddleAnchor=y.isMiddleAnchor,u.isBottomAnchor=y.isBottomAnchor;var b=t("./geometry2d");u.segmentsIntersect=b.segmentsIntersect,u.segmentDistance=b.segmentDistance,u.getTextLocation=b.getTextLocation,u.clearLocationCache=b.clearLocationCache,u.getVisibleSegment=b.getVisibleSegment,u.findPointOnPath=b.findPointOnPath;var x=t("./extend");u.extendFlat=x.extendFlat,u.extendDeep=x.extendDeep,u.extendDeepAll=x.extendDeepAll,u.extendDeepNoArrays=x.extendDeepNoArrays;var _=t("./loggers");u.log=_.log,u.warn=_.warn,u.error=_.error;var w=t("./regex");u.counterRegex=w.counter;var A=t("./throttle");u.throttle=A.throttle,u.throttleDone=A.done,u.clearThrottle=A.clear;var T=t("./dom");function k(t){var e={};for(var r in t)for(var n=t[r],a=0;as?l:i(t)?Number(t):l:l},u.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(i(t)&&t>=0&&t%1==0)},u.noop=t("./noop"),u.identity=t("./identity"),u.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))},u.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},u.simpleMap=function(t,e,r,n,a){for(var i=t.length,o=new Array(i),s=0;s=Math.pow(2,r)?a>10?(u.warn("randstr failed uniqueness"),l):t(e,r,n,(a||0)+1):l},u.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},u.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,i,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(a-=s*Math.floor(a/s)),a<0?a=-1-a:a>=o&&(a=s-1-a),i+=t[a]*u[n];c[r]=i}return c},u.syncOrAsync=function(t,e,r){var n;function a(){return u.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(a).then(void 0,u.promiseError);return r&&r(e)},u.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},u.noneOrAll=function(t,e,r){if(t){var n,a=!1,i=!0;for(n=0;n0?e:0}))},u.fillArray=function(t,e,r,n){if(n=n||u.identity,u.isArrayOrTypedArray(t))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+i+"$2");return s+l},u.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var O=/^\w*$/;u.templateString=function(t,e){var r={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,n){var a;return O.test(n)?a=e[n]:(r[n]=r[n]||u.nestedProperty(e,n).get,a=r[n]()),u.isValidTextValue(a)?a:""}))};var D={max:10,count:0,name:"hovertemplate"};u.hovertemplateString=function(){return P.apply(D,arguments)};var R={max:10,count:0,name:"texttemplate"};u.texttemplateString=function(){return P.apply(R,arguments)};var I=/^[:|\|]/;function P(t,e,r){var i=this,o=arguments;e||(e={});var s={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,l,c){var f,d,h,p;for(h=3;h=48&&o<=57,u=s>=48&&s<=57;if(l&&(n=10*n+o-48),u&&(a=10*a+s-48),!l||!u){if(n!==a)return n-a;if(o!==s)return o-s}}return a-n};var F=2e9;u.seedPseudoRandom=function(){F=2e9},u.pseudoRandom=function(){var t=F;return F=(69069*F+1)%4294967296,Math.abs(F-t)<429496729?u.pseudoRandom():F/4294967296},u.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},a=u.extractOption(t,e,"htx","hovertext");if(u.isValidTextValue(a))return n(a);var i=u.extractOption(t,e,"tx","text");return u.isValidTextValue(i)?n(i):void 0},u.isValidTextValue=function(t){return t||0===t},u.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(c=1):c=0,u.strTranslate(a-c*(r+o),i-c*(n+s))+u.strScale(c)+(l?"rotate("+l+(e?"":" "+r+" "+n)+")":"")},u.ensureUniformFontSize=function(t,e){var r=u.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r},u.join2=function(t,e,r){var n=t.length;return n>1?t.slice(0,-1).join(e)+r+t[n-1]:t.join(e)}},{"../constants/numerical":474,"./anchor_utils":479,"./angles":480,"./array":481,"./clean_number":482,"./clear_responsive":484,"./coerce":485,"./dates":486,"./dom":487,"./extend":489,"./filter_unique":490,"./filter_visible":491,"./geometry2d":492,"./identity":495,"./increment":496,"./is_plain_object":498,"./keyed_container":499,"./localize":500,"./loggers":501,"./make_trace_groups":502,"./matrix":503,"./mod":504,"./nested_property":505,"./noop":506,"./notifier":507,"./push_unique":511,"./regex":513,"./relative_attr":514,"./relink_private":515,"./search":516,"./stats":519,"./throttle":522,"./to_log_range":523,d3:86,"d3-time-format":84,"fast-isnumeric":155}],498:[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}},{}],499:[function(t,e,r){"use strict";var n=t("./nested_property"),a=/^\w*$/;e.exports=function(t,e,r,i){var o,s,l;r=r||"name",i=i||"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],d.set(t,null);if(f){for(o=e;o1){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},i.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},i.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":532,"./notifier":507}],502:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var a=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=t.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(t){t[0][i]=n.select(this)})),a}},{d3:86}],503:[function(t,e,r){"use strict";var n=t("gl-mat4");r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],505:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./array").isArrayOrTypedArray;function i(t,e){return function(){var r,n,o,s,l,u=t;for(s=0;s/g),l=0;li||u===a||us)&&(!e||!l(t))}:function(t,e){var l=t[0],u=t[1];if(l===a||li||u===a||us)return!1;var c,f,d,h,p,g=r.length,v=r[0][0],m=r[0][1],y=0;for(c=1;cMath.max(f,v)||u>Math.max(d,m)))if(uc||Math.abs(n(o,d))>a)return!0;return!1},i.filter=function(t,e){var r=[t[0]],n=0,a=0;function o(o){t.push(o);var s=r.length,l=n;r.splice(a+1);for(var u=l+1;u1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":474,"./matrix":503}],510:[function(t,e,r){(function(r){(function(){"use strict";var n=t("./show_no_webgl_msg"),a=t("regl");e.exports=function(t,e){var i=t._fullLayout,o=!0;return i._glcanvas.each((function(n){if(!n.regl&&(!n.pick||i._has("parcoords"))){try{n.regl=a({canvas:this,attributes:{antialias:!n.pick,preserveDrawingBuffer:!0},pixelRatio:t._context.plotGlPixelRatio||r.devicePixelRatio,extensions:e||[]})}catch(t){o=!1}n.regl||(o=!1),o&&this.addEventListener("webglcontextlost",(function(e){t&&t.emit&&t.emit("plotly_webglcontextlost",{event:e,layer:n.key})}),!1)}})),o||n({container:i._glcontainer.node()}),o}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./show_no_webgl_msg":518,regl:296}],511:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){for(var r=e.toString(),n=0;na.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 c(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 i,o,f=0,d=e.length,h=0,p=d>1?(e[d-1]-e[0])/(d-1):1;for(o=p>=0?r?s:l:r?c:u,t+=1e-9*p*(r?-1:1)*(p>=0?1:-1);f90&&a.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,e){var n,a=(e||{}).unitMinDiff,i=t.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var s=1;a||(s=i[n]-i[0]||1);for(var l,u=s/(n||1)/1e4,c=[],f=0;f<=n;f++){var d=i[f],h=d-l;void 0===l?(c.push(d),l=d):h>u&&(s=Math.min(s,h),c.push(d),l=d)}return{vals:c,minDiff:s}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return t.sort(e)}return n?t:t.reverse()},r.findIndexOfMin=function(t,e){e=e||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(e)||(e=!1),a(i[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":155}],520:[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":63}],521:[function(t,e,r){"use strict";var n=t("d3"),a=t("../lib"),i=a.strTranslate,o=t("../constants/xmlns_namespaces"),s=t("../constants/alignment").LINE_SPACING;function l(t,e){return t.node().getBoundingClientRect()[e]}var u=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,M){var E=t.text(),C=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&E.match(u),L=n.select(t.node().parentNode);if(!L.empty()){var O=t.attr("class")?t.attr("class").split(" ")[0]:"text";return O+="-math",L.selectAll("svg."+O).remove(),L.selectAll("g."+O+"-group").remove(),t.style("display",null).attr({"data-unformatted":E,"data-math":"N"}),C?(e&&e._promises||[]).push(new Promise((function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),o={fontSize:r};!function(t,e,r){var i,o,s,l;MathJax.Hub.Queue((function(){return o=a.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"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.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(c,"\\lt ").replace(f,"\\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())a.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"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==s&&(MathJax.Hub.processSectionDelay=s),MathJax.Hub.Config(o)}))}(C[2],o,(function(n,a,o){L.selectAll("svg."+O).remove(),L.selectAll("g."+O+"-group").remove();var s=n&&n.select("svg");if(!s||!s.node())return D(),void e();var u=L.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":E,"data-math":"Y"});u.node().appendChild(s.node()),a&&a.node()&&s.node().insertBefore(a.node().cloneNode(!0),s.node().firstChild),s.attr({class:O,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=t.node().style.fill||"black",f=s.select("g");f.attr({fill:c,stroke:c});var d=l(f,"width"),h=l(f,"height"),p=+t.attr("x")-d*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],g=-(r||l(t,"height"))/4;"y"===O[0]?(u.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+")"+i(-d/2,g-h/2)}),s.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===O[0]?s.attr({x:t.attr("x"),y:g-h/2}):"a"===O[0]&&0!==O.indexOf("atitle")?s.attr({x:0,y:g}):s.attr({x:p,y:+t.attr("y")+g-h/2}),M&&M.call(t,u),e(u)}))}))):D(),t}function D(){L.empty()||(O=t.attr("class")+"-math",L.select("svg."+O).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(v," ");var r,i=!1,l=[],u=-1;function c(){u++;var e=document.createElementNS(o.svg,"tspan");n.select(e).attr({class:"line",dy:u*s+"em"}),t.appendChild(e),r=e;var a=l;if(l=[{node:e}],a.length>1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),r=l[l.length-1].node}else a.log("Ignoring unexpected end tag .",e)}b.test(e)?c():(r=t,l=[{node:t}]);for(var C=e.split(m),L=0;L|>|>)/g;var d={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"},p={sub:"-0.21em",sup:"0.42em"},g=["http:","https:","mailto:","",void 0,":"],v=r.NEWLINES=/(\r\n?|\n)/g,m=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,b=//i;r.BR_TAG_ALL=//gi;var 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 T(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&S(n)}var k=/(^|;)\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"],a="...".length,i=t.split(m),o=[],s="",l=0,u=0;ua?o.push(c.substr(0,p-a)+"..."):o.push(c.substr(0,p));break}s=""}}return o.join("")};var M={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},E=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function S(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)):M[e])||t}))}function C(t,e,r){var n,i,o,s=r.horizontalAlign,l=r.verticalAlign||"top",u=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return i="bottom"===l?function(){return u.bottom-n.height}:"middle"===l?function(){return u.top+(u.height-n.height)/2}:function(){return u.top},o="right"===s?function(){return u.right-n.width}:"center"===s?function(){return u.left+(u.width-n.width)/2}:function(){return u.left},function(){n=this.node().getBoundingClientRect();var t=o()-c.left,e=i()-c.top,s=r.gd||{};if(r.gd){s._fullLayout._calcInverseTransform(s);var l=a.apply3DTransform(s._fullLayout._invTransform)(t,e);t=l[0],e=l[1]}return this.style({top:e+"px",left:t+"px","z-index":1e3}),this}}r.convertEntities=S,r.sanitizeHTML=function(t){t=t.replace(v," ");for(var e=document.createElement("p"),r=e,a=[],i=t.split(m),o=0;oi.ts+e?l():i.timer=setTimeout((function(){l(),i.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)a(n[t]),delete n[t];else for(var e in n)r.clear(e)}},{}],523:[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":155}],524:[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"}}},{}],525:[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"}}},{}],526:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,i=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 i=(s.subplotsRegistry.cartesian||{}).attrRegex,l=(s.subplotsRegistry.polar||{}).attrRegex,f=(s.subplotsRegistry.ternary||{}).attrRegex,d=(s.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(t);for(e=0;e3?(R.x=1.02,R.xanchor="left"):R.x<-2&&(R.x=-.02,R.xanchor="right"),R.y>3?(R.y=1.02,R.yanchor="bottom"):R.y<-2&&(R.y=-.02,R.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&&i.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 i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var b,x,_,w,A,T,k,M,E=Object.keys(r).map(Number).sort(o),S=e.get(),C=S||[],L=c(m,f).get(),O=[],D=-1,R=C.length;for(b=0;bC.length-(k?0:1))i.warn("index out of range",f,_);else if(void 0!==T)A.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(T)?O.push(_):k?("add"===T&&(T={}),C.splice(_,0,T),L&&L.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,T),-1===D&&(D=_);else for(x=0;x=0;b--)C.splice(O[b],1),L&&L.splice(O[b],1);if(C.length?S||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==a){var I;if(-1===D)I=E;else{for(R=Math.max(C.length,R),I=[],b=0;b=D);b++)I.push(_);for(b=D;b=t.data.length||a<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-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]),R(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&R(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function P(t,e,r,n,i){!function(t,e,r,n){var a=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 i in R(t,r,"indices"),e){if(!Array.isArray(e[i])||e[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==e[i].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 i,l,u,c,f,d=o.isPlainObject(n),h=[];for(var p in Array.isArray(r)||(r=[r]),r=D(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 H(t,e,r){if(t=o.getGraphDiv(t),A.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 a=Z(t,n),i=a.flags;i.calc&&(t.calcdata=void 0);var s=[d.previousPromises];i.layoutReplot?s.push(T.layoutReplot):Object.keys(n).length&&(G(t,i,a)||d.supplyDefaults(t),i.legend&&s.push(T.doLegend),i.layoutstyle&&s.push(T.layoutStyles),i.axrange&&q(s,a.rangesAltered),i.ticks&&s.push(T.doTicksRelayout),i.modebar&&s.push(T.doModeBar),i.camera&&s.push(T.doCamera),i.colorbars&&s.push(T.doColorBars),s.push(S)),s.push(d.rehover,d.redrag),u.add(t,H,[t,a.undoit],H,[t,a.redoit]);var l=o.syncOrAsync(s,t);return l&&l.then||(l=Promise.resolve(t)),l.then((function(){return t.emit("plotly_relayout",a.eventData),t}))}function G(t,e,r){var n=t._fullLayout;if(!e.axrange)return!1;for(var a in e)if("axrange"!==a&&e[a])return!1;for(var i in r.rangesAltered){var o=p.id2name(i),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!==i){var c=n[p.id2name(u)];c.autorange=l.autorange,c.range=l.range.slice(),c._input.range=l.range.slice()}}return!0}function q(t,e){var r=e?function(t){var r=[],n=!0;for(var a in e){var i=p.getFromId(t,a);if(r.push(a),-1!==(i.ticklabelposition||"").indexOf("inside")&&i._anchorAxis&&r.push(i._anchorAxis._id),i._matchGroup)for(var o in i._matchGroup)e[o]||r.push(o);i.automargin&&(n=!1)}return p.draw(t,r,{skipTitle:n})}:function(t){return p.draw(t,"redraw")};t.push(x,T.doAutoRangeAndConstraints,r,T.drawData,T.finalDraw)}var X=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,W=/^[xyz]axis[0-9]*\.autorange$/,Y=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function Z(t,e){var r,n,a,i=t.layout,l=t._fullLayout,u=l._guiEditing,d=B(l._preGUI,u),h=Object.keys(e),g=p.list(t),v=o.extendDeepAll({},e),m={};for(V(e),h=Object.keys(e),n=0;n0&&"string"!=typeof R.parts[P];)P--;var F=R.parts[P],z=R.parts[P-1]+"."+F,j=R.parts.slice(0,P).join("."),U=s(t.layout,j).get(),H=s(l,j).get(),G=R.get();if(void 0!==I){T[D]=I,E[D]="reverse"===F?I:N(G);var q=f.getLayoutValObject(l,R.parts);if(q&&q.impliedEdits&&null!==I)for(var Z in q.impliedEdits)S(o.relativeAttr(D,Z),q.impliedEdits[Z]);if(-1!==["width","height"].indexOf(D))if(I){S("autosize",null);var Q="height"===D?"width":"height";S(Q,l[Q])}else l[D]=t._initialAutoSize[D];else if("autosize"===D)S("width",I?null:l.width),S("height",I?null:l.height);else if(z.match(X))O(z),s(l,j+"._inputRange").set(null);else if(z.match(W)){O(z),s(l,j+"._inputRange").set(null);var $=s(l,j).get();$._inputDomain&&($._input.domain=$._inputDomain.slice())}else z.match(Y)&&s(l,j+"._inputDomain").set(null);if("type"===F){C=U;var K="linear"===H.type&&"log"===I,tt="log"===H.type&&"linear"===I;if(K||tt){if(C&&C.range)if(H.autorange)K&&(C.range=C.range[1]>C.range[0]?[1,2]:[2,1]);else{var et=C.range[0],rt=C.range[1];K?(et<=0&&rt<=0&&S(j+".autorange",!0),et<=0?et=rt/1e6:rt<=0&&(rt=et/1e6),S(j+".range[0]",Math.log(et)/Math.LN10),S(j+".range[1]",Math.log(rt)/Math.LN10)):(S(j+".range[0]",Math.pow(10,et)),S(j+".range[1]",Math.pow(10,rt)))}else S(j+".autorange",!0);Array.isArray(l._subplots.polar)&&l._subplots.polar.length&&l[R.parts[0]]&&"radialaxis"===R.parts[1]&&delete l[R.parts[0]]._subplot.viewInitial["radialaxis.range"],c.getComponentMethod("annotations","convertCoords")(t,H,I,S),c.getComponentMethod("images","convertCoords")(t,H,I,S)}else S(j+".autorange",!0),S(j+".range",null);s(l,j+"._inputRange").set(null)}else if(F.match(M)){var nt=s(l,D).get(),at=(I||{}).type;at&&"-"!==at||(at="linear"),c.getComponentMethod("annotations","convertCoords")(t,nt,at,S),c.getComponentMethod("images","convertCoords")(t,nt,at,S)}var it=w.containerArrayMatch(D);if(it){r=it.array,n=it.index;var ot=it.property,st=q||{editType:"calc"};""!==n&&""===ot&&(w.isAddVal(I)?E[D]=null:w.isRemoveVal(I)?E[D]=(s(i,r).get()||[])[n]:o.warn("unrecognized full object value",e)),k.update(_,st),m[r]||(m[r]={});var lt=m[r][n];lt||(lt=m[r][n]={}),lt[ot]=I,delete e[D]}else"reverse"===F?(U.range?U.range.reverse():(S(j+".autorange",!0),U.range=[1,0]),H.autorange?_.calc=!0:_.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===D&&("lasso"===I||"select"===I)&&"lasso"!==G&&"select"!==G||l._has("gl2d")?_.plot=!0:q?k.update(_,q):_.calc=!0,R.set(I))}}for(r in m){w.applyContainerArrayChanges(t,d(i,r),m[r],_,d)||(_.plot=!0)}for(var ut in L){var ct=(C=p.getFromId(t,ut))&&C._constraintGroup;if(ct)for(var ft in _.calc=!0,ct)L[ft]||(p.getFromId(t,ft)._constraintShrinkable=!0)}return(J(t)||e.height||e.width)&&(_.plot=!0),(_.plot||_.calc)&&(_.layoutReplot=!0),{flags:_,rangesAltered:L,undoit:E,redoit:T,eventData:v}}function J(t){var e=t._fullLayout,r=e.width,n=e.height;return t.layout.autosize&&d.plotAutoSize(t,t.layout,e),e.width!==r||e.height!==n}function Q(t,e,n,a){if(t=o.getGraphDiv(t),A.clearPromiseQueue(t),t.framework&&t.framework.isPolar)return Promise.resolve(t);o.isPlainObject(e)||(e={}),o.isPlainObject(n)||(n={}),Object.keys(e).length&&(t.changed=!0),Object.keys(n).length&&(t.changed=!0);var i=A.coerceTraceIndices(t,a),s=U(t,o.extendFlat({},e),i),l=s.flags,c=Z(t,o.extendFlat({},n)),f=c.flags;(l.calc||f.calc)&&(t.calcdata=void 0),l.clearAxisTypes&&A.clearAxisTypes(t,i,n);var h=[];f.layoutReplot?h.push(T.layoutReplot):l.fullReplot?h.push(r.plot):(h.push(d.previousPromises),G(t,f,c)||d.supplyDefaults(t),l.style&&h.push(T.doTraceStyle),(l.colorbars||f.colorbars)&&h.push(T.doColorBars),f.legend&&h.push(T.doLegend),f.layoutstyle&&h.push(T.layoutStyles),f.axrange&&q(h,c.rangesAltered),f.ticks&&h.push(T.doTicksRelayout),f.modebar&&h.push(T.doModeBar),f.camera&&h.push(T.doCamera),h.push(S)),h.push(d.rehover,d.redrag),u.add(t,Q,[t,s.undoit,c.undoit,s.traces],Q,[t,s.redoit,c.redoit,s.traces]);var p=o.syncOrAsync(h,t);return p&&p.then||(p=Promise.resolve(t)),p.then((function(){return t.emit("plotly_update",{data:s.eventData,layout:c.eventData}),t}))}function $(t){return function(e){e._fullLayout._guiEditing=!0;var r=t.apply(null,arguments);return e._fullLayout._guiEditing=!1,r}}var K=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],tt=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function et(t,e){for(var r=0;r1;)if(n.pop(),void 0!==(r=s(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(t,e){for(var r=0;r=a.length?a[0]:a[t]:a}function l(t){return Array.isArray(i)?t>=i.length?i[0]:i[t]:i}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(i,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,d.transition(t,e.frame.data,e.frame.layout,A.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 h(){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(a)?v>=a.length?t.transitionOpts=a[v]:t.transitionOpts=a[0]:t.transitionOpts=a,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&&TT)&&k.push(g);y=k}}y.length>0?function(e){if(0!==e.length){for(var a=0;a=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&&E<5&&(E++,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===E&&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},h.push({frame:d.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}h.sort((function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(a=h[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;c[a.name="frame "+t._transitionData._counter++];);if(c[a.name]){for(i=0;i=0;r--)n=e[r],i.push({type:"delete",index:n}),s.unshift({type:"insert",index:n,value:a[n]});var l=d.modifyFrames,c=d.modifyFrames,f=[t,s],h=[t,i];return u&&u.add(t,l,f,c,h),d.modifyFrames(t,i)},r.addTraces=function t(e,n,a){e=o.getGraphDiv(e);var i,s,l=[],c=r.deleteTraces,f=t,d=[e,l],h=[e,n];for(function(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!_(o))return!1;t=i[a][o]}else t=i[a]}else t=i}}return t}function _(t){return t===Math.round(t)&&t>=0}function w(){var t,e,r={};for(t in p(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var a=0;a=l.length)return!1;a=(r=(n.transformsRegistry[l[u].type]||{}).attributes)&&r[e[2]],s=3}else if("area"===t.type)a=c[o];else{var f=t._module;if(f||(f=(n.modules[t.type||i.type.dflt]||{})._module),!f)return!1;if(!(a=(r=f.attributes)&&r[o])){var d=f.basePlotModule;d&&d.attributes&&(a=d.attributes[o])}a||(a=i[o])}return x(a,e,s)},r.getLayoutValObject=function(t,e){return x(function(t,e){var r,a,i,s,l=t._basePlotModules;if(l){var u;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var s,l=e+"["+i+"]";function u(){s={},o&&(s[l]={},s[l].templateitemname=o)}function c(t,e){o?n.nestedProperty(s[l],t).set(e):s[l+"."+t]=e}function f(){var t=s;return u(),t}return u(),{modifyBase:function(t,e){s[t]=e},modifyItem:c,getUpdateObj:f,applyUpdate:function(e,r){e&&c(e,r);var a=f();for(var i in a)n.nestedProperty(t,i).set(a[i])}}}},{"../lib":497,"../plots/attributes":541}],535:[function(t,e,r){"use strict";var n=t("d3"),a=t("../registry"),i=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"),d=t("../plots/cartesian/axes"),h=t("../constants/alignment"),p=t("../plots/cartesian/constraints"),g=p.enforce,v=p.clean,m=t("../plots/cartesian/autorange").doAutoRange;function y(t,e,r){for(var n=0;n=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}function b(t){var e,a,s,c,p,g,v=t._fullLayout,m=v._size,b=m.p,_=d.list(t,"",!0);if(v._paperdiv.style({width:t._context.responsive&&v.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":v.width+"px",height:t._context.responsive&&v.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(u.setSize,v.width,v.height),t._context.setBackground(t,v.paper_bgcolor),r.drawMainTitle(t),f.manage(t),!v._has("cartesian"))return i.previousPromises(t);function A(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-b-n:e._offset+e._length+b+n:m.t+m.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+b+n:e._offset-b-n:m.l+m.w*(t.position||0)+n%1}for(e=0;e<_.length;e++){var T=(c=_[e])._anchorAxis;c._linepositions={},c._lw=u.crispRound(t,c.linewidth,1),c._mainLinePosition=A(c,T,c.side),c._mainMirrorPosition=c.mirror&&T?A(c,T,h.OPPOSITE_SIDE[c.side]):null}var k=[],M=[],E=[],S=1===l.opacity(v.paper_bgcolor)&&1===l.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(a in v._plots)if((s=v._plots[a]).mainplot)s.bg&&s.bg.remove(),s.bg=void 0;else{var C=s.xaxis.domain,L=s.yaxis.domain,O=s.plotgroup;if(y(C,L,E)){var D=O.node(),R=s.bg=o.ensureSingle(O,"rect","bg");D.insertBefore(R.node(),D.childNodes[0]),M.push(a)}else O.select("rect.bg").remove(),E.push([C,L]),S||(k.push(a),M.push(a))}var I,P,F,z,N,B,j,U,V,H,G,q,X,W=v._bgLayer.selectAll(".bg").data(k);for(W.enter().append("rect").classed("bg",!0),W.exit().remove(),W.each((function(t){v._plots[t].bg=n.select(this)})),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 i=e[n],o=g(e,n,r);a(i)?(Array.isArray(e)&&!1===i._template&&i.templateitemname&&c.push({code:"missing",path:o,templateitemname:i.templateitemname}),t(i,o)):Array.isArray(i)&&v(i)&&t(i,o)}}({data:h,layout:d},""),c.length)return c.map(m)}},{"../lib":497,"../plots/attributes":541,"../plots/plots":583,"./plot_config":532,"./plot_schema":533,"./plot_template":534}],537:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./plot_api"),i=t("../plots/plots"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg"),c=t("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,d,h,p;function g(t){return!(t in e)||o.validate(e[t],f[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],d=t.layout||{},h=t.config||{},p={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),d=o.extendDeep({},t.layout),h=t._context,p=t._fullLayout||{}),!g("width")&&null!==e.width||!g("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Export format is not "+o.join2(f.format.values,", "," or ")+".");var v={};function m(t,r){return o.coerce(e,v,f,t,r)}var y=m("format"),b=m("width"),x=m("height"),_=m("scale"),w=m("setBackground"),A=m("imageDataOnly"),T=document.createElement("div");T.style.position="absolute",T.style.left="-5000px",document.body.appendChild(T);var k=o.extendFlat({},d);b?k.width=b:null===e.width&&n(p.width)&&(k.width=p.width),x?k.height=x:null===e.height&&n(p.height)&&(k.height=p.height);var M=o.extendFlat({},h,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),E=s.getRedrawFunc(T);function S(){return new Promise((function(t){setTimeout(t,s.getDelay(T._fullLayout))}))}function C(){return new Promise((function(t,e){var r=l(T,y,_),n=T._fullLayout.width,f=T._fullLayout.height;function d(){a.purge(T),document.body.removeChild(T)}if("full-json"===y){var h=i.graphJson(T,!1,"keepdata","object",!0,!0);return h.version=c,h=JSON.stringify(h),d(),t(A?h:s.encodeJSON(h))}if(d(),"svg"===y)return t(A?r:s.encodeSVG(r));var p=document.createElement("canvas");p.id=o.randstr(),u({format:y,width:n,height:f,scale:_,canvas:p,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){a.plot(T,r,k,M).then(E).then(S).then(C).then((function(e){t(function(t){return A?t.replace(s.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":497,"../plots/plots":583,"../snapshot/helpers":595,"../snapshot/svgtoimg":597,"../snapshot/tosvg":599,"../version":705,"./plot_api":531,"fast-isnumeric":155}],538:[function(t,e,r){"use strict";var n=t("../lib"),a=t("../plots/plots"),i=t("./plot_schema"),o=t("./plot_config").dfltConfig,s=n.isPlainObject,l=Array.isArray,u=n.isArrayOrTypedArray;function c(t,e,r,a,i,o){o=o||[];for(var f=Object.keys(t),d=0;db.length&&a.push(p("unused",i,m.concat(b.length)));var k,M,E,S,C,L=b.length,O=Array.isArray(T);if(O&&(L=Math.min(L,T.length)),2===x.dimensions)for(M=0;Mb[M].length&&a.push(p("unused",i,m.concat(M,b[M].length)));var D=b[M].length;for(k=0;k<(O?Math.min(D,T[M].length):D);k++)E=O?T[M][k]:T,S=y[M][k],C=b[M][k],n.validate(S,E)?C!==S&&C!==+S&&a.push(p("dynamic",i,m.concat(M,k),S,C)):a.push(p("value",i,m.concat(M,k),S))}else a.push(p("array",i,m.concat(M),y[M]));else for(M=0;M1&&h.push(p("object","layout"))),a.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&Math.round(f)===f))return a;u=f}for(var d=e.calendar,h="start"===l,p="end"===l,g=t[r+"period0"],v=i(g,d)||0,m=[],y=a.length,b=0;bA;)w=o(w,-u,d);for(;w<=A;)w=o(w,u,d);_=o(w,-u,d)}else{for(w=v+(x=Math.round((A-v)/c))*c;w>A;)w-=c;for(;w<=A;)w+=c;_=w-c}m[b]=h?_:p?w:(_+w)/2}return m}},{"../../constants/numerical":474,"../../lib":497,"fast-isnumeric":155}],543:[function(t,e,r){"use strict";e.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],544:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").FP_SAFE,o=t("../../registry"),s=t("./axis_ids").getFromId;function l(t,e){var r,n,i=[],o=c(e,0),s=c(e,1),l=f(t,e),d=l.min,h=l.max;if(0===d.length||0===h.length)return a.simpleMap(e.range,e.r2l);var p=d[0].val,g=h[0].val;for(r=1;r0&&((w=E-o(y)-s(b))>S?A/w>C&&(x=y,_=b,C=A/w):A/E>C&&(x={val:y.val,pad:0},_={val:b.val,pad:0},C=A/E));if(p===g){var L=p-1,O=p+1;if(k)if(0===p)i=[0,1];else{var D=(p>0?h:d).reduce((function(t,e){return Math.max(t,s(e))}),0),R=p/(1-Math.min(.5,D/E));i=p>0?[0,R]:[R,0]}else i=M?[Math.max(0,L),Math.max(1,O)]:[L,O]}else k?(x.val>=0&&(x={val:0,pad:0}),_.val<=0&&(_={val:0,pad:0})):M&&(x.val-C*o(x)<0&&(x={val:0,pad:0}),_.val<=0&&(_={val:1,pad:0})),C=(_.val-x.val-u(e,y.val,b.val))/(E-o(x)-s(_)),i=[x.val-C*o(x),_.val+C*s(_)];return v&&i.reverse(),a.simpleMap(i,e.l2r||Number)}function u(t,e,r){var n=0;if(t.rangebreaks)for(var a=t.locateBreaks(e,r),i=0;i0?r.ppadplus:r.ppadminus)||r.ppad||0),E=k((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),S=k(r.vpadplus||r.vpad),C=k(r.vpadminus||r.vpad);if(!A){if(p=1/0,v=-1/0,w)for(a=0;a0&&(p=o),o>v&&o-i&&(p=o),o>v&&o=D;a--)O(a);return{min:m,max:y,opts:r}},concatExtremes:f};function f(t,e,r){var n,a,i,o=e._id,l=t._fullData,u=t._fullLayout,c=[],p=[];function g(t,e){for(n=0;n=r&&(u.extrapad||!o)){s=!1;break}a(e,u.val)&&u.pad<=r&&(o||!u.extrapad)&&(t.splice(l,1),l--)}if(s){var c=i&&0===e;t.push({val:e,pad:c?0:r,extrapad:!c&&o})}}function g(t){return n(t)&&Math.abs(t)=e}},{"../../constants/numerical":474,"../../lib":497,"../../registry":591,"./axis_ids":548,"fast-isnumeric":155}],545:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib"),l=s.strTranslate,u=t("../../lib/svg_text_utils"),c=t("../../components/titles"),f=t("../../components/color"),d=t("../../components/drawing"),h=t("./layout_attributes"),p=t("./clean_ticks"),g=t("../../constants/numerical"),v=g.ONEMAXYEAR,m=g.ONEAVGYEAR,y=g.ONEMINYEAR,b=g.ONEMAXQUARTER,x=g.ONEAVGQUARTER,_=g.ONEMINQUARTER,w=g.ONEMAXMONTH,A=g.ONEAVGMONTH,T=g.ONEMINMONTH,k=g.ONEWEEK,M=g.ONEDAY,E=M/2,S=g.ONEHOUR,C=g.ONEMIN,L=g.ONESEC,O=g.MINUS_SIGN,D=g.BADNUM,R=t("../../constants/alignment"),I=R.MID_SHIFT,P=R.CAP_SHIFT,F=R.LINE_SPACING,z=R.OPPOSITE_SIDE,N=e.exports={};N.setConvert=t("./set_convert");var B=t("./axis_autotype"),j=t("./axis_ids");N.id2name=j.id2name,N.name2id=j.name2id,N.cleanId=j.cleanId,N.list=j.list,N.listIds=j.listIds,N.getFromId=j.getFromId,N.getFromTrace=j.getFromTrace;var U=t("./autorange");N.getAutoRange=U.getAutoRange,N.findExtremes=U.findExtremes;function V(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}N.coerceRef=function(t,e,r,n,a,i){var o=n.charAt(n.length-1),l=r._fullLayout._subplots[o+"axis"],u=n+"ref",c={};return a||(a=l[0]||("string"==typeof i?i:i[0])),i||(i=a),l=l.concat(l.map((function(t){return t+" domain"}))),c[u]={valType:"enumerated",values:l.concat(i?"string"==typeof i?[i]:i:[]),dflt:a},s.coerce(t,e,c,u)},N.getRefType=function(t){return void 0===t?t:"paper"===t?"paper":"pixel"===t?"pixel":/( domain)$/.test(t)?"domain":"range"},N.coercePosition=function(t,e,r,n,a,i){var o,l;if("range"!==N.getRefType(n))o=s.ensureNumber,l=r(a,i);else{var u=N.getFromId(e,n);l=r(a,i=u.fraction2r(i)),o=u.cleanPos}t[a]=o(l)},N.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:N.getFromId(e,r).cleanPos)(t)},N.redrawComponents=function(t,e){e=e||N.listIds(t);var r=t._fullLayout;function n(n,a,i,s){for(var l=o.getComponentMethod(n,a),u={},c=0;c2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.saveRangeInitial=function(t,e){for(var r=N.list(t,"",!0),n=!1,a=0;a.3*d||c(n)||c(i))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=N.tickIncrement(t,"M6","reverse")+1.5*M:i.exactMonths>.8?t=N.tickIncrement(t,"M1","reverse")+15.5*M:t-=E;var l=N.tickIncrement(t,r);if(l<=n)return l}return t}(y,t,m,u,i)),v=y,0;v<=c;)v=N.tickIncrement(v,m,!1,i);return{start:e.c2r(y,0,i),end:e.c2r(v,0,i),size:m,_dataSpan:c-u}},N.prepTicks=function(t,e){var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if(t._dtickInit=t.dtick,t._tick0Init=t.tick0,"auto"===t.tickmode||!t.dtick){var n,i=t.nticks;i||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,i=t._length/n):(n="y"===t._id.charAt(0)?40:80,i=s.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(i*=2)),"array"===t.tickmode&&(i*=100),t._roughDTick=Math.abs(r[1]-r[0])/i,N.autoTicks(t,t._roughDTick),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}"period"===t.ticklabelmode&&function(t){var e;function r(){return!(a(t.dtick)||"M"!==t.dtick.charAt(0))}var n=r(),i=N.getTickFormat(t);if(i){var o=t._dtickInit!==t.dtick;/%[fLQsSMX]/.test(i)||(/%[HI]/.test(i)?(e=S,o&&!n&&t.dticki&&f=o:h<=o;h=N.tickIncrement(h,t.dtick,l,t.calendar)){if(t.rangebreaks&&!l){if(h=c)break}if(C.length>g||h===L)break;L=h;var O=!1;f&&h!==(0|h)&&(O=!0),C.push({minor:O,value:h})}if(d&&function(t,e,r){for(var n=0;n0?(i=n-1,o=n):(i=n,o=n);var s,l=t[i].value,u=t[o].value,c=Math.abs(u-l),f=r||c,d=0;f>=y?d=c>=y&&c<=v?c:m:r===x&&f>=_?d=c>=_&&c<=b?c:x:f>=T?d=c>=T&&c<=w?c:A:r===k&&f>=k?d=k:f>=M?d=M:r===E&&f>=E?d=E:r===S&&f>=S&&(d=S),d>=c&&(d=c,s=!0);var h=a+d;if(e.rangebreaks&&d>0){for(var p=0,g=0;g<84;g++){var C=(g+.5)/84;e.maskBreaks(a*(1-C)+C*h)!==D&&p++}(d*=p/84)||(t[n].drop=!0),s&&c>k&&(d=c)}(d>0||0===n)&&(t[n].periodX=a+d/2)}}(C,t,t._definedDelta),t.rangebreaks){var R="y"===t._id.charAt(0),I=1;"auto"===t.tickmode&&(I=t.tickfont?t.tickfont.size:12);var P=NaN;for(p=C.length-1;p>-1;p--)if(C[p].drop)C.splice(p,1);else{C[p].value=xt(C[p].value,t);var F=t.c2p(C[p].value);(R?P>F-I:Pc||Bc&&(z.periodX=c),B10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=M&&i<=10||e>=15*M)t._tickround="d";else if(e>=C&&i<=16||e>=S)t._tickround="M";else if(e>=L&&i<=19||e>=C)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,o)-20,t._tickround<0&&(t._tickround=4)}}else if(a(e)||"L"===e.charAt(0)){var s=t.range.map(t.r2d||Number);a(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),c=void 0===t.minexponent?3:t.minexponent;Math.abs(u)>c&&(at(t.exponentformat)&&!it(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function rt(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}}N.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,0);var i=2*e;if(i>m)e/=m,r=n(10),t.dtick="M"+12*tt(e,r,W);else if(i>A)e/=A,t.dtick="M"+tt(e,1,Y);else if(i>M){t.dtick=tt(e,M,t._hasDayOfWeekBreaks?[1,2,7,14]:J);var o=N.getTickFormat(t),l="period"===t.ticklabelmode;l&&(t._rawTick0=t.tick0),/%[uVW]/.test(o)?t.tick0=s.dateTick0(t.calendar,2):t.tick0=s.dateTick0(t.calendar,1),l&&(t._dowTick0=t.tick0)}else i>S?t.dtick=tt(e,S,Y):i>C?t.dtick=tt(e,C,Z):i>L?t.dtick=tt(e,L,Z):(r=n(10),t.dtick=tt(e,r,W))}else if("log"===t.type){t.tick0=0;var u=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(u[1]-u[0])<1){var c=1.5*Math.abs((u[1]-u[0])/e);e=Math.abs(Math.pow(10,u[1])-Math.pow(10,u[0]))/c,r=n(10),t.dtick="L"+tt(e,r,W)}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))):bt(t)?(t.tick0=0,r=1,t.dtick=tt(e,r,K)):(t.tick0=0,r=n(10),t.dtick=tt(e,r,W));if(0===t.dtick&&(t.dtick=1),!a(t.dtick)&&"string"!=typeof t.dtick){var f=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(f)}},N.tickIncrement=function(t,e,r,i){var o=r?-1:1;if(a(e))return s.increment(t,o*e);var l=e.charAt(0),u=o*Number(e.substr(1));if("M"===l)return s.incrementMonth(t,u,i);if("L"===l)return Math.log(Math.pow(10,t)+u)/Math.LN10;if("D"===l){var c="D2"===e?$:Q,f=t+.01*o,d=s.roundUp(s.mod(f,1),c,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t,e){var r=t.r2l||Number,i=s.simpleMap(t.range,r,void 0,void 0,e),o=i[1]"+l,t._prevDateHead=l));e.text=u}(t,o,r,u):"log"===c?function(t,e,r,n,i){var o=t.dtick,l=e.x,u=t.tickformat,c="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==c&&(o="L3",c="L");if(u||"L"===c)e.text=ot(Math.pow(10,l),t,i,n);else if(a(o)||"D"===c&&s.mod(l+.01,1)<.1){var f=Math.round(l),d=Math.abs(f),h=t.exponentformat;"power"===h||at(h)&&it(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":O)+d+"",e.fontSize*=1.25):("e"===h||"E"===h)&&d>2?e.text="1"+h+(f>0?"+":O)+d:(e.text=ot(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,o,0,u,g):"category"===c?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===c?function(t,e,r){var n=Math.round(e.x),a=t._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?e.text=o+" - "+i:(e.text=i,e.text2=o)}(t,o,r):bt(t)?function(t,e,r,n,a){if("radians"!==t.thetaunit||r)e.text=ot(e.x,t,a,n);else{var i=e.x/180;if(0===i)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){for(var r=1;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,a=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)e.text=ot(s.deg2rad(e.x),t,a,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=O+e.text)}}}}(t,o,r,u,g):function(t,e,r,n,a){"never"===a?a="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide");e.text=ot(e.x,t,a,n)}(t,o,0,u,g),n||(t.tickprefix&&!p(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!p(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var v=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[v(o.x-.5),v(o.x+t.dtick-.5)]}return o},N.hoverLabelText=function(t,e,r){if(r!==D&&r!==e)return N.hoverLabelText(t,e)+" - "+N.hoverLabelText(t,r);var n="log"===t.type&&e<=0,a=N.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":O+a:a};var nt=["f","p","n","\u03bc","m","","k","M","G","T"];function at(t){return"SI"===t||"B"===t}function it(t){return t>14||t<-15}function ot(t,e,r,n){var i=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=N.getTickFormat(e),f=e.separatethousands;if(n){var d={exponentformat:l,minexponent:e.minexponent,dtick:"none"===e.showexponent?e.dtick:a(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};et(d),o=(Number(d._tickround)||0)+4,u=d._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,O);var h,p=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))"+h+"":"B"===l&&9===u?t+="B":at(l)&&(t+=nt[u/3+5]));return i?O+t:t}function st(t,e){for(var r=[],n={},a=0;a1&&r=a.min&&t=0,i=c(t,e[1])<=0;return(r||a)&&(n||i)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=o(a)))){r=n;break}break;case"log":for(e=0;e0?r.bottom-f:0,d)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var h=[0,1];if("x"===p){if("b"===l?n[l]=e._depth:(n[l]=e._depth=Math.max(r.width>0?f-r.top:0,d),h.reverse()),r.width>0){var v=r.right-(e._offset+e._length);v>0&&(n.xr=1,n.r=v);var m=e._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===l?n[l]=e._depth=Math.max(r.height>0?f-r.left:0,d):(n[l]=e._depth=Math.max(r.height>0?r.right-f:0,d),h.reverse()),r.height>0){var y=r.bottom-(e._offset+e._length);y>0&&(n.yb=0,n.b=y);var b=e._offset-r.top;b>0&&(n.yt=1,n.t=b)}n[g]="free"===e.anchor?e.position:e._anchorAxis.domain[h[0]],e.title.text!==u._dfltTitle[p]&&(n[l]+=ct(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[c]=e.linewidth,e.mirror&&!0!==e.mirror&&(a[c]+=d),!0===e.mirror||"ticks"===e.mirror?a[g]=e._anchorAxis.domain[h[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(a[g]=[e._counterDomainMin,e._counterDomainMax][h[1]]))}Q&&(s=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),i.autoMargin(t,ht(e),n),i.autoMargin(t,pt(e),a),i.autoMargin(t,gt(e),s)})),r.skipTitle||Q&&"bottom"===e.side||Z.push((function(){return function(t,e){var r,n=t._fullLayout,a=e._id,i=a.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+ct(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===i?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var s,l,u,f,h=N.getPxPosition(t,e);"x"===i?(l=e._offset+e._length/2,u="top"===e.side?h-r:h+r):(u=e._offset+e._length/2,l="right"===e.side?h+r:h-r,s={rotate:"-90",offset:0});if("multicategory"!==e.type){var p=e._selections[e._id+"tick"];if(f={selection:p,side:e.side},p&&p.node()&&p.node().parentNode){var g=d.getTranslate(p.node().parentNode);f.offsetLeft=g.x,f.offsetTop=g.y}e.title.hasOwnProperty("standoff")&&(f.pad=0)}return c.draw(t,a+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[i],avoid:f,transform:s,attributes:{x:l,y:u,"text-anchor":"middle"}})}(t,e)})),s.syncOrAsync(Z)}}function $(t){var r=h+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,a,i;t._selections[e].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,t._selections[e].each((function(){var t=dt(this),e=d.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),a=Math.min(a,e.left),i=Math.max(i,e.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(e,r)),w[r]}},N.getTickSigns=function(t){var e=t._id.charAt(0),r={x:"top",y:"right"}[e],n=t.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==t.ticks==("x"===e)&&(a=a.map((function(t){return-t}))),t.side&&a.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),a},N.makeTransTickFn=function(t){return"x"===t._id.charAt(0)?function(e){return l(t._offset+t.l2p(e.x),0)}:function(e){return l(0,t._offset+t.l2p(e.x))}},N.makeTransTickLabelFn=function(t){var e=function(t){var e=t.ticklabelposition||"",r=function(t){return-1!==e.indexOf(t)},n=r("top"),a=r("left"),i=r("right"),o=r("bottom"),s=r("inside"),l=o||a||n||i;if(!l&&!s)return[0,0];var u=t.side,c=l?(t.tickwidth||0)/2:0,f=3,d=t.tickfont?t.tickfont.size:12;(o||n)&&(c+=d*P,f+=(t.linewidth||0)/2);(a||i)&&(c+=(t.linewidth||0)/2,f+=3);s&&"top"===u&&(f-=d*(1-P));(a||n)&&(c=-c);"bottom"!==u&&"right"!==u||(f=-f);return[l?c:0,s?f:0]}(t),r=e[0],n=e[1];return"x"===t._id.charAt(0)?function(e){return l(r+t._offset+t.l2p(lt(e)),n)}:function(e){return l(n,r+t._offset+t.l2p(lt(e)))}},N.makeTickPath=function(t,e,r,n){n=void 0!==n?n:t.ticklen;var a=t._id.charAt(0),i=(t.linewidth||1)/2;return"x"===a?"M0,"+(e+i*r)+"v"+n*r:"M"+(e+i*r)+",0h"+n*r},N.makeLabelFns=function(t,e,r){var n=t.ticklabelposition||"",i=function(t){return-1!==n.indexOf(t)},o=i("top"),l=i("left"),u=i("right"),c=i("bottom")||l||o||u,f=i("inside"),d="inside"===n&&"inside"===t.ticks||!f&&"outside"===t.ticks&&"boundaries"!==t.tickson,h=0,p=0,g=d?t.ticklen:0;if(f?g*=-1:c&&(g=0),d&&(h+=g,r)){var v=s.deg2rad(r);h=g*Math.cos(v)+1,p=g*Math.sin(v)}t.showticklabels&&(d||t.showline)&&(h+=.2*t.tickfont.size);var m,y,b,x,_,w={labelStandoff:h+=(t.linewidth||1)/2*(f?-1:1),labelShift:p},A=0,T=t.side,k=t._id.charAt(0),M=t.tickangle;if("x"===k)x=(_=!f&&"bottom"===T||f&&"top"===T)?1:-1,f&&(x*=-1),m=p*x,y=e+h*x,b=_?1:-.2,90===Math.abs(M)&&(f?b+=I:b=-90===M&&"bottom"===T?P:90===M&&"top"===T?I:.5,A=I/2*(M/90)),w.xFn=function(t){return t.dx+m+A*t.fontSize},w.yFn=function(t){return t.dy+y+t.fontSize*b},w.anchorFn=function(t,e){if(c){if(l)return"end";if(u)return"start"}return a(e)&&0!==e&&180!==e?e*x<0!==f?"end":"start":"middle"},w.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side!==f?-n:0};else if("y"===k){if(x=(_=!f&&"left"===T||f&&"right"===T)?1:-1,f&&(x*=-1),m=h,y=p*x,b=0,f||90!==Math.abs(M)||(b=-90===M&&"left"===T||90===M&&"right"===T?P:.5),f){var E=a(M)?+M:0;if(0!==E){var S=s.deg2rad(E);A=Math.abs(Math.sin(S))*P*x,b=0}}w.xFn=function(t){return t.dx+e-(m+t.fontSize*b)*x+A*t.fontSize},w.yFn=function(t){return t.dy+y+t.fontSize*I},w.anchorFn=function(t,e){return a(e)&&90===Math.abs(e)?"middle":_?"end":"start"},w.heightFn=function(e,r,n){return"right"===t.side&&(r*=-1),r<-30?-n:r<30?-.5*n:0}}return w},N.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",a=r.vals;"period"===e.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(e.ticks?a:[],ut);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(f.stroke,e.tickcolor).style("stroke-width",d.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},N.drawGrid=function(t,e,r){r=r||{};var n=e._id+"grid",a=r.vals,i=r.counterAxis;if(!1===e.showgrid)a=[];else if(i&&N.shouldShowZeroLine(t,e,i))for(var o="array"===e.tickmode,s=0;so||a.lefto||a.top+(e.tickangle?0:t.fontSize/4)1)for(n=1;n2*o}(a,e))return"date";var v="strict"!==r.autotypenumbers;return function(t,e){for(var r=t.length,n=f(r),a=0,o=0,s={},c=0;c2*a}(a,v)?"category":function(t,e){for(var r=t.length,n=0;n=2){var l,u,c="";if(2===o.length)for(l=0;l<2;l++)if(u=y(o[l])){c=p;break}var f=a("pattern",c);if(f===p)for(l=0;l<2;l++)(u=y(o[l]))&&(e.bounds[l]=o[l]=u-1);if(f)for(l=0;l<2;l++)switch(u=o[l],f){case p:if(!n(u))return void(e.enabled=!1);if((u=+u)!==Math.floor(u)||u<0||u>=7)return void(e.enabled=!1);e.bounds[l]=o[l]=u;break;case g:if(!n(u))return void(e.enabled=!1);if((u=+u)<0||u>24)return void(e.enabled=!1);e.bounds[l]=o[l]=u}if(!1===r.autorange){var d=r.range;if(d[0]d[1])return void(e.enabled=!1)}else if(o[0]>d[0]&&o[1]n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.ref2id=function(t){return!!/^[xyz]/.test(t)&&t.split(" ")[0]}},{"../../registry":591,"./constants":551}],549:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){if("category"===e.type){var a,i=t.categoryarray,o=Array.isArray(i)&&i.length>0;o&&(a="array");var s,l=r("categoryorder",a);"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,a,i=e.dataAttr||t._id.charAt(0),o={};if(e.axData)r=e.axData;else for(r=[],n=0;nn?a.substr(n):i.substr(r))+o:a+i+t*e:o}function v(t,e){for(var r=e._size,n=r.h/r.w,a={},i=Object.keys(t),o=0;ou*b)||A)for(r=0;rR&&zO&&(O=z);d/=(O-L)/(2*D),L=l.l2r(L),O=l.l2r(O),l.range=l._input.range=E=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function N(t,e,r,n,a){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",l(r,n)).attr("d",a+"Z")}function B(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",l(e,r)).attr("d","M0,0Z")}function j(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),U(t,e,a,i)}function U(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 V(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function H(t){O&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),O=!1)}function G(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,L)/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 q(t,e,r,n,a){for(var i,o,l,u,c=!1,f={},d={},h=(a||{}).xaHash,p=(a||{}).yaHash,g=0;g=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(V(a),2!==t||vt||Ht(),gt)i.indexOf("select")>-1&&M(r,a,Z,J,e.id,Lt),i.indexOf("event")>-1&&d.click(a,r,e.id);else if(1===t&&vt){var s=p?D:O,l="s"===p||"w"===v?0:1,c=s._name+".range["+l+"]",f=function(t,e){var r,a=t.range[e],i=Math.abs(a-t.range[1-e]);return"date"===t.type?a:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(s,l),h="left",g="middle";if(s.fixedrange)return;p?(g="n"===p?"top":"bottom","right"===s.side&&(h="right")):"e"===v&&(h="right"),a._context.showAxisRangeEntryBoxes&&n.select(bt).call(u.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(f),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:h,verticalAlign:g}).on("edit",(function(t){var e=s.d2r(t);void 0!==e&&o.call("_guiRelayout",a,c,e)}))}}}function Rt(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min(K,dt*e+xt)),a=Math.max(0,Math.min(tt,ht*r+_t)),i=Math.abs(n-xt),o=Math.abs(a-_t);function s(){Mt="",wt.r=wt.l,wt.t=wt.b,St.attr("d","M0,0Z")}if(wt.l=Math.min(xt,n),wt.r=Math.max(xt,n),wt.t=Math.min(_t,a),wt.b=Math.max(_t,a),et.isSubplotConstrained)i>L||o>L?(Mt="xy",i/K>o/tt?(o=i*tt/K,_t>a?wt.t=_t-o:wt.b=_t+o):(i=o*K/tt,xt>n?wt.l=xt-i:wt.r=xt+i),St.attr("d",G(wt))):s();else if(rt.isSubplotConstrained)if(i>L||o>L){Mt="xy";var l=Math.min(wt.l/K,(tt-wt.b)/tt),u=Math.max(wt.r/K,(tt-wt.t)/tt);wt.l=l*K,wt.r=u*K,wt.b=(1-l)*tt,wt.t=(1-u)*tt,St.attr("d",G(wt))}else s();else!at||o0){var c;if(rt.isSubplotConstrained||!nt&&1===at.length){for(c=0;cg[1]-1/4096&&(e.domain=s),a.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":497,"fast-isnumeric":155}],563:[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 a=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(i+(a[0]-i)*e),t.l2r(i+(a[1]-i)*e)],t.setScale()}},{"../../constants/alignment":469}],564:[function(t,e,r){"use strict";var n=t("polybooljs"),a=t("../../registry"),i=t("../../components/drawing").dashStyle,o=t("../../components/color"),s=t("../../components/fx"),l=t("../../components/fx/helpers").makeEventData,u=t("../../components/dragelement/helpers"),c=u.freeMode,f=u.rectMode,d=u.drawMode,h=u.openMode,p=u.selectMode,g=t("../../components/shapes/draw_newshape/display_outlines"),v=t("../../components/shapes/draw_newshape/helpers").handleEllipse,m=t("../../components/shapes/draw_newshape/newshapes"),y=t("../../lib"),b=t("../../lib/polygon"),x=t("../../lib/throttle"),_=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),A=t("../../plot_api/subroutines").redrawReglTraces,T=t("./constants"),k=T.MINSELECT,M=b.filter,E=b.tester,S=t("./handle_outline").clearSelect,C=t("./helpers"),L=C.p2r,O=C.axValue,D=C.getTransform;function R(t,e,r,n,a,i,o){var s,l,u,c,f,d,p,v,m,y=e._hoverdata,b=e._fullLayout.clickmode.indexOf("event")>-1,x=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(y)){z(t,e,i);var _=function(t,e){var r,n,a=t[0],i=-1,o=[];for(n=0;n0?function(t,e){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===e.searchInfo&&(n=e.searchInfo.cd[0].trace).selectedpoints.length===e.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(s)&&(d=j(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),d(e)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=m(i,t);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function B(t,e,r,n){var a,i,o,s=[],l=e.map((function(t){return t._id})),u=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(a)>-1}function U(t,e,r){var n,i,o,s;for(n=0;n=0)C._fullLayout._deactivateShape(C);else if(!_){var r=I.clickmode;x.done(gt).then((function(){if(x.clear(gt),2===t){for(ft.remove(),K=0;K-1&&R(e,C,a.xaxes,a.yaxes,a.subplot,a,ft),"event"===r&&C.emit("plotly_selected",void 0);s.click(C,e)})).catch(y.error)}},a.doneFn=function(){pt.remove(),x.done(gt).then((function(){x.clear(gt),a.gd.emit("plotly_selected",et),$&&a.selectionDefs&&($.subtract=ct,a.selectionDefs.push($),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,Q)),a.doneFnCompleted&&a.doneFnCompleted(vt)})).catch(y.error),_&&N(a)}},clearSelect:S,clearSelectionsCache:N,selectOnClick:R}},{"../../components/color":367,"../../components/dragelement/helpers":385,"../../components/drawing":389,"../../components/fx":407,"../../components/fx/helpers":403,"../../components/shapes/draw_newshape/display_outlines":452,"../../components/shapes/draw_newshape/helpers":453,"../../components/shapes/draw_newshape/newshapes":454,"../../lib":497,"../../lib/clear_gl_canvases":483,"../../lib/polygon":509,"../../lib/throttle":522,"../../plot_api/subroutines":535,"../../registry":591,"./axis_ids":548,"./constants":551,"./handle_outline":555,"./helpers":556,polybooljs:276}],565:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,u=o.dateTime2ms,c=o.ensureNumber,f=o.isArrayOrTypedArray,d=t("../../constants/numerical"),h=d.FP_SAFE,p=d.BADNUM,g=d.LOG_CLIP,v=d.ONEWEEK,m=d.ONEDAY,y=d.ONEHOUR,b=d.ONEMIN,x=d.ONESEC,_=t("./axis_ids"),w=t("./constants"),A=w.HOUR_PATTERN,T=w.WEEKDAY_PATTERN;function k(t){return Math.pow(10,t)}function M(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",d=r.charAt(0);function E(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],a=t.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return p}function S(e,r,n,a){if((a||{}).msUTC&&i(e))return+e;var s=u(e,n||t.calendar);if(s===p){if(!i(e))return p;e=+e;var l=Math.floor(10*o.mod(e+.05,1)),c=Math.round(e-l/10);s=u(new Date(c))+l/10}return s}function C(e,r,n){return l(e,r,n||t.calendar)}function L(e){return t._categories[Math.round(e)]}function O(e){if(M(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return p}function D(e){if(t._categoriesMap)return t._categoriesMap[e]}function R(t){var e=D(t);return void 0!==e?e:i(t)?+t:void 0}function I(t){return i(t)?+t:D(t)}function P(t,e,r){return n.round(r+e*t,2)}function F(t,e,r){return(t-r)/e}var z=function(e){return i(e)?P(e,t._m,t._b):p},N=function(e){return F(e,t._m,t._b)};if(t.rangebreaks){var B="y"===d;z=function(e){if(!i(e))return p;var r=t._rangebreaks.length;if(!r)return P(e,t._m,t._b);var n=B;t.range[0]>t.range[1]&&(n=!n);for(var a=n?-1:1,o=a*e,s=0,l=0;lc)){s=o<(u+c)/2?l:l+1;break}s=l+1}var f=t._B[s]||0;return isFinite(f)?P(e,t._m2,f):0},N=function(e){var r=t._rangebreaks.length;if(!r)return F(e,t._m,t._b);for(var n=0,a=0;at._rangebreaks[a].pmax&&(n=a+1);return F(e,t._m2,t._B[n])}}t.c2l="log"===t.type?E:c,t.l2c="log"===t.type?k:c,t.l2p=z,t.p2l=N,t.c2p="log"===t.type?function(t,e){return z(E(t,e))}:z,t.p2c="log"===t.type?function(t){return k(N(t))}:N,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=N,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return E(s(t),e)},t.r2d=t.r2c=function(t){return k(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=E,t.l2d=k,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return k(N(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=N,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=S,t.c2d=t.c2r=t.l2d=t.l2r=C,t.d2p=t.r2p=function(e,r,n){return t.l2p(S(e,0,n))},t.p2d=t.p2r=function(t,e,r){return C(N(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,p,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=O,t.r2d=t.c2d=t.l2d=L,t.d2r=t.d2l_noadd=R,t.r2c=function(e){var r=I(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=I,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return L(N(t))},t.r2p=t.d2p,t.p2r=N,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=L,t.d2r=t.d2l_noadd=R,t.r2c=function(e){var r=R(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=D,t.l2r=t.c2r=c,t.r2l=R,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return L(N(t))},t.r2p=t.d2p,t.p2r=N,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:c(t)},t.setupMultiCategory=function(n){var a,i,s=t._traceIndices,l=t._matchGroup;if(l&&0===t._categories.length)for(var u in l)if(u!==r){var c=e[_.id2name(u)];s=s.concat(c._traceIndices)}var h=[[0,{}],[0,{}]],p=[];for(a=0;ah&&(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 o.nestedProperty(t,e).set(a)},t.setScale=function(r){var n=e._size;if(t.overlaying){var a=_.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var i=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(i);var s,l,u=t.r2l(t[i][0],o),c=t.r2l(t[i][1],o),f="y"===d;if((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/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(u,c),Math.max(u,c)),t._rangebreaks.length)){for(s=0;sc&&(h=!h),h&&t._rangebreaks.reverse();var p=h?-1:1;for(t._m2=p*t._length/(Math.abs(c-u)-t._lBreaks),t._B.push(-t._m2*(f?c:u)),s=0;sa&&(a+=7,ia&&(a+=24,i=n&&i=n&&e=s.min&&(ts.max&&(s.max=n),a=!1)}a&&u.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function v(e,r){var n=e.plotinfo,a=n.xaxis,l=n.yaxis,u=a._length,c=l._length,f=!!e.xr1,d=!!e.yr1,h=[];if(f){var p=i.simpleMap(e.xr0,a.r2l),g=i.simpleMap(e.xr1,a.r2l),v=p[1]-p[0],m=g[1]-g[0];h[0]=(p[0]*(1-r)+r*g[0]-p[0])/(p[1]-p[0])*u,h[2]=u*(1-r+r*m/v),a.range[0]=a.l2r(p[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(p[1]*(1-r)+r*g[1])}else h[0]=0,h[2]=u;if(d){var y=i.simpleMap(e.yr0,l.r2l),b=i.simpleMap(e.yr1,l.r2l),x=y[1]-y[0],_=b[1]-b[0];h[1]=(y[1]*(1-r)+r*b[1]-y[1])/(y[0]-y[1])*c,h[3]=c*(1-r+r*_/x),l.range[0]=a.l2r(y[0]*(1-r)+r*b[0]),l.range[1]=l.l2r(y[1]*(1-r)+r*b[1])}else h[1]=0,h[3]=c;s.drawOne(t,a,{skipTitle:!0}),s.drawOne(t,l,{skipTitle:!0}),s.redrawComponents(t,[a._id,l._id]);var w=f?u/h[2]:1,A=d?c/h[3]:1,T=f?h[0]:0,k=d?h[1]:0,M=f?h[0]/h[2]*u:0,E=d?h[1]/h[3]*c:0,S=a._offset-M,C=l._offset-E;n.clipRect.call(o.setTranslate,T,k).call(o.setScale,1/w,1/A),n.plot.call(o.setTranslate,S,C).call(o.setScale,w,A),o.setPointGroupScale(n.zoomScalePts,1/w,1/A),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/A)}s.redrawComponents(t)}},{"../../components/drawing":389,"../../lib":497,"../../registry":591,"./axes":545,d3:86}],570:[function(t,e,r){"use strict";var n=t("../../registry").traceIs,a=t("./axis_autotype");function i(t){return{v:"x",h:"y"}[t.orientation||"v"]}function o(t,e){var r=i(t),a=n(t,"box-violin"),o=n(t._fullInput||{},"candlestick");return a&&!o&&e===r&&void 0===t[r]&&void 0===t[r+"0"]}e.exports=function(t,e,r,s){r("autotypenumbers",s.autotypenumbersDflt),"-"===r("type",(s.splomStash||{}).type)&&(!function(t,e){if("-"!==t.type)return;var r,s=t._id,l=s.charAt(0);-1!==s.indexOf("scene")&&(s=l);var u=function(t,e,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[e])return a;if((a[r+"axis"]||r)===e){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(e,s,l);if(!u)return;if("histogram"===u.type&&l==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=l+"calendar",f=u[c],d={noMultiCategory:!n(u,"cartesian")||n(u,"noMultiCategory")};"box"===u.type&&u._hasPreCompStats&&l==={h:"x",v:"y"}[u.orientation||"v"]&&(d.noMultiCategory=!0);if(d.autotypenumbers=t.autotypenumbers,o(u,l)){var h=i(u),p=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?l(o,e,s,n+1):e(s,i,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){i(t,u,s.cache),s.check=function(){if(l){var e=i(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(s)?(u.boxEnd[1]=u.boxStart[1]+Math.abs(i)*_*(s>=0?1:-1),u.boxEnd[1]l[3]&&(u.boxEnd[1]=l[3],u.boxEnd[0]=u.boxStart[0]+(l[3]-u.boxStart[1])/Math.abs(_))):(u.boxEnd[0]=u.boxStart[0]+Math.abs(s)/_*(i>=0?1:-1),u.boxEnd[0]l[2]&&(u.boxEnd[0]=l[2],u.boxEnd[1]=u.boxStart[1]+(l[2]-u.boxStart[0])*Math.abs(_)))}}else u.boxEnabled?(i=u.boxStart[0]!==u.boxEnd[0],s=u.boxStart[1]!==u.boxEnd[1],i||s?(i&&(v(0,u.boxStart[0],u.boxEnd[0]),t.xaxis.autorange=!1),s&&(v(1,u.boxStart[1],u.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),u.boxEnabled=!1,u.boxInited=!1):u.boxInited&&(u.boxInited=!1);break;case"pan":u.boxEnabled=!1,u.boxInited=!1,e?(u.panning||(u.dragStart[0]=n,u.dragStart[1]=a),Math.abs(u.dragStart[0]-n)=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),l=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(){b.sendDataToCloud(t)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(t,o),s.text(o.text()&&l.text()?" - ":"")}},b.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var r=n.select(t).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=b.graphJson(t,!1,"keepdata"),a.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],A=["year","month","dayMonth","dayMonthYear"];function T(t,e){var r=t._context.locale;r||(r="en-US");var n=!1,a={};function i(t){for(var r=!0,i=0;i1&&I.length>1){for(o.getComponentMethod("grid","sizeDefaults")(c,l),s=0;s15&&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"),b.linkSubplots(d,l,f,i),b.cleanPlot(d,l,f,i);var B=!(!i._has||!i._has("gl2d")),j=!(!l._has||!l._has("gl2d")),U=!(!i._has||!i._has("cartesian"))||B,V=!(!l._has||!l._has("cartesian"))||j;U&&!V?i._bgLayer.remove():V&&!U&&(l._shouldCreateBgLayer=!0),i._zoomlayer&&!t._dragging&&h({_fullLayout:i}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var a=0;a0){var f=1-2*s;n=Math.round(f*n),a=Math.round(f*a)}}var d=b.layoutAttributes.width.min,h=b.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}),b.sanitizeMargins(r)},b.supplyLayoutModuleDefaults=function(t,e,r,n){var a,i,s,l=o.componentsRegistry,c=e._basePlotModules,f=o.subplotsRegistry.cartesian;for(a in l)(s=l[a]).includeBasePlot&&s.includeBasePlot(t,e);for(var d in c.length||c.push(f),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[d].sort(u.subplotSort);for(i=0;i1&&(r.l/=d,r.r/=d);var h=(r.t+r.b)/s;h>1&&(r.t/=h,r.b/=h);var p=void 0!==r.xl?r.xl:r.x,g=void 0!==r.xr?r.xr:r.x,v=void 0!==r.yt?r.yt:r.y,m=void 0!==r.yb?r.yb:r.y;l[e]={l:{val:p,size:r.l+c},r:{val:g,size:r.r+c},b:{val:m,size:r.b+c},t:{val:v,size:r.t+c}},u[e]=1}else delete l[e],delete u[e];if(!n._replotting)return b.doAutoMargin(t)}},b.doAutoMargin=function(t){var e=t._fullLayout,r=e.width,n=e.height,a=Math.max(0,r-64),s=Math.max(0,n-64);e._size||(e._size={}),C(e);var l=e._size,c=e.margin,f=u.extendFlat({},l),h=c.l,p=c.r,g=c.t,v=c.b,m=e._pushmargin,y=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var x in m)y[x]||delete m[x];for(var _ in m.base={l:{val:0,size:h},r:{val:1,size:p},t:{val:1,size:g},b:{val:0,size:v}},m){var w=m[_].l||{},A=m[_].b||{},T=w.val,k=w.size,M=A.val,E=A.size;for(var S in m){if(i(k)&&m[S].r){var L=m[S].r.val,O=m[S].r.size;if(L>T){var D=(k*L+(O-r)*T)/(L-T),R=(O*(1-T)+(k-r)*(1-L))/(L-T);D+R>h+p&&(h=D,p=R)}}if(i(E)&&m[S].t){var I=m[S].t.val,P=m[S].t.size;if(I>M){var F=(E*I+(P-n)*M)/(I-M),z=(P*(1-M)+(E-n)*(1-I))/(I-M);F+z>v+g&&(v=F,g=z)}}}}}var N=(h+p)/a;N>1&&(h/=N,p/=N);var B=(v+g)/s;if(B>1&&(v/=B,g/=B),l.l=Math.round(h),l.r=Math.round(p),l.t=Math.round(g),l.b=Math.round(v),l.p=Math.round(c.pad),l.w=Math.round(r)-l.l-l.r,l.h=Math.round(n)-l.t-l.b,!e._replotting&&b.didMarginChange(f,l)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var j=3*(1+Object.keys(y).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var i=0,s=0;function l(){return i++,function(){s++,n||s!==i||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(a)}}r.runFn(l),setTimeout(l())}))}],i=u.syncOrAsync(a,t);return i&&i.then||(i=Promise.resolve()),i.then((function(){return t}))}b.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},b.graphJson=function(t,e,r,n,a,i){(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&b.supplyDefaults(t);var o=a?t._fullData:t.data,s=a?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function c(t,e){if("function"==typeof t)return e?"_function_":null;if(u.isPlainObject(t)){var n,a={};return Object.keys(t).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof t[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0&&!u.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0)return;a[i]=c(t[i],e)}else e&&(a[i]="_function")})),a}return Array.isArray(t)?t.map((function(t){return c(t,e)})):u.isTypedArray(t)?u.simpleMap(t,u.identity):u.isJSDate(t)?u.ms2DateTimeLocal(+t):t}var f={data:(o||[]).map((function(t){var r=c(t);return e&&delete r.fit,r}))};if(!e&&(f.layout=c(s),a)){var d=s._size;f.layout.computed={margin:{b:d.b,l:d.l,r:d.r,t:d.t}}}return t.framework&&t.framework.isPolar&&(f=t.framework.getConfig()),l&&(f.frames=c(l)),i&&(f.config=c(t._context,!0)),"object"===n?f:JSON.stringify(f)},b.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;i--)if(s[i].enabled){r._indexToPoints=s[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,p[e]=o}}for(R(l,c,h),a=0;a=0?d.angularAxis.domain:n.extent(A),S=Math.abs(A[1]-A[0]);k&&!T&&(S=0);var C=E.slice();M&&T&&(C[1]+=S);var L=d.angularAxis.ticksCount||4;L>8&&(L=L/(L/8)+L%8),d.angularAxis.ticksStep&&(L=(C[1]-C[0])/L);var O=d.angularAxis.ticksStep||(C[1]-C[0])/(L*(d.minorTicks+1));w&&(O=Math.max(Math.round(O),1)),C[2]||(C[2]=O);var D=n.range.apply(this,C);if(D=D.map((function(t,e){return parseFloat(t.toPrecision(12))})),s=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===d.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=M?S:0,"undefined"==typeof(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 P,F=t.select(".chart-group"),z={fill:"none",stroke:d.tickColor},N={"font-size":d.font.size,"font-family":d.font.family,fill:d.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(t,e){return" "+t+" 0 "+d.font.outlineColor})).join(",")};if(d.showLegend){P=t.select(".legend-group").attr({transform:"translate("+[b,d.margin.top]+")"}).style({display:"block"});var B=h.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:h.map((function(t,e){return t.name||"Element"+e})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:P,elements:B,reverseOrder:d.legend.reverseOrder})})();var j=P.node().getBBox();b=Math.min(d.width-j.width-d.margin.left-d.margin.right,d.height-d.margin.top-d.margin.bottom)/2,b=Math.max(10,b),_=[d.margin.left+b,d.margin.top+b],r.range([0,b]),c.layout.radialAxis.domain=r.domain(),P.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else P=t.select(".legend-group").style({display:"none"});t.attr({width:d.width,height:d.height}).style({opacity:d.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(d.width-(d.margin.left+d.margin.right+2*b+(j?j.width:0)))/2,(d.height-(d.margin.top+d.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+")"),d.title&&d.title.text){var V=t.select("g.title-group text").style(N).text(d.title.text),H=V.node().getBBox();V.attr({x:_[0]-H.width/2,y:_[1]-b-20})}var G=t.select(".radial.axis-group");if(d.radialAxis.gridLinesVisible){var q=G.selectAll("circle.grid-circle").data(r.ticks(5));q.enter().append("circle").attr({class:"grid-circle"}).style(z),q.attr("r",r),q.exit().remove()}G.select("circle.outside-circle").attr({r:b}).style(z);var X=t.select("circle.background-circle").attr({r:b}).style({fill:d.backgroundColor,stroke:d.stroke});function W(t,e){return s(t)%360+d.orientation}if(d.radialAxis.visible){var Y=n.svg.axis().scale(r).ticks(5).tickSize(5);G.call(Y).attr({transform:"rotate("+d.radialAxis.orientation+")"}),G.selectAll(".domain").style(z),G.selectAll("g>text").text((function(t,e){return this.textContent+d.radialAxis.ticksSuffix})).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===d.radialAxis.tickOrientation?"rotate("+-d.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var Z=t.select(".angular.axis-group").selectAll("g.angular-tick").data(D),J=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+W(t)+")"}}).style({display:d.angularAxis.visible?"block":"none"}),Z.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",(function(t,e){return e%(d.minorTicks+1)==0})).classed("minor",(function(t,e){return!(e%(d.minorTicks+1)==0)})).style(z),J.selectAll(".minor").style({stroke:d.minorTickColor}),Z.select("line.grid-line").attr({x1:d.tickLength?b-d.tickLength:0,x2:b}).style({display:d.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(N);var Q=Z.select("text.axis-text").attr({x:b+d.labelOffset,dy:i+"em",transform:function(t,e){var r=W(t),n=b+d.labelOffset,a=d.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:d.angularAxis.labelsVisible?"block":"none"}).text((function(t,e){return e%(d.minorTicks+1)!=0?"":w?w[t]+d.angularAxis.ticksSuffix:t+d.angularAxis.ticksSuffix})).style(N);d.angularAxis.rewriteTicks&&Q.text((function(t,e){return e%(d.minorTicks+1)!=0?"":d.angularAxis.rewriteTicks(this.textContent,e)}));var $=n.max(F.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));P.attr({transform:"translate("+[b+$,d.margin.top]+")"});var K=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.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=d.orientation,n.direction=d.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 a(o[r].defaultConfig(),t)}));o[r]().config(n)()}))}var at,it,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(!T){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.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-d.orientation)%360;at=s.invert(n);var a=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(at)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(t,e){ot.select("line").style({opacity:0})}))}var dt=ot.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",(function(t,e){var n=o.util.getMousePos(X).radius;dt.attr({r:n}).style({opacity:.5}),it=r.invert(o.util.getMousePos(X).radius);var a=o.util.convertToCartesian(n,d.radialAxis.orientation);ut.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(t,e){dt.style({opacity:0}),ct.hide(),lt.hide(),ut.hide()})),t.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(e,r){var a=n.select(this),i=this.style.fill,s="black",l=this.style.opacity||1;if(a.attr({"data-opacity":l}),i&&"none"!==i){a.attr({"data-fill":i}),s=n.hsl(i).darker().toString(),a.style({fill:s,opacity:1});var u={t:o.util.round(e[0]),r:o.util.round(e[1])};T&&(u.t=w[e[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),d=t.node().getBoundingClientRect(),h=[f.left+f.width/2-U[0]-d.left,f.top+f.height/2-U[1]-d.top];ct.config({color:s}).text(c),ct.move(h)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),s=n.hsl(i).darker().toString(),a.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),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(u),this},d.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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)})),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},d.getLiveConfig=function(){return c},d.getinputConfig=function(){return u},d.radialScale=function(t){return r},d.angularScale=function(t){return s},d.svg=function(){return t},n.rebind(d,f,"on"),d},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 a=e||6,i=[],o=[];n.range(0,360+a,a).forEach((function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)}));var s={t:i,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],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){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,a,i)},"fill-opacity":0,stroke:function(t,e){return p.stroke(r,a,i)},"stroke-width":function(t,e){return p["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return p["stroke-dasharray"](r,a,i)},opacity:function(t,e){return p.opacity(r,a,i)},display:function(t,e){return p.display(r,a,i)}})}};var f=e.angularScale.range(),d=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,h=n.svg.arc().startAngle((function(t){return-d/2})).endAngle((function(t){return d/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,a){n.select(this).attr({class:"mark arc",d:h,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,a){return r[t[a].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 i.config=function(e){return arguments.length?(e.forEach((function(e,r){t[r]||(t[r]={}),a(t[r],o.PolyChart.defaultConfig()),a(t[r],e)})),this):t},i.getColorScale=function(){},n.rebind(i,e,"on"),i},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,i=t.data.map((function(t,r){return[].concat(t).map((function(t,n){var i=a({},e.elements[r]);return i.name=t,i.color=[].concat(e.elements[r].color)[n],i}))})),o=n.merge(i);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,d=s.classed("legend-group",!0).selectAll("svg").data([0]),h=d.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"});h.append("g").classed("legend-axis",!0),h.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=d.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}}),d.append("rect").classed("legend-mark",!0).attr({height:e.height,width:e.colorBandWidth,fill:"url(#grad1)"})}else{var y=d.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,a,i,o=t.symbol;return i=3*(a=u),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(t,e){return g(e)}}),y.exit().remove()}var b=n.svg.axis().scale(v).orient("right"),x=d.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?(a(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,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,u=function(){var n=(t=i.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:i.padding+l,dy:.3*+i.fontSize}),u};return u.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",c=o>=.5?"black":"white",f=a||"";e.style({fill:c,"font-size":i.fontSize+"px"}).text(f);var d=i.padding,h=e.node().getBBox(),p={fill:i.color,stroke:s,"stroke-width":"2px"},g=h.width+2*d+l,v=h.height+2*d;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[i.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*d]+")"}),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 a(i,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=a({},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 i=o.util.duplicates(r.data.map((function(t,e){return t.geometry})));r.data.forEach((function(t,e){var n=i.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)}))}if(t.layout){var s=a({},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":469,"../../../lib":497,d3:86}],588:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../../lib"),i=t("../../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=a.extendDeepAll,u=e.exports={};u.framework=function(t){var e,r,a,i,c,f=new s;function d(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,a||(a=o.Axis()),i=o.adapter.plotly().convert(e),a.config(i).render(c),t.data=e.data,t.layout=e.layout,u.fillLayout(t),e}return d.isPolar=!0,d.svg=function(){return a.svg()},d.getConfig=function(){return e},d.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},d.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},d.setUndoPoint=function(){var t,n,a=this,i=o.util.cloneJson(e);t=i,n=r,f.add({undo:function(){n&&a(n)},redo:function(){a(t)}}),r=o.util.cloneJson(i)},d.undo=function(){f.undo()},d.redo=function(){f.redo()},d},u.fillLayout=function(t){var e=n.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=l(o,t.layout)}},{"../../../components/color":367,"../../../lib":497,"./micropolar":587,"./undo_manager":589,d3:86}],589:[function(t,e,r){"use strict";e.exports=function(){var t,e=[],r=-1,n=!1;function a(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n||(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?(a(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(a(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0){for(var n=[],a=0;a-1&&(f[h[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(A),A=(A=A.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),a.isIE()&&(A=(A=(A=A.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),A}},{"../components/color":367,"../components/drawing":389,"../constants/xmlns_namespaces":475,"../lib":497,d3:86}],600:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;r2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:n(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),n(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0))}(r,g),"="===v?d=g.showlines=!0:(d=r("contours.showlines"),p=r("fillcolor",o((t.line||{}).color||l,.5))),d)&&(h=r("line.color",p&&s(p)?o(e.fillcolor,1):l),r("line.width",2),r("line.dash"));r("line.smoothing"),a(r,i,h,f)}},{"../../components/color":367,"../../constants/filter_ops":472,"./label_defaults":608,"fast-isnumeric":155}],605:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=n("contours.start"),i=n("contours.end"),o=!1===a||!1===i,s=r("contours.size");!(o?e.autocontour=!0:r("autocontour",!1))&&s||r("ncontours")}},{}],606:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/xyz_defaults"),i=t("../scatter/period_defaults"),o=t("./constraint_defaults"),s=t("./contours_defaults"),l=t("./style_defaults"),u=t("./attributes");e.exports=function(t,e,r,c){function f(r,a){return n.coerce(t,e,u,r,a)}if(a(t,e,f,c)){i(t,e,c,f),f("text"),f("hovertext"),f("hovertemplate"),f("hoverongaps");var d="constraint"===f("contours.type");f("connectgaps",n.isArray1D(e.z)),d?o(t,e,f,c,r):(s(t,e,f,(function(r){return n.coerce2(t,e,u,r)})),l(t,e,f,c))}else e.visible=!1}},{"../../lib":497,"../heatmap/xyz_defaults":622,"../scatter/period_defaults":672,"./attributes":601,"./constraint_defaults":604,"./contours_defaults":605,"./style_defaults":611}],607:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],608:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){if(a||(a={}),t("contours.showlabels")){var i=e.font;n.coerceFont(t,"contours.labelfont",{family:i.family,size:i.size,color:r}),t("contours.labelformat")}!1!==a.hasHover&&t("zhoverformat")}},{"../../lib":497}],609:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/colorscale"),i=t("./end_plus");e.exports=function(t){var e=t.contours,r=e.start,o=i(e),s=e.size||1,l=Math.floor((o-r)/s)+1,u="lines"===e.coloring?0:1,c=a.extractOpts(t);isFinite(s)||(s=1,l=1);var f,d,h=c.reversescale?a.flipScale(c.colorscale):c.colorscale,p=h.length,g=new Array(p),v=new Array(p);if("heatmap"===e.coloring){var m=c.min,y=c.max;for(d=0;dr.end&&(r.start=r.end=(r.start+r.end)/2),t._input.contours||(t._input.contours={}),a.extendFlat(t._input.contours,{start:r.start,end:r.end,size:r.size}),t._input.autocontour=!0}else if("constraint"!==r.type){var u,c=r.start,f=r.end,d=t._input.contours;if(c>f&&(r.start=d.start=f,f=r.end=d.end=c,c=r.start),!(r.size>0))u=c===f?1:i(c,f,t.ncontours).dtick,d.size=r.size=u}}},{"../../lib":497,"../../plots/cartesian/axes":545}],611:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults"),a=t("./label_defaults");e.exports=function(t,e,r,i,o){var s,l=r("contours.coloring"),u="";"fill"===l&&(s=r("contours.showlines")),!1!==s&&("lines"!==l&&(u=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==l&&(!0!==t.showlegend&&(e.showlegend=!1),e._dfltShowLegend=!1,n(t,e,i,r,{prefix:"",cLetter:"z"})),r("line.smoothing"),a(r,i,u,o)}},{"../../components/colorscale/defaults":377,"./label_defaults":608}],612:[function(t,e,r){"use strict";var n=t("gl-contour2d"),a=t("gl-heatmap2d"),i=t("../../plots/cartesian/axes"),o=t("../contour/make_color_map"),s=t("../../lib/str2rgbarray");function l(t,e){this.scene=t,this.uid=e,this.type="contourgl",this.name="",this.hoverinfo="all",this.xData=[],this.yData=[],this.zData=[],this.textLabels=[],this.idToIndex=[],this.bounds=[0,0,0,0],this.contourOptions={z:new Float32Array(0),x:[],y:[],shape:[0,0],levels:[0],levelColors:[0,0,0,1],lineWidth:1},this.contour=n(t.glplot,this.contourOptions),this.contour._trace=this,this.heatmapOptions={z:new Float32Array(0),x:[],y:[],shape:[0,0],colorLevels:[0],colorValues:[0,0,0,0]},this.heatmap=a(t.glplot,this.heatmapOptions),this.heatmap._trace=this}var u=l.prototype;function c(t,e){for(var r=t.contours,n=r.start,a=r.end,i=r.size||1,l=e.fill,u=o(t),c=Math.floor((a-n)/i)+(l?2:1),f=new Array(c),d=new Array(4*c),h=0;hP){R("x scale is not linear");break}}if(b.length&&"fast"===O){var F=(b[b.length-1]-b[0])/(b.length-1),z=Math.abs(F/100);for(T=0;Tz){R("y scale is not linear");break}}}var N=a.maxRowLength(A),B="scaled"===e.xtype?"":r,j=h(e,B,v,m,N,M),U="scaled"===e.ytype?"":b,V=h(e,U,x,_,A.length,E);L||(e._extremes[M._id]=i.findExtremes(M,j),e._extremes[E._id]=i.findExtremes(E,V));var H={x:j,y:V,z:A,text:e._text||e.text,hovertext:e._hovertext||e.hovertext};if(e.xperiodalignment&&y&&(H.orig_x=y),e.yperiodalignment&&w&&(H.orig_y=w),B&&B.length===j.length-1&&(H.xCenter=B),U&&U.length===V.length-1&&(H.yCenter=U),C&&(H.xRanges=k.xRanges,H.yRanges=k.yRanges,H.pts=k.pts),S||l(t,e,{vals:A,cLetter:"z"}),S&&e.contours&&"heatmap"===e.contours.coloring){var G={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};H.xfill=h(G,B,v,m,N,M),H.yfill=h(G,U,x,_,A.length,E)}return[H]}},{"../../components/colorscale/calc":375,"../../constants/numerical":474,"../../lib":497,"../../plots/cartesian/align_period":542,"../../plots/cartesian/axes":545,"../../registry":591,"../histogram2d/calc":632,"./clean_2d_array":616,"./convert_column_xyz":618,"./find_empties":619,"./interp2d":620,"./make_bound_array":621}],616:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r,o){var s,l,u,c,f,d;function h(t){if(n(t))return+t}if(e&&e.transpose){for(s=0,f=0;f=0;o--)(s=((f[[(r=(i=d[o])[0])-1,a=i[1]]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(l[i]=[r,a,s],d.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(i in l)f[i]=l[i],c.push(l[i])}return c.sort((function(t,e){return e[2]-t[2]}))}},{"../../lib":497}],620:[function(t,e,r){"use strict";var n=t("../../lib"),a=[[-1,0],[1,0],[0,-1],[0,1]];function i(t){return.5-.25*Math.min(1,.5*t)}function o(t,e,r){var n,i,o,s,l,u,c,f,d,h,p,g,v,m=0;for(s=0;sg&&(m=Math.max(m,Math.abs(t[i][o]-p)/(v-g))))}return m}e.exports=function(t,e){var r,a=1;for(o(t,e),r=0;r.01;r++)a=o(t,e,i(a));return a>.01&&n.log("interp2d didn't converge quickly",a),t}},{"../../lib":497}],621:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib").isArrayOrTypedArray;e.exports=function(t,e,r,i,o,s){var l,u,c,f=[],d=n.traceIs(t,"contour"),h=n.traceIs(t,"histogram"),p=n.traceIs(t,"gl2d");if(a(e)&&e.length>1&&!h&&"category"!==s.type){var g=e.length;if(!(g<=o))return d?e.slice(0,o):e.slice(0,o+1);if(d||p)f=e.slice(0,o);else if(1===o)f=[e[0]-.5,e[0]+.5];else{for(f=[1.5*e[0]-.5*e[1]],c=1;c0&&(i=!0);for(var l=0;li){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]u?t>o?t>1.1*a?a:t>1.1*i?i:o:t>s?s:t>l?l:u:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function h(t,e,r,n,i,s){if(n&&t>o){var l=p(e,i,s),u=p(r,i,s),c=t===a?0:1;return l[c]!==u[c]}return Math.floor(r/t)-Math.floor(e/t)>.1}function p(t,e,r){var n=e.c2d(t,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}e.exports=function(t,e,r,n,i){var s,l,u=-1.1*e,d=-.1*e,h=t-d,p=r[0],g=r[1],v=Math.min(f(p+d,p+h,n,i),f(g+d,g+h,n,i)),m=Math.min(f(p+u,p+d,n,i),f(g+u,g+d,n,i));if(v>m&&mo){var y=s===a?1:6,b=s===a?"M12":"M1";return function(e,r){var o=n.c2d(e,a,i),s=o.indexOf("-",y);s>0&&(o=o.substr(0,s));var u=n.d2c(o,0,i);if(ur.r2l(N)&&(j=o.tickIncrement(j,x.size,!0,h)),I.start=r.l2r(j),z||a.nestedProperty(e,m+".start").set(I.start)}var U=x.end,V=r.r2l(R.end),H=void 0!==V;if((x.endFound||H)&&V!==r.r2l(U)){var G=H?V:a.aggNums(Math.max,null,p);I.end=r.l2r(G),H||a.nestedProperty(e,m+".start").set(I.end)}var q="autobin"+s;return!1===e._input[q]&&(e._input[m]=a.extendFlat({},e[m]||{}),delete e._input[q],delete e[q]),[I,p]}e.exports={calc:function(t,e){var r,i,h,p,g=[],v=[],m=o.getFromId(t,"h"===e.orientation?e.yaxis:e.xaxis),y="h"===e.orientation?"y":"x",b={x:"y",y:"x"}[y],x=e[y+"calendar"],_=e.cumulative,w=d(t,e,m,y),A=w[0],T=w[1],k="string"==typeof A.size,M=[],E=k?M:A,S=[],C=[],L=[],O=0,D=e.histnorm,R=e.histfunc,I=-1!==D.indexOf("density");_.enabled&&I&&(D=D.replace(/ ?density$/,""),I=!1);var P,F="max"===R||"min"===R?null:0,z=l.count,N=u[D],B=!1,j=function(t){return m.r2c(t,0,x)};for(a.isArrayOrTypedArray(e[b])&&"count"!==R&&(P=e[b],B="avg"===R,z=l[R]),r=j(A.start),h=j(A.end)+(r-o.tickIncrement(r,A.size,!1,x))/1e6;r=0&&p=0;n--)s(n);else if("increasing"===e){for(n=1;n=0;n--)t[n]+=t[n+1];"exclude"===r&&(t.push(0),t.shift())}}(v,_.direction,_.currentbin);var J=Math.min(g.length,v.length),Q=[],$=0,K=J-1;for(r=0;r=$;r--)if(v[r]){K=r;break}for(r=$;r<=K;r++)if(n(g[r])&&n(v[r])){var tt={p:g[r],s:v[r],b:0};_.enabled||(tt.pts=L[r],q?tt.ph0=tt.ph1=L[r].length?T[L[r][0]]:g[r]:(e._computePh=!0,tt.ph0=H(M[r]),tt.ph1=H(M[r+1],!0))),Q.push(tt)}return 1===Q.length&&(Q[0].width1=o.tickIncrement(Q[0].p,A.size,!1,x)-Q[0].p),s(Q,e),a.isArrayOrTypedArray(e.selectedpoints)&&a.tagSelected(Q,e,Y),Q},calcAllAutoBins:d}},{"../../lib":497,"../../plots/cartesian/axes":545,"../../registry":591,"../bar/arrays_to_calcdata":600,"./average":627,"./bin_functions":628,"./bin_label_vals":629,"./norm_functions":631,"fast-isnumeric":155}],631:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;aE&&A.splice(E,A.length-E),M.length>E&&M.splice(E,M.length-E);var S=[],C=[],L=[],O="string"==typeof w.size,D="string"==typeof k.size,R=[],I=[],P=O?R:w,F=D?I:k,z=0,N=[],B=[],j=e.histnorm,U=e.histfunc,V=-1!==j.indexOf("density"),H="max"===U||"min"===U?null:0,G=i.count,q=o[j],X=!1,W=[],Y=[],Z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";Z&&"count"!==U&&(X="avg"===U,G=i[U]);var J=w.size,Q=b(w.start),$=b(w.end)+(Q-a.tickIncrement(Q,J,!1,m))/1e6;for(r=Q;r<$;r=a.tickIncrement(r,J,!1,m))C.push(H),R.push(r),X&&L.push(0);R.push(r);var K,tt=C.length,et=(r-Q)/tt,rt=(K=Q+et/2,g.c2r(K,0,m)),nt=k.size,at=x(k.start),it=x(k.end)+(at-a.tickIncrement(at,nt,!1,y))/1e6;for(r=at;r=0&&h=0&&p=e[r][0]&&t<=e[r][1])return!0;return!1}(r,n))return r;var a=t?-1:1,i=0,o=e.length-1;if(a<0){var s=i;i=o,o=s}for(var l=e[i],u=l,f=i;a*fe){d=r;break}}if(i=c,isNaN(i)&&(i=isNaN(f)||isNaN(d)?isNaN(f)?d:f:e-u[f][1]t[1]+r||e=.9*t[1]+.1*t[0]?"n":e<=.9*t[0]+.1*t[1]?"s":"ns"}(p,e);g&&(o.interval=l[i],o.intervalPix=p,o.region=g)}}if(t.ordinal&&!o.region){var v=t.unitTickvals,y=t.unitToPaddedPx.invert(e);for(r=0;r=b[0]&&y<=b[1]){o.clickableOrdinalRange=b;break}}}return o}function w(t,e){a.event.sourceEvent.stopPropagation();var r=e.height-a.mouse(t)[1]-2*n.verticalPadding,i=e.brush.svgBrush;i.wasDragged=!0,i._dragging=!0,i.grabbingBar?i.newExtent=[r-i.grabPoint,r+i.barLength-i.grabPoint].map(e.unitToPaddedPx.invert):i.newExtent=[i.startExtent,e.unitToPaddedPx.invert(r)].sort(s),e.brush.filterSpecified=!0,i.extent=i.stayingIntervals.concat([i.newExtent]),i.brushCallback(e),x(t.parentNode)}function A(t,e){var r=_(e,e.height-a.mouse(t)[1]-2*n.verticalPadding),i="crosshair";r.clickableOrdinalRange?i="pointer":r.region&&(i=r.region+"-resize"),a.select(document.body).style("cursor",i)}function T(t){t.on("mousemove",(function(t){a.event.preventDefault(),t.parent.inBrushDrag||A(this,t)})).on("mouseleave",(function(t){t.parent.inBrushDrag||y()})).call(a.behavior.drag().on("dragstart",(function(t){!function(t,e){a.event.sourceEvent.stopPropagation();var r=e.height-a.mouse(t)[1]-2*n.verticalPadding,i=e.unitToPaddedPx.invert(r),o=e.brush,s=_(e,r),l=s.interval,u=o.svgBrush;if(u.wasDragged=!1,u.grabbingBar="ns"===s.region,u.grabbingBar){var c=l.map(e.unitToPaddedPx);u.grabPoint=r-c[0]-n.verticalPadding,u.barLength=c[1]-c[0]}u.clickableOrdinalRange=s.clickableOrdinalRange,u.stayingIntervals=e.multiselect&&o.filterSpecified?o.filter.getConsolidated():[],l&&(u.stayingIntervals=u.stayingIntervals.filter((function(t){return t[0]!==l[0]&&t[1]!==l[1]}))),u.startExtent=s.region?l["s"===s.region?1:0]:i,e.parent.inBrushDrag=!0,u.brushStartCallback()}(this,t)})).on("drag",(function(t){w(this,t)})).on("dragend",(function(t){!function(t,e){var r=e.brush,n=r.filter,i=r.svgBrush;i._dragging||(A(t,e),w(t,e),e.brush.svgBrush.wasDragged=!1),i._dragging=!1,a.event.sourceEvent.stopPropagation();var o=i.grabbingBar;if(i.grabbingBar=!1,i.grabLocation=void 0,e.parent.inBrushDrag=!1,y(),!i.wasDragged)return i.wasDragged=void 0,i.clickableOrdinalRange?r.filterSpecified&&e.multiselect?i.extent.push(i.clickableOrdinalRange):(i.extent=[i.clickableOrdinalRange],r.filterSpecified=!0):o?(i.extent=i.stayingIntervals,0===i.extent.length&&M(r)):M(r),i.brushCallback(e),x(t.parentNode),void i.brushEndCallback(r.filterSpecified?n.getConsolidated():[]);var s=function(){n.set(n.getConsolidated())};if(e.ordinal){var l=e.unitTickvals;l[l.length-1]i.newExtent[0];i.extent=i.stayingIntervals.concat(u?[i.newExtent]:[]),i.extent.length||M(r),i.brushCallback(e),u?x(t.parentNode,s):(s(),x(t.parentNode))}else s();i.brushEndCallback(r.filterSpecified?n.getConsolidated():[])}(this,t)})))}function k(t,e){return t[0]-e[0]}function M(t){t.filterSpecified=!1,t.svgBrush.extent=[[-1/0,1/0]]}function E(t){for(var e,r=t.slice(),n=[],a=r.shift();a;){for(e=a.slice();(a=r.shift())&&a[0]<=e[1];)e[1]=Math.max(e[1],a[1]);n.push(e)}return 1===n.length&&n[0][0]>n[0][1]&&(n=[]),n}e.exports={makeBrush:function(t,e,r,n,a,i){var o,l=function(){var t,e,r=[];return{set:function(n){1===(r=n.map((function(t){return t.slice().sort(s)})).sort(k)).length&&r[0][0]===-1/0&&r[0][1]===1/0&&(r=[[0,-1]]),t=E(r),e=r.reduce((function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}),[1/0,-1/0])},get:function(){return r.slice()},getConsolidated:function(){return t},getBounds:function(){return e}}}();return l.set(r),{filter:l,filterSpecified:e,svgBrush:{extent:[],brushStartCallback:n,brushCallback:(o=a,function(t){var e=t.brush,r=function(t){return t.svgBrush.extent.map((function(t){return t.slice()}))}(e).slice();e.filter.set(r),o()}),brushEndCallback:i}}},ensureAxisBrush:function(t){var e=t.selectAll("."+n.cn.axisBrush).data(o,i);e.enter().append("g").classed(n.cn.axisBrush,!0),function(t){var e=t.selectAll(".background").data(o);e.enter().append("rect").classed("background",!0).call(p).call(g).style("pointer-events","auto").attr("transform",l(0,n.verticalPadding)),e.call(T).attr("height",(function(t){return t.height-n.verticalPadding}));var r=t.selectAll(".highlight-shadow").data(o);r.enter().append("line").classed("highlight-shadow",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width+n.bar.strokeWidth).attr("stroke",n.bar.strokeColor).attr("opacity",n.bar.strokeOpacity).attr("stroke-linecap","butt"),r.attr("y1",(function(t){return t.height})).call(b);var a=t.selectAll(".highlight").data(o);a.enter().append("line").classed("highlight",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width-n.bar.strokeWidth).attr("stroke",n.bar.fillColor).attr("opacity",n.bar.fillOpacity).attr("stroke-linecap","butt"),a.attr("y1",(function(t){return t.height})).call(b)}(e)},cleanRanges:function(t,e){if(Array.isArray(t[0])?(t=t.map((function(t){return t.sort(s)})),t=e.multiselect?E(t.sort(k)):[t[0]]):t=[t.sort(s)],e.tickvals){var r=e.tickvals.slice().sort(s);if(!(t=t.map((function(t){var e=[h(0,r,t[0],[]),h(1,r,t[1],[])];if(e[1]>e[0])return e})).filter((function(t){return t}))).length)return}return t.length>1?t:t[0]}}},{"../../lib":497,"../../lib/gup":494,"./constants":637,d3:86}],635:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/get_data").getModuleCalcData,i=t("./plot"),o=t("../../constants/xmlns_namespaces");r.name="parcoords",r.plot=function(t){var e=a(t.calcdata,"parcoords")[0];e.length&&i(t,e)},r.clean=function(t,e,r,n){var a=n._has&&n._has("parcoords"),i=e._has&&e._has("parcoords");a&&!i&&(n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){var e=t._fullLayout._glimages,r=n.select(t).selectAll(".svg-container");r.filter((function(t,e){return e===r.size()-1})).selectAll(".gl-canvas-context, .gl-canvas-focus").each((function(){var t=this.toDataURL("image/png");e.append("svg:image").attr({xmlns:o.svg,"xlink:href":t,preserveAspectRatio:"none",x:0,y:0,width:this.width,height:this.height})})),window.setTimeout((function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")}),60)}},{"../../constants/xmlns_namespaces":475,"../../plots/get_data":575,"./plot":644,d3:86}],636:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale"),i=t("../../lib/gup").wrap;e.exports=function(t,e){var r,o;return a.hasColorscale(e,"line")&&n(e.line.color)?(r=e.line.color,o=a.extractOpts(e.line).colorscale,a.calc(t,e,{vals:r,containerStr:"line",cLetter:"c"})):(r=function(t){for(var e=new Array(t),r=0;rf&&(n.log("parcoords traces support up to "+f+" dimensions at the moment"),p.splice(f));var g=s(t,e,{name:"dimensions",layout:l,handleItemDefaults:h}),v=function(t,e,r,o,s){var l=s("line.color",r);if(a(t,"line")&&n.isArrayOrTypedArray(l)){if(l.length)return s("line.colorscale"),i(t,e,o,s,{prefix:"line.",cLetter:"c"}),l.length;e.line.color=r}return 1/0}(t,e,r,l,c);o(e,l,c),Array.isArray(g)&&g.length||(e.visible=!1),d(e,g,"values",v);var m={family:l.font.family,size:Math.round(l.font.size/1.2),color:l.font.color};n.coerceFont(c,"labelfont",m),n.coerceFont(c,"tickfont",m),n.coerceFont(c,"rangefont",m),c("labelangle"),c("labelside")}},{"../../components/colorscale/defaults":377,"../../components/colorscale/helpers":378,"../../lib":497,"../../plots/array_container_defaults":540,"../../plots/cartesian/axes":545,"../../plots/domain":572,"./attributes":633,"./axisbrush":634,"./constants":637,"./merge_length":642}],639:[function(t,e,r){"use strict";var n=t("../../lib").isTypedArray;r.convertTypedArray=function(t){return n(t)?Array.prototype.slice.call(t):t},r.isOrdinal=function(t){return!!t.tickvals},r.isVisible=function(t){return t.visible||!("visible"in t)}},{"../../lib":497}],640:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcoords",basePlotModule:t("./base_plot"),categories:["gl","regl","noOpacity","noHover"],meta:{}}},{"./attributes":633,"./base_plot":635,"./calc":636,"./defaults":638,"./plot":644}],641:[function(t,e,r){"use strict";var n=t("glslify"),a=n(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nattribute vec4 p01_04, p05_08, p09_12, p13_16,\n p17_20, p21_24, p25_28, p29_32,\n p33_36, p37_40, p41_44, p45_48,\n p49_52, p53_56, p57_60, colors;\n\nuniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution, viewBoxPos, viewBoxSize;\nuniform sampler2D mask, palette;\nuniform float maskHeight;\nuniform float drwLayer; // 0: context, 1: focus, 2: pick\nuniform vec4 contextColor;\n\nbool isPick = (drwLayer > 1.5);\nbool isContext = (drwLayer < 0.5);\n\nconst vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0);\nconst vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * UNITS, UNITS);\n}\n\nfloat axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) {\n float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D);\n float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D);\n return y1 * (1.0 - ratio) + y2 * ratio;\n}\n\nint iMod(int a, int b) {\n return a - b * (a / b);\n}\n\nbool fOutside(float p, float lo, float hi) {\n return (lo < hi) && (lo > p || p > hi);\n}\n\nbool vOutside(vec4 p, vec4 lo, vec4 hi) {\n return (\n fOutside(p[0], lo[0], hi[0]) ||\n fOutside(p[1], lo[1], hi[1]) ||\n fOutside(p[2], lo[2], hi[2]) ||\n fOutside(p[3], lo[3], hi[3])\n );\n}\n\nbool mOutside(mat4 p, mat4 lo, mat4 hi) {\n return (\n vOutside(p[0], lo[0], hi[0]) ||\n vOutside(p[1], lo[1], hi[1]) ||\n vOutside(p[2], lo[2], hi[2]) ||\n vOutside(p[3], lo[3], hi[3])\n );\n}\n\nbool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) {\n return mOutside(A, loA, hiA) ||\n mOutside(B, loB, hiB) ||\n mOutside(C, loC, hiC) ||\n mOutside(D, loD, hiD);\n}\n\nbool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) {\n mat4 pnts[4];\n pnts[0] = A;\n pnts[1] = B;\n pnts[2] = C;\n pnts[3] = D;\n\n for(int i = 0; i < 4; ++i) {\n for(int j = 0; j < 4; ++j) {\n for(int k = 0; k < 4; ++k) {\n if(0 == iMod(\n int(255.0 * texture2D(mask,\n vec2(\n (float(i * 2 + j / 2) + 0.5) / 8.0,\n (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight\n ))[3]\n ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))),\n 2\n )) return true;\n }\n }\n }\n return false;\n}\n\nvec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) {\n float x = 0.5 * sign(v) + 0.5;\n float y = axisY(x, A, B, C, D);\n float z = 1.0 - abs(v);\n\n z += isContext ? 0.0 : 2.0 * float(\n outsideBoundingBox(A, B, C, D) ||\n outsideRasterMask(A, B, C, D)\n );\n\n return vec4(\n 2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0,\n z,\n 1.0\n );\n}\n\nvoid main() {\n mat4 A = mat4(p01_04, p05_08, p09_12, p13_16);\n mat4 B = mat4(p17_20, p21_24, p25_28, p29_32);\n mat4 C = mat4(p33_36, p37_40, p41_44, p45_48);\n mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS);\n\n float v = colors[3];\n\n gl_Position = position(isContext, v, A, B, C, D);\n\n fragColor =\n isContext ? vec4(contextColor) :\n isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5));\n}\n"]),i=n(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}\n"]),o=t("./constants").maxDimensionCount,s=t("../../lib"),l=new Uint8Array(4),u=new Uint8Array(4),c={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function f(t,e,r,n,a){var i=t._gl;i.enable(i.SCISSOR_TEST),i.scissor(e,r,n,a),t.clear({color:[0,0,0,0],depth:1})}function d(t,e,r,n,a,i){var o=i.key;r.drawCompleted||(!function(t){t.read({x:0,y:0,width:1,height:1,data:l})}(t),r.drawCompleted=!0),function s(l){var u=Math.min(n,a-l*n);0===l&&(window.cancelAnimationFrame(r.currentRafs[o]),delete r.currentRafs[o],f(t,i.scissorX,i.scissorY,i.scissorWidth,i.viewBoxSize[1])),r.clearOnly||(i.count=2*u,i.offset=2*l*n,e(i),l*n+u>>8*e)%256/255}function g(t,e,r){for(var n=new Array(8*e),a=0,i=0;ic&&(c=t[a].dim1.canvasX,o=a);0===s&&f(A,0,0,r.canvasWidth,r.canvasHeight);var h=function(t){var e,r,n,a=[[],[]];for(n=0;n<64;n++){var i=!t&&na._length&&(M=M.slice(0,a._length));var S,C=a.tickvals;function L(t,e){return{val:t,text:S[e]}}function O(t,e){return t.val-e.val}if(Array.isArray(C)&&C.length){S=a.ticktext,Array.isArray(S)&&S.length?S.length>C.length?S=S.slice(0,C.length):C.length>S.length&&(C=C.slice(0,S.length)):S=C.map(n.format(a.tickformat));for(var D=1;D=r||l>=i)return;var u=t.lineLayer.readPixel(s,i-1-l),c=0!==u[3],f=c?u[2]+256*(u[1]+256*u[0]):null,d={x:s,y:l,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:f};f!==F&&(c?a.hover(d):a.unhover&&a.unhover(d),F=f)}})),P.style("opacity",(function(t){return t.pick?0:1})),d.style("background","rgba(255, 255, 255, 0)");var z=d.selectAll("."+m.cn.parcoords).data(M,h);z.exit().remove(),z.enter().append("g").classed(m.cn.parcoords,!0).style("shape-rendering","crispEdges").style("pointer-events","none"),z.attr("transform",(function(t){return l(t.model.translateX,t.model.translateY)}));var N=z.selectAll("."+m.cn.parcoordsControlView).data(p,h);N.enter().append("g").classed(m.cn.parcoordsControlView,!0),N.attr("transform",(function(t){return l(t.model.pad.l,t.model.pad.t)}));var B=N.selectAll("."+m.cn.yAxis).data((function(t){return t.dimensions}),h);B.enter().append("g").classed(m.cn.yAxis,!0),N.each((function(t){D(B,t)})),P.each((function(t){if(t.viewModel){!t.lineLayer||a?t.lineLayer=b(this,t):t.lineLayer.update(t),(t.key||0===t.key)&&(t.viewModel[t.key]=t.lineLayer);var e=!t.context||a;t.lineLayer.render(t.viewModel.panels,e)}})),B.attr("transform",(function(t){return l(t.xScale(t.xIndex),0)})),B.call(n.behavior.drag().origin((function(t){return t})).on("drag",(function(t){var e=t.parent;k.linePickActive(!1),t.x=Math.max(-m.overdrag,Math.min(t.model.width+m.overdrag,n.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,B.sort((function(t,e){return t.x-e.x})).each((function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio})),D(B,e),B.filter((function(e){return 0!==Math.abs(t.xIndex-e.xIndex)})).attr("transform",(function(t){return l(t.xScale(t.xIndex),0)})),n.select(this).attr("transform",l(t.x,0)),B.each((function(r,n,a){a===t.parent.key&&(e.dimensions[n]=r)})),e.contextLayer&&e.contextLayer.render(e.panels,!1,!E(e)),e.focusLayer.render&&e.focusLayer.render(e.panels)})).on("dragend",(function(t){var e=t.parent;t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,D(B,e),n.select(this).attr("transform",(function(t){return l(t.x,0)})),e.contextLayer&&e.contextLayer.render(e.panels,!1,!E(e)),e.focusLayer&&e.focusLayer.render(e.panels),e.pickLayer&&e.pickLayer.render(e.panels,!0),k.linePickActive(!0),a&&a.axesMoved&&a.axesMoved(e.key,e.dimensions.map((function(t){return t.crossfilterDimensionIndex})))}))),B.exit().remove();var j=B.selectAll("."+m.cn.axisOverlays).data(p,h);j.enter().append("g").classed(m.cn.axisOverlays,!0),j.selectAll("."+m.cn.axis).remove();var U=j.selectAll("."+m.cn.axis).data(p,h);U.enter().append("g").classed(m.cn.axis,!0),U.each((function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,a=r.domain();n.select(this).call(n.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?a:null).tickFormat((function(e){return v.isOrdinal(t)?e:R(t.model.dimensions[t.visibleIndex],e)})).scale(r)),c.font(U.selectAll("text"),t.model.tickFont)})),U.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),U.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default");var V=j.selectAll("."+m.cn.axisHeading).data(p,h);V.enter().append("g").classed(m.cn.axisHeading,!0);var H=V.selectAll("."+m.cn.axisTitle).data(p,h);H.enter().append("text").classed(m.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("pointer-events","auto"),H.text((function(t){return t.label})).each((function(e){var r=n.select(this);c.font(r,e.model.labelFont),u.convertToTspans(r,t)})).attr("transform",(function(t){var e=O(t.model.labelAngle,t.model.labelSide),r=m.axisTitleOffset;return(e.dir>0?"":l(0,2*r+t.model.height))+s(e.degrees)+l(-r*e.dx,-r*e.dy)})).attr("text-anchor",(function(t){var e=O(t.model.labelAngle,t.model.labelSide);return 2*Math.abs(e.dx)>Math.abs(e.dy)?e.dir*e.dx<0?"start":"end":"middle"}));var G=j.selectAll("."+m.cn.axisExtent).data(p,h);G.enter().append("g").classed(m.cn.axisExtent,!0);var q=G.selectAll("."+m.cn.axisExtentTop).data(p,h);q.enter().append("g").classed(m.cn.axisExtentTop,!0),q.attr("transform",l(0,-m.axisExtentOffset));var X=q.selectAll("."+m.cn.axisExtentTopText).data(p,h);X.enter().append("text").classed(m.cn.axisExtentTopText,!0).call(L),X.text((function(t){return I(t,!0)})).each((function(t){c.font(n.select(this),t.model.rangeFont)}));var W=G.selectAll("."+m.cn.axisExtentBottom).data(p,h);W.enter().append("g").classed(m.cn.axisExtentBottom,!0),W.attr("transform",(function(t){return l(0,t.model.height+m.axisExtentOffset)}));var Y=W.selectAll("."+m.cn.axisExtentBottomText).data(p,h);Y.enter().append("text").classed(m.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(L),Y.text((function(t){return I(t,!1)})).each((function(t){c.font(n.select(this),t.model.rangeFont)})),y.ensureAxisBrush(j)}},{"../../components/colorscale":379,"../../components/drawing":389,"../../lib":497,"../../lib/gup":494,"../../lib/svg_text_utils":521,"../../plots/cartesian/axes":545,"./axisbrush":634,"./constants":637,"./helpers":639,"./lines":641,"color-rgba":65,d3:86}],644:[function(t,e,r){"use strict";var n=t("./parcoords"),a=t("../../lib/prepare_regl"),i=t("./helpers").isVisible;function o(t,e,r){var n=e.indexOf(r),a=t.indexOf(n);return-1===a&&(a+=e.length),a}e.exports=function(t,e){var r=t._fullLayout;if(a(t)){var s={},l={},u={},c={},f=r._size;e.forEach((function(e,r){var n=e[0].trace;u[r]=n.index;var a=c[r]=n._fullInput.index;s[r]=t.data[a].dimensions,l[r]=t.data[a].dimensions.slice()}));n(t,e,{width:f.w,height:f.h,margin:{t:f.t,r:f.r,b:f.b,l:f.l}},{filterChanged:function(e,n,a){var i=l[e][n],o=a.map((function(t){return t.slice()})),s="dimensions["+n+"].constraintrange",f=r._tracePreGUI[t._fullData[u[e]]._fullInput.uid];if(void 0===f[s]){var d=i.constraintrange;f[s]=d||null}var h=t._fullData[u[e]].dimensions[n];o.length?(1===o.length&&(o=o[0]),i.constraintrange=o,h.constraintrange=o.slice(),o=[o]):(delete i.constraintrange,delete h.constraintrange,o=null);var p={};p[s]=o,t.emit("plotly_restyle",[p,[c[e]]])},hover:function(e){t.emit("plotly_hover",e)},unhover:function(e){t.emit("plotly_unhover",e)},axesMoved:function(e,r){var n=function(t,e){return function(r,n){return o(t,e,r)-o(t,e,n)}}(r,l[e].filter(i));s[e].sort(n),l[e].filter((function(t){return!i(t)})).sort((function(t){return l[e].indexOf(t)})).forEach((function(t){s[e].splice(s[e].indexOf(t),1),s[e].splice(l[e].indexOf(t),0,t)})),t.emit("plotly_restyle",[{dimensions:[s[e]]},[c[e]]])}})}}},{"../../lib/prepare_regl":510,"./helpers":639,"./parcoords":643}],645:[function(t,e,r){"use strict";var n=t("../../lib");function a(t){return-1!==t.indexOf("e")?t.replace(/[.]?0+e/,"e"):-1!==t.indexOf(".")?t.replace(/[.]?0+$/,""):t}r.formatPiePercent=function(t,e){var r=a((100*t).toPrecision(3));return n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=a(t.toPrecision(10));return n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;r>>1,d)p[0]=t.xbounds[0],p[2]=t.xbounds[1],p[1]=t.ybounds[0],p[3]=t.ybounds[1];else for(l=0;lp[2]&&(p[2]=o),sp[3]&&(p[3]=s);if(h)r=h;else for(r=new Int32Array(e),l=0;lp[2]&&(p[2]=o),sp[3]&&(p[3]=s);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var g=a(t.marker.color),v=a(t.marker.border.color),m=t.opacity*t.marker.opacity;g[3]*=m,this.pointcloudOptions.color=g;var y=t.marker.blend;if(null===y){y=u.length<100||c.length<100}this.pointcloudOptions.blend=y,v[3]*=m,this.pointcloudOptions.borderColor=v;var b=t.marker.sizemin,x=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=b,this.pointcloudOptions.sizeMax=x,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions);var _=this.scene.xaxis,w=this.scene.yaxis,A=x/2||.5;t._extremes[_._id]=i(_,[p[0],p[2]],{ppad:A}),t._extremes[w._id]=i(w,[p[1],p[3]],{ppad:A})},l.dispose=function(){this.pointcloud.dispose()},e.exports=function(t,e){var r=new s(t,e.uid);return r.update(e),r}},{"../../lib/str2rgbarray":520,"../../plots/cartesian/autorange":544,"../scatter/get_trace_color":662,"gl-pointcloud2d":212}],649:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}i("x"),i("y"),i("xbounds"),i("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),i("text"),i("marker.color",r),i("marker.opacity"),i("marker.blend"),i("marker.sizemin"),i("marker.sizemax"),i("marker.border.color",r),i("marker.border.arearatio"),e._length=null}},{"../../lib":497,"./attributes":647}],650:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("../scatter3d/calc"),plot:t("./convert"),moduleType:"trace",name:"pointcloud",basePlotModule:t("../../plots/gl2d"),categories:["gl","gl2d","showLegend"],meta:{}}},{"../../plots/gl2d":578,"../scatter3d/calc":680,"./attributes":647,"./convert":648,"./defaults":649}],651:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rl&&S[m].gap;)m--;for(b=S[m].s,g=S.length-1;g>m;g--)S[g].s=b;for(;lM[c]&&c=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],659:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("./attributes"),o=t("./constants"),s=t("./subtypes"),l=t("./xy_defaults"),u=t("./period_defaults"),c=t("./stack_defaults"),f=t("./marker_defaults"),d=t("./line_defaults"),h=t("./line_shape_defaults"),p=t("./text_defaults"),g=t("./fillcolor_defaults");e.exports=function(t,e,r,v){function m(r,a){return n.coerce(t,e,i,r,a)}var y=l(t,e,v,m);if(y||(e.visible=!1),e.visible){u(t,e,v,m);var b=c(t,e,v,m),x=!b&&yq!=(z=D[L][1])>=q&&(I=D[L-1][0],P=D[L][0],z-F&&(R=I+(P-I)*(q-F)/(z-F),U=Math.min(U,R),V=Math.max(V,R)));U=Math.max(U,0),V=Math.min(V,d._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:q,y1:q,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":367,"../../components/fx":407,"../../lib":497,"../../registry":591,"./get_trace_color":662}],664:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":558,"./arrays_to_calcdata":651,"./attributes":652,"./calc":653,"./cross_trace_calc":657,"./cross_trace_defaults":658,"./defaults":659,"./format_labels":661,"./hover":663,"./marker_colorbar":670,"./plot":673,"./select":674,"./style":676,"./subtypes":677}],665:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s,l){var u=(t.marker||{}).color;(s("line.color",r),a(t,"line"))?i(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":377,"../../components/colorscale/helpers":378,"../../lib":497}],666:[function(t,e,r){"use strict";var n=t("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,s=i-.5,l=t("../../lib"),u=l.segmentsIntersect,c=l.constrain,f=t("./constants");e.exports=function(t,e){var r,n,i,d,h,p,g,v,m,y,b,x,_,w,A,T,k,M,E=e.xaxis,S=e.yaxis,C="log"===E.type,L="log"===S.type,O=E._length,D=S._length,R=e.connectGaps,I=e.baseTolerance,P=e.shape,F="linear"===P,z=e.fill&&"none"!==e.fill,N=[],B=f.minTolerance,j=t.length,U=new Array(j),V=0;function H(r){var n=t[r];if(!n)return!1;var i=e.linearized?E.l2p(n.x):E.c2p(n.x),l=e.linearized?S.l2p(n.y):S.c2p(n.y);if(i===a){if(C&&(i=E.c2p(n.x,!0)),i===a)return!1;L&&l===a&&(i*=Math.abs(E._m*D*(E._m>0?o:s)/(S._m*O*(S._m>0?o:s)))),i*=1e3}if(l===a){if(L&&(l=S.c2p(n.y,!0)),l===a)return!1;l*=1e3}return[i,l]}function G(t,e,r,n){var a=r-t,i=n-e,o=.5-t,s=.5-e,l=a*a+i*i,u=a*o+i*s;if(u>0&&urt||t[1]at)return[c(t[0],et,rt),c(t[1],nt,at)]}function st(t,e){return t[0]===e[0]&&(t[0]===et||t[0]===rt)||(t[1]===e[1]&&(t[1]===nt||t[1]===at)||void 0)}function lt(t,e,r){return function(n,a){var i=ot(n),o=ot(a),s=[];if(i&&o&&st(i,o))return s;i&&s.push(i),o&&s.push(o);var u=2*l.constrain((n[t]+a[t])/2,e,r)-((i||n)[t]+(o||a)[t]);u&&((i&&o?u>0==i[t]>o[t]?i:o:i||o)[t]+=u);return s}}function ut(t){var e=t[0],r=t[1],n=e===U[V-1][0],a=r===U[V-1][1];if(!n||!a)if(V>1){var i=e===U[V-2][0],o=r===U[V-2][1];n&&(e===et||e===rt)&&i?o?V--:U[V-1]=t:a&&(r===nt||r===at)&&o?i?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,J]),ut(t),Q=null,Z=J=0}function ft(t){if(k=t[0]/O,M=t[1]/D,W=t[0]rt?rt:0,Y=t[1]at?at:0,W||Y){if(V)if(Q){var e=K(Q,t);e.length>1&&(ct(e[0]),U[V++]=e[1])}else $=K(U[V-1],t)[0],U[V++]=$;else U[V++]=[W||t[0],Y||t[1]];var r=U[V-1];W&&Y&&(r[0]!==W||r[1]!==Y)?(Q&&(Z!==W&&J!==Y?ut(Z&&J?(n=Q,i=(a=t)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?et:rt,at]:[o>0?rt:et,nt]):[Z||W,J||Y]):Z&&J&&ut([Z,J])),ut([W,Y])):Z-W&&J-Y&&ut([W||Z,Y||J]),Q=t,Z=W,J=Y}else Q&&ct(K(Q,t)[0]),U[V++]=t;var n,a,i,o}for("linear"===P||"spline"===P?K=function(t,e){for(var r=[],n=0,a=0;a<4;a++){var i=it[a],o=u(t[0],t[1],e[0],e[1],i[0],i[1],i[2],i[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)q(p,dt))break;i=p,(_=m[0]*v[0]+m[1]*v[1])>b?(b=_,d=p,g=!1):_=t.length||!p)break;ft(p),n=p}}else ft(d)}Q&&ut([Z||Q[0],J||Q[1]]),N.push(U.slice(0,V))}return N}},{"../../constants/numerical":474,"../../lib":497,"./constants":656}],667:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],668:[function(t,e,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};e.exports=function(t,e,r){var a,i,o,s,l,u={},c=!1,f=-1,d=0,h=-1;for(i=0;i=0?l=h:(l=h=d,d++),l0?Math.max(e,a):0}}},{"fast-isnumeric":155}],670:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],671:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,i=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),a(t,"marker")&&i(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),a(t,"marker.line")&&i(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":367,"../../components/colorscale/defaults":377,"../../components/colorscale/helpers":378,"./subtypes":677}],672:[function(t,e,r){"use strict";var n=t("../../lib").dateTick0,a=t("../../constants/numerical").ONEWEEK;function i(t,e){return n(e,t%a==0?1:0)}e.exports=function(t,e,r,n,a){if(a||(a={x:!0,y:!0}),a.x){var o=n("xperiod");o&&(n("xperiod0",i(o,e.xcalendar)),n("xperiodalignment"))}if(a.y){var s=n("yperiod");s&&(n("yperiod0",i(s,e.ycalendar)),n("yperiodalignment"))}}},{"../../constants/numerical":474,"../../lib":497}],673:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../registry"),i=t("../../lib"),o=i.ensureSingle,s=i.identity,l=t("../../components/drawing"),u=t("./subtypes"),c=t("./line_points"),f=t("./link_traces"),d=t("../../lib/polygon").tester;function h(t,e,r,f,h,p,g){var v;!function(t,e,r,a,o){var s=r.xaxis,l=r.yaxis,c=n.extent(i.simpleMap(s.range,s.r2c)),f=n.extent(i.simpleMap(l.range,l.r2c)),d=a[0].trace;if(!u.hasMarkers(d))return;var h=d.marker.maxdisplayed;if(0===h)return;var p=a.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/h),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),T=o(A,"g","errorbars"),k=o(A,"g","lines"),M=o(A,"g","points"),E=o(A,"g","text");if(a.getComponentMethod("errorbars","plot")(t,T,r,g),!0===_.visible){var S,C;y(A).style("opacity",_.opacity);var L=_.fill.charAt(_.fill.length-1);"x"!==L&&"y"!==L&&(L=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=A;var O,D,R="",I=[],P=_._prevtrace;P&&(R=P._prevRevpath||"",C=P._nextFill,I=P._polygons);var F,z,N,B,j,U,V,H="",G="",q=[],X=i.noop;if(S=_._ownFill,u.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(F=l.steps(w.shape),z=l.steps(w.shape.split("").reverse().join(""))):F=z="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")},N=function(t){return z(t.reverse())},q=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(q.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 a=y(r);a.attr("d",O),l.singleLineStyle(f,a)}}}}}var W=k.selectAll(".js-line").data(q);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),q.length?(S?(S.datum(f),B&&U&&(L?("y"===L?B[1]=U[1]=x.c2p(0,!0):"x"===L&&(B[0]=U[0]=b.c2p(0,!0)),y(S).attr("d","M"+U+"L"+B+"L"+H.substr(1)).call(l.singleFillStyle)):y(S).attr("d",H+"Z").call(l.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&H&&R?("tonext"===_.fill?y(C).attr("d",H+"Z"+R+"Z").call(l.singleFillStyle):y(C).attr("d",H+"L"+R.substr(1)+"Z").call(l.singleFillStyle),_._polygons=_._polygons.concat(I)):(Z(C),_._polygons=null)),_._prevRevpath=G,_._prevPolygons=V):(S?Z(S):C&&Z(C),_._polygons=_._prevRevpath=_._prevPolygons=null),M.datum(f),E.datum(f),function(e,a,i){var o,c=i[0].trace,f=u.hasMarkers(c),d=u.hasText(c),h=tt(c),p=et,g=et;if(f||d){var v=s,_=c.stackgroup,w=_&&"infer zero"===t._fullLayout._scatterStackOpts[b._id+x._id][_].stackgaps;c.marker.maxdisplayed||c._needsCull?v=w?Q:J:_&&!w&&(v=$),f&&(p=v),d&&(g=v)}var A,T=(o=e.selectAll("path.point").data(p,h)).enter().append("path").classed("point",!0);m&&T.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 a=n.select(this),i=y(a);l.translatePoint(e,i,b,x)?(l.singlePointStyle(e,i,c,A,t),r.layerClipId&&l.hideOutsideRangePoint(e,i,b,x,c.xcalendar,c.ycalendar),c.customdata&&a.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):i.remove()})),m?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,h)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(t){var e=n.select(this),a=y(e.select("text"));l.translatePoint(t,a,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()}(M,E,f);var Y=!1===_.cliponaxis?null:r.layerClipId;l.setClipUrl(M,Y,t),l.setClipUrl(E,Y,t)}function Z(t){y(t).attr("d","M0,0Z")}function J(t){return t.filter((function(t){return!t.gap&&t.vis}))}function Q(t){return t.filter((function(t){return t.vis}))}function $(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,a,i,u){var c,d,p=!i,g=!!i&&i.duration>0,v=f(t,e,r);((c=a.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 a=o(n.select(this),"g","fills");l.setClipUrl(a,r.layerClipId,t);var i=e[0].trace,u=[];i._ownfill&&u.push("_ownFill"),i._nexttrace&&u.push("_nextFill");var c=a.selectAll("g").data(u,s);c.enter().append("g"),c.exit().each((function(t){i[t]=null})).remove(),c.order().each((function(t){i[t]=o(n.select(this),"path","js-fill")}))}))}(t,c,e),g)?(u&&(d=u()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){d&&d()})).each("interrupt",(function(){d&&d()})).each((function(){a.selectAll("g.trace").each((function(r,n){h(t,n,e,r,v,this,i)}))}))):c.each((function(r,n){h(t,n,e,r,v,this,i)}));p&&c.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":389,"../../lib":497,"../../lib/polygon":509,"../../registry":591,"./line_points":666,"./link_traces":668,"./subtypes":677,d3:86}],674:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,i,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=v,T=2*w,k={},M=b.makeCalcdata(e,"x"),E=x.makeCalcdata(e,"y"),S=s(e,b,"x",M),C=s(e,x,"y",E);e._x=S,e._y=C,e.xperiodalignment&&(e._origX=M),e.yperiodalignment&&(e._origY=E);var L=new Array(T);for(r=0;r1&&a.extendFlat(s.line,h.linePositions(t,r,n));if(s.errorX||s.errorY){var l=h.errorBarPositions(t,r,n,i,o);s.errorX&&a.extendFlat(s.errorX,l.x),s.errorY&&a.extendFlat(s.errorY,l.y)}s.text&&(a.extendFlat(s.text,{positions:n},h.textPosition(t,r,s.text,s.marker)),a.extendFlat(s.textSel,{positions:n},h.textPosition(t,r,s.text,s.markerSel)),a.extendFlat(s.textUnsel,{positions:n},h.textPosition(t,r,s.text,s.markerUnsel)));return s}(t,0,e,L,S,C),I=p(t,_);return f(y,e),A?R.marker&&(D=2*(R.marker.sizeAvg||Math.max(R.marker.size,3))):D=u(e,w),c(t,e,b,x,S,C,D),R.errorX&&m(e,b,R.errorX),R.errorY&&m(e,x,R.errorY),R.fill&&!I.fill2d&&(I.fill2d=!0),R.marker&&!I.scatter2d&&(I.scatter2d=!0),R.line&&!I.line2d&&(I.line2d=!0),!R.errorX&&!R.errorY||I.error2d||(I.error2d=!0),R.text&&!I.glText&&(I.glText=!0),R.marker&&(R.marker.snap=w),I.lineOptions.push(R.line),I.errorXOptions.push(R.errorX),I.errorYOptions.push(R.errorY),I.fillOptions.push(R.fill),I.markerOptions.push(R.marker),I.markerSelectedOptions.push(R.markerSel),I.markerUnselectedOptions.push(R.markerUnsel),I.textOptions.push(R.text),I.textSelectedOptions.push(R.textSel),I.textUnselectedOptions.push(R.textUnsel),I.selectBatch.push([]),I.unselectBatch.push([]),k._scene=I,k.index=I.count,k.x=S,k.y=C,k.positions=L,I.count++,[{x:!1,y:!1,t:k,trace:e}]}},{"../../constants/numerical":474,"../../lib":497,"../../plots/cartesian/align_period":542,"../../plots/cartesian/autorange":544,"../../plots/cartesian/axis_ids":548,"../scatter/calc":653,"../scatter/colorscale_calc":655,"./constants":683,"./convert":684,"./scene_update":692,"@plotly/point-cluster":10}],683:[function(t,e,r){"use strict";e.exports={TOO_MANY_POINTS:1e5,SYMBOL_SDF_SIZE:200,SYMBOL_SIZE:20,SYMBOL_STROKE:1,DOT_RE:/-dot/,OPEN_RE:/-open/,DASHES:{solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}}},{}],684:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("svg-path-sdf"),i=t("color-normalize"),o=t("../../registry"),s=t("../../lib"),l=t("../../components/drawing"),u=t("../../plots/cartesian/axis_ids"),c=t("../../lib/gl_format_color").formatColor,f=t("../scatter/subtypes"),d=t("../scatter/make_bubble_size_func"),h=t("./helpers"),p=t("./constants"),g=t("../../constants/interactions").DESELECTDIM,v={start:1,left:1,end:-1,right:-1,middle:0,center:0,bottom:1,top:-1},m=t("../../components/fx/helpers").appendArrayPointValue;function y(t,e){var r,a=t._fullLayout,i=e._length,o=e.textfont,l=e.textposition,u=Array.isArray(l)?l:[l],c=o.color,f=o.size,d=o.family,h={},p=e.texttemplate;if(p){h.text=[];var g=a._d3locale,v=Array.isArray(p),y=v?Math.min(p.length,i):i,b=v?function(t){return p[t]}:function(){return p};for(r=0;rp.TOO_MANY_POINTS||f.hasMarkers(e)?"rect":"round";if(u&&e.connectgaps){var d=n[0],h=n[1];for(a=0;a1?l[a]:l[0]:l,p=Array.isArray(u)?u.length>1?u[a]:u[0]:u,g=v[h],m=v[p],y=c?c/.8+1:0,b=-m*y-.5*m;o.offset[a]=[g*y/d,b/d]}}return o}}},{"../../components/drawing":389,"../../components/fx/helpers":403,"../../constants/interactions":473,"../../lib":497,"../../lib/gl_format_color":493,"../../plots/cartesian/axis_ids":548,"../../registry":591,"../scatter/make_bubble_size_func":669,"../scatter/subtypes":677,"./constants":683,"./helpers":688,"color-normalize":63,"fast-isnumeric":155,"svg-path-sdf":319}],685:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("./helpers"),o=t("./attributes"),s=t("../scatter/constants"),l=t("../scatter/subtypes"),u=t("../scatter/xy_defaults"),c=t("../scatter/period_defaults"),f=t("../scatter/marker_defaults"),d=t("../scatter/line_defaults"),h=t("../scatter/fillcolor_defaults"),p=t("../scatter/text_defaults");e.exports=function(t,e,r,g){function v(r,a){return n.coerce(t,e,o,r,a)}var m=!!t.marker&&i.isOpenSymbol(t.marker.symbol),y=l.isBubble(t),b=u(t,e,g,v);if(b){c(t,e,g,v);var x=b100},r.isDotSymbol=function(t){return"string"==typeof t?n.DOT_RE.test(t):t>200}},{"./constants":683}],689:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("../scatter/get_trace_color");function o(t,e,r,o){var s=t.xa,l=t.ya,u=t.distance,c=t.dxy,f=t.index,d={pointNumber:f,x:e[f],y:r[f]};d.tx=Array.isArray(o.text)?o.text[f]:o.text,d.htx=Array.isArray(o.hovertext)?o.hovertext[f]:o.hovertext,d.data=Array.isArray(o.customdata)?o.customdata[f]:o.customdata,d.tp=Array.isArray(o.textposition)?o.textposition[f]:o.textposition;var h=o.textfont;h&&(d.ts=a.isArrayOrTypedArray(h.size)?h.size[f]:h.size,d.tc=Array.isArray(h.color)?h.color[f]:h.color,d.tf=Array.isArray(h.family)?h.family[f]:h.family);var p=o.marker;p&&(d.ms=a.isArrayOrTypedArray(p.size)?p.size[f]:p.size,d.mo=a.isArrayOrTypedArray(p.opacity)?p.opacity[f]:p.opacity,d.mx=a.isArrayOrTypedArray(p.symbol)?p.symbol[f]:p.symbol,d.mc=a.isArrayOrTypedArray(p.color)?p.color[f]:p.color);var g=p&&p.line;g&&(d.mlc=Array.isArray(g.color)?g.color[f]:g.color,d.mlw=a.isArrayOrTypedArray(g.width)?g.width[f]:g.width);var v=p&&p.gradient;v&&"none"!==v.type&&(d.mgt=Array.isArray(v.type)?v.type[f]:v.type,d.mgc=Array.isArray(v.color)?v.color[f]:v.color);var m=s.c2p(d.x,!0),y=l.c2p(d.y,!0),b=d.mrc||1,x=o.hoverlabel;x&&(d.hbg=Array.isArray(x.bgcolor)?x.bgcolor[f]:x.bgcolor,d.hbc=Array.isArray(x.bordercolor)?x.bordercolor[f]:x.bordercolor,d.hts=a.isArrayOrTypedArray(x.font.size)?x.font.size[f]:x.font.size,d.htc=Array.isArray(x.font.color)?x.font.color[f]:x.font.color,d.htf=Array.isArray(x.font.family)?x.font.family[f]:x.font.family,d.hnl=a.isArrayOrTypedArray(x.namelength)?x.namelength[f]:x.namelength);var _=o.hoverinfo;_&&(d.hi=Array.isArray(_)?_[f]:_);var w=o.hovertemplate;w&&(d.ht=Array.isArray(w)?w[f]:w);var A={};A[t.index]=d;var T=o._origX,k=o._origY,M=a.extendFlat({},t,{color:i(o,d),x0:m-b,x1:m+b,xLabelVal:T?T[f]:d.x,y0:y-b,y1:y+b,yLabelVal:k?k[f]:d.y,cd:A,distance:u,spikeDistance:c,hovertemplate:d.ht});return d.htx?M.text=d.htx:d.tx?M.text=d.tx:o.text&&(M.text=o.text),a.fillText(d,o,M),n.getComponentMethod("errorbars","hoverInfo")(d,o,M),M}e.exports={hoverPoints:function(t,e,r,n){var a,i,s,l,u,c,f,d,h,p=t.cd,g=p[0].t,v=p[0].trace,m=t.xa,y=t.ya,b=g.x,x=g.y,_=m.c2p(e),w=y.c2p(r),A=t.distance;if(g.tree){var T=m.p2c(_-A),k=m.p2c(_+A),M=y.p2c(w-A),E=y.p2c(w+A);a="x"===n?g.tree.range(Math.min(T,k),Math.min(y._rl[0],y._rl[1]),Math.max(T,k),Math.max(y._rl[0],y._rl[1])):g.tree.range(Math.min(T,k),Math.min(M,E),Math.max(T,k),Math.max(M,E))}else a=g.ids;var S=A;if("x"===n)for(u=0;u-1;u--)s=b[a[u]],l=x[a[u]],c=m.c2p(s)-_,f=y.c2p(l)-w,(d=Math.sqrt(c*c+f*f))m.glText.length){var w=x-m.glText.length;for(p=0;pr&&(isNaN(e[n])||isNaN(e[n+1]));)n-=2;t.positions=e.slice(r,n+2)}return t})),m.line2d.update(m.lineOptions)),m.error2d){var T=(m.errorXOptions||[]).concat(m.errorYOptions||[]);m.error2d.update(T)}m.scatter2d&&m.scatter2d.update(m.markerOptions),m.fillOrder=s.repeat(null,x),m.fill2d&&(m.fillOptions=m.fillOptions.map((function(t,e){var n=r[e];if(t&&n&&n[0]&&n[0].trace){var a,i,o=n[0],s=o.trace,l=o.t,u=m.lineOptions[e],c=[];s._ownfill&&c.push(e),s._nexttrace&&c.push(e+1),c.length&&(m.fillOrder[e]=c);var f,d,h=[],p=u&&u.positions||l.positions;if("tozeroy"===s.fill){for(f=0;ff&&isNaN(p[d+1]);)d-=2;0!==p[f+1]&&(h=[p[f],0]),h=h.concat(p.slice(f,d+2)),0!==p[d+1]&&(h=h.concat([p[d],0]))}else if("tozerox"===s.fill){for(f=0;ff&&isNaN(p[d]);)d-=2;0!==p[f]&&(h=[0,p[f+1]]),h=h.concat(p.slice(f,d+2)),0!==p[d]&&(h=h.concat([0,p[d+1]]))}else if("toself"===s.fill||"tonext"===s.fill){for(h=[],a=0,i=0;i-1;for(p=0;pd?2*(x.sizeAvg||Math.max(x.size,3)):i(e,b),h=0;hi&&l||a-1,M=!0;if(o(b)||!!h.selectedpoints||k){var E=h._length;if(h.selectedpoints){g.selectBatch=h.selectedpoints;var S=h.selectedpoints,C={};for(l=0;l 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -6510,19 +6471,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -6531,7 +6491,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -6539,33 +6499,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -6587,44 +6543,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -6634,20 +6575,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -6669,35 +6609,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -6706,7 +6649,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -6714,7 +6657,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -6723,7 +6666,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -6736,17 +6679,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -6769,12 +6713,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -6783,16 +6727,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -6800,6 +6737,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -6808,27 +6751,37 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],49:[function(_dereq_,module,exports){ -(function (Buffer){ +(function (Buffer){(function (){ /*! * The buffer module from node.js, for the browser. * @@ -8607,8 +8560,8 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -}).call(this,_dereq_("buffer").Buffer) -},{"base64-js":19,"buffer":49,"ieee754":248}],50:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"base64-js":19,"buffer":49,"ieee754":269}],50:[function(_dereq_,module,exports){ 'use strict' var monotoneTriangulate = _dereq_('./lib/monotone') @@ -8809,7 +8762,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":36,"robust-in-sphere":316}],52:[function(_dereq_,module,exports){ +},{"binary-search-bounds":36,"robust-in-sphere":337}],52:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -9180,7 +9133,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":36,"robust-orientation":318}],54:[function(_dereq_,module,exports){ +},{"binary-search-bounds":36,"robust-orientation":339}],54:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -9374,7 +9327,7 @@ function circumcenter(points) { circumcenter.barycenetric = barycentricCircumcenter module.exports = circumcenter -},{"dup":87,"robust-linear-solve":317}],57:[function(_dereq_,module,exports){ +},{"dup":87,"robust-linear-solve":338}],57:[function(_dereq_,module,exports){ module.exports = circumradius var circumcenter = _dereq_('circumcenter') @@ -9782,7 +9735,7 @@ function cleanPSLG (points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":60,"big-rat":23,"big-rat/cmp":21,"big-rat/to-float":35,"box-intersect":40,"nextafter":281,"rat-vec":307,"robust-segment-intersect":321,"union-find":346}],60:[function(_dereq_,module,exports){ +},{"./lib/rat-seg-intersect":60,"big-rat":23,"big-rat/cmp":21,"big-rat/to-float":35,"box-intersect":40,"nextafter":302,"rat-vec":328,"robust-segment-intersect":342,"union-find":367}],60:[function(_dereq_,module,exports){ 'use strict' module.exports = solveIntersection @@ -9826,7 +9779,7 @@ function solveIntersection (a, b, c, d) { return r } -},{"big-rat/div":22,"big-rat/mul":32,"big-rat/sign":33,"big-rat/sub":34,"rat-vec/add":306,"rat-vec/muls":308,"rat-vec/sub":309}],61:[function(_dereq_,module,exports){ +},{"big-rat/div":22,"big-rat/mul":32,"big-rat/sign":33,"big-rat/sub":34,"rat-vec/add":327,"rat-vec/muls":329,"rat-vec/sub":330}],61:[function(_dereq_,module,exports){ 'use strict' module.exports = { @@ -10054,7 +10007,7 @@ function isInt(color) { } },{"clamp":58,"color-rgba":64,"dtype":86}],63:[function(_dereq_,module,exports){ -(function (global){ +(function (global){(function (){ /** * @module color-parse */ @@ -10231,8 +10184,8 @@ function parse (cstr) { } } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"color-name":61,"defined":83,"is-plain-obj":257}],64:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"color-name":61,"defined":83,"is-plain-obj":278}],64:[function(_dereq_,module,exports){ /** @module color-rgba */ 'use strict' @@ -10626,7 +10579,7 @@ function rgbaStr (rgba) { return 'rgba(' + rgba.join(',') + ')'; } -},{"./colorScale":67,"lerp":259}],69:[function(_dereq_,module,exports){ +},{"./colorScale":67,"lerp":280}],69:[function(_dereq_,module,exports){ "use strict" module.exports = compareAngle @@ -10712,7 +10665,7 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":318,"robust-product":319,"robust-sum":323,"signum":324,"two-sum":344}],70:[function(_dereq_,module,exports){ +},{"robust-orientation":339,"robust-product":340,"robust-sum":344,"signum":345,"two-sum":365}],70:[function(_dereq_,module,exports){ module.exports = compareCells var min = Math.min @@ -10853,7 +10806,7 @@ function convexHull2D(points) { return edges } -},{"monotone-convex-hull-2d":267}],75:[function(_dereq_,module,exports){ +},{"monotone-convex-hull-2d":288}],75:[function(_dereq_,module,exports){ 'use strict' module.exports = convexHullnD @@ -10914,7 +10867,7 @@ function convexHullnD(points, d) { return invPermute(nhull, ah) } } -},{"affine-hull":14,"incremental-convex-hull":249}],76:[function(_dereq_,module,exports){ +},{"affine-hull":14,"incremental-convex-hull":270}],76:[function(_dereq_,module,exports){ "use strict" function dcubicHermite(p0, v0, p1, v1, t, f) { @@ -11425,7 +11378,7 @@ function generateCWiseOp(proc, typesig) { } module.exports = generateCWiseOp -},{"uniq":347}],79:[function(_dereq_,module,exports){ +},{"uniq":368}],79:[function(_dereq_,module,exports){ "use strict" // The function below is called when constructing a cwise function object, and does the following: @@ -22319,8 +22272,8 @@ function triangulate(points, includePointAtInfinity) { return hull } -},{"incremental-convex-hull":249,"uniq":347}],85:[function(_dereq_,module,exports){ -(function (Buffer){ +},{"incremental-convex-hull":270,"uniq":368}],85:[function(_dereq_,module,exports){ +(function (Buffer){(function (){ var hasTypedArrays = false if(typeof Float64Array !== "undefined") { var DOUBLE_VIEW = new Float64Array(1) @@ -22422,7 +22375,7 @@ module.exports.denormalized = function(n) { var hi = module.exports.hi(n) return !(hi & 0x7ff00000) } -}).call(this,_dereq_("buffer").Buffer) +}).call(this)}).call(this,_dereq_("buffer").Buffer) },{"buffer":49}],86:[function(_dereq_,module,exports){ module.exports = function(dtype) { switch (dtype) { @@ -22533,8 +22486,8 @@ function edgeToAdjacency(edges, numVertices) { } return adj } -},{"uniq":347}],89:[function(_dereq_,module,exports){ -(function (process,global){ +},{"uniq":368}],89:[function(_dereq_,module,exports){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -23710,8 +23663,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":304}],90:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":325}],90:[function(_dereq_,module,exports){ "use strict" module.exports = extractPlanes @@ -23754,7 +23707,7 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":258}],92:[function(_dereq_,module,exports){ +},{"is-string-blank":279}],92:[function(_dereq_,module,exports){ 'use strict' module.exports = createFilteredVector @@ -25936,7 +25889,7 @@ function createBackgroundCube(gl) { return new BackgroundCube(gl, buffer, vao, shader) } -},{"./shaders":101,"gl-buffer":105,"gl-vao":164}],99:[function(_dereq_,module,exports){ +},{"./shaders":101,"gl-buffer":106,"gl-vao":186}],99:[function(_dereq_,module,exports){ "use strict" module.exports = getCubeEdges @@ -26178,7 +26131,7 @@ function getCubeEdges(model, view, projection, bounds, ortho) { //Return result return CUBE_RESULT } -},{"bit-twiddle":37,"gl-mat4/multiply":125,"robust-orientation":318,"split-polygon":336}],100:[function(_dereq_,module,exports){ +},{"bit-twiddle":37,"gl-mat4/multiply":139,"robust-orientation":339,"split-polygon":357}],100:[function(_dereq_,module,exports){ 'use strict' module.exports = createLines @@ -26388,7 +26341,7 @@ function createLines(gl, bounds, ticks) { return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } -},{"./shaders":101,"gl-buffer":105,"gl-vao":164}],101:[function(_dereq_,module,exports){ +},{"./shaders":101,"gl-buffer":106,"gl-vao":186}],101:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -26419,8 +26372,8 @@ exports.bg = function(gl) { ]) } -},{"gl-shader":147,"glslify":245}],102:[function(_dereq_,module,exports){ -(function (process){ +},{"gl-shader":166,"glslify":104}],102:[function(_dereq_,module,exports){ +(function (process){(function (){ "use strict" module.exports = createTextSprites @@ -26640,8 +26593,8 @@ function createTextSprites( return result } -}).call(this,_dereq_('_process')) -},{"./shaders":101,"_process":304,"gl-buffer":105,"gl-vao":164,"vectorize-text":348}],103:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process')) +},{"./shaders":101,"_process":325,"gl-buffer":106,"gl-vao":186,"vectorize-text":369}],103:[function(_dereq_,module,exports){ 'use strict' exports.create = defaultTicks @@ -26723,6 +26676,18 @@ function ticksEqual(ticksA, ticksB) { return true } },{}],104:[function(_dereq_,module,exports){ +module.exports = function(strings) { + if (typeof strings === 'string') strings = [strings] + var exprs = [].slice.call(arguments,1) + var parts = [] + for (var i = 0; i < strings.length-1; i++) { + parts.push(strings[i], exprs[i] || '') + } + parts.push(strings[i]) + return parts.join('') +} + +},{}],105:[function(_dereq_,module,exports){ "use strict" module.exports = axesProperties @@ -26866,7 +26831,7 @@ i_loop: return ranges } -},{"./lib/cube.js":99,"extract-frustum-planes":90,"gl-mat4/multiply":125,"gl-mat4/transpose":134,"gl-vec4/transformMat4":235,"split-polygon":336}],105:[function(_dereq_,module,exports){ +},{"./lib/cube.js":99,"extract-frustum-planes":90,"gl-mat4/multiply":139,"gl-mat4/transpose":150,"gl-vec4/transformMat4":257,"split-polygon":357}],106:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -27020,7 +26985,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":280,"ndarray-ops":275,"typedarray-pool":345}],106:[function(_dereq_,module,exports){ +},{"ndarray":301,"ndarray-ops":296,"typedarray-pool":366}],107:[function(_dereq_,module,exports){ "use strict"; var vec3 = _dereq_('gl-vec3'); @@ -27158,7 +27123,7 @@ module.exports.createConeMesh = function(gl, params) { }); } -},{"./create_mesh":107,"./lib/shaders":108,"gl-vec3":183}],107:[function(_dereq_,module,exports){ +},{"./create_mesh":108,"./lib/shaders":109,"gl-vec3":205}],108:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -27733,7 +27698,7 @@ function createVectorMesh(gl, params, opts) { module.exports = createVectorMesh -},{"colormap":68,"gl-buffer":105,"gl-mat4/invert":123,"gl-mat4/multiply":125,"gl-shader":147,"gl-texture2d":160,"gl-vao":164,"ndarray":280}],108:[function(_dereq_,module,exports){ +},{"colormap":68,"gl-buffer":106,"gl-mat4/invert":137,"gl-mat4/multiply":139,"gl-shader":166,"gl-texture2d":182,"gl-vao":186,"ndarray":301}],109:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["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;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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"]) @@ -27761,7 +27726,9 @@ exports.pickShader = { ] } -},{"glslify":245}],109:[function(_dereq_,module,exports){ +},{"glslify":110}],110:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],111:[function(_dereq_,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -28061,14 +28028,14 @@ module.exports = { 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],110:[function(_dereq_,module,exports){ +},{}],112:[function(_dereq_,module,exports){ var gl10 = _dereq_('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":109}],111:[function(_dereq_,module,exports){ +},{"./1.0/numbers":111}],113:[function(_dereq_,module,exports){ 'use strict' module.exports = createErrorBars @@ -28319,7 +28286,9 @@ function createErrorBars(options) { return result } -},{"./shaders/index":112,"gl-buffer":105,"gl-vao":164}],112:[function(_dereq_,module,exports){ +},{"./shaders/index":115,"gl-buffer":106,"gl-vao":186}],114:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],115:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -28336,7 +28305,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":147,"glslify":245}],113:[function(_dereq_,module,exports){ +},{"gl-shader":166,"glslify":114}],116:[function(_dereq_,module,exports){ 'use strict' var createTexture = _dereq_('gl-texture2d') @@ -28803,7 +28772,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":160}],114:[function(_dereq_,module,exports){ +},{"gl-texture2d":182}],117:[function(_dereq_,module,exports){ var sprintf = _dereq_('sprintf-js').sprintf; var glConstants = _dereq_('gl-constants/lookup'); @@ -28858,7 +28827,7 @@ function formatCompilerError(errLog, src, type) { } -},{"add-line-numbers":13,"gl-constants/lookup":110,"glsl-shader-name":237,"sprintf-js":337}],115:[function(_dereq_,module,exports){ +},{"add-line-numbers":13,"gl-constants/lookup":112,"glsl-shader-name":259,"sprintf-js":358}],118:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') @@ -28882,7 +28851,7 @@ exports.createPickShader = function(gl) { return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) } -},{"gl-shader":147,"glslify":245}],116:[function(_dereq_,module,exports){ +},{"gl-shader":166,"glslify":120}],119:[function(_dereq_,module,exports){ 'use strict' module.exports = createLinePlot @@ -29283,7 +29252,43 @@ function createLinePlot (options) { return linePlot } -},{"./lib/shaders":115,"binary-search-bounds":36,"gl-buffer":105,"gl-texture2d":160,"gl-vao":164,"ndarray":280}],117:[function(_dereq_,module,exports){ +},{"./lib/shaders":118,"binary-search-bounds":36,"gl-buffer":106,"gl-texture2d":182,"gl-vao":186,"ndarray":301}],120:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],121:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],122:[function(_dereq_,module,exports){ module.exports = clone; /** @@ -29312,7 +29317,36 @@ function clone(a) { out[15] = a[15]; return out; }; -},{}],118:[function(_dereq_,module,exports){ +},{}],123:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],124:[function(_dereq_,module,exports){ module.exports = create; /** @@ -29340,7 +29374,7 @@ function create() { out[15] = 1; return out; }; -},{}],119:[function(_dereq_,module,exports){ +},{}],125:[function(_dereq_,module,exports){ module.exports = determinant; /** @@ -29371,7 +29405,7 @@ function determinant(a) { // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; -},{}],120:[function(_dereq_,module,exports){ +},{}],126:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -29419,7 +29453,62 @@ function fromQuat(out, q) { return out; }; -},{}],121:[function(_dereq_,module,exports){ +},{}],127:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],128:[function(_dereq_,module,exports){ module.exports = fromRotationTranslation; /** @@ -29473,7 +29562,223 @@ function fromRotationTranslation(out, q, v) { return out; }; -},{}],122:[function(_dereq_,module,exports){ +},{}],129:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],130:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],131:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],132:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],133:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],134:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],135:[function(_dereq_,module,exports){ module.exports = identity; /** @@ -29501,7 +29806,40 @@ function identity(out) { out[15] = 1; return out; }; -},{}],123:[function(_dereq_,module,exports){ +},{}],136:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":121,"./clone":122,"./copy":123,"./create":124,"./determinant":125,"./fromQuat":126,"./fromRotation":127,"./fromRotationTranslation":128,"./fromScaling":129,"./fromTranslation":130,"./fromXRotation":131,"./fromYRotation":132,"./fromZRotation":133,"./frustum":134,"./identity":135,"./invert":137,"./lookAt":138,"./multiply":139,"./ortho":140,"./perspective":141,"./perspectiveFromFieldOfView":142,"./rotate":143,"./rotateX":144,"./rotateY":145,"./rotateZ":146,"./scale":147,"./str":148,"./translate":149,"./transpose":150}],137:[function(_dereq_,module,exports){ module.exports = invert; /** @@ -29557,7 +29895,7 @@ function invert(out, a) { return out; }; -},{}],124:[function(_dereq_,module,exports){ +},{}],138:[function(_dereq_,module,exports){ var identity = _dereq_('./identity'); module.exports = lookAt; @@ -29648,7 +29986,7 @@ function lookAt(out, eye, center, up) { return out; }; -},{"./identity":122}],125:[function(_dereq_,module,exports){ +},{"./identity":135}],139:[function(_dereq_,module,exports){ module.exports = multiply; /** @@ -29691,7 +30029,7 @@ function multiply(out, a, b) { out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; -},{}],126:[function(_dereq_,module,exports){ +},{}],140:[function(_dereq_,module,exports){ module.exports = ortho; /** @@ -29728,7 +30066,7 @@ function ortho(out, left, right, bottom, top, near, far) { out[15] = 1; return out; }; -},{}],127:[function(_dereq_,module,exports){ +},{}],141:[function(_dereq_,module,exports){ module.exports = perspective; /** @@ -29762,7 +30100,49 @@ function perspective(out, fovy, aspect, near, far) { out[15] = 0; return out; }; -},{}],128:[function(_dereq_,module,exports){ +},{}],142:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],143:[function(_dereq_,module,exports){ module.exports = rotate; /** @@ -29827,7 +30207,7 @@ function rotate(out, a, rad, axis) { } return out; }; -},{}],129:[function(_dereq_,module,exports){ +},{}],144:[function(_dereq_,module,exports){ module.exports = rotateX; /** @@ -29872,7 +30252,7 @@ function rotateX(out, a, rad) { out[11] = a23 * c - a13 * s; return out; }; -},{}],130:[function(_dereq_,module,exports){ +},{}],145:[function(_dereq_,module,exports){ module.exports = rotateY; /** @@ -29917,7 +30297,7 @@ function rotateY(out, a, rad) { out[11] = a03 * s + a23 * c; return out; }; -},{}],131:[function(_dereq_,module,exports){ +},{}],146:[function(_dereq_,module,exports){ module.exports = rotateZ; /** @@ -29962,7 +30342,7 @@ function rotateZ(out, a, rad) { out[7] = a13 * c - a03 * s; return out; }; -},{}],132:[function(_dereq_,module,exports){ +},{}],147:[function(_dereq_,module,exports){ module.exports = scale; /** @@ -29994,7 +30374,22 @@ function scale(out, a, v) { out[15] = a[15]; return out; }; -},{}],133:[function(_dereq_,module,exports){ +},{}],148:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],149:[function(_dereq_,module,exports){ module.exports = translate; /** @@ -30033,7 +30428,7 @@ function translate(out, a, v) { return out; }; -},{}],134:[function(_dereq_,module,exports){ +},{}],150:[function(_dereq_,module,exports){ module.exports = transpose; /** @@ -30083,7 +30478,7 @@ function transpose(out, a) { return out; }; -},{}],135:[function(_dereq_,module,exports){ +},{}],151:[function(_dereq_,module,exports){ 'use strict' var barycentric = _dereq_('barycentric') @@ -30181,7 +30576,7 @@ function closestPointToPickLocation(simplex, pixelCoord, model, view, projection } return [closestIndex, interpolate(simplex, weights), weights] } -},{"barycentric":18,"polytope-closest-point/lib/closest_point_2d.js":303}],136:[function(_dereq_,module,exports){ +},{"barycentric":18,"polytope-closest-point/lib/closest_point_2d.js":324}],152:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\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;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\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 f_color = color;\n f_data = position;\n f_uv = uv;\n}\n"]) @@ -30250,7 +30645,7 @@ exports.contourShader = { ] } -},{"glslify":245}],137:[function(_dereq_,module,exports){ +},{"glslify":154}],153:[function(_dereq_,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -31361,7 +31756,9 @@ function createSimplicialMesh(gl, params) { module.exports = createSimplicialMesh -},{"./lib/closest-point":135,"./lib/shaders":136,"colormap":68,"gl-buffer":105,"gl-mat4/invert":123,"gl-mat4/multiply":125,"gl-shader":147,"gl-texture2d":160,"gl-vao":164,"ndarray":280,"normals":282,"simplicial-complex-contour":326,"typedarray-pool":345}],138:[function(_dereq_,module,exports){ +},{"./lib/closest-point":151,"./lib/shaders":152,"colormap":68,"gl-buffer":106,"gl-mat4/invert":137,"gl-mat4/multiply":139,"gl-shader":166,"gl-texture2d":182,"gl-vao":186,"ndarray":301,"normals":303,"simplicial-complex-contour":347,"typedarray-pool":366}],154:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],155:[function(_dereq_,module,exports){ 'use strict' module.exports = createCamera @@ -31554,23 +31951,17 @@ function createCamera(element, options) { var xy = mouseOffset(ev.changedTouches[0], element) handleInteraction(0, xy[0], xy[1], camera._lastMods) handleInteraction(1, xy[0], xy[1], camera._lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) + }, hasPassive ? {passive: true} : false) element.addEventListener('touchmove', function (ev) { var xy = mouseOffset(ev.changedTouches[0], element) handleInteraction(1, xy[0], xy[1], camera._lastMods) - ev.preventDefault() }, hasPassive ? {passive: false} : false) element.addEventListener('touchend', function (ev) { - handleInteraction(0, camera._lastX, camera._lastY, camera._lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) + }, hasPassive ? {passive: true} : false) function handleInteraction (buttons, x, y, mods) { var keyBindingMode = camera.keyBindingMode @@ -31648,7 +32039,7 @@ function createCamera(element, options) { return camera } -},{"3d-view":11,"has-passive-events":247,"mouse-change":268,"mouse-event-offset":269,"mouse-wheel":271,"right-now":312}],139:[function(_dereq_,module,exports){ +},{"3d-view":11,"has-passive-events":268,"mouse-change":289,"mouse-event-offset":290,"mouse-wheel":292,"right-now":333}],156:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') @@ -31659,7 +32050,9 @@ module.exports = function(gl) { return createShader(gl, vertSrc, fragSrc, null, [ { name: 'position', type: 'vec2'}]) } -},{"gl-shader":147,"glslify":245}],140:[function(_dereq_,module,exports){ +},{"gl-shader":166,"glslify":157}],157:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],158:[function(_dereq_,module,exports){ 'use strict' var createCamera = _dereq_('./camera.js') @@ -32514,7 +32907,7 @@ function calcCameraParams(scene, isOrtho) { } } -},{"./camera.js":138,"./lib/shader":139,"a-big-triangle":12,"gl-axes3d":97,"gl-axes3d/properties":104,"gl-fbo":113,"gl-mat4/ortho":126,"gl-mat4/perspective":127,"gl-select-static":146,"gl-spikes3d":155,"is-mobile":256,"mouse-change":268}],141:[function(_dereq_,module,exports){ +},{"./camera.js":155,"./lib/shader":156,"a-big-triangle":12,"gl-axes3d":97,"gl-axes3d/properties":105,"gl-fbo":116,"gl-mat4/ortho":140,"gl-mat4/perspective":141,"gl-select-static":165,"gl-spikes3d":175,"is-mobile":277,"mouse-change":289}],159:[function(_dereq_,module,exports){ module.exports = slerp /** @@ -32567,14 +32960,14 @@ function slerp (out, a, b, t) { return out } -},{}],142:[function(_dereq_,module,exports){ +},{}],160:[function(_dereq_,module,exports){ 'use strict'; module.exports = function(a){ return (!a && a !== 0) ? '' : a.toString(); } -},{}],143:[function(_dereq_,module,exports){ +},{}],161:[function(_dereq_,module,exports){ "use strict" var vectorizeText = _dereq_("vectorize-text") @@ -32643,7 +33036,7 @@ function getGlyph(symbol, font, pixelRatio) { //Save cached symbol return fontCache[symbol] = [triSymbol, lineSymbol, bounds] } -},{"vectorize-text":348}],144:[function(_dereq_,module,exports){ +},{"vectorize-text":369}],162:[function(_dereq_,module,exports){ var createShaderWrapper = _dereq_('gl-shader') var glslify = _dereq_('glslify') @@ -32720,7 +33113,9 @@ exports.createPickProject = function(gl) { return createShader(gl, pickProject) } -},{"gl-shader":147,"glslify":245}],145:[function(_dereq_,module,exports){ +},{"gl-shader":166,"glslify":163}],163:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],164:[function(_dereq_,module,exports){ 'use strict' var isAllBlank = _dereq_('is-string-blank') @@ -33592,7 +33987,7 @@ function createPointCloud(options) { return pointCloud } -},{"./lib/get-simple-string":142,"./lib/glyphs":143,"./lib/shaders":144,"gl-buffer":105,"gl-mat4/multiply":125,"gl-vao":164,"is-string-blank":258,"typedarray-pool":345}],146:[function(_dereq_,module,exports){ +},{"./lib/get-simple-string":160,"./lib/glyphs":161,"./lib/shaders":162,"gl-buffer":106,"gl-mat4/multiply":139,"gl-vao":186,"is-string-blank":279,"typedarray-pool":366}],165:[function(_dereq_,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -33777,7 +34172,7 @@ function createSelectBuffer(gl, shape) { return new SelectBuffer(gl, fbo, buffer) } -},{"bit-twiddle":37,"gl-fbo":113,"ndarray":280,"typedarray-pool":345}],147:[function(_dereq_,module,exports){ +},{"bit-twiddle":37,"gl-fbo":116,"ndarray":301,"typedarray-pool":366}],166:[function(_dereq_,module,exports){ 'use strict' var createUniformWrapper = _dereq_('./lib/create-uniforms') @@ -34043,7 +34438,7 @@ function createShader( module.exports = createShader -},{"./lib/GLError":148,"./lib/create-attributes":149,"./lib/create-uniforms":150,"./lib/reflect":151,"./lib/runtime-reflect":152,"./lib/shader-cache":153}],148:[function(_dereq_,module,exports){ +},{"./lib/GLError":167,"./lib/create-attributes":168,"./lib/create-uniforms":169,"./lib/reflect":170,"./lib/runtime-reflect":171,"./lib/shader-cache":172}],167:[function(_dereq_,module,exports){ function GLError (rawError, shortMessage, longMessage) { this.shortMessage = shortMessage || '' this.longMessage = longMessage || '' @@ -34058,7 +34453,7 @@ GLError.prototype.name = 'GLError' GLError.prototype.constructor = GLError module.exports = GLError -},{}],149:[function(_dereq_,module,exports){ +},{}],168:[function(_dereq_,module,exports){ 'use strict' module.exports = createAttributeWrapper @@ -34323,7 +34718,7 @@ function createAttributeWrapper( return obj } -},{"./GLError":148}],150:[function(_dereq_,module,exports){ +},{"./GLError":167}],169:[function(_dereq_,module,exports){ 'use strict' var coallesceUniforms = _dereq_('./reflect') @@ -34516,7 +34911,7 @@ function createUniformWrapper(gl, wrapper, uniforms, locations) { } } -},{"./GLError":148,"./reflect":151}],151:[function(_dereq_,module,exports){ +},{"./GLError":167,"./reflect":170}],170:[function(_dereq_,module,exports){ 'use strict' module.exports = makeReflectTypes @@ -34574,7 +34969,7 @@ function makeReflectTypes(uniforms, useIndex) { } return obj } -},{}],152:[function(_dereq_,module,exports){ +},{}],171:[function(_dereq_,module,exports){ 'use strict' exports.uniforms = runtimeUniforms @@ -34654,7 +35049,7 @@ function runtimeAttributes(gl, program) { return result } -},{}],153:[function(_dereq_,module,exports){ +},{}],172:[function(_dereq_,module,exports){ 'use strict' exports.shader = getShaderReference @@ -34792,7 +35187,9 @@ function createProgram(gl, vref, fref, attribs, locations) { return getCache(gl).getProgram(vref, fref, attribs, locations) } -},{"./GLError":148,"gl-format-compiler-error":114,"weakmap-shim":353}],154:[function(_dereq_,module,exports){ +},{"./GLError":167,"gl-format-compiler-error":117,"weakmap-shim":374}],173:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],174:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -34809,7 +35206,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":147,"glslify":245}],155:[function(_dereq_,module,exports){ +},{"gl-shader":166,"glslify":173}],175:[function(_dereq_,module,exports){ 'use strict' var createBuffer = _dereq_('gl-buffer') @@ -35005,7 +35402,7 @@ function createSpikes(gl, options) { return spikes } -},{"./shaders/index":154,"gl-buffer":105,"gl-vao":164}],156:[function(_dereq_,module,exports){ +},{"./shaders/index":174,"gl-buffer":106,"gl-vao":186}],176:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["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 color, position;\nattribute vec2 uv;\n\nuniform float vectorScale, tubeScale;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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"]) @@ -35033,7 +35430,9 @@ exports.pickShader = { ] } -},{"glslify":245}],157:[function(_dereq_,module,exports){ +},{"glslify":177}],177:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],178:[function(_dereq_,module,exports){ "use strict"; var vec3 = _dereq_('gl-vec3'); @@ -35593,7 +35992,7 @@ module.exports.createTubeMesh = function(gl, params) { }); } -},{"./lib/shaders":156,"gl-cone3d":106,"gl-vec3":183,"gl-vec4":219}],158:[function(_dereq_,module,exports){ +},{"./lib/shaders":176,"gl-cone3d":107,"gl-vec3":205,"gl-vec4":241}],179:[function(_dereq_,module,exports){ var createShader = _dereq_('gl-shader') var glslify = _dereq_('glslify') @@ -35643,7 +36042,9 @@ exports.createPickContourShader = function (gl) { return shader } -},{"gl-shader":147,"glslify":245}],159:[function(_dereq_,module,exports){ +},{"gl-shader":166,"glslify":180}],180:[function(_dereq_,module,exports){ +arguments[4][104][0].apply(exports,arguments) +},{"dup":104}],181:[function(_dereq_,module,exports){ 'use strict' module.exports = createSurfacePlot @@ -35713,19 +36114,6 @@ function SurfacePickResult (position, index, uv, level, dataCoordinate) { var N_COLORS = 256 -function genColormap (name, opacityscale) { - var x = pack([colormap({ - colormap: name, - nshades: N_COLORS, - format: 'rgba' - }).map(function (c, i) { - var a = opacityscale ? getOpacityFromScale(i / 255.0, opacityscale) : 1 - return [c[0], c[1], c[2], 255 * a] - })]) - ops.divseq(x, 255.0) - return x -} - function SurfacePlot ( gl, shape, @@ -35811,7 +36199,6 @@ function SurfacePlot ( this.pixelRatio = 1 this.opacity = 1.0 - this.opacityscale = false this.lightPosition = [10, 10000, 0] this.ambientLight = 0.8 @@ -35826,26 +36213,30 @@ function SurfacePlot ( var proto = SurfacePlot.prototype +proto.genColormap = function (name, opacityscale) { + var hasAlpha = false + + var x = pack([colormap({ + colormap: name, + nshades: N_COLORS, + format: 'rgba' + }).map(function (c, i) { + var a = opacityscale ? getOpacityFromScale(i / 255.0, opacityscale) : c[3] + if(a < 1) hasAlpha = true + return [c[0], c[1], c[2], 255 * a] + })]) + ops.divseq(x, 255.0) + + this.hasAlphaScale = hasAlpha + return x +} + proto.isTransparent = function () { - return this.opacity < 1 || this.opacityscale + return this.opacity < 1 || this.hasAlphaScale } proto.isOpaque = function () { - if (this.opacityscale) { - return false - } - if (this.opacity < 1) { - return false - } - if (this.opacity >= 1) { - return true - } - for (var i = 0; i < 3; ++i) { - if (this._contourCounts[i].length > 0) { - return true - } - } - return false + return !this.isTransparent() } proto.pickSlots = 1 @@ -36446,6 +36837,9 @@ proto.update = function (params) { if ('vertexColor' in params) { this.vertexColor = params.vertexColor ? 1 : 0; } + if ('colormap' in params) { + this._colorMap.setPixels(this.genColormap(params.colormap, this.opacityscale)) + } var field = params.field || (params.coords && params.coords[2]) || null var levelsChanged = false @@ -36815,10 +37209,6 @@ proto.update = function (params) { this._contourBuffer.update(floatBuffer) pool.freeFloat(floatBuffer) } - - if (params.colormap) { - this._colorMap.setPixels(genColormap(params.colormap, this.opacityscale)) - } } proto.dispose = function () { @@ -37036,7 +37426,7 @@ function createSurfacePlot (params) { return surface } -},{"./lib/shaders":158,"binary-search-bounds":36,"bit-twiddle":37,"colormap":68,"gl-buffer":105,"gl-mat4/invert":123,"gl-mat4/multiply":125,"gl-texture2d":160,"gl-vao":164,"ndarray":280,"ndarray-gradient":273,"ndarray-ops":275,"ndarray-pack":276,"surface-nets":338,"typedarray-pool":345}],160:[function(_dereq_,module,exports){ +},{"./lib/shaders":179,"binary-search-bounds":36,"bit-twiddle":37,"colormap":68,"gl-buffer":106,"gl-mat4/invert":137,"gl-mat4/multiply":139,"gl-texture2d":182,"gl-vao":186,"ndarray":301,"ndarray-gradient":294,"ndarray-ops":296,"ndarray-pack":297,"surface-nets":359,"typedarray-pool":366}],182:[function(_dereq_,module,exports){ 'use strict' var ndarray = _dereq_('ndarray') @@ -37599,7 +37989,7 @@ function createTexture2D(gl) { throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":280,"ndarray-ops":275,"typedarray-pool":345}],161:[function(_dereq_,module,exports){ +},{"ndarray":301,"ndarray-ops":296,"typedarray-pool":366}],183:[function(_dereq_,module,exports){ "use strict" function doBind(gl, elements, attributes) { @@ -37654,7 +38044,7 @@ function doBind(gl, elements, attributes) { } module.exports = doBind -},{}],162:[function(_dereq_,module,exports){ +},{}],184:[function(_dereq_,module,exports){ "use strict" var bindAttribs = _dereq_("./do-bind.js") @@ -37694,7 +38084,7 @@ function createVAOEmulated(gl) { } module.exports = createVAOEmulated -},{"./do-bind.js":161}],163:[function(_dereq_,module,exports){ +},{"./do-bind.js":183}],185:[function(_dereq_,module,exports){ "use strict" var bindAttribs = _dereq_("./do-bind.js") @@ -37782,7 +38172,7 @@ function createVAONative(gl, ext) { } module.exports = createVAONative -},{"./do-bind.js":161}],164:[function(_dereq_,module,exports){ +},{"./do-bind.js":183}],186:[function(_dereq_,module,exports){ "use strict" var createVAONative = _dereq_("./lib/vao-native.js") @@ -37811,7 +38201,7 @@ function createVAO(gl, attributes, elements, elementsType) { module.exports = createVAO -},{"./lib/vao-emulated.js":162,"./lib/vao-native.js":163}],165:[function(_dereq_,module,exports){ +},{"./lib/vao-emulated.js":184,"./lib/vao-native.js":185}],187:[function(_dereq_,module,exports){ module.exports = add; /** @@ -37828,7 +38218,7 @@ function add(out, a, b) { out[2] = a[2] + b[2] return out } -},{}],166:[function(_dereq_,module,exports){ +},{}],188:[function(_dereq_,module,exports){ module.exports = angle var fromValues = _dereq_('./fromValues') @@ -37857,7 +38247,7 @@ function angle(a, b) { } } -},{"./dot":176,"./fromValues":182,"./normalize":193}],167:[function(_dereq_,module,exports){ +},{"./dot":198,"./fromValues":204,"./normalize":215}],189:[function(_dereq_,module,exports){ module.exports = ceil /** @@ -37874,7 +38264,7 @@ function ceil(out, a) { return out } -},{}],168:[function(_dereq_,module,exports){ +},{}],190:[function(_dereq_,module,exports){ module.exports = clone; /** @@ -37890,7 +38280,7 @@ function clone(a) { out[2] = a[2] return out } -},{}],169:[function(_dereq_,module,exports){ +},{}],191:[function(_dereq_,module,exports){ module.exports = copy; /** @@ -37906,7 +38296,7 @@ function copy(out, a) { out[2] = a[2] return out } -},{}],170:[function(_dereq_,module,exports){ +},{}],192:[function(_dereq_,module,exports){ module.exports = create; /** @@ -37921,7 +38311,7 @@ function create() { out[2] = 0 return out } -},{}],171:[function(_dereq_,module,exports){ +},{}],193:[function(_dereq_,module,exports){ module.exports = cross; /** @@ -37941,10 +38331,10 @@ function cross(out, a, b) { out[2] = ax * by - ay * bx return out } -},{}],172:[function(_dereq_,module,exports){ +},{}],194:[function(_dereq_,module,exports){ module.exports = _dereq_('./distance') -},{"./distance":173}],173:[function(_dereq_,module,exports){ +},{"./distance":195}],195:[function(_dereq_,module,exports){ module.exports = distance; /** @@ -37960,10 +38350,10 @@ function distance(a, b) { z = b[2] - a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],174:[function(_dereq_,module,exports){ +},{}],196:[function(_dereq_,module,exports){ module.exports = _dereq_('./divide') -},{"./divide":175}],175:[function(_dereq_,module,exports){ +},{"./divide":197}],197:[function(_dereq_,module,exports){ module.exports = divide; /** @@ -37980,7 +38370,7 @@ function divide(out, a, b) { out[2] = a[2] / b[2] return out } -},{}],176:[function(_dereq_,module,exports){ +},{}],198:[function(_dereq_,module,exports){ module.exports = dot; /** @@ -37993,10 +38383,10 @@ module.exports = dot; function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] } -},{}],177:[function(_dereq_,module,exports){ +},{}],199:[function(_dereq_,module,exports){ module.exports = 0.000001 -},{}],178:[function(_dereq_,module,exports){ +},{}],200:[function(_dereq_,module,exports){ module.exports = equals var EPSILON = _dereq_('./epsilon') @@ -38020,7 +38410,7 @@ function equals(a, b) { Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))) } -},{"./epsilon":177}],179:[function(_dereq_,module,exports){ +},{"./epsilon":199}],201:[function(_dereq_,module,exports){ module.exports = exactEquals /** @@ -38034,7 +38424,7 @@ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] } -},{}],180:[function(_dereq_,module,exports){ +},{}],202:[function(_dereq_,module,exports){ module.exports = floor /** @@ -38051,7 +38441,7 @@ function floor(out, a) { return out } -},{}],181:[function(_dereq_,module,exports){ +},{}],203:[function(_dereq_,module,exports){ module.exports = forEach; var vec = _dereq_('./create')() @@ -38096,7 +38486,7 @@ function forEach(a, stride, offset, count, fn, arg) { return a } -},{"./create":170}],182:[function(_dereq_,module,exports){ +},{"./create":192}],204:[function(_dereq_,module,exports){ module.exports = fromValues; /** @@ -38114,7 +38504,7 @@ function fromValues(x, y, z) { out[2] = z return out } -},{}],183:[function(_dereq_,module,exports){ +},{}],205:[function(_dereq_,module,exports){ module.exports = { EPSILON: _dereq_('./epsilon') , create: _dereq_('./create') @@ -38163,7 +38553,7 @@ module.exports = { , forEach: _dereq_('./forEach') } -},{"./add":165,"./angle":166,"./ceil":167,"./clone":168,"./copy":169,"./create":170,"./cross":171,"./dist":172,"./distance":173,"./div":174,"./divide":175,"./dot":176,"./epsilon":177,"./equals":178,"./exactEquals":179,"./floor":180,"./forEach":181,"./fromValues":182,"./inverse":184,"./len":185,"./length":186,"./lerp":187,"./max":188,"./min":189,"./mul":190,"./multiply":191,"./negate":192,"./normalize":193,"./random":194,"./rotateX":195,"./rotateY":196,"./rotateZ":197,"./round":198,"./scale":199,"./scaleAndAdd":200,"./set":201,"./sqrDist":202,"./sqrLen":203,"./squaredDistance":204,"./squaredLength":205,"./sub":206,"./subtract":207,"./transformMat3":208,"./transformMat4":209,"./transformQuat":210}],184:[function(_dereq_,module,exports){ +},{"./add":187,"./angle":188,"./ceil":189,"./clone":190,"./copy":191,"./create":192,"./cross":193,"./dist":194,"./distance":195,"./div":196,"./divide":197,"./dot":198,"./epsilon":199,"./equals":200,"./exactEquals":201,"./floor":202,"./forEach":203,"./fromValues":204,"./inverse":206,"./len":207,"./length":208,"./lerp":209,"./max":210,"./min":211,"./mul":212,"./multiply":213,"./negate":214,"./normalize":215,"./random":216,"./rotateX":217,"./rotateY":218,"./rotateZ":219,"./round":220,"./scale":221,"./scaleAndAdd":222,"./set":223,"./sqrDist":224,"./sqrLen":225,"./squaredDistance":226,"./squaredLength":227,"./sub":228,"./subtract":229,"./transformMat3":230,"./transformMat4":231,"./transformQuat":232}],206:[function(_dereq_,module,exports){ module.exports = inverse; /** @@ -38179,10 +38569,10 @@ function inverse(out, a) { out[2] = 1.0 / a[2] return out } -},{}],185:[function(_dereq_,module,exports){ +},{}],207:[function(_dereq_,module,exports){ module.exports = _dereq_('./length') -},{"./length":186}],186:[function(_dereq_,module,exports){ +},{"./length":208}],208:[function(_dereq_,module,exports){ module.exports = length; /** @@ -38197,7 +38587,7 @@ function length(a) { z = a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],187:[function(_dereq_,module,exports){ +},{}],209:[function(_dereq_,module,exports){ module.exports = lerp; /** @@ -38218,7 +38608,7 @@ function lerp(out, a, b, t) { out[2] = az + t * (b[2] - az) return out } -},{}],188:[function(_dereq_,module,exports){ +},{}],210:[function(_dereq_,module,exports){ module.exports = max; /** @@ -38235,7 +38625,7 @@ function max(out, a, b) { out[2] = Math.max(a[2], b[2]) return out } -},{}],189:[function(_dereq_,module,exports){ +},{}],211:[function(_dereq_,module,exports){ module.exports = min; /** @@ -38252,10 +38642,10 @@ function min(out, a, b) { out[2] = Math.min(a[2], b[2]) return out } -},{}],190:[function(_dereq_,module,exports){ +},{}],212:[function(_dereq_,module,exports){ module.exports = _dereq_('./multiply') -},{"./multiply":191}],191:[function(_dereq_,module,exports){ +},{"./multiply":213}],213:[function(_dereq_,module,exports){ module.exports = multiply; /** @@ -38272,7 +38662,7 @@ function multiply(out, a, b) { out[2] = a[2] * b[2] return out } -},{}],192:[function(_dereq_,module,exports){ +},{}],214:[function(_dereq_,module,exports){ module.exports = negate; /** @@ -38288,7 +38678,7 @@ function negate(out, a) { out[2] = -a[2] return out } -},{}],193:[function(_dereq_,module,exports){ +},{}],215:[function(_dereq_,module,exports){ module.exports = normalize; /** @@ -38312,7 +38702,7 @@ function normalize(out, a) { } return out } -},{}],194:[function(_dereq_,module,exports){ +},{}],216:[function(_dereq_,module,exports){ module.exports = random; /** @@ -38334,7 +38724,7 @@ function random(out, scale) { out[2] = z * scale return out } -},{}],195:[function(_dereq_,module,exports){ +},{}],217:[function(_dereq_,module,exports){ module.exports = rotateX; /** @@ -38364,7 +38754,7 @@ function rotateX(out, a, b, c){ return out } -},{}],196:[function(_dereq_,module,exports){ +},{}],218:[function(_dereq_,module,exports){ module.exports = rotateY; /** @@ -38394,7 +38784,7 @@ function rotateY(out, a, b, c){ return out } -},{}],197:[function(_dereq_,module,exports){ +},{}],219:[function(_dereq_,module,exports){ module.exports = rotateZ; /** @@ -38424,7 +38814,7 @@ function rotateZ(out, a, b, c){ return out } -},{}],198:[function(_dereq_,module,exports){ +},{}],220:[function(_dereq_,module,exports){ module.exports = round /** @@ -38441,7 +38831,7 @@ function round(out, a) { return out } -},{}],199:[function(_dereq_,module,exports){ +},{}],221:[function(_dereq_,module,exports){ module.exports = scale; /** @@ -38458,7 +38848,7 @@ function scale(out, a, b) { out[2] = a[2] * b return out } -},{}],200:[function(_dereq_,module,exports){ +},{}],222:[function(_dereq_,module,exports){ module.exports = scaleAndAdd; /** @@ -38476,7 +38866,7 @@ function scaleAndAdd(out, a, b, scale) { out[2] = a[2] + (b[2] * scale) return out } -},{}],201:[function(_dereq_,module,exports){ +},{}],223:[function(_dereq_,module,exports){ module.exports = set; /** @@ -38494,13 +38884,13 @@ function set(out, x, y, z) { out[2] = z return out } -},{}],202:[function(_dereq_,module,exports){ +},{}],224:[function(_dereq_,module,exports){ module.exports = _dereq_('./squaredDistance') -},{"./squaredDistance":204}],203:[function(_dereq_,module,exports){ +},{"./squaredDistance":226}],225:[function(_dereq_,module,exports){ module.exports = _dereq_('./squaredLength') -},{"./squaredLength":205}],204:[function(_dereq_,module,exports){ +},{"./squaredLength":227}],226:[function(_dereq_,module,exports){ module.exports = squaredDistance; /** @@ -38516,7 +38906,7 @@ function squaredDistance(a, b) { z = b[2] - a[2] return x*x + y*y + z*z } -},{}],205:[function(_dereq_,module,exports){ +},{}],227:[function(_dereq_,module,exports){ module.exports = squaredLength; /** @@ -38531,10 +38921,10 @@ function squaredLength(a) { z = a[2] return x*x + y*y + z*z } -},{}],206:[function(_dereq_,module,exports){ +},{}],228:[function(_dereq_,module,exports){ module.exports = _dereq_('./subtract') -},{"./subtract":207}],207:[function(_dereq_,module,exports){ +},{"./subtract":229}],229:[function(_dereq_,module,exports){ module.exports = subtract; /** @@ -38551,7 +38941,7 @@ function subtract(out, a, b) { out[2] = a[2] - b[2] return out } -},{}],208:[function(_dereq_,module,exports){ +},{}],230:[function(_dereq_,module,exports){ module.exports = transformMat3; /** @@ -38569,7 +38959,7 @@ function transformMat3(out, a, m) { out[2] = x * m[2] + y * m[5] + z * m[8] return out } -},{}],209:[function(_dereq_,module,exports){ +},{}],231:[function(_dereq_,module,exports){ module.exports = transformMat4; /** @@ -38590,7 +38980,7 @@ function transformMat4(out, a, m) { out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w return out } -},{}],210:[function(_dereq_,module,exports){ +},{}],232:[function(_dereq_,module,exports){ module.exports = transformQuat; /** @@ -38619,7 +39009,7 @@ function transformQuat(out, a, q) { out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx return out } -},{}],211:[function(_dereq_,module,exports){ +},{}],233:[function(_dereq_,module,exports){ module.exports = add /** @@ -38638,7 +39028,7 @@ function add (out, a, b) { return out } -},{}],212:[function(_dereq_,module,exports){ +},{}],234:[function(_dereq_,module,exports){ module.exports = clone /** @@ -38656,7 +39046,7 @@ function clone (a) { return out } -},{}],213:[function(_dereq_,module,exports){ +},{}],235:[function(_dereq_,module,exports){ module.exports = copy /** @@ -38674,7 +39064,7 @@ function copy (out, a) { return out } -},{}],214:[function(_dereq_,module,exports){ +},{}],236:[function(_dereq_,module,exports){ module.exports = create /** @@ -38691,7 +39081,7 @@ function create () { return out } -},{}],215:[function(_dereq_,module,exports){ +},{}],237:[function(_dereq_,module,exports){ module.exports = distance /** @@ -38709,7 +39099,7 @@ function distance (a, b) { return Math.sqrt(x * x + y * y + z * z + w * w) } -},{}],216:[function(_dereq_,module,exports){ +},{}],238:[function(_dereq_,module,exports){ module.exports = divide /** @@ -38728,7 +39118,7 @@ function divide (out, a, b) { return out } -},{}],217:[function(_dereq_,module,exports){ +},{}],239:[function(_dereq_,module,exports){ module.exports = dot /** @@ -38742,7 +39132,7 @@ function dot (a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3] } -},{}],218:[function(_dereq_,module,exports){ +},{}],240:[function(_dereq_,module,exports){ module.exports = fromValues /** @@ -38763,7 +39153,7 @@ function fromValues (x, y, z, w) { return out } -},{}],219:[function(_dereq_,module,exports){ +},{}],241:[function(_dereq_,module,exports){ module.exports = { create: _dereq_('./create'), clone: _dereq_('./clone'), @@ -38792,7 +39182,7 @@ module.exports = { transformQuat: _dereq_('./transformQuat') } -},{"./add":211,"./clone":212,"./copy":213,"./create":214,"./distance":215,"./divide":216,"./dot":217,"./fromValues":218,"./inverse":220,"./length":221,"./lerp":222,"./max":223,"./min":224,"./multiply":225,"./negate":226,"./normalize":227,"./random":228,"./scale":229,"./scaleAndAdd":230,"./set":231,"./squaredDistance":232,"./squaredLength":233,"./subtract":234,"./transformMat4":235,"./transformQuat":236}],220:[function(_dereq_,module,exports){ +},{"./add":233,"./clone":234,"./copy":235,"./create":236,"./distance":237,"./divide":238,"./dot":239,"./fromValues":240,"./inverse":242,"./length":243,"./lerp":244,"./max":245,"./min":246,"./multiply":247,"./negate":248,"./normalize":249,"./random":250,"./scale":251,"./scaleAndAdd":252,"./set":253,"./squaredDistance":254,"./squaredLength":255,"./subtract":256,"./transformMat4":257,"./transformQuat":258}],242:[function(_dereq_,module,exports){ module.exports = inverse /** @@ -38810,7 +39200,7 @@ function inverse (out, a) { return out } -},{}],221:[function(_dereq_,module,exports){ +},{}],243:[function(_dereq_,module,exports){ module.exports = length /** @@ -38827,7 +39217,7 @@ function length (a) { return Math.sqrt(x * x + y * y + z * z + w * w) } -},{}],222:[function(_dereq_,module,exports){ +},{}],244:[function(_dereq_,module,exports){ module.exports = lerp /** @@ -38851,7 +39241,7 @@ function lerp (out, a, b, t) { return out } -},{}],223:[function(_dereq_,module,exports){ +},{}],245:[function(_dereq_,module,exports){ module.exports = max /** @@ -38870,7 +39260,7 @@ function max (out, a, b) { return out } -},{}],224:[function(_dereq_,module,exports){ +},{}],246:[function(_dereq_,module,exports){ module.exports = min /** @@ -38889,7 +39279,7 @@ function min (out, a, b) { return out } -},{}],225:[function(_dereq_,module,exports){ +},{}],247:[function(_dereq_,module,exports){ module.exports = multiply /** @@ -38908,7 +39298,7 @@ function multiply (out, a, b) { return out } -},{}],226:[function(_dereq_,module,exports){ +},{}],248:[function(_dereq_,module,exports){ module.exports = negate /** @@ -38926,7 +39316,7 @@ function negate (out, a) { return out } -},{}],227:[function(_dereq_,module,exports){ +},{}],249:[function(_dereq_,module,exports){ module.exports = normalize /** @@ -38952,7 +39342,7 @@ function normalize (out, a) { return out } -},{}],228:[function(_dereq_,module,exports){ +},{}],250:[function(_dereq_,module,exports){ var vecNormalize = _dereq_('./normalize') var vecScale = _dereq_('./scale') @@ -38978,7 +39368,7 @@ function random (out, scale) { return out } -},{"./normalize":227,"./scale":229}],229:[function(_dereq_,module,exports){ +},{"./normalize":249,"./scale":251}],251:[function(_dereq_,module,exports){ module.exports = scale /** @@ -38997,7 +39387,7 @@ function scale (out, a, b) { return out } -},{}],230:[function(_dereq_,module,exports){ +},{}],252:[function(_dereq_,module,exports){ module.exports = scaleAndAdd /** @@ -39017,7 +39407,7 @@ function scaleAndAdd (out, a, b, scale) { return out } -},{}],231:[function(_dereq_,module,exports){ +},{}],253:[function(_dereq_,module,exports){ module.exports = set /** @@ -39038,7 +39428,7 @@ function set (out, x, y, z, w) { return out } -},{}],232:[function(_dereq_,module,exports){ +},{}],254:[function(_dereq_,module,exports){ module.exports = squaredDistance /** @@ -39056,7 +39446,7 @@ function squaredDistance (a, b) { return x * x + y * y + z * z + w * w } -},{}],233:[function(_dereq_,module,exports){ +},{}],255:[function(_dereq_,module,exports){ module.exports = squaredLength /** @@ -39073,7 +39463,7 @@ function squaredLength (a) { return x * x + y * y + z * z + w * w } -},{}],234:[function(_dereq_,module,exports){ +},{}],256:[function(_dereq_,module,exports){ module.exports = subtract /** @@ -39092,7 +39482,7 @@ function subtract (out, a, b) { return out } -},{}],235:[function(_dereq_,module,exports){ +},{}],257:[function(_dereq_,module,exports){ module.exports = transformMat4 /** @@ -39112,7 +39502,7 @@ function transformMat4 (out, a, m) { return out } -},{}],236:[function(_dereq_,module,exports){ +},{}],258:[function(_dereq_,module,exports){ module.exports = transformQuat /** @@ -39141,7 +39531,7 @@ function transformQuat (out, a, q) { return out } -},{}],237:[function(_dereq_,module,exports){ +},{}],259:[function(_dereq_,module,exports){ var tokenize = _dereq_('glsl-tokenizer') var atob = _dereq_('atob-lite') @@ -39166,7 +39556,7 @@ function getName(src) { } } -},{"atob-lite":17,"glsl-tokenizer":244}],238:[function(_dereq_,module,exports){ +},{"atob-lite":17,"glsl-tokenizer":266}],260:[function(_dereq_,module,exports){ module.exports = tokenize var literals100 = _dereq_('./lib/literals') @@ -39543,7 +39933,7 @@ function tokenize(opt) { } } -},{"./lib/builtins":240,"./lib/builtins-300es":239,"./lib/literals":242,"./lib/literals-300es":241,"./lib/operators":243}],239:[function(_dereq_,module,exports){ +},{"./lib/builtins":262,"./lib/builtins-300es":261,"./lib/literals":264,"./lib/literals-300es":263,"./lib/operators":265}],261:[function(_dereq_,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = _dereq_('./builtins') @@ -39614,7 +40004,7 @@ module.exports = v100.concat([ , 'textureProjGradOffset' ]) -},{"./builtins":240}],240:[function(_dereq_,module,exports){ +},{"./builtins":262}],262:[function(_dereq_,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -39766,7 +40156,7 @@ module.exports = [ , 'textureCubeGradEXT' ] -},{}],241:[function(_dereq_,module,exports){ +},{}],263:[function(_dereq_,module,exports){ var v100 = _dereq_('./literals') module.exports = v100.slice().concat([ @@ -39855,7 +40245,7 @@ module.exports = v100.slice().concat([ , 'usampler2DMSArray' ]) -},{"./literals":242}],242:[function(_dereq_,module,exports){ +},{"./literals":264}],264:[function(_dereq_,module,exports){ module.exports = [ // current 'precision' @@ -39951,7 +40341,7 @@ module.exports = [ , 'using' ] -},{}],243:[function(_dereq_,module,exports){ +},{}],265:[function(_dereq_,module,exports){ module.exports = [ '<<=' , '>>=' @@ -40000,7 +40390,7 @@ module.exports = [ , '}' ] -},{}],244:[function(_dereq_,module,exports){ +},{}],266:[function(_dereq_,module,exports){ var tokenize = _dereq_('./index') module.exports = tokenizeString @@ -40015,20 +40405,8 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":238}],245:[function(_dereq_,module,exports){ -module.exports = function(strings) { - if (typeof strings === 'string') strings = [strings] - var exprs = [].slice.call(arguments,1) - var parts = [] - for (var i = 0; i < strings.length-1; i++) { - parts.push(strings[i], exprs[i] || '') - } - parts.push(strings[i]) - return parts.join('') -} - -},{}],246:[function(_dereq_,module,exports){ -(function (global){ +},{"./index":260}],267:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -40043,8 +40421,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":254}],247:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":275}],268:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -40070,7 +40448,7 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":254}],248:[function(_dereq_,module,exports){ +},{"is-browser":275}],269:[function(_dereq_,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -40156,7 +40534,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],249:[function(_dereq_,module,exports){ +},{}],270:[function(_dereq_,module,exports){ "use strict" //High level idea: @@ -40603,7 +40981,7 @@ function incrementalConvexHull(points, randomSearch) { //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":318,"simplicial-complex":328}],250:[function(_dereq_,module,exports){ +},{"robust-orientation":339,"simplicial-complex":349}],271:[function(_dereq_,module,exports){ "use strict" var bounds = _dereq_("binary-search-bounds") @@ -40970,9 +41348,9 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":251}],251:[function(_dereq_,module,exports){ +},{"binary-search-bounds":272}],272:[function(_dereq_,module,exports){ arguments[4][93][0].apply(exports,arguments) -},{"dup":93}],252:[function(_dereq_,module,exports){ +},{"dup":93}],273:[function(_dereq_,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -40984,7 +41362,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],253:[function(_dereq_,module,exports){ +},{}],274:[function(_dereq_,module,exports){ "use strict" function iota(n) { @@ -40996,9 +41374,9 @@ function iota(n) { } module.exports = iota -},{}],254:[function(_dereq_,module,exports){ +},{}],275:[function(_dereq_,module,exports){ module.exports = true; -},{}],255:[function(_dereq_,module,exports){ +},{}],276:[function(_dereq_,module,exports){ /*! * Determine if an object is a Buffer * @@ -41021,7 +41399,7 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],256:[function(_dereq_,module,exports){ +},{}],277:[function(_dereq_,module,exports){ 'use strict' module.exports = isMobile @@ -41058,7 +41436,7 @@ function isMobile (opts) { return result } -},{}],257:[function(_dereq_,module,exports){ +},{}],278:[function(_dereq_,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -41067,7 +41445,7 @@ module.exports = function (x) { return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],258:[function(_dereq_,module,exports){ +},{}],279:[function(_dereq_,module,exports){ 'use strict'; /** @@ -41104,12 +41482,12 @@ module.exports = function(str){ return true; } -},{}],259:[function(_dereq_,module,exports){ +},{}],280:[function(_dereq_,module,exports){ function lerp(v0, v1, t) { return v0*(1-t)+v1*t } module.exports = lerp -},{}],260:[function(_dereq_,module,exports){ +},{}],281:[function(_dereq_,module,exports){ 'use strict' module.exports = createTable @@ -41175,7 +41553,7 @@ function createTable(dimension) { } return result } -},{"convex-hull":72}],261:[function(_dereq_,module,exports){ +},{"convex-hull":72}],282:[function(_dereq_,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -41355,7 +41733,7 @@ function combine(out, a, b, scale1, scale2) { out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":262,"gl-mat4/clone":117,"gl-mat4/create":118,"gl-mat4/determinant":119,"gl-mat4/invert":123,"gl-mat4/transpose":134,"gl-vec3/cross":171,"gl-vec3/dot":176,"gl-vec3/length":186,"gl-vec3/normalize":193}],262:[function(_dereq_,module,exports){ +},{"./normalize":283,"gl-mat4/clone":122,"gl-mat4/create":124,"gl-mat4/determinant":125,"gl-mat4/invert":137,"gl-mat4/transpose":150,"gl-vec3/cross":193,"gl-vec3/dot":198,"gl-vec3/length":208,"gl-vec3/normalize":215}],283:[function(_dereq_,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -41366,7 +41744,7 @@ module.exports = function normalize(out, mat) { out[i] = mat[i] * scale return true } -},{}],263:[function(_dereq_,module,exports){ +},{}],284:[function(_dereq_,module,exports){ var lerp = _dereq_('gl-vec3/lerp') var recompose = _dereq_('mat4-recompose') @@ -41419,7 +41797,7 @@ function vec3(n) { function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":119,"gl-vec3/lerp":187,"mat4-decompose":261,"mat4-recompose":264,"quat-slerp":305}],264:[function(_dereq_,module,exports){ +},{"gl-mat4/determinant":125,"gl-vec3/lerp":209,"mat4-decompose":282,"mat4-recompose":285,"quat-slerp":326}],285:[function(_dereq_,module,exports){ /* Input: translation ; a 3 component vector scale ; a 3 component vector @@ -41480,7 +41858,7 @@ module.exports = function recomposeMat4(matrix, translation, scale, skew, perspe mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":118,"gl-mat4/fromRotationTranslation":121,"gl-mat4/identity":122,"gl-mat4/multiply":125,"gl-mat4/scale":132,"gl-mat4/translate":133}],265:[function(_dereq_,module,exports){ +},{"gl-mat4/create":124,"gl-mat4/fromRotationTranslation":128,"gl-mat4/identity":135,"gl-mat4/multiply":139,"gl-mat4/scale":147,"gl-mat4/translate":149}],286:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -41680,9 +42058,9 @@ function createMatrixCameraController(options) { return new MatrixCameraController(matrix) } -},{"binary-search-bounds":266,"gl-mat4/invert":123,"gl-mat4/lookAt":124,"gl-mat4/rotateX":129,"gl-mat4/rotateY":130,"gl-mat4/rotateZ":131,"gl-mat4/scale":132,"gl-mat4/translate":133,"gl-vec3/normalize":193,"mat4-interpolate":263}],266:[function(_dereq_,module,exports){ +},{"binary-search-bounds":287,"gl-mat4/invert":137,"gl-mat4/lookAt":138,"gl-mat4/rotateX":144,"gl-mat4/rotateY":145,"gl-mat4/rotateZ":146,"gl-mat4/scale":147,"gl-mat4/translate":149,"gl-vec3/normalize":215,"mat4-interpolate":284}],287:[function(_dereq_,module,exports){ arguments[4][93][0].apply(exports,arguments) -},{"dup":93}],267:[function(_dereq_,module,exports){ +},{"dup":93}],288:[function(_dereq_,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -41764,7 +42142,7 @@ function monotoneConvexHull2D(points) { //Return result return result } -},{"robust-orientation":318}],268:[function(_dereq_,module,exports){ +},{"robust-orientation":339}],289:[function(_dereq_,module,exports){ 'use strict' module.exports = mouseListen @@ -41971,7 +42349,7 @@ function mouseListen (element, callback) { return result } -},{"mouse-event":270}],269:[function(_dereq_,module,exports){ +},{"mouse-event":291}],290:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -41998,7 +42376,7 @@ function getBoundingClientOffset (element) { } } -},{}],270:[function(_dereq_,module,exports){ +},{}],291:[function(_dereq_,module,exports){ 'use strict' function mouseButtons(ev) { @@ -42060,7 +42438,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],271:[function(_dereq_,module,exports){ +},{}],292:[function(_dereq_,module,exports){ 'use strict' var toPX = _dereq_('to-px') @@ -42102,7 +42480,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":340}],272:[function(_dereq_,module,exports){ +},{"to-px":361}],293:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -42518,7 +42896,7 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":345}],273:[function(_dereq_,module,exports){ +},{"typedarray-pool":366}],294:[function(_dereq_,module,exports){ 'use strict' module.exports = gradient @@ -42816,7 +43194,7 @@ function gradient(out, inp, bc) { var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":77,"dup":87}],274:[function(_dereq_,module,exports){ +},{"cwise-compiler":77,"dup":87}],295:[function(_dereq_,module,exports){ "use strict" function interp1d(arr, x) { @@ -42927,7 +43305,7 @@ module.exports.d1 = interp1d module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],275:[function(_dereq_,module,exports){ +},{}],296:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("cwise-compiler") @@ -43390,7 +43768,7 @@ exports.equals = compile({ -},{"cwise-compiler":77}],276:[function(_dereq_,module,exports){ +},{"cwise-compiler":77}],297:[function(_dereq_,module,exports){ "use strict" var ndarray = _dereq_("ndarray") @@ -43413,10 +43791,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":277,"ndarray":280}],277:[function(_dereq_,module,exports){ +},{"./doConvert.js":298,"ndarray":301}],298:[function(_dereq_,module,exports){ module.exports=_dereq_('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":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":77}],278:[function(_dereq_,module,exports){ +},{"cwise-compiler":77}],299:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -44145,7 +44523,7 @@ function compileSort(order, dtype) { } module.exports = compileSort -},{"typedarray-pool":345}],279:[function(_dereq_,module,exports){ +},{"typedarray-pool":366}],300:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("./lib/compile_sort.js") @@ -44165,7 +44543,7 @@ function sort(array) { } module.exports = sort -},{"./lib/compile_sort.js":278}],280:[function(_dereq_,module,exports){ +},{"./lib/compile_sort.js":299}],301:[function(_dereq_,module,exports){ var iota = _dereq_("iota-array") var isBuffer = _dereq_("is-buffer") @@ -44516,7 +44894,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":253,"is-buffer":255}],281:[function(_dereq_,module,exports){ +},{"iota-array":274,"is-buffer":276}],302:[function(_dereq_,module,exports){ "use strict" var doubleBits = _dereq_("double-bits") @@ -44559,7 +44937,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":85}],282:[function(_dereq_,module,exports){ +},{"double-bits":85}],303:[function(_dereq_,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -44684,7 +45062,7 @@ exports.faceNormals = function(faces, positions, specifiedEpsilon) { -},{}],283:[function(_dereq_,module,exports){ +},{}],304:[function(_dereq_,module,exports){ 'use strict' module.exports = quatFromFrame @@ -44726,7 +45104,7 @@ function quatFromFrame( } return out } -},{}],284:[function(_dereq_,module,exports){ +},{}],305:[function(_dereq_,module,exports){ 'use strict' module.exports = createOrbitController @@ -45120,7 +45498,7 @@ function createOrbitController(options) { return result } -},{"./lib/quatFromFrame":283,"filtered-vector":92,"gl-mat4/fromQuat":120,"gl-mat4/invert":123,"gl-mat4/lookAt":124}],285:[function(_dereq_,module,exports){ +},{"./lib/quatFromFrame":304,"filtered-vector":92,"gl-mat4/fromQuat":126,"gl-mat4/invert":137,"gl-mat4/lookAt":138}],306:[function(_dereq_,module,exports){ /*! * pad-left * @@ -45136,7 +45514,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":311}],286:[function(_dereq_,module,exports){ +},{"repeat-string":332}],307:[function(_dereq_,module,exports){ module.exports = parse @@ -45195,7 +45573,7 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],287:[function(_dereq_,module,exports){ +},{}],308:[function(_dereq_,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -45206,7 +45584,7 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],288:[function(_dereq_,module,exports){ +},{}],309:[function(_dereq_,module,exports){ "use strict" module.exports = permutationSign @@ -45258,7 +45636,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":345}],289:[function(_dereq_,module,exports){ +},{"typedarray-pool":366}],310:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -45345,7 +45723,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":252,"typedarray-pool":345}],290:[function(_dereq_,module,exports){ +},{"invert-permutation":273,"typedarray-pool":366}],311:[function(_dereq_,module,exports){ "use strict" module.exports = planarDual @@ -45476,7 +45854,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":69}],291:[function(_dereq_,module,exports){ +},{"compare-angle":69}],312:[function(_dereq_,module,exports){ 'use strict' module.exports = trimLeaves @@ -45532,7 +45910,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":88}],292:[function(_dereq_,module,exports){ +},{"edges-to-adjacency-list":88}],313:[function(_dereq_,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -45737,9 +46115,9 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":291,"edges-to-adjacency-list":88,"planar-dual":290,"point-in-big-polygon":294,"robust-sum":323,"two-product":343,"uniq":347}],293:[function(_dereq_,module,exports){ +},{"./lib/trim-leaves":312,"edges-to-adjacency-list":88,"planar-dual":311,"point-in-big-polygon":315,"robust-sum":344,"two-product":364,"uniq":368}],314:[function(_dereq_,module,exports){ arguments[4][93][0].apply(exports,arguments) -},{"dup":93}],294:[function(_dereq_,module,exports){ +},{"dup":93}],315:[function(_dereq_,module,exports){ module.exports = preprocessPolygon var orient = _dereq_('robust-orientation')[3] @@ -45891,7 +46269,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":293,"interval-tree-1d":250,"robust-orientation":318,"slab-decomposition":335}],295:[function(_dereq_,module,exports){ +},{"binary-search-bounds":314,"interval-tree-1d":271,"robust-orientation":339,"slab-decomposition":356}],316:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -46019,7 +46397,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":296,"./lib/epsilon":297,"./lib/geojson":298,"./lib/intersecter":299,"./lib/segment-chainer":301,"./lib/segment-selector":302}],296:[function(_dereq_,module,exports){ +},{"./lib/build-log":317,"./lib/epsilon":318,"./lib/geojson":319,"./lib/intersecter":320,"./lib/segment-chainer":322,"./lib/segment-selector":323}],317:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -46134,7 +46512,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],297:[function(_dereq_,module,exports){ +},{}],318:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -46306,7 +46684,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],298:[function(_dereq_,module,exports){ +},{}],319:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -46496,7 +46874,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],299:[function(_dereq_,module,exports){ +},{}],320:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -47003,7 +47381,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":300}],300:[function(_dereq_,module,exports){ +},{"./linked-list":321}],321:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -47086,7 +47464,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],301:[function(_dereq_,module,exports){ +},{}],322:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -47340,7 +47718,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],302:[function(_dereq_,module,exports){ +},{}],323:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -47508,7 +47886,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],303:[function(_dereq_,module,exports){ +},{}],324:[function(_dereq_,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -47706,7 +48084,7 @@ function closestPoint2d(V0, V1, V2, point, result) { module.exports = closestPoint2d; -},{}],304:[function(_dereq_,module,exports){ +},{}],325:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -47892,9 +48270,9 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],305:[function(_dereq_,module,exports){ +},{}],326:[function(_dereq_,module,exports){ module.exports = _dereq_('gl-quat/slerp') -},{"gl-quat/slerp":141}],306:[function(_dereq_,module,exports){ +},{"gl-quat/slerp":159}],327:[function(_dereq_,module,exports){ 'use strict' var bnadd = _dereq_('big-rat/add') @@ -47910,7 +48288,7 @@ function add (a, b) { return r } -},{"big-rat/add":20}],307:[function(_dereq_,module,exports){ +},{"big-rat/add":20}],328:[function(_dereq_,module,exports){ 'use strict' module.exports = float2rat @@ -47925,7 +48303,7 @@ function float2rat(v) { return result } -},{"big-rat":23}],308:[function(_dereq_,module,exports){ +},{"big-rat":23}],329:[function(_dereq_,module,exports){ 'use strict' var rat = _dereq_('big-rat') @@ -47943,7 +48321,7 @@ function muls(a, x) { return r } -},{"big-rat":23,"big-rat/mul":32}],309:[function(_dereq_,module,exports){ +},{"big-rat":23,"big-rat/mul":32}],330:[function(_dereq_,module,exports){ 'use strict' var bnsub = _dereq_('big-rat/sub') @@ -47959,7 +48337,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":34}],310:[function(_dereq_,module,exports){ +},{"big-rat/sub":34}],331:[function(_dereq_,module,exports){ 'use strict' var compareCell = _dereq_('compare-cell') @@ -47992,7 +48370,7 @@ function reduceCellComplex(cells) { return cells } -},{"cell-orientation":55,"compare-cell":70,"compare-oriented-cell":71}],311:[function(_dereq_,module,exports){ +},{"cell-orientation":55,"compare-cell":70,"compare-oriented-cell":71}],332:[function(_dereq_,module,exports){ /*! * repeat-string * @@ -48064,8 +48442,8 @@ function repeat(str, num) { return res; } -},{}],312:[function(_dereq_,module,exports){ -(function (global){ +},{}],333:[function(_dereq_,module,exports){ +(function (global){(function (){ module.exports = global.performance && global.performance.now ? function now() { @@ -48074,8 +48452,8 @@ module.exports = return +new Date } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],313:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],334:[function(_dereq_,module,exports){ "use strict" module.exports = compressExpansion @@ -48110,7 +48488,7 @@ function compressExpansion(e) { e.length = top return e } -},{}],314:[function(_dereq_,module,exports){ +},{}],335:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -48214,7 +48592,7 @@ return robustDeterminant") } generateDispatch() -},{"robust-compress":313,"robust-scale":320,"robust-sum":323,"two-product":343}],315:[function(_dereq_,module,exports){ +},{"robust-compress":334,"robust-scale":341,"robust-sum":344,"two-product":364}],336:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -48229,7 +48607,7 @@ function robustDotProduct(a, b) { } return r } -},{"robust-sum":323,"two-product":343}],316:[function(_dereq_,module,exports){ +},{"robust-sum":344,"two-product":364}],337:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -48397,7 +48775,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":320,"robust-subtract":322,"robust-sum":323,"two-product":343}],317:[function(_dereq_,module,exports){ +},{"robust-scale":341,"robust-subtract":343,"robust-sum":344,"two-product":364}],338:[function(_dereq_,module,exports){ "use strict" var determinant = _dereq_("robust-determinant") @@ -48469,7 +48847,7 @@ function generateDispatch() { } generateDispatch() -},{"robust-determinant":314}],318:[function(_dereq_,module,exports){ +},{"robust-determinant":335}],339:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -48660,7 +49038,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":320,"robust-subtract":322,"robust-sum":323,"two-product":343}],319:[function(_dereq_,module,exports){ +},{"robust-scale":341,"robust-subtract":343,"robust-sum":344,"two-product":364}],340:[function(_dereq_,module,exports){ "use strict" var robustSum = _dereq_("robust-sum") @@ -48690,7 +49068,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":320,"robust-sum":323}],320:[function(_dereq_,module,exports){ +},{"robust-scale":341,"robust-sum":344}],341:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -48741,7 +49119,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":343,"two-sum":344}],321:[function(_dereq_,module,exports){ +},{"two-product":364,"two-sum":365}],342:[function(_dereq_,module,exports){ "use strict" module.exports = segmentsIntersect @@ -48789,7 +49167,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":318}],322:[function(_dereq_,module,exports){ +},{"robust-orientation":339}],343:[function(_dereq_,module,exports){ "use strict" module.exports = robustSubtract @@ -48946,7 +49324,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],323:[function(_dereq_,module,exports){ +},{}],344:[function(_dereq_,module,exports){ "use strict" module.exports = linearExpansionSum @@ -49103,7 +49481,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],324:[function(_dereq_,module,exports){ +},{}],345:[function(_dereq_,module,exports){ "use strict" module.exports = function signum(x) { @@ -49111,7 +49489,7 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],325:[function(_dereq_,module,exports){ +},{}],346:[function(_dereq_,module,exports){ 'use strict' module.exports = boundary @@ -49123,7 +49501,7 @@ function boundary(cells) { return reduce(bnd(cells)) } -},{"boundary-cells":39,"reduce-simplicial-complex":310}],326:[function(_dereq_,module,exports){ +},{"boundary-cells":39,"reduce-simplicial-complex":331}],347:[function(_dereq_,module,exports){ 'use strict' module.exports = extractContour @@ -49286,7 +49664,7 @@ function extractContour(cells, values, level, d) { vertexWeights: uweights } } -},{"./lib/codegen":327,"ndarray":280,"ndarray-sort":279,"typedarray-pool":345}],327:[function(_dereq_,module,exports){ +},{"./lib/codegen":348,"ndarray":301,"ndarray-sort":300,"typedarray-pool":366}],348:[function(_dereq_,module,exports){ 'use strict' module.exports = getPolygonizer @@ -49383,7 +49761,7 @@ function getPolygonizer(d) { } return alg } -},{"marching-simplex-table":260,"typedarray-pool":345}],328:[function(_dereq_,module,exports){ +},{"marching-simplex-table":281,"typedarray-pool":366}],349:[function(_dereq_,module,exports){ "use strict"; "use restrict"; var bits = _dereq_("bit-twiddle") @@ -49727,11 +50105,11 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":37,"union-find":346}],329:[function(_dereq_,module,exports){ +},{"bit-twiddle":37,"union-find":367}],350:[function(_dereq_,module,exports){ arguments[4][37][0].apply(exports,arguments) -},{"dup":37}],330:[function(_dereq_,module,exports){ -arguments[4][328][0].apply(exports,arguments) -},{"bit-twiddle":329,"dup":328,"union-find":331}],331:[function(_dereq_,module,exports){ +},{"dup":37}],351:[function(_dereq_,module,exports){ +arguments[4][349][0].apply(exports,arguments) +},{"bit-twiddle":350,"dup":349,"union-find":352}],352:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -49788,7 +50166,7 @@ UnionFind.prototype.link = function(x, y) { } -},{}],332:[function(_dereq_,module,exports){ +},{}],353:[function(_dereq_,module,exports){ "use strict" module.exports = simplifyPolygon @@ -50060,7 +50438,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":318,"simplicial-complex":330}],333:[function(_dereq_,module,exports){ +},{"robust-orientation":339,"simplicial-complex":351}],354:[function(_dereq_,module,exports){ "use strict" module.exports = orderSegments @@ -50156,9 +50534,9 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":318}],334:[function(_dereq_,module,exports){ +},{"robust-orientation":339}],355:[function(_dereq_,module,exports){ arguments[4][93][0].apply(exports,arguments) -},{"dup":93}],335:[function(_dereq_,module,exports){ +},{"dup":93}],356:[function(_dereq_,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -50389,7 +50767,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":333,"binary-search-bounds":334,"functional-red-black-tree":94,"robust-orientation":318}],336:[function(_dereq_,module,exports){ +},{"./lib/order-segments":354,"binary-search-bounds":355,"functional-red-black-tree":94,"robust-orientation":339}],357:[function(_dereq_,module,exports){ "use strict" var robustDot = _dereq_("robust-dot-product") @@ -50481,7 +50859,7 @@ function negative(points, plane) { } return neg } -},{"robust-dot-product":315,"robust-sum":323}],337:[function(_dereq_,module,exports){ +},{"robust-dot-product":336,"robust-sum":344}],358:[function(_dereq_,module,exports){ /* global window, exports, define */ !function() { @@ -50714,7 +51092,7 @@ function negative(points, plane) { /* eslint-enable quote-props */ }(); // eslint-disable-line -},{}],338:[function(_dereq_,module,exports){ +},{}],359:[function(_dereq_,module,exports){ "use strict" module.exports = surfaceNets @@ -50922,8 +51300,8 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":272,"triangulate-hypercube":341,"zero-crossings":356}],339:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +},{"ndarray-extract-contour":293,"triangulate-hypercube":362,"zero-crossings":377}],360:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -52119,7 +52497,7 @@ else { })(Math); -},{}],340:[function(_dereq_,module,exports){ +},{}],361:[function(_dereq_,module,exports){ 'use strict' var parseUnit = _dereq_('parse-unit') @@ -52180,7 +52558,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":287}],341:[function(_dereq_,module,exports){ +},{"parse-unit":308}],362:[function(_dereq_,module,exports){ "use strict" module.exports = triangulateCube @@ -52214,7 +52592,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":95,"permutation-parity":288,"permutation-rank":289}],342:[function(_dereq_,module,exports){ +},{"gamma":95,"permutation-parity":309,"permutation-rank":310}],363:[function(_dereq_,module,exports){ 'use strict' module.exports = createTurntableController @@ -52787,7 +53165,7 @@ function createTurntableController(options) { theta, phi) } -},{"filtered-vector":92,"gl-mat4/invert":123,"gl-mat4/rotate":128,"gl-vec3/cross":171,"gl-vec3/dot":176,"gl-vec3/normalize":193}],343:[function(_dereq_,module,exports){ +},{"filtered-vector":92,"gl-mat4/invert":137,"gl-mat4/rotate":143,"gl-vec3/cross":193,"gl-vec3/dot":198,"gl-vec3/normalize":215}],364:[function(_dereq_,module,exports){ "use strict" module.exports = twoProduct @@ -52821,7 +53199,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],344:[function(_dereq_,module,exports){ +},{}],365:[function(_dereq_,module,exports){ "use strict" module.exports = fastTwoSum @@ -52839,8 +53217,8 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],345:[function(_dereq_,module,exports){ -(function (global){ +},{}],366:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var bits = _dereq_('bit-twiddle') @@ -53093,8 +53471,8 @@ exports.clearCache = function clearCache() { } } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"bit-twiddle":37,"buffer":49,"dup":87}],346:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"bit-twiddle":37,"buffer":49,"dup":87}],367:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -53157,7 +53535,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],347:[function(_dereq_,module,exports){ +},{}],368:[function(_dereq_,module,exports){ "use strict" function unique_pred(list, compare) { @@ -53216,7 +53594,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],348:[function(_dereq_,module,exports){ +},{}],369:[function(_dereq_,module,exports){ "use strict" module.exports = createText @@ -53243,7 +53621,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":349}],349:[function(_dereq_,module,exports){ +},{"./lib/vtext":370}],370:[function(_dereq_,module,exports){ module.exports = vectorizeText module.exports.processPixels = processPixels @@ -53698,7 +54076,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":50,"clean-pslg":59,"ndarray":280,"planar-graph-to-polyline":292,"simplify-planar-graph":332,"surface-nets":338}],350:[function(_dereq_,module,exports){ +},{"cdt2d":50,"clean-pslg":59,"ndarray":301,"planar-graph-to-polyline":313,"simplify-planar-graph":353,"surface-nets":359}],371:[function(_dereq_,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -54385,7 +54763,7 @@ function vectorizeText(str, canvas, context, options) { } })(); -},{}],351:[function(_dereq_,module,exports){ +},{}],372:[function(_dereq_,module,exports){ var hiddenStore = _dereq_('./hidden-store.js'); module.exports = createStore; @@ -54406,7 +54784,7 @@ function createStore() { }; } -},{"./hidden-store.js":352}],352:[function(_dereq_,module,exports){ +},{"./hidden-store.js":373}],373:[function(_dereq_,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -54424,7 +54802,7 @@ function hiddenStore(obj, key) { return store; } -},{}],353:[function(_dereq_,module,exports){ +},{}],374:[function(_dereq_,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -54455,14 +54833,14 @@ function weakMap() { } } -},{"./create-store.js":351}],354:[function(_dereq_,module,exports){ +},{"./create-store.js":372}],375:[function(_dereq_,module,exports){ var getContext = _dereq_('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":96}],355:[function(_dereq_,module,exports){ +},{"get-canvas-context":96}],376:[function(_dereq_,module,exports){ module.exports = _dereq_('cwise-compiler')({ args: ['array', { offset: [1], @@ -54514,7 +54892,7 @@ module.exports = _dereq_('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":77}],356:[function(_dereq_,module,exports){ +},{"cwise-compiler":77}],377:[function(_dereq_,module,exports){ "use strict" module.exports = findZeroCrossings @@ -54527,7 +54905,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":355}],357:[function(_dereq_,module,exports){ +},{"./lib/zc-core":376}],378:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54598,7 +54976,7 @@ module.exports = [ } ]; -},{}],358:[function(_dereq_,module,exports){ +},{}],379:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54613,7 +54991,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -54953,7 +55358,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":538,"../../plots/cartesian/constants":554,"../../plots/font_attributes":576,"./arrow_paths":357}],359:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":497,"../../plot_api/plot_template":560,"../../plots/cartesian/constants":577,"../../plots/font_attributes":599,"./arrow_paths":378}],380:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54990,10 +55395,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -55042,7 +55449,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":502,"../../plots/cartesian/axes":548,"./draw":364}],360:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/cartesian/axes":571,"./draw":385}],381:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55180,7 +55587,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":502,"../../plot_api/plot_template":538,"../../registry":602}],361:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plot_api/plot_template":560,"../../registry":625}],382:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55259,7 +55666,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":502,"../color":373}],362:[function(_dereq_,module,exports){ +},{"../../lib":524,"../color":394}],383:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55322,7 +55729,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":527,"fast-isnumeric":91}],363:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":549,"fast-isnumeric":91}],384:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55385,7 +55792,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -55429,7 +55837,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":502,"../../plots/array_container_defaults":544,"../../plots/cartesian/axes":548,"./attributes":358,"./common_defaults":361}],364:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/array_container_defaults":566,"../../plots/cartesian/axes":571,"./attributes":379,"./common_defaults":382}],385:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55445,6 +55853,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -55505,6 +55914,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -55728,13 +56162,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -55750,12 +56185,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -55772,8 +56212,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -55963,7 +56424,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -55994,22 +56455,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -56041,14 +56503,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -56057,7 +56522,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -56067,7 +56534,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -56087,7 +56556,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -56129,7 +56598,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":502,"../../lib/setcursor":521,"../../lib/svg_text_utils":525,"../../plot_api/plot_template":538,"../../plots/cartesian/axes":548,"../../plots/plots":593,"../../registry":602,"../color":373,"../dragelement":392,"../drawing":395,"../fx":413,"./draw_arrow_head":365,"d3":82}],365:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../lib/setcursor":543,"../../lib/svg_text_utils":547,"../../plot_api/plot_template":560,"../../plots/cartesian/axes":571,"../../plots/plots":616,"../../registry":625,"../color":394,"../dragelement":413,"../drawing":416,"../fx":434,"./draw_arrow_head":386,"d3":82}],386:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56147,6 +56616,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -56266,9 +56740,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -56280,7 +56754,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":373,"./arrow_paths":357,"d3":82}],366:[function(_dereq_,module,exports){ +},{"../../lib":524,"../color":394,"./arrow_paths":378,"d3":82}],387:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56314,7 +56788,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":560,"./attributes":358,"./calc_autorange":359,"./click":360,"./convert_coords":362,"./defaults":363,"./draw":364}],367:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":583,"./attributes":379,"./calc_autorange":380,"./click":381,"./convert_coords":383,"./defaults":384,"./draw":385}],388:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56402,7 +56876,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":531,"../../plot_api/plot_template":538,"../annotations/attributes":358}],368:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":553,"../../plot_api/plot_template":560,"../annotations/attributes":379}],389:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56467,7 +56941,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":502,"../../plots/cartesian/axes":548}],369:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/cartesian/axes":571}],390:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56543,7 +57017,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":502,"../../plots/array_container_defaults":544,"../../plots/cartesian/axes":548,"../annotations/common_defaults":361,"./attributes":367}],370:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/array_container_defaults":566,"../../plots/cartesian/axes":571,"../annotations/common_defaults":382,"./attributes":388}],391:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56595,7 +57069,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":588,"../annotations/draw":364}],371:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":611,"../annotations/draw":385}],392:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56643,7 +57117,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":502,"../../registry":602,"./attributes":367,"./convert":368,"./defaults":369,"./draw":370}],372:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625,"./attributes":388,"./convert":389,"./defaults":390,"./draw":391}],393:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56683,7 +57157,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],373:[function(_dereq_,module,exports){ +},{}],394:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56857,7 +57331,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":372,"fast-isnumeric":91,"tinycolor2":339}],374:[function(_dereq_,module,exports){ +},{"./attributes":393,"fast-isnumeric":91,"tinycolor2":360}],395:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56982,6 +57456,17 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -56998,6 +57483,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -57036,7 +57522,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":495,"../../plot_api/edit_types":531,"../../plots/cartesian/layout_attributes":562,"../../plots/font_attributes":576}],375:[function(_dereq_,module,exports){ +},{"../../lib/extend":517,"../../plot_api/edit_types":553,"../../plots/cartesian/layout_attributes":585,"../../plots/font_attributes":599}],396:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57064,7 +57550,7 @@ module.exports = { } }; -},{}],376:[function(_dereq_,module,exports){ +},{}],397:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57118,10 +57604,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -57130,7 +57620,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":502,"../../plot_api/plot_template":538,"../../plots/cartesian/tick_label_defaults":569,"../../plots/cartesian/tick_mark_defaults":570,"../../plots/cartesian/tick_value_defaults":571,"./attributes":374}],377:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plot_api/plot_template":560,"../../plots/cartesian/tick_label_defaults":592,"../../plots/cartesian/tick_mark_defaults":593,"../../plots/cartesian/tick_value_defaults":594,"./attributes":395}],398:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57149,6 +57639,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -57403,10 +57894,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -57518,18 +58009,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -57593,20 +58085,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -57616,7 +58107,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -57661,7 +58156,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -57717,7 +58212,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -57812,10 +58307,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -57857,7 +58354,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":475,"../../lib":502,"../../lib/extend":495,"../../lib/setcursor":521,"../../lib/svg_text_utils":525,"../../plots/cartesian/axes":548,"../../plots/cartesian/axis_defaults":550,"../../plots/cartesian/layout_attributes":562,"../../plots/cartesian/position_defaults":565,"../../plots/plots":593,"../../registry":602,"../color":373,"../colorscale/helpers":384,"../dragelement":392,"../drawing":395,"../titles":468,"./constants":375,"d3":82,"tinycolor2":339}],378:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496,"../../lib":524,"../../lib/extend":517,"../../lib/setcursor":543,"../../lib/svg_text_utils":547,"../../plots/cartesian/axes":571,"../../plots/cartesian/axis_defaults":573,"../../plots/cartesian/layout_attributes":585,"../../plots/cartesian/position_defaults":588,"../../plots/plots":616,"../../registry":625,"../color":394,"../colorscale/helpers":405,"../dragelement":413,"../drawing":416,"../titles":489,"./constants":396,"d3":82,"tinycolor2":360}],399:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57876,7 +58373,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":502}],379:[function(_dereq_,module,exports){ +},{"../../lib":524}],400:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -57898,7 +58395,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":374,"./defaults":376,"./draw":377,"./has_colorbar":378}],380:[function(_dereq_,module,exports){ +},{"./attributes":395,"./defaults":397,"./draw":398,"./has_colorbar":399}],401:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58106,7 +58603,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":517,"../colorbar/attributes":374,"./scales.js":388}],381:[function(_dereq_,module,exports){ +},{"../../lib/regex":539,"../colorbar/attributes":395,"./scales.js":409}],402:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58185,7 +58682,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":502,"./helpers":384,"fast-isnumeric":91}],382:[function(_dereq_,module,exports){ +},{"../../lib":524,"./helpers":405,"fast-isnumeric":91}],403:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58262,7 +58759,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":502,"./helpers":384}],383:[function(_dereq_,module,exports){ +},{"../../lib":524,"./helpers":405}],404:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58387,7 +58884,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":502,"../../registry":602,"../colorbar/defaults":376,"../colorbar/has_colorbar":378,"./scales":388,"fast-isnumeric":91}],384:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625,"../colorbar/defaults":397,"../colorbar/has_colorbar":399,"./scales":409,"fast-isnumeric":91}],405:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58627,7 +59124,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":502,"../color":373,"./scales":388,"d3":82,"fast-isnumeric":91,"tinycolor2":339}],385:[function(_dereq_,module,exports){ +},{"../../lib":524,"../color":394,"./scales":409,"d3":82,"fast-isnumeric":91,"tinycolor2":360}],406:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58669,7 +59166,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":380,"./calc":381,"./cross_trace_defaults":382,"./defaults":383,"./helpers":384,"./layout_attributes":386,"./layout_defaults":387,"./scales":388}],386:[function(_dereq_,module,exports){ +},{"./attributes":401,"./calc":402,"./cross_trace_defaults":403,"./defaults":404,"./helpers":405,"./layout_attributes":407,"./layout_defaults":408,"./scales":409}],407:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58730,7 +59227,7 @@ module.exports = { })) }; -},{"../../lib/extend":495,"./attributes":380,"./scales":388}],387:[function(_dereq_,module,exports){ +},{"../../lib/extend":517,"./attributes":401,"./scales":409}],408:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58781,7 +59278,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":502,"../../plot_api/plot_template":538,"./defaults":383,"./layout_attributes":386}],388:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plot_api/plot_template":560,"./defaults":404,"./layout_attributes":407}],409:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -58985,7 +59482,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":339}],389:[function(_dereq_,module,exports){ +},{"tinycolor2":360}],410:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59018,7 +59515,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],390:[function(_dereq_,module,exports){ +},{}],411:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59056,7 +59553,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":502}],391:[function(_dereq_,module,exports){ +},{"../../lib":524}],412:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59115,7 +59612,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],392:[function(_dereq_,module,exports){ +},{}],413:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59407,7 +59904,7 @@ function pointerOffset(e) { ); } -},{"../../lib":502,"../../plots/cartesian/constants":554,"./align":389,"./cursor":390,"./unhover":393,"has-hover":246,"has-passive-events":247,"mouse-event-offset":269}],393:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/cartesian/constants":577,"./align":410,"./cursor":411,"./unhover":414,"has-hover":267,"has-passive-events":268,"mouse-event-offset":290}],414:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59462,7 +59959,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":493,"../../lib/events":494,"../../lib/throttle":526,"../fx/constants":407}],394:[function(_dereq_,module,exports){ +},{"../../lib/dom":515,"../../lib/events":516,"../../lib/throttle":548,"../fx/constants":428}],415:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59487,7 +59984,7 @@ exports.dash = { }; -},{}],395:[function(_dereq_,module,exports){ +},{}],416:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59507,6 +60004,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -59568,7 +60066,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -60194,7 +60692,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -60585,7 +61083,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -60619,7 +61117,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -60638,7 +61136,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -60669,9 +61167,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -60679,11 +61177,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":409,"../../constants/alignment":475,"../../constants/interactions":479,"../../constants/xmlns_namespaces":481,"../../lib":502,"../../lib/svg_text_utils":525,"../../registry":602,"../../traces/scatter/make_bubble_size_func":648,"../../traces/scatter/subtypes":655,"../color":373,"../colorscale":385,"./symbol_defs":396,"d3":82,"fast-isnumeric":91,"tinycolor2":339}],396:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":430,"../../constants/alignment":496,"../../constants/interactions":501,"../../constants/xmlns_namespaces":503,"../../lib":524,"../../lib/svg_text_utils":547,"../../registry":625,"../../traces/scatter/make_bubble_size_func":671,"../../traces/scatter/subtypes":679,"../color":394,"../colorscale":406,"./symbol_defs":417,"d3":82,"fast-isnumeric":91,"tinycolor2":360}],417:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61247,7 +61745,7 @@ module.exports = { } }; -},{"d3":82}],397:[function(_dereq_,module,exports){ +},{"d3":82}],418:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61362,7 +61860,7 @@ module.exports = { } }; -},{}],398:[function(_dereq_,module,exports){ +},{}],419:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61448,7 +61946,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":502,"../../plots/cartesian/axes":548,"../../registry":602,"./compute_error":399,"fast-isnumeric":91}],399:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/cartesian/axes":571,"../../registry":625,"./compute_error":420,"fast-isnumeric":91}],420:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61549,7 +62047,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],400:[function(_dereq_,module,exports){ +},{}],421:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61624,7 +62122,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":502,"../../plot_api/plot_template":538,"../../registry":602,"./attributes":397,"fast-isnumeric":91}],401:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plot_api/plot_template":560,"../../registry":625,"./attributes":418,"fast-isnumeric":91}],422:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61693,7 +62191,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":502,"../../plot_api/edit_types":531,"./attributes":397,"./calc":398,"./compute_error":399,"./defaults":400,"./plot":402,"./style":403}],402:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plot_api/edit_types":553,"./attributes":418,"./calc":419,"./compute_error":420,"./defaults":421,"./plot":423,"./style":424}],423:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61865,7 +62363,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":655,"../drawing":395,"d3":82,"fast-isnumeric":91}],403:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":679,"../drawing":416,"d3":82,"fast-isnumeric":91}],424:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61902,7 +62400,7 @@ module.exports = function style(traces) { }); }; -},{"../color":373,"d3":82}],404:[function(_dereq_,module,exports){ +},{"../color":394,"d3":82}],425:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61938,7 +62436,7 @@ module.exports = { } }; -},{"../../lib/extend":495,"../../plots/font_attributes":576,"./layout_attributes":414}],405:[function(_dereq_,module,exports){ +},{"../../lib/extend":517,"../../plots/font_attributes":599,"./layout_attributes":435}],426:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -61997,7 +62495,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":502,"../../registry":602}],406:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625}],427:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62034,7 +62532,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":602,"./hover":410}],407:[function(_dereq_,module,exports){ +},{"../../registry":625,"./hover":431}],428:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62066,7 +62564,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],408:[function(_dereq_,module,exports){ +},{}],429:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62092,7 +62590,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":502,"./attributes":404,"./hoverlabel_defaults":411}],409:[function(_dereq_,module,exports){ +},{"../../lib":524,"./attributes":425,"./hoverlabel_defaults":432}],430:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62354,7 +62852,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":502}],410:[function(_dereq_,module,exports){ +},{"../../lib":524}],431:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62370,6 +62868,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -62549,7 +63049,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -62693,6 +63195,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -63073,10 +63581,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -63317,7 +63823,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -63425,7 +63931,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -63460,8 +63966,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -63469,7 +63980,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -63569,8 +64080,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -63829,7 +64340,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -63845,7 +64359,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -63854,49 +64369,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -64208,7 +64724,7 @@ function plainText(s, len) { }); } -},{"../../lib":502,"../../lib/events":494,"../../lib/override_cursor":513,"../../lib/svg_text_utils":525,"../../plots/cartesian/axes":548,"../../registry":602,"../color":373,"../dragelement":392,"../drawing":395,"../legend/defaults":425,"../legend/draw":426,"./constants":407,"./helpers":409,"d3":82,"fast-isnumeric":91,"tinycolor2":339}],411:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../lib/events":516,"../../lib/override_cursor":535,"../../lib/svg_text_utils":547,"../../plots/cartesian/axes":571,"../../registry":625,"../color":394,"../dragelement":413,"../drawing":416,"../legend/defaults":446,"../legend/draw":447,"./constants":428,"./helpers":430,"d3":82,"fast-isnumeric":91,"tinycolor2":360}],432:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64254,7 +64770,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":502,"../color":373,"./helpers":409}],412:[function(_dereq_,module,exports){ +},{"../../lib":524,"../color":394,"./helpers":430}],433:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64310,7 +64826,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":502,"./layout_attributes":414}],413:[function(_dereq_,module,exports){ +},{"../../lib":524,"./layout_attributes":435}],434:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64389,7 +64905,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":502,"../dragelement":392,"./attributes":404,"./calc":405,"./click":406,"./constants":407,"./defaults":408,"./helpers":409,"./hover":410,"./layout_attributes":414,"./layout_defaults":415,"./layout_global_defaults":416,"d3":82}],414:[function(_dereq_,module,exports){ +},{"../../lib":524,"../dragelement":413,"./attributes":425,"./calc":426,"./click":427,"./constants":428,"./defaults":429,"./helpers":430,"./hover":431,"./layout_attributes":435,"./layout_defaults":436,"./layout_global_defaults":437,"d3":82}],435:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64505,7 +65021,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":576,"./constants":407}],415:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":599,"./constants":428}],436:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64553,7 +65069,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":502,"./helpers":409,"./hoverlabel_defaults":411,"./hovermode_defaults":412,"./layout_attributes":414}],416:[function(_dereq_,module,exports){ +},{"../../lib":524,"./helpers":430,"./hoverlabel_defaults":432,"./hovermode_defaults":433,"./layout_attributes":435}],437:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64576,7 +65092,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":502,"./hoverlabel_defaults":411,"./layout_attributes":414}],417:[function(_dereq_,module,exports){ +},{"../../lib":524,"./hoverlabel_defaults":432,"./layout_attributes":435}],438:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64950,7 +65466,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":502,"../../lib/regex":517,"../../plot_api/plot_template":538,"../../plots/cartesian/constants":554,"../../plots/domain":575}],418:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../lib/regex":539,"../../plot_api/plot_template":560,"../../plots/cartesian/constants":577,"../../plots/domain":598}],439:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64963,6 +65479,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -65085,7 +65602,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw' }); -},{"../../plot_api/plot_template":538,"../../plots/cartesian/constants":554}],419:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":497,"../../plot_api/plot_template":560,"../../plots/cartesian/constants":577}],440:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65166,7 +65683,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":527,"fast-isnumeric":91}],420:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":549,"fast-isnumeric":91}],441:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65218,7 +65735,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -65231,7 +65748,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":502,"../../plots/array_container_defaults":544,"../../plots/cartesian/axes":548,"./attributes":418}],421:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/array_container_defaults":566,"../../plots/cartesian/axes":571,"./attributes":439}],442:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65245,6 +65762,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -65261,7 +65779,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -65364,10 +65882,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -65376,8 +65909,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -65401,8 +65951,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -65456,7 +66006,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":481,"../../plots/cartesian/axes":548,"../drawing":395,"d3":82}],422:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":503,"../../plots/cartesian/axes":571,"../../plots/cartesian/axis_ids":574,"../drawing":416,"d3":82}],443:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65480,7 +66030,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":560,"./attributes":418,"./convert_coords":419,"./defaults":420,"./draw":421}],423:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":583,"./attributes":439,"./convert_coords":440,"./defaults":441,"./draw":442}],444:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65552,6 +66102,14 @@ module.exports = { editType: 'legend', + }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + + editType: 'legend', + }, itemclick: { @@ -65641,7 +66199,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":576,"../color/attributes":372}],424:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":599,"../color/attributes":393}],445:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65661,13 +66219,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],425:[function(_dereq_,module,exports){ +},{}],446:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65783,6 +66339,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -65801,7 +66358,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":502,"../../plot_api/plot_template":538,"../../plots/layout_attributes":591,"../../registry":602,"./attributes":423,"./helpers":429}],426:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plot_api/plot_template":560,"../../plots/layout_attributes":614,"../../registry":625,"./attributes":444,"./helpers":450}],447:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65893,7 +66450,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -66214,11 +66770,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -66271,11 +66827,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -66345,7 +66904,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -66398,8 +66958,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -66512,7 +67072,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -66595,7 +67155,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":475,"../../lib":502,"../../lib/events":494,"../../lib/svg_text_utils":525,"../../plots/plots":593,"../../registry":602,"../color":373,"../dragelement":392,"../drawing":395,"./constants":424,"./get_legend_data":427,"./handle_click":428,"./helpers":429,"./style":431,"d3":82}],427:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496,"../../lib":524,"../../lib/events":516,"../../lib/svg_text_utils":547,"../../plots/plots":616,"../../registry":625,"../color":394,"../dragelement":413,"../drawing":416,"./constants":445,"./get_legend_data":448,"./handle_click":449,"./helpers":450,"./style":452,"d3":82}],448:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66704,7 +67264,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":602,"./helpers":429}],428:[function(_dereq_,module,exports){ +},{"../../registry":625,"./helpers":450}],449:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66943,7 +67503,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":502,"../../registry":602}],429:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625}],450:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66967,7 +67527,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],430:[function(_dereq_,module,exports){ +},{}],451:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66991,7 +67551,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":423,"./defaults":425,"./draw":426,"./style":431}],431:[function(_dereq_,module,exports){ +},{"./attributes":444,"./defaults":446,"./draw":447,"./style":452}],452:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67006,6 +67566,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -67014,6 +67575,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -67024,6 +67587,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -67052,7 +67618,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -67155,7 +67721,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -67175,7 +67741,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -67265,7 +67831,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -67277,7 +67843,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -67305,7 +67871,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -67345,7 +67911,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -67369,7 +67935,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -67409,7 +67975,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -67436,7 +68002,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -67472,7 +68038,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -67570,7 +68136,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -67618,7 +68184,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":502,"../../registry":602,"../../traces/pie/helpers":628,"../../traces/pie/style_one":629,"../../traces/scatter/subtypes":655,"../color":373,"../colorscale/helpers":384,"../drawing":395,"d3":82}],432:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625,"../../traces/pie/helpers":651,"../../traces/pie/style_one":652,"../../traces/scatter/subtypes":679,"../color":394,"../colorscale/helpers":405,"../drawing":416,"./constants":445,"d3":82}],453:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68354,7 +68920,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":484,"../../lib":502,"../../plots/cartesian/axis_ids":551,"../../plots/plots":593,"../../registry":602,"../shapes/draw":454}],433:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":506,"../../lib":524,"../../plots/cartesian/axis_ids":574,"../../plots/plots":616,"../../registry":625,"../shapes/draw":475}],454:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68368,7 +68934,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":434}],434:[function(_dereq_,module,exports){ +},{"./manage":455}],455:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68664,7 +69230,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":551,"../../registry":602,"../../traces/scatter/subtypes":655,"../fx/helpers":409,"./buttons":432,"./modebar":435}],435:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":574,"../../registry":625,"../../traces/scatter/subtypes":679,"../fx/helpers":430,"./buttons":453,"./modebar":456}],456:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69010,7 +69576,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":484,"../../lib":502,"d3":82,"fast-isnumeric":91}],436:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":506,"../../lib":524,"d3":82,"fast-isnumeric":91}],457:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69146,7 +69712,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":538,"../../plots/font_attributes":576,"../color/attributes":372}],437:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":560,"../../plots/font_attributes":599,"../color/attributes":393}],458:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69175,7 +69741,7 @@ module.exports = { darkAmount: 10 }; -},{}],438:[function(_dereq_,module,exports){ +},{}],459:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69267,7 +69833,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":502,"../../plot_api/plot_template":538,"../../plots/array_container_defaults":544,"../color":373,"./attributes":436,"./constants":437}],439:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plot_api/plot_template":560,"../../plots/array_container_defaults":566,"../color":394,"./attributes":457,"./constants":458}],460:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69285,6 +69851,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -69414,8 +69981,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -69466,9 +70032,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -69521,10 +70085,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":475,"../../lib":502,"../../lib/svg_text_utils":525,"../../plots/cartesian/axis_ids":551,"../../plots/plots":593,"../../registry":602,"../color":373,"../drawing":395,"./constants":437,"./get_update_object":440,"d3":82}],440:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496,"../../lib":524,"../../lib/svg_text_utils":547,"../../plots/cartesian/axis_ids":574,"../../plots/plots":616,"../../registry":625,"../color":394,"../drawing":416,"./constants":458,"./get_update_object":461,"d3":82}],461:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69578,7 +70142,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":82}],441:[function(_dereq_,module,exports){ +},{"d3":82}],462:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69605,7 +70169,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":436,"./defaults":438,"./draw":439}],442:[function(_dereq_,module,exports){ +},{"./attributes":457,"./defaults":459,"./draw":460}],463:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69679,7 +70243,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":372}],443:[function(_dereq_,module,exports){ +},{"../color/attributes":393}],464:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69713,7 +70277,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":547,"../../plots/cartesian/axis_ids":551,"./constants":444}],444:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":570,"../../plots/cartesian/axis_ids":574,"./constants":465}],465:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69769,7 +70333,7 @@ module.exports = { extraPad: 15 }; -},{}],445:[function(_dereq_,module,exports){ +},{}],466:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69855,7 +70419,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":502,"../../plot_api/plot_template":538,"../../plots/cartesian/axis_ids":551,"./attributes":442,"./oppaxis_attributes":449}],446:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plot_api/plot_template":560,"../../plots/cartesian/axis_ids":574,"./attributes":463,"./oppaxis_attributes":470}],467:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69872,6 +70436,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -69977,7 +70542,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -70090,6 +70655,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -70236,10 +70803,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -70261,7 +70828,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -70477,14 +71044,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -70498,7 +71063,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":502,"../../lib/setcursor":521,"../../plots/cartesian":561,"../../plots/cartesian/axis_ids":551,"../../plots/plots":593,"../../registry":602,"../color":373,"../dragelement":392,"../drawing":395,"../titles":468,"./constants":444,"d3":82}],447:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../lib/setcursor":543,"../../plots/cartesian":584,"../../plots/cartesian/axis_ids":574,"../../plots/plots":616,"../../registry":625,"../color":394,"../dragelement":413,"../drawing":416,"../titles":489,"./constants":465,"d3":82}],468:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70573,7 +71138,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":475,"../../lib/svg_text_utils":525,"../../plots/cartesian/axis_ids":551,"./constants":444}],448:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496,"../../lib/svg_text_utils":547,"../../plots/cartesian/axis_ids":574,"./constants":465}],469:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70612,7 +71177,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":502,"./attributes":442,"./calc_autorange":443,"./defaults":445,"./draw":446,"./helpers":447,"./oppaxis_attributes":449}],449:[function(_dereq_,module,exports){ +},{"../../lib":524,"./attributes":463,"./calc_autorange":464,"./defaults":466,"./draw":467,"./helpers":468,"./oppaxis_attributes":470}],470:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70650,7 +71215,7 @@ module.exports = { editType: 'calc' }; -},{}],450:[function(_dereq_,module,exports){ +},{}],471:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70666,6 +71231,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -70802,7 +71368,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":495,"../../plot_api/plot_template":538,"../../traces/scatter/attributes":631,"../annotations/attributes":358,"../drawing/attributes":394}],451:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":497,"../../lib/extend":517,"../../plot_api/plot_template":560,"../../traces/scatter/attributes":654,"../annotations/attributes":379,"../drawing/attributes":415}],472:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70830,9 +71396,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -70843,7 +71412,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -70919,7 +71488,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":502,"../../plots/cartesian/axes":548,"./constants":452,"./helpers":461}],452:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/cartesian/axes":571,"./constants":473,"./helpers":482}],473:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70983,7 +71552,7 @@ module.exports = { } }; -},{}],453:[function(_dereq_,module,exports){ +},{}],474:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71049,9 +71618,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -71112,7 +71683,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":502,"../../plots/array_container_defaults":544,"../../plots/cartesian/axes":548,"./attributes":450,"./helpers":461}],454:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/array_container_defaults":566,"../../plots/cartesian/axes":571,"./attributes":471,"./helpers":482}],475:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71298,7 +71869,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -71324,11 +71898,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -71699,6 +72275,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -71706,15 +72284,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -71871,7 +72457,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":502,"../../lib/setcursor":521,"../../plot_api/plot_template":538,"../../plots/cartesian/axes":548,"../../plots/cartesian/handle_outline":558,"../../registry":602,"../color":373,"../dragelement":392,"../drawing":395,"./constants":452,"./draw_newshape/display_outlines":458,"./draw_newshape/helpers":459,"./helpers":461}],455:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../lib/setcursor":543,"../../plot_api/plot_template":560,"../../plots/cartesian/axes":571,"../../plots/cartesian/handle_outline":581,"../../registry":625,"../color":394,"../dragelement":413,"../drawing":416,"./constants":473,"./draw_newshape/display_outlines":479,"./draw_newshape/helpers":480,"./helpers":482}],476:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71974,7 +72560,7 @@ module.exports = { } }; -},{"../../../lib/extend":495,"../../drawing/attributes":394}],456:[function(_dereq_,module,exports){ +},{"../../../lib/extend":517,"../../drawing/attributes":415}],477:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -71998,7 +72584,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],457:[function(_dereq_,module,exports){ +},{}],478:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72030,7 +72616,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":373}],458:[function(_dereq_,module,exports){ +},{"../../color":394}],479:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72325,7 +72911,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":558,"../../../registry":602,"../../dragelement":392,"../../dragelement/helpers":391,"./constants":456,"./helpers":459,"./newshapes":460}],459:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":581,"../../../registry":625,"../../dragelement":413,"../../dragelement/helpers":412,"./constants":477,"./helpers":480,"./newshapes":481}],480:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72663,7 +73249,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":559,"./constants":456,"parse-svg-path":286}],460:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":582,"./constants":477,"parse-svg-path":307}],481:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72922,7 +73508,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":558,"../../../plots/cartesian/helpers":559,"../../dragelement/helpers":391,"./constants":456,"./helpers":459}],461:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":581,"../../../plots/cartesian/helpers":582,"../../dragelement/helpers":412,"./constants":477,"./helpers":480}],482:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -72983,18 +73569,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -73004,13 +73596,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -73067,7 +73666,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":502,"./constants":452}],462:[function(_dereq_,module,exports){ +},{"../../lib":524,"./constants":473}],483:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73095,7 +73694,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":560,"./attributes":450,"./calc_autorange":451,"./defaults":453,"./draw":454,"./draw_newshape/defaults":457}],463:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":583,"./attributes":471,"./calc_autorange":472,"./defaults":474,"./draw":475,"./draw_newshape/defaults":478}],484:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73338,7 +73937,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":495,"../../plot_api/edit_types":531,"../../plot_api/plot_template":538,"../../plots/animation_attributes":543,"../../plots/font_attributes":576,"../../plots/pad_attributes":592,"./constants":464}],464:[function(_dereq_,module,exports){ +},{"../../lib/extend":517,"../../plot_api/edit_types":553,"../../plot_api/plot_template":560,"../../plots/animation_attributes":565,"../../plots/font_attributes":599,"../../plots/pad_attributes":615,"./constants":485}],485:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73432,7 +74031,7 @@ module.exports = { currentValueInset: 0, }; -},{}],465:[function(_dereq_,module,exports){ +},{}],486:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73547,7 +74146,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":502,"../../plots/array_container_defaults":544,"./attributes":463,"./constants":464}],466:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/array_container_defaults":566,"./attributes":484,"./constants":485}],487:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73564,6 +74163,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -73852,11 +74452,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -73907,11 +74506,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -74124,7 +74722,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -74179,7 +74777,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":475,"../../lib":502,"../../lib/svg_text_utils":525,"../../plot_api/plot_template":538,"../../plots/plots":593,"../color":373,"../drawing":395,"./constants":464,"d3":82}],467:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496,"../../lib":524,"../../lib/svg_text_utils":547,"../../plot_api/plot_template":560,"../../plots/plots":616,"../color":394,"../drawing":416,"./constants":485,"d3":82}],488:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74202,7 +74800,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":463,"./constants":464,"./defaults":465,"./draw":466}],468:[function(_dereq_,module,exports){ +},{"./attributes":484,"./constants":485,"./defaults":486,"./draw":487}],489:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74220,6 +74818,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -74340,7 +74939,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -74418,7 +75017,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -74469,7 +75068,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":475,"../../constants/interactions":479,"../../lib":502,"../../lib/svg_text_utils":525,"../../plots/plots":593,"../../registry":602,"../color":373,"../drawing":395,"d3":82,"fast-isnumeric":91}],469:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496,"../../constants/interactions":501,"../../lib":524,"../../lib/svg_text_utils":547,"../../plots/plots":616,"../../registry":625,"../color":394,"../drawing":416,"d3":82,"fast-isnumeric":91}],490:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74638,7 +75237,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":495,"../../plot_api/edit_types":531,"../../plot_api/plot_template":538,"../../plots/font_attributes":576,"../../plots/pad_attributes":592,"../color/attributes":372}],470:[function(_dereq_,module,exports){ +},{"../../lib/extend":517,"../../plot_api/edit_types":553,"../../plot_api/plot_template":560,"../../plots/font_attributes":599,"../../plots/pad_attributes":615,"../color/attributes":393}],491:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74719,7 +75318,7 @@ module.exports = { } }; -},{}],471:[function(_dereq_,module,exports){ +},{}],492:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -74802,7 +75401,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":502,"../../plots/array_container_defaults":544,"./attributes":469,"./constants":470}],472:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../plots/array_container_defaults":566,"./attributes":490,"./constants":491}],493:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75000,8 +75599,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -75240,11 +75838,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -75455,9 +76052,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":475,"../../lib":502,"../../lib/svg_text_utils":525,"../../plot_api/plot_template":538,"../../plots/plots":593,"../color":373,"../drawing":395,"./constants":470,"./scrollbox":474,"d3":82}],473:[function(_dereq_,module,exports){ -arguments[4][467][0].apply(exports,arguments) -},{"./attributes":469,"./constants":470,"./defaults":471,"./draw":472,"dup":467}],474:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496,"../../lib":524,"../../lib/svg_text_utils":547,"../../plot_api/plot_template":560,"../../plots/plots":616,"../color":394,"../drawing":416,"./constants":491,"./scrollbox":495,"d3":82}],494:[function(_dereq_,module,exports){ +arguments[4][488][0].apply(exports,arguments) +},{"./attributes":490,"./constants":491,"./defaults":492,"./draw":493,"dup":488}],495:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75922,7 +76519,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":502,"../color":373,"../drawing":395,"d3":82}],475:[function(_dereq_,module,exports){ +},{"../../lib":524,"../color":394,"../drawing":416,"d3":82}],496:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75987,7 +76584,39 @@ module.exports = { } }; -},{}],476:[function(_dereq_,module,exports){ +},{}],497:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],498:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76003,7 +76632,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],477:[function(_dereq_,module,exports){ +},{}],499:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76024,7 +76653,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],478:[function(_dereq_,module,exports){ +},{}],500:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76047,7 +76676,7 @@ module.exports = { x: '❌' }; -},{}],479:[function(_dereq_,module,exports){ +},{}],501:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76070,7 +76699,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],480:[function(_dereq_,module,exports){ +},{}],502:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76143,7 +76772,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],481:[function(_dereq_,module,exports){ +},{}],503:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76167,7 +76796,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],482:[function(_dereq_,module,exports){ +},{}],504:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76253,7 +76882,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":366,"./components/annotations3d":371,"./components/colorbar":379,"./components/colorscale":385,"./components/errorbars":401,"./components/fx":413,"./components/grid":417,"./components/images":422,"./components/legend":430,"./components/rangeselector":441,"./components/rangeslider":448,"./components/shapes":462,"./components/sliders":467,"./components/updatemenus":473,"./fonts/mathjax_config":483,"./fonts/ploticon":484,"./lib/queue":516,"./locale-en":529,"./locale-en-us":528,"./plot_api":533,"./plot_api/plot_schema":537,"./plots/plots":593,"./registry":602,"./snapshot":607,"./traces/scatter":643,"./version":678,"d3":82,"es6-promise":89}],483:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":387,"./components/annotations3d":392,"./components/colorbar":400,"./components/colorscale":406,"./components/errorbars":422,"./components/fx":434,"./components/grid":438,"./components/images":443,"./components/legend":451,"./components/rangeselector":462,"./components/rangeslider":469,"./components/shapes":483,"./components/sliders":488,"./components/updatemenus":494,"./fonts/mathjax_config":505,"./fonts/ploticon":506,"./lib/queue":538,"./locale-en":551,"./locale-en-us":550,"./plot_api":555,"./plot_api/plot_schema":559,"./plots/plots":616,"./registry":625,"./snapshot":630,"./traces/scatter":666,"./version":702,"d3":82,"es6-promise":89}],505:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76284,7 +76913,7 @@ module.exports = function() { } }; -},{}],484:[function(_dereq_,module,exports){ +},{}],506:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76464,7 +77093,7 @@ module.exports = { } }; -},{}],485:[function(_dereq_,module,exports){ +},{}],507:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76528,7 +77157,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],486:[function(_dereq_,module,exports){ +},{}],508:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76769,7 +77398,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":509}],487:[function(_dereq_,module,exports){ +},{"./mod":531}],509:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76926,7 +77555,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],488:[function(_dereq_,module,exports){ +},{}],510:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76959,7 +77588,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":480,"fast-isnumeric":91}],489:[function(_dereq_,module,exports){ +},{"../constants/numerical":502,"fast-isnumeric":91}],511:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76987,7 +77616,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],490:[function(_dereq_,module,exports){ +},{}],512:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77010,7 +77639,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],491:[function(_dereq_,module,exports){ +},{}],513:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77474,7 +78103,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":388,"../constants/interactions":479,"../plots/attributes":545,"./array":487,"./mod":509,"./nested_property":510,"./regex":517,"fast-isnumeric":91,"tinycolor2":339}],492:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":409,"../constants/interactions":501,"../plots/attributes":567,"./array":509,"./mod":531,"./nested_property":532,"./regex":539,"fast-isnumeric":91,"tinycolor2":360}],514:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77522,9 +78151,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -77532,7 +78175,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -78061,7 +78704,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":480,"../registry":602,"./loggers":506,"./mod":509,"d3-time-format":80,"fast-isnumeric":91}],493:[function(_dereq_,module,exports){ +},{"../constants/numerical":502,"../registry":625,"./loggers":528,"./mod":531,"d3-time-format":80,"fast-isnumeric":91}],515:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78074,6 +78717,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -78155,16 +78800,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":506,"d3":82}],494:[function(_dereq_,module,exports){ +},{"./loggers":528,"./matrix":530,"d3":82,"gl-mat4":136}],516:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78337,7 +79055,7 @@ var Events = { module.exports = Events; -},{"events":48}],495:[function(_dereq_,module,exports){ +},{"events":48}],517:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78451,7 +79169,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":503}],496:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":525}],518:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78502,7 +79220,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],497:[function(_dereq_,module,exports){ +},{}],519:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78550,7 +79268,7 @@ function isCalcData(cont) { ); } -},{}],498:[function(_dereq_,module,exports){ +},{}],520:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78794,7 +79512,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":509}],499:[function(_dereq_,module,exports){ +},{"./mod":531}],521:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78873,14 +79591,11 @@ function formatColor(containerIn, opacityIn, len) { return colorOut; } -function parseColorScale(cont, alpha) { - if(alpha === undefined) alpha = 1; - +function parseColorScale(cont) { var cOpts = Colorscale.extractOpts(cont); - var colorscale = cOpts.reversescale ? - Colorscale.flipScale(cOpts.colorscale) : - cOpts.colorscale; + var colorscale = cOpts.colorscale; + if(cOpts.reversescale) colorscale = Colorscale.flipScale(cOpts.colorscale); return colorscale.map(function(elem) { var index = elem[0]; @@ -78888,7 +79603,7 @@ function parseColorScale(cont, alpha) { var rgb = color.toRgb(); return { index: index, - rgb: [rgb.r, rgb.g, rgb.b, alpha] + rgb: [rgb.r, rgb.g, rgb.b, rgb.a] }; }); } @@ -78898,7 +79613,7 @@ module.exports = { parseColorScale: parseColorScale }; -},{"../components/color/attributes":372,"../components/colorscale":385,"./array":487,"color-normalize":62,"fast-isnumeric":91,"tinycolor2":339}],500:[function(_dereq_,module,exports){ +},{"../components/color/attributes":393,"../components/colorscale":406,"./array":509,"color-normalize":62,"fast-isnumeric":91,"tinycolor2":360}],522:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78914,7 +79629,7 @@ module.exports = { module.exports = function identity(d) { return d; }; -},{}],501:[function(_dereq_,module,exports){ +},{}],523:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78956,7 +79671,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],502:[function(_dereq_,module,exports){ +},{}],524:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79047,8 +79762,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -79104,6 +79822,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -80154,6 +80876,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -80180,13 +80914,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -80204,7 +80936,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":480,"./anchor_utils":485,"./angles":486,"./array":487,"./clean_number":488,"./clear_responsive":490,"./coerce":491,"./dates":492,"./dom":493,"./extend":495,"./filter_unique":496,"./filter_visible":497,"./geometry2d":498,"./identity":500,"./increment":501,"./is_plain_object":503,"./keyed_container":504,"./localize":505,"./loggers":506,"./make_trace_groups":507,"./matrix":508,"./mod":509,"./nested_property":510,"./noop":511,"./notifier":512,"./push_unique":515,"./regex":517,"./relative_attr":518,"./relink_private":519,"./search":520,"./stats":523,"./throttle":526,"./to_log_range":527,"d3":82,"d3-time-format":80,"fast-isnumeric":91}],503:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":502,"./anchor_utils":507,"./angles":508,"./array":509,"./clean_number":510,"./clear_responsive":512,"./coerce":513,"./dates":514,"./dom":515,"./extend":517,"./filter_unique":518,"./filter_visible":519,"./geometry2d":520,"./identity":522,"./increment":523,"./is_plain_object":525,"./keyed_container":526,"./localize":527,"./loggers":528,"./make_trace_groups":529,"./matrix":530,"./mod":531,"./nested_property":532,"./noop":533,"./notifier":534,"./push_unique":537,"./regex":539,"./relative_attr":540,"./relink_private":541,"./search":542,"./stats":545,"./throttle":548,"./to_log_range":549,"d3":82,"d3-time-format":80,"fast-isnumeric":91}],525:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80232,7 +80981,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],504:[function(_dereq_,module,exports){ +},{}],526:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80425,7 +81174,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":510}],505:[function(_dereq_,module,exports){ +},{"./nested_property":532}],527:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80481,7 +81230,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":602}],506:[function(_dereq_,module,exports){ +},{"../registry":625}],528:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80591,7 +81340,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":536,"./notifier":512}],507:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":558,"./notifier":534}],529:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80634,7 +81383,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":82}],508:[function(_dereq_,module,exports){ +},{"d3":82}],530:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80646,6 +81395,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -80721,13 +81471,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -80741,7 +81501,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],509:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":136}],531:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80776,7 +81570,7 @@ module.exports = { modHalf: modHalf }; -},{}],510:[function(_dereq_,module,exports){ +},{}],532:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81022,7 +81816,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":487,"fast-isnumeric":91}],511:[function(_dereq_,module,exports){ +},{"./array":509,"fast-isnumeric":91}],533:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81038,7 +81832,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],512:[function(_dereq_,module,exports){ +},{}],534:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81126,7 +81920,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":82,"fast-isnumeric":91}],513:[function(_dereq_,module,exports){ +},{"d3":82,"fast-isnumeric":91}],535:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81174,7 +81968,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":521}],514:[function(_dereq_,module,exports){ +},{"./setcursor":543}],536:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81426,7 +82220,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":480,"./matrix":508}],515:[function(_dereq_,module,exports){ +},{"../constants/numerical":502,"./matrix":530}],537:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81464,7 +82258,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],516:[function(_dereq_,module,exports){ +},{}],538:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81672,7 +82466,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":502,"../plot_api/plot_config":536}],517:[function(_dereq_,module,exports){ +},{"../lib":524,"../plot_api/plot_config":558}],539:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81702,7 +82496,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],518:[function(_dereq_,module,exports){ +},{}],540:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81755,7 +82549,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],519:[function(_dereq_,module,exports){ +},{}],541:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81812,7 +82606,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":487,"./is_plain_object":503}],520:[function(_dereq_,module,exports){ +},{"./array":509,"./is_plain_object":525}],542:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82017,7 +82811,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":480,"./identity":500,"./loggers":506,"fast-isnumeric":91}],521:[function(_dereq_,module,exports){ +},{"../constants/numerical":502,"./identity":522,"./loggers":528,"fast-isnumeric":91}],543:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82040,7 +82834,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],522:[function(_dereq_,module,exports){ +},{}],544:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82104,7 +82898,7 @@ module.exports = function showNoWebGlMsg(scene) { return false; }; -},{"../components/color":373}],523:[function(_dereq_,module,exports){ +},{"../components/color":394}],545:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82214,7 +83008,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":487,"fast-isnumeric":91}],524:[function(_dereq_,module,exports){ +},{"./array":509,"fast-isnumeric":91}],546:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82235,7 +83029,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"color-normalize":62}],525:[function(_dereq_,module,exports){ +},{"color-normalize":62}],547:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82252,6 +83046,7 @@ module.exports = str2RgbaArray; var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -82366,7 +83161,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -82981,9 +83776,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -83114,7 +83920,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":475,"../constants/xmlns_namespaces":481,"../lib":502,"d3":82}],526:[function(_dereq_,module,exports){ +},{"../constants/alignment":496,"../constants/xmlns_namespaces":503,"../lib":524,"d3":82}],548:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83217,7 +84023,7 @@ function _clearTimeout(cache) { } } -},{}],527:[function(_dereq_,module,exports){ +},{}],549:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83245,7 +84051,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":91}],528:[function(_dereq_,module,exports){ +},{"fast-isnumeric":91}],550:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83267,7 +84073,7 @@ module.exports = { } }; -},{}],529:[function(_dereq_,module,exports){ +},{}],551:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83310,7 +84116,7 @@ module.exports = { } }; -},{}],530:[function(_dereq_,module,exports){ +},{}],552:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83368,7 +84174,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":602}],531:[function(_dereq_,module,exports){ +},{"../registry":625}],553:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83493,7 +84299,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":502}],532:[function(_dereq_,module,exports){ +},{"../lib":524}],554:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -83670,6 +84476,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -83714,7 +84530,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -84185,7 +85001,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":373,"../lib":502,"../plots/cartesian/axis_ids":551,"../plots/plots":593,"../registry":602,"fast-isnumeric":91,"gl-mat4/fromQuat":120}],533:[function(_dereq_,module,exports){ +},{"../components/color":394,"../lib":524,"../plots/cartesian/axis_ids":574,"../plots/plots":616,"../registry":625,"fast-isnumeric":91,"gl-mat4/fromQuat":126}],555:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84228,7 +85044,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":604,"./plot_api":535,"./template_api":540,"./to_image":541,"./validate":542}],534:[function(_dereq_,module,exports){ +},{"../snapshot/download":627,"./plot_api":557,"./template_api":562,"./to_image":563,"./validate":564}],556:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84441,7 +85257,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":503,"../lib/loggers":506,"../lib/noop":511,"../lib/search":520,"../registry":602,"./container_array_match":530}],535:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":525,"../lib/loggers":528,"../lib/noop":533,"../lib/search":542,"../registry":625,"./container_array_match":552}],557:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -84811,7 +85627,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -84825,9 +85652,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -86405,6 +87239,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -86499,7 +87339,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -86589,7 +87429,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -86727,21 +87567,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -88152,6 +88990,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -88159,15 +89010,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -88193,6 +89049,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -88326,7 +89183,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":373,"../components/drawing":395,"../constants/xmlns_namespaces":481,"../lib":502,"../lib/events":494,"../lib/queue":516,"../lib/svg_text_utils":525,"../plots/cartesian/axes":548,"../plots/cartesian/constants":554,"../plots/cartesian/graph_interact":557,"../plots/cartesian/select":567,"../plots/plots":593,"../plots/polar/legacy":596,"../registry":602,"./edit_types":531,"./helpers":532,"./manage_arrays":534,"./plot_config":536,"./plot_schema":537,"./subroutines":539,"d3":82,"fast-isnumeric":91,"has-hover":246}],536:[function(_dereq_,module,exports){ +},{"../components/color":394,"../components/drawing":416,"../constants/xmlns_namespaces":503,"../lib":524,"../lib/events":516,"../lib/queue":538,"../lib/svg_text_utils":547,"../plots/cartesian/axes":571,"../plots/cartesian/constants":577,"../plots/cartesian/graph_interact":580,"../plots/cartesian/select":590,"../plots/plots":616,"../plots/polar/legacy":619,"../registry":625,"./edit_types":553,"./helpers":554,"./manage_arrays":556,"./plot_config":558,"./plot_schema":559,"./subroutines":561,"d3":82,"fast-isnumeric":91,"has-hover":267}],558:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88641,7 +89498,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],537:[function(_dereq_,module,exports){ +},{}],559:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89352,7 +90209,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":502,"../plots/animation_attributes":543,"../plots/attributes":545,"../plots/frame_attributes":577,"../plots/layout_attributes":591,"../plots/polar/legacy/area_attributes":594,"../plots/polar/legacy/axis_attributes":595,"../registry":602,"./edit_types":531,"./plot_config":536}],538:[function(_dereq_,module,exports){ +},{"../lib":524,"../plots/animation_attributes":565,"../plots/attributes":567,"../plots/frame_attributes":600,"../plots/layout_attributes":614,"../plots/polar/legacy/area_attributes":617,"../plots/polar/legacy/axis_attributes":618,"../registry":625,"./edit_types":553,"./plot_config":558}],560:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89664,7 +90521,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":502,"../plots/attributes":545}],539:[function(_dereq_,module,exports){ +},{"../lib":524,"../plots/attributes":567}],561:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89845,7 +90702,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -90334,57 +91191,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - - enforceAxisConstraints(gd); - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; - - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); + + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -90410,7 +91245,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":373,"../components/drawing":395,"../components/modebar":433,"../components/titles":468,"../constants/alignment":475,"../lib":502,"../lib/clear_gl_canvases":489,"../plots/cartesian/autorange":547,"../plots/cartesian/axes":548,"../plots/cartesian/constraints":555,"../plots/plots":593,"../registry":602,"d3":82}],540:[function(_dereq_,module,exports){ +},{"../components/color":394,"../components/drawing":416,"../components/modebar":454,"../components/titles":489,"../constants/alignment":496,"../lib":524,"../lib/clear_gl_canvases":511,"../plots/cartesian/autorange":570,"../plots/cartesian/axes":571,"../plots/cartesian/constraints":578,"../plots/plots":616,"../registry":625,"d3":82}],562:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90872,7 +91707,7 @@ function format(opts) { return opts; } -},{"../lib":502,"../plots/attributes":545,"../plots/plots":593,"./plot_config":536,"./plot_schema":537,"./plot_template":538}],541:[function(_dereq_,module,exports){ +},{"../lib":524,"../plots/attributes":567,"../plots/plots":616,"./plot_config":558,"./plot_schema":559,"./plot_template":560}],563:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90969,7 +91804,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -91093,7 +91928,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":502,"../plots/plots":593,"../snapshot/helpers":606,"../snapshot/svgtoimg":608,"../snapshot/tosvg":610,"../version":678,"./plot_api":535,"fast-isnumeric":91}],542:[function(_dereq_,module,exports){ +},{"../lib":524,"../plots/plots":616,"../snapshot/helpers":629,"../snapshot/svgtoimg":631,"../snapshot/tosvg":633,"../version":702,"./plot_api":557,"fast-isnumeric":91}],564:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91524,7 +92359,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":502,"../plots/plots":593,"./plot_config":536,"./plot_schema":537}],543:[function(_dereq_,module,exports){ +},{"../lib":524,"../plots/plots":616,"./plot_config":558,"./plot_schema":559}],565:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91636,7 +92471,7 @@ module.exports = { } }; -},{}],544:[function(_dereq_,module,exports){ +},{}],566:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91731,7 +92566,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":502,"../plot_api/plot_template":538}],545:[function(_dereq_,module,exports){ +},{"../lib":524,"../plot_api/plot_template":560}],567:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91872,7 +92707,99 @@ module.exports = { } }; -},{"../components/fx/attributes":404}],546:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":425}],568:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":502,"../../lib":524,"fast-isnumeric":91}],569:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91901,7 +92828,7 @@ module.exports = { } }; -},{}],547:[function(_dereq_,module,exports){ +},{}],570:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -91918,6 +92845,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -91958,7 +92887,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -91999,19 +92929,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -92019,9 +92936,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -92039,8 +92956,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -92054,7 +92971,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -92075,7 +92992,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -92084,12 +93001,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -92099,13 +93016,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -92117,7 +93062,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -92146,14 +93181,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -92413,7 +93468,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":480,"../../lib":502,"../../registry":602,"fast-isnumeric":91}],548:[function(_dereq_,module,exports){ +},{"../../constants/numerical":502,"../../lib":524,"../../registry":625,"./axis_ids":574,"fast-isnumeric":91}],571:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92430,6 +93485,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -92463,6 +93519,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -92507,14 +93565,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -92522,6 +93583,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -92546,8 +93622,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -92556,7 +93632,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -92615,7 +93690,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -92937,6 +94014,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -92961,7 +94041,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -92971,6 +94051,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -92984,6 +94068,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -92996,15 +94264,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -93016,85 +94289,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } + var flip = ax._id.charAt(0) === 'y'; - var pos = ax.c2p(tickVal.value); + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -93115,180 +94384,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } - - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -93381,7 +94502,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -93398,15 +94520,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -93519,7 +94643,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -94002,6 +95127,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -94274,21 +95400,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -94389,23 +95517,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -94436,13 +95565,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -94463,7 +95592,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -94479,7 +95608,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -94499,7 +95628,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -94531,7 +95660,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -94543,7 +95672,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -94558,7 +95687,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -94814,21 +95943,81 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; +}; + +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; -}; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} /** * Make axis tick path string @@ -94875,24 +96064,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -94900,42 +96110,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } + + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } - out.xFn = function(d) { return d.dx + x0; }; + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } + + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -95187,6 +96456,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -95204,22 +96475,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -95287,11 +96602,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -95331,6 +96659,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -95812,7 +97160,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":373,"../../components/drawing":395,"../../components/titles":468,"../../constants/alignment":475,"../../constants/numerical":480,"../../lib":502,"../../lib/svg_text_utils":525,"../../plots/plots":593,"../../registry":602,"./autorange":547,"./axis_autotype":549,"./axis_ids":551,"./clean_ticks":553,"./layout_attributes":562,"./set_convert":568,"d3":82,"fast-isnumeric":91}],549:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../components/drawing":416,"../../components/titles":489,"../../constants/alignment":496,"../../constants/numerical":502,"../../lib":524,"../../lib/svg_text_utils":547,"../../plots/plots":616,"../../registry":625,"./autorange":570,"./axis_autotype":572,"./axis_ids":574,"./clean_ticks":576,"./layout_attributes":585,"./set_convert":591,"d3":82,"fast-isnumeric":91}],572:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95829,23 +97177,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; + + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + if(moreDates(a, calendar)) return 'date'; + + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -95858,56 +97232,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":480,"../../lib":502,"fast-isnumeric":91}],550:[function(_dereq_,module,exports){ +},{"../../constants/numerical":502,"../../lib":524,"fast-isnumeric":91}],573:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95964,9 +97348,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -96024,7 +97432,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -96036,8 +97447,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -96190,7 +97599,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":502,"../../registry":602,"../array_container_defaults":544,"./category_order_defaults":552,"./constants":554,"./layout_attributes":562,"./line_grid_defaults":564,"./set_convert":568,"./tick_label_defaults":569,"./tick_mark_defaults":570,"./tick_value_defaults":571,"fast-isnumeric":91}],551:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625,"../array_container_defaults":566,"./category_order_defaults":575,"./constants":577,"./layout_attributes":585,"./line_grid_defaults":587,"./set_convert":591,"./tick_label_defaults":592,"./tick_mark_defaults":593,"./tick_value_defaults":594,"fast-isnumeric":91}],574:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96211,7 +97620,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -96223,13 +97632,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -96275,6 +97691,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -96307,17 +97725,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":602,"./constants":554}],552:[function(_dereq_,module,exports){ +},{"../../registry":625,"./constants":577}],575:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96411,7 +97833,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],553:[function(_dereq_,module,exports){ +},{}],576:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96424,7 +97846,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -96489,7 +97913,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -96499,7 +97925,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":480,"../../lib":502,"fast-isnumeric":91}],554:[function(_dereq_,module,exports){ +},{"../../constants/numerical":502,"../../lib":524,"fast-isnumeric":91}],577:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96514,8 +97940,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -96527,7 +97953,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -96591,7 +98017,7 @@ module.exports = { } }; -},{"../../lib/regex":517}],555:[function(_dereq_,module,exports){ +},{"../../lib/regex":539}],578:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96603,74 +98029,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; + + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } + + var canLink = linkableAxes.length; + + var matches, scaleanchor; + + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -96681,64 +98313,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; +} - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -96747,12 +98354,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -96765,38 +98374,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); } } - thisGroup[scaleanchor] = 1; + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } + } + + out[key] = val; + } + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -96905,25 +98585,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -96945,6 +98626,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -96977,7 +98668,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":475,"../../constants/numerical":480,"../../lib":502,"./autorange":547,"./axis_ids":551,"./scale_zoom":566}],556:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496,"../../constants/numerical":502,"../../lib":524,"./autorange":570,"./axis_ids":574,"./layout_attributes":585,"./scale_zoom":589,"./set_convert":591}],579:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96994,6 +98685,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -97070,6 +98762,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -97101,10 +98796,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -97141,6 +98837,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -97306,6 +99005,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -97323,8 +99028,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -97524,6 +99229,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -97533,6 +99240,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -97541,7 +99264,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -97572,15 +99295,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -97589,12 +99314,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -97604,7 +99333,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -97614,9 +99343,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -97816,15 +99560,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -97840,7 +99584,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -98052,7 +99796,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -98065,7 +99809,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -98130,11 +99874,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -98145,14 +99891,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -98162,7 +99916,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -98249,7 +100006,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":373,"../../components/dragelement":392,"../../components/dragelement/helpers":391,"../../components/drawing":395,"../../components/fx":413,"../../constants/alignment":475,"../../lib":502,"../../lib/clear_gl_canvases":489,"../../lib/setcursor":521,"../../lib/svg_text_utils":525,"../../plot_api/subroutines":539,"../../registry":602,"../plots":593,"./axes":548,"./axis_ids":551,"./constants":554,"./scale_zoom":566,"./select":567,"d3":82,"has-passive-events":247,"tinycolor2":339}],557:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../components/dragelement":413,"../../components/dragelement/helpers":412,"../../components/drawing":416,"../../components/fx":434,"../../constants/alignment":496,"../../lib":524,"../../lib/clear_gl_canvases":511,"../../lib/setcursor":543,"../../lib/svg_text_utils":547,"../../plot_api/subroutines":561,"../../registry":625,"../plots":616,"./axes":571,"./axis_ids":574,"./constants":577,"./scale_zoom":589,"./select":590,"d3":82,"has-passive-events":268,"tinycolor2":360}],580:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98417,7 +100174,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":392,"../../components/fx":413,"../../lib/setcursor":521,"./constants":554,"./dragbox":556,"d3":82}],558:[function(_dereq_,module,exports){ +},{"../../components/dragelement":413,"../../components/fx":434,"../../lib/setcursor":543,"./constants":577,"./dragbox":579,"d3":82}],581:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98453,7 +100210,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],559:[function(_dereq_,module,exports){ +},{}],582:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98465,6 +100222,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -98495,9 +100254,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -98507,7 +100267,7 @@ module.exports = { getTransform: getTransform }; -},{}],560:[function(_dereq_,module,exports){ +},{"../../lib":524}],583:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98521,6 +100281,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -98550,8 +100311,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -98582,7 +100345,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":502,"../../registry":602}],561:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625,"./axis_ids":574}],584:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98920,6 +100683,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -99199,7 +100963,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":395,"../../constants/xmlns_namespaces":481,"../../lib":502,"../../registry":602,"../get_data":578,"../plots":593,"./attributes":546,"./axis_ids":551,"./constants":554,"./graph_interact":557,"./layout_attributes":562,"./layout_defaults":563,"./transition_axes":572,"d3":82}],562:[function(_dereq_,module,exports){ +},{"../../components/drawing":416,"../../constants/xmlns_namespaces":503,"../../lib":524,"../../registry":625,"../get_data":601,"../plots":616,"./attributes":569,"./axis_ids":574,"./constants":577,"./graph_interact":580,"./layout_attributes":585,"./layout_defaults":586,"./transition_axes":595,"d3":82}],585:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99272,6 +101036,14 @@ module.exports = { // type in the template explicitly it will be honored as the default. _noTemplating: true, + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, autorange: { valType: 'enumerated', @@ -99332,7 +101104,6 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', editType: 'plot', @@ -99496,6 +101267,22 @@ module.exports = { editType: 'ticks', + }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + editType: 'calc', + }, mirror: { valType: 'enumerated', @@ -99636,6 +101423,14 @@ module.exports = { editType: 'ticks', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'ticks', + }, separatethousands: { valType: 'boolean', @@ -99888,7 +101683,7 @@ module.exports = { } }; -},{"../../components/color/attributes":372,"../../components/drawing/attributes":394,"../../constants/docs":476,"../../constants/numerical":480,"../../lib/extend":495,"../../plot_api/plot_template":538,"../font_attributes":576,"./constants":554}],563:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":393,"../../components/drawing/attributes":415,"../../constants/docs":498,"../../constants/numerical":502,"../../lib/extend":517,"../../plot_api/plot_template":560,"../font_attributes":599,"./constants":577}],586:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99910,7 +101705,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -99929,6 +101724,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -100137,6 +101934,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -100201,6 +101999,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -100265,101 +102064,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":373,"../../components/fx/helpers":409,"../../components/fx/hovermode_defaults":412,"../../lib":502,"../../plot_api/plot_template":538,"../../registry":602,"../layout_attributes":591,"./axis_defaults":550,"./axis_ids":551,"./constants":554,"./constraints":555,"./layout_attributes":562,"./position_defaults":565,"./type_defaults":573}],564:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../components/fx/helpers":430,"../../components/fx/hovermode_defaults":433,"../../lib":524,"../../plot_api/plot_template":560,"../../registry":625,"../layout_attributes":614,"./axis_defaults":573,"./axis_ids":574,"./constants":577,"./constraints":578,"./layout_attributes":585,"./position_defaults":588,"./type_defaults":596}],587:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100424,7 +102135,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":372,"../../lib":502,"tinycolor2":339}],565:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":393,"../../lib":524,"tinycolor2":360}],588:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100512,7 +102223,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":502,"fast-isnumeric":91}],566:[function(_dereq_,module,exports){ +},{"../../lib":524,"fast-isnumeric":91}],589:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100538,9 +102249,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":475}],567:[function(_dereq_,module,exports){ +},{"../../constants/alignment":496}],590:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100610,6 +102322,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -100699,8 +102419,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -101475,7 +103195,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":373,"../../components/dragelement/helpers":391,"../../components/drawing":395,"../../components/fx":413,"../../components/fx/helpers":409,"../../components/shapes/draw_newshape/display_outlines":458,"../../components/shapes/draw_newshape/helpers":459,"../../components/shapes/draw_newshape/newshapes":460,"../../lib":502,"../../lib/clear_gl_canvases":489,"../../lib/polygon":514,"../../lib/throttle":526,"../../plot_api/subroutines":539,"../../registry":602,"./axis_ids":551,"./constants":554,"./handle_outline":558,"./helpers":559,"polybooljs":295}],568:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../components/dragelement/helpers":412,"../../components/drawing":416,"../../components/fx":434,"../../components/fx/helpers":430,"../../components/shapes/draw_newshape/display_outlines":479,"../../components/shapes/draw_newshape/helpers":480,"../../components/shapes/draw_newshape/newshapes":481,"../../lib":524,"../../lib/clear_gl_canvases":511,"../../lib/polygon":536,"../../lib/throttle":548,"../../plot_api/subroutines":561,"../../registry":625,"./axis_ids":574,"./constants":577,"./handle_outline":581,"./helpers":582,"polybooljs":316}],591:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101508,7 +103228,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -101664,6 +103383,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -101795,12 +103518,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -101843,17 +103566,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -102357,38 +104075,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -102447,7 +104153,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":480,"../../lib":502,"./axis_ids":551,"./constants":554,"d3":82,"d3-time-format":80,"fast-isnumeric":91}],569:[function(_dereq_,module,exports){ +},{"../../constants/numerical":502,"../../lib":524,"./axis_ids":574,"./constants":577,"d3":82,"d3-time-format":80,"fast-isnumeric":91}],592:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102460,6 +104166,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -102496,10 +104203,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -102522,6 +104233,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -102568,7 +104280,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":502,"../array_container_defaults":544,"./layout_attributes":562}],570:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../lib":524,"../array_container_defaults":566,"./layout_attributes":585}],593:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102601,7 +104313,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":502,"./layout_attributes":562}],571:[function(_dereq_,module,exports){ +},{"../../lib":524,"./layout_attributes":585}],594:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102648,7 +104360,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":502,"./clean_ticks":553}],572:[function(_dereq_,module,exports){ +},{"../../lib":524,"./clean_ticks":576}],595:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102861,7 +104573,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":395,"../../lib":502,"../../registry":602,"./axes":548,"d3":82}],573:[function(_dereq_,module,exports){ +},{"../../components/drawing":416,"../../lib":524,"../../registry":625,"./axes":571,"d3":82}],596:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102880,6 +104592,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -102932,6 +104645,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -102998,7 +104713,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":602,"./axis_autotype":549}],574:[function(_dereq_,module,exports){ +},{"../../registry":625,"./axis_autotype":572}],597:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103425,7 +105140,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":502,"../registry":602}],575:[function(_dereq_,module,exports){ +},{"../lib":524,"../registry":625}],598:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103537,7 +105252,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":495}],576:[function(_dereq_,module,exports){ +},{"../lib/extend":517}],599:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103602,7 +105317,7 @@ module.exports = function(opts) { return attrs; }; -},{}],577:[function(_dereq_,module,exports){ +},{}],600:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103648,7 +105363,7 @@ module.exports = { } }; -},{}],578:[function(_dereq_,module,exports){ +},{}],601:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103777,7 +105492,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":602,"./cartesian/constants":554}],579:[function(_dereq_,module,exports){ +},{"../registry":625,"./cartesian/constants":577}],602:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103937,7 +105652,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/fx/layout_attributes":414,"../../constants/xmlns_namespaces":481,"../../lib":502,"../../plot_api/edit_types":531,"../get_data":578,"./layout/attributes":580,"./layout/defaults":584,"./layout/layout_attributes":585,"./scene":589}],580:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":435,"../../constants/xmlns_namespaces":503,"../../lib":524,"../../plot_api/edit_types":553,"../get_data":601,"./layout/attributes":603,"./layout/defaults":607,"./layout/layout_attributes":608,"./scene":612}],603:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103959,7 +105674,7 @@ module.exports = { } }; -},{}],581:[function(_dereq_,module,exports){ +},{}],604:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104030,6 +105745,7 @@ module.exports = overrideAll({ type: extendFlat({}, axesAttrs.type, { values: ['-', 'linear', 'log', 'date', 'category'] }), + autotypenumbers: axesAttrs.autotypenumbers, autorange: axesAttrs.autorange, rangemode: axesAttrs.rangemode, range: extendFlat({}, axesAttrs.range, { @@ -104060,6 +105776,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickformat: axesAttrs.tickformat, tickformatstops: axesAttrs.tickformatstops, @@ -104081,7 +105798,7 @@ module.exports = overrideAll({ } }, 'plot', 'from-root'); -},{"../../../components/color":373,"../../../lib/extend":495,"../../../plot_api/edit_types":531,"../../cartesian/layout_attributes":562}],582:[function(_dereq_,module,exports){ +},{"../../../components/color":394,"../../../lib/extend":517,"../../../plot_api/edit_types":553,"../../cartesian/layout_attributes":585}],605:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104136,6 +105853,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { showGrid: true, noTickson: true, noTicklabelmode: true, + noTicklabelposition: true, bgColor: options.bgColor, calendar: options.calendar }, @@ -104157,7 +105875,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":502,"../../../plot_api/plot_template":538,"../../cartesian/axis_defaults":550,"../../cartesian/type_defaults":573,"./axis_attributes":581,"tinycolor2":339}],583:[function(_dereq_,module,exports){ +},{"../../../lib":524,"../../../plot_api/plot_template":560,"../../cartesian/axis_defaults":573,"../../cartesian/type_defaults":596,"./axis_attributes":604,"tinycolor2":360}],606:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104322,7 +106040,7 @@ function createAxesOptions(fullLayout, sceneLayout) { module.exports = createAxesOptions; -},{"../../../lib":502,"../../../lib/str2rgbarray":524}],584:[function(_dereq_,module,exports){ +},{"../../../lib":524,"../../../lib/str2rgbarray":546}],607:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104365,6 +106083,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { font: layoutOut.font, fullData: fullData, getDfltFromLayout: getDfltFromLayout, + autotypenumbersDflt: layoutOut.autotypenumbers, paper_bgcolor: layoutOut.paper_bgcolor, calendar: layoutOut.calendar }); @@ -104434,6 +106153,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { data: fullGl3dData, bgColor: bgColorCombined, calendar: opts.calendar, + autotypenumbersDflt: opts.autotypenumbersDflt, fullLayout: opts.fullLayout }); @@ -104470,7 +106190,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":373,"../../../lib":502,"../../../registry":602,"../../get_data":578,"../../subplot_defaults":600,"./axis_defaults":582,"./layout_attributes":585}],585:[function(_dereq_,module,exports){ +},{"../../../components/color":394,"../../../lib":524,"../../../registry":625,"../../get_data":601,"../../subplot_defaults":623,"./axis_defaults":605,"./layout_attributes":608}],608:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104621,7 +106341,7 @@ module.exports = { } }; -},{"../../../lib":502,"../../../lib/extend":495,"../../domain":575,"./axis_attributes":581}],586:[function(_dereq_,module,exports){ +},{"../../../lib":524,"../../../lib/extend":517,"../../domain":598,"./axis_attributes":604}],609:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104673,7 +106393,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":524}],587:[function(_dereq_,module,exports){ +},{"../../../lib/str2rgbarray":546}],610:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104774,7 +106494,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":502,"../../cartesian/axes":548}],588:[function(_dereq_,module,exports){ +},{"../../../lib":524,"../../cartesian/axes":571}],611:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104808,7 +106528,7 @@ function project(camera, v) { module.exports = project; -},{}],589:[function(_dereq_,module,exports){ +},{}],612:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104947,6 +106667,8 @@ proto.prepareOptions = function() { return opts; }; +var firstInit = true; + proto.tryCreatePlot = function() { var scene = this; @@ -104957,7 +106679,7 @@ proto.tryCreatePlot = function() { try { scene.glplot = createPlot(opts); } catch(e) { - if(scene.staticMode) { + if(scene.staticMode || !firstInit) { success = false; } else { // try second time try { @@ -104969,15 +106691,22 @@ proto.tryCreatePlot = function() { 'The device may not be supported by is-mobile module!', 'Inverting preserveDrawingBuffer option in second attempt to create webgl scene.' ].join(' ')); + + // invert is-mobile isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; scene.glplot = createPlot(opts); } catch(e) { + // revert changes to is-mobile + isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; + success = false; } } } + firstInit = false; + return success; }; @@ -105049,43 +106778,45 @@ proto.initializeGLPlot = function() { scene.graphDiv.emit('plotly_relayout', update); }; - scene.glplot.canvas.addEventListener('mouseup', function() { - relayoutCallback(scene); - }); + if(scene.glplot.canvas) { + scene.glplot.canvas.addEventListener('mouseup', function() { + relayoutCallback(scene); + }); - scene.glplot.canvas.addEventListener('wheel', function(e) { - if(gd._context._scrollZoom.gl3d) { - if(scene.camera._ortho) { - var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1; - var o = scene.glplot.getAspectratio(); - scene.glplot.setAspectratio({ - x: s * o.x, - y: s * o.y, - z: s * o.z - }); - } + scene.glplot.canvas.addEventListener('wheel', function(e) { + if(gd._context._scrollZoom.gl3d) { + if(scene.camera._ortho) { + var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1; + var o = scene.glplot.getAspectratio(); + scene.glplot.setAspectratio({ + x: s * o.x, + y: s * o.y, + z: s * o.z + }); + } - relayoutCallback(scene); - } - }, passiveSupported ? {passive: false} : false); + relayoutCallback(scene); + } + }, passiveSupported ? {passive: false} : false); - scene.glplot.canvas.addEventListener('mousemove', function() { - if(scene.fullSceneLayout.dragmode === false) return; - if(scene.camera.mouseListener.buttons === 0) return; + scene.glplot.canvas.addEventListener('mousemove', function() { + if(scene.fullSceneLayout.dragmode === false) return; + if(scene.camera.mouseListener.buttons === 0) return; - var update = makeUpdate(); - scene.graphDiv.emit('plotly_relayouting', update); - }); + var update = makeUpdate(); + scene.graphDiv.emit('plotly_relayouting', update); + }); - if(!scene.staticMode) { - scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { - if(gd && gd.emit) { - gd.emit('plotly_webglcontextlost', { - event: event, - layer: scene.id - }); - } - }, false); + if(!scene.staticMode) { + scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { + if(gd && gd.emit) { + gd.emit('plotly_webglcontextlost', { + event: event, + layer: scene.id + }); + } + }, false); + } } scene.glplot.oncontextloss = function() { @@ -105107,8 +106838,12 @@ proto.render = function() { // update size of svg container var svgContainer = scene.svgContainer; var clientRect = scene.container.getBoundingClientRect(); - var width = clientRect.width; - var height = clientRect.height; + + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var width = clientRect.width * scaleX; + var height = clientRect.height * scaleY; svgContainer.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height); svgContainer.setAttributeNS(null, 'width', width); svgContainer.setAttributeNS(null, 'height', height); @@ -105932,7 +107667,7 @@ proto.make4thDimension = function() { module.exports = Scene; -},{"../../components/fx":413,"../../lib":502,"../../lib/show_no_webgl_msg":522,"../../lib/str2rgbarray":524,"../../plots/cartesian/axes":548,"../../registry":602,"./layout/convert":583,"./layout/spikes":586,"./layout/tick_marks":587,"./project":588,"gl-plot3d":140,"has-passive-events":247,"is-mobile":256,"webgl-context":354}],590:[function(_dereq_,module,exports){ +},{"../../components/fx":434,"../../lib":524,"../../lib/show_no_webgl_msg":544,"../../lib/str2rgbarray":546,"../../plots/cartesian/axes":571,"../../registry":625,"./layout/convert":606,"./layout/spikes":609,"./layout/tick_marks":610,"./project":611,"gl-plot3d":158,"has-passive-events":268,"is-mobile":277,"webgl-context":375}],613:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105953,7 +107688,7 @@ module.exports = function zip3(x, y, z, len) { return result; }; -},{}],591:[function(_dereq_,module,exports){ +},{}],614:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106141,6 +107876,12 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + + editType: 'none', + + }, paper_bgcolor: { valType: 'color', @@ -106156,6 +107897,14 @@ module.exports = { dflt: colorAttrs.background, editType: 'layoutstyle', + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, separators: { valType: 'string', @@ -106280,7 +108029,7 @@ module.exports = { } }; -},{"../components/color/attributes":372,"../components/shapes/draw_newshape/attributes":455,"../lib/extend":495,"./animation_attributes":543,"./font_attributes":576,"./pad_attributes":592}],592:[function(_dereq_,module,exports){ +},{"../components/color/attributes":393,"../components/shapes/draw_newshape/attributes":476,"../lib/extend":517,"./animation_attributes":565,"./font_attributes":599,"./pad_attributes":615}],615:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106335,7 +108084,7 @@ module.exports = function(opts) { }; }; -},{}],593:[function(_dereq_,module,exports){ +},{}],616:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107005,7 +108754,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -107814,6 +109563,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -108202,6 +109953,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -108219,6 +109973,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -108238,13 +109996,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -108269,6 +110029,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -108283,8 +110048,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -108316,11 +110079,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -108330,11 +110092,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -108344,6 +110105,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -108370,11 +110143,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -108498,7 +110284,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -109398,6 +111197,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -109408,7 +111210,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -109418,27 +111219,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -109447,18 +111249,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -109481,16 +111279,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -109532,12 +111333,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -109546,13 +111343,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -109674,7 +111472,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":373,"../constants/numerical":480,"../lib":502,"../plot_api/plot_schema":537,"../plot_api/plot_template":538,"../plots/get_data":578,"../registry":602,"./animation_attributes":543,"./attributes":545,"./cartesian/axis_ids":551,"./cartesian/handle_outline":558,"./command":574,"./font_attributes":576,"./frame_attributes":577,"./layout_attributes":591,"d3":82,"d3-time-format":80,"fast-isnumeric":91}],594:[function(_dereq_,module,exports){ +},{"../components/color":394,"../constants/numerical":502,"../lib":524,"../plot_api/plot_schema":559,"../plot_api/plot_template":560,"../plots/get_data":601,"../registry":625,"./animation_attributes":565,"./attributes":567,"./cartesian/axis_ids":574,"./cartesian/handle_outline":581,"./command":597,"./font_attributes":599,"./frame_attributes":600,"./layout_attributes":614,"d3":82,"d3-time-format":80,"fast-isnumeric":91}],617:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109718,7 +111516,7 @@ module.exports = { } }; -},{"../../../lib/extend":495,"../../../traces/scatter/attributes":631}],595:[function(_dereq_,module,exports){ +},{"../../../lib/extend":517,"../../../traces/scatter/attributes":654}],618:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109840,7 +111638,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":495,"../../../plot_api/edit_types":531,"../../cartesian/layout_attributes":562}],596:[function(_dereq_,module,exports){ +},{"../../../lib/extend":517,"../../../plot_api/edit_types":553,"../../cartesian/layout_attributes":585}],619:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109855,7 +111653,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":597,"./micropolar_manager":598}],597:[function(_dereq_,module,exports){ +},{"./micropolar":620,"./micropolar_manager":621}],620:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111275,7 +113073,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":475,"../../../lib":502,"d3":82}],598:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":496,"../../../lib":524,"d3":82}],621:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111361,7 +113159,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":373,"../../../lib":502,"./micropolar":597,"./undo_manager":599,"d3":82}],599:[function(_dereq_,module,exports){ +},{"../../../components/color":394,"../../../lib":524,"./micropolar":620,"./undo_manager":622,"d3":82}],622:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111427,7 +113225,7 @@ module.exports = function UndoManager() { }; }; -},{}],600:[function(_dereq_,module,exports){ +},{}],623:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111512,7 +113310,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":502,"../plot_api/plot_template":538,"./domain":575}],601:[function(_dereq_,module,exports){ +},{"../lib":524,"../plot_api/plot_template":560,"./domain":598}],624:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111595,7 +113393,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":476}],602:[function(_dereq_,module,exports){ +},{"../constants/docs":498}],625:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112061,7 +113859,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":493,"./lib/extend":495,"./lib/is_plain_object":503,"./lib/loggers":506,"./lib/noop":511,"./lib/push_unique":515,"./plots/attributes":545,"./plots/layout_attributes":591}],603:[function(_dereq_,module,exports){ +},{"./lib/dom":515,"./lib/extend":517,"./lib/is_plain_object":525,"./lib/loggers":528,"./lib/noop":533,"./lib/push_unique":537,"./plots/attributes":567,"./plots/layout_attributes":614}],626:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112234,7 +114032,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":502,"../registry":602}],604:[function(_dereq_,module,exports){ +},{"../lib":524,"../registry":625}],627:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112268,6 +114066,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -112304,7 +114104,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":502,"../plot_api/to_image":541,"./filesaver":605,"./helpers":606}],605:[function(_dereq_,module,exports){ +},{"../lib":524,"../plot_api/to_image":563,"./filesaver":628,"./helpers":629}],628:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112384,7 +114184,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":502,"./helpers":606}],606:[function(_dereq_,module,exports){ +},{"../lib":524,"./helpers":629}],629:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112467,7 +114267,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":602}],607:[function(_dereq_,module,exports){ +},{"../registry":625}],630:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112493,7 +114293,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":603,"./download":604,"./helpers":606,"./svgtoimg":608,"./toimage":609,"./tosvg":610}],608:[function(_dereq_,module,exports){ +},{"./cloneplot":626,"./download":627,"./helpers":629,"./svgtoimg":631,"./toimage":632,"./tosvg":633}],631:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112620,7 +114420,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":502,"./helpers":606,"events":48}],609:[function(_dereq_,module,exports){ +},{"../lib":524,"./helpers":629,"events":48}],632:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112697,7 +114497,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":502,"../registry":602,"./cloneplot":603,"./helpers":606,"./svgtoimg":608,"./tosvg":610,"events":48}],610:[function(_dereq_,module,exports){ +},{"../lib":524,"../registry":625,"./cloneplot":626,"./helpers":629,"./svgtoimg":631,"./tosvg":633,"events":48}],633:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112886,7 +114686,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":373,"../components/drawing":395,"../constants/xmlns_namespaces":481,"../lib":502,"d3":82}],611:[function(_dereq_,module,exports){ +},{"../components/color":394,"../components/drawing":416,"../constants/xmlns_namespaces":503,"../lib":524,"d3":82}],634:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113049,7 +114849,7 @@ attrs.transforms = undefined; module.exports = attrs; -},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plots/attributes":545,"../../plots/template_attributes":601,"../mesh3d/attributes":623}],612:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plots/attributes":567,"../../plots/template_attributes":624,"../mesh3d/attributes":646}],635:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113093,7 +114893,7 @@ module.exports = function calc(gd, trace) { }); }; -},{"../../components/colorscale/calc":381}],613:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":402}],636:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113240,7 +115040,7 @@ function createConeTrace(scene, data) { module.exports = createConeTrace; -},{"../../components/colorscale":385,"../../lib":502,"../../lib/gl_format_color":499,"../../plots/gl3d/zip3":590,"gl-cone3d":106}],614:[function(_dereq_,module,exports){ +},{"../../components/colorscale":406,"../../lib":524,"../../lib/gl_format_color":521,"../../plots/gl3d/zip3":613,"gl-cone3d":107}],637:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113302,7 +115102,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":383,"../../lib":502,"./attributes":611}],615:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":404,"../../lib":524,"./attributes":634}],638:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113337,7 +115137,7 @@ module.exports = { } }; -},{"../../plots/gl3d":579,"./attributes":611,"./calc":612,"./convert":613,"./defaults":614}],616:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":602,"./attributes":634,"./calc":635,"./convert":636,"./defaults":637}],639:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113442,7 +115242,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"../../lib":502}],617:[function(_dereq_,module,exports){ +},{"../../lib":524}],640:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113575,7 +115375,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":502}],618:[function(_dereq_,module,exports){ +},{"../../lib":524}],641:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113769,7 +115569,7 @@ attrs.flatshading.dflt = true; attrs.lighting.facenormalsepsilon.dflt = 0; attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plot_api/edit_types":531,"../../plots/attributes":545,"../../plots/template_attributes":601,"../mesh3d/attributes":623}],619:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plot_api/edit_types":553,"../../plots/attributes":567,"../../plots/template_attributes":624,"../mesh3d/attributes":646}],642:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113824,7 +115624,7 @@ module.exports = function calc(gd, trace) { }); }; -},{"../../components/colorscale/calc":381,"../streamtube/calc":665}],620:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":402,"../streamtube/calc":689}],643:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114880,7 +116680,7 @@ module.exports = { createIsosurfaceTrace: createIsosurfaceTrace, }; -},{"../../components/colorscale":385,"../../lib/gl_format_color":499,"../../lib/str2rgbarray":524,"../../plots/gl3d/zip3":590,"gl-mesh3d":137}],621:[function(_dereq_,module,exports){ +},{"../../components/colorscale":406,"../../lib/gl_format_color":521,"../../lib/str2rgbarray":546,"../../plots/gl3d/zip3":613,"gl-mesh3d":153}],644:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114997,7 +116797,7 @@ module.exports = { supplyIsoDefaults: supplyIsoDefaults }; -},{"../../components/colorscale/defaults":383,"../../lib":502,"../../registry":602,"./attributes":618}],622:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":404,"../../lib":524,"../../registry":625,"./attributes":641}],645:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115027,7 +116827,7 @@ module.exports = { } }; -},{"../../plots/gl3d":579,"./attributes":618,"./calc":619,"./convert":620,"./defaults":621}],623:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":602,"./attributes":641,"./calc":642,"./convert":643,"./defaults":644}],646:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115208,7 +117008,7 @@ colorScaleAttrs('', { showlegend: extendFlat({}, baseAttrs.showlegend, {dflt: false}) }); -},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plots/attributes":545,"../../plots/template_attributes":601,"../surface/attributes":669}],624:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plots/attributes":567,"../../plots/template_attributes":624,"../surface/attributes":693}],647:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115231,7 +117031,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":381}],625:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":402}],648:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115434,7 +117234,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../components/colorscale":385,"../../lib/gl_format_color":499,"../../lib/str2rgbarray":524,"../../plots/gl3d/zip3":590,"alpha-shape":16,"convex-hull":72,"delaunay-triangulate":84,"gl-mesh3d":137}],626:[function(_dereq_,module,exports){ +},{"../../components/colorscale":406,"../../lib/gl_format_color":521,"../../lib/str2rgbarray":546,"../../plots/gl3d/zip3":613,"alpha-shape":16,"convex-hull":72,"delaunay-triangulate":84,"gl-mesh3d":153}],649:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115536,7 +117336,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":383,"../../lib":502,"../../registry":602,"./attributes":623}],627:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":404,"../../lib":524,"../../registry":625,"./attributes":646}],650:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115566,7 +117366,7 @@ module.exports = { } }; -},{"../../plots/gl3d":579,"./attributes":623,"./calc":624,"./convert":625,"./defaults":626}],628:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":602,"./attributes":646,"./calc":647,"./convert":648,"./defaults":649}],651:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115579,19 +117379,21 @@ module.exports = { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -115608,7 +117410,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":502}],629:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":524}],652:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115632,7 +117438,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":373,"./helpers":628}],630:[function(_dereq_,module,exports){ +},{"../../components/color":394,"./helpers":651}],653:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115684,7 +117490,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":502}],631:[function(_dereq_,module,exports){ +},{"../../lib":524}],654:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115703,8 +117509,41 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + + editType: 'calc', + + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + + editType: 'calc', + + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + + editType: 'calc', + + }; +} + module.exports = { x: { valType: 'data_array', @@ -115751,6 +117590,13 @@ module.exports = { }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', @@ -116098,7 +117944,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":380,"../../components/drawing":395,"../../components/drawing/attributes":394,"../../lib/extend":495,"../../plots/font_attributes":576,"../../plots/template_attributes":601,"./constants":635}],632:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":401,"../../components/drawing":416,"../../components/drawing/attributes":415,"../../lib/extend":517,"../../plots/font_attributes":599,"../../plots/template_attributes":624,"./constants":658}],655:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116113,6 +117959,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -116124,8 +117971,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -116156,6 +118006,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -116163,6 +118016,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -116383,7 +118243,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":480,"../../lib":502,"../../plots/cartesian/axes":548,"./arrays_to_calcdata":630,"./calc_selection":633,"./colorscale_calc":634,"./subtypes":655,"fast-isnumeric":91}],633:[function(_dereq_,module,exports){ +},{"../../constants/numerical":502,"../../lib":524,"../../plots/cartesian/align_period":568,"../../plots/cartesian/axes":571,"./arrays_to_calcdata":653,"./calc_selection":656,"./colorscale_calc":657,"./subtypes":679,"fast-isnumeric":91}],656:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116402,7 +118262,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":502}],634:[function(_dereq_,module,exports){ +},{"../../lib":524}],657:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116445,7 +118305,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":381,"../../components/colorscale/helpers":384,"./subtypes":655}],635:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":402,"../../components/colorscale/helpers":405,"./subtypes":679}],658:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116474,7 +118334,7 @@ module.exports = { eventDataKeys: [] }; -},{}],636:[function(_dereq_,module,exports){ +},{}],659:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116655,7 +118515,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":632}],637:[function(_dereq_,module,exports){ +},{"./calc":655}],660:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116694,7 +118554,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],638:[function(_dereq_,module,exports){ +},{}],661:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116712,6 +118572,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -116729,6 +118590,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -116784,7 +118647,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":502,"../../registry":602,"./attributes":631,"./constants":635,"./fillcolor_defaults":639,"./line_defaults":644,"./line_shape_defaults":646,"./marker_defaults":650,"./stack_defaults":653,"./subtypes":655,"./text_defaults":656,"./xy_defaults":657}],639:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625,"./attributes":654,"./constants":658,"./fillcolor_defaults":662,"./line_defaults":667,"./line_shape_defaults":669,"./marker_defaults":673,"./period_defaults":674,"./stack_defaults":677,"./subtypes":679,"./text_defaults":680,"./xy_defaults":681}],662:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116821,7 +118684,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":373,"../../lib":502}],640:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../lib":524}],663:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116847,7 +118710,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":548}],641:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":571}],664:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116896,7 +118759,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":373,"./subtypes":655}],642:[function(_dereq_,module,exports){ +},{"../../components/color":394,"./subtypes":679}],665:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116977,8 +118840,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -117091,7 +118954,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":373,"../../components/fx":413,"../../lib":502,"../../registry":602,"./get_trace_color":641}],643:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../components/fx":434,"../../lib":524,"../../registry":625,"./get_trace_color":664}],666:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117137,7 +119000,7 @@ module.exports = { } }; -},{"../../plots/cartesian":561,"./arrays_to_calcdata":630,"./attributes":631,"./calc":632,"./cross_trace_calc":636,"./cross_trace_defaults":637,"./defaults":638,"./format_labels":640,"./hover":642,"./marker_colorbar":649,"./plot":651,"./select":652,"./style":654,"./subtypes":655}],644:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":584,"./arrays_to_calcdata":653,"./attributes":654,"./calc":655,"./cross_trace_calc":659,"./cross_trace_defaults":660,"./defaults":661,"./format_labels":663,"./hover":665,"./marker_colorbar":672,"./plot":675,"./select":676,"./style":678,"./subtypes":679}],667:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117168,7 +119031,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":383,"../../components/colorscale/helpers":384,"../../lib":502}],645:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":404,"../../components/colorscale/helpers":405,"../../lib":524}],668:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117629,7 +119492,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":480,"../../lib":502,"./constants":635}],646:[function(_dereq_,module,exports){ +},{"../../constants/numerical":502,"../../lib":524,"./constants":658}],669:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117648,7 +119511,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],647:[function(_dereq_,module,exports){ +},{}],670:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117738,7 +119601,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],648:[function(_dereq_,module,exports){ +},{}],671:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117780,7 +119643,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":91}],649:[function(_dereq_,module,exports){ +},{"fast-isnumeric":91}],672:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117798,7 +119661,7 @@ module.exports = { max: 'cmax' }; -},{}],650:[function(_dereq_,module,exports){ +},{}],673:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117879,7 +119742,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":373,"../../components/colorscale/defaults":383,"../../components/colorscale/helpers":384,"./subtypes":655}],651:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../components/colorscale/defaults":404,"../../components/colorscale/helpers":405,"./subtypes":679}],674:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":502,"../../lib":524}],675:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118440,7 +120350,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":395,"../../lib":502,"../../lib/polygon":514,"../../registry":602,"./line_points":645,"./link_traces":647,"./subtypes":655,"d3":82}],652:[function(_dereq_,module,exports){ +},{"../../components/drawing":416,"../../lib":524,"../../lib/polygon":536,"../../registry":625,"./line_points":668,"./link_traces":670,"./subtypes":679,"d3":82}],676:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118494,7 +120404,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":655}],653:[function(_dereq_,module,exports){ +},{"./subtypes":679}],677:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118599,7 +120509,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],654:[function(_dereq_,module,exports){ +},{}],678:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118670,7 +120580,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":395,"../../registry":602,"d3":82}],655:[function(_dereq_,module,exports){ +},{"../../components/drawing":416,"../../registry":625,"d3":82}],679:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118709,7 +120619,7 @@ module.exports = { } }; -},{"../../lib":502}],656:[function(_dereq_,module,exports){ +},{"../../lib":524}],680:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118739,7 +120649,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":502}],657:[function(_dereq_,module,exports){ +},{"../../lib":524}],681:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118783,7 +120693,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":502,"../../registry":602}],658:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625}],682:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118929,7 +120839,7 @@ var attrs = module.exports = overrideAll({ attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; -},{"../../components/colorscale/attributes":380,"../../constants/gl3d_dashes":477,"../../constants/gl3d_markers":478,"../../lib/extend":495,"../../plot_api/edit_types":531,"../../plots/attributes":545,"../../plots/template_attributes":601,"../scatter/attributes":631}],659:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":401,"../../constants/gl3d_dashes":499,"../../constants/gl3d_markers":500,"../../lib/extend":517,"../../plot_api/edit_types":553,"../../plots/attributes":567,"../../plots/template_attributes":624,"../scatter/attributes":654}],683:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -118957,7 +120867,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":630,"../scatter/colorscale_calc":634}],660:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":653,"../scatter/colorscale_calc":657}],684:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119044,7 +120954,7 @@ function calculateErrors(data, scaleFactor, sceneLayout) { module.exports = calculateErrors; -},{"../../registry":602}],661:[function(_dereq_,module,exports){ +},{"../../registry":625}],685:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119378,11 +121288,11 @@ function convertPlotlyOptions(scene, data) { return params; } -function arrayToColor(color) { - if(Array.isArray(color)) { +function _arrayToColor(color) { + if(Lib.isArrayOrTypedArray(color)) { var c = color[0]; - if(Array.isArray(c)) color = c; + if(Lib.isArrayOrTypedArray(c)) color = c; return 'rgb(' + color.slice(0, 3).map(function(x) { return Math.round(x * 255); @@ -119392,6 +121302,18 @@ function arrayToColor(color) { return null; } +function arrayToColor(colors) { + if(!Lib.isArrayOrTypedArray(colors)) { + return null; + } + + if((colors.length === 4) && (typeof colors[0] === 'number')) { + return _arrayToColor(colors); + } + + return colors.map(_arrayToColor); +} + proto.update = function(data) { var gl = this.scene.glplot.gl; var lineOptions; @@ -119586,7 +121508,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../components/fx/helpers":409,"../../constants/gl3d_dashes":477,"../../constants/gl3d_markers":478,"../../lib":502,"../../lib/gl_format_color":499,"../../lib/str2rgbarray":524,"../../plots/cartesian/axes":548,"../scatter/make_bubble_size_func":648,"./calc_errors":660,"delaunay-triangulate":84,"gl-error3d":111,"gl-line3d":116,"gl-mesh3d":137,"gl-scatter3d":145}],662:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":430,"../../constants/gl3d_dashes":499,"../../constants/gl3d_markers":500,"../../lib":524,"../../lib/gl_format_color":521,"../../lib/str2rgbarray":546,"../../plots/cartesian/axes":571,"../scatter/make_bubble_size_func":671,"./calc_errors":684,"delaunay-triangulate":84,"gl-error3d":113,"gl-line3d":119,"gl-mesh3d":153,"gl-scatter3d":164}],686:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119675,7 +121597,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce, layout) { return len; } -},{"../../lib":502,"../../registry":602,"../scatter/line_defaults":644,"../scatter/marker_defaults":650,"../scatter/subtypes":655,"../scatter/text_defaults":656,"./attributes":658}],663:[function(_dereq_,module,exports){ +},{"../../lib":524,"../../registry":625,"../scatter/line_defaults":667,"../scatter/marker_defaults":673,"../scatter/subtypes":679,"../scatter/text_defaults":680,"./attributes":682}],687:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119714,7 +121636,7 @@ module.exports = { } }; -},{"../../constants/gl3d_markers":478,"../../plots/gl3d":579,"./attributes":658,"./calc":659,"./convert":661,"./defaults":662}],664:[function(_dereq_,module,exports){ +},{"../../constants/gl3d_markers":500,"../../plots/gl3d":602,"./attributes":682,"./calc":683,"./convert":685,"./defaults":686}],688:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -119867,7 +121789,7 @@ attrs.transforms = undefined; module.exports = attrs; -},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plots/attributes":545,"../../plots/template_attributes":601,"../mesh3d/attributes":623}],665:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plots/attributes":567,"../../plots/template_attributes":624,"../mesh3d/attributes":646}],689:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -120123,7 +122045,7 @@ module.exports = { processGrid: processGrid }; -},{"../../components/colorscale/calc":381,"../../lib":502}],666:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":402,"../../lib":524}],690:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -120349,7 +122271,7 @@ function createStreamtubeTrace(scene, data) { module.exports = createStreamtubeTrace; -},{"../../components/colorscale":385,"../../lib":502,"../../lib/gl_format_color":499,"../../plots/gl3d/zip3":590,"gl-streamtube3d":157}],667:[function(_dereq_,module,exports){ +},{"../../components/colorscale":406,"../../lib":524,"../../lib/gl_format_color":521,"../../plots/gl3d/zip3":613,"gl-streamtube3d":178}],691:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -120414,7 +122336,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":383,"../../lib":502,"./attributes":664}],668:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":404,"../../lib":524,"./attributes":688}],692:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -120464,7 +122386,7 @@ module.exports = { } }; -},{"../../plots/gl3d":579,"./attributes":664,"./calc":665,"./convert":666,"./defaults":667}],669:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":602,"./attributes":688,"./calc":689,"./convert":690,"./defaults":691}],693:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -120740,7 +122662,7 @@ colorScaleAttrs('', { attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/color":373,"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plot_api/edit_types":531,"../../plots/attributes":545,"../../plots/template_attributes":601}],670:[function(_dereq_,module,exports){ +},{"../../components/color":394,"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plot_api/edit_types":553,"../../plots/attributes":567,"../../plots/template_attributes":624}],694:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -120772,7 +122694,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":381}],671:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":402}],695:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121208,8 +123130,7 @@ proto.update = function(data) { var scene = this.scene; var sceneLayout = scene.fullSceneLayout; var surface = this.surface; - var alpha = data.opacity; - var colormap = parseColorScale(data, alpha); + var colormap = parseColorScale(data); var scaleFactor = scene.dataScale; var xlen = data.z[0].length; var ylen = data._ylength; @@ -121454,10 +123375,6 @@ proto.update = function(data) { if('lightposition' in data) { surface.lightPosition = [data.lightposition.x, data.lightposition.y, data.lightposition.z]; } - - if(alpha && alpha < 1) { - surface.supportsTransparency = true; - } }; proto.dispose = function() { @@ -121477,7 +123394,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../components/colorscale":385,"../../lib":502,"../../lib/gl_format_color":499,"../../lib/str2rgbarray":524,"../heatmap/find_empties":616,"../heatmap/interp2d":617,"gl-surface3d":159,"ndarray":280,"ndarray-linear-interpolate":274}],672:[function(_dereq_,module,exports){ +},{"../../components/colorscale":406,"../../lib":524,"../../lib/gl_format_color":521,"../../lib/str2rgbarray":546,"../heatmap/find_empties":639,"../heatmap/interp2d":640,"gl-surface3d":181,"ndarray":301,"ndarray-linear-interpolate":295}],696:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121651,7 +123568,7 @@ module.exports = { opacityscaleDefaults: opacityscaleDefaults }; -},{"../../components/colorscale/defaults":383,"../../lib":502,"../../registry":602,"./attributes":669}],673:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":404,"../../lib":524,"../../registry":625,"./attributes":693}],697:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121681,7 +123598,7 @@ module.exports = { } }; -},{"../../plots/gl3d":579,"./attributes":669,"./calc":670,"./convert":671,"./defaults":672}],674:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":602,"./attributes":693,"./calc":694,"./convert":695,"./defaults":696}],698:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121754,7 +123671,7 @@ colorScaleAttrs('', { attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plot_api/edit_types":531,"../../plots/attributes":545,"../isosurface/attributes":618,"../surface/attributes":669}],675:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plot_api/edit_types":553,"../../plots/attributes":567,"../isosurface/attributes":641,"../surface/attributes":693}],699:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121887,7 +123804,7 @@ function createVolumeTrace(scene, data) { module.exports = createVolumeTrace; -},{"../../components/colorscale":385,"../../lib/gl_format_color":499,"../../lib/str2rgbarray":524,"../../plots/gl3d/zip3":590,"../isosurface/convert":620,"gl-mesh3d":137}],676:[function(_dereq_,module,exports){ +},{"../../components/colorscale":406,"../../lib/gl_format_color":521,"../../lib/str2rgbarray":546,"../../plots/gl3d/zip3":613,"../isosurface/convert":643,"gl-mesh3d":153}],700:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121913,7 +123830,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout opacityscaleDefaults(traceIn, traceOut, layout, coerce); }; -},{"../../lib":502,"../isosurface/defaults":621,"../surface/defaults":672,"./attributes":674}],677:[function(_dereq_,module,exports){ +},{"../../lib":524,"../isosurface/defaults":644,"../surface/defaults":696,"./attributes":698}],701:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121943,7 +123860,7 @@ module.exports = { } }; -},{"../../plots/gl3d":579,"../isosurface/calc":619,"./attributes":674,"./convert":675,"./defaults":676}],678:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":602,"../isosurface/calc":642,"./attributes":698,"./convert":699,"./defaults":700}],702:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121955,7 +123872,7 @@ module.exports = { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[4])(4) }); diff --git a/dist/plotly-gl3d.min.js b/dist/plotly-gl3d.min.js index 0caf73a1c44..bea563711c2 100644 --- a/dist/plotly-gl3d.min.js +++ b/dist/plotly-gl3d.min.js @@ -1,17 +1,17 @@ /** -* plotly.js (gl3d - minified) v1.55.2 +* plotly.js (gl3d - minified) v1.58.0 * Copyright 2012-2020, 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 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){return i(e[o][1][t]||t)}),c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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":502}],2:[function(t,e,r){"use strict";e.exports=t("../src/traces/cone")},{"../src/traces/cone":615}],3:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":482}],4:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./scatter3d"),t("./surface"),t("./mesh3d"),t("./isosurface"),t("./volume"),t("./cone"),t("./streamtube")]),e.exports=n},{"./cone":2,"./core":3,"./isosurface":5,"./mesh3d":6,"./scatter3d":7,"./streamtube":8,"./surface":9,"./volume":10}],5:[function(t,e,r){"use strict";e.exports=t("../src/traces/isosurface")},{"../src/traces/isosurface":622}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":627}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":663}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/streamtube")},{"../src/traces/streamtube":668}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/surface")},{"../src/traces/surface":673}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/volume")},{"../src/traces/volume":677}],11:[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?o-4:o;for(r=0;r>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[c++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},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},{}],20:[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":30}],21:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],22:[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":30}],23:[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,c,f=0;if(i(e))u=e.clone();else if("string"==typeof e)u=o(e);else{if(0===e)return[a(0),a(1)];if(e===Math.floor(e))u=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),f-=256;u=a(e)}}if(n(r))u.mul(r[1]),c=r[0].clone();else if(i(r))c=r.clone();else if("string"==typeof r)c=o(r);else if(r)if(r===Math.floor(r))c=a(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),f+=256;c=a(r)}else c=a(1);f>0?u=u.ushln(f):f<0&&(c=c.ushln(-f));return s(u,c)}},{"./div":22,"./is-rat":24,"./lib/is-bn":28,"./lib/num-to-bn":29,"./lib/rationalize":30,"./lib/str-to-bn":31}],24:[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":28}],25:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":38}],26:[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":37,"double-bits":85}],28:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":38}],29:[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":38,"double-bits":85}],30:[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":25,"./num-to-bn":29}],31:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":38}],32:[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":30}],33:[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":25}],34:[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":30}],35:[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":26,"./lib/ctz":27}],36:[function(t,e,r){"use strict";function n(t,e,r,n,i){var a=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>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)}},{}],37:[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}},{}],38:[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],M=8191&w,A=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,D=z>>>13,N=0|o[9],F=8191&N,j=N>>>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],Y=8191&X,W=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,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(h,Y)|0))<<13)|0;u=((a=a+Math.imul(h,W)|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,Y)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,Y)|0,a=a+Math.imul(g,W)|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,Y)|0,i=(i=i+Math.imul(m,W)|0)+Math.imul(y,Y)|0,a=a+Math.imul(y,W)|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,Y)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(_,Y)|0,a=a+Math.imul(_,W)|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(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(M,Y)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(A,Y)|0,a=a+Math.imul(A,W)|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(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,Y)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(E,Y)|0,a=a+Math.imul(E,W)|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(I,U),i=(i=Math.imul(I,V))+Math.imul(D,U)|0,a=Math.imul(D,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,Y)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(C,Y)|0,a=a+Math.imul(C,W)|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(I,q)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(D,q)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(P,Y)|0,a=a+Math.imul(P,W)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,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(I,Y)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(D,Y)|0,a=a+Math.imul(D,W)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(P,Q)|0,a=a+Math.imul(P,J)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,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,Y),i=(i=Math.imul(F,W))+Math.imul(j,Y)|0,a=Math.imul(j,W),n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,J)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(P,$)|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(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(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,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(M,ft)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(A,ft)|0,a=a+Math.imul(A,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,$),i=(i=Math.imul(F,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,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(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)+(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(D,at)|0,a=a+Math.imul(D,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(D,lt)|0,a=a+Math.imul(D,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(D,ft)|0,a=a+Math.imul(D,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(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,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]=Mt,l[8]=At,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 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)}}("undefined"==typeof e||e,this)},{buffer:47}],39:[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])}function f(t){return n=[],u(t,t,c,!0),n}function h(t,e){return n=[],u(t,e,c,!1),n}},{"./lib/intersect":42,"./lib/sweep":46,"typedarray-pool":345}],41:[function(t,e,r){"use strict";var n=["d","ax","vv","rs","re","rb","ri","bs","be","bb","bi"];function i(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],i=n.slice();t||i.splice(3,0,"fp");var a=["function "+e+"("+i.join()+"){"];function o(e,i){var o=function(t,e,r){var i="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),a=["function ",i,"(",n.join(),"){","var ","es","=2*","d",";"],o="for(var i=rs,rp=es*rs;ibe-bs){"),t?(o(!0,!1),a.push("}else{"),o(!1,!1)):(a.push("if(fp){"),o(!0,!0),a.push("}else{"),o(!0,!1),a.push("}}else{if(fp){"),o(!1,!0),a.push("}else{"),o(!1,!1),a.push("}")),a.push("}}return "+e);var s=r.join("")+a.join("");return new Function(s)()}r.partial=i(!1),r.full=i(!0)},{}],42:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,c,w,M,A,T){!function(t,e){var r=8*i.log2(e+1)*(t+1)|0,a=i.nextPow2(6*r);m.length0;){var S=6*(E-=1),C=m[S],O=m[S+1],R=m[S+2],P=m[S+3],z=m[S+4],I=m[S+5],D=2*E,N=y[D],F=y[D+1],j=1&I,B=!!(16&I),U=c,V=w,H=A,q=T;if(j&&(U=A,V=T,H=c,q=w),!(2&I&&(R=d(t,C,O,R,U,V,F),O>=R)||4&I&&(O=p(t,C,O,R,U,V,N))>=R)){var G=R-O,X=z-P;if(B){if(t*G*(G+X)<1<<22){if(void 0!==(k=l.scanComplete(t,C,e,O,R,U,V,P,z,H,q)))return k;continue}}else{if(t*Math.min(G,X)<128){if(void 0!==(k=o(t,C,e,j,O,R,U,V,P,z,H,q)))return k;continue}if(t*G*X<1<<22){if(void 0!==(k=l.scanBipartite(t,C,e,j,O,R,U,V,P,z,H,q)))return k;continue}}var Y=f(t,C,O,R,U,V,N,F);if(O=p0)&&!(p1>=hi)",["p0","p1"]),h=c("lo===p0",["p0"]),d=c("lo>>1,f=2*t,h=c,d=o[f*c+e];for(;l=y?(h=m,d=y):v>=x?(h=g,d=v):(h=b,d=x):y>=x?(h=m,d=y):x>=v?(h=g,d=v):(h=b,d=x);for(var _=f*(u-1),w=f*h,M=0;Mr&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p=0&&n.push("lo=e[k+n]");t.indexOf("hi")>=0&&n.push("hi=e[k+o]");return r.push("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".replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}},{}],45:[function(t,e,r){"use strict";e.exports=function(t,e){e<=128?n(0,e-1,t):function t(e,r,c){var f=(r-e+1)/6|0,h=e+f,d=r-f,p=e+r>>1,g=p-f,v=p+f,m=h,y=g,b=p,x=v,_=d,w=e+1,M=r-1,A=0;l(m,y,c)&&(A=m,m=y,y=A);l(x,_,c)&&(A=x,x=_,_=A);l(m,b,c)&&(A=m,m=b,b=A);l(y,b,c)&&(A=y,y=b,b=A);l(m,x,c)&&(A=m,m=x,x=A);l(b,x,c)&&(A=b,b=x,x=A);l(y,_,c)&&(A=y,y=_,_=A);l(y,b,c)&&(A=y,y=b,b=A);l(x,_,c)&&(A=x,x=_,_=A);for(var T=c[2*y],k=c[2*y+1],E=c[2*x],L=c[2*x+1],S=2*m,C=2*b,O=2*_,R=2*h,P=2*p,z=2*d,I=0;I<2;++I){var D=c[S+I],N=c[C+I],F=c[O+I];c[R+I]=D,c[P+I]=N,c[z+I]=F}a(g,e,c),a(v,r,c);for(var j=w;j<=M;++j)if(u(j,T,k,c))j!==w&&i(j,w,c),++w;else if(!u(j,E,L,c))for(;;){if(u(M,E,L,c)){u(M,T,k,c)?(o(j,w,M,c),++w,--M):(i(j,M,c),--M);break}if(--Mt;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function u(t,e,r,n){var i=n[t*=2];return i>>1;a(h,k);var E=0,L=0;for(w=0;w=1<<28)d(l,u,L--,S=S-(1<<28)|0);else if(S>=0)d(o,s,E--,S);else if(S<=-(1<<28)){S=-S-(1<<28)|0;for(var C=0;C>>1;a(h,L);var S=0,C=0,O=0;for(A=0;A>1==h[2*A+3]>>1&&(P=2,A+=1),R<0){for(var z=-(R>>1)-1,I=0;I>1)-1;0===P?d(o,s,S--,z):1===P?d(l,u,C--,z):2===P&&d(c,f,O--,z)}}},scanBipartite:function(t,e,r,n,i,l,u,c,f,g,v,m){var y=0,b=2*t,x=e,_=e+t,w=1,M=1;n?M=1<<28:w=1<<28;for(var A=i;A>>1;a(h,L);var S=0;for(A=0;A=1<<28?(O=!n,T-=1<<28):(O=!!n,T-=1),O)p(o,s,S++,T);else{var R=m[T],P=b*T,z=v[P+e+1],I=v[P+e+1+t];t:for(var D=0;D>>1;a(h,w);var M=0;for(y=0;y=1<<28)o[M++]=b-(1<<28);else{var T=d[b-=1],k=g*b,E=f[k+e+1],L=f[k+e+1+t];t:for(var S=0;S=0;--S)if(o[S]===b){for(P=S+1;P0&&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 m(){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:f(r,u,this);break;case 2:h(r,u,this,arguments[1]);break;case 3:d(r,u,this,arguments[1],arguments[2]);break;case 4:p(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),a=1;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 b(this,t,!0)},o.prototype.rawListeners=function(t){return b(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):x.call(t,e)},o.prototype.listenerCount=x,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],49:[function(t,e,r){(function(e){ +!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 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){return i(e[o][1][t]||t)}),c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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":524}],2:[function(t,e,r){"use strict";e.exports=t("../src/traces/cone")},{"../src/traces/cone":638}],3:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":504}],4:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./scatter3d"),t("./surface"),t("./mesh3d"),t("./isosurface"),t("./volume"),t("./cone"),t("./streamtube")]),e.exports=n},{"./cone":2,"./core":3,"./isosurface":5,"./mesh3d":6,"./scatter3d":7,"./streamtube":8,"./surface":9,"./volume":10}],5:[function(t,e,r){"use strict";e.exports=t("../src/traces/isosurface")},{"../src/traces/isosurface":645}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":650}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":687}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/streamtube")},{"../src/traces/streamtube":692}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/surface")},{"../src/traces/surface":697}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/volume")},{"../src/traces/volume":701}],11:[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?o-4:o;for(r=0;r>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[c++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},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},{}],20:[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":30}],21:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],22:[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":30}],23:[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,c,f=0;if(i(e))u=e.clone();else if("string"==typeof e)u=o(e);else{if(0===e)return[a(0),a(1)];if(e===Math.floor(e))u=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),f-=256;u=a(e)}}if(n(r))u.mul(r[1]),c=r[0].clone();else if(i(r))c=r.clone();else if("string"==typeof r)c=o(r);else if(r)if(r===Math.floor(r))c=a(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),f+=256;c=a(r)}else c=a(1);f>0?u=u.ushln(f):f<0&&(c=c.ushln(-f));return s(u,c)}},{"./div":22,"./is-rat":24,"./lib/is-bn":28,"./lib/num-to-bn":29,"./lib/rationalize":30,"./lib/str-to-bn":31}],24:[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":28}],25:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":38}],26:[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":37,"double-bits":85}],28:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":38}],29:[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":38,"double-bits":85}],30:[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":25,"./num-to-bn":29}],31:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":38}],32:[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":30}],33:[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":25}],34:[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":30}],35:[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":26,"./lib/ctz":27}],36:[function(t,e,r){"use strict";function n(t,e,r,n,i){var a=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>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)}},{}],37:[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}},{}],38:[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],M=8191&w,T=w>>>13,A=0|o[5],k=8191&A,E=A>>>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,D=z>>>13,N=0|o[9],F=8191&N,j=N>>>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],Y=8191&X,W=X>>>13,Z=0|s[3],Q=8191&Z,K=Z>>>13,J=0|s[4],$=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,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(h,Y)|0))<<13)|0;u=((a=a+Math.imul(h,W)|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,Y)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,Y)|0,a=a+Math.imul(g,W)|0;var bt=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,Q)|0))<<13)|0;u=((a=a+Math.imul(h,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=(i=Math.imul(M,V))+Math.imul(T,U)|0,a=Math.imul(T,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,Y)|0,i=(i=i+Math.imul(m,W)|0)+Math.imul(y,Y)|0,a=a+Math.imul(y,W)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,K)|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(T,q)|0,a=a+Math.imul(T,G)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(_,Y)|0,a=a+Math.imul(_,W)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,K)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,K)|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(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(M,Y)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(T,Y)|0,a=a+Math.imul(T,W)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,K)|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(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,Y)|0,i=(i=i+Math.imul(k,W)|0)+Math.imul(E,Y)|0,a=a+Math.imul(E,W)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(T,Q)|0,a=a+Math.imul(T,K)|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(I,U),i=(i=Math.imul(I,V))+Math.imul(D,U)|0,a=Math.imul(D,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,Y)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(C,Y)|0,a=a+Math.imul(C,W)|0,n=n+Math.imul(k,Q)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,K)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(T,$)|0,a=a+Math.imul(T,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 Tt=(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)+(Tt>>>26)|0,Tt&=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(D,q)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(P,Y)|0,a=a+Math.imul(P,W)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,K)|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(T,rt)|0,a=a+Math.imul(T,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 At=(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)+(At>>>26)|0,At&=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,Y)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(D,Y)|0,a=a+Math.imul(D,W)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(P,Q)|0,a=a+Math.imul(P,K)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,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(T,at)|0,a=a+Math.imul(T,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,Y),i=(i=Math.imul(F,W))+Math.imul(j,Y)|0,a=Math.imul(j,W),n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(D,Q)|0,a=a+Math.imul(D,K)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,tt)|0)+Math.imul(P,$)|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(M,lt)|0,i=(i=i+Math.imul(M,ut)|0)+Math.imul(T,lt)|0,a=a+Math.imul(T,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,K))+Math.imul(j,Q)|0,a=Math.imul(j,K),n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,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(M,ft)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(T,ft)|0,a=a+Math.imul(T,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,$),i=(i=Math.imul(F,tt))+Math.imul(j,$)|0,a=Math.imul(j,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,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(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,gt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((a=a+Math.imul(T,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(D,at)|0,a=a+Math.imul(D,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(D,lt)|0,a=a+Math.imul(D,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(D,ft)|0,a=a+Math.imul(D,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(D,pt)|0))<<13)|0;u=((a=a+Math.imul(D,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]=Mt,l[8]=Tt,l[9]=At,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 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)}}("undefined"==typeof e||e,this)},{buffer:47}],39:[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])}function f(t){return n=[],u(t,t,c,!0),n}function h(t,e){return n=[],u(t,e,c,!1),n}},{"./lib/intersect":42,"./lib/sweep":46,"typedarray-pool":366}],41:[function(t,e,r){"use strict";var n=["d","ax","vv","rs","re","rb","ri","bs","be","bb","bi"];function i(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],i=n.slice();t||i.splice(3,0,"fp");var a=["function "+e+"("+i.join()+"){"];function o(e,i){var o=function(t,e,r){var i="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),a=["function ",i,"(",n.join(),"){","var ","es","=2*","d",";"],o="for(var i=rs,rp=es*rs;ibe-bs){"),t?(o(!0,!1),a.push("}else{"),o(!1,!1)):(a.push("if(fp){"),o(!0,!0),a.push("}else{"),o(!0,!1),a.push("}}else{if(fp){"),o(!1,!0),a.push("}else{"),o(!1,!1),a.push("}")),a.push("}}return "+e);var s=r.join("")+a.join("");return new Function(s)()}r.partial=i(!1),r.full=i(!0)},{}],42:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,c,w,M,T,A){!function(t,e){var r=8*i.log2(e+1)*(t+1)|0,a=i.nextPow2(6*r);m.length0;){var S=6*(E-=1),C=m[S],O=m[S+1],R=m[S+2],P=m[S+3],z=m[S+4],I=m[S+5],D=2*E,N=y[D],F=y[D+1],j=1&I,B=!!(16&I),U=c,V=w,H=T,q=A;if(j&&(U=T,V=A,H=c,q=w),!(2&I&&(R=d(t,C,O,R,U,V,F),O>=R)||4&I&&(O=p(t,C,O,R,U,V,N))>=R)){var G=R-O,X=z-P;if(B){if(t*G*(G+X)<1<<22){if(void 0!==(k=l.scanComplete(t,C,e,O,R,U,V,P,z,H,q)))return k;continue}}else{if(t*Math.min(G,X)<128){if(void 0!==(k=o(t,C,e,j,O,R,U,V,P,z,H,q)))return k;continue}if(t*G*X<1<<22){if(void 0!==(k=l.scanBipartite(t,C,e,j,O,R,U,V,P,z,H,q)))return k;continue}}var Y=f(t,C,O,R,U,V,N,F);if(O=p0)&&!(p1>=hi)",["p0","p1"]),h=c("lo===p0",["p0"]),d=c("lo>>1,f=2*t,h=c,d=o[f*c+e];for(;l=y?(h=m,d=y):v>=x?(h=g,d=v):(h=b,d=x):y>=x?(h=m,d=y):x>=v?(h=g,d=v):(h=b,d=x);for(var _=f*(u-1),w=f*h,M=0;Mr&&i[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p=0&&n.push("lo=e[k+n]");t.indexOf("hi")>=0&&n.push("hi=e[k+o]");return r.push("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".replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}},{}],45:[function(t,e,r){"use strict";e.exports=function(t,e){e<=128?n(0,e-1,t):function t(e,r,c){var f=(r-e+1)/6|0,h=e+f,d=r-f,p=e+r>>1,g=p-f,v=p+f,m=h,y=g,b=p,x=v,_=d,w=e+1,M=r-1,T=0;l(m,y,c)&&(T=m,m=y,y=T);l(x,_,c)&&(T=x,x=_,_=T);l(m,b,c)&&(T=m,m=b,b=T);l(y,b,c)&&(T=y,y=b,b=T);l(m,x,c)&&(T=m,m=x,x=T);l(b,x,c)&&(T=b,b=x,x=T);l(y,_,c)&&(T=y,y=_,_=T);l(y,b,c)&&(T=y,y=b,b=T);l(x,_,c)&&(T=x,x=_,_=T);for(var A=c[2*y],k=c[2*y+1],E=c[2*x],L=c[2*x+1],S=2*m,C=2*b,O=2*_,R=2*h,P=2*p,z=2*d,I=0;I<2;++I){var D=c[S+I],N=c[C+I],F=c[O+I];c[R+I]=D,c[P+I]=N,c[z+I]=F}a(g,e,c),a(v,r,c);for(var j=w;j<=M;++j)if(u(j,A,k,c))j!==w&&i(j,w,c),++w;else if(!u(j,E,L,c))for(;;){if(u(M,E,L,c)){u(M,A,k,c)?(o(j,w,M,c),++w,--M):(i(j,M,c),--M);break}if(--Mt;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function u(t,e,r,n){var i=n[t*=2];return i>>1;a(h,k);var E=0,L=0;for(w=0;w=1<<28)d(l,u,L--,S=S-(1<<28)|0);else if(S>=0)d(o,s,E--,S);else if(S<=-(1<<28)){S=-S-(1<<28)|0;for(var C=0;C>>1;a(h,L);var S=0,C=0,O=0;for(T=0;T>1==h[2*T+3]>>1&&(P=2,T+=1),R<0){for(var z=-(R>>1)-1,I=0;I>1)-1;0===P?d(o,s,S--,z):1===P?d(l,u,C--,z):2===P&&d(c,f,O--,z)}}},scanBipartite:function(t,e,r,n,i,l,u,c,f,g,v,m){var y=0,b=2*t,x=e,_=e+t,w=1,M=1;n?M=1<<28:w=1<<28;for(var T=i;T>>1;a(h,L);var S=0;for(T=0;T=1<<28?(O=!n,A-=1<<28):(O=!!n,A-=1),O)p(o,s,S++,A);else{var R=m[A],P=b*A,z=v[P+e+1],I=v[P+e+1+t];t:for(var D=0;D>>1;a(h,w);var M=0;for(y=0;y=1<<28)o[M++]=b-(1<<28);else{var A=d[b-=1],k=g*b,E=f[k+e+1],L=f[k+e+1+t];t:for(var S=0;S=0;--S)if(o[S]===b){for(P=S+1;P0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function p(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=i[t];if(void 0===l)return!1;if("function"==typeof l)a(l,this,e);else{var u=l.length,c=v(l,u);for(r=0;r=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],49:[function(t,e,r){(function(e){(function(){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;function a(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(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 l(t)}return o(t,e,r)}function o(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|f(t,r),i=a(n),o=i.write(t,r);o!==n&&(i=i.slice(0,o));return i}(t,r);if(ArrayBuffer.isView(t))return u(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(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(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 n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var a=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return I(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return D(t).length;default:if(a)return i?-1:I(t).length;r=(""+r).toLowerCase(),a=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 k(this,e,r);case"utf8":case"utf-8":return M(this,e,r);case"ascii":return A(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return w(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function p(t,r,n,i,a){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),j(n=+n)&&(n=a?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(a)return-1;n=t.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof r&&(r=e.from(r,i)),e.isBuffer(r))return 0===r.length?-1:g(t,r,n,i,a);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):g(t,[r],n,i,a);throw new TypeError("val must be string, number or Buffer")}function g(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 w(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<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,i,a){if(F(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===a&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(this===t)return 0;for(var o=(a>>>=0)-(i>>>=0),s=(n>>>=0)-(r>>>=0),l=Math.min(o,s),u=this.slice(i,a),c=t.slice(r,n),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 v(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(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 S(t,r,n,i,a,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>a||rt.length)throw new RangeError("Index out of range")}function C(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 O(t,e,r,n,a){return e=+e,r>>>=0,a||C(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,a){return e=+e,r>>>=0,a||C(t,0,r,8),i.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||L(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||L(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||L(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},e.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||L(t,4,this.length),i.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),i.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||S(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)||S(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},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||S(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},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||S(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},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);S(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},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);S(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},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||S(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},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||S(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},e.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,i){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,i),r);return a},e.prototype.fill=function(t,r,n,i){if("string"==typeof t){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!e.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var a=t.charCodeAt(0);("utf8"===i&&a<128||"latin1"===i)&&(t=a)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&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 D(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function j(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":19,buffer:49,ieee754:248}],50:[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 d=r.pop(),p=(s=r.pop(),c=-1,f=-1,l=o[s],1);p=0||(e.flip(s,d),i(t,e,r,c,s,f),i(t,e,r,s,f,c),i(t,e,r,f,d,c),i(t,e,r,d,c,f)))}}},{"binary-search-bounds":36,"robust-in-sphere":316}],52:[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=f.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 c(t,e){var r;return(r=t.a[0]p[0]&&i.push(new o(p,d,2,l),new o(d,p,1,l))}i.sort(s);for(var g=i[0].a[0]-(1+Math.abs(i[0].a[0]))*Math.pow(2,-52),v=[new a([g,1],[g,0],-1,[],[],[],[])],m=[],y=(l=0,i.length);l=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;nr?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],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,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":23,"big-rat/cmp":21,"big-rat/to-float":35,"box-intersect":40,nextafter:281,"rat-vec":307,"robust-segment-intersect":321,"union-find":346}],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":22,"big-rat/mul":32,"big-rat/sign":33,"big-rat/sub":34,"rat-vec/add":306,"rat-vec/muls":308,"rat-vec/sub":309}],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:86}],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=(d=t.slice(1)).length;u=1,c<=4?(l=[parseInt(d[0]+d[0],16),parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16)],4===c&&(u=parseInt(d[3]+d[3],16)/255)):(l=[parseInt(d[0]+d[1],16),parseInt(d[2]+d[3],16),parseInt(d[4]+d[5],16)],8===c&&(u=parseInt(d[6]+d[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 f=e[1],h="rgb"===f,d=f.replace(/a$/,"");s=d;c="cmyk"===d?4:"gray"===d?1:3;l=e[2].trim().split(/\s*,\s*/).map((function(t,e){if(/%$/.test(t))return e===c?parseFloat(t)/100:"rgb"===d?255*parseFloat(t)/100:parseFloat(t);if("h"===d[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)})),f===d&&l.push(1),u=h||void 0===l[c]?1:l[c],l=l.slice(0,c)}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:83,"is-plain-obj":257}],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[3]=p[0]+(p[1]-p[0])*r),n})),m=[];for(g=0;g0||l(t,e,a)?-1:1:0===s?u>0||l(t,e,r)?1:-1:i(u-s)}var h=n(t,e,r);return h>0?o>0&&n(t,e,a)>0?1:-1:h<0?o>0||n(t,e,a)>0?1:-1:n(t,e,a)>0||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":318,"robust-product":319,"robust-sum":323,signum:324,"two-sum":344}],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}(n(a,!0),r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":14,"incremental-convex-hull":249}],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&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,s=new Array(t.arrayArgs.length),l=new Array(t.arrayArgs.length),u=0;u0&&b.push("shape=SS.slice(0)"),t.indexArgs.length>0){var x=new Array(r);for(u=0;u0&&y.push("var "+b.join(",")),u=0;u3&&y.push(a(t.pre,t,l));var A=a(t.body,t,l),T=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&&y.push(a(t.post,t,l)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+y.join("\n")+"\n----------");var k=[t.funcName||"unnamed","_cwise_loop_",s[0].join("s"),"m",T,o(l)].join("");return new Function(["function ",k,"(",m.join(","),"){",y.join("\n"),"} return ",k].join(""))()}},{uniq:347}],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;c=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:vt,s:mt,S:H,u:q,U:G,V:X,w:Y,W:W,x:null,X:null,y:Z,Y:Q,Z:J,"%":gt},Ct={a:function(t){return f[t.getUTCDay()]},A:function(t){return c[t.getUTCDay()]},b:function(t){return yt[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:K,e:K,f:nt,H:$,I:tt,j:et,L:rt,m:it,M:at,p:function(t){return u[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:vt,s:mt,S:ot,u:st,U:lt,V:ut,w:ct,W:ft,x:null,X:null,y:ht,Y:dt,Z:pt,"%":gt},Ot={a:function(t,e,r){var n=Mt.exec(e.slice(r));return n?(t.w=At[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=Et.exec(e.slice(r));return n?(t.m=Lt[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=Tt.exec(e.slice(r));return n?(t.m=kt[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return zt(t,a,e,r)},d:T,e:T,f:O,H:E,I:E,j:k,L:C,m:A,M:L,p:function(t,e,r){var n=bt.exec(e.slice(r));return n?(t.p=xt[n[0].toLowerCase()],r+n[0].length):-1},q:M,Q:P,s:z,S:S,u:v,U:m,V:y,w:g,W:b,x:function(t,e,r){return zt(t,o,e,r)},X:function(t,e,r){return zt(t,l,e,r)},y:_,Y:x,Z:w,"%":R};function Rt(t,e){return function(r){var n,i,a,o=[],l=-1,u=0,c=t.length;for(r instanceof Date||(r=new Date(+r));++l53)return null;"w"in u||(u.w=1),"Z"in u?(l=(s=n(i(u.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(u.V-1)),u.y=s.getUTCFullYear(),u.m=s.getUTCMonth(),u.d=s.getUTCDate()+(u.w+6)%7):(l=(s=r(i(u.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(u.V-1)),u.y=s.getFullYear(),u.m=s.getMonth(),u.d=s.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),l="Z"in u?n(i(u.y,0,1)).getUTCDay():r(i(u.y,0,1)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+7*u.W-(l+5)%7:u.w+7*u.U-(l+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,n(u)):r(u)}}function zt(t,e,r,n){for(var i,a,o=0,l=e.length,u=r.length;o=u)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=Ot[i in s?e.charAt(o++):i])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}return St.x=Rt(o,St),St.X=Rt(l,St),St.c=Rt(a,St),Ct.x=Rt(o,Ct),Ct.X=Rt(l,Ct),Ct.c=Rt(a,Ct),{format:function(t){var e=Rt(t+="",St);return e.toString=function(){return t},e},parse:function(t){var e=Pt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=Rt(t+="",Ct);return e.toString=function(){return t},e},utcParse:function(t){var e=Pt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,u=/^%/,c=/[\\^$*+?|[\]().{}]/g;function f(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function O(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function R(t,e,r){var n=u.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function P(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function z(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function I(t,e){return f(t.getDate(),e,2)}function D(t,e){return f(t.getHours(),e,2)}function N(t,e){return f(t.getHours()%12||12,e,2)}function F(t,r){return f(1+e.timeDay.count(e.timeYear(t),t),r,3)}function j(t,e){return f(t.getMilliseconds(),e,3)}function B(t,e){return j(t,e)+"000"}function U(t,e){return f(t.getMonth()+1,e,2)}function V(t,e){return f(t.getMinutes(),e,2)}function H(t,e){return f(t.getSeconds(),e,2)}function q(t){var e=t.getDay();return 0===e?7:e}function G(t,r){return f(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function X(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function Y(t){return t.getDay()}function W(t,r){return f(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function Z(t,e){return f(t.getFullYear()%100,e,2)}function Q(t,e){return f(t.getFullYear()%1e4,e,4)}function J(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+f(e/60|0,"0",2)+f(e%60,"0",2)}function K(t,e){return f(t.getUTCDate(),e,2)}function $(t,e){return f(t.getUTCHours(),e,2)}function tt(t,e){return f(t.getUTCHours()%12||12,e,2)}function et(t,r){return f(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return f(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function it(t,e){return f(t.getUTCMonth()+1,e,2)}function at(t,e){return f(t.getUTCMinutes(),e,2)}function ot(t,e){return f(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,r){return f(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ut(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ct(t){return t.getUTCDay()}function ft(t,r){return f(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function ht(t,e){return f(t.getUTCFullYear()%100,e,2)}function dt(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function pt(){return"+0000"}function gt(){return"%"}function vt(t){return+t}function mt(t){return Math.floor(+t/1e3)}function yt(e){return o=a(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var bt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var xt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=bt,t.isoParse=xt,t.timeFormatDefaultLocale=yt,t.timeFormatLocale=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":81}],81:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,i,a,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),i(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e0))return o;do{o.push(a=new Date(+e)),i(e,n),t(e)}while(a=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;i(t,-1),!e(t););else for(;--r>=0;)for(;i(t,1),!e(t););}))},a&&(s.count=function(n,i){return e.setTime(+n),r.setTime(+i),t(e),t(r),Math.floor(a(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var i=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):i:null};var a=i.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),u=l.range,c=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),f=c.range,h=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),d=h.range;function p(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var g=p(0),v=p(1),m=p(2),y=p(3),b=p(4),x=p(5),_=p(6),w=g.range,M=v.range,A=m.range,T=y.range,k=b.range,E=x.range,L=_.range,S=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),C=S.range,O=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));O.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var R=O.range,P=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),z=P.range,I=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),D=I.range,N=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),F=N.range;function j(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var B=j(0),U=j(1),V=j(2),H=j(3),q=j(4),G=j(5),X=j(6),Y=B.range,W=U.range,Z=V.range,Q=H.range,J=q.range,K=G.range,$=X.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=h,t.timeDays=d,t.timeFriday=x,t.timeFridays=E,t.timeHour=c,t.timeHours=f,t.timeInterval=n,t.timeMillisecond=i,t.timeMilliseconds=a,t.timeMinute=l,t.timeMinutes=u,t.timeMonday=v,t.timeMondays=M,t.timeMonth=S,t.timeMonths=C,t.timeSaturday=_,t.timeSaturdays=L,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=g,t.timeSundays=w,t.timeThursday=b,t.timeThursdays=k,t.timeTuesday=m,t.timeTuesdays=A,t.timeWednesday=y,t.timeWednesdays=T,t.timeWeek=g,t.timeWeeks=w,t.timeYear=O,t.timeYears=R,t.utcDay=N,t.utcDays=F,t.utcFriday=G,t.utcFridays=K,t.utcHour=I,t.utcHours=D,t.utcMillisecond=i,t.utcMilliseconds=a,t.utcMinute=P,t.utcMinutes=z,t.utcMonday=U,t.utcMondays=W,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=X,t.utcSaturdays=$,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=B,t.utcSundays=Y,t.utcThursday=q,t.utcThursdays=J,t.utcTuesday=V,t.utcTuesdays=Z,t.utcWednesday=H,t.utcWednesdays=Q,t.utcWeek=B,t.utcWeeks=Y,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],82:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},i=this.document;function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(i)try{n(i.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),i)try{i.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,u=s.setAttributeNS,c=this.CSSStyleDeclaration.prototype,f=c.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){u.call(this,t,e,r+"")},c.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function h(t,e){return te?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){for(var e=1;t*e%1;)e*=10;return e}function x(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){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=b(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 _;++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 S;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(B,"\\$&")};var B=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return U(t,X),t}var H=function(t,e){return e.querySelector(t)},q=function(t,e){return e.querySelectorAll(t)},G=function(t,e){var r=t.matches||t[R(t,"matchesSelector")];return(G=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(H=function(t,e){return Sizzle(t,e)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var X=t.selection.prototype=[];function Y(t){return"function"==typeof t?t:function(){return H(t,this)}}function W(t){return"function"==typeof t?t:function(){return q(t,this)}}X.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)),Q.hasOwnProperty(r)?{space:Q[r],local:t}:t}},X.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))},X.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(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},X.sort=function(t){t=ut.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=i+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=gt.get(e);function u(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=mt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:u:r?z: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=X.append,ht.empty=X.empty,ht.node=X.node,ht.call=X.call,ht.size=X.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s0?1:t<0?-1:0}function Pt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function zt(t){return t>1?0:t<-1?kt:Math.acos(t)}function It(t){return t>1?St:t<-1?-St:Math.asin(t)}function Dt(t){return((t=Math.exp(t))+1/t)/2}function Nt(t){return(t=Math.sin(t/2))*t}var Ft=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,l).on(b,u),a=M(t.mouse(e)),s=xt(e);function l(){n=1,T(t.mouse(e),a),S(r)}function u(){i.on(y,null).on(b,null),s(n),C(r)}ms.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=xt(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);ms.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)||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 ne(a(t+120),a(t),a(t-120))}function Xt(e,r,n){return this instanceof Xt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Xt?new Xt(e.h,e.c,e.l):$t(e instanceof Zt?e.l:(e=ce((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Xt(e,r,n)}qt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,this.l/t)},qt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,t*this.l)},qt.rgb=function(){return Gt(this.h,this.s,this.l)},t.hcl=Xt;var Yt=Xt.prototype=new Vt;function Wt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Zt(r,Math.cos(t*=Ct)*e,Math.sin(t)*e)}function Zt(t,e,r){return this instanceof Zt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Zt?new Zt(t.l,t.a,t.b):t instanceof Xt?Wt(t.h,t.c,t.l):ce((t=ne(t)).r,t.g,t.b):new Zt(t,e,r)}Yt.brighter=function(t){return new Xt(this.h,this.c,Math.min(100,this.l+Qt*(arguments.length?t:1)))},Yt.darker=function(t){return new Xt(this.h,this.c,Math.max(0,this.l-Qt*(arguments.length?t:1)))},Yt.rgb=function(){return Wt(this.h,this.c,this.l).rgb()},t.lab=Zt;var Qt=18,Jt=Zt.prototype=new Vt;function Kt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ne(re(3.2404542*(i=.95047*te(i))-1.5371385*(n=1*te(n))-.4985314*(a=1.08883*te(a))),re(-.969266*i+1.8760108*n+.041556*a),re(.0556434*i-.2040259*n+1.0572252*a))}function $t(t,e,r){return t>0?new Xt(Math.atan2(r,e)*Ot,Math.sqrt(e*e+r*r),t):new Xt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,Gt):new ne(t,e,r)}function ie(t){return new ne(t>>16,t>>8&255,255&t)}function ae(t){return ie(t)+""}Jt.brighter=function(t){return new Zt(Math.min(100,this.l+Qt*(arguments.length?t:1)),this.a,this.b)},Jt.darker=function(t){return new Zt(Math.max(0,this.l-Qt*(arguments.length?t:1)),this.a,this.b)},Jt.rgb=function(){return Kt(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(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(he(i[0]),he(i[1]),he(i[2]))}return(a=de.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 ue(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 Ht(n,i,l)}function ce(t,e,r){var n=ee((.4124564*(t=fe(t))+.3575761*(e=fe(e))+.1804375*(r=fe(r)))/.95047),i=ee((.2126729*t+.7151522*e+.072175*r)/1);return Zt(116*i-16,500*(n-i),200*(i-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function he(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.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))}de.forEach((function(t,e){de.set(t,ie(e))})),t.functor=pe,t.xhr=ge(C),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=ve(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(xe),xe=setTimeout(Me,e)),be=0):(be=1,_e(Me))}function Ae(){for(var t=Date.now(),e=me;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Te(){for(var t,e=me,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Le(e){var r=e.decimal,n=e.thousands,i=e.grouping,a=e.currency,o=i&&n?function(t,e){for(var r=t.length,a=[],o=0,s=i[0],l=0;r>0&&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)}:C;return function(e){var n=Se.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=Ce.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}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,ke(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)))),Ee[8+n/3]};var Se=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ce=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,ke(e,r))).toFixed(Math.max(0,Math.min(20,ke(e*(1+1e-15),r))))}});function Oe(t){return t+""}var Re=t.time={},Pe=Date;function ze(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}ze.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(){Ie.setUTCDate.apply(this._,arguments)},setDay:function(){Ie.setUTCDay.apply(this._,arguments)},setFullYear:function(){Ie.setUTCFullYear.apply(this._,arguments)},setHours:function(){Ie.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Ie.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Ie.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Ie.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Ie.setUTCSeconds.apply(this._,arguments)},setTime:function(){Ie.setTime.apply(this._,arguments)}};var Ie=Date.prototype;function De(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=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(Pe=ze);return r._=t,e(r)}finally{Pe=Date}}return r.parse=function(t){try{Pe=ze;var r=e.parse(t);return r&&r._}finally{Pe=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:Ye,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:We,Z:Qe,"%":ar};return c}Re.year=De((function(t){return(t=Re.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),Re.years=Re.year.range,Re.years.utc=Re.year.utc.range,Re.day=De((function(t){var e=new Pe(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),Re.days=Re.day.range,Re.days.utc=Re.day.utc.range,Re.dayOfYear=function(t){var e=Re.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=Re[t]=De((function(t){return(t=Re.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=Re.year(t).getDay();return Math.floor((Re.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));Re[t+"s"]=r.range,Re[t+"s"].utc=r.utc.range,Re[t+"OfYear"]=function(t){var r=Re.year(t).getDay();return Math.floor((Re.dayOfYear(t)+(r+e)%7)/7)}})),Re.week=Re.sunday,Re.weeks=Re.sunday.range,Re.weeks.utc=Re.sunday.utc.range,Re.weekOfYear=Re.sundayOfYear;var je={"-":"",_:" ",0:"0"},Be=/^\s*\d+/,Ue=/^%/;function Ve(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?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;++r=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)*Ct,n=Math.cos(s=(e=s)*Ct/2+kt/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 Dr(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 Nr(t){return[Math.atan2(t[1],t[0]),It(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*Ct,o*Ct]);if(l){var u=Pr(l,s),c=Pr([u[1],-u[0],0],u);Dr(c),c=Nr(c);var f=t-a,h=f>0?1:-1,p=c[0]*Ot*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 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 Wr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,M=w*_,A=M>kt,T=p*b;if(Lr.add(Math.atan2(T*w*Math.sin(M),g*x+T*Math.cos(M))),a+=A?_+w*Et:_,A^h>=r^m>=r){var k=Pr(Or(f),Or(t));Dr(k);var E=Pr(i,k);Dr(E);var L=(A^_>=0?-1:1)*It(E[2]);(n>L||n===L&&(k[0]||k[1]))&&(o+=A^_>=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(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:z,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-At:St-t[1])-((e=e.x)[0]<0?e[1]-St-At: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?kt:-kt,l=y(a-r);y(l-kt)0?St:-St),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=kt&&(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*St,n.point(-kt,i),n.point(0,i),n.point(kt,i),n.point(kt,0),n.point(kt,-i),n.point(0,-i),n.point(-kt,-i),n.point(-kt,0),n.point(-kt,i);else if(y(t[0]-e[0])>At){var a=t[0]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?kt:-kt),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}}}),Fn(t,6*Ct),r?[0,-t]:[-kt,t-kt]);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=Nr(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-kt)0^b[1]<(y(b[0]-_)kt^(_<=b[0]&&b[0]<=w)){var E=Ir(d,(-p+m)/g);return zr(E,h),[b,Nr(E)]}}}function o(e,n){var i=r?t:kt-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}function rn(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=0,f=1,h=s.x-l,d=s.y-u;if(a=t-l,h||!(a>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}}}}}}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=rn(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&&Pt(u,a,t)>0&&++e:a[1]<=n&&Pt(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&&Yr(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(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,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=kt/3,n=Cn(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*kt/180,r=t[1]*kt/180):[e/kt*180,r/kt*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+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:z,lineStart:z,lineEnd:z,polygonStart:function(){ln=0,dn.lineStart=pn},polygonEnd:function(){dn.lineStart=dn.lineEnd=dn.point=z,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:z,lineEnd:z,polygonStart:z,polygonEnd:z};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:z};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,Et)}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*Ct),n=16;function i(t){return(n?o:a)(t)}function a(e){return Ln(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,i,a,o,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 a=Or([r,i]),o=t(r,i);s(f,h,c,d,p,g,f=o[0],h=o[1],c=r,d=a[0],p=a[1],g=a[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,a=h,o=d,l=p,u=g,v.point=b}function M(){s(f,h,c,d,p,g,i,a,r,o,l,u,n,e),v.lineEnd=x,x()}return v}function s(n,i,a,o,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=o+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*O+x*R)/_-.5)>.3||o*d+l*p+u*g0&&16,i):Math.sqrt(e)},i}function kn(t){var e=Tn((function(e,r){return t([e*Ot,r*Ot])}));return function(t){return On(e(t))}}function En(t){this.stream=t}function Ln(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 Cn((function(){return t}))()}function Cn(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,y=C,b=null,x=null;function _(t){return[(t=i(t[0]*Ct,t[1]*Ct))[0]*u+a,o-t[1]*u]}function w(t){return(t=i.invert((t[0]-a)/u,(o-t[1])/u))&&[t[0]*Ot,t[1]*Ot]}function M(){i=Gr(n=zn(p,g,v),r);var t=r(h,d);return a=c-t[0]*u,o=f+t[1]*u,A()}function A(){return s&&(s.valid=!1,s=null),_}return _.stream=function(t){return s&&(s.valid=!1),(s=On(m(n,l(y(t))))).valid=!0,s},_.clipAngle=function(t){return arguments.length?(m=null==t?(b=t,tn):en((b=+t)*Ct),A()):b},_.clipExtent=function(t){return arguments.length?(x=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):C,A()):x},_.scale=function(t){return arguments.length?(u=+t,M()):u},_.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],M()):[c,f]},_.center=function(t){return arguments.length?(h=t[0]%360*Ct,d=t[1]%360*Ct,M()):[h*Ot,d*Ot]},_.rotate=function(t){return arguments.length?(p=t[0]%360*Ct,g=t[1]%360*Ct,v=t.length>2?t[2]%360*Ct:0,M()):[p*Ot,g*Ot,v*Ot]},t.rebind(_,l,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,M()}}function On(t){return Ln(t,(function(e,r){t.point(e*Ct,r*Ct)}))}function Rn(t,e){return[t,e]}function Pn(t,e){return[t>kt?t-Et:t<-kt?t+Et:t,e]}function zn(t,e,r){return t?e||r?Gr(Dn(t),Nn(e,r)):Dn(t):e||r?Nn(e,r):Pn}function In(t){return function(e,r){return[(e+=t)>kt?e-Et:e<-kt?e+Et:e,r]}}function Dn(t){var e=In(t);return e.invert=In(-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),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 Fn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=jn(r,i),a=jn(r,a),(o>0?ia)&&(i+=o*Et)):(i=t+o*Et,a=t-.5*l);for(var u,c=i;o>0?c>a:c2?t[2]*Ct:0),e.invert=function(e){return(e=t.invert(e[0]*Ct,e[1]*Ct))[0]*=Ot,e[1]*=Ot,e},e},Pn.invert=Rn,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=zn(-t[0]*Ct,-t[1]*Ct,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Ot,t[1]*=Ot}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=Fn((t=+r)*Ct,n*Ct),i):t},i.precision=function(r){return arguments.length?(e=Fn(t*Ct,(n=+r)*Ct),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ct,i=t[1]*Ct,a=e[1]*Ct,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=Bn(o,a,90),c=Un(r,e,m),f=Bn(l,s,90),h=Un(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=Vn,i=Hn;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]*Ct,n=t[1]*Ct,i=e[0]*Ct,a=e[1]*Ct,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)*Ot,Math.atan2(a,Math.sqrt(n*n+i*i))*Ot]}:function(){return[r*Ot,n*Ot]}).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,qn),yn};var qn={sphere:z,point:z,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=Ct),o=Math.cos(i),s=y((n*=Ct)-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}qn.point=function(i,a){t=i*Ct,e=Math.sin(a*=Ct),r=Math.cos(a),qn.point=n},qn.lineEnd=function(){qn.point=qn.lineEnd=z}},lineEnd:z,polygonStart:z,polygonEnd:z};function Gn(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 Xn=Gn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Sn(Xn)}).raw=Xn;var Yn=Gn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),C);function Wn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(kt/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 Jn;function o(t,e){a>0?e<-St+At&&(e=-St+At):e>St-At&&(e=St-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=Rt(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 Zn(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&&Pt(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ai(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Sn(ti)}).raw=ti,ei.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-St]},(t.geo.transverseMercator=function(){var t=Kn(ei),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=ei,t.geom={},t.geom.hull=function(t){var e=ri,r=ni;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=pe(e),a=pe(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-Mi(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=yi(t);if(hi.insert(e,l),e||r){if(e===r)return Li(e),r=yi(e.site),hi.insert(l,r),l.edge=r.edge=Oi(e.site,l.site),Ei(e),void Ei(r);if(r){Li(e),Li(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=Oi(u,t,null,x),r.edge=Oi(t,p,null,x),Ei(e),Ei(r)}else l.edge=Oi(e.site,l.site)}}function wi(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 Mi(t,e){var r=t.N;if(r)return wi(r,e);var n=t.site;return n.y===e?n.x:1/0}function Ai(t){this.site=t,this.edges=[]}function Ti(t,e){return e.angle-t.angle}function ki(){Di(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ei(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>=-Tt)){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=vi.pop()||new ki;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=pi._;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 zi(Ri(a.site,c,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 Bi(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 Bi(s(t)).cells.forEach((function(r,n){for(var i,a,o,s,l=r.site,u=r.edges.sort(Ti),c=-1,f=u.length,h=u[f-1].edge,d=h.l===l?h.r:h.l;++ca||f>o||h=_)<<1|e>=x,M=w+4;wa&&(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:Zi(r,n)})),a=Ki.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}),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)},visit:function(t){Gi(t,k,d,p,g,v)},find:function(t){return Xi(k,t[0],t[1],d,p,g,v)}};if(f=-1,null==e){for(;++f=0&&!(n=t.interpolators[i](e,r)););return n}function ta(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function aa(t){return function(e){return 1-t(1-e)}}function oa(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function sa(t){return t*t}function la(t){return t*t*t}function ua(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ca(t){return 1-Math.cos(t*St)}function fa(t){return Math.pow(2,10*(t-1))}function ha(t){return 1-Math.sqrt(1-t*t)}function da(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 pa(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function ga(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=ma(i),s=va(i,a),l=ma(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=ra.get(n)||ea,ia((i=na.get(i)||C)(n.apply(null,r.call(arguments,1))))},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 Gt(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 Kt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=pa,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 ga(e?e.matrix:ya)})(e)},ga.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ya={a:1,b:0,c:0,d:1,e:0,f:0};function ba(t){return t.length?t.pop()+",":""}function xa(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:Zi(t[0],e[0])},{i:i-2,x:Zi(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(ba(r)+"rotate(",null,")")-2,x:Zi(t,e)})):e&&r.push(ba(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(ba(r)+"skewX(",null,")")-2,x:Zi(t,e)}):e&&r.push(ba(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(ba(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Zi(t[0],e[0])},{i:i-2,x:Zi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(ba(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=we(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 za(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 za(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&&(Pa(t,(function(t){t.children&&(t.value=0)})),za(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 Wa(t){return t.reduce(Za,0)}function Za(t,e){return t+e[1]}function Qa(t,e){return Ja(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ja(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 Ka(e){return[t.min(e),t.max(e)]}function $a(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(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 no(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(io),(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(oo(r,n,i=e[2]),b(i),to(r,i),r._pack_prev=i,to(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=pe(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Ja(e,t)}:pe(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($a),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,za(s,(function(t){t.r=+c(t.value)})),za(s,no),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;za(s,(function(t){t.r+=f})),za(s,no),za(s,(function(t){t.r-=f}))}return function t(e,r,n,i){var a=e.children;if(e.x=r+=i*e.x,e.y=n+=i*e.y,e.r*=i,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);Pa(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=uo(s),a=lo(a),s&&a;)l=lo(l),(o=uo(o)).a=t,(i=s.z+f-a.z-u+r(s._,a._))>0&&(co(fo(s,t,n),t,i),u+=i,c+=i),f+=s.m,u+=a.m,h+=l.m,c+=o.m;s&&!uo(o)&&(o.t=s,o.m+=f-c),a&&!lo(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},Ra(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),u=l[0],c=0;za(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 za(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},Ra(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=ho,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?_o:mo,s=i?wa:_a;return a=t(e,r,s,n),o=t(r,e,s,$i),l}function l(t){return a(t)}return 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(pa)},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 To(e,t)},l.tickFormat=function(t,r){return ko(e,t,r)},l.nice=function(t){return Mo(e,t),s()},l.copy=function(){return t(e,r,n,i)},s()}([0,1],[0,1],$i,!1)};var Eo={s:1,g:1,p:1,r:1,e:1};function Lo(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))}return 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=yo(a.map(o),i?Math:Co);return r.domain(t),a=t.map(s),l},l.ticks=function(){var t=go(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 So;arguments.length<2?r=So:"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=Lt)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,L=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===No?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 S=Math.abs(f-c-2*E)<=kt?0:1;if(E&&Ho(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),M=s*Math.sin(f-k),A=s*Math.cos(c+k),T=s*Math.sin(c+k);var O=Math.abs(c-f+2*k)<=kt?0:1;if(k&&Ho(w,M,A,T)===1-d^O){var R=(c+f)/2;w=s*Math.cos(R),M=s*Math.sin(R),A=T=null}}else w=M=0;if(h>At&&(p=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function qo(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,L=A-p,S=T-g;return k*k+E*E>L*L+S*S&&(w=A,M=T),[[w-l,M-u],[w*r/b,M*r/b]]}function Go(t){var e=ri,r=ni,n=Xr,i=Yo,a=i.key,o=.7;function s(a){var s,l=[],u=[],c=-1,f=a.length,h=pe(e),d=pe(r);function p(){l.push("M",i(t(u),o))}for(;++c1&&i.push("H",n[0]);return i.join("")},"step-before":Zo,"step-after":Qo,basis:$o,"basis-open":function(t){if(t.length<4)return Yo(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(ts(ns,a)+","+ts(ns,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 Yo(t){return t.length>1?t.join("L"):t+"Z"}function Wo(t){return t.join("L")+"Z"}function Zo(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;ukt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=pe(t),a):r},a.source=function(e){return arguments.length?(t=pe(e),a):t},a.target=function(t){return arguments.length?(e=pe(t),a):e},a.startAngle=function(t){return arguments.length?(n=pe(t),a):n},a.endAngle=function(t){return arguments.length?(i=pe(t),a):i},a},t.svg.diagonal=function(){var t=Vn,e=Hn,r=us;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=pe(e),n):t},n.target=function(t){return arguments.length?(e=pe(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=us,n=e.projection;return e.projection=function(t){return arguments.length?n(cs(r=t)):r},e},t.svg.symbol=function(){var t=hs,e=fs;function r(r,n){return(ps.get(t.call(this,r,n))||ds)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=pe(e),r):t},r.size=function(t){return arguments.length?(e=pe(t),r):e},r};var ps=t.map({circle:ds,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*vs)),r=e*vs;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/gs),r=e*gs/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/gs),r=e*gs/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ps.keys();var gs=Math.sqrt(3),vs=Math.tan(30*Ct);X.transition=function(t){for(var e,r,n=xs||++Ms,i=ks(t),a=[],o=_s||{time:Date.now(),ease:ua,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=we((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 _,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++c.count)}ws.call=X.call,ws.empty=X.empty,ws.node=X.node,ws.size=X.size,t.transition=function(e,r){return e&&e.transition?xs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.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=xt(m),k=t.mouse(m),E=t.select(o(m)).on("keydown.brush",C).on("keyup.brush",O);if(t.event.changedTouches?E.on("touchmove.brush",R).on("touchend.brush",z):E.on("mousemove.brush",R).on("mouseup.brush",z),x.interrupt().selectAll("*").interrupt(),A)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(){32==t.event.keyCode&&(A||(f=null,k[0]-=s[1],k[1]-=l[1],A=2),N())}function O(){32==t.event.keyCode&&2==A&&(k[0]+=s[1],k[1]+=l[1],A=0,N())}function R(){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=js(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=js(+e+1);return e}}:t))},i.ticks=function(t,e){var r=go(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],js(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Fs(e.copy(),r,n)},wo(i,e)}function js(t){return new Date(t)}zs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ns:Ds,Ns.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Ns.toString=Ds.toString,Re.second=De((function(t){return new Pe(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 Pe(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 Pe(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 Bs=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[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]],Vs=zs.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]]),Hs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(js)},floor:C,ceil:C};Us.year=Re.year,Re.scale=function(){return Fs(t.scale.linear(),Us,Vs)};var qs=Us.map((function(t){return[t[0].utc,t[1]]})),Gs=Is.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 Xs(t){return JSON.parse(t.responseText)}function Ys(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}qs.year=Re.year.utc,Re.scale.utc=function(){return Fs(t.scale.linear(),qs,Gs)},t.text=ge((function(t){return t.responseText})),t.json=function(t,e){return ve(t,"application/json",Xs,e)},t.html=function(t,e){return ve(t,"text/html",Ys,e)},t.xml=ge((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],83:[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(c=0;c<_.length;++c){h=(x=_[c])[0];x[0]=x[1],x[1]=h}return _}},{"incremental-convex-hull":249,uniq:347}],85:[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:49}],86:[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}}},{}],87:[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;n2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(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 l(t)}return o(t,e,r)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|f(t,e),n=i(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return u(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(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(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 I(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(i)return n?-1:I(t).length;e=(""+e).toLowerCase(),i=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 k(this,e,r);case"utf8":case"utf-8":return M(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return w(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function p(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),j(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=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:g(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):g(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(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 w(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}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<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},a.prototype.compare=function(t,e,r,n,i){if(F(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.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 o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),l=Math.min(o,s),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 v(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(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 S(t,e,r,n,i,o){if(!a.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 C(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 O(t,e,r,i,a){return e=+e,r>>>=0,a||C(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function R(t,e,r,i,a){return e=+e,r>>>=0,a||C(t,0,r,8),n.write(t,e,r,i,52,8),r+8}a.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||L(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||L(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||L(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},a.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||L(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||S(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)||S(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},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||S(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},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||S(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},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);S(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},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);S(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},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||S(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},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||S(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},a.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.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;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},a.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&&!a.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(o=e;o55295&&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 D(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function j(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":19,buffer:49,ieee754:269}],50:[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 d=r.pop(),p=(s=r.pop(),c=-1,f=-1,l=o[s],1);p=0||(e.flip(s,d),i(t,e,r,c,s,f),i(t,e,r,s,f,c),i(t,e,r,f,d,c),i(t,e,r,d,c,f)))}}},{"binary-search-bounds":36,"robust-in-sphere":337}],52:[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=f.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 c(t,e){var r;return(r=t.a[0]p[0]&&i.push(new o(p,d,2,l),new o(d,p,1,l))}i.sort(s);for(var g=i[0].a[0]-(1+Math.abs(i[0].a[0]))*Math.pow(2,-52),v=[new a([g,1],[g,0],-1,[],[],[],[])],m=[],y=(l=0,i.length);l=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;nr?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],M=t[_];if((w[0]-M[0]||w[1]-M[1])<0){var T=x;x=_,_=T}b[0]=x;var A,k=b[1]=E[1];for(i&&(A=b[2]);a>0&&n[a-1][0]===c;){var E,L=(E=n[--a])[1];i?e.push([k,L,A]):e.push([k,L]),k=L}i?e.push([k,_,A]):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":23,"big-rat/cmp":21,"big-rat/to-float":35,"box-intersect":40,nextafter:302,"rat-vec":328,"robust-segment-intersect":342,"union-find":367}],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":22,"big-rat/mul":32,"big-rat/sign":33,"big-rat/sub":34,"rat-vec/add":327,"rat-vec/muls":329,"rat-vec/sub":330}],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:86}],63:[function(t,e,r){(function(r){(function(){"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=(d=t.slice(1)).length;u=1,c<=4?(l=[parseInt(d[0]+d[0],16),parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16)],4===c&&(u=parseInt(d[3]+d[3],16)/255)):(l=[parseInt(d[0]+d[1],16),parseInt(d[2]+d[3],16),parseInt(d[4]+d[5],16)],8===c&&(u=parseInt(d[6]+d[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 f=e[1],h="rgb"===f,d=f.replace(/a$/,"");s=d;c="cmyk"===d?4:"gray"===d?1:3;l=e[2].trim().split(/\s*,\s*/).map((function(t,e){if(/%$/.test(t))return e===c?parseFloat(t)/100:"rgb"===d?255*parseFloat(t)/100:parseFloat(t);if("h"===d[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)})),f===d&&l.push(1),u=h||void 0===l[c]?1:l[c],l=l.slice(0,c)}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)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":61,defined:83,"is-plain-obj":278}],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[3]=p[0]+(p[1]-p[0])*r),n})),m=[];for(g=0;g0||l(t,e,a)?-1:1:0===s?u>0||l(t,e,r)?1:-1:i(u-s)}var h=n(t,e,r);return h>0?o>0&&n(t,e,a)>0?1:-1:h<0?o>0||n(t,e,a)>0?1:-1:n(t,e,a)>0||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":339,"robust-product":340,"robust-sum":344,signum:345,"two-sum":365}],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}(n(a,!0),r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":14,"incremental-convex-hull":270}],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&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,s=new Array(t.arrayArgs.length),l=new Array(t.arrayArgs.length),u=0;u0&&b.push("shape=SS.slice(0)"),t.indexArgs.length>0){var x=new Array(r);for(u=0;u0&&y.push("var "+b.join(",")),u=0;u3&&y.push(a(t.pre,t,l));var T=a(t.body,t,l),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&&y.push(a(t.post,t,l)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+y.join("\n")+"\n----------");var k=[t.funcName||"unnamed","_cwise_loop_",s[0].join("s"),"m",A,o(l)].join("");return new Function(["function ",k,"(",m.join(","),"){",y.join("\n"),"} return ",k].join(""))()}},{uniq:368}],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;c=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:vt,s:mt,S:H,u:q,U:G,V:X,w:Y,W:W,x:null,X:null,y:Z,Y:Q,Z:K,"%":gt},Ct={a:function(t){return f[t.getUTCDay()]},A:function(t){return c[t.getUTCDay()]},b:function(t){return yt[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:J,e:J,f:nt,H:$,I:tt,j:et,L:rt,m:it,M:at,p:function(t){return u[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:vt,s:mt,S:ot,u:st,U:lt,V:ut,w:ct,W:ft,x:null,X:null,y:ht,Y:dt,Z:pt,"%":gt},Ot={a:function(t,e,r){var n=Mt.exec(e.slice(r));return n?(t.w=Tt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=Et.exec(e.slice(r));return n?(t.m=Lt[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=At.exec(e.slice(r));return n?(t.m=kt[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return zt(t,a,e,r)},d:A,e:A,f:O,H:E,I:E,j:k,L:C,m:T,M:L,p:function(t,e,r){var n=bt.exec(e.slice(r));return n?(t.p=xt[n[0].toLowerCase()],r+n[0].length):-1},q:M,Q:P,s:z,S:S,u:v,U:m,V:y,w:g,W:b,x:function(t,e,r){return zt(t,o,e,r)},X:function(t,e,r){return zt(t,l,e,r)},y:_,Y:x,Z:w,"%":R};function Rt(t,e){return function(r){var n,i,a,o=[],l=-1,u=0,c=t.length;for(r instanceof Date||(r=new Date(+r));++l53)return null;"w"in u||(u.w=1),"Z"in u?(l=(s=n(i(u.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(u.V-1)),u.y=s.getUTCFullYear(),u.m=s.getUTCMonth(),u.d=s.getUTCDate()+(u.w+6)%7):(l=(s=r(i(u.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(u.V-1)),u.y=s.getFullYear(),u.m=s.getMonth(),u.d=s.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),l="Z"in u?n(i(u.y,0,1)).getUTCDay():r(i(u.y,0,1)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+7*u.W-(l+5)%7:u.w+7*u.U-(l+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,n(u)):r(u)}}function zt(t,e,r,n){for(var i,a,o=0,l=e.length,u=r.length;o=u)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=Ot[i in s?e.charAt(o++):i])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}return St.x=Rt(o,St),St.X=Rt(l,St),St.c=Rt(a,St),Ct.x=Rt(o,Ct),Ct.X=Rt(l,Ct),Ct.c=Rt(a,Ct),{format:function(t){var e=Rt(t+="",St);return e.toString=function(){return t},e},parse:function(t){var e=Pt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=Rt(t+="",Ct);return e.toString=function(){return t},e},utcParse:function(t){var e=Pt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,u=/^%/,c=/[\\^$*+?|[\]().{}]/g;function f(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function O(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function R(t,e,r){var n=u.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function P(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function z(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function I(t,e){return f(t.getDate(),e,2)}function D(t,e){return f(t.getHours(),e,2)}function N(t,e){return f(t.getHours()%12||12,e,2)}function F(t,r){return f(1+e.timeDay.count(e.timeYear(t),t),r,3)}function j(t,e){return f(t.getMilliseconds(),e,3)}function B(t,e){return j(t,e)+"000"}function U(t,e){return f(t.getMonth()+1,e,2)}function V(t,e){return f(t.getMinutes(),e,2)}function H(t,e){return f(t.getSeconds(),e,2)}function q(t){var e=t.getDay();return 0===e?7:e}function G(t,r){return f(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function X(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function Y(t){return t.getDay()}function W(t,r){return f(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function Z(t,e){return f(t.getFullYear()%100,e,2)}function Q(t,e){return f(t.getFullYear()%1e4,e,4)}function K(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+f(e/60|0,"0",2)+f(e%60,"0",2)}function J(t,e){return f(t.getUTCDate(),e,2)}function $(t,e){return f(t.getUTCHours(),e,2)}function tt(t,e){return f(t.getUTCHours()%12||12,e,2)}function et(t,r){return f(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return f(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function it(t,e){return f(t.getUTCMonth()+1,e,2)}function at(t,e){return f(t.getUTCMinutes(),e,2)}function ot(t,e){return f(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,r){return f(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ut(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ct(t){return t.getUTCDay()}function ft(t,r){return f(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function ht(t,e){return f(t.getUTCFullYear()%100,e,2)}function dt(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function pt(){return"+0000"}function gt(){return"%"}function vt(t){return+t}function mt(t){return Math.floor(+t/1e3)}function yt(e){return o=a(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var bt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var xt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=bt,t.isoParse=xt,t.timeFormatDefaultLocale=yt,t.timeFormatLocale=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":81}],81:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,i,a,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),i(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e0))return o;do{o.push(a=new Date(+e)),i(e,n),t(e)}while(a=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;i(t,-1),!e(t););else for(;--r>=0;)for(;i(t,1),!e(t););}))},a&&(s.count=function(n,i){return e.setTime(+n),r.setTime(+i),t(e),t(r),Math.floor(a(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var i=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):i:null};var a=i.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),u=l.range,c=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),f=c.range,h=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),d=h.range;function p(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var g=p(0),v=p(1),m=p(2),y=p(3),b=p(4),x=p(5),_=p(6),w=g.range,M=v.range,T=m.range,A=y.range,k=b.range,E=x.range,L=_.range,S=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),C=S.range,O=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));O.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var R=O.range,P=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),z=P.range,I=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),D=I.range,N=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),F=N.range;function j(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var B=j(0),U=j(1),V=j(2),H=j(3),q=j(4),G=j(5),X=j(6),Y=B.range,W=U.range,Z=V.range,Q=H.range,K=q.range,J=G.range,$=X.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=h,t.timeDays=d,t.timeFriday=x,t.timeFridays=E,t.timeHour=c,t.timeHours=f,t.timeInterval=n,t.timeMillisecond=i,t.timeMilliseconds=a,t.timeMinute=l,t.timeMinutes=u,t.timeMonday=v,t.timeMondays=M,t.timeMonth=S,t.timeMonths=C,t.timeSaturday=_,t.timeSaturdays=L,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=g,t.timeSundays=w,t.timeThursday=b,t.timeThursdays=k,t.timeTuesday=m,t.timeTuesdays=T,t.timeWednesday=y,t.timeWednesdays=A,t.timeWeek=g,t.timeWeeks=w,t.timeYear=O,t.timeYears=R,t.utcDay=N,t.utcDays=F,t.utcFriday=G,t.utcFridays=J,t.utcHour=I,t.utcHours=D,t.utcMillisecond=i,t.utcMilliseconds=a,t.utcMinute=P,t.utcMinutes=z,t.utcMonday=U,t.utcMondays=W,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=X,t.utcSaturdays=$,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=B,t.utcSundays=Y,t.utcThursday=q,t.utcThursdays=K,t.utcTuesday=V,t.utcTuesdays=Z,t.utcWednesday=H,t.utcWednesdays=Q,t.utcWeek=B,t.utcWeeks=Y,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],82:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},i=this.document;function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(i)try{n(i.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),i)try{i.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,u=s.setAttributeNS,c=this.CSSStyleDeclaration.prototype,f=c.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){u.call(this,t,e,r+"")},c.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function h(t,e){return te?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){for(var e=1;t*e%1;)e*=10;return e}function x(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){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=b(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 _;++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 S;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(B,"\\$&")};var B=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return U(t,X),t}var H=function(t,e){return e.querySelector(t)},q=function(t,e){return e.querySelectorAll(t)},G=function(t,e){var r=t.matches||t[R(t,"matchesSelector")];return(G=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(H=function(t,e){return Sizzle(t,e)[0]||null},q=Sizzle,G=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var X=t.selection.prototype=[];function Y(t){return"function"==typeof t?t:function(){return H(t,this)}}function W(t){return"function"==typeof t?t:function(){return q(t,this)}}X.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)),Q.hasOwnProperty(r)?{space:Q[r],local:t}:t}},X.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))},X.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(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},X.sort=function(t){t=ut.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=i+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=gt.get(e);function u(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=mt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:u:r?z: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=X.append,ht.empty=X.empty,ht.node=X.node,ht.call=X.call,ht.size=X.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s0?1:t<0?-1:0}function Pt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function zt(t){return t>1?0:t<-1?kt:Math.acos(t)}function It(t){return t>1?St:t<-1?-St:Math.asin(t)}function Dt(t){return((t=Math.exp(t))+1/t)/2}function Nt(t){return(t=Math.sin(t/2))*t}var Ft=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,l).on(b,u),a=M(t.mouse(e)),s=xt(e);function l(){n=1,A(t.mouse(e),a),S(r)}function u(){i.on(y,null).on(b,null),s(n),C(r)}ms.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=xt(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);ms.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)||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 ne(a(t+120),a(t),a(t-120))}function Xt(e,r,n){return this instanceof Xt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Xt?new Xt(e.h,e.c,e.l):$t(e instanceof Zt?e.l:(e=ce((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Xt(e,r,n)}qt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,this.l/t)},qt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ht(this.h,this.s,t*this.l)},qt.rgb=function(){return Gt(this.h,this.s,this.l)},t.hcl=Xt;var Yt=Xt.prototype=new Vt;function Wt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Zt(r,Math.cos(t*=Ct)*e,Math.sin(t)*e)}function Zt(t,e,r){return this instanceof Zt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Zt?new Zt(t.l,t.a,t.b):t instanceof Xt?Wt(t.h,t.c,t.l):ce((t=ne(t)).r,t.g,t.b):new Zt(t,e,r)}Yt.brighter=function(t){return new Xt(this.h,this.c,Math.min(100,this.l+Qt*(arguments.length?t:1)))},Yt.darker=function(t){return new Xt(this.h,this.c,Math.max(0,this.l-Qt*(arguments.length?t:1)))},Yt.rgb=function(){return Wt(this.h,this.c,this.l).rgb()},t.lab=Zt;var Qt=18,Kt=Zt.prototype=new Vt;function Jt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ne(re(3.2404542*(i=.95047*te(i))-1.5371385*(n=1*te(n))-.4985314*(a=1.08883*te(a))),re(-.969266*i+1.8760108*n+.041556*a),re(.0556434*i-.2040259*n+1.0572252*a))}function $t(t,e,r){return t>0?new Xt(Math.atan2(r,e)*Ot,Math.sqrt(e*e+r*r),t):new Xt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,Gt):new ne(t,e,r)}function ie(t){return new ne(t>>16,t>>8&255,255&t)}function ae(t){return ie(t)+""}Kt.brighter=function(t){return new Zt(Math.min(100,this.l+Qt*(arguments.length?t:1)),this.a,this.b)},Kt.darker=function(t){return new Zt(Math.max(0,this.l-Qt*(arguments.length?t:1)),this.a,this.b)},Kt.rgb=function(){return Jt(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(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(he(i[0]),he(i[1]),he(i[2]))}return(a=de.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 ue(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 Ht(n,i,l)}function ce(t,e,r){var n=ee((.4124564*(t=fe(t))+.3575761*(e=fe(e))+.1804375*(r=fe(r)))/.95047),i=ee((.2126729*t+.7151522*e+.072175*r)/1);return Zt(116*i-16,500*(n-i),200*(i-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function he(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.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))}de.forEach((function(t,e){de.set(t,ie(e))})),t.functor=pe,t.xhr=ge(C),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=ve(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(xe),xe=setTimeout(Me,e)),be=0):(be=1,_e(Me))}function Te(){for(var t=Date.now(),e=me;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ae(){for(var t,e=me,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Le(e){var r=e.decimal,n=e.thousands,i=e.grouping,a=e.currency,o=i&&n?function(t,e){for(var r=t.length,a=[],o=0,s=i[0],l=0;r>0&&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)}:C;return function(e){var n=Se.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=Ce.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 T=b?e.lastIndexOf("e"):-1;T<0?(_=e,w=""):(_=e.substring(0,T),w=e.substring(T))}else _=e.substring(0,M),w=r+e.substring(M+1);!c&&h&&(_=o(_,1/0));var A=v.length+_.length+w.length+(x?0:a.length),k=A"===s?k+a+e:"^"===s?k.substring(0,A>>=1)+a+e+k.substring(A):a+(x?e:k+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,ke(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)))),Ee[8+n/3]};var Se=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ce=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,ke(e,r))).toFixed(Math.max(0,Math.min(20,ke(e*(1+1e-15),r))))}});function Oe(t){return t+""}var Re=t.time={},Pe=Date;function ze(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}ze.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(){Ie.setUTCDate.apply(this._,arguments)},setDay:function(){Ie.setUTCDay.apply(this._,arguments)},setFullYear:function(){Ie.setUTCFullYear.apply(this._,arguments)},setHours:function(){Ie.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Ie.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Ie.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Ie.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Ie.setUTCSeconds.apply(this._,arguments)},setTime:function(){Ie.setTime.apply(this._,arguments)}};var Ie=Date.prototype;function De(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=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(Pe=ze);return r._=t,e(r)}finally{Pe=Date}}return r.parse=function(t){try{Pe=ze;var r=e.parse(t);return r&&r._}finally{Pe=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:Je,e:Je,H:tr,I:tr,j:$e,L:nr,m:Ke,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:Ye,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:We,Z:Qe,"%":ar};return c}Re.year=De((function(t){return(t=Re.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),Re.years=Re.year.range,Re.years.utc=Re.year.utc.range,Re.day=De((function(t){var e=new Pe(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),Re.days=Re.day.range,Re.days.utc=Re.day.utc.range,Re.dayOfYear=function(t){var e=Re.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=Re[t]=De((function(t){return(t=Re.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=Re.year(t).getDay();return Math.floor((Re.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));Re[t+"s"]=r.range,Re[t+"s"].utc=r.utc.range,Re[t+"OfYear"]=function(t){var r=Re.year(t).getDay();return Math.floor((Re.dayOfYear(t)+(r+e)%7)/7)}})),Re.week=Re.sunday,Re.weeks=Re.sunday.range,Re.weeks.utc=Re.sunday.utc.range,Re.weekOfYear=Re.sundayOfYear;var je={"-":"",_:" ",0:"0"},Be=/^\s*\d+/,Ue=/^%/;function Ve(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?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 Ke(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 $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;++r=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)*Ct,n=Math.cos(s=(e=s)*Ct/2+kt/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 Dr(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 Nr(t){return[Math.atan2(t[1],t[0]),It(t[2])]}function Fr(t,e){return y(t[0]-e[0])Tt?i=90:u<-Tt&&(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*Ct,o*Ct]);if(l){var u=Pr(l,s),c=Pr([u[1],-u[0],0],u);Dr(c),c=Nr(c);var f=t-a,h=f>0?1:-1,p=c[0]*Ot*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)>Tt&&(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=Tr=Ar=kr=Er=0,t.geo.stream(e,jr);var r=Ar,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 Wr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,M=w*_,T=M>kt,A=p*b;if(Lr.add(Math.atan2(A*w*Math.sin(M),g*x+A*Math.cos(M))),a+=T?_+w*Et:_,T^h>=r^m>=r){var k=Pr(Or(f),Or(t));Dr(k);var E=Pr(i,k);Dr(E);var L=(T^_>=0?-1:1)*It(E[2]);(n>L||n===L&&(k[0]||k[1]))&&(o+=T^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-Tt||a0){for(b||(o.polygonStart(),b=!0),o.lineStart();++a1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter(Kr))}return c}}function Kr(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:z,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-Tt:St-t[1])-((e=e.x)[0]<0?e[1]-St-Tt: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?kt:-kt,l=y(a-r);y(l-kt)0?St:-St),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=kt&&(y(r-i)Tt?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(-kt,i),n.point(0,i),n.point(kt,i),n.point(kt,0),n.point(kt,-i),n.point(0,-i),n.point(-kt,-i),n.point(-kt,0),n.point(-kt,i);else if(y(t[0]-e[0])>Tt){var a=t[0]0,n=y(e)>Tt;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?kt:-kt),h):0;if(!e&&(u=l=g)&&t.lineStart(),g!==l&&(d=a(e,p),(Fr(e,d)||Fr(p,d))&&(p[0]+=Tt,p[1]+=Tt,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}}}),Fn(t,6*Ct),r?[0,-t]:[-kt,t-kt]);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=Nr(b),!n)return b;var x,_=t[0],w=r[0],M=t[1],T=r[1];w<_&&(x=_,_=w,w=x);var A=w-_,k=y(A-kt)0^b[1]<(y(b[0]-_)kt^(_<=b[0]&&b[0]<=w)){var E=Ir(d,(-p+m)/g);return zr(E,h),[b,Nr(E)]}}}function o(e,n){var i=r?t:kt-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}function rn(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=0,f=1,h=s.x-l,d=s.y-u;if(a=t-l,h||!(a>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}}}}}}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=rn(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&&Pt(u,a,t)>0&&++e:a[1]<=n&&Pt(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(),T(null,null,1,l),l.lineEnd()),a&&Yr(u,o,r,T,l),l.polygonEnd()),u=c=f=null}};function T(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 A(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function k(t,e){A(t,e)&&l.point(t,e)}function E(t,e){var r=A(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,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=kt/3,n=Cn(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*kt/180,r=t[1]*kt/180):[e/kt*180,r/kt*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+Tt,f+.12*e+Tt],[c-.214*e-Tt,f+.234*e-Tt]]).stream(l).point,i=s.translate([c-.205*e,f+.212*e]).clipExtent([[c-.214*e+Tt,f+.166*e+Tt],[c-.115*e-Tt,f+.234*e-Tt]]).stream(l).point,u},u.scale(1070)};var sn,ln,un,cn,fn,hn,dn={point:z,lineStart:z,lineEnd:z,polygonStart:function(){ln=0,dn.lineStart=pn},polygonEnd:function(){dn.lineStart=dn.lineEnd=dn.point=z,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:z,lineEnd:z,polygonStart:z,polygonEnd:z};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,Tr+=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,Tr+=o,Ar+=(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 Tn(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:z};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,Et)}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 An(t){var e=.5,r=Math.cos(30*Ct),n=16;function i(t){return(n?o:a)(t)}function a(e){return Ln(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,i,a,o,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 a=Or([r,i]),o=t(r,i);s(f,h,c,d,p,g,f=o[0],h=o[1],c=r,d=a[0],p=a[1],g=a[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,a=h,o=d,l=p,u=g,v.point=b}function M(){s(f,h,c,d,p,g,i,a,r,o,l,u,n,e),v.lineEnd=x,x()}return v}function s(n,i,a,o,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=o+d,M=l+p,T=u+g,A=Math.sqrt(w*w+M*M+T*T),k=Math.asin(T/=A),E=y(y(T)-1)e||y((b*O+x*R)/_-.5)>.3||o*d+l*p+u*g0&&16,i):Math.sqrt(e)},i}function kn(t){var e=An((function(e,r){return t([e*Ot,r*Ot])}));return function(t){return On(e(t))}}function En(t){this.stream=t}function Ln(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 Cn((function(){return t}))()}function Cn(e){var r,n,i,a,o,s,l=An((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,y=C,b=null,x=null;function _(t){return[(t=i(t[0]*Ct,t[1]*Ct))[0]*u+a,o-t[1]*u]}function w(t){return(t=i.invert((t[0]-a)/u,(o-t[1])/u))&&[t[0]*Ot,t[1]*Ot]}function M(){i=Gr(n=zn(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),_}return _.stream=function(t){return s&&(s.valid=!1),(s=On(m(n,l(y(t))))).valid=!0,s},_.clipAngle=function(t){return arguments.length?(m=null==t?(b=t,tn):en((b=+t)*Ct),T()):b},_.clipExtent=function(t){return arguments.length?(x=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):C,T()):x},_.scale=function(t){return arguments.length?(u=+t,M()):u},_.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],M()):[c,f]},_.center=function(t){return arguments.length?(h=t[0]%360*Ct,d=t[1]%360*Ct,M()):[h*Ot,d*Ot]},_.rotate=function(t){return arguments.length?(p=t[0]%360*Ct,g=t[1]%360*Ct,v=t.length>2?t[2]%360*Ct:0,M()):[p*Ot,g*Ot,v*Ot]},t.rebind(_,l,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,M()}}function On(t){return Ln(t,(function(e,r){t.point(e*Ct,r*Ct)}))}function Rn(t,e){return[t,e]}function Pn(t,e){return[t>kt?t-Et:t<-kt?t+Et:t,e]}function zn(t,e,r){return t?e||r?Gr(Dn(t),Nn(e,r)):Dn(t):e||r?Nn(e,r):Pn}function In(t){return function(e,r){return[(e+=t)>kt?e-Et:e<-kt?e+Et:e,r]}}function Dn(t){var e=In(t);return e.invert=In(-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),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 Fn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=jn(r,i),a=jn(r,a),(o>0?ia)&&(i+=o*Et)):(i=t+o*Et,a=t-.5*l);for(var u,c=i;o>0?c>a:c2?t[2]*Ct:0),e.invert=function(e){return(e=t.invert(e[0]*Ct,e[1]*Ct))[0]*=Ot,e[1]*=Ot,e},e},Pn.invert=Rn,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=zn(-t[0]*Ct,-t[1]*Ct,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Ot,t[1]*=Ot}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=Fn((t=+r)*Ct,n*Ct),i):t},i.precision=function(r){return arguments.length?(e=Fn(t*Ct,(n=+r)*Ct),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ct,i=t[1]*Ct,a=e[1]*Ct,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)>Tt})).map(u)).concat(t.range(Math.ceil(o/p)*p,a,p).filter((function(t){return y(t%v)>Tt})).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=Bn(o,a,90),c=Un(r,e,m),f=Bn(l,s,90),h=Un(i,n,m),b):m},b.majorExtent([[-180,-90+Tt],[180,90-Tt]]).minorExtent([[-180,-80-Tt],[180,80+Tt]])},t.geo.greatArc=function(){var e,r,n=Vn,i=Hn;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]*Ct,n=t[1]*Ct,i=e[0]*Ct,a=e[1]*Ct,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)*Ot,Math.atan2(a,Math.sqrt(n*n+i*i))*Ot]}:function(){return[r*Ot,n*Ot]}).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,qn),yn};var qn={sphere:z,point:z,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=Ct),o=Math.cos(i),s=y((n*=Ct)-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}qn.point=function(i,a){t=i*Ct,e=Math.sin(a*=Ct),r=Math.cos(a),qn.point=n},qn.lineEnd=function(){qn.point=qn.lineEnd=z}},lineEnd:z,polygonStart:z,polygonEnd:z};function Gn(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 Xn=Gn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Sn(Xn)}).raw=Xn;var Yn=Gn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),C);function Wn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(kt/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 Kn;function o(t,e){a>0?e<-St+Tt&&(e=-St+Tt):e>St-Tt&&(e=St-Tt);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=Rt(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 Zn(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&&Pt(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ai(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Sn(ti)}).raw=ti,ei.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-St]},(t.geo.transverseMercator=function(){var t=Jn(ei),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=ei,t.geom={},t.geom.hull=function(t){var e=ri,r=ni;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=pe(e),a=pe(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)d.push(t[s[u[n]][2]]);for(n=+f;nTt)s=s.L;else{if(!((i=a-Mi(s,o))>Tt)){n>-Tt?(e=s.P,r=s):i>-Tt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=yi(t);if(hi.insert(e,l),e||r){if(e===r)return Li(e),r=yi(e.site),hi.insert(l,r),l.edge=r.edge=Oi(e.site,l.site),Ei(e),void Ei(r);if(r){Li(e),Li(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=Oi(u,t,null,x),r.edge=Oi(t,p,null,x),Ei(e),Ei(r)}else l.edge=Oi(e.site,l.site)}}function wi(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 Mi(t,e){var r=t.N;if(r)return wi(r,e);var n=t.site;return n.y===e?n.x:1/0}function Ti(t){this.site=t,this.edges=[]}function Ai(t,e){return e.angle-t.angle}function ki(){Di(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ei(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=vi.pop()||new ki;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=pi._;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.xTt||y(i-r)>Tt)&&(s.splice(o,0,new zi(Ri(a.site,c,y(n-f)Tt?{x:f,y:y(e-f)Tt?{x:y(r-p)Tt?{x:h,y:y(e-h)Tt?{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)/Tt)*Tt,y:Math.round(i(t,e)/Tt)*Tt,i:e}}))}return o.links=function(t){return Bi(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 Bi(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||f>o||h=_)<<1|e>=x,M=w+4;wa&&(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:Zi(r,n)})),a=Ji.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 T(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)A(t,e,r,n,i,a,o,s);else{var c=t.point;t.x=t.y=t.point=null,A(t,c,l,u,i,a,o,s),A(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else A(t,e,r,n,i,a,o,s)}function A(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,T(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),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){T(k,t,+m(t,++f),+b(t,f),d,p,g,v)},visit:function(t){Gi(t,k,d,p,g,v)},find:function(t){return Xi(k,t[0],t[1],d,p,g,v)}};if(f=-1,null==e){for(;++f=0&&!(n=t.interpolators[i](e,r)););return n}function ta(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function aa(t){return function(e){return 1-t(1-e)}}function oa(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function sa(t){return t*t}function la(t){return t*t*t}function ua(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ca(t){return 1-Math.cos(t*St)}function fa(t){return Math.pow(2,10*(t-1))}function ha(t){return 1-Math.sqrt(1-t*t)}function da(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 pa(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function ga(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=ma(i),s=va(i,a),l=ma(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=ra.get(n)||ea,ia((i=na.get(i)||C)(n.apply(null,r.call(arguments,1))))},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 Gt(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 Jt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=pa,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 ga(e?e.matrix:ya)})(e)},ga.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ya={a:1,b:0,c:0,d:1,e:0,f:0};function ba(t){return t.length?t.pop()+",":""}function xa(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:Zi(t[0],e[0])},{i:i-2,x:Zi(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(ba(r)+"rotate(",null,")")-2,x:Zi(t,e)})):e&&r.push(ba(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(ba(r)+"skewX(",null,")")-2,x:Zi(t,e)}):e&&r.push(ba(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(ba(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Zi(t[0],e[0])},{i:i-2,x:Zi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(ba(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=we(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 za(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 za(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&&(Pa(t,(function(t){t.children&&(t.value=0)})),za(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 Wa(t){return t.reduce(Za,0)}function Za(t,e){return t+e[1]}function Qa(t,e){return Ka(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ka(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 Ja(e){return[t.min(e),t.max(e)]}function $a(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(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 no(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(io),(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(oo(r,n,i=e[2]),b(i),to(r,i),r._pack_prev=i,to(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=pe(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Ka(e,t)}:pe(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($a),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,za(s,(function(t){t.r=+c(t.value)})),za(s,no),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;za(s,(function(t){t.r+=f})),za(s,no),za(s,(function(t){t.r-=f}))}return function t(e,r,n,i){var a=e.children;if(e.x=r+=i*e.x,e.y=n+=i*e.y,e.r*=i,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);Pa(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=uo(s),a=lo(a),s&&a;)l=lo(l),(o=uo(o)).a=t,(i=s.z+f-a.z-u+r(s._,a._))>0&&(co(fo(s,t,n),t,i),u+=i,c+=i),f+=s.m,u+=a.m,h+=l.m,c+=o.m;s&&!uo(o)&&(o.t=s,o.m+=f-c),a&&!lo(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},Ra(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),u=l[0],c=0;za(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 za(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},Ra(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=ho,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?_o:mo,s=i?wa:_a;return a=t(e,r,s,n),o=t(r,e,s,$i),l}function l(t){return a(t)}return 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(pa)},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 Ao(e,t)},l.tickFormat=function(t,r){return ko(e,t,r)},l.nice=function(t){return Mo(e,t),s()},l.copy=function(){return t(e,r,n,i)},s()}([0,1],[0,1],$i,!1)};var Eo={s:1,g:1,p:1,r:1,e:1};function Lo(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))}return 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=yo(a.map(o),i?Math:Co);return r.domain(t),a=t.map(s),l},l.ticks=function(){var t=go(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 So;arguments.length<2?r=So:"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=Lt)return l(u,d)+(s?l(s,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,M,T,A,k=0,E=0,L=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===No?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 S=Math.abs(f-c-2*E)<=kt?0:1;if(E&&Ho(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),M=s*Math.sin(f-k),T=s*Math.cos(c+k),A=s*Math.sin(c+k);var O=Math.abs(c-f+2*k)<=kt?0:1;if(k&&Ho(w,M,T,A)===1-d^O){var R=(c+f)/2;w=s*Math.cos(R),M=s*Math.sin(R),T=A=null}}else w=M=0;if(h>Tt&&(p=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function qo(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,T=(x*m+v*_)/y,A=(-x*v+m*_)/y,k=w-p,E=M-g,L=T-p,S=A-g;return k*k+E*E>L*L+S*S&&(w=T,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}function Go(t){var e=ri,r=ni,n=Xr,i=Yo,a=i.key,o=.7;function s(a){var s,l=[],u=[],c=-1,f=a.length,h=pe(e),d=pe(r);function p(){l.push("M",i(t(u),o))}for(;++c1&&i.push("H",n[0]);return i.join("")},"step-before":Zo,"step-after":Qo,basis:$o,"basis-open":function(t){if(t.length<4)return Yo(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(ts(ns,a)+","+ts(ns,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 Yo(t){return t.length>1?t.join("L"):t+"Z"}function Wo(t){return t.join("L")+"Z"}function Zo(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;ukt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=pe(t),a):r},a.source=function(e){return arguments.length?(t=pe(e),a):t},a.target=function(t){return arguments.length?(e=pe(t),a):e},a.startAngle=function(t){return arguments.length?(n=pe(t),a):n},a.endAngle=function(t){return arguments.length?(i=pe(t),a):i},a},t.svg.diagonal=function(){var t=Vn,e=Hn,r=us;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=pe(e),n):t},n.target=function(t){return arguments.length?(e=pe(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=us,n=e.projection;return e.projection=function(t){return arguments.length?n(cs(r=t)):r},e},t.svg.symbol=function(){var t=hs,e=fs;function r(r,n){return(ps.get(t.call(this,r,n))||ds)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=pe(e),r):t},r.size=function(t){return arguments.length?(e=pe(t),r):e},r};var ps=t.map({circle:ds,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*vs)),r=e*vs;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/gs),r=e*gs/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/gs),r=e*gs/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ps.keys();var gs=Math.sqrt(3),vs=Math.tan(30*Ct);X.transition=function(t){for(var e,r,n=xs||++Ms,i=ks(t),a=[],o=_s||{time:Date.now(),ease:ua,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=we((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 _,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++c.count)}ws.call=X.call,ws.empty=X.empty,ws.node=X.node,ws.size=X.size,t.transition=function(e,r){return e&&e.transition?xs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.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,T=y.classed("extent"),A=xt(m),k=t.mouse(m),E=t.select(o(m)).on("keydown.brush",C).on("keyup.brush",O);if(t.event.changedTouches?E.on("touchmove.brush",R).on("touchend.brush",z):E.on("mousemove.brush",R).on("mouseup.brush",z),x.interrupt().selectAll("*").interrupt(),T)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(){32==t.event.keyCode&&(T||(f=null,k[0]-=s[1],k[1]-=l[1],T=2),N())}function O(){32==t.event.keyCode&&2==T&&(k[0]+=s[1],k[1]+=l[1],T=0,N())}function R(){var e=t.mouse(m),r=!1;v&&(e[0]+=v[0],e[1]+=v[1]),T||(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=js(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=js(+e+1);return e}}:t))},i.ticks=function(t,e){var r=go(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],js(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Fs(e.copy(),r,n)},wo(i,e)}function js(t){return new Date(t)}zs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ns:Ds,Ns.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Ns.toString=Ds.toString,Re.second=De((function(t){return new Pe(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 Pe(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 Pe(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 Bs=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[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]],Vs=zs.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]]),Hs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(js)},floor:C,ceil:C};Us.year=Re.year,Re.scale=function(){return Fs(t.scale.linear(),Us,Vs)};var qs=Us.map((function(t){return[t[0].utc,t[1]]})),Gs=Is.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 Xs(t){return JSON.parse(t.responseText)}function Ys(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}qs.year=Re.year.utc,Re.scale.utc=function(){return Fs(t.scale.linear(),qs,Gs)},t.text=ge((function(t){return t.responseText})),t.json=function(t,e){return ve(t,"application/json",Xs,e)},t.html=function(t,e){return ve(t,"text/html",Ys,e)},t.xml=ge((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],83:[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(c=0;c<_.length;++c){h=(x=_[c])[0];x[0]=x[1],x[1]=h}return _}},{"incremental-convex-hull":270,uniq:368}],85:[function(t,e,r){(function(t){(function(){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)}).call(this,t("buffer").Buffer)},{buffer:49}],86:[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}}},{}],87:[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":93,"cubic-hermite":76}],93:[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)}},{}],94:[function(t,e,r){"use strict";e.exports=function(t){return new s(t||g,null)};function n(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 i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}var l=s.prototype;function u(t,e){var r;if(e.left&&(r=u(t,e.left)))return r;return(r=t(e.key,e.value))||(e.right?u(t,e.right):void 0)}function c(t,e,r,n){if(e(t,n.key)<=0){var i;if(n.left)if(i=c(t,e,r,n.left))return i;if(i=r(n.key,n.value))return i}if(n.right)return c(t,e,r,n.right)}function f(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=f(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return f(t,e,r,n,i.right)}function h(t,e){this.tree=t,this._stack=e}Object.defineProperty(l,"keys",{get:function(){var t=[];return this.forEach((function(e,r){t.push(e)})),t}}),Object.defineProperty(l,"values",{get:function(){var t=[];return this.forEach((function(e,r){t.push(r)})),t}}),Object.defineProperty(l,"length",{get:function(){return this.root?this.root._count:0}}),l.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(0,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){i=l[f];u[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(f=l.length-1;f>1;--f){var h=l[f-1];i=l[f];if(1===h._color||1===i._color)break;var d=l[f-2];if(d.left===h)if(h.left===i){if(!(p=d.right)||0!==p._color){if(d._color=0,d.left=h.right,h._color=1,h.right=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3)(g=l[f-3]).left===d?g.left=h:g.right=h;break}h._color=1,d.right=a(1,p),d._color=0,f-=1}else{if(!(p=d.right)||0!==p._color){if(h.right=i.left,d._color=0,d.left=i.right,i._color=1,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3)(g=l[f-3]).left===d?g.left=i:g.right=i;break}h._color=1,d.right=a(1,p),d._color=0,f-=1}else if(h.right===i){if(!(p=d.left)||0!==p._color){if(d._color=0,d.right=h.left,h._color=1,h.left=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3)(g=l[f-3]).right===d?g.right=h:g.left=h;break}h._color=1,d.left=a(1,p),d._color=0,f-=1}else{var p;if(!(p=d.left)||0!==p._color){var g;if(h.left=i.right,d._color=0,d.right=i.left,i._color=1,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3)(g=l[f-3]).right===d?g.right=i:g.left=i;break}h._color=1,d.left=a(1,p),d._color=0,f-=1}}return l[0]._color=1,new s(r,l[0])},l.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return u(t,this.root);case 2:return c(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return f(e,r,this._compare,t,this.root)}},Object.defineProperty(l,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(l,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),l.at=function(t){if(t<0)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new h(this,[])},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n);r=i<=0?r.left:r.right}return new h(this,[])},l.remove=function(t){var e=this.find(t);return e?e.remove():this},l.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 d=h.prototype;function p(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 g(t,e){return te?1:0}Object.defineProperty(d,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(d,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),d.clone=function(){return new h(this.tree,this._stack.slice())},d.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 n(r._color,r.key,r.value,r.left,r.right,r._count);for(var l=t.length-2;l>=0;--l){(r=t[l]).left===t[l+1]?e[l]=new n(r._color,r.key,r.value,e[l+1],r.right,r._count):e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count)}if((r=e[e.length-1]).left&&r.right){var u=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var c=e[u-1];e.push(new n(r._color,c.key,c.value,r.left,r.right,r._count)),e[u-1].key=r.key,e[u-1].value=r.value;for(l=e.length-2;l>=u;--l)r=e[l],e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count);e[u-1].left=e[u]}if(0===(r=e[e.length-1])._color){var f=e[e.length-2];f.left===r?f.left=null:f.right===r&&(f.right=null),e.pop();for(l=0;l=0;--l){if(e=t[l],0===l)return void(e._color=1);if((r=t[l-1]).left===e){if((n=r.right).right&&0===n.right._color){if(s=(n=r.right=i(n)).right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=1,r._color=1,s._color=1,o(r),o(n),l>1)(u=t[l-2]).left===r?u.left=n:u.right=n;return void(t[l-1]=n)}if(n.left&&0===n.left._color){if(s=(n=r.right=i(n)).left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(u=t[l-2]).left===r?u.left=s:u.right=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.right=a(0,n));r.right=a(0,n);continue}n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((u=t[l-2]).left===r?u.left=n:u.right=n),t[l-1]=n,t[l]=r,l+11)(u=t[l-2]).right===r?u.right=n:u.left=n;return void(t[l-1]=n)}if(n.right&&0===n.right._color){if(s=(n=r.left=i(n)).right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(u=t[l-2]).right===r?u.right=s:u.left=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.left=a(0,n));r.left=a(0,n);continue}var u;n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((u=t[l-2]).right===r?u.right=n:u.left=n),t[l-1]=n,t[l]=r,l+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(d,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(d,"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}),d.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(d,"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}}),d.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),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)(i=e[a]).left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},d.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(d,"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}})},{}],95:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=[.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 a(t){if(t<0)return Number("0/0");for(var e=i[0],r=i.length-1;r>0;--r)e+=i[r]/(t+r);var n=t+607/128+.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(a(e));e-=1;for(var r=n[0],i=1;i<9;i++)r+=n[i]/(e+i);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=a},{}],96:[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],M=n[15],A=(s?2:1)*this.pixelRatio*(i[3]*x+i[7]*_+i[11]*w+i[15]*M)/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 D=A/r[5*C];P[C]*=I[C]*D,z[C]*=I[C]*D}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 N,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||a>0&&l<0||a<0&&l>0||a<0&&l<0?j(n):(o>0&&s>0||o>0&&s<0||o<0&&s>0||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]+=A*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,N=1,"auto"===(E=[this.tickAlign[T],.5,N])[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]+=A*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]){N=0,F=[0,0,0],this.labels[T].length>4&&(j(T),N=1),"auto"===(E=[this.labelAlign[T],.5,N])[0]?E[0]=0:E[0]=parseInt(""+E[0]);for(C=0;C<3;++C)H[C]+=A*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":98,"./lib/cube.js":99,"./lib/lines.js":100,"./lib/text.js":102,"./lib/ticks.js":103}],98:[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":101,"gl-buffer":105,"gl-vao":164}],99:[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}}var w=-1;for(b=0;b<8;++b){for(var M=l[b][3],A=0;A<3;++A)u[b][A]=l[b][A]/M;d&&(u[b][2]*=-1),M<0&&(w<0||u[b][2]L&&(w|=1<L&&(w|=1<u[b][1])&&(D=b);var N=-1;for(b=0;b<3;++b){if((j=D^1<u[F][0]&&(F=j)}var B=g;B[0]=B[1]=B[2]=0,B[n.log2(N^D)]=D&N,B[n.log2(D^F)]=D&F;var U=7^F;U===w||U===I?(U=7^N,B[n.log2(F^U)]=U&F):B[n.log2(N^U)]=U&N;var V=v,H=w;for(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":147,glslify:245}],102:[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:280,"ndarray-ops":275,"typedarray-pool":345}],106:[function(t,e,r){"use strict";var n=t("gl-vec3");e.exports=function(t,e){var r=t.positions,i=t.vectors,a={positions:[],vertexIntensity:[],vertexIntensityBounds:t.vertexIntensityBounds,vectors:[],cells:[],coneOffset:t.coneOffset,colormap:t.colormap};if(0===t.positions.length)return e&&(e[0]=[0,0,0],e[1]=[0,0,0]),a;for(var o=0,s=1/0,l=-1/0,u=1/0,c=-1/0,f=1/0,h=-1/0,d=null,p=null,g=[],v=1/0,m=!1,y=0;yo&&(o=n.length(x)),y){var _=2*n.distance(d,b)/(n.length(p)+n.length(x));_?(v=Math.min(v,_),m=!1):m=!0}m||(d=b,p=x),g.push(x)}var w=[s,u,f],M=[l,c,h];e&&(e[0]=w,e[1]=M),0===o&&(o=1);var A=1/o;isFinite(v)||(v=1),a.vectorScale=v;var T=t.coneSize||.5;t.absoluteConeSize&&(T=t.absoluteConeSize*A),a.coneScale=T;y=0;for(var k=0;y=1},d.isTransparent=function(){return this.opacity<1},d.pickSlots=1,d.setPickBase=function(t){this.pickId=t},d.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),void 0!==t.tubeScale&&(this.tubeScale=t.tubeScale),void 0!==t.vectorScale&&(this.vectorScale=t.vectorScale),void 0!==t.coneScale&&(this.coneScale=t.coneScale),void 0!==t.coneOffset&&(this.coneOffset=t.coneOffset),t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(function(t){for(var e=c({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return u(r,[256,256,4],[4,0,1])}(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions,i=t.vectors;if(n&&r&&i){var a=[],o=[],s=[],l=[],f=[];this.cells=r,this.positions=n,this.vectors=i;var h=t.meshColor||[1,1,1,1],d=t.vertexIntensity,p=1/0,g=-1/0;if(d)if(t.vertexIntensityBounds)p=+t.vertexIntensityBounds[0],g=+t.vertexIntensityBounds[1];else for(var v=0;v0){var g=this.triShader;g.bind(),g.uniforms=u,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}},d.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||f,n=t.view||f,i=t.projection||f,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,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())},d.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),i={position:n,dataCoordinate:n,index:Math.floor(r[1]/48)};return"cone"===this.traceType?i.index=Math.floor(r[1]/48):"streamtube"===this.traceType&&(i.intensity=this.intensity[r[1]],i.velocity=this.vectors[r[1]].slice(0,3),i.divergence=this.vectors[r[1]][3],i.index=e),i},d.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.triangleIds.dispose()},e.exports=function(t,e,r){var n=r.shaders;1===arguments.length&&(t=(e=t).gl);var s=p(t,n),l=g(t,n),c=o(t,u(new Uint8Array([255,255,255,255]),[1,1,4]));c.generateMipmap(),c.minFilter=t.LINEAR_MIPMAP_LINEAR,c.magFilter=t.LINEAR;var f=i(t),d=i(t),v=i(t),m=i(t),y=i(t),b=a(t,[{buffer:f,type:t.FLOAT,size:4},{buffer:y,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:v,type:t.FLOAT,size:4},{buffer:m,type:t.FLOAT,size:2},{buffer:d,type:t.FLOAT,size:4}]),x=new h(t,c,s,l,f,d,y,v,m,b,r.traceType||"cone");return x.update(e),x}},{colormap:68,"gl-buffer":105,"gl-mat4/invert":123,"gl-mat4/multiply":125,"gl-shader":147,"gl-texture2d":160,"gl-vao":164,ndarray:280}],108:[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;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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 vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float vectorScale, coneScale, 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.xyz), 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:"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:245}],109:[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",34e3:"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"}},{}],110:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":109}],111:[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":112,"gl-buffer":105,"gl-vao":164}],112:[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":147,glslify:245}],113:[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){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);for(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\n// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl\nvec4 packFloat(float v) {\n 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 vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n float e = floor(log2(av));\n 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 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, packFloat(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":147,glslify:245}],116:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=f(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=h(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),l=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}]),c=u(new Array(1024),[256,1,4]),d=0;d<1024;++d)c.data[d]=255;var p=a(e,c);p.wrap=e.REPEAT;var g=new m(e,r,o,s,l,p);return g.update(t),g};var n=t("gl-buffer"),i=t("gl-vao"),a=t("gl-texture2d"),o=new Uint8Array(4),s=new Float32Array(o.buffer);var l=t("binary-search-bounds"),u=t("ndarray"),c=t("./lib/shaders"),f=c.createShader,h=c.createPickShader,d=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function p(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 g(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 v(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function m(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 y=m.prototype;y.isTransparent=function(){return this.hasAlpha},y.isOpaque=function(){return!this.hasAlpha},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){if(this.vertexCount){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||d,view:t.view||d,projection:t.projection||d,clipBounds:g(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()}},y.drawPick=function(t){if(this.vertexCount){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||d,view:t.view||d,projection:t.projection||d,pickId:this.pickId,clipBounds:g(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()}},y.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=[],s=0,c=0,f=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],h=t.position||t.positions;if(h){var d=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(d[0])?(m=d.length>e-1?d[e-1]:d.length>0?d[d.length-1]:[0,0,0,1],y=d.length>e?d[e]:d.length>0?d[d.length-1]:[0,0,0,1]):m=y=d,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 M=s;if(s+=p(x,_),v){for(r=0;r<2;++r)i.push(x[0],x[1],x[2],_[0],_[1],_[2],M,b,m[0],m[1],m[2],m[3]);c+=2,v=!1}i.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],s,-b,y[0],y[1],y[2],y[3],_[0],_[1],_[2],x[0],x[1],x[2],s,b,y[0],y[1],y[2],y[3]),c+=4}}if(this.buffer.update(i),a.push(s),o.push(h[h.length-1].slice()),this.bounds=f,this.vertexCount=c,this.points=o,this.arcLength=a,"dashes"in t){var A=t.dashes.slice();for(A.unshift(0),e=1;e1.0001)return null;m+=v[f]}if(Math.abs(m-1)>.001)return null;return[h,s(t,v),v]}},{barycentric:18,"polytope-closest-point/lib/closest_point_2d.js":303}],136:[function(t,e,r){var n=t("glslify"),i=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\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;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\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 f_color = color;\n f_data = position;\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\n//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d\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;\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 (f_color.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], f_data)\n ) 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 = vec4(f_color.rgb, 1.0) * 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 * f_color.a;\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 ,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, 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.0);\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:245}],137:[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.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=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.pickVertex=!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.hasAlpha=!1,this.opacityscale=!1,this._model=w,this._view=w,this._projection=w,this._resolution=[1,1]}var A=M.prototype;function T(t,e){if(!e)return 1;if(!e.length)return 1;for(var r=0;rt&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}function k(t){var e=n(t,v.vertex,v.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function E(t){var e=n(t,m.vertex,m.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function L(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 S(t){var e=n(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}function C(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 O(t){var e=n(t,_.vertex,_.fragment);return e.attributes.position.location=0,e}A.isOpaque=function(){return!this.hasAlpha},A.isTransparent=function(){return this.hasAlpha},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*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())},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*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())},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;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":11,"has-passive-events":247,"mouse-change":268,"mouse-event-offset":269,"mouse-wheel":271,"right-now":312}],139:[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":147,glslify:245}],140:[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("gl-mat4/perspective"),h=t("gl-mat4/ortho"),d=t("./lib/shader"),p=t("is-mobile")({tablet:!0,featureDetect:!0});function g(){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 v(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 m(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)t.container.appendChild(e);else document.body.appendChild(e)}var r=t.gl;r||(t.glOptions&&(p=!!t.glOptions.preserveDrawingBuffer),r=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:p}));if(!r)throw new Error("webgl not supported");var y=t.bounds||[[-10,-10,-10],[10,10,10]],b=new g,x=l(r,r.drawingBufferWidth,r.drawingBufferHeight,{preferFloat:!p}),_=d(r),w=t.cameraObject&&!0===t.cameraObject._ortho||t.camera.projection&&"orthographic"===t.camera.projection.type||!1,M={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:w},A=t.axes||{},T=i(r,A);T.enable=!A.disable;var k=t.spikes||{},E=o(r,k),L=[],S=[],C=[],O=[],R=!0,P=!0,z=new Array(16),I=new Array(16),D={view:null,projection:z,model:I,_ortho:!1},N=(P=!0,[r.drawingBufferWidth,r.drawingBufferHeight]),F=t.cameraObject||n(e,M),j={gl:r,contextLost:!1,pixelRatio:t.pixelRatio||1,canvas:e,selection:b,camera:F,axes:T,axesPixels:null,spikes:E,bounds:y,objects:L,shape:N,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:m(t.autoResize),autoBounds:m(t.autoBounds),autoScale:!!t.autoScale,autoCenter:m(t.autoCenter),clipToBounds:m(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:D,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(t){this.aspect[0]=t.x,this.aspect[1]=t.y,this.aspect[2]=t.z,P=!0},setBounds:function(t,e){this.bounds[0][t]=e.min,this.bounds[1][t]=e.max},setClearColor:function(t){this.clearColor=t},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},B=[r.drawingBufferWidth/j.pixelRatio|0,r.drawingBufferHeight/j.pixelRatio|0];function U(){if(!j._stopped&&j.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*j.pixelRatio),a=0|Math.ceil(n*j.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",R=!0}}}j.autoResize&&U();function V(){for(var t=L.length,e=O.length,n=0;n0&&0===C[e-1];)C.pop(),O.pop().dispose()}function H(){if(j.contextLost)return!0;r.isContextLost()&&(j.contextLost=!0,j.mouseListener.enabled=!1,j.selection.object=null,j.oncontextloss&&j.oncontextloss())}window.addEventListener("resize",U),j.update=function(t){j._stopped||(t=t||{},R=!0,P=!0)},j.add=function(t){j._stopped||(t.axes=T,L.push(t),S.push(-1),R=!0,P=!0,V())},j.remove=function(t){if(!j._stopped){var e=L.indexOf(t);e<0||(L.splice(e,1),S.pop(),R=!0,P=!0,V())}},j.dispose=function(){if(!j._stopped&&(j._stopped=!0,window.removeEventListener("resize",U),e.removeEventListener("webglcontextlost",H),j.mouseListener.enabled=!1,!j.contextLost)){T.dispose(),E.dispose();for(var t=0;tb.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}},{}],142:[function(t,e,r){"use strict";e.exports=function(t){return t||0===t?t.toString():""}},{}],143:[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 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":147,glslify:245}],145:[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||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],M=f.slice(),A=[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=M,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 D=z;z=I,I=D,D=R,R=P,P=D;var N=C;C=O,O=N}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(A,g[0],v,-1e8),l.fragClipBounds[1]=L(A,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],D=[0,0,0,1],N=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],M=0;M<3;++M){if(isNaN(w[M])||!isFinite(w[M]))continue t;f[M]=Math.max(f[M],w[M]),c[M]=Math.min(c[M],w[M])}A=(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=N?n0?1-k[0][0]:X<0?1+k[1][0]:1,Y*=Y>0?1-k[0][1]:Y<0?1+k[1][1]:1],Z=A.cells||[],Q=A.positions||[];for(M=0;Mthis.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 L(){h.program=o.program(d,h._vref,h._fref,x,_);for(var t=0;t=0){if((p=h.charCodeAt(h.length-1)-48)<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;if((p=h.charCodeAt(h.length-1)-48)<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)}if((a=r.charCodeAt(r.length-1)-48)<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;if((r=t.charCodeAt(t.length-1)-48)<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){s[0]in a||(a[s[0]]=[]),a=a[s[0]];for(var l=1;l1)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;\n\nuniform float vectorScale, tubeScale;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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:"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:245}],157:[function(t,e,r){"use strict";var n=t("gl-vec3"),i=t("gl-vec4"),a=["xyz","xzy","yxz","yzx","zxy","zyx"],o=function(t,e,r,a){for(var o=0,s=0;s0)for(M=0;M<8;M++){var A=(M+1)%8;u.push(h[M],d[M],d[A],d[A],h[A],h[M]),f.push(y,m,m,m,y,y),p.push(g,v,v,v,g,g);var T=u.length;c.push([T-6,T-5,T-4],[T-3,T-2,T-1])}var k=h;h=d,d=k;var E=y;y=m,m=E;var L=g;g=v,v=L}return{positions:u,cells:c,vectors:f,vertexIntensity:p}}(t,r,a,o)})),f=[],h=[],d=[],p=[];for(s=0;se)return r-1}return r},l=function(t,e,r){return tr?r:t},u=function(t){var e=1/0;t.sort((function(t,e){return t-e}));for(var r=t.length,n=1;nf-1||y>h-1||b>d-1)return n.create();var x,_,w,M,A,T,k=a[0][p],E=a[0][m],L=a[1][g],S=a[1][y],C=a[2][v],O=(o-k)/(E-k),R=(u-L)/(S-L),P=(c-C)/(a[2][b]-C);switch(isFinite(O)||(O=.5),isFinite(R)||(R=.5),isFinite(P)||(P=.5),r.reversedX&&(p=f-1-p,m=f-1-m),r.reversedY&&(g=h-1-g,y=h-1-y),r.reversedZ&&(v=d-1-v,b=d-1-b),r.filled){case 5:A=v,T=b,w=g*d,M=y*d,x=p*d*h,_=m*d*h;break;case 4:A=v,T=b,x=p*d,_=m*d,w=g*d*f,M=y*d*f;break;case 3:w=g,M=y,A=v*h,T=b*h,x=p*h*d,_=m*h*d;break;case 2:w=g,M=y,x=p*h,_=m*h,A=v*h*f,T=b*h*f;break;case 1:x=p,_=m,A=v*f,T=b*f,w=g*f*d,M=y*f*d;break;default:x=p,_=m,w=g*f,M=y*f,A=v*f*h,T=b*f*h}var z=i[x+w+A],I=i[x+w+T],D=i[x+M+A],N=i[x+M+T],F=i[_+w+A],j=i[_+w+T],B=i[_+M+A],U=i[_+M+T],V=n.create(),H=n.create(),q=n.create(),G=n.create();n.lerp(V,z,F,O),n.lerp(H,I,j,O),n.lerp(q,D,B,O),n.lerp(G,N,U,O);var X=n.create(),Y=n.create();n.lerp(X,V,q,R),n.lerp(Y,H,G,R);var W=n.create();return n.lerp(W,X,Y,P),W}(e,t,d)},g=t.getDivergence||function(t,e){var r=n.create(),i=1e-4;n.add(r,t,[i,0,0]);var a=p(r);n.subtract(a,a,e),n.scale(a,a,1/i),n.add(r,t,[0,i,0]);var o=p(r);n.subtract(o,o,e),n.scale(o,o,1/i),n.add(r,t,[0,0,i]);var s=p(r);return n.subtract(s,s,e),n.scale(s,s,1/i),n.add(r,a,o),n.add(r,r,s),r},v=[],m=e[0][0],y=e[0][1],b=e[0][2],x=e[1][0],_=e[1][1],w=e[1][2],M=function(t){var e=t[0],r=t[1],n=t[2];return!(ex||r_||nw)},A=10*n.distance(e[0],e[1])/i,T=A*A,k=1,E=0,L=r.length;L>1&&(k=function(t){for(var e=[],r=[],n=[],i={},a={},o={},s=t.length,l=0;lE&&(E=N),I.push(N),v.push({points:O,velocities:R,divergences:I});for(var F=0;F<100*i&&O.lengthT&&n.scale(j,j,A/Math.sqrt(B)),n.add(j,j,C),P=p(j),n.squaredDistance(z,j)-T>-1e-4*T){O.push(j),z=j,R.push(P);D=g(j,P),N=n.length(D);isFinite(N)&&N>E&&(E=N),I.push(N)}C=j}}var U=o(v,t.colormap,E,k);return f?U.tubeScale=f:(0===E&&(E=1),U.tubeScale=.5*c*k/E),U};var c=t("./lib/shaders"),f=t("gl-cone3d").createMesh;e.exports.createTubeMesh=function(t,e){return f(t,e,{shaders:c,traceType:"streamtube"})}},{"./lib/shaders":156,"gl-cone3d":106,"gl-vec3":183,"gl-vec4":219}],158:[function(t,e,r){var n=t("gl-shader"),i=t("glslify"),a=i(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform vec3 objectOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\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 localCoordinate = vec3(uv.zw, f.x);\n worldCoordinate = objectOffset + localCoordinate;\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n"]),o=i(["precision 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 beckmannSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\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 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 (\n kill > 0.0 ||\n vColor.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)\n ) 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":147,glslify:245}],159:[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:40,offset:0},{buffer:u,size:3,stride:40,offset:16},{buffer:u,size:3,stride:40,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,256,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var v=new k(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 w in t)m[w]=t[w];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=[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]],A=[[0,0,0,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 T(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=A[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();function k(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 T([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.opacityscale=!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 E=k.prototype;E.isTransparent=function(){return this.opacity<1||this.opacityscale},E.isOpaque=function(){if(this.opacityscale)return!1;if(this.opacity<1)return!1;if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0)return!0;return!1},E.pickSlots=1,E.setPickBase=function(t){this.pickId=t};var L=[0,0,0],S={showSurface:!1,showContour:!1,projections:[w.slice(),w.slice(),w.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function C(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||L,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=S.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=S.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 S.showSurface=o,S.showContour=s,S}var O={model:w,view:w,projection:w,inverseModel:w.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},R=w.slice(),P=[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=O;n.model=t.model||w,n.view=t.view||w,n.projection=t.projection||w,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=P,n.vertexColor=this.vertexColor;var s=R;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=C(n,this);if(c.showSurface){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){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=A[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},E.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))},E.update=function(t){t=t||{},this.objectOffset=t.objectOffset||this.objectOffset,this.dirty=!0,"contourWidth"in t&&(this.contourWidth=D(t.contourWidth,Number)),"showContour"in t&&(this.showContour=D(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=D(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=F(t.contourColor)),"contourProject"in t&&(this.contourProject=D(t.contourProject,(function(t){return D(t,Boolean)}))),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=F(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=D(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=D(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"opacityscale"in t&&(this.opacityscale=t.opacityscale),"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 wt=0;wt<5;++wt)et.pop();q-=1}continue t}et.push(ot[0],ot[1],ut[0],ut[1],ot[2]),q+=1}}at.push(q)}this._contourOffsets[rt]=it,this._contourCounts[rt]=at}var Mt=s.mallocFloat(et.length);for(o=0;ot&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}(r/255,e):1;return[t[0],t[1],t[2],255*n]}))]);return u.divseq(r,255),r}(t.colormap,this.opacityscale))},E.dispose=function(){this._shader.dispose(),this._vao.dispose(),this._coordinateBuffer.dispose(),this._colorMap.dispose(),this._contourBuffer.dispose(),this._contourVAO.dispose(),this._contourShader.dispose(),this._contourPickShader.dispose(),this._dynamicBuffer.dispose(),this._dynamicVAO.dispose();for(var t=0;t<3;++t)s.freeFloat(this._field[t].data)},E.highlight=function(t){var e,r;if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(e=0;e<3;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;for(r=this.snapToData?t.dataCoordinate:t.position,e=0;e<3;++e)r[e]-=this.objectOffset[e];if(this.enableDynamic[0]&&r[0]!==this.dynamicLevel[0]||this.enableDynamic[1]&&r[1]!==this.dynamicLevel[1]||this.enableDynamic[2]&&r[2]!==this.dynamicLevel[2]){for(var n=0,i=this.shape,a=s.mallocFloat(12*i[0]*i[1]),o=0;o<3;++o)if(this.enableDynamic[o]){this.dynamicLevel[o]=r[o];var l=(o+1)%3,u=(o+2)%3,c=this._field[o],f=this._field[l],d=this._field[u],p=h(c,r[o]),g=p.cells,v=p.positions;for(this._dynamicOffsets[o]=n,e=0;ei||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 d(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 p=d.prototype;function g(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 v(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 m(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=v(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new d(t,o,e,r,n,i)}function y(t,e,r,n,i,a){var o=v(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new d(t,o,r,n,i,a)}function b(t,e){var r=e.dtype,o=e.shape.slice(),s=t.getParameter(t.MAX_TEXTURE_SIZE);if(o[0]<0||o[0]>s||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=g(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 c,h,p=0;if(2===o.length)p=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])p=t.ALPHA;else if(2===o[2])p=t.LUMINANCE_ALPHA;else if(3===o[2])p=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");p=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,l=!1);var m=e.size;if(l)c=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];h=a.malloc(m,r);var b=n(h,o,y,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?i.assign(b,e):f(b,e),c=h.subarray(0,m)}var x=v(t);return t.texImage2D(t.TEXTURE_2D,0,p,o[0],o[1],0,p,u,c),l||a.free(h),new d(t,x,o[0],o[1],p,u)}Object.defineProperties(p,{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 h(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return h(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,h(this,this._shape[0],t),t}}}),p.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},p.dispose=function(){this.gl.deleteTexture(this.handle)},p.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)},p.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=c(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,c){var h=c.dtype,d=c.shape.slice();if(d.length<2||d.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var p=0,v=0,m=g(d,c.stride.slice());"float32"===h?p=t.FLOAT:"float64"===h?(p=t.FLOAT,m=!1,h="float32"):"uint8"===h?p=t.UNSIGNED_BYTE:(p=t.UNSIGNED_BYTE,m=!1,h="uint8");if(2===d.length)v=t.LUMINANCE,d=[d[0],d[1],1],c=n(c.data,d,[c.stride[0],c.stride[1],1],c.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=c.size,b=u.indexOf(o)<0;b&&u.push(o);if(p===l&&m)0===c.offset&&c.data.length===y?b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,c.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,c.data):b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,c.data.subarray(c.offset,c.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,c.data.subarray(c.offset,c.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]);p===t.FLOAT&&l===t.UNSIGNED_BYTE?f(_,c):i.assign(_,c),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:280,"ndarray-ops":275,"typedarray-pool":345}],161:[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":176,"./fromValues":182,"./normalize":193}],167:[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}},{}],168:[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}},{}],169:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}},{}],170:[function(t,e,r){e.exports=function(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}},{}],171:[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}},{}],172:[function(t,e,r){e.exports=t("./distance")},{"./distance":173}],173:[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)}},{}],174:[function(t,e,r){e.exports=t("./divide")},{"./divide":175}],175:[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}},{}],176:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],177:[function(t,e,r){e.exports=1e-6},{}],178:[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":177}],179:[function(t,e,r){e.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}},{}],180:[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}},{}],181:[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}},{}],194:[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}},{}],195:[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}},{}],196:[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}},{}],197:[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}},{}],198:[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}},{}],199:[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}},{}],200:[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}},{}],201:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}},{}],202:[function(t,e,r){e.exports=t("./squaredDistance")},{"./squaredDistance":204}],203:[function(t,e,r){e.exports=t("./squaredLength")},{"./squaredLength":205}],204:[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}},{}],205:[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}},{}],206:[function(t,e,r){e.exports=t("./subtract")},{"./subtract":207}],207:[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}},{}],208:[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}},{}],209:[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}},{}],210:[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}},{}],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[3]=e[3]+r[3],t}},{}],212:[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}},{}],213:[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}},{}],214:[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}},{}],215:[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)}},{}],216:[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}},{}],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]}},{}],218:[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}},{}],219:[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":211,"./clone":212,"./copy":213,"./create":214,"./distance":215,"./divide":216,"./dot":217,"./fromValues":218,"./inverse":220,"./length":221,"./lerp":222,"./max":223,"./min":224,"./multiply":225,"./negate":226,"./normalize":227,"./random":228,"./scale":229,"./scaleAndAdd":230,"./set":231,"./squaredDistance":232,"./squaredLength":233,"./subtract":234,"./transformMat4":235,"./transformQuat":236}],220:[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}},{}],221:[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)}},{}],222:[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}},{}],223:[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}},{}],224:[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}},{}],225:[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}},{}],226:[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}},{}],227:[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}},{}],228:[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":227,"./scale":229}],229:[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}},{}],230:[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}},{}],231:[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}},{}],232:[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}},{}],233:[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}},{}],234:[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}},{}],235:[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}},{}],236:[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}},{}],237:[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 T(r),m+=r.length,(d=d.slice(r.length)).length}}function R(){return/[^a-fA-F0-9]/.test(e)?(T(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function P(){return"."===e||/[eE]/.test(e)?(d.push(e),h=5,r=e,c+1):"x"===e&&1===d.length&&"0"===d[0]?(h=11,d.push(e),r=e,c+1):/[^\d]/.test(e)?(T(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function z(){return"f"===e&&(d.push(e),r=e,c+=1),/[eE]/.test(e)?(d.push(e),r=e,c+1):("-"!==e&&"+"!==e||!/[eE]/.test(r))&&/[^\d]/.test(e)?(T(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function I(){if(/[^\d\w_]/.test(e)){var t=d.join("");return h=A[t]?8:M[t]?7:6,T(d.join("")),h=999,c}return d.push(e),r=e,c+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=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":240,"./lib/builtins-300es":239,"./lib/literals":242,"./lib/literals-300es":241,"./lib/operators":243}],239:[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":240}],240:[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"]},{}],241:[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","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":242}],242:[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","uint","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"]},{}],243:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],244:[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":238}],245:[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}},{}],249:[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);var f=new a(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2);for(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(c=0;c<=i;++c){p=h[c].vertices;var y=h[c].adjacent;for(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])}}var _=new u(i,o,d),w=!!e;for(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),L=0,S=0;S<=n;++S){var C=w[S];C<0||S===x||(E[L++]=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":318,"simplicial-complex":328}],250:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function i(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 m(null);return new m(v(t))};var a=i.prototype;function o(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 s(t,e){var r=v(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 l(t,e){var r=t.intervals([]);r.push(e),s(t,r)}function u(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?0:(r.splice(n,1),s(t,r),1)}function c(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function h(t,e){for(var r=0;r>1],a=[],o=[],s=[];for(r=0;r3*(e+1)?l(this,t):this.left.insert(t):this.left=v([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?l(this,t):this.right.insert(t):this.right=v([t]);else{var r=n.ge(this.leftPoints,t,p),i=n.ge(this.rightPoints,t,g);this.leftPoints.splice(r,0,t),this.rightPoints.splice(i,0,t)}},a.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?u(this,t):2===(s=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?u(this,t):2===(s=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,i=this.left;i.right;)r=i,i=i.right;if(r===this)i.right=this.right;else{var a=this.left,s=this.right;r.count-=i.count,r.right=i.left,i.left=a,i.right=s}o(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?o(this,this.left):o(this,this.right);return 1}for(a=n.ge(this.leftPoints,t,p);athis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return f(this.rightPoints,t,e)}return h(this.leftPoints,e)},a.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?f(this.rightPoints,t,r):h(this.leftPoints,r)};var y=m.prototype;y.insert=function(t){this.root?this.root.insert(t):this.root=new i(t[0],null,null,[t],[t])},y.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},y.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},y.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(y,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(y,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":251}],251:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{dup:93}],252:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r=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":93,"cubic-hermite":76}],93:[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)}},{}],94:[function(t,e,r){"use strict";e.exports=function(t){return new s(t||g,null)};function n(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 i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}var l=s.prototype;function u(t,e){var r;if(e.left&&(r=u(t,e.left)))return r;return(r=t(e.key,e.value))||(e.right?u(t,e.right):void 0)}function c(t,e,r,n){if(e(t,n.key)<=0){var i;if(n.left)if(i=c(t,e,r,n.left))return i;if(i=r(n.key,n.value))return i}if(n.right)return c(t,e,r,n.right)}function f(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=f(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return f(t,e,r,n,i.right)}function h(t,e){this.tree=t,this._stack=e}Object.defineProperty(l,"keys",{get:function(){var t=[];return this.forEach((function(e,r){t.push(e)})),t}}),Object.defineProperty(l,"values",{get:function(){var t=[];return this.forEach((function(e,r){t.push(r)})),t}}),Object.defineProperty(l,"length",{get:function(){return this.root?this.root._count:0}}),l.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],u=[];i;){var c=r(t,i.key);l.push(i),u.push(c),i=c<=0?i.left:i.right}l.push(new n(0,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){i=l[f];u[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(f=l.length-1;f>1;--f){var h=l[f-1];i=l[f];if(1===h._color||1===i._color)break;var d=l[f-2];if(d.left===h)if(h.left===i){if(!(p=d.right)||0!==p._color){if(d._color=0,d.left=h.right,h._color=1,h.right=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3)(g=l[f-3]).left===d?g.left=h:g.right=h;break}h._color=1,d.right=a(1,p),d._color=0,f-=1}else{if(!(p=d.right)||0!==p._color){if(h.right=i.left,d._color=0,d.left=i.right,i._color=1,i.left=h,i.right=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3)(g=l[f-3]).left===d?g.left=i:g.right=i;break}h._color=1,d.right=a(1,p),d._color=0,f-=1}else if(h.right===i){if(!(p=d.left)||0!==p._color){if(d._color=0,d.right=h.left,h._color=1,h.left=d,l[f-2]=h,l[f-1]=i,o(d),o(h),f>=3)(g=l[f-3]).right===d?g.right=h:g.left=h;break}h._color=1,d.left=a(1,p),d._color=0,f-=1}else{var p;if(!(p=d.left)||0!==p._color){var g;if(h.left=i.right,d._color=0,d.right=i.left,i._color=1,i.right=h,i.left=d,l[f-2]=i,l[f-1]=h,o(d),o(h),o(i),f>=3)(g=l[f-3]).right===d?g.right=i:g.left=i;break}h._color=1,d.left=a(1,p),d._color=0,f-=1}}return l[0]._color=1,new s(r,l[0])},l.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return u(t,this.root);case 2:return c(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return f(e,r,this._compare,t,this.root)}},Object.defineProperty(l,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(l,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),l.at=function(t){if(t<0)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new h(this,[])},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n);r=i<=0?r.left:r.right}return new h(this,[])},l.remove=function(t){var e=this.find(t);return e?e.remove():this},l.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 d=h.prototype;function p(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 g(t,e){return te?1:0}Object.defineProperty(d,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(d,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),d.clone=function(){return new h(this.tree,this._stack.slice())},d.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 n(r._color,r.key,r.value,r.left,r.right,r._count);for(var l=t.length-2;l>=0;--l){(r=t[l]).left===t[l+1]?e[l]=new n(r._color,r.key,r.value,e[l+1],r.right,r._count):e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count)}if((r=e[e.length-1]).left&&r.right){var u=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var c=e[u-1];e.push(new n(r._color,c.key,c.value,r.left,r.right,r._count)),e[u-1].key=r.key,e[u-1].value=r.value;for(l=e.length-2;l>=u;--l)r=e[l],e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count);e[u-1].left=e[u]}if(0===(r=e[e.length-1])._color){var f=e[e.length-2];f.left===r?f.left=null:f.right===r&&(f.right=null),e.pop();for(l=0;l=0;--l){if(e=t[l],0===l)return void(e._color=1);if((r=t[l-1]).left===e){if((n=r.right).right&&0===n.right._color){if(s=(n=r.right=i(n)).right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=1,r._color=1,s._color=1,o(r),o(n),l>1)(u=t[l-2]).left===r?u.left=n:u.right=n;return void(t[l-1]=n)}if(n.left&&0===n.left._color){if(s=(n=r.right=i(n)).left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(u=t[l-2]).left===r?u.left=s:u.right=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.right=a(0,n));r.right=a(0,n);continue}n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((u=t[l-2]).left===r?u.left=n:u.right=n),t[l-1]=n,t[l]=r,l+11)(u=t[l-2]).right===r?u.right=n:u.left=n;return void(t[l-1]=n)}if(n.right&&0===n.right._color){if(s=(n=r.left=i(n)).right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(u=t[l-2]).right===r?u.right=s:u.left=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.left=a(0,n));r.left=a(0,n);continue}var u;n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((u=t[l-2]).right===r?u.right=n:u.left=n),t[l-1]=n,t[l]=r,l+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(d,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(d,"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}),d.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(d,"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}}),d.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),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)(i=e[a]).left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},d.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(d,"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}})},{}],95:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=[.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 a(t){if(t<0)return Number("0/0");for(var e=i[0],r=i.length-1;r>0;--r)e+=i[r]/(t+r);var n=t+607/128+.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(a(e));e-=1;for(var r=n[0],i=1;i<9;i++)r+=n[i]/(e+i);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=a},{}],96:[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],M=n[15],T=(s?2:1)*this.pixelRatio*(i[3]*x+i[7]*_+i[11]*w+i[15]*M)/e.drawingBufferHeight,A=0;A<3;++A)this.lastCubeProps.cubeEdges[A]=f[A],this.lastCubeProps.axis[A]=h[A];var k=d;for(A=0;A<3;++A)p(d[A],A,this.bounds,f,h);e=this.gl;var E,L=g;for(A=0;A<3;++A)this.backgroundEnable[A]?L[A]=h[A]:L[A]=0;this._background.draw(r,n,i,a,L,this.backgroundColor),this._lines.bind(r,n,i,this);for(A=0;A<3;++A){var S=[0,0,0];h[A]>0?S[A]=a[1][A]:S[A]=a[0][A];for(var C=0;C<2;++C){var O=(A+1+C)%3,R=(A+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=(A+1+C)%3,R=(A+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(A=0;A<3;++A){this.lineEnable[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].primalOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio),this.lineMirror[A]&&this._lines.drawAxisLine(A,this.bounds,k[A].mirrorOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio);var P=u(m,k[A].primalMinor),z=u(y,k[A].mirrorMinor),I=this.lineTickLength;for(C=0;C<3;++C){var D=T/r[5*C];P[C]*=I[C]*D,z[C]*=I[C]*D}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,k[A].primalOffset,P,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,k[A].mirrorOffset,z,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio)}this._lines.unbind(),this._text.bind(r,n,i,this.pixelRatio);var N,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||a>0&&l<0||a<0&&l>0||a<0&&l<0?j(n):(o>0&&s>0||o>0&&s<0||o<0&&s>0||o<0&&s<0)&&j(i)}for(A=0;A<3;++A){var U=k[A].primalMinor,V=k[A].mirrorMinor,H=u(b,k[A].primalOffset);for(C=0;C<3;++C)this.lineTickEnable[A]&&(H[C]+=T*U[C]*Math.max(this.lineTickLength[C],0)/r[5*C]);var q=[0,0,0];if(q[A]=1,this.tickEnable[A]){-3600===this.tickAngle[A]?(this.tickAngle[A]=0,this.tickAlign[A]="auto"):this.tickAlign[A]=-1,N=1,"auto"===(E=[this.tickAlign[A],.5,N])[0]?E[0]=0:E[0]=parseInt(""+E[0]),F=[0,0,0],B(A,U,V);for(C=0;C<3;++C)H[C]+=T*U[C]*this.tickPad[C]/r[5*C];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],H,this.tickColor[A],q,F,E)}if(this.labelEnable[A]){N=0,F=[0,0,0],this.labels[A].length>4&&(j(A),N=1),"auto"===(E=[this.labelAlign[A],.5,N])[0]?E[0]=0:E[0]=parseInt(""+E[0]);for(C=0;C<3;++C)H[C]+=T*U[C]*this.labelPad[C]/r[5*C];H[A]+=.5*(a[0][A]+a[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],H,this.labelColor[A],[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":98,"./lib/cube.js":99,"./lib/lines.js":100,"./lib/text.js":102,"./lib/ticks.js":103}],98:[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":101,"gl-buffer":106,"gl-vao":186}],99:[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}}var w=-1;for(b=0;b<8;++b){for(var M=l[b][3],T=0;T<3;++T)u[b][T]=l[b][T]/M;d&&(u[b][2]*=-1),M<0&&(w<0||u[b][2]L&&(w|=1<L&&(w|=1<u[b][1])&&(D=b);var N=-1;for(b=0;b<3;++b){if((j=D^1<u[F][0]&&(F=j)}var B=g;B[0]=B[1]=B[2]=0,B[n.log2(N^D)]=D&N,B[n.log2(D^F)]=D&F;var U=7^F;U===w||U===I?(U=7^N,B[n.log2(F^U)]=U&F):B[n.log2(N^U)]=U&N;var V=v,H=w;for(A=0;A<3;++A)V[A]=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":166,glslify:104}],102:[function(t,e,r){(function(r){(function(){"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:301,"ndarray-ops":296,"typedarray-pool":366}],107:[function(t,e,r){"use strict";var n=t("gl-vec3");e.exports=function(t,e){var r=t.positions,i=t.vectors,a={positions:[],vertexIntensity:[],vertexIntensityBounds:t.vertexIntensityBounds,vectors:[],cells:[],coneOffset:t.coneOffset,colormap:t.colormap};if(0===t.positions.length)return e&&(e[0]=[0,0,0],e[1]=[0,0,0]),a;for(var o=0,s=1/0,l=-1/0,u=1/0,c=-1/0,f=1/0,h=-1/0,d=null,p=null,g=[],v=1/0,m=!1,y=0;yo&&(o=n.length(x)),y){var _=2*n.distance(d,b)/(n.length(p)+n.length(x));_?(v=Math.min(v,_),m=!1):m=!0}m||(d=b,p=x),g.push(x)}var w=[s,u,f],M=[l,c,h];e&&(e[0]=w,e[1]=M),0===o&&(o=1);var T=1/o;isFinite(v)||(v=1),a.vectorScale=v;var A=t.coneSize||.5;t.absoluteConeSize&&(A=t.absoluteConeSize*T),a.coneScale=A;y=0;for(var k=0;y=1},d.isTransparent=function(){return this.opacity<1},d.pickSlots=1,d.setPickBase=function(t){this.pickId=t},d.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),void 0!==t.tubeScale&&(this.tubeScale=t.tubeScale),void 0!==t.vectorScale&&(this.vectorScale=t.vectorScale),void 0!==t.coneScale&&(this.coneScale=t.coneScale),void 0!==t.coneOffset&&(this.coneOffset=t.coneOffset),t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(function(t){for(var e=c({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return u(r,[256,256,4],[4,0,1])}(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions,i=t.vectors;if(n&&r&&i){var a=[],o=[],s=[],l=[],f=[];this.cells=r,this.positions=n,this.vectors=i;var h=t.meshColor||[1,1,1,1],d=t.vertexIntensity,p=1/0,g=-1/0;if(d)if(t.vertexIntensityBounds)p=+t.vertexIntensityBounds[0],g=+t.vertexIntensityBounds[1];else for(var v=0;v0){var g=this.triShader;g.bind(),g.uniforms=u,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}},d.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||f,n=t.view||f,i=t.projection||f,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,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())},d.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),i={position:n,dataCoordinate:n,index:Math.floor(r[1]/48)};return"cone"===this.traceType?i.index=Math.floor(r[1]/48):"streamtube"===this.traceType&&(i.intensity=this.intensity[r[1]],i.velocity=this.vectors[r[1]].slice(0,3),i.divergence=this.vectors[r[1]][3],i.index=e),i},d.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.triangleIds.dispose()},e.exports=function(t,e,r){var n=r.shaders;1===arguments.length&&(t=(e=t).gl);var s=p(t,n),l=g(t,n),c=o(t,u(new Uint8Array([255,255,255,255]),[1,1,4]));c.generateMipmap(),c.minFilter=t.LINEAR_MIPMAP_LINEAR,c.magFilter=t.LINEAR;var f=i(t),d=i(t),v=i(t),m=i(t),y=i(t),b=a(t,[{buffer:f,type:t.FLOAT,size:4},{buffer:y,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:v,type:t.FLOAT,size:4},{buffer:m,type:t.FLOAT,size:2},{buffer:d,type:t.FLOAT,size:4}]),x=new h(t,c,s,l,f,d,y,v,m,b,r.traceType||"cone");return x.update(e),x}},{colormap:68,"gl-buffer":106,"gl-mat4/invert":137,"gl-mat4/multiply":139,"gl-shader":166,"gl-texture2d":182,"gl-vao":186,ndarray:301}],109:[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;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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 vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float vectorScale, coneScale, 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.xyz), 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:"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:110}],110:[function(t,e,r){arguments[4][104][0].apply(r,arguments)},{dup:104}],111:[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",34e3:"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"}},{}],112:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":111}],113:[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":115,"gl-buffer":106,"gl-vao":186}],114:[function(t,e,r){arguments[4][104][0].apply(r,arguments)},{dup:104}],115:[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":166,glslify:114}],116:[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){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);for(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\n// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl\nvec4 packFloat(float v) {\n 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 vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n float e = floor(log2(av));\n 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 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, packFloat(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":166,glslify:120}],119:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=f(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=h(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),l=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}]),c=u(new Array(1024),[256,1,4]),d=0;d<1024;++d)c.data[d]=255;var p=a(e,c);p.wrap=e.REPEAT;var g=new m(e,r,o,s,l,p);return g.update(t),g};var n=t("gl-buffer"),i=t("gl-vao"),a=t("gl-texture2d"),o=new Uint8Array(4),s=new Float32Array(o.buffer);var l=t("binary-search-bounds"),u=t("ndarray"),c=t("./lib/shaders"),f=c.createShader,h=c.createPickShader,d=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function p(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 g(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 v(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function m(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 y=m.prototype;y.isTransparent=function(){return this.hasAlpha},y.isOpaque=function(){return!this.hasAlpha},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){if(this.vertexCount){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||d,view:t.view||d,projection:t.projection||d,clipBounds:g(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()}},y.drawPick=function(t){if(this.vertexCount){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||d,view:t.view||d,projection:t.projection||d,pickId:this.pickId,clipBounds:g(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()}},y.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=[],s=0,c=0,f=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],h=t.position||t.positions;if(h){var d=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(d[0])?(m=d.length>e-1?d[e-1]:d.length>0?d[d.length-1]:[0,0,0,1],y=d.length>e?d[e]:d.length>0?d[d.length-1]:[0,0,0,1]):m=y=d,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 M=s;if(s+=p(x,_),v){for(r=0;r<2;++r)i.push(x[0],x[1],x[2],_[0],_[1],_[2],M,b,m[0],m[1],m[2],m[3]);c+=2,v=!1}i.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],s,-b,y[0],y[1],y[2],y[3],_[0],_[1],_[2],x[0],x[1],x[2],s,b,y[0],y[1],y[2],y[3]),c+=4}}if(this.buffer.update(i),a.push(s),o.push(h[h.length-1].slice()),this.bounds=f,this.vertexCount=c,this.points=o,this.arcLength=a,"dashes"in t){var T=t.dashes.slice();for(T.unshift(0),e=1;e1.0001)return null;m+=v[f]}if(Math.abs(m-1)>.001)return null;return[h,s(t,v),v]}},{barycentric:18,"polytope-closest-point/lib/closest_point_2d.js":324}],152:[function(t,e,r){var n=t("glslify"),i=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\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;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\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 f_color = color;\n f_data = position;\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\n//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d\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;\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 (f_color.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], f_data)\n ) 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 = vec4(f_color.rgb, 1.0) * 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 * f_color.a;\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 ,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, 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.0);\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:154}],153:[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,T,A,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=M,this.pointSizes=T,this.pointIds=x,this.pointVAO=A,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=E,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickVertex=!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.hasAlpha=!1,this.opacityscale=!1,this._model=w,this._view=w,this._projection=w,this._resolution=[1,1]}var T=M.prototype;function A(t,e){if(!e)return 1;if(!e.length)return 1;for(var r=0;rt&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}function k(t){var e=n(t,v.vertex,v.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function E(t){var e=n(t,m.vertex,m.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function L(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 S(t){var e=n(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}function C(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 O(t){var e=n(t,_.vertex,_.fragment);return e.attributes.position.location=0,e}T.isOpaque=function(){return!this.hasAlpha},T.isTransparent=function(){return this.hasAlpha},T.pickSlots=1,T.setPickBase=function(t){this.pickId=t},T.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())},T.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())},T.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":11,"has-passive-events":268,"mouse-change":289,"mouse-event-offset":290,"mouse-wheel":292,"right-now":333}],156:[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":166,glslify:157}],157:[function(t,e,r){arguments[4][104][0].apply(r,arguments)},{dup:104}],158:[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("gl-mat4/perspective"),h=t("gl-mat4/ortho"),d=t("./lib/shader"),p=t("is-mobile")({tablet:!0,featureDetect:!0});function g(){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 v(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 m(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)t.container.appendChild(e);else document.body.appendChild(e)}var r=t.gl;r||(t.glOptions&&(p=!!t.glOptions.preserveDrawingBuffer),r=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:p}));if(!r)throw new Error("webgl not supported");var y=t.bounds||[[-10,-10,-10],[10,10,10]],b=new g,x=l(r,r.drawingBufferWidth,r.drawingBufferHeight,{preferFloat:!p}),_=d(r),w=t.cameraObject&&!0===t.cameraObject._ortho||t.camera.projection&&"orthographic"===t.camera.projection.type||!1,M={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:w},T=t.axes||{},A=i(r,T);A.enable=!T.disable;var k=t.spikes||{},E=o(r,k),L=[],S=[],C=[],O=[],R=!0,P=!0,z=new Array(16),I=new Array(16),D={view:null,projection:z,model:I,_ortho:!1},N=(P=!0,[r.drawingBufferWidth,r.drawingBufferHeight]),F=t.cameraObject||n(e,M),j={gl:r,contextLost:!1,pixelRatio:t.pixelRatio||1,canvas:e,selection:b,camera:F,axes:A,axesPixels:null,spikes:E,bounds:y,objects:L,shape:N,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:m(t.autoResize),autoBounds:m(t.autoBounds),autoScale:!!t.autoScale,autoCenter:m(t.autoCenter),clipToBounds:m(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:D,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(t){this.aspect[0]=t.x,this.aspect[1]=t.y,this.aspect[2]=t.z,P=!0},setBounds:function(t,e){this.bounds[0][t]=e.min,this.bounds[1][t]=e.max},setClearColor:function(t){this.clearColor=t},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},B=[r.drawingBufferWidth/j.pixelRatio|0,r.drawingBufferHeight/j.pixelRatio|0];function U(){if(!j._stopped&&j.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*j.pixelRatio),a=0|Math.ceil(n*j.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",R=!0}}}j.autoResize&&U();function V(){for(var t=L.length,e=O.length,n=0;n0&&0===C[e-1];)C.pop(),O.pop().dispose()}function H(){if(j.contextLost)return!0;r.isContextLost()&&(j.contextLost=!0,j.mouseListener.enabled=!1,j.selection.object=null,j.oncontextloss&&j.oncontextloss())}window.addEventListener("resize",U),j.update=function(t){j._stopped||(t=t||{},R=!0,P=!0)},j.add=function(t){j._stopped||(t.axes=A,L.push(t),S.push(-1),R=!0,P=!0,V())},j.remove=function(t){if(!j._stopped){var e=L.indexOf(t);e<0||(L.splice(e,1),S.pop(),R=!0,P=!0,V())}},j.dispose=function(){if(!j._stopped&&(j._stopped=!0,window.removeEventListener("resize",U),e.removeEventListener("webglcontextlost",H),j.mouseListener.enabled=!1,!j.contextLost)){A.dispose(),E.dispose();for(var t=0;tb.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}},{}],160:[function(t,e,r){"use strict";e.exports=function(t){return t||0===t?t.toString():""}},{}],161:[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 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":166,glslify:163}],163:[function(t,e,r){arguments[4][104][0].apply(r,arguments)},{dup:104}],164:[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||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],M=f.slice(),T=[0,0,0],A=[[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=A,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=M,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 D=z;z=I,I=D,D=R,R=P,P=D;var N=C;C=O,O=N}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(T,g[0],v,-1e8),l.fragClipBounds[1]=L(T,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],D=[0,0,0,1],N=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],M=0;M<3;++M){if(isNaN(w[M])||!isFinite(w[M]))continue t;f[M]=Math.max(f[M],w[M]),c[M]=Math.min(c[M],w[M])}T=(j=R(h,n,l,this.pixelRatio)).mesh,A=j.lines,k=j.bounds;var j,B=j.visible;if(B)if(Array.isArray(d)){if(3===(U=N?n0?1-k[0][0]:X<0?1+k[1][0]:1,Y*=Y>0?1-k[0][1]:Y<0?1+k[1][1]:1],Z=T.cells||[],Q=T.positions||[];for(M=0;Mthis.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),T=new Array(M),A=0;A=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){if((p=h.charCodeAt(h.length-1)-48)<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;if((p=h.charCodeAt(h.length-1)-48)<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)}if((a=r.charCodeAt(r.length-1)-48)<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;if((r=t.charCodeAt(t.length-1)-48)<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){s[0]in a||(a[s[0]]=[]),a=a[s[0]];for(var l=1;l1)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;\n\nuniform float vectorScale, tubeScale;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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:"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:177}],177:[function(t,e,r){arguments[4][104][0].apply(r,arguments)},{dup:104}],178:[function(t,e,r){"use strict";var n=t("gl-vec3"),i=t("gl-vec4"),a=["xyz","xzy","yxz","yzx","zxy","zyx"],o=function(t,e,r,a){for(var o=0,s=0;s0)for(M=0;M<8;M++){var T=(M+1)%8;u.push(h[M],d[M],d[T],d[T],h[T],h[M]),f.push(y,m,m,m,y,y),p.push(g,v,v,v,g,g);var A=u.length;c.push([A-6,A-5,A-4],[A-3,A-2,A-1])}var k=h;h=d,d=k;var E=y;y=m,m=E;var L=g;g=v,v=L}return{positions:u,cells:c,vectors:f,vertexIntensity:p}}(t,r,a,o)})),f=[],h=[],d=[],p=[];for(s=0;se)return r-1}return r},l=function(t,e,r){return tr?r:t},u=function(t){var e=1/0;t.sort((function(t,e){return t-e}));for(var r=t.length,n=1;nf-1||y>h-1||b>d-1)return n.create();var x,_,w,M,T,A,k=a[0][p],E=a[0][m],L=a[1][g],S=a[1][y],C=a[2][v],O=(o-k)/(E-k),R=(u-L)/(S-L),P=(c-C)/(a[2][b]-C);switch(isFinite(O)||(O=.5),isFinite(R)||(R=.5),isFinite(P)||(P=.5),r.reversedX&&(p=f-1-p,m=f-1-m),r.reversedY&&(g=h-1-g,y=h-1-y),r.reversedZ&&(v=d-1-v,b=d-1-b),r.filled){case 5:T=v,A=b,w=g*d,M=y*d,x=p*d*h,_=m*d*h;break;case 4:T=v,A=b,x=p*d,_=m*d,w=g*d*f,M=y*d*f;break;case 3:w=g,M=y,T=v*h,A=b*h,x=p*h*d,_=m*h*d;break;case 2:w=g,M=y,x=p*h,_=m*h,T=v*h*f,A=b*h*f;break;case 1:x=p,_=m,T=v*f,A=b*f,w=g*f*d,M=y*f*d;break;default:x=p,_=m,w=g*f,M=y*f,T=v*f*h,A=b*f*h}var z=i[x+w+T],I=i[x+w+A],D=i[x+M+T],N=i[x+M+A],F=i[_+w+T],j=i[_+w+A],B=i[_+M+T],U=i[_+M+A],V=n.create(),H=n.create(),q=n.create(),G=n.create();n.lerp(V,z,F,O),n.lerp(H,I,j,O),n.lerp(q,D,B,O),n.lerp(G,N,U,O);var X=n.create(),Y=n.create();n.lerp(X,V,q,R),n.lerp(Y,H,G,R);var W=n.create();return n.lerp(W,X,Y,P),W}(e,t,d)},g=t.getDivergence||function(t,e){var r=n.create(),i=1e-4;n.add(r,t,[i,0,0]);var a=p(r);n.subtract(a,a,e),n.scale(a,a,1/i),n.add(r,t,[0,i,0]);var o=p(r);n.subtract(o,o,e),n.scale(o,o,1/i),n.add(r,t,[0,0,i]);var s=p(r);return n.subtract(s,s,e),n.scale(s,s,1/i),n.add(r,a,o),n.add(r,r,s),r},v=[],m=e[0][0],y=e[0][1],b=e[0][2],x=e[1][0],_=e[1][1],w=e[1][2],M=function(t){var e=t[0],r=t[1],n=t[2];return!(ex||r_||nw)},T=10*n.distance(e[0],e[1])/i,A=T*T,k=1,E=0,L=r.length;L>1&&(k=function(t){for(var e=[],r=[],n=[],i={},a={},o={},s=t.length,l=0;lE&&(E=N),I.push(N),v.push({points:O,velocities:R,divergences:I});for(var F=0;F<100*i&&O.lengthA&&n.scale(j,j,T/Math.sqrt(B)),n.add(j,j,C),P=p(j),n.squaredDistance(z,j)-A>-1e-4*A){O.push(j),z=j,R.push(P);D=g(j,P),N=n.length(D);isFinite(N)&&N>E&&(E=N),I.push(N)}C=j}}var U=o(v,t.colormap,E,k);return f?U.tubeScale=f:(0===E&&(E=1),U.tubeScale=.5*c*k/E),U};var c=t("./lib/shaders"),f=t("gl-cone3d").createMesh;e.exports.createTubeMesh=function(t,e){return f(t,e,{shaders:c,traceType:"streamtube"})}},{"./lib/shaders":176,"gl-cone3d":107,"gl-vec3":205,"gl-vec4":241}],179:[function(t,e,r){var n=t("gl-shader"),i=t("glslify"),a=i(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform vec3 objectOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\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 localCoordinate = vec3(uv.zw, f.x);\n worldCoordinate = objectOffset + localCoordinate;\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n"]),o=i(["precision 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 beckmannSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\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 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 (\n kill > 0.0 ||\n vColor.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)\n ) 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":166,glslify:180}],180:[function(t,e,r){arguments[4][104][0].apply(r,arguments)},{dup:104}],181:[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:40,offset:0},{buffer:u,size:3,stride:40,offset:16},{buffer:u,size:3,stride:40,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,256,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var v=new k(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 w in t)m[w]=t[w];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=[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 A(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}}();function k(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 A([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 E=k.prototype;E.genColormap=function(t,e){var r=!1,n=c([l({colormap:t,nshades:256,format:"rgba"}).map((function(t,n){var i=e?function(t,e){if(!e)return 1;if(!e.length)return 1;for(var r=0;rt&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}(n/255,e):t[3];return i<1&&(r=!0),[t[0],t[1],t[2],255*i]}))]);return u.divseq(n,255),this.hasAlphaScale=r,n},E.isTransparent=function(){return this.opacity<1||this.hasAlphaScale},E.isOpaque=function(){return!this.isTransparent()},E.pickSlots=1,E.setPickBase=function(t){this.pickId=t};var L=[0,0,0],S={showSurface:!1,showContour:!1,projections:[w.slice(),w.slice(),w.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function C(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||L,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=S.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=S.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 S.showSurface=o,S.showContour=s,S}var O={model:w,view:w,projection:w,inverseModel:w.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},R=w.slice(),P=[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=O;n.model=t.model||w,n.view=t.view||w,n.projection=t.projection||w,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=P,n.vertexColor=this.vertexColor;var s=R;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=C(n,this);if(c.showSurface){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){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},E.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))},E.update=function(t){t=t||{},this.objectOffset=t.objectOffset||this.objectOffset,this.dirty=!0,"contourWidth"in t&&(this.contourWidth=D(t.contourWidth,Number)),"showContour"in t&&(this.showContour=D(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=D(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=F(t.contourColor)),"contourProject"in t&&(this.contourProject=D(t.contourProject,(function(t){return D(t,Boolean)}))),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=F(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=D(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=D(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"opacityscale"in t&&(this.opacityscale=t.opacityscale),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0),"colormap"in t&&this._colorMap.setPixels(this.genColormap(t.colormap,this.opacityscale));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 l=t.coords;if(!Array.isArray(l)||3!==l.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var u=l[o];for(m=0;m<2;++m)if(u.shape[m]!==a[m])throw new Error("gl-surface: coords have incorrect shape");this.padField(this._field[o],u)}}else if(t.ticks){var c=t.ticks;if(!Array.isArray(c)||2!==c.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var d=c[o];if((Array.isArray(d)||d.length)&&(d=f(d)),d.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var p=f(d.data,a);p.stride[o]=d.stride[0],p.stride[1^o]=0,this.padField(this._field[o],p)}}else{for(o=0;o<2;++o){var g=[0,0];g[o]=1,this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2],g,0)}this._field[0].set(0,0,0);for(var m=0;m0){for(var bt=0;bt<5;++bt)J.pop();U-=1}continue t}J.push(nt[0],nt[1],ot[0],ot[1],nt[2]),U+=1}}rt.push(U)}this._contourOffsets[$]=et,this._contourCounts[$]=rt}var xt=s.mallocFloat(J.length);for(o=0;oi||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 d(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 p=d.prototype;function g(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 v(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 m(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=v(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new d(t,o,e,r,n,i)}function y(t,e,r,n,i,a){var o=v(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new d(t,o,r,n,i,a)}function b(t,e){var r=e.dtype,o=e.shape.slice(),s=t.getParameter(t.MAX_TEXTURE_SIZE);if(o[0]<0||o[0]>s||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=g(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 c,h,p=0;if(2===o.length)p=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])p=t.ALPHA;else if(2===o[2])p=t.LUMINANCE_ALPHA;else if(3===o[2])p=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");p=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,l=!1);var m=e.size;if(l)c=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];h=a.malloc(m,r);var b=n(h,o,y,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?i.assign(b,e):f(b,e),c=h.subarray(0,m)}var x=v(t);return t.texImage2D(t.TEXTURE_2D,0,p,o[0],o[1],0,p,u,c),l||a.free(h),new d(t,x,o[0],o[1],p,u)}Object.defineProperties(p,{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 h(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return h(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,h(this,this._shape[0],t),t}}}),p.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},p.dispose=function(){this.gl.deleteTexture(this.handle)},p.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)},p.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=c(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,c){var h=c.dtype,d=c.shape.slice();if(d.length<2||d.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var p=0,v=0,m=g(d,c.stride.slice());"float32"===h?p=t.FLOAT:"float64"===h?(p=t.FLOAT,m=!1,h="float32"):"uint8"===h?p=t.UNSIGNED_BYTE:(p=t.UNSIGNED_BYTE,m=!1,h="uint8");if(2===d.length)v=t.LUMINANCE,d=[d[0],d[1],1],c=n(c.data,d,[c.stride[0],c.stride[1],1],c.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=c.size,b=u.indexOf(o)<0;b&&u.push(o);if(p===l&&m)0===c.offset&&c.data.length===y?b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,c.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,c.data):b?t.texImage2D(t.TEXTURE_2D,o,s,d[0],d[1],0,s,l,c.data.subarray(c.offset,c.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,d[0],d[1],s,l,c.data.subarray(c.offset,c.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]);p===t.FLOAT&&l===t.UNSIGNED_BYTE?f(_,c):i.assign(_,c),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:301,"ndarray-ops":296,"typedarray-pool":366}],183:[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":198,"./fromValues":204,"./normalize":215}],189:[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}},{}],190:[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}},{}],191:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}},{}],192:[function(t,e,r){e.exports=function(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}},{}],193:[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}},{}],194:[function(t,e,r){e.exports=t("./distance")},{"./distance":195}],195:[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)}},{}],196:[function(t,e,r){e.exports=t("./divide")},{"./divide":197}],197:[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}},{}],198:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],199:[function(t,e,r){e.exports=1e-6},{}],200:[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":199}],201:[function(t,e,r){e.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}},{}],202:[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}},{}],203:[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}},{}],216:[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}},{}],217:[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}},{}],218:[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}},{}],219:[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}},{}],220:[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}},{}],221:[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}},{}],222:[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}},{}],223:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}},{}],224:[function(t,e,r){e.exports=t("./squaredDistance")},{"./squaredDistance":226}],225:[function(t,e,r){e.exports=t("./squaredLength")},{"./squaredLength":227}],226:[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}},{}],227:[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}},{}],228:[function(t,e,r){e.exports=t("./subtract")},{"./subtract":229}],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}},{}],230:[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}},{}],231:[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}},{}],232:[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}},{}],233:[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}},{}],234:[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}},{}],235:[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}},{}],236:[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}},{}],237:[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)}},{}],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){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}},{}],240:[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}},{}],241:[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":233,"./clone":234,"./copy":235,"./create":236,"./distance":237,"./divide":238,"./dot":239,"./fromValues":240,"./inverse":242,"./length":243,"./lerp":244,"./max":245,"./min":246,"./multiply":247,"./negate":248,"./normalize":249,"./random":250,"./scale":251,"./scaleAndAdd":252,"./set":253,"./squaredDistance":254,"./squaredLength":255,"./subtract":256,"./transformMat4":257,"./transformQuat":258}],242:[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}},{}],243:[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)}},{}],244:[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}},{}],245:[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}},{}],246:[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}},{}],247:[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}},{}],248:[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}},{}],249:[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}},{}],250:[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":249,"./scale":251}],251:[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}},{}],252:[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}},{}],253:[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}},{}],254:[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}},{}],255:[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}},{}],256:[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}},{}],257:[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}},{}],258:[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}},{}],259:[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 A(r),m+=r.length,(d=d.slice(r.length)).length}}function R(){return/[^a-fA-F0-9]/.test(e)?(A(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function P(){return"."===e||/[eE]/.test(e)?(d.push(e),h=5,r=e,c+1):"x"===e&&1===d.length&&"0"===d[0]?(h=11,d.push(e),r=e,c+1):/[^\d]/.test(e)?(A(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function z(){return"f"===e&&(d.push(e),r=e,c+=1),/[eE]/.test(e)?(d.push(e),r=e,c+1):("-"!==e&&"+"!==e||!/[eE]/.test(r))&&/[^\d]/.test(e)?(A(d.join("")),h=999,c):(d.push(e),r=e,c+1)}function I(){if(/[^\d\w_]/.test(e)){var t=d.join("");return h=T[t]?8:M[t]?7:6,A(d.join("")),h=999,c}return d.push(e),r=e,c+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=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":262,"./lib/builtins-300es":261,"./lib/literals":264,"./lib/literals-300es":263,"./lib/operators":265}],261:[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":262}],262:[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"]},{}],263:[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","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":264}],264:[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","uint","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"]},{}],265:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],266:[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":260}],267:[function(t,e,r){(function(r){(function(){"use strict";var n,i=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:i,e.exports=n}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":275}],268:[function(t,e,r){"use strict";var n=t("is-browser");e.exports=n&&function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){t=!1}return t}()},{"is-browser":275}],269:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>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}},{}],270:[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);var f=new a(l,new Array(i+1),!1),h=f.adjacent,d=new Array(i+2);for(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(c=0;c<=i;++c){p=h[c].vertices;var y=h[c].adjacent;for(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])}}var _=new u(i,o,d),w=!!e;for(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(),T=new a(w,M,!0);c.push(T);var A=_.indexOf(e);if(!(A<0)){_[A]=T,M[g]=m,w[v]=-1,M[v]=e,p[v]=T,T.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,T,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":339,"simplicial-complex":349}],271:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function i(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 m(null);return new m(v(t))};var a=i.prototype;function o(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 s(t,e){var r=v(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 l(t,e){var r=t.intervals([]);r.push(e),s(t,r)}function u(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?0:(r.splice(n,1),s(t,r),1)}function c(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function h(t,e){for(var r=0;r>1],a=[],o=[],s=[];for(r=0;r3*(e+1)?l(this,t):this.left.insert(t):this.left=v([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?l(this,t):this.right.insert(t):this.right=v([t]);else{var r=n.ge(this.leftPoints,t,p),i=n.ge(this.rightPoints,t,g);this.leftPoints.splice(r,0,t),this.rightPoints.splice(i,0,t)}},a.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?u(this,t):2===(s=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?u(this,t):2===(s=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,i=this.left;i.right;)r=i,i=i.right;if(r===this)i.right=this.right;else{var a=this.left,s=this.right;r.count-=i.count,r.right=i.left,i.left=a,i.right=s}o(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?o(this,this.left):o(this,this.right);return 1}for(a=n.ge(this.leftPoints,t,p);athis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return f(this.rightPoints,t,e)}return h(this.leftPoints,e)},a.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?f(this.rightPoints,t,r):h(this.leftPoints,r)};var y=m.prototype;y.insert=function(t){this.root?this.root.insert(t):this.root=new i(t[0],null,null,[t],[t])},y.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},y.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},y.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(y,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(y,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":272}],272:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{dup:93}],273:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r * @license MIT */ -e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],256:[function(t,e,r){"use strict";e.exports=a,e.exports.isMobile=a,e.exports.default=a;var n=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function a(t){t||(t={});var e=t.ua;if(e||"undefined"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&"string"==typeof e.headers["user-agent"]&&(e=e.headers["user-agent"]),"string"!=typeof e)return!1;var r=t.tablet?i.test(e):n.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf("Macintosh")&&-1!==e.indexOf("Safari")&&(r=!0),r}},{}],257:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],258:[function(t,e,r){"use strict";e.exports=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}},{}],259:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],260:[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":262,"gl-mat4/clone":117,"gl-mat4/create":118,"gl-mat4/determinant":119,"gl-mat4/invert":123,"gl-mat4/transpose":134,"gl-vec3/cross":171,"gl-vec3/dot":176,"gl-vec3/length":186,"gl-vec3/normalize":193}],262:[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}},{}],263:[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":119,"gl-vec3/lerp":187,"mat4-decompose":261,"mat4-recompose":264,"quat-slerp":305}],264:[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":118,"gl-mat4/fromRotationTranslation":121,"gl-mat4/identity":122,"gl-mat4/multiply":125,"gl-mat4/scale":132,"gl-mat4/translate":133}],265:[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)}r=new Array(s.length+o.length-2);for(var f=0,h=(i=0,o.length);i0;--d)r[f++]=s[d];return r};var n=t("robust-orientation")[3]},{"robust-orientation":318}],268:[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():function(){if(!s)return;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":270}],269:[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}},{}],270:[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 w=t.getters||[],M=new Array(x),A=0;A=0?M[A]=!0:M[A]=!1;return function(t,e,r,x,_,w){var M=w.length,A=_.length;if(A<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var T="extractContour"+_.join("_"),k=[],E=[],L=[],S=0;S0&&P.push(l(S,_[C-1])+"*"+s(_[C-1])),E.push(p(S,_[C])+"=("+P.join("-")+")|0")}for(S=0;S=0;--S)z.push(s(_[S]));E.push("Q=("+z.join("*")+")|0","P=mallocUint32(Q)","V=mallocUint32(Q)","X=0"),E.push(g(0)+"=0");for(C=1;C<1<0;_=_-1&p)b.push("V[X+"+m(_)+"]");b.push(y(0));for(_=0;_=0;--e)j(e,0);var r=[];for(e=0;e0){",d(_[e]),"=1;"),t(e-1,r|1<<_[e]);for(var n=0;n=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(l=0;l=0||e.indexOf(-(l+1))>=0||n.push("&&s[",l,"]>2");n.push("){grad",i,"(src.pick(",s.join(),")",u);for(l=0;l=0||e.indexOf(-(l+1))>=0||n.push(",dst.pick(",s.join(),",",l,")",u);n.push(");")}for(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}],276:[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":277,ndarray:280}],277:[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}],278:[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){r.push("dptr=0;sptr=ptr");for(c=t.length-1;c>=0;--c){0!==(d=t[c])&&r.push(["for(i",d,"=0;i",d,"b){break __l}"].join(""));for(c=t.length-1;c>=1;--c)r.push("sptr+=e"+c,"dptr+=f"+c,"}");r.push("dptr=cptr;sptr=cptr-s0");for(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 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){"),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){"),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){"),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":345}],279:[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":278}],280:[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:[],bigint64:[],biguint64:[],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){n=0;for(s=0;st==t>0?a===-1>>>0?(r+=1,a=0):a+=1:0===a?(a=-1>>>0,r-=1):a-=1;return n.pack(a,r)}},{"double-bits":85}],282:[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}},{}],283:[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}},{}],284:[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],L=A[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":283,"filtered-vector":92,"gl-mat4/fromQuat":120,"gl-mat4/invert":123,"gl-mat4/lookAt":124}],285:[function(t,e,r){ +e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],277:[function(t,e,r){"use strict";e.exports=a,e.exports.isMobile=a,e.exports.default=a;var n=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function a(t){t||(t={});var e=t.ua;if(e||"undefined"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&"string"==typeof e.headers["user-agent"]&&(e=e.headers["user-agent"]),"string"!=typeof e)return!1;var r=t.tablet?i.test(e):n.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf("Macintosh")&&-1!==e.indexOf("Safari")&&(r=!0),r}},{}],278:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],279:[function(t,e,r){"use strict";e.exports=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}},{}],280:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],281:[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":283,"gl-mat4/clone":122,"gl-mat4/create":124,"gl-mat4/determinant":125,"gl-mat4/invert":137,"gl-mat4/transpose":150,"gl-vec3/cross":193,"gl-vec3/dot":198,"gl-vec3/length":208,"gl-vec3/normalize":215}],283:[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}},{}],284:[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":125,"gl-vec3/lerp":209,"mat4-decompose":282,"mat4-recompose":285,"quat-slerp":326}],285:[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":124,"gl-mat4/fromRotationTranslation":128,"gl-mat4/identity":135,"gl-mat4/multiply":139,"gl-mat4/scale":147,"gl-mat4/translate":149}],286:[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)}r=new Array(s.length+o.length-2);for(var f=0,h=(i=0,o.length);i0;--d)r[f++]=s[d];return r};var n=t("robust-orientation")[3]},{"robust-orientation":339}],289:[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():function(){if(!s)return;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":291}],290:[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}},{}],291:[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 w=t.getters||[],M=new Array(x),T=0;T=0?M[T]=!0:M[T]=!1;return function(t,e,r,x,_,w){var M=w.length,T=_.length;if(T<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var A="extractContour"+_.join("_"),k=[],E=[],L=[],S=0;S0&&P.push(l(S,_[C-1])+"*"+s(_[C-1])),E.push(p(S,_[C])+"=("+P.join("-")+")|0")}for(S=0;S=0;--S)z.push(s(_[S]));E.push("Q=("+z.join("*")+")|0","P=mallocUint32(Q)","V=mallocUint32(Q)","X=0"),E.push(g(0)+"=0");for(C=1;C<1<0;_=_-1&p)b.push("V[X+"+m(_)+"]");b.push(y(0));for(_=0;_=0;--e)j(e,0);var r=[];for(e=0;e0){",d(_[e]),"=1;"),t(e-1,r|1<<_[e]);for(var n=0;n=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(l=0;l=0||e.indexOf(-(l+1))>=0||n.push("&&s[",l,"]>2");n.push("){grad",i,"(src.pick(",s.join(),")",u);for(l=0;l=0||e.indexOf(-(l+1))>=0||n.push(",dst.pick(",s.join(),",",l,")",u);n.push(");")}for(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}],297:[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":298,ndarray:301}],298:[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}],299:[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){r.push("dptr=0;sptr=ptr");for(c=t.length-1;c>=0;--c){0!==(d=t[c])&&r.push(["for(i",d,"=0;i",d,"b){break __l}"].join(""));for(c=t.length-1;c>=1;--c)r.push("sptr+=e"+c,"dptr+=f"+c,"}");r.push("dptr=cptr;sptr=cptr-s0");for(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 T(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 A(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 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){"),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){"),T("k","less","great"),n.push("break"),n.push("}else{"),A("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){"),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){"),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":366}],300:[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":299}],301:[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:[],bigint64:[],biguint64:[],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){n=0;for(s=0;st==t>0?a===-1>>>0?(r+=1,a=0):a+=1:0===a?(a=-1>>>0,r-=1):a-=1;return n.pack(a,r)}},{"double-bits":85}],303:[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(T),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}},{}],304:[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}},{}],305:[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 T=Math.exp(this.computedRadius[0]);T=Math.max(1e-4,T+n),this.radius.set(t,Math.log(T))},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 T=this.computedRotation,A=T[0],k=T[1],E=T[2],L=T[3],S=A*w+L*b+k*_-E*x,C=k*w+L*x+E*b-A*_,O=E*w+L*_+A*x-k*b,R=L*w-A*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":304,"filtered-vector":92,"gl-mat4/fromQuat":126,"gl-mat4/invert":137,"gl-mat4/lookAt":138}],306:[function(t,e,r){ /*! * pad-left * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT license. */ -"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return n(r="undefined"!=typeof r?r+"":" ",e)+t}},{"repeat-string":311}],286:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,(function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),"m"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length0;--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":252,"typedarray-pool":345}],290:[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||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(o=0;o0;){a[0][o].length;var g=f(o,d);h(0,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}],291:[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;var c=r[u];for(s=0;s0}))).length,v=new Array(g),m=new Array(g);for(d=0;d0;){var F=D.pop(),j=L[F];l(j,(function(t,e){return t-e}));var B,U=j.length,V=N[F];if(0===V){var H=p[F];B=[H]}for(d=0;d=0))if(N[q]=1^V,D.push(q),0===V)I(H=p[q])||(H.reverse(),B.push(H))}0===V&&r.push(B)}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;r2&&(e.push([r].concat(i.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length0;--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":273,"typedarray-pool":366}],311:[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||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(o=0;o0;){a[0][o].length;var g=f(o,d);h(0,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}],312:[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;var c=r[u];for(s=0;s0}))).length,v=new Array(g),m=new Array(g);for(d=0;d0;){var F=D.pop(),j=L[F];l(j,(function(t,e){return t-e}));var B,U=j.length,V=N[F];if(0===V){var H=p[F];B=[H]}for(d=0;d=0))if(N[q]=1^V,D.push(q),0===V)I(H=p[q])||(H.reverse(),B.push(H))}0===V&&r.push(B)}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}},{}],298:[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=v();if(y){var b;if(t)(b=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=h.seg.myFill;r&&r.segmentUpdate(y.seg),h.other.remove(),h.remove()}if(a.getHead()!==h){r&&r.rewind(h.seg);continue}if(t)b=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=b?!h.seg.myFill.below:h.seg.myFill.below;else if(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":55,"compare-cell":70,"compare-oriented-cell":71}],311:[function(t,e,r){ +var n,i=t("./lib/build-log"),a=t("./lib/epsilon"),o=t("./lib/intersecter"),s=t("./lib/segment-chainer"),l=t("./lib/segment-selector"),u=t("./lib/geojson"),c=!1,f=a();function h(t,e,r){var i=n.segments(t),a=n.segments(e),o=r(n.combine(i,a));return n.polygon(o)}n={buildLog:function(t){return!0===t?c=i():!1===t&&(c=!1),!1!==c&&c.list},epsilon:function(t){return f.epsilon(t)},segments:function(t){var e=o(!0,f,c);return t.regions.forEach(e.addRegion),{segments:e.calculate(t.inverted),inverted:t.inverted}},combine:function(t,e){return{combined:o(!1,f,c).calculate(t.segments,t.inverted,e.segments,e.inverted),inverted1:t.inverted,inverted2:e.inverted}},selectUnion:function(t){return{segments:l.union(t.combined,c),inverted:t.inverted1||t.inverted2}},selectIntersect:function(t){return{segments:l.intersect(t.combined,c),inverted:t.inverted1&&t.inverted2}},selectDifference:function(t){return{segments:l.difference(t.combined,c),inverted:t.inverted1&&!t.inverted2}},selectDifferenceRev:function(t){return{segments:l.differenceRev(t.combined,c),inverted:!t.inverted1&&t.inverted2}},selectXor:function(t){return{segments:l.xor(t.combined,c),inverted:t.inverted1!==t.inverted2}},polygon:function(t){return{regions:s(t.segments,f,c),inverted:t.inverted}},polygonFromGeoJSON:function(t){return u.toPolygon(n,t)},polygonToGeoJSON:function(t){return u.fromPolygon(n,f,t)},union:function(t,e){return h(t,e,n.selectUnion)},intersect:function(t,e){return h(t,e,n.selectIntersect)},difference:function(t,e){return h(t,e,n.selectDifference)},differenceRev:function(t,e){return h(t,e,n.selectDifferenceRev)},xor:function(t,e){return h(t,e,n.selectXor)}},"object"==typeof window&&(window.PolyBool=n),e.exports=n},{"./lib/build-log":317,"./lib/epsilon":318,"./lib/geojson":319,"./lib/intersecter":320,"./lib/segment-chainer":322,"./lib/segment-selector":323}],317:[function(t,e,r){e.exports=function(){var t,e=0,r=!1;function n(e,r){return t.list.push({type:e,data:r?JSON.parse(JSON.stringify(r)):void 0}),t}return t={list:[],segmentId:function(){return e++},checkIntersection:function(t,e){return n("check",{seg1:t,seg2:e})},segmentChop:function(t,e){return n("div_seg",{seg:t,pt:e}),n("chop",{seg:t,pt:e})},statusRemove:function(t){return n("pop_seg",{seg:t})},segmentUpdate:function(t){return n("seg_update",{seg:t})},segmentNew:function(t,e){return n("new_seg",{seg:t,primary:e})},segmentRemove:function(t){return n("rem_seg",{seg:t})},tempStatus:function(t,e,r){return n("temp_status",{seg:t,above:e,below:r})},rewind:function(t){return n("rewind",{seg:t})},status:function(t,e,r){return n("status",{seg:t,above:e,below:r})},vert:function(e){return e===r?t:(r=e,n("vert",{x:e}))},log:function(t){return"string"!=typeof t&&(t=JSON.stringify(t,!1," ")),n("log",{txt:t})},reset:function(){return n("reset")},selected:function(t){return n("selected",{segs:t})},chainStart:function(t){return n("chain_start",{seg:t})},chainRemoveHead:function(t,e){return n("chain_rem_head",{index:t,pt:e})},chainRemoveTail:function(t,e){return n("chain_rem_tail",{index:t,pt:e})},chainNew:function(t,e){return n("chain_new",{pt1:t,pt2:e})},chainMatch:function(t){return n("chain_match",{index:t})},chainClose:function(t){return n("chain_close",{index:t})},chainAddHead:function(t,e){return n("chain_add_head",{index:t,pt:e})},chainAddTail:function(t,e){return n("chain_add_tail",{index:t,pt:e})},chainConnect:function(t,e){return n("chain_con",{index1:t,index2:e})},chainReverse:function(t){return n("chain_rev",{index:t})},chainJoin:function(t,e){return n("chain_join",{index1:t,index2:e})},done:function(){return n("done")}}}},{}],318:[function(t,e,r){e.exports=function(t){"number"!=typeof t&&(t=1e-10);var e={epsilon:function(e){return"number"==typeof e&&(t=e),t},pointAboveOrOnLine:function(e,r,n){var i=r[0],a=r[1],o=n[0],s=n[1],l=e[0];return(o-i)*(e[1]-a)-(s-a)*(l-i)>=-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}},{}],319:[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=v();if(y){var b;if(t)(b=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=h.seg.myFill;r&&r.segmentUpdate(y.seg),h.other.remove(),h.remove()}if(a.getHead()!==h){r&&r.rewind(h.seg);continue}if(t)b=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=b?!h.seg.myFill.below:h.seg.myFill.below;else if(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?(T=1,y=u+2*h+p):y=h*(T=-h/u)+p):(T=0,d>=0?(A=0,y=p):-d>=f?(A=1,y=f+2*d+p):y=d*(A=-d/f)+p);else if(A<0)A=0,h>=0?(T=0,y=p):-h>=u?(T=1,y=u+2*h+p):y=h*(T=-h/u)+p;else{var k=1/M;y=(T*=k)*(u*T+c*(A*=k)+2*h)+A*(c*T+f*A+2*d)+p}else T<0?(x=f+d)>(b=c+h)?(_=x-b)>=(w=u-2*c+f)?(T=1,A=0,y=u+2*h+p):y=(T=_/w)*(u*T+c*(A=1-T)+2*h)+A*(c*T+f*A+2*d)+p:(T=0,x<=0?(A=1,y=f+2*d+p):d>=0?(A=0,y=p):y=d*(A=-d/f)+p):A<0?(x=u+h)>(b=c+d)?(_=x-b)>=(w=u-2*c+f)?(A=1,T=0,y=f+2*d+p):y=(T=1-(A=_/w))*(u*T+c*A+2*h)+A*(c*T+f*A+2*d)+p:(A=0,x<=0?(T=1,y=u+2*h+p):h>=0?(T=0,y=p):y=h*(T=-h/u)+p):(_=f+d-c-h)<=0?(T=0,A=1,y=f+2*d+p):_>=(w=u-2*c+f)?(T=1,A=0,y=u+2*h+p):y=(T=_/w)*(u*T+c*(A=1-T)+2*h)+A*(c*T+f*A+2*d)+p;var E=1-T-A;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}],332:[function(t,e,r){ /*! * repeat-string * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */ -"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)}},{}],312:[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:{})},{}],313:[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];(l=o-((r=a+o)-a))&&(t[--n]=r,r=l)}var s=0;for(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(l(t)),")};return robustDeterminant",t].join(""))(i,a,n,o)}var f=[function(){return[0]},function(t){return[t[0][0]]}];!function(){for(;f.length<6;)f.push(c(f.length));for(var t=[],r=["function robustDeterminant(m){switch(m.length){"],n=0;n<6;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);for(e.exports=i.apply(void 0,f.concat([f,c])),n=0;n>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function u(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 u(e,t)}function c(t){if(2===t.length)return[["diff(",u(t[0][0],t[1][1]),",",u(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 a=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];!function(){for(;a.length<6;)a.push(i(a.length));for(var t=[],r=["function dispatchLinearSolve(A,b){switch(A.length){"],n=0;n<6;++n)t.push("s"+n),r.push("case ",n,":return s",n,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);for(e.exports=o.apply(void 0,a.concat([a,i])),n=0;n<6;++n)e.exports[n]=a[n]}()},{"robust-determinant":314}],318:[function(t,e,r){"use strict";var n=t("two-product"),i=t("robust-sum"),a=t("robust-scale"),o=t("robust-subtract");function s(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function u(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=33306690738754716e-32*n;return o>=s||o<=-s?o:f(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],d=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)+d*(y-b),_=7771561172376103e-31*((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(d));return x>_||-x>_?x:h(t,e,r,n)}];function p(t){var e=d[t.length];return e||(e=d[t.length]=c(t.length)),e.apply(void 0,t)}!function(){for(;d.length<=5;)d.push(c(d.length));for(var t=[],r=["slow"],n=0;n<=5;++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<=5;++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);if(Math.max(u,c)=n?(i=f,(l+=1)=n?(i=f,(l+=1)0?1:0}},{}],325:[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":39,"reduce-simplicial-complex":310}],326:[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(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)if(e0){var t=A[0];return v(0,k-1),k-=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((k+=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))}}var A=[],T=new Array(a);for(f=0;f>1;f>=0;--f)b(f);for(;;){var E=_();if(E<0||u[E]>r)break;M(E)}var L=[];for(f=0;f=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&C.push([n,i])}})),i.unique(i.normalize(C)),{positions:L,edges:C}};var n=t("robust-orientation"),i=t("simplicial-complex")},{"robust-orientation":318,"simplicial-complex":330}],333:[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":333,"binary-search-bounds":334,"functional-red-black-tree":94,"robust-orientation":318}],336:[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":315,"robust-sum":323}],337:[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(t){return i(o(t),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}function i(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}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var r,n=e,i=[],o=0;n;){if(null!==(r=t.text.exec(n)))i.push(r[0]);else if(null!==(r=t.modulo.exec(n)))i.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");i.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 a[e]=i}"undefined"!=typeof r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],338:[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(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("}}");var L=[];for(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(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]: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 D(t){return R(t)/255}var N,F,j,B=(F="[\\s|\\(]+("+(N="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+N+")[,|\\s]+("+N+")\\s*\\)?",j="[\\s|\\(]+("+N+")[,|\\s]+("+N+")[,|\\s]+("+N+")[,|\\s]+("+N+")\\s*\\)?",{CSS_UNIT:new RegExp(N),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)},{}],340:[function(t,e,r){"use strict";var n=t("parse-unit");e.exports=a;function i(t,e){var r=n(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function a(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=i(r,"font-size")/128;return e.removeChild(r),n}(t,e);case"em":return i(e,"font-size");case"rem":return i(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 96;case"cm":return 96/2.54;case"mm":return 96/25.4;case"pt":return 96/72;case"pc":return 16}return 1}},{"parse-unit":287}],341:[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,L=this.computedMatrix;for(a=0;a<3;++a){var S=_*r[a]+w*h[a]+M*e[a];L[4*a+1]=A*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],D=O*I-R*z,N=R*P-C*I,F=C*z-O*P,j=u(D,N,F);D/=j,N/=j,F/=j,L[0]=D,L[4]=N,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,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 L=e[1],S=e[5],C=e[9],O=L*b+S*x+C*_,R=L*A+S*T+C*k;m=D<0?-Math.PI/2:Math.PI/2,y=Math.atan2(R,O)}else{var P=e[2],z=e[6],I=e[10],D=P*s+z*l+I*f,N=P*b+z*x+I*_,F=P*A+z*T+I*k;m=Math.asin(c(D)),y=Math.atan2(F,N)}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,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,q-j*Y,G-B*Y,X-U*Y)},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)),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 p(t){return new Uint8Array(d(t),0,t)}function g(t){return new Uint16Array(d(2*t),0,t)}function v(t){return new Uint32Array(d(4*t),0,t)}function m(t){return new Int8Array(d(t),0,t)}function y(t){return new Int16Array(d(2*t),0,t)}function b(t){return new Int32Array(d(4*t),0,t)}function x(t){return new Float32Array(d(4*t),0,t)}function _(t){return new Float64Array(d(8*t),0,t)}function w(t){return o?new Uint8ClampedArray(d(t),0,t):p(t)}function M(t){return s?new BigUint64Array(d(8*t),0,t):null}function A(t){return l?new BigInt64Array(d(8*t),0,t):null}function T(t){return new DataView(d(t),0,t)}function k(t){t=n.nextPow2(t);var e=n.log2(t),r=f[e];return r.length>0?r.pop():new a(t)}r.free=function(t){if(a.isBuffer(t))f[n.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|n.log2(e);c[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeBigUint64=r.freeInt8=r.freeInt16=r.freeInt32=r.freeBigInt64=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){h(t.buffer)},r.freeArrayBuffer=h,r.freeBuffer=function(t){f[n.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return d(t);switch(e){case"uint8":return p(t);case"uint16":return g(t);case"uint32":return v(t);case"int8":return m(t);case"int16":return y(t);case"int32":return b(t);case"float":case"float32":return x(t);case"double":case"float64":return _(t);case"uint8_clamped":return w(t);case"bigint64":return A(t);case"biguint64":return M(t);case"buffer":return k(t);case"data":case"dataview":return T(t);default:return null}return null},r.mallocArrayBuffer=d,r.mallocUint8=p,r.mallocUint16=g,r.mallocUint32=v,r.mallocInt8=m,r.mallocInt16=y,r.mallocInt32=b,r.mallocFloat32=r.mallocFloat=x,r.mallocFloat64=r.mallocDouble=_,r.mallocUint8Clamped=w,r.mallocBigUint64=M,r.mallocBigInt64=A,r.mallocDataView=T,r.mallocBuffer=k,r.clearCache=function(){for(var t=0;t<32;++t)u.UINT8[t].length=0,u.UINT16[t].length=0,u.UINT32[t].length=0,u.INT8[t].length=0,u.INT16[t].length=0,u.INT32[t].length=0,u.FLOAT[t].length=0,u.DOUBLE[t].length=0,u.BIGUINT64[t].length=0,u.BIGINT64[t].length=0,u.UINT8C[t].length=0,c[t].length=0,f[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":37,buffer:49,dup:87}],346:[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",h(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(d=0;d-1?parseInt(t[1+i]):0,l=a>-1?parseInt(r[1+a]):0;s!==l&&(n=n.replace(E(),"?px "),v*=Math.pow(.75,l-s),n=n.replace("?px ",E())),g+=.25*b*(l-s)}if(!0===o.superscripts){var u=t.indexOf("+"),c=r.indexOf("+"),f=u>-1?parseInt(t[1+u]):0,h=c>-1?parseInt(r[1+c]):0;f!==h&&(n=n.replace(E(),"?px "),v*=Math.pow(.75,h-f),n=n.replace("?px ",E())),g-=.25*b*(h-f)}if(!0===o.bolds){var d=t.indexOf("b|")>-1,p=r.indexOf("b|")>-1;!d&&p&&(n=m?n.replace("italic ","italic bold "):"bold "+n),d&&!p&&(n=n.replace("bold ",""))}if(!0===o.italics){var m=t.indexOf("i|")>-1,y=r.indexOf("i|")>-1;!m&&y&&(n="italic "+n),m&&!y&&(n=n.replace("italic ",""))}e.font=n}for(h=0;h",a="",o=i.length,s=a.length,l="+"===e[0]||"-"===e[0],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,p=r.substr(d,c-d).indexOf(i);u=-1!==p?p:c+s}return n}function c(t,e){var r=n(t,128);return e?a(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function f(t,e,r,n){var i=c(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:y((function(e){var n=m(e);return n?r in n:t.indexOf(e)>=0}))},set___:{value:y((function(n,i){var a,o=m(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:y((function(n){var i,a,o=m(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)}))}})};p.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 p||b();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 p),i.set(t,e)),this}:function(t,e){if(a)try{n.set(t,e)}catch(r){i||(i=new p),i.set___(t,e)}else n.set(t,e);return this},Object.create(p.prototype,{get___:{value:y((function(t,e){return i?n.has(t)?n.get(t):i.get___(t,e):n.get(t,e)}))},has___:{value:y((function(t){return n.has(t)||!!i&&i.has___(t)}))},set___:{value:y(e)},delete___:{value:y((function(t){var e=!!n.delete(t);return i&&i.delete___(t)||e}))},permitHostObjects___:{value:y((function(t){if(t!==g)throw new Error("bogus call to permitHostObjects___");a=!0}))}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=p.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=p)}function g(t){t.permitHostObjects___&&t.permitHostObjects___(g)}function v(t){return!("weakmap:"==t.substr(0,"weakmap:".length)&&"___"===t.substr(t.length-3))}function m(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[l];if(e&&e.key===t)return e;if(s(t)){e={key:t};try{return o(t,l,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function y(t){return t.prototype=null,Object.freeze(t)}function b(){h||"undefined"==typeof console||(h=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},{}],351:[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":352}],352:[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}},{}],353:[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":351}],354:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":96}],355:[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}],356:[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":355}],357:[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}]},{}],358:[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":538,"../../plots/cartesian/constants":554,"../../plots/font_attributes":576,"./arrow_paths":357}],359:[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":502,"../../plots/cartesian/axes":548,"./draw":364}],360:[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 q=!1,G=["x","y"],X=0;X1)&&(tt===$?((ut=et.r2fraction(e["a"+K]))<0||ut>1)&&(q=!0):q=!0),Y=et._offset+et.r2p(e[K]),Q=.5}else"x"===K?(Z=e[K],Y=x.l+x.w*Z):(Z=1-e[K],Y=x.t+x.h*Z),Q=e.showarrow?.5:Z;if(e.showarrow){lt.head=Y;var ct=e["a"+K];J=nt*U(.5,e.xanchor)-it*U(.5,e.yanchor),tt===$?(lt.tail=et._offset+et.r2p(ct),W=J):(lt.tail=Y+ct,W=J+ct),lt.text=lt.tail+J;var ft=b["x"===K?"width":"height"];if("paper"===$&&(lt.head=o.constrain(lt.head,1,ft-1)),"pixel"===tt){var ht=-Math.max(lt.tail-3,lt.text),dt=Math.min(lt.tail+3,lt.text)-ft;ht>0?(lt.tail+=ht,lt.text+=ht):dt>0&&(lt.tail-=dt,lt.text-=dt)}lt.tail+=st,lt.head+=st}else W=J=at*U(Q,ot),lt.text=Y+J;lt.text+=st,J+=st,W+=st,e["_"+K+"padplus"]=at/2+W,e["_"+K+"padminus"]=at/2-W,e["_"+K+"size"]=at,e["_"+K+"shift"]=J}if(q)P.remove();else{var pt=0,gt=0;if("left"!==e.align&&(pt=(w-m)*("center"===e.align?.5:1)),"top"!==e.valign&&(gt=(R-y)*("middle"===e.valign?.5:1)),c)n.select("svg").attr({x:D+pt-1,y:D+gt}).call(u.setClipUrl,F?k:null,t);else{var vt=D+gt-p.top,mt=D+pt-p.left;V.call(f.positionText,mt,vt).call(u.setClipUrl,F?k:null,t)}j.select("rect").call(u.setRect,D,D,w,R),N.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 yt,bt=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=+N.attr("width"),R=+N.attr("height"),z=m-.5*O,I=z+O,D=y-.5*R,F=D+R,j=[[z,D,z,F],[z,F,I,F],[I,F,I,D],[I,D,z,D]].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 Y=Math.sqrt(Math.pow(c-h,2)+Math.pow(f-p,2));G+=e.standoff*(h-c)/Y,X+=e.standoff*(p-f)/Y}var W,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);W=t.x,Z=t.y,s&&s.autorange&&M(s._name+".autorange",!0),v&&v.autorange&&M(v._name+".autorange",!0)},moveFn:function(t,r){var n=w(W,Z),i=n[0]+t,a=n[1]+r;P.call(u.setTranslate,i,a),A("x",s?s.p2r(s.r2p(e.x)+t):e.x+t/x.w),A("y",v?v.p2r(v.r2p(e.y)+r):e.y-r/x.h),e.axref===e.xref&&A("ax",s.p2r(s.r2p(e.ax)+t)),e.ayref===e.yref&&A("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&&bt(0,0),O)d.init({element:P.node(),gd:t,prepFn:function(){yt=C.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?A("ax",s.p2r(s.r2p(e.ax)+t)):A("ax",e.ax+t),e.ayref===e.yref?A("ay",v.p2r(v.r2p(e.ay)+r)):A("ay",e.ay+r),bt(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)}A("x",i),A("y",o),s&&v||(n=d.getCursor(s?.5:i,v?.5:o,e.xanchor,e.yanchor))}C.attr({transform:"translate("+t+","+r+")"+yt}),h(P,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",H(n))},doneFn:function(){h(P),i.call("_guiRelayout",t,T());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 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 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":588,"../annotations/draw":364}],371:[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?n>=l:n<=l));i++)n>c&&n0?n>=l:n<=l));i++)n>r[0]&&n1){var Z=Math.pow(10,Math.floor(Math.log(W)/Math.LN10));X*=Z*u.roundUp(W/Z,[2,5,10]),(Math.abs(S.start)/S.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=X}G.domain=[V+j,V+D-j],G.setScale(),t.attr("transform","translate("+Math.round(l.l)+","+Math.round(l.t)+")");var Q,J=t.select("."+A.cbtitleunshift).attr("transform","translate(-"+Math.round(l.l)+",-"+Math.round(l.t)+")"),K=t.select("."+A.cbaxis),$=0;function tt(n,i){var a={propContainer:G,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+A.cbtitle)},s="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+s+",."+s+"-math-group").remove(),p.draw(r,n,c(a,i||{}))}return u.syncOrAsync([a.previousPromises,function(){if(-1!==["top","bottom"].indexOf(T)){var t,r=l.l+(e.x+N)*l.w,n=G.title.font.size;t="top"===T?(1-(V+D-j))*l.h+l.t+3+.75*n:(1-(V+j))*l.h+l.t-3-.25*n,tt(G._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(T)){var a=t.select("."+A.cbtitle),o=a.select("text"),c=[-e.outlinewidth/2,e.outlinewidth/2],f=a.select(".h"+G._id+"title-math-group").node(),d=15.6;if(o.node()&&(d=parseInt(o.node().style.fontSize,10)*_),f?($=h.bBox(f).height)>d&&(c[1]-=($-d)/2):o.node()&&!o.classed(A.jsPlaceholder)&&($=h.bBox(o.node()).height),$){if($+=5,"top"===T)G.domain[1]-=$/l.h,c[1]*=-1;else{G.domain[0]+=$/l.h;var p=g.lineCount(o);c[1]+=(1-p)*d}a.attr("transform","translate("+c+")"),G.setScale()}}t.selectAll("."+A.cbfills+",."+A.cblines).attr("transform","translate(0,"+Math.round(l.h*(1-G.domain[1]))+")"),K.attr("transform","translate(0,"+Math.round(-l.t)+")");var m=t.select("."+A.cbfills).selectAll("rect."+A.cbfill).data(O);m.enter().append("rect").classed(A.cbfill,!0).style("stroke","none"),m.exit().remove();var y=k.map(G.c2p).map(Math.round).sort((function(t,e){return t-e}));m.each((function(t,a){var o=[0===a?k[0]:(O[a]+O[a-1])/2,a===O.length-1?k[1]:(O[a]+O[a+1])/2].map(G.c2p).map(Math.round);o[1]=u.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var s=n.select(this).attr({x:B,width:Math.max(P,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)h.gradient(s,r,e._id,"vertical",e._fillgradient,"fill");else{var l=L(t).replace("e-","");s.attr("fill",i(l).toHexString())}}));var b=t.select("."+A.cblines).selectAll("path."+A.cbline).data(v.color&&v.width?R:[]);b.enter().append("path").classed(A.cbline,!0),b.exit().remove(),b.each((function(t){n.select(this).attr("d","M"+B+","+(Math.round(G.c2p(t))+v.width/2%1)+"h"+P).call(h.lineGroupStyle,v.width,E(t),v.dash)})),K.selectAll("g."+G._id+"tick,path").remove();var x=B+P+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),w=s.calcTicks(G),M=s.makeTransFn(G),S=s.getTickSigns(G)[2];return s.drawTicks(r,G,{vals:"inside"===G.ticks?s.clipEnds(G,w):w,layer:K,path:s.makeTickPath(G,x,S),transFn:M}),s.drawLabels(r,G,{vals:w,layer:K,transFn:M,labelFns:s.makeLabelFns(G,x)})},function(){if(-1===["top","bottom"].indexOf(T)){var t=G.title.font.size,e=G._offset+G._length/2,i=l.l+(G.position||0)*l.w+("right"===G.side?10+t*(G.showticklabels?1:.5):-10-t*(G.showticklabels?.5:0));tt("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:T,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:i,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},a.previousPromises,function(){var n=P+e.outlinewidth/2+h.bBox(K.node()).width;if((Q=J.select("text")).node()&&!Q.classed(A.jsPlaceholder)){var i,o=J.select(".h"+G._id+"title-math-group").node();i=o&&-1!==["top","bottom"].indexOf(T)?h.bBox(o).width:h.bBox(J.node()).right-B-l.l,n=Math.max(n,i)}var s=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,u=H-q;t.select("."+A.cbbg).attr({x:B-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:q-F,width:Math.max(s,2),height:Math.max(u+2*F,2)}).call(d.fill,e.bgcolor).call(d.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+A.cboutline).attr({x:B,y:q+e.ypad+("top"===T?$:0),width:Math.max(P,2),height:Math.max(u-2*e.ypad-$,2)}).call(d.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var c=({center:.5,right:1}[e.xanchor]||0)*s;t.attr("transform","translate("+(l.l-c)+","+l.t+")");var f={},p=w[e.yanchor],g=M[e.yanchor];"pixels"===e.lenmode?(f.y=e.y,f.t=u*p,f.b=u*g):(f.t=f.b=0,f.yt=e.y+e.len*p,f.yb=e.y-e.len*g);var v=w[e.xanchor],m=M[e.xanchor];if("pixels"===e.thicknessmode)f.x=e.x,f.l=s*v,f.r=s*m;else{var y=s-P;f.l=y*v,f.r=y*m,f.xl=e.x-e.thickness*v,f.xr=e.x+e.thickness*m}a.autoMargin(r,e._id,f)}],r)}(r,e,t);v&&v.then&&(t._promises||[]).push(v),t._context.edits.colorbarPosition&&function(t,e,r){var n,i,a,s=r._fullLayout._size;l.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),f(t)},moveFn:function(r,o){t.attr("transform",n+" translate("+r+","+o+")"),i=l.align(e._xLeftFrac+r/s.w,e._thickFrac,0,1,e.xanchor),a=l.align(e._yBottomFrac-o/s.h,e._lenFrac,0,1,e.yanchor);var u=l.getCursor(i,a,e.xanchor,e.yanchor);f(t,u)},doneFn:function(){if(f(t),void 0!==i&&void 0!==a){var n={};n[e._propPrefix+"x"]=i,n[e._propPrefix+"y"]=a,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){a.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":475,"../../lib":502,"../../lib/extend":495,"../../lib/setcursor":521,"../../lib/svg_text_utils":525,"../../plots/cartesian/axes":548,"../../plots/cartesian/axis_defaults":550,"../../plots/cartesian/layout_attributes":562,"../../plots/cartesian/position_defaults":565,"../../plots/plots":593,"../../registry":602,"../color":373,"../colorscale/helpers":384,"../dragelement":392,"../drawing":395,"../titles":468,"./constants":375,d3:82,tinycolor2:339}],378:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":502}],379:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":374,"./defaults":376,"./draw":377,"./has_colorbar":378}],380:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),i=t("../../lib/regex").counter,a=t("./scales.js").scales;Object.keys(a);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,s=(e=e||{}).cLetter||"c",l=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),u="showScaleDflt"in e?e.showScaleDflt:"z"===s,c="string"==typeof e.colorscaleDflt?a[e.colorscaleDflt]:null,f=e.editTypeOverride||"",h=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(h+(r={z:"z",c:"color"}[s]));var d=s+"auto",p=s+"min",g=s+"max",v=s+"mid",m=(o(h+d),o(h+p),o(h+g),{});m[p]=m[g]=void 0;var y={};y[d]=!1;var b={};return"color"===r&&(b.color={valType:"color",arrayOk:!0,editType:f||"style"},e.anim&&(b.color.anim=!0)),b[d]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},b[p]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},b[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},b[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},b.colorscale={valType:"colorscale",editType:"calc",dflt:c,impliedEdits:{autocolorscale:!1}},b.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},b.reversescale={valType:"boolean",dflt:!1,editType:"plot"},l||(b.showscale={valType:"boolean",dflt:u,editType:"calc"},b.colorbar=n),e.noColorAxis||(b.coloraxis={valType:"subplotid",regex:i("coloraxis"),dflt:null,editType:"calc"}),b}},{"../../lib/regex":517,"../colorbar/attributes":374,"./scales.js":388}],381:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,s=t._fullLayout,l=r.vals,u=r.containerStr,c=u?i.nestedProperty(e,u).get():e,f=a(c),h=!1!==f.auto,d=f.min,p=f.max,g=f.mid,v=function(){return i.aggNums(Math.min,null,l)},m=function(){return i.aggNums(Math.max,null,l)};(void 0===d?d=v():h&&(d=c._colorAx&&n(d)?Math.min(d,v()):v()),void 0===p?p=m():h&&(p=c._colorAx&&n(p)?Math.max(p,m()):m()),h&&void 0!==g&&(p-g>g-d?d=g-(p-g):p-g=0?s.colorscale.sequential:s.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":502,"./helpers":384,"fast-isnumeric":91}],382:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./helpers").hasColorscale,a=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,i){var o=i.container?n.nestedProperty(t,i.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var s=a(o),l=s.auto;(l||void 0===s.min)&&r(o,i.min),(l||void 0===s.max)&&r(o,i.max),s.autocolorscale&&r(o,"colorscale")}}for(var s=0;s=0;n--,i++){var a=t[n];r[i]=[1-a[0],a[1]]}return r}function p(t,e){e=e||{};for(var r=t.domain,o=t.range,l=o.length,u=new Array(l),c=0;c4/3-s?o:s}},{}],390:[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":502}],391:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],392:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),i=t("has-hover"),a=t("has-passive-events"),o=t("../../lib").removeElement,s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");function c(){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 f(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){var e,r,n,u,h,d,p,g,v=t.gd,m=1,y=v._context.doubleClickDelay,b=t.element;v._mouseDownTime||(v._mouseDownTime=0),b.style.pointerEvents="all",b.onmousedown=_,a?(b._ontouchstart&&b.removeEventListener("touchstart",b._ontouchstart),b._ontouchstart=_,b.addEventListener("touchstart",_,{passive:!1})):b.ontouchstart=_;var x=t.clampFn||function(t,e,r){return Math.abs(t)y&&(m=Math.max(m-1,1)),v._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(m,d),!g){var r;try{r=new MouseEvent("click",e)}catch(t){var n=f(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)}p.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},l.coverSlip=c},{"../../lib":502,"../../plots/cartesian/constants":554,"./align":389,"./cursor":390,"./unhover":393,"has-hover":246,"has-passive-events":247,"mouse-event-offset":269}],393:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/dom").getGraphDiv,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/dom":493,"../../lib/events":494,"../../lib/throttle":526,"../fx/constants":407}],394:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],395:[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=t("../../components/fx/helpers").appendArrayPointValue,m=e.exports={};m.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)},m.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},m.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},m.setRect=function(t,e,r,n,i){t.call(m.setPosition,e,r).call(m.setSize,n,i)},m.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)},m.translatePoints=function(t,e,r){t.each((function(t){var i=n.select(this);m.translatePoint(t,i,e,r)}))},m.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},m.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,i=e.yaxis;t.each((function(e){var a=e[0].trace,s=a.xcalendar,l=a.ycalendar,u=o.traceIs(a,"bar-like")?".bartext":".point,.textpoint";t.selectAll(u).each((function(t){m.hideOutsideRangePoint(t,n.select(this),r,i,s,l)}))}))}},m.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},m.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),m.dashLine(e,l,o)},m.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(m.dashLine,l,o)}))},m.dashLine=function(t,e,r){r=+r||0,e=m.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},m.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},m.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},m.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 y=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(y).forEach((function(t){var e=y[t],r=e.n;m.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),m.symbolNames[r]=t,m.symbolFuncs[r]=e.f,e.needLine&&(m.symbolNeedLines[r]=!0),e.noDot?m.symbolNoDot[r]=!0:m.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(m.symbolNoFill[r]=!0)}));var b=m.symbolNames.length;function x(t,e){var r=t%100;return m.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}m.symbolNumber=function(t){if(i(t))t=+t;else 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=m.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=b||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},M=n.format("~.1f"),A={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}};m.gradient=function(t,e,r,i,o,l){for(var c=o.length,f=A[i],h=new Array(c),d=0;d"+m(t);p._gradientUrlQueryParts[y]=1},m.initGradients=function(t){var e=t._fullLayout;u.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},m.pointStyle=function(t,e,r){if(t.size()){var i=m.makePointStyleFns(e);t.each((function(t){m.singlePointStyle(t,n.select(this),e,i,r)}))}},m.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=m.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;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",(t.isBlank?0:d)+"px");var v=a.gradient,y=t.mgt;if(y?p=!0:y=v&&v.type,Array.isArray(y)&&(y=y[0],A[y]||(y=0)),y&&"none"!==y){var b=t.mgc;b?p=!0:b=v.color;var _=r.uid;p&&(_+="-"+t.i),m.gradient(e,i,_,y,[[0,b],[1,f]],"fill")}else s.fill(e,f);d&&s.stroke(e,h)}},m.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=m.tryColorscale(r,""),e.lineScale=m.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,m.makeSelectedPointStyleFns(t)),e},m.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},m.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},m.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=m.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(m.symbolNumber(n),a)),e.mrc2=a})),a.length&&t.each((function(t){for(var e=n.select(this),r=0;r0?r:0}m.textPointStyle=function(t,e,r){if(t.size()){var i;if(e.selectedpoints){var a=m.makeSelectedTextStyleFns(e);i=a.selectedTextColorFn}var o=e.texttemplate,s=r._fullLayout;t.each((function(t){var a=n.select(this),l=o?u.extractOption(t,e,"txt","texttemplate"):u.extractOption(t,e,"tx","text");if(l||0===l){if(o){var f=e._module.formatLabels?e._module.formatLabels(t,e,s):{},h={};v(h,e,t.i);var d=e._meta||{};l=u.texttemplateString(l,f,s._d3locale,h,t,d)}var p=t.tp||e.textposition,g=E(t,e),y=i?i(t):t.tc||e.textfont.color;a.call(m.font,t.tf||e.textfont.family,g,y).text(l).call(c.convertToTspans,r).call(k,p,g,t.mrc)}else a.remove()}))}},m.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=m.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)}))}};function L(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,.25),c=Math.pow(s*s+l*l,.25),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)]]}m.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&&(m.savedBBoxes={},O=0),r&&(m.savedBBoxes[r]=v),O++,u.extendFlat({},v)},m.setClipUrl=function(t,e,r){t.attr("clip-path",P(e,r))},m.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}},m.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},m.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}},m.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.*/;m.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*$/;m.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(" "))}}))}},{"../../components/fx/helpers":409,"../../constants/alignment":475,"../../constants/interactions":479,"../../constants/xmlns_namespaces":481,"../../lib":502,"../../lib/svg_text_utils":525,"../../registry":602,"../../traces/scatter/make_bubble_size_func":648,"../../traces/scatter/subtypes":655,"../color":373,"../colorscale":385,"./symbol_defs":396,d3:82,"fast-isnumeric":91,tinycolor2:339}],396:[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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:82}],397:[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"}}}},{}],398:[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":655,"../drawing":395,d3:82,"fast-isnumeric":91}],403:[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":373,d3:82}],404:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("./layout_attributes").hoverlabel,a=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:a({},i.bgcolor,{arrayOk:!0}),bordercolor:a({},i.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:a({},i.align,{arrayOk:!0}),namelength:a({},i.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":495,"../../plots/font_attributes":576,"./layout_attributes":414}],405:[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.indexx[0]._length||tt<0||tt>w[0]._length)return h.unhoverRaw(t,e)}if(e.pointerX=$+x[0]._offset,e.pointerY=tt+w[0]._offset,z="xval"in e?g.flat(l,e.xval):g.p2c(x,$),I="yval"in e?g.flat(l,e.yval):g.p2c(w,tt),!i(z[0])||!i(I[0]))return o.warn("Fx.hover failed",e,t),h.unhoverRaw(t,e)}var rt=1/0;function nt(t,r){for(N=0;NX&&(Z.splice(0,X),rt=Z[0].distance),m&&0!==W&&0===Z.length){G.distance=W,G.index=!1;var h=j._module.hoverPoints(G,H,q,"closest",c._hoverlayer);if(h&&(h=h.filter((function(t){return t.spikeDistance<=W}))),h&&h.length){var d,p=h.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(p.length){var v=p[0];i(v.x0)&&i(v.y0)&&(d=at(v),(!J.vLinePoint||J.vLinePoint.spikeDistance>d.spikeDistance)&&(J.vLinePoint=d))}var y=h.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(y.length){var b=y[0];i(b.x0)&&i(b.y0)&&(d=at(b),(!J.hLinePoint||J.hLinePoint.spikeDistance>d.spikeDistance)&&(J.hLinePoint=d))}}}}}function it(t,e){for(var r,n=null,i=1/0,a=0;a1||Z.length>1)||"closest"===S&&K&&Z.length>1,Tt=f.combine(c.plot_bgcolor||f.background,c.paper_bgcolor),kt={hovermode:S,rotateLabels:At,bgColor:Tt,container:c._hoverlayer,outerContainer:c._paperdiv,commonLabelOpts:c.hoverlabel,hoverdistance:c.hoverdistance},Et=L(Z,kt,t);g.isUnifiedHover(S)||(!function(t,e,r){var n,i,a,o,s,l,u,c=0,f=1,h=t.size(),d=new Array(h),p=0;function g(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--)}}}t.each((function(t){var n=t[e],i="x"===n._id.charAt(0),a=n.range;0===p&&a&&a[0]>a[1]!==i&&(f=-1),d[p++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(i?_:1)/2,pmin:0,pmax:i?r.width:r.height}]})),d.sort((function(t,e){return t[0].posref-e[0].posref||f*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&c<=h;){for(c++,n=!0,o=0;o.01&&y.pmin===b.pmin&&y.pmax===b.pmax){for(s=m.length-1;s>=0;s--)m[s].dp+=i;for(v.push.apply(v,m),d.splice(o+1,1),u=0,s=v.length-1;s>=0;s--)u+=v[s].dp;for(a=u/v.length,s=v.length-1;s>=0;s--)v[s].dp-=a;n=!1}else o++}d.forEach(g)}for(o=d.length-1;o>=0;o--){var x=d[o];for(s=x.length-1;s>=0;s--){var w=x[s],M=w.datum;M.offset=w.dp,M.del=w.del}}}(Et,At?"xa":"ya",c),C(Et,At));if(e.target&&e.target.tagName){var Lt=p.getComponentMethod("annotations","hasClickToShow")(t,xt);u(n.select(e.target),Lt?"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,bt))return;bt&&t.emit("plotly_unhover",{event:e,points:bt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:x,yaxes:w,xvals:z,yvals:I})}(t,e,r,a)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var i=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,nameLength:t.nameLength,textAlign:t.textAlign,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}})),a=n.select(e.container),o=e.outerContainer?n.select(e.outerContainer):a,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||f.background,container:a,outerContainer:o},l=L(i,s,e.gd),u=0,c=0;return l.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function L(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||{},x=e.fontFamily||v.HOVERFONT,_=e.fontSize||v.HOVERFONTSIZE,w=t[0],M=w.xa,E=w.ya,L="y"===a.charAt(0)?"yLabel":"xLabel",C=w[L],O=(String(C)||"").split(" ")[0],R=d.node().getBoundingClientRect(),P=R.top,z=R.width,I=R.height,D=void 0!==C&&w.distance<=e.hoverdistance&&("x"===a||"y"===a);if(D){var N,F,j=!0;for(N=0;Ni.width-L?(m=i.width-L,s.attr("d","M"+(L-A)+",0L"+L+","+k+A+"v"+k+(2*T+b.height)+"H-"+L+"V"+k+A+"H"+(L-2*A)+"Z")):s.attr("d","M0,0L"+A+","+k+A+"H"+(T+b.width/2)+"v"+k+(2*T+b.height)+"H-"+(T+b.width/2)+"V"+k+A+"H-"+A+"Z")}else{var S,O,R;"right"===E.side?(S="start",O=1,R="",m=M._offset+M._length):(S="end",O=-1,R="-",m=M._offset),y=E._offset+(w.y0+w.y1)/2,u.attr("text-anchor",S),s.attr("d","M0,0L"+R+A+","+A+"V"+(T+b.height/2)+"h"+R+(2*T+b.width)+"V-"+(T+b.height/2)+"H"+R+A+"V-"+A+"Z");var z,I=b.height/2,D=P-b.top-I,N="clip"+i._uid+"commonlabel"+E._id;if(m=0?$-=rt:$+=2*T;var nt=et.height+2*T,it=K+nt>=I;return nt<=I&&(K<=P?K=E._offset+2*T:it&&(K=I-nt)),tt.attr("transform","translate("+$+","+K+")"),tt}var at=h.selectAll("g.hovertext").data(t,(function(t){return k(t)}));return at.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(f.fill,f.addOpacity(u,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(c.font,x,_)})),at.exit().remove(),at.each((function(t){var e=n.select(this).attr("transform",""),o=t.bgcolor||t.color,h=f.combine(f.opacity(o)?o:f.defaultLine,u),d=f.combine(f.opacity(t.color)?t.color:f.defaultLine,u),p=t.borderColor||f.contrast(h),g=S(t,D,a,i,C,e),v=g[0],m=g[1],y=e.select("text.nums").call(c.font,t.fontFamily||x,t.fontSize||_,t.fontColor||p).text(v).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),w=e.select("text.name"),M=0,k=0;if(m&&m!==v){w.call(c.font,t.fontFamily||x,t.fontSize||_,d).text(m).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r);var E=w.node().getBoundingClientRect();M=E.width+2*T,k=E.height+2*T}else w.remove(),e.select("rect").remove();e.select("path").style({fill:h,stroke:p});var L,O,R=y.node().getBoundingClientRect(),N=t.xa._offset+(t.x0+t.x1)/2,F=t.ya._offset+(t.y0+t.y1)/2,j=Math.abs(t.x1-t.x0),B=Math.abs(t.y1-t.y0),U=R.width+A+T+M;if(t.ty0=P-R.top,t.bx=R.width+2*T,t.by=Math.max(R.height+2*T,k),t.anchor="start",t.txwidth=R.width,t.tx2width=M,t.offset=0,s)t.pos=N,L=F+B/2+U<=I,O=F-B/2-U>=0,"top"!==t.idealAlign&&L||!O?L?(F+=B/2,t.anchor="start"):t.anchor="middle":(F-=B/2,t.anchor="end");else if(t.pos=F,L=N+j/2+U<=z,O=N-j/2-U>=0,"left"!==t.idealAlign&&L||!O)if(L)N+=j/2,t.anchor="start";else{t.anchor="middle";var V=U/2,H=N+V-z,q=N-V;H>0&&(N-=H),q<0&&(N+=-q)}else N-=j/2,t.anchor="end";y.attr("text-anchor",t.anchor),M&&w.attr("text-anchor",t.anchor),e.attr("transform","translate("+N+","+F+")"+(s?"rotate("+b+")":""))})),at}function S(t,e,r,n,i,a){var s="",l="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),s=z(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(l+=(l?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===i?l=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(l+=(l?"
":"")+t.text),void 0!==t.extraText&&(l+=(l?"
":"")+t.extraText),a&&""===l&&!t.hovertemplate&&(""===s&&a.remove(),l=s);var u=n._d3locale,c=t.hovertemplate||!1,f=t.hovertemplateLabels||t,h=t.eventData[0]||{};return c&&(l=(l=o.hovertemplateString(c,f,u,h,t.trace._meta)).replace(E,(function(e,r){return s=z(r,t.nameLength),""}))),[l,s]}function C(t,e){t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var i=r.select("text.nums"),a=t.anchor,o="end"===a?-1:1,s={start:1,end:-1,middle:0}[a],u=s*(A+T),f=u+s*(t.txwidth+T),h=0,d=t.offset;"middle"===a&&(u-=t.tx2width/2,f+=t.txwidth/2+T),e&&(d*=-M,h=t.offset*w),r.select("path").attr("d","middle"===a?"M-"+(t.bx/2+t.tx2width/2)+","+(d-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(o*A+h)+","+(A+d)+"v"+(t.by/2-A)+"h"+o*t.bx+"v-"+t.by+"H"+(o*A+h)+"V"+(d-A)+"Z");var p=u+h,g=d+t.ty0-t.by/2+T,v=t.textAlign||"auto";"auto"!==v&&("left"===v&&"start"!==a?(i.attr("text-anchor","start"),p="middle"===a?-t.bx/2-t.tx2width/2+T:-t.bx-T):"right"===v&&"end"!==a&&(i.attr("text-anchor","end"),p="middle"===a?t.bx/2-t.tx2width/2-T:t.bx+T)),i.call(l.positionText,p,g),t.tx2width&&(r.select("text.name").call(l.positionText,f+s*T+h,d+t.ty0-t.by/2+T),r.select("rect").call(c.setRect,f+(s-1)*t.tx2width/2+h,d-t.by/2-1,t.tx2width,t.by+2))}))}function O(t,e){var r=t.index,n=t.trace||{},a=t.cd[0],s=t.cd[r]||{};function l(t){return t||i(t)&&0===t}var u=Array.isArray(r)?function(t,e){var i=o.castOption(a,r,t);return l(i)?i:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(s,n,t,e)};function c(e,r,n){var i=u(r,n);l(i)&&(t[e]=i)}if(c("hoverinfo","hi","hoverinfo"),c("bgcolor","hbg","hoverlabel.bgcolor"),c("borderColor","hbc","hoverlabel.bordercolor"),c("fontFamily","htf","hoverlabel.font.family"),c("fontSize","hts","hoverlabel.font.size"),c("fontColor","htc","hoverlabel.font.color"),c("nameLength","hnl","hoverlabel.namelength"),c("textAlign","hta","hoverlabel.align"),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 f=d.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+f+" / -"+d.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+f,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var h=d.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+h+" / -"+d.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+h,"y"===e&&(t.distance+=1)}var p=t.hoverinfo||t.trace.hoverinfo;return p&&"all"!==p&&(-1===(p=Array.isArray(p)?p:p.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===p.indexOf("y")&&(t.yLabel=void 0),-1===p.indexOf("z")&&(t.zLabel=void 0),-1===p.indexOf("text")&&(t.text=void 0),-1===p.indexOf("name")&&(t.name=void 0)),t}function R(t,e,r){var n,i,o=r.container,s=r.fullLayout,l=s._size,u=r.event,h=!!e.hLinePoint,p=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),p||h){var g=f.combine(s.plot_bgcolor,s.paper_bgcolor);if(h){var v,m,y=e.hLinePoint;n=y&&y.xa,"cursor"===(i=y&&y.ya).spikesnap?(v=u.pointerX,m=u.pointerY):(v=n._offset+y.x,m=i._offset+y.y);var b,x,_=a.readability(y.color,g)<1.5?f.contrast(g):y.color,w=i.spikemode,M=i.spikethickness,A=i.spikecolor||_,T=d.getPxPosition(t,i);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(b=T,x=v),-1!==w.indexOf("across")){var k=i._counterDomainMin,E=i._counterDomainMax;"free"===i.anchor&&(k=Math.min(k,i.position),E=Math.max(E,i.position)),b=l.l+k*l.w,x=l.l+E*l.w}o.insert("line",":first-child").attr({x1:b,x2:x,y1:m,y2:m,"stroke-width":M,stroke:A,"stroke-dasharray":c.dashStyle(i.spikedash,M)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:b,x2:x,y1:m,y2:m,"stroke-width":M+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:T+("right"!==i.side?M:-M),cy:m,r:M,fill:A}).classed("spikeline",!0)}if(p){var L,S,C=e.vLinePoint;n=C&&C.xa,i=C&&C.ya,"cursor"===n.spikesnap?(L=u.pointerX,S=u.pointerY):(L=n._offset+C.x,S=i._offset+C.y);var O,R,P=a.readability(C.color,g)<1.5?f.contrast(g):C.color,z=n.spikemode,I=n.spikethickness,D=n.spikecolor||P,N=d.getPxPosition(t,n);if(-1!==z.indexOf("toaxis")||-1!==z.indexOf("across")){if(-1!==z.indexOf("toaxis")&&(O=N,R=S),-1!==z.indexOf("across")){var F=n._counterDomainMin,j=n._counterDomainMax;"free"===n.anchor&&(F=Math.min(F,n.position),j=Math.max(j,n.position)),O=l.t+(1-j)*l.h,R=l.t+(1-F)*l.h}o.insert("line",":first-child").attr({x1:L,x2:L,y1:O,y2:R,"stroke-width":I,stroke:D,"stroke-dasharray":c.dashStyle(n.spikedash,I)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:L,x2:L,y1:O,y2:R,"stroke-width":I+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==z.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:L,cy:N-("top"!==n.side?I:-I),r:I,fill:D}).classed("spikeline",!0)}}}function P(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function z(t,e){return l.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":502,"../../lib/events":494,"../../lib/override_cursor":513,"../../lib/svg_text_utils":525,"../../plots/cartesian/axes":548,"../../registry":602,"../color":373,"../dragelement":392,"../drawing":395,"../legend/defaults":425,"../legend/draw":426,"./constants":407,"./helpers":409,d3:82,"fast-isnumeric":91,tinycolor2:339}],411:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function s(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&a(e.hovermode)&&(o.font||(o.font={}),s("size"),s("family"),s("color"),e.legend?(o.bgcolor||(o.bgcolor=i.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":502,"../color":373,"./helpers":409}],412:[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 void 0!==e[r]?e[r]:n.coerce(t,e,i,r,a)}var o,s=a("clickmode");return e._has("cartesian")?s.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!h&&!d&&!p)"independent"===A("pattern")&&(h=!0);v._hasSubplotGrid=h;var b,x,_="top to bottom"===A("roworder"),w=h?.2:.1,M=h?.3:.1;g&&e._splomGridDflt&&(b=e._splomGridDflt.xside,x=e._splomGridDflt.yside),v._domains={x:c("x",A,w,b,y),y:c("y",A,M,x,m,_)}}else delete e.grid}function A(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!==g||u.uirevision){var v=a.newContainer(e,"legend");if(_("uirevision",e.uirevision),!1!==g){_("bgcolor",e.paper_bgcolor),_("bordercolor"),_("borderwidth"),i.coerceFont(_,"font",e.font);var m,y,b,x=_("orientation");"h"===x?(m=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(y=1.1,b="bottom"):(y=-.1,b="top")):(m=1.02,y=1,b="auto"),_("traceorder",h),l.isGrouped(e.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",b),_("valign"),i.noneOrAll(u,v,["x","y"]),_("title.text")&&(_("title.side","h"===x?"left":"top"),i.coerceFont(_,"title.font",e.font))}}function _(t,e){return i.coerce(u,v,o,t,e)}}},{"../../lib":502,"../../plot_api/plot_template":538,"../../plots/layout_attributes":591,"../../registry":602,"./attributes":423,"./helpers":429}],426:[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/alignment"),g=p.LINE_SPACING,v=p.FROM_TL,m=p.FROM_BR,y=t("./get_legend_data"),b=t("./style"),x=t("./helpers");function _(t,e,r,n,i){var a=r.data()[0][0].trace,l={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&&(l.group=a._group),o.traceIs(a,"pie-like")&&(l.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",l))if(1===n)e._clickTimeout=setTimeout((function(){h(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",l)&&h(r,t,n)}}function w(t,e,r){var n,a=t.data()[0][0],s=a.trace,l=o.traceIs(s,"pie-like"),c=s.index,h=r._main&&e._context.edits.legendText&&!l,p=r._maxNameLength;r.entries?n=a.text:(n=l?a.label:s.name,s._meta&&(n=i.templateString(n,s._meta)));var g=i.ensureSingle(t,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(u.font,r.font).text(h?M(n,p):n),f.positionText(g,d.textGap,0),h?g.call(f.makeEditable,{gd:e,text:n}).call(T,t,e,r).on("edit",(function(n){this.text(M(n,p)).call(T,t,e,r);var s=a.trace._fullInput||{},l={};if(o.hasTransform(s,"groupby")){var u=o.getTransformIndices(s,"groupby"),f=u[u.length-1],h=i.keyedContainer(s,"transforms["+f+"].styles","target","value.name");h.set(a.trace._group,n),l=h.constructUpdate()}else l.name=n;return o.call("_guiRestyle",e,l,c)})):T(g,t,e,r)}function M(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 A(t,e){var r,a=e._context.doubleClickDelay,o=1,s=i.ensureSingle(t,"rect","legendtoggle",(function(t){t.style("cursor","pointer").attr("pointer-events","all").call(c.fill,"rgba(0,0,0,0)")}));s.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimea&&(o=Math.max(o-1,1)),_(e,r,t,o,n.event)}}))}function T(t,e,r,n){n._main||t.attr("data-notex",!0),f.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var i=t.select("g[class*=math-group]"),a=i.node();r||(r=e._fullLayout.legend);var o,s,l=r.borderwidth,c=(n?r:r.title).font.size*g;if(a){var h=u.bBox(a);o=h.height,s=h.width,n?u.setTranslate(i,0,.25*o):u.setTranslate(i,l,.75*o+l)}else{var p=t.select(n?".legendtext":".legendtitletext"),v=f.lineCount(p),m=p.node();o=c*v,s=m?u.bBox(m).width:0;var y=c*((v-1)/2-.3);n?f.positionText(p,d.textGap,-y):f.positionText(p,d.titlePad+l,c+l)}n?(n.lineHeight=c,n.height=Math.max(o,16)+3,n.width=s):(r._titleWidth=s,r._titleHeight=o)}(e,r,n)}))}function k(t){return i.isRightAnchor(t)?"right":i.isCenterAnchor(t)?"center":"left"}function E(t){return i.isBottomAnchor(t)?"bottom":i.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,s=t._fullLayout,f="legend"+s._uid;if(e?(r=e.layer,f+="-hover"):((e=s.legend||{})._main=!0,r=s._infolayer),r){var h;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;h=s.showlegend&&y(t.calcdata,e)}else{if(!e.entries)return;h=y(e.entries,e)}var p=s.hiddenlabels||[];if(e._main&&(!s.showlegend||!h.length))return r.selectAll(".legend").remove(),s._topdefs.select("#"+f).remove(),a.autoMargin(t,"legend");var g=i.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),M=i.ensureSingleById(s._topdefs,"clipPath",f,(function(t){t.append("rect")})),L=i.ensureSingle(g,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));L.call(c.stroke,e.bordercolor).call(c.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var S=i.ensureSingle(g,"g","scrollbox"),C=e.title;if(e._titleWidth=0,e._titleHeight=0,C.text){var O=i.ensureSingle(S,"text","legendtitletext");O.attr("text-anchor","start").classed("user-select-none",!0).call(u.font,C.font).text(C.text),T(O,S,t,e)}else S.selectAll(".legendtitletext").remove();var R=i.ensureSingle(g,"rect","scrollbar",(function(t){t.attr(d.scrollBarEnterAttrs).call(c.fill,d.scrollBarColor)})),P=S.selectAll("g.groups").data(h);P.enter().append("g").attr("class","groups"),P.exit().remove();var z=P.selectAll("g.traces").data(i.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==p.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(b,t,e).each((function(){e._main&&n.select(this).call(A,t)})),i.syncOrAsync([a.previousPromises,function(){return function(t,e,r,i){var a=t._fullLayout;i||(i=a.legend);var o=a._size,s=x.isVertical(i),l=x.isGrouped(i),c=i.borderwidth,f=2*c,h=d.textGap,p=d.itemGap,g=2*(c+p),v=E(i),m=i.y<0||0===i.y&&"top"===v,y=i.y>1||1===i.y&&"bottom"===v;i._maxHeight=Math.max(m||y?a.height/2:o.h,30);var b=0;i._width=0,i._height=0;var _=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(i);if(s)r.each((function(t){var e=t[0].height;u.setTranslate(this,c+_[0],c+_[1]+i._height+e/2+p),i._height+=e,i._width=Math.max(i._width,t[0].width)})),b=h+i._width,i._width+=p+h+f,i._height+=g,l&&(e.each((function(t,e){u.setTranslate(this,0,e*i.tracegroupgap)})),i._height+=(i._lgroupsLength-1)*i.tracegroupgap);else{var w=k(i),M=i.x<0||0===i.x&&"right"===w,A=i.x>1||1===i.x&&"left"===w,T=y||m,L=a.width/2;i._maxWidth=Math.max(M?T&&"left"===w?o.l+o.w:L:A?T&&"right"===w?o.r+o.w:L:o.w,2*h);var S=0,C=0;r.each((function(t){var e=t[0].width+h;S=Math.max(S,e),C+=e})),b=null;var O=0;if(l){var R=0,P=0,z=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;u.setTranslate(this,_[0],_[1]+c+p+n/2+e),e+=n,t=Math.max(t,h+r[0].width)})),R=Math.max(R,e);var r=t+p;r+c+P>i._maxWidth&&(O=Math.max(O,P),P=0,z+=R+i.tracegroupgap,R=e),u.setTranslate(this,P,z),P+=r})),i._width=Math.max(O,P)+c,i._height=z+R+g}else{var I=r.size(),D=C+f+(I-1)*pi._maxWidth&&(O=Math.max(O,B),F=0,j+=N,i._height+=N,N=0),u.setTranslate(this,_[0]+c+F,_[1]+c+j+e/2+p),B=F+r+p,F+=n,N=Math.max(N,e)})),D?(i._width=F+f,i._height=N+g):(i._width=Math.max(O,B)+f,i._height+=N+g)}}i._width=Math.ceil(Math.max(i._width+_[0],i._titleWidth+2*(c+d.titlePad))),i._height=Math.ceil(Math.max(i._height+_[1],i._titleHeight+2*(c+d.itemGap))),i._effHeight=Math.min(i._height,i._maxHeight);var U=t._context.edits,V=U.legendText||U.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,i=V?h:b||h+t[0].width;s||(i+=p/2),u.setRect(e,0,-r/2,i,r)}))}(t,P,z,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=k(e),n=E(e);return a.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*v[r],r:e._width*m[r],b:e._effHeight*m[n],t:e._effHeight*v[n]})}(t)){var c,h,p,y,b=s._size,x=e.borderwidth,w=b.l+b.w*e.x-v[k(e)]*e._width,A=b.t+b.h*(1-e.y)-v[E(e)]*e._effHeight;if(e._main&&s.margin.autoexpand){var T=w,C=A;w=i.constrain(w,0,s.width-e._width),A=i.constrain(A,0,s.height-e._effHeight),w!==T&&i.log("Constrain legend.x to make legend fit inside graph"),A!==C&&i.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&u.setTranslate(g,w,A),R.on(".drag",null),g.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var O=e._effHeight;e._main||(O=e._height),L.attr({width:e._width-x,height:O-x,x:x/2,y:x/2}),u.setTranslate(S,0,0),M.select("rect").attr({width:e._width-2*x,height:O-2*x,x:x,y:x}),u.setClipUrl(S,f,t),u.setRect(R,0,0,0,0),delete e._scrollY}else{var P,z,I,D=Math.max(d.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),N=e._effHeight-D-2*d.scrollBarMargin,F=e._height-e._effHeight,j=N/F,B=Math.min(e._scrollY||0,F);L.attr({width:e._width-2*x+d.scrollBarWidth+d.scrollBarMargin,height:e._effHeight-x,x:x/2,y:x/2}),M.select("rect").attr({width:e._width-2*x+d.scrollBarWidth+d.scrollBarMargin,height:e._effHeight-2*x,x:x,y:x+B}),u.setClipUrl(S,f,t),H(B,D,j),g.on("wheel",(function(){H(B=i.constrain(e._scrollY+n.event.deltaY/N*F,0,F),D,j),0!==B&&B!==F&&n.event.preventDefault()}));var U=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;P="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,I=B})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(z="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,H(B=function(t,e,r){var n=(r-e)/j+t;return i.constrain(n,0,F)}(I,P,z),D,j))}));R.call(U);var V=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(P=t.changedTouches[0].clientY,I=B)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(z=t.changedTouches[0].clientY,H(B=function(t,e,r){var n=(e-r)/j+t;return i.constrain(n,0,F)}(I,P,z),D,j))}));S.call(V)}if(t._context.edits.legendPosition)g.classed("cursor-move",!0),l.init({element:g.node(),gd:t,prepFn:function(){var t=u.getTranslate(g);p=t.x,y=t.y},moveFn:function(t,r){var n=p+t,i=y+r;u.setTranslate(g,n,i),c=l.align(n,0,b.l,b.l+b.w,e.xanchor),h=l.align(i,0,b.t+b.h,b.t,e.yanchor)},doneFn:function(){void 0!==c&&void 0!==h&&o.call("_guiRelayout",t,{"legend.x":c,"legend.y":h})},clickFn:function(e,n){var i=r.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&&_(t,g,i,e,n)}})}function H(r,n,i){e._scrollY=t._fullLayout.legend._scrollY=r,u.setTranslate(S,0,-r),u.setRect(R,e._width,d.scrollBarMargin+r*i,d.scrollBarWidth,n),M.select("rect").attr("y",x+r)}}],t)}}},{"../../constants/alignment":475,"../../lib":502,"../../lib/events":494,"../../lib/svg_text_utils":525,"../../plots/plots":593,"../../registry":602,"../color":373,"../dragelement":392,"../drawing":395,"./constants":424,"./get_legend_data":427,"./handle_click":428,"./helpers":429,"./style":431,d3:82}],427:[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,f=0,h=e._main;function d(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;r0))return 0;i=e.width}return p?n:Math.min(i,r)};function v(t,e,r){var a=t[0].trace,o=a.marker||{},l=o.line||{},u=r?a.visible&&a.type===r:i.traceIs(a,"bar"),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(u?[t]:[]);c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.each((function(t){var e=n.select(this),r=t[0],i=g(r.mlw,o.line,5,2);e.style("stroke-width",i+"px").call(s.fill,r.mc||o.color),i&&s.stroke(e,r.mlc||l.color)}))}function m(t,e,r){var o=t[0],s=o.trace,l=r?s.visible&&s.type===r:i.traceIs(s,r),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(l?[t]:[]);if(u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.size()){var h=(s.marker||{}).line,d=g(f(h.width,o.pts),h,5,2),p=a.minExtend(s,{marker:{line:{width:d}}});p.marker.line.color=h.color;var v=a.minExtend(o,{trace:p});c(u,v,p)}}t.each((function(t){var e=n.select(this),i=a.ensureSingle(e,"g","layers");i.style("opacity",t[0].trace.opacity);var o=r.valign,s=t[0].lineHeight,l=t[0].height;if("middle"!==o&&s&&l){var u={top:1,bottom:-1}[o]*(.5*(s-l+3));i.attr("transform","translate(0,"+u+")")}else i.attr("transform",null);i.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),i.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var c=i.selectAll("g.legendsymbols").data([t]);c.enter().append("g").classed("legendsymbols",!0),c.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,i=t[0].trace,u=[];if(i.visible)switch(i.type){case"histogram2d":case"heatmap":u=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":u=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":u=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":u=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":u=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":u=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var c=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(u);c.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),c.exit().remove(),c.each((function(t,u){var c,f=n.select(this),d=l(i),p=d.colorscale,g=d.reversescale;if(p){if(!r){var v=p.length;c=0===u?p[g?v-1:0][1]:1===u?p[g?0:v-1][1]:p[Math.floor((v-1)/2)][1]}}else{var m=i.vertexcolor||i.facecolor||i.color;c=a.isArrayOrTypedArray(m)?m[u]||m[0]:m}f.attr("d",t[0]),c?f.call(s.fill,c):f.call((function(t){if(t.size()){var n="legendfill-"+i.uid;o.gradient(t,e,n,h(g,"radial"===r),p,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var i=t[0].trace[t[0].dir].marker;return t[0].mc=i.color,t[0].mlw=i.line.width,t[0].mlc=i.line.color,v(t,this,"waterfall")}var a=[];e.visible&&r&&(a=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(a);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),i=e[t[0]].marker,a=g(void 0,i.line,5,2);r.attr("d",t[1]).style("stroke-width",a+"px").call(s.fill,i.color),a&&r.call(s.stroke,i.line.color)}))})).each((function(t){v(t,this,"funnel")})).each((function(t){v(t,this)})).each((function(t){var r=t[0].trace,l=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&i.traceIs(r,"box-violin")?[t]:[]);l.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),l.exit().remove(),l.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==s.opacity(r.fillcolor)||0!==s.opacity((r.line||{}).color)){var i=g(void 0,r.line,5,2);t.style("stroke-width",i+"px").call(s.fill,r.fillcolor),i&&s.stroke(t,r.line.color)}else{var u=a.minExtend(r,{marker:{size:p?12:a.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});l.call(o.pointStyle,u,e)}}))})).each((function(t){m(t,this,"funnelarea")})).each((function(t){m(t,this,"pie")})).each((function(t){var r,i,s=t[0],c=s.trace,f=c.visible&&c.fill&&"none"!==c.fill,d=u.hasLines(c),p=c.contours,v=!1,m=!1,y=l(c),b=y.colorscale,x=y.reversescale;if(p){var _=p.coloring;"lines"===_?v=!0:d="none"===_||"heatmap"===_||p.showlines,"constraint"===p.type?f="="!==p._operation:"fill"!==_&&"heatmap"!==_||(m=!0)}var w=u.hasMarkers(c)||u.hasText(c),M=f||m,A=d||v,T=w||!M?"M5,0":A?"M5,-2":"M5,-3",k=n.select(this),E=k.select(".legendfill").selectAll("path").data(f||m?[t]:[]);if(E.enter().append("path").classed("js-fill",!0),E.exit().remove(),E.attr("d",T+"h30v6h-30z").call(f?o.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+c.uid;o.gradient(t,e,r,h(x),b,"fill")}}),d||v){var L=g(void 0,c.line,10,5);i=a.minExtend(c,{line:{width:L}}),r=[a.minExtend(s,{trace:i})]}var S=k.select(".legendlines").selectAll("path").data(d||v?[r]:[]);S.enter().append("path").classed("js-line",!0),S.exit().remove(),S.attr("d",T+(v?"l30,0.0001":"h30")).call(d?o.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+c.uid;o.lineGroupStyle(t),o.gradient(t,e,r,h(x),b,"stroke")}})})).each((function(t){var r,i,s=t[0],l=s.trace,c=u.hasMarkers(l),f=u.hasText(l),h=u.hasLines(l);function d(t,e,r,n){var i=a.nestedProperty(l,t).get(),o=a.isArrayOrTypedArray(i)&&e?e(i):i;if(p&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(t){return s._distinct&&s.index&&t[s.index]?t[s.index]:t[0]}if(c||f||h){var v={},m={};if(c){v.mc=d("marker.color",g),v.mx=d("marker.symbol",g),v.mo=d("marker.opacity",a.mean,[.2,1]),v.mlc=d("marker.line.color",g),v.mlw=d("marker.line.width",a.mean,[0,5],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=d("marker.size",a.mean,[2,16],12);v.ms=y,m.marker.size=y}h&&(m.line={width:d("line.width",g,[0,10],5)}),f&&(v.tx="Aa",v.tp=d("textposition",g),v.ts=10,v.tc=d("textfont.color",g),v.tf=d("textfont.family",g)),r=[a.minExtend(s,v)],(i=a.minExtend(l,m)).selectedpoints=null,i.texttemplate=null}var b=n.select(this).select("g.legendpoints"),x=b.selectAll("path.scatterpts").data(c?r:[]);x.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),x.exit().remove(),x.call(o.pointStyle,i,e),c&&(r[0].mrc=3);var _=b.selectAll("g.pointtext").data(f?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.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(e.visible&&"candlestick"===e.type?[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=n.select(this),a=e[r?"increasing":"decreasing"],o=g(void 0,a.line,5,2);i.style("stroke-width",o+"px").call(s.fill,a.fillcolor),o&&s.stroke(i,a.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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=n.select(this),a=e[r?"increasing":"decreasing"],l=g(void 0,a.line,5,2);i.style("fill","none").call(o.dashLine,a.line.dash,l),l&&s.stroke(i,a.line.color)}))}))}},{"../../lib":502,"../../registry":602,"../../traces/pie/helpers":628,"../../traces/pie/style_one":629,"../../traces/scatter/subtypes":655,"../color":373,"../colorscale/helpers":384,"../drawing":395,d3:82}],432:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/plots"),a=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),s=t("../shapes/draw").eraseActiveShape,l=t("../../lib"),u=l._,c=e.exports={};function f(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=u._cartesianSpikesEnabled;if("zoom"===s){var d,p="in"===l?.5:2,g=(1+p)/2,v=(1-p)/2;for(i=0;i1?(L=["toggleHover"],S=["resetViews"]):p?(E=["zoomInGeo","zoomOutGeo"],L=["hoverClosestGeo"],S=["resetGeo"]):d?(L=["hoverClosest3d"],S=["resetCameraDefault3d","resetCameraLastSave3d"]):b?(E=["zoomInMapbox","zoomOutMapbox"],L=["toggleHover"],S=["resetViewMapbox"]):m?L=["hoverClosestGl2d"]:g?L=["hoverClosestPie"]:_?(L=["hoverClosestCartesian","hoverCompareCartesian"],S=["resetViewSankey"]):L=["toggleHover"];h&&(L=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var g=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),i=0,a=0;a=n.max)e=D[r+1];else if(t=n.pmax)e=D[r+1];else if(t0?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;oy?(A=f,L="y0",T=y,S="y1"):(A=y,L="y1",T=f,S="y0");Y(n),Q(s,r),function(t,e,r){var n=e.xref,i=e.yref,o=a.getFromId(r,n),s=a.getFromId(r,i),l="";"paper"===n||o.autorange||(l+=n);"paper"===i||s.autorange||(l+=i);c.setClipUrl(t,l?"clip"+r._fullLayout._uid+l:null,r)}(e,r,t),X.moveFn="move"===P?W:Z,X.altKey=n.altKey},doneFn:function(){if(m(t))return;d(e),J(s),x(e,t,r),n.call("_guiRelayout",t,l.getUpdateObj())},clickFn:function(){if(m(t))return;J(s)}};function Y(r){if(m(t))P=null;else if(D)P="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=X.element.getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top,o=r.clientX-n.left,s=r.clientY-n.top,l=!N&&i>10&&a>10&&!r.shiftKey?h.getCursor(o/i,1-s/a):"move";d(e,l),P=l.split("-")[0]}}function W(n,i){if("path"===r.type){var a=function(t){return t},o=a,l=a;z?F("xanchor",r.xanchor=H(b+n)):(o=function(t){return H(U(t)+n)},j&&"date"===j.type&&(o=g.encodeDate(o))),I?F("yanchor",r.yanchor=q(M+i)):(l=function(t){return q(V(t)+i)},B&&"date"===B.type&&(l=g.encodeDate(l))),F("path",r.path=w(R,o,l))}else z?F("xanchor",r.xanchor=H(b+n)):(F("x0",r.x0=H(u+n)),F("x1",r.x1=H(v+n))),I?F("yanchor",r.yanchor=q(M+i)):(F("y0",r.y0=q(f+i)),F("y1",r.y1=q(y+i)));e.attr("d",_(t,r)),Q(s,r)}function Z(n,i){if(N){var a=function(t){return t},o=a,l=a;z?F("xanchor",r.xanchor=H(b+n)):(o=function(t){return H(U(t)+n)},j&&"date"===j.type&&(o=g.encodeDate(o))),I?F("yanchor",r.yanchor=q(M+i)):(l=function(t){return q(V(t)+i)},B&&"date"===B.type&&(l=g.encodeDate(l))),F("path",r.path=w(R,o,l))}else if(D){if("resize-over-start-point"===P){var c=u+n,h=I?f-i:f+i;F("x0",r.x0=z?c:H(c)),F("y0",r.y0=I?h:q(h))}else if("resize-over-end-point"===P){var d=v+n,p=I?y-i:y+i;F("x1",r.x1=z?d:H(d)),F("y1",r.y1=I?p:q(p))}}else{var m=function(t){return-1!==P.indexOf(t)},x=m("n"),G=m("s"),X=m("w"),Y=m("e"),W=x?A+i:A,Z=G?T+i:T,J=X?k+n:k,K=Y?E+n:E;I&&(x&&(W=A-i),G&&(Z=T-i)),(!I&&Z-W>10||I&&W-Z>10)&&(F(L,r[L]=I?W:q(W)),F(S,r[S]=I?Z:q(Z))),K-J>10&&(F(C,r[C]=z?J:H(J)),F(O,r[O]=z?K:H(K)))}e.attr("d",_(t,r)),Q(s,r)}function Q(t,e){(z||I)&&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=U(z?e.xanchor:i.midRange(r?[e.x0,e.x1]:g.extractPathCoords(e.path,p.paramIsX))),o=V(I?e.yanchor:i.midRange(r?[e.y0,e.y1]:g.extractPathCoords(e.path,p.paramIsY)));if(a=g.roundPositionForSharpStrokeRendering(a,1),o=g.roundPositionForSharpStrokeRendering(o,1),z&&I){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(z){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 J(t){t.selectAll(".visual-cue").remove()}h.init(X),G.node().onmousemove=Y}(t,z,l,e,r,P):!0===l.editable&&z.style("pointer-events",O||u.opacity(E)*k<=.5?"stroke":"all");z.node().addEventListener("click",(function(){return function(t,e){if(!y(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void M(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=M,v(t)}}(t,z)}))}}function x(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"");c.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function _(t,e){var r,n,o,s,l,u,c,f,h=e.type,d=a.getFromId(t,e.xref),v=a.getFromId(t,e.yref),m=t._fullLayout._size;if(d?(r=g.shapePositionToRange(d),n=function(t){return d._offset+d.r2p(r(t,!0))}):n=function(t){return m.l+m.w*t},v?(o=g.shapePositionToRange(v),s=function(t){return v._offset+v.r2p(o(t,!0))}):s=function(t){return m.t+m.h*(1-t)},"path"===h)return d&&"date"===d.type&&(n=g.decodeDate(n)),v&&"date"===v.type&&(s=g.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(p.segmentRE,(function(t){var n=0,u=t.charAt(0),c=p.paramIsX[u],f=p.paramIsY[u],h=p.numParams[u],d=t.substr(1).replace(p.paramRE,(function(t){return c[n]?t="pixel"===a?e(s)+Number(t):e(t):f[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>h&&(t="X"),t}));return n>h&&(d=d.replace(/[\s,]*X.*/,""),i.log("Ignoring extra params in segment "+t)),u+d}))}(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,f=b-e.y1}else c=s(e.y0),f=s(e.y1);if("line"===h)return"M"+l+","+c+"L"+u+","+f;if("rect"===h)return"M"+l+","+c+"H"+u+"V"+f+"H"+l+"Z";var x=(l+u)/2,_=(c+f)/2,w=Math.abs(x-l),M=Math.abs(_-c),A="A"+w+","+M,T=x+w+","+_;return"M"+T+A+" 0 1,1 "+(x+","+(_-M))+A+" 0 0,1 "+T+"Z"}function w(t,e,r){return t.replace(p.segmentRE,(function(t){var n=0,i=t.charAt(0),a=p.paramIsX[i],o=p.paramIsY[i],s=p.numParams[i];return i+t.substr(1).replace(p.paramRE,(function(t){return n>=s||(a[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function M(t){y(t)&&(t._fullLayout._activeShapeIndex>=0&&(l(t),delete t._fullLayout._activeShapeIndex,v(t)))}e.exports={draw:v,drawOne:b,eraseActiveShape:function(t){if(!y(t))return;l(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&f(m),r.attr("d",g(e)),T&&!h)&&(A=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===M&&(t[0][0]="M"),e[w]=t,y(),b())}}()}}function R(t,r){!function(t,r){if(e.length)for(var n=0;n0&&l0&&(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(A,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||f<0){var v={left:[-d,0],right:[d,0],top:[0,-d],bottom:[0,d]}[b.side];e.attr("transform","translate("+v+")")}}}return z.call(I),R&&(E?z.on(".opacity",null):(A=0,T=!0,z.text(m).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)}))),z.call(c.makeEditable,{gd:t}).on("edit",(function(e){void 0!==y?o.call("_guiRestyle",t,v,e,y):o.call("_guiRelayout",t,v,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(I)})).on("input",(function(t){this.text(t||" ").call(c.positionText,x.x,x.y)}))),z.classed("js-placeholder",T),w}}},{"../../constants/alignment":475,"../../constants/interactions":479,"../../lib":502,"../../lib/svg_text_utils":525,"../../plots/plots":593,"../../registry":602,"../color":373,"../drawing":395,d3:82,"fast-isnumeric":91}],469:[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"}]},args2:{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":495,"../../plot_api/edit_types":531,"../../plot_api/plot_template":538,"../../plots/font_attributes":576,"../../plots/pad_attributes":592,"../color/attributes":372}],470:[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"}}},{}],471:[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("args2"),r("label"),r("execute"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":502,"../../plots/array_container_defaults":544,"./attributes":469,"./constants":470}],472:[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(M,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},A={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||(s.execute&&(s.args2&&o.active===l?(g(t,o,0,e,r,a,-1),i.executeAPICommand(t,s.method,s.args2)):(g(t,o,0,e,r,a,l),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(M,o),c.call(_,o)}))})),c.call(_,o),b?(A.w=Math.max(m.openWidth,m.headerWidth),A.h=x.y-A.t):(A.w=x.x-A.l,A.h=Math.max(m.openHeight,m.headerHeight)),A.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(A?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,s.barColor),A?(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>M,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=M-R):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var D=this.id,N=c-.5,F=C?f+O+.5:f+.5,j=h-.5,B=A?d+k+.5:d+.5,U=o._topdefs.selectAll("#"+D).data(A||C?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",D).append("rect"),A||C?(this._clipRect=U.select("rect").attr({x:Math.floor(N),y:Math.floor(j),width:Math.ceil(F)-Math.floor(N),height:Math.ceil(B)-Math.floor(j)}),this.container.call(a.setClipUrl,D,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),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":502,"../color":373,"../drawing":395,d3:82}],475:[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"}}},{}],476:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],477:[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]}},{}],478:[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"}},{}],479:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],480:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],481:[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}},{}],482:[function(t,e,r){"use strict";r.version=t("./version").version,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;splotly-logomark"}}},{}],485:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],486:[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":509}],487:[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),M=t.match(w?b:y);if(!M)return c;var A=M[1],T=M[3]||"1",k=Number(M[5]||1),E=Number(M[7]||0),L=Number(M[9]||0),S=Number(M[11]||0);if(u){if(2===A.length)return c;var C;A=Number(A);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(A,O.toMonthIndex(A,T,R),k)}else C=O.newDate(A,Number(T),k)}catch(t){return c}return C?(C.toJD()-g)*f+E*h+L*d+S*p:c}A=2===A.length?(Number(A)+2e3-x)%100+x:Number(A),T-=1;var P=new Date(Date.UTC(2e3,T,k,E,L));return P.setUTCFullYear(A),P.getUTCMonth()!==T||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 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,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("%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":509}],499:[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);function c(t,e){var r=t;return r[3]*=e,r}function f(t){if(n(t))return u;var e=a(t);return e.length?e:u}function h(t){return n(t)?t:1}e.exports={formatColor:function(t,e,r){var n,i,s,d,p,g=t.color,v=l(g),m=l(e),y=o.extractOpts(t),b=[];if(n=void 0!==y.colorscale?o.makeColorScaleFuncFromTrace(t):f,i=v?function(t,e){return void 0===t[e]?u:a(n(t[e]))}:f,s=m?function(t,e){return void 0===t[e]?1:h(t[e])}:h,v||m)for(var x=0;x1?(r*t+r*e)/r:t+e,i=String(n).length;if(i>16){var a=String(e).length;if(i>=String(t).length+a){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],502:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../constants/numerical"),s=o.FP_SAFE,l=o.BADNUM,u=e.exports={};u.nestedProperty=t("./nested_property"),u.keyedContainer=t("./keyed_container"),u.relativeAttr=t("./relative_attr"),u.isPlainObject=t("./is_plain_object"),u.toLogRange=t("./to_log_range"),u.relinkPrivateKeys=t("./relink_private");var c=t("./array");u.isTypedArray=c.isTypedArray,u.isArrayOrTypedArray=c.isArrayOrTypedArray,u.isArray1D=c.isArray1D,u.ensureArray=c.ensureArray,u.concat=c.concat,u.maxRowLength=c.maxRowLength,u.minRowLength=c.minRowLength;var f=t("./mod");u.mod=f.mod,u.modHalf=f.modHalf;var h=t("./coerce");u.valObjectMeta=h.valObjectMeta,u.coerce=h.coerce,u.coerce2=h.coerce2,u.coerceFont=h.coerceFont,u.coerceHoverinfo=h.coerceHoverinfo,u.coerceSelectionMarkerOpacity=h.coerceSelectionMarkerOpacity,u.validate=h.validate;var d=t("./dates");u.dateTime2ms=d.dateTime2ms,u.isDateTime=d.isDateTime,u.ms2DateTime=d.ms2DateTime,u.ms2DateTimeLocal=d.ms2DateTimeLocal,u.cleanDate=d.cleanDate,u.isJSDate=d.isJSDate,u.formatDate=d.formatDate,u.incrementMonth=d.incrementMonth,u.dateTick0=d.dateTick0,u.dfltRange=d.dfltRange,u.findExactDates=d.findExactDates,u.MIN_MS=d.MIN_MS,u.MAX_MS=d.MAX_MS;var p=t("./search");u.findBin=p.findBin,u.sorterAsc=p.sorterAsc,u.sorterDes=p.sorterDes,u.distinctVals=p.distinctVals,u.roundUp=p.roundUp,u.sort=p.sort,u.findIndexOfMin=p.findIndexOfMin;var g=t("./stats");u.aggNums=g.aggNums,u.len=g.len,u.mean=g.mean,u.median=g.median,u.midRange=g.midRange,u.variance=g.variance,u.stdev=g.stdev,u.interp=g.interp;var v=t("./matrix");u.init2dArray=v.init2dArray,u.transposeRagged=v.transposeRagged,u.dot=v.dot,u.translationMatrix=v.translationMatrix,u.rotationMatrix=v.rotationMatrix,u.rotationXYMatrix=v.rotationXYMatrix,u.apply2DTransform=v.apply2DTransform,u.apply2DTransform2=v.apply2DTransform2;var m=t("./angles");u.deg2rad=m.deg2rad,u.rad2deg=m.rad2deg,u.angleDelta=m.angleDelta,u.angleDist=m.angleDist,u.isFullCircle=m.isFullCircle,u.isAngleInsideSector=m.isAngleInsideSector,u.isPtInsideSector=m.isPtInsideSector,u.pathArc=m.pathArc,u.pathSector=m.pathSector,u.pathAnnulus=m.pathAnnulus;var y=t("./anchor_utils");u.isLeftAnchor=y.isLeftAnchor,u.isCenterAnchor=y.isCenterAnchor,u.isRightAnchor=y.isRightAnchor,u.isTopAnchor=y.isTopAnchor,u.isMiddleAnchor=y.isMiddleAnchor,u.isBottomAnchor=y.isBottomAnchor;var b=t("./geometry2d");u.segmentsIntersect=b.segmentsIntersect,u.segmentDistance=b.segmentDistance,u.getTextLocation=b.getTextLocation,u.clearLocationCache=b.clearLocationCache,u.getVisibleSegment=b.getVisibleSegment,u.findPointOnPath=b.findPointOnPath;var x=t("./extend");u.extendFlat=x.extendFlat,u.extendDeep=x.extendDeep,u.extendDeepAll=x.extendDeepAll,u.extendDeepNoArrays=x.extendDeepNoArrays;var _=t("./loggers");u.log=_.log,u.warn=_.warn,u.error=_.error;var w=t("./regex");u.counterRegex=w.counter;var M=t("./throttle");u.throttle=M.throttle,u.throttleDone=M.done,u.clearThrottle=M.clear;var A=t("./dom");function T(t){var e={};for(var r in t)for(var n=t[r],i=0;is?l:a(t)?Number(t):l:l},u.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(a(t)&&t>=0&&t%1==0)},u.noop=t("./noop"),u.identity=t("./identity"),u.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))},u.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},u.simpleMap=function(t,e,r,n,i){for(var a=t.length,o=new Array(a),s=0;s=Math.pow(2,r)?i>10?(u.warn("randstr failed uniqueness"),l):t(e,r,n,(i||0)+1):l},u.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},u.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},u.syncOrAsync=function(t,e,r){var n;function i(){return u.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,u.promiseError);return r&&r(e)},u.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},u.noneOrAll=function(t,e,r){if(t){var n,i=!1,a=!0;for(n=0;n0?e:0}))},u.fillArray=function(t,e,r,n){if(n=n||u.identity,u.isArrayOrTypedArray(t))for(var i=0;i1?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},u.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var O=/^\w*$/;u.templateString=function(t,e){var r={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,n){var i;return O.test(n)?i=e[n]:(r[n]=r[n]||u.nestedProperty(e,n).get,i=r[n]()),u.isValidTextValue(i)?i:""}))};var R={max:10,count:0,name:"hovertemplate"};u.hovertemplateString=function(){return I.apply(R,arguments)};var P={max:10,count:0,name:"texttemplate"};u.texttemplateString=function(){return I.apply(P,arguments)};var z=/^[:|\|]/;function I(t,e,r){var a=this,o=arguments;e||(e={});var s={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,l,c){var f,h,d,p;for(d=3;d=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 D=2e9;u.seedPseudoRandom=function(){D=2e9},u.pseudoRandom=function(){var t=D;return D=(69069*D+1)%4294967296,Math.abs(D-t)<429496729?u.pseudoRandom():D/4294967296},u.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},i=u.extractOption(t,e,"htx","hovertext");if(u.isValidTextValue(i))return n(i);var a=u.extractOption(t,e,"tx","text");return u.isValidTextValue(a)?n(a):void 0},u.isValidTextValue=function(t){return t||0===t},u.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(u=1):u=0,"translate("+(i-u*(r+o))+","+(a-u*(n+s))+")"+(u<1?"scale("+u+")":"")+(l?"rotate("+l+(e?"":" "+r+" "+n)+")":"")},u.ensureUniformFontSize=function(t,e){var r=u.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":480,"./anchor_utils":485,"./angles":486,"./array":487,"./clean_number":488,"./clear_responsive":490,"./coerce":491,"./dates":492,"./dom":493,"./extend":495,"./filter_unique":496,"./filter_visible":497,"./geometry2d":498,"./identity":500,"./increment":501,"./is_plain_object":503,"./keyed_container":504,"./localize":505,"./loggers":506,"./make_trace_groups":507,"./matrix":508,"./mod":509,"./nested_property":510,"./noop":511,"./notifier":512,"./push_unique":515,"./regex":517,"./relative_attr":518,"./relink_private":519,"./search":520,"./stats":523,"./throttle":526,"./to_log_range":527,d3:82,"d3-time-format":80,"fast-isnumeric":91}],503:[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}},{}],504:[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){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},a.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},a.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":536,"./notifier":512}],507:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var i=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));i.exit().remove(),i.enter().append("g").attr("class",r),i.order();var a=t.classed("rangeplot")?"nodeRangePlot3":"node3";return i.each((function(t){t[0][a]=n.select(this)})),i}},{d3:82}],508:[function(t,e,r){"use strict";r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],510:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./array").isArrayOrTypedArray;function a(t,e){return function(){var r,n,o,s,l,u=t;for(s=0;s/g),l=0;la||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 o(o){t.push(o);var s=r.length,l=n;r.splice(i+1);for(var u=l+1;u1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":480,"./matrix":508}],515:[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 c(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,o,f=0,h=e.length,d=0,p=h>1?(e[h-1]-e[0])/(h-1):1;for(o=p>=0?r?s:l:r?c:u,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,e){var n,i=(e||{}).unitMinDiff,a=t.slice();for(a.sort(r.sorterAsc),n=a.length-1;n>-1&&a[n]===o;n--);var s=1;i||(s=a[n]-a[0]||1);for(var l,u=s/(n||1)/1e4,c=[],f=0;f<=n;f++){var h=a[f],d=h-l;void 0===l?(c.push(h),l=h):d>u&&(s=Math.min(s,d),c.push(h),l=h)}return{vals:c,minDiff:s}},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":487,"fast-isnumeric":91}],524:[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}],525:[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,T){var k=t.text(),L=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&k.match(l),S=n.select(t.node().parentNode);if(!S.empty()){var C=t.attr("class")?t.attr("class").split(" ")[0]:"text";return C+="-math",S.selectAll("svg."+C).remove(),S.selectAll("g."+C+"-group").remove(),t.style("display",null).attr({"data-unformatted":k,"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,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)}))}(L[2],a,(function(n,i,a){S.selectAll("svg."+C).remove(),S.selectAll("g."+C+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return O(),void e();var l=S.append("g").classed(C+"-group",!0).attr({"pointer-events":"none","data-unformatted":k,"data-math":"Y"});l.node().appendChild(o.node()),i&&i.node()&&o.node().insertBefore(i.node().cloneNode(!0),o.node().firstChild),o.attr({class:C,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=t.node().style.fill||"black",c=o.select("g");c.attr({fill:u,stroke:u});var f=s(c,"width"),h=s(c,"height"),d=+t.attr("x")-f*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],p=-(r||s(t,"height"))/4;"y"===C[0]?(l.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-f/2,p-h/2]+")"}),o.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===C[0]?o.attr({x:t.attr("x"),y:p-h/2}):"a"===C[0]&&0!==C.indexOf("atitle")?o.attr({x:0,y:p}):o.attr({x:d,y:+t.attr("y")+p-h/2}),T&&T.call(t,l),e(l)}))}))):O(),t}function O(){S.empty()||(C=t.attr("class")+"-math",S.select("svg."+C).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(g," ");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)}y.test(e)?c():(r=t,l=[{node:t}]);for(var S=e.split(v),C=0;C|>|>)/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=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,m=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var b=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,x=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\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&&E(n)}var A=/(^|;)\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(v),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 T={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},k=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function E(t){return t.replace(k,(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)):T[e])||t}))}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.convertEntities=E,r.sanitizeHTML=function(t){t=t.replace(g," ");for(var e=document.createElement("p"),r=e,i=[],a=t.split(v),o=0;oa.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)}},{}],527:[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":91}],528:[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"}}},{}],529:[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"}}},{}],530:[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,M,A,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!==A)M.length>1&&a.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(A)?O.push(_):T?("add"===A&&(A={}),S.splice(_,0,A),C&&C.splice(_,0,{})):a.warn("Unrecognized full object edit value",f,_,A),-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 z(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]),P(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&P(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function I(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 P(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=R(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 H(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=Z(t,n),a=i.flags;a.calc&&(t.calcdata=void 0);var s=[h.previousPromises];a.layoutReplot?s.push(A.layoutReplot):Object.keys(n).length&&(q(t,a,i)||h.supplyDefaults(t),a.legend&&s.push(A.doLegend),a.layoutstyle&&s.push(A.layoutStyles),a.axrange&&G(s,i.rangesAltered),a.ticks&&s.push(A.doTicksRelayout),a.modebar&&s.push(A.doModeBar),a.camera&&s.push(A.doCamera),a.colorbars&&s.push(A.doColorBars),s.push(L)),s.push(h.rehover,h.redrag),u.add(t,H,[t,i.undoit],H,[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 q(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 G(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(x,A.doAutoRangeAndConstraints,r,A.drawData,A.finalDraw)}var X=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,W=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function Z(t,e){var r,n,i,a=t.layout,l=t._fullLayout,u=l._guiEditing,h=j(l._preGUI,u),d=Object.keys(e),g=p.list(t),v=o.extendDeepAll({},e),m={};for(V(e),d=Object.keys(e),n=0;n0&&"string"!=typeof P.parts[I];)I--;var D=P.parts[I],N=P.parts[I-1]+"."+D,B=P.parts.slice(0,I).join("."),U=s(t.layout,B).get(),H=s(l,B).get(),q=P.get();if(void 0!==z){A[R]=z,E[R]="reverse"===D?z:F(q);var G=f.getLayoutValObject(l,P.parts);if(G&&G.impliedEdits&&null!==z)for(var Z in G.impliedEdits)L(o.relativeAttr(R,Z),G.impliedEdits[Z]);if(-1!==["width","height"].indexOf(R))if(z){L("autosize",null);var J="height"===R?"width":"height";L(J,l[J])}else l[R]=t._initialAutoSize[R];else if("autosize"===R)L("width",z?null:l.width),L("height",z?null:l.height);else if(N.match(X))O(N),s(l,B+"._inputRange").set(null);else if(N.match(Y)){O(N),s(l,B+"._inputRange").set(null);var K=s(l,B).get();K._inputDomain&&(K._input.domain=K._inputDomain.slice())}else N.match(W)&&s(l,B+"._inputDomain").set(null);if("type"===D){var $=U,tt="linear"===H.type&&"log"===z,et="log"===H.type&&"linear"===z;if(tt||et){if($&&$.range)if(H.autorange)tt&&($.range=$.range[1]>$.range[0]?[1,2]:[2,1]);else{var rt=$.range[0],nt=$.range[1];tt?(rt<=0&&nt<=0&&L(B+".autorange",!0),rt<=0?rt=nt/1e6:nt<=0&&(nt=rt/1e6),L(B+".range[0]",Math.log(rt)/Math.LN10),L(B+".range[1]",Math.log(nt)/Math.LN10)):(L(B+".range[0]",Math.pow(10,rt)),L(B+".range[1]",Math.pow(10,nt)))}else L(B+".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,H,z,L),c.getComponentMethod("images","convertCoords")(t,H,z,L)}else L(B+".autorange",!0),L(B+".range",null);s(l,B+"._inputRange").set(null)}else if(D.match(k)){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=w.containerArrayMatch(R);if(ot){r=ot.array,n=ot.index;var st=ot.property,lt=G||{editType:"calc"};""!==n&&""===st&&(w.isAddVal(z)?E[R]=null:w.isRemoveVal(z)?E[R]=(s(a,r).get()||[])[n]:o.warn("unrecognized full object value",e)),T.update(_,lt),m[r]||(m[r]={});var ut=m[r][n];ut||(ut=m[r][n]={}),ut[st]=z,delete e[R]}else"reverse"===D?(U.range?U.range.reverse():(L(B+".autorange",!0),U.range=[1,0]),H.autorange?_.calc=!0:_.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===R&&("lasso"===z||"select"===z)&&"lasso"!==q&&"select"!==q||l._has("gl2d")?_.plot=!0:G?T.update(_,G):_.calc=!0,P.set(z))}}for(r in m){w.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 nt(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&&E<5&&(E++,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===E&&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.addTraces=function t(e,n,i){e=o.getGraphDiv(e);var a,s,l=[],c=r.deleteTraces,f=t,h=[e,l],d=[e,n];for(function(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&r=a.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!_(o))return!1;t=a[i][o]}else t=a[i]}else t=a}}return t}function _(t){return t===Math.round(t)&&t>=0}function w(){var t,e,r={};for(t in p(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var i=0;i=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 x(i,e,s)},r.getLayoutValObject=function(t,e){return x(function(t,e){var r,i,a,s,l=t._basePlotModules;if(l){var u;for(r=0;r=i&&(r._input||{})._templateitemname;o&&(a=i);var s,l=e+"["+a+"]";function u(){s={},o&&(s[l]={},s[l].templateitemname=o)}function c(t,e){o?n.nestedProperty(s[l],t).set(e):s[l+"."+t]=e}function f(){var t=s;return u(),t}return u(),{modifyBase:function(t,e){s[t]=e},modifyItem:c,getUpdateObj:f,applyUpdate:function(e,r){e&&c(e,r);var i=f();for(var a in i)n.nestedProperty(t,a).set(i[a])}}}},{"../lib":502,"../plots/attributes":545}],539:[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;function y(t,e,r){for(var n=0;n=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function b(t){var e,i,s,c,p,g,v=t._fullLayout,m=v._size,b=m.p,_=h.list(t,"",!0);if(v._paperdiv.style({width:t._context.responsive&&v.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":v.width+"px",height:t._context.responsive&&v.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(u.setSize,v.width,v.height),t._context.setBackground(t,v.paper_bgcolor),r.drawMainTitle(t),f.manage(t),!v._has("cartesian"))return a.previousPromises(t);function M(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-b-n:e._offset+e._length+b+n:m.t+m.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+b+n:e._offset-b-n:m.l+m.w*(t.position||0)+n%1}for(e=0;e<_.length;e++){var A=(c=_[e])._anchorAxis;c._linepositions={},c._lw=u.crispRound(t,c.linewidth,1),c._mainLinePosition=M(c,A,c.side),c._mainMirrorPosition=c.mirror&&A?M(c,A,d.OPPOSITE_SIDE[c.side]):null}var T=[],k=[],E=[],L=1===l.opacity(v.paper_bgcolor)&&1===l.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(i in v._plots)if((s=v._plots[i]).mainplot)s.bg&&s.bg.remove(),s.bg=void 0;else{var S=s.xaxis.domain,C=s.yaxis.domain,O=s.plotgroup;if(y(S,C,E)){var R=O.node(),P=s.bg=o.ensureSingle(O,"rect","bg");R.insertBefore(P.node(),R.childNodes[0]),k.push(i)}else O.select("rect.bg").remove(),E.push([S,C]),L||(T.push(i),k.push(i))}var z,I,D,N,F,j,B,U,V,H,q,G,X,Y=v._bgLayer.selectAll(".bg").data(T);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(t){v._plots[t].bg=n.select(this)})),e=0;eM?c.push({code:"unused",traceType:y,templateCount:w,dataCount:M}):M>w&&c.push({code:"reused",traceType:y,templateCount:w,dataCount:M})}}else c.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var a=e[n],o=g(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)&&v(a)&&t(a,o)}}({data:d,layout:h},""),c.length)return c.map(m)}},{"../lib":502,"../plots/attributes":545,"../plots/plots":593,"./plot_config":536,"./plot_schema":537,"./plot_template":538}],541:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./plot_api"),a=t("../plots/plots"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg"),c=t("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,h,d,p;function g(t){return!(t in e)||o.validate(e[t],f[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],h=t.layout||{},d=t.config||{},p={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),h=o.extendDeep({},t.layout),d=t._context,p=t._fullLayout||{}),!g("width")&&null!==e.width||!g("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var v={};function m(t,r){return o.coerce(e,v,f,t,r)}var y=m("format"),b=m("width"),x=m("height"),_=m("scale"),w=m("setBackground"),M=m("imageDataOnly"),A=document.createElement("div");A.style.position="absolute",A.style.left="-5000px",document.body.appendChild(A);var T=o.extendFlat({},h);b?T.width=b:null===e.width&&n(p.width)&&(T.width=p.width),x?T.height=x:null===e.height&&n(p.height)&&(T.height=p.height);var k=o.extendFlat({},d,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),E=s.getRedrawFunc(A);function L(){return new Promise((function(t){setTimeout(t,s.getDelay(A._fullLayout))}))}function S(){return new Promise((function(t,e){var r=l(A,y,_),n=A._fullLayout.width,f=A._fullLayout.height;function h(){i.purge(A),document.body.removeChild(A)}if("full-json"===y){var d=a.graphJson(A,!1,"keepdata","object",!0,!0);return d.version=c,d=JSON.stringify(d),h(),t(M?d:s.encodeJSON(d))}if(h(),"svg"===y)return t(M?r:s.encodeSVG(r));var p=document.createElement("canvas");p.id=o.randstr(),u({format:y,width:n,height:f,scale:_,canvas:p,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){i.plot(A,r,T,k).then(E).then(L).then(S).then((function(e){t(function(t){return M?t.replace(s.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":502,"../plots/plots":593,"../snapshot/helpers":606,"../snapshot/svgtoimg":608,"../snapshot/tosvg":610,"../version":678,"./plot_api":535,"fast-isnumeric":91}],542:[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(p("unused",a,m.concat(b.length)));var T,k,E,L,S,C=b.length,O=Array.isArray(A);if(O&&(C=Math.min(C,A.length)),2===x.dimensions)for(k=0;kb[k].length&&i.push(p("unused",a,m.concat(k,b[k].length)));var R=b[k].length;for(T=0;T<(O?Math.min(R,A[k].length):R);T++)E=O?A[k][T]:A,L=y[k][T],S=b[k][T],n.validate(L,E)?S!==L&&S!==+L&&i.push(p("dynamic",a,m.concat(k,T),L,S)):i.push(p("value",a,m.concat(k,T),L))}else i.push(p("array",a,m.concat(k),y[k]));else for(k=0;k1&&d.push(p("object","layout"))),i.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&((x=T-o(v)-o(m))>k?_/x>L&&(y=v,b=m,L=_/x):_/T>L&&(y={val:v.val,pad:0},b={val:m.val,pad:0},L=_/T));if(h===d){var S=h-1,C=h+1;if(M)if(0===h)a=[0,1];else{var O=(h>0?f:c).reduce((function(t,e){return Math.max(t,o(e))}),0),R=h/(1-Math.min(.5,O/T));a=h>0?[0,R]:[R,0]}else a=A?[Math.max(0,S),Math.max(1,C)]:[S,C]}else M?(y.val>=0&&(y={val:0,pad:0}),b.val<=0&&(b={val:0,pad:0})):A&&(y.val-L*o(y)<0&&(y={val:0,pad:0}),b.val<=0&&(b={val:1,pad:0})),L=(b.val-y.val-E(v.val,m.val))/(T-o(y)-o(b)),a=[y.val-L*o(y),b.val+L*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,M=!1,A=r.vpadLinearized||!1;function T(t){if(Array.isArray(t))return M=!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),L=T(r.vpadplus||r.vpad),S=T(r.vpadminus||r.vpad);if(!M){if(g=1/0,v=-1/0,w)for(i=0;i0&&(g=o),o>v&&o-a&&(g=o),o>v&&o=R;i--)O(i);return{min:m,max:y,opts:r}},concatExtremes:u}},{"../../constants/numerical":480,"../../lib":502,"../../registry":602,"fast-isnumeric":91}],548:[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.ONEMAXYEAR,v=p.ONEAVGYEAR,m=p.ONEMINYEAR,y=p.ONEMAXQUARTER,b=p.ONEAVGQUARTER,x=p.ONEMINQUARTER,_=p.ONEMAXMONTH,w=p.ONEAVGMONTH,M=p.ONEMINMONTH,A=p.ONEWEEK,T=p.ONEDAY,k=T/2,E=p.ONEHOUR,L=p.ONEMIN,S=p.ONESEC,C=p.MINUS_SIGN,O=p.BADNUM,R=t("../../constants/alignment"),P=R.MID_SHIFT,z=R.CAP_SHIFT,I=R.LINE_SPACING,D=R.OPPOSITE_SIDE,N=e.exports={};N.setConvert=t("./set_convert");var F=t("./axis_autotype"),j=t("./axis_ids");N.id2name=j.id2name,N.name2id=j.name2id,N.cleanId=j.cleanId,N.list=j.list,N.listIds=j.listIds,N.getFromId=j.getFromId,N.getFromTrace=j.getFromTrace;var B=t("./autorange");N.getAutoRange=B.getAutoRange,N.findExtremes=B.findExtremes;function U(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}N.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)},N.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=N.getFromId(e,n);l=r(i,a=u.fraction2r(a)),o=u.cleanPos}t[i]=o(l)},N.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:N.getFromId(e,r).cleanPos)(t)},N.redrawComponents=function(t,e){e=e||N.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},N.saveRangeInitial=function(t,e){for(var r=N.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=N.tickIncrement(t,"M6","reverse")+1.5*T:a.exactMonths>.8?t=N.tickIncrement(t,"M1","reverse")+15.5*T:t-=k;var l=N.tickIncrement(t,r);if(l<=n)return l}return t}(y,t,m,u,a)),v=y,0;v<=c;)v=N.tickIncrement(v,m,!1,a);return{start:e.c2r(y,0,a),end:e.c2r(v,0,a),size:m,_dataSpan:c-u}},N.prepTicks=function(t,e){var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if("auto"===t.tickmode||!t.dtick){var n,i=t.nticks;i||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,i=t._length/n):(n="y"===t._id.charAt(0)?40:80,i=s.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(i*=2)),"array"===t.tickmode&&(i*=100),t._roughDTick=(Math.abs(r[1]-r[0])-(t._lBreaks||0))/i,N.autoTicks(t,t._roughDTick),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),$(t)},N.calcTicks=function(t,e){N.prepTicks(t,e);var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if("array"===t.tickmode)return function(t){var e=t.tickvals,r=t.ticktext,n=new Array(e.length),i=U(s.simpleMap(t.range,t.r2l)),a=Math.min(i[0],i[1]),o=Math.max(i[0],i[1]),l=0;Array.isArray(r)||(r=[]);var u="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 c=0;ca&&f=o:n<=o)&&!(u.length>r||n===e);n=N.tickIncrement(n,t.dtick,l,t.calendar)){e=n;var i=!1;c&&n!==(0|n)&&(i=!0),u.push({minor:i,value:n})}}();var f="period"===t.ticklabelmode;if(f&&u.unshift({minor:!1,value:N.tickIncrement(u[0].value,t.dtick,!l,t.caldendar)}),t.rangebreaks){var h=u.length;if(h){var d=0;"auto"===t.tickmode&&(d=("y"===t._id.charAt(0)?2:6)*(t.tickfont?t.tickfont.size:12));for(var p,L=[],S=l?1:-1,C=l?h-1:0,R=l?0:h-1;S*R<=S*C;R+=S){var P=u[R];if(t.maskBreaks(P.value)!==O||(P.value=mt(P.value,t),!t._rl||t._rl[0]!==P.value&&t._rl[1]!==P.value)){var z=t.c2p(P.value);z===p?L[L.length-1].valued)&&(p=z,L.push(P))}}u=L.reverse()}}vt(t)&&360===Math.abs(r[1]-r[0])&&u.pop(),t._tmax=(u[u.length-1]||{}).value,t._prevDateHead="",t._inCalcTicks=!0;var I,D=Math.min(r[0],r[1]),F=Math.max(r[0],r[1]),j=N.getTickFormat(t);f&&j&&(/%[fLQsSMX]/.test(j)||(/%[HI]/.test(j)?I=E:/%p/.test(j)?I=k:/%[Aadejuwx]/.test(j)?I=T:/%[UVW]/.test(j)?I=A:/%[Bbm]/.test(j)?I=w:/%[q]/.test(j)?I=b:/%[Yy]/.test(j)&&(I=v)));var B,V,H=[];for(B=0;B0?(Z=B-1,Q=B):(Z=B,Q=B);var J=H[Z].x,K=H[Q].x,$=Math.abs(K-J),et=I||$,rt=0;if(et>=m?rt=$>=m&&$<=g?$:v:I===b&&et>=x?rt=$>=x&&$<=y?$:b:et>=M?rt=$>=M&&$<=_?$:w:I===A&&et>=A?rt=A:et>=T?rt=T:I===k&&et>=k?rt=k:I===E&&et>=E&&(rt=E),rt&&t.rangebreaks){for(var nt=0,it=0,at=0;at<42;at++){var ot=at/42;t.maskBreaks(J*(1-ot)+K*ot)!==O&&(ot<.5?nt++:it++)}it&&(rt*=(nt+it)/42)}rt<=$&&(W+=rt/2),H[B].periodX=W,(W>F||W=D){t._prevDateHead="",H[B].text=N.tickText(t,H[B].x).text;break}}return t._inCalcTicks=!1,H};var G=[2,5,10],X=[1,2,3,6,12],Y=[1,2,5,10,15,30],W=[1,2,3,7,14],Z=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],Q=[-.301,0,.301,.699,1],J=[15,30,45,90,180];function K(t,e,r){return e*s.roundUp(t/e,r)}function $(t){var e=t.dtick;if(t._tickexponent=0,i(e)||"string"==typeof e||(e=1),"category"!==t.type&&"multicategory"!==t.type||(t._tickround=null),"date"===t.type){var r=t.r2l(t.tick0),n=t.l2r(r).replace(/(^-|i)/g,""),a=n.length;if("M"===String(e).charAt(0))a>10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=T&&a<=10||e>=15*T)t._tickround="d";else if(e>=L&&a<=16||e>=E)t._tickround="M";else if(e>=S&&a<=19||e>=L)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&&(rt(t.exponentformat)&&!nt(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function tt(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}}N.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;if(a>v)e/=v,r=n(10),t.dtick="M"+12*K(e,r,G);else if(a>w)e/=w,t.dtick="M"+K(e,1,X);else if(a>T){t.dtick=K(e,T,t._hasDayOfWeekBreaks?[1,2,7,14]:W),t.tick0=s.dateTick0(t.calendar,!0);var o=N.getTickFormat(t);if(/%[uVW]/.test(o)){var l=t.tick0.length,u=+t.tick0[l-1];t.tick0=t.tick0.substring(0,l-2)+String(u+1)}}else a>E?t.dtick=K(e,E,X):a>L?t.dtick=K(e,L,Y):a>S?t.dtick=K(e,S,Y):(r=n(10),t.dtick=K(e,r,G))}else if("log"===t.type){t.tick0=0;var c=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(c[1]-c[0])<1){var f=1.5*Math.abs((c[1]-c[0])/e);e=Math.abs(Math.pow(10,c[1])-Math.pow(10,c[0]))/f,r=n(10),t.dtick="L"+K(e,r,G)}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))):vt(t)?(t.tick0=0,r=1,t.dtick=K(e,r,J)):(t.tick0=0,r=n(10),t.dtick=K(e,r,G));if(0===t.dtick&&(t.dtick=1),!i(t.dtick)&&"string"!=typeof t.dtick){var h=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(h)}},N.tickIncrement=function(t,e,r,a){var o=r?-1:1;if(i(e))return s.increment(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?Q:Z,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)},N.tickFirst=function(t,e){var r=t.r2l||Number,a=s.simpleMap(t.range,r,void 0,void 0,e),o=a[1]"+l,t._prevDateHead=l));e.text=u}(t,o,r,u):"log"===c?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=it(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||rt(d)&&nt(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":C)+h+"",e.fontSize*=1.25):("e"===d||"E"===d)&&h>2?e.text="1"+d+(f>0?"+":C)+h:(e.text=it(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,o,0,u,g):"category"===c?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===c?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,o,r):vt(t)?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=it(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){for(var r=1;!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=it(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=C+e.text)}}}}(t,o,r,u,g):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=it(e.x,t,i,n)}(t,o,0,u,g),n||(t.tickprefix&&!p(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!p(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var v=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[v(o.x-.5),v(o.x+t.dtick-.5)]}return o},N.hoverLabelText=function(t,e,r){if(r!==O&&r!==e)return N.hoverLabelText(t,e)+" - "+N.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=N.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":C+i:i};var et=["f","p","n","\u03bc","m","","k","M","G","T"];function rt(t){return"SI"===t||"B"===t}function nt(t){return t>14||t<-15}function it(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=N.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]};$(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,C);var d,p=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))"+d+"":"B"===l&&9===u?t+="B":rt(l)&&(t+=et[u/3+5]));return a?C+t:t}function at(t,e){for(var r=[],n={},i=0;i1&&r=i.min&&t=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.bottom-c:0,f)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var d=[0,1];if("x"===p){if("b"===l?n[l]=e._depth:(n[l]=e._depth=Math.max(r.width>0?c-r.top:0,f),d.reverse()),r.width>0){var v=r.right-(e._offset+e._length);v>0&&(n.xr=1,n.r=v);var m=e._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===l?n[l]=e._depth=Math.max(r.height>0?c-r.left:0,f):(n[l]=e._depth=Math.max(r.height>0?r.right-c:0,f),d.reverse()),r.height>0){var y=r.bottom-(e._offset+e._length);y>0&&(n.yb=0,n.b=y);var b=e._offset-r.top;b>0&&(n.yt=1,n.t=b)}n[g]="free"===e.anchor?e.position:e._anchorAxis.domain[d[0]],e.title.text!==h._dfltTitle[p]&&(n[l]+=st(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((i={x:0,y:0,r:0,l:0,t:0,b:0})[u]=e.linewidth,e.mirror&&!0!==e.mirror&&(i[u]+=f),!0===e.mirror||"ticks"===e.mirror?i[g]=e._anchorAxis.domain[d[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(i[g]=[e._counterDomainMin,e._counterDomainMax][d[1]]))}Z&&(s=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),a.autoMargin(t,ct(e),n),a.autoMargin(t,ft(e),i),a.autoMargin(t,ht(e),s)})),r.skipTitle||Z&&"bottom"===e.side||Y.push((function(){return function(t,e){var r,n=t._fullLayout,i=e._id,a=i.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+st(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===a?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var s,l,c,h,d=N.getPxPosition(t,e);"x"===a?(l=e._offset+e._length/2,c="top"===e.side?d-r:d+r):(c=e._offset+e._length/2,l="right"===e.side?d+r:d-r,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}e.title.hasOwnProperty("standoff")&&(h.pad=0)}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(Y)}}function Q(t){var r=d+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,i,a;t._selections[e].size()?(r=1/0,n=-1/0,i=1/0,a=-1/0,t._selections[e].each((function(){var t=ut(this),e=f.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),i=Math.min(i,e.left),a=Math.max(a,e.right)}))):(r=0,n=0,i=0,a=0);return{top:r,bottom:n,left:i,right:a,height:n-r,width:a-i}}(e,r)),w[r]}},N.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}))),t.side&&i.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),i},N.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))+")"}},N.makeTransPeriodFn=function(t){var e=t._id.charAt(0),r=t._offset;return"x"===e?function(e){return"translate("+(r+t.l2p(e.periodX))+",0)"}:function(e){return"translate(0,"+(r+t.l2p(e.periodX))+")"}},N.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},N.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*P},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},N.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",i=r.vals;"period"===e.ticklabelmode&&(i=i.slice()).shift();var a=r.layer.selectAll("path."+n).data(e.ticks?i:[],ot);a.exit().remove(),a.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),a.attr("transform",r.transFn)},N.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&&N.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;e=2){var l,u,c="";if(2===o.length)for(l=0;l<2;l++)if(u=y(o[l])){c=p;break}var f=i("pattern",c);if(f===p)for(l=0;l<2;l++)(u=y(o[l]))&&(e.bounds[l]=o[l]=u-1);if(f)for(l=0;l<2;l++)switch(u=o[l],f){case p:if(!n(u))return void(e.enabled=!1);if((u=+u)!==Math.floor(u)||u<0||u>=7)return void(e.enabled=!1);e.bounds[l]=o[l]=u;break;case g:if(!n(u))return void(e.enabled=!1);if((u=+u)<0||u>24)return void(e.enabled=!1);e.bounds[l]=o[l]=u}if(!1===r.autorange){var h=r.range;if(h[0]h[1])return void(e.enabled=!1)}else if(o[0]>h[0]&&o[1]n?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)||M)for(r=0;rP&&DO&&(O=D);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 N(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 F(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 j(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"),B(t,e,i,a)}function B(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 U(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function V(t){C&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),C=!1)}function H(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,S)/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 q(t,e,r,n){for(var i,a,o,l,u=!1,c={},f={},h=0;h=0)i._fullLayout._deactivateShape(i);else{var a=i._fullLayout.clickmode;if(U(i),2!==t||pt||Ut(),dt)a.indexOf("select")>-1&&T(r,i,Z,Q,e.id,Lt),a.indexOf("event")>-1&&f.click(i,r,e.id);else if(1===t&&pt){var s=g?B:O,u="s"===g||"w"===C?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;g?(p="n"===g?"top":"bottom","right"===s.side&&(d="right")):"e"===C&&(d="right"),i._context.showAxisRangeEntryBoxes&&n.select(mt).call(l.makeEditable,{gd:i,immediate:!0,background:i._fullLayout.paper_bgcolor,text:String(h),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:d,verticalAlign:p}).on("edit",(function(t){var e=s.d2r(t);void 0!==e&&o.call("_guiRelayout",i,c,e)}))}}}function Ot(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min($,e+yt)),i=Math.max(0,Math.min(tt,r+bt)),a=Math.abs(n-yt),o=Math.abs(i-bt);function s(){At="",xt.r=xt.l,xt.t=xt.b,kt.attr("d","M0,0Z")}if(xt.l=Math.min(yt,n),xt.r=Math.max(yt,n),xt.t=Math.min(bt,i),xt.b=Math.max(bt,i),et.isSubplotConstrained)a>S||o>S?(At="xy",a/$>o/tt?(o=a*tt/$,bt>i?xt.t=bt-o:xt.b=bt+o):(a=o*$/tt,yt>n?xt.l=yt-a:xt.r=yt+a),kt.attr("d",H(xt))):s();else if(rt.isSubplotConstrained)if(a>S||o>S){At="xy";var l=Math.min(xt.l/$,(tt-xt.b)/tt),u=Math.max(xt.r/$,(tt-xt.t)/tt);xt.l=l*$,xt.r=u*$,xt.b=(1-l)*tt,xt.t=(1-u)*tt,kt.attr("d",H(xt))}else s();else!it||og[1]-1/4096&&(e.domain=s),i.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":502,"fast-isnumeric":91}],566:[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":475}],567:[function(t,e,r){"use strict";var n=t("polybooljs"),i=t("../../registry"),a=t("../../components/drawing").dashStyle,o=t("../../components/color"),s=t("../../components/fx"),l=t("../../components/fx/helpers").makeEventData,u=t("../../components/dragelement/helpers"),c=u.freeMode,f=u.rectMode,h=u.drawMode,d=u.openMode,p=u.selectMode,g=t("../../components/shapes/draw_newshape/display_outlines"),v=t("../../components/shapes/draw_newshape/helpers").handleEllipse,m=t("../../components/shapes/draw_newshape/newshapes"),y=t("../../lib"),b=t("../../lib/polygon"),x=t("../../lib/throttle"),_=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),M=t("../../plot_api/subroutines").redrawReglTraces,A=t("./constants"),T=A.MINSELECT,k=b.filter,E=b.tester,L=t("./handle_outline").clearSelect,S=t("./helpers"),C=S.p2r,O=S.axValue,R=S.getTransform;function P(t,e,r,n,i,a,o){var s,l,u,c,f,h,p,v,m,y=e._hoverdata,b=e._fullLayout.clickmode.indexOf("event")>-1,x=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(y)){N(t,e,a);var _=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=B(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),h(e)){var a=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(a&&n._fullLayout._drawing){var o=m(a,t);o&&i.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function j(t,e,r,n){var i,a,o,s=[],l=e.map((function(t){return t._id})),u=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(i)>-1}function U(t,e,r){var n,a,o,s;for(n=0;n=0)Y._fullLayout._deactivateShape(Y);else if(!B){var r=W.clickmode;x.done(ht).then((function(){if(x.clear(ht),2===t){for(lt.remove(),w=0;w-1&&P(e,Y,i.xaxes,i.yaxes,i.subplot,i,lt),"event"===r&&Y.emit("plotly_selected",void 0);s.click(Y,e)})).catch(y.error)}},i.doneFn=function(){ft.remove(),x.done(ht).then((function(){x.clear(ht),i.gd.emit("plotly_selected",L),_&&i.selectionDefs&&(_.subtract=st,i.selectionDefs.push(_),i.mergedPolygons.length=0,[].push.apply(i.mergedPolygons,b)),i.doneFnCompleted&&i.doneFnCompleted(dt)})).catch(y.error),B&&F(i)}},clearSelect:L,clearSelectionsCache:F,selectOnClick:P}},{"../../components/color":373,"../../components/dragelement/helpers":391,"../../components/drawing":395,"../../components/fx":413,"../../components/fx/helpers":409,"../../components/shapes/draw_newshape/display_outlines":458,"../../components/shapes/draw_newshape/helpers":459,"../../components/shapes/draw_newshape/newshapes":460,"../../lib":502,"../../lib/clear_gl_canvases":489,"../../lib/polygon":514,"../../lib/throttle":526,"../../plot_api/subroutines":539,"../../registry":602,"./axis_ids":551,"./constants":554,"./handle_outline":558,"./helpers":559,polybooljs:295}],568:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,u=o.dateTime2ms,c=o.ensureNumber,f=o.isArrayOrTypedArray,h=t("../../constants/numerical"),d=h.FP_SAFE,p=h.BADNUM,g=h.LOG_CLIP,v=h.ONEWEEK,m=h.ONEDAY,y=h.ONEHOUR,b=h.ONEMIN,x=h.ONESEC,_=t("./axis_ids"),w=t("./constants"),M=w.HOUR_PATTERN,A=w.WEEKDAY_PATTERN;function T(t){return Math.pow(10,t)}function k(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",h=r.charAt(0);function E(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*g*Math.abs(n-i))}return p}function L(e,r,n,i){if((i||{}).msUTC&&a(e))return+e;var s=u(e,n||t.calendar);if(s===p){if(!a(e))return p;e=+e;var l=Math.floor(10*o.mod(e+.05,1)),c=Math.round(e-l/10);s=u(new Date(c))+l/10}return s}function S(e,r,n){return l(e,r,n||t.calendar)}function C(e){return t._categories[Math.round(e)]}function O(e){if(k(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return p}function R(e){if(t._categoriesMap)return t._categoriesMap[e]}function P(t){var e=R(t);return void 0!==e?e:a(t)?+t:void 0}function z(t,e,r){return n.round(r+e*t,2)}function I(t,e,r){return(t-r)/e}var D=function(e){return a(e)?z(e,t._m,t._b):p},N=function(e){return I(e,t._m,t._b)};if(t.rangebreaks){var F="y"===h;D=function(e){if(!a(e))return p;var r=t._rangebreaks.length;if(!r)return z(e,t._m,t._b);var n=F;t.range[0]>t.range[1]&&(n=!n);for(var i=n?-1:1,o=i*e,s=0,l=0;lc)){s=o<(u+c)/2?l:l+1;break}s=l+1}var f=t._B[s]||0;return isFinite(f)?z(e,t._m2,f):0},N=function(e){var r=t._rangebreaks.length;if(!r)return I(e,t._m,t._b);for(var n=0,i=0;it._rangebreaks[i].pmax&&(n=i+1);return I(e,t._m2,t._B[n])}}t.c2l="log"===t.type?E:c,t.l2c="log"===t.type?T:c,t.l2p=D,t.p2l=N,t.c2p="log"===t.type?function(t,e){return D(E(t,e))}:D,t.p2c="log"===t.type?function(t){return T(N(t))}:N,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=N,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return E(s(t),e)},t.r2d=t.r2c=function(t){return T(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=E,t.l2d=T,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return T(N(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=N,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=L,t.c2d=t.c2r=t.l2d=t.l2r=S,t.d2p=t.r2p=function(e,r,n){return t.l2p(L(e,0,n))},t.p2d=t.p2r=function(t,e,r){return S(N(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,p,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=O,t.r2d=t.c2d=t.l2d=C,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return C(N(t))},t.r2p=t.d2p,t.p2r=N,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=C,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=R,t.l2r=t.c2r=c,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return C(N(t))},t.r2p=t.d2p,t.p2r=N,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:c(t)},t.setupMultiCategory=function(n){var i,a,s=t._traceIndices,l=e._axisMatchGroups;if(l&&l.length&&0===t._categories.length)for(i=0;id&&(s[n]=d),s[0]===s[1]){var u=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=u,s[1]+=u}}else o.nestedProperty(t,e).set(i)},t.setScale=function(r){var n=e._size;if(t.overlaying){var i=_.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var a=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(a);var s,l,u=t.r2l(t[a][0],o),c=t.r2l(t[a][1],o),f="y"===h;if((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/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(u,c),Math.max(u,c)),t._rangebreaks.length)){for(s=0;sc&&(d=!d),d&&t._rangebreaks.reverse();var p=d?-1:1;for(t._m2=p*t._length/(Math.abs(c-u)-t._lBreaks),t._B.push(-t._m2*(f?c:u)),s=0;si&&(i+=7,ai&&(i+=24,a=n&&a=n&&e=s.min&&(ts.max&&(s.max=n),i=!1)}i&&u.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function v(e,r){var n=e.plotinfo,i=n.xaxis,l=n.yaxis,u=i._length,c=l._length,f=!!e.xr1,h=!!e.yr1,d=[];if(f){var p=a.simpleMap(e.xr0,i.r2l),g=a.simpleMap(e.xr1,i.r2l),v=p[1]-p[0],m=g[1]-g[0];d[0]=(p[0]*(1-r)+r*g[0]-p[0])/(p[1]-p[0])*u,d[2]=u*(1-r+r*m/v),i.range[0]=i.l2r(p[0]*(1-r)+r*g[0]),i.range[1]=i.l2r(p[1]*(1-r)+r*g[1])}else d[0]=0,d[2]=u;if(h){var y=a.simpleMap(e.yr0,l.r2l),b=a.simpleMap(e.yr1,l.r2l),x=y[1]-y[0],_=b[1]-b[0];d[1]=(y[1]*(1-r)+r*b[1]-y[1])/(y[0]-y[1])*c,d[3]=c*(1-r+r*_/x),l.range[0]=i.l2r(y[0]*(1-r)+r*b[0]),l.range[1]=l.l2r(y[1]*(1-r)+r*b[1])}else d[1]=0,d[3]=c;s.drawOne(t,i,{skipTitle:!0}),s.drawOne(t,l,{skipTitle:!0}),s.redrawComponents(t,[i._id,l._id]);var w=f?u/d[2]:1,M=h?c/d[3]:1,A=f?d[0]:0,T=h?d[1]:0,k=f?d[0]/d[2]*u:0,E=h?d[1]/d[3]*c:0,L=i._offset-k,S=l._offset-E;n.clipRect.call(o.setTranslate,A,T).call(o.setScale,1/w,1/M),n.plot.call(o.setTranslate,L,S).call(o.setScale,w,M),o.setPointGroupScale(n.zoomScalePts,1/w,1/M),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/M)}s.redrawComponents(t)}},{"../../components/drawing":395,"../../lib":502,"../../registry":602,"./axes":548,d3:82}],573:[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,s=t._id,l=s.charAt(0);-1!==s.indexOf("scene")&&(s=l);var u=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,s,l);if(!u)return;if("histogram"===u.type&&l==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=l+"calendar",f=u[c],h={noMultiCategory:!n(u,"cartesian")||n(u,"noMultiCategory")};"box"===u.type&&u._hasPreCompStats&&l==={h:"x",v:"y"}[u.orientation||"v"]&&(h.noMultiCategory=!0);if(o(u,l)){var d=a(u),p=[];for(r=0;r0?".":"")+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&&(g="turntable"):g="turntable")}else g="turntable";r("dragmode",g),r("hovermode",n.getDfltFromLayout("hovermode"))}e.exports=function(t,e,r){var i=e._basePlotModules.length>1;o(t,e,r,{type:"gl3d",attributes:l,handleDefaults:c,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":373,"../../../lib":502,"../../../registry":602,"../../get_data":578,"../../subplot_defaults":600,"./axis_defaults":582,"./layout_attributes":585}],585:[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":502,"../../../lib/extend":495,"../../domain":575,"./axis_attributes":581}],586:[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":524}],587:[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,{msUTC:!0}),p=0;p/g," "));l[u]=d,c.tickmode=f}}e.ticks=l;for(u=0;u<3;++u){o[u]=.5*(t.glplot.bounds[0][u]+t.glplot.bounds[1][u]);for(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;ar.deltaY?1.1:1/1.1,a=t.glplot.getAspectratio();t.glplot.setAspectratio({x:n*a.x,y:n*a.y,z:n*a.z})}i(t)}}),!!u&&{passive:!1}),t.glplot.canvas.addEventListener("mousemove",(function(){if(!1!==t.fullSceneLayout.dragmode&&0!==t.camera.mouseListener.buttons){var e=n();t.graphDiv.emit("plotly_relayouting",e)}})),t.staticMode||t.glplot.canvas.addEventListener("webglcontextlost",(function(r){e&&e.emit&&e.emit("plotly_webglcontextlost",{event:r,layer:t.id})}),!1),t.glplot.oncontextloss=function(){t.recoverContext()},t.glplot.onrender=function(){t.render()},!0},w.render=function(){var t,e=this,r=e.graphDiv,n=e.svgContainer,i=e.container.getBoundingClientRect(),a=i.width,o=i.height;n.setAttributeNS(null,"viewBox","0 0 "+a+" "+o),n.setAttributeNS(null,"width",a),n.setAttributeNS(null,"height",o),b(e),e.glplot.axes.update(e.axesOptions);for(var s,l=Object.keys(e.traces),u=null,c=e.glplot.selection,p=0;p")):"isosurface"===t.type||"volume"===t.type?(w.valueLabel=h.tickText(e._mockAxis,e._mockAxis.d2l(c.traceCoordinate[3]),"hover").text,k.push("value: "+w.valueLabel),c.textLabel&&k.push(c.textLabel),y=k.join("
")):y=c.textLabel;var E={x:c.traceCoordinate[0],y:c.traceCoordinate[1],z:c.traceCoordinate[2],data:x._input,fullData:x,curveNumber:x.index,pointNumber:_};d.appendArrayPointValue(E,x,_),t._module.eventData&&(E=x._module.eventData(E,c,x,{},_));var L={points:[E]};e.fullSceneLayout.hovermode&&d.loneHover({trace:x,x:(.5+.5*m[0]/m[3])*a,y:(.5-.5*m[1]/m[3])*o,xLabel:w.xLabel,yLabel:w.yLabel,zLabel:w.zLabel,text:y,name:u.name,color:d.castHoverOption(x,_,"bgcolor")||u.color,borderColor:d.castHoverOption(x,_,"bordercolor"),fontFamily:d.castHoverOption(x,_,"font.family"),fontSize:d.castHoverOption(x,_,"font.size"),fontColor:d.castHoverOption(x,_,"font.color"),nameLength:d.castHoverOption(x,_,"namelength"),textAlign:d.castHoverOption(x,_,"align"),hovertemplate:f.castOption(x,_,"hovertemplate"),hovertemplateLabels:f.extendFlat({},E,w),eventData:[E]},{container:n,gd:r}),c.buttons&&c.distance<5?r.emit("plotly_click",L):r.emit("plotly_hover",L),s=L}else d.loneUnhover(n),r.emit("plotly_unhover",s);e.drawAnnotations(e)},w.recoverContext=function(){var t=this;t.glplot.dispose();var e=function(){t.glplot.gl.isContextLost()?requestAnimationFrame(e):t.initializeGLPlot()?t.plot.apply(t,t.plotArgs):f.error("Catastrophic and unrecoverable WebGL error. Context lost.")};requestAnimationFrame(e)};var M=["xaxis","yaxis","zaxis"];function A(t,e,r){for(var n=t.fullSceneLayout,i=0;i<3;i++){var a=M[i],o=a.charAt(0),s=n[a],l=e[o],u=e[o+"calendar"],c=e["_"+o+"length"];if(f.isArrayOrTypedArray(l))for(var h,d=0;d<(c||l.length);d++)if(f.isArrayOrTypedArray(l[d]))for(var p=0;pv[1][a])v[0][a]=-1,v[1][a]=1;else{var S=v[1][a]-v[0][a];v[0][a]-=S/32,v[1][a]+=S/32}if("reversed"===s.autorange){var C=v[0][a];v[0][a]=v[1][a],v[1][a]=C}}else{var O=s.range;v[0][a]=s.r2l(O[0]),v[1][a]=s.r2l(O[1])}v[0][a]===v[1][a]&&(v[0][a]-=1,v[1][a]+=1),m[a]=v[1][a]-v[0][a],this.glplot.setBounds(a,{min:v[0][a]*h[a],max:v[1][a]*h[a]})}var R=u.aspectmode;if("cube"===R)g=[1,1,1];else if("manual"===R){var P=u.aspectratio;g=[P.x,P.y,P.z]}else{if("auto"!==R&&"data"!==R)throw new Error("scene.js aspectRatio was not one of the enumerated types");var z=[1,1,1];for(a=0;a<3;++a){var I=y[l=(s=u[M[a]]).type];z[a]=Math.pow(I.acc,1/I.count)/h[a]}g="data"===R||Math.max.apply(null,z)/Math.min.apply(null,z)<=4?z:[1,1,1]}u.aspectratio.x=c.aspectratio.x=g[0],u.aspectratio.y=c.aspectratio.y=g[1],u.aspectratio.z=c.aspectratio.z=g[2],this.glplot.setAspectratio(u.aspectratio),this.viewInitial.aspectratio||(this.viewInitial.aspectratio={x:u.aspectratio.x,y:u.aspectratio.y,z:u.aspectratio.z}),this.viewInitial.aspectmode||(this.viewInitial.aspectmode=u.aspectmode);var D=u.domain||null,N=e._size||null;if(D&&N){var F=this.container.style;F.position="absolute",F.left=N.l+D.x[0]*N.w+"px",F.top=N.t+(1-D.y[1])*N.h+"px",F.width=N.w*(D.x[1]-D.x[0])+"px",F.height=N.h*(D.y[1]-D.y[0])+"px"}this.glplot.redraw()}},w.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},w.getCamera=function(){var t;return this.camera.view.recalcMatrix(this.camera.view.lastT()),{up:{x:(t=this.camera).up[0],y:t.up[1],z:t.up[2]},center:{x:t.center[0],y:t.center[1],z:t.center[2]},eye:{x:t.eye[0],y:t.eye[1],z:t.eye[2]},projection:{type:!0===t._ortho?"orthographic":"perspective"}}},w.setViewport=function(t){var e,r=t.camera;this.camera.lookAt.apply(this,[[(e=r).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]]),this.glplot.setAspectratio(t.aspectratio),"orthographic"===r.projection.type!==this.camera._ortho&&(this.glplot.redraw(),this.glplot.clearRGBA(),this.glplot.dispose(),this.initializeGLPlot())},w.isCameraChanged=function(t){var e=this.getCamera(),r=f.nestedProperty(t,this.id+".camera").get();function n(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]]}var i=!1;if(void 0===r)i=!0;else{for(var a=0;a<3;a++)for(var o=0;o<3;o++)if(!n(e,r,a,o)){i=!0;break}(!r.projection||e.projection&&e.projection.type!==r.projection.type)&&(i=!0)}return i},w.isAspectChanged=function(t){var e=this.glplot.getAspectratio(),r=f.nestedProperty(t,this.id+".aspectratio").get();return void 0===r||r.x!==e.x||r.y!==e.y||r.z!==e.z},w.saveLayout=function(t){var e,r,n,i,a,o,s=this.fullLayout,l=this.isCameraChanged(t),u=this.isAspectChanged(t),h=l||u;if(h){var d={};if(l&&(e=this.getCamera(),n=(r=f.nestedProperty(t,this.id+".camera")).get(),d[this.id+".camera"]=n),u&&(i=this.glplot.getAspectratio(),o=(a=f.nestedProperty(t,this.id+".aspectratio")).get(),d[this.id+".aspectratio"]=o),c.call("_storeDirectGUIEdit",t,s._preGUI,d),l)r.set(e),f.nestedProperty(s,this.id+".camera").set(e);if(u)a.set(i),f.nestedProperty(s,this.id+".aspectratio").set(i),this.glplot.redraw()}return h},w.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 u=this.id+".camera.up",h={x:0,y:0,z:1},d={};d[u]=h;var p=n.layout;c.call("_storeDirectGUIEdit",p,i._preGUI,d),a.up=h,f.nestedProperty(p,u).set(h)}}else r.keyBindingMode=t;this.fullSceneLayout.hovermode=e},w.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),function(t,e,r){for(var n=0,i=r-1;n0)for(var s=255/o,l=0;l<3;++l)t[a+l]=Math.min(s*t[a+l],255)}}(a,r,i);var o=document.createElement("canvas");o.width=r,o.height=i;var s,l=o.getContext("2d"),u=l.createImageData(r,i);switch(u.data.set(a),l.putImageData(u,0,0),t){case"jpeg":s=o.toDataURL("image/jpeg");break;case"webp":s=o.toDataURL("image/webp");break;default:s=o.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(n),s},w.setConvert=function(){for(var t=0;t<3;t++){var e=this.fullSceneLayout[M[t]];h.setConvert(e,this.fullLayout),e.setScale=f.noop}},w.make4thDimension=function(){var t=this.graphDiv._fullLayout;this._mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},h.setConvert(this._mockAxis,t)},e.exports=_},{"../../components/fx":413,"../../lib":502,"../../lib/show_no_webgl_msg":522,"../../lib/str2rgbarray":524,"../../plots/cartesian/axes":548,"../../registry":602,"./layout/convert":583,"./layout/spikes":586,"./layout/tick_marks":587,"./project":588,"gl-plot3d":140,"has-passive-events":247,"is-mobile":256,"webgl-context":354}],590:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){n=n||t.length;for(var i=new Array(n),a=0;a=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"),l=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(){b.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()&&l.text()?" - ":"")}},b.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var 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=b.graphJson(t,!1,"keepdata"),i.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],M=["year","month","dayMonth","dayMonthYear"];function A(t,e){var r=t._context.locale,n=!1,i={};function a(t){for(var r=!0,a=0;a1&&z.length>1){for(o.getComponentMethod("grid","sizeDefaults")(c,l),s=0;s15&&z.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"),b.linkSubplots(h,l,f,a),b.cleanPlot(h,l,f,a);var j=!(!a._has||!a._has("gl2d")),B=!(!l._has||!l._has("gl2d")),U=!(!a._has||!a._has("cartesian"))||j,V=!(!l._has||!l._has("cartesian"))||B;U&&!V?a._bgLayer.remove():V&&!U&&(l._shouldCreateBgLayer=!0),a._zoomlayer&&!t._dragging&&d({_fullLayout:a}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var i=0;i0){var f=1-2*s;n=Math.round(f*n),i=Math.round(f*i)}}var h=b.layoutAttributes.width.min,d=b.layoutAttributes.height.min;n1,g=!e.height&&Math.abs(r.height-i)>1;(g||p)&&(p&&(r.width=n),g&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),b.sanitizeMargins(r)},b.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a,s,l=o.componentsRegistry,c=e._basePlotModules,f=o.subplotsRegistry.cartesian;for(i in l)(s=l[i]).includeBasePlot&&s.includeBasePlot(t,e);for(var h in c.length||c.push(f),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(u.subplotSort);for(a=0;a.5*n.width&&(u.log("Margin push",e,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(u.log("Margin push",e,"is too big in y, dropping"),r.b=r.t=0);var l=void 0!==r.xl?r.xl:r.x,c=void 0!==r.xr?r.xr:r.x,f=void 0!==r.yt?r.yt:r.y,h=void 0!==r.yb?r.yb:r.y;i[e]={l:{val:l,size:r.l+o},r:{val:c,size:r.r+o},b:{val:h,size:r.b+o},t:{val:f,size:r.t+o}},a[e]=1}else delete i[e],delete a[e];if(!n._replotting)return b.doAutoMargin(t)}},b.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),S(e);var r=e._size,n=e.margin,i=u.extendFlat({},r),s=n.l,l=n.r,c=n.t,f=n.b,h=e.width,d=e.height,p=e._pushmargin,g=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var v in p)g[v]||delete p[v];for(var m in p.base={l:{val:0,size:s},r:{val:1,size:l},t:{val:1,size:c},b:{val:0,size:f}},p){var y=p[m].l||{},x=p[m].b||{},_=y.val,w=y.size,M=x.val,A=x.size;for(var T in p){if(a(w)&&p[T].r){var k=p[T].r.val,E=p[T].r.size;if(k>_){var L=(w*k+(E-h)*_)/(k-_),C=(E*(1-_)+(w-h)*(1-k))/(k-_);L>=0&&C>=0&&h-(L+C)>0&&L+C>s+l&&(s=L,l=C)}}if(a(A)&&p[T].t){var O=p[T].t.val,R=p[T].t.size;if(O>M){var P=(A*O+(R-d)*M)/(O-M),z=(R*(1-M)+(A-d)*(1-O))/(O-M);P>=0&&z>=0&&d-(z+P)>0&&P+z>f+c&&(f=P,c=z)}}}}}if(r.l=Math.round(s),r.r=Math.round(l),r.t=Math.round(c),r.b=Math.round(f),r.p=Math.round(n.pad),r.w=Math.round(h)-r.l-r.r,r.h=Math.round(d)-r.t-r.b,!e._replotting&&b.didMarginChange(i,r)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var I=3*(1+Object.keys(g).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var a=0,s=0;function l(){return a++,function(){s++,n||s!==a||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(i)}}r.runFn(l),setTimeout(l())}))}],a=u.syncOrAsync(i,t);return a&&a.then||(a=Promise.resolve()),a.then((function(){return t}))}b.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},b.graphJson=function(t,e,r,n,i,a){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&b.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function c(t,e){if("function"==typeof t)return e?"_function_":null;if(u.isPlainObject(t)){var n,i={};return Object.keys(t).sort().forEach((function(a){if(-1===["_","["].indexOf(a.charAt(0)))if("function"!=typeof t[a]){if("keepdata"===r){if("src"===a.substr(a.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0&&!u.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0)return;i[a]=c(t[a],e)}else e&&(i[a]="_function")})),i}return Array.isArray(t)?t.map((function(t){return c(t,e)})):u.isTypedArray(t)?u.simpleMap(t,u.identity):u.isJSDate(t)?u.ms2DateTimeLocal(+t):t}var f={data:(o||[]).map((function(t){var r=c(t);return e&&delete r.fit,r}))};return e||(f.layout=c(s)),t.framework&&t.framework.isPolar&&(f=t.framework.getConfig()),l&&(f.frames=c(l)),a&&(f.config=c(t._context,!0)),"object"===n?f:JSON.stringify(f)},b.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;a--)if(s[a].enabled){r._indexToPoints=s[a]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,p[e]=o}}for(P(l,c,d),i=0;i=0?h.angularAxis.domain:n.extent(M),L=Math.abs(M[1]-M[0]);T&&!A&&(L=0);var S=E.slice();k&&A&&(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,D=t.select(".chart-group"),N={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}),D.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(N),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:b}).style(N);var X=t.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});function Y(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var W=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(W).attr({transform:"rotate("+h.radialAxis.orientation+")"}),q.selectAll(".domain").style(N),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("+Y(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(N),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=Y(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(D.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));I.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"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(!A){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});D.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"});D.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("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":475,"../../../lib":502,d3:82}],598:[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":373,"../../../lib":502,"./micropolar":597,"./undo_manager":599,d3:82}],599:[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||(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 r0){for(var n=[],i=0;i-1&&(f[d[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(M),M=(M=M.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),i.isIE()&&(M=(M=(M=M.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),M}},{"../components/color":373,"../components/drawing":395,"../constants/xmlns_namespaces":481,"../lib":502,d3:82}],611:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l={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:i({editType:"calc"},{keys:["norm"]}),showlegend:s({},o.showlegend,{dflt:!1})};s(l,n("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}));["opacity","lightposition","lighting"].forEach((function(t){l[t]=a[t]})),l.hoverinfo=s({},o.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","text","name"],dflt:"x+y+z+norm+text+name"}),l.transforms=void 0,e.exports=l},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plots/attributes":545,"../../plots/template_attributes":601,"../mesh3d/attributes":623}],612:[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":502}],617:[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":502}],618:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll;var u=e.exports=l(s({x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},value:{valType:"data_array"},isomin:{valType:"number"},isomax:{valType:"number"},surface:{show:{valType:"boolean",dflt:!0},count:{valType:"integer",dflt:2,min:1},fill:{valType:"number",min:0,max:1,dflt:1},pattern:{valType:"flaglist",flags:["A","B","C","D","E"],extras:["all","odd","even"],dflt:"all"}},spaceframe:{show:{valType:"boolean",dflt:!1},fill:{valType:"number",min:0,max:1,dflt:.15}},slices:{x:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}}},caps:{x:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}}},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:i(),showlegend:s({},o.showlegend,{dflt:!1})},n("",{colorAttr:"`value`",showScaleDflt:!0,editTypeOverride:"calc"}),{opacity:a.opacity,lightposition:a.lightposition,lighting:a.lighting,flatshading:a.flatshading,contour:a.contour,hoverinfo:s({},o.hoverinfo)}),"calc","nested");u.flatshading.dflt=!0,u.lighting.facenormalsepsilon.dflt=0,u.x.editType=u.y.editType=u.z.editType=u.value.editType="calc+clearAxisTypes",u.transforms=void 0},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plot_api/edit_types":531,"../../plots/attributes":545,"../../plots/template_attributes":601,"../mesh3d/attributes":623}],619:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc"),i=t("../streamtube/calc").processGrid,a=t("../streamtube/calc").filter;e.exports=function(t,e){e._len=Math.min(e.x.length,e.y.length,e.z.length,e.value.length),e._x=a(e.x,e._len),e._y=a(e.y,e._len),e._z=a(e.z,e._len),e._value=a(e.value,e._len);var r=i(e);e._gridFill=r.fill,e._Xs=r.Xs,e._Ys=r.Ys,e._Zs=r.Zs,e._len=r.len;for(var o=1/0,s=-1/0,l=0;l0;r--){var n=Math.min(e[r],e[r-1]),i=Math.max(e[r],e[r-1]);if(i>n&&n-1}function D(t,e){return null===t?e:t}function N(e,r,n){C();var i,a,o,l=[r],u=[n];if(s>=1)l=[r],u=[n];else if(s>0){var c=function(t,e){var r=t[0],n=t[1],i=t[2],a=function(t,e,r){for(var n=[],i=0;i-1?n[d]:S(p,g,m);h[d]=b>-1?b:R(p,g,m,D(e,y))}i=h[0],a=h[1],o=h[2],t._meshI.push(i),t._meshJ.push(a),t._meshK.push(o),++v}}function F(t,e,r,n){var i=t[3];in&&(i=n);for(var a=(t[3]-i)/(t[3]-e[3]+1e-9),o=[],s=0;s<4;s++)o[s]=(1-a)*t[s]+a*e[s];return o}function j(t,e,r){return t>=e&&t<=r}function B(t){var e=.001*(L-E);return t>=E-e&&t<=L+e}function U(e){for(var r=[],n=0;n<4;n++){var i=e[n];r.push([t._x[i],t._y[i],t._z[i],t._value[i]])}return r}function V(t,e,r,n,i,a){a||(a=1),r=[-1,-1,-1];var o=!1,s=[j(e[0][3],n,i),j(e[1][3],n,i),j(e[2][3],n,i)];if(!s[0]&&!s[1]&&!s[2])return!1;var l=function(t,e,r){return B(e[0][3])&&B(e[1][3])&&B(e[2][3])?(N(t,e,r),!0):a<3&&V(t,e,r,E,L,++a)};if(s[0]&&s[1]&&s[2])return l(t,e,r)||o;var u=!1;return[[0,1,2],[2,0,1],[1,2,0]].forEach((function(a){if(s[a[0]]&&s[a[1]]&&!s[a[2]]){var c=e[a[0]],f=e[a[1]],h=e[a[2]],d=F(h,c,n,i),p=F(h,f,n,i);o=l(t,[p,d,c],[-1,-1,r[a[0]]])||o,o=l(t,[c,f,p],[r[a[0]],r[a[1]],-1])||o,u=!0}})),u||[[0,1,2],[1,2,0],[2,0,1]].forEach((function(a){if(s[a[0]]&&!s[a[1]]&&!s[a[2]]){var c=e[a[0]],f=e[a[1]],h=e[a[2]],d=F(f,c,n,i),p=F(h,c,n,i);o=l(t,[p,d,c],[-1,-1,r[a[0]]])||o,u=!0}})),o}function H(t,e,r,n){var i=!1,a=U(e),o=[j(a[0][3],r,n),j(a[1][3],r,n),j(a[2][3],r,n),j(a[3][3],r,n)];if(!(o[0]||o[1]||o[2]||o[3]))return i;if(o[0]&&o[1]&&o[2]&&o[3])return g&&(i=function(t,e,r){var n=function(n,i,a){N(t,[e[n],e[i],e[a]],[r[n],r[i],r[a]])};n(0,1,2),n(3,0,1),n(2,3,0),n(1,2,3)}(t,a,e)||i),i;var s=!1;return[[0,1,2,3],[3,0,1,2],[2,3,0,1],[1,2,3,0]].forEach((function(l){if(o[l[0]]&&o[l[1]]&&o[l[2]]&&!o[l[3]]){var u=a[l[0]],c=a[l[1]],f=a[l[2]],h=a[l[3]];if(g)i=N(t,[u,c,f],[e[l[0]],e[l[1]],e[l[2]]])||i;else{var d=F(h,u,r,n),p=F(h,c,r,n),v=F(h,f,r,n);i=N(null,[d,p,v],[-1,-1,-1])||i}s=!0}})),s?i:([[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2],[0,2,3,1],[1,3,2,0]].forEach((function(l){if(o[l[0]]&&o[l[1]]&&!o[l[2]]&&!o[l[3]]){var u=a[l[0]],c=a[l[1]],f=a[l[2]],h=a[l[3]],d=F(f,u,r,n),p=F(f,c,r,n),v=F(h,c,r,n),m=F(h,u,r,n);g?(i=N(t,[u,m,d],[e[l[0]],-1,-1])||i,i=N(t,[c,p,v],[e[l[1]],-1,-1])||i):i=function(t,e,r){var n=function(n,i,a){N(t,[e[n],e[i],e[a]],[r[n],r[i],r[a]])};n(0,1,2),n(2,3,0)}(null,[d,p,v,m],[-1,-1,-1,-1])||i,s=!0}})),s||[[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2]].forEach((function(l){if(o[l[0]]&&!o[l[1]]&&!o[l[2]]&&!o[l[3]]){var u=a[l[0]],c=a[l[1]],f=a[l[2]],h=a[l[3]],d=F(c,u,r,n),p=F(f,u,r,n),v=F(h,u,r,n);g?(i=N(t,[u,d,p],[e[l[0]],-1,-1])||i,i=N(t,[u,p,v],[e[l[0]],-1,-1])||i,i=N(t,[u,v,d],[e[l[0]],-1,-1])||i):i=N(null,[d,p,v],[-1,-1,-1])||i,s=!0}})),i)}function q(t,e,r,n,i,a,o,s,l,u,c){var f=!1;return p&&(I(t,"A")&&(f=H(null,[e,r,n,a],u,c)||f),I(t,"B")&&(f=H(null,[r,n,i,l],u,c)||f),I(t,"C")&&(f=H(null,[r,a,o,l],u,c)||f),I(t,"D")&&(f=H(null,[n,a,s,l],u,c)||f),I(t,"E")&&(f=H(null,[r,n,a,l],u,c)||f)),g&&(f=H(t,[r,n,a,l],u,c)||f),f}function G(t,e,r,n,i,a,o,s){return[!0===s[0]||V(t,U([e,r,n]),[e,r,n],a,o),!0===s[1]||V(t,U([n,i,e]),[n,i,e],a,o)]}function X(t,e,r,n,i,a,o,s,l){return s?G(t,e,r,i,n,a,o,l):G(t,r,i,n,e,a,o,l)}function Y(t,e,r,n,i,a,o){var s,l,u,c,f=!1,h=function(){f=V(t,[s,l,u],[-1,-1,-1],i,a)||f,f=V(t,[u,c,s],[-1,-1,-1],i,a)||f},d=o[0],p=o[1],g=o[2];return d&&(s=P(U([A(e,r-0,n-0)])[0],U([A(e-1,r-0,n-0)])[0],d),l=P(U([A(e,r-0,n-1)])[0],U([A(e-1,r-0,n-1)])[0],d),u=P(U([A(e,r-1,n-1)])[0],U([A(e-1,r-1,n-1)])[0],d),c=P(U([A(e,r-1,n-0)])[0],U([A(e-1,r-1,n-0)])[0],d),h()),p&&(s=P(U([A(e-0,r,n-0)])[0],U([A(e-0,r-1,n-0)])[0],p),l=P(U([A(e-0,r,n-1)])[0],U([A(e-0,r-1,n-1)])[0],p),u=P(U([A(e-1,r,n-1)])[0],U([A(e-1,r-1,n-1)])[0],p),c=P(U([A(e-1,r,n-0)])[0],U([A(e-1,r-1,n-0)])[0],p),h()),g&&(s=P(U([A(e-0,r-0,n)])[0],U([A(e-0,r-0,n-1)])[0],g),l=P(U([A(e-0,r-1,n)])[0],U([A(e-0,r-1,n-1)])[0],g),u=P(U([A(e-1,r-1,n)])[0],U([A(e-1,r-1,n-1)])[0],g),c=P(U([A(e-1,r-0,n)])[0],U([A(e-1,r-0,n-1)])[0],g),h()),f}function W(t,e,r,n,i,a,o,s,l,u,c,f){var h=t;return f?(p&&"even"===t&&(h=null),q(h,e,r,n,i,a,o,s,l,u,c)):(p&&"odd"===t&&(h=null),q(h,l,s,o,a,i,n,r,e,u,c))}function Z(t,e,r,n,i){for(var a=[],o=0,s=0;sMath.abs(p-k)?[T,p]:[p,k];$(e,M[0],M[1])}}var S=[[Math.min(E,k),Math.max(E,k)],[Math.min(T,L),Math.max(T,L)]];["x","y","z"].forEach((function(e){for(var r=[],n=0;n0&&(c.push(d.id),"x"===e?f.push([d.distRatio,0,0]):"y"===e?f.push([0,d.distRatio,0]):f.push([0,0,d.distRatio]))}else u=nt(1,"x"===e?x-1:"y"===e?_-1:w-1);c.length>0&&(r[i]="x"===e?tt(null,c,a,o,f,r[i]):"y"===e?et(null,c,a,o,f,r[i]):rt(null,c,a,o,f,r[i]),i++),u.length>0&&(r[i]="x"===e?Z(null,u,a,o,r[i]):"y"===e?Q(null,u,a,o,r[i]):J(null,u,a,o,r[i]),i++)}var p=t.caps[e];p.show&&p.fill&&(z(p.fill),r[i]="x"===e?Z(null,[0,x-1],a,o,r[i]):"y"===e?Q(null,[0,_-1],a,o,r[i]):J(null,[0,w-1],a,o,r[i]),i++)}})),0===v&&O(),t._meshX=n,t._meshY=i,t._meshZ=a,t._meshIntensity=o,t._Xs=m,t._Ys=y,t._Zs=b}(),t}e.exports={findNearestOnAxis:l,generateIsoMeshes:h,createIsosurfaceTrace: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}}},{"../../components/colorscale":385,"../../lib/gl_format_color":499,"../../lib/str2rgbarray":524,"../../plots/gl3d/zip3":590,"gl-mesh3d":137}],621:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("./attributes"),o=t("../../components/colorscale/defaults");function s(t,e,r,n,a){var s=a("isomin"),l=a("isomax");null!=l&&null!=s&&s>l&&(e.isomin=null,e.isomax=null);var u=a("x"),c=a("y"),f=a("z"),h=a("value");u&&u.length&&c&&c.length&&f&&f.length&&h&&h.length?(i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],n),["x","y","z"].forEach((function(t){var e="caps."+t;a(e+".show")&&a(e+".fill");var r="slices."+t;a(r+".show")&&(a(r+".fill"),a(r+".locations"))})),a("spaceframe.show")&&a("spaceframe.fill"),a("surface.show")&&(a("surface.count"),a("surface.fill"),a("surface.pattern")),a("contour.show")&&(a("contour.color"),a("contour.width")),["text","hovertext","hovertemplate","lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","flatshading","opacity"].forEach((function(t){a(t)})),o(t,e,n,a,{prefix:"",cLetter:"c"}),e._length=null):e.visible=!1}e.exports={supplyDefaults:function(t,e,r,i){s(t,e,r,i,(function(r,i){return n.coerce(t,e,a,r,i)}))},supplyIsoDefaults:s}},{"../../components/colorscale/defaults":383,"../../lib":502,"../../registry":602,"./attributes":618}],622:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,calc:t("./calc"),colorbar:{min:"cmin",max:"cmax"},plot:t("./convert").createIsosurfaceTrace,moduleType:"trace",name:"isosurface",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","showLegend"],meta:{}}},{"../../plots/gl3d":579,"./attributes":618,"./calc":619,"./convert":620,"./defaults":621}],623:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../surface/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s({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:i({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"},intensitymode:{valType:"enumerated",values:["vertex","cell"],dflt:"vertex",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"}),{opacity:a.opacity,flatshading:{valType:"boolean",dflt:!1,editType:"calc"},contour:{show:s({},a.contours.x.show,{}),color:a.contours.x.color,width:a.contours.x.width,editType:"calc"},lightposition:{x:s({},a.lightposition.x,{dflt:1e5}),y:s({},a.lightposition.y,{dflt:1e5}),z:s({},a.lightposition.z,{dflt:0}),editType:"calc"},lighting:s({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"},a.lighting),hoverinfo:s({},o.hoverinfo,{editType:"calc"}),showlegend:s({},o.showlegend,{dflt:!1})})},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plots/attributes":545,"../../plots/template_attributes":601,"../surface/attributes":669}],624:[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":381}],625:[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("../../components/colorscale").extractOpts,c=t("../../plots/gl3d/zip3");function f(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}var h=f.prototype;function d(t){for(var e=[],r=t.length,n=0;n=e-.5)return!1;return!0}h.handlePick=function(t){if(t.object===this.mesh){var e=t.index=t.data.index;t.data._cellCenter?t.traceCoordinate=t.data.dataCoordinate: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}},h.update=function(t){var e=this.scene,r=e.fullSceneLayout;this.data=t;var n,f=t.x.length,h=c(p(r.xaxis,t.x,e.dataScale[0],t.xcalendar),p(r.yaxis,t.y,e.dataScale[1],t.ycalendar),p(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||!v(t.i,f)||!v(t.j,f)||!v(t.k,f))return;n=c(g(t.i),g(t.j),g(t.k))}else n=0===t.alphahull?o(h):t.alphahull>0?a(t.alphahull,h):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}}}}}},{}],638:[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!=(N=R[C][1])>=G&&(z=R[C-1][0],I=R[C][0],N-D&&(P=z+(I-z)*(G-D)/(N-D),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":373,"../../components/fx":413,"../../lib":502,"../../registry":602,"./get_trace_color":641}],643:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":561,"./arrays_to_calcdata":630,"./attributes":631,"./calc":632,"./cross_trace_calc":636,"./cross_trace_defaults":637,"./defaults":638,"./format_labels":640,"./hover":642,"./marker_colorbar":649,"./plot":651,"./select":652,"./style":654,"./subtypes":655}],644:[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":383,"../../components/colorscale/helpers":384,"../../lib":502}],645:[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,M,A,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,D="linear"===I,N=e.fill&&"none"!==e.fill,F=[],j=f.minTolerance,B=t.length,U=new Array(B),V=0;function H(r){var n=t[r];if(!n)return!1;var a=e.linearized?E.l2p(n.x):E.c2p(n.x),l=e.linearized?L.l2p(n.y):L.c2p(n.y);if(a===i){if(S&&(a=E.c2p(n.x,!0)),a===i)return!1;C&&l===i&&(a*=Math.abs(E._m*R*(E._m>0?o:s)/(L._m*O*(L._m>0?o:s)))),a*=1e3}if(l===i){if(C&&(l=L.c2p(n.y,!0)),l===i)return!1;l*=1e3}return[a,l]}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),J=null,Z=Q=0}function ft(t){if(T=t[0]/O,k=t[1]/R,Y=t[0]rt?rt:0,W=t[1]it?it:0,Y||W){if(V)if(J){var e=$(J,t);e.length>1&&(ct(e[0]),U[V++]=e[1])}else K=$(U[V-1],t)[0],U[V++]=K;else U[V++]=[Y||t[0],W||t[1]];var r=U[V-1];Y&&W&&(r[0]!==Y||r[1]!==W)?(J&&(Z!==Y&&Q!==W?ut(Z&&Q?(n=J,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||Y,Q||W]):Z&&Q&&ut([Z,Q])),ut([Y,W])):Z-Y&&Q-W&&ut([Y||Z,W||Q]),J=t,Z=Y,Q=W}else J&&ct($(J,t)[0]),U[V++]=t;var n,i,a,o}for("linear"===I||"spline"===I?$=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)}J&&ut([Z||J[0],Q||J[1]]),F.push(U.slice(0,V))}return F}},{"../../constants/numerical":480,"../../lib":502,"./constants":635}],646:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],647:[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":91}],649:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],650:[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":373,"../../components/colorscale/defaults":383,"../../components/colorscale/helpers":384,"./subtypes":655}],651:[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,M=n.select(p),A=o(M,"g","errorbars"),T=o(M,"g","lines"),k=o(M,"g","points"),E=o(M,"g","text");if(i.getComponentMethod("errorbars","plot")(t,A,r,g),!0===_.visible){var L,S;y(M).style("opacity",_.opacity);var C=_.fill.charAt(_.fill.length-1);"x"!==C&&"y"!==C&&(C=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=M;var O,R,P="",z=[],I=_._prevtrace;I&&(P=I._prevRevpath||"",S=I._nextFill,z=I._polygons);var D,N,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)?(D=l.steps(w.shape),N=l.steps(w.shape.split("").reverse().join(""))):D=N="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 N(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 Y=T.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(X(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(X(!0)),l.setClipUrl(Y,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?J:Q:_&&!w&&(v=K),f&&(p=v),h&&(g=v)}var M,A=(o=e.selectAll("path.point").data(p,d)).enter().append("path").classed("point",!0);m&&A.call(l.pointStyle,c,t).call(l.translatePoints,b,x).style("opacity",0).transition().style("opacity",1),o.order(),f&&(M=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,M,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 W=!1===_.cliponaxis?null:r.layerClipId;l.setClipUrl(k,W,t),l.setClipUrl(E,W,t)}function Z(t){y(t).attr("d","M0,0Z")}function Q(t){return t.filter((function(t){return!t.gap&&t.vis}))}function J(t){return t.filter((function(t){return t.vis}))}function K(t){return t.filter((function(t){return!t.gap}))}function $(t){return t.id}function tt(t){if(t.ids)return $}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":395,"../../lib":502,"../../lib/polygon":514,"../../registry":602,"./line_points":645,"./link_traces":647,"./subtypes":655,d3:82}],652:[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 x(t){return null==t?0:t.indexOf("top")>-1?-1:t.indexOf("bottom")>-1?1:0}function _(t,e){return e(4*t)}function w(t){return d[t]}function M(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":502,"../../registry":602,"../scatter/line_defaults":644,"../scatter/marker_defaults":650,"../scatter/subtypes":655,"../scatter/text_defaults":656,"./attributes":658}],663:[function(t,e,r){"use strict";e.exports={plot:t("./convert"),attributes:t("./attributes"),markerSymbols:t("../../constants/gl3d_markers"),supplyDefaults:t("./defaults"),colorbar:[{container:"marker",min:"cmin",max:"cmax"},{container:"line",min:"cmin",max:"cmax"}],calc:t("./calc"),moduleType:"trace",name:"scatter3d",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","symbols","showLegend","scatter-like"],meta:{}}},{"../../constants/gl3d_markers":478,"../../plots/gl3d":579,"./attributes":658,"./calc":659,"./convert":661,"./defaults":662}],664:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l={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:i({editType:"calc"},{keys:["tubex","tubey","tubez","tubeu","tubev","tubew","norm","divergence"]}),showlegend:s({},o.showlegend,{dflt:!1})};s(l,n("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}));["opacity","lightposition","lighting"].forEach((function(t){l[t]=a[t]})),l.hoverinfo=s({},o.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","divergence","text","name"],dflt:"x+y+z+norm+text+name"}),l.transforms=void 0,e.exports=l},{"../../components/colorscale/attributes":380,"../../lib/extend":495,"../../plots/attributes":545,"../../plots/template_attributes":601,"../mesh3d/attributes":623}],665:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorscale/calc");function a(t){var e,r,i,a,s,l,u,c,f,h,d,p,g=t._x,v=t._y,m=t._z,y=t._len,b=-1/0,x=1/0,_=-1/0,w=1/0,M=-1/0,A=1/0,T="";for(y&&(u=g[0],f=v[0],d=m[0]),y>1&&(c=g[y-1],h=v[y-1],p=m[y-1]),e=0;ec?"-":"+")+"x")).replace("y",(f>h?"-":"+")+"y")).replace("z",(d>p?"-":"+")+"z");var S=function(){y=0,k=[],E=[],L=[]};(!y||y2?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,c=e._len,f={};function p(t,e){var n=r[e],o=i[u[e]];return a.simpleMap(t,(function(t){return n.d2l(t)*o}))}if(f.vectors=l(p(e._u,"xaxis"),p(e._v,"yaxis"),p(e._w,"zaxis"),c),!c)return{positions:[],cells:[]};var g=p(e._Xs,"xaxis"),v=p(e._Ys,"yaxis"),m=p(e._Zs,"zaxis");if(f.meshgrid=[g,v,m],f.gridFill=e._gridFill,e._slen)f.startingPositions=l(p(e._startsX,"xaxis"),p(e._startsY,"yaxis"),p(e._startsZ,"zaxis"));else{for(var y=v[0],b=h(g),x=h(m),_=new Array(b.length*x.length),w=0,M=0;M0){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],a=t[0].shape[1],o=0|Math.floor(t[0].shape[0]*e+1),s=0|Math.floor(t[0].shape[1]*r+1),l=1+n+1,u=1+a+1,c=i(new Float32Array(l*u),[l,u]),f=[1/e,0,0,0,1/r,0,0,0,1],h=0;h0&&null!==this.contourStart[t]&&null!==this.contourEnd[t]&&this.contourEnd[t]>this.contourStart[t]))for(i[t]=!0,e=this.contourStart[t];ea&&(this.minValues[e]=a),this.maxValues[e]=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)}},{}],333:[function(t,e,r){(function(t){(function(){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],334:[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];(l=o-((r=a+o)-a))&&(t[--n]=r,r=l)}var s=0;for(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(l(t)),")};return robustDeterminant",t].join(""))(i,a,n,o)}var f=[function(){return[0]},function(t){return[t[0][0]]}];!function(){for(;f.length<6;)f.push(c(f.length));for(var t=[],r=["function robustDeterminant(m){switch(m.length){"],n=0;n<6;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);for(e.exports=i.apply(void 0,f.concat([f,c])),n=0;n>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function u(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 u(e,t)}function c(t){if(2===t.length)return[["diff(",u(t[0][0],t[1][1]),",",u(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 a=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];!function(){for(;a.length<6;)a.push(i(a.length));for(var t=[],r=["function dispatchLinearSolve(A,b){switch(A.length){"],n=0;n<6;++n)t.push("s"+n),r.push("case ",n,":return s",n,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);for(e.exports=o.apply(void 0,a.concat([a,i])),n=0;n<6;++n)e.exports[n]=a[n]}()},{"robust-determinant":335}],339:[function(t,e,r){"use strict";var n=t("two-product"),i=t("robust-sum"),a=t("robust-scale"),o=t("robust-subtract");function s(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function u(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=33306690738754716e-32*n;return o>=s||o<=-s?o:f(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],d=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)+d*(y-b),_=7771561172376103e-31*((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(d));return x>_||-x>_?x:h(t,e,r,n)}];function p(t){var e=d[t.length];return e||(e=d[t.length]=c(t.length)),e.apply(void 0,t)}!function(){for(;d.length<=5;)d.push(c(d.length));for(var t=[],r=["slow"],n=0;n<=5;++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<=5;++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);if(Math.max(u,c)=n?(i=f,(l+=1)=n?(i=f,(l+=1)0?1:0}},{}],346:[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":39,"reduce-simplicial-complex":331}],347:[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(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)if(e0){var t=T[0];return v(0,k-1),k-=1,b(0),t}return-1}function w(t,e){var r=T[t];return u[r]===e?t:(u[r]=-1/0,x(t),_(),u[r]=e,x((k+=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),A[e]>=0&&w(A[e],g(e)),A[r]>=0&&w(A[r],g(r))}}var T=[],A=new Array(a);for(f=0;f>1;f>=0;--f)b(f);for(;;){var E=_();if(E<0||u[E]>r)break;M(E)}var L=[];for(f=0;f=0&&r>=0&&e!==r){var n=A[e],i=A[r];n!==i&&C.push([n,i])}})),i.unique(i.normalize(C)),{positions:L,edges:C}};var n=t("robust-orientation"),i=t("simplicial-complex")},{"robust-orientation":339,"simplicial-complex":351}],354:[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":354,"binary-search-bounds":355,"functional-red-black-tree":94,"robust-orientation":339}],357:[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":336,"robust-sum":344}],358:[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(t){return i(o(t),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}function i(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}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var r,n=e,i=[],o=0;n;){if(null!==(r=t.text.exec(n)))i.push(r[0]);else if(null!==(r=t.modulo.exec(n)))i.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");i.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 a[e]=i}"undefined"!=typeof r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],359:[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(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&&(A="+"+v[x]+"*c");var k=p[x].length/y*.5,E=.5+m[x]/y*.5;T.push("d"+x+"-"+E+"-"+k+"*("+p[x].join("+")+A+")/("+g[x].join("+")+")")}h.push("a.push([",T.join(),"]);","break;")}a.push("}},"),f.length>0&&h.push("}}");var L=[];for(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(A,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(k,arguments)},splitcomplement:function(){return this._applyCombination(T,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]: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 D(t){return R(t)/255}var N,F,j,B=(F="[\\s|\\(]+("+(N="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+N+")[,|\\s]+("+N+")\\s*\\)?",j="[\\s|\\(]+("+N+")[,|\\s]+("+N+")[,|\\s]+("+N+")[,|\\s]+("+N+")\\s*\\)?",{CSS_UNIT:new RegExp(N),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)},{}],361:[function(t,e,r){"use strict";var n=t("parse-unit");e.exports=a;function i(t,e){var r=n(getComputedStyle(t).getPropertyValue(e));return r[0]*a(r[1],t)}function a(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=i(r,"font-size")/128;return e.removeChild(r),n}(t,e);case"em":return i(e,"font-size");case"rem":return i(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 96;case"cm":return 96/2.54;case"mm":return 96/25.4;case"pt":return 96/72;case"pc":return 16}return 1}},{"parse-unit":308}],362:[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,T=-v*b,A=-m*b,k=y,E=this.computedEye,L=this.computedMatrix;for(a=0;a<3;++a){var S=_*r[a]+w*h[a]+M*e[a];L[4*a+1]=T*r[a]+A*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],D=O*I-R*z,N=R*P-C*I,F=C*z-O*P,j=u(D,N,F);D/=j,N/=j,F/=j,L[0]=D,L[4]=N,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,M=u(b-=s*w,x-=l*w,_-=f*w),T=l*(_/=M)-f*(x/=M),A=f*(b/=M)-s*_,k=s*x-l*b,E=u(T,A,k);if(T/=E,A/=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*T+S*A+C*k;m=D<0?-Math.PI/2:Math.PI/2,y=Math.atan2(R,O)}else{var P=e[2],z=e[6],I=e[10],D=P*s+z*l+I*f,N=P*b+z*x+I*_,F=P*T+z*A+I*k;m=Math.asin(c(D)),y=Math.atan2(F,N)}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,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,q-j*Y,G-B*Y,X-U*Y)},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),T=i*l+a*f+o*h,A=g*l+v*f+m*h,k=(x/=M)*l+(_/=M)*f+(w/=M)*h,E=Math.asin(c(T)),L=Math.atan2(k,A),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 p(t){return new Uint8Array(d(t),0,t)}function g(t){return new Uint16Array(d(2*t),0,t)}function v(t){return new Uint32Array(d(4*t),0,t)}function m(t){return new Int8Array(d(t),0,t)}function y(t){return new Int16Array(d(2*t),0,t)}function b(t){return new Int32Array(d(4*t),0,t)}function x(t){return new Float32Array(d(4*t),0,t)}function _(t){return new Float64Array(d(8*t),0,t)}function w(t){return o?new Uint8ClampedArray(d(t),0,t):p(t)}function M(t){return s?new BigUint64Array(d(8*t),0,t):null}function T(t){return l?new BigInt64Array(d(8*t),0,t):null}function A(t){return new DataView(d(t),0,t)}function k(t){t=n.nextPow2(t);var e=n.log2(t),r=f[e];return r.length>0?r.pop():new a(t)}r.free=function(t){if(a.isBuffer(t))f[n.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|n.log2(e);c[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeBigUint64=r.freeInt8=r.freeInt16=r.freeInt32=r.freeBigInt64=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){h(t.buffer)},r.freeArrayBuffer=h,r.freeBuffer=function(t){f[n.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return d(t);switch(e){case"uint8":return p(t);case"uint16":return g(t);case"uint32":return v(t);case"int8":return m(t);case"int16":return y(t);case"int32":return b(t);case"float":case"float32":return x(t);case"double":case"float64":return _(t);case"uint8_clamped":return w(t);case"bigint64":return T(t);case"biguint64":return M(t);case"buffer":return k(t);case"data":case"dataview":return A(t);default:return null}return null},r.mallocArrayBuffer=d,r.mallocUint8=p,r.mallocUint16=g,r.mallocUint32=v,r.mallocInt8=m,r.mallocInt16=y,r.mallocInt32=b,r.mallocFloat32=r.mallocFloat=x,r.mallocFloat64=r.mallocDouble=_,r.mallocUint8Clamped=w,r.mallocBigUint64=M,r.mallocBigInt64=T,r.mallocDataView=A,r.mallocBuffer=k,r.clearCache=function(){for(var t=0;t<32;++t)u.UINT8[t].length=0,u.UINT16[t].length=0,u.UINT32[t].length=0,u.INT8[t].length=0,u.INT16[t].length=0,u.INT32[t].length=0,u.FLOAT[t].length=0,u.DOUBLE[t].length=0,u.BIGUINT64[t].length=0,u.BIGINT64[t].length=0,u.UINT8C[t].length=0,c[t].length=0,f[t].length=0}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":37,buffer:49,dup:87}],367:[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",h(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(d=0;d-1?parseInt(t[1+i]):0,l=a>-1?parseInt(r[1+a]):0;s!==l&&(n=n.replace(E(),"?px "),v*=Math.pow(.75,l-s),n=n.replace("?px ",E())),g+=.25*b*(l-s)}if(!0===o.superscripts){var u=t.indexOf("+"),c=r.indexOf("+"),f=u>-1?parseInt(t[1+u]):0,h=c>-1?parseInt(r[1+c]):0;f!==h&&(n=n.replace(E(),"?px "),v*=Math.pow(.75,h-f),n=n.replace("?px ",E())),g-=.25*b*(h-f)}if(!0===o.bolds){var d=t.indexOf("b|")>-1,p=r.indexOf("b|")>-1;!d&&p&&(n=m?n.replace("italic ","italic bold "):"bold "+n),d&&!p&&(n=n.replace("bold ",""))}if(!0===o.italics){var m=t.indexOf("i|")>-1,y=r.indexOf("i|")>-1;!m&&y&&(n="italic "+n),m&&!y&&(n=n.replace("italic ",""))}e.font=n}for(h=0;h",a="",o=i.length,s=a.length,l="+"===e[0]||"-"===e[0],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,p=r.substr(d,c-d).indexOf(i);u=-1!==p?p:c+s}return n}function c(t,e){var r=n(t,128);return e?a(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function f(t,e,r,n){var i=c(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:y((function(e){var n=m(e);return n?r in n:t.indexOf(e)>=0}))},set___:{value:y((function(n,i){var a,o=m(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:y((function(n){var i,a,o=m(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)}))}})};p.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 p||b();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 p),i.set(t,e)),this}:function(t,e){if(a)try{n.set(t,e)}catch(r){i||(i=new p),i.set___(t,e)}else n.set(t,e);return this},Object.create(p.prototype,{get___:{value:y((function(t,e){return i?n.has(t)?n.get(t):i.get___(t,e):n.get(t,e)}))},has___:{value:y((function(t){return n.has(t)||!!i&&i.has___(t)}))},set___:{value:y(e)},delete___:{value:y((function(t){var e=!!n.delete(t);return i&&i.delete___(t)||e}))},permitHostObjects___:{value:y((function(t){if(t!==g)throw new Error("bogus call to permitHostObjects___");a=!0}))}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=p.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=p)}function g(t){t.permitHostObjects___&&t.permitHostObjects___(g)}function v(t){return!("weakmap:"==t.substr(0,"weakmap:".length)&&"___"===t.substr(t.length-3))}function m(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[l];if(e&&e.key===t)return e;if(s(t)){e={key:t};try{return o(t,l,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function y(t){return t.prototype=null,Object.freeze(t)}function b(){h||"undefined"==typeof console||(h=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},{}],372:[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":373}],373:[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}},{}],374:[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":372}],375:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":96}],376:[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}],377:[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":376}],378:[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}]},{}],379:[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;t("../../constants/axis_placeable_objects");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"}}})},{"../../constants/axis_placeable_objects":497,"../../plot_api/plot_template":560,"../../plots/cartesian/constants":577,"../../plots/font_attributes":599,"./arrow_paths":378}],380:[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),a=i.getRefType(e.xref),o=i.getRefType(e.yref);e._extremes={},"range"===a&&s(e,r),"range"===o&&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":524,"../../plots/cartesian/axes":571,"./draw":385}],381:[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 Y=!1,W=["x","y"],Z=0;Z1)&&(nt===rt?((dt=it.r2fraction(e["a"+et]))<0||dt>1)&&(Y=!0):Y=!0),Q=it._offset+it.r2p(e[et]),$=.5}else{var pt="domain"===ht;"x"===et?(J=e[et],Q=pt?it._offset+it._length*J:Q=M.l+M.w*J):(J=1-e[et],Q=pt?it._offset+it._length*J:Q=M.t+M.h*J),$=e.showarrow?.5:J}if(e.showarrow){ft.head=Q;var gt=e["a"+et];if(tt=ot*q(.5,e.xanchor)-st*q(.5,e.yanchor),nt===rt){var vt=l.getRefType(nt);"domain"===vt?("y"===et&&(gt=1-gt),ft.tail=it._offset+it._length*gt):"paper"===vt?"y"===et?(gt=1-gt,ft.tail=M.t+M.h*gt):ft.tail=M.l+M.w*gt:ft.tail=it._offset+it.r2p(gt),K=tt}else ft.tail=Q+gt,K=tt+gt;ft.text=ft.tail+tt;var mt=w["x"===et?"width":"height"];if("paper"===rt&&(ft.head=o.constrain(ft.head,1,mt-1)),"pixel"===nt){var yt=-Math.max(ft.tail-3,ft.text),bt=Math.min(ft.tail+3,ft.text)-mt;yt>0?(ft.tail+=yt,ft.text+=yt):bt>0&&(ft.tail-=bt,ft.text-=bt)}ft.tail+=ct,ft.head+=ct}else K=tt=lt*q($,ut),ft.text=Q+tt;ft.text+=ct,tt+=ct,K+=ct,e["_"+et+"padplus"]=lt/2+K,e["_"+et+"padminus"]=lt/2-K,e["_"+et+"size"]=lt,e["_"+et+"shift"]=tt}if(Y)D.remove();else{var xt=0,_t=0;if("left"!==e.align&&(xt=(A-x)*("center"===e.align?.5:1)),"top"!==e.valign&&(_t=(I-_)*("middle"===e.valign?.5:1)),f)n.select("svg").attr({x:j+xt-1,y:j+_t}).call(c.setClipUrl,U?S:null,t);else{var wt=j+_t-g.top,Mt=j+xt-g.left;G.call(h.positionText,Mt,wt).call(c.setClipUrl,U?S:null,t)}V.select("rect").call(c.setRect,j,j,A,I),B.call(c.setRect,N/2,N/2,F-N,H-N),D.call(c.setTranslate,Math.round(C.x.text-F/2),Math.round(C.y.text-H/2)),P.attr({transform:"rotate("+O+","+C.x.text+","+C.y.text+")"});var Tt,At=function(r,n){R.selectAll(".annotation-arrow-g").remove();var l=C.x.head,f=C.y.head,h=C.x.tail+r,d=C.y.tail+n,g=C.x.text+r,x=C.y.text+n,_=o.rotationXYMatrix(O,g,x),w=o.apply2DTransform(_),A=o.apply2DTransform2(_),S=+B.attr("width"),z=+B.attr("height"),I=g-.5*S,N=I+S,F=x-.5*z,j=F+z,U=[[I,F,I,j],[I,j,N,j],[N,j,N,F],[N,F,I,F]].map(A);if(!U.reduce((function(t,e){return t^!!o.segmentsIntersect(l,f,l+1e6,f+1e6,e[0],e[1],e[2],e[3])}),!1)){U.forEach((function(t){var e=o.segmentsIntersect(h,d,l,f,t[0],t[1],t[2],t[3]);e&&(h=e.x,d=e.y)}));var V=e.arrowwidth,H=e.arrowcolor,q=e.arrowside,G=R.append("g").style({opacity:u.opacity(H)}).classed("annotation-arrow-g",!0),X=G.append("path").attr("d","M"+h+","+d+"L"+l+","+f).style("stroke-width",V+"px").call(u.stroke,u.rgb(H));if(v(X,q,e),T.annotationPosition&&X.node().parentNode&&!a){var Y=l,W=f;if(e.standoff){var Z=Math.sqrt(Math.pow(l-h,2)+Math.pow(f-d,2));Y+=e.standoff*(h-l)/Z,W+=e.standoff*(d-f)/Z}var Q,K,J=G.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-Y)+","+(d-W),transform:s(Y,W)}).style("stroke-width",V+6+"px").call(u.stroke,"rgba(0,0,0,0)").call(u.fill,"rgba(0,0,0,0)");p.init({element:J.node(),gd:t,prepFn:function(){var t=c.getTranslate(D);Q=t.x,K=t.y,m&&m.autorange&&k(m._name+".autorange",!0),b&&b.autorange&&k(b._name+".autorange",!0)},moveFn:function(t,r){var n=w(Q,K),i=n[0]+t,a=n[1]+r;D.call(c.setTranslate,i,a),E("x",y(m,t,"x",M,e)),E("y",y(b,r,"y",M,e)),e.axref===e.xref&&E("ax",y(m,t,"ax",M,e)),e.ayref===e.yref&&E("ay",y(b,r,"ay",M,e)),G.attr("transform",s(t,r)),P.attr({transform:"rotate("+O+","+i+","+a+")"})},doneFn:function(){i.call("_guiRelayout",t,L());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&At(0,0),z)p.init({element:D.node(),gd:t,prepFn:function(){Tt=P.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?E("ax",y(m,t,"ax",M,e)):E("ax",e.ax+t),e.ayref===e.yref?E("ay",y(b,r,"ay",M.w,e)):E("ay",e.ay+r),At(t,r);else{if(a)return;var i,o;if(m)i=y(m,t,"x",M,e);else{var l=e._xsize/M.w,u=e.x+(e._xshift-e.xshift)/M.w-l/2;i=p.align(u+t/M.w,l,0,1,e.xanchor)}if(b)o=y(b,r,"y",M,e);else{var c=e._ysize/M.h,f=e.y-(e._yshift+e.yshift)/M.h-c/2;o=p.align(f-r/M.h,c,0,1,e.yanchor)}E("x",i),E("y",o),m&&b||(n=p.getCursor(m?.5:i,b?.5:o,e.xanchor,e.yanchor))}P.attr({transform:s(t,r)+Tt}),d(D,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",X(n))},doneFn:function(){d(D),i.call("_guiRelayout",t,L());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,b=e.indexOf("end")>=0,x=p.backoff*v+r.standoff,_=g.backoff*m+r.startstandoff;if("line"===d.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},c={x:+t.attr("x2"),y:+t.attr("y2")};var w=o.x-c.x,M=o.y-c.y;if(h=(f=Math.atan2(M,w))+Math.PI,x&&_&&x+_>Math.sqrt(w*w+M*M))return void z();if(x){if(x*x>w*w+M*M)return void z();var T=x*Math.cos(f),A=x*Math.sin(f);c.x+=T,c.y+=A,t.attr({x2:c.x,y2:c.y})}if(_){if(_*_>w*w+M*M)return void z();var k=_*Math.cos(f),E=_*Math.sin(f);o.x-=k,o.y-=E,t.attr({x1:o.x,y1:o.y})}}else if("path"===d.nodeName){var L=d.getTotalLength(),S="";if(L1){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":611,"../annotations/draw":385}],392:[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?n>=l:n<=l));i++)n>c&&n0?n>=l:n<=l));i++)n>r[0]&&n1){var Q=Math.pow(10,Math.floor(Math.log(Z)/Math.LN10));Y*=Q*u.roundUp(Z/Q,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(X.tick0=0)}X.dtick=Y}X.domain=[H+B,H+N-B],X.setScale(),t.attr("transform",c(Math.round(l.l),Math.round(l.t)));var K,J=t.select("."+A.cbtitleunshift).attr("transform",c(-Math.round(l.l),-Math.round(l.t))),$=t.select("."+A.cbaxis),tt=0;function et(n,i){var a={propContainer:X,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+A.cbtitle)},s="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+s+",."+s+"-math-group").remove(),g.draw(r,n,f(a,i||{}))}return u.syncOrAsync([a.previousPromises,function(){if(-1!==["top","bottom"].indexOf(k)){var t,r=l.l+(e.x+F)*l.w,n=X.title.font.size;t="top"===k?(1-(H+N-B))*l.h+l.t+3+.75*n:(1-(H+B))*l.h+l.t-3-.25*n,et(X._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(k)){var a=t.select("."+A.cbtitle),o=a.select("text"),f=[-e.outlinewidth/2,e.outlinewidth/2],h=a.select(".h"+X._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*w),h?(tt=d.bBox(h).height)>p&&(f[1]-=(tt-p)/2):o.node()&&!o.classed(A.jsPlaceholder)&&(tt=d.bBox(o.node()).height),tt){if(tt+=5,"top"===k)X.domain[1]-=tt/l.h,f[1]*=-1;else{X.domain[0]+=tt/l.h;var g=v.lineCount(o);f[1]+=(1-g)*p}a.attr("transform",c(f[0],f[1])),X.setScale()}}t.selectAll("."+A.cbfills+",."+A.cblines).attr("transform",c(0,Math.round(l.h*(1-X.domain[1])))),$.attr("transform",c(0,Math.round(-l.t)));var y=t.select("."+A.cbfills).selectAll("rect."+A.cbfill).attr("style","").data(R);y.enter().append("rect").classed(A.cbfill,!0).style("stroke","none"),y.exit().remove();var b=E.map(X.c2p).map(Math.round).sort((function(t,e){return t-e}));y.each((function(t,a){var o=[0===a?E[0]:(R[a]+R[a-1])/2,a===R.length-1?E[1]:(R[a]+R[a+1])/2].map(X.c2p).map(Math.round);o[1]=u.constrain(o[1]+(o[1]>o[0])?1:-1,b[0],b[1]);var s=n.select(this).attr({x:U,width:Math.max(z,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)d.gradient(s,r,e._id,"vertical",e._fillgradient,"fill");else{var l=S(t).replace("e-","");s.attr("fill",i(l).toHexString())}}));var x=t.select("."+A.cblines).selectAll("path."+A.cbline).data(m.color&&m.width?P:[]);x.enter().append("path").classed(A.cbline,!0),x.exit().remove(),x.each((function(t){n.select(this).attr("d","M"+U+","+(Math.round(X.c2p(t))+m.width/2%1)+"h"+z).call(d.lineGroupStyle,m.width,L(t),m.dash)})),$.selectAll("g."+X._id+"tick,path").remove();var _=U+z+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),M=s.calcTicks(X),T=s.getTickSigns(X)[2];return s.drawTicks(r,X,{vals:"inside"===X.ticks?s.clipEnds(X,M):M,layer:$,path:s.makeTickPath(X,_,T),transFn:s.makeTransTickFn(X)}),s.drawLabels(r,X,{vals:M,layer:$,transFn:s.makeTransTickLabelFn(X),labelFns:s.makeLabelFns(X,_)})},function(){if(-1===["top","bottom"].indexOf(k)){var t=X.title.font.size,e=X._offset+X._length/2,i=l.l+(X.position||0)*l.w+("right"===X.side?10+t*(X.showticklabels?1:.5):-10-t*(X.showticklabels?.5:0));et("h"+X._id+"title",{avoid:{selection:n.select(r).selectAll("g."+X._id+"tick"),side:k,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:i,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},a.previousPromises,function(){var n=z+e.outlinewidth/2;if(-1===X.ticklabelposition.indexOf("inside")&&(n+=d.bBox($.node()).width),(K=J.select("text")).node()&&!K.classed(A.jsPlaceholder)){var i,o=J.select(".h"+X._id+"title-math-group").node();i=o&&-1!==["top","bottom"].indexOf(k)?d.bBox(o).width:d.bBox(J.node()).right-U-l.l,n=Math.max(n,i)}var s=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,u=q-G;t.select("."+A.cbbg).attr({x:U-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:G-j,width:Math.max(s,2),height:Math.max(u+2*j,2)}).call(p.fill,e.bgcolor).call(p.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+A.cboutline).attr({x:U,y:G+e.ypad+("top"===k?tt:0),width:Math.max(z,2),height:Math.max(u-2*e.ypad-tt,2)}).call(p.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var f=({center:.5,right:1}[e.xanchor]||0)*s;t.attr("transform",c(l.l-f,l.t));var h={},g=M[e.yanchor],v=T[e.yanchor];"pixels"===e.lenmode?(h.y=e.y,h.t=u*g,h.b=u*v):(h.t=h.b=0,h.yt=e.y+e.len*g,h.yb=e.y-e.len*v);var m=M[e.xanchor],y=T[e.xanchor];if("pixels"===e.thicknessmode)h.x=e.x,h.l=s*m,h.r=s*y;else{var b=s-z;h.l=b*m,h.r=b*y,h.xl=e.x-e.thickness*m,h.xr=e.x+e.thickness*y}a.autoMargin(r,e._id,h)}],r)}(r,e,t);m&&m.then&&(t._promises||[]).push(m),t._context.edits.colorbarPosition&&function(t,e,r){var n,i,a,s=r._fullLayout._size;l.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),h(t)},moveFn:function(r,o){t.attr("transform",n+c(r,o)),i=l.align(e._xLeftFrac+r/s.w,e._thickFrac,0,1,e.xanchor),a=l.align(e._yBottomFrac-o/s.h,e._lenFrac,0,1,e.yanchor);var u=l.getCursor(i,a,e.xanchor,e.yanchor);h(t,u)},doneFn:function(){if(h(t),void 0!==i&&void 0!==a){var n={};n[e._propPrefix+"x"]=i,n[e._propPrefix+"y"]=a,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){a.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":496,"../../lib":524,"../../lib/extend":517,"../../lib/setcursor":543,"../../lib/svg_text_utils":547,"../../plots/cartesian/axes":571,"../../plots/cartesian/axis_defaults":573,"../../plots/cartesian/layout_attributes":585,"../../plots/cartesian/position_defaults":588,"../../plots/plots":616,"../../registry":625,"../color":394,"../colorscale/helpers":405,"../dragelement":413,"../drawing":416,"../titles":489,"./constants":396,d3:82,tinycolor2:360}],399:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":524}],400:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":395,"./defaults":397,"./draw":398,"./has_colorbar":399}],401:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),i=t("../../lib/regex").counter,a=t("./scales.js").scales;Object.keys(a);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,s=(e=e||{}).cLetter||"c",l=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),u="showScaleDflt"in e?e.showScaleDflt:"z"===s,c="string"==typeof e.colorscaleDflt?a[e.colorscaleDflt]:null,f=e.editTypeOverride||"",h=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(h+(r={z:"z",c:"color"}[s]));var d=s+"auto",p=s+"min",g=s+"max",v=s+"mid",m=(o(h+d),o(h+p),o(h+g),{});m[p]=m[g]=void 0;var y={};y[d]=!1;var b={};return"color"===r&&(b.color={valType:"color",arrayOk:!0,editType:f||"style"},e.anim&&(b.color.anim=!0)),b[d]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:m},b[p]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},b[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},b[v]={valType:"number",dflt:null,editType:"calc",impliedEdits:m},b.colorscale={valType:"colorscale",editType:"calc",dflt:c,impliedEdits:{autocolorscale:!1}},b.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},b.reversescale={valType:"boolean",dflt:!1,editType:"plot"},l||(b.showscale={valType:"boolean",dflt:u,editType:"calc"},b.colorbar=n),e.noColorAxis||(b.coloraxis={valType:"subplotid",regex:i("coloraxis"),dflt:null,editType:"calc"}),b}},{"../../lib/regex":539,"../colorbar/attributes":395,"./scales.js":409}],402:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,s=t._fullLayout,l=r.vals,u=r.containerStr,c=u?i.nestedProperty(e,u).get():e,f=a(c),h=!1!==f.auto,d=f.min,p=f.max,g=f.mid,v=function(){return i.aggNums(Math.min,null,l)},m=function(){return i.aggNums(Math.max,null,l)};(void 0===d?d=v():h&&(d=c._colorAx&&n(d)?Math.min(d,v()):v()),void 0===p?p=m():h&&(p=c._colorAx&&n(p)?Math.max(p,m()):m()),h&&void 0!==g&&(p-g>g-d?d=g-(p-g):p-g=0?s.colorscale.sequential:s.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":524,"./helpers":405,"fast-isnumeric":91}],403:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./helpers").hasColorscale,a=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,i){var o=i.container?n.nestedProperty(t,i.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var s=a(o),l=s.auto;(l||void 0===s.min)&&r(o,i.min),(l||void 0===s.max)&&r(o,i.max),s.autocolorscale&&r(o,"colorscale")}}for(var s=0;s=0;n--,i++){var a=t[n];r[i]=[1-a[0],a[1]]}return r}function p(t,e){e=e||{};for(var r=t.domain,o=t.range,l=o.length,u=new Array(l),c=0;c4/3-s?o:s}},{}],411:[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":524}],412:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],413:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),i=t("has-hover"),a=t("has-passive-events"),o=t("../../lib").removeElement,s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");function c(){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 f(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){var e,r,n,u,h,d,p,g,v=t.gd,m=1,y=v._context.doubleClickDelay,b=t.element;v._mouseDownTime||(v._mouseDownTime=0),b.style.pointerEvents="all",b.onmousedown=_,a?(b._ontouchstart&&b.removeEventListener("touchstart",b._ontouchstart),b._ontouchstart=_,b.addEventListener("touchstart",_,{passive:!1})):b.ontouchstart=_;var x=t.clampFn||function(t,e,r){return Math.abs(t)y&&(m=Math.max(m-1,1)),v._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(m,d),!g){var r;try{r=new MouseEvent("click",e)}catch(t){var n=f(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)}p.dispatchEvent(r)}v._dragging=!1,v._dragged=!1}else v._dragged=!1}},l.coverSlip=c},{"../../lib":524,"../../plots/cartesian/constants":577,"./align":410,"./cursor":411,"./unhover":414,"has-hover":267,"has-passive-events":268,"mouse-event-offset":290}],414:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/dom").getGraphDiv,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/dom":515,"../../lib/events":516,"../../lib/throttle":548,"../fx/constants":428}],415:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],416:[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=u.strTranslate,f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),d=t("../../constants/alignment").LINE_SPACING,p=t("../../constants/interactions").DESELECTDIM,g=t("../../traces/scatter/subtypes"),v=t("../../traces/scatter/make_bubble_size_func"),m=t("../../components/fx/helpers").appendArrayPointValue,y=e.exports={};y.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)},y.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},y.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},y.setRect=function(t,e,r,n,i){t.call(y.setPosition,e,r).call(y.setSize,n,i)},y.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",c(a,o)),!0)},y.translatePoints=function(t,e,r){t.each((function(t){var i=n.select(this);y.translatePoint(t,i,e,r)}))},y.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},y.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,i=e.yaxis;t.each((function(e){var a=e[0].trace,s=a.xcalendar,l=a.ycalendar,u=o.traceIs(a,"bar-like")?".bartext":".point,.textpoint";t.selectAll(u).each((function(t){y.hideOutsideRangePoint(t,n.select(this),r,i,s,l)}))}))}},y.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},y.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),y.dashLine(e,l,o)},y.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(y.dashLine,l,o)}))},y.dashLine=function(t,e,r){r=+r||0,e=y.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},y.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},y.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},y.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 b=t("./symbol_defs");y.symbolNames=[],y.symbolFuncs=[],y.symbolNeedLines={},y.symbolNoDot={},y.symbolNoFill={},y.symbolList=[],Object.keys(b).forEach((function(t){var e=b[t],r=e.n;y.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),y.symbolNames[r]=t,y.symbolFuncs[r]=e.f,e.needLine&&(y.symbolNeedLines[r]=!0),e.noDot?y.symbolNoDot[r]=!0:y.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(y.symbolNoFill[r]=!0)}));var x=y.symbolNames.length;function _(t,e){var r=t%100;return y.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}y.symbolNumber=function(t){if(i(t))t=+t;else 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=y.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=x||t>=400?0:Math.floor(Math.max(t,0))};var w={x1:1,x2:0,y1:0,y2:0},M={x1:0,x2:0,y1:1,y2:0},T=n.format("~.1f"),A={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:w},horizontalreversed:{node:"linearGradient",attrs:w,reversed:!0},vertical:{node:"linearGradient",attrs:M},verticalreversed:{node:"linearGradient",attrs:M,reversed:!0}};y.gradient=function(t,e,r,i,o,l){for(var c=o.length,f=A[i],h=new Array(c),d=0;d"+m(t);p._gradientUrlQueryParts[y]=1},y.initGradients=function(t){var e=t._fullLayout;u.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},y.pointStyle=function(t,e,r){if(t.size()){var i=y.makePointStyleFns(e);t.each((function(t){y.singlePointStyle(t,n.select(this),e,i,r)}))}},y.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=y.symbolNumber(t.mx||a.symbol)||0;t.om=c%200>=100,e.attr("d",_(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",(t.isBlank?0:d)+"px");var v=a.gradient,m=t.mgt;if(m?p=!0:m=v&&v.type,Array.isArray(m)&&(m=m[0],A[m]||(m=0)),m&&"none"!==m){var b=t.mgc;b?p=!0:b=v.color;var x=r.uid;p&&(x+="-"+t.i),y.gradient(e,i,x,m,[[0,b],[1,f]],"fill")}else s.fill(e,f);d&&s.stroke(e,h)}},y.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=y.tryColorscale(r,""),e.lineScale=y.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=g.isBubble(t)?v(t):function(){return(r.size||6)/2}),t.selectedpoints&&u.extendFlat(e,y.makeSelectedPointStyleFns(t)),e},y.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,d=void 0!==f;(u.isArrayOrTypedArray(l)||h||d)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?i.opacity:t.mo;return t.selected?h?c:e:d?f:p*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},y.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,p))},e},y.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.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",_(y.symbolNumber(n),a)),e.mrc2=a})),a.length&&t.each((function(t){for(var e=n.select(this),r=0;r0?r:0}y.textPointStyle=function(t,e,r){if(t.size()){var i;if(e.selectedpoints){var a=y.makeSelectedTextStyleFns(e);i=a.selectedTextColorFn}var o=e.texttemplate,s=r._fullLayout;t.each((function(t){var a=n.select(this),l=o?u.extractOption(t,e,"txt","texttemplate"):u.extractOption(t,e,"tx","text");if(l||0===l){if(o){var c=e._module.formatLabels?e._module.formatLabels(t,e,s):{},h={};m(h,e,t.i);var d=e._meta||{};l=u.texttemplateString(l,c,s._d3locale,h,t,d)}var p=t.tp||e.textposition,g=L(t,e),v=i?i(t):t.tc||e.textfont.color;a.call(y.font,t.tf||e.textfont.family,g,v).text(l).call(f.convertToTspans,r).call(E,p,g,t.mrc)}else a.remove()}))}},y.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.makeSelectedTextStyleFns(e);t.each((function(t){var i=n.select(this),a=r.selectedTextColorFn(t),o=t.tp||e.textposition,l=L(t,e);s.fill(i,a),E(i,o,l,t.mrc2||t.mrc)}))}};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,.25),c=Math.pow(s*s+l*l,.25),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)]]}y.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&&(y.savedBBoxes={},R=0),r&&(y.savedBBoxes[r]=v),R++,u.extendFlat({},v)},y.setClipUrl=function(t,e,r){t.attr("clip-path",z(e,r))},y.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}},y.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+=c(e,r)).trim(),t[i]("transform",a),a},y.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}},y.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 I=/\s*sc.*/;y.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(I,"");t=(t+=n).trim(),this.setAttribute("transform",t)}))}};var D=/translate\([^)]*\)\s*$/;y.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(D);t=1===e&&1===r?[]:[c(o,s),"scale("+e+","+r+")",c(-o,-s)],l&&t.push(l),i.attr("transform",t.join(""))}}))}},{"../../components/fx/helpers":430,"../../constants/alignment":496,"../../constants/interactions":501,"../../constants/xmlns_namespaces":503,"../../lib":524,"../../lib/svg_text_utils":547,"../../registry":625,"../../traces/scatter/make_bubble_size_func":671,"../../traces/scatter/subtypes":679,"../color":394,"../colorscale":406,"./symbol_defs":417,d3:82,"fast-isnumeric":91,tinycolor2:360}],417:[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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:82}],418:[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"}}}},{}],419:[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":679,"../drawing":416,d3:82,"fast-isnumeric":91}],424:[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":394,d3:82}],425:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("./layout_attributes").hoverlabel,a=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:a({},i.bgcolor,{arrayOk:!0}),bordercolor:a({},i.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:a({},i.align,{arrayOk:!0}),namelength:a({},i.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":517,"../../plots/font_attributes":599,"./layout_attributes":435}],426:[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.indexx[0]._length||tt<0||tt>_[0]._length)return p.unhoverRaw(t,e)}if(e.pointerX=$+x[0]._offset,e.pointerY=tt+_[0]._offset,S="xval"in e?m.flat(s,e.xval):m.p2c(x,$),O="yval"in e?m.flat(s,e.yval):m.p2c(_,tt),!i(S[0])||!i(O[0]))return o.warn("Fx.hover failed",e,t),p.unhoverRaw(t,e)}var nt=1/0;function it(t,r){for(N=0;NX&&(Z.splice(0,X),nt=Z[0].distance),g&&0!==W&&0===Z.length){G.distance=W,G.index=!1;var f=j._module.hoverPoints(G,H,q,"closest",l._hoverlayer);if(f&&(f=f.filter((function(t){return t.spikeDistance<=W}))),f&&f.length){var h,p=f.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(p.length){var v=p[0];i(v.x0)&&i(v.y0)&&(h=ot(v),(!K.vLinePoint||K.vLinePoint.spikeDistance>h.spikeDistance)&&(K.vLinePoint=h))}var y=f.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(y.length){var b=y[0];i(b.x0)&&i(b.y0)&&(h=ot(b),(!K.hLinePoint||K.hLinePoint.spikeDistance>h.spikeDistance)&&(K.hLinePoint=h))}}}}}function at(t,e){for(var r,n=null,i=1/0,a=0;a1||Z.length>1)||"closest"===E&&J&&Z.length>1,kt=d.combine(l.plot_bgcolor||d.background,l.paper_bgcolor),Et={hovermode:E,rotateLabels:At,bgColor:kt,container:l._hoverlayer,outerContainer:l._paperdiv,commonLabelOpts:l.hoverlabel,hoverdistance:l.hoverdistance},Lt=C(Z,Et,t);m.isUnifiedHover(E)||(!function(t,e,r){var n,i,a,o,s,l,u,c=0,f=1,h=t.size(),d=new Array(h),p=0;function g(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--)}}}t.each((function(t){var n=t[e],i="x"===n._id.charAt(0),a=n.range;0===p&&a&&a[0]>a[1]!==i&&(f=-1),d[p++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(i?M:1)/2,pmin:0,pmax:i?r.width:r.height}]})),d.sort((function(t,e){return t[0].posref-e[0].posref||f*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&c<=h;){for(c++,n=!0,o=0;o.01&&y.pmin===b.pmin&&y.pmax===b.pmax){for(s=m.length-1;s>=0;s--)m[s].dp+=i;for(v.push.apply(v,m),d.splice(o+1,1),u=0,s=v.length-1;s>=0;s--)u+=v[s].dp;for(a=u/v.length,s=v.length-1;s>=0;s--)v[s].dp-=a;n=!1}else o++}d.forEach(g)}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}}}(Lt,At?"xa":"ya",l),R(Lt,At,l._invScaleX,l._invScaleY));if(e.target&&e.target.tagName){var St=v.getComponentMethod("annotations","hasClickToShow")(t,_t);f(n.select(e.target),St?"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,xt))return;xt&&t.emit("plotly_unhover",{event:e,points:xt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:x,yaxes:_,xvals:S,yvals:O})}(t,e,r,a)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var i=t.map((function(t){return{color:t.color||d.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,nameLength:t.nameLength,textAlign:t.textAlign,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}})),a=n.select(e.container),o=e.outerContainer?n.select(e.outerContainer):a,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||d.background,container:a,outerContainer:o},l=C(i,s,e.gd),u=0,c=0;l.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function C(t,e,r){var i=r._fullLayout,a=e.hovermode,u=e.rotateLabels,f=e.bgColor,p=e.container,g=e.outerContainer,v=e.commonLabelOpts||{},w=e.fontFamily||y.HOVERFONT,M=e.fontSize||y.HOVERFONTSIZE,T=t[0],A=T.xa,S=T.ya,C="y"===a.charAt(0)?"yLabel":"xLabel",R=T[C],P=(String(R)||"").split(" ")[0],z=g.node().getBoundingClientRect(),I=z.top,D=z.width,N=z.height,F=void 0!==R&&T.distance<=e.hoverdistance&&("x"===a||"y"===a);if(F){var j,B,U=!0;for(j=0;ji.width-L?(y=i.width-L,l.attr("d","M"+(L-k)+",0L"+L+","+_+k+"v"+_+(2*E+x.height)+"H-"+L+"V"+_+k+"H"+(L-2*k)+"Z")):l.attr("d","M0,0L"+k+","+_+k+"H"+(E+x.width/2)+"v"+_+(2*E+x.height)+"H-"+(E+x.width/2)+"V"+_+k+"H-"+k+"Z")}else{var C,O,P;"right"===S.side?(C="start",O=1,P="",y=A._offset+A._length):(C="end",O=-1,P="-",y=A._offset),b=S._offset+(T.y0+T.y1)/2,u.attr("text-anchor",C),l.attr("d","M0,0L"+P+k+","+k+"V"+(E+x.height/2)+"h"+P+(2*E+x.width)+"V-"+(E+x.height/2)+"H"+P+k+"V-"+k+"Z");var z,D=x.height/2,N=I-x.top-D,F="clip"+i._uid+"commonlabel"+S._id;if(y=0?et-=it:et+=2*E;var at=nt.height+2*E,ot=tt+at>=N;return at<=N&&(tt<=I?tt=S._offset+2*E:ot&&(tt=N-at)),rt.attr("transform",s(et,tt)),rt}var st=p.selectAll("g.hovertext").data(t,(function(t){return L(t)}));return st.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(d.fill,d.addOpacity(f,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(h.font,w,M)})),st.exit().remove(),st.each((function(t){var e=n.select(this).attr("transform",""),o=t.color;Array.isArray(o)&&(o=o[t.eventData[0].pointNumber]);var p=t.bgcolor||o,g=d.combine(d.opacity(p)?p:d.defaultLine,f),v=d.combine(d.opacity(o)?o:d.defaultLine,f),m=t.borderColor||d.contrast(g),y=O(t,F,a,i,R,e),b=y[0],x=y[1],T=e.select("text.nums").call(h.font,t.fontFamily||w,t.fontSize||M,t.fontColor||m).text(b).attr("data-notex",1).call(c.positionText,0,0).call(c.convertToTspans,r),A=e.select("text.name"),L=0,S=0;if(x&&x!==b){A.call(h.font,t.fontFamily||w,t.fontSize||M,v).text(x).attr("data-notex",1).call(c.positionText,0,0).call(c.convertToTspans,r);var C=A.node().getBoundingClientRect();L=C.width+2*E,S=C.height+2*E}else A.remove(),e.select("rect").remove();e.select("path").style({fill:g,stroke:m});var P,z,j=T.node().getBoundingClientRect(),B=t.xa._offset+(t.x0+t.x1)/2,U=t.ya._offset+(t.y0+t.y1)/2,V=Math.abs(t.x1-t.x0),H=Math.abs(t.y1-t.y0),q=j.width+k+E+L;if(t.ty0=I-j.top,t.bx=j.width+2*E,t.by=Math.max(j.height+2*E,S),t.anchor="start",t.txwidth=j.width,t.tx2width=L,t.offset=0,u)t.pos=B,P=U+H/2+q<=N,z=U-H/2-q>=0,"top"!==t.idealAlign&&P||!z?P?(U+=H/2,t.anchor="start"):t.anchor="middle":(U-=H/2,t.anchor="end");else if(t.pos=U,P=B+V/2+q<=D,z=B-V/2-q>=0,"left"!==t.idealAlign&&P||!z)if(P)B+=V/2,t.anchor="start";else{t.anchor="middle";var G=q/2,X=B+G-D,Y=B-G;X>0&&(B-=X),Y<0&&(B+=-Y)}else B-=V/2,t.anchor="end";T.attr("text-anchor",t.anchor),L&&A.attr("text-anchor",t.anchor),e.attr("transform",s(B,U)+(u?l(_):""))})),st}function O(t,e,r,n,i,a){var s="",l="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),s=D(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(l+=(l?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===i?l=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(l+=(l?"
":"")+t.text),void 0!==t.extraText&&(l+=(l?"
":"")+t.extraText),a&&""===l&&!t.hovertemplate&&(""===s&&a.remove(),l=s);var u=n._d3locale,c=t.hovertemplate||!1,f=t.hovertemplateLabels||t,h=t.eventData[0]||{};return c&&(l=(l=o.hovertemplateString(c,f,u,h,t.trace._meta)).replace(S,(function(e,r){return s=D(r,t.nameLength),""}))),[l,s]}function R(t,e,r,i){var a=function(t){return t*r},o=function(t){return t*i};t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var i=r.select("text.nums"),s=t.anchor,l="end"===s?-1:1,u={start:1,end:-1,middle:0}[s],f=u*(k+E),d=f+u*(t.txwidth+E),p=0,g=t.offset,v="middle"===s;v&&(f-=t.tx2width/2,d+=t.txwidth/2+E),e&&(g*=-A,p=t.offset*T),r.select("path").attr("d",v?"M-"+a(t.bx/2+t.tx2width/2)+","+o(g-t.by/2)+"h"+a(t.bx)+"v"+o(t.by)+"h-"+a(t.bx)+"Z":"M0,0L"+a(l*k+p)+","+o(k+g)+"v"+o(t.by/2-k)+"h"+a(l*t.bx)+"v-"+o(t.by)+"H"+a(l*k+p)+"V"+o(g-k)+"Z");var m=p+f,y=g+t.ty0-t.by/2+E,b=t.textAlign||"auto";"auto"!==b&&("left"===b&&"start"!==s?(i.attr("text-anchor","start"),m=v?-t.bx/2-t.tx2width/2+E:-t.bx-E):"right"===b&&"end"!==s&&(i.attr("text-anchor","end"),m=v?t.bx/2-t.tx2width/2-E:t.bx+E)),i.call(c.positionText,a(m),o(y)),t.tx2width&&(r.select("text.name").call(c.positionText,a(d+u*E+p),o(g+t.ty0-t.by/2+E)),r.select("rect").call(h.setRect,a(d+(u-1)*t.tx2width/2+p),o(g-t.by/2-1),a(t.tx2width),o(t.by+2)))}))}function P(t,e){var r=t.index,n=t.trace||{},a=t.cd[0],s=t.cd[r]||{};function l(t){return t||i(t)&&0===t}var u=Array.isArray(r)?function(t,e){var i=o.castOption(a,r,t);return l(i)?i:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(s,n,t,e)};function c(e,r,n){var i=u(r,n);l(i)&&(t[e]=i)}if(c("hoverinfo","hi","hoverinfo"),c("bgcolor","hbg","hoverlabel.bgcolor"),c("borderColor","hbc","hoverlabel.bordercolor"),c("fontFamily","htf","hoverlabel.font.family"),c("fontSize","hts","hoverlabel.font.size"),c("fontColor","htc","hoverlabel.font.color"),c("nameLength","hnl","hoverlabel.namelength"),c("textAlign","hta","hoverlabel.align"),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:g.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:g.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 f=g.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+f+" / -"+g.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+f,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var h=g.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+h+" / -"+g.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+h,"y"===e&&(t.distance+=1)}var d=t.hoverinfo||t.trace.hoverinfo;return d&&"all"!==d&&(-1===(d=Array.isArray(d)?d:d.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===d.indexOf("y")&&(t.yLabel=void 0),-1===d.indexOf("z")&&(t.zLabel=void 0),-1===d.indexOf("text")&&(t.text=void 0),-1===d.indexOf("name")&&(t.name=void 0)),t}function z(t,e,r){var n,i,o=r.container,s=r.fullLayout,l=s._size,u=r.event,c=!!e.hLinePoint,f=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),f||c){var p=d.combine(s.plot_bgcolor,s.paper_bgcolor);if(c){var v,m,y=e.hLinePoint;n=y&&y.xa,"cursor"===(i=y&&y.ya).spikesnap?(v=u.pointerX,m=u.pointerY):(v=n._offset+y.x,m=i._offset+y.y);var b,x,_=a.readability(y.color,p)<1.5?d.contrast(p):y.color,w=i.spikemode,M=i.spikethickness,T=i.spikecolor||_,A=g.getPxPosition(t,i);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(b=A,x=v),-1!==w.indexOf("across")){var k=i._counterDomainMin,E=i._counterDomainMax;"free"===i.anchor&&(k=Math.min(k,i.position),E=Math.max(E,i.position)),b=l.l+k*l.w,x=l.l+E*l.w}o.insert("line",":first-child").attr({x1:b,x2:x,y1:m,y2:m,"stroke-width":M,stroke:T,"stroke-dasharray":h.dashStyle(i.spikedash,M)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:b,x2:x,y1:m,y2:m,"stroke-width":M+2,stroke:p}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:A+("right"!==i.side?M:-M),cy:m,r:M,fill:T}).classed("spikeline",!0)}if(f){var L,S,C=e.vLinePoint;n=C&&C.xa,i=C&&C.ya,"cursor"===n.spikesnap?(L=u.pointerX,S=u.pointerY):(L=n._offset+C.x,S=i._offset+C.y);var O,R,P=a.readability(C.color,p)<1.5?d.contrast(p):C.color,z=n.spikemode,I=n.spikethickness,D=n.spikecolor||P,N=g.getPxPosition(t,n);if(-1!==z.indexOf("toaxis")||-1!==z.indexOf("across")){if(-1!==z.indexOf("toaxis")&&(O=N,R=S),-1!==z.indexOf("across")){var F=n._counterDomainMin,j=n._counterDomainMax;"free"===n.anchor&&(F=Math.min(F,n.position),j=Math.max(j,n.position)),O=l.t+(1-j)*l.h,R=l.t+(1-F)*l.h}o.insert("line",":first-child").attr({x1:L,x2:L,y1:O,y2:R,"stroke-width":I,stroke:D,"stroke-dasharray":h.dashStyle(n.spikedash,I)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:L,x2:L,y1:O,y2:R,"stroke-width":I+2,stroke:p}).classed("spikeline",!0).classed("crisp",!0)}-1!==z.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:L,cy:N-("top"!==n.side?I:-I),r:I,fill:D}).classed("spikeline",!0)}}}function I(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function D(t,e){return c.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":524,"../../lib/events":516,"../../lib/override_cursor":535,"../../lib/svg_text_utils":547,"../../plots/cartesian/axes":571,"../../registry":625,"../color":394,"../dragelement":413,"../drawing":416,"../legend/defaults":446,"../legend/draw":447,"./constants":428,"./helpers":430,d3:82,"fast-isnumeric":91,tinycolor2:360}],432:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function s(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&a(e.hovermode)&&(o.font||(o.font={}),s("size"),s("family"),s("color"),e.legend?(o.bgcolor||(o.bgcolor=i.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":524,"../color":394,"./helpers":430}],433:[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 void 0!==e[r]?e[r]:n.coerce(t,e,i,r,a)}var o,s=a("clickmode");return e._has("cartesian")?s.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!h&&!d&&!p)"independent"===T("pattern")&&(h=!0);v._hasSubplotGrid=h;var b,x,_="top to bottom"===T("roworder"),w=h?.2:.1,M=h?.3:.1;g&&e._splomGridDflt&&(b=e._splomGridDflt.xside,x=e._splomGridDflt.yside),v._domains={x:c("x",T,w,b,y),y:c("y",T,M,x,m,_)}}else delete e.grid}function T(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!==g||u.uirevision){var v=a.newContainer(e,"legend");if(_("uirevision",e.uirevision),!1!==g){_("bgcolor",e.paper_bgcolor),_("bordercolor"),_("borderwidth"),i.coerceFont(_,"font",e.font);var m,y,b,x=_("orientation");"h"===x?(m=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(y=1.1,b="bottom"):(y=-.1,b="top")):(m=1.02,y=1,b="auto"),_("traceorder",h),l.isGrouped(e.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemwidth"),_("itemclick"),_("itemdoubleclick"),_("x",m),_("xanchor"),_("y",y),_("yanchor",b),_("valign"),i.noneOrAll(u,v,["x","y"]),_("title.text")&&(_("title.side","h"===x?"left":"top"),i.coerceFont(_,"title.font",e.font))}}function _(t,e){return i.coerce(u,v,o,t,e)}}},{"../../lib":524,"../../plot_api/plot_template":560,"../../plots/layout_attributes":614,"../../registry":625,"./attributes":444,"./helpers":450}],447:[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/alignment"),g=p.LINE_SPACING,v=p.FROM_TL,m=p.FROM_BR,y=t("./get_legend_data"),b=t("./style"),x=t("./helpers");function _(t,e,r,n,i){var a=r.data()[0][0].trace,l={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&&(l.group=a._group),o.traceIs(a,"pie-like")&&(l.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",l))if(1===n)e._clickTimeout=setTimeout((function(){h(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",l)&&h(r,t,n)}}function w(t,e,r){var n,a=t.data()[0][0],s=a.trace,l=o.traceIs(s,"pie-like"),c=s.index,h=r._main&&e._context.edits.legendText&&!l,p=r._maxNameLength;r.entries?n=a.text:(n=l?a.label:s.name,s._meta&&(n=i.templateString(n,s._meta)));var g=i.ensureSingle(t,"text","legendtext");g.attr("text-anchor","start").call(u.font,r.font).text(h?M(n,p):n);var v=r.itemwidth+2*d.itemGap;f.positionText(g,v,0),h?g.call(f.makeEditable,{gd:e,text:n}).call(A,t,e,r).on("edit",(function(n){this.text(M(n,p)).call(A,t,e,r);var s=a.trace._fullInput||{},l={};if(o.hasTransform(s,"groupby")){var u=o.getTransformIndices(s,"groupby"),f=u[u.length-1],h=i.keyedContainer(s,"transforms["+f+"].styles","target","value.name");h.set(a.trace._group,n),l=h.constructUpdate()}else l.name=n;return o.call("_guiRestyle",e,l,c)})):A(g,t,e,r)}function M(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 T(t,e){var r,a=e._context.doubleClickDelay,o=1,s=i.ensureSingle(t,"rect","legendtoggle",(function(t){e._context.staticPlot||t.style("cursor","pointer").attr("pointer-events","all"),t.call(c.fill,"rgba(0,0,0,0)")}));e._context.staticPlot||(s.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimea&&(o=Math.max(o-1,1)),_(e,r,t,o,n.event)}})))}function A(t,e,r,n){n._main||t.attr("data-notex",!0),f.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var i=t.select("g[class*=math-group]"),a=i.node();r||(r=e._fullLayout.legend);var o,s,l=r.borderwidth,c=(n?r:r.title).font.size*g;if(a){var h=u.bBox(a);o=h.height,s=h.width,n?u.setTranslate(i,0,.25*o):u.setTranslate(i,l,.75*o+l)}else{var p=t.select(n?".legendtext":".legendtitletext"),v=f.lineCount(p),m=p.node();o=c*v,s=m?u.bBox(m).width:0;var y=c*((v-1)/2-.3);if(n){var b=r.itemwidth+2*d.itemGap;f.positionText(p,b,-y)}else f.positionText(p,d.titlePad+l,c+l)}n?(n.lineHeight=c,n.height=Math.max(o,16)+3,n.width=s):(r._titleWidth=s,r._titleHeight=o)}(e,r,n)}))}function k(t){return i.isRightAnchor(t)?"right":i.isCenterAnchor(t)?"center":"left"}function E(t){return i.isBottomAnchor(t)?"bottom":i.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,s=t._fullLayout,f="legend"+s._uid;if(e?(r=e.layer,f+="-hover"):((e=s.legend||{})._main=!0,r=s._infolayer),r){var h;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;h=s.showlegend&&y(t.calcdata,e)}else{if(!e.entries)return;h=y(e.entries,e)}var p=s.hiddenlabels||[];if(e._main&&(!s.showlegend||!h.length))return r.selectAll(".legend").remove(),s._topdefs.select("#"+f).remove(),a.autoMargin(t,"legend");var g=i.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),M=i.ensureSingleById(s._topdefs,"clipPath",f,(function(t){t.append("rect")})),L=i.ensureSingle(g,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));L.call(c.stroke,e.bordercolor).call(c.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var S=i.ensureSingle(g,"g","scrollbox"),C=e.title;if(e._titleWidth=0,e._titleHeight=0,C.text){var O=i.ensureSingle(S,"text","legendtitletext");O.attr("text-anchor","start").call(u.font,C.font).text(C.text),A(O,S,t,e)}else S.selectAll(".legendtitletext").remove();var R=i.ensureSingle(g,"rect","scrollbar",(function(t){t.attr(d.scrollBarEnterAttrs).call(c.fill,d.scrollBarColor)})),P=S.selectAll("g.groups").data(h);P.enter().append("g").attr("class","groups"),P.exit().remove();var z=P.selectAll("g.traces").data(i.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==p.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(b,t,e).each((function(){e._main&&n.select(this).call(T,t)})),i.syncOrAsync([a.previousPromises,function(){return function(t,e,r,i){var a=t._fullLayout;i||(i=a.legend);var o=a._size,s=x.isVertical(i),l=x.isGrouped(i),c=i.borderwidth,f=2*c,h=d.itemGap,p=i.itemwidth+2*h,g=2*(c+h),v=E(i),m=i.y<0||0===i.y&&"top"===v,y=i.y>1||1===i.y&&"bottom"===v;i._maxHeight=Math.max(m||y?a.height/2:o.h,30);var b=0;i._width=0,i._height=0;var _=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(i);if(s)r.each((function(t){var e=t[0].height;u.setTranslate(this,c+_[0],c+_[1]+i._height+e/2+h),i._height+=e,i._width=Math.max(i._width,t[0].width)})),b=p+i._width,i._width+=h+p+f,i._height+=g,l&&(e.each((function(t,e){u.setTranslate(this,0,e*i.tracegroupgap)})),i._height+=(i._lgroupsLength-1)*i.tracegroupgap);else{var w=k(i),M=i.x<0||0===i.x&&"right"===w,T=i.x>1||1===i.x&&"left"===w,A=y||m,L=a.width/2;i._maxWidth=Math.max(M?A&&"left"===w?o.l+o.w:L:T?A&&"right"===w?o.r+o.w:L:o.w,2*p);var S=0,C=0;r.each((function(t){var e=t[0].width+p;S=Math.max(S,e),C+=e})),b=null;var O=0;if(l){var R=0,P=0,z=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;u.setTranslate(this,_[0],_[1]+c+h+n/2+e),e+=n,t=Math.max(t,p+r[0].width)})),R=Math.max(R,e);var r=t+h;r+c+P>i._maxWidth&&(O=Math.max(O,P),P=0,z+=R+i.tracegroupgap,R=e),u.setTranslate(this,P,z),P+=r})),i._width=Math.max(O,P)+c,i._height=z+R+g}else{var I=r.size(),D=C+f+(I-1)*h=i._maxWidth&&(O=Math.max(O,B),F=0,j+=N,i._height+=N,N=0),u.setTranslate(this,_[0]+c+F,_[1]+c+j+e/2+h),B=F+r+h,F+=n,N=Math.max(N,e)})),D?(i._width=F+f,i._height=N+g):(i._width=Math.max(O,B)+f,i._height+=N+g)}}i._width=Math.ceil(Math.max(i._width+_[0],i._titleWidth+2*(c+d.titlePad))),i._height=Math.ceil(Math.max(i._height+_[1],i._titleHeight+2*(c+d.itemGap))),i._effHeight=Math.min(i._height,i._maxHeight);var U=t._context.edits,V=U.legendText||U.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,i=V?p:b||p+t[0].width;s||(i+=h/2),u.setRect(e,0,-r/2,i,r)}))}(t,P,z,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=k(e),n=E(e);return a.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*v[r],r:e._width*m[r],b:e._effHeight*m[n],t:e._effHeight*v[n]})}(t)){var c,h,p,y,b=s._size,x=e.borderwidth,w=b.l+b.w*e.x-v[k(e)]*e._width,T=b.t+b.h*(1-e.y)-v[E(e)]*e._effHeight;if(e._main&&s.margin.autoexpand){var A=w,C=T;w=i.constrain(w,0,s.width-e._width),T=i.constrain(T,0,s.height-e._effHeight),w!==A&&i.log("Constrain legend.x to make legend fit inside graph"),T!==C&&i.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&u.setTranslate(g,w,T),R.on(".drag",null),g.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var O=e._effHeight;e._main||(O=e._height),L.attr({width:e._width-x,height:O-x,x:x/2,y:x/2}),u.setTranslate(S,0,0),M.select("rect").attr({width:e._width-2*x,height:O-2*x,x:x,y:x}),u.setClipUrl(S,f,t),u.setRect(R,0,0,0,0),delete e._scrollY}else{var P,z,I,D=Math.max(d.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),N=e._effHeight-D-2*d.scrollBarMargin,F=e._height-e._effHeight,j=N/F,B=Math.min(e._scrollY||0,F);L.attr({width:e._width-2*x+d.scrollBarWidth+d.scrollBarMargin,height:e._effHeight-x,x:x/2,y:x/2}),M.select("rect").attr({width:e._width-2*x+d.scrollBarWidth+d.scrollBarMargin,height:e._effHeight-2*x,x:x,y:x+B}),u.setClipUrl(S,f,t),H(B,D,j),g.on("wheel",(function(){H(B=i.constrain(e._scrollY+n.event.deltaY/N*F,0,F),D,j),0!==B&&B!==F&&n.event.preventDefault()}));var U=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;P="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,I=B})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(z="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,H(B=function(t,e,r){var n=(r-e)/j+t;return i.constrain(n,0,F)}(I,P,z),D,j))}));R.call(U);var V=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(P=t.changedTouches[0].clientY,I=B)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(z=t.changedTouches[0].clientY,H(B=function(t,e,r){var n=(e-r)/j+t;return i.constrain(n,0,F)}(I,P,z),D,j))}));S.call(V)}if(t._context.edits.legendPosition)g.classed("cursor-move",!0),l.init({element:g.node(),gd:t,prepFn:function(){var t=u.getTranslate(g);p=t.x,y=t.y},moveFn:function(t,r){var n=p+t,i=y+r;u.setTranslate(g,n,i),c=l.align(n,0,b.l,b.l+b.w,e.xanchor),h=l.align(i,0,b.t+b.h,b.t,e.yanchor)},doneFn:function(){void 0!==c&&void 0!==h&&o.call("_guiRelayout",t,{"legend.x":c,"legend.y":h})},clickFn:function(e,n){var i=r.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&&_(t,g,i,e,n)}})}function H(r,n,i){e._scrollY=t._fullLayout.legend._scrollY=r,u.setTranslate(S,0,-r),u.setRect(R,e._width,d.scrollBarMargin+r*i,d.scrollBarWidth,n),M.select("rect").attr("y",x+r)}}],t)}}},{"../../constants/alignment":496,"../../lib":524,"../../lib/events":516,"../../lib/svg_text_utils":547,"../../plots/plots":616,"../../registry":625,"../color":394,"../dragelement":413,"../drawing":416,"./constants":445,"./get_legend_data":448,"./handle_click":449,"./helpers":450,"./style":452,d3:82}],448:[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,f=0,h=e._main;function d(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;r0))return 0;i=e.width}return v?n:Math.min(i,r)};function _(t,e,r){var a=t[0].trace,o=a.marker||{},s=o.line||{},u=r?a.visible&&a.type===r:i.traceIs(a,"bar"),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(u?[t]:[]);c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",b),c.exit().remove(),c.each((function(t){var e=n.select(this),r=t[0],i=x(r.mlw,o.line,5,2);e.style("stroke-width",i+"px").call(l.fill,r.mc||o.color),i&&l.stroke(e,r.mlc||s.color)}))}function w(t,e,r){var o=t[0],s=o.trace,l=r?s.visible&&s.type===r:i.traceIs(s,r),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(l?[t]:[]);if(u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",b),u.exit().remove(),u.size()){var c=(s.marker||{}).line,d=x(h(c.width,o.pts),c,5,2),p=a.minExtend(s,{marker:{line:{width:d}}});p.marker.line.color=c.color;var g=a.minExtend(o,{trace:p});f(u,g,p)}}t.each((function(t){var e=n.select(this),i=a.ensureSingle(e,"g","layers");i.style("opacity",t[0].trace.opacity);var s=r.valign,l=t[0].lineHeight,u=t[0].height;if("middle"!==s&&l&&u){var c={top:1,bottom:-1}[s]*(.5*(l-u+3));i.attr("transform",o(0,c))}else i.attr("transform",null);i.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),i.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var f=i.selectAll("g.legendsymbols").data([t]);f.enter().append("g").classed("legendsymbols",!0),f.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,i=t[0].trace,o=[];if(i.visible)switch(i.type){case"histogram2d":case"heatmap":o=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":o=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":o=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":o=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":o=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":o=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var c=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(o);c.enter().append("path").classed("legend3dandfriends",!0).attr("transform",b).style("stroke-miterlimit",1),c.exit().remove(),c.each((function(t,o){var c,f=n.select(this),h=u(i),d=h.colorscale,g=h.reversescale;if(d){if(!r){var v=d.length;c=0===o?d[g?v-1:0][1]:1===o?d[g?0:v-1][1]:d[Math.floor((v-1)/2)][1]}}else{var m=i.vertexcolor||i.facecolor||i.color;c=a.isArrayOrTypedArray(m)?m[o]||m[0]:m}f.attr("d",t[0]),c?f.call(l.fill,c):f.call((function(t){if(t.size()){var n="legendfill-"+i.uid;s.gradient(t,e,n,p(g,"radial"===r),d,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var i=t[0].trace[t[0].dir].marker;return t[0].mc=i.color,t[0].mlw=i.line.width,t[0].mlc=i.line.color,_(t,this,"waterfall")}var a=[];e.visible&&r&&(a=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(a);o.enter().append("path").classed("legendwaterfall",!0).attr("transform",b).style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),i=e[t[0]].marker,a=x(void 0,i.line,5,2);r.attr("d",t[1]).style("stroke-width",a+"px").call(l.fill,i.color),a&&r.call(l.stroke,i.line.color)}))})).each((function(t){_(t,this,"funnel")})).each((function(t){_(t,this)})).each((function(t){var r=t[0].trace,o=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&i.traceIs(r,"box-violin")?[t]:[]);o.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",b),o.exit().remove(),o.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var i=x(void 0,r.line,5,2);t.style("stroke-width",i+"px").call(l.fill,r.fillcolor),i&&l.stroke(t,r.line.color)}else{var u=a.minExtend(r,{marker:{size:v?12:a.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});o.call(s.pointStyle,u,e)}}))})).each((function(t){w(t,this,"funnelarea")})).each((function(t){w(t,this,"pie")})).each((function(t){var r,i,o=t[0],l=o.trace,f=l.visible&&l.fill&&"none"!==l.fill,h=c.hasLines(l),d=l.contours,g=!1,v=!1,y=u(l),b=y.colorscale,_=y.reversescale;if(d){var w=d.coloring;"lines"===w?g=!0:h="none"===w||"heatmap"===w||d.showlines,"constraint"===d.type?f="="!==d._operation:"fill"!==w&&"heatmap"!==w||(v=!0)}var M=c.hasMarkers(l)||c.hasText(l),T=f||v,A=h||g,k=M||!T?"M5,0":A?"M5,-2":"M5,-3",E=n.select(this),L=E.select(".legendfill").selectAll("path").data(f||v?[t]:[]);if(L.enter().append("path").classed("js-fill",!0),L.exit().remove(),L.attr("d",k+"h"+m+"v6h-"+m+"z").call(f?s.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+l.uid;s.gradient(t,e,r,p(_),b,"fill")}}),h||g){var S=x(void 0,l.line,10,5);i=a.minExtend(l,{line:{width:S}}),r=[a.minExtend(o,{trace:i})]}var C=E.select(".legendlines").selectAll("path").data(h||g?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",k+(g?"l"+m+",0.0001":"h"+m)).call(h?s.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+l.uid;s.lineGroupStyle(t),s.gradient(t,e,r,p(_),b,"stroke")}})})).each((function(t){var r,i,o=t[0],l=o.trace,u=c.hasMarkers(l),f=c.hasText(l),h=c.hasLines(l);function d(t,e,r,n){var i=a.nestedProperty(l,t).get(),o=a.isArrayOrTypedArray(i)&&e?e(i):i;if(v&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function p(t){return o._distinct&&o.index&&t[o.index]?t[o.index]:t[0]}if(u||f||h){var g={},m={};if(u){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],2),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=d("marker.size",a.mean,[2,16],12);g.ms=y,m.marker.size=y}h&&(m.line={width:d("line.width",p,[0,10],5)}),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(o,g)],(i=a.minExtend(l,m)).selectedpoints=null,i.texttemplate=null}var x=n.select(this).select("g.legendpoints"),_=x.selectAll("path.scatterpts").data(u?r:[]);_.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",b),_.exit().remove(),_.call(s.pointStyle,i,e),u&&(r[0].mrc=3);var w=x.selectAll("g.pointtext").data(f?r:[]);w.enter().append("g").classed("pointtext",!0).append("text").attr("transform",b),w.exit().remove(),w.selectAll("text").call(s.textPointStyle,i,e)})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.visible&&"candlestick"===e.type?[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",b).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var i=n.select(this),a=e[r?"increasing":"decreasing"],o=x(void 0,a.line,5,2);i.style("stroke-width",o+"px").call(l.fill,a.fillcolor),o&&l.stroke(i,a.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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",b).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var i=n.select(this),a=e[r?"increasing":"decreasing"],o=x(void 0,a.line,5,2);i.style("fill","none").call(s.dashLine,a.line.dash,o),o&&l.stroke(i,a.line.color)}))}))}},{"../../lib":524,"../../registry":625,"../../traces/pie/helpers":651,"../../traces/pie/style_one":652,"../../traces/scatter/subtypes":679,"../color":394,"../colorscale/helpers":405,"../drawing":416,"./constants":445,d3:82}],453:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/plots"),a=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),s=t("../shapes/draw").eraseActiveShape,l=t("../../lib"),u=l._,c=e.exports={};function f(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=u._cartesianSpikesEnabled;if("zoom"===s){var d,p="in"===l?.5:2,g=(1+p)/2,v=(1-p)/2;for(i=0;i1?(L=["toggleHover"],S=["resetViews"]):p?(E=["zoomInGeo","zoomOutGeo"],L=["hoverClosestGeo"],S=["resetGeo"]):d?(L=["hoverClosest3d"],S=["resetCameraDefault3d","resetCameraLastSave3d"]):b?(E=["zoomInMapbox","zoomOutMapbox"],L=["toggleHover"],S=["resetViewMapbox"]):m?L=["hoverClosestGl2d"]:g?L=["hoverClosestPie"]:_?(L=["hoverClosestCartesian","hoverCompareCartesian"],S=["resetViewSankey"]):L=["toggleHover"];h&&(L=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var g=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),i=0,a=0;a=n.max)e=N[r+1];else if(t=n.pmax)e=N[r+1];else if(t0?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;oy?(T=f,L="y0",A=y,S="y1"):(T=y,L="y1",A=f,S="y0");Z(n),J(s,r),function(t,e,r){var n=e.xref,i=e.yref,o=a.getFromId(r,n),s=a.getFromId(r,i),l="";"paper"===n||o.autorange||(l+=n);"paper"===i||s.autorange||(l+=i);c.setClipUrl(t,l?"clip"+r._fullLayout._uid+l:null,r)}(e,r,t),W.moveFn="move"===P?Q:K,W.altKey=n.altKey},doneFn:function(){if(m(t))return;d(e),$(s),x(e,t,r),n.call("_guiRelayout",t,l.getUpdateObj())},clickFn:function(){if(m(t))return;$(s)}};function Z(r){if(m(t))P=null;else if(D)P="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=W.element.getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top,o=r.clientX-n.left,s=r.clientY-n.top,l=!N&&i>10&&a>10&&!r.shiftKey?h.getCursor(o/i,1-s/a):"move";d(e,l),P=l.split("-")[0]}}function Q(n,i){if("path"===r.type){var a=function(t){return t},o=a,l=a;z?F("xanchor",r.xanchor=G(b+n)):(o=function(t){return G(H(t)+n)},j&&"date"===j.type&&(o=g.encodeDate(o))),I?F("yanchor",r.yanchor=X(M+i)):(l=function(t){return X(q(t)+i)},U&&"date"===U.type&&(l=g.encodeDate(l))),F("path",r.path=w(R,o,l))}else z?F("xanchor",r.xanchor=G(b+n)):(F("x0",r.x0=G(u+n)),F("x1",r.x1=G(v+n))),I?F("yanchor",r.yanchor=X(M+i)):(F("y0",r.y0=X(f+i)),F("y1",r.y1=X(y+i)));e.attr("d",_(t,r)),J(s,r)}function K(n,i){if(N){var a=function(t){return t},o=a,l=a;z?F("xanchor",r.xanchor=G(b+n)):(o=function(t){return G(H(t)+n)},j&&"date"===j.type&&(o=g.encodeDate(o))),I?F("yanchor",r.yanchor=X(M+i)):(l=function(t){return X(q(t)+i)},U&&"date"===U.type&&(l=g.encodeDate(l))),F("path",r.path=w(R,o,l))}else if(D){if("resize-over-start-point"===P){var c=u+n,h=I?f-i:f+i;F("x0",r.x0=z?c:G(c)),F("y0",r.y0=I?h:X(h))}else if("resize-over-end-point"===P){var d=v+n,p=I?y-i:y+i;F("x1",r.x1=z?d:G(d)),F("y1",r.y1=I?p:X(p))}}else{var m=function(t){return-1!==P.indexOf(t)},x=m("n"),B=m("s"),V=m("w"),Y=m("e"),W=x?T+i:T,Z=B?A+i:A,Q=V?k+n:k,K=Y?E+n:E;I&&(x&&(W=T-i),B&&(Z=A-i)),(!I&&Z-W>10||I&&W-Z>10)&&(F(L,r[L]=I?W:X(W)),F(S,r[S]=I?Z:X(Z))),K-Q>10&&(F(C,r[C]=z?Q:G(Q)),F(O,r[O]=z?K:G(K)))}e.attr("d",_(t,r)),J(s,r)}function J(t,e){(z||I)&&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(z?e.xanchor:i.midRange(r?[e.x0,e.x1]:g.extractPathCoords(e.path,p.paramIsX))),o=q(I?e.yanchor:i.midRange(r?[e.y0,e.y1]:g.extractPathCoords(e.path,p.paramIsY)));if(a=g.roundPositionForSharpStrokeRendering(a,1),o=g.roundPositionForSharpStrokeRendering(o,1),z&&I){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(z){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 $(t){t.selectAll(".visual-cue").remove()}h.init(W),Y.node().onmousemove=Z}(t,z,l,e,r,P):!0===l.editable&&z.style("pointer-events",O||u.opacity(E)*k<=.5?"stroke":"all");z.node().addEventListener("click",(function(){return function(t,e){if(!y(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void M(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=M,v(t)}}(t,z)}))}}function x(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");c.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function _(t,e){var r,n,o,s,l,u,c,f,h=e.type,d=a.getRefType(e.xref),v=a.getRefType(e.yref),m=a.getFromId(t,e.xref),y=a.getFromId(t,e.yref),b=t._fullLayout._size;if(m?"domain"===d?n=function(t){return m._offset+m._length*t}:(r=g.shapePositionToRange(m),n=function(t){return m._offset+m.r2p(r(t,!0))}):n=function(t){return b.l+b.w*t},y?"domain"===v?s=function(t){return y._offset+y._length*(1-t)}:(o=g.shapePositionToRange(y),s=function(t){return y._offset+y.r2p(o(t,!0))}):s=function(t){return b.t+b.h*(1-t)},"path"===h)return m&&"date"===m.type&&(n=g.decodeDate(n)),y&&"date"===y.type&&(s=g.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(p.segmentRE,(function(t){var n=0,u=t.charAt(0),c=p.paramIsX[u],f=p.paramIsY[u],h=p.numParams[u],d=t.substr(1).replace(p.paramRE,(function(t){return c[n]?t="pixel"===a?e(s)+Number(t):e(t):f[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>h&&(t="X"),t}));return n>h&&(d=d.replace(/[\s,]*X.*/,""),i.log("Ignoring extra params in segment "+t)),u+d}))}(e,n,s);if("pixel"===e.xsizemode){var x=n(e.xanchor);l=x+e.x0,u=x+e.x1}else l=n(e.x0),u=n(e.x1);if("pixel"===e.ysizemode){var _=s(e.yanchor);c=_-e.y0,f=_-e.y1}else c=s(e.y0),f=s(e.y1);if("line"===h)return"M"+l+","+c+"L"+u+","+f;if("rect"===h)return"M"+l+","+c+"H"+u+"V"+f+"H"+l+"Z";var w=(l+u)/2,M=(c+f)/2,T=Math.abs(w-l),A=Math.abs(M-c),k="A"+T+","+A,E=w+T+","+M;return"M"+E+k+" 0 1,1 "+(w+","+(M-A))+k+" 0 0,1 "+E+"Z"}function w(t,e,r){return t.replace(p.segmentRE,(function(t){var n=0,i=t.charAt(0),a=p.paramIsX[i],o=p.paramIsY[i],s=p.numParams[i];return i+t.substr(1).replace(p.paramRE,(function(t){return n>=s||(a[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function M(t){y(t)&&(t._fullLayout._activeShapeIndex>=0&&(l(t),delete t._fullLayout._activeShapeIndex,v(t)))}e.exports={draw:v,drawOne:b,eraseActiveShape:function(t){if(!y(t))return;l(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&f(m),r.attr("d",g(e)),A&&!h)&&(T=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===M&&(t[0][0]="M"),e[w]=t,y(),b())}}()}}function R(t,r){!function(t,r){if(e.length)for(var n=0;n0&&l0&&(s=s.transition().duration(e.transition.duration).ease(e.transition.easing)),s.attr("transform",l(o-.5*f.gripWidth,e._dims.currentValueTotalHeight))}}function L(t,e){var r=t._dims;return r.inputAreaStart+f.stepInset+(r.inputAreaLength-2*f.stepInset)*Math.min(1,Math.max(0,e))}function S(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-f.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*f.stepInset-2*r.inputAreaStart)))}function C(t,e,r){var n=r._dims,i=s.ensureSingle(t,"rect",f.railTouchRectClass,(function(n){n.call(A,e,t,r).style("pointer-events","all")}));i.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,f.tickOffset+r.ticklen+n.labelHeight)}).call(a.fill,r.bgcolor).attr("opacity",0),o.setTranslate(i,0,n.currentValueTotalHeight)}function O(t,e){var r=e._dims,n=r.inputAreaLength-2*f.railInset,i=s.ensureSingle(t,"rect",f.railRectClass);i.attr({width:n,height:f.railWidth,rx:f.railRadius,ry:f.railRadius,"shape-rendering":"crispEdges"}).call(a.stroke,e.bordercolor).call(a.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(i,f.railInset,.5*(r.inputAreaWidth-f.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[f.name],n=[],i=0;i0?[0]:[]);function s(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),i.autoMargin(t,v(e))}if(a.enter().append("g").classed(f.containerClassName,!0).style("cursor","ew-resize"),a.exit().each((function(){n.select(this).selectAll("g."+f.groupClassName).each(s)})).remove(),0!==r.length){var l=a.selectAll("g."+f.groupClassName).data(r,m);l.enter().append("g").classed(f.groupClassName,!0),l.exit().each(s).remove();for(var u=0;u0||h<0){var m={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];e.attr("transform",l(m[0],m[1]))}}}return I.call(D),P&&(L?I.on(".opacity",null):(A=0,k=!0,I.text(y).on("mouseover.opacity",(function(){n.select(this).transition().duration(h.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(h.HIDE_PLACEHOLDER).style("opacity",0)}))),I.call(f.makeEditable,{gd:t}).on("edit",(function(e){void 0!==b?o.call("_guiRestyle",t,m,e,b):o.call("_guiRelayout",t,m,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(D)})).on("input",(function(t){this.text(t||" ").call(f.positionText,_.x,_.y)}))),I.classed("js-placeholder",k),M}}},{"../../constants/alignment":496,"../../constants/interactions":501,"../../lib":524,"../../lib/svg_text_utils":547,"../../plots/plots":616,"../../registry":625,"../color":394,"../drawing":416,d3:82,"fast-isnumeric":91}],490:[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"}]},args2:{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":517,"../../plot_api/edit_types":553,"../../plot_api/plot_template":560,"../../plots/font_attributes":599,"../../plots/pad_attributes":615,"../color/attributes":393}],491:[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"}}},{}],492:[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("args2"),r("label"),r("execute"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":524,"../../plots/array_container_defaults":566,"./attributes":490,"./constants":491}],493:[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.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(M,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},T={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||(s.execute&&(s.args2&&o.active===l?(g(t,o,0,e,r,a,-1),i.executeAPICommand(t,s.method,s.args2)):(g(t,o,0,e,r,a,l),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(M,o),c.call(_,o)}))})),c.call(_,o),b?(T.w=Math.max(m.openWidth,m.headerWidth),T.h=x.y-T.t):(T.w=x.x-T.l,T.h=Math.max(m.openHeight,m.headerHeight)),T.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,A=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(T?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,s.barColor),T?(this.hbar=S.attr({rx:s.barRadius,ry:s.barRadius,x:E,y:L,width:A,height:k}),this._hbarXMin=E+A/2,this._hbarTranslateMax=w-A):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var C=m>M,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=M-R):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var D=this.id,N=c-.5,F=C?f+O+.5:f+.5,j=h-.5,B=T?d+k+.5:d+.5,U=o._topdefs.selectAll("#"+D).data(T||C?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",D).append("rect"),T||C?(this._clipRect=U.select("rect").attr({x:Math.floor(N),y:Math.floor(j),width:Math.ceil(F)-Math.floor(N),height:Math.ceil(B)-Math.floor(j)}),this.container.call(a.setClipUrl,D,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),T||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));T&&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":524,"../color":394,"../drawing":416,d3:82}],496:[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"}}},{}],497:[function(t,e,r){"use strict";e.exports={axisRefDescription:function(t,e,r){return["If set to a",t,"axis id (e.g. *"+t+"* or","*"+t+"2*), the `"+t+"` position refers to a",t,"coordinate. If set to *paper*, the `"+t+"`","position refers to the distance from the",e,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",e,"("+r+"). If set to a",t,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",e,"of the domain of that axis: e.g.,","*"+t+"2 domain* refers to the domain of the second",t," axis and a",t,"position of 0.5 refers to the","point between the",e,"and the",r,"of the domain of the","second",t,"axis."].join(" ")}}},{}],498:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],499:[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]}},{}],500:[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"}},{}],501:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],502:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],503:[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}},{}],504:[function(t,e,r){"use strict";r.version=t("./version").version,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;splotly-logomark"}}},{}],507:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],508:[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":531}],509:[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),M=t.match(w?b:y);if(!M)return c;var T=M[1],A=M[3]||"1",k=Number(M[5]||1),E=Number(M[7]||0),L=Number(M[9]||0),S=Number(M[11]||0);if(u){if(2===T.length)return c;var C;T=Number(T);try{var O=v.getComponentMethod("calendars","getCal")(e);if(w){var R="i"===A.charAt(A.length-1);A=parseInt(A,10),C=O.newDate(T,O.toMonthIndex(T,A,R),k)}else C=O.newDate(T,Number(A),k)}catch(t){return c}return C?(C.toJD()-g)*f+E*h+L*d+S*p:c}T=2===T.length?(Number(T)+2e3-x)%100+x:Number(T),A-=1;var P=new Date(Date.UTC(2e3,A,k,E,L));return P.setUTCFullYear(T),P.getUTCMonth()!==A||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 M=90*f,T=3*h,A=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("%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":531}],521:[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);function c(t,e){var r=t;return r[3]*=e,r}function f(t){if(n(t))return u;var e=a(t);return e.length?e:u}function h(t){return n(t)?t:1}e.exports={formatColor:function(t,e,r){var n,i,s,d,p,g=t.color,v=l(g),m=l(e),y=o.extractOpts(t),b=[];if(n=void 0!==y.colorscale?o.makeColorScaleFuncFromTrace(t):f,i=v?function(t,e){return void 0===t[e]?u:a(n(t[e]))}:f,s=m?function(t,e){return void 0===t[e]?1:h(t[e])}:h,v||m)for(var x=0;x1?(r*t+r*e)/r:t+e,i=String(n).length;if(i>16){var a=String(e).length;if(i>=String(t).length+a){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],524:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../constants/numerical"),s=o.FP_SAFE,l=o.BADNUM,u=e.exports={};u.nestedProperty=t("./nested_property"),u.keyedContainer=t("./keyed_container"),u.relativeAttr=t("./relative_attr"),u.isPlainObject=t("./is_plain_object"),u.toLogRange=t("./to_log_range"),u.relinkPrivateKeys=t("./relink_private");var c=t("./array");u.isTypedArray=c.isTypedArray,u.isArrayOrTypedArray=c.isArrayOrTypedArray,u.isArray1D=c.isArray1D,u.ensureArray=c.ensureArray,u.concat=c.concat,u.maxRowLength=c.maxRowLength,u.minRowLength=c.minRowLength;var f=t("./mod");u.mod=f.mod,u.modHalf=f.modHalf;var h=t("./coerce");u.valObjectMeta=h.valObjectMeta,u.coerce=h.coerce,u.coerce2=h.coerce2,u.coerceFont=h.coerceFont,u.coerceHoverinfo=h.coerceHoverinfo,u.coerceSelectionMarkerOpacity=h.coerceSelectionMarkerOpacity,u.validate=h.validate;var d=t("./dates");u.dateTime2ms=d.dateTime2ms,u.isDateTime=d.isDateTime,u.ms2DateTime=d.ms2DateTime,u.ms2DateTimeLocal=d.ms2DateTimeLocal,u.cleanDate=d.cleanDate,u.isJSDate=d.isJSDate,u.formatDate=d.formatDate,u.incrementMonth=d.incrementMonth,u.dateTick0=d.dateTick0,u.dfltRange=d.dfltRange,u.findExactDates=d.findExactDates,u.MIN_MS=d.MIN_MS,u.MAX_MS=d.MAX_MS;var p=t("./search");u.findBin=p.findBin,u.sorterAsc=p.sorterAsc,u.sorterDes=p.sorterDes,u.distinctVals=p.distinctVals,u.roundUp=p.roundUp,u.sort=p.sort,u.findIndexOfMin=p.findIndexOfMin;var g=t("./stats");u.aggNums=g.aggNums,u.len=g.len,u.mean=g.mean,u.median=g.median,u.midRange=g.midRange,u.variance=g.variance,u.stdev=g.stdev,u.interp=g.interp;var v=t("./matrix");u.init2dArray=v.init2dArray,u.transposeRagged=v.transposeRagged,u.dot=v.dot,u.translationMatrix=v.translationMatrix,u.rotationMatrix=v.rotationMatrix,u.rotationXYMatrix=v.rotationXYMatrix,u.apply3DTransform=v.apply3DTransform,u.apply2DTransform=v.apply2DTransform,u.apply2DTransform2=v.apply2DTransform2,u.convertCssMatrix=v.convertCssMatrix,u.inverseTransformMatrix=v.inverseTransformMatrix;var m=t("./angles");u.deg2rad=m.deg2rad,u.rad2deg=m.rad2deg,u.angleDelta=m.angleDelta,u.angleDist=m.angleDist,u.isFullCircle=m.isFullCircle,u.isAngleInsideSector=m.isAngleInsideSector,u.isPtInsideSector=m.isPtInsideSector,u.pathArc=m.pathArc,u.pathSector=m.pathSector,u.pathAnnulus=m.pathAnnulus;var y=t("./anchor_utils");u.isLeftAnchor=y.isLeftAnchor,u.isCenterAnchor=y.isCenterAnchor,u.isRightAnchor=y.isRightAnchor,u.isTopAnchor=y.isTopAnchor,u.isMiddleAnchor=y.isMiddleAnchor,u.isBottomAnchor=y.isBottomAnchor;var b=t("./geometry2d");u.segmentsIntersect=b.segmentsIntersect,u.segmentDistance=b.segmentDistance,u.getTextLocation=b.getTextLocation,u.clearLocationCache=b.clearLocationCache,u.getVisibleSegment=b.getVisibleSegment,u.findPointOnPath=b.findPointOnPath;var x=t("./extend");u.extendFlat=x.extendFlat,u.extendDeep=x.extendDeep,u.extendDeepAll=x.extendDeepAll,u.extendDeepNoArrays=x.extendDeepNoArrays;var _=t("./loggers");u.log=_.log,u.warn=_.warn,u.error=_.error;var w=t("./regex");u.counterRegex=w.counter;var M=t("./throttle");u.throttle=M.throttle,u.throttleDone=M.done,u.clearThrottle=M.clear;var T=t("./dom");function A(t){var e={};for(var r in t)for(var n=t[r],i=0;is?l:a(t)?Number(t):l:l},u.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(a(t)&&t>=0&&t%1==0)},u.noop=t("./noop"),u.identity=t("./identity"),u.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))},u.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},u.simpleMap=function(t,e,r,n,i){for(var a=t.length,o=new Array(a),s=0;s=Math.pow(2,r)?i>10?(u.warn("randstr failed uniqueness"),l):t(e,r,n,(i||0)+1):l},u.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},u.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},u.syncOrAsync=function(t,e,r){var n;function i(){return u.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,u.promiseError);return r&&r(e)},u.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},u.noneOrAll=function(t,e,r){if(t){var n,i=!1,a=!0;for(n=0;n0?e:0}))},u.fillArray=function(t,e,r,n){if(n=n||u.identity,u.isArrayOrTypedArray(t))for(var i=0;i1?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},u.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var O=/^\w*$/;u.templateString=function(t,e){var r={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,n){var i;return O.test(n)?i=e[n]:(r[n]=r[n]||u.nestedProperty(e,n).get,i=r[n]()),u.isValidTextValue(i)?i:""}))};var R={max:10,count:0,name:"hovertemplate"};u.hovertemplateString=function(){return I.apply(R,arguments)};var P={max:10,count:0,name:"texttemplate"};u.texttemplateString=function(){return I.apply(P,arguments)};var z=/^[:|\|]/;function I(t,e,r){var a=this,o=arguments;e||(e={});var s={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,l,c){var f,h,d,p;for(d=3;d=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 D=2e9;u.seedPseudoRandom=function(){D=2e9},u.pseudoRandom=function(){var t=D;return D=(69069*D+1)%4294967296,Math.abs(D-t)<429496729?u.pseudoRandom():D/4294967296},u.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},i=u.extractOption(t,e,"htx","hovertext");if(u.isValidTextValue(i))return n(i);var a=u.extractOption(t,e,"tx","text");return u.isValidTextValue(a)?n(a):void 0},u.isValidTextValue=function(t){return t||0===t},u.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(c=1):c=0,u.strTranslate(i-c*(r+o),a-c*(n+s))+u.strScale(c)+(l?"rotate("+l+(e?"":" "+r+" "+n)+")":"")},u.ensureUniformFontSize=function(t,e){var r=u.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r},u.join2=function(t,e,r){var n=t.length;return n>1?t.slice(0,-1).join(e)+r+t[n-1]:t.join(e)}},{"../constants/numerical":502,"./anchor_utils":507,"./angles":508,"./array":509,"./clean_number":510,"./clear_responsive":512,"./coerce":513,"./dates":514,"./dom":515,"./extend":517,"./filter_unique":518,"./filter_visible":519,"./geometry2d":520,"./identity":522,"./increment":523,"./is_plain_object":525,"./keyed_container":526,"./localize":527,"./loggers":528,"./make_trace_groups":529,"./matrix":530,"./mod":531,"./nested_property":532,"./noop":533,"./notifier":534,"./push_unique":537,"./regex":539,"./relative_attr":540,"./relink_private":541,"./search":542,"./stats":545,"./throttle":548,"./to_log_range":549,d3:82,"d3-time-format":80,"fast-isnumeric":91}],525:[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}},{}],526:[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){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},a.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},a.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":558,"./notifier":534}],529:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var i=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));i.exit().remove(),i.enter().append("g").attr("class",r),i.order();var a=t.classed("rangeplot")?"nodeRangePlot3":"node3";return i.each((function(t){t[0][a]=n.select(this)})),i}},{d3:82}],530:[function(t,e,r){"use strict";var n=t("gl-mat4");r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],532:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./array").isArrayOrTypedArray;function a(t,e){return function(){var r,n,o,s,l,u=t;for(s=0;s/g),l=0;la||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 o(o){t.push(o);var s=r.length,l=n;r.splice(i+1);for(var u=l+1;u1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":502,"./matrix":530}],537:[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 c(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,o,f=0,h=e.length,d=0,p=h>1?(e[h-1]-e[0])/(h-1):1;for(o=p>=0?r?s:l:r?c:u,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,e){var n,i=(e||{}).unitMinDiff,a=t.slice();for(a.sort(r.sorterAsc),n=a.length-1;n>-1&&a[n]===o;n--);var s=1;i||(s=a[n]-a[0]||1);for(var l,u=s/(n||1)/1e4,c=[],f=0;f<=n;f++){var h=a[f],d=h-l;void 0===l?(c.push(h),l=h):d>u&&(s=Math.min(s,d),c.push(h),l=h)}return{vals:c,minDiff:s}},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":509,"fast-isnumeric":91}],546:[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}],547:[function(t,e,r){"use strict";var n=t("d3"),i=t("../lib"),a=i.strTranslate,o=t("../constants/xmlns_namespaces"),s=t("../constants/alignment").LINE_SPACING;function l(t,e){return t.node().getBoundingClientRect()[e]}var u=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,k){var E=t.text(),S=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&E.match(u),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),o={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(c,"\\lt ").replace(f,"\\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],o,(function(n,i,o){C.selectAll("svg."+O).remove(),C.selectAll("g."+O+"-group").remove();var s=n&&n.select("svg");if(!s||!s.node())return R(),void e();var u=C.append("g").classed(O+"-group",!0).attr({"pointer-events":"none","data-unformatted":E,"data-math":"Y"});u.node().appendChild(s.node()),i&&i.node()&&s.node().insertBefore(i.node().cloneNode(!0),s.node().firstChild),s.attr({class:O,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=t.node().style.fill||"black",f=s.select("g");f.attr({fill:c,stroke:c});var h=l(f,"width"),d=l(f,"height"),p=+t.attr("x")-h*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],g=-(r||l(t,"height"))/4;"y"===O[0]?(u.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+")"+a(-h/2,g-d/2)}),s.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===O[0]?s.attr({x:t.attr("x"),y:g-d/2}):"a"===O[0]&&0!==O.indexOf("atitle")?s.attr({x:0,y:g}):s.attr({x:p,y:+t.attr("y")+g-d/2}),k&&k.call(t,u),e(u)}))}))):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,a=!1,l=[],u=-1;function c(){u++;var e=document.createElementNS(o.svg,"tspan");n.select(e).attr({class:"line",dy:u*s+"em"}),t.appendChild(e),r=e;var i=l;if(l=[{node:e}],i.length>1)for(var a=1;a 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 S=e.split(m),C=0;C|>|>)/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=["http:","https:","mailto:","",void 0,":"],v=r.NEWLINES=/(\r\n?|\n)/g,m=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,b=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,_=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,M=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&L(n)}var A=/(^|;)\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,a,o,s=r.horizontalAlign,l=r.verticalAlign||"top",u=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return u.bottom-n.height}:"middle"===l?function(){return u.top+(u.height-n.height)/2}:function(){return u.top},o="right"===s?function(){return u.right-n.width}:"center"===s?function(){return u.left+(u.width-n.width)/2}:function(){return u.left},function(){n=this.node().getBoundingClientRect();var t=o()-c.left,e=a()-c.top,s=r.gd||{};if(r.gd){s._fullLayout._calcInverseTransform(s);var l=i.apply3DTransform(s._fullLayout._invTransform)(t,e);t=l[0],e=l[1]}return this.style({top:e+"px",left:t+"px","z-index":1e3}),this}}r.convertEntities=L,r.sanitizeHTML=function(t){t=t.replace(v," ");for(var e=document.createElement("p"),r=e,i=[],a=t.split(m),o=0;oa.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)}},{}],549:[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":91}],550:[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"}}},{}],551:[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"}}},{}],552:[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?(P.x=1.02,P.xanchor="left"):P.x<-2&&(P.x=-.02,P.xanchor="right"),P.y>3?(P.y=1.02,P.yanchor="bottom"):P.y<-2&&(P.y=-.02,P.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,M,T,A,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-(A?0:1))a.warn("index out of range",f,_);else if(void 0!==T)M.length>1&&a.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(T)?O.push(_):A?("add"===T&&(T={}),S.splice(_,0,T),C&&C.splice(_,0,{})):a.warn("Unrecognized full object edit value",f,_,T),-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 z(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]),P(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&P(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function I(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 P(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=R(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 H(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=Z(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&&(q(t,a,i)||h.supplyDefaults(t),a.legend&&s.push(T.doLegend),a.layoutstyle&&s.push(T.layoutStyles),a.axrange&&G(s,i.rangesAltered),a.ticks&&s.push(T.doTicksRelayout),a.modebar&&s.push(T.doModeBar),a.camera&&s.push(T.doCamera),a.colorbars&&s.push(T.doColorBars),s.push(L)),s.push(h.rehover,h.redrag),u.add(t,H,[t,i.undoit],H,[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 q(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 G(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),-1!==(a.ticklabelposition||"").indexOf("inside")&&a._anchorAxis&&r.push(a._anchorAxis._id),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(x,T.doAutoRangeAndConstraints,r,T.drawData,T.finalDraw)}var X=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,Y=/^[xyz]axis[0-9]*\.autorange$/,W=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function Z(t,e){var r,n,i,a=t.layout,l=t._fullLayout,u=l._guiEditing,h=j(l._preGUI,u),d=Object.keys(e),g=p.list(t),v=o.extendDeepAll({},e),m={};for(V(e),d=Object.keys(e),n=0;n0&&"string"!=typeof P.parts[I];)I--;var D=P.parts[I],N=P.parts[I-1]+"."+D,B=P.parts.slice(0,I).join("."),U=s(t.layout,B).get(),H=s(l,B).get(),q=P.get();if(void 0!==z){T[R]=z,E[R]="reverse"===D?z:F(q);var G=f.getLayoutValObject(l,P.parts);if(G&&G.impliedEdits&&null!==z)for(var Z in G.impliedEdits)L(o.relativeAttr(R,Z),G.impliedEdits[Z]);if(-1!==["width","height"].indexOf(R))if(z){L("autosize",null);var K="height"===R?"width":"height";L(K,l[K])}else l[R]=t._initialAutoSize[R];else if("autosize"===R)L("width",z?null:l.width),L("height",z?null:l.height);else if(N.match(X))O(N),s(l,B+"._inputRange").set(null);else if(N.match(Y)){O(N),s(l,B+"._inputRange").set(null);var J=s(l,B).get();J._inputDomain&&(J._input.domain=J._inputDomain.slice())}else N.match(W)&&s(l,B+"._inputDomain").set(null);if("type"===D){S=U;var $="linear"===H.type&&"log"===z,tt="log"===H.type&&"linear"===z;if($||tt){if(S&&S.range)if(H.autorange)$&&(S.range=S.range[1]>S.range[0]?[1,2]:[2,1]);else{var et=S.range[0],rt=S.range[1];$?(et<=0&&rt<=0&&L(B+".autorange",!0),et<=0?et=rt/1e6:rt<=0&&(rt=et/1e6),L(B+".range[0]",Math.log(et)/Math.LN10),L(B+".range[1]",Math.log(rt)/Math.LN10)):(L(B+".range[0]",Math.pow(10,et)),L(B+".range[1]",Math.pow(10,rt)))}else L(B+".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,H,z,L),c.getComponentMethod("images","convertCoords")(t,H,z,L)}else L(B+".autorange",!0),L(B+".range",null);s(l,B+"._inputRange").set(null)}else if(D.match(k)){var nt=s(l,R).get(),it=(z||{}).type;it&&"-"!==it||(it="linear"),c.getComponentMethod("annotations","convertCoords")(t,nt,it,L),c.getComponentMethod("images","convertCoords")(t,nt,it,L)}var at=w.containerArrayMatch(R);if(at){r=at.array,n=at.index;var ot=at.property,st=G||{editType:"calc"};""!==n&&""===ot&&(w.isAddVal(z)?E[R]=null:w.isRemoveVal(z)?E[R]=(s(a,r).get()||[])[n]:o.warn("unrecognized full object value",e)),A.update(_,st),m[r]||(m[r]={});var lt=m[r][n];lt||(lt=m[r][n]={}),lt[ot]=z,delete e[R]}else"reverse"===D?(U.range?U.range.reverse():(L(B+".autorange",!0),U.range=[1,0]),H.autorange?_.calc=!0:_.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===R&&("lasso"===z||"select"===z)&&"lasso"!==q&&"select"!==q||l._has("gl2d")?_.plot=!0:G?A.update(_,G):_.calc=!0,P.set(z))}}for(r in m){w.applyContainerArrayChanges(t,h(a,r),m[r],_,h)||(_.plot=!0)}for(var ut in C){var ct=(S=p.getFromId(t,ut))&&S._constraintGroup;if(ct)for(var ft in _.calc=!0,ct)C[ft]||(p.getFromId(t,ft)._constraintShrinkable=!0)}return(Q(t)||e.height||e.width)&&(_.plot=!0),(_.plot||_.calc)&&(_.layoutReplot=!0),{flags:_,rangesAltered:C,undoit:E,redoit:T,eventData:v}}function Q(t){var e=t._fullLayout,r=e.width,n=e.height;return t.layout.autosize&&h.plotAutoSize(t,t.layout,e),e.width!==r||e.height!==n}function K(t,e,n,i){if(t=o.getGraphDiv(t),M.clearPromiseQueue(t),t.framework&&t.framework.isPolar)return Promise.resolve(t);o.isPlainObject(e)||(e={}),o.isPlainObject(n)||(n={}),Object.keys(e).length&&(t.changed=!0),Object.keys(n).length&&(t.changed=!0);var a=M.coerceTraceIndices(t,i),s=U(t,o.extendFlat({},e),a),l=s.flags,c=Z(t,o.extendFlat({},n)),f=c.flags;(l.calc||f.calc)&&(t.calcdata=void 0),l.clearAxisTypes&&M.clearAxisTypes(t,a,n);var d=[];f.layoutReplot?d.push(T.layoutReplot):l.fullReplot?d.push(r.plot):(d.push(h.previousPromises),q(t,f,c)||h.supplyDefaults(t),l.style&&d.push(T.doTraceStyle),(l.colorbars||f.colorbars)&&d.push(T.doColorBars),f.legend&&d.push(T.doLegend),f.layoutstyle&&d.push(T.layoutStyles),f.axrange&&G(d,c.rangesAltered),f.ticks&&d.push(T.doTicksRelayout),f.modebar&&d.push(T.doModeBar),f.camera&&d.push(T.doCamera),d.push(L)),d.push(h.rehover,h.redrag),u.add(t,K,[t,s.undoit,c.undoit,s.traces],K,[t,s.redoit,c.redoit,s.traces]);var p=o.syncOrAsync(d,t);return p&&p.then||(p=Promise.resolve(t)),p.then((function(){return t.emit("plotly_update",{data:s.eventData,layout:c.eventData}),t}))}function J(t){return function(e){e._fullLayout._guiEditing=!0;var r=t.apply(null,arguments);return e._fullLayout._guiEditing=!1,r}}var $=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],tt=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function et(t,e){for(var r=0;r1;)if(n.pop(),void 0!==(r=s(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(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&&TT)&&A.push(g);y=A}}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&&E<5&&(E++,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===E&&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.addTraces=function t(e,n,i){e=o.getGraphDiv(e);var a,s,l=[],c=r.deleteTraces,f=t,h=[e,l],d=[e,n];for(function(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&r=a.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!_(o))return!1;t=a[i][o]}else t=a[i]}else t=a}}return t}function _(t){return t===Math.round(t)&&t>=0}function w(){var t,e,r={};for(t in p(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var i=0;i=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 x(i,e,s)},r.getLayoutValObject=function(t,e){return x(function(t,e){var r,i,a,s,l=t._basePlotModules;if(l){var u;for(r=0;r=i&&(r._input||{})._templateitemname;o&&(a=i);var s,l=e+"["+a+"]";function u(){s={},o&&(s[l]={},s[l].templateitemname=o)}function c(t,e){o?n.nestedProperty(s[l],t).set(e):s[l+"."+t]=e}function f(){var t=s;return u(),t}return u(),{modifyBase:function(t,e){s[t]=e},modifyItem:c,getUpdateObj:f,applyUpdate:function(e,r){e&&c(e,r);var i=f();for(var a in i)n.nestedProperty(t,a).set(i[a])}}}},{"../lib":524,"../plots/attributes":567}],561:[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;function y(t,e,r){for(var n=0;n=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function b(t){var e,i,s,c,p,g,v=t._fullLayout,m=v._size,b=m.p,_=h.list(t,"",!0);if(v._paperdiv.style({width:t._context.responsive&&v.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":v.width+"px",height:t._context.responsive&&v.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":v.height+"px"}).selectAll(".main-svg").call(u.setSize,v.width,v.height),t._context.setBackground(t,v.paper_bgcolor),r.drawMainTitle(t),f.manage(t),!v._has("cartesian"))return a.previousPromises(t);function M(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-b-n:e._offset+e._length+b+n:m.t+m.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+b+n:e._offset-b-n:m.l+m.w*(t.position||0)+n%1}for(e=0;e<_.length;e++){var T=(c=_[e])._anchorAxis;c._linepositions={},c._lw=u.crispRound(t,c.linewidth,1),c._mainLinePosition=M(c,T,c.side),c._mainMirrorPosition=c.mirror&&T?M(c,T,d.OPPOSITE_SIDE[c.side]):null}var A=[],k=[],E=[],L=1===l.opacity(v.paper_bgcolor)&&1===l.opacity(v.plot_bgcolor)&&v.paper_bgcolor===v.plot_bgcolor;for(i in v._plots)if((s=v._plots[i]).mainplot)s.bg&&s.bg.remove(),s.bg=void 0;else{var S=s.xaxis.domain,C=s.yaxis.domain,O=s.plotgroup;if(y(S,C,E)){var R=O.node(),P=s.bg=o.ensureSingle(O,"rect","bg");R.insertBefore(P.node(),R.childNodes[0]),k.push(i)}else O.select("rect.bg").remove(),E.push([S,C]),L||(A.push(i),k.push(i))}var z,I,D,N,F,j,B,U,V,H,q,G,X,Y=v._bgLayer.selectAll(".bg").data(A);for(Y.enter().append("rect").classed("bg",!0),Y.exit().remove(),Y.each((function(t){v._plots[t].bg=n.select(this)})),e=0;eM?c.push({code:"unused",traceType:y,templateCount:w,dataCount:M}):M>w&&c.push({code:"reused",traceType:y,templateCount:w,dataCount:M})}}else c.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var a=e[n],o=g(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)&&v(a)&&t(a,o)}}({data:d,layout:h},""),c.length)return c.map(m)}},{"../lib":524,"../plots/attributes":567,"../plots/plots":616,"./plot_config":558,"./plot_schema":559,"./plot_template":560}],563:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./plot_api"),a=t("../plots/plots"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg"),c=t("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,h,d,p;function g(t){return!(t in e)||o.validate(e[t],f[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],h=t.layout||{},d=t.config||{},p={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),h=o.extendDeep({},t.layout),d=t._context,p=t._fullLayout||{}),!g("width")&&null!==e.width||!g("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Export format is not "+o.join2(f.format.values,", "," or ")+".");var v={};function m(t,r){return o.coerce(e,v,f,t,r)}var y=m("format"),b=m("width"),x=m("height"),_=m("scale"),w=m("setBackground"),M=m("imageDataOnly"),T=document.createElement("div");T.style.position="absolute",T.style.left="-5000px",document.body.appendChild(T);var A=o.extendFlat({},h);b?A.width=b:null===e.width&&n(p.width)&&(A.width=p.width),x?A.height=x:null===e.height&&n(p.height)&&(A.height=p.height);var k=o.extendFlat({},d,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),E=s.getRedrawFunc(T);function L(){return new Promise((function(t){setTimeout(t,s.getDelay(T._fullLayout))}))}function S(){return new Promise((function(t,e){var r=l(T,y,_),n=T._fullLayout.width,f=T._fullLayout.height;function h(){i.purge(T),document.body.removeChild(T)}if("full-json"===y){var d=a.graphJson(T,!1,"keepdata","object",!0,!0);return d.version=c,d=JSON.stringify(d),h(),t(M?d:s.encodeJSON(d))}if(h(),"svg"===y)return t(M?r:s.encodeSVG(r));var p=document.createElement("canvas");p.id=o.randstr(),u({format:y,width:n,height:f,scale:_,canvas:p,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){i.plot(T,r,A,k).then(E).then(L).then(S).then((function(e){t(function(t){return M?t.replace(s.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":524,"../plots/plots":616,"../snapshot/helpers":629,"../snapshot/svgtoimg":631,"../snapshot/tosvg":633,"../version":702,"./plot_api":557,"fast-isnumeric":91}],564:[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(p("unused",a,m.concat(b.length)));var A,k,E,L,S,C=b.length,O=Array.isArray(T);if(O&&(C=Math.min(C,T.length)),2===x.dimensions)for(k=0;kb[k].length&&i.push(p("unused",a,m.concat(k,b[k].length)));var R=b[k].length;for(A=0;A<(O?Math.min(R,T[k].length):R);A++)E=O?T[k][A]:T,L=y[k][A],S=b[k][A],n.validate(L,E)?S!==L&&S!==+L&&i.push(p("dynamic",a,m.concat(k,A),L,S)):i.push(p("value",a,m.concat(k,A),L))}else i.push(p("array",a,m.concat(k),y[k]));else for(k=0;k1&&d.push(p("object","layout"))),i.supplyDefaults(g);for(var v=g._fullData,m=r.length,y=0;y0&&Math.round(f)===f))return i;u=f}for(var h=e.calendar,d="start"===l,p="end"===l,g=t[r+"period0"],v=a(g,h)||0,m=[],y=i.length,b=0;bM;)w=o(w,-u,h);for(;w<=M;)w=o(w,u,h);_=o(w,-u,h)}else{for(w=v+(x=Math.round((M-v)/c))*c;w>M;)w-=c;for(;w<=M;)w+=c;_=w-c}m[b]=d?_:p?w:(_+w)/2}return m}},{"../../constants/numerical":502,"../../lib":524,"fast-isnumeric":91}],569:[function(t,e,r){"use strict";e.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],570:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../constants/numerical").FP_SAFE,o=t("../../registry"),s=t("./axis_ids").getFromId;function l(t,e){var r,n,a=[],o=c(e,0),s=c(e,1),l=f(t,e),h=l.min,d=l.max;if(0===h.length||0===d.length)return i.simpleMap(e.range,e.r2l);var p=h[0].val,g=d[0].val;for(r=1;r0&&((w=E-o(y)-s(b))>L?M/w>S&&(x=y,_=b,S=M/w):M/E>S&&(x={val:y.val,pad:0},_={val:b.val,pad:0},S=M/E));if(p===g){var C=p-1,O=p+1;if(A)if(0===p)a=[0,1];else{var R=(p>0?d:h).reduce((function(t,e){return Math.max(t,s(e))}),0),P=p/(1-Math.min(.5,R/E));a=p>0?[0,P]:[P,0]}else a=k?[Math.max(0,C),Math.max(1,O)]:[C,O]}else A?(x.val>=0&&(x={val:0,pad:0}),_.val<=0&&(_={val:0,pad:0})):k&&(x.val-S*o(x)<0&&(x={val:0,pad:0}),_.val<=0&&(_={val:1,pad:0})),S=(_.val-x.val-u(e,y.val,b.val))/(E-o(x)-s(_)),a=[x.val-S*o(x),_.val+S*s(_)];return v&&a.reverse(),i.simpleMap(a,e.l2r||Number)}function u(t,e,r){var n=0;if(t.rangebreaks)for(var i=t.locateBreaks(e,r),a=0;a0?r.ppadplus:r.ppadminus)||r.ppad||0),E=A((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),L=A(r.vpadplus||r.vpad),S=A(r.vpadminus||r.vpad);if(!M){if(p=1/0,v=-1/0,w)for(i=0;i0&&(p=o),o>v&&o-a&&(p=o),o>v&&o=R;i--)O(i);return{min:m,max:y,opts:r}},concatExtremes:f};function f(t,e,r){var n,i,a,o=e._id,l=t._fullData,u=t._fullLayout,c=[],p=[];function g(t,e){for(n=0;n=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 g(t){return n(t)&&Math.abs(t)=e}},{"../../constants/numerical":502,"../../lib":524,"../../registry":625,"./axis_ids":574,"fast-isnumeric":91}],571:[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=s.strTranslate,u=t("../../lib/svg_text_utils"),c=t("../../components/titles"),f=t("../../components/color"),h=t("../../components/drawing"),d=t("./layout_attributes"),p=t("./clean_ticks"),g=t("../../constants/numerical"),v=g.ONEMAXYEAR,m=g.ONEAVGYEAR,y=g.ONEMINYEAR,b=g.ONEMAXQUARTER,x=g.ONEAVGQUARTER,_=g.ONEMINQUARTER,w=g.ONEMAXMONTH,M=g.ONEAVGMONTH,T=g.ONEMINMONTH,A=g.ONEWEEK,k=g.ONEDAY,E=k/2,L=g.ONEHOUR,S=g.ONEMIN,C=g.ONESEC,O=g.MINUS_SIGN,R=g.BADNUM,P=t("../../constants/alignment"),z=P.MID_SHIFT,I=P.CAP_SHIFT,D=P.LINE_SPACING,N=P.OPPOSITE_SIDE,F=e.exports={};F.setConvert=t("./set_convert");var j=t("./axis_autotype"),B=t("./axis_ids");F.id2name=B.id2name,F.name2id=B.name2id,F.cleanId=B.cleanId,F.list=B.list,F.listIds=B.listIds,F.getFromId=B.getFromId,F.getFromTrace=B.getFromTrace;var U=t("./autorange");F.getAutoRange=U.getAutoRange,F.findExtremes=U.findExtremes;function V(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}F.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]||("string"==typeof a?a:a[0])),a||(a=i),l=l.concat(l.map((function(t){return t+" domain"}))),c[u]={valType:"enumerated",values:l.concat(a?"string"==typeof a?[a]:a:[]),dflt:i},s.coerce(t,e,c,u)},F.getRefType=function(t){return void 0===t?t:"paper"===t?"paper":"pixel"===t?"pixel":/( domain)$/.test(t)?"domain":"range"},F.coercePosition=function(t,e,r,n,i,a){var o,l;if("range"!==F.getRefType(n))o=s.ensureNumber,l=r(i,a);else{var u=F.getFromId(e,n);l=r(i,a=u.fraction2r(a)),o=u.cleanPos}t[i]=o(l)},F.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:F.getFromId(e,r).cleanPos)(t)},F.redrawComponents=function(t,e){e=e||F.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},F.saveRangeInitial=function(t,e){for(var r=F.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=F.tickIncrement(t,"M6","reverse")+1.5*k:a.exactMonths>.8?t=F.tickIncrement(t,"M1","reverse")+15.5*k:t-=E;var l=F.tickIncrement(t,r);if(l<=n)return l}return t}(y,t,m,u,a)),v=y,0;v<=c;)v=F.tickIncrement(v,m,!1,a);return{start:e.c2r(y,0,a),end:e.c2r(v,0,a),size:m,_dataSpan:c-u}},F.prepTicks=function(t,e){var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if(t._dtickInit=t.dtick,t._tick0Init=t.tick0,"auto"===t.tickmode||!t.dtick){var n,a=t.nticks;a||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,a=t._length/n):(n="y"===t._id.charAt(0)?40:80,a=s.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(a*=2)),"array"===t.tickmode&&(a*=100),t._roughDTick=Math.abs(r[1]-r[0])/a,F.autoTicks(t,t._roughDTick),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}"period"===t.ticklabelmode&&function(t){var e;function r(){return!(i(t.dtick)||"M"!==t.dtick.charAt(0))}var n=r(),a=F.getTickFormat(t);if(a){var o=t._dtickInit!==t.dtick;/%[fLQsSMX]/.test(a)||(/%[HI]/.test(a)?(e=L,o&&!n&&t.dticka&&f=o:d<=o;d=F.tickIncrement(d,t.dtick,l,t.calendar)){if(t.rangebreaks&&!l){if(d=c)break}if(S.length>g||d===C)break;C=d;var O=!1;f&&d!==(0|d)&&(O=!0),S.push({minor:O,value:d})}if(h&&function(t,e,r){for(var n=0;n0?(a=n-1,o=n):(a=n,o=n);var s,l=t[a].value,u=t[o].value,c=Math.abs(u-l),f=r||c,h=0;f>=y?h=c>=y&&c<=v?c:m:r===x&&f>=_?h=c>=_&&c<=b?c:x:f>=T?h=c>=T&&c<=w?c:M:r===A&&f>=A?h=A:f>=k?h=k:r===E&&f>=E?h=E:r===L&&f>=L&&(h=L),h>=c&&(h=c,s=!0);var d=i+h;if(e.rangebreaks&&h>0){for(var p=0,g=0;g<84;g++){var S=(g+.5)/84;e.maskBreaks(i*(1-S)+S*d)!==R&&p++}(h*=p/84)||(t[n].drop=!0),s&&c>A&&(h=c)}(h>0||0===n)&&(t[n].periodX=i+h/2)}}(S,t,t._definedDelta),t.rangebreaks){var P="y"===t._id.charAt(0),z=1;"auto"===t.tickmode&&(z=t.tickfont?t.tickfont.size:12);var I=NaN;for(p=S.length-1;p>-1;p--)if(S[p].drop)S.splice(p,1);else{S[p].value=xt(S[p].value,t);var D=t.c2p(S[p].value);(P?I>D-z:Ic||jc&&(N.periodX=c),j10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=k&&a<=10||e>=15*k)t._tickround="d";else if(e>=S&&a<=16||e>=L)t._tickround="M";else if(e>=C&&a<=19||e>=S)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),c=void 0===t.minexponent?3:t.minexponent;Math.abs(u)>c&&(it(t.exponentformat)&&!at(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function rt(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}}F.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,0);var a=2*e;if(a>m)e/=m,r=n(10),t.dtick="M"+12*tt(e,r,Y);else if(a>M)e/=M,t.dtick="M"+tt(e,1,W);else if(a>k){t.dtick=tt(e,k,t._hasDayOfWeekBreaks?[1,2,7,14]:Q);var o=F.getTickFormat(t),l="period"===t.ticklabelmode;l&&(t._rawTick0=t.tick0),/%[uVW]/.test(o)?t.tick0=s.dateTick0(t.calendar,2):t.tick0=s.dateTick0(t.calendar,1),l&&(t._dowTick0=t.tick0)}else a>L?t.dtick=tt(e,L,W):a>S?t.dtick=tt(e,S,Z):a>C?t.dtick=tt(e,C,Z):(r=n(10),t.dtick=tt(e,r,Y))}else if("log"===t.type){t.tick0=0;var u=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(u[1]-u[0])<1){var c=1.5*Math.abs((u[1]-u[0])/e);e=Math.abs(Math.pow(10,u[1])-Math.pow(10,u[0]))/c,r=n(10),t.dtick="L"+tt(e,r,Y)}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))):bt(t)?(t.tick0=0,r=1,t.dtick=tt(e,r,$)):(t.tick0=0,r=n(10),t.dtick=tt(e,r,Y));if(0===t.dtick&&(t.dtick=1),!i(t.dtick)&&"string"!=typeof t.dtick){var f=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(f)}},F.tickIncrement=function(t,e,r,a){var o=r?-1:1;if(i(e))return s.increment(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?J:K,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)},F.tickFirst=function(t,e){var r=t.r2l||Number,a=s.simpleMap(t.range,r,void 0,void 0,e),o=a[1]"+l,t._prevDateHead=l));e.text=u}(t,o,r,u):"log"===c?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=ot(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||it(d)&&at(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":O)+h+"",e.fontSize*=1.25):("e"===d||"E"===d)&&h>2?e.text="1"+d+(f>0?"+":O)+h:(e.text=ot(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,o,0,u,g):"category"===c?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===c?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,o,r):bt(t)?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=ot(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){for(var r=1;!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=ot(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=O+e.text)}}}}(t,o,r,u,g):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=ot(e.x,t,i,n)}(t,o,0,u,g),n||(t.tickprefix&&!p(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!p(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var v=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[v(o.x-.5),v(o.x+t.dtick-.5)]}return o},F.hoverLabelText=function(t,e,r){if(r!==R&&r!==e)return F.hoverLabelText(t,e)+" - "+F.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=F.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":O+i:i};var nt=["f","p","n","\u03bc","m","","k","M","G","T"];function it(t){return"SI"===t||"B"===t}function at(t){return t>14||t<-15}function ot(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=F.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,minexponent:e.minexponent,dtick:"none"===e.showexponent?e.dtick:i(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};et(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,O);var d,p=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))"+d+"":"B"===l&&9===u?t+="B":it(l)&&(t+=nt[u/3+5]));return a?O+t:t}function st(t,e){for(var r=[],n={},i=0;i1&&r=i.min&&t=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.bottom-f:0,h)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var d=[0,1];if("x"===p){if("b"===l?n[l]=e._depth:(n[l]=e._depth=Math.max(r.width>0?f-r.top:0,h),d.reverse()),r.width>0){var v=r.right-(e._offset+e._length);v>0&&(n.xr=1,n.r=v);var m=e._offset-r.left;m>0&&(n.xl=0,n.l=m)}}else if("l"===l?n[l]=e._depth=Math.max(r.height>0?f-r.left:0,h):(n[l]=e._depth=Math.max(r.height>0?r.right-f:0,h),d.reverse()),r.height>0){var y=r.bottom-(e._offset+e._length);y>0&&(n.yb=0,n.b=y);var b=e._offset-r.top;b>0&&(n.yt=1,n.t=b)}n[g]="free"===e.anchor?e.position:e._anchorAxis.domain[d[0]],e.title.text!==u._dfltTitle[p]&&(n[l]+=ct(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((i={x:0,y:0,r:0,l:0,t:0,b:0})[c]=e.linewidth,e.mirror&&!0!==e.mirror&&(i[c]+=h),!0===e.mirror||"ticks"===e.mirror?i[g]=e._anchorAxis.domain[d[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(i[g]=[e._counterDomainMin,e._counterDomainMax][d[1]]))}K&&(s=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),a.autoMargin(t,dt(e),n),a.autoMargin(t,pt(e),i),a.autoMargin(t,gt(e),s)})),r.skipTitle||K&&"bottom"===e.side||Z.push((function(){return function(t,e){var r,n=t._fullLayout,i=e._id,a=i.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+ct(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===a?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var s,l,u,f,d=F.getPxPosition(t,e);"x"===a?(l=e._offset+e._length/2,u="top"===e.side?d-r:d+r):(u=e._offset+e._length/2,l="right"===e.side?d+r:d-r,s={rotate:"-90",offset:0});if("multicategory"!==e.type){var p=e._selections[e._id+"tick"];if(f={selection:p,side:e.side},p&&p.node()&&p.node().parentNode){var g=h.getTranslate(p.node().parentNode);f.offsetLeft=g.x,f.offsetTop=g.y}e.title.hasOwnProperty("standoff")&&(f.pad=0)}return c.draw(t,i+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[a],avoid:f,transform:s,attributes:{x:l,y:u,"text-anchor":"middle"}})}(t,e)})),s.syncOrAsync(Z)}}function J(t){var r=d+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,i,a;t._selections[e].size()?(r=1/0,n=-1/0,i=1/0,a=-1/0,t._selections[e].each((function(){var t=ht(this),e=h.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),i=Math.min(i,e.left),a=Math.max(a,e.right)}))):(r=0,n=0,i=0,a=0);return{top:r,bottom:n,left:i,right:a,height:n-r,width:a-i}}(e,r)),w[r]}},F.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}))),t.side&&i.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),i},F.makeTransTickFn=function(t){return"x"===t._id.charAt(0)?function(e){return l(t._offset+t.l2p(e.x),0)}:function(e){return l(0,t._offset+t.l2p(e.x))}},F.makeTransTickLabelFn=function(t){var e=function(t){var e=t.ticklabelposition||"",r=function(t){return-1!==e.indexOf(t)},n=r("top"),i=r("left"),a=r("right"),o=r("bottom"),s=r("inside"),l=o||i||n||a;if(!l&&!s)return[0,0];var u=t.side,c=l?(t.tickwidth||0)/2:0,f=3,h=t.tickfont?t.tickfont.size:12;(o||n)&&(c+=h*I,f+=(t.linewidth||0)/2);(i||a)&&(c+=(t.linewidth||0)/2,f+=3);s&&"top"===u&&(f-=h*(1-I));(i||n)&&(c=-c);"bottom"!==u&&"right"!==u||(f=-f);return[l?c:0,s?f:0]}(t),r=e[0],n=e[1];return"x"===t._id.charAt(0)?function(e){return l(r+t._offset+t.l2p(lt(e)),n)}:function(e){return l(n,r+t._offset+t.l2p(lt(e)))}},F.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},F.makeLabelFns=function(t,e,r){var n=t.ticklabelposition||"",a=function(t){return-1!==n.indexOf(t)},o=a("top"),l=a("left"),u=a("right"),c=a("bottom")||l||o||u,f=a("inside"),h="inside"===n&&"inside"===t.ticks||!f&&"outside"===t.ticks&&"boundaries"!==t.tickson,d=0,p=0,g=h?t.ticklen:0;if(f?g*=-1:c&&(g=0),h&&(d+=g,r)){var v=s.deg2rad(r);d=g*Math.cos(v)+1,p=g*Math.sin(v)}t.showticklabels&&(h||t.showline)&&(d+=.2*t.tickfont.size);var m,y,b,x,_,w={labelStandoff:d+=(t.linewidth||1)/2*(f?-1:1),labelShift:p},M=0,T=t.side,A=t._id.charAt(0),k=t.tickangle;if("x"===A)x=(_=!f&&"bottom"===T||f&&"top"===T)?1:-1,f&&(x*=-1),m=p*x,y=e+d*x,b=_?1:-.2,90===Math.abs(k)&&(f?b+=z:b=-90===k&&"bottom"===T?I:90===k&&"top"===T?z:.5,M=z/2*(k/90)),w.xFn=function(t){return t.dx+m+M*t.fontSize},w.yFn=function(t){return t.dy+y+t.fontSize*b},w.anchorFn=function(t,e){if(c){if(l)return"end";if(u)return"start"}return i(e)&&0!==e&&180!==e?e*x<0!==f?"end":"start":"middle"},w.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side!==f?-n:0};else if("y"===A){if(x=(_=!f&&"left"===T||f&&"right"===T)?1:-1,f&&(x*=-1),m=d,y=p*x,b=0,f||90!==Math.abs(k)||(b=-90===k&&"left"===T||90===k&&"right"===T?I:.5),f){var E=i(k)?+k:0;if(0!==E){var L=s.deg2rad(E);M=Math.abs(Math.sin(L))*I*x,b=0}}w.xFn=function(t){return t.dx+e-(m+t.fontSize*b)*x+M*t.fontSize},w.yFn=function(t){return t.dy+y+t.fontSize*z},w.anchorFn=function(t,e){return i(e)&&90===Math.abs(e)?"middle":_?"end":"start"},w.heightFn=function(e,r,n){return"right"===t.side&&(r*=-1),r<-30?-n:r<30?-.5*n:0}}return w},F.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",i=r.vals;"period"===e.ticklabelmode&&(i=i.slice()).shift();var a=r.layer.selectAll("path."+n).data(e.ticks?i:[],ut);a.exit().remove(),a.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(f.stroke,e.tickcolor).style("stroke-width",h.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),a.attr("transform",r.transFn)},F.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&&F.shouldShowZeroLine(t,e,a))for(var o="array"===e.tickmode,s=0;so||i.lefto||i.top+(e.tickangle?0:t.fontSize/4)1)for(n=1;n2*o}(i,e))return"date";var v="strict"!==r.autotypenumbers;return function(t,e){for(var r=t.length,n=f(r),i=0,o=0,s={},c=0;c2*i}(i,v)?"category":function(t,e){for(var r=t.length,n=0;n=2){var l,u,c="";if(2===o.length)for(l=0;l<2;l++)if(u=y(o[l])){c=p;break}var f=i("pattern",c);if(f===p)for(l=0;l<2;l++)(u=y(o[l]))&&(e.bounds[l]=o[l]=u-1);if(f)for(l=0;l<2;l++)switch(u=o[l],f){case p:if(!n(u))return void(e.enabled=!1);if((u=+u)!==Math.floor(u)||u<0||u>=7)return void(e.enabled=!1);e.bounds[l]=o[l]=u;break;case g:if(!n(u))return void(e.enabled=!1);if((u=+u)<0||u>24)return void(e.enabled=!1);e.bounds[l]=o[l]=u}if(!1===r.autorange){var h=r.range;if(h[0]h[1])return void(e.enabled=!1)}else if(o[0]>h[0]&&o[1]n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.ref2id=function(t){return!!/^[xyz]/.test(t)&&t.split(" ")[0]}},{"../../registry":625,"./constants":577}],575:[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;nn?i.substr(n):a.substr(r))+o:i+a+t*e:o}function v(t,e){for(var r=e._size,n=r.h/r.w,i={},a=Object.keys(t),o=0;ou*b)||M)for(r=0;rP&&NO&&(O=N);h/=(O-C)/(2*R),C=l.l2r(C),O=l.l2r(O),l.range=l._input.range=E=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function F(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",l(r,n)).attr("d",i+"Z")}function j(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",l(e,r)).attr("d","M0,0Z")}function B(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"),U(t,e,i,a)}function U(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 V(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function H(t){O&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),O=!1)}function q(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,C)/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 G(t,e,r,n,i){for(var a,o,l,u,c=!1,f={},h={},d=(i||{}).xaHash,p=(i||{}).yaHash,g=0;g=0)i._fullLayout._deactivateShape(i);else{var a=i._fullLayout.clickmode;if(V(i),2!==t||vt||Ht(),gt)a.indexOf("select")>-1&&k(r,i,Z,Q,e.id,Ct),a.indexOf("event")>-1&&h.click(i,r,e.id);else if(1===t&&vt){var s=p?R:O,l="s"===p||"w"===v?0:1,c=s._name+".range["+l+"]",f=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,l),d="left",g="middle";if(s.fixedrange)return;p?(g="n"===p?"top":"bottom","right"===s.side&&(d="right")):"e"===v&&(d="right"),i._context.showAxisRangeEntryBoxes&&n.select(bt).call(u.makeEditable,{gd:i,immediate:!0,background:i._fullLayout.paper_bgcolor,text:String(f),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:d,verticalAlign:g}).on("edit",(function(t){var e=s.d2r(t);void 0!==e&&o.call("_guiRelayout",i,c,e)}))}}}function Pt(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min($,ht*e+xt)),i=Math.max(0,Math.min(tt,dt*r+_t)),a=Math.abs(n-xt),o=Math.abs(i-_t);function s(){kt="",wt.r=wt.l,wt.t=wt.b,Lt.attr("d","M0,0Z")}if(wt.l=Math.min(xt,n),wt.r=Math.max(xt,n),wt.t=Math.min(_t,i),wt.b=Math.max(_t,i),et.isSubplotConstrained)a>C||o>C?(kt="xy",a/$>o/tt?(o=a*tt/$,_t>i?wt.t=_t-o:wt.b=_t+o):(a=o*$/tt,xt>n?wt.l=xt-a:wt.r=xt+a),Lt.attr("d",q(wt))):s();else if(rt.isSubplotConstrained)if(a>C||o>C){kt="xy";var l=Math.min(wt.l/$,(tt-wt.b)/tt),u=Math.max(wt.r/$,(tt-wt.t)/tt);wt.l=l*$,wt.r=u*$,wt.b=(1-l)*tt,wt.t=(1-u)*tt,Lt.attr("d",q(wt))}else s();else!it||o0){var c;if(rt.isSubplotConstrained||!nt&&1===it.length){for(c=0;cg[1]-1/4096&&(e.domain=s),i.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":524,"fast-isnumeric":91}],589:[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)],t.setScale()}},{"../../constants/alignment":496}],590:[function(t,e,r){"use strict";var n=t("polybooljs"),i=t("../../registry"),a=t("../../components/drawing").dashStyle,o=t("../../components/color"),s=t("../../components/fx"),l=t("../../components/fx/helpers").makeEventData,u=t("../../components/dragelement/helpers"),c=u.freeMode,f=u.rectMode,h=u.drawMode,d=u.openMode,p=u.selectMode,g=t("../../components/shapes/draw_newshape/display_outlines"),v=t("../../components/shapes/draw_newshape/helpers").handleEllipse,m=t("../../components/shapes/draw_newshape/newshapes"),y=t("../../lib"),b=t("../../lib/polygon"),x=t("../../lib/throttle"),_=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),M=t("../../plot_api/subroutines").redrawReglTraces,T=t("./constants"),A=T.MINSELECT,k=b.filter,E=b.tester,L=t("./handle_outline").clearSelect,S=t("./helpers"),C=S.p2r,O=S.axValue,R=S.getTransform;function P(t,e,r,n,i,a,o){var s,l,u,c,f,h,p,v,m,y=e._hoverdata,b=e._fullLayout.clickmode.indexOf("event")>-1,x=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(y)){N(t,e,a);var _=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=B(_))){for(o&&o.remove(),m=0;m=0&&n._fullLayout._deactivateShape(n),h(e)){var a=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(a&&n._fullLayout._drawing){var o=m(a,t);o&&i.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function j(t,e,r,n){var i,a,o,s=[],l=e.map((function(t){return t._id})),u=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(i)>-1}function U(t,e,r){var n,a,o,s;for(n=0;n=0)S._fullLayout._deactivateShape(S);else if(!_){var r=z.clickmode;x.done(gt).then((function(){if(x.clear(gt),2===t){for(ft.remove(),$=0;$-1&&P(e,S,i.xaxes,i.yaxes,i.subplot,i,ft),"event"===r&&S.emit("plotly_selected",void 0);s.click(S,e)})).catch(y.error)}},i.doneFn=function(){pt.remove(),x.done(gt).then((function(){x.clear(gt),i.gd.emit("plotly_selected",et),J&&i.selectionDefs&&(J.subtract=ct,i.selectionDefs.push(J),i.mergedPolygons.length=0,[].push.apply(i.mergedPolygons,K)),i.doneFnCompleted&&i.doneFnCompleted(vt)})).catch(y.error),_&&F(i)}},clearSelect:L,clearSelectionsCache:F,selectOnClick:P}},{"../../components/color":394,"../../components/dragelement/helpers":412,"../../components/drawing":416,"../../components/fx":434,"../../components/fx/helpers":430,"../../components/shapes/draw_newshape/display_outlines":479,"../../components/shapes/draw_newshape/helpers":480,"../../components/shapes/draw_newshape/newshapes":481,"../../lib":524,"../../lib/clear_gl_canvases":511,"../../lib/polygon":536,"../../lib/throttle":548,"../../plot_api/subroutines":561,"../../registry":625,"./axis_ids":574,"./constants":577,"./handle_outline":581,"./helpers":582,polybooljs:316}],591:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,u=o.dateTime2ms,c=o.ensureNumber,f=o.isArrayOrTypedArray,h=t("../../constants/numerical"),d=h.FP_SAFE,p=h.BADNUM,g=h.LOG_CLIP,v=h.ONEWEEK,m=h.ONEDAY,y=h.ONEHOUR,b=h.ONEMIN,x=h.ONESEC,_=t("./axis_ids"),w=t("./constants"),M=w.HOUR_PATTERN,T=w.WEEKDAY_PATTERN;function A(t){return Math.pow(10,t)}function k(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",h=r.charAt(0);function E(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*g*Math.abs(n-i))}return p}function L(e,r,n,i){if((i||{}).msUTC&&a(e))return+e;var s=u(e,n||t.calendar);if(s===p){if(!a(e))return p;e=+e;var l=Math.floor(10*o.mod(e+.05,1)),c=Math.round(e-l/10);s=u(new Date(c))+l/10}return s}function S(e,r,n){return l(e,r,n||t.calendar)}function C(e){return t._categories[Math.round(e)]}function O(e){if(k(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return p}function R(e){if(t._categoriesMap)return t._categoriesMap[e]}function P(t){var e=R(t);return void 0!==e?e:a(t)?+t:void 0}function z(t){return a(t)?+t:R(t)}function I(t,e,r){return n.round(r+e*t,2)}function D(t,e,r){return(t-r)/e}var N=function(e){return a(e)?I(e,t._m,t._b):p},F=function(e){return D(e,t._m,t._b)};if(t.rangebreaks){var j="y"===h;N=function(e){if(!a(e))return p;var r=t._rangebreaks.length;if(!r)return I(e,t._m,t._b);var n=j;t.range[0]>t.range[1]&&(n=!n);for(var i=n?-1:1,o=i*e,s=0,l=0;lc)){s=o<(u+c)/2?l:l+1;break}s=l+1}var f=t._B[s]||0;return isFinite(f)?I(e,t._m2,f):0},F=function(e){var r=t._rangebreaks.length;if(!r)return D(e,t._m,t._b);for(var n=0,i=0;it._rangebreaks[i].pmax&&(n=i+1);return D(e,t._m2,t._B[n])}}t.c2l="log"===t.type?E:c,t.l2c="log"===t.type?A:c,t.l2p=N,t.p2l=F,t.c2p="log"===t.type?function(t,e){return N(E(t,e))}:N,t.p2c="log"===t.type?function(t){return A(F(t))}:F,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=F,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return E(s(t),e)},t.r2d=t.r2c=function(t){return A(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=E,t.l2d=A,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return A(F(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=F,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=L,t.c2d=t.c2r=t.l2d=t.l2r=S,t.d2p=t.r2p=function(e,r,n){return t.l2p(L(e,0,n))},t.p2d=t.p2r=function(t,e,r){return S(F(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,p,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=O,t.r2d=t.c2d=t.l2d=C,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=z(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=z,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return C(F(t))},t.r2p=t.d2p,t.p2r=F,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=C,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=R,t.l2r=t.c2r=c,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return C(F(t))},t.r2p=t.d2p,t.p2r=F,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:c(t)},t.setupMultiCategory=function(n){var i,a,s=t._traceIndices,l=t._matchGroup;if(l&&0===t._categories.length)for(var u in l)if(u!==r){var c=e[_.id2name(u)];s=s.concat(c._traceIndices)}var d=[[0,{}],[0,{}]],p=[];for(i=0;id&&(s[n]=d),s[0]===s[1]){var u=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=u,s[1]+=u}}else o.nestedProperty(t,e).set(i)},t.setScale=function(r){var n=e._size;if(t.overlaying){var i=_.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var a=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(a);var s,l,u=t.r2l(t[a][0],o),c=t.r2l(t[a][1],o),f="y"===h;if((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/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(u,c),Math.max(u,c)),t._rangebreaks.length)){for(s=0;sc&&(d=!d),d&&t._rangebreaks.reverse();var p=d?-1:1;for(t._m2=p*t._length/(Math.abs(c-u)-t._lBreaks),t._B.push(-t._m2*(f?c:u)),s=0;si&&(i+=7,ai&&(i+=24,a=n&&a=n&&e=s.min&&(ts.max&&(s.max=n),i=!1)}i&&u.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function v(e,r){var n=e.plotinfo,i=n.xaxis,l=n.yaxis,u=i._length,c=l._length,f=!!e.xr1,h=!!e.yr1,d=[];if(f){var p=a.simpleMap(e.xr0,i.r2l),g=a.simpleMap(e.xr1,i.r2l),v=p[1]-p[0],m=g[1]-g[0];d[0]=(p[0]*(1-r)+r*g[0]-p[0])/(p[1]-p[0])*u,d[2]=u*(1-r+r*m/v),i.range[0]=i.l2r(p[0]*(1-r)+r*g[0]),i.range[1]=i.l2r(p[1]*(1-r)+r*g[1])}else d[0]=0,d[2]=u;if(h){var y=a.simpleMap(e.yr0,l.r2l),b=a.simpleMap(e.yr1,l.r2l),x=y[1]-y[0],_=b[1]-b[0];d[1]=(y[1]*(1-r)+r*b[1]-y[1])/(y[0]-y[1])*c,d[3]=c*(1-r+r*_/x),l.range[0]=i.l2r(y[0]*(1-r)+r*b[0]),l.range[1]=l.l2r(y[1]*(1-r)+r*b[1])}else d[1]=0,d[3]=c;s.drawOne(t,i,{skipTitle:!0}),s.drawOne(t,l,{skipTitle:!0}),s.redrawComponents(t,[i._id,l._id]);var w=f?u/d[2]:1,M=h?c/d[3]:1,T=f?d[0]:0,A=h?d[1]:0,k=f?d[0]/d[2]*u:0,E=h?d[1]/d[3]*c:0,L=i._offset-k,S=l._offset-E;n.clipRect.call(o.setTranslate,T,A).call(o.setScale,1/w,1/M),n.plot.call(o.setTranslate,L,S).call(o.setScale,w,M),o.setPointGroupScale(n.zoomScalePts,1/w,1/M),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/M)}s.redrawComponents(t)}},{"../../components/drawing":416,"../../lib":524,"../../registry":625,"./axes":571,d3:82}],596:[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("autotypenumbers",s.autotypenumbersDflt),"-"===r("type",(s.splomStash||{}).type)&&(!function(t,e){if("-"!==t.type)return;var r,s=t._id,l=s.charAt(0);-1!==s.indexOf("scene")&&(s=l);var u=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,s,l);if(!u)return;if("histogram"===u.type&&l==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=l+"calendar",f=u[c],h={noMultiCategory:!n(u,"cartesian")||n(u,"noMultiCategory")};"box"===u.type&&u._hasPreCompStats&&l==={h:"x",v:"y"}[u.orientation||"v"]&&(h.noMultiCategory=!0);if(h.autotypenumbers=t.autotypenumbers,o(u,l)){var d=a(u),p=[];for(r=0;r0?".":"")+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&&(g="turntable"):g="turntable")}else g="turntable";r("dragmode",g),r("hovermode",n.getDfltFromLayout("hovermode"))}e.exports=function(t,e,r){var i=e._basePlotModules.length>1;o(t,e,r,{type:"gl3d",attributes:l,handleDefaults:c,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:function(e){if(!i)return n.validate(t[e],l[e])?t[e]:void 0},autotypenumbersDflt:e.autotypenumbers,paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":394,"../../../lib":524,"../../../registry":625,"../../get_data":601,"../../subplot_defaults":623,"./axis_defaults":605,"./layout_attributes":608}],608:[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":524,"../../../lib/extend":517,"../../domain":598,"./axis_attributes":604}],609:[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":546}],610:[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,{msUTC:!0}),p=0;p/g," "));l[u]=d,c.tickmode=f}}e.ticks=l;for(u=0;u<3;++u){o[u]=.5*(t.glplot.bounds[0][u]+t.glplot.bounds[1][u]);for(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;ar.deltaY?1.1:1/1.1,a=t.glplot.getAspectratio();t.glplot.setAspectratio({x:n*a.x,y:n*a.y,z:n*a.z})}i(t)}}),!!u&&{passive:!1}),t.glplot.canvas.addEventListener("mousemove",(function(){if(!1!==t.fullSceneLayout.dragmode&&0!==t.camera.mouseListener.buttons){var e=n();t.graphDiv.emit("plotly_relayouting",e)}})),t.staticMode||t.glplot.canvas.addEventListener("webglcontextlost",(function(r){e&&e.emit&&e.emit("plotly_webglcontextlost",{event:r,layer:t.id})}),!1)),t.glplot.oncontextloss=function(){t.recoverContext()},t.glplot.onrender=function(){t.render()},!0},w.render=function(){var t,e=this,r=e.graphDiv,n=e.svgContainer,i=e.container.getBoundingClientRect();r._fullLayout._calcInverseTransform(r);var a=r._fullLayout._invScaleX,o=r._fullLayout._invScaleY,s=i.width*a,l=i.height*o;n.setAttributeNS(null,"viewBox","0 0 "+s+" "+l),n.setAttributeNS(null,"width",s),n.setAttributeNS(null,"height",l),b(e),e.glplot.axes.update(e.axesOptions);for(var u,c=Object.keys(e.traces),p=null,g=e.glplot.selection,m=0;m")):"isosurface"===t.type||"volume"===t.type?(T.valueLabel=h.tickText(e._mockAxis,e._mockAxis.d2l(g.traceCoordinate[3]),"hover").text,L.push("value: "+T.valueLabel),g.textLabel&&L.push(g.textLabel),_=L.join("
")):_=g.textLabel;var S={x:g.traceCoordinate[0],y:g.traceCoordinate[1],z:g.traceCoordinate[2],data:w._input,fullData:w,curveNumber:w.index,pointNumber:M};d.appendArrayPointValue(S,w,M),t._module.eventData&&(S=w._module.eventData(S,g,w,{},M));var C={points:[S]};e.fullSceneLayout.hovermode&&d.loneHover({trace:w,x:(.5+.5*x[0]/x[3])*s,y:(.5-.5*x[1]/x[3])*l,xLabel:T.xLabel,yLabel:T.yLabel,zLabel:T.zLabel,text:_,name:p.name,color:d.castHoverOption(w,M,"bgcolor")||p.color,borderColor:d.castHoverOption(w,M,"bordercolor"),fontFamily:d.castHoverOption(w,M,"font.family"),fontSize:d.castHoverOption(w,M,"font.size"),fontColor:d.castHoverOption(w,M,"font.color"),nameLength:d.castHoverOption(w,M,"namelength"),textAlign:d.castHoverOption(w,M,"align"),hovertemplate:f.castOption(w,M,"hovertemplate"),hovertemplateLabels:f.extendFlat({},S,T),eventData:[S]},{container:n,gd:r}),g.buttons&&g.distance<5?r.emit("plotly_click",C):r.emit("plotly_hover",C),u=C}else d.loneUnhover(n),r.emit("plotly_unhover",u);e.drawAnnotations(e)},w.recoverContext=function(){var t=this;t.glplot.dispose();var e=function(){t.glplot.gl.isContextLost()?requestAnimationFrame(e):t.initializeGLPlot()?t.plot.apply(t,t.plotArgs):f.error("Catastrophic and unrecoverable WebGL error. Context lost.")};requestAnimationFrame(e)};var T=["xaxis","yaxis","zaxis"];function A(t,e,r){for(var n=t.fullSceneLayout,i=0;i<3;i++){var a=T[i],o=a.charAt(0),s=n[a],l=e[o],u=e[o+"calendar"],c=e["_"+o+"length"];if(f.isArrayOrTypedArray(l))for(var h,d=0;d<(c||l.length);d++)if(f.isArrayOrTypedArray(l[d]))for(var p=0;pv[1][a])v[0][a]=-1,v[1][a]=1;else{var S=v[1][a]-v[0][a];v[0][a]-=S/32,v[1][a]+=S/32}if("reversed"===s.autorange){var C=v[0][a];v[0][a]=v[1][a],v[1][a]=C}}else{var O=s.range;v[0][a]=s.r2l(O[0]),v[1][a]=s.r2l(O[1])}v[0][a]===v[1][a]&&(v[0][a]-=1,v[1][a]+=1),m[a]=v[1][a]-v[0][a],this.glplot.setBounds(a,{min:v[0][a]*h[a],max:v[1][a]*h[a]})}var R=u.aspectmode;if("cube"===R)g=[1,1,1];else if("manual"===R){var P=u.aspectratio;g=[P.x,P.y,P.z]}else{if("auto"!==R&&"data"!==R)throw new Error("scene.js aspectRatio was not one of the enumerated types");var z=[1,1,1];for(a=0;a<3;++a){var I=y[l=(s=u[T[a]]).type];z[a]=Math.pow(I.acc,1/I.count)/h[a]}g="data"===R||Math.max.apply(null,z)/Math.min.apply(null,z)<=4?z:[1,1,1]}u.aspectratio.x=c.aspectratio.x=g[0],u.aspectratio.y=c.aspectratio.y=g[1],u.aspectratio.z=c.aspectratio.z=g[2],this.glplot.setAspectratio(u.aspectratio),this.viewInitial.aspectratio||(this.viewInitial.aspectratio={x:u.aspectratio.x,y:u.aspectratio.y,z:u.aspectratio.z}),this.viewInitial.aspectmode||(this.viewInitial.aspectmode=u.aspectmode);var D=u.domain||null,N=e._size||null;if(D&&N){var F=this.container.style;F.position="absolute",F.left=N.l+D.x[0]*N.w+"px",F.top=N.t+(1-D.y[1])*N.h+"px",F.width=N.w*(D.x[1]-D.x[0])+"px",F.height=N.h*(D.y[1]-D.y[0])+"px"}this.glplot.redraw()}},w.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},w.getCamera=function(){var t;return this.camera.view.recalcMatrix(this.camera.view.lastT()),{up:{x:(t=this.camera).up[0],y:t.up[1],z:t.up[2]},center:{x:t.center[0],y:t.center[1],z:t.center[2]},eye:{x:t.eye[0],y:t.eye[1],z:t.eye[2]},projection:{type:!0===t._ortho?"orthographic":"perspective"}}},w.setViewport=function(t){var e,r=t.camera;this.camera.lookAt.apply(this,[[(e=r).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]]),this.glplot.setAspectratio(t.aspectratio),"orthographic"===r.projection.type!==this.camera._ortho&&(this.glplot.redraw(),this.glplot.clearRGBA(),this.glplot.dispose(),this.initializeGLPlot())},w.isCameraChanged=function(t){var e=this.getCamera(),r=f.nestedProperty(t,this.id+".camera").get();function n(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]]}var i=!1;if(void 0===r)i=!0;else{for(var a=0;a<3;a++)for(var o=0;o<3;o++)if(!n(e,r,a,o)){i=!0;break}(!r.projection||e.projection&&e.projection.type!==r.projection.type)&&(i=!0)}return i},w.isAspectChanged=function(t){var e=this.glplot.getAspectratio(),r=f.nestedProperty(t,this.id+".aspectratio").get();return void 0===r||r.x!==e.x||r.y!==e.y||r.z!==e.z},w.saveLayout=function(t){var e,r,n,i,a,o,s=this.fullLayout,l=this.isCameraChanged(t),u=this.isAspectChanged(t),h=l||u;if(h){var d={};if(l&&(e=this.getCamera(),n=(r=f.nestedProperty(t,this.id+".camera")).get(),d[this.id+".camera"]=n),u&&(i=this.glplot.getAspectratio(),o=(a=f.nestedProperty(t,this.id+".aspectratio")).get(),d[this.id+".aspectratio"]=o),c.call("_storeDirectGUIEdit",t,s._preGUI,d),l)r.set(e),f.nestedProperty(s,this.id+".camera").set(e);if(u)a.set(i),f.nestedProperty(s,this.id+".aspectratio").set(i),this.glplot.redraw()}return h},w.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 u=this.id+".camera.up",h={x:0,y:0,z:1},d={};d[u]=h;var p=n.layout;c.call("_storeDirectGUIEdit",p,i._preGUI,d),a.up=h,f.nestedProperty(p,u).set(h)}}else r.keyBindingMode=t;this.fullSceneLayout.hovermode=e},w.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),function(t,e,r){for(var n=0,i=r-1;n0)for(var s=255/o,l=0;l<3;++l)t[a+l]=Math.min(s*t[a+l],255)}}(a,r,i);var o=document.createElement("canvas");o.width=r,o.height=i;var s,l=o.getContext("2d"),u=l.createImageData(r,i);switch(u.data.set(a),l.putImageData(u,0,0),t){case"jpeg":s=o.toDataURL("image/jpeg");break;case"webp":s=o.toDataURL("image/webp");break;default:s=o.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(n),s},w.setConvert=function(){for(var t=0;t<3;t++){var e=this.fullSceneLayout[T[t]];h.setConvert(e,this.fullLayout),e.setScale=f.noop}},w.make4thDimension=function(){var t=this.graphDiv._fullLayout;this._mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},h.setConvert(this._mockAxis,t)},e.exports=_},{"../../components/fx":434,"../../lib":524,"../../lib/show_no_webgl_msg":544,"../../lib/str2rgbarray":546,"../../plots/cartesian/axes":571,"../../registry":625,"./layout/convert":606,"./layout/spikes":609,"./layout/tick_marks":610,"./project":611,"gl-plot3d":158,"has-passive-events":268,"is-mobile":277,"webgl-context":375}],613:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){n=n||t.length;for(var i=new Array(n),a=0;a=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"),l=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(){b.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()&&l.text()?" - ":"")}},b.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var 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=b.graphJson(t,!1,"keepdata"),i.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],M=["year","month","dayMonth","dayMonthYear"];function T(t,e){var r=t._context.locale;r||(r="en-US");var n=!1,i={};function a(t){for(var r=!0,a=0;a1&&z.length>1){for(o.getComponentMethod("grid","sizeDefaults")(c,l),s=0;s15&&z.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"),b.linkSubplots(h,l,f,a),b.cleanPlot(h,l,f,a);var j=!(!a._has||!a._has("gl2d")),B=!(!l._has||!l._has("gl2d")),U=!(!a._has||!a._has("cartesian"))||j,V=!(!l._has||!l._has("cartesian"))||B;U&&!V?a._bgLayer.remove():V&&!U&&(l._shouldCreateBgLayer=!0),a._zoomlayer&&!t._dragging&&d({_fullLayout:a}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var i=0;i0){var f=1-2*s;n=Math.round(f*n),i=Math.round(f*i)}}var h=b.layoutAttributes.width.min,d=b.layoutAttributes.height.min;n1,g=!e.height&&Math.abs(r.height-i)>1;(g||p)&&(p&&(r.width=n),g&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),b.sanitizeMargins(r)},b.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a,s,l=o.componentsRegistry,c=e._basePlotModules,f=o.subplotsRegistry.cartesian;for(i in l)(s=l[i]).includeBasePlot&&s.includeBasePlot(t,e);for(var h in c.length||c.push(f),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(u.subplotSort);for(a=0;a1&&(r.l/=h,r.r/=h);var d=(r.t+r.b)/s;d>1&&(r.t/=d,r.b/=d);var p=void 0!==r.xl?r.xl:r.x,g=void 0!==r.xr?r.xr:r.x,v=void 0!==r.yt?r.yt:r.y,m=void 0!==r.yb?r.yb:r.y;l[e]={l:{val:p,size:r.l+c},r:{val:g,size:r.r+c},b:{val:m,size:r.b+c},t:{val:v,size:r.t+c}},u[e]=1}else delete l[e],delete u[e];if(!n._replotting)return b.doAutoMargin(t)}},b.doAutoMargin=function(t){var e=t._fullLayout,r=e.width,n=e.height,i=Math.max(0,r-64),s=Math.max(0,n-64);e._size||(e._size={}),S(e);var l=e._size,c=e.margin,f=u.extendFlat({},l),d=c.l,p=c.r,g=c.t,v=c.b,m=e._pushmargin,y=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var x in m)y[x]||delete m[x];for(var _ in m.base={l:{val:0,size:d},r:{val:1,size:p},t:{val:1,size:g},b:{val:0,size:v}},m){var w=m[_].l||{},M=m[_].b||{},T=w.val,A=w.size,k=M.val,E=M.size;for(var L in m){if(a(A)&&m[L].r){var C=m[L].r.val,O=m[L].r.size;if(C>T){var R=(A*C+(O-r)*T)/(C-T),P=(O*(1-T)+(A-r)*(1-C))/(C-T);R+P>d+p&&(d=R,p=P)}}if(a(E)&&m[L].t){var z=m[L].t.val,I=m[L].t.size;if(z>k){var D=(E*z+(I-n)*k)/(z-k),N=(I*(1-k)+(E-n)*(1-z))/(z-k);D+N>v+g&&(v=D,g=N)}}}}}var F=(d+p)/i;F>1&&(d/=F,p/=F);var j=(v+g)/s;if(j>1&&(v/=j,g/=j),l.l=Math.round(d),l.r=Math.round(p),l.t=Math.round(g),l.b=Math.round(v),l.p=Math.round(c.pad),l.w=Math.round(r)-l.l-l.r,l.h=Math.round(n)-l.t-l.b,!e._replotting&&b.didMarginChange(f,l)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var B=3*(1+Object.keys(y).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var a=0,s=0;function l(){return a++,function(){s++,n||s!==a||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(i)}}r.runFn(l),setTimeout(l())}))}],a=u.syncOrAsync(i,t);return a&&a.then||(a=Promise.resolve()),a.then((function(){return t}))}b.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},b.graphJson=function(t,e,r,n,i,a){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&b.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function c(t,e){if("function"==typeof t)return e?"_function_":null;if(u.isPlainObject(t)){var n,i={};return Object.keys(t).sort().forEach((function(a){if(-1===["_","["].indexOf(a.charAt(0)))if("function"!=typeof t[a]){if("keepdata"===r){if("src"===a.substr(a.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0&&!u.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0)return;i[a]=c(t[a],e)}else e&&(i[a]="_function")})),i}return Array.isArray(t)?t.map((function(t){return c(t,e)})):u.isTypedArray(t)?u.simpleMap(t,u.identity):u.isJSDate(t)?u.ms2DateTimeLocal(+t):t}var f={data:(o||[]).map((function(t){var r=c(t);return e&&delete r.fit,r}))};if(!e&&(f.layout=c(s),i)){var h=s._size;f.layout.computed={margin:{b:h.b,l:h.l,r:h.r,t:h.t}}}return t.framework&&t.framework.isPolar&&(f=t.framework.getConfig()),l&&(f.frames=c(l)),a&&(f.config=c(t._context,!0)),"object"===n?f:JSON.stringify(f)},b.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;a--)if(s[a].enabled){r._indexToPoints=s[a]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,p[e]=o}}for(P(l,c,d),i=0;i=0?h.angularAxis.domain:n.extent(M),L=Math.abs(M[1]-M[0]);A&&!T&&(L=0);var S=E.slice();k&&T&&(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,D=t.select(".chart-group"),N={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}),D.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(N),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:b}).style(N);var X=t.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});function Y(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var W=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(W).attr({transform:"rotate("+h.radialAxis.orientation+")"}),q.selectAll(".domain").style(N),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("+Y(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(N),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 K=Z.select("text.axis-text").attr({x:b+h.labelOffset,dy:a+"em",transform:function(t,e){var r=Y(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&&K.text((function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)}));var J=n.max(D.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 $=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"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(!T){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});D.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"});D.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])};T&&(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":496,"../../../lib":524,d3:82}],621:[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":394,"../../../lib":524,"./micropolar":620,"./undo_manager":622,d3:82}],622:[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||(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 r0){for(var n=[],i=0;i-1&&(f[d[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(M),M=(M=M.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),i.isIE()&&(M=(M=(M=M.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),M}},{"../components/color":394,"../components/drawing":416,"../constants/xmlns_namespaces":503,"../lib":524,d3:82}],634:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l={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:i({editType:"calc"},{keys:["norm"]}),showlegend:s({},o.showlegend,{dflt:!1})};s(l,n("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}));["opacity","lightposition","lighting"].forEach((function(t){l[t]=a[t]})),l.hoverinfo=s({},o.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","text","name"],dflt:"x+y+z+norm+text+name"}),l.transforms=void 0,e.exports=l},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plots/attributes":567,"../../plots/template_attributes":624,"../mesh3d/attributes":646}],635:[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":524}],640:[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":524}],641:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll;var u=e.exports=l(s({x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},value:{valType:"data_array"},isomin:{valType:"number"},isomax:{valType:"number"},surface:{show:{valType:"boolean",dflt:!0},count:{valType:"integer",dflt:2,min:1},fill:{valType:"number",min:0,max:1,dflt:1},pattern:{valType:"flaglist",flags:["A","B","C","D","E"],extras:["all","odd","even"],dflt:"all"}},spaceframe:{show:{valType:"boolean",dflt:!1},fill:{valType:"number",min:0,max:1,dflt:.15}},slices:{x:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}}},caps:{x:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}}},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:i(),showlegend:s({},o.showlegend,{dflt:!1})},n("",{colorAttr:"`value`",showScaleDflt:!0,editTypeOverride:"calc"}),{opacity:a.opacity,lightposition:a.lightposition,lighting:a.lighting,flatshading:a.flatshading,contour:a.contour,hoverinfo:s({},o.hoverinfo)}),"calc","nested");u.flatshading.dflt=!0,u.lighting.facenormalsepsilon.dflt=0,u.x.editType=u.y.editType=u.z.editType=u.value.editType="calc+clearAxisTypes",u.transforms=void 0},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plot_api/edit_types":553,"../../plots/attributes":567,"../../plots/template_attributes":624,"../mesh3d/attributes":646}],642:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc"),i=t("../streamtube/calc").processGrid,a=t("../streamtube/calc").filter;e.exports=function(t,e){e._len=Math.min(e.x.length,e.y.length,e.z.length,e.value.length),e._x=a(e.x,e._len),e._y=a(e.y,e._len),e._z=a(e.z,e._len),e._value=a(e.value,e._len);var r=i(e);e._gridFill=r.fill,e._Xs=r.Xs,e._Ys=r.Ys,e._Zs=r.Zs,e._len=r.len;for(var o=1/0,s=-1/0,l=0;l0;r--){var n=Math.min(e[r],e[r-1]),i=Math.max(e[r],e[r-1]);if(i>n&&n-1}function D(t,e){return null===t?e:t}function N(e,r,n){C();var i,a,o,l=[r],u=[n];if(s>=1)l=[r],u=[n];else if(s>0){var c=function(t,e){var r=t[0],n=t[1],i=t[2],a=function(t,e,r){for(var n=[],i=0;i-1?n[d]:S(p,g,m);h[d]=b>-1?b:R(p,g,m,D(e,y))}i=h[0],a=h[1],o=h[2],t._meshI.push(i),t._meshJ.push(a),t._meshK.push(o),++v}}function F(t,e,r,n){var i=t[3];in&&(i=n);for(var a=(t[3]-i)/(t[3]-e[3]+1e-9),o=[],s=0;s<4;s++)o[s]=(1-a)*t[s]+a*e[s];return o}function j(t,e,r){return t>=e&&t<=r}function B(t){var e=.001*(L-E);return t>=E-e&&t<=L+e}function U(e){for(var r=[],n=0;n<4;n++){var i=e[n];r.push([t._x[i],t._y[i],t._z[i],t._value[i]])}return r}function V(t,e,r,n,i,a){a||(a=1),r=[-1,-1,-1];var o=!1,s=[j(e[0][3],n,i),j(e[1][3],n,i),j(e[2][3],n,i)];if(!s[0]&&!s[1]&&!s[2])return!1;var l=function(t,e,r){return B(e[0][3])&&B(e[1][3])&&B(e[2][3])?(N(t,e,r),!0):a<3&&V(t,e,r,E,L,++a)};if(s[0]&&s[1]&&s[2])return l(t,e,r)||o;var u=!1;return[[0,1,2],[2,0,1],[1,2,0]].forEach((function(a){if(s[a[0]]&&s[a[1]]&&!s[a[2]]){var c=e[a[0]],f=e[a[1]],h=e[a[2]],d=F(h,c,n,i),p=F(h,f,n,i);o=l(t,[p,d,c],[-1,-1,r[a[0]]])||o,o=l(t,[c,f,p],[r[a[0]],r[a[1]],-1])||o,u=!0}})),u||[[0,1,2],[1,2,0],[2,0,1]].forEach((function(a){if(s[a[0]]&&!s[a[1]]&&!s[a[2]]){var c=e[a[0]],f=e[a[1]],h=e[a[2]],d=F(f,c,n,i),p=F(h,c,n,i);o=l(t,[p,d,c],[-1,-1,r[a[0]]])||o,u=!0}})),o}function H(t,e,r,n){var i=!1,a=U(e),o=[j(a[0][3],r,n),j(a[1][3],r,n),j(a[2][3],r,n),j(a[3][3],r,n)];if(!(o[0]||o[1]||o[2]||o[3]))return i;if(o[0]&&o[1]&&o[2]&&o[3])return g&&(i=function(t,e,r){var n=function(n,i,a){N(t,[e[n],e[i],e[a]],[r[n],r[i],r[a]])};n(0,1,2),n(3,0,1),n(2,3,0),n(1,2,3)}(t,a,e)||i),i;var s=!1;return[[0,1,2,3],[3,0,1,2],[2,3,0,1],[1,2,3,0]].forEach((function(l){if(o[l[0]]&&o[l[1]]&&o[l[2]]&&!o[l[3]]){var u=a[l[0]],c=a[l[1]],f=a[l[2]],h=a[l[3]];if(g)i=N(t,[u,c,f],[e[l[0]],e[l[1]],e[l[2]]])||i;else{var d=F(h,u,r,n),p=F(h,c,r,n),v=F(h,f,r,n);i=N(null,[d,p,v],[-1,-1,-1])||i}s=!0}})),s?i:([[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2],[0,2,3,1],[1,3,2,0]].forEach((function(l){if(o[l[0]]&&o[l[1]]&&!o[l[2]]&&!o[l[3]]){var u=a[l[0]],c=a[l[1]],f=a[l[2]],h=a[l[3]],d=F(f,u,r,n),p=F(f,c,r,n),v=F(h,c,r,n),m=F(h,u,r,n);g?(i=N(t,[u,m,d],[e[l[0]],-1,-1])||i,i=N(t,[c,p,v],[e[l[1]],-1,-1])||i):i=function(t,e,r){var n=function(n,i,a){N(t,[e[n],e[i],e[a]],[r[n],r[i],r[a]])};n(0,1,2),n(2,3,0)}(null,[d,p,v,m],[-1,-1,-1,-1])||i,s=!0}})),s||[[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2]].forEach((function(l){if(o[l[0]]&&!o[l[1]]&&!o[l[2]]&&!o[l[3]]){var u=a[l[0]],c=a[l[1]],f=a[l[2]],h=a[l[3]],d=F(c,u,r,n),p=F(f,u,r,n),v=F(h,u,r,n);g?(i=N(t,[u,d,p],[e[l[0]],-1,-1])||i,i=N(t,[u,p,v],[e[l[0]],-1,-1])||i,i=N(t,[u,v,d],[e[l[0]],-1,-1])||i):i=N(null,[d,p,v],[-1,-1,-1])||i,s=!0}})),i)}function q(t,e,r,n,i,a,o,s,l,u,c){var f=!1;return p&&(I(t,"A")&&(f=H(null,[e,r,n,a],u,c)||f),I(t,"B")&&(f=H(null,[r,n,i,l],u,c)||f),I(t,"C")&&(f=H(null,[r,a,o,l],u,c)||f),I(t,"D")&&(f=H(null,[n,a,s,l],u,c)||f),I(t,"E")&&(f=H(null,[r,n,a,l],u,c)||f)),g&&(f=H(t,[r,n,a,l],u,c)||f),f}function G(t,e,r,n,i,a,o,s){return[!0===s[0]||V(t,U([e,r,n]),[e,r,n],a,o),!0===s[1]||V(t,U([n,i,e]),[n,i,e],a,o)]}function X(t,e,r,n,i,a,o,s,l){return s?G(t,e,r,i,n,a,o,l):G(t,r,i,n,e,a,o,l)}function Y(t,e,r,n,i,a,o){var s,l,u,c,f=!1,h=function(){f=V(t,[s,l,u],[-1,-1,-1],i,a)||f,f=V(t,[u,c,s],[-1,-1,-1],i,a)||f},d=o[0],p=o[1],g=o[2];return d&&(s=P(U([T(e,r-0,n-0)])[0],U([T(e-1,r-0,n-0)])[0],d),l=P(U([T(e,r-0,n-1)])[0],U([T(e-1,r-0,n-1)])[0],d),u=P(U([T(e,r-1,n-1)])[0],U([T(e-1,r-1,n-1)])[0],d),c=P(U([T(e,r-1,n-0)])[0],U([T(e-1,r-1,n-0)])[0],d),h()),p&&(s=P(U([T(e-0,r,n-0)])[0],U([T(e-0,r-1,n-0)])[0],p),l=P(U([T(e-0,r,n-1)])[0],U([T(e-0,r-1,n-1)])[0],p),u=P(U([T(e-1,r,n-1)])[0],U([T(e-1,r-1,n-1)])[0],p),c=P(U([T(e-1,r,n-0)])[0],U([T(e-1,r-1,n-0)])[0],p),h()),g&&(s=P(U([T(e-0,r-0,n)])[0],U([T(e-0,r-0,n-1)])[0],g),l=P(U([T(e-0,r-1,n)])[0],U([T(e-0,r-1,n-1)])[0],g),u=P(U([T(e-1,r-1,n)])[0],U([T(e-1,r-1,n-1)])[0],g),c=P(U([T(e-1,r-0,n)])[0],U([T(e-1,r-0,n-1)])[0],g),h()),f}function W(t,e,r,n,i,a,o,s,l,u,c,f){var h=t;return f?(p&&"even"===t&&(h=null),q(h,e,r,n,i,a,o,s,l,u,c)):(p&&"odd"===t&&(h=null),q(h,l,s,o,a,i,n,r,e,u,c))}function Z(t,e,r,n,i){for(var a=[],o=0,s=0;sMath.abs(p-k)?[A,p]:[p,k];$(e,M[0],M[1])}}var S=[[Math.min(E,k),Math.max(E,k)],[Math.min(A,L),Math.max(A,L)]];["x","y","z"].forEach((function(e){for(var r=[],n=0;n0&&(c.push(d.id),"x"===e?f.push([d.distRatio,0,0]):"y"===e?f.push([0,d.distRatio,0]):f.push([0,0,d.distRatio]))}else u=nt(1,"x"===e?x-1:"y"===e?_-1:w-1);c.length>0&&(r[i]="x"===e?tt(null,c,a,o,f,r[i]):"y"===e?et(null,c,a,o,f,r[i]):rt(null,c,a,o,f,r[i]),i++),u.length>0&&(r[i]="x"===e?Z(null,u,a,o,r[i]):"y"===e?Q(null,u,a,o,r[i]):K(null,u,a,o,r[i]),i++)}var p=t.caps[e];p.show&&p.fill&&(z(p.fill),r[i]="x"===e?Z(null,[0,x-1],a,o,r[i]):"y"===e?Q(null,[0,_-1],a,o,r[i]):K(null,[0,w-1],a,o,r[i]),i++)}})),0===v&&O(),t._meshX=n,t._meshY=i,t._meshZ=a,t._meshIntensity=o,t._Xs=m,t._Ys=y,t._Zs=b}(),t}e.exports={findNearestOnAxis:l,generateIsoMeshes:h,createIsosurfaceTrace: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}}},{"../../components/colorscale":406,"../../lib/gl_format_color":521,"../../lib/str2rgbarray":546,"../../plots/gl3d/zip3":613,"gl-mesh3d":153}],644:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("./attributes"),o=t("../../components/colorscale/defaults");function s(t,e,r,n,a){var s=a("isomin"),l=a("isomax");null!=l&&null!=s&&s>l&&(e.isomin=null,e.isomax=null);var u=a("x"),c=a("y"),f=a("z"),h=a("value");u&&u.length&&c&&c.length&&f&&f.length&&h&&h.length?(i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],n),["x","y","z"].forEach((function(t){var e="caps."+t;a(e+".show")&&a(e+".fill");var r="slices."+t;a(r+".show")&&(a(r+".fill"),a(r+".locations"))})),a("spaceframe.show")&&a("spaceframe.fill"),a("surface.show")&&(a("surface.count"),a("surface.fill"),a("surface.pattern")),a("contour.show")&&(a("contour.color"),a("contour.width")),["text","hovertext","hovertemplate","lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","flatshading","opacity"].forEach((function(t){a(t)})),o(t,e,n,a,{prefix:"",cLetter:"c"}),e._length=null):e.visible=!1}e.exports={supplyDefaults:function(t,e,r,i){s(t,e,r,i,(function(r,i){return n.coerce(t,e,a,r,i)}))},supplyIsoDefaults:s}},{"../../components/colorscale/defaults":404,"../../lib":524,"../../registry":625,"./attributes":641}],645:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,calc:t("./calc"),colorbar:{min:"cmin",max:"cmax"},plot:t("./convert").createIsosurfaceTrace,moduleType:"trace",name:"isosurface",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","showLegend"],meta:{}}},{"../../plots/gl3d":602,"./attributes":641,"./calc":642,"./convert":643,"./defaults":644}],646:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../surface/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s({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:i({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"},intensitymode:{valType:"enumerated",values:["vertex","cell"],dflt:"vertex",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"}),{opacity:a.opacity,flatshading:{valType:"boolean",dflt:!1,editType:"calc"},contour:{show:s({},a.contours.x.show,{}),color:a.contours.x.color,width:a.contours.x.width,editType:"calc"},lightposition:{x:s({},a.lightposition.x,{dflt:1e5}),y:s({},a.lightposition.y,{dflt:1e5}),z:s({},a.lightposition.z,{dflt:0}),editType:"calc"},lighting:s({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"},a.lighting),hoverinfo:s({},o.hoverinfo,{editType:"calc"}),showlegend:s({},o.showlegend,{dflt:!1})})},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plots/attributes":567,"../../plots/template_attributes":624,"../surface/attributes":693}],647:[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":402}],648:[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("../../components/colorscale").extractOpts,c=t("../../plots/gl3d/zip3");function f(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}var h=f.prototype;function d(t){for(var e=[],r=t.length,n=0;n=e-.5)return!1;return!0}h.handlePick=function(t){if(t.object===this.mesh){var e=t.index=t.data.index;t.data._cellCenter?t.traceCoordinate=t.data.dataCoordinate: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}},h.update=function(t){var e=this.scene,r=e.fullSceneLayout;this.data=t;var n,f=t.x.length,h=c(p(r.xaxis,t.x,e.dataScale[0],t.xcalendar),p(r.yaxis,t.y,e.dataScale[1],t.ycalendar),p(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||!v(t.i,f)||!v(t.j,f)||!v(t.k,f))return;n=c(g(t.i),g(t.j),g(t.k))}else n=0===t.alphahull?o(h):t.alphahull>0?a(t.alphahull,h):function(t,e){for(var r=["x","y","z"].indexOf(t),n=[],a=e.length,o=0;ol&&L[m].gap;)m--;for(b=L[m].s,g=L.length-1;g>m;g--)L[g].s=b;for(;lk[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}}}}}},{}],661:[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("./period_defaults"),c=t("./stack_defaults"),f=t("./marker_defaults"),h=t("./line_defaults"),d=t("./line_shape_defaults"),p=t("./text_defaults"),g=t("./fillcolor_defaults");e.exports=function(t,e,r,v){function m(r,i){return n.coerce(t,e,a,r,i)}var y=l(t,e,v,m);if(y||(e.visible=!1),e.visible){u(t,e,v,m);var b=c(t,e,v,m),x=!b&&yG!=(N=R[C][1])>=G&&(z=R[C-1][0],I=R[C][0],N-D&&(P=z+(I-z)*(G-D)/(N-D),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":394,"../../components/fx":434,"../../lib":524,"../../registry":625,"./get_trace_color":664}],666:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":584,"./arrays_to_calcdata":653,"./attributes":654,"./calc":655,"./cross_trace_calc":659,"./cross_trace_defaults":660,"./defaults":661,"./format_labels":663,"./hover":665,"./marker_colorbar":672,"./plot":675,"./select":676,"./style":678,"./subtypes":679}],667:[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":404,"../../components/colorscale/helpers":405,"../../lib":524}],668:[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,M,T,A,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,D="linear"===I,N=e.fill&&"none"!==e.fill,F=[],j=f.minTolerance,B=t.length,U=new Array(B),V=0;function H(r){var n=t[r];if(!n)return!1;var a=e.linearized?E.l2p(n.x):E.c2p(n.x),l=e.linearized?L.l2p(n.y):L.c2p(n.y);if(a===i){if(S&&(a=E.c2p(n.x,!0)),a===i)return!1;C&&l===i&&(a*=Math.abs(E._m*R*(E._m>0?o:s)/(L._m*O*(L._m>0?o:s)))),a*=1e3}if(l===i){if(C&&(l=L.c2p(n.y,!0)),l===i)return!1;l*=1e3}return[a,l]}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),K=null,Z=Q=0}function ft(t){if(A=t[0]/O,k=t[1]/R,Y=t[0]rt?rt:0,W=t[1]it?it:0,Y||W){if(V)if(K){var e=$(K,t);e.length>1&&(ct(e[0]),U[V++]=e[1])}else J=$(U[V-1],t)[0],U[V++]=J;else U[V++]=[Y||t[0],W||t[1]];var r=U[V-1];Y&&W&&(r[0]!==Y||r[1]!==W)?(K&&(Z!==Y&&Q!==W?ut(Z&&Q?(n=K,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||Y,Q||W]):Z&&Q&&ut([Z,Q])),ut([Y,W])):Z-Y&&Q-W&&ut([Y||Z,W||Q]),K=t,Z=Y,Q=W}else K&&ct($(K,t)[0]),U[V++]=t;var n,i,a,o}for("linear"===I||"spline"===I?$=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)}K&&ut([Z||K[0],Q||K[1]]),F.push(U.slice(0,V))}return F}},{"../../constants/numerical":502,"../../lib":524,"./constants":658}],669:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],670:[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":91}],672:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],673:[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":394,"../../components/colorscale/defaults":404,"../../components/colorscale/helpers":405,"./subtypes":679}],674:[function(t,e,r){"use strict";var n=t("../../lib").dateTick0,i=t("../../constants/numerical").ONEWEEK;function a(t,e){return n(e,t%i==0?1:0)}e.exports=function(t,e,r,n,i){if(i||(i={x:!0,y:!0}),i.x){var o=n("xperiod");o&&(n("xperiod0",a(o,e.xcalendar)),n("xperiodalignment"))}if(i.y){var s=n("yperiod");s&&(n("yperiod0",a(s,e.ycalendar)),n("yperiodalignment"))}}},{"../../constants/numerical":502,"../../lib":524}],675:[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,M=n.select(p),T=o(M,"g","errorbars"),A=o(M,"g","lines"),k=o(M,"g","points"),E=o(M,"g","text");if(i.getComponentMethod("errorbars","plot")(t,T,r,g),!0===_.visible){var L,S;y(M).style("opacity",_.opacity);var C=_.fill.charAt(_.fill.length-1);"x"!==C&&"y"!==C&&(C=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=M;var O,R,P="",z=[],I=_._prevtrace;I&&(P=I._prevRevpath||"",S=I._nextFill,z=I._polygons);var D,N,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)?(D=l.steps(w.shape),N=l.steps(w.shape.split("").reverse().join(""))):D=N="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 N(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 Y=A.selectAll(".js-line").data(G);y(Y.exit()).style("opacity",0).remove(),Y.each(X(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(X(!0)),l.setClipUrl(Y,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?K:Q:_&&!w&&(v=J),f&&(p=v),h&&(g=v)}var M,T=(o=e.selectAll("path.point").data(p,d)).enter().append("path").classed("point",!0);m&&T.call(l.pointStyle,c,t).call(l.translatePoints,b,x).style("opacity",0).transition().style("opacity",1),o.order(),f&&(M=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,M,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 W=!1===_.cliponaxis?null:r.layerClipId;l.setClipUrl(k,W,t),l.setClipUrl(E,W,t)}function Z(t){y(t).attr("d","M0,0Z")}function Q(t){return t.filter((function(t){return!t.gap&&t.vis}))}function K(t){return t.filter((function(t){return t.vis}))}function J(t){return t.filter((function(t){return!t.gap}))}function $(t){return t.id}function tt(t){if(t.ids)return $}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":416,"../../lib":524,"../../lib/polygon":536,"../../registry":625,"./line_points":668,"./link_traces":670,"./subtypes":679,d3:82}],676:[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 x(t){return null==t?0:t.indexOf("top")>-1?-1:t.indexOf("bottom")>-1?1:0}function _(t,e){return e(4*t)}function w(t){return d[t]}function M(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":524,"../../registry":625,"../scatter/line_defaults":667,"../scatter/marker_defaults":673,"../scatter/subtypes":679,"../scatter/text_defaults":680,"./attributes":682}],687:[function(t,e,r){"use strict";e.exports={plot:t("./convert"),attributes:t("./attributes"),markerSymbols:t("../../constants/gl3d_markers"),supplyDefaults:t("./defaults"),colorbar:[{container:"marker",min:"cmin",max:"cmax"},{container:"line",min:"cmin",max:"cmax"}],calc:t("./calc"),moduleType:"trace",name:"scatter3d",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","symbols","showLegend","scatter-like"],meta:{}}},{"../../constants/gl3d_markers":500,"../../plots/gl3d":602,"./attributes":682,"./calc":683,"./convert":685,"./defaults":686}],688:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l={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:i({editType:"calc"},{keys:["tubex","tubey","tubez","tubeu","tubev","tubew","norm","divergence"]}),showlegend:s({},o.showlegend,{dflt:!1})};s(l,n("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}));["opacity","lightposition","lighting"].forEach((function(t){l[t]=a[t]})),l.hoverinfo=s({},o.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","divergence","text","name"],dflt:"x+y+z+norm+text+name"}),l.transforms=void 0,e.exports=l},{"../../components/colorscale/attributes":401,"../../lib/extend":517,"../../plots/attributes":567,"../../plots/template_attributes":624,"../mesh3d/attributes":646}],689:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorscale/calc");function a(t){var e,r,i,a,s,l,u,c,f,h,d,p,g=t._x,v=t._y,m=t._z,y=t._len,b=-1/0,x=1/0,_=-1/0,w=1/0,M=-1/0,T=1/0,A="";for(y&&(u=g[0],f=v[0],d=m[0]),y>1&&(c=g[y-1],h=v[y-1],p=m[y-1]),e=0;ec?"-":"+")+"x")).replace("y",(f>h?"-":"+")+"y")).replace("z",(d>p?"-":"+")+"z");var S=function(){y=0,k=[],E=[],L=[]};(!y||y2?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,c=e._len,f={};function p(t,e){var n=r[e],o=i[u[e]];return a.simpleMap(t,(function(t){return n.d2l(t)*o}))}if(f.vectors=l(p(e._u,"xaxis"),p(e._v,"yaxis"),p(e._w,"zaxis"),c),!c)return{positions:[],cells:[]};var g=p(e._Xs,"xaxis"),v=p(e._Ys,"yaxis"),m=p(e._Zs,"zaxis");if(f.meshgrid=[g,v,m],f.gridFill=e._gridFill,e._slen)f.startingPositions=l(p(e._startsX,"xaxis"),p(e._startsY,"yaxis"),p(e._startsZ,"zaxis"));else{for(var y=v[0],b=h(g),x=h(m),_=new Array(b.length*x.length),w=0,M=0;M0){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],a=t[0].shape[1],o=0|Math.floor(t[0].shape[0]*e+1),s=0|Math.floor(t[0].shape[1]*r+1),l=1+n+1,u=1+a+1,c=i(new Float32Array(l*u),[l,u]),f=[1/e,0,0,0,1/r,0,0,0,1],h=0;h0&&null!==this.contourStart[t]&&null!==this.contourEnd[t]&&this.contourEnd[t]>this.contourStart[t]))for(i[t]=!0,e=this.contourStart[t];ea&&(this.minValues[e]=a),this.maxValues[e] 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -2412,19 +2373,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -2433,7 +2393,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -2441,33 +2401,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -2489,44 +2445,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -2536,20 +2477,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -2571,35 +2511,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -2608,7 +2551,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -2616,7 +2559,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -2625,7 +2568,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -2638,17 +2581,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -2671,12 +2615,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -2685,16 +2629,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -2702,6 +2639,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -2710,23 +2653,33 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],13:[function(_dereq_,module,exports){ @@ -13628,7 +13581,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; }(); },{}],17:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -14804,8 +14757,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":35}],18:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":64}],18:[function(_dereq_,module,exports){ /** * inspired by is-number * but significantly simplified and sped up by ignoring number and string constructors @@ -14831,7 +14784,158 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":23}],19:[function(_dereq_,module,exports){ +},{"is-string-blank":52}],19:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],20:[function(_dereq_,module,exports){ +module.exports = clone; + +/** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param {mat4} a matrix to clone + * @returns {mat4} a new 4x4 matrix + */ +function clone(a) { + var out = new Float32Array(16); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],21:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],22:[function(_dereq_,module,exports){ +module.exports = create; + +/** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ +function create() { + var out = new Float32Array(16); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],23:[function(_dereq_,module,exports){ +module.exports = determinant; + +/** + * Calculates the determinant of a mat4 + * + * @param {mat4} a the source matrix + * @returns {Number} determinant of a + */ +function determinant(a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; +}; +},{}],24:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -14879,8 +14983,1033 @@ function fromQuat(out, q) { return out; }; -},{}],20:[function(_dereq_,module,exports){ -(function (global){ +},{}],25:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],26:[function(_dereq_,module,exports){ +module.exports = fromRotationTranslation; + +/** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat4} q Rotation quaternion + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; +}; +},{}],27:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],28:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],29:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],30:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],31:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],32:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],33:[function(_dereq_,module,exports){ +module.exports = identity; + +/** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ +function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +}; +},{}],34:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":19,"./clone":20,"./copy":21,"./create":22,"./determinant":23,"./fromQuat":24,"./fromRotation":25,"./fromRotationTranslation":26,"./fromScaling":27,"./fromTranslation":28,"./fromXRotation":29,"./fromYRotation":30,"./fromZRotation":31,"./frustum":32,"./identity":33,"./invert":35,"./lookAt":36,"./multiply":37,"./ortho":38,"./perspective":39,"./perspectiveFromFieldOfView":40,"./rotate":41,"./rotateX":42,"./rotateY":43,"./rotateZ":44,"./scale":45,"./str":46,"./translate":47,"./transpose":48}],35:[function(_dereq_,module,exports){ +module.exports = invert; + +/** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; +}; +},{}],36:[function(_dereq_,module,exports){ +var identity = _dereq_('./identity'); + +module.exports = lookAt; + +/** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {vec3} eye Position of the viewer + * @param {vec3} center Point the viewer is looking at + * @param {vec3} up vec3 pointing up + * @returns {mat4} out + */ +function lookAt(out, eye, center, up) { + var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, + eyex = eye[0], + eyey = eye[1], + eyez = eye[2], + upx = up[0], + upy = up[1], + upz = up[2], + centerx = center[0], + centery = center[1], + centerz = center[2]; + + if (Math.abs(eyex - centerx) < 0.000001 && + Math.abs(eyey - centery) < 0.000001 && + Math.abs(eyez - centerz) < 0.000001) { + return identity(out); + } + + z0 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + + x0 = upy * z2 - upz * z1; + x1 = upz * z0 - upx * z2; + x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + y0 = z1 * x2 - z2 * x1; + y1 = z2 * x0 - z0 * x2; + y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + + return out; +}; +},{"./identity":33}],37:[function(_dereq_,module,exports){ +module.exports = multiply; + +/** + * Multiplies two mat4's + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ +function multiply(out, a, b) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + // Cache only the current line of the second matrix + var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; + out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; + out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; + out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + return out; +}; +},{}],38:[function(_dereq_,module,exports){ +module.exports = ortho; + +/** + * Generates a orthogonal projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} left Left bound of the frustum + * @param {number} right Right bound of the frustum + * @param {number} bottom Bottom bound of the frustum + * @param {number} top Top bound of the frustum + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function ortho(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; +},{}],39:[function(_dereq_,module,exports){ +module.exports = perspective; + +/** + * Generates a perspective projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspective(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2), + nf = 1 / (near - far); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + return out; +}; +},{}],40:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],41:[function(_dereq_,module,exports){ +module.exports = rotate; + +/** + * Rotates a mat4 by the given angle + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function rotate(out, a, rad, axis) { + var x = axis[0], y = axis[1], z = axis[2], + len = Math.sqrt(x * x + y * y + z * z), + s, c, t, + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23, + b00, b01, b02, + b10, b11, b12, + b20, b21, b22; + + if (Math.abs(len) < 0.000001) { return null; } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + s = Math.sin(rad); + c = Math.cos(rad); + t = 1 - c; + + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + // Construct the elements of the rotation matrix + b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; + b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; + b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; +}; +},{}],42:[function(_dereq_,module,exports){ +module.exports = rotateX; + +/** + * Rotates a matrix by the given angle around the X axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateX(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; +}; +},{}],43:[function(_dereq_,module,exports){ +module.exports = rotateY; + +/** + * Rotates a matrix by the given angle around the Y axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateY(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + + if (a !== out) { // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; +}; +},{}],44:[function(_dereq_,module,exports){ +module.exports = rotateZ; + +/** + * Rotates a matrix by the given angle around the Z axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function rotateZ(out, a, rad) { + var s = Math.sin(rad), + c = Math.cos(rad), + a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + + if (a !== out) { // If the source and destination differ, copy the unchanged last row + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; +}; +},{}],45:[function(_dereq_,module,exports){ +module.exports = scale; + +/** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to scale + * @param {vec3} v the vec3 to scale the matrix by + * @returns {mat4} out + **/ +function scale(out, a, v) { + var x = v[0], y = v[1], z = v[2]; + + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],46:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],47:[function(_dereq_,module,exports){ +module.exports = translate; + +/** + * Translate a mat4 by the given vector + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to translate + * @param {vec3} v vector to translate by + * @returns {mat4} out + */ +function translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; +}; +},{}],48:[function(_dereq_,module,exports){ +module.exports = transpose; + +/** + * Transpose the values of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function transpose(out, a) { + // If we are transposing ourselves we can skip a few steps but have to cache some values + if (out === a) { + var a01 = a[1], a02 = a[2], a03 = a[3], + a12 = a[6], a13 = a[7], + a23 = a[11]; + + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + + return out; +}; +},{}],49:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -14895,8 +16024,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":22}],21:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":51}],50:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -14922,9 +16051,9 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":22}],22:[function(_dereq_,module,exports){ +},{"is-browser":51}],51:[function(_dereq_,module,exports){ module.exports = true; -},{}],23:[function(_dereq_,module,exports){ +},{}],52:[function(_dereq_,module,exports){ 'use strict'; /** @@ -14961,7 +16090,7 @@ module.exports = function(str){ return true; } -},{}],24:[function(_dereq_,module,exports){ +},{}],53:[function(_dereq_,module,exports){ /* Mapbox GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/mapbox/mapbox-gl-js/blob/v1.10.1/LICENSE.txt */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : @@ -15003,7 +16132,7 @@ return mapboxgl; }))); -},{}],25:[function(_dereq_,module,exports){ +},{}],54:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -15030,7 +16159,7 @@ function getBoundingClientOffset (element) { } } -},{}],26:[function(_dereq_,module,exports){ +},{}],55:[function(_dereq_,module,exports){ module.exports = parse @@ -15089,7 +16218,7 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],27:[function(_dereq_,module,exports){ +},{}],56:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -15217,7 +16346,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":28,"./lib/epsilon":29,"./lib/geojson":30,"./lib/intersecter":31,"./lib/segment-chainer":33,"./lib/segment-selector":34}],28:[function(_dereq_,module,exports){ +},{"./lib/build-log":57,"./lib/epsilon":58,"./lib/geojson":59,"./lib/intersecter":60,"./lib/segment-chainer":62,"./lib/segment-selector":63}],57:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -15332,7 +16461,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],29:[function(_dereq_,module,exports){ +},{}],58:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -15504,7 +16633,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],30:[function(_dereq_,module,exports){ +},{}],59:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -15694,7 +16823,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],31:[function(_dereq_,module,exports){ +},{}],60:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16201,7 +17330,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":32}],32:[function(_dereq_,module,exports){ +},{"./linked-list":61}],61:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16284,7 +17413,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],33:[function(_dereq_,module,exports){ +},{}],62:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16538,7 +17667,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],34:[function(_dereq_,module,exports){ +},{}],63:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -16706,7 +17835,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],35:[function(_dereq_,module,exports){ +},{}],64:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -16892,8 +18021,8 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],36:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +},{}],65:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -18089,7 +19218,7 @@ else { })(Math); -},{}],37:[function(_dereq_,module,exports){ +},{}],66:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18160,7 +19289,7 @@ module.exports = [ } ]; -},{}],38:[function(_dereq_,module,exports){ +},{}],67:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18175,7 +19304,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -18515,7 +19671,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":215,"../../plots/cartesian/constants":231,"../../plots/font_attributes":253,"./arrow_paths":37}],39:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":185,"../../plot_api/plot_template":245,"../../plots/cartesian/constants":262,"../../plots/font_attributes":284,"./arrow_paths":66}],68:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18552,10 +19708,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -18604,7 +19762,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":181,"../../plots/cartesian/axes":225,"./draw":44}],40:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/cartesian/axes":256,"./draw":73}],69:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18742,7 +19900,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":181,"../../plot_api/plot_template":215,"../../registry":275}],41:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plot_api/plot_template":245,"../../registry":306}],70:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18821,7 +19979,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":181,"../color":53}],42:[function(_dereq_,module,exports){ +},{"../../lib":211,"../color":82}],71:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18884,7 +20042,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":204,"fast-isnumeric":18}],43:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":234,"fast-isnumeric":18}],72:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -18947,7 +20105,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -18991,7 +20150,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":181,"../../plots/array_container_defaults":221,"../../plots/cartesian/axes":225,"./attributes":38,"./common_defaults":41}],44:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/array_container_defaults":251,"../../plots/cartesian/axes":256,"./attributes":67,"./common_defaults":70}],73:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19007,6 +20166,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -19067,6 +20227,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -19290,13 +20475,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -19312,12 +20498,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -19334,8 +20525,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -19525,7 +20737,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -19556,22 +20768,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -19603,14 +20816,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -19619,7 +20835,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -19629,7 +20847,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -19649,7 +20869,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -19691,7 +20911,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":181,"../../lib/setcursor":200,"../../lib/svg_text_utils":202,"../../plot_api/plot_template":215,"../../plots/cartesian/axes":225,"../../plots/plots":266,"../../registry":275,"../color":53,"../dragelement":72,"../drawing":75,"../fx":93,"./draw_arrow_head":45,"d3":16}],45:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../lib/setcursor":230,"../../lib/svg_text_utils":232,"../../plot_api/plot_template":245,"../../plots/cartesian/axes":256,"../../plots/plots":297,"../../registry":306,"../color":82,"../dragelement":101,"../drawing":104,"../fx":122,"./draw_arrow_head":74,"d3":16}],74:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19709,6 +20929,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -19828,9 +21053,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -19842,7 +21067,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":53,"./arrow_paths":37,"d3":16}],46:[function(_dereq_,module,exports){ +},{"../../lib":211,"../color":82,"./arrow_paths":66,"d3":16}],75:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19876,7 +21101,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":237,"./attributes":38,"./calc_autorange":39,"./click":40,"./convert_coords":42,"./defaults":43,"./draw":44}],47:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":268,"./attributes":67,"./calc_autorange":68,"./click":69,"./convert_coords":71,"./defaults":72,"./draw":73}],76:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -19964,7 +21189,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../annotations/attributes":38}],48:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../annotations/attributes":67}],77:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20029,7 +21254,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":181,"../../plots/cartesian/axes":225}],49:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/cartesian/axes":256}],78:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20105,7 +21330,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":181,"../../plots/array_container_defaults":221,"../../plots/cartesian/axes":225,"../annotations/common_defaults":41,"./attributes":47}],50:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/array_container_defaults":251,"../../plots/cartesian/axes":256,"../annotations/common_defaults":70,"./attributes":76}],79:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20157,7 +21382,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":256,"../annotations/draw":44}],51:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":287,"../annotations/draw":73}],80:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20205,7 +21430,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":181,"../../registry":275,"./attributes":47,"./convert":48,"./defaults":49,"./draw":50}],52:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306,"./attributes":76,"./convert":77,"./defaults":78,"./draw":79}],81:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20245,7 +21470,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],53:[function(_dereq_,module,exports){ +},{}],82:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20419,7 +21644,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":52,"fast-isnumeric":18,"tinycolor2":36}],54:[function(_dereq_,module,exports){ +},{"./attributes":81,"fast-isnumeric":18,"tinycolor2":65}],83:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20544,6 +21769,17 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -20560,6 +21796,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -20598,7 +21835,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":173,"../../plot_api/edit_types":208,"../../plots/cartesian/layout_attributes":239,"../../plots/font_attributes":253}],55:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plot_api/edit_types":238,"../../plots/cartesian/layout_attributes":270,"../../plots/font_attributes":284}],84:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20626,7 +21863,7 @@ module.exports = { } }; -},{}],56:[function(_dereq_,module,exports){ +},{}],85:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20680,10 +21917,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -20692,7 +21933,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":181,"../../plot_api/plot_template":215,"../../plots/cartesian/tick_label_defaults":246,"../../plots/cartesian/tick_mark_defaults":247,"../../plots/cartesian/tick_value_defaults":248,"./attributes":54}],57:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plot_api/plot_template":245,"../../plots/cartesian/tick_label_defaults":277,"../../plots/cartesian/tick_mark_defaults":278,"../../plots/cartesian/tick_value_defaults":279,"./attributes":83}],86:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -20711,6 +21952,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -20965,10 +22207,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -21080,18 +22322,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -21155,20 +22398,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -21178,7 +22420,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -21223,7 +22469,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -21279,7 +22525,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -21374,10 +22620,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -21419,7 +22667,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":155,"../../lib":181,"../../lib/extend":173,"../../lib/setcursor":200,"../../lib/svg_text_utils":202,"../../plots/cartesian/axes":225,"../../plots/cartesian/axis_defaults":227,"../../plots/cartesian/layout_attributes":239,"../../plots/cartesian/position_defaults":242,"../../plots/plots":266,"../../registry":275,"../color":53,"../colorscale/helpers":64,"../dragelement":72,"../drawing":75,"../titles":148,"./constants":55,"d3":16,"tinycolor2":36}],58:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184,"../../lib":211,"../../lib/extend":203,"../../lib/setcursor":230,"../../lib/svg_text_utils":232,"../../plots/cartesian/axes":256,"../../plots/cartesian/axis_defaults":258,"../../plots/cartesian/layout_attributes":270,"../../plots/cartesian/position_defaults":273,"../../plots/plots":297,"../../registry":306,"../color":82,"../colorscale/helpers":93,"../dragelement":101,"../drawing":104,"../titles":177,"./constants":84,"d3":16,"tinycolor2":65}],87:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21438,7 +22686,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":181}],59:[function(_dereq_,module,exports){ +},{"../../lib":211}],88:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21460,7 +22708,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":54,"./defaults":56,"./draw":57,"./has_colorbar":58}],60:[function(_dereq_,module,exports){ +},{"./attributes":83,"./defaults":85,"./draw":86,"./has_colorbar":87}],89:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21668,7 +22916,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":196,"../colorbar/attributes":54,"./scales.js":68}],61:[function(_dereq_,module,exports){ +},{"../../lib/regex":226,"../colorbar/attributes":83,"./scales.js":97}],90:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21747,7 +22995,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":181,"./helpers":64,"fast-isnumeric":18}],62:[function(_dereq_,module,exports){ +},{"../../lib":211,"./helpers":93,"fast-isnumeric":18}],91:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21824,7 +23072,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":181,"./helpers":64}],63:[function(_dereq_,module,exports){ +},{"../../lib":211,"./helpers":93}],92:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -21949,7 +23197,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":181,"../../registry":275,"../colorbar/defaults":56,"../colorbar/has_colorbar":58,"./scales":68,"fast-isnumeric":18}],64:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306,"../colorbar/defaults":85,"../colorbar/has_colorbar":87,"./scales":97,"fast-isnumeric":18}],93:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22189,7 +23437,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":181,"../color":53,"./scales":68,"d3":16,"fast-isnumeric":18,"tinycolor2":36}],65:[function(_dereq_,module,exports){ +},{"../../lib":211,"../color":82,"./scales":97,"d3":16,"fast-isnumeric":18,"tinycolor2":65}],94:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22231,7 +23479,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":60,"./calc":61,"./cross_trace_defaults":62,"./defaults":63,"./helpers":64,"./layout_attributes":66,"./layout_defaults":67,"./scales":68}],66:[function(_dereq_,module,exports){ +},{"./attributes":89,"./calc":90,"./cross_trace_defaults":91,"./defaults":92,"./helpers":93,"./layout_attributes":95,"./layout_defaults":96,"./scales":97}],95:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22292,7 +23540,7 @@ module.exports = { })) }; -},{"../../lib/extend":173,"./attributes":60,"./scales":68}],67:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"./attributes":89,"./scales":97}],96:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22343,7 +23591,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":181,"../../plot_api/plot_template":215,"./defaults":63,"./layout_attributes":66}],68:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plot_api/plot_template":245,"./defaults":92,"./layout_attributes":95}],97:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22547,7 +23795,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":36}],69:[function(_dereq_,module,exports){ +},{"tinycolor2":65}],98:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22580,7 +23828,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],70:[function(_dereq_,module,exports){ +},{}],99:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22618,7 +23866,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":181}],71:[function(_dereq_,module,exports){ +},{"../../lib":211}],100:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22677,7 +23925,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],72:[function(_dereq_,module,exports){ +},{}],101:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -22969,7 +24217,7 @@ function pointerOffset(e) { ); } -},{"../../lib":181,"../../plots/cartesian/constants":231,"./align":69,"./cursor":70,"./unhover":73,"has-hover":20,"has-passive-events":21,"mouse-event-offset":25}],73:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/cartesian/constants":262,"./align":98,"./cursor":99,"./unhover":102,"has-hover":49,"has-passive-events":50,"mouse-event-offset":54}],102:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23024,7 +24272,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":171,"../../lib/events":172,"../../lib/throttle":203,"../fx/constants":87}],74:[function(_dereq_,module,exports){ +},{"../../lib/dom":201,"../../lib/events":202,"../../lib/throttle":233,"../fx/constants":116}],103:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23049,7 +24297,7 @@ exports.dash = { }; -},{}],75:[function(_dereq_,module,exports){ +},{}],104:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -23069,6 +24317,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -23130,7 +24379,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -23756,7 +25005,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -24147,7 +25396,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -24181,7 +25430,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -24200,7 +25449,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -24231,9 +25480,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -24241,11 +25490,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":89,"../../constants/alignment":155,"../../constants/interactions":157,"../../constants/xmlns_namespaces":159,"../../lib":181,"../../lib/svg_text_utils":202,"../../registry":275,"../../traces/scatter/make_bubble_size_func":323,"../../traces/scatter/subtypes":330,"../color":53,"../colorscale":65,"./symbol_defs":76,"d3":16,"fast-isnumeric":18,"tinycolor2":36}],76:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":118,"../../constants/alignment":184,"../../constants/interactions":187,"../../constants/xmlns_namespaces":189,"../../lib":211,"../../lib/svg_text_utils":232,"../../registry":306,"../../traces/scatter/make_bubble_size_func":354,"../../traces/scatter/subtypes":362,"../color":82,"../colorscale":94,"./symbol_defs":105,"d3":16,"fast-isnumeric":18,"tinycolor2":65}],105:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -24809,7 +26058,7 @@ module.exports = { } }; -},{"d3":16}],77:[function(_dereq_,module,exports){ +},{"d3":16}],106:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -24924,7 +26173,7 @@ module.exports = { } }; -},{}],78:[function(_dereq_,module,exports){ +},{}],107:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25010,7 +26259,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":181,"../../plots/cartesian/axes":225,"../../registry":275,"./compute_error":79,"fast-isnumeric":18}],79:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/cartesian/axes":256,"../../registry":306,"./compute_error":108,"fast-isnumeric":18}],108:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25111,7 +26360,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],80:[function(_dereq_,module,exports){ +},{}],109:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25186,7 +26435,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":181,"../../plot_api/plot_template":215,"../../registry":275,"./attributes":77,"fast-isnumeric":18}],81:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plot_api/plot_template":245,"../../registry":306,"./attributes":106,"fast-isnumeric":18}],110:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25255,7 +26504,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":181,"../../plot_api/edit_types":208,"./attributes":77,"./calc":78,"./compute_error":79,"./defaults":80,"./plot":82,"./style":83}],82:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plot_api/edit_types":238,"./attributes":106,"./calc":107,"./compute_error":108,"./defaults":109,"./plot":111,"./style":112}],111:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25427,7 +26676,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":330,"../drawing":75,"d3":16,"fast-isnumeric":18}],83:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":362,"../drawing":104,"d3":16,"fast-isnumeric":18}],112:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25464,7 +26713,7 @@ module.exports = function style(traces) { }); }; -},{"../color":53,"d3":16}],84:[function(_dereq_,module,exports){ +},{"../color":82,"d3":16}],113:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25500,7 +26749,7 @@ module.exports = { } }; -},{"../../lib/extend":173,"../../plots/font_attributes":253,"./layout_attributes":94}],85:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plots/font_attributes":284,"./layout_attributes":123}],114:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25559,7 +26808,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":181,"../../registry":275}],86:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306}],115:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25596,7 +26845,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":275,"./hover":90}],87:[function(_dereq_,module,exports){ +},{"../../registry":306,"./hover":119}],116:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25628,7 +26877,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],88:[function(_dereq_,module,exports){ +},{}],117:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25654,7 +26903,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":181,"./attributes":84,"./hoverlabel_defaults":91}],89:[function(_dereq_,module,exports){ +},{"../../lib":211,"./attributes":113,"./hoverlabel_defaults":120}],118:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25916,7 +27165,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":181}],90:[function(_dereq_,module,exports){ +},{"../../lib":211}],119:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -25932,6 +27181,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -26111,7 +27362,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -26255,6 +27508,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -26635,10 +27894,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -26879,7 +28136,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -26987,7 +28244,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -27022,8 +28279,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -27031,7 +28293,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -27131,8 +28393,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -27391,7 +28653,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -27407,7 +28672,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -27416,49 +28682,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -27770,7 +29037,7 @@ function plainText(s, len) { }); } -},{"../../lib":181,"../../lib/events":172,"../../lib/override_cursor":192,"../../lib/svg_text_utils":202,"../../plots/cartesian/axes":225,"../../registry":275,"../color":53,"../dragelement":72,"../drawing":75,"../legend/defaults":105,"../legend/draw":106,"./constants":87,"./helpers":89,"d3":16,"fast-isnumeric":18,"tinycolor2":36}],91:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../lib/events":202,"../../lib/override_cursor":222,"../../lib/svg_text_utils":232,"../../plots/cartesian/axes":256,"../../registry":306,"../color":82,"../dragelement":101,"../drawing":104,"../legend/defaults":134,"../legend/draw":135,"./constants":116,"./helpers":118,"d3":16,"fast-isnumeric":18,"tinycolor2":65}],120:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -27816,7 +29083,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":181,"../color":53,"./helpers":89}],92:[function(_dereq_,module,exports){ +},{"../../lib":211,"../color":82,"./helpers":118}],121:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -27872,7 +29139,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":181,"./layout_attributes":94}],93:[function(_dereq_,module,exports){ +},{"../../lib":211,"./layout_attributes":123}],122:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -27951,7 +29218,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":181,"../dragelement":72,"./attributes":84,"./calc":85,"./click":86,"./constants":87,"./defaults":88,"./helpers":89,"./hover":90,"./layout_attributes":94,"./layout_defaults":95,"./layout_global_defaults":96,"d3":16}],94:[function(_dereq_,module,exports){ +},{"../../lib":211,"../dragelement":101,"./attributes":113,"./calc":114,"./click":115,"./constants":116,"./defaults":117,"./helpers":118,"./hover":119,"./layout_attributes":123,"./layout_defaults":124,"./layout_global_defaults":125,"d3":16}],123:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28067,7 +29334,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":253,"./constants":87}],95:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":284,"./constants":116}],124:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28115,7 +29382,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":181,"./helpers":89,"./hoverlabel_defaults":91,"./hovermode_defaults":92,"./layout_attributes":94}],96:[function(_dereq_,module,exports){ +},{"../../lib":211,"./helpers":118,"./hoverlabel_defaults":120,"./hovermode_defaults":121,"./layout_attributes":123}],125:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28138,7 +29405,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":181,"./hoverlabel_defaults":91,"./layout_attributes":94}],97:[function(_dereq_,module,exports){ +},{"../../lib":211,"./hoverlabel_defaults":120,"./layout_attributes":123}],126:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28512,7 +29779,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":181,"../../lib/regex":196,"../../plot_api/plot_template":215,"../../plots/cartesian/constants":231,"../../plots/domain":252}],98:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../lib/regex":226,"../../plot_api/plot_template":245,"../../plots/cartesian/constants":262,"../../plots/domain":283}],127:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28525,6 +29792,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -28647,7 +29915,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw' }); -},{"../../plot_api/plot_template":215,"../../plots/cartesian/constants":231}],99:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":185,"../../plot_api/plot_template":245,"../../plots/cartesian/constants":262}],128:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28728,7 +29996,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":204,"fast-isnumeric":18}],100:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":234,"fast-isnumeric":18}],129:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28780,7 +30048,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -28793,7 +30061,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":181,"../../plots/array_container_defaults":221,"../../plots/cartesian/axes":225,"./attributes":98}],101:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/array_container_defaults":251,"../../plots/cartesian/axes":256,"./attributes":127}],130:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -28807,6 +30075,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -28823,7 +30092,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -28926,10 +30195,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -28938,8 +30222,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -28963,8 +30264,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -29018,7 +30319,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":159,"../../plots/cartesian/axes":225,"../drawing":75,"d3":16}],102:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":189,"../../plots/cartesian/axes":256,"../../plots/cartesian/axis_ids":259,"../drawing":104,"d3":16}],131:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29042,7 +30343,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":237,"./attributes":98,"./convert_coords":99,"./defaults":100,"./draw":101}],103:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":268,"./attributes":127,"./convert_coords":128,"./defaults":129,"./draw":130}],132:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29114,6 +30415,14 @@ module.exports = { editType: 'legend', + }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + + editType: 'legend', + }, itemclick: { @@ -29203,7 +30512,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":253,"../color/attributes":52}],104:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":284,"../color/attributes":81}],133:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29223,13 +30532,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],105:[function(_dereq_,module,exports){ +},{}],134:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29345,6 +30652,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -29363,7 +30671,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":181,"../../plot_api/plot_template":215,"../../plots/layout_attributes":257,"../../registry":275,"./attributes":103,"./helpers":109}],106:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plot_api/plot_template":245,"../../plots/layout_attributes":288,"../../registry":306,"./attributes":132,"./helpers":138}],135:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -29455,7 +30763,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -29776,11 +31083,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -29833,11 +31140,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -29907,7 +31217,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -29960,8 +31271,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -30074,7 +31385,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -30157,7 +31468,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":155,"../../lib":181,"../../lib/events":172,"../../lib/svg_text_utils":202,"../../plots/plots":266,"../../registry":275,"../color":53,"../dragelement":72,"../drawing":75,"./constants":104,"./get_legend_data":107,"./handle_click":108,"./helpers":109,"./style":111,"d3":16}],107:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184,"../../lib":211,"../../lib/events":202,"../../lib/svg_text_utils":232,"../../plots/plots":297,"../../registry":306,"../color":82,"../dragelement":101,"../drawing":104,"./constants":133,"./get_legend_data":136,"./handle_click":137,"./helpers":138,"./style":140,"d3":16}],136:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30266,7 +31577,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":275,"./helpers":109}],108:[function(_dereq_,module,exports){ +},{"../../registry":306,"./helpers":138}],137:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30505,7 +31816,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":181,"../../registry":275}],109:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306}],138:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30529,7 +31840,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],110:[function(_dereq_,module,exports){ +},{}],139:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30553,7 +31864,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":103,"./defaults":105,"./draw":106,"./style":111}],111:[function(_dereq_,module,exports){ +},{"./attributes":132,"./defaults":134,"./draw":135,"./style":140}],140:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -30568,6 +31879,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -30576,6 +31888,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -30586,6 +31900,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -30614,7 +31931,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -30717,7 +32034,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -30737,7 +32054,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -30827,7 +32144,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -30839,7 +32156,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -30867,7 +32184,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -30907,7 +32224,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -30931,7 +32248,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -30971,7 +32288,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -30998,7 +32315,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -31034,7 +32351,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -31132,7 +32449,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -31180,7 +32497,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":181,"../../registry":275,"../../traces/pie/helpers":303,"../../traces/pie/style_one":304,"../../traces/scatter/subtypes":330,"../color":53,"../colorscale/helpers":64,"../drawing":75,"d3":16}],112:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306,"../../traces/pie/helpers":334,"../../traces/pie/style_one":335,"../../traces/scatter/subtypes":362,"../color":82,"../colorscale/helpers":93,"../drawing":104,"./constants":133,"d3":16}],141:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31916,7 +33233,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":162,"../../lib":181,"../../plots/cartesian/axis_ids":228,"../../plots/plots":266,"../../registry":275,"../shapes/draw":134}],113:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":192,"../../lib":211,"../../plots/cartesian/axis_ids":259,"../../plots/plots":297,"../../registry":306,"../shapes/draw":163}],142:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -31930,7 +33247,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":114}],114:[function(_dereq_,module,exports){ +},{"./manage":143}],143:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32226,7 +33543,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":228,"../../registry":275,"../../traces/scatter/subtypes":330,"../fx/helpers":89,"./buttons":112,"./modebar":115}],115:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":259,"../../registry":306,"../../traces/scatter/subtypes":362,"../fx/helpers":118,"./buttons":141,"./modebar":144}],144:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32572,7 +33889,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":162,"../../lib":181,"d3":16,"fast-isnumeric":18}],116:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":192,"../../lib":211,"d3":16,"fast-isnumeric":18}],145:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32708,7 +34025,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":215,"../../plots/font_attributes":253,"../color/attributes":52}],117:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":245,"../../plots/font_attributes":284,"../color/attributes":81}],146:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32737,7 +34054,7 @@ module.exports = { darkAmount: 10 }; -},{}],118:[function(_dereq_,module,exports){ +},{}],147:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32829,7 +34146,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":181,"../../plot_api/plot_template":215,"../../plots/array_container_defaults":221,"../color":53,"./attributes":116,"./constants":117}],119:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plot_api/plot_template":245,"../../plots/array_container_defaults":251,"../color":82,"./attributes":145,"./constants":146}],148:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -32847,6 +34164,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -32976,8 +34294,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -33028,9 +34345,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -33083,10 +34398,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":155,"../../lib":181,"../../lib/svg_text_utils":202,"../../plots/cartesian/axis_ids":228,"../../plots/plots":266,"../../registry":275,"../color":53,"../drawing":75,"./constants":117,"./get_update_object":120,"d3":16}],120:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184,"../../lib":211,"../../lib/svg_text_utils":232,"../../plots/cartesian/axis_ids":259,"../../plots/plots":297,"../../registry":306,"../color":82,"../drawing":104,"./constants":146,"./get_update_object":149,"d3":16}],149:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33140,7 +34455,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":16}],121:[function(_dereq_,module,exports){ +},{"d3":16}],150:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33167,7 +34482,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":116,"./defaults":118,"./draw":119}],122:[function(_dereq_,module,exports){ +},{"./attributes":145,"./defaults":147,"./draw":148}],151:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33241,7 +34556,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":52}],123:[function(_dereq_,module,exports){ +},{"../color/attributes":81}],152:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33275,7 +34590,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":224,"../../plots/cartesian/axis_ids":228,"./constants":124}],124:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":255,"../../plots/cartesian/axis_ids":259,"./constants":153}],153:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33331,7 +34646,7 @@ module.exports = { extraPad: 15 }; -},{}],125:[function(_dereq_,module,exports){ +},{}],154:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33417,7 +34732,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":181,"../../plot_api/plot_template":215,"../../plots/cartesian/axis_ids":228,"./attributes":122,"./oppaxis_attributes":129}],126:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plot_api/plot_template":245,"../../plots/cartesian/axis_ids":259,"./attributes":151,"./oppaxis_attributes":158}],155:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -33434,6 +34749,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -33539,7 +34855,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -33652,6 +34968,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -33798,10 +35116,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -33823,7 +35141,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -34039,14 +35357,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -34060,7 +35376,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":181,"../../lib/setcursor":200,"../../plots/cartesian":238,"../../plots/cartesian/axis_ids":228,"../../plots/plots":266,"../../registry":275,"../color":53,"../dragelement":72,"../drawing":75,"../titles":148,"./constants":124,"d3":16}],127:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../lib/setcursor":230,"../../plots/cartesian":269,"../../plots/cartesian/axis_ids":259,"../../plots/plots":297,"../../registry":306,"../color":82,"../dragelement":101,"../drawing":104,"../titles":177,"./constants":153,"d3":16}],156:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34135,7 +35451,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":155,"../../lib/svg_text_utils":202,"../../plots/cartesian/axis_ids":228,"./constants":124}],128:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184,"../../lib/svg_text_utils":232,"../../plots/cartesian/axis_ids":259,"./constants":153}],157:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34174,7 +35490,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":181,"./attributes":122,"./calc_autorange":123,"./defaults":125,"./draw":126,"./helpers":127,"./oppaxis_attributes":129}],129:[function(_dereq_,module,exports){ +},{"../../lib":211,"./attributes":151,"./calc_autorange":152,"./defaults":154,"./draw":155,"./helpers":156,"./oppaxis_attributes":158}],158:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34212,7 +35528,7 @@ module.exports = { editType: 'calc' }; -},{}],130:[function(_dereq_,module,exports){ +},{}],159:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34228,6 +35544,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -34364,7 +35681,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":173,"../../plot_api/plot_template":215,"../../traces/scatter/attributes":306,"../annotations/attributes":38,"../drawing/attributes":74}],131:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":185,"../../lib/extend":203,"../../plot_api/plot_template":245,"../../traces/scatter/attributes":337,"../annotations/attributes":67,"../drawing/attributes":103}],160:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34392,9 +35709,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -34405,7 +35725,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -34481,7 +35801,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":181,"../../plots/cartesian/axes":225,"./constants":132,"./helpers":141}],132:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/cartesian/axes":256,"./constants":161,"./helpers":170}],161:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34545,7 +35865,7 @@ module.exports = { } }; -},{}],133:[function(_dereq_,module,exports){ +},{}],162:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34611,9 +35931,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -34674,7 +35996,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":181,"../../plots/array_container_defaults":221,"../../plots/cartesian/axes":225,"./attributes":130,"./helpers":141}],134:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/array_container_defaults":251,"../../plots/cartesian/axes":256,"./attributes":159,"./helpers":170}],163:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -34860,7 +36182,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -34886,11 +36211,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -35261,6 +36588,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -35268,15 +36597,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -35433,7 +36770,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":181,"../../lib/setcursor":200,"../../plot_api/plot_template":215,"../../plots/cartesian/axes":225,"../../plots/cartesian/handle_outline":235,"../../registry":275,"../color":53,"../dragelement":72,"../drawing":75,"./constants":132,"./draw_newshape/display_outlines":138,"./draw_newshape/helpers":139,"./helpers":141}],135:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../lib/setcursor":230,"../../plot_api/plot_template":245,"../../plots/cartesian/axes":256,"../../plots/cartesian/handle_outline":266,"../../registry":306,"../color":82,"../dragelement":101,"../drawing":104,"./constants":161,"./draw_newshape/display_outlines":167,"./draw_newshape/helpers":168,"./helpers":170}],164:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35536,7 +36873,7 @@ module.exports = { } }; -},{"../../../lib/extend":173,"../../drawing/attributes":74}],136:[function(_dereq_,module,exports){ +},{"../../../lib/extend":203,"../../drawing/attributes":103}],165:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35560,7 +36897,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],137:[function(_dereq_,module,exports){ +},{}],166:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35592,7 +36929,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":53}],138:[function(_dereq_,module,exports){ +},{"../../color":82}],167:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -35887,7 +37224,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":235,"../../../registry":275,"../../dragelement":72,"../../dragelement/helpers":71,"./constants":136,"./helpers":139,"./newshapes":140}],139:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":266,"../../../registry":306,"../../dragelement":101,"../../dragelement/helpers":100,"./constants":165,"./helpers":168,"./newshapes":169}],168:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36225,7 +37562,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":236,"./constants":136,"parse-svg-path":26}],140:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":267,"./constants":165,"parse-svg-path":55}],169:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36484,7 +37821,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":235,"../../../plots/cartesian/helpers":236,"../../dragelement/helpers":71,"./constants":136,"./helpers":139}],141:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":266,"../../../plots/cartesian/helpers":267,"../../dragelement/helpers":100,"./constants":165,"./helpers":168}],170:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36545,18 +37882,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -36566,13 +37909,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -36629,7 +37979,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":181,"./constants":132}],142:[function(_dereq_,module,exports){ +},{"../../lib":211,"./constants":161}],171:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36657,7 +38007,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":237,"./attributes":130,"./calc_autorange":131,"./defaults":133,"./draw":134,"./draw_newshape/defaults":137}],143:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":268,"./attributes":159,"./calc_autorange":160,"./defaults":162,"./draw":163,"./draw_newshape/defaults":166}],172:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36900,7 +38250,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":173,"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../../plots/animation_attributes":220,"../../plots/font_attributes":253,"../../plots/pad_attributes":265,"./constants":144}],144:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../../plots/animation_attributes":250,"../../plots/font_attributes":284,"../../plots/pad_attributes":296,"./constants":173}],173:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -36994,7 +38344,7 @@ module.exports = { currentValueInset: 0, }; -},{}],145:[function(_dereq_,module,exports){ +},{}],174:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37109,7 +38459,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":181,"../../plots/array_container_defaults":221,"./attributes":143,"./constants":144}],146:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/array_container_defaults":251,"./attributes":172,"./constants":173}],175:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37126,6 +38476,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -37414,11 +38765,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -37469,11 +38819,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -37686,7 +39035,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -37741,7 +39090,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":155,"../../lib":181,"../../lib/svg_text_utils":202,"../../plot_api/plot_template":215,"../../plots/plots":266,"../color":53,"../drawing":75,"./constants":144,"d3":16}],147:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184,"../../lib":211,"../../lib/svg_text_utils":232,"../../plot_api/plot_template":245,"../../plots/plots":297,"../color":82,"../drawing":104,"./constants":173,"d3":16}],176:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37764,7 +39113,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":143,"./constants":144,"./defaults":145,"./draw":146}],148:[function(_dereq_,module,exports){ +},{"./attributes":172,"./constants":173,"./defaults":174,"./draw":175}],177:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -37782,6 +39131,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -37902,7 +39252,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -37980,7 +39330,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -38031,7 +39381,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":155,"../../constants/interactions":157,"../../lib":181,"../../lib/svg_text_utils":202,"../../plots/plots":266,"../../registry":275,"../color":53,"../drawing":75,"d3":16,"fast-isnumeric":18}],149:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184,"../../constants/interactions":187,"../../lib":211,"../../lib/svg_text_utils":232,"../../plots/plots":297,"../../registry":306,"../color":82,"../drawing":104,"d3":16,"fast-isnumeric":18}],178:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38200,7 +39550,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":173,"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../../plots/font_attributes":253,"../../plots/pad_attributes":265,"../color/attributes":52}],150:[function(_dereq_,module,exports){ +},{"../../lib/extend":203,"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../../plots/font_attributes":284,"../../plots/pad_attributes":296,"../color/attributes":81}],179:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38281,7 +39631,7 @@ module.exports = { } }; -},{}],151:[function(_dereq_,module,exports){ +},{}],180:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38364,7 +39714,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":181,"../../plots/array_container_defaults":221,"./attributes":149,"./constants":150}],152:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/array_container_defaults":251,"./attributes":178,"./constants":179}],181:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -38562,8 +39912,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -38802,11 +40151,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -39017,9 +40365,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":155,"../../lib":181,"../../lib/svg_text_utils":202,"../../plot_api/plot_template":215,"../../plots/plots":266,"../color":53,"../drawing":75,"./constants":150,"./scrollbox":154,"d3":16}],153:[function(_dereq_,module,exports){ -arguments[4][147][0].apply(exports,arguments) -},{"./attributes":149,"./constants":150,"./defaults":151,"./draw":152,"dup":147}],154:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184,"../../lib":211,"../../lib/svg_text_utils":232,"../../plot_api/plot_template":245,"../../plots/plots":297,"../color":82,"../drawing":104,"./constants":179,"./scrollbox":183,"d3":16}],182:[function(_dereq_,module,exports){ +arguments[4][176][0].apply(exports,arguments) +},{"./attributes":178,"./constants":179,"./defaults":180,"./draw":181,"dup":176}],183:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39484,7 +40832,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":181,"../color":53,"../drawing":75,"d3":16}],155:[function(_dereq_,module,exports){ +},{"../../lib":211,"../color":82,"../drawing":104,"d3":16}],184:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39549,7 +40897,39 @@ module.exports = { } }; -},{}],156:[function(_dereq_,module,exports){ +},{}],185:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],186:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39565,7 +40945,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],157:[function(_dereq_,module,exports){ +},{}],187:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39588,7 +40968,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],158:[function(_dereq_,module,exports){ +},{}],188:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39661,7 +41041,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],159:[function(_dereq_,module,exports){ +},{}],189:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39685,7 +41065,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],160:[function(_dereq_,module,exports){ +},{}],190:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39771,7 +41151,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":46,"./components/annotations3d":51,"./components/colorbar":59,"./components/colorscale":65,"./components/errorbars":81,"./components/fx":93,"./components/grid":97,"./components/images":102,"./components/legend":110,"./components/rangeselector":121,"./components/rangeslider":128,"./components/shapes":142,"./components/sliders":147,"./components/updatemenus":153,"./fonts/mathjax_config":161,"./fonts/ploticon":162,"./lib/queue":195,"./locale-en":206,"./locale-en-us":205,"./plot_api":210,"./plot_api/plot_schema":214,"./plots/plots":266,"./registry":275,"./snapshot":280,"./traces/scatter":318,"./version":344,"d3":16,"es6-promise":17}],161:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":75,"./components/annotations3d":80,"./components/colorbar":88,"./components/colorscale":94,"./components/errorbars":110,"./components/fx":122,"./components/grid":126,"./components/images":131,"./components/legend":139,"./components/rangeselector":150,"./components/rangeslider":157,"./components/shapes":171,"./components/sliders":176,"./components/updatemenus":182,"./fonts/mathjax_config":191,"./fonts/ploticon":192,"./lib/queue":225,"./locale-en":236,"./locale-en-us":235,"./plot_api":240,"./plot_api/plot_schema":244,"./plots/plots":297,"./registry":306,"./snapshot":311,"./traces/scatter":349,"./version":376,"d3":16,"es6-promise":17}],191:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39802,7 +41182,7 @@ module.exports = function() { } }; -},{}],162:[function(_dereq_,module,exports){ +},{}],192:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -39982,7 +41362,7 @@ module.exports = { } }; -},{}],163:[function(_dereq_,module,exports){ +},{}],193:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40046,7 +41426,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],164:[function(_dereq_,module,exports){ +},{}],194:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40287,7 +41667,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":188}],165:[function(_dereq_,module,exports){ +},{"./mod":218}],195:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40444,7 +41824,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],166:[function(_dereq_,module,exports){ +},{}],196:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40477,7 +41857,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":158,"fast-isnumeric":18}],167:[function(_dereq_,module,exports){ +},{"../constants/numerical":188,"fast-isnumeric":18}],197:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40505,7 +41885,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],168:[function(_dereq_,module,exports){ +},{}],198:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40528,7 +41908,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],169:[function(_dereq_,module,exports){ +},{}],199:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -40992,7 +42372,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":68,"../constants/interactions":157,"../plots/attributes":222,"./array":165,"./mod":188,"./nested_property":189,"./regex":196,"fast-isnumeric":18,"tinycolor2":36}],170:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":97,"../constants/interactions":187,"../plots/attributes":252,"./array":195,"./mod":218,"./nested_property":219,"./regex":226,"fast-isnumeric":18,"tinycolor2":65}],200:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41040,9 +42420,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -41050,7 +42444,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -41579,7 +42973,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":158,"../registry":275,"./loggers":185,"./mod":188,"d3-time-format":14,"fast-isnumeric":18}],171:[function(_dereq_,module,exports){ +},{"../constants/numerical":188,"../registry":306,"./loggers":215,"./mod":218,"d3-time-format":14,"fast-isnumeric":18}],201:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41592,6 +42986,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -41673,16 +43069,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":185,"d3":16}],172:[function(_dereq_,module,exports){ +},{"./loggers":215,"./matrix":217,"d3":16,"gl-mat4":34}],202:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41855,7 +43324,7 @@ var Events = { module.exports = Events; -},{"events":12}],173:[function(_dereq_,module,exports){ +},{"events":12}],203:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -41969,7 +43438,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":182}],174:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":212}],204:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42020,7 +43489,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],175:[function(_dereq_,module,exports){ +},{}],205:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42068,7 +43537,7 @@ function isCalcData(cont) { ); } -},{}],176:[function(_dereq_,module,exports){ +},{}],206:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42453,7 +43922,7 @@ module.exports = { computeBbox: computeBbox }; -},{"./identity":179,"./is_plain_object":182,"./loggers":185,"./nested_property":189,"./polygon":193,"@turf/area":7,"@turf/bbox":8,"@turf/centroid":9,"country-regex":13,"d3":16}],177:[function(_dereq_,module,exports){ +},{"./identity":209,"./is_plain_object":212,"./loggers":215,"./nested_property":219,"./polygon":223,"@turf/area":7,"@turf/bbox":8,"@turf/centroid":9,"country-regex":13,"d3":16}],207:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42570,7 +44039,7 @@ exports.makeBlank = function() { }; }; -},{"../constants/numerical":158}],178:[function(_dereq_,module,exports){ +},{"../constants/numerical":188}],208:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42814,7 +44283,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":188}],179:[function(_dereq_,module,exports){ +},{"./mod":218}],209:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42830,7 +44299,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { module.exports = function identity(d) { return d; }; -},{}],180:[function(_dereq_,module,exports){ +},{}],210:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42872,7 +44341,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],181:[function(_dereq_,module,exports){ +},{}],211:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -42963,8 +44432,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -43020,6 +44492,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -44070,6 +45546,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -44096,13 +45584,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -44120,7 +45606,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":158,"./anchor_utils":163,"./angles":164,"./array":165,"./clean_number":166,"./clear_responsive":168,"./coerce":169,"./dates":170,"./dom":171,"./extend":173,"./filter_unique":174,"./filter_visible":175,"./geometry2d":178,"./identity":179,"./increment":180,"./is_plain_object":182,"./keyed_container":183,"./localize":184,"./loggers":185,"./make_trace_groups":186,"./matrix":187,"./mod":188,"./nested_property":189,"./noop":190,"./notifier":191,"./push_unique":194,"./regex":196,"./relative_attr":197,"./relink_private":198,"./search":199,"./stats":201,"./throttle":203,"./to_log_range":204,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],182:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":188,"./anchor_utils":193,"./angles":194,"./array":195,"./clean_number":196,"./clear_responsive":198,"./coerce":199,"./dates":200,"./dom":201,"./extend":203,"./filter_unique":204,"./filter_visible":205,"./geometry2d":208,"./identity":209,"./increment":210,"./is_plain_object":212,"./keyed_container":213,"./localize":214,"./loggers":215,"./make_trace_groups":216,"./matrix":217,"./mod":218,"./nested_property":219,"./noop":220,"./notifier":221,"./push_unique":224,"./regex":226,"./relative_attr":227,"./relink_private":228,"./search":229,"./stats":231,"./throttle":233,"./to_log_range":234,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],212:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44148,7 +45651,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],183:[function(_dereq_,module,exports){ +},{}],213:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44341,7 +45844,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":189}],184:[function(_dereq_,module,exports){ +},{"./nested_property":219}],214:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44397,7 +45900,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":275}],185:[function(_dereq_,module,exports){ +},{"../registry":306}],215:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44507,7 +46010,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":213,"./notifier":191}],186:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":243,"./notifier":221}],216:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44550,7 +46053,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":16}],187:[function(_dereq_,module,exports){ +},{"d3":16}],217:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44562,6 +46065,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -44637,13 +46141,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -44657,7 +46171,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],188:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":34}],218:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44692,7 +46240,7 @@ module.exports = { modHalf: modHalf }; -},{}],189:[function(_dereq_,module,exports){ +},{}],219:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44938,7 +46486,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":165,"fast-isnumeric":18}],190:[function(_dereq_,module,exports){ +},{"./array":195,"fast-isnumeric":18}],220:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -44954,7 +46502,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],191:[function(_dereq_,module,exports){ +},{}],221:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45042,7 +46590,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":16,"fast-isnumeric":18}],192:[function(_dereq_,module,exports){ +},{"d3":16,"fast-isnumeric":18}],222:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45090,7 +46638,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":200}],193:[function(_dereq_,module,exports){ +},{"./setcursor":230}],223:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45342,7 +46890,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":158,"./matrix":187}],194:[function(_dereq_,module,exports){ +},{"../constants/numerical":188,"./matrix":217}],224:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45380,7 +46928,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],195:[function(_dereq_,module,exports){ +},{}],225:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45588,7 +47136,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":181,"../plot_api/plot_config":213}],196:[function(_dereq_,module,exports){ +},{"../lib":211,"../plot_api/plot_config":243}],226:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45618,7 +47166,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],197:[function(_dereq_,module,exports){ +},{}],227:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45671,7 +47219,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],198:[function(_dereq_,module,exports){ +},{}],228:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45728,7 +47276,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":165,"./is_plain_object":182}],199:[function(_dereq_,module,exports){ +},{"./array":195,"./is_plain_object":212}],229:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45933,7 +47481,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":158,"./identity":179,"./loggers":185,"fast-isnumeric":18}],200:[function(_dereq_,module,exports){ +},{"../constants/numerical":188,"./identity":209,"./loggers":215,"fast-isnumeric":18}],230:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -45956,7 +47504,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],201:[function(_dereq_,module,exports){ +},{}],231:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46066,7 +47614,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":165,"fast-isnumeric":18}],202:[function(_dereq_,module,exports){ +},{"./array":195,"fast-isnumeric":18}],232:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -46083,6 +47631,7 @@ exports.interp = function(arr, n) { var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -46197,7 +47746,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -46812,9 +48361,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -46945,7 +48505,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":155,"../constants/xmlns_namespaces":159,"../lib":181,"d3":16}],203:[function(_dereq_,module,exports){ +},{"../constants/alignment":184,"../constants/xmlns_namespaces":189,"../lib":211,"d3":16}],233:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47048,7 +48608,7 @@ function _clearTimeout(cache) { } } -},{}],204:[function(_dereq_,module,exports){ +},{}],234:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47076,7 +48636,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":18}],205:[function(_dereq_,module,exports){ +},{"fast-isnumeric":18}],235:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47098,7 +48658,7 @@ module.exports = { } }; -},{}],206:[function(_dereq_,module,exports){ +},{}],236:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47141,7 +48701,7 @@ module.exports = { } }; -},{}],207:[function(_dereq_,module,exports){ +},{}],237:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47199,7 +48759,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":275}],208:[function(_dereq_,module,exports){ +},{"../registry":306}],238:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47324,7 +48884,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":181}],209:[function(_dereq_,module,exports){ +},{"../lib":211}],239:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -47501,6 +49061,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -47545,7 +49115,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -48016,7 +49586,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":53,"../lib":181,"../plots/cartesian/axis_ids":228,"../plots/plots":266,"../registry":275,"fast-isnumeric":18,"gl-mat4/fromQuat":19}],210:[function(_dereq_,module,exports){ +},{"../components/color":82,"../lib":211,"../plots/cartesian/axis_ids":259,"../plots/plots":297,"../registry":306,"fast-isnumeric":18,"gl-mat4/fromQuat":24}],240:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -48059,7 +49629,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":277,"./plot_api":212,"./template_api":217,"./to_image":218,"./validate":219}],211:[function(_dereq_,module,exports){ +},{"../snapshot/download":308,"./plot_api":242,"./template_api":247,"./to_image":248,"./validate":249}],241:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -48272,7 +49842,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":182,"../lib/loggers":185,"../lib/noop":190,"../lib/search":199,"../registry":275,"./container_array_match":207}],212:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":212,"../lib/loggers":215,"../lib/noop":220,"../lib/search":229,"../registry":306,"./container_array_match":237}],242:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -48642,7 +50212,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -48656,9 +50237,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -50236,6 +51824,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -50330,7 +51924,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -50420,7 +52014,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -50558,21 +52152,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -51983,6 +53575,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -51990,15 +53595,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -52024,6 +53634,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -52157,7 +53768,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":53,"../components/drawing":75,"../constants/xmlns_namespaces":159,"../lib":181,"../lib/events":172,"../lib/queue":195,"../lib/svg_text_utils":202,"../plots/cartesian/axes":225,"../plots/cartesian/constants":231,"../plots/cartesian/graph_interact":234,"../plots/cartesian/select":244,"../plots/plots":266,"../plots/polar/legacy":269,"../registry":275,"./edit_types":208,"./helpers":209,"./manage_arrays":211,"./plot_config":213,"./plot_schema":214,"./subroutines":216,"d3":16,"fast-isnumeric":18,"has-hover":20}],213:[function(_dereq_,module,exports){ +},{"../components/color":82,"../components/drawing":104,"../constants/xmlns_namespaces":189,"../lib":211,"../lib/events":202,"../lib/queue":225,"../lib/svg_text_utils":232,"../plots/cartesian/axes":256,"../plots/cartesian/constants":262,"../plots/cartesian/graph_interact":265,"../plots/cartesian/select":275,"../plots/plots":297,"../plots/polar/legacy":300,"../registry":306,"./edit_types":238,"./helpers":239,"./manage_arrays":241,"./plot_config":243,"./plot_schema":244,"./subroutines":246,"d3":16,"fast-isnumeric":18,"has-hover":49}],243:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -52472,7 +54083,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],214:[function(_dereq_,module,exports){ +},{}],244:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53183,7 +54794,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":181,"../plots/animation_attributes":220,"../plots/attributes":222,"../plots/frame_attributes":254,"../plots/layout_attributes":257,"../plots/polar/legacy/area_attributes":267,"../plots/polar/legacy/axis_attributes":268,"../registry":275,"./edit_types":208,"./plot_config":213}],215:[function(_dereq_,module,exports){ +},{"../lib":211,"../plots/animation_attributes":250,"../plots/attributes":252,"../plots/frame_attributes":285,"../plots/layout_attributes":288,"../plots/polar/legacy/area_attributes":298,"../plots/polar/legacy/axis_attributes":299,"../registry":306,"./edit_types":238,"./plot_config":243}],245:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53495,7 +55106,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":181,"../plots/attributes":222}],216:[function(_dereq_,module,exports){ +},{"../lib":211,"../plots/attributes":252}],246:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -53676,7 +55287,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -54165,57 +55776,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - - enforceAxisConstraints(gd); - - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); + + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -54241,7 +55830,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":53,"../components/drawing":75,"../components/modebar":113,"../components/titles":148,"../constants/alignment":155,"../lib":181,"../lib/clear_gl_canvases":167,"../plots/cartesian/autorange":224,"../plots/cartesian/axes":225,"../plots/cartesian/constraints":232,"../plots/plots":266,"../registry":275,"d3":16}],217:[function(_dereq_,module,exports){ +},{"../components/color":82,"../components/drawing":104,"../components/modebar":142,"../components/titles":177,"../constants/alignment":184,"../lib":211,"../lib/clear_gl_canvases":197,"../plots/cartesian/autorange":255,"../plots/cartesian/axes":256,"../plots/cartesian/constraints":263,"../plots/plots":297,"../registry":306,"d3":16}],247:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54703,7 +56292,7 @@ function format(opts) { return opts; } -},{"../lib":181,"../plots/attributes":222,"../plots/plots":266,"./plot_config":213,"./plot_schema":214,"./plot_template":215}],218:[function(_dereq_,module,exports){ +},{"../lib":211,"../plots/attributes":252,"../plots/plots":297,"./plot_config":243,"./plot_schema":244,"./plot_template":245}],248:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -54800,7 +56389,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -54924,7 +56513,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":181,"../plots/plots":266,"../snapshot/helpers":279,"../snapshot/svgtoimg":281,"../snapshot/tosvg":283,"../version":344,"./plot_api":212,"fast-isnumeric":18}],219:[function(_dereq_,module,exports){ +},{"../lib":211,"../plots/plots":297,"../snapshot/helpers":310,"../snapshot/svgtoimg":312,"../snapshot/tosvg":314,"../version":376,"./plot_api":242,"fast-isnumeric":18}],249:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55355,7 +56944,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":181,"../plots/plots":266,"./plot_config":213,"./plot_schema":214}],220:[function(_dereq_,module,exports){ +},{"../lib":211,"../plots/plots":297,"./plot_config":243,"./plot_schema":244}],250:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55467,7 +57056,7 @@ module.exports = { } }; -},{}],221:[function(_dereq_,module,exports){ +},{}],251:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55562,7 +57151,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":181,"../plot_api/plot_template":215}],222:[function(_dereq_,module,exports){ +},{"../lib":211,"../plot_api/plot_template":245}],252:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55703,7 +57292,99 @@ module.exports = { } }; -},{"../components/fx/attributes":84}],223:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":113}],253:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":188,"../../lib":211,"fast-isnumeric":18}],254:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55732,7 +57413,7 @@ module.exports = { } }; -},{}],224:[function(_dereq_,module,exports){ +},{}],255:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -55749,6 +57430,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -55789,7 +57472,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -55830,19 +57514,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -55850,9 +57521,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -55870,8 +57541,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -55885,7 +57556,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -55906,7 +57577,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -55915,12 +57586,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -55930,13 +57601,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -55948,7 +57647,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -55977,14 +57766,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -56244,7 +58053,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":158,"../../lib":181,"../../registry":275,"fast-isnumeric":18}],225:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":211,"../../registry":306,"./axis_ids":259,"fast-isnumeric":18}],256:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -56261,6 +58070,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -56294,6 +58104,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -56338,14 +58150,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -56353,6 +58168,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -56377,8 +58207,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -56387,7 +58217,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -56446,7 +58275,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -56768,6 +58599,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -56792,7 +58626,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -56802,6 +58636,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -56815,6 +58653,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -56827,15 +58849,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -56847,85 +58874,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } + var flip = ax._id.charAt(0) === 'y'; - var pos = ax.c2p(tickVal.value); + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -56946,180 +58969,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } - - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -57212,7 +59087,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -57229,15 +59105,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -57350,7 +59228,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -57833,6 +59712,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -58105,21 +59985,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -58220,23 +60102,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -58267,13 +60150,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -58294,7 +60177,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -58310,7 +60193,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -58330,7 +60213,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -58362,7 +60245,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -58374,7 +60257,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -58389,7 +60272,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -58645,21 +60528,81 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; +}; + +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; -}; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} /** * Make axis tick path string @@ -58706,24 +60649,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -58731,42 +60695,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } - out.xFn = function(d) { return d.dx + x0; }; + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } + + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } + + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -59018,6 +61041,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -59035,22 +61060,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -59118,11 +61187,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -59162,6 +61244,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -59643,7 +61745,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":53,"../../components/drawing":75,"../../components/titles":148,"../../constants/alignment":155,"../../constants/numerical":158,"../../lib":181,"../../lib/svg_text_utils":202,"../../plots/plots":266,"../../registry":275,"./autorange":224,"./axis_autotype":226,"./axis_ids":228,"./clean_ticks":230,"./layout_attributes":239,"./set_convert":245,"d3":16,"fast-isnumeric":18}],226:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../components/drawing":104,"../../components/titles":177,"../../constants/alignment":184,"../../constants/numerical":188,"../../lib":211,"../../lib/svg_text_utils":232,"../../plots/plots":297,"../../registry":306,"./autorange":255,"./axis_autotype":257,"./axis_ids":259,"./clean_ticks":261,"./layout_attributes":270,"./set_convert":276,"d3":16,"fast-isnumeric":18}],257:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59660,23 +61762,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; + + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + if(moreDates(a, calendar)) return 'date'; + + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -59689,56 +61817,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":158,"../../lib":181,"fast-isnumeric":18}],227:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":211,"fast-isnumeric":18}],258:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -59795,9 +61933,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -59855,7 +62017,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -59867,8 +62032,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -60021,7 +62184,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":181,"../../registry":275,"../array_container_defaults":221,"./category_order_defaults":229,"./constants":231,"./layout_attributes":239,"./line_grid_defaults":241,"./set_convert":245,"./tick_label_defaults":246,"./tick_mark_defaults":247,"./tick_value_defaults":248,"fast-isnumeric":18}],228:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306,"../array_container_defaults":251,"./category_order_defaults":260,"./constants":262,"./layout_attributes":270,"./line_grid_defaults":272,"./set_convert":276,"./tick_label_defaults":277,"./tick_mark_defaults":278,"./tick_value_defaults":279,"fast-isnumeric":18}],259:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60042,7 +62205,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -60054,13 +62217,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -60106,6 +62276,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -60138,17 +62310,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":275,"./constants":231}],229:[function(_dereq_,module,exports){ +},{"../../registry":306,"./constants":262}],260:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60242,7 +62418,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],230:[function(_dereq_,module,exports){ +},{}],261:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60255,7 +62431,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -60320,7 +62498,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -60330,7 +62510,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":158,"../../lib":181,"fast-isnumeric":18}],231:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":211,"fast-isnumeric":18}],262:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60345,8 +62525,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -60358,7 +62538,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -60422,7 +62602,7 @@ module.exports = { } }; -},{"../../lib/regex":196}],232:[function(_dereq_,module,exports){ +},{"../../lib/regex":226}],263:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60434,74 +62614,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; + + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; + + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + var canLink = linkableAxes.length; + + var matches, scaleanchor; + + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -60512,64 +62898,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; +} - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -60578,12 +62939,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -60596,38 +62959,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); } } - thisGroup[scaleanchor] = 1; + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } + } + + out[key] = val; + } + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -60736,25 +63170,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -60776,6 +63211,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -60808,7 +63253,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":155,"../../constants/numerical":158,"../../lib":181,"./autorange":224,"./axis_ids":228,"./scale_zoom":243}],233:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184,"../../constants/numerical":188,"../../lib":211,"./autorange":255,"./axis_ids":259,"./layout_attributes":270,"./scale_zoom":274,"./set_convert":276}],264:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -60825,6 +63270,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -60901,6 +63347,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -60932,10 +63381,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -60972,6 +63422,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -61137,6 +63590,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -61154,8 +63613,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -61355,6 +63814,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -61364,6 +63825,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -61372,7 +63849,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -61403,15 +63880,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -61420,12 +63899,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -61435,7 +63918,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -61445,9 +63928,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -61647,15 +64145,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -61671,7 +64169,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -61883,7 +64381,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -61896,7 +64394,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -61961,11 +64459,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -61976,14 +64476,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -61993,7 +64501,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -62080,7 +64591,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":53,"../../components/dragelement":72,"../../components/dragelement/helpers":71,"../../components/drawing":75,"../../components/fx":93,"../../constants/alignment":155,"../../lib":181,"../../lib/clear_gl_canvases":167,"../../lib/setcursor":200,"../../lib/svg_text_utils":202,"../../plot_api/subroutines":216,"../../registry":275,"../plots":266,"./axes":225,"./axis_ids":228,"./constants":231,"./scale_zoom":243,"./select":244,"d3":16,"has-passive-events":21,"tinycolor2":36}],234:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../components/dragelement":101,"../../components/dragelement/helpers":100,"../../components/drawing":104,"../../components/fx":122,"../../constants/alignment":184,"../../lib":211,"../../lib/clear_gl_canvases":197,"../../lib/setcursor":230,"../../lib/svg_text_utils":232,"../../plot_api/subroutines":246,"../../registry":306,"../plots":297,"./axes":256,"./axis_ids":259,"./constants":262,"./scale_zoom":274,"./select":275,"d3":16,"has-passive-events":50,"tinycolor2":65}],265:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62248,7 +64759,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":72,"../../components/fx":93,"../../lib/setcursor":200,"./constants":231,"./dragbox":233,"d3":16}],235:[function(_dereq_,module,exports){ +},{"../../components/dragelement":101,"../../components/fx":122,"../../lib/setcursor":230,"./constants":262,"./dragbox":264,"d3":16}],266:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62284,7 +64795,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],236:[function(_dereq_,module,exports){ +},{}],267:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62296,6 +64807,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -62326,9 +64839,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -62338,7 +64852,7 @@ module.exports = { getTransform: getTransform }; -},{}],237:[function(_dereq_,module,exports){ +},{"../../lib":211}],268:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62352,6 +64866,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -62381,8 +64896,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -62413,7 +64930,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":181,"../../registry":275}],238:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306,"./axis_ids":259}],269:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -62751,6 +65268,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -63030,7 +65548,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":75,"../../constants/xmlns_namespaces":159,"../../lib":181,"../../registry":275,"../get_data":255,"../plots":266,"./attributes":223,"./axis_ids":228,"./constants":231,"./graph_interact":234,"./layout_attributes":239,"./layout_defaults":240,"./transition_axes":249,"d3":16}],239:[function(_dereq_,module,exports){ +},{"../../components/drawing":104,"../../constants/xmlns_namespaces":189,"../../lib":211,"../../registry":306,"../get_data":286,"../plots":297,"./attributes":254,"./axis_ids":259,"./constants":262,"./graph_interact":265,"./layout_attributes":270,"./layout_defaults":271,"./transition_axes":280,"d3":16}],270:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63103,6 +65621,14 @@ module.exports = { // type in the template explicitly it will be honored as the default. _noTemplating: true, + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, autorange: { valType: 'enumerated', @@ -63163,7 +65689,6 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', editType: 'plot', @@ -63327,6 +65852,22 @@ module.exports = { editType: 'ticks', + }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + editType: 'calc', + }, mirror: { valType: 'enumerated', @@ -63467,6 +66008,14 @@ module.exports = { editType: 'ticks', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'ticks', + }, separatethousands: { valType: 'boolean', @@ -63719,7 +66268,7 @@ module.exports = { } }; -},{"../../components/color/attributes":52,"../../components/drawing/attributes":74,"../../constants/docs":156,"../../constants/numerical":158,"../../lib/extend":173,"../../plot_api/plot_template":215,"../font_attributes":253,"./constants":231}],240:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":81,"../../components/drawing/attributes":103,"../../constants/docs":186,"../../constants/numerical":188,"../../lib/extend":203,"../../plot_api/plot_template":245,"../font_attributes":284,"./constants":262}],271:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -63741,7 +66290,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -63760,6 +66309,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -63968,6 +66519,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -64032,6 +66584,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -64096,101 +66649,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":53,"../../components/fx/helpers":89,"../../components/fx/hovermode_defaults":92,"../../lib":181,"../../plot_api/plot_template":215,"../../registry":275,"../layout_attributes":257,"./axis_defaults":227,"./axis_ids":228,"./constants":231,"./constraints":232,"./layout_attributes":239,"./position_defaults":242,"./type_defaults":250}],241:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../components/fx/helpers":118,"../../components/fx/hovermode_defaults":121,"../../lib":211,"../../plot_api/plot_template":245,"../../registry":306,"../layout_attributes":288,"./axis_defaults":258,"./axis_ids":259,"./constants":262,"./constraints":263,"./layout_attributes":270,"./position_defaults":273,"./type_defaults":281}],272:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64255,7 +66720,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":52,"../../lib":181,"tinycolor2":36}],242:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":81,"../../lib":211,"tinycolor2":65}],273:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64343,7 +66808,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":181,"fast-isnumeric":18}],243:[function(_dereq_,module,exports){ +},{"../../lib":211,"fast-isnumeric":18}],274:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64369,9 +66834,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":155}],244:[function(_dereq_,module,exports){ +},{"../../constants/alignment":184}],275:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -64441,6 +66907,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -64530,8 +67004,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -65306,7 +67780,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":53,"../../components/dragelement/helpers":71,"../../components/drawing":75,"../../components/fx":93,"../../components/fx/helpers":89,"../../components/shapes/draw_newshape/display_outlines":138,"../../components/shapes/draw_newshape/helpers":139,"../../components/shapes/draw_newshape/newshapes":140,"../../lib":181,"../../lib/clear_gl_canvases":167,"../../lib/polygon":193,"../../lib/throttle":203,"../../plot_api/subroutines":216,"../../registry":275,"./axis_ids":228,"./constants":231,"./handle_outline":235,"./helpers":236,"polybooljs":27}],245:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../components/dragelement/helpers":100,"../../components/drawing":104,"../../components/fx":122,"../../components/fx/helpers":118,"../../components/shapes/draw_newshape/display_outlines":167,"../../components/shapes/draw_newshape/helpers":168,"../../components/shapes/draw_newshape/newshapes":169,"../../lib":211,"../../lib/clear_gl_canvases":197,"../../lib/polygon":223,"../../lib/throttle":233,"../../plot_api/subroutines":246,"../../registry":306,"./axis_ids":259,"./constants":262,"./handle_outline":266,"./helpers":267,"polybooljs":56}],276:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -65339,7 +67813,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -65495,6 +67968,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -65626,12 +68103,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -65674,17 +68151,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -66188,38 +68660,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -66278,7 +68738,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":158,"../../lib":181,"./axis_ids":228,"./constants":231,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],246:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":211,"./axis_ids":259,"./constants":262,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],277:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66291,6 +68751,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -66327,10 +68788,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -66353,6 +68818,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -66399,7 +68865,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":181,"../array_container_defaults":221,"./layout_attributes":239}],247:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../lib":211,"../array_container_defaults":251,"./layout_attributes":270}],278:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66432,7 +68898,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":181,"./layout_attributes":239}],248:[function(_dereq_,module,exports){ +},{"../../lib":211,"./layout_attributes":270}],279:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66479,7 +68945,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":181,"./clean_ticks":230}],249:[function(_dereq_,module,exports){ +},{"../../lib":211,"./clean_ticks":261}],280:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66692,7 +69158,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":75,"../../lib":181,"../../registry":275,"./axes":225,"d3":16}],250:[function(_dereq_,module,exports){ +},{"../../components/drawing":104,"../../lib":211,"../../registry":306,"./axes":256,"d3":16}],281:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -66711,6 +69177,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -66763,6 +69230,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -66829,7 +69298,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":275,"./axis_autotype":226}],251:[function(_dereq_,module,exports){ +},{"../../registry":306,"./axis_autotype":257}],282:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67256,7 +69725,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":181,"../registry":275}],252:[function(_dereq_,module,exports){ +},{"../lib":211,"../registry":306}],283:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67368,7 +69837,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":173}],253:[function(_dereq_,module,exports){ +},{"../lib/extend":203}],284:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67433,7 +69902,7 @@ module.exports = function(opts) { return attrs; }; -},{}],254:[function(_dereq_,module,exports){ +},{}],285:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67479,7 +69948,7 @@ module.exports = { } }; -},{}],255:[function(_dereq_,module,exports){ +},{}],286:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67608,7 +70077,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":275,"./cartesian/constants":231}],256:[function(_dereq_,module,exports){ +},{"../registry":306,"./cartesian/constants":262}],287:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67642,7 +70111,7 @@ function project(camera, v) { module.exports = project; -},{}],257:[function(_dereq_,module,exports){ +},{}],288:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -67830,6 +70299,12 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + + editType: 'none', + + }, paper_bgcolor: { valType: 'color', @@ -67845,6 +70320,14 @@ module.exports = { dflt: colorAttrs.background, editType: 'layoutstyle', + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, separators: { valType: 'string', @@ -67969,7 +70452,7 @@ module.exports = { } }; -},{"../components/color/attributes":52,"../components/shapes/draw_newshape/attributes":135,"../lib/extend":173,"./animation_attributes":220,"./font_attributes":253,"./pad_attributes":265}],258:[function(_dereq_,module,exports){ +},{"../components/color/attributes":81,"../components/shapes/draw_newshape/attributes":164,"../lib/extend":203,"./animation_attributes":250,"./font_attributes":284,"./pad_attributes":296}],289:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68203,7 +70686,7 @@ module.exports = { } }; -},{}],259:[function(_dereq_,module,exports){ +},{}],290:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68276,7 +70759,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":181}],260:[function(_dereq_,module,exports){ +},{"../../lib":211}],291:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68290,6 +70773,8 @@ module.exports = function convertTextOpts(textposition, iconSize) { var mapboxgl = _dereq_('mapbox-gl'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strScale = Lib.strScale; var getSubplotCalcData = _dereq_('../../plots/get_data').getSubplotCalcData; var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); var d3 = _dereq_('d3'); @@ -68401,7 +70886,7 @@ exports.toSVG = function(gd) { var hidden = subplotDiv.select('.mapboxgl-ctrl-logo').node().offsetParent === null; if(!hidden) { var logo = fullLayout._glimages.append('g'); - logo.attr('transform', 'translate(' + (size.l + size.w * domain.x[0] + 10) + ', ' + (size.t + size.h * (1 - domain.y[0]) - 31) + ')'); + logo.attr('transform', strTranslate(size.l + size.w * domain.x[0] + 10, size.t + size.h * (1 - domain.y[0]) - 31)); logo.append('path') .attr('d', constants.mapboxLogo.path0) .style({ @@ -68461,7 +70946,7 @@ exports.toSVG = function(gd) { bBox = Drawing.bBox(attributionText.node()); } - attributionText.attr('transform', 'translate(-3, ' + (-bBox.height + 8) + ')'); + attributionText.attr('transform', strTranslate(-3, -bBox.height + 8)); // Draw white rectangle behind text attributionGroup @@ -68479,7 +70964,7 @@ exports.toSVG = function(gd) { if((bBox.width + 6) > maxWidth) scaleRatio = maxWidth / (bBox.width + 6); var offset = [(size.l + size.w * domain.x[1]), (size.t + size.h * (1 - domain.y[0]))]; - attributionGroup.attr('transform', 'translate(' + offset[0] + ',' + offset[1] + ') scale(' + scaleRatio + ')'); + attributionGroup.attr('transform', strTranslate(offset[0], offset[1]) + strScale(scaleRatio)); } }; @@ -68561,7 +71046,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/drawing":75,"../../constants/xmlns_namespaces":159,"../../lib":181,"../../lib/svg_text_utils":202,"../../plots/get_data":255,"./constants":258,"./layout_attributes":262,"./layout_defaults":263,"./mapbox":264,"d3":16,"mapbox-gl":24}],261:[function(_dereq_,module,exports){ +},{"../../components/drawing":104,"../../constants/xmlns_namespaces":189,"../../lib":211,"../../lib/svg_text_utils":232,"../../plots/get_data":286,"./constants":289,"./layout_attributes":293,"./layout_defaults":294,"./mapbox":295,"d3":16,"mapbox-gl":53}],292:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -68637,7 +71122,7 @@ proto.needsNewSource = function(opts) { // stay safe and make new source on type changes return ( this.sourceType !== opts.sourcetype || - this.source !== opts.source || + JSON.stringify(this.source) !== JSON.stringify(opts.source) || this.layerType !== opts.type ); }; @@ -68649,11 +71134,23 @@ proto.needsNewLayer = function(opts) { ); }; +proto.lookupBelow = function() { + return this.subplot.belowLookup['layout-' + this.index]; +}; + proto.updateImage = function(opts) { var map = this.subplot.map; map.getSource(this.idSource).updateImage({ url: opts.source, coordinates: opts.coordinates }); + + // Since the `updateImage` control flow doesn't call updateLayer, + // We need to take care of moving the image layer to match the location + // where updateLayer would have placed it. + var _below = this.findFollowingMapboxLayerId(this.lookupBelow()); + if(_below !== null) { + this.subplot.map.moveLayer(this.idLayer, _below); + } }; proto.updateSource = function(opts) { @@ -68671,15 +71168,9 @@ proto.updateSource = function(opts) { map.addSource(this.idSource, sourceOpts); }; -proto.updateLayer = function(opts) { - var subplot = this.subplot; - var convertedOpts = convertOpts(opts); - - var below = this.subplot.belowLookup['layout-' + this.index]; - var _below; - +proto.findFollowingMapboxLayerId = function(below) { if(below === 'traces') { - var mapLayers = subplot.getMapLayers(); + var mapLayers = this.subplot.getMapLayers(); // find id of first plotly trace layer for(var i = 0; i < mapLayers.length; i++) { @@ -68687,13 +71178,19 @@ proto.updateLayer = function(opts) { if(typeof layerId === 'string' && layerId.indexOf(constants.traceLayerPrefix) === 0 ) { - _below = layerId; + below = layerId; break; } } - } else { - _below = below; } + return below; +}; + +proto.updateLayer = function(opts) { + var subplot = this.subplot; + var convertedOpts = convertOpts(opts); + var below = this.lookupBelow(); + var _below = this.findFollowingMapboxLayerId(below); this.removeLayer(); @@ -68858,7 +71355,7 @@ module.exports = function createMapboxLayer(subplot, index, opts) { return mapboxLayer; }; -},{"../../lib":181,"../../lib/svg_text_utils":202,"./constants":258,"./convert_text_opts":259}],262:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../lib/svg_text_utils":232,"./constants":289,"./convert_text_opts":290}],293:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69095,7 +71592,7 @@ attrs.uirevision = { }; -},{"../../components/color":53,"../../lib":181,"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../../traces/scatter/attributes":306,"../domain":252,"../font_attributes":253,"./constants":258}],263:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../lib":211,"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../../traces/scatter/attributes":337,"../domain":283,"../font_attributes":284,"./constants":289}],294:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69203,7 +71700,7 @@ function handleLayerDefaults(layerIn, layerOut) { } } -},{"../../lib":181,"../array_container_defaults":221,"../subplot_defaults":273,"./layout_attributes":262}],264:[function(_dereq_,module,exports){ +},{"../../lib":211,"../array_container_defaults":251,"../subplot_defaults":304,"./layout_attributes":293}],295:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -69656,15 +72153,15 @@ proto.initFx = function(calcData, fullLayout) { map.on('mousemove', function(evt) { var bb = self.div.getBoundingClientRect(); - - // some hackery to get Fx.hover to work - evt.clientX = evt.point.x + bb.left; - evt.clientY = evt.point.y + bb.top; + var xy = [ + evt.originalEvent.offsetX, + evt.originalEvent.offsetY + ]; evt.target.getBoundingClientRect = function() { return bb; }; - self.xaxis.p2c = function() { return evt.lngLat.lng; }; - self.yaxis.p2c = function() { return evt.lngLat.lat; }; + self.xaxis.p2c = function() { return map.unproject(xy).lng; }; + self.yaxis.p2c = function() { return map.unproject(xy).lat; }; gd._fullLayout._rehover = function() { if(gd._fullLayout._hoversubplot === self.id && gd._fullLayout[self.id]) { @@ -70014,7 +72511,7 @@ function convertCenter(center) { module.exports = Mapbox; -},{"../../components/dragelement":72,"../../components/dragelement/helpers":71,"../../components/fx":93,"../../lib":181,"../../lib/geo_location_utils":176,"../../registry":275,"../cartesian/axes":225,"../cartesian/select":244,"./constants":258,"./layers":261,"mapbox-gl":24}],265:[function(_dereq_,module,exports){ +},{"../../components/dragelement":101,"../../components/dragelement/helpers":100,"../../components/fx":122,"../../lib":211,"../../lib/geo_location_utils":206,"../../registry":306,"../cartesian/axes":256,"../cartesian/select":275,"./constants":289,"./layers":292,"mapbox-gl":53}],296:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70069,7 +72566,7 @@ module.exports = function(opts) { }; }; -},{}],266:[function(_dereq_,module,exports){ +},{}],297:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -70739,7 +73236,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -71548,6 +74045,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -71936,6 +74435,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -71953,6 +74455,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -71972,13 +74478,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -72003,6 +74511,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -72017,8 +74530,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -72050,11 +74561,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -72064,11 +74574,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -72078,6 +74587,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -72104,11 +74625,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -72232,7 +74766,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -73132,6 +75679,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -73142,7 +75692,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -73152,27 +75701,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -73181,18 +75731,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -73215,16 +75761,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -73266,12 +75815,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -73280,13 +75825,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -73408,7 +75954,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":53,"../constants/numerical":158,"../lib":181,"../plot_api/plot_schema":214,"../plot_api/plot_template":215,"../plots/get_data":255,"../registry":275,"./animation_attributes":220,"./attributes":222,"./cartesian/axis_ids":228,"./cartesian/handle_outline":235,"./command":251,"./font_attributes":253,"./frame_attributes":254,"./layout_attributes":257,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],267:[function(_dereq_,module,exports){ +},{"../components/color":82,"../constants/numerical":188,"../lib":211,"../plot_api/plot_schema":244,"../plot_api/plot_template":245,"../plots/get_data":286,"../registry":306,"./animation_attributes":250,"./attributes":252,"./cartesian/axis_ids":259,"./cartesian/handle_outline":266,"./command":282,"./font_attributes":284,"./frame_attributes":285,"./layout_attributes":288,"d3":16,"d3-time-format":14,"fast-isnumeric":18}],298:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73452,7 +75998,7 @@ module.exports = { } }; -},{"../../../lib/extend":173,"../../../traces/scatter/attributes":306}],268:[function(_dereq_,module,exports){ +},{"../../../lib/extend":203,"../../../traces/scatter/attributes":337}],299:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73574,7 +76120,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":173,"../../../plot_api/edit_types":208,"../../cartesian/layout_attributes":239}],269:[function(_dereq_,module,exports){ +},{"../../../lib/extend":203,"../../../plot_api/edit_types":238,"../../cartesian/layout_attributes":270}],300:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -73589,7 +76135,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":270,"./micropolar_manager":271}],270:[function(_dereq_,module,exports){ +},{"./micropolar":301,"./micropolar_manager":302}],301:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75009,7 +77555,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":155,"../../../lib":181,"d3":16}],271:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":184,"../../../lib":211,"d3":16}],302:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75095,7 +77641,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":53,"../../../lib":181,"./micropolar":270,"./undo_manager":272,"d3":16}],272:[function(_dereq_,module,exports){ +},{"../../../components/color":82,"../../../lib":211,"./micropolar":301,"./undo_manager":303,"d3":16}],303:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75161,7 +77707,7 @@ module.exports = function UndoManager() { }; }; -},{}],273:[function(_dereq_,module,exports){ +},{}],304:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75246,7 +77792,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":181,"../plot_api/plot_template":215,"./domain":252}],274:[function(_dereq_,module,exports){ +},{"../lib":211,"../plot_api/plot_template":245,"./domain":283}],305:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75329,7 +77875,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":156}],275:[function(_dereq_,module,exports){ +},{"../constants/docs":186}],306:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75795,7 +78341,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":171,"./lib/extend":173,"./lib/is_plain_object":182,"./lib/loggers":185,"./lib/noop":190,"./lib/push_unique":194,"./plots/attributes":222,"./plots/layout_attributes":257}],276:[function(_dereq_,module,exports){ +},{"./lib/dom":201,"./lib/extend":203,"./lib/is_plain_object":212,"./lib/loggers":215,"./lib/noop":220,"./lib/push_unique":224,"./plots/attributes":252,"./plots/layout_attributes":288}],307:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -75968,7 +78514,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":181,"../registry":275}],277:[function(_dereq_,module,exports){ +},{"../lib":211,"../registry":306}],308:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76002,6 +78548,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -76038,7 +78586,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":181,"../plot_api/to_image":218,"./filesaver":278,"./helpers":279}],278:[function(_dereq_,module,exports){ +},{"../lib":211,"../plot_api/to_image":248,"./filesaver":309,"./helpers":310}],309:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76118,7 +78666,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":181,"./helpers":279}],279:[function(_dereq_,module,exports){ +},{"../lib":211,"./helpers":310}],310:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76201,7 +78749,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":275}],280:[function(_dereq_,module,exports){ +},{"../registry":306}],311:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76227,7 +78775,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":276,"./download":277,"./helpers":279,"./svgtoimg":281,"./toimage":282,"./tosvg":283}],281:[function(_dereq_,module,exports){ +},{"./cloneplot":307,"./download":308,"./helpers":310,"./svgtoimg":312,"./toimage":313,"./tosvg":314}],312:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76354,7 +78902,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":181,"./helpers":279,"events":12}],282:[function(_dereq_,module,exports){ +},{"../lib":211,"./helpers":310,"events":12}],313:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76431,7 +78979,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":181,"../registry":275,"./cloneplot":276,"./helpers":279,"./svgtoimg":281,"./tosvg":283,"events":12}],283:[function(_dereq_,module,exports){ +},{"../lib":211,"../registry":306,"./cloneplot":307,"./helpers":310,"./svgtoimg":312,"./tosvg":314,"events":12}],314:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76620,7 +79168,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":53,"../components/drawing":75,"../constants/xmlns_namespaces":159,"../lib":181,"d3":16}],284:[function(_dereq_,module,exports){ +},{"../components/color":82,"../components/drawing":104,"../constants/xmlns_namespaces":189,"../lib":211,"d3":16}],315:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76712,7 +79260,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/color/attributes":52,"../../components/colorscale/attributes":60,"../../lib/extend":173,"../../plots/attributes":222,"../../plots/template_attributes":274,"../scattergeo/attributes":333}],285:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":81,"../../components/colorscale/attributes":89,"../../lib/extend":203,"../../plots/attributes":252,"../../plots/template_attributes":305,"../scattergeo/attributes":365}],316:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76773,7 +79321,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/calc":61,"../../constants/numerical":158,"../scatter/arrays_to_calcdata":305,"../scatter/calc_selection":308,"fast-isnumeric":18}],286:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":90,"../../constants/numerical":188,"../scatter/arrays_to_calcdata":336,"../scatter/calc_selection":339,"fast-isnumeric":18}],317:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76798,7 +79346,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],287:[function(_dereq_,module,exports){ +},{}],318:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76820,17 +79368,20 @@ module.exports = function hoverPoints(pointData, xval, yval) { var pt, i, j, isInside; + var xy = [xval, yval]; + var altXy = [xval + 360, yval]; + for(i = 0; i < cd.length; i++) { pt = cd[i]; isInside = false; if(pt._polygons) { for(j = 0; j < pt._polygons.length; j++) { - if(pt._polygons[j].contains([xval, yval])) { + if(pt._polygons[j].contains(xy)) { isInside = !isInside; } // for polygons that cross antimeridian as xval is in [-180, 180] - if(pt._polygons[j].contains([xval + 360, yval])) { + if(pt._polygons[j].contains(altXy)) { isInside = !isInside; } } @@ -76850,7 +79401,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { pointData.zLabel = Axes.tickText(geo.mockAxis, geo.mockAxis.c2l(pt.z), 'hover').text; pointData.hovertemplate = pt.hovertemplate; - makeHoverInfo(pointData, trace, pt, geo.mockAxis); + makeHoverInfo(pointData, trace, pt); return [pointData]; }; @@ -76890,7 +79441,7 @@ function makeHoverInfo(pointData, trace, pt) { pointData.extraText = text.join('
'); } -},{"../../lib":181,"../../plots/cartesian/axes":225,"./attributes":284}],288:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/cartesian/axes":256,"./attributes":315}],319:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -76939,7 +79490,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],289:[function(_dereq_,module,exports){ +},{}],320:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77042,7 +79593,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":60,"../../lib/extend":173,"../../plots/attributes":222,"../../plots/template_attributes":274,"../choropleth/attributes":284}],290:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":89,"../../lib/extend":203,"../../plots/attributes":252,"../../plots/template_attributes":305,"../choropleth/attributes":315}],321:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77198,7 +79749,7 @@ module.exports = { convertOnSelect: convertOnSelect }; -},{"../../components/colorscale":65,"../../components/drawing":75,"../../lib":181,"../../lib/geo_location_utils":176,"../../lib/geojson_utils":177,"fast-isnumeric":18}],291:[function(_dereq_,module,exports){ +},{"../../components/colorscale":94,"../../components/drawing":104,"../../lib":211,"../../lib/geo_location_utils":206,"../../lib/geojson_utils":207,"fast-isnumeric":18}],322:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77249,7 +79800,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../components/colorscale/defaults":63,"../../lib":181,"./attributes":289}],292:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":92,"../../lib":211,"./attributes":320}],323:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77311,7 +79862,7 @@ module.exports = { } }; -},{"../../plots/mapbox":260,"../choropleth/calc":285,"../choropleth/event_data":286,"../choropleth/hover":287,"../choropleth/select":288,"../heatmap/colorbar":302,"./attributes":289,"./defaults":291,"./plot":293}],293:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":291,"../choropleth/calc":316,"../choropleth/event_data":317,"../choropleth/hover":318,"../choropleth/select":319,"../heatmap/colorbar":333,"./attributes":320,"./defaults":322,"./plot":324}],324:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77438,7 +79989,7 @@ module.exports = function createChoroplethMapbox(subplot, calcTrace) { return choroplethMapbox; }; -},{"../../plots/mapbox/constants":258,"./convert":290}],294:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":289,"./convert":321}],325:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77520,7 +80071,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":60,"../../lib/extend":173,"../../plots/attributes":222,"../../plots/template_attributes":274,"../scattermapbox/attributes":335}],295:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":89,"../../lib/extend":203,"../../plots/attributes":252,"../../plots/template_attributes":305,"../scattermapbox/attributes":367}],326:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77579,7 +80130,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/calc":61,"../../constants/numerical":158,"../../lib":181,"fast-isnumeric":18}],296:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":90,"../../constants/numerical":188,"../../lib":211,"fast-isnumeric":18}],327:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77695,7 +80246,7 @@ module.exports = function convert(calcTrace) { return opts; }; -},{"../../components/color":53,"../../components/colorscale":65,"../../constants/numerical":158,"../../lib":181,"../../lib/geojson_utils":177,"fast-isnumeric":18}],297:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../components/colorscale":94,"../../constants/numerical":188,"../../lib":211,"../../lib/geojson_utils":207,"fast-isnumeric":18}],328:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77737,7 +80288,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":63,"../../lib":181,"./attributes":294}],298:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":92,"../../lib":211,"./attributes":325}],329:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77755,7 +80306,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],299:[function(_dereq_,module,exports){ +},{}],330:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77823,7 +80374,7 @@ function getExtraText(trace, di, labels) { return text.join('
'); } -},{"../../lib":181,"../../plots/cartesian/axes":225,"../scattermapbox/hover":340}],300:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../plots/cartesian/axes":256,"../scattermapbox/hover":372}],331:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77870,7 +80421,7 @@ module.exports = { } }; -},{"../../plots/mapbox":260,"../heatmap/colorbar":302,"../scattermapbox/format_labels":339,"./attributes":294,"./calc":295,"./defaults":297,"./event_data":298,"./hover":299,"./plot":301}],301:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":291,"../heatmap/colorbar":333,"../scattermapbox/format_labels":371,"./attributes":325,"./calc":326,"./defaults":328,"./event_data":329,"./hover":330,"./plot":332}],332:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -77984,7 +80535,7 @@ module.exports = function createDensityMapbox(subplot, calcTrace) { return densityMapbox; }; -},{"../../plots/mapbox/constants":258,"./convert":296}],302:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":289,"./convert":327}],333:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78000,7 +80551,7 @@ module.exports = { max: 'zmax' }; -},{}],303:[function(_dereq_,module,exports){ +},{}],334:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78013,19 +80564,21 @@ module.exports = { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -78042,7 +80595,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":181}],304:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":211}],335:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78066,7 +80623,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":53,"./helpers":303}],305:[function(_dereq_,module,exports){ +},{"../../components/color":82,"./helpers":334}],336:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78118,7 +80675,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":181}],306:[function(_dereq_,module,exports){ +},{"../../lib":211}],337:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78137,8 +80694,41 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + + editType: 'calc', + + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + + editType: 'calc', + + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + + editType: 'calc', + + }; +} + module.exports = { x: { valType: 'data_array', @@ -78185,6 +80775,13 @@ module.exports = { }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', @@ -78532,7 +81129,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":60,"../../components/drawing":75,"../../components/drawing/attributes":74,"../../lib/extend":173,"../../plots/font_attributes":253,"../../plots/template_attributes":274,"./constants":310}],307:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":89,"../../components/drawing":104,"../../components/drawing/attributes":103,"../../lib/extend":203,"../../plots/font_attributes":284,"../../plots/template_attributes":305,"./constants":341}],338:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78547,6 +81144,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -78558,8 +81156,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -78590,6 +81191,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -78597,6 +81201,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -78817,7 +81428,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":158,"../../lib":181,"../../plots/cartesian/axes":225,"./arrays_to_calcdata":305,"./calc_selection":308,"./colorscale_calc":309,"./subtypes":330,"fast-isnumeric":18}],308:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":211,"../../plots/cartesian/align_period":253,"../../plots/cartesian/axes":256,"./arrays_to_calcdata":336,"./calc_selection":339,"./colorscale_calc":340,"./subtypes":362,"fast-isnumeric":18}],339:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78836,7 +81447,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":181}],309:[function(_dereq_,module,exports){ +},{"../../lib":211}],340:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78879,7 +81490,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":61,"../../components/colorscale/helpers":64,"./subtypes":330}],310:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":90,"../../components/colorscale/helpers":93,"./subtypes":362}],341:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -78908,7 +81519,7 @@ module.exports = { eventDataKeys: [] }; -},{}],311:[function(_dereq_,module,exports){ +},{}],342:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79089,7 +81700,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":307}],312:[function(_dereq_,module,exports){ +},{"./calc":338}],343:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79128,7 +81739,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],313:[function(_dereq_,module,exports){ +},{}],344:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79146,6 +81757,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -79163,6 +81775,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -79218,7 +81832,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":181,"../../registry":275,"./attributes":306,"./constants":310,"./fillcolor_defaults":314,"./line_defaults":319,"./line_shape_defaults":321,"./marker_defaults":325,"./stack_defaults":328,"./subtypes":330,"./text_defaults":331,"./xy_defaults":332}],314:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306,"./attributes":337,"./constants":341,"./fillcolor_defaults":345,"./line_defaults":350,"./line_shape_defaults":352,"./marker_defaults":356,"./period_defaults":357,"./stack_defaults":360,"./subtypes":362,"./text_defaults":363,"./xy_defaults":364}],345:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79255,7 +81869,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":53,"../../lib":181}],315:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../lib":211}],346:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79281,7 +81895,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":225}],316:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":256}],347:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79330,7 +81944,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":53,"./subtypes":330}],317:[function(_dereq_,module,exports){ +},{"../../components/color":82,"./subtypes":362}],348:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79411,8 +82025,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -79525,7 +82139,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":53,"../../components/fx":93,"../../lib":181,"../../registry":275,"./get_trace_color":316}],318:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../components/fx":122,"../../lib":211,"../../registry":306,"./get_trace_color":347}],349:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79571,7 +82185,7 @@ module.exports = { } }; -},{"../../plots/cartesian":238,"./arrays_to_calcdata":305,"./attributes":306,"./calc":307,"./cross_trace_calc":311,"./cross_trace_defaults":312,"./defaults":313,"./format_labels":315,"./hover":317,"./marker_colorbar":324,"./plot":326,"./select":327,"./style":329,"./subtypes":330}],319:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":269,"./arrays_to_calcdata":336,"./attributes":337,"./calc":338,"./cross_trace_calc":342,"./cross_trace_defaults":343,"./defaults":344,"./format_labels":346,"./hover":348,"./marker_colorbar":355,"./plot":358,"./select":359,"./style":361,"./subtypes":362}],350:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -79602,7 +82216,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":63,"../../components/colorscale/helpers":64,"../../lib":181}],320:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":92,"../../components/colorscale/helpers":93,"../../lib":211}],351:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80063,7 +82677,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":158,"../../lib":181,"./constants":310}],321:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":211,"./constants":341}],352:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80082,7 +82696,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],322:[function(_dereq_,module,exports){ +},{}],353:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80172,7 +82786,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],323:[function(_dereq_,module,exports){ +},{}],354:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80214,7 +82828,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":18}],324:[function(_dereq_,module,exports){ +},{"fast-isnumeric":18}],355:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80232,7 +82846,7 @@ module.exports = { max: 'cmax' }; -},{}],325:[function(_dereq_,module,exports){ +},{}],356:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80313,7 +82927,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":53,"../../components/colorscale/defaults":63,"../../components/colorscale/helpers":64,"./subtypes":330}],326:[function(_dereq_,module,exports){ +},{"../../components/color":82,"../../components/colorscale/defaults":92,"../../components/colorscale/helpers":93,"./subtypes":362}],357:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":188,"../../lib":211}],358:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80874,7 +83535,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":75,"../../lib":181,"../../lib/polygon":193,"../../registry":275,"./line_points":320,"./link_traces":322,"./subtypes":330,"d3":16}],327:[function(_dereq_,module,exports){ +},{"../../components/drawing":104,"../../lib":211,"../../lib/polygon":223,"../../registry":306,"./line_points":351,"./link_traces":353,"./subtypes":362,"d3":16}],359:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -80928,7 +83589,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":330}],328:[function(_dereq_,module,exports){ +},{"./subtypes":362}],360:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81033,7 +83694,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],329:[function(_dereq_,module,exports){ +},{}],361:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81104,7 +83765,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":75,"../../registry":275,"d3":16}],330:[function(_dereq_,module,exports){ +},{"../../components/drawing":104,"../../registry":306,"d3":16}],362:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81143,7 +83804,7 @@ module.exports = { } }; -},{"../../lib":181}],331:[function(_dereq_,module,exports){ +},{"../../lib":211}],363:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81173,7 +83834,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":181}],332:[function(_dereq_,module,exports){ +},{"../../lib":211}],364:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81217,7 +83878,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":181,"../../registry":275}],333:[function(_dereq_,module,exports){ +},{"../../lib":211,"../../registry":306}],365:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81336,7 +83997,7 @@ module.exports = overrideAll({ hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorscale/attributes":60,"../../components/drawing/attributes":74,"../../lib/extend":173,"../../plot_api/edit_types":208,"../../plots/attributes":222,"../../plots/template_attributes":274,"../scatter/attributes":306}],334:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":89,"../../components/drawing/attributes":103,"../../lib/extend":203,"../../plot_api/edit_types":238,"../../plots/attributes":252,"../../plots/template_attributes":305,"../scatter/attributes":337}],366:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81404,7 +84065,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../constants/numerical":158,"../../lib":181,"../scatter/arrays_to_calcdata":305,"../scatter/calc_selection":308,"../scatter/colorscale_calc":309,"fast-isnumeric":18}],335:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":211,"../scatter/arrays_to_calcdata":336,"../scatter/calc_selection":339,"../scatter/colorscale_calc":340,"fast-isnumeric":18}],367:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81517,7 +84178,7 @@ module.exports = overrideAll({ hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorscale/attributes":60,"../../lib/extend":173,"../../plot_api/edit_types":208,"../../plots/attributes":222,"../../plots/mapbox/layout_attributes":262,"../../plots/template_attributes":274,"../scatter/attributes":306,"../scattergeo/attributes":333}],336:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":89,"../../lib/extend":203,"../../plot_api/edit_types":238,"../../plots/attributes":252,"../../plots/mapbox/layout_attributes":293,"../../plots/template_attributes":305,"../scatter/attributes":337,"../scattergeo/attributes":365}],368:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81852,7 +84513,7 @@ function isBADNUM(lonlat) { return lonlat[0] === BADNUM; } -},{"../../components/colorscale":65,"../../components/drawing":75,"../../components/fx/helpers":89,"../../constants/numerical":158,"../../lib":181,"../../lib/geojson_utils":177,"../../lib/svg_text_utils":202,"../../plots/mapbox/convert_text_opts":259,"../scatter/make_bubble_size_func":323,"../scatter/subtypes":330,"fast-isnumeric":18}],337:[function(_dereq_,module,exports){ +},{"../../components/colorscale":94,"../../components/drawing":104,"../../components/fx/helpers":118,"../../constants/numerical":188,"../../lib":211,"../../lib/geojson_utils":207,"../../lib/svg_text_utils":232,"../../plots/mapbox/convert_text_opts":290,"../scatter/make_bubble_size_func":354,"../scatter/subtypes":362,"fast-isnumeric":18}],369:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81930,7 +84591,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":181,"../scatter/fillcolor_defaults":314,"../scatter/line_defaults":319,"../scatter/marker_defaults":325,"../scatter/subtypes":330,"../scatter/text_defaults":331,"./attributes":335}],338:[function(_dereq_,module,exports){ +},{"../../lib":211,"../scatter/fillcolor_defaults":345,"../scatter/line_defaults":350,"../scatter/marker_defaults":356,"../scatter/subtypes":362,"../scatter/text_defaults":363,"./attributes":367}],370:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81950,7 +84611,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],339:[function(_dereq_,module,exports){ +},{}],371:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -81976,7 +84637,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":225}],340:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":256}],372:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82088,7 +84749,7 @@ function getExtraText(trace, di, labels) { return text.join('
'); } -},{"../../components/fx":93,"../../constants/numerical":158,"../../lib":181,"../scatter/get_trace_color":316}],341:[function(_dereq_,module,exports){ +},{"../../components/fx":122,"../../constants/numerical":188,"../../lib":211,"../scatter/get_trace_color":347}],373:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82127,7 +84788,7 @@ module.exports = { } }; -},{"../../plots/mapbox":260,"../scatter/marker_colorbar":324,"../scattergeo/calc":334,"./attributes":335,"./defaults":337,"./event_data":338,"./format_labels":339,"./hover":340,"./plot":342,"./select":343}],342:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":291,"../scatter/marker_colorbar":355,"../scattergeo/calc":366,"./attributes":367,"./defaults":369,"./event_data":370,"./format_labels":371,"./hover":372,"./plot":374,"./select":375}],374:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82260,7 +84921,7 @@ module.exports = function createScatterMapbox(subplot, calcTrace) { return scatterMapbox; }; -},{"../../plots/mapbox/constants":258,"./convert":336}],343:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":289,"./convert":368}],375:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82315,7 +84976,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"../../constants/numerical":158,"../../lib":181,"../scatter/subtypes":330}],344:[function(_dereq_,module,exports){ +},{"../../constants/numerical":188,"../../lib":211,"../scatter/subtypes":362}],376:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -82327,7 +84988,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[5])(5) }); diff --git a/dist/plotly-mapbox.min.js b/dist/plotly-mapbox.min.js index e003520e14f..6060dae326b 100644 --- a/dist/plotly-mapbox.min.js +++ b/dist/plotly-mapbox.min.js @@ -1,10 +1,10 @@ /** -* plotly.js (mapbox - minified) v1.55.2 +* plotly.js (mapbox - minified) v1.58.0 * Copyright 2012-2020, 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 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){return i(e[o][1][t]||t)}),c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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":181}],2:[function(t,e,r){"use strict";e.exports=t("../src/traces/choroplethmapbox")},{"../src/traces/choroplethmapbox":292}],3:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":160}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/densitymapbox")},{"../src/traces/densitymapbox":300}],5:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./scattermapbox"),t("./choroplethmapbox"),t("./densitymapbox")]),e.exports=n},{"./choroplethmapbox":2,"./core":3,"./densitymapbox":4,"./scattermapbox":6}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":341}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/meta");function i(t){var e=0;if(t&&t.length>0){e+=Math.abs(a(t[0]));for(var r=1;r2){for(s=0;st[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},r.radiansToLength=p,r.lengthToRadians=h,r.lengthToDegrees=function(t,e){return f(h(t,e))},r.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},r.radiansToDegrees=f,r.degreesToRadians=function(t){return t%360*Math.PI/180},r.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return p(h(t,e),r)},r.convertArea=function(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=r.areaFactors[e];if(!i)throw new Error("invalid original units");var a=r.areaFactors[n];if(!a)throw new Error("invalid final units");return t/i*a},r.isNumber=d,r.isObject=function(t){return!!t&&t.constructor===Object},r.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!d(t))throw new Error("bbox must only contain numbers")}))},r.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},r.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},r.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},r.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},r.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},r.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},r.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},r.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},{}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/helpers");function i(t,e,r){if(null!==t)for(var n,a,o,s,l,u,c,p,h=0,f=0,d=t.type,m="FeatureCollection"===d,g="Feature"===d,y=m?t.features.length:1,v=0;vu||f>c||d>p)return l=i,u=r,c=f,p=d,void(o=0);var m=n.lineString([l,i],t.properties);if(!1===e(m,r,a,d,o))return!1;o++,l=i}))&&void 0}}}))}function c(t,e){if(!t)throw new Error("geojson is required");l(t,(function(t,r,i){if(null!==t.geometry){var a=t.geometry.type,o=t.geometry.coordinates;switch(a){case"LineString":if(!1===e(t,r,i,0,0))return!1;break;case"Polygon":for(var s=0;s0&&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 y(){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:p(r,u,this);break;case 2:h(r,u,this,arguments[1]);break;case 3:f(r,u,this,arguments[1],arguments[2]);break;case 4:d(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),a=1;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 _(this,t,!0)},o.prototype.rawListeners=function(t){return _(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):x.call(t,e)},o.prototype.listenerCount=x,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],13:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],14:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-time")):i((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function n(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function i(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function a(t){var a=t.dateTime,o=t.date,l=t.time,u=t.periods,c=t.days,p=t.shortDays,h=t.months,vt=t.shortMonths,_t=f(u),xt=d(u),bt=f(c),wt=d(c),Tt=f(p),kt=d(p),At=f(h),Mt=d(h),St=f(vt),Ct=d(vt),Lt={a:function(t){return p[t.getDay()]},A:function(t){return c[t.getDay()]},b:function(t){return vt[t.getMonth()]},B:function(t){return h[t.getMonth()]},c:null,d:O,e:O,f:U,H:R,I:F,j:B,L:N,m:j,M:V,p:function(t){return u[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:gt,s:yt,S:q,u:H,U:Z,V:G,w:X,W:W,x:null,X:null,y:Y,Y:K,Z:J,"%":mt},Et={a:function(t){return p[t.getUTCDay()]},A:function(t){return c[t.getUTCDay()]},b:function(t){return vt[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:Q,e:Q,f:nt,H:$,I:tt,j:et,L:rt,m:it,M:at,p:function(t){return u[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:gt,s:yt,S:ot,u:st,U:lt,V:ut,w:ct,W:pt,x:null,X:null,y:ht,Y:ft,Z:dt,"%":mt},zt={a:function(t,e,r){var n=Tt.exec(e.slice(r));return n?(t.w=kt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=bt.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=St.exec(e.slice(r));return n?(t.m=Ct[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=At.exec(e.slice(r));return n?(t.m=Mt[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return Dt(t,a,e,r)},d:A,e:A,f:z,H:S,I:S,j:M,L:E,m:k,M:C,p:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.p=xt[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:P,s:D,S:L,u:g,U:y,V:v,w:m,W:_,x:function(t,e,r){return Dt(t,o,e,r)},X:function(t,e,r){return Dt(t,l,e,r)},y:b,Y:x,Z:w,"%":I};function It(t,e){return function(r){var n,i,a,o=[],l=-1,u=0,c=t.length;for(r instanceof Date||(r=new Date(+r));++l53)return null;"w"in u||(u.w=1),"Z"in u?(l=(s=n(i(u.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(u.V-1)),u.y=s.getUTCFullYear(),u.m=s.getUTCMonth(),u.d=s.getUTCDate()+(u.w+6)%7):(l=(s=r(i(u.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(u.V-1)),u.y=s.getFullYear(),u.m=s.getMonth(),u.d=s.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),l="Z"in u?n(i(u.y,0,1)).getUTCDay():r(i(u.y,0,1)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+7*u.W-(l+5)%7:u.w+7*u.U-(l+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,n(u)):r(u)}}function Dt(t,e,r,n){for(var i,a,o=0,l=e.length,u=r.length;o=u)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=zt[i in s?e.charAt(o++):i])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}return Lt.x=It(o,Lt),Lt.X=It(l,Lt),Lt.c=It(a,Lt),Et.x=It(o,Et),Et.X=It(l,Et),Et.c=It(a,Et),{format:function(t){var e=It(t+="",Lt);return e.toString=function(){return t},e},parse:function(t){var e=Pt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=It(t+="",Et);return e.toString=function(){return t},e},utcParse:function(t){var e=Pt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,u=/^%/,c=/[\\^$*+?|[\]().{}]/g;function p(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function z(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function I(t,e,r){var n=u.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function P(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function D(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function O(t,e){return p(t.getDate(),e,2)}function R(t,e){return p(t.getHours(),e,2)}function F(t,e){return p(t.getHours()%12||12,e,2)}function B(t,r){return p(1+e.timeDay.count(e.timeYear(t),t),r,3)}function N(t,e){return p(t.getMilliseconds(),e,3)}function U(t,e){return N(t,e)+"000"}function j(t,e){return p(t.getMonth()+1,e,2)}function V(t,e){return p(t.getMinutes(),e,2)}function q(t,e){return p(t.getSeconds(),e,2)}function H(t){var e=t.getDay();return 0===e?7:e}function Z(t,r){return p(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function G(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),p(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function X(t){return t.getDay()}function W(t,r){return p(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function Y(t,e){return p(t.getFullYear()%100,e,2)}function K(t,e){return p(t.getFullYear()%1e4,e,4)}function J(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+p(e/60|0,"0",2)+p(e%60,"0",2)}function Q(t,e){return p(t.getUTCDate(),e,2)}function $(t,e){return p(t.getUTCHours(),e,2)}function tt(t,e){return p(t.getUTCHours()%12||12,e,2)}function et(t,r){return p(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return p(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function it(t,e){return p(t.getUTCMonth()+1,e,2)}function at(t,e){return p(t.getUTCMinutes(),e,2)}function ot(t,e){return p(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,r){return p(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ut(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),p(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ct(t){return t.getUTCDay()}function pt(t,r){return p(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function ht(t,e){return p(t.getUTCFullYear()%100,e,2)}function ft(t,e){return p(t.getUTCFullYear()%1e4,e,4)}function dt(){return"+0000"}function mt(){return"%"}function gt(t){return+t}function yt(t){return Math.floor(+t/1e3)}function vt(e){return o=a(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}vt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var _t=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var xt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=_t,t.isoParse=xt,t.timeFormatDefaultLocale=vt,t.timeFormatLocale=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":15}],15:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,i,a,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),i(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e0))return o;do{o.push(a=new Date(+e)),i(e,n),t(e)}while(a=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;i(t,-1),!e(t););else for(;--r>=0;)for(;i(t,1),!e(t););}))},a&&(s.count=function(n,i){return e.setTime(+n),r.setTime(+i),t(e),t(r),Math.floor(a(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var i=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):i:null};var a=i.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),u=l.range,c=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),p=c.range,h=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),f=h.range;function d(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var m=d(0),g=d(1),y=d(2),v=d(3),_=d(4),x=d(5),b=d(6),w=m.range,T=g.range,k=y.range,A=v.range,M=_.range,S=x.range,C=b.range,L=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),E=L.range,z=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));z.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var I=z.range,P=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),D=P.range,O=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),R=O.range,F=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),B=F.range;function N(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var U=N(0),j=N(1),V=N(2),q=N(3),H=N(4),Z=N(5),G=N(6),X=U.range,W=j.range,Y=V.range,K=q.range,J=H.range,Q=Z.range,$=G.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=h,t.timeDays=f,t.timeFriday=x,t.timeFridays=S,t.timeHour=c,t.timeHours=p,t.timeInterval=n,t.timeMillisecond=i,t.timeMilliseconds=a,t.timeMinute=l,t.timeMinutes=u,t.timeMonday=g,t.timeMondays=T,t.timeMonth=L,t.timeMonths=E,t.timeSaturday=b,t.timeSaturdays=C,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=m,t.timeSundays=w,t.timeThursday=_,t.timeThursdays=M,t.timeTuesday=y,t.timeTuesdays=k,t.timeWednesday=v,t.timeWednesdays=A,t.timeWeek=m,t.timeWeeks=w,t.timeYear=z,t.timeYears=I,t.utcDay=F,t.utcDays=B,t.utcFriday=Z,t.utcFridays=Q,t.utcHour=O,t.utcHours=R,t.utcMillisecond=i,t.utcMilliseconds=a,t.utcMinute=P,t.utcMinutes=D,t.utcMonday=j,t.utcMondays=W,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=G,t.utcSaturdays=$,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=U,t.utcSundays=X,t.utcThursday=H,t.utcThursdays=J,t.utcTuesday=V,t.utcTuesdays=Y,t.utcWednesday=q,t.utcWednesdays=K,t.utcWeek=U,t.utcWeeks=X,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],16:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},i=this.document;function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(i)try{n(i.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),i)try{i.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,u=s.setAttributeNS,c=this.CSSStyleDeclaration.prototype,p=c.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){u.call(this,t,e,r+"")},c.setProperty=function(t,e,r){p.call(this,t,e+"",r)}}function h(t,e){return te?1:t>=e?0:NaN}function f(t){return null===t?NaN:+t}function d(t){return!isNaN(t)}function m(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 g=m(h);function y(t){return t.length}t.bisectLeft=g.left,t.bisect=t.bisectRight=g.right,t.bisector=function(t){return m(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 v=Math.abs;function _(t){for(var e=1;t*e%1;)e*=10;return e}function x(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function b(){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=_(v(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,p,h=-1,f=a.length,d=i[s++],m=new b;++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 L;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,j={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return j(t,G),t}var q=function(t,e){return e.querySelector(t)},H=function(t,e){return e.querySelectorAll(t)},Z=function(t,e){var r=t.matches||t[I(t,"matchesSelector")];return(Z=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},H=Sizzle,Z=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var G=t.selection.prototype=[];function X(t){return"function"==typeof t?t:function(){return q(t,this)}}function W(t){return"function"==typeof t?t:function(){return H(t,this)}}G.select=function(t){var e,r,n,i,a=[];t=X(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),K.hasOwnProperty(r)?{space:K[r],local:t}:t}},G.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))},G.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(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},G.sort=function(t){t=ut.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=i+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=mt.get(e);function u(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=yt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:u:r?D: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=pt,t.selection.enter.prototype=ht,ht.append=G.append,ht.empty=G.empty,ht.node=G.node,ht.call=G.call,ht.size=G.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s0?1:t<0?-1:0}function Pt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Dt(t){return t>1?0:t<-1?Mt:Math.acos(t)}function Ot(t){return t>1?Lt:t<-1?-Lt:Math.asin(t)}function Rt(t){return((t=Math.exp(t))+1/t)/2}function Ft(t){return(t=Math.sin(t/2))*t}var Bt=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,p=l-a,h=c*c+p*p;if(h0&&(e=e.transition().duration(m)),e.call(w.event)}function S(){u&&u.domain(l.range().map((function(t){return(t-h.x)/h.k})).map(l.invert)),p&&p.domain(c.range().map((function(t){return(t-h.y)/h.k})).map(c.invert))}function C(t){g++||t({type:"zoomstart"})}function L(t){S(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function E(t){--g||(t({type:"zoomend"}),r=null)}function z(){var e=this,r=b.of(e,arguments),n=0,i=t.select(o(e)).on(v,l).on(_,u),a=T(t.mouse(e)),s=xt(e);function l(){n=1,A(t.mouse(e),a),L(r)}function u(){i.on(v,null).on(_,null),s(n),E(r)}ys.call(e),C(r)}function I(){var e,r=this,n=b.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,u="touchend"+o,c=[],p=t.select(r),f=xt(r);function d(){var n=t.touches(r);return e=h.k,n.forEach((function(t){t.identifier in i&&(i[t.identifier]=T(t))})),n}function m(){var e=t.event.target;t.select(e).on(l,g).on(u,v),c.push(e);for(var n=t.event.changedTouches,o=0,p=n.length;o1){y=f[0];var _=f[1],x=y[0]-_[0],b=y[1]-_[1];a=x*x+b*b}}function g(){var o,l,u,c,p=t.touches(r);ys.call(r);for(var h=0,f=p.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)||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 ne(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):$t(e instanceof Yt?e.l:(e=ce((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 qt(this.h,this.s,this.l/t)},Ht.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new qt(this.h,this.s,t*this.l)},Ht.rgb=function(){return Zt(this.h,this.s,this.l)},t.hcl=Gt;var Xt=Gt.prototype=new Vt;function Wt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Yt(r,Math.cos(t*=Et)*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):ce((t=ne(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+Kt*(arguments.length?t:1)))},Xt.darker=function(t){return new Gt(this.h,this.c,Math.max(0,this.l-Kt*(arguments.length?t:1)))},Xt.rgb=function(){return Wt(this.h,this.c,this.l).rgb()},t.lab=Yt;var Kt=18,Jt=Yt.prototype=new Vt;function Qt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ne(re(3.2404542*(i=.95047*te(i))-1.5371385*(n=1*te(n))-.4985314*(a=1.08883*te(a))),re(-.969266*i+1.8760108*n+.041556*a),re(.0556434*i-.2040259*n+1.0572252*a))}function $t(t,e,r){return t>0?new Gt(Math.atan2(r,e)*zt,Math.sqrt(e*e+r*r),t):new Gt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,Zt):new ne(t,e,r)}function ie(t){return new ne(t>>16,t>>8&255,255&t)}function ae(t){return ie(t)+""}Jt.brighter=function(t){return new Yt(Math.min(100,this.l+Kt*(arguments.length?t:1)),this.a,this.b)},Jt.darker=function(t){return new Yt(Math.max(0,this.l-Kt*(arguments.length?t:1)),this.a,this.b)},Jt.rgb=function(){return Qt(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(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(he(i[0]),he(i[1]),he(i[2]))}return(a=fe.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 ue(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 qt(n,i,l)}function ce(t,e,r){var n=ee((.4124564*(t=pe(t))+.3575761*(e=pe(e))+.1804375*(r=pe(r)))/.95047),i=ee((.2126729*t+.7151522*e+.072175*r)/1);return Yt(116*i-16,500*(n-i),200*(i-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function pe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function he(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.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=p:u.onreadystatechange=function(){u.readyState>3&&p()},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))}fe.forEach((function(t,e){fe.set(t,ie(e))})),t.functor=de,t.xhr=me(E),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=ge(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 p(){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(xe),xe=setTimeout(Te,e)),_e=0):(_e=1,be(Te))}function ke(){for(var t=Date.now(),e=ye;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ae(){for(var t,e=ye,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Ce(e){var r=e.decimal,n=e.thousands,i=e.grouping,a=e.currency,o=i&&n?function(t,e){for(var r=t.length,a=[],o=0,s=i[0],l=0;r>0&&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)}:E;return function(e){var n=Le.exec(e),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],p=+n[6],h=n[7],f=n[8],d=n[9],m=1,g="",y="",v=!1,_=!0;switch(f&&(f=+f.substring(1)),(c||"0"===i&&"="===s)&&(c=i="0",s="="),d){case"n":h=!0,d="g";break;case"%":m=100,y="%",d="f";break;case"p":m=100,y="%",d="r";break;case"b":case"o":case"x":case"X":"#"===u&&(g="0"+d.toLowerCase());case"c":_=!1;case"d":v=!0,f=0;break;case"s":m=-1,d="r"}"$"===u&&(g=a[0],y=a[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):"e"!=d&&"f"!=d||(f=Math.max(0,Math.min(20,f)))),d=Ee.get(d)||ze;var x=c&&h;return function(e){var n=y;if(v&&e%1)return"";var a=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(m<0){var u=t.formatPrefix(e,f);e=u.scale(e),n=u.symbol+y}else e*=m;var b,w,T=(e=d(e,f)).lastIndexOf(".");if(T<0){var k=_?e.lastIndexOf("e"):-1;k<0?(b=e,w=""):(b=e.substring(0,k),w=e.substring(k))}else b=e.substring(0,T),w=r+e.substring(T+1);!c&&h&&(b=o(b,1/0));var A=g.length+b.length+w.length+(x?0:a.length),M=A"===s?M+a+e:"^"===s?M.substring(0,A>>=1)+a+e+M.substring(A):a+(x?e:M+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Me(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 Le=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ee=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,Me(e,r))).toFixed(Math.max(0,Math.min(20,Me(e*(1+1e-15),r))))}});function ze(t){return t+""}var Ie=t.time={},Pe=Date;function De(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}De.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(){Oe.setUTCDate.apply(this._,arguments)},setDay:function(){Oe.setUTCDay.apply(this._,arguments)},setFullYear:function(){Oe.setUTCFullYear.apply(this._,arguments)},setHours:function(){Oe.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Oe.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Oe.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Oe.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Oe.setUTCSeconds.apply(this._,arguments)},setTime:function(){Oe.setTime.apply(this._,arguments)}};var Oe=Date.prototype;function Re(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=w[o in Ne?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(Pe=De);return r._=t,e(r)}finally{Pe=Date}}return r.parse=function(t){try{Pe=De;var r=e.parse(t);return r&&r._}finally{Pe=Date}},r.toString=e.toString,r},c.multi=c.utc.multi=or;var h=t.map(),f=qe(o),d=He(o),m=qe(s),g=He(s),y=qe(l),v=He(l),_=qe(u),x=He(u);a.forEach((function(t,e){h.set(t.toLowerCase(),e)}));var b={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+Ie.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(Ie.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ve(Ie.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){m.lastIndex=0;var n=m.exec(e.slice(r));return n?(t.w=g.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){f.lastIndex=0;var n=f.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){_.lastIndex=0;var n=_.exec(e.slice(r));return n?(t.m=x.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){y.lastIndex=0;var n=y.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,r){return p(t,b.c.toString(),e,r)},d:Qe,e:Qe,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:Ge,w:Ze,W:Xe,x:function(t,e,r){return p(t,b.x.toString(),e,r)},X:function(t,e,r){return p(t,b.X.toString(),e,r)},y:Ye,Y:We,Z:Ke,"%":ar};return c}Ie.year=Re((function(t){return(t=Ie.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),Ie.years=Ie.year.range,Ie.years.utc=Ie.year.utc.range,Ie.day=Re((function(t){var e=new Pe(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),Ie.days=Ie.day.range,Ie.days.utc=Ie.day.utc.range,Ie.dayOfYear=function(t){var e=Ie.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=Ie[t]=Re((function(t){return(t=Ie.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=Ie.year(t).getDay();return Math.floor((Ie.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));Ie[t+"s"]=r.range,Ie[t+"s"].utc=r.utc.range,Ie[t+"OfYear"]=function(t){var r=Ie.year(t).getDay();return Math.floor((Ie.dayOfYear(t)+(r+e)%7)/7)}})),Ie.week=Ie.sunday,Ie.weeks=Ie.sunday.range,Ie.weeks.utc=Ie.sunday.utc.range,Ie.weekOfYear=Ie.sundayOfYear;var Ne={"-":"",_:" ",0:"0"},Ue=/^\s*\d+/,je=/^%/;function Ve(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3),r+i[0].length):-1}function Ke(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Je(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Qe(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function $e(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){Ue.lastIndex=0;var n=Ue.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=v(e)/60|0,i=v(e)%60;return r+Ve(n,"0",2)+Ve(i,"0",2)}function ar(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*a,l=Math.cos(e),u=Math.sin(e),c=i*u,p=n*l+c*Math.cos(s),h=c*o*Math.sin(s);Cr.add(Math.atan2(h,p)),r=t,n=l,i=u}Lr.point=function(o,s){Lr.point=a,r=(t=o)*Et,n=Math.cos(s=(e=s)*Et/2+Mt/4),i=Math.sin(s)},Lr.lineEnd=function(){a(t,e)}}function zr(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 Ir(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 Dr(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Or(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Rr(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 Fr(t){return[Math.atan2(t[1],t[0]),Ot(t[2])]}function Br(t,e){return v(t[0]-e[0])kt?i=90:u<-kt&&(r=-90),p[0]=e,p[1]=n}};function f(t,a){c.push(p=[e=t,n=t]),ai&&(i=a)}function d(t,o){var s=zr([t*Et,o*Et]);if(l){var u=Pr(l,s),c=Pr([u[1],-u[0],0],u);Rr(c),c=Fr(c);var p=t-a,h=p>0?1:-1,d=c[0]*zt*h,m=v(p)>180;if(m^(h*ai&&(i=g);else if(m^(h*a<(d=(d+360)%360-180)&&di&&(i=o);m?tb(e,n)&&(n=t):b(t,n)>b(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>a?b(e,t)>b(e,n)&&(n=t):b(t,n)>b(e,n)&&(e=t)}else f(t,o);l=s,a=t}function m(){h.point=d}function g(){p[0]=e,p[1]=n,h.point=f,l=null}function y(t,e){if(l){var r=t-a;u+=v(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Lr.point(t,e),d(t,e)}function _(){Lr.lineStart()}function x(){y(o,s),Lr.lineEnd(),v(u)>kt&&(e=-(n=180)),p[0]=e,p[1]=n,l=null}function b(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function T(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tb(m[0],m[1])&&(m[1]=f[1]),b(f[0],m[1])>b(m[0],m[1])&&(m[0]=f[0])):s.push(m=f);for(var l,u,f,d=-1/0,m=(o=0,s[u=s.length-1]);o<=u;m=f,++o)f=s[o],(l=b(m[1],f[0]))>d&&(d=l,e=f[0],n=m[1])}return c=p=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,i]]}}(),t.geo.centroid=function(e){yr=vr=_r=xr=br=wr=Tr=kr=Ar=Mr=Sr=0,t.geo.stream(e,Nr);var r=Ar,n=Mr,i=Sr,a=r*r+n*n+i*i;return a=0;--s)i.point((p=c[s])[0],p[1]);else n(f.x,f.p.x,-1,i);f=f.p}c=(f=f.o).z,d=!d}while(!f.v);i.lineEnd()}}}function Wr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,T=w*b,k=T>Mt,A=d*_;if(Cr.add(Math.atan2(A*w*Math.sin(T),m*x+A*Math.cos(T))),a+=k?b+w*St:b,k^h>=r^y>=r){var M=Pr(zr(p),zr(t));Rr(M);var S=Pr(i,M);Rr(S);var C=(k^b>=0?-1:1)*Ot(S[2]);(n>C||n===C&&(M[0]||M[1]))&&(o+=k^b>=0?1:-1)}if(!g++)break;h=y,d=_,m=x,p=t}}return(a<-kt||a0){for(_||(o.polygonStart(),_=!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 Qr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:D,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]-Lt-kt:Lt-t[1])-((e=e.x)[0]<0?e[1]-Lt-kt:Lt-e[1])}var tn=Kr(Gr,(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?Mt:-Mt,l=v(a-r);v(l-Mt)0?Lt:-Lt),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Mt&&(v(r-i)kt?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(-Mt,i),n.point(0,i),n.point(Mt,i),n.point(Mt,0),n.point(Mt,-i),n.point(0,-i),n.point(-Mt,-i),n.point(-Mt,0),n.point(-Mt,i);else if(v(t[0]-e[0])>kt){var a=t[0]0,n=v(e)>kt;return Kr(i,(function(t){var e,s,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(p,h){var f,d=[p,h],m=i(p,h),g=r?m?0:o(p,h):m?o(p+(p<0?Mt:-Mt),h):0;if(!e&&(u=l=m)&&t.lineStart(),m!==l&&(f=a(e,d),(Br(e,f)||Br(d,f))&&(d[0]+=kt,d[1]+=kt,m=i(d[0],d[1]))),m!==l)c=0,m?(t.lineStart(),f=a(d,e),t.point(f[0],f[1])):(f=a(e,d),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(n&&e&&r^m){var y;g&s||!(y=a(d,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!m||e&&Br(e,d)||t.point(d[0],d[1]),e=d,l=m,s=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(u&&l)<<1}}}),Bn(t,6*Et),r?[0,-t]:[-Mt,t-Mt]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function a(t,r,n){var i=[1,0,0],a=Pr(zr(t),zr(r)),o=Ir(a,a),s=a[0],l=o-s*s;if(!l)return!n&&t;var u=e*o/l,c=-e*s/l,p=Pr(i,a),h=Or(i,u);Dr(h,Or(a,c));var f=p,d=Ir(h,f),m=Ir(f,f),g=d*d-m*(Ir(h,h)-1);if(!(g<0)){var y=Math.sqrt(g),_=Or(f,(-d-y)/m);if(Dr(_,h),_=Fr(_),!n)return _;var x,b=t[0],w=r[0],T=t[1],k=r[1];w0^_[1]<(v(_[0]-b)Mt^(b<=_[0]&&_[0]<=w)){var S=Or(f,(-d+y)/m);return Dr(S,h),[_,Fr(S)]}}}function o(e,n){var i=r?t:Mt-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}function rn(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=0,p=1,h=s.x-l,f=s.y-u;if(a=t-l,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>p)return;a>c&&(c=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>p)return;a>c&&(c=a)}else if(h>0){if(a0)){if(a/=f,f<0){if(a0){if(a>p)return;a>c&&(c=a)}if(a=n-u,f||!(a<0)){if(a/=f,f<0){if(a>p)return;a>c&&(c=a)}else if(f>0){if(a0&&(i.a={x:l+c*h,y:u+c*f}),p<1&&(i.b={x:l+p*h,y:u+p*f}),i}}}}}}function nn(e,r,n,i){return function(l){var u,c,p,h,f,d,m,g,y,v,_,x=l,b=Qr(),w=rn(e,r,n,i),T={point:M,lineStart:function(){T.point=S,c&&c.push(p=[]);v=!0,y=!1,m=g=NaN},lineEnd:function(){u&&(S(h,f),d&&y&&b.rejoin(),u.push(b.buffer()));T.point=M,y&&l.lineEnd()},polygonStart:function(){l=b,u=[],c=[],_=!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&&Pt(u,a,t)>0&&++e:a[1]<=n&&Pt(u,a,t)<0&&--e,u=a;return 0!==e}([e,i]),n=_&&r,a=u.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),k(null,null,1,l),l.lineEnd()),a&&Xr(u,o,r,k,l),l.polygonEnd()),u=c=p=null}};function k(t,o,l,u){var c=0,p=0;if(null==t||(c=a(t,l))!==(p=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)!==p);else u.point(o[0],o[1])}function A(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function M(t,e){A(t,e)&&l.point(t,e)}function S(t,e){var r=A(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(c&&p.push([t,e]),v)h=t,f=e,d=r,v=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&y)l.point(t,e);else{var n={a:{x:m,y:g},b:{x:t,y:e}};w(n)?(y||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),_=!1):r&&(l.lineStart(),l.point(t,e),_=!1)}m=t,g=e,y=r}return T};function a(t,i){return v(t[0]-e)0?0:3:v(t[0]-n)0?2:1:v(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=Mt/3,n=En(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Mt/180,r=t[1]*Mt/180):[e/Mt*180,r/Mt*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,Ot((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],p=+t[1];return r=a.translate(t).clipExtent([[c-.455*e,p-.238*e],[c+.455*e,p+.238*e]]).stream(l).point,n=o.translate([c-.307*e,p+.201*e]).clipExtent([[c-.425*e+kt,p+.12*e+kt],[c-.214*e-kt,p+.234*e-kt]]).stream(l).point,i=s.translate([c-.205*e,p+.212*e]).clipExtent([[c-.214*e+kt,p+.166*e+kt],[c-.115*e-kt,p+.234*e-kt]]).stream(l).point,u},u.scale(1070)};var sn,ln,un,cn,pn,hn,fn={point:D,lineStart:D,lineEnd:D,polygonStart:function(){ln=0,fn.lineStart=dn},polygonEnd:function(){fn.lineStart=fn.lineEnd=fn.point=D,sn+=v(ln/2)}};function dn(){var t,e,r,n;function i(t,e){ln+=n*t-r*e,r=t,n=e}fn.point=function(a,o){fn.point=i,t=r=a,e=n=o},fn.lineEnd=function(){i(t,e)}}var mn={point:function(t,e){tpn&&(pn=t);ehn&&(hn=e)},lineStart:D,lineEnd:D,polygonStart:D,polygonEnd:D};function gn(){var t=yn(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=yn(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 yn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var vn,_n={point:xn,lineStart:bn,lineEnd:wn,polygonStart:function(){_n.lineStart=Tn},polygonEnd:function(){_n.point=xn,_n.lineStart=bn,_n.lineEnd=wn}};function xn(t,e){_r+=t,xr+=e,++br}function bn(){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,Tr+=o*(e+n)/2,kr+=o,xn(t=r,e=n)}_n.point=function(n,i){_n.point=r,xn(t=n,e=i)}}function wn(){_n.point=xn}function Tn(){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,Tr+=o*(n+e)/2,kr+=o,Ar+=(o=n*t-r*e)*(r+t),Mr+=o*(n+e),Sr+=3*o,xn(r=t,n=e)}_n.point=function(a,o){_n.point=i,xn(t=r=a,e=n=o)},_n.lineEnd=function(){i(t,e)}}function kn(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:D};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,St)}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 An(t){var e=.5,r=Math.cos(30*Et),n=16;function i(t){return(n?o:a)(t)}function a(e){return Cn(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,i,a,o,l,u,c,p,h,f,d,m,g={point:y,lineStart:v,lineEnd:x,polygonStart:function(){e.polygonStart(),g.lineStart=b},polygonEnd:function(){e.polygonEnd(),g.lineStart=v}};function y(r,n){r=t(r,n),e.point(r[0],r[1])}function v(){p=NaN,g.point=_,e.lineStart()}function _(r,i){var a=zr([r,i]),o=t(r,i);s(p,h,c,f,d,m,p=o[0],h=o[1],c=r,f=a[0],d=a[1],m=a[2],n,e),e.point(p,h)}function x(){g.point=y,e.lineEnd()}function b(){v(),g.point=w,g.lineEnd=T}function w(t,e){_(r=t,e),i=p,a=h,o=f,l=d,u=m,g.point=_}function T(){s(p,h,c,f,d,m,i,a,r,o,l,u,n,e),g.lineEnd=x,x()}return g}function s(n,i,a,o,l,u,c,p,h,f,d,m,g,y){var _=c-n,x=p-i,b=_*_+x*x;if(b>4*e&&g--){var w=o+f,T=l+d,k=u+m,A=Math.sqrt(w*w+T*T+k*k),M=Math.asin(k/=A),S=v(v(k)-1)e||v((_*z+x*I)/b-.5)>.3||o*f+l*d+u*m0&&16,i):Math.sqrt(e)},i}function Mn(t){var e=An((function(e,r){return t([e*zt,r*zt])}));return function(t){return zn(e(t))}}function Sn(t){this.stream=t}function Cn(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 En((function(){return t}))()}function En(e){var r,n,i,a,o,s,l=An((function(t,e){return[(t=r(t,e))[0]*u+a,o-t[1]*u]})),u=150,c=480,p=250,h=0,f=0,d=0,m=0,g=0,y=tn,v=E,_=null,x=null;function b(t){return[(t=i(t[0]*Et,t[1]*Et))[0]*u+a,o-t[1]*u]}function w(t){return(t=i.invert((t[0]-a)/u,(o-t[1])/u))&&[t[0]*zt,t[1]*zt]}function T(){i=Zr(n=Dn(d,m,g),r);var t=r(h,f);return a=c-t[0]*u,o=p+t[1]*u,k()}function k(){return s&&(s.valid=!1,s=null),b}return b.stream=function(t){return s&&(s.valid=!1),(s=zn(y(n,l(v(t))))).valid=!0,s},b.clipAngle=function(t){return arguments.length?(y=null==t?(_=t,tn):en((_=+t)*Et),k()):_},b.clipExtent=function(t){return arguments.length?(x=t,v=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):E,k()):x},b.scale=function(t){return arguments.length?(u=+t,T()):u},b.translate=function(t){return arguments.length?(c=+t[0],p=+t[1],T()):[c,p]},b.center=function(t){return arguments.length?(h=t[0]%360*Et,f=t[1]%360*Et,T()):[h*zt,f*zt]},b.rotate=function(t){return arguments.length?(d=t[0]%360*Et,m=t[1]%360*Et,g=t.length>2?t[2]%360*Et:0,T()):[d*zt,m*zt,g*zt]},t.rebind(b,l,"precision"),function(){return r=e.apply(this,arguments),b.invert=r.invert&&w,T()}}function zn(t){return Cn(t,(function(e,r){t.point(e*Et,r*Et)}))}function In(t,e){return[t,e]}function Pn(t,e){return[t>Mt?t-St:t<-Mt?t+St:t,e]}function Dn(t,e,r){return t?e||r?Zr(Rn(t),Fn(e,r)):Rn(t):e||r?Fn(e,r):Pn}function On(t){return function(e,r){return[(e+=t)>Mt?e-St:e<-Mt?e+St:e,r]}}function Rn(t){var e=On(t);return e.invert=On(-t),e}function Fn(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),Ot(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),Ot(c*r-s*n)]},o}function Bn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Nn(r,i),a=Nn(r,a),(o>0?ia)&&(i+=o*St)):(i=t+o*St,a=t-.5*l);for(var u,c=i;o>0?c>a:c2?t[2]*Et:0),e.invert=function(e){return(e=t.invert(e[0]*Et,e[1]*Et))[0]*=zt,e[1]*=zt,e},e},Pn.invert=In,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=Dn(-t[0]*Et,-t[1]*Et,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=zt,t[1]*=zt}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=Bn((t=+r)*Et,n*Et),i):t},i.precision=function(r){return arguments.length?(e=Bn(t*Et,(n=+r)*Et),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Et,i=t[1]*Et,a=e[1]*Et,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),p=Math.cos(a);return Math.atan2(Math.sqrt((r=p*o)*r+(r=u*c-l*p*s)*r),l*c+u*p*s)},t.geo.graticule=function(){var e,r,n,i,a,o,s,l,u,c,p,h,f=10,d=f,m=90,g=360,y=2.5;function _(){return{type:"MultiLineString",coordinates:x()}}function x(){return t.range(Math.ceil(i/m)*m,n,m).map(p).concat(t.range(Math.ceil(l/g)*g,s,g).map(h)).concat(t.range(Math.ceil(r/f)*f,e,f).filter((function(t){return v(t%m)>kt})).map(u)).concat(t.range(Math.ceil(o/d)*d,a,d).filter((function(t){return v(t%g)>kt})).map(c))}return _.lines=function(){return x().map((function(t){return{type:"LineString",coordinates:t}}))},_.outline=function(){return{type:"Polygon",coordinates:[p(i).concat(h(s).slice(1),p(n).reverse().slice(1),h(l).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.majorExtent(t).minorExtent(t):_.minorExtent()},_.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),_.precision(y)):[[i,l],[n,s]]},_.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),_.precision(y)):[[r,o],[e,a]]},_.step=function(t){return arguments.length?_.majorStep(t).minorStep(t):_.minorStep()},_.majorStep=function(t){return arguments.length?(m=+t[0],g=+t[1],_):[m,g]},_.minorStep=function(t){return arguments.length?(f=+t[0],d=+t[1],_):[f,d]},_.precision=function(t){return arguments.length?(y=+t,u=Un(o,a,90),c=jn(r,e,y),p=Un(l,s,90),h=jn(i,n,y),_):y},_.majorExtent([[-180,-90+kt],[180,90-kt]]).minorExtent([[-180,-80-kt],[180,80+kt]])},t.geo.greatArc=function(){var e,r,n=Vn,i=qn;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]*Et,n=t[1]*Et,i=e[0]*Et,a=e[1]*Et,o=Math.cos(n),s=Math.sin(n),l=Math.cos(a),u=Math.sin(a),c=o*Math.cos(r),p=o*Math.sin(r),h=l*Math.cos(i),f=l*Math.sin(i),d=2*Math.asin(Math.sqrt(Ft(a-n)+o*l*Ft(i-r))),m=1/Math.sin(d),(g=d?function(t){var e=Math.sin(t*=d)*m,r=Math.sin(d-t)*m,n=r*c+e*h,i=r*p+e*f,a=r*s+e*u;return[Math.atan2(i,n)*zt,Math.atan2(a,Math.sqrt(n*n+i*i))*zt]}:function(){return[r*zt,n*zt]}).distance=d,g;var r,n,i,a,o,s,l,u,c,p,h,f,d,m,g},t.geo.length=function(e){return vn=0,t.geo.stream(e,Hn),vn};var Hn={sphere:D,point:D,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=Et),o=Math.cos(i),s=v((n*=Et)-t),l=Math.cos(s);vn+=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*Et,e=Math.sin(a*=Et),r=Math.cos(a),Hn.point=n},Hn.lineEnd=function(){Hn.point=Hn.lineEnd=D}},lineEnd:D,polygonStart:D,polygonEnd:D};function Zn(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=Zn((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=Zn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),E);function Wn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(Mt/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 Jn;function o(t,e){a>0?e<-Lt+kt&&(e=-Lt+kt):e>Lt-kt&&(e=Lt-kt);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=It(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(v(n)1&&Pt(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ai(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Ln(ti)}).raw=ti,ei.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Lt]},(t.geo.transverseMercator=function(){var t=Qn(ei),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=ei,t.geom={},t.geom.hull=function(t){var e=ri,r=ni;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=de(e),a=de(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)f.push(t[s[u[n]][2]]);for(n=+p;nkt)s=s.L;else{if(!((i=a-Ti(s,o))>kt)){n>-kt?(e=s.P,r=s):i>-kt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=vi(t);if(hi.insert(e,l),e||r){if(e===r)return Ci(e),r=vi(e.site),hi.insert(l,r),l.edge=r.edge=zi(e.site,l.site),Si(e),void Si(r);if(r){Ci(e),Ci(r);var u=e.site,c=u.x,p=u.y,h=t.x-c,f=t.y-p,d=r.site,m=d.x-c,g=d.y-p,y=2*(h*g-f*m),v=h*h+f*f,_=m*m+g*g,x={x:(g*v-f*_)/y+c,y:(h*_-m*v)/y+p};Pi(r.edge,u,d,x),l.edge=zi(u,t,null,x),r.edge=zi(t,d,null,x),Si(e),Si(r)}else l.edge=zi(e.site,l.site)}}function wi(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,p=1/a-1/u,h=c/u;return p?(-h+Math.sqrt(h*h-2*p*(c*c/(-2*u)-l+u/2+i-a/2)))/p+n:(n+s)/2}function Ti(t,e){var r=t.N;if(r)return wi(r,e);var n=t.site;return n.y===e?n.x:1/0}function ki(t){this.site=t,this.edges=[]}function Ai(t,e){return e.angle-t.angle}function Mi(){Ri(this),this.x=this.y=this.arc=this.site=this.cy=null}function Si(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,p=2*(l*(g=a.y-s)-u*c);if(!(p>=-At)){var h=l*l+u*u,f=c*c+g*g,d=(g*h-u*f)/p,m=(l*f-c*h)/p,g=m+s,y=gi.pop()||new Mi;y.arc=t,y.site=i,y.x=d+o,y.y=g+Math.sqrt(d*d+m*m),y.cy=g,t.circle=y;for(var v=null,_=di._;_;)if(y.y<_.y||y.y===_.y&&y.x<=_.x){if(!_.L){v=_.P;break}_=_.L}else{if(!_.R){v=_;break}_=_.R}di.insert(v,y),v||(fi=y)}}}}function Ci(t){var e=t.circle;e&&(e.P||(fi=e.N),di.remove(e),gi.push(e),Ri(e),t.circle=null)}function Li(t,e){var r=t.b;if(r)return!0;var n,i,a=t.a,o=e[0][0],s=e[1][0],l=e[0][1],u=e[1][1],c=t.l,p=t.r,h=c.x,f=c.y,d=p.x,m=p.y,g=(h+d)/2,y=(f+m)/2;if(m===f){if(g=s)return;if(h>d){if(a){if(a.y>=u)return}else a={x:g,y:l};r={x:g,y:u}}else{if(a){if(a.y1)if(h>d){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.xkt||v(i-r)>kt)&&(s.splice(o,0,new Di(Ii(a.site,c,v(n-p)kt?{x:p,y:v(e-p)kt?{x:v(r-d)kt?{x:h,y:v(e-h)kt?{x:v(r-f)=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)/kt)*kt,y:Math.round(i(t,e)/kt)*kt,i:e}}))}return o.links=function(t){return Ui(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 Ui(s(t)).cells.forEach((function(r,n){for(var i,a,o,s,l=r.site,u=r.edges.sort(Ai),c=-1,p=u.length,h=u[p-1].edge,f=h.l===l?h.r:h.l;++ca||p>o||h=b)<<1|e>=x,T=w+4;wa&&(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:Yi(r,n)})),a=Qi.lastIndex;return am&&(m=l.x),l.y>g&&(g=l.y),u.push(l.x),c.push(l.y);else for(p=0;pm&&(m=x),b>g&&(g=b),u.push(x),c.push(b)}var w=m-f,T=g-d;function k(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(v(l-r)+v(u-n)<.01)A(t,e,r,n,i,a,o,s);else{var c=t.point;t.x=t.y=t.point=null,A(t,c,l,u,i,a,o,s),A(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else A(t,e,r,n,i,a,o,s)}function A(t,e,r,n,i,a,o,s){var l=.5*(i+o),u=.5*(a+s),c=r>=l,p=n>=u,h=p<<1|c;t.leaf=!1,c?i=l:o=l,p?a=u:s=u,k(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,i,a,o,s)}w>T?g=d+w:m=f+T;var M={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(M,t,+y(t,++p),+_(t,p),f,d,m,g)},visit:function(t){Zi(t,M,f,d,m,g)},find:function(t){return Gi(M,t[0],t[1],f,d,m,g)}};if(p=-1,null==e){for(;++p=0&&!(n=t.interpolators[i](e,r)););return n}function ta(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function aa(t){return function(e){return 1-t(1-e)}}function oa(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function sa(t){return t*t}function la(t){return t*t*t}function ua(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ca(t){return 1-Math.cos(t*Lt)}function pa(t){return Math.pow(2,10*(t-1))}function ha(t){return 1-Math.sqrt(1-t*t)}function fa(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 da(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function ma(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=ya(i),s=ga(i,a),l=ya(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=ra.get(n)||ea,ia((i=na.get(i)||E)(n.apply(null,r.call(arguments,1))))},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 Zt(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 Qt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=da,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 ma(e?e.matrix:va)})(e)},ma.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var va={a:1,b:0,c:0,d:1,e:0,f:0};function _a(t){return t.length?t.pop()+",":""}function xa(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:Yi(t[0],e[0])},{i:i-2,x:Yi(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(_a(r)+"rotate(",null,")")-2,x:Yi(t,e)})):e&&r.push(_a(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(_a(r)+"skewX(",null,")")-2,x:Yi(t,e)}):e&&r.push(_a(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(_a(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Yi(t[0],e[0])},{i:i-2,x:Yi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(_a(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=we(s.tick)),s):n},s.start=function(){var t,e,r,n=y.length,l=v.length,c=u[0],d=u[1];for(t=0;t=0;)r.push(i[n])}function Da(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 Da(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&&(Pa(t,(function(t){t.children&&(t.value=0)})),Da(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 Wa(t){return t.reduce(Ya,0)}function Ya(t,e){return t+e[1]}function Ka(t,e){return Ja(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ja(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 Qa(e){return[t.min(e),t.max(e)]}function $a(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(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 no(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,u=1/0,c=-1/0,p=1/0,h=-1/0;if(e.forEach(io),(r=e[0]).x=-r.r,r.y=0,_(r),l>1&&((n=e[1]).x=n.r,n.y=0,_(n),l>2))for(oo(r,n,i=e[2]),_(i),to(r,i),r._pack_prev=i,to(i,n),n=r._pack_next,a=3;a0)for(o=-1;++o=p[0]&&l<=p[1]&&((s=u[t.bisect(h,l,1,d)-1]).y+=m,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=de(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Ja(e,t)}:de(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($a),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,Da(s,(function(t){t.r=+c(t.value)})),Da(s,no),n){var p=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;Da(s,(function(t){t.r+=p})),Da(s,no),Da(s,(function(t){t.r-=p}))}return function t(e,r,n,i){var a=e.children;if(e.x=r+=i*e.x,e.y=n+=i*e.y,e.r*=i,a)for(var o=-1,s=a.length;++of.x&&(f=t),t.depth>d.depth&&(d=t)}));var m=r(h,f)/2-h.x,g=n[0]/(f.x+r(f,h)/2+m),y=n[1]/(d.depth||1);Pa(c,(function(t){t.x=(t.x+m)*g,t.y=t.depth*y}))}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,p=s.m,h=l.m;s=uo(s),a=lo(a),s&&a;)l=lo(l),(o=uo(o)).a=t,(i=s.z+p-a.z-u+r(s._,a._))>0&&(co(po(s,t,n),t,i),u+=i,c+=i),p+=s.m,u+=a.m,h+=l.m,c+=o.m;s&&!uo(o)&&(o.t=s,o.m+=p-c),a&&!lo(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},Ia(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),u=l[0],c=0;Da(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 p=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),f=p.x-r(p,h)/2,d=h.x+r(h,p)/2;return Da(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-f)/(d-f)*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},Ia(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=ho,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=f(s,m))<=h?(u.pop(),h=n):(s.area-=s.pop().area,d(s,m,a,!1),m=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(d(s,m,a,!0),s.length=s.area=0),e.forEach(p)}}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&&(d(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(h)}}function f(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 d(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?bo:yo,s=i?wa:ba;return a=t(e,r,s,n),o=t(r,e,s,$i),l}function l(t){return a(t)}return 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(da)},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 Ao(e,t)},l.tickFormat=function(t,r){return Mo(e,t,r)},l.nice=function(t){return To(e,t),s()},l.copy=function(){return t(e,r,n,i)},s()}([0,1],[0,1],$i,!1)};var So={s:1,g:1,p:1,r:1,e:1};function Co(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))}return 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=vo(a.map(o),i?Math:Eo);return r.domain(t),a=t.map(s),l},l.ticks=function(){var t=mo(a),e=[],r=t[0],l=t[1],u=Math.floor(o(r)),c=Math.ceil(o(l)),p=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 Lo;arguments.length<2?r=Lo:"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],tp?0:1;if(u=Ct)return l(u,f)+(s?l(s,1-f):"")+"Z";var d,m,g,y,v,_,x,b,w,T,k,A,M=0,S=0,C=[];if((y=(+o.apply(this,arguments)||0)/2)&&(g=n===Fo?Math.sqrt(s*s+u*u):+n.apply(this,arguments),f||(S*=-1),u&&(S=Ot(g/u*Math.sin(y))),s&&(M=Ot(g/s*Math.sin(y)))),u){v=u*Math.cos(c+S),_=u*Math.sin(c+S),x=u*Math.cos(p-S),b=u*Math.sin(p-S);var L=Math.abs(p-c-2*S)<=Mt?0:1;if(S&&qo(v,_,x,b)===f^L){var E=(c+p)/2;v=u*Math.cos(E),_=u*Math.sin(E),x=b=null}}else v=_=0;if(s){w=s*Math.cos(p-M),T=s*Math.sin(p-M),k=s*Math.cos(c+M),A=s*Math.sin(c+M);var z=Math.abs(c-p+2*M)<=Mt?0:1;if(M&&qo(w,T,k,A)===1-f^z){var I=(c+p)/2;w=s*Math.cos(I),T=s*Math.sin(I),k=A=null}}else w=T=0;if(h>kt&&(d=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){m=s0?0:1}function Ho(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,p=t[1]+u,h=e[0]+l,f=e[1]+u,d=(c+h)/2,m=(p+f)/2,g=h-c,y=f-p,v=g*g+y*y,_=r-n,x=c*f-h*p,b=(y<0?-1:1)*Math.sqrt(Math.max(0,_*_*v-x*x)),w=(x*y-g*b)/v,T=(-x*g-y*b)/v,k=(x*y+g*b)/v,A=(-x*g+y*b)/v,M=w-d,S=T-m,C=k-d,L=A-m;return M*M+S*S>C*C+L*L&&(w=k,T=A),[[w-l,T-u],[w*r/_,T*r/_]]}function Zo(t){var e=ri,r=ni,n=Gr,i=Xo,a=i.key,o=.7;function s(a){var s,l=[],u=[],c=-1,p=a.length,h=de(e),f=de(r);function d(){l.push("M",i(t(u),o))}for(;++c1&&i.push("H",n[0]);return i.join("")},"step-before":Yo,"step-after":Ko,basis:$o,"basis-open":function(t){if(t.length<4)return Xo(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(ts(ns,a)+","+ts(ns,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 Xo(t){return t.length>1?t.join("L"):t+"Z"}function Wo(t){return t.join("L")+"Z"}function Yo(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;uMt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=de(t),a):r},a.source=function(e){return arguments.length?(t=de(e),a):t},a.target=function(t){return arguments.length?(e=de(t),a):e},a.startAngle=function(t){return arguments.length?(n=de(t),a):n},a.endAngle=function(t){return arguments.length?(i=de(t),a):i},a},t.svg.diagonal=function(){var t=Vn,e=qn,r=us;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=de(e),n):t},n.target=function(t){return arguments.length?(e=de(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=us,n=e.projection;return e.projection=function(t){return arguments.length?n(cs(r=t)):r},e},t.svg.symbol=function(){var t=hs,e=ps;function r(r,n){return(ds.get(t.call(this,r,n))||fs)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=de(e),r):t},r.size=function(t){return arguments.length?(e=de(t),r):e},r};var ds=t.map({circle:fs,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*gs)),r=e*gs;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/ms),r=e*ms/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/ms),r=e*ms/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ds.keys();var ms=Math.sqrt(3),gs=Math.tan(30*Et);G.transition=function(t){for(var e,r,n=xs||++Ts,i=Ms(t),a=[],o=bs||{time:Date.now(),ease:ua,delay:0,duration:250},s=-1,l=this.length;++s0;)u[--h].call(t,o);if(a>=1)return p.event&&p.event.end.call(t,t.__data__,e),--c.count?delete c[n]:delete t[r],1}p||(a=i.time,o=we((function(t){var e=p.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h}),0,a),p=c[n]={tween:new b,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++c.count)}ws.call=G.call,ws.empty=G.empty,ws.node=G.node,ws.size=G.size,t.transition=function(e,r){return e&&e.transition?xs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=X(t);for(var s=-1,l=this.length;++srect,.s>rect").attr("width",s[1]-s[0])}function m(t){t.select(".extent").attr("y",l[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",l[1]-l[0])}function g(){var p,g,y=this,v=t.select(t.event.target),_=n.of(y,arguments),x=t.select(y),b=v.datum(),w=!/^(n|s)$/.test(b)&&i,T=!/^(e|w)$/.test(b)&&a,k=v.classed("extent"),A=xt(y),M=t.mouse(y),S=t.select(o(y)).on("keydown.brush",E).on("keyup.brush",z);if(t.event.changedTouches?S.on("touchmove.brush",I).on("touchend.brush",D):S.on("mousemove.brush",I).on("mouseup.brush",D),x.interrupt().selectAll("*").interrupt(),k)M[0]=s[0]-M[0],M[1]=l[0]-M[1];else if(b){var C=+/w$/.test(b),L=+/^n/.test(b);g=[s[1-C]-M[0],l[1-L]-M[1]],M[0]=s[C],M[1]=l[L]}else t.event.altKey&&(p=M.slice());function E(){32==t.event.keyCode&&(k||(p=null,M[0]-=s[1],M[1]-=l[1],k=2),F())}function z(){32==t.event.keyCode&&2==k&&(M[0]+=s[1],M[1]+=l[1],k=0,F())}function I(){var e=t.mouse(y),r=!1;g&&(e[0]+=g[0],e[1]+=g[1]),k||(t.event.altKey?(p||(p=[(s[0]+s[1])/2,(l[0]+l[1])/2]),M[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Ns(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Ns(+e+1);return e}}:t))},i.ticks=function(t,e){var r=mo(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],Ns(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Bs(e.copy(),r,n)},wo(i,e)}function Ns(t){return new Date(t)}Ds.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fs:Rs,Fs.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Fs.toString=Rs.toString,Ie.second=Re((function(t){return new Pe(1e3*Math.floor(t/1e3))}),(function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))}),(function(t){return t.getSeconds()})),Ie.seconds=Ie.second.range,Ie.seconds.utc=Ie.second.utc.range,Ie.minute=Re((function(t){return new Pe(6e4*Math.floor(t/6e4))}),(function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))}),(function(t){return t.getMinutes()})),Ie.minutes=Ie.minute.range,Ie.minutes.utc=Ie.minute.utc.range,Ie.hour=Re((function(t){var e=t.getTimezoneOffset()/60;return new Pe(36e5*(Math.floor(t/36e5-e)+e))}),(function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))}),(function(t){return t.getHours()})),Ie.hours=Ie.hour.range,Ie.hours.utc=Ie.hour.utc.range,Ie.month=Re((function(t){return(t=Ie.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),Ie.months=Ie.month.range,Ie.months.utc=Ie.month.utc.range;var Us=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],js=[[Ie.second,1],[Ie.second,5],[Ie.second,15],[Ie.second,30],[Ie.minute,1],[Ie.minute,5],[Ie.minute,15],[Ie.minute,30],[Ie.hour,1],[Ie.hour,3],[Ie.hour,6],[Ie.hour,12],[Ie.day,1],[Ie.day,2],[Ie.week,1],[Ie.month,1],[Ie.month,3],[Ie.year,1]],Vs=Ds.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",Gr]]),qs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Ns)},floor:E,ceil:E};js.year=Ie.year,Ie.scale=function(){return Bs(t.scale.linear(),js,Vs)};var Hs=js.map((function(t){return[t[0].utc,t[1]]})),Zs=Os.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",Gr]]);function Gs(t){return JSON.parse(t.responseText)}function Xs(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}Hs.year=Ie.year.utc,Ie.scale.utc=function(){return Bs(t.scale.linear(),Hs,Zs)},t.text=me((function(t){return t.responseText})),t.json=function(t,e){return ge(t,"application/json",Gs,e)},t.html=function(t,e){return ge(t,"text/html",Xs,e)},t.xml=me((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],17:[function(t,e,r){(function(n,i){ +!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 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){return i(e[o][1][t]||t)}),c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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":211}],2:[function(t,e,r){"use strict";e.exports=t("../src/traces/choroplethmapbox")},{"../src/traces/choroplethmapbox":323}],3:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":190}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/densitymapbox")},{"../src/traces/densitymapbox":331}],5:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./scattermapbox"),t("./choroplethmapbox"),t("./densitymapbox")]),e.exports=n},{"./choroplethmapbox":2,"./core":3,"./densitymapbox":4,"./scattermapbox":6}],6:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":373}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/meta");function i(t){var e=0;if(t&&t.length>0){e+=Math.abs(a(t[0]));for(var r=1;r2){for(s=0;st[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},r.radiansToLength=p,r.lengthToRadians=h,r.lengthToDegrees=function(t,e){return f(h(t,e))},r.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},r.radiansToDegrees=f,r.degreesToRadians=function(t){return t%360*Math.PI/180},r.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return p(h(t,e),r)},r.convertArea=function(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=r.areaFactors[e];if(!i)throw new Error("invalid original units");var a=r.areaFactors[n];if(!a)throw new Error("invalid final units");return t/i*a},r.isNumber=d,r.isObject=function(t){return!!t&&t.constructor===Object},r.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!d(t))throw new Error("bbox must only contain numbers")}))},r.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},r.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},r.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},r.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},r.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},r.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},r.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},r.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},{}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/helpers");function i(t,e,r){if(null!==t)for(var n,a,o,s,l,u,c,p,h=0,f=0,d=t.type,m="FeatureCollection"===d,y="Feature"===d,g=m?t.features.length:1,v=0;vu||f>c||d>p)return l=i,u=r,c=f,p=d,void(o=0);var m=n.lineString([l,i],t.properties);if(!1===e(m,r,a,d,o))return!1;o++,l=i}))&&void 0}}}))}function c(t,e){if(!t)throw new Error("geojson is required");l(t,(function(t,r,i){if(null!==t.geometry){var a=t.geometry.type,o=t.geometry.coordinates;switch(a){case"LineString":if(!1===e(t,r,i,0,0))return!1;break;case"Polygon":for(var s=0;s0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function d(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=i[t];if(void 0===l)return!1;if("function"==typeof l)a(l,this,e);else{var u=l.length,c=y(l,u);for(r=0;r=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],13:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],14:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-time")):i((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function n(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function i(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function a(t){var a=t.dateTime,o=t.date,l=t.time,u=t.periods,c=t.days,p=t.shortDays,h=t.months,vt=t.shortMonths,_t=f(u),xt=d(u),bt=f(c),wt=d(c),Tt=f(p),kt=d(p),At=f(h),Mt=d(h),St=f(vt),Ct=d(vt),Lt={a:function(t){return p[t.getDay()]},A:function(t){return c[t.getDay()]},b:function(t){return vt[t.getMonth()]},B:function(t){return h[t.getMonth()]},c:null,d:O,e:O,f:U,H:R,I:F,j:B,L:N,m:j,M:V,p:function(t){return u[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:yt,s:gt,S:q,u:H,U:Z,V:G,w:X,W:W,x:null,X:null,y:Y,Y:K,Z:J,"%":mt},Et={a:function(t){return p[t.getUTCDay()]},A:function(t){return c[t.getUTCDay()]},b:function(t){return vt[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:Q,e:Q,f:nt,H:$,I:tt,j:et,L:rt,m:it,M:at,p:function(t){return u[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:yt,s:gt,S:ot,u:st,U:lt,V:ut,w:ct,W:pt,x:null,X:null,y:ht,Y:ft,Z:dt,"%":mt},It={a:function(t,e,r){var n=Tt.exec(e.slice(r));return n?(t.w=kt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=bt.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=St.exec(e.slice(r));return n?(t.m=Ct[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=At.exec(e.slice(r));return n?(t.m=Mt[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return Dt(t,a,e,r)},d:A,e:A,f:I,H:S,I:S,j:M,L:E,m:k,M:C,p:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.p=xt[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:P,s:D,S:L,u:y,U:g,V:v,w:m,W:_,x:function(t,e,r){return Dt(t,o,e,r)},X:function(t,e,r){return Dt(t,l,e,r)},y:b,Y:x,Z:w,"%":z};function zt(t,e){return function(r){var n,i,a,o=[],l=-1,u=0,c=t.length;for(r instanceof Date||(r=new Date(+r));++l53)return null;"w"in u||(u.w=1),"Z"in u?(l=(s=n(i(u.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(u.V-1)),u.y=s.getUTCFullYear(),u.m=s.getUTCMonth(),u.d=s.getUTCDate()+(u.w+6)%7):(l=(s=r(i(u.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(u.V-1)),u.y=s.getFullYear(),u.m=s.getMonth(),u.d=s.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),l="Z"in u?n(i(u.y,0,1)).getUTCDay():r(i(u.y,0,1)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+7*u.W-(l+5)%7:u.w+7*u.U-(l+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,n(u)):r(u)}}function Dt(t,e,r,n){for(var i,a,o=0,l=e.length,u=r.length;o=u)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=It[i in s?e.charAt(o++):i])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}return Lt.x=zt(o,Lt),Lt.X=zt(l,Lt),Lt.c=zt(a,Lt),Et.x=zt(o,Et),Et.X=zt(l,Et),Et.c=zt(a,Et),{format:function(t){var e=zt(t+="",Lt);return e.toString=function(){return t},e},parse:function(t){var e=Pt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=zt(t+="",Et);return e.toString=function(){return t},e},utcParse:function(t){var e=Pt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,u=/^%/,c=/[\\^$*+?|[\]().{}]/g;function p(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function I(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function z(t,e,r){var n=u.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function P(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function D(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function O(t,e){return p(t.getDate(),e,2)}function R(t,e){return p(t.getHours(),e,2)}function F(t,e){return p(t.getHours()%12||12,e,2)}function B(t,r){return p(1+e.timeDay.count(e.timeYear(t),t),r,3)}function N(t,e){return p(t.getMilliseconds(),e,3)}function U(t,e){return N(t,e)+"000"}function j(t,e){return p(t.getMonth()+1,e,2)}function V(t,e){return p(t.getMinutes(),e,2)}function q(t,e){return p(t.getSeconds(),e,2)}function H(t){var e=t.getDay();return 0===e?7:e}function Z(t,r){return p(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function G(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),p(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function X(t){return t.getDay()}function W(t,r){return p(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function Y(t,e){return p(t.getFullYear()%100,e,2)}function K(t,e){return p(t.getFullYear()%1e4,e,4)}function J(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+p(e/60|0,"0",2)+p(e%60,"0",2)}function Q(t,e){return p(t.getUTCDate(),e,2)}function $(t,e){return p(t.getUTCHours(),e,2)}function tt(t,e){return p(t.getUTCHours()%12||12,e,2)}function et(t,r){return p(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return p(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function it(t,e){return p(t.getUTCMonth()+1,e,2)}function at(t,e){return p(t.getUTCMinutes(),e,2)}function ot(t,e){return p(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,r){return p(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ut(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),p(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ct(t){return t.getUTCDay()}function pt(t,r){return p(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function ht(t,e){return p(t.getUTCFullYear()%100,e,2)}function ft(t,e){return p(t.getUTCFullYear()%1e4,e,4)}function dt(){return"+0000"}function mt(){return"%"}function yt(t){return+t}function gt(t){return Math.floor(+t/1e3)}function vt(e){return o=a(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}vt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var _t=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var xt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=_t,t.isoParse=xt,t.timeFormatDefaultLocale=vt,t.timeFormatLocale=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":15}],15:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,i,a,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),i(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e0))return o;do{o.push(a=new Date(+e)),i(e,n),t(e)}while(a=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;i(t,-1),!e(t););else for(;--r>=0;)for(;i(t,1),!e(t););}))},a&&(s.count=function(n,i){return e.setTime(+n),r.setTime(+i),t(e),t(r),Math.floor(a(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var i=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):i:null};var a=i.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),u=l.range,c=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),p=c.range,h=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),f=h.range;function d(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var m=d(0),y=d(1),g=d(2),v=d(3),_=d(4),x=d(5),b=d(6),w=m.range,T=y.range,k=g.range,A=v.range,M=_.range,S=x.range,C=b.range,L=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),E=L.range,I=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));I.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var z=I.range,P=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),D=P.range,O=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),R=O.range,F=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),B=F.range;function N(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var U=N(0),j=N(1),V=N(2),q=N(3),H=N(4),Z=N(5),G=N(6),X=U.range,W=j.range,Y=V.range,K=q.range,J=H.range,Q=Z.range,$=G.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=h,t.timeDays=f,t.timeFriday=x,t.timeFridays=S,t.timeHour=c,t.timeHours=p,t.timeInterval=n,t.timeMillisecond=i,t.timeMilliseconds=a,t.timeMinute=l,t.timeMinutes=u,t.timeMonday=y,t.timeMondays=T,t.timeMonth=L,t.timeMonths=E,t.timeSaturday=b,t.timeSaturdays=C,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=m,t.timeSundays=w,t.timeThursday=_,t.timeThursdays=M,t.timeTuesday=g,t.timeTuesdays=k,t.timeWednesday=v,t.timeWednesdays=A,t.timeWeek=m,t.timeWeeks=w,t.timeYear=I,t.timeYears=z,t.utcDay=F,t.utcDays=B,t.utcFriday=Z,t.utcFridays=Q,t.utcHour=O,t.utcHours=R,t.utcMillisecond=i,t.utcMilliseconds=a,t.utcMinute=P,t.utcMinutes=D,t.utcMonday=j,t.utcMondays=W,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=G,t.utcSaturdays=$,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=U,t.utcSundays=X,t.utcThursday=H,t.utcThursdays=J,t.utcTuesday=V,t.utcTuesdays=Y,t.utcWednesday=q,t.utcWednesdays=K,t.utcWeek=U,t.utcWeeks=X,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],16:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},i=this.document;function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(i)try{n(i.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),i)try{i.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,u=s.setAttributeNS,c=this.CSSStyleDeclaration.prototype,p=c.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){u.call(this,t,e,r+"")},c.setProperty=function(t,e,r){p.call(this,t,e+"",r)}}function h(t,e){return te?1:t>=e?0:NaN}function f(t){return null===t?NaN:+t}function d(t){return!isNaN(t)}function m(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 y=m(h);function g(t){return t.length}t.bisectLeft=y.left,t.bisect=t.bisectRight=y.right,t.bisector=function(t){return m(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 v=Math.abs;function _(t){for(var e=1;t*e%1;)e*=10;return e}function x(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function b(){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=_(v(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,p,h=-1,f=a.length,d=i[s++],m=new b;++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 L;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,j={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return j(t,G),t}var q=function(t,e){return e.querySelector(t)},H=function(t,e){return e.querySelectorAll(t)},Z=function(t,e){var r=t.matches||t[z(t,"matchesSelector")];return(Z=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},H=Sizzle,Z=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var G=t.selection.prototype=[];function X(t){return"function"==typeof t?t:function(){return q(t,this)}}function W(t){return"function"==typeof t?t:function(){return H(t,this)}}G.select=function(t){var e,r,n,i,a=[];t=X(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),K.hasOwnProperty(r)?{space:K[r],local:t}:t}},G.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))},G.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(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},G.sort=function(t){t=ut.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=i+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=mt.get(e);function u(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=gt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:u:r?D: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=pt,t.selection.enter.prototype=ht,ht.append=G.append,ht.empty=G.empty,ht.node=G.node,ht.call=G.call,ht.size=G.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s0?1:t<0?-1:0}function Pt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Dt(t){return t>1?0:t<-1?Mt:Math.acos(t)}function Ot(t){return t>1?Lt:t<-1?-Lt:Math.asin(t)}function Rt(t){return((t=Math.exp(t))+1/t)/2}function Ft(t){return(t=Math.sin(t/2))*t}var Bt=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,p=l-a,h=c*c+p*p;if(h0&&(e=e.transition().duration(m)),e.call(w.event)}function S(){u&&u.domain(l.range().map((function(t){return(t-h.x)/h.k})).map(l.invert)),p&&p.domain(c.range().map((function(t){return(t-h.y)/h.k})).map(c.invert))}function C(t){y++||t({type:"zoomstart"})}function L(t){S(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function E(t){--y||(t({type:"zoomend"}),r=null)}function I(){var e=this,r=b.of(e,arguments),n=0,i=t.select(o(e)).on(v,l).on(_,u),a=T(t.mouse(e)),s=xt(e);function l(){n=1,A(t.mouse(e),a),L(r)}function u(){i.on(v,null).on(_,null),s(n),E(r)}gs.call(e),C(r)}function z(){var e,r=this,n=b.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,u="touchend"+o,c=[],p=t.select(r),f=xt(r);function d(){var n=t.touches(r);return e=h.k,n.forEach((function(t){t.identifier in i&&(i[t.identifier]=T(t))})),n}function m(){var e=t.event.target;t.select(e).on(l,y).on(u,v),c.push(e);for(var n=t.event.changedTouches,o=0,p=n.length;o1){g=f[0];var _=f[1],x=g[0]-_[0],b=g[1]-_[1];a=x*x+b*b}}function y(){var o,l,u,c,p=t.touches(r);gs.call(r);for(var h=0,f=p.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)||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 ne(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):$t(e instanceof Yt?e.l:(e=ce((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 qt(this.h,this.s,this.l/t)},Ht.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new qt(this.h,this.s,t*this.l)},Ht.rgb=function(){return Zt(this.h,this.s,this.l)},t.hcl=Gt;var Xt=Gt.prototype=new Vt;function Wt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Yt(r,Math.cos(t*=Et)*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):ce((t=ne(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+Kt*(arguments.length?t:1)))},Xt.darker=function(t){return new Gt(this.h,this.c,Math.max(0,this.l-Kt*(arguments.length?t:1)))},Xt.rgb=function(){return Wt(this.h,this.c,this.l).rgb()},t.lab=Yt;var Kt=18,Jt=Yt.prototype=new Vt;function Qt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ne(re(3.2404542*(i=.95047*te(i))-1.5371385*(n=1*te(n))-.4985314*(a=1.08883*te(a))),re(-.969266*i+1.8760108*n+.041556*a),re(.0556434*i-.2040259*n+1.0572252*a))}function $t(t,e,r){return t>0?new Gt(Math.atan2(r,e)*It,Math.sqrt(e*e+r*r),t):new Gt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,Zt):new ne(t,e,r)}function ie(t){return new ne(t>>16,t>>8&255,255&t)}function ae(t){return ie(t)+""}Jt.brighter=function(t){return new Yt(Math.min(100,this.l+Kt*(arguments.length?t:1)),this.a,this.b)},Jt.darker=function(t){return new Yt(Math.max(0,this.l-Kt*(arguments.length?t:1)),this.a,this.b)},Jt.rgb=function(){return Qt(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(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(he(i[0]),he(i[1]),he(i[2]))}return(a=fe.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 ue(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 qt(n,i,l)}function ce(t,e,r){var n=ee((.4124564*(t=pe(t))+.3575761*(e=pe(e))+.1804375*(r=pe(r)))/.95047),i=ee((.2126729*t+.7151522*e+.072175*r)/1);return Yt(116*i-16,500*(n-i),200*(i-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function pe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function he(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.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=p:u.onreadystatechange=function(){u.readyState>3&&p()},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))}fe.forEach((function(t,e){fe.set(t,ie(e))})),t.functor=de,t.xhr=me(E),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 p(){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(xe),xe=setTimeout(Te,e)),_e=0):(_e=1,be(Te))}function ke(){for(var t=Date.now(),e=ge;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ae(){for(var t,e=ge,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Ce(e){var r=e.decimal,n=e.thousands,i=e.grouping,a=e.currency,o=i&&n?function(t,e){for(var r=t.length,a=[],o=0,s=i[0],l=0;r>0&&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)}:E;return function(e){var n=Le.exec(e),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],p=+n[6],h=n[7],f=n[8],d=n[9],m=1,y="",g="",v=!1,_=!0;switch(f&&(f=+f.substring(1)),(c||"0"===i&&"="===s)&&(c=i="0",s="="),d){case"n":h=!0,d="g";break;case"%":m=100,g="%",d="f";break;case"p":m=100,g="%",d="r";break;case"b":case"o":case"x":case"X":"#"===u&&(y="0"+d.toLowerCase());case"c":_=!1;case"d":v=!0,f=0;break;case"s":m=-1,d="r"}"$"===u&&(y=a[0],g=a[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):"e"!=d&&"f"!=d||(f=Math.max(0,Math.min(20,f)))),d=Ee.get(d)||Ie;var x=c&&h;return function(e){var n=g;if(v&&e%1)return"";var a=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(m<0){var u=t.formatPrefix(e,f);e=u.scale(e),n=u.symbol+g}else e*=m;var b,w,T=(e=d(e,f)).lastIndexOf(".");if(T<0){var k=_?e.lastIndexOf("e"):-1;k<0?(b=e,w=""):(b=e.substring(0,k),w=e.substring(k))}else b=e.substring(0,T),w=r+e.substring(T+1);!c&&h&&(b=o(b,1/0));var A=y.length+b.length+w.length+(x?0:a.length),M=A"===s?M+a+e:"^"===s?M.substring(0,A>>=1)+a+e+M.substring(A):a+(x?e:M+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Me(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 Le=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ee=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,Me(e,r))).toFixed(Math.max(0,Math.min(20,Me(e*(1+1e-15),r))))}});function Ie(t){return t+""}var ze=t.time={},Pe=Date;function De(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}De.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(){Oe.setUTCDate.apply(this._,arguments)},setDay:function(){Oe.setUTCDay.apply(this._,arguments)},setFullYear:function(){Oe.setUTCFullYear.apply(this._,arguments)},setHours:function(){Oe.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Oe.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Oe.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Oe.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Oe.setUTCSeconds.apply(this._,arguments)},setTime:function(){Oe.setTime.apply(this._,arguments)}};var Oe=Date.prototype;function Re(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=w[o in Ne?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(Pe=De);return r._=t,e(r)}finally{Pe=Date}}return r.parse=function(t){try{Pe=De;var r=e.parse(t);return r&&r._}finally{Pe=Date}},r.toString=e.toString,r},c.multi=c.utc.multi=or;var h=t.map(),f=qe(o),d=He(o),m=qe(s),y=He(s),g=qe(l),v=He(l),_=qe(u),x=He(u);a.forEach((function(t,e){h.set(t.toLowerCase(),e)}));var b={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+ze.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(ze.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ve(ze.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){m.lastIndex=0;var n=m.exec(e.slice(r));return n?(t.w=y.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){f.lastIndex=0;var n=f.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){_.lastIndex=0;var n=_.exec(e.slice(r));return n?(t.m=x.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){g.lastIndex=0;var n=g.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,r){return p(t,b.c.toString(),e,r)},d:Qe,e:Qe,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:Ge,w:Ze,W:Xe,x:function(t,e,r){return p(t,b.x.toString(),e,r)},X:function(t,e,r){return p(t,b.X.toString(),e,r)},y:Ye,Y:We,Z:Ke,"%":ar};return c}ze.year=Re((function(t){return(t=ze.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),ze.years=ze.year.range,ze.years.utc=ze.year.utc.range,ze.day=Re((function(t){var e=new Pe(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),ze.days=ze.day.range,ze.days.utc=ze.day.utc.range,ze.dayOfYear=function(t){var e=ze.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=ze[t]=Re((function(t){return(t=ze.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=ze.year(t).getDay();return Math.floor((ze.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));ze[t+"s"]=r.range,ze[t+"s"].utc=r.utc.range,ze[t+"OfYear"]=function(t){var r=ze.year(t).getDay();return Math.floor((ze.dayOfYear(t)+(r+e)%7)/7)}})),ze.week=ze.sunday,ze.weeks=ze.sunday.range,ze.weeks.utc=ze.sunday.utc.range,ze.weekOfYear=ze.sundayOfYear;var Ne={"-":"",_:" ",0:"0"},Ue=/^\s*\d+/,je=/^%/;function Ve(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3),r+i[0].length):-1}function Ke(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Je(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Qe(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function $e(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){Ue.lastIndex=0;var n=Ue.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=v(e)/60|0,i=v(e)%60;return r+Ve(n,"0",2)+Ve(i,"0",2)}function ar(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*a,l=Math.cos(e),u=Math.sin(e),c=i*u,p=n*l+c*Math.cos(s),h=c*o*Math.sin(s);Cr.add(Math.atan2(h,p)),r=t,n=l,i=u}Lr.point=function(o,s){Lr.point=a,r=(t=o)*Et,n=Math.cos(s=(e=s)*Et/2+Mt/4),i=Math.sin(s)},Lr.lineEnd=function(){a(t,e)}}function Ir(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 zr(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 Dr(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Or(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Rr(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 Fr(t){return[Math.atan2(t[1],t[0]),Ot(t[2])]}function Br(t,e){return v(t[0]-e[0])kt?i=90:u<-kt&&(r=-90),p[0]=e,p[1]=n}};function f(t,a){c.push(p=[e=t,n=t]),ai&&(i=a)}function d(t,o){var s=Ir([t*Et,o*Et]);if(l){var u=Pr(l,s),c=Pr([u[1],-u[0],0],u);Rr(c),c=Fr(c);var p=t-a,h=p>0?1:-1,d=c[0]*It*h,m=v(p)>180;if(m^(h*ai&&(i=y);else if(m^(h*a<(d=(d+360)%360-180)&&di&&(i=o);m?tb(e,n)&&(n=t):b(t,n)>b(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>a?b(e,t)>b(e,n)&&(n=t):b(t,n)>b(e,n)&&(e=t)}else f(t,o);l=s,a=t}function m(){h.point=d}function y(){p[0]=e,p[1]=n,h.point=f,l=null}function g(t,e){if(l){var r=t-a;u+=v(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Lr.point(t,e),d(t,e)}function _(){Lr.lineStart()}function x(){g(o,s),Lr.lineEnd(),v(u)>kt&&(e=-(n=180)),p[0]=e,p[1]=n,l=null}function b(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function T(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tb(m[0],m[1])&&(m[1]=f[1]),b(f[0],m[1])>b(m[0],m[1])&&(m[0]=f[0])):s.push(m=f);for(var l,u,f,d=-1/0,m=(o=0,s[u=s.length-1]);o<=u;m=f,++o)f=s[o],(l=b(m[1],f[0]))>d&&(d=l,e=f[0],n=m[1])}return c=p=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,i]]}}(),t.geo.centroid=function(e){gr=vr=_r=xr=br=wr=Tr=kr=Ar=Mr=Sr=0,t.geo.stream(e,Nr);var r=Ar,n=Mr,i=Sr,a=r*r+n*n+i*i;return a=0;--s)i.point((p=c[s])[0],p[1]);else n(f.x,f.p.x,-1,i);f=f.p}c=(f=f.o).z,d=!d}while(!f.v);i.lineEnd()}}}function Wr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,T=w*b,k=T>Mt,A=d*_;if(Cr.add(Math.atan2(A*w*Math.sin(T),m*x+A*Math.cos(T))),a+=k?b+w*St:b,k^h>=r^g>=r){var M=Pr(Ir(p),Ir(t));Rr(M);var S=Pr(i,M);Rr(S);var C=(k^b>=0?-1:1)*Ot(S[2]);(n>C||n===C&&(M[0]||M[1]))&&(o+=k^b>=0?1:-1)}if(!y++)break;h=g,d=_,m=x,p=t}}return(a<-kt||a0){for(_||(o.polygonStart(),_=!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 Qr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:D,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]-Lt-kt:Lt-t[1])-((e=e.x)[0]<0?e[1]-Lt-kt:Lt-e[1])}var tn=Kr(Gr,(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?Mt:-Mt,l=v(a-r);v(l-Mt)0?Lt:-Lt),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Mt&&(v(r-i)kt?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(-Mt,i),n.point(0,i),n.point(Mt,i),n.point(Mt,0),n.point(Mt,-i),n.point(0,-i),n.point(-Mt,-i),n.point(-Mt,0),n.point(-Mt,i);else if(v(t[0]-e[0])>kt){var a=t[0]0,n=v(e)>kt;return Kr(i,(function(t){var e,s,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(p,h){var f,d=[p,h],m=i(p,h),y=r?m?0:o(p,h):m?o(p+(p<0?Mt:-Mt),h):0;if(!e&&(u=l=m)&&t.lineStart(),m!==l&&(f=a(e,d),(Br(e,f)||Br(d,f))&&(d[0]+=kt,d[1]+=kt,m=i(d[0],d[1]))),m!==l)c=0,m?(t.lineStart(),f=a(d,e),t.point(f[0],f[1])):(f=a(e,d),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(n&&e&&r^m){var g;y&s||!(g=a(d,e,!0))||(c=0,r?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1])))}!m||e&&Br(e,d)||t.point(d[0],d[1]),e=d,l=m,s=y},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(u&&l)<<1}}}),Bn(t,6*Et),r?[0,-t]:[-Mt,t-Mt]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function a(t,r,n){var i=[1,0,0],a=Pr(Ir(t),Ir(r)),o=zr(a,a),s=a[0],l=o-s*s;if(!l)return!n&&t;var u=e*o/l,c=-e*s/l,p=Pr(i,a),h=Or(i,u);Dr(h,Or(a,c));var f=p,d=zr(h,f),m=zr(f,f),y=d*d-m*(zr(h,h)-1);if(!(y<0)){var g=Math.sqrt(y),_=Or(f,(-d-g)/m);if(Dr(_,h),_=Fr(_),!n)return _;var x,b=t[0],w=r[0],T=t[1],k=r[1];w0^_[1]<(v(_[0]-b)Mt^(b<=_[0]&&_[0]<=w)){var S=Or(f,(-d+g)/m);return Dr(S,h),[_,Fr(S)]}}}function o(e,n){var i=r?t:Mt-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}function rn(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,u=o.y,c=0,p=1,h=s.x-l,f=s.y-u;if(a=t-l,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>p)return;a>c&&(c=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>p)return;a>c&&(c=a)}else if(h>0){if(a0)){if(a/=f,f<0){if(a0){if(a>p)return;a>c&&(c=a)}if(a=n-u,f||!(a<0)){if(a/=f,f<0){if(a>p)return;a>c&&(c=a)}else if(f>0){if(a0&&(i.a={x:l+c*h,y:u+c*f}),p<1&&(i.b={x:l+p*h,y:u+p*f}),i}}}}}}function nn(e,r,n,i){return function(l){var u,c,p,h,f,d,m,y,g,v,_,x=l,b=Qr(),w=rn(e,r,n,i),T={point:M,lineStart:function(){T.point=S,c&&c.push(p=[]);v=!0,g=!1,m=y=NaN},lineEnd:function(){u&&(S(h,f),d&&g&&b.rejoin(),u.push(b.buffer()));T.point=M,g&&l.lineEnd()},polygonStart:function(){l=b,u=[],c=[],_=!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&&Pt(u,a,t)>0&&++e:a[1]<=n&&Pt(u,a,t)<0&&--e,u=a;return 0!==e}([e,i]),n=_&&r,a=u.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),k(null,null,1,l),l.lineEnd()),a&&Xr(u,o,r,k,l),l.polygonEnd()),u=c=p=null}};function k(t,o,l,u){var c=0,p=0;if(null==t||(c=a(t,l))!==(p=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)!==p);else u.point(o[0],o[1])}function A(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function M(t,e){A(t,e)&&l.point(t,e)}function S(t,e){var r=A(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(c&&p.push([t,e]),v)h=t,f=e,d=r,v=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&g)l.point(t,e);else{var n={a:{x:m,y:y},b:{x:t,y:e}};w(n)?(g||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),_=!1):r&&(l.lineStart(),l.point(t,e),_=!1)}m=t,y=e,g=r}return T};function a(t,i){return v(t[0]-e)0?0:3:v(t[0]-n)0?2:1:v(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=Mt/3,n=En(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Mt/180,r=t[1]*Mt/180):[e/Mt*180,r/Mt*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,Ot((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],p=+t[1];return r=a.translate(t).clipExtent([[c-.455*e,p-.238*e],[c+.455*e,p+.238*e]]).stream(l).point,n=o.translate([c-.307*e,p+.201*e]).clipExtent([[c-.425*e+kt,p+.12*e+kt],[c-.214*e-kt,p+.234*e-kt]]).stream(l).point,i=s.translate([c-.205*e,p+.212*e]).clipExtent([[c-.214*e+kt,p+.166*e+kt],[c-.115*e-kt,p+.234*e-kt]]).stream(l).point,u},u.scale(1070)};var sn,ln,un,cn,pn,hn,fn={point:D,lineStart:D,lineEnd:D,polygonStart:function(){ln=0,fn.lineStart=dn},polygonEnd:function(){fn.lineStart=fn.lineEnd=fn.point=D,sn+=v(ln/2)}};function dn(){var t,e,r,n;function i(t,e){ln+=n*t-r*e,r=t,n=e}fn.point=function(a,o){fn.point=i,t=r=a,e=n=o},fn.lineEnd=function(){i(t,e)}}var mn={point:function(t,e){tpn&&(pn=t);ehn&&(hn=e)},lineStart:D,lineEnd:D,polygonStart:D,polygonEnd:D};function yn(){var t=gn(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=gn(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 gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var vn,_n={point:xn,lineStart:bn,lineEnd:wn,polygonStart:function(){_n.lineStart=Tn},polygonEnd:function(){_n.point=xn,_n.lineStart=bn,_n.lineEnd=wn}};function xn(t,e){_r+=t,xr+=e,++br}function bn(){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,Tr+=o*(e+n)/2,kr+=o,xn(t=r,e=n)}_n.point=function(n,i){_n.point=r,xn(t=n,e=i)}}function wn(){_n.point=xn}function Tn(){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,Tr+=o*(n+e)/2,kr+=o,Ar+=(o=n*t-r*e)*(r+t),Mr+=o*(n+e),Sr+=3*o,xn(r=t,n=e)}_n.point=function(a,o){_n.point=i,xn(t=r=a,e=n=o)},_n.lineEnd=function(){i(t,e)}}function kn(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:D};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,St)}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 An(t){var e=.5,r=Math.cos(30*Et),n=16;function i(t){return(n?o:a)(t)}function a(e){return Cn(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,i,a,o,l,u,c,p,h,f,d,m,y={point:g,lineStart:v,lineEnd:x,polygonStart:function(){e.polygonStart(),y.lineStart=b},polygonEnd:function(){e.polygonEnd(),y.lineStart=v}};function g(r,n){r=t(r,n),e.point(r[0],r[1])}function v(){p=NaN,y.point=_,e.lineStart()}function _(r,i){var a=Ir([r,i]),o=t(r,i);s(p,h,c,f,d,m,p=o[0],h=o[1],c=r,f=a[0],d=a[1],m=a[2],n,e),e.point(p,h)}function x(){y.point=g,e.lineEnd()}function b(){v(),y.point=w,y.lineEnd=T}function w(t,e){_(r=t,e),i=p,a=h,o=f,l=d,u=m,y.point=_}function T(){s(p,h,c,f,d,m,i,a,r,o,l,u,n,e),y.lineEnd=x,x()}return y}function s(n,i,a,o,l,u,c,p,h,f,d,m,y,g){var _=c-n,x=p-i,b=_*_+x*x;if(b>4*e&&y--){var w=o+f,T=l+d,k=u+m,A=Math.sqrt(w*w+T*T+k*k),M=Math.asin(k/=A),S=v(v(k)-1)e||v((_*I+x*z)/b-.5)>.3||o*f+l*d+u*m0&&16,i):Math.sqrt(e)},i}function Mn(t){var e=An((function(e,r){return t([e*It,r*It])}));return function(t){return In(e(t))}}function Sn(t){this.stream=t}function Cn(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 En((function(){return t}))()}function En(e){var r,n,i,a,o,s,l=An((function(t,e){return[(t=r(t,e))[0]*u+a,o-t[1]*u]})),u=150,c=480,p=250,h=0,f=0,d=0,m=0,y=0,g=tn,v=E,_=null,x=null;function b(t){return[(t=i(t[0]*Et,t[1]*Et))[0]*u+a,o-t[1]*u]}function w(t){return(t=i.invert((t[0]-a)/u,(o-t[1])/u))&&[t[0]*It,t[1]*It]}function T(){i=Zr(n=Dn(d,m,y),r);var t=r(h,f);return a=c-t[0]*u,o=p+t[1]*u,k()}function k(){return s&&(s.valid=!1,s=null),b}return b.stream=function(t){return s&&(s.valid=!1),(s=In(g(n,l(v(t))))).valid=!0,s},b.clipAngle=function(t){return arguments.length?(g=null==t?(_=t,tn):en((_=+t)*Et),k()):_},b.clipExtent=function(t){return arguments.length?(x=t,v=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):E,k()):x},b.scale=function(t){return arguments.length?(u=+t,T()):u},b.translate=function(t){return arguments.length?(c=+t[0],p=+t[1],T()):[c,p]},b.center=function(t){return arguments.length?(h=t[0]%360*Et,f=t[1]%360*Et,T()):[h*It,f*It]},b.rotate=function(t){return arguments.length?(d=t[0]%360*Et,m=t[1]%360*Et,y=t.length>2?t[2]%360*Et:0,T()):[d*It,m*It,y*It]},t.rebind(b,l,"precision"),function(){return r=e.apply(this,arguments),b.invert=r.invert&&w,T()}}function In(t){return Cn(t,(function(e,r){t.point(e*Et,r*Et)}))}function zn(t,e){return[t,e]}function Pn(t,e){return[t>Mt?t-St:t<-Mt?t+St:t,e]}function Dn(t,e,r){return t?e||r?Zr(Rn(t),Fn(e,r)):Rn(t):e||r?Fn(e,r):Pn}function On(t){return function(e,r){return[(e+=t)>Mt?e-St:e<-Mt?e+St:e,r]}}function Rn(t){var e=On(t);return e.invert=On(-t),e}function Fn(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),Ot(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),Ot(c*r-s*n)]},o}function Bn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Nn(r,i),a=Nn(r,a),(o>0?ia)&&(i+=o*St)):(i=t+o*St,a=t-.5*l);for(var u,c=i;o>0?c>a:c2?t[2]*Et:0),e.invert=function(e){return(e=t.invert(e[0]*Et,e[1]*Et))[0]*=It,e[1]*=It,e},e},Pn.invert=zn,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=Dn(-t[0]*Et,-t[1]*Et,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=It,t[1]*=It}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=Bn((t=+r)*Et,n*Et),i):t},i.precision=function(r){return arguments.length?(e=Bn(t*Et,(n=+r)*Et),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Et,i=t[1]*Et,a=e[1]*Et,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),p=Math.cos(a);return Math.atan2(Math.sqrt((r=p*o)*r+(r=u*c-l*p*s)*r),l*c+u*p*s)},t.geo.graticule=function(){var e,r,n,i,a,o,s,l,u,c,p,h,f=10,d=f,m=90,y=360,g=2.5;function _(){return{type:"MultiLineString",coordinates:x()}}function x(){return t.range(Math.ceil(i/m)*m,n,m).map(p).concat(t.range(Math.ceil(l/y)*y,s,y).map(h)).concat(t.range(Math.ceil(r/f)*f,e,f).filter((function(t){return v(t%m)>kt})).map(u)).concat(t.range(Math.ceil(o/d)*d,a,d).filter((function(t){return v(t%y)>kt})).map(c))}return _.lines=function(){return x().map((function(t){return{type:"LineString",coordinates:t}}))},_.outline=function(){return{type:"Polygon",coordinates:[p(i).concat(h(s).slice(1),p(n).reverse().slice(1),h(l).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.majorExtent(t).minorExtent(t):_.minorExtent()},_.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),_.precision(g)):[[i,l],[n,s]]},_.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),_.precision(g)):[[r,o],[e,a]]},_.step=function(t){return arguments.length?_.majorStep(t).minorStep(t):_.minorStep()},_.majorStep=function(t){return arguments.length?(m=+t[0],y=+t[1],_):[m,y]},_.minorStep=function(t){return arguments.length?(f=+t[0],d=+t[1],_):[f,d]},_.precision=function(t){return arguments.length?(g=+t,u=Un(o,a,90),c=jn(r,e,g),p=Un(l,s,90),h=jn(i,n,g),_):g},_.majorExtent([[-180,-90+kt],[180,90-kt]]).minorExtent([[-180,-80-kt],[180,80+kt]])},t.geo.greatArc=function(){var e,r,n=Vn,i=qn;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]*Et,n=t[1]*Et,i=e[0]*Et,a=e[1]*Et,o=Math.cos(n),s=Math.sin(n),l=Math.cos(a),u=Math.sin(a),c=o*Math.cos(r),p=o*Math.sin(r),h=l*Math.cos(i),f=l*Math.sin(i),d=2*Math.asin(Math.sqrt(Ft(a-n)+o*l*Ft(i-r))),m=1/Math.sin(d),(y=d?function(t){var e=Math.sin(t*=d)*m,r=Math.sin(d-t)*m,n=r*c+e*h,i=r*p+e*f,a=r*s+e*u;return[Math.atan2(i,n)*It,Math.atan2(a,Math.sqrt(n*n+i*i))*It]}:function(){return[r*It,n*It]}).distance=d,y;var r,n,i,a,o,s,l,u,c,p,h,f,d,m,y},t.geo.length=function(e){return vn=0,t.geo.stream(e,Hn),vn};var Hn={sphere:D,point:D,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=Et),o=Math.cos(i),s=v((n*=Et)-t),l=Math.cos(s);vn+=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*Et,e=Math.sin(a*=Et),r=Math.cos(a),Hn.point=n},Hn.lineEnd=function(){Hn.point=Hn.lineEnd=D}},lineEnd:D,polygonStart:D,polygonEnd:D};function Zn(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=Zn((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=Zn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),E);function Wn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(Mt/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 Jn;function o(t,e){a>0?e<-Lt+kt&&(e=-Lt+kt):e>Lt-kt&&(e=Lt-kt);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=zt(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(v(n)1&&Pt(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ai(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Ln(ti)}).raw=ti,ei.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Lt]},(t.geo.transverseMercator=function(){var t=Qn(ei),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=ei,t.geom={},t.geom.hull=function(t){var e=ri,r=ni;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=de(e),a=de(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)f.push(t[s[u[n]][2]]);for(n=+p;nkt)s=s.L;else{if(!((i=a-Ti(s,o))>kt)){n>-kt?(e=s.P,r=s):i>-kt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=vi(t);if(hi.insert(e,l),e||r){if(e===r)return Ci(e),r=vi(e.site),hi.insert(l,r),l.edge=r.edge=Ii(e.site,l.site),Si(e),void Si(r);if(r){Ci(e),Ci(r);var u=e.site,c=u.x,p=u.y,h=t.x-c,f=t.y-p,d=r.site,m=d.x-c,y=d.y-p,g=2*(h*y-f*m),v=h*h+f*f,_=m*m+y*y,x={x:(y*v-f*_)/g+c,y:(h*_-m*v)/g+p};Pi(r.edge,u,d,x),l.edge=Ii(u,t,null,x),r.edge=Ii(t,d,null,x),Si(e),Si(r)}else l.edge=Ii(e.site,l.site)}}function wi(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,p=1/a-1/u,h=c/u;return p?(-h+Math.sqrt(h*h-2*p*(c*c/(-2*u)-l+u/2+i-a/2)))/p+n:(n+s)/2}function Ti(t,e){var r=t.N;if(r)return wi(r,e);var n=t.site;return n.y===e?n.x:1/0}function ki(t){this.site=t,this.edges=[]}function Ai(t,e){return e.angle-t.angle}function Mi(){Ri(this),this.x=this.y=this.arc=this.site=this.cy=null}function Si(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,p=2*(l*(y=a.y-s)-u*c);if(!(p>=-At)){var h=l*l+u*u,f=c*c+y*y,d=(y*h-u*f)/p,m=(l*f-c*h)/p,y=m+s,g=yi.pop()||new Mi;g.arc=t,g.site=i,g.x=d+o,g.y=y+Math.sqrt(d*d+m*m),g.cy=y,t.circle=g;for(var v=null,_=di._;_;)if(g.y<_.y||g.y===_.y&&g.x<=_.x){if(!_.L){v=_.P;break}_=_.L}else{if(!_.R){v=_;break}_=_.R}di.insert(v,g),v||(fi=g)}}}}function Ci(t){var e=t.circle;e&&(e.P||(fi=e.N),di.remove(e),yi.push(e),Ri(e),t.circle=null)}function Li(t,e){var r=t.b;if(r)return!0;var n,i,a=t.a,o=e[0][0],s=e[1][0],l=e[0][1],u=e[1][1],c=t.l,p=t.r,h=c.x,f=c.y,d=p.x,m=p.y,y=(h+d)/2,g=(f+m)/2;if(m===f){if(y=s)return;if(h>d){if(a){if(a.y>=u)return}else a={x:y,y:l};r={x:y,y:u}}else{if(a){if(a.y1)if(h>d){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.xkt||v(i-r)>kt)&&(s.splice(o,0,new Di(zi(a.site,c,v(n-p)kt?{x:p,y:v(e-p)kt?{x:v(r-d)kt?{x:h,y:v(e-h)kt?{x:v(r-f)=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)/kt)*kt,y:Math.round(i(t,e)/kt)*kt,i:e}}))}return o.links=function(t){return Ui(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 Ui(s(t)).cells.forEach((function(r,n){for(var i,a,o,s,l=r.site,u=r.edges.sort(Ai),c=-1,p=u.length,h=u[p-1].edge,f=h.l===l?h.r:h.l;++ca||p>o||h=b)<<1|e>=x,T=w+4;wa&&(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:Yi(r,n)})),a=Qi.lastIndex;return am&&(m=l.x),l.y>y&&(y=l.y),u.push(l.x),c.push(l.y);else for(p=0;pm&&(m=x),b>y&&(y=b),u.push(x),c.push(b)}var w=m-f,T=y-d;function k(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(v(l-r)+v(u-n)<.01)A(t,e,r,n,i,a,o,s);else{var c=t.point;t.x=t.y=t.point=null,A(t,c,l,u,i,a,o,s),A(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else A(t,e,r,n,i,a,o,s)}function A(t,e,r,n,i,a,o,s){var l=.5*(i+o),u=.5*(a+s),c=r>=l,p=n>=u,h=p<<1|c;t.leaf=!1,c?i=l:o=l,p?a=u:s=u,k(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,i,a,o,s)}w>T?y=d+w:m=f+T;var M={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(M,t,+g(t,++p),+_(t,p),f,d,m,y)},visit:function(t){Zi(t,M,f,d,m,y)},find:function(t){return Gi(M,t[0],t[1],f,d,m,y)}};if(p=-1,null==e){for(;++p=0&&!(n=t.interpolators[i](e,r)););return n}function ta(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function aa(t){return function(e){return 1-t(1-e)}}function oa(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function sa(t){return t*t}function la(t){return t*t*t}function ua(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ca(t){return 1-Math.cos(t*Lt)}function pa(t){return Math.pow(2,10*(t-1))}function ha(t){return 1-Math.sqrt(1-t*t)}function fa(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 da(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function ma(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=ga(i),s=ya(i,a),l=ga(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=ra.get(n)||ea,ia((i=na.get(i)||E)(n.apply(null,r.call(arguments,1))))},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 Zt(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 Qt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=da,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 ma(e?e.matrix:va)})(e)},ma.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var va={a:1,b:0,c:0,d:1,e:0,f:0};function _a(t){return t.length?t.pop()+",":""}function xa(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:Yi(t[0],e[0])},{i:i-2,x:Yi(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(_a(r)+"rotate(",null,")")-2,x:Yi(t,e)})):e&&r.push(_a(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(_a(r)+"skewX(",null,")")-2,x:Yi(t,e)}):e&&r.push(_a(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(_a(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Yi(t[0],e[0])},{i:i-2,x:Yi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(_a(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=we(s.tick)),s):n},s.start=function(){var t,e,r,n=g.length,l=v.length,c=u[0],d=u[1];for(t=0;t=0;)r.push(i[n])}function Da(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 Da(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&&(Pa(t,(function(t){t.children&&(t.value=0)})),Da(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 Wa(t){return t.reduce(Ya,0)}function Ya(t,e){return t+e[1]}function Ka(t,e){return Ja(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ja(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 Qa(e){return[t.min(e),t.max(e)]}function $a(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(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 no(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,u=1/0,c=-1/0,p=1/0,h=-1/0;if(e.forEach(io),(r=e[0]).x=-r.r,r.y=0,_(r),l>1&&((n=e[1]).x=n.r,n.y=0,_(n),l>2))for(oo(r,n,i=e[2]),_(i),to(r,i),r._pack_prev=i,to(i,n),n=r._pack_next,a=3;a0)for(o=-1;++o=p[0]&&l<=p[1]&&((s=u[t.bisect(h,l,1,d)-1]).y+=m,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=de(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Ja(e,t)}:de(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($a),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,Da(s,(function(t){t.r=+c(t.value)})),Da(s,no),n){var p=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;Da(s,(function(t){t.r+=p})),Da(s,no),Da(s,(function(t){t.r-=p}))}return function t(e,r,n,i){var a=e.children;if(e.x=r+=i*e.x,e.y=n+=i*e.y,e.r*=i,a)for(var o=-1,s=a.length;++of.x&&(f=t),t.depth>d.depth&&(d=t)}));var m=r(h,f)/2-h.x,y=n[0]/(f.x+r(f,h)/2+m),g=n[1]/(d.depth||1);Pa(c,(function(t){t.x=(t.x+m)*y,t.y=t.depth*g}))}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,p=s.m,h=l.m;s=uo(s),a=lo(a),s&&a;)l=lo(l),(o=uo(o)).a=t,(i=s.z+p-a.z-u+r(s._,a._))>0&&(co(po(s,t,n),t,i),u+=i,c+=i),p+=s.m,u+=a.m,h+=l.m,c+=o.m;s&&!uo(o)&&(o.t=s,o.m+=p-c),a&&!lo(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},za(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),u=l[0],c=0;Da(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 p=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),f=p.x-r(p,h)/2,d=h.x+r(h,p)/2;return Da(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-f)/(d-f)*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},za(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=ho,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=f(s,m))<=h?(u.pop(),h=n):(s.area-=s.pop().area,d(s,m,a,!1),m=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(d(s,m,a,!0),s.length=s.area=0),e.forEach(p)}}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&&(d(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(h)}}function f(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 d(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?bo:go,s=i?wa:ba;return a=t(e,r,s,n),o=t(r,e,s,$i),l}function l(t){return a(t)}return 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(da)},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 Ao(e,t)},l.tickFormat=function(t,r){return Mo(e,t,r)},l.nice=function(t){return To(e,t),s()},l.copy=function(){return t(e,r,n,i)},s()}([0,1],[0,1],$i,!1)};var So={s:1,g:1,p:1,r:1,e:1};function Co(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))}return 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=vo(a.map(o),i?Math:Eo);return r.domain(t),a=t.map(s),l},l.ticks=function(){var t=mo(a),e=[],r=t[0],l=t[1],u=Math.floor(o(r)),c=Math.ceil(o(l)),p=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 Lo;arguments.length<2?r=Lo:"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],tp?0:1;if(u=Ct)return l(u,f)+(s?l(s,1-f):"")+"Z";var d,m,y,g,v,_,x,b,w,T,k,A,M=0,S=0,C=[];if((g=(+o.apply(this,arguments)||0)/2)&&(y=n===Fo?Math.sqrt(s*s+u*u):+n.apply(this,arguments),f||(S*=-1),u&&(S=Ot(y/u*Math.sin(g))),s&&(M=Ot(y/s*Math.sin(g)))),u){v=u*Math.cos(c+S),_=u*Math.sin(c+S),x=u*Math.cos(p-S),b=u*Math.sin(p-S);var L=Math.abs(p-c-2*S)<=Mt?0:1;if(S&&qo(v,_,x,b)===f^L){var E=(c+p)/2;v=u*Math.cos(E),_=u*Math.sin(E),x=b=null}}else v=_=0;if(s){w=s*Math.cos(p-M),T=s*Math.sin(p-M),k=s*Math.cos(c+M),A=s*Math.sin(c+M);var I=Math.abs(c-p+2*M)<=Mt?0:1;if(M&&qo(w,T,k,A)===1-f^I){var z=(c+p)/2;w=s*Math.cos(z),T=s*Math.sin(z),k=A=null}}else w=T=0;if(h>kt&&(d=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){m=s0?0:1}function Ho(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,p=t[1]+u,h=e[0]+l,f=e[1]+u,d=(c+h)/2,m=(p+f)/2,y=h-c,g=f-p,v=y*y+g*g,_=r-n,x=c*f-h*p,b=(g<0?-1:1)*Math.sqrt(Math.max(0,_*_*v-x*x)),w=(x*g-y*b)/v,T=(-x*y-g*b)/v,k=(x*g+y*b)/v,A=(-x*y+g*b)/v,M=w-d,S=T-m,C=k-d,L=A-m;return M*M+S*S>C*C+L*L&&(w=k,T=A),[[w-l,T-u],[w*r/_,T*r/_]]}function Zo(t){var e=ri,r=ni,n=Gr,i=Xo,a=i.key,o=.7;function s(a){var s,l=[],u=[],c=-1,p=a.length,h=de(e),f=de(r);function d(){l.push("M",i(t(u),o))}for(;++c1&&i.push("H",n[0]);return i.join("")},"step-before":Yo,"step-after":Ko,basis:$o,"basis-open":function(t){if(t.length<4)return Xo(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(ts(ns,a)+","+ts(ns,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 Xo(t){return t.length>1?t.join("L"):t+"Z"}function Wo(t){return t.join("L")+"Z"}function Yo(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;uMt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=de(t),a):r},a.source=function(e){return arguments.length?(t=de(e),a):t},a.target=function(t){return arguments.length?(e=de(t),a):e},a.startAngle=function(t){return arguments.length?(n=de(t),a):n},a.endAngle=function(t){return arguments.length?(i=de(t),a):i},a},t.svg.diagonal=function(){var t=Vn,e=qn,r=us;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=de(e),n):t},n.target=function(t){return arguments.length?(e=de(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=us,n=e.projection;return e.projection=function(t){return arguments.length?n(cs(r=t)):r},e},t.svg.symbol=function(){var t=hs,e=ps;function r(r,n){return(ds.get(t.call(this,r,n))||fs)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=de(e),r):t},r.size=function(t){return arguments.length?(e=de(t),r):e},r};var ds=t.map({circle:fs,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*ys)),r=e*ys;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/ms),r=e*ms/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/ms),r=e*ms/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ds.keys();var ms=Math.sqrt(3),ys=Math.tan(30*Et);G.transition=function(t){for(var e,r,n=xs||++Ts,i=Ms(t),a=[],o=bs||{time:Date.now(),ease:ua,delay:0,duration:250},s=-1,l=this.length;++s0;)u[--h].call(t,o);if(a>=1)return p.event&&p.event.end.call(t,t.__data__,e),--c.count?delete c[n]:delete t[r],1}p||(a=i.time,o=we((function(t){var e=p.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h}),0,a),p=c[n]={tween:new b,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++c.count)}ws.call=G.call,ws.empty=G.empty,ws.node=G.node,ws.size=G.size,t.transition=function(e,r){return e&&e.transition?xs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=X(t);for(var s=-1,l=this.length;++srect,.s>rect").attr("width",s[1]-s[0])}function m(t){t.select(".extent").attr("y",l[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",l[1]-l[0])}function y(){var p,y,g=this,v=t.select(t.event.target),_=n.of(g,arguments),x=t.select(g),b=v.datum(),w=!/^(n|s)$/.test(b)&&i,T=!/^(e|w)$/.test(b)&&a,k=v.classed("extent"),A=xt(g),M=t.mouse(g),S=t.select(o(g)).on("keydown.brush",E).on("keyup.brush",I);if(t.event.changedTouches?S.on("touchmove.brush",z).on("touchend.brush",D):S.on("mousemove.brush",z).on("mouseup.brush",D),x.interrupt().selectAll("*").interrupt(),k)M[0]=s[0]-M[0],M[1]=l[0]-M[1];else if(b){var C=+/w$/.test(b),L=+/^n/.test(b);y=[s[1-C]-M[0],l[1-L]-M[1]],M[0]=s[C],M[1]=l[L]}else t.event.altKey&&(p=M.slice());function E(){32==t.event.keyCode&&(k||(p=null,M[0]-=s[1],M[1]-=l[1],k=2),F())}function I(){32==t.event.keyCode&&2==k&&(M[0]+=s[1],M[1]+=l[1],k=0,F())}function z(){var e=t.mouse(g),r=!1;y&&(e[0]+=y[0],e[1]+=y[1]),k||(t.event.altKey?(p||(p=[(s[0]+s[1])/2,(l[0]+l[1])/2]),M[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Ns(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Ns(+e+1);return e}}:t))},i.ticks=function(t,e){var r=mo(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],Ns(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Bs(e.copy(),r,n)},wo(i,e)}function Ns(t){return new Date(t)}Ds.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fs:Rs,Fs.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Fs.toString=Rs.toString,ze.second=Re((function(t){return new Pe(1e3*Math.floor(t/1e3))}),(function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))}),(function(t){return t.getSeconds()})),ze.seconds=ze.second.range,ze.seconds.utc=ze.second.utc.range,ze.minute=Re((function(t){return new Pe(6e4*Math.floor(t/6e4))}),(function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))}),(function(t){return t.getMinutes()})),ze.minutes=ze.minute.range,ze.minutes.utc=ze.minute.utc.range,ze.hour=Re((function(t){var e=t.getTimezoneOffset()/60;return new Pe(36e5*(Math.floor(t/36e5-e)+e))}),(function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))}),(function(t){return t.getHours()})),ze.hours=ze.hour.range,ze.hours.utc=ze.hour.utc.range,ze.month=Re((function(t){return(t=ze.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),ze.months=ze.month.range,ze.months.utc=ze.month.utc.range;var Us=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],js=[[ze.second,1],[ze.second,5],[ze.second,15],[ze.second,30],[ze.minute,1],[ze.minute,5],[ze.minute,15],[ze.minute,30],[ze.hour,1],[ze.hour,3],[ze.hour,6],[ze.hour,12],[ze.day,1],[ze.day,2],[ze.week,1],[ze.month,1],[ze.month,3],[ze.year,1]],Vs=Ds.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",Gr]]),qs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Ns)},floor:E,ceil:E};js.year=ze.year,ze.scale=function(){return Bs(t.scale.linear(),js,Vs)};var Hs=js.map((function(t){return[t[0].utc,t[1]]})),Zs=Os.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",Gr]]);function Gs(t){return JSON.parse(t.responseText)}function Xs(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}Hs.year=ze.year.utc,ze.scale.utc=function(){return Bs(t.scale.linear(),Hs,Zs)},t.text=me((function(t){return t.responseText})),t.json=function(t,e){return ye(t,"application/json",Gs,e)},t.html=function(t,e){return ye(t,"text/html",Xs,e)},t.xml=me((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],17:[function(t,e,r){(function(n,i){(function(){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -12,10 +12,10 @@ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ -!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():t.ES6Promise=n()}(this,(function(){"use strict";function e(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},a=0,o=void 0,s=void 0,l=function(t,e){m[a]=t,m[a+1]=e,2===(a+=2)&&(s?s(g):b())};var u="undefined"!=typeof window?window:void 0,c=u||{},p=c.MutationObserver||c.WebKitMutationObserver,h="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(g,1)}}var m=new Array(1e3);function g(){for(var t=0;t13)&&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}},{}],24:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():(t=t||self).mapboxgl=n()}(this,(function(){"use strict";var t,e,r;function n(n,i){if(t)if(e){var a="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),(r=i(o)).workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"}))}else e=i;else t=i}return n(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,a,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)(n=1))return n;for(;ra?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=a;function a(t,e){this.x=t,this.y=e}function o(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(t){return t instanceof a?t:Array.isArray(t)?new a(t[0],t[1]):t};var s=o(.25,.1,.25,1);function l(t,e,r){return Math.min(r,Math.max(e,t))}function u(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function c(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function d(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function m(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function g(t,e){return-1!==t.indexOf(e,t.length-e.length)}function y(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function v(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function _(t){return Array.isArray(t)?t.map(_):"object"==typeof t&&t?y(t,_):t}var x={};function b(t){x[t]||("undefined"!=typeof console&&console.warn(t),x[t]=!0)}function w(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function T(t){for(var e=0,r=0,n=t.length,i=n-1,a=void 0,o=void 0;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var a=n||i;return e[r]=!a||a.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var M=null;function S(t){if(null==M){var e=t.navigator?t.navigator.userAgent:null;M=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return M}function C(t){try{var e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var L,E,z,I,P=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),D=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,O=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,R={now:P,frame:function(t){var e=D(t);return{cancel:function(){return O(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=self.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return L||(L=self.document.createElement("a")),L.href=t,L.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio},get prefersReducedMotion(){return!!self.matchMedia&&(null==E&&(E=self.matchMedia("(prefers-reduced-motion: reduce)")),E.matches)}},F={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},B={supported:!1,testSupport:function(t){!N&&I&&(U?j(t):z=t)}},N=!1,U=!1;function j(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,I),t.isContextLost())return;B.supported=!0}catch(t){}t.deleteTexture(e),N=!0}self.document&&((I=self.document.createElement("img")).onload=function(){z&&j(z),z=null,U=!0},I.onerror=function(){N=!0,z=null},I.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var V="01",q=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function H(t){return 0===t.indexOf("mapbox:")}q.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",V,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},q.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},q.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},q.prototype.normalizeStyleURL=function(t,e){if(!H(t))return t;var r=W(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeGlyphsURL=function(t,e){if(!H(t))return t;var r=W(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSourceURL=function(t,e){if(!H(t))return t;var r=W(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSpriteURL=function(t,e,r,n){var i=W(t);return H(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,Y(i))},q.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!H(t))return t;var r=W(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(R.devicePixelRatio>=2||512===e?"@2x":"")+(B.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e=1&&self.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){b("Unable to write to LocalStorage")}},J.prototype.processRequests=function(t){},J.prototype.postEvent=function(t,e,r,n){var i=this;if(F.EVENTS_URL){var a=W(F.EVENTS_URL);a.params.push("access_token="+(n||F.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.10.1",skuId:V,userId:this.anonId},s=e?c(o,e):o,l={url:Y(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=_t(l,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n)}))}},J.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var Q,$,tt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(F.EVENTS_URL&&n||F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||G(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,i=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),d(this.anonId)||(this.anonId=f()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}(J),et=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){F.EVENTS_URL&&F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||G(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=K(F.ACCESS_TOKEN),n=r?r.u:F.ACCESS_TOKEN,i=n!==this.eventData.tokenU;d(this.anonId)||(this.anonId=f(),i=!0);var a=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),s=new Date(a),l=(a-this.eventData.lastSuccess)/864e5;i=i||l>=1||l<-1||o.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(a,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=a,e.eventData.tokenU=n)}),t)}},e}(J)),rt=et.postTurnstileEvent.bind(et),nt=new tt,it=nt.postMapLoadEvent.bind(nt),at=500,ot=50;function st(){self.caches&&!Q&&(Q=self.caches.open("mapbox-tiles"))}function lt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ut,ct=1/0;function pt(){return null==ut&&(ut=self.OffscreenCanvas&&new self.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),ut}var ht={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ht);var ft,dt,mt=function(t){function e(e,r,n){401===r&&G(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=r,this.url=n,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),gt=k()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===self.location.protocol?self.parent:self).location.href},yt=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(gt())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&self.Request.prototype.hasOwnProperty("signal"))return function(t,e){var r,n=new self.AbortController,i=new self.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:gt(),signal:n.signal}),a=!1,o=!1,s=(r=i.url).indexOf("sku=")>0&&G(r);"json"===t.type&&i.headers.set("Accept","application/json");var l=function(r,n,a){if(!o){if(r&&"SecurityError"!==r.message&&b(r),n&&a)return u(n);var l=Date.now();self.fetch(i).then((function(r){if(r.ok){var n=s?r.clone():null;return u(r,n,l)}return e(new mt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},u=function(r,n,s){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){o||(n&&s&&function(t,e,r){if(st(),Q){var n={status:e.status,statusText:e.statusText,headers:new self.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var i=A(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===$)try{new Response(new ReadableStream),$=!0}catch(t){$=!1}$?e(t.body):t.blob().then(e)}(e,(function(e){var r=new self.Response(e,n);st(),Q&&Q.then((function(e){return e.put(lt(t.url),r)})).catch((function(t){return b(t.message)}))})))}}(i,n,s),a=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){o||e(new Error(t.message))}))};return s?function(t,e){if(st(),!Q)return e(null);var r=lt(t.url);Q.then((function(t){t.match(r).then((function(n){var i=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),r=A(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i)})).catch(e)})).catch(e)}(i,l):l(null,null),{cancel:function(){o=!0,a||n.abort()}}}(t,e);if(k()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){var r=new self.XMLHttpRequest;for(var n in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(n,t.headers[n]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new mt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},vt=function(t,e){return yt(c(t,{type:"arrayBuffer"}),e)},_t=function(t,e){return yt(c(t,{method:"POST"}),e)};ft=[],dt=0;var xt=function(t,e){if(B.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),dt>=F.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return ft.push(r),r}dt++;var n=!1,i=function(){if(!n)for(n=!0,dt--;ft.length&&dt0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},At.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Mt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},St=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function Ct(t){var e=t.value;return e?[new St(t.key,e,"constants have been deprecated as of v8")]:[]}function Lt(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Gt=[Dt,Ot,Rt,Ft,Bt,Vt,Nt,Ht(Ut),qt];function Xt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Xt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=Gt;r255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),u=s.indexOf(")");if(-1!==l&&u+1===s.length){var c=s.substr(0,l),p=s.substr(l+1,u-(l+1)).split(","),h=1;switch(c){case"rgba":if(4!==p.length)return null;h=a(p.pop());case"rgb":return 3!==p.length?null:[i(p[0]),i(p[1]),i(p[2]),h];case"hsla":if(4!==p.length)return null;h=a(p.pop());case"hsl":if(3!==p.length)return null;var f=(parseFloat(p[0])%360+360)%360/360,d=a(p[1]),m=a(p[2]),g=m<=.5?m*(d+1):m+d-m*d,y=2*m-g;return[n(255*o(y,g,f+1/3)),n(255*o(y,g,f)),n(255*o(y,g,f-1/3)),h];default:return null}}return null}}catch(t){}})).parseCSSColor,Jt=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};Jt.parse=function(t){if(t){if(t instanceof Jt)return t;if("string"==typeof t){var e=Kt(t);if(e)return new Jt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Jt.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},Jt.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},Jt.black=new Jt(0,0,0,1),Jt.white=new Jt(1,1,1,1),Jt.transparent=new Jt(0,0,0,0),Jt.red=new Jt(1,0,0,1);var Qt=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Qt.prototype.compare=function(t,e){return this.collator.compare(t,e)},Qt.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var $t=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i},te=function(t){this.sections=t};te.fromString=function(t){return new te([new $t(t,null,null,null,null)])},te.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},te.factory=function(t){return t instanceof te?t:te.fromString(t)},te.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},te.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ne(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof Jt)return!0;if(t instanceof Qt)return!0;if(t instanceof te)return!0;if(t instanceof ee)return!0;if(Array.isArray(t)){for(var e=0,r=t;e2){var s=t[1];if("string"!=typeof s||!(s in le)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);a=le[s],n++}else a=Ut;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++}r=Ht(a,o)}else r=le[i];for(var l=[];n1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var ce=function(t){this.type=Vt,this.sections=t};ce.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,a=1;a<=t.length-1;++a){var o=t[a];if(i&&"object"==typeof o&&!Array.isArray(o)){i=!1;var s=null;if(o["font-scale"]&&!(s=e.parse(o["font-scale"],1,Ot)))return null;var l=null;if(o["text-font"]&&!(l=e.parse(o["text-font"],1,Ht(Rt))))return null;var u=null;if(o["text-color"]&&!(u=e.parse(o["text-color"],1,Bt)))return null;var c=n[n.length-1];c.scale=s,c.font=l,c.textColor=u}else{var p=e.parse(t[a],1,Ut);if(!p)return null;var h=p.type.kind;if("string"!==h&&"value"!==h&&"null"!==h&&"resolvedImage"!==h)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:p,scale:null,font:null,textColor:null})}}return new ce(n)},ce.prototype.evaluate=function(t){return new te(this.sections.map((function(e){var r=e.content.evaluate(t);return ie(r)===qt?new $t("",r,null,null,null):new $t(ae(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},ce.prototype.eachChild=function(t){for(var e=0,r=this.sections;e-1),r},pe.prototype.eachChild=function(t){t(this.input)},pe.prototype.outputDefined=function(){return!1},pe.prototype.serialize=function(){return["image",this.input.serialize()]};var he={"to-boolean":Ft,"to-color":Bt,"to-number":Ot,"to-string":Rt},fe=function(t,e){this.type=t,this.args=e};fe.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=he[r],i=[],a=1;a4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":re(e[0],e[1],e[2],e[3])))return new Jt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new se(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var o=null,s=0,l=this.args;s=e[2]||t[1]<=e[1]||t[3]>=e[3])}function xe(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*8192),Math.round(n*i*8192)]}function be(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function we(t,e){for(var r,n,i,a,o,s,l,u=!1,c=0,p=e.length;c0&&s<0||o<0&&s>0}function Ae(t,e,r){for(var n=0,i=r;nr[2]){var i=.5*n,a=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;0===a&&(a=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=a}ve(e,t)}function ze(t,e,r,n){for(var i=8192*Math.pow(2,n.z),a=[8192*n.x,8192*n.y],o=[],s=0,l=t;s=0)return!1;var r=!0;return t.eachChild((function(t){r&&!Re(t,e)&&(r=!1)})),r}Pe.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(ne(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;ne))throw new se("Input is not a number.");a=o-1}return 0}Be.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},Be.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new ue(e,[t]):"coerce"===r?new fe(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var a=i.parse(t,this);if(!a)return null;if(this.expectedType){var o=this.expectedType,s=a.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==s.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(o,s))return null}else a=r(a,o,e.typeAnnotation||"coerce");else a=r(a,o,e.typeAnnotation||"assert")}if(!(a instanceof oe)&&"resolvedImage"!==a.type.kind&&function t(e){if(e instanceof Fe)return t(e.boundExpression);if(e instanceof ge&&"error"===e.name)return!1;if(e instanceof ye)return!1;if(e instanceof Pe)return!1;var r=e instanceof fe||e instanceof ue,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof oe})),!!n&&De(e)&&Re(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(a)){var l=new me;try{a=new oe(a.type,a.evaluate(l))}catch(t){return this.error(t.message),null}}return a}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Be.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Be(this.registry,n,e||null,i,this.errors)},Be.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new It(n,t))},Be.prototype.checkSubtype=function(t,e){var r=Xt(t,e);return r&&this.error(r),r};var Ue=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var c=e.parse(s,u,i);if(!c)return null;i=i||c.type,n.push([o,c])}return new Ue(i,r,n)},Ue.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ne(e,n)].evaluate(t)},Ue.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ve=Object.freeze({__proto__:null,number:je,color:function(t,e,r){return new Jt(je(t.r,e.r,r),je(t.g,e.g,r),je(t.b,e.b,r),je(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return je(t,e[n],r)}))}}),qe=6/29*3*(6/29),He=Math.PI/180,Ze=180/Math.PI;function Ge(t){return t>.008856451679035631?Math.pow(t,1/3):t/qe+4/29}function Xe(t){return t>6/29?t*t*t:qe*(t-4/29)}function We(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ye(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ke(t){var e=Ye(t.r),r=Ye(t.g),n=Ye(t.b),i=Ge((.4124564*e+.3575761*r+.1804375*n)/.95047),a=Ge((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*a-16,a:500*(i-a),b:200*(a-Ge((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function Je(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Xe(e),r=.95047*Xe(r),n=1.08883*Xe(n),new Jt(We(3.2404542*r-1.5371385*e-.4985314*n),We(-.969266*r+1.8760108*e+.041556*n),We(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function Qe(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var $e={forward:Ke,reverse:Je,interpolate:function(t,e,r){return{l:je(t.l,e.l,r),a:je(t.a,e.a,r),b:je(t.b,e.b,r),alpha:je(t.alpha,e.alpha,r)}}},tr={forward:function(t){var e=Ke(t),r=e.l,n=e.a,i=e.b,a=Math.atan2(i,n)*Ze;return{h:a<0?a+360:a,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*He,r=t.c;return Je({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:Qe(t.h,e.h,r),c:je(t.c,e.c,r),l:je(t.l,e.l,r),alpha:je(t.alpha,e.alpha,r)}}},er=Object.freeze({__proto__:null,lab:$e,hcl:tr}),rr=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var a=0,o=i;a1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Ot)))return null;var l=[],u=null;"interpolate-hcl"===r||"interpolate-lab"===r?u=Bt:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var c=0;c=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var m=e.parse(h,d,u);if(!m)return null;u=u||m.type,l.push([p,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new rr(u,r,n,i,l):e.error("Type "+Zt(u)+" is not interpolatable.")},rr.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var a=Ne(e,n),o=rr.interpolationFactor(this.interpolation,n,e[a],e[a+1]),s=r[a].evaluate(t),l=r[a+1].evaluate(t);return"interpolate"===this.operator?Ve[this.type.kind.toLowerCase()](s,l,o):"interpolate-hcl"===this.operator?tr.reverse(tr.interpolate(tr.forward(s),tr.forward(l),o)):$e.reverse($e.interpolate($e.forward(s),$e.forward(l),o))},rr.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new se("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new se("Array index must be an integer, but found "+e+" instead.");return r[e]},or.prototype.eachChild=function(t){t(this.index),t(this.input)},or.prototype.outputDefined=function(){return!1},or.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var sr=function(t,e){this.type=Ft,this.needle=t,this.haystack=e};sr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ut),n=e.parse(t[2],2,Ut);return r&&n?Wt(r.type,[Ft,Rt,Ot,Dt,Ut])?new sr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Zt(r.type)+" instead"):null},sr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Yt(e,["boolean","string","number","null"]))throw new se("Expected first argument to be of type boolean, string, number or null, but found "+Zt(ie(e))+" instead.");if(!Yt(r,["string","array"]))throw new se("Expected second argument to be of type array or string, but found "+Zt(ie(r))+" instead.");return r.indexOf(e)>=0},sr.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},sr.prototype.outputDefined=function(){return!0},sr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var lr=function(t,e,r){this.type=Ot,this.needle=t,this.haystack=e,this.fromIndex=r};lr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ut),n=e.parse(t[2],2,Ut);if(!r||!n)return null;if(!Wt(r.type,[Ft,Rt,Ot,Dt,Ut]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Zt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Ot);return i?new lr(r,n,i):null}return new lr(r,n)},lr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Yt(e,["boolean","string","number","null"]))throw new se("Expected first argument to be of type boolean, string, number or null, but found "+Zt(ie(e))+" instead.");if(!Yt(r,["string","array"]))throw new se("Expected second argument to be of type array or string, but found "+Zt(ie(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},lr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},lr.prototype.outputDefined=function(){return!1},lr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var ur=function(t,e,r,n,i,a){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=a};ur.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},a=[],o=2;oNumber.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,ie(h)))return null}else r=ie(h);if(void 0!==i[String(h)])return u.error("Branch labels must be unique.");i[String(h)]=a.length}var f=e.parse(l,o,n);if(!f)return null;n=n||f.type,a.push(f)}var d=e.parse(t[1],1,Ut);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,n);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new ur(r,n,d,i,a,m):null},ur.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ie(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},ur.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},ur.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},ur.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,a=Object.keys(this.cases).sort();i=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ut),n=e.parse(t[2],2,Ot);if(!r||!n)return null;if(!Wt(r.type,[Ht(Ut),Rt,Ut]))return e.error("Expected first argument to be of type array or string, but found "+Zt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Ot);return i?new pr(r.type,r,n,i):null}return new pr(r.type,r,n)},pr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Yt(e,["string","array"]))throw new se("Expected first argument to be of type array or string, but found "+Zt(ie(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},pr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},pr.prototype.outputDefined=function(){return!1},pr.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var mr=dr("==",(function(t,e,r){return e===r}),fr),gr=dr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!fr(0,e,r,n)})),yr=dr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),_r=dr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),xr=dr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),br=function(t,e,r,n,i){this.type=Rt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i};br.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Ot);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var i=null;if(n.locale&&!(i=e.parse(n.locale,1,Rt)))return null;var a=null;if(n.currency&&!(a=e.parse(n.currency,1,Rt)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Ot)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Ot))?null:new br(r,i,a,o,s)},br.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},br.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},br.prototype.outputDefined=function(){return!1},br.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var wr=function(t){this.type=Ot,this.input=t};wr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Zt(r.type)+" instead."):new wr(r):null},wr.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new se("Expected value to be of type string or array, but found "+Zt(ie(e))+" instead.")},wr.prototype.eachChild=function(t){t(this.input)},wr.prototype.outputDefined=function(){return!1},wr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Tr={"==":mr,"!=":gr,">":vr,"<":yr,">=":xr,"<=":_r,array:ue,at:or,boolean:ue,case:cr,coalesce:ir,collator:ye,format:ce,image:pe,in:sr,"index-of":lr,interpolate:rr,"interpolate-hcl":rr,"interpolate-lab":rr,length:wr,let:ar,literal:oe,match:ur,number:ue,"number-format":br,object:ue,slice:pr,step:Ue,string:ue,"to-boolean":fe,"to-color":fe,"to-number":fe,"to-string":fe,var:Fe,within:Pe};function kr(t,e){var r=e[0],n=e[1],i=e[2],a=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var o=a?a.evaluate(t):1,s=re(r,n,i,o);if(s)throw new se(s);return new Jt(r/255*o,n/255*o,i/255*o,o)}function Ar(t,e){return t in e}function Mr(t,e){var r=e[t];return void 0===r?null:r}function Sr(t){return{type:t}}function Cr(t){return{result:"success",value:t}}function Lr(t){return{result:"error",value:t}}function Er(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function zr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ir(t){return!!t.expression&&t.expression.interpolated}function Pr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Dr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Or(t){return t}function Rr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Fr(t,e,r,n,i){return Rr(typeof r===i?n[r]:void 0,t.default,e.default)}function Br(t,e,r){if("number"!==Pr(r))return Rr(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=Ne(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function Nr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==Pr(r))return Rr(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var a=Ne(t.stops.map((function(t){return t[0]})),r),o=function(t,e,r,n){var i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],l=t.stops[a+1][1],u=Ve[e.type]||Or;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=er[t.colorSpace];u=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),o))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return u(r,n,o)}}:u(s,l,o)}function Ur(t,e,r){return"color"===e.type?r=Jt.parse(r):"formatted"===e.type?r=te.fromString(r.toString()):"resolvedImage"===e.type?r=ee.fromString(r.toString()):Pr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Rr(r,t.default,e.default)}ge.register(Tr,{error:[{kind:"error"},[Rt],function(t,e){throw new se(e[0].evaluate(t))}],typeof:[Rt,[Ut],function(t,e){return Zt(ie(e[0].evaluate(t)))}],"to-rgba":[Ht(Ot,4),[Bt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Bt,[Ot,Ot,Ot],kr],rgba:[Bt,[Ot,Ot,Ot,Ot],kr],has:{type:Ft,overloads:[[[Rt],function(t,e){return Ar(e[0].evaluate(t),t.properties())}],[[Rt,Nt],function(t,e){var r=e[1];return Ar(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:Ut,overloads:[[[Rt],function(t,e){return Mr(e[0].evaluate(t),t.properties())}],[[Rt,Nt],function(t,e){var r=e[1];return Mr(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[Ut,[Rt],function(t,e){return Mr(e[0].evaluate(t),t.featureState||{})}],properties:[Nt,[],function(t){return t.properties()}],"geometry-type":[Rt,[],function(t){return t.geometryType()}],id:[Ut,[],function(t){return t.id()}],zoom:[Ot,[],function(t){return t.globals.zoom}],"heatmap-density":[Ot,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Ot,[],function(t){return t.globals.lineProgress||0}],accumulated:[Ut,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Ot,Sr(Ot),function(t,e){for(var r=0,n=0,i=e;n":[Ft,[Rt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>a}],"filter-id->":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[Ft,[Rt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[Ft,[Rt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[Ft,[Ut],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Ft,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Ft,[Ht(Rt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Ft,[Ht(Ut)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Ft,[Rt,Ht(Ut)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[Ft,[Rt,Ht(Ut)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:Ft,overloads:[[[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Sr(Ft),function(t,e){for(var r=0,n=e;r0&&"string"==typeof t[0]&&t[0]in Tr}function qr(t,e){var r=new Be(Tr,[],e?function(t){var e={color:Bt,string:Rt,number:Ot,enum:Rt,boolean:Ft,formatted:Vt,resolvedImage:qt};return"array"===t.type?Ht(e[t.value]||Ut,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Cr(new jr(n,e)):Lr(r.errors)}jr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)},jr.prototype.evaluate=function(t,e,r,n,i,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{var o=this.expression.evaluate(this._evaluator);if(null==o||"number"==typeof o&&o!=o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new se("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(o)+" instead.");return o}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Hr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Oe(e.expression)};Hr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)},Hr.prototype.evaluate=function(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)};var Zr=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Oe(e.expression),this.interpolationType=n};function Gr(t,e){if("error"===(t=qr(t,e)).result)return t;var r=t.value.expression,n=De(r);if(!n&&!Er(e))return Lr([new It("","data expressions not supported")]);var i=Re(r,["zoom"]);if(!i&&!zr(e))return Lr([new It("","zoom expressions not supported")]);var a=function t(e){var r=null;if(e instanceof ar)r=t(e.result);else if(e instanceof ir)for(var n=0,i=e.args;nn.maximum?[new St(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function Jr(t){var e,r,n,i=t.valueSpec,a=Et(t.value.type),o={},s="categorical"!==a&&void 0===t.value.property,l=!s,u="array"===Pr(t.value.stops)&&"array"===Pr(t.value.stops[0])&&"object"===Pr(t.value.stops[0][0]),c=Wr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===a)return[new St(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Yr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===Pr(r)&&0===r.length&&e.push(new St(t.key,r,"array must have at least one stop")),e},default:function(t){return xn({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===a&&s&&c.push(new St(t.key,t.value,'missing required property "property"')),"identity"===a||t.value.stops||c.push(new St(t.key,t.value,'missing required property "stops"')),"exponential"===a&&t.valueSpec.expression&&!Ir(t.valueSpec)&&c.push(new St(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Er(t.valueSpec)?c.push(new St(t.key,t.value,"property functions not supported")):s&&!zr(t.valueSpec)&&c.push(new St(t.key,t.value,"zoom functions not supported"))),"categorical"!==a&&!u||void 0!==t.value.property||c.push(new St(t.key,t.value,'"property" property is required')),c;function p(t){var e=[],a=t.value,s=t.key;if("array"!==Pr(a))return[new St(s,a,"array expected, "+Pr(a)+" found")];if(2!==a.length)return[new St(s,a,"array length 2 expected, length "+a.length+" found")];if(u){if("object"!==Pr(a[0]))return[new St(s,a,"object expected, "+Pr(a[0])+" found")];if(void 0===a[0].zoom)return[new St(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new St(s,a,"object stop key must have value")];if(n&&n>Et(a[0].zoom))return[new St(s,a[0].zoom,"stop zoom values must appear in ascending order")];Et(a[0].zoom)!==n&&(n=Et(a[0].zoom),r=void 0,o={}),e=e.concat(Wr({key:s+"[0]",value:a[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Kr,value:h}}))}else e=e.concat(h({key:s+"[0]",value:a[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},a));return Vr(zt(a[1]))?e.concat([new St(s+"[1]",a[1],"expressions are not allowed in function stops.")]):e.concat(xn({key:s+"[1]",value:a[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function h(t,n){var s=Pr(t.value),l=Et(t.value),u=null!==t.value?t.value:n;if(e){if(s!==e)return[new St(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new St(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==a){var c="number expected, "+s+" found";return Er(i)&&void 0===a&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new St(t.key,u,c)]}return"categorical"!==a||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==a&&"number"===s&&void 0!==r&&l=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function an(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?on(t[1],t[2],"=="):"!="===r?un(on(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?on(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(an))):"all"===r?["all"].concat(t.slice(1).map(an)):"none"===r?["all"].concat(t.slice(1).map(an).map(un)):"in"===r?sn(t[1],t.slice(2)):"!in"===r?un(sn(t[1],t.slice(2))):"has"===r?ln(t[1]):"!has"===r?un(ln(t[1])):"within"!==r||t}function on(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function sn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(nn)]]:["filter-in-small",t,["literal",e]]}}function ln(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function un(t){return["!",t]}function cn(t){return tn(zt(t.value))?Qr(Lt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==Pr(r))return[new St(n,r,"array expected, "+Pr(r)+" found")];var i,a=e.styleSpec,o=[];if(r.length<1)return[new St(n,r,"filter array must have at least 1 element")];switch(o=o.concat($r({key:n+"[0]",value:r[0],valueSpec:a.filter_operator,style:e.style,styleSpec:e.styleSpec})),Et(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===Et(r[1])&&o.push(new St(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&o.push(new St(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=Pr(r[1]))&&o.push(new St(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s=c[f+0]&&n>=c[f+1])?(o[h]=!0,a.push(u[h])):o[h]=!1}}},zn.prototype._forEachCell=function(t,e,r,n,i,a,o,s){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),h=l;h<=c;h++)for(var f=u;f<=p;f++){var d=this.d*f+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(f),this._convertFromCellCoord(h+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,d,a,o,s))return}},zn.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},zn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},zn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n=0)){var c=t[u];l[u]=Dn[s].shallow.indexOf(u)>=0?c:Nn(c,e)}t instanceof Error&&(l.message=t.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof t)}function Un(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Fn(t)||Bn(t)||ArrayBuffer.isView(t)||t instanceof In)return t;if(Array.isArray(t))return t.map(Un);if("object"==typeof t){var e=t.$name||"Object",r=Dn[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),i=0,a=Object.keys(t);i=0?s:Un(s)}}return n}throw new Error("can't deserialize object of type "+typeof t)}var jn=function(){this.first=!0};jn.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function qn(t){for(var e=0,r=t;e=65097&&t<=65103)||Vn["CJK Compatibility Ideographs"](t)||Vn["CJK Compatibility"](t)||Vn["CJK Radicals Supplement"](t)||Vn["CJK Strokes"](t)||!(!Vn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Vn["CJK Unified Ideographs Extension A"](t)||Vn["CJK Unified Ideographs"](t)||Vn["Enclosed CJK Letters and Months"](t)||Vn["Hangul Compatibility Jamo"](t)||Vn["Hangul Jamo Extended-A"](t)||Vn["Hangul Jamo Extended-B"](t)||Vn["Hangul Jamo"](t)||Vn["Hangul Syllables"](t)||Vn.Hiragana(t)||Vn["Ideographic Description Characters"](t)||Vn.Kanbun(t)||Vn["Kangxi Radicals"](t)||Vn["Katakana Phonetic Extensions"](t)||Vn.Katakana(t)&&12540!==t||!(!Vn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Vn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Vn["Unified Canadian Aboriginal Syllabics"](t)||Vn["Unified Canadian Aboriginal Syllabics Extended"](t)||Vn["Vertical Forms"](t)||Vn["Yijing Hexagram Symbols"](t)||Vn["Yi Syllables"](t)||Vn["Yi Radicals"](t))))}function Zn(t){return!(Hn(t)||function(t){return!!(Vn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Vn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Vn["Letterlike Symbols"](t)||Vn["Number Forms"](t)||Vn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Vn["Control Pictures"](t)&&9251!==t||Vn["Optical Character Recognition"](t)||Vn["Enclosed Alphanumerics"](t)||Vn["Geometric Shapes"](t)||Vn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Vn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vn["CJK Symbols and Punctuation"](t)||Vn.Katakana(t)||Vn["Private Use Area"](t)||Vn["CJK Compatibility Forms"](t)||Vn["Small Form Variants"](t)||Vn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Gn(t){return t>=1424&&t<=2303||Vn["Arabic Presentation Forms-A"](t)||Vn["Arabic Presentation Forms-B"](t)}function Xn(t,e){return!(!e&&Gn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Vn.Khmer(t))}function Wn(t){for(var e=0,r=t;e-1&&(Kn="error"),Yn&&Yn(t)};function $n(){ti.fire(new Tt("pluginStateChange",{pluginStatus:Kn,pluginURL:Jn}))}var ti=new At,ei=function(){return Kn},ri=function(){if("deferred"!==Kn||!Jn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Kn="loading",$n(),Jn&&vt({url:Jn},(function(t){t?Qn(t):(Kn="loaded",$n())}))},ni={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===Kn||null!=ni.applyArabicShaping},isLoading:function(){return"loading"===Kn},setState:function(t){Kn=t.pluginStatus,Jn=t.pluginURL},isParsed:function(){return null!=ni.applyArabicShaping&&null!=ni.processBidirectionalText&&null!=ni.processStyledBidirectionalText},getPluginURL:function(){return Jn}},ii=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new jn,this.transition={})};ii.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var ai=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Dr(t))return new Xr(t,e);if(Vr(t)){var r=Gr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return"string"==typeof t&&"color"===e.type&&(n=Jt.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification)};ai.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},ai.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var oi=function(t){this.property=t,this.value=new ai(t,void 0)};oi.prototype.transitioned=function(t,e){return new li(this.property,this.value,e,c({},t.transition,this.transition),t.now)},oi.prototype.untransitioned=function(){return new li(this.property,this.value,null,{},0)};var si=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};si.prototype.getValue=function(t){return _(this._values[t].value.value)},si.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new oi(this._values[t].property)),this._values[t].value=new ai(this._values[t].property,null===e?void 0:_(e))},si.prototype.getTransition=function(t){return _(this._values[t].transition)},si.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new oi(this._values[t].property)),this._values[t].transition=_(e)||void 0},si.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);ethis.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}return i};var ui=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};ui.prototype.possiblyEvaluate=function(t,e,r){for(var n=new hi(this._properties),i=0,a=Object.keys(this._values);in.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(di),gi=function(t){this.specification=t};gi.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new ii(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ii(Math.floor(e.zoom),e)),t.expression.evaluate(new ii(Math.floor(e.zoom+1),e)),e)}},gi.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},gi.prototype.interpolate=function(t){return t};var yi=function(t){this.specification=t};yi.prototype.possiblyEvaluate=function(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)},yi.prototype.interpolate=function(){return!1};var vi=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new ai(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new oi(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};On("DataDrivenProperty",di),On("DataConstantProperty",fi),On("CrossFadedDataDrivenProperty",mi),On("CrossFadedProperty",gi),On("ColorRampProperty",yi);var _i=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=(e=e).metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new ci(r.layout)),r.paint)){for(var n in this._transitionablePaint=new si(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hi(r.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){void 0===r&&(r={}),null!=e&&this._validate(Cn,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return g(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(Sn,"layers."+this.id+".paint."+t,t,e,r))return!1;if(g(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],a=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||a||i||this._handleOverridablePaintPropertyUpdate(t,o,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),v(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&Ln(this,t.call(An,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Mt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof pi&&Er(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(At),xi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},bi=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},wi=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Ti(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map((function(t){var i=xi[t.type].BYTES_PER_ELEMENT,a=r=ki(r,Math.max(e,i)),o=t.components||1;return n=Math.max(n,i),r+=i*o,{name:t.name,type:t.type,components:o,offset:a}})),size:ki(r,Math.max(n,e)),alignment:e}}function ki(t,e){return Math.ceil(t/e)*e}wi.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},wi.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},wi.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},wi.prototype.clear=function(){this.length=0},wi.prototype.resize=function(t){this.reserve(t),this.length=t},wi.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},wi.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Ai=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(wi);Ai.prototype.bytesPerElement=4,On("StructArrayLayout2i4",Ai);var Mi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,t},e}(wi);Mi.prototype.bytesPerElement=8,On("StructArrayLayout4i8",Mi);var Si=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(wi);Si.prototype.bytesPerElement=12,On("StructArrayLayout2i4i12",Si);var Ci=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=a,this.uint8[l+7]=o,t},e}(wi);Ci.prototype.bytesPerElement=8,On("StructArrayLayout2i4ub8",Ci);var Li=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,u){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,a,o,s,l,u)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u,c){var p=9*t,h=18*t;return this.uint16[p+0]=e,this.uint16[p+1]=r,this.uint16[p+2]=n,this.uint16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=l,this.uint8[h+16]=u,this.uint8[h+17]=c,t},e}(wi);Li.prototype.bytesPerElement=18,On("StructArrayLayout8ui2ub18",Li);var Ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,u,c,p){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,a,o,s,l,u,c,p)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u,c,p,h){var f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=a,this.uint16[f+5]=o,this.uint16[f+6]=s,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=p,this.int16[f+11]=h,t},e}(wi);Ei.prototype.bytesPerElement=24,On("StructArrayLayout4i4ui4i24",Ei);var zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(wi);zi.prototype.bytesPerElement=12,On("StructArrayLayout3f12",zi);var Ii=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(wi);Ii.prototype.bytesPerElement=4,On("StructArrayLayout1ul4",Ii);var Pi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l){var u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,a,o,s,l)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u){var c=10*t,p=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=a,this.int16[c+5]=o,this.uint32[p+3]=s,this.uint16[c+8]=l,this.uint16[c+9]=u,t},e}(wi);Pi.prototype.bytesPerElement=20,On("StructArrayLayout6i1ul2ui20",Pi);var Di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(wi);Di.prototype.bytesPerElement=12,On("StructArrayLayout2i2i2i12",Di);var Oi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i)},e.prototype.emplace=function(t,e,r,n,i,a){var o=4*t,s=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[s+6]=i,this.int16[s+7]=a,t},e}(wi);Oi.prototype.bytesPerElement=16,On("StructArrayLayout2f1f2i16",Oi);var Ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=12*t,o=3*t;return this.uint8[a+0]=e,this.uint8[a+1]=r,this.float32[o+1]=n,this.float32[o+2]=i,t},e}(wi);Ri.prototype.bytesPerElement=12,On("StructArrayLayout2ub2f12",Ri);var Fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(wi);Fi.prototype.bytesPerElement=6,On("StructArrayLayout3ui6",Fi);var Bi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,g){var y=this.length;return this.resize(y+1),this.emplace(y,t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,g)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,g,y){var v=24*t,_=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=n,this.uint16[v+3]=i,this.uint32[_+2]=a,this.uint32[_+3]=o,this.uint32[_+4]=s,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=c,this.float32[_+7]=p,this.float32[_+8]=h,this.uint8[x+36]=f,this.uint8[x+37]=d,this.uint8[x+38]=m,this.uint32[_+10]=g,this.int16[v+22]=y,t},e}(wi);Bi.prototype.bytesPerElement=48,On("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Bi);var Ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,g,y,v,_,x,b,w,T,k,A,M,S){var C=this.length;return this.resize(C+1),this.emplace(C,t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,g,y,v,_,x,b,w,T,k,A,M,S)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,g,y,v,_,x,b,w,T,k,A,M,S,C){var L=34*t,E=17*t;return this.int16[L+0]=e,this.int16[L+1]=r,this.int16[L+2]=n,this.int16[L+3]=i,this.int16[L+4]=a,this.int16[L+5]=o,this.int16[L+6]=s,this.int16[L+7]=l,this.uint16[L+8]=u,this.uint16[L+9]=c,this.uint16[L+10]=p,this.uint16[L+11]=h,this.uint16[L+12]=f,this.uint16[L+13]=d,this.uint16[L+14]=m,this.uint16[L+15]=g,this.uint16[L+16]=y,this.uint16[L+17]=v,this.uint16[L+18]=_,this.uint16[L+19]=x,this.uint16[L+20]=b,this.uint16[L+21]=w,this.uint16[L+22]=T,this.uint32[E+12]=k,this.float32[E+13]=A,this.float32[E+14]=M,this.float32[E+15]=S,this.float32[E+16]=C,t},e}(wi);Ni.prototype.bytesPerElement=68,On("StructArrayLayout8i15ui1ul4f68",Ni);var Ui=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(wi);Ui.prototype.bytesPerElement=4,On("StructArrayLayout1f4",Ui);var ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(wi);ji.prototype.bytesPerElement=6,On("StructArrayLayout3i6",ji);var Vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t},e}(wi);Vi.prototype.bytesPerElement=8,On("StructArrayLayout1ul2ui8",Vi);var qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(wi);qi.prototype.bytesPerElement=4,On("StructArrayLayout2ui4",qi);var Hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(wi);Hi.prototype.bytesPerElement=2,On("StructArrayLayout1ui2",Hi);var Zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(wi);Zi.prototype.bytesPerElement=8,On("StructArrayLayout2f8",Zi);var Gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,t},e}(wi);Gi.prototype.bytesPerElement=16,On("StructArrayLayout4f16",Gi);var Xi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(bi);Xi.prototype.size=20;var Wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Xi(this,t)},e}(Pi);On("CollisionBoxArray",Wi);var Yi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(bi);Yi.prototype.size=48;var Ki=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Yi(this,t)},e}(Bi);On("PlacedSymbolArray",Ki);var Ji=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(bi);Ji.prototype.size=68;var Qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ji(this,t)},e}(Ni);On("SymbolInstanceArray",Qi);var $i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Ui);On("GlyphOffsetArray",$i);var ta=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(ji);On("SymbolLineVertexArray",ta);var ea=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(bi);ea.prototype.size=8;var ra=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new ea(this,t)},e}(Vi);On("FeatureIndexArray",ra);var na=Ti([{name:"a_pos",components:2,type:"Int16"}],4).members,ia=function(t){void 0===t&&(t=[]),this.segments=t};function aa(t,e){return 256*(t=l(Math.floor(t),0,255))+l(Math.floor(e),0,255)}ia.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>ia.MAX_VERTEX_ARRAY_LENGTH&&b("Max vertices per segment is "+ia.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>ia.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i},ia.prototype.get=function(){return this.segments},ia.prototype.destroy=function(){for(var t=0,e=this.segments;t>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),la=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,a=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&t.charCodeAt(a+2))<<16;case 2:i^=(255&t.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),ua=sa,ca=la;ua.murmur3=sa,ua.murmur2=ca;var pa=function(){this.ids=[],this.positions=[],this.indexed=!1};pa.prototype.add=function(t,e,r,n){this.ids.push(fa(t)),this.positions.push(e,r,n)},pa.prototype.getPositions=function(t){for(var e=fa(t),r=0,n=this.ids.length-1;r>1;this.ids[i]>=e?n=i:r=i+1}for(var a=[];this.ids[r]===e;)a.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return a},pa.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,i){for(;n>1],o=n-1,s=i+1;;){do{o++}while(e[o]a);if(o>=s)break;da(e,o,s),da(r,3*o,3*s),da(r,3*o+1,3*s+1),da(r,3*o+2,3*s+2)}s-nDa.max||o.yDa.max)&&(b("Geometry exceeds allowed extent, reduce your vector tile buffer size"),o.x=l(o.x,Da.min,Da.max),o.y=l(o.y,Da.min,Da.max))}return r}function Ra(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var Fa=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ai,this.indexArray=new Fi,this.segments=new ia,this.programConfigurations=new za(na,t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Ba(t,e){for(var r=0;r1){if(Va(t,e))return!0;for(var n=0;n1?r:r.sub(e)._mult(i)._add(e))}function Ga(t,e){for(var r,n,i,a=!1,o=0;oe.y!=(i=r[l]).y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);return a}function Xa(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}function Wa(t,e,r){var n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return!1;var a=w(t,e,r[0]);return a!==w(t,e,r[1])||a!==w(t,e,r[2])||a!==w(t,e,r[3])}function Ya(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ka(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ja(t,e,r,n,a){if(!e[0]&&!e[1])return t;var o=i.convert(e)._mult(a);"viewport"===r&&o._rotate(-n);for(var s=[],l=0;l=8192||c<0||c>=8192)){var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),h=p.vertexLength;Ra(this.layoutVertexArray,u,c,-1,-1),Ra(this.layoutVertexArray,u,c,1,-1),Ra(this.layoutVertexArray,u,c,1,1),Ra(this.layoutVertexArray,u,c,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),p.vertexLength+=4,p.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)},On("CircleBucket",Fa,{omit:["layers"]});var Qa=new vi({"circle-sort-key":new di(Mt.layout_circle["circle-sort-key"])}),$a={paint:new vi({"circle-radius":new di(Mt.paint_circle["circle-radius"]),"circle-color":new di(Mt.paint_circle["circle-color"]),"circle-blur":new di(Mt.paint_circle["circle-blur"]),"circle-opacity":new di(Mt.paint_circle["circle-opacity"]),"circle-translate":new fi(Mt.paint_circle["circle-translate"]),"circle-translate-anchor":new fi(Mt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new fi(Mt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new fi(Mt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new di(Mt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new di(Mt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new di(Mt.paint_circle["circle-stroke-opacity"])}),layout:Qa},to="undefined"!=typeof Float32Array?Float32Array:Array;function eo(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ro(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],m=e[12],g=e[13],y=e[14],v=e[15],_=r[0],x=r[1],b=r[2],w=r[3];return t[0]=_*n+x*s+b*p+w*m,t[1]=_*i+x*l+b*h+w*g,t[2]=_*a+x*u+b*f+w*y,t[3]=_*o+x*c+b*d+w*v,t[4]=(_=r[4])*n+(x=r[5])*s+(b=r[6])*p+(w=r[7])*m,t[5]=_*i+x*l+b*h+w*g,t[6]=_*a+x*u+b*f+w*y,t[7]=_*o+x*c+b*d+w*v,t[8]=(_=r[8])*n+(x=r[9])*s+(b=r[10])*p+(w=r[11])*m,t[9]=_*i+x*l+b*h+w*g,t[10]=_*a+x*u+b*f+w*y,t[11]=_*o+x*c+b*d+w*v,t[12]=(_=r[12])*n+(x=r[13])*s+(b=r[14])*p+(w=r[15])*m,t[13]=_*i+x*l+b*h+w*g,t[14]=_*a+x*u+b*f+w*y,t[15]=_*o+x*c+b*d+w*v,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var no,io=ro;function ao(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}no=new to(3),to!=Float32Array&&(no[0]=0,no[1]=0,no[2]=0),function(){var t=new to(4);to!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var oo=(function(){var t=new to(2);to!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,$a)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Fa(t)},e.prototype.queryRadius=function(t){var e=t;return Ya("circle-radius",this,e)+Ya("circle-stroke-width",this,e)+Ka(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,a,o,s){for(var l=Ja(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,o),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),p=c?l:function(t,e){return t.map((function(t){return so(t,e)}))}(l,s),h=c?u*o:u,f=0,d=n;ft.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,l=0;l80*r){n=a=t[0],i=o=t[1];for(var d=r;da&&(a=s),l>o&&(o=l);u=0!==(u=Math.max(a-n,o-i))?1/u:0}return Mo(h,f,r,n,i,u),f}function ko(t,e,r,n,i){var a,o;if(i===Wo(t,e,r,n)>0)for(a=e;a=e;a-=n)o=Zo(a,t[a],t[a+1],o);return o&&No(o,o.next)&&(Go(o),o=o.next),o}function Ao(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!No(n,n.next)&&0!==Bo(n.prev,n,n.next))n=n.next;else{if(Go(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function Mo(t,e,r,n,i,a,o){if(t){!o&&a&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Do(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,u=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1)}(i)}(t,n,i,a);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?Co(t,n,i,a):So(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),Go(t),t=l.next,u=l.next;else if((t=l)===u){o?1===o?Mo(t=Lo(Ao(t),e,r),e,r,n,i,a,2):2===o&&Eo(t,e,r,n,i,a):Mo(Ao(t),e,r,n,i,a,1);break}}}function So(t){var e=t.prev,r=t,n=t.next;if(Bo(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Ro(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Bo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Co(t,e,r,n){var i=t.prev,a=t,o=t.next;if(Bo(i,a,o)>=0)return!1;for(var s=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,l=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,u=Do(i.x=u&&h&&h.z<=c;){if(p!==t.prev&&p!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Bo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,h!==t.prev&&h!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Bo(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Bo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;h&&h.z<=c;){if(h!==t.prev&&h!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Bo(h.prev,h,h.next)>=0)return!1;h=h.nextZ}return!0}function Lo(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!No(i,a)&&Uo(i,n,n.next,a)&&qo(i,a)&&qo(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),Go(n),Go(n.next),n=t=a),n=n.next}while(n!==t);return Ao(n)}function Eo(t,e,r,n,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Fo(o,s)){var l=Ho(o,s);return o=Ao(o,o.next),l=Ao(l,l.next),Mo(o,e,r,n,i,a),void Mo(l,e,r,n,i,a)}s=s.next}o=o.next}while(o!==t)}function zo(t,e){return t.x-e.x}function Io(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&Ro(ar.x||n.x===r.x&&Po(r,n)))&&(r=n,h=l)),n=n.next}while(n!==u);return r}(t,e)){var r=Ho(e,t);Ao(e,e.next),Ao(r,r.next)}}function Po(t,e){return Bo(t.prev,t,e.prev)<0&&Bo(e.next,t,t.next)<0}function Do(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Oo(t){var e=t,r=t;do{(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function Fo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Uo(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(qo(t,e)&&qo(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Bo(t.prev,t,e.prev)||Bo(t,e.prev,e))||No(t,e)&&Bo(t.prev,t,t.next)>0&&Bo(e.prev,e,e.next)>0)}function Bo(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function No(t,e){return t.x===e.x&&t.y===e.y}function Uo(t,e,r,n){var i=Vo(Bo(t,e,r)),a=Vo(Bo(t,e,n)),o=Vo(Bo(r,n,t)),s=Vo(Bo(r,n,e));return i!==a&&o!==s||!(0!==i||!jo(t,r,e))||!(0!==a||!jo(t,n,e))||!(0!==o||!jo(r,t,n))||!(0!==s||!jo(r,e,n))}function jo(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Vo(t){return t>0?1:t<0?-1:0}function qo(t,e){return Bo(t.prev,t,t.next)<0?Bo(t,e,t.next)>=0&&Bo(t,t.prev,e)>=0:Bo(t,e,t.prev)<0||Bo(t,t.next,e)<0}function Ho(t,e){var r=new Xo(t.i,t.x,t.y),n=new Xo(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function Zo(t,e,r,n){var i=new Xo(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Go(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Xo(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Wo(t,e,r,n){for(var i=0,a=e,o=r-n;an;){if(i-n>600){var o=i-n+1,s=r-n+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(s-o/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*u/o+c)),Math.min(i,Math.floor(r+(o-s)*u/o+c)),a)}var p=e[r],h=n,f=i;for(Ko(e,n,r),a(e[i],p)>0&&Ko(e,n,i);h0;)f--}0===a(e[n],p)?Ko(e,n,f):Ko(e,++f,i),f<=r&&(n=f+1),r<=f&&(i=f-1)}}(t,e,r||0,n||t.length-1,i||Jo)}function Ko(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Jo(t,e){return te?1:0}function Qo(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,a=[],o=0;o1)for(var l=0;l0&&r.holes.push(n+=t[i-1].length)}return r},bo.default=wo;var rs=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ai,this.indexArray=new Fi,this.indexArray2=new qi,this.programConfigurations=new za(xo,t.layers,t.zoom),this.segments=new ia,this.segments2=new ia,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};rs.prototype.populate=function(t,e,r){this.hasPattern=ts("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),i=[],a=0,o=t;a>3}if(a--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&l.push(e),e=[]),e.push(new i(o,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&l.push(e),l},ls.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,a=0,o=1/0,s=-1/0,l=1/0,u=-1/0;t.pos>3}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(a+=t.readSVarint())u&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},ls.prototype.toGeoJSON=function(t,e,r){var n,i,a=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=ls.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function ds(t,e,r){if(3===t){var n=new ps(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}hs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ss(this._pbf,e,this.extent,this._keys,this._values)};var ms={VectorTile:function(t,e){this.layers=t.readFields(ds,{},e)},VectorTileFeature:ss,VectorTileLayer:ps},gs=ms.VectorTileFeature.types,ys=Math.pow(2,13);function vs(t,e,r,n,i,a,o,s){t.emplaceBack(e,r,2*Math.floor(n*ys)+o,i*ys*2,a*ys*2,Math.round(s))}var _s=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Si,this.indexArray=new Fi,this.programConfigurations=new za(os,t.layers,t.zoom),this.segments=new ia,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function xs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}_s.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=ts("fill-extrusion",this.layers,e);for(var n=0,i=t;n8192}))||I.every((function(t){return t.y<0}))||I.every((function(t){return t.y>8192}))))for(var m=0,g=0;g=1){var v=d[g-1];if(!xs(y,v)){p.vertexLength+4>ia.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var _=y.sub(v)._perp()._unit(),x=v.dist(y);m+x>32768&&(m=0),vs(this.layoutVertexArray,y.x,y.y,_.x,_.y,0,0,m),vs(this.layoutVertexArray,y.x,y.y,_.x,_.y,0,1,m),vs(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,0,m+=x),vs(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,1,m);var b=p.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),p.vertexLength+=4,p.primitiveLength+=2}}}}if(p.vertexLength+l>ia.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),"Polygon"===gs[t.type]){for(var w=[],T=[],k=p.vertexLength,A=0,M=s;A=2&&t[l-1].equals(t[l-2]);)l--;for(var u=0;u0;if(T&&y>u){var A=c.dist(f);if(A>2*p){var M=c.sub(c.sub(f)._mult(p/A)._round());this.updateDistance(f,M),this.addCurrentVertex(M,m,0,0,h),f=M}}var S=f&&d,C=S?r:s?"butt":n;if(S&&"round"===C&&(bi&&(C="bevel"),"bevel"===C&&(b>2&&(C="flipbevel"),b100)v=g.mult(-1);else{var L=b*m.add(g).mag()/m.sub(g).mag();v._perp()._mult(L*(k?-1:1))}this.addCurrentVertex(c,v,0,0,h),this.addCurrentVertex(c,v.mult(-1),0,0,h)}else if("bevel"===C||"fakeround"===C){var E=-Math.sqrt(b*b-1),z=k?E:0,I=k?0:E;if(f&&this.addCurrentVertex(c,m,z,I,h),"fakeround"===C)for(var P=Math.round(180*w/Math.PI/20),D=1;D2*p){var U=c.add(d.sub(c)._mult(p/N)._round());this.updateDistance(c,U),this.addCurrentVertex(U,g,0,0,h),c=U}}}}},Ls.prototype.addCurrentVertex=function(t,e,r,n,i,a){void 0===a&&(a=!1);var o=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,a,!1,r,i),this.addHalfVertex(t,o,s,a,!0,-n,i),this.distance>Cs/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,a))},Ls.prototype.addHalfVertex=function(t,e,r,n,i,a,o){var s=.5*this.scaledDistance;this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&s)<<2,s>>6);var l=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),o.primitiveLength++),i?this.e2=l:this.e1=l},Ls.prototype.updateScaledDistance=function(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(Cs-1):this.distance},Ls.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},On("LineBucket",Ls,{omit:["layers","patternFeatures"]});var Es=new vi({"line-cap":new fi(Mt.layout_line["line-cap"]),"line-join":new di(Mt.layout_line["line-join"]),"line-miter-limit":new fi(Mt.layout_line["line-miter-limit"]),"line-round-limit":new fi(Mt.layout_line["line-round-limit"]),"line-sort-key":new di(Mt.layout_line["line-sort-key"])}),zs={paint:new vi({"line-opacity":new di(Mt.paint_line["line-opacity"]),"line-color":new di(Mt.paint_line["line-color"]),"line-translate":new fi(Mt.paint_line["line-translate"]),"line-translate-anchor":new fi(Mt.paint_line["line-translate-anchor"]),"line-width":new di(Mt.paint_line["line-width"]),"line-gap-width":new di(Mt.paint_line["line-gap-width"]),"line-offset":new di(Mt.paint_line["line-offset"]),"line-blur":new di(Mt.paint_line["line-blur"]),"line-dasharray":new gi(Mt.paint_line["line-dasharray"]),"line-pattern":new mi(Mt.paint_line["line-pattern"]),"line-gradient":new yi(Mt.paint_line["line-gradient"])}),layout:Es},Is=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new ii(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=c({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(di))(zs.paint.properties["line-width"].specification);Is.useIntegerZoom=!0;var Ps=function(t){function e(e){t.call(this,e,zs)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){this.gradient=go(this._transitionablePaint._values["line-gradient"].value.expression,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=Is.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Ls(t)},e.prototype.queryRadius=function(t){var e=t,r=Ds(Ya("line-width",this,e),Ya("line-gap-width",this,e)),n=Ya("line-offset",this,e);return r/2+Math.abs(n)+Ka(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,a,o,s){var l=Ja(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),u=s/2*Ds(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),c=this.paint.get("line-offset").evaluate(e,r);return c&&(n=function(t,e){for(var r=[],n=new i(0,0),a=0;a=3)for(var a=0;a0?e+2*t:t}var Os=Ti([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Rs=Ti([{name:"a_projected_pos",components:3,type:"Float32"}],4),Fs=(Ti([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Ti([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Bs=(Ti([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ti([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Ns=Ti([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Us(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),ni.applyArabicShaping&&(t=ni.applyArabicShaping(t)),t}(t.text,e,r)})),t}Ti([{name:"triangle",components:3,type:"Uint16"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ti([{type:"Float32",name:"offsetX"}]),Ti([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var js={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"},Vs=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,p=r?i-1:0,h=r?-1:1,f=t[e+p];for(p+=h,a=f&(1<<-c)-1,f>>=-c,c+=s;c>0;a=256*a+t[e+p],p+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+p],p+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),a-=u}return(f?-1:1)*o*Math.pow(2,a-n)},qs=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,f=n?0:a-1,d=n?1:-1,m=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+p>=1?h/l:h*Math.pow(2,1-p))*l>=2&&(o++,l/=2),o+p>=c?(s=0,o=c):o+p>=1?(s=(e*l-1)*Math.pow(2,i),o+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(o=o<0;t[r+f]=255&o,f+=d,o/=256,u-=8);t[r+f-d]|=128*m},Hs=Zs;function Zs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Zs.Varint=0,Zs.Fixed64=1,Zs.Bytes=2,Zs.Fixed32=5;var Gs="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Xs(t){return t.type===Zs.Bytes?t.readVarint()+t.pos:t.pos+1}function Ws(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ys(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Ks(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function sl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ll(t,e,r){1===t&&r.readMessage(ul,e)}function ul(t,e,r){if(3===t){var n=r.readMessage(cl,{}),i=n.width,a=n.height,o=n.left,s=n.top,l=n.advance;e.push({id:n.id,bitmap:new ho({width:i+6,height:a+6},n.bitmap),metrics:{width:i,height:a,left:o,top:s,advance:l}})}}function cl(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function pl(t){for(var e=0,r=0,n=0,i=t;n=0;h--){var f=o[h];if(!(p.w>f.w||p.h>f.h)){if(p.x=f.x,p.y=f.y,l=Math.max(l,p.y+p.h),s=Math.max(s,p.x+p.w),p.w===f.w&&p.h===f.h){var d=o.pop();h>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=al(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=sl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=al(this.buf,this.pos)+4294967296*al(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=al(this.buf,this.pos)+4294967296*sl(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Vs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Vs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,a=r.buf;if(n=(112&(i=a[r.pos++]))>>4,i<128)return Ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<3,i<128)return Ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<10,i<128)return Ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<17,i<128)return Ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<24,i<128)return Ws(t,n,e);if(n|=(1&(i=a[r.pos++]))<<31,i<128)return Ws(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Gs?function(t,e,r){return Gs.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(a=t[i+1]))&&(u=(31&l)<<6|63&a)<=127&&(u=null):3===c?(o=t[i+2],128==(192&(a=t[i+1]))&&128==(192&o)&&((u=(15&l)<<12|(63&a)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=t[i+2],s=t[i+3],128==(192&(a=t[i+1]))&&128==(192&o)&&128==(192&s)&&((u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Zs.Bytes)return t.push(this.readVarint(e));var r=Xs(this);for(t=t||[];this.pos127;);else if(e===Zs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Zs.Fixed32)this.pos+=4;else{if(e!==Zs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Ys(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),qs(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),qs(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Ys(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Zs.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ks,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Js,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Qs,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,$s,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,il,e)},writeBytesField:function(t,e){this.writeTag(t,Zs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Zs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Zs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Zs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var hl=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,a=e.stretchY,o=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=a,this.content=o,this.version=n},fl={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};fl.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},fl.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},fl.tlbr.get=function(){return this.tl.concat(this.br)},fl.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(hl.prototype,fl);var dl=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var a=pl(i),o=new fo({width:a.w||1,height:a.h||1});for(var s in t){var l=t[s],u=r[s].paddedRect;fo.copy(l.data,o,{x:0,y:0},{x:u.x+1,y:u.y+1},l.data)}for(var c in e){var p=e[c],h=n[c].paddedRect,f=h.x+1,d=h.y+1,m=p.data.width,g=p.data.height;fo.copy(p.data,o,{x:0,y:0},{x:f,y:d},p.data),fo.copy(p.data,o,{x:0,y:g-1},{x:f,y:d-1},{width:m,height:1}),fo.copy(p.data,o,{x:0,y:0},{x:f,y:d+g},{width:m,height:1}),fo.copy(p.data,o,{x:m-1,y:0},{x:f-1,y:d},{width:1,height:g}),fo.copy(p.data,o,{x:0,y:0},{x:f+m,y:d},{width:1,height:g})}this.image=o,this.iconPositions=r,this.patternPositions=n};dl.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(a),e[n]=new hl(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},dl.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},dl.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]})}},On("ImagePosition",hl),On("ImageAtlas",dl);var ml={horizontal:1,vertical:2,horizontalOnly:3},gl=function(){this.scale=1,this.fontStack="",this.imageName=null};gl.forText=function(t,e){var r=new gl;return r.scale=t||1,r.fontStack=e,r},gl.forImage=function(t){var e=new gl;return e.imageName=t,e};var yl=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function vl(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m){var g,y=yl.fromFeature(t,i);p===ml.vertical&&y.verticalizePunctuation();var v=ni.processBidirectionalText,_=ni.processStyledBidirectionalText;if(v&&1===y.sections.length){g=[];for(var x=0,b=v(y.toString(),Al(y,u,a,e,n,f,d));x0&&B>A&&(A=B)}else{var N=r[S.fontStack],U=N&&N[L];if(U&&U.rect)I=U.rect,z=U.metrics;else{var j=e[S.fontStack],V=j&&j[L];if(!V)continue;z=V.metrics}E=24*(b-S.scale)}O?(t.verticalizable=!0,k.push({glyph:L,imageName:P,x:h,y:f+E,vertical:O,scale:S.scale,fontStack:S.fontStack,sectionIndex:C,metrics:z,rect:I}),h+=D*S.scale+u):(k.push({glyph:L,imageName:P,x:h,y:f+E,vertical:O,scale:S.scale,fontStack:S.fontStack,sectionIndex:C,metrics:z,rect:I}),h+=z.advance*S.scale+u)}0!==k.length&&(d=Math.max(h-u,d),Sl(k,0,k.length-1,g,A)),h=0;var q=a*b+A;T.lineOffset=Math.max(A,w),f+=q,m=Math.max(q,m),++y}else f+=a,++y}var H,Z=f- -17,G=Ml(o),X=G.horizontalAlign,W=G.verticalAlign;(function(t,e,r,n,i,a,o,s,l){var u,c=(e-r)*i;u=a!==o?-s*n- -17:(-n*l+.5)*o;for(var p=0,h=t;p=0&&n>=t&&_l[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},yl.prototype.substring=function(t,e){var r=new yl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},yl.prototype.toString=function(){return this.text},yl.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},yl.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(gl.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var _l={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},xl={};function bl(t,e,r,n,i,a){if(e.imageName){var o=n[e.imageName];return o?o.displaySize[0]*e.scale*24/a+i:0}var s=r[e.fontStack],l=s&&s[t];return l?l.metrics.advance*e.scale+i:0}function wl(t,e,r,n){var i=Math.pow(t-e,2);return n?t=0,p=0,h=0;h-r/2;){if(--o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],u=0;sn;)u-=l.shift().angleDelta;if(u>i)return!1;o++,s+=c.dist(p)}return!0}function Ol(t){for(var e=0,r=0;ru){var d=(u-l)/f,m=je(p.x,h.x,d),g=je(p.y,h.y,d),y=new Ll(m,g,h.angleTo(p),c);return y._round(),!o||Dl(t,y,s,o,e)?y:void 0}l+=f}}function Nl(t,e,r,n,i,a,o,s,l){var u=Rl(n,a,o),c=Fl(n,i),p=c*o,h=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-p=0&&b=0&&w=0&&f+c<=p){var T=new Ll(b,w,_,m);T._round(),i&&!Dl(e,T,o,i,a)||d.push(T)}}h+=v}return l||d.length||s||(d=t(e,h/2,n,i,a,o,s,!0,u)),d}(t,h?e/2*s%e:(c/2+2*a)*o*s%e,e,u,r,p,h,!1,l)}function Ul(t,e,r,n,a){for(var o=[],s=0;s=n&&h.x>=n||(p.x>=n?p=new i(n,p.y+(n-p.x)/(h.x-p.x)*(h.y-p.y))._round():h.x>=n&&(h=new i(n,p.y+(n-p.x)/(h.x-p.x)*(h.y-p.y))._round()),p.y>=a&&h.y>=a||(p.y>=a?p=new i(p.x+(a-p.y)/(h.y-p.y)*(h.x-p.x),a)._round():h.y>=a&&(h=new i(p.x+(a-p.y)/(h.y-p.y)*(h.x-p.x),a)._round()),u&&p.equals(u[u.length-1])||o.push(u=[p]),u.push(h)))))}return o}function jl(t,e,r,n){var a=[],o=t.image,s=o.pixelRatio,l=o.paddedRect.w-2,u=o.paddedRect.h-2,c=t.right-t.left,p=t.bottom-t.top,h=o.stretchX||[[0,l]],f=o.stretchY||[[0,u]],d=function(t,e){return t+e[1]-e[0]},m=h.reduce(d,0),g=f.reduce(d,0),y=l-m,v=u-g,_=0,x=m,b=0,w=g,T=0,k=y,A=0,M=v;if(o.content&&n){var S=o.content;_=Vl(h,0,S[0]),b=Vl(f,0,S[1]),x=Vl(h,S[0],S[2]),w=Vl(f,S[1],S[3]),T=S[0]-_,A=S[1]-b,k=S[2]-S[0]-x,M=S[3]-S[1]-w}var C=function(n,a,l,u){var h=Hl(n.stretch-_,x,c,t.left),f=Zl(n.fixed-T,k,n.stretch,m),d=Hl(a.stretch-b,w,p,t.top),y=Zl(a.fixed-A,M,a.stretch,g),v=Hl(l.stretch-_,x,c,t.left),S=Zl(l.fixed-T,k,l.stretch,m),C=Hl(u.stretch-b,w,p,t.top),L=Zl(u.fixed-A,M,u.stretch,g),E=new i(h,d),z=new i(v,d),I=new i(v,C),P=new i(h,C),D=new i(f/s,y/s),O=new i(S/s,L/s),R=e*Math.PI/180;if(R){var F=Math.sin(R),B=Math.cos(R),N=[B,-F,F,B];E._matMult(N),z._matMult(N),P._matMult(N),I._matMult(N)}var U=n.stretch+n.fixed,j=a.stretch+a.fixed;return{tl:E,tr:z,bl:P,br:I,tex:{x:o.paddedRect.x+1+U,y:o.paddedRect.y+1+j,w:l.stretch+l.fixed-U,h:u.stretch+u.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:O,minFontScaleX:k/s/c,minFontScaleY:M/s/p,isSDF:r}};if(n&&(o.stretchX||o.stretchY))for(var L=ql(h,y,m),E=ql(f,v,g),z=0;z0&&(d=Math.max(10,d),this.circleDiameter=d)}else{var m=o.top*s-l,g=o.bottom*s+l,y=o.left*s-l,v=o.right*s+l,_=o.collisionPadding;if(_&&(y-=_[0]*s,m-=_[1]*s,v+=_[2]*s,g+=_[3]*s),c){var x=new i(y,m),b=new i(v,m),w=new i(y,g),T=new i(v,g),k=c*Math.PI/180;x._rotate(k),b._rotate(k),w._rotate(k),T._rotate(k),y=Math.min(x.x,b.x,w.x,T.x),v=Math.max(x.x,b.x,w.x,T.x),m=Math.min(x.y,b.y,w.y,T.y),g=Math.max(x.y,b.y,w.y,T.y)}t.emplaceBack(e.x,e.y,y,m,v,g,r,n,a)}this.boxEndIndex=t.length},Xl=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=Wl),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function Wl(t,e){return te?1:0}function Yl(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,a=1/0,o=-1/0,s=-1/0,l=t[0],u=0;uo)&&(o=c.x),(!u||c.y>s)&&(s=c.y)}var p=Math.min(o-n,s-a),h=p/2,f=new Xl([],Kl);if(0===p)return new i(n,a);for(var d=n;dg.d||!g.d)&&(g=v,r&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,y)),v.max-g.d<=e||(f.push(new Jl(v.p.x-(h=v.h/2),v.p.y-h,h,t)),f.push(new Jl(v.p.x+h,v.p.y-h,h,t)),f.push(new Jl(v.p.x-h,v.p.y+h,h,t)),f.push(new Jl(v.p.x+h,v.p.y+h,h,t)),y+=4)}return r&&(console.log("num probes: "+y),console.log("best distance: "+g.d)),g.p}function Kl(t,e){return e.max-t.max}function Jl(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,Za(t,u,c))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}Xl.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},Xl.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},Xl.prototype.peek=function(){return this.data[0]},Xl.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i}e[t]=n},Xl.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=o,t=a}e[t]=i};var Ql=Number.POSITIVE_INFINITY;function $l(t,e){return e[1]!==Ql?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function tu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eu(t,e,r,n,a,o,s,l,u,c,p,h,f,d,m){var g=function(t,e,r,n,a,o,s,l){for(var u=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,c=[],p=0,h=e.positionedLines;p32640&&b(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===y.kind&&((v=[128*d.compositeTextSizes[0].evaluate(s,{},m),128*d.compositeTextSizes[1].evaluate(s,{},m)])[0]>32640||v[1]>32640)&&b(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,g,v,l,o,s,c,e,u.lineStartIndex,u.lineLength,f,m);for(var _=0,x=p;_=0;o--)if(n.dist(a[o])0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],l||u){for(var p=e.iconDependencies,h=e.glyphDependencies,f=e.availableImages,d=new ii(this.zoom),m=0,g=t;m=0;for(var P=0,D=k.sections;P=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var l=0;l0},pu.prototype.hasIconData=function(){return this.icon.segments.get().length>0},pu.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},pu.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},pu.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},pu.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},On("SymbolBucket",pu,{omit:["layers","collisionBoxArray","features","compareText"]}),pu.MAX_GLYPHS=65535,pu.addDynamicAttributes=su;var hu=new vi({"symbol-placement":new fi(Mt.layout_symbol["symbol-placement"]),"symbol-spacing":new fi(Mt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new fi(Mt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new di(Mt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new fi(Mt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new fi(Mt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new fi(Mt.layout_symbol["icon-ignore-placement"]),"icon-optional":new fi(Mt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new fi(Mt.layout_symbol["icon-rotation-alignment"]),"icon-size":new di(Mt.layout_symbol["icon-size"]),"icon-text-fit":new fi(Mt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new fi(Mt.layout_symbol["icon-text-fit-padding"]),"icon-image":new di(Mt.layout_symbol["icon-image"]),"icon-rotate":new di(Mt.layout_symbol["icon-rotate"]),"icon-padding":new fi(Mt.layout_symbol["icon-padding"]),"icon-keep-upright":new fi(Mt.layout_symbol["icon-keep-upright"]),"icon-offset":new di(Mt.layout_symbol["icon-offset"]),"icon-anchor":new di(Mt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new fi(Mt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new fi(Mt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new fi(Mt.layout_symbol["text-rotation-alignment"]),"text-field":new di(Mt.layout_symbol["text-field"]),"text-font":new di(Mt.layout_symbol["text-font"]),"text-size":new di(Mt.layout_symbol["text-size"]),"text-max-width":new di(Mt.layout_symbol["text-max-width"]),"text-line-height":new fi(Mt.layout_symbol["text-line-height"]),"text-letter-spacing":new di(Mt.layout_symbol["text-letter-spacing"]),"text-justify":new di(Mt.layout_symbol["text-justify"]),"text-radial-offset":new di(Mt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new fi(Mt.layout_symbol["text-variable-anchor"]),"text-anchor":new di(Mt.layout_symbol["text-anchor"]),"text-max-angle":new fi(Mt.layout_symbol["text-max-angle"]),"text-writing-mode":new fi(Mt.layout_symbol["text-writing-mode"]),"text-rotate":new di(Mt.layout_symbol["text-rotate"]),"text-padding":new fi(Mt.layout_symbol["text-padding"]),"text-keep-upright":new fi(Mt.layout_symbol["text-keep-upright"]),"text-transform":new di(Mt.layout_symbol["text-transform"]),"text-offset":new di(Mt.layout_symbol["text-offset"]),"text-allow-overlap":new fi(Mt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new fi(Mt.layout_symbol["text-ignore-placement"]),"text-optional":new fi(Mt.layout_symbol["text-optional"])}),fu={paint:new vi({"icon-opacity":new di(Mt.paint_symbol["icon-opacity"]),"icon-color":new di(Mt.paint_symbol["icon-color"]),"icon-halo-color":new di(Mt.paint_symbol["icon-halo-color"]),"icon-halo-width":new di(Mt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new di(Mt.paint_symbol["icon-halo-blur"]),"icon-translate":new fi(Mt.paint_symbol["icon-translate"]),"icon-translate-anchor":new fi(Mt.paint_symbol["icon-translate-anchor"]),"text-opacity":new di(Mt.paint_symbol["text-opacity"]),"text-color":new di(Mt.paint_symbol["text-color"],{runtimeType:Bt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new di(Mt.paint_symbol["text-halo-color"]),"text-halo-width":new di(Mt.paint_symbol["text-halo-width"]),"text-halo-blur":new di(Mt.paint_symbol["text-halo-blur"]),"text-translate":new fi(Mt.paint_symbol["text-translate"]),"text-translate-anchor":new fi(Mt.paint_symbol["text-translate-anchor"])}),layout:hu},du=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Dt,this.defaultValue=t};du.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},du.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},du.prototype.outputDefined=function(){return!1},du.prototype.serialize=function(){return null},On("FormatSectionOverride",du,{omit:["defaultValue"]});var mu=function(t){function e(e){t.call(this,e,fu)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],a=0,o=n;a",targetMapId:n,sourceMapId:a.mapId})}}},Lu.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else k()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},Lu.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Lu.prototype.processTask=function(t,e){var r=this;if(""===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(Un(e.error)):n(null,Un(e.data)))}else{var i=!1,a=S(this.globalScope)?void 0:[],o=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"",sourceMapId:r.mapId,error:e?Nn(e):null,data:Nn(n,a)},a)}:function(t){i=!0},s=null,l=Un(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,l,o);else if(this.parent.getWorkerSource){var u=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,u[0],l.source)[u[1]](l,o)}else o(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Lu.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var zu=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};zu.prototype.setNorthEast=function(t){return this._ne=t instanceof Iu?new Iu(t.lng,t.lat):Iu.convert(t),this},zu.prototype.setSouthWest=function(t){return this._sw=t instanceof Iu?new Iu(t.lng,t.lat):Iu.convert(t),this},zu.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof Iu)e=t,r=t;else{if(!(t instanceof zu))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(zu.convert(t)):this.extend(Iu.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Iu(e.lng,e.lat),this._ne=new Iu(r.lng,r.lat)),this},zu.prototype.getCenter=function(){return new Iu((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},zu.prototype.getSouthWest=function(){return this._sw},zu.prototype.getNorthEast=function(){return this._ne},zu.prototype.getNorthWest=function(){return new Iu(this.getWest(),this.getNorth())},zu.prototype.getSouthEast=function(){return new Iu(this.getEast(),this.getSouth())},zu.prototype.getWest=function(){return this._sw.lng},zu.prototype.getSouth=function(){return this._sw.lat},zu.prototype.getEast=function(){return this._ne.lng},zu.prototype.getNorth=function(){return this._ne.lat},zu.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},zu.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},zu.prototype.isEmpty=function(){return!(this._sw&&this._ne)},zu.prototype.contains=function(t){var e=Iu.convert(t),r=e.lng,n=e.lat,i=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i},zu.convert=function(t){return!t||t instanceof zu?t:new zu(t)};var Iu=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Iu.prototype.wrap=function(){return new Iu(u(this.lng,-180,180),this.lat)},Iu.prototype.toArray=function(){return[this.lng,this.lat]},Iu.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Iu.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(i,1))},Iu.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new zu(new Iu(this.lng-r,this.lat-e),new Iu(this.lng+r,this.lat+e))},Iu.convert=function(t){if(t instanceof Iu)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Iu(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Iu(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var Pu=2*Math.PI*6371008.8;function Du(t){return Pu*Math.cos(t*Math.PI/180)}function Ou(t){return(180+t)/360}function Ru(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Fu(t,e){return t/Du(e)}function Bu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Nu=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};Nu.fromLngLat=function(t,e){void 0===e&&(e=0);var r=Iu.convert(t);return new Nu(Ou(r.lng),Ru(r.lat),Fu(e,r.lat))},Nu.prototype.toLngLat=function(){return new Iu(360*this.x-180,Bu(this.y))},Nu.prototype.toAltitude=function(){return this.z*Du(Bu(this.y))},Nu.prototype.meterInMercatorCoordinateUnits=function(){return 1/Pu*(t=Bu(this.y),1/Math.cos(t*Math.PI/180));var t};var Uu=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=qu(0,t,t,e,r)};Uu.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Uu.prototype.url=function(t,e){var r,n,i,a,o,s=(n=this.y,i=this.z,a=Eu(256*(r=this.x),256*(n=Math.pow(2,i)-n-1),i),o=Eu(256*(r+1),256*(n+1),i),a[0]+","+a[1]+","+o[0]+","+o[1]),l=function(t,e,r){for(var n,i="",a=t;a>0;a--)i+=(e&(n=1<this.canonical.z?new Vu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Vu.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?qu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):qu(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Vu.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Vu.prototype.children=function(t){if(this.overscaledZ>=t)return[new Vu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Vu(e,this.wrap,e,r,n),new Vu(e,this.wrap,e,r+1,n),new Vu(e,this.wrap,e,r,n+1),new Vu(e,this.wrap,e,r+1,n+1)]},Vu.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Hu.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Hu.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Hu.prototype.getPixels=function(){return new fo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Hu.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,a=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:a=o-1;break;case 1:o=a+1}for(var s=-e*this.dim,l=-r*this.dim,u=a;u=0&&c[3]>=0&&s.insert(o,c[0],c[1],c[2],c[3])}},Yu.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new ms.VectorTile(new Hs(this.rawTileData)).layers,this.sourceLayerCoder=new Zu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Yu.prototype.query=function(t,e,r,n){var a=this;this.loadVTLayers();for(var o=t.params||{},s=8192/t.tileSize/t.scale,l=rn(o.filter),u=t.queryGeometry,c=t.queryPadding*s,p=Ju(u),h=this.grid.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c),f=Ju(t.cameraQueryGeometry),d=0,m=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(function(e,r,n,a){return function(t,e,r,n,a){for(var o=0,s=t;o=l.x&&a>=l.y)return!0}var u=[new i(e,r),new i(e,a),new i(n,a),new i(n,r)];if(t.length>2)for(var c=0,p=u;c=0)return!0;return!1}(a,p)){var h=this.sourceLayerCoder.decode(r),f=this.vtLayers[h].feature(n);if(i.filter(new ii(this.tileID.overscaledZ),f))for(var d=this.getId(f,h),m=0;mn)i=!1;else if(e)if(this.expirationTimeot&&(t.getActor().send("enforceCacheSizeLimit",at),ct=0)},t.clamp=l,t.clearTileCache=function(t){var e=self.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=Ul,t.clone=function(t){var e=new to(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=_,t.clone$2=function(t){var e=new to(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Ns,t.config=F,t.create=function(){var t=new to(16);return to!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new to(9);return to!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new to(4);return to!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=qr,t.createLayout=Ti,t.createStyleLayer=function(t){return"custom"===t.type?new xu(t):new bu[t.type](t)},t.cross=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},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t},t.number=je,t.offscreenCanvasSupported=pt,t.ortho=function(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),u=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(o+a)*u,t[15]=1,t},t.parseGlyphPBF=function(t){return new Hs(t).readFields(ll,[])},t.pbf=Hs,t.performSymbolLayout=function(t,e,r,n,i,a,o){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,l=t.layers[0]._unevaluatedLayout._values,u={};if("composite"===t.textSizeData.kind){var c=t.textSizeData,p=c.maxZoom;u.compositeTextSizes=[l["text-size"].possiblyEvaluate(new ii(c.minZoom),o),l["text-size"].possiblyEvaluate(new ii(p),o)]}if("composite"===t.iconSizeData.kind){var h=t.iconSizeData,f=h.maxZoom;u.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new ii(h.minZoom),o),l["icon-size"].possiblyEvaluate(new ii(f),o)]}u.layoutTextSize=l["text-size"].possiblyEvaluate(new ii(t.zoom+1),o),u.layoutIconSize=l["icon-size"].possiblyEvaluate(new ii(t.zoom+1),o),u.textMaxSize=l["text-size"].possiblyEvaluate(new ii(18));for(var d=24*s.get("text-line-height"),m="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),g=s.get("text-keep-upright"),y=s.get("text-size"),v=function(){var a=x[_],l=s.get("text-font").evaluate(a,{},o).join(","),c=y.evaluate(a,{},o),p=u.layoutTextSize.evaluate(a,{},o),h=u.layoutIconSize.evaluate(a,{},o),f={horizontal:{},vertical:void 0},v=a.text,w=[0,0];if(v){var T=v.toString(),k=24*s.get("text-letter-spacing").evaluate(a,{},o),A=function(t){for(var e=0,r=t;e=8192||p.y<0||p.y>=8192||function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,g,y,v,_,x,w,T,k,A){var M,S,C,L,E,z=t.addToLineVertexArray(e,r),I=0,P=0,D=0,O=0,R=-1,F=-1,B={},N=ua(""),U=0,j=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(U=(M=s.layout.get("text-offset").evaluate(x,{},k).map((function(t){return 24*t})))[0],j=M[1]):(U=24*s.layout.get("text-radial-offset").evaluate(x,{},k),j=Ql),t.allowVerticalPlacement&&n.vertical){var V=s.layout.get("text-rotate").evaluate(x,{},k)+90;L=new Gl(l,e,u,c,p,n.vertical,h,f,d,V),o&&(E=new Gl(l,e,u,c,p,o,g,y,d,V))}if(i){var q=s.layout.get("icon-rotate").evaluate(x,{}),H="none"!==s.layout.get("icon-text-fit"),Z=jl(i,q,T,H),G=o?jl(o,q,T,H):void 0;C=new Gl(l,e,u,c,p,i,g,y,!1,q),I=4*Z.length;var X=t.iconSizeData,W=null;"source"===X.kind?(W=[128*s.layout.get("icon-size").evaluate(x,{})])[0]>32640&&b(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===X.kind&&((W=[128*w.compositeIconSizes[0].evaluate(x,{},k),128*w.compositeIconSizes[1].evaluate(x,{},k)])[0]>32640||W[1]>32640)&&b(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,Z,W,_,v,x,!1,e,z.lineStartIndex,z.lineLength,-1,k),R=t.icon.placedSymbolArray.length-1,G&&(P=4*G.length,t.addSymbols(t.icon,G,W,_,v,x,ml.vertical,e,z.lineStartIndex,z.lineLength,-1,k),F=t.icon.placedSymbolArray.length-1)}for(var Y in n.horizontal){var K=n.horizontal[Y];if(!S){N=ua(K.text);var J=s.layout.get("text-rotate").evaluate(x,{},k);S=new Gl(l,e,u,c,p,K,h,f,d,J)}var Q=1===K.positionedLines.length;if(D+=eu(t,e,K,a,s,d,x,m,z,n.vertical?ml.horizontal:ml.horizontalOnly,Q?Object.keys(n.horizontal):[Y],B,R,w,k),Q)break}n.vertical&&(O+=eu(t,e,n.vertical,a,s,d,x,m,z,ml.vertical,["vertical"],B,F,w,k));var $=S?S.boxStartIndex:t.collisionBoxArray.length,tt=S?S.boxEndIndex:t.collisionBoxArray.length,et=L?L.boxStartIndex:t.collisionBoxArray.length,rt=L?L.boxEndIndex:t.collisionBoxArray.length,nt=C?C.boxStartIndex:t.collisionBoxArray.length,it=C?C.boxEndIndex:t.collisionBoxArray.length,at=E?E.boxStartIndex:t.collisionBoxArray.length,ot=E?E.boxEndIndex:t.collisionBoxArray.length,st=-1,lt=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=lt(S,st),st=lt(L,st),st=lt(C,st);var ut=(st=lt(E,st))>-1?1:0;ut&&(st*=A/24),t.glyphOffsetArray.length>=pu.MAX_GLYPHS&&b("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,R,F,N,$,tt,et,rt,nt,it,at,ot,u,D,O,I,P,ut,0,h,U,j,st)}(t,p,s,r,n,i,h,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,y,w,A,l,_,T,M,d,e,a,u,c,o)};if("line"===S)for(var z=0,I=Ul(e.geometry,0,0,8192,8192);z1){var U=Bl(N,k,r.vertical||m,n,24,v);U&&E(N,U)}}else if("Polygon"===e.type)for(var j=0,V=Qo(e.geometry,0);j=C.maxzoom||"none"!==C.visibility&&(o(S,this.zoom,n),(m[C.id]=C.createBucket({index:c.bucketLayerIDs.length,layers:S,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,g,this.tileID.canonical),c.bucketLayerIDs.push(S.map((function(t){return t.id}))))}}}var L=t.mapObject(g.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(L).length?a.send("getGlyphs",{uid:this.uid,stacks:L},(function(t,e){p||(p=t,h=e,I.call(l))})):h={};var E=Object.keys(g.iconDependencies);E.length?a.send("getImages",{icons:E,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){p||(p=t,f=e,I.call(l))})):f={};var z=Object.keys(g.patternDependencies);function I(){if(p)return s(p);if(h&&f&&d){var e=new i(h),r=new t.ImageAtlas(f,d);for(var a in m){var l=m[a];l instanceof t.SymbolBucket?(o(l.layers,this.zoom,n),t.performSymbolLayout(l,h,e.positions,f,r.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):l.hasPattern&&(l instanceof t.LineBucket||l instanceof t.FillBucket||l instanceof t.FillExtrusionBucket)&&(o(l.layers,this.zoom,n),l.addFeatures(g,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:t.values(m).filter((function(t){return!t.isEmpty()})),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?h:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}z.length?a.send("getImages",{icons:z,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){p||(p=t,d=e,I.call(l))})):d={},I.call(this)};var l=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||s,this.loading={},this.loaded={}};l.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[i]=new a(e);s.abort=this.loadVectorData(e,(function(e,a){if(delete n.loading[i],e||!a)return s.status="done",n.loaded[i]=s,r(e);var l=a.rawData,u={};a.expires&&(u.expires=a.expires),a.cacheControl&&(u.cacheControl=a.cacheControl);var c={};if(o){var p=o.finish();p&&(c.resourceTiming=JSON.parse(JSON.stringify(p)))}s.vectorTile=a.vectorTile,s.parse(a.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:l.slice(0)},n,u,c))})),n.loaded=n.loaded||{},n.loaded[i]=s}))},l.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,i=t.uid,a=this;if(n&&n[i]){var o=n[i];o.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,a.layerIndex,r.availableImages,a.actor,i)),e(t,n)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},l.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},l.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var u=t.window.ImageBitmap,c=function(){this.loaded={}};function p(t,e){if(0!==t.length){h(t[0],e);for(var r=1;r=0!=!!e&&t.reverse()}c.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,a=e.rawImageData,o=u&&a instanceof u?this.getImageData(a):a,s=new t.DEMData(n,o,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)},c.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:r.width,height:r.height},r.data)},c.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var f=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function C(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,a=0,o=r.length,s=0;s>1;!function t(e,r,n,i,a,o){for(;a>i;){if(a-i>600){var s=a-i+1,l=n-i+1,u=Math.log(s),c=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-l*c/s+p)),Math.min(a,Math.floor(n+(s-l)*c/s+p)),o)}var h=r[2*n+o],f=i,d=a;for(E(e,r,i,n),r[2*a+o]>h&&E(e,r,i,a);fh;)d--}r[2*i+o]===h?E(e,r,i,d):E(e,r,++d,a),d<=n&&(i=d+1),n<=d&&(a=d-1)}}(e,r,s,i,a,o%2),t(e,r,n,i,s-1,o+1),t(e,r,n,s+1,a,o+1)}}(o,s,n,0,o.length-1,0)};O.prototype.range=function(t,e,r,n){return function(t,e,r,n,i,a,o){for(var s,l,u=[0,t.length-1,0],c=[];u.length;){var p=u.pop(),h=u.pop(),f=u.pop();if(h-f<=o)for(var d=f;d<=h;d++)l=e[2*d+1],(s=e[2*d])>=r&&s<=i&&l>=n&&l<=a&&c.push(t[d]);else{var m=Math.floor((f+h)/2);l=e[2*m+1],(s=e[2*m])>=r&&s<=i&&l>=n&&l<=a&&c.push(t[m]);var g=(p+1)%2;(0===p?r<=s:n<=l)&&(u.push(f),u.push(m-1),u.push(g)),(0===p?i>=s:a>=l)&&(u.push(m+1),u.push(h),u.push(g))}}return c}(this.ids,this.coords,t,e,r,n,this.nodeSize)},O.prototype.within=function(t,e,r){return function(t,e,r,n,i,a){for(var o=[0,t.length-1,0],s=[],l=i*i;o.length;){var u=o.pop(),c=o.pop(),p=o.pop();if(c-p<=a)for(var h=p;h<=c;h++)I(e[2*h],e[2*h+1],r,n)<=l&&s.push(t[h]);else{var f=Math.floor((p+c)/2),d=e[2*f],m=e[2*f+1];I(d,m,r,n)<=l&&s.push(t[f]);var g=(u+1)%2;(0===u?r-i<=d:n-i<=m)&&(o.push(p),o.push(f-1),o.push(g)),(0===u?r+i>=d:n+i>=m)&&(o.push(f+1),o.push(c),o.push(g))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var R={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},F=function(t){this.options=H(Object.create(R),t),this.trees=new Array(this.options.maxZoom+1)};function B(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function N(t,e){var r=t.geometry.coordinates,n=r[1];return{x:V(r[0]),y:q(n),zoom:1/0,index:e,parentId:-1}}function U(t){return{type:"Feature",id:t.id,properties:j(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function j(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return H(H({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function V(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function H(t,e){for(var r in e)t[r]=e[r];return t}function Z(t){return t.x}function G(t){return t.y}function X(t,e,r,n,i,a){var o=i-r,s=a-n;if(0!==o||0!==s){var l=((t-r)*o+(e-n)*s)/(o*o+s*s);l>1?(r=i,n=a):l>0&&(r+=o*l,n+=s*l)}return(o=t-r)*o+(s=e-n)*s}function W(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)Y(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(o+=n?(i*u-l*a)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-a,2))),i=l,a=u}var c=e.length-3;e[2]=1,function t(e,r,n,i){for(var a,o=i,s=n-r>>1,l=n-r,u=e[r],c=e[r+1],p=e[n],h=e[n+1],f=r+3;fo)a=f,o=d;else if(d===o){var m=Math.abs(f-s);mi&&(a-r>3&&t(e,r,a,i),e[a+2]=o,n-a>3&&t(e,a,n,i))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function $(t,e,r,n){for(var i=0;i1?1:r}function rt(t,e,r,n,i,a,o,s){if(n/=e,a>=(r/=e)&&o=n)return null;for(var l=[],u=0;u=r&&d=n)){var m=[];if("Point"===h||"MultiPoint"===h)nt(p,m,r,n,i);else if("LineString"===h)it(p,m,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===h)ot(p,m,r,n,i,!1);else if("Polygon"===h)ot(p,m,r,n,i,!0);else if("MultiPolygon"===h)for(var g=0;g=r&&o<=n&&(e.push(t[a]),e.push(t[a+1]),e.push(t[a+2]))}}function it(t,e,r,n,i,a,o){for(var s,l,u=at(t),c=0===i?lt:ut,p=t.start,h=0;hr&&(l=c(u,f,d,g,y,r),o&&(u.start=p+s*l)):v>n?_=r&&(l=c(u,f,d,g,y,r),x=!0),_>n&&v<=n&&(l=c(u,f,d,g,y,n),x=!0),!a&&x&&(o&&(u.end=p+s*l),e.push(u),u=at(t)),o&&(p+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(v=0===i?f:d)>=r&&v<=n&&st(u,f,d,m),b=u.length-3,a&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&st(u,u[0],u[1],u[2]),u.length&&e.push(u)}function at(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ot(t,e,r,n,i,a){for(var o=0;oo.maxX&&(o.maxX=c),p>o.maxY&&(o.maxY=p)}return o}function mt(t,e,r,n){var i=e.geometry,a=e.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s0&&e.size<(i?o:n))r.numPoints+=e.length/3;else{for(var s=[],l=0;lo)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,a=i-2;n0===e)for(n=0,i=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=n;u--){var c=+Date.now();s=this._cluster(s,u),this.trees[u]=new O(s,Z,G,a,Float32Array),r&&console.log("z%d: %d clusters in %dms",u,s.length,+Date.now()-c)}return r&&console.timeEnd("total time"),this},F.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),i=180===t[2]?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){var o=this.getClusters([r,n,180,a],e),s=this.getClusters([-180,n,i,a],e);return o.concat(s)}for(var l=this.trees[this._limitZoom(e)],u=[],c=0,p=l.range(V(r),q(a),V(i),q(n));c1?this._map(s,!0):null,d=(o<<5)+(e+1)+this.points.length,m=0,g=u;m>5},F.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},F.prototype._map=function(t,e){if(t.numPoints)return e?H({},t.properties):t.properties;var r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?H({},n):n},yt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},yt.prototype.splitTile=function(t,e,r,n,i,a,o){for(var s=[t,e,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<1&&console.time("creation"),h=this.tiles[p]=dt(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(h.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<1&&console.time("clipping");var m,g,y,v,_,x,b=.5*l.buffer/l.extent,w=.5-b,T=.5+b,k=1+b;m=g=y=v=null,_=rt(t,c,r-b,r+T,0,h.minX,h.maxX,l),x=rt(t,c,r+w,r+k,0,h.minX,h.maxX,l),t=null,_&&(m=rt(_,c,n-b,n+T,1,h.minY,h.maxY,l),g=rt(_,c,n+w,n+k,1,h.minY,h.maxY,l),_=null),x&&(y=rt(x,c,n-b,n+T,1,h.minY,h.maxY,l),v=rt(x,c,n+w,n+k,1,h.minY,h.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*r,2*n),s.push(g||[],e+1,2*r,2*n+1),s.push(y||[],e+1,2*r+1,2*n),s.push(v||[],e+1,2*r+1,2*n+1)}}},yt.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,a=n.debug;if(t<0||t>24)return null;var o=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,p=r;!l&&u>0;)u--,c=Math.floor(c/2),p=Math.floor(p/2),l=this.tiles[vt(u,c,p)];return l&&l.source?(a>1&&console.log("found parent tile z%d-%d-%d",u,c,p),a>1&&console.time("drilling down"),this.splitTile(l.source,u,c,p,t,e,r),a>1&&console.timeEnd("drilling down"),this.tiles[s]?ht(this.tiles[s],i):null):null};var xt=function(e){function r(t,r,n,i){e.call(this,t,r,n,_t),i&&(this.loadGeoJSON=i)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(n&&n.request&&n.request.collectResourceTiming)&&new t.RequestPerformance(n.request);this.loadGeoJSON(n,(function(a,o){if(a||!o)return r(a);if("object"!=typeof o)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var h=function(e){function r(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e=0?1.2:1))}function y(t,e,r,n,i,a,o){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else if(a.ranges[s])e(null,{stack:r,id:i,glyph:o});else{var l=a.requests[s];l||(l=a.requests[s]=[],_.loadGlyphRange(r,s,n.url,n.requestManager,(function(t,e){if(e){for(var r in e)n._doesCharSupportLocalGlyph(+r)||(a.glyphs[+r]=e[+r]);a.ranges[s]=!0}for(var i=0,o=l;i1&&(s=t[++o]);var u=Math.abs(l-s.left),c=Math.abs(l-s.right),p=Math.min(u,c),h=void 0,f=i/r*(n+1);if(s.isDash){var d=n-Math.abs(f);h=Math.sqrt(p*p+d*d)}else h=n-Math.sqrt(p*p+f*f);this.data[a+l]=Math.max(0,Math.min(255,h+128))}},T.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}var i=t[0],a=t[t.length-1];i.isDash===a.isDash&&(i.left=a.left-this.width,a.right=i.right+this.width);for(var o=this.width*this.nextRow,s=0,l=t[s],u=0;u1&&(l=t[++s]);var c=Math.abs(u-l.left),p=Math.abs(u-l.right),h=Math.min(c,p);this.data[o+u]=Math.max(0,Math.min(255,(l.isDash?h:-h)+128))}},T.prototype.addDash=function(e,r){var n=r?7:0,i=2*n+1;if(this.nextRow+i>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o=n&&e.x=i&&e.y0&&(l[new t.OverscaledTileID(e.overscaledZ,a,r.z,i,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,o,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.actor.send(this.type+".loadData",n,(function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,a){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(a,n.map.painter,"reloadTile"===i),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),z=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),I=function(e){function r(t,r,n,i){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(e,r){var n=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(i,a){n._loaded=!0,i?n.fire(new t.ErrorEvent(i)):a&&(n.image=a,e&&(n.coordinates=e),r&&r(),n._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,i=-1/0,a=-1/0,o=0,s=e;or.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(I),D=function(e){function r(r,n,i,a){e.call(this,r,n,i,a),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,z.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var a=this.tiles[i];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];tthis.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this},N.prototype.has=function(t){return t.wrapped().key in this.data},N.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},N.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},N.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},N.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},N.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},N.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},N.prototype.filter=function(t){var e=[];for(var r in this.data)for(var n=0,i=this.data[r];n1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[a]&&(t.neighboringTiles[a].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var i in this._tiles){var a=this._tiles[i];if(!(n[i]||!a.hasData()||a.tileID.overscaledZ<=e||a.tileID.overscaledZ>r)){for(var o=a.tileID;a&&a.tileID.overscaledZ>e+1;){var s=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[s.key])&&a.hasData()&&(o=s)}for(var l=o;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){n[o.key]=o;break}}}},r.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n),a=this._getLoadedTile(i);if(a)return a}},r.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},r.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*r*5),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(i)},r.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var r={};for(var n in this._tiles){var i=this._tiles[n];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),r[i.tileID.key]=i}for(var a in this._tiles=r,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter((function(t){return n._source.hasTile(t)})))):i=[];var a=e.coveringZoomLevel(this._source),o=Math.max(a-r.maxOverzooming,this._source.minzoom),s=Math.max(a+r.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(i,a);if(It(this._source.type)){for(var u={},c={},p=0,h=Object.keys(l);pthis._source.maxzoom){var g=d.children(this._source.maxzoom)[0],y=this.getTile(g);if(y&&y.hasData()){n[g.key]=g;continue}}else{var v=d.children(this._source.maxzoom);if(n[v[0].key]&&n[v[1].key]&&n[v[2].key]&&n[v[3].key])continue}for(var _=m.wasRequested(),x=d.overscaledZ-1;x>=a;--x){var b=d.scaledTo(x);if(i[b.key])break;if(i[b.key]=!0,!(m=this.getTile(b))&&_&&(m=this._addTile(b)),m&&(n[b.key]=b,_=m.wasRequested(),m.hasData()))break}}}return n},r.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],r=void 0,n=this._tiles[t].tileID;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);var i=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(i))break;n=i}for(var a=0,o=e;a0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var i=this,a=[],o=this.transform;if(!o)return a;for(var s=n?o.getCameraQueryGeometry(e):e,l=e.map((function(t){return o.pointCoordinate(t)})),u=s.map((function(t){return o.pointCoordinate(t)})),c=this.getIds(),p=1/0,h=1/0,f=-1/0,d=-1/0,m=0,g=u;m=0&&y[1].y+g>=0){var v=l.map((function(t){return s.getTilePoint(t)})),_=u.map((function(t){return s.getTilePoint(t)}));a.push({tile:n,tileID:s,queryGeometry:v,cameraQueryGeometry:_,scale:m})}}},_=0;_=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)},r.prototype.removeFeatureState=function(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)},r.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},r.prototype.setDependencies=function(t,e,r){var n=this._tiles[t];n&&n.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function zt(t,e){var r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function It(t){return"raster"===t||"image"===t||"video"===t}function Pt(){return new t.window.Worker(Gi.workerUrl)}Et.maxOverzooming=10,Et.maxUnderzooming=3;var Dt="mapboxgl_preloaded_worker_pool",Ot=function(){this.active={}};Ot.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length0?(i-o)/s:0;return this.points[a].mult(1-l).add(this.points[r].mult(l))};var Kt=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var a=0;a=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,i,a,o,s,l){var u=i?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(u,n.transform.zoom),p=[256/n.width*2+1,256/n.height*2+1],h=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;h.clear();for(var f=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=n.transform.width/n.transform.height,g=!1,y=0;yMath.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function ae(e,r,n,i,a,o,s,l,u,c,p,h,f,d){var m,g=r/24,y=e.lineOffsetX*g,v=e.lineOffsetY*g;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ne(g,l,y,v,n,p,h,e,u,o,f);if(!w)return{notEnoughRoom:!0};var T=$t(w.first.point,s).point,k=$t(w.last.point,s).point;if(i&&!n){var A=ie(e.writingMode,T,k,d);if(A)return A}m=[w.first];for(var M=e.glyphStartIndex+1;M<_-1;M++)m.push(se(g*l.getoffsetX(M),y,v,n,p,h,e.segment,x,b,u,o,f));m.push(w.last)}else{if(i&&!n){var S=$t(h,a).point,C=e.lineStartIndex+e.segment+1,L=new t.Point(u.getx(C),u.gety(C)),E=$t(L,a),z=E.signedDistanceFromCamera>0?E.point:oe(h,L,S,1,a),I=ie(e.writingMode,S,z,d);if(I)return I}var P=se(g*l.getoffsetX(e.glyphStartIndex),y,v,n,p,h,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,o,f);if(!P)return{notEnoughRoom:!0};m=[P]}for(var D=0,O=m;D0?1:-1,m=0;i&&(d*=-1,m=Math.PI),d<0&&(m+=Math.PI);for(var g=d>0?l+s:l+s+1,y=a,v=a,_=0,x=0,b=Math.abs(f),w=[];_+x<=b;){if((g+=d)=u)return null;if(v=y,w.push(y),void 0===(y=h[g])){var T=new t.Point(c.getx(g),c.gety(g)),k=$t(T,p);if(k.signedDistanceFromCamera>0)y=h[g]=k.point;else{var A=g-d;y=oe(0===_?o:new t.Point(c.getx(A),c.gety(A)),T,v,b-_+1,p)}}_+=x,x=v.dist(y)}var M=(b-_)/x,S=y.sub(v),C=S.mult(M)._add(v);C._add(S._unit()._perp()._mult(n*d));var L=m+Math.atan2(y.y-v.y,y.x-v.x);return w.push(C),{point:C,angle:L,path:w}}Kt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Kt.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},Kt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},Kt.prototype._insertBoxCell=function(t,e,r,n,i,a){this.boxCells[i].push(a)},Kt.prototype._insertCircleCell=function(t,e,r,n,i,a){this.circleCells[i].push(a)},Kt.prototype._query=function(t,e,r,n,i,a){if(r<0||t>this.width||n<0||e>this.height)return!i&&[];var o=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s0:o},Kt.prototype._queryCircle=function(t,e,r,n,i){var a=t-r,o=t+r,s=e-r,l=e+r;if(o<0||a>this.width||l<0||s>this.height)return!n&&[];var u=[];return this._forEachCell(a,s,o,l,this._queryCellCircle,u,{hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},i),n?u.length>0:u},Kt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},Kt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},Kt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Kt.prototype._queryCell=function(t,e,r,n,i,a,o,s){var l=o.seenUids,u=this.boxCells[i];if(null!==u)for(var c=this.bboxes,p=0,h=u;p=c[d+0]&&n>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var m=this.circleCells[i];if(null!==m)for(var g=this.circles,y=0,v=m;yo*o+s*s},Kt.prototype._circleAndRectCollide=function(t,e,r,n,i,a,o){var s=(a-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var u=(o-i)/2,c=Math.abs(e-(i+u));if(c>u+r)return!1;if(l<=s||c<=u)return!0;var p=l-s,h=c-u;return p*p+h*h<=r*r};var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ue(t,e){for(var r=0;r=1;z--)E.push(C.path[z]);for(var I=1;I0){for(var R=E[0].clone(),F=E[0].clone(),B=1;B=A.x&&F.x<=M.x&&R.y>=A.y&&F.y<=M.y?[E]:F.xM.x||F.yM.y?[]:t.clipLine([E],A.x,A.y,M.x,M.y)}for(var N=0,U=O;N=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},pe.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t=0&&e0?(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(m=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:g,width:r,height:n,anchor:t,textBoxScale:i,prevAnchor:m},this.markUsedJustification(h,t,p,f),h.allowVerticalPlacement&&(this.markUsedOrientation(h,f,p),this.placedOrientations[p.crossTileID]=f),{shift:y,placedGlyphBoxes:v}):void 0},be.prototype.placeLayerBucketPart=function(e,r,n){var i=this,a=e.parameters,o=a.bucket,s=a.layout,l=a.posMatrix,u=a.textLabelPlaneMatrix,c=a.labelToScreenMatrix,p=a.textPixelRatio,h=a.holdingForFade,f=a.collisionBoxArray,d=a.partiallyEvaluatedTextSize,m=a.collisionGroup,g=s.get("text-optional"),y=s.get("icon-optional"),v=s.get("text-allow-overlap"),_=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),T="viewport-y"===s.get("symbol-z-order"),k=v&&(_||!o.hasIconData()||y),A=_&&(v||!o.hasTextData()||g);!o.collisionArrays&&f&&o.deserializeCollisionBoxes(f);var M=function(e,a){if(!r[e.crossTileID])if(h)i.placements[e.crossTileID]=new me(!1,!1,!1);else{var f,T=!1,M=!1,S=!0,C=null,L={box:null,offscreen:null},E={box:null,offscreen:null},z=null,I=null,P=0,D=0,O=0;a.textFeatureIndex?P=a.textFeatureIndex:e.useRuntimeCollisionCircles&&(P=e.featureIndex),a.verticalTextFeatureIndex&&(D=a.verticalTextFeatureIndex);var R=a.textBox;if(R){var F=function(r){var n=t.WritingMode.horizontal;if(o.allowVerticalPlacement&&!r&&i.prevPlacement){var a=i.prevPlacement.placedOrientations[e.crossTileID];a&&(i.placedOrientations[e.crossTileID]=a,i.markUsedOrientation(o,n=a,e))}return n},B=function(r,n){if(o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&a.verticalTextBox)for(var i=0,s=o.writingModes;i0&&(N=N.filter((function(t){return t!==U.anchor}))).unshift(U.anchor)}var j=function(t,r,n){for(var a=t.x2-t.x1,s=t.y2-t.y1,u=e.textBoxScale,c=w&&!_?r:null,h={box:[],offscreen:!1},f=v?2*N.length:N.length,d=0;d=N.length,e,o,n,c);if(g&&(h=g.placedGlyphBoxes)&&h.box&&h.box.length){T=!0,C=g.shift;break}}return h};B((function(){return j(R,a.iconBox,t.WritingMode.horizontal)}),(function(){var r=a.verticalTextBox;return o.allowVerticalPlacement&&!(L&&L.box&&L.box.length)&&e.numVerticalGlyphVertices>0&&r?j(r,a.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),L&&(T=L.box,S=L.offscreen);var V=F(L&&L.box);if(!T&&i.prevPlacement){var q=i.prevPlacement.variableOffsets[e.crossTileID];q&&(i.variableOffsets[e.crossTileID]=q,i.markUsedJustification(o,q.anchor,e,V))}}else{var H=function(t,r){var n=i.collisionIndex.placeCollisionBox(t,v,p,l,m.predicate);return n&&n.box&&n.box.length&&(i.markUsedOrientation(o,r,e),i.placedOrientations[e.crossTileID]=r),n};B((function(){return H(R,t.WritingMode.horizontal)}),(function(){var r=a.verticalTextBox;return o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?H(r,t.WritingMode.vertical):{box:null,offscreen:null}})),F(L&&L.box&&L.box.length)}}if(T=(f=L)&&f.box&&f.box.length>0,S=f&&f.offscreen,e.useRuntimeCollisionCircles){var Z=o.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),G=t.evaluateSizeForFeature(o.textSizeData,d,Z),X=s.get("text-padding");z=i.collisionIndex.placeCollisionCircles(v,Z,o.lineVertexArray,o.glyphOffsetArray,G,l,u,c,n,b,m.predicate,e.collisionCircleDiameter,X),T=v||z.circles.length>0&&!z.collisionDetected,S=S&&z.offscreen}if(a.iconFeatureIndex&&(O=a.iconFeatureIndex),a.iconBox){var W=function(t){var e=w&&C?xe(t,C.x,C.y,x,b,i.transform.angle):t;return i.collisionIndex.placeCollisionBox(e,_,p,l,m.predicate)};M=E&&E.box&&E.box.length&&a.verticalIconBox?(I=W(a.verticalIconBox)).box.length>0:(I=W(a.iconBox)).box.length>0,S=S&&I.offscreen}var Y=g||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,K=y||0===e.numIconVertices;if(Y||K?K?Y||(M=M&&T):T=M&&T:M=T=M&&T,T&&f&&f.box&&i.collisionIndex.insertCollisionBox(f.box,s.get("text-ignore-placement"),o.bucketInstanceId,E&&E.box&&D?D:P,m.ID),M&&I&&i.collisionIndex.insertCollisionBox(I.box,s.get("icon-ignore-placement"),o.bucketInstanceId,O,m.ID),z&&(T&&i.collisionIndex.insertCollisionCircles(z.circles,s.get("text-ignore-placement"),o.bucketInstanceId,P,m.ID),n)){var J=o.bucketInstanceId,Q=i.collisionCircleArrays[J];void 0===Q&&(Q=i.collisionCircleArrays[J]=new ge);for(var $=0;$=0;--C){var L=S[C];M(o.symbolInstances.get(L),o.collisionArrays[L])}else for(var E=e.symbolInstanceStart;E=0&&(e.text.placedSymbolArray.get(l).crossTileID=a>=0&&l!==a?0:n.crossTileID)}},be.prototype.markUsedOrientation=function(e,r,n){for(var i=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,a=r===t.WritingMode.vertical?r:0,o=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];o0,v=i.placedOrientations[a.crossTileID],_=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=Ee(g.text);d(e.text,s,_?ze:b),d(e.text,l,x?ze:b);var w=g.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||_?1:0)})),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var T=i.variableOffsets[a.crossTileID];T&&i.markUsedJustification(e,T.anchor,a,v);var k=i.placedOrientations[a.crossTileID];k&&(i.markUsedJustification(e,"left",a,k),i.markUsedOrientation(e,k,a))}if(y){var A=Ee(g.icon),M=!(h&&a.verticalPlacedIconSymbolIndex&&_);a.placedIconSymbolIndex>=0&&(d(e.icon,a.numIconVertices,M?A:ze),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=g.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,a.numVerticalIconVertices,M?ze:A),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var S=e.collisionArrays[n];if(S){var C=new t.Point(0,0);if(S.textBox||S.verticalTextBox){var L=!0;if(u){var E=i.variableOffsets[m];E?(C=_e(E.anchor,E.width,E.height,E.textOffset,E.textBoxScale),c&&C._rotate(p?i.transform.angle:-i.transform.angle)):L=!1}S.textBox&&we(e.textCollisionBox.collisionVertexArray,g.text.placed,!L||_,C.x,C.y),S.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,g.text.placed,!L||x,C.x,C.y)}var z=Boolean(!x&&S.verticalIconBox);S.iconBox&&we(e.iconCollisionBox.collisionVertexArray,g.icon.placed,z,h?C.x:0,h?C.y:0),S.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,g.icon.placed,!z,h?C.x:0,h?C.y:0)}}},g=0;gt},be.prototype.setStale=function(){this.stale=!0};var Te=Math.pow(2,25),ke=Math.pow(2,24),Ae=Math.pow(2,17),Me=Math.pow(2,16),Se=Math.pow(2,9),Ce=Math.pow(2,8),Le=Math.pow(2,1);function Ee(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*Te+e*ke+r*Ae+e*Me+r*Se+e*Ce+r*Le+e}var ze=0,Ie=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};Ie.prototype.continuePlacement=function(t,e,r,n,i){for(var a=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=r[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Ie(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Pe.prototype.commit=function(t){return this.placement.commit(t),this.placement};var De=512/t.EXTENT/2,Oe=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;nt.overscaledZ)for(var s in o){var l=o[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,i)}else{var u=o[t.scaledTo(Number(a)).key];u&&u.findMatches(e.symbolInstances,t,i)}}for(var c=0;c1?"@2x":"",l=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){l=null,o||(o=t,i=e,c())})),u=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){u=null,o||(o=t,a=e,c())}));function c(){if(o)n(o);else if(i&&a){var e=t.browser.getImageData(a),r={};for(var s in i){var l=i[s],u=l.width,c=l.height,p=l.x,h=l.y,f=l.sdf,d=l.pixelRatio,m=l.stretchX,g=l.stretchY,y=l.content,v=new t.RGBAImage({width:u,height:c});t.RGBAImage.copy(e,v,{x:p,y:h},{x:0,y:0},{width:u,height:c}),r[s]={data:v,pixelRatio:d,sdf:f,stretchX:m,stretchY:g,content:y}}n(null,r)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(e,this.map._requestManager,(function(e,n){if(r._spriteRequest=null,e)r.fire(new t.ErrorEvent(e));else if(n)for(var i in n)r.imageManager.addImage(i,n[i]);r.imageManager.setLoaded(!0),r._availableImages=r.imageManager.listImages(),r.dispatcher.broadcast("setImages",r._availableImages),r.fire(new t.Event("data",{dataType:"style"}))}))},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var n=e.sourceLayer;if(n){var i=r.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+n+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}}},r.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,n=t;r0)throw new Error("Unimplemented: "+i.map((function(t){return t.command})).join(", ")+".");return n.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(void 0===n&&(n={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var a=this.sourceCaches[e]=new Et(e,r,this.dispatcher);a.style=this,a.setEventedParent(this,(function(){return{isSourceLoaded:i.loaded(),source:a.serialize(),sourceId:e}})),a.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else{var a;if("custom"===e.type){if(Ne(this,t.validateCustomStyleLayer(e)))return;a=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})),this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n))return;a=t.createStyleLayer(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[a.id]=a.serialize()}var o=r?this._order.indexOf(r):this._order.length;if(r&&-1===o)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(o,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&"custom"!==a.type){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.hasLayer=function(t){return t in this._layers},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.deepEqual(i.filter,r))return null==r?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",r,null,n)||(i.filter=t.clone$1(r),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var a=this.getLayer(e);a?t.deepEqual(a.getLayoutProperty(r),n)||(a.setLayoutProperty(r,n,i),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(e,r){var n=this.getLayer(e);if(n)return n.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var a=this.getLayer(e);a?t.deepEqual(a.getPaintProperty(r),n)||(a.setPaintProperty(r,n,i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,a=this.sourceCaches[n];if(void 0!==a){var o=a.getSource().type;"geojson"===o&&i?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||i?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.setFeatureState(i,e.id,r)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=this.sourceCaches[n];if(void 0!==i){var a=i.getSource().type,o="vector"===a?e.sourceLayer:void 0;"vector"!==a||o?r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))):i.removeFeatureState(o,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r];if(void 0!==i){if("vector"!==i.getSource().type||n)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),i.getFeatureState(n,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},n={},i=[],a=this._order.length-1;a>=0;a--){var o=this._order[a];if(r(o)){n[o]=a;for(var s=0,l=t;s=0;f--){var d=this._order[f];if(r(d))for(var m=i.length-1;m>=0;m--){var g=i[m].feature;if(n[g.layer.id] 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),$e=yr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),tr=yr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),er=yr("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),rr=yr("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),nr=yr("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ir=yr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),ar=yr("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),or=yr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),sr=yr("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),lr=yr("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),ur=yr("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),cr=yr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define MAX_LINE_DISTANCE 32767.0\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),pr=yr("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),hr=yr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),fr=yr("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),dr=yr("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),mr=yr("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),gr=yr("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function yr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n={};return{fragmentSource:t=t.replace(r,(function(t,e,r,i,a){return n[a]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nvarying "+r+" "+i+" "+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,i,a){var o="float"===i?"vec2":"vec4",s=a.match(/color/)?"color":o;return n[a]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float u_"+a+"_t;\nattribute "+r+" "+o+" a_"+a+";\nvarying "+r+" "+i+" "+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+a+" = a_"+a+";\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+a+" = unpack_mix_"+s+"(a_"+a+", u_"+a+"_t);\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float u_"+a+"_t;\nattribute "+r+" "+o+" a_"+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = a_"+a+";\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = unpack_mix_"+s+"(a_"+a+", u_"+a+"_t);\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n"}))}}var vr=Object.freeze({__proto__:null,prelude:Ze,background:Ge,backgroundPattern:Xe,circle:We,clippingMask:Ye,heatmap:Ke,heatmapTexture:Je,collisionBox:Qe,collisionCircle:$e,debug:tr,fill:er,fillOutline:rr,fillOutlinePattern:nr,fillPattern:ir,fillExtrusion:ar,fillExtrusionPattern:or,hillshadePrepare:sr,hillshade:lr,line:ur,lineGradient:cr,linePattern:pr,lineSDF:hr,raster:fr,symbolIcon:dr,symbolSDF:mr,symbolTextAndIcon:gr}),_r=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};_r.prototype.bind=function(t,e,r,n,i,a,o,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==n.length,u=0;!l&&u>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}xr.prototype.draw=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m){var g,y=t.gl;if(!this.failedToCreate){for(var v in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(i),t.setCullFace(a),this.fixedUniforms)this.fixedUniforms[v].set(o[v]);f&&f.setUniforms(t,this.binderUniforms,p,{zoom:h});for(var _=(g={},g[y.LINES]=2,g[y.TRIANGLES]=3,g[y.LINE_STRIP]=1,g)[e],x=0,b=c.get();x0?1-1/(1.001-o):-o),u_contrast_factor:(a=i.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:jr(i.paint.get("raster-hue-rotate"))};var a,o};function jr(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var Vr,qr=function(t,e,r,n,i,a,o,s,l,u){var c=i.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:c.width/c.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+n,u_texsize:u,u_texture:0}},Hr=function(e,r,n,i,a,o,s,l,u,c,p){var h=a.transform;return t.extend(qr(e,r,n,i,a,o,s,l,u,c),{u_gamma_scale:i?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+p})},Zr=function(e,r,n,i,a,o,s,l,u,c){return t.extend(Hr(e,r,n,i,a,o,s,l,!0,u,!0),{u_texsize_icon:c,u_texture_icon:1})},Gr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Xr=function(e,r,n,i,a,o){return t.extend(function(t,e,r,n){var i=r.imageManager.getPattern(t.from.toString()),a=r.imageManager.getPattern(t.to.toString()),o=r.imageManager.getPixelSize(),s=o.width,l=o.height,u=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,r.transform.tileZoom)/u,p=c*(n.tileID.canonical.x+n.tileID.wrap*u),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/he(n,1,r.transform.tileZoom),u_pixel_coord_upper:[p>>16,h>>16],u_pixel_coord_lower:[65535&p,65535&h]}}(i,o,n,a),{u_matrix:e,u_opacity:r})},Wr={fillExtrusion:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},collisionCircle:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,r.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,r.u_viewport_size)}},debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_overlay:new t.Uniform1i(e,r.u_overlay),u_overlay_scale:new t.Uniform1f(e,r.u_overlay_scale)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_maxzoom:new t.Uniform1f(e,r.u_maxzoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Yr(e,r,n,i,a,o,s){for(var l=e.context,u=l.gl,c=e.useProgram("collisionBox"),p=[],h=0,f=0,d=0;d0){var b=t.create(),w=v;t.mul(b,y.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,y.placementViewportMatrix),p.push({circleArray:x,circleOffset:f,transform:w,invTransform:b}),f=h+=x.length/4}_&&c.draw(l,u.LINES,At.disabled,Mt.disabled,e.colorModeForRenderPass(),Ct.disabled,Lr(v,e.transform,g),n.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,e.transform.zoom,null,null,_.collisionVertexBuffer)}}if(s&&p.length){var T=e.useProgram("collisionCircle"),k=new t.StructArrayLayout2f1f2i16;k.resize(4*h),k._trim();for(var A=0,M=0,S=p;M=0&&(m[y.associatedIconIndex]={shiftedAnchor:k,angle:A})}else ue(y.numGlyphs,f)}if(p){d.clear();for(var S=e.icon.placedSymbolArray,C=0;C0){var s=t.browser.now(),l=(s-e.timeAdded)/o,u=r?(s-r.timeAdded)/o:-1,c=n.getSource(),p=a.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!r||Math.abs(r.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),f=h&&e.refreshedUponExpiration?1:t.clamp(h?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var ln=new t.Color(1,0,0,1),un=new t.Color(0,1,0,1),cn=new t.Color(0,0,1,1),pn=new t.Color(1,0,1,1),hn=new t.Color(0,1,1,1);function fn(t,e,r,n){mn(t,0,e+r/2,t.transform.width,r,n)}function dn(t,e,r,n){mn(t,e-r/2,0,r,t.transform.height,n)}function mn(e,r,n,i,a,o){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(r*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,a*t.browser.devicePixelRatio),s.clear({color:o}),l.disable(l.SCISSOR_TEST)}function gn(e,r,n){var i=e.context,a=i.gl,o=n.posMatrix,s=e.useProgram("debug"),l=At.disabled,u=Mt.disabled,c=e.colorModeForRenderPass();i.activeTexture.set(a.TEXTURE0),e.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),s.draw(i,a.LINE_STRIP,l,u,c,Ct.disabled,zr(o,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var p=r.getTileByID(n.key).latestRawTileData,h=Math.floor((p&&p.byteLength||0)/1024),f=r.getTile(n).tileSize,d=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5,m=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(m+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var r=t.debugOverlayCanvas,n=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,r.width,r.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,m+" "+h+"kb"),s.draw(i,a.TRIANGLES,l,u,St.alphaBlended,Ct.disabled,zr(o,t.Color.transparent,d),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var yn={symbol:function(e,r,n,i,a){if("translucent"===e.renderPass){var o=Mt.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,r,n,i,a,o,s){for(var l=r.transform,u="map"===a,c="map"===o,p=0,h=e;p256&&this.clearStencil(),r.setColorMode(St.disabled),r.setDepthMode(At.disabled);var i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var a=0,o=e;a256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new Mt({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},vn.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new Mt({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},vn.prototype.stencilConfigForOverlap=function(t){var e,r=this.context.gl,n=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),i=n[n.length-1].overscaledZ,a=n[0].overscaledZ-i+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();for(var o={},s=0;s=0;this.currentLayer--){var x=this.style._layers[i[this.currentLayer]],b=a[x.source],w=c[x.source];this._renderTileClippingMasks(x,w),this.renderLayer(this,b,x,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?e.pop():null},vn.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},vn.prototype.useProgram=function(t,e){this.cache=this.cache||{};var r=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new xr(this.context,vr[t],e,Wr[t],this._showOverdrawInspector)),this.cache[r]},vn.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},vn.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},vn.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},vn.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var _n=function(t,e){this.points=t,this.planes=e};_n.fromInvProjectionMatrix=function(e,r,n){var i=Math.pow(2,n),a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(r){return t.transformMat4([],r,e)})).map((function(e){return t.scale$1([],e,1/e[3]/r*i)})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var r=t.sub([],a[e[0]],a[e[1]]),n=t.sub([],a[e[2]],a[e[1]]),i=t.normalize([],t.cross([],r,n)),o=-t.dot(i,a[e[1]]);return i.concat(o)}));return new _n(a,o)};var xn=function(e,r){this.min=e,this.max=r,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};xn.prototype.quadrant=function(e){for(var r=[e%2==0,e<2],n=t.clone$2(this.min),i=t.clone$2(this.max),a=0;a=0;if(0===o)return 0;o!==r.length&&(n=!1)}if(n)return 2;for(var l=0;l<3;l++){for(var u=Number.MAX_VALUE,c=-Number.MAX_VALUE,p=0;pthis.max[l]-this.min[l])return 0}return 1};var bn=function(t,e,r,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=n};bn.prototype.interpolate=function(e,r,n){return null!=r.top&&null!=e.top&&(this.top=t.number(e.top,r.top,n)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,r.bottom,n)),null!=r.left&&null!=e.left&&(this.left=t.number(e.left,r.left,n)),null!=r.right&&null!=e.right&&(this.right=t.number(e.right,r.right,n)),this},bn.prototype.getCenter=function(e,r){var n=t.clamp((this.left+e-this.right)/2,0,e),i=t.clamp((this.top+r-this.bottom)/2,0,r);return new t.Point(n,i)},bn.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},bn.prototype.clone=function(){return new bn(this.top,this.bottom,this.left,this.right)},bn.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var wn=function(e,r,n,i,a){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===a||a,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new bn,this._posMatrixCache={},this._alignedPosMatrixCache={}},Tn={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};wn.prototype.clone=function(){var t=new wn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},Tn.minZoom.get=function(){return this._minZoom},Tn.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Tn.maxZoom.get=function(){return this._maxZoom},Tn.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Tn.minPitch.get=function(){return this._minPitch},Tn.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},Tn.maxPitch.get=function(){return this._maxPitch},Tn.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},Tn.renderWorldCopies.get=function(){return this._renderWorldCopies},Tn.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Tn.worldSize.get=function(){return this.tileSize*this.scale},Tn.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Tn.size.get=function(){return new t.Point(this.width,this.height)},Tn.bearing.get=function(){return-this.angle/Math.PI*180},Tn.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Tn.pitch.get=function(){return this._pitch/Math.PI*180},Tn.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},Tn.fov.get=function(){return this._fov/Math.PI*180},Tn.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},Tn.zoom.get=function(){return this._zoom},Tn.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},Tn.center.get=function(){return this._center},Tn.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Tn.padding.get=function(){return this._edgeInsets.toJSON()},Tn.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},Tn.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},wn.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},wn.prototype.interpolatePadding=function(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()},wn.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},wn.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var n=this.pointCoordinate(new t.Point(0,0)),i=this.pointCoordinate(new t.Point(this.width,0)),a=this.pointCoordinate(new t.Point(this.width,this.height)),o=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(n.x,i.x,a.x,o.x)),l=Math.floor(Math.max(n.x,i.x,a.x,o.x)),u=s-1;u<=l+1;u++)0!==u&&r.push(new t.UnwrappedTileID(u,e));return r},wn.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var i=t.MercatorCoordinate.fromLngLat(this.center),a=Math.pow(2,r),o=[a*i.x,a*i.y,0],s=_n.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=r);var u=function(t){return{aabb:new xn([t*a,0,0],[(t+1)*a,a,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},c=[],p=[],h=r,f=e.reparseOverscaled?n:r;if(this._renderWorldCopies)for(var d=1;d<=3;d++)c.push(u(-d)),c.push(u(d));for(c.push(u(0));c.length>0;){var m=c.pop(),g=m.x,y=m.y,v=m.fullyVisible;if(!v){var _=m.aabb.intersects(s);if(0===_)continue;v=2===_}var x=m.aabb.distanceX(o),b=m.aabb.distanceY(o),w=Math.max(Math.abs(x),Math.abs(b));if(m.zoom===h||w>3+(1<=l)p.push({tileID:new t.OverscaledTileID(m.zoom===h?f:m.zoom,m.wrap,m.zoom,g,y),distanceSq:t.sqrLen([o[0]-.5-g,o[1]-.5-y])});else for(var T=0;T<4;T++){var k=(g<<1)+T%2,A=(y<<1)+(T>>1);c.push({aabb:m.aabb.quadrant(T),zoom:m.zoom+1,x:k,y:A,wrap:m.wrap,fullyVisible:v})}}return p.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},wn.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},Tn.unmodified.get=function(){return this._unmodified},wn.prototype.zoomScale=function(t){return Math.pow(2,t)},wn.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},wn.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},wn.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Tn.point.get=function(){return this.project(this.center)},wn.prototype.setLocationAtPoint=function(e,r){var n=this.pointCoordinate(r),i=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(e),o=new t.MercatorCoordinate(a.x-(n.x-i.x),a.y-(n.y-i.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())},wn.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},wn.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},wn.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},wn.prototype.coordinateLocation=function(t){return t.toLngLat()},wn.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],a=n[3],o=r[1]/i,s=n[1]/a,l=r[2]/i,u=n[2]/a,c=l===u?0:(0-l)/(u-l);return new t.MercatorCoordinate(t.number(r[0]/i,n[0]/a,c)/this.worldSize,t.number(o,s,c)/this.worldSize)},wn.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},wn.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},wn.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},wn.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},wn.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var n=e.key,i=r?this._alignedPosMatrixCache:this._posMatrixCache;if(i[n])return i[n];var a=e.canonical,o=this.worldSize/this.zoomScale(a.z),s=a.x+Math.pow(2,a.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*o,a.y*o,0]),t.scale(l,l,[o/t.EXTENT,o/t.EXTENT,1]),t.multiply(l,r?this.alignedProjMatrix:this.projMatrix,l),i[n]=new Float32Array(l),i[n]},wn.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},wn.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,n,i,a=-90,o=90,s=-180,l=180,u=this.size,c=this._unmodified;if(this.latRange){var p=this.latRange;a=t.mercatorYfromLat(p[1])*this.worldSize,e=(o=t.mercatorYfromLat(p[0])*this.worldSize)-ao&&(i=o-g)}if(this.lngRange){var y=f.x,v=u.x/2;y-vl&&(n=l-v)}void 0===n&&void 0===i||(this.center=this.unproject(new t.Point(void 0!==n?n:f.x,void 0!==i?i:f.y))),this._unmodified=c,this._constraining=!1}},wn.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var r=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),i=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-n,.01,Math.PI-.01)),a=this.point,o=a.x,s=a.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),u=this.height/50,c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,u,l),c[8]=2*-e.x/this.width,c[9]=2*e.y/this.height,t.scale(c,c,[1,-1,1]),t.translate(c,c,[0,0,-this.cameraToCenterDistance]),t.rotateX(c,c,this._pitch),t.rotateZ(c,c,this.angle),t.translate(c,c,[-o,-s,0]),this.mercatorMatrix=t.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),t.scale(c,c,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=c,this.invProjMatrix=t.invert([],this.projMatrix);var p=this.width%2/2,h=this.height%2/2,f=Math.cos(this.angle),d=Math.sin(this.angle),m=o-Math.round(o)+f*p+d*h,g=s-Math.round(s)+f*h+d*p,y=new Float64Array(c);if(t.translate(y,y,[m>.5?m-1:m,g>.5?g-1:g,0]),this.alignedProjMatrix=y,c=t.create(),t.scale(c,c,[this.width/2,-this.height/2,1]),t.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=t.create(),t.scale(c,c,[1,-1,1]),t.translate(c,c,[-1,-1,0]),t.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(c=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}},wn.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},wn.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},wn.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var n=r.x,i=r.y,a=r.x,o=r.y,s=0,l=e;s=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},kn.prototype._updateHashUnthrottled=function(){var e=this.getHashString();try{t.window.history.replaceState(t.window.history.state,"",e)}catch(t){}};var An={linearity:.3,easing:t.bezier(0,0,.3,1)},Mn=t.extend({deceleration:2500,maxSpeed:1400},An),Sn=t.extend({deceleration:20,maxSpeed:1400},An),Cn=t.extend({deceleration:1e3,maxSpeed:360},An),Ln=t.extend({deceleration:1e3,maxSpeed:90},An),En=function(t){this._map=t,this.clear()};function zn(t,e){(!t.duration||t.duration0&&r-e[0].time>160;)e.shift()},En.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var r={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},n=0,i=this._inertiaBuffer;n=this._clickTolerance||this._map.fire(new Pn(t.type,this._map,t))},Rn.prototype.dblclick=function(t){return this._firePreventable(new Pn(t.type,this._map,t))},Rn.prototype.mouseover=function(t){this._map.fire(new Pn(t.type,this._map,t))},Rn.prototype.mouseout=function(t){this._map.fire(new Pn(t.type,this._map,t))},Rn.prototype.touchstart=function(t){return this._firePreventable(new Dn(t.type,this._map,t))},Rn.prototype.touchmove=function(t){this._map.fire(new Dn(t.type,this._map,t))},Rn.prototype.touchend=function(t){this._map.fire(new Dn(t.type,this._map,t))},Rn.prototype.touchcancel=function(t){this._map.fire(new Dn(t.type,this._map,t))},Rn.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},Rn.prototype.isEnabled=function(){return!0},Rn.prototype.isActive=function(){return!1},Rn.prototype.enable=function(){},Rn.prototype.disable=function(){};var Fn=function(t){this._map=t};Fn.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Fn.prototype.mousemove=function(t){this._map.fire(new Pn(t.type,this._map,t))},Fn.prototype.mousedown=function(){this._delayContextMenu=!0},Fn.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Fn.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Pn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Fn.prototype.isEnabled=function(){return!0},Fn.prototype.isActive=function(){return!1},Fn.prototype.enable=function(){},Fn.prototype.disable=function(){};var Bn=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Nn(t,e){for(var r={},n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){for(var r=new t.Point(0,0),n=0,i=e;n30)&&(this.aborted=!0)}}},Un.prototype.touchend=function(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){var n=!this.aborted&&this.centroid;if(this.reset(),n)return n}};var jn=function(t){this.singleTap=new Un(t),this.numTaps=t.numTaps,this.reset()};jn.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},jn.prototype.touchstart=function(t,e,r){this.singleTap.touchstart(t,e,r)},jn.prototype.touchmove=function(t,e,r){this.singleTap.touchmove(t,e,r)},jn.prototype.touchend=function(t,e,r){var n=this.singleTap.touchend(t,e,r);if(n){var i=t.timeStamp-this.lastTime<500,a=!this.lastTap||this.lastTap.dist(n)<30;if(i&&a||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}};var Vn=function(){this._zoomIn=new jn({numTouches:1,numTaps:2}),this._zoomOut=new jn({numTouches:2,numTaps:1}),this.reset()};Vn.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},Vn.prototype.touchstart=function(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)},Vn.prototype.touchmove=function(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)},Vn.prototype.touchend=function(t,e,r){var n=this,i=this._zoomIn.touchend(t,e,r),a=this._zoomOut.touchend(t,e,r);return i?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}}):a?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(a)},{originalEvent:t})}}):void 0},Vn.prototype.touchcancel=function(){this.reset()},Vn.prototype.enable=function(){this._enabled=!0},Vn.prototype.disable=function(){this._enabled=!1,this.reset()},Vn.prototype.isEnabled=function(){return this._enabled},Vn.prototype.isActive=function(){return this._active};var qn=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};qn.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},qn.prototype._correctButton=function(t,e){return!1},qn.prototype._move=function(t,e){return{}},qn.prototype.mousedown=function(t,e){if(!this._lastPoint){var n=r.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}},qn.prototype.mousemoveWindow=function(t,e){var r=this._lastPoint;if(r&&(t.preventDefault(),this._moved||!(e.dist(r)0&&(this._active=!0);var i=Nn(n,r),a=new t.Point(0,0),o=new t.Point(0,0),s=0;for(var l in i){var u=i[l],c=this._touches[l];c&&(a._add(u),o._add(u.sub(c)),s++,i[l]=u)}if(this._touches=i,!(sMath.abs(t.x)}var ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,ti(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,r){var n=t[0].sub(this._lastPoints[0]),i=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,i,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+i.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,r){if(void 0!==this._valid)return this._valid;var n=t.mag()>=2,i=e.mag()>=2;if(n||i){if(!n||!i)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;var a=t.y>0==e.y>0;return ti(t)&&ti(e)&&a}},e}(Wn),ri={panStep:100,bearingStep:15,pitchStep:10},ni=function(){var t=ri;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep};function ii(t){return t*(2-t)}ni.prototype.reset=function(){this._active=!1},ni.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var r=0,n=0,i=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),o=1);break;default:return}return{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:ii,zoom:r?Math.round(l)+r*(t.shiftKey?2:1):l,bearing:s.getBearing()+n*e._bearingStep,pitch:s.getPitch()+i*e._pitchStep,offset:[-a*e._panStep,-o*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},ni.prototype.enable=function(){this._enabled=!0},ni.prototype.disable=function(){this._enabled=!1,this.reset()},ni.prototype.isEnabled=function(){return this._enabled},ni.prototype.isActive=function(){return this._active};var ai=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};ai.prototype.setZoomRate=function(t){this._defaultZoomRate=t},ai.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},ai.prototype.isEnabled=function(){return!!this._enabled},ai.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},ai.prototype.isZooming=function(){return!!this._zooming},ai.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},ai.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},ai.prototype.wheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.browser.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}},ai.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},ai.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var n=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},ai.prototype.renderFrame=function(){return this._onScrollFrame()},ai.prototype._onScrollFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var a="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(a*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var o,s="number"==typeof this._targetZoom?this._targetZoom:r.zoom,l=this._startZoom,u=this._easing,c=!1;if("wheel"===this._type&&l&&u){var p=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),h=u(p);o=t.number(l,s,h),p<1?this._frameId||(this._frameId=!0):c=!0}else o=s,c=!0;return this._active=!0,c&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!c,zoomDelta:o-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},ai.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.browser.now()-n.start)/n.duration,a=n.easing(i+.01)-n.easing(i),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=t.bezier(o,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r},ai.prototype.reset=function(){this._active=!1};var oi=function(t,e){this._clickZoom=t,this._tapZoom=e};oi.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},oi.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},oi.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},oi.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var si=function(){this.reset()};si.prototype.reset=function(){this._active=!1},si.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(r){r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.unproject(e)},{originalEvent:t})}}},si.prototype.enable=function(){this._enabled=!0},si.prototype.disable=function(){this._enabled=!1,this.reset()},si.prototype.isEnabled=function(){return this._enabled},si.prototype.isActive=function(){return this._active};var li=function(){this._tap=new jn({numTouches:1,numTaps:1}),this.reset()};li.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},li.prototype.touchstart=function(t,e,r){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=e[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,e,r))},li.prototype.touchmove=function(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;var n=e[0],i=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(t,e,r)},li.prototype.touchend=function(t,e,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(t,e,r)&&(this._tapTime=t.timeStamp)},li.prototype.touchcancel=function(){this.reset()},li.prototype.enable=function(){this._enabled=!0},li.prototype.disable=function(){this._enabled=!1,this.reset()},li.prototype.isEnabled=function(){return this._enabled},li.prototype.isActive=function(){return this._active};var ui=function(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r};ui.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},ui.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},ui.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},ui.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var ci=function(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r};ci.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},ci.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},ci.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},ci.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var pi=function(t,e,r,n){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0};pi.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},pi.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},pi.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},pi.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},pi.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},pi.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var hi=function(t){return t.zoom||t.drag||t.pitch||t.rotate},fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function di(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var mi=function(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new En(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);var i=this._el;this._listeners=[[i,"touchstart",{passive:!1}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(var a=0,o=this._listeners;aa?Math.min(2,b):Math.max(.5,b),w=Math.pow(g,1-e),T=i.unproject(_.add(x.mult(e*w)).mult(m));i.setLocationAtPoint(i.renderWorldCopies?T.wrap():T,d)}n._fireMoveEvents(r)}),(function(t){n._afterEase(r,t)}),e),this},r.prototype._prepareEase=function(e,r,n){void 0===n&&(n={}),this._moving=!0,r||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e,r){if(!this._easeId||!r||this._easeId!==r){delete this._easeId;var n=this._zooming,i=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),a&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},r.prototype.flyTo=function(e,r){var n=this;if(!e.essential&&t.browser.prefersReducedMotion){var i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,r)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var a=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),u=this.getPadding(),c="zoom"in e?t.clamp(+e.zoom,a.minZoom,a.maxZoom):o,p="bearing"in e?this._normalizeBearing(e.bearing,s):s,h="pitch"in e?+e.pitch:l,f="padding"in e?e.padding:a.padding,d=a.zoomScale(c-o),m=t.Point.convert(e.offset),g=a.centerPoint.add(m),y=a.pointLocation(g),v=t.LngLat.convert(e.center||y);this._normalizeCenter(v);var _=a.project(y),x=a.project(v).sub(_),b=e.curve,w=Math.max(a.width,a.height),T=w/d,k=x.mag();if("minZoom"in e){var A=t.clamp(Math.min(e.minZoom,o,c),a.minZoom,a.maxZoom),M=w/a.zoomScale(A-o);b=Math.sqrt(M/k*2)}var S=b*b;function C(t){var e=(T*T-w*w+(t?-1:1)*S*S*k*k)/(2*(t?T:w)*S*k);return Math.log(Math.sqrt(e*e+1)-e)}function L(t){return(Math.exp(t)-Math.exp(-t))/2}function E(t){return(Math.exp(t)+Math.exp(-t))/2}var z=C(0),I=function(t){return E(z)/E(z+b*t)},P=function(t){return w*((E(z)*(L(e=z+b*t)/E(e))-L(z))/S)/k;var e},D=(C(1)-z)/b;if(Math.abs(k)<1e-6||!isFinite(D)){if(Math.abs(w-T)<1e-6)return this.easeTo(e,r);var O=Te.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==p,this._pitching=h!==l,this._padding=!a.isPaddingEqual(f),this._prepareEase(r,!1),this._ease((function(e){var i=e*D,d=1/I(i);a.zoom=1===e?c:o+a.scaleZoom(d),n._rotating&&(a.bearing=t.number(s,p,e)),n._pitching&&(a.pitch=t.number(l,h,e)),n._padding&&(a.interpolatePadding(u,f,e),g=a.centerPoint.add(m));var y=1===e?v:a.unproject(_.add(x.mult(P(i))).mult(d));a.setLocationAtPoint(a.renderWorldCopies?y.wrap():y,g),n._fireMoveEvents(r)}),(function(){return n._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){return this._stop()},r.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}if(!t){var n=this.handlers;n&&n.stop()}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),yi=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};yi.prototype.getDefaultPosition=function(){return"bottom-right"},yi.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._innerContainer=r.create("div","mapboxgl-ctrl-attrib-inner",this._container),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},yi.prototype.onRemove=function(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},yi.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var n=r.reduce((function(t,e,n){return e.value&&(t+=e.key+"="+e.value+(n=0)return!1;return!0}))).join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},yi.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var vi=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};vi.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},vi.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},vi.prototype.getDefaultPosition=function(){return"bottom-left"},vi.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},vi.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},vi.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var _i=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};_i.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},_i.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var i=new wn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(n.call(this,i,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new _i,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},xi,e.locale),this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof wi))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return r._update(!1)})),this.on("moveend",(function(){return r._update(!1)})),this.on("zoom",(function(){return r._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1)),this.handlers=new mi(this,e),this._hash=e.hash&&new kn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new yi({customAttribution:e.customAttribution})),this.addControl(new vi,e.logoPosition),this.on("style.load",(function(){r.transform.unmodified&&r.jumpTo(r.style.stylesheet)})),this.on("data",(function(e){r._update("style"===e.dataType),r.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){r.fire(new t.Event(e.dataType+"dataloading",e))}))}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var a={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,r){if(void 0===r&&e.getDefaultPosition&&(r=e.getDefaultPosition()),void 0===r&&(r="top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var n=e.onAdd(this);this._controls.push(e);var i=this._controlPositions[r];return-1!==r.indexOf("bottom")?i.insertBefore(n,i.firstChild):i.appendChild(n),this},i.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i);var a=!this._moving;return a&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),a&&this.fire(new t.Event("moveend",e)),this},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},i.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},i.prototype._createDelegatedListener=function(t,e,r){var n,i=this;if("mouseenter"===t||"mouseover"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var o=i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[];o.length?a||(a=!0,r.call(i,new Pn(t,i,n.originalEvent,{features:o}))):a=!1},mouseout:function(){a=!1}}}}if("mouseleave"===t||"mouseout"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?o=!0:o&&(o=!1,r.call(i,new Pn(t,i,n.originalEvent)))},mouseout:function(e){o&&(o=!1,r.call(i,new Pn(t,i,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var n=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(i,t),delete t.features)},n)}},i.prototype.on=function(t,e,r){if(void 0===r)return n.prototype.on.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var a in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i),i.delegates)this.on(a,i.delegates[a]);return this},i.prototype.once=function(t,e,r){if(void 0===r)return n.prototype.once.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var a in i.delegates)this.once(a,i.delegates[a]);return this},i.prototype.off=function(t,e,r){var i=this;return void 0===r?n.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(n){for(var a=n[t],o=0;o180;){var s=n.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}Li.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag()},Li.prototype.move=function(t,e){var r=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&r.setBearing(r.getBearing()+n.bearingDelta),this.mousePitch){var i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&r.setPitch(r.getPitch()+i.pitchDelta)}},Li.prototype.off=function(){var t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},Li.prototype.offTemp=function(){r.enableDrag(),r.removeEventListener(t.window,"mousemove",this.mousemove),r.removeEventListener(t.window,"mouseup",this.mouseup)},Li.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),r.mousePos(this.element,e)),r.addEventListener(t.window,"mousemove",this.mousemove),r.addEventListener(t.window,"mouseup",this.mouseup)},Li.prototype.mousemove=function(t){this.move(t,r.mousePos(this.element,t))},Li.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},Li.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},Li.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},Li.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)e.getEast()||r.latitudee.getNorth())},n.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}},n.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},n.prototype._updateCamera=function(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,i=this._map.getBearing(),a=t.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(n),a,{geolocateSource:!0})},n.prototype._updateMarker=function(e){if(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},n.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),r=this._map.unproject([1,t]),n=e.distanceTo(r),i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=i+"px",this._circleElement.style.height=i+"px"},n.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},n.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Fi)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},n.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},n.prototype._setupUI=function(e){var n=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=r.create("button","mapboxgl-ctrl-geolocate",this._container),r.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{var a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Di(this._dotElement),this._circleElement=r.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Di({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==n._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(n._watchState="BACKGROUND",n._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),n._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),n.fire(new t.Event("trackuserlocationend")))}))},n.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ri--,Fi=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Ri>1?(e={maximumAge:6e5,timeout:0},Fi=!0):(e=this.options.positionOptions,Fi=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},n.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},n}(t.Evented),Ni={maxWidth:100,unit:"metric"},Ui=function(e){this.options=t.extend({},Ni,e),t.bindAll(["_onMove","setUnit"],this)};function ji(t,e,r){var n=r&&r.maxWidth||100,i=t._container.clientHeight/2,a=t.unproject([0,i]),o=t.unproject([n,i]),s=a.distanceTo(o);if(r&&"imperial"===r.unit){var l=3.2808*s;l>5280?Vi(e,n,l/5280,t._getUIString("ScaleControl.Miles")):Vi(e,n,l,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?Vi(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Vi(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):Vi(e,n,s,t._getUIString("ScaleControl.Meters"))}function Vi(t,e,r,n){var i,a,o,s=(i=r,(a=Math.pow(10,(""+Math.floor(i)).length-1))*(o=(o=i/a)>=10?10:o>=5?5:o>=3?3:o>=2?2:o>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(o)));t.style.width=e*(s/r)+"px",t.innerHTML=s+" "+n}Ui.prototype.getDefaultPosition=function(){return"bottom-left"},Ui.prototype._onMove=function(){ji(this._map,this._container,this.options)},Ui.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Ui.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Ui.prototype.setUnit=function(t){this.options.unit=t,ji(this._map,this._container,this.options)};var qi=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};qi.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},qi.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},qi.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},qi.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},qi.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},qi.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},qi.prototype._isFullscreen=function(){return this._fullscreen},qi.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},qi.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Hi={closeButton:!0,closeOnClick:!0,className:"",maxWidth:"240px"},Zi=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(Hi),r),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},n.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},n.prototype.getElement=function(){return this._container},n.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},n.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},n.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},n.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},n.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},n.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},n.prototype._createContent=function(){this._content&&r.remove(this._content),this._content=r.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},n.prototype._onMouseUp=function(t){this._update(t.point)},n.prototype._onMouseMove=function(t){this._update(t.point)},n.prototype._onDrag=function(t){this._update(t.point)},n.prototype._update=function(e){var n=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return n._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ei(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),a=this.options.anchor,o=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(n,n),"top-right":new t.Point(-n,n),bottom:new t.Point(0,-r),"bottom-left":new t.Point(n,-n),"bottom-right":new t.Point(-n,-n),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var i=t.Point.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!a){var s,l=this._container.offsetWidth,u=this._container.offsetHeight;s=i.y+o.bottom.ythis._map.transform.height-u?["bottom"]:[],i.xthis._map.transform.width-l/2&&s.push("right"),a=0===s.length?"bottom":s.join("-")}var c=i.add(o[a]).round();r.setTransform(this._container,zi[a]+" translate("+c.x+"px,"+c.y+"px)"),Ii(this._container,a,"popup")}},n.prototype._onClose=function(){this.remove()},n}(t.Evented),Gi={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Ai,NavigationControl:Ci,GeolocateControl:Bi,AttributionControl:yi,ScaleControl:Ui,FullscreenControl:qi,Popup:Zi,Marker:Di,Style:qe,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Bt().acquire(Dt)},clearPrewarmedResources:function(){var t=Rt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Dt),Rt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Ot.workerCount},set workerCount(t){Ot.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:""};return Gi})),r}))},{}],25:[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}},{}],26:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,(function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),"m"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length13)&&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}},{}],53:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():(t=t||self).mapboxgl=n()}(this,(function(){"use strict";var t,e,r;function n(n,i){if(t)if(e){var a="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),(r=i(o)).workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"}))}else e=i;else t=i}return n(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,a,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)(n=1))return n;for(;ra?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=a;function a(t,e){this.x=t,this.y=e}function o(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(t){return t instanceof a?t:Array.isArray(t)?new a(t[0],t[1]):t};var s=o(.25,.1,.25,1);function l(t,e,r){return Math.min(r,Math.max(e,t))}function u(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function c(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function d(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function m(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function y(t,e){return-1!==t.indexOf(e,t.length-e.length)}function g(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function v(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function _(t){return Array.isArray(t)?t.map(_):"object"==typeof t&&t?g(t,_):t}var x={};function b(t){x[t]||("undefined"!=typeof console&&console.warn(t),x[t]=!0)}function w(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function T(t){for(var e=0,r=0,n=t.length,i=n-1,a=void 0,o=void 0;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var a=n||i;return e[r]=!a||a.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var M=null;function S(t){if(null==M){var e=t.navigator?t.navigator.userAgent:null;M=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return M}function C(t){try{var e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var L,E,I,z,P=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),D=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,O=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,R={now:P,frame:function(t){var e=D(t);return{cancel:function(){return O(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=self.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return L||(L=self.document.createElement("a")),L.href=t,L.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio},get prefersReducedMotion(){return!!self.matchMedia&&(null==E&&(E=self.matchMedia("(prefers-reduced-motion: reduce)")),E.matches)}},F={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},B={supported:!1,testSupport:function(t){!N&&z&&(U?j(t):I=t)}},N=!1,U=!1;function j(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,z),t.isContextLost())return;B.supported=!0}catch(t){}t.deleteTexture(e),N=!0}self.document&&((z=self.document.createElement("img")).onload=function(){I&&j(I),I=null,U=!0},z.onerror=function(){N=!0,I=null},z.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var V="01",q=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function H(t){return 0===t.indexOf("mapbox:")}q.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",V,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},q.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},q.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},q.prototype.normalizeStyleURL=function(t,e){if(!H(t))return t;var r=W(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeGlyphsURL=function(t,e){if(!H(t))return t;var r=W(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSourceURL=function(t,e){if(!H(t))return t;var r=W(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSpriteURL=function(t,e,r,n){var i=W(t);return H(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,Y(i))},q.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!H(t))return t;var r=W(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(R.devicePixelRatio>=2||512===e?"@2x":"")+(B.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e=1&&self.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){b("Unable to write to LocalStorage")}},J.prototype.processRequests=function(t){},J.prototype.postEvent=function(t,e,r,n){var i=this;if(F.EVENTS_URL){var a=W(F.EVENTS_URL);a.params.push("access_token="+(n||F.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.10.1",skuId:V,userId:this.anonId},s=e?c(o,e):o,l={url:Y(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=_t(l,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n)}))}},J.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var Q,$,tt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(F.EVENTS_URL&&n||F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||G(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,i=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),d(this.anonId)||(this.anonId=f()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}(J),et=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){F.EVENTS_URL&&F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||G(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=K(F.ACCESS_TOKEN),n=r?r.u:F.ACCESS_TOKEN,i=n!==this.eventData.tokenU;d(this.anonId)||(this.anonId=f(),i=!0);var a=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),s=new Date(a),l=(a-this.eventData.lastSuccess)/864e5;i=i||l>=1||l<-1||o.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(a,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=a,e.eventData.tokenU=n)}),t)}},e}(J)),rt=et.postTurnstileEvent.bind(et),nt=new tt,it=nt.postMapLoadEvent.bind(nt),at=500,ot=50;function st(){self.caches&&!Q&&(Q=self.caches.open("mapbox-tiles"))}function lt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ut,ct=1/0;function pt(){return null==ut&&(ut=self.OffscreenCanvas&&new self.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),ut}var ht={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ht);var ft,dt,mt=function(t){function e(e,r,n){401===r&&G(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=r,this.url=n,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),yt=k()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===self.location.protocol?self.parent:self).location.href},gt=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(yt())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&self.Request.prototype.hasOwnProperty("signal"))return function(t,e){var r,n=new self.AbortController,i=new self.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:yt(),signal:n.signal}),a=!1,o=!1,s=(r=i.url).indexOf("sku=")>0&&G(r);"json"===t.type&&i.headers.set("Accept","application/json");var l=function(r,n,a){if(!o){if(r&&"SecurityError"!==r.message&&b(r),n&&a)return u(n);var l=Date.now();self.fetch(i).then((function(r){if(r.ok){var n=s?r.clone():null;return u(r,n,l)}return e(new mt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},u=function(r,n,s){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){o||(n&&s&&function(t,e,r){if(st(),Q){var n={status:e.status,statusText:e.statusText,headers:new self.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var i=A(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===$)try{new Response(new ReadableStream),$=!0}catch(t){$=!1}$?e(t.body):t.blob().then(e)}(e,(function(e){var r=new self.Response(e,n);st(),Q&&Q.then((function(e){return e.put(lt(t.url),r)})).catch((function(t){return b(t.message)}))})))}}(i,n,s),a=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){o||e(new Error(t.message))}))};return s?function(t,e){if(st(),!Q)return e(null);var r=lt(t.url);Q.then((function(t){t.match(r).then((function(n){var i=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),r=A(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i)})).catch(e)})).catch(e)}(i,l):l(null,null),{cancel:function(){o=!0,a||n.abort()}}}(t,e);if(k()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){var r=new self.XMLHttpRequest;for(var n in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(n,t.headers[n]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new mt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},vt=function(t,e){return gt(c(t,{type:"arrayBuffer"}),e)},_t=function(t,e){return gt(c(t,{method:"POST"}),e)};ft=[],dt=0;var xt=function(t,e){if(B.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),dt>=F.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return ft.push(r),r}dt++;var n=!1,i=function(){if(!n)for(n=!0,dt--;ft.length&&dt0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},At.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Mt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},St=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function Ct(t){var e=t.value;return e?[new St(t.key,e,"constants have been deprecated as of v8")]:[]}function Lt(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Gt=[Dt,Ot,Rt,Ft,Bt,Vt,Nt,Ht(Ut),qt];function Xt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Xt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=Gt;r255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),u=s.indexOf(")");if(-1!==l&&u+1===s.length){var c=s.substr(0,l),p=s.substr(l+1,u-(l+1)).split(","),h=1;switch(c){case"rgba":if(4!==p.length)return null;h=a(p.pop());case"rgb":return 3!==p.length?null:[i(p[0]),i(p[1]),i(p[2]),h];case"hsla":if(4!==p.length)return null;h=a(p.pop());case"hsl":if(3!==p.length)return null;var f=(parseFloat(p[0])%360+360)%360/360,d=a(p[1]),m=a(p[2]),y=m<=.5?m*(d+1):m+d-m*d,g=2*m-y;return[n(255*o(g,y,f+1/3)),n(255*o(g,y,f)),n(255*o(g,y,f-1/3)),h];default:return null}}return null}}catch(t){}})).parseCSSColor,Jt=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};Jt.parse=function(t){if(t){if(t instanceof Jt)return t;if("string"==typeof t){var e=Kt(t);if(e)return new Jt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Jt.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},Jt.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},Jt.black=new Jt(0,0,0,1),Jt.white=new Jt(1,1,1,1),Jt.transparent=new Jt(0,0,0,0),Jt.red=new Jt(1,0,0,1);var Qt=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Qt.prototype.compare=function(t,e){return this.collator.compare(t,e)},Qt.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var $t=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i},te=function(t){this.sections=t};te.fromString=function(t){return new te([new $t(t,null,null,null,null)])},te.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},te.factory=function(t){return t instanceof te?t:te.fromString(t)},te.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},te.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ne(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof Jt)return!0;if(t instanceof Qt)return!0;if(t instanceof te)return!0;if(t instanceof ee)return!0;if(Array.isArray(t)){for(var e=0,r=t;e2){var s=t[1];if("string"!=typeof s||!(s in le)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);a=le[s],n++}else a=Ut;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++}r=Ht(a,o)}else r=le[i];for(var l=[];n1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var ce=function(t){this.type=Vt,this.sections=t};ce.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,a=1;a<=t.length-1;++a){var o=t[a];if(i&&"object"==typeof o&&!Array.isArray(o)){i=!1;var s=null;if(o["font-scale"]&&!(s=e.parse(o["font-scale"],1,Ot)))return null;var l=null;if(o["text-font"]&&!(l=e.parse(o["text-font"],1,Ht(Rt))))return null;var u=null;if(o["text-color"]&&!(u=e.parse(o["text-color"],1,Bt)))return null;var c=n[n.length-1];c.scale=s,c.font=l,c.textColor=u}else{var p=e.parse(t[a],1,Ut);if(!p)return null;var h=p.type.kind;if("string"!==h&&"value"!==h&&"null"!==h&&"resolvedImage"!==h)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:p,scale:null,font:null,textColor:null})}}return new ce(n)},ce.prototype.evaluate=function(t){return new te(this.sections.map((function(e){var r=e.content.evaluate(t);return ie(r)===qt?new $t("",r,null,null,null):new $t(ae(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},ce.prototype.eachChild=function(t){for(var e=0,r=this.sections;e-1),r},pe.prototype.eachChild=function(t){t(this.input)},pe.prototype.outputDefined=function(){return!1},pe.prototype.serialize=function(){return["image",this.input.serialize()]};var he={"to-boolean":Ft,"to-color":Bt,"to-number":Ot,"to-string":Rt},fe=function(t,e){this.type=t,this.args=e};fe.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=he[r],i=[],a=1;a4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":re(e[0],e[1],e[2],e[3])))return new Jt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new se(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var o=null,s=0,l=this.args;s=e[2]||t[1]<=e[1]||t[3]>=e[3])}function xe(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*8192),Math.round(n*i*8192)]}function be(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function we(t,e){for(var r,n,i,a,o,s,l,u=!1,c=0,p=e.length;c0&&s<0||o<0&&s>0}function Ae(t,e,r){for(var n=0,i=r;nr[2]){var i=.5*n,a=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;0===a&&(a=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=a}ve(e,t)}function Ie(t,e,r,n){for(var i=8192*Math.pow(2,n.z),a=[8192*n.x,8192*n.y],o=[],s=0,l=t;s=0)return!1;var r=!0;return t.eachChild((function(t){r&&!Re(t,e)&&(r=!1)})),r}Pe.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(ne(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;ne))throw new se("Input is not a number.");a=o-1}return 0}Be.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},Be.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new ue(e,[t]):"coerce"===r?new fe(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var a=i.parse(t,this);if(!a)return null;if(this.expectedType){var o=this.expectedType,s=a.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==s.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(o,s))return null}else a=r(a,o,e.typeAnnotation||"coerce");else a=r(a,o,e.typeAnnotation||"assert")}if(!(a instanceof oe)&&"resolvedImage"!==a.type.kind&&function t(e){if(e instanceof Fe)return t(e.boundExpression);if(e instanceof ye&&"error"===e.name)return!1;if(e instanceof ge)return!1;if(e instanceof Pe)return!1;var r=e instanceof fe||e instanceof ue,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof oe})),!!n&&De(e)&&Re(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(a)){var l=new me;try{a=new oe(a.type,a.evaluate(l))}catch(t){return this.error(t.message),null}}return a}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Be.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Be(this.registry,n,e||null,i,this.errors)},Be.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new zt(n,t))},Be.prototype.checkSubtype=function(t,e){var r=Xt(t,e);return r&&this.error(r),r};var Ue=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var c=e.parse(s,u,i);if(!c)return null;i=i||c.type,n.push([o,c])}return new Ue(i,r,n)},Ue.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ne(e,n)].evaluate(t)},Ue.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ve=Object.freeze({__proto__:null,number:je,color:function(t,e,r){return new Jt(je(t.r,e.r,r),je(t.g,e.g,r),je(t.b,e.b,r),je(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return je(t,e[n],r)}))}}),qe=6/29*3*(6/29),He=Math.PI/180,Ze=180/Math.PI;function Ge(t){return t>.008856451679035631?Math.pow(t,1/3):t/qe+4/29}function Xe(t){return t>6/29?t*t*t:qe*(t-4/29)}function We(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ye(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ke(t){var e=Ye(t.r),r=Ye(t.g),n=Ye(t.b),i=Ge((.4124564*e+.3575761*r+.1804375*n)/.95047),a=Ge((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*a-16,a:500*(i-a),b:200*(a-Ge((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function Je(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Xe(e),r=.95047*Xe(r),n=1.08883*Xe(n),new Jt(We(3.2404542*r-1.5371385*e-.4985314*n),We(-.969266*r+1.8760108*e+.041556*n),We(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function Qe(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var $e={forward:Ke,reverse:Je,interpolate:function(t,e,r){return{l:je(t.l,e.l,r),a:je(t.a,e.a,r),b:je(t.b,e.b,r),alpha:je(t.alpha,e.alpha,r)}}},tr={forward:function(t){var e=Ke(t),r=e.l,n=e.a,i=e.b,a=Math.atan2(i,n)*Ze;return{h:a<0?a+360:a,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*He,r=t.c;return Je({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:Qe(t.h,e.h,r),c:je(t.c,e.c,r),l:je(t.l,e.l,r),alpha:je(t.alpha,e.alpha,r)}}},er=Object.freeze({__proto__:null,lab:$e,hcl:tr}),rr=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var a=0,o=i;a1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Ot)))return null;var l=[],u=null;"interpolate-hcl"===r||"interpolate-lab"===r?u=Bt:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var c=0;c=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var m=e.parse(h,d,u);if(!m)return null;u=u||m.type,l.push([p,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new rr(u,r,n,i,l):e.error("Type "+Zt(u)+" is not interpolatable.")},rr.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var a=Ne(e,n),o=rr.interpolationFactor(this.interpolation,n,e[a],e[a+1]),s=r[a].evaluate(t),l=r[a+1].evaluate(t);return"interpolate"===this.operator?Ve[this.type.kind.toLowerCase()](s,l,o):"interpolate-hcl"===this.operator?tr.reverse(tr.interpolate(tr.forward(s),tr.forward(l),o)):$e.reverse($e.interpolate($e.forward(s),$e.forward(l),o))},rr.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new se("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new se("Array index must be an integer, but found "+e+" instead.");return r[e]},or.prototype.eachChild=function(t){t(this.index),t(this.input)},or.prototype.outputDefined=function(){return!1},or.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var sr=function(t,e){this.type=Ft,this.needle=t,this.haystack=e};sr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ut),n=e.parse(t[2],2,Ut);return r&&n?Wt(r.type,[Ft,Rt,Ot,Dt,Ut])?new sr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Zt(r.type)+" instead"):null},sr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Yt(e,["boolean","string","number","null"]))throw new se("Expected first argument to be of type boolean, string, number or null, but found "+Zt(ie(e))+" instead.");if(!Yt(r,["string","array"]))throw new se("Expected second argument to be of type array or string, but found "+Zt(ie(r))+" instead.");return r.indexOf(e)>=0},sr.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},sr.prototype.outputDefined=function(){return!0},sr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var lr=function(t,e,r){this.type=Ot,this.needle=t,this.haystack=e,this.fromIndex=r};lr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ut),n=e.parse(t[2],2,Ut);if(!r||!n)return null;if(!Wt(r.type,[Ft,Rt,Ot,Dt,Ut]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Zt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Ot);return i?new lr(r,n,i):null}return new lr(r,n)},lr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Yt(e,["boolean","string","number","null"]))throw new se("Expected first argument to be of type boolean, string, number or null, but found "+Zt(ie(e))+" instead.");if(!Yt(r,["string","array"]))throw new se("Expected second argument to be of type array or string, but found "+Zt(ie(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},lr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},lr.prototype.outputDefined=function(){return!1},lr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var ur=function(t,e,r,n,i,a){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=a};ur.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},a=[],o=2;oNumber.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,ie(h)))return null}else r=ie(h);if(void 0!==i[String(h)])return u.error("Branch labels must be unique.");i[String(h)]=a.length}var f=e.parse(l,o,n);if(!f)return null;n=n||f.type,a.push(f)}var d=e.parse(t[1],1,Ut);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,n);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new ur(r,n,d,i,a,m):null},ur.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ie(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},ur.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},ur.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},ur.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,a=Object.keys(this.cases).sort();i=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Ut),n=e.parse(t[2],2,Ot);if(!r||!n)return null;if(!Wt(r.type,[Ht(Ut),Rt,Ut]))return e.error("Expected first argument to be of type array or string, but found "+Zt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Ot);return i?new pr(r.type,r,n,i):null}return new pr(r.type,r,n)},pr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Yt(e,["string","array"]))throw new se("Expected first argument to be of type array or string, but found "+Zt(ie(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},pr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},pr.prototype.outputDefined=function(){return!1},pr.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var mr=dr("==",(function(t,e,r){return e===r}),fr),yr=dr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!fr(0,e,r,n)})),gr=dr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),_r=dr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),xr=dr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),br=function(t,e,r,n,i){this.type=Rt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i};br.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Ot);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var i=null;if(n.locale&&!(i=e.parse(n.locale,1,Rt)))return null;var a=null;if(n.currency&&!(a=e.parse(n.currency,1,Rt)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Ot)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Ot))?null:new br(r,i,a,o,s)},br.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},br.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},br.prototype.outputDefined=function(){return!1},br.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var wr=function(t){this.type=Ot,this.input=t};wr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Zt(r.type)+" instead."):new wr(r):null},wr.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new se("Expected value to be of type string or array, but found "+Zt(ie(e))+" instead.")},wr.prototype.eachChild=function(t){t(this.input)},wr.prototype.outputDefined=function(){return!1},wr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Tr={"==":mr,"!=":yr,">":vr,"<":gr,">=":xr,"<=":_r,array:ue,at:or,boolean:ue,case:cr,coalesce:ir,collator:ge,format:ce,image:pe,in:sr,"index-of":lr,interpolate:rr,"interpolate-hcl":rr,"interpolate-lab":rr,length:wr,let:ar,literal:oe,match:ur,number:ue,"number-format":br,object:ue,slice:pr,step:Ue,string:ue,"to-boolean":fe,"to-color":fe,"to-number":fe,"to-string":fe,var:Fe,within:Pe};function kr(t,e){var r=e[0],n=e[1],i=e[2],a=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var o=a?a.evaluate(t):1,s=re(r,n,i,o);if(s)throw new se(s);return new Jt(r/255*o,n/255*o,i/255*o,o)}function Ar(t,e){return t in e}function Mr(t,e){var r=e[t];return void 0===r?null:r}function Sr(t){return{type:t}}function Cr(t){return{result:"success",value:t}}function Lr(t){return{result:"error",value:t}}function Er(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ir(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function zr(t){return!!t.expression&&t.expression.interpolated}function Pr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Dr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Or(t){return t}function Rr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Fr(t,e,r,n,i){return Rr(typeof r===i?n[r]:void 0,t.default,e.default)}function Br(t,e,r){if("number"!==Pr(r))return Rr(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=Ne(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function Nr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==Pr(r))return Rr(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var a=Ne(t.stops.map((function(t){return t[0]})),r),o=function(t,e,r,n){var i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],l=t.stops[a+1][1],u=Ve[e.type]||Or;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=er[t.colorSpace];u=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),o))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return u(r,n,o)}}:u(s,l,o)}function Ur(t,e,r){return"color"===e.type?r=Jt.parse(r):"formatted"===e.type?r=te.fromString(r.toString()):"resolvedImage"===e.type?r=ee.fromString(r.toString()):Pr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Rr(r,t.default,e.default)}ye.register(Tr,{error:[{kind:"error"},[Rt],function(t,e){throw new se(e[0].evaluate(t))}],typeof:[Rt,[Ut],function(t,e){return Zt(ie(e[0].evaluate(t)))}],"to-rgba":[Ht(Ot,4),[Bt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Bt,[Ot,Ot,Ot],kr],rgba:[Bt,[Ot,Ot,Ot,Ot],kr],has:{type:Ft,overloads:[[[Rt],function(t,e){return Ar(e[0].evaluate(t),t.properties())}],[[Rt,Nt],function(t,e){var r=e[1];return Ar(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:Ut,overloads:[[[Rt],function(t,e){return Mr(e[0].evaluate(t),t.properties())}],[[Rt,Nt],function(t,e){var r=e[1];return Mr(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[Ut,[Rt],function(t,e){return Mr(e[0].evaluate(t),t.featureState||{})}],properties:[Nt,[],function(t){return t.properties()}],"geometry-type":[Rt,[],function(t){return t.geometryType()}],id:[Ut,[],function(t){return t.id()}],zoom:[Ot,[],function(t){return t.globals.zoom}],"heatmap-density":[Ot,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Ot,[],function(t){return t.globals.lineProgress||0}],accumulated:[Ut,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Ot,Sr(Ot),function(t,e){for(var r=0,n=0,i=e;n":[Ft,[Rt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>a}],"filter-id->":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[Ft,[Rt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[Ft,[Rt,Ut],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[Ft,[Ut],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[Ft,[Ut],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Ft,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Ft,[Ht(Rt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Ft,[Ht(Ut)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Ft,[Rt,Ht(Ut)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[Ft,[Rt,Ht(Ut)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:Ft,overloads:[[[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Sr(Ft),function(t,e){for(var r=0,n=e;r0&&"string"==typeof t[0]&&t[0]in Tr}function qr(t,e){var r=new Be(Tr,[],e?function(t){var e={color:Bt,string:Rt,number:Ot,enum:Rt,boolean:Ft,formatted:Vt,resolvedImage:qt};return"array"===t.type?Ht(e[t.value]||Ut,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Cr(new jr(n,e)):Lr(r.errors)}jr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)},jr.prototype.evaluate=function(t,e,r,n,i,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{var o=this.expression.evaluate(this._evaluator);if(null==o||"number"==typeof o&&o!=o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new se("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(o)+" instead.");return o}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Hr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Oe(e.expression)};Hr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)},Hr.prototype.evaluate=function(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)};var Zr=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Oe(e.expression),this.interpolationType=n};function Gr(t,e){if("error"===(t=qr(t,e)).result)return t;var r=t.value.expression,n=De(r);if(!n&&!Er(e))return Lr([new zt("","data expressions not supported")]);var i=Re(r,["zoom"]);if(!i&&!Ir(e))return Lr([new zt("","zoom expressions not supported")]);var a=function t(e){var r=null;if(e instanceof ar)r=t(e.result);else if(e instanceof ir)for(var n=0,i=e.args;nn.maximum?[new St(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function Jr(t){var e,r,n,i=t.valueSpec,a=Et(t.value.type),o={},s="categorical"!==a&&void 0===t.value.property,l=!s,u="array"===Pr(t.value.stops)&&"array"===Pr(t.value.stops[0])&&"object"===Pr(t.value.stops[0][0]),c=Wr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===a)return[new St(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Yr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===Pr(r)&&0===r.length&&e.push(new St(t.key,r,"array must have at least one stop")),e},default:function(t){return xn({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===a&&s&&c.push(new St(t.key,t.value,'missing required property "property"')),"identity"===a||t.value.stops||c.push(new St(t.key,t.value,'missing required property "stops"')),"exponential"===a&&t.valueSpec.expression&&!zr(t.valueSpec)&&c.push(new St(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Er(t.valueSpec)?c.push(new St(t.key,t.value,"property functions not supported")):s&&!Ir(t.valueSpec)&&c.push(new St(t.key,t.value,"zoom functions not supported"))),"categorical"!==a&&!u||void 0!==t.value.property||c.push(new St(t.key,t.value,'"property" property is required')),c;function p(t){var e=[],a=t.value,s=t.key;if("array"!==Pr(a))return[new St(s,a,"array expected, "+Pr(a)+" found")];if(2!==a.length)return[new St(s,a,"array length 2 expected, length "+a.length+" found")];if(u){if("object"!==Pr(a[0]))return[new St(s,a,"object expected, "+Pr(a[0])+" found")];if(void 0===a[0].zoom)return[new St(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new St(s,a,"object stop key must have value")];if(n&&n>Et(a[0].zoom))return[new St(s,a[0].zoom,"stop zoom values must appear in ascending order")];Et(a[0].zoom)!==n&&(n=Et(a[0].zoom),r=void 0,o={}),e=e.concat(Wr({key:s+"[0]",value:a[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Kr,value:h}}))}else e=e.concat(h({key:s+"[0]",value:a[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},a));return Vr(It(a[1]))?e.concat([new St(s+"[1]",a[1],"expressions are not allowed in function stops.")]):e.concat(xn({key:s+"[1]",value:a[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function h(t,n){var s=Pr(t.value),l=Et(t.value),u=null!==t.value?t.value:n;if(e){if(s!==e)return[new St(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new St(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==a){var c="number expected, "+s+" found";return Er(i)&&void 0===a&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new St(t.key,u,c)]}return"categorical"!==a||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==a&&"number"===s&&void 0!==r&&l=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function an(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?on(t[1],t[2],"=="):"!="===r?un(on(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?on(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(an))):"all"===r?["all"].concat(t.slice(1).map(an)):"none"===r?["all"].concat(t.slice(1).map(an).map(un)):"in"===r?sn(t[1],t.slice(2)):"!in"===r?un(sn(t[1],t.slice(2))):"has"===r?ln(t[1]):"!has"===r?un(ln(t[1])):"within"!==r||t}function on(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function sn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(nn)]]:["filter-in-small",t,["literal",e]]}}function ln(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function un(t){return["!",t]}function cn(t){return tn(It(t.value))?Qr(Lt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==Pr(r))return[new St(n,r,"array expected, "+Pr(r)+" found")];var i,a=e.styleSpec,o=[];if(r.length<1)return[new St(n,r,"filter array must have at least 1 element")];switch(o=o.concat($r({key:n+"[0]",value:r[0],valueSpec:a.filter_operator,style:e.style,styleSpec:e.styleSpec})),Et(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===Et(r[1])&&o.push(new St(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&o.push(new St(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=Pr(r[1]))&&o.push(new St(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s=c[f+0]&&n>=c[f+1])?(o[h]=!0,a.push(u[h])):o[h]=!1}}},In.prototype._forEachCell=function(t,e,r,n,i,a,o,s){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),h=l;h<=c;h++)for(var f=u;f<=p;f++){var d=this.d*f+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(f),this._convertFromCellCoord(h+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,d,a,o,s))return}},In.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},In.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},In.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n=0)){var c=t[u];l[u]=Dn[s].shallow.indexOf(u)>=0?c:Nn(c,e)}t instanceof Error&&(l.message=t.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof t)}function Un(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Fn(t)||Bn(t)||ArrayBuffer.isView(t)||t instanceof zn)return t;if(Array.isArray(t))return t.map(Un);if("object"==typeof t){var e=t.$name||"Object",r=Dn[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),i=0,a=Object.keys(t);i=0?s:Un(s)}}return n}throw new Error("can't deserialize object of type "+typeof t)}var jn=function(){this.first=!0};jn.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function qn(t){for(var e=0,r=t;e=65097&&t<=65103)||Vn["CJK Compatibility Ideographs"](t)||Vn["CJK Compatibility"](t)||Vn["CJK Radicals Supplement"](t)||Vn["CJK Strokes"](t)||!(!Vn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Vn["CJK Unified Ideographs Extension A"](t)||Vn["CJK Unified Ideographs"](t)||Vn["Enclosed CJK Letters and Months"](t)||Vn["Hangul Compatibility Jamo"](t)||Vn["Hangul Jamo Extended-A"](t)||Vn["Hangul Jamo Extended-B"](t)||Vn["Hangul Jamo"](t)||Vn["Hangul Syllables"](t)||Vn.Hiragana(t)||Vn["Ideographic Description Characters"](t)||Vn.Kanbun(t)||Vn["Kangxi Radicals"](t)||Vn["Katakana Phonetic Extensions"](t)||Vn.Katakana(t)&&12540!==t||!(!Vn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Vn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Vn["Unified Canadian Aboriginal Syllabics"](t)||Vn["Unified Canadian Aboriginal Syllabics Extended"](t)||Vn["Vertical Forms"](t)||Vn["Yijing Hexagram Symbols"](t)||Vn["Yi Syllables"](t)||Vn["Yi Radicals"](t))))}function Zn(t){return!(Hn(t)||function(t){return!!(Vn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Vn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Vn["Letterlike Symbols"](t)||Vn["Number Forms"](t)||Vn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Vn["Control Pictures"](t)&&9251!==t||Vn["Optical Character Recognition"](t)||Vn["Enclosed Alphanumerics"](t)||Vn["Geometric Shapes"](t)||Vn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Vn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vn["CJK Symbols and Punctuation"](t)||Vn.Katakana(t)||Vn["Private Use Area"](t)||Vn["CJK Compatibility Forms"](t)||Vn["Small Form Variants"](t)||Vn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Gn(t){return t>=1424&&t<=2303||Vn["Arabic Presentation Forms-A"](t)||Vn["Arabic Presentation Forms-B"](t)}function Xn(t,e){return!(!e&&Gn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Vn.Khmer(t))}function Wn(t){for(var e=0,r=t;e-1&&(Kn="error"),Yn&&Yn(t)};function $n(){ti.fire(new Tt("pluginStateChange",{pluginStatus:Kn,pluginURL:Jn}))}var ti=new At,ei=function(){return Kn},ri=function(){if("deferred"!==Kn||!Jn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Kn="loading",$n(),Jn&&vt({url:Jn},(function(t){t?Qn(t):(Kn="loaded",$n())}))},ni={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===Kn||null!=ni.applyArabicShaping},isLoading:function(){return"loading"===Kn},setState:function(t){Kn=t.pluginStatus,Jn=t.pluginURL},isParsed:function(){return null!=ni.applyArabicShaping&&null!=ni.processBidirectionalText&&null!=ni.processStyledBidirectionalText},getPluginURL:function(){return Jn}},ii=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new jn,this.transition={})};ii.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var ai=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Dr(t))return new Xr(t,e);if(Vr(t)){var r=Gr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return"string"==typeof t&&"color"===e.type&&(n=Jt.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification)};ai.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},ai.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var oi=function(t){this.property=t,this.value=new ai(t,void 0)};oi.prototype.transitioned=function(t,e){return new li(this.property,this.value,e,c({},t.transition,this.transition),t.now)},oi.prototype.untransitioned=function(){return new li(this.property,this.value,null,{},0)};var si=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};si.prototype.getValue=function(t){return _(this._values[t].value.value)},si.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new oi(this._values[t].property)),this._values[t].value=new ai(this._values[t].property,null===e?void 0:_(e))},si.prototype.getTransition=function(t){return _(this._values[t].transition)},si.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new oi(this._values[t].property)),this._values[t].transition=_(e)||void 0},si.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);ethis.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}return i};var ui=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};ui.prototype.possiblyEvaluate=function(t,e,r){for(var n=new hi(this._properties),i=0,a=Object.keys(this._values);in.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(di),yi=function(t){this.specification=t};yi.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new ii(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ii(Math.floor(e.zoom),e)),t.expression.evaluate(new ii(Math.floor(e.zoom+1),e)),e)}},yi.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},yi.prototype.interpolate=function(t){return t};var gi=function(t){this.specification=t};gi.prototype.possiblyEvaluate=function(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)},gi.prototype.interpolate=function(){return!1};var vi=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new ai(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new oi(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};On("DataDrivenProperty",di),On("DataConstantProperty",fi),On("CrossFadedDataDrivenProperty",mi),On("CrossFadedProperty",yi),On("ColorRampProperty",gi);var _i=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=(e=e).metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new ci(r.layout)),r.paint)){for(var n in this._transitionablePaint=new si(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hi(r.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){void 0===r&&(r={}),null!=e&&this._validate(Cn,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return y(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(Sn,"layers."+this.id+".paint."+t,t,e,r))return!1;if(y(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],a=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||a||i||this._handleOverridablePaintPropertyUpdate(t,o,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),v(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&Ln(this,t.call(An,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Mt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof pi&&Er(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(At),xi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},bi=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},wi=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Ti(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map((function(t){var i=xi[t.type].BYTES_PER_ELEMENT,a=r=ki(r,Math.max(e,i)),o=t.components||1;return n=Math.max(n,i),r+=i*o,{name:t.name,type:t.type,components:o,offset:a}})),size:ki(r,Math.max(n,e)),alignment:e}}function ki(t,e){return Math.ceil(t/e)*e}wi.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},wi.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},wi.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},wi.prototype.clear=function(){this.length=0},wi.prototype.resize=function(t){this.reserve(t),this.length=t},wi.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},wi.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Ai=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(wi);Ai.prototype.bytesPerElement=4,On("StructArrayLayout2i4",Ai);var Mi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,t},e}(wi);Mi.prototype.bytesPerElement=8,On("StructArrayLayout4i8",Mi);var Si=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(wi);Si.prototype.bytesPerElement=12,On("StructArrayLayout2i4i12",Si);var Ci=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=a,this.uint8[l+7]=o,t},e}(wi);Ci.prototype.bytesPerElement=8,On("StructArrayLayout2i4ub8",Ci);var Li=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,u){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,a,o,s,l,u)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u,c){var p=9*t,h=18*t;return this.uint16[p+0]=e,this.uint16[p+1]=r,this.uint16[p+2]=n,this.uint16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=l,this.uint8[h+16]=u,this.uint8[h+17]=c,t},e}(wi);Li.prototype.bytesPerElement=18,On("StructArrayLayout8ui2ub18",Li);var Ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,u,c,p){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,a,o,s,l,u,c,p)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u,c,p,h){var f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=a,this.uint16[f+5]=o,this.uint16[f+6]=s,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=p,this.int16[f+11]=h,t},e}(wi);Ei.prototype.bytesPerElement=24,On("StructArrayLayout4i4ui4i24",Ei);var Ii=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(wi);Ii.prototype.bytesPerElement=12,On("StructArrayLayout3f12",Ii);var zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(wi);zi.prototype.bytesPerElement=4,On("StructArrayLayout1ul4",zi);var Pi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l){var u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,a,o,s,l)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u){var c=10*t,p=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=a,this.int16[c+5]=o,this.uint32[p+3]=s,this.uint16[c+8]=l,this.uint16[c+9]=u,t},e}(wi);Pi.prototype.bytesPerElement=20,On("StructArrayLayout6i1ul2ui20",Pi);var Di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(wi);Di.prototype.bytesPerElement=12,On("StructArrayLayout2i2i2i12",Di);var Oi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i)},e.prototype.emplace=function(t,e,r,n,i,a){var o=4*t,s=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[s+6]=i,this.int16[s+7]=a,t},e}(wi);Oi.prototype.bytesPerElement=16,On("StructArrayLayout2f1f2i16",Oi);var Ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=12*t,o=3*t;return this.uint8[a+0]=e,this.uint8[a+1]=r,this.float32[o+1]=n,this.float32[o+2]=i,t},e}(wi);Ri.prototype.bytesPerElement=12,On("StructArrayLayout2ub2f12",Ri);var Fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(wi);Fi.prototype.bytesPerElement=6,On("StructArrayLayout3ui6",Fi);var Bi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,y){var g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,y)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,y,g){var v=24*t,_=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=n,this.uint16[v+3]=i,this.uint32[_+2]=a,this.uint32[_+3]=o,this.uint32[_+4]=s,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=c,this.float32[_+7]=p,this.float32[_+8]=h,this.uint8[x+36]=f,this.uint8[x+37]=d,this.uint8[x+38]=m,this.uint32[_+10]=y,this.int16[v+22]=g,t},e}(wi);Bi.prototype.bytesPerElement=48,On("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Bi);var Ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,y,g,v,_,x,b,w,T,k,A,M,S){var C=this.length;return this.resize(C+1),this.emplace(C,t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,y,g,v,_,x,b,w,T,k,A,M,S)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,y,g,v,_,x,b,w,T,k,A,M,S,C){var L=34*t,E=17*t;return this.int16[L+0]=e,this.int16[L+1]=r,this.int16[L+2]=n,this.int16[L+3]=i,this.int16[L+4]=a,this.int16[L+5]=o,this.int16[L+6]=s,this.int16[L+7]=l,this.uint16[L+8]=u,this.uint16[L+9]=c,this.uint16[L+10]=p,this.uint16[L+11]=h,this.uint16[L+12]=f,this.uint16[L+13]=d,this.uint16[L+14]=m,this.uint16[L+15]=y,this.uint16[L+16]=g,this.uint16[L+17]=v,this.uint16[L+18]=_,this.uint16[L+19]=x,this.uint16[L+20]=b,this.uint16[L+21]=w,this.uint16[L+22]=T,this.uint32[E+12]=k,this.float32[E+13]=A,this.float32[E+14]=M,this.float32[E+15]=S,this.float32[E+16]=C,t},e}(wi);Ni.prototype.bytesPerElement=68,On("StructArrayLayout8i15ui1ul4f68",Ni);var Ui=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(wi);Ui.prototype.bytesPerElement=4,On("StructArrayLayout1f4",Ui);var ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(wi);ji.prototype.bytesPerElement=6,On("StructArrayLayout3i6",ji);var Vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t},e}(wi);Vi.prototype.bytesPerElement=8,On("StructArrayLayout1ul2ui8",Vi);var qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(wi);qi.prototype.bytesPerElement=4,On("StructArrayLayout2ui4",qi);var Hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(wi);Hi.prototype.bytesPerElement=2,On("StructArrayLayout1ui2",Hi);var Zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(wi);Zi.prototype.bytesPerElement=8,On("StructArrayLayout2f8",Zi);var Gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,t},e}(wi);Gi.prototype.bytesPerElement=16,On("StructArrayLayout4f16",Gi);var Xi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(bi);Xi.prototype.size=20;var Wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Xi(this,t)},e}(Pi);On("CollisionBoxArray",Wi);var Yi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(bi);Yi.prototype.size=48;var Ki=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Yi(this,t)},e}(Bi);On("PlacedSymbolArray",Ki);var Ji=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(bi);Ji.prototype.size=68;var Qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ji(this,t)},e}(Ni);On("SymbolInstanceArray",Qi);var $i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Ui);On("GlyphOffsetArray",$i);var ta=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(ji);On("SymbolLineVertexArray",ta);var ea=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(bi);ea.prototype.size=8;var ra=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new ea(this,t)},e}(Vi);On("FeatureIndexArray",ra);var na=Ti([{name:"a_pos",components:2,type:"Int16"}],4).members,ia=function(t){void 0===t&&(t=[]),this.segments=t};function aa(t,e){return 256*(t=l(Math.floor(t),0,255))+l(Math.floor(e),0,255)}ia.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>ia.MAX_VERTEX_ARRAY_LENGTH&&b("Max vertices per segment is "+ia.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>ia.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i},ia.prototype.get=function(){return this.segments},ia.prototype.destroy=function(){for(var t=0,e=this.segments;t>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),la=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,a=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&t.charCodeAt(a+2))<<16;case 2:i^=(255&t.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),ua=sa,ca=la;ua.murmur3=sa,ua.murmur2=ca;var pa=function(){this.ids=[],this.positions=[],this.indexed=!1};pa.prototype.add=function(t,e,r,n){this.ids.push(fa(t)),this.positions.push(e,r,n)},pa.prototype.getPositions=function(t){for(var e=fa(t),r=0,n=this.ids.length-1;r>1;this.ids[i]>=e?n=i:r=i+1}for(var a=[];this.ids[r]===e;)a.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return a},pa.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,i){for(;n>1],o=n-1,s=i+1;;){do{o++}while(e[o]a);if(o>=s)break;da(e,o,s),da(r,3*o,3*s),da(r,3*o+1,3*s+1),da(r,3*o+2,3*s+2)}s-nDa.max||o.yDa.max)&&(b("Geometry exceeds allowed extent, reduce your vector tile buffer size"),o.x=l(o.x,Da.min,Da.max),o.y=l(o.y,Da.min,Da.max))}return r}function Ra(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var Fa=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ai,this.indexArray=new Fi,this.segments=new ia,this.programConfigurations=new Ia(na,t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Ba(t,e){for(var r=0;r1){if(Va(t,e))return!0;for(var n=0;n1?r:r.sub(e)._mult(i)._add(e))}function Ga(t,e){for(var r,n,i,a=!1,o=0;oe.y!=(i=r[l]).y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);return a}function Xa(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}function Wa(t,e,r){var n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return!1;var a=w(t,e,r[0]);return a!==w(t,e,r[1])||a!==w(t,e,r[2])||a!==w(t,e,r[3])}function Ya(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ka(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ja(t,e,r,n,a){if(!e[0]&&!e[1])return t;var o=i.convert(e)._mult(a);"viewport"===r&&o._rotate(-n);for(var s=[],l=0;l=8192||c<0||c>=8192)){var p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),h=p.vertexLength;Ra(this.layoutVertexArray,u,c,-1,-1),Ra(this.layoutVertexArray,u,c,1,-1),Ra(this.layoutVertexArray,u,c,1,1),Ra(this.layoutVertexArray,u,c,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),p.vertexLength+=4,p.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)},On("CircleBucket",Fa,{omit:["layers"]});var Qa=new vi({"circle-sort-key":new di(Mt.layout_circle["circle-sort-key"])}),$a={paint:new vi({"circle-radius":new di(Mt.paint_circle["circle-radius"]),"circle-color":new di(Mt.paint_circle["circle-color"]),"circle-blur":new di(Mt.paint_circle["circle-blur"]),"circle-opacity":new di(Mt.paint_circle["circle-opacity"]),"circle-translate":new fi(Mt.paint_circle["circle-translate"]),"circle-translate-anchor":new fi(Mt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new fi(Mt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new fi(Mt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new di(Mt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new di(Mt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new di(Mt.paint_circle["circle-stroke-opacity"])}),layout:Qa},to="undefined"!=typeof Float32Array?Float32Array:Array;function eo(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ro(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],m=e[12],y=e[13],g=e[14],v=e[15],_=r[0],x=r[1],b=r[2],w=r[3];return t[0]=_*n+x*s+b*p+w*m,t[1]=_*i+x*l+b*h+w*y,t[2]=_*a+x*u+b*f+w*g,t[3]=_*o+x*c+b*d+w*v,t[4]=(_=r[4])*n+(x=r[5])*s+(b=r[6])*p+(w=r[7])*m,t[5]=_*i+x*l+b*h+w*y,t[6]=_*a+x*u+b*f+w*g,t[7]=_*o+x*c+b*d+w*v,t[8]=(_=r[8])*n+(x=r[9])*s+(b=r[10])*p+(w=r[11])*m,t[9]=_*i+x*l+b*h+w*y,t[10]=_*a+x*u+b*f+w*g,t[11]=_*o+x*c+b*d+w*v,t[12]=(_=r[12])*n+(x=r[13])*s+(b=r[14])*p+(w=r[15])*m,t[13]=_*i+x*l+b*h+w*y,t[14]=_*a+x*u+b*f+w*g,t[15]=_*o+x*c+b*d+w*v,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var no,io=ro;function ao(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}no=new to(3),to!=Float32Array&&(no[0]=0,no[1]=0,no[2]=0),function(){var t=new to(4);to!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var oo=(function(){var t=new to(2);to!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,$a)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Fa(t)},e.prototype.queryRadius=function(t){var e=t;return Ya("circle-radius",this,e)+Ya("circle-stroke-width",this,e)+Ka(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,a,o,s){for(var l=Ja(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,o),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),p=c?l:function(t,e){return t.map((function(t){return so(t,e)}))}(l,s),h=c?u*o:u,f=0,d=n;ft.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,l=0;l80*r){n=a=t[0],i=o=t[1];for(var d=r;da&&(a=s),l>o&&(o=l);u=0!==(u=Math.max(a-n,o-i))?1/u:0}return Mo(h,f,r,n,i,u),f}function ko(t,e,r,n,i){var a,o;if(i===Wo(t,e,r,n)>0)for(a=e;a=e;a-=n)o=Zo(a,t[a],t[a+1],o);return o&&No(o,o.next)&&(Go(o),o=o.next),o}function Ao(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!No(n,n.next)&&0!==Bo(n.prev,n,n.next))n=n.next;else{if(Go(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function Mo(t,e,r,n,i,a,o){if(t){!o&&a&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Do(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,u=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1)}(i)}(t,n,i,a);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?Co(t,n,i,a):So(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),Go(t),t=l.next,u=l.next;else if((t=l)===u){o?1===o?Mo(t=Lo(Ao(t),e,r),e,r,n,i,a,2):2===o&&Eo(t,e,r,n,i,a):Mo(Ao(t),e,r,n,i,a,1);break}}}function So(t){var e=t.prev,r=t,n=t.next;if(Bo(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Ro(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Bo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Co(t,e,r,n){var i=t.prev,a=t,o=t.next;if(Bo(i,a,o)>=0)return!1;for(var s=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,l=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,u=Do(i.x=u&&h&&h.z<=c;){if(p!==t.prev&&p!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Bo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,h!==t.prev&&h!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Bo(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Bo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;h&&h.z<=c;){if(h!==t.prev&&h!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Bo(h.prev,h,h.next)>=0)return!1;h=h.nextZ}return!0}function Lo(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!No(i,a)&&Uo(i,n,n.next,a)&&qo(i,a)&&qo(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),Go(n),Go(n.next),n=t=a),n=n.next}while(n!==t);return Ao(n)}function Eo(t,e,r,n,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Fo(o,s)){var l=Ho(o,s);return o=Ao(o,o.next),l=Ao(l,l.next),Mo(o,e,r,n,i,a),void Mo(l,e,r,n,i,a)}s=s.next}o=o.next}while(o!==t)}function Io(t,e){return t.x-e.x}function zo(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&Ro(ar.x||n.x===r.x&&Po(r,n)))&&(r=n,h=l)),n=n.next}while(n!==u);return r}(t,e)){var r=Ho(e,t);Ao(e,e.next),Ao(r,r.next)}}function Po(t,e){return Bo(t.prev,t,e.prev)<0&&Bo(e.next,t,t.next)<0}function Do(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Oo(t){var e=t,r=t;do{(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function Fo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Uo(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(qo(t,e)&&qo(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Bo(t.prev,t,e.prev)||Bo(t,e.prev,e))||No(t,e)&&Bo(t.prev,t,t.next)>0&&Bo(e.prev,e,e.next)>0)}function Bo(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function No(t,e){return t.x===e.x&&t.y===e.y}function Uo(t,e,r,n){var i=Vo(Bo(t,e,r)),a=Vo(Bo(t,e,n)),o=Vo(Bo(r,n,t)),s=Vo(Bo(r,n,e));return i!==a&&o!==s||!(0!==i||!jo(t,r,e))||!(0!==a||!jo(t,n,e))||!(0!==o||!jo(r,t,n))||!(0!==s||!jo(r,e,n))}function jo(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Vo(t){return t>0?1:t<0?-1:0}function qo(t,e){return Bo(t.prev,t,t.next)<0?Bo(t,e,t.next)>=0&&Bo(t,t.prev,e)>=0:Bo(t,e,t.prev)<0||Bo(t,t.next,e)<0}function Ho(t,e){var r=new Xo(t.i,t.x,t.y),n=new Xo(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function Zo(t,e,r,n){var i=new Xo(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Go(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Xo(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Wo(t,e,r,n){for(var i=0,a=e,o=r-n;an;){if(i-n>600){var o=i-n+1,s=r-n+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(s-o/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*u/o+c)),Math.min(i,Math.floor(r+(o-s)*u/o+c)),a)}var p=e[r],h=n,f=i;for(Ko(e,n,r),a(e[i],p)>0&&Ko(e,n,i);h0;)f--}0===a(e[n],p)?Ko(e,n,f):Ko(e,++f,i),f<=r&&(n=f+1),r<=f&&(i=f-1)}}(t,e,r||0,n||t.length-1,i||Jo)}function Ko(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Jo(t,e){return te?1:0}function Qo(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,a=[],o=0;o1)for(var l=0;l0&&r.holes.push(n+=t[i-1].length)}return r},bo.default=wo;var rs=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ai,this.indexArray=new Fi,this.indexArray2=new qi,this.programConfigurations=new Ia(xo,t.layers,t.zoom),this.segments=new ia,this.segments2=new ia,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};rs.prototype.populate=function(t,e,r){this.hasPattern=ts("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),i=[],a=0,o=t;a>3}if(a--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&l.push(e),e=[]),e.push(new i(o,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&l.push(e),l},ls.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,a=0,o=1/0,s=-1/0,l=1/0,u=-1/0;t.pos>3}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(a+=t.readSVarint())u&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},ls.prototype.toGeoJSON=function(t,e,r){var n,i,a=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=ls.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function ds(t,e,r){if(3===t){var n=new ps(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}hs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ss(this._pbf,e,this.extent,this._keys,this._values)};var ms={VectorTile:function(t,e){this.layers=t.readFields(ds,{},e)},VectorTileFeature:ss,VectorTileLayer:ps},ys=ms.VectorTileFeature.types,gs=Math.pow(2,13);function vs(t,e,r,n,i,a,o,s){t.emplaceBack(e,r,2*Math.floor(n*gs)+o,i*gs*2,a*gs*2,Math.round(s))}var _s=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Si,this.indexArray=new Fi,this.programConfigurations=new Ia(os,t.layers,t.zoom),this.segments=new ia,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function xs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}_s.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=ts("fill-extrusion",this.layers,e);for(var n=0,i=t;n8192}))||z.every((function(t){return t.y<0}))||z.every((function(t){return t.y>8192}))))for(var m=0,y=0;y=1){var v=d[y-1];if(!xs(g,v)){p.vertexLength+4>ia.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var _=g.sub(v)._perp()._unit(),x=v.dist(g);m+x>32768&&(m=0),vs(this.layoutVertexArray,g.x,g.y,_.x,_.y,0,0,m),vs(this.layoutVertexArray,g.x,g.y,_.x,_.y,0,1,m),vs(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,0,m+=x),vs(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,1,m);var b=p.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),p.vertexLength+=4,p.primitiveLength+=2}}}}if(p.vertexLength+l>ia.MAX_VERTEX_ARRAY_LENGTH&&(p=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),"Polygon"===ys[t.type]){for(var w=[],T=[],k=p.vertexLength,A=0,M=s;A=2&&t[l-1].equals(t[l-2]);)l--;for(var u=0;u0;if(T&&g>u){var A=c.dist(f);if(A>2*p){var M=c.sub(c.sub(f)._mult(p/A)._round());this.updateDistance(f,M),this.addCurrentVertex(M,m,0,0,h),f=M}}var S=f&&d,C=S?r:s?"butt":n;if(S&&"round"===C&&(bi&&(C="bevel"),"bevel"===C&&(b>2&&(C="flipbevel"),b100)v=y.mult(-1);else{var L=b*m.add(y).mag()/m.sub(y).mag();v._perp()._mult(L*(k?-1:1))}this.addCurrentVertex(c,v,0,0,h),this.addCurrentVertex(c,v.mult(-1),0,0,h)}else if("bevel"===C||"fakeround"===C){var E=-Math.sqrt(b*b-1),I=k?E:0,z=k?0:E;if(f&&this.addCurrentVertex(c,m,I,z,h),"fakeround"===C)for(var P=Math.round(180*w/Math.PI/20),D=1;D2*p){var U=c.add(d.sub(c)._mult(p/N)._round());this.updateDistance(c,U),this.addCurrentVertex(U,y,0,0,h),c=U}}}}},Ls.prototype.addCurrentVertex=function(t,e,r,n,i,a){void 0===a&&(a=!1);var o=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,a,!1,r,i),this.addHalfVertex(t,o,s,a,!0,-n,i),this.distance>Cs/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,a))},Ls.prototype.addHalfVertex=function(t,e,r,n,i,a,o){var s=.5*this.scaledDistance;this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&s)<<2,s>>6);var l=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),o.primitiveLength++),i?this.e2=l:this.e1=l},Ls.prototype.updateScaledDistance=function(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(Cs-1):this.distance},Ls.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},On("LineBucket",Ls,{omit:["layers","patternFeatures"]});var Es=new vi({"line-cap":new fi(Mt.layout_line["line-cap"]),"line-join":new di(Mt.layout_line["line-join"]),"line-miter-limit":new fi(Mt.layout_line["line-miter-limit"]),"line-round-limit":new fi(Mt.layout_line["line-round-limit"]),"line-sort-key":new di(Mt.layout_line["line-sort-key"])}),Is={paint:new vi({"line-opacity":new di(Mt.paint_line["line-opacity"]),"line-color":new di(Mt.paint_line["line-color"]),"line-translate":new fi(Mt.paint_line["line-translate"]),"line-translate-anchor":new fi(Mt.paint_line["line-translate-anchor"]),"line-width":new di(Mt.paint_line["line-width"]),"line-gap-width":new di(Mt.paint_line["line-gap-width"]),"line-offset":new di(Mt.paint_line["line-offset"]),"line-blur":new di(Mt.paint_line["line-blur"]),"line-dasharray":new yi(Mt.paint_line["line-dasharray"]),"line-pattern":new mi(Mt.paint_line["line-pattern"]),"line-gradient":new gi(Mt.paint_line["line-gradient"])}),layout:Es},zs=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new ii(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=c({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(di))(Is.paint.properties["line-width"].specification);zs.useIntegerZoom=!0;var Ps=function(t){function e(e){t.call(this,e,Is)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){this.gradient=yo(this._transitionablePaint._values["line-gradient"].value.expression,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=zs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Ls(t)},e.prototype.queryRadius=function(t){var e=t,r=Ds(Ya("line-width",this,e),Ya("line-gap-width",this,e)),n=Ya("line-offset",this,e);return r/2+Math.abs(n)+Ka(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,a,o,s){var l=Ja(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),u=s/2*Ds(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),c=this.paint.get("line-offset").evaluate(e,r);return c&&(n=function(t,e){for(var r=[],n=new i(0,0),a=0;a=3)for(var a=0;a0?e+2*t:t}var Os=Ti([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Rs=Ti([{name:"a_projected_pos",components:3,type:"Float32"}],4),Fs=(Ti([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Ti([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Bs=(Ti([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ti([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Ns=Ti([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Us(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),ni.applyArabicShaping&&(t=ni.applyArabicShaping(t)),t}(t.text,e,r)})),t}Ti([{name:"triangle",components:3,type:"Uint16"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ti([{type:"Float32",name:"offsetX"}]),Ti([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var js={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"},Vs=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,p=r?i-1:0,h=r?-1:1,f=t[e+p];for(p+=h,a=f&(1<<-c)-1,f>>=-c,c+=s;c>0;a=256*a+t[e+p],p+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+p],p+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),a-=u}return(f?-1:1)*o*Math.pow(2,a-n)},qs=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,f=n?0:a-1,d=n?1:-1,m=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+p>=1?h/l:h*Math.pow(2,1-p))*l>=2&&(o++,l/=2),o+p>=c?(s=0,o=c):o+p>=1?(s=(e*l-1)*Math.pow(2,i),o+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(o=o<0;t[r+f]=255&o,f+=d,o/=256,u-=8);t[r+f-d]|=128*m},Hs=Zs;function Zs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Zs.Varint=0,Zs.Fixed64=1,Zs.Bytes=2,Zs.Fixed32=5;var Gs="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Xs(t){return t.type===Zs.Bytes?t.readVarint()+t.pos:t.pos+1}function Ws(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ys(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Ks(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function sl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ll(t,e,r){1===t&&r.readMessage(ul,e)}function ul(t,e,r){if(3===t){var n=r.readMessage(cl,{}),i=n.width,a=n.height,o=n.left,s=n.top,l=n.advance;e.push({id:n.id,bitmap:new ho({width:i+6,height:a+6},n.bitmap),metrics:{width:i,height:a,left:o,top:s,advance:l}})}}function cl(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function pl(t){for(var e=0,r=0,n=0,i=t;n=0;h--){var f=o[h];if(!(p.w>f.w||p.h>f.h)){if(p.x=f.x,p.y=f.y,l=Math.max(l,p.y+p.h),s=Math.max(s,p.x+p.w),p.w===f.w&&p.h===f.h){var d=o.pop();h>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=al(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=sl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=al(this.buf,this.pos)+4294967296*al(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=al(this.buf,this.pos)+4294967296*sl(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Vs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Vs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,a=r.buf;if(n=(112&(i=a[r.pos++]))>>4,i<128)return Ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<3,i<128)return Ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<10,i<128)return Ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<17,i<128)return Ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<24,i<128)return Ws(t,n,e);if(n|=(1&(i=a[r.pos++]))<<31,i<128)return Ws(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Gs?function(t,e,r){return Gs.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(a=t[i+1]))&&(u=(31&l)<<6|63&a)<=127&&(u=null):3===c?(o=t[i+2],128==(192&(a=t[i+1]))&&128==(192&o)&&((u=(15&l)<<12|(63&a)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=t[i+2],s=t[i+3],128==(192&(a=t[i+1]))&&128==(192&o)&&128==(192&s)&&((u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Zs.Bytes)return t.push(this.readVarint(e));var r=Xs(this);for(t=t||[];this.pos127;);else if(e===Zs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Zs.Fixed32)this.pos+=4;else{if(e!==Zs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Ys(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),qs(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),qs(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Ys(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Zs.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ks,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Js,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Qs,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,$s,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,il,e)},writeBytesField:function(t,e){this.writeTag(t,Zs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Zs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Zs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Zs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var hl=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,a=e.stretchY,o=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=a,this.content=o,this.version=n},fl={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};fl.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},fl.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},fl.tlbr.get=function(){return this.tl.concat(this.br)},fl.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(hl.prototype,fl);var dl=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var a=pl(i),o=new fo({width:a.w||1,height:a.h||1});for(var s in t){var l=t[s],u=r[s].paddedRect;fo.copy(l.data,o,{x:0,y:0},{x:u.x+1,y:u.y+1},l.data)}for(var c in e){var p=e[c],h=n[c].paddedRect,f=h.x+1,d=h.y+1,m=p.data.width,y=p.data.height;fo.copy(p.data,o,{x:0,y:0},{x:f,y:d},p.data),fo.copy(p.data,o,{x:0,y:y-1},{x:f,y:d-1},{width:m,height:1}),fo.copy(p.data,o,{x:0,y:0},{x:f,y:d+y},{width:m,height:1}),fo.copy(p.data,o,{x:m-1,y:0},{x:f-1,y:d},{width:1,height:y}),fo.copy(p.data,o,{x:0,y:0},{x:f+m,y:d},{width:1,height:y})}this.image=o,this.iconPositions=r,this.patternPositions=n};dl.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(a),e[n]=new hl(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},dl.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},dl.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]})}},On("ImagePosition",hl),On("ImageAtlas",dl);var ml={horizontal:1,vertical:2,horizontalOnly:3},yl=function(){this.scale=1,this.fontStack="",this.imageName=null};yl.forText=function(t,e){var r=new yl;return r.scale=t||1,r.fontStack=e,r},yl.forImage=function(t){var e=new yl;return e.imageName=t,e};var gl=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function vl(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m){var y,g=gl.fromFeature(t,i);p===ml.vertical&&g.verticalizePunctuation();var v=ni.processBidirectionalText,_=ni.processStyledBidirectionalText;if(v&&1===g.sections.length){y=[];for(var x=0,b=v(g.toString(),Al(g,u,a,e,n,f,d));x0&&B>A&&(A=B)}else{var N=r[S.fontStack],U=N&&N[L];if(U&&U.rect)z=U.rect,I=U.metrics;else{var j=e[S.fontStack],V=j&&j[L];if(!V)continue;I=V.metrics}E=24*(b-S.scale)}O?(t.verticalizable=!0,k.push({glyph:L,imageName:P,x:h,y:f+E,vertical:O,scale:S.scale,fontStack:S.fontStack,sectionIndex:C,metrics:I,rect:z}),h+=D*S.scale+u):(k.push({glyph:L,imageName:P,x:h,y:f+E,vertical:O,scale:S.scale,fontStack:S.fontStack,sectionIndex:C,metrics:I,rect:z}),h+=I.advance*S.scale+u)}0!==k.length&&(d=Math.max(h-u,d),Sl(k,0,k.length-1,y,A)),h=0;var q=a*b+A;T.lineOffset=Math.max(A,w),f+=q,m=Math.max(q,m),++g}else f+=a,++g}var H,Z=f- -17,G=Ml(o),X=G.horizontalAlign,W=G.verticalAlign;(function(t,e,r,n,i,a,o,s,l){var u,c=(e-r)*i;u=a!==o?-s*n- -17:(-n*l+.5)*o;for(var p=0,h=t;p=0&&n>=t&&_l[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},gl.prototype.substring=function(t,e){var r=new gl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},gl.prototype.toString=function(){return this.text},gl.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},gl.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(yl.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var _l={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},xl={};function bl(t,e,r,n,i,a){if(e.imageName){var o=n[e.imageName];return o?o.displaySize[0]*e.scale*24/a+i:0}var s=r[e.fontStack],l=s&&s[t];return l?l.metrics.advance*e.scale+i:0}function wl(t,e,r,n){var i=Math.pow(t-e,2);return n?t=0,p=0,h=0;h-r/2;){if(--o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],u=0;sn;)u-=l.shift().angleDelta;if(u>i)return!1;o++,s+=c.dist(p)}return!0}function Ol(t){for(var e=0,r=0;ru){var d=(u-l)/f,m=je(p.x,h.x,d),y=je(p.y,h.y,d),g=new Ll(m,y,h.angleTo(p),c);return g._round(),!o||Dl(t,g,s,o,e)?g:void 0}l+=f}}function Nl(t,e,r,n,i,a,o,s,l){var u=Rl(n,a,o),c=Fl(n,i),p=c*o,h=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-p=0&&b=0&&w=0&&f+c<=p){var T=new Ll(b,w,_,m);T._round(),i&&!Dl(e,T,o,i,a)||d.push(T)}}h+=v}return l||d.length||s||(d=t(e,h/2,n,i,a,o,s,!0,u)),d}(t,h?e/2*s%e:(c/2+2*a)*o*s%e,e,u,r,p,h,!1,l)}function Ul(t,e,r,n,a){for(var o=[],s=0;s=n&&h.x>=n||(p.x>=n?p=new i(n,p.y+(n-p.x)/(h.x-p.x)*(h.y-p.y))._round():h.x>=n&&(h=new i(n,p.y+(n-p.x)/(h.x-p.x)*(h.y-p.y))._round()),p.y>=a&&h.y>=a||(p.y>=a?p=new i(p.x+(a-p.y)/(h.y-p.y)*(h.x-p.x),a)._round():h.y>=a&&(h=new i(p.x+(a-p.y)/(h.y-p.y)*(h.x-p.x),a)._round()),u&&p.equals(u[u.length-1])||o.push(u=[p]),u.push(h)))))}return o}function jl(t,e,r,n){var a=[],o=t.image,s=o.pixelRatio,l=o.paddedRect.w-2,u=o.paddedRect.h-2,c=t.right-t.left,p=t.bottom-t.top,h=o.stretchX||[[0,l]],f=o.stretchY||[[0,u]],d=function(t,e){return t+e[1]-e[0]},m=h.reduce(d,0),y=f.reduce(d,0),g=l-m,v=u-y,_=0,x=m,b=0,w=y,T=0,k=g,A=0,M=v;if(o.content&&n){var S=o.content;_=Vl(h,0,S[0]),b=Vl(f,0,S[1]),x=Vl(h,S[0],S[2]),w=Vl(f,S[1],S[3]),T=S[0]-_,A=S[1]-b,k=S[2]-S[0]-x,M=S[3]-S[1]-w}var C=function(n,a,l,u){var h=Hl(n.stretch-_,x,c,t.left),f=Zl(n.fixed-T,k,n.stretch,m),d=Hl(a.stretch-b,w,p,t.top),g=Zl(a.fixed-A,M,a.stretch,y),v=Hl(l.stretch-_,x,c,t.left),S=Zl(l.fixed-T,k,l.stretch,m),C=Hl(u.stretch-b,w,p,t.top),L=Zl(u.fixed-A,M,u.stretch,y),E=new i(h,d),I=new i(v,d),z=new i(v,C),P=new i(h,C),D=new i(f/s,g/s),O=new i(S/s,L/s),R=e*Math.PI/180;if(R){var F=Math.sin(R),B=Math.cos(R),N=[B,-F,F,B];E._matMult(N),I._matMult(N),P._matMult(N),z._matMult(N)}var U=n.stretch+n.fixed,j=a.stretch+a.fixed;return{tl:E,tr:I,bl:P,br:z,tex:{x:o.paddedRect.x+1+U,y:o.paddedRect.y+1+j,w:l.stretch+l.fixed-U,h:u.stretch+u.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:O,minFontScaleX:k/s/c,minFontScaleY:M/s/p,isSDF:r}};if(n&&(o.stretchX||o.stretchY))for(var L=ql(h,g,m),E=ql(f,v,y),I=0;I0&&(d=Math.max(10,d),this.circleDiameter=d)}else{var m=o.top*s-l,y=o.bottom*s+l,g=o.left*s-l,v=o.right*s+l,_=o.collisionPadding;if(_&&(g-=_[0]*s,m-=_[1]*s,v+=_[2]*s,y+=_[3]*s),c){var x=new i(g,m),b=new i(v,m),w=new i(g,y),T=new i(v,y),k=c*Math.PI/180;x._rotate(k),b._rotate(k),w._rotate(k),T._rotate(k),g=Math.min(x.x,b.x,w.x,T.x),v=Math.max(x.x,b.x,w.x,T.x),m=Math.min(x.y,b.y,w.y,T.y),y=Math.max(x.y,b.y,w.y,T.y)}t.emplaceBack(e.x,e.y,g,m,v,y,r,n,a)}this.boxEndIndex=t.length},Xl=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=Wl),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function Wl(t,e){return te?1:0}function Yl(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,a=1/0,o=-1/0,s=-1/0,l=t[0],u=0;uo)&&(o=c.x),(!u||c.y>s)&&(s=c.y)}var p=Math.min(o-n,s-a),h=p/2,f=new Xl([],Kl);if(0===p)return new i(n,a);for(var d=n;dy.d||!y.d)&&(y=v,r&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,g)),v.max-y.d<=e||(f.push(new Jl(v.p.x-(h=v.h/2),v.p.y-h,h,t)),f.push(new Jl(v.p.x+h,v.p.y-h,h,t)),f.push(new Jl(v.p.x-h,v.p.y+h,h,t)),f.push(new Jl(v.p.x+h,v.p.y+h,h,t)),g+=4)}return r&&(console.log("num probes: "+g),console.log("best distance: "+y.d)),y.p}function Kl(t,e){return e.max-t.max}function Jl(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,Za(t,u,c))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}Xl.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},Xl.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},Xl.prototype.peek=function(){return this.data[0]},Xl.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i}e[t]=n},Xl.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=o,t=a}e[t]=i};var Ql=Number.POSITIVE_INFINITY;function $l(t,e){return e[1]!==Ql?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function tu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eu(t,e,r,n,a,o,s,l,u,c,p,h,f,d,m){var y=function(t,e,r,n,a,o,s,l){for(var u=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,c=[],p=0,h=e.positionedLines;p32640&&b(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===g.kind&&((v=[128*d.compositeTextSizes[0].evaluate(s,{},m),128*d.compositeTextSizes[1].evaluate(s,{},m)])[0]>32640||v[1]>32640)&&b(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,y,v,l,o,s,c,e,u.lineStartIndex,u.lineLength,f,m);for(var _=0,x=p;_=0;o--)if(n.dist(a[o])0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],l||u){for(var p=e.iconDependencies,h=e.glyphDependencies,f=e.availableImages,d=new ii(this.zoom),m=0,y=t;m=0;for(var P=0,D=k.sections;P=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var l=0;l0},pu.prototype.hasIconData=function(){return this.icon.segments.get().length>0},pu.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},pu.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},pu.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},pu.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},On("SymbolBucket",pu,{omit:["layers","collisionBoxArray","features","compareText"]}),pu.MAX_GLYPHS=65535,pu.addDynamicAttributes=su;var hu=new vi({"symbol-placement":new fi(Mt.layout_symbol["symbol-placement"]),"symbol-spacing":new fi(Mt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new fi(Mt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new di(Mt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new fi(Mt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new fi(Mt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new fi(Mt.layout_symbol["icon-ignore-placement"]),"icon-optional":new fi(Mt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new fi(Mt.layout_symbol["icon-rotation-alignment"]),"icon-size":new di(Mt.layout_symbol["icon-size"]),"icon-text-fit":new fi(Mt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new fi(Mt.layout_symbol["icon-text-fit-padding"]),"icon-image":new di(Mt.layout_symbol["icon-image"]),"icon-rotate":new di(Mt.layout_symbol["icon-rotate"]),"icon-padding":new fi(Mt.layout_symbol["icon-padding"]),"icon-keep-upright":new fi(Mt.layout_symbol["icon-keep-upright"]),"icon-offset":new di(Mt.layout_symbol["icon-offset"]),"icon-anchor":new di(Mt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new fi(Mt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new fi(Mt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new fi(Mt.layout_symbol["text-rotation-alignment"]),"text-field":new di(Mt.layout_symbol["text-field"]),"text-font":new di(Mt.layout_symbol["text-font"]),"text-size":new di(Mt.layout_symbol["text-size"]),"text-max-width":new di(Mt.layout_symbol["text-max-width"]),"text-line-height":new fi(Mt.layout_symbol["text-line-height"]),"text-letter-spacing":new di(Mt.layout_symbol["text-letter-spacing"]),"text-justify":new di(Mt.layout_symbol["text-justify"]),"text-radial-offset":new di(Mt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new fi(Mt.layout_symbol["text-variable-anchor"]),"text-anchor":new di(Mt.layout_symbol["text-anchor"]),"text-max-angle":new fi(Mt.layout_symbol["text-max-angle"]),"text-writing-mode":new fi(Mt.layout_symbol["text-writing-mode"]),"text-rotate":new di(Mt.layout_symbol["text-rotate"]),"text-padding":new fi(Mt.layout_symbol["text-padding"]),"text-keep-upright":new fi(Mt.layout_symbol["text-keep-upright"]),"text-transform":new di(Mt.layout_symbol["text-transform"]),"text-offset":new di(Mt.layout_symbol["text-offset"]),"text-allow-overlap":new fi(Mt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new fi(Mt.layout_symbol["text-ignore-placement"]),"text-optional":new fi(Mt.layout_symbol["text-optional"])}),fu={paint:new vi({"icon-opacity":new di(Mt.paint_symbol["icon-opacity"]),"icon-color":new di(Mt.paint_symbol["icon-color"]),"icon-halo-color":new di(Mt.paint_symbol["icon-halo-color"]),"icon-halo-width":new di(Mt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new di(Mt.paint_symbol["icon-halo-blur"]),"icon-translate":new fi(Mt.paint_symbol["icon-translate"]),"icon-translate-anchor":new fi(Mt.paint_symbol["icon-translate-anchor"]),"text-opacity":new di(Mt.paint_symbol["text-opacity"]),"text-color":new di(Mt.paint_symbol["text-color"],{runtimeType:Bt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new di(Mt.paint_symbol["text-halo-color"]),"text-halo-width":new di(Mt.paint_symbol["text-halo-width"]),"text-halo-blur":new di(Mt.paint_symbol["text-halo-blur"]),"text-translate":new fi(Mt.paint_symbol["text-translate"]),"text-translate-anchor":new fi(Mt.paint_symbol["text-translate-anchor"])}),layout:hu},du=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Dt,this.defaultValue=t};du.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},du.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},du.prototype.outputDefined=function(){return!1},du.prototype.serialize=function(){return null},On("FormatSectionOverride",du,{omit:["defaultValue"]});var mu=function(t){function e(e){t.call(this,e,fu)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],a=0,o=n;a",targetMapId:n,sourceMapId:a.mapId})}}},Lu.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else k()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},Lu.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Lu.prototype.processTask=function(t,e){var r=this;if(""===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(Un(e.error)):n(null,Un(e.data)))}else{var i=!1,a=S(this.globalScope)?void 0:[],o=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"",sourceMapId:r.mapId,error:e?Nn(e):null,data:Nn(n,a)},a)}:function(t){i=!0},s=null,l=Un(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,l,o);else if(this.parent.getWorkerSource){var u=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,u[0],l.source)[u[1]](l,o)}else o(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Lu.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Iu=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Iu.prototype.setNorthEast=function(t){return this._ne=t instanceof zu?new zu(t.lng,t.lat):zu.convert(t),this},Iu.prototype.setSouthWest=function(t){return this._sw=t instanceof zu?new zu(t.lng,t.lat):zu.convert(t),this},Iu.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof zu)e=t,r=t;else{if(!(t instanceof Iu))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Iu.convert(t)):this.extend(zu.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new zu(e.lng,e.lat),this._ne=new zu(r.lng,r.lat)),this},Iu.prototype.getCenter=function(){return new zu((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Iu.prototype.getSouthWest=function(){return this._sw},Iu.prototype.getNorthEast=function(){return this._ne},Iu.prototype.getNorthWest=function(){return new zu(this.getWest(),this.getNorth())},Iu.prototype.getSouthEast=function(){return new zu(this.getEast(),this.getSouth())},Iu.prototype.getWest=function(){return this._sw.lng},Iu.prototype.getSouth=function(){return this._sw.lat},Iu.prototype.getEast=function(){return this._ne.lng},Iu.prototype.getNorth=function(){return this._ne.lat},Iu.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Iu.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Iu.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Iu.prototype.contains=function(t){var e=zu.convert(t),r=e.lng,n=e.lat,i=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i},Iu.convert=function(t){return!t||t instanceof Iu?t:new Iu(t)};var zu=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};zu.prototype.wrap=function(){return new zu(u(this.lng,-180,180),this.lat)},zu.prototype.toArray=function(){return[this.lng,this.lat]},zu.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},zu.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(i,1))},zu.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Iu(new zu(this.lng-r,this.lat-e),new zu(this.lng+r,this.lat+e))},zu.convert=function(t){if(t instanceof zu)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new zu(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new zu(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var Pu=2*Math.PI*6371008.8;function Du(t){return Pu*Math.cos(t*Math.PI/180)}function Ou(t){return(180+t)/360}function Ru(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Fu(t,e){return t/Du(e)}function Bu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Nu=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};Nu.fromLngLat=function(t,e){void 0===e&&(e=0);var r=zu.convert(t);return new Nu(Ou(r.lng),Ru(r.lat),Fu(e,r.lat))},Nu.prototype.toLngLat=function(){return new zu(360*this.x-180,Bu(this.y))},Nu.prototype.toAltitude=function(){return this.z*Du(Bu(this.y))},Nu.prototype.meterInMercatorCoordinateUnits=function(){return 1/Pu*(t=Bu(this.y),1/Math.cos(t*Math.PI/180));var t};var Uu=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=qu(0,t,t,e,r)};Uu.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Uu.prototype.url=function(t,e){var r,n,i,a,o,s=(n=this.y,i=this.z,a=Eu(256*(r=this.x),256*(n=Math.pow(2,i)-n-1),i),o=Eu(256*(r+1),256*(n+1),i),a[0]+","+a[1]+","+o[0]+","+o[1]),l=function(t,e,r){for(var n,i="",a=t;a>0;a--)i+=(e&(n=1<this.canonical.z?new Vu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Vu.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?qu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):qu(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Vu.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Vu.prototype.children=function(t){if(this.overscaledZ>=t)return[new Vu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Vu(e,this.wrap,e,r,n),new Vu(e,this.wrap,e,r+1,n),new Vu(e,this.wrap,e,r,n+1),new Vu(e,this.wrap,e,r+1,n+1)]},Vu.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Hu.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Hu.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Hu.prototype.getPixels=function(){return new fo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Hu.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,a=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:a=o-1;break;case 1:o=a+1}for(var s=-e*this.dim,l=-r*this.dim,u=a;u=0&&c[3]>=0&&s.insert(o,c[0],c[1],c[2],c[3])}},Yu.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new ms.VectorTile(new Hs(this.rawTileData)).layers,this.sourceLayerCoder=new Zu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Yu.prototype.query=function(t,e,r,n){var a=this;this.loadVTLayers();for(var o=t.params||{},s=8192/t.tileSize/t.scale,l=rn(o.filter),u=t.queryGeometry,c=t.queryPadding*s,p=Ju(u),h=this.grid.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c),f=Ju(t.cameraQueryGeometry),d=0,m=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(function(e,r,n,a){return function(t,e,r,n,a){for(var o=0,s=t;o=l.x&&a>=l.y)return!0}var u=[new i(e,r),new i(e,a),new i(n,a),new i(n,r)];if(t.length>2)for(var c=0,p=u;c=0)return!0;return!1}(a,p)){var h=this.sourceLayerCoder.decode(r),f=this.vtLayers[h].feature(n);if(i.filter(new ii(this.tileID.overscaledZ),f))for(var d=this.getId(f,h),m=0;mn)i=!1;else if(e)if(this.expirationTimeot&&(t.getActor().send("enforceCacheSizeLimit",at),ct=0)},t.clamp=l,t.clearTileCache=function(t){var e=self.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=Ul,t.clone=function(t){var e=new to(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=_,t.clone$2=function(t){var e=new to(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Ns,t.config=F,t.create=function(){var t=new to(16);return to!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new to(9);return to!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new to(4);return to!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=qr,t.createLayout=Ti,t.createStyleLayer=function(t){return"custom"===t.type?new xu(t):new bu[t.type](t)},t.cross=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},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t},t.number=je,t.offscreenCanvasSupported=pt,t.ortho=function(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),u=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(o+a)*u,t[15]=1,t},t.parseGlyphPBF=function(t){return new Hs(t).readFields(ll,[])},t.pbf=Hs,t.performSymbolLayout=function(t,e,r,n,i,a,o){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,l=t.layers[0]._unevaluatedLayout._values,u={};if("composite"===t.textSizeData.kind){var c=t.textSizeData,p=c.maxZoom;u.compositeTextSizes=[l["text-size"].possiblyEvaluate(new ii(c.minZoom),o),l["text-size"].possiblyEvaluate(new ii(p),o)]}if("composite"===t.iconSizeData.kind){var h=t.iconSizeData,f=h.maxZoom;u.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new ii(h.minZoom),o),l["icon-size"].possiblyEvaluate(new ii(f),o)]}u.layoutTextSize=l["text-size"].possiblyEvaluate(new ii(t.zoom+1),o),u.layoutIconSize=l["icon-size"].possiblyEvaluate(new ii(t.zoom+1),o),u.textMaxSize=l["text-size"].possiblyEvaluate(new ii(18));for(var d=24*s.get("text-line-height"),m="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),y=s.get("text-keep-upright"),g=s.get("text-size"),v=function(){var a=x[_],l=s.get("text-font").evaluate(a,{},o).join(","),c=g.evaluate(a,{},o),p=u.layoutTextSize.evaluate(a,{},o),h=u.layoutIconSize.evaluate(a,{},o),f={horizontal:{},vertical:void 0},v=a.text,w=[0,0];if(v){var T=v.toString(),k=24*s.get("text-letter-spacing").evaluate(a,{},o),A=function(t){for(var e=0,r=t;e=8192||p.y<0||p.y>=8192||function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m,y,g,v,_,x,w,T,k,A){var M,S,C,L,E,I=t.addToLineVertexArray(e,r),z=0,P=0,D=0,O=0,R=-1,F=-1,B={},N=ua(""),U=0,j=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(U=(M=s.layout.get("text-offset").evaluate(x,{},k).map((function(t){return 24*t})))[0],j=M[1]):(U=24*s.layout.get("text-radial-offset").evaluate(x,{},k),j=Ql),t.allowVerticalPlacement&&n.vertical){var V=s.layout.get("text-rotate").evaluate(x,{},k)+90;L=new Gl(l,e,u,c,p,n.vertical,h,f,d,V),o&&(E=new Gl(l,e,u,c,p,o,y,g,d,V))}if(i){var q=s.layout.get("icon-rotate").evaluate(x,{}),H="none"!==s.layout.get("icon-text-fit"),Z=jl(i,q,T,H),G=o?jl(o,q,T,H):void 0;C=new Gl(l,e,u,c,p,i,y,g,!1,q),z=4*Z.length;var X=t.iconSizeData,W=null;"source"===X.kind?(W=[128*s.layout.get("icon-size").evaluate(x,{})])[0]>32640&&b(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===X.kind&&((W=[128*w.compositeIconSizes[0].evaluate(x,{},k),128*w.compositeIconSizes[1].evaluate(x,{},k)])[0]>32640||W[1]>32640)&&b(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,Z,W,_,v,x,!1,e,I.lineStartIndex,I.lineLength,-1,k),R=t.icon.placedSymbolArray.length-1,G&&(P=4*G.length,t.addSymbols(t.icon,G,W,_,v,x,ml.vertical,e,I.lineStartIndex,I.lineLength,-1,k),F=t.icon.placedSymbolArray.length-1)}for(var Y in n.horizontal){var K=n.horizontal[Y];if(!S){N=ua(K.text);var J=s.layout.get("text-rotate").evaluate(x,{},k);S=new Gl(l,e,u,c,p,K,h,f,d,J)}var Q=1===K.positionedLines.length;if(D+=eu(t,e,K,a,s,d,x,m,I,n.vertical?ml.horizontal:ml.horizontalOnly,Q?Object.keys(n.horizontal):[Y],B,R,w,k),Q)break}n.vertical&&(O+=eu(t,e,n.vertical,a,s,d,x,m,I,ml.vertical,["vertical"],B,F,w,k));var $=S?S.boxStartIndex:t.collisionBoxArray.length,tt=S?S.boxEndIndex:t.collisionBoxArray.length,et=L?L.boxStartIndex:t.collisionBoxArray.length,rt=L?L.boxEndIndex:t.collisionBoxArray.length,nt=C?C.boxStartIndex:t.collisionBoxArray.length,it=C?C.boxEndIndex:t.collisionBoxArray.length,at=E?E.boxStartIndex:t.collisionBoxArray.length,ot=E?E.boxEndIndex:t.collisionBoxArray.length,st=-1,lt=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=lt(S,st),st=lt(L,st),st=lt(C,st);var ut=(st=lt(E,st))>-1?1:0;ut&&(st*=A/24),t.glyphOffsetArray.length>=pu.MAX_GLYPHS&&b("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,R,F,N,$,tt,et,rt,nt,it,at,ot,u,D,O,z,P,ut,0,h,U,j,st)}(t,p,s,r,n,i,h,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,w,A,l,_,T,M,d,e,a,u,c,o)};if("line"===S)for(var I=0,z=Ul(e.geometry,0,0,8192,8192);I1){var U=Bl(N,k,r.vertical||m,n,24,v);U&&E(N,U)}}else if("Polygon"===e.type)for(var j=0,V=Qo(e.geometry,0);j=C.maxzoom||"none"!==C.visibility&&(o(S,this.zoom,n),(m[C.id]=C.createBucket({index:c.bucketLayerIDs.length,layers:S,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,y,this.tileID.canonical),c.bucketLayerIDs.push(S.map((function(t){return t.id}))))}}}var L=t.mapObject(y.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(L).length?a.send("getGlyphs",{uid:this.uid,stacks:L},(function(t,e){p||(p=t,h=e,z.call(l))})):h={};var E=Object.keys(y.iconDependencies);E.length?a.send("getImages",{icons:E,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){p||(p=t,f=e,z.call(l))})):f={};var I=Object.keys(y.patternDependencies);function z(){if(p)return s(p);if(h&&f&&d){var e=new i(h),r=new t.ImageAtlas(f,d);for(var a in m){var l=m[a];l instanceof t.SymbolBucket?(o(l.layers,this.zoom,n),t.performSymbolLayout(l,h,e.positions,f,r.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):l.hasPattern&&(l instanceof t.LineBucket||l instanceof t.FillBucket||l instanceof t.FillExtrusionBucket)&&(o(l.layers,this.zoom,n),l.addFeatures(y,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:t.values(m).filter((function(t){return!t.isEmpty()})),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?h:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}I.length?a.send("getImages",{icons:I,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){p||(p=t,d=e,z.call(l))})):d={},z.call(this)};var l=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||s,this.loading={},this.loaded={}};l.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[i]=new a(e);s.abort=this.loadVectorData(e,(function(e,a){if(delete n.loading[i],e||!a)return s.status="done",n.loaded[i]=s,r(e);var l=a.rawData,u={};a.expires&&(u.expires=a.expires),a.cacheControl&&(u.cacheControl=a.cacheControl);var c={};if(o){var p=o.finish();p&&(c.resourceTiming=JSON.parse(JSON.stringify(p)))}s.vectorTile=a.vectorTile,s.parse(a.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:l.slice(0)},n,u,c))})),n.loaded=n.loaded||{},n.loaded[i]=s}))},l.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,i=t.uid,a=this;if(n&&n[i]){var o=n[i];o.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,a.layerIndex,r.availableImages,a.actor,i)),e(t,n)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},l.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},l.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var u=t.window.ImageBitmap,c=function(){this.loaded={}};function p(t,e){if(0!==t.length){h(t[0],e);for(var r=1;r=0!=!!e&&t.reverse()}c.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,a=e.rawImageData,o=u&&a instanceof u?this.getImageData(a):a,s=new t.DEMData(n,o,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)},c.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:r.width,height:r.height},r.data)},c.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var f=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function C(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,a=0,o=r.length,s=0;s>1;!function t(e,r,n,i,a,o){for(;a>i;){if(a-i>600){var s=a-i+1,l=n-i+1,u=Math.log(s),c=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-l*c/s+p)),Math.min(a,Math.floor(n+(s-l)*c/s+p)),o)}var h=r[2*n+o],f=i,d=a;for(E(e,r,i,n),r[2*a+o]>h&&E(e,r,i,a);fh;)d--}r[2*i+o]===h?E(e,r,i,d):E(e,r,++d,a),d<=n&&(i=d+1),n<=d&&(a=d-1)}}(e,r,s,i,a,o%2),t(e,r,n,i,s-1,o+1),t(e,r,n,s+1,a,o+1)}}(o,s,n,0,o.length-1,0)};O.prototype.range=function(t,e,r,n){return function(t,e,r,n,i,a,o){for(var s,l,u=[0,t.length-1,0],c=[];u.length;){var p=u.pop(),h=u.pop(),f=u.pop();if(h-f<=o)for(var d=f;d<=h;d++)l=e[2*d+1],(s=e[2*d])>=r&&s<=i&&l>=n&&l<=a&&c.push(t[d]);else{var m=Math.floor((f+h)/2);l=e[2*m+1],(s=e[2*m])>=r&&s<=i&&l>=n&&l<=a&&c.push(t[m]);var y=(p+1)%2;(0===p?r<=s:n<=l)&&(u.push(f),u.push(m-1),u.push(y)),(0===p?i>=s:a>=l)&&(u.push(m+1),u.push(h),u.push(y))}}return c}(this.ids,this.coords,t,e,r,n,this.nodeSize)},O.prototype.within=function(t,e,r){return function(t,e,r,n,i,a){for(var o=[0,t.length-1,0],s=[],l=i*i;o.length;){var u=o.pop(),c=o.pop(),p=o.pop();if(c-p<=a)for(var h=p;h<=c;h++)z(e[2*h],e[2*h+1],r,n)<=l&&s.push(t[h]);else{var f=Math.floor((p+c)/2),d=e[2*f],m=e[2*f+1];z(d,m,r,n)<=l&&s.push(t[f]);var y=(u+1)%2;(0===u?r-i<=d:n-i<=m)&&(o.push(p),o.push(f-1),o.push(y)),(0===u?r+i>=d:n+i>=m)&&(o.push(f+1),o.push(c),o.push(y))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var R={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},F=function(t){this.options=H(Object.create(R),t),this.trees=new Array(this.options.maxZoom+1)};function B(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function N(t,e){var r=t.geometry.coordinates,n=r[1];return{x:V(r[0]),y:q(n),zoom:1/0,index:e,parentId:-1}}function U(t){return{type:"Feature",id:t.id,properties:j(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function j(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return H(H({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function V(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function H(t,e){for(var r in e)t[r]=e[r];return t}function Z(t){return t.x}function G(t){return t.y}function X(t,e,r,n,i,a){var o=i-r,s=a-n;if(0!==o||0!==s){var l=((t-r)*o+(e-n)*s)/(o*o+s*s);l>1?(r=i,n=a):l>0&&(r+=o*l,n+=s*l)}return(o=t-r)*o+(s=e-n)*s}function W(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)Y(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(o+=n?(i*u-l*a)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-a,2))),i=l,a=u}var c=e.length-3;e[2]=1,function t(e,r,n,i){for(var a,o=i,s=n-r>>1,l=n-r,u=e[r],c=e[r+1],p=e[n],h=e[n+1],f=r+3;fo)a=f,o=d;else if(d===o){var m=Math.abs(f-s);mi&&(a-r>3&&t(e,r,a,i),e[a+2]=o,n-a>3&&t(e,a,n,i))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function $(t,e,r,n){for(var i=0;i1?1:r}function rt(t,e,r,n,i,a,o,s){if(n/=e,a>=(r/=e)&&o=n)return null;for(var l=[],u=0;u=r&&d=n)){var m=[];if("Point"===h||"MultiPoint"===h)nt(p,m,r,n,i);else if("LineString"===h)it(p,m,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===h)ot(p,m,r,n,i,!1);else if("Polygon"===h)ot(p,m,r,n,i,!0);else if("MultiPolygon"===h)for(var y=0;y=r&&o<=n&&(e.push(t[a]),e.push(t[a+1]),e.push(t[a+2]))}}function it(t,e,r,n,i,a,o){for(var s,l,u=at(t),c=0===i?lt:ut,p=t.start,h=0;hr&&(l=c(u,f,d,y,g,r),o&&(u.start=p+s*l)):v>n?_=r&&(l=c(u,f,d,y,g,r),x=!0),_>n&&v<=n&&(l=c(u,f,d,y,g,n),x=!0),!a&&x&&(o&&(u.end=p+s*l),e.push(u),u=at(t)),o&&(p+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(v=0===i?f:d)>=r&&v<=n&&st(u,f,d,m),b=u.length-3,a&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&st(u,u[0],u[1],u[2]),u.length&&e.push(u)}function at(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ot(t,e,r,n,i,a){for(var o=0;oo.maxX&&(o.maxX=c),p>o.maxY&&(o.maxY=p)}return o}function mt(t,e,r,n){var i=e.geometry,a=e.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s0&&e.size<(i?o:n))r.numPoints+=e.length/3;else{for(var s=[],l=0;lo)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,a=i-2;n0===e)for(n=0,i=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=n;u--){var c=+Date.now();s=this._cluster(s,u),this.trees[u]=new O(s,Z,G,a,Float32Array),r&&console.log("z%d: %d clusters in %dms",u,s.length,+Date.now()-c)}return r&&console.timeEnd("total time"),this},F.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),i=180===t[2]?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){var o=this.getClusters([r,n,180,a],e),s=this.getClusters([-180,n,i,a],e);return o.concat(s)}for(var l=this.trees[this._limitZoom(e)],u=[],c=0,p=l.range(V(r),q(a),V(i),q(n));c1?this._map(s,!0):null,d=(o<<5)+(e+1)+this.points.length,m=0,y=u;m>5},F.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},F.prototype._map=function(t,e){if(t.numPoints)return e?H({},t.properties):t.properties;var r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?H({},n):n},gt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},gt.prototype.splitTile=function(t,e,r,n,i,a,o){for(var s=[t,e,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<1&&console.time("creation"),h=this.tiles[p]=dt(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(h.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<1&&console.time("clipping");var m,y,g,v,_,x,b=.5*l.buffer/l.extent,w=.5-b,T=.5+b,k=1+b;m=y=g=v=null,_=rt(t,c,r-b,r+T,0,h.minX,h.maxX,l),x=rt(t,c,r+w,r+k,0,h.minX,h.maxX,l),t=null,_&&(m=rt(_,c,n-b,n+T,1,h.minY,h.maxY,l),y=rt(_,c,n+w,n+k,1,h.minY,h.maxY,l),_=null),x&&(g=rt(x,c,n-b,n+T,1,h.minY,h.maxY,l),v=rt(x,c,n+w,n+k,1,h.minY,h.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*r,2*n),s.push(y||[],e+1,2*r,2*n+1),s.push(g||[],e+1,2*r+1,2*n),s.push(v||[],e+1,2*r+1,2*n+1)}}},gt.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,a=n.debug;if(t<0||t>24)return null;var o=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,p=r;!l&&u>0;)u--,c=Math.floor(c/2),p=Math.floor(p/2),l=this.tiles[vt(u,c,p)];return l&&l.source?(a>1&&console.log("found parent tile z%d-%d-%d",u,c,p),a>1&&console.time("drilling down"),this.splitTile(l.source,u,c,p,t,e,r),a>1&&console.timeEnd("drilling down"),this.tiles[s]?ht(this.tiles[s],i):null):null};var xt=function(e){function r(t,r,n,i){e.call(this,t,r,n,_t),i&&(this.loadGeoJSON=i)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(n&&n.request&&n.request.collectResourceTiming)&&new t.RequestPerformance(n.request);this.loadGeoJSON(n,(function(a,o){if(a||!o)return r(a);if("object"!=typeof o)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var h=function(e){function r(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e=0?1.2:1))}function g(t,e,r,n,i,a,o){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else if(a.ranges[s])e(null,{stack:r,id:i,glyph:o});else{var l=a.requests[s];l||(l=a.requests[s]=[],_.loadGlyphRange(r,s,n.url,n.requestManager,(function(t,e){if(e){for(var r in e)n._doesCharSupportLocalGlyph(+r)||(a.glyphs[+r]=e[+r]);a.ranges[s]=!0}for(var i=0,o=l;i1&&(s=t[++o]);var u=Math.abs(l-s.left),c=Math.abs(l-s.right),p=Math.min(u,c),h=void 0,f=i/r*(n+1);if(s.isDash){var d=n-Math.abs(f);h=Math.sqrt(p*p+d*d)}else h=n-Math.sqrt(p*p+f*f);this.data[a+l]=Math.max(0,Math.min(255,h+128))}},T.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}var i=t[0],a=t[t.length-1];i.isDash===a.isDash&&(i.left=a.left-this.width,a.right=i.right+this.width);for(var o=this.width*this.nextRow,s=0,l=t[s],u=0;u1&&(l=t[++s]);var c=Math.abs(u-l.left),p=Math.abs(u-l.right),h=Math.min(c,p);this.data[o+u]=Math.max(0,Math.min(255,(l.isDash?h:-h)+128))}},T.prototype.addDash=function(e,r){var n=r?7:0,i=2*n+1;if(this.nextRow+i>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o=n&&e.x=i&&e.y0&&(l[new t.OverscaledTileID(e.overscaledZ,a,r.z,i,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,o,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.actor.send(this.type+".loadData",n,(function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,a){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(a,n.map.painter,"reloadTile"===i),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),I=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),z=function(e){function r(t,r,n,i){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(e,r){var n=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(i,a){n._loaded=!0,i?n.fire(new t.ErrorEvent(i)):a&&(n.image=a,e&&(n.coordinates=e),r&&r(),n._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,i=-1/0,a=-1/0,o=0,s=e;or.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,I.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(z),D=function(e){function r(r,n,i,a){e.call(this,r,n,i,a),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,I.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var a=this.tiles[i];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];tthis.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this},N.prototype.has=function(t){return t.wrapped().key in this.data},N.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},N.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},N.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},N.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},N.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},N.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},N.prototype.filter=function(t){var e=[];for(var r in this.data)for(var n=0,i=this.data[r];n1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[a]&&(t.neighboringTiles[a].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var i in this._tiles){var a=this._tiles[i];if(!(n[i]||!a.hasData()||a.tileID.overscaledZ<=e||a.tileID.overscaledZ>r)){for(var o=a.tileID;a&&a.tileID.overscaledZ>e+1;){var s=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[s.key])&&a.hasData()&&(o=s)}for(var l=o;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){n[o.key]=o;break}}}},r.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n),a=this._getLoadedTile(i);if(a)return a}},r.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},r.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*r*5),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(i)},r.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var r={};for(var n in this._tiles){var i=this._tiles[n];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),r[i.tileID.key]=i}for(var a in this._tiles=r,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter((function(t){return n._source.hasTile(t)})))):i=[];var a=e.coveringZoomLevel(this._source),o=Math.max(a-r.maxOverzooming,this._source.minzoom),s=Math.max(a+r.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(i,a);if(zt(this._source.type)){for(var u={},c={},p=0,h=Object.keys(l);pthis._source.maxzoom){var y=d.children(this._source.maxzoom)[0],g=this.getTile(y);if(g&&g.hasData()){n[y.key]=y;continue}}else{var v=d.children(this._source.maxzoom);if(n[v[0].key]&&n[v[1].key]&&n[v[2].key]&&n[v[3].key])continue}for(var _=m.wasRequested(),x=d.overscaledZ-1;x>=a;--x){var b=d.scaledTo(x);if(i[b.key])break;if(i[b.key]=!0,!(m=this.getTile(b))&&_&&(m=this._addTile(b)),m&&(n[b.key]=b,_=m.wasRequested(),m.hasData()))break}}}return n},r.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],r=void 0,n=this._tiles[t].tileID;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);var i=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(i))break;n=i}for(var a=0,o=e;a0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var i=this,a=[],o=this.transform;if(!o)return a;for(var s=n?o.getCameraQueryGeometry(e):e,l=e.map((function(t){return o.pointCoordinate(t)})),u=s.map((function(t){return o.pointCoordinate(t)})),c=this.getIds(),p=1/0,h=1/0,f=-1/0,d=-1/0,m=0,y=u;m=0&&g[1].y+y>=0){var v=l.map((function(t){return s.getTilePoint(t)})),_=u.map((function(t){return s.getTilePoint(t)}));a.push({tile:n,tileID:s,queryGeometry:v,cameraQueryGeometry:_,scale:m})}}},_=0;_=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)},r.prototype.removeFeatureState=function(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)},r.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},r.prototype.setDependencies=function(t,e,r){var n=this._tiles[t];n&&n.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function It(t,e){var r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function zt(t){return"raster"===t||"image"===t||"video"===t}function Pt(){return new t.window.Worker(Gi.workerUrl)}Et.maxOverzooming=10,Et.maxUnderzooming=3;var Dt="mapboxgl_preloaded_worker_pool",Ot=function(){this.active={}};Ot.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length0?(i-o)/s:0;return this.points[a].mult(1-l).add(this.points[r].mult(l))};var Kt=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var a=0;a=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,i,a,o,s,l){var u=i?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(u,n.transform.zoom),p=[256/n.width*2+1,256/n.height*2+1],h=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;h.clear();for(var f=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=n.transform.width/n.transform.height,y=!1,g=0;gMath.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function ae(e,r,n,i,a,o,s,l,u,c,p,h,f,d){var m,y=r/24,g=e.lineOffsetX*y,v=e.lineOffsetY*y;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ne(y,l,g,v,n,p,h,e,u,o,f);if(!w)return{notEnoughRoom:!0};var T=$t(w.first.point,s).point,k=$t(w.last.point,s).point;if(i&&!n){var A=ie(e.writingMode,T,k,d);if(A)return A}m=[w.first];for(var M=e.glyphStartIndex+1;M<_-1;M++)m.push(se(y*l.getoffsetX(M),g,v,n,p,h,e.segment,x,b,u,o,f));m.push(w.last)}else{if(i&&!n){var S=$t(h,a).point,C=e.lineStartIndex+e.segment+1,L=new t.Point(u.getx(C),u.gety(C)),E=$t(L,a),I=E.signedDistanceFromCamera>0?E.point:oe(h,L,S,1,a),z=ie(e.writingMode,S,I,d);if(z)return z}var P=se(y*l.getoffsetX(e.glyphStartIndex),g,v,n,p,h,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,o,f);if(!P)return{notEnoughRoom:!0};m=[P]}for(var D=0,O=m;D0?1:-1,m=0;i&&(d*=-1,m=Math.PI),d<0&&(m+=Math.PI);for(var y=d>0?l+s:l+s+1,g=a,v=a,_=0,x=0,b=Math.abs(f),w=[];_+x<=b;){if((y+=d)=u)return null;if(v=g,w.push(g),void 0===(g=h[y])){var T=new t.Point(c.getx(y),c.gety(y)),k=$t(T,p);if(k.signedDistanceFromCamera>0)g=h[y]=k.point;else{var A=y-d;g=oe(0===_?o:new t.Point(c.getx(A),c.gety(A)),T,v,b-_+1,p)}}_+=x,x=v.dist(g)}var M=(b-_)/x,S=g.sub(v),C=S.mult(M)._add(v);C._add(S._unit()._perp()._mult(n*d));var L=m+Math.atan2(g.y-v.y,g.x-v.x);return w.push(C),{point:C,angle:L,path:w}}Kt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Kt.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},Kt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},Kt.prototype._insertBoxCell=function(t,e,r,n,i,a){this.boxCells[i].push(a)},Kt.prototype._insertCircleCell=function(t,e,r,n,i,a){this.circleCells[i].push(a)},Kt.prototype._query=function(t,e,r,n,i,a){if(r<0||t>this.width||n<0||e>this.height)return!i&&[];var o=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s0:o},Kt.prototype._queryCircle=function(t,e,r,n,i){var a=t-r,o=t+r,s=e-r,l=e+r;if(o<0||a>this.width||l<0||s>this.height)return!n&&[];var u=[];return this._forEachCell(a,s,o,l,this._queryCellCircle,u,{hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},i),n?u.length>0:u},Kt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},Kt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},Kt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Kt.prototype._queryCell=function(t,e,r,n,i,a,o,s){var l=o.seenUids,u=this.boxCells[i];if(null!==u)for(var c=this.bboxes,p=0,h=u;p=c[d+0]&&n>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var m=this.circleCells[i];if(null!==m)for(var y=this.circles,g=0,v=m;go*o+s*s},Kt.prototype._circleAndRectCollide=function(t,e,r,n,i,a,o){var s=(a-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var u=(o-i)/2,c=Math.abs(e-(i+u));if(c>u+r)return!1;if(l<=s||c<=u)return!0;var p=l-s,h=c-u;return p*p+h*h<=r*r};var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ue(t,e){for(var r=0;r=1;I--)E.push(C.path[I]);for(var z=1;z0){for(var R=E[0].clone(),F=E[0].clone(),B=1;B=A.x&&F.x<=M.x&&R.y>=A.y&&F.y<=M.y?[E]:F.xM.x||F.yM.y?[]:t.clipLine([E],A.x,A.y,M.x,M.y)}for(var N=0,U=O;N=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},pe.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t=0&&e0?(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(m=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:y,width:r,height:n,anchor:t,textBoxScale:i,prevAnchor:m},this.markUsedJustification(h,t,p,f),h.allowVerticalPlacement&&(this.markUsedOrientation(h,f,p),this.placedOrientations[p.crossTileID]=f),{shift:g,placedGlyphBoxes:v}):void 0},be.prototype.placeLayerBucketPart=function(e,r,n){var i=this,a=e.parameters,o=a.bucket,s=a.layout,l=a.posMatrix,u=a.textLabelPlaneMatrix,c=a.labelToScreenMatrix,p=a.textPixelRatio,h=a.holdingForFade,f=a.collisionBoxArray,d=a.partiallyEvaluatedTextSize,m=a.collisionGroup,y=s.get("text-optional"),g=s.get("icon-optional"),v=s.get("text-allow-overlap"),_=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),T="viewport-y"===s.get("symbol-z-order"),k=v&&(_||!o.hasIconData()||g),A=_&&(v||!o.hasTextData()||y);!o.collisionArrays&&f&&o.deserializeCollisionBoxes(f);var M=function(e,a){if(!r[e.crossTileID])if(h)i.placements[e.crossTileID]=new me(!1,!1,!1);else{var f,T=!1,M=!1,S=!0,C=null,L={box:null,offscreen:null},E={box:null,offscreen:null},I=null,z=null,P=0,D=0,O=0;a.textFeatureIndex?P=a.textFeatureIndex:e.useRuntimeCollisionCircles&&(P=e.featureIndex),a.verticalTextFeatureIndex&&(D=a.verticalTextFeatureIndex);var R=a.textBox;if(R){var F=function(r){var n=t.WritingMode.horizontal;if(o.allowVerticalPlacement&&!r&&i.prevPlacement){var a=i.prevPlacement.placedOrientations[e.crossTileID];a&&(i.placedOrientations[e.crossTileID]=a,i.markUsedOrientation(o,n=a,e))}return n},B=function(r,n){if(o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&a.verticalTextBox)for(var i=0,s=o.writingModes;i0&&(N=N.filter((function(t){return t!==U.anchor}))).unshift(U.anchor)}var j=function(t,r,n){for(var a=t.x2-t.x1,s=t.y2-t.y1,u=e.textBoxScale,c=w&&!_?r:null,h={box:[],offscreen:!1},f=v?2*N.length:N.length,d=0;d=N.length,e,o,n,c);if(y&&(h=y.placedGlyphBoxes)&&h.box&&h.box.length){T=!0,C=y.shift;break}}return h};B((function(){return j(R,a.iconBox,t.WritingMode.horizontal)}),(function(){var r=a.verticalTextBox;return o.allowVerticalPlacement&&!(L&&L.box&&L.box.length)&&e.numVerticalGlyphVertices>0&&r?j(r,a.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),L&&(T=L.box,S=L.offscreen);var V=F(L&&L.box);if(!T&&i.prevPlacement){var q=i.prevPlacement.variableOffsets[e.crossTileID];q&&(i.variableOffsets[e.crossTileID]=q,i.markUsedJustification(o,q.anchor,e,V))}}else{var H=function(t,r){var n=i.collisionIndex.placeCollisionBox(t,v,p,l,m.predicate);return n&&n.box&&n.box.length&&(i.markUsedOrientation(o,r,e),i.placedOrientations[e.crossTileID]=r),n};B((function(){return H(R,t.WritingMode.horizontal)}),(function(){var r=a.verticalTextBox;return o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?H(r,t.WritingMode.vertical):{box:null,offscreen:null}})),F(L&&L.box&&L.box.length)}}if(T=(f=L)&&f.box&&f.box.length>0,S=f&&f.offscreen,e.useRuntimeCollisionCircles){var Z=o.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),G=t.evaluateSizeForFeature(o.textSizeData,d,Z),X=s.get("text-padding");I=i.collisionIndex.placeCollisionCircles(v,Z,o.lineVertexArray,o.glyphOffsetArray,G,l,u,c,n,b,m.predicate,e.collisionCircleDiameter,X),T=v||I.circles.length>0&&!I.collisionDetected,S=S&&I.offscreen}if(a.iconFeatureIndex&&(O=a.iconFeatureIndex),a.iconBox){var W=function(t){var e=w&&C?xe(t,C.x,C.y,x,b,i.transform.angle):t;return i.collisionIndex.placeCollisionBox(e,_,p,l,m.predicate)};M=E&&E.box&&E.box.length&&a.verticalIconBox?(z=W(a.verticalIconBox)).box.length>0:(z=W(a.iconBox)).box.length>0,S=S&&z.offscreen}var Y=y||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,K=g||0===e.numIconVertices;if(Y||K?K?Y||(M=M&&T):T=M&&T:M=T=M&&T,T&&f&&f.box&&i.collisionIndex.insertCollisionBox(f.box,s.get("text-ignore-placement"),o.bucketInstanceId,E&&E.box&&D?D:P,m.ID),M&&z&&i.collisionIndex.insertCollisionBox(z.box,s.get("icon-ignore-placement"),o.bucketInstanceId,O,m.ID),I&&(T&&i.collisionIndex.insertCollisionCircles(I.circles,s.get("text-ignore-placement"),o.bucketInstanceId,P,m.ID),n)){var J=o.bucketInstanceId,Q=i.collisionCircleArrays[J];void 0===Q&&(Q=i.collisionCircleArrays[J]=new ye);for(var $=0;$=0;--C){var L=S[C];M(o.symbolInstances.get(L),o.collisionArrays[L])}else for(var E=e.symbolInstanceStart;E=0&&(e.text.placedSymbolArray.get(l).crossTileID=a>=0&&l!==a?0:n.crossTileID)}},be.prototype.markUsedOrientation=function(e,r,n){for(var i=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,a=r===t.WritingMode.vertical?r:0,o=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];o0,v=i.placedOrientations[a.crossTileID],_=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||l>0){var b=Ee(y.text);d(e.text,s,_?Ie:b),d(e.text,l,x?Ie:b);var w=y.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||_?1:0)})),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var T=i.variableOffsets[a.crossTileID];T&&i.markUsedJustification(e,T.anchor,a,v);var k=i.placedOrientations[a.crossTileID];k&&(i.markUsedJustification(e,"left",a,k),i.markUsedOrientation(e,k,a))}if(g){var A=Ee(y.icon),M=!(h&&a.verticalPlacedIconSymbolIndex&&_);a.placedIconSymbolIndex>=0&&(d(e.icon,a.numIconVertices,M?A:Ie),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=y.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,a.numVerticalIconVertices,M?Ie:A),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var S=e.collisionArrays[n];if(S){var C=new t.Point(0,0);if(S.textBox||S.verticalTextBox){var L=!0;if(u){var E=i.variableOffsets[m];E?(C=_e(E.anchor,E.width,E.height,E.textOffset,E.textBoxScale),c&&C._rotate(p?i.transform.angle:-i.transform.angle)):L=!1}S.textBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!L||_,C.x,C.y),S.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!L||x,C.x,C.y)}var I=Boolean(!x&&S.verticalIconBox);S.iconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,I,h?C.x:0,h?C.y:0),S.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,!I,h?C.x:0,h?C.y:0)}}},y=0;yt},be.prototype.setStale=function(){this.stale=!0};var Te=Math.pow(2,25),ke=Math.pow(2,24),Ae=Math.pow(2,17),Me=Math.pow(2,16),Se=Math.pow(2,9),Ce=Math.pow(2,8),Le=Math.pow(2,1);function Ee(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*Te+e*ke+r*Ae+e*Me+r*Se+e*Ce+r*Le+e}var Ie=0,ze=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};ze.prototype.continuePlacement=function(t,e,r,n,i){for(var a=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=r[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new ze(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Pe.prototype.commit=function(t){return this.placement.commit(t),this.placement};var De=512/t.EXTENT/2,Oe=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;nt.overscaledZ)for(var s in o){var l=o[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,i)}else{var u=o[t.scaledTo(Number(a)).key];u&&u.findMatches(e.symbolInstances,t,i)}}for(var c=0;c1?"@2x":"",l=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){l=null,o||(o=t,i=e,c())})),u=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){u=null,o||(o=t,a=e,c())}));function c(){if(o)n(o);else if(i&&a){var e=t.browser.getImageData(a),r={};for(var s in i){var l=i[s],u=l.width,c=l.height,p=l.x,h=l.y,f=l.sdf,d=l.pixelRatio,m=l.stretchX,y=l.stretchY,g=l.content,v=new t.RGBAImage({width:u,height:c});t.RGBAImage.copy(e,v,{x:p,y:h},{x:0,y:0},{width:u,height:c}),r[s]={data:v,pixelRatio:d,sdf:f,stretchX:m,stretchY:y,content:g}}n(null,r)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(e,this.map._requestManager,(function(e,n){if(r._spriteRequest=null,e)r.fire(new t.ErrorEvent(e));else if(n)for(var i in n)r.imageManager.addImage(i,n[i]);r.imageManager.setLoaded(!0),r._availableImages=r.imageManager.listImages(),r.dispatcher.broadcast("setImages",r._availableImages),r.fire(new t.Event("data",{dataType:"style"}))}))},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var n=e.sourceLayer;if(n){var i=r.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+n+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}}},r.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,n=t;r0)throw new Error("Unimplemented: "+i.map((function(t){return t.command})).join(", ")+".");return n.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(void 0===n&&(n={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var a=this.sourceCaches[e]=new Et(e,r,this.dispatcher);a.style=this,a.setEventedParent(this,(function(){return{isSourceLoaded:i.loaded(),source:a.serialize(),sourceId:e}})),a.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else{var a;if("custom"===e.type){if(Ne(this,t.validateCustomStyleLayer(e)))return;a=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})),this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n))return;a=t.createStyleLayer(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[a.id]=a.serialize()}var o=r?this._order.indexOf(r):this._order.length;if(r&&-1===o)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(o,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&"custom"!==a.type){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.hasLayer=function(t){return t in this._layers},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.deepEqual(i.filter,r))return null==r?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",r,null,n)||(i.filter=t.clone$1(r),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var a=this.getLayer(e);a?t.deepEqual(a.getLayoutProperty(r),n)||(a.setLayoutProperty(r,n,i),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(e,r){var n=this.getLayer(e);if(n)return n.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var a=this.getLayer(e);a?t.deepEqual(a.getPaintProperty(r),n)||(a.setPaintProperty(r,n,i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,a=this.sourceCaches[n];if(void 0!==a){var o=a.getSource().type;"geojson"===o&&i?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||i?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.setFeatureState(i,e.id,r)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=this.sourceCaches[n];if(void 0!==i){var a=i.getSource().type,o="vector"===a?e.sourceLayer:void 0;"vector"!==a||o?r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))):i.removeFeatureState(o,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r];if(void 0!==i){if("vector"!==i.getSource().type||n)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),i.getFeatureState(n,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},n={},i=[],a=this._order.length-1;a>=0;a--){var o=this._order[a];if(r(o)){n[o]=a;for(var s=0,l=t;s=0;f--){var d=this._order[f];if(r(d))for(var m=i.length-1;m>=0;m--){var y=i[m].feature;if(n[y.layer.id] 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),$e=gr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),tr=gr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),er=gr("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),rr=gr("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),nr=gr("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ir=gr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),ar=gr("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),or=gr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),sr=gr("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),lr=gr("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),ur=gr("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),cr=gr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define MAX_LINE_DISTANCE 32767.0\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),pr=gr("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),hr=gr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),fr=gr("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),dr=gr("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),mr=gr("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),yr=gr("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function gr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n={};return{fragmentSource:t=t.replace(r,(function(t,e,r,i,a){return n[a]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nvarying "+r+" "+i+" "+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,i,a){var o="float"===i?"vec2":"vec4",s=a.match(/color/)?"color":o;return n[a]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float u_"+a+"_t;\nattribute "+r+" "+o+" a_"+a+";\nvarying "+r+" "+i+" "+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+a+" = a_"+a+";\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+a+" = unpack_mix_"+s+"(a_"+a+", u_"+a+"_t);\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float u_"+a+"_t;\nattribute "+r+" "+o+" a_"+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = a_"+a+";\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = unpack_mix_"+s+"(a_"+a+", u_"+a+"_t);\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n"}))}}var vr=Object.freeze({__proto__:null,prelude:Ze,background:Ge,backgroundPattern:Xe,circle:We,clippingMask:Ye,heatmap:Ke,heatmapTexture:Je,collisionBox:Qe,collisionCircle:$e,debug:tr,fill:er,fillOutline:rr,fillOutlinePattern:nr,fillPattern:ir,fillExtrusion:ar,fillExtrusionPattern:or,hillshadePrepare:sr,hillshade:lr,line:ur,lineGradient:cr,linePattern:pr,lineSDF:hr,raster:fr,symbolIcon:dr,symbolSDF:mr,symbolTextAndIcon:yr}),_r=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};_r.prototype.bind=function(t,e,r,n,i,a,o,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==n.length,u=0;!l&&u>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}xr.prototype.draw=function(t,e,r,n,i,a,o,s,l,u,c,p,h,f,d,m){var y,g=t.gl;if(!this.failedToCreate){for(var v in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(i),t.setCullFace(a),this.fixedUniforms)this.fixedUniforms[v].set(o[v]);f&&f.setUniforms(t,this.binderUniforms,p,{zoom:h});for(var _=(y={},y[g.LINES]=2,y[g.TRIANGLES]=3,y[g.LINE_STRIP]=1,y)[e],x=0,b=c.get();x0?1-1/(1.001-o):-o),u_contrast_factor:(a=i.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:jr(i.paint.get("raster-hue-rotate"))};var a,o};function jr(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var Vr,qr=function(t,e,r,n,i,a,o,s,l,u){var c=i.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:c.width/c.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+n,u_texsize:u,u_texture:0}},Hr=function(e,r,n,i,a,o,s,l,u,c,p){var h=a.transform;return t.extend(qr(e,r,n,i,a,o,s,l,u,c),{u_gamma_scale:i?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+p})},Zr=function(e,r,n,i,a,o,s,l,u,c){return t.extend(Hr(e,r,n,i,a,o,s,l,!0,u,!0),{u_texsize_icon:c,u_texture_icon:1})},Gr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Xr=function(e,r,n,i,a,o){return t.extend(function(t,e,r,n){var i=r.imageManager.getPattern(t.from.toString()),a=r.imageManager.getPattern(t.to.toString()),o=r.imageManager.getPixelSize(),s=o.width,l=o.height,u=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,r.transform.tileZoom)/u,p=c*(n.tileID.canonical.x+n.tileID.wrap*u),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/he(n,1,r.transform.tileZoom),u_pixel_coord_upper:[p>>16,h>>16],u_pixel_coord_lower:[65535&p,65535&h]}}(i,o,n,a),{u_matrix:e,u_opacity:r})},Wr={fillExtrusion:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},collisionCircle:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,r.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,r.u_viewport_size)}},debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_overlay:new t.Uniform1i(e,r.u_overlay),u_overlay_scale:new t.Uniform1f(e,r.u_overlay_scale)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_maxzoom:new t.Uniform1f(e,r.u_maxzoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Yr(e,r,n,i,a,o,s){for(var l=e.context,u=l.gl,c=e.useProgram("collisionBox"),p=[],h=0,f=0,d=0;d0){var b=t.create(),w=v;t.mul(b,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,g.placementViewportMatrix),p.push({circleArray:x,circleOffset:f,transform:w,invTransform:b}),f=h+=x.length/4}_&&c.draw(l,u.LINES,At.disabled,Mt.disabled,e.colorModeForRenderPass(),Ct.disabled,Lr(v,e.transform,y),n.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,e.transform.zoom,null,null,_.collisionVertexBuffer)}}if(s&&p.length){var T=e.useProgram("collisionCircle"),k=new t.StructArrayLayout2f1f2i16;k.resize(4*h),k._trim();for(var A=0,M=0,S=p;M=0&&(m[g.associatedIconIndex]={shiftedAnchor:k,angle:A})}else ue(g.numGlyphs,f)}if(p){d.clear();for(var S=e.icon.placedSymbolArray,C=0;C0){var s=t.browser.now(),l=(s-e.timeAdded)/o,u=r?(s-r.timeAdded)/o:-1,c=n.getSource(),p=a.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!r||Math.abs(r.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),f=h&&e.refreshedUponExpiration?1:t.clamp(h?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var ln=new t.Color(1,0,0,1),un=new t.Color(0,1,0,1),cn=new t.Color(0,0,1,1),pn=new t.Color(1,0,1,1),hn=new t.Color(0,1,1,1);function fn(t,e,r,n){mn(t,0,e+r/2,t.transform.width,r,n)}function dn(t,e,r,n){mn(t,e-r/2,0,r,t.transform.height,n)}function mn(e,r,n,i,a,o){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(r*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,a*t.browser.devicePixelRatio),s.clear({color:o}),l.disable(l.SCISSOR_TEST)}function yn(e,r,n){var i=e.context,a=i.gl,o=n.posMatrix,s=e.useProgram("debug"),l=At.disabled,u=Mt.disabled,c=e.colorModeForRenderPass();i.activeTexture.set(a.TEXTURE0),e.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),s.draw(i,a.LINE_STRIP,l,u,c,Ct.disabled,Ir(o,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var p=r.getTileByID(n.key).latestRawTileData,h=Math.floor((p&&p.byteLength||0)/1024),f=r.getTile(n).tileSize,d=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5,m=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(m+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var r=t.debugOverlayCanvas,n=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,r.width,r.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,m+" "+h+"kb"),s.draw(i,a.TRIANGLES,l,u,St.alphaBlended,Ct.disabled,Ir(o,t.Color.transparent,d),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var gn={symbol:function(e,r,n,i,a){if("translucent"===e.renderPass){var o=Mt.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,r,n,i,a,o,s){for(var l=r.transform,u="map"===a,c="map"===o,p=0,h=e;p256&&this.clearStencil(),r.setColorMode(St.disabled),r.setDepthMode(At.disabled);var i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var a=0,o=e;a256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new Mt({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},vn.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new Mt({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},vn.prototype.stencilConfigForOverlap=function(t){var e,r=this.context.gl,n=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),i=n[n.length-1].overscaledZ,a=n[0].overscaledZ-i+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();for(var o={},s=0;s=0;this.currentLayer--){var x=this.style._layers[i[this.currentLayer]],b=a[x.source],w=c[x.source];this._renderTileClippingMasks(x,w),this.renderLayer(this,b,x,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?e.pop():null},vn.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},vn.prototype.useProgram=function(t,e){this.cache=this.cache||{};var r=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new xr(this.context,vr[t],e,Wr[t],this._showOverdrawInspector)),this.cache[r]},vn.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},vn.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},vn.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},vn.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var _n=function(t,e){this.points=t,this.planes=e};_n.fromInvProjectionMatrix=function(e,r,n){var i=Math.pow(2,n),a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(r){return t.transformMat4([],r,e)})).map((function(e){return t.scale$1([],e,1/e[3]/r*i)})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var r=t.sub([],a[e[0]],a[e[1]]),n=t.sub([],a[e[2]],a[e[1]]),i=t.normalize([],t.cross([],r,n)),o=-t.dot(i,a[e[1]]);return i.concat(o)}));return new _n(a,o)};var xn=function(e,r){this.min=e,this.max=r,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};xn.prototype.quadrant=function(e){for(var r=[e%2==0,e<2],n=t.clone$2(this.min),i=t.clone$2(this.max),a=0;a=0;if(0===o)return 0;o!==r.length&&(n=!1)}if(n)return 2;for(var l=0;l<3;l++){for(var u=Number.MAX_VALUE,c=-Number.MAX_VALUE,p=0;pthis.max[l]-this.min[l])return 0}return 1};var bn=function(t,e,r,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=n};bn.prototype.interpolate=function(e,r,n){return null!=r.top&&null!=e.top&&(this.top=t.number(e.top,r.top,n)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,r.bottom,n)),null!=r.left&&null!=e.left&&(this.left=t.number(e.left,r.left,n)),null!=r.right&&null!=e.right&&(this.right=t.number(e.right,r.right,n)),this},bn.prototype.getCenter=function(e,r){var n=t.clamp((this.left+e-this.right)/2,0,e),i=t.clamp((this.top+r-this.bottom)/2,0,r);return new t.Point(n,i)},bn.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},bn.prototype.clone=function(){return new bn(this.top,this.bottom,this.left,this.right)},bn.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var wn=function(e,r,n,i,a){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===a||a,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new bn,this._posMatrixCache={},this._alignedPosMatrixCache={}},Tn={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};wn.prototype.clone=function(){var t=new wn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},Tn.minZoom.get=function(){return this._minZoom},Tn.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Tn.maxZoom.get=function(){return this._maxZoom},Tn.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Tn.minPitch.get=function(){return this._minPitch},Tn.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},Tn.maxPitch.get=function(){return this._maxPitch},Tn.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},Tn.renderWorldCopies.get=function(){return this._renderWorldCopies},Tn.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Tn.worldSize.get=function(){return this.tileSize*this.scale},Tn.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Tn.size.get=function(){return new t.Point(this.width,this.height)},Tn.bearing.get=function(){return-this.angle/Math.PI*180},Tn.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Tn.pitch.get=function(){return this._pitch/Math.PI*180},Tn.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},Tn.fov.get=function(){return this._fov/Math.PI*180},Tn.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},Tn.zoom.get=function(){return this._zoom},Tn.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},Tn.center.get=function(){return this._center},Tn.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Tn.padding.get=function(){return this._edgeInsets.toJSON()},Tn.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},Tn.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},wn.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},wn.prototype.interpolatePadding=function(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()},wn.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},wn.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var n=this.pointCoordinate(new t.Point(0,0)),i=this.pointCoordinate(new t.Point(this.width,0)),a=this.pointCoordinate(new t.Point(this.width,this.height)),o=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(n.x,i.x,a.x,o.x)),l=Math.floor(Math.max(n.x,i.x,a.x,o.x)),u=s-1;u<=l+1;u++)0!==u&&r.push(new t.UnwrappedTileID(u,e));return r},wn.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var i=t.MercatorCoordinate.fromLngLat(this.center),a=Math.pow(2,r),o=[a*i.x,a*i.y,0],s=_n.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=r);var u=function(t){return{aabb:new xn([t*a,0,0],[(t+1)*a,a,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},c=[],p=[],h=r,f=e.reparseOverscaled?n:r;if(this._renderWorldCopies)for(var d=1;d<=3;d++)c.push(u(-d)),c.push(u(d));for(c.push(u(0));c.length>0;){var m=c.pop(),y=m.x,g=m.y,v=m.fullyVisible;if(!v){var _=m.aabb.intersects(s);if(0===_)continue;v=2===_}var x=m.aabb.distanceX(o),b=m.aabb.distanceY(o),w=Math.max(Math.abs(x),Math.abs(b));if(m.zoom===h||w>3+(1<=l)p.push({tileID:new t.OverscaledTileID(m.zoom===h?f:m.zoom,m.wrap,m.zoom,y,g),distanceSq:t.sqrLen([o[0]-.5-y,o[1]-.5-g])});else for(var T=0;T<4;T++){var k=(y<<1)+T%2,A=(g<<1)+(T>>1);c.push({aabb:m.aabb.quadrant(T),zoom:m.zoom+1,x:k,y:A,wrap:m.wrap,fullyVisible:v})}}return p.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},wn.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},Tn.unmodified.get=function(){return this._unmodified},wn.prototype.zoomScale=function(t){return Math.pow(2,t)},wn.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},wn.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},wn.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Tn.point.get=function(){return this.project(this.center)},wn.prototype.setLocationAtPoint=function(e,r){var n=this.pointCoordinate(r),i=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(e),o=new t.MercatorCoordinate(a.x-(n.x-i.x),a.y-(n.y-i.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())},wn.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},wn.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},wn.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},wn.prototype.coordinateLocation=function(t){return t.toLngLat()},wn.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],a=n[3],o=r[1]/i,s=n[1]/a,l=r[2]/i,u=n[2]/a,c=l===u?0:(0-l)/(u-l);return new t.MercatorCoordinate(t.number(r[0]/i,n[0]/a,c)/this.worldSize,t.number(o,s,c)/this.worldSize)},wn.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},wn.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},wn.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},wn.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},wn.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var n=e.key,i=r?this._alignedPosMatrixCache:this._posMatrixCache;if(i[n])return i[n];var a=e.canonical,o=this.worldSize/this.zoomScale(a.z),s=a.x+Math.pow(2,a.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*o,a.y*o,0]),t.scale(l,l,[o/t.EXTENT,o/t.EXTENT,1]),t.multiply(l,r?this.alignedProjMatrix:this.projMatrix,l),i[n]=new Float32Array(l),i[n]},wn.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},wn.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,n,i,a=-90,o=90,s=-180,l=180,u=this.size,c=this._unmodified;if(this.latRange){var p=this.latRange;a=t.mercatorYfromLat(p[1])*this.worldSize,e=(o=t.mercatorYfromLat(p[0])*this.worldSize)-ao&&(i=o-y)}if(this.lngRange){var g=f.x,v=u.x/2;g-vl&&(n=l-v)}void 0===n&&void 0===i||(this.center=this.unproject(new t.Point(void 0!==n?n:f.x,void 0!==i?i:f.y))),this._unmodified=c,this._constraining=!1}},wn.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var r=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),i=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-n,.01,Math.PI-.01)),a=this.point,o=a.x,s=a.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),u=this.height/50,c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,u,l),c[8]=2*-e.x/this.width,c[9]=2*e.y/this.height,t.scale(c,c,[1,-1,1]),t.translate(c,c,[0,0,-this.cameraToCenterDistance]),t.rotateX(c,c,this._pitch),t.rotateZ(c,c,this.angle),t.translate(c,c,[-o,-s,0]),this.mercatorMatrix=t.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),t.scale(c,c,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=c,this.invProjMatrix=t.invert([],this.projMatrix);var p=this.width%2/2,h=this.height%2/2,f=Math.cos(this.angle),d=Math.sin(this.angle),m=o-Math.round(o)+f*p+d*h,y=s-Math.round(s)+f*h+d*p,g=new Float64Array(c);if(t.translate(g,g,[m>.5?m-1:m,y>.5?y-1:y,0]),this.alignedProjMatrix=g,c=t.create(),t.scale(c,c,[this.width/2,-this.height/2,1]),t.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=t.create(),t.scale(c,c,[1,-1,1]),t.translate(c,c,[-1,-1,0]),t.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(c=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}},wn.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},wn.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},wn.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var n=r.x,i=r.y,a=r.x,o=r.y,s=0,l=e;s=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},kn.prototype._updateHashUnthrottled=function(){var e=this.getHashString();try{t.window.history.replaceState(t.window.history.state,"",e)}catch(t){}};var An={linearity:.3,easing:t.bezier(0,0,.3,1)},Mn=t.extend({deceleration:2500,maxSpeed:1400},An),Sn=t.extend({deceleration:20,maxSpeed:1400},An),Cn=t.extend({deceleration:1e3,maxSpeed:360},An),Ln=t.extend({deceleration:1e3,maxSpeed:90},An),En=function(t){this._map=t,this.clear()};function In(t,e){(!t.duration||t.duration0&&r-e[0].time>160;)e.shift()},En.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var r={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},n=0,i=this._inertiaBuffer;n=this._clickTolerance||this._map.fire(new Pn(t.type,this._map,t))},Rn.prototype.dblclick=function(t){return this._firePreventable(new Pn(t.type,this._map,t))},Rn.prototype.mouseover=function(t){this._map.fire(new Pn(t.type,this._map,t))},Rn.prototype.mouseout=function(t){this._map.fire(new Pn(t.type,this._map,t))},Rn.prototype.touchstart=function(t){return this._firePreventable(new Dn(t.type,this._map,t))},Rn.prototype.touchmove=function(t){this._map.fire(new Dn(t.type,this._map,t))},Rn.prototype.touchend=function(t){this._map.fire(new Dn(t.type,this._map,t))},Rn.prototype.touchcancel=function(t){this._map.fire(new Dn(t.type,this._map,t))},Rn.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},Rn.prototype.isEnabled=function(){return!0},Rn.prototype.isActive=function(){return!1},Rn.prototype.enable=function(){},Rn.prototype.disable=function(){};var Fn=function(t){this._map=t};Fn.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Fn.prototype.mousemove=function(t){this._map.fire(new Pn(t.type,this._map,t))},Fn.prototype.mousedown=function(){this._delayContextMenu=!0},Fn.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Fn.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Pn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Fn.prototype.isEnabled=function(){return!0},Fn.prototype.isActive=function(){return!1},Fn.prototype.enable=function(){},Fn.prototype.disable=function(){};var Bn=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Nn(t,e){for(var r={},n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){for(var r=new t.Point(0,0),n=0,i=e;n30)&&(this.aborted=!0)}}},Un.prototype.touchend=function(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){var n=!this.aborted&&this.centroid;if(this.reset(),n)return n}};var jn=function(t){this.singleTap=new Un(t),this.numTaps=t.numTaps,this.reset()};jn.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},jn.prototype.touchstart=function(t,e,r){this.singleTap.touchstart(t,e,r)},jn.prototype.touchmove=function(t,e,r){this.singleTap.touchmove(t,e,r)},jn.prototype.touchend=function(t,e,r){var n=this.singleTap.touchend(t,e,r);if(n){var i=t.timeStamp-this.lastTime<500,a=!this.lastTap||this.lastTap.dist(n)<30;if(i&&a||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}};var Vn=function(){this._zoomIn=new jn({numTouches:1,numTaps:2}),this._zoomOut=new jn({numTouches:2,numTaps:1}),this.reset()};Vn.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},Vn.prototype.touchstart=function(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)},Vn.prototype.touchmove=function(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)},Vn.prototype.touchend=function(t,e,r){var n=this,i=this._zoomIn.touchend(t,e,r),a=this._zoomOut.touchend(t,e,r);return i?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}}):a?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(a)},{originalEvent:t})}}):void 0},Vn.prototype.touchcancel=function(){this.reset()},Vn.prototype.enable=function(){this._enabled=!0},Vn.prototype.disable=function(){this._enabled=!1,this.reset()},Vn.prototype.isEnabled=function(){return this._enabled},Vn.prototype.isActive=function(){return this._active};var qn=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};qn.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},qn.prototype._correctButton=function(t,e){return!1},qn.prototype._move=function(t,e){return{}},qn.prototype.mousedown=function(t,e){if(!this._lastPoint){var n=r.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}},qn.prototype.mousemoveWindow=function(t,e){var r=this._lastPoint;if(r&&(t.preventDefault(),this._moved||!(e.dist(r)0&&(this._active=!0);var i=Nn(n,r),a=new t.Point(0,0),o=new t.Point(0,0),s=0;for(var l in i){var u=i[l],c=this._touches[l];c&&(a._add(u),o._add(u.sub(c)),s++,i[l]=u)}if(this._touches=i,!(sMath.abs(t.x)}var ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,ti(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,r){var n=t[0].sub(this._lastPoints[0]),i=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,i,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+i.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,r){if(void 0!==this._valid)return this._valid;var n=t.mag()>=2,i=e.mag()>=2;if(n||i){if(!n||!i)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;var a=t.y>0==e.y>0;return ti(t)&&ti(e)&&a}},e}(Wn),ri={panStep:100,bearingStep:15,pitchStep:10},ni=function(){var t=ri;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep};function ii(t){return t*(2-t)}ni.prototype.reset=function(){this._active=!1},ni.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var r=0,n=0,i=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),o=1);break;default:return}return{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:ii,zoom:r?Math.round(l)+r*(t.shiftKey?2:1):l,bearing:s.getBearing()+n*e._bearingStep,pitch:s.getPitch()+i*e._pitchStep,offset:[-a*e._panStep,-o*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},ni.prototype.enable=function(){this._enabled=!0},ni.prototype.disable=function(){this._enabled=!1,this.reset()},ni.prototype.isEnabled=function(){return this._enabled},ni.prototype.isActive=function(){return this._active};var ai=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};ai.prototype.setZoomRate=function(t){this._defaultZoomRate=t},ai.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},ai.prototype.isEnabled=function(){return!!this._enabled},ai.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},ai.prototype.isZooming=function(){return!!this._zooming},ai.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},ai.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},ai.prototype.wheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.browser.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}},ai.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},ai.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var n=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},ai.prototype.renderFrame=function(){return this._onScrollFrame()},ai.prototype._onScrollFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var a="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(a*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var o,s="number"==typeof this._targetZoom?this._targetZoom:r.zoom,l=this._startZoom,u=this._easing,c=!1;if("wheel"===this._type&&l&&u){var p=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),h=u(p);o=t.number(l,s,h),p<1?this._frameId||(this._frameId=!0):c=!0}else o=s,c=!0;return this._active=!0,c&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!c,zoomDelta:o-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},ai.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.browser.now()-n.start)/n.duration,a=n.easing(i+.01)-n.easing(i),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=t.bezier(o,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r},ai.prototype.reset=function(){this._active=!1};var oi=function(t,e){this._clickZoom=t,this._tapZoom=e};oi.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},oi.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},oi.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},oi.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var si=function(){this.reset()};si.prototype.reset=function(){this._active=!1},si.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(r){r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.unproject(e)},{originalEvent:t})}}},si.prototype.enable=function(){this._enabled=!0},si.prototype.disable=function(){this._enabled=!1,this.reset()},si.prototype.isEnabled=function(){return this._enabled},si.prototype.isActive=function(){return this._active};var li=function(){this._tap=new jn({numTouches:1,numTaps:1}),this.reset()};li.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},li.prototype.touchstart=function(t,e,r){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=e[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,e,r))},li.prototype.touchmove=function(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;var n=e[0],i=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(t,e,r)},li.prototype.touchend=function(t,e,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(t,e,r)&&(this._tapTime=t.timeStamp)},li.prototype.touchcancel=function(){this.reset()},li.prototype.enable=function(){this._enabled=!0},li.prototype.disable=function(){this._enabled=!1,this.reset()},li.prototype.isEnabled=function(){return this._enabled},li.prototype.isActive=function(){return this._active};var ui=function(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r};ui.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},ui.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},ui.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},ui.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var ci=function(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r};ci.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},ci.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},ci.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},ci.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var pi=function(t,e,r,n){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0};pi.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},pi.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},pi.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},pi.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},pi.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},pi.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var hi=function(t){return t.zoom||t.drag||t.pitch||t.rotate},fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function di(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var mi=function(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new En(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);var i=this._el;this._listeners=[[i,"touchstart",{passive:!1}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(var a=0,o=this._listeners;aa?Math.min(2,b):Math.max(.5,b),w=Math.pow(y,1-e),T=i.unproject(_.add(x.mult(e*w)).mult(m));i.setLocationAtPoint(i.renderWorldCopies?T.wrap():T,d)}n._fireMoveEvents(r)}),(function(t){n._afterEase(r,t)}),e),this},r.prototype._prepareEase=function(e,r,n){void 0===n&&(n={}),this._moving=!0,r||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e,r){if(!this._easeId||!r||this._easeId!==r){delete this._easeId;var n=this._zooming,i=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),a&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},r.prototype.flyTo=function(e,r){var n=this;if(!e.essential&&t.browser.prefersReducedMotion){var i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,r)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var a=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),u=this.getPadding(),c="zoom"in e?t.clamp(+e.zoom,a.minZoom,a.maxZoom):o,p="bearing"in e?this._normalizeBearing(e.bearing,s):s,h="pitch"in e?+e.pitch:l,f="padding"in e?e.padding:a.padding,d=a.zoomScale(c-o),m=t.Point.convert(e.offset),y=a.centerPoint.add(m),g=a.pointLocation(y),v=t.LngLat.convert(e.center||g);this._normalizeCenter(v);var _=a.project(g),x=a.project(v).sub(_),b=e.curve,w=Math.max(a.width,a.height),T=w/d,k=x.mag();if("minZoom"in e){var A=t.clamp(Math.min(e.minZoom,o,c),a.minZoom,a.maxZoom),M=w/a.zoomScale(A-o);b=Math.sqrt(M/k*2)}var S=b*b;function C(t){var e=(T*T-w*w+(t?-1:1)*S*S*k*k)/(2*(t?T:w)*S*k);return Math.log(Math.sqrt(e*e+1)-e)}function L(t){return(Math.exp(t)-Math.exp(-t))/2}function E(t){return(Math.exp(t)+Math.exp(-t))/2}var I=C(0),z=function(t){return E(I)/E(I+b*t)},P=function(t){return w*((E(I)*(L(e=I+b*t)/E(e))-L(I))/S)/k;var e},D=(C(1)-I)/b;if(Math.abs(k)<1e-6||!isFinite(D)){if(Math.abs(w-T)<1e-6)return this.easeTo(e,r);var O=Te.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==p,this._pitching=h!==l,this._padding=!a.isPaddingEqual(f),this._prepareEase(r,!1),this._ease((function(e){var i=e*D,d=1/z(i);a.zoom=1===e?c:o+a.scaleZoom(d),n._rotating&&(a.bearing=t.number(s,p,e)),n._pitching&&(a.pitch=t.number(l,h,e)),n._padding&&(a.interpolatePadding(u,f,e),y=a.centerPoint.add(m));var g=1===e?v:a.unproject(_.add(x.mult(P(i))).mult(d));a.setLocationAtPoint(a.renderWorldCopies?g.wrap():g,y),n._fireMoveEvents(r)}),(function(){return n._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){return this._stop()},r.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}if(!t){var n=this.handlers;n&&n.stop()}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),gi=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};gi.prototype.getDefaultPosition=function(){return"bottom-right"},gi.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._innerContainer=r.create("div","mapboxgl-ctrl-attrib-inner",this._container),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},gi.prototype.onRemove=function(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},gi.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var n=r.reduce((function(t,e,n){return e.value&&(t+=e.key+"="+e.value+(n=0)return!1;return!0}))).join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},gi.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var vi=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};vi.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},vi.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},vi.prototype.getDefaultPosition=function(){return"bottom-left"},vi.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},vi.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},vi.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var _i=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};_i.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},_i.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var i=new wn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(n.call(this,i,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new _i,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},xi,e.locale),this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof wi))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return r._update(!1)})),this.on("moveend",(function(){return r._update(!1)})),this.on("zoom",(function(){return r._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1)),this.handlers=new mi(this,e),this._hash=e.hash&&new kn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new gi({customAttribution:e.customAttribution})),this.addControl(new vi,e.logoPosition),this.on("style.load",(function(){r.transform.unmodified&&r.jumpTo(r.style.stylesheet)})),this.on("data",(function(e){r._update("style"===e.dataType),r.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){r.fire(new t.Event(e.dataType+"dataloading",e))}))}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var a={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,r){if(void 0===r&&e.getDefaultPosition&&(r=e.getDefaultPosition()),void 0===r&&(r="top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var n=e.onAdd(this);this._controls.push(e);var i=this._controlPositions[r];return-1!==r.indexOf("bottom")?i.insertBefore(n,i.firstChild):i.appendChild(n),this},i.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i);var a=!this._moving;return a&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),a&&this.fire(new t.Event("moveend",e)),this},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},i.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},i.prototype._createDelegatedListener=function(t,e,r){var n,i=this;if("mouseenter"===t||"mouseover"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var o=i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[];o.length?a||(a=!0,r.call(i,new Pn(t,i,n.originalEvent,{features:o}))):a=!1},mouseout:function(){a=!1}}}}if("mouseleave"===t||"mouseout"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?o=!0:o&&(o=!1,r.call(i,new Pn(t,i,n.originalEvent)))},mouseout:function(e){o&&(o=!1,r.call(i,new Pn(t,i,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var n=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(i,t),delete t.features)},n)}},i.prototype.on=function(t,e,r){if(void 0===r)return n.prototype.on.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var a in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i),i.delegates)this.on(a,i.delegates[a]);return this},i.prototype.once=function(t,e,r){if(void 0===r)return n.prototype.once.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var a in i.delegates)this.once(a,i.delegates[a]);return this},i.prototype.off=function(t,e,r){var i=this;return void 0===r?n.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(n){for(var a=n[t],o=0;o180;){var s=n.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}Li.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag()},Li.prototype.move=function(t,e){var r=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&r.setBearing(r.getBearing()+n.bearingDelta),this.mousePitch){var i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&r.setPitch(r.getPitch()+i.pitchDelta)}},Li.prototype.off=function(){var t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},Li.prototype.offTemp=function(){r.enableDrag(),r.removeEventListener(t.window,"mousemove",this.mousemove),r.removeEventListener(t.window,"mouseup",this.mouseup)},Li.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),r.mousePos(this.element,e)),r.addEventListener(t.window,"mousemove",this.mousemove),r.addEventListener(t.window,"mouseup",this.mouseup)},Li.prototype.mousemove=function(t){this.move(t,r.mousePos(this.element,t))},Li.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},Li.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},Li.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},Li.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)e.getEast()||r.latitudee.getNorth())},n.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}},n.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},n.prototype._updateCamera=function(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,i=this._map.getBearing(),a=t.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(n),a,{geolocateSource:!0})},n.prototype._updateMarker=function(e){if(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},n.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),r=this._map.unproject([1,t]),n=e.distanceTo(r),i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=i+"px",this._circleElement.style.height=i+"px"},n.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},n.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Fi)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},n.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},n.prototype._setupUI=function(e){var n=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=r.create("button","mapboxgl-ctrl-geolocate",this._container),r.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{var a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Di(this._dotElement),this._circleElement=r.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Di({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==n._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(n._watchState="BACKGROUND",n._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),n._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),n.fire(new t.Event("trackuserlocationend")))}))},n.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ri--,Fi=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Ri>1?(e={maximumAge:6e5,timeout:0},Fi=!0):(e=this.options.positionOptions,Fi=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},n.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},n}(t.Evented),Ni={maxWidth:100,unit:"metric"},Ui=function(e){this.options=t.extend({},Ni,e),t.bindAll(["_onMove","setUnit"],this)};function ji(t,e,r){var n=r&&r.maxWidth||100,i=t._container.clientHeight/2,a=t.unproject([0,i]),o=t.unproject([n,i]),s=a.distanceTo(o);if(r&&"imperial"===r.unit){var l=3.2808*s;l>5280?Vi(e,n,l/5280,t._getUIString("ScaleControl.Miles")):Vi(e,n,l,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?Vi(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Vi(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):Vi(e,n,s,t._getUIString("ScaleControl.Meters"))}function Vi(t,e,r,n){var i,a,o,s=(i=r,(a=Math.pow(10,(""+Math.floor(i)).length-1))*(o=(o=i/a)>=10?10:o>=5?5:o>=3?3:o>=2?2:o>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(o)));t.style.width=e*(s/r)+"px",t.innerHTML=s+" "+n}Ui.prototype.getDefaultPosition=function(){return"bottom-left"},Ui.prototype._onMove=function(){ji(this._map,this._container,this.options)},Ui.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Ui.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Ui.prototype.setUnit=function(t){this.options.unit=t,ji(this._map,this._container,this.options)};var qi=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};qi.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},qi.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},qi.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},qi.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},qi.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},qi.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},qi.prototype._isFullscreen=function(){return this._fullscreen},qi.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},qi.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Hi={closeButton:!0,closeOnClick:!0,className:"",maxWidth:"240px"},Zi=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(Hi),r),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},n.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},n.prototype.getElement=function(){return this._container},n.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},n.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},n.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},n.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},n.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},n.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},n.prototype._createContent=function(){this._content&&r.remove(this._content),this._content=r.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},n.prototype._onMouseUp=function(t){this._update(t.point)},n.prototype._onMouseMove=function(t){this._update(t.point)},n.prototype._onDrag=function(t){this._update(t.point)},n.prototype._update=function(e){var n=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return n._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ei(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),a=this.options.anchor,o=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(n,n),"top-right":new t.Point(-n,n),bottom:new t.Point(0,-r),"bottom-left":new t.Point(n,-n),"bottom-right":new t.Point(-n,-n),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var i=t.Point.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!a){var s,l=this._container.offsetWidth,u=this._container.offsetHeight;s=i.y+o.bottom.ythis._map.transform.height-u?["bottom"]:[],i.xthis._map.transform.width-l/2&&s.push("right"),a=0===s.length?"bottom":s.join("-")}var c=i.add(o[a]).round();r.setTransform(this._container,Ii[a]+" translate("+c.x+"px,"+c.y+"px)"),zi(this._container,a,"popup")}},n.prototype._onClose=function(){this.remove()},n}(t.Evented),Gi={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Ai,NavigationControl:Ci,GeolocateControl:Bi,AttributionControl:gi,ScaleControl:Ui,FullscreenControl:qi,Popup:Zi,Marker:Di,Style:qe,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Bt().acquire(Dt)},clearPrewarmedResources:function(){var t=Rt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Dt),Rt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Ot.workerCount},set workerCount(t){Ot.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:""};return Gi})),r}))},{}],54:[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}},{}],55:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,(function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),"m"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length=-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}},{}],30:[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 p=e.linesIntersect(o,s,u,c);if(!1===p){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),f=e.pointsSame(s,c);if(h&&f)return n;var d=!h&&e.pointBetween(o,u,c),m=!f&&e.pointBetween(s,u,c);if(h)return m?l(n,s):l(t,c),n;d&&(f||(m?l(n,s):l(t,c)),l(n,o))}else 0===p.alongA&&(-1===p.alongB?l(t,u):0===p.alongB?l(t,p.pt):1===p.alongB&&l(t,c)),0===p.alongB&&(-1===p.alongA?l(n,o):0===p.alongA?l(n,p.pt):1===p.alongA&&l(n,s));return!1}for(var p=[];!a.isEmpty();){var h=a.getHead();if(r&&r.vert(h.pt[0]),h.isStart){r&&r.segmentNew(h.seg,h.primary);var f=u(h),d=f.before?f.before.ev:null,m=f.after?f.after.ev:null;function g(){if(d){var t=c(h,d);if(t)return t}return!!m&&c(h,m)}r&&r.tempStatus(h.seg,!!d&&d.seg,!!m&&m.seg);var y,v=g();if(v){var _;if(t)(_=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(v.seg.myFill.above=!v.seg.myFill.above);else v.seg.otherFill=h.seg.myFill;r&&r.segmentUpdate(v.seg),h.other.remove(),h.remove()}if(a.getHead()!==h){r&&r.rewind(h.seg);continue}if(t)_=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below,h.seg.myFill.below=m?m.seg.myFill.above:i,h.seg.myFill.above=_?!h.seg.myFill.below:h.seg.myFill.below;else if(null===h.seg.otherFill)y=m?h.primary===m.primary?m.seg.otherFill.above:m.seg.myFill.above:h.primary?o:i,h.seg.otherFill={above:y,below:y};r&&r.status(h.seg,!!d&&d.seg,!!m&&m.seg),h.other.status=f.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 b=h.seg.myFill;h.seg.myFill=h.seg.otherFill,h.seg.otherFill=b}p.push(h.seg)}a.getHead().remove()}return r&&r.done(),p}return t?{addRegion:function(t){for(var n,i,a,o=t[t.length-1],l=0;l1)for(var r=1;r1&&(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=E(t,360),e=E(e,100),r=E(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),p=!0,h="hsl"),e.hasOwnProperty("a")&&(a=e.a));var f,d,m;return a=L(a),{ok:p,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=E(t,255),e=E(e,255),r=E(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 M(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=p(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=p(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(O(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*E(this._r,255))+"%",g:a(100*E(this._g,255))+"%",b:a(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*E(this._r,255))+"%, "+a(100*E(this._g,255))+"%, "+a(100*E(this._b,255))+"%)":"rgba("+a(100*E(this._r,255))+"%, "+a(100*E(this._g,255))+"%, "+a(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(C[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=u(t);r="#"+f(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(y,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(_,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(m,arguments)},greyscale:function(){return this._applyModification(g,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(A,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,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]:D(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 S=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"},C=u.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(S);function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(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 z(t){return o(1,s(0,t))}function I(t){return parseInt(t,16)}function P(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function O(e){return t.round(255*parseFloat(e)).toString(16)}function R(t){return I(t)/255}var F,B,N,U=(B="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",N="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+B),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+B),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+B),hsva:new RegExp("hsva"+N),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 j(t){return!!U.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=u:window.tinycolor=u}(Math)},{}],37:[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}]},{}],38:[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":215,"../../plots/cartesian/constants":231,"../../plots/font_attributes":253,"./arrow_paths":37}],39:[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"],p=t["_"+a+"padminus"],h={x:1,y:-1}[a]*t[a+"shift"],f=3*t.arrowsize*t.arrowwidth||0,d=f+h,m=f-h,g=3*t.startarrowsize*t.arrowwidth||0,y=g+h,v=g-h;if(u===l){var _=i.findExtremes(e,[e.r2c(o)],{ppadplus:d,ppadminus:m}),x=i.findExtremes(e,[e.r2c(s)],{ppadplus:Math.max(c,y),ppadminus:Math.max(p,v)});r={min:[_.min[0],x.min[0]],max:[_.max[0],x.max[0]]}}else y=s?y+s:y,v=s?v-s:v,r=i.findExtremes(e,[e.r2c(o)],{ppadplus:Math.max(c,d,y),ppadminus:Math.max(p,m,v)});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":181,"../../plots/cartesian/axes":225,"./draw":44}],40:[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,p=[],h=[],f=[],d=(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),p={},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,Z=["x","y"],G=0;G1)&&(tt===$?((ut=et.r2fraction(e["a"+Q]))<0||ut>1)&&(H=!0):H=!0),X=et._offset+et.r2p(e[Q]),K=.5}else"x"===Q?(Y=e[Q],X=x.l+x.w*Y):(Y=1-e[Q],X=x.t+x.h*Y),K=e.showarrow?.5:Y;if(e.showarrow){lt.head=X;var ct=e["a"+Q];J=nt*j(.5,e.xanchor)-it*j(.5,e.yanchor),tt===$?(lt.tail=et._offset+et.r2p(ct),W=J):(lt.tail=X+ct,W=J+ct),lt.text=lt.tail+J;var pt=_["x"===Q?"width":"height"];if("paper"===$&&(lt.head=o.constrain(lt.head,1,pt-1)),"pixel"===tt){var ht=-Math.max(lt.tail-3,lt.text),ft=Math.min(lt.tail+3,lt.text)-pt;ht>0?(lt.tail+=ht,lt.text+=ht):ft>0&&(lt.tail-=ft,lt.text-=ft)}lt.tail+=st,lt.head+=st}else W=J=at*j(K,ot),lt.text=X+J;lt.text+=st,J+=st,W+=st,e["_"+Q+"padplus"]=at/2+W,e["_"+Q+"padminus"]=at/2-W,e["_"+Q+"size"]=at,e["_"+Q+"shift"]=J}if(H)P.remove();else{var dt=0,mt=0;if("left"!==e.align&&(dt=(w-y)*("center"===e.align?.5:1)),"top"!==e.valign&&(mt=(I-v)*("middle"===e.valign?.5:1)),c)n.select("svg").attr({x:R+dt-1,y:R+mt}).call(u.setClipUrl,B?M:null,t);else{var gt=R+mt-d.top,yt=R+dt-d.left;V.call(p.positionText,yt,gt).call(u.setClipUrl,B?M:null,t)}N.select("rect").call(u.setRect,R,R,w,I),F.call(u.setRect,D/2,D/2,O-D,U-D),P.call(u.setTranslate,Math.round(S.x.text-O/2),Math.round(S.y.text-U/2)),E.attr({transform:"rotate("+C+","+S.x.text+","+S.y.text+")"});var vt,_t=function(r,n){L.selectAll(".annotation-arrow-g").remove();var c=S.x.head,p=S.y.head,h=S.x.tail+r,d=S.y.tail+n,y=S.x.text+r,v=S.y.text+n,_=o.rotationXYMatrix(C,y,v),w=o.apply2DTransform(_),M=o.apply2DTransform2(_),z=+F.attr("width"),I=+F.attr("height"),D=y-.5*z,O=D+z,R=v-.5*I,B=R+I,N=[[D,R,D,B],[D,B,O,B],[O,B,O,R],[O,R,D,R]].map(M);if(!N.reduce((function(t,e){return t^!!o.segmentsIntersect(c,p,c+1e6,p+1e6,e[0],e[1],e[2],e[3])}),!1)){N.forEach((function(t){var e=o.segmentsIntersect(h,d,c,p,t[0],t[1],t[2],t[3]);e&&(h=e.x,d=e.y)}));var U=e.arrowwidth,j=e.arrowcolor,V=e.arrowside,q=L.append("g").style({opacity:l.opacity(j)}).classed("annotation-arrow-g",!0),H=q.append("path").attr("d","M"+h+","+d+"L"+c+","+p).style("stroke-width",U+"px").call(l.stroke,l.rgb(j));if(m(H,V,e),b.annotationPosition&&H.node().parentNode&&!a){var Z=c,G=p;if(e.standoff){var X=Math.sqrt(Math.pow(c-h,2)+Math.pow(p-d,2));Z+=e.standoff*(h-c)/X,G+=e.standoff*(d-p)/X}var W,Y,K=q.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-Z)+","+(d-G),transform:"translate("+Z+","+G+")"}).style("stroke-width",U+6+"px").call(l.stroke,"rgba(0,0,0,0)").call(l.fill,"rgba(0,0,0,0)");f.init({element:K.node(),gd:t,prepFn:function(){var t=u.getTranslate(P);W=t.x,Y=t.y,s&&s.autorange&&T(s._name+".autorange",!0),g&&g.autorange&&T(g._name+".autorange",!0)},moveFn:function(t,r){var n=w(W,Y),i=n[0]+t,a=n[1]+r;P.call(u.setTranslate,i,a),k("x",s?s.p2r(s.r2p(e.x)+t):e.x+t/x.w),k("y",g?g.p2r(g.r2p(e.y)+r):e.y-r/x.h),e.axref===e.xref&&k("ax",s.p2r(s.r2p(e.ax)+t)),e.ayref===e.yref&&k("ay",g.p2r(g.r2p(e.ay)+r)),q.attr("transform","translate("+t+","+r+")"),E.attr({transform:"rotate("+C+","+i+","+a+")"})},doneFn:function(){i.call("_guiRelayout",t,A());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&_t(0,0),z)f.init({element:P.node(),gd:t,prepFn:function(){vt=E.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?k("ax",s.p2r(s.r2p(e.ax)+t)):k("ax",e.ax+t),e.ayref===e.yref?k("ay",g.p2r(g.r2p(e.ay)+r)):k("ay",e.ay+r),_t(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=f.align(u+t/x.w,l,0,1,e.xanchor)}if(g)o=g.p2r(g.r2p(e.y)+r);else{var c=e._ysize/x.h,p=e.y-(e._yshift+e.yshift)/x.h-c/2;o=f.align(p-r/x.h,c,0,1,e.yanchor)}k("x",i),k("y",o),s&&g||(n=f.getCursor(s?.5:i,g?.5:o,e.xanchor,e.yanchor))}E.attr({transform:"translate("+t+","+r+")"+vt}),h(P,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",q(n))},doneFn:function(){h(P),i.call("_guiRelayout",t,A());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,g=e.indexOf("end")>=0,y=p.backoff*f+r.standoff,v=h.backoff*d+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 _=o.x-s.x,x=o.y-s.y;if(u=(l=Math.atan2(x,_))+Math.PI,y&&v&&y+v>Math.sqrt(_*_+x*x))return void z();if(y){if(y*y>_*_+x*x)return void z();var b=y*Math.cos(l),w=y*Math.sin(l);s.x+=b,s.y+=w,t.attr({x2:s.x,y2:s.y})}if(v){if(v*v>_*_+x*x)return void z();var T=v*Math.cos(l),k=v*Math.sin(l);o.x-=T,o.y-=k,t.attr({x1:o.x,y1:o.y})}}else if("path"===c.nodeName){var A=c.getTotalLength(),M="";if(A1){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":256,"../annotations/draw":44}],51:[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?n>=l:n<=l));i++)n>c&&n0?n>=l:n<=l));i++)n>r[0]&&n1){var Y=Math.pow(10,Math.floor(Math.log(W)/Math.LN10));G*=Y*u.roundUp(W/Y,[2,5,10]),(Math.abs(L.start)/L.size+1e-6)%1<2e-6&&(Z.tick0=0)}Z.dtick=G}Z.domain=[V+N,V+R-N],Z.setScale(),t.attr("transform","translate("+Math.round(l.l)+","+Math.round(l.t)+")");var K,J=t.select("."+k.cbtitleunshift).attr("transform","translate(-"+Math.round(l.l)+",-"+Math.round(l.t)+")"),Q=t.select("."+k.cbaxis),$=0;function tt(n,i){var a={propContainer:Z,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+k.cbtitle)},s="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+s+",."+s+"-math-group").remove(),d.draw(r,n,c(a,i||{}))}return u.syncOrAsync([a.previousPromises,function(){if(-1!==["top","bottom"].indexOf(A)){var t,r=l.l+(e.x+F)*l.w,n=Z.title.font.size;t="top"===A?(1-(V+R-N))*l.h+l.t+3+.75*n:(1-(V+N))*l.h+l.t-3-.25*n,tt(Z._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(A)){var a=t.select("."+k.cbtitle),o=a.select("text"),c=[-e.outlinewidth/2,e.outlinewidth/2],p=a.select(".h"+Z._id+"title-math-group").node(),f=15.6;if(o.node()&&(f=parseInt(o.node().style.fontSize,10)*b),p?($=h.bBox(p).height)>f&&(c[1]-=($-f)/2):o.node()&&!o.classed(k.jsPlaceholder)&&($=h.bBox(o.node()).height),$){if($+=5,"top"===A)Z.domain[1]-=$/l.h,c[1]*=-1;else{Z.domain[0]+=$/l.h;var d=m.lineCount(o);c[1]+=(1-d)*f}a.attr("transform","translate("+c+")"),Z.setScale()}}t.selectAll("."+k.cbfills+",."+k.cblines).attr("transform","translate(0,"+Math.round(l.h*(1-Z.domain[1]))+")"),Q.attr("transform","translate(0,"+Math.round(-l.t)+")");var y=t.select("."+k.cbfills).selectAll("rect."+k.cbfill).data(z);y.enter().append("rect").classed(k.cbfill,!0).style("stroke","none"),y.exit().remove();var v=M.map(Z.c2p).map(Math.round).sort((function(t,e){return t-e}));y.each((function(t,a){var o=[0===a?M[0]:(z[a]+z[a-1])/2,a===z.length-1?M[1]:(z[a]+z[a+1])/2].map(Z.c2p).map(Math.round);o[1]=u.constrain(o[1]+(o[1]>o[0])?1:-1,v[0],v[1]);var s=n.select(this).attr({x:U,width:Math.max(P,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)h.gradient(s,r,e._id,"vertical",e._fillgradient,"fill");else{var l=C(t).replace("e-","");s.attr("fill",i(l).toHexString())}}));var _=t.select("."+k.cblines).selectAll("path."+k.cbline).data(g.color&&g.width?I:[]);_.enter().append("path").classed(k.cbline,!0),_.exit().remove(),_.each((function(t){n.select(this).attr("d","M"+U+","+(Math.round(Z.c2p(t))+g.width/2%1)+"h"+P).call(h.lineGroupStyle,g.width,S(t),g.dash)})),Q.selectAll("g."+Z._id+"tick,path").remove();var x=U+P+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),w=s.calcTicks(Z),T=s.makeTransFn(Z),L=s.getTickSigns(Z)[2];return s.drawTicks(r,Z,{vals:"inside"===Z.ticks?s.clipEnds(Z,w):w,layer:Q,path:s.makeTickPath(Z,x,L),transFn:T}),s.drawLabels(r,Z,{vals:w,layer:Q,transFn:T,labelFns:s.makeLabelFns(Z,x)})},function(){if(-1===["top","bottom"].indexOf(A)){var t=Z.title.font.size,e=Z._offset+Z._length/2,i=l.l+(Z.position||0)*l.w+("right"===Z.side?10+t*(Z.showticklabels?1:.5):-10-t*(Z.showticklabels?.5:0));tt("h"+Z._id+"title",{avoid:{selection:n.select(r).selectAll("g."+Z._id+"tick"),side:A,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:i,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},a.previousPromises,function(){var n=P+e.outlinewidth/2+h.bBox(Q.node()).width;if((K=J.select("text")).node()&&!K.classed(k.jsPlaceholder)){var i,o=J.select(".h"+Z._id+"title-math-group").node();i=o&&-1!==["top","bottom"].indexOf(A)?h.bBox(o).width:h.bBox(J.node()).right-U-l.l,n=Math.max(n,i)}var s=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,u=q-H;t.select("."+k.cbbg).attr({x:U-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:H-B,width:Math.max(s,2),height:Math.max(u+2*B,2)}).call(f.fill,e.bgcolor).call(f.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+k.cboutline).attr({x:U,y:H+e.ypad+("top"===A?$:0),width:Math.max(P,2),height:Math.max(u-2*e.ypad-$,2)}).call(f.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var c=({center:.5,right:1}[e.xanchor]||0)*s;t.attr("transform","translate("+(l.l-c)+","+l.t+")");var p={},d=w[e.yanchor],m=T[e.yanchor];"pixels"===e.lenmode?(p.y=e.y,p.t=u*d,p.b=u*m):(p.t=p.b=0,p.yt=e.y+e.len*d,p.yb=e.y-e.len*m);var g=w[e.xanchor],y=T[e.xanchor];if("pixels"===e.thicknessmode)p.x=e.x,p.l=s*g,p.r=s*y;else{var v=s-P;p.l=v*g,p.r=v*y,p.xl=e.x-e.thickness*g,p.xr=e.x+e.thickness*y}a.autoMargin(r,e._id,p)}],r)}(r,e,t);g&&g.then&&(t._promises||[]).push(g),t._context.edits.colorbarPosition&&function(t,e,r){var n,i,a,s=r._fullLayout._size;l.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),p(t)},moveFn:function(r,o){t.attr("transform",n+" translate("+r+","+o+")"),i=l.align(e._xLeftFrac+r/s.w,e._thickFrac,0,1,e.xanchor),a=l.align(e._yBottomFrac-o/s.h,e._lenFrac,0,1,e.yanchor);var u=l.getCursor(i,a,e.xanchor,e.yanchor);p(t,u)},doneFn:function(){if(p(t),void 0!==i&&void 0!==a){var n={};n[e._propPrefix+"x"]=i,n[e._propPrefix+"y"]=a,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){a.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":155,"../../lib":181,"../../lib/extend":173,"../../lib/setcursor":200,"../../lib/svg_text_utils":202,"../../plots/cartesian/axes":225,"../../plots/cartesian/axis_defaults":227,"../../plots/cartesian/layout_attributes":239,"../../plots/cartesian/position_defaults":242,"../../plots/plots":266,"../../registry":275,"../color":53,"../colorscale/helpers":64,"../dragelement":72,"../drawing":75,"../titles":148,"./constants":55,d3:16,tinycolor2:36}],58:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":181}],59:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":54,"./defaults":56,"./draw":57,"./has_colorbar":58}],60:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),i=t("../../lib/regex").counter,a=t("./scales.js").scales;Object.keys(a);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,s=(e=e||{}).cLetter||"c",l=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),u="showScaleDflt"in e?e.showScaleDflt:"z"===s,c="string"==typeof e.colorscaleDflt?a[e.colorscaleDflt]:null,p=e.editTypeOverride||"",h=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(h+(r={z:"z",c:"color"}[s]));var f=s+"auto",d=s+"min",m=s+"max",g=s+"mid",y=(o(h+f),o(h+d),o(h+m),{});y[d]=y[m]=void 0;var v={};v[f]=!1;var _={};return"color"===r&&(_.color={valType:"color",arrayOk:!0,editType:p||"style"},e.anim&&(_.color.anim=!0)),_[f]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:y},_[d]={valType:"number",dflt:null,editType:p||"plot",impliedEdits:v},_[m]={valType:"number",dflt:null,editType:p||"plot",impliedEdits:v},_[g]={valType:"number",dflt:null,editType:"calc",impliedEdits:y},_.colorscale={valType:"colorscale",editType:"calc",dflt:c,impliedEdits:{autocolorscale:!1}},_.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},_.reversescale={valType:"boolean",dflt:!1,editType:"plot"},l||(_.showscale={valType:"boolean",dflt:u,editType:"calc"},_.colorbar=n),e.noColorAxis||(_.coloraxis={valType:"subplotid",regex:i("coloraxis"),dflt:null,editType:"calc"}),_}},{"../../lib/regex":196,"../colorbar/attributes":54,"./scales.js":68}],61:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,s=t._fullLayout,l=r.vals,u=r.containerStr,c=u?i.nestedProperty(e,u).get():e,p=a(c),h=!1!==p.auto,f=p.min,d=p.max,m=p.mid,g=function(){return i.aggNums(Math.min,null,l)},y=function(){return i.aggNums(Math.max,null,l)};(void 0===f?f=g():h&&(f=c._colorAx&&n(f)?Math.min(f,g()):g()),void 0===d?d=y():h&&(d=c._colorAx&&n(d)?Math.max(d,y()):y()),h&&void 0!==m&&(d-m>m-f?f=m-(d-m):d-m=0?s.colorscale.sequential:s.colorscale.sequentialminus,p._sync("colorscale",o))}},{"../../lib":181,"./helpers":64,"fast-isnumeric":18}],62:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./helpers").hasColorscale,a=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,i){var o=i.container?n.nestedProperty(t,i.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var s=a(o),l=s.auto;(l||void 0===s.min)&&r(o,i.min),(l||void 0===s.max)&&r(o,i.max),s.autocolorscale&&r(o,"colorscale")}}for(var s=0;s=0;n--,i++){var a=t[n];r[i]=[1-a[0],a[1]]}return r}function d(t,e){e=e||{};for(var r=t.domain,o=t.range,l=o.length,u=new Array(l),c=0;c4/3-s?o:s}},{}],70:[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":181}],71:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],72:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),i=t("has-hover"),a=t("has-passive-events"),o=t("../../lib").removeElement,s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");function c(){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 p(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){var e,r,n,u,h,f,d,m,g=t.gd,y=1,v=g._context.doubleClickDelay,_=t.element;g._mouseDownTime||(g._mouseDownTime=0),_.style.pointerEvents="all",_.onmousedown=b,a?(_._ontouchstart&&_.removeEventListener("touchstart",_._ontouchstart),_._ontouchstart=b,_.addEventListener("touchstart",b,{passive:!1})):_.ontouchstart=b;var x=t.clampFn||function(t,e,r){return Math.abs(t)v&&(y=Math.max(y-1,1)),g._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(y,f),!m){var r;try{r=new MouseEvent("click",e)}catch(t){var n=p(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)}d.dispatchEvent(r)}g._dragging=!1,g._dragged=!1}else g._dragged=!1}},l.coverSlip=c},{"../../lib":181,"../../plots/cartesian/constants":231,"./align":69,"./cursor":70,"./unhover":73,"has-hover":20,"has-passive-events":21,"mouse-event-offset":25}],73:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/dom").getGraphDiv,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/dom":171,"../../lib/events":172,"../../lib/throttle":203,"../fx/constants":87}],74:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],75:[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"),p=t("../../constants/xmlns_namespaces"),h=t("../../constants/alignment").LINE_SPACING,f=t("../../constants/interactions").DESELECTDIM,d=t("../../traces/scatter/subtypes"),m=t("../../traces/scatter/make_bubble_size_func"),g=t("../../components/fx/helpers").appendArrayPointValue,y=e.exports={};y.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)},y.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},y.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},y.setRect=function(t,e,r,n,i){t.call(y.setPosition,e,r).call(y.setSize,n,i)},y.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)},y.translatePoints=function(t,e,r){t.each((function(t){var i=n.select(this);y.translatePoint(t,i,e,r)}))},y.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},y.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,i=e.yaxis;t.each((function(e){var a=e[0].trace,s=a.xcalendar,l=a.ycalendar,u=o.traceIs(a,"bar-like")?".bartext":".point,.textpoint";t.selectAll(u).each((function(t){y.hideOutsideRangePoint(t,n.select(this),r,i,s,l)}))}))}},y.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},y.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),y.dashLine(e,l,o)},y.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(y.dashLine,l,o)}))},y.dashLine=function(t,e,r){r=+r||0,e=y.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},y.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},y.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},y.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 v=t("./symbol_defs");y.symbolNames=[],y.symbolFuncs=[],y.symbolNeedLines={},y.symbolNoDot={},y.symbolNoFill={},y.symbolList=[],Object.keys(v).forEach((function(t){var e=v[t],r=e.n;y.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),y.symbolNames[r]=t,y.symbolFuncs[r]=e.f,e.needLine&&(y.symbolNeedLines[r]=!0),e.noDot?y.symbolNoDot[r]=!0:y.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(y.symbolNoFill[r]=!0)}));var _=y.symbolNames.length;function x(t,e){var r=t%100;return y.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}y.symbolNumber=function(t){if(i(t))t=+t;else 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=y.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var b={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0},T=n.format("~.1f"),k={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:b},horizontalreversed:{node:"linearGradient",attrs:b,reversed:!0},vertical:{node:"linearGradient",attrs:w},verticalreversed:{node:"linearGradient",attrs:w,reversed:!0}};y.gradient=function(t,e,r,i,o,l){for(var c=o.length,p=k[i],h=new Array(c),f=0;f"+y(t);d._gradientUrlQueryParts[v]=1},y.initGradients=function(t){var e=t._fullLayout;u.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},y.pointStyle=function(t,e,r){if(t.size()){var i=y.makePointStyleFns(e);t.each((function(t){y.singlePointStyle(t,n.select(this),e,i,r)}))}},y.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=y.symbolNumber(t.mx||a.symbol)||0;t.om=c%200>=100,e.attr("d",x(c,l))}var p,h,f,d=!1;if(t.so)f=o.outlierwidth,h=o.outliercolor,p=a.outliercolor;else{var m=(o||{}).width;f=(t.mlw+1||m+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)&&(p=s.defaultLine,d=!0),p="mc"in t?t.mcc=n.markerScale(t.mc):a.color||"rgba(0,0,0,0)",n.selectedColorFn&&(p=n.selectedColorFn(t))}if(t.om)e.call(s.stroke,p).style({"stroke-width":(f||1)+"px",fill:"none"});else{e.style("stroke-width",(t.isBlank?0:f)+"px");var g=a.gradient,v=t.mgt;if(v?d=!0:v=g&&g.type,Array.isArray(v)&&(v=v[0],k[v]||(v=0)),v&&"none"!==v){var _=t.mgc;_?d=!0:_=g.color;var b=r.uid;d&&(b+="-"+t.i),y.gradient(e,i,b,v,[[0,_],[1,p]],"fill")}else s.fill(e,p);f&&s.stroke(e,h)}},y.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=y.tryColorscale(r,""),e.lineScale=y.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=d.isBubble(t)?m(t):function(){return(r.size||6)/2}),t.selectedpoints&&u.extendFlat(e,y.makeSelectedPointStyleFns(t)),e},y.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,p=s.opacity,h=void 0!==c,d=void 0!==p;(u.isArrayOrTypedArray(l)||h||d)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?i.opacity:t.mo;return t.selected?h?c:e:d?p:f*e});var m=i.color,g=a.color,y=s.color;(g||y)&&(e.selectedColorFn=function(t){var e=t.mcc||m;return t.selected?g||e:y||e});var v=i.size,_=a.size,x=s.size,b=void 0!==_,w=void 0!==x;return o.traceIs(t,"symbols")&&(b||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||v/2;return t.selected?b?_/2:e:w?x/2:e}),e},y.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,f))},e},y.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.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(y.symbolNumber(n),a)),e.mrc2=a})),a.length&&t.each((function(t){for(var e=n.select(this),r=0;r0?r:0}y.textPointStyle=function(t,e,r){if(t.size()){var i;if(e.selectedpoints){var a=y.makeSelectedTextStyleFns(e);i=a.selectedTextColorFn}var o=e.texttemplate,s=r._fullLayout;t.each((function(t){var a=n.select(this),l=o?u.extractOption(t,e,"txt","texttemplate"):u.extractOption(t,e,"tx","text");if(l||0===l){if(o){var p=e._module.formatLabels?e._module.formatLabels(t,e,s):{},h={};g(h,e,t.i);var f=e._meta||{};l=u.texttemplateString(l,p,s._d3locale,h,t,f)}var d=t.tp||e.textposition,m=S(t,e),v=i?i(t):t.tc||e.textfont.color;a.call(y.font,t.tf||e.textfont.family,m,v).text(l).call(c.convertToTspans,r).call(M,d,m,t.mrc)}else a.remove()}))}},y.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.makeSelectedTextStyleFns(e);t.each((function(t){var i=n.select(this),a=r.selectedTextColorFn(t),o=t.tp||e.textposition,l=S(t,e);s.fill(i,a),M(i,o,l,t.mrc2||t.mrc)}))}};function C(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,.25),c=Math.pow(s*s+l*l,.25),p=(c*c*a-u*u*s)*i,h=(c*c*o-u*u*l)*i,f=3*c*(u+c),d=3*u*(u+c);return[[n.round(e[0]+(f&&p/f),2),n.round(e[1]+(f&&h/f),2)],[n.round(e[0]-(d&&p/d),2),n.round(e[1]-(d&&h/d),2)]]}y.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&&(y.savedBBoxes={},z=0),r&&(y.savedBBoxes[r]=g),z++,u.extendFlat({},g)},y.setClipUrl=function(t,e,r){t.attr("clip-path",P(e,r))},y.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}},y.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},y.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}},y.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 D=/\s*sc.*/;y.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(D,"");t=(t+=n).trim(),this.setAttribute("transform",t)}))}};var O=/translate\([^)]*\)\s*$/;y.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(O);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),i.attr("transform",t.join(" "))}}))}},{"../../components/fx/helpers":89,"../../constants/alignment":155,"../../constants/interactions":157,"../../constants/xmlns_namespaces":159,"../../lib":181,"../../lib/svg_text_utils":202,"../../registry":275,"../../traces/scatter/make_bubble_size_func":323,"../../traces/scatter/subtypes":330,"../color":53,"../colorscale":65,"./symbol_defs":76,d3:16,"fast-isnumeric":18,tinycolor2:36}],76:[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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:16}],77:[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"}}}},{}],78:[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),p=0;p0;e.each((function(e){var p,h=e[0].trace,f=h.error_x||{},d=h.error_y||{};h.ids&&(p=function(t){return t.id});var m=o.hasMarkers(h)&&h.marker.maxdisplayed>0;d.visible||f.visible||(e=[]);var g=n.select(this).selectAll("g.errorbar").data(e,p);if(g.exit().remove(),e.length){f.visible||g.selectAll("path.xerror").remove(),d.visible||g.selectAll("path.yerror").remove(),g.style("opacity",1);var y=g.enter().append("g").classed("errorbar",!0);c&&y.style("opacity",0).transition().duration(s.duration).style("opacity",1),a.setClipUrl(g,r.layerClipId,t),g.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(!m||t.vis){var a,o=e.select("path.yerror");if(d.visible&&i(r.x)&&i(r.yh)&&i(r.ys)){var p=d.width;a="M"+(r.x-p)+","+r.yh+"h"+2*p+"m-"+p+",0V"+r.ys,r.noYS||(a+="m-"+p+",0h"+2*p),!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(f.visible&&i(r.y)&&i(r.xh)&&i(r.xs)){var g=(f.copy_ystyle?d:f).width;a="M"+r.xh+","+(r.y-g)+"v"+2*g+"m0,-"+g+"H"+r.xs,r.noXS||(a+="m0,-"+g+"v"+2*g),!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":330,"../drawing":75,d3:16,"fast-isnumeric":18}],83:[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":53,d3:16}],84:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("./layout_attributes").hoverlabel,a=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:a({},i.bgcolor,{arrayOk:!0}),bordercolor:a({},i.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:a({},i.align,{arrayOk:!0}),namelength:a({},i.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":173,"../../plots/font_attributes":253,"./layout_attributes":94}],85:[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.indexx[0]._length||tt<0||tt>w[0]._length)return h.unhoverRaw(t,e)}if(e.pointerX=$+x[0]._offset,e.pointerY=tt+w[0]._offset,D="xval"in e?m.flat(l,e.xval):m.p2c(x,$),O="yval"in e?m.flat(l,e.yval):m.p2c(w,tt),!i(D[0])||!i(O[0]))return o.warn("Fx.hover failed",e,t),h.unhoverRaw(t,e)}var rt=1/0;function nt(t,r){for(F=0;FG&&(Y.splice(0,G),rt=Y[0].distance),y&&0!==W&&0===Y.length){Z.distance=W,Z.index=!1;var h=N._module.hoverPoints(Z,q,H,"closest",c._hoverlayer);if(h&&(h=h.filter((function(t){return t.spikeDistance<=W}))),h&&h.length){var f,d=h.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(d.length){var g=d[0];i(g.x0)&&i(g.y0)&&(f=at(g),(!J.vLinePoint||J.vLinePoint.spikeDistance>f.spikeDistance)&&(J.vLinePoint=f))}var v=h.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(v.length){var _=v[0];i(_.x0)&&i(_.y0)&&(f=at(_),(!J.hLinePoint||J.hLinePoint.spikeDistance>f.spikeDistance)&&(J.hLinePoint=f))}}}}}function it(t,e){for(var r,n=null,i=1/0,a=0;a1||Y.length>1)||"closest"===L&&Q&&Y.length>1,At=p.combine(c.plot_bgcolor||p.background,c.paper_bgcolor),Mt={hovermode:L,rotateLabels:kt,bgColor:At,container:c._hoverlayer,outerContainer:c._paperdiv,commonLabelOpts:c.hoverlabel,hoverdistance:c.hoverdistance},St=C(Y,Mt,t);m.isUnifiedHover(L)||(!function(t,e,r){var n,i,a,o,s,l,u,c=0,p=1,h=t.size(),f=new Array(h),d=0;function m(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--)}}}t.each((function(t){var n=t[e],i="x"===n._id.charAt(0),a=n.range;0===d&&a&&a[0]>a[1]!==i&&(p=-1),f[d++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(i?b:1)/2,pmin:0,pmax:i?r.width:r.height}]})),f.sort((function(t,e){return t[0].posref-e[0].posref||p*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&c<=h;){for(c++,n=!0,o=0;o.01&&v.pmin===_.pmin&&v.pmax===_.pmax){for(s=y.length-1;s>=0;s--)y[s].dp+=i;for(g.push.apply(g,y),f.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++}f.forEach(m)}for(o=f.length-1;o>=0;o--){var x=f[o];for(s=x.length-1;s>=0;s--){var w=x[s],T=w.datum;T.offset=w.dp,T.del=w.del}}}(St,kt?"xa":"ya",c),E(St,kt));if(e.target&&e.target.tagName){var Ct=d.getComponentMethod("annotations","hasClickToShow")(t,xt);u(n.select(e.target),Ct?"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,_t))return;_t&&t.emit("plotly_unhover",{event:e,points:_t});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:x,yaxes:w,xvals:D,yvals:O})}(t,e,r,a)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var i=t.map((function(t){return{color:t.color||p.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,nameLength:t.nameLength,textAlign:t.textAlign,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}})),a=n.select(e.container),o=e.outerContainer?n.select(e.outerContainer):a,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||p.background,container:a,outerContainer:o},l=C(i,s,e.gd),u=0,c=0;return l.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function C(t,e,r){var i=r._fullLayout,a=e.hovermode,s=e.rotateLabels,u=e.bgColor,h=e.container,f=e.outerContainer,d=e.commonLabelOpts||{},x=e.fontFamily||g.HOVERFONT,b=e.fontSize||g.HOVERFONTSIZE,w=t[0],T=w.xa,S=w.ya,C="y"===a.charAt(0)?"yLabel":"xLabel",E=w[C],z=(String(E)||"").split(" ")[0],I=f.node().getBoundingClientRect(),P=I.top,D=I.width,O=I.height,R=void 0!==E&&w.distance<=e.hoverdistance&&("x"===a||"y"===a);if(R){var F,B,N=!0;for(F=0;Fi.width-C?(y=i.width-C,s.attr("d","M"+(C-k)+",0L"+C+","+M+k+"v"+M+(2*A+_.height)+"H-"+C+"V"+M+k+"H"+(C-2*k)+"Z")):s.attr("d","M0,0L"+k+","+M+k+"H"+(A+_.width/2)+"v"+M+(2*A+_.height)+"H-"+(A+_.width/2)+"V"+M+k+"H-"+k+"Z")}else{var L,z,I;"right"===S.side?(L="start",z=1,I="",y=T._offset+T._length):(L="end",z=-1,I="-",y=T._offset),v=S._offset+(w.y0+w.y1)/2,u.attr("text-anchor",L),s.attr("d","M0,0L"+I+k+","+k+"V"+(A+_.height/2)+"h"+I+(2*A+_.width)+"V-"+(A+_.height/2)+"H"+I+k+"V-"+k+"Z");var D,O=_.height/2,R=P-_.top-O,F="clip"+i._uid+"commonlabel"+S._id;if(y<_.width+2*A+k){D="M-"+(k+A)+"-"+O+"h-"+(_.width-A)+"V"+O+"h"+(_.width-A)+"Z";var B=_.width-y+A;l.positionText(u,B,R),"end"===L&&u.selectAll("tspan").each((function(){var t=n.select(this),e=c.tester.append("text").text(t.text()).call(c.font,g),r=e.node().getBoundingClientRect();Math.round(r.width)=0?$-=rt:$+=2*A;var nt=et.height+2*A,it=Q+nt>=O;return nt<=O&&(Q<=P?Q=S._offset+2*A:it&&(Q=O-nt)),tt.attr("transform","translate("+$+","+Q+")"),tt}var at=h.selectAll("g.hovertext").data(t,(function(t){return M(t)}));return at.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(p.fill,p.addOpacity(u,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(c.font,x,b)})),at.exit().remove(),at.each((function(t){var e=n.select(this).attr("transform",""),o=t.bgcolor||t.color,h=p.combine(p.opacity(o)?o:p.defaultLine,u),f=p.combine(p.opacity(t.color)?t.color:p.defaultLine,u),d=t.borderColor||p.contrast(h),m=L(t,R,a,i,E,e),g=m[0],y=m[1],v=e.select("text.nums").call(c.font,t.fontFamily||x,t.fontSize||b,t.fontColor||d).text(g).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),w=e.select("text.name"),T=0,M=0;if(y&&y!==g){w.call(c.font,t.fontFamily||x,t.fontSize||b,f).text(y).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r);var S=w.node().getBoundingClientRect();T=S.width+2*A,M=S.height+2*A}else w.remove(),e.select("rect").remove();e.select("path").style({fill:h,stroke:d});var C,z,I=v.node().getBoundingClientRect(),F=t.xa._offset+(t.x0+t.x1)/2,B=t.ya._offset+(t.y0+t.y1)/2,N=Math.abs(t.x1-t.x0),U=Math.abs(t.y1-t.y0),j=I.width+k+A+T;if(t.ty0=P-I.top,t.bx=I.width+2*A,t.by=Math.max(I.height+2*A,M),t.anchor="start",t.txwidth=I.width,t.tx2width=T,t.offset=0,s)t.pos=F,C=B+U/2+j<=O,z=B-U/2-j>=0,"top"!==t.idealAlign&&C||!z?C?(B+=U/2,t.anchor="start"):t.anchor="middle":(B-=U/2,t.anchor="end");else if(t.pos=B,C=F+N/2+j<=D,z=F-N/2-j>=0,"left"!==t.idealAlign&&C||!z)if(C)F+=N/2,t.anchor="start";else{t.anchor="middle";var V=j/2,q=F+V-D,H=F-V;q>0&&(F-=q),H<0&&(F+=-H)}else F-=N/2,t.anchor="end";v.attr("text-anchor",t.anchor),T&&w.attr("text-anchor",t.anchor),e.attr("transform","translate("+F+","+B+")"+(s?"rotate("+_+")":""))})),at}function L(t,e,r,n,i,a){var s="",l="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),s=D(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(l+=(l?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===i?l=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(l+=(l?"
":"")+t.text),void 0!==t.extraText&&(l+=(l?"
":"")+t.extraText),a&&""===l&&!t.hovertemplate&&(""===s&&a.remove(),l=s);var u=n._d3locale,c=t.hovertemplate||!1,p=t.hovertemplateLabels||t,h=t.eventData[0]||{};return c&&(l=(l=o.hovertemplateString(c,p,u,h,t.trace._meta)).replace(S,(function(e,r){return s=D(r,t.nameLength),""}))),[l,s]}function E(t,e){t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var i=r.select("text.nums"),a=t.anchor,o="end"===a?-1:1,s={start:1,end:-1,middle:0}[a],u=s*(k+A),p=u+s*(t.txwidth+A),h=0,f=t.offset;"middle"===a&&(u-=t.tx2width/2,p+=t.txwidth/2+A),e&&(f*=-T,h=t.offset*w),r.select("path").attr("d","middle"===a?"M-"+(t.bx/2+t.tx2width/2)+","+(f-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(o*k+h)+","+(k+f)+"v"+(t.by/2-k)+"h"+o*t.bx+"v-"+t.by+"H"+(o*k+h)+"V"+(f-k)+"Z");var d=u+h,m=f+t.ty0-t.by/2+A,g=t.textAlign||"auto";"auto"!==g&&("left"===g&&"start"!==a?(i.attr("text-anchor","start"),d="middle"===a?-t.bx/2-t.tx2width/2+A:-t.bx-A):"right"===g&&"end"!==a&&(i.attr("text-anchor","end"),d="middle"===a?t.bx/2-t.tx2width/2-A:t.bx+A)),i.call(l.positionText,d,m),t.tx2width&&(r.select("text.name").call(l.positionText,p+s*A+h,f+t.ty0-t.by/2+A),r.select("rect").call(c.setRect,p+(s-1)*t.tx2width/2+h,f-t.by/2-1,t.tx2width,t.by+2))}))}function z(t,e){var r=t.index,n=t.trace||{},a=t.cd[0],s=t.cd[r]||{};function l(t){return t||i(t)&&0===t}var u=Array.isArray(r)?function(t,e){var i=o.castOption(a,r,t);return l(i)?i:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(s,n,t,e)};function c(e,r,n){var i=u(r,n);l(i)&&(t[e]=i)}if(c("hoverinfo","hi","hoverinfo"),c("bgcolor","hbg","hoverlabel.bgcolor"),c("borderColor","hbc","hoverlabel.bordercolor"),c("fontFamily","htf","hoverlabel.font.family"),c("fontSize","hts","hoverlabel.font.size"),c("fontColor","htc","hoverlabel.font.color"),c("nameLength","hnl","hoverlabel.namelength"),c("textAlign","hta","hoverlabel.align"),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:f.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:f.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 p=f.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+p+" / -"+f.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+p,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var h=f.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+h+" / -"+f.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+h,"y"===e&&(t.distance+=1)}var d=t.hoverinfo||t.trace.hoverinfo;return d&&"all"!==d&&(-1===(d=Array.isArray(d)?d:d.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===d.indexOf("y")&&(t.yLabel=void 0),-1===d.indexOf("z")&&(t.zLabel=void 0),-1===d.indexOf("text")&&(t.text=void 0),-1===d.indexOf("name")&&(t.name=void 0)),t}function I(t,e,r){var n,i,o=r.container,s=r.fullLayout,l=s._size,u=r.event,h=!!e.hLinePoint,d=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),d||h){var m=p.combine(s.plot_bgcolor,s.paper_bgcolor);if(h){var g,y,v=e.hLinePoint;n=v&&v.xa,"cursor"===(i=v&&v.ya).spikesnap?(g=u.pointerX,y=u.pointerY):(g=n._offset+v.x,y=i._offset+v.y);var _,x,b=a.readability(v.color,m)<1.5?p.contrast(m):v.color,w=i.spikemode,T=i.spikethickness,k=i.spikecolor||b,A=f.getPxPosition(t,i);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(_=A,x=g),-1!==w.indexOf("across")){var M=i._counterDomainMin,S=i._counterDomainMax;"free"===i.anchor&&(M=Math.min(M,i.position),S=Math.max(S,i.position)),_=l.l+M*l.w,x=l.l+S*l.w}o.insert("line",":first-child").attr({x1:_,x2:x,y1:y,y2:y,"stroke-width":T,stroke:k,"stroke-dasharray":c.dashStyle(i.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:_,x2:x,y1:y,y2:y,"stroke-width":T+2,stroke:m}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:A+("right"!==i.side?T:-T),cy:y,r:T,fill:k}).classed("spikeline",!0)}if(d){var C,L,E=e.vLinePoint;n=E&&E.xa,i=E&&E.ya,"cursor"===n.spikesnap?(C=u.pointerX,L=u.pointerY):(C=n._offset+E.x,L=i._offset+E.y);var z,I,P=a.readability(E.color,m)<1.5?p.contrast(m):E.color,D=n.spikemode,O=n.spikethickness,R=n.spikecolor||P,F=f.getPxPosition(t,n);if(-1!==D.indexOf("toaxis")||-1!==D.indexOf("across")){if(-1!==D.indexOf("toaxis")&&(z=F,I=L),-1!==D.indexOf("across")){var B=n._counterDomainMin,N=n._counterDomainMax;"free"===n.anchor&&(B=Math.min(B,n.position),N=Math.max(N,n.position)),z=l.t+(1-N)*l.h,I=l.t+(1-B)*l.h}o.insert("line",":first-child").attr({x1:C,x2:C,y1:z,y2:I,"stroke-width":O,stroke:R,"stroke-dasharray":c.dashStyle(n.spikedash,O)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:C,x2:C,y1:z,y2:I,"stroke-width":O+2,stroke:m}).classed("spikeline",!0).classed("crisp",!0)}-1!==D.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:C,cy:F-("top"!==n.side?O:-O),r:O,fill:R}).classed("spikeline",!0)}}}function P(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function D(t,e){return l.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":181,"../../lib/events":172,"../../lib/override_cursor":192,"../../lib/svg_text_utils":202,"../../plots/cartesian/axes":225,"../../registry":275,"../color":53,"../dragelement":72,"../drawing":75,"../legend/defaults":105,"../legend/draw":106,"./constants":87,"./helpers":89,d3:16,"fast-isnumeric":18,tinycolor2:36}],91:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function s(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&a(e.hovermode)&&(o.font||(o.font={}),s("size"),s("family"),s("color"),e.legend?(o.bgcolor||(o.bgcolor=i.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":181,"../color":53,"./helpers":89}],92:[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 void 0!==e[r]?e[r]:n.coerce(t,e,i,r,a)}var o,s=a("clickmode");return e._has("cartesian")?s.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!h&&!f&&!d)"independent"===k("pattern")&&(h=!0);g._hasSubplotGrid=h;var _,x,b="top to bottom"===k("roworder"),w=h?.2:.1,T=h?.3:.1;m&&e._splomGridDflt&&(_=e._splomGridDflt.xside,x=e._splomGridDflt.yside),g._domains={x:c("x",k,w,_,v),y:c("y",k,T,x,y,b)}}else delete e.grid}function k(t,e){return n.coerce(r,g,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||{},f=e._subplots,d=r._hasSubplotGrid,m=r.rows,g=r.columns,y="independent"===r.pattern,v=r._axisMap={};if(d){var _=h.subplots||[];l=r.subplots=new Array(m);var x=1;for(n=0;n1);if(!1!==m||u.uirevision){var g=a.newContainer(e,"legend");if(b("uirevision",e.uirevision),!1!==m){b("bgcolor",e.paper_bgcolor),b("bordercolor"),b("borderwidth"),i.coerceFont(b,"font",e.font);var y,v,_,x=b("orientation");"h"===x?(y=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(v=1.1,_="bottom"):(v=-.1,_="top")):(y=1.02,v=1,_="auto"),b("traceorder",h),l.isGrouped(e.legend)&&b("tracegroupgap"),b("itemsizing"),b("itemclick"),b("itemdoubleclick"),b("x",y),b("xanchor"),b("y",v),b("yanchor",_),b("valign"),i.noneOrAll(u,g,["x","y"]),b("title.text")&&(b("title.side","h"===x?"left":"top"),i.coerceFont(b,"title.font",e.font))}}function b(t,e){return i.coerce(u,g,o,t,e)}}},{"../../lib":181,"../../plot_api/plot_template":215,"../../plots/layout_attributes":257,"../../registry":275,"./attributes":103,"./helpers":109}],106:[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"),p=t("../../lib/svg_text_utils"),h=t("./handle_click"),f=t("./constants"),d=t("../../constants/alignment"),m=d.LINE_SPACING,g=d.FROM_TL,y=d.FROM_BR,v=t("./get_legend_data"),_=t("./style"),x=t("./helpers");function b(t,e,r,n,i){var a=r.data()[0][0].trace,l={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&&(l.group=a._group),o.traceIs(a,"pie-like")&&(l.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",l))if(1===n)e._clickTimeout=setTimeout((function(){h(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",l)&&h(r,t,n)}}function w(t,e,r){var n,a=t.data()[0][0],s=a.trace,l=o.traceIs(s,"pie-like"),c=s.index,h=r._main&&e._context.edits.legendText&&!l,d=r._maxNameLength;r.entries?n=a.text:(n=l?a.label:s.name,s._meta&&(n=i.templateString(n,s._meta)));var m=i.ensureSingle(t,"text","legendtext");m.attr("text-anchor","start").classed("user-select-none",!0).call(u.font,r.font).text(h?T(n,d):n),p.positionText(m,f.textGap,0),h?m.call(p.makeEditable,{gd:e,text:n}).call(A,t,e,r).on("edit",(function(n){this.text(T(n,d)).call(A,t,e,r);var s=a.trace._fullInput||{},l={};if(o.hasTransform(s,"groupby")){var u=o.getTransformIndices(s,"groupby"),p=u[u.length-1],h=i.keyedContainer(s,"transforms["+p+"].styles","target","value.name");h.set(a.trace._group,n),l=h.constructUpdate()}else l.name=n;return o.call("_guiRestyle",e,l,c)})):A(m,t,e,r)}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=e._context.doubleClickDelay,o=1,s=i.ensureSingle(t,"rect","legendtoggle",(function(t){t.style("cursor","pointer").attr("pointer-events","all").call(c.fill,"rgba(0,0,0,0)")}));s.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimea&&(o=Math.max(o-1,1)),b(e,r,t,o,n.event)}}))}function A(t,e,r,n){n._main||t.attr("data-notex",!0),p.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var i=t.select("g[class*=math-group]"),a=i.node();r||(r=e._fullLayout.legend);var o,s,l=r.borderwidth,c=(n?r:r.title).font.size*m;if(a){var h=u.bBox(a);o=h.height,s=h.width,n?u.setTranslate(i,0,.25*o):u.setTranslate(i,l,.75*o+l)}else{var d=t.select(n?".legendtext":".legendtitletext"),g=p.lineCount(d),y=d.node();o=c*g,s=y?u.bBox(y).width:0;var v=c*((g-1)/2-.3);n?p.positionText(d,f.textGap,-v):p.positionText(d,f.titlePad+l,c+l)}n?(n.lineHeight=c,n.height=Math.max(o,16)+3,n.width=s):(r._titleWidth=s,r._titleHeight=o)}(e,r,n)}))}function M(t){return i.isRightAnchor(t)?"right":i.isCenterAnchor(t)?"center":"left"}function S(t){return i.isBottomAnchor(t)?"bottom":i.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,s=t._fullLayout,p="legend"+s._uid;if(e?(r=e.layer,p+="-hover"):((e=s.legend||{})._main=!0,r=s._infolayer),r){var h;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;h=s.showlegend&&v(t.calcdata,e)}else{if(!e.entries)return;h=v(e.entries,e)}var d=s.hiddenlabels||[];if(e._main&&(!s.showlegend||!h.length))return r.selectAll(".legend").remove(),s._topdefs.select("#"+p).remove(),a.autoMargin(t,"legend");var m=i.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),T=i.ensureSingleById(s._topdefs,"clipPath",p,(function(t){t.append("rect")})),C=i.ensureSingle(m,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));C.call(c.stroke,e.bordercolor).call(c.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var L=i.ensureSingle(m,"g","scrollbox"),E=e.title;if(e._titleWidth=0,e._titleHeight=0,E.text){var z=i.ensureSingle(L,"text","legendtitletext");z.attr("text-anchor","start").classed("user-select-none",!0).call(u.font,E.font).text(E.text),A(z,L,t,e)}else L.selectAll(".legendtitletext").remove();var I=i.ensureSingle(m,"rect","scrollbar",(function(t){t.attr(f.scrollBarEnterAttrs).call(c.fill,f.scrollBarColor)})),P=L.selectAll("g.groups").data(h);P.enter().append("g").attr("class","groups"),P.exit().remove();var D=P.selectAll("g.traces").data(i.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==d.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(_,t,e).each((function(){e._main&&n.select(this).call(k,t)})),i.syncOrAsync([a.previousPromises,function(){return function(t,e,r,i){var a=t._fullLayout;i||(i=a.legend);var o=a._size,s=x.isVertical(i),l=x.isGrouped(i),c=i.borderwidth,p=2*c,h=f.textGap,d=f.itemGap,m=2*(c+d),g=S(i),y=i.y<0||0===i.y&&"top"===g,v=i.y>1||1===i.y&&"bottom"===g;i._maxHeight=Math.max(y||v?a.height/2:o.h,30);var _=0;i._width=0,i._height=0;var b=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(i);if(s)r.each((function(t){var e=t[0].height;u.setTranslate(this,c+b[0],c+b[1]+i._height+e/2+d),i._height+=e,i._width=Math.max(i._width,t[0].width)})),_=h+i._width,i._width+=d+h+p,i._height+=m,l&&(e.each((function(t,e){u.setTranslate(this,0,e*i.tracegroupgap)})),i._height+=(i._lgroupsLength-1)*i.tracegroupgap);else{var w=M(i),T=i.x<0||0===i.x&&"right"===w,k=i.x>1||1===i.x&&"left"===w,A=v||y,C=a.width/2;i._maxWidth=Math.max(T?A&&"left"===w?o.l+o.w:C:k?A&&"right"===w?o.r+o.w:C:o.w,2*h);var L=0,E=0;r.each((function(t){var e=t[0].width+h;L=Math.max(L,e),E+=e})),_=null;var z=0;if(l){var I=0,P=0,D=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;u.setTranslate(this,b[0],b[1]+c+d+n/2+e),e+=n,t=Math.max(t,h+r[0].width)})),I=Math.max(I,e);var r=t+d;r+c+P>i._maxWidth&&(z=Math.max(z,P),P=0,D+=I+i.tracegroupgap,I=e),u.setTranslate(this,P,D),P+=r})),i._width=Math.max(z,P)+c,i._height=D+I+m}else{var O=r.size(),R=E+p+(O-1)*di._maxWidth&&(z=Math.max(z,U),B=0,N+=F,i._height+=F,F=0),u.setTranslate(this,b[0]+c+B,b[1]+c+N+e/2+d),U=B+r+d,B+=n,F=Math.max(F,e)})),R?(i._width=B+p,i._height=F+m):(i._width=Math.max(z,U)+p,i._height+=F+m)}}i._width=Math.ceil(Math.max(i._width+b[0],i._titleWidth+2*(c+f.titlePad))),i._height=Math.ceil(Math.max(i._height+b[1],i._titleHeight+2*(c+f.itemGap))),i._effHeight=Math.min(i._height,i._maxHeight);var j=t._context.edits,V=j.legendText||j.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,i=V?h:_||h+t[0].width;s||(i+=d/2),u.setRect(e,0,-r/2,i,r)}))}(t,P,D,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=M(e),n=S(e);return a.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*g[r],r:e._width*y[r],b:e._effHeight*y[n],t:e._effHeight*g[n]})}(t)){var c,h,d,v,_=s._size,x=e.borderwidth,w=_.l+_.w*e.x-g[M(e)]*e._width,k=_.t+_.h*(1-e.y)-g[S(e)]*e._effHeight;if(e._main&&s.margin.autoexpand){var A=w,E=k;w=i.constrain(w,0,s.width-e._width),k=i.constrain(k,0,s.height-e._effHeight),w!==A&&i.log("Constrain legend.x to make legend fit inside graph"),k!==E&&i.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&u.setTranslate(m,w,k),I.on(".drag",null),m.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var z=e._effHeight;e._main||(z=e._height),C.attr({width:e._width-x,height:z-x,x:x/2,y:x/2}),u.setTranslate(L,0,0),T.select("rect").attr({width:e._width-2*x,height:z-2*x,x:x,y:x}),u.setClipUrl(L,p,t),u.setRect(I,0,0,0,0),delete e._scrollY}else{var P,D,O,R=Math.max(f.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),F=e._effHeight-R-2*f.scrollBarMargin,B=e._height-e._effHeight,N=F/B,U=Math.min(e._scrollY||0,B);C.attr({width:e._width-2*x+f.scrollBarWidth+f.scrollBarMargin,height:e._effHeight-x,x:x/2,y:x/2}),T.select("rect").attr({width:e._width-2*x+f.scrollBarWidth+f.scrollBarMargin,height:e._effHeight-2*x,x:x,y:x+U}),u.setClipUrl(L,p,t),q(U,R,N),m.on("wheel",(function(){q(U=i.constrain(e._scrollY+n.event.deltaY/F*B,0,B),R,N),0!==U&&U!==B&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;P="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,O=U})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(D="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,q(U=function(t,e,r){var n=(r-e)/N+t;return i.constrain(n,0,B)}(O,P,D),R,N))}));I.call(j);var V=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(P=t.changedTouches[0].clientY,O=U)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(D=t.changedTouches[0].clientY,q(U=function(t,e,r){var n=(e-r)/N+t;return i.constrain(n,0,B)}(O,P,D),R,N))}));L.call(V)}if(t._context.edits.legendPosition)m.classed("cursor-move",!0),l.init({element:m.node(),gd:t,prepFn:function(){var t=u.getTranslate(m);d=t.x,v=t.y},moveFn:function(t,r){var n=d+t,i=v+r;u.setTranslate(m,n,i),c=l.align(n,0,_.l,_.l+_.w,e.xanchor),h=l.align(i,0,_.t+_.h,_.t,e.yanchor)},doneFn:function(){void 0!==c&&void 0!==h&&o.call("_guiRelayout",t,{"legend.x":c,"legend.y":h})},clickFn:function(e,n){var i=r.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&&b(t,m,i,e,n)}})}function q(r,n,i){e._scrollY=t._fullLayout.legend._scrollY=r,u.setTranslate(L,0,-r),u.setRect(I,e._width,f.scrollBarMargin+r*i,f.scrollBarWidth,n),T.select("rect").attr("y",x+r)}}],t)}}},{"../../constants/alignment":155,"../../lib":181,"../../lib/events":172,"../../lib/svg_text_utils":202,"../../plots/plots":266,"../../registry":275,"../color":53,"../dragelement":72,"../drawing":75,"./constants":104,"./get_legend_data":107,"./handle_click":108,"./helpers":109,"./style":111,d3:16}],107:[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,p=0,h=e._main;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;r0))return 0;i=e.width}return d?n:Math.min(i,r)};function g(t,e,r){var a=t[0].trace,o=a.marker||{},l=o.line||{},u=r?a.visible&&a.type===r:i.traceIs(a,"bar"),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(u?[t]:[]);c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.each((function(t){var e=n.select(this),r=t[0],i=m(r.mlw,o.line,5,2);e.style("stroke-width",i+"px").call(s.fill,r.mc||o.color),i&&s.stroke(e,r.mlc||l.color)}))}function y(t,e,r){var o=t[0],s=o.trace,l=r?s.visible&&s.type===r:i.traceIs(s,r),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(l?[t]:[]);if(u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.size()){var h=(s.marker||{}).line,f=m(p(h.width,o.pts),h,5,2),d=a.minExtend(s,{marker:{line:{width:f}}});d.marker.line.color=h.color;var g=a.minExtend(o,{trace:d});c(u,g,d)}}t.each((function(t){var e=n.select(this),i=a.ensureSingle(e,"g","layers");i.style("opacity",t[0].trace.opacity);var o=r.valign,s=t[0].lineHeight,l=t[0].height;if("middle"!==o&&s&&l){var u={top:1,bottom:-1}[o]*(.5*(s-l+3));i.attr("transform","translate(0,"+u+")")}else i.attr("transform",null);i.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),i.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var c=i.selectAll("g.legendsymbols").data([t]);c.enter().append("g").classed("legendsymbols",!0),c.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,i=t[0].trace,u=[];if(i.visible)switch(i.type){case"histogram2d":case"heatmap":u=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":u=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":u=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":u=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":u=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":u=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":u=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var c=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(u);c.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),c.exit().remove(),c.each((function(t,u){var c,p=n.select(this),f=l(i),d=f.colorscale,m=f.reversescale;if(d){if(!r){var g=d.length;c=0===u?d[m?g-1:0][1]:1===u?d[m?0:g-1][1]:d[Math.floor((g-1)/2)][1]}}else{var y=i.vertexcolor||i.facecolor||i.color;c=a.isArrayOrTypedArray(y)?y[u]||y[0]:y}p.attr("d",t[0]),c?p.call(s.fill,c):p.call((function(t){if(t.size()){var n="legendfill-"+i.uid;o.gradient(t,e,n,h(m,"radial"===r),d,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var i=t[0].trace[t[0].dir].marker;return t[0].mc=i.color,t[0].mlw=i.line.width,t[0].mlc=i.line.color,g(t,this,"waterfall")}var a=[];e.visible&&r&&(a=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(a);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),i=e[t[0]].marker,a=m(void 0,i.line,5,2);r.attr("d",t[1]).style("stroke-width",a+"px").call(s.fill,i.color),a&&r.call(s.stroke,i.line.color)}))})).each((function(t){g(t,this,"funnel")})).each((function(t){g(t,this)})).each((function(t){var r=t[0].trace,l=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&i.traceIs(r,"box-violin")?[t]:[]);l.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),l.exit().remove(),l.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==s.opacity(r.fillcolor)||0!==s.opacity((r.line||{}).color)){var i=m(void 0,r.line,5,2);t.style("stroke-width",i+"px").call(s.fill,r.fillcolor),i&&s.stroke(t,r.line.color)}else{var u=a.minExtend(r,{marker:{size:d?12:a.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});l.call(o.pointStyle,u,e)}}))})).each((function(t){y(t,this,"funnelarea")})).each((function(t){y(t,this,"pie")})).each((function(t){var r,i,s=t[0],c=s.trace,p=c.visible&&c.fill&&"none"!==c.fill,f=u.hasLines(c),d=c.contours,g=!1,y=!1,v=l(c),_=v.colorscale,x=v.reversescale;if(d){var b=d.coloring;"lines"===b?g=!0:f="none"===b||"heatmap"===b||d.showlines,"constraint"===d.type?p="="!==d._operation:"fill"!==b&&"heatmap"!==b||(y=!0)}var w=u.hasMarkers(c)||u.hasText(c),T=p||y,k=f||g,A=w||!T?"M5,0":k?"M5,-2":"M5,-3",M=n.select(this),S=M.select(".legendfill").selectAll("path").data(p||y?[t]:[]);if(S.enter().append("path").classed("js-fill",!0),S.exit().remove(),S.attr("d",A+"h30v6h-30z").call(p?o.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+c.uid;o.gradient(t,e,r,h(x),_,"fill")}}),f||g){var C=m(void 0,c.line,10,5);i=a.minExtend(c,{line:{width:C}}),r=[a.minExtend(s,{trace:i})]}var L=M.select(".legendlines").selectAll("path").data(f||g?[r]:[]);L.enter().append("path").classed("js-line",!0),L.exit().remove(),L.attr("d",A+(g?"l30,0.0001":"h30")).call(f?o.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+c.uid;o.lineGroupStyle(t),o.gradient(t,e,r,h(x),_,"stroke")}})})).each((function(t){var r,i,s=t[0],l=s.trace,c=u.hasMarkers(l),p=u.hasText(l),h=u.hasLines(l);function f(t,e,r,n){var i=a.nestedProperty(l,t).get(),o=a.isArrayOrTypedArray(i)&&e?e(i):i;if(d&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function m(t){return s._distinct&&s.index&&t[s.index]?t[s.index]:t[0]}if(c||p||h){var g={},y={};if(c){g.mc=f("marker.color",m),g.mx=f("marker.symbol",m),g.mo=f("marker.opacity",a.mean,[.2,1]),g.mlc=f("marker.line.color",m),g.mlw=f("marker.line.width",a.mean,[0,5],2),y.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var v=f("marker.size",a.mean,[2,16],12);g.ms=v,y.marker.size=v}h&&(y.line={width:f("line.width",m,[0,10],5)}),p&&(g.tx="Aa",g.tp=f("textposition",m),g.ts=10,g.tc=f("textfont.color",m),g.tf=f("textfont.family",m)),r=[a.minExtend(s,g)],(i=a.minExtend(l,y)).selectedpoints=null,i.texttemplate=null}var _=n.select(this).select("g.legendpoints"),x=_.selectAll("path.scatterpts").data(c?r:[]);x.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),x.exit().remove(),x.call(o.pointStyle,i,e),c&&(r[0].mrc=3);var b=_.selectAll("g.pointtext").data(p?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(e.visible&&"candlestick"===e.type?[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=n.select(this),a=e[r?"increasing":"decreasing"],o=m(void 0,a.line,5,2);i.style("stroke-width",o+"px").call(s.fill,a.fillcolor),o&&s.stroke(i,a.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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=n.select(this),a=e[r?"increasing":"decreasing"],l=m(void 0,a.line,5,2);i.style("fill","none").call(o.dashLine,a.line.dash,l),l&&s.stroke(i,a.line.color)}))}))}},{"../../lib":181,"../../registry":275,"../../traces/pie/helpers":303,"../../traces/pie/style_one":304,"../../traces/scatter/subtypes":330,"../color":53,"../colorscale/helpers":64,"../drawing":75,d3:16}],112:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/plots"),a=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),s=t("../shapes/draw").eraseActiveShape,l=t("../../lib"),u=l._,c=e.exports={};function p(t,e){var r,i,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,u=t._fullLayout,c={},p=a.list(t,null,!0),h=u._cartesianSpikesEnabled;if("zoom"===s){var f,d="in"===l?.5:2,m=(1+d)/2,g=(1-d)/2;for(i=0;i1?(C=["toggleHover"],L=["resetViews"]):d?(S=["zoomInGeo","zoomOutGeo"],C=["hoverClosestGeo"],L=["resetGeo"]):f?(C=["hoverClosest3d"],L=["resetCameraDefault3d","resetCameraLastSave3d"]):_?(S=["zoomInMapbox","zoomOutMapbox"],C=["toggleHover"],L=["resetViewMapbox"]):y?C=["hoverClosestGl2d"]:m?C=["hoverClosestPie"]:b?(C=["hoverClosestCartesian","hoverCompareCartesian"],L=["resetViewSankey"]):C=["toggleHover"];h&&(C=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var m=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),i=0,a=0;a=n.max)e=R[r+1];else if(t=n.pmax)e=R[r+1];else if(t0?h+u:u;return{ppad:u,ppadplus:c?d:m,ppadminus:c?m:d}}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,p,h=1/0,f=-1/0,d=n.match(a.segmentRE);for("date"===t.type&&(s=o.decodeDate(s)),l=0;lf&&(f=p)));return f>=h?[h,f]: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;ov?(k=p,C="y0",A=v,L="y1"):(k=v,C="y1",A=p,L="y0");X(n),K(s,r),function(t,e,r){var n=e.xref,i=e.yref,o=a.getFromId(r,n),s=a.getFromId(r,i),l="";"paper"===n||o.autorange||(l+=n);"paper"===i||s.autorange||(l+=i);c.setClipUrl(t,l?"clip"+r._fullLayout._uid+l:null,r)}(e,r,t),G.moveFn="move"===P?W:Y,G.altKey=n.altKey},doneFn:function(){if(y(t))return;f(e),J(s),x(e,t,r),n.call("_guiRelayout",t,l.getUpdateObj())},clickFn:function(){if(y(t))return;J(s)}};function X(r){if(y(t))P=null;else if(R)P="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=G.element.getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top,o=r.clientX-n.left,s=r.clientY-n.top,l=!F&&i>10&&a>10&&!r.shiftKey?h.getCursor(o/i,1-s/a):"move";f(e,l),P=l.split("-")[0]}}function W(n,i){if("path"===r.type){var a=function(t){return t},o=a,l=a;D?B("xanchor",r.xanchor=q(_+n)):(o=function(t){return q(j(t)+n)},N&&"date"===N.type&&(o=m.encodeDate(o))),O?B("yanchor",r.yanchor=H(T+i)):(l=function(t){return H(V(t)+i)},U&&"date"===U.type&&(l=m.encodeDate(l))),B("path",r.path=w(I,o,l))}else D?B("xanchor",r.xanchor=q(_+n)):(B("x0",r.x0=q(u+n)),B("x1",r.x1=q(g+n))),O?B("yanchor",r.yanchor=H(T+i)):(B("y0",r.y0=H(p+i)),B("y1",r.y1=H(v+i)));e.attr("d",b(t,r)),K(s,r)}function Y(n,i){if(F){var a=function(t){return t},o=a,l=a;D?B("xanchor",r.xanchor=q(_+n)):(o=function(t){return q(j(t)+n)},N&&"date"===N.type&&(o=m.encodeDate(o))),O?B("yanchor",r.yanchor=H(T+i)):(l=function(t){return H(V(t)+i)},U&&"date"===U.type&&(l=m.encodeDate(l))),B("path",r.path=w(I,o,l))}else if(R){if("resize-over-start-point"===P){var c=u+n,h=O?p-i:p+i;B("x0",r.x0=D?c:q(c)),B("y0",r.y0=O?h:H(h))}else if("resize-over-end-point"===P){var f=g+n,d=O?v-i:v+i;B("x1",r.x1=D?f:q(f)),B("y1",r.y1=O?d:H(d))}}else{var y=function(t){return-1!==P.indexOf(t)},x=y("n"),Z=y("s"),G=y("w"),X=y("e"),W=x?k+i:k,Y=Z?A+i:A,J=G?M+n:M,Q=X?S+n:S;O&&(x&&(W=k-i),Z&&(Y=A-i)),(!O&&Y-W>10||O&&W-Y>10)&&(B(C,r[C]=O?W:H(W)),B(L,r[L]=O?Y:H(Y))),Q-J>10&&(B(E,r[E]=D?J:q(J)),B(z,r[z]=D?Q:q(Q)))}e.attr("d",b(t,r)),K(s,r)}function K(t,e){(D||O)&&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=j(D?e.xanchor:i.midRange(r?[e.x0,e.x1]:m.extractPathCoords(e.path,d.paramIsX))),o=V(O?e.yanchor:i.midRange(r?[e.y0,e.y1]:m.extractPathCoords(e.path,d.paramIsY)));if(a=m.roundPositionForSharpStrokeRendering(a,1),o=m.roundPositionForSharpStrokeRendering(o,1),D&&O){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(D){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 J(t){t.selectAll(".visual-cue").remove()}h.init(G),Z.node().onmousemove=X}(t,D,l,e,r,P):!0===l.editable&&D.style("pointer-events",z||u.opacity(S)*M<=.5?"stroke":"all");D.node().addEventListener("click",(function(){return function(t,e){if(!v(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void T(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=T,g(t)}}(t,D)}))}}function x(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"");c.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function b(t,e){var r,n,o,s,l,u,c,p,h=e.type,f=a.getFromId(t,e.xref),g=a.getFromId(t,e.yref),y=t._fullLayout._size;if(f?(r=m.shapePositionToRange(f),n=function(t){return f._offset+f.r2p(r(t,!0))}):n=function(t){return y.l+y.w*t},g?(o=m.shapePositionToRange(g),s=function(t){return g._offset+g.r2p(o(t,!0))}):s=function(t){return y.t+y.h*(1-t)},"path"===h)return f&&"date"===f.type&&(n=m.decodeDate(n)),g&&"date"===g.type&&(s=m.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(d.segmentRE,(function(t){var n=0,u=t.charAt(0),c=d.paramIsX[u],p=d.paramIsY[u],h=d.numParams[u],f=t.substr(1).replace(d.paramRE,(function(t){return c[n]?t="pixel"===a?e(s)+Number(t):e(t):p[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>h&&(t="X"),t}));return n>h&&(f=f.replace(/[\s,]*X.*/,""),i.log("Ignoring extra params in segment "+t)),u+f}))}(e,n,s);if("pixel"===e.xsizemode){var v=n(e.xanchor);l=v+e.x0,u=v+e.x1}else l=n(e.x0),u=n(e.x1);if("pixel"===e.ysizemode){var _=s(e.yanchor);c=_-e.y0,p=_-e.y1}else c=s(e.y0),p=s(e.y1);if("line"===h)return"M"+l+","+c+"L"+u+","+p;if("rect"===h)return"M"+l+","+c+"H"+u+"V"+p+"H"+l+"Z";var x=(l+u)/2,b=(c+p)/2,w=Math.abs(x-l),T=Math.abs(b-c),k="A"+w+","+T,A=x+w+","+b;return"M"+A+k+" 0 1,1 "+(x+","+(b-T))+k+" 0 0,1 "+A+"Z"}function w(t,e,r){return t.replace(d.segmentRE,(function(t){var n=0,i=t.charAt(0),a=d.paramIsX[i],o=d.paramIsY[i],s=d.numParams[i];return i+t.substr(1).replace(d.paramRE,(function(t){return n>=s||(a[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function T(t){v(t)&&(t._fullLayout._activeShapeIndex>=0&&(l(t),delete t._fullLayout._activeShapeIndex,g(t)))}e.exports={draw:g,drawOne:_,eraseActiveShape:function(t){if(!v(t))return;l(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&p(y),r.attr("d",m(e)),A&&!h)&&(k=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===T&&(t[0][0]="M"),e[w]=t,v(),_())}}()}}function I(t,r){!function(t,r){if(e.length)for(var n=0;n0&&l0&&(s=s.transition().duration(e.transition.duration).ease(e.transition.easing)),s.attr("transform","translate("+(o-.5*c.gripWidth)+","+e._dims.currentValueTotalHeight+")")}}function S(t,e){var r=t._dims;return r.inputAreaStart+c.stepInset+(r.inputAreaLength-2*c.stepInset)*Math.min(1,Math.max(0,e))}function C(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 L(t,e,r){var n=r._dims,i=s.ensureSingle(t,"rect",c.railTouchRectClass,(function(n){n.call(k,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 E(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,m(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,g);l.enter().append("g").classed(c.groupClassName,!0),l.exit().each(s).remove();for(var u=0;u0||p<0){var g={left:[-f,0],right:[f,0],top:[0,-f],bottom:[0,f]}[_.side];e.attr("transform","translate("+g+")")}}}return D.call(O),I&&(S?D.on(".opacity",null):(k=0,A=!0,D.text(y).on("mouseover.opacity",(function(){n.select(this).transition().duration(p.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(p.HIDE_PLACEHOLDER).style("opacity",0)}))),D.call(c.makeEditable,{gd:t}).on("edit",(function(e){void 0!==v?o.call("_guiRestyle",t,g,e,v):o.call("_guiRelayout",t,g,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(O)})).on("input",(function(t){this.text(t||" ").call(c.positionText,x.x,x.y)}))),D.classed("js-placeholder",A),w}}},{"../../constants/alignment":155,"../../constants/interactions":157,"../../lib":181,"../../lib/svg_text_utils":202,"../../plots/plots":266,"../../registry":275,"../color":53,"../drawing":75,d3:16,"fast-isnumeric":18}],149:[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"}]},args2:{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":173,"../../plot_api/edit_types":208,"../../plot_api/plot_template":215,"../../plots/font_attributes":253,"../../plots/pad_attributes":265,"../color/attributes":52}],150:[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"}}},{}],151:[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("args2"),r("label"),r("execute"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":181,"../../plots/array_container_defaults":221,"./attributes":149,"./constants":150}],152:[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,p=t("./constants"),h=t("./scrollbox");function f(t){return t._index}function d(t,e){return+t.attr(p.menuIndexAttrName)===e._index}function m(t,e,r,n,i,a,o,s){e.active=o,u(t.layout,p.name,e).applyUpdate("active",o),"buttons"===e.type?y(t,n,null,null,e):"dropdown"===e.type&&(i.attr(p.menuIndexAttrName,"-1"),g(t,n,i,a,e),s||y(t,n,i,a,e))}function g(t,e,r,n,i){var a=s.ensureSingle(e,"g",p.headerClassName,(function(t){t.style("pointer-events","all")})),l=i._dims,u=i.active,c=i.buttons[u]||p.blankHeaderOpts,h={y:i.pad.t,yPad:0,x:i.pad.l,xPad:0,index:0},f={width:l.headerWidth,height:l.headerHeight};a.call(v,i,c,t).call(M,i,h,f),s.ensureSingle(e,"text",p.headerArrowClassName,(function(t){t.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,i.font).text(p.arrowSymbol[i.direction])})).attr({x:l.headerWidth-p.arrowOffsetX+i.pad.l,y:l.headerHeight/2+p.textOffsetY+i.pad.t}),a.on("click",(function(){r.call(S,String(d(r,i)?-1:i._index)),y(t,e,r,n,i)})),a.on("mouseover",(function(){a.call(w)})),a.on("mouseout",(function(){a.call(T,i)})),o.setTranslate(e,l.lx,l.ly)}function y(t,e,r,a,o){r||(r=e).attr("pointer-events","all");var l=function(t){return-1==+t.attr(p.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,u="dropdown"===o.type?p.dropdownButtonClassName:p.buttonClassName,c=r.selectAll("g."+u).data(s.filterVisible(l)),h=c.enter().append("g").classed(u,!0),f=c.exit();"dropdown"===o.type?(h.attr("opacity","0").transition().attr("opacity","1"),f.transition().attr("opacity","0").remove()):f.remove();var d=0,g=0,y=o._dims,_=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(_?g=y.headerHeight+p.gapButtonHeader:d=y.headerWidth+p.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(g=-p.gapButtonHeader+p.gapButton-y.openHeight),"dropdown"===o.type&&"left"===o.direction&&(d=-p.gapButtonHeader+p.gapButton-y.openWidth);var x={x:y.lx+d+o.pad.l,y:y.ly+g+o.pad.t,yPad:p.gapButton,xPad:p.gapButton,index:0},k={l:x.x+o.borderwidth,t:x.y+o.borderwidth};c.each((function(s,l){var u=n.select(this);u.call(v,o,s,t).call(M,o,x),u.on("click",(function(){n.event.defaultPrevented||(s.execute&&(s.args2&&o.active===l?(m(t,o,0,e,r,a,-1),i.executeAPICommand(t,s.method,s.args2)):(m(t,o,0,e,r,a,l),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(T,o),c.call(b,o)}))})),c.call(b,o),_?(k.w=Math.max(y.openWidth,y.headerWidth),k.h=x.y-k.t):(k.w=x.x-k.l,k.h=Math.max(y.openHeight,y.headerHeight)),k.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,f=i.active;if(c)for(s=0,l=0;l0?[0]:[]);if(o.enter().append("g").classed(p.containerClassName,!0).style("cursor","pointer"),o.exit().each((function(){n.select(this).selectAll("g."+p.headerGroupClassName).each(a)})).remove(),0!==r.length){var l=o.selectAll("g."+p.headerGroupClassName).data(r,f);l.enter().append("g").classed(p.headerGroupClassName,!0);for(var u=s.ensureSingle(o,"g",p.dropdownButtonGroupClassName,(function(t){t.style("pointer-events","all")})),c=0;cw,A=s.barLength+2*s.barPad,M=s.barWidth+2*s.barPad,S=d,C=g+y;C+M>u&&(C=u-M);var L=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);L.exit().on(".drag",null).remove(),L.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,s.barColor),k?(this.hbar=L.attr({rx:s.barRadius,ry:s.barRadius,x:S,y:C,width:A,height:M}),this._hbarXMin=S+A/2,this._hbarTranslateMax=w-A):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var E=y>T,z=s.barWidth+2*s.barPad,I=s.barLength+2*s.barPad,P=d+m,D=g;P+z>l&&(P=l-z);var O=this.container.selectAll("rect.scrollbar-vertical").data(E?[0]:[]);O.exit().on(".drag",null).remove(),O.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,s.barColor),E?(this.vbar=O.attr({rx:s.barRadius,ry:s.barRadius,x:P,y:D,width:z,height:I}),this._vbarYMin=D+I/2,this._vbarTranslateMax=T-I):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=c-.5,B=E?p+z+.5:p+.5,N=h-.5,U=k?f+M+.5:f+.5,j=o._topdefs.selectAll("#"+R).data(k||E?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",R).append("rect"),k||E?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(N),width:Math.ceil(B)-Math.floor(F),height:Math.ceil(U)-Math.floor(N)}),this.container.call(a.setClipUrl,R,this.gd),this.bg.attr({x:d,y:g,width:m,height:y})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),k||E){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 q=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),E&&this.vbar.on(".drag",null).call(q)}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":181,"../color":53,"../drawing":75,d3:16}],155:[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"}}},{}],156:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],157:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],158:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],159:[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}},{}],160:[function(t,e,r){"use strict";r.version=t("./version").version,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;splotly-logomark"}}},{}],163:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],164:[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 p(t,e,r,n,i,a,u){i=i||0,a=a||0;var c,p,h,f,d,m=l([r,n]);function g(t,e){return[t*Math.cos(e)+i,a-t*Math.sin(e)]}m?(c=0,p=o,h=s):r=i&&t<=a);var i,a},pathArc:function(t,e,r,n,i){return p(null,t,e,r,n,i,0)},pathSector:function(t,e,r,n,i){return p(null,t,e,r,n,i,1)},pathAnnulus:function(t,e,r,n,i,a){return p(t,e,r,n,i,a,1)}}},{"./mod":188}],165:[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=b(e),y=t.charAt(0);!u||"G"!==y&&"g"!==y||(t=t.substr(1),e="");var w=u&&"chinese"===e.substr(0,7),T=t.match(w?_:v);if(!T)return c;var k=T[1],A=T[3]||"1",M=Number(T[5]||1),S=Number(T[7]||0),C=Number(T[9]||0),L=Number(T[11]||0);if(u){if(2===k.length)return c;var E;k=Number(k);try{var z=g.getComponentMethod("calendars","getCal")(e);if(w){var I="i"===A.charAt(A.length-1);A=parseInt(A,10),E=z.newDate(k,z.toMonthIndex(k,A,I),M)}else E=z.newDate(k,Number(A),M)}catch(t){return c}return E?(E.toJD()-m)*p+S*h+C*f+L*d:c}k=2===k.length?(Number(k)+2e3-x)%100+x:Number(k),A-=1;var P=new Date(Date.UTC(2e3,A,M,S,C));return P.setUTCFullYear(k),P.getUTCMonth()!==A||P.getUTCDate()!==M?c:P.getTime()+L*d},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 T=90*p,k=3*h,A=5*f;function M(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,v,_,x=Math.floor(10*l(t+.05,1)),w=Math.round(t-x/10);if(b(r)){var S=Math.floor(w/p)+m,C=Math.floor(l(t,p));try{a=g.getComponentMethod("calendars","getCal")(r).fromJD(S).formatDate("yyyy-mm-dd")}catch(t){a=y("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+p&&t<=i-p))return c;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return M(a("%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(b(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 S=/%\d?f/g;function C(t,e,r,n){t=t.replace(S,(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(b(n))try{t=g.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=b(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,p),n=w(Math.floor(r/h),2)+":"+w(l(Math.floor(r/f),60),2);if("M"!==e){o(e)||(e=0);var i=(100+Math.min(l(t/d,60),L[e])).toFixed(e).substr(1);e>0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}(t,r)+"\n"+C(a.dayMonthYear,t,n,i);e=a.dayMonth+"\n"+a.year}return C(e,t,n,i)};var E=3*p;r.incrementMonth=function(t,e,r){r=b(r)&&r;var n=l(t,p);if(t=Math.round(t-n),r)try{var i=Math.round(t/p)+m,a=g.getComponentMethod("calendars","getCal")(r),o=a.fromJD(i);return e%12?a.add(o,e,"m"):a.add(o,e/12,"y"),(o.toJD()-m)*p+n}catch(e){s.error("invalid ms "+t+" in calendar "+r)}var u=new Date(t+E);return u.setUTCMonth(u.getUTCMonth()+e)+n-E},r.findExactDates=function(t,e){for(var r,n,i=0,a=0,s=0,l=0,u=b(e)&&g.getComponentMethod("calendars","getCal")(e),c=0;c0&&t[e+1][0]<0)return e;return null}switch(e="RUS"===s||"FJI"===s?function(t){var e;if(null===u(t))e=t;else for(e=new Array(t.length),i=0;ie?r[n++]=[t[i][0]+360,t[i][1]]:i===e?(r[n++]=t[i],r[n++]=[t[i][0],-90]):r[n++]=t[i];var a=h.tester(r);a.pts.pop(),l.push(a)}:function(t){l.push(h.tester(t))},a.type){case"MultiPolygon":for(r=0;ri&&(i=u,e=l)}else e=r;return o.default(e).geometry.coordinates}(c),n.fIn=t,n.fOut=c,s.push(c)}else u.log(["Location",n.loc,"does not have a valid GeoJSON geometry.","Traces with locationmode *geojson-id* only support","*Polygon* and *MultiPolygon* geometries."].join(" "))}delete i[r]}switch(r.type){case"FeatureCollection":var h=r.features;for(n=0;n100?(clearInterval(a),n("Unexpected error while fetching from "+t)):void i++}),50)}))}for(var o=0;o0&&(r.push(i),i=[])}return i.length>0&&r.push(i),r},r.makeLine=function(t){return 1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}},r.makePolygon=function(t){if(1===t.length)return{type:"Polygon",coordinates:t};for(var e=new Array(t.length),r=0;r1||m<0||m>1?null:{x:t+l*m,y:e+p*m}}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,p=n-e,h=o-i,f=u-a,d=c*c+p*p,m=h*h+f*f,g=Math.min(l(c,p,d,i-t,a-e),l(c,p,d,o-t,u-e),l(h,f,m,t-i,e-a),l(h,f,m,r-i,n-a));return Math.sqrt(g)},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)),p=t.getPointAtLength(o(r,e)),h={x:(4*p.x+l.x+u.x)/6,y:(4*p.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(),p=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,p=r.yl?r.y-l:0;return Math.sqrt(u*u+p*p)}for(var f=h(u);f;){if((u+=f+r)>p)return;f=h(u)}for(f=h(p);f;){if(u>(p-=f+r))return;f=h(p)}return{min:u,max:p,len:p-u,total:c,isClosed:0===u&&p===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,p=0,h=0,f=s;p0?f=i:h=i,p++}return a}},{"./mod":188}],179:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],180:[function(t,e,r){"use strict";e.exports=function(t,e){if(!e)return t;var r=1/Math.abs(e),n=r>1?(r*t+r*e)/r:t+e,i=String(n).length;if(i>16){var a=String(e).length;if(i>=String(t).length+a){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],181:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../constants/numerical"),s=o.FP_SAFE,l=o.BADNUM,u=e.exports={};u.nestedProperty=t("./nested_property"),u.keyedContainer=t("./keyed_container"),u.relativeAttr=t("./relative_attr"),u.isPlainObject=t("./is_plain_object"),u.toLogRange=t("./to_log_range"),u.relinkPrivateKeys=t("./relink_private");var c=t("./array");u.isTypedArray=c.isTypedArray,u.isArrayOrTypedArray=c.isArrayOrTypedArray,u.isArray1D=c.isArray1D,u.ensureArray=c.ensureArray,u.concat=c.concat,u.maxRowLength=c.maxRowLength,u.minRowLength=c.minRowLength;var p=t("./mod");u.mod=p.mod,u.modHalf=p.modHalf;var h=t("./coerce");u.valObjectMeta=h.valObjectMeta,u.coerce=h.coerce,u.coerce2=h.coerce2,u.coerceFont=h.coerceFont,u.coerceHoverinfo=h.coerceHoverinfo,u.coerceSelectionMarkerOpacity=h.coerceSelectionMarkerOpacity,u.validate=h.validate;var f=t("./dates");u.dateTime2ms=f.dateTime2ms,u.isDateTime=f.isDateTime,u.ms2DateTime=f.ms2DateTime,u.ms2DateTimeLocal=f.ms2DateTimeLocal,u.cleanDate=f.cleanDate,u.isJSDate=f.isJSDate,u.formatDate=f.formatDate,u.incrementMonth=f.incrementMonth,u.dateTick0=f.dateTick0,u.dfltRange=f.dfltRange,u.findExactDates=f.findExactDates,u.MIN_MS=f.MIN_MS,u.MAX_MS=f.MAX_MS;var d=t("./search");u.findBin=d.findBin,u.sorterAsc=d.sorterAsc,u.sorterDes=d.sorterDes,u.distinctVals=d.distinctVals,u.roundUp=d.roundUp,u.sort=d.sort,u.findIndexOfMin=d.findIndexOfMin;var m=t("./stats");u.aggNums=m.aggNums,u.len=m.len,u.mean=m.mean,u.median=m.median,u.midRange=m.midRange,u.variance=m.variance,u.stdev=m.stdev,u.interp=m.interp;var g=t("./matrix");u.init2dArray=g.init2dArray,u.transposeRagged=g.transposeRagged,u.dot=g.dot,u.translationMatrix=g.translationMatrix,u.rotationMatrix=g.rotationMatrix,u.rotationXYMatrix=g.rotationXYMatrix,u.apply2DTransform=g.apply2DTransform,u.apply2DTransform2=g.apply2DTransform2;var y=t("./angles");u.deg2rad=y.deg2rad,u.rad2deg=y.rad2deg,u.angleDelta=y.angleDelta,u.angleDist=y.angleDist,u.isFullCircle=y.isFullCircle,u.isAngleInsideSector=y.isAngleInsideSector,u.isPtInsideSector=y.isPtInsideSector,u.pathArc=y.pathArc,u.pathSector=y.pathSector,u.pathAnnulus=y.pathAnnulus;var v=t("./anchor_utils");u.isLeftAnchor=v.isLeftAnchor,u.isCenterAnchor=v.isCenterAnchor,u.isRightAnchor=v.isRightAnchor,u.isTopAnchor=v.isTopAnchor,u.isMiddleAnchor=v.isMiddleAnchor,u.isBottomAnchor=v.isBottomAnchor;var _=t("./geometry2d");u.segmentsIntersect=_.segmentsIntersect,u.segmentDistance=_.segmentDistance,u.getTextLocation=_.getTextLocation,u.clearLocationCache=_.clearLocationCache,u.getVisibleSegment=_.getVisibleSegment,u.findPointOnPath=_.findPointOnPath;var x=t("./extend");u.extendFlat=x.extendFlat,u.extendDeep=x.extendDeep,u.extendDeepAll=x.extendDeepAll,u.extendDeepNoArrays=x.extendDeepNoArrays;var b=t("./loggers");u.log=b.log,u.warn=b.warn,u.error=b.error;var w=t("./regex");u.counterRegex=w.counter;var T=t("./throttle");u.throttle=T.throttle,u.throttleDone=T.done,u.clearThrottle=T.clear;var k=t("./dom");function A(t){var e={};for(var r in t)for(var n=t[r],i=0;is?l:a(t)?Number(t):l:l},u.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(a(t)&&t>=0&&t%1==0)},u.noop=t("./noop"),u.identity=t("./identity"),u.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))},u.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},u.simpleMap=function(t,e,r,n,i){for(var a=t.length,o=new Array(a),s=0;s=Math.pow(2,r)?i>10?(u.warn("randstr failed uniqueness"),l):t(e,r,n,(i||0)+1):l},u.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},u.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},u.syncOrAsync=function(t,e,r){var n;function i(){return u.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,u.promiseError);return r&&r(e)},u.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},u.noneOrAll=function(t,e,r){if(t){var n,i=!1,a=!0;for(n=0;n0?e:0}))},u.fillArray=function(t,e,r,n){if(n=n||u.identity,u.isArrayOrTypedArray(t))for(var i=0;i1?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},u.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var z=/^\w*$/;u.templateString=function(t,e){var r={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,n){var i;return z.test(n)?i=e[n]:(r[n]=r[n]||u.nestedProperty(e,n).get,i=r[n]()),u.isValidTextValue(i)?i:""}))};var I={max:10,count:0,name:"hovertemplate"};u.hovertemplateString=function(){return O.apply(I,arguments)};var P={max:10,count:0,name:"texttemplate"};u.texttemplateString=function(){return O.apply(P,arguments)};var D=/^[:|\|]/;function O(t,e,r){var a=this,o=arguments;e||(e={});var s={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,l,c){var p,h,f,d;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 R=2e9;u.seedPseudoRandom=function(){R=2e9},u.pseudoRandom=function(){var t=R;return R=(69069*R+1)%4294967296,Math.abs(R-t)<429496729?u.pseudoRandom():R/4294967296},u.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},i=u.extractOption(t,e,"htx","hovertext");if(u.isValidTextValue(i))return n(i);var a=u.extractOption(t,e,"tx","text");return u.isValidTextValue(a)?n(a):void 0},u.isValidTextValue=function(t){return t||0===t},u.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(u=1):u=0,"translate("+(i-u*(r+o))+","+(a-u*(n+s))+")"+(u<1?"scale("+u+")":"")+(l?"rotate("+l+(e?"":" "+r+" "+n)+")":"")},u.ensureUniformFontSize=function(t,e){var r=u.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":158,"./anchor_utils":163,"./angles":164,"./array":165,"./clean_number":166,"./clear_responsive":168,"./coerce":169,"./dates":170,"./dom":171,"./extend":173,"./filter_unique":174,"./filter_visible":175,"./geometry2d":178,"./identity":179,"./increment":180,"./is_plain_object":182,"./keyed_container":183,"./localize":184,"./loggers":185,"./make_trace_groups":186,"./matrix":187,"./mod":188,"./nested_property":189,"./noop":190,"./notifier":191,"./push_unique":194,"./regex":196,"./relative_attr":197,"./relink_private":198,"./search":199,"./stats":201,"./throttle":203,"./to_log_range":204,d3:16,"d3-time-format":14,"fast-isnumeric":18}],182:[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}},{}],183:[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(p){for(o=e;o1){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},a.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},a.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":213,"./notifier":191}],186:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var i=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));i.exit().remove(),i.enter().append("g").attr("class",r),i.order();var a=t.classed("rangeplot")?"nodeRangePlot3":"node3";return i.each((function(t){t[0][a]=n.select(this)})),i}},{d3:16}],187:[function(t,e,r){"use strict";r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],189:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./array").isArrayOrTypedArray;function a(t,e){return function(){var r,n,o,s,l,u=t;for(s=0;s/g),l=0;la||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,p,h,f,d,m=r.length,g=r[0][0],y=r[0][1],v=0;for(c=1;cMath.max(p,g)||u>Math.max(h,y)))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 o(o){t.push(o);var s=r.length,l=n;r.splice(i+1);for(var u=l+1;u1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":158,"./matrix":187}],194:[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 c(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,o,p=0,h=e.length,f=0,d=h>1?(e[h-1]-e[0])/(h-1):1;for(o=d>=0?r?s:l:r?c:u,t+=1e-9*d*(r?-1:1)*(d>=0?1:-1);p90&&i.log("Long binary search..."),p-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t,e){var n,i=(e||{}).unitMinDiff,a=t.slice();for(a.sort(r.sorterAsc),n=a.length-1;n>-1&&a[n]===o;n--);var s=1;i||(s=a[n]-a[0]||1);for(var l,u=s/(n||1)/1e4,c=[],p=0;p<=n;p++){var h=a[p],f=h-l;void 0===l?(c.push(h),l=h):f>u&&(s=Math.min(s,f),c.push(h),l=h)}return{vals:c,minDiff:s}},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":165,"fast-isnumeric":18}],202:[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,A){var M=t.text(),C=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&M.match(l),L=n.select(t.node().parentNode);if(!L.empty()){var E=t.attr("class")?t.attr("class").split(" ")[0]:"text";return E+="-math",L.selectAll("svg."+E).remove(),L.selectAll("g."+E+"-group").remove(),t.style("display",null).attr({"data-unformatted":M,"data-math":"N"}),C?(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)}))}(C[2],a,(function(n,i,a){L.selectAll("svg."+E).remove(),L.selectAll("g."+E+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return z(),void e();var l=L.append("g").classed(E+"-group",!0).attr({"pointer-events":"none","data-unformatted":M,"data-math":"Y"});l.node().appendChild(o.node()),i&&i.node()&&o.node().insertBefore(i.node().cloneNode(!0),o.node().firstChild),o.attr({class:E,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=t.node().style.fill||"black",c=o.select("g");c.attr({fill:u,stroke:u});var p=s(c,"width"),h=s(c,"height"),f=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],d=-(r||s(t,"height"))/4;"y"===E[0]?(l.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,d-h/2]+")"}),o.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===E[0]?o.attr({x:t.attr("x"),y:d-h/2}):"a"===E[0]&&0!==E.indexOf("atitle")?o.attr({x:0,y:d}):o.attr({x:f,y:+t.attr("y")+d-h/2}),A&&A.call(t,l),e(l)}))}))):z(),t}function z(){L.empty()||(E=t.attr("class")+"-math",L.select("svg."+E).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(m," ");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)}v.test(e)?c():(r=t,l=[{node:t}]);for(var L=e.split(g),E=0;E|>|>)/g;var p={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"},f={sub:"-0.21em",sup:"0.42em"},d=["http:","https:","mailto:","",void 0,":"],m=r.NEWLINES=/(\r\n?|\n)/g,g=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,v=//i;r.BR_TAG_ALL=//gi;var _=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,x=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,b=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&S(n)}var k=/(^|;)\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(g),o=[],s="",l=0,u=0;ui?o.push(c.substr(0,d-i)+"..."):o.push(c.substr(0,d));break}s=""}}return o.join("")};var A={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},M=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function S(t){return t.replace(M,(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)):A[e])||t}))}function C(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=S,r.sanitizeHTML=function(t){t=t.replace(m," ");for(var e=document.createElement("p"),r=e,i=[],a=t.split(g),o=0;oa.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)}},{}],204:[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":18}],205:[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"}}},{}],206:[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"}}},{}],207:[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,p=(s.subplotsRegistry.ternary||{}).attrRegex,h=(s.subplotsRegistry.gl3d||{}).attrRegex,m=Object.keys(t);for(e=0;e3?(z.x=1.02,z.xanchor="left"):z.x<-2&&(z.x=-.02,z.xanchor="right"),z.y>3?(z.y=1.02,z.yanchor="bottom"):z.y<-2&&(z.y=-.02,z.yanchor="top")),d(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 b=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1&&a.warn("Full array edits are incompatible with other edits",p);var v=r[""][""];if(u(v))e.set(null);else{if(!Array.isArray(v))return a.warn("Unrecognized full array edit value",p,v),!0;e.set(v)}return!m&&(h(g,y),f(t),!0)}var _,x,b,w,T,k,A,M,S=Object.keys(r).map(Number).sort(o),C=e.get(),L=C||[],E=c(y,p).get(),z=[],I=-1,P=L.length;for(_=0;_L.length-(A?0:1))a.warn("index out of range",p,b);else if(void 0!==k)T.length>1&&a.warn("Insertion & removal are incompatible with edits to the same index.",p,b),u(k)?z.push(b):A?("add"===k&&(k={}),L.splice(b,0,k),E&&E.splice(b,0,{})):a.warn("Unrecognized full object edit value",p,b,k),-1===I&&(I=b);else for(x=0;x=0;_--)L.splice(z[_],1),E&&E.splice(z[_],1);if(L.length?C||e.set(L):e.set(null),m)return!1;if(h(g,y),d!==i){var D;if(-1===I)D=S;else{for(P=Math.max(L.length,P),D=[],_=0;_=I);_++)D.push(b);for(_=I;_=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 D(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]),P(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&P(t,r,"newIndices"),"undefined"!=typeof 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("undefined"==typeof r)throw new Error("indices must be an integer or array of integers");for(var a in P(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,p,h=o.isPlainObject(n),f=[];for(var d in Array.isArray(r)||(r=[r]),r=I(r,t.data.length-1),e)for(var m=0;m-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),T.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=Y(t,n),a=i.flags;a.calc&&(t.calcdata=void 0);var s=[h.previousPromises];a.layoutReplot?s.push(k.layoutReplot):Object.keys(n).length&&(H(t,a,i)||h.supplyDefaults(t),a.legend&&s.push(k.doLegend),a.layoutstyle&&s.push(k.layoutStyles),a.axrange&&Z(s,i.rangesAltered),a.ticks&&s.push(k.doTicksRelayout),a.modebar&&s.push(k.doModeBar),a.camera&&s.push(k.doCamera),a.colorbars&&s.push(k.doColorBars),s.push(C)),s.push(h.rehover,h.redrag),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 H(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=d.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[d.id2name(u)];c.autorange=l.autorange,c.range=l.range.slice(),c._input.range=l.range.slice()}}return!0}function Z(t,e){var r=e?function(t){var r=[],n=!0;for(var i in e){var a=d.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 d.draw(t,r,{skipTitle:n})}:function(t){return d.draw(t,"redraw")};t.push(x,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var G=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,X=/^[xyz]axis[0-9]*\.autorange$/,W=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function Y(t,e){var r,n,i,a=t.layout,l=t._fullLayout,u=l._guiEditing,h=N(l._preGUI,u),f=Object.keys(e),m=d.list(t),g=o.extendDeepAll({},e),y={};for(V(e),f=Object.keys(e),n=0;n0&&"string"!=typeof P.parts[O];)O--;var R=P.parts[O],F=P.parts[O-1]+"."+R,U=P.parts.slice(0,O).join("."),j=s(t.layout,U).get(),q=s(l,U).get(),H=P.get();if(void 0!==D){k[I]=D,S[I]="reverse"===R?D:B(H);var Z=p.getLayoutValObject(l,P.parts);if(Z&&Z.impliedEdits&&null!==D)for(var Y in Z.impliedEdits)C(o.relativeAttr(I,Y),Z.impliedEdits[Y]);if(-1!==["width","height"].indexOf(I))if(D){C("autosize",null);var J="height"===I?"width":"height";C(J,l[J])}else l[I]=t._initialAutoSize[I];else if("autosize"===I)C("width",D?null:l.width),C("height",D?null:l.height);else if(F.match(G))z(F),s(l,U+"._inputRange").set(null);else if(F.match(X)){z(F),s(l,U+"._inputRange").set(null);var Q=s(l,U).get();Q._inputDomain&&(Q._input.domain=Q._inputDomain.slice())}else F.match(W)&&s(l,U+"._inputDomain").set(null);if("type"===R){var $=j,tt="linear"===q.type&&"log"===D,et="log"===q.type&&"linear"===D;if(tt||et){if($&&$.range)if(q.autorange)tt&&($.range=$.range[1]>$.range[0]?[1,2]:[2,1]);else{var rt=$.range[0],nt=$.range[1];tt?(rt<=0&&nt<=0&&C(U+".autorange",!0),rt<=0?rt=nt/1e6:nt<=0&&(nt=rt/1e6),C(U+".range[0]",Math.log(rt)/Math.LN10),C(U+".range[1]",Math.log(nt)/Math.LN10)):(C(U+".range[0]",Math.pow(10,rt)),C(U+".range[1]",Math.pow(10,nt)))}else C(U+".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,q,D,C),c.getComponentMethod("images","convertCoords")(t,q,D,C)}else C(U+".autorange",!0),C(U+".range",null);s(l,U+"._inputRange").set(null)}else if(R.match(M)){var it=s(l,I).get(),at=(D||{}).type;at&&"-"!==at||(at="linear"),c.getComponentMethod("annotations","convertCoords")(t,it,at,C),c.getComponentMethod("images","convertCoords")(t,it,at,C)}var ot=w.containerArrayMatch(I);if(ot){r=ot.array,n=ot.index;var st=ot.property,lt=Z||{editType:"calc"};""!==n&&""===st&&(w.isAddVal(D)?S[I]=null:w.isRemoveVal(D)?S[I]=(s(a,r).get()||[])[n]:o.warn("unrecognized full object value",e)),A.update(b,lt),y[r]||(y[r]={});var ut=y[r][n];ut||(ut=y[r][n]={}),ut[st]=D,delete e[I]}else"reverse"===R?(j.range?j.range.reverse():(C(U+".autorange",!0),j.range=[1,0]),q.autorange?b.calc=!0:b.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===I&&("lasso"===D||"select"===D)&&"lasso"!==H&&"select"!==H||l._has("gl2d")?b.plot=!0:Z?A.update(b,Z):b.calc=!0,P.set(D))}}for(r in y){w.applyContainerArrayChanges(t,h(a,r),y[r],b,h)||(b.plot=!0)}var ct=l._axisConstraintGroups||[];for(L in E)for(n=0;n1;)if(n.pop(),void 0!==(r=s(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(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 p(){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,T.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 f(){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&&p()};e()}var d,m,g=0;function y(t){return Array.isArray(i)?g>=i.length?t.transitionOpts=i[g]:t.transitionOpts=i[0]:t.transitionOpts=i,g++,t}var v=[],_=null==e,x=Array.isArray(e);if(!_&&!x&&o.isPlainObject(e))v.push({type:"object",data:y(o.extendFlat({},e))});else if(_||-1!==["string","number"].indexOf(typeof e))for(d=0;d0&&kk)&&A.push(m);v=A}}v.length>0?function(e){if(0!==e.length){for(var i=0;i=0;n--)if(o.isPlainObject(e[n])){var m=e[n].name,g=(c[m]||d[m]||{}).name,y=e[n].name,v=c[g]||d[g];g&&y&&"number"==typeof y&&v&&S<5&&(S++,o.warn('addFrames: overwriting frame "'+(c[g]||d[g]).name+'" with a frame whose name of type "number" also equates to "'+g+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===S&&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.")),d[m]={name:m},f.push({frame:h.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:p+n})}f.sort((function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(i=f[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,p=[t,s],f=[t,a];return u&&u.add(t,l,p,c,f),h.modifyFrames(t,a)},r.addTraces=function t(e,n,i){e=o.getGraphDiv(e);var a,s,l=[],c=r.deleteTraces,p=t,h=[e,l],f=[e,n];for(function(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&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 w(){var t,e,r={};for(t in d(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var i=0;i=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 p=t._module;if(p||(p=(n.modules[t.type||a.type.dflt]||{})._module),!p)return!1;if(!(i=(r=p.attributes)&&r[o])){var h=p.basePlotModule;h&&h.attributes&&(i=h.attributes[o])}i||(i=a[o])}return x(i,e,s)},r.getLayoutValObject=function(t,e){return x(function(t,e){var r,i,a,s,l=t._basePlotModules;if(l){var u;for(r=0;r=i&&(r._input||{})._templateitemname;o&&(a=i);var s,l=e+"["+a+"]";function u(){s={},o&&(s[l]={},s[l].templateitemname=o)}function c(t,e){o?n.nestedProperty(s[l],t).set(e):s[l+"."+t]=e}function p(){var t=s;return u(),t}return u(),{modifyBase:function(t,e){s[t]=e},modifyItem:c,getUpdateObj:p,applyUpdate:function(e,r){e&&c(e,r);var i=p();for(var a in i)n.nestedProperty(t,a).set(i[a])}}}},{"../lib":181,"../plots/attributes":222}],216:[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"),p=t("../components/modebar"),h=t("../plots/cartesian/axes"),f=t("../constants/alignment"),d=t("../plots/cartesian/constraints"),m=d.enforce,g=d.clean,y=t("../plots/cartesian/autorange").doAutoRange;function v(t,e,r){for(var n=0;n=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function _(t){var e,i,s,c,d,m,g=t._fullLayout,y=g._size,_=y.p,b=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),p.manage(t),!g._has("cartesian"))return a.previousPromises(t);function T(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-_-n:e._offset+e._length+_+n:y.t+y.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+_+n:e._offset-_-n:y.l+y.w*(t.position||0)+n%1}for(e=0;eT?c.push({code:"unused",traceType:v,templateCount:w,dataCount:T}):T>w&&c.push({code:"reused",traceType:v,templateCount:w,dataCount:T})}}else c.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var a=e[n],o=m(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)&&g(a)&&t(a,o)}}({data:f,layout:h},""),c.length)return c.map(y)}},{"../lib":181,"../plots/attributes":222,"../plots/plots":266,"./plot_config":213,"./plot_schema":214,"./plot_template":215}],218:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./plot_api"),a=t("../plots/plots"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg"),c=t("../version").version,p={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,h,f,d;function m(t){return!(t in e)||o.validate(e[t],p[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],h=t.layout||{},f=t.config||{},d={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),h=o.extendDeep({},t.layout),f=t._context,d=t._fullLayout||{}),!m("width")&&null!==e.width||!m("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!m("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var g={};function y(t,r){return o.coerce(e,g,p,t,r)}var v=y("format"),_=y("width"),x=y("height"),b=y("scale"),w=y("setBackground"),T=y("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var A=o.extendFlat({},h);_?A.width=_:null===e.width&&n(d.width)&&(A.width=d.width),x?A.height=x:null===e.height&&n(d.height)&&(A.height=d.height);var M=o.extendFlat({},f,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),S=s.getRedrawFunc(k);function C(){return new Promise((function(t){setTimeout(t,s.getDelay(k._fullLayout))}))}function L(){return new Promise((function(t,e){var r=l(k,v,b),n=k._fullLayout.width,p=k._fullLayout.height;function h(){i.purge(k),document.body.removeChild(k)}if("full-json"===v){var f=a.graphJson(k,!1,"keepdata","object",!0,!0);return f.version=c,f=JSON.stringify(f),h(),t(T?f:s.encodeJSON(f))}if(h(),"svg"===v)return t(T?r:s.encodeSVG(r));var d=document.createElement("canvas");d.id=o.randstr(),u({format:v,width:n,height:p,scale:b,canvas:d,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){i.plot(k,r,A,M).then(S).then(C).then(L).then((function(e){t(function(t){return T?t.replace(s.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":181,"../plots/plots":266,"../snapshot/helpers":279,"../snapshot/svgtoimg":281,"../snapshot/tosvg":283,"../version":344,"./plot_api":212,"fast-isnumeric":18}],219:[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 p=Object.keys(t),h=0;h_.length&&i.push(d("unused",a,y.concat(_.length)));var A,M,S,C,L,E=_.length,z=Array.isArray(k);if(z&&(E=Math.min(E,k.length)),2===x.dimensions)for(M=0;M_[M].length&&i.push(d("unused",a,y.concat(M,_[M].length)));var I=_[M].length;for(A=0;A<(z?Math.min(I,k[M].length):I);A++)S=z?k[M][A]:k,C=v[M][A],L=_[M][A],n.validate(C,S)?L!==C&&L!==+C&&i.push(d("dynamic",a,y.concat(M,A),C,L)):i.push(d("value",a,y.concat(M,A),C))}else i.push(d("array",a,y.concat(M),v[M]));else for(M=0;M1&&f.push(d("object","layout"))),i.supplyDefaults(m);for(var g=m._fullData,y=r.length,v=0;v0&&((x=A-o(g)-o(y))>M?b/x>C&&(v=g,_=y,C=b/x):b/A>C&&(v={val:g.val,pad:0},_={val:y.val,pad:0},C=b/A));if(h===f){var L=h-1,E=h+1;if(T)if(0===h)a=[0,1];else{var z=(h>0?p:c).reduce((function(t,e){return Math.max(t,o(e))}),0),I=h/(1-Math.min(.5,z/A));a=h>0?[0,I]:[I,0]}else a=k?[Math.max(0,L),Math.max(1,E)]:[L,E]}else T?(v.val>=0&&(v={val:0,pad:0}),_.val<=0&&(_={val:0,pad:0})):k&&(v.val-C*o(v)<0&&(v={val:0,pad:0}),_.val<=0&&(_={val:1,pad:0})),C=(_.val-v.val-S(g.val,y.val))/(A-o(v)-o(_)),a=[v.val-C*o(v),_.val+C*o(_)];return d&&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 f(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,d,m,g,y=[],v=[],_=e.length,x=r.padded||!1,b=r.tozero&&("linear"===t.type||"-"===t.type),w="log"===t.type,T=!1,k=r.vpadLinearized||!1;function A(t){if(Array.isArray(t))return T=!0,function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}var M=A((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),S=A((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),C=A(r.vpadplus||r.vpad),L=A(r.vpadminus||r.vpad);if(!T){if(m=1/0,g=-1/0,w)for(i=0;i<_;i++)(o=e[i])0&&(m=o),o>g&&o-a&&(m=o),o>g&&o=I;i--)z(i);return{min:y,max:v,opts:r}},concatExtremes:u}},{"../../constants/numerical":158,"../../lib":181,"../../registry":275,"fast-isnumeric":18}],225:[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"),p=t("../../components/drawing"),h=t("./layout_attributes"),f=t("./clean_ticks"),d=t("../../constants/numerical"),m=d.ONEMAXYEAR,g=d.ONEAVGYEAR,y=d.ONEMINYEAR,v=d.ONEMAXQUARTER,_=d.ONEAVGQUARTER,x=d.ONEMINQUARTER,b=d.ONEMAXMONTH,w=d.ONEAVGMONTH,T=d.ONEMINMONTH,k=d.ONEWEEK,A=d.ONEDAY,M=A/2,S=d.ONEHOUR,C=d.ONEMIN,L=d.ONESEC,E=d.MINUS_SIGN,z=d.BADNUM,I=t("../../constants/alignment"),P=I.MID_SHIFT,D=I.CAP_SHIFT,O=I.LINE_SPACING,R=I.OPPOSITE_SIDE,F=e.exports={};F.setConvert=t("./set_convert");var B=t("./axis_autotype"),N=t("./axis_ids");F.id2name=N.id2name,F.name2id=N.name2id,F.cleanId=N.cleanId,F.list=N.list,F.listIds=N.listIds,F.getFromId=N.getFromId,F.getFromTrace=N.getFromTrace;var U=t("./autorange");F.getAutoRange=U.getAutoRange,F.findExtremes=U.findExtremes;function j(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}F.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)},F.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=F.getFromId(e,n);l=r(i,a=u.fraction2r(a)),o=u.cleanPos}t[i]=o(l)},F.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:F.getFromId(e,r).cleanPos)(t)},F.redrawComponents=function(t,e){e=e||F.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},F.saveRangeInitial=function(t,e){for(var r=F.list(t,"",!0),n=!1,i=0;i.3*h||c(n)||c(a))){var f=r.dtick/2;t+=t+f.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=F.tickIncrement(t,"M6","reverse")+1.5*A:a.exactMonths>.8?t=F.tickIncrement(t,"M1","reverse")+15.5*A:t-=M;var l=F.tickIncrement(t,r);if(l<=n)return l}return t}(v,t,y,u,a)),g=v,0;g<=c;)g=F.tickIncrement(g,y,!1,a);return{start:e.c2r(v,0,a),end:e.c2r(g,0,a),size:y,_dataSpan:c-u}},F.prepTicks=function(t,e){var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if("auto"===t.tickmode||!t.dtick){var n,i=t.nticks;i||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,i=t._length/n):(n="y"===t._id.charAt(0)?40:80,i=s.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(i*=2)),"array"===t.tickmode&&(i*=100),t._roughDTick=(Math.abs(r[1]-r[0])-(t._lBreaks||0))/i,F.autoTicks(t,t._roughDTick),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),$(t)},F.calcTicks=function(t,e){F.prepTicks(t,e);var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if("array"===t.tickmode)return function(t){var e=t.tickvals,r=t.ticktext,n=new Array(e.length),i=j(s.simpleMap(t.range,t.r2l)),a=Math.min(i[0],i[1]),o=Math.max(i[0],i[1]),l=0;Array.isArray(r)||(r=[]);var u="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 c=0;ca&&p=o:n<=o)&&!(u.length>r||n===e);n=F.tickIncrement(n,t.dtick,l,t.calendar)){e=n;var i=!1;c&&n!==(0|n)&&(i=!0),u.push({minor:i,value:n})}}();var p="period"===t.ticklabelmode;if(p&&u.unshift({minor:!1,value:F.tickIncrement(u[0].value,t.dtick,!l,t.caldendar)}),t.rangebreaks){var h=u.length;if(h){var f=0;"auto"===t.tickmode&&(f=("y"===t._id.charAt(0)?2:6)*(t.tickfont?t.tickfont.size:12));for(var d,C=[],L=l?1:-1,E=l?h-1:0,I=l?0:h-1;L*I<=L*E;I+=L){var P=u[I];if(t.maskBreaks(P.value)!==z||(P.value=yt(P.value,t),!t._rl||t._rl[0]!==P.value&&t._rl[1]!==P.value)){var D=t.c2p(P.value);D===d?C[C.length-1].valuef)&&(d=D,C.push(P))}}u=C.reverse()}}gt(t)&&360===Math.abs(r[1]-r[0])&&u.pop(),t._tmax=(u[u.length-1]||{}).value,t._prevDateHead="",t._inCalcTicks=!0;var O,R=Math.min(r[0],r[1]),B=Math.max(r[0],r[1]),N=F.getTickFormat(t);p&&N&&(/%[fLQsSMX]/.test(N)||(/%[HI]/.test(N)?O=S:/%p/.test(N)?O=M:/%[Aadejuwx]/.test(N)?O=A:/%[UVW]/.test(N)?O=k:/%[Bbm]/.test(N)?O=w:/%[q]/.test(N)?O=_:/%[Yy]/.test(N)&&(O=g)));var U,V,q=[];for(U=0;U0?(Y=U-1,K=U):(Y=U,K=U);var J=q[Y].x,Q=q[K].x,$=Math.abs(Q-J),et=O||$,rt=0;if(et>=y?rt=$>=y&&$<=m?$:g:O===_&&et>=x?rt=$>=x&&$<=v?$:_:et>=T?rt=$>=T&&$<=b?$:w:O===k&&et>=k?rt=k:et>=A?rt=A:O===M&&et>=M?rt=M:O===S&&et>=S&&(rt=S),rt&&t.rangebreaks){for(var nt=0,it=0,at=0;at<42;at++){var ot=at/42;t.maskBreaks(J*(1-ot)+Q*ot)!==z&&(ot<.5?nt++:it++)}it&&(rt*=(nt+it)/42)}rt<=$&&(W+=rt/2),q[U].periodX=W,(W>B||W=R){t._prevDateHead="",q[U].text=F.tickText(t,q[U].x).text;break}}return t._inCalcTicks=!1,q};var Z=[2,5,10],G=[1,2,3,6,12],X=[1,2,5,10,15,30],W=[1,2,3,7,14],Y=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],K=[-.301,0,.301,.699,1],J=[15,30,45,90,180];function Q(t,e,r){return e*s.roundUp(t/e,r)}function $(t){var e=t.dtick;if(t._tickexponent=0,i(e)||"string"==typeof e||(e=1),"category"!==t.type&&"multicategory"!==t.type||(t._tickround=null),"date"===t.type){var r=t.r2l(t.tick0),n=t.l2r(r).replace(/(^-|i)/g,""),a=n.length;if("M"===String(e).charAt(0))a>10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=A&&a<=10||e>=15*A)t._tickround="d";else if(e>=C&&a<=16||e>=S)t._tickround="M";else if(e>=L&&a<=19||e>=C)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&&(rt(t.exponentformat)&&!nt(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function tt(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}}F.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;if(a>g)e/=g,r=n(10),t.dtick="M"+12*Q(e,r,Z);else if(a>w)e/=w,t.dtick="M"+Q(e,1,G);else if(a>A){t.dtick=Q(e,A,t._hasDayOfWeekBreaks?[1,2,7,14]:W),t.tick0=s.dateTick0(t.calendar,!0);var o=F.getTickFormat(t);if(/%[uVW]/.test(o)){var l=t.tick0.length,u=+t.tick0[l-1];t.tick0=t.tick0.substring(0,l-2)+String(u+1)}}else a>S?t.dtick=Q(e,S,G):a>C?t.dtick=Q(e,C,X):a>L?t.dtick=Q(e,L,X):(r=n(10),t.dtick=Q(e,r,Z))}else if("log"===t.type){t.tick0=0;var c=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(c[1]-c[0])<1){var p=1.5*Math.abs((c[1]-c[0])/e);e=Math.abs(Math.pow(10,c[1])-Math.pow(10,c[0]))/p,r=n(10),t.dtick="L"+Q(e,r,Z)}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))):gt(t)?(t.tick0=0,r=1,t.dtick=Q(e,r,J)):(t.tick0=0,r=n(10),t.dtick=Q(e,r,Z));if(0===t.dtick&&(t.dtick=1),!i(t.dtick)&&"string"!=typeof t.dtick){var h=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(h)}},F.tickIncrement=function(t,e,r,a){var o=r?-1:1;if(i(e))return s.increment(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?K:Y,p=t+.01*o,h=s.roundUp(s.mod(p,1),c,r);return Math.floor(p)+Math.log(n.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(e)},F.tickFirst=function(t,e){var r=t.r2l||Number,a=s.simpleMap(t.range,r,void 0,void 0,e),o=a[1]"+l,t._prevDateHead=l));e.text=u}(t,o,r,u):"log"===c?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=it(Math.pow(10,l),t,a,n);else if(i(o)||"D"===c&&s.mod(l+.01,1)<.1){var p=Math.round(l),h=Math.abs(p),f=t.exponentformat;"power"===f||rt(f)&&nt(p)?(e.text=0===p?1:1===p?"10":"10"+(p>1?"":E)+h+"",e.fontSize*=1.25):("e"===f||"E"===f)&&h>2?e.text="1"+f+(p>0?"+":E)+h:(e.text=it(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 d=String(e.text).charAt(0);"0"!==d&&"1"!==d||("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,m):"category"===c?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===c?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,o,r):gt(t)?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=it(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){for(var r=1;!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=it(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+e.text)}}}}(t,o,r,u,m):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=it(e.x,t,i,n)}(t,o,0,u,m),n||(t.tickprefix&&!d(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!d(t.showticksuffix)&&(o.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};o.xbnd=[g(o.x-.5),g(o.x+t.dtick-.5)]}return o},F.hoverLabelText=function(t,e,r){if(r!==z&&r!==e)return F.hoverLabelText(t,e)+" - "+F.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=F.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":E+i:i};var et=["f","p","n","\u03bc","m","","k","M","G","T"];function rt(t){return"SI"===t||"B"===t}function nt(t){return t>14||t<-15}function it(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=F.getTickFormat(e),p=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]};$(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,E);var f,d=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))"+f+"":"B"===l&&9===u?t+="B":rt(l)&&(t+=et[u/3+5]));return a?E+t:t}function at(t,e){for(var r=[],n={},i=0;i1&&r=i.min&&t=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.bottom-c:0,p)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var f=[0,1];if("x"===d){if("b"===l?n[l]=e._depth:(n[l]=e._depth=Math.max(r.width>0?c-r.top:0,p),f.reverse()),r.width>0){var g=r.right-(e._offset+e._length);g>0&&(n.xr=1,n.r=g);var y=e._offset-r.left;y>0&&(n.xl=0,n.l=y)}}else if("l"===l?n[l]=e._depth=Math.max(r.height>0?c-r.left:0,p):(n[l]=e._depth=Math.max(r.height>0?r.right-c:0,p),f.reverse()),r.height>0){var v=r.bottom-(e._offset+e._length);v>0&&(n.yb=0,n.b=v);var _=e._offset-r.top;_>0&&(n.yt=1,n.t=_)}n[m]="free"===e.anchor?e.position:e._anchorAxis.domain[f[0]],e.title.text!==h._dfltTitle[d]&&(n[l]+=st(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((i={x:0,y:0,r:0,l:0,t:0,b:0})[u]=e.linewidth,e.mirror&&!0!==e.mirror&&(i[u]+=p),!0===e.mirror||"ticks"===e.mirror?i[m]=e._anchorAxis.domain[f[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(i[m]=[e._counterDomainMin,e._counterDomainMax][f[1]]))}Y&&(s=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),a.autoMargin(t,ct(e),n),a.autoMargin(t,pt(e),i),a.autoMargin(t,ht(e),s)})),r.skipTitle||Y&&"bottom"===e.side||X.push((function(){return function(t,e){var r,n=t._fullLayout,i=e._id,a=i.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+st(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===a?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var s,l,c,h,f=F.getPxPosition(t,e);"x"===a?(l=e._offset+e._length/2,c="top"===e.side?f-r:f+r):(c=e._offset+e._length/2,l="right"===e.side?f+r:f-r,s={rotate:"-90",offset:0});if("multicategory"!==e.type){var d=e._selections[e._id+"tick"];if(h={selection:d,side:e.side},d&&d.node()&&d.node().parentNode){var m=p.getTranslate(d.node().parentNode);h.offsetLeft=m.x,h.offsetTop=m.y}e.title.hasOwnProperty("standoff")&&(h.pad=0)}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(X)}}function K(t){var r=f+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,i,a;t._selections[e].size()?(r=1/0,n=-1/0,i=1/0,a=-1/0,t._selections[e].each((function(){var t=ut(this),e=p.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),i=Math.min(i,e.left),a=Math.max(a,e.right)}))):(r=0,n=0,i=0,a=0);return{top:r,bottom:n,left:i,right:a,height:n-r,width:a-i}}(e,r)),w[r]}},F.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}))),t.side&&i.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),i},F.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))+")"}},F.makeTransPeriodFn=function(t){var e=t._id.charAt(0),r=t._offset;return"x"===e?function(e){return"translate("+(r+t.l2p(e.periodX))+",0)"}:function(e){return"translate(0,"+(r+t.l2p(e.periodX))+")"}},F.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},F.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,p,h,f,d={labelStandoff:o+=(t.linewidth||1)/2,labelShift:l};return"x"===n?(f="bottom"===t.side?1:-1,c=l*f,p=e+o*f,h="bottom"===t.side?1:-.2,d.xFn=function(t){return t.dx+c},d.yFn=function(t){return t.dy+p+t.fontSize*h},d.anchorFn=function(t,e){return i(e)&&0!==e&&180!==e?e*f<0?"end":"start":"middle"},d.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side?-n:0}):"y"===n&&(f="right"===t.side?1:-1,c=o,p=-l*f,h=90===Math.abs(t.tickangle)?.5:0,d.xFn=function(t){return t.dx+e+(c+t.fontSize*h)*f},d.yFn=function(t){return t.dy+p+t.fontSize*P},d.anchorFn=function(e,r){return i(r)&&90===Math.abs(r)?"middle":"right"===t.side?"start":"end"},d.heightFn=function(e,r,n){return(r*="left"===t.side?1:-1)<-30?-n:r<30?-.5*n:0}),d},F.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",i=r.vals;"period"===e.ticklabelmode&&(i=i.slice()).shift();var a=r.layer.selectAll("path."+n).data(e.ticks?i:[],ot);a.exit().remove(),a.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(c.stroke,e.tickcolor).style("stroke-width",p.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),a.attr("transform",r.transFn)},F.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&&F.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;e=2){var l,u,c="";if(2===o.length)for(l=0;l<2;l++)if(u=v(o[l])){c=d;break}var p=i("pattern",c);if(p===d)for(l=0;l<2;l++)(u=v(o[l]))&&(e.bounds[l]=o[l]=u-1);if(p)for(l=0;l<2;l++)switch(u=o[l],p){case d:if(!n(u))return void(e.enabled=!1);if((u=+u)!==Math.floor(u)||u<0||u>=7)return void(e.enabled=!1);e.bounds[l]=o[l]=u;break;case m:if(!n(u))return void(e.enabled=!1);if((u=+u)<0||u>24)return void(e.enabled=!1);e.bounds[l]=o[l]=u}if(!1===r.autorange){var h=r.range;if(h[0]h[1])return void(e.enabled=!1)}else if(o[0]>h[0]&&o[1]n?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*_)||T)for(r=0;rP&&Rz&&(z=R);f/=(z-E)/(2*I),E=u.l2r(E),z=u.l2r(z),u.range=u._input.range=S=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function F(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 B(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"),U(t,e,i,a)}function U(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 j(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function V(t){E&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),E=!1)}function q(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,L)/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 H(t,e,r,n){for(var i,a,o,l,u=!1,c={},p={},h=0;h=0)i._fullLayout._deactivateShape(i);else{var a=i._fullLayout.clickmode;if(j(i),2!==t||dt||jt(),ft)a.indexOf("select")>-1&&A(r,i,Y,K,e.id,Ct),a.indexOf("event")>-1&&p.click(i,r,e.id);else if(1===t&&dt){var s=m?U:z,u="s"===m||"w"===E?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),f="left",d="middle";if(s.fixedrange)return;m?(d="n"===m?"top":"bottom","right"===s.side&&(f="right")):"e"===E&&(f="right"),i._context.showAxisRangeEntryBoxes&&n.select(yt).call(l.makeEditable,{gd:i,immediate:!0,background:i._fullLayout.paper_bgcolor,text:String(h),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:f,verticalAlign:d}).on("edit",(function(t){var e=s.d2r(t);void 0!==e&&o.call("_guiRelayout",i,c,e)}))}}}function zt(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min($,e+vt)),i=Math.max(0,Math.min(tt,r+_t)),a=Math.abs(n-vt),o=Math.abs(i-_t);function s(){kt="",xt.r=xt.l,xt.t=xt.b,Mt.attr("d","M0,0Z")}if(xt.l=Math.min(vt,n),xt.r=Math.max(vt,n),xt.t=Math.min(_t,i),xt.b=Math.max(_t,i),et.isSubplotConstrained)a>L||o>L?(kt="xy",a/$>o/tt?(o=a*tt/$,_t>i?xt.t=_t-o:xt.b=_t+o):(a=o*$/tt,vt>n?xt.l=vt-a:xt.r=vt+a),Mt.attr("d",q(xt))):s();else if(rt.isSubplotConstrained)if(a>L||o>L){kt="xy";var l=Math.min(xt.l/$,(tt-xt.b)/tt),u=Math.max(xt.r/$,(tt-xt.t)/tt);xt.l=l*$,xt.r=u*$,xt.b=(1-l)*tt,xt.t=(1-u)*tt,Mt.attr("d",q(xt))}else s();else!it||om[1]-1/4096&&(e.domain=s),i.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":181,"fast-isnumeric":18}],243:[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":155}],244:[function(t,e,r){"use strict";var n=t("polybooljs"),i=t("../../registry"),a=t("../../components/drawing").dashStyle,o=t("../../components/color"),s=t("../../components/fx"),l=t("../../components/fx/helpers").makeEventData,u=t("../../components/dragelement/helpers"),c=u.freeMode,p=u.rectMode,h=u.drawMode,f=u.openMode,d=u.selectMode,m=t("../../components/shapes/draw_newshape/display_outlines"),g=t("../../components/shapes/draw_newshape/helpers").handleEllipse,y=t("../../components/shapes/draw_newshape/newshapes"),v=t("../../lib"),_=t("../../lib/polygon"),x=t("../../lib/throttle"),b=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),T=t("../../plot_api/subroutines").redrawReglTraces,k=t("./constants"),A=k.MINSELECT,M=_.filter,S=_.tester,C=t("./handle_outline").clearSelect,L=t("./helpers"),E=L.p2r,z=L.axValue,I=L.getTransform;function P(t,e,r,n,i,a,o){var s,l,u,c,p,h,d,g,y,v=e._hoverdata,_=e._fullLayout.clickmode.indexOf("event")>-1,x=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(v)){F(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=U(b))){for(o&&o.remove(),y=0;y=0&&n._fullLayout._deactivateShape(n),h(e)){var a=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(a&&n._fullLayout._drawing){var o=y(a,t);o&&i.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function N(t,e,r,n){var i,a,o,s=[],l=e.map((function(t){return t._id})),u=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(i)>-1}function j(t,e,r){var n,a,o,s;for(n=0;n=0)X._fullLayout._deactivateShape(X);else if(!U){var r=W.clickmode;x.done(ht).then((function(){if(x.clear(ht),2===t){for(lt.remove(),w=0;w-1&&P(e,X,i.xaxes,i.yaxes,i.subplot,i,lt),"event"===r&&X.emit("plotly_selected",void 0);s.click(X,e)})).catch(v.error)}},i.doneFn=function(){pt.remove(),x.done(ht).then((function(){x.clear(ht),i.gd.emit("plotly_selected",C),b&&i.selectionDefs&&(b.subtract=st,i.selectionDefs.push(b),i.mergedPolygons.length=0,[].push.apply(i.mergedPolygons,_)),i.doneFnCompleted&&i.doneFnCompleted(ft)})).catch(v.error),U&&B(i)}},clearSelect:C,clearSelectionsCache:B,selectOnClick:P}},{"../../components/color":53,"../../components/dragelement/helpers":71,"../../components/drawing":75,"../../components/fx":93,"../../components/fx/helpers":89,"../../components/shapes/draw_newshape/display_outlines":138,"../../components/shapes/draw_newshape/helpers":139,"../../components/shapes/draw_newshape/newshapes":140,"../../lib":181,"../../lib/clear_gl_canvases":167,"../../lib/polygon":193,"../../lib/throttle":203,"../../plot_api/subroutines":216,"../../registry":275,"./axis_ids":228,"./constants":231,"./handle_outline":235,"./helpers":236,polybooljs:27}],245:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,u=o.dateTime2ms,c=o.ensureNumber,p=o.isArrayOrTypedArray,h=t("../../constants/numerical"),f=h.FP_SAFE,d=h.BADNUM,m=h.LOG_CLIP,g=h.ONEWEEK,y=h.ONEDAY,v=h.ONEHOUR,_=h.ONEMIN,x=h.ONESEC,b=t("./axis_ids"),w=t("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function A(t){return Math.pow(10,t)}function M(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",h=r.charAt(0);function S(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*m*Math.abs(n-i))}return d}function C(e,r,n,i){if((i||{}).msUTC&&a(e))return+e;var s=u(e,n||t.calendar);if(s===d){if(!a(e))return d;e=+e;var l=Math.floor(10*o.mod(e+.05,1)),c=Math.round(e-l/10);s=u(new Date(c))+l/10}return s}function L(e,r,n){return l(e,r,n||t.calendar)}function E(e){return t._categories[Math.round(e)]}function z(e){if(M(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function I(e){if(t._categoriesMap)return t._categoriesMap[e]}function P(t){var e=I(t);return void 0!==e?e:a(t)?+t:void 0}function D(t,e,r){return n.round(r+e*t,2)}function O(t,e,r){return(t-r)/e}var R=function(e){return a(e)?D(e,t._m,t._b):d},F=function(e){return O(e,t._m,t._b)};if(t.rangebreaks){var B="y"===h;R=function(e){if(!a(e))return d;var r=t._rangebreaks.length;if(!r)return D(e,t._m,t._b);var n=B;t.range[0]>t.range[1]&&(n=!n);for(var i=n?-1:1,o=i*e,s=0,l=0;lc)){s=o<(u+c)/2?l:l+1;break}s=l+1}var p=t._B[s]||0;return isFinite(p)?D(e,t._m2,p):0},F=function(e){var r=t._rangebreaks.length;if(!r)return O(e,t._m,t._b);for(var n=0,i=0;it._rangebreaks[i].pmax&&(n=i+1);return O(e,t._m2,t._B[n])}}t.c2l="log"===t.type?S:c,t.l2c="log"===t.type?A:c,t.l2p=R,t.p2l=F,t.c2p="log"===t.type?function(t,e){return R(S(t,e))}:R,t.p2c="log"===t.type?function(t){return A(F(t))}:F,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=F,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return S(s(t),e)},t.r2d=t.r2c=function(t){return A(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=S,t.l2d=A,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return A(F(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=F,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=C,t.c2d=t.c2r=t.l2d=t.l2r=L,t.d2p=t.r2p=function(e,r,n){return t.l2p(C(e,0,n))},t.p2d=t.p2r=function(t,e,r){return L(F(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=z,t.r2d=t.c2d=t.l2d=E,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return E(F(t))},t.r2p=t.d2p,t.p2r=F,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=E,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=I,t.l2r=t.c2r=c,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return E(F(t))},t.r2p=t.d2p,t.p2r=F,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:c(t)},t.setupMultiCategory=function(n){var i,a,s=t._traceIndices,l=e._axisMatchGroups;if(l&&l.length&&0===t._categories.length)for(i=0;if&&(s[n]=f),s[0]===s[1]){var u=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=u,s[1]+=u}}else o.nestedProperty(t,e).set(i)},t.setScale=function(r){var n=e._size;if(t.overlaying){var i=b.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var a=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(a);var s,l,u=t.r2l(t[a][0],o),c=t.r2l(t[a][1],o),p="y"===h;if((p?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(u,c),Math.max(u,c)),t._rangebreaks.length)){for(s=0;sc&&(f=!f),f&&t._rangebreaks.reverse();var d=f?-1:1;for(t._m2=d*t._length/(Math.abs(c-u)-t._lBreaks),t._B.push(-t._m2*(p?c:u)),s=0;si&&(i+=7,ai&&(i+=24,a=n&&a=n&&e=s.min&&(ts.max&&(s.max=n),i=!1)}i&&u.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function g(e,r){var n=e.plotinfo,i=n.xaxis,l=n.yaxis,u=i._length,c=l._length,p=!!e.xr1,h=!!e.yr1,f=[];if(p){var d=a.simpleMap(e.xr0,i.r2l),m=a.simpleMap(e.xr1,i.r2l),g=d[1]-d[0],y=m[1]-m[0];f[0]=(d[0]*(1-r)+r*m[0]-d[0])/(d[1]-d[0])*u,f[2]=u*(1-r+r*y/g),i.range[0]=i.l2r(d[0]*(1-r)+r*m[0]),i.range[1]=i.l2r(d[1]*(1-r)+r*m[1])}else f[0]=0,f[2]=u;if(h){var v=a.simpleMap(e.yr0,l.r2l),_=a.simpleMap(e.yr1,l.r2l),x=v[1]-v[0],b=_[1]-_[0];f[1]=(v[1]*(1-r)+r*_[1]-v[1])/(v[0]-v[1])*c,f[3]=c*(1-r+r*b/x),l.range[0]=i.l2r(v[0]*(1-r)+r*_[0]),l.range[1]=l.l2r(v[1]*(1-r)+r*_[1])}else f[1]=0,f[3]=c;s.drawOne(t,i,{skipTitle:!0}),s.drawOne(t,l,{skipTitle:!0}),s.redrawComponents(t,[i._id,l._id]);var w=p?u/f[2]:1,T=h?c/f[3]:1,k=p?f[0]:0,A=h?f[1]:0,M=p?f[0]/f[2]*u:0,S=h?f[1]/f[3]*c:0,C=i._offset-M,L=l._offset-S;n.clipRect.call(o.setTranslate,k,A).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,C,L).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}s.redrawComponents(t)}},{"../../components/drawing":75,"../../lib":181,"../../registry":275,"./axes":225,d3:16}],250:[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,s=t._id,l=s.charAt(0);-1!==s.indexOf("scene")&&(s=l);var u=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,s,l);if(!u)return;if("histogram"===u.type&&l==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=l+"calendar",p=u[c],h={noMultiCategory:!n(u,"cartesian")||n(u,"noMultiCategory")};"box"===u.type&&u._hasPreCompStats&&l==={h:"x",v:"y"}[u.orientation||"v"]&&(h.noMultiCategory=!0);if(o(u,l)){var f=a(u),d=[];for(r=0;r0?".":"")+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"],p=0;p\xa9 OpenStreetMap',tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-osm-tiles",type:"raster",source:"plotly-osm-tiles",minzoom:0,maxzoom:22}]},"white-bg":{id:"white-bg",version:8,sources:{},layers:[{id:"white-bg",type:"background",paint:{"background-color":"#FFFFFF"},minzoom:0,maxzoom:22}]},"carto-positron":{id:"carto-positron",version:8,sources:{"plotly-carto-positron":{type:"raster",attribution:'\xa9 CARTO',tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-positron",type:"raster",source:"plotly-carto-positron",minzoom:0,maxzoom:22}]},"carto-darkmatter":{id:"carto-darkmatter",version:8,sources:{"plotly-carto-darkmatter":{type:"raster",attribution:'\xa9 CARTO',tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-darkmatter",type:"raster",source:"plotly-carto-darkmatter",minzoom:0,maxzoom:22}]},"stamen-terrain":{id:"stamen-terrain",version:8,sources:{"plotly-stamen-terrain":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under ODbL.',tiles:["https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-terrain",type:"raster",source:"plotly-stamen-terrain",minzoom:0,maxzoom:22}]},"stamen-toner":{id:"stamen-toner",version:8,sources:{"plotly-stamen-toner":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under ODbL.',tiles:["https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-toner",type:"raster",source:"plotly-stamen-toner",minzoom:0,maxzoom:22}]},"stamen-watercolor":{id:"stamen-watercolor",version:8,sources:{"plotly-stamen-watercolor":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under CC BY SA.',tiles:["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-watercolor",type:"raster",source:"plotly-stamen-watercolor",minzoom:0,maxzoom:22}]}},i=Object.keys(n);e.exports={requiredVersion:"1.10.1",styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",styleValuesMapbox:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],styleValueDflt:"basic",stylesNonMapbox:n,styleValuesNonMapbox:i,traceLayerPrefix:"plotly-trace-layer-",layoutLayerPrefix:"plotly-layout-layer-",wrongVersionErrorMsg:["Your custom plotly.js bundle is not using the correct mapbox-gl version","Please install mapbox-gl@1.10.1."].join("\n"),noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.plot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join("\n"),missingStyleErrorMsg:["No valid mapbox style found, please set `mapbox.style` to one of:",i.join(", "),"or register a Mapbox access token to use a Mapbox-served style."].join("\n"),multipleTokensErrorMsg:["Set multiple mapbox access token across different mapbox subplot,","using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join("\n"),mapOnErrorMsg:"Mapbox error.",mapboxLogo:{path0:"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z",path1:"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z",path2:"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z",polygon:"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34"},styleRules:{map:"overflow:hidden;position:relative;","missing-css":"display:none;",canary:"background-color:salmon;","ctrl-bottom-left":"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;","ctrl-bottom-right":"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;",ctrl:"clear: both; pointer-events: auto; transform: translate(0, 0);","ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner":"display: none;","ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner":"display: block; margin-top:2px","ctrl-attrib.mapboxgl-compact:hover":"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;","ctrl-attrib.mapboxgl-compact::after":'content: ""; cursor: pointer; position: absolute; background-image: url(\'data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath fill="%23333333" fill-rule="evenodd" d="M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0"/%3E %3C/svg%3E\'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;',"ctrl-attrib.mapboxgl-compact":"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;","ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; right: 0","ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; left: 0","ctrl-bottom-left .mapboxgl-ctrl":"margin: 0 0 10px 10px; float: left;","ctrl-bottom-right .mapboxgl-ctrl":"margin: 0 10px 10px 0; float: right;","ctrl-attrib":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a:hover":"color: inherit; text-decoration: underline;","ctrl-attrib .mapbox-improve-map":"font-weight: bold; margin-left: 2px;","attrib-empty":"display: none;","ctrl-logo":'display:block; width: 21px; height: 21px; background-image: url(\'data:image/svg+xml;charset=utf-8,%3C?xml version="1.0" encoding="utf-8"?%3E %3Csvg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve"%3E%3Cg transform="translate(0,0.01)"%3E%3Cpath d="m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z" style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3Cpath d="M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpath d="M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpolygon points="11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34 " style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3C/g%3E%3C/svg%3E\')'}}},{}],259:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r=t.split(" "),i=r[0],a=r[1],o=n.isArrayOrTypedArray(e)?n.mean(e):e,s=.5+o/100,l=1.5+o/100,u=["",""],c=[0,0];switch(i){case"top":u[0]="top",c[1]=-l;break;case"bottom":u[0]="bottom",c[1]=l}switch(a){case"left":u[1]="right",c[0]=-s;break;case"right":u[1]="left",c[0]=s}return{anchor:u[0]&&u[1]?u.join("-"):u[0]?u[0]:u[1]?u[1]:"center",offset:c}}},{"../../lib":181}],260:[function(t,e,r){"use strict";var n=t("mapbox-gl"),i=t("../../lib"),a=t("../../plots/get_data").getSubplotCalcData,o=t("../../constants/xmlns_namespaces"),s=t("d3"),l=t("../../components/drawing"),u=t("../../lib/svg_text_utils"),c=t("./mapbox"),p=r.constants=t("./constants");function h(t){return"string"==typeof t&&(-1!==p.styleValuesMapbox.indexOf(t)||0===t.indexOf("mapbox://"))}r.name="mapbox",r.attr="subplot",r.idRoot="mapbox",r.idRegex=r.attrRegex=i.counterRegex("mapbox"),r.attributes={subplot:{valType:"subplotid",dflt:"mapbox",editType:"calc"}},r.layoutAttributes=t("./layout_attributes"),r.supplyLayoutDefaults=t("./layout_defaults"),r.plot=function(t){var e=t._fullLayout,r=t.calcdata,o=e._subplots.mapbox;if(n.version!==p.requiredVersion)throw new Error(p.wrongVersionErrorMsg);var s=function(t,e){var r=t._fullLayout;if(""===t._context.mapboxAccessToken)return"";for(var n=[],a=[],o=!1,s=!1,l=0;l1&&i.warn(p.multipleTokensErrorMsg),n[0]):(a.length&&i.log(["Listed mapbox access token(s)",a.join(","),"but did not use a Mapbox map style, ignoring token(s)."].join(" ")),"")}(t,o);n.accessToken=s;for(var l=0;l_/2){var x=m.split("|").join("
");y.text(x).attr("data-unformatted",x).call(u.convertToTspans,t),v=l.bBox(y.node())}y.attr("transform","translate(-3, "+(8-v.height)+")"),g.insert("rect",".static-attribution").attr({x:-v.width-6,y:-v.height-3,width:v.width+6,height:v.height+3,fill:"rgba(255, 255, 255, 0.75)"});var b=1;v.width+6>_&&(b=_/(v.width+6));var w=[n.l+n.w*c.x[1],n.t+n.h*(1-c.y[0])];g.attr("transform","translate("+w[0]+","+w[1]+") scale("+b+")")}},r.updateFx=function(t){for(var e=t._fullLayout,r=e._subplots.mapbox,n=0;n0){for(var r=0;r0}function c(t){var e={},r={};switch(t.type){case"circle":n.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":n.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity,"line-dasharray":t.line.dash});break;case"fill":n.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var i=t.symbol,o=a(i.textposition,i.iconsize);n.extendFlat(e,{"icon-image":i.icon+"-15","icon-size":i.iconsize/10,"text-field":i.text,"text-size":i.textfont.size,"text-anchor":o.anchor,"text-offset":o.offset,"symbol-placement":i.placement}),n.extendFlat(r,{"icon-color":t.color,"text-color":i.textfont.color,"text-opacity":t.opacity});break;case"raster":n.extendFlat(r,{"raster-fade-duration":0,"raster-opacity":t.opacity})}return{layout:e,paint:r}}l.update=function(t){this.visible?this.needsNewImage(t)?this.updateImage(t):this.needsNewSource(t)?(this.removeLayer(),this.updateSource(t),this.updateLayer(t)):this.needsNewLayer(t)?this.updateLayer(t):this.updateStyle(t):(this.updateSource(t),this.updateLayer(t)),this.visible=u(t)},l.needsNewImage=function(t){return this.subplot.map.getSource(this.idSource)&&"image"===this.sourceType&&"image"===t.sourcetype&&(this.source!==t.source||JSON.stringify(this.coordinates)!==JSON.stringify(t.coordinates))},l.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},l.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},l.updateImage=function(t){this.subplot.map.getSource(this.idSource).updateImage({url:t.source,coordinates:t.coordinates})},l.updateSource=function(t){var e=this.subplot.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,u(t)){var r=function(t){var e,r=t.sourcetype,n=t.source,a={type:r};"geojson"===r?e="data":"vector"===r?e="string"==typeof n?"url":"tiles":"raster"===r?(e="tiles",a.tileSize=256):"image"===r&&(e="url",a.coordinates=t.coordinates);a[e]=n,t.sourceattribution&&(a.attribution=i(t.sourceattribution));return a}(t);e.addSource(this.idSource,r)}},l.updateLayer=function(t){var e,r=this.subplot,n=c(t),i=this.subplot.belowLookup["layout-"+this.index];if("traces"===i)for(var a=r.getMapLayers(),s=0;s1)for(r=0;r-1&&y(e.originalEvent,n,[r.xaxis],[r.yaxis],r.id,t),i.indexOf("event")>-1&&u.click(n,e.originalEvent)}}},b.updateFx=function(t){var e=this,r=e.map,n=e.gd;if(!e.isStatic){var a,o=t.dragmode;a=p(o)?function(t,r){(t.range={})[e.id]=[u([r.xmin,r.ymin]),u([r.xmax,r.ymax])]}:function(t,r,n){(t.lassoPoints={})[e.id]=n.filtered.map(u)};var s=e.dragOptions;e.dragOptions=i.extendDeep(s||{},{dragmode:t.dragmode,element:e.div,gd:n,plotinfo:{id:e.id,domain:t[e.id].domain,xaxis:e.xaxis,yaxis:e.yaxis,fillRangeItems:a},xaxes:[e.xaxis],yaxes:[e.yaxis],subplot:e.id}),r.off("click",e.onClickInPanHandler),f(o)||h(o)?(r.dragPan.disable(),r.on("zoomstart",e.clearSelect),e.dragOptions.prepFn=function(t,r,n){d(t,r,n,e.dragOptions,o)},l.init(e.dragOptions)):(r.dragPan.enable(),r.off("zoomstart",e.clearSelect),e.div.onmousedown=null,e.onClickInPanHandler=e.onClickInPanFn(e.dragOptions),r.on("click",e.onClickInPanHandler))}function u(t){var r=e.map.unproject(t);return[r.lng,r.lat]}},b.updateFramework=function(t){var e=t[this.id].domain,r=t._size,n=this.div.style;n.width=r.w*(e.x[1]-e.x[0])+"px",n.height=r.h*(e.y[1]-e.y[0])+"px",n.left=r.l+e.x[0]*r.w+"px",n.top=r.t+(1-e.y[1])*r.h+"px",this.xaxis._offset=r.l+e.x[0]*r.w,this.xaxis._length=r.w*(e.x[1]-e.x[0]),this.yaxis._offset=r.t+(1-e.y[1])*r.h,this.yaxis._length=r.h*(e.y[1]-e.y[0])},b.updateLayers=function(t){var e,r=t[this.id].layers,n=this.layerList;if(r.length!==n.length){for(e=0;e=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"),l=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(){_.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()&&l.text()?" - ":"")}},_.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var 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=_.graphJson(t,!1,"keepdata"),i.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(t,e){var r=t._context.locale,n=!1,i={};function a(t){for(var r=!0,a=0;a1&&D.length>1){for(o.getComponentMethod("grid","sizeDefaults")(c,l),s=0;s15&&D.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"),_.linkSubplots(h,l,p,a),_.cleanPlot(h,l,p,a);var N=!(!a._has||!a._has("gl2d")),U=!(!l._has||!l._has("gl2d")),j=!(!a._has||!a._has("cartesian"))||N,V=!(!l._has||!l._has("cartesian"))||U;j&&!V?a._bgLayer.remove():V&&!j&&(l._shouldCreateBgLayer=!0),a._zoomlayer&&!t._dragging&&f({_fullLayout:a}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var i=0;i0){var p=1-2*s;n=Math.round(p*n),i=Math.round(p*i)}}var h=_.layoutAttributes.width.min,f=_.layoutAttributes.height.min;n1,m=!e.height&&Math.abs(r.height-i)>1;(m||d)&&(d&&(r.width=n),m&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),_.sanitizeMargins(r)},_.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a,s,l=o.componentsRegistry,c=e._basePlotModules,p=o.subplotsRegistry.cartesian;for(i in l)(s=l[i]).includeBasePlot&&s.includeBasePlot(t,e);for(var h in c.length||c.push(p),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),p.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(u.subplotSort);for(a=0;a.5*n.width&&(u.log("Margin push",e,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(u.log("Margin push",e,"is too big in y, dropping"),r.b=r.t=0);var l=void 0!==r.xl?r.xl:r.x,c=void 0!==r.xr?r.xr:r.x,p=void 0!==r.yt?r.yt:r.y,h=void 0!==r.yb?r.yb:r.y;i[e]={l:{val:l,size:r.l+o},r:{val:c,size:r.r+o},b:{val:h,size:r.b+o},t:{val:p,size:r.t+o}},a[e]=1}else delete i[e],delete a[e];if(!n._replotting)return _.doAutoMargin(t)}},_.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),L(e);var r=e._size,n=e.margin,i=u.extendFlat({},r),s=n.l,l=n.r,c=n.t,p=n.b,h=e.width,f=e.height,d=e._pushmargin,m=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var g in d)m[g]||delete d[g];for(var y in d.base={l:{val:0,size:s},r:{val:1,size:l},t:{val:1,size:c},b:{val:0,size:p}},d){var v=d[y].l||{},x=d[y].b||{},b=v.val,w=v.size,T=x.val,k=x.size;for(var A in d){if(a(w)&&d[A].r){var M=d[A].r.val,S=d[A].r.size;if(M>b){var C=(w*M+(S-h)*b)/(M-b),E=(S*(1-b)+(w-h)*(1-M))/(M-b);C>=0&&E>=0&&h-(C+E)>0&&C+E>s+l&&(s=C,l=E)}}if(a(k)&&d[A].t){var z=d[A].t.val,I=d[A].t.size;if(z>T){var P=(k*z+(I-f)*T)/(z-T),D=(I*(1-T)+(k-f)*(1-z))/(z-T);P>=0&&D>=0&&f-(D+P)>0&&P+D>p+c&&(p=P,c=D)}}}}}if(r.l=Math.round(s),r.r=Math.round(l),r.t=Math.round(c),r.b=Math.round(p),r.p=Math.round(n.pad),r.w=Math.round(h)-r.l-r.r,r.h=Math.round(f)-r.t-r.b,!e._replotting&&_.didMarginChange(i,r)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var O=3*(1+Object.keys(m).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var a=0,s=0;function l(){return a++,function(){s++,n||s!==a||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(i)}}r.runFn(l),setTimeout(l())}))}],a=u.syncOrAsync(i,t);return a&&a.then||(a=Promise.resolve()),a.then((function(){return t}))}_.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},_.graphJson=function(t,e,r,n,i,a){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&_.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function c(t,e){if("function"==typeof t)return e?"_function_":null;if(u.isPlainObject(t)){var n,i={};return Object.keys(t).sort().forEach((function(a){if(-1===["_","["].indexOf(a.charAt(0)))if("function"!=typeof t[a]){if("keepdata"===r){if("src"===a.substr(a.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0&&!u.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0)return;i[a]=c(t[a],e)}else e&&(i[a]="_function")})),i}return Array.isArray(t)?t.map((function(t){return c(t,e)})):u.isTypedArray(t)?u.simpleMap(t,u.identity):u.isJSDate(t)?u.ms2DateTimeLocal(+t):t}var p={data:(o||[]).map((function(t){var r=c(t);return e&&delete r.fit,r}))};return e||(p.layout=c(s)),t.framework&&t.framework.isPolar&&(p=t.framework.getConfig()),l&&(p.frames=c(l)),a&&(p.config=c(t._context,!0)),"object"===n?p:JSON.stringify(p)},_.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;a--)if(s[a].enabled){r._indexToPoints=s[a]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:p,y:p}]),o[0].t||(o[0].t={}),o[0].trace=r,d[e]=o}}for(P(l,c,f),i=0;i=0?h.angularAxis.domain:n.extent(T),C=Math.abs(T[1]-T[0]);A&&!k&&(C=0);var L=S.slice();M&&k&&(L[1]+=C);var E=h.angularAxis.ticksCount||4;E>8&&(E=E/(E/8)+E%8),h.angularAxis.ticksStep&&(E=(L[1]-L[0])/E);var z=h.angularAxis.ticksStep||(L[1]-L[0])/(E*(h.minorTicks+1));w&&(z=Math.max(Math.round(z),1)),L[2]||(L[2]=z);var I=n.range.apply(this,L);if(I=I.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=M?C:0,"undefined"==typeof(t=n.select(this).select("svg.chart-root"))||t.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),D=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));t=n.select(D)}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 O,R=t.select(".chart-group"),F={fill:"none",stroke:h.tickColor},B={"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){O=t.select(".legend-group").attr({transform:"translate("+[_,h.margin.top]+")"}).style({display:"block"});var N=f.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:f.map((function(t,e){return t.name||"Element"+e})),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:O,elements:N,reverseOrder:h.legend.reverseOrder})})();var U=O.node().getBBox();_=Math.min(h.width-U.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,_=Math.max(10,_),b=[h.margin.left+_,h.margin.top+_],r.range([0,_]),c.layout.radialAxis.domain=r.domain(),O.attr("transform","translate("+[b[0]+_,b[1]-_]+")")}else O=t.select(".legend-group").style({display:"none"});t.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),R.attr("transform","translate("+b+")").style({cursor:"crosshair"});var j=[(h.width-(h.margin.left+h.margin.right+2*_+(U?U.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*_))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),t.select(".outer-group").attr("transform","translate("+j+")"),h.title&&h.title.text){var V=t.select("g.title-group text").style(B).text(h.title.text),q=V.node().getBBox();V.attr({x:b[0]-q.width/2,y:b[1]-_-20})}var H=t.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var Z=H.selectAll("circle.grid-circle").data(r.ticks(5));Z.enter().append("circle").attr({class:"grid-circle"}).style(F),Z.attr("r",r),Z.exit().remove()}H.select("circle.outside-circle").attr({r:_}).style(F);var G=t.select("circle.background-circle").attr({r:_}).style({fill:h.backgroundColor,stroke:h.stroke});function X(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var W=n.svg.axis().scale(r).ticks(5).tickSize(5);H.call(W).attr({transform:"rotate("+h.radialAxis.orientation+")"}),H.selectAll(".domain").style(F),H.selectAll("g>text").text((function(t,e){return this.textContent+h.radialAxis.ticksSuffix})).style(B).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,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),H.selectAll("g>line").style({stroke:"black"})}var Y=t.select(".angular.axis-group").selectAll("g.angular-tick").data(I),K=Y.enter().append("g").classed("angular-tick",!0);Y.attr({transform:function(t,e){return"rotate("+X(t)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Y.exit().remove(),K.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(F),K.selectAll(".minor").style({stroke:h.minorTickColor}),Y.select("line.grid-line").attr({x1:h.tickLength?_-h.tickLength:0,x2:_}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(B);var J=Y.select("text.axis-text").attr({x:_+h.labelOffset,dy:a+"em",transform:function(t,e){var r=X(t),n=_+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(B);h.angularAxis.rewriteTicks&&J.text((function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)}));var Q=n.max(R.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));O.attr({transform:"translate("+[_+Q,h.margin.top]+")"});var $=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(f);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),f[0]||$){var et=[];f.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(!k){var pt=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",(function(t,e){var r=o.util.getMousePos(G).angle;pt.attr({x2:-_,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(_+12,r+180);lt.text(o.util.round(it)).move([i[0]+b[0],i[1]+b[1]])})).on("mouseout.angular-guide",(function(t,e){ot.select("line").style({opacity:0})}))}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",(function(t,e){var n=o.util.getMousePos(G).radius;ht.attr({r:n}).style({opacity:.5}),at=r.invert(o.util.getMousePos(G).radius);var i=o.util.convertToCartesian(n,h.radialAxis.orientation);ut.text(o.util.round(at)).move([i[0]+b[0],i[1]+b[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])};k&&(u.t=w[e[0]]);var c="t: "+u.t+", r: "+u.r,p=this.getBoundingClientRect(),h=t.node().getBoundingClientRect(),f=[p.left+p.width/2-j[0]-h.left,p.top+p.height/2-j[1]-h.top];ct.config({color:s}).text(c),ct.move(f)}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,p,"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 d.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return d.stroke(r,i,a)},"stroke-width":function(t,e){return d["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return d["stroke-dasharray"](r,i,a)},opacity:function(t,e){return d.opacity(r,i,a)},display:function(t,e){return d.display(r,i,a)}})}};var p=e.angularScale.range(),h=Math.abs(p[1]-p[0])/o[0].length*Math.PI/180,f=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:f,transform:function(t,r){return"rotate("+(e.orientation+s(t[0])+90)+")"}})};var d={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"}},m=n.select(this).selectAll("g.layer").data(o);m.enter().append("g").attr({class:"layer"});var g=m.selectAll("path.mark").data((function(t,e){return t}));g.enter().append("path").attr({class:"mark"}),g.style(d).each(u[e.geometryType]),g.exit().remove(),m.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,p=c?e.height:u*o.length,h=s.classed("legend-group",!0).selectAll("svg").data([0]),f=h.enter().append("svg").attr({width:300,height:p+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});f.append("g").classed("legend-axis",!0),f.append("g").classed("legend-marks",!0);var d=n.range(o.length),m=n.scale[c?"linear":"ordinal"]().domain(d).range(l),g=n.scale[c?"linear":"ordinal"]().domain(d)[c?"range":"rangePoints"]([0,p]);if(c){var y=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);y.enter().append("stop"),y.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 v=h.select(".legend-marks").selectAll("path.legend-mark").data(o);v.enter().append("path").classed("legend-mark",!0),v.attr({transform:function(t,e){return"translate("+[u/2,g(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 m(e)}}),v.exit().remove()}var _=n.svg.axis().scale(g).orient("right"),x=h.select("g.legend-axis").attr({transform:"translate("+[c?e.colorBandWidth:u,u/2]+")"}).call(_);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",p=i||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(p);var h=a.padding,f=e.node().getBBox(),d={fill:a.color,stroke:s,"stroke-width":"2px"},m=f.width+2*h+l,g=f.height+2*h;return r.attr({d:"M"+[[l,-g/2],[l,-g/4],[a.hasTick?0:l,0],[l,g/4],[l,g/2],[m,g/2],[m,-g/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[l,-g/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":155,"../../../lib":181,d3:16}],271:[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,p=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,p.add({undo:function(){n&&i(n)},redo:function(){i(t)}}),r=o.util.cloneJson(a)},h.undo=function(){p.undo()},h.redo=function(){p.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":53,"../../../lib":181,"./micropolar":270,"./undo_manager":272,d3:16}],272:[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||(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 r0){for(var n=[],i=0;i-1&&(p[f[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),i.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":53,"../components/drawing":75,"../constants/xmlns_namespaces":159,"../lib":181,d3:16}],284:[function(t,e,r){"use strict";var n=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../scattergeo/attributes"),a=t("../../components/colorscale/attributes"),o=t("../../plots/attributes"),s=t("../../components/color/attributes").defaultLine,l=t("../../lib/extend").extendFlat,u=i.marker.line;e.exports=l({locations:{valType:"data_array",editType:"calc"},locationmode:i.locationmode,z:{valType:"data_array",editType:"calc"},geojson:l({},i.geojson,{}),featureidkey:i.featureidkey,text:l({},i.text,{}),hovertext:l({},i.hovertext,{}),marker:{line:{color:l({},u.color,{dflt:s}),width:l({},u.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:i.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:i.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:l({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]}),hovertemplate:n(),showlegend:l({},o.showlegend,{dflt:!1})},a("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/color/attributes":52,"../../components/colorscale/attributes":60,"../../lib/extend":173,"../../plots/attributes":222,"../../plots/template_attributes":274,"../scattergeo/attributes":333}],285:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../constants/numerical").BADNUM,a=t("../../components/colorscale/calc"),o=t("../scatter/arrays_to_calcdata"),s=t("../scatter/calc_selection");function l(t){return t&&"string"==typeof t}e.exports=function(t,e){var r,u=e._length,c=new Array(u);r=e.geojson?function(t){return l(t)||n(t)}:l;for(var p=0;p")}(t,p,o,h.mockAxis),[t]}},{"../../lib":181,"../../plots/cartesian/axes":225,"./attributes":284}],288:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[];if(!1===e)for(r=0;r=0;n--){var i=r[n].id;if("string"==typeof i&&0===i.indexOf("water"))for(var a=n+1;a=0;r--)t.removeLayer(e[r][1])},s.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},e.exports=function(t,e){var r=e[0].trace,i=new o(t,r.uid),a=i.sourceId,s=n(e),l=i.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(a,{type:"geojson",data:s.geojson}),i._addLayers(s,l),e[0].trace._glTrace=i,i}},{"../../plots/mapbox/constants":258,"./convert":290}],294:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../../plots/attributes"),o=t("../scattermapbox/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s({lon:o.lon,lat:o.lat,z:{valType:"data_array",editType:"calc"},radius:{valType:"number",editType:"plot",arrayOk:!0,min:1,dflt:30},below:{valType:"string",editType:"plot"},text:o.text,hovertext:o.hovertext,hoverinfo:s({},a.hoverinfo,{flags:["lon","lat","z","text","name"]}),hovertemplate:i(),showlegend:s({},a.showlegend,{dflt:!1})},n("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/colorscale/attributes":60,"../../lib/extend":173,"../../plots/attributes":222,"../../plots/template_attributes":274,"../scattermapbox/attributes":335}],295:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").isArrayOrTypedArray,a=t("../../constants/numerical").BADNUM,o=t("../../components/colorscale/calc"),s=t("../../lib")._;e.exports=function(t,e){for(var r=e._length,l=new Array(r),u=e.z,c=i(u)&&u.length,p=0;p0?+f[c]:0),p.push({type:"Feature",geometry:{type:"Point",coordinates:y},properties:v})}}var x=o.extractOpts(e),b=x.reversescale?o.flipScale(x.colorscale):x.colorscale,w=b[0][1],T=["interpolate",["linear"],["heatmap-density"],0,a.opacity(w)<1?w:a.addOpacity(w,0)];for(c=1;c")}(u,c,l[0].t.labels),[s]}}},{"../../lib":181,"../../plots/cartesian/axes":225,"../scattermapbox/hover":340}],300:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../heatmap/colorbar"),formatLabels:t("../scattermapbox/format_labels"),calc:t("./calc"),plot:t("./plot"),hoverPoints:t("./hover"),eventData:t("./event_data"),getBelow:function(t,e){for(var r=e.getMapLayers(),n=0;n=0;r--)t.removeLayer(e[r][1])},o.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},e.exports=function(t,e){var r=e[0].trace,i=new a(t,r.uid),o=i.sourceId,s=n(e),l=i.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(o,{type:"geojson",data:s.geojson}),i._addLayers(s,l),i}},{"../../plots/mapbox/constants":258,"./convert":296}],302:[function(t,e,r){"use strict";e.exports={min:"zmin",max:"zmax"}},{}],303:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;rs&&A[g].gap;)g--;for(v=A[g].s,d=A.length-1;d>g;d--)A[d].s=v;for(;sM[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}}}}}},{}],313:[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"),p=t("./line_defaults"),h=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults");e.exports=function(t,e,r,m){function g(r,i){return n.coerce(t,e,a,r,i)}var y=l(t,e,m,g);if(y||(e.visible=!1),e.visible){var v=u(t,e,m,g),_=!v&&yZ!=(F=I[E][1])>=Z&&(D=I[E-1][0],O=I[E][0],F-R&&(P=D+(O-D)*(Z-R)/(F-R),j=Math.min(j,P),V=Math.max(V,P)));j=Math.max(j,0),V=Math.min(V,h._length);var G=s.defaultLine;return s.opacity(p.fillcolor)?G=p.fillcolor:s.opacity((p.line||{}).color)&&(G=p.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:j,x1:V,y0:Z,y1:Z,color:G,hovertemplate:!1}),delete t.index,p.text&&!Array.isArray(p.text)?t.text=String(p.text):t.text=p.name,[t]}}}},{"../../components/color":53,"../../components/fx":93,"../../lib":181,"../../registry":275,"./get_trace_color":316}],318:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":238,"./arrays_to_calcdata":305,"./attributes":306,"./calc":307,"./cross_trace_calc":311,"./cross_trace_defaults":312,"./defaults":313,"./format_labels":315,"./hover":317,"./marker_colorbar":324,"./plot":326,"./select":327,"./style":329,"./subtypes":330}],319:[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":63,"../../components/colorscale/helpers":64,"../../lib":181}],320:[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,p=t("./constants");e.exports=function(t,e){var r,n,a,h,f,d,m,g,y,v,_,x,b,w,T,k,A,M,S=e.xaxis,C=e.yaxis,L="log"===S.type,E="log"===C.type,z=S._length,I=C._length,P=e.connectGaps,D=e.baseTolerance,O=e.shape,R="linear"===O,F=e.fill&&"none"!==e.fill,B=[],N=p.minTolerance,U=t.length,j=new Array(U),V=0;function q(r){var n=t[r];if(!n)return!1;var a=e.linearized?S.l2p(n.x):S.c2p(n.x),l=e.linearized?C.l2p(n.y):C.c2p(n.y);if(a===i){if(L&&(a=S.c2p(n.x,!0)),a===i)return!1;E&&l===i&&(a*=Math.abs(S._m*I*(S._m>0?o:s)/(C._m*z*(C._m>0?o:s)))),a*=1e3}if(l===i){if(E&&(l=C.c2p(n.y,!0)),l===i)return!1;l*=1e3}return[a,l]}function H(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===j[V-1][0],i=r===j[V-1][1];if(!n||!i)if(V>1){var a=e===j[V-2][0],o=r===j[V-2][1];n&&(e===et||e===rt)&&a?o?V--:j[V-1]=t:i&&(r===nt||r===it)&&o?a?V--:j[V-1]=t:j[V++]=t}else j[V++]=t}function ct(t){j[V-1][0]!==t[0]&&j[V-1][1]!==t[1]&&ut([Y,K]),ut(t),J=null,Y=K=0}function pt(t){if(A=t[0]/z,M=t[1]/I,X=t[0]rt?rt:0,W=t[1]it?it:0,X||W){if(V)if(J){var e=$(J,t);e.length>1&&(ct(e[0]),j[V++]=e[1])}else Q=$(j[V-1],t)[0],j[V++]=Q;else j[V++]=[X||t[0],W||t[1]];var r=j[V-1];X&&W&&(r[0]!==X||r[1]!==W)?(J&&(Y!==X&&K!==W?ut(Y&&K?(n=J,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]):[Y||X,K||W]):Y&&K&&ut([Y,K])),ut([X,W])):Y-X&&K-W&&ut([X||Y,W||K]),J=t,Y=X,K=W}else J&&ct($(J,t)[0]),j[V++]=t;var n,i,a,o}for("linear"===O||"spline"===O?$=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&&G(o,t)Z(d,ht))break;a=d,(b=y[0]*g[0]+y[1]*g[1])>_?(_=b,h=d,m=!1):b=t.length||!d)break;pt(d),n=d}}else pt(h)}J&&ut([Y||J[0],K||J[1]]),B.push(j.slice(0,V))}return B}},{"../../constants/numerical":158,"../../lib":181,"./constants":310}],321:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],322:[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,p=-1,h=0,f=-1;for(a=0;a=0?l=f:(l=f=h,h++),l0?Math.max(e,i):0}}},{"fast-isnumeric":18}],324:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],325:[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),p=(t.line||{}).color;(u=u||{},p&&(r=p),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",p&&!Array.isArray(p)&&e.marker.color!==p?p: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":53,"../../components/colorscale/defaults":63,"../../components/colorscale/helpers":64,"./subtypes":330}],326:[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"),p=t("./link_traces"),h=t("../../lib/polygon").tester;function f(t,e,r,p,f,d,m){var g;!function(t,e,r,i,o){var s=r.xaxis,l=r.yaxis,c=n.extent(a.simpleMap(s.range,s.r2c)),p=n.extent(a.simpleMap(l.range,l.r2c)),h=i[0].trace;if(!u.hasMarkers(h))return;var f=h.marker.maxdisplayed;if(0===f)return;var d=i.filter((function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=p[0]&&t.y<=p[1]})),m=Math.ceil(d.length/f),g=0;o.forEach((function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function v(t){return y?t.transition():t}var _=r.xaxis,x=r.yaxis,b=p[0].trace,w=b.line,T=n.select(d),k=o(T,"g","errorbars"),A=o(T,"g","lines"),M=o(T,"g","points"),S=o(T,"g","text");if(i.getComponentMethod("errorbars","plot")(t,k,r,m),!0===b.visible){var C,L;v(T).style("opacity",b.opacity);var E=b.fill.charAt(b.fill.length-1);"x"!==E&&"y"!==E&&(E=""),p[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var z,I,P="",D=[],O=b._prevtrace;O&&(P=O._prevRevpath||"",L=O._nextFill,D=O._polygons);var R,F,B,N,U,j,V,q="",H="",Z=[],G=a.noop;if(C=b._ownFill,u.hasLines(b)||"none"!==b.fill){for(L&&L.datum(p),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(R=l.steps(w.shape),F=l.steps(w.shape.split("").reverse().join(""))):R=F="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")},B=function(t){return F(t.reverse())},Z=c(p,{xaxis:_,yaxis:x,connectGaps:b.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:b.fill}),V=b._polygons=new Array(Z.length),g=0;g1){var r=n.select(this);if(r.datum(p),t)v(r.style("opacity",0).attr("d",z).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",z),l.singleLineStyle(p,i)}}}}}var X=A.selectAll(".js-line").data(Z);v(X.exit()).style("opacity",0).remove(),X.each(G(!1)),X.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(G(!0)),l.setClipUrl(X,r.layerClipId,t),Z.length?(C?(C.datum(p),N&&j&&(E?("y"===E?N[1]=j[1]=x.c2p(0,!0):"x"===E&&(N[0]=j[0]=_.c2p(0,!0)),v(C).attr("d","M"+j+"L"+N+"L"+q.substr(1)).call(l.singleFillStyle)):v(C).attr("d",q+"Z").call(l.singleFillStyle))):L&&("tonext"===b.fill.substr(0,6)&&q&&P?("tonext"===b.fill?v(L).attr("d",q+"Z"+P+"Z").call(l.singleFillStyle):v(L).attr("d",q+"L"+P.substr(1)+"Z").call(l.singleFillStyle),b._polygons=b._polygons.concat(D)):(Y(L),b._polygons=null)),b._prevRevpath=H,b._prevPolygons=V):(C?Y(C):L&&Y(L),b._polygons=b._prevRevpath=b._prevPolygons=null),M.datum(p),S.datum(p),function(e,i,a){var o,c=a[0].trace,p=u.hasMarkers(c),h=u.hasText(c),f=tt(c),d=et,m=et;if(p||h){var g=s,b=c.stackgroup,w=b&&"infer zero"===t._fullLayout._scatterStackOpts[_._id+x._id][b].stackgaps;c.marker.maxdisplayed||c._needsCull?g=w?J:K:b&&!w&&(g=Q),p&&(d=g),h&&(m=g)}var T,k=(o=e.selectAll("path.point").data(d,f)).enter().append("path").classed("point",!0);y&&k.call(l.pointStyle,c,t).call(l.translatePoints,_,x).style("opacity",0).transition().style("opacity",1),o.order(),p&&(T=l.makePointStyleFns(c)),o.each((function(e){var i=n.select(this),a=v(i);l.translatePoint(e,a,_,x)?(l.singlePointStyle(e,a,c,T,t),r.layerClipId&&l.hideOutsideRangePoint(e,a,_,x,c.xcalendar,c.ycalendar),c.customdata&&i.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()})),y?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=i.selectAll("g").data(m,f)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(t){var e=n.select(this),i=v(e.select("text"));l.translatePoint(t,i,_,x)?r.layerClipId&&l.hideOutsideRangePoint(t,e,_,x,c.xcalendar,c.ycalendar):e.remove()})),o.selectAll("text").call(l.textPointStyle,c,t).each((function(t){var e=_.c2p(t.x),r=x.c2p(t.y);n.select(this).selectAll("tspan.line").each((function(){v(n.select(this)).attr({x:e,y:r})}))})),o.exit().remove()}(M,S,p);var W=!1===b.cliponaxis?null:r.layerClipId;l.setClipUrl(M,W,t),l.setClipUrl(S,W,t)}function Y(t){v(t).attr("d","M0,0Z")}function K(t){return t.filter((function(t){return!t.gap&&t.vis}))}function J(t){return t.filter((function(t){return t.vis}))}function Q(t){return t.filter((function(t){return!t.gap}))}function $(t){return t.id}function tt(t){if(t.ids)return $}function et(){return!1}}e.exports=function(t,e,r,i,a,u){var c,h,d=!a,m=!!a&&a.duration>0,g=p(t,e,r);((c=i.selectAll("g.trace").data(g,(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),m)?(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){f(t,n,e,r,g,this,a)}))}))):c.each((function(r,n){f(t,n,e,r,g,this,a)}));d&&c.exit().remove(),i.selectAll("path:not([d])").remove()}},{"../../components/drawing":75,"../../lib":181,"../../lib/polygon":193,"../../registry":275,"./line_points":320,"./link_traces":322,"./subtypes":330,d3:16}],327:[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=[],p=s[0].trace;if(!n.hasMarkers(p)&&!n.hasText(p))return[];if(!1===e)for(r=0;r=0?Math.floor((e+180)/360):Math.ceil((e-180)/360)),d=e-f;if(n.getClosest(l,(function(t){var e=t.lonlat;if(e[0]===s)return 1/0;var n=i.modHalf(e[0],360),a=e[1],o=h.project([n,a]),l=o.x-c.c2p([d,a]),u=o.y-p.c2p([n,r]),f=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(l*l+u*u)-f,1-3/f)}),t),!1!==t.index){var m=l[t.index],g=m.lonlat,y=[i.modHalf(g[0],360)+f,g[1]],v=c.c2p(y),_=p.c2p(y),x=m.mrc||1;t.x0=v-x,t.x1=v+x,t.y0=_-x,t.y1=_+x;var b={};b[u.subplot]={_subplot:h};var w=u._module.formatLabels(m,u,b);return t.lonLabel=w.lonLabel,t.latLabel=w.latLabel,t.color=a(u,m),t.extraText=function(t,e,r){if(t.hovertemplate)return;var n=(e.hi||t.hoverinfo).split("+"),i=-1!==n.indexOf("all"),a=-1!==n.indexOf("lon"),s=-1!==n.indexOf("lat"),l=e.lonlat,u=[];function c(t){return t+"\xb0"}i||a&&s?u.push("("+c(l[0])+", "+c(l[1])+")"):a?u.push(r.lon+c(l[0])):s&&u.push(r.lat+c(l[1]));(i||-1!==n.indexOf("text"))&&o(e,t,u);return u.join("
")}(u,m,l[0].t.labels),t.hovertemplate=u.hovertemplate,[t]}}},{"../../components/fx":93,"../../constants/numerical":158,"../../lib":181,"../scatter/get_trace_color":316}],341:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("../scattergeo/calc"),plot:t("./plot"),hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),styleOnSelect:function(t,e){e&&e[0].trace._glTrace.update(e)},moduleType:"trace",name:"scattermapbox",basePlotModule:t("../../plots/mapbox"),categories:["mapbox","gl","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/mapbox":260,"../scatter/marker_colorbar":324,"../scattergeo/calc":334,"./attributes":335,"./defaults":337,"./event_data":338,"./format_labels":339,"./hover":340,"./plot":342,"./select":343}],342:[function(t,e,r){"use strict";var n=t("./convert"),i=t("../../plots/mapbox/constants").traceLayerPrefix,a=["fill","line","circle","symbol"];function o(t,e){this.type="scattermapbox",this.subplot=t,this.uid=e,this.sourceIds={fill:"source-"+e+"-fill",line:"source-"+e+"-line",circle:"source-"+e+"-circle",symbol:"source-"+e+"-symbol"},this.layerIds={fill:i+e+"-fill",line:i+e+"-line",circle:i+e+"-circle",symbol:i+e+"-symbol"},this.below=null}var s=o.prototype;s.addSource=function(t,e){this.subplot.map.addSource(this.sourceIds[t],{type:"geojson",data:e.geojson})},s.setSourceData=function(t,e){this.subplot.map.getSource(this.sourceIds[t]).setData(e.geojson)},s.addLayer=function(t,e,r){this.subplot.addLayer({type:t,id:this.layerIds[t],source:this.sourceIds[t],layout:e.layout,paint:e.paint},r)},s.update=function(t){var e,r,i,o=this.subplot,s=o.map,l=n(o.gd,t),u=o.belowLookup["trace-"+this.uid];if(u!==this.below){for(e=a.length-1;e>=0;e--)r=a[e],s.removeLayer(this.layerIds[r]);for(e=0;e=0;e--){var r=a[e];t.removeLayer(this.layerIds[r]),t.removeSource(this.sourceIds[r])}},e.exports=function(t,e){for(var r=e[0].trace,i=new o(t,r.uid),s=n(t.gd,e),l=i.below=t.belowLookup["trace-"+r.uid],u=0;u=-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}},{}],59:[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 p=e.linesIntersect(o,s,u,c);if(!1===p){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),f=e.pointsSame(s,c);if(h&&f)return n;var d=!h&&e.pointBetween(o,u,c),m=!f&&e.pointBetween(s,u,c);if(h)return m?l(n,s):l(t,c),n;d&&(f||(m?l(n,s):l(t,c)),l(n,o))}else 0===p.alongA&&(-1===p.alongB?l(t,u):0===p.alongB?l(t,p.pt):1===p.alongB&&l(t,c)),0===p.alongB&&(-1===p.alongA?l(n,o):0===p.alongA?l(n,p.pt):1===p.alongA&&l(n,s));return!1}for(var p=[];!a.isEmpty();){var h=a.getHead();if(r&&r.vert(h.pt[0]),h.isStart){r&&r.segmentNew(h.seg,h.primary);var f=u(h),d=f.before?f.before.ev:null,m=f.after?f.after.ev:null;function y(){if(d){var t=c(h,d);if(t)return t}return!!m&&c(h,m)}r&&r.tempStatus(h.seg,!!d&&d.seg,!!m&&m.seg);var g,v=y();if(v){var _;if(t)(_=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(v.seg.myFill.above=!v.seg.myFill.above);else v.seg.otherFill=h.seg.myFill;r&&r.segmentUpdate(v.seg),h.other.remove(),h.remove()}if(a.getHead()!==h){r&&r.rewind(h.seg);continue}if(t)_=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below,h.seg.myFill.below=m?m.seg.myFill.above:i,h.seg.myFill.above=_?!h.seg.myFill.below:h.seg.myFill.below;else if(null===h.seg.otherFill)g=m?h.primary===m.primary?m.seg.otherFill.above:m.seg.myFill.above:h.primary?o:i,h.seg.otherFill={above:g,below:g};r&&r.status(h.seg,!!d&&d.seg,!!m&&m.seg),h.other.status=f.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 b=h.seg.myFill;h.seg.myFill=h.seg.otherFill,h.seg.otherFill=b}p.push(h.seg)}a.getHead().remove()}return r&&r.done(),p}return t?{addRegion:function(t){for(var n,i,a,o=t[t.length-1],l=0;l1)for(var r=1;r1&&(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=E(t,360),e=E(e,100),r=E(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),p=!0,h="hsl"),e.hasOwnProperty("a")&&(a=e.a));var f,d,m;return a=L(a),{ok:p,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=E(t,255),e=E(e,255),r=E(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 M(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=p(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=p(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(O(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*E(this._r,255))+"%",g:a(100*E(this._g,255))+"%",b:a(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*E(this._r,255))+"%, "+a(100*E(this._g,255))+"%, "+a(100*E(this._b,255))+"%)":"rgba("+a(100*E(this._r,255))+"%, "+a(100*E(this._g,255))+"%, "+a(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(C[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=u(t);r="#"+f(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(g,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(_,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(m,arguments)},greyscale:function(){return this._applyModification(y,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(A,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,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]:D(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 S=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"},C=u.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(S);function L(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(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 I(t){return o(1,s(0,t))}function z(t){return parseInt(t,16)}function P(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function O(e){return t.round(255*parseFloat(e)).toString(16)}function R(t){return z(t)/255}var F,B,N,U=(B="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",N="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+B),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+B),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+B),hsva:new RegExp("hsva"+N),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 j(t){return!!U.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=u:window.tinycolor=u}(Math)},{}],66:[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}]},{}],67:[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;t("../../constants/axis_placeable_objects");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"}}})},{"../../constants/axis_placeable_objects":185,"../../plot_api/plot_template":245,"../../plots/cartesian/constants":262,"../../plots/font_attributes":284,"./arrow_paths":66}],68:[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),a=i.getRefType(e.xref),o=i.getRefType(e.yref);e._extremes={},"range"===a&&s(e,r),"range"===o&&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"],p=t["_"+a+"padminus"],h={x:1,y:-1}[a]*t[a+"shift"],f=3*t.arrowsize*t.arrowwidth||0,d=f+h,m=f-h,y=3*t.startarrowsize*t.arrowwidth||0,g=y+h,v=y-h;if(u===l){var _=i.findExtremes(e,[e.r2c(o)],{ppadplus:d,ppadminus:m}),x=i.findExtremes(e,[e.r2c(s)],{ppadplus:Math.max(c,g),ppadminus:Math.max(p,v)});r={min:[_.min[0],x.min[0]],max:[_.max[0],x.max[0]]}}else g=s?g+s:g,v=s?v-s:v,r=i.findExtremes(e,[e.r2c(o)],{ppadplus:Math.max(c,d,g),ppadminus:Math.max(p,m,v)});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":211,"../../plots/cartesian/axes":256,"./draw":73}],69:[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,p=[],h=[],f=[],d=(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),p={},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 X=!1,W=["x","y"],Y=0;Y1)&&(nt===rt?((ft=it.r2fraction(e["a"+et]))<0||ft>1)&&(X=!0):X=!0),K=it._offset+it.r2p(e[et]),$=.5}else{var dt="domain"===ht;"x"===et?(Q=e[et],K=dt?it._offset+it._length*Q:K=T.l+T.w*Q):(Q=1-e[et],K=dt?it._offset+it._length*Q:K=T.t+T.h*Q),$=e.showarrow?.5:Q}if(e.showarrow){pt.head=K;var mt=e["a"+et];if(tt=ot*H(.5,e.xanchor)-st*H(.5,e.yanchor),nt===rt){var yt=l.getRefType(nt);"domain"===yt?("y"===et&&(mt=1-mt),pt.tail=it._offset+it._length*mt):"paper"===yt?"y"===et?(mt=1-mt,pt.tail=T.t+T.h*mt):pt.tail=T.l+T.w*mt:pt.tail=it._offset+it.r2p(mt),J=tt}else pt.tail=K+mt,J=tt+mt;pt.text=pt.tail+tt;var gt=w["x"===et?"width":"height"];if("paper"===rt&&(pt.head=o.constrain(pt.head,1,gt-1)),"pixel"===nt){var vt=-Math.max(pt.tail-3,pt.text),_t=Math.min(pt.tail+3,pt.text)-gt;vt>0?(pt.tail+=vt,pt.text+=vt):_t>0&&(pt.tail-=_t,pt.text-=_t)}pt.tail+=ct,pt.head+=ct}else J=tt=lt*H($,ut),pt.text=K+tt;pt.text+=ct,tt+=ct,J+=ct,e["_"+et+"padplus"]=lt/2+J,e["_"+et+"padminus"]=lt/2-J,e["_"+et+"size"]=lt,e["_"+et+"shift"]=tt}if(X)R.remove();else{var xt=0,bt=0;if("left"!==e.align&&(xt=(A-x)*("center"===e.align?.5:1)),"top"!==e.valign&&(bt=(O-b)*("middle"===e.valign?.5:1)),p)n.select("svg").attr({x:N+xt-1,y:N+bt}).call(c.setClipUrl,j?L:null,t);else{var wt=N+bt-m.top,Tt=N+xt-m.left;Z.call(h.positionText,Tt,wt).call(c.setClipUrl,j?L:null,t)}V.select("rect").call(c.setRect,N,N,A,O),U.call(c.setRect,F/2,F/2,B-F,q-F),R.call(c.setTranslate,Math.round(E.x.text-B/2),Math.round(E.y.text-q/2)),P.attr({transform:"rotate("+I+","+E.x.text+","+E.y.text+")"});var kt,At=function(r,n){z.selectAll(".annotation-arrow-g").remove();var l=E.x.head,p=E.y.head,h=E.x.tail+r,f=E.y.tail+n,m=E.x.text+r,x=E.y.text+n,b=o.rotationXYMatrix(I,m,x),w=o.apply2DTransform(b),A=o.apply2DTransform2(b),L=+U.attr("width"),D=+U.attr("height"),O=m-.5*L,F=O+L,B=x-.5*D,N=B+D,j=[[O,B,O,N],[O,N,F,N],[F,N,F,B],[F,B,O,B]].map(A);if(!j.reduce((function(t,e){return t^!!o.segmentsIntersect(l,p,l+1e6,p+1e6,e[0],e[1],e[2],e[3])}),!1)){j.forEach((function(t){var e=o.segmentsIntersect(h,f,l,p,t[0],t[1],t[2],t[3]);e&&(h=e.x,f=e.y)}));var V=e.arrowwidth,q=e.arrowcolor,H=e.arrowside,Z=z.append("g").style({opacity:u.opacity(q)}).classed("annotation-arrow-g",!0),G=Z.append("path").attr("d","M"+h+","+f+"L"+l+","+p).style("stroke-width",V+"px").call(u.stroke,u.rgb(q));if(y(G,H,e),k.annotationPosition&&G.node().parentNode&&!a){var X=l,W=p;if(e.standoff){var Y=Math.sqrt(Math.pow(l-h,2)+Math.pow(p-f,2));X+=e.standoff*(h-l)/Y,W+=e.standoff*(f-p)/Y}var K,J,Q=Z.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-X)+","+(f-W),transform:s(X,W)}).style("stroke-width",V+6+"px").call(u.stroke,"rgba(0,0,0,0)").call(u.fill,"rgba(0,0,0,0)");d.init({element:Q.node(),gd:t,prepFn:function(){var t=c.getTranslate(R);K=t.x,J=t.y,g&&g.autorange&&M(g._name+".autorange",!0),_&&_.autorange&&M(_._name+".autorange",!0)},moveFn:function(t,r){var n=w(K,J),i=n[0]+t,a=n[1]+r;R.call(c.setTranslate,i,a),S("x",v(g,t,"x",T,e)),S("y",v(_,r,"y",T,e)),e.axref===e.xref&&S("ax",v(g,t,"ax",T,e)),e.ayref===e.yref&&S("ay",v(_,r,"ay",T,e)),Z.attr("transform",s(t,r)),P.attr({transform:"rotate("+I+","+i+","+a+")"})},doneFn:function(){i.call("_guiRelayout",t,C());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&At(0,0),D)d.init({element:R.node(),gd:t,prepFn:function(){kt=P.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?S("ax",v(g,t,"ax",T,e)):S("ax",e.ax+t),e.ayref===e.yref?S("ay",v(_,r,"ay",T.w,e)):S("ay",e.ay+r),At(t,r);else{if(a)return;var i,o;if(g)i=v(g,t,"x",T,e);else{var l=e._xsize/T.w,u=e.x+(e._xshift-e.xshift)/T.w-l/2;i=d.align(u+t/T.w,l,0,1,e.xanchor)}if(_)o=v(_,r,"y",T,e);else{var c=e._ysize/T.h,p=e.y-(e._yshift+e.yshift)/T.h-c/2;o=d.align(p-r/T.h,c,0,1,e.yanchor)}S("x",i),S("y",o),g&&_||(n=d.getCursor(g?.5:i,_?.5:o,e.xanchor,e.yanchor))}P.attr({transform:s(t,r)+kt}),f(R,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",G(n))},doneFn:function(){f(R),i.call("_guiRelayout",t,C());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,_=e.indexOf("end")>=0,x=d.backoff*y+r.standoff,b=m.backoff*g+r.startstandoff;if("line"===f.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},c={x:+t.attr("x2"),y:+t.attr("y2")};var w=o.x-c.x,T=o.y-c.y;if(h=(p=Math.atan2(T,w))+Math.PI,x&&b&&x+b>Math.sqrt(w*w+T*T))return void D();if(x){if(x*x>w*w+T*T)return void D();var k=x*Math.cos(p),A=x*Math.sin(p);c.x+=k,c.y+=A,t.attr({x2:c.x,y2:c.y})}if(b){if(b*b>w*w+T*T)return void D();var M=b*Math.cos(p),S=b*Math.sin(p);o.x-=M,o.y-=S,t.attr({x1:o.x,y1:o.y})}}else if("path"===f.nodeName){var C=f.getTotalLength(),L="";if(C1){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":287,"../annotations/draw":73}],80:[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?n>=l:n<=l));i++)n>c&&n0?n>=l:n<=l));i++)n>r[0]&&n1){var K=Math.pow(10,Math.floor(Math.log(Y)/Math.LN10));X*=K*u.roundUp(Y/K,[2,5,10]),(Math.abs(E.start)/E.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=X}G.domain=[q+U,q+F-U],G.setScale(),t.attr("transform",c(Math.round(l.l),Math.round(l.t)));var J,Q=t.select("."+A.cbtitleunshift).attr("transform",c(-Math.round(l.l),-Math.round(l.t))),$=t.select("."+A.cbaxis),tt=0;function et(n,i){var a={propContainer:G,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+A.cbtitle)},s="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+s+",."+s+"-math-group").remove(),m.draw(r,n,p(a,i||{}))}return u.syncOrAsync([a.previousPromises,function(){if(-1!==["top","bottom"].indexOf(M)){var t,r=l.l+(e.x+B)*l.w,n=G.title.font.size;t="top"===M?(1-(q+F-U))*l.h+l.t+3+.75*n:(1-(q+U))*l.h+l.t-3-.25*n,et(G._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(M)){var a=t.select("."+A.cbtitle),o=a.select("text"),p=[-e.outlinewidth/2,e.outlinewidth/2],h=a.select(".h"+G._id+"title-math-group").node(),d=15.6;if(o.node()&&(d=parseInt(o.node().style.fontSize,10)*w),h?(tt=f.bBox(h).height)>d&&(p[1]-=(tt-d)/2):o.node()&&!o.classed(A.jsPlaceholder)&&(tt=f.bBox(o.node()).height),tt){if(tt+=5,"top"===M)G.domain[1]-=tt/l.h,p[1]*=-1;else{G.domain[0]+=tt/l.h;var m=y.lineCount(o);p[1]+=(1-m)*d}a.attr("transform",c(p[0],p[1])),G.setScale()}}t.selectAll("."+A.cbfills+",."+A.cblines).attr("transform",c(0,Math.round(l.h*(1-G.domain[1])))),$.attr("transform",c(0,Math.round(-l.t)));var v=t.select("."+A.cbfills).selectAll("rect."+A.cbfill).attr("style","").data(z);v.enter().append("rect").classed(A.cbfill,!0).style("stroke","none"),v.exit().remove();var _=S.map(G.c2p).map(Math.round).sort((function(t,e){return t-e}));v.each((function(t,a){var o=[0===a?S[0]:(z[a]+z[a-1])/2,a===z.length-1?S[1]:(z[a]+z[a+1])/2].map(G.c2p).map(Math.round);o[1]=u.constrain(o[1]+(o[1]>o[0])?1:-1,_[0],_[1]);var s=n.select(this).attr({x:j,width:Math.max(D,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)f.gradient(s,r,e._id,"vertical",e._fillgradient,"fill");else{var l=L(t).replace("e-","");s.attr("fill",i(l).toHexString())}}));var x=t.select("."+A.cblines).selectAll("path."+A.cbline).data(g.color&&g.width?P:[]);x.enter().append("path").classed(A.cbline,!0),x.exit().remove(),x.each((function(t){n.select(this).attr("d","M"+j+","+(Math.round(G.c2p(t))+g.width/2%1)+"h"+D).call(f.lineGroupStyle,g.width,C(t),g.dash)})),$.selectAll("g."+G._id+"tick,path").remove();var b=j+D+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),T=s.calcTicks(G),k=s.getTickSigns(G)[2];return s.drawTicks(r,G,{vals:"inside"===G.ticks?s.clipEnds(G,T):T,layer:$,path:s.makeTickPath(G,b,k),transFn:s.makeTransTickFn(G)}),s.drawLabels(r,G,{vals:T,layer:$,transFn:s.makeTransTickLabelFn(G),labelFns:s.makeLabelFns(G,b)})},function(){if(-1===["top","bottom"].indexOf(M)){var t=G.title.font.size,e=G._offset+G._length/2,i=l.l+(G.position||0)*l.w+("right"===G.side?10+t*(G.showticklabels?1:.5):-10-t*(G.showticklabels?.5:0));et("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:M,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:i,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},a.previousPromises,function(){var n=D+e.outlinewidth/2;if(-1===G.ticklabelposition.indexOf("inside")&&(n+=f.bBox($.node()).width),(J=Q.select("text")).node()&&!J.classed(A.jsPlaceholder)){var i,o=Q.select(".h"+G._id+"title-math-group").node();i=o&&-1!==["top","bottom"].indexOf(M)?f.bBox(o).width:f.bBox(Q.node()).right-j-l.l,n=Math.max(n,i)}var s=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,u=H-Z;t.select("."+A.cbbg).attr({x:j-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:Z-N,width:Math.max(s,2),height:Math.max(u+2*N,2)}).call(d.fill,e.bgcolor).call(d.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+A.cboutline).attr({x:j,y:Z+e.ypad+("top"===M?tt:0),width:Math.max(D,2),height:Math.max(u-2*e.ypad-tt,2)}).call(d.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var p=({center:.5,right:1}[e.xanchor]||0)*s;t.attr("transform",c(l.l-p,l.t));var h={},m=T[e.yanchor],y=k[e.yanchor];"pixels"===e.lenmode?(h.y=e.y,h.t=u*m,h.b=u*y):(h.t=h.b=0,h.yt=e.y+e.len*m,h.yb=e.y-e.len*y);var g=T[e.xanchor],v=k[e.xanchor];if("pixels"===e.thicknessmode)h.x=e.x,h.l=s*g,h.r=s*v;else{var _=s-D;h.l=_*g,h.r=_*v,h.xl=e.x-e.thickness*g,h.xr=e.x+e.thickness*v}a.autoMargin(r,e._id,h)}],r)}(r,e,t);g&&g.then&&(t._promises||[]).push(g),t._context.edits.colorbarPosition&&function(t,e,r){var n,i,a,s=r._fullLayout._size;l.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),h(t)},moveFn:function(r,o){t.attr("transform",n+c(r,o)),i=l.align(e._xLeftFrac+r/s.w,e._thickFrac,0,1,e.xanchor),a=l.align(e._yBottomFrac-o/s.h,e._lenFrac,0,1,e.yanchor);var u=l.getCursor(i,a,e.xanchor,e.yanchor);h(t,u)},doneFn:function(){if(h(t),void 0!==i&&void 0!==a){var n={};n[e._propPrefix+"x"]=i,n[e._propPrefix+"y"]=a,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){a.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":184,"../../lib":211,"../../lib/extend":203,"../../lib/setcursor":230,"../../lib/svg_text_utils":232,"../../plots/cartesian/axes":256,"../../plots/cartesian/axis_defaults":258,"../../plots/cartesian/layout_attributes":270,"../../plots/cartesian/position_defaults":273,"../../plots/plots":297,"../../registry":306,"../color":82,"../colorscale/helpers":93,"../dragelement":101,"../drawing":104,"../titles":177,"./constants":84,d3:16,tinycolor2:65}],87:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":211}],88:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":83,"./defaults":85,"./draw":86,"./has_colorbar":87}],89:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),i=t("../../lib/regex").counter,a=t("./scales.js").scales;Object.keys(a);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,s=(e=e||{}).cLetter||"c",l=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),u="showScaleDflt"in e?e.showScaleDflt:"z"===s,c="string"==typeof e.colorscaleDflt?a[e.colorscaleDflt]:null,p=e.editTypeOverride||"",h=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(h+(r={z:"z",c:"color"}[s]));var f=s+"auto",d=s+"min",m=s+"max",y=s+"mid",g=(o(h+f),o(h+d),o(h+m),{});g[d]=g[m]=void 0;var v={};v[f]=!1;var _={};return"color"===r&&(_.color={valType:"color",arrayOk:!0,editType:p||"style"},e.anim&&(_.color.anim=!0)),_[f]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:g},_[d]={valType:"number",dflt:null,editType:p||"plot",impliedEdits:v},_[m]={valType:"number",dflt:null,editType:p||"plot",impliedEdits:v},_[y]={valType:"number",dflt:null,editType:"calc",impliedEdits:g},_.colorscale={valType:"colorscale",editType:"calc",dflt:c,impliedEdits:{autocolorscale:!1}},_.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},_.reversescale={valType:"boolean",dflt:!1,editType:"plot"},l||(_.showscale={valType:"boolean",dflt:u,editType:"calc"},_.colorbar=n),e.noColorAxis||(_.coloraxis={valType:"subplotid",regex:i("coloraxis"),dflt:null,editType:"calc"}),_}},{"../../lib/regex":226,"../colorbar/attributes":83,"./scales.js":97}],90:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,s=t._fullLayout,l=r.vals,u=r.containerStr,c=u?i.nestedProperty(e,u).get():e,p=a(c),h=!1!==p.auto,f=p.min,d=p.max,m=p.mid,y=function(){return i.aggNums(Math.min,null,l)},g=function(){return i.aggNums(Math.max,null,l)};(void 0===f?f=y():h&&(f=c._colorAx&&n(f)?Math.min(f,y()):y()),void 0===d?d=g():h&&(d=c._colorAx&&n(d)?Math.max(d,g()):g()),h&&void 0!==m&&(d-m>m-f?f=m-(d-m):d-m=0?s.colorscale.sequential:s.colorscale.sequentialminus,p._sync("colorscale",o))}},{"../../lib":211,"./helpers":93,"fast-isnumeric":18}],91:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./helpers").hasColorscale,a=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,i){var o=i.container?n.nestedProperty(t,i.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var s=a(o),l=s.auto;(l||void 0===s.min)&&r(o,i.min),(l||void 0===s.max)&&r(o,i.max),s.autocolorscale&&r(o,"colorscale")}}for(var s=0;s=0;n--,i++){var a=t[n];r[i]=[1-a[0],a[1]]}return r}function d(t,e){e=e||{};for(var r=t.domain,o=t.range,l=o.length,u=new Array(l),c=0;c4/3-s?o:s}},{}],99:[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":211}],100:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],101:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),i=t("has-hover"),a=t("has-passive-events"),o=t("../../lib").removeElement,s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");function c(){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 p(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){var e,r,n,u,h,f,d,m,y=t.gd,g=1,v=y._context.doubleClickDelay,_=t.element;y._mouseDownTime||(y._mouseDownTime=0),_.style.pointerEvents="all",_.onmousedown=b,a?(_._ontouchstart&&_.removeEventListener("touchstart",_._ontouchstart),_._ontouchstart=b,_.addEventListener("touchstart",b,{passive:!1})):_.ontouchstart=b;var x=t.clampFn||function(t,e,r){return Math.abs(t)v&&(g=Math.max(g-1,1)),y._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(g,f),!m){var r;try{r=new MouseEvent("click",e)}catch(t){var n=p(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)}d.dispatchEvent(r)}y._dragging=!1,y._dragged=!1}else y._dragged=!1}},l.coverSlip=c},{"../../lib":211,"../../plots/cartesian/constants":262,"./align":98,"./cursor":99,"./unhover":102,"has-hover":49,"has-passive-events":50,"mouse-event-offset":54}],102:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/dom").getGraphDiv,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/dom":201,"../../lib/events":202,"../../lib/throttle":233,"../fx/constants":116}],103:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],104:[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=u.strTranslate,p=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),f=t("../../constants/alignment").LINE_SPACING,d=t("../../constants/interactions").DESELECTDIM,m=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),g=t("../../components/fx/helpers").appendArrayPointValue,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",c(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,s=a.xcalendar,l=a.ycalendar,u=o.traceIs(a,"bar-like")?".bartext":".point,.textpoint";t.selectAll(u).each((function(t){v.hideOutsideRangePoint(t,n.select(this),r,i,s,l)}))}))}},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 _=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolNoFill={},v.symbolList=[],Object.keys(_).forEach((function(t){var e=_[t],r=e.n;v.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),v.symbolNames[r]=t,v.symbolFuncs[r]=e.f,e.needLine&&(v.symbolNeedLines[r]=!0),e.noDot?v.symbolNoDot[r]=!0:v.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(v.symbolNoFill[r]=!0)}));var x=v.symbolNames.length;function b(t,e){var r=t%100;return v.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}v.symbolNumber=function(t){if(i(t))t=+t;else 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>=x||t>=400?0:Math.floor(Math.max(t,0))};var w={x1:1,x2:0,y1:0,y2:0},T={x1:0,x2:0,y1:1,y2:0},k=n.format("~.1f"),A={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:w},horizontalreversed:{node:"linearGradient",attrs:w,reversed:!0},vertical:{node:"linearGradient",attrs:T},verticalreversed:{node:"linearGradient",attrs:T,reversed:!0}};v.gradient=function(t,e,r,i,o,l){for(var c=o.length,p=A[i],h=new Array(c),f=0;f"+g(t);d._gradientUrlQueryParts[v]=1},v.initGradients=function(t){var e=t._fullLayout;u.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},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",b(c,l))}var p,h,f,d=!1;if(t.so)f=o.outlierwidth,h=o.outliercolor,p=a.outliercolor;else{var m=(o||{}).width;f=(t.mlw+1||m+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)&&(p=s.defaultLine,d=!0),p="mc"in t?t.mcc=n.markerScale(t.mc):a.color||"rgba(0,0,0,0)",n.selectedColorFn&&(p=n.selectedColorFn(t))}if(t.om)e.call(s.stroke,p).style({"stroke-width":(f||1)+"px",fill:"none"});else{e.style("stroke-width",(t.isBlank?0:f)+"px");var y=a.gradient,g=t.mgt;if(g?d=!0:g=y&&y.type,Array.isArray(g)&&(g=g[0],A[g]||(g=0)),g&&"none"!==g){var _=t.mgc;_?d=!0:_=y.color;var x=r.uid;d&&(x+="-"+t.i),v.gradient(e,i,x,g,[[0,_],[1,p]],"fill")}else s.fill(e,p);f&&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=m.isBubble(t)?y(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,p=s.opacity,h=void 0!==c,f=void 0!==p;(u.isArrayOrTypedArray(l)||h||f)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?i.opacity:t.mo;return t.selected?h?c:e:f?p:d*e});var m=i.color,y=a.color,g=s.color;(y||g)&&(e.selectedColorFn=function(t){var e=t.mcc||m;return t.selected?y||e:g||e});var v=i.size,_=a.size,x=s.size,b=void 0!==_,w=void 0!==x;return o.traceIs(t,"symbols")&&(b||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||v/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",b(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}var o=e.texttemplate,s=r._fullLayout;t.each((function(t){var a=n.select(this),l=o?u.extractOption(t,e,"txt","texttemplate"):u.extractOption(t,e,"tx","text");if(l||0===l){if(o){var c=e._module.formatLabels?e._module.formatLabels(t,e,s):{},h={};g(h,e,t.i);var f=e._meta||{};l=u.texttemplateString(l,c,s._d3locale,h,t,f)}var d=t.tp||e.textposition,m=C(t,e),y=i?i(t):t.tc||e.textfont.color;a.call(v.font,t.tf||e.textfont.family,m,y).text(l).call(p.convertToTspans,r).call(S,d,m,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=C(t,e);s.fill(i,a),S(i,o,l,t.mrc2||t.mrc)}))}};function L(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,.25),c=Math.pow(s*s+l*l,.25),p=(c*c*a-u*u*s)*i,h=(c*c*o-u*u*l)*i,f=3*c*(u+c),d=3*u*(u+c);return[[n.round(e[0]+(f&&p/f),2),n.round(e[1]+(f&&h/f),2)],[n.round(e[0]-(d&&p/d),2),n.round(e[1]-(d&&h/d),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={},z=0),r&&(v.savedBBoxes[r]=y),z++,u.extendFlat({},y)},v.setClipUrl=function(t,e,r){t.attr("clip-path",D(e,r))},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+=c(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?[]:[c(o,s),"scale("+e+","+r+")",c(-o,-s)],l&&t.push(l),i.attr("transform",t.join(""))}}))}},{"../../components/fx/helpers":118,"../../constants/alignment":184,"../../constants/interactions":187,"../../constants/xmlns_namespaces":189,"../../lib":211,"../../lib/svg_text_utils":232,"../../registry":306,"../../traces/scatter/make_bubble_size_func":354,"../../traces/scatter/subtypes":362,"../color":82,"../colorscale":94,"./symbol_defs":105,d3:16,"fast-isnumeric":18,tinycolor2:65}],105:[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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:16}],106:[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"}}}},{}],107:[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),p=0;p0;e.each((function(e){var p,h=e[0].trace,f=h.error_x||{},d=h.error_y||{};h.ids&&(p=function(t){return t.id});var m=o.hasMarkers(h)&&h.marker.maxdisplayed>0;d.visible||f.visible||(e=[]);var y=n.select(this).selectAll("g.errorbar").data(e,p);if(y.exit().remove(),e.length){f.visible||y.selectAll("path.xerror").remove(),d.visible||y.selectAll("path.yerror").remove(),y.style("opacity",1);var g=y.enter().append("g").classed("errorbar",!0);c&&g.style("opacity",0).transition().duration(s.duration).style("opacity",1),a.setClipUrl(y,r.layerClipId,t),y.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(!m||t.vis){var a,o=e.select("path.yerror");if(d.visible&&i(r.x)&&i(r.yh)&&i(r.ys)){var p=d.width;a="M"+(r.x-p)+","+r.yh+"h"+2*p+"m-"+p+",0V"+r.ys,r.noYS||(a+="m-"+p+",0h"+2*p),!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(f.visible&&i(r.y)&&i(r.xh)&&i(r.xs)){var y=(f.copy_ystyle?d:f).width;a="M"+r.xh+","+(r.y-y)+"v"+2*y+"m0,-"+y+"H"+r.xs,r.noXS||(a+="m0,-"+y+"v"+2*y),!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":362,"../drawing":104,d3:16,"fast-isnumeric":18}],112:[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":82,d3:16}],113:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("./layout_attributes").hoverlabel,a=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:a({},i.bgcolor,{arrayOk:!0}),bordercolor:a({},i.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:a({},i.align,{arrayOk:!0}),namelength:a({},i.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":203,"../../plots/font_attributes":284,"./layout_attributes":123}],114:[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.indexx[0]._length||tt<0||tt>b[0]._length)return d.unhoverRaw(t,e)}if(e.pointerX=$+x[0]._offset,e.pointerY=tt+b[0]._offset,L="xval"in e?g.flat(s,e.xval):g.p2c(x,$),I="yval"in e?g.flat(s,e.yval):g.p2c(b,tt),!i(L[0])||!i(I[0]))return o.warn("Fx.hover failed",e,t),d.unhoverRaw(t,e)}var nt=1/0;function it(t,r){for(F=0;FG&&(Y.splice(0,G),nt=Y[0].distance),m&&0!==W&&0===Y.length){Z.distance=W,Z.index=!1;var p=N._module.hoverPoints(Z,q,H,"closest",l._hoverlayer);if(p&&(p=p.filter((function(t){return t.spikeDistance<=W}))),p&&p.length){var h,d=p.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(d.length){var y=d[0];i(y.x0)&&i(y.y0)&&(h=ot(y),(!J.vLinePoint||J.vLinePoint.spikeDistance>h.spikeDistance)&&(J.vLinePoint=h))}var v=p.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(v.length){var _=v[0];i(_.x0)&&i(_.y0)&&(h=ot(_),(!J.hLinePoint||J.hLinePoint.spikeDistance>h.spikeDistance)&&(J.hLinePoint=h))}}}}}function at(t,e){for(var r,n=null,i=1/0,a=0;a1||Y.length>1)||"closest"===S&&Q&&Y.length>1,Mt=f.combine(l.plot_bgcolor||f.background,l.paper_bgcolor),St={hovermode:S,rotateLabels:At,bgColor:Mt,container:l._hoverlayer,outerContainer:l._paperdiv,commonLabelOpts:l.hoverlabel,hoverdistance:l.hoverdistance},Ct=E(Y,St,t);g.isUnifiedHover(S)||(!function(t,e,r){var n,i,a,o,s,l,u,c=0,p=1,h=t.size(),f=new Array(h),d=0;function m(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--)}}}t.each((function(t){var n=t[e],i="x"===n._id.charAt(0),a=n.range;0===d&&a&&a[0]>a[1]!==i&&(p=-1),f[d++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(i?T:1)/2,pmin:0,pmax:i?r.width:r.height}]})),f.sort((function(t,e){return t[0].posref-e[0].posref||p*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&c<=h;){for(c++,n=!0,o=0;o.01&&v.pmin===_.pmin&&v.pmax===_.pmax){for(s=g.length-1;s>=0;s--)g[s].dp+=i;for(y.push.apply(y,g),f.splice(o+1,1),u=0,s=y.length-1;s>=0;s--)u+=y[s].dp;for(a=u/y.length,s=y.length-1;s>=0;s--)y[s].dp-=a;n=!1}else o++}f.forEach(m)}for(o=f.length-1;o>=0;o--){var x=f[o];for(s=x.length-1;s>=0;s--){var b=x[s],w=b.datum;w.offset=b.dp,w.del=b.del}}}(Ct,At?"xa":"ya",l),z(Ct,At,l._invScaleX,l._invScaleY));if(e.target&&e.target.tagName){var Lt=y.getComponentMethod("annotations","hasClickToShow")(t,bt);p(n.select(e.target),Lt?"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,xt))return;xt&&t.emit("plotly_unhover",{event:e,points:xt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:x,yaxes:b,xvals:L,yvals:I})}(t,e,r,a)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var i=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,nameLength:t.nameLength,textAlign:t.textAlign,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}})),a=n.select(e.container),o=e.outerContainer?n.select(e.outerContainer):a,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||f.background,container:a,outerContainer:o},l=E(i,s,e.gd),u=0,c=0;l.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function E(t,e,r){var i=r._fullLayout,a=e.hovermode,u=e.rotateLabels,p=e.bgColor,d=e.container,m=e.outerContainer,y=e.commonLabelOpts||{},w=e.fontFamily||v.HOVERFONT,T=e.fontSize||v.HOVERFONTSIZE,k=t[0],A=k.xa,L=k.ya,E="y"===a.charAt(0)?"yLabel":"xLabel",z=k[E],P=(String(z)||"").split(" ")[0],D=m.node().getBoundingClientRect(),O=D.top,R=D.width,F=D.height,B=void 0!==z&&k.distance<=e.hoverdistance&&("x"===a||"y"===a);if(B){var N,U,j=!0;for(N=0;Ni.width-C?(v=i.width-C,l.attr("d","M"+(C-M)+",0L"+C+","+b+M+"v"+b+(2*S+x.height)+"H-"+C+"V"+b+M+"H"+(C-2*M)+"Z")):l.attr("d","M0,0L"+M+","+b+M+"H"+(S+x.width/2)+"v"+b+(2*S+x.height)+"H-"+(S+x.width/2)+"V"+b+M+"H-"+M+"Z")}else{var E,I,P;"right"===L.side?(E="start",I=1,P="",v=A._offset+A._length):(E="end",I=-1,P="-",v=A._offset),_=L._offset+(k.y0+k.y1)/2,u.attr("text-anchor",E),l.attr("d","M0,0L"+P+M+","+M+"V"+(S+x.height/2)+"h"+P+(2*S+x.width)+"V-"+(S+x.height/2)+"H"+P+M+"V-"+M+"Z");var D,R=x.height/2,F=O-x.top-R,B="clip"+i._uid+"commonlabel"+L._id;if(v=0?et-=it:et+=2*S;var at=nt.height+2*S,ot=tt+at>=F;return at<=F&&(tt<=O?tt=L._offset+2*S:ot&&(tt=F-at)),rt.attr("transform",s(et,tt)),rt}var st=d.selectAll("g.hovertext").data(t,(function(t){return C(t)}));return st.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(f.fill,f.addOpacity(p,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(h.font,w,T)})),st.exit().remove(),st.each((function(t){var e=n.select(this).attr("transform",""),o=t.color;Array.isArray(o)&&(o=o[t.eventData[0].pointNumber]);var d=t.bgcolor||o,m=f.combine(f.opacity(d)?d:f.defaultLine,p),y=f.combine(f.opacity(o)?o:f.defaultLine,p),g=t.borderColor||f.contrast(m),v=I(t,B,a,i,z,e),_=v[0],x=v[1],k=e.select("text.nums").call(h.font,t.fontFamily||w,t.fontSize||T,t.fontColor||g).text(_).attr("data-notex",1).call(c.positionText,0,0).call(c.convertToTspans,r),A=e.select("text.name"),C=0,L=0;if(x&&x!==_){A.call(h.font,t.fontFamily||w,t.fontSize||T,y).text(x).attr("data-notex",1).call(c.positionText,0,0).call(c.convertToTspans,r);var E=A.node().getBoundingClientRect();C=E.width+2*S,L=E.height+2*S}else A.remove(),e.select("rect").remove();e.select("path").style({fill:m,stroke:g});var P,D,N=k.node().getBoundingClientRect(),U=t.xa._offset+(t.x0+t.x1)/2,j=t.ya._offset+(t.y0+t.y1)/2,V=Math.abs(t.x1-t.x0),q=Math.abs(t.y1-t.y0),H=N.width+M+S+C;if(t.ty0=O-N.top,t.bx=N.width+2*S,t.by=Math.max(N.height+2*S,L),t.anchor="start",t.txwidth=N.width,t.tx2width=C,t.offset=0,u)t.pos=U,P=j+q/2+H<=F,D=j-q/2-H>=0,"top"!==t.idealAlign&&P||!D?P?(j+=q/2,t.anchor="start"):t.anchor="middle":(j-=q/2,t.anchor="end");else if(t.pos=j,P=U+V/2+H<=R,D=U-V/2-H>=0,"left"!==t.idealAlign&&P||!D)if(P)U+=V/2,t.anchor="start";else{t.anchor="middle";var Z=H/2,G=U+Z-R,X=U-Z;G>0&&(U-=G),X<0&&(U+=-X)}else U-=V/2,t.anchor="end";k.attr("text-anchor",t.anchor),C&&A.attr("text-anchor",t.anchor),e.attr("transform",s(U,j)+(u?l(b):""))})),st}function I(t,e,r,n,i,a){var s="",l="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),s=R(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(l+=(l?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===i?l=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(l+=(l?"
":"")+t.text),void 0!==t.extraText&&(l+=(l?"
":"")+t.extraText),a&&""===l&&!t.hovertemplate&&(""===s&&a.remove(),l=s);var u=n._d3locale,c=t.hovertemplate||!1,p=t.hovertemplateLabels||t,h=t.eventData[0]||{};return c&&(l=(l=o.hovertemplateString(c,p,u,h,t.trace._meta)).replace(L,(function(e,r){return s=R(r,t.nameLength),""}))),[l,s]}function z(t,e,r,i){var a=function(t){return t*r},o=function(t){return t*i};t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var i=r.select("text.nums"),s=t.anchor,l="end"===s?-1:1,u={start:1,end:-1,middle:0}[s],p=u*(M+S),f=p+u*(t.txwidth+S),d=0,m=t.offset,y="middle"===s;y&&(p-=t.tx2width/2,f+=t.txwidth/2+S),e&&(m*=-A,d=t.offset*k),r.select("path").attr("d",y?"M-"+a(t.bx/2+t.tx2width/2)+","+o(m-t.by/2)+"h"+a(t.bx)+"v"+o(t.by)+"h-"+a(t.bx)+"Z":"M0,0L"+a(l*M+d)+","+o(M+m)+"v"+o(t.by/2-M)+"h"+a(l*t.bx)+"v-"+o(t.by)+"H"+a(l*M+d)+"V"+o(m-M)+"Z");var g=d+p,v=m+t.ty0-t.by/2+S,_=t.textAlign||"auto";"auto"!==_&&("left"===_&&"start"!==s?(i.attr("text-anchor","start"),g=y?-t.bx/2-t.tx2width/2+S:-t.bx-S):"right"===_&&"end"!==s&&(i.attr("text-anchor","end"),g=y?t.bx/2-t.tx2width/2-S:t.bx+S)),i.call(c.positionText,a(g),o(v)),t.tx2width&&(r.select("text.name").call(c.positionText,a(f+u*S+d),o(m+t.ty0-t.by/2+S)),r.select("rect").call(h.setRect,a(f+(u-1)*t.tx2width/2+d),o(m-t.by/2-1),a(t.tx2width),o(t.by+2)))}))}function P(t,e){var r=t.index,n=t.trace||{},a=t.cd[0],s=t.cd[r]||{};function l(t){return t||i(t)&&0===t}var u=Array.isArray(r)?function(t,e){var i=o.castOption(a,r,t);return l(i)?i:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(s,n,t,e)};function c(e,r,n){var i=u(r,n);l(i)&&(t[e]=i)}if(c("hoverinfo","hi","hoverinfo"),c("bgcolor","hbg","hoverlabel.bgcolor"),c("borderColor","hbc","hoverlabel.bordercolor"),c("fontFamily","htf","hoverlabel.font.family"),c("fontSize","hts","hoverlabel.font.size"),c("fontColor","htc","hoverlabel.font.color"),c("nameLength","hnl","hoverlabel.namelength"),c("textAlign","hta","hoverlabel.align"),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:m.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:m.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 p=m.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+p+" / -"+m.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+p,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var h=m.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+h+" / -"+m.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+h,"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 D(t,e,r){var n,i,o=r.container,s=r.fullLayout,l=s._size,u=r.event,c=!!e.hLinePoint,p=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),p||c){var d=f.combine(s.plot_bgcolor,s.paper_bgcolor);if(c){var y,g,v=e.hLinePoint;n=v&&v.xa,"cursor"===(i=v&&v.ya).spikesnap?(y=u.pointerX,g=u.pointerY):(y=n._offset+v.x,g=i._offset+v.y);var _,x,b=a.readability(v.color,d)<1.5?f.contrast(d):v.color,w=i.spikemode,T=i.spikethickness,k=i.spikecolor||b,A=m.getPxPosition(t,i);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(_=A,x=y),-1!==w.indexOf("across")){var M=i._counterDomainMin,S=i._counterDomainMax;"free"===i.anchor&&(M=Math.min(M,i.position),S=Math.max(S,i.position)),_=l.l+M*l.w,x=l.l+S*l.w}o.insert("line",":first-child").attr({x1:_,x2:x,y1:g,y2:g,"stroke-width":T,stroke:k,"stroke-dasharray":h.dashStyle(i.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:_,x2:x,y1:g,y2:g,"stroke-width":T+2,stroke:d}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:A+("right"!==i.side?T:-T),cy:g,r:T,fill:k}).classed("spikeline",!0)}if(p){var C,L,E=e.vLinePoint;n=E&&E.xa,i=E&&E.ya,"cursor"===n.spikesnap?(C=u.pointerX,L=u.pointerY):(C=n._offset+E.x,L=i._offset+E.y);var I,z,P=a.readability(E.color,d)<1.5?f.contrast(d):E.color,D=n.spikemode,O=n.spikethickness,R=n.spikecolor||P,F=m.getPxPosition(t,n);if(-1!==D.indexOf("toaxis")||-1!==D.indexOf("across")){if(-1!==D.indexOf("toaxis")&&(I=F,z=L),-1!==D.indexOf("across")){var B=n._counterDomainMin,N=n._counterDomainMax;"free"===n.anchor&&(B=Math.min(B,n.position),N=Math.max(N,n.position)),I=l.t+(1-N)*l.h,z=l.t+(1-B)*l.h}o.insert("line",":first-child").attr({x1:C,x2:C,y1:I,y2:z,"stroke-width":O,stroke:R,"stroke-dasharray":h.dashStyle(n.spikedash,O)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:C,x2:C,y1:I,y2:z,"stroke-width":O+2,stroke:d}).classed("spikeline",!0).classed("crisp",!0)}-1!==D.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:C,cy:F-("top"!==n.side?O:-O),r:O,fill:R}).classed("spikeline",!0)}}}function O(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function R(t,e){return c.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":211,"../../lib/events":202,"../../lib/override_cursor":222,"../../lib/svg_text_utils":232,"../../plots/cartesian/axes":256,"../../registry":306,"../color":82,"../dragelement":101,"../drawing":104,"../legend/defaults":134,"../legend/draw":135,"./constants":116,"./helpers":118,d3:16,"fast-isnumeric":18,tinycolor2:65}],120:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function s(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&a(e.hovermode)&&(o.font||(o.font={}),s("size"),s("family"),s("color"),e.legend?(o.bgcolor||(o.bgcolor=i.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":211,"../color":82,"./helpers":118}],121:[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 void 0!==e[r]?e[r]:n.coerce(t,e,i,r,a)}var o,s=a("clickmode");return e._has("cartesian")?s.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!h&&!f&&!d)"independent"===k("pattern")&&(h=!0);y._hasSubplotGrid=h;var _,x,b="top to bottom"===k("roworder"),w=h?.2:.1,T=h?.3:.1;m&&e._splomGridDflt&&(_=e._splomGridDflt.xside,x=e._splomGridDflt.yside),y._domains={x:c("x",k,w,_,v),y:c("y",k,T,x,g,b)}}else delete e.grid}function k(t,e){return n.coerce(r,y,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||{},f=e._subplots,d=r._hasSubplotGrid,m=r.rows,y=r.columns,g="independent"===r.pattern,v=r._axisMap={};if(d){var _=h.subplots||[];l=r.subplots=new Array(m);var x=1;for(n=0;n1);if(!1!==m||u.uirevision){var y=a.newContainer(e,"legend");if(b("uirevision",e.uirevision),!1!==m){b("bgcolor",e.paper_bgcolor),b("bordercolor"),b("borderwidth"),i.coerceFont(b,"font",e.font);var g,v,_,x=b("orientation");"h"===x?(g=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(v=1.1,_="bottom"):(v=-.1,_="top")):(g=1.02,v=1,_="auto"),b("traceorder",h),l.isGrouped(e.legend)&&b("tracegroupgap"),b("itemsizing"),b("itemwidth"),b("itemclick"),b("itemdoubleclick"),b("x",g),b("xanchor"),b("y",v),b("yanchor",_),b("valign"),i.noneOrAll(u,y,["x","y"]),b("title.text")&&(b("title.side","h"===x?"left":"top"),i.coerceFont(b,"title.font",e.font))}}function b(t,e){return i.coerce(u,y,o,t,e)}}},{"../../lib":211,"../../plot_api/plot_template":245,"../../plots/layout_attributes":288,"../../registry":306,"./attributes":132,"./helpers":138}],135:[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"),p=t("../../lib/svg_text_utils"),h=t("./handle_click"),f=t("./constants"),d=t("../../constants/alignment"),m=d.LINE_SPACING,y=d.FROM_TL,g=d.FROM_BR,v=t("./get_legend_data"),_=t("./style"),x=t("./helpers");function b(t,e,r,n,i){var a=r.data()[0][0].trace,l={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&&(l.group=a._group),o.traceIs(a,"pie-like")&&(l.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",l))if(1===n)e._clickTimeout=setTimeout((function(){h(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",l)&&h(r,t,n)}}function w(t,e,r){var n,a=t.data()[0][0],s=a.trace,l=o.traceIs(s,"pie-like"),c=s.index,h=r._main&&e._context.edits.legendText&&!l,d=r._maxNameLength;r.entries?n=a.text:(n=l?a.label:s.name,s._meta&&(n=i.templateString(n,s._meta)));var m=i.ensureSingle(t,"text","legendtext");m.attr("text-anchor","start").call(u.font,r.font).text(h?T(n,d):n);var y=r.itemwidth+2*f.itemGap;p.positionText(m,y,0),h?m.call(p.makeEditable,{gd:e,text:n}).call(A,t,e,r).on("edit",(function(n){this.text(T(n,d)).call(A,t,e,r);var s=a.trace._fullInput||{},l={};if(o.hasTransform(s,"groupby")){var u=o.getTransformIndices(s,"groupby"),p=u[u.length-1],h=i.keyedContainer(s,"transforms["+p+"].styles","target","value.name");h.set(a.trace._group,n),l=h.constructUpdate()}else l.name=n;return o.call("_guiRestyle",e,l,c)})):A(m,t,e,r)}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=e._context.doubleClickDelay,o=1,s=i.ensureSingle(t,"rect","legendtoggle",(function(t){e._context.staticPlot||t.style("cursor","pointer").attr("pointer-events","all"),t.call(c.fill,"rgba(0,0,0,0)")}));e._context.staticPlot||(s.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimea&&(o=Math.max(o-1,1)),b(e,r,t,o,n.event)}})))}function A(t,e,r,n){n._main||t.attr("data-notex",!0),p.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var i=t.select("g[class*=math-group]"),a=i.node();r||(r=e._fullLayout.legend);var o,s,l=r.borderwidth,c=(n?r:r.title).font.size*m;if(a){var h=u.bBox(a);o=h.height,s=h.width,n?u.setTranslate(i,0,.25*o):u.setTranslate(i,l,.75*o+l)}else{var d=t.select(n?".legendtext":".legendtitletext"),y=p.lineCount(d),g=d.node();o=c*y,s=g?u.bBox(g).width:0;var v=c*((y-1)/2-.3);if(n){var _=r.itemwidth+2*f.itemGap;p.positionText(d,_,-v)}else p.positionText(d,f.titlePad+l,c+l)}n?(n.lineHeight=c,n.height=Math.max(o,16)+3,n.width=s):(r._titleWidth=s,r._titleHeight=o)}(e,r,n)}))}function M(t){return i.isRightAnchor(t)?"right":i.isCenterAnchor(t)?"center":"left"}function S(t){return i.isBottomAnchor(t)?"bottom":i.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,s=t._fullLayout,p="legend"+s._uid;if(e?(r=e.layer,p+="-hover"):((e=s.legend||{})._main=!0,r=s._infolayer),r){var h;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;h=s.showlegend&&v(t.calcdata,e)}else{if(!e.entries)return;h=v(e.entries,e)}var d=s.hiddenlabels||[];if(e._main&&(!s.showlegend||!h.length))return r.selectAll(".legend").remove(),s._topdefs.select("#"+p).remove(),a.autoMargin(t,"legend");var m=i.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),T=i.ensureSingleById(s._topdefs,"clipPath",p,(function(t){t.append("rect")})),C=i.ensureSingle(m,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));C.call(c.stroke,e.bordercolor).call(c.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var L=i.ensureSingle(m,"g","scrollbox"),E=e.title;if(e._titleWidth=0,e._titleHeight=0,E.text){var I=i.ensureSingle(L,"text","legendtitletext");I.attr("text-anchor","start").call(u.font,E.font).text(E.text),A(I,L,t,e)}else L.selectAll(".legendtitletext").remove();var z=i.ensureSingle(m,"rect","scrollbar",(function(t){t.attr(f.scrollBarEnterAttrs).call(c.fill,f.scrollBarColor)})),P=L.selectAll("g.groups").data(h);P.enter().append("g").attr("class","groups"),P.exit().remove();var D=P.selectAll("g.traces").data(i.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==d.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(_,t,e).each((function(){e._main&&n.select(this).call(k,t)})),i.syncOrAsync([a.previousPromises,function(){return function(t,e,r,i){var a=t._fullLayout;i||(i=a.legend);var o=a._size,s=x.isVertical(i),l=x.isGrouped(i),c=i.borderwidth,p=2*c,h=f.itemGap,d=i.itemwidth+2*h,m=2*(c+h),y=S(i),g=i.y<0||0===i.y&&"top"===y,v=i.y>1||1===i.y&&"bottom"===y;i._maxHeight=Math.max(g||v?a.height/2:o.h,30);var _=0;i._width=0,i._height=0;var b=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(i);if(s)r.each((function(t){var e=t[0].height;u.setTranslate(this,c+b[0],c+b[1]+i._height+e/2+h),i._height+=e,i._width=Math.max(i._width,t[0].width)})),_=d+i._width,i._width+=h+d+p,i._height+=m,l&&(e.each((function(t,e){u.setTranslate(this,0,e*i.tracegroupgap)})),i._height+=(i._lgroupsLength-1)*i.tracegroupgap);else{var w=M(i),T=i.x<0||0===i.x&&"right"===w,k=i.x>1||1===i.x&&"left"===w,A=v||g,C=a.width/2;i._maxWidth=Math.max(T?A&&"left"===w?o.l+o.w:C:k?A&&"right"===w?o.r+o.w:C:o.w,2*d);var L=0,E=0;r.each((function(t){var e=t[0].width+d;L=Math.max(L,e),E+=e})),_=null;var I=0;if(l){var z=0,P=0,D=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;u.setTranslate(this,b[0],b[1]+c+h+n/2+e),e+=n,t=Math.max(t,d+r[0].width)})),z=Math.max(z,e);var r=t+h;r+c+P>i._maxWidth&&(I=Math.max(I,P),P=0,D+=z+i.tracegroupgap,z=e),u.setTranslate(this,P,D),P+=r})),i._width=Math.max(I,P)+c,i._height=D+z+m}else{var O=r.size(),R=E+p+(O-1)*h=i._maxWidth&&(I=Math.max(I,U),B=0,N+=F,i._height+=F,F=0),u.setTranslate(this,b[0]+c+B,b[1]+c+N+e/2+h),U=B+r+h,B+=n,F=Math.max(F,e)})),R?(i._width=B+p,i._height=F+m):(i._width=Math.max(I,U)+p,i._height+=F+m)}}i._width=Math.ceil(Math.max(i._width+b[0],i._titleWidth+2*(c+f.titlePad))),i._height=Math.ceil(Math.max(i._height+b[1],i._titleHeight+2*(c+f.itemGap))),i._effHeight=Math.min(i._height,i._maxHeight);var j=t._context.edits,V=j.legendText||j.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,i=V?d:_||d+t[0].width;s||(i+=h/2),u.setRect(e,0,-r/2,i,r)}))}(t,P,D,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=M(e),n=S(e);return a.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*y[r],r:e._width*g[r],b:e._effHeight*g[n],t:e._effHeight*y[n]})}(t)){var c,h,d,v,_=s._size,x=e.borderwidth,w=_.l+_.w*e.x-y[M(e)]*e._width,k=_.t+_.h*(1-e.y)-y[S(e)]*e._effHeight;if(e._main&&s.margin.autoexpand){var A=w,E=k;w=i.constrain(w,0,s.width-e._width),k=i.constrain(k,0,s.height-e._effHeight),w!==A&&i.log("Constrain legend.x to make legend fit inside graph"),k!==E&&i.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&u.setTranslate(m,w,k),z.on(".drag",null),m.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var I=e._effHeight;e._main||(I=e._height),C.attr({width:e._width-x,height:I-x,x:x/2,y:x/2}),u.setTranslate(L,0,0),T.select("rect").attr({width:e._width-2*x,height:I-2*x,x:x,y:x}),u.setClipUrl(L,p,t),u.setRect(z,0,0,0,0),delete e._scrollY}else{var P,D,O,R=Math.max(f.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),F=e._effHeight-R-2*f.scrollBarMargin,B=e._height-e._effHeight,N=F/B,U=Math.min(e._scrollY||0,B);C.attr({width:e._width-2*x+f.scrollBarWidth+f.scrollBarMargin,height:e._effHeight-x,x:x/2,y:x/2}),T.select("rect").attr({width:e._width-2*x+f.scrollBarWidth+f.scrollBarMargin,height:e._effHeight-2*x,x:x,y:x+U}),u.setClipUrl(L,p,t),q(U,R,N),m.on("wheel",(function(){q(U=i.constrain(e._scrollY+n.event.deltaY/F*B,0,B),R,N),0!==U&&U!==B&&n.event.preventDefault()}));var j=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;P="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,O=U})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(D="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,q(U=function(t,e,r){var n=(r-e)/N+t;return i.constrain(n,0,B)}(O,P,D),R,N))}));z.call(j);var V=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(P=t.changedTouches[0].clientY,O=U)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(D=t.changedTouches[0].clientY,q(U=function(t,e,r){var n=(e-r)/N+t;return i.constrain(n,0,B)}(O,P,D),R,N))}));L.call(V)}if(t._context.edits.legendPosition)m.classed("cursor-move",!0),l.init({element:m.node(),gd:t,prepFn:function(){var t=u.getTranslate(m);d=t.x,v=t.y},moveFn:function(t,r){var n=d+t,i=v+r;u.setTranslate(m,n,i),c=l.align(n,0,_.l,_.l+_.w,e.xanchor),h=l.align(i,0,_.t+_.h,_.t,e.yanchor)},doneFn:function(){void 0!==c&&void 0!==h&&o.call("_guiRelayout",t,{"legend.x":c,"legend.y":h})},clickFn:function(e,n){var i=r.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&&b(t,m,i,e,n)}})}function q(r,n,i){e._scrollY=t._fullLayout.legend._scrollY=r,u.setTranslate(L,0,-r),u.setRect(z,e._width,f.scrollBarMargin+r*i,f.scrollBarWidth,n),T.select("rect").attr("y",x+r)}}],t)}}},{"../../constants/alignment":184,"../../lib":211,"../../lib/events":202,"../../lib/svg_text_utils":232,"../../plots/plots":297,"../../registry":306,"../color":82,"../dragelement":101,"../drawing":104,"./constants":133,"./get_legend_data":136,"./handle_click":137,"./helpers":138,"./style":140,d3:16}],136:[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,p=0,h=e._main;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;r0))return 0;i=e.width}return y?n:Math.min(i,r)};function b(t,e,r){var a=t[0].trace,o=a.marker||{},s=o.line||{},u=r?a.visible&&a.type===r:i.traceIs(a,"bar"),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(u?[t]:[]);c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",_),c.exit().remove(),c.each((function(t){var e=n.select(this),r=t[0],i=x(r.mlw,o.line,5,2);e.style("stroke-width",i+"px").call(l.fill,r.mc||o.color),i&&l.stroke(e,r.mlc||s.color)}))}function w(t,e,r){var o=t[0],s=o.trace,l=r?s.visible&&s.type===r:i.traceIs(s,r),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(l?[t]:[]);if(u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",_),u.exit().remove(),u.size()){var c=(s.marker||{}).line,f=x(h(c.width,o.pts),c,5,2),d=a.minExtend(s,{marker:{line:{width:f}}});d.marker.line.color=c.color;var m=a.minExtend(o,{trace:d});p(u,m,d)}}t.each((function(t){var e=n.select(this),i=a.ensureSingle(e,"g","layers");i.style("opacity",t[0].trace.opacity);var s=r.valign,l=t[0].lineHeight,u=t[0].height;if("middle"!==s&&l&&u){var c={top:1,bottom:-1}[s]*(.5*(l-u+3));i.attr("transform",o(0,c))}else i.attr("transform",null);i.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),i.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var p=i.selectAll("g.legendsymbols").data([t]);p.enter().append("g").classed("legendsymbols",!0),p.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,i=t[0].trace,o=[];if(i.visible)switch(i.type){case"histogram2d":case"heatmap":o=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":o=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":o=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":o=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":o=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":o=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var c=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(o);c.enter().append("path").classed("legend3dandfriends",!0).attr("transform",_).style("stroke-miterlimit",1),c.exit().remove(),c.each((function(t,o){var c,p=n.select(this),h=u(i),f=h.colorscale,m=h.reversescale;if(f){if(!r){var y=f.length;c=0===o?f[m?y-1:0][1]:1===o?f[m?0:y-1][1]:f[Math.floor((y-1)/2)][1]}}else{var g=i.vertexcolor||i.facecolor||i.color;c=a.isArrayOrTypedArray(g)?g[o]||g[0]:g}p.attr("d",t[0]),c?p.call(l.fill,c):p.call((function(t){if(t.size()){var n="legendfill-"+i.uid;s.gradient(t,e,n,d(m,"radial"===r),f,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var i=t[0].trace[t[0].dir].marker;return t[0].mc=i.color,t[0].mlw=i.line.width,t[0].mlc=i.line.color,b(t,this,"waterfall")}var a=[];e.visible&&r&&(a=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(a);o.enter().append("path").classed("legendwaterfall",!0).attr("transform",_).style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),i=e[t[0]].marker,a=x(void 0,i.line,5,2);r.attr("d",t[1]).style("stroke-width",a+"px").call(l.fill,i.color),a&&r.call(l.stroke,i.line.color)}))})).each((function(t){b(t,this,"funnel")})).each((function(t){b(t,this)})).each((function(t){var r=t[0].trace,o=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&i.traceIs(r,"box-violin")?[t]:[]);o.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",_),o.exit().remove(),o.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var i=x(void 0,r.line,5,2);t.style("stroke-width",i+"px").call(l.fill,r.fillcolor),i&&l.stroke(t,r.line.color)}else{var u=a.minExtend(r,{marker:{size:y?12:a.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});o.call(s.pointStyle,u,e)}}))})).each((function(t){w(t,this,"funnelarea")})).each((function(t){w(t,this,"pie")})).each((function(t){var r,i,o=t[0],l=o.trace,p=l.visible&&l.fill&&"none"!==l.fill,h=c.hasLines(l),f=l.contours,m=!1,y=!1,v=u(l),_=v.colorscale,b=v.reversescale;if(f){var w=f.coloring;"lines"===w?m=!0:h="none"===w||"heatmap"===w||f.showlines,"constraint"===f.type?p="="!==f._operation:"fill"!==w&&"heatmap"!==w||(y=!0)}var T=c.hasMarkers(l)||c.hasText(l),k=p||y,A=h||m,M=T||!k?"M5,0":A?"M5,-2":"M5,-3",S=n.select(this),C=S.select(".legendfill").selectAll("path").data(p||y?[t]:[]);if(C.enter().append("path").classed("js-fill",!0),C.exit().remove(),C.attr("d",M+"h"+g+"v6h-"+g+"z").call(p?s.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+l.uid;s.gradient(t,e,r,d(b),_,"fill")}}),h||m){var L=x(void 0,l.line,10,5);i=a.minExtend(l,{line:{width:L}}),r=[a.minExtend(o,{trace:i})]}var E=S.select(".legendlines").selectAll("path").data(h||m?[r]:[]);E.enter().append("path").classed("js-line",!0),E.exit().remove(),E.attr("d",M+(m?"l"+g+",0.0001":"h"+g)).call(h?s.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+l.uid;s.lineGroupStyle(t),s.gradient(t,e,r,d(b),_,"stroke")}})})).each((function(t){var r,i,o=t[0],l=o.trace,u=c.hasMarkers(l),p=c.hasText(l),h=c.hasLines(l);function f(t,e,r,n){var i=a.nestedProperty(l,t).get(),o=a.isArrayOrTypedArray(i)&&e?e(i):i;if(y&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function d(t){return o._distinct&&o.index&&t[o.index]?t[o.index]:t[0]}if(u||p||h){var m={},g={};if(u){m.mc=f("marker.color",d),m.mx=f("marker.symbol",d),m.mo=f("marker.opacity",a.mean,[.2,1]),m.mlc=f("marker.line.color",d),m.mlw=f("marker.line.width",a.mean,[0,5],2),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var v=f("marker.size",a.mean,[2,16],12);m.ms=v,g.marker.size=v}h&&(g.line={width:f("line.width",d,[0,10],5)}),p&&(m.tx="Aa",m.tp=f("textposition",d),m.ts=10,m.tc=f("textfont.color",d),m.tf=f("textfont.family",d)),r=[a.minExtend(o,m)],(i=a.minExtend(l,g)).selectedpoints=null,i.texttemplate=null}var x=n.select(this).select("g.legendpoints"),b=x.selectAll("path.scatterpts").data(u?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",_),b.exit().remove(),b.call(s.pointStyle,i,e),u&&(r[0].mrc=3);var w=x.selectAll("g.pointtext").data(p?r:[]);w.enter().append("g").classed("pointtext",!0).append("text").attr("transform",_),w.exit().remove(),w.selectAll("text").call(s.textPointStyle,i,e)})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.visible&&"candlestick"===e.type?[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",_).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var i=n.select(this),a=e[r?"increasing":"decreasing"],o=x(void 0,a.line,5,2);i.style("stroke-width",o+"px").call(l.fill,a.fillcolor),o&&l.stroke(i,a.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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",_).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var i=n.select(this),a=e[r?"increasing":"decreasing"],o=x(void 0,a.line,5,2);i.style("fill","none").call(s.dashLine,a.line.dash,o),o&&l.stroke(i,a.line.color)}))}))}},{"../../lib":211,"../../registry":306,"../../traces/pie/helpers":334,"../../traces/pie/style_one":335,"../../traces/scatter/subtypes":362,"../color":82,"../colorscale/helpers":93,"../drawing":104,"./constants":133,d3:16}],141:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/plots"),a=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),s=t("../shapes/draw").eraseActiveShape,l=t("../../lib"),u=l._,c=e.exports={};function p(t,e){var r,i,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,u=t._fullLayout,c={},p=a.list(t,null,!0),h=u._cartesianSpikesEnabled;if("zoom"===s){var f,d="in"===l?.5:2,m=(1+d)/2,y=(1-d)/2;for(i=0;i1?(C=["toggleHover"],L=["resetViews"]):d?(S=["zoomInGeo","zoomOutGeo"],C=["hoverClosestGeo"],L=["resetGeo"]):f?(C=["hoverClosest3d"],L=["resetCameraDefault3d","resetCameraLastSave3d"]):_?(S=["zoomInMapbox","zoomOutMapbox"],C=["toggleHover"],L=["resetViewMapbox"]):g?C=["hoverClosestGl2d"]:m?C=["hoverClosestPie"]:b?(C=["hoverClosestCartesian","hoverCompareCartesian"],L=["resetViewSankey"]):C=["toggleHover"];h&&(C=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var m=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),i=0,a=0;a=n.max)e=F[r+1];else if(t=n.pmax)e=F[r+1];else if(t0?h+u:u;return{ppad:u,ppadplus:c?d:m,ppadminus:c?m:d}}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,p,h=1/0,f=-1/0,d=n.match(a.segmentRE);for("date"===t.type&&(s=o.decodeDate(s)),l=0;lf&&(f=p)));return f>=h?[h,f]: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;ov?(k=p,C="y0",A=v,L="y1"):(k=v,C="y1",A=p,L="y0");Y(n),Q(s,r),function(t,e,r){var n=e.xref,i=e.yref,o=a.getFromId(r,n),s=a.getFromId(r,i),l="";"paper"===n||o.autorange||(l+=n);"paper"===i||s.autorange||(l+=i);c.setClipUrl(t,l?"clip"+r._fullLayout._uid+l:null,r)}(e,r,t),W.moveFn="move"===P?K:J,W.altKey=n.altKey},doneFn:function(){if(g(t))return;f(e),$(s),x(e,t,r),n.call("_guiRelayout",t,l.getUpdateObj())},clickFn:function(){if(g(t))return;$(s)}};function Y(r){if(g(t))P=null;else if(R)P="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=W.element.getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top,o=r.clientX-n.left,s=r.clientY-n.top,l=!F&&i>10&&a>10&&!r.shiftKey?h.getCursor(o/i,1-s/a):"move";f(e,l),P=l.split("-")[0]}}function K(n,i){if("path"===r.type){var a=function(t){return t},o=a,l=a;D?B("xanchor",r.xanchor=Z(_+n)):(o=function(t){return Z(q(t)+n)},N&&"date"===N.type&&(o=m.encodeDate(o))),O?B("yanchor",r.yanchor=G(T+i)):(l=function(t){return G(H(t)+i)},j&&"date"===j.type&&(l=m.encodeDate(l))),B("path",r.path=w(z,o,l))}else D?B("xanchor",r.xanchor=Z(_+n)):(B("x0",r.x0=Z(u+n)),B("x1",r.x1=Z(y+n))),O?B("yanchor",r.yanchor=G(T+i)):(B("y0",r.y0=G(p+i)),B("y1",r.y1=G(v+i)));e.attr("d",b(t,r)),Q(s,r)}function J(n,i){if(F){var a=function(t){return t},o=a,l=a;D?B("xanchor",r.xanchor=Z(_+n)):(o=function(t){return Z(q(t)+n)},N&&"date"===N.type&&(o=m.encodeDate(o))),O?B("yanchor",r.yanchor=G(T+i)):(l=function(t){return G(H(t)+i)},j&&"date"===j.type&&(l=m.encodeDate(l))),B("path",r.path=w(z,o,l))}else if(R){if("resize-over-start-point"===P){var c=u+n,h=O?p-i:p+i;B("x0",r.x0=D?c:Z(c)),B("y0",r.y0=O?h:G(h))}else if("resize-over-end-point"===P){var f=y+n,d=O?v-i:v+i;B("x1",r.x1=D?f:Z(f)),B("y1",r.y1=O?d:G(d))}}else{var g=function(t){return-1!==P.indexOf(t)},x=g("n"),U=g("s"),V=g("w"),X=g("e"),W=x?k+i:k,Y=U?A+i:A,K=V?M+n:M,J=X?S+n:S;O&&(x&&(W=k-i),U&&(Y=A-i)),(!O&&Y-W>10||O&&W-Y>10)&&(B(C,r[C]=O?W:G(W)),B(L,r[L]=O?Y:G(Y))),J-K>10&&(B(E,r[E]=D?K:Z(K)),B(I,r[I]=D?J:Z(J)))}e.attr("d",b(t,r)),Q(s,r)}function Q(t,e){(D||O)&&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=q(D?e.xanchor:i.midRange(r?[e.x0,e.x1]:m.extractPathCoords(e.path,d.paramIsX))),o=H(O?e.yanchor:i.midRange(r?[e.y0,e.y1]:m.extractPathCoords(e.path,d.paramIsY)));if(a=m.roundPositionForSharpStrokeRendering(a,1),o=m.roundPositionForSharpStrokeRendering(o,1),D&&O){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(D){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 $(t){t.selectAll(".visual-cue").remove()}h.init(W),X.node().onmousemove=Y}(t,D,l,e,r,P):!0===l.editable&&D.style("pointer-events",I||u.opacity(S)*M<=.5?"stroke":"all");D.node().addEventListener("click",(function(){return function(t,e){if(!v(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void T(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=T,y(t)}}(t,D)}))}}function x(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");c.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function b(t,e){var r,n,o,s,l,u,c,p,h=e.type,f=a.getRefType(e.xref),y=a.getRefType(e.yref),g=a.getFromId(t,e.xref),v=a.getFromId(t,e.yref),_=t._fullLayout._size;if(g?"domain"===f?n=function(t){return g._offset+g._length*t}:(r=m.shapePositionToRange(g),n=function(t){return g._offset+g.r2p(r(t,!0))}):n=function(t){return _.l+_.w*t},v?"domain"===y?s=function(t){return v._offset+v._length*(1-t)}:(o=m.shapePositionToRange(v),s=function(t){return v._offset+v.r2p(o(t,!0))}):s=function(t){return _.t+_.h*(1-t)},"path"===h)return g&&"date"===g.type&&(n=m.decodeDate(n)),v&&"date"===v.type&&(s=m.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(d.segmentRE,(function(t){var n=0,u=t.charAt(0),c=d.paramIsX[u],p=d.paramIsY[u],h=d.numParams[u],f=t.substr(1).replace(d.paramRE,(function(t){return c[n]?t="pixel"===a?e(s)+Number(t):e(t):p[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>h&&(t="X"),t}));return n>h&&(f=f.replace(/[\s,]*X.*/,""),i.log("Ignoring extra params in segment "+t)),u+f}))}(e,n,s);if("pixel"===e.xsizemode){var x=n(e.xanchor);l=x+e.x0,u=x+e.x1}else l=n(e.x0),u=n(e.x1);if("pixel"===e.ysizemode){var b=s(e.yanchor);c=b-e.y0,p=b-e.y1}else c=s(e.y0),p=s(e.y1);if("line"===h)return"M"+l+","+c+"L"+u+","+p;if("rect"===h)return"M"+l+","+c+"H"+u+"V"+p+"H"+l+"Z";var w=(l+u)/2,T=(c+p)/2,k=Math.abs(w-l),A=Math.abs(T-c),M="A"+k+","+A,S=w+k+","+T;return"M"+S+M+" 0 1,1 "+(w+","+(T-A))+M+" 0 0,1 "+S+"Z"}function w(t,e,r){return t.replace(d.segmentRE,(function(t){var n=0,i=t.charAt(0),a=d.paramIsX[i],o=d.paramIsY[i],s=d.numParams[i];return i+t.substr(1).replace(d.paramRE,(function(t){return n>=s||(a[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function T(t){v(t)&&(t._fullLayout._activeShapeIndex>=0&&(l(t),delete t._fullLayout._activeShapeIndex,y(t)))}e.exports={draw:y,drawOne:_,eraseActiveShape:function(t){if(!v(t))return;l(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&p(g),r.attr("d",m(e)),A&&!h)&&(k=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===T&&(t[0][0]="M"),e[w]=t,v(),_())}}()}}function z(t,r){!function(t,r){if(e.length)for(var n=0;n0&&l0&&(s=s.transition().duration(e.transition.duration).ease(e.transition.easing)),s.attr("transform",l(o-.5*p.gripWidth,e._dims.currentValueTotalHeight))}}function C(t,e){var r=t._dims;return r.inputAreaStart+p.stepInset+(r.inputAreaLength-2*p.stepInset)*Math.min(1,Math.max(0,e))}function L(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-p.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*p.stepInset-2*r.inputAreaStart)))}function E(t,e,r){var n=r._dims,i=s.ensureSingle(t,"rect",p.railTouchRectClass,(function(n){n.call(A,e,t,r).style("pointer-events","all")}));i.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,p.tickOffset+r.ticklen+n.labelHeight)}).call(a.fill,r.bgcolor).attr("opacity",0),o.setTranslate(i,0,n.currentValueTotalHeight)}function I(t,e){var r=e._dims,n=r.inputAreaLength-2*p.railInset,i=s.ensureSingle(t,"rect",p.railRectClass);i.attr({width:n,height:p.railWidth,rx:p.railRadius,ry:p.railRadius,"shape-rendering":"crispEdges"}).call(a.stroke,e.bordercolor).call(a.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(i,p.railInset,.5*(r.inputAreaWidth-p.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[p.name],n=[],i=0;i0?[0]:[]);function s(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),i.autoMargin(t,y(e))}if(a.enter().append("g").classed(p.containerClassName,!0).style("cursor","ew-resize"),a.exit().each((function(){n.select(this).selectAll("g."+p.groupClassName).each(s)})).remove(),0!==r.length){var l=a.selectAll("g."+p.groupClassName).data(r,g);l.enter().append("g").classed(p.groupClassName,!0),l.exit().each(s).remove();for(var u=0;u0||h<0){var g={left:[-d,0],right:[d,0],top:[0,-d],bottom:[0,d]}[x.side];e.attr("transform",l(g[0],g[1]))}}}return O.call(R),P&&(C?O.on(".opacity",null):(A=0,M=!0,O.text(v).on("mouseover.opacity",(function(){n.select(this).transition().duration(h.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(h.HIDE_PLACEHOLDER).style("opacity",0)}))),O.call(p.makeEditable,{gd:t}).on("edit",(function(e){void 0!==_?o.call("_guiRestyle",t,g,e,_):o.call("_guiRelayout",t,g,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(R)})).on("input",(function(t){this.text(t||" ").call(p.positionText,b.x,b.y)}))),O.classed("js-placeholder",M),T}}},{"../../constants/alignment":184,"../../constants/interactions":187,"../../lib":211,"../../lib/svg_text_utils":232,"../../plots/plots":297,"../../registry":306,"../color":82,"../drawing":104,d3:16,"fast-isnumeric":18}],178:[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"}]},args2:{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":203,"../../plot_api/edit_types":238,"../../plot_api/plot_template":245,"../../plots/font_attributes":284,"../../plots/pad_attributes":296,"../color/attributes":81}],179:[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"}}},{}],180:[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("args2"),r("label"),r("execute"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":211,"../../plots/array_container_defaults":251,"./attributes":178,"./constants":179}],181:[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,p=t("./constants"),h=t("./scrollbox");function f(t){return t._index}function d(t,e){return+t.attr(p.menuIndexAttrName)===e._index}function m(t,e,r,n,i,a,o,s){e.active=o,u(t.layout,p.name,e).applyUpdate("active",o),"buttons"===e.type?g(t,n,null,null,e):"dropdown"===e.type&&(i.attr(p.menuIndexAttrName,"-1"),y(t,n,i,a,e),s||g(t,n,i,a,e))}function y(t,e,r,n,i){var a=s.ensureSingle(e,"g",p.headerClassName,(function(t){t.style("pointer-events","all")})),l=i._dims,u=i.active,c=i.buttons[u]||p.blankHeaderOpts,h={y:i.pad.t,yPad:0,x:i.pad.l,xPad:0,index:0},f={width:l.headerWidth,height:l.headerHeight};a.call(v,i,c,t).call(M,i,h,f),s.ensureSingle(e,"text",p.headerArrowClassName,(function(t){t.attr("text-anchor","end").call(o.font,i.font).text(p.arrowSymbol[i.direction])})).attr({x:l.headerWidth-p.arrowOffsetX+i.pad.l,y:l.headerHeight/2+p.textOffsetY+i.pad.t}),a.on("click",(function(){r.call(S,String(d(r,i)?-1:i._index)),g(t,e,r,n,i)})),a.on("mouseover",(function(){a.call(w)})),a.on("mouseout",(function(){a.call(T,i)})),o.setTranslate(e,l.lx,l.ly)}function g(t,e,r,a,o){r||(r=e).attr("pointer-events","all");var l=function(t){return-1==+t.attr(p.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,u="dropdown"===o.type?p.dropdownButtonClassName:p.buttonClassName,c=r.selectAll("g."+u).data(s.filterVisible(l)),h=c.enter().append("g").classed(u,!0),f=c.exit();"dropdown"===o.type?(h.attr("opacity","0").transition().attr("opacity","1"),f.transition().attr("opacity","0").remove()):f.remove();var d=0,y=0,g=o._dims,_=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(_?y=g.headerHeight+p.gapButtonHeader:d=g.headerWidth+p.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(y=-p.gapButtonHeader+p.gapButton-g.openHeight),"dropdown"===o.type&&"left"===o.direction&&(d=-p.gapButtonHeader+p.gapButton-g.openWidth);var x={x:g.lx+d+o.pad.l,y:g.ly+y+o.pad.t,yPad:p.gapButton,xPad:p.gapButton,index:0},k={l:x.x+o.borderwidth,t:x.y+o.borderwidth};c.each((function(s,l){var u=n.select(this);u.call(v,o,s,t).call(M,o,x),u.on("click",(function(){n.event.defaultPrevented||(s.execute&&(s.args2&&o.active===l?(m(t,o,0,e,r,a,-1),i.executeAPICommand(t,s.method,s.args2)):(m(t,o,0,e,r,a,l),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(T,o),c.call(b,o)}))})),c.call(b,o),_?(k.w=Math.max(g.openWidth,g.headerWidth),k.h=x.y-k.t):(k.w=x.x-k.l,k.h=Math.max(g.openHeight,g.headerHeight)),k.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,f=i.active;if(c)for(s=0,l=0;l0?[0]:[]);if(o.enter().append("g").classed(p.containerClassName,!0).style("cursor","pointer"),o.exit().each((function(){n.select(this).selectAll("g."+p.headerGroupClassName).each(a)})).remove(),0!==r.length){var l=o.selectAll("g."+p.headerGroupClassName).data(r,f);l.enter().append("g").classed(p.headerGroupClassName,!0);for(var u=s.ensureSingle(o,"g",p.dropdownButtonGroupClassName,(function(t){t.style("pointer-events","all")})),c=0;cw,A=s.barLength+2*s.barPad,M=s.barWidth+2*s.barPad,S=d,C=y+g;C+M>u&&(C=u-M);var L=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);L.exit().on(".drag",null).remove(),L.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,s.barColor),k?(this.hbar=L.attr({rx:s.barRadius,ry:s.barRadius,x:S,y:C,width:A,height:M}),this._hbarXMin=S+A/2,this._hbarTranslateMax=w-A):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var E=g>T,I=s.barWidth+2*s.barPad,z=s.barLength+2*s.barPad,P=d+m,D=y;P+I>l&&(P=l-I);var O=this.container.selectAll("rect.scrollbar-vertical").data(E?[0]:[]);O.exit().on(".drag",null).remove(),O.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,s.barColor),E?(this.vbar=O.attr({rx:s.barRadius,ry:s.barRadius,x:P,y:D,width:I,height:z}),this._vbarYMin=D+z/2,this._vbarTranslateMax=T-z):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=c-.5,B=E?p+I+.5:p+.5,N=h-.5,U=k?f+M+.5:f+.5,j=o._topdefs.selectAll("#"+R).data(k||E?[0]:[]);if(j.exit().remove(),j.enter().append("clipPath").attr("id",R).append("rect"),k||E?(this._clipRect=j.select("rect").attr({x:Math.floor(F),y:Math.floor(N),width:Math.ceil(B)-Math.floor(F),height:Math.ceil(U)-Math.floor(N)}),this.container.call(a.setClipUrl,R,this.gd),this.bg.attr({x:d,y:y,width:m,height:g})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),k||E){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 q=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),E&&this.vbar.on(".drag",null).call(q)}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":211,"../color":82,"../drawing":104,d3:16}],184:[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"}}},{}],185:[function(t,e,r){"use strict";e.exports={axisRefDescription:function(t,e,r){return["If set to a",t,"axis id (e.g. *"+t+"* or","*"+t+"2*), the `"+t+"` position refers to a",t,"coordinate. If set to *paper*, the `"+t+"`","position refers to the distance from the",e,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",e,"("+r+"). If set to a",t,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",e,"of the domain of that axis: e.g.,","*"+t+"2 domain* refers to the domain of the second",t," axis and a",t,"position of 0.5 refers to the","point between the",e,"and the",r,"of the domain of the","second",t,"axis."].join(" ")}}},{}],186:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],187:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],188:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],189:[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}},{}],190:[function(t,e,r){"use strict";r.version=t("./version").version,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;splotly-logomark"}}},{}],193:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],194:[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 p(t,e,r,n,i,a,u){i=i||0,a=a||0;var c,p,h,f,d,m=l([r,n]);function y(t,e){return[t*Math.cos(e)+i,a-t*Math.sin(e)]}m?(c=0,p=o,h=s):r=i&&t<=a);var i,a},pathArc:function(t,e,r,n,i){return p(null,t,e,r,n,i,0)},pathSector:function(t,e,r,n,i){return p(null,t,e,r,n,i,1)},pathAnnulus:function(t,e,r,n,i,a){return p(t,e,r,n,i,a,1)}}},{"./mod":218}],195:[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=b(e),g=t.charAt(0);!u||"G"!==g&&"g"!==g||(t=t.substr(1),e="");var w=u&&"chinese"===e.substr(0,7),T=t.match(w?_:v);if(!T)return c;var k=T[1],A=T[3]||"1",M=Number(T[5]||1),S=Number(T[7]||0),C=Number(T[9]||0),L=Number(T[11]||0);if(u){if(2===k.length)return c;var E;k=Number(k);try{var I=y.getComponentMethod("calendars","getCal")(e);if(w){var z="i"===A.charAt(A.length-1);A=parseInt(A,10),E=I.newDate(k,I.toMonthIndex(k,A,z),M)}else E=I.newDate(k,Number(A),M)}catch(t){return c}return E?(E.toJD()-m)*p+S*h+C*f+L*d:c}k=2===k.length?(Number(k)+2e3-x)%100+x:Number(k),A-=1;var P=new Date(Date.UTC(2e3,A,M,S,C));return P.setUTCFullYear(k),P.getUTCMonth()!==A||P.getUTCDate()!==M?c:P.getTime()+L*d},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 T=90*p,k=3*h,A=5*f;function M(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,v,_,x=Math.floor(10*l(t+.05,1)),w=Math.round(t-x/10);if(b(r)){var S=Math.floor(w/p)+m,C=Math.floor(l(t,p));try{a=y.getComponentMethod("calendars","getCal")(r).fromJD(S).formatDate("yyyy-mm-dd")}catch(t){a=g("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+p&&t<=i-p))return c;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return M(a("%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(b(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 S=/%\d?f/g;function C(t,e,r,n){t=t.replace(S,(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(b(n))try{t=y.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=b(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,p),n=w(Math.floor(r/h),2)+":"+w(l(Math.floor(r/f),60),2);if("M"!==e){o(e)||(e=0);var i=(100+Math.min(l(t/d,60),L[e])).toFixed(e).substr(1);e>0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}(t,r)+"\n"+C(a.dayMonthYear,t,n,i);e=a.dayMonth+"\n"+a.year}return C(e,t,n,i)};var E=3*p;r.incrementMonth=function(t,e,r){r=b(r)&&r;var n=l(t,p);if(t=Math.round(t-n),r)try{var i=Math.round(t/p)+m,a=y.getComponentMethod("calendars","getCal")(r),o=a.fromJD(i);return e%12?a.add(o,e,"m"):a.add(o,e/12,"y"),(o.toJD()-m)*p+n}catch(e){s.error("invalid ms "+t+" in calendar "+r)}var u=new Date(t+E);return u.setUTCMonth(u.getUTCMonth()+e)+n-E},r.findExactDates=function(t,e){for(var r,n,i=0,a=0,s=0,l=0,u=b(e)&&y.getComponentMethod("calendars","getCal")(e),c=0;c0&&t[e+1][0]<0)return e;return null}switch(e="RUS"===s||"FJI"===s?function(t){var e;if(null===u(t))e=t;else for(e=new Array(t.length),i=0;ie?r[n++]=[t[i][0]+360,t[i][1]]:i===e?(r[n++]=t[i],r[n++]=[t[i][0],-90]):r[n++]=t[i];var a=h.tester(r);a.pts.pop(),l.push(a)}:function(t){l.push(h.tester(t))},a.type){case"MultiPolygon":for(r=0;ri&&(i=u,e=l)}else e=r;return o.default(e).geometry.coordinates}(c),n.fIn=t,n.fOut=c,s.push(c)}else u.log(["Location",n.loc,"does not have a valid GeoJSON geometry.","Traces with locationmode *geojson-id* only support","*Polygon* and *MultiPolygon* geometries."].join(" "))}delete i[r]}switch(r.type){case"FeatureCollection":var h=r.features;for(n=0;n100?(clearInterval(a),n("Unexpected error while fetching from "+t)):void i++}),50)}))}for(var o=0;o0&&(r.push(i),i=[])}return i.length>0&&r.push(i),r},r.makeLine=function(t){return 1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}},r.makePolygon=function(t){if(1===t.length)return{type:"Polygon",coordinates:t};for(var e=new Array(t.length),r=0;r1||m<0||m>1?null:{x:t+l*m,y:e+p*m}}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,p=n-e,h=o-i,f=u-a,d=c*c+p*p,m=h*h+f*f,y=Math.min(l(c,p,d,i-t,a-e),l(c,p,d,o-t,u-e),l(h,f,m,t-i,e-a),l(h,f,m,r-i,n-a));return Math.sqrt(y)},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)),p=t.getPointAtLength(o(r,e)),h={x:(4*p.x+l.x+u.x)/6,y:(4*p.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(),p=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,p=r.yl?r.y-l:0;return Math.sqrt(u*u+p*p)}for(var f=h(u);f;){if((u+=f+r)>p)return;f=h(u)}for(f=h(p);f;){if(u>(p-=f+r))return;f=h(p)}return{min:u,max:p,len:p-u,total:c,isClosed:0===u&&p===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,p=0,h=0,f=s;p0?f=i:h=i,p++}return a}},{"./mod":218}],209:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],210:[function(t,e,r){"use strict";e.exports=function(t,e){if(!e)return t;var r=1/Math.abs(e),n=r>1?(r*t+r*e)/r:t+e,i=String(n).length;if(i>16){var a=String(e).length;if(i>=String(t).length+a){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],211:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../constants/numerical"),s=o.FP_SAFE,l=o.BADNUM,u=e.exports={};u.nestedProperty=t("./nested_property"),u.keyedContainer=t("./keyed_container"),u.relativeAttr=t("./relative_attr"),u.isPlainObject=t("./is_plain_object"),u.toLogRange=t("./to_log_range"),u.relinkPrivateKeys=t("./relink_private");var c=t("./array");u.isTypedArray=c.isTypedArray,u.isArrayOrTypedArray=c.isArrayOrTypedArray,u.isArray1D=c.isArray1D,u.ensureArray=c.ensureArray,u.concat=c.concat,u.maxRowLength=c.maxRowLength,u.minRowLength=c.minRowLength;var p=t("./mod");u.mod=p.mod,u.modHalf=p.modHalf;var h=t("./coerce");u.valObjectMeta=h.valObjectMeta,u.coerce=h.coerce,u.coerce2=h.coerce2,u.coerceFont=h.coerceFont,u.coerceHoverinfo=h.coerceHoverinfo,u.coerceSelectionMarkerOpacity=h.coerceSelectionMarkerOpacity,u.validate=h.validate;var f=t("./dates");u.dateTime2ms=f.dateTime2ms,u.isDateTime=f.isDateTime,u.ms2DateTime=f.ms2DateTime,u.ms2DateTimeLocal=f.ms2DateTimeLocal,u.cleanDate=f.cleanDate,u.isJSDate=f.isJSDate,u.formatDate=f.formatDate,u.incrementMonth=f.incrementMonth,u.dateTick0=f.dateTick0,u.dfltRange=f.dfltRange,u.findExactDates=f.findExactDates,u.MIN_MS=f.MIN_MS,u.MAX_MS=f.MAX_MS;var d=t("./search");u.findBin=d.findBin,u.sorterAsc=d.sorterAsc,u.sorterDes=d.sorterDes,u.distinctVals=d.distinctVals,u.roundUp=d.roundUp,u.sort=d.sort,u.findIndexOfMin=d.findIndexOfMin;var m=t("./stats");u.aggNums=m.aggNums,u.len=m.len,u.mean=m.mean,u.median=m.median,u.midRange=m.midRange,u.variance=m.variance,u.stdev=m.stdev,u.interp=m.interp;var y=t("./matrix");u.init2dArray=y.init2dArray,u.transposeRagged=y.transposeRagged,u.dot=y.dot,u.translationMatrix=y.translationMatrix,u.rotationMatrix=y.rotationMatrix,u.rotationXYMatrix=y.rotationXYMatrix,u.apply3DTransform=y.apply3DTransform,u.apply2DTransform=y.apply2DTransform,u.apply2DTransform2=y.apply2DTransform2,u.convertCssMatrix=y.convertCssMatrix,u.inverseTransformMatrix=y.inverseTransformMatrix;var g=t("./angles");u.deg2rad=g.deg2rad,u.rad2deg=g.rad2deg,u.angleDelta=g.angleDelta,u.angleDist=g.angleDist,u.isFullCircle=g.isFullCircle,u.isAngleInsideSector=g.isAngleInsideSector,u.isPtInsideSector=g.isPtInsideSector,u.pathArc=g.pathArc,u.pathSector=g.pathSector,u.pathAnnulus=g.pathAnnulus;var v=t("./anchor_utils");u.isLeftAnchor=v.isLeftAnchor,u.isCenterAnchor=v.isCenterAnchor,u.isRightAnchor=v.isRightAnchor,u.isTopAnchor=v.isTopAnchor,u.isMiddleAnchor=v.isMiddleAnchor,u.isBottomAnchor=v.isBottomAnchor;var _=t("./geometry2d");u.segmentsIntersect=_.segmentsIntersect,u.segmentDistance=_.segmentDistance,u.getTextLocation=_.getTextLocation,u.clearLocationCache=_.clearLocationCache,u.getVisibleSegment=_.getVisibleSegment,u.findPointOnPath=_.findPointOnPath;var x=t("./extend");u.extendFlat=x.extendFlat,u.extendDeep=x.extendDeep,u.extendDeepAll=x.extendDeepAll,u.extendDeepNoArrays=x.extendDeepNoArrays;var b=t("./loggers");u.log=b.log,u.warn=b.warn,u.error=b.error;var w=t("./regex");u.counterRegex=w.counter;var T=t("./throttle");u.throttle=T.throttle,u.throttleDone=T.done,u.clearThrottle=T.clear;var k=t("./dom");function A(t){var e={};for(var r in t)for(var n=t[r],i=0;is?l:a(t)?Number(t):l:l},u.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(a(t)&&t>=0&&t%1==0)},u.noop=t("./noop"),u.identity=t("./identity"),u.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))},u.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},u.simpleMap=function(t,e,r,n,i){for(var a=t.length,o=new Array(a),s=0;s=Math.pow(2,r)?i>10?(u.warn("randstr failed uniqueness"),l):t(e,r,n,(i||0)+1):l},u.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},u.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},u.syncOrAsync=function(t,e,r){var n;function i(){return u.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,u.promiseError);return r&&r(e)},u.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},u.noneOrAll=function(t,e,r){if(t){var n,i=!1,a=!0;for(n=0;n0?e:0}))},u.fillArray=function(t,e,r,n){if(n=n||u.identity,u.isArrayOrTypedArray(t))for(var i=0;i1?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},u.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var I=/^\w*$/;u.templateString=function(t,e){var r={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,n){var i;return I.test(n)?i=e[n]:(r[n]=r[n]||u.nestedProperty(e,n).get,i=r[n]()),u.isValidTextValue(i)?i:""}))};var z={max:10,count:0,name:"hovertemplate"};u.hovertemplateString=function(){return O.apply(z,arguments)};var P={max:10,count:0,name:"texttemplate"};u.texttemplateString=function(){return O.apply(P,arguments)};var D=/^[:|\|]/;function O(t,e,r){var a=this,o=arguments;e||(e={});var s={};return t.replace(u.TEMPLATE_STRING_REGEX,(function(t,l,c){var p,h,f,d;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 R=2e9;u.seedPseudoRandom=function(){R=2e9},u.pseudoRandom=function(){var t=R;return R=(69069*R+1)%4294967296,Math.abs(R-t)<429496729?u.pseudoRandom():R/4294967296},u.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},i=u.extractOption(t,e,"htx","hovertext");if(u.isValidTextValue(i))return n(i);var a=u.extractOption(t,e,"tx","text");return u.isValidTextValue(a)?n(a):void 0},u.isValidTextValue=function(t){return t||0===t},u.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(c=1):c=0,u.strTranslate(i-c*(r+o),a-c*(n+s))+u.strScale(c)+(l?"rotate("+l+(e?"":" "+r+" "+n)+")":"")},u.ensureUniformFontSize=function(t,e){var r=u.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r},u.join2=function(t,e,r){var n=t.length;return n>1?t.slice(0,-1).join(e)+r+t[n-1]:t.join(e)}},{"../constants/numerical":188,"./anchor_utils":193,"./angles":194,"./array":195,"./clean_number":196,"./clear_responsive":198,"./coerce":199,"./dates":200,"./dom":201,"./extend":203,"./filter_unique":204,"./filter_visible":205,"./geometry2d":208,"./identity":209,"./increment":210,"./is_plain_object":212,"./keyed_container":213,"./localize":214,"./loggers":215,"./make_trace_groups":216,"./matrix":217,"./mod":218,"./nested_property":219,"./noop":220,"./notifier":221,"./push_unique":224,"./regex":226,"./relative_attr":227,"./relink_private":228,"./search":229,"./stats":231,"./throttle":233,"./to_log_range":234,d3:16,"d3-time-format":14,"fast-isnumeric":18}],212:[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}},{}],213:[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(p){for(o=e;o1){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},a.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},a.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":243,"./notifier":221}],216:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var i=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));i.exit().remove(),i.enter().append("g").attr("class",r),i.order();var a=t.classed("rangeplot")?"nodeRangePlot3":"node3";return i.each((function(t){t[0][a]=n.select(this)})),i}},{d3:16}],217:[function(t,e,r){"use strict";var n=t("gl-mat4");r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],219:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./array").isArrayOrTypedArray;function a(t,e){return function(){var r,n,o,s,l,u=t;for(s=0;s/g),l=0;la||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,p,h,f,d,m=r.length,y=r[0][0],g=r[0][1],v=0;for(c=1;cMath.max(p,y)||u>Math.max(h,g)))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 o(o){t.push(o);var s=r.length,l=n;r.splice(i+1);for(var u=l+1;u1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":188,"./matrix":217}],224:[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 c(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,o,p=0,h=e.length,f=0,d=h>1?(e[h-1]-e[0])/(h-1):1;for(o=d>=0?r?s:l:r?c:u,t+=1e-9*d*(r?-1:1)*(d>=0?1:-1);p90&&i.log("Long binary search..."),p-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t,e){var n,i=(e||{}).unitMinDiff,a=t.slice();for(a.sort(r.sorterAsc),n=a.length-1;n>-1&&a[n]===o;n--);var s=1;i||(s=a[n]-a[0]||1);for(var l,u=s/(n||1)/1e4,c=[],p=0;p<=n;p++){var h=a[p],f=h-l;void 0===l?(c.push(h),l=h):f>u&&(s=Math.min(s,f),c.push(h),l=h)}return{vals:c,minDiff:s}},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":195,"fast-isnumeric":18}],232:[function(t,e,r){"use strict";var n=t("d3"),i=t("../lib"),a=i.strTranslate,o=t("../constants/xmlns_namespaces"),s=t("../constants/alignment").LINE_SPACING;function l(t,e){return t.node().getBoundingClientRect()[e]}var u=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,M){var S=t.text(),L=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&S.match(u),E=n.select(t.node().parentNode);if(!E.empty()){var I=t.attr("class")?t.attr("class").split(" ")[0]:"text";return I+="-math",E.selectAll("svg."+I).remove(),E.selectAll("g."+I+"-group").remove(),t.style("display",null).attr({"data-unformatted":S,"data-math":"N"}),L?(e&&e._promises||[]).push(new Promise((function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),o={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(c,"\\lt ").replace(p,"\\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)}))}(L[2],o,(function(n,i,o){E.selectAll("svg."+I).remove(),E.selectAll("g."+I+"-group").remove();var s=n&&n.select("svg");if(!s||!s.node())return z(),void e();var u=E.append("g").classed(I+"-group",!0).attr({"pointer-events":"none","data-unformatted":S,"data-math":"Y"});u.node().appendChild(s.node()),i&&i.node()&&s.node().insertBefore(i.node().cloneNode(!0),s.node().firstChild),s.attr({class:I,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=t.node().style.fill||"black",p=s.select("g");p.attr({fill:c,stroke:c});var h=l(p,"width"),f=l(p,"height"),d=+t.attr("x")-h*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=-(r||l(t,"height"))/4;"y"===I[0]?(u.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+")"+a(-h/2,m-f/2)}),s.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===I[0]?s.attr({x:t.attr("x"),y:m-f/2}):"a"===I[0]&&0!==I.indexOf("atitle")?s.attr({x:0,y:m}):s.attr({x:d,y:+t.attr("y")+m-f/2}),M&&M.call(t,u),e(u)}))}))):z(),t}function z(){E.empty()||(I=t.attr("class")+"-math",E.select("svg."+I).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(y," ");var r,a=!1,l=[],u=-1;function c(){u++;var e=document.createElementNS(o.svg,"tspan");n.select(e).attr({class:"line",dy:u*s+"em"}),t.appendChild(e),r=e;var i=l;if(l=[{node:e}],i.length>1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),r=l[l.length-1].node}else i.log("Ignoring unexpected end tag .",e)}_.test(e)?c():(r=t,l=[{node:t}]);for(var L=e.split(g),E=0;E|>|>)/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"},f={sub:"0.3em",sup:"-0.6em"},d={sub:"-0.21em",sup:"0.42em"},m=["http:","https:","mailto:","",void 0,":"],y=r.NEWLINES=/(\r\n?|\n)/g,g=/(<[^<>]*>)/,v=/<(\/?)([^ >]*)(\s+(.*))?>/i,_=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,b=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,T=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function k(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&C(n)}var A=/(^|;)\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(g),o=[],s="",l=0,u=0;ui?o.push(c.substr(0,d-i)+"..."):o.push(c.substr(0,d));break}s=""}}return o.join("")};var M={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},S=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function C(t){return t.replace(S,(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)):M[e])||t}))}function L(t,e,r){var n,a,o,s=r.horizontalAlign,l=r.verticalAlign||"top",u=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return u.bottom-n.height}:"middle"===l?function(){return u.top+(u.height-n.height)/2}:function(){return u.top},o="right"===s?function(){return u.right-n.width}:"center"===s?function(){return u.left+(u.width-n.width)/2}:function(){return u.left},function(){n=this.node().getBoundingClientRect();var t=o()-c.left,e=a()-c.top,s=r.gd||{};if(r.gd){s._fullLayout._calcInverseTransform(s);var l=i.apply3DTransform(s._fullLayout._invTransform)(t,e);t=l[0],e=l[1]}return this.style({top:e+"px",left:t+"px","z-index":1e3}),this}}r.convertEntities=C,r.sanitizeHTML=function(t){t=t.replace(y," ");for(var e=document.createElement("p"),r=e,i=[],a=t.split(g),o=0;oa.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)}},{}],234:[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":18}],235:[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"}}},{}],236:[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"}}},{}],237:[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,p=(s.subplotsRegistry.ternary||{}).attrRegex,h=(s.subplotsRegistry.gl3d||{}).attrRegex,m=Object.keys(t);for(e=0;e3?(P.x=1.02,P.xanchor="left"):P.x<-2&&(P.x=-.02,P.xanchor="right"),P.y>3?(P.y=1.02,P.yanchor="bottom"):P.y<-2&&(P.y=-.02,P.yanchor="top")),d(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 b=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1&&a.warn("Full array edits are incompatible with other edits",p);var v=r[""][""];if(u(v))e.set(null);else{if(!Array.isArray(v))return a.warn("Unrecognized full array edit value",p,v),!0;e.set(v)}return!m&&(h(y,g),f(t),!0)}var _,x,b,w,T,k,A,M,S=Object.keys(r).map(Number).sort(o),C=e.get(),L=C||[],E=c(g,p).get(),I=[],z=-1,P=L.length;for(_=0;_L.length-(A?0:1))a.warn("index out of range",p,b);else if(void 0!==k)T.length>1&&a.warn("Insertion & removal are incompatible with edits to the same index.",p,b),u(k)?I.push(b):A?("add"===k&&(k={}),L.splice(b,0,k),E&&E.splice(b,0,{})):a.warn("Unrecognized full object edit value",p,b,k),-1===z&&(z=b);else for(x=0;x=0;_--)L.splice(I[_],1),E&&E.splice(I[_],1);if(L.length?C||e.set(L):e.set(null),m)return!1;if(h(y,g),d!==i){var D;if(-1===z)D=S;else{for(P=Math.max(L.length,P),D=[],_=0;_=z);_++)D.push(b);for(_=z;_=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 D(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]),P(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&P(t,r,"newIndices"),"undefined"!=typeof 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("undefined"==typeof r)throw new Error("indices must be an integer or array of integers");for(var a in P(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,p,h=o.isPlainObject(n),f=[];for(var d in Array.isArray(r)||(r=[r]),r=z(r,t.data.length-1),e)for(var m=0;m-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),T.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=Y(t,n),a=i.flags;a.calc&&(t.calcdata=void 0);var s=[h.previousPromises];a.layoutReplot?s.push(k.layoutReplot):Object.keys(n).length&&(H(t,a,i)||h.supplyDefaults(t),a.legend&&s.push(k.doLegend),a.layoutstyle&&s.push(k.layoutStyles),a.axrange&&Z(s,i.rangesAltered),a.ticks&&s.push(k.doTicksRelayout),a.modebar&&s.push(k.doModeBar),a.camera&&s.push(k.doCamera),a.colorbars&&s.push(k.doColorBars),s.push(C)),s.push(h.rehover,h.redrag),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 H(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=d.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[d.id2name(u)];c.autorange=l.autorange,c.range=l.range.slice(),c._input.range=l.range.slice()}}return!0}function Z(t,e){var r=e?function(t){var r=[],n=!0;for(var i in e){var a=d.getFromId(t,i);if(r.push(i),-1!==(a.ticklabelposition||"").indexOf("inside")&&a._anchorAxis&&r.push(a._anchorAxis._id),a._matchGroup)for(var o in a._matchGroup)e[o]||r.push(o);a.automargin&&(n=!1)}return d.draw(t,r,{skipTitle:n})}:function(t){return d.draw(t,"redraw")};t.push(x,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var G=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,X=/^[xyz]axis[0-9]*\.autorange$/,W=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function Y(t,e){var r,n,i,a=t.layout,l=t._fullLayout,u=l._guiEditing,h=N(l._preGUI,u),f=Object.keys(e),m=d.list(t),y=o.extendDeepAll({},e),g={};for(V(e),f=Object.keys(e),n=0;n0&&"string"!=typeof P.parts[O];)O--;var R=P.parts[O],F=P.parts[O-1]+"."+R,U=P.parts.slice(0,O).join("."),j=s(t.layout,U).get(),q=s(l,U).get(),H=P.get();if(void 0!==D){k[z]=D,S[z]="reverse"===R?D:B(H);var Z=p.getLayoutValObject(l,P.parts);if(Z&&Z.impliedEdits&&null!==D)for(var Y in Z.impliedEdits)C(o.relativeAttr(z,Y),Z.impliedEdits[Y]);if(-1!==["width","height"].indexOf(z))if(D){C("autosize",null);var J="height"===z?"width":"height";C(J,l[J])}else l[z]=t._initialAutoSize[z];else if("autosize"===z)C("width",D?null:l.width),C("height",D?null:l.height);else if(F.match(G))I(F),s(l,U+"._inputRange").set(null);else if(F.match(X)){I(F),s(l,U+"._inputRange").set(null);var Q=s(l,U).get();Q._inputDomain&&(Q._input.domain=Q._inputDomain.slice())}else F.match(W)&&s(l,U+"._inputDomain").set(null);if("type"===R){L=j;var $="linear"===q.type&&"log"===D,tt="log"===q.type&&"linear"===D;if($||tt){if(L&&L.range)if(q.autorange)$&&(L.range=L.range[1]>L.range[0]?[1,2]:[2,1]);else{var et=L.range[0],rt=L.range[1];$?(et<=0&&rt<=0&&C(U+".autorange",!0),et<=0?et=rt/1e6:rt<=0&&(rt=et/1e6),C(U+".range[0]",Math.log(et)/Math.LN10),C(U+".range[1]",Math.log(rt)/Math.LN10)):(C(U+".range[0]",Math.pow(10,et)),C(U+".range[1]",Math.pow(10,rt)))}else C(U+".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,q,D,C),c.getComponentMethod("images","convertCoords")(t,q,D,C)}else C(U+".autorange",!0),C(U+".range",null);s(l,U+"._inputRange").set(null)}else if(R.match(M)){var nt=s(l,z).get(),it=(D||{}).type;it&&"-"!==it||(it="linear"),c.getComponentMethod("annotations","convertCoords")(t,nt,it,C),c.getComponentMethod("images","convertCoords")(t,nt,it,C)}var at=w.containerArrayMatch(z);if(at){r=at.array,n=at.index;var ot=at.property,st=Z||{editType:"calc"};""!==n&&""===ot&&(w.isAddVal(D)?S[z]=null:w.isRemoveVal(D)?S[z]=(s(a,r).get()||[])[n]:o.warn("unrecognized full object value",e)),A.update(b,st),g[r]||(g[r]={});var lt=g[r][n];lt||(lt=g[r][n]={}),lt[ot]=D,delete e[z]}else"reverse"===R?(j.range?j.range.reverse():(C(U+".autorange",!0),j.range=[1,0]),q.autorange?b.calc=!0:b.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===z&&("lasso"===D||"select"===D)&&"lasso"!==H&&"select"!==H||l._has("gl2d")?b.plot=!0:Z?A.update(b,Z):b.calc=!0,P.set(D))}}for(r in g){w.applyContainerArrayChanges(t,h(a,r),g[r],b,h)||(b.plot=!0)}for(var ut in E){var ct=(L=d.getFromId(t,ut))&&L._constraintGroup;if(ct)for(var pt in b.calc=!0,ct)E[pt]||(d.getFromId(t,pt)._constraintShrinkable=!0)}return(K(t)||e.height||e.width)&&(b.plot=!0),(b.plot||b.calc)&&(b.layoutReplot=!0),{flags:b,rangesAltered:E,undoit:S,redoit:k,eventData:y}}function K(t){var e=t._fullLayout,r=e.width,n=e.height;return t.layout.autosize&&h.plotAutoSize(t,t.layout,e),e.width!==r||e.height!==n}function J(t,e,n,i){if(t=o.getGraphDiv(t),T.clearPromiseQueue(t),t.framework&&t.framework.isPolar)return Promise.resolve(t);o.isPlainObject(e)||(e={}),o.isPlainObject(n)||(n={}),Object.keys(e).length&&(t.changed=!0),Object.keys(n).length&&(t.changed=!0);var a=T.coerceTraceIndices(t,i),s=j(t,o.extendFlat({},e),a),l=s.flags,c=Y(t,o.extendFlat({},n)),p=c.flags;(l.calc||p.calc)&&(t.calcdata=void 0),l.clearAxisTypes&&T.clearAxisTypes(t,a,n);var f=[];p.layoutReplot?f.push(k.layoutReplot):l.fullReplot?f.push(r.plot):(f.push(h.previousPromises),H(t,p,c)||h.supplyDefaults(t),l.style&&f.push(k.doTraceStyle),(l.colorbars||p.colorbars)&&f.push(k.doColorBars),p.legend&&f.push(k.doLegend),p.layoutstyle&&f.push(k.layoutStyles),p.axrange&&Z(f,c.rangesAltered),p.ticks&&f.push(k.doTicksRelayout),p.modebar&&f.push(k.doModeBar),p.camera&&f.push(k.doCamera),f.push(C)),f.push(h.rehover,h.redrag),u.add(t,J,[t,s.undoit,c.undoit,s.traces],J,[t,s.redoit,c.redoit,s.traces]);var d=o.syncOrAsync(f,t);return d&&d.then||(d=Promise.resolve(t)),d.then((function(){return t.emit("plotly_update",{data:s.eventData,layout:c.eventData}),t}))}function Q(t){return function(e){e._fullLayout._guiEditing=!0;var r=t.apply(null,arguments);return e._fullLayout._guiEditing=!1,r}}var $=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],tt=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function et(t,e){for(var r=0;r1;)if(n.pop(),void 0!==(r=s(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(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 p(){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,T.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 f(){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&&p()};e()}var d,m,y=0;function g(t){return Array.isArray(i)?y>=i.length?t.transitionOpts=i[y]:t.transitionOpts=i[0]:t.transitionOpts=i,y++,t}var v=[],_=null==e,x=Array.isArray(e);if(!_&&!x&&o.isPlainObject(e))v.push({type:"object",data:g(o.extendFlat({},e))});else if(_||-1!==["string","number"].indexOf(typeof e))for(d=0;d0&&kk)&&A.push(m);v=A}}v.length>0?function(e){if(0!==e.length){for(var i=0;i=0;n--)if(o.isPlainObject(e[n])){var m=e[n].name,y=(c[m]||d[m]||{}).name,g=e[n].name,v=c[y]||d[y];y&&g&&"number"==typeof g&&v&&S<5&&(S++,o.warn('addFrames: overwriting frame "'+(c[y]||d[y]).name+'" with a frame whose name of type "number" also equates to "'+y+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===S&&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.")),d[m]={name:m},f.push({frame:h.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:p+n})}f.sort((function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(i=f[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,p=[t,s],f=[t,a];return u&&u.add(t,l,p,c,f),h.modifyFrames(t,a)},r.addTraces=function t(e,n,i){e=o.getGraphDiv(e);var a,s,l=[],c=r.deleteTraces,p=t,h=[e,l],f=[e,n];for(function(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&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 w(){var t,e,r={};for(t in d(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var i=0;i=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 p=t._module;if(p||(p=(n.modules[t.type||a.type.dflt]||{})._module),!p)return!1;if(!(i=(r=p.attributes)&&r[o])){var h=p.basePlotModule;h&&h.attributes&&(i=h.attributes[o])}i||(i=a[o])}return x(i,e,s)},r.getLayoutValObject=function(t,e){return x(function(t,e){var r,i,a,s,l=t._basePlotModules;if(l){var u;for(r=0;r=i&&(r._input||{})._templateitemname;o&&(a=i);var s,l=e+"["+a+"]";function u(){s={},o&&(s[l]={},s[l].templateitemname=o)}function c(t,e){o?n.nestedProperty(s[l],t).set(e):s[l+"."+t]=e}function p(){var t=s;return u(),t}return u(),{modifyBase:function(t,e){s[t]=e},modifyItem:c,getUpdateObj:p,applyUpdate:function(e,r){e&&c(e,r);var i=p();for(var a in i)n.nestedProperty(t,a).set(i[a])}}}},{"../lib":211,"../plots/attributes":252}],246:[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"),p=t("../components/modebar"),h=t("../plots/cartesian/axes"),f=t("../constants/alignment"),d=t("../plots/cartesian/constraints"),m=d.enforce,y=d.clean,g=t("../plots/cartesian/autorange").doAutoRange;function v(t,e,r){for(var n=0;n=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function _(t){var e,i,s,c,d,m,y=t._fullLayout,g=y._size,_=g.p,b=h.list(t,"",!0);if(y._paperdiv.style({width:t._context.responsive&&y.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":y.width+"px",height:t._context.responsive&&y.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":y.height+"px"}).selectAll(".main-svg").call(u.setSize,y.width,y.height),t._context.setBackground(t,y.paper_bgcolor),r.drawMainTitle(t),p.manage(t),!y._has("cartesian"))return a.previousPromises(t);function T(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-_-n:e._offset+e._length+_+n:g.t+g.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+_+n:e._offset-_-n:g.l+g.w*(t.position||0)+n%1}for(e=0;eT?c.push({code:"unused",traceType:v,templateCount:w,dataCount:T}):T>w&&c.push({code:"reused",traceType:v,templateCount:w,dataCount:T})}}else c.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var a=e[n],o=m(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)&&y(a)&&t(a,o)}}({data:f,layout:h},""),c.length)return c.map(g)}},{"../lib":211,"../plots/attributes":252,"../plots/plots":297,"./plot_config":243,"./plot_schema":244,"./plot_template":245}],248:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./plot_api"),a=t("../plots/plots"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg"),c=t("../version").version,p={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,h,f,d;function m(t){return!(t in e)||o.validate(e[t],p[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],h=t.layout||{},f=t.config||{},d={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),h=o.extendDeep({},t.layout),f=t._context,d=t._fullLayout||{}),!m("width")&&null!==e.width||!m("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!m("format"))throw new Error("Export format is not "+o.join2(p.format.values,", "," or ")+".");var y={};function g(t,r){return o.coerce(e,y,p,t,r)}var v=g("format"),_=g("width"),x=g("height"),b=g("scale"),w=g("setBackground"),T=g("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var A=o.extendFlat({},h);_?A.width=_:null===e.width&&n(d.width)&&(A.width=d.width),x?A.height=x:null===e.height&&n(d.height)&&(A.height=d.height);var M=o.extendFlat({},f,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),S=s.getRedrawFunc(k);function C(){return new Promise((function(t){setTimeout(t,s.getDelay(k._fullLayout))}))}function L(){return new Promise((function(t,e){var r=l(k,v,b),n=k._fullLayout.width,p=k._fullLayout.height;function h(){i.purge(k),document.body.removeChild(k)}if("full-json"===v){var f=a.graphJson(k,!1,"keepdata","object",!0,!0);return f.version=c,f=JSON.stringify(f),h(),t(T?f:s.encodeJSON(f))}if(h(),"svg"===v)return t(T?r:s.encodeSVG(r));var d=document.createElement("canvas");d.id=o.randstr(),u({format:v,width:n,height:p,scale:b,canvas:d,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){i.plot(k,r,A,M).then(S).then(C).then(L).then((function(e){t(function(t){return T?t.replace(s.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":211,"../plots/plots":297,"../snapshot/helpers":310,"../snapshot/svgtoimg":312,"../snapshot/tosvg":314,"../version":376,"./plot_api":242,"fast-isnumeric":18}],249:[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 p=Object.keys(t),h=0;h_.length&&i.push(d("unused",a,g.concat(_.length)));var A,M,S,C,L,E=_.length,I=Array.isArray(k);if(I&&(E=Math.min(E,k.length)),2===x.dimensions)for(M=0;M_[M].length&&i.push(d("unused",a,g.concat(M,_[M].length)));var z=_[M].length;for(A=0;A<(I?Math.min(z,k[M].length):z);A++)S=I?k[M][A]:k,C=v[M][A],L=_[M][A],n.validate(C,S)?L!==C&&L!==+C&&i.push(d("dynamic",a,g.concat(M,A),C,L)):i.push(d("value",a,g.concat(M,A),C))}else i.push(d("array",a,g.concat(M),v[M]));else for(M=0;M1&&f.push(d("object","layout"))),i.supplyDefaults(m);for(var y=m._fullData,g=r.length,v=0;v0&&Math.round(p)===p))return i;u=p}for(var h=e.calendar,f="start"===l,d="end"===l,m=t[r+"period0"],y=a(m,h)||0,g=[],v=i.length,_=0;_T;)w=o(w,-u,h);for(;w<=T;)w=o(w,u,h);b=o(w,-u,h)}else{for(w=y+(x=Math.round((T-y)/c))*c;w>T;)w-=c;for(;w<=T;)w+=c;b=w-c}g[_]=f?b:d?w:(b+w)/2}return g}},{"../../constants/numerical":188,"../../lib":211,"fast-isnumeric":18}],254:[function(t,e,r){"use strict";e.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],255:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../constants/numerical").FP_SAFE,o=t("../../registry"),s=t("./axis_ids").getFromId;function l(t,e){var r,n,a=[],o=c(e,0),s=c(e,1),l=p(t,e),h=l.min,f=l.max;if(0===h.length||0===f.length)return i.simpleMap(e.range,e.r2l);var d=h[0].val,m=f[0].val;for(r=1;r0&&((w=S-o(v)-s(_))>C?T/w>L&&(x=v,b=_,L=T/w):T/S>L&&(x={val:v.val,pad:0},b={val:_.val,pad:0},L=T/S));if(d===m){var E=d-1,I=d+1;if(A)if(0===d)a=[0,1];else{var z=(d>0?f:h).reduce((function(t,e){return Math.max(t,s(e))}),0),P=d/(1-Math.min(.5,z/S));a=d>0?[0,P]:[P,0]}else a=M?[Math.max(0,E),Math.max(1,I)]:[E,I]}else A?(x.val>=0&&(x={val:0,pad:0}),b.val<=0&&(b={val:0,pad:0})):M&&(x.val-L*o(x)<0&&(x={val:0,pad:0}),b.val<=0&&(b={val:1,pad:0})),L=(b.val-x.val-u(e,v.val,_.val))/(S-o(x)-s(b)),a=[x.val-L*o(x),b.val+L*s(b)];return y&&a.reverse(),i.simpleMap(a,e.l2r||Number)}function u(t,e,r){var n=0;if(t.rangebreaks)for(var i=t.locateBreaks(e,r),a=0;a0?r.ppadplus:r.ppadminus)||r.ppad||0),S=A((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),C=A(r.vpadplus||r.vpad),L=A(r.vpadminus||r.vpad);if(!T){if(d=1/0,y=-1/0,w)for(i=0;i<_;i++)(o=e[i])0&&(d=o),o>y&&o-a&&(d=o),o>y&&o=z;i--)I(i);return{min:g,max:v,opts:r}},concatExtremes:p};function p(t,e,r){var n,i,a,o=e._id,l=t._fullData,u=t._fullLayout,c=[],d=[];function m(t,e){for(n=0;n=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 m(t){return n(t)&&Math.abs(t)=e}},{"../../constants/numerical":188,"../../lib":211,"../../registry":306,"./axis_ids":259,"fast-isnumeric":18}],256:[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=s.strTranslate,u=t("../../lib/svg_text_utils"),c=t("../../components/titles"),p=t("../../components/color"),h=t("../../components/drawing"),f=t("./layout_attributes"),d=t("./clean_ticks"),m=t("../../constants/numerical"),y=m.ONEMAXYEAR,g=m.ONEAVGYEAR,v=m.ONEMINYEAR,_=m.ONEMAXQUARTER,x=m.ONEAVGQUARTER,b=m.ONEMINQUARTER,w=m.ONEMAXMONTH,T=m.ONEAVGMONTH,k=m.ONEMINMONTH,A=m.ONEWEEK,M=m.ONEDAY,S=M/2,C=m.ONEHOUR,L=m.ONEMIN,E=m.ONESEC,I=m.MINUS_SIGN,z=m.BADNUM,P=t("../../constants/alignment"),D=P.MID_SHIFT,O=P.CAP_SHIFT,R=P.LINE_SPACING,F=P.OPPOSITE_SIDE,B=e.exports={};B.setConvert=t("./set_convert");var N=t("./axis_autotype"),U=t("./axis_ids");B.id2name=U.id2name,B.name2id=U.name2id,B.cleanId=U.cleanId,B.list=U.list,B.listIds=U.listIds,B.getFromId=U.getFromId,B.getFromTrace=U.getFromTrace;var j=t("./autorange");B.getAutoRange=j.getAutoRange,B.findExtremes=j.findExtremes;function V(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}B.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]||("string"==typeof a?a:a[0])),a||(a=i),l=l.concat(l.map((function(t){return t+" domain"}))),c[u]={valType:"enumerated",values:l.concat(a?"string"==typeof a?[a]:a:[]),dflt:i},s.coerce(t,e,c,u)},B.getRefType=function(t){return void 0===t?t:"paper"===t?"paper":"pixel"===t?"pixel":/( domain)$/.test(t)?"domain":"range"},B.coercePosition=function(t,e,r,n,i,a){var o,l;if("range"!==B.getRefType(n))o=s.ensureNumber,l=r(i,a);else{var u=B.getFromId(e,n);l=r(i,a=u.fraction2r(a)),o=u.cleanPos}t[i]=o(l)},B.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:B.getFromId(e,r).cleanPos)(t)},B.redrawComponents=function(t,e){e=e||B.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},B.saveRangeInitial=function(t,e){for(var r=B.list(t,"",!0),n=!1,i=0;i.3*h||c(n)||c(a))){var f=r.dtick/2;t+=t+f.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=B.tickIncrement(t,"M6","reverse")+1.5*M:a.exactMonths>.8?t=B.tickIncrement(t,"M1","reverse")+15.5*M:t-=S;var l=B.tickIncrement(t,r);if(l<=n)return l}return t}(v,t,g,u,a)),y=v,0;y<=c;)y=B.tickIncrement(y,g,!1,a);return{start:e.c2r(v,0,a),end:e.c2r(y,0,a),size:g,_dataSpan:c-u}},B.prepTicks=function(t,e){var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if(t._dtickInit=t.dtick,t._tick0Init=t.tick0,"auto"===t.tickmode||!t.dtick){var n,a=t.nticks;a||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,a=t._length/n):(n="y"===t._id.charAt(0)?40:80,a=s.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(a*=2)),"array"===t.tickmode&&(a*=100),t._roughDTick=Math.abs(r[1]-r[0])/a,B.autoTicks(t,t._roughDTick),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}"period"===t.ticklabelmode&&function(t){var e;function r(){return!(i(t.dtick)||"M"!==t.dtick.charAt(0))}var n=r(),a=B.getTickFormat(t);if(a){var o=t._dtickInit!==t.dtick;/%[fLQsSMX]/.test(a)||(/%[HI]/.test(a)?(e=C,o&&!n&&t.dticka&&p=o:f<=o;f=B.tickIncrement(f,t.dtick,l,t.calendar)){if(t.rangebreaks&&!l){if(f=c)break}if(L.length>m||f===E)break;E=f;var I=!1;p&&f!==(0|f)&&(I=!0),L.push({minor:I,value:f})}if(h&&function(t,e,r){for(var n=0;n0?(a=n-1,o=n):(a=n,o=n);var s,l=t[a].value,u=t[o].value,c=Math.abs(u-l),p=r||c,h=0;p>=v?h=c>=v&&c<=y?c:g:r===x&&p>=b?h=c>=b&&c<=_?c:x:p>=k?h=c>=k&&c<=w?c:T:r===A&&p>=A?h=A:p>=M?h=M:r===S&&p>=S?h=S:r===C&&p>=C&&(h=C),h>=c&&(h=c,s=!0);var f=i+h;if(e.rangebreaks&&h>0){for(var d=0,m=0;m<84;m++){var L=(m+.5)/84;e.maskBreaks(i*(1-L)+L*f)!==z&&d++}(h*=d/84)||(t[n].drop=!0),s&&c>A&&(h=c)}(h>0||0===n)&&(t[n].periodX=i+h/2)}}(L,t,t._definedDelta),t.rangebreaks){var P="y"===t._id.charAt(0),D=1;"auto"===t.tickmode&&(D=t.tickfont?t.tickfont.size:12);var O=NaN;for(d=L.length-1;d>-1;d--)if(L[d].drop)L.splice(d,1);else{L[d].value=xt(L[d].value,t);var R=t.c2p(L[d].value);(P?O>R-D:Oc||Nc&&(F.periodX=c),N10||"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>=L&&a<=16||e>=C)t._tickround="M";else if(e>=E&&a<=19||e>=L)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),c=void 0===t.minexponent?3:t.minexponent;Math.abs(u)>c&&(it(t.exponentformat)&&!at(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function rt(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}}B.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,0);var a=2*e;if(a>g)e/=g,r=n(10),t.dtick="M"+12*tt(e,r,X);else if(a>T)e/=T,t.dtick="M"+tt(e,1,W);else if(a>M){t.dtick=tt(e,M,t._hasDayOfWeekBreaks?[1,2,7,14]:K);var o=B.getTickFormat(t),l="period"===t.ticklabelmode;l&&(t._rawTick0=t.tick0),/%[uVW]/.test(o)?t.tick0=s.dateTick0(t.calendar,2):t.tick0=s.dateTick0(t.calendar,1),l&&(t._dowTick0=t.tick0)}else a>C?t.dtick=tt(e,C,W):a>L?t.dtick=tt(e,L,Y):a>E?t.dtick=tt(e,E,Y):(r=n(10),t.dtick=tt(e,r,X))}else if("log"===t.type){t.tick0=0;var u=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(u[1]-u[0])<1){var c=1.5*Math.abs((u[1]-u[0])/e);e=Math.abs(Math.pow(10,u[1])-Math.pow(10,u[0]))/c,r=n(10),t.dtick="L"+tt(e,r,X)}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))):_t(t)?(t.tick0=0,r=1,t.dtick=tt(e,r,$)):(t.tick0=0,r=n(10),t.dtick=tt(e,r,X));if(0===t.dtick&&(t.dtick=1),!i(t.dtick)&&"string"!=typeof t.dtick){var p=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(p)}},B.tickIncrement=function(t,e,r,a){var o=r?-1:1;if(i(e))return s.increment(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?Q:J,p=t+.01*o,h=s.roundUp(s.mod(p,1),c,r);return Math.floor(p)+Math.log(n.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(e)},B.tickFirst=function(t,e){var r=t.r2l||Number,a=s.simpleMap(t.range,r,void 0,void 0,e),o=a[1]"+l,t._prevDateHead=l));e.text=u}(t,o,r,u):"log"===c?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=ot(Math.pow(10,l),t,a,n);else if(i(o)||"D"===c&&s.mod(l+.01,1)<.1){var p=Math.round(l),h=Math.abs(p),f=t.exponentformat;"power"===f||it(f)&&at(p)?(e.text=0===p?1:1===p?"10":"10"+(p>1?"":I)+h+"",e.fontSize*=1.25):("e"===f||"E"===f)&&h>2?e.text="1"+f+(p>0?"+":I)+h:(e.text=ot(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 d=String(e.text).charAt(0);"0"!==d&&"1"!==d||("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,m):"category"===c?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===c?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,o,r):_t(t)?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=ot(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){for(var r=1;!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=ot(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=I+e.text)}}}}(t,o,r,u,m):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=ot(e.x,t,i,n)}(t,o,0,u,m),n||(t.tickprefix&&!d(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!d(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var y=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[y(o.x-.5),y(o.x+t.dtick-.5)]}return o},B.hoverLabelText=function(t,e,r){if(r!==z&&r!==e)return B.hoverLabelText(t,e)+" - "+B.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=B.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":I+i:i};var nt=["f","p","n","\u03bc","m","","k","M","G","T"];function it(t){return"SI"===t||"B"===t}function at(t){return t>14||t<-15}function ot(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=B.getTickFormat(e),p=e.separatethousands;if(n){var h={exponentformat:l,minexponent:e.minexponent,dtick:"none"===e.showexponent?e.dtick:i(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};et(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,I);var f,d=Math.pow(10,-o)/2;if("none"===l&&(u=0),(t=Math.abs(t))"+f+"":"B"===l&&9===u?t+="B":it(l)&&(t+=nt[u/3+5]));return a?I+t:t}function st(t,e){for(var r=[],n={},i=0;i1&&r=i.min&&t=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.bottom-p:0,h)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var f=[0,1];if("x"===d){if("b"===l?n[l]=e._depth:(n[l]=e._depth=Math.max(r.width>0?p-r.top:0,h),f.reverse()),r.width>0){var y=r.right-(e._offset+e._length);y>0&&(n.xr=1,n.r=y);var g=e._offset-r.left;g>0&&(n.xl=0,n.l=g)}}else if("l"===l?n[l]=e._depth=Math.max(r.height>0?p-r.left:0,h):(n[l]=e._depth=Math.max(r.height>0?r.right-p:0,h),f.reverse()),r.height>0){var v=r.bottom-(e._offset+e._length);v>0&&(n.yb=0,n.b=v);var _=e._offset-r.top;_>0&&(n.yt=1,n.t=_)}n[m]="free"===e.anchor?e.position:e._anchorAxis.domain[f[0]],e.title.text!==u._dfltTitle[d]&&(n[l]+=ct(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((i={x:0,y:0,r:0,l:0,t:0,b:0})[c]=e.linewidth,e.mirror&&!0!==e.mirror&&(i[c]+=h),!0===e.mirror||"ticks"===e.mirror?i[m]=e._anchorAxis.domain[f[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(i[m]=[e._counterDomainMin,e._counterDomainMax][f[1]]))}J&&(s=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),a.autoMargin(t,ft(e),n),a.autoMargin(t,dt(e),i),a.autoMargin(t,mt(e),s)})),r.skipTitle||J&&"bottom"===e.side||Y.push((function(){return function(t,e){var r,n=t._fullLayout,i=e._id,a=i.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+ct(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===a?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var s,l,u,p,f=B.getPxPosition(t,e);"x"===a?(l=e._offset+e._length/2,u="top"===e.side?f-r:f+r):(u=e._offset+e._length/2,l="right"===e.side?f+r:f-r,s={rotate:"-90",offset:0});if("multicategory"!==e.type){var d=e._selections[e._id+"tick"];if(p={selection:d,side:e.side},d&&d.node()&&d.node().parentNode){var m=h.getTranslate(d.node().parentNode);p.offsetLeft=m.x,p.offsetTop=m.y}e.title.hasOwnProperty("standoff")&&(p.pad=0)}return c.draw(t,i+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[a],avoid:p,transform:s,attributes:{x:l,y:u,"text-anchor":"middle"}})}(t,e)})),s.syncOrAsync(Y)}}function Q(t){var r=f+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,i,a;t._selections[e].size()?(r=1/0,n=-1/0,i=1/0,a=-1/0,t._selections[e].each((function(){var t=ht(this),e=h.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),i=Math.min(i,e.left),a=Math.max(a,e.right)}))):(r=0,n=0,i=0,a=0);return{top:r,bottom:n,left:i,right:a,height:n-r,width:a-i}}(e,r)),w[r]}},B.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}))),t.side&&i.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),i},B.makeTransTickFn=function(t){return"x"===t._id.charAt(0)?function(e){return l(t._offset+t.l2p(e.x),0)}:function(e){return l(0,t._offset+t.l2p(e.x))}},B.makeTransTickLabelFn=function(t){var e=function(t){var e=t.ticklabelposition||"",r=function(t){return-1!==e.indexOf(t)},n=r("top"),i=r("left"),a=r("right"),o=r("bottom"),s=r("inside"),l=o||i||n||a;if(!l&&!s)return[0,0];var u=t.side,c=l?(t.tickwidth||0)/2:0,p=3,h=t.tickfont?t.tickfont.size:12;(o||n)&&(c+=h*O,p+=(t.linewidth||0)/2);(i||a)&&(c+=(t.linewidth||0)/2,p+=3);s&&"top"===u&&(p-=h*(1-O));(i||n)&&(c=-c);"bottom"!==u&&"right"!==u||(p=-p);return[l?c:0,s?p:0]}(t),r=e[0],n=e[1];return"x"===t._id.charAt(0)?function(e){return l(r+t._offset+t.l2p(lt(e)),n)}:function(e){return l(n,r+t._offset+t.l2p(lt(e)))}},B.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},B.makeLabelFns=function(t,e,r){var n=t.ticklabelposition||"",a=function(t){return-1!==n.indexOf(t)},o=a("top"),l=a("left"),u=a("right"),c=a("bottom")||l||o||u,p=a("inside"),h="inside"===n&&"inside"===t.ticks||!p&&"outside"===t.ticks&&"boundaries"!==t.tickson,f=0,d=0,m=h?t.ticklen:0;if(p?m*=-1:c&&(m=0),h&&(f+=m,r)){var y=s.deg2rad(r);f=m*Math.cos(y)+1,d=m*Math.sin(y)}t.showticklabels&&(h||t.showline)&&(f+=.2*t.tickfont.size);var g,v,_,x,b,w={labelStandoff:f+=(t.linewidth||1)/2*(p?-1:1),labelShift:d},T=0,k=t.side,A=t._id.charAt(0),M=t.tickangle;if("x"===A)x=(b=!p&&"bottom"===k||p&&"top"===k)?1:-1,p&&(x*=-1),g=d*x,v=e+f*x,_=b?1:-.2,90===Math.abs(M)&&(p?_+=D:_=-90===M&&"bottom"===k?O:90===M&&"top"===k?D:.5,T=D/2*(M/90)),w.xFn=function(t){return t.dx+g+T*t.fontSize},w.yFn=function(t){return t.dy+v+t.fontSize*_},w.anchorFn=function(t,e){if(c){if(l)return"end";if(u)return"start"}return i(e)&&0!==e&&180!==e?e*x<0!==p?"end":"start":"middle"},w.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side!==p?-n:0};else if("y"===A){if(x=(b=!p&&"left"===k||p&&"right"===k)?1:-1,p&&(x*=-1),g=f,v=d*x,_=0,p||90!==Math.abs(M)||(_=-90===M&&"left"===k||90===M&&"right"===k?O:.5),p){var S=i(M)?+M:0;if(0!==S){var C=s.deg2rad(S);T=Math.abs(Math.sin(C))*O*x,_=0}}w.xFn=function(t){return t.dx+e-(g+t.fontSize*_)*x+T*t.fontSize},w.yFn=function(t){return t.dy+v+t.fontSize*D},w.anchorFn=function(t,e){return i(e)&&90===Math.abs(e)?"middle":b?"end":"start"},w.heightFn=function(e,r,n){return"right"===t.side&&(r*=-1),r<-30?-n:r<30?-.5*n:0}}return w},B.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",i=r.vals;"period"===e.ticklabelmode&&(i=i.slice()).shift();var a=r.layer.selectAll("path."+n).data(e.ticks?i:[],ut);a.exit().remove(),a.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(p.stroke,e.tickcolor).style("stroke-width",h.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),a.attr("transform",r.transFn)},B.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&&B.shouldShowZeroLine(t,e,a))for(var o="array"===e.tickmode,s=0;so||i.lefto||i.top+(e.tickangle?0:t.fontSize/4)1)for(n=1;n2*o}(i,e))return"date";var y="strict"!==r.autotypenumbers;return function(t,e){for(var r=t.length,n=p(r),i=0,o=0,s={},c=0;c2*i}(i,y)?"category":function(t,e){for(var r=t.length,n=0;n=2){var l,u,c="";if(2===o.length)for(l=0;l<2;l++)if(u=v(o[l])){c=d;break}var p=i("pattern",c);if(p===d)for(l=0;l<2;l++)(u=v(o[l]))&&(e.bounds[l]=o[l]=u-1);if(p)for(l=0;l<2;l++)switch(u=o[l],p){case d:if(!n(u))return void(e.enabled=!1);if((u=+u)!==Math.floor(u)||u<0||u>=7)return void(e.enabled=!1);e.bounds[l]=o[l]=u;break;case m:if(!n(u))return void(e.enabled=!1);if((u=+u)<0||u>24)return void(e.enabled=!1);e.bounds[l]=o[l]=u}if(!1===r.autorange){var h=r.range;if(h[0]h[1])return void(e.enabled=!1)}else if(o[0]>h[0]&&o[1]n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.ref2id=function(t){return!!/^[xyz]/.test(t)&&t.split(" ")[0]}},{"../../registry":306,"./constants":262}],260:[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;nn?i.substr(n):a.substr(r))+o:i+a+t*e:o}function y(t,e){for(var r=e._size,n=r.h/r.w,i={},a=Object.keys(t),o=0;ou*_)||T)for(r=0;rP&&FI&&(I=F);h/=(I-E)/(2*z),E=l.l2r(E),I=l.l2r(I),l.range=l._input.range=S=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function B(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",l(r,n)).attr("d",i+"Z")}function N(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",l(e,r)).attr("d","M0,0Z")}function U(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"),j(t,e,i,a)}function j(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 V(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function q(t){I&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),I=!1)}function H(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,E)/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 Z(t,e,r,n,i){for(var a,o,l,u,c=!1,p={},h={},f=(i||{}).xaHash,d=(i||{}).yaHash,m=0;m=0)i._fullLayout._deactivateShape(i);else{var a=i._fullLayout.clickmode;if(V(i),2!==t||yt||qt(),mt)a.indexOf("select")>-1&&M(r,i,Y,K,e.id,Et),a.indexOf("event")>-1&&h.click(i,r,e.id);else if(1===t&&yt){var s=d?z:I,l="s"===d||"w"===y?0:1,c=s._name+".range["+l+"]",p=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,l),f="left",m="middle";if(s.fixedrange)return;d?(m="n"===d?"top":"bottom","right"===s.side&&(f="right")):"e"===y&&(f="right"),i._context.showAxisRangeEntryBoxes&&n.select(_t).call(u.makeEditable,{gd:i,immediate:!0,background:i._fullLayout.paper_bgcolor,text:String(p),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:f,verticalAlign:m}).on("edit",(function(t){var e=s.d2r(t);void 0!==e&&o.call("_guiRelayout",i,c,e)}))}}}function Pt(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min($,ht*e+xt)),i=Math.max(0,Math.min(tt,ft*r+bt)),a=Math.abs(n-xt),o=Math.abs(i-bt);function s(){Mt="",wt.r=wt.l,wt.t=wt.b,Ct.attr("d","M0,0Z")}if(wt.l=Math.min(xt,n),wt.r=Math.max(xt,n),wt.t=Math.min(bt,i),wt.b=Math.max(bt,i),et.isSubplotConstrained)a>E||o>E?(Mt="xy",a/$>o/tt?(o=a*tt/$,bt>i?wt.t=bt-o:wt.b=bt+o):(a=o*$/tt,xt>n?wt.l=xt-a:wt.r=xt+a),Ct.attr("d",H(wt))):s();else if(rt.isSubplotConstrained)if(a>E||o>E){Mt="xy";var l=Math.min(wt.l/$,(tt-wt.b)/tt),u=Math.max(wt.r/$,(tt-wt.t)/tt);wt.l=l*$,wt.r=u*$,wt.b=(1-l)*tt,wt.t=(1-u)*tt,Ct.attr("d",H(wt))}else s();else!it||o0){var c;if(rt.isSubplotConstrained||!nt&&1===it.length){for(c=0;cm[1]-1/4096&&(e.domain=s),i.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":211,"fast-isnumeric":18}],274:[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)],t.setScale()}},{"../../constants/alignment":184}],275:[function(t,e,r){"use strict";var n=t("polybooljs"),i=t("../../registry"),a=t("../../components/drawing").dashStyle,o=t("../../components/color"),s=t("../../components/fx"),l=t("../../components/fx/helpers").makeEventData,u=t("../../components/dragelement/helpers"),c=u.freeMode,p=u.rectMode,h=u.drawMode,f=u.openMode,d=u.selectMode,m=t("../../components/shapes/draw_newshape/display_outlines"),y=t("../../components/shapes/draw_newshape/helpers").handleEllipse,g=t("../../components/shapes/draw_newshape/newshapes"),v=t("../../lib"),_=t("../../lib/polygon"),x=t("../../lib/throttle"),b=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),T=t("../../plot_api/subroutines").redrawReglTraces,k=t("./constants"),A=k.MINSELECT,M=_.filter,S=_.tester,C=t("./handle_outline").clearSelect,L=t("./helpers"),E=L.p2r,I=L.axValue,z=L.getTransform;function P(t,e,r,n,i,a,o){var s,l,u,c,p,h,d,y,g,v=e._hoverdata,_=e._fullLayout.clickmode.indexOf("event")>-1,x=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(v)){F(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=U(b))){for(o&&o.remove(),g=0;g=0&&n._fullLayout._deactivateShape(n),h(e)){var a=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(a&&n._fullLayout._drawing){var o=g(a,t);o&&i.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function N(t,e,r,n){var i,a,o,s=[],l=e.map((function(t){return t._id})),u=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(i)>-1}function j(t,e,r){var n,a,o,s;for(n=0;n=0)L._fullLayout._deactivateShape(L);else if(!b){var r=D.clickmode;x.done(mt).then((function(){if(x.clear(mt),2===t){for(pt.remove(),$=0;$-1&&P(e,L,i.xaxes,i.yaxes,i.subplot,i,pt),"event"===r&&L.emit("plotly_selected",void 0);s.click(L,e)})).catch(v.error)}},i.doneFn=function(){dt.remove(),x.done(mt).then((function(){x.clear(mt),i.gd.emit("plotly_selected",et),Q&&i.selectionDefs&&(Q.subtract=ct,i.selectionDefs.push(Q),i.mergedPolygons.length=0,[].push.apply(i.mergedPolygons,J)),i.doneFnCompleted&&i.doneFnCompleted(yt)})).catch(v.error),b&&B(i)}},clearSelect:C,clearSelectionsCache:B,selectOnClick:P}},{"../../components/color":82,"../../components/dragelement/helpers":100,"../../components/drawing":104,"../../components/fx":122,"../../components/fx/helpers":118,"../../components/shapes/draw_newshape/display_outlines":167,"../../components/shapes/draw_newshape/helpers":168,"../../components/shapes/draw_newshape/newshapes":169,"../../lib":211,"../../lib/clear_gl_canvases":197,"../../lib/polygon":223,"../../lib/throttle":233,"../../plot_api/subroutines":246,"../../registry":306,"./axis_ids":259,"./constants":262,"./handle_outline":266,"./helpers":267,polybooljs:56}],276:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,u=o.dateTime2ms,c=o.ensureNumber,p=o.isArrayOrTypedArray,h=t("../../constants/numerical"),f=h.FP_SAFE,d=h.BADNUM,m=h.LOG_CLIP,y=h.ONEWEEK,g=h.ONEDAY,v=h.ONEHOUR,_=h.ONEMIN,x=h.ONESEC,b=t("./axis_ids"),w=t("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function A(t){return Math.pow(10,t)}function M(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",h=r.charAt(0);function S(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*m*Math.abs(n-i))}return d}function C(e,r,n,i){if((i||{}).msUTC&&a(e))return+e;var s=u(e,n||t.calendar);if(s===d){if(!a(e))return d;e=+e;var l=Math.floor(10*o.mod(e+.05,1)),c=Math.round(e-l/10);s=u(new Date(c))+l/10}return s}function L(e,r,n){return l(e,r,n||t.calendar)}function E(e){return t._categories[Math.round(e)]}function I(e){if(M(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function z(e){if(t._categoriesMap)return t._categoriesMap[e]}function P(t){var e=z(t);return void 0!==e?e:a(t)?+t:void 0}function D(t){return a(t)?+t:z(t)}function O(t,e,r){return n.round(r+e*t,2)}function R(t,e,r){return(t-r)/e}var F=function(e){return a(e)?O(e,t._m,t._b):d},B=function(e){return R(e,t._m,t._b)};if(t.rangebreaks){var N="y"===h;F=function(e){if(!a(e))return d;var r=t._rangebreaks.length;if(!r)return O(e,t._m,t._b);var n=N;t.range[0]>t.range[1]&&(n=!n);for(var i=n?-1:1,o=i*e,s=0,l=0;lc)){s=o<(u+c)/2?l:l+1;break}s=l+1}var p=t._B[s]||0;return isFinite(p)?O(e,t._m2,p):0},B=function(e){var r=t._rangebreaks.length;if(!r)return R(e,t._m,t._b);for(var n=0,i=0;it._rangebreaks[i].pmax&&(n=i+1);return R(e,t._m2,t._B[n])}}t.c2l="log"===t.type?S:c,t.l2c="log"===t.type?A:c,t.l2p=F,t.p2l=B,t.c2p="log"===t.type?function(t,e){return F(S(t,e))}:F,t.p2c="log"===t.type?function(t){return A(B(t))}:B,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=B,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return S(s(t),e)},t.r2d=t.r2c=function(t){return A(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=S,t.l2d=A,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return A(B(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=B,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=C,t.c2d=t.c2r=t.l2d=t.l2r=L,t.d2p=t.r2p=function(e,r,n){return t.l2p(C(e,0,n))},t.p2d=t.p2r=function(t,e,r){return L(B(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=I,t.r2d=t.c2d=t.l2d=E,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=D(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=D,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return E(B(t))},t.r2p=t.d2p,t.p2r=B,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=E,t.d2r=t.d2l_noadd=P,t.r2c=function(e){var r=P(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=z,t.l2r=t.c2r=c,t.r2l=P,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return E(B(t))},t.r2p=t.d2p,t.p2r=B,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:c(t)},t.setupMultiCategory=function(n){var i,a,s=t._traceIndices,l=t._matchGroup;if(l&&0===t._categories.length)for(var u in l)if(u!==r){var c=e[b.id2name(u)];s=s.concat(c._traceIndices)}var f=[[0,{}],[0,{}]],d=[];for(i=0;if&&(s[n]=f),s[0]===s[1]){var u=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=u,s[1]+=u}}else o.nestedProperty(t,e).set(i)},t.setScale=function(r){var n=e._size;if(t.overlaying){var i=b.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var a=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(a);var s,l,u=t.r2l(t[a][0],o),c=t.r2l(t[a][1],o),p="y"===h;if((p?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(u,c),Math.max(u,c)),t._rangebreaks.length)){for(s=0;sc&&(f=!f),f&&t._rangebreaks.reverse();var d=f?-1:1;for(t._m2=d*t._length/(Math.abs(c-u)-t._lBreaks),t._B.push(-t._m2*(p?c:u)),s=0;si&&(i+=7,ai&&(i+=24,a=n&&a=n&&e=s.min&&(ts.max&&(s.max=n),i=!1)}i&&u.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function y(e,r){var n=e.plotinfo,i=n.xaxis,l=n.yaxis,u=i._length,c=l._length,p=!!e.xr1,h=!!e.yr1,f=[];if(p){var d=a.simpleMap(e.xr0,i.r2l),m=a.simpleMap(e.xr1,i.r2l),y=d[1]-d[0],g=m[1]-m[0];f[0]=(d[0]*(1-r)+r*m[0]-d[0])/(d[1]-d[0])*u,f[2]=u*(1-r+r*g/y),i.range[0]=i.l2r(d[0]*(1-r)+r*m[0]),i.range[1]=i.l2r(d[1]*(1-r)+r*m[1])}else f[0]=0,f[2]=u;if(h){var v=a.simpleMap(e.yr0,l.r2l),_=a.simpleMap(e.yr1,l.r2l),x=v[1]-v[0],b=_[1]-_[0];f[1]=(v[1]*(1-r)+r*_[1]-v[1])/(v[0]-v[1])*c,f[3]=c*(1-r+r*b/x),l.range[0]=i.l2r(v[0]*(1-r)+r*_[0]),l.range[1]=l.l2r(v[1]*(1-r)+r*_[1])}else f[1]=0,f[3]=c;s.drawOne(t,i,{skipTitle:!0}),s.drawOne(t,l,{skipTitle:!0}),s.redrawComponents(t,[i._id,l._id]);var w=p?u/f[2]:1,T=h?c/f[3]:1,k=p?f[0]:0,A=h?f[1]:0,M=p?f[0]/f[2]*u:0,S=h?f[1]/f[3]*c:0,C=i._offset-M,L=l._offset-S;n.clipRect.call(o.setTranslate,k,A).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,C,L).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}s.redrawComponents(t)}},{"../../components/drawing":104,"../../lib":211,"../../registry":306,"./axes":256,d3:16}],281:[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("autotypenumbers",s.autotypenumbersDflt),"-"===r("type",(s.splomStash||{}).type)&&(!function(t,e){if("-"!==t.type)return;var r,s=t._id,l=s.charAt(0);-1!==s.indexOf("scene")&&(s=l);var u=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,s,l);if(!u)return;if("histogram"===u.type&&l==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=l+"calendar",p=u[c],h={noMultiCategory:!n(u,"cartesian")||n(u,"noMultiCategory")};"box"===u.type&&u._hasPreCompStats&&l==={h:"x",v:"y"}[u.orientation||"v"]&&(h.noMultiCategory=!0);if(h.autotypenumbers=t.autotypenumbers,o(u,l)){var f=a(u),d=[];for(r=0;r0?".":"")+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"],p=0;p\xa9 OpenStreetMap',tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-osm-tiles",type:"raster",source:"plotly-osm-tiles",minzoom:0,maxzoom:22}]},"white-bg":{id:"white-bg",version:8,sources:{},layers:[{id:"white-bg",type:"background",paint:{"background-color":"#FFFFFF"},minzoom:0,maxzoom:22}]},"carto-positron":{id:"carto-positron",version:8,sources:{"plotly-carto-positron":{type:"raster",attribution:'\xa9 CARTO',tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-positron",type:"raster",source:"plotly-carto-positron",minzoom:0,maxzoom:22}]},"carto-darkmatter":{id:"carto-darkmatter",version:8,sources:{"plotly-carto-darkmatter":{type:"raster",attribution:'\xa9 CARTO',tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-darkmatter",type:"raster",source:"plotly-carto-darkmatter",minzoom:0,maxzoom:22}]},"stamen-terrain":{id:"stamen-terrain",version:8,sources:{"plotly-stamen-terrain":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under ODbL.',tiles:["https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-terrain",type:"raster",source:"plotly-stamen-terrain",minzoom:0,maxzoom:22}]},"stamen-toner":{id:"stamen-toner",version:8,sources:{"plotly-stamen-toner":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under ODbL.',tiles:["https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-toner",type:"raster",source:"plotly-stamen-toner",minzoom:0,maxzoom:22}]},"stamen-watercolor":{id:"stamen-watercolor",version:8,sources:{"plotly-stamen-watercolor":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under CC BY SA.',tiles:["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-watercolor",type:"raster",source:"plotly-stamen-watercolor",minzoom:0,maxzoom:22}]}},i=Object.keys(n);e.exports={requiredVersion:"1.10.1",styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",styleValuesMapbox:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],styleValueDflt:"basic",stylesNonMapbox:n,styleValuesNonMapbox:i,traceLayerPrefix:"plotly-trace-layer-",layoutLayerPrefix:"plotly-layout-layer-",wrongVersionErrorMsg:["Your custom plotly.js bundle is not using the correct mapbox-gl version","Please install mapbox-gl@1.10.1."].join("\n"),noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.plot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join("\n"),missingStyleErrorMsg:["No valid mapbox style found, please set `mapbox.style` to one of:",i.join(", "),"or register a Mapbox access token to use a Mapbox-served style."].join("\n"),multipleTokensErrorMsg:["Set multiple mapbox access token across different mapbox subplot,","using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join("\n"),mapOnErrorMsg:"Mapbox error.",mapboxLogo:{path0:"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z",path1:"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z",path2:"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z",polygon:"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34"},styleRules:{map:"overflow:hidden;position:relative;","missing-css":"display:none;",canary:"background-color:salmon;","ctrl-bottom-left":"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;","ctrl-bottom-right":"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;",ctrl:"clear: both; pointer-events: auto; transform: translate(0, 0);","ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner":"display: none;","ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner":"display: block; margin-top:2px","ctrl-attrib.mapboxgl-compact:hover":"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;","ctrl-attrib.mapboxgl-compact::after":'content: ""; cursor: pointer; position: absolute; background-image: url(\'data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath fill="%23333333" fill-rule="evenodd" d="M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0"/%3E %3C/svg%3E\'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;',"ctrl-attrib.mapboxgl-compact":"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;","ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; right: 0","ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; left: 0","ctrl-bottom-left .mapboxgl-ctrl":"margin: 0 0 10px 10px; float: left;","ctrl-bottom-right .mapboxgl-ctrl":"margin: 0 10px 10px 0; float: right;","ctrl-attrib":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a:hover":"color: inherit; text-decoration: underline;","ctrl-attrib .mapbox-improve-map":"font-weight: bold; margin-left: 2px;","attrib-empty":"display: none;","ctrl-logo":'display:block; width: 21px; height: 21px; background-image: url(\'data:image/svg+xml;charset=utf-8,%3C?xml version="1.0" encoding="utf-8"?%3E %3Csvg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve"%3E%3Cg transform="translate(0,0.01)"%3E%3Cpath d="m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z" style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3Cpath d="M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpath d="M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpolygon points="11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34 " style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3C/g%3E%3C/svg%3E\')'}}},{}],290:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r=t.split(" "),i=r[0],a=r[1],o=n.isArrayOrTypedArray(e)?n.mean(e):e,s=.5+o/100,l=1.5+o/100,u=["",""],c=[0,0];switch(i){case"top":u[0]="top",c[1]=-l;break;case"bottom":u[0]="bottom",c[1]=l}switch(a){case"left":u[1]="right",c[0]=-s;break;case"right":u[1]="left",c[0]=s}return{anchor:u[0]&&u[1]?u.join("-"):u[0]?u[0]:u[1]?u[1]:"center",offset:c}}},{"../../lib":211}],291:[function(t,e,r){"use strict";var n=t("mapbox-gl"),i=t("../../lib"),a=i.strTranslate,o=i.strScale,s=t("../../plots/get_data").getSubplotCalcData,l=t("../../constants/xmlns_namespaces"),u=t("d3"),c=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),h=t("./mapbox"),f=r.constants=t("./constants");function d(t){return"string"==typeof t&&(-1!==f.styleValuesMapbox.indexOf(t)||0===t.indexOf("mapbox://"))}r.name="mapbox",r.attr="subplot",r.idRoot="mapbox",r.idRegex=r.attrRegex=i.counterRegex("mapbox"),r.attributes={subplot:{valType:"subplotid",dflt:"mapbox",editType:"calc"}},r.layoutAttributes=t("./layout_attributes"),r.supplyLayoutDefaults=t("./layout_defaults"),r.plot=function(t){var e=t._fullLayout,r=t.calcdata,a=e._subplots.mapbox;if(n.version!==f.requiredVersion)throw new Error(f.wrongVersionErrorMsg);var o=function(t,e){var r=t._fullLayout;if(""===t._context.mapboxAccessToken)return"";for(var n=[],a=[],o=!1,s=!1,l=0;l1&&i.warn(f.multipleTokensErrorMsg),n[0]):(a.length&&i.log(["Listed mapbox access token(s)",a.join(","),"but did not use a Mapbox map style, ignoring token(s)."].join(" ")),"")}(t,a);n.accessToken=o;for(var l=0;lb/2){var w=g.split("|").join("
");_.text(w).attr("data-unformatted",w).call(p.convertToTspans,t),x=c.bBox(_.node())}_.attr("transform",a(-3,8-x.height)),v.insert("rect",".static-attribution").attr({x:-x.width-6,y:-x.height-3,width:x.width+6,height:x.height+3,fill:"rgba(255, 255, 255, 0.75)"});var T=1;x.width+6>b&&(T=b/(x.width+6));var k=[n.l+n.w*h.x[1],n.t+n.h*(1-h.y[0])];v.attr("transform",a(k[0],k[1])+o(T))}},r.updateFx=function(t){for(var e=t._fullLayout,r=e._subplots.mapbox,n=0;n0){for(var r=0;r0}function c(t){var e={},r={};switch(t.type){case"circle":n.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":n.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity,"line-dasharray":t.line.dash});break;case"fill":n.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var i=t.symbol,o=a(i.textposition,i.iconsize);n.extendFlat(e,{"icon-image":i.icon+"-15","icon-size":i.iconsize/10,"text-field":i.text,"text-size":i.textfont.size,"text-anchor":o.anchor,"text-offset":o.offset,"symbol-placement":i.placement}),n.extendFlat(r,{"icon-color":t.color,"text-color":i.textfont.color,"text-opacity":t.opacity});break;case"raster":n.extendFlat(r,{"raster-fade-duration":0,"raster-opacity":t.opacity})}return{layout:e,paint:r}}l.update=function(t){this.visible?this.needsNewImage(t)?this.updateImage(t):this.needsNewSource(t)?(this.removeLayer(),this.updateSource(t),this.updateLayer(t)):this.needsNewLayer(t)?this.updateLayer(t):this.updateStyle(t):(this.updateSource(t),this.updateLayer(t)),this.visible=u(t)},l.needsNewImage=function(t){return this.subplot.map.getSource(this.idSource)&&"image"===this.sourceType&&"image"===t.sourcetype&&(this.source!==t.source||JSON.stringify(this.coordinates)!==JSON.stringify(t.coordinates))},l.needsNewSource=function(t){return this.sourceType!==t.sourcetype||JSON.stringify(this.source)!==JSON.stringify(t.source)||this.layerType!==t.type},l.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},l.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},l.updateImage=function(t){this.subplot.map.getSource(this.idSource).updateImage({url:t.source,coordinates:t.coordinates});var e=this.findFollowingMapboxLayerId(this.lookupBelow());null!==e&&this.subplot.map.moveLayer(this.idLayer,e)},l.updateSource=function(t){var e=this.subplot.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,u(t)){var r=function(t){var e,r=t.sourcetype,n=t.source,a={type:r};"geojson"===r?e="data":"vector"===r?e="string"==typeof n?"url":"tiles":"raster"===r?(e="tiles",a.tileSize=256):"image"===r&&(e="url",a.coordinates=t.coordinates);a[e]=n,t.sourceattribution&&(a.attribution=i(t.sourceattribution));return a}(t);e.addSource(this.idSource,r)}},l.findFollowingMapboxLayerId=function(t){if("traces"===t)for(var e=this.subplot.getMapLayers(),r=0;r1)for(r=0;r-1&&g(e.originalEvent,n,[r.xaxis],[r.yaxis],r.id,t),i.indexOf("event")>-1&&u.click(n,e.originalEvent)}}},b.updateFx=function(t){var e=this,r=e.map,n=e.gd;if(!e.isStatic){var a,o=t.dragmode;a=p(o)?function(t,r){(t.range={})[e.id]=[u([r.xmin,r.ymin]),u([r.xmax,r.ymax])]}:function(t,r,n){(t.lassoPoints={})[e.id]=n.filtered.map(u)};var s=e.dragOptions;e.dragOptions=i.extendDeep(s||{},{dragmode:t.dragmode,element:e.div,gd:n,plotinfo:{id:e.id,domain:t[e.id].domain,xaxis:e.xaxis,yaxis:e.yaxis,fillRangeItems:a},xaxes:[e.xaxis],yaxes:[e.yaxis],subplot:e.id}),r.off("click",e.onClickInPanHandler),f(o)||h(o)?(r.dragPan.disable(),r.on("zoomstart",e.clearSelect),e.dragOptions.prepFn=function(t,r,n){d(t,r,n,e.dragOptions,o)},l.init(e.dragOptions)):(r.dragPan.enable(),r.off("zoomstart",e.clearSelect),e.div.onmousedown=null,e.onClickInPanHandler=e.onClickInPanFn(e.dragOptions),r.on("click",e.onClickInPanHandler))}function u(t){var r=e.map.unproject(t);return[r.lng,r.lat]}},b.updateFramework=function(t){var e=t[this.id].domain,r=t._size,n=this.div.style;n.width=r.w*(e.x[1]-e.x[0])+"px",n.height=r.h*(e.y[1]-e.y[0])+"px",n.left=r.l+e.x[0]*r.w+"px",n.top=r.t+(1-e.y[1])*r.h+"px",this.xaxis._offset=r.l+e.x[0]*r.w,this.xaxis._length=r.w*(e.x[1]-e.x[0]),this.yaxis._offset=r.t+(1-e.y[1])*r.h,this.yaxis._length=r.h*(e.y[1]-e.y[0])},b.updateLayers=function(t){var e,r=t[this.id].layers,n=this.layerList;if(r.length!==n.length){for(e=0;e=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"),l=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(){_.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()&&l.text()?" - ":"")}},_.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var 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=_.graphJson(t,!1,"keepdata"),i.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(t,e){var r=t._context.locale;r||(r="en-US");var n=!1,i={};function a(t){for(var r=!0,a=0;a1&&D.length>1){for(o.getComponentMethod("grid","sizeDefaults")(c,l),s=0;s15&&D.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"),_.linkSubplots(h,l,p,a),_.cleanPlot(h,l,p,a);var N=!(!a._has||!a._has("gl2d")),U=!(!l._has||!l._has("gl2d")),j=!(!a._has||!a._has("cartesian"))||N,V=!(!l._has||!l._has("cartesian"))||U;j&&!V?a._bgLayer.remove():V&&!j&&(l._shouldCreateBgLayer=!0),a._zoomlayer&&!t._dragging&&f({_fullLayout:a}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var i=0;i0){var p=1-2*s;n=Math.round(p*n),i=Math.round(p*i)}}var h=_.layoutAttributes.width.min,f=_.layoutAttributes.height.min;n1,m=!e.height&&Math.abs(r.height-i)>1;(m||d)&&(d&&(r.width=n),m&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),_.sanitizeMargins(r)},_.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a,s,l=o.componentsRegistry,c=e._basePlotModules,p=o.subplotsRegistry.cartesian;for(i in l)(s=l[i]).includeBasePlot&&s.includeBasePlot(t,e);for(var h in c.length||c.push(p),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),p.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(u.subplotSort);for(a=0;a1&&(r.l/=h,r.r/=h);var f=(r.t+r.b)/s;f>1&&(r.t/=f,r.b/=f);var d=void 0!==r.xl?r.xl:r.x,m=void 0!==r.xr?r.xr:r.x,y=void 0!==r.yt?r.yt:r.y,g=void 0!==r.yb?r.yb:r.y;l[e]={l:{val:d,size:r.l+c},r:{val:m,size:r.r+c},b:{val:g,size:r.b+c},t:{val:y,size:r.t+c}},u[e]=1}else delete l[e],delete u[e];if(!n._replotting)return _.doAutoMargin(t)}},_.doAutoMargin=function(t){var e=t._fullLayout,r=e.width,n=e.height,i=Math.max(0,r-64),s=Math.max(0,n-64);e._size||(e._size={}),L(e);var l=e._size,c=e.margin,p=u.extendFlat({},l),f=c.l,d=c.r,m=c.t,y=c.b,g=e._pushmargin,v=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var x in g)v[x]||delete g[x];for(var b in g.base={l:{val:0,size:f},r:{val:1,size:d},t:{val:1,size:m},b:{val:0,size:y}},g){var w=g[b].l||{},T=g[b].b||{},k=w.val,A=w.size,M=T.val,S=T.size;for(var C in g){if(a(A)&&g[C].r){var E=g[C].r.val,I=g[C].r.size;if(E>k){var z=(A*E+(I-r)*k)/(E-k),P=(I*(1-k)+(A-r)*(1-E))/(E-k);z+P>f+d&&(f=z,d=P)}}if(a(S)&&g[C].t){var D=g[C].t.val,O=g[C].t.size;if(D>M){var R=(S*D+(O-n)*M)/(D-M),F=(O*(1-M)+(S-n)*(1-D))/(D-M);R+F>y+m&&(y=R,m=F)}}}}}var B=(f+d)/i;B>1&&(f/=B,d/=B);var N=(y+m)/s;if(N>1&&(y/=N,m/=N),l.l=Math.round(f),l.r=Math.round(d),l.t=Math.round(m),l.b=Math.round(y),l.p=Math.round(c.pad),l.w=Math.round(r)-l.l-l.r,l.h=Math.round(n)-l.t-l.b,!e._replotting&&_.didMarginChange(p,l)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var U=3*(1+Object.keys(v).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var a=0,s=0;function l(){return a++,function(){s++,n||s!==a||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(i)}}r.runFn(l),setTimeout(l())}))}],a=u.syncOrAsync(i,t);return a&&a.then||(a=Promise.resolve()),a.then((function(){return t}))}_.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},_.graphJson=function(t,e,r,n,i,a){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&_.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function c(t,e){if("function"==typeof t)return e?"_function_":null;if(u.isPlainObject(t)){var n,i={};return Object.keys(t).sort().forEach((function(a){if(-1===["_","["].indexOf(a.charAt(0)))if("function"!=typeof t[a]){if("keepdata"===r){if("src"===a.substr(a.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0&&!u.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0)return;i[a]=c(t[a],e)}else e&&(i[a]="_function")})),i}return Array.isArray(t)?t.map((function(t){return c(t,e)})):u.isTypedArray(t)?u.simpleMap(t,u.identity):u.isJSDate(t)?u.ms2DateTimeLocal(+t):t}var p={data:(o||[]).map((function(t){var r=c(t);return e&&delete r.fit,r}))};if(!e&&(p.layout=c(s),i)){var h=s._size;p.layout.computed={margin:{b:h.b,l:h.l,r:h.r,t:h.t}}}return t.framework&&t.framework.isPolar&&(p=t.framework.getConfig()),l&&(p.frames=c(l)),a&&(p.config=c(t._context,!0)),"object"===n?p:JSON.stringify(p)},_.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;a--)if(s[a].enabled){r._indexToPoints=s[a]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:p,y:p}]),o[0].t||(o[0].t={}),o[0].trace=r,d[e]=o}}for(P(l,c,f),i=0;i=0?h.angularAxis.domain:n.extent(T),C=Math.abs(T[1]-T[0]);A&&!k&&(C=0);var L=S.slice();M&&k&&(L[1]+=C);var E=h.angularAxis.ticksCount||4;E>8&&(E=E/(E/8)+E%8),h.angularAxis.ticksStep&&(E=(L[1]-L[0])/E);var I=h.angularAxis.ticksStep||(L[1]-L[0])/(E*(h.minorTicks+1));w&&(I=Math.max(Math.round(I),1)),L[2]||(L[2]=I);var z=n.range.apply(this,L);if(z=z.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=M?C:0,"undefined"==typeof(t=n.select(this).select("svg.chart-root"))||t.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),D=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));t=n.select(D)}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 O,R=t.select(".chart-group"),F={fill:"none",stroke:h.tickColor},B={"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){O=t.select(".legend-group").attr({transform:"translate("+[_,h.margin.top]+")"}).style({display:"block"});var N=f.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:f.map((function(t,e){return t.name||"Element"+e})),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:O,elements:N,reverseOrder:h.legend.reverseOrder})})();var U=O.node().getBBox();_=Math.min(h.width-U.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,_=Math.max(10,_),b=[h.margin.left+_,h.margin.top+_],r.range([0,_]),c.layout.radialAxis.domain=r.domain(),O.attr("transform","translate("+[b[0]+_,b[1]-_]+")")}else O=t.select(".legend-group").style({display:"none"});t.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),R.attr("transform","translate("+b+")").style({cursor:"crosshair"});var j=[(h.width-(h.margin.left+h.margin.right+2*_+(U?U.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*_))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),t.select(".outer-group").attr("transform","translate("+j+")"),h.title&&h.title.text){var V=t.select("g.title-group text").style(B).text(h.title.text),q=V.node().getBBox();V.attr({x:b[0]-q.width/2,y:b[1]-_-20})}var H=t.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var Z=H.selectAll("circle.grid-circle").data(r.ticks(5));Z.enter().append("circle").attr({class:"grid-circle"}).style(F),Z.attr("r",r),Z.exit().remove()}H.select("circle.outside-circle").attr({r:_}).style(F);var G=t.select("circle.background-circle").attr({r:_}).style({fill:h.backgroundColor,stroke:h.stroke});function X(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var W=n.svg.axis().scale(r).ticks(5).tickSize(5);H.call(W).attr({transform:"rotate("+h.radialAxis.orientation+")"}),H.selectAll(".domain").style(F),H.selectAll("g>text").text((function(t,e){return this.textContent+h.radialAxis.ticksSuffix})).style(B).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,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),H.selectAll("g>line").style({stroke:"black"})}var Y=t.select(".angular.axis-group").selectAll("g.angular-tick").data(z),K=Y.enter().append("g").classed("angular-tick",!0);Y.attr({transform:function(t,e){return"rotate("+X(t)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Y.exit().remove(),K.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(F),K.selectAll(".minor").style({stroke:h.minorTickColor}),Y.select("line.grid-line").attr({x1:h.tickLength?_-h.tickLength:0,x2:_}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(B);var J=Y.select("text.axis-text").attr({x:_+h.labelOffset,dy:a+"em",transform:function(t,e){var r=X(t),n=_+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(B);h.angularAxis.rewriteTicks&&J.text((function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)}));var Q=n.max(R.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));O.attr({transform:"translate("+[_+Q,h.margin.top]+")"});var $=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(f);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),f[0]||$){var et=[];f.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(!k){var pt=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",(function(t,e){var r=o.util.getMousePos(G).angle;pt.attr({x2:-_,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(_+12,r+180);lt.text(o.util.round(it)).move([i[0]+b[0],i[1]+b[1]])})).on("mouseout.angular-guide",(function(t,e){ot.select("line").style({opacity:0})}))}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",(function(t,e){var n=o.util.getMousePos(G).radius;ht.attr({r:n}).style({opacity:.5}),at=r.invert(o.util.getMousePos(G).radius);var i=o.util.convertToCartesian(n,h.radialAxis.orientation);ut.text(o.util.round(at)).move([i[0]+b[0],i[1]+b[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])};k&&(u.t=w[e[0]]);var c="t: "+u.t+", r: "+u.r,p=this.getBoundingClientRect(),h=t.node().getBoundingClientRect(),f=[p.left+p.width/2-j[0]-h.left,p.top+p.height/2-j[1]-h.top];ct.config({color:s}).text(c),ct.move(f)}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,p,"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 d.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return d.stroke(r,i,a)},"stroke-width":function(t,e){return d["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return d["stroke-dasharray"](r,i,a)},opacity:function(t,e){return d.opacity(r,i,a)},display:function(t,e){return d.display(r,i,a)}})}};var p=e.angularScale.range(),h=Math.abs(p[1]-p[0])/o[0].length*Math.PI/180,f=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:f,transform:function(t,r){return"rotate("+(e.orientation+s(t[0])+90)+")"}})};var d={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"}},m=n.select(this).selectAll("g.layer").data(o);m.enter().append("g").attr({class:"layer"});var y=m.selectAll("path.mark").data((function(t,e){return t}));y.enter().append("path").attr({class:"mark"}),y.style(d).each(u[e.geometryType]),y.exit().remove(),m.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,p=c?e.height:u*o.length,h=s.classed("legend-group",!0).selectAll("svg").data([0]),f=h.enter().append("svg").attr({width:300,height:p+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});f.append("g").classed("legend-axis",!0),f.append("g").classed("legend-marks",!0);var d=n.range(o.length),m=n.scale[c?"linear":"ordinal"]().domain(d).range(l),y=n.scale[c?"linear":"ordinal"]().domain(d)[c?"range":"rangePoints"]([0,p]);if(c){var g=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);g.enter().append("stop"),g.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 v=h.select(".legend-marks").selectAll("path.legend-mark").data(o);v.enter().append("path").classed("legend-mark",!0),v.attr({transform:function(t,e){return"translate("+[u/2,y(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 m(e)}}),v.exit().remove()}var _=n.svg.axis().scale(y).orient("right"),x=h.select("g.legend-axis").attr({transform:"translate("+[c?e.colorBandWidth:u,u/2]+")"}).call(_);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",p=i||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(p);var h=a.padding,f=e.node().getBBox(),d={fill:a.color,stroke:s,"stroke-width":"2px"},m=f.width+2*h+l,y=f.height+2*h;return r.attr({d:"M"+[[l,-y/2],[l,-y/4],[a.hasTick?0:l,0],[l,y/4],[l,y/2],[m,y/2],[m,-y/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[l,-y/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":184,"../../../lib":211,d3:16}],302:[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,p=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,p.add({undo:function(){n&&i(n)},redo:function(){i(t)}}),r=o.util.cloneJson(a)},h.undo=function(){p.undo()},h.redo=function(){p.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":82,"../../../lib":211,"./micropolar":301,"./undo_manager":303,d3:16}],303:[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||(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 r0){for(var n=[],i=0;i-1&&(p[f[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),i.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":82,"../components/drawing":104,"../constants/xmlns_namespaces":189,"../lib":211,d3:16}],315:[function(t,e,r){"use strict";var n=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../scattergeo/attributes"),a=t("../../components/colorscale/attributes"),o=t("../../plots/attributes"),s=t("../../components/color/attributes").defaultLine,l=t("../../lib/extend").extendFlat,u=i.marker.line;e.exports=l({locations:{valType:"data_array",editType:"calc"},locationmode:i.locationmode,z:{valType:"data_array",editType:"calc"},geojson:l({},i.geojson,{}),featureidkey:i.featureidkey,text:l({},i.text,{}),hovertext:l({},i.hovertext,{}),marker:{line:{color:l({},u.color,{dflt:s}),width:l({},u.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:i.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:i.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:l({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]}),hovertemplate:n(),showlegend:l({},o.showlegend,{dflt:!1})},a("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/color/attributes":81,"../../components/colorscale/attributes":89,"../../lib/extend":203,"../../plots/attributes":252,"../../plots/template_attributes":305,"../scattergeo/attributes":365}],316:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../constants/numerical").BADNUM,a=t("../../components/colorscale/calc"),o=t("../scatter/arrays_to_calcdata"),s=t("../scatter/calc_selection");function l(t){return t&&"string"==typeof t}e.exports=function(t,e){var r,u=e._length,c=new Array(u);r=e.geojson?function(t){return l(t)||n(t)}:l;for(var p=0;p")}(t,p,o),[t]}},{"../../lib":211,"../../plots/cartesian/axes":256,"./attributes":315}],319:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[];if(!1===e)for(r=0;r=0;n--){var i=r[n].id;if("string"==typeof i&&0===i.indexOf("water"))for(var a=n+1;a=0;r--)t.removeLayer(e[r][1])},s.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},e.exports=function(t,e){var r=e[0].trace,i=new o(t,r.uid),a=i.sourceId,s=n(e),l=i.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(a,{type:"geojson",data:s.geojson}),i._addLayers(s,l),e[0].trace._glTrace=i,i}},{"../../plots/mapbox/constants":289,"./convert":321}],325:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../../plots/attributes"),o=t("../scattermapbox/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s({lon:o.lon,lat:o.lat,z:{valType:"data_array",editType:"calc"},radius:{valType:"number",editType:"plot",arrayOk:!0,min:1,dflt:30},below:{valType:"string",editType:"plot"},text:o.text,hovertext:o.hovertext,hoverinfo:s({},a.hoverinfo,{flags:["lon","lat","z","text","name"]}),hovertemplate:i(),showlegend:s({},a.showlegend,{dflt:!1})},n("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/colorscale/attributes":89,"../../lib/extend":203,"../../plots/attributes":252,"../../plots/template_attributes":305,"../scattermapbox/attributes":367}],326:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").isArrayOrTypedArray,a=t("../../constants/numerical").BADNUM,o=t("../../components/colorscale/calc"),s=t("../../lib")._;e.exports=function(t,e){for(var r=e._length,l=new Array(r),u=e.z,c=i(u)&&u.length,p=0;p0?+f[c]:0),p.push({type:"Feature",geometry:{type:"Point",coordinates:g},properties:v})}}var x=o.extractOpts(e),b=x.reversescale?o.flipScale(x.colorscale):x.colorscale,w=b[0][1],T=["interpolate",["linear"],["heatmap-density"],0,a.opacity(w)<1?w:a.addOpacity(w,0)];for(c=1;c")}(u,c,l[0].t.labels),[s]}}},{"../../lib":211,"../../plots/cartesian/axes":256,"../scattermapbox/hover":372}],331:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../heatmap/colorbar"),formatLabels:t("../scattermapbox/format_labels"),calc:t("./calc"),plot:t("./plot"),hoverPoints:t("./hover"),eventData:t("./event_data"),getBelow:function(t,e){for(var r=e.getMapLayers(),n=0;n=0;r--)t.removeLayer(e[r][1])},o.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},e.exports=function(t,e){var r=e[0].trace,i=new a(t,r.uid),o=i.sourceId,s=n(e),l=i.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(o,{type:"geojson",data:s.geojson}),i._addLayers(s,l),i}},{"../../plots/mapbox/constants":289,"./convert":327}],333:[function(t,e,r){"use strict";e.exports={min:"zmin",max:"zmax"}},{}],334:[function(t,e,r){"use strict";var n=t("../../lib");function i(t){return-1!==t.indexOf("e")?t.replace(/[.]?0+e/,"e"):-1!==t.indexOf(".")?t.replace(/[.]?0+$/,""):t}r.formatPiePercent=function(t,e){var r=i((100*t).toPrecision(3));return n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=i(t.toPrecision(10));return n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;rl&&C[g].gap;)g--;for(_=C[g].s,m=C.length-1;m>g;m--)C[m].s=_;for(;lM[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}}}}}},{}],344:[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("./period_defaults"),c=t("./stack_defaults"),p=t("./marker_defaults"),h=t("./line_defaults"),f=t("./line_shape_defaults"),d=t("./text_defaults"),m=t("./fillcolor_defaults");e.exports=function(t,e,r,y){function g(r,i){return n.coerce(t,e,a,r,i)}var v=l(t,e,y,g);if(v||(e.visible=!1),e.visible){u(t,e,y,g);var _=c(t,e,y,g),x=!_&&vZ!=(F=z[E][1])>=Z&&(D=z[E-1][0],O=z[E][0],F-R&&(P=D+(O-D)*(Z-R)/(F-R),j=Math.min(j,P),V=Math.max(V,P)));j=Math.max(j,0),V=Math.min(V,h._length);var G=s.defaultLine;return s.opacity(p.fillcolor)?G=p.fillcolor:s.opacity((p.line||{}).color)&&(G=p.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:j,x1:V,y0:Z,y1:Z,color:G,hovertemplate:!1}),delete t.index,p.text&&!Array.isArray(p.text)?t.text=String(p.text):t.text=p.name,[t]}}}},{"../../components/color":82,"../../components/fx":122,"../../lib":211,"../../registry":306,"./get_trace_color":347}],349:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":269,"./arrays_to_calcdata":336,"./attributes":337,"./calc":338,"./cross_trace_calc":342,"./cross_trace_defaults":343,"./defaults":344,"./format_labels":346,"./hover":348,"./marker_colorbar":355,"./plot":358,"./select":359,"./style":361,"./subtypes":362}],350:[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":92,"../../components/colorscale/helpers":93,"../../lib":211}],351:[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,p=t("./constants");e.exports=function(t,e){var r,n,a,h,f,d,m,y,g,v,_,x,b,w,T,k,A,M,S=e.xaxis,C=e.yaxis,L="log"===S.type,E="log"===C.type,I=S._length,z=C._length,P=e.connectGaps,D=e.baseTolerance,O=e.shape,R="linear"===O,F=e.fill&&"none"!==e.fill,B=[],N=p.minTolerance,U=t.length,j=new Array(U),V=0;function q(r){var n=t[r];if(!n)return!1;var a=e.linearized?S.l2p(n.x):S.c2p(n.x),l=e.linearized?C.l2p(n.y):C.c2p(n.y);if(a===i){if(L&&(a=S.c2p(n.x,!0)),a===i)return!1;E&&l===i&&(a*=Math.abs(S._m*z*(S._m>0?o:s)/(C._m*I*(C._m>0?o:s)))),a*=1e3}if(l===i){if(E&&(l=C.c2p(n.y,!0)),l===i)return!1;l*=1e3}return[a,l]}function H(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===j[V-1][0],i=r===j[V-1][1];if(!n||!i)if(V>1){var a=e===j[V-2][0],o=r===j[V-2][1];n&&(e===et||e===rt)&&a?o?V--:j[V-1]=t:i&&(r===nt||r===it)&&o?a?V--:j[V-1]=t:j[V++]=t}else j[V++]=t}function ct(t){j[V-1][0]!==t[0]&&j[V-1][1]!==t[1]&&ut([Y,K]),ut(t),J=null,Y=K=0}function pt(t){if(A=t[0]/I,M=t[1]/z,X=t[0]rt?rt:0,W=t[1]it?it:0,X||W){if(V)if(J){var e=$(J,t);e.length>1&&(ct(e[0]),j[V++]=e[1])}else Q=$(j[V-1],t)[0],j[V++]=Q;else j[V++]=[X||t[0],W||t[1]];var r=j[V-1];X&&W&&(r[0]!==X||r[1]!==W)?(J&&(Y!==X&&K!==W?ut(Y&&K?(n=J,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]):[Y||X,K||W]):Y&&K&&ut([Y,K])),ut([X,W])):Y-X&&K-W&&ut([X||Y,W||K]),J=t,Y=X,K=W}else J&&ct($(J,t)[0]),j[V++]=t;var n,i,a,o}for("linear"===O||"spline"===O?$=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&&G(o,t)Z(d,ht))break;a=d,(b=g[0]*y[0]+g[1]*y[1])>_?(_=b,h=d,m=!1):b=t.length||!d)break;pt(d),n=d}}else pt(h)}J&&ut([Y||J[0],K||J[1]]),B.push(j.slice(0,V))}return B}},{"../../constants/numerical":188,"../../lib":211,"./constants":341}],352:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],353:[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,p=-1,h=0,f=-1;for(a=0;a=0?l=f:(l=f=h,h++),l0?Math.max(e,i):0}}},{"fast-isnumeric":18}],355:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],356:[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),p=(t.line||{}).color;(u=u||{},p&&(r=p),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",p&&!Array.isArray(p)&&e.marker.color!==p?p: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":82,"../../components/colorscale/defaults":92,"../../components/colorscale/helpers":93,"./subtypes":362}],357:[function(t,e,r){"use strict";var n=t("../../lib").dateTick0,i=t("../../constants/numerical").ONEWEEK;function a(t,e){return n(e,t%i==0?1:0)}e.exports=function(t,e,r,n,i){if(i||(i={x:!0,y:!0}),i.x){var o=n("xperiod");o&&(n("xperiod0",a(o,e.xcalendar)),n("xperiodalignment"))}if(i.y){var s=n("yperiod");s&&(n("yperiod0",a(s,e.ycalendar)),n("yperiodalignment"))}}},{"../../constants/numerical":188,"../../lib":211}],358:[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"),p=t("./link_traces"),h=t("../../lib/polygon").tester;function f(t,e,r,p,f,d,m){var y;!function(t,e,r,i,o){var s=r.xaxis,l=r.yaxis,c=n.extent(a.simpleMap(s.range,s.r2c)),p=n.extent(a.simpleMap(l.range,l.r2c)),h=i[0].trace;if(!u.hasMarkers(h))return;var f=h.marker.maxdisplayed;if(0===f)return;var d=i.filter((function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=p[0]&&t.y<=p[1]})),m=Math.ceil(d.length/f),y=0;o.forEach((function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function v(t){return g?t.transition():t}var _=r.xaxis,x=r.yaxis,b=p[0].trace,w=b.line,T=n.select(d),k=o(T,"g","errorbars"),A=o(T,"g","lines"),M=o(T,"g","points"),S=o(T,"g","text");if(i.getComponentMethod("errorbars","plot")(t,k,r,m),!0===b.visible){var C,L;v(T).style("opacity",b.opacity);var E=b.fill.charAt(b.fill.length-1);"x"!==E&&"y"!==E&&(E=""),p[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var I,z,P="",D=[],O=b._prevtrace;O&&(P=O._prevRevpath||"",L=O._nextFill,D=O._polygons);var R,F,B,N,U,j,V,q="",H="",Z=[],G=a.noop;if(C=b._ownFill,u.hasLines(b)||"none"!==b.fill){for(L&&L.datum(p),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(R=l.steps(w.shape),F=l.steps(w.shape.split("").reverse().join(""))):R=F="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")},B=function(t){return F(t.reverse())},Z=c(p,{xaxis:_,yaxis:x,connectGaps:b.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:b.fill}),V=b._polygons=new Array(Z.length),y=0;y1){var r=n.select(this);if(r.datum(p),t)v(r.style("opacity",0).attr("d",I).call(l.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",I),l.singleLineStyle(p,i)}}}}}var X=A.selectAll(".js-line").data(Z);v(X.exit()).style("opacity",0).remove(),X.each(G(!1)),X.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(G(!0)),l.setClipUrl(X,r.layerClipId,t),Z.length?(C?(C.datum(p),N&&j&&(E?("y"===E?N[1]=j[1]=x.c2p(0,!0):"x"===E&&(N[0]=j[0]=_.c2p(0,!0)),v(C).attr("d","M"+j+"L"+N+"L"+q.substr(1)).call(l.singleFillStyle)):v(C).attr("d",q+"Z").call(l.singleFillStyle))):L&&("tonext"===b.fill.substr(0,6)&&q&&P?("tonext"===b.fill?v(L).attr("d",q+"Z"+P+"Z").call(l.singleFillStyle):v(L).attr("d",q+"L"+P.substr(1)+"Z").call(l.singleFillStyle),b._polygons=b._polygons.concat(D)):(Y(L),b._polygons=null)),b._prevRevpath=H,b._prevPolygons=V):(C?Y(C):L&&Y(L),b._polygons=b._prevRevpath=b._prevPolygons=null),M.datum(p),S.datum(p),function(e,i,a){var o,c=a[0].trace,p=u.hasMarkers(c),h=u.hasText(c),f=tt(c),d=et,m=et;if(p||h){var y=s,b=c.stackgroup,w=b&&"infer zero"===t._fullLayout._scatterStackOpts[_._id+x._id][b].stackgaps;c.marker.maxdisplayed||c._needsCull?y=w?J:K:b&&!w&&(y=Q),p&&(d=y),h&&(m=y)}var T,k=(o=e.selectAll("path.point").data(d,f)).enter().append("path").classed("point",!0);g&&k.call(l.pointStyle,c,t).call(l.translatePoints,_,x).style("opacity",0).transition().style("opacity",1),o.order(),p&&(T=l.makePointStyleFns(c)),o.each((function(e){var i=n.select(this),a=v(i);l.translatePoint(e,a,_,x)?(l.singlePointStyle(e,a,c,T,t),r.layerClipId&&l.hideOutsideRangePoint(e,a,_,x,c.xcalendar,c.ycalendar),c.customdata&&i.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()})),g?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=i.selectAll("g").data(m,f)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(t){var e=n.select(this),i=v(e.select("text"));l.translatePoint(t,i,_,x)?r.layerClipId&&l.hideOutsideRangePoint(t,e,_,x,c.xcalendar,c.ycalendar):e.remove()})),o.selectAll("text").call(l.textPointStyle,c,t).each((function(t){var e=_.c2p(t.x),r=x.c2p(t.y);n.select(this).selectAll("tspan.line").each((function(){v(n.select(this)).attr({x:e,y:r})}))})),o.exit().remove()}(M,S,p);var W=!1===b.cliponaxis?null:r.layerClipId;l.setClipUrl(M,W,t),l.setClipUrl(S,W,t)}function Y(t){v(t).attr("d","M0,0Z")}function K(t){return t.filter((function(t){return!t.gap&&t.vis}))}function J(t){return t.filter((function(t){return t.vis}))}function Q(t){return t.filter((function(t){return!t.gap}))}function $(t){return t.id}function tt(t){if(t.ids)return $}function et(){return!1}}e.exports=function(t,e,r,i,a,u){var c,h,d=!a,m=!!a&&a.duration>0,y=p(t,e,r);((c=i.selectAll("g.trace").data(y,(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),m)?(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){f(t,n,e,r,y,this,a)}))}))):c.each((function(r,n){f(t,n,e,r,y,this,a)}));d&&c.exit().remove(),i.selectAll("path:not([d])").remove()}},{"../../components/drawing":104,"../../lib":211,"../../lib/polygon":223,"../../registry":306,"./line_points":351,"./link_traces":353,"./subtypes":362,d3:16}],359:[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=[],p=s[0].trace;if(!n.hasMarkers(p)&&!n.hasText(p))return[];if(!1===e)for(r=0;r=0?Math.floor((e+180)/360):Math.ceil((e-180)/360)),d=e-f;if(n.getClosest(l,(function(t){var e=t.lonlat;if(e[0]===s)return 1/0;var n=i.modHalf(e[0],360),a=e[1],o=h.project([n,a]),l=o.x-c.c2p([d,a]),u=o.y-p.c2p([n,r]),f=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(l*l+u*u)-f,1-3/f)}),t),!1!==t.index){var m=l[t.index],y=m.lonlat,g=[i.modHalf(y[0],360)+f,y[1]],v=c.c2p(g),_=p.c2p(g),x=m.mrc||1;t.x0=v-x,t.x1=v+x,t.y0=_-x,t.y1=_+x;var b={};b[u.subplot]={_subplot:h};var w=u._module.formatLabels(m,u,b);return t.lonLabel=w.lonLabel,t.latLabel=w.latLabel,t.color=a(u,m),t.extraText=function(t,e,r){if(t.hovertemplate)return;var n=(e.hi||t.hoverinfo).split("+"),i=-1!==n.indexOf("all"),a=-1!==n.indexOf("lon"),s=-1!==n.indexOf("lat"),l=e.lonlat,u=[];function c(t){return t+"\xb0"}i||a&&s?u.push("("+c(l[0])+", "+c(l[1])+")"):a?u.push(r.lon+c(l[0])):s&&u.push(r.lat+c(l[1]));(i||-1!==n.indexOf("text"))&&o(e,t,u);return u.join("
")}(u,m,l[0].t.labels),t.hovertemplate=u.hovertemplate,[t]}}},{"../../components/fx":122,"../../constants/numerical":188,"../../lib":211,"../scatter/get_trace_color":347}],373:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("../scattergeo/calc"),plot:t("./plot"),hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),styleOnSelect:function(t,e){e&&e[0].trace._glTrace.update(e)},moduleType:"trace",name:"scattermapbox",basePlotModule:t("../../plots/mapbox"),categories:["mapbox","gl","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/mapbox":291,"../scatter/marker_colorbar":355,"../scattergeo/calc":366,"./attributes":367,"./defaults":369,"./event_data":370,"./format_labels":371,"./hover":372,"./plot":374,"./select":375}],374:[function(t,e,r){"use strict";var n=t("./convert"),i=t("../../plots/mapbox/constants").traceLayerPrefix,a=["fill","line","circle","symbol"];function o(t,e){this.type="scattermapbox",this.subplot=t,this.uid=e,this.sourceIds={fill:"source-"+e+"-fill",line:"source-"+e+"-line",circle:"source-"+e+"-circle",symbol:"source-"+e+"-symbol"},this.layerIds={fill:i+e+"-fill",line:i+e+"-line",circle:i+e+"-circle",symbol:i+e+"-symbol"},this.below=null}var s=o.prototype;s.addSource=function(t,e){this.subplot.map.addSource(this.sourceIds[t],{type:"geojson",data:e.geojson})},s.setSourceData=function(t,e){this.subplot.map.getSource(this.sourceIds[t]).setData(e.geojson)},s.addLayer=function(t,e,r){this.subplot.addLayer({type:t,id:this.layerIds[t],source:this.sourceIds[t],layout:e.layout,paint:e.paint},r)},s.update=function(t){var e,r,i,o=this.subplot,s=o.map,l=n(o.gd,t),u=o.belowLookup["trace-"+this.uid];if(u!==this.below){for(e=a.length-1;e>=0;e--)r=a[e],s.removeLayer(this.layerIds[r]);for(e=0;e=0;e--){var r=a[e];t.removeLayer(this.layerIds[r]),t.removeSource(this.sourceIds[r])}},e.exports=function(t,e){for(var r=e[0].trace,i=new o(t,r.uid),s=n(t.gd,e),l=i.below=t.belowLookup["trace-"+r.uid],u=0;u 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -12848,19 +12809,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -12869,7 +12829,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -12877,33 +12837,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -12925,44 +12881,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -12972,20 +12913,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -13007,35 +12947,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -13044,7 +12987,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -13052,7 +12995,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -13061,7 +13004,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -13074,17 +13017,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -13107,12 +13051,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -13121,16 +13065,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -13138,6 +13075,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -13146,27 +13089,37 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],111:[function(_dereq_,module,exports){ -(function (Buffer){ +(function (Buffer){(function (){ /*! * The buffer module from node.js, for the browser. * @@ -14945,8 +14898,8 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -}).call(this,_dereq_("buffer").Buffer) -},{"base64-js":79,"buffer":111,"ieee754":416}],112:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"base64-js":79,"buffer":111,"ieee754":442}],112:[function(_dereq_,module,exports){ 'use strict' var monotoneTriangulate = _dereq_('./lib/monotone') @@ -15147,7 +15100,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":96,"robust-in-sphere":518}],114:[function(_dereq_,module,exports){ +},{"binary-search-bounds":96,"robust-in-sphere":546}],114:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -15518,7 +15471,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":96,"robust-orientation":520}],116:[function(_dereq_,module,exports){ +},{"binary-search-bounds":96,"robust-orientation":548}],116:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -15712,7 +15665,7 @@ function circumcenter(points) { circumcenter.barycenetric = barycentricCircumcenter module.exports = circumcenter -},{"dup":176,"robust-linear-solve":519}],119:[function(_dereq_,module,exports){ +},{"dup":176,"robust-linear-solve":547}],119:[function(_dereq_,module,exports){ module.exports = circumradius var circumcenter = _dereq_('circumcenter') @@ -16120,7 +16073,7 @@ function cleanPSLG (points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":122,"big-rat":83,"big-rat/cmp":81,"big-rat/to-float":95,"box-intersect":101,"nextafter":470,"rat-vec":504,"robust-segment-intersect":523,"union-find":568}],122:[function(_dereq_,module,exports){ +},{"./lib/rat-seg-intersect":122,"big-rat":83,"big-rat/cmp":81,"big-rat/to-float":95,"box-intersect":101,"nextafter":496,"rat-vec":530,"robust-segment-intersect":551,"union-find":596}],122:[function(_dereq_,module,exports){ 'use strict' module.exports = solveIntersection @@ -16164,7 +16117,7 @@ function solveIntersection (a, b, c, d) { return r } -},{"big-rat/div":82,"big-rat/mul":92,"big-rat/sign":93,"big-rat/sub":94,"rat-vec/add":503,"rat-vec/muls":505,"rat-vec/sub":506}],123:[function(_dereq_,module,exports){ +},{"big-rat/div":82,"big-rat/mul":92,"big-rat/sign":93,"big-rat/sub":94,"rat-vec/add":529,"rat-vec/muls":531,"rat-vec/sub":532}],123:[function(_dereq_,module,exports){ /** @module color-id */ 'use strict' @@ -16441,7 +16394,7 @@ function isInt(color) { } },{"clamp":120,"color-rgba":127,"dtype":175}],126:[function(_dereq_,module,exports){ -(function (global){ +(function (global){(function (){ /** * @module color-parse */ @@ -16618,8 +16571,8 @@ function parse (cstr) { } } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"color-name":124,"defined":170,"is-plain-obj":443}],127:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"color-name":124,"defined":170,"is-plain-obj":469}],127:[function(_dereq_,module,exports){ /** @module color-rgba */ 'use strict' @@ -17013,7 +16966,7 @@ function rgbaStr (rgba) { return 'rgba(' + rgba.join(',') + ')'; } -},{"./colorScale":130,"lerp":446}],132:[function(_dereq_,module,exports){ +},{"./colorScale":130,"lerp":472}],132:[function(_dereq_,module,exports){ "use strict" module.exports = compareAngle @@ -17099,7 +17052,7 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":520,"robust-product":521,"robust-sum":525,"signum":526,"two-sum":555}],133:[function(_dereq_,module,exports){ +},{"robust-orientation":548,"robust-product":549,"robust-sum":553,"signum":554,"two-sum":583}],133:[function(_dereq_,module,exports){ module.exports = compareCells var min = Math.min @@ -17240,7 +17193,7 @@ function convexHull2D(points) { return edges } -},{"monotone-convex-hull-2d":456}],138:[function(_dereq_,module,exports){ +},{"monotone-convex-hull-2d":482}],138:[function(_dereq_,module,exports){ 'use strict' module.exports = convexHullnD @@ -17301,7 +17254,7 @@ function convexHullnD(points, d) { return invPermute(nhull, ah) } } -},{"affine-hull":67,"incremental-convex-hull":433}],139:[function(_dereq_,module,exports){ +},{"affine-hull":67,"incremental-convex-hull":459}],139:[function(_dereq_,module,exports){ module.exports = { AFG: 'afghan', ALA: '\\b\\wland', @@ -17740,7 +17693,7 @@ function parseLineHeight(value) { return value } -},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"string-split-by":540,"unquote":570}],147:[function(_dereq_,module,exports){ +},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"string-split-by":568,"unquote":598}],147:[function(_dereq_,module,exports){ 'use strict' var pick = _dereq_('pick-by-alias') @@ -17844,7 +17797,7 @@ function a2o (a) { return o } -},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"pick-by-alias":485}],148:[function(_dereq_,module,exports){ +},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"pick-by-alias":511}],148:[function(_dereq_,module,exports){ module.exports=[ "inherit", "initial", @@ -18372,7 +18325,7 @@ function generateCWiseOp(proc, typesig) { } module.exports = generateCWiseOp -},{"uniq":569}],153:[function(_dereq_,module,exports){ +},{"uniq":597}],153:[function(_dereq_,module,exports){ "use strict" // The function below is called when constructing a cwise function object, and does the following: @@ -18495,7 +18448,7 @@ module.exports = function (props/*, options*/) { return map(props, function (desc, name) { return define(name, desc, options); }); }; -},{"es5-ext/object/copy":196,"es5-ext/object/map":204,"es5-ext/object/normalize-options":205,"type/plain-function/ensure":561,"type/value/ensure":565,"type/value/is":566}],155:[function(_dereq_,module,exports){ +},{"es5-ext/object/copy":196,"es5-ext/object/map":204,"es5-ext/object/normalize-options":205,"type/plain-function/ensure":589,"type/value/ensure":593,"type/value/is":594}],155:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("type/value/is") @@ -18559,7 +18512,7 @@ d.gs = function (dscr, get, set/*, options*/) { return !options ? desc : assign(normalizeOpts(options), desc); }; -},{"es5-ext/object/assign":193,"es5-ext/object/normalize-options":205,"es5-ext/string/#/contains":212,"type/plain-function/is":562,"type/value/is":566}],156:[function(_dereq_,module,exports){ +},{"es5-ext/object/assign":193,"es5-ext/object/normalize-options":205,"es5-ext/string/#/contains":212,"type/plain-function/is":590,"type/value/is":594}],156:[function(_dereq_,module,exports){ // https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -36079,7 +36032,7 @@ function triangulate(points, includePointAtInfinity) { return hull } -},{"incremental-convex-hull":433,"uniq":569}],172:[function(_dereq_,module,exports){ +},{"incremental-convex-hull":459,"uniq":597}],172:[function(_dereq_,module,exports){ 'use strict' @@ -36150,7 +36103,7 @@ function createPairs (range) { } },{}],173:[function(_dereq_,module,exports){ -(function (Buffer){ +(function (Buffer){(function (){ var hasTypedArrays = false if(typeof Float64Array !== "undefined") { var DOUBLE_VIEW = new Float64Array(1) @@ -36252,7 +36205,7 @@ module.exports.denormalized = function(n) { var hi = module.exports.hi(n) return !(hi & 0x7ff00000) } -}).call(this,_dereq_("buffer").Buffer) +}).call(this)}).call(this,_dereq_("buffer").Buffer) },{"buffer":111}],174:[function(_dereq_,module,exports){ var abs = _dereq_('abs-svg-path') var normalize = _dereq_('normalize-svg-path') @@ -36279,7 +36232,7 @@ module.exports = function(context, segments) { context.closePath() } -},{"abs-svg-path":65,"normalize-svg-path":471}],175:[function(_dereq_,module,exports){ +},{"abs-svg-path":65,"normalize-svg-path":497}],175:[function(_dereq_,module,exports){ module.exports = function(dtype) { switch (dtype) { case 'int8': @@ -37070,7 +37023,7 @@ function edgeToAdjacency(edges, numVertices) { } return adj } -},{"uniq":569}],179:[function(_dereq_,module,exports){ +},{"uniq":597}],179:[function(_dereq_,module,exports){ var tarjan = _dereq_('strongly-connected-components'); module.exports = function findCircuits(edges, cb) { @@ -37228,7 +37181,7 @@ module.exports = function findCircuits(edges, cb) { } }; -},{"strongly-connected-components":541}],180:[function(_dereq_,module,exports){ +},{"strongly-connected-components":569}],180:[function(_dereq_,module,exports){ // Inspired by Google Closure: // http://closure-library.googlecode.com/svn/docs/ // closure_goog_array_array.js.html#goog.array.clear @@ -38129,7 +38082,7 @@ module.exports = function (value) { }; },{"./is-iterable":221}],224:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -39305,8 +39258,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":500}],225:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":526}],225:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() @@ -39732,7 +39685,7 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":444}],242:[function(_dereq_,module,exports){ +},{"is-string-blank":470}],242:[function(_dereq_,module,exports){ 'use strict' module.exports = createFilteredVector @@ -42220,7 +42173,7 @@ function createBackgroundCube(gl) { return new BackgroundCube(gl, buffer, vao, shader) } -},{"./shaders":254,"gl-buffer":258,"gl-vao":332}],252:[function(_dereq_,module,exports){ +},{"./shaders":254,"gl-buffer":259,"gl-vao":358}],252:[function(_dereq_,module,exports){ "use strict" module.exports = getCubeEdges @@ -42462,7 +42415,7 @@ function getCubeEdges(model, view, projection, bounds, ortho) { //Return result return CUBE_RESULT } -},{"bit-twiddle":97,"gl-mat4/multiply":280,"robust-orientation":520,"split-polygon":538}],253:[function(_dereq_,module,exports){ +},{"bit-twiddle":97,"gl-mat4/multiply":295,"robust-orientation":548,"split-polygon":566}],253:[function(_dereq_,module,exports){ 'use strict' module.exports = createLines @@ -42672,7 +42625,7 @@ function createLines(gl, bounds, ticks) { return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } -},{"./shaders":254,"gl-buffer":258,"gl-vao":332}],254:[function(_dereq_,module,exports){ +},{"./shaders":254,"gl-buffer":259,"gl-vao":358}],254:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -42703,8 +42656,8 @@ exports.bg = function(gl) { ]) } -},{"gl-shader":312,"glslify":413}],255:[function(_dereq_,module,exports){ -(function (process){ +},{"gl-shader":335,"glslify":257}],255:[function(_dereq_,module,exports){ +(function (process){(function (){ "use strict" module.exports = createTextSprites @@ -42924,8 +42877,8 @@ function createTextSprites( return result } -}).call(this,_dereq_('_process')) -},{"./shaders":254,"_process":500,"gl-buffer":258,"gl-vao":332,"vectorize-text":572}],256:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process')) +},{"./shaders":254,"_process":526,"gl-buffer":259,"gl-vao":358,"vectorize-text":600}],256:[function(_dereq_,module,exports){ 'use strict' exports.create = defaultTicks @@ -43007,6 +42960,18 @@ function ticksEqual(ticksA, ticksB) { return true } },{}],257:[function(_dereq_,module,exports){ +module.exports = function(strings) { + if (typeof strings === 'string') strings = [strings] + var exprs = [].slice.call(arguments,1) + var parts = [] + for (var i = 0; i < strings.length-1; i++) { + parts.push(strings[i], exprs[i] || '') + } + parts.push(strings[i]) + return parts.join('') +} + +},{}],258:[function(_dereq_,module,exports){ "use strict" module.exports = axesProperties @@ -43150,7 +43115,7 @@ i_loop: return ranges } -},{"./lib/cube.js":252,"extract-frustum-planes":240,"gl-mat4/multiply":280,"gl-mat4/transpose":289,"gl-vec4/transformMat4":403,"split-polygon":538}],258:[function(_dereq_,module,exports){ +},{"./lib/cube.js":252,"extract-frustum-planes":240,"gl-mat4/multiply":295,"gl-mat4/transpose":306,"gl-vec4/transformMat4":429,"split-polygon":566}],259:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -43304,7 +43269,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":469,"ndarray-ops":464,"typedarray-pool":567}],259:[function(_dereq_,module,exports){ +},{"ndarray":495,"ndarray-ops":490,"typedarray-pool":595}],260:[function(_dereq_,module,exports){ "use strict"; var vec3 = _dereq_('gl-vec3'); @@ -43442,7 +43407,7 @@ module.exports.createConeMesh = function(gl, params) { }); } -},{"./create_mesh":260,"./lib/shaders":261,"gl-vec3":351}],260:[function(_dereq_,module,exports){ +},{"./create_mesh":261,"./lib/shaders":262,"gl-vec3":377}],261:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -44017,7 +43982,7 @@ function createVectorMesh(gl, params, opts) { module.exports = createVectorMesh -},{"colormap":131,"gl-buffer":258,"gl-mat4/invert":278,"gl-mat4/multiply":280,"gl-shader":312,"gl-texture2d":327,"gl-vao":332,"ndarray":469}],261:[function(_dereq_,module,exports){ +},{"colormap":131,"gl-buffer":259,"gl-mat4/invert":293,"gl-mat4/multiply":295,"gl-shader":335,"gl-texture2d":353,"gl-vao":358,"ndarray":495}],262:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["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;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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"]) @@ -44045,7 +44010,9 @@ exports.pickShader = { ] } -},{"glslify":413}],262:[function(_dereq_,module,exports){ +},{"glslify":263}],263:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],264:[function(_dereq_,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -44345,14 +44312,14 @@ module.exports = { 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],263:[function(_dereq_,module,exports){ +},{}],265:[function(_dereq_,module,exports){ var gl10 = _dereq_('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":262}],264:[function(_dereq_,module,exports){ +},{"./1.0/numbers":264}],266:[function(_dereq_,module,exports){ 'use strict' module.exports = createErrorBars @@ -44603,7 +44570,9 @@ function createErrorBars(options) { return result } -},{"./shaders/index":265,"gl-buffer":258,"gl-vao":332}],265:[function(_dereq_,module,exports){ +},{"./shaders/index":268,"gl-buffer":259,"gl-vao":358}],267:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],268:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -44620,7 +44589,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":312,"glslify":413}],266:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":267}],269:[function(_dereq_,module,exports){ 'use strict' var createTexture = _dereq_('gl-texture2d') @@ -45087,7 +45056,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":327}],267:[function(_dereq_,module,exports){ +},{"gl-texture2d":353}],270:[function(_dereq_,module,exports){ var sprintf = _dereq_('sprintf-js').sprintf; var glConstants = _dereq_('gl-constants/lookup'); @@ -45142,7 +45111,7 @@ function formatCompilerError(errLog, src, type) { } -},{"add-line-numbers":66,"gl-constants/lookup":263,"glsl-shader-name":405,"sprintf-js":539}],268:[function(_dereq_,module,exports){ +},{"add-line-numbers":66,"gl-constants/lookup":265,"glsl-shader-name":431,"sprintf-js":567}],271:[function(_dereq_,module,exports){ 'use strict' module.exports = createHeatmap2D @@ -45494,7 +45463,7 @@ function createHeatmap2D (plot, options) { return heatmap } -},{"./lib/shaders":269,"binary-search-bounds":96,"gl-buffer":258,"gl-shader":312,"iota-array":437,"typedarray-pool":567}],269:[function(_dereq_,module,exports){ +},{"./lib/shaders":272,"binary-search-bounds":96,"gl-buffer":259,"gl-shader":335,"iota-array":463,"typedarray-pool":595}],272:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -45506,7 +45475,9 @@ module.exports = { pickVertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]) } -},{"glslify":413}],270:[function(_dereq_,module,exports){ +},{"glslify":273}],273:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],274:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') @@ -45530,7 +45501,7 @@ exports.createPickShader = function(gl) { return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) } -},{"gl-shader":312,"glslify":413}],271:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":276}],275:[function(_dereq_,module,exports){ 'use strict' module.exports = createLinePlot @@ -45931,7 +45902,43 @@ function createLinePlot (options) { return linePlot } -},{"./lib/shaders":270,"binary-search-bounds":96,"gl-buffer":258,"gl-texture2d":327,"gl-vao":332,"ndarray":469}],272:[function(_dereq_,module,exports){ +},{"./lib/shaders":274,"binary-search-bounds":96,"gl-buffer":259,"gl-texture2d":353,"gl-vao":358,"ndarray":495}],276:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],277:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],278:[function(_dereq_,module,exports){ module.exports = clone; /** @@ -45960,7 +45967,36 @@ function clone(a) { out[15] = a[15]; return out; }; -},{}],273:[function(_dereq_,module,exports){ +},{}],279:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],280:[function(_dereq_,module,exports){ module.exports = create; /** @@ -45988,7 +46024,7 @@ function create() { out[15] = 1; return out; }; -},{}],274:[function(_dereq_,module,exports){ +},{}],281:[function(_dereq_,module,exports){ module.exports = determinant; /** @@ -46019,7 +46055,7 @@ function determinant(a) { // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; -},{}],275:[function(_dereq_,module,exports){ +},{}],282:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -46067,7 +46103,62 @@ function fromQuat(out, q) { return out; }; -},{}],276:[function(_dereq_,module,exports){ +},{}],283:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],284:[function(_dereq_,module,exports){ module.exports = fromRotationTranslation; /** @@ -46121,7 +46212,223 @@ function fromRotationTranslation(out, q, v) { return out; }; -},{}],277:[function(_dereq_,module,exports){ +},{}],285:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],286:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],287:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],288:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],289:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],290:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],291:[function(_dereq_,module,exports){ module.exports = identity; /** @@ -46149,7 +46456,40 @@ function identity(out) { out[15] = 1; return out; }; -},{}],278:[function(_dereq_,module,exports){ +},{}],292:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":277,"./clone":278,"./copy":279,"./create":280,"./determinant":281,"./fromQuat":282,"./fromRotation":283,"./fromRotationTranslation":284,"./fromScaling":285,"./fromTranslation":286,"./fromXRotation":287,"./fromYRotation":288,"./fromZRotation":289,"./frustum":290,"./identity":291,"./invert":293,"./lookAt":294,"./multiply":295,"./ortho":296,"./perspective":297,"./perspectiveFromFieldOfView":298,"./rotate":299,"./rotateX":300,"./rotateY":301,"./rotateZ":302,"./scale":303,"./str":304,"./translate":305,"./transpose":306}],293:[function(_dereq_,module,exports){ module.exports = invert; /** @@ -46205,7 +46545,7 @@ function invert(out, a) { return out; }; -},{}],279:[function(_dereq_,module,exports){ +},{}],294:[function(_dereq_,module,exports){ var identity = _dereq_('./identity'); module.exports = lookAt; @@ -46296,7 +46636,7 @@ function lookAt(out, eye, center, up) { return out; }; -},{"./identity":277}],280:[function(_dereq_,module,exports){ +},{"./identity":291}],295:[function(_dereq_,module,exports){ module.exports = multiply; /** @@ -46339,7 +46679,7 @@ function multiply(out, a, b) { out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; -},{}],281:[function(_dereq_,module,exports){ +},{}],296:[function(_dereq_,module,exports){ module.exports = ortho; /** @@ -46376,7 +46716,7 @@ function ortho(out, left, right, bottom, top, near, far) { out[15] = 1; return out; }; -},{}],282:[function(_dereq_,module,exports){ +},{}],297:[function(_dereq_,module,exports){ module.exports = perspective; /** @@ -46410,7 +46750,49 @@ function perspective(out, fovy, aspect, near, far) { out[15] = 0; return out; }; -},{}],283:[function(_dereq_,module,exports){ +},{}],298:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],299:[function(_dereq_,module,exports){ module.exports = rotate; /** @@ -46475,7 +46857,7 @@ function rotate(out, a, rad, axis) { } return out; }; -},{}],284:[function(_dereq_,module,exports){ +},{}],300:[function(_dereq_,module,exports){ module.exports = rotateX; /** @@ -46520,7 +46902,7 @@ function rotateX(out, a, rad) { out[11] = a23 * c - a13 * s; return out; }; -},{}],285:[function(_dereq_,module,exports){ +},{}],301:[function(_dereq_,module,exports){ module.exports = rotateY; /** @@ -46565,7 +46947,7 @@ function rotateY(out, a, rad) { out[11] = a03 * s + a23 * c; return out; }; -},{}],286:[function(_dereq_,module,exports){ +},{}],302:[function(_dereq_,module,exports){ module.exports = rotateZ; /** @@ -46610,7 +46992,7 @@ function rotateZ(out, a, rad) { out[7] = a13 * c - a03 * s; return out; }; -},{}],287:[function(_dereq_,module,exports){ +},{}],303:[function(_dereq_,module,exports){ module.exports = scale; /** @@ -46642,7 +47024,22 @@ function scale(out, a, v) { out[15] = a[15]; return out; }; -},{}],288:[function(_dereq_,module,exports){ +},{}],304:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],305:[function(_dereq_,module,exports){ module.exports = translate; /** @@ -46681,7 +47078,7 @@ function translate(out, a, v) { return out; }; -},{}],289:[function(_dereq_,module,exports){ +},{}],306:[function(_dereq_,module,exports){ module.exports = transpose; /** @@ -46731,7 +47128,7 @@ function transpose(out, a) { return out; }; -},{}],290:[function(_dereq_,module,exports){ +},{}],307:[function(_dereq_,module,exports){ 'use strict' var barycentric = _dereq_('barycentric') @@ -46829,7 +47226,7 @@ function closestPointToPickLocation(simplex, pixelCoord, model, view, projection } return [closestIndex, interpolate(simplex, weights), weights] } -},{"barycentric":78,"polytope-closest-point/lib/closest_point_2d.js":499}],291:[function(_dereq_,module,exports){ +},{"barycentric":78,"polytope-closest-point/lib/closest_point_2d.js":525}],308:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\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;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\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 f_color = color;\n f_data = position;\n f_uv = uv;\n}\n"]) @@ -46898,7 +47295,7 @@ exports.contourShader = { ] } -},{"glslify":413}],292:[function(_dereq_,module,exports){ +},{"glslify":310}],309:[function(_dereq_,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -48009,7 +48406,9 @@ function createSimplicialMesh(gl, params) { module.exports = createSimplicialMesh -},{"./lib/closest-point":290,"./lib/shaders":291,"colormap":131,"gl-buffer":258,"gl-mat4/invert":278,"gl-mat4/multiply":280,"gl-shader":312,"gl-texture2d":327,"gl-vao":332,"ndarray":469,"normals":472,"simplicial-complex-contour":528,"typedarray-pool":567}],293:[function(_dereq_,module,exports){ +},{"./lib/closest-point":307,"./lib/shaders":308,"colormap":131,"gl-buffer":259,"gl-mat4/invert":293,"gl-mat4/multiply":295,"gl-shader":335,"gl-texture2d":353,"gl-vao":358,"ndarray":495,"normals":498,"simplicial-complex-contour":556,"typedarray-pool":595}],310:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],311:[function(_dereq_,module,exports){ 'use strict' module.exports = createBoxes @@ -48072,7 +48471,7 @@ function createBoxes(plot) { return new Boxes(plot, vbo, shader) } -},{"./shaders":296,"gl-buffer":258,"gl-shader":312}],294:[function(_dereq_,module,exports){ +},{"./shaders":314,"gl-buffer":259,"gl-shader":335}],312:[function(_dereq_,module,exports){ 'use strict' module.exports = createGrid @@ -48319,7 +48718,7 @@ function createGrid(plot) { return grid } -},{"./shaders":296,"binary-search-bounds":96,"gl-buffer":258,"gl-shader":312}],295:[function(_dereq_,module,exports){ +},{"./shaders":314,"binary-search-bounds":96,"gl-buffer":259,"gl-shader":335}],313:[function(_dereq_,module,exports){ 'use strict' module.exports = createLines @@ -48384,7 +48783,7 @@ function createLines(plot) { return lines } -},{"./shaders":296,"gl-buffer":258,"gl-shader":312}],296:[function(_dereq_,module,exports){ +},{"./shaders":314,"gl-buffer":259,"gl-shader":335}],314:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -48402,7 +48801,7 @@ module.exports = { tickVert: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"]) } -},{"glslify":413}],297:[function(_dereq_,module,exports){ +},{"glslify":316}],315:[function(_dereq_,module,exports){ 'use strict' module.exports = createTextElements @@ -48680,7 +49079,9 @@ function createTextElements(plot) { return text } -},{"./shaders":296,"binary-search-bounds":96,"gl-buffer":258,"gl-shader":312,"text-cache":547}],298:[function(_dereq_,module,exports){ +},{"./shaders":314,"binary-search-bounds":96,"gl-buffer":259,"gl-shader":335,"text-cache":575}],316:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],317:[function(_dereq_,module,exports){ 'use strict' module.exports = createGLPlot2D @@ -49263,7 +49664,7 @@ function createGLPlot2D(options) { return plot } -},{"./lib/box":293,"./lib/grid":294,"./lib/line":295,"./lib/text":297,"gl-select-static":311}],299:[function(_dereq_,module,exports){ +},{"./lib/box":311,"./lib/grid":312,"./lib/line":313,"./lib/text":315,"gl-select-static":334}],318:[function(_dereq_,module,exports){ 'use strict' module.exports = createCamera @@ -49456,23 +49857,17 @@ function createCamera(element, options) { var xy = mouseOffset(ev.changedTouches[0], element) handleInteraction(0, xy[0], xy[1], camera._lastMods) handleInteraction(1, xy[0], xy[1], camera._lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) + }, hasPassive ? {passive: true} : false) element.addEventListener('touchmove', function (ev) { var xy = mouseOffset(ev.changedTouches[0], element) handleInteraction(1, xy[0], xy[1], camera._lastMods) - ev.preventDefault() }, hasPassive ? {passive: false} : false) element.addEventListener('touchend', function (ev) { - handleInteraction(0, camera._lastX, camera._lastY, camera._lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) + }, hasPassive ? {passive: true} : false) function handleInteraction (buttons, x, y, mods) { var keyBindingMode = camera.keyBindingMode @@ -49550,7 +49945,7 @@ function createCamera(element, options) { return camera } -},{"3d-view":54,"has-passive-events":415,"mouse-change":457,"mouse-event-offset":458,"mouse-wheel":460,"right-now":514}],300:[function(_dereq_,module,exports){ +},{"3d-view":54,"has-passive-events":441,"mouse-change":483,"mouse-event-offset":484,"mouse-wheel":486,"right-now":542}],319:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') @@ -49561,7 +49956,9 @@ module.exports = function(gl) { return createShader(gl, vertSrc, fragSrc, null, [ { name: 'position', type: 'vec2'}]) } -},{"gl-shader":312,"glslify":413}],301:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":320}],320:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],321:[function(_dereq_,module,exports){ 'use strict' var createCamera = _dereq_('./camera.js') @@ -50416,7 +50813,7 @@ function calcCameraParams(scene, isOrtho) { } } -},{"./camera.js":299,"./lib/shader":300,"a-big-triangle":64,"gl-axes3d":250,"gl-axes3d/properties":257,"gl-fbo":266,"gl-mat4/ortho":281,"gl-mat4/perspective":282,"gl-select-static":311,"gl-spikes3d":321,"is-mobile":441,"mouse-change":457}],302:[function(_dereq_,module,exports){ +},{"./camera.js":318,"./lib/shader":319,"a-big-triangle":64,"gl-axes3d":250,"gl-axes3d/properties":258,"gl-fbo":269,"gl-mat4/ortho":296,"gl-mat4/perspective":297,"gl-select-static":334,"gl-spikes3d":345,"is-mobile":467,"mouse-change":483}],322:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') exports.pointVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}"]) @@ -50424,7 +50821,9 @@ exports.pointFragment = glslify(["precision mediump float;\n#define GLSLIFY exports.pickVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]) exports.pickFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"]) -},{"glslify":413}],303:[function(_dereq_,module,exports){ +},{"glslify":323}],323:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],324:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -50644,7 +51043,7 @@ function createPointcloud2D(plot, options) { return result } -},{"./lib/shader":302,"gl-buffer":258,"gl-shader":312,"typedarray-pool":567}],304:[function(_dereq_,module,exports){ +},{"./lib/shader":322,"gl-buffer":259,"gl-shader":335,"typedarray-pool":595}],325:[function(_dereq_,module,exports){ module.exports = slerp /** @@ -50697,14 +51096,14 @@ function slerp (out, a, b, t) { return out } -},{}],305:[function(_dereq_,module,exports){ +},{}],326:[function(_dereq_,module,exports){ 'use strict'; module.exports = function(a){ return (!a && a !== 0) ? '' : a.toString(); } -},{}],306:[function(_dereq_,module,exports){ +},{}],327:[function(_dereq_,module,exports){ "use strict" var vectorizeText = _dereq_("vectorize-text") @@ -50773,7 +51172,7 @@ function getGlyph(symbol, font, pixelRatio) { //Save cached symbol return fontCache[symbol] = [triSymbol, lineSymbol, bounds] } -},{"vectorize-text":572}],307:[function(_dereq_,module,exports){ +},{"vectorize-text":600}],328:[function(_dereq_,module,exports){ var createShaderWrapper = _dereq_('gl-shader') var glslify = _dereq_('glslify') @@ -50850,7 +51249,9 @@ exports.createPickProject = function(gl) { return createShader(gl, pickProject) } -},{"gl-shader":312,"glslify":413}],308:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":329}],329:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],330:[function(_dereq_,module,exports){ 'use strict' var isAllBlank = _dereq_('is-string-blank') @@ -51722,7 +52123,7 @@ function createPointCloud(options) { return pointCloud } -},{"./lib/get-simple-string":305,"./lib/glyphs":306,"./lib/shaders":307,"gl-buffer":258,"gl-mat4/multiply":280,"gl-vao":332,"is-string-blank":444,"typedarray-pool":567}],309:[function(_dereq_,module,exports){ +},{"./lib/get-simple-string":326,"./lib/glyphs":327,"./lib/shaders":328,"gl-buffer":259,"gl-mat4/multiply":295,"gl-vao":358,"is-string-blank":470,"typedarray-pool":595}],331:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -51730,7 +52131,9 @@ var glslify = _dereq_('glslify') exports.boxVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n"]) exports.boxFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"]) -},{"glslify":413}],310:[function(_dereq_,module,exports){ +},{"glslify":332}],332:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],333:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -51856,7 +52259,7 @@ function createSelectBox(plot, options) { return selectBox } -},{"./lib/shaders":309,"gl-buffer":258,"gl-shader":312}],311:[function(_dereq_,module,exports){ +},{"./lib/shaders":331,"gl-buffer":259,"gl-shader":335}],334:[function(_dereq_,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -52041,7 +52444,7 @@ function createSelectBuffer(gl, shape) { return new SelectBuffer(gl, fbo, buffer) } -},{"bit-twiddle":97,"gl-fbo":266,"ndarray":469,"typedarray-pool":567}],312:[function(_dereq_,module,exports){ +},{"bit-twiddle":97,"gl-fbo":269,"ndarray":495,"typedarray-pool":595}],335:[function(_dereq_,module,exports){ 'use strict' var createUniformWrapper = _dereq_('./lib/create-uniforms') @@ -52307,7 +52710,7 @@ function createShader( module.exports = createShader -},{"./lib/GLError":313,"./lib/create-attributes":314,"./lib/create-uniforms":315,"./lib/reflect":316,"./lib/runtime-reflect":317,"./lib/shader-cache":318}],313:[function(_dereq_,module,exports){ +},{"./lib/GLError":336,"./lib/create-attributes":337,"./lib/create-uniforms":338,"./lib/reflect":339,"./lib/runtime-reflect":340,"./lib/shader-cache":341}],336:[function(_dereq_,module,exports){ function GLError (rawError, shortMessage, longMessage) { this.shortMessage = shortMessage || '' this.longMessage = longMessage || '' @@ -52322,7 +52725,7 @@ GLError.prototype.name = 'GLError' GLError.prototype.constructor = GLError module.exports = GLError -},{}],314:[function(_dereq_,module,exports){ +},{}],337:[function(_dereq_,module,exports){ 'use strict' module.exports = createAttributeWrapper @@ -52587,7 +52990,7 @@ function createAttributeWrapper( return obj } -},{"./GLError":313}],315:[function(_dereq_,module,exports){ +},{"./GLError":336}],338:[function(_dereq_,module,exports){ 'use strict' var coallesceUniforms = _dereq_('./reflect') @@ -52780,7 +53183,7 @@ function createUniformWrapper(gl, wrapper, uniforms, locations) { } } -},{"./GLError":313,"./reflect":316}],316:[function(_dereq_,module,exports){ +},{"./GLError":336,"./reflect":339}],339:[function(_dereq_,module,exports){ 'use strict' module.exports = makeReflectTypes @@ -52838,7 +53241,7 @@ function makeReflectTypes(uniforms, useIndex) { } return obj } -},{}],317:[function(_dereq_,module,exports){ +},{}],340:[function(_dereq_,module,exports){ 'use strict' exports.uniforms = runtimeUniforms @@ -52918,7 +53321,7 @@ function runtimeAttributes(gl, program) { return result } -},{}],318:[function(_dereq_,module,exports){ +},{}],341:[function(_dereq_,module,exports){ 'use strict' exports.shader = getShaderReference @@ -53056,7 +53459,7 @@ function createProgram(gl, vref, fref, attribs, locations) { return getCache(gl).getProgram(vref, fref, attribs, locations) } -},{"./GLError":313,"gl-format-compiler-error":267,"weakmap-shim":577}],319:[function(_dereq_,module,exports){ +},{"./GLError":336,"gl-format-compiler-error":270,"weakmap-shim":605}],342:[function(_dereq_,module,exports){ 'use strict' module.exports = createSpikes2D @@ -53144,7 +53547,9 @@ function createSpikes2D(plot, options) { return spikes } -},{}],320:[function(_dereq_,module,exports){ +},{}],343:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],344:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -53161,7 +53566,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":312,"glslify":413}],321:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":343}],345:[function(_dereq_,module,exports){ 'use strict' var createBuffer = _dereq_('gl-buffer') @@ -53357,7 +53762,7 @@ function createSpikes(gl, options) { return spikes } -},{"./shaders/index":320,"gl-buffer":258,"gl-vao":332}],322:[function(_dereq_,module,exports){ +},{"./shaders/index":344,"gl-buffer":259,"gl-vao":358}],346:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["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 color, position;\nattribute vec2 uv;\n\nuniform float vectorScale, tubeScale;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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"]) @@ -53385,7 +53790,9 @@ exports.pickShader = { ] } -},{"glslify":413}],323:[function(_dereq_,module,exports){ +},{"glslify":347}],347:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],348:[function(_dereq_,module,exports){ "use strict"; var vec3 = _dereq_('gl-vec3'); @@ -53945,7 +54352,7 @@ module.exports.createTubeMesh = function(gl, params) { }); } -},{"./lib/shaders":322,"gl-cone3d":259,"gl-vec3":351,"gl-vec4":387}],324:[function(_dereq_,module,exports){ +},{"./lib/shaders":346,"gl-cone3d":260,"gl-vec3":377,"gl-vec4":413}],349:[function(_dereq_,module,exports){ var createShader = _dereq_('gl-shader') var glslify = _dereq_('glslify') @@ -53995,7 +54402,9 @@ exports.createPickContourShader = function (gl) { return shader } -},{"gl-shader":312,"glslify":413}],325:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":350}],350:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],351:[function(_dereq_,module,exports){ 'use strict' module.exports = createSurfacePlot @@ -54065,19 +54474,6 @@ function SurfacePickResult (position, index, uv, level, dataCoordinate) { var N_COLORS = 256 -function genColormap (name, opacityscale) { - var x = pack([colormap({ - colormap: name, - nshades: N_COLORS, - format: 'rgba' - }).map(function (c, i) { - var a = opacityscale ? getOpacityFromScale(i / 255.0, opacityscale) : 1 - return [c[0], c[1], c[2], 255 * a] - })]) - ops.divseq(x, 255.0) - return x -} - function SurfacePlot ( gl, shape, @@ -54163,7 +54559,6 @@ function SurfacePlot ( this.pixelRatio = 1 this.opacity = 1.0 - this.opacityscale = false this.lightPosition = [10, 10000, 0] this.ambientLight = 0.8 @@ -54178,26 +54573,30 @@ function SurfacePlot ( var proto = SurfacePlot.prototype +proto.genColormap = function (name, opacityscale) { + var hasAlpha = false + + var x = pack([colormap({ + colormap: name, + nshades: N_COLORS, + format: 'rgba' + }).map(function (c, i) { + var a = opacityscale ? getOpacityFromScale(i / 255.0, opacityscale) : c[3] + if(a < 1) hasAlpha = true + return [c[0], c[1], c[2], 255 * a] + })]) + ops.divseq(x, 255.0) + + this.hasAlphaScale = hasAlpha + return x +} + proto.isTransparent = function () { - return this.opacity < 1 || this.opacityscale + return this.opacity < 1 || this.hasAlphaScale } proto.isOpaque = function () { - if (this.opacityscale) { - return false - } - if (this.opacity < 1) { - return false - } - if (this.opacity >= 1) { - return true - } - for (var i = 0; i < 3; ++i) { - if (this._contourCounts[i].length > 0) { - return true - } - } - return false + return !this.isTransparent() } proto.pickSlots = 1 @@ -54798,6 +55197,9 @@ proto.update = function (params) { if ('vertexColor' in params) { this.vertexColor = params.vertexColor ? 1 : 0; } + if ('colormap' in params) { + this._colorMap.setPixels(this.genColormap(params.colormap, this.opacityscale)) + } var field = params.field || (params.coords && params.coords[2]) || null var levelsChanged = false @@ -55167,10 +55569,6 @@ proto.update = function (params) { this._contourBuffer.update(floatBuffer) pool.freeFloat(floatBuffer) } - - if (params.colormap) { - this._colorMap.setPixels(genColormap(params.colormap, this.opacityscale)) - } } proto.dispose = function () { @@ -55388,7 +55786,7 @@ function createSurfacePlot (params) { return surface } -},{"./lib/shaders":324,"binary-search-bounds":96,"bit-twiddle":97,"colormap":131,"gl-buffer":258,"gl-mat4/invert":278,"gl-mat4/multiply":280,"gl-texture2d":327,"gl-vao":332,"ndarray":469,"ndarray-gradient":462,"ndarray-ops":464,"ndarray-pack":465,"surface-nets":542,"typedarray-pool":567}],326:[function(_dereq_,module,exports){ +},{"./lib/shaders":349,"binary-search-bounds":96,"bit-twiddle":97,"colormap":131,"gl-buffer":259,"gl-mat4/invert":293,"gl-mat4/multiply":295,"gl-texture2d":353,"gl-vao":358,"ndarray":495,"ndarray-gradient":488,"ndarray-ops":490,"ndarray-pack":491,"surface-nets":570,"typedarray-pool":595}],352:[function(_dereq_,module,exports){ 'use strict' var Font = _dereq_('css-font') @@ -56116,7 +56514,7 @@ function isRegl (o) { module.exports = GlText -},{"bit-twiddle":97,"color-normalize":125,"css-font":144,"detect-kerning":172,"es6-weak-map":233,"flatten-vertex-data":244,"font-atlas":245,"font-measure":246,"gl-util/context":328,"is-plain-obj":443,"object-assign":473,"parse-rect":478,"parse-unit":480,"pick-by-alias":485,"regl":512,"to-px":550,"typedarray-pool":567}],327:[function(_dereq_,module,exports){ +},{"bit-twiddle":97,"color-normalize":125,"css-font":144,"detect-kerning":172,"es6-weak-map":233,"flatten-vertex-data":244,"font-atlas":245,"font-measure":246,"gl-util/context":354,"is-plain-obj":469,"object-assign":499,"parse-rect":504,"parse-unit":506,"pick-by-alias":511,"regl":540,"to-px":578,"typedarray-pool":595}],353:[function(_dereq_,module,exports){ 'use strict' var ndarray = _dereq_('ndarray') @@ -56679,8 +57077,8 @@ function createTexture2D(gl) { throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":469,"ndarray-ops":464,"typedarray-pool":567}],328:[function(_dereq_,module,exports){ -(function (global){ +},{"ndarray":495,"ndarray-ops":490,"typedarray-pool":595}],354:[function(_dereq_,module,exports){ +(function (global){(function (){ /** @module gl-util/context */ 'use strict' @@ -56810,8 +57208,8 @@ function createCanvas () { return canvas } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"pick-by-alias":485}],329:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"pick-by-alias":511}],355:[function(_dereq_,module,exports){ "use strict" function doBind(gl, elements, attributes) { @@ -56866,7 +57264,7 @@ function doBind(gl, elements, attributes) { } module.exports = doBind -},{}],330:[function(_dereq_,module,exports){ +},{}],356:[function(_dereq_,module,exports){ "use strict" var bindAttribs = _dereq_("./do-bind.js") @@ -56906,7 +57304,7 @@ function createVAOEmulated(gl) { } module.exports = createVAOEmulated -},{"./do-bind.js":329}],331:[function(_dereq_,module,exports){ +},{"./do-bind.js":355}],357:[function(_dereq_,module,exports){ "use strict" var bindAttribs = _dereq_("./do-bind.js") @@ -56994,7 +57392,7 @@ function createVAONative(gl, ext) { } module.exports = createVAONative -},{"./do-bind.js":329}],332:[function(_dereq_,module,exports){ +},{"./do-bind.js":355}],358:[function(_dereq_,module,exports){ "use strict" var createVAONative = _dereq_("./lib/vao-native.js") @@ -57023,7 +57421,7 @@ function createVAO(gl, attributes, elements, elementsType) { module.exports = createVAO -},{"./lib/vao-emulated.js":330,"./lib/vao-native.js":331}],333:[function(_dereq_,module,exports){ +},{"./lib/vao-emulated.js":356,"./lib/vao-native.js":357}],359:[function(_dereq_,module,exports){ module.exports = add; /** @@ -57040,7 +57438,7 @@ function add(out, a, b) { out[2] = a[2] + b[2] return out } -},{}],334:[function(_dereq_,module,exports){ +},{}],360:[function(_dereq_,module,exports){ module.exports = angle var fromValues = _dereq_('./fromValues') @@ -57069,7 +57467,7 @@ function angle(a, b) { } } -},{"./dot":344,"./fromValues":350,"./normalize":361}],335:[function(_dereq_,module,exports){ +},{"./dot":370,"./fromValues":376,"./normalize":387}],361:[function(_dereq_,module,exports){ module.exports = ceil /** @@ -57086,7 +57484,7 @@ function ceil(out, a) { return out } -},{}],336:[function(_dereq_,module,exports){ +},{}],362:[function(_dereq_,module,exports){ module.exports = clone; /** @@ -57102,7 +57500,7 @@ function clone(a) { out[2] = a[2] return out } -},{}],337:[function(_dereq_,module,exports){ +},{}],363:[function(_dereq_,module,exports){ module.exports = copy; /** @@ -57118,7 +57516,7 @@ function copy(out, a) { out[2] = a[2] return out } -},{}],338:[function(_dereq_,module,exports){ +},{}],364:[function(_dereq_,module,exports){ module.exports = create; /** @@ -57133,7 +57531,7 @@ function create() { out[2] = 0 return out } -},{}],339:[function(_dereq_,module,exports){ +},{}],365:[function(_dereq_,module,exports){ module.exports = cross; /** @@ -57153,10 +57551,10 @@ function cross(out, a, b) { out[2] = ax * by - ay * bx return out } -},{}],340:[function(_dereq_,module,exports){ +},{}],366:[function(_dereq_,module,exports){ module.exports = _dereq_('./distance') -},{"./distance":341}],341:[function(_dereq_,module,exports){ +},{"./distance":367}],367:[function(_dereq_,module,exports){ module.exports = distance; /** @@ -57172,10 +57570,10 @@ function distance(a, b) { z = b[2] - a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],342:[function(_dereq_,module,exports){ +},{}],368:[function(_dereq_,module,exports){ module.exports = _dereq_('./divide') -},{"./divide":343}],343:[function(_dereq_,module,exports){ +},{"./divide":369}],369:[function(_dereq_,module,exports){ module.exports = divide; /** @@ -57192,7 +57590,7 @@ function divide(out, a, b) { out[2] = a[2] / b[2] return out } -},{}],344:[function(_dereq_,module,exports){ +},{}],370:[function(_dereq_,module,exports){ module.exports = dot; /** @@ -57205,10 +57603,10 @@ module.exports = dot; function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] } -},{}],345:[function(_dereq_,module,exports){ +},{}],371:[function(_dereq_,module,exports){ module.exports = 0.000001 -},{}],346:[function(_dereq_,module,exports){ +},{}],372:[function(_dereq_,module,exports){ module.exports = equals var EPSILON = _dereq_('./epsilon') @@ -57232,7 +57630,7 @@ function equals(a, b) { Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))) } -},{"./epsilon":345}],347:[function(_dereq_,module,exports){ +},{"./epsilon":371}],373:[function(_dereq_,module,exports){ module.exports = exactEquals /** @@ -57246,7 +57644,7 @@ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] } -},{}],348:[function(_dereq_,module,exports){ +},{}],374:[function(_dereq_,module,exports){ module.exports = floor /** @@ -57263,7 +57661,7 @@ function floor(out, a) { return out } -},{}],349:[function(_dereq_,module,exports){ +},{}],375:[function(_dereq_,module,exports){ module.exports = forEach; var vec = _dereq_('./create')() @@ -57308,7 +57706,7 @@ function forEach(a, stride, offset, count, fn, arg) { return a } -},{"./create":338}],350:[function(_dereq_,module,exports){ +},{"./create":364}],376:[function(_dereq_,module,exports){ module.exports = fromValues; /** @@ -57326,7 +57724,7 @@ function fromValues(x, y, z) { out[2] = z return out } -},{}],351:[function(_dereq_,module,exports){ +},{}],377:[function(_dereq_,module,exports){ module.exports = { EPSILON: _dereq_('./epsilon') , create: _dereq_('./create') @@ -57375,7 +57773,7 @@ module.exports = { , forEach: _dereq_('./forEach') } -},{"./add":333,"./angle":334,"./ceil":335,"./clone":336,"./copy":337,"./create":338,"./cross":339,"./dist":340,"./distance":341,"./div":342,"./divide":343,"./dot":344,"./epsilon":345,"./equals":346,"./exactEquals":347,"./floor":348,"./forEach":349,"./fromValues":350,"./inverse":352,"./len":353,"./length":354,"./lerp":355,"./max":356,"./min":357,"./mul":358,"./multiply":359,"./negate":360,"./normalize":361,"./random":362,"./rotateX":363,"./rotateY":364,"./rotateZ":365,"./round":366,"./scale":367,"./scaleAndAdd":368,"./set":369,"./sqrDist":370,"./sqrLen":371,"./squaredDistance":372,"./squaredLength":373,"./sub":374,"./subtract":375,"./transformMat3":376,"./transformMat4":377,"./transformQuat":378}],352:[function(_dereq_,module,exports){ +},{"./add":359,"./angle":360,"./ceil":361,"./clone":362,"./copy":363,"./create":364,"./cross":365,"./dist":366,"./distance":367,"./div":368,"./divide":369,"./dot":370,"./epsilon":371,"./equals":372,"./exactEquals":373,"./floor":374,"./forEach":375,"./fromValues":376,"./inverse":378,"./len":379,"./length":380,"./lerp":381,"./max":382,"./min":383,"./mul":384,"./multiply":385,"./negate":386,"./normalize":387,"./random":388,"./rotateX":389,"./rotateY":390,"./rotateZ":391,"./round":392,"./scale":393,"./scaleAndAdd":394,"./set":395,"./sqrDist":396,"./sqrLen":397,"./squaredDistance":398,"./squaredLength":399,"./sub":400,"./subtract":401,"./transformMat3":402,"./transformMat4":403,"./transformQuat":404}],378:[function(_dereq_,module,exports){ module.exports = inverse; /** @@ -57391,10 +57789,10 @@ function inverse(out, a) { out[2] = 1.0 / a[2] return out } -},{}],353:[function(_dereq_,module,exports){ +},{}],379:[function(_dereq_,module,exports){ module.exports = _dereq_('./length') -},{"./length":354}],354:[function(_dereq_,module,exports){ +},{"./length":380}],380:[function(_dereq_,module,exports){ module.exports = length; /** @@ -57409,7 +57807,7 @@ function length(a) { z = a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],355:[function(_dereq_,module,exports){ +},{}],381:[function(_dereq_,module,exports){ module.exports = lerp; /** @@ -57430,7 +57828,7 @@ function lerp(out, a, b, t) { out[2] = az + t * (b[2] - az) return out } -},{}],356:[function(_dereq_,module,exports){ +},{}],382:[function(_dereq_,module,exports){ module.exports = max; /** @@ -57447,7 +57845,7 @@ function max(out, a, b) { out[2] = Math.max(a[2], b[2]) return out } -},{}],357:[function(_dereq_,module,exports){ +},{}],383:[function(_dereq_,module,exports){ module.exports = min; /** @@ -57464,10 +57862,10 @@ function min(out, a, b) { out[2] = Math.min(a[2], b[2]) return out } -},{}],358:[function(_dereq_,module,exports){ +},{}],384:[function(_dereq_,module,exports){ module.exports = _dereq_('./multiply') -},{"./multiply":359}],359:[function(_dereq_,module,exports){ +},{"./multiply":385}],385:[function(_dereq_,module,exports){ module.exports = multiply; /** @@ -57484,7 +57882,7 @@ function multiply(out, a, b) { out[2] = a[2] * b[2] return out } -},{}],360:[function(_dereq_,module,exports){ +},{}],386:[function(_dereq_,module,exports){ module.exports = negate; /** @@ -57500,7 +57898,7 @@ function negate(out, a) { out[2] = -a[2] return out } -},{}],361:[function(_dereq_,module,exports){ +},{}],387:[function(_dereq_,module,exports){ module.exports = normalize; /** @@ -57524,7 +57922,7 @@ function normalize(out, a) { } return out } -},{}],362:[function(_dereq_,module,exports){ +},{}],388:[function(_dereq_,module,exports){ module.exports = random; /** @@ -57546,7 +57944,7 @@ function random(out, scale) { out[2] = z * scale return out } -},{}],363:[function(_dereq_,module,exports){ +},{}],389:[function(_dereq_,module,exports){ module.exports = rotateX; /** @@ -57576,7 +57974,7 @@ function rotateX(out, a, b, c){ return out } -},{}],364:[function(_dereq_,module,exports){ +},{}],390:[function(_dereq_,module,exports){ module.exports = rotateY; /** @@ -57606,7 +58004,7 @@ function rotateY(out, a, b, c){ return out } -},{}],365:[function(_dereq_,module,exports){ +},{}],391:[function(_dereq_,module,exports){ module.exports = rotateZ; /** @@ -57636,7 +58034,7 @@ function rotateZ(out, a, b, c){ return out } -},{}],366:[function(_dereq_,module,exports){ +},{}],392:[function(_dereq_,module,exports){ module.exports = round /** @@ -57653,7 +58051,7 @@ function round(out, a) { return out } -},{}],367:[function(_dereq_,module,exports){ +},{}],393:[function(_dereq_,module,exports){ module.exports = scale; /** @@ -57670,7 +58068,7 @@ function scale(out, a, b) { out[2] = a[2] * b return out } -},{}],368:[function(_dereq_,module,exports){ +},{}],394:[function(_dereq_,module,exports){ module.exports = scaleAndAdd; /** @@ -57688,7 +58086,7 @@ function scaleAndAdd(out, a, b, scale) { out[2] = a[2] + (b[2] * scale) return out } -},{}],369:[function(_dereq_,module,exports){ +},{}],395:[function(_dereq_,module,exports){ module.exports = set; /** @@ -57706,13 +58104,13 @@ function set(out, x, y, z) { out[2] = z return out } -},{}],370:[function(_dereq_,module,exports){ +},{}],396:[function(_dereq_,module,exports){ module.exports = _dereq_('./squaredDistance') -},{"./squaredDistance":372}],371:[function(_dereq_,module,exports){ +},{"./squaredDistance":398}],397:[function(_dereq_,module,exports){ module.exports = _dereq_('./squaredLength') -},{"./squaredLength":373}],372:[function(_dereq_,module,exports){ +},{"./squaredLength":399}],398:[function(_dereq_,module,exports){ module.exports = squaredDistance; /** @@ -57728,7 +58126,7 @@ function squaredDistance(a, b) { z = b[2] - a[2] return x*x + y*y + z*z } -},{}],373:[function(_dereq_,module,exports){ +},{}],399:[function(_dereq_,module,exports){ module.exports = squaredLength; /** @@ -57743,10 +58141,10 @@ function squaredLength(a) { z = a[2] return x*x + y*y + z*z } -},{}],374:[function(_dereq_,module,exports){ +},{}],400:[function(_dereq_,module,exports){ module.exports = _dereq_('./subtract') -},{"./subtract":375}],375:[function(_dereq_,module,exports){ +},{"./subtract":401}],401:[function(_dereq_,module,exports){ module.exports = subtract; /** @@ -57763,7 +58161,7 @@ function subtract(out, a, b) { out[2] = a[2] - b[2] return out } -},{}],376:[function(_dereq_,module,exports){ +},{}],402:[function(_dereq_,module,exports){ module.exports = transformMat3; /** @@ -57781,7 +58179,7 @@ function transformMat3(out, a, m) { out[2] = x * m[2] + y * m[5] + z * m[8] return out } -},{}],377:[function(_dereq_,module,exports){ +},{}],403:[function(_dereq_,module,exports){ module.exports = transformMat4; /** @@ -57802,7 +58200,7 @@ function transformMat4(out, a, m) { out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w return out } -},{}],378:[function(_dereq_,module,exports){ +},{}],404:[function(_dereq_,module,exports){ module.exports = transformQuat; /** @@ -57831,7 +58229,7 @@ function transformQuat(out, a, q) { out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx return out } -},{}],379:[function(_dereq_,module,exports){ +},{}],405:[function(_dereq_,module,exports){ module.exports = add /** @@ -57850,7 +58248,7 @@ function add (out, a, b) { return out } -},{}],380:[function(_dereq_,module,exports){ +},{}],406:[function(_dereq_,module,exports){ module.exports = clone /** @@ -57868,7 +58266,7 @@ function clone (a) { return out } -},{}],381:[function(_dereq_,module,exports){ +},{}],407:[function(_dereq_,module,exports){ module.exports = copy /** @@ -57886,7 +58284,7 @@ function copy (out, a) { return out } -},{}],382:[function(_dereq_,module,exports){ +},{}],408:[function(_dereq_,module,exports){ module.exports = create /** @@ -57903,7 +58301,7 @@ function create () { return out } -},{}],383:[function(_dereq_,module,exports){ +},{}],409:[function(_dereq_,module,exports){ module.exports = distance /** @@ -57921,7 +58319,7 @@ function distance (a, b) { return Math.sqrt(x * x + y * y + z * z + w * w) } -},{}],384:[function(_dereq_,module,exports){ +},{}],410:[function(_dereq_,module,exports){ module.exports = divide /** @@ -57940,7 +58338,7 @@ function divide (out, a, b) { return out } -},{}],385:[function(_dereq_,module,exports){ +},{}],411:[function(_dereq_,module,exports){ module.exports = dot /** @@ -57954,7 +58352,7 @@ function dot (a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3] } -},{}],386:[function(_dereq_,module,exports){ +},{}],412:[function(_dereq_,module,exports){ module.exports = fromValues /** @@ -57975,7 +58373,7 @@ function fromValues (x, y, z, w) { return out } -},{}],387:[function(_dereq_,module,exports){ +},{}],413:[function(_dereq_,module,exports){ module.exports = { create: _dereq_('./create'), clone: _dereq_('./clone'), @@ -58004,7 +58402,7 @@ module.exports = { transformQuat: _dereq_('./transformQuat') } -},{"./add":379,"./clone":380,"./copy":381,"./create":382,"./distance":383,"./divide":384,"./dot":385,"./fromValues":386,"./inverse":388,"./length":389,"./lerp":390,"./max":391,"./min":392,"./multiply":393,"./negate":394,"./normalize":395,"./random":396,"./scale":397,"./scaleAndAdd":398,"./set":399,"./squaredDistance":400,"./squaredLength":401,"./subtract":402,"./transformMat4":403,"./transformQuat":404}],388:[function(_dereq_,module,exports){ +},{"./add":405,"./clone":406,"./copy":407,"./create":408,"./distance":409,"./divide":410,"./dot":411,"./fromValues":412,"./inverse":414,"./length":415,"./lerp":416,"./max":417,"./min":418,"./multiply":419,"./negate":420,"./normalize":421,"./random":422,"./scale":423,"./scaleAndAdd":424,"./set":425,"./squaredDistance":426,"./squaredLength":427,"./subtract":428,"./transformMat4":429,"./transformQuat":430}],414:[function(_dereq_,module,exports){ module.exports = inverse /** @@ -58022,7 +58420,7 @@ function inverse (out, a) { return out } -},{}],389:[function(_dereq_,module,exports){ +},{}],415:[function(_dereq_,module,exports){ module.exports = length /** @@ -58039,7 +58437,7 @@ function length (a) { return Math.sqrt(x * x + y * y + z * z + w * w) } -},{}],390:[function(_dereq_,module,exports){ +},{}],416:[function(_dereq_,module,exports){ module.exports = lerp /** @@ -58063,7 +58461,7 @@ function lerp (out, a, b, t) { return out } -},{}],391:[function(_dereq_,module,exports){ +},{}],417:[function(_dereq_,module,exports){ module.exports = max /** @@ -58082,7 +58480,7 @@ function max (out, a, b) { return out } -},{}],392:[function(_dereq_,module,exports){ +},{}],418:[function(_dereq_,module,exports){ module.exports = min /** @@ -58101,7 +58499,7 @@ function min (out, a, b) { return out } -},{}],393:[function(_dereq_,module,exports){ +},{}],419:[function(_dereq_,module,exports){ module.exports = multiply /** @@ -58120,7 +58518,7 @@ function multiply (out, a, b) { return out } -},{}],394:[function(_dereq_,module,exports){ +},{}],420:[function(_dereq_,module,exports){ module.exports = negate /** @@ -58138,7 +58536,7 @@ function negate (out, a) { return out } -},{}],395:[function(_dereq_,module,exports){ +},{}],421:[function(_dereq_,module,exports){ module.exports = normalize /** @@ -58164,7 +58562,7 @@ function normalize (out, a) { return out } -},{}],396:[function(_dereq_,module,exports){ +},{}],422:[function(_dereq_,module,exports){ var vecNormalize = _dereq_('./normalize') var vecScale = _dereq_('./scale') @@ -58190,7 +58588,7 @@ function random (out, scale) { return out } -},{"./normalize":395,"./scale":397}],397:[function(_dereq_,module,exports){ +},{"./normalize":421,"./scale":423}],423:[function(_dereq_,module,exports){ module.exports = scale /** @@ -58209,7 +58607,7 @@ function scale (out, a, b) { return out } -},{}],398:[function(_dereq_,module,exports){ +},{}],424:[function(_dereq_,module,exports){ module.exports = scaleAndAdd /** @@ -58229,7 +58627,7 @@ function scaleAndAdd (out, a, b, scale) { return out } -},{}],399:[function(_dereq_,module,exports){ +},{}],425:[function(_dereq_,module,exports){ module.exports = set /** @@ -58250,7 +58648,7 @@ function set (out, x, y, z, w) { return out } -},{}],400:[function(_dereq_,module,exports){ +},{}],426:[function(_dereq_,module,exports){ module.exports = squaredDistance /** @@ -58268,7 +58666,7 @@ function squaredDistance (a, b) { return x * x + y * y + z * z + w * w } -},{}],401:[function(_dereq_,module,exports){ +},{}],427:[function(_dereq_,module,exports){ module.exports = squaredLength /** @@ -58285,7 +58683,7 @@ function squaredLength (a) { return x * x + y * y + z * z + w * w } -},{}],402:[function(_dereq_,module,exports){ +},{}],428:[function(_dereq_,module,exports){ module.exports = subtract /** @@ -58304,7 +58702,7 @@ function subtract (out, a, b) { return out } -},{}],403:[function(_dereq_,module,exports){ +},{}],429:[function(_dereq_,module,exports){ module.exports = transformMat4 /** @@ -58324,7 +58722,7 @@ function transformMat4 (out, a, m) { return out } -},{}],404:[function(_dereq_,module,exports){ +},{}],430:[function(_dereq_,module,exports){ module.exports = transformQuat /** @@ -58353,7 +58751,7 @@ function transformQuat (out, a, q) { return out } -},{}],405:[function(_dereq_,module,exports){ +},{}],431:[function(_dereq_,module,exports){ var tokenize = _dereq_('glsl-tokenizer') var atob = _dereq_('atob-lite') @@ -58378,7 +58776,7 @@ function getName(src) { } } -},{"atob-lite":77,"glsl-tokenizer":412}],406:[function(_dereq_,module,exports){ +},{"atob-lite":77,"glsl-tokenizer":438}],432:[function(_dereq_,module,exports){ module.exports = tokenize var literals100 = _dereq_('./lib/literals') @@ -58755,7 +59153,7 @@ function tokenize(opt) { } } -},{"./lib/builtins":408,"./lib/builtins-300es":407,"./lib/literals":410,"./lib/literals-300es":409,"./lib/operators":411}],407:[function(_dereq_,module,exports){ +},{"./lib/builtins":434,"./lib/builtins-300es":433,"./lib/literals":436,"./lib/literals-300es":435,"./lib/operators":437}],433:[function(_dereq_,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = _dereq_('./builtins') @@ -58826,7 +59224,7 @@ module.exports = v100.concat([ , 'textureProjGradOffset' ]) -},{"./builtins":408}],408:[function(_dereq_,module,exports){ +},{"./builtins":434}],434:[function(_dereq_,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -58978,7 +59376,7 @@ module.exports = [ , 'textureCubeGradEXT' ] -},{}],409:[function(_dereq_,module,exports){ +},{}],435:[function(_dereq_,module,exports){ var v100 = _dereq_('./literals') module.exports = v100.slice().concat([ @@ -59067,7 +59465,7 @@ module.exports = v100.slice().concat([ , 'usampler2DMSArray' ]) -},{"./literals":410}],410:[function(_dereq_,module,exports){ +},{"./literals":436}],436:[function(_dereq_,module,exports){ module.exports = [ // current 'precision' @@ -59163,7 +59561,7 @@ module.exports = [ , 'using' ] -},{}],411:[function(_dereq_,module,exports){ +},{}],437:[function(_dereq_,module,exports){ module.exports = [ '<<=' , '>>=' @@ -59212,7 +59610,7 @@ module.exports = [ , '}' ] -},{}],412:[function(_dereq_,module,exports){ +},{}],438:[function(_dereq_,module,exports){ var tokenize = _dereq_('./index') module.exports = tokenizeString @@ -59227,20 +59625,10 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":406}],413:[function(_dereq_,module,exports){ -module.exports = function(strings) { - if (typeof strings === 'string') strings = [strings] - var exprs = [].slice.call(arguments,1) - var parts = [] - for (var i = 0; i < strings.length-1; i++) { - parts.push(strings[i], exprs[i] || '') - } - parts.push(strings[i]) - return parts.join('') -} - -},{}],414:[function(_dereq_,module,exports){ -(function (global){ +},{"./index":432}],439:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],440:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -59255,8 +59643,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":438}],415:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":464}],441:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -59282,7 +59670,7 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":438}],416:[function(_dereq_,module,exports){ +},{"is-browser":464}],442:[function(_dereq_,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -59368,7 +59756,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],417:[function(_dereq_,module,exports){ +},{}],443:[function(_dereq_,module,exports){ 'use strict'; var typeHandlers = _dereq_('./types'); @@ -59383,8 +59771,8 @@ module.exports = function (buffer, filepath) { } }; -},{"./types":420}],418:[function(_dereq_,module,exports){ -(function (Buffer){ +},{"./types":446}],444:[function(_dereq_,module,exports){ +(function (Buffer){(function (){ 'use strict'; var fs = _dereq_('fs'); @@ -59512,8 +59900,8 @@ module.exports = function (input, callback) { module.exports.types = Object.keys(typeHandlers); -}).call(this,_dereq_("buffer").Buffer) -},{"./detector":417,"./types":420,"buffer":111,"fs":109,"path":481}],419:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"./detector":443,"./types":446,"buffer":111,"fs":109,"path":507}],445:[function(_dereq_,module,exports){ 'use strict'; // Abstract reading multi-byte unsigned integers @@ -59526,7 +59914,7 @@ function readUInt (buffer, bits, offset, isBigEndian) { module.exports = readUInt; -},{}],420:[function(_dereq_,module,exports){ +},{}],446:[function(_dereq_,module,exports){ 'use strict'; // load all available handlers for browserify support @@ -59547,7 +59935,7 @@ var typeHandlers = { module.exports = typeHandlers; -},{"./types/bmp":421,"./types/cur":422,"./types/dds":423,"./types/gif":424,"./types/icns":425,"./types/ico":426,"./types/jpg":427,"./types/png":428,"./types/psd":429,"./types/svg":430,"./types/tiff":431,"./types/webp":432}],421:[function(_dereq_,module,exports){ +},{"./types/bmp":447,"./types/cur":448,"./types/dds":449,"./types/gif":450,"./types/icns":451,"./types/ico":452,"./types/jpg":453,"./types/png":454,"./types/psd":455,"./types/svg":456,"./types/tiff":457,"./types/webp":458}],447:[function(_dereq_,module,exports){ 'use strict'; function isBMP (buffer) { @@ -59566,7 +59954,7 @@ module.exports = { 'calculate': calculate }; -},{}],422:[function(_dereq_,module,exports){ +},{}],448:[function(_dereq_,module,exports){ 'use strict'; var TYPE_CURSOR = 2; @@ -59585,7 +59973,7 @@ module.exports = { 'calculate': _dereq_('./ico').calculate }; -},{"./ico":426}],423:[function(_dereq_,module,exports){ +},{"./ico":452}],449:[function(_dereq_,module,exports){ 'use strict'; function isDDS(buffer){ @@ -59605,7 +59993,7 @@ module.exports = { 'calculate': calculate }; -},{}],424:[function(_dereq_,module,exports){ +},{}],450:[function(_dereq_,module,exports){ 'use strict'; var gifRegexp = /^GIF8[79]a/; @@ -59626,7 +60014,7 @@ module.exports = { 'calculate': calculate }; -},{}],425:[function(_dereq_,module,exports){ +},{}],451:[function(_dereq_,module,exports){ 'use strict'; /** @@ -59750,7 +60138,7 @@ module.exports = { 'calculate': calculate }; -},{}],426:[function(_dereq_,module,exports){ +},{}],452:[function(_dereq_,module,exports){ 'use strict'; var TYPE_ICON = 1; @@ -59833,7 +60221,7 @@ module.exports = { 'calculate': calculate }; -},{}],427:[function(_dereq_,module,exports){ +},{}],453:[function(_dereq_,module,exports){ 'use strict'; var readUInt = _dereq_('../readUInt'); @@ -59992,7 +60380,7 @@ module.exports = { 'calculate': calculate }; -},{"../readUInt":419}],428:[function(_dereq_,module,exports){ +},{"../readUInt":445}],454:[function(_dereq_,module,exports){ 'use strict'; var pngSignature = 'PNG\r\n\x1a\n'; @@ -60032,7 +60420,7 @@ module.exports = { 'calculate': calculate }; -},{}],429:[function(_dereq_,module,exports){ +},{}],455:[function(_dereq_,module,exports){ 'use strict'; function isPSD (buffer) { @@ -60051,7 +60439,7 @@ module.exports = { 'calculate': calculate }; -},{}],430:[function(_dereq_,module,exports){ +},{}],456:[function(_dereq_,module,exports){ 'use strict'; var svgReg = /"']|"[^"]*"|'[^']*')*>/; @@ -60149,8 +60537,8 @@ module.exports = { 'calculate': calculate }; -},{}],431:[function(_dereq_,module,exports){ -(function (Buffer){ +},{}],457:[function(_dereq_,module,exports){ +(function (Buffer){(function (){ 'use strict'; // based on http://www.compix.com/fileformattif.htm @@ -60272,8 +60660,8 @@ module.exports = { 'calculate': calculate }; -}).call(this,_dereq_("buffer").Buffer) -},{"../readUInt":419,"buffer":111,"fs":109}],432:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"../readUInt":445,"buffer":111,"fs":109}],458:[function(_dereq_,module,exports){ 'use strict'; // based on https://developers.google.com/speed/webp/docs/riff_container @@ -60346,7 +60734,7 @@ module.exports = { 'calculate': calculate }; -},{}],433:[function(_dereq_,module,exports){ +},{}],459:[function(_dereq_,module,exports){ "use strict" //High level idea: @@ -60793,7 +61181,7 @@ function incrementalConvexHull(points, randomSearch) { //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":520,"simplicial-complex":530}],434:[function(_dereq_,module,exports){ +},{"robust-orientation":548,"simplicial-complex":558}],460:[function(_dereq_,module,exports){ "use strict" var bounds = _dereq_("binary-search-bounds") @@ -61160,9 +61548,9 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":435}],435:[function(_dereq_,module,exports){ +},{"binary-search-bounds":461}],461:[function(_dereq_,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],436:[function(_dereq_,module,exports){ +},{"dup":243}],462:[function(_dereq_,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -61174,7 +61562,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],437:[function(_dereq_,module,exports){ +},{}],463:[function(_dereq_,module,exports){ "use strict" function iota(n) { @@ -61186,9 +61574,9 @@ function iota(n) { } module.exports = iota -},{}],438:[function(_dereq_,module,exports){ +},{}],464:[function(_dereq_,module,exports){ module.exports = true; -},{}],439:[function(_dereq_,module,exports){ +},{}],465:[function(_dereq_,module,exports){ /*! * Determine if an object is a Buffer * @@ -61211,12 +61599,12 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],440:[function(_dereq_,module,exports){ +},{}],466:[function(_dereq_,module,exports){ 'use strict'; module.exports = typeof navigator !== 'undefined' && (/MSIE/.test(navigator.userAgent) || /Trident\//.test(navigator.appVersion)); -},{}],441:[function(_dereq_,module,exports){ +},{}],467:[function(_dereq_,module,exports){ 'use strict' module.exports = isMobile @@ -61253,14 +61641,14 @@ function isMobile (opts) { return result } -},{}],442:[function(_dereq_,module,exports){ +},{}],468:[function(_dereq_,module,exports){ 'use strict'; module.exports = function (x) { var type = typeof x; return x !== null && (type === 'object' || type === 'function'); }; -},{}],443:[function(_dereq_,module,exports){ +},{}],469:[function(_dereq_,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -61269,7 +61657,7 @@ module.exports = function (x) { return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],444:[function(_dereq_,module,exports){ +},{}],470:[function(_dereq_,module,exports){ 'use strict'; /** @@ -61306,7 +61694,7 @@ module.exports = function(str){ return true; } -},{}],445:[function(_dereq_,module,exports){ +},{}],471:[function(_dereq_,module,exports){ 'use strict' module.exports = function isPath(str) { @@ -61320,12 +61708,12 @@ module.exports = function isPath(str) { return false } -},{}],446:[function(_dereq_,module,exports){ +},{}],472:[function(_dereq_,module,exports){ function lerp(v0, v1, t) { return v0*(1-t)+v1*t } module.exports = lerp -},{}],447:[function(_dereq_,module,exports){ +},{}],473:[function(_dereq_,module,exports){ /* Mapbox GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/mapbox/mapbox-gl-js/blob/v1.10.1/LICENSE.txt */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : @@ -61367,7 +61755,7 @@ return mapboxgl; }))); -},{}],448:[function(_dereq_,module,exports){ +},{}],474:[function(_dereq_,module,exports){ 'use strict' module.exports = createTable @@ -61433,7 +61821,7 @@ function createTable(dimension) { } return result } -},{"convex-hull":135}],449:[function(_dereq_,module,exports){ +},{"convex-hull":135}],475:[function(_dereq_,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -61613,7 +62001,7 @@ function combine(out, a, b, scale1, scale2) { out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":450,"gl-mat4/clone":272,"gl-mat4/create":273,"gl-mat4/determinant":274,"gl-mat4/invert":278,"gl-mat4/transpose":289,"gl-vec3/cross":339,"gl-vec3/dot":344,"gl-vec3/length":354,"gl-vec3/normalize":361}],450:[function(_dereq_,module,exports){ +},{"./normalize":476,"gl-mat4/clone":278,"gl-mat4/create":280,"gl-mat4/determinant":281,"gl-mat4/invert":293,"gl-mat4/transpose":306,"gl-vec3/cross":365,"gl-vec3/dot":370,"gl-vec3/length":380,"gl-vec3/normalize":387}],476:[function(_dereq_,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -61624,7 +62012,7 @@ module.exports = function normalize(out, mat) { out[i] = mat[i] * scale return true } -},{}],451:[function(_dereq_,module,exports){ +},{}],477:[function(_dereq_,module,exports){ var lerp = _dereq_('gl-vec3/lerp') var recompose = _dereq_('mat4-recompose') @@ -61677,7 +62065,7 @@ function vec3(n) { function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":274,"gl-vec3/lerp":355,"mat4-decompose":449,"mat4-recompose":452,"quat-slerp":501}],452:[function(_dereq_,module,exports){ +},{"gl-mat4/determinant":281,"gl-vec3/lerp":381,"mat4-decompose":475,"mat4-recompose":478,"quat-slerp":527}],478:[function(_dereq_,module,exports){ /* Input: translation ; a 3 component vector scale ; a 3 component vector @@ -61738,13 +62126,13 @@ module.exports = function recomposeMat4(matrix, translation, scale, skew, perspe mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":273,"gl-mat4/fromRotationTranslation":276,"gl-mat4/identity":277,"gl-mat4/multiply":280,"gl-mat4/scale":287,"gl-mat4/translate":288}],453:[function(_dereq_,module,exports){ +},{"gl-mat4/create":280,"gl-mat4/fromRotationTranslation":284,"gl-mat4/identity":291,"gl-mat4/multiply":295,"gl-mat4/scale":303,"gl-mat4/translate":305}],479:[function(_dereq_,module,exports){ 'use strict'; module.exports = Math.log2 || function (x) { return Math.log(x) * Math.LOG2E; }; -},{}],454:[function(_dereq_,module,exports){ +},{}],480:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -61944,9 +62332,9 @@ function createMatrixCameraController(options) { return new MatrixCameraController(matrix) } -},{"binary-search-bounds":455,"gl-mat4/invert":278,"gl-mat4/lookAt":279,"gl-mat4/rotateX":284,"gl-mat4/rotateY":285,"gl-mat4/rotateZ":286,"gl-mat4/scale":287,"gl-mat4/translate":288,"gl-vec3/normalize":361,"mat4-interpolate":451}],455:[function(_dereq_,module,exports){ +},{"binary-search-bounds":481,"gl-mat4/invert":293,"gl-mat4/lookAt":294,"gl-mat4/rotateX":300,"gl-mat4/rotateY":301,"gl-mat4/rotateZ":302,"gl-mat4/scale":303,"gl-mat4/translate":305,"gl-vec3/normalize":387,"mat4-interpolate":477}],481:[function(_dereq_,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],456:[function(_dereq_,module,exports){ +},{"dup":243}],482:[function(_dereq_,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -62028,7 +62416,7 @@ function monotoneConvexHull2D(points) { //Return result return result } -},{"robust-orientation":520}],457:[function(_dereq_,module,exports){ +},{"robust-orientation":548}],483:[function(_dereq_,module,exports){ 'use strict' module.exports = mouseListen @@ -62235,7 +62623,7 @@ function mouseListen (element, callback) { return result } -},{"mouse-event":459}],458:[function(_dereq_,module,exports){ +},{"mouse-event":485}],484:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -62262,7 +62650,7 @@ function getBoundingClientOffset (element) { } } -},{}],459:[function(_dereq_,module,exports){ +},{}],485:[function(_dereq_,module,exports){ 'use strict' function mouseButtons(ev) { @@ -62324,7 +62712,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],460:[function(_dereq_,module,exports){ +},{}],486:[function(_dereq_,module,exports){ 'use strict' var toPX = _dereq_('to-px') @@ -62366,7 +62754,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":550}],461:[function(_dereq_,module,exports){ +},{"to-px":578}],487:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -62782,7 +63170,7 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":567}],462:[function(_dereq_,module,exports){ +},{"typedarray-pool":595}],488:[function(_dereq_,module,exports){ 'use strict' module.exports = gradient @@ -63080,7 +63468,7 @@ function gradient(out, inp, bc) { var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":151,"dup":176}],463:[function(_dereq_,module,exports){ +},{"cwise-compiler":151,"dup":176}],489:[function(_dereq_,module,exports){ "use strict" function interp1d(arr, x) { @@ -63191,7 +63579,7 @@ module.exports.d1 = interp1d module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],464:[function(_dereq_,module,exports){ +},{}],490:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("cwise-compiler") @@ -63654,7 +64042,7 @@ exports.equals = compile({ -},{"cwise-compiler":151}],465:[function(_dereq_,module,exports){ +},{"cwise-compiler":151}],491:[function(_dereq_,module,exports){ "use strict" var ndarray = _dereq_("ndarray") @@ -63677,10 +64065,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":466,"ndarray":469}],466:[function(_dereq_,module,exports){ +},{"./doConvert.js":492,"ndarray":495}],492:[function(_dereq_,module,exports){ module.exports=_dereq_('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":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":151}],467:[function(_dereq_,module,exports){ +},{"cwise-compiler":151}],493:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -64409,7 +64797,7 @@ function compileSort(order, dtype) { } module.exports = compileSort -},{"typedarray-pool":567}],468:[function(_dereq_,module,exports){ +},{"typedarray-pool":595}],494:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("./lib/compile_sort.js") @@ -64429,7 +64817,7 @@ function sort(array) { } module.exports = sort -},{"./lib/compile_sort.js":467}],469:[function(_dereq_,module,exports){ +},{"./lib/compile_sort.js":493}],495:[function(_dereq_,module,exports){ var iota = _dereq_("iota-array") var isBuffer = _dereq_("is-buffer") @@ -64780,7 +65168,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":437,"is-buffer":439}],470:[function(_dereq_,module,exports){ +},{"iota-array":463,"is-buffer":465}],496:[function(_dereq_,module,exports){ "use strict" var doubleBits = _dereq_("double-bits") @@ -64823,7 +65211,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":173}],471:[function(_dereq_,module,exports){ +},{"double-bits":173}],497:[function(_dereq_,module,exports){ var π = Math.PI var _120 = radians(120) @@ -65025,7 +65413,7 @@ function radians(degress){ return degress * (π / 180) } -},{}],472:[function(_dereq_,module,exports){ +},{}],498:[function(_dereq_,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -65150,7 +65538,7 @@ exports.faceNormals = function(faces, positions, specifiedEpsilon) { -},{}],473:[function(_dereq_,module,exports){ +},{}],499:[function(_dereq_,module,exports){ /* object-assign (c) Sindre Sorhus @@ -65242,7 +65630,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],474:[function(_dereq_,module,exports){ +},{}],500:[function(_dereq_,module,exports){ 'use strict' module.exports = quatFromFrame @@ -65284,7 +65672,7 @@ function quatFromFrame( } return out } -},{}],475:[function(_dereq_,module,exports){ +},{}],501:[function(_dereq_,module,exports){ 'use strict' module.exports = createOrbitController @@ -65678,7 +66066,7 @@ function createOrbitController(options) { return result } -},{"./lib/quatFromFrame":474,"filtered-vector":242,"gl-mat4/fromQuat":275,"gl-mat4/invert":278,"gl-mat4/lookAt":279}],476:[function(_dereq_,module,exports){ +},{"./lib/quatFromFrame":500,"filtered-vector":242,"gl-mat4/fromQuat":282,"gl-mat4/invert":293,"gl-mat4/lookAt":294}],502:[function(_dereq_,module,exports){ /*! * pad-left * @@ -65694,7 +66082,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":513}],477:[function(_dereq_,module,exports){ +},{"repeat-string":541}],503:[function(_dereq_,module,exports){ 'use strict' /** @@ -65831,7 +66219,7 @@ parenthesis.stringify = stringify module.exports = parenthesis -},{}],478:[function(_dereq_,module,exports){ +},{}],504:[function(_dereq_,module,exports){ 'use strict' var pick = _dereq_('pick-by-alias') @@ -65918,7 +66306,7 @@ function parseRect (arg) { return rect } -},{"pick-by-alias":485}],479:[function(_dereq_,module,exports){ +},{"pick-by-alias":511}],505:[function(_dereq_,module,exports){ module.exports = parse @@ -65977,7 +66365,7 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],480:[function(_dereq_,module,exports){ +},{}],506:[function(_dereq_,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -65988,10 +66376,10 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],481:[function(_dereq_,module,exports){ -(function (process){ -// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, -// backported and transplited with Babel, with backwards-compat fixes +},{}],507:[function(_dereq_,module,exports){ +(function (process){(function (){ +// 'path' module extracted from Node.js v8.11.1 (only the posix part) +// transplited with Babel // Copyright Joyent, Inc. and other Node contributors. // @@ -66014,288 +66402,515 @@ module.exports = function parseUnit(str, out) { // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } +'use strict'; + +function assertPath(path) { + if (typeof path !== 'string') { + throw new TypeError('Path must be a string. Received ' + JSON.stringify(path)); } +} - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); +// Resolves . and .. elements in a path with directory names +function normalizeStringPosix(path, allowAboveRoot) { + var res = ''; + var lastSegmentLength = 0; + var lastSlash = -1; + var dots = 0; + var code; + for (var i = 0; i <= path.length; ++i) { + if (i < path.length) + code = path.charCodeAt(i); + else if (code === 47 /*/*/) + break; + else + code = 47 /*/*/; + if (code === 47 /*/*/) { + if (lastSlash === i - 1 || dots === 1) { + // NOOP + } else if (lastSlash !== i - 1 && dots === 2) { + if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) { + if (res.length > 2) { + var lastSlashIndex = res.lastIndexOf('/'); + if (lastSlashIndex !== res.length - 1) { + if (lastSlashIndex === -1) { + res = ''; + lastSegmentLength = 0; + } else { + res = res.slice(0, lastSlashIndex); + lastSegmentLength = res.length - 1 - res.lastIndexOf('/'); + } + lastSlash = i; + dots = 0; + continue; + } + } else if (res.length === 2 || res.length === 1) { + res = ''; + lastSegmentLength = 0; + lastSlash = i; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + if (res.length > 0) + res += '/..'; + else + res = '..'; + lastSegmentLength = 2; + } + } else { + if (res.length > 0) + res += '/' + path.slice(lastSlash + 1, i); + else + res = path.slice(lastSlash + 1, i); + lastSegmentLength = i - lastSlash - 1; + } + lastSlash = i; + dots = 0; + } else if (code === 46 /*.*/ && dots !== -1) { + ++dots; + } else { + dots = -1; } } + return res; +} - return parts; +function _format(sep, pathObject) { + var dir = pathObject.dir || pathObject.root; + var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || ''); + if (!dir) { + return base; + } + if (dir === pathObject.root) { + return dir + base; + } + return dir + sep + base; } -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; +var posix = { + // path.resolve([from ...], to) + resolve: function resolve() { + var resolvedPath = ''; + var resolvedAbsolute = false; + var cwd; - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path; + if (i >= 0) + path = arguments[i]; + else { + if (cwd === undefined) + cwd = process.cwd(); + path = cwd; + } + + assertPath(path); + + // Skip empty entries + if (path.length === 0) { + continue; + } - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/; } - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) + // Normalize the path + resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute); - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); + if (resolvedAbsolute) { + if (resolvedPath.length > 0) + return '/' + resolvedPath; + else + return '/'; + } else if (resolvedPath.length > 0) { + return resolvedPath; + } else { + return '.'; + } + }, - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; + normalize: function normalize(path) { + assertPath(path); -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; + if (path.length === 0) return '.'; - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); + var isAbsolute = path.charCodeAt(0) === 47 /*/*/; + var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/; - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } + // Normalize the path + path = normalizeStringPosix(path, !isAbsolute); - return (isAbsolute ? '/' : '') + path; -}; + if (path.length === 0 && !isAbsolute) path = '.'; + if (path.length > 0 && trailingSeparator) path += '/'; -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; + if (isAbsolute) return '/' + path; + return path; + }, + + isAbsolute: function isAbsolute(path) { + assertPath(path); + return path.length > 0 && path.charCodeAt(0) === 47 /*/*/; + }, -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); + join: function join() { + if (arguments.length === 0) + return '.'; + var joined; + for (var i = 0; i < arguments.length; ++i) { + var arg = arguments[i]; + assertPath(arg); + if (arg.length > 0) { + if (joined === undefined) + joined = arg; + else + joined += '/' + arg; + } } - return p; - }).join('/')); -}; + if (joined === undefined) + return '.'; + return posix.normalize(joined); + }, + relative: function relative(from, to) { + assertPath(from); + assertPath(to); -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); + if (from === to) return ''; - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; + from = posix.resolve(from); + to = posix.resolve(to); + + if (from === to) return ''; + + // Trim any leading backslashes + var fromStart = 1; + for (; fromStart < from.length; ++fromStart) { + if (from.charCodeAt(fromStart) !== 47 /*/*/) + break; } + var fromEnd = from.length; + var fromLen = fromEnd - fromStart; - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; + // Trim any leading backslashes + var toStart = 1; + for (; toStart < to.length; ++toStart) { + if (to.charCodeAt(toStart) !== 47 /*/*/) + break; } + var toEnd = to.length; + var toLen = toEnd - toStart; - if (start > end) return []; - return arr.slice(start, end - start + 1); - } + // Compare paths to find the longest common path from root + var length = fromLen < toLen ? fromLen : toLen; + var lastCommonSep = -1; + var i = 0; + for (; i <= length; ++i) { + if (i === length) { + if (toLen > length) { + if (to.charCodeAt(toStart + i) === 47 /*/*/) { + // We get here if `from` is the exact base path for `to`. + // For example: from='/foo/bar'; to='/foo/bar/baz' + return to.slice(toStart + i + 1); + } else if (i === 0) { + // We get here if `from` is the root + // For example: from='/'; to='/foo' + return to.slice(toStart + i); + } + } else if (fromLen > length) { + if (from.charCodeAt(fromStart + i) === 47 /*/*/) { + // We get here if `to` is the exact base path for `from`. + // For example: from='/foo/bar/baz'; to='/foo/bar' + lastCommonSep = i; + } else if (i === 0) { + // We get here if `to` is the root. + // For example: from='/foo'; to='/' + lastCommonSep = 0; + } + } + break; + } + var fromCode = from.charCodeAt(fromStart + i); + var toCode = to.charCodeAt(toStart + i); + if (fromCode !== toCode) + break; + else if (fromCode === 47 /*/*/) + lastCommonSep = i; + } - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); + var out = ''; + // Generate the relative path based on the path difference between `to` + // and `from` + for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { + if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) { + if (out.length === 0) + out += '..'; + else + out += '/..'; + } + } - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; + // Lastly, append the rest of the destination (`to`) path that comes after + // the common path parts + if (out.length > 0) + return out + to.slice(toStart + lastCommonSep); + else { + toStart += lastCommonSep; + if (to.charCodeAt(toStart) === 47 /*/*/) + ++toStart; + return to.slice(toStart); } - } + }, - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } + _makeLong: function _makeLong(path) { + return path; + }, - outputParts = outputParts.concat(toParts.slice(samePartsLength)); + dirname: function dirname(path) { + assertPath(path); + if (path.length === 0) return '.'; + var code = path.charCodeAt(0); + var hasRoot = code === 47 /*/*/; + var end = -1; + var matchedSlash = true; + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47 /*/*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } + } - return outputParts.join('/'); -}; + if (end === -1) return hasRoot ? '/' : '.'; + if (hasRoot && end === 1) return '//'; + return path.slice(0, end); + }, -exports.sep = '/'; -exports.delimiter = ':'; + basename: function basename(path, ext) { + if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string'); + assertPath(path); -exports.dirname = function (path) { - if (typeof path !== 'string') path = path + ''; - if (path.length === 0) return '.'; - var code = path.charCodeAt(0); - var hasRoot = code === 47 /*/*/; - var end = -1; - var matchedSlash = true; - for (var i = path.length - 1; i >= 1; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - if (!matchedSlash) { - end = i; - break; + var start = 0; + var end = -1; + var matchedSlash = true; + var i; + + if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { + if (ext.length === path.length && ext === path) return ''; + var extIdx = ext.length - 1; + var firstNonSlashEnd = -1; + for (i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false; + firstNonSlashEnd = i + 1; + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === ext.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i; + } + } else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1; + end = firstNonSlashEnd; + } + } } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } + } - if (end === -1) return hasRoot ? '/' : '.'; - if (hasRoot && end === 1) { - // return '//'; - // Backwards-compat fix: - return '/'; - } - return path.slice(0, end); -}; + if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length; + return path.slice(start, end); + } else { + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } -function basename(path) { - if (typeof path !== 'string') path = path + ''; + if (end === -1) return ''; + return path.slice(start, end); + } + }, - var start = 0; - var end = -1; - var matchedSlash = true; - var i; + extname: function extname(path) { + assertPath(path); + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + startDot = i; + else if (preDotState !== 1) + preDotState = 1; + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + + if (startDot === -1 || end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ''; + } + return path.slice(startDot, end); + }, - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; + format: function format(pathObject) { + if (pathObject === null || typeof pathObject !== 'object') { + throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject); + } + return _format('/', pathObject); + }, + + parse: function parse(path) { + assertPath(path); + + var ret = { root: '', dir: '', base: '', ext: '', name: '' }; + if (path.length === 0) return ret; + var code = path.charCodeAt(0); + var isAbsolute = code === 47 /*/*/; + var start; + if (isAbsolute) { + ret.root = '/'; + start = 1; + } else { + start = 0; + } + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + var i = path.length - 1; + + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + + // Get non-dir info + for (; i >= start; --i) { + code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1; + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } } - } - if (end === -1) return ''; - return path.slice(start, end); -} + if (startDot === -1 || end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + if (end !== -1) { + if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end); + } + } else { + if (startPart === 0 && isAbsolute) { + ret.name = path.slice(1, startDot); + ret.base = path.slice(1, end); + } else { + ret.name = path.slice(startPart, startDot); + ret.base = path.slice(startPart, end); + } + ret.ext = path.slice(startDot, end); + } -// Uses a mixed approach for backwards-compatibility, as ext behavior changed -// in new Node.js versions, so only basename() above is backported here -exports.basename = function (path, ext) { - var f = basename(path); - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; + if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/'; -exports.extname = function (path) { - if (typeof path !== 'string') path = path + ''; - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) - startDot = i; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ''; - } - return path.slice(startDot, end); + return ret; + }, + + sep: '/', + delimiter: ':', + win32: null, + posix: null }; -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} +posix.posix = posix; -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; +module.exports = posix; -}).call(this,_dereq_('_process')) -},{"_process":500}],482:[function(_dereq_,module,exports){ -(function (process){ +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":526}],508:[function(_dereq_,module,exports){ +(function (process){(function (){ // Generated by CoffeeScript 1.12.2 (function() { var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; @@ -66333,8 +66948,8 @@ var substr = 'ab'.substr(-1) === 'b' -}).call(this,_dereq_('_process')) -},{"_process":500}],483:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":526}],509:[function(_dereq_,module,exports){ "use strict" module.exports = permutationSign @@ -66386,7 +67001,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":567}],484:[function(_dereq_,module,exports){ +},{"typedarray-pool":595}],510:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -66473,7 +67088,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":436,"typedarray-pool":567}],485:[function(_dereq_,module,exports){ +},{"invert-permutation":462,"typedarray-pool":595}],511:[function(_dereq_,module,exports){ 'use strict' @@ -66552,7 +67167,7 @@ function toList(arg) { return arg } -},{}],486:[function(_dereq_,module,exports){ +},{}],512:[function(_dereq_,module,exports){ "use strict" module.exports = planarDual @@ -66683,7 +67298,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":132}],487:[function(_dereq_,module,exports){ +},{"compare-angle":132}],513:[function(_dereq_,module,exports){ 'use strict' module.exports = trimLeaves @@ -66739,7 +67354,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":178}],488:[function(_dereq_,module,exports){ +},{"edges-to-adjacency-list":178}],514:[function(_dereq_,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -66944,9 +67559,9 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":487,"edges-to-adjacency-list":178,"planar-dual":486,"point-in-big-polygon":490,"robust-sum":525,"two-product":554,"uniq":569}],489:[function(_dereq_,module,exports){ +},{"./lib/trim-leaves":513,"edges-to-adjacency-list":178,"planar-dual":512,"point-in-big-polygon":516,"robust-sum":553,"two-product":582,"uniq":597}],515:[function(_dereq_,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],490:[function(_dereq_,module,exports){ +},{"dup":243}],516:[function(_dereq_,module,exports){ module.exports = preprocessPolygon var orient = _dereq_('robust-orientation')[3] @@ -67098,7 +67713,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":489,"interval-tree-1d":434,"robust-orientation":520,"slab-decomposition":537}],491:[function(_dereq_,module,exports){ +},{"binary-search-bounds":515,"interval-tree-1d":460,"robust-orientation":548,"slab-decomposition":565}],517:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -67226,7 +67841,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":492,"./lib/epsilon":493,"./lib/geojson":494,"./lib/intersecter":495,"./lib/segment-chainer":497,"./lib/segment-selector":498}],492:[function(_dereq_,module,exports){ +},{"./lib/build-log":518,"./lib/epsilon":519,"./lib/geojson":520,"./lib/intersecter":521,"./lib/segment-chainer":523,"./lib/segment-selector":524}],518:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -67341,7 +67956,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],493:[function(_dereq_,module,exports){ +},{}],519:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -67513,7 +68128,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],494:[function(_dereq_,module,exports){ +},{}],520:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -67703,7 +68318,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],495:[function(_dereq_,module,exports){ +},{}],521:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -68210,7 +68825,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":496}],496:[function(_dereq_,module,exports){ +},{"./linked-list":522}],522:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -68293,7 +68908,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],497:[function(_dereq_,module,exports){ +},{}],523:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -68547,7 +69162,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],498:[function(_dereq_,module,exports){ +},{}],524:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -68715,7 +69330,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],499:[function(_dereq_,module,exports){ +},{}],525:[function(_dereq_,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -68913,7 +69528,7 @@ function closestPoint2d(V0, V1, V2, point, result) { module.exports = closestPoint2d; -},{}],500:[function(_dereq_,module,exports){ +},{}],526:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -69099,10 +69714,10 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],501:[function(_dereq_,module,exports){ +},{}],527:[function(_dereq_,module,exports){ module.exports = _dereq_('gl-quat/slerp') -},{"gl-quat/slerp":304}],502:[function(_dereq_,module,exports){ -(function (global){ +},{"gl-quat/slerp":325}],528:[function(_dereq_,module,exports){ +(function (global){(function (){ var now = _dereq_('performance-now') , root = typeof window === 'undefined' ? global : window , vendors = ['moz', 'webkit'] @@ -69179,8 +69794,8 @@ module.exports.polyfill = function(object) { object.cancelAnimationFrame = caf } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"performance-now":482}],503:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"performance-now":508}],529:[function(_dereq_,module,exports){ 'use strict' var bnadd = _dereq_('big-rat/add') @@ -69196,7 +69811,7 @@ function add (a, b) { return r } -},{"big-rat/add":80}],504:[function(_dereq_,module,exports){ +},{"big-rat/add":80}],530:[function(_dereq_,module,exports){ 'use strict' module.exports = float2rat @@ -69211,7 +69826,7 @@ function float2rat(v) { return result } -},{"big-rat":83}],505:[function(_dereq_,module,exports){ +},{"big-rat":83}],531:[function(_dereq_,module,exports){ 'use strict' var rat = _dereq_('big-rat') @@ -69229,7 +69844,7 @@ function muls(a, x) { return r } -},{"big-rat":83,"big-rat/mul":92}],506:[function(_dereq_,module,exports){ +},{"big-rat":83,"big-rat/mul":92}],532:[function(_dereq_,module,exports){ 'use strict' var bnsub = _dereq_('big-rat/sub') @@ -69245,7 +69860,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":94}],507:[function(_dereq_,module,exports){ +},{"big-rat/sub":94}],533:[function(_dereq_,module,exports){ 'use strict' var compareCell = _dereq_('compare-cell') @@ -69278,7 +69893,7 @@ function reduceCellComplex(cells) { return cells } -},{"cell-orientation":117,"compare-cell":133,"compare-oriented-cell":134}],508:[function(_dereq_,module,exports){ +},{"cell-orientation":117,"compare-cell":133,"compare-oriented-cell":134}],534:[function(_dereq_,module,exports){ 'use strict' var getBounds = _dereq_('array-bounds') @@ -69765,7 +70380,7 @@ function Error2D (regl, options) { } } -},{"array-bounds":70,"color-normalize":125,"flatten-vertex-data":244,"object-assign":473,"pick-by-alias":485,"to-float32":549,"update-diff":571}],509:[function(_dereq_,module,exports){ +},{"array-bounds":70,"color-normalize":125,"flatten-vertex-data":244,"object-assign":499,"pick-by-alias":511,"to-float32":577,"update-diff":599}],535:[function(_dereq_,module,exports){ 'use strict' @@ -70494,7 +71109,9 @@ Line2D.prototype.destroy = function () { return this } -},{"array-bounds":70,"array-normalize":71,"color-normalize":125,"earcut":177,"es6-weak-map":233,"flatten-vertex-data":244,"glslify":413,"object-assign":473,"parse-rect":478,"pick-by-alias":485,"to-float32":549}],510:[function(_dereq_,module,exports){ +},{"array-bounds":70,"array-normalize":71,"color-normalize":125,"earcut":177,"es6-weak-map":233,"flatten-vertex-data":244,"glslify":536,"object-assign":499,"parse-rect":504,"pick-by-alias":511,"to-float32":577}],536:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],537:[function(_dereq_,module,exports){ 'use strict'; function _slicedToArray(arr, i) { @@ -71478,7 +72095,9 @@ var reglScatter2d = function reglScatter2d(regl, options) { module.exports = reglScatter2d; -},{"@plotly/point-cluster":57,"array-bounds":70,"color-id":123,"color-normalize":125,"flatten-vertex-data":244,"glslify":413,"is-iexplorer":440,"object-assign":473,"parse-rect":478,"pick-by-alias":485,"to-float32":549,"update-diff":571}],511:[function(_dereq_,module,exports){ +},{"@plotly/point-cluster":57,"array-bounds":70,"color-id":123,"color-normalize":125,"flatten-vertex-data":244,"glslify":538,"is-iexplorer":466,"object-assign":499,"parse-rect":504,"pick-by-alias":511,"to-float32":577,"update-diff":599}],538:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],539:[function(_dereq_,module,exports){ 'use strict' @@ -71900,7 +72519,7 @@ function getPad (arg) { } } -},{"array-bounds":70,"array-range":72,"flatten-vertex-data":244,"parse-rect":478,"pick-by-alias":485,"raf":502,"regl-scatter2d":510}],512:[function(_dereq_,module,exports){ +},{"array-bounds":70,"array-range":72,"flatten-vertex-data":244,"parse-rect":504,"pick-by-alias":511,"raf":528,"regl-scatter2d":537}],540:[function(_dereq_,module,exports){ (function(ja,N){"object"===typeof exports&&"undefined"!==typeof module?module.exports=N():"function"===typeof define&&define.amd?define(N):ja.createREGL=N()})(this,function(){function ja(a,b){this.id=Bb++;this.type=a;this.data=b}function N(a){if(0===a.length)return[];var b=a.charAt(0),c=a.charAt(a.length-1);if(1b;+ b){var c;switch(a){case "frame":return u(b);case "lost":c=V;break;case "restore":c=X;break;case "destroy":c=Y}c.push(b);return{cancel:function(){for(var a=0;a * @@ -72135,8 +72754,8 @@ function repeat(str, num) { return res; } -},{}],514:[function(_dereq_,module,exports){ -(function (global){ +},{}],542:[function(_dereq_,module,exports){ +(function (global){(function (){ module.exports = global.performance && global.performance.now ? function now() { @@ -72145,8 +72764,8 @@ module.exports = return +new Date } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],515:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],543:[function(_dereq_,module,exports){ "use strict" module.exports = compressExpansion @@ -72181,7 +72800,7 @@ function compressExpansion(e) { e.length = top return e } -},{}],516:[function(_dereq_,module,exports){ +},{}],544:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72285,7 +72904,7 @@ return robustDeterminant") } generateDispatch() -},{"robust-compress":515,"robust-scale":522,"robust-sum":525,"two-product":554}],517:[function(_dereq_,module,exports){ +},{"robust-compress":543,"robust-scale":550,"robust-sum":553,"two-product":582}],545:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72300,7 +72919,7 @@ function robustDotProduct(a, b) { } return r } -},{"robust-sum":525,"two-product":554}],518:[function(_dereq_,module,exports){ +},{"robust-sum":553,"two-product":582}],546:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72468,7 +73087,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":522,"robust-subtract":524,"robust-sum":525,"two-product":554}],519:[function(_dereq_,module,exports){ +},{"robust-scale":550,"robust-subtract":552,"robust-sum":553,"two-product":582}],547:[function(_dereq_,module,exports){ "use strict" var determinant = _dereq_("robust-determinant") @@ -72540,7 +73159,7 @@ function generateDispatch() { } generateDispatch() -},{"robust-determinant":516}],520:[function(_dereq_,module,exports){ +},{"robust-determinant":544}],548:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72731,7 +73350,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":522,"robust-subtract":524,"robust-sum":525,"two-product":554}],521:[function(_dereq_,module,exports){ +},{"robust-scale":550,"robust-subtract":552,"robust-sum":553,"two-product":582}],549:[function(_dereq_,module,exports){ "use strict" var robustSum = _dereq_("robust-sum") @@ -72761,7 +73380,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":522,"robust-sum":525}],522:[function(_dereq_,module,exports){ +},{"robust-scale":550,"robust-sum":553}],550:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72812,7 +73431,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":554,"two-sum":555}],523:[function(_dereq_,module,exports){ +},{"two-product":582,"two-sum":583}],551:[function(_dereq_,module,exports){ "use strict" module.exports = segmentsIntersect @@ -72860,7 +73479,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":520}],524:[function(_dereq_,module,exports){ +},{"robust-orientation":548}],552:[function(_dereq_,module,exports){ "use strict" module.exports = robustSubtract @@ -73017,7 +73636,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],525:[function(_dereq_,module,exports){ +},{}],553:[function(_dereq_,module,exports){ "use strict" module.exports = linearExpansionSum @@ -73174,7 +73793,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],526:[function(_dereq_,module,exports){ +},{}],554:[function(_dereq_,module,exports){ "use strict" module.exports = function signum(x) { @@ -73182,7 +73801,7 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],527:[function(_dereq_,module,exports){ +},{}],555:[function(_dereq_,module,exports){ 'use strict' module.exports = boundary @@ -73194,7 +73813,7 @@ function boundary(cells) { return reduce(bnd(cells)) } -},{"boundary-cells":100,"reduce-simplicial-complex":507}],528:[function(_dereq_,module,exports){ +},{"boundary-cells":100,"reduce-simplicial-complex":533}],556:[function(_dereq_,module,exports){ 'use strict' module.exports = extractContour @@ -73357,7 +73976,7 @@ function extractContour(cells, values, level, d) { vertexWeights: uweights } } -},{"./lib/codegen":529,"ndarray":469,"ndarray-sort":468,"typedarray-pool":567}],529:[function(_dereq_,module,exports){ +},{"./lib/codegen":557,"ndarray":495,"ndarray-sort":494,"typedarray-pool":595}],557:[function(_dereq_,module,exports){ 'use strict' module.exports = getPolygonizer @@ -73454,7 +74073,7 @@ function getPolygonizer(d) { } return alg } -},{"marching-simplex-table":448,"typedarray-pool":567}],530:[function(_dereq_,module,exports){ +},{"marching-simplex-table":474,"typedarray-pool":595}],558:[function(_dereq_,module,exports){ "use strict"; "use restrict"; var bits = _dereq_("bit-twiddle") @@ -73798,11 +74417,11 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":97,"union-find":568}],531:[function(_dereq_,module,exports){ +},{"bit-twiddle":97,"union-find":596}],559:[function(_dereq_,module,exports){ arguments[4][97][0].apply(exports,arguments) -},{"dup":97}],532:[function(_dereq_,module,exports){ -arguments[4][530][0].apply(exports,arguments) -},{"bit-twiddle":531,"dup":530,"union-find":533}],533:[function(_dereq_,module,exports){ +},{"dup":97}],560:[function(_dereq_,module,exports){ +arguments[4][558][0].apply(exports,arguments) +},{"bit-twiddle":559,"dup":558,"union-find":561}],561:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -73859,7 +74478,7 @@ UnionFind.prototype.link = function(x, y) { } -},{}],534:[function(_dereq_,module,exports){ +},{}],562:[function(_dereq_,module,exports){ "use strict" module.exports = simplifyPolygon @@ -74131,7 +74750,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":520,"simplicial-complex":532}],535:[function(_dereq_,module,exports){ +},{"robust-orientation":548,"simplicial-complex":560}],563:[function(_dereq_,module,exports){ "use strict" module.exports = orderSegments @@ -74227,9 +74846,9 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":520}],536:[function(_dereq_,module,exports){ +},{"robust-orientation":548}],564:[function(_dereq_,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],537:[function(_dereq_,module,exports){ +},{"dup":243}],565:[function(_dereq_,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -74460,7 +75079,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":535,"binary-search-bounds":536,"functional-red-black-tree":247,"robust-orientation":520}],538:[function(_dereq_,module,exports){ +},{"./lib/order-segments":563,"binary-search-bounds":564,"functional-red-black-tree":247,"robust-orientation":548}],566:[function(_dereq_,module,exports){ "use strict" var robustDot = _dereq_("robust-dot-product") @@ -74552,7 +75171,7 @@ function negative(points, plane) { } return neg } -},{"robust-dot-product":517,"robust-sum":525}],539:[function(_dereq_,module,exports){ +},{"robust-dot-product":545,"robust-sum":553}],567:[function(_dereq_,module,exports){ /* global window, exports, define */ !function() { @@ -74785,7 +75404,7 @@ function negative(points, plane) { /* eslint-enable quote-props */ }(); // eslint-disable-line -},{}],540:[function(_dereq_,module,exports){ +},{}],568:[function(_dereq_,module,exports){ 'use strict' var paren = _dereq_('parenthesis') @@ -74843,7 +75462,7 @@ module.exports = function splitBy (string, separator, o) { return parts } -},{"parenthesis":477}],541:[function(_dereq_,module,exports){ +},{"parenthesis":503}],569:[function(_dereq_,module,exports){ "use strict" module.exports = stronglyConnectedComponents @@ -74959,7 +75578,7 @@ function stronglyConnectedComponents(adjList) { return {components: components, adjacencyList: sccAdjList} } -},{}],542:[function(_dereq_,module,exports){ +},{}],570:[function(_dereq_,module,exports){ "use strict" module.exports = surfaceNets @@ -75167,7 +75786,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":461,"triangulate-hypercube":552,"zero-crossings":596}],543:[function(_dereq_,module,exports){ +},{"ndarray-extract-contour":487,"triangulate-hypercube":580,"zero-crossings":624}],571:[function(_dereq_,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -75358,7 +75977,7 @@ var arcToBezier = function arcToBezier(_ref2) { exports.default = arcToBezier; module.exports = exports.default; -},{}],544:[function(_dereq_,module,exports){ +},{}],572:[function(_dereq_,module,exports){ 'use strict' var parse = _dereq_('parse-svg-path') @@ -75403,7 +76022,7 @@ function pathBounds(path) { return bounds } -},{"abs-svg-path":65,"assert":73,"is-svg-path":445,"normalize-svg-path":545,"parse-svg-path":479}],545:[function(_dereq_,module,exports){ +},{"abs-svg-path":65,"assert":73,"is-svg-path":471,"normalize-svg-path":573,"parse-svg-path":505}],573:[function(_dereq_,module,exports){ 'use strict' module.exports = normalize @@ -75527,7 +76146,7 @@ function quadratic(x1, y1, cx, cy, x2, y2){ ] } -},{"svg-arc-to-cubic-bezier":543}],546:[function(_dereq_,module,exports){ +},{"svg-arc-to-cubic-bezier":571}],574:[function(_dereq_,module,exports){ 'use strict' var pathBounds = _dereq_('svg-path-bounds') @@ -75630,8 +76249,8 @@ function isPath2DSupported () { return path2DSupported = idata && idata.data && idata.data[3] === 255 } -},{"bitmap-sdf":98,"draw-svg-path":174,"is-svg-path":445,"parse-svg-path":479,"svg-path-bounds":544}],547:[function(_dereq_,module,exports){ -(function (process){ +},{"bitmap-sdf":98,"draw-svg-path":174,"is-svg-path":471,"parse-svg-path":505,"svg-path-bounds":572}],575:[function(_dereq_,module,exports){ +(function (process){(function (){ 'use strict' module.exports = textGet @@ -75726,9 +76345,9 @@ function textGet(font, text, opts) { return mesh } -}).call(this,_dereq_('_process')) -},{"_process":500,"vectorize-text":572}],548:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":526,"vectorize-text":600}],576:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -76924,7 +77543,7 @@ else { })(Math); -},{}],549:[function(_dereq_,module,exports){ +},{}],577:[function(_dereq_,module,exports){ /* @module to-float32 */ 'use strict' @@ -76965,7 +77584,7 @@ function float32 (arr) { return narr[0] } -},{}],550:[function(_dereq_,module,exports){ +},{}],578:[function(_dereq_,module,exports){ 'use strict' var parseUnit = _dereq_('parse-unit') @@ -77026,7 +77645,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":480}],551:[function(_dereq_,module,exports){ +},{"parse-unit":506}],579:[function(_dereq_,module,exports){ // https://github.com/topojson/topojson-client v3.1.0 Copyright 2019 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -77536,7 +78155,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); })); -},{}],552:[function(_dereq_,module,exports){ +},{}],580:[function(_dereq_,module,exports){ "use strict" module.exports = triangulateCube @@ -77570,7 +78189,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":248,"permutation-parity":483,"permutation-rank":484}],553:[function(_dereq_,module,exports){ +},{"gamma":248,"permutation-parity":509,"permutation-rank":510}],581:[function(_dereq_,module,exports){ 'use strict' module.exports = createTurntableController @@ -78143,7 +78762,7 @@ function createTurntableController(options) { theta, phi) } -},{"filtered-vector":242,"gl-mat4/invert":278,"gl-mat4/rotate":283,"gl-vec3/cross":339,"gl-vec3/dot":344,"gl-vec3/normalize":361}],554:[function(_dereq_,module,exports){ +},{"filtered-vector":242,"gl-mat4/invert":293,"gl-mat4/rotate":299,"gl-vec3/cross":365,"gl-vec3/dot":370,"gl-vec3/normalize":387}],582:[function(_dereq_,module,exports){ "use strict" module.exports = twoProduct @@ -78177,7 +78796,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],555:[function(_dereq_,module,exports){ +},{}],583:[function(_dereq_,module,exports){ "use strict" module.exports = fastTwoSum @@ -78195,7 +78814,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],556:[function(_dereq_,module,exports){ +},{}],584:[function(_dereq_,module,exports){ "use strict"; var isPrototype = _dereq_("../prototype/is"); @@ -78216,7 +78835,7 @@ module.exports = function (value) { return !isPrototype(value); }; -},{"../prototype/is":563}],557:[function(_dereq_,module,exports){ +},{"../prototype/is":591}],585:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is") @@ -78239,7 +78858,7 @@ module.exports = function (value, defaultMessage, inputOptions) { throw new TypeError(resolveMessage(errorMessage, value)); }; -},{"../object/is":560,"../string/coerce":564,"../value/is":566,"./to-short-string":559}],558:[function(_dereq_,module,exports){ +},{"../object/is":588,"../string/coerce":592,"../value/is":594,"./to-short-string":587}],586:[function(_dereq_,module,exports){ "use strict"; module.exports = function (value) { @@ -78251,7 +78870,7 @@ module.exports = function (value) { } }; -},{}],559:[function(_dereq_,module,exports){ +},{}],587:[function(_dereq_,module,exports){ "use strict"; var safeToString = _dereq_("./safe-to-string"); @@ -78282,7 +78901,7 @@ module.exports = function (value) { return string; }; -},{"./safe-to-string":558}],560:[function(_dereq_,module,exports){ +},{"./safe-to-string":586}],588:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is"); @@ -78295,7 +78914,7 @@ module.exports = function (value) { return hasOwnProperty.call(possibleTypes, typeof value); }; -},{"../value/is":566}],561:[function(_dereq_,module,exports){ +},{"../value/is":594}],589:[function(_dereq_,module,exports){ "use strict"; var resolveException = _dereq_("../lib/resolve-exception") @@ -78306,7 +78925,7 @@ module.exports = function (value/*, options*/) { return resolveException(value, "%v is not a plain function", arguments[1]); }; -},{"../lib/resolve-exception":557,"./is":562}],562:[function(_dereq_,module,exports){ +},{"../lib/resolve-exception":585,"./is":590}],590:[function(_dereq_,module,exports){ "use strict"; var isFunction = _dereq_("../function/is"); @@ -78319,7 +78938,7 @@ module.exports = function (value) { return true; }; -},{"../function/is":556}],563:[function(_dereq_,module,exports){ +},{"../function/is":584}],591:[function(_dereq_,module,exports){ "use strict"; var isObject = _dereq_("../object/is"); @@ -78334,7 +78953,7 @@ module.exports = function (value) { } }; -},{"../object/is":560}],564:[function(_dereq_,module,exports){ +},{"../object/is":588}],592:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is") @@ -78359,7 +78978,7 @@ module.exports = function (value) { } }; -},{"../object/is":560,"../value/is":566}],565:[function(_dereq_,module,exports){ +},{"../object/is":588,"../value/is":594}],593:[function(_dereq_,module,exports){ "use strict"; var resolveException = _dereq_("../lib/resolve-exception") @@ -78370,7 +78989,7 @@ module.exports = function (value/*, options*/) { return resolveException(value, "Cannot use %v", arguments[1]); }; -},{"../lib/resolve-exception":557,"./is":566}],566:[function(_dereq_,module,exports){ +},{"../lib/resolve-exception":585,"./is":594}],594:[function(_dereq_,module,exports){ "use strict"; // ES3 safe @@ -78378,8 +78997,8 @@ var _undefined = void 0; module.exports = function (value) { return value !== _undefined && value !== null; }; -},{}],567:[function(_dereq_,module,exports){ -(function (global){ +},{}],595:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var bits = _dereq_('bit-twiddle') @@ -78632,8 +79251,8 @@ exports.clearCache = function clearCache() { } } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"bit-twiddle":97,"buffer":111,"dup":176}],568:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"bit-twiddle":97,"buffer":111,"dup":176}],596:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -78696,7 +79315,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],569:[function(_dereq_,module,exports){ +},{}],597:[function(_dereq_,module,exports){ "use strict" function unique_pred(list, compare) { @@ -78755,7 +79374,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],570:[function(_dereq_,module,exports){ +},{}],598:[function(_dereq_,module,exports){ var reg = /[\'\"]/ module.exports = function unquote(str) { @@ -78771,7 +79390,7 @@ module.exports = function unquote(str) { return str } -},{}],571:[function(_dereq_,module,exports){ +},{}],599:[function(_dereq_,module,exports){ /** * @module update-diff */ @@ -78804,7 +79423,7 @@ module.exports = function updateDiff (obj, diff, mappers) { return obj } -},{}],572:[function(_dereq_,module,exports){ +},{}],600:[function(_dereq_,module,exports){ "use strict" module.exports = createText @@ -78831,7 +79450,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":573}],573:[function(_dereq_,module,exports){ +},{"./lib/vtext":601}],601:[function(_dereq_,module,exports){ module.exports = vectorizeText module.exports.processPixels = processPixels @@ -79286,7 +79905,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":112,"clean-pslg":121,"ndarray":469,"planar-graph-to-polyline":488,"simplify-planar-graph":534,"surface-nets":542}],574:[function(_dereq_,module,exports){ +},{"cdt2d":112,"clean-pslg":121,"ndarray":495,"planar-graph-to-polyline":514,"simplify-planar-graph":562,"surface-nets":570}],602:[function(_dereq_,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -79973,7 +80592,7 @@ function vectorizeText(str, canvas, context, options) { } })(); -},{}],575:[function(_dereq_,module,exports){ +},{}],603:[function(_dereq_,module,exports){ var hiddenStore = _dereq_('./hidden-store.js'); module.exports = createStore; @@ -79994,7 +80613,7 @@ function createStore() { }; } -},{"./hidden-store.js":576}],576:[function(_dereq_,module,exports){ +},{"./hidden-store.js":604}],604:[function(_dereq_,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -80012,7 +80631,7 @@ function hiddenStore(obj, key) { return store; } -},{}],577:[function(_dereq_,module,exports){ +},{}],605:[function(_dereq_,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -80043,14 +80662,14 @@ function weakMap() { } } -},{"./create-store.js":575}],578:[function(_dereq_,module,exports){ +},{"./create-store.js":603}],606:[function(_dereq_,module,exports){ var getContext = _dereq_('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":249}],579:[function(_dereq_,module,exports){ +},{"get-canvas-context":249}],607:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -80783,7 +81402,7 @@ function toSolar(yearOrDate, monthOrResult, day, isIntercalaryOrResult, result) } -},{"../main":593,"object-assign":473}],580:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],608:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -80967,7 +81586,7 @@ assign(CopticCalendar.prototype, { main.calendars.coptic = CopticCalendar; -},{"../main":593,"object-assign":473}],581:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],609:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -81195,7 +81814,7 @@ var centuries = { main.calendars.discworld = DiscworldCalendar; -},{"../main":593,"object-assign":473}],582:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],610:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -81379,7 +81998,7 @@ assign(EthiopianCalendar.prototype, { main.calendars.ethiopian = EthiopianCalendar; -},{"../main":593,"object-assign":473}],583:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],611:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -81653,7 +82272,7 @@ function mod(a, b) { main.calendars.hebrew = HebrewCalendar; -},{"../main":593,"object-assign":473}],584:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],612:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -81834,7 +82453,7 @@ assign(IslamicCalendar.prototype, { main.calendars.islamic = IslamicCalendar; -},{"../main":593,"object-assign":473}],585:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],613:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -82017,7 +82636,7 @@ assign(JulianCalendar.prototype, { main.calendars.julian = JulianCalendar; -},{"../main":593,"object-assign":473}],586:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],614:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -82312,7 +82931,7 @@ function amod(a, b) { main.calendars.mayan = MayanCalendar; -},{"../main":593,"object-assign":473}],587:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],615:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -82492,7 +83111,7 @@ assign(NanakshahiCalendar.prototype, { main.calendars.nanakshahi = NanakshahiCalendar; -},{"../main":593,"object-assign":473}],588:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],616:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -82915,7 +83534,7 @@ assign(NepaliCalendar.prototype, { main.calendars.nepali = NepaliCalendar; -},{"../main":593,"object-assign":473}],589:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],617:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -83105,7 +83724,7 @@ main.calendars.persian = PersianCalendar; main.calendars.jalali = PersianCalendar; -},{"../main":593,"object-assign":473}],590:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],618:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -83291,7 +83910,7 @@ assign(TaiwanCalendar.prototype, { main.calendars.taiwan = TaiwanCalendar; -},{"../main":593,"object-assign":473}],591:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],619:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -83477,7 +84096,7 @@ assign(ThaiCalendar.prototype, { main.calendars.thai = ThaiCalendar; -},{"../main":593,"object-assign":473}],592:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],620:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -83842,7 +84461,7 @@ var ummalqura_dat = [ 79990]; -},{"../main":593,"object-assign":473}],593:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],621:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -84747,7 +85366,7 @@ _exports.baseCalendar = BaseCalendar; _exports.calendars.gregorian = GregorianCalendar; -},{"object-assign":473}],594:[function(_dereq_,module,exports){ +},{"object-assign":499}],622:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -85249,7 +85868,7 @@ assign(main.baseCalendar.prototype, { }); -},{"./main":593,"object-assign":473}],595:[function(_dereq_,module,exports){ +},{"./main":621,"object-assign":499}],623:[function(_dereq_,module,exports){ module.exports = _dereq_('cwise-compiler')({ args: ['array', { offset: [1], @@ -85301,7 +85920,7 @@ module.exports = _dereq_('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":151}],596:[function(_dereq_,module,exports){ +},{"cwise-compiler":151}],624:[function(_dereq_,module,exports){ "use strict" module.exports = findZeroCrossings @@ -85314,7 +85933,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":595}],597:[function(_dereq_,module,exports){ +},{"./lib/zc-core":623}],625:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85385,7 +86004,7 @@ module.exports = [ } ]; -},{}],598:[function(_dereq_,module,exports){ +},{}],626:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85400,7 +86019,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -85642,12 +86288,7 @@ module.exports = templatedArray('annotation', { role: 'info', editType: 'calc+arraydraw', description: [ - 'Sets the x component of the arrow tail about the arrow head.', - 'If `axref` is `pixel`, a positive (negative) ', - 'component corresponds to an arrow pointing', - 'from right to left (left to right).', - 'If `axref` is an axis, this is an absolute value on that axis,', - 'like `x`, NOT a relative value.' + arrowCoordinateDescription('x', 'left', 'right') ].join(' ') }, ay: { @@ -85655,12 +86296,7 @@ module.exports = templatedArray('annotation', { role: 'info', editType: 'calc+arraydraw', description: [ - 'Sets the y component of the arrow tail about the arrow head.', - 'If `ayref` is `pixel`, a positive (negative) ', - 'component corresponds to an arrow pointing', - 'from bottom to top (top to bottom).', - 'If `ayref` is an axis, this is an absolute value on that axis,', - 'like `y`, NOT a relative value.' + arrowCoordinateDescription('y', 'top', 'bottom') ].join(' ') }, axref: { @@ -85673,12 +86309,10 @@ module.exports = templatedArray('annotation', { role: 'info', editType: 'calc', description: [ - 'Indicates in what terms the tail of the annotation (ax,ay) ', - 'is specified. If `pixel`, `ax` is a relative offset in pixels ', - 'from `x`. If set to an x axis id (e.g. *x* or *x2*), `ax` is ', - 'specified in the same terms as that axis. This is useful ', - 'for trendline annotations which should continue to indicate ', - 'the correct trend when zoomed.' + 'Indicates in what coordinates the tail of the', + 'annotation (ax,ay) is specified.', + axisPlaceableObjs.axisRefDescription('ax', 'left', 'right'), + arrowAxisRefDescription('x') ].join(' ') }, ayref: { @@ -85691,12 +86325,10 @@ module.exports = templatedArray('annotation', { role: 'info', editType: 'calc', description: [ - 'Indicates in what terms the tail of the annotation (ax,ay) ', - 'is specified. If `pixel`, `ay` is a relative offset in pixels ', - 'from `y`. If set to a y axis id (e.g. *y* or *y2*), `ay` is ', - 'specified in the same terms as that axis. This is useful ', - 'for trendline annotations which should continue to indicate ', - 'the correct trend when zoomed.' + 'Indicates in what coordinates the tail of the', + 'annotation (ax,ay) is specified.', + axisPlaceableObjs.axisRefDescription('ay', 'bottom', 'top'), + arrowAxisRefDescription('y') ].join(' ') }, // positioning @@ -85710,11 +86342,7 @@ module.exports = templatedArray('annotation', { editType: 'calc', description: [ 'Sets the annotation\'s x coordinate axis.', - 'If set to an x axis id (e.g. *x* or *x2*), the `x` position', - 'refers to an x coordinate', - 'If set to *paper*, the `x` position refers to the distance from', - 'the left side of the plotting area in normalized coordinates', - 'where 0 (1) corresponds to the left (right) side.' + axisPlaceableObjs.axisRefDescription('x', 'left', 'right'), ].join(' ') }, x: { @@ -85773,11 +86401,7 @@ module.exports = templatedArray('annotation', { editType: 'calc', description: [ 'Sets the annotation\'s y coordinate axis.', - 'If set to an y axis id (e.g. *y* or *y2*), the `y` position', - 'refers to an y coordinate', - 'If set to *paper*, the `y` position refers to the distance from', - 'the bottom of the plotting area in normalized coordinates', - 'where 0 (1) corresponds to the bottom (top).' + axisPlaceableObjs.axisRefDescription('y', 'bottom', 'top'), ].join(' ') }, y: { @@ -85932,7 +86556,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803,"../../plots/font_attributes":825,"./arrow_paths":597}],599:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":746,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833,"../../plots/font_attributes":855,"./arrow_paths":625}],627:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85969,10 +86593,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -86021,7 +86647,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":749,"../../plots/cartesian/axes":797,"./draw":604}],600:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"./draw":632}],628:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86159,7 +86785,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":749,"../../plot_api/plot_template":787,"../../registry":880}],601:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../registry":910}],629:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86238,7 +86864,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":749,"../color":615}],602:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643}],630:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86301,7 +86927,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":775,"fast-isnumeric":241}],603:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":804,"fast-isnumeric":241}],631:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86364,7 +86990,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -86408,7 +87035,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"./attributes":598,"./common_defaults":601}],604:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"./attributes":626,"./common_defaults":629}],632:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86424,6 +87051,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -86484,6 +87112,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -86707,13 +87360,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -86729,12 +87383,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -86751,8 +87410,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -86942,7 +87622,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -86973,22 +87653,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -87020,14 +87701,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -87036,7 +87720,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -87046,7 +87732,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -87066,7 +87754,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -87108,7 +87796,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":749,"../../lib/setcursor":769,"../../lib/svg_text_utils":773,"../../plot_api/plot_template":787,"../../plots/cartesian/axes":797,"../../plots/plots":860,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"../fx":655,"./draw_arrow_head":605,"d3":169}],605:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/setcursor":798,"../../lib/svg_text_utils":802,"../../plot_api/plot_template":816,"../../plots/cartesian/axes":827,"../../plots/plots":890,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"../fx":683,"./draw_arrow_head":633,"d3":169}],633:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87126,6 +87814,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -87245,9 +87938,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -87259,7 +87952,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":615,"./arrow_paths":597,"d3":169}],606:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643,"./arrow_paths":625,"d3":169}],634:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87293,7 +87986,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":809,"./attributes":598,"./calc_autorange":599,"./click":600,"./convert_coords":602,"./defaults":603,"./draw":604}],607:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":839,"./attributes":626,"./calc_autorange":627,"./click":628,"./convert_coords":630,"./defaults":631,"./draw":632}],635:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87391,7 +88084,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../annotations/attributes":598}],608:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../annotations/attributes":626}],636:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87456,7 +88149,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":749,"../../plots/cartesian/axes":797}],609:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827}],637:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87532,7 +88225,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"../annotations/common_defaults":601,"./attributes":607}],610:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"../annotations/common_defaults":629,"./attributes":635}],638:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87584,7 +88277,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":848,"../annotations/draw":604}],611:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":878,"../annotations/draw":632}],639:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87632,7 +88325,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":749,"../../registry":880,"./attributes":607,"./convert":608,"./defaults":609,"./draw":610}],612:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"./attributes":635,"./convert":636,"./defaults":637,"./draw":638}],640:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87665,7 +88358,7 @@ _dereq_('world-calendars/dist/calendars/taiwan'); _dereq_('world-calendars/dist/calendars/thai'); _dereq_('world-calendars/dist/calendars/ummalqura'); -},{"world-calendars/dist/calendars/chinese":579,"world-calendars/dist/calendars/coptic":580,"world-calendars/dist/calendars/discworld":581,"world-calendars/dist/calendars/ethiopian":582,"world-calendars/dist/calendars/hebrew":583,"world-calendars/dist/calendars/islamic":584,"world-calendars/dist/calendars/julian":585,"world-calendars/dist/calendars/mayan":586,"world-calendars/dist/calendars/nanakshahi":587,"world-calendars/dist/calendars/nepali":588,"world-calendars/dist/calendars/persian":589,"world-calendars/dist/calendars/taiwan":590,"world-calendars/dist/calendars/thai":591,"world-calendars/dist/calendars/ummalqura":592,"world-calendars/dist/main":593,"world-calendars/dist/plus":594}],613:[function(_dereq_,module,exports){ +},{"world-calendars/dist/calendars/chinese":607,"world-calendars/dist/calendars/coptic":608,"world-calendars/dist/calendars/discworld":609,"world-calendars/dist/calendars/ethiopian":610,"world-calendars/dist/calendars/hebrew":611,"world-calendars/dist/calendars/islamic":612,"world-calendars/dist/calendars/julian":613,"world-calendars/dist/calendars/mayan":614,"world-calendars/dist/calendars/nanakshahi":615,"world-calendars/dist/calendars/nepali":616,"world-calendars/dist/calendars/persian":617,"world-calendars/dist/calendars/taiwan":618,"world-calendars/dist/calendars/thai":619,"world-calendars/dist/calendars/ummalqura":620,"world-calendars/dist/main":621,"world-calendars/dist/plus":622}],641:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87938,7 +88631,7 @@ module.exports = { worldCalFmt: worldCalFmt }; -},{"../../constants/numerical":724,"../../lib":749,"./calendars":612}],614:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"./calendars":640}],642:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87978,7 +88671,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],615:[function(_dereq_,module,exports){ +},{}],643:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88152,7 +88845,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":614,"fast-isnumeric":241,"tinycolor2":548}],616:[function(_dereq_,module,exports){ +},{"./attributes":642,"fast-isnumeric":241,"tinycolor2":576}],644:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88312,6 +89005,19 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + role: 'info', + description: [ + 'Determines where tick labels are drawn.' + ].join(' ') + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -88328,6 +89034,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -88384,7 +89091,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/cartesian/layout_attributes":811,"../../plots/font_attributes":825}],617:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/cartesian/layout_attributes":841,"../../plots/font_attributes":855}],645:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88412,7 +89119,7 @@ module.exports = { } }; -},{}],618:[function(_dereq_,module,exports){ +},{}],646:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88466,10 +89173,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -88478,7 +89189,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/cartesian/tick_label_defaults":818,"../../plots/cartesian/tick_mark_defaults":819,"../../plots/cartesian/tick_value_defaults":820,"./attributes":616}],619:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/cartesian/tick_label_defaults":848,"../../plots/cartesian/tick_mark_defaults":849,"../../plots/cartesian/tick_value_defaults":850,"./attributes":644}],647:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88497,6 +89208,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -88751,10 +89463,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -88866,18 +89578,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -88941,20 +89654,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -88964,7 +89676,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -89009,7 +89725,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -89065,7 +89781,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -89160,10 +89876,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -89205,7 +89923,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":717,"../../lib":749,"../../lib/extend":739,"../../lib/setcursor":769,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_defaults":799,"../../plots/cartesian/layout_attributes":811,"../../plots/cartesian/position_defaults":814,"../../plots/plots":860,"../../registry":880,"../color":615,"../colorscale/helpers":626,"../dragelement":634,"../drawing":637,"../titles":710,"./constants":617,"d3":169,"tinycolor2":548}],620:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/extend":768,"../../lib/setcursor":798,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_defaults":829,"../../plots/cartesian/layout_attributes":841,"../../plots/cartesian/position_defaults":844,"../../plots/plots":890,"../../registry":910,"../color":643,"../colorscale/helpers":654,"../dragelement":662,"../drawing":665,"../titles":738,"./constants":645,"d3":169,"tinycolor2":576}],648:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89224,7 +89942,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":749}],621:[function(_dereq_,module,exports){ +},{"../../lib":778}],649:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89246,7 +89964,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":616,"./defaults":618,"./draw":619,"./has_colorbar":620}],622:[function(_dereq_,module,exports){ +},{"./attributes":644,"./defaults":646,"./draw":647,"./has_colorbar":648}],650:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89516,7 +90234,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":765,"../colorbar/attributes":616,"./scales.js":630}],623:[function(_dereq_,module,exports){ +},{"../../lib/regex":794,"../colorbar/attributes":644,"./scales.js":658}],651:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89595,7 +90313,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":749,"./helpers":626,"fast-isnumeric":241}],624:[function(_dereq_,module,exports){ +},{"../../lib":778,"./helpers":654,"fast-isnumeric":241}],652:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89672,7 +90390,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":749,"./helpers":626}],625:[function(_dereq_,module,exports){ +},{"../../lib":778,"./helpers":654}],653:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89797,7 +90515,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":749,"../../registry":880,"../colorbar/defaults":618,"../colorbar/has_colorbar":620,"./scales":630,"fast-isnumeric":241}],626:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../colorbar/defaults":646,"../colorbar/has_colorbar":648,"./scales":658,"fast-isnumeric":241}],654:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90037,7 +90755,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":749,"../color":615,"./scales":630,"d3":169,"fast-isnumeric":241,"tinycolor2":548}],627:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643,"./scales":658,"d3":169,"fast-isnumeric":241,"tinycolor2":576}],655:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90079,7 +90797,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":622,"./calc":623,"./cross_trace_defaults":624,"./defaults":625,"./helpers":626,"./layout_attributes":628,"./layout_defaults":629,"./scales":630}],628:[function(_dereq_,module,exports){ +},{"./attributes":650,"./calc":651,"./cross_trace_defaults":652,"./defaults":653,"./helpers":654,"./layout_attributes":656,"./layout_defaults":657,"./scales":658}],656:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90151,7 +90869,7 @@ module.exports = { })) }; -},{"../../lib/extend":739,"./attributes":622,"./scales":630}],629:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"./attributes":650,"./scales":658}],657:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90202,7 +90920,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":749,"../../plot_api/plot_template":787,"./defaults":625,"./layout_attributes":628}],630:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"./defaults":653,"./layout_attributes":656}],658:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90406,7 +91124,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":548}],631:[function(_dereq_,module,exports){ +},{"tinycolor2":576}],659:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90439,7 +91157,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],632:[function(_dereq_,module,exports){ +},{}],660:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90477,7 +91195,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":749}],633:[function(_dereq_,module,exports){ +},{"../../lib":778}],661:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90536,7 +91254,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],634:[function(_dereq_,module,exports){ +},{}],662:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90828,7 +91546,7 @@ function pointerOffset(e) { ); } -},{"../../lib":749,"../../plots/cartesian/constants":803,"./align":631,"./cursor":632,"./unhover":635,"has-hover":414,"has-passive-events":415,"mouse-event-offset":458}],635:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/constants":833,"./align":659,"./cursor":660,"./unhover":663,"has-hover":440,"has-passive-events":441,"mouse-event-offset":484}],663:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90883,7 +91601,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":737,"../../lib/events":738,"../../lib/throttle":774,"../fx/constants":649}],636:[function(_dereq_,module,exports){ +},{"../../lib/dom":766,"../../lib/events":767,"../../lib/throttle":803,"../fx/constants":677}],664:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90912,7 +91630,7 @@ exports.dash = { ].join(' ') }; -},{}],637:[function(_dereq_,module,exports){ +},{}],665:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90932,6 +91650,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -90993,7 +91712,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -91619,7 +92338,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -92010,7 +92729,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -92044,7 +92763,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -92063,7 +92782,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -92094,9 +92813,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -92104,11 +92823,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":651,"../../constants/alignment":717,"../../constants/interactions":723,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../lib/svg_text_utils":773,"../../registry":880,"../../traces/scatter/make_bubble_size_func":1172,"../../traces/scatter/subtypes":1179,"../color":615,"../colorscale":627,"./symbol_defs":638,"d3":169,"fast-isnumeric":241,"tinycolor2":548}],638:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":679,"../../constants/alignment":745,"../../constants/interactions":752,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../lib/svg_text_utils":802,"../../registry":910,"../../traces/scatter/make_bubble_size_func":1203,"../../traces/scatter/subtypes":1211,"../color":643,"../colorscale":655,"./symbol_defs":666,"d3":169,"fast-isnumeric":241,"tinycolor2":576}],666:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92672,7 +93391,7 @@ module.exports = { } }; -},{"d3":169}],639:[function(_dereq_,module,exports){ +},{"d3":169}],667:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92830,7 +93549,7 @@ module.exports = { } }; -},{}],640:[function(_dereq_,module,exports){ +},{}],668:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92916,7 +93635,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"./compute_error":641,"fast-isnumeric":241}],641:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"./compute_error":669,"fast-isnumeric":241}],669:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93017,7 +93736,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],642:[function(_dereq_,module,exports){ +},{}],670:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93092,7 +93811,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../registry":880,"./attributes":639,"fast-isnumeric":241}],643:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../registry":910,"./attributes":667,"fast-isnumeric":241}],671:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93161,7 +93880,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":749,"../../plot_api/edit_types":780,"./attributes":639,"./calc":640,"./compute_error":641,"./defaults":642,"./plot":644,"./style":645}],644:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/edit_types":809,"./attributes":667,"./calc":668,"./compute_error":669,"./defaults":670,"./plot":672,"./style":673}],672:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93333,7 +94052,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":1179,"../drawing":637,"d3":169,"fast-isnumeric":241}],645:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":1211,"../drawing":665,"d3":169,"fast-isnumeric":241}],673:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93370,7 +94089,7 @@ module.exports = function style(traces) { }); }; -},{"../color":615,"d3":169}],646:[function(_dereq_,module,exports){ +},{"../color":643,"d3":169}],674:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93406,7 +94125,7 @@ module.exports = { } }; -},{"../../lib/extend":739,"../../plots/font_attributes":825,"./layout_attributes":656}],647:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/font_attributes":855,"./layout_attributes":684}],675:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93465,7 +94184,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":749,"../../registry":880}],648:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],676:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93502,7 +94221,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":880,"./hover":652}],649:[function(_dereq_,module,exports){ +},{"../../registry":910,"./hover":680}],677:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93534,7 +94253,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],650:[function(_dereq_,module,exports){ +},{}],678:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93560,7 +94279,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":749,"./attributes":646,"./hoverlabel_defaults":653}],651:[function(_dereq_,module,exports){ +},{"../../lib":778,"./attributes":674,"./hoverlabel_defaults":681}],679:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93822,7 +94541,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":749}],652:[function(_dereq_,module,exports){ +},{"../../lib":778}],680:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93838,6 +94557,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -94017,7 +94738,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -94161,6 +94884,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -94541,10 +95270,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -94785,7 +95512,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -94893,7 +95620,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -94928,8 +95655,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -94937,7 +95669,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -95037,8 +95769,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -95297,7 +96029,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -95313,7 +96048,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -95322,49 +96058,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -95676,7 +96413,7 @@ function plainText(s, len) { }); } -},{"../../lib":749,"../../lib/events":738,"../../lib/override_cursor":760,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"../legend/defaults":667,"../legend/draw":668,"./constants":649,"./helpers":651,"d3":169,"fast-isnumeric":241,"tinycolor2":548}],653:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/events":767,"../../lib/override_cursor":789,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"../legend/defaults":695,"../legend/draw":696,"./constants":677,"./helpers":679,"d3":169,"fast-isnumeric":241,"tinycolor2":576}],681:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95722,7 +96459,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":749,"../color":615,"./helpers":651}],654:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643,"./helpers":679}],682:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95778,7 +96515,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":749,"./layout_attributes":656}],655:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":684}],683:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95857,7 +96594,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":749,"../dragelement":634,"./attributes":646,"./calc":647,"./click":648,"./constants":649,"./defaults":650,"./helpers":651,"./hover":652,"./layout_attributes":656,"./layout_defaults":657,"./layout_global_defaults":658,"d3":169}],656:[function(_dereq_,module,exports){ +},{"../../lib":778,"../dragelement":662,"./attributes":674,"./calc":675,"./click":676,"./constants":677,"./defaults":678,"./helpers":679,"./hover":680,"./layout_attributes":684,"./layout_defaults":685,"./layout_global_defaults":686,"d3":169}],684:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96042,7 +96779,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":825,"./constants":649}],657:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":855,"./constants":677}],685:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96090,7 +96827,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":749,"./helpers":651,"./hoverlabel_defaults":653,"./hovermode_defaults":654,"./layout_attributes":656}],658:[function(_dereq_,module,exports){ +},{"../../lib":778,"./helpers":679,"./hoverlabel_defaults":681,"./hovermode_defaults":682,"./layout_attributes":684}],686:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96113,7 +96850,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":749,"./hoverlabel_defaults":653,"./layout_attributes":656}],659:[function(_dereq_,module,exports){ +},{"../../lib":778,"./hoverlabel_defaults":681,"./layout_attributes":684}],687:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96545,7 +97282,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":749,"../../lib/regex":765,"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803,"../../plots/domain":824}],660:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/regex":794,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833,"../../plots/domain":854}],688:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96558,6 +97295,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -96605,7 +97343,9 @@ module.exports = templatedArray('image', { 'Sets the image container size horizontally.', 'The image will be sized based on the `position` value.', 'When `xref` is set to `paper`, units are sized relative', - 'to the plot width.' + 'to the plot width.', + 'When `xref` ends with ` domain`, units are sized relative', + 'to the axis width.', ].join(' ') }, @@ -96618,7 +97358,9 @@ module.exports = templatedArray('image', { 'Sets the image container size vertically.', 'The image will be sized based on the `position` value.', 'When `yref` is set to `paper`, units are sized relative', - 'to the plot height.' + 'to the plot height.', + 'When `yref` ends with ` domain`, units are sized relative', + 'to the axis height.' ].join(' ') }, @@ -96698,11 +97440,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw', description: [ 'Sets the images\'s x coordinate axis.', - 'If set to a x axis id (e.g. *x* or *x2*), the `x` position', - 'refers to an x data coordinate', - 'If set to *paper*, the `x` position refers to the distance from', - 'the left of plot in normalized coordinates', - 'where *0* (*1*) corresponds to the left (right).' + axisPlaceableObjs.axisRefDescription('x', 'left', 'right'), ].join(' ') }, @@ -96717,17 +97455,13 @@ module.exports = templatedArray('image', { editType: 'arraydraw', description: [ 'Sets the images\'s y coordinate axis.', - 'If set to a y axis id (e.g. *y* or *y2*), the `y` position', - 'refers to a y data coordinate.', - 'If set to *paper*, the `y` position refers to the distance from', - 'the bottom of the plot in normalized coordinates', - 'where *0* (*1*) corresponds to the bottom (top).' + axisPlaceableObjs.axisRefDescription('y', 'bottom', 'top'), ].join(' ') }, editType: 'arraydraw' }); -},{"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803}],661:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":746,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833}],689:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96808,7 +97542,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":775,"fast-isnumeric":241}],662:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":804,"fast-isnumeric":241}],690:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96860,7 +97594,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -96873,7 +97607,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"./attributes":660}],663:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"./attributes":688}],691:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96887,6 +97621,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -96903,7 +97638,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -97006,10 +97741,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -97018,8 +97768,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -97043,8 +97810,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -97098,7 +97865,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":725,"../../plots/cartesian/axes":797,"../drawing":637,"d3":169}],664:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":754,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_ids":830,"../drawing":665,"d3":169}],692:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97122,7 +97889,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":809,"./attributes":660,"./convert_coords":661,"./defaults":662,"./draw":663}],665:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":839,"./attributes":688,"./convert_coords":689,"./defaults":690,"./draw":691}],693:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97217,6 +97984,14 @@ module.exports = { 'or remain *constant* independent of the symbol size on the graph.' ].join(' ') }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + role: 'style', + editType: 'legend', + description: 'Sets the width (in px) of the legend item symbols (the part other than the title.text).', + }, itemclick: { valType: 'enumerated', @@ -97354,7 +98129,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":825,"../color/attributes":614}],666:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":855,"../color/attributes":642}],694:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97374,13 +98149,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],667:[function(_dereq_,module,exports){ +},{}],695:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97496,6 +98269,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -97514,7 +98288,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/layout_attributes":851,"../../registry":880,"./attributes":665,"./helpers":671}],668:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/layout_attributes":881,"../../registry":910,"./attributes":693,"./helpers":699}],696:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97606,7 +98380,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -97927,11 +98700,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -97984,11 +98757,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -98058,7 +98834,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -98111,8 +98888,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -98225,7 +99002,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -98308,7 +99085,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":717,"../../lib":749,"../../lib/events":738,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"./constants":666,"./get_legend_data":669,"./handle_click":670,"./helpers":671,"./style":673,"d3":169}],669:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/events":767,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"./constants":694,"./get_legend_data":697,"./handle_click":698,"./helpers":699,"./style":701,"d3":169}],697:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98417,7 +99194,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":880,"./helpers":671}],670:[function(_dereq_,module,exports){ +},{"../../registry":910,"./helpers":699}],698:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98656,7 +99433,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":749,"../../registry":880}],671:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],699:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98680,7 +99457,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],672:[function(_dereq_,module,exports){ +},{}],700:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98704,7 +99481,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":665,"./defaults":667,"./draw":668,"./style":673}],673:[function(_dereq_,module,exports){ +},{"./attributes":693,"./defaults":695,"./draw":696,"./style":701}],701:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98719,6 +99496,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -98727,6 +99505,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -98737,6 +99517,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -98765,7 +99548,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -98868,7 +99651,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -98888,7 +99671,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -98978,7 +99761,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -98990,7 +99773,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -99018,7 +99801,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -99058,7 +99841,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -99082,7 +99865,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -99122,7 +99905,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -99149,7 +99932,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -99185,7 +99968,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -99283,7 +100066,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -99331,7 +100114,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":749,"../../registry":880,"../../traces/pie/helpers":1134,"../../traces/pie/style_one":1140,"../../traces/scatter/subtypes":1179,"../color":615,"../colorscale/helpers":626,"../drawing":637,"d3":169}],674:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../../traces/pie/helpers":1165,"../../traces/pie/style_one":1171,"../../traces/scatter/subtypes":1211,"../color":643,"../colorscale/helpers":654,"../drawing":665,"./constants":694,"d3":169}],702:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100067,7 +100850,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":728,"../../lib":749,"../../plots/cartesian/axis_ids":800,"../../plots/plots":860,"../../registry":880,"../shapes/draw":696}],675:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":757,"../../lib":778,"../../plots/cartesian/axis_ids":830,"../../plots/plots":890,"../../registry":910,"../shapes/draw":724}],703:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100081,7 +100864,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":676}],676:[function(_dereq_,module,exports){ +},{"./manage":704}],704:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100377,7 +101160,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":800,"../../registry":880,"../../traces/scatter/subtypes":1179,"../fx/helpers":651,"./buttons":674,"./modebar":677}],677:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":830,"../../registry":910,"../../traces/scatter/subtypes":1211,"../fx/helpers":679,"./buttons":702,"./modebar":705}],705:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100723,7 +101506,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":728,"../../lib":749,"d3":169,"fast-isnumeric":241}],678:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":757,"../../lib":778,"d3":169,"fast-isnumeric":241}],706:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100891,7 +101674,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":787,"../../plots/font_attributes":825,"../color/attributes":614}],679:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":816,"../../plots/font_attributes":855,"../color/attributes":642}],707:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100920,7 +101703,7 @@ module.exports = { darkAmount: 10 }; -},{}],680:[function(_dereq_,module,exports){ +},{}],708:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101012,7 +101795,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/array_container_defaults":793,"../color":615,"./attributes":678,"./constants":679}],681:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/array_container_defaults":822,"../color":643,"./attributes":706,"./constants":707}],709:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101030,6 +101813,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -101159,8 +101943,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -101211,9 +101994,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -101266,10 +102047,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axis_ids":800,"../../plots/plots":860,"../../registry":880,"../color":615,"../drawing":637,"./constants":679,"./get_update_object":682,"d3":169}],682:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axis_ids":830,"../../plots/plots":890,"../../registry":910,"../color":643,"../drawing":665,"./constants":707,"./get_update_object":710,"d3":169}],710:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101323,7 +102104,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":169}],683:[function(_dereq_,module,exports){ +},{"d3":169}],711:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101350,7 +102131,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":678,"./defaults":680,"./draw":681}],684:[function(_dereq_,module,exports){ +},{"./attributes":706,"./defaults":708,"./draw":709}],712:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101445,7 +102226,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":614}],685:[function(_dereq_,module,exports){ +},{"../color/attributes":642}],713:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101479,7 +102260,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":796,"../../plots/cartesian/axis_ids":800,"./constants":686}],686:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":826,"../../plots/cartesian/axis_ids":830,"./constants":714}],714:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101535,7 +102316,7 @@ module.exports = { extraPad: 15 }; -},{}],687:[function(_dereq_,module,exports){ +},{}],715:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101621,7 +102402,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/cartesian/axis_ids":800,"./attributes":684,"./oppaxis_attributes":691}],688:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/cartesian/axis_ids":830,"./attributes":712,"./oppaxis_attributes":719}],716:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101638,6 +102419,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -101743,7 +102525,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -101856,6 +102638,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -102002,10 +102786,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -102027,7 +102811,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -102243,14 +103027,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -102264,7 +103046,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":749,"../../lib/setcursor":769,"../../plots/cartesian":810,"../../plots/cartesian/axis_ids":800,"../../plots/plots":860,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"../titles":710,"./constants":686,"d3":169}],689:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/setcursor":798,"../../plots/cartesian":840,"../../plots/cartesian/axis_ids":830,"../../plots/plots":890,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"../titles":738,"./constants":714,"d3":169}],717:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102339,7 +103121,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":717,"../../lib/svg_text_utils":773,"../../plots/cartesian/axis_ids":800,"./constants":686}],690:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib/svg_text_utils":802,"../../plots/cartesian/axis_ids":830,"./constants":714}],718:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102378,7 +103160,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":749,"./attributes":684,"./calc_autorange":685,"./defaults":687,"./draw":688,"./helpers":689,"./oppaxis_attributes":691}],691:[function(_dereq_,module,exports){ +},{"../../lib":778,"./attributes":712,"./calc_autorange":713,"./defaults":715,"./draw":716,"./helpers":717,"./oppaxis_attributes":719}],719:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102425,7 +103207,7 @@ module.exports = { editType: 'calc' }; -},{}],692:[function(_dereq_,module,exports){ +},{}],720:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102441,6 +103223,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -102491,11 +103274,7 @@ module.exports = templatedArray('shape', { xref: extendFlat({}, annAttrs.xref, { description: [ 'Sets the shape\'s x coordinate axis.', - 'If set to an x axis id (e.g. *x* or *x2*), the `x` position', - 'refers to an x coordinate.', - 'If set to *paper*, the `x` position refers to the distance from', - 'the left side of the plotting area in normalized coordinates', - 'where *0* (*1*) corresponds to the left (right) side.', + axisPlaceableObjs.axisRefDescription('x', 'left', 'right'), 'If the axis `type` is *log*, then you must take the', 'log of your desired range.', 'If the axis `type` is *date*, then you must convert', @@ -102554,11 +103333,7 @@ module.exports = templatedArray('shape', { yref: extendFlat({}, annAttrs.yref, { description: [ 'Sets the annotation\'s y coordinate axis.', - 'If set to an y axis id (e.g. *y* or *y2*), the `y` position', - 'refers to an y coordinate', - 'If set to *paper*, the `y` position refers to the distance from', - 'the bottom of the plotting area in normalized coordinates', - 'where *0* (*1*) corresponds to the bottom (top).' + axisPlaceableObjs.axisRefDescription('y', 'bottom', 'top'), ].join(' ') }), ysizemode: { @@ -102692,7 +103467,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":739,"../../plot_api/plot_template":787,"../../traces/scatter/attributes":1155,"../annotations/attributes":598,"../drawing/attributes":636}],693:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":746,"../../lib/extend":768,"../../plot_api/plot_template":816,"../../traces/scatter/attributes":1186,"../annotations/attributes":626,"../drawing/attributes":664}],721:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102720,9 +103495,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -102733,7 +103511,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -102809,7 +103587,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":749,"../../plots/cartesian/axes":797,"./constants":694,"./helpers":703}],694:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"./constants":722,"./helpers":731}],722:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102873,7 +103651,7 @@ module.exports = { } }; -},{}],695:[function(_dereq_,module,exports){ +},{}],723:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102939,9 +103717,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -103002,7 +103782,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"./attributes":692,"./helpers":703}],696:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"./attributes":720,"./helpers":731}],724:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103188,7 +103968,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -103214,11 +103997,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -103589,6 +104374,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -103596,15 +104383,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -103761,7 +104556,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":749,"../../lib/setcursor":769,"../../plot_api/plot_template":787,"../../plots/cartesian/axes":797,"../../plots/cartesian/handle_outline":807,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"./constants":694,"./draw_newshape/display_outlines":700,"./draw_newshape/helpers":701,"./helpers":703}],697:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/setcursor":798,"../../plot_api/plot_template":816,"../../plots/cartesian/axes":827,"../../plots/cartesian/handle_outline":837,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"./constants":722,"./draw_newshape/display_outlines":728,"./draw_newshape/helpers":729,"./helpers":731}],725:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103883,7 +104678,7 @@ module.exports = { } }; -},{"../../../lib/extend":739,"../../drawing/attributes":636}],698:[function(_dereq_,module,exports){ +},{"../../../lib/extend":768,"../../drawing/attributes":664}],726:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103907,7 +104702,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],699:[function(_dereq_,module,exports){ +},{}],727:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103939,7 +104734,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":615}],700:[function(_dereq_,module,exports){ +},{"../../color":643}],728:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104234,7 +105029,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":807,"../../../registry":880,"../../dragelement":634,"../../dragelement/helpers":633,"./constants":698,"./helpers":701,"./newshapes":702}],701:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":837,"../../../registry":910,"../../dragelement":662,"../../dragelement/helpers":661,"./constants":726,"./helpers":729,"./newshapes":730}],729:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104572,7 +105367,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":808,"./constants":698,"parse-svg-path":479}],702:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":838,"./constants":726,"parse-svg-path":505}],730:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104831,7 +105626,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":807,"../../../plots/cartesian/helpers":808,"../../dragelement/helpers":633,"./constants":698,"./helpers":701}],703:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":837,"../../../plots/cartesian/helpers":838,"../../dragelement/helpers":661,"./constants":726,"./helpers":729}],731:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104892,18 +105687,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -104913,13 +105714,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -104976,7 +105784,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":749,"./constants":694}],704:[function(_dereq_,module,exports){ +},{"../../lib":778,"./constants":722}],732:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105004,7 +105812,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":809,"./attributes":692,"./calc_autorange":693,"./defaults":695,"./draw":696,"./draw_newshape/defaults":699}],705:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":839,"./attributes":720,"./calc_autorange":721,"./defaults":723,"./draw":724,"./draw_newshape/defaults":727}],733:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105299,7 +106107,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/animation_attributes":792,"../../plots/font_attributes":825,"../../plots/pad_attributes":859,"./constants":706}],706:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/animation_attributes":821,"../../plots/font_attributes":855,"../../plots/pad_attributes":889,"./constants":734}],734:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105393,7 +106201,7 @@ module.exports = { currentValueInset: 0, }; -},{}],707:[function(_dereq_,module,exports){ +},{}],735:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105508,7 +106316,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"./attributes":705,"./constants":706}],708:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"./attributes":733,"./constants":734}],736:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105525,6 +106333,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -105813,11 +106622,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -105868,11 +106676,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -106085,7 +106892,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -106140,7 +106947,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plot_api/plot_template":787,"../../plots/plots":860,"../color":615,"../drawing":637,"./constants":706,"d3":169}],709:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plot_api/plot_template":816,"../../plots/plots":890,"../color":643,"../drawing":665,"./constants":734,"d3":169}],737:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106163,7 +106970,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":705,"./constants":706,"./defaults":707,"./draw":708}],710:[function(_dereq_,module,exports){ +},{"./attributes":733,"./constants":734,"./defaults":735,"./draw":736}],738:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106181,6 +106988,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -106301,7 +107109,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -106379,7 +107187,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -106430,7 +107238,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":717,"../../constants/interactions":723,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../../registry":880,"../color":615,"../drawing":637,"d3":169,"fast-isnumeric":241}],711:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../constants/interactions":752,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../../registry":910,"../color":643,"../drawing":665,"d3":169,"fast-isnumeric":241}],739:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106640,7 +107448,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/font_attributes":825,"../../plots/pad_attributes":859,"../color/attributes":614}],712:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/font_attributes":855,"../../plots/pad_attributes":889,"../color/attributes":642}],740:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106721,7 +107529,7 @@ module.exports = { } }; -},{}],713:[function(_dereq_,module,exports){ +},{}],741:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106804,7 +107612,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"./attributes":711,"./constants":712}],714:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"./attributes":739,"./constants":740}],742:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107002,8 +107810,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -107242,11 +108049,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -107457,9 +108263,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plot_api/plot_template":787,"../../plots/plots":860,"../color":615,"../drawing":637,"./constants":712,"./scrollbox":716,"d3":169}],715:[function(_dereq_,module,exports){ -arguments[4][709][0].apply(exports,arguments) -},{"./attributes":711,"./constants":712,"./defaults":713,"./draw":714,"dup":709}],716:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plot_api/plot_template":816,"../../plots/plots":890,"../color":643,"../drawing":665,"./constants":740,"./scrollbox":744,"d3":169}],743:[function(_dereq_,module,exports){ +arguments[4][737][0].apply(exports,arguments) +},{"./attributes":739,"./constants":740,"./defaults":741,"./draw":742,"dup":737}],744:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107924,7 +108730,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":749,"../color":615,"../drawing":637,"d3":169}],717:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643,"../drawing":665,"d3":169}],745:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107989,7 +108795,39 @@ module.exports = { } }; -},{}],718:[function(_dereq_,module,exports){ +},{}],746:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],747:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108011,7 +108849,7 @@ module.exports = { } }; -},{}],719:[function(_dereq_,module,exports){ +},{}],748:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108027,7 +108865,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],720:[function(_dereq_,module,exports){ +},{}],749:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108065,7 +108903,7 @@ module.exports = { } }; -},{}],721:[function(_dereq_,module,exports){ +},{}],750:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108086,7 +108924,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],722:[function(_dereq_,module,exports){ +},{}],751:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108109,7 +108947,7 @@ module.exports = { x: '❌' }; -},{}],723:[function(_dereq_,module,exports){ +},{}],752:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108132,7 +108970,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],724:[function(_dereq_,module,exports){ +},{}],753:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108205,7 +109043,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],725:[function(_dereq_,module,exports){ +},{}],754:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108229,7 +109067,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],726:[function(_dereq_,module,exports){ +},{}],755:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108315,7 +109153,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":606,"./components/annotations3d":611,"./components/colorbar":621,"./components/colorscale":627,"./components/errorbars":643,"./components/fx":655,"./components/grid":659,"./components/images":664,"./components/legend":672,"./components/rangeselector":683,"./components/rangeslider":690,"./components/shapes":704,"./components/sliders":709,"./components/updatemenus":715,"./fonts/mathjax_config":727,"./fonts/ploticon":728,"./lib/queue":764,"./locale-en":778,"./locale-en-us":777,"./plot_api":782,"./plot_api/plot_schema":786,"./plots/plots":860,"./registry":880,"./snapshot":885,"./traces/scatter":1167,"./version":1337,"d3":169,"es6-promise":224}],727:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":634,"./components/annotations3d":639,"./components/colorbar":649,"./components/colorscale":655,"./components/errorbars":671,"./components/fx":683,"./components/grid":687,"./components/images":692,"./components/legend":700,"./components/rangeselector":711,"./components/rangeslider":718,"./components/shapes":732,"./components/sliders":737,"./components/updatemenus":743,"./fonts/mathjax_config":756,"./fonts/ploticon":757,"./lib/queue":793,"./locale-en":807,"./locale-en-us":806,"./plot_api":811,"./plot_api/plot_schema":815,"./plots/plots":890,"./registry":910,"./snapshot":915,"./traces/scatter":1198,"./version":1369,"d3":169,"es6-promise":224}],756:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108346,7 +109184,7 @@ module.exports = function() { } }; -},{}],728:[function(_dereq_,module,exports){ +},{}],757:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108526,7 +109364,7 @@ module.exports = { } }; -},{}],729:[function(_dereq_,module,exports){ +},{}],758:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108590,7 +109428,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],730:[function(_dereq_,module,exports){ +},{}],759:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108831,7 +109669,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":756}],731:[function(_dereq_,module,exports){ +},{"./mod":785}],760:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108988,7 +109826,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],732:[function(_dereq_,module,exports){ +},{}],761:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109021,7 +109859,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":724,"fast-isnumeric":241}],733:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"fast-isnumeric":241}],762:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109049,7 +109887,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],734:[function(_dereq_,module,exports){ +},{}],763:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109072,7 +109910,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],735:[function(_dereq_,module,exports){ +},{}],764:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109589,7 +110427,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":630,"../constants/interactions":723,"../plots/attributes":794,"./array":731,"./mod":756,"./nested_property":757,"./regex":765,"fast-isnumeric":241,"tinycolor2":548}],736:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":658,"../constants/interactions":752,"../plots/attributes":823,"./array":760,"./mod":785,"./nested_property":786,"./regex":794,"fast-isnumeric":241,"tinycolor2":576}],765:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109637,9 +110475,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -109647,7 +110499,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -110176,7 +111028,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":724,"../registry":880,"./loggers":753,"./mod":756,"d3-time-format":166,"fast-isnumeric":241}],737:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"../registry":910,"./loggers":782,"./mod":785,"d3-time-format":166,"fast-isnumeric":241}],766:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110189,6 +111041,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -110270,16 +111124,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":753,"d3":169}],738:[function(_dereq_,module,exports){ +},{"./loggers":782,"./matrix":784,"d3":169,"gl-mat4":292}],767:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110452,7 +111379,7 @@ var Events = { module.exports = Events; -},{"events":110}],739:[function(_dereq_,module,exports){ +},{"events":110}],768:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110566,7 +111493,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":750}],740:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":779}],769:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110617,7 +111544,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],741:[function(_dereq_,module,exports){ +},{}],770:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110665,7 +111592,7 @@ function isCalcData(cont) { ); } -},{}],742:[function(_dereq_,module,exports){ +},{}],771:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111050,7 +111977,7 @@ module.exports = { computeBbox: computeBbox }; -},{"./identity":747,"./is_plain_object":750,"./loggers":753,"./nested_property":757,"./polygon":761,"@turf/area":59,"@turf/bbox":60,"@turf/centroid":61,"country-regex":139,"d3":169}],743:[function(_dereq_,module,exports){ +},{"./identity":776,"./is_plain_object":779,"./loggers":782,"./nested_property":786,"./polygon":790,"@turf/area":59,"@turf/bbox":60,"@turf/centroid":61,"country-regex":139,"d3":169}],772:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111167,7 +112094,7 @@ exports.makeBlank = function() { }; }; -},{"../constants/numerical":724}],744:[function(_dereq_,module,exports){ +},{"../constants/numerical":753}],773:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111411,7 +112338,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":756}],745:[function(_dereq_,module,exports){ +},{"./mod":785}],774:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111490,14 +112417,11 @@ function formatColor(containerIn, opacityIn, len) { return colorOut; } -function parseColorScale(cont, alpha) { - if(alpha === undefined) alpha = 1; - +function parseColorScale(cont) { var cOpts = Colorscale.extractOpts(cont); - var colorscale = cOpts.reversescale ? - Colorscale.flipScale(cOpts.colorscale) : - cOpts.colorscale; + var colorscale = cOpts.colorscale; + if(cOpts.reversescale) colorscale = Colorscale.flipScale(cOpts.colorscale); return colorscale.map(function(elem) { var index = elem[0]; @@ -111505,7 +112429,7 @@ function parseColorScale(cont, alpha) { var rgb = color.toRgb(); return { index: index, - rgb: [rgb.r, rgb.g, rgb.b, alpha] + rgb: [rgb.r, rgb.g, rgb.b, rgb.a] }; }); } @@ -111515,7 +112439,7 @@ module.exports = { parseColorScale: parseColorScale }; -},{"../components/color/attributes":614,"../components/colorscale":627,"./array":731,"color-normalize":125,"fast-isnumeric":241,"tinycolor2":548}],746:[function(_dereq_,module,exports){ +},{"../components/color/attributes":642,"../components/colorscale":655,"./array":760,"color-normalize":125,"fast-isnumeric":241,"tinycolor2":576}],775:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111551,7 +112475,7 @@ module.exports = { unwrap: function(d) {return d[0];} }; -},{"./identity":747}],747:[function(_dereq_,module,exports){ +},{"./identity":776}],776:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111567,7 +112491,7 @@ module.exports = { module.exports = function identity(d) { return d; }; -},{}],748:[function(_dereq_,module,exports){ +},{}],777:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111609,7 +112533,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],749:[function(_dereq_,module,exports){ +},{}],778:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111700,8 +112624,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -111757,6 +112684,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -112807,6 +113738,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -112833,13 +113776,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -112857,7 +113798,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":724,"./anchor_utils":729,"./angles":730,"./array":731,"./clean_number":732,"./clear_responsive":734,"./coerce":735,"./dates":736,"./dom":737,"./extend":739,"./filter_unique":740,"./filter_visible":741,"./geometry2d":744,"./identity":747,"./increment":748,"./is_plain_object":750,"./keyed_container":751,"./localize":752,"./loggers":753,"./make_trace_groups":754,"./matrix":755,"./mod":756,"./nested_property":757,"./noop":758,"./notifier":759,"./push_unique":763,"./regex":765,"./relative_attr":766,"./relink_private":767,"./search":768,"./stats":771,"./throttle":774,"./to_log_range":775,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],750:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":753,"./anchor_utils":758,"./angles":759,"./array":760,"./clean_number":761,"./clear_responsive":763,"./coerce":764,"./dates":765,"./dom":766,"./extend":768,"./filter_unique":769,"./filter_visible":770,"./geometry2d":773,"./identity":776,"./increment":777,"./is_plain_object":779,"./keyed_container":780,"./localize":781,"./loggers":782,"./make_trace_groups":783,"./matrix":784,"./mod":785,"./nested_property":786,"./noop":787,"./notifier":788,"./push_unique":792,"./regex":794,"./relative_attr":795,"./relink_private":796,"./search":797,"./stats":800,"./throttle":803,"./to_log_range":804,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],779:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112885,7 +113843,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],751:[function(_dereq_,module,exports){ +},{}],780:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113078,7 +114036,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":757}],752:[function(_dereq_,module,exports){ +},{"./nested_property":786}],781:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113134,7 +114092,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":880}],753:[function(_dereq_,module,exports){ +},{"../registry":910}],782:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113244,7 +114202,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":785,"./notifier":759}],754:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":814,"./notifier":788}],783:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113287,7 +114245,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":169}],755:[function(_dereq_,module,exports){ +},{"d3":169}],784:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113299,6 +114257,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -113374,13 +114333,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -113394,7 +114363,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],756:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":292}],785:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113429,7 +114432,7 @@ module.exports = { modHalf: modHalf }; -},{}],757:[function(_dereq_,module,exports){ +},{}],786:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113675,7 +114678,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":731,"fast-isnumeric":241}],758:[function(_dereq_,module,exports){ +},{"./array":760,"fast-isnumeric":241}],787:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113691,7 +114694,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],759:[function(_dereq_,module,exports){ +},{}],788:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113779,7 +114782,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":169,"fast-isnumeric":241}],760:[function(_dereq_,module,exports){ +},{"d3":169,"fast-isnumeric":241}],789:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113827,7 +114830,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":769}],761:[function(_dereq_,module,exports){ +},{"./setcursor":798}],790:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114079,8 +115082,8 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":724,"./matrix":755}],762:[function(_dereq_,module,exports){ -(function (global){ +},{"../constants/numerical":753,"./matrix":784}],791:[function(_dereq_,module,exports){ +(function (global){(function (){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114152,8 +115155,8 @@ module.exports = function prepareRegl(gd, extensions) { return success; }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./show_no_webgl_msg":770,"regl":512}],763:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./show_no_webgl_msg":799,"regl":540}],792:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114191,7 +115194,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],764:[function(_dereq_,module,exports){ +},{}],793:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114399,7 +115402,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":749,"../plot_api/plot_config":785}],765:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/plot_config":814}],794:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114429,7 +115432,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],766:[function(_dereq_,module,exports){ +},{}],795:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114482,7 +115485,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],767:[function(_dereq_,module,exports){ +},{}],796:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114539,7 +115542,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":731,"./is_plain_object":750}],768:[function(_dereq_,module,exports){ +},{"./array":760,"./is_plain_object":779}],797:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114744,7 +115747,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":724,"./identity":747,"./loggers":753,"fast-isnumeric":241}],769:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"./identity":776,"./loggers":782,"fast-isnumeric":241}],798:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114767,7 +115770,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],770:[function(_dereq_,module,exports){ +},{}],799:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114831,7 +115834,7 @@ module.exports = function showNoWebGlMsg(scene) { return false; }; -},{"../components/color":615}],771:[function(_dereq_,module,exports){ +},{"../components/color":643}],800:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114941,7 +115944,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":731,"fast-isnumeric":241}],772:[function(_dereq_,module,exports){ +},{"./array":760,"fast-isnumeric":241}],801:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114962,7 +115965,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"color-normalize":125}],773:[function(_dereq_,module,exports){ +},{"color-normalize":125}],802:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114979,6 +115982,7 @@ module.exports = str2RgbaArray; var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -115093,7 +116097,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -115708,9 +116712,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -115841,7 +116856,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":717,"../constants/xmlns_namespaces":725,"../lib":749,"d3":169}],774:[function(_dereq_,module,exports){ +},{"../constants/alignment":745,"../constants/xmlns_namespaces":754,"../lib":778,"d3":169}],803:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115944,7 +116959,7 @@ function _clearTimeout(cache) { } } -},{}],775:[function(_dereq_,module,exports){ +},{}],804:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115972,7 +116987,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":241}],776:[function(_dereq_,module,exports){ +},{"fast-isnumeric":241}],805:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116006,7 +117021,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":827,"topojson-client":551}],777:[function(_dereq_,module,exports){ +},{"../plots/geo/constants":857,"topojson-client":579}],806:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116028,7 +117043,7 @@ module.exports = { } }; -},{}],778:[function(_dereq_,module,exports){ +},{}],807:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116071,7 +117086,7 @@ module.exports = { } }; -},{}],779:[function(_dereq_,module,exports){ +},{}],808:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116129,7 +117144,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":880}],780:[function(_dereq_,module,exports){ +},{"../registry":910}],809:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116279,7 +117294,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":749}],781:[function(_dereq_,module,exports){ +},{"../lib":778}],810:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116456,6 +117471,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -116500,7 +117525,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -116971,7 +117996,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":615,"../lib":749,"../plots/cartesian/axis_ids":800,"../plots/plots":860,"../registry":880,"fast-isnumeric":241,"gl-mat4/fromQuat":275}],782:[function(_dereq_,module,exports){ +},{"../components/color":643,"../lib":778,"../plots/cartesian/axis_ids":830,"../plots/plots":890,"../registry":910,"fast-isnumeric":241,"gl-mat4/fromQuat":282}],811:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117014,7 +118039,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":882,"./plot_api":784,"./template_api":789,"./to_image":790,"./validate":791}],783:[function(_dereq_,module,exports){ +},{"../snapshot/download":912,"./plot_api":813,"./template_api":818,"./to_image":819,"./validate":820}],812:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117227,7 +118252,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":750,"../lib/loggers":753,"../lib/noop":758,"../lib/search":768,"../registry":880,"./container_array_match":779}],784:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":779,"../lib/loggers":782,"../lib/noop":787,"../lib/search":797,"../registry":910,"./container_array_match":808}],813:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -117597,7 +118622,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -117611,9 +118647,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -119191,6 +120234,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -119285,7 +120334,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -119375,7 +120424,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -119513,21 +120562,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -120938,6 +121985,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -120945,15 +122005,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -120979,6 +122044,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -121112,7 +122178,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":615,"../components/drawing":637,"../constants/xmlns_namespaces":725,"../lib":749,"../lib/events":738,"../lib/queue":764,"../lib/svg_text_utils":773,"../plots/cartesian/axes":797,"../plots/cartesian/constants":803,"../plots/cartesian/graph_interact":806,"../plots/cartesian/select":816,"../plots/plots":860,"../plots/polar/legacy":868,"../registry":880,"./edit_types":780,"./helpers":781,"./manage_arrays":783,"./plot_config":785,"./plot_schema":786,"./subroutines":788,"d3":169,"fast-isnumeric":241,"has-hover":414}],785:[function(_dereq_,module,exports){ +},{"../components/color":643,"../components/drawing":665,"../constants/xmlns_namespaces":754,"../lib":778,"../lib/events":767,"../lib/queue":793,"../lib/svg_text_utils":802,"../plots/cartesian/axes":827,"../plots/cartesian/constants":833,"../plots/cartesian/graph_interact":836,"../plots/cartesian/select":846,"../plots/plots":890,"../plots/polar/legacy":898,"../registry":910,"./edit_types":809,"./helpers":810,"./manage_arrays":812,"./plot_config":814,"./plot_schema":815,"./subroutines":817,"d3":169,"fast-isnumeric":241,"has-hover":440}],814:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121599,7 +122665,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],786:[function(_dereq_,module,exports){ +},{}],815:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -122328,7 +123394,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":749,"../plots/animation_attributes":792,"../plots/attributes":794,"../plots/frame_attributes":826,"../plots/layout_attributes":851,"../plots/polar/legacy/area_attributes":866,"../plots/polar/legacy/axis_attributes":867,"../registry":880,"./edit_types":780,"./plot_config":785}],787:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/animation_attributes":821,"../plots/attributes":823,"../plots/frame_attributes":856,"../plots/layout_attributes":881,"../plots/polar/legacy/area_attributes":896,"../plots/polar/legacy/axis_attributes":897,"../registry":910,"./edit_types":809,"./plot_config":814}],816:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -122656,7 +123722,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":749,"../plots/attributes":794}],788:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/attributes":823}],817:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -122837,7 +123903,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -123326,57 +124392,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - - enforceAxisConstraints(gd); - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -123402,7 +124446,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":615,"../components/drawing":637,"../components/modebar":675,"../components/titles":710,"../constants/alignment":717,"../lib":749,"../lib/clear_gl_canvases":733,"../plots/cartesian/autorange":796,"../plots/cartesian/axes":797,"../plots/cartesian/constraints":804,"../plots/plots":860,"../registry":880,"d3":169}],789:[function(_dereq_,module,exports){ +},{"../components/color":643,"../components/drawing":665,"../components/modebar":703,"../components/titles":738,"../constants/alignment":745,"../lib":778,"../lib/clear_gl_canvases":762,"../plots/cartesian/autorange":826,"../plots/cartesian/axes":827,"../plots/cartesian/constraints":834,"../plots/plots":890,"../registry":910,"d3":169}],818:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -123864,7 +124908,7 @@ function format(opts) { return opts; } -},{"../lib":749,"../plots/attributes":794,"../plots/plots":860,"./plot_config":785,"./plot_schema":786,"./plot_template":787}],790:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/attributes":823,"../plots/plots":890,"./plot_config":814,"./plot_schema":815,"./plot_template":816}],819:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -123983,7 +125027,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -124107,7 +125151,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":749,"../plots/plots":860,"../snapshot/helpers":884,"../snapshot/svgtoimg":886,"../snapshot/tosvg":888,"../version":1337,"./plot_api":784,"fast-isnumeric":241}],791:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/plots":890,"../snapshot/helpers":914,"../snapshot/svgtoimg":916,"../snapshot/tosvg":918,"../version":1369,"./plot_api":813,"fast-isnumeric":241}],820:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -124538,7 +125582,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":749,"../plots/plots":860,"./plot_config":785,"./plot_schema":786}],792:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/plots":890,"./plot_config":814,"./plot_schema":815}],821:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -124675,7 +125719,7 @@ module.exports = { } }; -},{}],793:[function(_dereq_,module,exports){ +},{}],822:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -124770,7 +125814,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":749,"../plot_api/plot_template":787}],794:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/plot_template":816}],823:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -124988,7 +126032,99 @@ module.exports = { } }; -},{"../components/fx/attributes":646}],795:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":674}],824:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],825:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -125029,7 +126165,7 @@ module.exports = { } }; -},{}],796:[function(_dereq_,module,exports){ +},{}],826:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -125046,6 +126182,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -125086,7 +126224,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -125127,19 +126266,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -125147,9 +126273,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -125167,8 +126293,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -125182,7 +126308,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -125203,7 +126329,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -125212,12 +126338,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -125227,13 +126353,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -125245,7 +126399,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -125274,14 +126518,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -125541,7 +126805,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":724,"../../lib":749,"../../registry":880,"fast-isnumeric":241}],797:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../registry":910,"./axis_ids":830,"fast-isnumeric":241}],827:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -125558,6 +126822,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -125591,6 +126856,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -125635,14 +126902,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -125650,6 +126920,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -125674,8 +126959,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -125684,7 +126969,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -125743,7 +127027,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -126065,6 +127351,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -126089,7 +127378,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -126099,6 +127388,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -126112,6 +127405,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -126124,15 +127601,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -126144,85 +127626,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } - - var pos = ax.c2p(tickVal.value); - - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var flip = ax._id.charAt(0) === 'y'; + + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } + + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -126243,180 +127721,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; - - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -126509,7 +127839,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -126526,15 +127857,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -126647,7 +127980,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -127130,6 +128464,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -127402,21 +128737,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -127517,23 +128854,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -127564,13 +128902,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -127591,7 +128929,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -127607,7 +128945,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -127627,7 +128965,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -127659,7 +128997,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -127671,7 +129009,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -127686,7 +129024,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -127942,22 +129280,82 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} + /** * Make axis tick path string * @@ -128003,24 +129401,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -128028,42 +129447,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } + + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } - out.xFn = function(d) { return d.dx + x0; }; + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } + + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -128315,6 +129793,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -128332,22 +129812,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -128415,11 +129939,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -128459,6 +129996,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -128940,7 +130497,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":615,"../../components/drawing":637,"../../components/titles":710,"../../constants/alignment":717,"../../constants/numerical":724,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../../registry":880,"./autorange":796,"./axis_autotype":798,"./axis_ids":800,"./clean_ticks":802,"./layout_attributes":811,"./set_convert":817,"d3":169,"fast-isnumeric":241}],798:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../components/titles":738,"../../constants/alignment":745,"../../constants/numerical":753,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../../registry":910,"./autorange":826,"./axis_autotype":828,"./axis_ids":830,"./clean_ticks":832,"./layout_attributes":841,"./set_convert":847,"d3":169,"fast-isnumeric":241}],828:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -128957,23 +130514,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } + + if(moreDates(a, calendar)) return 'date'; + + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -128986,56 +130569,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":724,"../../lib":749,"fast-isnumeric":241}],799:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],829:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -129092,9 +130685,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -129152,7 +130769,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -129164,8 +130784,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -129318,7 +130936,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":749,"../../registry":880,"../array_container_defaults":793,"./category_order_defaults":801,"./constants":803,"./layout_attributes":811,"./line_grid_defaults":813,"./set_convert":817,"./tick_label_defaults":818,"./tick_mark_defaults":819,"./tick_value_defaults":820,"fast-isnumeric":241}],800:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../array_container_defaults":822,"./category_order_defaults":831,"./constants":833,"./layout_attributes":841,"./line_grid_defaults":843,"./set_convert":847,"./tick_label_defaults":848,"./tick_mark_defaults":849,"./tick_value_defaults":850,"fast-isnumeric":241}],830:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -129339,7 +130957,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -129351,13 +130969,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -129403,6 +131028,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -129435,17 +131062,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":880,"./constants":803}],801:[function(_dereq_,module,exports){ +},{"../../registry":910,"./constants":833}],831:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -129539,7 +131170,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],802:[function(_dereq_,module,exports){ +},{}],832:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -129552,7 +131183,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -129617,7 +131250,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -129627,7 +131262,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":724,"../../lib":749,"fast-isnumeric":241}],803:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],833:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -129642,8 +131277,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -129655,7 +131290,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -129719,7 +131354,7 @@ module.exports = { } }; -},{"../../lib/regex":765}],804:[function(_dereq_,module,exports){ +},{"../../lib/regex":794}],834:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -129731,74 +131366,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; + + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; + + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } + + var canLink = linkableAxes.length; + + var matches, scaleanchor; - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -129809,64 +131650,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; - - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; +} - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -129875,12 +131691,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -129893,38 +131711,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); + } + } + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } } + + out[key] = val; } - thisGroup[scaleanchor] = 1; + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -130033,25 +131922,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -130073,6 +131963,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -130105,7 +132005,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":717,"../../constants/numerical":724,"../../lib":749,"./autorange":796,"./axis_ids":800,"./scale_zoom":815}],805:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../constants/numerical":753,"../../lib":778,"./autorange":826,"./axis_ids":830,"./layout_attributes":841,"./scale_zoom":845,"./set_convert":847}],835:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -130122,6 +132022,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -130198,6 +132099,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -130229,10 +132133,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -130269,6 +132174,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -130434,6 +132342,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -130451,8 +132365,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -130652,6 +132566,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -130661,6 +132577,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -130669,7 +132601,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -130700,15 +132632,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -130717,12 +132651,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -130732,7 +132670,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -130742,9 +132680,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -130944,15 +132897,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -130968,7 +132921,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -131180,7 +133133,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -131193,7 +133146,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -131258,11 +133211,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -131273,14 +133228,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -131290,7 +133253,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -131377,7 +133343,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":615,"../../components/dragelement":634,"../../components/dragelement/helpers":633,"../../components/drawing":637,"../../components/fx":655,"../../constants/alignment":717,"../../lib":749,"../../lib/clear_gl_canvases":733,"../../lib/setcursor":769,"../../lib/svg_text_utils":773,"../../plot_api/subroutines":788,"../../registry":880,"../plots":860,"./axes":797,"./axis_ids":800,"./constants":803,"./scale_zoom":815,"./select":816,"d3":169,"has-passive-events":415,"tinycolor2":548}],806:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement":662,"../../components/dragelement/helpers":661,"../../components/drawing":665,"../../components/fx":683,"../../constants/alignment":745,"../../lib":778,"../../lib/clear_gl_canvases":762,"../../lib/setcursor":798,"../../lib/svg_text_utils":802,"../../plot_api/subroutines":817,"../../registry":910,"../plots":890,"./axes":827,"./axis_ids":830,"./constants":833,"./scale_zoom":845,"./select":846,"d3":169,"has-passive-events":441,"tinycolor2":576}],836:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -131545,7 +133511,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":634,"../../components/fx":655,"../../lib/setcursor":769,"./constants":803,"./dragbox":805,"d3":169}],807:[function(_dereq_,module,exports){ +},{"../../components/dragelement":662,"../../components/fx":683,"../../lib/setcursor":798,"./constants":833,"./dragbox":835,"d3":169}],837:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -131581,7 +133547,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],808:[function(_dereq_,module,exports){ +},{}],838:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -131593,6 +133559,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -131623,9 +133591,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -131635,7 +133604,7 @@ module.exports = { getTransform: getTransform }; -},{}],809:[function(_dereq_,module,exports){ +},{"../../lib":778}],839:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -131649,6 +133618,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -131678,8 +133648,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -131710,7 +133682,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":749,"../../registry":880}],810:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"./axis_ids":830}],840:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -132048,6 +134020,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -132327,7 +134300,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":637,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../registry":880,"../get_data":834,"../plots":860,"./attributes":795,"./axis_ids":800,"./constants":803,"./graph_interact":806,"./layout_attributes":811,"./layout_defaults":812,"./transition_axes":821,"d3":169}],811:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../registry":910,"../get_data":864,"../plots":890,"./attributes":825,"./axis_ids":830,"./constants":833,"./graph_interact":836,"./layout_attributes":841,"./layout_defaults":842,"./transition_axes":851,"d3":169}],841:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -132432,6 +134405,19 @@ module.exports = { 'the axis in question.' ].join(' ') }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + role: 'info', + editType: 'calc', + description: [ + 'Using *strict* a numeric string in trace data is not converted to a number.', + 'Using *convert types* a numeric string in trace data may be', + 'treated as a number during automatic axis `type` detection.', + 'Defaults to layout.autotypenumbers.' + ].join(' ') + }, autorange: { valType: 'enumerated', values: [true, false, 'reversed'], @@ -132540,13 +134526,13 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', role: 'info', editType: 'plot', description: [ 'If this axis needs to be compressed (either due to its own `scaleanchor` and', '`scaleratio` or those of the other axis), determines how that happens:', - 'by increasing the *range* (default), or by decreasing the *domain*.' + 'by increasing the *range*, or by decreasing the *domain*.', + 'Default is *domain* for axes containing image traces, *range* otherwise.' ].join(' ') }, // constraintoward: not used directly, just put here for reference @@ -132822,6 +134808,29 @@ module.exports = { 'between ticks.' ].join(' ') }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + role: 'info', + editType: 'calc', + description: [ + 'Determines where tick labels are drawn with respect to the axis', + 'Please note that', + 'top or bottom has no effect on x axes or when `ticklabelmode` is set to *period*.', + 'Similarly', + 'left or right has no effect on y axes or when `ticklabelmode` is set to *period*.', + 'Has no effect on *multicategory* axes or when `tickson` is set to *boundaries*.' + ].join(' ') + }, mirror: { valType: 'enumerated', values: [true, 'ticks', false, 'all', 'allticks'], @@ -133010,6 +135019,17 @@ module.exports = { 'If *B*, 1B.' ].join(' ') }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + role: 'style', + editType: 'ticks', + description: [ + 'Hide SI prefix for 10^n if |n| is below this number.', + 'This only has an effect when `tickformat` is *SI* or *B*.' + ].join(' ') + }, separatethousands: { valType: 'boolean', dflt: false, @@ -133366,7 +135386,7 @@ module.exports = { } }; -},{"../../components/color/attributes":614,"../../components/drawing/attributes":636,"../../constants/docs":719,"../../constants/numerical":724,"../../lib/extend":739,"../../plot_api/plot_template":787,"../font_attributes":825,"./constants":803}],812:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../components/drawing/attributes":664,"../../constants/docs":748,"../../constants/numerical":753,"../../lib/extend":768,"../../plot_api/plot_template":816,"../font_attributes":855,"./constants":833}],842:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -133388,7 +135408,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -133407,6 +135427,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -133615,6 +135637,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -133679,6 +135702,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -133743,101 +135767,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":615,"../../components/fx/helpers":651,"../../components/fx/hovermode_defaults":654,"../../lib":749,"../../plot_api/plot_template":787,"../../registry":880,"../layout_attributes":851,"./axis_defaults":799,"./axis_ids":800,"./constants":803,"./constraints":804,"./layout_attributes":811,"./position_defaults":814,"./type_defaults":822}],813:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx/helpers":679,"../../components/fx/hovermode_defaults":682,"../../lib":778,"../../plot_api/plot_template":816,"../../registry":910,"../layout_attributes":881,"./axis_defaults":829,"./axis_ids":830,"./constants":833,"./constraints":834,"./layout_attributes":841,"./position_defaults":844,"./type_defaults":852}],843:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -133902,7 +135838,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":614,"../../lib":749,"tinycolor2":548}],814:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib":778,"tinycolor2":576}],844:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -133990,7 +135926,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":749,"fast-isnumeric":241}],815:[function(_dereq_,module,exports){ +},{"../../lib":778,"fast-isnumeric":241}],845:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -134016,9 +135952,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":717}],816:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745}],846:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -134088,6 +136025,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -134177,8 +136122,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -134953,7 +136898,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":615,"../../components/dragelement/helpers":633,"../../components/drawing":637,"../../components/fx":655,"../../components/fx/helpers":651,"../../components/shapes/draw_newshape/display_outlines":700,"../../components/shapes/draw_newshape/helpers":701,"../../components/shapes/draw_newshape/newshapes":702,"../../lib":749,"../../lib/clear_gl_canvases":733,"../../lib/polygon":761,"../../lib/throttle":774,"../../plot_api/subroutines":788,"../../registry":880,"./axis_ids":800,"./constants":803,"./handle_outline":807,"./helpers":808,"polybooljs":491}],817:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement/helpers":661,"../../components/drawing":665,"../../components/fx":683,"../../components/fx/helpers":679,"../../components/shapes/draw_newshape/display_outlines":728,"../../components/shapes/draw_newshape/helpers":729,"../../components/shapes/draw_newshape/newshapes":730,"../../lib":778,"../../lib/clear_gl_canvases":762,"../../lib/polygon":790,"../../lib/throttle":803,"../../plot_api/subroutines":817,"../../registry":910,"./axis_ids":830,"./constants":833,"./handle_outline":837,"./helpers":838,"polybooljs":517}],847:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -134986,7 +136931,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -135142,6 +137086,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -135273,12 +137221,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -135321,17 +137269,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -135835,38 +137778,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -135925,7 +137856,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":724,"../../lib":749,"./axis_ids":800,"./constants":803,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],818:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"./axis_ids":830,"./constants":833,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],848:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -135938,6 +137869,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -135974,10 +137906,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -136000,6 +137936,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -136046,7 +137983,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":749,"../array_container_defaults":793,"./layout_attributes":811}],819:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../array_container_defaults":822,"./layout_attributes":841}],849:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -136079,7 +138016,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":749,"./layout_attributes":811}],820:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":841}],850:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -136126,7 +138063,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":749,"./clean_ticks":802}],821:[function(_dereq_,module,exports){ +},{"../../lib":778,"./clean_ticks":832}],851:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -136339,7 +138276,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":637,"../../lib":749,"../../registry":880,"./axes":797,"d3":169}],822:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../registry":910,"./axes":827,"d3":169}],852:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -136358,6 +138295,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -136410,6 +138348,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -136476,7 +138416,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":880,"./axis_autotype":798}],823:[function(_dereq_,module,exports){ +},{"../../registry":910,"./axis_autotype":828}],853:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -136903,7 +138843,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":749,"../registry":880}],824:[function(_dereq_,module,exports){ +},{"../lib":778,"../registry":910}],854:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -137041,7 +138981,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":739}],825:[function(_dereq_,module,exports){ +},{"../lib/extend":768}],855:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -137117,7 +139057,7 @@ module.exports = function(opts) { return attrs; }; -},{}],826:[function(_dereq_,module,exports){ +},{}],856:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -137179,7 +139119,7 @@ module.exports = { } }; -},{}],827:[function(_dereq_,module,exports){ +},{}],857:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -137354,7 +139294,7 @@ exports.layerNameToAdjective = { frame: 'frame' }; -},{}],828:[function(_dereq_,module,exports){ +},{}],858:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -137371,6 +139311,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Fx = _dereq_('../../components/fx'); @@ -137989,7 +139930,7 @@ proto.render = function() { function translatePoints(d) { var lonlatPx = projection(d.lonlat); return lonlatPx ? - 'translate(' + lonlatPx[0] + ',' + lonlatPx[1] + ')' : + strTranslate(lonlatPx[0], lonlatPx[1]) : null; } @@ -138188,7 +140129,7 @@ function makeRangeBox(lon, lat) { }; } -},{"../../components/color":615,"../../components/dragelement":634,"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/topojson_utils":776,"../../registry":880,"../cartesian/autorange":796,"../cartesian/axes":797,"../cartesian/select":816,"../plots":860,"./constants":827,"./projections":832,"./zoom":833,"d3":169,"topojson-client":551}],829:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement":662,"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/topojson_utils":805,"../../registry":910,"../cartesian/autorange":826,"../cartesian/axes":827,"../cartesian/select":846,"../plots":890,"./constants":857,"./projections":862,"./zoom":863,"d3":169,"topojson-client":579}],859:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138289,7 +140230,7 @@ module.exports = { clean: clean }; -},{"../../lib":749,"../../plots/get_data":834,"./geo":828,"./layout_attributes":830,"./layout_defaults":831}],830:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/get_data":864,"./geo":858,"./layout_attributes":860,"./layout_defaults":861}],860:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138649,7 +140590,7 @@ attrs.uirevision = { ].join(' ') }; -},{"../../components/color/attributes":614,"../../plot_api/edit_types":780,"../domain":824,"./constants":827}],831:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../plot_api/edit_types":809,"../domain":854,"./constants":857}],861:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138877,7 +140818,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) { } } -},{"../../lib":749,"../get_data":834,"../subplot_defaults":874,"./constants":827,"./layout_attributes":830}],832:[function(_dereq_,module,exports){ +},{"../../lib":778,"../get_data":864,"../subplot_defaults":904,"./constants":857,"./layout_attributes":860}],862:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -139323,7 +141264,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],833:[function(_dereq_,module,exports){ +},{}],863:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -139835,7 +141776,7 @@ function d3eventDispatch(target) { return dispatch; } -},{"../../lib":749,"../../registry":880,"d3":169}],834:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"d3":169}],864:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -139964,7 +141905,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":880,"./cartesian/constants":803}],835:[function(_dereq_,module,exports){ +},{"../registry":910,"./cartesian/constants":833}],865:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140259,7 +142200,7 @@ function createCamera(scene) { return result; } -},{"../cartesian/constants":803,"has-passive-events":415,"mouse-change":457,"mouse-event-offset":458,"mouse-wheel":460}],836:[function(_dereq_,module,exports){ +},{"../cartesian/constants":833,"has-passive-events":441,"mouse-change":483,"mouse-event-offset":484,"mouse-wheel":486}],866:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140502,7 +142443,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/str2rgbarray":772,"../cartesian/axes":797}],837:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":801,"../cartesian/axes":827}],867:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140653,7 +142594,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/fx/layout_attributes":656,"../../constants/xmlns_namespaces":725,"../../plot_api/edit_types":780,"../cartesian":810,"../cartesian/attributes":795,"../cartesian/constants":803,"../get_data":834,"../layout_attributes":851,"./scene2d":838}],838:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":684,"../../constants/xmlns_namespaces":754,"../../plot_api/edit_types":809,"../cartesian":840,"../cartesian/attributes":825,"../cartesian/constants":833,"../get_data":864,"../layout_attributes":881,"./scene2d":868}],868:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140801,11 +142742,6 @@ proto.makeFramework = function() { this.updateSize(canvas); - // disabling user select on the canvas - // sanitizes double-clicks interactions - // ref: https://github.com/plotly/plotly.js/issues/744 - canvas.className += ' user-select-none'; - // create SVG container for hover text var svgContainer = this.svgContainer = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -141378,7 +143314,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../components/dragelement/helpers":633,"../../components/fx":655,"../../lib/show_no_webgl_msg":770,"../../plots/cartesian/axes":797,"../../registry":880,"../cartesian/autorange":796,"../cartesian/constants":803,"../cartesian/constraints":804,"./camera":835,"./convert":836,"gl-plot2d":298,"gl-select-box":310,"gl-spikes2d":319,"webgl-context":578}],839:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":661,"../../components/fx":683,"../../lib/show_no_webgl_msg":799,"../../plots/cartesian/axes":827,"../../registry":910,"../cartesian/autorange":826,"../cartesian/constants":833,"../cartesian/constraints":834,"./camera":865,"./convert":866,"gl-plot2d":317,"gl-select-box":333,"gl-spikes2d":342,"webgl-context":606}],869:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -141538,7 +143474,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/fx/layout_attributes":656,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../plot_api/edit_types":780,"../get_data":834,"./layout/attributes":840,"./layout/defaults":844,"./layout/layout_attributes":845,"./scene":849}],840:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":684,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../plot_api/edit_types":809,"../get_data":864,"./layout/attributes":870,"./layout/defaults":874,"./layout/layout_attributes":875,"./scene":879}],870:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -141567,7 +143503,7 @@ module.exports = { } }; -},{}],841:[function(_dereq_,module,exports){ +},{}],871:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -141648,6 +143584,7 @@ module.exports = overrideAll({ type: extendFlat({}, axesAttrs.type, { values: ['-', 'linear', 'log', 'date', 'category'] }), + autotypenumbers: axesAttrs.autotypenumbers, autorange: axesAttrs.autorange, rangemode: axesAttrs.rangemode, range: extendFlat({}, axesAttrs.range, { @@ -141678,6 +143615,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickformat: axesAttrs.tickformat, tickformatstops: axesAttrs.tickformatstops, @@ -141699,7 +143637,7 @@ module.exports = overrideAll({ } }, 'plot', 'from-root'); -},{"../../../components/color":615,"../../../lib/extend":739,"../../../plot_api/edit_types":780,"../../cartesian/layout_attributes":811}],842:[function(_dereq_,module,exports){ +},{"../../../components/color":643,"../../../lib/extend":768,"../../../plot_api/edit_types":809,"../../cartesian/layout_attributes":841}],872:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -141754,6 +143692,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { showGrid: true, noTickson: true, noTicklabelmode: true, + noTicklabelposition: true, bgColor: options.bgColor, calendar: options.calendar }, @@ -141775,7 +143714,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":749,"../../../plot_api/plot_template":787,"../../cartesian/axis_defaults":799,"../../cartesian/type_defaults":822,"./axis_attributes":841,"tinycolor2":548}],843:[function(_dereq_,module,exports){ +},{"../../../lib":778,"../../../plot_api/plot_template":816,"../../cartesian/axis_defaults":829,"../../cartesian/type_defaults":852,"./axis_attributes":871,"tinycolor2":576}],873:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -141940,7 +143879,7 @@ function createAxesOptions(fullLayout, sceneLayout) { module.exports = createAxesOptions; -},{"../../../lib":749,"../../../lib/str2rgbarray":772}],844:[function(_dereq_,module,exports){ +},{"../../../lib":778,"../../../lib/str2rgbarray":801}],874:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -141983,6 +143922,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { font: layoutOut.font, fullData: fullData, getDfltFromLayout: getDfltFromLayout, + autotypenumbersDflt: layoutOut.autotypenumbers, paper_bgcolor: layoutOut.paper_bgcolor, calendar: layoutOut.calendar }); @@ -142052,6 +143992,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { data: fullGl3dData, bgColor: bgColorCombined, calendar: opts.calendar, + autotypenumbersDflt: opts.autotypenumbersDflt, fullLayout: opts.fullLayout }); @@ -142088,7 +144029,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":615,"../../../lib":749,"../../../registry":880,"../../get_data":834,"../../subplot_defaults":874,"./axis_defaults":842,"./layout_attributes":845}],845:[function(_dereq_,module,exports){ +},{"../../../components/color":643,"../../../lib":778,"../../../registry":910,"../../get_data":864,"../../subplot_defaults":904,"./axis_defaults":872,"./layout_attributes":875}],875:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142282,7 +144223,7 @@ module.exports = { } }; -},{"../../../lib":749,"../../../lib/extend":739,"../../domain":824,"./axis_attributes":841}],846:[function(_dereq_,module,exports){ +},{"../../../lib":778,"../../../lib/extend":768,"../../domain":854,"./axis_attributes":871}],876:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142334,7 +144275,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":772}],847:[function(_dereq_,module,exports){ +},{"../../../lib/str2rgbarray":801}],877:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142435,7 +144376,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":749,"../../cartesian/axes":797}],848:[function(_dereq_,module,exports){ +},{"../../../lib":778,"../../cartesian/axes":827}],878:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142469,7 +144410,7 @@ function project(camera, v) { module.exports = project; -},{}],849:[function(_dereq_,module,exports){ +},{}],879:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142608,6 +144549,8 @@ proto.prepareOptions = function() { return opts; }; +var firstInit = true; + proto.tryCreatePlot = function() { var scene = this; @@ -142618,7 +144561,7 @@ proto.tryCreatePlot = function() { try { scene.glplot = createPlot(opts); } catch(e) { - if(scene.staticMode) { + if(scene.staticMode || !firstInit) { success = false; } else { // try second time try { @@ -142630,15 +144573,22 @@ proto.tryCreatePlot = function() { 'The device may not be supported by is-mobile module!', 'Inverting preserveDrawingBuffer option in second attempt to create webgl scene.' ].join(' ')); + + // invert is-mobile isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; scene.glplot = createPlot(opts); } catch(e) { + // revert changes to is-mobile + isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; + success = false; } } } + firstInit = false; + return success; }; @@ -142710,43 +144660,45 @@ proto.initializeGLPlot = function() { scene.graphDiv.emit('plotly_relayout', update); }; - scene.glplot.canvas.addEventListener('mouseup', function() { - relayoutCallback(scene); - }); + if(scene.glplot.canvas) { + scene.glplot.canvas.addEventListener('mouseup', function() { + relayoutCallback(scene); + }); - scene.glplot.canvas.addEventListener('wheel', function(e) { - if(gd._context._scrollZoom.gl3d) { - if(scene.camera._ortho) { - var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1; - var o = scene.glplot.getAspectratio(); - scene.glplot.setAspectratio({ - x: s * o.x, - y: s * o.y, - z: s * o.z - }); - } + scene.glplot.canvas.addEventListener('wheel', function(e) { + if(gd._context._scrollZoom.gl3d) { + if(scene.camera._ortho) { + var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1; + var o = scene.glplot.getAspectratio(); + scene.glplot.setAspectratio({ + x: s * o.x, + y: s * o.y, + z: s * o.z + }); + } - relayoutCallback(scene); - } - }, passiveSupported ? {passive: false} : false); + relayoutCallback(scene); + } + }, passiveSupported ? {passive: false} : false); - scene.glplot.canvas.addEventListener('mousemove', function() { - if(scene.fullSceneLayout.dragmode === false) return; - if(scene.camera.mouseListener.buttons === 0) return; + scene.glplot.canvas.addEventListener('mousemove', function() { + if(scene.fullSceneLayout.dragmode === false) return; + if(scene.camera.mouseListener.buttons === 0) return; - var update = makeUpdate(); - scene.graphDiv.emit('plotly_relayouting', update); - }); + var update = makeUpdate(); + scene.graphDiv.emit('plotly_relayouting', update); + }); - if(!scene.staticMode) { - scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { - if(gd && gd.emit) { - gd.emit('plotly_webglcontextlost', { - event: event, - layer: scene.id - }); - } - }, false); + if(!scene.staticMode) { + scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { + if(gd && gd.emit) { + gd.emit('plotly_webglcontextlost', { + event: event, + layer: scene.id + }); + } + }, false); + } } scene.glplot.oncontextloss = function() { @@ -142768,8 +144720,12 @@ proto.render = function() { // update size of svg container var svgContainer = scene.svgContainer; var clientRect = scene.container.getBoundingClientRect(); - var width = clientRect.width; - var height = clientRect.height; + + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var width = clientRect.width * scaleX; + var height = clientRect.height * scaleY; svgContainer.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height); svgContainer.setAttributeNS(null, 'width', width); svgContainer.setAttributeNS(null, 'height', height); @@ -143593,7 +145549,7 @@ proto.make4thDimension = function() { module.exports = Scene; -},{"../../components/fx":655,"../../lib":749,"../../lib/show_no_webgl_msg":770,"../../lib/str2rgbarray":772,"../../plots/cartesian/axes":797,"../../registry":880,"./layout/convert":843,"./layout/spikes":846,"./layout/tick_marks":847,"./project":848,"gl-plot3d":301,"has-passive-events":415,"is-mobile":441,"webgl-context":578}],850:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../lib":778,"../../lib/show_no_webgl_msg":799,"../../lib/str2rgbarray":801,"../../plots/cartesian/axes":827,"../../registry":910,"./layout/convert":873,"./layout/spikes":876,"./layout/tick_marks":877,"./project":878,"gl-plot3d":321,"has-passive-events":441,"is-mobile":467,"webgl-context":606}],880:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -143614,7 +145570,7 @@ module.exports = function zip3(x, y, z, len) { return result; }; -},{}],851:[function(_dereq_,module,exports){ +},{}],881:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -143882,6 +145838,15 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + role: 'info', + editType: 'none', + description: [ + 'Placeholder for exporting automargin-impacting values namely', + '`margin.t`, `margin.b`, `margin.l` and `margin.r` in *full-json* mode.', + ].join(' ') + }, paper_bgcolor: { valType: 'color', role: 'style', @@ -143900,6 +145865,19 @@ module.exports = { 'Sets the background color of the plotting area in-between x and y axes.' ].join(' ') }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + role: 'info', + editType: 'calc', + description: [ + 'Using *strict* a numeric string in trace data is not converted to a number.', + 'Using *convert types* a numeric string in trace data may be', + 'treated as a number during automatic axis `type` detection.', + 'This is the default value; however it could be overridden for individual axes.' + ].join(' ') + }, separators: { valType: 'string', role: 'style', @@ -144108,7 +146086,7 @@ module.exports = { } }; -},{"../components/color/attributes":614,"../components/shapes/draw_newshape/attributes":697,"../lib/extend":739,"./animation_attributes":792,"./font_attributes":825,"./pad_attributes":859}],852:[function(_dereq_,module,exports){ +},{"../components/color/attributes":642,"../components/shapes/draw_newshape/attributes":725,"../lib/extend":768,"./animation_attributes":821,"./font_attributes":855,"./pad_attributes":889}],882:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -144342,7 +146320,7 @@ module.exports = { } }; -},{}],853:[function(_dereq_,module,exports){ +},{}],883:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -144415,7 +146393,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":749}],854:[function(_dereq_,module,exports){ +},{"../../lib":778}],884:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -144429,6 +146407,8 @@ module.exports = function convertTextOpts(textposition, iconSize) { var mapboxgl = _dereq_('mapbox-gl'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strScale = Lib.strScale; var getSubplotCalcData = _dereq_('../../plots/get_data').getSubplotCalcData; var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); var d3 = _dereq_('d3'); @@ -144545,7 +146525,7 @@ exports.toSVG = function(gd) { var hidden = subplotDiv.select('.mapboxgl-ctrl-logo').node().offsetParent === null; if(!hidden) { var logo = fullLayout._glimages.append('g'); - logo.attr('transform', 'translate(' + (size.l + size.w * domain.x[0] + 10) + ', ' + (size.t + size.h * (1 - domain.y[0]) - 31) + ')'); + logo.attr('transform', strTranslate(size.l + size.w * domain.x[0] + 10, size.t + size.h * (1 - domain.y[0]) - 31)); logo.append('path') .attr('d', constants.mapboxLogo.path0) .style({ @@ -144605,7 +146585,7 @@ exports.toSVG = function(gd) { bBox = Drawing.bBox(attributionText.node()); } - attributionText.attr('transform', 'translate(-3, ' + (-bBox.height + 8) + ')'); + attributionText.attr('transform', strTranslate(-3, -bBox.height + 8)); // Draw white rectangle behind text attributionGroup @@ -144623,7 +146603,7 @@ exports.toSVG = function(gd) { if((bBox.width + 6) > maxWidth) scaleRatio = maxWidth / (bBox.width + 6); var offset = [(size.l + size.w * domain.x[1]), (size.t + size.h * (1 - domain.y[0]))]; - attributionGroup.attr('transform', 'translate(' + offset[0] + ',' + offset[1] + ') scale(' + scaleRatio + ')'); + attributionGroup.attr('transform', strTranslate(offset[0], offset[1]) + strScale(scaleRatio)); } }; @@ -144705,7 +146685,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/drawing":637,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/get_data":834,"./constants":852,"./layout_attributes":856,"./layout_defaults":857,"./mapbox":858,"d3":169,"mapbox-gl":447}],855:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/get_data":864,"./constants":882,"./layout_attributes":886,"./layout_defaults":887,"./mapbox":888,"d3":169,"mapbox-gl":473}],885:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -144781,7 +146761,7 @@ proto.needsNewSource = function(opts) { // stay safe and make new source on type changes return ( this.sourceType !== opts.sourcetype || - this.source !== opts.source || + JSON.stringify(this.source) !== JSON.stringify(opts.source) || this.layerType !== opts.type ); }; @@ -144793,11 +146773,23 @@ proto.needsNewLayer = function(opts) { ); }; +proto.lookupBelow = function() { + return this.subplot.belowLookup['layout-' + this.index]; +}; + proto.updateImage = function(opts) { var map = this.subplot.map; map.getSource(this.idSource).updateImage({ url: opts.source, coordinates: opts.coordinates }); + + // Since the `updateImage` control flow doesn't call updateLayer, + // We need to take care of moving the image layer to match the location + // where updateLayer would have placed it. + var _below = this.findFollowingMapboxLayerId(this.lookupBelow()); + if(_below !== null) { + this.subplot.map.moveLayer(this.idLayer, _below); + } }; proto.updateSource = function(opts) { @@ -144815,15 +146807,9 @@ proto.updateSource = function(opts) { map.addSource(this.idSource, sourceOpts); }; -proto.updateLayer = function(opts) { - var subplot = this.subplot; - var convertedOpts = convertOpts(opts); - - var below = this.subplot.belowLookup['layout-' + this.index]; - var _below; - +proto.findFollowingMapboxLayerId = function(below) { if(below === 'traces') { - var mapLayers = subplot.getMapLayers(); + var mapLayers = this.subplot.getMapLayers(); // find id of first plotly trace layer for(var i = 0; i < mapLayers.length; i++) { @@ -144831,13 +146817,19 @@ proto.updateLayer = function(opts) { if(typeof layerId === 'string' && layerId.indexOf(constants.traceLayerPrefix) === 0 ) { - _below = layerId; + below = layerId; break; } } - } else { - _below = below; } + return below; +}; + +proto.updateLayer = function(opts) { + var subplot = this.subplot; + var convertedOpts = convertOpts(opts); + var below = this.lookupBelow(); + var _below = this.findFollowingMapboxLayerId(below); this.removeLayer(); @@ -145002,7 +146994,7 @@ module.exports = function createMapboxLayer(subplot, index, opts) { return mapboxLayer; }; -},{"../../lib":749,"../../lib/svg_text_utils":773,"./constants":852,"./convert_text_opts":853}],856:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/svg_text_utils":802,"./constants":882,"./convert_text_opts":883}],886:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -145356,7 +147348,7 @@ attrs.uirevision = { ].join(' ') }; -},{"../../components/color":615,"../../lib":749,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../traces/scatter/attributes":1155,"../domain":824,"../font_attributes":825,"./constants":852}],857:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../traces/scatter/attributes":1186,"../domain":854,"../font_attributes":855,"./constants":882}],887:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -145464,7 +147456,7 @@ function handleLayerDefaults(layerIn, layerOut) { } } -},{"../../lib":749,"../array_container_defaults":793,"../subplot_defaults":874,"./layout_attributes":856}],858:[function(_dereq_,module,exports){ +},{"../../lib":778,"../array_container_defaults":822,"../subplot_defaults":904,"./layout_attributes":886}],888:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -145917,15 +147909,15 @@ proto.initFx = function(calcData, fullLayout) { map.on('mousemove', function(evt) { var bb = self.div.getBoundingClientRect(); - - // some hackery to get Fx.hover to work - evt.clientX = evt.point.x + bb.left; - evt.clientY = evt.point.y + bb.top; + var xy = [ + evt.originalEvent.offsetX, + evt.originalEvent.offsetY + ]; evt.target.getBoundingClientRect = function() { return bb; }; - self.xaxis.p2c = function() { return evt.lngLat.lng; }; - self.yaxis.p2c = function() { return evt.lngLat.lat; }; + self.xaxis.p2c = function() { return map.unproject(xy).lng; }; + self.yaxis.p2c = function() { return map.unproject(xy).lat; }; gd._fullLayout._rehover = function() { if(gd._fullLayout._hoversubplot === self.id && gd._fullLayout[self.id]) { @@ -146275,7 +148267,7 @@ function convertCenter(center) { module.exports = Mapbox; -},{"../../components/dragelement":634,"../../components/dragelement/helpers":633,"../../components/fx":655,"../../lib":749,"../../lib/geo_location_utils":742,"../../registry":880,"../cartesian/axes":797,"../cartesian/select":816,"./constants":852,"./layers":855,"mapbox-gl":447}],859:[function(_dereq_,module,exports){ +},{"../../components/dragelement":662,"../../components/dragelement/helpers":661,"../../components/fx":683,"../../lib":778,"../../lib/geo_location_utils":771,"../../registry":910,"../cartesian/axes":827,"../cartesian/select":846,"./constants":882,"./layers":885,"mapbox-gl":473}],889:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -146330,7 +148322,7 @@ module.exports = function(opts) { }; }; -},{}],860:[function(_dereq_,module,exports){ +},{}],890:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -147000,7 +148992,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -147809,6 +149801,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -148197,6 +150191,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -148214,6 +150211,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -148233,13 +150234,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -148264,6 +150267,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -148278,8 +150286,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -148311,11 +150317,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -148325,11 +150330,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -148339,6 +150343,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -148365,11 +150381,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -148493,7 +150522,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -149393,6 +151435,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -149403,7 +151448,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -149413,27 +151457,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -149442,18 +151487,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -149476,16 +151517,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -149527,12 +151571,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -149541,13 +151581,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -149669,7 +151710,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":615,"../constants/numerical":724,"../lib":749,"../plot_api/plot_schema":786,"../plot_api/plot_template":787,"../plots/get_data":834,"../registry":880,"./animation_attributes":792,"./attributes":794,"./cartesian/axis_ids":800,"./cartesian/handle_outline":807,"./command":823,"./font_attributes":825,"./frame_attributes":826,"./layout_attributes":851,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],861:[function(_dereq_,module,exports){ +},{"../components/color":643,"../constants/numerical":753,"../lib":778,"../plot_api/plot_schema":815,"../plot_api/plot_template":816,"../plots/get_data":864,"../registry":910,"./animation_attributes":821,"./attributes":823,"./cartesian/axis_ids":830,"./cartesian/handle_outline":837,"./command":853,"./font_attributes":855,"./frame_attributes":856,"./layout_attributes":881,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],891:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -149714,7 +151755,7 @@ module.exports = { OFFEDGE: 20 }; -},{}],862:[function(_dereq_,module,exports){ +},{}],892:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150009,7 +152050,7 @@ module.exports = { pathPolygonAnnulus: pathPolygonAnnulus }; -},{"../../lib":749,"../../lib/polygon":761}],863:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/polygon":790}],893:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150103,7 +152144,7 @@ module.exports = { toSVG: _dereq_('../cartesian').toSVG }; -},{"../../lib":749,"../cartesian":810,"../get_data":834,"./constants":861,"./layout_attributes":864,"./layout_defaults":865,"./polar":872}],864:[function(_dereq_,module,exports){ +},{"../../lib":778,"../cartesian":840,"../get_data":864,"./constants":891,"./layout_attributes":894,"./layout_defaults":895,"./polar":902}],894:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150153,6 +152194,7 @@ var axisTickAttrs = overrideAll({ ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, @@ -150166,6 +152208,7 @@ var radialAxisAttrs = { type: extendFlat({}, axesAttrs.type, { values: ['-', 'linear', 'log', 'date', 'category'] }), + autotypenumbers: axesAttrs.autotypenumbers, autorange: extendFlat({}, axesAttrs.autorange, {editType: 'plot'}), rangemode: { @@ -150284,6 +152327,7 @@ var angularAxisAttrs = { 'If *category, use `period` to set the number of integer coordinates around polar axis.' ].join(' ') }, + autotypenumbers: axesAttrs.autotypenumbers, categoryorder: axesAttrs.categoryorder, categoryarray: axesAttrs.categoryarray, @@ -150451,7 +152495,7 @@ module.exports = { editType: 'calc' }; -},{"../../components/color/attributes":614,"../../lib":749,"../../plot_api/edit_types":780,"../cartesian/layout_attributes":811,"../domain":824}],865:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib":778,"../../plot_api/edit_types":809,"../cartesian/layout_attributes":841,"../domain":854}],895:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150511,7 +152555,7 @@ function handleDefaults(contIn, contOut, coerce, opts) { axOut._traceIndices = subplotData.map(function(t) { return t._expandedIndex; }); var dataAttr = constants.axisName2dataArray[axName]; - var axType = handleAxisTypeDefaults(axIn, axOut, coerceAxis, subplotData, dataAttr); + var axType = handleAxisTypeDefaults(axIn, axOut, coerceAxis, subplotData, dataAttr, opts); handleCategoryOrderDefaults(axIn, axOut, coerceAxis, { axData: subplotData, @@ -150641,7 +152685,8 @@ function handleDefaults(contIn, contOut, coerce, opts) { } } -function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr) { +function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr, options) { + var autotypenumbers = coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type'); if(axType === '-') { @@ -150655,7 +152700,10 @@ function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr) { } if(trace && trace[dataAttr]) { - axOut.type = autoType(trace[dataAttr], 'gregorian'); + axOut.type = autoType(trace[dataAttr], 'gregorian', { + noMultiCategory: true, + autotypenumbers: autotypenumbers + }); } if(axOut.type === '-') { @@ -150678,13 +152726,14 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { attributes: layoutAttributes, handleDefaults: handleDefaults, font: layoutOut.font, + autotypenumbersDflt: layoutOut.autotypenumbers, paper_bgcolor: layoutOut.paper_bgcolor, fullData: fullData, layoutOut: layoutOut }); }; -},{"../../components/color":615,"../../lib":749,"../../plot_api/plot_template":787,"../cartesian/axis_autotype":798,"../cartesian/category_order_defaults":801,"../cartesian/line_grid_defaults":813,"../cartesian/tick_label_defaults":818,"../cartesian/tick_mark_defaults":819,"../cartesian/tick_value_defaults":820,"../get_data":834,"../subplot_defaults":874,"./constants":861,"./layout_attributes":864,"./set_convert":873}],866:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plot_api/plot_template":816,"../cartesian/axis_autotype":828,"../cartesian/category_order_defaults":831,"../cartesian/line_grid_defaults":843,"../cartesian/tick_label_defaults":848,"../cartesian/tick_mark_defaults":849,"../cartesian/tick_value_defaults":850,"../get_data":864,"../subplot_defaults":904,"./constants":891,"./layout_attributes":894,"./set_convert":903}],896:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150748,7 +152797,7 @@ module.exports = { } }; -},{"../../../lib/extend":739,"../../../traces/scatter/attributes":1155}],867:[function(_dereq_,module,exports){ +},{"../../../lib/extend":768,"../../../traces/scatter/attributes":1186}],897:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150917,7 +152966,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":739,"../../../plot_api/edit_types":780,"../../cartesian/layout_attributes":811}],868:[function(_dereq_,module,exports){ +},{"../../../lib/extend":768,"../../../plot_api/edit_types":809,"../../cartesian/layout_attributes":841}],898:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150932,7 +152981,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":869,"./micropolar_manager":870}],869:[function(_dereq_,module,exports){ +},{"./micropolar":899,"./micropolar_manager":900}],899:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152352,7 +154401,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":717,"../../../lib":749,"d3":169}],870:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":745,"../../../lib":778,"d3":169}],900:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152438,7 +154487,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":615,"../../../lib":749,"./micropolar":869,"./undo_manager":871,"d3":169}],871:[function(_dereq_,module,exports){ +},{"../../../components/color":643,"../../../lib":778,"./micropolar":899,"./undo_manager":901,"d3":169}],901:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152504,7 +154553,7 @@ module.exports = function UndoManager() { }; }; -},{}],872:[function(_dereq_,module,exports){ +},{}],902:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152520,6 +154569,8 @@ var tinycolor = _dereq_('tinycolor2'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Plots = _dereq_('../plots'); @@ -152886,7 +154937,7 @@ proto.updateRadialAxis = function(fullLayout, polarLayout) { // easier to set rotate angle with custom translate function var transFn = function(d) { - return 'translate(' + (ax.l2p(d.x) + innerRadius) + ',0)'; + return strTranslate(ax.l2p(d.x) + innerRadius, 0); }; // set special grid path function @@ -153185,6 +155236,9 @@ proto.updateMainDrag = function(fullLayout) { var chw = constants.cornerHalfWidth; var chl = constants.cornerLen / 2; + var scaleX; + var scaleY; + var mainDrag = dragBox.makeDragger(layers, 'path', 'maindrag', 'crosshair'); d3.select(mainDrag) @@ -153344,8 +155398,12 @@ proto.updateMainDrag = function(fullLayout) { } function zoomMove(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; + var x1 = x0 + dx; var y1 = y0 + dy; + var rr0 = xy2r(x0, y0); var rr1 = Math.min(xy2r(x1, y1), radius); var a0 = xy2a(x0, y0); @@ -153441,8 +155499,13 @@ proto.updateMainDrag = function(fullLayout) { var dragModeNow = gd._fullLayout.dragmode; var bbox = mainDrag.getBoundingClientRect(); - x0 = startX - bbox.left; - y0 = startY - bbox.top; + gd._fullLayout._calcInverseTransform(gd); + var inverse = gd._fullLayout._invTransform; + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + var transformedCoords = Lib.apply3DTransform(inverse)(startX - bbox.left, startY - bbox.top); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; // need to offset x/y as bbox center does not // match origin for asymmetric polygons @@ -153694,8 +155757,8 @@ proto.updateAngularDrag = function(fullLayout) { var fullLayoutNow = _this.gd._fullLayout; var polarLayoutNow = fullLayoutNow[_this.id]; - var x1 = x0 + dx; - var y1 = y0 + dy; + var x1 = x0 + dx * fullLayout._invScaleX; + var y1 = y0 + dy * fullLayout._invScaleY; var a1 = xy2a(x1, y1); var da = rad2deg(a1 - a0); rot1 = rot0 + da; @@ -153788,6 +155851,12 @@ proto.updateAngularDrag = function(fullLayout) { var bbox = angularDrag.getBoundingClientRect(); x0 = startX - bbox.left; y0 = startY - bbox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + a0 = xy2a(x0, y0); dragOpts.moveFn = moveFn; @@ -153927,15 +155996,7 @@ function updateElement(sel, showAttr, attrs) { return sel; } -function strTranslate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - -function strRotate(angle) { - return 'rotate(' + angle + ')'; -} - -},{"../../components/color":615,"../../components/dragelement":634,"../../components/drawing":637,"../../components/fx":655,"../../components/titles":710,"../../constants/alignment":717,"../../lib":749,"../../lib/clear_gl_canvases":733,"../../lib/setcursor":769,"../../plot_api/subroutines":788,"../../plots/cartesian/axes":797,"../../registry":880,"../cartesian/autorange":796,"../cartesian/dragbox":805,"../cartesian/select":816,"../cartesian/set_convert":817,"../plots":860,"./constants":861,"./helpers":862,"./set_convert":873,"d3":169,"tinycolor2":548}],873:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement":662,"../../components/drawing":665,"../../components/fx":683,"../../components/titles":738,"../../constants/alignment":745,"../../lib":778,"../../lib/clear_gl_canvases":762,"../../lib/setcursor":798,"../../plot_api/subroutines":817,"../../plots/cartesian/axes":827,"../../registry":910,"../cartesian/autorange":826,"../cartesian/dragbox":835,"../cartesian/select":846,"../cartesian/set_convert":847,"../plots":890,"./constants":891,"./helpers":892,"./set_convert":903,"d3":169,"tinycolor2":576}],903:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154130,7 +156191,7 @@ function setConvertAngular(ax, polarLayout) { }; } -},{"../../lib":749,"../cartesian/set_convert":817}],874:[function(_dereq_,module,exports){ +},{"../../lib":778,"../cartesian/set_convert":847}],904:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154215,7 +156276,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":749,"../plot_api/plot_template":787,"./domain":824}],875:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/plot_template":816,"./domain":854}],905:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154313,7 +156374,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":719}],876:[function(_dereq_,module,exports){ +},{"../constants/docs":748}],906:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154402,7 +156463,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../lib":749,"../../plots/get_data":834,"./layout_attributes":877,"./layout_defaults":878,"./ternary":879}],877:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/get_data":864,"./layout_attributes":907,"./layout_defaults":908,"./ternary":909}],907:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154445,6 +156506,7 @@ var ternaryAxesAttrs = { ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, @@ -154525,7 +156587,7 @@ attrs.aaxis.uirevision = attrs.baxis.uirevision = attrs.caxis.uirevision = { ].join(' ') }; -},{"../../components/color/attributes":614,"../../lib/extend":739,"../../plot_api/edit_types":780,"../cartesian/layout_attributes":811,"../domain":824}],878:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib/extend":768,"../../plot_api/edit_types":809,"../cartesian/layout_attributes":841,"../domain":854}],908:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154657,7 +156719,7 @@ function handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut coerce('layer'); } -},{"../../components/color":615,"../../lib":749,"../../plot_api/plot_template":787,"../cartesian/line_grid_defaults":813,"../cartesian/tick_label_defaults":818,"../cartesian/tick_mark_defaults":819,"../cartesian/tick_value_defaults":820,"../subplot_defaults":874,"./layout_attributes":877}],879:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plot_api/plot_template":816,"../cartesian/line_grid_defaults":843,"../cartesian/tick_label_defaults":848,"../cartesian/tick_mark_defaults":849,"../cartesian/tick_value_defaults":850,"../subplot_defaults":904,"./layout_attributes":907}],909:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154674,6 +156736,7 @@ var tinycolor = _dereq_('tinycolor2'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var _ = Lib._; var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -154961,7 +157024,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { var triangleClipRelative = 'M0,' + h + 'h' + w + 'l-' + (w / 2) + ',-' + h + 'Z'; _this.clipDefRelative.select('path').attr('d', triangleClipRelative); - var plotTransform = 'translate(' + x0 + ',' + y0 + ')'; + var plotTransform = strTranslate(x0, y0); _this.plotContainer.selectAll('.scatterlayer,.maplayer') .attr('transform', plotTransform); @@ -154970,18 +157033,18 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { // TODO: shift axes to accommodate linewidth*sin(30) tick mark angle // TODO: there's probably an easier way to handle these translations/offsets now... - var bTransform = 'translate(' + (x0 - baxis._offset) + ',' + (y0 + h) + ')'; + var bTransform = strTranslate(x0 - baxis._offset, y0 + h); _this.layers.baxis.attr('transform', bTransform); _this.layers.bgrid.attr('transform', bTransform); - var aTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(30)translate(0,' + -aaxis._offset + ')'; + var aTransform = strTranslate(x0 + w / 2, y0) + + 'rotate(30)' + strTranslate(0, -aaxis._offset); _this.layers.aaxis.attr('transform', aTransform); _this.layers.agrid.attr('transform', aTransform); - var cTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(-30)translate(0,' + -caxis._offset + ')'; + var cTransform = strTranslate(x0 + w / 2, y0) + + 'rotate(-30)' + strTranslate(0, -caxis._offset); _this.layers.caxis.attr('transform', cTransform); _this.layers.cgrid.attr('transform', cTransform); @@ -155087,7 +157150,7 @@ proto.drawAx = function(ax) { var vals = Axes.calcTicks(ax); var valsClipped = Axes.clipEnds(ax, vals); - var transFn = Axes.makeTransFn(ax); + var transFn = Axes.makeTransTickFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; var caRad = Lib.deg2rad(counterAngle); @@ -155162,6 +157225,8 @@ proto.initInteractions = function() { var dragger = _this.layers.plotbg.select('path').node(); var gd = _this.graphDiv; var zoomLayer = gd._fullLayout._zoomlayer; + var scaleX; + var scaleY; // use plotbg for the main interactions this.dragOptions = { @@ -155180,6 +157245,9 @@ proto.initInteractions = function() { _this.dragOptions.xaxes = [_this.xaxis]; _this.dragOptions.yaxes = [_this.yaxis]; + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + var dragModeNow = _this.dragOptions.dragmode = gd._fullLayout.dragmode; if(freeMode(dragModeNow)) _this.dragOptions.minDrag = 1; @@ -155235,6 +157303,13 @@ proto.initInteractions = function() { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var inverse = gd._fullLayout._invTransform; + var transformedCoords = Lib.apply3DTransform(inverse)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + mins0 = { a: _this.aaxis.range[0], b: _this.baxis.range[1], @@ -155248,7 +157323,7 @@ proto.initInteractions = function() { zb = zoomLayer.append('path') .attr('class', 'zoombox') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') + .attr('transform', strTranslate(_this.x0, _this.y0)) .style({ 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 @@ -155257,7 +157332,7 @@ proto.initInteractions = function() { corners = zoomLayer.append('path') .attr('class', 'zoombox-corners') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') + .attr('transform', strTranslate(_this.x0, _this.y0)) .style({ fill: Color.background, stroke: Color.defaultLine, @@ -155274,8 +157349,8 @@ proto.initInteractions = function() { function getCFrac(x, y) { return ((x - (_this.h - y) / Math.sqrt(3)) / _this.w); } function zoomMove(dx0, dy0) { - var x1 = x0 + dx0; - var y1 = y0 + dy0; + var x1 = x0 + dx0 * scaleX; + var y1 = y0 + dy0 * scaleY; var afrac = Math.max(0, Math.min(1, getAFrac(x0, y0), getAFrac(x1, y1))); var bfrac = Math.max(0, Math.min(1, getBFrac(x0, y0), getBFrac(x1, y1))); var cfrac = Math.max(0, Math.min(1, getCFrac(x0, y0), getCFrac(x1, y1))); @@ -155374,11 +157449,11 @@ proto.initInteractions = function() { } // move the data (translate, don't redraw) - var plotTransform = 'translate(' + (_this.x0 + dx) + ',' + (_this.y0 + dy) + ')'; + var plotTransform = strTranslate(_this.x0 + dx, _this.y0 + dy); _this.plotContainer.selectAll('.scatterlayer,.maplayer') .attr('transform', plotTransform); - var plotTransform2 = 'translate(' + -dx + ',' + -dy + ')'; + var plotTransform2 = strTranslate(-dx, -dy); _this.clipDefRelative.select('path').attr('transform', plotTransform2); // move the ticks @@ -155425,7 +157500,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":615,"../../components/dragelement":634,"../../components/dragelement/helpers":633,"../../components/drawing":637,"../../components/fx":655,"../../components/titles":710,"../../lib":749,"../../lib/extend":739,"../../registry":880,"../cartesian/axes":797,"../cartesian/constants":803,"../cartesian/select":816,"../cartesian/set_convert":817,"../plots":860,"d3":169,"tinycolor2":548}],880:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement":662,"../../components/dragelement/helpers":661,"../../components/drawing":665,"../../components/fx":683,"../../components/titles":738,"../../lib":778,"../../lib/extend":768,"../../registry":910,"../cartesian/axes":827,"../cartesian/constants":833,"../cartesian/select":846,"../cartesian/set_convert":847,"../plots":890,"d3":169,"tinycolor2":576}],910:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -155891,7 +157966,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":737,"./lib/extend":739,"./lib/is_plain_object":750,"./lib/loggers":753,"./lib/noop":758,"./lib/push_unique":763,"./plots/attributes":794,"./plots/layout_attributes":851}],881:[function(_dereq_,module,exports){ +},{"./lib/dom":766,"./lib/extend":768,"./lib/is_plain_object":779,"./lib/loggers":782,"./lib/noop":787,"./lib/push_unique":792,"./plots/attributes":823,"./plots/layout_attributes":881}],911:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156064,7 +158139,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":749,"../registry":880}],882:[function(_dereq_,module,exports){ +},{"../lib":778,"../registry":910}],912:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156098,6 +158173,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -156134,7 +158211,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":749,"../plot_api/to_image":790,"./filesaver":883,"./helpers":884}],883:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/to_image":819,"./filesaver":913,"./helpers":914}],913:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156214,7 +158291,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":749,"./helpers":884}],884:[function(_dereq_,module,exports){ +},{"../lib":778,"./helpers":914}],914:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156297,7 +158374,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":880}],885:[function(_dereq_,module,exports){ +},{"../registry":910}],915:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156323,7 +158400,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":881,"./download":882,"./helpers":884,"./svgtoimg":886,"./toimage":887,"./tosvg":888}],886:[function(_dereq_,module,exports){ +},{"./cloneplot":911,"./download":912,"./helpers":914,"./svgtoimg":916,"./toimage":917,"./tosvg":918}],916:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156450,7 +158527,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":749,"./helpers":884,"events":110}],887:[function(_dereq_,module,exports){ +},{"../lib":778,"./helpers":914,"events":110}],917:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156527,7 +158604,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":749,"../registry":880,"./cloneplot":881,"./helpers":884,"./svgtoimg":886,"./tosvg":888,"events":110}],888:[function(_dereq_,module,exports){ +},{"../lib":778,"../registry":910,"./cloneplot":911,"./helpers":914,"./svgtoimg":916,"./tosvg":918,"events":110}],918:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156716,7 +158793,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":615,"../components/drawing":637,"../constants/xmlns_namespaces":725,"../lib":749,"d3":169}],889:[function(_dereq_,module,exports){ +},{"../components/color":643,"../components/drawing":665,"../constants/xmlns_namespaces":754,"../lib":778,"d3":169}],919:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156749,7 +158826,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":749}],890:[function(_dereq_,module,exports){ +},{"../../lib":778}],920:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156811,6 +158888,13 @@ module.exports = { y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, texttemplate: texttemplateAttrs({editType: 'plot'}, { keys: constants.eventDataKeys @@ -157009,7 +159093,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/font_attributes":825,"../../plots/template_attributes":875,"../scatter/attributes":1155,"./constants":892}],891:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/font_attributes":855,"../../plots/template_attributes":905,"../scatter/attributes":1186,"./constants":922}],921:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157021,6 +159105,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; var colorscaleCalc = _dereq_('../../components/colorscale/calc'); var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); @@ -157029,18 +159114,23 @@ var calcSelection = _dereq_('../scatter/calc_selection'); module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; var sizeOpts = { msUTC: !!(trace.base || trace.base === 0) }; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x', sizeOpts); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y', sizeOpts); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -157051,6 +159141,10 @@ module.exports = function calc(gd, trace) { for(var i = 0; i < serieslen; i++) { cd[i] = { p: pos[i], s: size[i] }; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cd[i].id = String(trace.ids[i]); } @@ -157078,7 +159172,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":623,"../../components/colorscale/helpers":626,"../../plots/cartesian/axes":797,"../scatter/calc_selection":1157,"./arrays_to_calcdata":889}],892:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../components/colorscale/helpers":654,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../scatter/calc_selection":1188,"./arrays_to_calcdata":919}],922:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157100,7 +159194,7 @@ module.exports = { eventDataKeys: ['value', 'label'] }; -},{}],893:[function(_dereq_,module,exports){ +},{}],923:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157117,7 +159211,7 @@ var BADNUM = _dereq_('../../constants/numerical').BADNUM; var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var Sieve = _dereq_('./sieve.js'); /* @@ -157880,7 +159974,7 @@ module.exports = { setGroupPositions: setGroupPositions }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_ids":800,"../../registry":880,"./sieve.js":903,"fast-isnumeric":241}],894:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axes":827,"../../plots/cartesian/constraints":834,"../../registry":910,"./sieve.js":933,"fast-isnumeric":241}],924:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157896,8 +159990,9 @@ var Color = _dereq_('../../components/color'); var Registry = _dereq_('../../registry'); var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var attributes = _dereq_('./attributes'); var coerceFont = Lib.coerceFont; @@ -157913,6 +160008,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); coerce('base'); coerce('offset'); @@ -158062,7 +160159,7 @@ module.exports = { handleText: handleText }; -},{"../../components/color":615,"../../lib":749,"../../plots/cartesian/axis_ids":800,"../../registry":880,"../scatter/xy_defaults":1181,"./attributes":890,"./style_defaults":905}],895:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plots/cartesian/constraints":834,"../../registry":910,"../scatter/period_defaults":1206,"../scatter/xy_defaults":1213,"./attributes":920,"./style_defaults":935}],925:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158091,7 +160188,7 @@ module.exports = function eventData(out, pt, trace) { return out; }; -},{}],896:[function(_dereq_,module,exports){ +},{}],926:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158169,7 +160266,7 @@ exports.getLineWidth = function(trace, di) { return w; }; -},{"../../lib":749,"fast-isnumeric":241,"tinycolor2":548}],897:[function(_dereq_,module,exports){ +},{"../../lib":778,"fast-isnumeric":241,"tinycolor2":576}],927:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158330,10 +160427,13 @@ function hoverOnBars(pointData, xval, yval, hovermode) { var extent = t.extents[t.extents.round(di.p)]; pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true); pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true); - pointData[posLetter + 'LabelVal'] = di.p; + + var hasPeriod = di.orig_p !== undefined; + pointData[posLetter + 'LabelVal'] = hasPeriod ? di.orig_p : di.p; pointData.labelLabel = hoverLabelText(pa, pointData[posLetter + 'LabelVal']); pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + 'LabelVal']); + pointData.baseLabel = hoverLabelText(sa, di.b); // spikelines always want "closest" distance regardless of hovermode pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 - maxHoverDistance; @@ -158362,7 +160462,7 @@ module.exports = { getTraceColor: getTraceColor }; -},{"../../components/color":615,"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"./helpers":896}],898:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"./helpers":926}],928:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158405,7 +160505,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../scatter/marker_colorbar":1173,"./arrays_to_calcdata":889,"./attributes":890,"./calc":891,"./cross_trace_calc":893,"./defaults":894,"./event_data":895,"./hover":897,"./layout_attributes":899,"./layout_defaults":900,"./plot":901,"./select":902,"./style":904}],899:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../scatter/marker_colorbar":1204,"./arrays_to_calcdata":919,"./attributes":920,"./calc":921,"./cross_trace_calc":923,"./defaults":924,"./event_data":925,"./hover":927,"./layout_attributes":929,"./layout_defaults":930,"./plot":931,"./select":932,"./style":934}],929:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158474,7 +160574,7 @@ module.exports = { } }; -},{}],900:[function(_dereq_,module,exports){ +},{}],930:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158534,7 +160634,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"./layout_attributes":899}],901:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"./layout_attributes":929}],931:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158779,7 +160879,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback); sel .style('vector-effect', 'non-scaling-stroke') - .attr('d', isNaN((x1 - x0) * (y1 - y0)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') + .attr('d', (isNaN((x1 - x0) * (y1 - y0)) || (isBlank && gd._context.staticPlot)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') .call(Drawing.setClipUrl, plotinfo.layerClipId, gd); if(!fullLayout.uniformtext.mode && withTransition) { @@ -159319,7 +161419,7 @@ module.exports = { toMoveInsideBar: toMoveInsideBar }; -},{"../../components/color":615,"../../components/drawing":637,"../../components/fx/helpers":651,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../registry":880,"./attributes":890,"./constants":892,"./helpers":896,"./style":904,"./uniform_text":906,"d3":169,"fast-isnumeric":241}],902:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../components/fx/helpers":679,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../registry":910,"./attributes":920,"./constants":922,"./helpers":926,"./style":934,"./uniform_text":936,"d3":169,"fast-isnumeric":241}],932:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159383,7 +161483,7 @@ function getCentroid(d, xa, ya, isHorizontal, isFunnel) { } } -},{}],903:[function(_dereq_,module,exports){ +},{}],933:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159497,7 +161597,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":724,"../../lib":749}],904:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778}],934:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159679,7 +161779,7 @@ module.exports = { resizeText: resizeText }; -},{"../../components/color":615,"../../components/drawing":637,"../../lib":749,"../../registry":880,"./attributes":890,"./helpers":896,"./uniform_text":906,"d3":169}],905:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../lib":778,"../../registry":910,"./attributes":920,"./helpers":926,"./uniform_text":936,"d3":169}],935:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159717,7 +161817,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('unselected.marker.color'); }; -},{"../../components/color":615,"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626}],906:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654}],936:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159803,7 +161903,7 @@ module.exports = { resizeText: resizeText }; -},{"../../lib":749,"d3":169}],907:[function(_dereq_,module,exports){ +},{"../../lib":778,"d3":169}],937:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159887,7 +161987,7 @@ module.exports = { // error_y }; -},{"../../lib/extend":739,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatterpolar/attributes":1228}],908:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatterpolar/attributes":1260}],938:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159999,7 +162099,7 @@ module.exports = { crossTraceCalc: crossTraceCalc }; -},{"../../components/colorscale/calc":623,"../../components/colorscale/helpers":626,"../../lib":749,"../../registry":880,"../bar/arrays_to_calcdata":889,"../bar/cross_trace_calc":893,"../scatter/calc_selection":1157}],909:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../components/colorscale/helpers":654,"../../lib":778,"../../registry":910,"../bar/arrays_to_calcdata":919,"../bar/cross_trace_calc":923,"../scatter/calc_selection":1188}],939:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160058,7 +162158,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../bar/style_defaults":905,"../scatterpolar/defaults":1230,"./attributes":907}],910:[function(_dereq_,module,exports){ +},{"../../lib":778,"../bar/style_defaults":935,"../scatterpolar/defaults":1262,"./attributes":937}],940:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160133,7 +162233,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { return [pointData]; }; -},{"../../components/fx":655,"../../lib":749,"../../plots/polar/helpers":862,"../bar/hover":897,"../scatterpolar/hover":1232}],911:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../lib":778,"../../plots/polar/helpers":892,"../bar/hover":927,"../scatterpolar/hover":1264}],941:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160179,7 +162279,7 @@ module.exports = { } }; -},{"../../plots/polar":863,"../bar/select":902,"../bar/style":904,"../scatter/marker_colorbar":1173,"../scatterpolar/format_labels":1231,"./attributes":907,"./calc":908,"./defaults":909,"./hover":910,"./layout_attributes":912,"./layout_defaults":913,"./plot":914}],912:[function(_dereq_,module,exports){ +},{"../../plots/polar":893,"../bar/select":932,"../bar/style":934,"../scatter/marker_colorbar":1204,"../scatterpolar/format_labels":1263,"./attributes":937,"./calc":938,"./defaults":939,"./hover":940,"./layout_attributes":942,"./layout_defaults":943,"./plot":944}],942:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160221,7 +162321,7 @@ module.exports = { } }; -},{}],913:[function(_dereq_,module,exports){ +},{}],943:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160256,7 +162356,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":749,"./layout_attributes":912}],914:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":942}],944:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160364,7 +162464,7 @@ function makePathFn(subplot) { }; } -},{"../../components/drawing":637,"../../lib":749,"../../plots/polar/helpers":862,"d3":169,"fast-isnumeric":241}],915:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../plots/polar/helpers":892,"d3":169,"fast-isnumeric":241}],945:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160443,6 +162543,13 @@ module.exports = { ].join(' ') }, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + name: { valType: 'string', role: 'info', @@ -160813,7 +162920,7 @@ module.exports = { } }; -},{"../../components/color/attributes":614,"../../lib/extend":739,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatter/attributes":1155}],916:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib/extend":768,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatter/attributes":1186}],946:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160827,6 +162934,7 @@ module.exports = { var isNumeric = _dereq_('fast-isnumeric'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -160845,19 +162953,24 @@ module.exports = function calc(gd, trace) { var valAxis, valLetter; var posAxis, posLetter; + var hasPeriod; if(trace.orientation === 'h') { valAxis = xa; valLetter = 'x'; posAxis = ya; posLetter = 'y'; + hasPeriod = !!trace.yperiodalignment; } else { valAxis = ya; valLetter = 'y'; posAxis = xa; posLetter = 'x'; + hasPeriod = !!trace.xperiodalignment; } - var posArray = getPos(trace, posLetter, posAxis, fullLayout[numKey]); + var allPosArrays = getPosArrays(trace, posLetter, posAxis, fullLayout[numKey]); + var posArray = allPosArrays[0]; + var origPos = allPosArrays[1]; var dv = Lib.distinctVals(posArray); var posDistinct = dv.vals; var dPos = dv.minDiff / 2; @@ -160893,6 +163006,9 @@ module.exports = function calc(gd, trace) { cdi = {}; cdi.pos = cdi[posLetter] = posi; + if(hasPeriod && origPos) { + cdi.orig_p = origPos[i]; // used by hover + } cdi.q1 = d2c('q1'); cdi.med = d2c('median'); @@ -161119,13 +163235,15 @@ module.exports = function calc(gd, trace) { // so if you want one box // per trace, set x0 (y0) to the x (y) value or category for this trace // (or set x (y) to a constant array matching y (x)) -function getPos(trace, posLetter, posAxis, num) { +function getPosArrays(trace, posLetter, posAxis, num) { var hasPosArray = posLetter in trace; var hasPos0 = posLetter + '0' in trace; var hasPosStep = 'd' + posLetter in trace; if(hasPosArray || (hasPos0 && hasPosStep)) { - return posAxis.makeCalcdata(trace, posLetter); + var origPos = posAxis.makeCalcdata(trace, posLetter); + var pos = alignPeriod(trace, posAxis, posLetter, origPos); + return [pos, origPos]; } var pos0; @@ -161153,7 +163271,7 @@ function getPos(trace, posLetter, posAxis, num) { var out = new Array(len); for(var i = 0; i < len; i++) out[i] = pos0c; - return out; + return [out]; } function makeBins(x, dx) { @@ -161256,7 +163374,7 @@ function computeNotchSpan(cdi, N) { return 1.57 * (cdi.q3 - cdi.q1) / Math.sqrt(N); } -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"fast-isnumeric":241}],917:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"fast-isnumeric":241}],947:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161269,7 +163387,7 @@ function computeNotchSpan(cdi, N) { var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var orientations = ['v', 'h']; @@ -161488,7 +163606,7 @@ module.exports = { setPositionOffset: setPositionOffset }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_ids":800}],918:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../../plots/cartesian/constraints":834}],948:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161502,6 +163620,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var Registry = _dereq_('../../registry'); var Color = _dereq_('../../components/color'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var autoType = _dereq_('../../plots/cartesian/axis_autotype'); var attributes = _dereq_('./attributes'); @@ -161514,6 +163633,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { handleSampleDefaults(traceIn, traceOut, coerce, layout); if(traceOut.visible === false) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var hasPreCompStats = traceOut._hasPreCompStats; if(hasPreCompStats) { @@ -161597,6 +163718,11 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { var yLen = yDims && Lib.minRowLength(y); var xLen = xDims && Lib.minRowLength(x); + var calendar = layout.calendar; + var opts = { + autotypenumbers: layout.autotypenumbers + }; + var defaultOrientation, len; if(traceOut._hasPreCompStats) { switch(String(xDims) + String(yDims)) { @@ -161648,7 +163774,7 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { var hasCategories = false; var i; for(i = 0; i < x.length; i++) { - if(autoType(x[i]) === 'category') { + if(autoType(x[i], calendar, opts) === 'category') { hasCategories = true; break; } @@ -161659,7 +163785,7 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { len = Math.min(sLen, xLen, y.length); } else { for(i = 0; i < y.length; i++) { - if(autoType(y[i]) === 'category') { + if(autoType(y[i], calendar, opts) === 'category') { hasCategories = true; break; } @@ -161796,7 +163922,7 @@ module.exports = { handlePointsDefaults: handlePointsDefaults }; -},{"../../components/color":615,"../../lib":749,"../../plots/cartesian/axis_autotype":798,"../../registry":880,"../bar/defaults":894,"./attributes":915}],919:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plots/cartesian/axis_autotype":828,"../../registry":910,"../bar/defaults":924,"../scatter/period_defaults":1206,"./attributes":945}],949:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161821,7 +163947,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],920:[function(_dereq_,module,exports){ +},{}],950:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161967,7 +164093,7 @@ function hoverOnBoxes(pointData, xval, yval, hovermode) { pointData[pLetter + '0'] = pAxis.c2p(di.pos + t.bPos - boxDeltaNeg, true); pointData[pLetter + '1'] = pAxis.c2p(di.pos + t.bPos + boxDeltaPos, true); - pointData[pLetter + 'LabelVal'] = di.pos; + pointData[pLetter + 'LabelVal'] = di.orig_p !== undefined ? di.orig_p : di.pos; var spikePosAttr = pLetter + 'Spike'; pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; @@ -162081,14 +164207,16 @@ function hoverOnPoints(pointData, xval, yval) { hovertemplate: trace.hovertemplate }); + var origPos = di.orig_p; + var pos = origPos !== undefined ? origPos : di.pos; var pa; if(trace.orientation === 'h') { pa = ya; closePtData.xLabelVal = pt.x; - closePtData.yLabelVal = di.pos; + closePtData.yLabelVal = pos; } else { pa = xa; - closePtData.xLabelVal = di.pos; + closePtData.xLabelVal = pos; closePtData.yLabelVal = pt.y; } @@ -162106,7 +164234,7 @@ module.exports = { hoverOnPoints: hoverOnPoints }; -},{"../../components/color":615,"../../components/fx":655,"../../lib":749,"../../plots/cartesian/axes":797}],921:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../lib":778,"../../plots/cartesian/axes":827}],951:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162167,7 +164295,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":915,"./calc":916,"./cross_trace_calc":917,"./defaults":918,"./event_data":919,"./hover":920,"./layout_attributes":922,"./layout_defaults":923,"./plot":924,"./select":925,"./style":926}],922:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":945,"./calc":946,"./cross_trace_calc":947,"./defaults":948,"./event_data":949,"./hover":950,"./layout_attributes":952,"./layout_defaults":953,"./plot":954,"./select":955,"./style":956}],952:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162224,7 +164352,7 @@ module.exports = { } }; -},{}],923:[function(_dereq_,module,exports){ +},{}],953:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162270,7 +164398,7 @@ module.exports = { _supply: _supply }; -},{"../../lib":749,"../../registry":880,"./layout_attributes":922}],924:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"./layout_attributes":952}],954:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162620,7 +164748,7 @@ module.exports = { plotBoxMean: plotBoxMean }; -},{"../../components/drawing":637,"../../lib":749,"d3":169}],925:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"d3":169}],955:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162669,7 +164797,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],926:[function(_dereq_,module,exports){ +},{}],956:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162743,7 +164871,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/color":615,"../../components/drawing":637,"d3":169}],927:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"d3":169}],957:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162773,6 +164901,10 @@ function directionAttrs(lineColorDefault) { } module.exports = { + xperiod: OHLCattrs.xperiod, + xperiod0: OHLCattrs.xperiod0, + xperiodalignment: OHLCattrs.xperiodalignment, + x: OHLCattrs.x, open: OHLCattrs.open, high: OHLCattrs.high, @@ -162802,7 +164934,7 @@ module.exports = { hoverlabel: OHLCattrs.hoverlabel, }; -},{"../../lib":749,"../box/attributes":915,"../ohlc/attributes":1101}],928:[function(_dereq_,module,exports){ +},{"../../lib":778,"../box/attributes":945,"../ohlc/attributes":1132}],958:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162815,6 +164947,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var calcCommon = _dereq_('../ohlc/calc').calcCommon; @@ -162823,9 +164956,10 @@ module.exports = function(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis); var ya = Axes.getFromId(gd, trace.yaxis); - var x = xa.makeCalcdata(trace, 'x'); + var origX = xa.makeCalcdata(trace, 'x'); + var x = alignPeriod(trace, xa, 'x', origX); - var cd = calcCommon(gd, trace, x, ya, ptFunc); + var cd = calcCommon(gd, trace, origX, x, ya, ptFunc); if(cd.length) { Lib.extendFlat(cd[0].t, { @@ -162852,7 +164986,7 @@ function ptFunc(o, h, l, c) { }; } -},{"../../lib":749,"../../plots/cartesian/axes":797,"../ohlc/calc":1102}],929:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../ohlc/calc":1133}],959:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162867,6 +165001,7 @@ function ptFunc(o, h, l, c) { var Lib = _dereq_('../../lib'); var Color = _dereq_('../../components/color'); var handleOHLC = _dereq_('../ohlc/ohlc_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -162880,6 +165015,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce, {x: true}); + coerce('line.width'); handleDirection(traceIn, traceOut, coerce, 'increasing'); @@ -162898,7 +165035,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor', Color.addOpacity(lineColor, 0.5)); } -},{"../../components/color":615,"../../lib":749,"../ohlc/ohlc_defaults":1106,"./attributes":927}],930:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../ohlc/ohlc_defaults":1137,"../scatter/period_defaults":1206,"./attributes":957}],960:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162943,7 +165080,7 @@ module.exports = { selectPoints: _dereq_('../ohlc/select') }; -},{"../../plots/cartesian":810,"../box/cross_trace_calc":917,"../box/layout_attributes":922,"../box/layout_defaults":923,"../box/plot":924,"../box/style":926,"../ohlc/hover":1104,"../ohlc/select":1108,"./attributes":927,"./calc":928,"./defaults":929}],931:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../box/cross_trace_calc":947,"../box/layout_attributes":952,"../box/layout_defaults":953,"../box/plot":954,"../box/style":956,"../ohlc/hover":1135,"../ohlc/select":1139,"./attributes":957,"./calc":958,"./defaults":959}],961:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162993,6 +165130,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) { calendar: traceOut.calendar, dfltColor: dfltColor, bgColor: fullLayout.paper_bgcolor, + autotypenumbersDflt: fullLayout.autotypenumbers, fullLayout: fullLayout }; @@ -163007,7 +165145,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) { }); } -},{"../../plot_api/plot_template":787,"./axis_defaults":936}],932:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":816,"./axis_defaults":966}],962:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163054,7 +165192,7 @@ function minMax(a, depth) { return [min, max]; } -},{"../../lib":749}],933:[function(_dereq_,module,exports){ +},{"../../lib":778}],963:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163187,7 +165325,7 @@ module.exports = { transforms: undefined }; -},{"../../components/color/attributes":614,"../../plots/font_attributes":825,"./axis_attributes":935}],934:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../plots/font_attributes":855,"./axis_attributes":965}],964:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163294,7 +165432,7 @@ module.exports = function(carpet, carpetcd, a, b) { return segments; }; -},{"../../lib":749}],935:[function(_dereq_,module,exports){ +},{"../../lib":778}],965:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163385,6 +165523,7 @@ module.exports = { 'the axis in question.' ].join(' ') }, + autotypenumbers: axesAttrs.autotypenumbers, autorange: { valType: 'enumerated', values: [true, false, 'reversed'], @@ -163581,6 +165720,16 @@ module.exports = { 'If *B*, 1B.' ].join(' ') }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + role: 'style', + editType: 'calc', + description: [ + 'Hide SI prefix for 10^n if |n| is below this number' + ].join(' ') + }, separatethousands: { valType: 'boolean', dflt: false, @@ -163836,7 +165985,7 @@ module.exports = { editType: 'calc' }; -},{"../../components/color/attributes":614,"../../constants/docs":719,"../../plot_api/edit_types":780,"../../plots/cartesian/layout_attributes":811,"../../plots/font_attributes":825}],936:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../constants/docs":748,"../../plot_api/edit_types":809,"../../plots/cartesian/layout_attributes":841,"../../plots/font_attributes":855}],966:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163890,6 +166039,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) } // now figure out type and do some more initialization + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type'); if(axType === '-') { if(options.data) setAutoType(containerOut, options.data); @@ -163917,6 +166067,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) coerce('separatethousands'); coerce('tickformat'); coerce('exponentformat'); + coerce('minexponent'); coerce('showexponent'); coerce('categoryorder'); @@ -164025,6 +166176,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) delete containerOut.tickangle; delete containerOut.showexponent; delete containerOut.exponentformat; + delete containerOut.minexponent; delete containerOut.tickformat; delete containerOut.showticksuffix; delete containerOut.showtickprefix; @@ -164056,10 +166208,12 @@ function setAutoType(ax, data) { var calAttr = axLetter + 'calendar'; var calendar = ax[calAttr]; - ax.type = autoType(data, calendar); + ax.type = autoType(data, calendar, { + autotypenumbers: ax.autotypenumbers + }); } -},{"../../components/color":615,"../../lib":749,"../../plots/cartesian/axis_autotype":798,"../../plots/cartesian/category_order_defaults":801,"../../plots/cartesian/set_convert":817,"../../plots/cartesian/tick_label_defaults":818,"../../plots/cartesian/tick_value_defaults":820,"../../registry":880,"./attributes":933}],937:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plots/cartesian/axis_autotype":828,"../../plots/cartesian/category_order_defaults":831,"../../plots/cartesian/set_convert":847,"../../plots/cartesian/tick_label_defaults":848,"../../plots/cartesian/tick_value_defaults":850,"../../registry":910,"./attributes":963}],967:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164169,7 +166323,7 @@ module.exports = function calc(gd, trace) { return [t]; }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../heatmap/clean_2d_array":1036,"../heatmap/convert_column_xyz":1038,"./array_minmax":932,"./calc_clippath":938,"./calc_gridlines":939,"./calc_labels":940,"./cheater_basis":942,"./set_convert":955,"./smooth_fill_2d_array":956}],938:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../heatmap/clean_2d_array":1066,"../heatmap/convert_column_xyz":1068,"./array_minmax":962,"./calc_clippath":968,"./calc_gridlines":969,"./calc_labels":970,"./cheater_basis":972,"./set_convert":985,"./smooth_fill_2d_array":986}],968:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164221,7 +166375,7 @@ module.exports = function makeClipPath(xctrl, yctrl, aax, bax) { return segments; }; -},{}],939:[function(_dereq_,module,exports){ +},{}],969:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164564,7 +166718,7 @@ module.exports = function calcGridlines(trace, axisLetter, crossAxisLetter) { } }; -},{"../../lib/extend":739,"../../plots/cartesian/axes":797}],940:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/cartesian/axes":827}],970:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164625,7 +166779,7 @@ module.exports = function calcLabels(trace, axis) { } }; -},{"../../lib/extend":739,"../../plots/cartesian/axes":797}],941:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/cartesian/axes":827}],971:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164668,7 +166822,7 @@ module.exports = function makeControlPoints(p0, p1, p2, smoothness) { ]]; }; -},{}],942:[function(_dereq_,module,exports){ +},{}],972:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164736,7 +166890,7 @@ module.exports = function(a, b, cheaterslope) { return data; }; -},{"../../lib":749}],943:[function(_dereq_,module,exports){ +},{"../../lib":778}],973:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165088,7 +167242,7 @@ module.exports = function computeControlPoints(xe, ye, x, y, asmoothing, bsmooth return [xe, ye]; }; -},{"../../lib":749,"./catmull_rom":941}],944:[function(_dereq_,module,exports){ +},{"../../lib":778,"./catmull_rom":971}],974:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165104,7 +167258,7 @@ module.exports = { RELATIVE_CULL_TOLERANCE: 1e-6 }; -},{}],945:[function(_dereq_,module,exports){ +},{}],975:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165256,7 +167410,7 @@ module.exports = function(arrays, asmoothing, bsmoothing) { } }; -},{}],946:[function(_dereq_,module,exports){ +},{}],976:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165383,7 +167537,7 @@ module.exports = function(arrays, asmoothing, bsmoothing) { } }; -},{}],947:[function(_dereq_,module,exports){ +},{}],977:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165533,7 +167687,7 @@ module.exports = function(arrays, na, nb, asmoothing, bsmoothing) { } }; -},{}],948:[function(_dereq_,module,exports){ +},{}],978:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165592,7 +167746,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, dfltColor, fullLayou } }; -},{"../../components/color/attributes":614,"../../lib":749,"./ab_defaults":931,"./attributes":933,"./xy_defaults":957}],949:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib":778,"./ab_defaults":961,"./attributes":963,"./xy_defaults":987}],979:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165628,7 +167782,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":933,"./calc":937,"./defaults":948,"./plot":954}],950:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":963,"./calc":967,"./defaults":978,"./plot":984}],980:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165664,7 +167818,7 @@ module.exports = function(gd, trace) { return firstAxis; }; -},{}],951:[function(_dereq_,module,exports){ +},{}],981:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165696,7 +167850,7 @@ module.exports = function makePath(xp, yp, isBicubic) { return path.join(isBicubic ? '' : 'L'); }; -},{}],952:[function(_dereq_,module,exports){ +},{}],982:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165733,7 +167887,7 @@ module.exports = function mapArray(out, data, func) { return out; }; -},{"../../lib":749}],953:[function(_dereq_,module,exports){ +},{"../../lib":778}],983:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165775,7 +167929,7 @@ module.exports = function orientText(trace, xaxis, yaxis, xy, dxy, refDxy) { }; }; -},{}],954:[function(_dereq_,module,exports){ +},{}],984:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165794,6 +167948,8 @@ var makepath = _dereq_('./makepath'); var orientText = _dereq_('./orient_text'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Lib = _dereq_('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var alignmentConstants = _dereq_('../../constants/alignment'); module.exports = function plot(gd, plotinfo, cdcarpet, carpetLayer) { @@ -165932,11 +168088,11 @@ function drawAxisLabels(gd, xaxis, yaxis, trace, t, layer, labels, labelClass) { labelEl.attr('transform', // Translate to the correct point: - 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + + strTranslate(orientation.p[0], orientation.p[1]) + // Rotate to line up with grid line tangent: - 'rotate(' + orientation.angle + ')' + + strRotate(orientation.angle) + // Adjust the baseline and indentation: - 'translate(' + label.axis.labelpadding * direction + ',' + bbox.height * 0.3 + ')' + strTranslate(label.axis.labelpadding * direction, bbox.height * 0.3) ); maxExtent = Math.max(maxExtent, bbox.width + label.axis.labelpadding); @@ -166013,11 +168169,10 @@ function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientat } el.attr('transform', - 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + - 'rotate(' + orientation.angle + ') ' + - 'translate(0,' + offset + ')' + strTranslate(orientation.p[0], orientation.p[1]) + + strRotate(orientation.angle) + + strTranslate(0, offset) ) - .classed('user-select-none', true) .attr('text-anchor', 'middle') .call(Drawing.font, axis.title.font); }); @@ -166025,7 +168180,7 @@ function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientat titleJoin.exit().remove(); } -},{"../../components/drawing":637,"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"./makepath":951,"./map_1d_array":952,"./orient_text":953,"d3":169}],955:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"./makepath":981,"./map_1d_array":982,"./orient_text":983,"d3":169}],985:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166308,7 +168463,7 @@ module.exports = function setConvert(trace) { }; }; -},{"../../lib/search":768,"./compute_control_points":943,"./constants":944,"./create_i_derivative_evaluator":945,"./create_j_derivative_evaluator":946,"./create_spline_evaluator":947}],956:[function(_dereq_,module,exports){ +},{"../../lib/search":797,"./compute_control_points":973,"./constants":974,"./create_i_derivative_evaluator":975,"./create_j_derivative_evaluator":976,"./create_spline_evaluator":977}],986:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166530,7 +168685,7 @@ module.exports = function smoothFill2dArray(data, a, b) { return data; }; -},{"../../lib":749}],957:[function(_dereq_,module,exports){ +},{"../../lib":778}],987:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166564,7 +168719,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return true; }; -},{"../../lib":749}],958:[function(_dereq_,module,exports){ +},{"../../lib":778}],988:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166669,7 +168824,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/color/attributes":614,"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scattergeo/attributes":1196}],959:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scattergeo/attributes":1228}],989:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166730,7 +168885,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/calc":623,"../../constants/numerical":724,"../scatter/arrays_to_calcdata":1154,"../scatter/calc_selection":1157,"fast-isnumeric":241}],960:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../constants/numerical":753,"../scatter/arrays_to_calcdata":1185,"../scatter/calc_selection":1188,"fast-isnumeric":241}],990:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166786,7 +168941,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":958}],961:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":988}],991:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166811,7 +168966,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],962:[function(_dereq_,module,exports){ +},{}],992:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166833,17 +168988,20 @@ module.exports = function hoverPoints(pointData, xval, yval) { var pt, i, j, isInside; + var xy = [xval, yval]; + var altXy = [xval + 360, yval]; + for(i = 0; i < cd.length; i++) { pt = cd[i]; isInside = false; if(pt._polygons) { for(j = 0; j < pt._polygons.length; j++) { - if(pt._polygons[j].contains([xval, yval])) { + if(pt._polygons[j].contains(xy)) { isInside = !isInside; } // for polygons that cross antimeridian as xval is in [-180, 180] - if(pt._polygons[j].contains([xval + 360, yval])) { + if(pt._polygons[j].contains(altXy)) { isInside = !isInside; } } @@ -166863,7 +169021,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { pointData.zLabel = Axes.tickText(geo.mockAxis, geo.mockAxis.c2l(pt.z), 'hover').text; pointData.hovertemplate = pt.hovertemplate; - makeHoverInfo(pointData, trace, pt, geo.mockAxis); + makeHoverInfo(pointData, trace, pt); return [pointData]; }; @@ -166903,7 +169061,7 @@ function makeHoverInfo(pointData, trace, pt) { pointData.extraText = text.join('
'); } -},{"../../lib":749,"../../plots/cartesian/axes":797,"./attributes":958}],963:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"./attributes":988}],993:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166941,7 +169099,7 @@ module.exports = { } }; -},{"../../plots/geo":829,"../heatmap/colorbar":1037,"./attributes":958,"./calc":959,"./defaults":960,"./event_data":961,"./hover":962,"./plot":964,"./select":965,"./style":966}],964:[function(_dereq_,module,exports){ +},{"../../plots/geo":859,"../heatmap/colorbar":1067,"./attributes":988,"./calc":989,"./defaults":990,"./event_data":991,"./hover":992,"./plot":994,"./select":995,"./style":996}],994:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167029,7 +169187,7 @@ module.exports = { plot: plot }; -},{"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/topojson_utils":776,"../../plots/cartesian/autorange":796,"./style":966,"d3":169}],965:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/topojson_utils":805,"../../plots/cartesian/autorange":826,"./style":996,"d3":169}],995:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167078,7 +169236,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],966:[function(_dereq_,module,exports){ +},{}],996:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167134,7 +169292,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/color":615,"../../components/colorscale":627,"../../components/drawing":637,"d3":169}],967:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale":655,"../../components/drawing":665,"d3":169}],997:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167256,7 +169414,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../choropleth/attributes":958}],968:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../choropleth/attributes":988}],998:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167412,7 +169570,7 @@ module.exports = { convertOnSelect: convertOnSelect }; -},{"../../components/colorscale":627,"../../components/drawing":637,"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/geojson_utils":743,"fast-isnumeric":241}],969:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/drawing":665,"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/geojson_utils":772,"fast-isnumeric":241}],999:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167463,7 +169621,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":967}],970:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":997}],1000:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167529,7 +169687,7 @@ module.exports = { } }; -},{"../../plots/mapbox":854,"../choropleth/calc":959,"../choropleth/event_data":961,"../choropleth/hover":962,"../choropleth/select":965,"../heatmap/colorbar":1037,"./attributes":967,"./defaults":969,"./plot":971}],971:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":884,"../choropleth/calc":989,"../choropleth/event_data":991,"../choropleth/hover":992,"../choropleth/select":995,"../heatmap/colorbar":1067,"./attributes":997,"./defaults":999,"./plot":1001}],1001:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167656,7 +169814,7 @@ module.exports = function createChoroplethMapbox(subplot, calcTrace) { return choroplethMapbox; }; -},{"../../plots/mapbox/constants":852,"./convert":968}],972:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":882,"./convert":998}],1002:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167852,7 +170010,7 @@ attrs.transforms = undefined; module.exports = attrs; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../mesh3d/attributes":1096}],973:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../mesh3d/attributes":1127}],1003:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167896,7 +170054,7 @@ module.exports = function calc(gd, trace) { }); }; -},{"../../components/colorscale/calc":623}],974:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651}],1004:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168043,7 +170201,7 @@ function createConeTrace(scene, data) { module.exports = createConeTrace; -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gl_format_color":745,"../../plots/gl3d/zip3":850,"gl-cone3d":259}],975:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gl_format_color":774,"../../plots/gl3d/zip3":880,"gl-cone3d":260}],1005:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168105,7 +170263,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":972}],976:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":1002}],1006:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168148,7 +170306,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":972,"./calc":973,"./convert":974,"./defaults":975}],977:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1002,"./calc":1003,"./convert":1004,"./defaults":1005}],1007:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168182,6 +170340,14 @@ module.exports = extendFlat({ y: heatmapAttrs.y, y0: heatmapAttrs.y0, dy: heatmapAttrs.dy, + + xperiod: heatmapAttrs.xperiod, + yperiod: heatmapAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: heatmapAttrs.xperiodalignment, + yperiodalignment: heatmapAttrs.yperiodalignment, + text: heatmapAttrs.text, hovertext: heatmapAttrs.hovertext, transpose: heatmapAttrs.transpose, @@ -168427,7 +170593,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../components/drawing/attributes":636,"../../constants/docs":719,"../../constants/filter_ops":720,"../../lib/extend":739,"../../plots/font_attributes":825,"../heatmap/attributes":1034,"../scatter/attributes":1155}],978:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../components/drawing/attributes":664,"../../constants/docs":748,"../../constants/filter_ops":749,"../../lib/extend":768,"../../plots/font_attributes":855,"../heatmap/attributes":1064,"../scatter/attributes":1186}],1008:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168480,7 +170646,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale":627,"../heatmap/calc":1035,"./end_plus":988,"./set_contours":996}],979:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../heatmap/calc":1065,"./end_plus":1018,"./set_contours":1026}],1009:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168570,7 +170736,7 @@ module.exports = function(pathinfo, contours) { } }; -},{}],980:[function(_dereq_,module,exports){ +},{}],1010:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168621,7 +170787,7 @@ module.exports = { calc: calc }; -},{"../../components/colorscale":627,"./end_plus":988,"./make_color_map":993}],981:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"./end_plus":1018,"./make_color_map":1023}],1011:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168699,7 +170865,7 @@ module.exports = { } }; -},{}],982:[function(_dereq_,module,exports){ +},{}],1012:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168793,7 +170959,7 @@ function handleConstraintValueDefaults(coerce, contours) { } } -},{"../../components/color":615,"../../constants/filter_ops":720,"./label_defaults":992,"fast-isnumeric":241}],983:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../constants/filter_ops":749,"./label_defaults":1022,"fast-isnumeric":241}],1013:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168872,7 +171038,7 @@ function makeInequalitySettings(operation) { }; } -},{"../../constants/filter_ops":720,"fast-isnumeric":241}],984:[function(_dereq_,module,exports){ +},{"../../constants/filter_ops":749,"fast-isnumeric":241}],1014:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168901,7 +171067,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce, coerc if(autoContour || !contourSize) coerce('ncontours'); }; -},{}],985:[function(_dereq_,module,exports){ +},{}],1015:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169001,7 +171167,7 @@ function copyPathinfo(pi) { }); } -},{"../../lib":749}],986:[function(_dereq_,module,exports){ +},{"../../lib":778}],1016:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169015,6 +171181,7 @@ function copyPathinfo(pi) { var Lib = _dereq_('../../lib'); var handleXYZDefaults = _dereq_('../heatmap/xyz_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleConstraintDefaults = _dereq_('./constraint_defaults'); var handleContoursDefaults = _dereq_('./contours_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); @@ -169036,6 +171203,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); @@ -169052,7 +171221,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../lib":749,"../heatmap/xyz_defaults":1048,"./attributes":977,"./constraint_defaults":982,"./contours_defaults":984,"./style_defaults":998}],987:[function(_dereq_,module,exports){ +},{"../../lib":778,"../heatmap/xyz_defaults":1078,"../scatter/period_defaults":1206,"./attributes":1007,"./constraint_defaults":1012,"./contours_defaults":1014,"./style_defaults":1028}],1017:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169116,7 +171285,7 @@ module.exports = function emptyPathinfo(contours, plotinfo, cd0) { return pathinfo; }; -},{"../../lib":749,"./constraint_mapping":983,"./end_plus":988}],988:[function(_dereq_,module,exports){ +},{"../../lib":778,"./constraint_mapping":1013,"./end_plus":1018}],1018:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169136,7 +171305,7 @@ module.exports = function endPlus(contours) { return contours.end + contours.size / 1e6; }; -},{}],989:[function(_dereq_,module,exports){ +},{}],1019:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169430,7 +171599,7 @@ function getInterpPx(pi, loc, step) { } } -},{"../../lib":749,"./constants":981}],990:[function(_dereq_,module,exports){ +},{"../../lib":778,"./constants":1011}],1020:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169465,7 +171634,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return hoverData; }; -},{"../../components/color":615,"../heatmap/hover":1041}],991:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../heatmap/hover":1071}],1021:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169503,7 +171672,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":977,"./calc":978,"./colorbar":980,"./defaults":986,"./hover":990,"./plot":995,"./style":997}],992:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":1007,"./calc":1008,"./colorbar":1010,"./defaults":1016,"./hover":1020,"./plot":1025,"./style":1027}],1022:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169533,7 +171702,7 @@ module.exports = function handleLabelDefaults(coerce, layout, lineColor, opts) { if(opts.hasHover !== false) coerce('zhoverformat'); }; -},{"../../lib":749}],993:[function(_dereq_,module,exports){ +},{"../../lib":778}],1023:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169617,7 +171786,7 @@ module.exports = function makeColorMap(trace) { ); }; -},{"../../components/colorscale":627,"./end_plus":988,"d3":169}],994:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"./end_plus":1018,"d3":169}],1024:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169709,7 +171878,7 @@ function getMarchingIndex(val, corners) { return (mi === 15) ? 0 : mi; } -},{"./constants":981}],995:[function(_dereq_,module,exports){ +},{"./constants":1011}],1025:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170400,7 +172569,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/colorscale":627,"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../plots/cartesian/set_convert":817,"../heatmap/plot":1045,"./close_boundaries":979,"./constants":981,"./convert_to_constraints":985,"./empty_pathinfo":987,"./find_all_paths":989,"./make_crossings":994,"d3":169}],996:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../plots/cartesian/set_convert":847,"../heatmap/plot":1075,"./close_boundaries":1009,"./constants":1011,"./convert_to_constraints":1015,"./empty_pathinfo":1017,"./find_all_paths":1019,"./make_crossings":1024,"d3":169}],1026:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170504,7 +172673,7 @@ function autoContours(start, end, ncontours) { return dummyAx; } -},{"../../lib":749,"../../plots/cartesian/axes":797}],997:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827}],1027:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170585,7 +172754,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":637,"../heatmap/style":1046,"./make_color_map":993,"d3":169}],998:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../heatmap/style":1076,"./make_color_map":1023,"d3":169}],1028:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170630,7 +172799,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, handleLabelDefaults(coerce, layout, lineColor, opts); }; -},{"../../components/colorscale/defaults":625,"./label_defaults":992}],999:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"./label_defaults":1022}],1029:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170722,7 +172891,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../contour/attributes":977,"../heatmap/attributes":1034}],1000:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../contour/attributes":1007,"../heatmap/attributes":1064}],1030:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170834,7 +173003,7 @@ function heatmappishCalc(gd, trace) { return [cd0]; } -},{"../../components/colorscale/calc":623,"../../lib":749,"../carpet/lookup_carpetid":950,"../contour/set_contours":996,"../heatmap/clean_2d_array":1036,"../heatmap/convert_column_xyz":1038,"../heatmap/find_empties":1040,"../heatmap/interp2d":1043,"../heatmap/make_bound_array":1044,"./defaults":1001}],1001:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../lib":778,"../carpet/lookup_carpetid":980,"../contour/set_contours":1026,"../heatmap/clean_2d_array":1066,"../heatmap/convert_column_xyz":1068,"../heatmap/find_empties":1070,"../heatmap/interp2d":1073,"../heatmap/make_bound_array":1074,"./defaults":1031}],1031:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170903,7 +173072,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../lib":749,"../contour/constraint_defaults":982,"../contour/contours_defaults":984,"../contour/style_defaults":998,"../heatmap/xyz_defaults":1048,"./attributes":999}],1002:[function(_dereq_,module,exports){ +},{"../../lib":778,"../contour/constraint_defaults":1012,"../contour/contours_defaults":1014,"../contour/style_defaults":1028,"../heatmap/xyz_defaults":1078,"./attributes":1029}],1032:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170937,7 +173106,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../contour/colorbar":980,"../contour/style":997,"./attributes":999,"./calc":1000,"./defaults":1001,"./plot":1003}],1003:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../contour/colorbar":1010,"../contour/style":1027,"./attributes":1029,"./calc":1030,"./defaults":1031,"./plot":1033}],1033:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171418,7 +173587,7 @@ function joinAllPaths(trace, pi, perimeter, ab2p, carpet, carpetcd, xa, ya) { return fullpath; } -},{"../../components/drawing":637,"../../lib":749,"../carpet/axis_aligned_line":934,"../carpet/lookup_carpetid":950,"../carpet/makepath":951,"../carpet/map_1d_array":952,"../contour/close_boundaries":979,"../contour/constants":981,"../contour/convert_to_constraints":985,"../contour/empty_pathinfo":987,"../contour/find_all_paths":989,"../contour/make_crossings":994,"../contour/plot":995,"d3":169}],1004:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../carpet/axis_aligned_line":964,"../carpet/lookup_carpetid":980,"../carpet/makepath":981,"../carpet/map_1d_array":982,"../contour/close_boundaries":1009,"../contour/constants":1011,"../contour/convert_to_constraints":1015,"../contour/empty_pathinfo":1017,"../contour/find_all_paths":1019,"../contour/make_crossings":1024,"../contour/plot":1025,"d3":169}],1034:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171514,7 +173683,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scattermapbox/attributes":1219}],1005:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scattermapbox/attributes":1251}],1035:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171573,7 +173742,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/calc":623,"../../constants/numerical":724,"../../lib":749,"fast-isnumeric":241}],1006:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],1036:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171689,7 +173858,7 @@ module.exports = function convert(calcTrace) { return opts; }; -},{"../../components/color":615,"../../components/colorscale":627,"../../constants/numerical":724,"../../lib":749,"../../lib/geojson_utils":743,"fast-isnumeric":241}],1007:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale":655,"../../constants/numerical":753,"../../lib":778,"../../lib/geojson_utils":772,"fast-isnumeric":241}],1037:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171731,7 +173900,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":1004}],1008:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":1034}],1038:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171749,7 +173918,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1009:[function(_dereq_,module,exports){ +},{}],1039:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171817,7 +173986,7 @@ function getExtraText(trace, di, labels) { return text.join('
'); } -},{"../../lib":749,"../../plots/cartesian/axes":797,"../scattermapbox/hover":1224}],1010:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../scattermapbox/hover":1256}],1040:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171867,7 +174036,7 @@ module.exports = { } }; -},{"../../plots/mapbox":854,"../heatmap/colorbar":1037,"../scattermapbox/format_labels":1223,"./attributes":1004,"./calc":1005,"./defaults":1007,"./event_data":1008,"./hover":1009,"./plot":1011}],1011:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":884,"../heatmap/colorbar":1067,"../scattermapbox/format_labels":1255,"./attributes":1034,"./calc":1035,"./defaults":1037,"./event_data":1038,"./hover":1039,"./plot":1041}],1041:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171981,7 +174150,7 @@ module.exports = function createDensityMapbox(subplot, calcTrace) { return densityMapbox; }; -},{"../../plots/mapbox/constants":852,"./convert":1006}],1012:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":882,"./convert":1036}],1042:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172014,7 +174183,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":749}],1013:[function(_dereq_,module,exports){ +},{"../../lib":778}],1043:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172042,6 +174211,13 @@ module.exports = { y0: barAttrs.y0, dy: barAttrs.dy, + xperiod: barAttrs.xperiod, + yperiod: barAttrs.yperiod, + xperiod0: barAttrs.xperiod0, + yperiod0: barAttrs.yperiod0, + xperiodalignment: barAttrs.xperiodalignment, + yperiodalignment: barAttrs.yperiodalignment, + hovertext: barAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys @@ -172130,7 +174306,7 @@ module.exports = { alignmentgroup: barAttrs.alignmentgroup }; -},{"../../components/color":615,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatter/attributes":1155,"./constants":1015}],1014:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatter/attributes":1186,"./constants":1045}],1044:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172142,6 +174318,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); var calcSelection = _dereq_('../scatter/calc_selection'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -172149,14 +174326,19 @@ var BADNUM = _dereq_('../../constants/numerical').BADNUM; module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos, i, cdi; + var size, pos, origPos, i, cdi; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -172188,6 +174370,10 @@ module.exports = function calc(gd, trace) { trace._base[i] = -0.5 * cdi.s; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cdi.id = String(trace.ids[i]); } @@ -172224,7 +174410,7 @@ function fixNum(a) { return (a === BADNUM) ? 0 : a; } -},{"../../constants/numerical":724,"../../plots/cartesian/axes":797,"../scatter/calc_selection":1157,"./arrays_to_calcdata":1012}],1015:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../scatter/calc_selection":1188,"./arrays_to_calcdata":1042}],1045:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172243,7 +174429,7 @@ module.exports = { ] }; -},{}],1016:[function(_dereq_,module,exports){ +},{}],1046:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172314,7 +174500,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../bar/cross_trace_calc":893}],1017:[function(_dereq_,module,exports){ +},{"../bar/cross_trace_calc":923}],1047:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172330,6 +174516,7 @@ var Lib = _dereq_('../../lib'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var handleText = _dereq_('../bar/defaults').handleText; var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); var Color = _dereq_('../../components/color'); @@ -172344,6 +174531,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.y && !traceOut.x) ? 'v' : 'h'); coerce('offset'); coerce('width'); @@ -172411,7 +174600,7 @@ module.exports = { crossTraceDefaults: crossTraceDefaults }; -},{"../../components/color":615,"../../lib":749,"../bar/defaults":894,"../scatter/xy_defaults":1181,"./attributes":1013}],1018:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../bar/defaults":924,"../scatter/period_defaults":1206,"../scatter/xy_defaults":1213,"./attributes":1043}],1048:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172438,7 +174627,7 @@ module.exports = function eventData(out, pt /* , trace, cd, pointNumber */) { return out; }; -},{}],1019:[function(_dereq_,module,exports){ +},{}],1049:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172511,7 +174700,7 @@ function getTraceColor(trace, di) { else if(opacity(mlc) && mlw) return mlc; } -},{"../../components/color":615,"../../lib":749,"../bar/hover":897}],1020:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../bar/hover":927}],1050:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172552,7 +174741,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../bar/select":902,"./attributes":1013,"./calc":1014,"./cross_trace_calc":1016,"./defaults":1017,"./event_data":1018,"./hover":1019,"./layout_attributes":1021,"./layout_defaults":1022,"./plot":1023,"./style":1024}],1021:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../bar/select":932,"./attributes":1043,"./calc":1044,"./cross_trace_calc":1046,"./defaults":1047,"./event_data":1048,"./hover":1049,"./layout_attributes":1051,"./layout_defaults":1052,"./plot":1053,"./style":1054}],1051:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172605,7 +174794,7 @@ module.exports = { } }; -},{}],1022:[function(_dereq_,module,exports){ +},{}],1052:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172642,7 +174831,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":749,"./layout_attributes":1021}],1023:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1051}],1053:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172811,7 +175000,7 @@ function getXY(di, xa, ya, isHorizontal) { return isHorizontal ? [s, p] : [p, s]; } -},{"../../components/drawing":637,"../../constants/numerical":724,"../../lib":749,"../bar/plot":901,"../bar/uniform_text":906,"d3":169}],1024:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/numerical":753,"../../lib":778,"../bar/plot":931,"../bar/uniform_text":936,"d3":169}],1054:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172876,7 +175065,7 @@ module.exports = { style: style }; -},{"../../components/color":615,"../../components/drawing":637,"../../constants/interactions":723,"../bar/style":904,"../bar/uniform_text":906,"d3":169}],1025:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../constants/interactions":752,"../bar/style":934,"../bar/uniform_text":936,"d3":169}],1055:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172989,7 +175178,7 @@ module.exports = { } }; -},{"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/template_attributes":875,"../pie/attributes":1129}],1026:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/template_attributes":905,"../pie/attributes":1160}],1056:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173012,7 +175201,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1027:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1057:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173038,7 +175227,7 @@ module.exports = { crossTraceCalc: crossTraceCalc }; -},{"../pie/calc":1131}],1028:[function(_dereq_,module,exports){ +},{"../pie/calc":1162}],1058:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173120,7 +175309,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('baseratio'); }; -},{"../../lib":749,"../../plots/domain":824,"../bar/defaults":894,"../pie/defaults":1132,"./attributes":1025}],1029:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/domain":854,"../bar/defaults":924,"../pie/defaults":1163,"./attributes":1055}],1059:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173159,7 +175348,7 @@ module.exports = { } }; -},{"../pie/style_one":1140,"./attributes":1025,"./base_plot":1026,"./calc":1027,"./defaults":1028,"./layout_attributes":1030,"./layout_defaults":1031,"./plot":1032,"./style":1033}],1030:[function(_dereq_,module,exports){ +},{"../pie/style_one":1171,"./attributes":1055,"./base_plot":1056,"./calc":1057,"./defaults":1058,"./layout_attributes":1060,"./layout_defaults":1061,"./plot":1062,"./style":1063}],1060:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173204,7 +175393,7 @@ module.exports = { } }; -},{"../pie/layout_attributes":1136}],1031:[function(_dereq_,module,exports){ +},{"../pie/layout_attributes":1167}],1061:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173229,7 +175418,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendfunnelareacolors'); }; -},{"../../lib":749,"./layout_attributes":1030}],1032:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1060}],1062:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173244,6 +175433,8 @@ var d3 = _dereq_('d3'); var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var barPlot = _dereq_('../bar/plot'); @@ -173399,9 +175590,9 @@ module.exports = function plot(gd, cdModule) { var transform = positionTitleOutside(cd0, fullLayout._size); titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); }); }); @@ -173525,7 +175716,7 @@ function setCoords(cd) { } } -},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../bar/plot":901,"../bar/uniform_text":906,"../pie/helpers":1134,"../pie/plot":1138,"d3":169}],1033:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../bar/plot":931,"../bar/uniform_text":936,"../pie/helpers":1165,"../pie/plot":1169,"d3":169}],1063:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173558,7 +175749,7 @@ module.exports = function style(gd) { }); }; -},{"../bar/uniform_text":906,"../pie/style_one":1140,"d3":169}],1034:[function(_dereq_,module,exports){ +},{"../bar/uniform_text":936,"../pie/style_one":1171,"d3":169}],1064:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173590,6 +175781,13 @@ module.exports = extendFlat({ y0: extendFlat({}, scatterAttrs.y0, {impliedEdits: {ytype: 'scaled'}}), dy: extendFlat({}, scatterAttrs.dy, {impliedEdits: {ytype: 'scaled'}}), + xperiod: extendFlat({}, scatterAttrs.xperiod, {impliedEdits: {xtype: 'scaled'}}), + yperiod: extendFlat({}, scatterAttrs.yperiod, {impliedEdits: {ytype: 'scaled'}}), + xperiod0: extendFlat({}, scatterAttrs.xperiod0, {impliedEdits: {xtype: 'scaled'}}), + yperiod0: extendFlat({}, scatterAttrs.yperiod0, {impliedEdits: {ytype: 'scaled'}}), + xperiodalignment: extendFlat({}, scatterAttrs.xperiodalignment, {impliedEdits: {xtype: 'scaled'}}), + yperiodalignment: extendFlat({}, scatterAttrs.yperiodalignment, {impliedEdits: {ytype: 'scaled'}}), + text: { valType: 'data_array', editType: 'calc', @@ -173700,7 +175898,7 @@ module.exports = extendFlat({ colorScaleAttrs('', {cLetter: 'z', autoColorDflt: false}) ); -},{"../../components/colorscale/attributes":622,"../../constants/docs":719,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1035:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../constants/docs":748,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1065:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173714,6 +175912,7 @@ module.exports = extendFlat({ var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var histogram2dCalc = _dereq_('../histogram2d/calc'); var colorscaleCalc = _dereq_('../../components/colorscale/calc'); @@ -173733,15 +175932,9 @@ module.exports = function calc(gd, trace) { var isHist = Registry.traceIs(trace, 'histogram'); var isGL2D = Registry.traceIs(trace, 'gl2d'); var zsmooth = isContour ? 'best' : trace.zsmooth; - var x; - var x0; - var dx; - var y; - var y0; - var dy; - var z; - var i; - var binned; + var x, x0, dx, origX; + var y, y0, dy, origY; + var z, i, binned; // cancel minimum tick spacings (only applies to bars and boxes) xa._minDtick = 0; @@ -173749,12 +175942,16 @@ module.exports = function calc(gd, trace) { if(isHist) { binned = histogram2dCalc(gd, trace); + origX = binned.orig_x; x = binned.x; x0 = binned.x0; dx = binned.dx; + + origY = binned.orig_y; y = binned.y; y0 = binned.y0; dy = binned.dy; + z = binned.z; } else { var zIn = trace.z; @@ -173764,8 +175961,12 @@ module.exports = function calc(gd, trace) { y = trace._y; zIn = trace._z; } else { - x = trace._x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace._y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + origX = trace.x ? xa.makeCalcdata(trace, 'x') : []; + origY = trace.y ? ya.makeCalcdata(trace, 'y') : []; + x = alignPeriod(trace, xa, 'x', origX); + y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; } x0 = trace.x0; @@ -173847,6 +176048,13 @@ module.exports = function calc(gd, trace) { hovertext: trace._hovertext || trace.hovertext }; + if(trace.xperiodalignment && origX) { + cd0.orig_x = origX; + } + if(trace.yperiodalignment && origY) { + cd0.orig_y = origY; + } + if(xIn && xIn.length === xArray.length - 1) cd0.xCenter = xIn; if(yIn && yIn.length === yArray.length - 1) cd0.yCenter = yIn; @@ -173899,7 +176107,7 @@ function dropZonBreaks(x, y, z) { return newZ; } -},{"../../components/colorscale/calc":623,"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"../histogram2d/calc":1067,"./clean_2d_array":1036,"./convert_column_xyz":1038,"./find_empties":1040,"./interp2d":1043,"./make_bound_array":1044}],1036:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../../registry":910,"../histogram2d/calc":1097,"./clean_2d_array":1066,"./convert_column_xyz":1068,"./find_empties":1070,"./interp2d":1073,"./make_bound_array":1074}],1066:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173976,7 +176184,7 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) { return zNew; }; -},{"../../constants/numerical":724,"../../lib":749,"fast-isnumeric":241}],1037:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],1067:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173992,7 +176200,7 @@ module.exports = { max: 'zmax' }; -},{}],1038:[function(_dereq_,module,exports){ +},{}],1068:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174006,11 +176214,15 @@ module.exports = { var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, arrayVarNames) { var colLen = trace._length; var col1 = ax1.makeCalcdata(trace, var1Name); var col2 = ax2.makeCalcdata(trace, var2Name); + col1 = alignPeriod(trace, ax1, var1Name, col1); + col2 = alignPeriod(trace, ax2, var2Name, col2); + var textCol = trace.text; var hasColumnText = (textCol !== undefined && Lib.isArray1D(textCol)); var hoverTextCol = trace.hovertext; @@ -174078,7 +176290,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, trace._after2before = after2before; }; -},{"../../constants/numerical":724,"../../lib":749}],1039:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824}],1069:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174093,6 +176305,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, var Lib = _dereq_('../../lib'); var handleXYZDefaults = _dereq_('./xyz_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); var attributes = _dereq_('./attributes'); @@ -174109,6 +176322,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); @@ -174121,7 +176336,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":1034,"./style_defaults":1047,"./xyz_defaults":1048}],1040:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../scatter/period_defaults":1206,"./attributes":1064,"./style_defaults":1077,"./xyz_defaults":1078}],1070:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174226,7 +176441,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"../../lib":749}],1041:[function(_dereq_,module,exports){ +},{"../../lib":778}],1071:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174299,14 +176514,21 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay var y0 = ya.c2p(y[ny]); var y1 = ya.c2p(y[ny + 1]); + var _x, _y; if(contour) { + _x = cd0.orig_x || x; + _y = cd0.orig_y || y; + x1 = x0; - xl = x[nx]; + xl = _x[nx]; y1 = y0; - yl = y[ny]; + yl = _y[ny]; } else { - xl = xc ? xc[nx] : ((x[nx] + x[nx + 1]) / 2); - yl = yc ? yc[ny] : ((y[ny] + y[ny + 1]) / 2); + _x = cd0.orig_x || xc || x; + _y = cd0.orig_y || yc || y; + + xl = xc ? _x[nx] : ((_x[nx] + _x[nx + 1]) / 2); + yl = yc ? _y[ny] : ((_y[ny] + _y[ny + 1]) / 2); if(xa && xa.type === 'category') xl = x[nx]; if(ya && ya.type === 'category') yl = y[ny]; @@ -174357,7 +176579,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay })]; }; -},{"../../components/colorscale":627,"../../components/fx":655,"../../lib":749,"../../plots/cartesian/axes":797}],1042:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/fx":683,"../../lib":778,"../../plots/cartesian/axes":827}],1072:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174409,7 +176631,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":1034,"./calc":1035,"./colorbar":1037,"./defaults":1039,"./hover":1041,"./plot":1045,"./style":1046}],1043:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":1064,"./calc":1065,"./colorbar":1067,"./defaults":1069,"./hover":1071,"./plot":1075,"./style":1076}],1073:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174542,7 +176764,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":749}],1044:[function(_dereq_,module,exports){ +},{"../../lib":778}],1074:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174630,7 +176852,7 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, return arrayOut; }; -},{"../../lib":749,"../../registry":880}],1045:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],1075:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175035,7 +177257,7 @@ function putColor(pixels, pxIndex, c) { pixels[pxIndex + 3] = Math.round(c[3] * 255); } -},{"../../components/colorscale":627,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../registry":880,"d3":169,"tinycolor2":548}],1046:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../registry":910,"d3":169,"tinycolor2":576}],1076:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175056,7 +177278,7 @@ module.exports = function style(gd) { }); }; -},{"d3":169}],1047:[function(_dereq_,module,exports){ +},{"d3":169}],1077:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175079,7 +177301,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce) { coerce('zhoverformat'); }; -},{}],1048:[function(_dereq_,module,exports){ +},{}],1078:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175181,7 +177403,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../lib":749,"../../registry":880,"fast-isnumeric":241}],1049:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"fast-isnumeric":241}],1079:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175229,7 +177451,7 @@ extendFlat( module.exports = overrideAll(attrs, 'calc', 'nested'); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../heatmap/attributes":1034}],1050:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../heatmap/attributes":1064}],1080:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175381,7 +177603,7 @@ function createHeatmap(scene, fullTrace, calcTrace) { module.exports = createHeatmap; -},{"../../lib/str2rgbarray":772,"../../plots/cartesian/axes":797,"gl-heatmap2d":268}],1051:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":801,"../../plots/cartesian/axes":827,"gl-heatmap2d":271}],1081:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175417,7 +177639,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../heatmap/xyz_defaults":1048,"./attributes":1049}],1052:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../heatmap/xyz_defaults":1078,"./attributes":1079}],1082:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175447,7 +177669,7 @@ module.exports = { } }; -},{"../../plots/gl2d":837,"../heatmap/calc":1035,"../heatmap/colorbar":1037,"./attributes":1049,"./convert":1050,"./defaults":1051}],1053:[function(_dereq_,module,exports){ +},{"../../plots/gl2d":867,"../heatmap/calc":1065,"../heatmap/colorbar":1067,"./attributes":1079,"./convert":1080,"./defaults":1081}],1083:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175675,7 +177897,7 @@ module.exports = { } }; -},{"../../lib/extend":739,"../../plots/template_attributes":875,"../bar/attributes":890,"./bin_attributes":1055,"./constants":1059}],1054:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/template_attributes":905,"../bar/attributes":920,"./bin_attributes":1085,"./constants":1089}],1084:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175700,7 +177922,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],1055:[function(_dereq_,module,exports){ +},{}],1085:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175776,7 +177998,7 @@ module.exports = function makeBinAttrs(axLetter, match) { }; }; -},{}],1056:[function(_dereq_,module,exports){ +},{}],1086:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175850,7 +178072,7 @@ module.exports = { } }; -},{"fast-isnumeric":241}],1057:[function(_dereq_,module,exports){ +},{"fast-isnumeric":241}],1087:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -176026,7 +178248,7 @@ function dateParts(v, pa, calendar) { return parts; } -},{"../../constants/numerical":724,"../../plots/cartesian/axes":797}],1058:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../plots/cartesian/axes":827}],1088:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -176605,7 +178827,7 @@ module.exports = { calcAllAutoBins: calcAllAutoBins }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"../bar/arrays_to_calcdata":889,"./average":1054,"./bin_functions":1056,"./bin_label_vals":1057,"./norm_functions":1065,"fast-isnumeric":241}],1059:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"../bar/arrays_to_calcdata":919,"./average":1084,"./bin_functions":1086,"./bin_label_vals":1087,"./norm_functions":1095,"fast-isnumeric":241}],1089:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -176621,7 +178843,7 @@ module.exports = { eventDataKeys: ['binNumber'] }; -},{}],1060:[function(_dereq_,module,exports){ +},{}],1090:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -176639,7 +178861,7 @@ var traceIs = _dereq_('../../registry').traceIs; var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var nestedProperty = Lib.nestedProperty; -var getAxisGroup = axisIds.getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var BINATTRS = [ {aStr: {x: 'xbins.start', y: 'ybins.start'}, name: 'start'}, @@ -176798,10 +179020,9 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } var binGroupFound = false; - for(i = 0; i < traces.length; i++) { - traceOut = traces[i]; + if(traces.length) { + traceOut = traces[0]; binGroupFound = coerce('bingroup'); - break; } groupName = binGroupFound || groupName; @@ -176899,7 +179120,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":749,"../../plots/cartesian/axis_ids":800,"../../registry":880,"../bar/defaults":894}],1061:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axis_ids":830,"../../plots/cartesian/constraints":834,"../../registry":910,"../bar/defaults":924}],1091:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -176973,7 +179194,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":615,"../../lib":749,"../../registry":880,"../bar/style_defaults":905,"./attributes":1053}],1062:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../registry":910,"../bar/style_defaults":935,"./attributes":1083}],1092:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177022,7 +179243,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],1063:[function(_dereq_,module,exports){ +},{}],1093:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177055,7 +179276,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return pts; }; -},{"../../plots/cartesian/axes":797,"../bar/hover":897}],1064:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827,"../bar/hover":927}],1094:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177111,7 +179332,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../bar/cross_trace_calc":893,"../bar/layout_attributes":899,"../bar/layout_defaults":900,"../bar/plot":901,"../bar/select":902,"../bar/style":904,"../scatter/marker_colorbar":1173,"./attributes":1053,"./calc":1058,"./cross_trace_defaults":1060,"./defaults":1061,"./event_data":1062,"./hover":1063}],1065:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../bar/cross_trace_calc":923,"../bar/layout_attributes":929,"../bar/layout_defaults":930,"../bar/plot":931,"../bar/select":932,"../bar/style":934,"../scatter/marker_colorbar":1204,"./attributes":1083,"./calc":1088,"./cross_trace_defaults":1090,"./defaults":1091,"./event_data":1092,"./hover":1093}],1095:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177146,7 +179367,7 @@ module.exports = { } }; -},{}],1066:[function(_dereq_,module,exports){ +},{}],1096:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177228,7 +179449,7 @@ module.exports = extendFlat( colorScaleAttrs('', {cLetter: 'z', autoColorDflt: false}) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../heatmap/attributes":1034,"../histogram/attributes":1053,"../histogram/bin_attributes":1055}],1067:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../heatmap/attributes":1064,"../histogram/attributes":1083,"../histogram/bin_attributes":1085}],1097:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177447,7 +179668,7 @@ function getRanges(edges, uniqueVals, gapLow, gapHigh, ax, calendar) { return out; } -},{"../../lib":749,"../../plots/cartesian/axes":797,"../histogram/average":1054,"../histogram/bin_functions":1056,"../histogram/bin_label_vals":1057,"../histogram/calc":1058,"../histogram/norm_functions":1065}],1068:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../histogram/average":1084,"../histogram/bin_functions":1086,"../histogram/bin_label_vals":1087,"../histogram/calc":1088,"../histogram/norm_functions":1095}],1098:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177480,7 +179701,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hovertemplate'); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../heatmap/style_defaults":1047,"./attributes":1066,"./sample_defaults":1071}],1069:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../heatmap/style_defaults":1077,"./attributes":1096,"./sample_defaults":1101}],1099:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177514,7 +179735,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return pts; }; -},{"../../plots/cartesian/axes":797,"../heatmap/hover":1041}],1070:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827,"../heatmap/hover":1071}],1100:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177554,7 +179775,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../heatmap/calc":1035,"../heatmap/colorbar":1037,"../heatmap/plot":1045,"../heatmap/style":1046,"../histogram/cross_trace_defaults":1060,"../histogram/event_data":1062,"./attributes":1066,"./defaults":1068,"./hover":1069}],1071:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../heatmap/calc":1065,"../heatmap/colorbar":1067,"../heatmap/plot":1075,"../heatmap/style":1076,"../histogram/cross_trace_defaults":1090,"../histogram/event_data":1092,"./attributes":1096,"./defaults":1098,"./hover":1099}],1101:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177599,7 +179820,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout coerce('autobiny'); }; -},{"../../lib":749,"../../registry":880}],1072:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],1102:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177657,7 +179878,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../contour/attributes":977,"../histogram2d/attributes":1066}],1073:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../contour/attributes":1007,"../histogram2d/attributes":1096}],1103:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177694,7 +179915,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hovertemplate'); }; -},{"../../lib":749,"../contour/contours_defaults":984,"../contour/style_defaults":998,"../histogram2d/sample_defaults":1071,"./attributes":1072}],1074:[function(_dereq_,module,exports){ +},{"../../lib":778,"../contour/contours_defaults":1014,"../contour/style_defaults":1028,"../histogram2d/sample_defaults":1101,"./attributes":1102}],1104:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177733,7 +179954,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../contour/calc":978,"../contour/colorbar":980,"../contour/hover":990,"../contour/plot":995,"../contour/style":997,"../histogram/cross_trace_defaults":1060,"./attributes":1072,"./defaults":1073}],1075:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../contour/calc":1008,"../contour/colorbar":1010,"../contour/hover":1020,"../contour/plot":1025,"../contour/style":1027,"../histogram/cross_trace_defaults":1090,"./attributes":1102,"./defaults":1103}],1105:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177868,7 +180089,7 @@ module.exports = extendFlat({ transforms: undefined }); -},{"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"./constants":1077}],1076:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"./constants":1107}],1106:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177884,9 +180105,7 @@ var constants = _dereq_('./constants'); var isNumeric = _dereq_('fast-isnumeric'); var Axes = _dereq_('../../plots/cartesian/axes'); var maxRowLength = _dereq_('../../lib').maxRowLength; -var sizeOf = _dereq_('image-size'); -var dataUri = _dereq_('../../snapshot/helpers').IMAGE_URL_PREFIX; -var Buffer = _dereq_('buffer/').Buffer; // note: the trailing slash is important! +var getImageSize = _dereq_('./helpers').getImageSize; module.exports = function calc(gd, trace) { var h; @@ -177968,14 +180187,7 @@ function makeScaler(trace) { }; } -// Get image size -function getImageSize(src) { - var data = src.replace(dataUri, ''); - var buff = new Buffer(data, 'base64'); - return sizeOf(buff); -} - -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../snapshot/helpers":884,"./constants":1077,"buffer/":111,"fast-isnumeric":241,"image-size":418}],1077:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"./constants":1107,"./helpers":1110,"fast-isnumeric":241}],1107:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178036,7 +180248,7 @@ module.exports = { } }; -},{}],1078:[function(_dereq_,module,exports){ +},{}],1108:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178093,7 +180305,7 @@ module.exports = function supplyDefaults(traceIn, traceOut) { traceOut._length = null; }; -},{"../../lib":749,"../../snapshot/helpers":884,"./attributes":1075,"./constants":1077}],1079:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../snapshot/helpers":914,"./attributes":1105,"./constants":1107}],1109:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178115,7 +180327,28 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1080:[function(_dereq_,module,exports){ +},{}],1110:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var sizeOf = _dereq_('image-size'); +var dataUri = _dereq_('../../snapshot/helpers').IMAGE_URL_PREFIX; +var Buffer = _dereq_('buffer/').Buffer; // note: the trailing slash is important! + +exports.getImageSize = function(src) { + var data = src.replace(dataUri, ''); + var buff = new Buffer(data, 'base64'); + return sizeOf(buff); +}; + +},{"../../snapshot/helpers":914,"buffer/":111,"image-size":444}],1111:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178215,7 +180448,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { })]; }; -},{"../../components/fx":655,"../../lib":749,"./constants":1077}],1081:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../lib":778,"./constants":1107}],1112:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178252,7 +180485,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":1075,"./calc":1076,"./defaults":1078,"./event_data":1079,"./hover":1080,"./plot":1082,"./style":1083}],1082:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":1105,"./calc":1106,"./defaults":1108,"./event_data":1109,"./hover":1111,"./plot":1113,"./style":1114}],1113:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178265,17 +180498,12 @@ module.exports = { var d3 = _dereq_('d3'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); var constants = _dereq_('./constants'); var unsupportedBrowsers = Lib.isIOS() || Lib.isSafari() || Lib.isIE(); -function compatibleAxis(ax) { - return ax.type === 'linear' && - // y axis must be reversed but x axis mustn't be - ((ax.range[1] > ax.range[0]) === (ax._id.charAt(0) === 'x')); -} - module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { var xa = plotinfo.xaxis; var ya = plotinfo.yaxis; @@ -178286,7 +180514,7 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { var plotGroup = d3.select(this); var cd0 = cd[0]; var trace = cd0.trace; - var fastImage = supportsPixelatedImage && !trace._hasZ && trace._hasSource && compatibleAxis(xa) && compatibleAxis(ya); + var fastImage = supportsPixelatedImage && !trace._hasZ && trace._hasSource && xa.type === 'linear' && ya.type === 'linear'; trace._fastImage = fastImage; var z = cd0.z; @@ -178399,8 +180627,23 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { // Pixelated image rendering // http://phrogz.net/tmp/canvas_image_zoom.html // https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering - image3 - .attr('style', 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;'); + var style = 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;'; + if(fastImage) { + var xRange = Lib.simpleMap(xa.range, xa.r2l); + var yRange = Lib.simpleMap(ya.range, ya.r2l); + + var flipX = xRange[1] < xRange[0]; + var flipY = yRange[1] > yRange[0]; + if(flipX || flipY) { + var tx = left + imageWidth / 2; + var ty = top + imageHeight / 2; + style += 'transform:' + + strTranslate(tx + 'px', ty + 'px') + + 'scale(' + (flipX ? -1 : 1) + ',' + (flipY ? -1 : 1) + ')' + + strTranslate(-tx + 'px', -ty + 'px') + ';'; + } + } + image3.attr('style', style); var p = new Promise(function(resolve) { if(trace._hasZ) { @@ -178472,7 +180715,7 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { }); }; -},{"../../constants/xmlns_namespaces":725,"../../lib":749,"./constants":1077,"d3":169}],1083:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":754,"../../lib":778,"./constants":1107,"d3":169}],1114:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178492,7 +180735,7 @@ module.exports = function style(gd) { }); }; -},{"d3":169}],1084:[function(_dereq_,module,exports){ +},{"d3":169}],1115:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178850,6 +181093,7 @@ module.exports = { showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, editType: 'plot' }, 'plot'), @@ -178893,7 +181137,7 @@ module.exports = { } }; -},{"../../components/color/attributes":614,"../../constants/delta.js":718,"../../constants/docs":719,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/cartesian/layout_attributes":811,"../../plots/domain":824,"../../plots/font_attributes":825}],1085:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../constants/delta.js":747,"../../constants/docs":748,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/cartesian/layout_attributes":841,"../../plots/domain":854,"../../plots/font_attributes":855}],1116:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178916,7 +181160,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1086:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1117:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178953,7 +181197,7 @@ module.exports = { calc: calc }; -},{}],1087:[function(_dereq_,module,exports){ +},{}],1118:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178975,7 +181219,7 @@ module.exports = { horizontalPadding: 10 }; -},{}],1088:[function(_dereq_,module,exports){ +},{}],1119:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179142,7 +181386,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/array_container_defaults":793,"../../plots/cartesian/tick_label_defaults":818,"../../plots/cartesian/tick_mark_defaults":819,"../../plots/cartesian/tick_value_defaults":820,"../../plots/domain":824,"./attributes":1084,"./constants.js":1087}],1089:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/array_container_defaults":822,"../../plots/cartesian/tick_label_defaults":848,"../../plots/cartesian/tick_mark_defaults":849,"../../plots/cartesian/tick_value_defaults":850,"../../plots/domain":854,"./attributes":1115,"./constants.js":1118}],1120:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179178,7 +181422,7 @@ module.exports = { } }; -},{"./attributes":1084,"./base_plot":1085,"./calc":1086,"./defaults":1088,"./plot":1090}],1090:[function(_dereq_,module,exports){ +},{"./attributes":1115,"./base_plot":1116,"./calc":1117,"./defaults":1119,"./plot":1121}],1121:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179192,6 +181436,8 @@ module.exports = { var d3 = _dereq_('d3'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var rad2deg = Lib.rad2deg; var MID_SHIFT = _dereq_('../../constants/alignment').MID_SHIFT; var Drawing = _dereq_('../../components/drawing'); @@ -179424,7 +181670,7 @@ function drawBulletGauge(gd, plotGroup, cd, opts) { // Enter bullet, axis bullet.enter().append('g').classed('bullet', true); - bullet.attr('transform', 'translate(' + size.l + ', ' + size.t + ')'); + bullet.attr('transform', strTranslate(size.l, size.t)); axisLayer.enter().append('g') .classed('bulletaxis', true) @@ -179443,7 +181689,7 @@ function drawBulletGauge(gd, plotGroup, cd, opts) { ax.setScale(); vals = Axes.calcTicks(ax); - transFn = Axes.makeTransFn(ax); + transFn = Axes.makeTransTickFn(ax); tickSign = Axes.getTickSigns(ax)[2]; shift = size.t + size.h; @@ -179961,7 +182207,7 @@ function drawNumbers(gd, plotGroup, cd, opts) { // Stash translateX translateX = cache(trace, 'numbersTranslate', 0, translateX, key, Math.max); - return strTranslate(translateX, translateY) + ' scale(' + scaleRatio + ')'; + return strTranslate(translateX, translateY) + strScale(scaleRatio); }); } } @@ -180018,10 +182264,6 @@ function mockAxis(gd, opts, zrange) { return axisOut; } -function strTranslate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - function fitTextInsideBox(textBB, width, height) { // compute scaling ratio to have text fit within specified width and height var ratio = Math.min(width / textBB.width, height / textBB.height); @@ -180059,7 +182301,7 @@ function cache(trace, name, initialValue, value, key, fn) { return v; } -},{"../../components/color":615,"../../components/drawing":637,"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_defaults":799,"../../plots/cartesian/layout_attributes":811,"../../plots/cartesian/position_defaults":814,"./constants":1087,"d3":169}],1091:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_defaults":829,"../../plots/cartesian/layout_attributes":841,"../../plots/cartesian/position_defaults":844,"./constants":1118,"d3":169}],1122:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -180318,7 +182560,7 @@ attrs.flatshading.dflt = true; attrs.lighting.facenormalsepsilon.dflt = 0; attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875,"../mesh3d/attributes":1096}],1092:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905,"../mesh3d/attributes":1127}],1123:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -180373,7 +182615,7 @@ module.exports = function calc(gd, trace) { }); }; -},{"../../components/colorscale/calc":623,"../streamtube/calc":1262}],1093:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../streamtube/calc":1294}],1124:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -181429,7 +183671,7 @@ module.exports = { createIsosurfaceTrace: createIsosurfaceTrace, }; -},{"../../components/colorscale":627,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/gl3d/zip3":850,"gl-mesh3d":292}],1094:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/gl3d/zip3":880,"gl-mesh3d":309}],1125:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -181546,7 +183788,7 @@ module.exports = { supplyIsoDefaults: supplyIsoDefaults }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../../registry":880,"./attributes":1091}],1095:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../../registry":910,"./attributes":1122}],1126:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -181581,7 +183823,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":1091,"./calc":1092,"./convert":1093,"./defaults":1094}],1096:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1122,"./calc":1123,"./convert":1124,"./defaults":1125}],1127:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -181837,7 +184079,7 @@ colorScaleAttrs('', { showlegend: extendFlat({}, baseAttrs.showlegend, {dflt: false}) }); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../surface/attributes":1278}],1097:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../surface/attributes":1310}],1128:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -181860,7 +184102,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":623}],1098:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651}],1129:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182063,7 +184305,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../components/colorscale":627,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/gl3d/zip3":850,"alpha-shape":69,"convex-hull":135,"delaunay-triangulate":171,"gl-mesh3d":292}],1099:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/gl3d/zip3":880,"alpha-shape":69,"convex-hull":135,"delaunay-triangulate":171,"gl-mesh3d":309}],1130:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182165,7 +184407,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../../registry":880,"./attributes":1096}],1100:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../../registry":910,"./attributes":1127}],1131:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182202,7 +184444,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":1096,"./calc":1097,"./convert":1098,"./defaults":1099}],1101:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1127,"./calc":1128,"./convert":1129,"./defaults":1130}],1132:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182239,6 +184481,10 @@ function directionAttrs(lineColorDefault) { module.exports = { + xperiod: scatterAttrs.xperiod, + xperiod0: scatterAttrs.xperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + x: { valType: 'data_array', editType: 'calc+clearAxisTypes', @@ -182346,7 +184592,7 @@ module.exports = { }), }; -},{"../../components/drawing/attributes":636,"../../components/fx/attributes":646,"../../constants/delta.js":718,"../../lib":749,"../scatter/attributes":1155}],1102:[function(_dereq_,module,exports){ +},{"../../components/drawing/attributes":664,"../../components/fx/attributes":674,"../../constants/delta.js":747,"../../lib":778,"../scatter/attributes":1186}],1133:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182360,6 +184606,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var _ = Lib._; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; function calc(gd, trace) { @@ -182369,10 +184616,12 @@ function calc(gd, trace) { var tickLen = convertTickWidth(gd, xa, trace); var minDiff = trace._minDiff; trace._minDiff = null; + var origX = trace._origX; + trace._origX = null; var x = trace._xcalc; trace._xcalc = null; - var cd = calcCommon(gd, trace, x, ya, ptFunc); + var cd = calcCommon(gd, trace, origX, x, ya, ptFunc); trace._extremes[xa._id] = Axes.findExtremes(xa, x, {vpad: minDiff / 2}); if(cd.length) { @@ -182398,7 +184647,7 @@ function ptFunc(o, h, l, c) { // shared between OHLC and candlestick // ptFunc makes a calcdata point specific to each trace type, from oi, hi, li, ci -function calcCommon(gd, trace, x, ya, ptFunc) { +function calcCommon(gd, trace, origX, x, ya, ptFunc) { var o = ya.makeCalcdata(trace, 'open'); var h = ya.makeCalcdata(trace, 'high'); var l = ya.makeCalcdata(trace, 'low'); @@ -182411,6 +184660,8 @@ function calcCommon(gd, trace, x, ya, ptFunc) { var increasing = true; var cPrev = null; + var hasPeriod = !!trace.xperiodalignment; + var cd = []; for(var i = 0; i < x.length; i++) { var xi = x[i]; @@ -182439,6 +184690,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) { pt.x = pt.pos; pt.y = [li, hi]; + if(hasPeriod) pt.orig_p = origX[i]; // used by hover if(hasTextArray) pt.tx = trace.text[i]; if(hasHovertextArray) pt.htx = trace.hovertext[i]; @@ -182470,7 +184722,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) { * in all traces; when a trace uses this in its * calc step it deletes _minDiff, so that next calc this is * done again in case the data changed. - * also since we need it here, stash _xcalc on the trace + * also since we need it here, stash _xcalc (and _origX) on the trace */ function convertTickWidth(gd, xa, trace) { var minDiff = trace._minDiff; @@ -182492,7 +184744,10 @@ function convertTickWidth(gd, xa, trace) { ) { ohlcTracesOnThisXaxis.push(tracei); - var xcalc = xa.makeCalcdata(tracei, 'x'); + var origX = xa.makeCalcdata(tracei, 'x'); + tracei._origX = origX; + + var xcalc = alignPeriod(trace, xa, 'x', origX); tracei._xcalc = xcalc; var _minDiff = Lib.distinctVals(xcalc).minDiff; @@ -182518,7 +184773,7 @@ module.exports = { calcCommon: calcCommon }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797}],1103:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827}],1134:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182532,6 +184787,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var handleOHLC = _dereq_('./ohlc_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -182545,6 +184801,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce, {x: true}); + coerce('line.width'); coerce('line.dash'); @@ -182564,7 +184822,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":749,"./attributes":1101,"./ohlc_defaults":1106}],1104:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/period_defaults":1206,"./attributes":1132,"./ohlc_defaults":1137}],1135:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182655,7 +184913,7 @@ function getClosestPoint(pointData, xval, yval, hovermode) { pointData.x0 = xa.c2p(di.pos + centerShift - displayHalfWidth, true); pointData.x1 = xa.c2p(di.pos + centerShift + displayHalfWidth, true); - pointData.xLabelVal = di.pos; + pointData.xLabelVal = di.orig_p !== undefined ? di.orig_p : di.pos; pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; pointData.xSpike = xa.c2p(di.pos, true); @@ -182771,7 +185029,7 @@ module.exports = { hoverOnPoints: hoverOnPoints }; -},{"../../components/color":615,"../../components/fx":655,"../../constants/delta.js":718,"../../lib":749,"../../plots/cartesian/axes":797}],1105:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../constants/delta.js":747,"../../lib":778,"../../plots/cartesian/axes":827}],1136:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182812,7 +185070,7 @@ module.exports = { selectPoints: _dereq_('./select') }; -},{"../../plots/cartesian":810,"./attributes":1101,"./calc":1102,"./defaults":1103,"./hover":1104,"./plot":1107,"./select":1108,"./style":1109}],1106:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":1132,"./calc":1133,"./defaults":1134,"./hover":1135,"./plot":1138,"./select":1139,"./style":1140}],1137:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182847,7 +185105,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { return len; }; -},{"../../lib":749,"../../registry":880}],1107:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],1138:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182905,7 +185163,7 @@ module.exports = function plot(gd, plotinfo, cdOHLC, ohlcLayer) { }); }; -},{"../../lib":749,"d3":169}],1108:[function(_dereq_,module,exports){ +},{"../../lib":778,"d3":169}],1139:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182950,7 +185208,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],1109:[function(_dereq_,module,exports){ +},{}],1140:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182989,7 +185247,7 @@ module.exports = function style(gd, cd, sel) { }); }; -},{"../../components/color":615,"../../components/drawing":637,"d3":169}],1110:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"d3":169}],1141:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183216,7 +185474,7 @@ module.exports = { showlegend: undefined }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/font_attributes":825,"../../plots/template_attributes":875}],1111:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/font_attributes":855,"../../plots/template_attributes":905}],1142:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183251,7 +185509,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/get_data":834,"./plot":1116}],1112:[function(_dereq_,module,exports){ +},{"../../plots/get_data":864,"./plot":1147}],1143:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183770,7 +186028,7 @@ function isRangePermutation(inds) { return true; } -},{"../../components/colorscale/calc":623,"../../components/colorscale/helpers":626,"../../components/drawing":637,"../../lib":749,"../../lib/filter_unique.js":740,"../../lib/gup":746,"fast-isnumeric":241}],1113:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../components/colorscale/helpers":654,"../../components/drawing":665,"../../lib":778,"../../lib/filter_unique.js":769,"../../lib/gup":775,"fast-isnumeric":241}],1144:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183891,7 +186149,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceFont(coerce, 'tickfont', categoryfontDefault); }; -},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/domain":824,"../parcoords/merge_length":1126,"./attributes":1110}],1114:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/domain":854,"../parcoords/merge_length":1157,"./attributes":1141}],1145:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183924,7 +186182,7 @@ module.exports = { } }; -},{"./attributes":1110,"./base_plot":1111,"./calc":1112,"./defaults":1113,"./plot":1116}],1115:[function(_dereq_,module,exports){ +},{"./attributes":1141,"./base_plot":1142,"./calc":1143,"./defaults":1144,"./plot":1147}],1146:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183939,6 +186197,7 @@ var d3 = _dereq_('d3'); var Plotly = _dereq_('../../plot_api/plot_api'); var Fx = _dereq_('../../components/fx'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../../components/drawing'); var tinycolor = _dereq_('tinycolor2'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -183968,7 +186227,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update properties for each trace traceSelection .attr('transform', function(d) { - return 'translate(' + d.x + ', ' + d.y + ')'; + return strTranslate(d.x, d.y); }); // Initialize paths group @@ -184049,7 +186308,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update dimension group transforms dimensionSelection.attr('transform', function(d) { - return 'translate(' + d.x + ', 0)'; + return strTranslate(d.x, 0); }); // Remove any old dimensions @@ -184071,7 +186330,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update category transforms categorySelection .attr('transform', function(d) { - return 'translate(0, ' + d.y + ')'; + return strTranslate(0, d.y); }); @@ -184692,7 +186951,11 @@ function emitPointsEventColorHovermode(bandElement, eventName, event) { * HTML element for band * */ -function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { +function createHoverLabelForCategoryHovermode(gd, rootBBox, bandElement) { + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + // Selections var rectSelection = d3.select(bandElement.parentNode).select('rect.catrect'); var rectBoundingBox = rectSelection.node().getBoundingClientRect(); @@ -184740,8 +187003,8 @@ function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { var hovertext = hoverinfoParts.join('
'); return { trace: trace, - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, + x: scaleX * (hoverCenterX - rootBBox.left), + y: scaleY * (hoverCenterY - rootBBox.top), text: hovertext, color: 'lightgray', borderColor: 'black', @@ -184770,7 +187033,7 @@ function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { * HTML element for band * */ -function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { +function createHoverLabelForDimensionHovermode(gd, rootBBox, bandElement) { var allHoverlabels = []; d3.select(bandElement.parentNode.parentNode) @@ -184778,7 +187041,7 @@ function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { .select('rect.catrect') .each(function() { var bandNode = this; - allHoverlabels.push(createHoverLabelForCategoryHovermode(rootBBox, bandNode)); + allHoverlabels.push(createHoverLabelForCategoryHovermode(gd, rootBBox, bandNode)); }); return allHoverlabels; @@ -184793,7 +187056,11 @@ function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { * HTML element for band * */ -function createHoverLabelForColorHovermode(rootBBox, bandElement) { +function createHoverLabelForColorHovermode(gd, rootBBox, bandElement) { + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var bandBoundingBox = bandElement.getBoundingClientRect(); // Models @@ -184871,8 +187138,8 @@ function createHoverLabelForColorHovermode(rootBBox, bandElement) { return { trace: trace, - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, + x: scaleX * (hoverCenterX - rootBBox.left), + y: scaleY * (hoverCenterY - rootBBox.top), // name: 'NAME', text: hovertext, color: bandViewModel.color, @@ -184935,11 +187202,11 @@ function mouseoverCategoryBand(bandViewModel) { if(bandViewModel.parcatsViewModel.hoverinfoItems.indexOf('none') === -1) { var hoverItems; if(hoveron === 'category') { - hoverItems = createHoverLabelForCategoryHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForCategoryHovermode(gd, rootBBox, bandElement); } else if(hoveron === 'color') { - hoverItems = createHoverLabelForColorHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForColorHovermode(gd, rootBBox, bandElement); } else if(hoveron === 'dimension') { - hoverItems = createHoverLabelForDimensionHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForDimensionHovermode(gd, rootBBox, bandElement); } if(hoverItems) { @@ -185328,13 +187595,13 @@ function updateSvgCategories(parcatsViewModel, hasTransition) { // Update dimension position transition(parcatsViewModel.dimensionSelection) .attr('transform', function(d) { - return 'translate(' + d.x + ', 0)'; + return strTranslate(d.x, 0); }); // Update category position transition(categorySelection) .attr('transform', function(d) { - return 'translate(0, ' + d.y + ')'; + return strTranslate(0, d.y); }); var dimLabelSelection = categorySelection.select('.dimlabel'); @@ -186075,7 +188342,7 @@ function createDimensionViewModel(parcatsViewModel, dimensionModel) { * The parent trace's view model */ -},{"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/svg_text_utils":773,"../../plot_api/plot_api":784,"d3":169,"tinycolor2":548}],1116:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/svg_text_utils":802,"../../plot_api/plot_api":813,"d3":169,"tinycolor2":576}],1147:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -186119,7 +188386,7 @@ module.exports = function plot(graphDiv, parcatsModels, transitionOpts, makeOnCo ); }; -},{"./parcats":1115}],1117:[function(_dereq_,module,exports){ +},{"./parcats":1146}],1148:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -186274,7 +188541,7 @@ module.exports = { ) }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/plot_template":787,"../../plots/cartesian/layout_attributes":811,"../../plots/domain":824,"../../plots/font_attributes":825}],1118:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/plot_template":816,"../../plots/cartesian/layout_attributes":841,"../../plots/domain":854,"../../plots/font_attributes":855}],1149:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -186290,6 +188557,7 @@ var d3 = _dereq_('d3'); var keyFun = _dereq_('../../lib/gup').keyFun; var repeat = _dereq_('../../lib/gup').repeat; var sortAsc = _dereq_('../../lib').sorterAsc; +var strTranslate = _dereq_('../../lib').strTranslate; var snapRatio = c.bar.snapRatio; function snapOvershoot(v, vAdjacent) { return v * (1 - snapRatio) + vAdjacent * snapRatio; } @@ -186647,7 +188915,7 @@ function renderAxisBrush(axisBrush) { .call(barHorizontalSetup) .call(backgroundBarHorizontalSetup) .style('pointer-events', 'auto') // parent pointer events are disabled; we must have it to register events - .attr('transform', 'translate(0 ' + c.verticalPadding + ')'); + .attr('transform', strTranslate(0, c.verticalPadding)); background .call(attachDragBehavior) @@ -186818,7 +189086,7 @@ module.exports = { cleanRanges: cleanRanges }; -},{"../../lib":749,"../../lib/gup":746,"./constants":1121,"d3":169}],1119:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/gup":775,"./constants":1152,"d3":169}],1150:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -186885,7 +189153,7 @@ exports.toSVG = function(gd) { }, 60); }; -},{"../../constants/xmlns_namespaces":725,"../../plots/get_data":834,"./plot":1128,"d3":169}],1120:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":754,"../../plots/get_data":864,"./plot":1159,"d3":169}],1151:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -186929,7 +189197,7 @@ function constHalf(len) { return out; } -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gup":746}],1121:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gup":775}],1152:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -186991,7 +189259,7 @@ module.exports = { } }; -},{}],1122:[function(_dereq_,module,exports){ +},{}],1153:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187111,7 +189379,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('labelside'); }; -},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"../../plots/domain":824,"./attributes":1117,"./axisbrush":1118,"./constants":1121,"./merge_length":1126}],1123:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"../../plots/domain":854,"./attributes":1148,"./axisbrush":1149,"./constants":1152,"./merge_length":1157}],1154:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187136,7 +189404,7 @@ exports.isVisible = function(dimension) { return dimension.visible || !('visible' in dimension); }; -},{"../../lib":749}],1124:[function(_dereq_,module,exports){ +},{"../../lib":778}],1155:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187171,7 +189439,7 @@ module.exports = { } }; -},{"./attributes":1117,"./base_plot":1119,"./calc":1120,"./defaults":1122,"./plot":1128}],1125:[function(_dereq_,module,exports){ +},{"./attributes":1148,"./base_plot":1150,"./calc":1151,"./defaults":1153,"./plot":1159}],1156:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187701,7 +189969,7 @@ module.exports = function(canvasGL, d) { }; }; -},{"../../lib":749,"./constants":1121,"glslify":413}],1126:[function(_dereq_,module,exports){ +},{"../../lib":778,"./constants":1152,"glslify":439}],1157:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187739,7 +190007,7 @@ module.exports = function(traceOut, dimensions, dataAttr, len) { return len; }; -},{}],1127:[function(_dereq_,module,exports){ +},{}],1158:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187755,6 +190023,8 @@ var rgba = _dereq_('color-rgba'); var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Drawing = _dereq_('../../components/drawing'); var Colorscale = _dereq_('../../components/colorscale'); @@ -188092,8 +190362,7 @@ function styleExtentTexts(selection) { selection .classed(c.cn.axisExtentText, true) .attr('text-anchor', 'middle') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); } function parcoordsInteractionState() { @@ -188261,7 +190530,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .style('pointer-events', 'none'); controlOverlay.attr('transform', function(d) { - return 'translate(' + d.model.translateX + ',' + d.model.translateY + ')'; + return strTranslate(d.model.translateX, d.model.translateY); }); var parcoordsControlView = controlOverlay.selectAll('.' + c.cn.parcoordsControlView) @@ -188272,7 +190541,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.parcoordsControlView, true); parcoordsControlView.attr('transform', function(d) { - return 'translate(' + d.model.pad.l + ',' + d.model.pad.t + ')'; + return strTranslate(d.model.pad.l, d.model.pad.t); }); var yAxis = parcoordsControlView.selectAll('.' + c.cn.yAxis) @@ -188303,7 +190572,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { }); yAxis.attr('transform', function(d) { - return 'translate(' + d.xScale(d.xIndex) + ', 0)'; + return strTranslate(d.xScale(d.xIndex), 0); }); // drag column for reordering columns @@ -188325,8 +190594,8 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { updatePanelLayout(yAxis, p); yAxis.filter(function(e) { return Math.abs(d.xIndex - e.xIndex) !== 0; }) - .attr('transform', function(d) { return 'translate(' + d.xScale(d.xIndex) + ', 0)'; }); - d3.select(this).attr('transform', 'translate(' + d.x + ', 0)'); + .attr('transform', function(d) { return strTranslate(d.xScale(d.xIndex), 0); }); + d3.select(this).attr('transform', strTranslate(d.x, 0)); yAxis.each(function(e, i0, i1) { if(i1 === d.parent.key) p.dimensions[i0] = e; }); p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); p.focusLayer.render && p.focusLayer.render(p.panels); @@ -188337,7 +190606,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { d.canvasX = d.x * d.model.canvasPixelRatio; updatePanelLayout(yAxis, p); d3.select(this) - .attr('transform', function(d) { return 'translate(' + d.x + ', 0)'; }); + .attr('transform', function(d) { return strTranslate(d.x, 0); }); p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); p.focusLayer && p.focusLayer.render(p.panels); p.pickLayer && p.pickLayer.render(p.panels, true); @@ -188397,8 +190666,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axis.selectAll('text') .style('text-shadow', '1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); var axisHeading = axisOverlays.selectAll('.' + c.cn.axisHeading) .data(repeat, keyFun); @@ -188415,7 +190683,6 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisTitle, true) .attr('text-anchor', 'middle') .style('cursor', 'ew-resize') - .style('user-select', 'none') .style('pointer-events', 'auto'); axisTitle @@ -188429,9 +190696,9 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { var tilt = calcTilt(d.model.labelAngle, d.model.labelSide); var r = c.axisTitleOffset; return ( - (tilt.dir > 0 ? '' : 'translate(0,' + (2 * r + d.model.height) + ')') + - 'rotate(' + tilt.degrees + ')' + - 'translate(' + (-r * tilt.dx) + ',' + (-r * tilt.dy) + ')' + (tilt.dir > 0 ? '' : strTranslate(0, 2 * r + d.model.height)) + + strRotate(tilt.degrees) + + strTranslate(-r * tilt.dx, -r * tilt.dy) ); }) .attr('text-anchor', function(d) { @@ -188461,7 +190728,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisExtentTop, true); axisExtentTop - .attr('transform', 'translate(' + 0 + ',' + -c.axisExtentOffset + ')'); + .attr('transform', strTranslate(0, -c.axisExtentOffset)); var axisExtentTopText = axisExtentTop.selectAll('.' + c.cn.axisExtentTopText) .data(repeat, keyFun); @@ -188484,7 +190751,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axisExtentBottom .attr('transform', function(d) { - return 'translate(' + 0 + ',' + (d.model.height + c.axisExtentOffset) + ')'; + return strTranslate(0, d.model.height + c.axisExtentOffset); }); var axisExtentBottomText = axisExtentBottom.selectAll('.' + c.cn.axisExtentBottomText) @@ -188503,7 +190770,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { brush.ensureAxisBrush(axisOverlays); }; -},{"../../components/colorscale":627,"../../components/drawing":637,"../../lib":749,"../../lib/gup":746,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"./axisbrush":1118,"./constants":1121,"./helpers":1123,"./lines":1125,"color-rgba":127,"d3":169}],1128:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/drawing":665,"../../lib":778,"../../lib/gup":775,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"./axisbrush":1149,"./constants":1152,"./helpers":1154,"./lines":1156,"color-rgba":127,"d3":169}],1159:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -188658,7 +190925,7 @@ module.exports = function plot(gd, cdModule) { ); }; -},{"../../lib/prepare_regl":762,"./helpers":1123,"./parcoords":1127}],1129:[function(_dereq_,module,exports){ +},{"../../lib/prepare_regl":791,"./helpers":1154,"./parcoords":1158}],1160:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189017,7 +191284,7 @@ module.exports = { } }; -},{"../../components/color/attributes":614,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/font_attributes":825,"../../plots/template_attributes":875}],1130:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/font_attributes":855,"../../plots/template_attributes":905}],1161:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189040,7 +191307,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1131:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1162:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189223,7 +191490,7 @@ module.exports = { generateExtendedColors: generateExtendedColors }; -},{"../../components/color":615,"fast-isnumeric":241,"tinycolor2":548}],1132:[function(_dereq_,module,exports){ +},{"../../components/color":643,"fast-isnumeric":241,"tinycolor2":576}],1163:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189354,7 +191621,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":749,"../../plots/domain":824,"../bar/defaults":894,"./attributes":1129,"fast-isnumeric":241}],1133:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/domain":854,"../bar/defaults":924,"./attributes":1160,"fast-isnumeric":241}],1164:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189403,7 +191670,7 @@ module.exports = function eventData(pt, trace) { return out; }; -},{"../../components/fx/helpers":651}],1134:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":679}],1165:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189416,19 +191683,21 @@ module.exports = function eventData(pt, trace) { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -189445,7 +191714,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":749}],1135:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":778}],1166:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189482,7 +191755,7 @@ module.exports = { } }; -},{"./attributes":1129,"./base_plot":1130,"./calc":1131,"./defaults":1132,"./layout_attributes":1136,"./layout_defaults":1137,"./plot":1138,"./style":1139,"./style_one":1140}],1136:[function(_dereq_,module,exports){ +},{"./attributes":1160,"./base_plot":1161,"./calc":1162,"./defaults":1163,"./layout_attributes":1167,"./layout_defaults":1168,"./plot":1169,"./style":1170,"./style_one":1171}],1167:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189534,7 +191807,7 @@ module.exports = { } }; -},{}],1137:[function(_dereq_,module,exports){ +},{}],1168:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189559,7 +191832,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendpiecolors'); }; -},{"../../lib":749,"./layout_attributes":1136}],1138:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1167}],1169:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189577,6 +191850,8 @@ var Fx = _dereq_('../../components/fx'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var uniformText = _dereq_('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; @@ -189806,9 +192081,9 @@ function plot(gd, cdModule) { } titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); // now make sure no labels overlap (at least within one pie) @@ -190607,7 +192882,7 @@ function setCoords(cd) { var cd0 = cd[0]; var r = cd0.r; var trace = cd0.trace; - var currentAngle = trace.rotation * Math.PI / 180; + var currentAngle = helpers.getRotationAngle(trace.rotation); var angleFactor = 2 * Math.PI / cd0.vTotal; var firstPt = 'px0'; var lastPt = 'px1'; @@ -190737,7 +193012,7 @@ module.exports = { computeTransform: computeTransform }; -},{"../../components/color":615,"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../bar/constants":892,"../bar/uniform_text":906,"./event_data":1133,"./helpers":1134,"d3":169}],1139:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../bar/constants":922,"../bar/uniform_text":936,"./event_data":1164,"./helpers":1165,"d3":169}],1170:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190770,7 +193045,7 @@ module.exports = function style(gd) { }); }; -},{"../bar/uniform_text":906,"./style_one":1140,"d3":169}],1140:[function(_dereq_,module,exports){ +},{"../bar/uniform_text":936,"./style_one":1171,"d3":169}],1171:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190794,7 +193069,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":615,"./helpers":1134}],1141:[function(_dereq_,module,exports){ +},{"../../components/color":643,"./helpers":1165}],1172:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190942,7 +193217,7 @@ module.exports = { transforms: undefined }; -},{"../scatter/attributes":1155}],1142:[function(_dereq_,module,exports){ +},{"../scatter/attributes":1186}],1173:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191144,7 +193419,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":772,"../../plots/cartesian/autorange":796,"../scatter/get_trace_color":1165,"gl-pointcloud2d":303}],1143:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":801,"../../plots/cartesian/autorange":826,"../scatter/get_trace_color":1196,"gl-pointcloud2d":324}],1174:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191192,7 +193467,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { traceOut._length = null; }; -},{"../../lib":749,"./attributes":1141}],1144:[function(_dereq_,module,exports){ +},{"../../lib":778,"./attributes":1172}],1175:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191223,7 +193498,7 @@ module.exports = { } }; -},{"../../plots/gl2d":837,"../scatter3d/calc":1183,"./attributes":1141,"./convert":1142,"./defaults":1143}],1145:[function(_dereq_,module,exports){ +},{"../../plots/gl2d":867,"../scatter3d/calc":1215,"./attributes":1172,"./convert":1173,"./defaults":1174}],1176:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191533,7 +193808,7 @@ var attrs = module.exports = overrideAll({ }, 'calc', 'nested'); attrs.transforms = undefined; -},{"../../components/color/attributes":614,"../../components/colorscale/attributes":622,"../../components/fx/attributes":646,"../../constants/docs":719,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/font_attributes":825,"../../plots/template_attributes":875}],1146:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../components/colorscale/attributes":650,"../../components/fx/attributes":674,"../../constants/docs":748,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/font_attributes":855,"../../plots/template_attributes":905}],1177:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191672,7 +193947,7 @@ function subplotUpdateFx(gd, index) { dragElement.init(dragOptions); } -},{"../../components/dragelement":634,"../../components/fx/layout_attributes":656,"../../lib":749,"../../lib/setcursor":769,"../../plot_api/edit_types":780,"../../plots/cartesian/select":816,"../../plots/get_data":834,"../../registry":880,"./plot":1151}],1147:[function(_dereq_,module,exports){ +},{"../../components/dragelement":662,"../../components/fx/layout_attributes":684,"../../lib":778,"../../lib/setcursor":798,"../../plot_api/edit_types":809,"../../plots/cartesian/select":846,"../../plots/get_data":864,"../../registry":910,"./plot":1182}],1178:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191861,7 +194136,7 @@ module.exports = function calc(gd, trace) { }); }; -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gup":746,"strongly-connected-components":541}],1148:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gup":775,"strongly-connected-components":569}],1179:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191896,7 +194171,7 @@ module.exports = { } }; -},{}],1149:[function(_dereq_,module,exports){ +},{}],1180:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192010,7 +194285,7 @@ function concentrationscalesDefaults(In, Out) { coerce('colorscale'); } -},{"../../components/color":615,"../../components/fx/hoverlabel_defaults":653,"../../lib":749,"../../plot_api/plot_template":787,"../../plots/array_container_defaults":793,"../../plots/domain":824,"./attributes":1145,"tinycolor2":548}],1150:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx/hoverlabel_defaults":681,"../../lib":778,"../../plot_api/plot_template":816,"../../plots/array_container_defaults":822,"../../plots/domain":854,"./attributes":1176,"tinycolor2":576}],1181:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192041,7 +194316,7 @@ module.exports = { } }; -},{"./attributes":1145,"./base_plot":1146,"./calc":1147,"./defaults":1149,"./plot":1151,"./select.js":1153}],1151:[function(_dereq_,module,exports){ +},{"./attributes":1176,"./base_plot":1177,"./calc":1178,"./defaults":1180,"./plot":1182,"./select.js":1184}],1182:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192336,10 +194611,14 @@ module.exports = function plot(gd, calcData) { var hovertemplateLabels = {valueLabel: d3.format(d.valueFormat)(d.node.value) + d.valueSuffix}; d.node.fullData = d.node.trace; + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var tooltip = Fx.loneHover({ - x0: hoverCenterX0, - x1: hoverCenterX1, - y: hoverCenterY, + x0: scaleX * hoverCenterX0, + x1: scaleX * hoverCenterX1, + y: scaleY * hoverCenterY, name: d3.format(d.valueFormat)(d.node.value) + d.valueSuffix, text: [ d.node.label, @@ -192413,7 +194692,7 @@ module.exports = function plot(gd, calcData) { ); }; -},{"../../components/color":615,"../../components/fx":655,"../../lib":749,"./constants":1148,"./render":1152,"d3":169}],1152:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../lib":778,"./constants":1179,"./render":1183,"d3":169}],1183:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192433,6 +194712,7 @@ var d3Sankey = _dereq_('@plotly/d3-sankey'); var d3SankeyCircular = _dereq_('@plotly/d3-sankey-circular'); var d3Force = _dereq_('d3-force'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var gup = _dereq_('../../lib/gup'); var keyFun = gup.keyFun; var repeat = gup.repeat; @@ -192943,7 +195223,7 @@ function nodeModel(d, n) { function updateNodePositions(sankeyNode) { sankeyNode .attr('transform', function(d) { - return 'translate(' + d.node.x0.toFixed(3) + ', ' + (d.node.y0).toFixed(3) + ')'; + return strTranslate(d.node.x0.toFixed(3), (d.node.y0).toFixed(3)); }); } @@ -192965,12 +195245,12 @@ function sizeNode(rect) { function salientEnough(d) {return (d.link.width > 1 || d.linkLineWidth > 0);} function sankeyTransform(d) { - var offset = 'translate(' + d.translateX + ',' + d.translateY + ')'; + var offset = strTranslate(d.translateX, d.translateY); return offset + (d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)'); } function nodeCentering(d) { - return 'translate(' + (d.horizontal ? 0 : d.labelY) + ' ' + (d.horizontal ? d.labelY : 0) + ')'; + return strTranslate(d.horizontal ? 0 : d.labelY, d.horizontal ? d.labelY : 0); } function textGuidePath(d) { @@ -193442,7 +195722,6 @@ module.exports = function(gd, svg, calcData, layout, callbacks) { .append('text') .classed(c.cn.nodeLabel, true) .attr('transform', textFlip) - .style('user-select', 'none') .style('cursor', 'default') .style('fill', 'black'); @@ -193479,7 +195758,7 @@ module.exports = function(gd, svg, calcData, layout, callbacks) { .style('fill', nodeTextColor); }; -},{"../../components/color":615,"../../components/drawing":637,"../../lib":749,"../../lib/gup":746,"../../registry":880,"./constants":1148,"@plotly/d3-sankey":56,"@plotly/d3-sankey-circular":55,"d3":169,"d3-force":160,"d3-interpolate":162,"tinycolor2":548}],1153:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../lib":778,"../../lib/gup":775,"../../registry":910,"./constants":1179,"@plotly/d3-sankey":56,"@plotly/d3-sankey-circular":55,"d3":169,"d3-force":160,"d3-interpolate":162,"tinycolor2":576}],1184:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193517,7 +195796,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],1154:[function(_dereq_,module,exports){ +},{}],1185:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193569,7 +195848,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":749}],1155:[function(_dereq_,module,exports){ +},{"../../lib":778}],1186:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193588,8 +195867,55 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + role: 'info', + editType: 'calc', + description: [ + 'Only relevant when the axis `type` is *date*.', + 'Sets the period positioning in milliseconds or *M* on the ' + axis + ' axis.', + 'Special values in the form of *M* could be used to declare', + 'the number of months. In this case `n` must be a positive integer.' + ].join(' ') + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + role: 'info', + editType: 'calc', + description: [ + 'Only relevant when the axis `type` is *date*.', + 'Sets the base for period positioning in milliseconds or date string on the ' + axis + ' axis.', + 'When `' + axis + 'period` is round number of weeks,', + 'the `' + axis + 'period0` by default would be on a Sunday i.e. 2000-01-02,', + 'otherwise it would be at 2000-01-01.' + ].join(' ') + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + role: 'style', + editType: 'calc', + description: [ + 'Only relevant when the axis `type` is *date*.', + 'Sets the alignment of data points on the ' + axis + ' axis.' + ].join(' ') + }; +} + module.exports = { x: { valType: 'data_array', @@ -193652,6 +195978,13 @@ module.exports = { ].join(' ') }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', role: 'info', @@ -194152,7 +196485,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":622,"../../components/drawing":637,"../../components/drawing/attributes":636,"../../lib/extend":739,"../../plots/font_attributes":825,"../../plots/template_attributes":875,"./constants":1159}],1156:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../components/drawing":665,"../../components/drawing/attributes":664,"../../lib/extend":768,"../../plots/font_attributes":855,"../../plots/template_attributes":905,"./constants":1190}],1187:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194167,6 +196500,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -194178,8 +196512,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -194210,6 +196547,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -194217,6 +196557,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -194437,7 +196784,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"./arrays_to_calcdata":1154,"./calc_selection":1157,"./colorscale_calc":1158,"./subtypes":1179,"fast-isnumeric":241}],1157:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"./arrays_to_calcdata":1185,"./calc_selection":1188,"./colorscale_calc":1189,"./subtypes":1211,"fast-isnumeric":241}],1188:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194456,7 +196803,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":749}],1158:[function(_dereq_,module,exports){ +},{"../../lib":778}],1189:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194499,7 +196846,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":623,"../../components/colorscale/helpers":626,"./subtypes":1179}],1159:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../components/colorscale/helpers":654,"./subtypes":1211}],1190:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194528,7 +196875,7 @@ module.exports = { eventDataKeys: [] }; -},{}],1160:[function(_dereq_,module,exports){ +},{}],1191:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194709,7 +197056,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":1156}],1161:[function(_dereq_,module,exports){ +},{"./calc":1187}],1192:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194748,7 +197095,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],1162:[function(_dereq_,module,exports){ +},{}],1193:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194766,6 +197113,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -194783,6 +197131,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -194838,7 +197188,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../../registry":880,"./attributes":1155,"./constants":1159,"./fillcolor_defaults":1163,"./line_defaults":1168,"./line_shape_defaults":1170,"./marker_defaults":1174,"./stack_defaults":1177,"./subtypes":1179,"./text_defaults":1180,"./xy_defaults":1181}],1163:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"./attributes":1186,"./constants":1190,"./fillcolor_defaults":1194,"./line_defaults":1199,"./line_shape_defaults":1201,"./marker_defaults":1205,"./period_defaults":1206,"./stack_defaults":1209,"./subtypes":1211,"./text_defaults":1212,"./xy_defaults":1213}],1194:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194875,7 +197225,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":615,"../../lib":749}],1164:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778}],1195:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194901,7 +197251,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":797}],1165:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827}],1196:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194950,7 +197300,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":615,"./subtypes":1179}],1166:[function(_dereq_,module,exports){ +},{"../../components/color":643,"./subtypes":1211}],1197:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195031,8 +197381,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -195145,7 +197495,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":615,"../../components/fx":655,"../../lib":749,"../../registry":880,"./get_trace_color":1165}],1167:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../lib":778,"../../registry":910,"./get_trace_color":1196}],1198:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195197,7 +197547,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./arrays_to_calcdata":1154,"./attributes":1155,"./calc":1156,"./cross_trace_calc":1160,"./cross_trace_defaults":1161,"./defaults":1162,"./format_labels":1164,"./hover":1166,"./marker_colorbar":1173,"./plot":1175,"./select":1176,"./style":1178,"./subtypes":1179}],1168:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./arrays_to_calcdata":1185,"./attributes":1186,"./calc":1187,"./cross_trace_calc":1191,"./cross_trace_defaults":1192,"./defaults":1193,"./format_labels":1195,"./hover":1197,"./marker_colorbar":1204,"./plot":1207,"./select":1208,"./style":1210,"./subtypes":1211}],1199:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195228,7 +197578,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749}],1169:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778}],1200:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195689,7 +198039,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":724,"../../lib":749,"./constants":1159}],1170:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"./constants":1190}],1201:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195708,7 +198058,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],1171:[function(_dereq_,module,exports){ +},{}],1202:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195798,7 +198148,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],1172:[function(_dereq_,module,exports){ +},{}],1203:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195840,7 +198190,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":241}],1173:[function(_dereq_,module,exports){ +},{"fast-isnumeric":241}],1204:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195858,7 +198208,7 @@ module.exports = { max: 'cmax' }; -},{}],1174:[function(_dereq_,module,exports){ +},{}],1205:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195939,7 +198289,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":615,"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"./subtypes":1179}],1175:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"./subtypes":1211}],1206:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":753,"../../lib":778}],1207:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196500,7 +198897,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":637,"../../lib":749,"../../lib/polygon":761,"../../registry":880,"./line_points":1169,"./link_traces":1171,"./subtypes":1179,"d3":169}],1176:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/polygon":790,"../../registry":910,"./line_points":1200,"./link_traces":1202,"./subtypes":1211,"d3":169}],1208:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196554,7 +198951,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":1179}],1177:[function(_dereq_,module,exports){ +},{"./subtypes":1211}],1209:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196659,7 +199056,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],1178:[function(_dereq_,module,exports){ +},{}],1210:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196730,7 +199127,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":637,"../../registry":880,"d3":169}],1179:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../registry":910,"d3":169}],1211:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196769,7 +199166,7 @@ module.exports = { } }; -},{"../../lib":749}],1180:[function(_dereq_,module,exports){ +},{"../../lib":778}],1212:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196799,7 +199196,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":749}],1181:[function(_dereq_,module,exports){ +},{"../../lib":778}],1213:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196843,7 +199240,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":749,"../../registry":880}],1182:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],1214:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197021,7 +199418,7 @@ var attrs = module.exports = overrideAll({ attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; -},{"../../components/colorscale/attributes":622,"../../constants/gl3d_dashes":721,"../../constants/gl3d_markers":722,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1183:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../constants/gl3d_dashes":750,"../../constants/gl3d_markers":751,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1215:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197049,7 +199446,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":1154,"../scatter/colorscale_calc":1158}],1184:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":1185,"../scatter/colorscale_calc":1189}],1216:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197136,7 +199533,7 @@ function calculateErrors(data, scaleFactor, sceneLayout) { module.exports = calculateErrors; -},{"../../registry":880}],1185:[function(_dereq_,module,exports){ +},{"../../registry":910}],1217:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197470,11 +199867,11 @@ function convertPlotlyOptions(scene, data) { return params; } -function arrayToColor(color) { - if(Array.isArray(color)) { +function _arrayToColor(color) { + if(Lib.isArrayOrTypedArray(color)) { var c = color[0]; - if(Array.isArray(c)) color = c; + if(Lib.isArrayOrTypedArray(c)) color = c; return 'rgb(' + color.slice(0, 3).map(function(x) { return Math.round(x * 255); @@ -197484,6 +199881,18 @@ function arrayToColor(color) { return null; } +function arrayToColor(colors) { + if(!Lib.isArrayOrTypedArray(colors)) { + return null; + } + + if((colors.length === 4) && (typeof colors[0] === 'number')) { + return _arrayToColor(colors); + } + + return colors.map(_arrayToColor); +} + proto.update = function(data) { var gl = this.scene.glplot.gl; var lineOptions; @@ -197678,7 +200087,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../components/fx/helpers":651,"../../constants/gl3d_dashes":721,"../../constants/gl3d_markers":722,"../../lib":749,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/cartesian/axes":797,"../scatter/make_bubble_size_func":1172,"./calc_errors":1184,"delaunay-triangulate":171,"gl-error3d":264,"gl-line3d":271,"gl-mesh3d":292,"gl-scatter3d":308}],1186:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":679,"../../constants/gl3d_dashes":750,"../../constants/gl3d_markers":751,"../../lib":778,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/cartesian/axes":827,"../scatter/make_bubble_size_func":1203,"./calc_errors":1216,"delaunay-triangulate":171,"gl-error3d":266,"gl-line3d":275,"gl-mesh3d":309,"gl-scatter3d":330}],1218:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197767,7 +200176,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce, layout) { return len; } -},{"../../lib":749,"../../registry":880,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1182}],1187:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1214}],1219:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197813,7 +200222,7 @@ module.exports = { } }; -},{"../../constants/gl3d_markers":722,"../../plots/gl3d":839,"./attributes":1182,"./calc":1183,"./convert":1185,"./defaults":1186}],1188:[function(_dereq_,module,exports){ +},{"../../constants/gl3d_markers":751,"../../plots/gl3d":869,"./attributes":1214,"./calc":1215,"./convert":1217,"./defaults":1218}],1220:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197941,7 +200350,7 @@ module.exports = { hovertemplate: hovertemplateAttrs() }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1189:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1221:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198000,7 +200409,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../carpet/lookup_carpetid":950,"../scatter/arrays_to_calcdata":1154,"../scatter/calc":1156,"../scatter/calc_selection":1157,"../scatter/colorscale_calc":1158,"fast-isnumeric":241}],1190:[function(_dereq_,module,exports){ +},{"../carpet/lookup_carpetid":980,"../scatter/arrays_to_calcdata":1185,"../scatter/calc":1187,"../scatter/calc_selection":1188,"../scatter/colorscale_calc":1189,"fast-isnumeric":241}],1222:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198090,7 +200499,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/line_shape_defaults":1170,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1188}],1191:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/line_shape_defaults":1201,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1220}],1223:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198111,7 +200520,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],1192:[function(_dereq_,module,exports){ +},{}],1224:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198138,7 +200547,7 @@ module.exports = function formatLabels(cdi, trace) { return labels; }; -},{}],1193:[function(_dereq_,module,exports){ +},{}],1225:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198229,7 +200638,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../lib":749,"../scatter/hover":1166}],1194:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/hover":1197}],1226:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198266,7 +200675,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1188,"./calc":1189,"./defaults":1190,"./event_data":1191,"./format_labels":1192,"./hover":1193,"./plot":1195}],1195:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1220,"./calc":1221,"./defaults":1222,"./event_data":1223,"./format_labels":1224,"./hover":1225,"./plot":1227}],1227:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198310,7 +200719,7 @@ module.exports = function plot(gd, plotinfoproxy, data, layer) { } }; -},{"../../components/drawing":637,"../../plots/cartesian/axes":797,"../scatter/plot":1175}],1196:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../plots/cartesian/axes":827,"../scatter/plot":1207}],1228:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198476,7 +200885,7 @@ module.exports = overrideAll({ hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorscale/attributes":622,"../../components/drawing/attributes":636,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1197:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../components/drawing/attributes":664,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1229:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198544,7 +200953,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../constants/numerical":724,"../../lib":749,"../scatter/arrays_to_calcdata":1154,"../scatter/calc_selection":1157,"../scatter/colorscale_calc":1158,"fast-isnumeric":241}],1198:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../scatter/arrays_to_calcdata":1185,"../scatter/calc_selection":1188,"../scatter/colorscale_calc":1189,"fast-isnumeric":241}],1230:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198627,7 +201036,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1196}],1199:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1228}],1231:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198654,7 +201063,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],1200:[function(_dereq_,module,exports){ +},{}],1232:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198679,7 +201088,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":797}],1201:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827}],1233:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198791,7 +201200,7 @@ function getExtraText(trace, pt, pointData, labels) { return text.join('
'); } -},{"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../scatter/get_trace_color":1165,"./attributes":1196}],1202:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../scatter/get_trace_color":1196,"./attributes":1228}],1234:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198830,7 +201239,7 @@ module.exports = { } }; -},{"../../plots/geo":829,"../scatter/marker_colorbar":1173,"../scatter/style":1178,"./attributes":1196,"./calc":1197,"./defaults":1198,"./event_data":1199,"./format_labels":1200,"./hover":1201,"./plot":1203,"./select":1204,"./style":1205}],1203:[function(_dereq_,module,exports){ +},{"../../plots/geo":859,"../scatter/marker_colorbar":1204,"../scatter/style":1210,"./attributes":1228,"./calc":1229,"./defaults":1230,"./event_data":1231,"./format_labels":1232,"./hover":1233,"./plot":1235,"./select":1236,"./style":1237}],1235:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198959,7 +201368,7 @@ module.exports = { plot: plot }; -},{"../../constants/numerical":724,"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/geojson_utils":743,"../../lib/topojson_utils":776,"../../plots/cartesian/autorange":796,"../scatter/calc":1156,"../scatter/subtypes":1179,"./style":1205,"d3":169}],1204:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/geojson_utils":772,"../../lib/topojson_utils":805,"../../plots/cartesian/autorange":826,"../scatter/calc":1187,"../scatter/subtypes":1211,"./style":1237,"d3":169}],1236:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199016,7 +201425,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"../../constants/numerical":724,"../scatter/subtypes":1179}],1205:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../scatter/subtypes":1211}],1237:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199065,7 +201474,7 @@ function styleTrace(gd, calcTrace) { }); } -},{"../../components/color":615,"../../components/drawing":637,"../scatter/style":1178,"d3":169}],1206:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../scatter/style":1210,"d3":169}],1238:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199096,6 +201505,13 @@ var attrs = module.exports = overrideAll({ y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, hovertext: scatterAttrs.hovertext, @@ -199168,7 +201584,7 @@ attrs.x.editType = attrs.y.editType = attrs.x0.editType = attrs.y0.editType = 'c attrs.hovertemplate = scatterAttrs.hovertemplate; attrs.texttemplate = scatterAttrs.texttemplate; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../scatter/attributes":1155,"./constants":1208}],1207:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../scatter/attributes":1186,"./constants":1240}],1239:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199184,6 +201600,7 @@ var cluster = _dereq_('@plotly/point-cluster'); var Lib = _dereq_('../../lib'); var AxisIDs = _dereq_('../../plots/cartesian/axis_ids'); var findExtremes = _dereq_('../../plots/cartesian/autorange').findExtremes; +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var scatterCalc = _dereq_('../scatter/calc'); var calcMarkerSize = scatterCalc.calcMarkerSize; @@ -199207,8 +201624,15 @@ module.exports = function calc(gd, trace) { var stash = {}; var i, xx, yy; - var x = trace._x = xa.makeCalcdata(trace, 'x'); - var y = trace._y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; + + if(trace.xperiodalignment) trace._origX = origX; + if(trace.yperiodalignment) trace._origY = origY; // we need hi-precision for scatter2d, // regl-scatter2d uses NaNs for bad/missing values @@ -199346,7 +201770,7 @@ function sceneOptions(gd, subplot, trace, positions, x, y) { return opts; } -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/autorange":796,"../../plots/cartesian/axis_ids":800,"../scatter/calc":1156,"../scatter/colorscale_calc":1158,"./constants":1208,"./convert":1209,"./scene_update":1217,"@plotly/point-cluster":57}],1208:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/autorange":826,"../../plots/cartesian/axis_ids":830,"../scatter/calc":1187,"../scatter/colorscale_calc":1189,"./constants":1240,"./convert":1241,"./scene_update":1249,"@plotly/point-cluster":57}],1240:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199379,7 +201803,7 @@ module.exports = { } }; -},{}],1209:[function(_dereq_,module,exports){ +},{}],1241:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200030,7 +202454,7 @@ module.exports = { textPosition: convertTextPosition }; -},{"../../components/drawing":637,"../../components/fx/helpers":651,"../../constants/interactions":723,"../../lib":749,"../../lib/gl_format_color":745,"../../plots/cartesian/axis_ids":800,"../../registry":880,"../scatter/make_bubble_size_func":1172,"../scatter/subtypes":1179,"./constants":1208,"./helpers":1213,"color-normalize":125,"fast-isnumeric":241,"svg-path-sdf":546}],1210:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../components/fx/helpers":679,"../../constants/interactions":752,"../../lib":778,"../../lib/gl_format_color":774,"../../plots/cartesian/axis_ids":830,"../../registry":910,"../scatter/make_bubble_size_func":1203,"../scatter/subtypes":1211,"./constants":1240,"./helpers":1245,"color-normalize":125,"fast-isnumeric":241,"svg-path-sdf":574}],1242:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200049,6 +202473,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('../scatter/constants'); var subTypes = _dereq_('../scatter/subtypes'); var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); var handleLineDefaults = _dereq_('../scatter/line_defaults'); var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); @@ -200067,6 +202492,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut.visible = false; return; } + + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines'; coerce('text'); @@ -200105,7 +202533,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../../registry":880,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"../scatter/xy_defaults":1181,"./attributes":1206,"./helpers":1213}],1211:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/period_defaults":1206,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"../scatter/xy_defaults":1213,"./attributes":1238,"./helpers":1245}],1243:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200161,7 +202589,7 @@ module.exports = { styleTextSelection: styleTextSelection }; -},{"../../components/color":615,"../../constants/interactions":723,"../../lib":749}],1212:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../constants/interactions":752,"../../lib":778}],1244:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200181,7 +202609,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return scatterFormatLabels(cdi, trace, fullLayout); }; -},{"../scatter/format_labels":1164}],1213:[function(_dereq_,module,exports){ +},{"../scatter/format_labels":1195}],1245:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200206,7 +202634,7 @@ exports.isDotSymbol = function(symbol) { symbol > 200; }; -},{"./constants":1208}],1214:[function(_dereq_,module,exports){ +},{"./constants":1240}],1246:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200370,16 +202798,19 @@ function calcHover(pointData, x, y, trace) { var fakeCd = {}; fakeCd[pointData.index] = di; + var origX = trace._origX; + var origY = trace._origY; + var pointData2 = Lib.extendFlat({}, pointData, { color: getTraceColor(trace, di), x0: xp - rad, x1: xp + rad, - xLabelVal: di.x, + xLabelVal: origX ? origX[id] : di.x, y0: yp - rad, y1: yp + rad, - yLabelVal: di.y, + yLabelVal: origY ? origY[id] : di.y, cd: fakeCd, distance: minDist, @@ -200403,7 +202834,7 @@ module.exports = { calcHover: calcHover }; -},{"../../lib":749,"../../registry":880,"../scatter/get_trace_color":1165}],1215:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../scatter/get_trace_color":1196}],1247:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200443,7 +202874,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../scatter/cross_trace_defaults":1161,"../scatter/marker_colorbar":1173,"./attributes":1206,"./calc":1207,"./defaults":1210,"./format_labels":1212,"./hover":1214,"./plot":1216,"./select":1218}],1216:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../scatter/cross_trace_defaults":1192,"../scatter/marker_colorbar":1204,"./attributes":1238,"./calc":1239,"./defaults":1242,"./format_labels":1244,"./hover":1246,"./plot":1248,"./select":1250}],1248:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200812,7 +203243,7 @@ module.exports = function plot(gd, subplot, cdata) { } }; -},{"../../components/dragelement/helpers":633,"../../lib":749,"../../lib/prepare_regl":762,"../scatter/link_traces":1171,"../scatter/subtypes":1179,"./edit_style":1211,"gl-text":326,"regl-error2d":508,"regl-line2d":509,"regl-scatter2d":510}],1217:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":661,"../../lib":778,"../../lib/prepare_regl":791,"../scatter/link_traces":1202,"../scatter/subtypes":1211,"./edit_style":1243,"gl-text":352,"regl-error2d":534,"regl-line2d":535,"regl-scatter2d":537}],1249:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200970,7 +203401,7 @@ module.exports = function sceneUpdate(gd, subplot) { return scene; }; -},{"../../lib":749}],1218:[function(_dereq_,module,exports){ +},{"../../lib":778}],1250:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201049,7 +203480,7 @@ module.exports = function select(searchInfo, selectionTester) { return selection; }; -},{"../scatter/subtypes":1179,"./edit_style":1211}],1219:[function(_dereq_,module,exports){ +},{"../scatter/subtypes":1211,"./edit_style":1243}],1251:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201199,7 +203630,7 @@ module.exports = overrideAll({ hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/mapbox/layout_attributes":856,"../../plots/template_attributes":875,"../scatter/attributes":1155,"../scattergeo/attributes":1196}],1220:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/mapbox/layout_attributes":886,"../../plots/template_attributes":905,"../scatter/attributes":1186,"../scattergeo/attributes":1228}],1252:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201534,7 +203965,7 @@ function isBADNUM(lonlat) { return lonlat[0] === BADNUM; } -},{"../../components/colorscale":627,"../../components/drawing":637,"../../components/fx/helpers":651,"../../constants/numerical":724,"../../lib":749,"../../lib/geojson_utils":743,"../../lib/svg_text_utils":773,"../../plots/mapbox/convert_text_opts":853,"../scatter/make_bubble_size_func":1172,"../scatter/subtypes":1179,"fast-isnumeric":241}],1221:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/drawing":665,"../../components/fx/helpers":679,"../../constants/numerical":753,"../../lib":778,"../../lib/geojson_utils":772,"../../lib/svg_text_utils":802,"../../plots/mapbox/convert_text_opts":883,"../scatter/make_bubble_size_func":1203,"../scatter/subtypes":1211,"fast-isnumeric":241}],1253:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201612,7 +204043,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":749,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1219}],1222:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1251}],1254:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201632,7 +204063,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1223:[function(_dereq_,module,exports){ +},{}],1255:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201658,7 +204089,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":797}],1224:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827}],1256:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201770,7 +204201,7 @@ function getExtraText(trace, di, labels) { return text.join('
'); } -},{"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../scatter/get_trace_color":1165}],1225:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../scatter/get_trace_color":1196}],1257:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201813,7 +204244,7 @@ module.exports = { } }; -},{"../../plots/mapbox":854,"../scatter/marker_colorbar":1173,"../scattergeo/calc":1197,"./attributes":1219,"./defaults":1221,"./event_data":1222,"./format_labels":1223,"./hover":1224,"./plot":1226,"./select":1227}],1226:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":884,"../scatter/marker_colorbar":1204,"../scattergeo/calc":1229,"./attributes":1251,"./defaults":1253,"./event_data":1254,"./format_labels":1255,"./hover":1256,"./plot":1258,"./select":1259}],1258:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201946,7 +204377,7 @@ module.exports = function createScatterMapbox(subplot, calcTrace) { return scatterMapbox; }; -},{"../../plots/mapbox/constants":852,"./convert":1220}],1227:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":882,"./convert":1252}],1259:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202001,7 +204432,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"../../constants/numerical":724,"../../lib":749,"../scatter/subtypes":1179}],1228:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../scatter/subtypes":1211}],1260:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202145,7 +204576,7 @@ module.exports = { unselected: scatterAttrs.unselected }; -},{"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1229:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1261:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202200,7 +204631,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":724,"../../plots/cartesian/axes":797,"../scatter/arrays_to_calcdata":1154,"../scatter/calc":1156,"../scatter/calc_selection":1157,"../scatter/colorscale_calc":1158,"fast-isnumeric":241}],1230:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../plots/cartesian/axes":827,"../scatter/arrays_to_calcdata":1185,"../scatter/calc":1187,"../scatter/calc_selection":1188,"../scatter/colorscale_calc":1189,"fast-isnumeric":241}],1262:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202307,7 +204738,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":749,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/line_shape_defaults":1170,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1228}],1231:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/line_shape_defaults":1201,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1260}],1263:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202349,7 +204780,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../lib":749,"../../plots/cartesian/axes":797}],1232:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827}],1264:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202425,7 +204856,7 @@ module.exports = { makeHoverPointText: makeHoverPointText }; -},{"../scatter/hover":1166}],1233:[function(_dereq_,module,exports){ +},{"../scatter/hover":1197}],1265:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202467,7 +204898,7 @@ module.exports = { } }; -},{"../../plots/polar":863,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1228,"./calc":1229,"./defaults":1230,"./format_labels":1231,"./hover":1232,"./plot":1234}],1234:[function(_dereq_,module,exports){ +},{"../../plots/polar":893,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1260,"./calc":1261,"./defaults":1262,"./format_labels":1263,"./hover":1264,"./plot":1266}],1266:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202517,7 +204948,7 @@ module.exports = function plot(gd, subplot, moduleCalcData) { scatterPlot(gd, plotinfo, moduleCalcData, mlayer); }; -},{"../../constants/numerical":724,"../scatter/plot":1175}],1235:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../scatter/plot":1207}],1267:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202568,7 +204999,7 @@ module.exports = { unselected: scatterPolarAttrs.unselected }; -},{"../../plots/template_attributes":875,"../scattergl/attributes":1206,"../scatterpolar/attributes":1228}],1236:[function(_dereq_,module,exports){ +},{"../../plots/template_attributes":905,"../scattergl/attributes":1238,"../scatterpolar/attributes":1260}],1268:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202620,7 +205051,7 @@ module.exports = function calc(gd, trace) { return [{x: false, y: false, t: stash, trace: trace}]; }; -},{"../../plots/cartesian/axes":797,"../scatter/calc":1156,"../scatter/colorscale_calc":1158,"../scattergl/constants":1208,"../scattergl/convert":1209}],1237:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827,"../scatter/calc":1187,"../scatter/colorscale_calc":1189,"../scattergl/constants":1240,"../scattergl/convert":1241}],1269:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202682,7 +205113,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"../scatterpolar/defaults":1230,"./attributes":1235}],1238:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"../scatterpolar/defaults":1262,"./attributes":1267}],1270:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202702,7 +205133,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return scatterPolarFormatLabels(cdi, trace, fullLayout); }; -},{"../scatterpolar/format_labels":1231}],1239:[function(_dereq_,module,exports){ +},{"../scatterpolar/format_labels":1263}],1271:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202752,7 +205183,7 @@ module.exports = { hoverPoints: hoverPoints }; -},{"../scattergl/hover":1214,"../scatterpolar/hover":1232}],1240:[function(_dereq_,module,exports){ +},{"../scattergl/hover":1246,"../scatterpolar/hover":1264}],1272:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202792,7 +205223,7 @@ module.exports = { } }; -},{"../../plots/polar":863,"../scatter/marker_colorbar":1173,"../scattergl/select":1218,"./attributes":1235,"./calc":1236,"./defaults":1237,"./format_labels":1238,"./hover":1239,"./plot":1241}],1241:[function(_dereq_,module,exports){ +},{"../../plots/polar":893,"../scatter/marker_colorbar":1204,"../scattergl/select":1250,"./attributes":1267,"./calc":1268,"./defaults":1269,"./format_labels":1270,"./hover":1271,"./plot":1273}],1273:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202930,7 +205361,7 @@ module.exports = function plot(gd, subplot, cdata) { return scatterglPlot(gd, subplot, cdata); }; -},{"../../lib":749,"../scattergl/constants":1208,"../scattergl/convert":1209,"../scattergl/plot":1216,"../scattergl/scene_update":1217,"@plotly/point-cluster":57,"fast-isnumeric":241}],1242:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scattergl/constants":1240,"../scattergl/convert":1241,"../scattergl/plot":1248,"../scattergl/scene_update":1249,"@plotly/point-cluster":57,"fast-isnumeric":241}],1274:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203087,7 +205518,7 @@ module.exports = { hovertemplate: hovertemplateAttrs(), }; -},{"../../components/colorscale/attributes":622,"../../components/drawing/attributes":636,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1243:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../components/drawing/attributes":664,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1275:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203168,7 +205599,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":1154,"../scatter/calc":1156,"../scatter/calc_selection":1157,"../scatter/colorscale_calc":1158,"fast-isnumeric":241}],1244:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":1185,"../scatter/calc":1187,"../scatter/calc_selection":1188,"../scatter/colorscale_calc":1189,"fast-isnumeric":241}],1276:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203272,7 +205703,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/line_shape_defaults":1170,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1242}],1245:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/line_shape_defaults":1201,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1274}],1277:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203304,7 +205735,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],1246:[function(_dereq_,module,exports){ +},{}],1278:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203328,7 +205759,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":797}],1247:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827}],1279:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203402,7 +205833,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../scatter/hover":1166}],1248:[function(_dereq_,module,exports){ +},{"../scatter/hover":1197}],1280:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203439,7 +205870,7 @@ module.exports = { } }; -},{"../../plots/ternary":876,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1242,"./calc":1243,"./defaults":1244,"./event_data":1245,"./format_labels":1246,"./hover":1247,"./plot":1249}],1249:[function(_dereq_,module,exports){ +},{"../../plots/ternary":906,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1274,"./calc":1275,"./defaults":1276,"./event_data":1277,"./format_labels":1278,"./hover":1279,"./plot":1281}],1281:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203472,7 +205903,7 @@ module.exports = function plot(gd, ternary, moduleCalcData) { scatterPlot(gd, plotinfo, moduleCalcData, scatterLayer); }; -},{"../scatter/plot":1175}],1250:[function(_dereq_,module,exports){ +},{"../scatter/plot":1207}],1282:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203675,7 +206106,7 @@ module.exports = { opacity: scatterGlAttrs.opacity }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803,"../../plots/template_attributes":875,"../scatter/attributes":1155,"../scattergl/attributes":1206}],1251:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833,"../../plots/template_attributes":905,"../scatter/attributes":1186,"../scattergl/attributes":1238}],1283:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203894,7 +206325,7 @@ module.exports = { toSVG: Cartesian.toSVG }; -},{"../../lib/prepare_regl":762,"../../plots/cartesian":810,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_ids":800,"../../plots/get_data":834,"../../registry":880,"regl-line2d":509}],1252:[function(_dereq_,module,exports){ +},{"../../lib/prepare_regl":791,"../../plots/cartesian":840,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_ids":830,"../../plots/get_data":864,"../../registry":910,"regl-line2d":535}],1284:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204005,7 +206436,7 @@ module.exports = function calc(gd, trace) { return [{x: false, y: false, t: {}, trace: trace}]; }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axis_ids":800,"../scatter/calc":1156,"../scatter/colorscale_calc":1158,"../scattergl/constants":1208,"../scattergl/convert":1209,"./scene_update":1259}],1253:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axis_ids":830,"../scatter/calc":1187,"../scatter/colorscale_calc":1189,"../scattergl/constants":1240,"../scattergl/convert":1241,"./scene_update":1291}],1285:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204182,7 +206613,7 @@ function handleAxisDefaults(traceIn, traceOut, layout, coerce) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../parcoords/merge_length":1126,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scattergl/helpers":1213,"./attributes":1250}],1254:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../parcoords/merge_length":1157,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scattergl/helpers":1245,"./attributes":1282}],1286:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204214,7 +206645,7 @@ module.exports = function editStyle(gd, cd0) { } }; -},{"../../lib":749,"../scatter/colorscale_calc":1158,"../scattergl/convert":1209}],1255:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/colorscale_calc":1189,"../scattergl/convert":1241}],1287:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204238,7 +206669,7 @@ exports.getDimIndex = function getDimIndex(trace, ax) { return false; }; -},{}],1256:[function(_dereq_,module,exports){ +},{}],1288:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204299,7 +206730,7 @@ module.exports = { hoverPoints: hoverPoints }; -},{"../scattergl/hover":1214,"./helpers":1255}],1257:[function(_dereq_,module,exports){ +},{"../scattergl/hover":1246,"./helpers":1287}],1289:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204346,7 +206777,7 @@ module.exports = { // register it here Registry.register(Grid); -},{"../../components/grid":659,"../../registry":880,"../scatter/marker_colorbar":1173,"./attributes":1250,"./base_plot":1251,"./calc":1252,"./defaults":1253,"./edit_style":1254,"./hover":1256,"./plot":1258,"./select":1260}],1258:[function(_dereq_,module,exports){ +},{"../../components/grid":687,"../../registry":910,"../scatter/marker_colorbar":1204,"./attributes":1282,"./base_plot":1283,"./calc":1284,"./defaults":1285,"./edit_style":1286,"./hover":1288,"./plot":1290,"./select":1292}],1290:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204491,7 +206922,7 @@ function plotOne(gd, cd0) { } } -},{"../../components/dragelement/helpers":633,"../../lib":749,"../../plots/cartesian/axis_ids":800,"regl-splom":511}],1259:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":661,"../../lib":778,"../../plots/cartesian/axis_ids":830,"regl-splom":539}],1291:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204563,7 +206994,7 @@ module.exports = function sceneUpdate(gd, trace) { return scene; }; -},{"../../lib":749}],1260:[function(_dereq_,module,exports){ +},{"../../lib":778}],1292:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204638,7 +207069,7 @@ module.exports = function select(searchInfo, selectionTester) { return selection; }; -},{"../../lib":749,"../scatter/subtypes":1179,"./helpers":1255}],1261:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/subtypes":1211,"./helpers":1287}],1293:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204810,7 +207241,7 @@ attrs.transforms = undefined; module.exports = attrs; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../mesh3d/attributes":1096}],1262:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../mesh3d/attributes":1127}],1294:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205066,7 +207497,7 @@ module.exports = { processGrid: processGrid }; -},{"../../components/colorscale/calc":623,"../../lib":749}],1263:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../lib":778}],1295:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205292,7 +207723,7 @@ function createStreamtubeTrace(scene, data) { module.exports = createStreamtubeTrace; -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gl_format_color":745,"../../plots/gl3d/zip3":850,"gl-streamtube3d":323}],1264:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gl_format_color":774,"../../plots/gl3d/zip3":880,"gl-streamtube3d":348}],1296:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205357,7 +207788,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":1261}],1265:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":1293}],1297:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205420,7 +207851,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":1261,"./calc":1262,"./convert":1263,"./defaults":1264}],1266:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1293,"./calc":1294,"./convert":1295,"./defaults":1296}],1298:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205626,11 +208057,36 @@ module.exports = { 'this option won\'t have any effect and `insidetextfont` would be used.' ].join(' ') }), + rotation: { + valType: 'angle', + role: 'style', + dflt: 0, + editType: 'plot', + description: [ + 'Rotates the whole diagram counterclockwise by some angle.', + 'By default the first slice starts at 3 o\'clock.' + ].join(' ') + }, + sort: pieAttrs.sort, + + root: { + color: { + valType: 'color', + editType: 'calc', + role: 'style', + dflt: 'rgba(0,0,0,0)', + description: [ + 'sets the color of the root node for a sunburst or a treemap trace.', + 'this has no effect when a colorscale is used to set the markers.' + ].join(' ') + }, + editType: 'calc' + }, domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'}) }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/template_attributes":875,"../pie/attributes":1129,"./constants":1269}],1267:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/template_attributes":905,"../pie/attributes":1160,"./constants":1301}],1299:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205653,7 +208109,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1268:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1300:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205767,7 +208223,10 @@ exports.calc = function(gd, trace) { label: k }); } else { - return Lib.warn('Multiple implied roots, cannot build ' + trace.type + ' hierarchy.'); + return Lib.warn([ + 'Multiple implied roots, cannot build', trace.type, 'hierarchy of', trace.name + '.', + 'These roots include:', impliedRoots.join(', ') + ].join(' ')); } } else if(parent2children[''].length > 1) { var dummyId = Lib.randstr(); @@ -205796,7 +208255,10 @@ exports.calc = function(gd, trace) { .id(function(d) { return d.id; }) .parentId(function(d) { return d.pid; })(cd); } catch(e) { - return Lib.warn('Failed to build ' + trace.type + ' hierarchy. Error: ' + e.message); + return Lib.warn([ + 'Failed to build', trace.type, 'hierarchy of', trace.name + '.', + 'Error:', e.message + ].join(' ')); } var hierarchy = d3Hierarchy.hierarchy(root); @@ -205826,7 +208288,7 @@ exports.calc = function(gd, trace) { if(v < partialSum * ALMOST_EQUAL) { failed = true; return Lib.warn([ - 'Total value for node', d.data.data.id, + 'Total value for node', d.data.data.id, 'of', trace.name, 'is smaller than the sum of its children.', '\nparent value =', v, '\nchildren sum =', partialSum @@ -205848,7 +208310,9 @@ exports.calc = function(gd, trace) { if(failed) return; // TODO add way to sort by height also? - hierarchy.sort(function(a, b) { return b.value - a.value; }); + if(trace.sort) { + hierarchy.sort(function(a, b) { return b.value - a.value; }); + } var pullColor; var scaleColor; @@ -205924,8 +208388,8 @@ exports._runCrossTraceCalc = function(desiredType, gd) { dfltColorCount++; } } else { - // root gets no coloring by default - cdi.color = 'rgba(0,0,0,0)'; + // set root color. no coloring by default. + cdi.color = cdi.trace.root.color; } } } @@ -205969,7 +208433,7 @@ function countDescendants(node, trace, opts) { return nChild; } -},{"../../components/colorscale":627,"../../constants/numerical":724,"../../lib":749,"../pie/calc":1131,"d3-hierarchy":161,"fast-isnumeric":241}],1269:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../constants/numerical":753,"../../lib":778,"../pie/calc":1162,"d3-hierarchy":161,"fast-isnumeric":241}],1301:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205997,7 +208461,7 @@ module.exports = { ] }; -},{}],1270:[function(_dereq_,module,exports){ +},{}],1302:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206073,13 +208537,19 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('insidetextorientation'); + coerce('sort'); + + coerce('rotation'); + + coerce('root.color'); + handleDomainDefaults(traceOut, layout, coerce); // do not support transforms for now traceOut._length = null; }; -},{"../../components/colorscale":627,"../../lib":749,"../../plots/domain":824,"../bar/defaults":894,"./attributes":1266}],1271:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../plots/domain":854,"../bar/defaults":924,"./attributes":1298}],1303:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206390,7 +208860,7 @@ function makeEventData(pt, trace, keys) { return out; } -},{"../../components/fx":655,"../../components/fx/helpers":651,"../../lib":749,"../../lib/events":738,"../../registry":880,"../pie/helpers":1134,"./helpers":1272,"d3":169}],1272:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../components/fx/helpers":679,"../../lib":778,"../../lib/events":767,"../../registry":910,"../pie/helpers":1165,"./helpers":1304,"d3":169}],1304:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206575,7 +209045,7 @@ exports.formatPercent = function(v, separators) { return tx; }; -},{"../../components/color":615,"../../lib":749,"../../lib/setcursor":769,"../pie/helpers":1134}],1273:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../lib/setcursor":798,"../pie/helpers":1165}],1305:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206615,7 +209085,7 @@ module.exports = { } }; -},{"../scatter/marker_colorbar":1173,"./attributes":1266,"./base_plot":1267,"./calc":1268,"./defaults":1270,"./layout_attributes":1274,"./layout_defaults":1275,"./plot":1276,"./style":1277}],1274:[function(_dereq_,module,exports){ +},{"../scatter/marker_colorbar":1204,"./attributes":1298,"./base_plot":1299,"./calc":1300,"./defaults":1302,"./layout_attributes":1306,"./layout_defaults":1307,"./plot":1308,"./style":1309}],1306:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206656,7 +209126,7 @@ module.exports = { } }; -},{}],1275:[function(_dereq_,module,exports){ +},{}],1307:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206678,7 +209148,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendsunburstcolors'); }; -},{"../../lib":749,"./layout_attributes":1274}],1276:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1306}],1308:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206699,6 +209169,7 @@ var uniformText = _dereq_('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; var clearMinTextSize = uniformText.clearMinTextSize; var piePlot = _dereq_('../pie/plot'); +var getRotationAngle = _dereq_('../pie/helpers').getRotationAngle; var computeTransform = piePlot.computeTransform; var transformInsideText = piePlot.transformInsideText; var styleOne = _dereq_('./style').styleOne; @@ -206831,6 +209302,14 @@ function plotOne(gd, cd, element, transitionOpts) { // filter out slices that won't show up on graph sliceData = sliceData.filter(function(pt) { return pt.y1 <= cutoff; }); + var baseX = getRotationAngle(trace.rotation); + if(baseX) { + sliceData.forEach(function(pt) { + pt.x0 += baseX; + pt.x1 += baseX; + }); + } + // partition span ('y') to sector radial px value var maxY = Math.min(maxHeight, maxDepth); var y2rpx = function(y) { return (y - yOffset) / maxY * rMax; }; @@ -206983,7 +209462,7 @@ function plotOne(gd, cd, element, transitionOpts) { var next; if(entryPrev) { - var a = pt.x1 > entryPrev.x1 ? 2 * Math.PI : 0; + var a = (pt.x1 > entryPrev.x1 ? 2 * Math.PI : 0) + baseX; // if pt to remove: // - if 'below' where the root-node used to be: shrink it radially inward // - otherwise, collapse it clockwise or counterclockwise which ever is shortest to theta=0 @@ -207033,7 +209512,7 @@ function plotOne(gd, cd, element, transitionOpts) { // if new branch, twist it in clockwise or // counterclockwise which ever is shorter to // its final angle - var a = pt.x1 > nextX1ofPrevEntry ? 2 * Math.PI : 0; + var a = (pt.x1 > nextX1ofPrevEntry ? 2 * Math.PI : 0) + baseX; prev = {x0: a, x1: a}; } else { // if new leaf (when maxdepth is set), @@ -207048,7 +209527,7 @@ function plotOne(gd, cd, element, transitionOpts) { } } else { // start sector of new traces from theta=0 - prev = {x0: 0, x1: 0}; + prev = {x0: baseX, x1: baseX}; } } @@ -207091,11 +209570,11 @@ function plotOne(gd, cd, element, transitionOpts) { } } else { // if new root-node - prev.x0 = prev.x1 = 0; + prev.x0 = prev.x1 = baseX; } } else { // on new traces - prev.x0 = prev.x1 = 0; + prev.x0 = prev.x1 = baseX; } } @@ -207309,7 +209788,7 @@ function getCoords(r, angle) { return [r * Math.sin(angle), -r * Math.cos(angle)]; } -},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../bar/style":904,"../bar/uniform_text":906,"../pie/plot":1138,"./constants":1269,"./fx":1271,"./helpers":1272,"./style":1277,"d3":169,"d3-hierarchy":161}],1277:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../bar/style":934,"../bar/uniform_text":936,"../pie/helpers":1165,"../pie/plot":1169,"./constants":1301,"./fx":1303,"./helpers":1304,"./style":1309,"d3":169,"d3-hierarchy":161}],1309:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207360,7 +209839,7 @@ module.exports = { styleOne: styleOne }; -},{"../../components/color":615,"../../lib":749,"../bar/uniform_text":906,"d3":169}],1278:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../bar/uniform_text":936,"d3":169}],1310:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207698,7 +210177,7 @@ colorScaleAttrs('', { attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/color":615,"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875}],1279:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905}],1311:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207730,7 +210209,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":623}],1280:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651}],1312:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208166,8 +210645,7 @@ proto.update = function(data) { var scene = this.scene; var sceneLayout = scene.fullSceneLayout; var surface = this.surface; - var alpha = data.opacity; - var colormap = parseColorScale(data, alpha); + var colormap = parseColorScale(data); var scaleFactor = scene.dataScale; var xlen = data.z[0].length; var ylen = data._ylength; @@ -208412,10 +210890,6 @@ proto.update = function(data) { if('lightposition' in data) { surface.lightPosition = [data.lightposition.x, data.lightposition.y, data.lightposition.z]; } - - if(alpha && alpha < 1) { - surface.supportsTransparency = true; - } }; proto.dispose = function() { @@ -208435,7 +210909,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../heatmap/find_empties":1040,"../heatmap/interp2d":1043,"gl-surface3d":325,"ndarray":469,"ndarray-linear-interpolate":463}],1281:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../heatmap/find_empties":1070,"../heatmap/interp2d":1073,"gl-surface3d":351,"ndarray":495,"ndarray-linear-interpolate":489}],1313:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208609,7 +211083,7 @@ module.exports = { opacityscaleDefaults: opacityscaleDefaults }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../../registry":880,"./attributes":1278}],1282:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../../registry":910,"./attributes":1310}],1314:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208652,7 +211126,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":1278,"./calc":1279,"./convert":1280,"./defaults":1281}],1283:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1310,"./calc":1311,"./convert":1312,"./defaults":1313}],1315:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208857,7 +211331,7 @@ var attrs = module.exports = overrideAll({ }, 'calc', 'from-root'); attrs.transforms = undefined; -},{"../../components/annotations/attributes":598,"../../constants/docs":719,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/domain":824,"../../plots/font_attributes":825}],1284:[function(_dereq_,module,exports){ +},{"../../components/annotations/attributes":626,"../../constants/docs":748,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/domain":854,"../../plots/font_attributes":855}],1316:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208889,7 +211363,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/get_data":834,"./plot":1291}],1285:[function(_dereq_,module,exports){ +},{"../../plots/get_data":864,"./plot":1323}],1317:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208908,7 +211382,7 @@ module.exports = function calc() { return wrap({}); }; -},{"../../lib/gup":746}],1286:[function(_dereq_,module,exports){ +},{"../../lib/gup":775}],1318:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208968,7 +211442,7 @@ module.exports = { } }; -},{}],1287:[function(_dereq_,module,exports){ +},{}],1319:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209163,7 +211637,7 @@ function makeIdentity() { }; } -},{"../../lib/extend":739,"./constants":1286,"fast-isnumeric":241}],1288:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"./constants":1318,"fast-isnumeric":241}],1320:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209246,7 +211720,7 @@ function rowFromTo(d) { return [rowFrom, rowTo]; } -},{"../../lib/extend":739}],1289:[function(_dereq_,module,exports){ +},{"../../lib/extend":768}],1321:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209311,7 +211785,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../lib":749,"../../plots/domain":824,"./attributes":1283}],1290:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/domain":854,"./attributes":1315}],1322:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209342,7 +211816,7 @@ module.exports = { } }; -},{"./attributes":1283,"./base_plot":1284,"./calc":1285,"./defaults":1289,"./plot":1291}],1291:[function(_dereq_,module,exports){ +},{"./attributes":1315,"./base_plot":1316,"./calc":1317,"./defaults":1321,"./plot":1323}],1323:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209359,6 +211833,7 @@ var gup = _dereq_('../../lib/gup'); var Drawing = _dereq_('../../components/drawing'); var svgUtil = _dereq_('../../lib/svg_text_utils'); var raiseToTop = _dereq_('../../lib').raiseToTop; +var strTranslate = _dereq_('../../lib').strTranslate; var cancelEeaseColumn = _dereq_('../../lib').cancelTransition; var prepareData = _dereq_('./data_preparation_helper'); var splitData = _dereq_('./data_split_helpers'); @@ -209391,7 +211866,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { .attr('width', function(d) {return d.width + d.size.l + d.size.r;}) .attr('height', function(d) {return d.height + d.size.t + d.size.b;}) .attr('transform', function(d) { - return 'translate(' + d.translateX + ',' + d.translateY + ')'; + return strTranslate(d.translateX, d.translateY); }); var tableControlView = table.selectAll('.' + c.cn.tableControlView) @@ -209424,7 +211899,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { } tableControlView - .attr('transform', function(d) {return 'translate(' + d.size.l + ' ' + d.size.t + ')';}); + .attr('transform', function(d) {return strTranslate(d.size.l, d.size.t);}); // scrollBackground merely ensures that mouse events are captured even on crazy fast scrollwheeling // otherwise rendering glitches may occur @@ -209453,7 +211928,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { yColumn.exit().remove(); - yColumn.attr('transform', function(d) {return 'translate(' + d.x + ' 0)';}); + yColumn.attr('transform', function(d) {return strTranslate(d.x, 0);}); if(dynamic) { yColumn.call(d3.behavior.drag() @@ -209481,10 +211956,10 @@ module.exports = function plot(gd, wrappedTraceHolders) { .transition() .ease(c.transitionEase) .duration(c.transitionDuration) - .attr('transform', function(d) {return 'translate(' + d.x + ' 0)';}); + .attr('transform', function(d) {return strTranslate(d.x, 0);}); movedColumn .call(cancelEeaseColumn) - .attr('transform', 'translate(' + d.x + ' -' + c.uplift + ' )'); + .attr('transform', strTranslate(d.x, -c.uplift)); }) .on('dragend', function(d) { var movedColumn = d3.select(this); @@ -209639,7 +212114,7 @@ function renderScrollbarKit(tableControlView, gd, bypassVisibleBar) { }) .attr('transform', function(d) { var xPosition = d.width + c.scrollbarWidth / 2 + c.scrollbarOffset; - return 'translate(' + xPosition + ' ' + headerHeight(d) + ')'; + return strTranslate(xPosition, headerHeight(d)); }); var scrollbar = scrollbarKit.selectAll('.' + c.cn.scrollbar) @@ -209658,7 +212133,7 @@ function renderScrollbarKit(tableControlView, gd, bypassVisibleBar) { scrollbarSlider .attr('transform', function(d) { - return 'translate(0 ' + (d.scrollbarState.topY || 0) + ')'; + return strTranslate(0, d.scrollbarState.topY || 0); }); var scrollbarGlyph = scrollbarSlider.selectAll('.' + c.cn.scrollbarGlyph) @@ -209917,7 +212392,7 @@ function populateCellText(cellText, tableControlView, allColumnBlock, gd) { } else { d3.select(element.parentNode) // basic cell adjustment - compliance with `cellPad` - .attr('transform', function(d) {return 'translate(' + xPosition(d) + ' ' + c.cellPad + ')';}) + .attr('transform', function(d) {return strTranslate(xPosition(d), c.cellPad);}) .attr('text-anchor', function(d) { return ({ left: 'start', @@ -209967,7 +212442,7 @@ function easeColumn(selection, d, y) { .transition() .ease(c.releaseTransitionEase) .duration(c.releaseTransitionDuration) - .attr('transform', 'translate(' + d.x + ' ' + y + ')'); + .attr('transform', strTranslate(d.x, y)); } function cellsBlock(d) {return d.type === 'cells';} @@ -210048,7 +212523,7 @@ function updateBlockYPosition(gd, cellsColumnBlock, tableControlView) { cellsColumnBlock .attr('transform', function(d) { var yTranslate = firstRowAnchor(d.rowBlocks, d.page) - d.scrollY; - return 'translate(0 ' + yTranslate + ')'; + return strTranslate(0, yTranslate); }); // conditionally rerendering panel 0 and 1 @@ -210174,7 +212649,7 @@ function updateYPositionMaker(columnBlock, element, tableControlView, gd, d) { var rectBox = d3.select(element.parentNode).select('.' + c.cn.cellRect).node().getBoundingClientRect(); var currentTransform = element.transform.baseVal.consolidate(); var yPosition = rectBox.top - box.top + (currentTransform ? currentTransform.matrix.f : c.cellPad); - return 'translate(' + xPosition(d, d3.select(element.parentNode).select('.' + c.cn.cellTextHolder).node().getBoundingClientRect().width) + ' ' + yPosition + ')'; + return strTranslate(xPosition(d, d3.select(element.parentNode).select('.' + c.cn.cellTextHolder).node().getBoundingClientRect().width), yPosition); }); d.settledY = true; @@ -210197,7 +212672,7 @@ function setCellHeightAndPositionY(columnCell) { var l = getBlock(d); var rowAnchor = rowsHeight(l, d.key); var yOffset = rowAnchor + headerHeight; - return 'translate(0 ' + yOffset + ')'; + return strTranslate(0, yOffset); }) .selectAll('.' + c.cn.cellRect) .attr('height', function(d) {return getRow(getBlock(d), d.key).rowHeight;}); @@ -210238,7 +212713,7 @@ function allRowsHeight(rowBlock) { function getBlock(d) {return d.rowBlocks[d.page];} function getRow(l, i) {return l.rows[i - l.firstRowIndex];} -},{"../../components/color":615,"../../components/drawing":637,"../../lib":749,"../../lib/gup":746,"../../lib/svg_text_utils":773,"./constants":1286,"./data_preparation_helper":1287,"./data_split_helpers":1288,"d3":169}],1292:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../lib":778,"../../lib/gup":775,"../../lib/svg_text_utils":802,"./constants":1318,"./data_preparation_helper":1319,"./data_split_helpers":1320,"d3":169}],1324:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210509,11 +212984,13 @@ module.exports = { 'Sets the positions of the `text` elements.' ].join(' ') }, + sort: pieAttrs.sort, + root: sunburstAttrs.root, domain: domainAttrs({name: 'treemap', trace: true, editType: 'calc'}), }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/domain":824,"../../plots/template_attributes":875,"../pie/attributes":1129,"../sunburst/attributes":1266,"./constants":1295}],1293:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/domain":854,"../../plots/template_attributes":905,"../pie/attributes":1160,"../sunburst/attributes":1298,"./constants":1327}],1325:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210536,7 +213013,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1294:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1326:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210557,7 +213034,7 @@ exports.crossTraceCalc = function(gd) { return calc._runCrossTraceCalc('treemap', gd); }; -},{"../sunburst/calc":1268}],1295:[function(_dereq_,module,exports){ +},{"../sunburst/calc":1300}],1327:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210586,7 +213063,7 @@ module.exports = { gapWithPathbar: 1 // i.e. one pixel }; -},{}],1296:[function(_dereq_,module,exports){ +},{}],1328:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210703,13 +213180,17 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pathbar.edgeshape'); } + coerce('sort'); + + coerce('root.color'); + handleDomainDefaults(traceOut, layout, coerce); // do not support transforms for now traceOut._length = null; }; -},{"../../components/color":615,"../../components/colorscale":627,"../../lib":749,"../../plots/domain":824,"../bar/constants":892,"../bar/defaults":894,"./attributes":1292}],1297:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale":655,"../../lib":778,"../../plots/domain":854,"../bar/constants":922,"../bar/defaults":924,"./attributes":1324}],1329:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210881,7 +213362,7 @@ module.exports = function drawAncestors(gd, cd, entry, slices, opts) { }); }; -},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../sunburst/fx":1271,"../sunburst/helpers":1272,"./constants":1295,"./partition":1302,"./style":1304,"d3":169}],1298:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../sunburst/fx":1303,"../sunburst/helpers":1304,"./constants":1327,"./partition":1334,"./style":1336,"d3":169}],1330:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -211094,7 +213575,7 @@ module.exports = function drawDescendants(gd, cd, entry, slices, opts) { return nextOfPrevEntry; }; -},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../sunburst/fx":1271,"../sunburst/helpers":1272,"../sunburst/plot":1276,"./constants":1295,"./partition":1302,"./style":1304,"d3":169}],1299:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../sunburst/fx":1303,"../sunburst/helpers":1304,"../sunburst/plot":1308,"./constants":1327,"./partition":1334,"./style":1336,"d3":169}],1331:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -211134,7 +213615,7 @@ module.exports = { } }; -},{"../scatter/marker_colorbar":1173,"./attributes":1292,"./base_plot":1293,"./calc":1294,"./defaults":1296,"./layout_attributes":1300,"./layout_defaults":1301,"./plot":1303,"./style":1304}],1300:[function(_dereq_,module,exports){ +},{"../scatter/marker_colorbar":1204,"./attributes":1324,"./base_plot":1325,"./calc":1326,"./defaults":1328,"./layout_attributes":1332,"./layout_defaults":1333,"./plot":1335,"./style":1336}],1332:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -211175,7 +213656,7 @@ module.exports = { } }; -},{}],1301:[function(_dereq_,module,exports){ +},{}],1333:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -211197,7 +213678,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendtreemapcolors'); }; -},{"../../lib":749,"./layout_attributes":1300}],1302:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1332}],1334:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -211303,7 +213784,7 @@ function flipTree(node, size, opts) { } } -},{"d3-hierarchy":161}],1303:[function(_dereq_,module,exports){ +},{"d3-hierarchy":161}],1335:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -211938,7 +214419,7 @@ function plotOne(gd, cd, element, transitionOpts) { } } -},{"../../lib":749,"../bar/constants":892,"../bar/plot":901,"../bar/style":904,"../bar/uniform_text":906,"../sunburst/helpers":1272,"./constants":1295,"./draw_ancestors":1297,"./draw_descendants":1298,"d3":169}],1304:[function(_dereq_,module,exports){ +},{"../../lib":778,"../bar/constants":922,"../bar/plot":931,"../bar/style":934,"../bar/uniform_text":936,"../sunburst/helpers":1304,"./constants":1327,"./draw_ancestors":1329,"./draw_descendants":1330,"d3":169}],1336:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -211988,8 +214469,8 @@ function styleOne(s, pt, trace, opts) { lineColor = trace._hovered.marker.line.color; lineWidth = trace._hovered.marker.line.width; } else { - if(isRoot && fillColor === 'rgba(0,0,0,0)') { - opacity = 0; + if(isRoot && fillColor === trace.root.color) { + opacity = 100; lineColor = 'rgba(0,0,0,0)'; lineWidth = 0; } else { @@ -212040,7 +214521,7 @@ module.exports = { styleOne: styleOne }; -},{"../../components/color":615,"../../lib":749,"../bar/uniform_text":906,"../sunburst/helpers":1272,"d3":169}],1305:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../bar/uniform_text":936,"../sunburst/helpers":1304,"d3":169}],1337:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212059,6 +214540,7 @@ module.exports = { x: boxAttrs.x, x0: boxAttrs.x0, y0: boxAttrs.y0, + name: extendFlat({}, boxAttrs.name, { description: [ 'Sets the trace name.', @@ -212318,7 +214800,7 @@ module.exports = { } }; -},{"../../lib/extend":739,"../box/attributes":915}],1306:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../box/attributes":945}],1338:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212494,7 +214976,7 @@ function calcSpan(trace, cdi, valAxis, bandwidth) { return spanOut; } -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../box/calc":916,"./helpers":1309}],1307:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axes":827,"../box/calc":946,"./helpers":1341}],1339:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212537,7 +215019,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../box/cross_trace_calc":917}],1308:[function(_dereq_,module,exports){ +},{"../box/cross_trace_calc":947}],1340:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212598,7 +215080,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!meanLineVisible) traceOut.meanline = {visible: false}; }; -},{"../../components/color":615,"../../lib":749,"../box/defaults":918,"./attributes":1305}],1309:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../box/defaults":948,"./attributes":1337}],1341:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212671,7 +215153,7 @@ exports.getKdeValue = function(calcItem, trace, valueDist) { exports.extractVal = function(o) { return o.v; }; -},{"../../lib":749}],1310:[function(_dereq_,module,exports){ +},{"../../lib":778}],1342:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212783,7 +215265,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return closeData; }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../box/hover":920,"./helpers":1309}],1311:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../box/hover":950,"./helpers":1341}],1343:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212825,7 +215307,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../box/defaults":918,"../box/select":925,"../scatter/style":1178,"./attributes":1305,"./calc":1306,"./cross_trace_calc":1307,"./defaults":1308,"./hover":1310,"./layout_attributes":1312,"./layout_defaults":1313,"./plot":1314,"./style":1315}],1312:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../box/defaults":948,"../box/select":955,"../scatter/style":1210,"./attributes":1337,"./calc":1338,"./cross_trace_calc":1339,"./defaults":1340,"./hover":1342,"./layout_attributes":1344,"./layout_defaults":1345,"./plot":1346,"./style":1347}],1344:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212867,7 +215349,7 @@ module.exports = { }) }; -},{"../../lib":749,"../box/layout_attributes":922}],1313:[function(_dereq_,module,exports){ +},{"../../lib":778,"../box/layout_attributes":952}],1345:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -212889,7 +215371,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { boxLayoutDefaults._supply(layoutIn, layoutOut, fullData, coerce, 'violin'); }; -},{"../../lib":749,"../box/layout_defaults":923,"./layout_attributes":1312}],1314:[function(_dereq_,module,exports){ +},{"../../lib":778,"../box/layout_defaults":953,"./layout_attributes":1344}],1346:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213079,7 +215561,7 @@ module.exports = function plot(gd, plotinfo, cdViolins, violinLayer) { }); }; -},{"../../components/drawing":637,"../../lib":749,"../box/plot":924,"../scatter/line_points":1169,"./helpers":1309,"d3":169}],1315:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../box/plot":954,"../scatter/line_points":1200,"./helpers":1341,"d3":169}],1347:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213134,7 +215616,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":615,"../scatter/style":1178,"d3":169}],1316:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../scatter/style":1210,"d3":169}],1348:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213215,7 +215697,7 @@ colorScaleAttrs('', { attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../isosurface/attributes":1091,"../surface/attributes":1278}],1317:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../isosurface/attributes":1122,"../surface/attributes":1310}],1349:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213348,7 +215830,7 @@ function createVolumeTrace(scene, data) { module.exports = createVolumeTrace; -},{"../../components/colorscale":627,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/gl3d/zip3":850,"../isosurface/convert":1093,"gl-mesh3d":292}],1318:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/gl3d/zip3":880,"../isosurface/convert":1124,"gl-mesh3d":309}],1350:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213374,7 +215856,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout opacityscaleDefaults(traceIn, traceOut, layout, coerce); }; -},{"../../lib":749,"../isosurface/defaults":1094,"../surface/defaults":1281,"./attributes":1316}],1319:[function(_dereq_,module,exports){ +},{"../../lib":778,"../isosurface/defaults":1125,"../surface/defaults":1313,"./attributes":1348}],1351:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213409,7 +215891,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"../isosurface/calc":1092,"./attributes":1316,"./convert":1317,"./defaults":1318}],1320:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"../isosurface/calc":1123,"./attributes":1348,"./convert":1349,"./defaults":1350}],1352:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213489,6 +215971,13 @@ module.exports = { y0: barAttrs.y0, dy: barAttrs.dy, + xperiod: barAttrs.xperiod, + yperiod: barAttrs.yperiod, + xperiod0: barAttrs.xperiod0, + yperiod0: barAttrs.yperiod0, + xperiodalignment: barAttrs.xperiodalignment, + yperiodalignment: barAttrs.yperiodalignment, + hovertext: barAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys @@ -213569,7 +216058,7 @@ module.exports = { alignmentgroup: barAttrs.alignmentgroup }; -},{"../../components/color":615,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatter/attributes":1155,"./constants":1322}],1321:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatter/attributes":1186,"./constants":1354}],1353:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213581,6 +216070,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var mergeArray = _dereq_('../../lib').mergeArray; var calcSelection = _dereq_('../scatter/calc_selection'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -213596,14 +216086,19 @@ function isTotal(a) { module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -213657,6 +216152,10 @@ module.exports = function calc(gd, trace) { hasTotals = true; } + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cdi.id = String(trace.ids[i]); } @@ -213673,7 +216172,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../scatter/calc_selection":1157}],1322:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../scatter/calc_selection":1188}],1354:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213692,7 +216191,7 @@ module.exports = { ] }; -},{}],1323:[function(_dereq_,module,exports){ +},{}],1355:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213765,7 +216264,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../bar/cross_trace_calc":893}],1324:[function(_dereq_,module,exports){ +},{"../bar/cross_trace_calc":923}],1356:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213781,6 +216280,7 @@ var Lib = _dereq_('../../lib'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var handleText = _dereq_('../bar/defaults').handleText; var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); var Color = _dereq_('../../components/color'); var delta = _dereq_('../../constants/delta.js'); @@ -213806,6 +216306,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('measure'); coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); @@ -213871,7 +216373,7 @@ module.exports = { crossTraceDefaults: crossTraceDefaults }; -},{"../../components/color":615,"../../constants/delta.js":718,"../../lib":749,"../bar/defaults":894,"../scatter/xy_defaults":1181,"./attributes":1320}],1325:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../constants/delta.js":747,"../../lib":778,"../bar/defaults":924,"../scatter/period_defaults":1206,"../scatter/xy_defaults":1213,"./attributes":1352}],1357:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213898,7 +216400,7 @@ module.exports = function eventData(out, pt /* , trace, cd, pointNumber */) { return out; }; -},{}],1326:[function(_dereq_,module,exports){ +},{}],1358:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -213993,7 +216495,7 @@ function getTraceColor(trace, di) { else if(opacity(mlc) && mlw) return mlc; } -},{"../../components/color":615,"../../constants/delta.js":718,"../../plots/cartesian/axes":797,"../bar/hover":897}],1327:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../constants/delta.js":747,"../../plots/cartesian/axes":827,"../bar/hover":927}],1359:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -214035,7 +216537,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../bar/select":902,"./attributes":1320,"./calc":1321,"./cross_trace_calc":1323,"./defaults":1324,"./event_data":1325,"./hover":1326,"./layout_attributes":1328,"./layout_defaults":1329,"./plot":1330,"./style":1331}],1328:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../bar/select":932,"./attributes":1352,"./calc":1353,"./cross_trace_calc":1355,"./defaults":1356,"./event_data":1357,"./hover":1358,"./layout_attributes":1360,"./layout_defaults":1361,"./plot":1362,"./style":1363}],1360:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -214087,7 +216589,7 @@ module.exports = { } }; -},{}],1329:[function(_dereq_,module,exports){ +},{}],1361:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -214124,7 +216626,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":749,"./layout_attributes":1328}],1330:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1360}],1362:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -214255,7 +216757,7 @@ function getXY(di, xa, ya, isHorizontal) { return isHorizontal ? [s, p] : [p, s]; } -},{"../../components/drawing":637,"../../constants/numerical":724,"../../lib":749,"../bar/plot":901,"../bar/uniform_text":906,"d3":169}],1331:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/numerical":753,"../../lib":778,"../bar/plot":931,"../bar/uniform_text":936,"d3":169}],1363:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -214316,7 +216818,7 @@ module.exports = { style: style }; -},{"../../components/color":615,"../../components/drawing":637,"../../constants/interactions":723,"../bar/style":904,"../bar/uniform_text":906,"d3":169}],1332:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../constants/interactions":752,"../bar/style":934,"../bar/uniform_text":936,"d3":169}],1364:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -214782,7 +217284,7 @@ function last(array, indices) { return array[indices[indices.length - 1]]; } -},{"../constants/numerical":724,"../lib":749,"../plot_api/plot_schema":786,"../plots/cartesian/axes":797,"./helpers":1335}],1333:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"../lib":778,"../plot_api/plot_schema":815,"../plots/cartesian/axes":827,"./helpers":1367}],1365:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -215120,7 +217622,7 @@ function getFilterFunc(opts, d2c, targetCalendar) { } } -},{"../constants/filter_ops":720,"../lib":749,"../plots/cartesian/axes":797,"../registry":880,"./helpers":1335}],1334:[function(_dereq_,module,exports){ +},{"../constants/filter_ops":749,"../lib":778,"../plots/cartesian/axes":827,"../registry":910,"./helpers":1367}],1366:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -215404,7 +217906,7 @@ function transformOne(trace, state) { return newData; } -},{"../lib":749,"../plot_api/plot_schema":786,"../plots/plots":860,"./helpers":1335}],1335:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/plot_schema":815,"../plots/plots":890,"./helpers":1367}],1367:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -215430,7 +217932,7 @@ exports.pointsAccessorFunction = function(transforms, opts) { return originalPointsAccessor; }; -},{}],1336:[function(_dereq_,module,exports){ +},{}],1368:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -215597,7 +218099,7 @@ function getSortFunc(opts, d2c) { } } -},{"../constants/numerical":724,"../lib":749,"../plots/cartesian/axes":797,"./helpers":1335}],1337:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"../lib":778,"../plots/cartesian/axes":827,"./helpers":1367}],1369:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -215609,7 +218111,7 @@ function getSortFunc(opts, d2c) { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[26])(26) }); diff --git a/dist/plotly.js b/dist/plotly.js index fc474cb24e5..94ab98cca93 100644 --- a/dist/plotly.js +++ b/dist/plotly.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.55.2 +* plotly.js v1.58.0 * Copyright 2012-2020, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -72,7 +72,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":749}],2:[function(_dereq_,module,exports){ +},{"../src/lib":778}],2:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85,7 +85,7 @@ for(var selector in rules) { module.exports = _dereq_('../src/transforms/aggregate'); -},{"../src/transforms/aggregate":1332}],3:[function(_dereq_,module,exports){ +},{"../src/transforms/aggregate":1364}],3:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98,7 +98,7 @@ module.exports = _dereq_('../src/transforms/aggregate'); module.exports = _dereq_('../src/traces/bar'); -},{"../src/traces/bar":898}],4:[function(_dereq_,module,exports){ +},{"../src/traces/bar":928}],4:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111,7 +111,7 @@ module.exports = _dereq_('../src/traces/bar'); module.exports = _dereq_('../src/traces/barpolar'); -},{"../src/traces/barpolar":911}],5:[function(_dereq_,module,exports){ +},{"../src/traces/barpolar":941}],5:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -124,7 +124,7 @@ module.exports = _dereq_('../src/traces/barpolar'); module.exports = _dereq_('../src/traces/box'); -},{"../src/traces/box":921}],6:[function(_dereq_,module,exports){ +},{"../src/traces/box":951}],6:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -137,7 +137,7 @@ module.exports = _dereq_('../src/traces/box'); module.exports = _dereq_('../src/components/calendars'); -},{"../src/components/calendars":613}],7:[function(_dereq_,module,exports){ +},{"../src/components/calendars":641}],7:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150,7 +150,7 @@ module.exports = _dereq_('../src/components/calendars'); module.exports = _dereq_('../src/traces/candlestick'); -},{"../src/traces/candlestick":930}],8:[function(_dereq_,module,exports){ +},{"../src/traces/candlestick":960}],8:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163,7 +163,7 @@ module.exports = _dereq_('../src/traces/candlestick'); module.exports = _dereq_('../src/traces/carpet'); -},{"../src/traces/carpet":949}],9:[function(_dereq_,module,exports){ +},{"../src/traces/carpet":979}],9:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -176,7 +176,7 @@ module.exports = _dereq_('../src/traces/carpet'); module.exports = _dereq_('../src/traces/choropleth'); -},{"../src/traces/choropleth":963}],10:[function(_dereq_,module,exports){ +},{"../src/traces/choropleth":993}],10:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189,7 +189,7 @@ module.exports = _dereq_('../src/traces/choropleth'); module.exports = _dereq_('../src/traces/choroplethmapbox'); -},{"../src/traces/choroplethmapbox":970}],11:[function(_dereq_,module,exports){ +},{"../src/traces/choroplethmapbox":1000}],11:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202,7 +202,7 @@ module.exports = _dereq_('../src/traces/choroplethmapbox'); module.exports = _dereq_('../src/traces/cone'); -},{"../src/traces/cone":976}],12:[function(_dereq_,module,exports){ +},{"../src/traces/cone":1006}],12:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -215,7 +215,7 @@ module.exports = _dereq_('../src/traces/cone'); module.exports = _dereq_('../src/traces/contour'); -},{"../src/traces/contour":991}],13:[function(_dereq_,module,exports){ +},{"../src/traces/contour":1021}],13:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -228,7 +228,7 @@ module.exports = _dereq_('../src/traces/contour'); module.exports = _dereq_('../src/traces/contourcarpet'); -},{"../src/traces/contourcarpet":1002}],14:[function(_dereq_,module,exports){ +},{"../src/traces/contourcarpet":1032}],14:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -241,7 +241,7 @@ module.exports = _dereq_('../src/traces/contourcarpet'); module.exports = _dereq_('../src/core'); -},{"../src/core":726}],15:[function(_dereq_,module,exports){ +},{"../src/core":755}],15:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -254,7 +254,7 @@ module.exports = _dereq_('../src/core'); module.exports = _dereq_('../src/traces/densitymapbox'); -},{"../src/traces/densitymapbox":1010}],16:[function(_dereq_,module,exports){ +},{"../src/traces/densitymapbox":1040}],16:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -267,7 +267,7 @@ module.exports = _dereq_('../src/traces/densitymapbox'); module.exports = _dereq_('../src/transforms/filter'); -},{"../src/transforms/filter":1333}],17:[function(_dereq_,module,exports){ +},{"../src/transforms/filter":1365}],17:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -280,7 +280,7 @@ module.exports = _dereq_('../src/transforms/filter'); module.exports = _dereq_('../src/traces/funnel'); -},{"../src/traces/funnel":1020}],18:[function(_dereq_,module,exports){ +},{"../src/traces/funnel":1050}],18:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -293,7 +293,7 @@ module.exports = _dereq_('../src/traces/funnel'); module.exports = _dereq_('../src/traces/funnelarea'); -},{"../src/traces/funnelarea":1029}],19:[function(_dereq_,module,exports){ +},{"../src/traces/funnelarea":1059}],19:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -306,7 +306,7 @@ module.exports = _dereq_('../src/traces/funnelarea'); module.exports = _dereq_('../src/transforms/groupby'); -},{"../src/transforms/groupby":1334}],20:[function(_dereq_,module,exports){ +},{"../src/transforms/groupby":1366}],20:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -319,7 +319,7 @@ module.exports = _dereq_('../src/transforms/groupby'); module.exports = _dereq_('../src/traces/heatmap'); -},{"../src/traces/heatmap":1042}],21:[function(_dereq_,module,exports){ +},{"../src/traces/heatmap":1072}],21:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -332,7 +332,7 @@ module.exports = _dereq_('../src/traces/heatmap'); module.exports = _dereq_('../src/traces/heatmapgl'); -},{"../src/traces/heatmapgl":1052}],22:[function(_dereq_,module,exports){ +},{"../src/traces/heatmapgl":1082}],22:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -345,7 +345,7 @@ module.exports = _dereq_('../src/traces/heatmapgl'); module.exports = _dereq_('../src/traces/histogram'); -},{"../src/traces/histogram":1064}],23:[function(_dereq_,module,exports){ +},{"../src/traces/histogram":1094}],23:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -358,7 +358,7 @@ module.exports = _dereq_('../src/traces/histogram'); module.exports = _dereq_('../src/traces/histogram2d'); -},{"../src/traces/histogram2d":1070}],24:[function(_dereq_,module,exports){ +},{"../src/traces/histogram2d":1100}],24:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -371,7 +371,7 @@ module.exports = _dereq_('../src/traces/histogram2d'); module.exports = _dereq_('../src/traces/histogram2dcontour'); -},{"../src/traces/histogram2dcontour":1074}],25:[function(_dereq_,module,exports){ +},{"../src/traces/histogram2dcontour":1104}],25:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -384,7 +384,7 @@ module.exports = _dereq_('../src/traces/histogram2dcontour'); module.exports = _dereq_('../src/traces/image'); -},{"../src/traces/image":1081}],26:[function(_dereq_,module,exports){ +},{"../src/traces/image":1112}],26:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -496,7 +496,7 @@ module.exports = Plotly; module.exports = _dereq_('../src/traces/indicator'); -},{"../src/traces/indicator":1089}],28:[function(_dereq_,module,exports){ +},{"../src/traces/indicator":1120}],28:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -509,7 +509,7 @@ module.exports = _dereq_('../src/traces/indicator'); module.exports = _dereq_('../src/traces/isosurface'); -},{"../src/traces/isosurface":1095}],29:[function(_dereq_,module,exports){ +},{"../src/traces/isosurface":1126}],29:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -522,7 +522,7 @@ module.exports = _dereq_('../src/traces/isosurface'); module.exports = _dereq_('../src/traces/mesh3d'); -},{"../src/traces/mesh3d":1100}],30:[function(_dereq_,module,exports){ +},{"../src/traces/mesh3d":1131}],30:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -535,7 +535,7 @@ module.exports = _dereq_('../src/traces/mesh3d'); module.exports = _dereq_('../src/traces/ohlc'); -},{"../src/traces/ohlc":1105}],31:[function(_dereq_,module,exports){ +},{"../src/traces/ohlc":1136}],31:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -548,7 +548,7 @@ module.exports = _dereq_('../src/traces/ohlc'); module.exports = _dereq_('../src/traces/parcats'); -},{"../src/traces/parcats":1114}],32:[function(_dereq_,module,exports){ +},{"../src/traces/parcats":1145}],32:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -561,7 +561,7 @@ module.exports = _dereq_('../src/traces/parcats'); module.exports = _dereq_('../src/traces/parcoords'); -},{"../src/traces/parcoords":1124}],33:[function(_dereq_,module,exports){ +},{"../src/traces/parcoords":1155}],33:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -574,7 +574,7 @@ module.exports = _dereq_('../src/traces/parcoords'); module.exports = _dereq_('../src/traces/pie'); -},{"../src/traces/pie":1135}],34:[function(_dereq_,module,exports){ +},{"../src/traces/pie":1166}],34:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -587,7 +587,7 @@ module.exports = _dereq_('../src/traces/pie'); module.exports = _dereq_('../src/traces/pointcloud'); -},{"../src/traces/pointcloud":1144}],35:[function(_dereq_,module,exports){ +},{"../src/traces/pointcloud":1175}],35:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -600,7 +600,7 @@ module.exports = _dereq_('../src/traces/pointcloud'); module.exports = _dereq_('../src/traces/sankey'); -},{"../src/traces/sankey":1150}],36:[function(_dereq_,module,exports){ +},{"../src/traces/sankey":1181}],36:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -613,7 +613,7 @@ module.exports = _dereq_('../src/traces/sankey'); module.exports = _dereq_('../src/traces/scatter3d'); -},{"../src/traces/scatter3d":1187}],37:[function(_dereq_,module,exports){ +},{"../src/traces/scatter3d":1219}],37:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -626,7 +626,7 @@ module.exports = _dereq_('../src/traces/scatter3d'); module.exports = _dereq_('../src/traces/scattercarpet'); -},{"../src/traces/scattercarpet":1194}],38:[function(_dereq_,module,exports){ +},{"../src/traces/scattercarpet":1226}],38:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -639,7 +639,7 @@ module.exports = _dereq_('../src/traces/scattercarpet'); module.exports = _dereq_('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":1202}],39:[function(_dereq_,module,exports){ +},{"../src/traces/scattergeo":1234}],39:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -652,7 +652,7 @@ module.exports = _dereq_('../src/traces/scattergeo'); module.exports = _dereq_('../src/traces/scattergl'); -},{"../src/traces/scattergl":1215}],40:[function(_dereq_,module,exports){ +},{"../src/traces/scattergl":1247}],40:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -665,7 +665,7 @@ module.exports = _dereq_('../src/traces/scattergl'); module.exports = _dereq_('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":1225}],41:[function(_dereq_,module,exports){ +},{"../src/traces/scattermapbox":1257}],41:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -678,7 +678,7 @@ module.exports = _dereq_('../src/traces/scattermapbox'); module.exports = _dereq_('../src/traces/scatterpolar'); -},{"../src/traces/scatterpolar":1233}],42:[function(_dereq_,module,exports){ +},{"../src/traces/scatterpolar":1265}],42:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -691,7 +691,7 @@ module.exports = _dereq_('../src/traces/scatterpolar'); module.exports = _dereq_('../src/traces/scatterpolargl'); -},{"../src/traces/scatterpolargl":1240}],43:[function(_dereq_,module,exports){ +},{"../src/traces/scatterpolargl":1272}],43:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -704,7 +704,7 @@ module.exports = _dereq_('../src/traces/scatterpolargl'); module.exports = _dereq_('../src/traces/scatterternary'); -},{"../src/traces/scatterternary":1248}],44:[function(_dereq_,module,exports){ +},{"../src/traces/scatterternary":1280}],44:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -717,7 +717,7 @@ module.exports = _dereq_('../src/traces/scatterternary'); module.exports = _dereq_('../src/transforms/sort'); -},{"../src/transforms/sort":1336}],45:[function(_dereq_,module,exports){ +},{"../src/transforms/sort":1368}],45:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -730,7 +730,7 @@ module.exports = _dereq_('../src/transforms/sort'); module.exports = _dereq_('../src/traces/splom'); -},{"../src/traces/splom":1257}],46:[function(_dereq_,module,exports){ +},{"../src/traces/splom":1289}],46:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -743,7 +743,7 @@ module.exports = _dereq_('../src/traces/splom'); module.exports = _dereq_('../src/traces/streamtube'); -},{"../src/traces/streamtube":1265}],47:[function(_dereq_,module,exports){ +},{"../src/traces/streamtube":1297}],47:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -756,7 +756,7 @@ module.exports = _dereq_('../src/traces/streamtube'); module.exports = _dereq_('../src/traces/sunburst'); -},{"../src/traces/sunburst":1273}],48:[function(_dereq_,module,exports){ +},{"../src/traces/sunburst":1305}],48:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -769,7 +769,7 @@ module.exports = _dereq_('../src/traces/sunburst'); module.exports = _dereq_('../src/traces/surface'); -},{"../src/traces/surface":1282}],49:[function(_dereq_,module,exports){ +},{"../src/traces/surface":1314}],49:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -782,7 +782,7 @@ module.exports = _dereq_('../src/traces/surface'); module.exports = _dereq_('../src/traces/table'); -},{"../src/traces/table":1290}],50:[function(_dereq_,module,exports){ +},{"../src/traces/table":1322}],50:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -795,7 +795,7 @@ module.exports = _dereq_('../src/traces/table'); module.exports = _dereq_('../src/traces/treemap'); -},{"../src/traces/treemap":1299}],51:[function(_dereq_,module,exports){ +},{"../src/traces/treemap":1331}],51:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -808,7 +808,7 @@ module.exports = _dereq_('../src/traces/treemap'); module.exports = _dereq_('../src/traces/violin'); -},{"../src/traces/violin":1311}],52:[function(_dereq_,module,exports){ +},{"../src/traces/violin":1343}],52:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -821,7 +821,7 @@ module.exports = _dereq_('../src/traces/violin'); module.exports = _dereq_('../src/traces/volume'); -},{"../src/traces/volume":1319}],53:[function(_dereq_,module,exports){ +},{"../src/traces/volume":1351}],53:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -834,7 +834,7 @@ module.exports = _dereq_('../src/traces/volume'); module.exports = _dereq_('../src/traces/waterfall'); -},{"../src/traces/waterfall":1327}],54:[function(_dereq_,module,exports){ +},{"../src/traces/waterfall":1359}],54:[function(_dereq_,module,exports){ 'use strict' module.exports = createViewController @@ -957,7 +957,7 @@ function createViewController(options) { matrix: matrix }, mode) } -},{"matrix-camera-controller":454,"orbit-camera-controller":475,"turntable-camera-controller":553}],55:[function(_dereq_,module,exports){ +},{"matrix-camera-controller":480,"orbit-camera-controller":501,"turntable-camera-controller":581}],55:[function(_dereq_,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, _dereq_('d3-array'), _dereq_('d3-collection'), _dereq_('d3-shape'), _dereq_('elementary-circuits-directed-graph')) : typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-collection', 'd3-shape', 'elementary-circuits-directed-graph'], factory) : @@ -3165,7 +3165,7 @@ function normalize (pts, bounds) { return result } -},{"array-bounds":70,"binary-search-bounds":96,"clamp":120,"defined":170,"dtype":175,"flatten-vertex-data":244,"is-obj":442,"math-log2":453,"parse-rect":478,"pick-by-alias":485}],59:[function(_dereq_,module,exports){ +},{"array-bounds":70,"binary-search-bounds":96,"clamp":120,"defined":170,"dtype":175,"flatten-vertex-data":244,"is-obj":468,"math-log2":479,"parse-rect":504,"pick-by-alias":511}],59:[function(_dereq_,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var meta_1 = _dereq_("@turf/meta"); @@ -5255,7 +5255,7 @@ function createABigTriangle(gl) { module.exports = createABigTriangle -},{"gl-buffer":258,"gl-vao":332,"weak-map":574}],65:[function(_dereq_,module,exports){ +},{"gl-buffer":259,"gl-vao":358,"weak-map":602}],65:[function(_dereq_,module,exports){ module.exports = absolutize @@ -5342,7 +5342,7 @@ function addLineNumbers (string, start, delim) { }).join('\n') } -},{"pad-left":476}],67:[function(_dereq_,module,exports){ +},{"pad-left":502}],67:[function(_dereq_,module,exports){ 'use strict' module.exports = affineHull @@ -5394,7 +5394,7 @@ function affineHull(points) { } return index } -},{"robust-orientation":520}],68:[function(_dereq_,module,exports){ +},{"robust-orientation":548}],68:[function(_dereq_,module,exports){ 'use strict' module.exports = alphaComplex @@ -5420,7 +5420,7 @@ var bnd = _dereq_('simplicial-complex-boundary') function alphaShape(alpha, points) { return bnd(ac(alpha, points)) } -},{"alpha-complex":68,"simplicial-complex-boundary":527}],70:[function(_dereq_,module,exports){ +},{"alpha-complex":68,"simplicial-complex-boundary":555}],70:[function(_dereq_,module,exports){ 'use strict' module.exports = normalize; @@ -5518,7 +5518,7 @@ module.exports = function newArray(start, end) { return a } },{}],73:[function(_dereq_,module,exports){ -(function (global){ +(function (global){(function (){ 'use strict'; var objectAssign = _dereq_('object-assign'); @@ -6026,8 +6026,8 @@ var objectKeys = Object.keys || function (obj) { return keys; }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":473,"util/":76}],74:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"object-assign":499,"util/":76}],74:[function(_dereq_,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -6060,7 +6060,7 @@ module.exports = function isBuffer(arg) { && typeof arg.readUInt8 === 'function'; } },{}],76:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6648,8 +6648,8 @@ function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":75,"_process":500,"inherits":74}],77:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":75,"_process":526,"inherits":74}],77:[function(_dereq_,module,exports){ module.exports = function _atob(str) { return atob(str) } @@ -6702,7 +6702,7 @@ function barycentric(simplex, point) { } return y } -},{"robust-linear-solve":519}],79:[function(_dereq_,module,exports){ +},{"robust-linear-solve":547}],79:[function(_dereq_,module,exports){ 'use strict' exports.byteLength = byteLength @@ -11160,7 +11160,7 @@ function boxIntersectWrapper(arg0, arg1, arg2) { throw new Error('box-intersect: Invalid arguments') } } -},{"./lib/intersect":103,"./lib/sweep":107,"typedarray-pool":567}],102:[function(_dereq_,module,exports){ +},{"./lib/intersect":103,"./lib/sweep":107,"typedarray-pool":595}],102:[function(_dereq_,module,exports){ 'use strict' var DIMENSION = 'd' @@ -11800,7 +11800,7 @@ function boxIntersectIter( } } } -},{"./brute":102,"./median":104,"./partition":105,"./sweep":107,"bit-twiddle":97,"typedarray-pool":567}],104:[function(_dereq_,module,exports){ +},{"./brute":102,"./median":104,"./partition":105,"./sweep":107,"bit-twiddle":97,"typedarray-pool":595}],104:[function(_dereq_,module,exports){ 'use strict' module.exports = findMedian @@ -12636,7 +12636,7 @@ red_loop: } } } -},{"./sort":106,"bit-twiddle":97,"typedarray-pool":567}],108:[function(_dereq_,module,exports){ +},{"./sort":106,"bit-twiddle":97,"typedarray-pool":595}],108:[function(_dereq_,module,exports){ },{}],109:[function(_dereq_,module,exports){ arguments[4][108][0].apply(exports,arguments) @@ -12662,182 +12662,143 @@ arguments[4][108][0].apply(exports,arguments) // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -var objectCreate = Object.create || objectCreatePolyfill -var objectKeys = Object.keys || objectKeysPolyfill -var bind = Function.prototype.bind || functionBindPolyfill +'use strict'; -function EventEmitter() { - if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { - this._events = objectCreate(null); - this._eventsCount = 0; +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); } - this._maxListeners = this._maxListeners || undefined; +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); } module.exports = EventEmitter; +module.exports.once = once; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. var defaultMaxListeners = 10; -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; - } - }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } } +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } this._maxListeners = n; return this; }; -function $getMaxListeners(that) { +function _getMaxListeners(that) { if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); + return _getMaxListeners(this); }; -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); - } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); - } -} - EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); var doError = (type === 'error'); - events = this._events; - if (events) - doError = (doError && events.error == null); + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); else if (!doError) return false; // If there is no 'error' event listener then throw. if (doError) { - if (arguments.length > 1) - er = arguments[1]; + var er; + if (args.length > 0) + er = args[0]; if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; } - return false; + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = events[type]; + var handler = events[type]; - if (!handler) + if (handler === undefined) return false; - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; @@ -12848,19 +12809,18 @@ function _addListener(target, type, listener, prepend) { var events; var existing; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = target._events; - if (!events) { - events = target._events = objectCreate(null); + if (events === undefined) { + events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". - if (events.newListener) { + if (events.newListener !== undefined) { target.emit('newListener', type, - listener.listener ? listener.listener : listener); + listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object @@ -12869,7 +12829,7 @@ function _addListener(target, type, listener, prepend) { existing = events[type]; } - if (!existing) { + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; @@ -12877,33 +12837,29 @@ function _addListener(target, type, listener, prepend) { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { + prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); } // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } @@ -12925,44 +12881,29 @@ function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; - switch (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: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); + var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; @@ -12972,20 +12913,19 @@ EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); + checkListener(listener); events = this._events; - if (!events) + if (events === undefined) return this; list = events[type]; - if (!list) + if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else { delete events[type]; if (events.removeListener) @@ -13007,35 +12947,38 @@ EventEmitter.prototype.removeListener = if (position === 0) list.shift(); - else + else { spliceOne(list, position); + } if (list.length === 1) events[type] = list[0]; - if (events.removeListener) + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; - if (!events) + if (events === undefined) return this; // not listening for removeListener, no need to emit - if (!events.removeListener) { + if (events.removeListener === undefined) { if (arguments.length === 0) { - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; - } else if (events[type]) { + } else if (events[type] !== undefined) { if (--this._eventsCount === 0) - this._events = objectCreate(null); + this._events = Object.create(null); else delete events[type]; } @@ -13044,7 +12987,7 @@ EventEmitter.prototype.removeAllListeners = // emit removeListener for all listeners on all events if (arguments.length === 0) { - var keys = objectKeys(events); + var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; @@ -13052,7 +12995,7 @@ EventEmitter.prototype.removeAllListeners = this.removeAllListeners(key); } this.removeAllListeners('removeListener'); - this._events = objectCreate(null); + this._events = Object.create(null); this._eventsCount = 0; return this; } @@ -13061,7 +13004,7 @@ EventEmitter.prototype.removeAllListeners = if (typeof listeners === 'function') { this.removeListener(type, listeners); - } else if (listeners) { + } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); @@ -13074,17 +13017,18 @@ EventEmitter.prototype.removeAllListeners = function _listeners(target, type, unwrap) { var events = target._events; - if (!events) + if (events === undefined) return []; var evlistener = events[type]; - if (!evlistener) + if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { @@ -13107,12 +13051,12 @@ EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; - if (events) { + if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; - } else if (evlistener) { + } else if (evlistener !== undefined) { return evlistener.length; } } @@ -13121,16 +13065,9 @@ function listenerCount(type) { } EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) @@ -13138,6 +13075,12 @@ function arrayClone(arr, n) { return copy; } +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { @@ -13146,27 +13089,37 @@ function unwrapListeners(arr) { return ret; } -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } },{}],111:[function(_dereq_,module,exports){ -(function (Buffer){ +(function (Buffer){(function (){ /*! * The buffer module from node.js, for the browser. * @@ -14945,8 +14898,8 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -}).call(this,_dereq_("buffer").Buffer) -},{"base64-js":79,"buffer":111,"ieee754":416}],112:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"base64-js":79,"buffer":111,"ieee754":442}],112:[function(_dereq_,module,exports){ 'use strict' var monotoneTriangulate = _dereq_('./lib/monotone') @@ -15147,7 +15100,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":96,"robust-in-sphere":518}],114:[function(_dereq_,module,exports){ +},{"binary-search-bounds":96,"robust-in-sphere":546}],114:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -15518,7 +15471,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":96,"robust-orientation":520}],116:[function(_dereq_,module,exports){ +},{"binary-search-bounds":96,"robust-orientation":548}],116:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -15712,7 +15665,7 @@ function circumcenter(points) { circumcenter.barycenetric = barycentricCircumcenter module.exports = circumcenter -},{"dup":176,"robust-linear-solve":519}],119:[function(_dereq_,module,exports){ +},{"dup":176,"robust-linear-solve":547}],119:[function(_dereq_,module,exports){ module.exports = circumradius var circumcenter = _dereq_('circumcenter') @@ -16120,7 +16073,7 @@ function cleanPSLG (points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":122,"big-rat":83,"big-rat/cmp":81,"big-rat/to-float":95,"box-intersect":101,"nextafter":470,"rat-vec":504,"robust-segment-intersect":523,"union-find":568}],122:[function(_dereq_,module,exports){ +},{"./lib/rat-seg-intersect":122,"big-rat":83,"big-rat/cmp":81,"big-rat/to-float":95,"box-intersect":101,"nextafter":496,"rat-vec":530,"robust-segment-intersect":551,"union-find":596}],122:[function(_dereq_,module,exports){ 'use strict' module.exports = solveIntersection @@ -16164,7 +16117,7 @@ function solveIntersection (a, b, c, d) { return r } -},{"big-rat/div":82,"big-rat/mul":92,"big-rat/sign":93,"big-rat/sub":94,"rat-vec/add":503,"rat-vec/muls":505,"rat-vec/sub":506}],123:[function(_dereq_,module,exports){ +},{"big-rat/div":82,"big-rat/mul":92,"big-rat/sign":93,"big-rat/sub":94,"rat-vec/add":529,"rat-vec/muls":531,"rat-vec/sub":532}],123:[function(_dereq_,module,exports){ /** @module color-id */ 'use strict' @@ -16441,7 +16394,7 @@ function isInt(color) { } },{"clamp":120,"color-rgba":127,"dtype":175}],126:[function(_dereq_,module,exports){ -(function (global){ +(function (global){(function (){ /** * @module color-parse */ @@ -16618,8 +16571,8 @@ function parse (cstr) { } } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"color-name":124,"defined":170,"is-plain-obj":443}],127:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"color-name":124,"defined":170,"is-plain-obj":469}],127:[function(_dereq_,module,exports){ /** @module color-rgba */ 'use strict' @@ -17013,7 +16966,7 @@ function rgbaStr (rgba) { return 'rgba(' + rgba.join(',') + ')'; } -},{"./colorScale":130,"lerp":446}],132:[function(_dereq_,module,exports){ +},{"./colorScale":130,"lerp":472}],132:[function(_dereq_,module,exports){ "use strict" module.exports = compareAngle @@ -17099,7 +17052,7 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":520,"robust-product":521,"robust-sum":525,"signum":526,"two-sum":555}],133:[function(_dereq_,module,exports){ +},{"robust-orientation":548,"robust-product":549,"robust-sum":553,"signum":554,"two-sum":583}],133:[function(_dereq_,module,exports){ module.exports = compareCells var min = Math.min @@ -17240,7 +17193,7 @@ function convexHull2D(points) { return edges } -},{"monotone-convex-hull-2d":456}],138:[function(_dereq_,module,exports){ +},{"monotone-convex-hull-2d":482}],138:[function(_dereq_,module,exports){ 'use strict' module.exports = convexHullnD @@ -17301,7 +17254,7 @@ function convexHullnD(points, d) { return invPermute(nhull, ah) } } -},{"affine-hull":67,"incremental-convex-hull":433}],139:[function(_dereq_,module,exports){ +},{"affine-hull":67,"incremental-convex-hull":459}],139:[function(_dereq_,module,exports){ module.exports = { AFG: 'afghan', ALA: '\\b\\wland', @@ -17740,7 +17693,7 @@ function parseLineHeight(value) { return value } -},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"string-split-by":540,"unquote":570}],147:[function(_dereq_,module,exports){ +},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"string-split-by":568,"unquote":598}],147:[function(_dereq_,module,exports){ 'use strict' var pick = _dereq_('pick-by-alias') @@ -17844,7 +17797,7 @@ function a2o (a) { return o } -},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"pick-by-alias":485}],148:[function(_dereq_,module,exports){ +},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"pick-by-alias":511}],148:[function(_dereq_,module,exports){ module.exports=[ "inherit", "initial", @@ -18372,7 +18325,7 @@ function generateCWiseOp(proc, typesig) { } module.exports = generateCWiseOp -},{"uniq":569}],153:[function(_dereq_,module,exports){ +},{"uniq":597}],153:[function(_dereq_,module,exports){ "use strict" // The function below is called when constructing a cwise function object, and does the following: @@ -18495,7 +18448,7 @@ module.exports = function (props/*, options*/) { return map(props, function (desc, name) { return define(name, desc, options); }); }; -},{"es5-ext/object/copy":196,"es5-ext/object/map":204,"es5-ext/object/normalize-options":205,"type/plain-function/ensure":561,"type/value/ensure":565,"type/value/is":566}],155:[function(_dereq_,module,exports){ +},{"es5-ext/object/copy":196,"es5-ext/object/map":204,"es5-ext/object/normalize-options":205,"type/plain-function/ensure":589,"type/value/ensure":593,"type/value/is":594}],155:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("type/value/is") @@ -18559,7 +18512,7 @@ d.gs = function (dscr, get, set/*, options*/) { return !options ? desc : assign(normalizeOpts(options), desc); }; -},{"es5-ext/object/assign":193,"es5-ext/object/normalize-options":205,"es5-ext/string/#/contains":212,"type/plain-function/is":562,"type/value/is":566}],156:[function(_dereq_,module,exports){ +},{"es5-ext/object/assign":193,"es5-ext/object/normalize-options":205,"es5-ext/string/#/contains":212,"type/plain-function/is":590,"type/value/is":594}],156:[function(_dereq_,module,exports){ // https://d3js.org/d3-array/ v1.2.4 Copyright 2018 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -36079,7 +36032,7 @@ function triangulate(points, includePointAtInfinity) { return hull } -},{"incremental-convex-hull":433,"uniq":569}],172:[function(_dereq_,module,exports){ +},{"incremental-convex-hull":459,"uniq":597}],172:[function(_dereq_,module,exports){ 'use strict' @@ -36150,7 +36103,7 @@ function createPairs (range) { } },{}],173:[function(_dereq_,module,exports){ -(function (Buffer){ +(function (Buffer){(function (){ var hasTypedArrays = false if(typeof Float64Array !== "undefined") { var DOUBLE_VIEW = new Float64Array(1) @@ -36252,7 +36205,7 @@ module.exports.denormalized = function(n) { var hi = module.exports.hi(n) return !(hi & 0x7ff00000) } -}).call(this,_dereq_("buffer").Buffer) +}).call(this)}).call(this,_dereq_("buffer").Buffer) },{"buffer":111}],174:[function(_dereq_,module,exports){ var abs = _dereq_('abs-svg-path') var normalize = _dereq_('normalize-svg-path') @@ -36279,7 +36232,7 @@ module.exports = function(context, segments) { context.closePath() } -},{"abs-svg-path":65,"normalize-svg-path":471}],175:[function(_dereq_,module,exports){ +},{"abs-svg-path":65,"normalize-svg-path":497}],175:[function(_dereq_,module,exports){ module.exports = function(dtype) { switch (dtype) { case 'int8': @@ -37070,7 +37023,7 @@ function edgeToAdjacency(edges, numVertices) { } return adj } -},{"uniq":569}],179:[function(_dereq_,module,exports){ +},{"uniq":597}],179:[function(_dereq_,module,exports){ var tarjan = _dereq_('strongly-connected-components'); module.exports = function findCircuits(edges, cb) { @@ -37228,7 +37181,7 @@ module.exports = function findCircuits(edges, cb) { } }; -},{"strongly-connected-components":541}],180:[function(_dereq_,module,exports){ +},{"strongly-connected-components":569}],180:[function(_dereq_,module,exports){ // Inspired by Google Closure: // http://closure-library.googlecode.com/svn/docs/ // closure_goog_array_array.js.html#goog.array.clear @@ -38129,7 +38082,7 @@ module.exports = function (value) { }; },{"./is-iterable":221}],224:[function(_dereq_,module,exports){ -(function (process,global){ +(function (process,global){(function (){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -39305,8 +39258,8 @@ return Promise$1; -}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":500}],225:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":526}],225:[function(_dereq_,module,exports){ "use strict"; module.exports = _dereq_("./is-implemented")() @@ -39732,7 +39685,7 @@ module.exports = function(n) { return n - n < 1; }; -},{"is-string-blank":444}],242:[function(_dereq_,module,exports){ +},{"is-string-blank":470}],242:[function(_dereq_,module,exports){ 'use strict' module.exports = createFilteredVector @@ -42220,7 +42173,7 @@ function createBackgroundCube(gl) { return new BackgroundCube(gl, buffer, vao, shader) } -},{"./shaders":254,"gl-buffer":258,"gl-vao":332}],252:[function(_dereq_,module,exports){ +},{"./shaders":254,"gl-buffer":259,"gl-vao":358}],252:[function(_dereq_,module,exports){ "use strict" module.exports = getCubeEdges @@ -42462,7 +42415,7 @@ function getCubeEdges(model, view, projection, bounds, ortho) { //Return result return CUBE_RESULT } -},{"bit-twiddle":97,"gl-mat4/multiply":280,"robust-orientation":520,"split-polygon":538}],253:[function(_dereq_,module,exports){ +},{"bit-twiddle":97,"gl-mat4/multiply":295,"robust-orientation":548,"split-polygon":566}],253:[function(_dereq_,module,exports){ 'use strict' module.exports = createLines @@ -42672,7 +42625,7 @@ function createLines(gl, bounds, ticks) { return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } -},{"./shaders":254,"gl-buffer":258,"gl-vao":332}],254:[function(_dereq_,module,exports){ +},{"./shaders":254,"gl-buffer":259,"gl-vao":358}],254:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -42703,8 +42656,8 @@ exports.bg = function(gl) { ]) } -},{"gl-shader":312,"glslify":413}],255:[function(_dereq_,module,exports){ -(function (process){ +},{"gl-shader":335,"glslify":257}],255:[function(_dereq_,module,exports){ +(function (process){(function (){ "use strict" module.exports = createTextSprites @@ -42924,8 +42877,8 @@ function createTextSprites( return result } -}).call(this,_dereq_('_process')) -},{"./shaders":254,"_process":500,"gl-buffer":258,"gl-vao":332,"vectorize-text":572}],256:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process')) +},{"./shaders":254,"_process":526,"gl-buffer":259,"gl-vao":358,"vectorize-text":600}],256:[function(_dereq_,module,exports){ 'use strict' exports.create = defaultTicks @@ -43007,6 +42960,18 @@ function ticksEqual(ticksA, ticksB) { return true } },{}],257:[function(_dereq_,module,exports){ +module.exports = function(strings) { + if (typeof strings === 'string') strings = [strings] + var exprs = [].slice.call(arguments,1) + var parts = [] + for (var i = 0; i < strings.length-1; i++) { + parts.push(strings[i], exprs[i] || '') + } + parts.push(strings[i]) + return parts.join('') +} + +},{}],258:[function(_dereq_,module,exports){ "use strict" module.exports = axesProperties @@ -43150,7 +43115,7 @@ i_loop: return ranges } -},{"./lib/cube.js":252,"extract-frustum-planes":240,"gl-mat4/multiply":280,"gl-mat4/transpose":289,"gl-vec4/transformMat4":403,"split-polygon":538}],258:[function(_dereq_,module,exports){ +},{"./lib/cube.js":252,"extract-frustum-planes":240,"gl-mat4/multiply":295,"gl-mat4/transpose":306,"gl-vec4/transformMat4":429,"split-polygon":566}],259:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -43304,7 +43269,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":469,"ndarray-ops":464,"typedarray-pool":567}],259:[function(_dereq_,module,exports){ +},{"ndarray":495,"ndarray-ops":490,"typedarray-pool":595}],260:[function(_dereq_,module,exports){ "use strict"; var vec3 = _dereq_('gl-vec3'); @@ -43442,7 +43407,7 @@ module.exports.createConeMesh = function(gl, params) { }); } -},{"./create_mesh":260,"./lib/shaders":261,"gl-vec3":351}],260:[function(_dereq_,module,exports){ +},{"./create_mesh":261,"./lib/shaders":262,"gl-vec3":377}],261:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -44017,7 +43982,7 @@ function createVectorMesh(gl, params, opts) { module.exports = createVectorMesh -},{"colormap":131,"gl-buffer":258,"gl-mat4/invert":278,"gl-mat4/multiply":280,"gl-shader":312,"gl-texture2d":327,"gl-vao":332,"ndarray":469}],261:[function(_dereq_,module,exports){ +},{"colormap":131,"gl-buffer":259,"gl-mat4/invert":293,"gl-mat4/multiply":295,"gl-shader":335,"gl-texture2d":353,"gl-vao":358,"ndarray":495}],262:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["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;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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"]) @@ -44045,7 +44010,9 @@ exports.pickShader = { ] } -},{"glslify":413}],262:[function(_dereq_,module,exports){ +},{"glslify":263}],263:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],264:[function(_dereq_,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -44345,14 +44312,14 @@ module.exports = { 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],263:[function(_dereq_,module,exports){ +},{}],265:[function(_dereq_,module,exports){ var gl10 = _dereq_('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":262}],264:[function(_dereq_,module,exports){ +},{"./1.0/numbers":264}],266:[function(_dereq_,module,exports){ 'use strict' module.exports = createErrorBars @@ -44603,7 +44570,9 @@ function createErrorBars(options) { return result } -},{"./shaders/index":265,"gl-buffer":258,"gl-vao":332}],265:[function(_dereq_,module,exports){ +},{"./shaders/index":268,"gl-buffer":259,"gl-vao":358}],267:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],268:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -44620,7 +44589,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":312,"glslify":413}],266:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":267}],269:[function(_dereq_,module,exports){ 'use strict' var createTexture = _dereq_('gl-texture2d') @@ -45087,7 +45056,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":327}],267:[function(_dereq_,module,exports){ +},{"gl-texture2d":353}],270:[function(_dereq_,module,exports){ var sprintf = _dereq_('sprintf-js').sprintf; var glConstants = _dereq_('gl-constants/lookup'); @@ -45142,7 +45111,7 @@ function formatCompilerError(errLog, src, type) { } -},{"add-line-numbers":66,"gl-constants/lookup":263,"glsl-shader-name":405,"sprintf-js":539}],268:[function(_dereq_,module,exports){ +},{"add-line-numbers":66,"gl-constants/lookup":265,"glsl-shader-name":431,"sprintf-js":567}],271:[function(_dereq_,module,exports){ 'use strict' module.exports = createHeatmap2D @@ -45494,7 +45463,7 @@ function createHeatmap2D (plot, options) { return heatmap } -},{"./lib/shaders":269,"binary-search-bounds":96,"gl-buffer":258,"gl-shader":312,"iota-array":437,"typedarray-pool":567}],269:[function(_dereq_,module,exports){ +},{"./lib/shaders":272,"binary-search-bounds":96,"gl-buffer":259,"gl-shader":335,"iota-array":463,"typedarray-pool":595}],272:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -45506,7 +45475,9 @@ module.exports = { pickVertex: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]) } -},{"glslify":413}],270:[function(_dereq_,module,exports){ +},{"glslify":273}],273:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],274:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') @@ -45530,7 +45501,7 @@ exports.createPickShader = function(gl) { return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) } -},{"gl-shader":312,"glslify":413}],271:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":276}],275:[function(_dereq_,module,exports){ 'use strict' module.exports = createLinePlot @@ -45931,7 +45902,43 @@ function createLinePlot (options) { return linePlot } -},{"./lib/shaders":270,"binary-search-bounds":96,"gl-buffer":258,"gl-texture2d":327,"gl-vao":332,"ndarray":469}],272:[function(_dereq_,module,exports){ +},{"./lib/shaders":274,"binary-search-bounds":96,"gl-buffer":259,"gl-texture2d":353,"gl-vao":358,"ndarray":495}],276:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],277:[function(_dereq_,module,exports){ +module.exports = adjoint; + +/** + * Calculates the adjugate of a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function adjoint(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); + out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); + out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); + out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); + out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); + out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); + out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); + out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); + out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); + out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); + out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); + out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); + out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); + out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); + out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); + out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); + return out; +}; +},{}],278:[function(_dereq_,module,exports){ module.exports = clone; /** @@ -45960,7 +45967,36 @@ function clone(a) { out[15] = a[15]; return out; }; -},{}],273:[function(_dereq_,module,exports){ +},{}],279:[function(_dereq_,module,exports){ +module.exports = copy; + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +}; +},{}],280:[function(_dereq_,module,exports){ module.exports = create; /** @@ -45988,7 +46024,7 @@ function create() { out[15] = 1; return out; }; -},{}],274:[function(_dereq_,module,exports){ +},{}],281:[function(_dereq_,module,exports){ module.exports = determinant; /** @@ -46019,7 +46055,7 @@ function determinant(a) { // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; -},{}],275:[function(_dereq_,module,exports){ +},{}],282:[function(_dereq_,module,exports){ module.exports = fromQuat; /** @@ -46067,7 +46103,62 @@ function fromQuat(out, q) { return out; }; -},{}],276:[function(_dereq_,module,exports){ +},{}],283:[function(_dereq_,module,exports){ +module.exports = fromRotation + +/** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotate(dest, dest, rad, axis) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ +function fromRotation(out, rad, axis) { + var s, c, t + var x = axis[0] + var y = axis[1] + var z = axis[2] + var len = Math.sqrt(x * x + y * y + z * z) + + if (Math.abs(len) < 0.000001) { + return null + } + + len = 1 / len + x *= len + y *= len + z *= len + + s = Math.sin(rad) + c = Math.cos(rad) + t = 1 - c + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c + out[1] = y * x * t + z * s + out[2] = z * x * t - y * s + out[3] = 0 + out[4] = x * y * t - z * s + out[5] = y * y * t + c + out[6] = z * y * t + x * s + out[7] = 0 + out[8] = x * z * t + y * s + out[9] = y * z * t - x * s + out[10] = z * z * t + c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],284:[function(_dereq_,module,exports){ module.exports = fromRotationTranslation; /** @@ -46121,7 +46212,223 @@ function fromRotationTranslation(out, q, v) { return out; }; -},{}],277:[function(_dereq_,module,exports){ +},{}],285:[function(_dereq_,module,exports){ +module.exports = fromScaling + +/** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.scale(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ +function fromScaling(out, v) { + out[0] = v[0] + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = v[1] + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = v[2] + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} + +},{}],286:[function(_dereq_,module,exports){ +module.exports = fromTranslation + +/** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.translate(dest, dest, vec) + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +function fromTranslation(out, v) { + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = v[0] + out[13] = v[1] + out[14] = v[2] + out[15] = 1 + return out +} + +},{}],287:[function(_dereq_,module,exports){ +module.exports = fromXRotation + +/** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateX(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromXRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = 1 + out[1] = 0 + out[2] = 0 + out[3] = 0 + out[4] = 0 + out[5] = c + out[6] = s + out[7] = 0 + out[8] = 0 + out[9] = -s + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],288:[function(_dereq_,module,exports){ +module.exports = fromYRotation + +/** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateY(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromYRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = 0 + out[2] = -s + out[3] = 0 + out[4] = 0 + out[5] = 1 + out[6] = 0 + out[7] = 0 + out[8] = s + out[9] = 0 + out[10] = c + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],289:[function(_dereq_,module,exports){ +module.exports = fromZRotation + +/** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest) + * mat4.rotateZ(dest, dest, rad) + * + * @param {mat4} out mat4 receiving operation result + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ +function fromZRotation(out, rad) { + var s = Math.sin(rad), + c = Math.cos(rad) + + // Perform axis-specific matrix multiplication + out[0] = c + out[1] = s + out[2] = 0 + out[3] = 0 + out[4] = -s + out[5] = c + out[6] = 0 + out[7] = 0 + out[8] = 0 + out[9] = 0 + out[10] = 1 + out[11] = 0 + out[12] = 0 + out[13] = 0 + out[14] = 0 + out[15] = 1 + return out +} +},{}],290:[function(_dereq_,module,exports){ +module.exports = frustum; + +/** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ +function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left), + tb = 1 / (top - bottom), + nf = 1 / (near - far); + out[0] = (near * 2) * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = (near * 2) * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (far * near * 2) * nf; + out[15] = 0; + return out; +}; +},{}],291:[function(_dereq_,module,exports){ module.exports = identity; /** @@ -46149,7 +46456,40 @@ function identity(out) { out[15] = 1; return out; }; -},{}],278:[function(_dereq_,module,exports){ +},{}],292:[function(_dereq_,module,exports){ +module.exports = { + create: _dereq_('./create') + , clone: _dereq_('./clone') + , copy: _dereq_('./copy') + , identity: _dereq_('./identity') + , transpose: _dereq_('./transpose') + , invert: _dereq_('./invert') + , adjoint: _dereq_('./adjoint') + , determinant: _dereq_('./determinant') + , multiply: _dereq_('./multiply') + , translate: _dereq_('./translate') + , scale: _dereq_('./scale') + , rotate: _dereq_('./rotate') + , rotateX: _dereq_('./rotateX') + , rotateY: _dereq_('./rotateY') + , rotateZ: _dereq_('./rotateZ') + , fromRotation: _dereq_('./fromRotation') + , fromRotationTranslation: _dereq_('./fromRotationTranslation') + , fromScaling: _dereq_('./fromScaling') + , fromTranslation: _dereq_('./fromTranslation') + , fromXRotation: _dereq_('./fromXRotation') + , fromYRotation: _dereq_('./fromYRotation') + , fromZRotation: _dereq_('./fromZRotation') + , fromQuat: _dereq_('./fromQuat') + , frustum: _dereq_('./frustum') + , perspective: _dereq_('./perspective') + , perspectiveFromFieldOfView: _dereq_('./perspectiveFromFieldOfView') + , ortho: _dereq_('./ortho') + , lookAt: _dereq_('./lookAt') + , str: _dereq_('./str') +} + +},{"./adjoint":277,"./clone":278,"./copy":279,"./create":280,"./determinant":281,"./fromQuat":282,"./fromRotation":283,"./fromRotationTranslation":284,"./fromScaling":285,"./fromTranslation":286,"./fromXRotation":287,"./fromYRotation":288,"./fromZRotation":289,"./frustum":290,"./identity":291,"./invert":293,"./lookAt":294,"./multiply":295,"./ortho":296,"./perspective":297,"./perspectiveFromFieldOfView":298,"./rotate":299,"./rotateX":300,"./rotateY":301,"./rotateZ":302,"./scale":303,"./str":304,"./translate":305,"./transpose":306}],293:[function(_dereq_,module,exports){ module.exports = invert; /** @@ -46205,7 +46545,7 @@ function invert(out, a) { return out; }; -},{}],279:[function(_dereq_,module,exports){ +},{}],294:[function(_dereq_,module,exports){ var identity = _dereq_('./identity'); module.exports = lookAt; @@ -46296,7 +46636,7 @@ function lookAt(out, eye, center, up) { return out; }; -},{"./identity":277}],280:[function(_dereq_,module,exports){ +},{"./identity":291}],295:[function(_dereq_,module,exports){ module.exports = multiply; /** @@ -46339,7 +46679,7 @@ function multiply(out, a, b) { out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; -},{}],281:[function(_dereq_,module,exports){ +},{}],296:[function(_dereq_,module,exports){ module.exports = ortho; /** @@ -46376,7 +46716,7 @@ function ortho(out, left, right, bottom, top, near, far) { out[15] = 1; return out; }; -},{}],282:[function(_dereq_,module,exports){ +},{}],297:[function(_dereq_,module,exports){ module.exports = perspective; /** @@ -46410,7 +46750,49 @@ function perspective(out, fovy, aspect, near, far) { out[15] = 0; return out; }; -},{}],283:[function(_dereq_,module,exports){ +},{}],298:[function(_dereq_,module,exports){ +module.exports = perspectiveFromFieldOfView; + +/** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI/180.0), + downTan = Math.tan(fov.downDegrees * Math.PI/180.0), + leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0), + rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; +} + + +},{}],299:[function(_dereq_,module,exports){ module.exports = rotate; /** @@ -46475,7 +46857,7 @@ function rotate(out, a, rad, axis) { } return out; }; -},{}],284:[function(_dereq_,module,exports){ +},{}],300:[function(_dereq_,module,exports){ module.exports = rotateX; /** @@ -46520,7 +46902,7 @@ function rotateX(out, a, rad) { out[11] = a23 * c - a13 * s; return out; }; -},{}],285:[function(_dereq_,module,exports){ +},{}],301:[function(_dereq_,module,exports){ module.exports = rotateY; /** @@ -46565,7 +46947,7 @@ function rotateY(out, a, rad) { out[11] = a03 * s + a23 * c; return out; }; -},{}],286:[function(_dereq_,module,exports){ +},{}],302:[function(_dereq_,module,exports){ module.exports = rotateZ; /** @@ -46610,7 +46992,7 @@ function rotateZ(out, a, rad) { out[7] = a13 * c - a03 * s; return out; }; -},{}],287:[function(_dereq_,module,exports){ +},{}],303:[function(_dereq_,module,exports){ module.exports = scale; /** @@ -46642,7 +47024,22 @@ function scale(out, a, v) { out[15] = a[15]; return out; }; -},{}],288:[function(_dereq_,module,exports){ +},{}],304:[function(_dereq_,module,exports){ +module.exports = str; + +/** + * Returns a string representation of a mat4 + * + * @param {mat4} mat matrix to represent as a string + * @returns {String} string representation of the matrix + */ +function str(a) { + return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')'; +}; +},{}],305:[function(_dereq_,module,exports){ module.exports = translate; /** @@ -46681,7 +47078,7 @@ function translate(out, a, v) { return out; }; -},{}],289:[function(_dereq_,module,exports){ +},{}],306:[function(_dereq_,module,exports){ module.exports = transpose; /** @@ -46731,7 +47128,7 @@ function transpose(out, a) { return out; }; -},{}],290:[function(_dereq_,module,exports){ +},{}],307:[function(_dereq_,module,exports){ 'use strict' var barycentric = _dereq_('barycentric') @@ -46829,7 +47226,7 @@ function closestPointToPickLocation(simplex, pixelCoord, model, view, projection } return [closestIndex, interpolate(simplex, weights), weights] } -},{"barycentric":78,"polytope-closest-point/lib/closest_point_2d.js":499}],291:[function(_dereq_,module,exports){ +},{"barycentric":78,"polytope-closest-point/lib/closest_point_2d.js":525}],308:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\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;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\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 f_color = color;\n f_data = position;\n f_uv = uv;\n}\n"]) @@ -46898,7 +47295,7 @@ exports.contourShader = { ] } -},{"glslify":413}],292:[function(_dereq_,module,exports){ +},{"glslify":310}],309:[function(_dereq_,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -48009,7 +48406,9 @@ function createSimplicialMesh(gl, params) { module.exports = createSimplicialMesh -},{"./lib/closest-point":290,"./lib/shaders":291,"colormap":131,"gl-buffer":258,"gl-mat4/invert":278,"gl-mat4/multiply":280,"gl-shader":312,"gl-texture2d":327,"gl-vao":332,"ndarray":469,"normals":472,"simplicial-complex-contour":528,"typedarray-pool":567}],293:[function(_dereq_,module,exports){ +},{"./lib/closest-point":307,"./lib/shaders":308,"colormap":131,"gl-buffer":259,"gl-mat4/invert":293,"gl-mat4/multiply":295,"gl-shader":335,"gl-texture2d":353,"gl-vao":358,"ndarray":495,"normals":498,"simplicial-complex-contour":556,"typedarray-pool":595}],310:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],311:[function(_dereq_,module,exports){ 'use strict' module.exports = createBoxes @@ -48072,7 +48471,7 @@ function createBoxes(plot) { return new Boxes(plot, vbo, shader) } -},{"./shaders":296,"gl-buffer":258,"gl-shader":312}],294:[function(_dereq_,module,exports){ +},{"./shaders":314,"gl-buffer":259,"gl-shader":335}],312:[function(_dereq_,module,exports){ 'use strict' module.exports = createGrid @@ -48319,7 +48718,7 @@ function createGrid(plot) { return grid } -},{"./shaders":296,"binary-search-bounds":96,"gl-buffer":258,"gl-shader":312}],295:[function(_dereq_,module,exports){ +},{"./shaders":314,"binary-search-bounds":96,"gl-buffer":259,"gl-shader":335}],313:[function(_dereq_,module,exports){ 'use strict' module.exports = createLines @@ -48384,7 +48783,7 @@ function createLines(plot) { return lines } -},{"./shaders":296,"gl-buffer":258,"gl-shader":312}],296:[function(_dereq_,module,exports){ +},{"./shaders":314,"gl-buffer":259,"gl-shader":335}],314:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -48402,7 +48801,7 @@ module.exports = { tickVert: glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"]) } -},{"glslify":413}],297:[function(_dereq_,module,exports){ +},{"glslify":316}],315:[function(_dereq_,module,exports){ 'use strict' module.exports = createTextElements @@ -48680,7 +49079,9 @@ function createTextElements(plot) { return text } -},{"./shaders":296,"binary-search-bounds":96,"gl-buffer":258,"gl-shader":312,"text-cache":547}],298:[function(_dereq_,module,exports){ +},{"./shaders":314,"binary-search-bounds":96,"gl-buffer":259,"gl-shader":335,"text-cache":575}],316:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],317:[function(_dereq_,module,exports){ 'use strict' module.exports = createGLPlot2D @@ -49263,7 +49664,7 @@ function createGLPlot2D(options) { return plot } -},{"./lib/box":293,"./lib/grid":294,"./lib/line":295,"./lib/text":297,"gl-select-static":311}],299:[function(_dereq_,module,exports){ +},{"./lib/box":311,"./lib/grid":312,"./lib/line":313,"./lib/text":315,"gl-select-static":334}],318:[function(_dereq_,module,exports){ 'use strict' module.exports = createCamera @@ -49456,23 +49857,17 @@ function createCamera(element, options) { var xy = mouseOffset(ev.changedTouches[0], element) handleInteraction(0, xy[0], xy[1], camera._lastMods) handleInteraction(1, xy[0], xy[1], camera._lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) + }, hasPassive ? {passive: true} : false) element.addEventListener('touchmove', function (ev) { var xy = mouseOffset(ev.changedTouches[0], element) handleInteraction(1, xy[0], xy[1], camera._lastMods) - ev.preventDefault() }, hasPassive ? {passive: false} : false) element.addEventListener('touchend', function (ev) { - handleInteraction(0, camera._lastX, camera._lastY, camera._lastMods) - - ev.preventDefault() - }, hasPassive ? {passive: false} : false) + }, hasPassive ? {passive: true} : false) function handleInteraction (buttons, x, y, mods) { var keyBindingMode = camera.keyBindingMode @@ -49550,7 +49945,7 @@ function createCamera(element, options) { return camera } -},{"3d-view":54,"has-passive-events":415,"mouse-change":457,"mouse-event-offset":458,"mouse-wheel":460,"right-now":514}],300:[function(_dereq_,module,exports){ +},{"3d-view":54,"has-passive-events":441,"mouse-change":483,"mouse-event-offset":484,"mouse-wheel":486,"right-now":542}],319:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var createShader = _dereq_('gl-shader') @@ -49561,7 +49956,9 @@ module.exports = function(gl) { return createShader(gl, vertSrc, fragSrc, null, [ { name: 'position', type: 'vec2'}]) } -},{"gl-shader":312,"glslify":413}],301:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":320}],320:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],321:[function(_dereq_,module,exports){ 'use strict' var createCamera = _dereq_('./camera.js') @@ -50416,7 +50813,7 @@ function calcCameraParams(scene, isOrtho) { } } -},{"./camera.js":299,"./lib/shader":300,"a-big-triangle":64,"gl-axes3d":250,"gl-axes3d/properties":257,"gl-fbo":266,"gl-mat4/ortho":281,"gl-mat4/perspective":282,"gl-select-static":311,"gl-spikes3d":321,"is-mobile":441,"mouse-change":457}],302:[function(_dereq_,module,exports){ +},{"./camera.js":318,"./lib/shader":319,"a-big-triangle":64,"gl-axes3d":250,"gl-axes3d/properties":258,"gl-fbo":269,"gl-mat4/ortho":296,"gl-mat4/perspective":297,"gl-select-static":334,"gl-spikes3d":345,"is-mobile":467,"mouse-change":483}],322:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') exports.pointVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}"]) @@ -50424,7 +50821,9 @@ exports.pointFragment = glslify(["precision mediump float;\n#define GLSLIFY exports.pickVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]) exports.pickFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"]) -},{"glslify":413}],303:[function(_dereq_,module,exports){ +},{"glslify":323}],323:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],324:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -50644,7 +51043,7 @@ function createPointcloud2D(plot, options) { return result } -},{"./lib/shader":302,"gl-buffer":258,"gl-shader":312,"typedarray-pool":567}],304:[function(_dereq_,module,exports){ +},{"./lib/shader":322,"gl-buffer":259,"gl-shader":335,"typedarray-pool":595}],325:[function(_dereq_,module,exports){ module.exports = slerp /** @@ -50697,14 +51096,14 @@ function slerp (out, a, b, t) { return out } -},{}],305:[function(_dereq_,module,exports){ +},{}],326:[function(_dereq_,module,exports){ 'use strict'; module.exports = function(a){ return (!a && a !== 0) ? '' : a.toString(); } -},{}],306:[function(_dereq_,module,exports){ +},{}],327:[function(_dereq_,module,exports){ "use strict" var vectorizeText = _dereq_("vectorize-text") @@ -50773,7 +51172,7 @@ function getGlyph(symbol, font, pixelRatio) { //Save cached symbol return fontCache[symbol] = [triSymbol, lineSymbol, bounds] } -},{"vectorize-text":572}],307:[function(_dereq_,module,exports){ +},{"vectorize-text":600}],328:[function(_dereq_,module,exports){ var createShaderWrapper = _dereq_('gl-shader') var glslify = _dereq_('glslify') @@ -50850,7 +51249,9 @@ exports.createPickProject = function(gl) { return createShader(gl, pickProject) } -},{"gl-shader":312,"glslify":413}],308:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":329}],329:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],330:[function(_dereq_,module,exports){ 'use strict' var isAllBlank = _dereq_('is-string-blank') @@ -51722,7 +52123,7 @@ function createPointCloud(options) { return pointCloud } -},{"./lib/get-simple-string":305,"./lib/glyphs":306,"./lib/shaders":307,"gl-buffer":258,"gl-mat4/multiply":280,"gl-vao":332,"is-string-blank":444,"typedarray-pool":567}],309:[function(_dereq_,module,exports){ +},{"./lib/get-simple-string":326,"./lib/glyphs":327,"./lib/shaders":328,"gl-buffer":259,"gl-mat4/multiply":295,"gl-vao":358,"is-string-blank":470,"typedarray-pool":595}],331:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -51730,7 +52131,9 @@ var glslify = _dereq_('glslify') exports.boxVertex = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n"]) exports.boxFragment = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"]) -},{"glslify":413}],310:[function(_dereq_,module,exports){ +},{"glslify":332}],332:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],333:[function(_dereq_,module,exports){ 'use strict' var createShader = _dereq_('gl-shader') @@ -51856,7 +52259,7 @@ function createSelectBox(plot, options) { return selectBox } -},{"./lib/shaders":309,"gl-buffer":258,"gl-shader":312}],311:[function(_dereq_,module,exports){ +},{"./lib/shaders":331,"gl-buffer":259,"gl-shader":335}],334:[function(_dereq_,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -52041,7 +52444,7 @@ function createSelectBuffer(gl, shape) { return new SelectBuffer(gl, fbo, buffer) } -},{"bit-twiddle":97,"gl-fbo":266,"ndarray":469,"typedarray-pool":567}],312:[function(_dereq_,module,exports){ +},{"bit-twiddle":97,"gl-fbo":269,"ndarray":495,"typedarray-pool":595}],335:[function(_dereq_,module,exports){ 'use strict' var createUniformWrapper = _dereq_('./lib/create-uniforms') @@ -52307,7 +52710,7 @@ function createShader( module.exports = createShader -},{"./lib/GLError":313,"./lib/create-attributes":314,"./lib/create-uniforms":315,"./lib/reflect":316,"./lib/runtime-reflect":317,"./lib/shader-cache":318}],313:[function(_dereq_,module,exports){ +},{"./lib/GLError":336,"./lib/create-attributes":337,"./lib/create-uniforms":338,"./lib/reflect":339,"./lib/runtime-reflect":340,"./lib/shader-cache":341}],336:[function(_dereq_,module,exports){ function GLError (rawError, shortMessage, longMessage) { this.shortMessage = shortMessage || '' this.longMessage = longMessage || '' @@ -52322,7 +52725,7 @@ GLError.prototype.name = 'GLError' GLError.prototype.constructor = GLError module.exports = GLError -},{}],314:[function(_dereq_,module,exports){ +},{}],337:[function(_dereq_,module,exports){ 'use strict' module.exports = createAttributeWrapper @@ -52587,7 +52990,7 @@ function createAttributeWrapper( return obj } -},{"./GLError":313}],315:[function(_dereq_,module,exports){ +},{"./GLError":336}],338:[function(_dereq_,module,exports){ 'use strict' var coallesceUniforms = _dereq_('./reflect') @@ -52780,7 +53183,7 @@ function createUniformWrapper(gl, wrapper, uniforms, locations) { } } -},{"./GLError":313,"./reflect":316}],316:[function(_dereq_,module,exports){ +},{"./GLError":336,"./reflect":339}],339:[function(_dereq_,module,exports){ 'use strict' module.exports = makeReflectTypes @@ -52838,7 +53241,7 @@ function makeReflectTypes(uniforms, useIndex) { } return obj } -},{}],317:[function(_dereq_,module,exports){ +},{}],340:[function(_dereq_,module,exports){ 'use strict' exports.uniforms = runtimeUniforms @@ -52918,7 +53321,7 @@ function runtimeAttributes(gl, program) { return result } -},{}],318:[function(_dereq_,module,exports){ +},{}],341:[function(_dereq_,module,exports){ 'use strict' exports.shader = getShaderReference @@ -53056,7 +53459,7 @@ function createProgram(gl, vref, fref, attribs, locations) { return getCache(gl).getProgram(vref, fref, attribs, locations) } -},{"./GLError":313,"gl-format-compiler-error":267,"weakmap-shim":577}],319:[function(_dereq_,module,exports){ +},{"./GLError":336,"gl-format-compiler-error":270,"weakmap-shim":605}],342:[function(_dereq_,module,exports){ 'use strict' module.exports = createSpikes2D @@ -53144,7 +53547,9 @@ function createSpikes2D(plot, options) { return spikes } -},{}],320:[function(_dereq_,module,exports){ +},{}],343:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],344:[function(_dereq_,module,exports){ 'use strict' var glslify = _dereq_('glslify') @@ -53161,7 +53566,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":312,"glslify":413}],321:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":343}],345:[function(_dereq_,module,exports){ 'use strict' var createBuffer = _dereq_('gl-buffer') @@ -53357,7 +53762,7 @@ function createSpikes(gl, options) { return spikes } -},{"./shaders/index":320,"gl-buffer":258,"gl-vao":332}],322:[function(_dereq_,module,exports){ +},{"./shaders/index":344,"gl-buffer":259,"gl-vao":358}],346:[function(_dereq_,module,exports){ var glslify = _dereq_('glslify') var triVertSrc = glslify(["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 color, position;\nattribute vec2 uv;\n\nuniform float vectorScale, tubeScale;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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"]) @@ -53385,7 +53790,9 @@ exports.pickShader = { ] } -},{"glslify":413}],323:[function(_dereq_,module,exports){ +},{"glslify":347}],347:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],348:[function(_dereq_,module,exports){ "use strict"; var vec3 = _dereq_('gl-vec3'); @@ -53945,7 +54352,7 @@ module.exports.createTubeMesh = function(gl, params) { }); } -},{"./lib/shaders":322,"gl-cone3d":259,"gl-vec3":351,"gl-vec4":387}],324:[function(_dereq_,module,exports){ +},{"./lib/shaders":346,"gl-cone3d":260,"gl-vec3":377,"gl-vec4":413}],349:[function(_dereq_,module,exports){ var createShader = _dereq_('gl-shader') var glslify = _dereq_('glslify') @@ -53995,7 +54402,9 @@ exports.createPickContourShader = function (gl) { return shader } -},{"gl-shader":312,"glslify":413}],325:[function(_dereq_,module,exports){ +},{"gl-shader":335,"glslify":350}],350:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],351:[function(_dereq_,module,exports){ 'use strict' module.exports = createSurfacePlot @@ -54065,19 +54474,6 @@ function SurfacePickResult (position, index, uv, level, dataCoordinate) { var N_COLORS = 256 -function genColormap (name, opacityscale) { - var x = pack([colormap({ - colormap: name, - nshades: N_COLORS, - format: 'rgba' - }).map(function (c, i) { - var a = opacityscale ? getOpacityFromScale(i / 255.0, opacityscale) : 1 - return [c[0], c[1], c[2], 255 * a] - })]) - ops.divseq(x, 255.0) - return x -} - function SurfacePlot ( gl, shape, @@ -54163,7 +54559,6 @@ function SurfacePlot ( this.pixelRatio = 1 this.opacity = 1.0 - this.opacityscale = false this.lightPosition = [10, 10000, 0] this.ambientLight = 0.8 @@ -54178,26 +54573,30 @@ function SurfacePlot ( var proto = SurfacePlot.prototype +proto.genColormap = function (name, opacityscale) { + var hasAlpha = false + + var x = pack([colormap({ + colormap: name, + nshades: N_COLORS, + format: 'rgba' + }).map(function (c, i) { + var a = opacityscale ? getOpacityFromScale(i / 255.0, opacityscale) : c[3] + if(a < 1) hasAlpha = true + return [c[0], c[1], c[2], 255 * a] + })]) + ops.divseq(x, 255.0) + + this.hasAlphaScale = hasAlpha + return x +} + proto.isTransparent = function () { - return this.opacity < 1 || this.opacityscale + return this.opacity < 1 || this.hasAlphaScale } proto.isOpaque = function () { - if (this.opacityscale) { - return false - } - if (this.opacity < 1) { - return false - } - if (this.opacity >= 1) { - return true - } - for (var i = 0; i < 3; ++i) { - if (this._contourCounts[i].length > 0) { - return true - } - } - return false + return !this.isTransparent() } proto.pickSlots = 1 @@ -54798,6 +55197,9 @@ proto.update = function (params) { if ('vertexColor' in params) { this.vertexColor = params.vertexColor ? 1 : 0; } + if ('colormap' in params) { + this._colorMap.setPixels(this.genColormap(params.colormap, this.opacityscale)) + } var field = params.field || (params.coords && params.coords[2]) || null var levelsChanged = false @@ -55167,10 +55569,6 @@ proto.update = function (params) { this._contourBuffer.update(floatBuffer) pool.freeFloat(floatBuffer) } - - if (params.colormap) { - this._colorMap.setPixels(genColormap(params.colormap, this.opacityscale)) - } } proto.dispose = function () { @@ -55388,7 +55786,7 @@ function createSurfacePlot (params) { return surface } -},{"./lib/shaders":324,"binary-search-bounds":96,"bit-twiddle":97,"colormap":131,"gl-buffer":258,"gl-mat4/invert":278,"gl-mat4/multiply":280,"gl-texture2d":327,"gl-vao":332,"ndarray":469,"ndarray-gradient":462,"ndarray-ops":464,"ndarray-pack":465,"surface-nets":542,"typedarray-pool":567}],326:[function(_dereq_,module,exports){ +},{"./lib/shaders":349,"binary-search-bounds":96,"bit-twiddle":97,"colormap":131,"gl-buffer":259,"gl-mat4/invert":293,"gl-mat4/multiply":295,"gl-texture2d":353,"gl-vao":358,"ndarray":495,"ndarray-gradient":488,"ndarray-ops":490,"ndarray-pack":491,"surface-nets":570,"typedarray-pool":595}],352:[function(_dereq_,module,exports){ 'use strict' var Font = _dereq_('css-font') @@ -56116,7 +56514,7 @@ function isRegl (o) { module.exports = GlText -},{"bit-twiddle":97,"color-normalize":125,"css-font":144,"detect-kerning":172,"es6-weak-map":233,"flatten-vertex-data":244,"font-atlas":245,"font-measure":246,"gl-util/context":328,"is-plain-obj":443,"object-assign":473,"parse-rect":478,"parse-unit":480,"pick-by-alias":485,"regl":512,"to-px":550,"typedarray-pool":567}],327:[function(_dereq_,module,exports){ +},{"bit-twiddle":97,"color-normalize":125,"css-font":144,"detect-kerning":172,"es6-weak-map":233,"flatten-vertex-data":244,"font-atlas":245,"font-measure":246,"gl-util/context":354,"is-plain-obj":469,"object-assign":499,"parse-rect":504,"parse-unit":506,"pick-by-alias":511,"regl":540,"to-px":578,"typedarray-pool":595}],353:[function(_dereq_,module,exports){ 'use strict' var ndarray = _dereq_('ndarray') @@ -56679,8 +57077,8 @@ function createTexture2D(gl) { throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":469,"ndarray-ops":464,"typedarray-pool":567}],328:[function(_dereq_,module,exports){ -(function (global){ +},{"ndarray":495,"ndarray-ops":490,"typedarray-pool":595}],354:[function(_dereq_,module,exports){ +(function (global){(function (){ /** @module gl-util/context */ 'use strict' @@ -56810,8 +57208,8 @@ function createCanvas () { return canvas } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"pick-by-alias":485}],329:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"pick-by-alias":511}],355:[function(_dereq_,module,exports){ "use strict" function doBind(gl, elements, attributes) { @@ -56866,7 +57264,7 @@ function doBind(gl, elements, attributes) { } module.exports = doBind -},{}],330:[function(_dereq_,module,exports){ +},{}],356:[function(_dereq_,module,exports){ "use strict" var bindAttribs = _dereq_("./do-bind.js") @@ -56906,7 +57304,7 @@ function createVAOEmulated(gl) { } module.exports = createVAOEmulated -},{"./do-bind.js":329}],331:[function(_dereq_,module,exports){ +},{"./do-bind.js":355}],357:[function(_dereq_,module,exports){ "use strict" var bindAttribs = _dereq_("./do-bind.js") @@ -56994,7 +57392,7 @@ function createVAONative(gl, ext) { } module.exports = createVAONative -},{"./do-bind.js":329}],332:[function(_dereq_,module,exports){ +},{"./do-bind.js":355}],358:[function(_dereq_,module,exports){ "use strict" var createVAONative = _dereq_("./lib/vao-native.js") @@ -57023,7 +57421,7 @@ function createVAO(gl, attributes, elements, elementsType) { module.exports = createVAO -},{"./lib/vao-emulated.js":330,"./lib/vao-native.js":331}],333:[function(_dereq_,module,exports){ +},{"./lib/vao-emulated.js":356,"./lib/vao-native.js":357}],359:[function(_dereq_,module,exports){ module.exports = add; /** @@ -57040,7 +57438,7 @@ function add(out, a, b) { out[2] = a[2] + b[2] return out } -},{}],334:[function(_dereq_,module,exports){ +},{}],360:[function(_dereq_,module,exports){ module.exports = angle var fromValues = _dereq_('./fromValues') @@ -57069,7 +57467,7 @@ function angle(a, b) { } } -},{"./dot":344,"./fromValues":350,"./normalize":361}],335:[function(_dereq_,module,exports){ +},{"./dot":370,"./fromValues":376,"./normalize":387}],361:[function(_dereq_,module,exports){ module.exports = ceil /** @@ -57086,7 +57484,7 @@ function ceil(out, a) { return out } -},{}],336:[function(_dereq_,module,exports){ +},{}],362:[function(_dereq_,module,exports){ module.exports = clone; /** @@ -57102,7 +57500,7 @@ function clone(a) { out[2] = a[2] return out } -},{}],337:[function(_dereq_,module,exports){ +},{}],363:[function(_dereq_,module,exports){ module.exports = copy; /** @@ -57118,7 +57516,7 @@ function copy(out, a) { out[2] = a[2] return out } -},{}],338:[function(_dereq_,module,exports){ +},{}],364:[function(_dereq_,module,exports){ module.exports = create; /** @@ -57133,7 +57531,7 @@ function create() { out[2] = 0 return out } -},{}],339:[function(_dereq_,module,exports){ +},{}],365:[function(_dereq_,module,exports){ module.exports = cross; /** @@ -57153,10 +57551,10 @@ function cross(out, a, b) { out[2] = ax * by - ay * bx return out } -},{}],340:[function(_dereq_,module,exports){ +},{}],366:[function(_dereq_,module,exports){ module.exports = _dereq_('./distance') -},{"./distance":341}],341:[function(_dereq_,module,exports){ +},{"./distance":367}],367:[function(_dereq_,module,exports){ module.exports = distance; /** @@ -57172,10 +57570,10 @@ function distance(a, b) { z = b[2] - a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],342:[function(_dereq_,module,exports){ +},{}],368:[function(_dereq_,module,exports){ module.exports = _dereq_('./divide') -},{"./divide":343}],343:[function(_dereq_,module,exports){ +},{"./divide":369}],369:[function(_dereq_,module,exports){ module.exports = divide; /** @@ -57192,7 +57590,7 @@ function divide(out, a, b) { out[2] = a[2] / b[2] return out } -},{}],344:[function(_dereq_,module,exports){ +},{}],370:[function(_dereq_,module,exports){ module.exports = dot; /** @@ -57205,10 +57603,10 @@ module.exports = dot; function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] } -},{}],345:[function(_dereq_,module,exports){ +},{}],371:[function(_dereq_,module,exports){ module.exports = 0.000001 -},{}],346:[function(_dereq_,module,exports){ +},{}],372:[function(_dereq_,module,exports){ module.exports = equals var EPSILON = _dereq_('./epsilon') @@ -57232,7 +57630,7 @@ function equals(a, b) { Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))) } -},{"./epsilon":345}],347:[function(_dereq_,module,exports){ +},{"./epsilon":371}],373:[function(_dereq_,module,exports){ module.exports = exactEquals /** @@ -57246,7 +57644,7 @@ function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] } -},{}],348:[function(_dereq_,module,exports){ +},{}],374:[function(_dereq_,module,exports){ module.exports = floor /** @@ -57263,7 +57661,7 @@ function floor(out, a) { return out } -},{}],349:[function(_dereq_,module,exports){ +},{}],375:[function(_dereq_,module,exports){ module.exports = forEach; var vec = _dereq_('./create')() @@ -57308,7 +57706,7 @@ function forEach(a, stride, offset, count, fn, arg) { return a } -},{"./create":338}],350:[function(_dereq_,module,exports){ +},{"./create":364}],376:[function(_dereq_,module,exports){ module.exports = fromValues; /** @@ -57326,7 +57724,7 @@ function fromValues(x, y, z) { out[2] = z return out } -},{}],351:[function(_dereq_,module,exports){ +},{}],377:[function(_dereq_,module,exports){ module.exports = { EPSILON: _dereq_('./epsilon') , create: _dereq_('./create') @@ -57375,7 +57773,7 @@ module.exports = { , forEach: _dereq_('./forEach') } -},{"./add":333,"./angle":334,"./ceil":335,"./clone":336,"./copy":337,"./create":338,"./cross":339,"./dist":340,"./distance":341,"./div":342,"./divide":343,"./dot":344,"./epsilon":345,"./equals":346,"./exactEquals":347,"./floor":348,"./forEach":349,"./fromValues":350,"./inverse":352,"./len":353,"./length":354,"./lerp":355,"./max":356,"./min":357,"./mul":358,"./multiply":359,"./negate":360,"./normalize":361,"./random":362,"./rotateX":363,"./rotateY":364,"./rotateZ":365,"./round":366,"./scale":367,"./scaleAndAdd":368,"./set":369,"./sqrDist":370,"./sqrLen":371,"./squaredDistance":372,"./squaredLength":373,"./sub":374,"./subtract":375,"./transformMat3":376,"./transformMat4":377,"./transformQuat":378}],352:[function(_dereq_,module,exports){ +},{"./add":359,"./angle":360,"./ceil":361,"./clone":362,"./copy":363,"./create":364,"./cross":365,"./dist":366,"./distance":367,"./div":368,"./divide":369,"./dot":370,"./epsilon":371,"./equals":372,"./exactEquals":373,"./floor":374,"./forEach":375,"./fromValues":376,"./inverse":378,"./len":379,"./length":380,"./lerp":381,"./max":382,"./min":383,"./mul":384,"./multiply":385,"./negate":386,"./normalize":387,"./random":388,"./rotateX":389,"./rotateY":390,"./rotateZ":391,"./round":392,"./scale":393,"./scaleAndAdd":394,"./set":395,"./sqrDist":396,"./sqrLen":397,"./squaredDistance":398,"./squaredLength":399,"./sub":400,"./subtract":401,"./transformMat3":402,"./transformMat4":403,"./transformQuat":404}],378:[function(_dereq_,module,exports){ module.exports = inverse; /** @@ -57391,10 +57789,10 @@ function inverse(out, a) { out[2] = 1.0 / a[2] return out } -},{}],353:[function(_dereq_,module,exports){ +},{}],379:[function(_dereq_,module,exports){ module.exports = _dereq_('./length') -},{"./length":354}],354:[function(_dereq_,module,exports){ +},{"./length":380}],380:[function(_dereq_,module,exports){ module.exports = length; /** @@ -57409,7 +57807,7 @@ function length(a) { z = a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],355:[function(_dereq_,module,exports){ +},{}],381:[function(_dereq_,module,exports){ module.exports = lerp; /** @@ -57430,7 +57828,7 @@ function lerp(out, a, b, t) { out[2] = az + t * (b[2] - az) return out } -},{}],356:[function(_dereq_,module,exports){ +},{}],382:[function(_dereq_,module,exports){ module.exports = max; /** @@ -57447,7 +57845,7 @@ function max(out, a, b) { out[2] = Math.max(a[2], b[2]) return out } -},{}],357:[function(_dereq_,module,exports){ +},{}],383:[function(_dereq_,module,exports){ module.exports = min; /** @@ -57464,10 +57862,10 @@ function min(out, a, b) { out[2] = Math.min(a[2], b[2]) return out } -},{}],358:[function(_dereq_,module,exports){ +},{}],384:[function(_dereq_,module,exports){ module.exports = _dereq_('./multiply') -},{"./multiply":359}],359:[function(_dereq_,module,exports){ +},{"./multiply":385}],385:[function(_dereq_,module,exports){ module.exports = multiply; /** @@ -57484,7 +57882,7 @@ function multiply(out, a, b) { out[2] = a[2] * b[2] return out } -},{}],360:[function(_dereq_,module,exports){ +},{}],386:[function(_dereq_,module,exports){ module.exports = negate; /** @@ -57500,7 +57898,7 @@ function negate(out, a) { out[2] = -a[2] return out } -},{}],361:[function(_dereq_,module,exports){ +},{}],387:[function(_dereq_,module,exports){ module.exports = normalize; /** @@ -57524,7 +57922,7 @@ function normalize(out, a) { } return out } -},{}],362:[function(_dereq_,module,exports){ +},{}],388:[function(_dereq_,module,exports){ module.exports = random; /** @@ -57546,7 +57944,7 @@ function random(out, scale) { out[2] = z * scale return out } -},{}],363:[function(_dereq_,module,exports){ +},{}],389:[function(_dereq_,module,exports){ module.exports = rotateX; /** @@ -57576,7 +57974,7 @@ function rotateX(out, a, b, c){ return out } -},{}],364:[function(_dereq_,module,exports){ +},{}],390:[function(_dereq_,module,exports){ module.exports = rotateY; /** @@ -57606,7 +58004,7 @@ function rotateY(out, a, b, c){ return out } -},{}],365:[function(_dereq_,module,exports){ +},{}],391:[function(_dereq_,module,exports){ module.exports = rotateZ; /** @@ -57636,7 +58034,7 @@ function rotateZ(out, a, b, c){ return out } -},{}],366:[function(_dereq_,module,exports){ +},{}],392:[function(_dereq_,module,exports){ module.exports = round /** @@ -57653,7 +58051,7 @@ function round(out, a) { return out } -},{}],367:[function(_dereq_,module,exports){ +},{}],393:[function(_dereq_,module,exports){ module.exports = scale; /** @@ -57670,7 +58068,7 @@ function scale(out, a, b) { out[2] = a[2] * b return out } -},{}],368:[function(_dereq_,module,exports){ +},{}],394:[function(_dereq_,module,exports){ module.exports = scaleAndAdd; /** @@ -57688,7 +58086,7 @@ function scaleAndAdd(out, a, b, scale) { out[2] = a[2] + (b[2] * scale) return out } -},{}],369:[function(_dereq_,module,exports){ +},{}],395:[function(_dereq_,module,exports){ module.exports = set; /** @@ -57706,13 +58104,13 @@ function set(out, x, y, z) { out[2] = z return out } -},{}],370:[function(_dereq_,module,exports){ +},{}],396:[function(_dereq_,module,exports){ module.exports = _dereq_('./squaredDistance') -},{"./squaredDistance":372}],371:[function(_dereq_,module,exports){ +},{"./squaredDistance":398}],397:[function(_dereq_,module,exports){ module.exports = _dereq_('./squaredLength') -},{"./squaredLength":373}],372:[function(_dereq_,module,exports){ +},{"./squaredLength":399}],398:[function(_dereq_,module,exports){ module.exports = squaredDistance; /** @@ -57728,7 +58126,7 @@ function squaredDistance(a, b) { z = b[2] - a[2] return x*x + y*y + z*z } -},{}],373:[function(_dereq_,module,exports){ +},{}],399:[function(_dereq_,module,exports){ module.exports = squaredLength; /** @@ -57743,10 +58141,10 @@ function squaredLength(a) { z = a[2] return x*x + y*y + z*z } -},{}],374:[function(_dereq_,module,exports){ +},{}],400:[function(_dereq_,module,exports){ module.exports = _dereq_('./subtract') -},{"./subtract":375}],375:[function(_dereq_,module,exports){ +},{"./subtract":401}],401:[function(_dereq_,module,exports){ module.exports = subtract; /** @@ -57763,7 +58161,7 @@ function subtract(out, a, b) { out[2] = a[2] - b[2] return out } -},{}],376:[function(_dereq_,module,exports){ +},{}],402:[function(_dereq_,module,exports){ module.exports = transformMat3; /** @@ -57781,7 +58179,7 @@ function transformMat3(out, a, m) { out[2] = x * m[2] + y * m[5] + z * m[8] return out } -},{}],377:[function(_dereq_,module,exports){ +},{}],403:[function(_dereq_,module,exports){ module.exports = transformMat4; /** @@ -57802,7 +58200,7 @@ function transformMat4(out, a, m) { out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w return out } -},{}],378:[function(_dereq_,module,exports){ +},{}],404:[function(_dereq_,module,exports){ module.exports = transformQuat; /** @@ -57831,7 +58229,7 @@ function transformQuat(out, a, q) { out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx return out } -},{}],379:[function(_dereq_,module,exports){ +},{}],405:[function(_dereq_,module,exports){ module.exports = add /** @@ -57850,7 +58248,7 @@ function add (out, a, b) { return out } -},{}],380:[function(_dereq_,module,exports){ +},{}],406:[function(_dereq_,module,exports){ module.exports = clone /** @@ -57868,7 +58266,7 @@ function clone (a) { return out } -},{}],381:[function(_dereq_,module,exports){ +},{}],407:[function(_dereq_,module,exports){ module.exports = copy /** @@ -57886,7 +58284,7 @@ function copy (out, a) { return out } -},{}],382:[function(_dereq_,module,exports){ +},{}],408:[function(_dereq_,module,exports){ module.exports = create /** @@ -57903,7 +58301,7 @@ function create () { return out } -},{}],383:[function(_dereq_,module,exports){ +},{}],409:[function(_dereq_,module,exports){ module.exports = distance /** @@ -57921,7 +58319,7 @@ function distance (a, b) { return Math.sqrt(x * x + y * y + z * z + w * w) } -},{}],384:[function(_dereq_,module,exports){ +},{}],410:[function(_dereq_,module,exports){ module.exports = divide /** @@ -57940,7 +58338,7 @@ function divide (out, a, b) { return out } -},{}],385:[function(_dereq_,module,exports){ +},{}],411:[function(_dereq_,module,exports){ module.exports = dot /** @@ -57954,7 +58352,7 @@ function dot (a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3] } -},{}],386:[function(_dereq_,module,exports){ +},{}],412:[function(_dereq_,module,exports){ module.exports = fromValues /** @@ -57975,7 +58373,7 @@ function fromValues (x, y, z, w) { return out } -},{}],387:[function(_dereq_,module,exports){ +},{}],413:[function(_dereq_,module,exports){ module.exports = { create: _dereq_('./create'), clone: _dereq_('./clone'), @@ -58004,7 +58402,7 @@ module.exports = { transformQuat: _dereq_('./transformQuat') } -},{"./add":379,"./clone":380,"./copy":381,"./create":382,"./distance":383,"./divide":384,"./dot":385,"./fromValues":386,"./inverse":388,"./length":389,"./lerp":390,"./max":391,"./min":392,"./multiply":393,"./negate":394,"./normalize":395,"./random":396,"./scale":397,"./scaleAndAdd":398,"./set":399,"./squaredDistance":400,"./squaredLength":401,"./subtract":402,"./transformMat4":403,"./transformQuat":404}],388:[function(_dereq_,module,exports){ +},{"./add":405,"./clone":406,"./copy":407,"./create":408,"./distance":409,"./divide":410,"./dot":411,"./fromValues":412,"./inverse":414,"./length":415,"./lerp":416,"./max":417,"./min":418,"./multiply":419,"./negate":420,"./normalize":421,"./random":422,"./scale":423,"./scaleAndAdd":424,"./set":425,"./squaredDistance":426,"./squaredLength":427,"./subtract":428,"./transformMat4":429,"./transformQuat":430}],414:[function(_dereq_,module,exports){ module.exports = inverse /** @@ -58022,7 +58420,7 @@ function inverse (out, a) { return out } -},{}],389:[function(_dereq_,module,exports){ +},{}],415:[function(_dereq_,module,exports){ module.exports = length /** @@ -58039,7 +58437,7 @@ function length (a) { return Math.sqrt(x * x + y * y + z * z + w * w) } -},{}],390:[function(_dereq_,module,exports){ +},{}],416:[function(_dereq_,module,exports){ module.exports = lerp /** @@ -58063,7 +58461,7 @@ function lerp (out, a, b, t) { return out } -},{}],391:[function(_dereq_,module,exports){ +},{}],417:[function(_dereq_,module,exports){ module.exports = max /** @@ -58082,7 +58480,7 @@ function max (out, a, b) { return out } -},{}],392:[function(_dereq_,module,exports){ +},{}],418:[function(_dereq_,module,exports){ module.exports = min /** @@ -58101,7 +58499,7 @@ function min (out, a, b) { return out } -},{}],393:[function(_dereq_,module,exports){ +},{}],419:[function(_dereq_,module,exports){ module.exports = multiply /** @@ -58120,7 +58518,7 @@ function multiply (out, a, b) { return out } -},{}],394:[function(_dereq_,module,exports){ +},{}],420:[function(_dereq_,module,exports){ module.exports = negate /** @@ -58138,7 +58536,7 @@ function negate (out, a) { return out } -},{}],395:[function(_dereq_,module,exports){ +},{}],421:[function(_dereq_,module,exports){ module.exports = normalize /** @@ -58164,7 +58562,7 @@ function normalize (out, a) { return out } -},{}],396:[function(_dereq_,module,exports){ +},{}],422:[function(_dereq_,module,exports){ var vecNormalize = _dereq_('./normalize') var vecScale = _dereq_('./scale') @@ -58190,7 +58588,7 @@ function random (out, scale) { return out } -},{"./normalize":395,"./scale":397}],397:[function(_dereq_,module,exports){ +},{"./normalize":421,"./scale":423}],423:[function(_dereq_,module,exports){ module.exports = scale /** @@ -58209,7 +58607,7 @@ function scale (out, a, b) { return out } -},{}],398:[function(_dereq_,module,exports){ +},{}],424:[function(_dereq_,module,exports){ module.exports = scaleAndAdd /** @@ -58229,7 +58627,7 @@ function scaleAndAdd (out, a, b, scale) { return out } -},{}],399:[function(_dereq_,module,exports){ +},{}],425:[function(_dereq_,module,exports){ module.exports = set /** @@ -58250,7 +58648,7 @@ function set (out, x, y, z, w) { return out } -},{}],400:[function(_dereq_,module,exports){ +},{}],426:[function(_dereq_,module,exports){ module.exports = squaredDistance /** @@ -58268,7 +58666,7 @@ function squaredDistance (a, b) { return x * x + y * y + z * z + w * w } -},{}],401:[function(_dereq_,module,exports){ +},{}],427:[function(_dereq_,module,exports){ module.exports = squaredLength /** @@ -58285,7 +58683,7 @@ function squaredLength (a) { return x * x + y * y + z * z + w * w } -},{}],402:[function(_dereq_,module,exports){ +},{}],428:[function(_dereq_,module,exports){ module.exports = subtract /** @@ -58304,7 +58702,7 @@ function subtract (out, a, b) { return out } -},{}],403:[function(_dereq_,module,exports){ +},{}],429:[function(_dereq_,module,exports){ module.exports = transformMat4 /** @@ -58324,7 +58722,7 @@ function transformMat4 (out, a, m) { return out } -},{}],404:[function(_dereq_,module,exports){ +},{}],430:[function(_dereq_,module,exports){ module.exports = transformQuat /** @@ -58353,7 +58751,7 @@ function transformQuat (out, a, q) { return out } -},{}],405:[function(_dereq_,module,exports){ +},{}],431:[function(_dereq_,module,exports){ var tokenize = _dereq_('glsl-tokenizer') var atob = _dereq_('atob-lite') @@ -58378,7 +58776,7 @@ function getName(src) { } } -},{"atob-lite":77,"glsl-tokenizer":412}],406:[function(_dereq_,module,exports){ +},{"atob-lite":77,"glsl-tokenizer":438}],432:[function(_dereq_,module,exports){ module.exports = tokenize var literals100 = _dereq_('./lib/literals') @@ -58755,7 +59153,7 @@ function tokenize(opt) { } } -},{"./lib/builtins":408,"./lib/builtins-300es":407,"./lib/literals":410,"./lib/literals-300es":409,"./lib/operators":411}],407:[function(_dereq_,module,exports){ +},{"./lib/builtins":434,"./lib/builtins-300es":433,"./lib/literals":436,"./lib/literals-300es":435,"./lib/operators":437}],433:[function(_dereq_,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = _dereq_('./builtins') @@ -58826,7 +59224,7 @@ module.exports = v100.concat([ , 'textureProjGradOffset' ]) -},{"./builtins":408}],408:[function(_dereq_,module,exports){ +},{"./builtins":434}],434:[function(_dereq_,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -58978,7 +59376,7 @@ module.exports = [ , 'textureCubeGradEXT' ] -},{}],409:[function(_dereq_,module,exports){ +},{}],435:[function(_dereq_,module,exports){ var v100 = _dereq_('./literals') module.exports = v100.slice().concat([ @@ -59067,7 +59465,7 @@ module.exports = v100.slice().concat([ , 'usampler2DMSArray' ]) -},{"./literals":410}],410:[function(_dereq_,module,exports){ +},{"./literals":436}],436:[function(_dereq_,module,exports){ module.exports = [ // current 'precision' @@ -59163,7 +59561,7 @@ module.exports = [ , 'using' ] -},{}],411:[function(_dereq_,module,exports){ +},{}],437:[function(_dereq_,module,exports){ module.exports = [ '<<=' , '>>=' @@ -59212,7 +59610,7 @@ module.exports = [ , '}' ] -},{}],412:[function(_dereq_,module,exports){ +},{}],438:[function(_dereq_,module,exports){ var tokenize = _dereq_('./index') module.exports = tokenizeString @@ -59227,20 +59625,10 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":406}],413:[function(_dereq_,module,exports){ -module.exports = function(strings) { - if (typeof strings === 'string') strings = [strings] - var exprs = [].slice.call(arguments,1) - var parts = [] - for (var i = 0; i < strings.length-1; i++) { - parts.push(strings[i], exprs[i] || '') - } - parts.push(strings[i]) - return parts.join('') -} - -},{}],414:[function(_dereq_,module,exports){ -(function (global){ +},{"./index":432}],439:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],440:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -59255,8 +59643,8 @@ else { module.exports = hasHover -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"is-browser":438}],415:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"is-browser":464}],441:[function(_dereq_,module,exports){ 'use strict' var isBrowser = _dereq_('is-browser') @@ -59282,7 +59670,7 @@ function detect() { module.exports = isBrowser && detect() -},{"is-browser":438}],416:[function(_dereq_,module,exports){ +},{"is-browser":464}],442:[function(_dereq_,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -59368,7 +59756,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],417:[function(_dereq_,module,exports){ +},{}],443:[function(_dereq_,module,exports){ 'use strict'; var typeHandlers = _dereq_('./types'); @@ -59383,8 +59771,8 @@ module.exports = function (buffer, filepath) { } }; -},{"./types":420}],418:[function(_dereq_,module,exports){ -(function (Buffer){ +},{"./types":446}],444:[function(_dereq_,module,exports){ +(function (Buffer){(function (){ 'use strict'; var fs = _dereq_('fs'); @@ -59512,8 +59900,8 @@ module.exports = function (input, callback) { module.exports.types = Object.keys(typeHandlers); -}).call(this,_dereq_("buffer").Buffer) -},{"./detector":417,"./types":420,"buffer":111,"fs":109,"path":481}],419:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"./detector":443,"./types":446,"buffer":111,"fs":109,"path":507}],445:[function(_dereq_,module,exports){ 'use strict'; // Abstract reading multi-byte unsigned integers @@ -59526,7 +59914,7 @@ function readUInt (buffer, bits, offset, isBigEndian) { module.exports = readUInt; -},{}],420:[function(_dereq_,module,exports){ +},{}],446:[function(_dereq_,module,exports){ 'use strict'; // load all available handlers for browserify support @@ -59547,7 +59935,7 @@ var typeHandlers = { module.exports = typeHandlers; -},{"./types/bmp":421,"./types/cur":422,"./types/dds":423,"./types/gif":424,"./types/icns":425,"./types/ico":426,"./types/jpg":427,"./types/png":428,"./types/psd":429,"./types/svg":430,"./types/tiff":431,"./types/webp":432}],421:[function(_dereq_,module,exports){ +},{"./types/bmp":447,"./types/cur":448,"./types/dds":449,"./types/gif":450,"./types/icns":451,"./types/ico":452,"./types/jpg":453,"./types/png":454,"./types/psd":455,"./types/svg":456,"./types/tiff":457,"./types/webp":458}],447:[function(_dereq_,module,exports){ 'use strict'; function isBMP (buffer) { @@ -59566,7 +59954,7 @@ module.exports = { 'calculate': calculate }; -},{}],422:[function(_dereq_,module,exports){ +},{}],448:[function(_dereq_,module,exports){ 'use strict'; var TYPE_CURSOR = 2; @@ -59585,7 +59973,7 @@ module.exports = { 'calculate': _dereq_('./ico').calculate }; -},{"./ico":426}],423:[function(_dereq_,module,exports){ +},{"./ico":452}],449:[function(_dereq_,module,exports){ 'use strict'; function isDDS(buffer){ @@ -59605,7 +59993,7 @@ module.exports = { 'calculate': calculate }; -},{}],424:[function(_dereq_,module,exports){ +},{}],450:[function(_dereq_,module,exports){ 'use strict'; var gifRegexp = /^GIF8[79]a/; @@ -59626,7 +60014,7 @@ module.exports = { 'calculate': calculate }; -},{}],425:[function(_dereq_,module,exports){ +},{}],451:[function(_dereq_,module,exports){ 'use strict'; /** @@ -59750,7 +60138,7 @@ module.exports = { 'calculate': calculate }; -},{}],426:[function(_dereq_,module,exports){ +},{}],452:[function(_dereq_,module,exports){ 'use strict'; var TYPE_ICON = 1; @@ -59833,7 +60221,7 @@ module.exports = { 'calculate': calculate }; -},{}],427:[function(_dereq_,module,exports){ +},{}],453:[function(_dereq_,module,exports){ 'use strict'; var readUInt = _dereq_('../readUInt'); @@ -59992,7 +60380,7 @@ module.exports = { 'calculate': calculate }; -},{"../readUInt":419}],428:[function(_dereq_,module,exports){ +},{"../readUInt":445}],454:[function(_dereq_,module,exports){ 'use strict'; var pngSignature = 'PNG\r\n\x1a\n'; @@ -60032,7 +60420,7 @@ module.exports = { 'calculate': calculate }; -},{}],429:[function(_dereq_,module,exports){ +},{}],455:[function(_dereq_,module,exports){ 'use strict'; function isPSD (buffer) { @@ -60051,7 +60439,7 @@ module.exports = { 'calculate': calculate }; -},{}],430:[function(_dereq_,module,exports){ +},{}],456:[function(_dereq_,module,exports){ 'use strict'; var svgReg = /"']|"[^"]*"|'[^']*')*>/; @@ -60149,8 +60537,8 @@ module.exports = { 'calculate': calculate }; -},{}],431:[function(_dereq_,module,exports){ -(function (Buffer){ +},{}],457:[function(_dereq_,module,exports){ +(function (Buffer){(function (){ 'use strict'; // based on http://www.compix.com/fileformattif.htm @@ -60272,8 +60660,8 @@ module.exports = { 'calculate': calculate }; -}).call(this,_dereq_("buffer").Buffer) -},{"../readUInt":419,"buffer":111,"fs":109}],432:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_("buffer").Buffer) +},{"../readUInt":445,"buffer":111,"fs":109}],458:[function(_dereq_,module,exports){ 'use strict'; // based on https://developers.google.com/speed/webp/docs/riff_container @@ -60346,7 +60734,7 @@ module.exports = { 'calculate': calculate }; -},{}],433:[function(_dereq_,module,exports){ +},{}],459:[function(_dereq_,module,exports){ "use strict" //High level idea: @@ -60793,7 +61181,7 @@ function incrementalConvexHull(points, randomSearch) { //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":520,"simplicial-complex":530}],434:[function(_dereq_,module,exports){ +},{"robust-orientation":548,"simplicial-complex":558}],460:[function(_dereq_,module,exports){ "use strict" var bounds = _dereq_("binary-search-bounds") @@ -61160,9 +61548,9 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":435}],435:[function(_dereq_,module,exports){ +},{"binary-search-bounds":461}],461:[function(_dereq_,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],436:[function(_dereq_,module,exports){ +},{"dup":243}],462:[function(_dereq_,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -61174,7 +61562,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],437:[function(_dereq_,module,exports){ +},{}],463:[function(_dereq_,module,exports){ "use strict" function iota(n) { @@ -61186,9 +61574,9 @@ function iota(n) { } module.exports = iota -},{}],438:[function(_dereq_,module,exports){ +},{}],464:[function(_dereq_,module,exports){ module.exports = true; -},{}],439:[function(_dereq_,module,exports){ +},{}],465:[function(_dereq_,module,exports){ /*! * Determine if an object is a Buffer * @@ -61211,12 +61599,12 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],440:[function(_dereq_,module,exports){ +},{}],466:[function(_dereq_,module,exports){ 'use strict'; module.exports = typeof navigator !== 'undefined' && (/MSIE/.test(navigator.userAgent) || /Trident\//.test(navigator.appVersion)); -},{}],441:[function(_dereq_,module,exports){ +},{}],467:[function(_dereq_,module,exports){ 'use strict' module.exports = isMobile @@ -61253,14 +61641,14 @@ function isMobile (opts) { return result } -},{}],442:[function(_dereq_,module,exports){ +},{}],468:[function(_dereq_,module,exports){ 'use strict'; module.exports = function (x) { var type = typeof x; return x !== null && (type === 'object' || type === 'function'); }; -},{}],443:[function(_dereq_,module,exports){ +},{}],469:[function(_dereq_,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -61269,7 +61657,7 @@ module.exports = function (x) { return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],444:[function(_dereq_,module,exports){ +},{}],470:[function(_dereq_,module,exports){ 'use strict'; /** @@ -61306,7 +61694,7 @@ module.exports = function(str){ return true; } -},{}],445:[function(_dereq_,module,exports){ +},{}],471:[function(_dereq_,module,exports){ 'use strict' module.exports = function isPath(str) { @@ -61320,12 +61708,12 @@ module.exports = function isPath(str) { return false } -},{}],446:[function(_dereq_,module,exports){ +},{}],472:[function(_dereq_,module,exports){ function lerp(v0, v1, t) { return v0*(1-t)+v1*t } module.exports = lerp -},{}],447:[function(_dereq_,module,exports){ +},{}],473:[function(_dereq_,module,exports){ /* Mapbox GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/mapbox/mapbox-gl-js/blob/v1.10.1/LICENSE.txt */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : @@ -61367,7 +61755,7 @@ return mapboxgl; }))); -},{}],448:[function(_dereq_,module,exports){ +},{}],474:[function(_dereq_,module,exports){ 'use strict' module.exports = createTable @@ -61433,7 +61821,7 @@ function createTable(dimension) { } return result } -},{"convex-hull":135}],449:[function(_dereq_,module,exports){ +},{"convex-hull":135}],475:[function(_dereq_,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -61613,7 +62001,7 @@ function combine(out, a, b, scale1, scale2) { out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":450,"gl-mat4/clone":272,"gl-mat4/create":273,"gl-mat4/determinant":274,"gl-mat4/invert":278,"gl-mat4/transpose":289,"gl-vec3/cross":339,"gl-vec3/dot":344,"gl-vec3/length":354,"gl-vec3/normalize":361}],450:[function(_dereq_,module,exports){ +},{"./normalize":476,"gl-mat4/clone":278,"gl-mat4/create":280,"gl-mat4/determinant":281,"gl-mat4/invert":293,"gl-mat4/transpose":306,"gl-vec3/cross":365,"gl-vec3/dot":370,"gl-vec3/length":380,"gl-vec3/normalize":387}],476:[function(_dereq_,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -61624,7 +62012,7 @@ module.exports = function normalize(out, mat) { out[i] = mat[i] * scale return true } -},{}],451:[function(_dereq_,module,exports){ +},{}],477:[function(_dereq_,module,exports){ var lerp = _dereq_('gl-vec3/lerp') var recompose = _dereq_('mat4-recompose') @@ -61677,7 +62065,7 @@ function vec3(n) { function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":274,"gl-vec3/lerp":355,"mat4-decompose":449,"mat4-recompose":452,"quat-slerp":501}],452:[function(_dereq_,module,exports){ +},{"gl-mat4/determinant":281,"gl-vec3/lerp":381,"mat4-decompose":475,"mat4-recompose":478,"quat-slerp":527}],478:[function(_dereq_,module,exports){ /* Input: translation ; a 3 component vector scale ; a 3 component vector @@ -61738,13 +62126,13 @@ module.exports = function recomposeMat4(matrix, translation, scale, skew, perspe mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":273,"gl-mat4/fromRotationTranslation":276,"gl-mat4/identity":277,"gl-mat4/multiply":280,"gl-mat4/scale":287,"gl-mat4/translate":288}],453:[function(_dereq_,module,exports){ +},{"gl-mat4/create":280,"gl-mat4/fromRotationTranslation":284,"gl-mat4/identity":291,"gl-mat4/multiply":295,"gl-mat4/scale":303,"gl-mat4/translate":305}],479:[function(_dereq_,module,exports){ 'use strict'; module.exports = Math.log2 || function (x) { return Math.log(x) * Math.LOG2E; }; -},{}],454:[function(_dereq_,module,exports){ +},{}],480:[function(_dereq_,module,exports){ 'use strict' var bsearch = _dereq_('binary-search-bounds') @@ -61944,9 +62332,9 @@ function createMatrixCameraController(options) { return new MatrixCameraController(matrix) } -},{"binary-search-bounds":455,"gl-mat4/invert":278,"gl-mat4/lookAt":279,"gl-mat4/rotateX":284,"gl-mat4/rotateY":285,"gl-mat4/rotateZ":286,"gl-mat4/scale":287,"gl-mat4/translate":288,"gl-vec3/normalize":361,"mat4-interpolate":451}],455:[function(_dereq_,module,exports){ +},{"binary-search-bounds":481,"gl-mat4/invert":293,"gl-mat4/lookAt":294,"gl-mat4/rotateX":300,"gl-mat4/rotateY":301,"gl-mat4/rotateZ":302,"gl-mat4/scale":303,"gl-mat4/translate":305,"gl-vec3/normalize":387,"mat4-interpolate":477}],481:[function(_dereq_,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],456:[function(_dereq_,module,exports){ +},{"dup":243}],482:[function(_dereq_,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -62028,7 +62416,7 @@ function monotoneConvexHull2D(points) { //Return result return result } -},{"robust-orientation":520}],457:[function(_dereq_,module,exports){ +},{"robust-orientation":548}],483:[function(_dereq_,module,exports){ 'use strict' module.exports = mouseListen @@ -62235,7 +62623,7 @@ function mouseListen (element, callback) { return result } -},{"mouse-event":459}],458:[function(_dereq_,module,exports){ +},{"mouse-event":485}],484:[function(_dereq_,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -62262,7 +62650,7 @@ function getBoundingClientOffset (element) { } } -},{}],459:[function(_dereq_,module,exports){ +},{}],485:[function(_dereq_,module,exports){ 'use strict' function mouseButtons(ev) { @@ -62324,7 +62712,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],460:[function(_dereq_,module,exports){ +},{}],486:[function(_dereq_,module,exports){ 'use strict' var toPX = _dereq_('to-px') @@ -62366,7 +62754,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":550}],461:[function(_dereq_,module,exports){ +},{"to-px":578}],487:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -62782,7 +63170,7 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":567}],462:[function(_dereq_,module,exports){ +},{"typedarray-pool":595}],488:[function(_dereq_,module,exports){ 'use strict' module.exports = gradient @@ -63080,7 +63468,7 @@ function gradient(out, inp, bc) { var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":151,"dup":176}],463:[function(_dereq_,module,exports){ +},{"cwise-compiler":151,"dup":176}],489:[function(_dereq_,module,exports){ "use strict" function interp1d(arr, x) { @@ -63191,7 +63579,7 @@ module.exports.d1 = interp1d module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],464:[function(_dereq_,module,exports){ +},{}],490:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("cwise-compiler") @@ -63654,7 +64042,7 @@ exports.equals = compile({ -},{"cwise-compiler":151}],465:[function(_dereq_,module,exports){ +},{"cwise-compiler":151}],491:[function(_dereq_,module,exports){ "use strict" var ndarray = _dereq_("ndarray") @@ -63677,10 +64065,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":466,"ndarray":469}],466:[function(_dereq_,module,exports){ +},{"./doConvert.js":492,"ndarray":495}],492:[function(_dereq_,module,exports){ module.exports=_dereq_('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":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":151}],467:[function(_dereq_,module,exports){ +},{"cwise-compiler":151}],493:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -64409,7 +64797,7 @@ function compileSort(order, dtype) { } module.exports = compileSort -},{"typedarray-pool":567}],468:[function(_dereq_,module,exports){ +},{"typedarray-pool":595}],494:[function(_dereq_,module,exports){ "use strict" var compile = _dereq_("./lib/compile_sort.js") @@ -64429,7 +64817,7 @@ function sort(array) { } module.exports = sort -},{"./lib/compile_sort.js":467}],469:[function(_dereq_,module,exports){ +},{"./lib/compile_sort.js":493}],495:[function(_dereq_,module,exports){ var iota = _dereq_("iota-array") var isBuffer = _dereq_("is-buffer") @@ -64780,7 +65168,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":437,"is-buffer":439}],470:[function(_dereq_,module,exports){ +},{"iota-array":463,"is-buffer":465}],496:[function(_dereq_,module,exports){ "use strict" var doubleBits = _dereq_("double-bits") @@ -64823,7 +65211,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":173}],471:[function(_dereq_,module,exports){ +},{"double-bits":173}],497:[function(_dereq_,module,exports){ var π = Math.PI var _120 = radians(120) @@ -65025,7 +65413,7 @@ function radians(degress){ return degress * (π / 180) } -},{}],472:[function(_dereq_,module,exports){ +},{}],498:[function(_dereq_,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -65150,7 +65538,7 @@ exports.faceNormals = function(faces, positions, specifiedEpsilon) { -},{}],473:[function(_dereq_,module,exports){ +},{}],499:[function(_dereq_,module,exports){ /* object-assign (c) Sindre Sorhus @@ -65242,7 +65630,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],474:[function(_dereq_,module,exports){ +},{}],500:[function(_dereq_,module,exports){ 'use strict' module.exports = quatFromFrame @@ -65284,7 +65672,7 @@ function quatFromFrame( } return out } -},{}],475:[function(_dereq_,module,exports){ +},{}],501:[function(_dereq_,module,exports){ 'use strict' module.exports = createOrbitController @@ -65678,7 +66066,7 @@ function createOrbitController(options) { return result } -},{"./lib/quatFromFrame":474,"filtered-vector":242,"gl-mat4/fromQuat":275,"gl-mat4/invert":278,"gl-mat4/lookAt":279}],476:[function(_dereq_,module,exports){ +},{"./lib/quatFromFrame":500,"filtered-vector":242,"gl-mat4/fromQuat":282,"gl-mat4/invert":293,"gl-mat4/lookAt":294}],502:[function(_dereq_,module,exports){ /*! * pad-left * @@ -65694,7 +66082,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":513}],477:[function(_dereq_,module,exports){ +},{"repeat-string":541}],503:[function(_dereq_,module,exports){ 'use strict' /** @@ -65831,7 +66219,7 @@ parenthesis.stringify = stringify module.exports = parenthesis -},{}],478:[function(_dereq_,module,exports){ +},{}],504:[function(_dereq_,module,exports){ 'use strict' var pick = _dereq_('pick-by-alias') @@ -65918,7 +66306,7 @@ function parseRect (arg) { return rect } -},{"pick-by-alias":485}],479:[function(_dereq_,module,exports){ +},{"pick-by-alias":511}],505:[function(_dereq_,module,exports){ module.exports = parse @@ -65977,7 +66365,7 @@ function parseValues(args) { return numbers ? numbers.map(Number) : [] } -},{}],480:[function(_dereq_,module,exports){ +},{}],506:[function(_dereq_,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -65988,10 +66376,10 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],481:[function(_dereq_,module,exports){ -(function (process){ -// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, -// backported and transplited with Babel, with backwards-compat fixes +},{}],507:[function(_dereq_,module,exports){ +(function (process){(function (){ +// 'path' module extracted from Node.js v8.11.1 (only the posix part) +// transplited with Babel // Copyright Joyent, Inc. and other Node contributors. // @@ -66014,288 +66402,515 @@ module.exports = function parseUnit(str, out) { // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } +'use strict'; + +function assertPath(path) { + if (typeof path !== 'string') { + throw new TypeError('Path must be a string. Received ' + JSON.stringify(path)); } +} - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); +// Resolves . and .. elements in a path with directory names +function normalizeStringPosix(path, allowAboveRoot) { + var res = ''; + var lastSegmentLength = 0; + var lastSlash = -1; + var dots = 0; + var code; + for (var i = 0; i <= path.length; ++i) { + if (i < path.length) + code = path.charCodeAt(i); + else if (code === 47 /*/*/) + break; + else + code = 47 /*/*/; + if (code === 47 /*/*/) { + if (lastSlash === i - 1 || dots === 1) { + // NOOP + } else if (lastSlash !== i - 1 && dots === 2) { + if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) { + if (res.length > 2) { + var lastSlashIndex = res.lastIndexOf('/'); + if (lastSlashIndex !== res.length - 1) { + if (lastSlashIndex === -1) { + res = ''; + lastSegmentLength = 0; + } else { + res = res.slice(0, lastSlashIndex); + lastSegmentLength = res.length - 1 - res.lastIndexOf('/'); + } + lastSlash = i; + dots = 0; + continue; + } + } else if (res.length === 2 || res.length === 1) { + res = ''; + lastSegmentLength = 0; + lastSlash = i; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + if (res.length > 0) + res += '/..'; + else + res = '..'; + lastSegmentLength = 2; + } + } else { + if (res.length > 0) + res += '/' + path.slice(lastSlash + 1, i); + else + res = path.slice(lastSlash + 1, i); + lastSegmentLength = i - lastSlash - 1; + } + lastSlash = i; + dots = 0; + } else if (code === 46 /*.*/ && dots !== -1) { + ++dots; + } else { + dots = -1; } } + return res; +} - return parts; +function _format(sep, pathObject) { + var dir = pathObject.dir || pathObject.root; + var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || ''); + if (!dir) { + return base; + } + if (dir === pathObject.root) { + return dir + base; + } + return dir + sep + base; } -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; +var posix = { + // path.resolve([from ...], to) + resolve: function resolve() { + var resolvedPath = ''; + var resolvedAbsolute = false; + var cwd; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path; + if (i >= 0) + path = arguments[i]; + else { + if (cwd === undefined) + cwd = process.cwd(); + path = cwd; + } + + assertPath(path); - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); + // Skip empty entries + if (path.length === 0) { + continue; + } - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/; } - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) + // Normalize the path + resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute); - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); + if (resolvedAbsolute) { + if (resolvedPath.length > 0) + return '/' + resolvedPath; + else + return '/'; + } else if (resolvedPath.length > 0) { + return resolvedPath; + } else { + return '.'; + } + }, - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; + normalize: function normalize(path) { + assertPath(path); -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; + if (path.length === 0) return '.'; - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); + var isAbsolute = path.charCodeAt(0) === 47 /*/*/; + var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/; - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } + // Normalize the path + path = normalizeStringPosix(path, !isAbsolute); - return (isAbsolute ? '/' : '') + path; -}; + if (path.length === 0 && !isAbsolute) path = '.'; + if (path.length > 0 && trailingSeparator) path += '/'; -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; + if (isAbsolute) return '/' + path; + return path; + }, + + isAbsolute: function isAbsolute(path) { + assertPath(path); + return path.length > 0 && path.charCodeAt(0) === 47 /*/*/; + }, -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); + join: function join() { + if (arguments.length === 0) + return '.'; + var joined; + for (var i = 0; i < arguments.length; ++i) { + var arg = arguments[i]; + assertPath(arg); + if (arg.length > 0) { + if (joined === undefined) + joined = arg; + else + joined += '/' + arg; + } } - return p; - }).join('/')); -}; + if (joined === undefined) + return '.'; + return posix.normalize(joined); + }, + relative: function relative(from, to) { + assertPath(from); + assertPath(to); -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); + if (from === to) return ''; - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; + from = posix.resolve(from); + to = posix.resolve(to); + + if (from === to) return ''; + + // Trim any leading backslashes + var fromStart = 1; + for (; fromStart < from.length; ++fromStart) { + if (from.charCodeAt(fromStart) !== 47 /*/*/) + break; } + var fromEnd = from.length; + var fromLen = fromEnd - fromStart; - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; + // Trim any leading backslashes + var toStart = 1; + for (; toStart < to.length; ++toStart) { + if (to.charCodeAt(toStart) !== 47 /*/*/) + break; } + var toEnd = to.length; + var toLen = toEnd - toStart; - if (start > end) return []; - return arr.slice(start, end - start + 1); - } + // Compare paths to find the longest common path from root + var length = fromLen < toLen ? fromLen : toLen; + var lastCommonSep = -1; + var i = 0; + for (; i <= length; ++i) { + if (i === length) { + if (toLen > length) { + if (to.charCodeAt(toStart + i) === 47 /*/*/) { + // We get here if `from` is the exact base path for `to`. + // For example: from='/foo/bar'; to='/foo/bar/baz' + return to.slice(toStart + i + 1); + } else if (i === 0) { + // We get here if `from` is the root + // For example: from='/'; to='/foo' + return to.slice(toStart + i); + } + } else if (fromLen > length) { + if (from.charCodeAt(fromStart + i) === 47 /*/*/) { + // We get here if `to` is the exact base path for `from`. + // For example: from='/foo/bar/baz'; to='/foo/bar' + lastCommonSep = i; + } else if (i === 0) { + // We get here if `to` is the root. + // For example: from='/foo'; to='/' + lastCommonSep = 0; + } + } + break; + } + var fromCode = from.charCodeAt(fromStart + i); + var toCode = to.charCodeAt(toStart + i); + if (fromCode !== toCode) + break; + else if (fromCode === 47 /*/*/) + lastCommonSep = i; + } - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); + var out = ''; + // Generate the relative path based on the path difference between `to` + // and `from` + for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { + if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) { + if (out.length === 0) + out += '..'; + else + out += '/..'; + } + } - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; + // Lastly, append the rest of the destination (`to`) path that comes after + // the common path parts + if (out.length > 0) + return out + to.slice(toStart + lastCommonSep); + else { + toStart += lastCommonSep; + if (to.charCodeAt(toStart) === 47 /*/*/) + ++toStart; + return to.slice(toStart); } - } + }, - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } + _makeLong: function _makeLong(path) { + return path; + }, - outputParts = outputParts.concat(toParts.slice(samePartsLength)); + dirname: function dirname(path) { + assertPath(path); + if (path.length === 0) return '.'; + var code = path.charCodeAt(0); + var hasRoot = code === 47 /*/*/; + var end = -1; + var matchedSlash = true; + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47 /*/*/) { + if (!matchedSlash) { + end = i; + break; + } + } else { + // We saw the first non-path separator + matchedSlash = false; + } + } - return outputParts.join('/'); -}; + if (end === -1) return hasRoot ? '/' : '.'; + if (hasRoot && end === 1) return '//'; + return path.slice(0, end); + }, -exports.sep = '/'; -exports.delimiter = ':'; + basename: function basename(path, ext) { + if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string'); + assertPath(path); -exports.dirname = function (path) { - if (typeof path !== 'string') path = path + ''; - if (path.length === 0) return '.'; - var code = path.charCodeAt(0); - var hasRoot = code === 47 /*/*/; - var end = -1; - var matchedSlash = true; - for (var i = path.length - 1; i >= 1; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - if (!matchedSlash) { - end = i; - break; + var start = 0; + var end = -1; + var matchedSlash = true; + var i; + + if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { + if (ext.length === path.length && ext === path) return ''; + var extIdx = ext.length - 1; + var firstNonSlashEnd = -1; + for (i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false; + firstNonSlashEnd = i + 1; + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === ext.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i; + } + } else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1; + end = firstNonSlashEnd; + } + } } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } + } - if (end === -1) return hasRoot ? '/' : '.'; - if (hasRoot && end === 1) { - // return '//'; - // Backwards-compat fix: - return '/'; - } - return path.slice(0, end); -}; + if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length; + return path.slice(start, end); + } else { + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } -function basename(path) { - if (typeof path !== 'string') path = path + ''; + if (end === -1) return ''; + return path.slice(start, end); + } + }, - var start = 0; - var end = -1; - var matchedSlash = true; - var i; + extname: function extname(path) { + assertPath(path); + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + startDot = i; + else if (preDotState !== 1) + preDotState = 1; + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + + if (startDot === -1 || end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ''; + } + return path.slice(startDot, end); + }, - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; + format: function format(pathObject) { + if (pathObject === null || typeof pathObject !== 'object') { + throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject); + } + return _format('/', pathObject); + }, + + parse: function parse(path) { + assertPath(path); + + var ret = { root: '', dir: '', base: '', ext: '', name: '' }; + if (path.length === 0) return ret; + var code = path.charCodeAt(0); + var isAbsolute = code === 47 /*/*/; + var start; + if (isAbsolute) { + ret.root = '/'; + start = 1; + } else { + start = 0; + } + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + var i = path.length - 1; + + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + + // Get non-dir info + for (; i >= start; --i) { + code = path.charCodeAt(i); + if (code === 47 /*/*/) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46 /*.*/) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1; + } else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } } - } - if (end === -1) return ''; - return path.slice(start, end); -} + if (startDot === -1 || end === -1 || + // We saw a non-dot character immediately before the dot + preDotState === 0 || + // The (right-most) trimmed path component is exactly '..' + preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + if (end !== -1) { + if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end); + } + } else { + if (startPart === 0 && isAbsolute) { + ret.name = path.slice(1, startDot); + ret.base = path.slice(1, end); + } else { + ret.name = path.slice(startPart, startDot); + ret.base = path.slice(startPart, end); + } + ret.ext = path.slice(startDot, end); + } -// Uses a mixed approach for backwards-compatibility, as ext behavior changed -// in new Node.js versions, so only basename() above is backported here -exports.basename = function (path, ext) { - var f = basename(path); - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; + if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/'; -exports.extname = function (path) { - if (typeof path !== 'string') path = path + ''; - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) - startDot = i; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ''; - } - return path.slice(startDot, end); + return ret; + }, + + sep: '/', + delimiter: ':', + win32: null, + posix: null }; -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} +posix.posix = posix; -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; +module.exports = posix; -}).call(this,_dereq_('_process')) -},{"_process":500}],482:[function(_dereq_,module,exports){ -(function (process){ +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":526}],508:[function(_dereq_,module,exports){ +(function (process){(function (){ // Generated by CoffeeScript 1.12.2 (function() { var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; @@ -66333,8 +66948,8 @@ var substr = 'ab'.substr(-1) === 'b' -}).call(this,_dereq_('_process')) -},{"_process":500}],483:[function(_dereq_,module,exports){ +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":526}],509:[function(_dereq_,module,exports){ "use strict" module.exports = permutationSign @@ -66386,7 +67001,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":567}],484:[function(_dereq_,module,exports){ +},{"typedarray-pool":595}],510:[function(_dereq_,module,exports){ "use strict" var pool = _dereq_("typedarray-pool") @@ -66473,7 +67088,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":436,"typedarray-pool":567}],485:[function(_dereq_,module,exports){ +},{"invert-permutation":462,"typedarray-pool":595}],511:[function(_dereq_,module,exports){ 'use strict' @@ -66552,7 +67167,7 @@ function toList(arg) { return arg } -},{}],486:[function(_dereq_,module,exports){ +},{}],512:[function(_dereq_,module,exports){ "use strict" module.exports = planarDual @@ -66683,7 +67298,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":132}],487:[function(_dereq_,module,exports){ +},{"compare-angle":132}],513:[function(_dereq_,module,exports){ 'use strict' module.exports = trimLeaves @@ -66739,7 +67354,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":178}],488:[function(_dereq_,module,exports){ +},{"edges-to-adjacency-list":178}],514:[function(_dereq_,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -66944,9 +67559,9 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":487,"edges-to-adjacency-list":178,"planar-dual":486,"point-in-big-polygon":490,"robust-sum":525,"two-product":554,"uniq":569}],489:[function(_dereq_,module,exports){ +},{"./lib/trim-leaves":513,"edges-to-adjacency-list":178,"planar-dual":512,"point-in-big-polygon":516,"robust-sum":553,"two-product":582,"uniq":597}],515:[function(_dereq_,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],490:[function(_dereq_,module,exports){ +},{"dup":243}],516:[function(_dereq_,module,exports){ module.exports = preprocessPolygon var orient = _dereq_('robust-orientation')[3] @@ -67098,7 +67713,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":489,"interval-tree-1d":434,"robust-orientation":520,"slab-decomposition":537}],491:[function(_dereq_,module,exports){ +},{"binary-search-bounds":515,"interval-tree-1d":460,"robust-orientation":548,"slab-decomposition":565}],517:[function(_dereq_,module,exports){ /* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT @@ -67226,7 +67841,7 @@ if (typeof window === 'object') module.exports = PolyBool; -},{"./lib/build-log":492,"./lib/epsilon":493,"./lib/geojson":494,"./lib/intersecter":495,"./lib/segment-chainer":497,"./lib/segment-selector":498}],492:[function(_dereq_,module,exports){ +},{"./lib/build-log":518,"./lib/epsilon":519,"./lib/geojson":520,"./lib/intersecter":521,"./lib/segment-chainer":523,"./lib/segment-selector":524}],518:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -67341,7 +67956,7 @@ function BuildLog(){ module.exports = BuildLog; -},{}],493:[function(_dereq_,module,exports){ +},{}],519:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -67513,7 +68128,7 @@ function Epsilon(eps){ module.exports = Epsilon; -},{}],494:[function(_dereq_,module,exports){ +},{}],520:[function(_dereq_,module,exports){ // (c) Copyright 2017, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -67703,7 +68318,7 @@ var GeoJSON = { module.exports = GeoJSON; -},{}],495:[function(_dereq_,module,exports){ +},{}],521:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -68210,7 +68825,7 @@ function Intersecter(selfIntersection, eps, buildLog){ module.exports = Intersecter; -},{"./linked-list":496}],496:[function(_dereq_,module,exports){ +},{"./linked-list":522}],522:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -68293,7 +68908,7 @@ var LinkedList = { module.exports = LinkedList; -},{}],497:[function(_dereq_,module,exports){ +},{}],523:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -68547,7 +69162,7 @@ function SegmentChainer(segments, eps, buildLog){ module.exports = SegmentChainer; -},{}],498:[function(_dereq_,module,exports){ +},{}],524:[function(_dereq_,module,exports){ // (c) Copyright 2016, Sean Connelly (@voidqk), http://syntheti.cc // MIT License // Project Home: https://github.com/voidqk/polybooljs @@ -68715,7 +69330,7 @@ var SegmentSelector = { module.exports = SegmentSelector; -},{}],499:[function(_dereq_,module,exports){ +},{}],525:[function(_dereq_,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -68913,7 +69528,7 @@ function closestPoint2d(V0, V1, V2, point, result) { module.exports = closestPoint2d; -},{}],500:[function(_dereq_,module,exports){ +},{}],526:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -69099,10 +69714,10 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],501:[function(_dereq_,module,exports){ +},{}],527:[function(_dereq_,module,exports){ module.exports = _dereq_('gl-quat/slerp') -},{"gl-quat/slerp":304}],502:[function(_dereq_,module,exports){ -(function (global){ +},{"gl-quat/slerp":325}],528:[function(_dereq_,module,exports){ +(function (global){(function (){ var now = _dereq_('performance-now') , root = typeof window === 'undefined' ? global : window , vendors = ['moz', 'webkit'] @@ -69179,8 +69794,8 @@ module.exports.polyfill = function(object) { object.cancelAnimationFrame = caf } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"performance-now":482}],503:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"performance-now":508}],529:[function(_dereq_,module,exports){ 'use strict' var bnadd = _dereq_('big-rat/add') @@ -69196,7 +69811,7 @@ function add (a, b) { return r } -},{"big-rat/add":80}],504:[function(_dereq_,module,exports){ +},{"big-rat/add":80}],530:[function(_dereq_,module,exports){ 'use strict' module.exports = float2rat @@ -69211,7 +69826,7 @@ function float2rat(v) { return result } -},{"big-rat":83}],505:[function(_dereq_,module,exports){ +},{"big-rat":83}],531:[function(_dereq_,module,exports){ 'use strict' var rat = _dereq_('big-rat') @@ -69229,7 +69844,7 @@ function muls(a, x) { return r } -},{"big-rat":83,"big-rat/mul":92}],506:[function(_dereq_,module,exports){ +},{"big-rat":83,"big-rat/mul":92}],532:[function(_dereq_,module,exports){ 'use strict' var bnsub = _dereq_('big-rat/sub') @@ -69245,7 +69860,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":94}],507:[function(_dereq_,module,exports){ +},{"big-rat/sub":94}],533:[function(_dereq_,module,exports){ 'use strict' var compareCell = _dereq_('compare-cell') @@ -69278,7 +69893,7 @@ function reduceCellComplex(cells) { return cells } -},{"cell-orientation":117,"compare-cell":133,"compare-oriented-cell":134}],508:[function(_dereq_,module,exports){ +},{"cell-orientation":117,"compare-cell":133,"compare-oriented-cell":134}],534:[function(_dereq_,module,exports){ 'use strict' var getBounds = _dereq_('array-bounds') @@ -69765,7 +70380,7 @@ function Error2D (regl, options) { } } -},{"array-bounds":70,"color-normalize":125,"flatten-vertex-data":244,"object-assign":473,"pick-by-alias":485,"to-float32":549,"update-diff":571}],509:[function(_dereq_,module,exports){ +},{"array-bounds":70,"color-normalize":125,"flatten-vertex-data":244,"object-assign":499,"pick-by-alias":511,"to-float32":577,"update-diff":599}],535:[function(_dereq_,module,exports){ 'use strict' @@ -70494,7 +71109,9 @@ Line2D.prototype.destroy = function () { return this } -},{"array-bounds":70,"array-normalize":71,"color-normalize":125,"earcut":177,"es6-weak-map":233,"flatten-vertex-data":244,"glslify":413,"object-assign":473,"parse-rect":478,"pick-by-alias":485,"to-float32":549}],510:[function(_dereq_,module,exports){ +},{"array-bounds":70,"array-normalize":71,"color-normalize":125,"earcut":177,"es6-weak-map":233,"flatten-vertex-data":244,"glslify":536,"object-assign":499,"parse-rect":504,"pick-by-alias":511,"to-float32":577}],536:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],537:[function(_dereq_,module,exports){ 'use strict'; function _slicedToArray(arr, i) { @@ -71478,7 +72095,9 @@ var reglScatter2d = function reglScatter2d(regl, options) { module.exports = reglScatter2d; -},{"@plotly/point-cluster":57,"array-bounds":70,"color-id":123,"color-normalize":125,"flatten-vertex-data":244,"glslify":413,"is-iexplorer":440,"object-assign":473,"parse-rect":478,"pick-by-alias":485,"to-float32":549,"update-diff":571}],511:[function(_dereq_,module,exports){ +},{"@plotly/point-cluster":57,"array-bounds":70,"color-id":123,"color-normalize":125,"flatten-vertex-data":244,"glslify":538,"is-iexplorer":466,"object-assign":499,"parse-rect":504,"pick-by-alias":511,"to-float32":577,"update-diff":599}],538:[function(_dereq_,module,exports){ +arguments[4][257][0].apply(exports,arguments) +},{"dup":257}],539:[function(_dereq_,module,exports){ 'use strict' @@ -71900,7 +72519,7 @@ function getPad (arg) { } } -},{"array-bounds":70,"array-range":72,"flatten-vertex-data":244,"parse-rect":478,"pick-by-alias":485,"raf":502,"regl-scatter2d":510}],512:[function(_dereq_,module,exports){ +},{"array-bounds":70,"array-range":72,"flatten-vertex-data":244,"parse-rect":504,"pick-by-alias":511,"raf":528,"regl-scatter2d":537}],540:[function(_dereq_,module,exports){ (function(ja,N){"object"===typeof exports&&"undefined"!==typeof module?module.exports=N():"function"===typeof define&&define.amd?define(N):ja.createREGL=N()})(this,function(){function ja(a,b){this.id=Bb++;this.type=a;this.data=b}function N(a){if(0===a.length)return[];var b=a.charAt(0),c=a.charAt(a.length-1);if(1b;+ b){var c;switch(a){case "frame":return u(b);case "lost":c=V;break;case "restore":c=X;break;case "destroy":c=Y}c.push(b);return{cancel:function(){for(var a=0;a * @@ -72135,8 +72754,8 @@ function repeat(str, num) { return res; } -},{}],514:[function(_dereq_,module,exports){ -(function (global){ +},{}],542:[function(_dereq_,module,exports){ +(function (global){(function (){ module.exports = global.performance && global.performance.now ? function now() { @@ -72145,8 +72764,8 @@ module.exports = return +new Date } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],515:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],543:[function(_dereq_,module,exports){ "use strict" module.exports = compressExpansion @@ -72181,7 +72800,7 @@ function compressExpansion(e) { e.length = top return e } -},{}],516:[function(_dereq_,module,exports){ +},{}],544:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72285,7 +72904,7 @@ return robustDeterminant") } generateDispatch() -},{"robust-compress":515,"robust-scale":522,"robust-sum":525,"two-product":554}],517:[function(_dereq_,module,exports){ +},{"robust-compress":543,"robust-scale":550,"robust-sum":553,"two-product":582}],545:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72300,7 +72919,7 @@ function robustDotProduct(a, b) { } return r } -},{"robust-sum":525,"two-product":554}],518:[function(_dereq_,module,exports){ +},{"robust-sum":553,"two-product":582}],546:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72468,7 +73087,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":522,"robust-subtract":524,"robust-sum":525,"two-product":554}],519:[function(_dereq_,module,exports){ +},{"robust-scale":550,"robust-subtract":552,"robust-sum":553,"two-product":582}],547:[function(_dereq_,module,exports){ "use strict" var determinant = _dereq_("robust-determinant") @@ -72540,7 +73159,7 @@ function generateDispatch() { } generateDispatch() -},{"robust-determinant":516}],520:[function(_dereq_,module,exports){ +},{"robust-determinant":544}],548:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72731,7 +73350,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":522,"robust-subtract":524,"robust-sum":525,"two-product":554}],521:[function(_dereq_,module,exports){ +},{"robust-scale":550,"robust-subtract":552,"robust-sum":553,"two-product":582}],549:[function(_dereq_,module,exports){ "use strict" var robustSum = _dereq_("robust-sum") @@ -72761,7 +73380,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":522,"robust-sum":525}],522:[function(_dereq_,module,exports){ +},{"robust-scale":550,"robust-sum":553}],550:[function(_dereq_,module,exports){ "use strict" var twoProduct = _dereq_("two-product") @@ -72812,7 +73431,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":554,"two-sum":555}],523:[function(_dereq_,module,exports){ +},{"two-product":582,"two-sum":583}],551:[function(_dereq_,module,exports){ "use strict" module.exports = segmentsIntersect @@ -72860,7 +73479,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":520}],524:[function(_dereq_,module,exports){ +},{"robust-orientation":548}],552:[function(_dereq_,module,exports){ "use strict" module.exports = robustSubtract @@ -73017,7 +73636,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],525:[function(_dereq_,module,exports){ +},{}],553:[function(_dereq_,module,exports){ "use strict" module.exports = linearExpansionSum @@ -73174,7 +73793,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],526:[function(_dereq_,module,exports){ +},{}],554:[function(_dereq_,module,exports){ "use strict" module.exports = function signum(x) { @@ -73182,7 +73801,7 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],527:[function(_dereq_,module,exports){ +},{}],555:[function(_dereq_,module,exports){ 'use strict' module.exports = boundary @@ -73194,7 +73813,7 @@ function boundary(cells) { return reduce(bnd(cells)) } -},{"boundary-cells":100,"reduce-simplicial-complex":507}],528:[function(_dereq_,module,exports){ +},{"boundary-cells":100,"reduce-simplicial-complex":533}],556:[function(_dereq_,module,exports){ 'use strict' module.exports = extractContour @@ -73357,7 +73976,7 @@ function extractContour(cells, values, level, d) { vertexWeights: uweights } } -},{"./lib/codegen":529,"ndarray":469,"ndarray-sort":468,"typedarray-pool":567}],529:[function(_dereq_,module,exports){ +},{"./lib/codegen":557,"ndarray":495,"ndarray-sort":494,"typedarray-pool":595}],557:[function(_dereq_,module,exports){ 'use strict' module.exports = getPolygonizer @@ -73454,7 +74073,7 @@ function getPolygonizer(d) { } return alg } -},{"marching-simplex-table":448,"typedarray-pool":567}],530:[function(_dereq_,module,exports){ +},{"marching-simplex-table":474,"typedarray-pool":595}],558:[function(_dereq_,module,exports){ "use strict"; "use restrict"; var bits = _dereq_("bit-twiddle") @@ -73798,11 +74417,11 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":97,"union-find":568}],531:[function(_dereq_,module,exports){ +},{"bit-twiddle":97,"union-find":596}],559:[function(_dereq_,module,exports){ arguments[4][97][0].apply(exports,arguments) -},{"dup":97}],532:[function(_dereq_,module,exports){ -arguments[4][530][0].apply(exports,arguments) -},{"bit-twiddle":531,"dup":530,"union-find":533}],533:[function(_dereq_,module,exports){ +},{"dup":97}],560:[function(_dereq_,module,exports){ +arguments[4][558][0].apply(exports,arguments) +},{"bit-twiddle":559,"dup":558,"union-find":561}],561:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -73859,7 +74478,7 @@ UnionFind.prototype.link = function(x, y) { } -},{}],534:[function(_dereq_,module,exports){ +},{}],562:[function(_dereq_,module,exports){ "use strict" module.exports = simplifyPolygon @@ -74131,7 +74750,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":520,"simplicial-complex":532}],535:[function(_dereq_,module,exports){ +},{"robust-orientation":548,"simplicial-complex":560}],563:[function(_dereq_,module,exports){ "use strict" module.exports = orderSegments @@ -74227,9 +74846,9 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":520}],536:[function(_dereq_,module,exports){ +},{"robust-orientation":548}],564:[function(_dereq_,module,exports){ arguments[4][243][0].apply(exports,arguments) -},{"dup":243}],537:[function(_dereq_,module,exports){ +},{"dup":243}],565:[function(_dereq_,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -74460,7 +75079,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":535,"binary-search-bounds":536,"functional-red-black-tree":247,"robust-orientation":520}],538:[function(_dereq_,module,exports){ +},{"./lib/order-segments":563,"binary-search-bounds":564,"functional-red-black-tree":247,"robust-orientation":548}],566:[function(_dereq_,module,exports){ "use strict" var robustDot = _dereq_("robust-dot-product") @@ -74552,7 +75171,7 @@ function negative(points, plane) { } return neg } -},{"robust-dot-product":517,"robust-sum":525}],539:[function(_dereq_,module,exports){ +},{"robust-dot-product":545,"robust-sum":553}],567:[function(_dereq_,module,exports){ /* global window, exports, define */ !function() { @@ -74785,7 +75404,7 @@ function negative(points, plane) { /* eslint-enable quote-props */ }(); // eslint-disable-line -},{}],540:[function(_dereq_,module,exports){ +},{}],568:[function(_dereq_,module,exports){ 'use strict' var paren = _dereq_('parenthesis') @@ -74843,7 +75462,7 @@ module.exports = function splitBy (string, separator, o) { return parts } -},{"parenthesis":477}],541:[function(_dereq_,module,exports){ +},{"parenthesis":503}],569:[function(_dereq_,module,exports){ "use strict" module.exports = stronglyConnectedComponents @@ -74959,7 +75578,7 @@ function stronglyConnectedComponents(adjList) { return {components: components, adjacencyList: sccAdjList} } -},{}],542:[function(_dereq_,module,exports){ +},{}],570:[function(_dereq_,module,exports){ "use strict" module.exports = surfaceNets @@ -75167,7 +75786,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":461,"triangulate-hypercube":552,"zero-crossings":596}],543:[function(_dereq_,module,exports){ +},{"ndarray-extract-contour":487,"triangulate-hypercube":580,"zero-crossings":624}],571:[function(_dereq_,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -75358,7 +75977,7 @@ var arcToBezier = function arcToBezier(_ref2) { exports.default = arcToBezier; module.exports = exports.default; -},{}],544:[function(_dereq_,module,exports){ +},{}],572:[function(_dereq_,module,exports){ 'use strict' var parse = _dereq_('parse-svg-path') @@ -75403,7 +76022,7 @@ function pathBounds(path) { return bounds } -},{"abs-svg-path":65,"assert":73,"is-svg-path":445,"normalize-svg-path":545,"parse-svg-path":479}],545:[function(_dereq_,module,exports){ +},{"abs-svg-path":65,"assert":73,"is-svg-path":471,"normalize-svg-path":573,"parse-svg-path":505}],573:[function(_dereq_,module,exports){ 'use strict' module.exports = normalize @@ -75527,7 +76146,7 @@ function quadratic(x1, y1, cx, cy, x2, y2){ ] } -},{"svg-arc-to-cubic-bezier":543}],546:[function(_dereq_,module,exports){ +},{"svg-arc-to-cubic-bezier":571}],574:[function(_dereq_,module,exports){ 'use strict' var pathBounds = _dereq_('svg-path-bounds') @@ -75630,8 +76249,8 @@ function isPath2DSupported () { return path2DSupported = idata && idata.data && idata.data[3] === 255 } -},{"bitmap-sdf":98,"draw-svg-path":174,"is-svg-path":445,"parse-svg-path":479,"svg-path-bounds":544}],547:[function(_dereq_,module,exports){ -(function (process){ +},{"bitmap-sdf":98,"draw-svg-path":174,"is-svg-path":471,"parse-svg-path":505,"svg-path-bounds":572}],575:[function(_dereq_,module,exports){ +(function (process){(function (){ 'use strict' module.exports = textGet @@ -75726,9 +76345,9 @@ function textGet(font, text, opts) { return mesh } -}).call(this,_dereq_('_process')) -},{"_process":500,"vectorize-text":572}],548:[function(_dereq_,module,exports){ -// TinyColor v1.4.1 +}).call(this)}).call(this,_dereq_('_process')) +},{"_process":526,"vectorize-text":600}],576:[function(_dereq_,module,exports){ +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -76924,7 +77543,7 @@ else { })(Math); -},{}],549:[function(_dereq_,module,exports){ +},{}],577:[function(_dereq_,module,exports){ /* @module to-float32 */ 'use strict' @@ -76965,7 +77584,7 @@ function float32 (arr) { return narr[0] } -},{}],550:[function(_dereq_,module,exports){ +},{}],578:[function(_dereq_,module,exports){ 'use strict' var parseUnit = _dereq_('parse-unit') @@ -77026,7 +77645,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":480}],551:[function(_dereq_,module,exports){ +},{"parse-unit":506}],579:[function(_dereq_,module,exports){ // https://github.com/topojson/topojson-client v3.1.0 Copyright 2019 Mike Bostock (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -77536,7 +78155,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); })); -},{}],552:[function(_dereq_,module,exports){ +},{}],580:[function(_dereq_,module,exports){ "use strict" module.exports = triangulateCube @@ -77570,7 +78189,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":248,"permutation-parity":483,"permutation-rank":484}],553:[function(_dereq_,module,exports){ +},{"gamma":248,"permutation-parity":509,"permutation-rank":510}],581:[function(_dereq_,module,exports){ 'use strict' module.exports = createTurntableController @@ -78143,7 +78762,7 @@ function createTurntableController(options) { theta, phi) } -},{"filtered-vector":242,"gl-mat4/invert":278,"gl-mat4/rotate":283,"gl-vec3/cross":339,"gl-vec3/dot":344,"gl-vec3/normalize":361}],554:[function(_dereq_,module,exports){ +},{"filtered-vector":242,"gl-mat4/invert":293,"gl-mat4/rotate":299,"gl-vec3/cross":365,"gl-vec3/dot":370,"gl-vec3/normalize":387}],582:[function(_dereq_,module,exports){ "use strict" module.exports = twoProduct @@ -78177,7 +78796,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],555:[function(_dereq_,module,exports){ +},{}],583:[function(_dereq_,module,exports){ "use strict" module.exports = fastTwoSum @@ -78195,7 +78814,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],556:[function(_dereq_,module,exports){ +},{}],584:[function(_dereq_,module,exports){ "use strict"; var isPrototype = _dereq_("../prototype/is"); @@ -78216,7 +78835,7 @@ module.exports = function (value) { return !isPrototype(value); }; -},{"../prototype/is":563}],557:[function(_dereq_,module,exports){ +},{"../prototype/is":591}],585:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is") @@ -78239,7 +78858,7 @@ module.exports = function (value, defaultMessage, inputOptions) { throw new TypeError(resolveMessage(errorMessage, value)); }; -},{"../object/is":560,"../string/coerce":564,"../value/is":566,"./to-short-string":559}],558:[function(_dereq_,module,exports){ +},{"../object/is":588,"../string/coerce":592,"../value/is":594,"./to-short-string":587}],586:[function(_dereq_,module,exports){ "use strict"; module.exports = function (value) { @@ -78251,7 +78870,7 @@ module.exports = function (value) { } }; -},{}],559:[function(_dereq_,module,exports){ +},{}],587:[function(_dereq_,module,exports){ "use strict"; var safeToString = _dereq_("./safe-to-string"); @@ -78282,7 +78901,7 @@ module.exports = function (value) { return string; }; -},{"./safe-to-string":558}],560:[function(_dereq_,module,exports){ +},{"./safe-to-string":586}],588:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is"); @@ -78295,7 +78914,7 @@ module.exports = function (value) { return hasOwnProperty.call(possibleTypes, typeof value); }; -},{"../value/is":566}],561:[function(_dereq_,module,exports){ +},{"../value/is":594}],589:[function(_dereq_,module,exports){ "use strict"; var resolveException = _dereq_("../lib/resolve-exception") @@ -78306,7 +78925,7 @@ module.exports = function (value/*, options*/) { return resolveException(value, "%v is not a plain function", arguments[1]); }; -},{"../lib/resolve-exception":557,"./is":562}],562:[function(_dereq_,module,exports){ +},{"../lib/resolve-exception":585,"./is":590}],590:[function(_dereq_,module,exports){ "use strict"; var isFunction = _dereq_("../function/is"); @@ -78319,7 +78938,7 @@ module.exports = function (value) { return true; }; -},{"../function/is":556}],563:[function(_dereq_,module,exports){ +},{"../function/is":584}],591:[function(_dereq_,module,exports){ "use strict"; var isObject = _dereq_("../object/is"); @@ -78334,7 +78953,7 @@ module.exports = function (value) { } }; -},{"../object/is":560}],564:[function(_dereq_,module,exports){ +},{"../object/is":588}],592:[function(_dereq_,module,exports){ "use strict"; var isValue = _dereq_("../value/is") @@ -78359,7 +78978,7 @@ module.exports = function (value) { } }; -},{"../object/is":560,"../value/is":566}],565:[function(_dereq_,module,exports){ +},{"../object/is":588,"../value/is":594}],593:[function(_dereq_,module,exports){ "use strict"; var resolveException = _dereq_("../lib/resolve-exception") @@ -78370,7 +78989,7 @@ module.exports = function (value/*, options*/) { return resolveException(value, "Cannot use %v", arguments[1]); }; -},{"../lib/resolve-exception":557,"./is":566}],566:[function(_dereq_,module,exports){ +},{"../lib/resolve-exception":585,"./is":594}],594:[function(_dereq_,module,exports){ "use strict"; // ES3 safe @@ -78378,8 +78997,8 @@ var _undefined = void 0; module.exports = function (value) { return value !== _undefined && value !== null; }; -},{}],567:[function(_dereq_,module,exports){ -(function (global){ +},{}],595:[function(_dereq_,module,exports){ +(function (global){(function (){ 'use strict' var bits = _dereq_('bit-twiddle') @@ -78632,8 +79251,8 @@ exports.clearCache = function clearCache() { } } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"bit-twiddle":97,"buffer":111,"dup":176}],568:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"bit-twiddle":97,"buffer":111,"dup":176}],596:[function(_dereq_,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -78696,7 +79315,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],569:[function(_dereq_,module,exports){ +},{}],597:[function(_dereq_,module,exports){ "use strict" function unique_pred(list, compare) { @@ -78755,7 +79374,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],570:[function(_dereq_,module,exports){ +},{}],598:[function(_dereq_,module,exports){ var reg = /[\'\"]/ module.exports = function unquote(str) { @@ -78771,7 +79390,7 @@ module.exports = function unquote(str) { return str } -},{}],571:[function(_dereq_,module,exports){ +},{}],599:[function(_dereq_,module,exports){ /** * @module update-diff */ @@ -78804,7 +79423,7 @@ module.exports = function updateDiff (obj, diff, mappers) { return obj } -},{}],572:[function(_dereq_,module,exports){ +},{}],600:[function(_dereq_,module,exports){ "use strict" module.exports = createText @@ -78831,7 +79450,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":573}],573:[function(_dereq_,module,exports){ +},{"./lib/vtext":601}],601:[function(_dereq_,module,exports){ module.exports = vectorizeText module.exports.processPixels = processPixels @@ -79286,7 +79905,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":112,"clean-pslg":121,"ndarray":469,"planar-graph-to-polyline":488,"simplify-planar-graph":534,"surface-nets":542}],574:[function(_dereq_,module,exports){ +},{"cdt2d":112,"clean-pslg":121,"ndarray":495,"planar-graph-to-polyline":514,"simplify-planar-graph":562,"surface-nets":570}],602:[function(_dereq_,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -79973,7 +80592,7 @@ function vectorizeText(str, canvas, context, options) { } })(); -},{}],575:[function(_dereq_,module,exports){ +},{}],603:[function(_dereq_,module,exports){ var hiddenStore = _dereq_('./hidden-store.js'); module.exports = createStore; @@ -79994,7 +80613,7 @@ function createStore() { }; } -},{"./hidden-store.js":576}],576:[function(_dereq_,module,exports){ +},{"./hidden-store.js":604}],604:[function(_dereq_,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -80012,7 +80631,7 @@ function hiddenStore(obj, key) { return store; } -},{}],577:[function(_dereq_,module,exports){ +},{}],605:[function(_dereq_,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -80043,14 +80662,14 @@ function weakMap() { } } -},{"./create-store.js":575}],578:[function(_dereq_,module,exports){ +},{"./create-store.js":603}],606:[function(_dereq_,module,exports){ var getContext = _dereq_('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":249}],579:[function(_dereq_,module,exports){ +},{"get-canvas-context":249}],607:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -80783,7 +81402,7 @@ function toSolar(yearOrDate, monthOrResult, day, isIntercalaryOrResult, result) } -},{"../main":593,"object-assign":473}],580:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],608:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -80967,7 +81586,7 @@ assign(CopticCalendar.prototype, { main.calendars.coptic = CopticCalendar; -},{"../main":593,"object-assign":473}],581:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],609:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -81195,7 +81814,7 @@ var centuries = { main.calendars.discworld = DiscworldCalendar; -},{"../main":593,"object-assign":473}],582:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],610:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -81379,7 +81998,7 @@ assign(EthiopianCalendar.prototype, { main.calendars.ethiopian = EthiopianCalendar; -},{"../main":593,"object-assign":473}],583:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],611:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -81653,7 +82272,7 @@ function mod(a, b) { main.calendars.hebrew = HebrewCalendar; -},{"../main":593,"object-assign":473}],584:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],612:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -81834,7 +82453,7 @@ assign(IslamicCalendar.prototype, { main.calendars.islamic = IslamicCalendar; -},{"../main":593,"object-assign":473}],585:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],613:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -82017,7 +82636,7 @@ assign(JulianCalendar.prototype, { main.calendars.julian = JulianCalendar; -},{"../main":593,"object-assign":473}],586:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],614:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -82312,7 +82931,7 @@ function amod(a, b) { main.calendars.mayan = MayanCalendar; -},{"../main":593,"object-assign":473}],587:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],615:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -82492,7 +83111,7 @@ assign(NanakshahiCalendar.prototype, { main.calendars.nanakshahi = NanakshahiCalendar; -},{"../main":593,"object-assign":473}],588:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],616:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -82915,7 +83534,7 @@ assign(NepaliCalendar.prototype, { main.calendars.nepali = NepaliCalendar; -},{"../main":593,"object-assign":473}],589:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],617:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -83105,7 +83724,7 @@ main.calendars.persian = PersianCalendar; main.calendars.jalali = PersianCalendar; -},{"../main":593,"object-assign":473}],590:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],618:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -83291,7 +83910,7 @@ assign(TaiwanCalendar.prototype, { main.calendars.taiwan = TaiwanCalendar; -},{"../main":593,"object-assign":473}],591:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],619:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -83477,7 +84096,7 @@ assign(ThaiCalendar.prototype, { main.calendars.thai = ThaiCalendar; -},{"../main":593,"object-assign":473}],592:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],620:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -83842,7 +84461,7 @@ var ummalqura_dat = [ 79990]; -},{"../main":593,"object-assign":473}],593:[function(_dereq_,module,exports){ +},{"../main":621,"object-assign":499}],621:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -84747,7 +85366,7 @@ _exports.baseCalendar = BaseCalendar; _exports.calendars.gregorian = GregorianCalendar; -},{"object-assign":473}],594:[function(_dereq_,module,exports){ +},{"object-assign":499}],622:[function(_dereq_,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -85249,7 +85868,7 @@ assign(main.baseCalendar.prototype, { }); -},{"./main":593,"object-assign":473}],595:[function(_dereq_,module,exports){ +},{"./main":621,"object-assign":499}],623:[function(_dereq_,module,exports){ module.exports = _dereq_('cwise-compiler')({ args: ['array', { offset: [1], @@ -85301,7 +85920,7 @@ module.exports = _dereq_('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":151}],596:[function(_dereq_,module,exports){ +},{"cwise-compiler":151}],624:[function(_dereq_,module,exports){ "use strict" module.exports = findZeroCrossings @@ -85314,7 +85933,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":595}],597:[function(_dereq_,module,exports){ +},{"./lib/zc-core":623}],625:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85385,7 +86004,7 @@ module.exports = [ } ]; -},{}],598:[function(_dereq_,module,exports){ +},{}],626:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85400,7 +86019,34 @@ var ARROWPATHS = _dereq_('./arrow_paths'); var fontAttrs = _dereq_('../../plots/font_attributes'); var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -85740,7 +86386,7 @@ module.exports = templatedArray('annotation', { } }); -},{"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803,"../../plots/font_attributes":825,"./arrow_paths":597}],599:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":746,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833,"../../plots/font_attributes":855,"./arrow_paths":625}],627:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85777,10 +86423,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } @@ -85829,7 +86477,7 @@ function calcAxisExpansion(ann, ax) { ann._extremes[axId] = extremes; } -},{"../../lib":749,"../../plots/cartesian/axes":797,"./draw":604}],600:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"./draw":632}],628:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -85967,7 +86615,7 @@ function clickData2r(d, ax) { return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); } -},{"../../lib":749,"../../plot_api/plot_template":787,"../../registry":880}],601:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../registry":910}],629:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86046,7 +86694,7 @@ module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayo coerce('captureevents', !!hoverText); }; -},{"../../lib":749,"../color":615}],602:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643}],630:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86109,7 +86757,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":775,"fast-isnumeric":241}],603:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":804,"fast-isnumeric":241}],631:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86172,7 +86820,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis @@ -86216,7 +86865,7 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"./attributes":598,"./common_defaults":601}],604:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"./attributes":626,"./common_defaults":629}],632:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86232,6 +86881,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = _dereq_('../../plots/cartesian/axes'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); @@ -86292,6 +86942,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -86515,13 +87190,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -86537,12 +87213,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -86559,8 +87240,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -86750,7 +87452,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -86781,22 +87483,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -86828,14 +87531,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -86844,7 +87550,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -86854,7 +87562,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -86874,7 +87584,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); @@ -86916,7 +87626,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else annText.call(textLayout); } -},{"../../lib":749,"../../lib/setcursor":769,"../../lib/svg_text_utils":773,"../../plot_api/plot_template":787,"../../plots/cartesian/axes":797,"../../plots/plots":860,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"../fx":655,"./draw_arrow_head":605,"d3":169}],605:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/setcursor":798,"../../lib/svg_text_utils":802,"../../plot_api/plot_template":816,"../../plots/cartesian/axes":827,"../../plots/plots":890,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"../fx":683,"./draw_arrow_head":633,"d3":169}],633:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -86934,6 +87644,11 @@ var Color = _dereq_('../color'); var ARROWPATHS = _dereq_('./arrow_paths'); +var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -87053,9 +87768,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), @@ -87067,7 +87782,7 @@ module.exports = function drawArrowHead(el3, ends, options) { if(doEnd) drawhead(headStyle, end, endRot, scale); }; -},{"../color":615,"./arrow_paths":597,"d3":169}],606:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643,"./arrow_paths":625,"d3":169}],634:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87101,7 +87816,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":809,"./attributes":598,"./calc_autorange":599,"./click":600,"./convert_coords":602,"./defaults":603,"./draw":604}],607:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":839,"./attributes":626,"./calc_autorange":627,"./click":628,"./convert_coords":630,"./defaults":631,"./draw":632}],635:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87189,7 +87904,7 @@ module.exports = overrideAll(templatedArray('annotation', { // zref: 'z' }), 'calc', 'from-root'); -},{"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../annotations/attributes":598}],608:[function(_dereq_,module,exports){ +},{"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../annotations/attributes":626}],636:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87254,7 +87969,7 @@ function mockAnnAxes(ann, scene) { }; } -},{"../../lib":749,"../../plots/cartesian/axes":797}],609:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827}],637:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87330,7 +88045,7 @@ function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"../annotations/common_defaults":601,"./attributes":607}],610:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"../annotations/common_defaults":629,"./attributes":635}],638:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87382,7 +88097,7 @@ module.exports = function draw(scene) { } }; -},{"../../plots/gl3d/project":848,"../annotations/draw":604}],611:[function(_dereq_,module,exports){ +},{"../../plots/gl3d/project":878,"../annotations/draw":632}],639:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87430,7 +88145,7 @@ function includeGL3D(layoutIn, layoutOut) { } } -},{"../../lib":749,"../../registry":880,"./attributes":607,"./convert":608,"./defaults":609,"./draw":610}],612:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"./attributes":635,"./convert":636,"./defaults":637,"./draw":638}],640:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87463,7 +88178,7 @@ _dereq_('world-calendars/dist/calendars/taiwan'); _dereq_('world-calendars/dist/calendars/thai'); _dereq_('world-calendars/dist/calendars/ummalqura'); -},{"world-calendars/dist/calendars/chinese":579,"world-calendars/dist/calendars/coptic":580,"world-calendars/dist/calendars/discworld":581,"world-calendars/dist/calendars/ethiopian":582,"world-calendars/dist/calendars/hebrew":583,"world-calendars/dist/calendars/islamic":584,"world-calendars/dist/calendars/julian":585,"world-calendars/dist/calendars/mayan":586,"world-calendars/dist/calendars/nanakshahi":587,"world-calendars/dist/calendars/nepali":588,"world-calendars/dist/calendars/persian":589,"world-calendars/dist/calendars/taiwan":590,"world-calendars/dist/calendars/thai":591,"world-calendars/dist/calendars/ummalqura":592,"world-calendars/dist/main":593,"world-calendars/dist/plus":594}],613:[function(_dereq_,module,exports){ +},{"world-calendars/dist/calendars/chinese":607,"world-calendars/dist/calendars/coptic":608,"world-calendars/dist/calendars/discworld":609,"world-calendars/dist/calendars/ethiopian":610,"world-calendars/dist/calendars/hebrew":611,"world-calendars/dist/calendars/islamic":612,"world-calendars/dist/calendars/julian":613,"world-calendars/dist/calendars/mayan":614,"world-calendars/dist/calendars/nanakshahi":615,"world-calendars/dist/calendars/nepali":616,"world-calendars/dist/calendars/persian":617,"world-calendars/dist/calendars/taiwan":618,"world-calendars/dist/calendars/thai":619,"world-calendars/dist/calendars/ummalqura":620,"world-calendars/dist/main":621,"world-calendars/dist/plus":622}],641:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87736,7 +88451,7 @@ module.exports = { worldCalFmt: worldCalFmt }; -},{"../../constants/numerical":724,"../../lib":749,"./calendars":612}],614:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"./calendars":640}],642:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87776,7 +88491,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],615:[function(_dereq_,module,exports){ +},{}],643:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -87950,7 +88665,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":614,"fast-isnumeric":241,"tinycolor2":548}],616:[function(_dereq_,module,exports){ +},{"./attributes":642,"fast-isnumeric":241,"tinycolor2":576}],644:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88075,6 +88790,17 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -88091,6 +88817,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { @@ -88129,7 +88856,7 @@ module.exports = overrideAll({ } }, 'colorbars', 'from-root'); -},{"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/cartesian/layout_attributes":811,"../../plots/font_attributes":825}],617:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/cartesian/layout_attributes":841,"../../plots/font_attributes":855}],645:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88157,7 +88884,7 @@ module.exports = { } }; -},{}],618:[function(_dereq_,module,exports){ +},{}],646:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88211,10 +88938,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); @@ -88223,7 +88954,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('title.side'); }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/cartesian/tick_label_defaults":818,"../../plots/cartesian/tick_mark_defaults":819,"../../plots/cartesian/tick_value_defaults":820,"./attributes":616}],619:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/cartesian/tick_label_defaults":848,"../../plots/cartesian/tick_mark_defaults":849,"../../plots/cartesian/tick_value_defaults":850,"./attributes":644}],647:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88242,6 +88973,7 @@ var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); var dragElement = _dereq_('../dragelement'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = _dereq_('../../lib/extend').extendFlat; var setCursor = _dereq_('../../lib/setcursor'); var Drawing = _dereq_('../drawing'); @@ -88496,10 +89228,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -88611,18 +89343,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -88686,20 +89419,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -88709,7 +89441,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -88754,7 +89490,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -88810,7 +89546,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -88905,10 +89641,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, @@ -88950,7 +89688,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":717,"../../lib":749,"../../lib/extend":739,"../../lib/setcursor":769,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_defaults":799,"../../plots/cartesian/layout_attributes":811,"../../plots/cartesian/position_defaults":814,"../../plots/plots":860,"../../registry":880,"../color":615,"../colorscale/helpers":626,"../dragelement":634,"../drawing":637,"../titles":710,"./constants":617,"d3":169,"tinycolor2":548}],620:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/extend":768,"../../lib/setcursor":798,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_defaults":829,"../../plots/cartesian/layout_attributes":841,"../../plots/cartesian/position_defaults":844,"../../plots/plots":890,"../../registry":910,"../color":643,"../colorscale/helpers":654,"../dragelement":662,"../drawing":665,"../titles":738,"./constants":645,"d3":169,"tinycolor2":576}],648:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88969,7 +89707,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":749}],621:[function(_dereq_,module,exports){ +},{"../../lib":778}],649:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -88991,7 +89729,7 @@ module.exports = { hasColorbar: _dereq_('./has_colorbar') }; -},{"./attributes":616,"./defaults":618,"./draw":619,"./has_colorbar":620}],622:[function(_dereq_,module,exports){ +},{"./attributes":644,"./defaults":646,"./draw":647,"./has_colorbar":648}],650:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89199,7 +89937,7 @@ module.exports = function colorScaleAttrs(context, opts) { return attrs; }; -},{"../../lib/regex":765,"../colorbar/attributes":616,"./scales.js":630}],623:[function(_dereq_,module,exports){ +},{"../../lib/regex":794,"../colorbar/attributes":644,"./scales.js":658}],651:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89278,7 +90016,7 @@ module.exports = function calc(gd, trace, opts) { } }; -},{"../../lib":749,"./helpers":626,"fast-isnumeric":241}],624:[function(_dereq_,module,exports){ +},{"../../lib":778,"./helpers":654,"fast-isnumeric":241}],652:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89355,7 +90093,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":749,"./helpers":626}],625:[function(_dereq_,module,exports){ +},{"../../lib":778,"./helpers":654}],653:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89480,7 +90218,7 @@ module.exports = function colorScaleDefaults(parentContIn, parentContOut, layout } }; -},{"../../lib":749,"../../registry":880,"../colorbar/defaults":618,"../colorbar/has_colorbar":620,"./scales":630,"fast-isnumeric":241}],626:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../colorbar/defaults":646,"../colorbar/has_colorbar":648,"./scales":658,"fast-isnumeric":241}],654:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89720,7 +90458,7 @@ module.exports = { makeColorScaleFuncFromTrace: makeColorScaleFuncFromTrace }; -},{"../../lib":749,"../color":615,"./scales":630,"d3":169,"fast-isnumeric":241,"tinycolor2":548}],627:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643,"./scales":658,"d3":169,"fast-isnumeric":241,"tinycolor2":576}],655:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89762,7 +90500,7 @@ module.exports = { makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; -},{"./attributes":622,"./calc":623,"./cross_trace_defaults":624,"./defaults":625,"./helpers":626,"./layout_attributes":628,"./layout_defaults":629,"./scales":630}],628:[function(_dereq_,module,exports){ +},{"./attributes":650,"./calc":651,"./cross_trace_defaults":652,"./defaults":653,"./helpers":654,"./layout_attributes":656,"./layout_defaults":657,"./scales":658}],656:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89823,7 +90561,7 @@ module.exports = { })) }; -},{"../../lib/extend":739,"./attributes":622,"./scales":630}],629:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"./attributes":650,"./scales":658}],657:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -89874,7 +90612,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { } }; -},{"../../lib":749,"../../plot_api/plot_template":787,"./defaults":625,"./layout_attributes":628}],630:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"./defaults":653,"./layout_attributes":656}],658:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90078,7 +90816,7 @@ module.exports = { isValid: isValidScale }; -},{"tinycolor2":548}],631:[function(_dereq_,module,exports){ +},{"tinycolor2":576}],659:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90111,7 +90849,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],632:[function(_dereq_,module,exports){ +},{}],660:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90149,7 +90887,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":749}],633:[function(_dereq_,module,exports){ +},{"../../lib":778}],661:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90208,7 +90946,7 @@ exports.selectingOrDrawing = function(dragmode) { ); }; -},{}],634:[function(_dereq_,module,exports){ +},{}],662:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90500,7 +91238,7 @@ function pointerOffset(e) { ); } -},{"../../lib":749,"../../plots/cartesian/constants":803,"./align":631,"./cursor":632,"./unhover":635,"has-hover":414,"has-passive-events":415,"mouse-event-offset":458}],635:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/constants":833,"./align":659,"./cursor":660,"./unhover":663,"has-hover":440,"has-passive-events":441,"mouse-event-offset":484}],663:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90555,7 +91293,7 @@ unhover.raw = function raw(gd, evt) { } }; -},{"../../lib/dom":737,"../../lib/events":738,"../../lib/throttle":774,"../fx/constants":649}],636:[function(_dereq_,module,exports){ +},{"../../lib/dom":766,"../../lib/events":767,"../../lib/throttle":803,"../fx/constants":677}],664:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90580,7 +91318,7 @@ exports.dash = { }; -},{}],637:[function(_dereq_,module,exports){ +},{}],665:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -90600,6 +91338,7 @@ var Registry = _dereq_('../../registry'); var Color = _dereq_('../color'); var Colorscale = _dereq_('../colorscale'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); @@ -90661,7 +91400,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -91287,7 +92026,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -91678,7 +92417,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -91712,7 +92451,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -91731,7 +92470,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -91762,9 +92501,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -91772,11 +92511,11 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; -},{"../../components/fx/helpers":651,"../../constants/alignment":717,"../../constants/interactions":723,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../lib/svg_text_utils":773,"../../registry":880,"../../traces/scatter/make_bubble_size_func":1172,"../../traces/scatter/subtypes":1179,"../color":615,"../colorscale":627,"./symbol_defs":638,"d3":169,"fast-isnumeric":241,"tinycolor2":548}],638:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":679,"../../constants/alignment":745,"../../constants/interactions":752,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../lib/svg_text_utils":802,"../../registry":910,"../../traces/scatter/make_bubble_size_func":1203,"../../traces/scatter/subtypes":1211,"../color":643,"../colorscale":655,"./symbol_defs":666,"d3":169,"fast-isnumeric":241,"tinycolor2":576}],666:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92340,7 +93079,7 @@ module.exports = { } }; -},{"d3":169}],639:[function(_dereq_,module,exports){ +},{"d3":169}],667:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92455,7 +93194,7 @@ module.exports = { } }; -},{}],640:[function(_dereq_,module,exports){ +},{}],668:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92541,7 +93280,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { baseExtremes.max = baseExtremes.max.concat(extremes.max); } -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"./compute_error":641,"fast-isnumeric":241}],641:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"./compute_error":669,"fast-isnumeric":241}],669:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92642,7 +93381,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],642:[function(_dereq_,module,exports){ +},{}],670:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92717,7 +93456,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../registry":880,"./attributes":639,"fast-isnumeric":241}],643:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../registry":910,"./attributes":667,"fast-isnumeric":241}],671:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92786,7 +93525,7 @@ function hoverInfo(calcPoint, trace, hoverPoint) { } } -},{"../../lib":749,"../../plot_api/edit_types":780,"./attributes":639,"./calc":640,"./compute_error":641,"./defaults":642,"./plot":644,"./style":645}],644:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/edit_types":809,"./attributes":667,"./calc":668,"./compute_error":669,"./defaults":670,"./plot":672,"./style":673}],672:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92958,7 +93697,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":1179,"../drawing":637,"d3":169,"fast-isnumeric":241}],645:[function(_dereq_,module,exports){ +},{"../../traces/scatter/subtypes":1211,"../drawing":665,"d3":169,"fast-isnumeric":241}],673:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -92995,7 +93734,7 @@ module.exports = function style(traces) { }); }; -},{"../color":615,"d3":169}],646:[function(_dereq_,module,exports){ +},{"../color":643,"d3":169}],674:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93031,7 +93770,7 @@ module.exports = { } }; -},{"../../lib/extend":739,"../../plots/font_attributes":825,"./layout_attributes":656}],647:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/font_attributes":855,"./layout_attributes":684}],675:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93090,7 +93829,7 @@ function paste(traceAttr, cd, cdAttr, fn) { } } -},{"../../lib":749,"../../registry":880}],648:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],676:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93127,7 +93866,7 @@ module.exports = function click(gd, evt, subplot) { } }; -},{"../../registry":880,"./hover":652}],649:[function(_dereq_,module,exports){ +},{"../../registry":910,"./hover":680}],677:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93159,7 +93898,7 @@ module.exports = { HOVERID: '-hover' }; -},{}],650:[function(_dereq_,module,exports){ +},{}],678:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93185,7 +93924,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; -},{"../../lib":749,"./attributes":646,"./hoverlabel_defaults":653}],651:[function(_dereq_,module,exports){ +},{"../../lib":778,"./attributes":674,"./hoverlabel_defaults":681}],679:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93447,7 +94186,7 @@ exports.isXYhover = function(hovermode) { return !!xyHoverMode[hovermode]; }; -},{"../../lib":749}],652:[function(_dereq_,module,exports){ +},{"../../lib":778}],680:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -93463,6 +94202,8 @@ var isNumeric = _dereq_('fast-isnumeric'); var tinycolor = _dereq_('tinycolor2'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = _dereq_('../../lib/events'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var overrideCursor = _dereq_('../../lib/override_cursor'); @@ -93642,7 +94383,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -93786,6 +94529,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -94166,10 +94915,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -94410,7 +95157,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -94518,7 +95265,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -94553,8 +95300,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -94562,7 +95314,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -94662,8 +95414,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -94922,7 +95674,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -94938,7 +95693,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -94947,49 +95703,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } @@ -95301,7 +96058,7 @@ function plainText(s, len) { }); } -},{"../../lib":749,"../../lib/events":738,"../../lib/override_cursor":760,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"../legend/defaults":667,"../legend/draw":668,"./constants":649,"./helpers":651,"d3":169,"fast-isnumeric":241,"tinycolor2":548}],653:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/events":767,"../../lib/override_cursor":789,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"../legend/defaults":695,"../legend/draw":696,"./constants":677,"./helpers":679,"d3":169,"fast-isnumeric":241,"tinycolor2":576}],681:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95347,7 +96104,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts coerce('hoverlabel.align', opts.align); }; -},{"../../lib":749,"../color":615,"./helpers":651}],654:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643,"./helpers":679}],682:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95403,7 +96160,7 @@ function isHoriz(fullData, fullLayout) { return true; } -},{"../../lib":749,"./layout_attributes":656}],655:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":684}],683:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95482,7 +96239,7 @@ function castHoverinfo(trace, fullLayout, ptNumber) { return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":749,"../dragelement":634,"./attributes":646,"./calc":647,"./click":648,"./constants":649,"./defaults":650,"./helpers":651,"./hover":652,"./layout_attributes":656,"./layout_defaults":657,"./layout_global_defaults":658,"d3":169}],656:[function(_dereq_,module,exports){ +},{"../../lib":778,"../dragelement":662,"./attributes":674,"./calc":675,"./click":676,"./constants":677,"./defaults":678,"./helpers":679,"./hover":680,"./layout_attributes":684,"./layout_defaults":685,"./layout_global_defaults":686,"d3":169}],684:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95598,7 +96355,7 @@ module.exports = { } }; -},{"../../plots/font_attributes":825,"./constants":649}],657:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":855,"./constants":677}],685:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95646,7 +96403,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":749,"./helpers":651,"./hoverlabel_defaults":653,"./hovermode_defaults":654,"./layout_attributes":656}],658:[function(_dereq_,module,exports){ +},{"../../lib":778,"./helpers":679,"./hoverlabel_defaults":681,"./hovermode_defaults":682,"./layout_attributes":684}],686:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -95669,7 +96426,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":749,"./hoverlabel_defaults":653,"./layout_attributes":656}],659:[function(_dereq_,module,exports){ +},{"../../lib":778,"./hoverlabel_defaults":681,"./layout_attributes":684}],687:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96043,7 +96800,7 @@ module.exports = { contentDefaults: contentDefaults }; -},{"../../lib":749,"../../lib/regex":765,"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803,"../../plots/domain":824}],660:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/regex":794,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833,"../../plots/domain":854}],688:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96056,6 +96813,7 @@ module.exports = { var cartesianConstants = _dereq_('../../plots/cartesian/constants'); var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -96178,7 +96936,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw' }); -},{"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803}],661:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":746,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833}],689:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96259,7 +97017,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":775,"fast-isnumeric":241}],662:[function(_dereq_,module,exports){ +},{"../../lib/to_log_range":804,"fast-isnumeric":241}],690:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96311,7 +97069,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); @@ -96324,7 +97082,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"./attributes":660}],663:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"./attributes":688}],691:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96338,6 +97096,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { var d3 = _dereq_('d3'); var Drawing = _dereq_('../drawing'); var Axes = _dereq_('../../plots/cartesian/axes'); +var axisIds = _dereq_('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -96354,7 +97113,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -96457,10 +97216,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -96469,8 +97243,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -96494,8 +97285,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( @@ -96549,7 +97340,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":725,"../../plots/cartesian/axes":797,"../drawing":637,"d3":169}],664:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":754,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_ids":830,"../drawing":665,"d3":169}],692:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96573,7 +97364,7 @@ module.exports = { convertCoords: _dereq_('./convert_coords') }; -},{"../../plots/cartesian/include_components":809,"./attributes":660,"./convert_coords":661,"./defaults":662,"./draw":663}],665:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":839,"./attributes":688,"./convert_coords":689,"./defaults":690,"./draw":691}],693:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96645,6 +97436,14 @@ module.exports = { editType: 'legend', + }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + + editType: 'legend', + }, itemclick: { @@ -96734,7 +97533,7 @@ module.exports = { editType: 'legend' }; -},{"../../plots/font_attributes":825,"../color/attributes":614}],666:[function(_dereq_,module,exports){ +},{"../../plots/font_attributes":855,"../color/attributes":642}],694:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96754,13 +97553,11 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; -},{}],667:[function(_dereq_,module,exports){ +},{}],695:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96876,6 +97673,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); @@ -96894,7 +97692,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/layout_attributes":851,"../../registry":880,"./attributes":665,"./helpers":671}],668:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/layout_attributes":881,"../../registry":910,"./attributes":693,"./helpers":699}],696:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -96986,7 +97784,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -97307,11 +98104,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -97364,11 +98161,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -97438,7 +98238,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -97491,8 +98292,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); @@ -97605,7 +98406,7 @@ function computeLegendDimensions(gd, groups, traces, opts) { var w = textGap + d[0].width; var next = (oneRowLegend ? w : maxItemWidth) + itemGap; - if((next + bw + offsetX) > opts._maxWidth) { + if((next + bw + offsetX - itemGap) >= opts._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; @@ -97688,7 +98489,7 @@ function getYanchor(opts) { 'top'; } -},{"../../constants/alignment":717,"../../lib":749,"../../lib/events":738,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"./constants":666,"./get_legend_data":669,"./handle_click":670,"./helpers":671,"./style":673,"d3":169}],669:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/events":767,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"./constants":694,"./get_legend_data":697,"./handle_click":698,"./helpers":699,"./style":701,"d3":169}],697:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -97797,7 +98598,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":880,"./helpers":671}],670:[function(_dereq_,module,exports){ +},{"../../registry":910,"./helpers":699}],698:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98036,7 +98837,7 @@ module.exports = function handleClick(g, gd, numClicks) { } }; -},{"../../lib":749,"../../registry":880}],671:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],699:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98060,7 +98861,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{}],672:[function(_dereq_,module,exports){ +},{}],700:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98084,7 +98885,7 @@ module.exports = { style: _dereq_('./style') }; -},{"./attributes":665,"./defaults":667,"./draw":668,"./style":673}],673:[function(_dereq_,module,exports){ +},{"./attributes":693,"./defaults":695,"./draw":696,"./style":701}],701:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -98099,6 +98900,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var extractOpts = _dereq_('../colorscale/helpers').extractOpts; @@ -98107,6 +98909,8 @@ var subTypes = _dereq_('../../traces/scatter/subtypes'); var stylePie = _dereq_('../../traces/pie/style_one'); var pieCastOption = _dereq_('../../traces/pie/helpers').castOption; +var constants = _dereq_('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -98117,6 +98921,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -98145,7 +98952,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -98248,7 +99055,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -98268,7 +99075,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -98358,7 +99165,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -98370,7 +99177,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -98398,7 +99205,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -98438,7 +99245,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -98462,7 +99269,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -98502,7 +99309,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -98529,7 +99336,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -98565,7 +99372,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -98663,7 +99470,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -98711,7 +99518,7 @@ function getGradientDirection(reversescale, isRadial) { return str + (reversescale ? '' : 'reversed'); } -},{"../../lib":749,"../../registry":880,"../../traces/pie/helpers":1134,"../../traces/pie/style_one":1140,"../../traces/scatter/subtypes":1179,"../color":615,"../colorscale/helpers":626,"../drawing":637,"d3":169}],674:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../../traces/pie/helpers":1165,"../../traces/pie/style_one":1171,"../../traces/scatter/subtypes":1211,"../color":643,"../colorscale/helpers":654,"../drawing":665,"./constants":694,"d3":169}],702:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99447,7 +100254,7 @@ function resetView(gd, subplotType) { Registry.call('_guiRelayout', gd, aObj); } -},{"../../fonts/ploticon":728,"../../lib":749,"../../plots/cartesian/axis_ids":800,"../../plots/plots":860,"../../registry":880,"../shapes/draw":696}],675:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":757,"../../lib":778,"../../plots/cartesian/axis_ids":830,"../../plots/plots":890,"../../registry":910,"../shapes/draw":724}],703:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99461,7 +100268,7 @@ function resetView(gd, subplotType) { exports.manage = _dereq_('./manage'); -},{"./manage":676}],676:[function(_dereq_,module,exports){ +},{"./manage":704}],704:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -99757,7 +100564,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axis_ids":800,"../../registry":880,"../../traces/scatter/subtypes":1179,"../fx/helpers":651,"./buttons":674,"./modebar":677}],677:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axis_ids":830,"../../registry":910,"../../traces/scatter/subtypes":1211,"../fx/helpers":679,"./buttons":702,"./modebar":705}],705:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100103,7 +100910,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../fonts/ploticon":728,"../../lib":749,"d3":169,"fast-isnumeric":241}],678:[function(_dereq_,module,exports){ +},{"../../fonts/ploticon":757,"../../lib":778,"d3":169,"fast-isnumeric":241}],706:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100239,7 +101046,7 @@ module.exports = { editType: 'plot' }; -},{"../../plot_api/plot_template":787,"../../plots/font_attributes":825,"../color/attributes":614}],679:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":816,"../../plots/font_attributes":855,"../color/attributes":642}],707:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100268,7 +101075,7 @@ module.exports = { darkAmount: 10 }; -},{}],680:[function(_dereq_,module,exports){ +},{}],708:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100360,7 +101167,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/array_container_defaults":793,"../color":615,"./attributes":678,"./constants":679}],681:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/array_container_defaults":822,"../color":643,"./attributes":706,"./constants":707}],709:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100378,6 +101185,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var axisIds = _dereq_('../../plots/cartesian/axis_ids'); @@ -100507,8 +101315,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -100559,9 +101366,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -100614,10 +101419,10 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } -},{"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axis_ids":800,"../../plots/plots":860,"../../registry":880,"../color":615,"../drawing":637,"./constants":679,"./get_update_object":682,"d3":169}],682:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axis_ids":830,"../../plots/plots":890,"../../registry":910,"../color":643,"../drawing":665,"./constants":707,"./get_update_object":710,"d3":169}],710:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100671,7 +101476,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":169}],683:[function(_dereq_,module,exports){ +},{"d3":169}],711:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100698,7 +101503,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":678,"./defaults":680,"./draw":681}],684:[function(_dereq_,module,exports){ +},{"./attributes":706,"./defaults":708,"./draw":709}],712:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100772,7 +101577,7 @@ module.exports = { editType: 'calc' }; -},{"../color/attributes":614}],685:[function(_dereq_,module,exports){ +},{"../color/attributes":642}],713:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100806,7 +101611,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/autorange":796,"../../plots/cartesian/axis_ids":800,"./constants":686}],686:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/autorange":826,"../../plots/cartesian/axis_ids":830,"./constants":714}],714:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100862,7 +101667,7 @@ module.exports = { extraPad: 15 }; -},{}],687:[function(_dereq_,module,exports){ +},{}],715:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100948,7 +101753,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/cartesian/axis_ids":800,"./attributes":684,"./oppaxis_attributes":691}],688:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/cartesian/axis_ids":830,"./attributes":712,"./oppaxis_attributes":719}],716:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -100965,6 +101770,7 @@ var Registry = _dereq_('../../registry'); var Plots = _dereq_('../../plots/plots'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var Titles = _dereq_('../titles'); @@ -101070,7 +101876,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -101183,6 +101989,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -101329,10 +102137,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -101354,7 +102162,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -101570,14 +102378,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { @@ -101591,7 +102397,7 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { grabAreaMax.attr('height', opts._height); } -},{"../../lib":749,"../../lib/setcursor":769,"../../plots/cartesian":810,"../../plots/cartesian/axis_ids":800,"../../plots/plots":860,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"../titles":710,"./constants":686,"d3":169}],689:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/setcursor":798,"../../plots/cartesian":840,"../../plots/cartesian/axis_ids":830,"../../plots/plots":890,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"../titles":738,"./constants":714,"d3":169}],717:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101666,7 +102472,7 @@ exports.autoMarginOpts = function(gd, ax) { }; }; -},{"../../constants/alignment":717,"../../lib/svg_text_utils":773,"../../plots/cartesian/axis_ids":800,"./constants":686}],690:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib/svg_text_utils":802,"../../plots/cartesian/axis_ids":830,"./constants":714}],718:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101705,7 +102511,7 @@ module.exports = { autoMarginOpts: helpers.autoMarginOpts }; -},{"../../lib":749,"./attributes":684,"./calc_autorange":685,"./defaults":687,"./draw":688,"./helpers":689,"./oppaxis_attributes":691}],691:[function(_dereq_,module,exports){ +},{"../../lib":778,"./attributes":712,"./calc_autorange":713,"./defaults":715,"./draw":716,"./helpers":717,"./oppaxis_attributes":719}],719:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101743,7 +102549,7 @@ module.exports = { editType: 'calc' }; -},{}],692:[function(_dereq_,module,exports){ +},{}],720:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101759,6 +102565,7 @@ var scatterLineAttrs = _dereq_('../../traces/scatter/attributes').line; var dash = _dereq_('../drawing/attributes').dash; var extendFlat = _dereq_('../../lib/extend').extendFlat; var templatedArray = _dereq_('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = _dereq_('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -101895,7 +102702,7 @@ module.exports = templatedArray('shape', { editType: 'arraydraw' }); -},{"../../lib/extend":739,"../../plot_api/plot_template":787,"../../traces/scatter/attributes":1155,"../annotations/attributes":598,"../drawing/attributes":636}],693:[function(_dereq_,module,exports){ +},{"../../constants/axis_placeable_objects":746,"../../lib/extend":768,"../../plot_api/plot_template":816,"../../traces/scatter/attributes":1186,"../annotations/attributes":626,"../drawing/attributes":664}],721:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -101923,9 +102730,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -101936,7 +102746,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); @@ -102012,7 +102822,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":749,"../../plots/cartesian/axes":797,"./constants":694,"./helpers":703}],694:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"./constants":722,"./helpers":731}],722:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102076,7 +102886,7 @@ module.exports = { } }; -},{}],695:[function(_dereq_,module,exports){ +},{}],723:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102142,9 +102952,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); @@ -102205,7 +103017,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"./attributes":692,"./helpers":703}],696:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"./attributes":720,"./helpers":731}],724:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -102391,7 +103203,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -102417,11 +103232,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -102792,6 +103609,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -102799,15 +103618,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } @@ -102964,7 +103791,7 @@ function eraseActiveShape(gd) { } } -},{"../../lib":749,"../../lib/setcursor":769,"../../plot_api/plot_template":787,"../../plots/cartesian/axes":797,"../../plots/cartesian/handle_outline":807,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"./constants":694,"./draw_newshape/display_outlines":700,"./draw_newshape/helpers":701,"./helpers":703}],697:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/setcursor":798,"../../plot_api/plot_template":816,"../../plots/cartesian/axes":827,"../../plots/cartesian/handle_outline":837,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"./constants":722,"./draw_newshape/display_outlines":728,"./draw_newshape/helpers":729,"./helpers":731}],725:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103067,7 +103894,7 @@ module.exports = { } }; -},{"../../../lib/extend":739,"../../drawing/attributes":636}],698:[function(_dereq_,module,exports){ +},{"../../../lib/extend":768,"../../drawing/attributes":664}],726:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103091,7 +103918,7 @@ module.exports = { SQRT2: Math.sqrt(2) }; -},{}],699:[function(_dereq_,module,exports){ +},{}],727:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103123,7 +103950,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce coerce('activeshape.opacity'); }; -},{"../../color":615}],700:[function(_dereq_,module,exports){ +},{"../../color":643}],728:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103418,7 +104245,7 @@ function recordPositions(polygonsOut, polygonsIn) { return polygonsOut; } -},{"../../../plots/cartesian/handle_outline":807,"../../../registry":880,"../../dragelement":634,"../../dragelement/helpers":633,"./constants":698,"./helpers":701,"./newshapes":702}],701:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":837,"../../../registry":910,"../../dragelement":662,"../../dragelement/helpers":661,"./constants":726,"./helpers":729,"./newshapes":730}],729:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -103756,7 +104583,7 @@ exports.ellipseOver = function(pos) { }; }; -},{"../../../plots/cartesian/helpers":808,"./constants":698,"parse-svg-path":479}],702:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/helpers":838,"./constants":726,"parse-svg-path":505}],730:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104015,7 +104842,7 @@ function fixDatesForPaths(polygons, xaxis, yaxis) { return polygons; } -},{"../../../plots/cartesian/handle_outline":807,"../../../plots/cartesian/helpers":808,"../../dragelement/helpers":633,"./constants":698,"./helpers":701}],703:[function(_dereq_,module,exports){ +},{"../../../plots/cartesian/handle_outline":837,"../../../plots/cartesian/helpers":838,"../../dragelement/helpers":661,"./constants":726,"./helpers":729}],731:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104076,18 +104903,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -104097,13 +104930,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { @@ -104160,7 +105000,7 @@ exports.makeOptionsAndPlotinfo = function(gd, index) { }; }; -},{"../../lib":749,"./constants":694}],704:[function(_dereq_,module,exports){ +},{"../../lib":778,"./constants":722}],732:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104188,7 +105028,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"../../plots/cartesian/include_components":809,"./attributes":692,"./calc_autorange":693,"./defaults":695,"./draw":696,"./draw_newshape/defaults":699}],705:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/include_components":839,"./attributes":720,"./calc_autorange":721,"./defaults":723,"./draw":724,"./draw_newshape/defaults":727}],733:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104431,7 +105271,7 @@ module.exports = overrideAll(templatedArray('slider', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/animation_attributes":792,"../../plots/font_attributes":825,"../../plots/pad_attributes":859,"./constants":706}],706:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/animation_attributes":821,"../../plots/font_attributes":855,"../../plots/pad_attributes":889,"./constants":734}],734:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104525,7 +105365,7 @@ module.exports = { currentValueInset: 0, }; -},{}],707:[function(_dereq_,module,exports){ +},{}],735:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104640,7 +105480,7 @@ function stepDefaults(valueIn, valueOut) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"./attributes":705,"./constants":706}],708:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"./attributes":733,"./constants":734}],736:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -104657,6 +105497,7 @@ var Plots = _dereq_('../../plots/plots'); var Color = _dereq_('../color'); var Drawing = _dereq_('../drawing'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var arrayEditor = _dereq_('../../plot_api/plot_template').arrayEditor; @@ -104945,11 +105786,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -105000,11 +105840,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -105217,7 +106056,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: @@ -105272,7 +106111,7 @@ function drawRail(sliderGroup, sliderOpts) { ); } -},{"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plot_api/plot_template":787,"../../plots/plots":860,"../color":615,"../drawing":637,"./constants":706,"d3":169}],709:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plot_api/plot_template":816,"../../plots/plots":890,"../color":643,"../drawing":665,"./constants":734,"d3":169}],737:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105295,7 +106134,7 @@ module.exports = { draw: _dereq_('./draw') }; -},{"./attributes":705,"./constants":706,"./defaults":707,"./draw":708}],710:[function(_dereq_,module,exports){ +},{"./attributes":733,"./constants":734,"./defaults":735,"./draw":736}],738:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105313,6 +106152,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../drawing'); var Color = _dereq_('../color'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -105433,7 +106273,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -105511,7 +106351,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } @@ -105562,7 +106402,7 @@ module.exports = { draw: draw }; -},{"../../constants/alignment":717,"../../constants/interactions":723,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../../registry":880,"../color":615,"../drawing":637,"d3":169,"fast-isnumeric":241}],711:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../constants/interactions":752,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../../registry":910,"../color":643,"../drawing":665,"d3":169,"fast-isnumeric":241}],739:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105731,7 +106571,7 @@ module.exports = overrideAll(templatedArray('updatemenu', { } }), 'arraydraw', 'from-root'); -},{"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/font_attributes":825,"../../plots/pad_attributes":859,"../color/attributes":614}],712:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/font_attributes":855,"../../plots/pad_attributes":889,"../color/attributes":642}],740:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105812,7 +106652,7 @@ module.exports = { } }; -},{}],713:[function(_dereq_,module,exports){ +},{}],741:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -105895,7 +106735,7 @@ function buttonDefaults(buttonIn, buttonOut) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"./attributes":711,"./constants":712}],714:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"./attributes":739,"./constants":740}],742:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -106093,8 +106933,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -106333,11 +107172,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; @@ -106548,9 +107386,9 @@ function removeAllButtons(gButton, newMenuIndexAttr) { .selectAll('g.' + constants.dropdownButtonClassName).remove(); } -},{"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plot_api/plot_template":787,"../../plots/plots":860,"../color":615,"../drawing":637,"./constants":712,"./scrollbox":716,"d3":169}],715:[function(_dereq_,module,exports){ -arguments[4][709][0].apply(exports,arguments) -},{"./attributes":711,"./constants":712,"./defaults":713,"./draw":714,"dup":709}],716:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plot_api/plot_template":816,"../../plots/plots":890,"../color":643,"../drawing":665,"./constants":740,"./scrollbox":744,"d3":169}],743:[function(_dereq_,module,exports){ +arguments[4][737][0].apply(exports,arguments) +},{"./attributes":739,"./constants":740,"./defaults":741,"./draw":742,"dup":737}],744:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107015,7 +107853,7 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":749,"../color":615,"../drawing":637,"d3":169}],717:[function(_dereq_,module,exports){ +},{"../../lib":778,"../color":643,"../drawing":665,"d3":169}],745:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107080,7 +107918,39 @@ module.exports = { } }; -},{}],718:[function(_dereq_,module,exports){ +},{}],746:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; + +},{}],747:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107102,7 +107972,7 @@ module.exports = { } }; -},{}],719:[function(_dereq_,module,exports){ +},{}],748:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107118,7 +107988,7 @@ module.exports = { DATE_FORMAT_LINK: 'https://github.com/d3/d3-time-format#locale_format' }; -},{}],720:[function(_dereq_,module,exports){ +},{}],749:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107156,7 +108026,7 @@ module.exports = { } }; -},{}],721:[function(_dereq_,module,exports){ +},{}],750:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107177,7 +108047,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],722:[function(_dereq_,module,exports){ +},{}],751:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107200,7 +108070,7 @@ module.exports = { x: '❌' }; -},{}],723:[function(_dereq_,module,exports){ +},{}],752:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107223,7 +108093,7 @@ module.exports = { DESELECTDIM: 0.2 }; -},{}],724:[function(_dereq_,module,exports){ +},{}],753:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107296,7 +108166,7 @@ module.exports = { MINUS_SIGN: '\u2212' }; -},{}],725:[function(_dereq_,module,exports){ +},{}],754:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107320,7 +108190,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],726:[function(_dereq_,module,exports){ +},{}],755:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107406,7 +108276,7 @@ exports.Queue = _dereq_('./lib/queue'); // export d3 used in the bundle exports.d3 = _dereq_('d3'); -},{"../build/plotcss":1,"./components/annotations":606,"./components/annotations3d":611,"./components/colorbar":621,"./components/colorscale":627,"./components/errorbars":643,"./components/fx":655,"./components/grid":659,"./components/images":664,"./components/legend":672,"./components/rangeselector":683,"./components/rangeslider":690,"./components/shapes":704,"./components/sliders":709,"./components/updatemenus":715,"./fonts/mathjax_config":727,"./fonts/ploticon":728,"./lib/queue":764,"./locale-en":778,"./locale-en-us":777,"./plot_api":782,"./plot_api/plot_schema":786,"./plots/plots":860,"./registry":880,"./snapshot":885,"./traces/scatter":1167,"./version":1337,"d3":169,"es6-promise":224}],727:[function(_dereq_,module,exports){ +},{"../build/plotcss":1,"./components/annotations":634,"./components/annotations3d":639,"./components/colorbar":649,"./components/colorscale":655,"./components/errorbars":671,"./components/fx":683,"./components/grid":687,"./components/images":692,"./components/legend":700,"./components/rangeselector":711,"./components/rangeslider":718,"./components/shapes":732,"./components/sliders":737,"./components/updatemenus":743,"./fonts/mathjax_config":756,"./fonts/ploticon":757,"./lib/queue":793,"./locale-en":807,"./locale-en-us":806,"./plot_api":811,"./plot_api/plot_schema":815,"./plots/plots":890,"./registry":910,"./snapshot":915,"./traces/scatter":1198,"./version":1369,"d3":169,"es6-promise":224}],756:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107437,7 +108307,7 @@ module.exports = function() { } }; -},{}],728:[function(_dereq_,module,exports){ +},{}],757:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107617,7 +108487,7 @@ module.exports = { } }; -},{}],729:[function(_dereq_,module,exports){ +},{}],758:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107681,7 +108551,7 @@ exports.isBottomAnchor = function isBottomAnchor(opts) { ); }; -},{}],730:[function(_dereq_,module,exports){ +},{}],759:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -107922,7 +108792,7 @@ module.exports = { pathAnnulus: pathAnnulus }; -},{"./mod":756}],731:[function(_dereq_,module,exports){ +},{"./mod":785}],760:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108079,7 +108949,7 @@ function _rowLength(z, fn, len0) { return 0; } -},{}],732:[function(_dereq_,module,exports){ +},{}],761:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108112,7 +108982,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":724,"fast-isnumeric":241}],733:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"fast-isnumeric":241}],762:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108140,7 +109010,7 @@ module.exports = function clearGlCanvases(gd) { } }; -},{}],734:[function(_dereq_,module,exports){ +},{}],763:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108163,7 +109033,7 @@ module.exports = function clearResponsive(gd) { } }; -},{}],735:[function(_dereq_,module,exports){ +},{}],764:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108627,7 +109497,7 @@ function validate(value, opts) { } exports.validate = validate; -},{"../components/colorscale/scales":630,"../constants/interactions":723,"../plots/attributes":794,"./array":731,"./mod":756,"./nested_property":757,"./regex":765,"fast-isnumeric":241,"tinycolor2":548}],736:[function(_dereq_,module,exports){ +},{"../components/colorscale/scales":658,"../constants/interactions":752,"../plots/attributes":823,"./array":760,"./mod":785,"./nested_property":786,"./regex":794,"fast-isnumeric":241,"tinycolor2":576}],765:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -108675,9 +109545,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -108685,7 +109569,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range @@ -109214,7 +110098,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":724,"../registry":880,"./loggers":753,"./mod":756,"d3-time-format":166,"fast-isnumeric":241}],737:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"../registry":910,"./loggers":782,"./mod":785,"d3-time-format":166,"fast-isnumeric":241}],766:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109227,6 +110111,8 @@ exports.findExactDates = function(data, calendar) { var d3 = _dereq_('d3'); var loggers = _dereq_('./loggers'); +var matrix = _dereq_('./matrix'); +var mat4X4 = _dereq_('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -109308,16 +110194,89 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; -},{"./loggers":753,"d3":169}],738:[function(_dereq_,module,exports){ +},{"./loggers":782,"./matrix":784,"d3":169,"gl-mat4":292}],767:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109490,7 +110449,7 @@ var Events = { module.exports = Events; -},{"events":110}],739:[function(_dereq_,module,exports){ +},{"events":110}],768:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109604,7 +110563,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":750}],740:[function(_dereq_,module,exports){ +},{"./is_plain_object.js":779}],769:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109655,7 +110614,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],741:[function(_dereq_,module,exports){ +},{}],770:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -109703,7 +110662,7 @@ function isCalcData(cont) { ); } -},{}],742:[function(_dereq_,module,exports){ +},{}],771:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110088,7 +111047,7 @@ module.exports = { computeBbox: computeBbox }; -},{"./identity":747,"./is_plain_object":750,"./loggers":753,"./nested_property":757,"./polygon":761,"@turf/area":59,"@turf/bbox":60,"@turf/centroid":61,"country-regex":139,"d3":169}],743:[function(_dereq_,module,exports){ +},{"./identity":776,"./is_plain_object":779,"./loggers":782,"./nested_property":786,"./polygon":790,"@turf/area":59,"@turf/bbox":60,"@turf/centroid":61,"country-regex":139,"d3":169}],772:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110205,7 +111164,7 @@ exports.makeBlank = function() { }; }; -},{"../constants/numerical":724}],744:[function(_dereq_,module,exports){ +},{"../constants/numerical":753}],773:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110449,7 +111408,7 @@ exports.findPointOnPath = function findPointOnPath(path, val, coord, opts) { return pt; }; -},{"./mod":756}],745:[function(_dereq_,module,exports){ +},{"./mod":785}],774:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110528,14 +111487,11 @@ function formatColor(containerIn, opacityIn, len) { return colorOut; } -function parseColorScale(cont, alpha) { - if(alpha === undefined) alpha = 1; - +function parseColorScale(cont) { var cOpts = Colorscale.extractOpts(cont); - var colorscale = cOpts.reversescale ? - Colorscale.flipScale(cOpts.colorscale) : - cOpts.colorscale; + var colorscale = cOpts.colorscale; + if(cOpts.reversescale) colorscale = Colorscale.flipScale(cOpts.colorscale); return colorscale.map(function(elem) { var index = elem[0]; @@ -110543,7 +111499,7 @@ function parseColorScale(cont, alpha) { var rgb = color.toRgb(); return { index: index, - rgb: [rgb.r, rgb.g, rgb.b, alpha] + rgb: [rgb.r, rgb.g, rgb.b, rgb.a] }; }); } @@ -110553,7 +111509,7 @@ module.exports = { parseColorScale: parseColorScale }; -},{"../components/color/attributes":614,"../components/colorscale":627,"./array":731,"color-normalize":125,"fast-isnumeric":241,"tinycolor2":548}],746:[function(_dereq_,module,exports){ +},{"../components/color/attributes":642,"../components/colorscale":655,"./array":760,"color-normalize":125,"fast-isnumeric":241,"tinycolor2":576}],775:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110589,7 +111545,7 @@ module.exports = { unwrap: function(d) {return d[0];} }; -},{"./identity":747}],747:[function(_dereq_,module,exports){ +},{"./identity":776}],776:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110605,7 +111561,7 @@ module.exports = { module.exports = function identity(d) { return d; }; -},{}],748:[function(_dereq_,module,exports){ +},{}],777:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110647,7 +111603,7 @@ module.exports = function incrementNumeric(x, delta) { return newX; }; -},{}],749:[function(_dereq_,module,exports){ +},{}],778:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -110738,8 +111694,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = _dereq_('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -110795,6 +111754,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = _dereq_('./clear_responsive'); @@ -111845,6 +112808,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -111871,13 +112846,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -111895,7 +112868,24 @@ lib.ensureUniformFontSize = function(gd, baseFont) { return out; }; -},{"../constants/numerical":724,"./anchor_utils":729,"./angles":730,"./array":731,"./clean_number":732,"./clear_responsive":734,"./coerce":735,"./dates":736,"./dom":737,"./extend":739,"./filter_unique":740,"./filter_visible":741,"./geometry2d":744,"./identity":747,"./increment":748,"./is_plain_object":750,"./keyed_container":751,"./localize":752,"./loggers":753,"./make_trace_groups":754,"./matrix":755,"./mod":756,"./nested_property":757,"./noop":758,"./notifier":759,"./push_unique":763,"./regex":765,"./relative_attr":766,"./relink_private":767,"./search":768,"./stats":771,"./throttle":774,"./to_log_range":775,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],750:[function(_dereq_,module,exports){ +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; + +},{"../constants/numerical":753,"./anchor_utils":758,"./angles":759,"./array":760,"./clean_number":761,"./clear_responsive":763,"./coerce":764,"./dates":765,"./dom":766,"./extend":768,"./filter_unique":769,"./filter_visible":770,"./geometry2d":773,"./identity":776,"./increment":777,"./is_plain_object":779,"./keyed_container":780,"./localize":781,"./loggers":782,"./make_trace_groups":783,"./matrix":784,"./mod":785,"./nested_property":786,"./noop":787,"./notifier":788,"./push_unique":792,"./regex":794,"./relative_attr":795,"./relink_private":796,"./search":797,"./stats":800,"./throttle":803,"./to_log_range":804,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],779:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -111923,7 +112913,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],751:[function(_dereq_,module,exports){ +},{}],780:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112116,7 +113106,7 @@ module.exports = function keyedContainer(baseObj, path, keyName, valueName) { return obj; }; -},{"./nested_property":757}],752:[function(_dereq_,module,exports){ +},{"./nested_property":786}],781:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112172,7 +113162,7 @@ module.exports = function localize(gd, s) { return s; }; -},{"../registry":880}],753:[function(_dereq_,module,exports){ +},{"../registry":910}],782:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112282,7 +113272,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":785,"./notifier":759}],754:[function(_dereq_,module,exports){ +},{"../plot_api/plot_config":814,"./notifier":788}],783:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112325,7 +113315,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { return traces; }; -},{"d3":169}],755:[function(_dereq_,module,exports){ +},{"d3":169}],784:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112337,6 +113327,7 @@ module.exports = function makeTraceGroups(traceLayer, cdModule, cls) { 'use strict'; +var mat4X4 = _dereq_('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -112412,13 +113403,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -112432,7 +113433,41 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],756:[function(_dereq_,module,exports){ +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; + +},{"gl-mat4":292}],785:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112467,7 +113502,7 @@ module.exports = { modHalf: modHalf }; -},{}],757:[function(_dereq_,module,exports){ +},{}],786:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112713,7 +113748,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"./array":731,"fast-isnumeric":241}],758:[function(_dereq_,module,exports){ +},{"./array":760,"fast-isnumeric":241}],787:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112729,7 +113764,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],759:[function(_dereq_,module,exports){ +},{}],788:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112817,7 +113852,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":169,"fast-isnumeric":241}],760:[function(_dereq_,module,exports){ +},{"d3":169,"fast-isnumeric":241}],789:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -112865,7 +113900,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":769}],761:[function(_dereq_,module,exports){ +},{"./setcursor":798}],790:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113117,8 +114152,8 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":724,"./matrix":755}],762:[function(_dereq_,module,exports){ -(function (global){ +},{"../constants/numerical":753,"./matrix":784}],791:[function(_dereq_,module,exports){ +(function (global){(function (){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113190,8 +114225,8 @@ module.exports = function prepareRegl(gd, extensions) { return success; }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./show_no_webgl_msg":770,"regl":512}],763:[function(_dereq_,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./show_no_webgl_msg":799,"regl":540}],792:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113229,7 +114264,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],764:[function(_dereq_,module,exports){ +},{}],793:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113437,7 +114472,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":749,"../plot_api/plot_config":785}],765:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/plot_config":814}],794:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113467,7 +114502,7 @@ exports.counter = function(head, tail, openEnded, matchBeginning) { return new RegExp(startWithPrefix + head + '([2-9]|[1-9][0-9]+)?' + fullTail); }; -},{}],766:[function(_dereq_,module,exports){ +},{}],795:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113520,7 +114555,7 @@ module.exports = function(baseAttr, relativeAttr) { return baseAttr + relativeAttr; }; -},{}],767:[function(_dereq_,module,exports){ +},{}],796:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113577,7 +114612,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./array":731,"./is_plain_object":750}],768:[function(_dereq_,module,exports){ +},{"./array":760,"./is_plain_object":779}],797:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113782,7 +114817,7 @@ exports.findIndexOfMin = function(arr, fn) { return ind; }; -},{"../constants/numerical":724,"./identity":747,"./loggers":753,"fast-isnumeric":241}],769:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"./identity":776,"./loggers":782,"fast-isnumeric":241}],798:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113805,7 +114840,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],770:[function(_dereq_,module,exports){ +},{}],799:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113869,7 +114904,7 @@ module.exports = function showNoWebGlMsg(scene) { return false; }; -},{"../components/color":615}],771:[function(_dereq_,module,exports){ +},{"../components/color":643}],800:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -113979,7 +115014,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"./array":731,"fast-isnumeric":241}],772:[function(_dereq_,module,exports){ +},{"./array":760,"fast-isnumeric":241}],801:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114000,7 +115035,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"color-normalize":125}],773:[function(_dereq_,module,exports){ +},{"color-normalize":125}],802:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114017,6 +115052,7 @@ module.exports = str2RgbaArray; var d3 = _dereq_('d3'); var Lib = _dereq_('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces'); var LINE_SPACING = _dereq_('../constants/alignment').LINE_SPACING; @@ -114131,7 +115167,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -114746,9 +115782,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; @@ -114879,7 +115926,7 @@ exports.makeEditable = function(context, options) { return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/alignment":717,"../constants/xmlns_namespaces":725,"../lib":749,"d3":169}],774:[function(_dereq_,module,exports){ +},{"../constants/alignment":745,"../constants/xmlns_namespaces":754,"../lib":778,"d3":169}],803:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -114982,7 +116029,7 @@ function _clearTimeout(cache) { } } -},{}],775:[function(_dereq_,module,exports){ +},{}],804:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115010,7 +116057,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":241}],776:[function(_dereq_,module,exports){ +},{"fast-isnumeric":241}],805:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115044,7 +116091,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":827,"topojson-client":551}],777:[function(_dereq_,module,exports){ +},{"../plots/geo/constants":857,"topojson-client":579}],806:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115066,7 +116113,7 @@ module.exports = { } }; -},{}],778:[function(_dereq_,module,exports){ +},{}],807:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115109,7 +116156,7 @@ module.exports = { } }; -},{}],779:[function(_dereq_,module,exports){ +},{}],808:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115167,7 +116214,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":880}],780:[function(_dereq_,module,exports){ +},{"../registry":910}],809:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115292,7 +116339,7 @@ function overrideOne(attr, editTypeOverride, overrideContainers, key) { } } -},{"../lib":749}],781:[function(_dereq_,module,exports){ +},{"../lib":778}],810:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -115469,6 +116516,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -115513,7 +116570,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } @@ -115984,7 +117041,7 @@ exports.clearAxisTypes = function(gd, traces, layoutUpdate) { } }; -},{"../components/color":615,"../lib":749,"../plots/cartesian/axis_ids":800,"../plots/plots":860,"../registry":880,"fast-isnumeric":241,"gl-mat4/fromQuat":275}],782:[function(_dereq_,module,exports){ +},{"../components/color":643,"../lib":778,"../plots/cartesian/axis_ids":830,"../plots/plots":890,"../registry":910,"fast-isnumeric":241,"gl-mat4/fromQuat":282}],811:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116027,7 +117084,7 @@ var templateApi = _dereq_('./template_api'); exports.makeTemplate = templateApi.makeTemplate; exports.validateTemplate = templateApi.validateTemplate; -},{"../snapshot/download":882,"./plot_api":784,"./template_api":789,"./to_image":790,"./validate":791}],783:[function(_dereq_,module,exports){ +},{"../snapshot/download":912,"./plot_api":813,"./template_api":818,"./to_image":819,"./validate":820}],812:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116240,7 +117297,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":750,"../lib/loggers":753,"../lib/noop":758,"../lib/search":768,"../registry":880,"./container_array_match":779}],784:[function(_dereq_,module,exports){ +},{"../lib/is_plain_object":779,"../lib/loggers":782,"../lib/noop":787,"../lib/search":797,"../registry":910,"./container_array_match":808}],813:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -116610,7 +117667,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -116624,9 +117692,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -118204,6 +119279,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -118298,7 +119379,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -118388,7 +119469,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -118526,21 +119607,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -119951,6 +121030,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -119958,15 +121050,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -119992,6 +121089,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); @@ -120125,7 +121223,7 @@ exports._guiUpdate = guiEdit(update); exports._storeDirectGUIEdit = _storeDirectGUIEdit; -},{"../components/color":615,"../components/drawing":637,"../constants/xmlns_namespaces":725,"../lib":749,"../lib/events":738,"../lib/queue":764,"../lib/svg_text_utils":773,"../plots/cartesian/axes":797,"../plots/cartesian/constants":803,"../plots/cartesian/graph_interact":806,"../plots/cartesian/select":816,"../plots/plots":860,"../plots/polar/legacy":868,"../registry":880,"./edit_types":780,"./helpers":781,"./manage_arrays":783,"./plot_config":785,"./plot_schema":786,"./subroutines":788,"d3":169,"fast-isnumeric":241,"has-hover":414}],785:[function(_dereq_,module,exports){ +},{"../components/color":643,"../components/drawing":665,"../constants/xmlns_namespaces":754,"../lib":778,"../lib/events":767,"../lib/queue":793,"../lib/svg_text_utils":802,"../plots/cartesian/axes":827,"../plots/cartesian/constants":833,"../plots/cartesian/graph_interact":836,"../plots/cartesian/select":846,"../plots/plots":890,"../plots/polar/legacy":898,"../registry":910,"./edit_types":809,"./helpers":810,"./manage_arrays":812,"./plot_config":814,"./plot_schema":815,"./subroutines":817,"d3":169,"fast-isnumeric":241,"has-hover":440}],814:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -120440,7 +121538,7 @@ module.exports = { dfltConfig: dfltConfig }; -},{}],786:[function(_dereq_,module,exports){ +},{}],815:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121151,7 +122249,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeepAll(np.get() || {}, newAttrs)); } -},{"../lib":749,"../plots/animation_attributes":792,"../plots/attributes":794,"../plots/frame_attributes":826,"../plots/layout_attributes":851,"../plots/polar/legacy/area_attributes":866,"../plots/polar/legacy/axis_attributes":867,"../registry":880,"./edit_types":780,"./plot_config":785}],787:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/animation_attributes":821,"../plots/attributes":823,"../plots/frame_attributes":856,"../plots/layout_attributes":881,"../plots/polar/legacy/area_attributes":896,"../plots/polar/legacy/axis_attributes":897,"../registry":910,"./edit_types":809,"./plot_config":814}],816:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121463,7 +122561,7 @@ exports.arrayEditor = function(parentIn, containerStr, itemOut) { }; }; -},{"../lib":749,"../plots/attributes":794}],788:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/attributes":823}],817:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -121644,7 +122742,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -122133,57 +123231,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - - enforceAxisConstraints(gd); - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be @@ -122209,7 +123285,7 @@ exports.drawMarginPushers = function(gd) { Registry.getComponentMethod('colorbar', 'draw')(gd); }; -},{"../components/color":615,"../components/drawing":637,"../components/modebar":675,"../components/titles":710,"../constants/alignment":717,"../lib":749,"../lib/clear_gl_canvases":733,"../plots/cartesian/autorange":796,"../plots/cartesian/axes":797,"../plots/cartesian/constraints":804,"../plots/plots":860,"../registry":880,"d3":169}],789:[function(_dereq_,module,exports){ +},{"../components/color":643,"../components/drawing":665,"../components/modebar":703,"../components/titles":738,"../constants/alignment":745,"../lib":778,"../lib/clear_gl_canvases":762,"../plots/cartesian/autorange":826,"../plots/cartesian/axes":827,"../plots/cartesian/constraints":834,"../plots/plots":890,"../registry":910,"d3":169}],818:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -122671,7 +123747,7 @@ function format(opts) { return opts; } -},{"../lib":749,"../plots/attributes":794,"../plots/plots":860,"./plot_config":785,"./plot_schema":786,"./plot_template":787}],790:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/attributes":823,"../plots/plots":890,"./plot_config":814,"./plot_schema":815,"./plot_template":816}],819:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -122768,7 +123844,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; @@ -122892,7 +123968,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":749,"../plots/plots":860,"../snapshot/helpers":884,"../snapshot/svgtoimg":886,"../snapshot/tosvg":888,"../version":1337,"./plot_api":784,"fast-isnumeric":241}],791:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/plots":890,"../snapshot/helpers":914,"../snapshot/svgtoimg":916,"../snapshot/tosvg":918,"../version":1369,"./plot_api":813,"fast-isnumeric":241}],820:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -123323,7 +124399,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":749,"../plots/plots":860,"./plot_config":785,"./plot_schema":786}],792:[function(_dereq_,module,exports){ +},{"../lib":778,"../plots/plots":890,"./plot_config":814,"./plot_schema":815}],821:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -123435,7 +124511,7 @@ module.exports = { } }; -},{}],793:[function(_dereq_,module,exports){ +},{}],822:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -123530,7 +124606,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut return contOut; }; -},{"../lib":749,"../plot_api/plot_template":787}],794:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/plot_template":816}],823:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -123671,7 +124747,99 @@ module.exports = { } }; -},{"../components/fx/attributes":646}],795:[function(_dereq_,module,exports){ +},{"../components/fx/attributes":674}],824:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = _dereq_('fast-isnumeric'); +var Lib = _dereq_('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = _dereq_('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; + +},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],825:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -123700,7 +124868,7 @@ module.exports = { } }; -},{}],796:[function(_dereq_,module,exports){ +},{}],826:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -123717,6 +124885,8 @@ var Lib = _dereq_('../../lib'); var FP_SAFE = _dereq_('../../constants/numerical').FP_SAFE; var Registry = _dereq_('../../registry'); +var getFromId = _dereq_('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -123757,7 +124927,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -123798,19 +124969,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -123818,9 +124976,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -123838,8 +124996,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -123853,7 +125011,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -123874,7 +125032,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -123883,12 +125041,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -123898,13 +125056,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -123916,7 +125102,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -123945,14 +125221,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); @@ -124212,7 +125508,7 @@ function goodNumber(v) { function lessOrEqual(v0, v1) { return v0 <= v1; } function greaterOrEqual(v0, v1) { return v0 >= v1; } -},{"../../constants/numerical":724,"../../lib":749,"../../registry":880,"fast-isnumeric":241}],797:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../registry":910,"./axis_ids":830,"fast-isnumeric":241}],827:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -124229,6 +125525,7 @@ var Plots = _dereq_('../../plots/plots'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Titles = _dereq_('../../components/titles'); var Color = _dereq_('../../components/color'); @@ -124262,6 +125559,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = _dereq_('./set_convert'); @@ -124306,14 +125605,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -124321,6 +125623,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -124345,8 +125662,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -124355,7 +125672,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -124414,7 +125730,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -124736,6 +126054,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -124760,7 +126081,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -124770,6 +126091,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -124783,6 +126108,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -124795,15 +126304,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -124815,85 +126329,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var x = ax._tmin; - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } - - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } - - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } - - var pos = ax.c2p(tickVal.value); - - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + var flip = ax._id.charAt(0) === 'y'; + + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } + + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } + + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -124914,180 +126424,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; - - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -125180,7 +126542,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -125197,15 +126560,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -125318,7 +126683,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -125801,6 +127167,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -126073,21 +127440,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -126188,23 +127557,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -126235,13 +127605,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -126262,7 +127632,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -126278,7 +127648,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -126298,7 +127668,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -126330,7 +127700,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -126342,7 +127712,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -126357,7 +127727,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -126613,22 +127983,82 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} + /** * Make axis tick path string * @@ -126674,24 +128104,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -126699,42 +128150,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } + + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } - out.xFn = function(d) { return d.dx + x0; }; + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } + + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -126986,6 +128496,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -127003,22 +128515,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -127086,11 +128642,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -127130,6 +128699,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; @@ -127611,7 +129200,7 @@ function moveOutsideBreak(v, ax) { return v; } -},{"../../components/color":615,"../../components/drawing":637,"../../components/titles":710,"../../constants/alignment":717,"../../constants/numerical":724,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../../registry":880,"./autorange":796,"./axis_autotype":798,"./axis_ids":800,"./clean_ticks":802,"./layout_attributes":811,"./set_convert":817,"d3":169,"fast-isnumeric":241}],798:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../components/titles":738,"../../constants/alignment":745,"../../constants/numerical":753,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../../registry":910,"./autorange":826,"./axis_autotype":828,"./axis_ids":830,"./clean_ticks":832,"./layout_attributes":841,"./set_convert":847,"d3":169,"fast-isnumeric":241}],828:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -127628,23 +129217,49 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } + + if(moreDates(a, calendar)) return 'date'; + + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -127657,56 +129272,66 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } -},{"../../constants/numerical":724,"../../lib":749,"fast-isnumeric":241}],799:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],829:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -127763,9 +129388,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -127823,7 +129472,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -127835,8 +129487,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', @@ -127989,7 +129639,7 @@ function indexOfDay(v) { ]; } -},{"../../lib":749,"../../registry":880,"../array_container_defaults":793,"./category_order_defaults":801,"./constants":803,"./layout_attributes":811,"./line_grid_defaults":813,"./set_convert":817,"./tick_label_defaults":818,"./tick_mark_defaults":819,"./tick_value_defaults":820,"fast-isnumeric":241}],800:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../array_container_defaults":822,"./category_order_defaults":831,"./constants":833,"./layout_attributes":841,"./line_grid_defaults":843,"./set_convert":847,"./tick_label_defaults":848,"./tick_mark_defaults":849,"./tick_value_defaults":850,"fast-isnumeric":241}],830:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -128010,7 +129660,7 @@ var constants = _dereq_('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -128022,13 +129672,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -128074,6 +129731,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -128106,17 +129765,21 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; -},{"../../registry":880,"./constants":803}],801:[function(_dereq_,module,exports){ +},{"../../registry":910,"./constants":833}],831:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -128210,7 +129873,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],802:[function(_dereq_,module,exports){ +},{}],832:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -128223,7 +129886,9 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); -var ONEDAY = _dereq_('../../constants/numerical').ONEDAY; +var constants = _dereq_('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -128288,7 +129953,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely @@ -128298,7 +129965,7 @@ exports.tick0 = function(tick0, axType, calendar, dtick) { return isNumeric(tick0) ? Number(tick0) : 0; }; -},{"../../constants/numerical":724,"../../lib":749,"fast-isnumeric":241}],803:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],833:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -128313,8 +129980,8 @@ var counterRegex = _dereq_('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -128326,7 +129993,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots @@ -128390,7 +130057,7 @@ module.exports = { } }; -},{"../../lib/regex":765}],804:[function(_dereq_,module,exports){ +},{"../../lib/regex":794}],834:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -128402,74 +130069,280 @@ module.exports = { 'use strict'; var Lib = _dereq_('../../lib'); + +var autorange = _dereq_('./autorange'); var id2name = _dereq_('./axis_ids').id2name; +var layoutAttributes = _dereq_('./layout_attributes'); var scaleZoom = _dereq_('./scale_zoom'); -var makePadFn = _dereq_('./autorange').makePadFn; -var concatExtremes = _dereq_('./autorange').concatExtremes; +var setConvert = _dereq_('./set_convert'); var ALMOST_EQUAL = _dereq_('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = _dereq_('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; + + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; + + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + var canLink = linkableAxes.length; + + var matches, scaleanchor; + + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -128480,64 +130353,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; + if(!scaleratio) scaleratio = axOut.scaleratio = 1; - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; - - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; +} - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -128546,12 +130394,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -128564,38 +130414,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); } } - thisGroup[scaleanchor] = 1; + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } + } + + out[key] = val; + } + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -128704,25 +130625,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -128744,6 +130666,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { @@ -128776,7 +130708,7 @@ function updateDomain(ax, factor) { ax.setScale(); } -},{"../../constants/alignment":717,"../../constants/numerical":724,"../../lib":749,"./autorange":796,"./axis_ids":800,"./scale_zoom":815}],805:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745,"../../constants/numerical":753,"../../lib":778,"./autorange":826,"./axis_ids":830,"./layout_attributes":841,"./scale_zoom":845,"./set_convert":847}],835:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -128793,6 +130725,7 @@ var supportsPassive = _dereq_('has-passive-events'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -128869,6 +130802,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -128900,10 +130836,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -128940,6 +130877,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -129105,6 +131045,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -129122,8 +131068,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -129323,6 +131269,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -129332,6 +131280,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -129340,7 +131304,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -129371,15 +131335,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -129388,12 +131354,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -129403,7 +131373,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -129413,9 +131383,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -129615,15 +131600,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -129639,7 +131624,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -129851,7 +131836,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -129864,7 +131849,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -129929,11 +131914,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -129944,14 +131931,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -129961,7 +131956,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } @@ -130048,7 +132046,7 @@ module.exports = { attachWheelEventHandler: attachWheelEventHandler }; -},{"../../components/color":615,"../../components/dragelement":634,"../../components/dragelement/helpers":633,"../../components/drawing":637,"../../components/fx":655,"../../constants/alignment":717,"../../lib":749,"../../lib/clear_gl_canvases":733,"../../lib/setcursor":769,"../../lib/svg_text_utils":773,"../../plot_api/subroutines":788,"../../registry":880,"../plots":860,"./axes":797,"./axis_ids":800,"./constants":803,"./scale_zoom":815,"./select":816,"d3":169,"has-passive-events":415,"tinycolor2":548}],806:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement":662,"../../components/dragelement/helpers":661,"../../components/drawing":665,"../../components/fx":683,"../../constants/alignment":745,"../../lib":778,"../../lib/clear_gl_canvases":762,"../../lib/setcursor":798,"../../lib/svg_text_utils":802,"../../plot_api/subroutines":817,"../../registry":910,"../plots":890,"./axes":827,"./axis_ids":830,"./constants":833,"./scale_zoom":845,"./select":846,"d3":169,"has-passive-events":441,"tinycolor2":576}],836:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -130216,7 +132214,7 @@ exports.updateFx = function(gd) { setCursor(fullLayout._draggers, cursor); }; -},{"../../components/dragelement":634,"../../components/fx":655,"../../lib/setcursor":769,"./constants":803,"./dragbox":805,"d3":169}],807:[function(_dereq_,module,exports){ +},{"../../components/dragelement":662,"../../components/fx":683,"../../lib/setcursor":798,"./constants":833,"./dragbox":835,"d3":169}],837:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -130252,7 +132250,7 @@ module.exports = { clearSelect: clearSelect }; -},{}],808:[function(_dereq_,module,exports){ +},{}],838:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -130264,6 +132262,8 @@ module.exports = { 'use strict'; +var strTranslate = _dereq_('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -130294,9 +132294,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { @@ -130306,7 +132307,7 @@ module.exports = { getTransform: getTransform }; -},{}],809:[function(_dereq_,module,exports){ +},{"../../lib":778}],839:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -130320,6 +132321,7 @@ module.exports = { var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var axisIds = _dereq_('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -130349,8 +132351,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); @@ -130381,7 +132385,7 @@ module.exports = function makeIncludeComponents(containerArrayName) { }; }; -},{"../../lib":749,"../../registry":880}],810:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"./axis_ids":830}],840:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -130719,6 +132723,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove @@ -130998,7 +133003,7 @@ exports.toSVG = function(gd) { exports.updateFx = _dereq_('./graph_interact').updateFx; -},{"../../components/drawing":637,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../registry":880,"../get_data":834,"../plots":860,"./attributes":795,"./axis_ids":800,"./constants":803,"./graph_interact":806,"./layout_attributes":811,"./layout_defaults":812,"./transition_axes":821,"d3":169}],811:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../registry":910,"../get_data":864,"../plots":890,"./attributes":825,"./axis_ids":830,"./constants":833,"./graph_interact":836,"./layout_attributes":841,"./layout_defaults":842,"./transition_axes":851,"d3":169}],841:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -131071,6 +133076,14 @@ module.exports = { // type in the template explicitly it will be honored as the default. _noTemplating: true, + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, autorange: { valType: 'enumerated', @@ -131131,7 +133144,6 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', editType: 'plot', @@ -131295,6 +133307,22 @@ module.exports = { editType: 'ticks', + }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + + editType: 'calc', + }, mirror: { valType: 'enumerated', @@ -131435,6 +133463,14 @@ module.exports = { editType: 'ticks', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'ticks', + }, separatethousands: { valType: 'boolean', @@ -131687,7 +133723,7 @@ module.exports = { } }; -},{"../../components/color/attributes":614,"../../components/drawing/attributes":636,"../../constants/docs":719,"../../constants/numerical":724,"../../lib/extend":739,"../../plot_api/plot_template":787,"../font_attributes":825,"./constants":803}],812:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../components/drawing/attributes":664,"../../constants/docs":748,"../../constants/numerical":753,"../../lib/extend":768,"../../plot_api/plot_template":816,"../font_attributes":855,"./constants":833}],842:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -131709,7 +133745,7 @@ var basePlotLayoutAttributes = _dereq_('../layout_attributes'); var layoutAttributes = _dereq_('./layout_attributes'); var handleTypeDefaults = _dereq_('./type_defaults'); var handleAxisDefaults = _dereq_('./axis_defaults'); -var handleConstraintDefaults = _dereq_('./constraints').handleConstraintDefaults; +var constraints = _dereq_('./constraints'); var handlePositionDefaults = _dereq_('./position_defaults'); var axisIds = _dereq_('./axis_ids'); @@ -131728,6 +133764,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -131936,6 +133974,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -132000,6 +134039,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -132064,101 +134104,13 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; -},{"../../components/color":615,"../../components/fx/helpers":651,"../../components/fx/hovermode_defaults":654,"../../lib":749,"../../plot_api/plot_template":787,"../../registry":880,"../layout_attributes":851,"./axis_defaults":799,"./axis_ids":800,"./constants":803,"./constraints":804,"./layout_attributes":811,"./position_defaults":814,"./type_defaults":822}],813:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx/helpers":679,"../../components/fx/hovermode_defaults":682,"../../lib":778,"../../plot_api/plot_template":816,"../../registry":910,"../layout_attributes":881,"./axis_defaults":829,"./axis_ids":830,"./constants":833,"./constraints":834,"./layout_attributes":841,"./position_defaults":844,"./type_defaults":852}],843:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -132223,7 +134175,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer } }; -},{"../../components/color/attributes":614,"../../lib":749,"tinycolor2":548}],814:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib":778,"tinycolor2":576}],844:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -132311,7 +134263,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":749,"fast-isnumeric":241}],815:[function(_dereq_,module,exports){ +},{"../../lib":778,"fast-isnumeric":241}],845:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -132337,9 +134289,10 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; -},{"../../constants/alignment":717}],816:[function(_dereq_,module,exports){ +},{"../../constants/alignment":745}],846:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -132409,6 +134362,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -132498,8 +134459,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -133274,7 +135235,7 @@ module.exports = { selectOnClick: selectOnClick }; -},{"../../components/color":615,"../../components/dragelement/helpers":633,"../../components/drawing":637,"../../components/fx":655,"../../components/fx/helpers":651,"../../components/shapes/draw_newshape/display_outlines":700,"../../components/shapes/draw_newshape/helpers":701,"../../components/shapes/draw_newshape/newshapes":702,"../../lib":749,"../../lib/clear_gl_canvases":733,"../../lib/polygon":761,"../../lib/throttle":774,"../../plot_api/subroutines":788,"../../registry":880,"./axis_ids":800,"./constants":803,"./handle_outline":807,"./helpers":808,"polybooljs":491}],817:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement/helpers":661,"../../components/drawing":665,"../../components/fx":683,"../../components/fx/helpers":679,"../../components/shapes/draw_newshape/display_outlines":728,"../../components/shapes/draw_newshape/helpers":729,"../../components/shapes/draw_newshape/newshapes":730,"../../lib":778,"../../lib/clear_gl_canvases":762,"../../lib/polygon":790,"../../lib/throttle":803,"../../plot_api/subroutines":817,"../../registry":910,"./axis_ids":830,"./constants":833,"./handle_outline":837,"./helpers":838,"polybooljs":517}],847:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -133307,7 +135268,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = _dereq_('./axis_ids'); - var constants = _dereq_('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -133463,6 +135423,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -133594,12 +135558,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -133642,17 +135606,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -134156,38 +136115,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } @@ -134246,7 +136193,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":724,"../../lib":749,"./axis_ids":800,"./constants":803,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],818:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"./axis_ids":830,"./constants":833,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],848:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -134259,6 +136206,7 @@ module.exports = function setConvert(ax, fullLayout) { 'use strict'; var Lib = _dereq_('../../lib'); +var contrast = _dereq_('../../components/color').contrast; var layoutAttributes = _dereq_('./layout_attributes'); var handleArrayContainerDefaults = _dereq_('../array_container_defaults'); @@ -134295,10 +136243,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -134321,6 +136273,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } @@ -134367,7 +136320,7 @@ function tickformatstopDefaults(valueIn, valueOut) { } } -},{"../../lib":749,"../array_container_defaults":793,"./layout_attributes":811}],819:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../array_container_defaults":822,"./layout_attributes":841}],849:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -134400,7 +136353,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":749,"./layout_attributes":811}],820:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":841}],850:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -134447,7 +136400,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../lib":749,"./clean_ticks":802}],821:[function(_dereq_,module,exports){ +},{"../../lib":778,"./clean_ticks":832}],851:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -134660,7 +136613,7 @@ module.exports = function transitionAxes(gd, edits, transitionOpts, makeOnComple return Promise.resolve(); }; -},{"../../components/drawing":637,"../../lib":749,"../../registry":880,"./axes":797,"d3":169}],822:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../registry":910,"./axes":827,"d3":169}],852:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -134679,6 +136632,7 @@ var autoType = _dereq_('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -134731,6 +136685,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { @@ -134797,7 +136753,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":880,"./axis_autotype":798}],823:[function(_dereq_,module,exports){ +},{"../../registry":910,"./axis_autotype":828}],853:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -135224,7 +137180,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":749,"../registry":880}],824:[function(_dereq_,module,exports){ +},{"../lib":778,"../registry":910}],854:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -135336,7 +137292,7 @@ exports.defaults = function(containerOut, layout, coerce, dfltDomains) { if(!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; -},{"../lib/extend":739}],825:[function(_dereq_,module,exports){ +},{"../lib/extend":768}],855:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -135401,7 +137357,7 @@ module.exports = function(opts) { return attrs; }; -},{}],826:[function(_dereq_,module,exports){ +},{}],856:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -135447,7 +137403,7 @@ module.exports = { } }; -},{}],827:[function(_dereq_,module,exports){ +},{}],857:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -135622,7 +137578,7 @@ exports.layerNameToAdjective = { frame: 'frame' }; -},{}],828:[function(_dereq_,module,exports){ +},{}],858:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -135639,6 +137595,7 @@ var d3 = _dereq_('d3'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Fx = _dereq_('../../components/fx'); @@ -136257,7 +138214,7 @@ proto.render = function() { function translatePoints(d) { var lonlatPx = projection(d.lonlat); return lonlatPx ? - 'translate(' + lonlatPx[0] + ',' + lonlatPx[1] + ')' : + strTranslate(lonlatPx[0], lonlatPx[1]) : null; } @@ -136456,7 +138413,7 @@ function makeRangeBox(lon, lat) { }; } -},{"../../components/color":615,"../../components/dragelement":634,"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/topojson_utils":776,"../../registry":880,"../cartesian/autorange":796,"../cartesian/axes":797,"../cartesian/select":816,"../plots":860,"./constants":827,"./projections":832,"./zoom":833,"d3":169,"topojson-client":551}],829:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement":662,"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/topojson_utils":805,"../../registry":910,"../cartesian/autorange":826,"../cartesian/axes":827,"../cartesian/select":846,"../plots":890,"./constants":857,"./projections":862,"./zoom":863,"d3":169,"topojson-client":579}],859:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -136550,7 +138507,7 @@ module.exports = { clean: clean }; -},{"../../lib":749,"../../plots/get_data":834,"./geo":828,"./layout_attributes":830,"./layout_defaults":831}],830:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/get_data":864,"./geo":858,"./layout_attributes":860,"./layout_defaults":861}],860:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -136841,7 +138798,7 @@ attrs.uirevision = { }; -},{"../../components/color/attributes":614,"../../plot_api/edit_types":780,"../domain":824,"./constants":827}],831:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../plot_api/edit_types":809,"../domain":854,"./constants":857}],861:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -137069,7 +139026,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) { } } -},{"../../lib":749,"../get_data":834,"../subplot_defaults":874,"./constants":827,"./layout_attributes":830}],832:[function(_dereq_,module,exports){ +},{"../../lib":778,"../get_data":864,"../subplot_defaults":904,"./constants":857,"./layout_attributes":860}],862:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -137515,7 +139472,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],833:[function(_dereq_,module,exports){ +},{}],863:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138027,7 +139984,7 @@ function d3eventDispatch(target) { return dispatch; } -},{"../../lib":749,"../../registry":880,"d3":169}],834:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"d3":169}],864:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138156,7 +140113,7 @@ exports.getSubplotData = function getSubplotData(data, type, subplotId) { return subplotData; }; -},{"../registry":880,"./cartesian/constants":803}],835:[function(_dereq_,module,exports){ +},{"../registry":910,"./cartesian/constants":833}],865:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138451,7 +140408,7 @@ function createCamera(scene) { return result; } -},{"../cartesian/constants":803,"has-passive-events":415,"mouse-change":457,"mouse-event-offset":458,"mouse-wheel":460}],836:[function(_dereq_,module,exports){ +},{"../cartesian/constants":833,"has-passive-events":441,"mouse-change":483,"mouse-event-offset":484,"mouse-wheel":486}],866:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138694,7 +140651,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/str2rgbarray":772,"../cartesian/axes":797}],837:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":801,"../cartesian/axes":827}],867:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138845,7 +140802,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/fx/layout_attributes":656,"../../constants/xmlns_namespaces":725,"../../plot_api/edit_types":780,"../cartesian":810,"../cartesian/attributes":795,"../cartesian/constants":803,"../get_data":834,"../layout_attributes":851,"./scene2d":838}],838:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":684,"../../constants/xmlns_namespaces":754,"../../plot_api/edit_types":809,"../cartesian":840,"../cartesian/attributes":825,"../cartesian/constants":833,"../get_data":864,"../layout_attributes":881,"./scene2d":868}],868:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -138993,11 +140950,6 @@ proto.makeFramework = function() { this.updateSize(canvas); - // disabling user select on the canvas - // sanitizes double-clicks interactions - // ref: https://github.com/plotly/plotly.js/issues/744 - canvas.className += ' user-select-none'; - // create SVG container for hover text var svgContainer = this.svgContainer = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -139570,7 +141522,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../components/dragelement/helpers":633,"../../components/fx":655,"../../lib/show_no_webgl_msg":770,"../../plots/cartesian/axes":797,"../../registry":880,"../cartesian/autorange":796,"../cartesian/constants":803,"../cartesian/constraints":804,"./camera":835,"./convert":836,"gl-plot2d":298,"gl-select-box":310,"gl-spikes2d":319,"webgl-context":578}],839:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":661,"../../components/fx":683,"../../lib/show_no_webgl_msg":799,"../../plots/cartesian/axes":827,"../../registry":910,"../cartesian/autorange":826,"../cartesian/constants":833,"../cartesian/constraints":834,"./camera":865,"./convert":866,"gl-plot2d":317,"gl-select-box":333,"gl-spikes2d":342,"webgl-context":606}],869:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -139730,7 +141682,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/fx/layout_attributes":656,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../plot_api/edit_types":780,"../get_data":834,"./layout/attributes":840,"./layout/defaults":844,"./layout/layout_attributes":845,"./scene":849}],840:[function(_dereq_,module,exports){ +},{"../../components/fx/layout_attributes":684,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../plot_api/edit_types":809,"../get_data":864,"./layout/attributes":870,"./layout/defaults":874,"./layout/layout_attributes":875,"./scene":879}],870:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -139752,7 +141704,7 @@ module.exports = { } }; -},{}],841:[function(_dereq_,module,exports){ +},{}],871:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -139823,6 +141775,7 @@ module.exports = overrideAll({ type: extendFlat({}, axesAttrs.type, { values: ['-', 'linear', 'log', 'date', 'category'] }), + autotypenumbers: axesAttrs.autotypenumbers, autorange: axesAttrs.autorange, rangemode: axesAttrs.rangemode, range: extendFlat({}, axesAttrs.range, { @@ -139853,6 +141806,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickformat: axesAttrs.tickformat, tickformatstops: axesAttrs.tickformatstops, @@ -139874,7 +141828,7 @@ module.exports = overrideAll({ } }, 'plot', 'from-root'); -},{"../../../components/color":615,"../../../lib/extend":739,"../../../plot_api/edit_types":780,"../../cartesian/layout_attributes":811}],842:[function(_dereq_,module,exports){ +},{"../../../components/color":643,"../../../lib/extend":768,"../../../plot_api/edit_types":809,"../../cartesian/layout_attributes":841}],872:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -139929,6 +141883,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { showGrid: true, noTickson: true, noTicklabelmode: true, + noTicklabelposition: true, bgColor: options.bgColor, calendar: options.calendar }, @@ -139950,7 +141905,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":749,"../../../plot_api/plot_template":787,"../../cartesian/axis_defaults":799,"../../cartesian/type_defaults":822,"./axis_attributes":841,"tinycolor2":548}],843:[function(_dereq_,module,exports){ +},{"../../../lib":778,"../../../plot_api/plot_template":816,"../../cartesian/axis_defaults":829,"../../cartesian/type_defaults":852,"./axis_attributes":871,"tinycolor2":576}],873:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140115,7 +142070,7 @@ function createAxesOptions(fullLayout, sceneLayout) { module.exports = createAxesOptions; -},{"../../../lib":749,"../../../lib/str2rgbarray":772}],844:[function(_dereq_,module,exports){ +},{"../../../lib":778,"../../../lib/str2rgbarray":801}],874:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140158,6 +142113,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { font: layoutOut.font, fullData: fullData, getDfltFromLayout: getDfltFromLayout, + autotypenumbersDflt: layoutOut.autotypenumbers, paper_bgcolor: layoutOut.paper_bgcolor, calendar: layoutOut.calendar }); @@ -140227,6 +142183,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { data: fullGl3dData, bgColor: bgColorCombined, calendar: opts.calendar, + autotypenumbersDflt: opts.autotypenumbersDflt, fullLayout: opts.fullLayout }); @@ -140263,7 +142220,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":615,"../../../lib":749,"../../../registry":880,"../../get_data":834,"../../subplot_defaults":874,"./axis_defaults":842,"./layout_attributes":845}],845:[function(_dereq_,module,exports){ +},{"../../../components/color":643,"../../../lib":778,"../../../registry":910,"../../get_data":864,"../../subplot_defaults":904,"./axis_defaults":872,"./layout_attributes":875}],875:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140414,7 +142371,7 @@ module.exports = { } }; -},{"../../../lib":749,"../../../lib/extend":739,"../../domain":824,"./axis_attributes":841}],846:[function(_dereq_,module,exports){ +},{"../../../lib":778,"../../../lib/extend":768,"../../domain":854,"./axis_attributes":871}],876:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140466,7 +142423,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":772}],847:[function(_dereq_,module,exports){ +},{"../../../lib/str2rgbarray":801}],877:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140567,7 +142524,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":749,"../../cartesian/axes":797}],848:[function(_dereq_,module,exports){ +},{"../../../lib":778,"../../cartesian/axes":827}],878:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140601,7 +142558,7 @@ function project(camera, v) { module.exports = project; -},{}],849:[function(_dereq_,module,exports){ +},{}],879:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -140740,6 +142697,8 @@ proto.prepareOptions = function() { return opts; }; +var firstInit = true; + proto.tryCreatePlot = function() { var scene = this; @@ -140750,7 +142709,7 @@ proto.tryCreatePlot = function() { try { scene.glplot = createPlot(opts); } catch(e) { - if(scene.staticMode) { + if(scene.staticMode || !firstInit) { success = false; } else { // try second time try { @@ -140762,15 +142721,22 @@ proto.tryCreatePlot = function() { 'The device may not be supported by is-mobile module!', 'Inverting preserveDrawingBuffer option in second attempt to create webgl scene.' ].join(' ')); + + // invert is-mobile isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; scene.glplot = createPlot(opts); } catch(e) { + // revert changes to is-mobile + isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; + success = false; } } } + firstInit = false; + return success; }; @@ -140842,43 +142808,45 @@ proto.initializeGLPlot = function() { scene.graphDiv.emit('plotly_relayout', update); }; - scene.glplot.canvas.addEventListener('mouseup', function() { - relayoutCallback(scene); - }); + if(scene.glplot.canvas) { + scene.glplot.canvas.addEventListener('mouseup', function() { + relayoutCallback(scene); + }); - scene.glplot.canvas.addEventListener('wheel', function(e) { - if(gd._context._scrollZoom.gl3d) { - if(scene.camera._ortho) { - var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1; - var o = scene.glplot.getAspectratio(); - scene.glplot.setAspectratio({ - x: s * o.x, - y: s * o.y, - z: s * o.z - }); - } + scene.glplot.canvas.addEventListener('wheel', function(e) { + if(gd._context._scrollZoom.gl3d) { + if(scene.camera._ortho) { + var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1; + var o = scene.glplot.getAspectratio(); + scene.glplot.setAspectratio({ + x: s * o.x, + y: s * o.y, + z: s * o.z + }); + } - relayoutCallback(scene); - } - }, passiveSupported ? {passive: false} : false); + relayoutCallback(scene); + } + }, passiveSupported ? {passive: false} : false); - scene.glplot.canvas.addEventListener('mousemove', function() { - if(scene.fullSceneLayout.dragmode === false) return; - if(scene.camera.mouseListener.buttons === 0) return; + scene.glplot.canvas.addEventListener('mousemove', function() { + if(scene.fullSceneLayout.dragmode === false) return; + if(scene.camera.mouseListener.buttons === 0) return; - var update = makeUpdate(); - scene.graphDiv.emit('plotly_relayouting', update); - }); + var update = makeUpdate(); + scene.graphDiv.emit('plotly_relayouting', update); + }); - if(!scene.staticMode) { - scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { - if(gd && gd.emit) { - gd.emit('plotly_webglcontextlost', { - event: event, - layer: scene.id - }); - } - }, false); + if(!scene.staticMode) { + scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { + if(gd && gd.emit) { + gd.emit('plotly_webglcontextlost', { + event: event, + layer: scene.id + }); + } + }, false); + } } scene.glplot.oncontextloss = function() { @@ -140900,8 +142868,12 @@ proto.render = function() { // update size of svg container var svgContainer = scene.svgContainer; var clientRect = scene.container.getBoundingClientRect(); - var width = clientRect.width; - var height = clientRect.height; + + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var width = clientRect.width * scaleX; + var height = clientRect.height * scaleY; svgContainer.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height); svgContainer.setAttributeNS(null, 'width', width); svgContainer.setAttributeNS(null, 'height', height); @@ -141725,7 +143697,7 @@ proto.make4thDimension = function() { module.exports = Scene; -},{"../../components/fx":655,"../../lib":749,"../../lib/show_no_webgl_msg":770,"../../lib/str2rgbarray":772,"../../plots/cartesian/axes":797,"../../registry":880,"./layout/convert":843,"./layout/spikes":846,"./layout/tick_marks":847,"./project":848,"gl-plot3d":301,"has-passive-events":415,"is-mobile":441,"webgl-context":578}],850:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../lib":778,"../../lib/show_no_webgl_msg":799,"../../lib/str2rgbarray":801,"../../plots/cartesian/axes":827,"../../registry":910,"./layout/convert":873,"./layout/spikes":876,"./layout/tick_marks":877,"./project":878,"gl-plot3d":321,"has-passive-events":441,"is-mobile":467,"webgl-context":606}],880:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -141746,7 +143718,7 @@ module.exports = function zip3(x, y, z, len) { return result; }; -},{}],851:[function(_dereq_,module,exports){ +},{}],881:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -141934,6 +143906,12 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + + editType: 'none', + + }, paper_bgcolor: { valType: 'color', @@ -141949,6 +143927,14 @@ module.exports = { dflt: colorAttrs.background, editType: 'layoutstyle', + }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + + editType: 'calc', + }, separators: { valType: 'string', @@ -142073,7 +144059,7 @@ module.exports = { } }; -},{"../components/color/attributes":614,"../components/shapes/draw_newshape/attributes":697,"../lib/extend":739,"./animation_attributes":792,"./font_attributes":825,"./pad_attributes":859}],852:[function(_dereq_,module,exports){ +},{"../components/color/attributes":642,"../components/shapes/draw_newshape/attributes":725,"../lib/extend":768,"./animation_attributes":821,"./font_attributes":855,"./pad_attributes":889}],882:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142307,7 +144293,7 @@ module.exports = { } }; -},{}],853:[function(_dereq_,module,exports){ +},{}],883:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142380,7 +144366,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":749}],854:[function(_dereq_,module,exports){ +},{"../../lib":778}],884:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142394,6 +144380,8 @@ module.exports = function convertTextOpts(textposition, iconSize) { var mapboxgl = _dereq_('mapbox-gl'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; +var strScale = Lib.strScale; var getSubplotCalcData = _dereq_('../../plots/get_data').getSubplotCalcData; var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); var d3 = _dereq_('d3'); @@ -142505,7 +144493,7 @@ exports.toSVG = function(gd) { var hidden = subplotDiv.select('.mapboxgl-ctrl-logo').node().offsetParent === null; if(!hidden) { var logo = fullLayout._glimages.append('g'); - logo.attr('transform', 'translate(' + (size.l + size.w * domain.x[0] + 10) + ', ' + (size.t + size.h * (1 - domain.y[0]) - 31) + ')'); + logo.attr('transform', strTranslate(size.l + size.w * domain.x[0] + 10, size.t + size.h * (1 - domain.y[0]) - 31)); logo.append('path') .attr('d', constants.mapboxLogo.path0) .style({ @@ -142565,7 +144553,7 @@ exports.toSVG = function(gd) { bBox = Drawing.bBox(attributionText.node()); } - attributionText.attr('transform', 'translate(-3, ' + (-bBox.height + 8) + ')'); + attributionText.attr('transform', strTranslate(-3, -bBox.height + 8)); // Draw white rectangle behind text attributionGroup @@ -142583,7 +144571,7 @@ exports.toSVG = function(gd) { if((bBox.width + 6) > maxWidth) scaleRatio = maxWidth / (bBox.width + 6); var offset = [(size.l + size.w * domain.x[1]), (size.t + size.h * (1 - domain.y[0]))]; - attributionGroup.attr('transform', 'translate(' + offset[0] + ',' + offset[1] + ') scale(' + scaleRatio + ')'); + attributionGroup.attr('transform', strTranslate(offset[0], offset[1]) + strScale(scaleRatio)); } }; @@ -142665,7 +144653,7 @@ exports.updateFx = function(gd) { } }; -},{"../../components/drawing":637,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/get_data":834,"./constants":852,"./layout_attributes":856,"./layout_defaults":857,"./mapbox":858,"d3":169,"mapbox-gl":447}],855:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/get_data":864,"./constants":882,"./layout_attributes":886,"./layout_defaults":887,"./mapbox":888,"d3":169,"mapbox-gl":473}],885:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -142741,7 +144729,7 @@ proto.needsNewSource = function(opts) { // stay safe and make new source on type changes return ( this.sourceType !== opts.sourcetype || - this.source !== opts.source || + JSON.stringify(this.source) !== JSON.stringify(opts.source) || this.layerType !== opts.type ); }; @@ -142753,11 +144741,23 @@ proto.needsNewLayer = function(opts) { ); }; +proto.lookupBelow = function() { + return this.subplot.belowLookup['layout-' + this.index]; +}; + proto.updateImage = function(opts) { var map = this.subplot.map; map.getSource(this.idSource).updateImage({ url: opts.source, coordinates: opts.coordinates }); + + // Since the `updateImage` control flow doesn't call updateLayer, + // We need to take care of moving the image layer to match the location + // where updateLayer would have placed it. + var _below = this.findFollowingMapboxLayerId(this.lookupBelow()); + if(_below !== null) { + this.subplot.map.moveLayer(this.idLayer, _below); + } }; proto.updateSource = function(opts) { @@ -142775,15 +144775,9 @@ proto.updateSource = function(opts) { map.addSource(this.idSource, sourceOpts); }; -proto.updateLayer = function(opts) { - var subplot = this.subplot; - var convertedOpts = convertOpts(opts); - - var below = this.subplot.belowLookup['layout-' + this.index]; - var _below; - +proto.findFollowingMapboxLayerId = function(below) { if(below === 'traces') { - var mapLayers = subplot.getMapLayers(); + var mapLayers = this.subplot.getMapLayers(); // find id of first plotly trace layer for(var i = 0; i < mapLayers.length; i++) { @@ -142791,13 +144785,19 @@ proto.updateLayer = function(opts) { if(typeof layerId === 'string' && layerId.indexOf(constants.traceLayerPrefix) === 0 ) { - _below = layerId; + below = layerId; break; } } - } else { - _below = below; } + return below; +}; + +proto.updateLayer = function(opts) { + var subplot = this.subplot; + var convertedOpts = convertOpts(opts); + var below = this.lookupBelow(); + var _below = this.findFollowingMapboxLayerId(below); this.removeLayer(); @@ -142962,7 +144962,7 @@ module.exports = function createMapboxLayer(subplot, index, opts) { return mapboxLayer; }; -},{"../../lib":749,"../../lib/svg_text_utils":773,"./constants":852,"./convert_text_opts":853}],856:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/svg_text_utils":802,"./constants":882,"./convert_text_opts":883}],886:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -143199,7 +145199,7 @@ attrs.uirevision = { }; -},{"../../components/color":615,"../../lib":749,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../traces/scatter/attributes":1155,"../domain":824,"../font_attributes":825,"./constants":852}],857:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../traces/scatter/attributes":1186,"../domain":854,"../font_attributes":855,"./constants":882}],887:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -143307,7 +145307,7 @@ function handleLayerDefaults(layerIn, layerOut) { } } -},{"../../lib":749,"../array_container_defaults":793,"../subplot_defaults":874,"./layout_attributes":856}],858:[function(_dereq_,module,exports){ +},{"../../lib":778,"../array_container_defaults":822,"../subplot_defaults":904,"./layout_attributes":886}],888:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -143760,15 +145760,15 @@ proto.initFx = function(calcData, fullLayout) { map.on('mousemove', function(evt) { var bb = self.div.getBoundingClientRect(); - - // some hackery to get Fx.hover to work - evt.clientX = evt.point.x + bb.left; - evt.clientY = evt.point.y + bb.top; + var xy = [ + evt.originalEvent.offsetX, + evt.originalEvent.offsetY + ]; evt.target.getBoundingClientRect = function() { return bb; }; - self.xaxis.p2c = function() { return evt.lngLat.lng; }; - self.yaxis.p2c = function() { return evt.lngLat.lat; }; + self.xaxis.p2c = function() { return map.unproject(xy).lng; }; + self.yaxis.p2c = function() { return map.unproject(xy).lat; }; gd._fullLayout._rehover = function() { if(gd._fullLayout._hoversubplot === self.id && gd._fullLayout[self.id]) { @@ -144118,7 +146118,7 @@ function convertCenter(center) { module.exports = Mapbox; -},{"../../components/dragelement":634,"../../components/dragelement/helpers":633,"../../components/fx":655,"../../lib":749,"../../lib/geo_location_utils":742,"../../registry":880,"../cartesian/axes":797,"../cartesian/select":816,"./constants":852,"./layers":855,"mapbox-gl":447}],859:[function(_dereq_,module,exports){ +},{"../../components/dragelement":662,"../../components/dragelement/helpers":661,"../../components/fx":683,"../../lib":778,"../../lib/geo_location_utils":771,"../../registry":910,"../cartesian/axes":827,"../cartesian/select":846,"./constants":882,"./layers":885,"mapbox-gl":473}],889:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -144173,7 +146173,7 @@ module.exports = function(opts) { }; }; -},{}],860:[function(_dereq_,module,exports){ +},{}],890:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -144843,7 +146843,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -145652,6 +147652,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -146040,6 +148042,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -146057,6 +148062,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -146076,13 +148085,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -146107,6 +148118,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -146121,8 +148137,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -146154,11 +148168,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -146168,11 +148181,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -146182,6 +148194,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -146208,11 +148232,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -146336,7 +148373,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -147236,6 +149286,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -147246,7 +149299,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -147256,27 +149308,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -147285,18 +149338,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -147319,16 +149368,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -147370,12 +149422,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -147384,13 +149432,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } @@ -147512,7 +149561,7 @@ plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullD } }; -},{"../components/color":615,"../constants/numerical":724,"../lib":749,"../plot_api/plot_schema":786,"../plot_api/plot_template":787,"../plots/get_data":834,"../registry":880,"./animation_attributes":792,"./attributes":794,"./cartesian/axis_ids":800,"./cartesian/handle_outline":807,"./command":823,"./font_attributes":825,"./frame_attributes":826,"./layout_attributes":851,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],861:[function(_dereq_,module,exports){ +},{"../components/color":643,"../constants/numerical":753,"../lib":778,"../plot_api/plot_schema":815,"../plot_api/plot_template":816,"../plots/get_data":864,"../registry":910,"./animation_attributes":821,"./attributes":823,"./cartesian/axis_ids":830,"./cartesian/handle_outline":837,"./command":853,"./font_attributes":855,"./frame_attributes":856,"./layout_attributes":881,"d3":169,"d3-time-format":166,"fast-isnumeric":241}],891:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -147557,7 +149606,7 @@ module.exports = { OFFEDGE: 20 }; -},{}],862:[function(_dereq_,module,exports){ +},{}],892:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -147852,7 +149901,7 @@ module.exports = { pathPolygonAnnulus: pathPolygonAnnulus }; -},{"../../lib":749,"../../lib/polygon":761}],863:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/polygon":790}],893:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -147941,7 +149990,7 @@ module.exports = { toSVG: _dereq_('../cartesian').toSVG }; -},{"../../lib":749,"../cartesian":810,"../get_data":834,"./constants":861,"./layout_attributes":864,"./layout_defaults":865,"./polar":872}],864:[function(_dereq_,module,exports){ +},{"../../lib":778,"../cartesian":840,"../get_data":864,"./constants":891,"./layout_attributes":894,"./layout_defaults":895,"./polar":902}],894:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -147991,6 +150040,7 @@ var axisTickAttrs = overrideAll({ ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, @@ -148004,6 +150054,7 @@ var radialAxisAttrs = { type: extendFlat({}, axesAttrs.type, { values: ['-', 'linear', 'log', 'date', 'category'] }), + autotypenumbers: axesAttrs.autotypenumbers, autorange: extendFlat({}, axesAttrs.autorange, {editType: 'plot'}), rangemode: { @@ -148099,6 +150150,7 @@ var angularAxisAttrs = { _noTemplating: true, }, + autotypenumbers: axesAttrs.autotypenumbers, categoryorder: axesAttrs.categoryorder, categoryarray: axesAttrs.categoryarray, @@ -148231,7 +150283,7 @@ module.exports = { editType: 'calc' }; -},{"../../components/color/attributes":614,"../../lib":749,"../../plot_api/edit_types":780,"../cartesian/layout_attributes":811,"../domain":824}],865:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib":778,"../../plot_api/edit_types":809,"../cartesian/layout_attributes":841,"../domain":854}],895:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -148291,7 +150343,7 @@ function handleDefaults(contIn, contOut, coerce, opts) { axOut._traceIndices = subplotData.map(function(t) { return t._expandedIndex; }); var dataAttr = constants.axisName2dataArray[axName]; - var axType = handleAxisTypeDefaults(axIn, axOut, coerceAxis, subplotData, dataAttr); + var axType = handleAxisTypeDefaults(axIn, axOut, coerceAxis, subplotData, dataAttr, opts); handleCategoryOrderDefaults(axIn, axOut, coerceAxis, { axData: subplotData, @@ -148421,7 +150473,8 @@ function handleDefaults(contIn, contOut, coerce, opts) { } } -function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr) { +function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr, options) { + var autotypenumbers = coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type'); if(axType === '-') { @@ -148435,7 +150488,10 @@ function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr) { } if(trace && trace[dataAttr]) { - axOut.type = autoType(trace[dataAttr], 'gregorian'); + axOut.type = autoType(trace[dataAttr], 'gregorian', { + noMultiCategory: true, + autotypenumbers: autotypenumbers + }); } if(axOut.type === '-') { @@ -148458,13 +150514,14 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { attributes: layoutAttributes, handleDefaults: handleDefaults, font: layoutOut.font, + autotypenumbersDflt: layoutOut.autotypenumbers, paper_bgcolor: layoutOut.paper_bgcolor, fullData: fullData, layoutOut: layoutOut }); }; -},{"../../components/color":615,"../../lib":749,"../../plot_api/plot_template":787,"../cartesian/axis_autotype":798,"../cartesian/category_order_defaults":801,"../cartesian/line_grid_defaults":813,"../cartesian/tick_label_defaults":818,"../cartesian/tick_mark_defaults":819,"../cartesian/tick_value_defaults":820,"../get_data":834,"../subplot_defaults":874,"./constants":861,"./layout_attributes":864,"./set_convert":873}],866:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plot_api/plot_template":816,"../cartesian/axis_autotype":828,"../cartesian/category_order_defaults":831,"../cartesian/line_grid_defaults":843,"../cartesian/tick_label_defaults":848,"../cartesian/tick_mark_defaults":849,"../cartesian/tick_value_defaults":850,"../get_data":864,"../subplot_defaults":904,"./constants":891,"./layout_attributes":894,"./set_convert":903}],896:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -148508,7 +150565,7 @@ module.exports = { } }; -},{"../../../lib/extend":739,"../../../traces/scatter/attributes":1155}],867:[function(_dereq_,module,exports){ +},{"../../../lib/extend":768,"../../../traces/scatter/attributes":1186}],897:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -148630,7 +150687,7 @@ module.exports = overrideAll({ } }, 'plot', 'nested'); -},{"../../../lib/extend":739,"../../../plot_api/edit_types":780,"../../cartesian/layout_attributes":811}],868:[function(_dereq_,module,exports){ +},{"../../../lib/extend":768,"../../../plot_api/edit_types":809,"../../cartesian/layout_attributes":841}],898:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -148645,7 +150702,7 @@ var Polar = module.exports = _dereq_('./micropolar'); Polar.manager = _dereq_('./micropolar_manager'); -},{"./micropolar":869,"./micropolar_manager":870}],869:[function(_dereq_,module,exports){ +},{"./micropolar":899,"./micropolar_manager":900}],899:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150065,7 +152122,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../../constants/alignment":717,"../../../lib":749,"d3":169}],870:[function(_dereq_,module,exports){ +},{"../../../constants/alignment":745,"../../../lib":778,"d3":169}],900:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150151,7 +152208,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../../components/color":615,"../../../lib":749,"./micropolar":869,"./undo_manager":871,"d3":169}],871:[function(_dereq_,module,exports){ +},{"../../../components/color":643,"../../../lib":778,"./micropolar":899,"./undo_manager":901,"d3":169}],901:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150217,7 +152274,7 @@ module.exports = function UndoManager() { }; }; -},{}],872:[function(_dereq_,module,exports){ +},{}],902:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -150233,6 +152290,8 @@ var tinycolor = _dereq_('tinycolor2'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Plots = _dereq_('../plots'); @@ -150599,7 +152658,7 @@ proto.updateRadialAxis = function(fullLayout, polarLayout) { // easier to set rotate angle with custom translate function var transFn = function(d) { - return 'translate(' + (ax.l2p(d.x) + innerRadius) + ',0)'; + return strTranslate(ax.l2p(d.x) + innerRadius, 0); }; // set special grid path function @@ -150898,6 +152957,9 @@ proto.updateMainDrag = function(fullLayout) { var chw = constants.cornerHalfWidth; var chl = constants.cornerLen / 2; + var scaleX; + var scaleY; + var mainDrag = dragBox.makeDragger(layers, 'path', 'maindrag', 'crosshair'); d3.select(mainDrag) @@ -151057,8 +153119,12 @@ proto.updateMainDrag = function(fullLayout) { } function zoomMove(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; + var x1 = x0 + dx; var y1 = y0 + dy; + var rr0 = xy2r(x0, y0); var rr1 = Math.min(xy2r(x1, y1), radius); var a0 = xy2a(x0, y0); @@ -151154,8 +153220,13 @@ proto.updateMainDrag = function(fullLayout) { var dragModeNow = gd._fullLayout.dragmode; var bbox = mainDrag.getBoundingClientRect(); - x0 = startX - bbox.left; - y0 = startY - bbox.top; + gd._fullLayout._calcInverseTransform(gd); + var inverse = gd._fullLayout._invTransform; + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + var transformedCoords = Lib.apply3DTransform(inverse)(startX - bbox.left, startY - bbox.top); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; // need to offset x/y as bbox center does not // match origin for asymmetric polygons @@ -151407,8 +153478,8 @@ proto.updateAngularDrag = function(fullLayout) { var fullLayoutNow = _this.gd._fullLayout; var polarLayoutNow = fullLayoutNow[_this.id]; - var x1 = x0 + dx; - var y1 = y0 + dy; + var x1 = x0 + dx * fullLayout._invScaleX; + var y1 = y0 + dy * fullLayout._invScaleY; var a1 = xy2a(x1, y1); var da = rad2deg(a1 - a0); rot1 = rot0 + da; @@ -151501,6 +153572,12 @@ proto.updateAngularDrag = function(fullLayout) { var bbox = angularDrag.getBoundingClientRect(); x0 = startX - bbox.left; y0 = startY - bbox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + a0 = xy2a(x0, y0); dragOpts.moveFn = moveFn; @@ -151640,15 +153717,7 @@ function updateElement(sel, showAttr, attrs) { return sel; } -function strTranslate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - -function strRotate(angle) { - return 'rotate(' + angle + ')'; -} - -},{"../../components/color":615,"../../components/dragelement":634,"../../components/drawing":637,"../../components/fx":655,"../../components/titles":710,"../../constants/alignment":717,"../../lib":749,"../../lib/clear_gl_canvases":733,"../../lib/setcursor":769,"../../plot_api/subroutines":788,"../../plots/cartesian/axes":797,"../../registry":880,"../cartesian/autorange":796,"../cartesian/dragbox":805,"../cartesian/select":816,"../cartesian/set_convert":817,"../plots":860,"./constants":861,"./helpers":862,"./set_convert":873,"d3":169,"tinycolor2":548}],873:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement":662,"../../components/drawing":665,"../../components/fx":683,"../../components/titles":738,"../../constants/alignment":745,"../../lib":778,"../../lib/clear_gl_canvases":762,"../../lib/setcursor":798,"../../plot_api/subroutines":817,"../../plots/cartesian/axes":827,"../../registry":910,"../cartesian/autorange":826,"../cartesian/dragbox":835,"../cartesian/select":846,"../cartesian/set_convert":847,"../plots":890,"./constants":891,"./helpers":892,"./set_convert":903,"d3":169,"tinycolor2":576}],903:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -151843,7 +153912,7 @@ function setConvertAngular(ax, polarLayout) { }; } -},{"../../lib":749,"../cartesian/set_convert":817}],874:[function(_dereq_,module,exports){ +},{"../../lib":778,"../cartesian/set_convert":847}],904:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -151928,7 +153997,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":749,"../plot_api/plot_template":787,"./domain":824}],875:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/plot_template":816,"./domain":854}],905:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152011,7 +154080,7 @@ exports.texttemplateAttrs = function(opts, extra) { return texttemplate; }; -},{"../constants/docs":719}],876:[function(_dereq_,module,exports){ +},{"../constants/docs":748}],906:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152095,7 +154164,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../lib":749,"../../plots/get_data":834,"./layout_attributes":877,"./layout_defaults":878,"./ternary":879}],877:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/get_data":864,"./layout_attributes":907,"./layout_defaults":908,"./ternary":909}],907:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152138,6 +154207,7 @@ var ternaryAxesAttrs = { ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, @@ -152202,7 +154272,7 @@ attrs.aaxis.uirevision = attrs.baxis.uirevision = attrs.caxis.uirevision = { }; -},{"../../components/color/attributes":614,"../../lib/extend":739,"../../plot_api/edit_types":780,"../cartesian/layout_attributes":811,"../domain":824}],878:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib/extend":768,"../../plot_api/edit_types":809,"../cartesian/layout_attributes":841,"../domain":854}],908:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152334,7 +154404,7 @@ function handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut coerce('layer'); } -},{"../../components/color":615,"../../lib":749,"../../plot_api/plot_template":787,"../cartesian/line_grid_defaults":813,"../cartesian/tick_label_defaults":818,"../cartesian/tick_mark_defaults":819,"../cartesian/tick_value_defaults":820,"../subplot_defaults":874,"./layout_attributes":877}],879:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plot_api/plot_template":816,"../cartesian/line_grid_defaults":843,"../cartesian/tick_label_defaults":848,"../cartesian/tick_mark_defaults":849,"../cartesian/tick_value_defaults":850,"../subplot_defaults":904,"./layout_attributes":907}],909:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -152351,6 +154421,7 @@ var tinycolor = _dereq_('tinycolor2'); var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var _ = Lib._; var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); @@ -152638,7 +154709,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { var triangleClipRelative = 'M0,' + h + 'h' + w + 'l-' + (w / 2) + ',-' + h + 'Z'; _this.clipDefRelative.select('path').attr('d', triangleClipRelative); - var plotTransform = 'translate(' + x0 + ',' + y0 + ')'; + var plotTransform = strTranslate(x0, y0); _this.plotContainer.selectAll('.scatterlayer,.maplayer') .attr('transform', plotTransform); @@ -152647,18 +154718,18 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { // TODO: shift axes to accommodate linewidth*sin(30) tick mark angle // TODO: there's probably an easier way to handle these translations/offsets now... - var bTransform = 'translate(' + (x0 - baxis._offset) + ',' + (y0 + h) + ')'; + var bTransform = strTranslate(x0 - baxis._offset, y0 + h); _this.layers.baxis.attr('transform', bTransform); _this.layers.bgrid.attr('transform', bTransform); - var aTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(30)translate(0,' + -aaxis._offset + ')'; + var aTransform = strTranslate(x0 + w / 2, y0) + + 'rotate(30)' + strTranslate(0, -aaxis._offset); _this.layers.aaxis.attr('transform', aTransform); _this.layers.agrid.attr('transform', aTransform); - var cTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(-30)translate(0,' + -caxis._offset + ')'; + var cTransform = strTranslate(x0 + w / 2, y0) + + 'rotate(-30)' + strTranslate(0, -caxis._offset); _this.layers.caxis.attr('transform', cTransform); _this.layers.cgrid.attr('transform', cTransform); @@ -152764,7 +154835,7 @@ proto.drawAx = function(ax) { var vals = Axes.calcTicks(ax); var valsClipped = Axes.clipEnds(ax, vals); - var transFn = Axes.makeTransFn(ax); + var transFn = Axes.makeTransTickFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; var caRad = Lib.deg2rad(counterAngle); @@ -152839,6 +154910,8 @@ proto.initInteractions = function() { var dragger = _this.layers.plotbg.select('path').node(); var gd = _this.graphDiv; var zoomLayer = gd._fullLayout._zoomlayer; + var scaleX; + var scaleY; // use plotbg for the main interactions this.dragOptions = { @@ -152857,6 +154930,9 @@ proto.initInteractions = function() { _this.dragOptions.xaxes = [_this.xaxis]; _this.dragOptions.yaxes = [_this.yaxis]; + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + var dragModeNow = _this.dragOptions.dragmode = gd._fullLayout.dragmode; if(freeMode(dragModeNow)) _this.dragOptions.minDrag = 1; @@ -152912,6 +154988,13 @@ proto.initInteractions = function() { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var inverse = gd._fullLayout._invTransform; + var transformedCoords = Lib.apply3DTransform(inverse)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + mins0 = { a: _this.aaxis.range[0], b: _this.baxis.range[1], @@ -152925,7 +155008,7 @@ proto.initInteractions = function() { zb = zoomLayer.append('path') .attr('class', 'zoombox') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') + .attr('transform', strTranslate(_this.x0, _this.y0)) .style({ 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 @@ -152934,7 +155017,7 @@ proto.initInteractions = function() { corners = zoomLayer.append('path') .attr('class', 'zoombox-corners') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') + .attr('transform', strTranslate(_this.x0, _this.y0)) .style({ fill: Color.background, stroke: Color.defaultLine, @@ -152951,8 +155034,8 @@ proto.initInteractions = function() { function getCFrac(x, y) { return ((x - (_this.h - y) / Math.sqrt(3)) / _this.w); } function zoomMove(dx0, dy0) { - var x1 = x0 + dx0; - var y1 = y0 + dy0; + var x1 = x0 + dx0 * scaleX; + var y1 = y0 + dy0 * scaleY; var afrac = Math.max(0, Math.min(1, getAFrac(x0, y0), getAFrac(x1, y1))); var bfrac = Math.max(0, Math.min(1, getBFrac(x0, y0), getBFrac(x1, y1))); var cfrac = Math.max(0, Math.min(1, getCFrac(x0, y0), getCFrac(x1, y1))); @@ -153051,11 +155134,11 @@ proto.initInteractions = function() { } // move the data (translate, don't redraw) - var plotTransform = 'translate(' + (_this.x0 + dx) + ',' + (_this.y0 + dy) + ')'; + var plotTransform = strTranslate(_this.x0 + dx, _this.y0 + dy); _this.plotContainer.selectAll('.scatterlayer,.maplayer') .attr('transform', plotTransform); - var plotTransform2 = 'translate(' + -dx + ',' + -dy + ')'; + var plotTransform2 = strTranslate(-dx, -dy); _this.clipDefRelative.select('path').attr('transform', plotTransform2); // move the ticks @@ -153102,7 +155185,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":615,"../../components/dragelement":634,"../../components/dragelement/helpers":633,"../../components/drawing":637,"../../components/fx":655,"../../components/titles":710,"../../lib":749,"../../lib/extend":739,"../../registry":880,"../cartesian/axes":797,"../cartesian/constants":803,"../cartesian/select":816,"../cartesian/set_convert":817,"../plots":860,"d3":169,"tinycolor2":548}],880:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/dragelement":662,"../../components/dragelement/helpers":661,"../../components/drawing":665,"../../components/fx":683,"../../components/titles":738,"../../lib":778,"../../lib/extend":768,"../../registry":910,"../cartesian/axes":827,"../cartesian/constants":833,"../cartesian/select":846,"../cartesian/set_convert":847,"../plots":890,"d3":169,"tinycolor2":576}],910:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -153568,7 +155651,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/dom":737,"./lib/extend":739,"./lib/is_plain_object":750,"./lib/loggers":753,"./lib/noop":758,"./lib/push_unique":763,"./plots/attributes":794,"./plots/layout_attributes":851}],881:[function(_dereq_,module,exports){ +},{"./lib/dom":766,"./lib/extend":768,"./lib/is_plain_object":779,"./lib/loggers":782,"./lib/noop":787,"./lib/push_unique":792,"./plots/attributes":823,"./plots/layout_attributes":881}],911:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -153741,7 +155824,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":749,"../registry":880}],882:[function(_dereq_,module,exports){ +},{"../lib":778,"../registry":910}],912:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -153775,6 +155858,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { @@ -153811,7 +155896,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":749,"../plot_api/to_image":790,"./filesaver":883,"./helpers":884}],883:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/to_image":819,"./filesaver":913,"./helpers":914}],913:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -153891,7 +155976,7 @@ function fileSaver(url, name, format) { module.exports = fileSaver; -},{"../lib":749,"./helpers":884}],884:[function(_dereq_,module,exports){ +},{"../lib":778,"./helpers":914}],914:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -153974,7 +156059,7 @@ exports.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\'svg\'} instead.'; -},{"../registry":880}],885:[function(_dereq_,module,exports){ +},{"../registry":910}],915:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154000,7 +156085,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":881,"./download":882,"./helpers":884,"./svgtoimg":886,"./toimage":887,"./tosvg":888}],886:[function(_dereq_,module,exports){ +},{"./cloneplot":911,"./download":912,"./helpers":914,"./svgtoimg":916,"./toimage":917,"./tosvg":918}],916:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154127,7 +156212,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":749,"./helpers":884,"events":110}],887:[function(_dereq_,module,exports){ +},{"../lib":778,"./helpers":914,"events":110}],917:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154204,7 +156289,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":749,"../registry":880,"./cloneplot":881,"./helpers":884,"./svgtoimg":886,"./tosvg":888,"events":110}],888:[function(_dereq_,module,exports){ +},{"../lib":778,"../registry":910,"./cloneplot":911,"./helpers":914,"./svgtoimg":916,"./tosvg":918,"events":110}],918:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154393,7 +156478,7 @@ module.exports = function toSVG(gd, format, scale) { return s; }; -},{"../components/color":615,"../components/drawing":637,"../constants/xmlns_namespaces":725,"../lib":749,"d3":169}],889:[function(_dereq_,module,exports){ +},{"../components/color":643,"../components/drawing":665,"../constants/xmlns_namespaces":754,"../lib":778,"d3":169}],919:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154426,7 +156511,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":749}],890:[function(_dereq_,module,exports){ +},{"../../lib":778}],920:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154488,6 +156573,13 @@ module.exports = { y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, texttemplate: texttemplateAttrs({editType: 'plot'}, { keys: constants.eventDataKeys @@ -154635,7 +156727,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/font_attributes":825,"../../plots/template_attributes":875,"../scatter/attributes":1155,"./constants":892}],891:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/font_attributes":855,"../../plots/template_attributes":905,"../scatter/attributes":1186,"./constants":922}],921:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154647,6 +156739,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale; var colorscaleCalc = _dereq_('../../components/colorscale/calc'); var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); @@ -154655,18 +156748,23 @@ var calcSelection = _dereq_('../scatter/calc_selection'); module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; var sizeOpts = { msUTC: !!(trace.base || trace.base === 0) }; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x', sizeOpts); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y', sizeOpts); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -154677,6 +156775,10 @@ module.exports = function calc(gd, trace) { for(var i = 0; i < serieslen; i++) { cd[i] = { p: pos[i], s: size[i] }; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cd[i].id = String(trace.ids[i]); } @@ -154704,7 +156806,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":623,"../../components/colorscale/helpers":626,"../../plots/cartesian/axes":797,"../scatter/calc_selection":1157,"./arrays_to_calcdata":889}],892:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../components/colorscale/helpers":654,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../scatter/calc_selection":1188,"./arrays_to_calcdata":919}],922:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154726,7 +156828,7 @@ module.exports = { eventDataKeys: ['value', 'label'] }; -},{}],893:[function(_dereq_,module,exports){ +},{}],923:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -154743,7 +156845,7 @@ var BADNUM = _dereq_('../../constants/numerical').BADNUM; var Registry = _dereq_('../../registry'); var Axes = _dereq_('../../plots/cartesian/axes'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var Sieve = _dereq_('./sieve.js'); /* @@ -155506,7 +157608,7 @@ module.exports = { setGroupPositions: setGroupPositions }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_ids":800,"../../registry":880,"./sieve.js":903,"fast-isnumeric":241}],894:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axes":827,"../../plots/cartesian/constraints":834,"../../registry":910,"./sieve.js":933,"fast-isnumeric":241}],924:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -155522,8 +157624,9 @@ var Color = _dereq_('../../components/color'); var Registry = _dereq_('../../registry'); var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var attributes = _dereq_('./attributes'); var coerceFont = Lib.coerceFont; @@ -155539,6 +157642,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); coerce('base'); coerce('offset'); @@ -155688,7 +157793,7 @@ module.exports = { handleText: handleText }; -},{"../../components/color":615,"../../lib":749,"../../plots/cartesian/axis_ids":800,"../../registry":880,"../scatter/xy_defaults":1181,"./attributes":890,"./style_defaults":905}],895:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plots/cartesian/constraints":834,"../../registry":910,"../scatter/period_defaults":1206,"../scatter/xy_defaults":1213,"./attributes":920,"./style_defaults":935}],925:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -155717,7 +157822,7 @@ module.exports = function eventData(out, pt, trace) { return out; }; -},{}],896:[function(_dereq_,module,exports){ +},{}],926:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -155795,7 +157900,7 @@ exports.getLineWidth = function(trace, di) { return w; }; -},{"../../lib":749,"fast-isnumeric":241,"tinycolor2":548}],897:[function(_dereq_,module,exports){ +},{"../../lib":778,"fast-isnumeric":241,"tinycolor2":576}],927:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -155956,10 +158061,13 @@ function hoverOnBars(pointData, xval, yval, hovermode) { var extent = t.extents[t.extents.round(di.p)]; pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true); pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true); - pointData[posLetter + 'LabelVal'] = di.p; + + var hasPeriod = di.orig_p !== undefined; + pointData[posLetter + 'LabelVal'] = hasPeriod ? di.orig_p : di.p; pointData.labelLabel = hoverLabelText(pa, pointData[posLetter + 'LabelVal']); pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + 'LabelVal']); + pointData.baseLabel = hoverLabelText(sa, di.b); // spikelines always want "closest" distance regardless of hovermode pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 - maxHoverDistance; @@ -155988,7 +158096,7 @@ module.exports = { getTraceColor: getTraceColor }; -},{"../../components/color":615,"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"./helpers":896}],898:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"./helpers":926}],928:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156026,7 +158134,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../scatter/marker_colorbar":1173,"./arrays_to_calcdata":889,"./attributes":890,"./calc":891,"./cross_trace_calc":893,"./defaults":894,"./event_data":895,"./hover":897,"./layout_attributes":899,"./layout_defaults":900,"./plot":901,"./select":902,"./style":904}],899:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../scatter/marker_colorbar":1204,"./arrays_to_calcdata":919,"./attributes":920,"./calc":921,"./cross_trace_calc":923,"./defaults":924,"./event_data":925,"./hover":927,"./layout_attributes":929,"./layout_defaults":930,"./plot":931,"./select":932,"./style":934}],929:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156074,7 +158182,7 @@ module.exports = { } }; -},{}],900:[function(_dereq_,module,exports){ +},{}],930:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156134,7 +158242,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"./layout_attributes":899}],901:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"./layout_attributes":929}],931:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156379,7 +158487,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback); sel .style('vector-effect', 'non-scaling-stroke') - .attr('d', isNaN((x1 - x0) * (y1 - y0)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') + .attr('d', (isNaN((x1 - x0) * (y1 - y0)) || (isBlank && gd._context.staticPlot)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') .call(Drawing.setClipUrl, plotinfo.layerClipId, gd); if(!fullLayout.uniformtext.mode && withTransition) { @@ -156919,7 +159027,7 @@ module.exports = { toMoveInsideBar: toMoveInsideBar }; -},{"../../components/color":615,"../../components/drawing":637,"../../components/fx/helpers":651,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../registry":880,"./attributes":890,"./constants":892,"./helpers":896,"./style":904,"./uniform_text":906,"d3":169,"fast-isnumeric":241}],902:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../components/fx/helpers":679,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../registry":910,"./attributes":920,"./constants":922,"./helpers":926,"./style":934,"./uniform_text":936,"d3":169,"fast-isnumeric":241}],932:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -156983,7 +159091,7 @@ function getCentroid(d, xa, ya, isHorizontal, isFunnel) { } } -},{}],903:[function(_dereq_,module,exports){ +},{}],933:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157097,7 +159205,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":724,"../../lib":749}],904:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778}],934:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157279,7 +159387,7 @@ module.exports = { resizeText: resizeText }; -},{"../../components/color":615,"../../components/drawing":637,"../../lib":749,"../../registry":880,"./attributes":890,"./helpers":896,"./uniform_text":906,"d3":169}],905:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../lib":778,"../../registry":910,"./attributes":920,"./helpers":926,"./uniform_text":936,"d3":169}],935:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157317,7 +159425,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('unselected.marker.color'); }; -},{"../../components/color":615,"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626}],906:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654}],936:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157403,7 +159511,7 @@ module.exports = { resizeText: resizeText }; -},{"../../lib":749,"d3":169}],907:[function(_dereq_,module,exports){ +},{"../../lib":778,"d3":169}],937:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157472,7 +159580,7 @@ module.exports = { // error_y }; -},{"../../lib/extend":739,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatterpolar/attributes":1228}],908:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatterpolar/attributes":1260}],938:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157584,7 +159692,7 @@ module.exports = { crossTraceCalc: crossTraceCalc }; -},{"../../components/colorscale/calc":623,"../../components/colorscale/helpers":626,"../../lib":749,"../../registry":880,"../bar/arrays_to_calcdata":889,"../bar/cross_trace_calc":893,"../scatter/calc_selection":1157}],909:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../components/colorscale/helpers":654,"../../lib":778,"../../registry":910,"../bar/arrays_to_calcdata":919,"../bar/cross_trace_calc":923,"../scatter/calc_selection":1188}],939:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157643,7 +159751,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../bar/style_defaults":905,"../scatterpolar/defaults":1230,"./attributes":907}],910:[function(_dereq_,module,exports){ +},{"../../lib":778,"../bar/style_defaults":935,"../scatterpolar/defaults":1262,"./attributes":937}],940:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157718,7 +159826,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { return [pointData]; }; -},{"../../components/fx":655,"../../lib":749,"../../plots/polar/helpers":862,"../bar/hover":897,"../scatterpolar/hover":1232}],911:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../lib":778,"../../plots/polar/helpers":892,"../bar/hover":927,"../scatterpolar/hover":1264}],941:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157759,7 +159867,7 @@ module.exports = { } }; -},{"../../plots/polar":863,"../bar/select":902,"../bar/style":904,"../scatter/marker_colorbar":1173,"../scatterpolar/format_labels":1231,"./attributes":907,"./calc":908,"./defaults":909,"./hover":910,"./layout_attributes":912,"./layout_defaults":913,"./plot":914}],912:[function(_dereq_,module,exports){ +},{"../../plots/polar":893,"../bar/select":932,"../bar/style":934,"../scatter/marker_colorbar":1204,"../scatterpolar/format_labels":1263,"./attributes":937,"./calc":938,"./defaults":939,"./hover":940,"./layout_attributes":942,"./layout_defaults":943,"./plot":944}],942:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157790,7 +159898,7 @@ module.exports = { } }; -},{}],913:[function(_dereq_,module,exports){ +},{}],943:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157825,7 +159933,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":749,"./layout_attributes":912}],914:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":942}],944:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157933,7 +160041,7 @@ function makePathFn(subplot) { }; } -},{"../../components/drawing":637,"../../lib":749,"../../plots/polar/helpers":862,"d3":169,"fast-isnumeric":241}],915:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../plots/polar/helpers":892,"d3":169,"fast-isnumeric":241}],945:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -157990,6 +160098,13 @@ module.exports = { }, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + name: { valType: 'string', @@ -158229,7 +160344,7 @@ module.exports = { } }; -},{"../../components/color/attributes":614,"../../lib/extend":739,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatter/attributes":1155}],916:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib/extend":768,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatter/attributes":1186}],946:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158243,6 +160358,7 @@ module.exports = { var isNumeric = _dereq_('fast-isnumeric'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -158261,19 +160377,24 @@ module.exports = function calc(gd, trace) { var valAxis, valLetter; var posAxis, posLetter; + var hasPeriod; if(trace.orientation === 'h') { valAxis = xa; valLetter = 'x'; posAxis = ya; posLetter = 'y'; + hasPeriod = !!trace.yperiodalignment; } else { valAxis = ya; valLetter = 'y'; posAxis = xa; posLetter = 'x'; + hasPeriod = !!trace.xperiodalignment; } - var posArray = getPos(trace, posLetter, posAxis, fullLayout[numKey]); + var allPosArrays = getPosArrays(trace, posLetter, posAxis, fullLayout[numKey]); + var posArray = allPosArrays[0]; + var origPos = allPosArrays[1]; var dv = Lib.distinctVals(posArray); var posDistinct = dv.vals; var dPos = dv.minDiff / 2; @@ -158309,6 +160430,9 @@ module.exports = function calc(gd, trace) { cdi = {}; cdi.pos = cdi[posLetter] = posi; + if(hasPeriod && origPos) { + cdi.orig_p = origPos[i]; // used by hover + } cdi.q1 = d2c('q1'); cdi.med = d2c('median'); @@ -158535,13 +160659,15 @@ module.exports = function calc(gd, trace) { // so if you want one box // per trace, set x0 (y0) to the x (y) value or category for this trace // (or set x (y) to a constant array matching y (x)) -function getPos(trace, posLetter, posAxis, num) { +function getPosArrays(trace, posLetter, posAxis, num) { var hasPosArray = posLetter in trace; var hasPos0 = posLetter + '0' in trace; var hasPosStep = 'd' + posLetter in trace; if(hasPosArray || (hasPos0 && hasPosStep)) { - return posAxis.makeCalcdata(trace, posLetter); + var origPos = posAxis.makeCalcdata(trace, posLetter); + var pos = alignPeriod(trace, posAxis, posLetter, origPos); + return [pos, origPos]; } var pos0; @@ -158569,7 +160695,7 @@ function getPos(trace, posLetter, posAxis, num) { var out = new Array(len); for(var i = 0; i < len; i++) out[i] = pos0c; - return out; + return [out]; } function makeBins(x, dx) { @@ -158672,7 +160798,7 @@ function computeNotchSpan(cdi, N) { return 1.57 * (cdi.q3 - cdi.q1) / Math.sqrt(N); } -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"fast-isnumeric":241}],917:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"fast-isnumeric":241}],947:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158685,7 +160811,7 @@ function computeNotchSpan(cdi, N) { var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); -var getAxisGroup = _dereq_('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var orientations = ['v', 'h']; @@ -158904,7 +161030,7 @@ module.exports = { setPositionOffset: setPositionOffset }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_ids":800}],918:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../../plots/cartesian/constraints":834}],948:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -158918,6 +161044,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var Registry = _dereq_('../../registry'); var Color = _dereq_('../../components/color'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var autoType = _dereq_('../../plots/cartesian/axis_autotype'); var attributes = _dereq_('./attributes'); @@ -158930,6 +161057,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { handleSampleDefaults(traceIn, traceOut, coerce, layout); if(traceOut.visible === false) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var hasPreCompStats = traceOut._hasPreCompStats; if(hasPreCompStats) { @@ -159013,6 +161142,11 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { var yLen = yDims && Lib.minRowLength(y); var xLen = xDims && Lib.minRowLength(x); + var calendar = layout.calendar; + var opts = { + autotypenumbers: layout.autotypenumbers + }; + var defaultOrientation, len; if(traceOut._hasPreCompStats) { switch(String(xDims) + String(yDims)) { @@ -159064,7 +161198,7 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { var hasCategories = false; var i; for(i = 0; i < x.length; i++) { - if(autoType(x[i]) === 'category') { + if(autoType(x[i], calendar, opts) === 'category') { hasCategories = true; break; } @@ -159075,7 +161209,7 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { len = Math.min(sLen, xLen, y.length); } else { for(i = 0; i < y.length; i++) { - if(autoType(y[i]) === 'category') { + if(autoType(y[i], calendar, opts) === 'category') { hasCategories = true; break; } @@ -159212,7 +161346,7 @@ module.exports = { handlePointsDefaults: handlePointsDefaults }; -},{"../../components/color":615,"../../lib":749,"../../plots/cartesian/axis_autotype":798,"../../registry":880,"../bar/defaults":894,"./attributes":915}],919:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plots/cartesian/axis_autotype":828,"../../registry":910,"../bar/defaults":924,"../scatter/period_defaults":1206,"./attributes":945}],949:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159237,7 +161371,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],920:[function(_dereq_,module,exports){ +},{}],950:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159383,7 +161517,7 @@ function hoverOnBoxes(pointData, xval, yval, hovermode) { pointData[pLetter + '0'] = pAxis.c2p(di.pos + t.bPos - boxDeltaNeg, true); pointData[pLetter + '1'] = pAxis.c2p(di.pos + t.bPos + boxDeltaPos, true); - pointData[pLetter + 'LabelVal'] = di.pos; + pointData[pLetter + 'LabelVal'] = di.orig_p !== undefined ? di.orig_p : di.pos; var spikePosAttr = pLetter + 'Spike'; pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; @@ -159497,14 +161631,16 @@ function hoverOnPoints(pointData, xval, yval) { hovertemplate: trace.hovertemplate }); + var origPos = di.orig_p; + var pos = origPos !== undefined ? origPos : di.pos; var pa; if(trace.orientation === 'h') { pa = ya; closePtData.xLabelVal = pt.x; - closePtData.yLabelVal = di.pos; + closePtData.yLabelVal = pos; } else { pa = xa; - closePtData.xLabelVal = di.pos; + closePtData.xLabelVal = pos; closePtData.yLabelVal = pt.y; } @@ -159522,7 +161658,7 @@ module.exports = { hoverOnPoints: hoverOnPoints }; -},{"../../components/color":615,"../../components/fx":655,"../../lib":749,"../../plots/cartesian/axes":797}],921:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../lib":778,"../../plots/cartesian/axes":827}],951:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159557,7 +161693,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":915,"./calc":916,"./cross_trace_calc":917,"./defaults":918,"./event_data":919,"./hover":920,"./layout_attributes":922,"./layout_defaults":923,"./plot":924,"./select":925,"./style":926}],922:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":945,"./calc":946,"./cross_trace_calc":947,"./defaults":948,"./event_data":949,"./hover":950,"./layout_attributes":952,"./layout_defaults":953,"./plot":954,"./select":955,"./style":956}],952:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159598,7 +161734,7 @@ module.exports = { } }; -},{}],923:[function(_dereq_,module,exports){ +},{}],953:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159644,7 +161780,7 @@ module.exports = { _supply: _supply }; -},{"../../lib":749,"../../registry":880,"./layout_attributes":922}],924:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"./layout_attributes":952}],954:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -159994,7 +162130,7 @@ module.exports = { plotBoxMean: plotBoxMean }; -},{"../../components/drawing":637,"../../lib":749,"d3":169}],925:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"d3":169}],955:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160043,7 +162179,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],926:[function(_dereq_,module,exports){ +},{}],956:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160117,7 +162253,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/color":615,"../../components/drawing":637,"d3":169}],927:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"d3":169}],957:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160147,6 +162283,10 @@ function directionAttrs(lineColorDefault) { } module.exports = { + xperiod: OHLCattrs.xperiod, + xperiod0: OHLCattrs.xperiod0, + xperiodalignment: OHLCattrs.xperiodalignment, + x: OHLCattrs.x, open: OHLCattrs.open, high: OHLCattrs.high, @@ -160171,7 +162311,7 @@ module.exports = { hoverlabel: OHLCattrs.hoverlabel, }; -},{"../../lib":749,"../box/attributes":915,"../ohlc/attributes":1101}],928:[function(_dereq_,module,exports){ +},{"../../lib":778,"../box/attributes":945,"../ohlc/attributes":1132}],958:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160184,6 +162324,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var calcCommon = _dereq_('../ohlc/calc').calcCommon; @@ -160192,9 +162333,10 @@ module.exports = function(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis); var ya = Axes.getFromId(gd, trace.yaxis); - var x = xa.makeCalcdata(trace, 'x'); + var origX = xa.makeCalcdata(trace, 'x'); + var x = alignPeriod(trace, xa, 'x', origX); - var cd = calcCommon(gd, trace, x, ya, ptFunc); + var cd = calcCommon(gd, trace, origX, x, ya, ptFunc); if(cd.length) { Lib.extendFlat(cd[0].t, { @@ -160221,7 +162363,7 @@ function ptFunc(o, h, l, c) { }; } -},{"../../lib":749,"../../plots/cartesian/axes":797,"../ohlc/calc":1102}],929:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../ohlc/calc":1133}],959:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160236,6 +162378,7 @@ function ptFunc(o, h, l, c) { var Lib = _dereq_('../../lib'); var Color = _dereq_('../../components/color'); var handleOHLC = _dereq_('../ohlc/ohlc_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -160249,6 +162392,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce, {x: true}); + coerce('line.width'); handleDirection(traceIn, traceOut, coerce, 'increasing'); @@ -160267,7 +162412,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor', Color.addOpacity(lineColor, 0.5)); } -},{"../../components/color":615,"../../lib":749,"../ohlc/ohlc_defaults":1106,"./attributes":927}],930:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../ohlc/ohlc_defaults":1137,"../scatter/period_defaults":1206,"./attributes":957}],960:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160300,7 +162445,7 @@ module.exports = { selectPoints: _dereq_('../ohlc/select') }; -},{"../../plots/cartesian":810,"../box/cross_trace_calc":917,"../box/layout_attributes":922,"../box/layout_defaults":923,"../box/plot":924,"../box/style":926,"../ohlc/hover":1104,"../ohlc/select":1108,"./attributes":927,"./calc":928,"./defaults":929}],931:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../box/cross_trace_calc":947,"../box/layout_attributes":952,"../box/layout_defaults":953,"../box/plot":954,"../box/style":956,"../ohlc/hover":1135,"../ohlc/select":1139,"./attributes":957,"./calc":958,"./defaults":959}],961:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160350,6 +162495,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) { calendar: traceOut.calendar, dfltColor: dfltColor, bgColor: fullLayout.paper_bgcolor, + autotypenumbersDflt: fullLayout.autotypenumbers, fullLayout: fullLayout }; @@ -160364,7 +162510,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) { }); } -},{"../../plot_api/plot_template":787,"./axis_defaults":936}],932:[function(_dereq_,module,exports){ +},{"../../plot_api/plot_template":816,"./axis_defaults":966}],962:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160411,7 +162557,7 @@ function minMax(a, depth) { return [min, max]; } -},{"../../lib":749}],933:[function(_dereq_,module,exports){ +},{"../../lib":778}],963:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160510,7 +162656,7 @@ module.exports = { transforms: undefined }; -},{"../../components/color/attributes":614,"../../plots/font_attributes":825,"./axis_attributes":935}],934:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../plots/font_attributes":855,"./axis_attributes":965}],964:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160617,7 +162763,7 @@ module.exports = function(carpet, carpetcd, a, b) { return segments; }; -},{"../../lib":749}],935:[function(_dereq_,module,exports){ +},{"../../lib":778}],965:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -160684,6 +162830,7 @@ module.exports = { editType: 'calc', }, + autotypenumbers: axesAttrs.autotypenumbers, autorange: { valType: 'enumerated', values: [true, false, 'reversed'], @@ -160814,6 +162961,14 @@ module.exports = { editType: 'calc', + }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + + editType: 'calc', + }, separatethousands: { valType: 'boolean', @@ -161028,7 +163183,7 @@ module.exports = { editType: 'calc' }; -},{"../../components/color/attributes":614,"../../constants/docs":719,"../../plot_api/edit_types":780,"../../plots/cartesian/layout_attributes":811,"../../plots/font_attributes":825}],936:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../constants/docs":748,"../../plot_api/edit_types":809,"../../plots/cartesian/layout_attributes":841,"../../plots/font_attributes":855}],966:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161082,6 +163237,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) } // now figure out type and do some more initialization + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type'); if(axType === '-') { if(options.data) setAutoType(containerOut, options.data); @@ -161109,6 +163265,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) coerce('separatethousands'); coerce('tickformat'); coerce('exponentformat'); + coerce('minexponent'); coerce('showexponent'); coerce('categoryorder'); @@ -161217,6 +163374,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) delete containerOut.tickangle; delete containerOut.showexponent; delete containerOut.exponentformat; + delete containerOut.minexponent; delete containerOut.tickformat; delete containerOut.showticksuffix; delete containerOut.showtickprefix; @@ -161248,10 +163406,12 @@ function setAutoType(ax, data) { var calAttr = axLetter + 'calendar'; var calendar = ax[calAttr]; - ax.type = autoType(data, calendar); + ax.type = autoType(data, calendar, { + autotypenumbers: ax.autotypenumbers + }); } -},{"../../components/color":615,"../../lib":749,"../../plots/cartesian/axis_autotype":798,"../../plots/cartesian/category_order_defaults":801,"../../plots/cartesian/set_convert":817,"../../plots/cartesian/tick_label_defaults":818,"../../plots/cartesian/tick_value_defaults":820,"../../registry":880,"./attributes":933}],937:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../plots/cartesian/axis_autotype":828,"../../plots/cartesian/category_order_defaults":831,"../../plots/cartesian/set_convert":847,"../../plots/cartesian/tick_label_defaults":848,"../../plots/cartesian/tick_value_defaults":850,"../../registry":910,"./attributes":963}],967:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161361,7 +163521,7 @@ module.exports = function calc(gd, trace) { return [t]; }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../heatmap/clean_2d_array":1036,"../heatmap/convert_column_xyz":1038,"./array_minmax":932,"./calc_clippath":938,"./calc_gridlines":939,"./calc_labels":940,"./cheater_basis":942,"./set_convert":955,"./smooth_fill_2d_array":956}],938:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../heatmap/clean_2d_array":1066,"../heatmap/convert_column_xyz":1068,"./array_minmax":962,"./calc_clippath":968,"./calc_gridlines":969,"./calc_labels":970,"./cheater_basis":972,"./set_convert":985,"./smooth_fill_2d_array":986}],968:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161413,7 +163573,7 @@ module.exports = function makeClipPath(xctrl, yctrl, aax, bax) { return segments; }; -},{}],939:[function(_dereq_,module,exports){ +},{}],969:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161756,7 +163916,7 @@ module.exports = function calcGridlines(trace, axisLetter, crossAxisLetter) { } }; -},{"../../lib/extend":739,"../../plots/cartesian/axes":797}],940:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/cartesian/axes":827}],970:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161817,7 +163977,7 @@ module.exports = function calcLabels(trace, axis) { } }; -},{"../../lib/extend":739,"../../plots/cartesian/axes":797}],941:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/cartesian/axes":827}],971:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161860,7 +164020,7 @@ module.exports = function makeControlPoints(p0, p1, p2, smoothness) { ]]; }; -},{}],942:[function(_dereq_,module,exports){ +},{}],972:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -161928,7 +164088,7 @@ module.exports = function(a, b, cheaterslope) { return data; }; -},{"../../lib":749}],943:[function(_dereq_,module,exports){ +},{"../../lib":778}],973:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162280,7 +164440,7 @@ module.exports = function computeControlPoints(xe, ye, x, y, asmoothing, bsmooth return [xe, ye]; }; -},{"../../lib":749,"./catmull_rom":941}],944:[function(_dereq_,module,exports){ +},{"../../lib":778,"./catmull_rom":971}],974:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162296,7 +164456,7 @@ module.exports = { RELATIVE_CULL_TOLERANCE: 1e-6 }; -},{}],945:[function(_dereq_,module,exports){ +},{}],975:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162448,7 +164608,7 @@ module.exports = function(arrays, asmoothing, bsmoothing) { } }; -},{}],946:[function(_dereq_,module,exports){ +},{}],976:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162575,7 +164735,7 @@ module.exports = function(arrays, asmoothing, bsmoothing) { } }; -},{}],947:[function(_dereq_,module,exports){ +},{}],977:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162725,7 +164885,7 @@ module.exports = function(arrays, na, nb, asmoothing, bsmoothing) { } }; -},{}],948:[function(_dereq_,module,exports){ +},{}],978:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162784,7 +164944,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, dfltColor, fullLayou } }; -},{"../../components/color/attributes":614,"../../lib":749,"./ab_defaults":931,"./attributes":933,"./xy_defaults":957}],949:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib":778,"./ab_defaults":961,"./attributes":963,"./xy_defaults":987}],979:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162812,7 +164972,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":933,"./calc":937,"./defaults":948,"./plot":954}],950:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":963,"./calc":967,"./defaults":978,"./plot":984}],980:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162848,7 +165008,7 @@ module.exports = function(gd, trace) { return firstAxis; }; -},{}],951:[function(_dereq_,module,exports){ +},{}],981:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162880,7 +165040,7 @@ module.exports = function makePath(xp, yp, isBicubic) { return path.join(isBicubic ? '' : 'L'); }; -},{}],952:[function(_dereq_,module,exports){ +},{}],982:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162917,7 +165077,7 @@ module.exports = function mapArray(out, data, func) { return out; }; -},{"../../lib":749}],953:[function(_dereq_,module,exports){ +},{"../../lib":778}],983:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162959,7 +165119,7 @@ module.exports = function orientText(trace, xaxis, yaxis, xy, dxy, refDxy) { }; }; -},{}],954:[function(_dereq_,module,exports){ +},{}],984:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -162978,6 +165138,8 @@ var makepath = _dereq_('./makepath'); var orientText = _dereq_('./orient_text'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Lib = _dereq_('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var alignmentConstants = _dereq_('../../constants/alignment'); module.exports = function plot(gd, plotinfo, cdcarpet, carpetLayer) { @@ -163116,11 +165278,11 @@ function drawAxisLabels(gd, xaxis, yaxis, trace, t, layer, labels, labelClass) { labelEl.attr('transform', // Translate to the correct point: - 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + + strTranslate(orientation.p[0], orientation.p[1]) + // Rotate to line up with grid line tangent: - 'rotate(' + orientation.angle + ')' + + strRotate(orientation.angle) + // Adjust the baseline and indentation: - 'translate(' + label.axis.labelpadding * direction + ',' + bbox.height * 0.3 + ')' + strTranslate(label.axis.labelpadding * direction, bbox.height * 0.3) ); maxExtent = Math.max(maxExtent, bbox.width + label.axis.labelpadding); @@ -163197,11 +165359,10 @@ function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientat } el.attr('transform', - 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + - 'rotate(' + orientation.angle + ') ' + - 'translate(0,' + offset + ')' + strTranslate(orientation.p[0], orientation.p[1]) + + strRotate(orientation.angle) + + strTranslate(0, offset) ) - .classed('user-select-none', true) .attr('text-anchor', 'middle') .call(Drawing.font, axis.title.font); }); @@ -163209,7 +165370,7 @@ function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientat titleJoin.exit().remove(); } -},{"../../components/drawing":637,"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"./makepath":951,"./map_1d_array":952,"./orient_text":953,"d3":169}],955:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"./makepath":981,"./map_1d_array":982,"./orient_text":983,"d3":169}],985:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163492,7 +165653,7 @@ module.exports = function setConvert(trace) { }; }; -},{"../../lib/search":768,"./compute_control_points":943,"./constants":944,"./create_i_derivative_evaluator":945,"./create_j_derivative_evaluator":946,"./create_spline_evaluator":947}],956:[function(_dereq_,module,exports){ +},{"../../lib/search":797,"./compute_control_points":973,"./constants":974,"./create_i_derivative_evaluator":975,"./create_j_derivative_evaluator":976,"./create_spline_evaluator":977}],986:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163714,7 +165875,7 @@ module.exports = function smoothFill2dArray(data, a, b) { return data; }; -},{"../../lib":749}],957:[function(_dereq_,module,exports){ +},{"../../lib":778}],987:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163748,7 +165909,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return true; }; -},{"../../lib":749}],958:[function(_dereq_,module,exports){ +},{"../../lib":778}],988:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163840,7 +166001,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/color/attributes":614,"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scattergeo/attributes":1196}],959:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scattergeo/attributes":1228}],989:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163901,7 +166062,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/calc":623,"../../constants/numerical":724,"../scatter/arrays_to_calcdata":1154,"../scatter/calc_selection":1157,"fast-isnumeric":241}],960:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../constants/numerical":753,"../scatter/arrays_to_calcdata":1185,"../scatter/calc_selection":1188,"fast-isnumeric":241}],990:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163957,7 +166118,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":958}],961:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":988}],991:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -163982,7 +166143,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],962:[function(_dereq_,module,exports){ +},{}],992:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164004,17 +166165,20 @@ module.exports = function hoverPoints(pointData, xval, yval) { var pt, i, j, isInside; + var xy = [xval, yval]; + var altXy = [xval + 360, yval]; + for(i = 0; i < cd.length; i++) { pt = cd[i]; isInside = false; if(pt._polygons) { for(j = 0; j < pt._polygons.length; j++) { - if(pt._polygons[j].contains([xval, yval])) { + if(pt._polygons[j].contains(xy)) { isInside = !isInside; } // for polygons that cross antimeridian as xval is in [-180, 180] - if(pt._polygons[j].contains([xval + 360, yval])) { + if(pt._polygons[j].contains(altXy)) { isInside = !isInside; } } @@ -164034,7 +166198,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { pointData.zLabel = Axes.tickText(geo.mockAxis, geo.mockAxis.c2l(pt.z), 'hover').text; pointData.hovertemplate = pt.hovertemplate; - makeHoverInfo(pointData, trace, pt, geo.mockAxis); + makeHoverInfo(pointData, trace, pt); return [pointData]; }; @@ -164074,7 +166238,7 @@ function makeHoverInfo(pointData, trace, pt) { pointData.extraText = text.join('
'); } -},{"../../lib":749,"../../plots/cartesian/axes":797,"./attributes":958}],963:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"./attributes":988}],993:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164107,7 +166271,7 @@ module.exports = { } }; -},{"../../plots/geo":829,"../heatmap/colorbar":1037,"./attributes":958,"./calc":959,"./defaults":960,"./event_data":961,"./hover":962,"./plot":964,"./select":965,"./style":966}],964:[function(_dereq_,module,exports){ +},{"../../plots/geo":859,"../heatmap/colorbar":1067,"./attributes":988,"./calc":989,"./defaults":990,"./event_data":991,"./hover":992,"./plot":994,"./select":995,"./style":996}],994:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164195,7 +166359,7 @@ module.exports = { plot: plot }; -},{"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/topojson_utils":776,"../../plots/cartesian/autorange":796,"./style":966,"d3":169}],965:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/topojson_utils":805,"../../plots/cartesian/autorange":826,"./style":996,"d3":169}],995:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164244,7 +166408,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],966:[function(_dereq_,module,exports){ +},{}],996:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164300,7 +166464,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/color":615,"../../components/colorscale":627,"../../components/drawing":637,"d3":169}],967:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale":655,"../../components/drawing":665,"d3":169}],997:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164403,7 +166567,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../choropleth/attributes":958}],968:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../choropleth/attributes":988}],998:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164559,7 +166723,7 @@ module.exports = { convertOnSelect: convertOnSelect }; -},{"../../components/colorscale":627,"../../components/drawing":637,"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/geojson_utils":743,"fast-isnumeric":241}],969:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/drawing":665,"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/geojson_utils":772,"fast-isnumeric":241}],999:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164610,7 +166774,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":967}],970:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":997}],1000:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164672,7 +166836,7 @@ module.exports = { } }; -},{"../../plots/mapbox":854,"../choropleth/calc":959,"../choropleth/event_data":961,"../choropleth/hover":962,"../choropleth/select":965,"../heatmap/colorbar":1037,"./attributes":967,"./defaults":969,"./plot":971}],971:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":884,"../choropleth/calc":989,"../choropleth/event_data":991,"../choropleth/hover":992,"../choropleth/select":995,"../heatmap/colorbar":1067,"./attributes":997,"./defaults":999,"./plot":1001}],1001:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164799,7 +166963,7 @@ module.exports = function createChoroplethMapbox(subplot, calcTrace) { return choroplethMapbox; }; -},{"../../plots/mapbox/constants":852,"./convert":968}],972:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":882,"./convert":998}],1002:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -164962,7 +167126,7 @@ attrs.transforms = undefined; module.exports = attrs; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../mesh3d/attributes":1096}],973:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../mesh3d/attributes":1127}],1003:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165006,7 +167170,7 @@ module.exports = function calc(gd, trace) { }); }; -},{"../../components/colorscale/calc":623}],974:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651}],1004:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165153,7 +167317,7 @@ function createConeTrace(scene, data) { module.exports = createConeTrace; -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gl_format_color":745,"../../plots/gl3d/zip3":850,"gl-cone3d":259}],975:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gl_format_color":774,"../../plots/gl3d/zip3":880,"gl-cone3d":260}],1005:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165215,7 +167379,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":972}],976:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":1002}],1006:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165250,7 +167414,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":972,"./calc":973,"./convert":974,"./defaults":975}],977:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1002,"./calc":1003,"./convert":1004,"./defaults":1005}],1007:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165284,6 +167448,14 @@ module.exports = extendFlat({ y: heatmapAttrs.y, y0: heatmapAttrs.y0, dy: heatmapAttrs.dy, + + xperiod: heatmapAttrs.xperiod, + yperiod: heatmapAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: heatmapAttrs.xperiodalignment, + yperiodalignment: heatmapAttrs.yperiodalignment, + text: heatmapAttrs.text, hovertext: heatmapAttrs.hovertext, transpose: heatmapAttrs.transpose, @@ -165437,7 +167609,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../components/drawing/attributes":636,"../../constants/docs":719,"../../constants/filter_ops":720,"../../lib/extend":739,"../../plots/font_attributes":825,"../heatmap/attributes":1034,"../scatter/attributes":1155}],978:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../components/drawing/attributes":664,"../../constants/docs":748,"../../constants/filter_ops":749,"../../lib/extend":768,"../../plots/font_attributes":855,"../heatmap/attributes":1064,"../scatter/attributes":1186}],1008:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165490,7 +167662,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale":627,"../heatmap/calc":1035,"./end_plus":988,"./set_contours":996}],979:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../heatmap/calc":1065,"./end_plus":1018,"./set_contours":1026}],1009:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165580,7 +167752,7 @@ module.exports = function(pathinfo, contours) { } }; -},{}],980:[function(_dereq_,module,exports){ +},{}],1010:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165631,7 +167803,7 @@ module.exports = { calc: calc }; -},{"../../components/colorscale":627,"./end_plus":988,"./make_color_map":993}],981:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"./end_plus":1018,"./make_color_map":1023}],1011:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165709,7 +167881,7 @@ module.exports = { } }; -},{}],982:[function(_dereq_,module,exports){ +},{}],1012:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165803,7 +167975,7 @@ function handleConstraintValueDefaults(coerce, contours) { } } -},{"../../components/color":615,"../../constants/filter_ops":720,"./label_defaults":992,"fast-isnumeric":241}],983:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../constants/filter_ops":749,"./label_defaults":1022,"fast-isnumeric":241}],1013:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165882,7 +168054,7 @@ function makeInequalitySettings(operation) { }; } -},{"../../constants/filter_ops":720,"fast-isnumeric":241}],984:[function(_dereq_,module,exports){ +},{"../../constants/filter_ops":749,"fast-isnumeric":241}],1014:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -165911,7 +168083,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce, coerc if(autoContour || !contourSize) coerce('ncontours'); }; -},{}],985:[function(_dereq_,module,exports){ +},{}],1015:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166011,7 +168183,7 @@ function copyPathinfo(pi) { }); } -},{"../../lib":749}],986:[function(_dereq_,module,exports){ +},{"../../lib":778}],1016:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166025,6 +168197,7 @@ function copyPathinfo(pi) { var Lib = _dereq_('../../lib'); var handleXYZDefaults = _dereq_('../heatmap/xyz_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleConstraintDefaults = _dereq_('./constraint_defaults'); var handleContoursDefaults = _dereq_('./contours_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); @@ -166046,6 +168219,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); @@ -166062,7 +168237,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../lib":749,"../heatmap/xyz_defaults":1048,"./attributes":977,"./constraint_defaults":982,"./contours_defaults":984,"./style_defaults":998}],987:[function(_dereq_,module,exports){ +},{"../../lib":778,"../heatmap/xyz_defaults":1078,"../scatter/period_defaults":1206,"./attributes":1007,"./constraint_defaults":1012,"./contours_defaults":1014,"./style_defaults":1028}],1017:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166126,7 +168301,7 @@ module.exports = function emptyPathinfo(contours, plotinfo, cd0) { return pathinfo; }; -},{"../../lib":749,"./constraint_mapping":983,"./end_plus":988}],988:[function(_dereq_,module,exports){ +},{"../../lib":778,"./constraint_mapping":1013,"./end_plus":1018}],1018:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166146,7 +168321,7 @@ module.exports = function endPlus(contours) { return contours.end + contours.size / 1e6; }; -},{}],989:[function(_dereq_,module,exports){ +},{}],1019:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166440,7 +168615,7 @@ function getInterpPx(pi, loc, step) { } } -},{"../../lib":749,"./constants":981}],990:[function(_dereq_,module,exports){ +},{"../../lib":778,"./constants":1011}],1020:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166475,7 +168650,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return hoverData; }; -},{"../../components/color":615,"../heatmap/hover":1041}],991:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../heatmap/hover":1071}],1021:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166504,7 +168679,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":977,"./calc":978,"./colorbar":980,"./defaults":986,"./hover":990,"./plot":995,"./style":997}],992:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":1007,"./calc":1008,"./colorbar":1010,"./defaults":1016,"./hover":1020,"./plot":1025,"./style":1027}],1022:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166534,7 +168709,7 @@ module.exports = function handleLabelDefaults(coerce, layout, lineColor, opts) { if(opts.hasHover !== false) coerce('zhoverformat'); }; -},{"../../lib":749}],993:[function(_dereq_,module,exports){ +},{"../../lib":778}],1023:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166618,7 +168793,7 @@ module.exports = function makeColorMap(trace) { ); }; -},{"../../components/colorscale":627,"./end_plus":988,"d3":169}],994:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"./end_plus":1018,"d3":169}],1024:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -166710,7 +168885,7 @@ function getMarchingIndex(val, corners) { return (mi === 15) ? 0 : mi; } -},{"./constants":981}],995:[function(_dereq_,module,exports){ +},{"./constants":1011}],1025:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167401,7 +169576,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/colorscale":627,"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../plots/cartesian/set_convert":817,"../heatmap/plot":1045,"./close_boundaries":979,"./constants":981,"./convert_to_constraints":985,"./empty_pathinfo":987,"./find_all_paths":989,"./make_crossings":994,"d3":169}],996:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../plots/cartesian/set_convert":847,"../heatmap/plot":1075,"./close_boundaries":1009,"./constants":1011,"./convert_to_constraints":1015,"./empty_pathinfo":1017,"./find_all_paths":1019,"./make_crossings":1024,"d3":169}],1026:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167505,7 +169680,7 @@ function autoContours(start, end, ncontours) { return dummyAx; } -},{"../../lib":749,"../../plots/cartesian/axes":797}],997:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827}],1027:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167586,7 +169761,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":637,"../heatmap/style":1046,"./make_color_map":993,"d3":169}],998:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../heatmap/style":1076,"./make_color_map":1023,"d3":169}],1028:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167631,7 +169806,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, handleLabelDefaults(coerce, layout, lineColor, opts); }; -},{"../../components/colorscale/defaults":625,"./label_defaults":992}],999:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"./label_defaults":1022}],1029:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167716,7 +169891,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../contour/attributes":977,"../heatmap/attributes":1034}],1000:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../contour/attributes":1007,"../heatmap/attributes":1064}],1030:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167828,7 +170003,7 @@ function heatmappishCalc(gd, trace) { return [cd0]; } -},{"../../components/colorscale/calc":623,"../../lib":749,"../carpet/lookup_carpetid":950,"../contour/set_contours":996,"../heatmap/clean_2d_array":1036,"../heatmap/convert_column_xyz":1038,"../heatmap/find_empties":1040,"../heatmap/interp2d":1043,"../heatmap/make_bound_array":1044,"./defaults":1001}],1001:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../lib":778,"../carpet/lookup_carpetid":980,"../contour/set_contours":1026,"../heatmap/clean_2d_array":1066,"../heatmap/convert_column_xyz":1068,"../heatmap/find_empties":1070,"../heatmap/interp2d":1073,"../heatmap/make_bound_array":1074,"./defaults":1031}],1031:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167897,7 +170072,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../lib":749,"../contour/constraint_defaults":982,"../contour/contours_defaults":984,"../contour/style_defaults":998,"../heatmap/xyz_defaults":1048,"./attributes":999}],1002:[function(_dereq_,module,exports){ +},{"../../lib":778,"../contour/constraint_defaults":1012,"../contour/contours_defaults":1014,"../contour/style_defaults":1028,"../heatmap/xyz_defaults":1078,"./attributes":1029}],1032:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -167926,7 +170101,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../contour/colorbar":980,"../contour/style":997,"./attributes":999,"./calc":1000,"./defaults":1001,"./plot":1003}],1003:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../contour/colorbar":1010,"../contour/style":1027,"./attributes":1029,"./calc":1030,"./defaults":1031,"./plot":1033}],1033:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168407,7 +170582,7 @@ function joinAllPaths(trace, pi, perimeter, ab2p, carpet, carpetcd, xa, ya) { return fullpath; } -},{"../../components/drawing":637,"../../lib":749,"../carpet/axis_aligned_line":934,"../carpet/lookup_carpetid":950,"../carpet/makepath":951,"../carpet/map_1d_array":952,"../contour/close_boundaries":979,"../contour/constants":981,"../contour/convert_to_constraints":985,"../contour/empty_pathinfo":987,"../contour/find_all_paths":989,"../contour/make_crossings":994,"../contour/plot":995,"d3":169}],1004:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../carpet/axis_aligned_line":964,"../carpet/lookup_carpetid":980,"../carpet/makepath":981,"../carpet/map_1d_array":982,"../contour/close_boundaries":1009,"../contour/constants":1011,"../contour/convert_to_constraints":1015,"../contour/empty_pathinfo":1017,"../contour/find_all_paths":1019,"../contour/make_crossings":1024,"../contour/plot":1025,"d3":169}],1034:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168489,7 +170664,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scattermapbox/attributes":1219}],1005:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scattermapbox/attributes":1251}],1035:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168548,7 +170723,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../components/colorscale/calc":623,"../../constants/numerical":724,"../../lib":749,"fast-isnumeric":241}],1006:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],1036:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168664,7 +170839,7 @@ module.exports = function convert(calcTrace) { return opts; }; -},{"../../components/color":615,"../../components/colorscale":627,"../../constants/numerical":724,"../../lib":749,"../../lib/geojson_utils":743,"fast-isnumeric":241}],1007:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale":655,"../../constants/numerical":753,"../../lib":778,"../../lib/geojson_utils":772,"fast-isnumeric":241}],1037:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168706,7 +170881,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":1004}],1008:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":1034}],1038:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168724,7 +170899,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1009:[function(_dereq_,module,exports){ +},{}],1039:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168792,7 +170967,7 @@ function getExtraText(trace, di, labels) { return text.join('
'); } -},{"../../lib":749,"../../plots/cartesian/axes":797,"../scattermapbox/hover":1224}],1010:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../scattermapbox/hover":1256}],1040:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168839,7 +171014,7 @@ module.exports = { } }; -},{"../../plots/mapbox":854,"../heatmap/colorbar":1037,"../scattermapbox/format_labels":1223,"./attributes":1004,"./calc":1005,"./defaults":1007,"./event_data":1008,"./hover":1009,"./plot":1011}],1011:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":884,"../heatmap/colorbar":1067,"../scattermapbox/format_labels":1255,"./attributes":1034,"./calc":1035,"./defaults":1037,"./event_data":1038,"./hover":1039,"./plot":1041}],1041:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168953,7 +171128,7 @@ module.exports = function createDensityMapbox(subplot, calcTrace) { return densityMapbox; }; -},{"../../plots/mapbox/constants":852,"./convert":1006}],1012:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":882,"./convert":1036}],1042:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -168986,7 +171161,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":749}],1013:[function(_dereq_,module,exports){ +},{"../../lib":778}],1043:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169014,6 +171189,13 @@ module.exports = { y0: barAttrs.y0, dy: barAttrs.dy, + xperiod: barAttrs.xperiod, + yperiod: barAttrs.yperiod, + xperiod0: barAttrs.xperiod0, + yperiod0: barAttrs.yperiod0, + xperiodalignment: barAttrs.xperiodalignment, + yperiodalignment: barAttrs.yperiodalignment, + hovertext: barAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys @@ -169086,7 +171268,7 @@ module.exports = { alignmentgroup: barAttrs.alignmentgroup }; -},{"../../components/color":615,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatter/attributes":1155,"./constants":1015}],1014:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatter/attributes":1186,"./constants":1045}],1044:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169098,6 +171280,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var arraysToCalcdata = _dereq_('./arrays_to_calcdata'); var calcSelection = _dereq_('../scatter/calc_selection'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -169105,14 +171288,19 @@ var BADNUM = _dereq_('../../constants/numerical').BADNUM; module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos, i, cdi; + var size, pos, origPos, i, cdi; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -169144,6 +171332,10 @@ module.exports = function calc(gd, trace) { trace._base[i] = -0.5 * cdi.s; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cdi.id = String(trace.ids[i]); } @@ -169180,7 +171372,7 @@ function fixNum(a) { return (a === BADNUM) ? 0 : a; } -},{"../../constants/numerical":724,"../../plots/cartesian/axes":797,"../scatter/calc_selection":1157,"./arrays_to_calcdata":1012}],1015:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../scatter/calc_selection":1188,"./arrays_to_calcdata":1042}],1045:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169199,7 +171391,7 @@ module.exports = { ] }; -},{}],1016:[function(_dereq_,module,exports){ +},{}],1046:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169270,7 +171462,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../bar/cross_trace_calc":893}],1017:[function(_dereq_,module,exports){ +},{"../bar/cross_trace_calc":923}],1047:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169286,6 +171478,7 @@ var Lib = _dereq_('../../lib'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var handleText = _dereq_('../bar/defaults').handleText; var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); var Color = _dereq_('../../components/color'); @@ -169300,6 +171493,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.y && !traceOut.x) ? 'v' : 'h'); coerce('offset'); coerce('width'); @@ -169367,7 +171562,7 @@ module.exports = { crossTraceDefaults: crossTraceDefaults }; -},{"../../components/color":615,"../../lib":749,"../bar/defaults":894,"../scatter/xy_defaults":1181,"./attributes":1013}],1018:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../bar/defaults":924,"../scatter/period_defaults":1206,"../scatter/xy_defaults":1213,"./attributes":1043}],1048:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169394,7 +171589,7 @@ module.exports = function eventData(out, pt /* , trace, cd, pointNumber */) { return out; }; -},{}],1019:[function(_dereq_,module,exports){ +},{}],1049:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169467,7 +171662,7 @@ function getTraceColor(trace, di) { else if(opacity(mlc) && mlw) return mlc; } -},{"../../components/color":615,"../../lib":749,"../bar/hover":897}],1020:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../bar/hover":927}],1050:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169502,7 +171697,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../bar/select":902,"./attributes":1013,"./calc":1014,"./cross_trace_calc":1016,"./defaults":1017,"./event_data":1018,"./hover":1019,"./layout_attributes":1021,"./layout_defaults":1022,"./plot":1023,"./style":1024}],1021:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../bar/select":932,"./attributes":1043,"./calc":1044,"./cross_trace_calc":1046,"./defaults":1047,"./event_data":1048,"./hover":1049,"./layout_attributes":1051,"./layout_defaults":1052,"./plot":1053,"./style":1054}],1051:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169541,7 +171736,7 @@ module.exports = { } }; -},{}],1022:[function(_dereq_,module,exports){ +},{}],1052:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169578,7 +171773,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":749,"./layout_attributes":1021}],1023:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1051}],1053:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169747,7 +171942,7 @@ function getXY(di, xa, ya, isHorizontal) { return isHorizontal ? [s, p] : [p, s]; } -},{"../../components/drawing":637,"../../constants/numerical":724,"../../lib":749,"../bar/plot":901,"../bar/uniform_text":906,"d3":169}],1024:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/numerical":753,"../../lib":778,"../bar/plot":931,"../bar/uniform_text":936,"d3":169}],1054:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169812,7 +172007,7 @@ module.exports = { style: style }; -},{"../../components/color":615,"../../components/drawing":637,"../../constants/interactions":723,"../bar/style":904,"../bar/uniform_text":906,"d3":169}],1025:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../constants/interactions":752,"../bar/style":934,"../bar/uniform_text":936,"d3":169}],1055:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169914,7 +172109,7 @@ module.exports = { } }; -},{"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/template_attributes":875,"../pie/attributes":1129}],1026:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/template_attributes":905,"../pie/attributes":1160}],1056:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169937,7 +172132,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1027:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1057:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -169963,7 +172158,7 @@ module.exports = { crossTraceCalc: crossTraceCalc }; -},{"../pie/calc":1131}],1028:[function(_dereq_,module,exports){ +},{"../pie/calc":1162}],1058:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170045,7 +172240,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('baseratio'); }; -},{"../../lib":749,"../../plots/domain":824,"../bar/defaults":894,"../pie/defaults":1132,"./attributes":1025}],1029:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/domain":854,"../bar/defaults":924,"../pie/defaults":1163,"./attributes":1055}],1059:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170079,7 +172274,7 @@ module.exports = { } }; -},{"../pie/style_one":1140,"./attributes":1025,"./base_plot":1026,"./calc":1027,"./defaults":1028,"./layout_attributes":1030,"./layout_defaults":1031,"./plot":1032,"./style":1033}],1030:[function(_dereq_,module,exports){ +},{"../pie/style_one":1171,"./attributes":1055,"./base_plot":1056,"./calc":1057,"./defaults":1058,"./layout_attributes":1060,"./layout_defaults":1061,"./plot":1062,"./style":1063}],1060:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170110,7 +172305,7 @@ module.exports = { } }; -},{"../pie/layout_attributes":1136}],1031:[function(_dereq_,module,exports){ +},{"../pie/layout_attributes":1167}],1061:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170135,7 +172330,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendfunnelareacolors'); }; -},{"../../lib":749,"./layout_attributes":1030}],1032:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1060}],1062:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170150,6 +172345,8 @@ var d3 = _dereq_('d3'); var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var barPlot = _dereq_('../bar/plot'); @@ -170305,9 +172502,9 @@ module.exports = function plot(gd, cdModule) { var transform = positionTitleOutside(cd0, fullLayout._size); titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); }); }); @@ -170431,7 +172628,7 @@ function setCoords(cd) { } } -},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../bar/plot":901,"../bar/uniform_text":906,"../pie/helpers":1134,"../pie/plot":1138,"d3":169}],1033:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../bar/plot":931,"../bar/uniform_text":936,"../pie/helpers":1165,"../pie/plot":1169,"d3":169}],1063:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170464,7 +172661,7 @@ module.exports = function style(gd) { }); }; -},{"../bar/uniform_text":906,"../pie/style_one":1140,"d3":169}],1034:[function(_dereq_,module,exports){ +},{"../bar/uniform_text":936,"../pie/style_one":1171,"d3":169}],1064:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170496,6 +172693,13 @@ module.exports = extendFlat({ y0: extendFlat({}, scatterAttrs.y0, {impliedEdits: {ytype: 'scaled'}}), dy: extendFlat({}, scatterAttrs.dy, {impliedEdits: {ytype: 'scaled'}}), + xperiod: extendFlat({}, scatterAttrs.xperiod, {impliedEdits: {xtype: 'scaled'}}), + yperiod: extendFlat({}, scatterAttrs.yperiod, {impliedEdits: {ytype: 'scaled'}}), + xperiod0: extendFlat({}, scatterAttrs.xperiod0, {impliedEdits: {xtype: 'scaled'}}), + yperiod0: extendFlat({}, scatterAttrs.yperiod0, {impliedEdits: {ytype: 'scaled'}}), + xperiodalignment: extendFlat({}, scatterAttrs.xperiodalignment, {impliedEdits: {xtype: 'scaled'}}), + yperiodalignment: extendFlat({}, scatterAttrs.yperiodalignment, {impliedEdits: {ytype: 'scaled'}}), + text: { valType: 'data_array', editType: 'calc', @@ -170579,7 +172783,7 @@ module.exports = extendFlat({ colorScaleAttrs('', {cLetter: 'z', autoColorDflt: false}) ); -},{"../../components/colorscale/attributes":622,"../../constants/docs":719,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1035:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../constants/docs":748,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1065:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170593,6 +172797,7 @@ module.exports = extendFlat({ var Registry = _dereq_('../../registry'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var histogram2dCalc = _dereq_('../histogram2d/calc'); var colorscaleCalc = _dereq_('../../components/colorscale/calc'); @@ -170612,15 +172817,9 @@ module.exports = function calc(gd, trace) { var isHist = Registry.traceIs(trace, 'histogram'); var isGL2D = Registry.traceIs(trace, 'gl2d'); var zsmooth = isContour ? 'best' : trace.zsmooth; - var x; - var x0; - var dx; - var y; - var y0; - var dy; - var z; - var i; - var binned; + var x, x0, dx, origX; + var y, y0, dy, origY; + var z, i, binned; // cancel minimum tick spacings (only applies to bars and boxes) xa._minDtick = 0; @@ -170628,12 +172827,16 @@ module.exports = function calc(gd, trace) { if(isHist) { binned = histogram2dCalc(gd, trace); + origX = binned.orig_x; x = binned.x; x0 = binned.x0; dx = binned.dx; + + origY = binned.orig_y; y = binned.y; y0 = binned.y0; dy = binned.dy; + z = binned.z; } else { var zIn = trace.z; @@ -170643,8 +172846,12 @@ module.exports = function calc(gd, trace) { y = trace._y; zIn = trace._z; } else { - x = trace._x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace._y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + origX = trace.x ? xa.makeCalcdata(trace, 'x') : []; + origY = trace.y ? ya.makeCalcdata(trace, 'y') : []; + x = alignPeriod(trace, xa, 'x', origX); + y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; } x0 = trace.x0; @@ -170726,6 +172933,13 @@ module.exports = function calc(gd, trace) { hovertext: trace._hovertext || trace.hovertext }; + if(trace.xperiodalignment && origX) { + cd0.orig_x = origX; + } + if(trace.yperiodalignment && origY) { + cd0.orig_y = origY; + } + if(xIn && xIn.length === xArray.length - 1) cd0.xCenter = xIn; if(yIn && yIn.length === yArray.length - 1) cd0.yCenter = yIn; @@ -170778,7 +172992,7 @@ function dropZonBreaks(x, y, z) { return newZ; } -},{"../../components/colorscale/calc":623,"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"../histogram2d/calc":1067,"./clean_2d_array":1036,"./convert_column_xyz":1038,"./find_empties":1040,"./interp2d":1043,"./make_bound_array":1044}],1036:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../../registry":910,"../histogram2d/calc":1097,"./clean_2d_array":1066,"./convert_column_xyz":1068,"./find_empties":1070,"./interp2d":1073,"./make_bound_array":1074}],1066:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170855,7 +173069,7 @@ module.exports = function clean2dArray(zOld, trace, xa, ya) { return zNew; }; -},{"../../constants/numerical":724,"../../lib":749,"fast-isnumeric":241}],1037:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],1067:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170871,7 +173085,7 @@ module.exports = { max: 'zmax' }; -},{}],1038:[function(_dereq_,module,exports){ +},{}],1068:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170885,11 +173099,15 @@ module.exports = { var Lib = _dereq_('../../lib'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, arrayVarNames) { var colLen = trace._length; var col1 = ax1.makeCalcdata(trace, var1Name); var col2 = ax2.makeCalcdata(trace, var2Name); + col1 = alignPeriod(trace, ax1, var1Name, col1); + col2 = alignPeriod(trace, ax2, var2Name, col2); + var textCol = trace.text; var hasColumnText = (textCol !== undefined && Lib.isArray1D(textCol)); var hoverTextCol = trace.hovertext; @@ -170957,7 +173175,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, trace._after2before = after2before; }; -},{"../../constants/numerical":724,"../../lib":749}],1039:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824}],1069:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -170972,6 +173190,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, var Lib = _dereq_('../../lib'); var handleXYZDefaults = _dereq_('./xyz_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleStyleDefaults = _dereq_('./style_defaults'); var colorscaleDefaults = _dereq_('../../components/colorscale/defaults'); var attributes = _dereq_('./attributes'); @@ -170988,6 +173207,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); @@ -171000,7 +173221,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":1034,"./style_defaults":1047,"./xyz_defaults":1048}],1040:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../scatter/period_defaults":1206,"./attributes":1064,"./style_defaults":1077,"./xyz_defaults":1078}],1070:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171105,7 +173326,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"../../lib":749}],1041:[function(_dereq_,module,exports){ +},{"../../lib":778}],1071:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171178,14 +173399,21 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay var y0 = ya.c2p(y[ny]); var y1 = ya.c2p(y[ny + 1]); + var _x, _y; if(contour) { + _x = cd0.orig_x || x; + _y = cd0.orig_y || y; + x1 = x0; - xl = x[nx]; + xl = _x[nx]; y1 = y0; - yl = y[ny]; + yl = _y[ny]; } else { - xl = xc ? xc[nx] : ((x[nx] + x[nx + 1]) / 2); - yl = yc ? yc[ny] : ((y[ny] + y[ny + 1]) / 2); + _x = cd0.orig_x || xc || x; + _y = cd0.orig_y || yc || y; + + xl = xc ? _x[nx] : ((_x[nx] + _x[nx + 1]) / 2); + yl = yc ? _y[ny] : ((_y[ny] + _y[ny + 1]) / 2); if(xa && xa.type === 'category') xl = x[nx]; if(ya && ya.type === 'category') yl = y[ny]; @@ -171236,7 +173464,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay })]; }; -},{"../../components/colorscale":627,"../../components/fx":655,"../../lib":749,"../../plots/cartesian/axes":797}],1042:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/fx":683,"../../lib":778,"../../plots/cartesian/axes":827}],1072:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171265,7 +173493,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":1034,"./calc":1035,"./colorbar":1037,"./defaults":1039,"./hover":1041,"./plot":1045,"./style":1046}],1043:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":1064,"./calc":1065,"./colorbar":1067,"./defaults":1069,"./hover":1071,"./plot":1075,"./style":1076}],1073:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171398,7 +173626,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":749}],1044:[function(_dereq_,module,exports){ +},{"../../lib":778}],1074:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171486,7 +173714,7 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, return arrayOut; }; -},{"../../lib":749,"../../registry":880}],1045:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],1075:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171891,7 +174119,7 @@ function putColor(pixels, pxIndex, c) { pixels[pxIndex + 3] = Math.round(c[3] * 255); } -},{"../../components/colorscale":627,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../registry":880,"d3":169,"tinycolor2":548}],1046:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../registry":910,"d3":169,"tinycolor2":576}],1076:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171912,7 +174140,7 @@ module.exports = function style(gd) { }); }; -},{"d3":169}],1047:[function(_dereq_,module,exports){ +},{"d3":169}],1077:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -171935,7 +174163,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce) { coerce('zhoverformat'); }; -},{}],1048:[function(_dereq_,module,exports){ +},{}],1078:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172037,7 +174265,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../lib":749,"../../registry":880,"fast-isnumeric":241}],1049:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"fast-isnumeric":241}],1079:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172085,7 +174313,7 @@ extendFlat( module.exports = overrideAll(attrs, 'calc', 'nested'); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../heatmap/attributes":1034}],1050:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../heatmap/attributes":1064}],1080:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172237,7 +174465,7 @@ function createHeatmap(scene, fullTrace, calcTrace) { module.exports = createHeatmap; -},{"../../lib/str2rgbarray":772,"../../plots/cartesian/axes":797,"gl-heatmap2d":268}],1051:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":801,"../../plots/cartesian/axes":827,"gl-heatmap2d":271}],1081:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172273,7 +174501,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../heatmap/xyz_defaults":1048,"./attributes":1049}],1052:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../heatmap/xyz_defaults":1078,"./attributes":1079}],1082:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172301,7 +174529,7 @@ module.exports = { } }; -},{"../../plots/gl2d":837,"../heatmap/calc":1035,"../heatmap/colorbar":1037,"./attributes":1049,"./convert":1050,"./defaults":1051}],1053:[function(_dereq_,module,exports){ +},{"../../plots/gl2d":867,"../heatmap/calc":1065,"../heatmap/colorbar":1067,"./attributes":1079,"./convert":1080,"./defaults":1081}],1083:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172442,7 +174670,7 @@ module.exports = { } }; -},{"../../lib/extend":739,"../../plots/template_attributes":875,"../bar/attributes":890,"./bin_attributes":1055,"./constants":1059}],1054:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/template_attributes":905,"../bar/attributes":920,"./bin_attributes":1085,"./constants":1089}],1084:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172467,7 +174695,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],1055:[function(_dereq_,module,exports){ +},{}],1085:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172502,7 +174730,7 @@ module.exports = function makeBinAttrs(axLetter, match) { }; }; -},{}],1056:[function(_dereq_,module,exports){ +},{}],1086:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172576,7 +174804,7 @@ module.exports = { } }; -},{"fast-isnumeric":241}],1057:[function(_dereq_,module,exports){ +},{"fast-isnumeric":241}],1087:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -172752,7 +174980,7 @@ function dateParts(v, pa, calendar) { return parts; } -},{"../../constants/numerical":724,"../../plots/cartesian/axes":797}],1058:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../plots/cartesian/axes":827}],1088:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173331,7 +175559,7 @@ module.exports = { calcAllAutoBins: calcAllAutoBins }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"../bar/arrays_to_calcdata":889,"./average":1054,"./bin_functions":1056,"./bin_label_vals":1057,"./norm_functions":1065,"fast-isnumeric":241}],1059:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"../bar/arrays_to_calcdata":919,"./average":1084,"./bin_functions":1086,"./bin_label_vals":1087,"./norm_functions":1095,"fast-isnumeric":241}],1089:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173347,7 +175575,7 @@ module.exports = { eventDataKeys: ['binNumber'] }; -},{}],1060:[function(_dereq_,module,exports){ +},{}],1090:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173365,7 +175593,7 @@ var traceIs = _dereq_('../../registry').traceIs; var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var nestedProperty = Lib.nestedProperty; -var getAxisGroup = axisIds.getAxisGroup; +var getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup; var BINATTRS = [ {aStr: {x: 'xbins.start', y: 'ybins.start'}, name: 'start'}, @@ -173524,10 +175752,9 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } var binGroupFound = false; - for(i = 0; i < traces.length; i++) { - traceOut = traces[i]; + if(traces.length) { + traceOut = traces[0]; binGroupFound = coerce('bingroup'); - break; } groupName = binGroupFound || groupName; @@ -173625,7 +175852,7 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } }; -},{"../../lib":749,"../../plots/cartesian/axis_ids":800,"../../registry":880,"../bar/defaults":894}],1061:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axis_ids":830,"../../plots/cartesian/constraints":834,"../../registry":910,"../bar/defaults":924}],1091:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173699,7 +175926,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":615,"../../lib":749,"../../registry":880,"../bar/style_defaults":905,"./attributes":1053}],1062:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../registry":910,"../bar/style_defaults":935,"./attributes":1083}],1092:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173748,7 +175975,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],1063:[function(_dereq_,module,exports){ +},{}],1093:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173781,7 +176008,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return pts; }; -},{"../../plots/cartesian/axes":797,"../bar/hover":897}],1064:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827,"../bar/hover":927}],1094:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173831,7 +176058,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../bar/cross_trace_calc":893,"../bar/layout_attributes":899,"../bar/layout_defaults":900,"../bar/plot":901,"../bar/select":902,"../bar/style":904,"../scatter/marker_colorbar":1173,"./attributes":1053,"./calc":1058,"./cross_trace_defaults":1060,"./defaults":1061,"./event_data":1062,"./hover":1063}],1065:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../bar/cross_trace_calc":923,"../bar/layout_attributes":929,"../bar/layout_defaults":930,"../bar/plot":931,"../bar/select":932,"../bar/style":934,"../scatter/marker_colorbar":1204,"./attributes":1083,"./calc":1088,"./cross_trace_defaults":1090,"./defaults":1091,"./event_data":1092,"./hover":1093}],1095:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173866,7 +176093,7 @@ module.exports = { } }; -},{}],1066:[function(_dereq_,module,exports){ +},{}],1096:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -173934,7 +176161,7 @@ module.exports = extendFlat( colorScaleAttrs('', {cLetter: 'z', autoColorDflt: false}) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../heatmap/attributes":1034,"../histogram/attributes":1053,"../histogram/bin_attributes":1055}],1067:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../heatmap/attributes":1064,"../histogram/attributes":1083,"../histogram/bin_attributes":1085}],1097:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174153,7 +176380,7 @@ function getRanges(edges, uniqueVals, gapLow, gapHigh, ax, calendar) { return out; } -},{"../../lib":749,"../../plots/cartesian/axes":797,"../histogram/average":1054,"../histogram/bin_functions":1056,"../histogram/bin_label_vals":1057,"../histogram/calc":1058,"../histogram/norm_functions":1065}],1068:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../histogram/average":1084,"../histogram/bin_functions":1086,"../histogram/bin_label_vals":1087,"../histogram/calc":1088,"../histogram/norm_functions":1095}],1098:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174186,7 +176413,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hovertemplate'); }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../heatmap/style_defaults":1047,"./attributes":1066,"./sample_defaults":1071}],1069:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../heatmap/style_defaults":1077,"./attributes":1096,"./sample_defaults":1101}],1099:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174220,7 +176447,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return pts; }; -},{"../../plots/cartesian/axes":797,"../heatmap/hover":1041}],1070:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827,"../heatmap/hover":1071}],1100:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174253,7 +176480,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../heatmap/calc":1035,"../heatmap/colorbar":1037,"../heatmap/plot":1045,"../heatmap/style":1046,"../histogram/cross_trace_defaults":1060,"../histogram/event_data":1062,"./attributes":1066,"./defaults":1068,"./hover":1069}],1071:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../heatmap/calc":1065,"../heatmap/colorbar":1067,"../heatmap/plot":1075,"../heatmap/style":1076,"../histogram/cross_trace_defaults":1090,"../histogram/event_data":1092,"./attributes":1096,"./defaults":1098,"./hover":1099}],1101:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174298,7 +176525,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout coerce('autobiny'); }; -},{"../../lib":749,"../../registry":880}],1072:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],1102:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174356,7 +176583,7 @@ module.exports = extendFlat({ }) ); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../contour/attributes":977,"../histogram2d/attributes":1066}],1073:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../contour/attributes":1007,"../histogram2d/attributes":1096}],1103:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174393,7 +176620,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('hovertemplate'); }; -},{"../../lib":749,"../contour/contours_defaults":984,"../contour/style_defaults":998,"../histogram2d/sample_defaults":1071,"./attributes":1072}],1074:[function(_dereq_,module,exports){ +},{"../../lib":778,"../contour/contours_defaults":1014,"../contour/style_defaults":1028,"../histogram2d/sample_defaults":1101,"./attributes":1102}],1104:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174425,7 +176652,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../contour/calc":978,"../contour/colorbar":980,"../contour/hover":990,"../contour/plot":995,"../contour/style":997,"../histogram/cross_trace_defaults":1060,"./attributes":1072,"./defaults":1073}],1075:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../contour/calc":1008,"../contour/colorbar":1010,"../contour/hover":1020,"../contour/plot":1025,"../contour/style":1027,"../histogram/cross_trace_defaults":1090,"./attributes":1102,"./defaults":1103}],1105:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174543,7 +176770,7 @@ module.exports = extendFlat({ transforms: undefined }); -},{"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"./constants":1077}],1076:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"./constants":1107}],1106:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174559,9 +176786,7 @@ var constants = _dereq_('./constants'); var isNumeric = _dereq_('fast-isnumeric'); var Axes = _dereq_('../../plots/cartesian/axes'); var maxRowLength = _dereq_('../../lib').maxRowLength; -var sizeOf = _dereq_('image-size'); -var dataUri = _dereq_('../../snapshot/helpers').IMAGE_URL_PREFIX; -var Buffer = _dereq_('buffer/').Buffer; // note: the trailing slash is important! +var getImageSize = _dereq_('./helpers').getImageSize; module.exports = function calc(gd, trace) { var h; @@ -174643,14 +176868,7 @@ function makeScaler(trace) { }; } -// Get image size -function getImageSize(src) { - var data = src.replace(dataUri, ''); - var buff = new Buffer(data, 'base64'); - return sizeOf(buff); -} - -},{"../../lib":749,"../../plots/cartesian/axes":797,"../../snapshot/helpers":884,"./constants":1077,"buffer/":111,"fast-isnumeric":241,"image-size":418}],1077:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"./constants":1107,"./helpers":1110,"fast-isnumeric":241}],1107:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174711,7 +176929,7 @@ module.exports = { } }; -},{}],1078:[function(_dereq_,module,exports){ +},{}],1108:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174768,7 +176986,7 @@ module.exports = function supplyDefaults(traceIn, traceOut) { traceOut._length = null; }; -},{"../../lib":749,"../../snapshot/helpers":884,"./attributes":1075,"./constants":1077}],1079:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../snapshot/helpers":914,"./attributes":1105,"./constants":1107}],1109:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174790,7 +177008,28 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1080:[function(_dereq_,module,exports){ +},{}],1110:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var sizeOf = _dereq_('image-size'); +var dataUri = _dereq_('../../snapshot/helpers').IMAGE_URL_PREFIX; +var Buffer = _dereq_('buffer/').Buffer; // note: the trailing slash is important! + +exports.getImageSize = function(src) { + var data = src.replace(dataUri, ''); + var buff = new Buffer(data, 'base64'); + return sizeOf(buff); +}; + +},{"../../snapshot/helpers":914,"buffer/":111,"image-size":444}],1111:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174890,7 +177129,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { })]; }; -},{"../../components/fx":655,"../../lib":749,"./constants":1077}],1081:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../lib":778,"./constants":1107}],1112:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174920,7 +177159,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./attributes":1075,"./calc":1076,"./defaults":1078,"./event_data":1079,"./hover":1080,"./plot":1082,"./style":1083}],1082:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":1105,"./calc":1106,"./defaults":1108,"./event_data":1109,"./hover":1111,"./plot":1113,"./style":1114}],1113:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -174933,17 +177172,12 @@ module.exports = { var d3 = _dereq_('d3'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = _dereq_('../../constants/xmlns_namespaces'); var constants = _dereq_('./constants'); var unsupportedBrowsers = Lib.isIOS() || Lib.isSafari() || Lib.isIE(); -function compatibleAxis(ax) { - return ax.type === 'linear' && - // y axis must be reversed but x axis mustn't be - ((ax.range[1] > ax.range[0]) === (ax._id.charAt(0) === 'x')); -} - module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { var xa = plotinfo.xaxis; var ya = plotinfo.yaxis; @@ -174954,7 +177188,7 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { var plotGroup = d3.select(this); var cd0 = cd[0]; var trace = cd0.trace; - var fastImage = supportsPixelatedImage && !trace._hasZ && trace._hasSource && compatibleAxis(xa) && compatibleAxis(ya); + var fastImage = supportsPixelatedImage && !trace._hasZ && trace._hasSource && xa.type === 'linear' && ya.type === 'linear'; trace._fastImage = fastImage; var z = cd0.z; @@ -175067,8 +177301,23 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { // Pixelated image rendering // http://phrogz.net/tmp/canvas_image_zoom.html // https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering - image3 - .attr('style', 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;'); + var style = 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;'; + if(fastImage) { + var xRange = Lib.simpleMap(xa.range, xa.r2l); + var yRange = Lib.simpleMap(ya.range, ya.r2l); + + var flipX = xRange[1] < xRange[0]; + var flipY = yRange[1] > yRange[0]; + if(flipX || flipY) { + var tx = left + imageWidth / 2; + var ty = top + imageHeight / 2; + style += 'transform:' + + strTranslate(tx + 'px', ty + 'px') + + 'scale(' + (flipX ? -1 : 1) + ',' + (flipY ? -1 : 1) + ')' + + strTranslate(-tx + 'px', -ty + 'px') + ';'; + } + } + image3.attr('style', style); var p = new Promise(function(resolve) { if(trace._hasZ) { @@ -175140,7 +177389,7 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { }); }; -},{"../../constants/xmlns_namespaces":725,"../../lib":749,"./constants":1077,"d3":169}],1083:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":754,"../../lib":778,"./constants":1107,"d3":169}],1114:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175160,7 +177409,7 @@ module.exports = function style(gd) { }); }; -},{"d3":169}],1084:[function(_dereq_,module,exports){ +},{"d3":169}],1115:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175444,6 +177693,7 @@ module.exports = { showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, editType: 'plot' }, 'plot'), @@ -175479,7 +177729,7 @@ module.exports = { } }; -},{"../../components/color/attributes":614,"../../constants/delta.js":718,"../../constants/docs":719,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/cartesian/layout_attributes":811,"../../plots/domain":824,"../../plots/font_attributes":825}],1085:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../constants/delta.js":747,"../../constants/docs":748,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/cartesian/layout_attributes":841,"../../plots/domain":854,"../../plots/font_attributes":855}],1116:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175502,7 +177752,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1086:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1117:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175539,7 +177789,7 @@ module.exports = { calc: calc }; -},{}],1087:[function(_dereq_,module,exports){ +},{}],1118:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175561,7 +177811,7 @@ module.exports = { horizontalPadding: 10 }; -},{}],1088:[function(_dereq_,module,exports){ +},{}],1119:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175728,7 +177978,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/array_container_defaults":793,"../../plots/cartesian/tick_label_defaults":818,"../../plots/cartesian/tick_mark_defaults":819,"../../plots/cartesian/tick_value_defaults":820,"../../plots/domain":824,"./attributes":1084,"./constants.js":1087}],1089:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/array_container_defaults":822,"../../plots/cartesian/tick_label_defaults":848,"../../plots/cartesian/tick_mark_defaults":849,"../../plots/cartesian/tick_value_defaults":850,"../../plots/domain":854,"./attributes":1115,"./constants.js":1118}],1120:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175758,7 +178008,7 @@ module.exports = { } }; -},{"./attributes":1084,"./base_plot":1085,"./calc":1086,"./defaults":1088,"./plot":1090}],1090:[function(_dereq_,module,exports){ +},{"./attributes":1115,"./base_plot":1116,"./calc":1117,"./defaults":1119,"./plot":1121}],1121:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -175772,6 +178022,8 @@ module.exports = { var d3 = _dereq_('d3'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var rad2deg = Lib.rad2deg; var MID_SHIFT = _dereq_('../../constants/alignment').MID_SHIFT; var Drawing = _dereq_('../../components/drawing'); @@ -176004,7 +178256,7 @@ function drawBulletGauge(gd, plotGroup, cd, opts) { // Enter bullet, axis bullet.enter().append('g').classed('bullet', true); - bullet.attr('transform', 'translate(' + size.l + ', ' + size.t + ')'); + bullet.attr('transform', strTranslate(size.l, size.t)); axisLayer.enter().append('g') .classed('bulletaxis', true) @@ -176023,7 +178275,7 @@ function drawBulletGauge(gd, plotGroup, cd, opts) { ax.setScale(); vals = Axes.calcTicks(ax); - transFn = Axes.makeTransFn(ax); + transFn = Axes.makeTransTickFn(ax); tickSign = Axes.getTickSigns(ax)[2]; shift = size.t + size.h; @@ -176541,7 +178793,7 @@ function drawNumbers(gd, plotGroup, cd, opts) { // Stash translateX translateX = cache(trace, 'numbersTranslate', 0, translateX, key, Math.max); - return strTranslate(translateX, translateY) + ' scale(' + scaleRatio + ')'; + return strTranslate(translateX, translateY) + strScale(scaleRatio); }); } } @@ -176598,10 +178850,6 @@ function mockAxis(gd, opts, zrange) { return axisOut; } -function strTranslate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - function fitTextInsideBox(textBB, width, height) { // compute scaling ratio to have text fit within specified width and height var ratio = Math.min(width / textBB.width, height / textBB.height); @@ -176639,7 +178887,7 @@ function cache(trace, name, initialValue, value, key, fn) { return v; } -},{"../../components/color":615,"../../components/drawing":637,"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_defaults":799,"../../plots/cartesian/layout_attributes":811,"../../plots/cartesian/position_defaults":814,"./constants":1087,"d3":169}],1091:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_defaults":829,"../../plots/cartesian/layout_attributes":841,"../../plots/cartesian/position_defaults":844,"./constants":1118,"d3":169}],1122:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -176833,7 +179081,7 @@ attrs.flatshading.dflt = true; attrs.lighting.facenormalsepsilon.dflt = 0; attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875,"../mesh3d/attributes":1096}],1092:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905,"../mesh3d/attributes":1127}],1123:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -176888,7 +179136,7 @@ module.exports = function calc(gd, trace) { }); }; -},{"../../components/colorscale/calc":623,"../streamtube/calc":1262}],1093:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../streamtube/calc":1294}],1124:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -177944,7 +180192,7 @@ module.exports = { createIsosurfaceTrace: createIsosurfaceTrace, }; -},{"../../components/colorscale":627,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/gl3d/zip3":850,"gl-mesh3d":292}],1094:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/gl3d/zip3":880,"gl-mesh3d":309}],1125:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178061,7 +180309,7 @@ module.exports = { supplyIsoDefaults: supplyIsoDefaults }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../../registry":880,"./attributes":1091}],1095:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../../registry":910,"./attributes":1122}],1126:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178091,7 +180339,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":1091,"./calc":1092,"./convert":1093,"./defaults":1094}],1096:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1122,"./calc":1123,"./convert":1124,"./defaults":1125}],1127:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178272,7 +180520,7 @@ colorScaleAttrs('', { showlegend: extendFlat({}, baseAttrs.showlegend, {dflt: false}) }); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../surface/attributes":1278}],1097:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../surface/attributes":1310}],1128:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178295,7 +180543,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":623}],1098:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651}],1129:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178498,7 +180746,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../components/colorscale":627,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/gl3d/zip3":850,"alpha-shape":69,"convex-hull":135,"delaunay-triangulate":171,"gl-mesh3d":292}],1099:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/gl3d/zip3":880,"alpha-shape":69,"convex-hull":135,"delaunay-triangulate":171,"gl-mesh3d":309}],1130:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178600,7 +180848,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../../registry":880,"./attributes":1096}],1100:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../../registry":910,"./attributes":1127}],1131:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178630,7 +180878,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":1096,"./calc":1097,"./convert":1098,"./defaults":1099}],1101:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1127,"./calc":1128,"./convert":1129,"./defaults":1130}],1132:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178667,6 +180915,10 @@ function directionAttrs(lineColorDefault) { module.exports = { + xperiod: scatterAttrs.xperiod, + xperiod0: scatterAttrs.xperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + x: { valType: 'data_array', editType: 'calc+clearAxisTypes', @@ -178749,7 +181001,7 @@ module.exports = { }), }; -},{"../../components/drawing/attributes":636,"../../components/fx/attributes":646,"../../constants/delta.js":718,"../../lib":749,"../scatter/attributes":1155}],1102:[function(_dereq_,module,exports){ +},{"../../components/drawing/attributes":664,"../../components/fx/attributes":674,"../../constants/delta.js":747,"../../lib":778,"../scatter/attributes":1186}],1133:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178763,6 +181015,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var _ = Lib._; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; function calc(gd, trace) { @@ -178772,10 +181025,12 @@ function calc(gd, trace) { var tickLen = convertTickWidth(gd, xa, trace); var minDiff = trace._minDiff; trace._minDiff = null; + var origX = trace._origX; + trace._origX = null; var x = trace._xcalc; trace._xcalc = null; - var cd = calcCommon(gd, trace, x, ya, ptFunc); + var cd = calcCommon(gd, trace, origX, x, ya, ptFunc); trace._extremes[xa._id] = Axes.findExtremes(xa, x, {vpad: minDiff / 2}); if(cd.length) { @@ -178801,7 +181056,7 @@ function ptFunc(o, h, l, c) { // shared between OHLC and candlestick // ptFunc makes a calcdata point specific to each trace type, from oi, hi, li, ci -function calcCommon(gd, trace, x, ya, ptFunc) { +function calcCommon(gd, trace, origX, x, ya, ptFunc) { var o = ya.makeCalcdata(trace, 'open'); var h = ya.makeCalcdata(trace, 'high'); var l = ya.makeCalcdata(trace, 'low'); @@ -178814,6 +181069,8 @@ function calcCommon(gd, trace, x, ya, ptFunc) { var increasing = true; var cPrev = null; + var hasPeriod = !!trace.xperiodalignment; + var cd = []; for(var i = 0; i < x.length; i++) { var xi = x[i]; @@ -178842,6 +181099,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) { pt.x = pt.pos; pt.y = [li, hi]; + if(hasPeriod) pt.orig_p = origX[i]; // used by hover if(hasTextArray) pt.tx = trace.text[i]; if(hasHovertextArray) pt.htx = trace.hovertext[i]; @@ -178873,7 +181131,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) { * in all traces; when a trace uses this in its * calc step it deletes _minDiff, so that next calc this is * done again in case the data changed. - * also since we need it here, stash _xcalc on the trace + * also since we need it here, stash _xcalc (and _origX) on the trace */ function convertTickWidth(gd, xa, trace) { var minDiff = trace._minDiff; @@ -178895,7 +181153,10 @@ function convertTickWidth(gd, xa, trace) { ) { ohlcTracesOnThisXaxis.push(tracei); - var xcalc = xa.makeCalcdata(tracei, 'x'); + var origX = xa.makeCalcdata(tracei, 'x'); + tracei._origX = origX; + + var xcalc = alignPeriod(trace, xa, 'x', origX); tracei._xcalc = xcalc; var _minDiff = Lib.distinctVals(xcalc).minDiff; @@ -178921,7 +181182,7 @@ module.exports = { calcCommon: calcCommon }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797}],1103:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827}],1134:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -178935,6 +181196,7 @@ module.exports = { var Lib = _dereq_('../../lib'); var handleOHLC = _dereq_('./ohlc_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -178948,6 +181210,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce, {x: true}); + coerce('line.width'); coerce('line.dash'); @@ -178967,7 +181231,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":749,"./attributes":1101,"./ohlc_defaults":1106}],1104:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/period_defaults":1206,"./attributes":1132,"./ohlc_defaults":1137}],1135:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179058,7 +181322,7 @@ function getClosestPoint(pointData, xval, yval, hovermode) { pointData.x0 = xa.c2p(di.pos + centerShift - displayHalfWidth, true); pointData.x1 = xa.c2p(di.pos + centerShift + displayHalfWidth, true); - pointData.xLabelVal = di.pos; + pointData.xLabelVal = di.orig_p !== undefined ? di.orig_p : di.pos; pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; pointData.xSpike = xa.c2p(di.pos, true); @@ -179174,7 +181438,7 @@ module.exports = { hoverOnPoints: hoverOnPoints }; -},{"../../components/color":615,"../../components/fx":655,"../../constants/delta.js":718,"../../lib":749,"../../plots/cartesian/axes":797}],1105:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../constants/delta.js":747,"../../lib":778,"../../plots/cartesian/axes":827}],1136:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179203,7 +181467,7 @@ module.exports = { selectPoints: _dereq_('./select') }; -},{"../../plots/cartesian":810,"./attributes":1101,"./calc":1102,"./defaults":1103,"./hover":1104,"./plot":1107,"./select":1108,"./style":1109}],1106:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./attributes":1132,"./calc":1133,"./defaults":1134,"./hover":1135,"./plot":1138,"./select":1139,"./style":1140}],1137:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179238,7 +181502,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { return len; }; -},{"../../lib":749,"../../registry":880}],1107:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],1138:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179296,7 +181560,7 @@ module.exports = function plot(gd, plotinfo, cdOHLC, ohlcLayer) { }); }; -},{"../../lib":749,"d3":169}],1108:[function(_dereq_,module,exports){ +},{"../../lib":778,"d3":169}],1139:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179341,7 +181605,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],1109:[function(_dereq_,module,exports){ +},{}],1140:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179380,7 +181644,7 @@ module.exports = function style(gd, cd, sel) { }); }; -},{"../../components/color":615,"../../components/drawing":637,"d3":169}],1110:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"d3":169}],1141:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179556,7 +181820,7 @@ module.exports = { showlegend: undefined }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/font_attributes":825,"../../plots/template_attributes":875}],1111:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/font_attributes":855,"../../plots/template_attributes":905}],1142:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -179591,7 +181855,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/get_data":834,"./plot":1116}],1112:[function(_dereq_,module,exports){ +},{"../../plots/get_data":864,"./plot":1147}],1143:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -180110,7 +182374,7 @@ function isRangePermutation(inds) { return true; } -},{"../../components/colorscale/calc":623,"../../components/colorscale/helpers":626,"../../components/drawing":637,"../../lib":749,"../../lib/filter_unique.js":740,"../../lib/gup":746,"fast-isnumeric":241}],1113:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../components/colorscale/helpers":654,"../../components/drawing":665,"../../lib":778,"../../lib/filter_unique.js":769,"../../lib/gup":775,"fast-isnumeric":241}],1144:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -180231,7 +182495,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceFont(coerce, 'tickfont', categoryfontDefault); }; -},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/domain":824,"../parcoords/merge_length":1126,"./attributes":1110}],1114:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/domain":854,"../parcoords/merge_length":1157,"./attributes":1141}],1145:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -180262,7 +182526,7 @@ module.exports = { } }; -},{"./attributes":1110,"./base_plot":1111,"./calc":1112,"./defaults":1113,"./plot":1116}],1115:[function(_dereq_,module,exports){ +},{"./attributes":1141,"./base_plot":1142,"./calc":1143,"./defaults":1144,"./plot":1147}],1146:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -180277,6 +182541,7 @@ var d3 = _dereq_('d3'); var Plotly = _dereq_('../../plot_api/plot_api'); var Fx = _dereq_('../../components/fx'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = _dereq_('../../components/drawing'); var tinycolor = _dereq_('tinycolor2'); var svgTextUtils = _dereq_('../../lib/svg_text_utils'); @@ -180306,7 +182571,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update properties for each trace traceSelection .attr('transform', function(d) { - return 'translate(' + d.x + ', ' + d.y + ')'; + return strTranslate(d.x, d.y); }); // Initialize paths group @@ -180387,7 +182652,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update dimension group transforms dimensionSelection.attr('transform', function(d) { - return 'translate(' + d.x + ', 0)'; + return strTranslate(d.x, 0); }); // Remove any old dimensions @@ -180409,7 +182674,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update category transforms categorySelection .attr('transform', function(d) { - return 'translate(0, ' + d.y + ')'; + return strTranslate(0, d.y); }); @@ -181030,7 +183295,11 @@ function emitPointsEventColorHovermode(bandElement, eventName, event) { * HTML element for band * */ -function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { +function createHoverLabelForCategoryHovermode(gd, rootBBox, bandElement) { + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + // Selections var rectSelection = d3.select(bandElement.parentNode).select('rect.catrect'); var rectBoundingBox = rectSelection.node().getBoundingClientRect(); @@ -181078,8 +183347,8 @@ function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { var hovertext = hoverinfoParts.join('
'); return { trace: trace, - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, + x: scaleX * (hoverCenterX - rootBBox.left), + y: scaleY * (hoverCenterY - rootBBox.top), text: hovertext, color: 'lightgray', borderColor: 'black', @@ -181108,7 +183377,7 @@ function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { * HTML element for band * */ -function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { +function createHoverLabelForDimensionHovermode(gd, rootBBox, bandElement) { var allHoverlabels = []; d3.select(bandElement.parentNode.parentNode) @@ -181116,7 +183385,7 @@ function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { .select('rect.catrect') .each(function() { var bandNode = this; - allHoverlabels.push(createHoverLabelForCategoryHovermode(rootBBox, bandNode)); + allHoverlabels.push(createHoverLabelForCategoryHovermode(gd, rootBBox, bandNode)); }); return allHoverlabels; @@ -181131,7 +183400,11 @@ function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { * HTML element for band * */ -function createHoverLabelForColorHovermode(rootBBox, bandElement) { +function createHoverLabelForColorHovermode(gd, rootBBox, bandElement) { + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var bandBoundingBox = bandElement.getBoundingClientRect(); // Models @@ -181209,8 +183482,8 @@ function createHoverLabelForColorHovermode(rootBBox, bandElement) { return { trace: trace, - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, + x: scaleX * (hoverCenterX - rootBBox.left), + y: scaleY * (hoverCenterY - rootBBox.top), // name: 'NAME', text: hovertext, color: bandViewModel.color, @@ -181273,11 +183546,11 @@ function mouseoverCategoryBand(bandViewModel) { if(bandViewModel.parcatsViewModel.hoverinfoItems.indexOf('none') === -1) { var hoverItems; if(hoveron === 'category') { - hoverItems = createHoverLabelForCategoryHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForCategoryHovermode(gd, rootBBox, bandElement); } else if(hoveron === 'color') { - hoverItems = createHoverLabelForColorHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForColorHovermode(gd, rootBBox, bandElement); } else if(hoveron === 'dimension') { - hoverItems = createHoverLabelForDimensionHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForDimensionHovermode(gd, rootBBox, bandElement); } if(hoverItems) { @@ -181666,13 +183939,13 @@ function updateSvgCategories(parcatsViewModel, hasTransition) { // Update dimension position transition(parcatsViewModel.dimensionSelection) .attr('transform', function(d) { - return 'translate(' + d.x + ', 0)'; + return strTranslate(d.x, 0); }); // Update category position transition(categorySelection) .attr('transform', function(d) { - return 'translate(0, ' + d.y + ')'; + return strTranslate(0, d.y); }); var dimLabelSelection = categorySelection.select('.dimlabel'); @@ -182413,7 +184686,7 @@ function createDimensionViewModel(parcatsViewModel, dimensionModel) { * The parent trace's view model */ -},{"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/svg_text_utils":773,"../../plot_api/plot_api":784,"d3":169,"tinycolor2":548}],1116:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/svg_text_utils":802,"../../plot_api/plot_api":813,"d3":169,"tinycolor2":576}],1147:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182457,7 +184730,7 @@ module.exports = function plot(graphDiv, parcatsModels, transitionOpts, makeOnCo ); }; -},{"./parcats":1115}],1117:[function(_dereq_,module,exports){ +},{"./parcats":1146}],1148:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182586,7 +184859,7 @@ module.exports = { ) }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/plot_template":787,"../../plots/cartesian/layout_attributes":811,"../../plots/domain":824,"../../plots/font_attributes":825}],1118:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/plot_template":816,"../../plots/cartesian/layout_attributes":841,"../../plots/domain":854,"../../plots/font_attributes":855}],1149:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -182602,6 +184875,7 @@ var d3 = _dereq_('d3'); var keyFun = _dereq_('../../lib/gup').keyFun; var repeat = _dereq_('../../lib/gup').repeat; var sortAsc = _dereq_('../../lib').sorterAsc; +var strTranslate = _dereq_('../../lib').strTranslate; var snapRatio = c.bar.snapRatio; function snapOvershoot(v, vAdjacent) { return v * (1 - snapRatio) + vAdjacent * snapRatio; } @@ -182959,7 +185233,7 @@ function renderAxisBrush(axisBrush) { .call(barHorizontalSetup) .call(backgroundBarHorizontalSetup) .style('pointer-events', 'auto') // parent pointer events are disabled; we must have it to register events - .attr('transform', 'translate(0 ' + c.verticalPadding + ')'); + .attr('transform', strTranslate(0, c.verticalPadding)); background .call(attachDragBehavior) @@ -183130,7 +185404,7 @@ module.exports = { cleanRanges: cleanRanges }; -},{"../../lib":749,"../../lib/gup":746,"./constants":1121,"d3":169}],1119:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../lib/gup":775,"./constants":1152,"d3":169}],1150:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183197,7 +185471,7 @@ exports.toSVG = function(gd) { }, 60); }; -},{"../../constants/xmlns_namespaces":725,"../../plots/get_data":834,"./plot":1128,"d3":169}],1120:[function(_dereq_,module,exports){ +},{"../../constants/xmlns_namespaces":754,"../../plots/get_data":864,"./plot":1159,"d3":169}],1151:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183241,7 +185515,7 @@ function constHalf(len) { return out; } -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gup":746}],1121:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gup":775}],1152:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183303,7 +185577,7 @@ module.exports = { } }; -},{}],1122:[function(_dereq_,module,exports){ +},{}],1153:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183423,7 +185697,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('labelside'); }; -},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"../../plots/domain":824,"./attributes":1117,"./axisbrush":1118,"./constants":1121,"./merge_length":1126}],1123:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"../../plots/domain":854,"./attributes":1148,"./axisbrush":1149,"./constants":1152,"./merge_length":1157}],1154:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183448,7 +185722,7 @@ exports.isVisible = function(dimension) { return dimension.visible || !('visible' in dimension); }; -},{"../../lib":749}],1124:[function(_dereq_,module,exports){ +},{"../../lib":778}],1155:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -183479,7 +185753,7 @@ module.exports = { } }; -},{"./attributes":1117,"./base_plot":1119,"./calc":1120,"./defaults":1122,"./plot":1128}],1125:[function(_dereq_,module,exports){ +},{"./attributes":1148,"./base_plot":1150,"./calc":1151,"./defaults":1153,"./plot":1159}],1156:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -184009,7 +186283,7 @@ module.exports = function(canvasGL, d) { }; }; -},{"../../lib":749,"./constants":1121,"glslify":413}],1126:[function(_dereq_,module,exports){ +},{"../../lib":778,"./constants":1152,"glslify":439}],1157:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -184047,7 +186321,7 @@ module.exports = function(traceOut, dimensions, dataAttr, len) { return len; }; -},{}],1127:[function(_dereq_,module,exports){ +},{}],1158:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -184063,6 +186337,8 @@ var rgba = _dereq_('color-rgba'); var Axes = _dereq_('../../plots/cartesian/axes'); var Lib = _dereq_('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var Drawing = _dereq_('../../components/drawing'); var Colorscale = _dereq_('../../components/colorscale'); @@ -184400,8 +186676,7 @@ function styleExtentTexts(selection) { selection .classed(c.cn.axisExtentText, true) .attr('text-anchor', 'middle') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); } function parcoordsInteractionState() { @@ -184569,7 +186844,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .style('pointer-events', 'none'); controlOverlay.attr('transform', function(d) { - return 'translate(' + d.model.translateX + ',' + d.model.translateY + ')'; + return strTranslate(d.model.translateX, d.model.translateY); }); var parcoordsControlView = controlOverlay.selectAll('.' + c.cn.parcoordsControlView) @@ -184580,7 +186855,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.parcoordsControlView, true); parcoordsControlView.attr('transform', function(d) { - return 'translate(' + d.model.pad.l + ',' + d.model.pad.t + ')'; + return strTranslate(d.model.pad.l, d.model.pad.t); }); var yAxis = parcoordsControlView.selectAll('.' + c.cn.yAxis) @@ -184611,7 +186886,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { }); yAxis.attr('transform', function(d) { - return 'translate(' + d.xScale(d.xIndex) + ', 0)'; + return strTranslate(d.xScale(d.xIndex), 0); }); // drag column for reordering columns @@ -184633,8 +186908,8 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { updatePanelLayout(yAxis, p); yAxis.filter(function(e) { return Math.abs(d.xIndex - e.xIndex) !== 0; }) - .attr('transform', function(d) { return 'translate(' + d.xScale(d.xIndex) + ', 0)'; }); - d3.select(this).attr('transform', 'translate(' + d.x + ', 0)'); + .attr('transform', function(d) { return strTranslate(d.xScale(d.xIndex), 0); }); + d3.select(this).attr('transform', strTranslate(d.x, 0)); yAxis.each(function(e, i0, i1) { if(i1 === d.parent.key) p.dimensions[i0] = e; }); p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); p.focusLayer.render && p.focusLayer.render(p.panels); @@ -184645,7 +186920,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { d.canvasX = d.x * d.model.canvasPixelRatio; updatePanelLayout(yAxis, p); d3.select(this) - .attr('transform', function(d) { return 'translate(' + d.x + ', 0)'; }); + .attr('transform', function(d) { return strTranslate(d.x, 0); }); p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); p.focusLayer && p.focusLayer.render(p.panels); p.pickLayer && p.pickLayer.render(p.panels, true); @@ -184705,8 +186980,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axis.selectAll('text') .style('text-shadow', '1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); var axisHeading = axisOverlays.selectAll('.' + c.cn.axisHeading) .data(repeat, keyFun); @@ -184723,7 +186997,6 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisTitle, true) .attr('text-anchor', 'middle') .style('cursor', 'ew-resize') - .style('user-select', 'none') .style('pointer-events', 'auto'); axisTitle @@ -184737,9 +187010,9 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { var tilt = calcTilt(d.model.labelAngle, d.model.labelSide); var r = c.axisTitleOffset; return ( - (tilt.dir > 0 ? '' : 'translate(0,' + (2 * r + d.model.height) + ')') + - 'rotate(' + tilt.degrees + ')' + - 'translate(' + (-r * tilt.dx) + ',' + (-r * tilt.dy) + ')' + (tilt.dir > 0 ? '' : strTranslate(0, 2 * r + d.model.height)) + + strRotate(tilt.degrees) + + strTranslate(-r * tilt.dx, -r * tilt.dy) ); }) .attr('text-anchor', function(d) { @@ -184769,7 +187042,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisExtentTop, true); axisExtentTop - .attr('transform', 'translate(' + 0 + ',' + -c.axisExtentOffset + ')'); + .attr('transform', strTranslate(0, -c.axisExtentOffset)); var axisExtentTopText = axisExtentTop.selectAll('.' + c.cn.axisExtentTopText) .data(repeat, keyFun); @@ -184792,7 +187065,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axisExtentBottom .attr('transform', function(d) { - return 'translate(' + 0 + ',' + (d.model.height + c.axisExtentOffset) + ')'; + return strTranslate(0, d.model.height + c.axisExtentOffset); }); var axisExtentBottomText = axisExtentBottom.selectAll('.' + c.cn.axisExtentBottomText) @@ -184811,7 +187084,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { brush.ensureAxisBrush(axisOverlays); }; -},{"../../components/colorscale":627,"../../components/drawing":637,"../../lib":749,"../../lib/gup":746,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"./axisbrush":1118,"./constants":1121,"./helpers":1123,"./lines":1125,"color-rgba":127,"d3":169}],1128:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/drawing":665,"../../lib":778,"../../lib/gup":775,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"./axisbrush":1149,"./constants":1152,"./helpers":1154,"./lines":1156,"color-rgba":127,"d3":169}],1159:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -184966,7 +187239,7 @@ module.exports = function plot(gd, cdModule) { ); }; -},{"../../lib/prepare_regl":762,"./helpers":1123,"./parcoords":1127}],1129:[function(_dereq_,module,exports){ +},{"../../lib/prepare_regl":791,"./helpers":1154,"./parcoords":1158}],1160:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185237,7 +187510,7 @@ module.exports = { } }; -},{"../../components/color/attributes":614,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/font_attributes":825,"../../plots/template_attributes":875}],1130:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/font_attributes":855,"../../plots/template_attributes":905}],1161:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185260,7 +187533,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1131:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1162:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185443,7 +187716,7 @@ module.exports = { generateExtendedColors: generateExtendedColors }; -},{"../../components/color":615,"fast-isnumeric":241,"tinycolor2":548}],1132:[function(_dereq_,module,exports){ +},{"../../components/color":643,"fast-isnumeric":241,"tinycolor2":576}],1163:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185574,7 +187847,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":749,"../../plots/domain":824,"../bar/defaults":894,"./attributes":1129,"fast-isnumeric":241}],1133:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/domain":854,"../bar/defaults":924,"./attributes":1160,"fast-isnumeric":241}],1164:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185623,7 +187896,7 @@ module.exports = function eventData(pt, trace) { return out; }; -},{"../../components/fx/helpers":651}],1134:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":679}],1165:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185636,19 +187909,21 @@ module.exports = function eventData(pt, trace) { var Lib = _dereq_('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -185665,7 +187940,11 @@ exports.castOption = function castOption(item, indices) { else if(item) return item; }; -},{"../../lib":749}],1135:[function(_dereq_,module,exports){ +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; + +},{"../../lib":778}],1166:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185698,7 +187977,7 @@ module.exports = { } }; -},{"./attributes":1129,"./base_plot":1130,"./calc":1131,"./defaults":1132,"./layout_attributes":1136,"./layout_defaults":1137,"./plot":1138,"./style":1139,"./style_one":1140}],1136:[function(_dereq_,module,exports){ +},{"./attributes":1160,"./base_plot":1161,"./calc":1162,"./defaults":1163,"./layout_attributes":1167,"./layout_defaults":1168,"./plot":1169,"./style":1170,"./style_one":1171}],1167:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185731,7 +188010,7 @@ module.exports = { } }; -},{}],1137:[function(_dereq_,module,exports){ +},{}],1168:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185756,7 +188035,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendpiecolors'); }; -},{"../../lib":749,"./layout_attributes":1136}],1138:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1167}],1169:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -185774,6 +188053,8 @@ var Fx = _dereq_('../../components/fx'); var Color = _dereq_('../../components/color'); var Drawing = _dereq_('../../components/drawing'); var Lib = _dereq_('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = _dereq_('../../lib/svg_text_utils'); var uniformText = _dereq_('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; @@ -186003,9 +188284,9 @@ function plot(gd, cdModule) { } titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); // now make sure no labels overlap (at least within one pie) @@ -186804,7 +189085,7 @@ function setCoords(cd) { var cd0 = cd[0]; var r = cd0.r; var trace = cd0.trace; - var currentAngle = trace.rotation * Math.PI / 180; + var currentAngle = helpers.getRotationAngle(trace.rotation); var angleFactor = 2 * Math.PI / cd0.vTotal; var firstPt = 'px0'; var lastPt = 'px1'; @@ -186934,7 +189215,7 @@ module.exports = { computeTransform: computeTransform }; -},{"../../components/color":615,"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../bar/constants":892,"../bar/uniform_text":906,"./event_data":1133,"./helpers":1134,"d3":169}],1139:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../bar/constants":922,"../bar/uniform_text":936,"./event_data":1164,"./helpers":1165,"d3":169}],1170:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -186967,7 +189248,7 @@ module.exports = function style(gd) { }); }; -},{"../bar/uniform_text":906,"./style_one":1140,"d3":169}],1140:[function(_dereq_,module,exports){ +},{"../bar/uniform_text":936,"./style_one":1171,"d3":169}],1171:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -186991,7 +189272,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":615,"./helpers":1134}],1141:[function(_dereq_,module,exports){ +},{"../../components/color":643,"./helpers":1165}],1172:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187094,7 +189375,7 @@ module.exports = { transforms: undefined }; -},{"../scatter/attributes":1155}],1142:[function(_dereq_,module,exports){ +},{"../scatter/attributes":1186}],1173:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187296,7 +189577,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":772,"../../plots/cartesian/autorange":796,"../scatter/get_trace_color":1165,"gl-pointcloud2d":303}],1143:[function(_dereq_,module,exports){ +},{"../../lib/str2rgbarray":801,"../../plots/cartesian/autorange":826,"../scatter/get_trace_color":1196,"gl-pointcloud2d":324}],1174:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187344,7 +189625,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { traceOut._length = null; }; -},{"../../lib":749,"./attributes":1141}],1144:[function(_dereq_,module,exports){ +},{"../../lib":778,"./attributes":1172}],1175:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187372,7 +189653,7 @@ module.exports = { } }; -},{"../../plots/gl2d":837,"../scatter3d/calc":1183,"./attributes":1141,"./convert":1142,"./defaults":1143}],1145:[function(_dereq_,module,exports){ +},{"../../plots/gl2d":867,"../scatter3d/calc":1215,"./attributes":1172,"./convert":1173,"./defaults":1174}],1176:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187627,7 +189908,7 @@ var attrs = module.exports = overrideAll({ }, 'calc', 'nested'); attrs.transforms = undefined; -},{"../../components/color/attributes":614,"../../components/colorscale/attributes":622,"../../components/fx/attributes":646,"../../constants/docs":719,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/font_attributes":825,"../../plots/template_attributes":875}],1146:[function(_dereq_,module,exports){ +},{"../../components/color/attributes":642,"../../components/colorscale/attributes":650,"../../components/fx/attributes":674,"../../constants/docs":748,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/font_attributes":855,"../../plots/template_attributes":905}],1177:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187766,7 +190047,7 @@ function subplotUpdateFx(gd, index) { dragElement.init(dragOptions); } -},{"../../components/dragelement":634,"../../components/fx/layout_attributes":656,"../../lib":749,"../../lib/setcursor":769,"../../plot_api/edit_types":780,"../../plots/cartesian/select":816,"../../plots/get_data":834,"../../registry":880,"./plot":1151}],1147:[function(_dereq_,module,exports){ +},{"../../components/dragelement":662,"../../components/fx/layout_attributes":684,"../../lib":778,"../../lib/setcursor":798,"../../plot_api/edit_types":809,"../../plots/cartesian/select":846,"../../plots/get_data":864,"../../registry":910,"./plot":1182}],1178:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187955,7 +190236,7 @@ module.exports = function calc(gd, trace) { }); }; -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gup":746,"strongly-connected-components":541}],1148:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gup":775,"strongly-connected-components":569}],1179:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -187990,7 +190271,7 @@ module.exports = { } }; -},{}],1149:[function(_dereq_,module,exports){ +},{}],1180:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -188104,7 +190385,7 @@ function concentrationscalesDefaults(In, Out) { coerce('colorscale'); } -},{"../../components/color":615,"../../components/fx/hoverlabel_defaults":653,"../../lib":749,"../../plot_api/plot_template":787,"../../plots/array_container_defaults":793,"../../plots/domain":824,"./attributes":1145,"tinycolor2":548}],1150:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx/hoverlabel_defaults":681,"../../lib":778,"../../plot_api/plot_template":816,"../../plots/array_container_defaults":822,"../../plots/domain":854,"./attributes":1176,"tinycolor2":576}],1181:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -188131,7 +190412,7 @@ module.exports = { } }; -},{"./attributes":1145,"./base_plot":1146,"./calc":1147,"./defaults":1149,"./plot":1151,"./select.js":1153}],1151:[function(_dereq_,module,exports){ +},{"./attributes":1176,"./base_plot":1177,"./calc":1178,"./defaults":1180,"./plot":1182,"./select.js":1184}],1182:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -188426,10 +190707,14 @@ module.exports = function plot(gd, calcData) { var hovertemplateLabels = {valueLabel: d3.format(d.valueFormat)(d.node.value) + d.valueSuffix}; d.node.fullData = d.node.trace; + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var tooltip = Fx.loneHover({ - x0: hoverCenterX0, - x1: hoverCenterX1, - y: hoverCenterY, + x0: scaleX * hoverCenterX0, + x1: scaleX * hoverCenterX1, + y: scaleY * hoverCenterY, name: d3.format(d.valueFormat)(d.node.value) + d.valueSuffix, text: [ d.node.label, @@ -188503,7 +190788,7 @@ module.exports = function plot(gd, calcData) { ); }; -},{"../../components/color":615,"../../components/fx":655,"../../lib":749,"./constants":1148,"./render":1152,"d3":169}],1152:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../lib":778,"./constants":1179,"./render":1183,"d3":169}],1183:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -188523,6 +190808,7 @@ var d3Sankey = _dereq_('@plotly/d3-sankey'); var d3SankeyCircular = _dereq_('@plotly/d3-sankey-circular'); var d3Force = _dereq_('d3-force'); var Lib = _dereq_('../../lib'); +var strTranslate = Lib.strTranslate; var gup = _dereq_('../../lib/gup'); var keyFun = gup.keyFun; var repeat = gup.repeat; @@ -189033,7 +191319,7 @@ function nodeModel(d, n) { function updateNodePositions(sankeyNode) { sankeyNode .attr('transform', function(d) { - return 'translate(' + d.node.x0.toFixed(3) + ', ' + (d.node.y0).toFixed(3) + ')'; + return strTranslate(d.node.x0.toFixed(3), (d.node.y0).toFixed(3)); }); } @@ -189055,12 +191341,12 @@ function sizeNode(rect) { function salientEnough(d) {return (d.link.width > 1 || d.linkLineWidth > 0);} function sankeyTransform(d) { - var offset = 'translate(' + d.translateX + ',' + d.translateY + ')'; + var offset = strTranslate(d.translateX, d.translateY); return offset + (d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)'); } function nodeCentering(d) { - return 'translate(' + (d.horizontal ? 0 : d.labelY) + ' ' + (d.horizontal ? d.labelY : 0) + ')'; + return strTranslate(d.horizontal ? 0 : d.labelY, d.horizontal ? d.labelY : 0); } function textGuidePath(d) { @@ -189532,7 +191818,6 @@ module.exports = function(gd, svg, calcData, layout, callbacks) { .append('text') .classed(c.cn.nodeLabel, true) .attr('transform', textFlip) - .style('user-select', 'none') .style('cursor', 'default') .style('fill', 'black'); @@ -189569,7 +191854,7 @@ module.exports = function(gd, svg, calcData, layout, callbacks) { .style('fill', nodeTextColor); }; -},{"../../components/color":615,"../../components/drawing":637,"../../lib":749,"../../lib/gup":746,"../../registry":880,"./constants":1148,"@plotly/d3-sankey":56,"@plotly/d3-sankey-circular":55,"d3":169,"d3-force":160,"d3-interpolate":162,"tinycolor2":548}],1153:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../lib":778,"../../lib/gup":775,"../../registry":910,"./constants":1179,"@plotly/d3-sankey":56,"@plotly/d3-sankey-circular":55,"d3":169,"d3-force":160,"d3-interpolate":162,"tinycolor2":576}],1184:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189607,7 +191892,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{}],1154:[function(_dereq_,module,exports){ +},{}],1185:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189659,7 +191944,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":749}],1155:[function(_dereq_,module,exports){ +},{"../../lib":778}],1186:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -189678,8 +191963,41 @@ var dash = _dereq_('../../components/drawing/attributes').dash; var Drawing = _dereq_('../../components/drawing'); var constants = _dereq_('./constants'); + var extendFlat = _dereq_('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + + editType: 'calc', + + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + + editType: 'calc', + + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + + editType: 'calc', + + }; +} + module.exports = { x: { valType: 'data_array', @@ -189726,6 +192044,13 @@ module.exports = { }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', @@ -190073,7 +192398,7 @@ module.exports = { } }; -},{"../../components/colorscale/attributes":622,"../../components/drawing":637,"../../components/drawing/attributes":636,"../../lib/extend":739,"../../plots/font_attributes":825,"../../plots/template_attributes":875,"./constants":1159}],1156:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../components/drawing":665,"../../components/drawing/attributes":664,"../../lib/extend":768,"../../plots/font_attributes":855,"../../plots/template_attributes":905,"./constants":1190}],1187:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190088,6 +192413,7 @@ var isNumeric = _dereq_('fast-isnumeric'); var Lib = _dereq_('../../lib'); var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; var subTypes = _dereq_('./subtypes'); @@ -190099,8 +192425,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -190131,6 +192460,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -190138,6 +192470,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes @@ -190358,7 +192697,7 @@ module.exports = { getStackOpts: getStackOpts }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"./arrays_to_calcdata":1154,"./calc_selection":1157,"./colorscale_calc":1158,"./subtypes":1179,"fast-isnumeric":241}],1157:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"./arrays_to_calcdata":1185,"./calc_selection":1188,"./colorscale_calc":1189,"./subtypes":1211,"fast-isnumeric":241}],1188:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190377,7 +192716,7 @@ module.exports = function calcSelection(cd, trace) { } }; -},{"../../lib":749}],1158:[function(_dereq_,module,exports){ +},{"../../lib":778}],1189:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190420,7 +192759,7 @@ module.exports = function calcMarkerColorscale(gd, trace) { } }; -},{"../../components/colorscale/calc":623,"../../components/colorscale/helpers":626,"./subtypes":1179}],1159:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../components/colorscale/helpers":654,"./subtypes":1211}],1190:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190449,7 +192788,7 @@ module.exports = { eventDataKeys: [] }; -},{}],1160:[function(_dereq_,module,exports){ +},{}],1191:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190630,7 +192969,7 @@ function getInterp(calcTrace, index, position, posAttr) { return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } -},{"./calc":1156}],1161:[function(_dereq_,module,exports){ +},{"./calc":1187}],1192:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190669,7 +193008,7 @@ module.exports = function crossTraceDefaults(fullData) { } }; -},{}],1162:[function(_dereq_,module,exports){ +},{}],1193:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190687,6 +193026,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('./constants'); var subTypes = _dereq_('./subtypes'); var handleXYDefaults = _dereq_('./xy_defaults'); +var handlePeriodDefaults = _dereq_('./period_defaults'); var handleStackDefaults = _dereq_('./stack_defaults'); var handleMarkerDefaults = _dereq_('./marker_defaults'); var handleLineDefaults = _dereq_('./line_defaults'); @@ -190704,6 +193044,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? @@ -190759,7 +193101,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../../registry":880,"./attributes":1155,"./constants":1159,"./fillcolor_defaults":1163,"./line_defaults":1168,"./line_shape_defaults":1170,"./marker_defaults":1174,"./stack_defaults":1177,"./subtypes":1179,"./text_defaults":1180,"./xy_defaults":1181}],1163:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"./attributes":1186,"./constants":1190,"./fillcolor_defaults":1194,"./line_defaults":1199,"./line_shape_defaults":1201,"./marker_defaults":1205,"./period_defaults":1206,"./stack_defaults":1209,"./subtypes":1211,"./text_defaults":1212,"./xy_defaults":1213}],1194:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190796,7 +193138,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":615,"../../lib":749}],1164:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778}],1195:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190822,7 +193164,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":797}],1165:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827}],1196:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190871,7 +193213,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":615,"./subtypes":1179}],1166:[function(_dereq_,module,exports){ +},{"../../components/color":643,"./subtypes":1211}],1197:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -190952,8 +193294,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), @@ -191066,7 +193408,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":615,"../../components/fx":655,"../../lib":749,"../../registry":880,"./get_trace_color":1165}],1167:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/fx":683,"../../lib":778,"../../registry":910,"./get_trace_color":1196}],1198:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191112,7 +193454,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"./arrays_to_calcdata":1154,"./attributes":1155,"./calc":1156,"./cross_trace_calc":1160,"./cross_trace_defaults":1161,"./defaults":1162,"./format_labels":1164,"./hover":1166,"./marker_colorbar":1173,"./plot":1175,"./select":1176,"./style":1178,"./subtypes":1179}],1168:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"./arrays_to_calcdata":1185,"./attributes":1186,"./calc":1187,"./cross_trace_calc":1191,"./cross_trace_defaults":1192,"./defaults":1193,"./format_labels":1195,"./hover":1197,"./marker_colorbar":1204,"./plot":1207,"./select":1208,"./style":1210,"./subtypes":1211}],1199:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191143,7 +193485,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749}],1169:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778}],1200:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191604,7 +193946,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":724,"../../lib":749,"./constants":1159}],1170:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"./constants":1190}],1201:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191623,7 +193965,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],1171:[function(_dereq_,module,exports){ +},{}],1202:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191713,7 +194055,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { return cdscatterSorted; }; -},{}],1172:[function(_dereq_,module,exports){ +},{}],1203:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191755,7 +194097,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":241}],1173:[function(_dereq_,module,exports){ +},{"fast-isnumeric":241}],1204:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191773,7 +194115,7 @@ module.exports = { max: 'cmax' }; -},{}],1174:[function(_dereq_,module,exports){ +},{}],1205:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -191854,7 +194196,54 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":615,"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"./subtypes":1179}],1175:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"./subtypes":1211}],1206:[function(_dereq_,module,exports){ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = _dereq_('../../lib').dateTick0; +var numConstants = _dereq_('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; + +},{"../../constants/numerical":753,"../../lib":778}],1207:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192415,7 +194804,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":637,"../../lib":749,"../../lib/polygon":761,"../../registry":880,"./line_points":1169,"./link_traces":1171,"./subtypes":1179,"d3":169}],1176:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/polygon":790,"../../registry":910,"./line_points":1200,"./link_traces":1202,"./subtypes":1211,"d3":169}],1208:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192469,7 +194858,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"./subtypes":1179}],1177:[function(_dereq_,module,exports){ +},{"./subtypes":1211}],1209:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192574,7 +194963,7 @@ module.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) } }; -},{}],1178:[function(_dereq_,module,exports){ +},{}],1210:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192645,7 +195034,7 @@ module.exports = { styleOnSelect: styleOnSelect }; -},{"../../components/drawing":637,"../../registry":880,"d3":169}],1179:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../registry":910,"d3":169}],1211:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192684,7 +195073,7 @@ module.exports = { } }; -},{"../../lib":749}],1180:[function(_dereq_,module,exports){ +},{"../../lib":778}],1212:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192714,7 +195103,7 @@ module.exports = function(traceIn, traceOut, layout, coerce, opts) { } }; -},{"../../lib":749}],1181:[function(_dereq_,module,exports){ +},{"../../lib":778}],1213:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192758,7 +195147,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../lib":749,"../../registry":880}],1182:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910}],1214:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192904,7 +195293,7 @@ var attrs = module.exports = overrideAll({ attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; -},{"../../components/colorscale/attributes":622,"../../constants/gl3d_dashes":721,"../../constants/gl3d_markers":722,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1183:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../constants/gl3d_dashes":750,"../../constants/gl3d_markers":751,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1215:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -192932,7 +195321,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":1154,"../scatter/colorscale_calc":1158}],1184:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":1185,"../scatter/colorscale_calc":1189}],1216:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193019,7 +195408,7 @@ function calculateErrors(data, scaleFactor, sceneLayout) { module.exports = calculateErrors; -},{"../../registry":880}],1185:[function(_dereq_,module,exports){ +},{"../../registry":910}],1217:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193353,11 +195742,11 @@ function convertPlotlyOptions(scene, data) { return params; } -function arrayToColor(color) { - if(Array.isArray(color)) { +function _arrayToColor(color) { + if(Lib.isArrayOrTypedArray(color)) { var c = color[0]; - if(Array.isArray(c)) color = c; + if(Lib.isArrayOrTypedArray(c)) color = c; return 'rgb(' + color.slice(0, 3).map(function(x) { return Math.round(x * 255); @@ -193367,6 +195756,18 @@ function arrayToColor(color) { return null; } +function arrayToColor(colors) { + if(!Lib.isArrayOrTypedArray(colors)) { + return null; + } + + if((colors.length === 4) && (typeof colors[0] === 'number')) { + return _arrayToColor(colors); + } + + return colors.map(_arrayToColor); +} + proto.update = function(data) { var gl = this.scene.glplot.gl; var lineOptions; @@ -193561,7 +195962,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../components/fx/helpers":651,"../../constants/gl3d_dashes":721,"../../constants/gl3d_markers":722,"../../lib":749,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/cartesian/axes":797,"../scatter/make_bubble_size_func":1172,"./calc_errors":1184,"delaunay-triangulate":171,"gl-error3d":264,"gl-line3d":271,"gl-mesh3d":292,"gl-scatter3d":308}],1186:[function(_dereq_,module,exports){ +},{"../../components/fx/helpers":679,"../../constants/gl3d_dashes":750,"../../constants/gl3d_markers":751,"../../lib":778,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/cartesian/axes":827,"../scatter/make_bubble_size_func":1203,"./calc_errors":1216,"delaunay-triangulate":171,"gl-error3d":266,"gl-line3d":275,"gl-mesh3d":309,"gl-scatter3d":330}],1218:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193650,7 +196051,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce, layout) { return len; } -},{"../../lib":749,"../../registry":880,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1182}],1187:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1214}],1219:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193689,7 +196090,7 @@ module.exports = { } }; -},{"../../constants/gl3d_markers":722,"../../plots/gl3d":839,"./attributes":1182,"./calc":1183,"./convert":1185,"./defaults":1186}],1188:[function(_dereq_,module,exports){ +},{"../../constants/gl3d_markers":751,"../../plots/gl3d":869,"./attributes":1214,"./calc":1215,"./convert":1217,"./defaults":1218}],1220:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193788,7 +196189,7 @@ module.exports = { hovertemplate: hovertemplateAttrs() }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1189:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1221:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193847,7 +196248,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../carpet/lookup_carpetid":950,"../scatter/arrays_to_calcdata":1154,"../scatter/calc":1156,"../scatter/calc_selection":1157,"../scatter/colorscale_calc":1158,"fast-isnumeric":241}],1190:[function(_dereq_,module,exports){ +},{"../carpet/lookup_carpetid":980,"../scatter/arrays_to_calcdata":1185,"../scatter/calc":1187,"../scatter/calc_selection":1188,"../scatter/colorscale_calc":1189,"fast-isnumeric":241}],1222:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193937,7 +196338,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/line_shape_defaults":1170,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1188}],1191:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/line_shape_defaults":1201,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1220}],1223:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193958,7 +196359,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],1192:[function(_dereq_,module,exports){ +},{}],1224:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -193985,7 +196386,7 @@ module.exports = function formatLabels(cdi, trace) { return labels; }; -},{}],1193:[function(_dereq_,module,exports){ +},{}],1225:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194076,7 +196477,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../lib":749,"../scatter/hover":1166}],1194:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/hover":1197}],1226:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194110,7 +196511,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1188,"./calc":1189,"./defaults":1190,"./event_data":1191,"./format_labels":1192,"./hover":1193,"./plot":1195}],1195:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1220,"./calc":1221,"./defaults":1222,"./event_data":1223,"./format_labels":1224,"./hover":1225,"./plot":1227}],1227:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194154,7 +196555,7 @@ module.exports = function plot(gd, plotinfoproxy, data, layer) { } }; -},{"../../components/drawing":637,"../../plots/cartesian/axes":797,"../scatter/plot":1175}],1196:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../plots/cartesian/axes":827,"../scatter/plot":1207}],1228:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194273,7 +196674,7 @@ module.exports = overrideAll({ hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorscale/attributes":622,"../../components/drawing/attributes":636,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1197:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../components/drawing/attributes":664,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1229:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194341,7 +196742,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../constants/numerical":724,"../../lib":749,"../scatter/arrays_to_calcdata":1154,"../scatter/calc_selection":1157,"../scatter/colorscale_calc":1158,"fast-isnumeric":241}],1198:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../scatter/arrays_to_calcdata":1185,"../scatter/calc_selection":1188,"../scatter/colorscale_calc":1189,"fast-isnumeric":241}],1230:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194424,7 +196825,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1196}],1199:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1228}],1231:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194451,7 +196852,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],1200:[function(_dereq_,module,exports){ +},{}],1232:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194476,7 +196877,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":797}],1201:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827}],1233:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194588,7 +196989,7 @@ function getExtraText(trace, pt, pointData, labels) { return text.join('
'); } -},{"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../scatter/get_trace_color":1165,"./attributes":1196}],1202:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../scatter/get_trace_color":1196,"./attributes":1228}],1234:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194623,7 +197024,7 @@ module.exports = { } }; -},{"../../plots/geo":829,"../scatter/marker_colorbar":1173,"../scatter/style":1178,"./attributes":1196,"./calc":1197,"./defaults":1198,"./event_data":1199,"./format_labels":1200,"./hover":1201,"./plot":1203,"./select":1204,"./style":1205}],1203:[function(_dereq_,module,exports){ +},{"../../plots/geo":859,"../scatter/marker_colorbar":1204,"../scatter/style":1210,"./attributes":1228,"./calc":1229,"./defaults":1230,"./event_data":1231,"./format_labels":1232,"./hover":1233,"./plot":1235,"./select":1236,"./style":1237}],1235:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194752,7 +197153,7 @@ module.exports = { plot: plot }; -},{"../../constants/numerical":724,"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/geojson_utils":743,"../../lib/topojson_utils":776,"../../plots/cartesian/autorange":796,"../scatter/calc":1156,"../scatter/subtypes":1179,"./style":1205,"d3":169}],1204:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/geojson_utils":772,"../../lib/topojson_utils":805,"../../plots/cartesian/autorange":826,"../scatter/calc":1187,"../scatter/subtypes":1211,"./style":1237,"d3":169}],1236:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194809,7 +197210,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"../../constants/numerical":724,"../scatter/subtypes":1179}],1205:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../scatter/subtypes":1211}],1237:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194858,7 +197259,7 @@ function styleTrace(gd, calcTrace) { }); } -},{"../../components/color":615,"../../components/drawing":637,"../scatter/style":1178,"d3":169}],1206:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../scatter/style":1210,"d3":169}],1238:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194889,6 +197290,13 @@ var attrs = module.exports = overrideAll({ y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, hovertext: scatterAttrs.hovertext, @@ -194956,7 +197364,7 @@ attrs.x.editType = attrs.y.editType = attrs.x0.editType = attrs.y0.editType = 'c attrs.hovertemplate = scatterAttrs.hovertemplate; attrs.texttemplate = scatterAttrs.texttemplate; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../scatter/attributes":1155,"./constants":1208}],1207:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../scatter/attributes":1186,"./constants":1240}],1239:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -194972,6 +197380,7 @@ var cluster = _dereq_('@plotly/point-cluster'); var Lib = _dereq_('../../lib'); var AxisIDs = _dereq_('../../plots/cartesian/axis_ids'); var findExtremes = _dereq_('../../plots/cartesian/autorange').findExtremes; +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var scatterCalc = _dereq_('../scatter/calc'); var calcMarkerSize = scatterCalc.calcMarkerSize; @@ -194995,8 +197404,15 @@ module.exports = function calc(gd, trace) { var stash = {}; var i, xx, yy; - var x = trace._x = xa.makeCalcdata(trace, 'x'); - var y = trace._y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; + + if(trace.xperiodalignment) trace._origX = origX; + if(trace.yperiodalignment) trace._origY = origY; // we need hi-precision for scatter2d, // regl-scatter2d uses NaNs for bad/missing values @@ -195134,7 +197550,7 @@ function sceneOptions(gd, subplot, trace, positions, x, y) { return opts; } -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/autorange":796,"../../plots/cartesian/axis_ids":800,"../scatter/calc":1156,"../scatter/colorscale_calc":1158,"./constants":1208,"./convert":1209,"./scene_update":1217,"@plotly/point-cluster":57}],1208:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/autorange":826,"../../plots/cartesian/axis_ids":830,"../scatter/calc":1187,"../scatter/colorscale_calc":1189,"./constants":1240,"./convert":1241,"./scene_update":1249,"@plotly/point-cluster":57}],1240:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195167,7 +197583,7 @@ module.exports = { } }; -},{}],1209:[function(_dereq_,module,exports){ +},{}],1241:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195818,7 +198234,7 @@ module.exports = { textPosition: convertTextPosition }; -},{"../../components/drawing":637,"../../components/fx/helpers":651,"../../constants/interactions":723,"../../lib":749,"../../lib/gl_format_color":745,"../../plots/cartesian/axis_ids":800,"../../registry":880,"../scatter/make_bubble_size_func":1172,"../scatter/subtypes":1179,"./constants":1208,"./helpers":1213,"color-normalize":125,"fast-isnumeric":241,"svg-path-sdf":546}],1210:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../components/fx/helpers":679,"../../constants/interactions":752,"../../lib":778,"../../lib/gl_format_color":774,"../../plots/cartesian/axis_ids":830,"../../registry":910,"../scatter/make_bubble_size_func":1203,"../scatter/subtypes":1211,"./constants":1240,"./helpers":1245,"color-normalize":125,"fast-isnumeric":241,"svg-path-sdf":574}],1242:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195837,6 +198253,7 @@ var attributes = _dereq_('./attributes'); var constants = _dereq_('../scatter/constants'); var subTypes = _dereq_('../scatter/subtypes'); var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var handleMarkerDefaults = _dereq_('../scatter/marker_defaults'); var handleLineDefaults = _dereq_('../scatter/line_defaults'); var handleFillColorDefaults = _dereq_('../scatter/fillcolor_defaults'); @@ -195855,6 +198272,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut.visible = false; return; } + + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines'; coerce('text'); @@ -195893,7 +198313,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../../registry":880,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"../scatter/xy_defaults":1181,"./attributes":1206,"./helpers":1213}],1211:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/period_defaults":1206,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"../scatter/xy_defaults":1213,"./attributes":1238,"./helpers":1245}],1243:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195949,7 +198369,7 @@ module.exports = { styleTextSelection: styleTextSelection }; -},{"../../components/color":615,"../../constants/interactions":723,"../../lib":749}],1212:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../constants/interactions":752,"../../lib":778}],1244:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195969,7 +198389,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return scatterFormatLabels(cdi, trace, fullLayout); }; -},{"../scatter/format_labels":1164}],1213:[function(_dereq_,module,exports){ +},{"../scatter/format_labels":1195}],1245:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -195994,7 +198414,7 @@ exports.isDotSymbol = function(symbol) { symbol > 200; }; -},{"./constants":1208}],1214:[function(_dereq_,module,exports){ +},{"./constants":1240}],1246:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196158,16 +198578,19 @@ function calcHover(pointData, x, y, trace) { var fakeCd = {}; fakeCd[pointData.index] = di; + var origX = trace._origX; + var origY = trace._origY; + var pointData2 = Lib.extendFlat({}, pointData, { color: getTraceColor(trace, di), x0: xp - rad, x1: xp + rad, - xLabelVal: di.x, + xLabelVal: origX ? origX[id] : di.x, y0: yp - rad, y1: yp + rad, - yLabelVal: di.y, + yLabelVal: origY ? origY[id] : di.y, cd: fakeCd, distance: minDist, @@ -196191,7 +198614,7 @@ module.exports = { calcHover: calcHover }; -},{"../../lib":749,"../../registry":880,"../scatter/get_trace_color":1165}],1215:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../registry":910,"../scatter/get_trace_color":1196}],1247:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196226,7 +198649,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../scatter/cross_trace_defaults":1161,"../scatter/marker_colorbar":1173,"./attributes":1206,"./calc":1207,"./defaults":1210,"./format_labels":1212,"./hover":1214,"./plot":1216,"./select":1218}],1216:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../scatter/cross_trace_defaults":1192,"../scatter/marker_colorbar":1204,"./attributes":1238,"./calc":1239,"./defaults":1242,"./format_labels":1244,"./hover":1246,"./plot":1248,"./select":1250}],1248:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196595,7 +199018,7 @@ module.exports = function plot(gd, subplot, cdata) { } }; -},{"../../components/dragelement/helpers":633,"../../lib":749,"../../lib/prepare_regl":762,"../scatter/link_traces":1171,"../scatter/subtypes":1179,"./edit_style":1211,"gl-text":326,"regl-error2d":508,"regl-line2d":509,"regl-scatter2d":510}],1217:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":661,"../../lib":778,"../../lib/prepare_regl":791,"../scatter/link_traces":1202,"../scatter/subtypes":1211,"./edit_style":1243,"gl-text":352,"regl-error2d":534,"regl-line2d":535,"regl-scatter2d":537}],1249:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196753,7 +199176,7 @@ module.exports = function sceneUpdate(gd, subplot) { return scene; }; -},{"../../lib":749}],1218:[function(_dereq_,module,exports){ +},{"../../lib":778}],1250:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196832,7 +199255,7 @@ module.exports = function select(searchInfo, selectionTester) { return selection; }; -},{"../scatter/subtypes":1179,"./edit_style":1211}],1219:[function(_dereq_,module,exports){ +},{"../scatter/subtypes":1211,"./edit_style":1243}],1251:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -196945,7 +199368,7 @@ module.exports = overrideAll({ hovertemplate: hovertemplateAttrs(), }, 'calc', 'nested'); -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/mapbox/layout_attributes":856,"../../plots/template_attributes":875,"../scatter/attributes":1155,"../scattergeo/attributes":1196}],1220:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/mapbox/layout_attributes":886,"../../plots/template_attributes":905,"../scatter/attributes":1186,"../scattergeo/attributes":1228}],1252:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197280,7 +199703,7 @@ function isBADNUM(lonlat) { return lonlat[0] === BADNUM; } -},{"../../components/colorscale":627,"../../components/drawing":637,"../../components/fx/helpers":651,"../../constants/numerical":724,"../../lib":749,"../../lib/geojson_utils":743,"../../lib/svg_text_utils":773,"../../plots/mapbox/convert_text_opts":853,"../scatter/make_bubble_size_func":1172,"../scatter/subtypes":1179,"fast-isnumeric":241}],1221:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../components/drawing":665,"../../components/fx/helpers":679,"../../constants/numerical":753,"../../lib":778,"../../lib/geojson_utils":772,"../../lib/svg_text_utils":802,"../../plots/mapbox/convert_text_opts":883,"../scatter/make_bubble_size_func":1203,"../scatter/subtypes":1211,"fast-isnumeric":241}],1253:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197358,7 +199781,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":749,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1219}],1222:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1251}],1254:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197378,7 +199801,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1223:[function(_dereq_,module,exports){ +},{}],1255:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197404,7 +199827,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":797}],1224:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827}],1256:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197516,7 +199939,7 @@ function getExtraText(trace, di, labels) { return text.join('
'); } -},{"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../scatter/get_trace_color":1165}],1225:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../scatter/get_trace_color":1196}],1257:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197555,7 +199978,7 @@ module.exports = { } }; -},{"../../plots/mapbox":854,"../scatter/marker_colorbar":1173,"../scattergeo/calc":1197,"./attributes":1219,"./defaults":1221,"./event_data":1222,"./format_labels":1223,"./hover":1224,"./plot":1226,"./select":1227}],1226:[function(_dereq_,module,exports){ +},{"../../plots/mapbox":884,"../scatter/marker_colorbar":1204,"../scattergeo/calc":1229,"./attributes":1251,"./defaults":1253,"./event_data":1254,"./format_labels":1255,"./hover":1256,"./plot":1258,"./select":1259}],1258:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197688,7 +200111,7 @@ module.exports = function createScatterMapbox(subplot, calcTrace) { return scatterMapbox; }; -},{"../../plots/mapbox/constants":852,"./convert":1220}],1227:[function(_dereq_,module,exports){ +},{"../../plots/mapbox/constants":882,"./convert":1252}],1259:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197743,7 +200166,7 @@ module.exports = function selectPoints(searchInfo, selectionTester) { return selection; }; -},{"../../constants/numerical":724,"../../lib":749,"../scatter/subtypes":1179}],1228:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../scatter/subtypes":1211}],1260:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197860,7 +200283,7 @@ module.exports = { unselected: scatterAttrs.unselected }; -},{"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1229:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1261:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -197915,7 +200338,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":724,"../../plots/cartesian/axes":797,"../scatter/arrays_to_calcdata":1154,"../scatter/calc":1156,"../scatter/calc_selection":1157,"../scatter/colorscale_calc":1158,"fast-isnumeric":241}],1230:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../plots/cartesian/axes":827,"../scatter/arrays_to_calcdata":1185,"../scatter/calc":1187,"../scatter/calc_selection":1188,"../scatter/colorscale_calc":1189,"fast-isnumeric":241}],1262:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198022,7 +200445,7 @@ module.exports = { supplyDefaults: supplyDefaults }; -},{"../../lib":749,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/line_shape_defaults":1170,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1228}],1231:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/line_shape_defaults":1201,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1260}],1263:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198064,7 +200487,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../lib":749,"../../plots/cartesian/axes":797}],1232:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827}],1264:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198140,7 +200563,7 @@ module.exports = { makeHoverPointText: makeHoverPointText }; -},{"../scatter/hover":1166}],1233:[function(_dereq_,module,exports){ +},{"../scatter/hover":1197}],1265:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198174,7 +200597,7 @@ module.exports = { } }; -},{"../../plots/polar":863,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1228,"./calc":1229,"./defaults":1230,"./format_labels":1231,"./hover":1232,"./plot":1234}],1234:[function(_dereq_,module,exports){ +},{"../../plots/polar":893,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1260,"./calc":1261,"./defaults":1262,"./format_labels":1263,"./hover":1264,"./plot":1266}],1266:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198224,7 +200647,7 @@ module.exports = function plot(gd, subplot, moduleCalcData) { scatterPlot(gd, plotinfo, moduleCalcData, mlayer); }; -},{"../../constants/numerical":724,"../scatter/plot":1175}],1235:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../scatter/plot":1207}],1267:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198275,7 +200698,7 @@ module.exports = { unselected: scatterPolarAttrs.unselected }; -},{"../../plots/template_attributes":875,"../scattergl/attributes":1206,"../scatterpolar/attributes":1228}],1236:[function(_dereq_,module,exports){ +},{"../../plots/template_attributes":905,"../scattergl/attributes":1238,"../scatterpolar/attributes":1260}],1268:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198327,7 +200750,7 @@ module.exports = function calc(gd, trace) { return [{x: false, y: false, t: stash, trace: trace}]; }; -},{"../../plots/cartesian/axes":797,"../scatter/calc":1156,"../scatter/colorscale_calc":1158,"../scattergl/constants":1208,"../scattergl/convert":1209}],1237:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827,"../scatter/calc":1187,"../scatter/colorscale_calc":1189,"../scattergl/constants":1240,"../scattergl/convert":1241}],1269:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198389,7 +200812,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"../scatterpolar/defaults":1230,"./attributes":1235}],1238:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"../scatterpolar/defaults":1262,"./attributes":1267}],1270:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198409,7 +200832,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return scatterPolarFormatLabels(cdi, trace, fullLayout); }; -},{"../scatterpolar/format_labels":1231}],1239:[function(_dereq_,module,exports){ +},{"../scatterpolar/format_labels":1263}],1271:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198459,7 +200882,7 @@ module.exports = { hoverPoints: hoverPoints }; -},{"../scattergl/hover":1214,"../scatterpolar/hover":1232}],1240:[function(_dereq_,module,exports){ +},{"../scattergl/hover":1246,"../scatterpolar/hover":1264}],1272:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198492,7 +200915,7 @@ module.exports = { } }; -},{"../../plots/polar":863,"../scatter/marker_colorbar":1173,"../scattergl/select":1218,"./attributes":1235,"./calc":1236,"./defaults":1237,"./format_labels":1238,"./hover":1239,"./plot":1241}],1241:[function(_dereq_,module,exports){ +},{"../../plots/polar":893,"../scatter/marker_colorbar":1204,"../scattergl/select":1250,"./attributes":1267,"./calc":1268,"./defaults":1269,"./format_labels":1270,"./hover":1271,"./plot":1273}],1273:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198630,7 +201053,7 @@ module.exports = function plot(gd, subplot, cdata) { return scatterglPlot(gd, subplot, cdata); }; -},{"../../lib":749,"../scattergl/constants":1208,"../scattergl/convert":1209,"../scattergl/plot":1216,"../scattergl/scene_update":1217,"@plotly/point-cluster":57,"fast-isnumeric":241}],1242:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scattergl/constants":1240,"../scattergl/convert":1241,"../scattergl/plot":1248,"../scattergl/scene_update":1249,"@plotly/point-cluster":57,"fast-isnumeric":241}],1274:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198738,7 +201161,7 @@ module.exports = { hovertemplate: hovertemplateAttrs(), }; -},{"../../components/colorscale/attributes":622,"../../components/drawing/attributes":636,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1243:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../components/drawing/attributes":664,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1275:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198819,7 +201242,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":1154,"../scatter/calc":1156,"../scatter/calc_selection":1157,"../scatter/colorscale_calc":1158,"fast-isnumeric":241}],1244:[function(_dereq_,module,exports){ +},{"../scatter/arrays_to_calcdata":1185,"../scatter/calc":1187,"../scatter/calc_selection":1188,"../scatter/colorscale_calc":1189,"fast-isnumeric":241}],1276:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198923,7 +201346,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; -},{"../../lib":749,"../scatter/constants":1159,"../scatter/fillcolor_defaults":1163,"../scatter/line_defaults":1168,"../scatter/line_shape_defaults":1170,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1242}],1245:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/constants":1190,"../scatter/fillcolor_defaults":1194,"../scatter/line_defaults":1199,"../scatter/line_shape_defaults":1201,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1274}],1277:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198955,7 +201378,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) { return out; }; -},{}],1246:[function(_dereq_,module,exports){ +},{}],1278:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -198979,7 +201402,7 @@ module.exports = function formatLabels(cdi, trace, fullLayout) { return labels; }; -},{"../../plots/cartesian/axes":797}],1247:[function(_dereq_,module,exports){ +},{"../../plots/cartesian/axes":827}],1279:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199053,7 +201476,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../scatter/hover":1166}],1248:[function(_dereq_,module,exports){ +},{"../scatter/hover":1197}],1280:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199087,7 +201510,7 @@ module.exports = { } }; -},{"../../plots/ternary":876,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1242,"./calc":1243,"./defaults":1244,"./event_data":1245,"./format_labels":1246,"./hover":1247,"./plot":1249}],1249:[function(_dereq_,module,exports){ +},{"../../plots/ternary":906,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1274,"./calc":1275,"./defaults":1276,"./event_data":1277,"./format_labels":1278,"./hover":1279,"./plot":1281}],1281:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199120,7 +201543,7 @@ module.exports = function plot(gd, ternary, moduleCalcData) { scatterPlot(gd, plotinfo, moduleCalcData, scatterLayer); }; -},{"../scatter/plot":1175}],1250:[function(_dereq_,module,exports){ +},{"../scatter/plot":1207}],1282:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199287,7 +201710,7 @@ module.exports = { opacity: scatterGlAttrs.opacity }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803,"../../plots/template_attributes":875,"../scatter/attributes":1155,"../scattergl/attributes":1206}],1251:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833,"../../plots/template_attributes":905,"../scatter/attributes":1186,"../scattergl/attributes":1238}],1283:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199506,7 +201929,7 @@ module.exports = { toSVG: Cartesian.toSVG }; -},{"../../lib/prepare_regl":762,"../../plots/cartesian":810,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_ids":800,"../../plots/get_data":834,"../../registry":880,"regl-line2d":509}],1252:[function(_dereq_,module,exports){ +},{"../../lib/prepare_regl":791,"../../plots/cartesian":840,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_ids":830,"../../plots/get_data":864,"../../registry":910,"regl-line2d":535}],1284:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199617,7 +202040,7 @@ module.exports = function calc(gd, trace) { return [{x: false, y: false, t: {}, trace: trace}]; }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axis_ids":800,"../scatter/calc":1156,"../scatter/colorscale_calc":1158,"../scattergl/constants":1208,"../scattergl/convert":1209,"./scene_update":1259}],1253:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axis_ids":830,"../scatter/calc":1187,"../scatter/colorscale_calc":1189,"../scattergl/constants":1240,"../scattergl/convert":1241,"./scene_update":1291}],1285:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199794,7 +202217,7 @@ function handleAxisDefaults(traceIn, traceOut, layout, coerce) { } } -},{"../../lib":749,"../../plots/array_container_defaults":793,"../parcoords/merge_length":1126,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scattergl/helpers":1213,"./attributes":1250}],1254:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/array_container_defaults":822,"../parcoords/merge_length":1157,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scattergl/helpers":1245,"./attributes":1282}],1286:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199826,7 +202249,7 @@ module.exports = function editStyle(gd, cd0) { } }; -},{"../../lib":749,"../scatter/colorscale_calc":1158,"../scattergl/convert":1209}],1255:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/colorscale_calc":1189,"../scattergl/convert":1241}],1287:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199850,7 +202273,7 @@ exports.getDimIndex = function getDimIndex(trace, ax) { return false; }; -},{}],1256:[function(_dereq_,module,exports){ +},{}],1288:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199911,7 +202334,7 @@ module.exports = { hoverPoints: hoverPoints }; -},{"../scattergl/hover":1214,"./helpers":1255}],1257:[function(_dereq_,module,exports){ +},{"../scattergl/hover":1246,"./helpers":1287}],1289:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -199951,7 +202374,7 @@ module.exports = { // register it here Registry.register(Grid); -},{"../../components/grid":659,"../../registry":880,"../scatter/marker_colorbar":1173,"./attributes":1250,"./base_plot":1251,"./calc":1252,"./defaults":1253,"./edit_style":1254,"./hover":1256,"./plot":1258,"./select":1260}],1258:[function(_dereq_,module,exports){ +},{"../../components/grid":687,"../../registry":910,"../scatter/marker_colorbar":1204,"./attributes":1282,"./base_plot":1283,"./calc":1284,"./defaults":1285,"./edit_style":1286,"./hover":1288,"./plot":1290,"./select":1292}],1290:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200096,7 +202519,7 @@ function plotOne(gd, cd0) { } } -},{"../../components/dragelement/helpers":633,"../../lib":749,"../../plots/cartesian/axis_ids":800,"regl-splom":511}],1259:[function(_dereq_,module,exports){ +},{"../../components/dragelement/helpers":661,"../../lib":778,"../../plots/cartesian/axis_ids":830,"regl-splom":539}],1291:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200168,7 +202591,7 @@ module.exports = function sceneUpdate(gd, trace) { return scene; }; -},{"../../lib":749}],1260:[function(_dereq_,module,exports){ +},{"../../lib":778}],1292:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200243,7 +202666,7 @@ module.exports = function select(searchInfo, selectionTester) { return selection; }; -},{"../../lib":749,"../scatter/subtypes":1179,"./helpers":1255}],1261:[function(_dereq_,module,exports){ +},{"../../lib":778,"../scatter/subtypes":1211,"./helpers":1287}],1293:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200396,7 +202819,7 @@ attrs.transforms = undefined; module.exports = attrs; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../mesh3d/attributes":1096}],1262:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../mesh3d/attributes":1127}],1294:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200652,7 +203075,7 @@ module.exports = { processGrid: processGrid }; -},{"../../components/colorscale/calc":623,"../../lib":749}],1263:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651,"../../lib":778}],1295:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200878,7 +203301,7 @@ function createStreamtubeTrace(scene, data) { module.exports = createStreamtubeTrace; -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gl_format_color":745,"../../plots/gl3d/zip3":850,"gl-streamtube3d":323}],1264:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gl_format_color":774,"../../plots/gl3d/zip3":880,"gl-streamtube3d":348}],1296:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200943,7 +203366,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":1261}],1265:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":1293}],1297:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -200993,7 +203416,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":1261,"./calc":1262,"./convert":1263,"./defaults":1264}],1266:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1293,"./calc":1294,"./convert":1295,"./defaults":1296}],1298:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201153,11 +203576,30 @@ module.exports = { outsidetextfont: extendFlat({}, pieAttrs.outsidetextfont, { }), + rotation: { + valType: 'angle', + + dflt: 0, + editType: 'plot', + + }, + sort: pieAttrs.sort, + + root: { + color: { + valType: 'color', + editType: 'calc', + + dflt: 'rgba(0,0,0,0)', + + }, + editType: 'calc' + }, domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'}) }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/template_attributes":875,"../pie/attributes":1129,"./constants":1269}],1267:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/template_attributes":905,"../pie/attributes":1160,"./constants":1301}],1299:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201180,7 +203622,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1268:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1300:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201294,7 +203736,10 @@ exports.calc = function(gd, trace) { label: k }); } else { - return Lib.warn('Multiple implied roots, cannot build ' + trace.type + ' hierarchy.'); + return Lib.warn([ + 'Multiple implied roots, cannot build', trace.type, 'hierarchy of', trace.name + '.', + 'These roots include:', impliedRoots.join(', ') + ].join(' ')); } } else if(parent2children[''].length > 1) { var dummyId = Lib.randstr(); @@ -201323,7 +203768,10 @@ exports.calc = function(gd, trace) { .id(function(d) { return d.id; }) .parentId(function(d) { return d.pid; })(cd); } catch(e) { - return Lib.warn('Failed to build ' + trace.type + ' hierarchy. Error: ' + e.message); + return Lib.warn([ + 'Failed to build', trace.type, 'hierarchy of', trace.name + '.', + 'Error:', e.message + ].join(' ')); } var hierarchy = d3Hierarchy.hierarchy(root); @@ -201353,7 +203801,7 @@ exports.calc = function(gd, trace) { if(v < partialSum * ALMOST_EQUAL) { failed = true; return Lib.warn([ - 'Total value for node', d.data.data.id, + 'Total value for node', d.data.data.id, 'of', trace.name, 'is smaller than the sum of its children.', '\nparent value =', v, '\nchildren sum =', partialSum @@ -201375,7 +203823,9 @@ exports.calc = function(gd, trace) { if(failed) return; // TODO add way to sort by height also? - hierarchy.sort(function(a, b) { return b.value - a.value; }); + if(trace.sort) { + hierarchy.sort(function(a, b) { return b.value - a.value; }); + } var pullColor; var scaleColor; @@ -201451,8 +203901,8 @@ exports._runCrossTraceCalc = function(desiredType, gd) { dfltColorCount++; } } else { - // root gets no coloring by default - cdi.color = 'rgba(0,0,0,0)'; + // set root color. no coloring by default. + cdi.color = cdi.trace.root.color; } } } @@ -201496,7 +203946,7 @@ function countDescendants(node, trace, opts) { return nChild; } -},{"../../components/colorscale":627,"../../constants/numerical":724,"../../lib":749,"../pie/calc":1131,"d3-hierarchy":161,"fast-isnumeric":241}],1269:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../constants/numerical":753,"../../lib":778,"../pie/calc":1162,"d3-hierarchy":161,"fast-isnumeric":241}],1301:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201524,7 +203974,7 @@ module.exports = { ] }; -},{}],1270:[function(_dereq_,module,exports){ +},{}],1302:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201600,13 +204050,19 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('insidetextorientation'); + coerce('sort'); + + coerce('rotation'); + + coerce('root.color'); + handleDomainDefaults(traceOut, layout, coerce); // do not support transforms for now traceOut._length = null; }; -},{"../../components/colorscale":627,"../../lib":749,"../../plots/domain":824,"../bar/defaults":894,"./attributes":1266}],1271:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../plots/domain":854,"../bar/defaults":924,"./attributes":1298}],1303:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -201917,7 +204373,7 @@ function makeEventData(pt, trace, keys) { return out; } -},{"../../components/fx":655,"../../components/fx/helpers":651,"../../lib":749,"../../lib/events":738,"../../registry":880,"../pie/helpers":1134,"./helpers":1272,"d3":169}],1272:[function(_dereq_,module,exports){ +},{"../../components/fx":683,"../../components/fx/helpers":679,"../../lib":778,"../../lib/events":767,"../../registry":910,"../pie/helpers":1165,"./helpers":1304,"d3":169}],1304:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202102,7 +204558,7 @@ exports.formatPercent = function(v, separators) { return tx; }; -},{"../../components/color":615,"../../lib":749,"../../lib/setcursor":769,"../pie/helpers":1134}],1273:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../../lib/setcursor":798,"../pie/helpers":1165}],1305:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202138,7 +204594,7 @@ module.exports = { } }; -},{"../scatter/marker_colorbar":1173,"./attributes":1266,"./base_plot":1267,"./calc":1268,"./defaults":1270,"./layout_attributes":1274,"./layout_defaults":1275,"./plot":1276,"./style":1277}],1274:[function(_dereq_,module,exports){ +},{"../scatter/marker_colorbar":1204,"./attributes":1298,"./base_plot":1299,"./calc":1300,"./defaults":1302,"./layout_attributes":1306,"./layout_defaults":1307,"./plot":1308,"./style":1309}],1306:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202165,7 +204621,7 @@ module.exports = { } }; -},{}],1275:[function(_dereq_,module,exports){ +},{}],1307:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202187,7 +204643,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendsunburstcolors'); }; -},{"../../lib":749,"./layout_attributes":1274}],1276:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1306}],1308:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202208,6 +204664,7 @@ var uniformText = _dereq_('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; var clearMinTextSize = uniformText.clearMinTextSize; var piePlot = _dereq_('../pie/plot'); +var getRotationAngle = _dereq_('../pie/helpers').getRotationAngle; var computeTransform = piePlot.computeTransform; var transformInsideText = piePlot.transformInsideText; var styleOne = _dereq_('./style').styleOne; @@ -202340,6 +204797,14 @@ function plotOne(gd, cd, element, transitionOpts) { // filter out slices that won't show up on graph sliceData = sliceData.filter(function(pt) { return pt.y1 <= cutoff; }); + var baseX = getRotationAngle(trace.rotation); + if(baseX) { + sliceData.forEach(function(pt) { + pt.x0 += baseX; + pt.x1 += baseX; + }); + } + // partition span ('y') to sector radial px value var maxY = Math.min(maxHeight, maxDepth); var y2rpx = function(y) { return (y - yOffset) / maxY * rMax; }; @@ -202492,7 +204957,7 @@ function plotOne(gd, cd, element, transitionOpts) { var next; if(entryPrev) { - var a = pt.x1 > entryPrev.x1 ? 2 * Math.PI : 0; + var a = (pt.x1 > entryPrev.x1 ? 2 * Math.PI : 0) + baseX; // if pt to remove: // - if 'below' where the root-node used to be: shrink it radially inward // - otherwise, collapse it clockwise or counterclockwise which ever is shortest to theta=0 @@ -202542,7 +205007,7 @@ function plotOne(gd, cd, element, transitionOpts) { // if new branch, twist it in clockwise or // counterclockwise which ever is shorter to // its final angle - var a = pt.x1 > nextX1ofPrevEntry ? 2 * Math.PI : 0; + var a = (pt.x1 > nextX1ofPrevEntry ? 2 * Math.PI : 0) + baseX; prev = {x0: a, x1: a}; } else { // if new leaf (when maxdepth is set), @@ -202557,7 +205022,7 @@ function plotOne(gd, cd, element, transitionOpts) { } } else { // start sector of new traces from theta=0 - prev = {x0: 0, x1: 0}; + prev = {x0: baseX, x1: baseX}; } } @@ -202600,11 +205065,11 @@ function plotOne(gd, cd, element, transitionOpts) { } } else { // if new root-node - prev.x0 = prev.x1 = 0; + prev.x0 = prev.x1 = baseX; } } else { // on new traces - prev.x0 = prev.x1 = 0; + prev.x0 = prev.x1 = baseX; } } @@ -202818,7 +205283,7 @@ function getCoords(r, angle) { return [r * Math.sin(angle), -r * Math.cos(angle)]; } -},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../bar/style":904,"../bar/uniform_text":906,"../pie/plot":1138,"./constants":1269,"./fx":1271,"./helpers":1272,"./style":1277,"d3":169,"d3-hierarchy":161}],1277:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../bar/style":934,"../bar/uniform_text":936,"../pie/helpers":1165,"../pie/plot":1169,"./constants":1301,"./fx":1303,"./helpers":1304,"./style":1309,"d3":169,"d3-hierarchy":161}],1309:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -202869,7 +205334,7 @@ module.exports = { styleOne: styleOne }; -},{"../../components/color":615,"../../lib":749,"../bar/uniform_text":906,"d3":169}],1278:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../bar/uniform_text":936,"d3":169}],1310:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203145,7 +205610,7 @@ colorScaleAttrs('', { attrs.x.editType = attrs.y.editType = attrs.z.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/color":615,"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875}],1279:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905}],1311:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203177,7 +205642,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":623}],1280:[function(_dereq_,module,exports){ +},{"../../components/colorscale/calc":651}],1312:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -203613,8 +206078,7 @@ proto.update = function(data) { var scene = this.scene; var sceneLayout = scene.fullSceneLayout; var surface = this.surface; - var alpha = data.opacity; - var colormap = parseColorScale(data, alpha); + var colormap = parseColorScale(data); var scaleFactor = scene.dataScale; var xlen = data.z[0].length; var ylen = data._ylength; @@ -203859,10 +206323,6 @@ proto.update = function(data) { if('lightposition' in data) { surface.lightPosition = [data.lightposition.x, data.lightposition.y, data.lightposition.z]; } - - if(alpha && alpha < 1) { - surface.supportsTransparency = true; - } }; proto.dispose = function() { @@ -203882,7 +206342,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../components/colorscale":627,"../../lib":749,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../heatmap/find_empties":1040,"../heatmap/interp2d":1043,"gl-surface3d":325,"ndarray":469,"ndarray-linear-interpolate":463}],1281:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib":778,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../heatmap/find_empties":1070,"../heatmap/interp2d":1073,"gl-surface3d":351,"ndarray":495,"ndarray-linear-interpolate":489}],1313:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204056,7 +206516,7 @@ module.exports = { opacityscaleDefaults: opacityscaleDefaults }; -},{"../../components/colorscale/defaults":625,"../../lib":749,"../../registry":880,"./attributes":1278}],1282:[function(_dereq_,module,exports){ +},{"../../components/colorscale/defaults":653,"../../lib":778,"../../registry":910,"./attributes":1310}],1314:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204086,7 +206546,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"./attributes":1278,"./calc":1279,"./convert":1280,"./defaults":1281}],1283:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"./attributes":1310,"./calc":1311,"./convert":1312,"./defaults":1313}],1315:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204262,7 +206722,7 @@ var attrs = module.exports = overrideAll({ }, 'calc', 'from-root'); attrs.transforms = undefined; -},{"../../components/annotations/attributes":598,"../../constants/docs":719,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/domain":824,"../../plots/font_attributes":825}],1284:[function(_dereq_,module,exports){ +},{"../../components/annotations/attributes":626,"../../constants/docs":748,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/domain":854,"../../plots/font_attributes":855}],1316:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204294,7 +206754,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/get_data":834,"./plot":1291}],1285:[function(_dereq_,module,exports){ +},{"../../plots/get_data":864,"./plot":1323}],1317:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204313,7 +206773,7 @@ module.exports = function calc() { return wrap({}); }; -},{"../../lib/gup":746}],1286:[function(_dereq_,module,exports){ +},{"../../lib/gup":775}],1318:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204373,7 +206833,7 @@ module.exports = { } }; -},{}],1287:[function(_dereq_,module,exports){ +},{}],1319:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204568,7 +207028,7 @@ function makeIdentity() { }; } -},{"../../lib/extend":739,"./constants":1286,"fast-isnumeric":241}],1288:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"./constants":1318,"fast-isnumeric":241}],1320:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204651,7 +207111,7 @@ function rowFromTo(d) { return [rowFrom, rowTo]; } -},{"../../lib/extend":739}],1289:[function(_dereq_,module,exports){ +},{"../../lib/extend":768}],1321:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204716,7 +207176,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut._length = null; }; -},{"../../lib":749,"../../plots/domain":824,"./attributes":1283}],1290:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/domain":854,"./attributes":1315}],1322:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204742,7 +207202,7 @@ module.exports = { } }; -},{"./attributes":1283,"./base_plot":1284,"./calc":1285,"./defaults":1289,"./plot":1291}],1291:[function(_dereq_,module,exports){ +},{"./attributes":1315,"./base_plot":1316,"./calc":1317,"./defaults":1321,"./plot":1323}],1323:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -204759,6 +207219,7 @@ var gup = _dereq_('../../lib/gup'); var Drawing = _dereq_('../../components/drawing'); var svgUtil = _dereq_('../../lib/svg_text_utils'); var raiseToTop = _dereq_('../../lib').raiseToTop; +var strTranslate = _dereq_('../../lib').strTranslate; var cancelEeaseColumn = _dereq_('../../lib').cancelTransition; var prepareData = _dereq_('./data_preparation_helper'); var splitData = _dereq_('./data_split_helpers'); @@ -204791,7 +207252,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { .attr('width', function(d) {return d.width + d.size.l + d.size.r;}) .attr('height', function(d) {return d.height + d.size.t + d.size.b;}) .attr('transform', function(d) { - return 'translate(' + d.translateX + ',' + d.translateY + ')'; + return strTranslate(d.translateX, d.translateY); }); var tableControlView = table.selectAll('.' + c.cn.tableControlView) @@ -204824,7 +207285,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { } tableControlView - .attr('transform', function(d) {return 'translate(' + d.size.l + ' ' + d.size.t + ')';}); + .attr('transform', function(d) {return strTranslate(d.size.l, d.size.t);}); // scrollBackground merely ensures that mouse events are captured even on crazy fast scrollwheeling // otherwise rendering glitches may occur @@ -204853,7 +207314,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { yColumn.exit().remove(); - yColumn.attr('transform', function(d) {return 'translate(' + d.x + ' 0)';}); + yColumn.attr('transform', function(d) {return strTranslate(d.x, 0);}); if(dynamic) { yColumn.call(d3.behavior.drag() @@ -204881,10 +207342,10 @@ module.exports = function plot(gd, wrappedTraceHolders) { .transition() .ease(c.transitionEase) .duration(c.transitionDuration) - .attr('transform', function(d) {return 'translate(' + d.x + ' 0)';}); + .attr('transform', function(d) {return strTranslate(d.x, 0);}); movedColumn .call(cancelEeaseColumn) - .attr('transform', 'translate(' + d.x + ' -' + c.uplift + ' )'); + .attr('transform', strTranslate(d.x, -c.uplift)); }) .on('dragend', function(d) { var movedColumn = d3.select(this); @@ -205039,7 +207500,7 @@ function renderScrollbarKit(tableControlView, gd, bypassVisibleBar) { }) .attr('transform', function(d) { var xPosition = d.width + c.scrollbarWidth / 2 + c.scrollbarOffset; - return 'translate(' + xPosition + ' ' + headerHeight(d) + ')'; + return strTranslate(xPosition, headerHeight(d)); }); var scrollbar = scrollbarKit.selectAll('.' + c.cn.scrollbar) @@ -205058,7 +207519,7 @@ function renderScrollbarKit(tableControlView, gd, bypassVisibleBar) { scrollbarSlider .attr('transform', function(d) { - return 'translate(0 ' + (d.scrollbarState.topY || 0) + ')'; + return strTranslate(0, d.scrollbarState.topY || 0); }); var scrollbarGlyph = scrollbarSlider.selectAll('.' + c.cn.scrollbarGlyph) @@ -205317,7 +207778,7 @@ function populateCellText(cellText, tableControlView, allColumnBlock, gd) { } else { d3.select(element.parentNode) // basic cell adjustment - compliance with `cellPad` - .attr('transform', function(d) {return 'translate(' + xPosition(d) + ' ' + c.cellPad + ')';}) + .attr('transform', function(d) {return strTranslate(xPosition(d), c.cellPad);}) .attr('text-anchor', function(d) { return ({ left: 'start', @@ -205367,7 +207828,7 @@ function easeColumn(selection, d, y) { .transition() .ease(c.releaseTransitionEase) .duration(c.releaseTransitionDuration) - .attr('transform', 'translate(' + d.x + ' ' + y + ')'); + .attr('transform', strTranslate(d.x, y)); } function cellsBlock(d) {return d.type === 'cells';} @@ -205448,7 +207909,7 @@ function updateBlockYPosition(gd, cellsColumnBlock, tableControlView) { cellsColumnBlock .attr('transform', function(d) { var yTranslate = firstRowAnchor(d.rowBlocks, d.page) - d.scrollY; - return 'translate(0 ' + yTranslate + ')'; + return strTranslate(0, yTranslate); }); // conditionally rerendering panel 0 and 1 @@ -205574,7 +208035,7 @@ function updateYPositionMaker(columnBlock, element, tableControlView, gd, d) { var rectBox = d3.select(element.parentNode).select('.' + c.cn.cellRect).node().getBoundingClientRect(); var currentTransform = element.transform.baseVal.consolidate(); var yPosition = rectBox.top - box.top + (currentTransform ? currentTransform.matrix.f : c.cellPad); - return 'translate(' + xPosition(d, d3.select(element.parentNode).select('.' + c.cn.cellTextHolder).node().getBoundingClientRect().width) + ' ' + yPosition + ')'; + return strTranslate(xPosition(d, d3.select(element.parentNode).select('.' + c.cn.cellTextHolder).node().getBoundingClientRect().width), yPosition); }); d.settledY = true; @@ -205597,7 +208058,7 @@ function setCellHeightAndPositionY(columnCell) { var l = getBlock(d); var rowAnchor = rowsHeight(l, d.key); var yOffset = rowAnchor + headerHeight; - return 'translate(0 ' + yOffset + ')'; + return strTranslate(0, yOffset); }) .selectAll('.' + c.cn.cellRect) .attr('height', function(d) {return getRow(getBlock(d), d.key).rowHeight;}); @@ -205638,7 +208099,7 @@ function allRowsHeight(rowBlock) { function getBlock(d) {return d.rowBlocks[d.page];} function getRow(l, i) {return l.rows[i - l.firstRowIndex];} -},{"../../components/color":615,"../../components/drawing":637,"../../lib":749,"../../lib/gup":746,"../../lib/svg_text_utils":773,"./constants":1286,"./data_preparation_helper":1287,"./data_split_helpers":1288,"d3":169}],1292:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../lib":778,"../../lib/gup":775,"../../lib/svg_text_utils":802,"./constants":1318,"./data_preparation_helper":1319,"./data_split_helpers":1320,"d3":169}],1324:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205856,11 +208317,13 @@ module.exports = { editType: 'plot', }, + sort: pieAttrs.sort, + root: sunburstAttrs.root, domain: domainAttrs({name: 'treemap', trace: true, editType: 'calc'}), }; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/domain":824,"../../plots/template_attributes":875,"../pie/attributes":1129,"../sunburst/attributes":1266,"./constants":1295}],1293:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/domain":854,"../../plots/template_attributes":905,"../pie/attributes":1160,"../sunburst/attributes":1298,"./constants":1327}],1325:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205883,7 +208346,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout); }; -},{"../../plots/plots":860}],1294:[function(_dereq_,module,exports){ +},{"../../plots/plots":890}],1326:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205904,7 +208367,7 @@ exports.crossTraceCalc = function(gd) { return calc._runCrossTraceCalc('treemap', gd); }; -},{"../sunburst/calc":1268}],1295:[function(_dereq_,module,exports){ +},{"../sunburst/calc":1300}],1327:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -205933,7 +208396,7 @@ module.exports = { gapWithPathbar: 1 // i.e. one pixel }; -},{}],1296:[function(_dereq_,module,exports){ +},{}],1328:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206050,13 +208513,17 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pathbar.edgeshape'); } + coerce('sort'); + + coerce('root.color'); + handleDomainDefaults(traceOut, layout, coerce); // do not support transforms for now traceOut._length = null; }; -},{"../../components/color":615,"../../components/colorscale":627,"../../lib":749,"../../plots/domain":824,"../bar/constants":892,"../bar/defaults":894,"./attributes":1292}],1297:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/colorscale":655,"../../lib":778,"../../plots/domain":854,"../bar/constants":922,"../bar/defaults":924,"./attributes":1324}],1329:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206228,7 +208695,7 @@ module.exports = function drawAncestors(gd, cd, entry, slices, opts) { }); }; -},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../sunburst/fx":1271,"../sunburst/helpers":1272,"./constants":1295,"./partition":1302,"./style":1304,"d3":169}],1298:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../sunburst/fx":1303,"../sunburst/helpers":1304,"./constants":1327,"./partition":1334,"./style":1336,"d3":169}],1330:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206441,7 +208908,7 @@ module.exports = function drawDescendants(gd, cd, entry, slices, opts) { return nextOfPrevEntry; }; -},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../sunburst/fx":1271,"../sunburst/helpers":1272,"../sunburst/plot":1276,"./constants":1295,"./partition":1302,"./style":1304,"d3":169}],1299:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../sunburst/fx":1303,"../sunburst/helpers":1304,"../sunburst/plot":1308,"./constants":1327,"./partition":1334,"./style":1336,"d3":169}],1331:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206477,7 +208944,7 @@ module.exports = { } }; -},{"../scatter/marker_colorbar":1173,"./attributes":1292,"./base_plot":1293,"./calc":1294,"./defaults":1296,"./layout_attributes":1300,"./layout_defaults":1301,"./plot":1303,"./style":1304}],1300:[function(_dereq_,module,exports){ +},{"../scatter/marker_colorbar":1204,"./attributes":1324,"./base_plot":1325,"./calc":1326,"./defaults":1328,"./layout_attributes":1332,"./layout_defaults":1333,"./plot":1335,"./style":1336}],1332:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206504,7 +208971,7 @@ module.exports = { } }; -},{}],1301:[function(_dereq_,module,exports){ +},{}],1333:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206526,7 +208993,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('extendtreemapcolors'); }; -},{"../../lib":749,"./layout_attributes":1300}],1302:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1332}],1334:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -206632,7 +209099,7 @@ function flipTree(node, size, opts) { } } -},{"d3-hierarchy":161}],1303:[function(_dereq_,module,exports){ +},{"d3-hierarchy":161}],1335:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207267,7 +209734,7 @@ function plotOne(gd, cd, element, transitionOpts) { } } -},{"../../lib":749,"../bar/constants":892,"../bar/plot":901,"../bar/style":904,"../bar/uniform_text":906,"../sunburst/helpers":1272,"./constants":1295,"./draw_ancestors":1297,"./draw_descendants":1298,"d3":169}],1304:[function(_dereq_,module,exports){ +},{"../../lib":778,"../bar/constants":922,"../bar/plot":931,"../bar/style":934,"../bar/uniform_text":936,"../sunburst/helpers":1304,"./constants":1327,"./draw_ancestors":1329,"./draw_descendants":1330,"d3":169}],1336:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207317,8 +209784,8 @@ function styleOne(s, pt, trace, opts) { lineColor = trace._hovered.marker.line.color; lineWidth = trace._hovered.marker.line.width; } else { - if(isRoot && fillColor === 'rgba(0,0,0,0)') { - opacity = 0; + if(isRoot && fillColor === trace.root.color) { + opacity = 100; lineColor = 'rgba(0,0,0,0)'; lineWidth = 0; } else { @@ -207369,7 +209836,7 @@ module.exports = { styleOne: styleOne }; -},{"../../components/color":615,"../../lib":749,"../bar/uniform_text":906,"../sunburst/helpers":1272,"d3":169}],1305:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../bar/uniform_text":936,"../sunburst/helpers":1304,"d3":169}],1337:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207388,6 +209855,7 @@ module.exports = { x: boxAttrs.x, x0: boxAttrs.x0, y0: boxAttrs.y0, + name: extendFlat({}, boxAttrs.name, { }), @@ -207568,7 +210036,7 @@ module.exports = { } }; -},{"../../lib/extend":739,"../box/attributes":915}],1306:[function(_dereq_,module,exports){ +},{"../../lib/extend":768,"../box/attributes":945}],1338:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207744,7 +210212,7 @@ function calcSpan(trace, cdi, valAxis, bandwidth) { return spanOut; } -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../box/calc":916,"./helpers":1309}],1307:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axes":827,"../box/calc":946,"./helpers":1341}],1339:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207787,7 +210255,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../box/cross_trace_calc":917}],1308:[function(_dereq_,module,exports){ +},{"../box/cross_trace_calc":947}],1340:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207848,7 +210316,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!meanLineVisible) traceOut.meanline = {visible: false}; }; -},{"../../components/color":615,"../../lib":749,"../box/defaults":918,"./attributes":1305}],1309:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib":778,"../box/defaults":948,"./attributes":1337}],1341:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -207921,7 +210389,7 @@ exports.getKdeValue = function(calcItem, trace, valueDist) { exports.extractVal = function(o) { return o.v; }; -},{"../../lib":749}],1310:[function(_dereq_,module,exports){ +},{"../../lib":778}],1342:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208033,7 +210501,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay return closeData; }; -},{"../../lib":749,"../../plots/cartesian/axes":797,"../box/hover":920,"./helpers":1309}],1311:[function(_dereq_,module,exports){ +},{"../../lib":778,"../../plots/cartesian/axes":827,"../box/hover":950,"./helpers":1341}],1343:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208067,7 +210535,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../box/defaults":918,"../box/select":925,"../scatter/style":1178,"./attributes":1305,"./calc":1306,"./cross_trace_calc":1307,"./defaults":1308,"./hover":1310,"./layout_attributes":1312,"./layout_defaults":1313,"./plot":1314,"./style":1315}],1312:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../box/defaults":948,"../box/select":955,"../scatter/style":1210,"./attributes":1337,"./calc":1338,"./cross_trace_calc":1339,"./defaults":1340,"./hover":1342,"./layout_attributes":1344,"./layout_defaults":1345,"./plot":1346,"./style":1347}],1344:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208093,7 +210561,7 @@ module.exports = { }) }; -},{"../../lib":749,"../box/layout_attributes":922}],1313:[function(_dereq_,module,exports){ +},{"../../lib":778,"../box/layout_attributes":952}],1345:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208115,7 +210583,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { boxLayoutDefaults._supply(layoutIn, layoutOut, fullData, coerce, 'violin'); }; -},{"../../lib":749,"../box/layout_defaults":923,"./layout_attributes":1312}],1314:[function(_dereq_,module,exports){ +},{"../../lib":778,"../box/layout_defaults":953,"./layout_attributes":1344}],1346:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208305,7 +210773,7 @@ module.exports = function plot(gd, plotinfo, cdViolins, violinLayer) { }); }; -},{"../../components/drawing":637,"../../lib":749,"../box/plot":924,"../scatter/line_points":1169,"./helpers":1309,"d3":169}],1315:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../lib":778,"../box/plot":954,"../scatter/line_points":1200,"./helpers":1341,"d3":169}],1347:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208360,7 +210828,7 @@ module.exports = function style(gd) { }); }; -},{"../../components/color":615,"../scatter/style":1178,"d3":169}],1316:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../scatter/style":1210,"d3":169}],1348:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208433,7 +210901,7 @@ colorScaleAttrs('', { attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; attrs.transforms = undefined; -},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../isosurface/attributes":1091,"../surface/attributes":1278}],1317:[function(_dereq_,module,exports){ +},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../isosurface/attributes":1122,"../surface/attributes":1310}],1349:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208566,7 +211034,7 @@ function createVolumeTrace(scene, data) { module.exports = createVolumeTrace; -},{"../../components/colorscale":627,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/gl3d/zip3":850,"../isosurface/convert":1093,"gl-mesh3d":292}],1318:[function(_dereq_,module,exports){ +},{"../../components/colorscale":655,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/gl3d/zip3":880,"../isosurface/convert":1124,"gl-mesh3d":309}],1350:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208592,7 +211060,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout opacityscaleDefaults(traceIn, traceOut, layout, coerce); }; -},{"../../lib":749,"../isosurface/defaults":1094,"../surface/defaults":1281,"./attributes":1316}],1319:[function(_dereq_,module,exports){ +},{"../../lib":778,"../isosurface/defaults":1125,"../surface/defaults":1313,"./attributes":1348}],1351:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208622,7 +211090,7 @@ module.exports = { } }; -},{"../../plots/gl3d":839,"../isosurface/calc":1092,"./attributes":1316,"./convert":1317,"./defaults":1318}],1320:[function(_dereq_,module,exports){ +},{"../../plots/gl3d":869,"../isosurface/calc":1123,"./attributes":1348,"./convert":1349,"./defaults":1350}],1352:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208694,6 +211162,13 @@ module.exports = { y0: barAttrs.y0, dy: barAttrs.dy, + xperiod: barAttrs.xperiod, + yperiod: barAttrs.yperiod, + xperiod0: barAttrs.xperiod0, + yperiod0: barAttrs.yperiod0, + xperiodalignment: barAttrs.xperiodalignment, + yperiodalignment: barAttrs.yperiodalignment, + hovertext: barAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys @@ -208766,7 +211241,7 @@ module.exports = { alignmentgroup: barAttrs.alignmentgroup }; -},{"../../components/color":615,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatter/attributes":1155,"./constants":1322}],1321:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatter/attributes":1186,"./constants":1354}],1353:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208778,6 +211253,7 @@ module.exports = { 'use strict'; var Axes = _dereq_('../../plots/cartesian/axes'); +var alignPeriod = _dereq_('../../plots/cartesian/align_period'); var mergeArray = _dereq_('../../lib').mergeArray; var calcSelection = _dereq_('../scatter/calc_selection'); var BADNUM = _dereq_('../../constants/numerical').BADNUM; @@ -208793,14 +211269,19 @@ function isTotal(a) { module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -208854,6 +211335,10 @@ module.exports = function calc(gd, trace) { hasTotals = true; } + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cdi.id = String(trace.ids[i]); } @@ -208870,7 +211355,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../scatter/calc_selection":1157}],1322:[function(_dereq_,module,exports){ +},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../scatter/calc_selection":1188}],1354:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208889,7 +211374,7 @@ module.exports = { ] }; -},{}],1323:[function(_dereq_,module,exports){ +},{}],1355:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208962,7 +211447,7 @@ module.exports = function crossTraceCalc(gd, plotinfo) { } }; -},{"../bar/cross_trace_calc":893}],1324:[function(_dereq_,module,exports){ +},{"../bar/cross_trace_calc":923}],1356:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -208978,6 +211463,7 @@ var Lib = _dereq_('../../lib'); var handleGroupingDefaults = _dereq_('../bar/defaults').handleGroupingDefaults; var handleText = _dereq_('../bar/defaults').handleText; var handleXYDefaults = _dereq_('../scatter/xy_defaults'); +var handlePeriodDefaults = _dereq_('../scatter/period_defaults'); var attributes = _dereq_('./attributes'); var Color = _dereq_('../../components/color'); var delta = _dereq_('../../constants/delta.js'); @@ -209003,6 +211489,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('measure'); coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); @@ -209068,7 +211556,7 @@ module.exports = { crossTraceDefaults: crossTraceDefaults }; -},{"../../components/color":615,"../../constants/delta.js":718,"../../lib":749,"../bar/defaults":894,"../scatter/xy_defaults":1181,"./attributes":1320}],1325:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../constants/delta.js":747,"../../lib":778,"../bar/defaults":924,"../scatter/period_defaults":1206,"../scatter/xy_defaults":1213,"./attributes":1352}],1357:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209095,7 +211583,7 @@ module.exports = function eventData(out, pt /* , trace, cd, pointNumber */) { return out; }; -},{}],1326:[function(_dereq_,module,exports){ +},{}],1358:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209190,7 +211678,7 @@ function getTraceColor(trace, di) { else if(opacity(mlc) && mlw) return mlc; } -},{"../../components/color":615,"../../constants/delta.js":718,"../../plots/cartesian/axes":797,"../bar/hover":897}],1327:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../constants/delta.js":747,"../../plots/cartesian/axes":827,"../bar/hover":927}],1359:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209225,7 +211713,7 @@ module.exports = { } }; -},{"../../plots/cartesian":810,"../bar/select":902,"./attributes":1320,"./calc":1321,"./cross_trace_calc":1323,"./defaults":1324,"./event_data":1325,"./hover":1326,"./layout_attributes":1328,"./layout_defaults":1329,"./plot":1330,"./style":1331}],1328:[function(_dereq_,module,exports){ +},{"../../plots/cartesian":840,"../bar/select":932,"./attributes":1352,"./calc":1353,"./cross_trace_calc":1355,"./defaults":1356,"./event_data":1357,"./hover":1358,"./layout_attributes":1360,"./layout_defaults":1361,"./plot":1362,"./style":1363}],1360:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209264,7 +211752,7 @@ module.exports = { } }; -},{}],1329:[function(_dereq_,module,exports){ +},{}],1361:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209301,7 +211789,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { } }; -},{"../../lib":749,"./layout_attributes":1328}],1330:[function(_dereq_,module,exports){ +},{"../../lib":778,"./layout_attributes":1360}],1362:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209432,7 +211920,7 @@ function getXY(di, xa, ya, isHorizontal) { return isHorizontal ? [s, p] : [p, s]; } -},{"../../components/drawing":637,"../../constants/numerical":724,"../../lib":749,"../bar/plot":901,"../bar/uniform_text":906,"d3":169}],1331:[function(_dereq_,module,exports){ +},{"../../components/drawing":665,"../../constants/numerical":753,"../../lib":778,"../bar/plot":931,"../bar/uniform_text":936,"d3":169}],1363:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209493,7 +211981,7 @@ module.exports = { style: style }; -},{"../../components/color":615,"../../components/drawing":637,"../../constants/interactions":723,"../bar/style":904,"../bar/uniform_text":906,"d3":169}],1332:[function(_dereq_,module,exports){ +},{"../../components/color":643,"../../components/drawing":665,"../../constants/interactions":752,"../bar/style":934,"../bar/uniform_text":936,"d3":169}],1364:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -209917,7 +212405,7 @@ function last(array, indices) { return array[indices[indices.length - 1]]; } -},{"../constants/numerical":724,"../lib":749,"../plot_api/plot_schema":786,"../plots/cartesian/axes":797,"./helpers":1335}],1333:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"../lib":778,"../plot_api/plot_schema":815,"../plots/cartesian/axes":827,"./helpers":1367}],1365:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210195,7 +212683,7 @@ function getFilterFunc(opts, d2c, targetCalendar) { } } -},{"../constants/filter_ops":720,"../lib":749,"../plots/cartesian/axes":797,"../registry":880,"./helpers":1335}],1334:[function(_dereq_,module,exports){ +},{"../constants/filter_ops":749,"../lib":778,"../plots/cartesian/axes":827,"../registry":910,"./helpers":1367}],1366:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210457,7 +212945,7 @@ function transformOne(trace, state) { return newData; } -},{"../lib":749,"../plot_api/plot_schema":786,"../plots/plots":860,"./helpers":1335}],1335:[function(_dereq_,module,exports){ +},{"../lib":778,"../plot_api/plot_schema":815,"../plots/plots":890,"./helpers":1367}],1367:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210483,7 +212971,7 @@ exports.pointsAccessorFunction = function(transforms, opts) { return originalPointsAccessor; }; -},{}],1336:[function(_dereq_,module,exports){ +},{}],1368:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210635,7 +213123,7 @@ function getSortFunc(opts, d2c) { } } -},{"../constants/numerical":724,"../lib":749,"../plots/cartesian/axes":797,"./helpers":1335}],1337:[function(_dereq_,module,exports){ +},{"../constants/numerical":753,"../lib":778,"../plots/cartesian/axes":827,"./helpers":1367}],1369:[function(_dereq_,module,exports){ /** * Copyright 2012-2020, Plotly, Inc. * All rights reserved. @@ -210647,7 +213135,7 @@ function getSortFunc(opts, d2c) { 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; },{}]},{},[26])(26) }); diff --git a/dist/plotly.min.js b/dist/plotly.min.js index ca89c6d1a1a..348a08c3fa1 100644 --- a/dist/plotly.min.js +++ b/dist/plotly.min.js @@ -1,23 +1,23 @@ /** -* plotly.js v1.55.2 +* plotly.js v1.58.0 * Copyright 2012-2020, 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 t(e,r,n){function a(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return a(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o: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', verdana, arial, sans-serif;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 i in a){var o=i.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,a[i])}},{"../src/lib":749}],2:[function(t,e,r){"use strict";e.exports=t("../src/transforms/aggregate")},{"../src/transforms/aggregate":1332}],3:[function(t,e,r){"use strict";e.exports=t("../src/traces/bar")},{"../src/traces/bar":898}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/barpolar")},{"../src/traces/barpolar":911}],5:[function(t,e,r){"use strict";e.exports=t("../src/traces/box")},{"../src/traces/box":921}],6:[function(t,e,r){"use strict";e.exports=t("../src/components/calendars")},{"../src/components/calendars":613}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/candlestick")},{"../src/traces/candlestick":930}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/carpet")},{"../src/traces/carpet":949}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/choropleth")},{"../src/traces/choropleth":963}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/choroplethmapbox")},{"../src/traces/choroplethmapbox":970}],11:[function(t,e,r){"use strict";e.exports=t("../src/traces/cone")},{"../src/traces/cone":976}],12:[function(t,e,r){"use strict";e.exports=t("../src/traces/contour")},{"../src/traces/contour":991}],13:[function(t,e,r){"use strict";e.exports=t("../src/traces/contourcarpet")},{"../src/traces/contourcarpet":1002}],14:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":726}],15:[function(t,e,r){"use strict";e.exports=t("../src/traces/densitymapbox")},{"../src/traces/densitymapbox":1010}],16:[function(t,e,r){"use strict";e.exports=t("../src/transforms/filter")},{"../src/transforms/filter":1333}],17:[function(t,e,r){"use strict";e.exports=t("../src/traces/funnel")},{"../src/traces/funnel":1020}],18:[function(t,e,r){"use strict";e.exports=t("../src/traces/funnelarea")},{"../src/traces/funnelarea":1029}],19:[function(t,e,r){"use strict";e.exports=t("../src/transforms/groupby")},{"../src/transforms/groupby":1334}],20:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":1042}],21:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmapgl")},{"../src/traces/heatmapgl":1052}],22:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":1064}],23:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":1070}],24:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":1074}],25:[function(t,e,r){"use strict";e.exports=t("../src/traces/image")},{"../src/traces/image":1081}],26:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./bar"),t("./box"),t("./heatmap"),t("./histogram"),t("./histogram2d"),t("./histogram2dcontour"),t("./contour"),t("./scatterternary"),t("./violin"),t("./funnel"),t("./waterfall"),t("./image"),t("./pie"),t("./sunburst"),t("./treemap"),t("./funnelarea"),t("./scatter3d"),t("./surface"),t("./isosurface"),t("./volume"),t("./mesh3d"),t("./cone"),t("./streamtube"),t("./scattergeo"),t("./choropleth"),t("./scattergl"),t("./splom"),t("./pointcloud"),t("./heatmapgl"),t("./parcoords"),t("./parcats"),t("./scattermapbox"),t("./choroplethmapbox"),t("./densitymapbox"),t("./sankey"),t("./indicator"),t("./table"),t("./carpet"),t("./scattercarpet"),t("./contourcarpet"),t("./ohlc"),t("./candlestick"),t("./scatterpolar"),t("./scatterpolargl"),t("./barpolar")]),n.register([t("./aggregate"),t("./filter"),t("./groupby"),t("./sort")]),n.register([t("./calendars")]),e.exports=n},{"./aggregate":2,"./bar":3,"./barpolar":4,"./box":5,"./calendars":6,"./candlestick":7,"./carpet":8,"./choropleth":9,"./choroplethmapbox":10,"./cone":11,"./contour":12,"./contourcarpet":13,"./core":14,"./densitymapbox":15,"./filter":16,"./funnel":17,"./funnelarea":18,"./groupby":19,"./heatmap":20,"./heatmapgl":21,"./histogram":22,"./histogram2d":23,"./histogram2dcontour":24,"./image":25,"./indicator":27,"./isosurface":28,"./mesh3d":29,"./ohlc":30,"./parcats":31,"./parcoords":32,"./pie":33,"./pointcloud":34,"./sankey":35,"./scatter3d":36,"./scattercarpet":37,"./scattergeo":38,"./scattergl":39,"./scattermapbox":40,"./scatterpolar":41,"./scatterpolargl":42,"./scatterternary":43,"./sort":44,"./splom":45,"./streamtube":46,"./sunburst":47,"./surface":48,"./table":49,"./treemap":50,"./violin":51,"./volume":52,"./waterfall":53}],27:[function(t,e,r){"use strict";e.exports=t("../src/traces/indicator")},{"../src/traces/indicator":1089}],28:[function(t,e,r){"use strict";e.exports=t("../src/traces/isosurface")},{"../src/traces/isosurface":1095}],29:[function(t,e,r){"use strict";e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":1100}],30:[function(t,e,r){"use strict";e.exports=t("../src/traces/ohlc")},{"../src/traces/ohlc":1105}],31:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcats")},{"../src/traces/parcats":1114}],32:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcoords")},{"../src/traces/parcoords":1124}],33:[function(t,e,r){"use strict";e.exports=t("../src/traces/pie")},{"../src/traces/pie":1135}],34:[function(t,e,r){"use strict";e.exports=t("../src/traces/pointcloud")},{"../src/traces/pointcloud":1144}],35:[function(t,e,r){"use strict";e.exports=t("../src/traces/sankey")},{"../src/traces/sankey":1150}],36:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":1187}],37:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattercarpet")},{"../src/traces/scattercarpet":1194}],38:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergeo")},{"../src/traces/scattergeo":1202}],39:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":1215}],40:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":1225}],41:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterpolar")},{"../src/traces/scatterpolar":1233}],42:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterpolargl")},{"../src/traces/scatterpolargl":1240}],43:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":1248}],44:[function(t,e,r){"use strict";e.exports=t("../src/transforms/sort")},{"../src/transforms/sort":1336}],45:[function(t,e,r){"use strict";e.exports=t("../src/traces/splom")},{"../src/traces/splom":1257}],46:[function(t,e,r){"use strict";e.exports=t("../src/traces/streamtube")},{"../src/traces/streamtube":1265}],47:[function(t,e,r){"use strict";e.exports=t("../src/traces/sunburst")},{"../src/traces/sunburst":1273}],48:[function(t,e,r){"use strict";e.exports=t("../src/traces/surface")},{"../src/traces/surface":1282}],49:[function(t,e,r){"use strict";e.exports=t("../src/traces/table")},{"../src/traces/table":1290}],50:[function(t,e,r){"use strict";e.exports=t("../src/traces/treemap")},{"../src/traces/treemap":1299}],51:[function(t,e,r){"use strict";e.exports=t("../src/traces/violin")},{"../src/traces/violin":1311}],52:[function(t,e,r){"use strict";e.exports=t("../src/traces/volume")},{"../src/traces/volume":1319}],53:[function(t,e,r){"use strict";e.exports=t("../src/traces/waterfall")},{"../src/traces/waterfall":1327}],54:[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],c=t.mode||"turntable",u=n(),h=a(),f=i();return u.setDistanceLimits(l[0],l[1]),u.lookAt(0,e,r,s),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,s),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,s),new o({turntable:u,orbit:h,matrix:f},c)};var n=t("turntable-camera-controller"),a=t("orbit-camera-controller"),i=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;n1||a>1)}function A(t,e,r){return t.sort(E),t.forEach((function(n,a){var i,o,s=0;if(H(n,r)&&M(n))n.circularPathData.verticalBuffer=s+n.width/2;else{for(var l=0;lo.source.column)){var c=t[l].circularPathData.verticalBuffer+t[l].width/2+e;s=c>s?c:s}n.circularPathData.verticalBuffer=s+n.width/2}})),t}function S(t,r,a,i){var o=e.min(t.links,(function(t){return t.source.y0}));t.links.forEach((function(t){t.circular&&(t.circularPathData={})})),A(t.links.filter((function(t){return"top"==t.circularLinkType})),r,i),A(t.links.filter((function(t){return"bottom"==t.circularLinkType})),r,i),t.links.forEach((function(e){if(e.circular){if(e.circularPathData.arcRadius=e.width+10,e.circularPathData.leftNodeBuffer=5,e.circularPathData.rightNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,H(e,i)&&M(e))e.circularPathData.leftSmallArcRadius=10+e.width/2,e.circularPathData.leftLargeArcRadius=10+e.width/2,e.circularPathData.rightSmallArcRadius=10+e.width/2,e.circularPathData.rightLargeArcRadius=10+e.width/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+25+e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-25-e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=t.links.filter((function(t){return t.source.column==s&&t.circularLinkType==l}));"bottom"==e.circularLinkType?c.sort(L):c.sort(C);var u=0;c.forEach((function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=10+e.width/2+u,e.circularPathData.leftLargeArcRadius=10+e.width/2+n*r+u),u+=t.width})),s=e.target.column,c=t.links.filter((function(t){return t.target.column==s&&t.circularLinkType==l})),"bottom"==e.circularLinkType?c.sort(I):c.sort(P),u=0,c.forEach((function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=10+e.width/2+u,e.circularPathData.rightLargeArcRadius=10+e.width/2+n*r+u),u+=t.width})),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(a,e.source.y1,e.target.y1)+25+e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius):(e.circularPathData.verticalFullExtent=o-25-e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius)}e.circularPathData.leftInnerExtent=e.circularPathData.sourceX+e.circularPathData.leftNodeBuffer,e.circularPathData.rightInnerExtent=e.circularPathData.targetX-e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.sourceX+e.circularPathData.leftLargeArcRadius+e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.targetX-e.circularPathData.rightLargeArcRadius-e.circularPathData.rightNodeBuffer}if(e.circular)e.path=function(t){var e="";e="top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.leftSmallArcRadius)+" L"+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" L"+t.circularPathData.rightFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.rightSmallArcRadius)+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.leftSmallArcRadius)+" L"+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" L"+t.circularPathData.rightFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.rightSmallArcRadius)+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY;return e}(e);else{var h=n.linkHorizontal().source((function(t){return[t.source.x0+(t.source.x1-t.source.x0),t.y0]})).target((function(t){return[t.target.x0,t.y1]}));e.path=h(e)}}))}function E(t,e){return z(t)==z(e)?"bottom"==t.circularLinkType?L(t,e):C(t,e):z(e)-z(t)}function C(t,e){return t.y0-e.y0}function L(t,e){return e.y0-t.y0}function P(t,e){return t.y1-e.y1}function I(t,e){return e.y1-t.y1}function z(t){return t.target.column-t.source.column}function O(t){return t.target.x0-t.source.x1}function D(t,e){var r=T(t),n=O(e)/Math.tan(r);return"up"==q(t)?t.y1+n:t.y1-n}function R(t,e){var r=T(t),n=O(e)/Math.tan(r);return"up"==q(t)?t.y1-n:t.y1+n}function F(t,e,r,n){t.links.forEach((function(a){if(!a.circular&&a.target.column-a.source.column>1){var i=a.source.column+1,o=a.target.column-1,s=1,l=o-i+1;for(s=1;i<=o;i++,s++)t.nodes.forEach((function(o){if(o.column==i){var c,u=s/(l+1),h=Math.pow(1-u,3),f=3*u*Math.pow(1-u,2),p=3*Math.pow(u,2)*(1-u),d=Math.pow(u,3),g=h*a.y0+f*a.y0+p*a.y1+d*a.y1,m=g-a.width/2,v=g+a.width/2;m>o.y0&&mo.y0&&vo.y1)&&(c=v-o.y0+10,o=N(o,c,e,r),t.nodes.forEach((function(t){b(t,n)!=b(o,n)&&t.column==o.column&&t.y0o.y1&&N(t,c,e,r)})))}}))}}))}function B(t,e){return t.y0>e.y0&&t.y0e.y0&&t.y1e.y1)}function N(t,e,r,n){return t.y0+e>=r&&t.y1+e<=n&&(t.y0=t.y0+e,t.y1=t.y1+e,t.targetLinks.forEach((function(t){t.y1=t.y1+e})),t.sourceLinks.forEach((function(t){t.y0=t.y0+e}))),t}function j(t,e,r,n){t.nodes.forEach((function(a){n&&a.y+(a.y1-a.y0)>e&&(a.y=a.y-(a.y+(a.y1-a.y0)-e));var i=t.links.filter((function(t){return b(t.source,r)==b(a,r)})),o=i.length;o>1&&i.sort((function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!V(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var r=R(e,t);return t.y1-r}if(e.target.column>t.target.column)return R(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0}));var s=a.y0;i.forEach((function(t){t.y0=s+t.width/2,s+=t.width})),i.forEach((function(t,e){if("bottom"==t.circularLinkType){for(var r=e+1,n=0;r1&&n.sort((function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!V(t,e))return t.y0-e.y0;if(e.source.column0?"up":"down"}function H(t,e){return b(t.source,e)==b(t.target,e)}function G(t,r,n){var a=t.nodes,i=t.links,o=!1,s=!1;if(i.forEach((function(t){"top"==t.circularLinkType?o=!0:"bottom"==t.circularLinkType&&(s=!0)})),0==o||0==s){var l=e.min(a,(function(t){return t.y0})),c=(n-r)/(e.max(a,(function(t){return t.y1}))-l);a.forEach((function(t){var e=(t.y1-t.y0)*c;t.y0=(t.y0-l)*c,t.y1=t.y0+e})),i.forEach((function(t){t.y0=(t.y0-l)*c,t.y1=(t.y1-l)*c,t.width=t.width*c}))}}t.sankeyCircular=function(){var t,n,a=0,i=0,b=1,T=1,M=24,A=m,E=o,C=v,L=y,P=32,I=2,z=null;function O(){var t={nodes:C.apply(null,arguments),links:L.apply(null,arguments)};D(t),_(t,A,z),R(t),B(t),w(t,A),N(t,P,A),V(t);for(var e=4,r=0;r0?r+25+10:r,bottom:n=n>0?n+25+10:n,left:i=i>0?i+25+10:i,right:a=a>0?a+25+10:a}}(o),h=function(t,r){var n=e.max(t.nodes,(function(t){return t.column})),o=b-a,s=T-i,l=o/(o+r.right+r.left),c=s/(s+r.top+r.bottom);return a=a*l+r.left,b=0==r.right?b:b*l,i=i*c+r.top,T*=c,t.nodes.forEach((function(t){t.x0=a+t.column*((b-a-M)/n),t.x1=t.x0+M})),c}(o,u);l*=h,o.links.forEach((function(t){t.width=t.value*l})),c.forEach((function(t){var e=t.length;t.forEach((function(t,n){t.depth==c.length-1&&1==e||0==t.depth&&1==e?(t.y0=T/2-t.value*l,t.y1=t.y0+t.value*l):t.partOfCycle?0==k(t,r)?(t.y0=T/2+n,t.y1=t.y0+t.value*l):"top"==t.circularLinkType?(t.y0=i+n,t.y1=t.y0+t.value*l):(t.y0=T-t.value*l-n,t.y1=t.y0+t.value*l):0==u.top||0==u.bottom?(t.y0=(T-i)/e*n,t.y1=t.y0+t.value*l):(t.y0=(T-i)/2-e/2+n,t.y1=t.y0+t.value*l)}))}))}(l),y();for(var u=1,m=s;m>0;--m)v(u*=.99,l),y();function v(t,r){var n=c.length;c.forEach((function(a){var i=a.length,o=a[0].depth;a.forEach((function(a){var s;if(a.sourceLinks.length||a.targetLinks.length)if(a.partOfCycle&&k(a,r)>0);else if(0==o&&1==i)s=a.y1-a.y0,a.y0=T/2-s/2,a.y1=T/2+s/2;else if(o==n-1&&1==i)s=a.y1-a.y0,a.y0=T/2-s/2,a.y1=T/2+s/2;else{var l=e.mean(a.sourceLinks,g),c=e.mean(a.targetLinks,d),u=((l&&c?(l+c)/2:l||c)-p(a))*t;a.y0+=u,a.y1+=u}}))}))}function y(){c.forEach((function(e){var r,n,a,o=i,s=e.length;for(e.sort(h),a=0;a0&&(r.y0+=n,r.y1+=n),o=r.y1+t;if((n=o-t-T)>0)for(o=r.y0-=n,r.y1-=n,a=s-2;a>=0;--a)(n=(r=e[a]).y1+t-o)>0&&(r.y0-=n,r.y1-=n),o=r.y0}))}}function V(t){t.nodes.forEach((function(t){t.sourceLinks.sort(u),t.targetLinks.sort(c)})),t.nodes.forEach((function(t){var e=t.y0,r=e,n=t.y1,a=n;t.sourceLinks.forEach((function(t){t.circular?(t.y0=n-t.width/2,n-=t.width):(t.y0=e+t.width/2,e+=t.width)})),t.targetLinks.forEach((function(t){t.circular?(t.y1=a-t.width/2,a-=t.width):(t.y1=r+t.width/2,r+=t.width)}))}))}return O.nodeId=function(t){return arguments.length?(A="function"==typeof t?t:s(t),O):A},O.nodeAlign=function(t){return arguments.length?(E="function"==typeof t?t:s(t),O):E},O.nodeWidth=function(t){return arguments.length?(M=+t,O):M},O.nodePadding=function(e){return arguments.length?(t=+e,O):t},O.nodes=function(t){return arguments.length?(C="function"==typeof t?t:s(t),O):C},O.links=function(t){return arguments.length?(L="function"==typeof t?t:s(t),O):L},O.size=function(t){return arguments.length?(a=i=0,b=+t[0],T=+t[1],O):[b-a,T-i]},O.extent=function(t){return arguments.length?(a=+t[0][0],b=+t[1][0],i=+t[0][1],T=+t[1][1],O):[[a,i],[b,T]]},O.iterations=function(t){return arguments.length?(P=+t,O):P},O.circularLinkGap=function(t){return arguments.length?(I=+t,O):I},O.nodePaddingRatio=function(t){return arguments.length?(n=+t,O):n},O.sortNodes=function(t){return arguments.length?(z=t,O):z},O.update=function(t){return w(t,A),V(t),t.links.forEach((function(t){t.circular&&(t.circularLinkType=t.y0+t.y1i&&(b=i);var o=e.min(a,(function(t){return(y-n-(t.length-1)*b)/e.sum(t,u)}));a.forEach((function(t){t.forEach((function(t,e){t.y1=(t.y0=e)+t.value*o}))})),t.links.forEach((function(t){t.width=t.value*o}))}(),d();for(var i=1,o=M;o>0;--o)l(i*=.99),d(),s(i),d();function s(t){a.forEach((function(r){r.forEach((function(r){if(r.targetLinks.length){var n=(e.sum(r.targetLinks,f)/e.sum(r.targetLinks,u)-h(r))*t;r.y0+=n,r.y1+=n}}))}))}function l(t){a.slice().reverse().forEach((function(r){r.forEach((function(r){if(r.sourceLinks.length){var n=(e.sum(r.sourceLinks,p)/e.sum(r.sourceLinks,u)-h(r))*t;r.y0+=n,r.y1+=n}}))}))}function d(){a.forEach((function(t){var e,r,a,i=n,o=t.length;for(t.sort(c),a=0;a0&&(e.y0+=r,e.y1+=r),i=e.y1+b;if((r=i-b-y)>0)for(i=e.y0-=r,e.y1-=r,a=o-2;a>=0;--a)(r=(e=t[a]).y1+b-i)>0&&(e.y0-=r,e.y1-=r),i=e.y0}))}}function P(t){t.nodes.forEach((function(t){t.sourceLinks.sort(l),t.targetLinks.sort(s)})),t.nodes.forEach((function(t){var e=t.y0,r=e;t.sourceLinks.forEach((function(t){t.y0=e+t.width/2,e+=t.width})),t.targetLinks.forEach((function(t){t.y1=r+t.width/2,r+=t.width}))}))}return A.update=function(t){return P(t),t},A.nodeId=function(t){return arguments.length?(_="function"==typeof t?t:o(t),A):_},A.nodeAlign=function(t){return arguments.length?(w="function"==typeof t?t:o(t),A):w},A.nodeWidth=function(t){return arguments.length?(x=+t,A):x},A.nodePadding=function(t){return arguments.length?(b=+t,A):b},A.nodes=function(t){return arguments.length?(T="function"==typeof t?t:o(t),A):T},A.links=function(t){return arguments.length?(k="function"==typeof t?t:o(t),A):k},A.size=function(e){return arguments.length?(t=n=0,a=+e[0],y=+e[1],A):[a-t,y-n]},A.extent=function(e){return arguments.length?(t=+e[0][0],a=+e[1][0],n=+e[0][1],y=+e[1][1],A):[[t,n],[a,y]]},A.iterations=function(t){return arguments.length?(M=+t,A):M},A},t.sankeyCenter=function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?e.min(t.sourceLinks,a)-1:0},t.sankeyLeft=function(t){return t.depth},t.sankeyRight=function(t,e){return e-1-t.height},t.sankeyJustify=i,t.sankeyLinkHorizontal=function(){return n.linkHorizontal().source(y).target(x)},Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-array":156,"d3-collection":157,"d3-shape":165}],57:[function(t,e,r){"use strict";e.exports=t("./quad")},{"./quad":58}],58:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),a=t("clamp"),i=t("parse-rect"),o=t("array-bounds"),s=t("pick-by-alias"),l=t("defined"),c=t("flatten-vertex-data"),u=t("is-obj"),h=t("dtype"),f=t("math-log2");function p(t,e){for(var r=e[0],n=e[1],i=1/(e[2]-r),o=1/(e[3]-n),s=new Array(t.length),l=0,c=t.length/2;l>>1;e.dtype||(e.dtype="array"),"string"==typeof e.dtype?d=new(h(e.dtype))(m):e.dtype&&(d=e.dtype,Array.isArray(d)&&(d.length=m));for(var v=0;vr||s>1073741824){for(var f=0;fe+n||w>r+n||T=M||i===o)){var s=y[a];void 0===o&&(o=s.length);for(var l=i;l=d&&u<=m&&h>=g&&h<=v&&S.push(c)}var f=x[a],p=f[4*i+0],b=f[4*i+1],A=f[4*i+2],E=f[4*i+3],P=L(f,i+1),I=.5*n,z=a+1;C(e,r,I,z,p,b||A||E||P),C(e,r+I,I,z,b,A||E||P),C(e+I,r,I,z,A,E||P),C(e+I,r+I,I,z,E,P)}}function L(t,e){for(var r=null,n=0;null===r;)if(r=t[4*e+n],++n>t.length)return null;return r}return C(0,0,1,0,0,1),S},d;function E(t,e,r,a,i){for(var o=[],s=0;s0){e+=Math.abs(i(t[0]));for(var r=1;r2){for(s=0;st[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},r.radiansToLength=h,r.lengthToRadians=f,r.lengthToDegrees=function(t,e){return p(f(t,e))},r.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},r.radiansToDegrees=p,r.degreesToRadians=function(t){return t%360*Math.PI/180},r.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return h(f(t,e),r)},r.convertArea=function(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var a=r.areaFactors[e];if(!a)throw new Error("invalid original units");var i=r.areaFactors[n];if(!i)throw new Error("invalid final units");return t/a*i},r.isNumber=d,r.isObject=function(t){return!!t&&t.constructor===Object},r.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!d(t))throw new Error("bbox must only contain numbers")}))},r.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},r.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},r.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},r.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},r.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},r.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},r.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},r.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},{}],63:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/helpers");function a(t,e,r){if(null!==t)for(var n,i,o,s,l,c,u,h,f=0,p=0,d=t.type,g="FeatureCollection"===d,m="Feature"===d,v=g?t.features.length:1,y=0;yc||p>u||d>h)return l=a,c=r,u=p,h=d,void(o=0);var g=n.lineString([l,a],t.properties);if(!1===e(g,r,i,d,o))return!1;o++,l=a}))&&void 0}}}))}function u(t,e){if(!t)throw new Error("geojson is required");l(t,(function(t,r,a){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,a,0,0))return!1;break;case"Polygon":for(var s=0;sa&&(a=t[o]),t[o]: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', verdana, arial, sans-serif;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":778}],2:[function(t,e,r){"use strict";e.exports=t("../src/transforms/aggregate")},{"../src/transforms/aggregate":1364}],3:[function(t,e,r){"use strict";e.exports=t("../src/traces/bar")},{"../src/traces/bar":928}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/barpolar")},{"../src/traces/barpolar":941}],5:[function(t,e,r){"use strict";e.exports=t("../src/traces/box")},{"../src/traces/box":951}],6:[function(t,e,r){"use strict";e.exports=t("../src/components/calendars")},{"../src/components/calendars":641}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/candlestick")},{"../src/traces/candlestick":960}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/carpet")},{"../src/traces/carpet":979}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/choropleth")},{"../src/traces/choropleth":993}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/choroplethmapbox")},{"../src/traces/choroplethmapbox":1e3}],11:[function(t,e,r){"use strict";e.exports=t("../src/traces/cone")},{"../src/traces/cone":1006}],12:[function(t,e,r){"use strict";e.exports=t("../src/traces/contour")},{"../src/traces/contour":1021}],13:[function(t,e,r){"use strict";e.exports=t("../src/traces/contourcarpet")},{"../src/traces/contourcarpet":1032}],14:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":755}],15:[function(t,e,r){"use strict";e.exports=t("../src/traces/densitymapbox")},{"../src/traces/densitymapbox":1040}],16:[function(t,e,r){"use strict";e.exports=t("../src/transforms/filter")},{"../src/transforms/filter":1365}],17:[function(t,e,r){"use strict";e.exports=t("../src/traces/funnel")},{"../src/traces/funnel":1050}],18:[function(t,e,r){"use strict";e.exports=t("../src/traces/funnelarea")},{"../src/traces/funnelarea":1059}],19:[function(t,e,r){"use strict";e.exports=t("../src/transforms/groupby")},{"../src/transforms/groupby":1366}],20:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":1072}],21:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmapgl")},{"../src/traces/heatmapgl":1082}],22:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":1094}],23:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":1100}],24:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":1104}],25:[function(t,e,r){"use strict";e.exports=t("../src/traces/image")},{"../src/traces/image":1112}],26:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./bar"),t("./box"),t("./heatmap"),t("./histogram"),t("./histogram2d"),t("./histogram2dcontour"),t("./contour"),t("./scatterternary"),t("./violin"),t("./funnel"),t("./waterfall"),t("./image"),t("./pie"),t("./sunburst"),t("./treemap"),t("./funnelarea"),t("./scatter3d"),t("./surface"),t("./isosurface"),t("./volume"),t("./mesh3d"),t("./cone"),t("./streamtube"),t("./scattergeo"),t("./choropleth"),t("./scattergl"),t("./splom"),t("./pointcloud"),t("./heatmapgl"),t("./parcoords"),t("./parcats"),t("./scattermapbox"),t("./choroplethmapbox"),t("./densitymapbox"),t("./sankey"),t("./indicator"),t("./table"),t("./carpet"),t("./scattercarpet"),t("./contourcarpet"),t("./ohlc"),t("./candlestick"),t("./scatterpolar"),t("./scatterpolargl"),t("./barpolar")]),n.register([t("./aggregate"),t("./filter"),t("./groupby"),t("./sort")]),n.register([t("./calendars")]),e.exports=n},{"./aggregate":2,"./bar":3,"./barpolar":4,"./box":5,"./calendars":6,"./candlestick":7,"./carpet":8,"./choropleth":9,"./choroplethmapbox":10,"./cone":11,"./contour":12,"./contourcarpet":13,"./core":14,"./densitymapbox":15,"./filter":16,"./funnel":17,"./funnelarea":18,"./groupby":19,"./heatmap":20,"./heatmapgl":21,"./histogram":22,"./histogram2d":23,"./histogram2dcontour":24,"./image":25,"./indicator":27,"./isosurface":28,"./mesh3d":29,"./ohlc":30,"./parcats":31,"./parcoords":32,"./pie":33,"./pointcloud":34,"./sankey":35,"./scatter3d":36,"./scattercarpet":37,"./scattergeo":38,"./scattergl":39,"./scattermapbox":40,"./scatterpolar":41,"./scatterpolargl":42,"./scatterternary":43,"./sort":44,"./splom":45,"./streamtube":46,"./sunburst":47,"./surface":48,"./table":49,"./treemap":50,"./violin":51,"./volume":52,"./waterfall":53}],27:[function(t,e,r){"use strict";e.exports=t("../src/traces/indicator")},{"../src/traces/indicator":1120}],28:[function(t,e,r){"use strict";e.exports=t("../src/traces/isosurface")},{"../src/traces/isosurface":1126}],29:[function(t,e,r){"use strict";e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":1131}],30:[function(t,e,r){"use strict";e.exports=t("../src/traces/ohlc")},{"../src/traces/ohlc":1136}],31:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcats")},{"../src/traces/parcats":1145}],32:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcoords")},{"../src/traces/parcoords":1155}],33:[function(t,e,r){"use strict";e.exports=t("../src/traces/pie")},{"../src/traces/pie":1166}],34:[function(t,e,r){"use strict";e.exports=t("../src/traces/pointcloud")},{"../src/traces/pointcloud":1175}],35:[function(t,e,r){"use strict";e.exports=t("../src/traces/sankey")},{"../src/traces/sankey":1181}],36:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":1219}],37:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattercarpet")},{"../src/traces/scattercarpet":1226}],38:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergeo")},{"../src/traces/scattergeo":1234}],39:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":1247}],40:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":1257}],41:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterpolar")},{"../src/traces/scatterpolar":1265}],42:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterpolargl")},{"../src/traces/scatterpolargl":1272}],43:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":1280}],44:[function(t,e,r){"use strict";e.exports=t("../src/transforms/sort")},{"../src/transforms/sort":1368}],45:[function(t,e,r){"use strict";e.exports=t("../src/traces/splom")},{"../src/traces/splom":1289}],46:[function(t,e,r){"use strict";e.exports=t("../src/traces/streamtube")},{"../src/traces/streamtube":1297}],47:[function(t,e,r){"use strict";e.exports=t("../src/traces/sunburst")},{"../src/traces/sunburst":1305}],48:[function(t,e,r){"use strict";e.exports=t("../src/traces/surface")},{"../src/traces/surface":1314}],49:[function(t,e,r){"use strict";e.exports=t("../src/traces/table")},{"../src/traces/table":1322}],50:[function(t,e,r){"use strict";e.exports=t("../src/traces/treemap")},{"../src/traces/treemap":1331}],51:[function(t,e,r){"use strict";e.exports=t("../src/traces/violin")},{"../src/traces/violin":1343}],52:[function(t,e,r){"use strict";e.exports=t("../src/traces/volume")},{"../src/traces/volume":1351}],53:[function(t,e,r){"use strict";e.exports=t("../src/traces/waterfall")},{"../src/traces/waterfall":1359}],54:[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],c=t.mode||"turntable",u=n(),f=i(),h=a();return u.setDistanceLimits(l[0],l[1]),u.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:u,orbit:f,matrix:h},c)};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;n1||i>1)}function A(t,e,r){return t.sort(E),t.forEach((function(n,i){var a,o,s=0;if(H(n,r)&&M(n))n.circularPathData.verticalBuffer=s+n.width/2;else{for(var l=0;lo.source.column)){var c=t[l].circularPathData.verticalBuffer+t[l].width/2+e;s=c>s?c:s}n.circularPathData.verticalBuffer=s+n.width/2}})),t}function S(t,r,i,a){var o=e.min(t.links,(function(t){return t.source.y0}));t.links.forEach((function(t){t.circular&&(t.circularPathData={})})),A(t.links.filter((function(t){return"top"==t.circularLinkType})),r,a),A(t.links.filter((function(t){return"bottom"==t.circularLinkType})),r,a),t.links.forEach((function(e){if(e.circular){if(e.circularPathData.arcRadius=e.width+10,e.circularPathData.leftNodeBuffer=5,e.circularPathData.rightNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,H(e,a)&&M(e))e.circularPathData.leftSmallArcRadius=10+e.width/2,e.circularPathData.leftLargeArcRadius=10+e.width/2,e.circularPathData.rightSmallArcRadius=10+e.width/2,e.circularPathData.rightLargeArcRadius=10+e.width/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+25+e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-25-e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=t.links.filter((function(t){return t.source.column==s&&t.circularLinkType==l}));"bottom"==e.circularLinkType?c.sort(L):c.sort(C);var u=0;c.forEach((function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=10+e.width/2+u,e.circularPathData.leftLargeArcRadius=10+e.width/2+n*r+u),u+=t.width})),s=e.target.column,c=t.links.filter((function(t){return t.target.column==s&&t.circularLinkType==l})),"bottom"==e.circularLinkType?c.sort(P):c.sort(I),u=0,c.forEach((function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=10+e.width/2+u,e.circularPathData.rightLargeArcRadius=10+e.width/2+n*r+u),u+=t.width})),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i,e.source.y1,e.target.y1)+25+e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius):(e.circularPathData.verticalFullExtent=o-25-e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius)}e.circularPathData.leftInnerExtent=e.circularPathData.sourceX+e.circularPathData.leftNodeBuffer,e.circularPathData.rightInnerExtent=e.circularPathData.targetX-e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.sourceX+e.circularPathData.leftLargeArcRadius+e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.targetX-e.circularPathData.rightLargeArcRadius-e.circularPathData.rightNodeBuffer}if(e.circular)e.path=function(t){var e="";e="top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.leftSmallArcRadius)+" L"+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" L"+t.circularPathData.rightFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.rightSmallArcRadius)+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.leftSmallArcRadius)+" L"+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" L"+t.circularPathData.rightFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.rightSmallArcRadius)+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY;return e}(e);else{var f=n.linkHorizontal().source((function(t){return[t.source.x0+(t.source.x1-t.source.x0),t.y0]})).target((function(t){return[t.target.x0,t.y1]}));e.path=f(e)}}))}function E(t,e){return z(t)==z(e)?"bottom"==t.circularLinkType?L(t,e):C(t,e):z(e)-z(t)}function C(t,e){return t.y0-e.y0}function L(t,e){return e.y0-t.y0}function I(t,e){return t.y1-e.y1}function P(t,e){return e.y1-t.y1}function z(t){return t.target.column-t.source.column}function O(t){return t.target.x0-t.source.x1}function D(t,e){var r=T(t),n=O(e)/Math.tan(r);return"up"==q(t)?t.y1+n:t.y1-n}function R(t,e){var r=T(t),n=O(e)/Math.tan(r);return"up"==q(t)?t.y1-n:t.y1+n}function F(t,e,r,n){t.links.forEach((function(i){if(!i.circular&&i.target.column-i.source.column>1){var a=i.source.column+1,o=i.target.column-1,s=1,l=o-a+1;for(s=1;a<=o;a++,s++)t.nodes.forEach((function(o){if(o.column==a){var c,u=s/(l+1),f=Math.pow(1-u,3),h=3*u*Math.pow(1-u,2),p=3*Math.pow(u,2)*(1-u),d=Math.pow(u,3),g=f*i.y0+h*i.y0+p*i.y1+d*i.y1,m=g-i.width/2,v=g+i.width/2;m>o.y0&&mo.y0&&vo.y1)&&(c=v-o.y0+10,o=N(o,c,e,r),t.nodes.forEach((function(t){b(t,n)!=b(o,n)&&t.column==o.column&&t.y0o.y1&&N(t,c,e,r)})))}}))}}))}function B(t,e){return t.y0>e.y0&&t.y0e.y0&&t.y1e.y1)}function N(t,e,r,n){return t.y0+e>=r&&t.y1+e<=n&&(t.y0=t.y0+e,t.y1=t.y1+e,t.targetLinks.forEach((function(t){t.y1=t.y1+e})),t.sourceLinks.forEach((function(t){t.y0=t.y0+e}))),t}function j(t,e,r,n){t.nodes.forEach((function(i){n&&i.y+(i.y1-i.y0)>e&&(i.y=i.y-(i.y+(i.y1-i.y0)-e));var a=t.links.filter((function(t){return b(t.source,r)==b(i,r)})),o=a.length;o>1&&a.sort((function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!V(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var r=R(e,t);return t.y1-r}if(e.target.column>t.target.column)return R(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0}));var s=i.y0;a.forEach((function(t){t.y0=s+t.width/2,s+=t.width})),a.forEach((function(t,e){if("bottom"==t.circularLinkType){for(var r=e+1,n=0;r1&&n.sort((function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!V(t,e))return t.y0-e.y0;if(e.source.column0?"up":"down"}function H(t,e){return b(t.source,e)==b(t.target,e)}function G(t,r,n){var i=t.nodes,a=t.links,o=!1,s=!1;if(a.forEach((function(t){"top"==t.circularLinkType?o=!0:"bottom"==t.circularLinkType&&(s=!0)})),0==o||0==s){var l=e.min(i,(function(t){return t.y0})),c=(n-r)/(e.max(i,(function(t){return t.y1}))-l);i.forEach((function(t){var e=(t.y1-t.y0)*c;t.y0=(t.y0-l)*c,t.y1=t.y0+e})),a.forEach((function(t){t.y0=(t.y0-l)*c,t.y1=(t.y1-l)*c,t.width=t.width*c}))}}t.sankeyCircular=function(){var t,n,i=0,a=0,b=1,T=1,M=24,A=m,E=o,C=v,L=y,I=32,P=2,z=null;function O(){var t={nodes:C.apply(null,arguments),links:L.apply(null,arguments)};D(t),_(t,A,z),R(t),B(t),w(t,A),N(t,I,A),V(t);for(var e=4,r=0;r0?r+25+10:r,bottom:n=n>0?n+25+10:n,left:a=a>0?a+25+10:a,right:i=i>0?i+25+10:i}}(o),f=function(t,r){var n=e.max(t.nodes,(function(t){return t.column})),o=b-i,s=T-a,l=o/(o+r.right+r.left),c=s/(s+r.top+r.bottom);return i=i*l+r.left,b=0==r.right?b:b*l,a=a*c+r.top,T*=c,t.nodes.forEach((function(t){t.x0=i+t.column*((b-i-M)/n),t.x1=t.x0+M})),c}(o,u);l*=f,o.links.forEach((function(t){t.width=t.value*l})),c.forEach((function(t){var e=t.length;t.forEach((function(t,n){t.depth==c.length-1&&1==e||0==t.depth&&1==e?(t.y0=T/2-t.value*l,t.y1=t.y0+t.value*l):t.partOfCycle?0==k(t,r)?(t.y0=T/2+n,t.y1=t.y0+t.value*l):"top"==t.circularLinkType?(t.y0=a+n,t.y1=t.y0+t.value*l):(t.y0=T-t.value*l-n,t.y1=t.y0+t.value*l):0==u.top||0==u.bottom?(t.y0=(T-a)/e*n,t.y1=t.y0+t.value*l):(t.y0=(T-a)/2-e/2+n,t.y1=t.y0+t.value*l)}))}))}(l),y();for(var u=1,m=s;m>0;--m)v(u*=.99,l),y();function v(t,r){var n=c.length;c.forEach((function(i){var a=i.length,o=i[0].depth;i.forEach((function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&k(i,r)>0);else if(0==o&&1==a)s=i.y1-i.y0,i.y0=T/2-s/2,i.y1=T/2+s/2;else if(o==n-1&&1==a)s=i.y1-i.y0,i.y0=T/2-s/2,i.y1=T/2+s/2;else{var l=e.mean(i.sourceLinks,g),c=e.mean(i.targetLinks,d),u=((l&&c?(l+c)/2:l||c)-p(i))*t;i.y0+=u,i.y1+=u}}))}))}function y(){c.forEach((function(e){var r,n,i,o=a,s=e.length;for(e.sort(f),i=0;i0&&(r.y0+=n,r.y1+=n),o=r.y1+t;if((n=o-t-T)>0)for(o=r.y0-=n,r.y1-=n,i=s-2;i>=0;--i)(n=(r=e[i]).y1+t-o)>0&&(r.y0-=n,r.y1-=n),o=r.y0}))}}function V(t){t.nodes.forEach((function(t){t.sourceLinks.sort(u),t.targetLinks.sort(c)})),t.nodes.forEach((function(t){var e=t.y0,r=e,n=t.y1,i=n;t.sourceLinks.forEach((function(t){t.circular?(t.y0=n-t.width/2,n-=t.width):(t.y0=e+t.width/2,e+=t.width)})),t.targetLinks.forEach((function(t){t.circular?(t.y1=i-t.width/2,i-=t.width):(t.y1=r+t.width/2,r+=t.width)}))}))}return O.nodeId=function(t){return arguments.length?(A="function"==typeof t?t:s(t),O):A},O.nodeAlign=function(t){return arguments.length?(E="function"==typeof t?t:s(t),O):E},O.nodeWidth=function(t){return arguments.length?(M=+t,O):M},O.nodePadding=function(e){return arguments.length?(t=+e,O):t},O.nodes=function(t){return arguments.length?(C="function"==typeof t?t:s(t),O):C},O.links=function(t){return arguments.length?(L="function"==typeof t?t:s(t),O):L},O.size=function(t){return arguments.length?(i=a=0,b=+t[0],T=+t[1],O):[b-i,T-a]},O.extent=function(t){return arguments.length?(i=+t[0][0],b=+t[1][0],a=+t[0][1],T=+t[1][1],O):[[i,a],[b,T]]},O.iterations=function(t){return arguments.length?(I=+t,O):I},O.circularLinkGap=function(t){return arguments.length?(P=+t,O):P},O.nodePaddingRatio=function(t){return arguments.length?(n=+t,O):n},O.sortNodes=function(t){return arguments.length?(z=t,O):z},O.update=function(t){return w(t,A),V(t),t.links.forEach((function(t){t.circular&&(t.circularLinkType=t.y0+t.y1a&&(b=a);var o=e.min(i,(function(t){return(y-n-(t.length-1)*b)/e.sum(t,u)}));i.forEach((function(t){t.forEach((function(t,e){t.y1=(t.y0=e)+t.value*o}))})),t.links.forEach((function(t){t.width=t.value*o}))}(),d();for(var a=1,o=M;o>0;--o)l(a*=.99),d(),s(a),d();function s(t){i.forEach((function(r){r.forEach((function(r){if(r.targetLinks.length){var n=(e.sum(r.targetLinks,h)/e.sum(r.targetLinks,u)-f(r))*t;r.y0+=n,r.y1+=n}}))}))}function l(t){i.slice().reverse().forEach((function(r){r.forEach((function(r){if(r.sourceLinks.length){var n=(e.sum(r.sourceLinks,p)/e.sum(r.sourceLinks,u)-f(r))*t;r.y0+=n,r.y1+=n}}))}))}function d(){i.forEach((function(t){var e,r,i,a=n,o=t.length;for(t.sort(c),i=0;i0&&(e.y0+=r,e.y1+=r),a=e.y1+b;if((r=a-b-y)>0)for(a=e.y0-=r,e.y1-=r,i=o-2;i>=0;--i)(r=(e=t[i]).y1+b-a)>0&&(e.y0-=r,e.y1-=r),a=e.y0}))}}function I(t){t.nodes.forEach((function(t){t.sourceLinks.sort(l),t.targetLinks.sort(s)})),t.nodes.forEach((function(t){var e=t.y0,r=e;t.sourceLinks.forEach((function(t){t.y0=e+t.width/2,e+=t.width})),t.targetLinks.forEach((function(t){t.y1=r+t.width/2,r+=t.width}))}))}return A.update=function(t){return I(t),t},A.nodeId=function(t){return arguments.length?(_="function"==typeof t?t:o(t),A):_},A.nodeAlign=function(t){return arguments.length?(w="function"==typeof t?t:o(t),A):w},A.nodeWidth=function(t){return arguments.length?(x=+t,A):x},A.nodePadding=function(t){return arguments.length?(b=+t,A):b},A.nodes=function(t){return arguments.length?(T="function"==typeof t?t:o(t),A):T},A.links=function(t){return arguments.length?(k="function"==typeof t?t:o(t),A):k},A.size=function(e){return arguments.length?(t=n=0,i=+e[0],y=+e[1],A):[i-t,y-n]},A.extent=function(e){return arguments.length?(t=+e[0][0],i=+e[1][0],n=+e[0][1],y=+e[1][1],A):[[t,n],[i,y]]},A.iterations=function(t){return arguments.length?(M=+t,A):M},A},t.sankeyCenter=function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?e.min(t.sourceLinks,i)-1:0},t.sankeyLeft=function(t){return t.depth},t.sankeyRight=function(t,e){return e-1-t.height},t.sankeyJustify=a,t.sankeyLinkHorizontal=function(){return n.linkHorizontal().source(y).target(x)},Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-array":156,"d3-collection":157,"d3-shape":165}],57:[function(t,e,r){"use strict";e.exports=t("./quad")},{"./quad":58}],58:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=t("clamp"),a=t("parse-rect"),o=t("array-bounds"),s=t("pick-by-alias"),l=t("defined"),c=t("flatten-vertex-data"),u=t("is-obj"),f=t("dtype"),h=t("math-log2");function p(t,e){for(var r=e[0],n=e[1],a=1/(e[2]-r),o=1/(e[3]-n),s=new Array(t.length),l=0,c=t.length/2;l>>1;e.dtype||(e.dtype="array"),"string"==typeof e.dtype?d=new(f(e.dtype))(m):e.dtype&&(d=e.dtype,Array.isArray(d)&&(d.length=m));for(var v=0;vr||s>1073741824){for(var h=0;he+n||w>r+n||T=M||a===o)){var s=y[i];void 0===o&&(o=s.length);for(var l=a;l=d&&u<=m&&f>=g&&f<=v&&S.push(c)}var h=x[i],p=h[4*a+0],b=h[4*a+1],A=h[4*a+2],E=h[4*a+3],I=L(h,a+1),P=.5*n,z=i+1;C(e,r,P,z,p,b||A||E||I),C(e,r+P,P,z,b,A||E||I),C(e+P,r,P,z,A,E||I),C(e+P,r+P,P,z,E,I)}}function L(t,e){for(var r=null,n=0;null===r;)if(r=t[4*e+n],++n>t.length)return null;return r}return C(0,0,1,0,0,1),S},d;function E(t,e,r,i,a){for(var o=[],s=0;s0){e+=Math.abs(a(t[0]));for(var r=1;r2){for(s=0;st[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},r.radiansToLength=f,r.lengthToRadians=h,r.lengthToDegrees=function(t,e){return p(h(t,e))},r.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},r.radiansToDegrees=p,r.degreesToRadians=function(t){return t%360*Math.PI/180},r.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return f(h(t,e),r)},r.convertArea=function(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=r.areaFactors[e];if(!i)throw new Error("invalid original units");var a=r.areaFactors[n];if(!a)throw new Error("invalid final units");return t/i*a},r.isNumber=d,r.isObject=function(t){return!!t&&t.constructor===Object},r.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!d(t))throw new Error("bbox must only contain numbers")}))},r.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")},r.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},r.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},r.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},r.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},r.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},r.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},r.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},{}],63:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/helpers");function i(t,e,r){if(null!==t)for(var n,a,o,s,l,c,u,f,h=0,p=0,d=t.type,g="FeatureCollection"===d,m="Feature"===d,v=g?t.features.length:1,y=0;yc||p>u||d>f)return l=i,c=r,u=p,f=d,void(o=0);var g=n.lineString([l,i],t.properties);if(!1===e(g,r,a,d,o))return!1;o++,l=i}))&&void 0}}}))}function u(t,e){if(!t)throw new Error("geojson is required");l(t,(function(t,r,i){if(null!==t.geometry){var a=t.geometry.type,o=t.geometry.coordinates;switch(a){case"LineString":if(!1===e(t,r,i,0,0))return!1;break;case"Polygon":for(var s=0;si&&(i=t[o]),t[o] * @license MIT - */function a(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,a=0,i=Math.min(r,n);a=0;c--)if(u[c]!==h[c])return!1;for(c=u.length-1;c>=0;c--)if(s=u[c],!x(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function b(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var a;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),a=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!a&&v(a,r,"Missing expected exception"+n);var i="string"==typeof n,s=!t&&a&&!r;if((!t&&o.isError(a)&&i&&_(a,r)||s)&&v(a,r,"Got unwanted exception"+n),t&&a&&r&&!_(a,r)||!t&&a)throw a}f.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(m(t.actual),128)+" "+t.operator+" "+g(m(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,a=d(e),i=n.indexOf("\n"+a);if(i>=0){var o=n.indexOf("\n",i+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(f.AssertionError,Error),f.fail=v,f.ok=y,f.equal=function(t,e,r){t!=e&&v(t,e,r,"==",f.equal)},f.notEqual=function(t,e,r){t==e&&v(t,e,r,"!=",f.notEqual)},f.deepEqual=function(t,e,r){x(t,e,!1)||v(t,e,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(t,e,r){x(t,e,!0)||v(t,e,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(t,e,r){x(t,e,!1)&&v(t,e,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function t(e,r,n){x(e,r,!0)&&v(e,r,n,"notDeepStrictEqual",t)},f.strictEqual=function(t,e,r){t!==e&&v(t,e,r,"===",f.strictEqual)},f.notStrictEqual=function(t,e,r){t===e&&v(t,e,r,"!==",f.notStrictEqual)},f.throws=function(t,e,r){w(!0,t,e,r)},f.doesNotThrow=function(t,e,r){w(!1,t,e,r)},f.ifError=function(t){if(t)throw t},f.strict=n((function t(e,r){e||v(e,!0,r,"==",t)}),f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var T=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":473,"util/":76}],74:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],75:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],76:[function(t,e,r){(function(e,n){var a=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),l=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(e)?n.showHidden=e:e&&r._extend(n,e),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),u(n,t,n.depth)}function l(t,e){var r=s.styles[e];return r?"\x1b["+s.colors[r][0]+"m"+t+"\x1b["+s.colors[r][1]+"m":t}function c(t,e){return t}function u(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var a=e.inspect(n,t);return v(a)||(a=u(t,a,n)),a}var i=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(m(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),w(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(e);if(0===o.length){if(T(e)){var l=e.name?": "+e.name:"";return t.stylize("[Function"+l+"]","special")}if(x(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(_(e))return t.stylize(Date.prototype.toString.call(e),"date");if(w(e))return h(e)}var c,b="",k=!1,M=["{","}"];(p(e)&&(k=!0,M=["[","]"]),T(e))&&(b=" [Function"+(e.name?": "+e.name:"")+"]");return x(e)&&(b=" "+RegExp.prototype.toString.call(e)),_(e)&&(b=" "+Date.prototype.toUTCString.call(e)),w(e)&&(b=" "+h(e)),0!==o.length||k&&0!=e.length?n<0?x(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=k?function(t,e,r,n,a){for(var i=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,b,M)):M[0]+b+M[1]}function h(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,r,n,a,i){var o,s,l;if((l=Object.getOwnPropertyDescriptor(e,a)||{value:e[a]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),E(n,a)||(o="["+a+"]"),s||(t.seen.indexOf(l.value)<0?(s=g(r)?u(t,l.value,null):u(t,l.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),y(o)){if(i&&a.match(/^\d+$/))return s;(o=JSON.stringify(""+a)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function g(t){return null===t}function m(t){return"number"==typeof t}function v(t){return"string"==typeof t}function y(t){return void 0===t}function x(t){return b(t)&&"[object RegExp]"===k(t)}function b(t){return"object"==typeof t&&null!==t}function _(t){return b(t)&&"[object Date]"===k(t)}function w(t){return b(t)&&("[object Error]"===k(t)||t instanceof Error)}function T(t){return"function"==typeof t}function k(t){return Object.prototype.toString.call(t)}function M(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(y(i)&&(i=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(i)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=m,r.isString=v,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=y,r.isRegExp=x,r.isObject=b,r.isDate=_,r.isError=w,r.isFunction=T,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t},r.isBuffer=t("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function S(){var t=new Date,e=[M(t.getHours()),M(t.getMinutes()),M(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function E(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){console.log("%s - %s",S(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!b(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":75,_process:500,inherits:74}],77:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],78:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=e.length,i=new Array(r+1),o=0;o0?o-4:o;for(r=0;r>16&255,l[u++]=e>>8&255,l[u++]=255&e;2===s&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,l[u++]=255&e);1===s&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e);return l},r.fromByteArray=function(t){for(var e,r=t.length,a=r%3,i=[],o=0,s=r-a;os?s:o+16383));1===a?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===a&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="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 u(t,e,r){for(var a,i,o=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],80:[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":90}],81:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],82:[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":90}],83:[function(t,e,r){"use strict";var n=t("./is-rat"),a=t("./lib/is-bn"),i=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 c,u,h=0;if(a(e))c=e.clone();else if("string"==typeof e)c=o(e);else{if(0===e)return[i(0),i(1)];if(e===Math.floor(e))c=i(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),h-=256;c=i(e)}}if(n(r))c.mul(r[1]),u=r[0].clone();else if(a(r))u=r.clone();else if("string"==typeof r)u=o(r);else if(r)if(r===Math.floor(r))u=i(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),h+=256;u=i(r)}else u=i(1);h>0?c=c.ushln(h):h<0&&(u=u.ushln(-h));return s(c,u)}},{"./div":82,"./is-rat":84,"./lib/is-bn":88,"./lib/num-to-bn":89,"./lib/rationalize":90,"./lib/str-to-bn":91}],84:[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":88}],85:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":99}],86:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,a=0;if(1===e)a=r[0];else if(2===e)a=r[0]+67108864*r[1];else for(var i=0;i20)return 52;return r+32}},{"bit-twiddle":97,"double-bits":173}],88:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":99}],89:[function(t,e,r){"use strict";var n=t("bn.js"),a=t("double-bits");e.exports=function(t){var e=a.exponent(t);return e<52?new n(t):new n(t*Math.pow(2,52-e)).ushln(e-52)}},{"bn.js":99,"double-bits":173}],90:[function(t,e,r){"use strict";var n=t("./num-to-bn"),a=t("./bn-sign");e.exports=function(t,e){var r=a(t),i=a(e);if(0===r)return[n(0),n(1)];if(0===i)return[n(0),n(0)];i<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":85,"./num-to-bn":89}],91:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":99}],92:[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":90}],93:[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":85}],94:[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":90}],95:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var i=e.abs().divmod(r.abs()),o=i.div,s=n(o),l=i.mod,c=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return c*s;if(s){var u=a(s)+4,h=n(l.ushln(u).divRound(r));return c*(s+h*Math.pow(2,-u))}var f=r.bitLength()-l.bitLength()+53;h=n(l.ushln(f).divRound(r));return f<1023?c*h*Math.pow(2,-f):(h*=Math.pow(2,-1023),c*h*Math.pow(2,1023-f))}},{"./lib/bn-to-num":86,"./lib/ctz":87}],96:[function(t,e,r){"use strict";function n(t,e,r,n,a){var i=["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[m]"];return a?e.indexOf("c")<0?i.push(";if(x===y){return m}else if(x<=y){"):i.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):i.push(";if(",e,"){i=m;"),r?i.push("l=m+1}else{h=m-1}"):i.push("h=m-1}else{l=m+1}"),i.push("}"),a?i.push("return -1};"):i.push("return i};"),i.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],a),n("P","c(x,y)"+t+"0",e,["y","c"],a),"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:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],97:[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 a=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,a=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--a;t[e]=n<>>8&255]<<16|a[t>>>16&255]<<8|a[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}},{}],98:[function(t,e,r){"use strict";var n=t("clamp");e.exports=function(t,e){e||(e={});var r,o,s,l,c,u,h,f,p,d,g,m=null==e.cutoff?.25:e.cutoff,v=null==e.radius?8:e.radius,y=e.channel||0;if(ArrayBuffer.isView(t)||Array.isArray(t)){if(!e.width||!e.height)throw Error("For raw data width and height should be provided by options");r=e.width,o=e.height,l=t,u=e.stride?e.stride:Math.floor(t.length/r/o)}else window.HTMLCanvasElement&&t instanceof window.HTMLCanvasElement?(h=(f=t).getContext("2d"),r=f.width,o=f.height,p=h.getImageData(0,0,r,o),l=p.data,u=4):window.CanvasRenderingContext2D&&t instanceof window.CanvasRenderingContext2D?(f=t.canvas,h=t,r=f.width,o=f.height,p=h.getImageData(0,0,r,o),l=p.data,u=4):window.ImageData&&t instanceof window.ImageData&&(p=t,r=t.width,o=t.height,l=p.data,u=4);if(s=Math.max(r,o),window.Uint8ClampedArray&&l instanceof window.Uint8ClampedArray||window.Uint8Array&&l instanceof window.Uint8Array)for(c=l,l=Array(r*o),d=0,g=c.length;d=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 a=0,i=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return a}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.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 a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&a++,16===e?this._parseHex(t,a):this._parseBase(t,e,a),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},i.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)},i.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 a=0;a=0;a-=3)o=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[i]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this.strip()},i.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)a=s(t,r,r+6),this.words[n]|=a<>>26-i&4194303,(i+=24)>=26&&(i-=26,n++);r+6!==e&&(a=s(t,e,r+6),this.words[n]|=a<>>26-i&4194303),this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=e)n++;n--,a=a/e|0;for(var i=t.length-r,o=i%n,s=Math.min(i,i-o)+r,c=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var c=["","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"],u=[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],h=[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 f(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var a=0|t.words[0],i=0|e.words[0],o=a*i,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var c=1;c>>26,h=67108863&l,f=Math.min(c,e.length-1),p=Math.max(0,c-t.length+1);p<=f;p++){var d=c-p|0;u+=(o=(a=0|t.words[d])*(i=0|e.words[p])+h)/67108864|0,h=67108863&o}r.words[c]=0|h,l=0|u}return 0!==l?r.words[c]=0|l:r.length--,r.strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var a=0,i=0,o=0;o>>24-a&16777215)||o!==this.length-1?c[6-l.length]+l+r:l+r,(a+=2)>=26&&(a-=26,o--)}for(0!==i&&(r=i.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 f=u[t],p=h[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modn(p).toString(t);r=(d=d.idivn(p)).isZero()?g+r:c[f-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")},i.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},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n("undefined"!=typeof o),this.toArrayLike(o,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var a=this.byteLength(),i=r||Math.max(1,a);n(a<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,c=new t(i),u=this.clone();if(l){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),c[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},i.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},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.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)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.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)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.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 a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,a=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 a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;it.length?this.clone().iadd(t):t.clone().iadd(this)},i.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,a=this.cmp(t);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==i&&o>26,this.words[o]=67108863&e;if(0===i&&o>>13,p=0|o[1],d=8191&p,g=p>>>13,m=0|o[2],v=8191&m,y=m>>>13,x=0|o[3],b=8191&x,_=x>>>13,w=0|o[4],T=8191&w,k=w>>>13,M=0|o[5],A=8191&M,S=M>>>13,E=0|o[6],C=8191&E,L=E>>>13,P=0|o[7],I=8191&P,z=P>>>13,O=0|o[8],D=8191&O,R=O>>>13,F=0|o[9],B=8191&F,N=F>>>13,j=0|s[0],U=8191&j,V=j>>>13,q=0|s[1],H=8191&q,G=q>>>13,Y=0|s[2],W=8191&Y,Z=Y>>>13,X=0|s[3],J=8191&X,K=X>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,at=0|s[6],it=8191&at,ot=at>>>13,st=0|s[7],lt=8191&st,ct=st>>>13,ut=0|s[8],ht=8191&ut,ft=ut>>>13,pt=0|s[9],dt=8191&pt,gt=pt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(h,U))|0)+((8191&(a=(a=Math.imul(h,V))+Math.imul(f,U)|0))<<13)|0;c=((i=Math.imul(f,V))+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(d,U),a=(a=Math.imul(d,V))+Math.imul(g,U)|0,i=Math.imul(g,V);var vt=(c+(n=n+Math.imul(h,H)|0)|0)+((8191&(a=(a=a+Math.imul(h,G)|0)+Math.imul(f,H)|0))<<13)|0;c=((i=i+Math.imul(f,G)|0)+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,U),a=(a=Math.imul(v,V))+Math.imul(y,U)|0,i=Math.imul(y,V),n=n+Math.imul(d,H)|0,a=(a=a+Math.imul(d,G)|0)+Math.imul(g,H)|0,i=i+Math.imul(g,G)|0;var yt=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(a=(a=a+Math.imul(h,Z)|0)+Math.imul(f,W)|0))<<13)|0;c=((i=i+Math.imul(f,Z)|0)+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,U),a=(a=Math.imul(b,V))+Math.imul(_,U)|0,i=Math.imul(_,V),n=n+Math.imul(v,H)|0,a=(a=a+Math.imul(v,G)|0)+Math.imul(y,H)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(d,W)|0,a=(a=a+Math.imul(d,Z)|0)+Math.imul(g,W)|0,i=i+Math.imul(g,Z)|0;var xt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(a=(a=a+Math.imul(h,K)|0)+Math.imul(f,J)|0))<<13)|0;c=((i=i+Math.imul(f,K)|0)+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),a=(a=Math.imul(T,V))+Math.imul(k,U)|0,i=Math.imul(k,V),n=n+Math.imul(b,H)|0,a=(a=a+Math.imul(b,G)|0)+Math.imul(_,H)|0,i=i+Math.imul(_,G)|0,n=n+Math.imul(v,W)|0,a=(a=a+Math.imul(v,Z)|0)+Math.imul(y,W)|0,i=i+Math.imul(y,Z)|0,n=n+Math.imul(d,J)|0,a=(a=a+Math.imul(d,K)|0)+Math.imul(g,J)|0,i=i+Math.imul(g,K)|0;var bt=(c+(n=n+Math.imul(h,$)|0)|0)+((8191&(a=(a=a+Math.imul(h,tt)|0)+Math.imul(f,$)|0))<<13)|0;c=((i=i+Math.imul(f,tt)|0)+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,U),a=(a=Math.imul(A,V))+Math.imul(S,U)|0,i=Math.imul(S,V),n=n+Math.imul(T,H)|0,a=(a=a+Math.imul(T,G)|0)+Math.imul(k,H)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(b,W)|0,a=(a=a+Math.imul(b,Z)|0)+Math.imul(_,W)|0,i=i+Math.imul(_,Z)|0,n=n+Math.imul(v,J)|0,a=(a=a+Math.imul(v,K)|0)+Math.imul(y,J)|0,i=i+Math.imul(y,K)|0,n=n+Math.imul(d,$)|0,a=(a=a+Math.imul(d,tt)|0)+Math.imul(g,$)|0,i=i+Math.imul(g,tt)|0;var _t=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(a=(a=a+Math.imul(h,nt)|0)+Math.imul(f,rt)|0))<<13)|0;c=((i=i+Math.imul(f,nt)|0)+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,U),a=(a=Math.imul(C,V))+Math.imul(L,U)|0,i=Math.imul(L,V),n=n+Math.imul(A,H)|0,a=(a=a+Math.imul(A,G)|0)+Math.imul(S,H)|0,i=i+Math.imul(S,G)|0,n=n+Math.imul(T,W)|0,a=(a=a+Math.imul(T,Z)|0)+Math.imul(k,W)|0,i=i+Math.imul(k,Z)|0,n=n+Math.imul(b,J)|0,a=(a=a+Math.imul(b,K)|0)+Math.imul(_,J)|0,i=i+Math.imul(_,K)|0,n=n+Math.imul(v,$)|0,a=(a=a+Math.imul(v,tt)|0)+Math.imul(y,$)|0,i=i+Math.imul(y,tt)|0,n=n+Math.imul(d,rt)|0,a=(a=a+Math.imul(d,nt)|0)+Math.imul(g,rt)|0,i=i+Math.imul(g,nt)|0;var wt=(c+(n=n+Math.imul(h,it)|0)|0)+((8191&(a=(a=a+Math.imul(h,ot)|0)+Math.imul(f,it)|0))<<13)|0;c=((i=i+Math.imul(f,ot)|0)+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(I,U),a=(a=Math.imul(I,V))+Math.imul(z,U)|0,i=Math.imul(z,V),n=n+Math.imul(C,H)|0,a=(a=a+Math.imul(C,G)|0)+Math.imul(L,H)|0,i=i+Math.imul(L,G)|0,n=n+Math.imul(A,W)|0,a=(a=a+Math.imul(A,Z)|0)+Math.imul(S,W)|0,i=i+Math.imul(S,Z)|0,n=n+Math.imul(T,J)|0,a=(a=a+Math.imul(T,K)|0)+Math.imul(k,J)|0,i=i+Math.imul(k,K)|0,n=n+Math.imul(b,$)|0,a=(a=a+Math.imul(b,tt)|0)+Math.imul(_,$)|0,i=i+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,a=(a=a+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,n=n+Math.imul(d,it)|0,a=(a=a+Math.imul(d,ot)|0)+Math.imul(g,it)|0,i=i+Math.imul(g,ot)|0;var Tt=(c+(n=n+Math.imul(h,lt)|0)|0)+((8191&(a=(a=a+Math.imul(h,ct)|0)+Math.imul(f,lt)|0))<<13)|0;c=((i=i+Math.imul(f,ct)|0)+(a>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,U),a=(a=Math.imul(D,V))+Math.imul(R,U)|0,i=Math.imul(R,V),n=n+Math.imul(I,H)|0,a=(a=a+Math.imul(I,G)|0)+Math.imul(z,H)|0,i=i+Math.imul(z,G)|0,n=n+Math.imul(C,W)|0,a=(a=a+Math.imul(C,Z)|0)+Math.imul(L,W)|0,i=i+Math.imul(L,Z)|0,n=n+Math.imul(A,J)|0,a=(a=a+Math.imul(A,K)|0)+Math.imul(S,J)|0,i=i+Math.imul(S,K)|0,n=n+Math.imul(T,$)|0,a=(a=a+Math.imul(T,tt)|0)+Math.imul(k,$)|0,i=i+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,a=(a=a+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,n=n+Math.imul(v,it)|0,a=(a=a+Math.imul(v,ot)|0)+Math.imul(y,it)|0,i=i+Math.imul(y,ot)|0,n=n+Math.imul(d,lt)|0,a=(a=a+Math.imul(d,ct)|0)+Math.imul(g,lt)|0,i=i+Math.imul(g,ct)|0;var kt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(a=(a=a+Math.imul(h,ft)|0)+Math.imul(f,ht)|0))<<13)|0;c=((i=i+Math.imul(f,ft)|0)+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,U),a=(a=Math.imul(B,V))+Math.imul(N,U)|0,i=Math.imul(N,V),n=n+Math.imul(D,H)|0,a=(a=a+Math.imul(D,G)|0)+Math.imul(R,H)|0,i=i+Math.imul(R,G)|0,n=n+Math.imul(I,W)|0,a=(a=a+Math.imul(I,Z)|0)+Math.imul(z,W)|0,i=i+Math.imul(z,Z)|0,n=n+Math.imul(C,J)|0,a=(a=a+Math.imul(C,K)|0)+Math.imul(L,J)|0,i=i+Math.imul(L,K)|0,n=n+Math.imul(A,$)|0,a=(a=a+Math.imul(A,tt)|0)+Math.imul(S,$)|0,i=i+Math.imul(S,tt)|0,n=n+Math.imul(T,rt)|0,a=(a=a+Math.imul(T,nt)|0)+Math.imul(k,rt)|0,i=i+Math.imul(k,nt)|0,n=n+Math.imul(b,it)|0,a=(a=a+Math.imul(b,ot)|0)+Math.imul(_,it)|0,i=i+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,a=(a=a+Math.imul(v,ct)|0)+Math.imul(y,lt)|0,i=i+Math.imul(y,ct)|0,n=n+Math.imul(d,ht)|0,a=(a=a+Math.imul(d,ft)|0)+Math.imul(g,ht)|0,i=i+Math.imul(g,ft)|0;var Mt=(c+(n=n+Math.imul(h,dt)|0)|0)+((8191&(a=(a=a+Math.imul(h,gt)|0)+Math.imul(f,dt)|0))<<13)|0;c=((i=i+Math.imul(f,gt)|0)+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(B,H),a=(a=Math.imul(B,G))+Math.imul(N,H)|0,i=Math.imul(N,G),n=n+Math.imul(D,W)|0,a=(a=a+Math.imul(D,Z)|0)+Math.imul(R,W)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(I,J)|0,a=(a=a+Math.imul(I,K)|0)+Math.imul(z,J)|0,i=i+Math.imul(z,K)|0,n=n+Math.imul(C,$)|0,a=(a=a+Math.imul(C,tt)|0)+Math.imul(L,$)|0,i=i+Math.imul(L,tt)|0,n=n+Math.imul(A,rt)|0,a=(a=a+Math.imul(A,nt)|0)+Math.imul(S,rt)|0,i=i+Math.imul(S,nt)|0,n=n+Math.imul(T,it)|0,a=(a=a+Math.imul(T,ot)|0)+Math.imul(k,it)|0,i=i+Math.imul(k,ot)|0,n=n+Math.imul(b,lt)|0,a=(a=a+Math.imul(b,ct)|0)+Math.imul(_,lt)|0,i=i+Math.imul(_,ct)|0,n=n+Math.imul(v,ht)|0,a=(a=a+Math.imul(v,ft)|0)+Math.imul(y,ht)|0,i=i+Math.imul(y,ft)|0;var At=(c+(n=n+Math.imul(d,dt)|0)|0)+((8191&(a=(a=a+Math.imul(d,gt)|0)+Math.imul(g,dt)|0))<<13)|0;c=((i=i+Math.imul(g,gt)|0)+(a>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,W),a=(a=Math.imul(B,Z))+Math.imul(N,W)|0,i=Math.imul(N,Z),n=n+Math.imul(D,J)|0,a=(a=a+Math.imul(D,K)|0)+Math.imul(R,J)|0,i=i+Math.imul(R,K)|0,n=n+Math.imul(I,$)|0,a=(a=a+Math.imul(I,tt)|0)+Math.imul(z,$)|0,i=i+Math.imul(z,tt)|0,n=n+Math.imul(C,rt)|0,a=(a=a+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,i=i+Math.imul(L,nt)|0,n=n+Math.imul(A,it)|0,a=(a=a+Math.imul(A,ot)|0)+Math.imul(S,it)|0,i=i+Math.imul(S,ot)|0,n=n+Math.imul(T,lt)|0,a=(a=a+Math.imul(T,ct)|0)+Math.imul(k,lt)|0,i=i+Math.imul(k,ct)|0,n=n+Math.imul(b,ht)|0,a=(a=a+Math.imul(b,ft)|0)+Math.imul(_,ht)|0,i=i+Math.imul(_,ft)|0;var St=(c+(n=n+Math.imul(v,dt)|0)|0)+((8191&(a=(a=a+Math.imul(v,gt)|0)+Math.imul(y,dt)|0))<<13)|0;c=((i=i+Math.imul(y,gt)|0)+(a>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,J),a=(a=Math.imul(B,K))+Math.imul(N,J)|0,i=Math.imul(N,K),n=n+Math.imul(D,$)|0,a=(a=a+Math.imul(D,tt)|0)+Math.imul(R,$)|0,i=i+Math.imul(R,tt)|0,n=n+Math.imul(I,rt)|0,a=(a=a+Math.imul(I,nt)|0)+Math.imul(z,rt)|0,i=i+Math.imul(z,nt)|0,n=n+Math.imul(C,it)|0,a=(a=a+Math.imul(C,ot)|0)+Math.imul(L,it)|0,i=i+Math.imul(L,ot)|0,n=n+Math.imul(A,lt)|0,a=(a=a+Math.imul(A,ct)|0)+Math.imul(S,lt)|0,i=i+Math.imul(S,ct)|0,n=n+Math.imul(T,ht)|0,a=(a=a+Math.imul(T,ft)|0)+Math.imul(k,ht)|0,i=i+Math.imul(k,ft)|0;var Et=(c+(n=n+Math.imul(b,dt)|0)|0)+((8191&(a=(a=a+Math.imul(b,gt)|0)+Math.imul(_,dt)|0))<<13)|0;c=((i=i+Math.imul(_,gt)|0)+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(B,$),a=(a=Math.imul(B,tt))+Math.imul(N,$)|0,i=Math.imul(N,tt),n=n+Math.imul(D,rt)|0,a=(a=a+Math.imul(D,nt)|0)+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,n=n+Math.imul(I,it)|0,a=(a=a+Math.imul(I,ot)|0)+Math.imul(z,it)|0,i=i+Math.imul(z,ot)|0,n=n+Math.imul(C,lt)|0,a=(a=a+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,i=i+Math.imul(L,ct)|0,n=n+Math.imul(A,ht)|0,a=(a=a+Math.imul(A,ft)|0)+Math.imul(S,ht)|0,i=i+Math.imul(S,ft)|0;var Ct=(c+(n=n+Math.imul(T,dt)|0)|0)+((8191&(a=(a=a+Math.imul(T,gt)|0)+Math.imul(k,dt)|0))<<13)|0;c=((i=i+Math.imul(k,gt)|0)+(a>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(B,rt),a=(a=Math.imul(B,nt))+Math.imul(N,rt)|0,i=Math.imul(N,nt),n=n+Math.imul(D,it)|0,a=(a=a+Math.imul(D,ot)|0)+Math.imul(R,it)|0,i=i+Math.imul(R,ot)|0,n=n+Math.imul(I,lt)|0,a=(a=a+Math.imul(I,ct)|0)+Math.imul(z,lt)|0,i=i+Math.imul(z,ct)|0,n=n+Math.imul(C,ht)|0,a=(a=a+Math.imul(C,ft)|0)+Math.imul(L,ht)|0,i=i+Math.imul(L,ft)|0;var Lt=(c+(n=n+Math.imul(A,dt)|0)|0)+((8191&(a=(a=a+Math.imul(A,gt)|0)+Math.imul(S,dt)|0))<<13)|0;c=((i=i+Math.imul(S,gt)|0)+(a>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(B,it),a=(a=Math.imul(B,ot))+Math.imul(N,it)|0,i=Math.imul(N,ot),n=n+Math.imul(D,lt)|0,a=(a=a+Math.imul(D,ct)|0)+Math.imul(R,lt)|0,i=i+Math.imul(R,ct)|0,n=n+Math.imul(I,ht)|0,a=(a=a+Math.imul(I,ft)|0)+Math.imul(z,ht)|0,i=i+Math.imul(z,ft)|0;var Pt=(c+(n=n+Math.imul(C,dt)|0)|0)+((8191&(a=(a=a+Math.imul(C,gt)|0)+Math.imul(L,dt)|0))<<13)|0;c=((i=i+Math.imul(L,gt)|0)+(a>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(B,lt),a=(a=Math.imul(B,ct))+Math.imul(N,lt)|0,i=Math.imul(N,ct),n=n+Math.imul(D,ht)|0,a=(a=a+Math.imul(D,ft)|0)+Math.imul(R,ht)|0,i=i+Math.imul(R,ft)|0;var It=(c+(n=n+Math.imul(I,dt)|0)|0)+((8191&(a=(a=a+Math.imul(I,gt)|0)+Math.imul(z,dt)|0))<<13)|0;c=((i=i+Math.imul(z,gt)|0)+(a>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(B,ht),a=(a=Math.imul(B,ft))+Math.imul(N,ht)|0,i=Math.imul(N,ft);var zt=(c+(n=n+Math.imul(D,dt)|0)|0)+((8191&(a=(a=a+Math.imul(D,gt)|0)+Math.imul(R,dt)|0))<<13)|0;c=((i=i+Math.imul(R,gt)|0)+(a>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(c+(n=Math.imul(B,dt))|0)+((8191&(a=(a=Math.imul(B,gt))+Math.imul(N,dt)|0))<<13)|0;return c=((i=Math.imul(N,gt))+(a>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,l[0]=mt,l[1]=vt,l[2]=yt,l[3]=xt,l[4]=bt,l[5]=_t,l[6]=wt,l[7]=Tt,l[8]=kt,l[9]=Mt,l[10]=At,l[11]=St,l[12]=Et,l[13]=Ct,l[14]=Lt,l[15]=Pt,l[16]=It,l[17]=zt,l[18]=Ot,0!==c&&(l[19]=c,r.length++),r};function d(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=f),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?f(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,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=s,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r.strip()}(this,t,e):d(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*e;o>=26,e+=a/67108864|0,e+=i>>>26,this.words[r]=67108863&i}return 0!==e&&(this.words[r]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>a}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,r=t%26,a=(t-r)/26,i=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!==a){for(e=this.length-1;e>=0;e--)this.words[e+a]=this.words[e];for(e=0;e=0),a=e?(e-e%26)/26:0;var i=t%26,o=Math.min((t-i)/26,this.length),s=67108863^67108863>>>i<o)for(this.length-=o,c=0;c=0&&(0!==u||c>=a);c--){var h=0|this.words[c];this.words[c]=u<<26-i|h>>>i,u=h&s}return l&&0!==u&&(l.words[l.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,a=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 a=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},i.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[a+r]=67108863&i}for(;a>26,this.words[a+r]=67108863&i;if(0===s)return this.strip();for(n(-1===s),s=0,a=0;a>26,this.words[a]=67108863&i;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),a=t,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,l=n.length-a.length;if("mod"!==e){(s=new i(null)).length=l+1,s.words=new Array(s.length);for(var c=0;c=0;h--){var f=67108864*(0|n.words[a.length+h])+(0|n.words[a.length+h-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(a,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(a,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=f)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(a=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:a,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(a=s.div.neg()),{div:a,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 i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var a,o,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.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),a=t.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,a=this.length-1;a>=0;a--)r=(e*r+(0|this.words[a]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*e;this.words[r]=a/t|0,e=a%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.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 a=new i(1),o=new i(0),s=new i(0),l=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),h=e.clone();!e.isZero();){for(var f=0,p=1;0==(e.words[0]&p)&&f<26;++f,p<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(u),o.isub(h)),a.iushrn(1),o.iushrn(1);for(var d=0,g=1;0==(r.words[0]&g)&&d<26;++d,g<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(u),l.isub(h)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s),o.isub(l)):(r.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:r.iushln(c)}},i.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 a,o=new i(1),s=new i(0),l=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,u=1;0==(e.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(e.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(l),o.iushrn(1);for(var h=0,f=1;0==(r.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(r.iushrn(h);h-- >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(a=0===e.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(t),a},i.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 a=e.cmp(r);if(a<0){var i=e;e=r,r=i}else if(0===a||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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 a=0|this.words[0];e=a===t?0:at.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|t.words[r];if(n!==a){na&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new w(t)},i.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)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function x(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=i._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 T(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.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},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},a(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,a=i}a>>>=22,t.words[n-10]=a,0===a&&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]=a,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new x;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return m[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 i(1)).iushrn(2);return this.pow(t,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),l=s.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);0!==this.pow(u,c).cmp(l);)u.redIAdd(l);for(var h=this.pow(u,a),f=this.pow(t,a.addn(1).iushrn(1)),p=this.pow(t,a),d=o;0!==p.cmp(s);){for(var g=p,m=0;0!==g.cmp(s);m++)g=g.redSqr();n(m=0;n--){for(var c=e.words[n],u=l-1;u>=0;u--){var h=c>>u&1;a!==r[0]&&(a=this.sqr(a)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===n&&0===u)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}l=26}return a},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},i.mont=function(t){return new T(t)},a(T,w),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.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),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof e||e,this)},{buffer:108}],100:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,a=t.length,i=0;for(e=0;e>>1;if(!(u<=0)){var h,f=a.mallocDouble(2*u*s),p=a.mallocInt32(s);if((s=l(t,u,f,p))>0){if(1===u&&n)i.init(s),h=i.sweepComplete(u,r,0,s,f,p,0,s,f,p);else{var d=a.mallocDouble(2*u*c),g=a.mallocInt32(c);(c=l(e,u,d,g))>0&&(i.init(s+c),h=1===u?i.sweepBipartite(u,r,0,s,f,p,0,c,d,g):o(u,r,n,s,f,p,c,d,g),a.free(d),a.free(g))}a.free(f),a.free(p)}return h}}}function u(t,e){n.push([t,e])}function h(t){return n=[],c(t,t,u,!0),n}function f(t,e){return n=[],c(t,e,u,!1),n}},{"./lib/intersect":103,"./lib/sweep":107,"typedarray-pool":567}],102:[function(t,e,r){"use strict";var n=["d","ax","vv","rs","re","rb","ri","bs","be","bb","bi"];function a(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],a=n.slice();t||a.splice(3,0,"fp");var i=["function "+e+"("+a.join()+"){"];function o(e,a){var o=function(t,e,r){var a="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",a,"(",n.join(),"){","var ","es","=2*","d",";"],o="for(var i=rs,rp=es*rs;ibe-bs){"),t?(o(!0,!1),i.push("}else{"),o(!1,!1)):(i.push("if(fp){"),o(!0,!0),i.push("}else{"),o(!0,!1),i.push("}}else{if(fp){"),o(!1,!0),i.push("}else{"),o(!1,!1),i.push("}")),i.push("}}return "+e);var s=r.join("")+i.join("");return new Function(s)()}r.partial=a(!1),r.full=a(!0)},{}],103:[function(t,e,r){"use strict";e.exports=function(t,e,r,i,u,w,T,k,M){!function(t,e){var r=8*a.log2(e+1)*(t+1)|0,i=a.nextPow2(6*r);v.length0;){var C=6*(S-=1),L=v[C],P=v[C+1],I=v[C+2],z=v[C+3],O=v[C+4],D=v[C+5],R=2*S,F=y[R],B=y[R+1],N=1&D,j=!!(16&D),U=u,V=w,q=k,H=M;if(N&&(U=k,V=M,q=u,H=w),!(2&D&&(I=p(t,L,P,I,U,V,B),P>=I)||4&D&&(P=d(t,L,P,I,U,V,F))>=I)){var G=I-P,Y=O-z;if(j){if(t*G*(G+Y)<1<<22){if(void 0!==(A=l.scanComplete(t,L,e,P,I,U,V,z,O,q,H)))return A;continue}}else{if(t*Math.min(G,Y)<128){if(void 0!==(A=o(t,L,e,N,P,I,U,V,z,O,q,H)))return A;continue}if(t*G*Y<1<<22){if(void 0!==(A=l.scanBipartite(t,L,e,N,P,I,U,V,z,O,q,H)))return A;continue}}var W=h(t,L,P,I,U,V,F,B);if(P=p0)&&!(p1>=hi)",["p0","p1"]),f=u("lo===p0",["p0"]),p=u("lo>>1,h=2*t,f=u,p=o[h*u+e];for(;l=y?(f=v,p=y):m>=b?(f=g,p=m):(f=x,p=b):y>=b?(f=v,p=y):b>=m?(f=g,p=m):(f=x,p=b);for(var _=h*(c-1),w=h*f,T=0;Tr&&a[h+e]>c;--u,h-=o){for(var f=h,p=h+o,d=0;d=0&&n.push("lo=e[k+n]");t.indexOf("hi")>=0&&n.push("hi=e[k+o]");return r.push("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".replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}},{}],106:[function(t,e,r){"use strict";e.exports=function(t,e){e<=128?n(0,e-1,t):function t(e,r,u){var h=(r-e+1)/6|0,f=e+h,p=r-h,d=e+r>>1,g=d-h,m=d+h,v=f,y=g,x=d,b=m,_=p,w=e+1,T=r-1,k=0;l(v,y,u)&&(k=v,v=y,y=k);l(b,_,u)&&(k=b,b=_,_=k);l(v,x,u)&&(k=v,v=x,x=k);l(y,x,u)&&(k=y,y=x,x=k);l(v,b,u)&&(k=v,v=b,b=k);l(x,b,u)&&(k=x,x=b,b=k);l(y,_,u)&&(k=y,y=_,_=k);l(y,x,u)&&(k=y,y=x,x=k);l(b,_,u)&&(k=b,b=_,_=k);for(var M=u[2*y],A=u[2*y+1],S=u[2*b],E=u[2*b+1],C=2*v,L=2*x,P=2*_,I=2*f,z=2*d,O=2*p,D=0;D<2;++D){var R=u[C+D],F=u[L+D],B=u[P+D];u[I+D]=R,u[z+D]=F,u[O+D]=B}i(g,e,u),i(m,r,u);for(var N=w;N<=T;++N)if(c(N,M,A,u))N!==w&&a(N,w,u),++w;else if(!c(N,S,E,u))for(;;){if(c(T,S,E,u)){c(T,M,A,u)?(o(N,w,T,u),++w,--T):(a(N,T,u),--T);break}if(--Tt;){var c=r[l-2],u=r[l-1];if(cr[e+1])}function c(t,e,r,n){var a=n[t*=2];return a>>1;i(f,A);var S=0,E=0;for(w=0;w=1<<28)p(l,c,E--,C=C-(1<<28)|0);else if(C>=0)p(o,s,S--,C);else if(C<=-(1<<28)){C=-C-(1<<28)|0;for(var L=0;L>>1;i(f,E);var C=0,L=0,P=0;for(k=0;k>1==f[2*k+3]>>1&&(z=2,k+=1),I<0){for(var O=-(I>>1)-1,D=0;D>1)-1;0===z?p(o,s,C--,O):1===z?p(l,c,L--,O):2===z&&p(u,h,P--,O)}}},scanBipartite:function(t,e,r,n,a,l,c,u,h,g,m,v){var y=0,x=2*t,b=e,_=e+t,w=1,T=1;n?T=1<<28:w=1<<28;for(var k=a;k>>1;i(f,E);var C=0;for(k=0;k=1<<28?(P=!n,M-=1<<28):(P=!!n,M-=1),P)d(o,s,C++,M);else{var I=v[M],z=x*M,O=m[z+e+1],D=m[z+e+1+t];t:for(var R=0;R>>1;i(f,w);var T=0;for(y=0;y=1<<28)o[T++]=x-(1<<28);else{var M=p[x-=1],A=g*x,S=h[A+e+1],E=h[A+e+1+t];t:for(var C=0;C=0;--C)if(o[C]===x){for(z=C+1;z0&&s.length>i){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 v(){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 c="function"==typeof r;switch(n=arguments.length){case 1:h(r,c,this);break;case 2:f(r,c,this,arguments[1]);break;case 3:p(r,c,this,arguments[1],arguments[2]);break;case 4:d(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(a=new Array(n-1),i=1;i=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(var r=e,n=r+1,a=t.length;n=0;i--)this.removeListener(t,e[i]);return this},o.prototype.listeners=function(t){return x(this,t,!0)},o.prototype.rawListeners=function(t){return x(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):b.call(t,e)},o.prototype.listenerCount=b,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],111:[function(t,e,r){(function(e){ + */function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i=0;c--)if(u[c]!==f[c])return!1;for(c=u.length-1;c>=0;c--)if(s=u[c],!x(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function b(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&v(i,r,"Missing expected exception"+n);var a="string"==typeof n,s=!t&&i&&!r;if((!t&&o.isError(i)&&a&&_(i,r)||s)&&v(i,r,"Got unwanted exception"+n),t&&i&&r&&!_(i,r)||!t&&i)throw i}h.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(m(t.actual),128)+" "+t.operator+" "+g(m(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=d(e),a=n.indexOf("\n"+i);if(a>=0){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(h.AssertionError,Error),h.fail=v,h.ok=y,h.equal=function(t,e,r){t!=e&&v(t,e,r,"==",h.equal)},h.notEqual=function(t,e,r){t==e&&v(t,e,r,"!=",h.notEqual)},h.deepEqual=function(t,e,r){x(t,e,!1)||v(t,e,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(t,e,r){x(t,e,!0)||v(t,e,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){x(t,e,!1)&&v(t,e,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){x(e,r,!0)&&v(e,r,n,"notDeepStrictEqual",t)},h.strictEqual=function(t,e,r){t!==e&&v(t,e,r,"===",h.strictEqual)},h.notStrictEqual=function(t,e,r){t===e&&v(t,e,r,"!==",h.notStrictEqual)},h.throws=function(t,e,r){w(!0,t,e,r)},h.doesNotThrow=function(t,e,r){w(!1,t,e,r)},h.ifError=function(t){if(t)throw t},h.strict=n((function t(e,r){e||v(e,!0,r,"==",t)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var T=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":499,"util/":76}],74:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],75:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],76:[function(t,e,r){(function(e,n){(function(){var i=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r=a)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),l=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(e)?n.showHidden=e:e&&r._extend(n,e),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),u(n,t,n.depth)}function l(t,e){var r=s.styles[e];return r?"\x1b["+s.colors[r][0]+"m"+t+"\x1b["+s.colors[r][1]+"m":t}function c(t,e){return t}function u(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return v(i)||(i=u(t,i,n)),i}var a=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(m(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(a)return a;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),w(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(e);if(0===o.length){if(T(e)){var l=e.name?": "+e.name:"";return t.stylize("[Function"+l+"]","special")}if(x(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(_(e))return t.stylize(Date.prototype.toString.call(e),"date");if(w(e))return f(e)}var c,b="",k=!1,M=["{","}"];(p(e)&&(k=!0,M=["[","]"]),T(e))&&(b=" [Function"+(e.name?": "+e.name:"")+"]");return x(e)&&(b=" "+RegExp.prototype.toString.call(e)),_(e)&&(b=" "+Date.prototype.toUTCString.call(e)),w(e)&&(b=" "+f(e)),0!==o.length||k&&0!=e.length?n<0?x(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=k?function(t,e,r,n,i){for(var a=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,b,M)):M[0]+b+M[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i,a){var o,s,l;if((l=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),E(n,i)||(o="["+i+"]"),s||(t.seen.indexOf(l.value)<0?(s=g(r)?u(t,l.value,null):u(t,l.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),y(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function g(t){return null===t}function m(t){return"number"==typeof t}function v(t){return"string"==typeof t}function y(t){return void 0===t}function x(t){return b(t)&&"[object RegExp]"===k(t)}function b(t){return"object"==typeof t&&null!==t}function _(t){return b(t)&&"[object Date]"===k(t)}function w(t){return b(t)&&("[object Error]"===k(t)||t instanceof Error)}function T(t){return"function"==typeof t}function k(t){return Object.prototype.toString.call(t)}function M(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(y(a)&&(a=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(a)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=m,r.isString=v,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=y,r.isRegExp=x,r.isObject=b,r.isDate=_,r.isError=w,r.isFunction=T,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t},r.isBuffer=t("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function S(){var t=new Date,e=[M(t.getHours()),M(t.getMinutes()),M(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function E(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){console.log("%s - %s",S(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!b(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":75,_process:526,inherits:74}],77:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],78:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=e.length,a=new Array(r+1),o=0;o0?o-4:o;for(r=0;r>16&255,l[u++]=e>>8&255,l[u++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[u++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e);return l},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 u(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},{}],80:[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":90}],81:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],82:[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":90}],83:[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 c,u,f=0;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),f-=256;c=a(e)}}if(n(r))c.mul(r[1]),u=r[0].clone();else if(i(r))u=r.clone();else if("string"==typeof r)u=o(r);else if(r)if(r===Math.floor(r))u=a(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),f+=256;u=a(r)}else u=a(1);f>0?c=c.ushln(f):f<0&&(u=u.ushln(-f));return s(c,u)}},{"./div":82,"./is-rat":84,"./lib/is-bn":88,"./lib/num-to-bn":89,"./lib/rationalize":90,"./lib/str-to-bn":91}],84:[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":88}],85:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":99}],86:[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":97,"double-bits":173}],88:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":99}],89:[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":99,"double-bits":173}],90:[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":85,"./num-to-bn":89}],91:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":99}],92:[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":90}],93:[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":85}],94:[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":90}],95:[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,c=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return c*s;if(s){var u=i(s)+4,f=n(l.ushln(u).divRound(r));return c*(s+f*Math.pow(2,-u))}var h=r.bitLength()-l.bitLength()+53;f=n(l.ushln(h).divRound(r));return h<1023?c*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),c*f*Math.pow(2,1023-h))}},{"./lib/bn-to-num":86,"./lib/ctz":87}],96:[function(t,e,r){"use strict";function n(t,e,r,n,i){var a=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>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)}},{}],97:[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}},{}],98:[function(t,e,r){"use strict";var n=t("clamp");e.exports=function(t,e){e||(e={});var r,o,s,l,c,u,f,h,p,d,g,m=null==e.cutoff?.25:e.cutoff,v=null==e.radius?8:e.radius,y=e.channel||0;if(ArrayBuffer.isView(t)||Array.isArray(t)){if(!e.width||!e.height)throw Error("For raw data width and height should be provided by options");r=e.width,o=e.height,l=t,u=e.stride?e.stride:Math.floor(t.length/r/o)}else window.HTMLCanvasElement&&t instanceof window.HTMLCanvasElement?(f=(h=t).getContext("2d"),r=h.width,o=h.height,p=f.getImageData(0,0,r,o),l=p.data,u=4):window.CanvasRenderingContext2D&&t instanceof window.CanvasRenderingContext2D?(h=t.canvas,f=t,r=h.width,o=h.height,p=f.getImageData(0,0,r,o),l=p.data,u=4):window.ImageData&&t instanceof window.ImageData&&(p=t,r=t.width,o=t.height,l=p.data,u=4);if(s=Math.max(r,o),window.Uint8ClampedArray&&l instanceof window.Uint8ClampedArray||window.Uint8Array&&l instanceof window.Uint8Array)for(c=l,l=Array(r*o),d=0,g=c.length;d=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,c=0,u=r;u1&&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 c=["","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"],u=[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 c=1;c>>26,f=67108863&l,h=Math.min(c,e.length-1),p=Math.max(0,c-t.length+1);p<=h;p++){var d=c-p|0;u+=(o=(i=0|t.words[d])*(a=0|e.words[p])+f)/67108864|0,f=67108863&o}r.words[c]=0|f,l=0|u}return 0!==l?r.words[c]=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?c[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=u[t],p=f[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modn(p).toString(t);r=(d=d.idivn(p)).isZero()?g+r:c[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,c=new t(a),u=this.clone();if(l){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),c[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,p=0|o[1],d=8191&p,g=p>>>13,m=0|o[2],v=8191&m,y=m>>>13,x=0|o[3],b=8191&x,_=x>>>13,w=0|o[4],T=8191&w,k=w>>>13,M=0|o[5],A=8191&M,S=M>>>13,E=0|o[6],C=8191&E,L=E>>>13,I=0|o[7],P=8191&I,z=I>>>13,O=0|o[8],D=8191&O,R=O>>>13,F=0|o[9],B=8191&F,N=F>>>13,j=0|s[0],U=8191&j,V=j>>>13,q=0|s[1],H=8191&q,G=q>>>13,Y=0|s[2],W=8191&Y,X=Y>>>13,Z=0|s[3],J=8191&Z,K=Z>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>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,ct=st>>>13,ut=0|s[8],ft=8191&ut,ht=ut>>>13,pt=0|s[9],dt=8191&pt,gt=pt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,V))+Math.imul(h,U)|0))<<13)|0;c=((a=Math.imul(h,V))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(d,U),i=(i=Math.imul(d,V))+Math.imul(g,U)|0,a=Math.imul(g,V);var vt=(c+(n=n+Math.imul(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(h,H)|0))<<13)|0;c=((a=a+Math.imul(h,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,U),i=(i=Math.imul(v,V))+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(d,H)|0,i=(i=i+Math.imul(d,G)|0)+Math.imul(g,H)|0,a=a+Math.imul(g,G)|0;var yt=(c+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(h,W)|0))<<13)|0;c=((a=a+Math.imul(h,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,V))+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(y,H)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(d,W)|0,i=(i=i+Math.imul(d,X)|0)+Math.imul(g,W)|0,a=a+Math.imul(g,X)|0;var xt=(c+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,J)|0))<<13)|0;c=((a=a+Math.imul(h,K)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,V))+Math.imul(k,U)|0,a=Math.imul(k,V),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(_,H)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,W)|0,a=a+Math.imul(y,X)|0,n=n+Math.imul(d,J)|0,i=(i=i+Math.imul(d,K)|0)+Math.imul(g,J)|0,a=a+Math.imul(g,K)|0;var bt=(c+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(h,$)|0))<<13)|0;c=((a=a+Math.imul(h,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,U),i=(i=Math.imul(A,V))+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,G)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,W)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(d,$)|0,i=(i=i+Math.imul(d,tt)|0)+Math.imul(g,$)|0,a=a+Math.imul(g,tt)|0;var _t=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(h,rt)|0))<<13)|0;c=((a=a+Math.imul(h,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,U),i=(i=Math.imul(C,V))+Math.imul(L,U)|0,a=Math.imul(L,V),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(S,H)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,X)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(v,$)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(d,rt)|0,i=(i=i+Math.imul(d,nt)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0;var wt=(c+(n=n+Math.imul(f,at)|0)|0)+((8191&(i=(i=i+Math.imul(f,ot)|0)+Math.imul(h,at)|0))<<13)|0;c=((a=a+Math.imul(h,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,U),i=(i=Math.imul(P,V))+Math.imul(z,U)|0,a=Math.imul(z,V),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(S,W)|0,a=a+Math.imul(S,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(k,J)|0,a=a+Math.imul(k,K)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(d,at)|0,i=(i=i+Math.imul(d,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0;var Tt=(c+(n=n+Math.imul(f,lt)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(h,lt)|0))<<13)|0;c=((a=a+Math.imul(h,ct)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,U),i=(i=Math.imul(D,V))+Math.imul(R,U)|0,a=Math.imul(R,V),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(z,H)|0,a=a+Math.imul(z,G)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,X)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(S,J)|0,a=a+Math.imul(S,K)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(v,at)|0,i=(i=i+Math.imul(v,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(d,lt)|0,i=(i=i+Math.imul(d,ct)|0)+Math.imul(g,lt)|0,a=a+Math.imul(g,ct)|0;var kt=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;c=((a=a+Math.imul(h,ht)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,U),i=(i=Math.imul(B,V))+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(D,H)|0,i=(i=i+Math.imul(D,G)|0)+Math.imul(R,H)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(z,W)|0,a=a+Math.imul(z,X)|0,n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(L,J)|0,a=a+Math.imul(L,K)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,nt)|0,n=n+Math.imul(b,at)|0,i=(i=i+Math.imul(b,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,lt)|0,a=a+Math.imul(y,ct)|0,n=n+Math.imul(d,ft)|0,i=(i=i+Math.imul(d,ht)|0)+Math.imul(g,ft)|0,a=a+Math.imul(g,ht)|0;var Mt=(c+(n=n+Math.imul(f,dt)|0)|0)+((8191&(i=(i=i+Math.imul(f,gt)|0)+Math.imul(h,dt)|0))<<13)|0;c=((a=a+Math.imul(h,gt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(B,H),i=(i=Math.imul(B,G))+Math.imul(N,H)|0,a=Math.imul(N,G),n=n+Math.imul(D,W)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(R,W)|0,a=a+Math.imul(R,X)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(z,J)|0,a=a+Math.imul(z,K)|0,n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(T,at)|0,i=(i=i+Math.imul(T,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,ht)|0)+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0;var At=(c+(n=n+Math.imul(d,dt)|0)|0)+((8191&(i=(i=i+Math.imul(d,gt)|0)+Math.imul(g,dt)|0))<<13)|0;c=((a=a+Math.imul(g,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,W),i=(i=Math.imul(B,X))+Math.imul(N,W)|0,a=Math.imul(N,X),n=n+Math.imul(D,J)|0,i=(i=i+Math.imul(D,K)|0)+Math.imul(R,J)|0,a=a+Math.imul(R,K)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(z,$)|0,a=a+Math.imul(z,tt)|0,n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,nt)|0,n=n+Math.imul(A,at)|0,i=(i=i+Math.imul(A,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0;var St=(c+(n=n+Math.imul(v,dt)|0)|0)+((8191&(i=(i=i+Math.imul(v,gt)|0)+Math.imul(y,dt)|0))<<13)|0;c=((a=a+Math.imul(y,gt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,J),i=(i=Math.imul(B,K))+Math.imul(N,J)|0,a=Math.imul(N,K),n=n+Math.imul(D,$)|0,i=(i=i+Math.imul(D,tt)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(z,rt)|0,a=a+Math.imul(z,nt)|0,n=n+Math.imul(C,at)|0,i=(i=i+Math.imul(C,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,n=n+Math.imul(A,lt)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(S,lt)|0,a=a+Math.imul(S,ct)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(k,ft)|0,a=a+Math.imul(k,ht)|0;var Et=(c+(n=n+Math.imul(b,dt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,dt)|0))<<13)|0;c=((a=a+Math.imul(_,gt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(N,$)|0,a=Math.imul(N,tt),n=n+Math.imul(D,rt)|0,i=(i=i+Math.imul(D,nt)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,nt)|0,n=n+Math.imul(P,at)|0,i=(i=i+Math.imul(P,ot)|0)+Math.imul(z,at)|0,a=a+Math.imul(z,ot)|0,n=n+Math.imul(C,lt)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0;var Ct=(c+(n=n+Math.imul(T,dt)|0)|0)+((8191&(i=(i=i+Math.imul(T,gt)|0)+Math.imul(k,dt)|0))<<13)|0;c=((a=a+Math.imul(k,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(B,rt),i=(i=Math.imul(B,nt))+Math.imul(N,rt)|0,a=Math.imul(N,nt),n=n+Math.imul(D,at)|0,i=(i=i+Math.imul(D,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(z,lt)|0,a=a+Math.imul(z,ct)|0,n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,ht)|0)+Math.imul(L,ft)|0,a=a+Math.imul(L,ht)|0;var Lt=(c+(n=n+Math.imul(A,dt)|0)|0)+((8191&(i=(i=i+Math.imul(A,gt)|0)+Math.imul(S,dt)|0))<<13)|0;c=((a=a+Math.imul(S,gt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(B,at),i=(i=Math.imul(B,ot))+Math.imul(N,at)|0,a=Math.imul(N,ot),n=n+Math.imul(D,lt)|0,i=(i=i+Math.imul(D,ct)|0)+Math.imul(R,lt)|0,a=a+Math.imul(R,ct)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(z,ft)|0,a=a+Math.imul(z,ht)|0;var It=(c+(n=n+Math.imul(C,dt)|0)|0)+((8191&(i=(i=i+Math.imul(C,gt)|0)+Math.imul(L,dt)|0))<<13)|0;c=((a=a+Math.imul(L,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(B,lt),i=(i=Math.imul(B,ct))+Math.imul(N,lt)|0,a=Math.imul(N,ct),n=n+Math.imul(D,ft)|0,i=(i=i+Math.imul(D,ht)|0)+Math.imul(R,ft)|0,a=a+Math.imul(R,ht)|0;var Pt=(c+(n=n+Math.imul(P,dt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(z,dt)|0))<<13)|0;c=((a=a+Math.imul(z,gt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(B,ft),i=(i=Math.imul(B,ht))+Math.imul(N,ft)|0,a=Math.imul(N,ht);var zt=(c+(n=n+Math.imul(D,dt)|0)|0)+((8191&(i=(i=i+Math.imul(D,gt)|0)+Math.imul(R,dt)|0))<<13)|0;c=((a=a+Math.imul(R,gt)|0)+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(c+(n=Math.imul(B,dt))|0)+((8191&(i=(i=Math.imul(B,gt))+Math.imul(N,dt)|0))<<13)|0;return c=((a=Math.imul(N,gt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,l[0]=mt,l[1]=vt,l[2]=yt,l[3]=xt,l[4]=bt,l[5]=_t,l[6]=wt,l[7]=Tt,l[8]=kt,l[9]=Mt,l[10]=At,l[11]=St,l[12]=Et,l[13]=Ct,l[14]=Lt,l[15]=It,l[16]=Pt,l[17]=zt,l[18]=Ot,0!==c&&(l[19]=c,r.length++),r};function d(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=h),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(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):d(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,c=0;c=0&&(0!==u||c>=i);c--){var f=0|this.words[c];this.words[c]=u<<26-a|f>>>a,u=f&s}return l&&0!==u&&(l.words[l.length++]=u),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 c=0;c=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),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),f=e.clone();!e.isZero();){for(var h=0,p=1;0==(e.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,g=1;0==(r.words[0]&g)&&d<26;++d,g<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(u),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(c)}},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 c=0,u=1;0==(e.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(e.iushrn(c);c-- >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 m={k256:null,p224:null,p192:null,p25519:null};function v(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(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function x(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.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 T(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)}v.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.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},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),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(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new x;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return m[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(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,c).cmp(l);)u.redIAdd(l);for(var f=this.pow(u,i),h=this.pow(t,i.addn(1).iushrn(1)),p=this.pow(t,i),d=o;0!==p.cmp(s);){for(var g=p,m=0;0!==g.cmp(s);m++)g=g.redSqr();n(m=0;n--){for(var c=e.words[n],u=l-1;u>=0;u--){var f=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===u)&&(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 T(t)},i(T,w),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.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)},T.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)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof e||e,this)},{buffer:108}],100:[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(!(u<=0)){var f,h=i.mallocDouble(2*u*s),p=i.mallocInt32(s);if((s=l(t,u,h,p))>0){if(1===u&&n)a.init(s),f=a.sweepComplete(u,r,0,s,h,p,0,s,h,p);else{var d=i.mallocDouble(2*u*c),g=i.mallocInt32(c);(c=l(e,u,d,g))>0&&(a.init(s+c),f=1===u?a.sweepBipartite(u,r,0,s,h,p,0,c,d,g):o(u,r,n,s,h,p,c,d,g),i.free(d),i.free(g))}i.free(h),i.free(p)}return f}}}function u(t,e){n.push([t,e])}function f(t){return n=[],c(t,t,u,!0),n}function h(t,e){return n=[],c(t,e,u,!1),n}},{"./lib/intersect":103,"./lib/sweep":107,"typedarray-pool":595}],102:[function(t,e,r){"use strict";var n=["d","ax","vv","rs","re","rb","ri","bs","be","bb","bi"];function i(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],i=n.slice();t||i.splice(3,0,"fp");var a=["function "+e+"("+i.join()+"){"];function o(e,i){var o=function(t,e,r){var i="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),a=["function ",i,"(",n.join(),"){","var ","es","=2*","d",";"],o="for(var i=rs,rp=es*rs;ibe-bs){"),t?(o(!0,!1),a.push("}else{"),o(!1,!1)):(a.push("if(fp){"),o(!0,!0),a.push("}else{"),o(!0,!1),a.push("}}else{if(fp){"),o(!1,!0),a.push("}else{"),o(!1,!1),a.push("}")),a.push("}}return "+e);var s=r.join("")+a.join("");return new Function(s)()}r.partial=i(!1),r.full=i(!0)},{}],103:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,u,w,T,k,M){!function(t,e){var r=8*i.log2(e+1)*(t+1)|0,a=i.nextPow2(6*r);v.length0;){var C=6*(S-=1),L=v[C],I=v[C+1],P=v[C+2],z=v[C+3],O=v[C+4],D=v[C+5],R=2*S,F=y[R],B=y[R+1],N=1&D,j=!!(16&D),U=u,V=w,q=k,H=M;if(N&&(U=k,V=M,q=u,H=w),!(2&D&&(P=p(t,L,I,P,U,V,B),I>=P)||4&D&&(I=d(t,L,I,P,U,V,F))>=P)){var G=P-I,Y=O-z;if(j){if(t*G*(G+Y)<1<<22){if(void 0!==(A=l.scanComplete(t,L,e,I,P,U,V,z,O,q,H)))return A;continue}}else{if(t*Math.min(G,Y)<128){if(void 0!==(A=o(t,L,e,N,I,P,U,V,z,O,q,H)))return A;continue}if(t*G*Y<1<<22){if(void 0!==(A=l.scanBipartite(t,L,e,N,I,P,U,V,z,O,q,H)))return A;continue}}var W=f(t,L,I,P,U,V,F,B);if(I=p0)&&!(p1>=hi)",["p0","p1"]),h=u("lo===p0",["p0"]),p=u("lo>>1,f=2*t,h=u,p=o[f*u+e];for(;l=y?(h=v,p=y):m>=b?(h=g,p=m):(h=x,p=b):y>=b?(h=v,p=y):b>=m?(h=g,p=m):(h=x,p=b);for(var _=f*(c-1),w=f*h,T=0;Tr&&i[f+e]>c;--u,f-=o){for(var h=f,p=f+o,d=0;d=0&&n.push("lo=e[k+n]");t.indexOf("hi")>=0&&n.push("hi=e[k+o]");return r.push("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".replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}},{}],106:[function(t,e,r){"use strict";e.exports=function(t,e){e<=128?n(0,e-1,t):function t(e,r,u){var f=(r-e+1)/6|0,h=e+f,p=r-f,d=e+r>>1,g=d-f,m=d+f,v=h,y=g,x=d,b=m,_=p,w=e+1,T=r-1,k=0;l(v,y,u)&&(k=v,v=y,y=k);l(b,_,u)&&(k=b,b=_,_=k);l(v,x,u)&&(k=v,v=x,x=k);l(y,x,u)&&(k=y,y=x,x=k);l(v,b,u)&&(k=v,v=b,b=k);l(x,b,u)&&(k=x,x=b,b=k);l(y,_,u)&&(k=y,y=_,_=k);l(y,x,u)&&(k=y,y=x,x=k);l(b,_,u)&&(k=b,b=_,_=k);for(var M=u[2*y],A=u[2*y+1],S=u[2*b],E=u[2*b+1],C=2*v,L=2*x,I=2*_,P=2*h,z=2*d,O=2*p,D=0;D<2;++D){var R=u[C+D],F=u[L+D],B=u[I+D];u[P+D]=R,u[z+D]=F,u[O+D]=B}a(g,e,u),a(m,r,u);for(var N=w;N<=T;++N)if(c(N,M,A,u))N!==w&&i(N,w,u),++w;else if(!c(N,S,E,u))for(;;){if(c(T,S,E,u)){c(T,M,A,u)?(o(N,w,T,u),++w,--T):(i(N,T,u),--T);break}if(--Tt;){var c=r[l-2],u=r[l-1];if(cr[e+1])}function c(t,e,r,n){var i=n[t*=2];return i>>1;a(h,A);var S=0,E=0;for(w=0;w=1<<28)p(l,c,E--,C=C-(1<<28)|0);else if(C>=0)p(o,s,S--,C);else if(C<=-(1<<28)){C=-C-(1<<28)|0;for(var L=0;L>>1;a(h,E);var C=0,L=0,I=0;for(k=0;k>1==h[2*k+3]>>1&&(z=2,k+=1),P<0){for(var O=-(P>>1)-1,D=0;D>1)-1;0===z?p(o,s,C--,O):1===z?p(l,c,L--,O):2===z&&p(u,f,I--,O)}}},scanBipartite:function(t,e,r,n,i,l,c,u,f,g,m,v){var y=0,x=2*t,b=e,_=e+t,w=1,T=1;n?T=1<<28:w=1<<28;for(var k=i;k>>1;a(h,E);var C=0;for(k=0;k=1<<28?(I=!n,M-=1<<28):(I=!!n,M-=1),I)d(o,s,C++,M);else{var P=v[M],z=x*M,O=m[z+e+1],D=m[z+e+1+t];t:for(var R=0;R>>1;a(h,w);var T=0;for(y=0;y=1<<28)o[T++]=x-(1<<28);else{var M=p[x-=1],A=g*x,S=f[A+e+1],E=f[A+e+1+t];t:for(var C=0;C=0;--C)if(o[C]===x){for(z=C+1;z0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function d(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=i[t];if(void 0===l)return!1;if("function"==typeof l)a(l,this,e);else{var c=l.length,u=m(l,c);for(r=0;r=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],111:[function(t,e,r){(function(e){(function(){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -"use strict";var n=t("base64-js"),a=t("ieee754");r.Buffer=e,r.SlowBuffer=function(t){+t!=t&&(t=0);return e.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=e.prototype,r}function e(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 l(t)}return o(t,e,r)}function o(t,r,n){if("string"==typeof t)return function(t,r){"string"==typeof r&&""!==r||(r="utf8");if(!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|h(t,r),a=i(n),o=a.write(t,r);o!==n&&(a=a.slice(0,o));return a}(t,r);if(ArrayBuffer.isView(t))return c(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,r,n){if(r<0||t.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function h(t,r){if(e.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 n=t.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return R(t).length;default:if(i)return a?-1:D(t).length;r=(""+r).toLowerCase(),i=!0}}function f(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 A(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return w(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}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,r,n,a,i){if(0===t.length)return-1;if("string"==typeof n?(a=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),N(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof r&&(r=e.from(r,a)),e.isBuffer(r))return 0===r.length?-1:g(t,r,n,a,i);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):g(t,[r],n,a,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,a){var i,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 c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(a){var u=-1;for(i=r;is&&(r=s-l),i=r;i>=0;i--){for(var h=!0,f=0;fa&&(n=a):n=a;var i=e.length;n>i/2&&(n=i/2);for(var o=0;o>8,a=r%256,i.push(a),i.push(n);return i}(e,t.length-r),t,r,n)}function w(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],a=e;a239?4:c>223?3:c>191?2:1;if(a+h<=r)switch(h){case 1:c<128&&(u=c);break;case 2:128==(192&(i=t[a+1]))&&(l=(31&c)<<6|63&i)>127&&(u=l);break;case 3:i=t[a+1],o=t[a+2],128==(192&i)&&128==(192&o)&&(l=(15&c)<<12|(63&i)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:i=t[a+1],o=t[a+2],s=t[a+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&(l=(15&c)<<18|(63&i)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,h=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),a+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},e.prototype.compare=function(t,r,n,a,i){if(B(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===a&&(a=0),void 0===i&&(i=this.length),r<0||n>t.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&r>=n)return 0;if(a>=i)return-1;if(r>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(a>>>=0),s=(n>>>=0)-(r>>>=0),l=Math.min(o,s),c=this.slice(a,i),u=t.slice(r,n),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-e;if((void 0===r||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;an)&&(r=n);for(var a="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function C(t,r,n,a,i,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||rt.length)throw new RangeError("Index out of range")}function L(t,e,r,n,a,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),a.write(t,e,r,n,23,4),r+4}function I(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),a.write(t,e,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],a=1,i=0;++i>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t+--e],a=1;e>0&&(a*=256);)n+=this[t+--e]*a;return n},e.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},e.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},e.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},e.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},e.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},e.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],a=1,i=0;++i=(a*=128)&&(n-=Math.pow(2,8*e)),n},e.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=e,a=1,i=this[t+--n];n>0&&(a*=256);)i+=this[t+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*e)),i},e.prototype.readInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},e.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},e.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},e.prototype.readFloatLE=function(t,e){return t>>>=0,e||E(t,4,this.length),a.read(this,t,!0,23,4)},e.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),a.read(this,t,!1,23,4)},e.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),a.read(this,t,!0,52,8)},e.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),a.read(this,t,!1,52,8)},e.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var a=r-1,i=1;for(this[e+a]=255&t;--a>=0&&(i*=256);)this[e+a]=t/i&255;return e+r},e.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},e.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},e.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);C(this,t,e,r,a-1,-a)}var i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},e.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},e.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},e.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},e.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},e.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},e.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},e.prototype.writeDoubleLE=function(t,e,r){return I(this,t,e,!0,r)},e.prototype.writeDoubleBE=function(t,e,r){return I(this,t,e,!1,r)},e.prototype.copy=function(t,r,n,a){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),a||0===a||(a=this.length),r>=t.length&&(r=t.length),r||(r=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,a),r);return i},e.prototype.fill=function(t,r,n,a){if("string"==typeof t){if("string"==typeof r?(a=r,r=0,n=this.length):"string"==typeof n&&(a=n,n=this.length),void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("string"==typeof a&&!e.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(1===t.length){var i=t.charCodeAt(0);("utf8"===a&&i<128||"latin1"===a)&&(t=i)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=r;o55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function R(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var a=0;a=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function B(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function N(t){return t!=t}}).call(this,t("buffer").Buffer)},{"base64-js":79,buffer:111,ieee754:416}],112:[function(t,e,r){"use strict";var n=t("./lib/monotone"),a=t("./lib/triangulation"),i=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 c(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 u=!!c(r,"delaunay",!0),h=!!c(r,"interior",!0),f=!!c(r,"exterior",!0),p=!!c(r,"infinity",!1);if(!h&&!f||0===t.length)return[];var d=n(t,e);if(u||h!==f||p){for(var g=a(t.length,function(t){return t.map(s).sort(l)}(e)),m=0;m0;){for(var p=r.pop(),d=(s=r.pop(),u=-1,h=-1,l=o[s],1);d=0||(e.flip(s,p),a(t,e,r,u,s,h),a(t,e,r,s,h,u),a(t,e,r,h,p,u),a(t,e,r,p,u,h)))}}},{"binary-search-bounds":96,"robust-in-sphere":518}],114:[function(t,e,r){"use strict";var n,a=t("binary-search-bounds");function i(t,e,r,n,a,i,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=a,this.next=i,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,a=0;a0||l.length>0;){for(;s.length>0;){var p=s.pop();if(c[p]!==-a){c[p]=a;u[p];for(var d=0;d<3;++d){var g=f[3*p+d];g>=0&&0===c[g]&&(h[3*p+d]?l.push(g):(s.push(g),c[g]=a))}}}var m=l;l=s,s=m,l.length=0,a=-a}var v=function(t,e,r){for(var n=0,a=0;a1&&a(r[f[p-2]],r[f[p-1]],i)>0;)t.push([f[p-1],f[p-2],o]),p-=1;f.length=p,f.push(o);var d=h.upperIds;for(p=d.length;p>1&&a(r[d[p-2]],r[d[p-1]],i)<0;)t.push([d[p-2],d[p-1],o]),p-=1;d.length=p,d.push(o)}}function u(t,e){var r;return(r=t.a[0]d[0]&&a.push(new o(d,p,2,l),new o(p,d,1,l))}a.sort(s);for(var g=a[0].a[0]-(1+Math.abs(a[0].a[0]))*Math.pow(2,-52),m=[new i([g,1],[g,0],-1,[],[],[],[])],v=[],y=(l=0,a.length);l=0}}(),i.removeTriangle=function(t,e,r){var n=this.stars;o(n[t],e,r),o(n[e],r,t),o(n[r],t,e)},i.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},i.opposite=function(t,e){for(var r=this.stars[e],n=1,a=r.length;nr?r:t:te?e:t}},{}],121:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n;if(r){n=e;for(var a=new Array(e.length),i=0;ie[2]?1:0)}function v(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--i){var x=e[u=(S=n[i])[0]],b=x[0],_=x[1],w=t[b],T=t[_];if((w[0]-T[0]||w[1]-T[1])<0){var k=b;b=_,_=k}x[0]=b;var M,A=x[1]=S[1];for(a&&(M=x[2]);i>0&&n[i-1][0]===u;){var S,E=(S=n[--i])[1];a?e.push([A,E,M]):e.push([A,E]),A=E}a?e.push([A,_,M]):e.push([A,_])}return f}(t,e,f,m,r));return v(e,y,r),!!y||(f.length>0||m.length>0)}},{"./lib/rat-seg-intersect":122,"big-rat":83,"big-rat/cmp":81,"big-rat/to-float":95,"box-intersect":101,nextafter:470,"rat-vec":504,"robust-segment-intersect":523,"union-find":568}],122:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=s(e,t),h=s(n,r),f=u(i,h);if(0===o(f))return null;var p=s(t,r),d=u(h,p),g=a(d,f),m=c(i,g);return l(t,m)};var n=t("big-rat/mul"),a=t("big-rat/div"),i=t("big-rat/sub"),o=t("big-rat/sign"),s=t("rat-vec/sub"),l=t("rat-vec/add"),c=t("rat-vec/muls");function u(t,e){return i(n(t[0],e[1]),n(t[1],e[0]))}},{"big-rat/div":82,"big-rat/mul":92,"big-rat/sign":93,"big-rat/sub":94,"rat-vec/add":503,"rat-vec/muls":505,"rat-vec/sub":506}],123:[function(t,e,r){"use strict";var n=t("clamp");function a(t,e){null==e&&(e=!0);var r=t[0],a=t[1],i=t[2],o=t[3];return null==o&&(o=e?1:255),e&&(r*=255,a*=255,i*=255,o*=255),16777216*(r=255&n(r,0,255))+((a=255&n(a,0,255))<<16)+((i=255&n(i,0,255))<<8)+(o=255&n(o,0,255))}e.exports=a,e.exports.to=a,e.exports.from=function(t,e){var r=(t=+t)>>>24,n=(16711680&t)>>>16,a=(65280&t)>>>8,i=255&t;return!1===e?[r,n,a,i]:[r/255,n/255,a/255,i/255]}},{clamp:120}],124:[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]}},{}],125:[function(t,e,r){"use strict";var n=t("color-rgba"),a=t("clamp"),i=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(i(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]=a(Math.floor(255*t[0]),0,255),r[1]=a(Math.floor(255*t[1]),0,255),r[2]=a(Math.floor(255*t[2]),0,255),r[3]=null==t[3]?255:a(Math.floor(255*t[3]),0,255)),r)}},{clamp:120,"color-rgba":127,dtype:175}],126:[function(t,e,r){(function(r){"use strict";var n=t("color-name"),a=t("is-plain-obj"),i=t("defined");e.exports=function(t){var e,s,l=[],c=1;if("string"==typeof t)if(n[t])l=n[t].slice(),s="rgb";else if("transparent"===t)c=0,s="rgb",l=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var u=(p=t.slice(1)).length;c=1,u<=4?(l=[parseInt(p[0]+p[0],16),parseInt(p[1]+p[1],16),parseInt(p[2]+p[2],16)],4===u&&(c=parseInt(p[3]+p[3],16)/255)):(l=[parseInt(p[0]+p[1],16),parseInt(p[2]+p[3],16),parseInt(p[4]+p[5],16)],8===u&&(c=parseInt(p[6]+p[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 h=e[1],f="rgb"===h,p=h.replace(/a$/,"");s=p;u="cmyk"===p?4:"gray"===p?1:3;l=e[2].trim().split(/\s*,\s*/).map((function(t,e){if(/%$/.test(t))return e===u?parseFloat(t)/100:"rgb"===p?255*parseFloat(t)/100:parseFloat(t);if("h"===p[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)})),h===p&&l.push(1),c=f||void 0===l[u]?1:l[u],l=l.slice(0,u)}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(a(t)){var d=i(t.r,t.red,t.R,null);null!==d?(s="rgb",l=[d,i(t.g,t.green,t.G),i(t.b,t.blue,t.B)]):(s="hsl",l=[i(t.h,t.hue,t.H),i(t.s,t.saturation,t.S),i(t.l,t.lightness,t.L,t.b,t.brightness)]),c=i(t.a,t.alpha,t.opacity,1),null!=t.opacity&&(c/=100)}else(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(l=[t[0],t[1],t[2]],s="rgb",c=4===t.length?t[3]:1);else s="rgb",l=[t>>>16,(65280&t)>>>8,255&t];return{space:s,values:l,alpha:c}};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":124,defined:170,"is-plain-obj":443}],127:[function(t,e,r){"use strict";var n=t("color-parse"),a=t("color-space/hsl"),i=t("clamp");e.exports=function(t){var e,r=n(t);return r.space?((e=Array(3))[0]=i(r.values[0],0,255),e[1]=i(r.values[1],0,255),e[2]=i(r.values[2],0,255),"h"===r.space[0]&&(e=a.rgb(e)),e.push(i(r.alpha,0,1)),e):[]}},{clamp:120,"color-parse":126,"color-space/hsl":128}],128:[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,a,i,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[i=255*l,i,i];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),a=[0,0,0];for(var c=0;c<3;c++)(n=o+1/3*-(c-1))<0?n++:n>1&&n--,i=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[c]=255*i;return a}},n.hsl=function(t){var e,r,n=t[0]/255,a=t[1]/255,i=t[2]/255,o=Math.min(n,a,i),s=Math.max(n,a,i),l=s-o;return s===o?e=0:n===s?e=(a-i)/l:a===s?e=2+(i-n)/l:i===s&&(e=4+(n-a)/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":129}],129:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],130:[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]}]}},{}],131:[function(t,e,r){"use strict";var n=t("./colorScale"),a=t("lerp");function i(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,c,u,h,f,p,d,g;t||(t={});p=(t.nshades||72)-1,f=t.format||"hex",(h=t.colormap)||(h="jet");if("string"==typeof h){if(h=h.toLowerCase(),!n[h])throw Error(h+" not a supported colorscale");u=n[h]}else{if(!Array.isArray(h))throw Error("unsupported colormap option",h);u=h.slice()}if(u.length>p+1)throw new Error(h+" map requires nshades to be at least size "+u.length);d=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:t.alpha.slice():"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1];e=u.map((function(t){return Math.round(t.index*p)})),d[0]=Math.min(Math.max(d[0],0),1),d[1]=Math.min(Math.max(d[1],0),1);var m=u.map((function(t,e){var r=u[e].index,n=u[e].rgb.slice();return 4===n.length&&n[3]>=0&&n[3]<=1||(n[3]=d[0]+(d[1]-d[0])*r),n})),v=[];for(g=0;g0||l(t,e,i)?-1:1:0===s?c>0||l(t,e,r)?1:-1:a(c-s)}var f=n(t,e,r);return f>0?o>0&&n(t,e,i)>0?1:-1:f<0?o>0||n(t,e,i)>0?1:-1:n(t,e,i)>0||l(t,e,r)?1:-1};var n=t("robust-orientation"),a=t("signum"),i=t("two-sum"),o=t("robust-product"),s=t("robust-sum");function l(t,e,r){var n=i(t[0],-e[0]),a=i(t[1],-e[1]),l=i(r[0],-e[0]),c=i(r[1],-e[1]),u=s(o(n,l),o(a,c));return u[u.length-1]>=0}},{"robust-orientation":520,"robust-product":521,"robust-sum":525,signum:526,"two-sum":555}],133:[function(t,e,r){e.exports=function(t,e){var r=t.length,i=t.length-e.length;if(i)return i;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(i=o+t[2]-(s+e[2]))return i;var l=n(t[0],t[1]),c=n(e[0],e[1]);return n(l,t[2])-n(c,e[2])||n(l+t[2],o)-n(c+e[2],s);case 4:var u=t[0],h=t[1],f=t[2],p=t[3],d=e[0],g=e[1],m=e[2],v=e[3];return u+h+f+p-(d+g+m+v)||n(u,h,f,p)-n(d,g,m,v,d)||n(u+h,u+f,u+p,h+f,h+p,f+p)-n(d+g,d+m,d+v,g+m,g+v,m+v)||n(u+h+f,u+h+p,u+f+p,h+f+p)-n(d+g+m,d+g+v,d+m+v,g+m+v);default:for(var y=t.slice().sort(a),x=e.slice().sort(a),b=0;bt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}},{}],137:[function(t,e,r){"use strict";e.exports=function(t){var e=n(t),r=e.length;if(r<=2)return[];for(var a=new Array(r),i=e[r-1],o=0;o=e[l]&&(s+=1);i[o]=s}}return t}(n(i,!0),r)}};var n=t("incremental-convex-hull"),a=t("affine-hull")},{"affine-hull":67,"incremental-convex-hull":433}],139:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],140:[function(t,e,r){e.exports=["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]},{}],141:[function(t,e,r){e.exports=["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]},{}],142:[function(t,e,r){e.exports=["normal","italic","oblique"]},{}],143:[function(t,e,r){e.exports=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},{}],144:[function(t,e,r){"use strict";e.exports={parse:t("./parse"),stringify:t("./stringify")}},{"./parse":146,"./stringify":147}],145:[function(t,e,r){"use strict";var n=t("css-font-size-keywords");e.exports={isSize:function(t){return/^[\d\.]/.test(t)||-1!==t.indexOf("/")||-1!==n.indexOf(t)}}},{"css-font-size-keywords":140}],146:[function(t,e,r){"use strict";var n=t("unquote"),a=t("css-global-keywords"),i=t("css-system-font-keywords"),o=t("css-font-weight-keywords"),s=t("css-font-style-keywords"),l=t("css-font-stretch-keywords"),c=t("string-split-by"),u=t("./lib/util").isSize;e.exports=f;var h=f.cache={};function f(t){if("string"!=typeof t)throw new Error("Font argument must be a string.");if(h[t])return h[t];if(""===t)throw new Error("Cannot parse an empty string.");if(-1!==i.indexOf(t))return h[t]={system:t};for(var e,r={style:"normal",variant:"normal",weight:"normal",stretch:"normal",lineHeight:"normal",size:"1rem",family:["serif"]},f=c(t,/\s+/);e=f.shift();){if(-1!==a.indexOf(e))return["style","variant","weight","stretch"].forEach((function(t){r[t]=e})),h[t]=r;if(-1===s.indexOf(e))if("normal"!==e&&"small-caps"!==e)if(-1===l.indexOf(e)){if(-1===o.indexOf(e)){if(u(e)){var d=c(e,"/");if(r.size=d[0],null!=d[1]?r.lineHeight=p(d[1]):"/"===f[0]&&(f.shift(),r.lineHeight=p(f.shift())),!f.length)throw new Error("Missing required font-family.");return r.family=c(f.join(" "),/\s*,\s*/).map(n),h[t]=r}throw new Error("Unknown or unsupported font token: "+e)}r.weight=e}else r.stretch=e;else r.variant=e;else r.style=e}throw new Error("Missing required font-size.")}function p(t){var e=parseFloat(t);return e.toString()===t?e:t}},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"string-split-by":540,unquote:570}],147:[function(t,e,r){"use strict";var n=t("pick-by-alias"),a=t("./lib/util").isSize,i=g(t("css-global-keywords")),o=g(t("css-system-font-keywords")),s=g(t("css-font-weight-keywords")),l=g(t("css-font-style-keywords")),c=g(t("css-font-stretch-keywords")),u={normal:1,"small-caps":1},h={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1},f="1rem",p="serif";function d(t,e){if(t&&!e[t]&&!i[t])throw Error("Unknown keyword `"+t+"`");return t}function g(t){for(var e={},r=0;r=0;--p)i[p]=c*t[p]+u*e[p]+h*r[p]+f*n[p];return i}return c*t+u*e+h*r+f*n},e.exports.derivative=function(t,e,r,n,a,i){var o=6*a*a-6*a,s=3*a*a-4*a+1,l=-6*a*a+6*a,c=3*a*a-2*a;if(t.length){i||(i=new Array(t.length));for(var u=t.length-1;u>=0;--u)i[u]=o*t[u]+s*e[u]+l*r[u]+c*n[u];return i}return o*t+s*e+l*r[u]+c*n}},{}],151:[function(t,e,r){"use strict";var n=t("./lib/thunk.js");function a(){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 a;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===o){if(e.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(i),ir.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":153}],152:[function(t,e,r){"use strict";var n=t("uniq");function a(t,e,r){var n,a,i=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],c=[],u=0,h=0;for(n=0;n0&&l.push("var "+c.join(",")),n=i-1;n>=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r){for(var n=t.body,a=[],i=[],o=0;o0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,s=new Array(t.arrayArgs.length),l=new Array(t.arrayArgs.length),c=0;c0&&x.push("shape=SS.slice(0)"),t.indexArgs.length>0){var b=new Array(r);for(c=0;c0&&y.push("var "+x.join(",")),c=0;c3&&y.push(i(t.pre,t,l));var k=i(t.body,t,l),M=function(t){for(var e=0,r=t[0].length;e0,c=[],u=0;u0;){"].join("")),c.push(["if(j",u,"<",s,"){"].join("")),c.push(["s",e[u],"=j",u].join("")),c.push(["j",u,"=0"].join("")),c.push(["}else{s",e[u],"=",s].join("")),c.push(["j",u,"-=",s,"}"].join("")),l&&c.push(["index[",e[u],"]=j",u].join(""));for(u=0;u3&&y.push(i(t.post,t,l)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+y.join("\n")+"\n----------");var A=[t.funcName||"unnamed","_cwise_loop_",s[0].join("s"),"m",M,o(l)].join("");return new Function(["function ",A,"(",v.join(","),"){",y.join("\n"),"} return ",A].join(""))()}},{uniq:569}],153:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],a=t.funcName+"_cwise_thunk";e.push(["return function ",a,"(",t.shimArgs.join(","),"){"].join(""));for(var i=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],c=[],u=0;u0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[u]))),c.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}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 (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),u=0;ue?1:t>=e?0:NaN}function r(t){var r;return 1===t.length&&(r=t,t=function(t,n){return e(r(t),n)}),{left:function(e,r,n,a){for(null==n&&(n=0),null==a&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(null==n&&(n=0),null==a&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+1}return n}}}var n=r(e),a=n.right,i=n.left;function o(t,e){return[t,e]}function s(t){return null===t?NaN:+t}function l(t,e){var r,n,a=t.length,i=0,o=-1,l=0,c=0;if(null==e)for(;++o1)return c/(i-1)}function c(t,e){var r=l(t,e);return r?Math.sqrt(r):r}function u(t,e){var r,n,a,i=t.length,o=-1;if(null==e){for(;++o=r)for(n=a=r;++or&&(n=r),a=r)for(n=a=r;++or&&(n=r),a=0?(i>=v?10:i>=y?5:i>=x?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(i>=v?10:i>=y?5:i>=x?2:1)}function _(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),a=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),i=n/a;return i>=v?a*=10:i>=y?a*=5:i>=x&&(a*=2),e=1)return+r(t[n-1],n-1,t);var n,a=(n-1)*e,i=Math.floor(a),o=+r(t[i],i,t);return o+(+r(t[i+1],i+1,t)-o)*(a-i)}}function k(t,e){var r,n,a=t.length,i=-1;if(null==e){for(;++i=r)for(n=r;++ir&&(n=r)}else for(;++i=r)for(n=r;++ir&&(n=r);return n}function M(t){if(!(a=t.length))return[];for(var e=-1,r=k(t,A),n=new Array(r);++et?1:e>=t?0:NaN},t.deviation=c,t.extent=u,t.histogram=function(){var t=g,e=u,r=w;function n(n){var i,o,s=n.length,l=new Array(s);for(i=0;ih;)f.pop(),--p;var d,g=new Array(p+1);for(i=0;i<=p;++i)(d=g[i]=[]).x0=i>0?f[i-1]:u,d.x1=i=r)for(n=r;++in&&(n=r)}else for(;++i=r)for(n=r;++in&&(n=r);return n},t.mean=function(t,e){var r,n=t.length,a=n,i=-1,o=0;if(null==e)for(;++i=0;)for(e=(n=t[a]).length;--e>=0;)r[--o]=n[e];return r},t.min=k,t.pairs=function(t,e){null==e&&(e=o);for(var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);r0)return[t];if((n=e0)for(t=Math.ceil(t/o),e=Math.floor(e/o),i=new Array(a=Math.ceil(e-t+1));++s=l.length)return null!=t&&n.sort(t),null!=e?e(n):n;for(var s,c,h,f=-1,p=n.length,d=l[a++],g=r(),m=i();++fl.length)return r;var a,i=c[n-1];return null!=e&&n>=l.length?a=r.entries():(a=[],r.each((function(e,r){a.push({key:r,values:t(e,n)})}))),null!=i?a.sort((function(t,e){return i(t.key,e.key)})):a}(u(t,0,i,o),0)},key:function(t){return l.push(t),s},sortKeys:function(t){return c[l.length-1]=t,s},sortValues:function(e){return t=e,s},rollup:function(t){return e=t,s}}},t.set=c,t.map=r,t.keys=function(t){var e=[];for(var r in t)e.push(r);return e},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},Object.defineProperty(t,"__esModule",{value:!0})}))},{}],158:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function r(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function n(){}var a="\\s*([+-]?\\d+)\\s*",i="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",s=/^#([0-9a-f]{3,8})$/,l=new RegExp("^rgb\\("+[a,a,a]+"\\)$"),c=new RegExp("^rgb\\("+[o,o,o]+"\\)$"),u=new RegExp("^rgba\\("+[a,a,a,i]+"\\)$"),h=new RegExp("^rgba\\("+[o,o,o,i]+"\\)$"),f=new RegExp("^hsl\\("+[i,o,o]+"\\)$"),p=new RegExp("^hsla\\("+[i,o,o,i]+"\\)$"),d={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function g(){return this.rgb().formatHex()}function m(){return this.rgb().formatRgb()}function v(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=s.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?y(e):3===r?new w(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?x(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?x(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=l.exec(t))?new w(e[1],e[2],e[3],1):(e=c.exec(t))?new w(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=u.exec(t))?x(e[1],e[2],e[3],e[4]):(e=h.exec(t))?x(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=f.exec(t))?A(e[1],e[2]/100,e[3]/100,1):(e=p.exec(t))?A(e[1],e[2]/100,e[3]/100,e[4]):d.hasOwnProperty(t)?y(d[t]):"transparent"===t?new w(NaN,NaN,NaN,0):null}function y(t){return new w(t>>16&255,t>>8&255,255&t,1)}function x(t,e,r,n){return n<=0&&(t=e=r=NaN),new w(t,e,r,n)}function b(t){return t instanceof n||(t=v(t)),t?new w((t=t.rgb()).r,t.g,t.b,t.opacity):new w}function _(t,e,r,n){return 1===arguments.length?b(t):new w(t,e,r,null==n?1:n)}function w(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function T(){return"#"+M(this.r)+M(this.g)+M(this.b)}function k(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function M(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function A(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new C(t,e,r,n)}function S(t){if(t instanceof C)return new C(t.h,t.s,t.l,t.opacity);if(t instanceof n||(t=v(t)),!t)return new C;if(t instanceof C)return t;var e=(t=t.rgb()).r/255,r=t.g/255,a=t.b/255,i=Math.min(e,r,a),o=Math.max(e,r,a),s=NaN,l=o-i,c=(o+i)/2;return l?(s=e===o?(r-a)/l+6*(r0&&c<1?0:s,new C(s,l,c,t.opacity)}function E(t,e,r,n){return 1===arguments.length?S(t):new C(t,e,r,null==n?1:n)}function C(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function L(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}e(n,v,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:g,formatHex:g,formatHsl:function(){return S(this).formatHsl()},formatRgb:m,toString:m}),e(w,_,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:T,formatHex:T,formatRgb:k,toString:k})),e(C,E,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new C(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new C(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,a=2*r-n;return new w(L(t>=240?t-240:t+120,a,n),L(t,a,n),L(t<120?t+240:t-120,a,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var P=Math.PI/180,I=180/Math.PI,z=6/29,O=3*z*z;function D(t){if(t instanceof F)return new F(t.l,t.a,t.b,t.opacity);if(t instanceof H)return G(t);t instanceof w||(t=b(t));var e,r,n=U(t.r),a=U(t.g),i=U(t.b),o=B((.2225045*n+.7168786*a+.0606169*i)/1);return n===a&&a===i?e=r=o:(e=B((.4360747*n+.3850649*a+.1430804*i)/.96422),r=B((.0139322*n+.0971045*a+.7141733*i)/.82521)),new F(116*o-16,500*(e-o),200*(o-r),t.opacity)}function R(t,e,r,n){return 1===arguments.length?D(t):new F(t,e,r,null==n?1:n)}function F(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function B(t){return t>.008856451679035631?Math.pow(t,1/3):t/O+4/29}function N(t){return t>z?t*t*t:O*(t-4/29)}function j(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function U(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function V(t){if(t instanceof H)return new H(t.h,t.c,t.l,t.opacity);if(t instanceof F||(t=D(t)),0===t.a&&0===t.b)return new H(NaN,0=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}}))}function i(t,e){for(var r,n=0,a=t.length;n0)for(var r,n,a=new Array(r),i=0;if+c||np+c||iu.index){var h=f-s.x-s.vx,m=p-s.y-s.vy,v=h*h+m*m;vt.r&&(t.r=t[e].r)}function f(){if(r){var e,a,i=r.length;for(n=new Array(i),e=0;e=c)){(t.data!==r||t.next)&&(0===h&&(d+=(h=o())*h),0===f&&(d+=(f=o())*f),d1?(null==r?u.remove(t):u.set(t,v(r)),e):u.get(t)},find:function(e,r,n){var a,i,o,s,l,c=0,u=t.length;for(null==n?n=1/0:n*=n,c=0;c1?(f.on(t,r),e):f.on(t)}}},t.forceX=function(t){var e,r,n,a=i(.1);function o(t){for(var a,i=0,o=e.length;i=0;)e+=r[n].value;else e=1;t.value=e}function i(t,e){var r,n,a,i,s,u=new c(t),h=+t.value&&(u.value=t.value),f=[u];for(null==e&&(e=o);r=f.pop();)if(h&&(r.value=+r.data.value),(a=e(r.data))&&(s=a.length))for(r.children=new Array(s),i=s-1;i>=0;--i)f.push(n=r.children[i]=new c(a[i])),n.parent=r,n.depth=r.depth+1;return u.eachBefore(l)}function o(t){return t.children}function s(t){t.data=t.data.data}function l(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function c(t){this.data=t,this.depth=this.height=0,this.parent=null}c.prototype=i.prototype={constructor:c,count:function(){return this.eachAfter(a)},each:function(t){var e,r,n,a,i=this,o=[i];do{for(e=o.reverse(),o=[];i=e.pop();)if(t(i),r=i.children)for(n=0,a=r.length;n=0;--r)a.push(e[r]);return this},sum:function(t){return this.eachAfter((function(e){for(var r=+t(e.data)||0,n=e.children,a=n&&n.length;--a>=0;)r+=n[a].value;e.value=r}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,r=function(t,e){if(t===e)return t;var r=t.ancestors(),n=e.ancestors(),a=null;t=r.pop(),e=n.pop();for(;t===e;)a=t,t=r.pop(),e=n.pop();return a}(e,t),n=[e];e!==r;)e=e.parent,n.push(e);for(var a=n.length;t!==r;)n.splice(a,0,t),t=t.parent;return n},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(r){r!==t&&e.push({source:r.parent,target:r})})),e},copy:function(){return i(this).eachBefore(s)}};var u=Array.prototype.slice;function h(t){for(var e,r,n=0,a=(t=function(t){for(var e,r,n=t.length;n;)r=Math.random()*n--|0,e=t[n],t[n]=t[r],t[r]=e;return t}(u.call(t))).length,i=[];n0&&r*r>n*n+a*a}function g(t,e){for(var r=0;r(o*=o)?(n=(c+o-a)/(2*c),i=Math.sqrt(Math.max(0,o/c-n*n)),r.x=t.x-n*s-i*l,r.y=t.y-n*l+i*s):(n=(c+a-o)/(2*c),i=Math.sqrt(Math.max(0,a/c-n*n)),r.x=e.x+n*s-i*l,r.y=e.y+n*l+i*s)):(r.x=e.x+r.r,r.y=e.y)}function b(t,e){var r=t.r+e.r-1e-6,n=e.x-t.x,a=e.y-t.y;return r>0&&r*r>n*n+a*a}function _(t){var e=t._,r=t.next._,n=e.r+r.r,a=(e.x*r.r+r.x*e.r)/n,i=(e.y*r.r+r.y*e.r)/n;return a*a+i*i}function w(t){this._=t,this.next=null,this.previous=null}function T(t){if(!(a=t.length))return 0;var e,r,n,a,i,o,s,l,c,u,f;if((e=t[0]).x=0,e.y=0,!(a>1))return e.r;if(r=t[1],e.x=-r.r,r.x=e.r,r.y=0,!(a>2))return e.r+r.r;x(r,e,n=t[2]),e=new w(e),r=new w(r),n=new w(n),e.next=n.previous=r,r.next=e.previous=n,n.next=r.previous=e;t:for(s=3;sf&&(f=s),m=u*u*g,(p=Math.max(f/m,m/h))>d){u-=s;break}d=p}v.push(o={value:u,dice:l1?e:1)},r}(G);var Z=function t(e){function r(t,r,n,a,i){if((o=t._squarify)&&o.ratio===e)for(var o,s,l,c,u,h=-1,f=o.length,p=t.value;++h1?e:1)},r}(G);t.cluster=function(){var t=e,a=1,i=1,o=!1;function s(e){var s,l=0;e.eachAfter((function(e){var a=e.children;a?(e.x=function(t){return t.reduce(r,0)/t.length}(a),e.y=function(t){return 1+t.reduce(n,0)}(a)):(e.x=s?l+=t(e,s):0,e.y=0,s=e)}));var c=function(t){for(var e;e=t.children;)t=e[0];return t}(e),u=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(e),h=c.x-t(c,u)/2,f=u.x+t(u,c)/2;return e.eachAfter(o?function(t){t.x=(t.x-e.x)*a,t.y=(e.y-t.y)*i}:function(t){t.x=(t.x-h)/(f-h)*a,t.y=(1-(e.y?t.y/e.y:1))*i})}return s.separation=function(e){return arguments.length?(t=e,s):t},s.size=function(t){return arguments.length?(o=!1,a=+t[0],i=+t[1],s):o?null:[a,i]},s.nodeSize=function(t){return arguments.length?(o=!0,a=+t[0],i=+t[1],s):o?[a,i]:null},s},t.hierarchy=i,t.pack=function(){var t=null,e=1,r=1,n=A;function a(a){return a.x=e/2,a.y=r/2,t?a.eachBefore(C(t)).eachAfter(L(n,.5)).eachBefore(P(1)):a.eachBefore(C(E)).eachAfter(L(A,1)).eachAfter(L(n,a.r/Math.min(e,r))).eachBefore(P(Math.min(e,r)/(2*a.r))),a}return a.radius=function(e){return arguments.length?(t=k(e),a):t},a.size=function(t){return arguments.length?(e=+t[0],r=+t[1],a):[e,r]},a.padding=function(t){return arguments.length?(n="function"==typeof t?t:S(+t),a):n},a},t.packEnclose=h,t.packSiblings=function(t){return T(t),t},t.partition=function(){var t=1,e=1,r=0,n=!1;function a(a){var i=a.height+1;return a.x0=a.y0=r,a.x1=t,a.y1=e/i,a.eachBefore(function(t,e){return function(n){n.children&&z(n,n.x0,t*(n.depth+1)/e,n.x1,t*(n.depth+2)/e);var a=n.x0,i=n.y0,o=n.x1-r,s=n.y1-r;o0)throw new Error("cycle");return i}return r.id=function(e){return arguments.length?(t=M(e),r):t},r.parentId=function(t){return arguments.length?(e=M(t),r):e},r},t.tree=function(){var t=B,e=1,r=1,n=null;function a(a){var l=function(t){for(var e,r,n,a,i,o=new q(t,0),s=[o];e=s.pop();)if(n=e._.children)for(e.children=new Array(i=n.length),a=i-1;a>=0;--a)s.push(r=e.children[a]=new q(n[a],a)),r.parent=e;return(o.parent=new q(null,0)).children=[o],o}(a);if(l.eachAfter(i),l.parent.m=-l.z,l.eachBefore(o),n)a.eachBefore(s);else{var c=a,u=a,h=a;a.eachBefore((function(t){t.xu.x&&(u=t),t.depth>h.depth&&(h=t)}));var f=c===u?1:t(c,u)/2,p=f-c.x,d=e/(u.x+f+p),g=r/(h.depth||1);a.eachBefore((function(t){t.x=(t.x+p)*d,t.y=t.depth*g}))}return a}function i(e){var r=e.children,n=e.parent.children,a=e.i?n[e.i-1]:null;if(r){!function(t){for(var e,r=0,n=0,a=t.children,i=a.length;--i>=0;)(e=a[i]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(e);var i=(r[0].z+r[r.length-1].z)/2;a?(e.z=a.z+t(e._,a._),e.m=e.z-i):e.z=i}else a&&(e.z=a.z+t(e._,a._));e.parent.A=function(e,r,n){if(r){for(var a,i=e,o=e,s=r,l=i.parent.children[0],c=i.m,u=o.m,h=s.m,f=l.m;s=j(s),i=N(i),s&&i;)l=N(l),(o=j(o)).a=e,(a=s.z+h-i.z-c+t(s._,i._))>0&&(U(V(s,e,n),e,a),c+=a,u+=a),h+=s.m,c+=i.m,f+=l.m,u+=o.m;s&&!j(o)&&(o.t=s,o.m+=h-u),i&&!N(l)&&(l.t=i,l.m+=c-f,n=e)}return n}(e,a,e.parent.A||n[0])}function o(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*r}return a.separation=function(e){return arguments.length?(t=e,a):t},a.size=function(t){return arguments.length?(n=!1,e=+t[0],r=+t[1],a):n?null:[e,r]},a.nodeSize=function(t){return arguments.length?(n=!0,e=+t[0],r=+t[1],a):n?[e,r]:null},a},t.treemap=function(){var t=W,e=!1,r=1,n=1,a=[0],i=A,o=A,s=A,l=A,c=A;function u(t){return t.x0=t.y0=0,t.x1=r,t.y1=n,t.eachBefore(h),a=[0],e&&t.eachBefore(I),t}function h(e){var r=a[e.depth],n=e.x0+r,u=e.y0+r,h=e.x1-r,f=e.y1-r;h=r-1){var u=s[e];return u.x0=a,u.y0=i,u.x1=o,void(u.y1=l)}var h=c[e],f=n/2+h,p=e+1,d=r-1;for(;p>>1;c[g]l-i){var y=(a*v+o*m)/n;t(e,p,m,a,i,y,l),t(p,r,v,y,i,o,l)}else{var x=(i*v+l*m)/n;t(e,p,m,a,i,o,x),t(p,r,v,a,x,o,l)}}(0,l,t.value,e,r,n,a)},t.treemapDice=z,t.treemapResquarify=Z,t.treemapSlice=H,t.treemapSliceDice=function(t,e,r,n,a){(1&t.depth?H:z)(t,e,r,n,a)},t.treemapSquarify=W,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],162:[function(t,e,r){!function(n,a){"object"==typeof r&&"undefined"!=typeof e?a(r,t("d3-color")):a((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t,e,r,n,a){var i=t*t,o=i*t;return((1-3*t+3*i-o)*e+(4-6*i+3*o)*r+(1+3*t+3*i-3*o)*n+o*a)/6}function n(t){var e=t.length-1;return function(n){var a=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[a],o=t[a+1],s=a>0?t[a-1]:2*i-o,l=a180||r<-180?r-360*Math.round(r/360):r):i(isNaN(t)?e:t)}function l(t){return 1==(t=+t)?c:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):i(isNaN(e)?r:e)}}function c(t,e){var r=e-t;return r?o(t,r):i(isNaN(t)?e:t)}var u=function t(r){var n=l(r);function a(t,r){var a=n((t=e.rgb(t)).r,(r=e.rgb(r)).r),i=n(t.g,r.g),o=n(t.b,r.b),s=c(t.opacity,r.opacity);return function(e){return t.r=a(e),t.g=i(e),t.b=o(e),t.opacity=s(e),t+""}}return a.gamma=t,a}(1);function h(t){return function(r){var n,a,i=r.length,o=new Array(i),s=new Array(i),l=new Array(i);for(n=0;ni&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:y(r,n)})),i=_.lastIndex;return i180?e+=360:e-t>180&&(t+=360),i.push({i:r.push(a(r)+"rotate(",null,n)-2,x:y(t,e)})):e&&r.push(a(r)+"rotate("+e+n)}(i.rotate,o.rotate,s,l),function(t,e,r,i){t!==e?i.push({i:r.push(a(r)+"skewX(",null,n)-2,x:y(t,e)}):e&&r.push(a(r)+"skewX("+e+n)}(i.skewX,o.skewX,s,l),function(t,e,r,n,i,o){if(t!==r||e!==n){var s=i.push(a(i)+"scale(",null,",",null,")");o.push({i:s-4,x:y(t,r)},{i:s-2,x:y(e,n)})}else 1===r&&1===n||i.push(a(i)+"scale("+r+","+n+")")}(i.scaleX,i.scaleY,o.scaleX,o.scaleY,s,l),i=o=null,function(t){for(var e,r=-1,n=l.length;++r1e-6)if(Math.abs(h*l-c*u)>1e-6&&i){var p=n-o,d=a-s,g=l*l+c*c,m=p*p+d*d,v=Math.sqrt(g),y=Math.sqrt(f),x=i*Math.tan((e-Math.acos((g+f-m)/(2*v*y)))/2),b=x/y,_=x/v;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*u)+","+(r+b*h)),this._+="A"+i+","+i+",0,0,"+ +(h*p>u*d)+","+(this._x1=t+_*l)+","+(this._y1=r+_*c)}else this._+="L"+(this._x1=t)+","+(this._y1=r);else;},arc:function(t,a,i,o,s,l){t=+t,a=+a,l=!!l;var c=(i=+i)*Math.cos(o),u=i*Math.sin(o),h=t+c,f=a+u,p=1^l,d=l?o-s:s-o;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+h+","+f:(Math.abs(this._x1-h)>1e-6||Math.abs(this._y1-f)>1e-6)&&(this._+="L"+h+","+f),i&&(d<0&&(d=d%r+r),d>n?this._+="A"+i+","+i+",0,1,"+p+","+(t-c)+","+(a-u)+"A"+i+","+i+",0,1,"+p+","+(this._x1=h)+","+(this._y1=f):d>1e-6&&(this._+="A"+i+","+i+",0,"+ +(d>=e)+","+p+","+(this._x1=t+i*Math.cos(s))+","+(this._y1=a+i*Math.sin(s))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}},t.path=i,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],164:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var a,i,o,s,l,c,u,h,f,p=t._root,d={data:n},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(!p)return t._root=d,t;for(;p.length;)if((c=e>=(i=(g+v)/2))?g=i:v=i,(u=r>=(o=(m+y)/2))?m=o:y=o,a=p,!(p=p[h=u<<1|c]))return a[h]=d,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&r===l)return d.next=p,a?a[h]=d:t._root=d,t;do{a=a?a[h]=new Array(4):t._root=new Array(4),(c=e>=(i=(g+v)/2))?g=i:v=i,(u=r>=(o=(m+y)/2))?m=o:y=o}while((h=u<<1|c)==(f=(l>=o)<<1|s>=i));return a[f]=p,a[h]=d,t}function r(t,e,r,n,a){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=a}function n(t){return t[0]}function a(t){return t[1]}function i(t,e,r){var i=new o(null==e?n:e,null==r?a:r,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function o(t,e,r,n,a,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=a,this._y1=i,this._root=void 0}function s(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var l=i.prototype=o.prototype;l.copy=function(){var t,e,r=new o(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=s(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var a=0;a<4;++a)(e=n.source[a])&&(e.length?t.push({source:e,target:n.target[a]=new Array(4)}):n.target[a]=s(e));return r},l.add=function(t){var r=+this._x.call(null,t),n=+this._y.call(null,t);return e(this.cover(r,n),r,n,t)},l.addAll=function(t){var r,n,a,i,o=t.length,s=new Array(o),l=new Array(o),c=1/0,u=1/0,h=-1/0,f=-1/0;for(n=0;nh&&(h=a),if&&(f=i));if(c>h||u>f)return this;for(this.cover(c,u).cover(h,f),n=0;nt||t>=a||n>e||e>=i;)switch(s=(ep||(o=c.y0)>d||(s=c.x1)=y)<<1|t>=v)&&(c=g[g.length-1],g[g.length-1]=g[g.length-1-u],g[g.length-1-u]=c)}else{var x=t-+this._x.call(null,m.data),b=e-+this._y.call(null,m.data),_=x*x+b*b;if(_=(s=(d+m)/2))?d=s:m=s,(u=o>=(l=(g+v)/2))?g=l:v=l,e=p,!(p=p[h=u<<1|c]))return this;if(!p.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(a=p.next)&&delete p.next,n?(a?n.next=a:delete n.next,this):e?(a?e[h]=a:delete e[h],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[f]=p:this._root=p),this):(this._root=a,this)},l.removeAll=function(t){for(var e=0,r=t.length;e1?0:t<-1?u:Math.acos(t)}function d(t){return t>=1?h:t<=-1?-h:Math.asin(t)}function g(t){return t.innerRadius}function m(t){return t.outerRadius}function v(t){return t.startAngle}function y(t){return t.endAngle}function x(t){return t&&t.padAngle}function b(t,e,r,n,a,i,o,s){var l=r-t,c=n-e,u=o-a,h=s-i,f=h*l-u*c;if(!(f*f<1e-12))return[t+(f=(u*(e-i)-h*(t-a))/f)*l,e+f*c]}function _(t,e,r,n,a,i,s){var l=t-r,u=e-n,h=(s?i:-i)/c(l*l+u*u),f=h*u,p=-h*l,d=t+f,g=e+p,m=r+f,v=n+p,y=(d+m)/2,x=(g+v)/2,b=m-d,_=v-g,w=b*b+_*_,T=a-i,k=d*v-m*g,M=(_<0?-1:1)*c(o(0,T*T*w-k*k)),A=(k*_-b*M)/w,S=(-k*b-_*M)/w,E=(k*_+b*M)/w,C=(-k*b+_*M)/w,L=A-y,P=S-x,I=E-y,z=C-x;return L*L+P*P>I*I+z*z&&(A=E,S=C),{cx:A,cy:S,x01:-f,y01:-p,x11:A*(a/T-1),y11:S*(a/T-1)}}function w(t){this._context=t}function T(t){return new w(t)}function k(t){return t[0]}function M(t){return t[1]}function A(){var t=k,n=M,a=r(!0),i=null,o=T,s=null;function l(r){var l,c,u,h=r.length,f=!1;for(null==i&&(s=o(u=e.path())),l=0;l<=h;++l)!(l=h;--f)c.point(v[f],y[f]);c.lineEnd(),c.areaEnd()}m&&(v[u]=+t(p,u,r),y[u]=+a(p,u,r),c.point(n?+n(p,u,r):v[u],i?+i(p,u,r):y[u]))}if(d)return c=null,d+""||null}function h(){return A().defined(o).curve(l).context(s)}return u.x=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),n=null,u):t},u.x0=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),u):t},u.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:r(+t),u):n},u.y=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),i=null,u):a},u.y0=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),u):a},u.y1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:r(+t),u):i},u.lineX0=u.lineY0=function(){return h().x(t).y(a)},u.lineY1=function(){return h().x(t).y(i)},u.lineX1=function(){return h().x(n).y(a)},u.defined=function(t){return arguments.length?(o="function"==typeof t?t:r(!!t),u):o},u.curve=function(t){return arguments.length?(l=t,null!=s&&(c=l(s)),u):l},u.context=function(t){return arguments.length?(null==t?s=c=null:c=l(s=t),u):s},u}function E(t,e){return et?1:e>=t?0:NaN}function C(t){return t}w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var L=I(T);function P(t){this._curve=t}function I(t){function e(e){return new P(t(e))}return e._curve=t,e}function z(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(I(t)):e()._curve},t}function O(){return z(A().curve(L))}function D(){var t=S().curve(L),e=t.curve,r=t.lineX0,n=t.lineX1,a=t.lineY0,i=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return z(r())},delete t.lineX0,t.lineEndAngle=function(){return z(n())},delete t.lineX1,t.lineInnerRadius=function(){return z(a())},delete t.lineY0,t.lineOuterRadius=function(){return z(i())},delete t.lineY1,t.curve=function(t){return arguments.length?e(I(t)):e()._curve},t}function R(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}P.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};var F=Array.prototype.slice;function B(t){return t.source}function N(t){return t.target}function j(t){var n=B,a=N,i=k,o=M,s=null;function l(){var r,l=F.call(arguments),c=n.apply(this,l),u=a.apply(this,l);if(s||(s=r=e.path()),t(s,+i.apply(this,(l[0]=c,l)),+o.apply(this,l),+i.apply(this,(l[0]=u,l)),+o.apply(this,l)),r)return s=null,r+""||null}return l.source=function(t){return arguments.length?(n=t,l):n},l.target=function(t){return arguments.length?(a=t,l):a},l.x=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),l):i},l.y=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),l):o},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function U(t,e,r,n,a){t.moveTo(e,r),t.bezierCurveTo(e=(e+n)/2,r,e,a,n,a)}function V(t,e,r,n,a){t.moveTo(e,r),t.bezierCurveTo(e,r=(r+a)/2,n,r,n,a)}function q(t,e,r,n,a){var i=R(e,r),o=R(e,r=(r+a)/2),s=R(n,r),l=R(n,a);t.moveTo(i[0],i[1]),t.bezierCurveTo(o[0],o[1],s[0],s[1],l[0],l[1])}var H={draw:function(t,e){var r=Math.sqrt(e/u);t.moveTo(r,0),t.arc(0,0,r,0,f)}},G={draw:function(t,e){var r=Math.sqrt(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},Y=Math.sqrt(1/3),W=2*Y,Z={draw:function(t,e){var r=Math.sqrt(e/W),n=r*Y;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},X=Math.sin(u/10)/Math.sin(7*u/10),J=Math.sin(f/10)*X,K=-Math.cos(f/10)*X,Q={draw:function(t,e){var r=Math.sqrt(.8908130915292852*e),n=J*r,a=K*r;t.moveTo(0,-r),t.lineTo(n,a);for(var i=1;i<5;++i){var o=f*i/5,s=Math.cos(o),l=Math.sin(o);t.lineTo(l*r,-s*r),t.lineTo(s*n-l*a,l*n+s*a)}t.closePath()}},$={draw:function(t,e){var r=Math.sqrt(e),n=-r/2;t.rect(n,n,r,r)}},tt=Math.sqrt(3),et={draw:function(t,e){var r=-Math.sqrt(e/(3*tt));t.moveTo(0,2*r),t.lineTo(-tt*r,-r),t.lineTo(tt*r,-r),t.closePath()}},rt=-.5,nt=Math.sqrt(3)/2,at=1/Math.sqrt(12),it=3*(at/2+1),ot={draw:function(t,e){var r=Math.sqrt(e/it),n=r/2,a=r*at,i=n,o=r*at+r,s=-i,l=o;t.moveTo(n,a),t.lineTo(i,o),t.lineTo(s,l),t.lineTo(rt*n-nt*a,nt*n+rt*a),t.lineTo(rt*i-nt*o,nt*i+rt*o),t.lineTo(rt*s-nt*l,nt*s+rt*l),t.lineTo(rt*n+nt*a,rt*a-nt*n),t.lineTo(rt*i+nt*o,rt*o-nt*i),t.lineTo(rt*s+nt*l,rt*l-nt*s),t.closePath()}},st=[H,G,Z,$,Q,et,ot];function lt(){}function ct(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function ut(t){this._context=t}function ht(t){this._context=t}function ft(t){this._context=t}function pt(t,e){this._basis=new ut(t),this._beta=e}ut.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ct(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ht.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ft.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},pt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n,a=t[0],i=e[0],o=t[r]-a,s=e[r]-i,l=-1;++l<=r;)n=l/r,this._basis.point(this._beta*t[l]+(1-this._beta)*(a+n*o),this._beta*e[l]+(1-this._beta)*(i+n*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var dt=function t(e){function r(t){return 1===e?new ut(t):new pt(t,e)}return r.beta=function(e){return t(+e)},r}(.85);function gt(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function mt(t,e){this._context=t,this._k=(1-e)/6}mt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:gt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:gt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var vt=function t(e){function r(t){return new mt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function yt(t,e){this._context=t,this._k=(1-e)/6}yt.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:gt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var xt=function t(e){function r(t){return new yt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function bt(t,e){this._context=t,this._k=(1-e)/6}bt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:gt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var _t=function t(e){function r(t){return new bt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function wt(t,e,r){var n=t._x1,a=t._y1,i=t._x2,o=t._y2;if(t._l01_a>1e-12){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,a=(a*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>1e-12){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);i=(i*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,a,i,o,t._x2,t._y2)}function Tt(t,e){this._context=t,this._alpha=e}Tt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var kt=function t(e){function r(t){return e?new Tt(t,e):new mt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Mt(t,e){this._context=t,this._alpha=e}Mt.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var At=function t(e){function r(t){return e?new Mt(t,e):new yt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function St(t,e){this._context=t,this._alpha=e}St.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Et=function t(e){function r(t){return e?new St(t,e):new bt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Ct(t){this._context=t}function Lt(t){return t<0?-1:1}function Pt(t,e,r){var n=t._x1-t._x0,a=e-t._x1,i=(t._y1-t._y0)/(n||a<0&&-0),o=(r-t._y1)/(a||n<0&&-0),s=(i*a+o*n)/(n+a);return(Lt(i)+Lt(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(s))||0}function It(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function zt(t,e,r){var n=t._x0,a=t._y0,i=t._x1,o=t._y1,s=(i-n)/3;t._context.bezierCurveTo(n+s,a+s*e,i-s,o-s*r,i,o)}function Ot(t){this._context=t}function Dt(t){this._context=new Rt(t)}function Rt(t){this._context=t}function Ft(t){this._context=t}function Bt(t){var e,r,n=t.length-1,a=new Array(n),i=new Array(n),o=new Array(n);for(a[0]=0,i[0]=2,o[0]=t[0]+2*t[1],e=1;e=0;--e)a[e]=(o[e]-a[e+1])/i[e];for(i[n-1]=(t[n]+a[n-1])/2,e=0;e1)for(var r,n,a,i=1,o=t[e[0]],s=o.length;i=0;)r[e]=e;return r}function Vt(t,e){return t[e]}function qt(t){var e=t.map(Ht);return Ut(t).sort((function(t,r){return e[t]-e[r]}))}function Ht(t){for(var e,r=-1,n=0,a=t.length,i=-1/0;++ri&&(i=e,n=r);return n}function Gt(t){var e=t.map(Yt);return Ut(t).sort((function(t,r){return e[t]-e[r]}))}function Yt(t){for(var e,r=0,n=-1,a=t.length;++n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}},t.arc=function(){var t=g,o=m,w=r(0),T=null,k=v,M=y,A=x,S=null;function E(){var r,g,m=+t.apply(this,arguments),v=+o.apply(this,arguments),y=k.apply(this,arguments)-h,x=M.apply(this,arguments)-h,E=n(x-y),C=x>y;if(S||(S=r=e.path()),v1e-12)if(E>f-1e-12)S.moveTo(v*i(y),v*l(y)),S.arc(0,0,v,y,x,!C),m>1e-12&&(S.moveTo(m*i(x),m*l(x)),S.arc(0,0,m,x,y,C));else{var L,P,I=y,z=x,O=y,D=x,R=E,F=E,B=A.apply(this,arguments)/2,N=B>1e-12&&(T?+T.apply(this,arguments):c(m*m+v*v)),j=s(n(v-m)/2,+w.apply(this,arguments)),U=j,V=j;if(N>1e-12){var q=d(N/m*l(B)),H=d(N/v*l(B));(R-=2*q)>1e-12?(O+=q*=C?1:-1,D-=q):(R=0,O=D=(y+x)/2),(F-=2*H)>1e-12?(I+=H*=C?1:-1,z-=H):(F=0,I=z=(y+x)/2)}var G=v*i(I),Y=v*l(I),W=m*i(D),Z=m*l(D);if(j>1e-12){var X,J=v*i(z),K=v*l(z),Q=m*i(O),$=m*l(O);if(E1e-12?V>1e-12?(L=_(Q,$,G,Y,v,V,C),P=_(J,K,W,Z,v,V,C),S.moveTo(L.cx+L.x01,L.cy+L.y01),V1e-12&&R>1e-12?U>1e-12?(L=_(W,Z,J,K,m,-U,C),P=_(G,Y,Q,$,m,-U,C),S.lineTo(L.cx+L.x01,L.cy+L.y01),U0&&(d+=h);for(null!=e?g.sort((function(t,r){return e(m[t],m[r])})):null!=n&&g.sort((function(t,e){return n(r[t],r[e])})),s=0,c=d?(y-p*b)/d:0;s0?h*c:0)+b,m[l]={data:r[l],index:s,value:h,startAngle:v,endAngle:u,padAngle:x};return m}return s.value=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,n=null,s):e},s.sort=function(t){return arguments.length?(n=t,e=null,s):n},s.startAngle=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),s):a},s.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),s):i},s.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),s):o},s},t.pointRadial=R,t.radialArea=D,t.radialLine=O,t.stack=function(){var t=r([]),e=Ut,n=jt,a=Vt;function i(r){var i,o,s=t.apply(this,arguments),l=r.length,c=s.length,u=new Array(c);for(i=0;i0)for(var r,n,a,i,o,s,l=0,c=t[e[0]].length;l0?(n[0]=i,n[1]=i+=a):a<0?(n[1]=o,n[0]=o+=a):(n[0]=0,n[1]=a)},t.stackOffsetExpand=function(t,e){if((n=t.length)>0){for(var r,n,a,i=0,o=t[0].length;i0){for(var r,n=0,a=t[e[0]],i=a.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,a,i=0,o=1;o=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:mt,s:vt,S:q,u:H,U:G,V:Y,w:W,W:Z,x:null,X:null,y:X,Y:J,Z:K,"%":gt},Lt={a:function(t){return h[t.getUTCDay()]},A:function(t){return u[t.getUTCDay()]},b:function(t){return yt[t.getUTCMonth()]},B:function(t){return f[t.getUTCMonth()]},c:null,d:Q,e:Q,f:nt,H:$,I:tt,j:et,L:rt,m:at,M:it,p:function(t){return c[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:mt,s:vt,S:ot,u:st,U:lt,V:ct,w:ut,W:ht,x:null,X:null,y:ft,Y:pt,Z:dt,"%":gt},Pt={a:function(t,e,r){var n=Tt.exec(e.slice(r));return n?(t.w=kt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=St.exec(e.slice(r));return n?(t.m=Et[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=Mt.exec(e.slice(r));return n?(t.m=At[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return Ot(t,i,e,r)},d:M,e:M,f:P,H:S,I:S,j:A,L:L,m:k,M:E,p:function(t,e,r){var n=xt.exec(e.slice(r));return n?(t.p=bt[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:z,s:O,S:C,u:m,U:v,V:y,w:g,W:x,x:function(t,e,r){return Ot(t,o,e,r)},X:function(t,e,r){return Ot(t,l,e,r)},y:_,Y:b,Z:w,"%":I};function It(t,e){return function(r){var n,a,i,o=[],l=-1,c=0,u=t.length;for(r instanceof Date||(r=new Date(+r));++l53)return null;"w"in c||(c.w=1),"Z"in c?(l=(s=n(a(c.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(c.V-1)),c.y=s.getUTCFullYear(),c.m=s.getUTCMonth(),c.d=s.getUTCDate()+(c.w+6)%7):(l=(s=r(a(c.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(c.V-1)),c.y=s.getFullYear(),c.m=s.getMonth(),c.d=s.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),l="Z"in c?n(a(c.y,0,1)).getUTCDay():r(a(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(l+5)%7:c.w+7*c.U-(l+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Ot(t,e,r,n){for(var a,i,o=0,l=e.length,c=r.length;o=c)return-1;if(37===(a=e.charCodeAt(o++))){if(a=e.charAt(o++),!(i=Pt[a in s?e.charAt(o++):a])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}return Ct.x=It(o,Ct),Ct.X=It(l,Ct),Ct.c=It(i,Ct),Lt.x=It(o,Lt),Lt.X=It(l,Lt),Lt.c=It(i,Lt),{format:function(t){var e=It(t+="",Ct);return e.toString=function(){return t},e},parse:function(t){var e=zt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=It(t+="",Lt);return e.toString=function(){return t},e},utcParse:function(t){var e=zt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function h(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function P(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function I(t,e,r){var n=c.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function z(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function O(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function D(t,e){return h(t.getDate(),e,2)}function R(t,e){return h(t.getHours(),e,2)}function F(t,e){return h(t.getHours()%12||12,e,2)}function B(t,r){return h(1+e.timeDay.count(e.timeYear(t),t),r,3)}function N(t,e){return h(t.getMilliseconds(),e,3)}function j(t,e){return N(t,e)+"000"}function U(t,e){return h(t.getMonth()+1,e,2)}function V(t,e){return h(t.getMinutes(),e,2)}function q(t,e){return h(t.getSeconds(),e,2)}function H(t){var e=t.getDay();return 0===e?7:e}function G(t,r){return h(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function Y(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),h(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function W(t){return t.getDay()}function Z(t,r){return h(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function X(t,e){return h(t.getFullYear()%100,e,2)}function J(t,e){return h(t.getFullYear()%1e4,e,4)}function K(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+h(e/60|0,"0",2)+h(e%60,"0",2)}function Q(t,e){return h(t.getUTCDate(),e,2)}function $(t,e){return h(t.getUTCHours(),e,2)}function tt(t,e){return h(t.getUTCHours()%12||12,e,2)}function et(t,r){return h(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return h(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function at(t,e){return h(t.getUTCMonth()+1,e,2)}function it(t,e){return h(t.getUTCMinutes(),e,2)}function ot(t,e){return h(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,r){return h(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ct(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),h(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ut(t){return t.getUTCDay()}function ht(t,r){return h(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function ft(t,e){return h(t.getUTCFullYear()%100,e,2)}function pt(t,e){return h(t.getUTCFullYear()%1e4,e,4)}function dt(){return"+0000"}function gt(){return"%"}function mt(t){return+t}function vt(t){return Math.floor(+t/1e3)}function yt(e){return o=i(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var bt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=xt,t.isoParse=bt,t.timeFormatDefaultLocale=yt,t.timeFormatLocale=i,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":167}],167:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,a,i,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),a(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e0))return o;do{o.push(i=new Date(+e)),a(e,n),t(e)}while(i=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;a(t,-1),!e(t););else for(;--r>=0;)for(;a(t,1),!e(t););}))},i&&(s.count=function(n,a){return e.setTime(+n),r.setTime(+a),t(e),t(r),Math.floor(i(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var a=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));a.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):a:null};var i=a.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),c=l.range,u=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),h=u.range,f=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),p=f.range;function d(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var g=d(0),m=d(1),v=d(2),y=d(3),x=d(4),b=d(5),_=d(6),w=g.range,T=m.range,k=v.range,M=y.range,A=x.range,S=b.range,E=_.range,C=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),L=C.range,P=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));P.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var I=P.range,z=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),O=z.range,D=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),R=D.range,F=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),B=F.range;function N(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var j=N(0),U=N(1),V=N(2),q=N(3),H=N(4),G=N(5),Y=N(6),W=j.range,Z=U.range,X=V.range,J=q.range,K=H.range,Q=G.range,$=Y.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=f,t.timeDays=p,t.timeFriday=b,t.timeFridays=S,t.timeHour=u,t.timeHours=h,t.timeInterval=n,t.timeMillisecond=a,t.timeMilliseconds=i,t.timeMinute=l,t.timeMinutes=c,t.timeMonday=m,t.timeMondays=T,t.timeMonth=C,t.timeMonths=L,t.timeSaturday=_,t.timeSaturdays=E,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=g,t.timeSundays=w,t.timeThursday=x,t.timeThursdays=A,t.timeTuesday=v,t.timeTuesdays=k,t.timeWednesday=y,t.timeWednesdays=M,t.timeWeek=g,t.timeWeeks=w,t.timeYear=P,t.timeYears=I,t.utcDay=F,t.utcDays=B,t.utcFriday=G,t.utcFridays=Q,t.utcHour=D,t.utcHours=R,t.utcMillisecond=a,t.utcMilliseconds=i,t.utcMinute=z,t.utcMinutes=O,t.utcMonday=U,t.utcMondays=Z,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=Y,t.utcSaturdays=$,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=j,t.utcSundays=W,t.utcThursday=H,t.utcThursdays=K,t.utcTuesday=V,t.utcTuesdays=X,t.utcWednesday=q,t.utcWednesdays=J,t.utcWeek=j,t.utcWeeks=W,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],168:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e,r,n=0,a=0,i=0,o=0,s=0,l=0,c="object"==typeof performance&&performance.now?performance:Date,u="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function h(){return s||(u(f),s=c.now()+l)}function f(){s=0}function p(){this._call=this._time=this._next=null}function d(t,e,r){var n=new p;return n.restart(t,e,r),n}function g(){h(),++n;for(var t,r=e;r;)(t=s-r._time)>=0&&r._call.call(null,t),r=r._next;--n}function m(){s=(o=c.now())+l,n=a=0;try{g()}finally{n=0,function(){var t,n,a=e,i=1/0;for(;a;)a._call?(i>a._time&&(i=a._time),t=a,a=a._next):(n=a._next,a._next=null,a=t?t._next=n:e=n);r=t,y(i)}(),s=0}}function v(){var t=c.now(),e=t-o;e>1e3&&(l-=e,o=t)}function y(t){n||(a&&(a=clearTimeout(a)),t-s>24?(t<1/0&&(a=setTimeout(m,t-c.now()-l)),i&&(i=clearInterval(i))):(i||(o=c.now(),i=setInterval(v,1e3)),n=1,u(m)))}p.prototype=d.prototype={constructor:p,restart:function(t,n,a){if("function"!=typeof t)throw new TypeError("callback is not a function");a=(null==a?h():+a)+(null==n?0:+n),this._next||r===this||(r?r._next=this:e=this,r=this),this._call=t,this._time=a,y()},stop:function(){this._call&&(this._call=null,this._time=1/0,y())}},t.interval=function(t,e,r){var n=new p,a=e;return null==e?(n.restart(t,e,r),n):(e=+e,r=null==r?h():+r,n.restart((function i(o){o+=a,n.restart(i,a+=e,r),t(o)}),e,r),n)},t.now=h,t.timeout=function(t,e,r){var n=new p;return e=null==e?0:+e,n.restart((function(r){n.stop(),t(r+e)}),e,r),n},t.timer=d,t.timerFlush=g,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],169:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},a=this.document;function i(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(a)try{n(a.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),a)try{a.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,c=s.setAttributeNS,u=this.CSSStyleDeclaration.prototype,h=u.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){c.call(this,t,e,r+"")},u.setProperty=function(t,e,r){h.call(this,t,e+"",r)}}function f(t,e){return te?1:t>=e?0:NaN}function p(t){return null===t?NaN:+t}function d(t){return!isNaN(t)}function g(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+1}return n}}}t.ascending=f,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++an&&(r=n)}else{for(;++a=n){r=n;break}for(;++an&&(r=n)}return r},t.max=function(t,e){var r,n,a=-1,i=t.length;if(1===arguments.length){for(;++a=n){r=n;break}for(;++ar&&(r=n)}else{for(;++a=n){r=n;break}for(;++ar&&(r=n)}return r},t.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return o/(l-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var m=g(f);function v(t){return t.length}t.bisectLeft=m.left,t.bisect=t.bisectRight=m.right,t.bisector=function(t){return g(1===t.length?function(e,r){return f(t(e),r)}:t)},t.shuffle=function(t,e,r){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+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],a=new Array(r<0?0:r);e=0;)for(e=(n=t[a]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function x(t){for(var e=1;t*e%1;)e*=10;return e}function b(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){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,a=[],i=x(y(r)),o=-1;if(t*=i,e*=i,(r*=i)<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=a.length)return r?r.call(n,i):e?i.sort(e):i;for(var l,c,u,h,f=-1,p=i.length,d=a[s++],g=new _;++f=a.length)return e;var n=[],o=i[r++];return e.forEach((function(e,a){n.push({key:e,values:t(a,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 a.push(t),n},n.sortKeys=function(t){return i[a.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(j,"\\$&")};var j=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return U(t,Y),t}var q=function(t,e){return e.querySelector(t)},H=function(t,e){return e.querySelectorAll(t)},G=function(t,e){var r=t.matches||t[I(t,"matchesSelector")];return(G=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},H=Sizzle,G=Sizzle.matchesSelector),t.selection=function(){return t.select(a.documentElement)};var Y=t.selection.prototype=[];function W(t){return"function"==typeof t?t:function(){return q(t,this)}}function Z(t){return"function"==typeof t?t:function(){return H(t,this)}}Y.select=function(t){var e,r,n,a,i=[];t=W(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}},Y.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))},Y.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},Y.sort=function(t){t=ct.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=a+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=gt.get(e);function c(){var t=this[i];t&&(this.removeEventListener(e,t,t.$),delete this[i])}return l&&(e=l,s=vt),o?r?function(){var t=s(r,n(arguments));c.call(this),this.addEventListener(e,this[i]=t,t.$=a),t._=r}:c:r?O:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var a in this)if(r=a.match(n)){var i=this[a];this.removeEventListener(r[1],i,i.$),delete this[a]}}}t.selection.enter=ht,t.selection.enter.prototype=ft,ft.append=Y.append,ft.empty=Y.empty,ft.node=Y.node,ft.call=Y.call,ft.size=Y.size,ft.select=function(t){for(var e,r,n,a,i,o=[],s=-1,l=this.length;++s0?1:t<0?-1:0}function zt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Ot(t){return t>1?0:t<-1?At:Math.acos(t)}function Dt(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Rt(t){return((t=Math.exp(t))+1/t)/2}function Ft(t){return(t=Math.sin(t/2))*t}var Bt=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,a=t[0],i=t[1],o=t[2],s=e[0],l=e[1],c=e[2],u=s-a,h=l-i,f=u*u+h*h;if(f0&&(e=e.transition().duration(g)),e.call(w.event)}function S(){c&&c.domain(l.range().map((function(t){return(t-f.x)/f.k})).map(l.invert)),h&&h.domain(u.range().map((function(t){return(t-f.y)/f.k})).map(u.invert))}function E(t){m++||t({type:"zoomstart"})}function C(t){S(),t({type:"zoom",scale:f.k,translate:[f.x,f.y]})}function L(t){--m||(t({type:"zoomend"}),r=null)}function P(){var e=this,r=_.of(e,arguments),n=0,a=t.select(o(e)).on(y,l).on(x,c),i=T(t.mouse(e)),s=bt(e);function l(){n=1,M(t.mouse(e),i),C(r)}function c(){a.on(y,null).on(x,null),s(n),L(r)}vs.call(e),E(r)}function I(){var e,r=this,n=_.of(r,arguments),a={},i=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,c="touchend"+o,u=[],h=t.select(r),p=bt(r);function d(){var n=t.touches(r);return e=f.k,n.forEach((function(t){t.identifier in a&&(a[t.identifier]=T(t))})),n}function g(){var e=t.event.target;t.select(e).on(l,m).on(c,y),u.push(e);for(var n=t.event.changedTouches,o=0,h=n.length;o1){v=p[0];var x=p[1],b=v[0]-x[0],_=v[1]-x[1];i=b*b+_*_}}function m(){var o,l,c,u,h=t.touches(r);vs.call(r);for(var f=0,p=h.length;f360?t-=360:t<0&&(t+=360),t<60?n+(a-n)*t/60:t<180?a:t<240?n+(a-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)||e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(a=r<=.5?r*(1+e):r+e-r*e),new ne(i(t+120),i(t),i(t-120))}function Yt(e,r,n){return this instanceof Yt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Yt?new Yt(e.h,e.c,e.l):$t(e instanceof Xt?e.l:(e=ue((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Yt(e,r,n)}Ht.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new qt(this.h,this.s,this.l/t)},Ht.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new qt(this.h,this.s,t*this.l)},Ht.rgb=function(){return Gt(this.h,this.s,this.l)},t.hcl=Yt;var Wt=Yt.prototype=new Vt;function Zt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Xt(r,Math.cos(t*=Lt)*e,Math.sin(t)*e)}function Xt(t,e,r){return this instanceof Xt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Xt?new Xt(t.l,t.a,t.b):t instanceof Yt?Zt(t.h,t.c,t.l):ue((t=ne(t)).r,t.g,t.b):new Xt(t,e,r)}Wt.brighter=function(t){return new Yt(this.h,this.c,Math.min(100,this.l+Jt*(arguments.length?t:1)))},Wt.darker=function(t){return new Yt(this.h,this.c,Math.max(0,this.l-Jt*(arguments.length?t:1)))},Wt.rgb=function(){return Zt(this.h,this.c,this.l).rgb()},t.lab=Xt;var Jt=18,Kt=Xt.prototype=new Vt;function Qt(t,e,r){var n=(t+16)/116,a=n+e/500,i=n-r/200;return new ne(re(3.2404542*(a=.95047*te(a))-1.5371385*(n=1*te(n))-.4985314*(i=1.08883*te(i))),re(-.969266*a+1.8760108*n+.041556*i),re(.0556434*a-.2040259*n+1.0572252*i))}function $t(t,e,r){return t>0?new Yt(Math.atan2(r,e)*Pt,Math.sqrt(e*e+r*r),t):new Yt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,Gt):new ne(t,e,r)}function ae(t){return new ne(t>>16,t>>8&255,255&t)}function ie(t){return ae(t)+""}Kt.brighter=function(t){return new Xt(Math.min(100,this.l+Jt*(arguments.length?t:1)),this.a,this.b)},Kt.darker=function(t){return new Xt(Math.max(0,this.l-Jt*(arguments.length?t:1)),this.a,this.b)},Kt.rgb=function(){return Qt(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(t,e,r){var n,a,i,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(a=n[2].split(","),n[1]){case"hsl":return r(parseFloat(a[0]),parseFloat(a[1])/100,parseFloat(a[2])/100);case"rgb":return e(fe(a[0]),fe(a[1]),fe(a[2]))}return(i=pe.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,s=240&i,s|=s>>4,l=15&i,l|=l<<4):7===t.length&&(o=(16711680&i)>>16,s=(65280&i)>>8,l=255&i)),e(o,s,l))}function ce(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-i,l=(o+i)/2;return s?(a=l<.5?s/(o+i):s/(2-o-i),n=t==o?(e-r)/s+(e0&&l<1?0:n),new qt(n,a,l)}function ue(t,e,r){var n=ee((.4124564*(t=he(t))+.3575761*(e=he(e))+.1804375*(r=he(r)))/.95047),a=ee((.2126729*t+.7151522*e+.072175*r)/1);return Xt(116*a-16,500*(n-a),200*(a-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function he(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fe(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,a=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=a.call(o,c)}catch(t){return void s.error.call(o,t)}s.load.call(o,t)}else s.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(e)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=h:c.onreadystatechange=function(){c.readyState>3&&h()},c.onprogress=function(e){var r=t.event;t.event=e;try{s.progress.call(o,c)}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?(u=t,o):u},o.response=function(t){return a=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}})),o.send=function(t,n,a){if(2===arguments.length&&"function"==typeof n&&(a=n,n=null),c.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),c.setRequestHeader)for(var i in l)c.setRequestHeader(i,l[i]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=a&&o.on("error",a).on("load",(function(t){a(null,t)})),s.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},t.rebind(o,s,"on"),null==i?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(i))}pe.forEach((function(t,e){pe.set(t,ae(e))})),t.functor=de,t.xhr=ge(L),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function a(t,r,n){arguments.length<3&&(n=r,r=null);var a=me(t,e,null==r?i:o(r),n);return a.row=function(t){return arguments.length?a.response(null==(r=t)?i:o(t)):r},a}function i(t){return a.parse(t.responseText)}function o(t){return function(e){return a.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 a.parse=function(t,e){var r;return a.parseRows(t,(function(t,n){if(r)return r(t,n-1);var a=new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+"]"})).join(",")+"}");r=e?function(t,r){return e(a(t),r)}:a}))},a.parseRows=function(t,e){var r,a,i={},o={},s=[],l=t.length,c=0,u=0;function h(){if(c>=l)return o;if(a)return a=!1,i;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(be),be=setTimeout(Te,e)),xe=0):(xe=1,_e(Te))}function ke(){for(var t=Date.now(),e=ve;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Me(){for(var t,e=ve,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Ee(e){var r=e.decimal,n=e.thousands,a=e.grouping,i=e.currency,o=a&&n?function(t,e){for(var r=t.length,i=[],o=0,s=a[0],l=0;r>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),i.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=a[o=(o+1)%a.length];return i.reverse().join(n)}:L;return function(e){var n=Ce.exec(e),a=n[1]||" ",s=n[2]||">",l=n[3]||"-",c=n[4]||"",u=n[5],h=+n[6],f=n[7],p=n[8],d=n[9],g=1,m="",v="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===a&&"="===s)&&(u=a="0",s="="),d){case"n":f=!0,d="g";break;case"%":g=100,v="%",d="f";break;case"p":g=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===c&&(m="0"+d.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,d="r"}"$"===c&&(m=i[0],v=i[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=Le.get(d)||Pe;var b=u&&f;return function(e){var n=v;if(y&&e%1)return"";var i=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(g<0){var c=t.formatPrefix(e,p);e=c.scale(e),n=c.symbol+v}else e*=g;var _,w,T=(e=d(e,p)).lastIndexOf(".");if(T<0){var k=x?e.lastIndexOf("e"):-1;k<0?(_=e,w=""):(_=e.substring(0,k),w=e.substring(k))}else _=e.substring(0,T),w=r+e.substring(T+1);!u&&f&&(_=o(_,1/0));var M=m.length+_.length+w.length+(b?0:i.length),A=M"===s?A+i+e:"^"===s?A.substring(0,M>>=1)+i+e+A.substring(M):i+(b?e:A+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Ae(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,Le=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,Ae(e,r))).toFixed(Math.max(0,Math.min(20,Ae(e*(1+1e-15),r))))}});function Pe(t){return t+""}var Ie=t.time={},ze=Date;function Oe(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Oe.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(){De.setUTCDate.apply(this._,arguments)},setDay:function(){De.setUTCDay.apply(this._,arguments)},setFullYear:function(){De.setUTCFullYear.apply(this._,arguments)},setHours:function(){De.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){De.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){De.setUTCMinutes.apply(this._,arguments)},setMonth:function(){De.setUTCMonth.apply(this._,arguments)},setSeconds:function(){De.setUTCSeconds.apply(this._,arguments)},setTime:function(){De.setTime.apply(this._,arguments)}};var De=Date.prototype;function Re(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=c)return-1;if(37===(a=e.charCodeAt(s++))){if(o=e.charAt(s++),!(i=w[o in Ne?e.charAt(s++):o])||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++))return-1}return n}u.utc=function(t){var e=u(t);function r(t){try{var r=new(ze=Oe);return r._=t,e(r)}finally{ze=Date}}return r.parse=function(t){try{ze=Oe;var r=e.parse(t);return r&&r._}finally{ze=Date}},r.toString=e.toString,r},u.multi=u.utc.multi=or;var f=t.map(),p=qe(o),d=He(o),g=qe(s),m=He(s),v=qe(l),y=He(l),x=qe(c),b=He(c);i.forEach((function(t,e){f.set(t.toLowerCase(),e)}));var _={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:u(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+Ie.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 i[+(t.getHours()>=12)]},S:function(t,e){return Ve(t.getSeconds(),e,2)},U:function(t,e){return Ve(Ie.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ve(Ie.mondayOfYear(t),e,2)},x:u(n),X:u(a),y:function(t,e){return Ve(t.getFullYear()%100,e,2)},Y:function(t,e){return Ve(t.getFullYear()%1e4,e,4)},Z:ar,"%":function(){return"%"}},w={a:function(t,e,r){g.lastIndex=0;var n=g.exec(e.slice(r));return n?(t.w=m.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){v.lastIndex=0;var n=v.exec(e.slice(r));return n?(t.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,r){return h(t,_.c.toString(),e,r)},d:Qe,e:Qe,H:tr,I:tr,j:$e,L:nr,m:Ke,M:er,p:function(t,e,r){var n=f.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:Ye,w:Ge,W:We,x:function(t,e,r){return h(t,_.x.toString(),e,r)},X:function(t,e,r){return h(t,_.X.toString(),e,r)},y:Xe,Y:Ze,Z:Je,"%":ir};return u}Ie.year=Re((function(t){return(t=Ie.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),Ie.years=Ie.year.range,Ie.years.utc=Ie.year.utc.range,Ie.day=Re((function(t){var e=new ze(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),Ie.days=Ie.day.range,Ie.days.utc=Ie.day.utc.range,Ie.dayOfYear=function(t){var e=Ie.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=Ie[t]=Re((function(t){return(t=Ie.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=Ie.year(t).getDay();return Math.floor((Ie.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));Ie[t+"s"]=r.range,Ie[t+"s"].utc=r.utc.range,Ie[t+"OfYear"]=function(t){var r=Ie.year(t).getDay();return Math.floor((Ie.dayOfYear(t)+(r+e)%7)/7)}})),Ie.week=Ie.sunday,Ie.weeks=Ie.sunday.range,Ie.weeks.utc=Ie.sunday.utc.range,Ie.weekOfYear=Ie.sundayOfYear;var Ne={"-":"",_:" ",0:"0"},je=/^\s*\d+/,Ue=/^%/;function Ve(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3),r+a[0].length):-1}function Je(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Ke(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Qe(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function $e(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ar(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,a=y(e)%60;return r+Ve(n,"0",2)+Ve(a,"0",2)}function ir(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;++r=0?1:-1,s=o*i,l=Math.cos(e),c=Math.sin(e),u=a*c,h=n*l+u*Math.cos(s),f=u*o*Math.sin(s);Er.add(Math.atan2(f,h)),r=t,n=l,a=c}Cr.point=function(o,s){Cr.point=i,r=(t=o)*Lt,n=Math.cos(s=(e=s)*Lt/2+At/4),a=Math.sin(s)},Cr.lineEnd=function(){i(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 Ir(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function zr(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 Or(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Dr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Rr(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 Fr(t){return[Math.atan2(t[1],t[0]),Dt(t[2])]}function Br(t,e){return y(t[0]-e[0])kt?a=90:c<-kt&&(r=-90),h[0]=e,h[1]=n}};function p(t,i){u.push(h=[e=t,n=t]),ia&&(a=i)}function d(t,o){var s=Pr([t*Lt,o*Lt]);if(l){var c=zr(l,s),u=zr([c[1],-c[0],0],c);Rr(u),u=Fr(u);var h=t-i,f=h>0?1:-1,d=u[0]*Pt*f,g=y(h)>180;if(g^(f*ia&&(a=m);else if(g^(f*i<(d=(d+360)%360-180)&&da&&(a=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>i?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else p(t,o);l=s,i=t}function g(){f.point=d}function m(){h[0]=e,h[1]=n,f.point=p,l=null}function v(t,e){if(l){var r=t-i;c+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Cr.point(t,e),d(t,e)}function x(){Cr.lineStart()}function b(){v(o,s),Cr.lineEnd(),y(c)>kt&&(e=-(n=180)),h[0]=e,h[1]=n,l=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function T(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):s.push(g=p);for(var l,c,p,d=-1/0,g=(o=0,s[c=s.length-1]);o<=c;g=p,++o)p=s[o],(l=_(g[1],p[0]))>d&&(d=l,e=p[0],n=g[1])}return u=h=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,a]]}}(),t.geo.centroid=function(e){vr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Sr=0,t.geo.stream(e,Nr);var r=Mr,n=Ar,a=Sr,i=r*r+n*n+a*a;return i=0;--s)a.point((h=u[s])[0],h[1]);else n(p.x,p.p.x,-1,a);p=p.p}u=(p=p.o).z,d=!d}while(!p.v);a.lineEnd()}}}function Zr(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n=0?1:-1,T=w*_,k=T>At,M=d*x;if(Er.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),i+=k?_+w*St:_,k^f>=r^v>=r){var A=zr(Pr(h),Pr(t));Rr(A);var S=zr(a,A);Rr(S);var E=(k^_>=0?-1:1)*Dt(S[2]);(n>E||n===E&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!m++)break;f=v,d=x,g=b,h=t}}return(i<-kt||i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++i1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter(Kr))}return u}}function Kr(t){return t.length>1}function Qr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:O,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]-Ct-kt:Ct-t[1])-((e=e.x)[0]<0?e[1]-Ct-kt:Ct-e[1])}var tn=Jr(Yr,(function(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var s=i>0?At:-At,l=y(i-r);y(l-At)0?Ct:-Ct),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(i,n),e=0):a!==s&&l>=At&&(y(r-a)kt?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}(r,n,i,o),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=i,n=o),a=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var a;if(null==t)a=r*Ct,n.point(-At,a),n.point(0,a),n.point(At,a),n.point(At,0),n.point(At,-a),n.point(0,-a),n.point(-At,-a),n.point(-At,0),n.point(-At,a);else if(y(t[0]-e[0])>kt){var i=t[0]0,n=y(e)>kt;return Jr(a,(function(t){var e,s,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,f){var p,d=[h,f],g=a(h,f),m=r?g?0:o(h,f):g?o(h+(h<0?At:-At),f):0;if(!e&&(c=l=g)&&t.lineStart(),g!==l&&(p=i(e,d),(Br(e,p)||Br(d,p))&&(d[0]+=kt,d[1]+=kt,g=a(d[0],d[1]))),g!==l)u=0,g?(t.lineStart(),p=i(d,e),t.point(p[0],p[1])):(p=i(e,d),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(n&&e&&r^g){var v;m&s||!(v=i(d,e,!0))||(u=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!g||e&&Br(e,d)||t.point(d[0],d[1]),e=d,l=g,s=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}}),Bn(t,6*Lt),r?[0,-t]:[-At,t-At]);function a(t,r){return Math.cos(t)*Math.cos(r)>e}function i(t,r,n){var a=[1,0,0],i=zr(Pr(t),Pr(r)),o=Ir(i,i),s=i[0],l=o-s*s;if(!l)return!n&&t;var c=e*o/l,u=-e*s/l,h=zr(a,i),f=Dr(a,c);Or(f,Dr(i,u));var p=h,d=Ir(f,p),g=Ir(p,p),m=d*d-g*(Ir(f,f)-1);if(!(m<0)){var v=Math.sqrt(m),x=Dr(p,(-d-v)/g);if(Or(x,f),x=Fr(x),!n)return x;var b,_=t[0],w=r[0],T=t[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-At)0^x[1]<(y(x[0]-_)At^(_<=x[0]&&x[0]<=w)){var S=Dr(p,(-d+v)/g);return Or(S,f),[x,Fr(S)]}}}function o(e,n){var a=r?t:At-t,i=0;return e<-a?i|=1:e>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}}function rn(t,e,r,n){return function(a){var i,o=a.a,s=a.b,l=o.x,c=o.y,u=0,h=1,f=s.x-l,p=s.y-c;if(i=t-l,f||!(i>0)){if(i/=f,f<0){if(i0){if(i>h)return;i>u&&(u=i)}if(i=r-l,f||!(i<0)){if(i/=f,f<0){if(i>h)return;i>u&&(u=i)}else if(f>0){if(i0)){if(i/=p,p<0){if(i0){if(i>h)return;i>u&&(u=i)}if(i=n-c,p||!(i<0)){if(i/=p,p<0){if(i>h)return;i>u&&(u=i)}else if(p>0){if(i0&&(a.a={x:l+u*f,y:c+u*p}),h<1&&(a.b={x:l+h*f,y:c+h*p}),a}}}}}}function nn(e,r,n,a){return function(l){var c,u,h,f,p,d,g,m,v,y,x,b=l,_=Qr(),w=rn(e,r,n,a),T={point:A,lineStart:function(){T.point=S,u&&u.push(h=[]);y=!0,v=!1,g=m=NaN},lineEnd:function(){c&&(S(f,p),d&&v&&_.rejoin(),c.push(_.buffer()));T.point=A,v&&l.lineEnd()},polygonStart:function(){l=_,c=[],u=[],x=!0},polygonEnd:function(){l=b,c=t.merge(c);var r=function(t){for(var e=0,r=u.length,n=t[1],a=0;an&&zt(c,i,t)>0&&++e:i[1]<=n&&zt(c,i,t)<0&&--e,c=i;return 0!==e}([e,a]),n=x&&r,i=c.length;(n||i)&&(l.polygonStart(),n&&(l.lineStart(),k(null,null,1,l),l.lineEnd()),i&&Wr(c,o,r,k,l),l.polygonEnd()),c=u=h=null}};function k(t,o,l,c){var u=0,h=0;if(null==t||(u=i(t,l))!==(h=i(o,l))||s(t,o)<0^l>0)do{c.point(0===u||3===u?e:n,u>1?a:r)}while((u=(u+l+4)%4)!==h);else c.point(o[0],o[1])}function M(t,i){return e<=t&&t<=n&&r<=i&&i<=a}function A(t,e){M(t,e)&&l.point(t,e)}function S(t,e){var r=M(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(u&&h.push([t,e]),y)f=t,p=e,d=r,y=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&v)l.point(t,e);else{var n={a:{x:g,y:m},b:{x:t,y:e}};w(n)?(v||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),x=!1):r&&(l.lineStart(),l.point(t,e),x=!1)}g=t,m=e,v=r}return T};function i(t,a){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:a>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=i(t,1),n=i(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=At/3,n=Ln(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*At/180,r=t[1]*At/180):[e/At*180,r/At*180]},a}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(t,e){var r=Math.sqrt(a-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),i-r*Math.cos(t)]}return o.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/n,Dt((a-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,a,i,o={stream:function(t){return a&&(a.valid=!1),(a=i(t)).valid=!0,a},extent:function(s){return arguments.length?(i=nn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),a&&(a.valid=!1,a=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,a,i=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 c(t){var i=t[0],o=t[1];return e=null,r(i,o),e||(n(i,o),e)||a(i,o),e}return c.invert=function(t){var e=i.scale(),r=i.translate(),n=(t[0]-r[0])/e,a=(t[1]-r[1])/e;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?s:i).invert(t)},c.stream=function(t){var e=i.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,a){e.point(t,a),r.point(t,a),n.point(t,a)},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()}}},c.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),s.precision(t),c):i.precision()},c.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),s.scale(t),c.translate(i.translate())):i.scale()},c.translate=function(t){if(!arguments.length)return i.translate();var e=i.scale(),u=+t[0],h=+t[1];return r=i.translate(t).clipExtent([[u-.455*e,h-.238*e],[u+.455*e,h+.238*e]]).stream(l).point,n=o.translate([u-.307*e,h+.201*e]).clipExtent([[u-.425*e+kt,h+.12*e+kt],[u-.214*e-kt,h+.234*e-kt]]).stream(l).point,a=s.translate([u-.205*e,h+.212*e]).clipExtent([[u-.214*e+kt,h+.166*e+kt],[u-.115*e-kt,h+.234*e-kt]]).stream(l).point,c},c.scale(1070)};var sn,ln,cn,un,hn,fn,pn={point:O,lineStart:O,lineEnd:O,polygonStart:function(){ln=0,pn.lineStart=dn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=O,sn+=y(ln/2)}};function dn(){var t,e,r,n;function a(t,e){ln+=n*t-r*e,r=t,n=e}pn.point=function(i,o){pn.point=a,t=r=i,e=n=o},pn.lineEnd=function(){a(t,e)}}var gn={point:function(t,e){thn&&(hn=t);efn&&(fn=e)},lineStart:O,lineEnd:O,polygonStart:O,polygonEnd:O};function mn(){var t=vn(4.5),e=[],r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=vn(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 a(t,n){e.push("M",t,",",n),r.point=i}function i(t,r){e.push("L",t,",",r)}function o(){r.point=n}function s(){e.push("Z")}return r}function vn(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,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(t,e){xr+=t,br+=e,++_r}function _n(){var t,e;function r(r,n){var a=r-t,i=n-e,o=Math.sqrt(a*a+i*i);wr+=o*(t+r)/2,Tr+=o*(e+n)/2,kr+=o,bn(t=r,e=n)}xn.point=function(n,a){xn.point=r,bn(t=n,e=a)}}function wn(){xn.point=bn}function Tn(){var t,e,r,n;function a(t,e){var a=t-r,i=e-n,o=Math.sqrt(a*a+i*i);wr+=o*(r+t)/2,Tr+=o*(n+e)/2,kr+=o,Mr+=(o=n*t-r*e)*(r+t),Ar+=o*(n+e),Sr+=3*o,bn(r=t,n=e)}xn.point=function(i,o){xn.point=a,bn(t=r=i,e=n=o)},xn.lineEnd=function(){a(t,e)}}function kn(t){var e=4.5,r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=t,r},result:O};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,St)}function a(e,n){t.moveTo(e,n),r.point=i}function i(e,r){t.lineTo(e,r)}function o(){r.point=n}function s(){t.closePath()}return r}function Mn(t){var e=.5,r=Math.cos(30*Lt),n=16;function a(t){return(n?o:i)(t)}function i(e){return En(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,a,i,o,l,c,u,h,f,p,d,g,m={point:v,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),m.lineStart=_},polygonEnd:function(){e.polygonEnd(),m.lineStart=y}};function v(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){h=NaN,m.point=x,e.lineStart()}function x(r,a){var i=Pr([r,a]),o=t(r,a);s(h,f,u,p,d,g,h=o[0],f=o[1],u=r,p=i[0],d=i[1],g=i[2],n,e),e.point(h,f)}function b(){m.point=v,e.lineEnd()}function _(){y(),m.point=w,m.lineEnd=T}function w(t,e){x(r=t,e),a=h,i=f,o=p,l=d,c=g,m.point=x}function T(){s(h,f,u,p,d,g,a,i,r,o,l,c,n,e),m.lineEnd=b,b()}return m}function s(n,a,i,o,l,c,u,h,f,p,d,g,m,v){var x=u-n,b=h-a,_=x*x+b*b;if(_>4*e&&m--){var w=o+p,T=l+d,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),S=y(y(k)-1)e||y((x*P+b*I)/_-.5)>.3||o*p+l*d+c*g0&&16,a):Math.sqrt(e)},a}function An(t){var e=Mn((function(e,r){return t([e*Pt,r*Pt])}));return function(t){return Pn(e(t))}}function Sn(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 Cn(t){return Ln((function(){return t}))()}function Ln(e){var r,n,a,i,o,s,l=Mn((function(t,e){return[(t=r(t,e))[0]*c+i,o-t[1]*c]})),c=150,u=480,h=250,f=0,p=0,d=0,g=0,m=0,v=tn,y=L,x=null,b=null;function _(t){return[(t=a(t[0]*Lt,t[1]*Lt))[0]*c+i,o-t[1]*c]}function w(t){return(t=a.invert((t[0]-i)/c,(o-t[1])/c))&&[t[0]*Pt,t[1]*Pt]}function T(){a=Gr(n=On(d,g,m),r);var t=r(f,p);return i=u-t[0]*c,o=h+t[1]*c,k()}function k(){return s&&(s.valid=!1,s=null),_}return _.stream=function(t){return s&&(s.valid=!1),(s=Pn(v(n,l(y(t))))).valid=!0,s},_.clipAngle=function(t){return arguments.length?(v=null==t?(x=t,tn):en((x=+t)*Lt),k()):x},_.clipExtent=function(t){return arguments.length?(b=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):L,k()):b},_.scale=function(t){return arguments.length?(c=+t,T()):c},_.translate=function(t){return arguments.length?(u=+t[0],h=+t[1],T()):[u,h]},_.center=function(t){return arguments.length?(f=t[0]%360*Lt,p=t[1]%360*Lt,T()):[f*Pt,p*Pt]},_.rotate=function(t){return arguments.length?(d=t[0]%360*Lt,g=t[1]%360*Lt,m=t.length>2?t[2]%360*Lt:0,T()):[d*Pt,g*Pt,m*Pt]},t.rebind(_,l,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,T()}}function Pn(t){return En(t,(function(e,r){t.point(e*Lt,r*Lt)}))}function In(t,e){return[t,e]}function zn(t,e){return[t>At?t-St:t<-At?t+St:t,e]}function On(t,e,r){return t?e||r?Gr(Rn(t),Fn(e,r)):Rn(t):e||r?Fn(e,r):zn}function Dn(t){return function(e,r){return[(e+=t)>At?e-St:e<-At?e+St:e,r]}}function Rn(t){var e=Dn(t);return e.invert=Dn(-t),e}function Fn(t,e){var r=Math.cos(t),n=Math.sin(t),a=Math.cos(e),i=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,c=Math.sin(e),u=c*r+s*n;return[Math.atan2(l*a-u*i,s*r-c*n),Dt(u*a+l*i)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,c=Math.sin(e),u=c*a-l*i;return[Math.atan2(l*a+c*i,s*r+u*n),Dt(u*r-s*n)]},o}function Bn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,s){var l=o*e;null!=a?(a=Nn(r,a),i=Nn(r,i),(o>0?ai)&&(a+=o*St)):(a=t+o*St,i=t-.5*l);for(var c,u=a;o>0?u>i:u2?t[2]*Lt:0),e.invert=function(e){return(e=t.invert(e[0]*Lt,e[1]*Lt))[0]*=Pt,e[1]*=Pt,e},e},zn.invert=In,t.geo.circle=function(){var t,e,r=[0,0],n=6;function a(){var t="function"==typeof r?r.apply(this,arguments):r,n=On(-t[0]*Lt,-t[1]*Lt,0).invert,a=[];return e(null,null,1,{point:function(t,e){a.push(t=n(t,e)),t[0]*=Pt,t[1]*=Pt}}),{type:"Polygon",coordinates:[a]}}return a.origin=function(t){return arguments.length?(r=t,a):r},a.angle=function(r){return arguments.length?(e=Bn((t=+r)*Lt,n*Lt),a):t},a.precision=function(r){return arguments.length?(e=Bn(t*Lt,(n=+r)*Lt),a):n},a.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Lt,a=t[1]*Lt,i=e[1]*Lt,o=Math.sin(n),s=Math.cos(n),l=Math.sin(a),c=Math.cos(a),u=Math.sin(i),h=Math.cos(i);return Math.atan2(Math.sqrt((r=h*o)*r+(r=c*u-l*h*s)*r),l*u+c*h*s)},t.geo.graticule=function(){var e,r,n,a,i,o,s,l,c,u,h,f,p=10,d=p,g=90,m=360,v=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return t.range(Math.ceil(a/g)*g,n,g).map(h).concat(t.range(Math.ceil(l/m)*m,s,m).map(f)).concat(t.range(Math.ceil(r/p)*p,e,p).filter((function(t){return y(t%g)>kt})).map(c)).concat(t.range(Math.ceil(o/d)*d,i,d).filter((function(t){return y(t%m)>kt})).map(u))}return x.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},x.outline=function(){return{type:"Polygon",coordinates:[h(a).concat(f(s).slice(1),h(n).reverse().slice(1),f(l).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(a=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],a>n&&(t=a,a=n,n=t),l>s&&(t=l,l=s,s=t),x.precision(v)):[[a,l],[n,s]]},x.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],i=+t[1][1],r>e&&(t=r,r=e,e=t),o>i&&(t=o,o=i,i=t),x.precision(v)):[[r,o],[e,i]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(g=+t[0],m=+t[1],x):[g,m]},x.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],x):[p,d]},x.precision=function(t){return arguments.length?(v=+t,c=jn(o,i,90),u=Un(r,e,v),h=jn(l,s,90),f=Un(a,n,v),x):v},x.majorExtent([[-180,-90+kt],[180,90-kt]]).minorExtent([[-180,-80-kt],[180,80+kt]])},t.geo.greatArc=function(){var e,r,n=Vn,a=qn;function i(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}return i.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||a.apply(this,arguments))},i.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,i):n},i.target=function(t){return arguments.length?(a=t,r="function"==typeof t?null:t,i):a},i.precision=function(){return arguments.length?i:0},i},t.geo.interpolate=function(t,e){return r=t[0]*Lt,n=t[1]*Lt,a=e[0]*Lt,i=e[1]*Lt,o=Math.cos(n),s=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=o*Math.cos(r),h=o*Math.sin(r),f=l*Math.cos(a),p=l*Math.sin(a),d=2*Math.asin(Math.sqrt(Ft(i-n)+o*l*Ft(a-r))),g=1/Math.sin(d),(m=d?function(t){var e=Math.sin(t*=d)*g,r=Math.sin(d-t)*g,n=r*u+e*f,a=r*h+e*p,i=r*s+e*c;return[Math.atan2(a,n)*Pt,Math.atan2(i,Math.sqrt(n*n+a*a))*Pt]}:function(){return[r*Pt,n*Pt]}).distance=d,m;var r,n,a,i,o,s,l,c,u,h,f,p,d,g,m},t.geo.length=function(e){return yn=0,t.geo.stream(e,Hn),yn};var Hn={sphere:O,point:O,lineStart:function(){var t,e,r;function n(n,a){var i=Math.sin(a*=Lt),o=Math.cos(a),s=y((n*=Lt)-t),l=Math.cos(s);yn+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*i-e*o*l)*s),e*i+r*o*l),t=n,e=i,r=o}Hn.point=function(a,i){t=a*Lt,e=Math.sin(i*=Lt),r=Math.cos(i),Hn.point=n},Hn.lineEnd=function(){Hn.point=Hn.lineEnd=O}},lineEnd:O,polygonStart:O,polygonEnd:O};function Gn(t,e){function r(e,r){var n=Math.cos(e),a=Math.cos(r),i=t(n*a);return[i*a*Math.sin(e),i*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),a=e(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(t*i,n*o),Math.asin(n&&r*i/n)]},r}var Yn=Gn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Cn(Yn)}).raw=Yn;var Wn=Gn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),L);function Zn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(At/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),i=r*Math.pow(n(t),a)/a;if(!a)return Kn;function o(t,e){i>0?e<-Ct+kt&&(e=-Ct+kt):e>Ct-kt&&(e=Ct-kt);var r=i/Math.pow(n(e),a);return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}return o.invert=function(t,e){var r=i-e,n=It(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(i/n,1/a))-Ct]},o}function Xn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/n+t;if(y(n)1&&zt(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function ia(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Cn(ta)}).raw=ta,ea.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=Qn(ea),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=ea,t.geom={},t.geom.hull=function(t){var e=ra,r=na;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,a=de(e),i=de(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)p.push(t[s[c[n]][2]]);for(n=+h;nkt)s=s.L;else{if(!((a=i-Ta(s,o))>kt)){n>-kt?(e=s.P,r=s):a>-kt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=ya(t);if(fa.insert(e,l),e||r){if(e===r)return Ea(e),r=ya(e.site),fa.insert(l,r),l.edge=r.edge=Pa(e.site,l.site),Sa(e),void Sa(r);if(r){Ea(e),Ea(r);var c=e.site,u=c.x,h=c.y,f=t.x-u,p=t.y-h,d=r.site,g=d.x-u,m=d.y-h,v=2*(f*m-p*g),y=f*f+p*p,x=g*g+m*m,b={x:(m*y-p*x)/v+u,y:(f*x-g*y)/v+h};za(r.edge,c,d,b),l.edge=Pa(c,t,null,b),r.edge=Pa(t,d,null,b),Sa(e),Sa(r)}else l.edge=Pa(e.site,l.site)}}function wa(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)return n;var o=t.P;if(!o)return-1/0;var s=(r=o.site).x,l=r.y,c=l-e;if(!c)return s;var u=s-n,h=1/i-1/c,f=u/c;return h?(-f+Math.sqrt(f*f-2*h*(u*u/(-2*c)-l+c/2+a-i/2)))/h+n:(n+s)/2}function Ta(t,e){var r=t.N;if(r)return wa(r,e);var n=t.site;return n.y===e?n.x:1/0}function ka(t){this.site=t,this.edges=[]}function Ma(t,e){return e.angle-t.angle}function Aa(){Ra(this),this.x=this.y=this.arc=this.site=this.cy=null}function Sa(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,a=t.site,i=r.site;if(n!==i){var o=a.x,s=a.y,l=n.x-o,c=n.y-s,u=i.x-o,h=2*(l*(m=i.y-s)-c*u);if(!(h>=-Mt)){var f=l*l+c*c,p=u*u+m*m,d=(m*f-c*p)/h,g=(l*p-u*f)/h,m=g+s,v=ma.pop()||new Aa;v.arc=t,v.site=a,v.x=d+o,v.y=m+Math.sqrt(d*d+g*g),v.cy=m,t.circle=v;for(var y=null,x=da._;x;)if(v.y=s)return;if(f>d){if(i){if(i.y>=c)return}else i={x:m,y:l};r={x:m,y:c}}else{if(i){if(i.y1)if(f>d){if(i){if(i.y>=c)return}else i={x:(l-a)/n,y:l};r={x:(c-a)/n,y:c}}else{if(i){if(i.y=s)return}else i={x:o,y:n*o+a};r={x:s,y:n*s+a}}else{if(i){if(i.xkt||y(a-r)>kt)&&(s.splice(o,0,new Oa(Ia(i.site,u,y(n-h)kt?{x:h,y:y(e-h)kt?{x:y(r-d)kt?{x:f,y:y(e-f)kt?{x:y(r-p)=r&&c.x<=a&&c.y>=n&&c.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[]).point=t[s]})),e}function s(t){return t.map((function(t,e){return{x:Math.round(n(t,e)/kt)*kt,y:Math.round(a(t,e)/kt)*kt,i:e}}))}return o.links=function(t){return ja(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 ja(s(t)).cells.forEach((function(r,n){for(var a,i,o,s,l=r.site,c=r.edges.sort(Ma),u=-1,h=c.length,f=c[h-1].edge,p=f.l===l?f.r:f.l;++ui||h>o||f=_)<<1|e>=b,T=w+4;wi&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:Xa(r,n)})),i=Qa.lastIndex;return ig&&(g=l.x),l.y>m&&(m=l.y),c.push(l.x),u.push(l.y);else for(h=0;hg&&(g=b),_>m&&(m=_),c.push(b),u.push(_)}var w=g-p,T=m-d;function k(t,e,r,n,a,i,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(y(l-r)+y(c-n)<.01)M(t,e,r,n,a,i,o,s);else{var u=t.point;t.x=t.y=t.point=null,M(t,u,l,c,a,i,o,s),M(t,e,r,n,a,i,o,s)}else t.x=r,t.y=n,t.point=e}else M(t,e,r,n,a,i,o,s)}function M(t,e,r,n,a,i,o,s){var l=.5*(a+o),c=.5*(i+s),u=r>=l,h=n>=c,f=h<<1|u;t.leaf=!1,u?a=l:o=l,h?i=c:s=c,k(t=t.nodes[f]||(t.nodes[f]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,a,i,o,s)}w>T?m=d+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(A,t,+v(t,++h),+x(t,h),p,d,g,m)},visit:function(t){Ga(t,A,p,d,g,m)},find:function(t){return Ya(A,t[0],t[1],p,d,g,m)}};if(h=-1,null==e){for(;++h=0&&!(n=t.interpolators[a](e,r)););return n}function ti(t,e){var r,n=[],a=[],i=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function ii(t){return function(e){return 1-t(1-e)}}function oi(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function si(t){return t*t}function li(t){return t*t*t}function ci(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ui(t){return 1-Math.cos(t*Ct)}function hi(t){return Math.pow(2,10*(t-1))}function fi(t){return 1-Math.sqrt(1-t*t)}function pi(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 di(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function gi(t){var e,r,n,a=[t.a,t.b],i=[t.c,t.d],o=vi(a),s=mi(a,i),l=vi(((e=i)[0]+=(n=-s)*(r=a)[0],e[1]+=n*r[1],e))||0;a[0]*i[1]=0?t.slice(0,e):t,a=e>=0?t.slice(e+1):"in";return n=ri.get(n)||ei,ai((a=ni.get(a)||L)(n.apply(null,r.call(arguments,1))))},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,a=e.c,i=e.l,o=r.h-n,s=r.c-a,l=r.l-i;isNaN(s)&&(s=0,a=isNaN(a)?r.c:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Zt(n+o*t,a+s*t,i+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,a=e.s,i=e.l,o=r.h-n,s=r.s-a,l=r.l-i;isNaN(s)&&(s=0,a=isNaN(a)?r.s:a);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Gt(n+o*t,a+s*t,i+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,a=e.a,i=e.b,o=r.l-n,s=r.a-a,l=r.b-i;return function(t){return Qt(n+o*t,a+s*t,i+l*t)+""}},t.interpolateRound=di,t.transform=function(e){var r=a.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 gi(e?e.matrix:yi)})(e)},gi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yi={a:1,b:0,c:0,d:1,e:0,f:0};function xi(t){return t.length?t.pop()+",":""}function bi(e,r){var n=[],a=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push("translate(",null,",",null,")");n.push({i:a-4,x:Xa(t[0],e[0])},{i:a-2,x:Xa(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,a),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(xi(r)+"rotate(",null,")")-2,x:Xa(t,e)})):e&&r.push(xi(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,a),function(t,e,r,n){t!==e?n.push({i:r.push(xi(r)+"skewX(",null,")")-2,x:Xa(t,e)}):e&&r.push(xi(r)+"skewX("+e+")")}(e.skew,r.skew,n,a),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(xi(r)+"scale(",null,",",null,")");n.push({i:a-4,x:Xa(t[0],e[0])},{i:a-2,x:Xa(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(xi(r)+"scale("+e+")")}(e.scale,r.scale,n,a),e=r=null,function(t){for(var e,r=-1,i=a.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=we(s.tick)),s):n},s.start=function(){var t,e,r,n=v.length,l=y.length,u=c[0],d=c[1];for(t=0;t=0;)r.push(a[n])}function Oi(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++o=0;)o.push(u=c[l]),u.parent=i,u.depth=i.depth+1;r&&(i.value=0),i.children=c}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Oi(a,(function(e){var n,a;t&&(n=e.children)&&n.sort(t),r&&(a=e.parent)&&(a.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&&(zi(t,(function(t){t.children&&(t.value=0)})),Oi(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 a=e.call(this,t,n);return function t(e,r,n,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.length)){var o,s,l,c=-1;for(n=e.value?n/e.value:0;++cs&&(s=n),o.push(n)}for(r=0;ra&&(n=r,a=e);return n}function Zi(t){return t.reduce(Xi,0)}function Xi(t,e){return t+e[1]}function Ji(t,e){return Ki(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ki(t,e){for(var r=-1,n=+t[0],a=(t[1]-n)/e,i=[];++r<=e;)i[r]=a*r+n;return i}function Qi(e){return[t.min(e),t.max(e)]}function $i(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(t,e){var r=e.x-t.x,n=e.y-t.y,a=t.r+e.r;return.999*a*a>r*r+n*n}function no(t){if((e=t.children)&&(l=e.length)){var e,r,n,a,i,o,s,l,c=1/0,u=-1/0,h=1/0,f=-1/0;if(e.forEach(ao),(r=e[0]).x=-r.r,r.y=0,x(r),l>1&&((n=e[1]).x=n.r,n.y=0,x(n),l>2))for(oo(r,n,a=e[2]),x(a),to(r,a),r._pack_prev=a,to(a,n),n=r._pack_next,i=3;i0)for(o=-1;++o=h[0]&&l<=h[1]&&((s=c[t.bisect(f,l,1,d)-1]).y+=g,s.push(i[o]));return c}return i.value=function(t){return arguments.length?(r=t,i):r},i.range=function(t){return arguments.length?(n=de(t),i):n},i.bins=function(t){return arguments.length?(a="number"==typeof t?function(e){return Ki(e,t)}:de(t),i):a},i.frequency=function(t){return arguments.length?(e=!!t,i):e},i},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort($i),n=0,a=[1,1];function i(t,i){var o=r.call(this,t,i),s=o[0],l=a[0],c=a[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,Oi(s,(function(t){t.r=+u(t.value)})),Oi(s,no),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;Oi(s,(function(t){t.r+=h})),Oi(s,no),Oi(s,(function(t){t.r-=h}))}return function t(e,r,n,a){var i=e.children;if(e.x=r+=a*e.x,e.y=n+=a*e.y,e.r*=a,i)for(var o=-1,s=i.length;++op.x&&(p=t),t.depth>d.depth&&(d=t)}));var g=r(f,p)/2-f.x,m=n[0]/(p.x+r(p,f)/2+g),v=n[1]/(d.depth||1);zi(u,(function(t){t.x=(t.x+g)*m,t.y=t.depth*v}))}return c}function o(t){var e=t.children,n=t.parent.children,a=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,a=t.children,i=a.length;for(;--i>=0;)(e=a[i]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var i=(e[0].z+e[e.length-1].z)/2;a?(t.z=a.z+r(t._,a._),t.m=t.z-i):t.z=i}else a&&(t.z=a.z+r(t._,a._));t.parent.A=function(t,e,n){if(e){for(var a,i=t,o=t,s=e,l=i.parent.children[0],c=i.m,u=o.m,h=s.m,f=l.m;s=co(s),i=lo(i),s&&i;)l=lo(l),(o=co(o)).a=t,(a=s.z+h-i.z-c+r(s._,i._))>0&&(uo(ho(s,t,n),t,a),c+=a,u+=a),h+=s.m,c+=i.m,f+=l.m,u+=o.m;s&&!co(o)&&(o.t=s,o.m+=h-u),i&&!lo(l)&&(l.t=i,l.m+=c-f,n=t)}return n}(t,a,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 i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t)?l:null,i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null==(n=t)?null:l,i):a?n:null},Ii(i,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],a=!1;function i(i,o){var s,l=e.call(this,i,o),c=l[0],u=0;Oi(c,(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?u+=r(e,s):0,e.y=0,s=e)}));var h=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(c),f=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(c),p=h.x-r(h,f)/2,d=f.x+r(f,h)/2;return Oi(c,a?function(t){t.x=(t.x-c.x)*n[0],t.y=(c.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(d-p)*n[0],t.y=(1-(c.y?t.y/c.y:1))*n[1]}),l}return i.separation=function(t){return arguments.length?(r=t,i):r},i.size=function(t){return arguments.length?(a=null==(n=t),i):a?null:n},i.nodeSize=function(t){return arguments.length?(a=null!=(n=t),i):a?n:null},Ii(i,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,a=[1,1],i=null,o=fo,s=!1,l="squarify",c=.5*(1+Math.sqrt(5));function u(t,e){for(var r,n,a=-1,i=t.length;++a0;)s.push(r=c[a-1]),s.area+=r.area,"squarify"!==l||(n=p(s,g))<=f?(c.pop(),f=n):(s.area-=s.pop().area,d(s,g,i,!1),g=Math.min(i.dx,i.dy),s.length=s.area=0,f=1/0);s.length&&(d(s,g,i,!0),s.length=s.area=0),e.forEach(h)}}function f(t){var e=t.children;if(e&&e.length){var r,n=o(t),a=e.slice(),i=[];for(u(a,n.dx*n.dy/t.value),i.area=0;r=a.pop();)i.push(r),i.area+=r.area,null!=r.z&&(d(i,r.z?n.dx:n.dy,n,!a.length),i.length=i.area=0);e.forEach(f)}}function p(t,e){for(var r,n=t.area,a=0,i=1/0,o=-1,s=t.length;++oa&&(a=r));return e*=e,(n*=n)?Math.max(e*a*c/n,n/(e*i*c)):1/0}function d(t,e,r,a){var i,o=-1,s=t.length,l=r.x,c=r.y,u=e?n(t.area/e):0;if(e==r.dx){for((a||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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?_o:vo,s=a?wi:_i;return i=t(e,r,s,n),o=t(r,e,s,$a),l}function l(t){return i(t)}return 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(di)},l.clamp=function(t){return arguments.length?(a=t,s()):a},l.interpolate=function(t){return arguments.length?(n=t,s()):n},l.ticks=function(t){return Mo(e,t)},l.tickFormat=function(t,r){return Ao(e,t,r)},l.nice=function(t){return To(e,t),s()},l.copy=function(){return t(e,r,n,a)},s()}([0,1],[0,1],$a,!1)};var So={s:1,g:1,p:1,r:1,e:1};function Eo(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,a,i){function o(t){return(a?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return a?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return r(o(t))}return l.invert=function(t){return s(r.invert(t))},l.domain=function(t){return arguments.length?(a=t[0]>=0,r.domain((i=t.map(Number)).map(o)),l):i},l.base=function(t){return arguments.length?(n=+t,r.domain(i.map(o)),l):n},l.nice=function(){var t=yo(i.map(o),a?Math:Lo);return r.domain(t),i=t.map(s),l},l.ticks=function(){var t=go(i),e=[],r=t[0],l=t[1],c=Math.floor(o(r)),u=Math.ceil(o(l)),h=n%1?2:n;if(isFinite(u-c)){if(a){for(;c0;f--)e.push(s(c)*f);for(c=0;e[c]l;u--);e=e.slice(c,u)}return e},l.tickFormat=function(e,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=t.format(r));var a=Math.max(1,n*e/l.ticks().length);return function(t){var e=t/s(Math.round(o(t)));return e*n0?a[t-1]:r[0],th?0:1;if(c=Et)return l(c,p)+(s?l(s,1-p):"")+"Z";var d,g,m,v,y,x,b,_,w,T,k,M,A=0,S=0,E=[];if((v=(+o.apply(this,arguments)||0)/2)&&(m=n===Fo?Math.sqrt(s*s+c*c):+n.apply(this,arguments),p||(S*=-1),c&&(S=Dt(m/c*Math.sin(v))),s&&(A=Dt(m/s*Math.sin(v)))),c){y=c*Math.cos(u+S),x=c*Math.sin(u+S),b=c*Math.cos(h-S),_=c*Math.sin(h-S);var C=Math.abs(h-u-2*S)<=At?0:1;if(S&&qo(y,x,b,_)===p^C){var L=(u+h)/2;y=c*Math.cos(L),x=c*Math.sin(L),b=_=null}}else y=x=0;if(s){w=s*Math.cos(h-A),T=s*Math.sin(h-A),k=s*Math.cos(u+A),M=s*Math.sin(u+A);var P=Math.abs(u-h+2*A)<=At?0:1;if(A&&qo(w,T,k,M)===1-p^P){var I=(u+h)/2;w=s*Math.cos(I),T=s*Math.sin(I),k=M=null}}else w=T=0;if(f>kt&&(d=Math.min(Math.abs(c-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function Ho(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],s=(a?n:-n)/Math.sqrt(i*i+o*o),l=s*o,c=-s*i,u=t[0]+l,h=t[1]+c,f=e[0]+l,p=e[1]+c,d=(u+f)/2,g=(h+p)/2,m=f-u,v=p-h,y=m*m+v*v,x=r-n,b=u*p-f*h,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-m*_)/y,T=(-b*m-v*_)/y,k=(b*v+m*_)/y,M=(-b*m+v*_)/y,A=w-d,S=T-g,E=k-d,C=M-g;return A*A+S*S>E*E+C*C&&(w=k,T=M),[[w-l,T-c],[w*r/x,T*r/x]]}function Go(t){var e=ra,r=na,n=Yr,a=Wo,i=a.key,o=.7;function s(i){var s,l=[],c=[],u=-1,h=i.length,f=de(e),p=de(r);function d(){l.push("M",a(t(c),o))}for(;++u1&&a.push("H",n[0]);return a.join("")},"step-before":Xo,"step-after":Jo,basis:$o,"basis-open":function(t){if(t.length<4)return Wo(t);var e,r=[],n=-1,a=t.length,i=[0],o=[0];for(;++n<3;)e=t[n],i.push(e[0]),o.push(e[1]);r.push(ts(ns,i)+","+ts(ns,o)),--n;for(;++n9&&(a=3*e/Math.sqrt(a),o[s]=a*r,o[s+1]=a*n));s=-1;for(;++s<=l;)a=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),i.push([a||0,o[s]*a||0]);return i}(t))}});function Wo(t){return t.length>1?t.join("L"):t+"Z"}function Zo(t){return t.join("L")+"Z"}function Xo(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){s=e[1],i=t[l],l++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-s[0])+","+(i[1]-s[1])+","+i[0]+","+i[1];for(var c=2;cAt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return i.radius=function(t){return arguments.length?(r=de(t),i):r},i.source=function(e){return arguments.length?(t=de(e),i):t},i.target=function(t){return arguments.length?(e=de(t),i):e},i.startAngle=function(t){return arguments.length?(n=de(t),i):n},i.endAngle=function(t){return arguments.length?(a=de(t),i):a},i},t.svg.diagonal=function(){var t=Vn,e=qn,r=cs;function n(n,a){var i=t.call(this,n,a),o=e.call(this,n,a),s=(i.y+o.y)/2,l=[i,{x:i.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=de(e),n):t},n.target=function(t){return arguments.length?(e=de(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=cs,n=e.projection;return e.projection=function(t){return arguments.length?n(us(r=t)):r},e},t.svg.symbol=function(){var t=fs,e=hs;function r(r,n){return(ds.get(t.call(this,r,n))||ps)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=de(e),r):t},r.size=function(t){return arguments.length?(e=de(t),r):e},r};var ds=t.map({circle:ps,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*ms)),r=e*ms;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/gs),r=e*gs/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/gs),r=e*gs/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ds.keys();var gs=Math.sqrt(3),ms=Math.tan(30*Lt);Y.transition=function(t){for(var e,r,n=bs||++Ts,a=As(t),i=[],o=_s||{time:Date.now(),ease:ci,delay:0,duration:250},s=-1,l=this.length;++s0;)c[--f].call(t,o);if(i>=1)return h.event&&h.event.end.call(t,t.__data__,e),--u.count?delete u[n]:delete t[r],1}h||(i=a.time,o=we((function(t){var e=h.delay;if(o.t=e+i,e<=t)return f(t-e);o.c=f}),0,i),h=u[n]={tween:new _,time:i,timer:o,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=null,++u.count)}ws.call=Y.call,ws.empty=Y.empty,ws.node=Y.node,ws.size=Y.size,t.transition=function(e,r){return e&&e.transition?bs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.select=function(t){var e,r,n,a=this.id,i=this.namespace,o=[];t=W(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 m(){var h,m,v=this,y=t.select(t.event.target),x=n.of(v,arguments),b=t.select(v),_=y.datum(),w=!/^(n|s)$/.test(_)&&a,T=!/^(e|w)$/.test(_)&&i,k=y.classed("extent"),M=bt(v),A=t.mouse(v),S=t.select(o(v)).on("keydown.brush",L).on("keyup.brush",P);if(t.event.changedTouches?S.on("touchmove.brush",I).on("touchend.brush",O):S.on("mousemove.brush",I).on("mouseup.brush",O),b.interrupt().selectAll("*").interrupt(),k)A[0]=s[0]-A[0],A[1]=l[0]-A[1];else if(_){var E=+/w$/.test(_),C=+/^n/.test(_);m=[s[1-E]-A[0],l[1-C]-A[1]],A[0]=s[E],A[1]=l[C]}else t.event.altKey&&(h=A.slice());function L(){32==t.event.keyCode&&(k||(h=null,A[0]-=s[1],A[1]-=l[1],k=2),F())}function P(){32==t.event.keyCode&&2==k&&(A[0]+=s[1],A[1]+=l[1],k=0,F())}function I(){var e=t.mouse(v),r=!1;m&&(e[0]+=m[0],e[1]+=m[1]),k||(t.event.altKey?(h||(h=[(s[0]+s[1])/2,(l[0]+l[1])/2]),A[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Ns(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Ns(+e+1);return e}}:t))},a.ticks=function(t,e){var r=go(a.domain()),n=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Ns(+r[1]+1),e<1?1:e)},a.tickFormat=function(){return n},a.copy=function(){return Bs(e.copy(),r,n)},wo(a,e)}function Ns(t){return new Date(t)}Os.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fs:Rs,Fs.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Fs.toString=Rs.toString,Ie.second=Re((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()})),Ie.seconds=Ie.second.range,Ie.seconds.utc=Ie.second.utc.range,Ie.minute=Re((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()})),Ie.minutes=Ie.minute.range,Ie.minutes.utc=Ie.minute.utc.range,Ie.hour=Re((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()})),Ie.hours=Ie.hour.range,Ie.hours.utc=Ie.hour.utc.range,Ie.month=Re((function(t){return(t=Ie.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),Ie.months=Ie.month.range,Ie.months.utc=Ie.month.utc.range;var js=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[Ie.second,1],[Ie.second,5],[Ie.second,15],[Ie.second,30],[Ie.minute,1],[Ie.minute,5],[Ie.minute,15],[Ie.minute,30],[Ie.hour,1],[Ie.hour,3],[Ie.hour,6],[Ie.hour,12],[Ie.day,1],[Ie.day,2],[Ie.week,1],[Ie.month,1],[Ie.month,3],[Ie.year,1]],Vs=Os.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",Yr]]),qs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Ns)},floor:L,ceil:L};Us.year=Ie.year,Ie.scale=function(){return Bs(t.scale.linear(),Us,Vs)};var Hs=Us.map((function(t){return[t[0].utc,t[1]]})),Gs=Ds.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",Yr]]);function Ys(t){return JSON.parse(t.responseText)}function Ws(t){var e=a.createRange();return e.selectNode(a.body),e.createContextualFragment(t.responseText)}Hs.year=Ie.year.utc,Ie.scale.utc=function(){return Bs(t.scale.linear(),Hs,Gs)},t.text=ge((function(t){return t.responseText})),t.json=function(t,e){return me(t,"application/json",Ys,e)},t.html=function(t,e){return me(t,"text/html",Ws,e)},t.xml=ge((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],170:[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=v[t[e]];if(r<0)return!1;t[e]=r}return!0}));if(1&s)for(u=0;u<_.length;++u){f=(b=_[u])[0];b[0]=b[1],b[1]=f}return _}},{"incremental-convex-hull":433,uniq:569}],172:[function(t,e,r){"use strict";e.exports=i;var n=(i.canvas=document.createElement("canvas")).getContext("2d"),a=o([32,126]);function i(t,e){Array.isArray(t)&&(t=t.join(", "));var r,i={},s=16,l=.05;e&&(2===e.length&&"number"==typeof e[0]?r=o(e):Array.isArray(e)?r=e:(e.o?r=o(e.o):e.pairs&&(r=e.pairs),e.fontSize&&(s=e.fontSize),null!=e.threshold&&(l=e.threshold))),r||(r=a),n.font=s+"px "+t;for(var c=0;cs*l){var p=(f-h)/s;i[u]=1e3*p}}return i}function o(t){for(var e=[],r=t[0];r<=t[1];r++)for(var n=String.fromCharCode(r),a=t[0];a>>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),a=1048575&n;return 2146435072&n&&(a+=1<<20),[r,a]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:111}],174:[function(t,e,r){var n=t("abs-svg-path"),a=t("normalize-svg-path"),i={M:"moveTo",C:"bezierCurveTo"};e.exports=function(t,e){t.beginPath(),a(n(e)).forEach((function(e){var r=e[0],n=e.slice(1);t[i[r]].apply(t,n)})),t.closePath()}},{"abs-svg-path":65,"normalize-svg-path":471}],175:[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}}},{}],176:[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;n80*r){n=l=t[0],s=c=t[1];for(var b=r;bl&&(l=u),p>c&&(c=p);d=0!==(d=Math.max(l-n,c-s))?1/d:0}return o(y,x,r,n,s,d),x}function a(t,e,r,n,a){var i,o;if(a===E(t,e,r,n)>0)for(i=e;i=e;i-=n)o=M(i,t[i],t[i+1],o);return o&&x(o,o.next)&&(A(o),o=o.next),o}function i(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!x(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(A(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,a,h,f){if(t){!f&&h&&function(t,e,r,n){var a=t;do{null===a.z&&(a.z=d(a.x,a.y,e,r,n)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==t);a.prevZ.nextZ=null,a.prevZ=null,function(t){var e,r,n,a,i,o,s,l,c=1;do{for(r=t,t=null,i=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(a=r,r=r.nextZ,s--):(a=n,n=n.nextZ,l--),i?i.nextZ=a:t=a,a.prevZ=i,i=a;r=n}i.nextZ=null,c*=2}while(o>1)}(a)}(t,n,a,h);for(var p,g,m=t;t.prev!==t.next;)if(p=t.prev,g=t.next,h?l(t,n,a,h):s(t))e.push(p.i/r),e.push(t.i/r),e.push(g.i/r),A(t),t=g.next,m=g.next;else if((t=g)===m){f?1===f?o(t=c(i(t),e,r),e,r,n,a,h,2):2===f&&u(t,e,r,n,a,h):o(i(t),e,r,n,a,h,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(y(e,r,n)>=0)return!1;for(var a=t.next.next;a!==t.prev;){if(m(e.x,e.y,r.x,r.y,n.x,n.y,a.x,a.y)&&y(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function l(t,e,r,n){var a=t.prev,i=t,o=t.next;if(y(a,i,o)>=0)return!1;for(var s=a.xi.x?a.x>o.x?a.x:o.x:i.x>o.x?i.x:o.x,u=a.y>i.y?a.y>o.y?a.y:o.y:i.y>o.y?i.y:o.y,h=d(s,l,e,r,n),f=d(c,u,e,r,n),p=t.prevZ,g=t.nextZ;p&&p.z>=h&&g&&g.z<=f;){if(p!==t.prev&&p!==t.next&&m(a.x,a.y,i.x,i.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,g!==t.prev&&g!==t.next&&m(a.x,a.y,i.x,i.y,o.x,o.y,g.x,g.y)&&y(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&m(a.x,a.y,i.x,i.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;g&&g.z<=f;){if(g!==t.prev&&g!==t.next&&m(a.x,a.y,i.x,i.y,o.x,o.y,g.x,g.y)&&y(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function c(t,e,r){var n=t;do{var a=n.prev,o=n.next.next;!x(a,o)&&b(a,n,n.next,o)&&T(a,o)&&T(o,a)&&(e.push(a.i/r),e.push(n.i/r),e.push(o.i/r),A(n),A(n.next),n=t=o),n=n.next}while(n!==t);return i(n)}function u(t,e,r,n,a,s){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&v(l,c)){var u=k(l,c);return l=i(l,l.next),u=i(u,u.next),o(l,e,r,n,a,s),void o(u,e,r,n,a,s)}c=c.next}l=l.next}while(l!==t)}function h(t,e){return t.x-e.x}function f(t,e){if(e=function(t,e){var r,n=e,a=t.x,i=t.y,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=a&&s>o){if(o=s,s===a){if(i===n.y)return n;if(i===n.next.y)return n.next}r=n.x=n.x&&n.x>=u&&a!==n.x&&m(ir.x||n.x===r.x&&p(r,n)))&&(r=n,f=l)),n=n.next}while(n!==c);return r}(t,e)){var r=k(e,t);i(e,e.next),i(r,r.next)}}function p(t,e){return y(t.prev,t,e.prev)<0&&y(e.next,t,t.next)<0}function d(t,e,r,n,a){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*a)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*a)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function g(t){var e=t,r=t;do{(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(i-s)-(a-o)*(n-s)>=0}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&b(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(T(t,e)&&T(e,t)&&function(t,e){var r=t,n=!1,a=(t.x+e.x)/2,i=(t.y+e.y)/2;do{r.y>i!=r.next.y>i&&r.next.y!==r.y&&a<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(y(t.prev,t,e.prev)||y(t,e.prev,e))||x(t,e)&&y(t.prev,t,t.next)>0&&y(e.prev,e,e.next)>0)}function y(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function x(t,e){return t.x===e.x&&t.y===e.y}function b(t,e,r,n){var a=w(y(t,e,r)),i=w(y(t,e,n)),o=w(y(r,n,t)),s=w(y(r,n,e));return a!==i&&o!==s||(!(0!==a||!_(t,r,e))||(!(0!==i||!_(t,n,e))||(!(0!==o||!_(r,t,n))||!(0!==s||!_(r,e,n)))))}function _(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function w(t){return t>0?1:t<0?-1:0}function T(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function k(t,e){var r=new S(t.i,t.x,t.y),n=new S(e.i,e.x,e.y),a=t.next,i=e.prev;return t.next=e,e.prev=t,r.next=a,a.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function M(t,e,r,n){var a=new S(t,e,r);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function A(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function S(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(t,e,r,n){for(var a=0,i=e,o=r-n;i0&&(n+=t[a-1].length,r.holes.push(n))}return r}},{}],178:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var a=0;a=e}))}(e);for(var r,a=n(t).components.filter((function(t){return t.length>1})),i=1/0,o=0;o=55296&&y<=56319&&(w+=t[++r]),w=T?f.call(T,k,w,g):w,e?(p.value=w,d(m,g,p)):m[g]=w,++g;v=g}if(void 0===v)for(v=o(t.length),e&&(m=new e(v)),r=0;r0?1:-1}},{}],190:[function(t,e,r){"use strict";var n=t("../math/sign"),a=Math.abs,i=Math.floor;e.exports=function(t){return isNaN(t)?0:0!==(t=Number(t))&&isFinite(t)?n(t)*i(a(t)):t}},{"../math/sign":187}],191:[function(t,e,r){"use strict";var n=t("./to-integer"),a=Math.max;e.exports=function(t){return a(0,n(t))}},{"./to-integer":190}],192:[function(t,e,r){"use strict";var n=t("./valid-callable"),a=t("./valid-value"),i=Function.prototype.bind,o=Function.prototype.call,s=Object.keys,l=Object.prototype.propertyIsEnumerable;e.exports=function(t,e){return function(r,c){var u,h=arguments[2],f=arguments[3];return r=Object(a(r)),n(c),u=s(r),f&&u.sort("function"==typeof f?i.call(f,r):void 0),"function"!=typeof t&&(t=u[t]),o.call(t,u,(function(t,n){return l.call(r,t)?o.call(c,h,r[t],t,r,n):e}))}}},{"./valid-callable":209,"./valid-value":211}],193:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.assign:t("./shim")},{"./is-implemented":194,"./shim":195}],194:[function(t,e,r){"use strict";e.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},{}],195:[function(t,e,r){"use strict";var n=t("../keys"),a=t("../valid-value"),i=Math.max;e.exports=function(t,e){var r,o,s,l=i(arguments.length,2);for(t=Object(a(t)),s=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},o=1;o-1}},{}],215:[function(t,e,r){"use strict";var n=Object.prototype.toString,a=n.call("");e.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===a)||!1}},{}],216:[function(t,e,r){"use strict";var n=Object.create(null),a=Math.random;e.exports=function(){var t;do{t=a().toString(36).slice(2)}while(n[t]);return t}},{}],217:[function(t,e,r){"use strict";var n,a=t("es5-ext/object/set-prototype-of"),i=t("es5-ext/string/#/contains"),o=t("d"),s=t("es6-symbol"),l=t("./"),c=Object.defineProperty;n=e.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");l.call(this,t),e=e?i.call(e,"key+value")?"key+value":i.call(e,"key")?"key":"value":"value",c(this,"__kind__",o("",e))},a&&a(n,l),delete n.prototype.constructor,n.prototype=Object.create(l.prototype,{_resolve:o((function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t}))}),c(n.prototype,s.toStringTag,o("c","Array Iterator"))},{"./":220,d:155,"es5-ext/object/set-prototype-of":206,"es5-ext/string/#/contains":212,"es6-symbol":225}],218:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/valid-callable"),i=t("es5-ext/string/is-string"),o=t("./get"),s=Array.isArray,l=Function.prototype.call,c=Array.prototype.some;e.exports=function(t,e){var r,u,h,f,p,d,g,m,v=arguments[2];if(s(t)||n(t)?r="array":i(t)?r="string":t=o(t),a(e),h=function(){f=!0},"array"!==r)if("string"!==r)for(u=t.next();!u.done;){if(l.call(e,v,u.value,h),f)return;u=t.next()}else for(d=t.length,p=0;p=55296&&m<=56319&&(g+=t[++p]),l.call(e,v,g,h),!f);++p);else c.call(t,(function(t){return l.call(e,v,t,h),f}))}},{"./get":219,"es5-ext/function/is-arguments":184,"es5-ext/object/valid-callable":209,"es5-ext/string/is-string":215}],219:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/string/is-string"),i=t("./array"),o=t("./string"),s=t("./valid-iterable"),l=t("es6-symbol").iterator;e.exports=function(t){return"function"==typeof s(t)[l]?t[l]():n(t)?new i(t):a(t)?new o(t):new i(t)}},{"./array":217,"./string":222,"./valid-iterable":223,"es5-ext/function/is-arguments":184,"es5-ext/string/is-string":215,"es6-symbol":225}],220:[function(t,e,r){"use strict";var n,a=t("es5-ext/array/#/clear"),i=t("es5-ext/object/assign"),o=t("es5-ext/object/valid-callable"),s=t("es5-ext/object/valid-value"),l=t("d"),c=t("d/auto-bind"),u=t("es6-symbol"),h=Object.defineProperty,f=Object.defineProperties;e.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");f(this,{__list__:l("w",s(t)),__context__:l("w",e),__nextIndex__:l("w",0)}),e&&(o(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,f(n.prototype,i({_next:l((function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach((function(e,r){e>=t&&(this.__redo__[r]=++e)}),this),this.__redo__.push(t)):h(this,"__redo__",l("c",[t])))})),_onDelete:l((function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(e=this.__redo__.indexOf(t))&&this.__redo__.splice(e,1),this.__redo__.forEach((function(e,r){e>t&&(this.__redo__[r]=--e)}),this)))})),_onClear:l((function(){this.__redo__&&a.call(this.__redo__),this.__nextIndex__=0}))}))),h(n.prototype,u.iterator,l((function(){return this})))},{d:155,"d/auto-bind":154,"es5-ext/array/#/clear":180,"es5-ext/object/assign":193,"es5-ext/object/valid-callable":209,"es5-ext/object/valid-value":211,"es6-symbol":225}],221:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/is-value"),i=t("es5-ext/string/is-string"),o=t("es6-symbol").iterator,s=Array.isArray;e.exports=function(t){return!!a(t)&&(!!s(t)||(!!i(t)||(!!n(t)||"function"==typeof t[o])))}},{"es5-ext/function/is-arguments":184,"es5-ext/object/is-value":200,"es5-ext/string/is-string":215,"es6-symbol":225}],222:[function(t,e,r){"use strict";var n,a=t("es5-ext/object/set-prototype-of"),i=t("d"),o=t("es6-symbol"),s=t("./"),l=Object.defineProperty;n=e.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),s.call(this,t),l(this,"__length__",i("",t.length))},a&&a(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:i((function(){if(this.__list__)return this.__nextIndex__=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r}))}),l(n.prototype,o.toStringTag,i("c","String Iterator"))},{"./":220,d:155,"es5-ext/object/set-prototype-of":206,"es6-symbol":225}],223:[function(t,e,r){"use strict";var n=t("./is-iterable");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},{"./is-iterable":221}],224:[function(t,e,r){(function(n,a){ +"use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(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 l(t)}return o(t,e,r)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|f(t,e),n=i(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(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=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,e){if(a.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 R(t).length;default:if(i)return n?-1:D(t).length;e=(""+e).toLowerCase(),i=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 A(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return M(this,e,r);case"base64":return w(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}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(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),N(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=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:g(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):g(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(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 c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var u=-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 w(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(u=c);break;case 2:128==(192&(a=t[i+1]))&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&(l=(15&c)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=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&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,f=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},a.prototype.compare=function(t,e,r,n,i){if(B(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.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 o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),l=Math.min(o,s),c=this.slice(n,i),u=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 v(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};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 C(t,e,r,n,i,o){if(!a.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 L(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 I(t,e,r,i,a){return e=+e,r>>>=0,a||L(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function P(t,e,r,i,a){return e=+e,r>>>=0,a||L(t,0,r,8),n.write(t,e,r,i,52,8),r+8}a.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||E(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(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},a.prototype.readInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||E(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(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)||C(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},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);C(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},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);C(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},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(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},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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},a.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.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;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},a.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&&!a.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(o=e;o55295&&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 R(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(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 N(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":79,buffer:111,ieee754:442}],112:[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 c(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 u=!!c(r,"delaunay",!0),f=!!c(r,"interior",!0),h=!!c(r,"exterior",!0),p=!!c(r,"infinity",!1);if(!f&&!h||0===t.length)return[];var d=n(t,e);if(u||f!==h||p){for(var g=i(t.length,function(t){return t.map(s).sort(l)}(e)),m=0;m0;){for(var p=r.pop(),d=(s=r.pop(),u=-1,f=-1,l=o[s],1);d=0||(e.flip(s,p),i(t,e,r,u,s,f),i(t,e,r,s,f,u),i(t,e,r,f,p,u),i(t,e,r,p,u,f)))}}},{"binary-search-bounds":96,"robust-in-sphere":546}],114:[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 p=s.pop();if(c[p]!==-i){c[p]=i;u[p];for(var d=0;d<3;++d){var g=h[3*p+d];g>=0&&0===c[g]&&(f[3*p+d]?l.push(g):(s.push(g),c[g]=i))}}}var m=l;l=s,s=m,l.length=0,i=-i}var v=function(t,e,r){for(var n=0,i=0;i1&&i(r[h[p-2]],r[h[p-1]],a)>0;)t.push([h[p-1],h[p-2],o]),p-=1;h.length=p,h.push(o);var d=f.upperIds;for(p=d.length;p>1&&i(r[d[p-2]],r[d[p-1]],a)<0;)t.push([d[p-2],d[p-1],o]),p-=1;d.length=p,d.push(o)}}function u(t,e){var r;return(r=t.a[0]d[0]&&i.push(new o(d,p,2,l),new o(p,d,1,l))}i.sort(s);for(var g=i[0].a[0]-(1+Math.abs(i[0].a[0]))*Math.pow(2,-52),m=[new a([g,1],[g,0],-1,[],[],[],[])],v=[],y=(l=0,i.length);l=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;nr?r:t:te?e:t}},{}],121:[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 v(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--a){var x=e[u=(S=n[a])[0]],b=x[0],_=x[1],w=t[b],T=t[_];if((w[0]-T[0]||w[1]-T[1])<0){var k=b;b=_,_=k}x[0]=b;var M,A=x[1]=S[1];for(i&&(M=x[2]);a>0&&n[a-1][0]===u;){var S,E=(S=n[--a])[1];i?e.push([A,E,M]):e.push([A,E]),A=E}i?e.push([A,_,M]):e.push([A,_])}return h}(t,e,h,m,r));return v(e,y,r),!!y||(h.length>0||m.length>0)}},{"./lib/rat-seg-intersect":122,"big-rat":83,"big-rat/cmp":81,"big-rat/to-float":95,"box-intersect":101,nextafter:496,"rat-vec":530,"robust-segment-intersect":551,"union-find":596}],122:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=s(e,t),f=s(n,r),h=u(a,f);if(0===o(h))return null;var p=s(t,r),d=u(f,p),g=i(d,h),m=c(a,g);return l(t,m)};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"),c=t("rat-vec/muls");function u(t,e){return a(n(t[0],e[1]),n(t[1],e[0]))}},{"big-rat/div":82,"big-rat/mul":92,"big-rat/sign":93,"big-rat/sub":94,"rat-vec/add":529,"rat-vec/muls":531,"rat-vec/sub":532}],123:[function(t,e,r){"use strict";var n=t("clamp");function i(t,e){null==e&&(e=!0);var r=t[0],i=t[1],a=t[2],o=t[3];return null==o&&(o=e?1:255),e&&(r*=255,i*=255,a*=255,o*=255),16777216*(r=255&n(r,0,255))+((i=255&n(i,0,255))<<16)+((a=255&n(a,0,255))<<8)+(o=255&n(o,0,255))}e.exports=i,e.exports.to=i,e.exports.from=function(t,e){var r=(t=+t)>>>24,n=(16711680&t)>>>16,i=(65280&t)>>>8,a=255&t;return!1===e?[r,n,i,a]:[r/255,n/255,i/255,a/255]}},{clamp:120}],124:[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]}},{}],125:[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:120,"color-rgba":127,dtype:175}],126:[function(t,e,r){(function(r){(function(){"use strict";var n=t("color-name"),i=t("is-plain-obj"),a=t("defined");e.exports=function(t){var e,s,l=[],c=1;if("string"==typeof t)if(n[t])l=n[t].slice(),s="rgb";else if("transparent"===t)c=0,s="rgb",l=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var u=(p=t.slice(1)).length;c=1,u<=4?(l=[parseInt(p[0]+p[0],16),parseInt(p[1]+p[1],16),parseInt(p[2]+p[2],16)],4===u&&(c=parseInt(p[3]+p[3],16)/255)):(l=[parseInt(p[0]+p[1],16),parseInt(p[2]+p[3],16),parseInt(p[4]+p[5],16)],8===u&&(c=parseInt(p[6]+p[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 f=e[1],h="rgb"===f,p=f.replace(/a$/,"");s=p;u="cmyk"===p?4:"gray"===p?1:3;l=e[2].trim().split(/\s*,\s*/).map((function(t,e){if(/%$/.test(t))return e===u?parseFloat(t)/100:"rgb"===p?255*parseFloat(t)/100:parseFloat(t);if("h"===p[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)})),f===p&&l.push(1),c=h||void 0===l[u]?1:l[u],l=l.slice(0,u)}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 d=a(t.r,t.red,t.R,null);null!==d?(s="rgb",l=[d,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)]),c=a(t.a,t.alpha,t.opacity,1),null!=t.opacity&&(c/=100)}else(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(l=[t[0],t[1],t[2]],s="rgb",c=4===t.length?t[3]:1);else s="rgb",l=[t>>>16,(65280&t)>>>8,255&t];return{space:s,values:l,alpha:c}};var o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":124,defined:170,"is-plain-obj":469}],127:[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:120,"color-parse":126,"color-space/hsl":128}],128:[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 c=0;c<3;c++)(n=o+1/3*-(c-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[c]=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":129}],129:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],130:[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]}]}},{}],131:[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,c,u,f,h,p,d,g;t||(t={});p=(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");u=n[f]}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);u=f.slice()}if(u.length>p+1)throw new Error(f+" map requires nshades to be at least size "+u.length);d=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:t.alpha.slice():"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1];e=u.map((function(t){return Math.round(t.index*p)})),d[0]=Math.min(Math.max(d[0],0),1),d[1]=Math.min(Math.max(d[1],0),1);var m=u.map((function(t,e){var r=u[e].index,n=u[e].rgb.slice();return 4===n.length&&n[3]>=0&&n[3]<=1||(n[3]=d[0]+(d[1]-d[0])*r),n})),v=[];for(g=0;g0||l(t,e,a)?-1:1:0===s?c>0||l(t,e,r)?1:-1:i(c-s)}var h=n(t,e,r);return h>0?o>0&&n(t,e,a)>0?1:-1:h<0?o>0||n(t,e,a)>0?1:-1:n(t,e,a)>0||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]),c=a(r[1],-e[1]),u=s(o(n,l),o(i,c));return u[u.length-1]>=0}},{"robust-orientation":548,"robust-product":549,"robust-sum":553,signum:554,"two-sum":583}],133:[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]),c=n(e[0],e[1]);return n(l,t[2])-n(c,e[2])||n(l+t[2],o)-n(c+e[2],s);case 4:var u=t[0],f=t[1],h=t[2],p=t[3],d=e[0],g=e[1],m=e[2],v=e[3];return u+f+h+p-(d+g+m+v)||n(u,f,h,p)-n(d,g,m,v,d)||n(u+f,u+h,u+p,f+h,f+p,h+p)-n(d+g,d+m,d+v,g+m,g+v,m+v)||n(u+f+h,u+f+p,u+h+p,f+h+p)-n(d+g+m,d+g+v,d+m+v,g+m+v);default:for(var y=t.slice().sort(i),x=e.slice().sort(i),b=0;bt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}},{}],137:[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}(n(a,!0),r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":67,"incremental-convex-hull":459}],139:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],140:[function(t,e,r){e.exports=["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]},{}],141:[function(t,e,r){e.exports=["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]},{}],142:[function(t,e,r){e.exports=["normal","italic","oblique"]},{}],143:[function(t,e,r){e.exports=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},{}],144:[function(t,e,r){"use strict";e.exports={parse:t("./parse"),stringify:t("./stringify")}},{"./parse":146,"./stringify":147}],145:[function(t,e,r){"use strict";var n=t("css-font-size-keywords");e.exports={isSize:function(t){return/^[\d\.]/.test(t)||-1!==t.indexOf("/")||-1!==n.indexOf(t)}}},{"css-font-size-keywords":140}],146:[function(t,e,r){"use strict";var n=t("unquote"),i=t("css-global-keywords"),a=t("css-system-font-keywords"),o=t("css-font-weight-keywords"),s=t("css-font-style-keywords"),l=t("css-font-stretch-keywords"),c=t("string-split-by"),u=t("./lib/util").isSize;e.exports=h;var f=h.cache={};function h(t){if("string"!=typeof t)throw new Error("Font argument must be a string.");if(f[t])return f[t];if(""===t)throw new Error("Cannot parse an empty string.");if(-1!==a.indexOf(t))return f[t]={system:t};for(var e,r={style:"normal",variant:"normal",weight:"normal",stretch:"normal",lineHeight:"normal",size:"1rem",family:["serif"]},h=c(t,/\s+/);e=h.shift();){if(-1!==i.indexOf(e))return["style","variant","weight","stretch"].forEach((function(t){r[t]=e})),f[t]=r;if(-1===s.indexOf(e))if("normal"!==e&&"small-caps"!==e)if(-1===l.indexOf(e)){if(-1===o.indexOf(e)){if(u(e)){var d=c(e,"/");if(r.size=d[0],null!=d[1]?r.lineHeight=p(d[1]):"/"===h[0]&&(h.shift(),r.lineHeight=p(h.shift())),!h.length)throw new Error("Missing required font-family.");return r.family=c(h.join(" "),/\s*,\s*/).map(n),f[t]=r}throw new Error("Unknown or unsupported font token: "+e)}r.weight=e}else r.stretch=e;else r.variant=e;else r.style=e}throw new Error("Missing required font-size.")}function p(t){var e=parseFloat(t);return e.toString()===t?e:t}},{"./lib/util":145,"css-font-stretch-keywords":141,"css-font-style-keywords":142,"css-font-weight-keywords":143,"css-global-keywords":148,"css-system-font-keywords":149,"string-split-by":568,unquote:598}],147:[function(t,e,r){"use strict";var n=t("pick-by-alias"),i=t("./lib/util").isSize,a=g(t("css-global-keywords")),o=g(t("css-system-font-keywords")),s=g(t("css-font-weight-keywords")),l=g(t("css-font-style-keywords")),c=g(t("css-font-stretch-keywords")),u={normal:1,"small-caps":1},f={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1},h="1rem",p="serif";function d(t,e){if(t&&!e[t]&&!a[t])throw Error("Unknown keyword `"+t+"`");return t}function g(t){for(var e={},r=0;r=0;--p)a[p]=c*t[p]+u*e[p]+f*r[p]+h*n[p];return a}return c*t+u*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,c=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var u=t.length-1;u>=0;--u)a[u]=o*t[u]+s*e[u]+l*r[u]+c*n[u];return a}return o*t+s*e+l*r[u]+c*n}},{}],151:[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":153}],152:[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=[],c=[],u=0,f=0;for(n=0;n0&&l.push("var "+c.join(",")),n=a-1;n>=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function a(t,e,r){for(var n=t.body,i=[],a=[],o=0;o0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,s=new Array(t.arrayArgs.length),l=new Array(t.arrayArgs.length),c=0;c0&&x.push("shape=SS.slice(0)"),t.indexArgs.length>0){var b=new Array(r);for(c=0;c0&&y.push("var "+x.join(",")),c=0;c3&&y.push(a(t.pre,t,l));var k=a(t.body,t,l),M=function(t){for(var e=0,r=t[0].length;e0,c=[],u=0;u0;){"].join("")),c.push(["if(j",u,"<",s,"){"].join("")),c.push(["s",e[u],"=j",u].join("")),c.push(["j",u,"=0"].join("")),c.push(["}else{s",e[u],"=",s].join("")),c.push(["j",u,"-=",s,"}"].join("")),l&&c.push(["index[",e[u],"]=j",u].join(""));for(u=0;u3&&y.push(a(t.post,t,l)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+y.join("\n")+"\n----------");var A=[t.funcName||"unnamed","_cwise_loop_",s[0].join("s"),"m",M,o(l)].join("");return new Function(["function ",A,"(",v.join(","),"){",y.join("\n"),"} return ",A].join(""))()}},{uniq:597}],153:[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=[],c=[],u=0;u0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[u]))),c.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}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 (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),u=0;ue?1:t>=e?0:NaN}function r(t){var r;return 1===t.length&&(r=t,t=function(t,n){return e(r(t),n)}),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}var n=r(e),i=n.right,a=n.left;function o(t,e){return[t,e]}function s(t){return null===t?NaN:+t}function l(t,e){var r,n,i=t.length,a=0,o=-1,l=0,c=0;if(null==e)for(;++o1)return c/(a-1)}function c(t,e){var r=l(t,e);return r?Math.sqrt(r):r}function u(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o=r)for(n=i=r;++or&&(n=r),i=r)for(n=i=r;++or&&(n=r),i=0?(a>=v?10:a>=y?5:a>=x?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=v?10:a>=y?5:a>=x?2:1)}function _(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=v?i*=10:a>=y?i*=5:a>=x&&(i*=2),e=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}}function k(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++ar&&(n=r)}else for(;++a=r)for(n=r;++ar&&(n=r);return n}function M(t){if(!(i=t.length))return[];for(var e=-1,r=k(t,A),n=new Array(r);++et?1:e>=t?0:NaN},t.deviation=c,t.extent=u,t.histogram=function(){var t=g,e=u,r=w;function n(n){var a,o,s=n.length,l=new Array(s);for(a=0;af;)h.pop(),--p;var d,g=new Array(p+1);for(a=0;a<=p;++a)(d=g[a]=[]).x0=a>0?h[a-1]:u,d.x1=a=r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},t.mean=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r},t.min=k,t.pairs=function(t,e){null==e&&(e=o);for(var r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r0)return[t];if((n=e0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++s=l.length)return null!=t&&n.sort(t),null!=e?e(n):n;for(var s,c,f,h=-1,p=n.length,d=l[i++],g=r(),m=a();++hl.length)return r;var i,a=c[n-1];return null!=e&&n>=l.length?i=r.entries():(i=[],r.each((function(e,r){i.push({key:r,values:t(e,n)})}))),null!=a?i.sort((function(t,e){return a(t.key,e.key)})):i}(u(t,0,a,o),0)},key:function(t){return l.push(t),s},sortKeys:function(t){return c[l.length-1]=t,s},sortValues:function(e){return t=e,s},rollup:function(t){return e=t,s}}},t.set=c,t.map=r,t.keys=function(t){var e=[];for(var r in t)e.push(r);return e},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},Object.defineProperty(t,"__esModule",{value:!0})}))},{}],158:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function r(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function n(){}var i="\\s*([+-]?\\d+)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",s=/^#([0-9a-f]{3,8})$/,l=new RegExp("^rgb\\("+[i,i,i]+"\\)$"),c=new RegExp("^rgb\\("+[o,o,o]+"\\)$"),u=new RegExp("^rgba\\("+[i,i,i,a]+"\\)$"),f=new RegExp("^rgba\\("+[o,o,o,a]+"\\)$"),h=new RegExp("^hsl\\("+[a,o,o]+"\\)$"),p=new RegExp("^hsla\\("+[a,o,o,a]+"\\)$"),d={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function g(){return this.rgb().formatHex()}function m(){return this.rgb().formatRgb()}function v(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=s.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?y(e):3===r?new w(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?x(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?x(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=l.exec(t))?new w(e[1],e[2],e[3],1):(e=c.exec(t))?new w(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=u.exec(t))?x(e[1],e[2],e[3],e[4]):(e=f.exec(t))?x(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=h.exec(t))?A(e[1],e[2]/100,e[3]/100,1):(e=p.exec(t))?A(e[1],e[2]/100,e[3]/100,e[4]):d.hasOwnProperty(t)?y(d[t]):"transparent"===t?new w(NaN,NaN,NaN,0):null}function y(t){return new w(t>>16&255,t>>8&255,255&t,1)}function x(t,e,r,n){return n<=0&&(t=e=r=NaN),new w(t,e,r,n)}function b(t){return t instanceof n||(t=v(t)),t?new w((t=t.rgb()).r,t.g,t.b,t.opacity):new w}function _(t,e,r,n){return 1===arguments.length?b(t):new w(t,e,r,null==n?1:n)}function w(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function T(){return"#"+M(this.r)+M(this.g)+M(this.b)}function k(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function M(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function A(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new C(t,e,r,n)}function S(t){if(t instanceof C)return new C(t.h,t.s,t.l,t.opacity);if(t instanceof n||(t=v(t)),!t)return new C;if(t instanceof C)return t;var e=(t=t.rgb()).r/255,r=t.g/255,i=t.b/255,a=Math.min(e,r,i),o=Math.max(e,r,i),s=NaN,l=o-a,c=(o+a)/2;return l?(s=e===o?(r-i)/l+6*(r0&&c<1?0:s,new C(s,l,c,t.opacity)}function E(t,e,r,n){return 1===arguments.length?S(t):new C(t,e,r,null==n?1:n)}function C(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function L(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}e(n,v,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:g,formatHex:g,formatHsl:function(){return S(this).formatHsl()},formatRgb:m,toString:m}),e(w,_,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:T,formatHex:T,formatRgb:k,toString:k})),e(C,E,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new C(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new C(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new w(L(t>=240?t-240:t+120,i,n),L(t,i,n),L(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var I=Math.PI/180,P=180/Math.PI,z=6/29,O=3*z*z;function D(t){if(t instanceof F)return new F(t.l,t.a,t.b,t.opacity);if(t instanceof H)return G(t);t instanceof w||(t=b(t));var e,r,n=U(t.r),i=U(t.g),a=U(t.b),o=B((.2225045*n+.7168786*i+.0606169*a)/1);return n===i&&i===a?e=r=o:(e=B((.4360747*n+.3850649*i+.1430804*a)/.96422),r=B((.0139322*n+.0971045*i+.7141733*a)/.82521)),new F(116*o-16,500*(e-o),200*(o-r),t.opacity)}function R(t,e,r,n){return 1===arguments.length?D(t):new F(t,e,r,null==n?1:n)}function F(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function B(t){return t>.008856451679035631?Math.pow(t,1/3):t/O+4/29}function N(t){return t>z?t*t*t:O*(t-4/29)}function j(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function U(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function V(t){if(t instanceof H)return new H(t.h,t.c,t.l,t.opacity);if(t instanceof F||(t=D(t)),0===t.a&&0===t.b)return new H(NaN,0=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}}))}function a(t,e){for(var r,n=0,i=t.length;n0)for(var r,n,i=new Array(r),a=0;ah+c||np+c||au.index){var f=h-s.x-s.vx,m=p-s.y-s.vy,v=f*f+m*m;vt.r&&(t.r=t[e].r)}function h(){if(r){var e,i,a=r.length;for(n=new Array(a),e=0;e=c)){(t.data!==r||t.next)&&(0===f&&(d+=(f=o())*f),0===h&&(d+=(h=o())*h),d1?(null==r?u.remove(t):u.set(t,v(r)),e):u.get(t)},find:function(e,r,n){var i,a,o,s,l,c=0,u=t.length;for(null==n?n=1/0:n*=n,c=0;c1?(h.on(t,r),e):h.on(t)}}},t.forceX=function(t){var e,r,n,i=a(.1);function o(t){for(var i,a=0,o=e.length;a=0;)e+=r[n].value;else e=1;t.value=e}function a(t,e){var r,n,i,a,s,u=new c(t),f=+t.value&&(u.value=t.value),h=[u];for(null==e&&(e=o);r=h.pop();)if(f&&(r.value=+r.data.value),(i=e(r.data))&&(s=i.length))for(r.children=new Array(s),a=s-1;a>=0;--a)h.push(n=r.children[a]=new c(i[a])),n.parent=r,n.depth=r.depth+1;return u.eachBefore(l)}function o(t){return t.children}function s(t){t.data=t.data.data}function l(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function c(t){this.data=t,this.depth=this.height=0,this.parent=null}c.prototype=a.prototype={constructor:c,count:function(){return this.eachAfter(i)},each:function(t){var e,r,n,i,a=this,o=[a];do{for(e=o.reverse(),o=[];a=e.pop();)if(t(a),r=a.children)for(n=0,i=r.length;n=0;--r)i.push(e[r]);return this},sum:function(t){return this.eachAfter((function(e){for(var r=+t(e.data)||0,n=e.children,i=n&&n.length;--i>=0;)r+=n[i].value;e.value=r}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,r=function(t,e){if(t===e)return t;var r=t.ancestors(),n=e.ancestors(),i=null;t=r.pop(),e=n.pop();for(;t===e;)i=t,t=r.pop(),e=n.pop();return i}(e,t),n=[e];e!==r;)e=e.parent,n.push(e);for(var i=n.length;t!==r;)n.splice(i,0,t),t=t.parent;return n},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(r){r!==t&&e.push({source:r.parent,target:r})})),e},copy:function(){return a(this).eachBefore(s)}};var u=Array.prototype.slice;function f(t){for(var e,r,n=0,i=(t=function(t){for(var e,r,n=t.length;n;)r=Math.random()*n--|0,e=t[n],t[n]=t[r],t[r]=e;return t}(u.call(t))).length,a=[];n0&&r*r>n*n+i*i}function g(t,e){for(var r=0;r(o*=o)?(n=(c+o-i)/(2*c),a=Math.sqrt(Math.max(0,o/c-n*n)),r.x=t.x-n*s-a*l,r.y=t.y-n*l+a*s):(n=(c+i-o)/(2*c),a=Math.sqrt(Math.max(0,i/c-n*n)),r.x=e.x+n*s-a*l,r.y=e.y+n*l+a*s)):(r.x=e.x+r.r,r.y=e.y)}function b(t,e){var r=t.r+e.r-1e-6,n=e.x-t.x,i=e.y-t.y;return r>0&&r*r>n*n+i*i}function _(t){var e=t._,r=t.next._,n=e.r+r.r,i=(e.x*r.r+r.x*e.r)/n,a=(e.y*r.r+r.y*e.r)/n;return i*i+a*a}function w(t){this._=t,this.next=null,this.previous=null}function T(t){if(!(i=t.length))return 0;var e,r,n,i,a,o,s,l,c,u,h;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(r=t[1],e.x=-r.r,r.x=e.r,r.y=0,!(i>2))return e.r+r.r;x(r,e,n=t[2]),e=new w(e),r=new w(r),n=new w(n),e.next=n.previous=r,r.next=e.previous=n,n.next=r.previous=e;t:for(s=3;sh&&(h=s),m=u*u*g,(p=Math.max(h/m,m/f))>d){u-=s;break}d=p}v.push(o={value:u,dice:l1?e:1)},r}(G);var X=function t(e){function r(t,r,n,i,a){if((o=t._squarify)&&o.ratio===e)for(var o,s,l,c,u,f=-1,h=o.length,p=t.value;++f1?e:1)},r}(G);t.cluster=function(){var t=e,i=1,a=1,o=!1;function s(e){var s,l=0;e.eachAfter((function(e){var i=e.children;i?(e.x=function(t){return t.reduce(r,0)/t.length}(i),e.y=function(t){return 1+t.reduce(n,0)}(i)):(e.x=s?l+=t(e,s):0,e.y=0,s=e)}));var c=function(t){for(var e;e=t.children;)t=e[0];return t}(e),u=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(e),f=c.x-t(c,u)/2,h=u.x+t(u,c)/2;return e.eachAfter(o?function(t){t.x=(t.x-e.x)*i,t.y=(e.y-t.y)*a}:function(t){t.x=(t.x-f)/(h-f)*i,t.y=(1-(e.y?t.y/e.y:1))*a})}return s.separation=function(e){return arguments.length?(t=e,s):t},s.size=function(t){return arguments.length?(o=!1,i=+t[0],a=+t[1],s):o?null:[i,a]},s.nodeSize=function(t){return arguments.length?(o=!0,i=+t[0],a=+t[1],s):o?[i,a]:null},s},t.hierarchy=a,t.pack=function(){var t=null,e=1,r=1,n=A;function i(i){return i.x=e/2,i.y=r/2,t?i.eachBefore(C(t)).eachAfter(L(n,.5)).eachBefore(I(1)):i.eachBefore(C(E)).eachAfter(L(A,1)).eachAfter(L(n,i.r/Math.min(e,r))).eachBefore(I(Math.min(e,r)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=k(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],r=+t[1],i):[e,r]},i.padding=function(t){return arguments.length?(n="function"==typeof t?t:S(+t),i):n},i},t.packEnclose=f,t.packSiblings=function(t){return T(t),t},t.partition=function(){var t=1,e=1,r=0,n=!1;function i(i){var a=i.height+1;return i.x0=i.y0=r,i.x1=t,i.y1=e/a,i.eachBefore(function(t,e){return function(n){n.children&&z(n,n.x0,t*(n.depth+1)/e,n.x1,t*(n.depth+2)/e);var i=n.x0,a=n.y0,o=n.x1-r,s=n.y1-r;o0)throw new Error("cycle");return a}return r.id=function(e){return arguments.length?(t=M(e),r):t},r.parentId=function(t){return arguments.length?(e=M(t),r):e},r},t.tree=function(){var t=B,e=1,r=1,n=null;function i(i){var l=function(t){for(var e,r,n,i,a,o=new q(t,0),s=[o];e=s.pop();)if(n=e._.children)for(e.children=new Array(a=n.length),i=a-1;i>=0;--i)s.push(r=e.children[i]=new q(n[i],i)),r.parent=e;return(o.parent=new q(null,0)).children=[o],o}(i);if(l.eachAfter(a),l.parent.m=-l.z,l.eachBefore(o),n)i.eachBefore(s);else{var c=i,u=i,f=i;i.eachBefore((function(t){t.xu.x&&(u=t),t.depth>f.depth&&(f=t)}));var h=c===u?1:t(c,u)/2,p=h-c.x,d=e/(u.x+h+p),g=r/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+p)*d,t.y=t.depth*g}))}return i}function a(e){var r=e.children,n=e.parent.children,i=e.i?n[e.i-1]:null;if(r){!function(t){for(var e,r=0,n=0,i=t.children,a=i.length;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(e);var a=(r[0].z+r[r.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-a):e.z=a}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,r,n){if(r){for(var i,a=e,o=e,s=r,l=a.parent.children[0],c=a.m,u=o.m,f=s.m,h=l.m;s=j(s),a=N(a),s&&a;)l=N(l),(o=j(o)).a=e,(i=s.z+f-a.z-c+t(s._,a._))>0&&(U(V(s,e,n),e,i),c+=i,u+=i),f+=s.m,c+=a.m,h+=l.m,u+=o.m;s&&!j(o)&&(o.t=s,o.m+=f-u),a&&!N(l)&&(l.t=a,l.m+=c-h,n=e)}return n}(e,i,e.parent.A||n[0])}function o(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*r}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(n=!1,e=+t[0],r=+t[1],i):n?null:[e,r]},i.nodeSize=function(t){return arguments.length?(n=!0,e=+t[0],r=+t[1],i):n?[e,r]:null},i},t.treemap=function(){var t=W,e=!1,r=1,n=1,i=[0],a=A,o=A,s=A,l=A,c=A;function u(t){return t.x0=t.y0=0,t.x1=r,t.y1=n,t.eachBefore(f),i=[0],e&&t.eachBefore(P),t}function f(e){var r=i[e.depth],n=e.x0+r,u=e.y0+r,f=e.x1-r,h=e.y1-r;f=r-1){var u=s[e];return u.x0=i,u.y0=a,u.x1=o,void(u.y1=l)}var f=c[e],h=n/2+f,p=e+1,d=r-1;for(;p>>1;c[g]l-a){var y=(i*v+o*m)/n;t(e,p,m,i,a,y,l),t(p,r,v,y,a,o,l)}else{var x=(a*v+l*m)/n;t(e,p,m,i,a,o,x),t(p,r,v,i,x,o,l)}}(0,l,t.value,e,r,n,i)},t.treemapDice=z,t.treemapResquarify=X,t.treemapSlice=H,t.treemapSliceDice=function(t,e,r,n,i){(1&t.depth?H:z)(t,e,r,n,i)},t.treemapSquarify=W,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],162:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-color")):i((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t,e,r,n,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*r+(1+3*t+3*a-3*o)*n+o*i)/6}function n(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),a=t[i],o=t[i+1],s=i>0?t[i-1]:2*a-o,l=i180||r<-180?r-360*Math.round(r/360):r):a(isNaN(t)?e:t)}function l(t){return 1==(t=+t)?c:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):a(isNaN(e)?r:e)}}function c(t,e){var r=e-t;return r?o(t,r):a(isNaN(t)?e:t)}var u=function t(r){var n=l(r);function i(t,r){var i=n((t=e.rgb(t)).r,(r=e.rgb(r)).r),a=n(t.g,r.g),o=n(t.b,r.b),s=c(t.opacity,r.opacity);return function(e){return t.r=i(e),t.g=a(e),t.b=o(e),t.opacity=s(e),t+""}}return i.gamma=t,i}(1);function f(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;na&&(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:y(r,n)})),a=_.lastIndex;return a180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:y(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(a.rotate,o.rotate,s,l),function(t,e,r,a){t!==e?a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:y(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(a.skewX,o.skewX,s,l),function(t,e,r,n,a,o){if(t!==r||e!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:y(t,r)},{i:s-2,x:y(e,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,l),a=o=null,function(t){for(var e,r=-1,n=l.length;++r1e-6)if(Math.abs(f*l-c*u)>1e-6&&a){var p=n-o,d=i-s,g=l*l+c*c,m=p*p+d*d,v=Math.sqrt(g),y=Math.sqrt(h),x=a*Math.tan((e-Math.acos((g+h-m)/(2*v*y)))/2),b=x/y,_=x/v;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*u)+","+(r+b*f)),this._+="A"+a+","+a+",0,0,"+ +(f*p>u*d)+","+(this._x1=t+_*l)+","+(this._y1=r+_*c)}else this._+="L"+(this._x1=t)+","+(this._y1=r);else;},arc:function(t,i,a,o,s,l){t=+t,i=+i,l=!!l;var c=(a=+a)*Math.cos(o),u=a*Math.sin(o),f=t+c,h=i+u,p=1^l,d=l?o-s:s-o;if(a<0)throw new Error("negative radius: "+a);null===this._x1?this._+="M"+f+","+h:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-h)>1e-6)&&(this._+="L"+f+","+h),a&&(d<0&&(d=d%r+r),d>n?this._+="A"+a+","+a+",0,1,"+p+","+(t-c)+","+(i-u)+"A"+a+","+a+",0,1,"+p+","+(this._x1=f)+","+(this._y1=h):d>1e-6&&(this._+="A"+a+","+a+",0,"+ +(d>=e)+","+p+","+(this._x1=t+a*Math.cos(s))+","+(this._y1=i+a*Math.sin(s))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}},t.path=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],164:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var i,a,o,s,l,c,u,f,h,p=t._root,d={data:n},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(!p)return t._root=d,t;for(;p.length;)if((c=e>=(a=(g+v)/2))?g=a:v=a,(u=r>=(o=(m+y)/2))?m=o:y=o,i=p,!(p=p[f=u<<1|c]))return i[f]=d,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&r===l)return d.next=p,i?i[f]=d:t._root=d,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=e>=(a=(g+v)/2))?g=a:v=a,(u=r>=(o=(m+y)/2))?m=o:y=o}while((f=u<<1|c)==(h=(l>=o)<<1|s>=a));return i[h]=p,i[f]=d,t}function r(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i}function n(t){return t[0]}function i(t){return t[1]}function a(t,e,r){var a=new o(null==e?n:e,null==r?i:r,NaN,NaN,NaN,NaN);return null==t?a:a.addAll(t)}function o(t,e,r,n,i,a){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function s(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var l=a.prototype=o.prototype;l.copy=function(){var t,e,r=new o(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=s(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=s(e));return r},l.add=function(t){var r=+this._x.call(null,t),n=+this._y.call(null,t);return e(this.cover(r,n),r,n,t)},l.addAll=function(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),c=1/0,u=1/0,f=-1/0,h=-1/0;for(n=0;nf&&(f=i),ah&&(h=a));if(c>f||u>h)return this;for(this.cover(c,u).cover(f,h),n=0;nt||t>=i||n>e||e>=a;)switch(s=(ep||(o=c.y0)>d||(s=c.x1)=y)<<1|t>=v)&&(c=g[g.length-1],g[g.length-1]=g[g.length-1-u],g[g.length-1-u]=c)}else{var x=t-+this._x.call(null,m.data),b=e-+this._y.call(null,m.data),_=x*x+b*b;if(_=(s=(d+m)/2))?d=s:m=s,(u=o>=(l=(g+v)/2))?g=l:v=l,e=p,!(p=p[f=u<<1|c]))return this;if(!p.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(r=e,h=f)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,n?(i?n.next=i:delete n.next,this):e?(i?e[f]=i:delete e[f],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[h]=p:this._root=p),this):(this._root=i,this)},l.removeAll=function(t){for(var e=0,r=t.length;e1?0:t<-1?u:Math.acos(t)}function d(t){return t>=1?f:t<=-1?-f:Math.asin(t)}function g(t){return t.innerRadius}function m(t){return t.outerRadius}function v(t){return t.startAngle}function y(t){return t.endAngle}function x(t){return t&&t.padAngle}function b(t,e,r,n,i,a,o,s){var l=r-t,c=n-e,u=o-i,f=s-a,h=f*l-u*c;if(!(h*h<1e-12))return[t+(h=(u*(e-a)-f*(t-i))/h)*l,e+h*c]}function _(t,e,r,n,i,a,s){var l=t-r,u=e-n,f=(s?a:-a)/c(l*l+u*u),h=f*u,p=-f*l,d=t+h,g=e+p,m=r+h,v=n+p,y=(d+m)/2,x=(g+v)/2,b=m-d,_=v-g,w=b*b+_*_,T=i-a,k=d*v-m*g,M=(_<0?-1:1)*c(o(0,T*T*w-k*k)),A=(k*_-b*M)/w,S=(-k*b-_*M)/w,E=(k*_+b*M)/w,C=(-k*b+_*M)/w,L=A-y,I=S-x,P=E-y,z=C-x;return L*L+I*I>P*P+z*z&&(A=E,S=C),{cx:A,cy:S,x01:-h,y01:-p,x11:A*(i/T-1),y11:S*(i/T-1)}}function w(t){this._context=t}function T(t){return new w(t)}function k(t){return t[0]}function M(t){return t[1]}function A(){var t=k,n=M,i=r(!0),a=null,o=T,s=null;function l(r){var l,c,u,f=r.length,h=!1;for(null==a&&(s=o(u=e.path())),l=0;l<=f;++l)!(l=f;--h)c.point(v[h],y[h]);c.lineEnd(),c.areaEnd()}m&&(v[u]=+t(p,u,r),y[u]=+i(p,u,r),c.point(n?+n(p,u,r):v[u],a?+a(p,u,r):y[u]))}if(d)return c=null,d+""||null}function f(){return A().defined(o).curve(l).context(s)}return u.x=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),n=null,u):t},u.x0=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),u):t},u.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:r(+t),u):n},u.y=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),a=null,u):i},u.y0=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),u):i},u.y1=function(t){return arguments.length?(a=null==t?null:"function"==typeof t?t:r(+t),u):a},u.lineX0=u.lineY0=function(){return f().x(t).y(i)},u.lineY1=function(){return f().x(t).y(a)},u.lineX1=function(){return f().x(n).y(i)},u.defined=function(t){return arguments.length?(o="function"==typeof t?t:r(!!t),u):o},u.curve=function(t){return arguments.length?(l=t,null!=s&&(c=l(s)),u):l},u.context=function(t){return arguments.length?(null==t?s=c=null:c=l(s=t),u):s},u}function E(t,e){return et?1:e>=t?0:NaN}function C(t){return t}w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var L=P(T);function I(t){this._curve=t}function P(t){function e(e){return new I(t(e))}return e._curve=t,e}function z(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(P(t)):e()._curve},t}function O(){return z(A().curve(L))}function D(){var t=S().curve(L),e=t.curve,r=t.lineX0,n=t.lineX1,i=t.lineY0,a=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return z(r())},delete t.lineX0,t.lineEndAngle=function(){return z(n())},delete t.lineX1,t.lineInnerRadius=function(){return z(i())},delete t.lineY0,t.lineOuterRadius=function(){return z(a())},delete t.lineY1,t.curve=function(t){return arguments.length?e(P(t)):e()._curve},t}function R(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}I.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};var F=Array.prototype.slice;function B(t){return t.source}function N(t){return t.target}function j(t){var n=B,i=N,a=k,o=M,s=null;function l(){var r,l=F.call(arguments),c=n.apply(this,l),u=i.apply(this,l);if(s||(s=r=e.path()),t(s,+a.apply(this,(l[0]=c,l)),+o.apply(this,l),+a.apply(this,(l[0]=u,l)),+o.apply(this,l)),r)return s=null,r+""||null}return l.source=function(t){return arguments.length?(n=t,l):n},l.target=function(t){return arguments.length?(i=t,l):i},l.x=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),l):a},l.y=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),l):o},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function U(t,e,r,n,i){t.moveTo(e,r),t.bezierCurveTo(e=(e+n)/2,r,e,i,n,i)}function V(t,e,r,n,i){t.moveTo(e,r),t.bezierCurveTo(e,r=(r+i)/2,n,r,n,i)}function q(t,e,r,n,i){var a=R(e,r),o=R(e,r=(r+i)/2),s=R(n,r),l=R(n,i);t.moveTo(a[0],a[1]),t.bezierCurveTo(o[0],o[1],s[0],s[1],l[0],l[1])}var H={draw:function(t,e){var r=Math.sqrt(e/u);t.moveTo(r,0),t.arc(0,0,r,0,h)}},G={draw:function(t,e){var r=Math.sqrt(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},Y=Math.sqrt(1/3),W=2*Y,X={draw:function(t,e){var r=Math.sqrt(e/W),n=r*Y;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},Z=Math.sin(u/10)/Math.sin(7*u/10),J=Math.sin(h/10)*Z,K=-Math.cos(h/10)*Z,Q={draw:function(t,e){var r=Math.sqrt(.8908130915292852*e),n=J*r,i=K*r;t.moveTo(0,-r),t.lineTo(n,i);for(var a=1;a<5;++a){var o=h*a/5,s=Math.cos(o),l=Math.sin(o);t.lineTo(l*r,-s*r),t.lineTo(s*n-l*i,l*n+s*i)}t.closePath()}},$={draw:function(t,e){var r=Math.sqrt(e),n=-r/2;t.rect(n,n,r,r)}},tt=Math.sqrt(3),et={draw:function(t,e){var r=-Math.sqrt(e/(3*tt));t.moveTo(0,2*r),t.lineTo(-tt*r,-r),t.lineTo(tt*r,-r),t.closePath()}},rt=-.5,nt=Math.sqrt(3)/2,it=1/Math.sqrt(12),at=3*(it/2+1),ot={draw:function(t,e){var r=Math.sqrt(e/at),n=r/2,i=r*it,a=n,o=r*it+r,s=-a,l=o;t.moveTo(n,i),t.lineTo(a,o),t.lineTo(s,l),t.lineTo(rt*n-nt*i,nt*n+rt*i),t.lineTo(rt*a-nt*o,nt*a+rt*o),t.lineTo(rt*s-nt*l,nt*s+rt*l),t.lineTo(rt*n+nt*i,rt*i-nt*n),t.lineTo(rt*a+nt*o,rt*o-nt*a),t.lineTo(rt*s+nt*l,rt*l-nt*s),t.closePath()}},st=[H,G,X,$,Q,et,ot];function lt(){}function ct(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function ut(t){this._context=t}function ft(t){this._context=t}function ht(t){this._context=t}function pt(t,e){this._basis=new ut(t),this._beta=e}ut.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ct(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ft.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ht.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},pt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n,i=t[0],a=e[0],o=t[r]-i,s=e[r]-a,l=-1;++l<=r;)n=l/r,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+n*o),this._beta*e[l]+(1-this._beta)*(a+n*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var dt=function t(e){function r(t){return 1===e?new ut(t):new pt(t,e)}return r.beta=function(e){return t(+e)},r}(.85);function gt(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function mt(t,e){this._context=t,this._k=(1-e)/6}mt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:gt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:gt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var vt=function t(e){function r(t){return new mt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function yt(t,e){this._context=t,this._k=(1-e)/6}yt.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:gt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var xt=function t(e){function r(t){return new yt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function bt(t,e){this._context=t,this._k=(1-e)/6}bt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:gt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var _t=function t(e){function r(t){return new bt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function wt(t,e,r){var n=t._x1,i=t._y1,a=t._x2,o=t._y2;if(t._l01_a>1e-12){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>1e-12){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,a,o,t._x2,t._y2)}function Tt(t,e){this._context=t,this._alpha=e}Tt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var kt=function t(e){function r(t){return e?new Tt(t,e):new mt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Mt(t,e){this._context=t,this._alpha=e}Mt.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var At=function t(e){function r(t){return e?new Mt(t,e):new yt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function St(t,e){this._context=t,this._alpha=e}St.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Et=function t(e){function r(t){return e?new St(t,e):new bt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Ct(t){this._context=t}function Lt(t){return t<0?-1:1}function It(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(Lt(a)+Lt(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Pt(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function zt(t,e,r){var n=t._x0,i=t._y0,a=t._x1,o=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,i+s*e,a-s,o-s*r,a,o)}function Ot(t){this._context=t}function Dt(t){this._context=new Rt(t)}function Rt(t){this._context=t}function Ft(t){this._context=t}function Bt(t){var e,r,n=t.length-1,i=new Array(n),a=new Array(n),o=new Array(n);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[n-1]=(t[n]+i[n-1])/2,e=0;e1)for(var r,n,i,a=1,o=t[e[0]],s=o.length;a=0;)r[e]=e;return r}function Vt(t,e){return t[e]}function qt(t){var e=t.map(Ht);return Ut(t).sort((function(t,r){return e[t]-e[r]}))}function Ht(t){for(var e,r=-1,n=0,i=t.length,a=-1/0;++ra&&(a=e,n=r);return n}function Gt(t){var e=t.map(Yt);return Ut(t).sort((function(t,r){return e[t]-e[r]}))}function Yt(t){for(var e,r=0,n=-1,i=t.length;++n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}},t.arc=function(){var t=g,o=m,w=r(0),T=null,k=v,M=y,A=x,S=null;function E(){var r,g,m=+t.apply(this,arguments),v=+o.apply(this,arguments),y=k.apply(this,arguments)-f,x=M.apply(this,arguments)-f,E=n(x-y),C=x>y;if(S||(S=r=e.path()),v1e-12)if(E>h-1e-12)S.moveTo(v*a(y),v*l(y)),S.arc(0,0,v,y,x,!C),m>1e-12&&(S.moveTo(m*a(x),m*l(x)),S.arc(0,0,m,x,y,C));else{var L,I,P=y,z=x,O=y,D=x,R=E,F=E,B=A.apply(this,arguments)/2,N=B>1e-12&&(T?+T.apply(this,arguments):c(m*m+v*v)),j=s(n(v-m)/2,+w.apply(this,arguments)),U=j,V=j;if(N>1e-12){var q=d(N/m*l(B)),H=d(N/v*l(B));(R-=2*q)>1e-12?(O+=q*=C?1:-1,D-=q):(R=0,O=D=(y+x)/2),(F-=2*H)>1e-12?(P+=H*=C?1:-1,z-=H):(F=0,P=z=(y+x)/2)}var G=v*a(P),Y=v*l(P),W=m*a(D),X=m*l(D);if(j>1e-12){var Z,J=v*a(z),K=v*l(z),Q=m*a(O),$=m*l(O);if(E1e-12?V>1e-12?(L=_(Q,$,G,Y,v,V,C),I=_(J,K,W,X,v,V,C),S.moveTo(L.cx+L.x01,L.cy+L.y01),V1e-12&&R>1e-12?U>1e-12?(L=_(W,X,J,K,m,-U,C),I=_(G,Y,Q,$,m,-U,C),S.lineTo(L.cx+L.x01,L.cy+L.y01),U0&&(d+=f);for(null!=e?g.sort((function(t,r){return e(m[t],m[r])})):null!=n&&g.sort((function(t,e){return n(r[t],r[e])})),s=0,c=d?(y-p*b)/d:0;s0?f*c:0)+b,m[l]={data:r[l],index:s,value:f,startAngle:v,endAngle:u,padAngle:x};return m}return s.value=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,n=null,s):e},s.sort=function(t){return arguments.length?(n=t,e=null,s):n},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),s):i},s.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),s):a},s.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),s):o},s},t.pointRadial=R,t.radialArea=D,t.radialLine=O,t.stack=function(){var t=r([]),e=Ut,n=jt,i=Vt;function a(r){var a,o,s=t.apply(this,arguments),l=r.length,c=s.length,u=new Array(c);for(a=0;a0)for(var r,n,i,a,o,s,l=0,c=t[e[0]].length;l0?(n[0]=a,n[1]=a+=i):i<0?(n[1]=o,n[0]=o+=i):(n[0]=0,n[1]=i)},t.stackOffsetExpand=function(t,e){if((n=t.length)>0){for(var r,n,i,a=0,o=t[0].length;a0){for(var r,n=0,i=t[e[0]],a=i.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,i,a=0,o=1;o=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:mt,s:vt,S:q,u:H,U:G,V:Y,w:W,W:X,x:null,X:null,y:Z,Y:J,Z:K,"%":gt},Lt={a:function(t){return f[t.getUTCDay()]},A:function(t){return u[t.getUTCDay()]},b:function(t){return yt[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:Q,e:Q,f:nt,H:$,I:tt,j:et,L:rt,m:it,M:at,p:function(t){return c[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:mt,s:vt,S:ot,u:st,U:lt,V:ct,w:ut,W:ft,x:null,X:null,y:ht,Y:pt,Z:dt,"%":gt},It={a:function(t,e,r){var n=Tt.exec(e.slice(r));return n?(t.w=kt[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=_t.exec(e.slice(r));return n?(t.w=wt[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=St.exec(e.slice(r));return n?(t.m=Et[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=Mt.exec(e.slice(r));return n?(t.m=At[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return Ot(t,a,e,r)},d:M,e:M,f:I,H:S,I:S,j:A,L:L,m:k,M:E,p:function(t,e,r){var n=xt.exec(e.slice(r));return n?(t.p=bt[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:z,s:O,S:C,u:m,U:v,V:y,w:g,W:x,x:function(t,e,r){return Ot(t,o,e,r)},X:function(t,e,r){return Ot(t,l,e,r)},y:_,Y:b,Z:w,"%":P};function Pt(t,e){return function(r){var n,i,a,o=[],l=-1,c=0,u=t.length;for(r instanceof Date||(r=new Date(+r));++l53)return null;"w"in c||(c.w=1),"Z"in c?(l=(s=n(i(c.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(c.V-1)),c.y=s.getUTCFullYear(),c.m=s.getUTCMonth(),c.d=s.getUTCDate()+(c.w+6)%7):(l=(s=r(i(c.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(c.V-1)),c.y=s.getFullYear(),c.m=s.getMonth(),c.d=s.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),l="Z"in c?n(i(c.y,0,1)).getUTCDay():r(i(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(l+5)%7:c.w+7*c.U-(l+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Ot(t,e,r,n){for(var i,a,o=0,l=e.length,c=r.length;o=c)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=It[i in s?e.charAt(o++):i])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}return Ct.x=Pt(o,Ct),Ct.X=Pt(l,Ct),Ct.c=Pt(a,Ct),Lt.x=Pt(o,Lt),Lt.X=Pt(l,Lt),Lt.c=Pt(a,Lt),{format:function(t){var e=Pt(t+="",Ct);return e.toString=function(){return t},e},parse:function(t){var e=zt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=Pt(t+="",Lt);return e.toString=function(){return t},e},utcParse:function(t){var e=zt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function I(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function P(t,e,r){var n=c.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function z(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function O(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function D(t,e){return f(t.getDate(),e,2)}function R(t,e){return f(t.getHours(),e,2)}function F(t,e){return f(t.getHours()%12||12,e,2)}function B(t,r){return f(1+e.timeDay.count(e.timeYear(t),t),r,3)}function N(t,e){return f(t.getMilliseconds(),e,3)}function j(t,e){return N(t,e)+"000"}function U(t,e){return f(t.getMonth()+1,e,2)}function V(t,e){return f(t.getMinutes(),e,2)}function q(t,e){return f(t.getSeconds(),e,2)}function H(t){var e=t.getDay();return 0===e?7:e}function G(t,r){return f(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function Y(t,r){var n=t.getDay();return t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function W(t){return t.getDay()}function X(t,r){return f(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function Z(t,e){return f(t.getFullYear()%100,e,2)}function J(t,e){return f(t.getFullYear()%1e4,e,4)}function K(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+f(e/60|0,"0",2)+f(e%60,"0",2)}function Q(t,e){return f(t.getUTCDate(),e,2)}function $(t,e){return f(t.getUTCHours(),e,2)}function tt(t,e){return f(t.getUTCHours()%12||12,e,2)}function et(t,r){return f(1+e.utcDay.count(e.utcYear(t),t),r,3)}function rt(t,e){return f(t.getUTCMilliseconds(),e,3)}function nt(t,e){return rt(t,e)+"000"}function it(t,e){return f(t.getUTCMonth()+1,e,2)}function at(t,e){return f(t.getUTCMinutes(),e,2)}function ot(t,e){return f(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,r){return f(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ct(t,r){var n=t.getUTCDay();return t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function ut(t){return t.getUTCDay()}function ft(t,r){return f(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function ht(t,e){return f(t.getUTCFullYear()%100,e,2)}function pt(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function dt(){return"+0000"}function gt(){return"%"}function mt(t){return+t}function vt(t){return Math.floor(+t/1e3)}function yt(e){return o=a(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var xt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var bt=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=xt,t.isoParse=bt,t.timeFormatDefaultLocale=yt,t.timeFormatLocale=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":167}],167:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,i,a,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),i(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e0))return o;do{o.push(a=new Date(+e)),i(e,n),t(e)}while(a=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;i(t,-1),!e(t););else for(;--r>=0;)for(;i(t,1),!e(t););}))},a&&(s.count=function(n,i){return e.setTime(+n),r.setTime(+i),t(e),t(r),Math.floor(a(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var i=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):i:null};var a=i.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),c=l.range,u=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),f=u.range,h=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),p=h.range;function d(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var g=d(0),m=d(1),v=d(2),y=d(3),x=d(4),b=d(5),_=d(6),w=g.range,T=m.range,k=v.range,M=y.range,A=x.range,S=b.range,E=_.range,C=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),L=C.range,I=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));I.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var P=I.range,z=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),O=z.range,D=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),R=D.range,F=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),B=F.range;function N(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var j=N(0),U=N(1),V=N(2),q=N(3),H=N(4),G=N(5),Y=N(6),W=j.range,X=U.range,Z=V.range,J=q.range,K=H.range,Q=G.range,$=Y.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=h,t.timeDays=p,t.timeFriday=b,t.timeFridays=S,t.timeHour=u,t.timeHours=f,t.timeInterval=n,t.timeMillisecond=i,t.timeMilliseconds=a,t.timeMinute=l,t.timeMinutes=c,t.timeMonday=m,t.timeMondays=T,t.timeMonth=C,t.timeMonths=L,t.timeSaturday=_,t.timeSaturdays=E,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=g,t.timeSundays=w,t.timeThursday=x,t.timeThursdays=A,t.timeTuesday=v,t.timeTuesdays=k,t.timeWednesday=y,t.timeWednesdays=M,t.timeWeek=g,t.timeWeeks=w,t.timeYear=I,t.timeYears=P,t.utcDay=F,t.utcDays=B,t.utcFriday=G,t.utcFridays=Q,t.utcHour=D,t.utcHours=R,t.utcMillisecond=i,t.utcMilliseconds=a,t.utcMinute=z,t.utcMinutes=O,t.utcMonday=U,t.utcMondays=X,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=Y,t.utcSaturdays=$,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=j,t.utcSundays=W,t.utcThursday=H,t.utcThursdays=K,t.utcTuesday=V,t.utcTuesdays=Z,t.utcWednesday=q,t.utcWednesdays=J,t.utcWeek=j,t.utcWeeks=W,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],168:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e,r,n=0,i=0,a=0,o=0,s=0,l=0,c="object"==typeof performance&&performance.now?performance:Date,u="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function f(){return s||(u(h),s=c.now()+l)}function h(){s=0}function p(){this._call=this._time=this._next=null}function d(t,e,r){var n=new p;return n.restart(t,e,r),n}function g(){f(),++n;for(var t,r=e;r;)(t=s-r._time)>=0&&r._call.call(null,t),r=r._next;--n}function m(){s=(o=c.now())+l,n=i=0;try{g()}finally{n=0,function(){var t,n,i=e,a=1/0;for(;i;)i._call?(a>i._time&&(a=i._time),t=i,i=i._next):(n=i._next,i._next=null,i=t?t._next=n:e=n);r=t,y(a)}(),s=0}}function v(){var t=c.now(),e=t-o;e>1e3&&(l-=e,o=t)}function y(t){n||(i&&(i=clearTimeout(i)),t-s>24?(t<1/0&&(i=setTimeout(m,t-c.now()-l)),a&&(a=clearInterval(a))):(a||(o=c.now(),a=setInterval(v,1e3)),n=1,u(m)))}p.prototype=d.prototype={constructor:p,restart:function(t,n,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?f():+i)+(null==n?0:+n),this._next||r===this||(r?r._next=this:e=this,r=this),this._call=t,this._time=i,y()},stop:function(){this._call&&(this._call=null,this._time=1/0,y())}},t.interval=function(t,e,r){var n=new p,i=e;return null==e?(n.restart(t,e,r),n):(e=+e,r=null==r?f():+r,n.restart((function a(o){o+=i,n.restart(a,i+=e,r),t(o)}),e,r),n)},t.now=f,t.timeout=function(t,e,r){var n=new p;return e=null==e?0:+e,n.restart((function(r){n.stop(),t(r+e)}),e,r),n},t.timer=d,t.timerFlush=g,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],169:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},i=this.document;function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(i)try{n(i.documentElement.childNodes)[0].nodeType}catch(t){n=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),i)try{i.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,c=s.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){c.call(this,t,e,r+"")},u.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function h(t,e){return te?1:t>=e?0:NaN}function p(t){return null===t?NaN:+t}function d(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 m=g(h);function v(t){return t.length}t.bisectLeft=m.left,t.bisect=t.bisectRight=m.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 x(t){for(var e=1;t*e%1;)e*=10;return e}function b(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){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=x(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,c,u,f,h=-1,p=a.length,d=i[s++],g=new _;++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(j,"\\$&")};var j=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return U(t,Y),t}var q=function(t,e){return e.querySelector(t)},H=function(t,e){return e.querySelectorAll(t)},G=function(t,e){var r=t.matches||t[P(t,"matchesSelector")];return(G=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},H=Sizzle,G=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var Y=t.selection.prototype=[];function W(t){return"function"==typeof t?t:function(){return q(t,this)}}function X(t){return"function"==typeof t?t:function(){return H(t,this)}}Y.select=function(t){var e,r,n,i,a=[];t=W(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}},Y.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))},Y.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(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},Y.sort=function(t){t=ct.apply(this,arguments);for(var e=-1,r=this.length;++e=e&&(e=i+1);!(o=s[e])&&++e0&&(e=e.slice(0,o));var l=gt.get(e);function c(){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));c.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:c:r?O: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=Y.append,ht.empty=Y.empty,ht.node=Y.node,ht.call=Y.call,ht.size=Y.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s0?1:t<0?-1:0}function zt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Ot(t){return t>1?0:t<-1?At:Math.acos(t)}function Dt(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Rt(t){return((t=Math.exp(t))+1/t)/2}function Ft(t){return(t=Math.sin(t/2))*t}var Bt=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],c=e[2],u=s-i,f=l-a,h=u*u+f*f;if(h0&&(e=e.transition().duration(g)),e.call(w.event)}function S(){c&&c.domain(l.range().map((function(t){return(t-h.x)/h.k})).map(l.invert)),f&&f.domain(u.range().map((function(t){return(t-h.y)/h.k})).map(u.invert))}function E(t){m++||t({type:"zoomstart"})}function C(t){S(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function L(t){--m||(t({type:"zoomend"}),r=null)}function I(){var e=this,r=_.of(e,arguments),n=0,i=t.select(o(e)).on(y,l).on(x,c),a=T(t.mouse(e)),s=bt(e);function l(){n=1,M(t.mouse(e),a),C(r)}function c(){i.on(y,null).on(x,null),s(n),L(r)}vs.call(e),E(r)}function P(){var e,r=this,n=_.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,c="touchend"+o,u=[],f=t.select(r),p=bt(r);function d(){var n=t.touches(r);return e=h.k,n.forEach((function(t){t.identifier in i&&(i[t.identifier]=T(t))})),n}function g(){var e=t.event.target;t.select(e).on(l,m).on(c,y),u.push(e);for(var n=t.event.changedTouches,o=0,f=n.length;o1){v=p[0];var x=p[1],b=v[0]-x[0],_=v[1]-x[1];a=b*b+_*_}}function m(){var o,l,c,u,f=t.touches(r);vs.call(r);for(var h=0,p=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)||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 ne(a(t+120),a(t),a(t-120))}function Yt(e,r,n){return this instanceof Yt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Yt?new Yt(e.h,e.c,e.l):$t(e instanceof Zt?e.l:(e=ue((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Yt(e,r,n)}Ht.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new qt(this.h,this.s,this.l/t)},Ht.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new qt(this.h,this.s,t*this.l)},Ht.rgb=function(){return Gt(this.h,this.s,this.l)},t.hcl=Yt;var Wt=Yt.prototype=new Vt;function Xt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Zt(r,Math.cos(t*=Lt)*e,Math.sin(t)*e)}function Zt(t,e,r){return this instanceof Zt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Zt?new Zt(t.l,t.a,t.b):t instanceof Yt?Xt(t.h,t.c,t.l):ue((t=ne(t)).r,t.g,t.b):new Zt(t,e,r)}Wt.brighter=function(t){return new Yt(this.h,this.c,Math.min(100,this.l+Jt*(arguments.length?t:1)))},Wt.darker=function(t){return new Yt(this.h,this.c,Math.max(0,this.l-Jt*(arguments.length?t:1)))},Wt.rgb=function(){return Xt(this.h,this.c,this.l).rgb()},t.lab=Zt;var Jt=18,Kt=Zt.prototype=new Vt;function Qt(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ne(re(3.2404542*(i=.95047*te(i))-1.5371385*(n=1*te(n))-.4985314*(a=1.08883*te(a))),re(-.969266*i+1.8760108*n+.041556*a),re(.0556434*i-.2040259*n+1.0572252*a))}function $t(t,e,r){return t>0?new Yt(Math.atan2(r,e)*It,Math.sqrt(e*e+r*r),t):new Yt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,Gt):new ne(t,e,r)}function ie(t){return new ne(t>>16,t>>8&255,255&t)}function ae(t){return ie(t)+""}Kt.brighter=function(t){return new Zt(Math.min(100,this.l+Jt*(arguments.length?t:1)),this.a,this.b)},Kt.darker=function(t){return new Zt(Math.max(0,this.l-Jt*(arguments.length?t:1)),this.a,this.b)},Kt.rgb=function(){return Qt(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(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(he(i[0]),he(i[1]),he(i[2]))}return(a=pe.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 ce(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 qt(n,i,l)}function ue(t,e,r){var n=ee((.4124564*(t=fe(t))+.3575761*(e=fe(e))+.1804375*(r=fe(r)))/.95047),i=ee((.2126729*t+.7151522*e+.072175*r)/1);return Zt(116*i-16,500*(n-i),200*(i-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function he(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.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,c)}catch(t){return void s.error.call(o,t)}s.load.call(o,t)}else s.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(e)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(e){var r=t.event;t.event=e;try{s.progress.call(o,c)}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?(u=t,o):u},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),c.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),c.setRequestHeader)for(var a in l)c.setRequestHeader(a,l[a]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=i&&o.on("error",i).on("load",(function(t){i(null,t)})),s.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.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))}pe.forEach((function(t,e){pe.set(t,ie(e))})),t.functor=de,t.xhr=ge(L),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=me(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,c=0,u=0;function f(){if(c>=l)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(be),be=setTimeout(Te,e)),xe=0):(xe=1,_e(Te))}function ke(){for(var t=Date.now(),e=ve;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Me(){for(var t,e=ve,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Ee(e){var r=e.decimal,n=e.thousands,i=e.grouping,a=e.currency,o=i&&n?function(t,e){for(var r=t.length,a=[],o=0,s=i[0],l=0;r>0&&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)}:L;return function(e){var n=Ce.exec(e),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],h=n[7],p=n[8],d=n[9],g=1,m="",v="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===i&&"="===s)&&(u=i="0",s="="),d){case"n":h=!0,d="g";break;case"%":g=100,v="%",d="f";break;case"p":g=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===c&&(m="0"+d.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,d="r"}"$"===c&&(m=a[0],v=a[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=Le.get(d)||Ie;var b=u&&h;return function(e){var n=v;if(y&&e%1)return"";var a=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(g<0){var c=t.formatPrefix(e,p);e=c.scale(e),n=c.symbol+v}else e*=g;var _,w,T=(e=d(e,p)).lastIndexOf(".");if(T<0){var k=x?e.lastIndexOf("e"):-1;k<0?(_=e,w=""):(_=e.substring(0,k),w=e.substring(k))}else _=e.substring(0,T),w=r+e.substring(T+1);!u&&h&&(_=o(_,1/0));var M=m.length+_.length+w.length+(b?0:a.length),A=M"===s?A+a+e:"^"===s?A.substring(0,M>>=1)+a+e+A.substring(M):a+(b?e:A+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Ae(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,Le=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,Ae(e,r))).toFixed(Math.max(0,Math.min(20,Ae(e*(1+1e-15),r))))}});function Ie(t){return t+""}var Pe=t.time={},ze=Date;function Oe(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Oe.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(){De.setUTCDate.apply(this._,arguments)},setDay:function(){De.setUTCDay.apply(this._,arguments)},setFullYear:function(){De.setUTCFullYear.apply(this._,arguments)},setHours:function(){De.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){De.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){De.setUTCMinutes.apply(this._,arguments)},setMonth:function(){De.setUTCMonth.apply(this._,arguments)},setSeconds:function(){De.setUTCSeconds.apply(this._,arguments)},setTime:function(){De.setTime.apply(this._,arguments)}};var De=Date.prototype;function Re(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o=c)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=w[o in Ne?e.charAt(s++):o])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}u.utc=function(t){var e=u(t);function r(t){try{var r=new(ze=Oe);return r._=t,e(r)}finally{ze=Date}}return r.parse=function(t){try{ze=Oe;var r=e.parse(t);return r&&r._}finally{ze=Date}},r.toString=e.toString,r},u.multi=u.utc.multi=or;var h=t.map(),p=qe(o),d=He(o),g=qe(s),m=He(s),v=qe(l),y=He(l),x=qe(c),b=He(c);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 c[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:u(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:u(n),X:u(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=m.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){v.lastIndex=0;var n=v.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:Qe,e:Qe,H:tr,I:tr,j:$e,L:nr,m:Ke,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:Ye,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:Xe,Z:Je,"%":ar};return u}Pe.year=Re((function(t){return(t=Pe.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),Pe.years=Pe.year.range,Pe.years.utc=Pe.year.utc.range,Pe.day=Re((function(t){var e=new ze(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t){return t.getDate()-1})),Pe.days=Pe.day.range,Pe.days.utc=Pe.day.utc.range,Pe.dayOfYear=function(t){var e=Pe.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,e){e=7-e;var r=Pe[t]=Re((function(t){return(t=Pe.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t}),(function(t,e){t.setDate(t.getDate()+7*Math.floor(e))}),(function(t){var r=Pe.year(t).getDay();return Math.floor((Pe.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));Pe[t+"s"]=r.range,Pe[t+"s"].utc=r.utc.range,Pe[t+"OfYear"]=function(t){var r=Pe.year(t).getDay();return Math.floor((Pe.dayOfYear(t)+(r+e)%7)/7)}})),Pe.week=Pe.sunday,Pe.weeks=Pe.sunday.range,Pe.weeks.utc=Pe.sunday.utc.range,Pe.weekOfYear=Pe.sundayOfYear;var Ne={"-":"",_:" ",0:"0"},je=/^\s*\d+/,Ue=/^%/;function Ve(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a68?1900:2e3),r+i[0].length):-1}function Je(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Ke(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Qe(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function $e(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){je.lastIndex=0;var n=je.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;++r=0?1:-1,s=o*a,l=Math.cos(e),c=Math.sin(e),u=i*c,f=n*l+u*Math.cos(s),h=u*o*Math.sin(s);Er.add(Math.atan2(h,f)),r=t,n=l,i=c}Cr.point=function(o,s){Cr.point=a,r=(t=o)*Lt,n=Math.cos(s=(e=s)*Lt/2+At/4),i=Math.sin(s)},Cr.lineEnd=function(){a(t,e)}}function Ir(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 Pr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function zr(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 Or(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Dr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Rr(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 Fr(t){return[Math.atan2(t[1],t[0]),Dt(t[2])]}function Br(t,e){return y(t[0]-e[0])kt?i=90:c<-kt&&(r=-90),f[0]=e,f[1]=n}};function p(t,a){u.push(f=[e=t,n=t]),ai&&(i=a)}function d(t,o){var s=Ir([t*Lt,o*Lt]);if(l){var c=zr(l,s),u=zr([c[1],-c[0],0],c);Rr(u),u=Fr(u);var f=t-a,h=f>0?1:-1,d=u[0]*It*h,g=y(f)>180;if(g^(h*ai&&(i=m);else if(g^(h*a<(d=(d+360)%360-180)&&di&&(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 p(t,o);l=s,a=t}function g(){h.point=d}function m(){f[0]=e,f[1]=n,h.point=p,l=null}function v(t,e){if(l){var r=t-a;c+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Cr.point(t,e),d(t,e)}function x(){Cr.lineStart()}function b(){v(o,s),Cr.lineEnd(),y(c)>kt&&(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 T(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):s.push(g=p);for(var l,c,p,d=-1/0,g=(o=0,s[c=s.length-1]);o<=c;g=p,++o)p=s[o],(l=_(g[1],p[0]))>d&&(d=l,e=p[0],n=g[1])}return u=f=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,i]]}}(),t.geo.centroid=function(e){vr=yr=xr=br=_r=wr=Tr=kr=Mr=Ar=Sr=0,t.geo.stream(e,Nr);var r=Mr,n=Ar,i=Sr,a=r*r+n*n+i*i;return a=0;--s)i.point((f=u[s])[0],f[1]);else n(p.x,p.p.x,-1,i);p=p.p}u=(p=p.o).z,d=!d}while(!p.v);i.lineEnd()}}}function Xr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,T=w*_,k=T>At,M=d*x;if(Er.add(Math.atan2(M*w*Math.sin(T),g*b+M*Math.cos(T))),a+=k?_+w*St:_,k^h>=r^v>=r){var A=zr(Ir(f),Ir(t));Rr(A);var S=zr(i,A);Rr(S);var E=(k^_>=0?-1:1)*Dt(S[2]);(n>E||n===E&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!m++)break;h=v,d=x,g=b,f=t}}return(a<-kt||a0){for(x||(o.polygonStart(),x=!0),o.lineStart();++a1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter(Kr))}return u}}function Kr(t){return t.length>1}function Qr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:O,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]-Ct-kt:Ct-t[1])-((e=e.x)[0]<0?e[1]-Ct-kt:Ct-e[1])}var tn=Jr(Yr,(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?At:-At,l=y(a-r);y(l-At)0?Ct:-Ct),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=At&&(y(r-i)kt?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*Ct,n.point(-At,i),n.point(0,i),n.point(At,i),n.point(At,0),n.point(At,-i),n.point(0,-i),n.point(-At,-i),n.point(-At,0),n.point(-At,i);else if(y(t[0]-e[0])>kt){var a=t[0]0,n=y(e)>kt;return Jr(i,(function(t){var e,s,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(f,h){var p,d=[f,h],g=i(f,h),m=r?g?0:o(f,h):g?o(f+(f<0?At:-At),h):0;if(!e&&(c=l=g)&&t.lineStart(),g!==l&&(p=a(e,d),(Br(e,p)||Br(d,p))&&(d[0]+=kt,d[1]+=kt,g=i(d[0],d[1]))),g!==l)u=0,g?(t.lineStart(),p=a(d,e),t.point(p[0],p[1])):(p=a(e,d),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(n&&e&&r^g){var v;m&s||!(v=a(d,e,!0))||(u=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!g||e&&Br(e,d)||t.point(d[0],d[1]),e=d,l=g,s=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}}),Bn(t,6*Lt),r?[0,-t]:[-At,t-At]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function a(t,r,n){var i=[1,0,0],a=zr(Ir(t),Ir(r)),o=Pr(a,a),s=a[0],l=o-s*s;if(!l)return!n&&t;var c=e*o/l,u=-e*s/l,f=zr(i,a),h=Dr(i,c);Or(h,Dr(a,u));var p=f,d=Pr(h,p),g=Pr(p,p),m=d*d-g*(Pr(h,h)-1);if(!(m<0)){var v=Math.sqrt(m),x=Dr(p,(-d-v)/g);if(Or(x,h),x=Fr(x),!n)return x;var b,_=t[0],w=r[0],T=t[1],k=r[1];w<_&&(b=_,_=w,w=b);var M=w-_,A=y(M-At)0^x[1]<(y(x[0]-_)At^(_<=x[0]&&x[0]<=w)){var S=Dr(p,(-d+v)/g);return Or(S,h),[x,Fr(S)]}}}function o(e,n){var i=r?t:At-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}function rn(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,c=o.y,u=0,f=1,h=s.x-l,p=s.y-c;if(a=t-l,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>f)return;a>u&&(u=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>u&&(u=a)}else if(h>0){if(a0)){if(a/=p,p<0){if(a0){if(a>f)return;a>u&&(u=a)}if(a=n-c,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>u&&(u=a)}else if(p>0){if(a0&&(i.a={x:l+u*h,y:c+u*p}),f<1&&(i.b={x:l+f*h,y:c+f*p}),i}}}}}}function nn(e,r,n,i){return function(l){var c,u,f,h,p,d,g,m,v,y,x,b=l,_=Qr(),w=rn(e,r,n,i),T={point:A,lineStart:function(){T.point=S,u&&u.push(f=[]);y=!0,v=!1,g=m=NaN},lineEnd:function(){c&&(S(h,p),d&&v&&_.rejoin(),c.push(_.buffer()));T.point=A,v&&l.lineEnd()},polygonStart:function(){l=_,c=[],u=[],x=!0},polygonEnd:function(){l=b,c=t.merge(c);var r=function(t){for(var e=0,r=u.length,n=t[1],i=0;in&&zt(c,a,t)>0&&++e:a[1]<=n&&zt(c,a,t)<0&&--e,c=a;return 0!==e}([e,i]),n=x&&r,a=c.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),k(null,null,1,l),l.lineEnd()),a&&Wr(c,o,r,k,l),l.polygonEnd()),c=u=f=null}};function k(t,o,l,c){var u=0,f=0;if(null==t||(u=a(t,l))!==(f=a(o,l))||s(t,o)<0^l>0)do{c.point(0===u||3===u?e:n,u>1?i:r)}while((u=(u+l+4)%4)!==f);else c.point(o[0],o[1])}function M(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function A(t,e){M(t,e)&&l.point(t,e)}function S(t,e){var r=M(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(u&&f.push([t,e]),y)h=t,p=e,d=r,y=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&v)l.point(t,e);else{var n={a:{x:g,y:m},b:{x:t,y:e}};w(n)?(v||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),x=!1):r&&(l.lineStart(),l.point(t,e),x=!1)}g=t,m=e,v=r}return T};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=At/3,n=Ln(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*At/180,r=t[1]*At/180):[e/At*180,r/At*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,Dt((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 c(t){var a=t[0],o=t[1];return e=null,r(a,o),e||(n(a,o),e)||i(a,o),e}return c.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)},c.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()}}},c.precision=function(t){return arguments.length?(a.precision(t),o.precision(t),s.precision(t),c):a.precision()},c.scale=function(t){return arguments.length?(a.scale(t),o.scale(.35*t),s.scale(t),c.translate(a.translate())):a.scale()},c.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),u=+t[0],f=+t[1];return r=a.translate(t).clipExtent([[u-.455*e,f-.238*e],[u+.455*e,f+.238*e]]).stream(l).point,n=o.translate([u-.307*e,f+.201*e]).clipExtent([[u-.425*e+kt,f+.12*e+kt],[u-.214*e-kt,f+.234*e-kt]]).stream(l).point,i=s.translate([u-.205*e,f+.212*e]).clipExtent([[u-.214*e+kt,f+.166*e+kt],[u-.115*e-kt,f+.234*e-kt]]).stream(l).point,c},c.scale(1070)};var sn,ln,cn,un,fn,hn,pn={point:O,lineStart:O,lineEnd:O,polygonStart:function(){ln=0,pn.lineStart=dn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=O,sn+=y(ln/2)}};function dn(){var t,e,r,n;function i(t,e){ln+=n*t-r*e,r=t,n=e}pn.point=function(a,o){pn.point=i,t=r=a,e=n=o},pn.lineEnd=function(){i(t,e)}}var gn={point:function(t,e){tfn&&(fn=t);ehn&&(hn=e)},lineStart:O,lineEnd:O,polygonStart:O,polygonEnd:O};function mn(){var t=vn(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=vn(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 vn(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,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(t,e){xr+=t,br+=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,Tr+=o*(e+n)/2,kr+=o,bn(t=r,e=n)}xn.point=function(n,i){xn.point=r,bn(t=n,e=i)}}function wn(){xn.point=bn}function Tn(){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,Tr+=o*(n+e)/2,kr+=o,Mr+=(o=n*t-r*e)*(r+t),Ar+=o*(n+e),Sr+=3*o,bn(r=t,n=e)}xn.point=function(a,o){xn.point=i,bn(t=r=a,e=n=o)},xn.lineEnd=function(){i(t,e)}}function kn(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:O};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,St)}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 Mn(t){var e=.5,r=Math.cos(30*Lt),n=16;function i(t){return(n?o:a)(t)}function a(e){return En(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,i,a,o,l,c,u,f,h,p,d,g,m={point:v,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),m.lineStart=_},polygonEnd:function(){e.polygonEnd(),m.lineStart=y}};function v(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){f=NaN,m.point=x,e.lineStart()}function x(r,i){var a=Ir([r,i]),o=t(r,i);s(f,h,u,p,d,g,f=o[0],h=o[1],u=r,p=a[0],d=a[1],g=a[2],n,e),e.point(f,h)}function b(){m.point=v,e.lineEnd()}function _(){y(),m.point=w,m.lineEnd=T}function w(t,e){x(r=t,e),i=f,a=h,o=p,l=d,c=g,m.point=x}function T(){s(f,h,u,p,d,g,i,a,r,o,l,c,n,e),m.lineEnd=b,b()}return m}function s(n,i,a,o,l,c,u,f,h,p,d,g,m,v){var x=u-n,b=f-i,_=x*x+b*b;if(_>4*e&&m--){var w=o+p,T=l+d,k=c+g,M=Math.sqrt(w*w+T*T+k*k),A=Math.asin(k/=M),S=y(y(k)-1)e||y((x*I+b*P)/_-.5)>.3||o*p+l*d+c*g0&&16,i):Math.sqrt(e)},i}function An(t){var e=Mn((function(e,r){return t([e*It,r*It])}));return function(t){return In(e(t))}}function Sn(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 Cn(t){return Ln((function(){return t}))()}function Ln(e){var r,n,i,a,o,s,l=Mn((function(t,e){return[(t=r(t,e))[0]*c+a,o-t[1]*c]})),c=150,u=480,f=250,h=0,p=0,d=0,g=0,m=0,v=tn,y=L,x=null,b=null;function _(t){return[(t=i(t[0]*Lt,t[1]*Lt))[0]*c+a,o-t[1]*c]}function w(t){return(t=i.invert((t[0]-a)/c,(o-t[1])/c))&&[t[0]*It,t[1]*It]}function T(){i=Gr(n=On(d,g,m),r);var t=r(h,p);return a=u-t[0]*c,o=f+t[1]*c,k()}function k(){return s&&(s.valid=!1,s=null),_}return _.stream=function(t){return s&&(s.valid=!1),(s=In(v(n,l(y(t))))).valid=!0,s},_.clipAngle=function(t){return arguments.length?(v=null==t?(x=t,tn):en((x=+t)*Lt),k()):x},_.clipExtent=function(t){return arguments.length?(b=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):L,k()):b},_.scale=function(t){return arguments.length?(c=+t,T()):c},_.translate=function(t){return arguments.length?(u=+t[0],f=+t[1],T()):[u,f]},_.center=function(t){return arguments.length?(h=t[0]%360*Lt,p=t[1]%360*Lt,T()):[h*It,p*It]},_.rotate=function(t){return arguments.length?(d=t[0]%360*Lt,g=t[1]%360*Lt,m=t.length>2?t[2]%360*Lt:0,T()):[d*It,g*It,m*It]},t.rebind(_,l,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,T()}}function In(t){return En(t,(function(e,r){t.point(e*Lt,r*Lt)}))}function Pn(t,e){return[t,e]}function zn(t,e){return[t>At?t-St:t<-At?t+St:t,e]}function On(t,e,r){return t?e||r?Gr(Rn(t),Fn(e,r)):Rn(t):e||r?Fn(e,r):zn}function Dn(t){return function(e,r){return[(e+=t)>At?e-St:e<-At?e+St:e,r]}}function Rn(t){var e=Dn(t);return e.invert=Dn(-t),e}function Fn(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,c=Math.sin(e),u=c*r+s*n;return[Math.atan2(l*i-u*a,s*r-c*n),Dt(u*i+l*a)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,c=Math.sin(e),u=c*i-l*a;return[Math.atan2(l*i+c*a,s*r+u*n),Dt(u*r-s*n)]},o}function Bn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Nn(r,i),a=Nn(r,a),(o>0?ia)&&(i+=o*St)):(i=t+o*St,a=t-.5*l);for(var c,u=i;o>0?u>a:u2?t[2]*Lt:0),e.invert=function(e){return(e=t.invert(e[0]*Lt,e[1]*Lt))[0]*=It,e[1]*=It,e},e},zn.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=On(-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]*=It,t[1]*=It}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=Bn((t=+r)*Lt,n*Lt),i):t},i.precision=function(r){return arguments.length?(e=Bn(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),c=Math.cos(i),u=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-l*f*s)*r),l*u+c*f*s)},t.geo.graticule=function(){var e,r,n,i,a,o,s,l,c,u,f,h,p=10,d=p,g=90,m=360,v=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return t.range(Math.ceil(i/g)*g,n,g).map(f).concat(t.range(Math.ceil(l/m)*m,s,m).map(h)).concat(t.range(Math.ceil(r/p)*p,e,p).filter((function(t){return y(t%g)>kt})).map(c)).concat(t.range(Math.ceil(o/d)*d,a,d).filter((function(t){return y(t%m)>kt})).map(u))}return x.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(h(s).slice(1),f(n).reverse().slice(1),h(l).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.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),x.precision(v)):[[i,l],[n,s]]},x.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),x.precision(v)):[[r,o],[e,a]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(g=+t[0],m=+t[1],x):[g,m]},x.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],x):[p,d]},x.precision=function(t){return arguments.length?(v=+t,c=jn(o,a,90),u=Un(r,e,v),f=jn(l,s,90),h=Un(i,n,v),x):v},x.majorExtent([[-180,-90+kt],[180,90-kt]]).minorExtent([[-180,-80-kt],[180,80+kt]])},t.geo.greatArc=function(){var e,r,n=Vn,i=qn;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),c=Math.sin(a),u=o*Math.cos(r),f=o*Math.sin(r),h=l*Math.cos(i),p=l*Math.sin(i),d=2*Math.asin(Math.sqrt(Ft(a-n)+o*l*Ft(i-r))),g=1/Math.sin(d),(m=d?function(t){var e=Math.sin(t*=d)*g,r=Math.sin(d-t)*g,n=r*u+e*h,i=r*f+e*p,a=r*s+e*c;return[Math.atan2(i,n)*It,Math.atan2(a,Math.sqrt(n*n+i*i))*It]}:function(){return[r*It,n*It]}).distance=d,m;var r,n,i,a,o,s,l,c,u,f,h,p,d,g,m},t.geo.length=function(e){return yn=0,t.geo.stream(e,Hn),yn};var Hn={sphere:O,point:O,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=O}},lineEnd:O,polygonStart:O,polygonEnd:O};function Gn(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 Yn=Gn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Cn(Yn)}).raw=Yn;var Wn=Gn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),L);function Xn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(At/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 Kn;function o(t,e){a>0?e<-Ct+kt&&(e=-Ct+kt):e>Ct-kt&&(e=Ct-kt);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))-Ct]},o}function Zn(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&&zt(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ai(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Cn(ti)}).raw=ti,ei.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=Qn(ei),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=ei,t.geom={},t.geom.hull=function(t){var e=ri,r=ni;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=de(e),a=de(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)p.push(t[s[c[n]][2]]);for(n=+f;nkt)s=s.L;else{if(!((i=a-Ti(s,o))>kt)){n>-kt?(e=s.P,r=s):i>-kt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=yi(t);if(hi.insert(e,l),e||r){if(e===r)return Ei(e),r=yi(e.site),hi.insert(l,r),l.edge=r.edge=Ii(e.site,l.site),Si(e),void Si(r);if(r){Ei(e),Ei(r);var c=e.site,u=c.x,f=c.y,h=t.x-u,p=t.y-f,d=r.site,g=d.x-u,m=d.y-f,v=2*(h*m-p*g),y=h*h+p*p,x=g*g+m*m,b={x:(m*y-p*x)/v+u,y:(h*x-g*y)/v+f};zi(r.edge,c,d,b),l.edge=Ii(c,t,null,b),r.edge=Ii(t,d,null,b),Si(e),Si(r)}else l.edge=Ii(e.site,l.site)}}function wi(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,c=l-e;if(!c)return s;var u=s-n,f=1/a-1/c,h=u/c;return f?(-h+Math.sqrt(h*h-2*f*(u*u/(-2*c)-l+c/2+i-a/2)))/f+n:(n+s)/2}function Ti(t,e){var r=t.N;if(r)return wi(r,e);var n=t.site;return n.y===e?n.x:1/0}function ki(t){this.site=t,this.edges=[]}function Mi(t,e){return e.angle-t.angle}function Ai(){Ri(this),this.x=this.y=this.arc=this.site=this.cy=null}function Si(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,c=n.y-s,u=a.x-o,f=2*(l*(m=a.y-s)-c*u);if(!(f>=-Mt)){var h=l*l+c*c,p=u*u+m*m,d=(m*h-c*p)/f,g=(l*p-u*h)/f,m=g+s,v=mi.pop()||new Ai;v.arc=t,v.site=i,v.x=d+o,v.y=m+Math.sqrt(d*d+g*g),v.cy=m,t.circle=v;for(var y=null,x=di._;x;)if(v.y=s)return;if(h>d){if(a){if(a.y>=c)return}else a={x:m,y:l};r={x:m,y:c}}else{if(a){if(a.y1)if(h>d){if(a){if(a.y>=c)return}else a={x:(l-i)/n,y:l};r={x:(c-i)/n,y:c}}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.xkt||y(i-r)>kt)&&(s.splice(o,0,new Oi(Pi(a.site,u,y(n-f)kt?{x:f,y:y(e-f)kt?{x:y(r-d)kt?{x:h,y:y(e-h)kt?{x:y(r-p)=r&&c.x<=i&&c.y>=n&&c.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)/kt)*kt,y:Math.round(i(t,e)/kt)*kt,i:e}}))}return o.links=function(t){return ji(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 ji(s(t)).cells.forEach((function(r,n){for(var i,a,o,s,l=r.site,c=r.edges.sort(Mi),u=-1,f=c.length,h=c[f-1].edge,p=h.l===l?h.r:h.l;++ua||f>o||h=_)<<1|e>=b,T=w+4;wa&&(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:Zi(r,n)})),a=Qi.lastIndex;return ag&&(g=l.x),l.y>m&&(m=l.y),c.push(l.x),u.push(l.y);else for(f=0;fg&&(g=b),_>m&&(m=_),c.push(b),u.push(_)}var w=g-p,T=m-d;function k(t,e,r,n,i,a,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(y(l-r)+y(c-n)<.01)M(t,e,r,n,i,a,o,s);else{var u=t.point;t.x=t.y=t.point=null,M(t,u,l,c,i,a,o,s),M(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else M(t,e,r,n,i,a,o,s)}function M(t,e,r,n,i,a,o,s){var l=.5*(i+o),c=.5*(a+s),u=r>=l,f=n>=c,h=f<<1|u;t.leaf=!1,u?i=l:o=l,f?a=c:s=c,k(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,i,a,o,s)}w>T?m=d+w:g=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(A,t,+v(t,++f),+x(t,f),p,d,g,m)},visit:function(t){Gi(t,A,p,d,g,m)},find:function(t){return Yi(A,t[0],t[1],p,d,g,m)}};if(f=-1,null==e){for(;++f=0&&!(n=t.interpolators[i](e,r)););return n}function ta(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1?1:t(e)}}function aa(t){return function(e){return 1-t(1-e)}}function oa(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function sa(t){return t*t}function la(t){return t*t*t}function ca(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ua(t){return 1-Math.cos(t*Ct)}function fa(t){return Math.pow(2,10*(t-1))}function ha(t){return 1-Math.sqrt(1-t*t)}function pa(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 da(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function ga(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=va(i),s=ma(i,a),l=va(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=ra.get(n)||ea,ia((i=na.get(i)||L)(n.apply(null,r.call(arguments,1))))},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 Xt(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 Gt(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 Qt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=da,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 ga(e?e.matrix:ya)})(e)},ga.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ya={a:1,b:0,c:0,d:1,e:0,f:0};function xa(t){return t.length?t.pop()+",":""}function ba(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:Zi(t[0],e[0])},{i:i-2,x:Zi(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(xa(r)+"rotate(",null,")")-2,x:Zi(t,e)})):e&&r.push(xa(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(xa(r)+"skewX(",null,")")-2,x:Zi(t,e)}):e&&r.push(xa(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(xa(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Zi(t[0],e[0])},{i:i-2,x:Zi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(xa(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=we(s.tick)),s):n},s.start=function(){var t,e,r,n=v.length,l=y.length,u=c[0],d=c[1];for(t=0;t=0;)r.push(i[n])}function Oa(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(u=c[l]),u.parent=a,u.depth=a.depth+1;r&&(a.value=0),a.children=c}else r&&(a.value=+r.call(n,a,a.depth)||0),delete a.children;return Oa(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&&(za(t,(function(t){t.children&&(t.value=0)})),Oa(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,c=-1;for(n=e.value?n/e.value:0;++cs&&(s=n),o.push(n)}for(r=0;ri&&(n=r,i=e);return n}function Xa(t){return t.reduce(Za,0)}function Za(t,e){return t+e[1]}function Ja(t,e){return Ka(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ka(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 Qa(e){return[t.min(e),t.max(e)]}function $a(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(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 no(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,c=1/0,u=-1/0,f=1/0,h=-1/0;if(e.forEach(io),(r=e[0]).x=-r.r,r.y=0,x(r),l>1&&((n=e[1]).x=n.r,n.y=0,x(n),l>2))for(oo(r,n,i=e[2]),x(i),to(r,i),r._pack_prev=i,to(i,n),n=r._pack_next,a=3;a0)for(o=-1;++o=f[0]&&l<=f[1]&&((s=c[t.bisect(h,l,1,d)-1]).y+=g,s.push(a[o]));return c}return a.value=function(t){return arguments.length?(r=t,a):r},a.range=function(t){return arguments.length?(n=de(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Ka(e,t)}:de(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($a),n=0,i=[1,1];function a(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],c=i[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,Oa(s,(function(t){t.r=+u(t.value)})),Oa(s,no),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;Oa(s,(function(t){t.r+=f})),Oa(s,no),Oa(s,(function(t){t.r-=f}))}return function t(e,r,n,i){var a=e.children;if(e.x=r+=i*e.x,e.y=n+=i*e.y,e.r*=i,a)for(var o=-1,s=a.length;++op.x&&(p=t),t.depth>d.depth&&(d=t)}));var g=r(h,p)/2-h.x,m=n[0]/(p.x+r(p,h)/2+g),v=n[1]/(d.depth||1);za(u,(function(t){t.x=(t.x+g)*m,t.y=t.depth*v}))}return c}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],c=a.m,u=o.m,f=s.m,h=l.m;s=co(s),a=lo(a),s&&a;)l=lo(l),(o=co(o)).a=t,(i=s.z+f-a.z-c+r(s._,a._))>0&&(uo(fo(s,t,n),t,i),c+=i,u+=i),f+=s.m,c+=a.m,h+=l.m,u+=o.m;s&&!co(o)&&(o.t=s,o.m+=f-u),a&&!lo(l)&&(l.t=a,l.m+=c-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},Pa(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),c=l[0],u=0;Oa(c,(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?u+=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}(c),h=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(c),p=f.x-r(f,h)/2,d=h.x+r(h,f)/2;return Oa(c,i?function(t){t.x=(t.x-c.x)*n[0],t.y=(c.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(d-p)*n[0],t.y=(1-(c.y?t.y/c.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},Pa(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=ho,s=!1,l="squarify",c=.5*(1+Math.sqrt(5));function u(t,e){for(var r,n,i=-1,a=t.length;++i0;)s.push(r=c[i-1]),s.area+=r.area,"squarify"!==l||(n=p(s,g))<=h?(c.pop(),h=n):(s.area-=s.pop().area,d(s,g,a,!1),g=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(d(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(u(i,n.dx*n.dy/t.value),a.area=0;r=i.pop();)a.push(r),a.area+=r.area,null!=r.z&&(d(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(h)}}function p(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*c/n,n/(e*a*c)):1/0}function d(t,e,r,i){var a,o=-1,s=t.length,l=r.x,c=r.y,u=e?n(t.area/e):0;if(e==r.dx){for((i||u>r.dy)&&(u=r.dy);++or.dx)&&(u=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?_o:vo,s=i?wa:_a;return a=t(e,r,s,n),o=t(r,e,s,$i),l}function l(t){return a(t)}return 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(da)},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 Mo(e,t)},l.tickFormat=function(t,r){return Ao(e,t,r)},l.nice=function(t){return To(e,t),s()},l.copy=function(){return t(e,r,n,i)},s()}([0,1],[0,1],$i,!1)};var So={s:1,g:1,p:1,r:1,e:1};function Eo(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))}return 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=yo(a.map(o),i?Math:Lo);return r.domain(t),a=t.map(s),l},l.ticks=function(){var t=go(a),e=[],r=t[0],l=t[1],c=Math.floor(o(r)),u=Math.ceil(o(l)),f=n%1?2:n;if(isFinite(u-c)){if(i){for(;c0;h--)e.push(s(c)*h);for(c=0;e[c]l;u--);e=e.slice(c,u)}return e},l.tickFormat=function(e,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"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(c=Et)return l(c,p)+(s?l(s,1-p):"")+"Z";var d,g,m,v,y,x,b,_,w,T,k,M,A=0,S=0,E=[];if((v=(+o.apply(this,arguments)||0)/2)&&(m=n===Fo?Math.sqrt(s*s+c*c):+n.apply(this,arguments),p||(S*=-1),c&&(S=Dt(m/c*Math.sin(v))),s&&(A=Dt(m/s*Math.sin(v)))),c){y=c*Math.cos(u+S),x=c*Math.sin(u+S),b=c*Math.cos(f-S),_=c*Math.sin(f-S);var C=Math.abs(f-u-2*S)<=At?0:1;if(S&&qo(y,x,b,_)===p^C){var L=(u+f)/2;y=c*Math.cos(L),x=c*Math.sin(L),b=_=null}}else y=x=0;if(s){w=s*Math.cos(f-A),T=s*Math.sin(f-A),k=s*Math.cos(u+A),M=s*Math.sin(u+A);var I=Math.abs(u-f+2*A)<=At?0:1;if(A&&qo(w,T,k,M)===1-p^I){var P=(u+f)/2;w=s*Math.cos(P),T=s*Math.sin(P),k=M=null}}else w=T=0;if(h>kt&&(d=Math.min(Math.abs(c-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function Ho(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,c=-s*a,u=t[0]+l,f=t[1]+c,h=e[0]+l,p=e[1]+c,d=(u+h)/2,g=(f+p)/2,m=h-u,v=p-f,y=m*m+v*v,x=r-n,b=u*p-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-m*_)/y,T=(-b*m-v*_)/y,k=(b*v+m*_)/y,M=(-b*m+v*_)/y,A=w-d,S=T-g,E=k-d,C=M-g;return A*A+S*S>E*E+C*C&&(w=k,T=M),[[w-l,T-c],[w*r/x,T*r/x]]}function Go(t){var e=ri,r=ni,n=Yr,i=Wo,a=i.key,o=.7;function s(a){var s,l=[],c=[],u=-1,f=a.length,h=de(e),p=de(r);function d(){l.push("M",i(t(c),o))}for(;++u1&&i.push("H",n[0]);return i.join("")},"step-before":Zo,"step-after":Jo,basis:$o,"basis-open":function(t){if(t.length<4)return Wo(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(ts(ns,a)+","+ts(ns,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 Wo(t){return t.length>1?t.join("L"):t+"Z"}function Xo(t){return t.join("L")+"Z"}function Zo(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 c=2;cAt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=de(t),a):r},a.source=function(e){return arguments.length?(t=de(e),a):t},a.target=function(t){return arguments.length?(e=de(t),a):e},a.startAngle=function(t){return arguments.length?(n=de(t),a):n},a.endAngle=function(t){return arguments.length?(i=de(t),a):i},a},t.svg.diagonal=function(){var t=Vn,e=qn,r=cs;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=de(e),n):t},n.target=function(t){return arguments.length?(e=de(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=cs,n=e.projection;return e.projection=function(t){return arguments.length?n(us(r=t)):r},e},t.svg.symbol=function(){var t=hs,e=fs;function r(r,n){return(ds.get(t.call(this,r,n))||ps)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=de(e),r):t},r.size=function(t){return arguments.length?(e=de(t),r):e},r};var ds=t.map({circle:ps,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*ms)),r=e*ms;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/gs),r=e*gs/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/gs),r=e*gs/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ds.keys();var gs=Math.sqrt(3),ms=Math.tan(30*Lt);Y.transition=function(t){for(var e,r,n=bs||++Ts,i=As(t),a=[],o=_s||{time:Date.now(),ease:ca,delay:0,duration:250},s=-1,l=this.length;++s0;)c[--h].call(t,o);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,e),--u.count?delete u[n]:delete t[r],1}f||(a=i.time,o=we((function(t){var e=f.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h}),0,a),f=u[n]={tween:new _,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++u.count)}ws.call=Y.call,ws.empty=Y.empty,ws.node=Y.node,ws.size=Y.size,t.transition=function(e,r){return e&&e.transition?bs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=W(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 m(){var f,m,v=this,y=t.select(t.event.target),x=n.of(v,arguments),b=t.select(v),_=y.datum(),w=!/^(n|s)$/.test(_)&&i,T=!/^(e|w)$/.test(_)&&a,k=y.classed("extent"),M=bt(v),A=t.mouse(v),S=t.select(o(v)).on("keydown.brush",L).on("keyup.brush",I);if(t.event.changedTouches?S.on("touchmove.brush",P).on("touchend.brush",O):S.on("mousemove.brush",P).on("mouseup.brush",O),b.interrupt().selectAll("*").interrupt(),k)A[0]=s[0]-A[0],A[1]=l[0]-A[1];else if(_){var E=+/w$/.test(_),C=+/^n/.test(_);m=[s[1-E]-A[0],l[1-C]-A[1]],A[0]=s[E],A[1]=l[C]}else t.event.altKey&&(f=A.slice());function L(){32==t.event.keyCode&&(k||(f=null,A[0]-=s[1],A[1]-=l[1],k=2),F())}function I(){32==t.event.keyCode&&2==k&&(A[0]+=s[1],A[1]+=l[1],k=0,F())}function P(){var e=t.mouse(v),r=!1;m&&(e[0]+=m[0],e[1]+=m[1]),k||(t.event.altKey?(f||(f=[(s[0]+s[1])/2,(l[0]+l[1])/2]),A[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Ns(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Ns(+e+1);return e}}:t))},i.ticks=function(t,e){var r=go(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],Ns(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Bs(e.copy(),r,n)},wo(i,e)}function Ns(t){return new Date(t)}Os.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Fs:Rs,Fs.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Fs.toString=Rs.toString,Pe.second=Re((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=Re((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=Re((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=Re((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 js=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[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]],Vs=Os.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",Yr]]),qs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Ns)},floor:L,ceil:L};Us.year=Pe.year,Pe.scale=function(){return Bs(t.scale.linear(),Us,Vs)};var Hs=Us.map((function(t){return[t[0].utc,t[1]]})),Gs=Ds.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",Yr]]);function Ys(t){return JSON.parse(t.responseText)}function Ws(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}Hs.year=Pe.year.utc,Pe.scale.utc=function(){return Bs(t.scale.linear(),Hs,Gs)},t.text=ge((function(t){return t.responseText})),t.json=function(t,e){return me(t,"application/json",Ys,e)},t.html=function(t,e){return me(t,"text/html",Ws,e)},t.xml=ge((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],170:[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=v[t[e]];if(r<0)return!1;t[e]=r}return!0}));if(1&s)for(u=0;u<_.length;++u){h=(b=_[u])[0];b[0]=b[1],b[1]=h}return _}},{"incremental-convex-hull":459,uniq:597}],172:[function(t,e,r){"use strict";e.exports=a;var n=(a.canvas=document.createElement("canvas")).getContext("2d"),i=o([32,126]);function a(t,e){Array.isArray(t)&&(t=t.join(", "));var r,a={},s=16,l=.05;e&&(2===e.length&&"number"==typeof e[0]?r=o(e):Array.isArray(e)?r=e:(e.o?r=o(e.o):e.pairs&&(r=e.pairs),e.fontSize&&(s=e.fontSize),null!=e.threshold&&(l=e.threshold))),r||(r=i),n.font=s+"px "+t;for(var c=0;cs*l){var p=(h-f)/s;a[u]=1e3*p}}return a}function o(t){for(var e=[],r=t[0];r<=t[1];r++)for(var n=String.fromCharCode(r),i=t[0];i>>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)}).call(this,t("buffer").Buffer)},{buffer:111}],174:[function(t,e,r){var n=t("abs-svg-path"),i=t("normalize-svg-path"),a={M:"moveTo",C:"bezierCurveTo"};e.exports=function(t,e){t.beginPath(),i(n(e)).forEach((function(e){var r=e[0],n=e.slice(1);t[a[r]].apply(t,n)})),t.closePath()}},{"abs-svg-path":65,"normalize-svg-path":497}],175:[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}}},{}],176:[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;n80*r){n=l=t[0],s=c=t[1];for(var b=r;bl&&(l=u),p>c&&(c=p);d=0!==(d=Math.max(l-n,c-s))?1/d:0}return o(y,x,r,n,s,d),x}function i(t,e,r,n,i){var a,o;if(i===E(t,e,r,n)>0)for(a=e;a=e;a-=n)o=M(a,t[a],t[a+1],o);return o&&x(o,o.next)&&(A(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!x(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(A(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,f,h){if(t){!h&&f&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=d(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,c=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,c*=2}while(o>1)}(i)}(t,n,i,f);for(var p,g,m=t;t.prev!==t.next;)if(p=t.prev,g=t.next,f?l(t,n,i,f):s(t))e.push(p.i/r),e.push(t.i/r),e.push(g.i/r),A(t),t=g.next,m=g.next;else if((t=g)===m){h?1===h?o(t=c(a(t),e,r),e,r,n,i,f,2):2===h&&u(t,e,r,n,i,f):o(a(t),e,r,n,i,f,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(y(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(m(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&y(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,r,n){var i=t.prev,a=t,o=t.next;if(y(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,f=d(s,l,e,r,n),h=d(c,u,e,r,n),p=t.prevZ,g=t.nextZ;p&&p.z>=f&&g&&g.z<=h;){if(p!==t.prev&&p!==t.next&&m(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,g!==t.prev&&g!==t.next&&m(i.x,i.y,a.x,a.y,o.x,o.y,g.x,g.y)&&y(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;p&&p.z>=f;){if(p!==t.prev&&p!==t.next&&m(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;g&&g.z<=h;){if(g!==t.prev&&g!==t.next&&m(i.x,i.y,a.x,a.y,o.x,o.y,g.x,g.y)&&y(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function c(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!x(i,o)&&b(i,n,n.next,o)&&T(i,o)&&T(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),A(n),A(n.next),n=t=o),n=n.next}while(n!==t);return a(n)}function u(t,e,r,n,i,s){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&v(l,c)){var u=k(l,c);return l=a(l,l.next),u=a(u,u.next),o(l,e,r,n,i,s),void o(u,e,r,n,i,s)}c=c.next}l=l.next}while(l!==t)}function f(t,e){return t.x-e.x}function h(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=u&&i!==n.x&&m(ar.x||n.x===r.x&&p(r,n)))&&(r=n,h=l)),n=n.next}while(n!==c);return r}(t,e)){var r=k(e,t);a(e,e.next),a(r,r.next)}}function p(t,e){return y(t.prev,t,e.prev)<0&&y(e.next,t,t.next)<0}function d(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function g(t){var e=t,r=t;do{(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&b(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(T(t,e)&&T(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(y(t.prev,t,e.prev)||y(t,e.prev,e))||x(t,e)&&y(t.prev,t,t.next)>0&&y(e.prev,e,e.next)>0)}function y(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function x(t,e){return t.x===e.x&&t.y===e.y}function b(t,e,r,n){var i=w(y(t,e,r)),a=w(y(t,e,n)),o=w(y(r,n,t)),s=w(y(r,n,e));return i!==a&&o!==s||(!(0!==i||!_(t,r,e))||(!(0!==a||!_(t,n,e))||(!(0!==o||!_(r,t,n))||!(0!==s||!_(r,e,n)))))}function _(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function w(t){return t>0?1:t<0?-1:0}function T(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function k(t,e){var r=new S(t.i,t.x,t.y),n=new S(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function M(t,e,r,n){var i=new S(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function A(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function S(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(t,e,r,n){for(var i=0,a=e,o=r-n;a0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],178:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var i=0;i=e}))}(e);for(var r,i=n(t).components.filter((function(t){return t.length>1})),a=1/0,o=0;o=55296&&y<=56319&&(w+=t[++r]),w=T?h.call(T,k,w,g):w,e?(p.value=w,d(m,g,p)):m[g]=w,++g;v=g}if(void 0===v)for(v=o(t.length),e&&(m=new e(v)),r=0;r0?1:-1}},{}],190:[function(t,e,r){"use strict";var n=t("../math/sign"),i=Math.abs,a=Math.floor;e.exports=function(t){return isNaN(t)?0:0!==(t=Number(t))&&isFinite(t)?n(t)*a(i(t)):t}},{"../math/sign":187}],191:[function(t,e,r){"use strict";var n=t("./to-integer"),i=Math.max;e.exports=function(t){return i(0,n(t))}},{"./to-integer":190}],192:[function(t,e,r){"use strict";var n=t("./valid-callable"),i=t("./valid-value"),a=Function.prototype.bind,o=Function.prototype.call,s=Object.keys,l=Object.prototype.propertyIsEnumerable;e.exports=function(t,e){return function(r,c){var u,f=arguments[2],h=arguments[3];return r=Object(i(r)),n(c),u=s(r),h&&u.sort("function"==typeof h?a.call(h,r):void 0),"function"!=typeof t&&(t=u[t]),o.call(t,u,(function(t,n){return l.call(r,t)?o.call(c,f,r[t],t,r,n):e}))}}},{"./valid-callable":209,"./valid-value":211}],193:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.assign:t("./shim")},{"./is-implemented":194,"./shim":195}],194:[function(t,e,r){"use strict";e.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},{}],195:[function(t,e,r){"use strict";var n=t("../keys"),i=t("../valid-value"),a=Math.max;e.exports=function(t,e){var r,o,s,l=a(arguments.length,2);for(t=Object(i(t)),s=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},o=1;o-1}},{}],215:[function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call("");e.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===i)||!1}},{}],216:[function(t,e,r){"use strict";var n=Object.create(null),i=Math.random;e.exports=function(){var t;do{t=i().toString(36).slice(2)}while(n[t]);return t}},{}],217:[function(t,e,r){"use strict";var n,i=t("es5-ext/object/set-prototype-of"),a=t("es5-ext/string/#/contains"),o=t("d"),s=t("es6-symbol"),l=t("./"),c=Object.defineProperty;n=e.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");l.call(this,t),e=e?a.call(e,"key+value")?"key+value":a.call(e,"key")?"key":"value":"value",c(this,"__kind__",o("",e))},i&&i(n,l),delete n.prototype.constructor,n.prototype=Object.create(l.prototype,{_resolve:o((function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t}))}),c(n.prototype,s.toStringTag,o("c","Array Iterator"))},{"./":220,d:155,"es5-ext/object/set-prototype-of":206,"es5-ext/string/#/contains":212,"es6-symbol":225}],218:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/object/valid-callable"),a=t("es5-ext/string/is-string"),o=t("./get"),s=Array.isArray,l=Function.prototype.call,c=Array.prototype.some;e.exports=function(t,e){var r,u,f,h,p,d,g,m,v=arguments[2];if(s(t)||n(t)?r="array":a(t)?r="string":t=o(t),i(e),f=function(){h=!0},"array"!==r)if("string"!==r)for(u=t.next();!u.done;){if(l.call(e,v,u.value,f),h)return;u=t.next()}else for(d=t.length,p=0;p=55296&&m<=56319&&(g+=t[++p]),l.call(e,v,g,f),!h);++p);else c.call(t,(function(t){return l.call(e,v,t,f),h}))}},{"./get":219,"es5-ext/function/is-arguments":184,"es5-ext/object/valid-callable":209,"es5-ext/string/is-string":215}],219:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/string/is-string"),a=t("./array"),o=t("./string"),s=t("./valid-iterable"),l=t("es6-symbol").iterator;e.exports=function(t){return"function"==typeof s(t)[l]?t[l]():n(t)?new a(t):i(t)?new o(t):new a(t)}},{"./array":217,"./string":222,"./valid-iterable":223,"es5-ext/function/is-arguments":184,"es5-ext/string/is-string":215,"es6-symbol":225}],220:[function(t,e,r){"use strict";var n,i=t("es5-ext/array/#/clear"),a=t("es5-ext/object/assign"),o=t("es5-ext/object/valid-callable"),s=t("es5-ext/object/valid-value"),l=t("d"),c=t("d/auto-bind"),u=t("es6-symbol"),f=Object.defineProperty,h=Object.defineProperties;e.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");h(this,{__list__:l("w",s(t)),__context__:l("w",e),__nextIndex__:l("w",0)}),e&&(o(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,h(n.prototype,a({_next:l((function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach((function(e,r){e>=t&&(this.__redo__[r]=++e)}),this),this.__redo__.push(t)):f(this,"__redo__",l("c",[t])))})),_onDelete:l((function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(e=this.__redo__.indexOf(t))&&this.__redo__.splice(e,1),this.__redo__.forEach((function(e,r){e>t&&(this.__redo__[r]=--e)}),this)))})),_onClear:l((function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0}))}))),f(n.prototype,u.iterator,l((function(){return this})))},{d:155,"d/auto-bind":154,"es5-ext/array/#/clear":180,"es5-ext/object/assign":193,"es5-ext/object/valid-callable":209,"es5-ext/object/valid-value":211,"es6-symbol":225}],221:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/object/is-value"),a=t("es5-ext/string/is-string"),o=t("es6-symbol").iterator,s=Array.isArray;e.exports=function(t){return!!i(t)&&(!!s(t)||(!!a(t)||(!!n(t)||"function"==typeof t[o])))}},{"es5-ext/function/is-arguments":184,"es5-ext/object/is-value":200,"es5-ext/string/is-string":215,"es6-symbol":225}],222:[function(t,e,r){"use strict";var n,i=t("es5-ext/object/set-prototype-of"),a=t("d"),o=t("es6-symbol"),s=t("./"),l=Object.defineProperty;n=e.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),s.call(this,t),l(this,"__length__",a("",t.length))},i&&i(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:a((function(){if(this.__list__)return this.__nextIndex__=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r}))}),l(n.prototype,o.toStringTag,a("c","String Iterator"))},{"./":220,d:155,"es5-ext/object/set-prototype-of":206,"es6-symbol":225}],223:[function(t,e,r){"use strict";var n=t("./is-iterable");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},{"./is-iterable":221}],224:[function(t,e,r){(function(n,i){(function(){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -25,37 +25,37 @@ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ -!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():t.ES6Promise=n()}(this,(function(){"use strict";function e(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,o=void 0,s=void 0,l=function(t,e){g[i]=t,g[i+1]=e,2===(i+=2)&&(s?s(m):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},h=u.MutationObserver||u.WebKitMutationObserver,f="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(m,1)}}var g=new Array(1e3);function m(){for(var t=0;t=r-1){f=l.length-1;var d=t-e[r-1];for(p=0;p=r-1)for(var u=s.length-1,h=(e[r-1],0);h=0;--r)if(t[--e])return!1;return!0},s.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--h)n.push(i(l[h-1],c[h-1],arguments[h])),a.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 f=r;f>0;--f){var p=i(c[f-1],u[f-1],arguments[f]);n.push(p),a.push((p-n[o++])*h)}}},s.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(i(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,a=this._velocity,o=n.length-this.dimension,s=this.bounds,l=s[0],c=s[1],u=t-e,h=u>1e-6?1/u:0;this._time.push(t);for(var f=r;f>0;--f){var p=arguments[f];n.push(i(l[f-1],c[f-1],n[o++]+p)),a.push(p*h)}}},s.idle=function(t){var e=this.lastT();if(!(t=0;--h)n.push(i(l[h],c[h],n[o]+u*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":243,"cubic-hermite":150}],243:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",a?".get(m)":"[m]"];return i?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("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],!1,a),n("B","x"+t+"y",e,["y"],!0,a),n("P","c(x,y)"+t+"0",e,["y","c"],!1,a),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,a),"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:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],244:[function(t,e,r){var n=t("dtype");e.exports=function(t,e,r){if(!t)throw new TypeError("must specify data as first parameter");if(r=0|+(r||0),Array.isArray(t)&&t[0]&&"number"==typeof t[0][0]){var a,i,o,s,l=t[0].length,c=t.length*l;e&&"string"!=typeof e||(e=new(n(e||"float32"))(c+r));var u=e.length-r;if(c!==u)throw new Error("source length "+c+" ("+l+"x"+t.length+") does not match destination length "+u);for(a=0,o=r;ae[0]-o[0]/2&&(f=o[0]/2,p+=o[1]);return r}},{"css-font/stringify":147}],246:[function(t,e,r){"use strict";function n(t,e){e||(e={}),("string"==typeof t||Array.isArray(t))&&(e.family=t);var r=Array.isArray(e.family)?e.family.join(", "):e.family;if(!r)throw Error("`family` must be defined");var s=e.size||e.fontSize||e.em||48,l=e.weight||e.fontWeight||"",c=(t=[e.style||e.fontStyle||"",l,s].join(" ")+"px "+r,e.origin||"top");if(n.cache[r]&&s<=n.cache[r].em)return a(n.cache[r],c);var u=e.canvas||n.canvas,h=u.getContext("2d"),f={upper:void 0!==e.upper?e.upper:"H",lower:void 0!==e.lower?e.lower:"x",descent:void 0!==e.descent?e.descent:"p",ascent:void 0!==e.ascent?e.ascent:"h",tittle:void 0!==e.tittle?e.tittle:"i",overshoot:void 0!==e.overshoot?e.overshoot:"O"},p=Math.ceil(1.5*s);u.height=p,u.width=.5*p,h.font=t;var d={top:0};h.clearRect(0,0,p,p),h.textBaseline="top",h.fillStyle="black",h.fillText("H",0,0);var g=i(h.getImageData(0,0,p,p));h.clearRect(0,0,p,p),h.textBaseline="bottom",h.fillText("H",0,p);var m=i(h.getImageData(0,0,p,p));d.lineHeight=d.bottom=p-m+g,h.clearRect(0,0,p,p),h.textBaseline="alphabetic",h.fillText("H",0,p);var v=p-i(h.getImageData(0,0,p,p))-1+g;d.baseline=d.alphabetic=v,h.clearRect(0,0,p,p),h.textBaseline="middle",h.fillText("H",0,.5*p);var y=i(h.getImageData(0,0,p,p));d.median=d.middle=p-y-1+g-.5*p,h.clearRect(0,0,p,p),h.textBaseline="hanging",h.fillText("H",0,.5*p);var x=i(h.getImageData(0,0,p,p));d.hanging=p-x-1+g-.5*p,h.clearRect(0,0,p,p),h.textBaseline="ideographic",h.fillText("H",0,p);var b=i(h.getImageData(0,0,p,p));if(d.ideographic=p-b-1+g,f.upper&&(h.clearRect(0,0,p,p),h.textBaseline="top",h.fillText(f.upper,0,0),d.upper=i(h.getImageData(0,0,p,p)),d.capHeight=d.baseline-d.upper),f.lower&&(h.clearRect(0,0,p,p),h.textBaseline="top",h.fillText(f.lower,0,0),d.lower=i(h.getImageData(0,0,p,p)),d.xHeight=d.baseline-d.lower),f.tittle&&(h.clearRect(0,0,p,p),h.textBaseline="top",h.fillText(f.tittle,0,0),d.tittle=i(h.getImageData(0,0,p,p))),f.ascent&&(h.clearRect(0,0,p,p),h.textBaseline="top",h.fillText(f.ascent,0,0),d.ascent=i(h.getImageData(0,0,p,p))),f.descent&&(h.clearRect(0,0,p,p),h.textBaseline="top",h.fillText(f.descent,0,0),d.descent=o(h.getImageData(0,0,p,p))),f.overshoot){h.clearRect(0,0,p,p),h.textBaseline="top",h.fillText(f.overshoot,0,0);var _=o(h.getImageData(0,0,p,p));d.overshoot=_-v}for(var w in d)d[w]/=s;return d.em=s,n.cache[r]=d,a(d,c)}function a(t,e){var r={};for(var n in"string"==typeof e&&(e=t[e]),t)"em"!==n&&(r[n]=t[n]-e);return r}function i(t){for(var e=t.height,r=t.data,n=3;n0;n-=4)if(0!==r[n])return Math.floor(.25*(n-3)/e)}e.exports=n,n.canvas=document.createElement("canvas"),n.cache={}},{}],247:[function(t,e,r){"use strict";e.exports=function(t){return new s(t||g,null)};function n(t,e,r,n,a,i){this._color=t,this.key=e,this.value=r,this.left=n,this.right=a,this._count=i}function a(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function i(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}var l=s.prototype;function c(t,e){var r;if(e.left&&(r=c(t,e.left)))return r;return(r=t(e.key,e.value))||(e.right?c(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){var a;if(n.left)if(a=u(t,e,r,n.left))return a;if(a=r(n.key,n.value))return a}if(n.right)return u(t,e,r,n.right)}function h(t,e,r,n,a){var i,o=r(t,a.key),s=r(e,a.key);if(o<=0){if(a.left&&(i=h(t,e,r,n,a.left)))return i;if(s>0&&(i=n(a.key,a.value)))return i}if(s>0&&a.right)return h(t,e,r,n,a.right)}function f(t,e){this.tree=t,this._stack=e}Object.defineProperty(l,"keys",{get:function(){var t=[];return this.forEach((function(e,r){t.push(e)})),t}}),Object.defineProperty(l,"values",{get:function(){var t=[];return this.forEach((function(e,r){t.push(r)})),t}}),Object.defineProperty(l,"length",{get:function(){return this.root?this.root._count:0}}),l.insert=function(t,e){for(var r=this._compare,a=this.root,l=[],c=[];a;){var u=r(t,a.key);l.push(a),c.push(u),a=u<=0?a.left:a.right}l.push(new n(0,t,e,null,null,1));for(var h=l.length-2;h>=0;--h){a=l[h];c[h]<=0?l[h]=new n(a._color,a.key,a.value,l[h+1],a.right,a._count+1):l[h]=new n(a._color,a.key,a.value,a.left,l[h+1],a._count+1)}for(h=l.length-1;h>1;--h){var f=l[h-1];a=l[h];if(1===f._color||1===a._color)break;var p=l[h-2];if(p.left===f)if(f.left===a){if(!(d=p.right)||0!==d._color){if(p._color=0,p.left=f.right,f._color=1,f.right=p,l[h-2]=f,l[h-1]=a,o(p),o(f),h>=3)(g=l[h-3]).left===p?g.left=f:g.right=f;break}f._color=1,p.right=i(1,d),p._color=0,h-=1}else{if(!(d=p.right)||0!==d._color){if(f.right=a.left,p._color=0,p.left=a.right,a._color=1,a.left=f,a.right=p,l[h-2]=a,l[h-1]=f,o(p),o(f),o(a),h>=3)(g=l[h-3]).left===p?g.left=a:g.right=a;break}f._color=1,p.right=i(1,d),p._color=0,h-=1}else if(f.right===a){if(!(d=p.left)||0!==d._color){if(p._color=0,p.right=f.left,f._color=1,f.left=p,l[h-2]=f,l[h-1]=a,o(p),o(f),h>=3)(g=l[h-3]).right===p?g.right=f:g.left=f;break}f._color=1,p.left=i(1,d),p._color=0,h-=1}else{var d;if(!(d=p.left)||0!==d._color){var g;if(f.left=a.right,p._color=0,p.right=a.left,a._color=1,a.right=f,a.left=p,l[h-2]=a,l[h-1]=f,o(p),o(f),o(a),h>=3)(g=l[h-3]).right===p?g.right=a:g.left=a;break}f._color=1,p.left=i(1,d),p._color=0,h-=1}}return l[0]._color=1,new s(r,l[0])},l.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return c(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return h(e,r,this._compare,t,this.root)}},Object.defineProperty(l,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(l,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),l.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,[])},l.ge=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<=0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},l.gt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},l.lt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},l.le=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>=0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},l.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var a=e(t,r.key);if(n.push(r),0===a)return new f(this,n);r=a<=0?r.left:r.right}return new f(this,[])},l.remove=function(t){var e=this.find(t);return e?e.remove():this},l.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 p=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 g(t,e){return te?1:0}Object.defineProperty(p,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(p,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),p.clone=function(){return new f(this.tree,this._stack.slice())},p.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 n(r._color,r.key,r.value,r.left,r.right,r._count);for(var l=t.length-2;l>=0;--l){(r=t[l]).left===t[l+1]?e[l]=new n(r._color,r.key,r.value,e[l+1],r.right,r._count):e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count)}if((r=e[e.length-1]).left&&r.right){var c=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var u=e[c-1];e.push(new n(r._color,u.key,u.value,r.left,r.right,r._count)),e[c-1].key=r.key,e[c-1].value=r.value;for(l=e.length-2;l>=c;--l)r=e[l],e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count);e[c-1].left=e[c]}if(0===(r=e[e.length-1])._color){var h=e[e.length-2];h.left===r?h.left=null:h.right===r&&(h.right=null),e.pop();for(l=0;l=0;--l){if(e=t[l],0===l)return void(e._color=1);if((r=t[l-1]).left===e){if((n=r.right).right&&0===n.right._color){if(s=(n=r.right=a(n)).right=a(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=1,r._color=1,s._color=1,o(r),o(n),l>1)(c=t[l-2]).left===r?c.left=n:c.right=n;return void(t[l-1]=n)}if(n.left&&0===n.left._color){if(s=(n=r.right=a(n)).left=a(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(c=t[l-2]).left===r?c.left=s:c.right=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.right=i(0,n));r.right=i(0,n);continue}n=a(n),r.right=n.left,n.left=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((c=t[l-2]).left===r?c.left=n:c.right=n),t[l-1]=n,t[l]=r,l+11)(c=t[l-2]).right===r?c.right=n:c.left=n;return void(t[l-1]=n)}if(n.right&&0===n.right._color){if(s=(n=r.left=a(n)).right=a(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(c=t[l-2]).right===r?c.right=s:c.left=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.left=i(0,n));r.left=i(0,n);continue}var c;n=a(n),r.left=n.right,n.right=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((c=t[l-2]).right===r?c.right=n:c.left=n),t[l-1]=n,t[l]=r,l+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(p,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(p,"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}),p.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(p,"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}}),p.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),a=e[e.length-1];r[r.length-1]=new n(a._color,a.key,t,a.left,a.right,a._count);for(var i=e.length-2;i>=0;--i)(a=e[i]).left===e[i+1]?r[i]=new n(a._color,a.key,a.value,r[i+1],a.right,a._count):r[i]=new n(a._color,a.key,a.value,a.left,r[i+1],a._count);return new s(this.tree._compare,r[0])},p.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(p,"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}})},{}],248:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],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 i(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+607/128+.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(i(e));e-=1;for(var r=n[0],a=1;a<9;a++)r+=n[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=i},{}],249:[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,a=e;try{var i=[t];0===t.indexOf("webgl")&&i.push("experimental-"+t);for(var o=0;o0?(p[u]=-1,d[u]=0):(p[u]=0,d[u]=1)}}var g=[0,0,0],m={model:l,view:l,projection:l,_ortho:!1};h.isOpaque=function(){return!0},h.isTransparent=function(){return!1},h.drawTransparent=function(t){};var v=[0,0,0],y=[0,0,0],x=[0,0,0];h.draw=function(t){t=t||m;for(var e=this.gl,r=t.model||l,n=t.view||l,a=t.projection||l,i=this.bounds,s=t._ortho||!1,u=o(r,n,a,i,s),h=u.cubeEdges,f=u.axis,b=n[12],_=n[13],w=n[14],T=n[15],k=(s?2:1)*this.pixelRatio*(a[3]*b+a[7]*_+a[11]*w+a[15]*T)/e.drawingBufferHeight,M=0;M<3;++M)this.lastCubeProps.cubeEdges[M]=h[M],this.lastCubeProps.axis[M]=f[M];var A=p;for(M=0;M<3;++M)d(p[M],M,this.bounds,h,f);e=this.gl;var S,E=g;for(M=0;M<3;++M)this.backgroundEnable[M]?E[M]=f[M]:E[M]=0;this._background.draw(r,n,a,i,E,this.backgroundColor),this._lines.bind(r,n,a,this);for(M=0;M<3;++M){var C=[0,0,0];f[M]>0?C[M]=i[1][M]:C[M]=i[0][M];for(var L=0;L<2;++L){var P=(M+1+L)%3,I=(M+1+(1^L))%3;this.gridEnable[P]&&this._lines.drawGrid(P,I,this.bounds,C,this.gridColor[P],this.gridWidth[P]*this.pixelRatio)}for(L=0;L<2;++L){P=(M+1+L)%3,I=(M+1+(1^L))%3;this.zeroEnable[I]&&Math.min(i[0][I],i[1][I])<=0&&Math.max(i[0][I],i[1][I])>=0&&this._lines.drawZero(P,I,this.bounds,C,this.zeroLineColor[I],this.zeroLineWidth[I]*this.pixelRatio)}}for(M=0;M<3;++M){this.lineEnable[M]&&this._lines.drawAxisLine(M,this.bounds,A[M].primalOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio),this.lineMirror[M]&&this._lines.drawAxisLine(M,this.bounds,A[M].mirrorOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio);var z=c(v,A[M].primalMinor),O=c(y,A[M].mirrorMinor),D=this.lineTickLength;for(L=0;L<3;++L){var R=k/r[5*L];z[L]*=D[L]*R,O[L]*=D[L]*R}this.lineTickEnable[M]&&this._lines.drawAxisTicks(M,A[M].primalOffset,z,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio),this.lineTickMirror[M]&&this._lines.drawAxisTicks(M,A[M].mirrorOffset,O,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio)}this._lines.unbind(),this._text.bind(r,n,a,this.pixelRatio);var F,B;function N(t){(B=[0,0,0])[t]=1}function j(t,e,r){var n=(t+1)%3,a=(t+2)%3,i=e[n],o=e[a],s=r[n],l=r[a];i>0&&l>0||i>0&&l<0||i<0&&l>0||i<0&&l<0?N(n):(o>0&&s>0||o>0&&s<0||o<0&&s>0||o<0&&s<0)&&N(a)}for(M=0;M<3;++M){var U=A[M].primalMinor,V=A[M].mirrorMinor,q=c(x,A[M].primalOffset);for(L=0;L<3;++L)this.lineTickEnable[M]&&(q[L]+=k*U[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);var H=[0,0,0];if(H[M]=1,this.tickEnable[M]){-3600===this.tickAngle[M]?(this.tickAngle[M]=0,this.tickAlign[M]="auto"):this.tickAlign[M]=-1,F=1,"auto"===(S=[this.tickAlign[M],.5,F])[0]?S[0]=0:S[0]=parseInt(""+S[0]),B=[0,0,0],j(M,U,V);for(L=0;L<3;++L)q[L]+=k*U[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(M,this.tickSize[M],this.tickAngle[M],q,this.tickColor[M],H,B,S)}if(this.labelEnable[M]){F=0,B=[0,0,0],this.labels[M].length>4&&(N(M),F=1),"auto"===(S=[this.labelAlign[M],.5,F])[0]?S[0]=0:S[0]=parseInt(""+S[0]);for(L=0;L<3;++L)q[L]+=k*U[L]*this.labelPad[L]/r[5*L];q[M]+=.5*(i[0][M]+i[1][M]),this._text.drawLabel(M,this.labelSize[M],this.labelAngle[M],q,this.labelColor[M],[0,0,0],B,S)}}this._text.unbind()},h.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":251,"./lib/cube.js":252,"./lib/lines.js":253,"./lib/text.js":255,"./lib/ticks.js":256}],251:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=[],s=0,l=0;l<3;++l)for(var c=(l+1)%3,u=(l+2)%3,h=[0,0,0],f=[0,0,0],p=-1;p<=1;p+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),h[l]=p,f[l]=p;for(var d=-1;d<=1;d+=2){h[c]=d;for(var g=-1;g<=1;g+=2)h[u]=g,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),s+=1}var m=c;c=u,u=m}var v=n(t,new Float32Array(e)),y=n(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),x=a(t,[{buffer:v,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:v,type:t.FLOAT,size:3,offset:12,stride:24}],y),b=i(t);return b.attributes.position.location=0,b.attributes.normal.location=1,new o(t,v,x,b)};var n=t("gl-buffer"),a=t("gl-vao"),i=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,a,i){for(var o=!1,s=0;s<3;++s)o=o||a[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:a,colors:i},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":254,"gl-buffer":258,"gl-vao":332}],252:[function(t,e,r){"use strict";e.exports=function(t,e,r,i,p){a(s,e,t),a(s,r,s);for(var y=0,x=0;x<2;++x){u[2]=i[x][2];for(var b=0;b<2;++b){u[1]=i[b][1];for(var _=0;_<2;++_)u[0]=i[_][0],f(l[y],u,s),y+=1}}var w=-1;for(x=0;x<8;++x){for(var T=l[x][3],k=0;k<3;++k)c[x][k]=l[x][k]/T;p&&(c[x][2]*=-1),T<0&&(w<0||c[x][2]E&&(w|=1<E&&(w|=1<c[x][1])&&(R=x);var F=-1;for(x=0;x<3;++x){if((N=R^1<c[B][0]&&(B=N)}var j=g;j[0]=j[1]=j[2]=0,j[n.log2(F^R)]=R&F,j[n.log2(R^B)]=R&B;var U=7^B;U===w||U===D?(U=7^F,j[n.log2(B^U)]=U&B):j[n.log2(F^U)]=U&F;var V=m,q=w;for(M=0;M<3;++M)V[M]=q&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 a(t,s,l,null,[{name:"position",type:"vec3"}])};var c=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}"]),u=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 a(t,c,u,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":312,glslify:413}],255:[function(t,e,r){(function(r){"use strict";e.exports=function(t,e,r,i,s,l){var u=n(t),h=a(t,[{buffer:u,size:3}]),f=o(t);f.attributes.position.location=0;var p=new c(t,f,u,h);return p.update(e,r,i,s,l),p};var n=t("gl-buffer"),a=t("gl-vao"),i=t("vectorize-text"),o=t("./shaders").text,s=window||r.global||{},l=s.__TEXT_CACHE||{};s.__TEXT_CACHE={};function c(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 u=c.prototype,h=[0,0];u.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var a=this.shader.uniforms;a.model=t,a.view=e,a.projection=r,a.pixelScale=n,h[0]=this.gl.drawingBufferWidth,h[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=h},u.unbind=function(){this.vao.unbind()},u.update=function(t,e,r,n,a){var o=[];function s(t,e,r,n,a,s){var c=l[r];c||(c=l[r]={});var u=c[e];u||(u=c[e]=function(t,e){try{return i(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:a,styletags:s}));for(var h=(n||12)/12,f=u.positions,p=u.cells,d=0,g=p.length;d=0;--v){var y=f[m[v]];o.push(h*y[0],-h*y[1],t)}}for(var c=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],p={breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},d=0;d<3;++d){h[d]=o.length/3|0,s(.5*(t[0][d]+t[1][d]),e[d],r[d],12,1.25,p),f[d]=(o.length/3|0)-h[d],c[d]=o.length/3|0;for(var g=0;g=0&&(a=r.length-n-1);var i=Math.pow(10,a),o=Math.round(t*e*i),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/i,c=o%i;o<0?(l=0|-Math.ceil(l),c=0|-c):(l=0|Math.floor(l),c|=0);var u=""+l;if(o<0&&(u="-"+u),a){for(var h=""+c;h.length=t[0][a];--o)i.push({x:o*e[a],text:n(e[a],o)});r.push(i)}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,i,a),r}function u(t,e){for(var r=n.malloc(t.length,e),a=t.length,i=0;i=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=c(this.gl,this.type,this.length,this.usage,t.data,e):this.length=c(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=i(s,t.shape);a.assign(l,t),this.length=c(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 h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?u(t,"uint16"):u(t,"float32"),this.length=c(this.gl,this.type,this.length,this.usage,e<0?h:h.subarray(0,t.length),e),n.free(h)}else if("object"==typeof t&&"number"==typeof t.length)this.length=c(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 a=t.createBuffer(),i=new s(t,r,a,0,n);return i.update(e),i}},{ndarray:469,"ndarray-ops":464,"typedarray-pool":567}],259:[function(t,e,r){"use strict";var n=t("gl-vec3");e.exports=function(t,e){var r=t.positions,a=t.vectors,i={positions:[],vertexIntensity:[],vertexIntensityBounds:t.vertexIntensityBounds,vectors:[],cells:[],coneOffset:t.coneOffset,colormap:t.colormap};if(0===t.positions.length)return e&&(e[0]=[0,0,0],e[1]=[0,0,0]),i;for(var o=0,s=1/0,l=-1/0,c=1/0,u=-1/0,h=1/0,f=-1/0,p=null,d=null,g=[],m=1/0,v=!1,y=0;yo&&(o=n.length(b)),y){var _=2*n.distance(p,x)/(n.length(d)+n.length(b));_?(m=Math.min(m,_),v=!1):v=!0}v||(p=x,d=b),g.push(b)}var w=[s,c,h],T=[l,u,f];e&&(e[0]=w,e[1]=T),0===o&&(o=1);var k=1/o;isFinite(m)||(m=1),i.vectorScale=m;var M=t.coneSize||.5;t.absoluteConeSize&&(M=t.absoluteConeSize*k),i.coneScale=M;y=0;for(var A=0;y=1},p.isTransparent=function(){return this.opacity<1},p.pickSlots=1,p.setPickBase=function(t){this.pickId=t},p.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),void 0!==t.tubeScale&&(this.tubeScale=t.tubeScale),void 0!==t.vectorScale&&(this.vectorScale=t.vectorScale),void 0!==t.coneScale&&(this.coneScale=t.coneScale),void 0!==t.coneOffset&&(this.coneOffset=t.coneOffset),t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(function(t){for(var e=u({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var a=e[n],i=0;i<3;++i)r[4*n+i]=a[i];r[4*n+3]=255*a[3]}return c(r,[256,256,4],[4,0,1])}(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions,a=t.vectors;if(n&&r&&a){var i=[],o=[],s=[],l=[],h=[];this.cells=r,this.positions=n,this.vectors=a;var f=t.meshColor||[1,1,1,1],p=t.vertexIntensity,d=1/0,g=-1/0;if(p)if(t.vertexIntensityBounds)d=+t.vertexIntensityBounds[0],g=+t.vertexIntensityBounds[1];else for(var m=0;m0){var g=this.triShader;g.bind(),g.uniforms=c,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}},p.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||h,n=t.view||h,a=t.projection||h,i=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)i[0][o]=Math.max(i[0][o],this.clipBounds[0][o]),i[1][o]=Math.min(i[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(a),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:a,clipBounds:i,tubeScale:this.tubeScale,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())},p.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),a={position:n,dataCoordinate:n,index:Math.floor(r[1]/48)};return"cone"===this.traceType?a.index=Math.floor(r[1]/48):"streamtube"===this.traceType&&(a.intensity=this.intensity[r[1]],a.velocity=this.vectors[r[1]].slice(0,3),a.divergence=this.vectors[r[1]][3],a.index=e),a},p.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.triangleIds.dispose()},e.exports=function(t,e,r){var n=r.shaders;1===arguments.length&&(t=(e=t).gl);var s=d(t,n),l=g(t,n),u=o(t,c(new Uint8Array([255,255,255,255]),[1,1,4]));u.generateMipmap(),u.minFilter=t.LINEAR_MIPMAP_LINEAR,u.magFilter=t.LINEAR;var h=a(t),p=a(t),m=a(t),v=a(t),y=a(t),x=i(t,[{buffer:h,type:t.FLOAT,size:4},{buffer:y,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:m,type:t.FLOAT,size:4},{buffer:v,type:t.FLOAT,size:2},{buffer:p,type:t.FLOAT,size:4}]),b=new f(t,u,s,l,h,p,y,m,v,x,r.traceType||"cone");return b.update(e),b}},{colormap:131,"gl-buffer":258,"gl-mat4/invert":278,"gl-mat4/multiply":280,"gl-shader":312,"gl-texture2d":327,"gl-vao":332,ndarray:469}],261:[function(t,e,r){var n=t("glslify"),a=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;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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"]),i=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, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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 vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float vectorScale, coneScale, 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.xyz), 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:a,fragment:i,attributes:[{name:"position",type:"vec4"},{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:413}],262:[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",34e3:"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"}},{}],263:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":262}],264:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e),o=a(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=i(e);l.attributes.position.location=0,l.attributes.color.location=1,l.attributes.offset.location=2;var c=new s(e,r,o,l);return c.update(t),c};var n=t("gl-buffer"),a=t("gl-vao"),i=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 c(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,a=r.projection=t.projection||o;r.model=t.model||o,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var i=n[12],s=n[13],l=n[14],c=n[15],u=(t._ortho||!1?2:1)*this.pixelRatio*(a[3]*i+a[7]*s+a[11]*l+a[15]*c)/e.drawingBufferHeight;this.vao.bind();for(var h=0;h<3;++h)e.lineWidth(this.lineWidth[h]*this.pixelRatio),r.capSize=this.capSize[h]*u,this.lineCount[h]&&e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var u=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var a=-1;a<=1;a+=2){var i=[0,0,0];i[(n+e)%3]=a,r.push(i)}t[e]=r}return t}();function h(t,e,r,n){for(var a=u[n],i=0;i0)(g=u.slice())[s]+=p[1][s],a.push(u[0],u[1],u[2],d[0],d[1],d[2],d[3],0,0,0,g[0],g[1],g[2],d[0],d[1],d[2],d[3],0,0,0),c(this.bounds,g),o+=2+h(a,g,d,s)}}this.lineCount[s]=o-this.lineOffset[s]}this.buffer.update(a)}},l.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":265,"gl-buffer":258,"gl-vao":332}],265:[function(t,e,r){"use strict";var n=t("glslify"),a=t("gl-shader"),i=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 a(t,i,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":312,glslify:413}],266:[function(t,e,r){"use strict";var n=t("gl-texture2d");e.exports=function(t,e,r,n){a||(a=t.FRAMEBUFFER_UNSUPPORTED,i=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,o=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,s=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var c=t.getExtension("WEBGL_draw_buffers");!l&&c&&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 a=new Array(r),i=0;iu||r<0||r>u)throw new Error("gl-fbo: Parameters are too large for FBO");var h=1;if("color"in(n=n||{})){if((h=Math.max(0|n.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(h>1){if(!c)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(h>t.getParameter(c.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+h+" draw buffers")}}var f=t.UNSIGNED_BYTE,p=t.getExtension("OES_texture_float");if(n.float&&h>0){if(!p)throw new Error("gl-fbo: Context does not support floating point textures");f=t.FLOAT}else n.preferFloat&&h>0&&p&&(f=t.FLOAT);var g=!0;"depth"in n&&(g=!!n.depth);var m=!1;"stencil"in n&&(m=!!n.stencil);return new d(t,e,r,f,h,g,m,c)};var a,i,o,s,l=null;function c(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function u(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function h(t){switch(t){case a:throw new Error("gl-fbo: Framebuffer unsupported");case i: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 f(t,e,r,a,i,o){if(!a)return null;var s=n(t,e,r,i,a);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 p(t,e,r,n,a){var i=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,i),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,a,t.RENDERBUFFER,i),i}function d(t,e,r,n,a,i,o,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(a);for(var d=0;d1&&s.drawBuffersWEBGL(l[o]);var y=r.getExtension("WEBGL_depth_texture");y?d?t.depth=f(r,a,i,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g&&(t.depth=f(r,a,i,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):g&&d?t._depth_rb=p(r,a,i,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g?t._depth_rb=p(r,a,i,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=p(r,a,i,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var x=r.checkFramebufferStatus(r.FRAMEBUFFER);if(x!==r.FRAMEBUFFER_COMPLETE){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);for(v=0;va||r<0||r>a)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var i=c(n),o=0;o>8*p&255;this.pickOffset=r,a.bind();var d=a.uniforms;d.viewTransform=t,d.pickOffset=e,d.shape=this.shape;var g=a.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),h.pick=function(t,e,r){var n=this.pickOffset,a=this.shape[0]*this.shape[1];if(r=n+a)return null;var i=r-n,o=this.xData,s=this.yData;return{object:this,pointId:i,dataCoord:[o[i%this.shape[0]],s[i/this.shape[0]|0]]}},h.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||a(e[0]),o=t.y||a(e[1]),s=t.z||new Float32Array(e[0]*e[1]),l=!1!==t.zsmooth;this.xData=r,this.yData=o;var c,u,h,p,d=t.colorLevels||[0],g=t.colorValues||[0,0,0,1],m=d.length,v=this.bounds;l?(c=v[0]=r[0],u=v[1]=o[0],h=v[2]=r[r.length-1],p=v[3]=o[o.length-1]):(c=v[0]=r[0]+(r[1]-r[0])/2,u=v[1]=o[0]+(o[1]-o[0])/2,h=v[2]=r[r.length-1]+(r[r.length-1]-r[r.length-2])/2,p=v[3]=o[o.length-1]+(o[o.length-1]-o[o.length-2])/2);var y=1/(h-c),x=1/(p-u),b=e[0],_=e[1];this.shape=[b,_];var w=(l?(b-1)*(_-1):b*_)*(f.length>>>1);this.numVertices=w;for(var T=i.mallocUint8(4*w),k=i.mallocFloat32(2*w),M=i.mallocUint8(2*w),A=i.mallocUint32(w),S=0,E=l?b-1:b,C=l?_-1:_,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\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\n// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl\nvec4 packFloat(float v) {\n 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 vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n float e = floor(log2(av));\n 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 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, packFloat(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 a(t,i,o,null,l)},r.createPickShader=function(t){return a(t,i,s,null,l)}},{"gl-shader":312,glslify:413}],271:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=h(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),l=a(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}]),u=c(new Array(1024),[256,1,4]),p=0;p<1024;++p)u.data[p]=255;var d=i(e,u);d.wrap=e.REPEAT;var g=new v(e,r,o,s,l,d);return g.update(t),g};var n=t("gl-buffer"),a=t("gl-vao"),i=t("gl-texture2d"),o=new Uint8Array(4),s=new Float32Array(o.buffer);var l=t("binary-search-bounds"),c=t("ndarray"),u=t("./lib/shaders"),h=u.createShader,f=u.createPickShader,p=[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 a=t[n]-e[n];r+=a*a}return Math.sqrt(r)}function g(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 m(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function v(t,e,r,n,a,i){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=a,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=i,this.dashScale=1,this.opacity=1,this.hasAlpha=!1,this.dirty=!0,this.pixelRatio=1}var y=v.prototype;y.isTransparent=function(){return this.hasAlpha},y.isOpaque=function(){return!this.hasAlpha},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){if(this.vertexCount){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||p,view:t.view||p,projection:t.projection||p,clipBounds:g(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()}},y.drawPick=function(t){if(this.vertexCount){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||p,view:t.view||p,projection:t.projection||p,pickId:this.pickId,clipBounds:g(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()}},y.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 a=[],i=[],o=[],s=0,u=0,h=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],f=t.position||t.positions;if(f){var p=t.color||t.colors||[0,0,0,1],g=t.lineWidth||1,m=!1;t:for(e=1;e0){for(var w=0;w<24;++w)a.push(a[a.length-12]);u+=2,m=!0}continue t}h[0][r]=Math.min(h[0][r],b[r],_[r]),h[1][r]=Math.max(h[1][r],b[r],_[r])}Array.isArray(p[0])?(v=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]):v=y=p,3===v.length&&(v=[v[0],v[1],v[2],1]),3===y.length&&(y=[y[0],y[1],y[2],1]),!this.hasAlpha&&v[3]<1&&(this.hasAlpha=!0),x=Array.isArray(g)?g.length>e-1?g[e-1]:g.length>0?g[g.length-1]:[0,0,0,1]:g;var T=s;if(s+=d(b,_),m){for(r=0;r<2;++r)a.push(b[0],b[1],b[2],_[0],_[1],_[2],T,x,v[0],v[1],v[2],v[3]);u+=2,m=!1}a.push(b[0],b[1],b[2],_[0],_[1],_[2],T,x,v[0],v[1],v[2],v[3],b[0],b[1],b[2],_[0],_[1],_[2],T,-x,v[0],v[1],v[2],v[3],_[0],_[1],_[2],b[0],b[1],b[2],s,-x,y[0],y[1],y[2],y[3],_[0],_[1],_[2],b[0],b[1],b[2],s,x,y[0],y[1],y[2],y[3]),u+=4}}if(this.buffer.update(a),i.push(s),o.push(f[f.length-1].slice()),this.bounds=h,this.vertexCount=u,this.points=o,this.arcLength=i,"dashes"in t){var k=t.dashes.slice();for(k.unshift(0),e=1;e1.0001)return null;v+=m[h]}if(Math.abs(v-1)>.001)return null;return[f,s(t,m),m]}},{barycentric:78,"polytope-closest-point/lib/closest_point_2d.js":499}],291:[function(t,e,r){var n=t("glslify"),a=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\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;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\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 f_color = color;\n f_data = position;\n f_uv = uv;\n}\n"]),i=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\n//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d\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;\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 (f_color.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], f_data)\n ) 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 = vec4(f_color.rgb, 1.0) * 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 * f_color.a;\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 ,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}"]),c=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}"]),u=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}"]),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\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}"]),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\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, 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}"]),p=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}"]),d=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor, 1.0);\n}\n"]);r.meshShader={vertex:a,fragment:i,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:c,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:h,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:f,fragment:h,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:p,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{glslify:413}],292:[function(t,e,r){"use strict";var n=t("gl-shader"),a=t("gl-buffer"),i=t("gl-vao"),o=t("gl-texture2d"),s=t("normals"),l=t("gl-mat4/multiply"),c=t("gl-mat4/invert"),u=t("ndarray"),h=t("colormap"),f=t("simplicial-complex-contour"),p=t("typedarray-pool"),d=t("./lib/shaders"),g=t("./lib/closest-point"),m=d.meshShader,v=d.wireShader,y=d.pointShader,x=d.pickShader,b=d.pointPickShader,_=d.contourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function T(t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g,m,v,y,x,b,_,T,k,M,A,S){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=a,this.pickShader=i,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=u,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=c,this.triangleVAO=p,this.triangleCount=0,this.lineWidth=1,this.edgePositions=d,this.edgeColors=m,this.edgeUVs=v,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=x,this.pointColors=_,this.pointUVs=T,this.pointSizes=k,this.pointIds=b,this.pointVAO=M,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=S,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickVertex=!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.hasAlpha=!1,this.opacityscale=!1,this._model=w,this._view=w,this._projection=w,this._resolution=[1,1]}var k=T.prototype;function M(t,e){if(!e)return 1;if(!e.length)return 1;for(var r=0;rt&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}function A(t){var e=n(t,m.vertex,m.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function S(t){var e=n(t,v.vertex,v.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function E(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 C(t){var e=n(t,x.vertex,x.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}function L(t){var e=n(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function P(t){var e=n(t,_.vertex,_.fragment);return e.attributes.position.location=0,e}k.isOpaque=function(){return!this.hasAlpha},k.isTransparent=function(){return this.hasAlpha},k.pickSlots=1,k.setPickBase=function(t){this.pickId=t},k.highlight=function(t){if(t&&this.contourEnable){for(var e=f(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,a=e.vertexWeights,i=r.length,o=p.mallocFloat32(6*i),s=0,l=0;l0&&((h=this.triShader).bind(),h.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind());this.edgeCount>0&&this.lineWidth>0&&((h=this.lineShader).bind(),h.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&&((h=this.pointShader).bind(),h.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind());this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((h=this.contourShader).bind(),h.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind())},k.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||w,n=t.view||w,a=t.projection||w,i=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)i[0][o]=Math.max(i[0][o],this.clipBounds[0][o]),i[1][o]=Math.min(i[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(a),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s,l={model:r,view:n,projection:a,clipBounds:i,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())},k.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,a=new Array(r.length),i=0;ia[k]&&(r.uniforms.dataAxis=c,r.uniforms.screenOffset=u,r.uniforms.color=m[t],r.uniforms.angle=v[t],i.drawArrays(i.TRIANGLES,a[k],a[M]-a[k]))),y[t]&&T&&(u[1^t]-=A*p*x[t],r.uniforms.dataAxis=h,r.uniforms.screenOffset=u,r.uniforms.color=b[t],r.uniforms.angle=_[t],i.drawArrays(i.TRIANGLES,w,T)),u[1^t]=A*s[2+(1^t)]-1,d[t+2]&&(u[1^t]+=A*p*g[t+2],ka[k]&&(r.uniforms.dataAxis=c,r.uniforms.screenOffset=u,r.uniforms.color=m[t+2],r.uniforms.angle=v[t+2],i.drawArrays(i.TRIANGLES,a[k],a[M]-a[k]))),y[t+2]&&T&&(u[1^t]+=A*p*x[t+2],r.uniforms.dataAxis=h,r.uniforms.screenOffset=u,r.uniforms.color=b[t+2],r.uniforms.angle=_[t+2],i.drawArrays(i.TRIANGLES,w,T))}),g.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,a=r.gl,i=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,c=r.pixelRatio;if(this.titleCount){for(var u=0;u<2;++u)e[u]=2*(o[u]*c-i[u])/(i[2+u]-i[u])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,a.drawArrays(a.TRIANGLES,this.titleOffset,this.titleCount)}}}(),g.bind=(f=[0,0],p=[0,0],d=[0,0],function(){var t=this.plot,e=this.shader,r=t._tickBounds,n=t.dataBox,a=t.screenBox,i=t.viewBox;e.bind();for(var o=0;o<2;++o){var s=r[o],l=r[o+2]-s,c=.5*(n[o+2]+n[o]),u=n[o+2]-n[o],h=i[o],g=i[o+2]-h,m=a[o],v=a[o+2]-m;p[o]=2*l/u*g/v,f[o]=2*(s-c)/u*g/v}d[1]=2*t.pixelRatio/(a[3]-a[1]),d[0]=d[1]*(a[3]-a[1])/(a[2]-a[0]),e.uniforms.dataScale=p,e.uniforms.dataShift=f,e.uniforms.textScale=d,this.vbo.bind(),e.attributes.textCoordinate.pointer()}),g.update=function(t){var e,r,n,a,o,s=[],l=t.ticks,c=t.bounds;for(o=0;o<2;++o){var u=[Math.floor(s.length/3)],h=[-1/0],f=l[o];for(e=0;e=0){var g=e[d]-n[d]*(e[d+2]-e[d])/(n[d+2]-n[d]);0===d?o.drawLine(g,e[1],g,e[3],p[d],f[d]):o.drawLine(e[0],g,e[2],g,p[d],f[d])}}for(d=0;d=0;--t)this.objects[t].dispose();this.objects.length=0;for(t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},c.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},c.removeObject=function(t){for(var e=this.objects,r=0;rMath.abs(e))c.rotate(i,0,0,-t*r*Math.PI*d.rotateSpeed/window.innerWidth);else if(!d._ortho){var o=-d.zoomSpeed*a*e/window.innerHeight*(i-c.lastT())/20;c.pan(i,0,0,h*(Math.exp(o)-1))}}}),!0)},d.enableMouseListeners(),d};var n=t("right-now"),a=t("3d-view"),i=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset"),l=t("has-passive-events")},{"3d-view":54,"has-passive-events":415,"mouse-change":457,"mouse-event-offset":458,"mouse-wheel":460,"right-now":514}],300:[function(t,e,r){var n=t("glslify"),a=t("gl-shader"),i=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 a(t,i,o,null,[{name:"position",type:"vec2"}])}},{"gl-shader":312,glslify:413}],301:[function(t,e,r){"use strict";var n=t("./camera.js"),a=t("gl-axes3d"),i=t("gl-axes3d/properties"),o=t("gl-spikes3d"),s=t("gl-select-static"),l=t("gl-fbo"),c=t("a-big-triangle"),u=t("mouse-change"),h=t("gl-mat4/perspective"),f=t("gl-mat4/ortho"),p=t("./lib/shader"),d=t("is-mobile")({tablet:!0,featureDetect:!0});function g(){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 v(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)t.container.appendChild(e);else document.body.appendChild(e)}var r=t.gl;r||(t.glOptions&&(d=!!t.glOptions.preserveDrawingBuffer),r=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:d}));if(!r)throw new Error("webgl not supported");var y=t.bounds||[[-10,-10,-10],[10,10,10]],x=new g,b=l(r,r.drawingBufferWidth,r.drawingBufferHeight,{preferFloat:!d}),_=p(r),w=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:w},k=t.axes||{},M=a(r,k);M.enable=!k.disable;var A=t.spikes||{},S=o(r,A),E=[],C=[],L=[],P=[],I=!0,z=!0,O=new Array(16),D=new Array(16),R={view:null,projection:O,model:D,_ortho:!1},F=(z=!0,[r.drawingBufferWidth,r.drawingBufferHeight]),B=t.cameraObject||n(e,T),N={gl:r,contextLost:!1,pixelRatio:t.pixelRatio||1,canvas:e,selection:x,camera:B,axes:M,axesPixels:null,spikes:S,bounds:y,objects:E,shape:F,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:v(t.autoResize),autoBounds:v(t.autoBounds),autoScale:!!t.autoScale,autoCenter:v(t.autoCenter),clipToBounds:v(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:R,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(t){this.aspect[0]=t.x,this.aspect[1]=t.y,this.aspect[2]=t.z,z=!0},setBounds:function(t,e){this.bounds[0][t]=e.min,this.bounds[1][t]=e.max},setClearColor:function(t){this.clearColor=t},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},j=[r.drawingBufferWidth/N.pixelRatio|0,r.drawingBufferHeight/N.pixelRatio|0];function U(){if(!N._stopped&&N.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 a=0|Math.ceil(r*N.pixelRatio),i=0|Math.ceil(n*N.pixelRatio);if(a!==e.width||i!==e.height){e.width=a,e.height=i;var o=e.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=r+"px",o.height=n+"px",I=!0}}}N.autoResize&&U();function V(){for(var t=E.length,e=P.length,n=0;n0&&0===L[e-1];)L.pop(),P.pop().dispose()}function q(){if(N.contextLost)return!0;r.isContextLost()&&(N.contextLost=!0,N.mouseListener.enabled=!1,N.selection.object=null,N.oncontextloss&&N.oncontextloss())}window.addEventListener("resize",U),N.update=function(t){N._stopped||(t=t||{},I=!0,z=!0)},N.add=function(t){N._stopped||(t.axes=M,E.push(t),C.push(-1),I=!0,z=!0,V())},N.remove=function(t){if(!N._stopped){var e=E.indexOf(t);e<0||(E.splice(e,1),C.pop(),I=!0,z=!0,V())}},N.dispose=function(){if(!N._stopped&&(N._stopped=!0,window.removeEventListener("resize",U),e.removeEventListener("webglcontextlost",q),N.mouseListener.enabled=!1,!N.contextLost)){M.dispose(),S.dispose();for(var t=0;tx.distance)continue;for(var c=0;c 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]),r.pickVertex=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]),r.pickFragment=n(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"])},{glslify:413}],303:[function(t,e,r){"use strict";var n=t("gl-shader"),a=t("gl-buffer"),i=t("typedarray-pool"),o=t("./lib/shader");function s(t,e,r,n,a){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.shader=n,this.pickShader=a,this.sizeMin=.5,this.sizeMinCap=2,this.sizeMax=20,this.areaRatio=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.blend=!1,this.pickOffset=0,this.points=null}e.exports=function(t,e){var r=t.gl,i=a(r),l=a(r),c=n(r,o.pointVertex,o.pointFragment),u=n(r,o.pickVertex,o.pickFragment),h=new s(t,i,l,c,u);return h.update(e),t.addObject(h),h};var l,c,u=s.prototype;u.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},u.update=function(t){var e;function r(e,r){return e in t?t[e]:r}t=t||{},this.sizeMin=r("sizeMin",.5),this.sizeMax=r("sizeMax",20),this.color=r("color",[1,0,0,1]).slice(),this.areaRatio=r("areaRatio",1),this.borderColor=r("borderColor",[0,0,0,1]).slice(),this.blend=r("blend",!1);var n=t.positions.length>>>1,a=t.positions instanceof Float32Array,o=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,s=t.positions,l=a?s:i.mallocFloat32(s.length),c=o?t.idToIndex:i.mallocInt32(n);if(a||l.set(s),!o)for(l.set(s),e=0;e>>1;for(r=0;r=e[0]&&i<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,a),u=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(s,.33333)));l[0]=2/i,l[4]=2/o,l[6]=-2*a[0]/i-1,l[7]=-2*a[1]/o-1,this.offsetBuffer.bind(),r.bind(),r.attributes.position.pointer(),r.uniforms.matrix=l,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointCloud=u<5,r.uniforms.pointSize=u,r.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),e&&(c[0]=255&t,c[1]=t>>8&255,c[2]=t>>16&255,c[3]=t>>24&255,this.pickBuffer.bind(),r.attributes.pickId.pointer(n.UNSIGNED_BYTE),r.uniforms.pickOffset=c,this.pickOffset=t);var h=n.getParameter(n.BLEND),f=n.getParameter(n.DITHER);return h&&!this.blend&&n.disable(n.BLEND),f&&n.disable(n.DITHER),n.drawArrays(n.POINTS,0,this.pointCount),h&&!this.blend&&n.enable(n.BLEND),f&&n.enable(n.DITHER),t+this.pointCount}),u.draw=u.unifiedDraw,u.drawPick=u.unifiedDraw,u.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}}},{"./lib/shader":302,"gl-buffer":258,"gl-shader":312,"typedarray-pool":567}],304:[function(t,e,r){e.exports=function(t,e,r,n){var a,i,o,s,l,c=e[0],u=e[1],h=e[2],f=e[3],p=r[0],d=r[1],g=r[2],m=r[3];(i=c*p+u*d+h*g+f*m)<0&&(i=-i,p=-p,d=-d,g=-g,m=-m);1-i>1e-6?(a=Math.acos(i),o=Math.sin(a),s=Math.sin((1-n)*a)/o,l=Math.sin(n*a)/o):(s=1-n,l=n);return t[0]=s*c+l*p,t[1]=s*u+l*d,t[2]=s*h+l*g,t[3]=s*f+l*m,t}},{}],305:[function(t,e,r){"use strict";e.exports=function(t){return t||0===t?t.toString():""}},{}],306:[function(t,e,r){"use strict";var n=t("vectorize-text");e.exports=function(t,e,r){var i=a[e];i||(i=a[e]={});if(t in i)return i[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,c,u=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=a(["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=a(["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=a(["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 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"]),c=a(["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}"]),u=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:i,fragment:l,attributes:u},f={vertex:o,fragment:l,attributes:u},p={vertex:s,fragment:l,attributes:u},d={vertex:i,fragment:c,attributes:u},g={vertex:o,fragment:c,attributes:u},m={vertex:s,fragment:c,attributes:u};function v(t,e){var r=n(t,e),a=r.attributes;return a.position.location=0,a.color.location=1,a.glyph.location=2,a.id.location=3,r}r.createPerspective=function(t){return v(t,h)},r.createOrtho=function(t){return v(t,f)},r.createProject=function(t){return v(t,p)},r.createPickPerspective=function(t){return v(t,d)},r.createPickOrtho=function(t){return v(t,g)},r.createPickProject=function(t){return v(t,m)}},{"gl-shader":312,glslify:413}],308:[function(t,e,r){"use strict";var n=t("is-string-blank"),a=t("gl-buffer"),i=t("gl-vao"),o=t("typedarray-pool"),s=t("gl-mat4/multiply"),l=t("./lib/shaders"),c=t("./lib/glyphs"),u=t("./lib/get-simple-string"),h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function f(t,e){var r=t[0],n=t[1],a=t[2],i=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*a+e[12]*i,t[1]=e[1]*r+e[5]*n+e[9]*a+e[13]*i,t[2]=e[2]*r+e[6]*n+e[10]*a+e[14]*i,t[3]=e[3]*r+e[7]*n+e[11]*a+e[15]*i,t}function p(t,e,r,n){return f(n,n),f(n,n),f(n,n)}function d(t,e){this.index=t,this.dataCoordinate=this.position=e}function g(t){return!0===t||t>1?1:t}function m(t,e,r,n,a,i,o,s,l,c,u,h){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=a,this.colorBuffer=i,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=c,this.pickOrthoShader=u,this.pickProjectShader=h,this.points=[],this._selectResult=new d(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),c=l.createPickOrtho(e),u=l.createPickProject(e),h=a(e),f=a(e),p=a(e),d=a(e),g=i(e,[{buffer:h,size:3,type:e.FLOAT},{buffer:f,size:4,type:e.FLOAT},{buffer:p,size:2,type:e.FLOAT},{buffer:d,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new m(e,r,n,o,h,f,p,d,g,s,c,u);return v.update(t),v};var v=m.prototype;v.pickSlots=1,v.setPickBase=function(t){this.pickId=t},v.isTransparent=function(){if(this.hasAlpha)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectHasAlpha)return!0;return!1},v.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],x=[0,0,0],b=[0,0,0],_=[0,0,0,1],w=[0,0,0,1],T=h.slice(),k=[0,0,0],M=[[0,0,0],[0,0,0]];function A(t){return t[0]=t[1]=t[2]=0,t}function S(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function E(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function C(t,e,r,n){var a,i=e.axesProject,o=e.gl,l=t.uniforms,c=r.model||h,u=r.view||h,f=r.projection||h,d=e.axesBounds,g=function(t){for(var e=M,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],y[0]=2/o.drawingBufferWidth,y[1]=2/o.drawingBufferHeight,t.bind(),l.view=u,l.projection=f,l.screenSize=y,l.highlightId=e.highlightId,l.highlightScale=e.highlightScale,l.clipBounds=g,l.pickGroup=e.pickId/255,l.pixelRatio=n;for(var m=0;m<3;++m)if(i[m]){l.scale=e.projectScale[m],l.opacity=e.projectOpacity[m];for(var v=T,C=0;C<16;++C)v[C]=0;for(C=0;C<4;++C)v[5*C]=1;v[5*m]=0,a[m]<0?v[12+m]=d[0][m]:v[12+m]=d[1][m],s(v,c,v),l.model=v;var L=(m+1)%3,P=(m+2)%3,I=A(x),z=A(b);I[L]=1,z[P]=1;var O=p(0,0,0,S(_,I)),D=p(0,0,0,S(w,z));if(Math.abs(O[1])>Math.abs(D[1])){var R=O;O=D,D=R,R=I,I=z,z=R;var F=L;L=P,P=F}O[0]<0&&(I[L]=-1),D[1]>0&&(z[P]=-1);var B=0,N=0;for(C=0;C<4;++C)B+=Math.pow(c[4*L+C],2),N+=Math.pow(c[4*P+C],2);I[L]/=Math.sqrt(B),z[P]/=Math.sqrt(N),l.axes[0]=I,l.axes[1]=z,l.fragClipBounds[0]=E(k,g[0],m,-1e8),l.fragClipBounds[1]=E(k,g[1],m,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 L=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];function P(t,e,r,n,a,i,o){var s=r.gl;if((i===r.projectHasAlpha||o)&&C(e,r,n,a),i===r.hasAlpha||o){t.bind();var l=t.uniforms;l.model=n.model||h,l.view=n.view||h,l.projection=n.projection||h,y[0]=2/s.drawingBufferWidth,y[1]=2/s.drawingBufferHeight,l.screenSize=y,l.highlightId=r.highlightId,l.highlightScale=r.highlightScale,l.fragClipBounds=L,l.clipBounds=r.axes.bounds,l.opacity=r.opacity,l.pickGroup=r.pickId/255,l.pixelRatio=a,r.vao.bind(),r.vao.draw(s.TRIANGLES,r.vertexCount),r.lineWidth>0&&(s.lineWidth(r.lineWidth*a),r.vao.draw(s.LINES,r.lineVertexCount,r.vertexCount)),r.vao.unbind()}}function I(t,e,r,a){var i;i=Array.isArray(t)?e=this.pointCount||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var a=0;a<3;++a)n.position[a]=n.dataCoordinate[a]=r[a];return n},v.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,a=e>>16&255;this.highlightId=[r/255,n/255,a/255,0]}else this.highlightId=[1,1,1,1]},v.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 a,i,s=t.position,l=t.font||"normal",c=t.alignment||[0,0];if(2===c.length)a=c[0],i=c[1];else{a=[],i=[];for(n=0;n0){var z=0,O=x,D=[0,0,0,1],R=[0,0,0,1],F=Array.isArray(p)&&Array.isArray(p[0]),B=Array.isArray(v)&&Array.isArray(v[0]);t:for(n=0;n<_;++n){y+=1;for(w=s[n],T=0;T<3;++T){if(isNaN(w[T])||!isFinite(w[T]))continue t;h[T]=Math.max(h[T],w[T]),u[T]=Math.min(u[T],w[T])}k=(N=I(f,n,l,this.pixelRatio)).mesh,M=N.lines,A=N.bounds;var N,j=N.visible;if(j)if(Array.isArray(p)){if(3===(U=F?n0?1-A[0][0]:Y<0?1+A[1][0]:1,W*=W>0?1-A[0][1]:W<0?1+A[1][1]:1],X=k.cells||[],J=k.positions||[];for(T=0;T0){var v=r*u;o.drawBox(h-v,f-v,p+v,f+v,i),o.drawBox(h-v,d-v,p+v,d+v,i),o.drawBox(h-v,f-v,h+v,d+v,i),o.drawBox(p-v,f-v,p+v,d+v,i)}}}},s.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},s.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":309,"gl-buffer":258,"gl-shader":312}],311:[function(t,e,r){"use strict";e.exports=function(t,e){var r=e[0],i=e[1],o=n(t,r,i,{}),s=a.mallocUint8(r*i*4);return new l(t,o,s)};var n=t("gl-fbo"),a=t("typedarray-pool"),i=t("ndarray"),o=t("bit-twiddle").nextPow2;function s(t,e,r,n,a){this.coord=[t,e],this.id=r,this.value=n,this.distance=a}function l(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}var c=l.prototype;Object.defineProperty(c,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(t){if(this.gl){this.fbo.shape=t;var e=this.fbo.shape[0],r=this.fbo.shape[1];if(r*e*4>this.buffer.length){a.free(this.buffer);for(var n=this.buffer=a.mallocUint8(o(r*e*4)),i=0;ir)for(t=r;te)for(t=e;t=0){for(var T=0|w.type.charAt(w.type.length-1),k=new Array(T),M=0;M=0;)A+=1;_[y]=A}var S=new Array(r.length);function E(){f.program=o.program(p,f._vref,f._fref,b,_);for(var t=0;t=0){if((d=f.charCodeAt(f.length-1)-48)<2||d>4)throw new n("","Invalid data type for attribute "+h+": "+f);o(t,e,p[0],a,d,i,h)}else{if(!(f.indexOf("mat")>=0))throw new n("","Unknown data type for attribute "+h+": "+f);var d;if((d=f.charCodeAt(f.length-1)-48)<2||d>4)throw new n("","Invalid data type for attribute "+h+": "+f);s(t,e,p,a,d,i,h)}}}return i};var n=t("./GLError");function a(t,e,r,n,a,i){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=a,this._constFunc=i}var i=a.prototype;function o(t,e,r,n,i,o,s){for(var l=["gl","v"],c=[],u=0;u4)throw new a("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new a("","Unknown uniform data type for "+name+": "+r)}if((i=r.charCodeAt(r.length-1)-48)<2||i>4)throw new a("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new a("","Unrecognized data type for vector "+name+": "+r)}}}function c(e){for(var n=["return function updateProperty(obj){"],a=function t(e,r){if("object"!=typeof r)return[[e,r]];var n=[];for(var a in r){var i=r[a],o=e;parseInt(a)+""===a?o+="["+a+"]":o+="."+a,"object"==typeof i?n.push.apply(n,t(o,i)):n.push([o,i])}return n}("",e),i=0;i4)throw new a("","Invalid data type");return"b"===t.charAt(0)?o(r,!1):o(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r;if((r=t.charCodeAt(t.length-1)-48)<2||r>4)throw new a("","Invalid uniform dimension type for matrix "+name+": "+t);return o(r*r,0)}throw new a("","Unknown uniform data type for "+name+": "+t)}}(r[u].type);var p}function h(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){s[0]in i||(i[s[0]]=[]),i=i[s[0]];for(var l=1;l1)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;\n\nuniform float vectorScale, tubeScale;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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"]),i=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, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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:a,fragment:i,attributes:[{name:"position",type:"vec4"},{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:413}],323:[function(t,e,r){"use strict";var n=t("gl-vec3"),a=t("gl-vec4"),i=["xyz","xzy","yxz","yzx","zxy","zyx"],o=function(t,e,r,i){for(var o=0,s=0;s0)for(T=0;T<8;T++){var k=(T+1)%8;c.push(f[T],p[T],p[k],p[k],f[k],f[T]),h.push(y,v,v,v,y,y),d.push(g,m,m,m,g,g);var M=c.length;u.push([M-6,M-5,M-4],[M-3,M-2,M-1])}var A=f;f=p,p=A;var S=y;y=v,v=S;var E=g;g=m,m=E}return{positions:c,cells:u,vectors:h,vertexIntensity:d}}(t,r,i,o)})),h=[],f=[],p=[],d=[];for(s=0;se)return r-1}return r},l=function(t,e,r){return tr?r:t},c=function(t){var e=1/0;t.sort((function(t,e){return t-e}));for(var r=t.length,n=1;nh-1||y>f-1||x>p-1)return n.create();var b,_,w,T,k,M,A=i[0][d],S=i[0][v],E=i[1][g],C=i[1][y],L=i[2][m],P=(o-A)/(S-A),I=(c-E)/(C-E),z=(u-L)/(i[2][x]-L);switch(isFinite(P)||(P=.5),isFinite(I)||(I=.5),isFinite(z)||(z=.5),r.reversedX&&(d=h-1-d,v=h-1-v),r.reversedY&&(g=f-1-g,y=f-1-y),r.reversedZ&&(m=p-1-m,x=p-1-x),r.filled){case 5:k=m,M=x,w=g*p,T=y*p,b=d*p*f,_=v*p*f;break;case 4:k=m,M=x,b=d*p,_=v*p,w=g*p*h,T=y*p*h;break;case 3:w=g,T=y,k=m*f,M=x*f,b=d*f*p,_=v*f*p;break;case 2:w=g,T=y,b=d*f,_=v*f,k=m*f*h,M=x*f*h;break;case 1:b=d,_=v,k=m*h,M=x*h,w=g*h*p,T=y*h*p;break;default:b=d,_=v,w=g*h,T=y*h,k=m*h*f,M=x*h*f}var O=a[b+w+k],D=a[b+w+M],R=a[b+T+k],F=a[b+T+M],B=a[_+w+k],N=a[_+w+M],j=a[_+T+k],U=a[_+T+M],V=n.create(),q=n.create(),H=n.create(),G=n.create();n.lerp(V,O,B,P),n.lerp(q,D,N,P),n.lerp(H,R,j,P),n.lerp(G,F,U,P);var Y=n.create(),W=n.create();n.lerp(Y,V,H,I),n.lerp(W,q,G,I);var Z=n.create();return n.lerp(Z,Y,W,z),Z}(e,t,p)},g=t.getDivergence||function(t,e){var r=n.create(),a=1e-4;n.add(r,t,[a,0,0]);var i=d(r);n.subtract(i,i,e),n.scale(i,i,1/a),n.add(r,t,[0,a,0]);var o=d(r);n.subtract(o,o,e),n.scale(o,o,1/a),n.add(r,t,[0,0,a]);var s=d(r);return n.subtract(s,s,e),n.scale(s,s,1/a),n.add(r,i,o),n.add(r,r,s),r},m=[],v=e[0][0],y=e[0][1],x=e[0][2],b=e[1][0],_=e[1][1],w=e[1][2],T=function(t){var e=t[0],r=t[1],n=t[2];return!(eb||r_||nw)},k=10*n.distance(e[0],e[1])/a,M=k*k,A=1,S=0,E=r.length;E>1&&(A=function(t){for(var e=[],r=[],n=[],a={},i={},o={},s=t.length,l=0;lS&&(S=F),D.push(F),m.push({points:P,velocities:I,divergences:D});for(var B=0;B<100*a&&P.lengthM&&n.scale(N,N,k/Math.sqrt(j)),n.add(N,N,L),z=d(N),n.squaredDistance(O,N)-M>-1e-4*M){P.push(N),O=N,I.push(z);R=g(N,z),F=n.length(R);isFinite(F)&&F>S&&(S=F),D.push(F)}L=N}}var U=o(m,t.colormap,S,A);return h?U.tubeScale=h:(0===S&&(S=1),U.tubeScale=.5*u*A/S),U};var u=t("./lib/shaders"),h=t("gl-cone3d").createMesh;e.exports.createTubeMesh=function(t,e){return h(t,e,{shaders:u,traceType:"streamtube"})}},{"./lib/shaders":322,"gl-cone3d":259,"gl-vec3":351,"gl-vec4":387}],324:[function(t,e,r){var n=t("gl-shader"),a=t("glslify"),i=a(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform vec3 objectOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\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 localCoordinate = vec3(uv.zw, f.x);\n worldCoordinate = objectOffset + localCoordinate;\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n"]),o=a(["precision 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 beckmannSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\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 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 (\n kill > 0.0 ||\n vColor.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)\n ) 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=a(["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=a(["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,i,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,i,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":312,glslify:413}],325:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=y(e),n=b(e),s=x(e),l=_(e),c=a(e),u=i(e,[{buffer:c,size:4,stride:40,offset:0},{buffer:c,size:3,stride:40,offset:16},{buffer:c,size:3,stride:40,offset:28}]),h=a(e),f=i(e,[{buffer:h,size:4,stride:20,offset:0},{buffer:h,size:1,stride:20,offset:16}]),p=a(e),d=i(e,[{buffer:p,size:2,type:e.FLOAT}]),g=o(e,1,256,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var m=new A(e,[0,0],[[0,0,0],[0,0,0]],r,n,c,u,g,s,l,h,f,p,d,[0,0,0]),v={levels:[[],[],[]]};for(var w in t)v[w]=t[w];return v.colormap=v.colormap||"jet",m.update(v),m};var n=t("bit-twiddle"),a=t("gl-buffer"),i=t("gl-vao"),o=t("gl-texture2d"),s=t("typedarray-pool"),l=t("colormap"),c=t("ndarray-ops"),u=t("ndarray-pack"),h=t("ndarray"),f=t("surface-nets"),p=t("gl-mat4/multiply"),d=t("gl-mat4/invert"),g=t("binary-search-bounds"),m=t("ndarray-gradient"),v=t("./lib/shaders"),y=v.createShader,x=v.createContourShader,b=v.createPickShader,_=v.createPickContourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],T=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],k=[[0,0,0,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 M(t,e,r,n,a){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=a}!function(){for(var t=0;t<3;++t){var e=k[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();function A(t,e,r,n,a,i,o,l,c,u,f,p,d,g,m){this.gl=t,this.shape=e,this.bounds=r,this.objectOffset=m,this.intensityBounds=[],this._shader=n,this._pickShader=a,this._coordinateBuffer=i,this._vao=o,this._colorMap=l,this._contourShader=c,this._contourPickShader=u,this._contourBuffer=f,this._contourVAO=p,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new M([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,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=[h(s.mallocFloat(1024),[0,0]),h(s.mallocFloat(1024),[0,0]),h(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.opacityscale=!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=A.prototype;S.isTransparent=function(){return this.opacity<1||this.opacityscale},S.isOpaque=function(){if(this.opacityscale)return!1;if(this.opacity<1)return!1;if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0)return!0;return!1},S.pickSlots=1,S.setPickBase=function(t){this.pickId=t};var E=[0,0,0],C={showSurface:!1,showContour:!1,projections:[w.slice(),w.slice(),w.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function L(t,e){var r,n,a,i=e.axes&&e.axes.lastCubeProps.axis||E,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=C.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[+(i[r]>0)][r],p(l,t.model,l);var c=C.clipBounds[r];for(a=0;a<2;++a)for(n=0;n<3;++n)c[a][n]=t.clipBounds[a][n];c[0][r]=-1e8,c[1][r]=1e8}return C.showSurface=o,C.showContour=s,C}var P={model:w,view:w,projection:w,inverseModel:w.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},I=w.slice(),z=[1,0,0,0,1,0,0,0,1];function O(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=P;n.model=t.model||w,n.view=t.view||w,n.projection=t.projection||w,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=d(n.inverseModel,n.model);for(var a=0;a<2;++a)for(var i=n.clipBounds[a],o=0;o<3;++o)i[o]=Math.min(Math.max(this.clipBounds[a][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=z,n.vertexColor=this.vertexColor;var s=I;for(p(s,n.view,n.model),p(s,n.projection,s),d(s,s),a=0;a<3;++a)n.eyePosition[a]=s[12+a]/s[15];var l=s[15];for(a=0;a<3;++a)l+=this.lightPosition[a]*s[4*a+3];for(a=0;a<3;++a){var c=s[12+a];for(o=0;o<3;++o)c+=s[4*o+a]*this.lightPosition[o];n.lightPosition[a]=c/l}var u=L(n,this);if(u.showSurface){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),a=0;a<3;++a)this.surfaceProject[a]&&this.vertexCount&&(this._shader.uniforms.model=u.projections[a],this._shader.uniforms.clipBounds=u.clipBounds[a],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(u.showContour){var h=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,h.bind(),h.uniforms=n;var f=this._contourVAO;for(f.bind(),a=0;a<3;++a)for(h.uniforms.permutation=k[a],r.lineWidth(this.contourWidth[a]*this.pixelRatio),o=0;o>4)/16)/255,a=Math.floor(n),i=n-a,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;a+=1,s+=1;var c=r.position;c[0]=c[1]=c[2]=0;for(var u=0;u<2;++u)for(var h=u?i:1-i,f=0;f<2;++f)for(var p=a+u,d=s+f,m=h*(f?l:1-l),v=0;v<3;++v)c[v]+=this._field[v].get(p,d)*m;for(var y=this._pickResult.level,x=0;x<3;++x)if(y[x]=g.le(this.contourLevels[x],c[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]Math.abs(_-c[x])&&(y[x]+=1)}for(r.index[0]=i<.5?a:a+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],v=0;v<3;++v)r.dataCoordinate[v]=this._field[v].get(r.index[0],r.index[1]);return r},S.padField=function(t,e){var r=e.shape.slice(),n=t.shape.slice();c.assign(t.lo(1,1).hi(r[0],r[1]),e),c.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),c.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),c.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),c.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=R(t.contourWidth,Number)),"showContour"in t&&(this.showContour=R(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=R(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=B(t.contourColor)),"contourProject"in t&&(this.contourProject=R(t.contourProject,(function(t){return R(t,Boolean)}))),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=B(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=R(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=R(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"opacityscale"in t&&(this.opacityscale=t.opacityscale),"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 a=(e.shape[0]+2)*(e.shape[1]+2);a>this._field[2].data.length&&(s.freeFloat(this._field[2].data),this._field[2].data=s.mallocFloat(n.nextPow2(a))),this._field[2]=h(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 i=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]=h(this._field[o].data,[i[0]+2,i[1]+2]);if(t.coords){var p=t.coords;if(!Array.isArray(p)||3!==p.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var d=p[o];for(b=0;b<2;++b)if(d.shape[b]!==i[b])throw new Error("gl-surface: coords have incorrect shape");this.padField(this._field[o],d)}}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 v=g[o];if((Array.isArray(v)||v.length)&&(v=h(v)),v.shape[0]!==i[o])throw new Error("gl-surface: invalid tick length");var y=h(v.data,i);y.stride[o]=v.stride[0],y.stride[1^o]=0,this.padField(this._field[o],y)}}else{for(o=0;o<2;++o){var x=[0,0];x[o]=1,this._field[o]=h(this._field[o].data,[i[0]+2,i[1]+2],x,0)}this._field[0].set(0,0,0);for(var b=0;b0){for(var wt=0;wt<5;++wt)et.pop();H-=1}continue t}et.push(ot[0],ot[1],ct[0],ct[1],ot[2]),H+=1}}it.push(H)}this._contourOffsets[rt]=at,this._contourCounts[rt]=it}var Tt=s.mallocFloat(et.length);for(o=0;ot&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}(r/255,e):1;return[t[0],t[1],t[2],255*n]}))]);return c.divseq(r,255),r}(t.colormap,this.opacityscale))},S.dispose=function(){this._shader.dispose(),this._vao.dispose(),this._coordinateBuffer.dispose(),this._colorMap.dispose(),this._contourBuffer.dispose(),this._contourVAO.dispose(),this._contourShader.dispose(),this._contourPickShader.dispose(),this._dynamicBuffer.dispose(),this._dynamicVAO.dispose();for(var t=0;t<3;++t)s.freeFloat(this._field[t].data)},S.highlight=function(t){var e,r;if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(e=0;e<3;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;for(r=this.snapToData?t.dataCoordinate:t.position,e=0;e<3;++e)r[e]-=this.objectOffset[e];if(this.enableDynamic[0]&&r[0]!==this.dynamicLevel[0]||this.enableDynamic[1]&&r[1]!==this.dynamicLevel[1]||this.enableDynamic[2]&&r[2]!==this.dynamicLevel[2]){for(var n=0,a=this.shape,i=s.mallocFloat(12*a[0]*a[1]),o=0;o<3;++o)if(this.enableDynamic[o]){this.dynamicLevel[o]=r[o];var l=(o+1)%3,c=(o+2)%3,u=this._field[o],h=this._field[l],p=this._field[c],d=f(u,r[o]),g=d.cells,m=d.positions;for(this._dynamicOffsets[o]=n,e=0;e halfCharStep + halfCharWidth ||\n\t\t\t\t\tfloor(uv.x) < halfCharStep - halfCharWidth) return;\n\n\t\t\t\tuv += charId * charStep;\n\t\t\t\tuv = uv / atlasSize;\n\n\t\t\t\tvec4 color = fontColor;\n\t\t\t\tvec4 mask = texture2D(atlas, uv);\n\n\t\t\t\tfloat maskY = lightness(mask);\n\t\t\t\t// float colorY = lightness(color);\n\t\t\t\tcolor.a *= maskY;\n\t\t\t\tcolor.a *= opacity;\n\n\t\t\t\t// color.a += .1;\n\n\t\t\t\t// antialiasing, see yiq color space y-channel formula\n\t\t\t\t// color.rgb += (1. - color.rgb) * (1. - mask.rgb);\n\n\t\t\t\tgl_FragColor = color;\n\t\t\t}"});return{regl:t,draw:e,atlas:{}}},T.prototype.update=function(t){var e=this;if("string"==typeof t)t={text:t};else if(!t)return;null!=(t=a(t,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0)).opacity&&(Array.isArray(t.opacity)?this.opacity=t.opacity.map((function(t){return parseFloat(t)})):this.opacity=parseFloat(t.opacity)),null!=t.viewport&&(this.viewport=h(t.viewport),T.normalViewport&&(this.viewport.y=this.canvas.height-this.viewport.y-this.viewport.height),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null==this.viewport&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null!=t.kerning&&(this.kerning=t.kerning),null!=t.offset&&("number"==typeof t.offset&&(t.offset=[t.offset,0]),this.positionOffset=y(t.offset)),t.direction&&(this.direction=t.direction),t.range&&(this.range=t.range,this.scale=[1/(t.range[2]-t.range[0]),1/(t.range[3]-t.range[1])],this.translate=[-t.range[0],-t.range[1]]),t.scale&&(this.scale=t.scale),t.translate&&(this.translate=t.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),this.font.length||t.font||(t.font=T.baseFontSize+"px sans-serif");var r,i=!1,o=!1;if(t.font&&(Array.isArray(t.font)?t.font:[t.font]).forEach((function(t,r){if("string"==typeof t)try{t=n.parse(t)}catch(e){t=n.parse(T.baseFontSize+"px "+t)}else t=n.parse(n.stringify(t));var a=n.stringify({size:T.baseFontSize,family:t.family,stretch:_?t.stretch:void 0,variant:t.variant,weight:t.weight,style:t.style}),s=p(t.size),l=Math.round(s[0]*d(s[1]));if(l!==e.fontSize[r]&&(o=!0,e.fontSize[r]=l),!(e.font[r]&&a==e.font[r].baseString||(i=!0,e.font[r]=T.fonts[a],e.font[r]))){var c=t.family.join(", "),u=[t.style];t.style!=t.variant&&u.push(t.variant),t.variant!=t.weight&&u.push(t.weight),_&&t.weight!=t.stretch&&u.push(t.stretch),e.font[r]={baseString:a,family:c,weight:t.weight,stretch:t.stretch,style:t.style,variant:t.variant,width:{},kerning:{},metrics:v(c,{origin:"top",fontSize:T.baseFontSize,fontStyle:u.join(" ")})},T.fonts[a]=e.font[r]}})),(i||o)&&this.font.forEach((function(r,a){var i=n.stringify({size:e.fontSize[a],family:r.family,stretch:_?r.stretch:void 0,variant:r.variant,weight:r.weight,style:r.style});if(e.fontAtlas[a]=e.shader.atlas[i],!e.fontAtlas[a]){var o=r.metrics;e.shader.atlas[i]=e.fontAtlas[a]={fontString:i,step:2*Math.ceil(e.fontSize[a]*o.bottom*.5),em:e.fontSize[a],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:e.regl.texture()}}null==t.text&&(t.text=e.text)})),"string"==typeof t.text&&t.position&&t.position.length>2){for(var s=Array(.5*t.position.length),f=0;f2){for(var w=!t.position[0].length,k=u.mallocFloat(2*this.count),M=0,A=0;M1?e.align[r]:e.align[0]:e.align;if("number"==typeof n)return n;switch(n){case"right":case"end":return-t;case"center":case"centre":case"middle":return.5*-t}return 0}))),null==this.baseline&&null==t.baseline&&(t.baseline=0),null!=t.baseline&&(this.baseline=t.baseline,Array.isArray(this.baseline)||(this.baseline=[this.baseline]),this.baselineOffset=this.baseline.map((function(t,r){var n=(e.font[r]||e.font[0]).metrics,a=0;return a+=.5*n.bottom,a+="number"==typeof t?t-n.baseline:-n[t],T.normalViewport||(a*=-1),a}))),null!=t.color)if(t.color||(t.color="transparent"),"string"!=typeof t.color&&isNaN(t.color)){var H;if("number"==typeof t.color[0]&&t.color.length>this.counts.length){var G=t.color.length;H=u.mallocUint8(G);for(var Y=(t.color.subarray||t.color.slice).bind(t.color),W=0;W4||this.baselineOffset.length>1||this.align&&this.align.length>1||this.fontAtlas.length>1||this.positionOffset.length>2){var J=Math.max(.5*this.position.length||0,.25*this.color.length||0,this.baselineOffset.length||0,this.alignOffset.length||0,this.font.length||0,this.opacity.length||0,.5*this.positionOffset.length||0);this.batch=Array(J);for(var K=0;K1?this.counts[K]:this.counts[0],offset:this.textOffsets.length>1?this.textOffsets[K]:this.textOffsets[0],color:this.color?this.color.length<=4?this.color:this.color.subarray(4*K,4*K+4):[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[K]:this.opacity,baseline:null!=this.baselineOffset[K]?this.baselineOffset[K]:this.baselineOffset[0],align:this.align?null!=this.alignOffset[K]?this.alignOffset[K]:this.alignOffset[0]:0,atlas:this.fontAtlas[K]||this.fontAtlas[0],positionOffset:this.positionOffset.length>2?this.positionOffset.subarray(2*K,2*K+2):this.positionOffset}}else this.count?this.batch=[{count:this.count,offset:0,color:this.color||[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[0]:this.opacity,baseline:this.baselineOffset[0],align:this.alignOffset?this.alignOffset[0]:0,atlas:this.fontAtlas[0],positionOffset:this.positionOffset}]:this.batch=[]},T.prototype.destroy=function(){},T.prototype.kerning=!0,T.prototype.position={constant:new Float32Array(2)},T.prototype.translate=null,T.prototype.scale=null,T.prototype.font=null,T.prototype.text="",T.prototype.positionOffset=[0,0],T.prototype.opacity=1,T.prototype.color=new Uint8Array([0,0,0,255]),T.prototype.alignOffset=[0,0],T.normalViewport=!1,T.maxAtlasSize=1024,T.atlasCanvas=document.createElement("canvas"),T.atlasContext=T.atlasCanvas.getContext("2d",{alpha:!1}),T.baseFontSize=64,T.fonts={},e.exports=T},{"bit-twiddle":97,"color-normalize":125,"css-font":144,"detect-kerning":172,"es6-weak-map":233,"flatten-vertex-data":244,"font-atlas":245,"font-measure":246,"gl-util/context":328,"is-plain-obj":443,"object-assign":473,"parse-rect":478,"parse-unit":480,"pick-by-alias":485,regl:512,"to-px":550,"typedarray-pool":567}],327:[function(t,e,r){"use strict";var n=t("ndarray"),a=t("ndarray-ops"),i=t("typedarray-pool");e.exports=function(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");o||c(t);if("number"==typeof arguments[1])return v(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return v(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=u(e)?e:e.raw;if(r)return y(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return x(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var o=null,s=null,l=null;function c(t){o=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],s=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],l=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}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 h=function(t,e){a.muls(t,e,255)};function f(t,e,r){var n=t.gl,a=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)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 p(t,e,r,n,a,i){this.gl=t,this.handle=e,this.format=a,this.type=i,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=p.prototype;function g(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 m(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,a){var i=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture shape");if(a===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=m(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,a,null),new p(t,o,e,r,n,a)}function y(t,e,r,n,a,i){var o=m(t);return t.texImage2D(t.TEXTURE_2D,0,a,a,i,e),new p(t,o,r,n,a,i)}function x(t,e){var r=e.dtype,o=e.shape.slice(),s=t.getParameter(t.MAX_TEXTURE_SIZE);if(o[0]<0||o[0]>s||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=g(o,e.stride.slice()),c=0;"float32"===r?c=t.FLOAT:"float64"===r?(c=t.FLOAT,l=!1,r="float32"):"uint8"===r?c=t.UNSIGNED_BYTE:(c=t.UNSIGNED_BYTE,l=!1,r="uint8");var u,f,d=0;if(2===o.length)d=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])d=t.ALPHA;else if(2===o[2])d=t.LUMINANCE_ALPHA;else if(3===o[2])d=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");d=t.RGBA}}c!==t.FLOAT||t.getExtension("OES_texture_float")||(c=t.UNSIGNED_BYTE,l=!1);var v=e.size;if(l)u=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var y=[o[2],o[2]*o[0],1];f=i.malloc(v,r);var x=n(f,o,y,0);"float32"!==r&&"float64"!==r||c!==t.UNSIGNED_BYTE?a.assign(x,e):h(x,e),u=f.subarray(0,v)}var b=m(t);return t.texImage2D(t.TEXTURE_2D,0,d,o[0],o[1],0,d,c,u),l||i.free(f),new p(t,b,o[0],o[1],d,c)}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,c,u){var f=u.dtype,p=u.shape.slice();if(p.length<2||p.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var d=0,m=0,v=g(p,u.stride.slice());"float32"===f?d=t.FLOAT:"float64"===f?(d=t.FLOAT,v=!1,f="float32"):"uint8"===f?d=t.UNSIGNED_BYTE:(d=t.UNSIGNED_BYTE,v=!1,f="uint8");if(2===p.length)m=t.LUMINANCE,p=[p[0],p[1],1],u=n(u.data,p,[u.stride[0],u.stride[1],1],u.offset);else{if(3!==p.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===p[2])m=t.ALPHA;else if(2===p[2])m=t.LUMINANCE_ALPHA;else if(3===p[2])m=t.RGB;else{if(4!==p[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");m=t.RGBA}p[2]}m!==t.LUMINANCE&&m!==t.ALPHA||s!==t.LUMINANCE&&s!==t.ALPHA||(m=s);if(m!==s)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=u.size,x=c.indexOf(o)<0;x&&c.push(o);if(d===l&&v)0===u.offset&&u.data.length===y?x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,u.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,u.data):x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,u.data.subarray(u.offset,u.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,u.data.subarray(u.offset,u.offset+y));else{var b;b=l===t.FLOAT?i.mallocFloat32(y):i.mallocUint8(y);var _=n(b,p,[p[2],p[2]*p[0],1]);d===t.FLOAT&&l===t.UNSIGNED_BYTE?h(_,u):a.assign(_,u),x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,b.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,b.subarray(0,y)),l===t.FLOAT?i.freeFloat32(b):i.freeUint8(b)}}(s,e,r,o,this.format,this.type,this._mipLevels,t)}}},{ndarray:469,"ndarray-ops":464,"typedarray-pool":567}],328:[function(t,e,r){(function(r){"use strict";var n=t("pick-by-alias");function a(t){if(t.container)if(t.container==document.body)document.body.style.width||(t.canvas.width=t.width||t.pixelRatio*r.innerWidth),document.body.style.height||(t.canvas.height=t.height||t.pixelRatio*r.innerHeight);else{var e=t.container.getBoundingClientRect();t.canvas.width=t.width||e.right-e.left,t.canvas.height=t.height||e.bottom-e.top}}function i(t){return"function"==typeof t.getContext&&"width"in t&&"height"in t}function o(){var t=document.createElement("canvas");return t.style.position="absolute",t.style.top=0,t.style.left=0,t}e.exports=function(t){var e;if(t?"string"==typeof t&&(t={container:t}):t={},i(t)?t={container:t}:t="string"==typeof(e=t).nodeName&&"function"==typeof e.appendChild&&"function"==typeof e.getBoundingClientRect?{container:t}:function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(t)?{gl:t}:n(t,{container:"container target element el canvas holder parent parentNode wrapper use ref root node",gl:"gl context webgl glContext",attrs:"attributes attrs contextAttributes",pixelRatio:"pixelRatio pxRatio px ratio pxratio pixelratio",width:"w width",height:"h height"},!0),t.pixelRatio||(t.pixelRatio=r.pixelRatio||1),t.gl)return t.gl;if(t.canvas&&(t.container=t.canvas.parentNode),t.container){if("string"==typeof t.container){var s=document.querySelector(t.container);if(!s)throw Error("Element "+t.container+" is not found");t.container=s}i(t.container)?(t.canvas=t.container,t.container=t.canvas.parentNode):t.canvas||(t.canvas=o(),t.container.appendChild(t.canvas),a(t))}else if(!t.canvas){if("undefined"==typeof document)throw Error("Not DOM environment. Use headless-gl.");t.container=document.body||document.documentElement,t.canvas=o(),t.container.appendChild(t.canvas),a(t)}if(!t.gl)try{t.gl=t.canvas.getContext("webgl",t.attrs)}catch(e){try{t.gl=t.canvas.getContext("experimental-webgl",t.attrs)}catch(e){t.gl=t.canvas.getContext("webgl-experimental",t.attrs)}}return t.gl}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"pick-by-alias":485}],329:[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 a=0;a1?0:Math.acos(s)};var n=t("./fromValues"),a=t("./normalize"),i=t("./dot")},{"./dot":344,"./fromValues":350,"./normalize":361}],335:[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}},{}],336:[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}},{}],337:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}},{}],338:[function(t,e,r){e.exports=function(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}},{}],339:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],l=r[2];return t[0]=a*l-i*s,t[1]=i*o-n*l,t[2]=n*s-a*o,t}},{}],340:[function(t,e,r){e.exports=t("./distance")},{"./distance":341}],341:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return Math.sqrt(r*r+n*n+a*a)}},{}],342:[function(t,e,r){e.exports=t("./divide")},{"./divide":343}],343:[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}},{}],344:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],345:[function(t,e,r){e.exports=1e-6},{}],346:[function(t,e,r){e.exports=function(t,e){var r=t[0],a=t[1],i=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(a-s)<=n*Math.max(1,Math.abs(a),Math.abs(s))&&Math.abs(i-l)<=n*Math.max(1,Math.abs(i),Math.abs(l))};var n=t("./epsilon")},{"./epsilon":345}],347:[function(t,e,r){e.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}},{}],348:[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}},{}],349:[function(t,e,r){e.exports=function(t,e,r,a,i,o){var s,l;e||(e=3);r||(r=0);l=a?Math.min(a*e+r,t.length):t.length;for(s=r;s0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i);return t}},{}],362:[function(t,e,r){e.exports=function(t,e){e=e||1;var r=2*Math.random()*Math.PI,n=2*Math.random()-1,a=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=n*e,t}},{}],363:[function(t,e,r){e.exports=function(t,e,r,n){var a=r[1],i=r[2],o=e[1]-a,s=e[2]-i,l=Math.sin(n),c=Math.cos(n);return t[0]=e[0],t[1]=a+o*c-s*l,t[2]=i+o*l+s*c,t}},{}],364:[function(t,e,r){e.exports=function(t,e,r,n){var a=r[0],i=r[2],o=e[0]-a,s=e[2]-i,l=Math.sin(n),c=Math.cos(n);return t[0]=a+s*l+o*c,t[1]=e[1],t[2]=i+s*c-o*l,t}},{}],365:[function(t,e,r){e.exports=function(t,e,r,n){var a=r[0],i=r[1],o=e[0]-a,s=e[1]-i,l=Math.sin(n),c=Math.cos(n);return t[0]=a+o*c-s*l,t[1]=i+o*l+s*c,t[2]=e[2],t}},{}],366:[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}},{}],367:[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}},{}],368:[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}},{}],369:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}},{}],370:[function(t,e,r){e.exports=t("./squaredDistance")},{"./squaredDistance":372}],371:[function(t,e,r){e.exports=t("./squaredLength")},{"./squaredLength":373}],372:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return r*r+n*n+a*a}},{}],373:[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}},{}],374:[function(t,e,r){e.exports=t("./subtract")},{"./subtract":375}],375:[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}},{}],376:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],a=e[1],i=e[2];return t[0]=n*r[0]+a*r[3]+i*r[6],t[1]=n*r[1]+a*r[4]+i*r[7],t[2]=n*r[2]+a*r[5]+i*r[8],t}},{}],377:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[3]*n+r[7]*a+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*a+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*a+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*a+r[10]*i+r[14])/o,t}},{}],378:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],l=r[2],c=r[3],u=c*n+s*i-l*a,h=c*a+l*n-o*i,f=c*i+o*a-s*n,p=-o*n-s*a-l*i;return t[0]=u*c+p*-o+h*-l-f*-s,t[1]=h*c+p*-s+f*-o-u*-l,t[2]=f*c+p*-l+u*-s-h*-o,t}},{}],379:[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}},{}],380:[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}},{}],381:[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}},{}],382:[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}},{}],383:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],i=e[3]-t[3];return Math.sqrt(r*r+n*n+a*a+i*i)}},{}],384:[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}},{}],385:[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]}},{}],386:[function(t,e,r){e.exports=function(t,e,r,n){var a=new Float32Array(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=n,a}},{}],387:[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":379,"./clone":380,"./copy":381,"./create":382,"./distance":383,"./divide":384,"./dot":385,"./fromValues":386,"./inverse":388,"./length":389,"./lerp":390,"./max":391,"./min":392,"./multiply":393,"./negate":394,"./normalize":395,"./random":396,"./scale":397,"./scaleAndAdd":398,"./set":399,"./squaredDistance":400,"./squaredLength":401,"./subtract":402,"./transformMat4":403,"./transformQuat":404}],388:[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}},{}],389:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],a=t[3];return Math.sqrt(e*e+r*r+n*n+a*a)}},{}],390:[function(t,e,r){e.exports=function(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3];return t[0]=a+n*(r[0]-a),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t}},{}],391:[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}},{}],392:[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}},{}],393:[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}},{}],394:[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}},{}],395:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r*r+n*n+a*a+i*i;o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=a*o,t[3]=i*o);return t}},{}],396:[function(t,e,r){var n=t("./normalize"),a=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),a(t,t,e),t}},{"./normalize":395,"./scale":397}],397:[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}},{}],398:[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}},{}],399:[function(t,e,r){e.exports=function(t,e,r,n,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t}},{}],400:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],i=e[3]-t[3];return r*r+n*n+a*a+i*i}},{}],401:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],a=t[3];return e*e+r*r+n*n+a*a}},{}],402:[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}},{}],403:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o,t}},{}],404:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],l=r[2],c=r[3],u=c*n+s*i-l*a,h=c*a+l*n-o*i,f=c*i+o*a-s*n,p=-o*n-s*a-l*i;return t[0]=u*c+p*-o+h*-l-f*-s,t[1]=h*c+p*-s+f*-o-u*-l,t[2]=f*c+p*-l+u*-s-h*-o,t[3]=e[3],t}},{}],405:[function(t,e,r){var n=t("glsl-tokenizer"),a=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 M(r),v+=r.length,(p=p.slice(r.length)).length}}function I(){return/[^a-fA-F0-9]/.test(e)?(M(p.join("")),f=999,u):(p.push(e),r=e,u+1)}function z(){return"."===e||/[eE]/.test(e)?(p.push(e),f=5,r=e,u+1):"x"===e&&1===p.length&&"0"===p[0]?(f=11,p.push(e),r=e,u+1):/[^\d]/.test(e)?(M(p.join("")),f=999,u):(p.push(e),r=e,u+1)}function O(){return"f"===e&&(p.push(e),r=e,u+=1),/[eE]/.test(e)?(p.push(e),r=e,u+1):("-"!==e&&"+"!==e||!/[eE]/.test(r))&&/[^\d]/.test(e)?(M(p.join("")),f=999,u):(p.push(e),r=e,u+1)}function D(){if(/[^\d\w_]/.test(e)){var t=p.join("");return f=k[t]?8:T[t]?7:6,M(p.join("")),f=999,u}return p.push(e),r=e,u+1}};var n=t("./lib/literals"),a=t("./lib/operators"),i=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":408,"./lib/builtins-300es":407,"./lib/literals":410,"./lib/literals-300es":409,"./lib/operators":411}],407:[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":408}],408:[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"]},{}],409:[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","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":410}],410:[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","uint","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"]},{}],411:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],412:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),a=[];return a=(a=a.concat(r(t))).concat(r(null))}},{"./index":406}],413:[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,u=-7,h=r?a-1:0,f=r?-1:1,p=t[e+h];for(h+=f,i=p&(1<<-u)-1,p>>=-u,u+=s;u>0;i=256*i+t[e+h],h+=f,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=n;u>0;o=256*o+t[e+h],h+=f,u-=8);if(0===i)i=1-c;else{if(i===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),i-=c}return(p?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,s,l,c=8*i-a-1,u=(1<>1,f=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=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=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(e*l-1)*Math.pow(2,a),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,a),o=0));a>=8;t[r+p]=255&s,p+=d,s/=256,a-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*g}},{}],417:[function(t,e,r){"use strict";var n=t("./types");e.exports=function(t,e){var r;for(r in n)if(n[r].detect(t,e))return r}},{"./types":420}],418:[function(t,e,r){(function(r){"use strict";var n=t("fs"),a=t("path"),i=t("./types"),o=t("./detector");function s(t,e){var r=o(t,e);if(r in i){var n=i[r].calculate(t,e);if(!1!==n)return n.type=r,n}throw new TypeError("unsupported file type: "+r+" (file: "+e+")")}e.exports=function(t,e){if(r.isBuffer(t))return s(t);if("string"!=typeof t)throw new TypeError("invalid invocation");var i=a.resolve(t);if("function"!=typeof e)return s(function(t){var e=n.openSync(t,"r"),a=n.fstatSync(e).size,i=Math.min(a,524288),o=r.alloc(i);return n.readSync(e,o,0,i,0),n.closeSync(e),o}(i),i);!function(t,e){n.open(t,"r",(function(a,i){if(a)return e(a);n.fstat(i,(function(a,o){if(a)return e(a);var s=o.size;if(s<=0)return e(new Error("File size is not greater than 0 \u2014\u2014 "+t));var l=Math.min(s,524288),c=r.alloc(l);n.read(i,c,0,l,0,(function(t){if(t)return e(t);n.close(i,(function(t){e(t,c)}))}))}))}))}(i,(function(t,r){if(t)return e(t);var n;try{n=s(r,i)}catch(e){t=e}e(t,n)}))},e.exports.types=Object.keys(i)}).call(this,t("buffer").Buffer)},{"./detector":417,"./types":420,buffer:111,fs:109,path:481}],419:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r=r||0,t["readUInt"+e+(n?"BE":"LE")].call(t,r)}},{}],420:[function(t,e,r){"use strict";var n={bmp:t("./types/bmp"),cur:t("./types/cur"),dds:t("./types/dds"),gif:t("./types/gif"),icns:t("./types/icns"),ico:t("./types/ico"),jpg:t("./types/jpg"),png:t("./types/png"),psd:t("./types/psd"),svg:t("./types/svg"),tiff:t("./types/tiff"),webp:t("./types/webp")};e.exports=n},{"./types/bmp":421,"./types/cur":422,"./types/dds":423,"./types/gif":424,"./types/icns":425,"./types/ico":426,"./types/jpg":427,"./types/png":428,"./types/psd":429,"./types/svg":430,"./types/tiff":431,"./types/webp":432}],421:[function(t,e,r){"use strict";e.exports={detect:function(t){return"BM"===t.toString("ascii",0,2)},calculate:function(t){return{width:t.readUInt32LE(18),height:Math.abs(t.readInt32LE(22))}}}},{}],422:[function(t,e,r){"use strict";e.exports={detect:function(t){return 0===t.readUInt16LE(0)&&2===t.readUInt16LE(2)},calculate:t("./ico").calculate}},{"./ico":426}],423:[function(t,e,r){"use strict";e.exports={detect:function(t){return 542327876===t.readUInt32LE(0)},calculate:function(t){return{height:t.readUInt32LE(12),width:t.readUInt32LE(16)}}}},{}],424:[function(t,e,r){"use strict";var n=/^GIF8[79]a/;e.exports={detect:function(t){var e=t.toString("ascii",0,6);return n.test(e)},calculate:function(t){return{width:t.readUInt16LE(6),height:t.readUInt16LE(8)}}}},{}],425:[function(t,e,r){"use strict";var n={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function a(t,e){var r=e+4;return[t.toString("ascii",e,r),t.readUInt32BE(r)]}function i(t){var e=n[t];return{width:e,height:e,type:t}}e.exports={detect:function(t){return"icns"===t.toString("ascii",0,4)},calculate:function(t){var e,r,n,o=t.length,s=8,l=t.readUInt32BE(4);if(r=i((e=a(t,s))[0]),(s+=e[1])===l)return r;for(n={width:r.width,height:r.height,images:[r]};st.length)return;var s=t.slice(r,a);if(274===n(s,16,0,e)){if(3!==n(s,16,2,e))return;if(1!==n(s,32,4,e))return;return n(s,16,8,e)}}}(r,i)}function s(t,e){if(e>t.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(255!==t[e])throw new TypeError("Invalid JPG, marker table corrupted")}e.exports={detect:function(t){return"ffd8"===t.toString("hex",0,2)},calculate:function(t){var e,r,n;for(t=t.slice(4);t.length;){if(r=t.readUInt16BE(0),a(t)&&(e=o(t,r)),s(t,r),192===(n=t[r+1])||193===n||194===n){var l=i(t,r+5);return e?{width:l.width,height:l.height,orientation:e}:l}t=t.slice(r+2)}throw new TypeError("Invalid JPG, no size found")}}},{"../readUInt":419}],428:[function(t,e,r){"use strict";e.exports={detect:function(t){if("PNG\r\n\x1a\n"===t.toString("ascii",1,8)){var e=t.toString("ascii",12,16);if("CgBI"===e&&(e=t.toString("ascii",28,32)),"IHDR"!==e)throw new TypeError("invalid png");return!0}},calculate:function(t){return"CgBI"===t.toString("ascii",12,16)?{width:t.readUInt32BE(32),height:t.readUInt32BE(36)}:{width:t.readUInt32BE(16),height:t.readUInt32BE(20)}}}},{}],429:[function(t,e,r){"use strict";e.exports={detect:function(t){return"8BPS"===t.toString("ascii",0,4)},calculate:function(t){return{width:t.readUInt32BE(18),height:t.readUInt32BE(14)}}}},{}],430:[function(t,e,r){"use strict";var n=/"']|"[^"]*"|'[^']*')*>/;var a={root:n,width:/\swidth=(['"])([^%]+?)\1/,height:/\sheight=(['"])([^%]+?)\1/,viewbox:/\sviewBox=(['"])(.+?)\1/},i={cm:96/2.54,mm:96/2.54/10,m:96/2.54*100,pt:96/72,pc:96/72/12,em:16,ex:8};function o(t){var e=/([0-9.]+)([a-z]*)/.exec(t);if(e)return Math.round(parseFloat(e[1])*(i[e[2]]||1))}function s(t){var e=t.split(" ");return{width:o(e[2]),height:o(e[3])}}e.exports={detect:function(t){return n.test(t)},calculate:function(t){var e=t.toString("utf8").match(a.root);if(e){var r=function(t){var e=t.match(a.width),r=t.match(a.height),n=t.match(a.viewbox);return{width:e&&o(e[2]),height:r&&o(r[2]),viewbox:n&&s(n[2])}}(e[0]);if(r.width&&r.height)return function(t){return{width:t.width,height:t.height}}(r);if(r.viewbox)return function(t){var e=t.viewbox.width/t.viewbox.height;return t.width?{width:t.width,height:Math.floor(t.width/e)}:t.height?{width:Math.floor(t.height*e),height:t.height}:{width:t.viewbox.width,height:t.viewbox.height}}(r)}throw new TypeError("invalid svg")}}},{}],431:[function(t,e,r){(function(r){"use strict";var n=t("fs"),a=t("../readUInt");function i(t,e){var r=a(t,16,8,e);return(a(t,16,10,e)<<16)+r}function o(t){if(t.length>24)return t.slice(12)}e.exports={detect:function(t){var e=t.toString("hex",0,4);return"49492a00"===e||"4d4d002a"===e},calculate:function(t,e){if(!e)throw new TypeError("Tiff doesn't support buffer");var s="BE"===function(t){var e=t.toString("ascii",0,2);return"II"===e?"LE":"MM"===e?"BE":void 0}(t),l=function(t,e){for(var r,n,s,l={};t&&t.length&&(r=a(t,16,0,e),n=a(t,16,2,e),s=a(t,32,4,e),0!==r);)1!==s||3!==n&&4!==n||(l[r]=i(t,e)),t=o(t);return l}(function(t,e,i){var o=a(t,32,4,i),s=1024,l=n.statSync(e).size;o+s>l&&(s=l-o-10);var c=r.alloc(s),u=n.openSync(e,"r");return n.readSync(u,c,0,s,o),c.slice(2)}(t,e,s),s),c=l[256],u=l[257];if(!c||!u)throw new TypeError("Invalid Tiff, missing tags");return{width:c,height:u}}}}).call(this,t("buffer").Buffer)},{"../readUInt":419,buffer:111,fs:109}],432:[function(t,e,r){"use strict";e.exports={detect:function(t){var e="RIFF"===t.toString("ascii",0,4),r="WEBP"===t.toString("ascii",8,12),n="VP8"===t.toString("ascii",12,15);return e&&r&&n},calculate:function(t){var e=t.toString("ascii",12,16);if(t=t.slice(20,30),"VP8X"===e){var r=t[0];return!(!(0==(192&r))||!(0==(1&r)))&&function(t){return{width:1+t.readUIntLE(4,3),height:1+t.readUIntLE(7,3)}}(t)}if("VP8 "===e&&47!==t[0])return function(t){return{width:16383&t.readInt16LE(6),height:16383&t.readInt16LE(8)}}(t);var n=t.toString("hex",3,6);return"VP8L"===e&&"9d012a"!==n&&function(t){return{width:1+((63&t[2])<<8|t[1]),height:1+((15&t[4])<<10|t[3]<<2|(192&t[2])>>6)}}(t)}}},{}],433:[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 a=t[0].length;if(r<=a)throw new Error("Must input at least d+1 points");var o=t.slice(0,a+1),s=n.apply(void 0,o);if(0===s)throw new Error("Input not in general position");for(var l=new Array(a+1),u=0;u<=a;++u)l[u]=u;s<0&&(l[0]=1,l[1]=0);var h=new i(l,new Array(a+1),!1),f=h.adjacent,p=new Array(a+2);for(u=0;u<=a;++u){for(var d=l.slice(),g=0;g<=a;++g)g===u&&(d[g]=-1);var m=d[0];d[0]=d[1],d[1]=m;var v=new i(d,new Array(a+1),!0);f[u]=v,p[u]=v}p[a+1]=h;for(u=0;u<=a;++u){d=f[u].vertices;var y=f[u].adjacent;for(g=0;g<=a;++g){var x=d[g];if(x<0)y[g]=h;else for(var b=0;b<=a;++b)f[b].vertices.indexOf(x)<0&&(y[g]=f[b])}}var _=new c(a,o,p),w=!!e;for(u=a+1;u0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var a=new Function("test",e.join("")),i=n[t+1];return i||(i=n),a(i)}(t)),this.orient=i}var u=c.prototype;u.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,a=this.tuple,i=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 c=s[l];if(c.boundary&&!(c.lastVisited<=-n)){for(var u=c.vertices,h=0;h<=r;++h){var f=u[h];a[h]=f<0?e:i[f]}var p=this.orient();if(p>0)return c;c.lastVisited=-n,0===p&&o.push(c)}}}return null},u.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,a=this.vertices,i=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,c=s.adjacent,u=0;u<=n;++u)i[u]=a[l[u]];s.lastVisited=r;for(u=0;u<=n;++u){var h=c[u];if(!(h.lastVisited>=r)){var f=i[u];i[u]=t;var p=this.orient();if(i[u]=f,p<0){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},u.addPeaks=function(t,e){var r=this.vertices.length-1,n=this.dimension,a=this.vertices,l=this.tuple,c=this.interior,u=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,c.push(e);for(var f=[];h.length>0;){var p=(e=h.pop()).vertices,d=e.adjacent,g=p.indexOf(r);if(!(g<0))for(var m=0;m<=n;++m)if(m!==g){var v=d[m];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;b<=n;++b)y[b]<0?(x=b,l[b]=t):l[b]=a[y[b]];if(this.orient()>0){y[x]=r,v.boundary=!1,c.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var _=v.adjacent,w=p.slice(),T=d.slice(),k=new i(w,T,!0);u.push(k);var M=_.indexOf(e);if(!(M<0)){_[M]=k,T[g]=v,w[m]=-1,T[m]=e,d[m]=k,k.flip();for(b=0;b<=n;++b){var A=w[b];if(!(A<0||A===r)){for(var S=new Array(n-1),E=0,C=0;C<=n;++C){var L=w[C];L<0||C===b||(S[E++]=L)}f.push(new o(S,k,b))}}}}}}f.sort(s);for(m=0;m+1=0?o[l++]=s[u]:c=1&u;if(c===(1&t)){var h=o[0];o[0]=o[1],o[1]=h}e.push(o)}}return e}},{"robust-orientation":520,"simplicial-complex":530}],434:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function a(t,e,r,n,a){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=a,this.count=(e?e.count:0)+(r?r.count:0)+n.length}e.exports=function(t){if(!t||0===t.length)return new v(null);return new v(m(t))};var i=a.prototype;function o(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 s(t,e){var r=m(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 l(t,e){var r=t.intervals([]);r.push(e),s(t,r)}function c(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?0:(r.splice(n,1),s(t,r),1)}function u(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var a=r(t[n]);if(a)return a}}function f(t,e){for(var r=0;r>1],i=[],o=[],s=[];for(r=0;r3*(e+1)?l(this,t):this.left.insert(t):this.left=m([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?l(this,t):this.right.insert(t):this.right=m([t]);else{var r=n.ge(this.leftPoints,t,d),a=n.ge(this.rightPoints,t,g);this.leftPoints.splice(r,0,t),this.rightPoints.splice(a,0,t)}},i.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?c(this,t):2===(s=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?c(this,t):2===(s=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,a=this.left;a.right;)r=a,a=a.right;if(r===this)a.right=this.right;else{var i=this.left,s=this.right;r.count-=a.count,r.right=a.left,a.left=i,a.right=s}o(this,a),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?o(this,this.left):o(this,this.right);return 1}for(i=n.ge(this.leftPoints,t,d);ithis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return h(this.rightPoints,t,e)}return f(this.leftPoints,e)},i.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?h(this.rightPoints,t,r):f(this.leftPoints,r)};var y=v.prototype;y.insert=function(t){this.root?this.root.insert(t):this.root=new a(t[0],null,null,[t],[t])},y.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},y.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},y.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(y,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(y,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":435}],435:[function(t,e,r){arguments[4][243][0].apply(r,arguments)},{dup:243}],436:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r=r-1){h=l.length-1;var d=t-e[r-1];for(p=0;p=r-1)for(var u=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],c[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 p=a(c[h-1],u[h-1],arguments[h]);n.push(p),i.push((p-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],c=s[1],u=t-e,f=u>1e-6?1/u:0;this._time.push(t);for(var h=r;h>0;--h){var p=arguments[h];n.push(a(l[h-1],c[h-1],n[o++]+p)),i.push(p*f)}}},s.idle=function(t){var e=this.lastT();if(!(t=0;--f)n.push(a(l[f],c[f],n[o]+u*i[o])),i.push(0),o+=1}}},{"binary-search-bounds":243,"cubic-hermite":150}],243:[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)}},{}],244:[function(t,e,r){var n=t("dtype");e.exports=function(t,e,r){if(!t)throw new TypeError("must specify data as first parameter");if(r=0|+(r||0),Array.isArray(t)&&t[0]&&"number"==typeof t[0][0]){var i,a,o,s,l=t[0].length,c=t.length*l;e&&"string"!=typeof e||(e=new(n(e||"float32"))(c+r));var u=e.length-r;if(c!==u)throw new Error("source length "+c+" ("+l+"x"+t.length+") does not match destination length "+u);for(i=0,o=r;ie[0]-o[0]/2&&(h=o[0]/2,p+=o[1]);return r}},{"css-font/stringify":147}],246:[function(t,e,r){"use strict";function n(t,e){e||(e={}),("string"==typeof t||Array.isArray(t))&&(e.family=t);var r=Array.isArray(e.family)?e.family.join(", "):e.family;if(!r)throw Error("`family` must be defined");var s=e.size||e.fontSize||e.em||48,l=e.weight||e.fontWeight||"",c=(t=[e.style||e.fontStyle||"",l,s].join(" ")+"px "+r,e.origin||"top");if(n.cache[r]&&s<=n.cache[r].em)return i(n.cache[r],c);var u=e.canvas||n.canvas,f=u.getContext("2d"),h={upper:void 0!==e.upper?e.upper:"H",lower:void 0!==e.lower?e.lower:"x",descent:void 0!==e.descent?e.descent:"p",ascent:void 0!==e.ascent?e.ascent:"h",tittle:void 0!==e.tittle?e.tittle:"i",overshoot:void 0!==e.overshoot?e.overshoot:"O"},p=Math.ceil(1.5*s);u.height=p,u.width=.5*p,f.font=t;var d={top:0};f.clearRect(0,0,p,p),f.textBaseline="top",f.fillStyle="black",f.fillText("H",0,0);var g=a(f.getImageData(0,0,p,p));f.clearRect(0,0,p,p),f.textBaseline="bottom",f.fillText("H",0,p);var m=a(f.getImageData(0,0,p,p));d.lineHeight=d.bottom=p-m+g,f.clearRect(0,0,p,p),f.textBaseline="alphabetic",f.fillText("H",0,p);var v=p-a(f.getImageData(0,0,p,p))-1+g;d.baseline=d.alphabetic=v,f.clearRect(0,0,p,p),f.textBaseline="middle",f.fillText("H",0,.5*p);var y=a(f.getImageData(0,0,p,p));d.median=d.middle=p-y-1+g-.5*p,f.clearRect(0,0,p,p),f.textBaseline="hanging",f.fillText("H",0,.5*p);var x=a(f.getImageData(0,0,p,p));d.hanging=p-x-1+g-.5*p,f.clearRect(0,0,p,p),f.textBaseline="ideographic",f.fillText("H",0,p);var b=a(f.getImageData(0,0,p,p));if(d.ideographic=p-b-1+g,h.upper&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.upper,0,0),d.upper=a(f.getImageData(0,0,p,p)),d.capHeight=d.baseline-d.upper),h.lower&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.lower,0,0),d.lower=a(f.getImageData(0,0,p,p)),d.xHeight=d.baseline-d.lower),h.tittle&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.tittle,0,0),d.tittle=a(f.getImageData(0,0,p,p))),h.ascent&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.ascent,0,0),d.ascent=a(f.getImageData(0,0,p,p))),h.descent&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.descent,0,0),d.descent=o(f.getImageData(0,0,p,p))),h.overshoot){f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.overshoot,0,0);var _=o(f.getImageData(0,0,p,p));d.overshoot=_-v}for(var w in d)d[w]/=s;return d.em=s,n.cache[r]=d,i(d,c)}function i(t,e){var r={};for(var n in"string"==typeof e&&(e=t[e]),t)"em"!==n&&(r[n]=t[n]-e);return r}function a(t){for(var e=t.height,r=t.data,n=3;n0;n-=4)if(0!==r[n])return Math.floor(.25*(n-3)/e)}e.exports=n,n.canvas=document.createElement("canvas"),n.cache={}},{}],247:[function(t,e,r){"use strict";e.exports=function(t){return new s(t||g,null)};function n(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 i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}var l=s.prototype;function c(t,e){var r;if(e.left&&(r=c(t,e.left)))return r;return(r=t(e.key,e.value))||(e.right?c(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){var i;if(n.left)if(i=u(t,e,r,n.left))return i;if(i=r(n.key,n.value))return i}if(n.right)return u(t,e,r,n.right)}function f(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=f(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return f(t,e,r,n,i.right)}function h(t,e){this.tree=t,this._stack=e}Object.defineProperty(l,"keys",{get:function(){var t=[];return this.forEach((function(e,r){t.push(e)})),t}}),Object.defineProperty(l,"values",{get:function(){var t=[];return this.forEach((function(e,r){t.push(r)})),t}}),Object.defineProperty(l,"length",{get:function(){return this.root?this.root._count:0}}),l.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],c=[];i;){var u=r(t,i.key);l.push(i),c.push(u),i=u<=0?i.left:i.right}l.push(new n(0,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){i=l[f];c[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(f=l.length-1;f>1;--f){var h=l[f-1];i=l[f];if(1===h._color||1===i._color)break;var p=l[f-2];if(p.left===h)if(h.left===i){if(!(d=p.right)||0!==d._color){if(p._color=0,p.left=h.right,h._color=1,h.right=p,l[f-2]=h,l[f-1]=i,o(p),o(h),f>=3)(g=l[f-3]).left===p?g.left=h:g.right=h;break}h._color=1,p.right=a(1,d),p._color=0,f-=1}else{if(!(d=p.right)||0!==d._color){if(h.right=i.left,p._color=0,p.left=i.right,i._color=1,i.left=h,i.right=p,l[f-2]=i,l[f-1]=h,o(p),o(h),o(i),f>=3)(g=l[f-3]).left===p?g.left=i:g.right=i;break}h._color=1,p.right=a(1,d),p._color=0,f-=1}else if(h.right===i){if(!(d=p.left)||0!==d._color){if(p._color=0,p.right=h.left,h._color=1,h.left=p,l[f-2]=h,l[f-1]=i,o(p),o(h),f>=3)(g=l[f-3]).right===p?g.right=h:g.left=h;break}h._color=1,p.left=a(1,d),p._color=0,f-=1}else{var d;if(!(d=p.left)||0!==d._color){var g;if(h.left=i.right,p._color=0,p.right=i.left,i._color=1,i.right=h,i.left=p,l[f-2]=i,l[f-1]=h,o(p),o(h),o(i),f>=3)(g=l[f-3]).right===p?g.right=i:g.left=i;break}h._color=1,p.left=a(1,d),p._color=0,f-=1}}return l[0]._color=1,new s(r,l[0])},l.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return c(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return f(e,r,this._compare,t,this.root)}},Object.defineProperty(l,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(l,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),l.at=function(t){if(t<0)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new h(this,[])},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n)},l.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 h(this,n);r=i<=0?r.left:r.right}return new h(this,[])},l.remove=function(t){var e=this.find(t);return e?e.remove():this},l.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 p=h.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 g(t,e){return te?1:0}Object.defineProperty(p,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(p,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),p.clone=function(){return new h(this.tree,this._stack.slice())},p.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 n(r._color,r.key,r.value,r.left,r.right,r._count);for(var l=t.length-2;l>=0;--l){(r=t[l]).left===t[l+1]?e[l]=new n(r._color,r.key,r.value,e[l+1],r.right,r._count):e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count)}if((r=e[e.length-1]).left&&r.right){var c=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var u=e[c-1];e.push(new n(r._color,u.key,u.value,r.left,r.right,r._count)),e[c-1].key=r.key,e[c-1].value=r.value;for(l=e.length-2;l>=c;--l)r=e[l],e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count);e[c-1].left=e[c]}if(0===(r=e[e.length-1])._color){var f=e[e.length-2];f.left===r?f.left=null:f.right===r&&(f.right=null),e.pop();for(l=0;l=0;--l){if(e=t[l],0===l)return void(e._color=1);if((r=t[l-1]).left===e){if((n=r.right).right&&0===n.right._color){if(s=(n=r.right=i(n)).right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=1,r._color=1,s._color=1,o(r),o(n),l>1)(c=t[l-2]).left===r?c.left=n:c.right=n;return void(t[l-1]=n)}if(n.left&&0===n.left._color){if(s=(n=r.right=i(n)).left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(c=t[l-2]).left===r?c.left=s:c.right=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.right=a(0,n));r.right=a(0,n);continue}n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((c=t[l-2]).left===r?c.left=n:c.right=n),t[l-1]=n,t[l]=r,l+11)(c=t[l-2]).right===r?c.right=n:c.left=n;return void(t[l-1]=n)}if(n.right&&0===n.right._color){if(s=(n=r.left=i(n)).right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(c=t[l-2]).right===r?c.right=s:c.left=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.left=a(0,n));r.left=a(0,n);continue}var c;n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((c=t[l-2]).right===r?c.right=n:c.left=n),t[l-1]=n,t[l]=r,l+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(p,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(p,"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}),p.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(p,"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}}),p.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),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)(i=e[a]).left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},p.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(p,"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}})},{}],248:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=[.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 a(t){if(t<0)return Number("0/0");for(var e=i[0],r=i.length-1;r>0;--r)e+=i[r]/(t+r);var n=t+607/128+.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(a(e));e-=1;for(var r=n[0],i=1;i<9;i++)r+=n[i]/(e+i);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=a},{}],249:[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?(p[u]=-1,d[u]=0):(p[u]=0,d[u]=1)}}var g=[0,0,0],m={model:l,view:l,projection:l,_ortho:!1};f.isOpaque=function(){return!0},f.isTransparent=function(){return!1},f.drawTransparent=function(t){};var v=[0,0,0],y=[0,0,0],x=[0,0,0];f.draw=function(t){t=t||m;for(var e=this.gl,r=t.model||l,n=t.view||l,i=t.projection||l,a=this.bounds,s=t._ortho||!1,u=o(r,n,i,a,s),f=u.cubeEdges,h=u.axis,b=n[12],_=n[13],w=n[14],T=n[15],k=(s?2:1)*this.pixelRatio*(i[3]*b+i[7]*_+i[11]*w+i[15]*T)/e.drawingBufferHeight,M=0;M<3;++M)this.lastCubeProps.cubeEdges[M]=f[M],this.lastCubeProps.axis[M]=h[M];var A=p;for(M=0;M<3;++M)d(p[M],M,this.bounds,f,h);e=this.gl;var S,E=g;for(M=0;M<3;++M)this.backgroundEnable[M]?E[M]=h[M]:E[M]=0;this._background.draw(r,n,i,a,E,this.backgroundColor),this._lines.bind(r,n,i,this);for(M=0;M<3;++M){var C=[0,0,0];h[M]>0?C[M]=a[1][M]:C[M]=a[0][M];for(var L=0;L<2;++L){var I=(M+1+L)%3,P=(M+1+(1^L))%3;this.gridEnable[I]&&this._lines.drawGrid(I,P,this.bounds,C,this.gridColor[I],this.gridWidth[I]*this.pixelRatio)}for(L=0;L<2;++L){I=(M+1+L)%3,P=(M+1+(1^L))%3;this.zeroEnable[P]&&Math.min(a[0][P],a[1][P])<=0&&Math.max(a[0][P],a[1][P])>=0&&this._lines.drawZero(I,P,this.bounds,C,this.zeroLineColor[P],this.zeroLineWidth[P]*this.pixelRatio)}}for(M=0;M<3;++M){this.lineEnable[M]&&this._lines.drawAxisLine(M,this.bounds,A[M].primalOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio),this.lineMirror[M]&&this._lines.drawAxisLine(M,this.bounds,A[M].mirrorOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio);var z=c(v,A[M].primalMinor),O=c(y,A[M].mirrorMinor),D=this.lineTickLength;for(L=0;L<3;++L){var R=k/r[5*L];z[L]*=D[L]*R,O[L]*=D[L]*R}this.lineTickEnable[M]&&this._lines.drawAxisTicks(M,A[M].primalOffset,z,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio),this.lineTickMirror[M]&&this._lines.drawAxisTicks(M,A[M].mirrorOffset,O,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio)}this._lines.unbind(),this._text.bind(r,n,i,this.pixelRatio);var F,B;function N(t){(B=[0,0,0])[t]=1}function j(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||a>0&&l<0||a<0&&l>0||a<0&&l<0?N(n):(o>0&&s>0||o>0&&s<0||o<0&&s>0||o<0&&s<0)&&N(i)}for(M=0;M<3;++M){var U=A[M].primalMinor,V=A[M].mirrorMinor,q=c(x,A[M].primalOffset);for(L=0;L<3;++L)this.lineTickEnable[M]&&(q[L]+=k*U[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);var H=[0,0,0];if(H[M]=1,this.tickEnable[M]){-3600===this.tickAngle[M]?(this.tickAngle[M]=0,this.tickAlign[M]="auto"):this.tickAlign[M]=-1,F=1,"auto"===(S=[this.tickAlign[M],.5,F])[0]?S[0]=0:S[0]=parseInt(""+S[0]),B=[0,0,0],j(M,U,V);for(L=0;L<3;++L)q[L]+=k*U[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(M,this.tickSize[M],this.tickAngle[M],q,this.tickColor[M],H,B,S)}if(this.labelEnable[M]){F=0,B=[0,0,0],this.labels[M].length>4&&(N(M),F=1),"auto"===(S=[this.labelAlign[M],.5,F])[0]?S[0]=0:S[0]=parseInt(""+S[0]);for(L=0;L<3;++L)q[L]+=k*U[L]*this.labelPad[L]/r[5*L];q[M]+=.5*(a[0][M]+a[1][M]),this._text.drawLabel(M,this.labelSize[M],this.labelAngle[M],q,this.labelColor[M],[0,0,0],B,S)}}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":251,"./lib/cube.js":252,"./lib/lines.js":253,"./lib/text.js":255,"./lib/ticks.js":256}],251:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=[],s=0,l=0;l<3;++l)for(var c=(l+1)%3,u=(l+2)%3,f=[0,0,0],h=[0,0,0],p=-1;p<=1;p+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),f[l]=p,h[l]=p;for(var d=-1;d<=1;d+=2){f[c]=d;for(var g=-1;g<=1;g+=2)f[u]=g,e.push(f[0],f[1],f[2],h[0],h[1],h[2]),s+=1}var m=c;c=u,u=m}var v=n(t,new Float32Array(e)),y=n(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),x=i(t,[{buffer:v,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:v,type:t.FLOAT,size:3,offset:12,stride:24}],y),b=a(t);return b.attributes.position.location=0,b.attributes.normal.location=1,new o(t,v,x,b)};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":254,"gl-buffer":259,"gl-vao":358}],252:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,p){i(s,e,t),i(s,r,s);for(var y=0,x=0;x<2;++x){u[2]=a[x][2];for(var b=0;b<2;++b){u[1]=a[b][1];for(var _=0;_<2;++_)u[0]=a[_][0],h(l[y],u,s),y+=1}}var w=-1;for(x=0;x<8;++x){for(var T=l[x][3],k=0;k<3;++k)c[x][k]=l[x][k]/T;p&&(c[x][2]*=-1),T<0&&(w<0||c[x][2]E&&(w|=1<E&&(w|=1<c[x][1])&&(R=x);var F=-1;for(x=0;x<3;++x){if((N=R^1<c[B][0]&&(B=N)}var j=g;j[0]=j[1]=j[2]=0,j[n.log2(F^R)]=R&F,j[n.log2(R^B)]=R&B;var U=7^B;U===w||U===D?(U=7^F,j[n.log2(B^U)]=U&B):j[n.log2(F^U)]=U&F;var V=m,q=w;for(M=0;M<3;++M)V[M]=q&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 c=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}"]),u=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,c,u,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":335,glslify:257}],255:[function(t,e,r){(function(r){(function(){"use strict";e.exports=function(t,e,r,a,s,l){var u=n(t),f=i(t,[{buffer:u,size:3}]),h=o(t);h.attributes.position.location=0;var p=new c(t,h,u,f);return p.update(e,r,a,s,l),p};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 c(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 u=c.prototype,f=[0,0];u.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},u.unbind=function(){this.vao.unbind()},u.update=function(t,e,r,n,i){var o=[];function s(t,e,r,n,i,s){var c=l[r];c||(c=l[r]={});var u=c[e];u||(u=c[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=u.positions,p=u.cells,d=0,g=p.length;d=0;--v){var y=h[m[v]];o.push(f*y[0],-f*y[1],t)}}for(var c=[0,0,0],u=[0,0,0],f=[0,0,0],h=[0,0,0],p={breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},d=0;d<3;++d){f[d]=o.length/3|0,s(.5*(t[0][d]+t[1][d]),e[d],r[d],12,1.25,p),h[d]=(o.length/3|0)-f[d],c[d]=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,c=o%a;o<0?(l=0|-Math.ceil(l),c=0|-c):(l=0|Math.floor(l),c|=0);var u=""+l;if(o<0&&(u="-"+u),i){for(var f=""+c;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 u(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=c(this.gl,this.type,this.length,this.usage,t.data,e):this.length=c(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=c(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?u(t,"uint16"):u(t,"float32"),this.length=c(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=c(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:495,"ndarray-ops":490,"typedarray-pool":595}],260:[function(t,e,r){"use strict";var n=t("gl-vec3");e.exports=function(t,e){var r=t.positions,i=t.vectors,a={positions:[],vertexIntensity:[],vertexIntensityBounds:t.vertexIntensityBounds,vectors:[],cells:[],coneOffset:t.coneOffset,colormap:t.colormap};if(0===t.positions.length)return e&&(e[0]=[0,0,0],e[1]=[0,0,0]),a;for(var o=0,s=1/0,l=-1/0,c=1/0,u=-1/0,f=1/0,h=-1/0,p=null,d=null,g=[],m=1/0,v=!1,y=0;yo&&(o=n.length(b)),y){var _=2*n.distance(p,x)/(n.length(d)+n.length(b));_?(m=Math.min(m,_),v=!1):v=!0}v||(p=x,d=b),g.push(b)}var w=[s,c,f],T=[l,u,h];e&&(e[0]=w,e[1]=T),0===o&&(o=1);var k=1/o;isFinite(m)||(m=1),a.vectorScale=m;var M=t.coneSize||.5;t.absoluteConeSize&&(M=t.absoluteConeSize*k),a.coneScale=M;y=0;for(var A=0;y=1},p.isTransparent=function(){return this.opacity<1},p.pickSlots=1,p.setPickBase=function(t){this.pickId=t},p.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),void 0!==t.tubeScale&&(this.tubeScale=t.tubeScale),void 0!==t.vectorScale&&(this.vectorScale=t.vectorScale),void 0!==t.coneScale&&(this.coneScale=t.coneScale),void 0!==t.coneOffset&&(this.coneOffset=t.coneOffset),t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(function(t){for(var e=u({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return c(r,[256,256,4],[4,0,1])}(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions,i=t.vectors;if(n&&r&&i){var a=[],o=[],s=[],l=[],f=[];this.cells=r,this.positions=n,this.vectors=i;var h=t.meshColor||[1,1,1,1],p=t.vertexIntensity,d=1/0,g=-1/0;if(p)if(t.vertexIntensityBounds)d=+t.vertexIntensityBounds[0],g=+t.vertexIntensityBounds[1];else for(var m=0;m0){var g=this.triShader;g.bind(),g.uniforms=c,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}},p.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||f,n=t.view||f,i=t.projection||f,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,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())},p.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),i={position:n,dataCoordinate:n,index:Math.floor(r[1]/48)};return"cone"===this.traceType?i.index=Math.floor(r[1]/48):"streamtube"===this.traceType&&(i.intensity=this.intensity[r[1]],i.velocity=this.vectors[r[1]].slice(0,3),i.divergence=this.vectors[r[1]][3],i.index=e),i},p.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.triangleIds.dispose()},e.exports=function(t,e,r){var n=r.shaders;1===arguments.length&&(t=(e=t).gl);var s=d(t,n),l=g(t,n),u=o(t,c(new Uint8Array([255,255,255,255]),[1,1,4]));u.generateMipmap(),u.minFilter=t.LINEAR_MIPMAP_LINEAR,u.magFilter=t.LINEAR;var f=i(t),p=i(t),m=i(t),v=i(t),y=i(t),x=a(t,[{buffer:f,type:t.FLOAT,size:4},{buffer:y,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:m,type:t.FLOAT,size:4},{buffer:v,type:t.FLOAT,size:2},{buffer:p,type:t.FLOAT,size:4}]),b=new h(t,u,s,l,f,p,y,m,v,x,r.traceType||"cone");return b.update(e),b}},{colormap:131,"gl-buffer":259,"gl-mat4/invert":293,"gl-mat4/multiply":295,"gl-shader":335,"gl-texture2d":353,"gl-vao":358,ndarray:495}],262:[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;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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 vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float vectorScale, coneScale, 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.xyz), 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:"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:263}],263:[function(t,e,r){arguments[4][257][0].apply(r,arguments)},{dup:257}],264:[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",34e3:"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"}},{}],265:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":264}],266:[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 c=new s(e,r,o,l);return c.update(t),c};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 c(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],c=n[15],u=(t._ortho||!1?2:1)*this.pixelRatio*(i[3]*a+i[7]*s+i[11]*l+i[15]*c)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]*this.pixelRatio),r.capSize=this.capSize[f]*u,this.lineCount[f]&&e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var u=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=u[n],a=0;a0)(g=u.slice())[s]+=p[1][s],i.push(u[0],u[1],u[2],d[0],d[1],d[2],d[3],0,0,0,g[0],g[1],g[2],d[0],d[1],d[2],d[3],0,0,0),c(this.bounds,g),o+=2+f(i,g,d,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":268,"gl-buffer":259,"gl-vao":358}],267:[function(t,e,r){arguments[4][257][0].apply(r,arguments)},{dup:257}],268:[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":335,glslify:267}],269:[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 c=t.getExtension("WEBGL_draw_buffers");!l&&c&&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;au||r<0||r>u)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(!c)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(f>t.getParameter(c.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+f+" draw buffers")}}var h=t.UNSIGNED_BYTE,p=t.getExtension("OES_texture_float");if(n.float&&f>0){if(!p)throw new Error("gl-fbo: Context does not support floating point textures");h=t.FLOAT}else n.preferFloat&&f>0&&p&&(h=t.FLOAT);var g=!0;"depth"in n&&(g=!!n.depth);var m=!1;"stencil"in n&&(m=!!n.stencil);return new d(t,e,r,h,f,g,m,c)};var i,a,o,s,l=null;function c(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function u(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 p(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 d(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 d=0;d1&&s.drawBuffersWEBGL(l[o]);var y=r.getExtension("WEBGL_depth_texture");y?d?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&&d?t._depth_rb=p(r,i,a,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g?t._depth_rb=p(r,i,a,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=p(r,i,a,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var x=r.checkFramebufferStatus(r.FRAMEBUFFER);if(x!==r.FRAMEBUFFER_COMPLETE){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);for(v=0;vi||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=c(n),o=0;o>8*p&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e,d.shape=this.shape;var g=i.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.shape[0]*this.shape[1];if(r=n+i)return null;var a=r-n,o=this.xData,s=this.yData;return{object:this,pointId:a,dataCoord:[o[a%this.shape[0]],s[a/this.shape[0]|0]]}},f.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||i(e[0]),o=t.y||i(e[1]),s=t.z||new Float32Array(e[0]*e[1]),l=!1!==t.zsmooth;this.xData=r,this.yData=o;var c,u,f,p,d=t.colorLevels||[0],g=t.colorValues||[0,0,0,1],m=d.length,v=this.bounds;l?(c=v[0]=r[0],u=v[1]=o[0],f=v[2]=r[r.length-1],p=v[3]=o[o.length-1]):(c=v[0]=r[0]+(r[1]-r[0])/2,u=v[1]=o[0]+(o[1]-o[0])/2,f=v[2]=r[r.length-1]+(r[r.length-1]-r[r.length-2])/2,p=v[3]=o[o.length-1]+(o[o.length-1]-o[o.length-2])/2);var y=1/(f-c),x=1/(p-u),b=e[0],_=e[1];this.shape=[b,_];var w=(l?(b-1)*(_-1):b*_)*(h.length>>>1);this.numVertices=w;for(var T=a.mallocUint8(4*w),k=a.mallocFloat32(2*w),M=a.mallocUint8(2*w),A=a.mallocUint32(w),S=0,E=l?b-1:b,C=l?_-1:_,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\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\n// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl\nvec4 packFloat(float v) {\n 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 vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n float e = floor(log2(av));\n 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 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, packFloat(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":335,glslify:276}],275:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=f(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=h(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),l=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}]),u=c(new Array(1024),[256,1,4]),p=0;p<1024;++p)u.data[p]=255;var d=a(e,u);d.wrap=e.REPEAT;var g=new v(e,r,o,s,l,d);return g.update(t),g};var n=t("gl-buffer"),i=t("gl-vao"),a=t("gl-texture2d"),o=new Uint8Array(4),s=new Float32Array(o.buffer);var l=t("binary-search-bounds"),c=t("ndarray"),u=t("./lib/shaders"),f=u.createShader,h=u.createPickShader,p=[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 g(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 m(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 y=v.prototype;y.isTransparent=function(){return this.hasAlpha},y.isOpaque=function(){return!this.hasAlpha},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){if(this.vertexCount){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||p,view:t.view||p,projection:t.projection||p,clipBounds:g(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()}},y.drawPick=function(t){if(this.vertexCount){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||p,view:t.view||p,projection:t.projection||p,pickId:this.pickId,clipBounds:g(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()}},y.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=[],s=0,u=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,m=!1;t:for(e=1;e0){for(var w=0;w<24;++w)i.push(i[i.length-12]);u+=2,m=!0}continue t}f[0][r]=Math.min(f[0][r],b[r],_[r]),f[1][r]=Math.max(f[1][r],b[r],_[r])}Array.isArray(p[0])?(v=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]):v=y=p,3===v.length&&(v=[v[0],v[1],v[2],1]),3===y.length&&(y=[y[0],y[1],y[2],1]),!this.hasAlpha&&v[3]<1&&(this.hasAlpha=!0),x=Array.isArray(g)?g.length>e-1?g[e-1]:g.length>0?g[g.length-1]:[0,0,0,1]:g;var T=s;if(s+=d(b,_),m){for(r=0;r<2;++r)i.push(b[0],b[1],b[2],_[0],_[1],_[2],T,x,v[0],v[1],v[2],v[3]);u+=2,m=!1}i.push(b[0],b[1],b[2],_[0],_[1],_[2],T,x,v[0],v[1],v[2],v[3],b[0],b[1],b[2],_[0],_[1],_[2],T,-x,v[0],v[1],v[2],v[3],_[0],_[1],_[2],b[0],b[1],b[2],s,-x,y[0],y[1],y[2],y[3],_[0],_[1],_[2],b[0],b[1],b[2],s,x,y[0],y[1],y[2],y[3]),u+=4}}if(this.buffer.update(i),a.push(s),o.push(h[h.length-1].slice()),this.bounds=f,this.vertexCount=u,this.points=o,this.arcLength=a,"dashes"in t){var k=t.dashes.slice();for(k.unshift(0),e=1;e1.0001)return null;v+=m[f]}if(Math.abs(v-1)>.001)return null;return[h,s(t,m),m]}},{barycentric:78,"polytope-closest-point/lib/closest_point_2d.js":525}],308:[function(t,e,r){var n=t("glslify"),i=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\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;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\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 f_color = color;\n f_data = position;\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\n//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d\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;\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 (f_color.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], f_data)\n ) 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 = vec4(f_color.rgb, 1.0) * 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 * f_color.a;\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 ,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}"]),c=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}"]),u=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, 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}"]),p=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}"]),d=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor, 1.0);\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:c,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,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:p,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{glslify:310}],309:[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"),c=t("gl-mat4/invert"),u=t("ndarray"),f=t("colormap"),h=t("simplicial-complex-contour"),p=t("typedarray-pool"),d=t("./lib/shaders"),g=t("./lib/closest-point"),m=d.meshShader,v=d.wireShader,y=d.pointShader,x=d.pickShader,b=d.pointPickShader,_=d.contourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function T(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m,v,y,x,b,_,T,k,M,A,S){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=u,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=c,this.triangleVAO=p,this.triangleCount=0,this.lineWidth=1,this.edgePositions=d,this.edgeColors=m,this.edgeUVs=v,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=x,this.pointColors=_,this.pointUVs=T,this.pointSizes=k,this.pointIds=b,this.pointVAO=M,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=S,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickVertex=!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.hasAlpha=!1,this.opacityscale=!1,this._model=w,this._view=w,this._projection=w,this._resolution=[1,1]}var k=T.prototype;function M(t,e){if(!e)return 1;if(!e.length)return 1;for(var r=0;rt&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}function A(t){var e=n(t,m.vertex,m.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function S(t){var e=n(t,v.vertex,v.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function E(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 C(t){var e=n(t,x.vertex,x.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}function L(t){var e=n(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function I(t){var e=n(t,_.vertex,_.fragment);return e.attributes.position.location=0,e}k.isOpaque=function(){return!this.hasAlpha},k.isTransparent=function(){return this.hasAlpha},k.pickSlots=1,k.setPickBase=function(t){this.pickId=t},k.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=p.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())},k.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())},k.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;ai[k]&&(r.uniforms.dataAxis=c,r.uniforms.screenOffset=u,r.uniforms.color=m[t],r.uniforms.angle=v[t],a.drawArrays(a.TRIANGLES,i[k],i[M]-i[k]))),y[t]&&T&&(u[1^t]-=A*p*x[t],r.uniforms.dataAxis=f,r.uniforms.screenOffset=u,r.uniforms.color=b[t],r.uniforms.angle=_[t],a.drawArrays(a.TRIANGLES,w,T)),u[1^t]=A*s[2+(1^t)]-1,d[t+2]&&(u[1^t]+=A*p*g[t+2],ki[k]&&(r.uniforms.dataAxis=c,r.uniforms.screenOffset=u,r.uniforms.color=m[t+2],r.uniforms.angle=v[t+2],a.drawArrays(a.TRIANGLES,i[k],i[M]-i[k]))),y[t+2]&&T&&(u[1^t]+=A*p*x[t+2],r.uniforms.dataAxis=f,r.uniforms.screenOffset=u,r.uniforms.color=b[t+2],r.uniforms.angle=_[t+2],a.drawArrays(a.TRIANGLES,w,T))}),g.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,c=r.pixelRatio;if(this.titleCount){for(var u=0;u<2;++u)e[u]=2*(o[u]*c-a[u])/(a[2+u]-a[u])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),g.bind=(h=[0,0],p=[0,0],d=[0,0],function(){var t=this.plot,e=this.shader,r=t._tickBounds,n=t.dataBox,i=t.screenBox,a=t.viewBox;e.bind();for(var o=0;o<2;++o){var s=r[o],l=r[o+2]-s,c=.5*(n[o+2]+n[o]),u=n[o+2]-n[o],f=a[o],g=a[o+2]-f,m=i[o],v=i[o+2]-m;p[o]=2*l/u*g/v,h[o]=2*(s-c)/u*g/v}d[1]=2*t.pixelRatio/(i[3]-i[1]),d[0]=d[1]*(i[3]-i[1])/(i[2]-i[0]),e.uniforms.dataScale=p,e.uniforms.dataShift=h,e.uniforms.textScale=d,this.vbo.bind(),e.attributes.textCoordinate.pointer()}),g.update=function(t){var e,r,n,i,o,s=[],l=t.ticks,c=t.bounds;for(o=0;o<2;++o){var u=[Math.floor(s.length/3)],f=[-1/0],h=l[o];for(e=0;e=0){var g=e[d]-n[d]*(e[d+2]-e[d])/(n[d+2]-n[d]);0===d?o.drawLine(g,e[1],g,e[3],p[d],h[d]):o.drawLine(e[0],g,e[2],g,p[d],h[d])}}for(d=0;d=0;--t)this.objects[t].dispose();this.objects.length=0;for(t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},c.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},c.removeObject=function(t){for(var e=this.objects,r=0;rMath.abs(e))c.rotate(a,0,0,-t*r*Math.PI*d.rotateSpeed/window.innerWidth);else if(!d._ortho){var o=-d.zoomSpeed*i*e/window.innerHeight*(a-c.lastT())/20;c.pan(a,0,0,f*(Math.exp(o)-1))}}}),!0)},d.enableMouseListeners(),d};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":54,"has-passive-events":441,"mouse-change":483,"mouse-event-offset":484,"mouse-wheel":486,"right-now":542}],319:[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":335,glslify:320}],320:[function(t,e,r){arguments[4][257][0].apply(r,arguments)},{dup:257}],321:[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"),c=t("a-big-triangle"),u=t("mouse-change"),f=t("gl-mat4/perspective"),h=t("gl-mat4/ortho"),p=t("./lib/shader"),d=t("is-mobile")({tablet:!0,featureDetect:!0});function g(){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 v(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)t.container.appendChild(e);else document.body.appendChild(e)}var r=t.gl;r||(t.glOptions&&(d=!!t.glOptions.preserveDrawingBuffer),r=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:d}));if(!r)throw new Error("webgl not supported");var y=t.bounds||[[-10,-10,-10],[10,10,10]],x=new g,b=l(r,r.drawingBufferWidth,r.drawingBufferHeight,{preferFloat:!d}),_=p(r),w=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:w},k=t.axes||{},M=i(r,k);M.enable=!k.disable;var A=t.spikes||{},S=o(r,A),E=[],C=[],L=[],I=[],P=!0,z=!0,O=new Array(16),D=new Array(16),R={view:null,projection:O,model:D,_ortho:!1},F=(z=!0,[r.drawingBufferWidth,r.drawingBufferHeight]),B=t.cameraObject||n(e,T),N={gl:r,contextLost:!1,pixelRatio:t.pixelRatio||1,canvas:e,selection:x,camera:B,axes:M,axesPixels:null,spikes:S,bounds:y,objects:E,shape:F,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:v(t.autoResize),autoBounds:v(t.autoBounds),autoScale:!!t.autoScale,autoCenter:v(t.autoCenter),clipToBounds:v(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:R,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(t){this.aspect[0]=t.x,this.aspect[1]=t.y,this.aspect[2]=t.z,z=!0},setBounds:function(t,e){this.bounds[0][t]=e.min,this.bounds[1][t]=e.max},setClearColor:function(t){this.clearColor=t},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},j=[r.drawingBufferWidth/N.pixelRatio|0,r.drawingBufferHeight/N.pixelRatio|0];function U(){if(!N._stopped&&N.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*N.pixelRatio),a=0|Math.ceil(n*N.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",P=!0}}}N.autoResize&&U();function V(){for(var t=E.length,e=I.length,n=0;n0&&0===L[e-1];)L.pop(),I.pop().dispose()}function q(){if(N.contextLost)return!0;r.isContextLost()&&(N.contextLost=!0,N.mouseListener.enabled=!1,N.selection.object=null,N.oncontextloss&&N.oncontextloss())}window.addEventListener("resize",U),N.update=function(t){N._stopped||(t=t||{},P=!0,z=!0)},N.add=function(t){N._stopped||(t.axes=M,E.push(t),C.push(-1),P=!0,z=!0,V())},N.remove=function(t){if(!N._stopped){var e=E.indexOf(t);e<0||(E.splice(e,1),C.pop(),P=!0,z=!0,V())}},N.dispose=function(){if(!N._stopped&&(N._stopped=!0,window.removeEventListener("resize",U),e.removeEventListener("webglcontextlost",q),N.mouseListener.enabled=!1,!N.contextLost)){M.dispose(),S.dispose();for(var t=0;tx.distance)continue;for(var c=0;c 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]),r.pickVertex=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n"]),r.pickFragment=n(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"])},{glslify:323}],323:[function(t,e,r){arguments[4][257][0].apply(r,arguments)},{dup:257}],324:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("typedarray-pool"),o=t("./lib/shader");function s(t,e,r,n,i){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.shader=n,this.pickShader=i,this.sizeMin=.5,this.sizeMinCap=2,this.sizeMax=20,this.areaRatio=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.blend=!1,this.pickOffset=0,this.points=null}e.exports=function(t,e){var r=t.gl,a=i(r),l=i(r),c=n(r,o.pointVertex,o.pointFragment),u=n(r,o.pickVertex,o.pickFragment),f=new s(t,a,l,c,u);return f.update(e),t.addObject(f),f};var l,c,u=s.prototype;u.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},u.update=function(t){var e;function r(e,r){return e in t?t[e]:r}t=t||{},this.sizeMin=r("sizeMin",.5),this.sizeMax=r("sizeMax",20),this.color=r("color",[1,0,0,1]).slice(),this.areaRatio=r("areaRatio",1),this.borderColor=r("borderColor",[0,0,0,1]).slice(),this.blend=r("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,o=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,s=t.positions,l=i?s:a.mallocFloat32(s.length),c=o?t.idToIndex:a.mallocInt32(n);if(i||l.set(s),!o)for(l.set(s),e=0;e>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,i),u=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(s,.33333)));l[0]=2/a,l[4]=2/o,l[6]=-2*i[0]/a-1,l[7]=-2*i[1]/o-1,this.offsetBuffer.bind(),r.bind(),r.attributes.position.pointer(),r.uniforms.matrix=l,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointCloud=u<5,r.uniforms.pointSize=u,r.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),e&&(c[0]=255&t,c[1]=t>>8&255,c[2]=t>>16&255,c[3]=t>>24&255,this.pickBuffer.bind(),r.attributes.pickId.pointer(n.UNSIGNED_BYTE),r.uniforms.pickOffset=c,this.pickOffset=t);var f=n.getParameter(n.BLEND),h=n.getParameter(n.DITHER);return f&&!this.blend&&n.disable(n.BLEND),h&&n.disable(n.DITHER),n.drawArrays(n.POINTS,0,this.pointCount),f&&!this.blend&&n.enable(n.BLEND),h&&n.enable(n.DITHER),t+this.pointCount}),u.draw=u.unifiedDraw,u.drawPick=u.unifiedDraw,u.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(r=n+i)return null;var a=r-n,o=this.points;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}}},{"./lib/shader":322,"gl-buffer":259,"gl-shader":335,"typedarray-pool":595}],325:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c=e[0],u=e[1],f=e[2],h=e[3],p=r[0],d=r[1],g=r[2],m=r[3];(a=c*p+u*d+f*g+h*m)<0&&(a=-a,p=-p,d=-d,g=-g,m=-m);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*c+l*p,t[1]=s*u+l*d,t[2]=s*f+l*g,t[3]=s*h+l*m,t}},{}],326:[function(t,e,r){"use strict";e.exports=function(t){return t||0===t?t.toString():""}},{}],327:[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,c,u=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 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"]),c=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}"]),u=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],f={vertex:a,fragment:l,attributes:u},h={vertex:o,fragment:l,attributes:u},p={vertex:s,fragment:l,attributes:u},d={vertex:a,fragment:c,attributes:u},g={vertex:o,fragment:c,attributes:u},m={vertex:s,fragment:c,attributes:u};function v(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 v(t,f)},r.createOrtho=function(t){return v(t,h)},r.createProject=function(t){return v(t,p)},r.createPickPerspective=function(t){return v(t,d)},r.createPickOrtho=function(t){return v(t,g)},r.createPickProject=function(t){return v(t,m)}},{"gl-shader":335,glslify:329}],329:[function(t,e,r){arguments[4][257][0].apply(r,arguments)},{dup:257}],330:[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"),c=t("./lib/glyphs"),u=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 p(t,e,r,n){return h(n,n),h(n,n),h(n,n)}function d(t,e){this.index=t,this.dataCoordinate=this.position=e}function g(t){return!0===t||t>1?1:t}function m(t,e,r,n,i,a,o,s,l,c,u,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=c,this.pickOrthoShader=u,this.pickProjectShader=f,this.points=[],this._selectResult=new d(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),c=l.createPickOrtho(e),u=l.createPickProject(e),f=i(e),h=i(e),p=i(e),d=i(e),g=a(e,[{buffer:f,size:3,type:e.FLOAT},{buffer:h,size:4,type:e.FLOAT},{buffer:p,size:2,type:e.FLOAT},{buffer:d,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new m(e,r,n,o,f,h,p,d,g,s,c,u);return v.update(t),v};var v=m.prototype;v.pickSlots=1,v.setPickBase=function(t){this.pickId=t},v.isTransparent=function(){if(this.hasAlpha)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectHasAlpha)return!0;return!1},v.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],x=[0,0,0],b=[0,0,0],_=[0,0,0,1],w=[0,0,0,1],T=f.slice(),k=[0,0,0],M=[[0,0,0],[0,0,0]];function A(t){return t[0]=t[1]=t[2]=0,t}function S(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function E(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function C(t,e,r,n){var i,a=e.axesProject,o=e.gl,l=t.uniforms,c=r.model||f,u=r.view||f,h=r.projection||f,d=e.axesBounds,g=function(t){for(var e=M,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=u,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 m=0;m<3;++m)if(a[m]){l.scale=e.projectScale[m],l.opacity=e.projectOpacity[m];for(var v=T,C=0;C<16;++C)v[C]=0;for(C=0;C<4;++C)v[5*C]=1;v[5*m]=0,i[m]<0?v[12+m]=d[0][m]:v[12+m]=d[1][m],s(v,c,v),l.model=v;var L=(m+1)%3,I=(m+2)%3,P=A(x),z=A(b);P[L]=1,z[I]=1;var O=p(0,0,0,S(_,P)),D=p(0,0,0,S(w,z));if(Math.abs(O[1])>Math.abs(D[1])){var R=O;O=D,D=R,R=P,P=z,z=R;var F=L;L=I,I=F}O[0]<0&&(P[L]=-1),D[1]>0&&(z[I]=-1);var B=0,N=0;for(C=0;C<4;++C)B+=Math.pow(c[4*L+C],2),N+=Math.pow(c[4*I+C],2);P[L]/=Math.sqrt(B),z[I]/=Math.sqrt(N),l.axes[0]=P,l.axes[1]=z,l.fragClipBounds[0]=E(k,g[0],m,-1e8),l.fragClipBounds[1]=E(k,g[1],m,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 L=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];function I(t,e,r,n,i,a,o){var s=r.gl;if((a===r.projectHasAlpha||o)&&C(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=L,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 P(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},v.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]},v.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",c=t.alignment||[0,0];if(2===c.length)i=c[0],a=c[1];else{i=[],a=[];for(n=0;n0){var z=0,O=x,D=[0,0,0,1],R=[0,0,0,1],F=Array.isArray(p)&&Array.isArray(p[0]),B=Array.isArray(v)&&Array.isArray(v[0]);t:for(n=0;n<_;++n){y+=1;for(w=s[n],T=0;T<3;++T){if(isNaN(w[T])||!isFinite(w[T]))continue t;f[T]=Math.max(f[T],w[T]),u[T]=Math.min(u[T],w[T])}k=(N=P(h,n,l,this.pixelRatio)).mesh,M=N.lines,A=N.bounds;var N,j=N.visible;if(j)if(Array.isArray(p)){if(3===(U=F?n0?1-A[0][0]:Y<0?1+A[1][0]:1,W*=W>0?1-A[0][1]:W<0?1+A[1][1]:1],Z=k.cells||[],J=k.positions||[];for(T=0;T0){var v=r*u;o.drawBox(f-v,h-v,p+v,h+v,a),o.drawBox(f-v,d-v,p+v,d+v,a),o.drawBox(f-v,h-v,f+v,d+v,a),o.drawBox(p-v,h-v,p+v,d+v,a)}}}},s.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},s.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":331,"gl-buffer":259,"gl-shader":335}],334:[function(t,e,r){"use strict";e.exports=function(t,e){var r=e[0],a=e[1],o=n(t,r,a,{}),s=i.mallocUint8(r*a*4);return new l(t,o,s)};var n=t("gl-fbo"),i=t("typedarray-pool"),a=t("ndarray"),o=t("bit-twiddle").nextPow2;function s(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function l(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}var c=l.prototype;Object.defineProperty(c,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(t){if(this.gl){this.fbo.shape=t;var e=this.fbo.shape[0],r=this.fbo.shape[1];if(r*e*4>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 T=0|w.type.charAt(w.type.length-1),k=new Array(T),M=0;M=0;)A+=1;_[y]=A}var S=new Array(r.length);function E(){h.program=o.program(p,h._vref,h._fref,b,_);for(var t=0;t=0){if((d=h.charCodeAt(h.length-1)-48)<2||d>4)throw new n("","Invalid data type for attribute "+f+": "+h);o(t,e,p[0],i,d,a,f)}else{if(!(h.indexOf("mat")>=0))throw new n("","Unknown data type for attribute "+f+": "+h);var d;if((d=h.charCodeAt(h.length-1)-48)<2||d>4)throw new n("","Invalid data type for attribute "+f+": "+h);s(t,e,p,i,d,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"],c=[],u=0;u4)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)}if((a=r.charCodeAt(r.length-1)-48)<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 c(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;if((r=t.charCodeAt(t.length-1)-48)<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[u].type);var p}function f(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){s[0]in a||(a[s[0]]=[]),a=a[s[0]];for(var l=1;l1)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;\n\nuniform float vectorScale, tubeScale;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, 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:"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:347}],347:[function(t,e,r){arguments[4][257][0].apply(r,arguments)},{dup:257}],348:[function(t,e,r){"use strict";var n=t("gl-vec3"),i=t("gl-vec4"),a=["xyz","xzy","yxz","yzx","zxy","zyx"],o=function(t,e,r,a){for(var o=0,s=0;s0)for(T=0;T<8;T++){var k=(T+1)%8;c.push(h[T],p[T],p[k],p[k],h[k],h[T]),f.push(y,v,v,v,y,y),d.push(g,m,m,m,g,g);var M=c.length;u.push([M-6,M-5,M-4],[M-3,M-2,M-1])}var A=h;h=p,p=A;var S=y;y=v,v=S;var E=g;g=m,m=E}return{positions:c,cells:u,vectors:f,vertexIntensity:d}}(t,r,a,o)})),f=[],h=[],p=[],d=[];for(s=0;se)return r-1}return r},l=function(t,e,r){return tr?r:t},c=function(t){var e=1/0;t.sort((function(t,e){return t-e}));for(var r=t.length,n=1;nf-1||y>h-1||x>p-1)return n.create();var b,_,w,T,k,M,A=a[0][d],S=a[0][v],E=a[1][g],C=a[1][y],L=a[2][m],I=(o-A)/(S-A),P=(c-E)/(C-E),z=(u-L)/(a[2][x]-L);switch(isFinite(I)||(I=.5),isFinite(P)||(P=.5),isFinite(z)||(z=.5),r.reversedX&&(d=f-1-d,v=f-1-v),r.reversedY&&(g=h-1-g,y=h-1-y),r.reversedZ&&(m=p-1-m,x=p-1-x),r.filled){case 5:k=m,M=x,w=g*p,T=y*p,b=d*p*h,_=v*p*h;break;case 4:k=m,M=x,b=d*p,_=v*p,w=g*p*f,T=y*p*f;break;case 3:w=g,T=y,k=m*h,M=x*h,b=d*h*p,_=v*h*p;break;case 2:w=g,T=y,b=d*h,_=v*h,k=m*h*f,M=x*h*f;break;case 1:b=d,_=v,k=m*f,M=x*f,w=g*f*p,T=y*f*p;break;default:b=d,_=v,w=g*f,T=y*f,k=m*f*h,M=x*f*h}var O=i[b+w+k],D=i[b+w+M],R=i[b+T+k],F=i[b+T+M],B=i[_+w+k],N=i[_+w+M],j=i[_+T+k],U=i[_+T+M],V=n.create(),q=n.create(),H=n.create(),G=n.create();n.lerp(V,O,B,I),n.lerp(q,D,N,I),n.lerp(H,R,j,I),n.lerp(G,F,U,I);var Y=n.create(),W=n.create();n.lerp(Y,V,H,P),n.lerp(W,q,G,P);var X=n.create();return n.lerp(X,Y,W,z),X}(e,t,p)},g=t.getDivergence||function(t,e){var r=n.create(),i=1e-4;n.add(r,t,[i,0,0]);var a=d(r);n.subtract(a,a,e),n.scale(a,a,1/i),n.add(r,t,[0,i,0]);var o=d(r);n.subtract(o,o,e),n.scale(o,o,1/i),n.add(r,t,[0,0,i]);var s=d(r);return n.subtract(s,s,e),n.scale(s,s,1/i),n.add(r,a,o),n.add(r,r,s),r},m=[],v=e[0][0],y=e[0][1],x=e[0][2],b=e[1][0],_=e[1][1],w=e[1][2],T=function(t){var e=t[0],r=t[1],n=t[2];return!(eb||r_||nw)},k=10*n.distance(e[0],e[1])/i,M=k*k,A=1,S=0,E=r.length;E>1&&(A=function(t){for(var e=[],r=[],n=[],i={},a={},o={},s=t.length,l=0;lS&&(S=F),D.push(F),m.push({points:I,velocities:P,divergences:D});for(var B=0;B<100*i&&I.lengthM&&n.scale(N,N,k/Math.sqrt(j)),n.add(N,N,L),z=d(N),n.squaredDistance(O,N)-M>-1e-4*M){I.push(N),O=N,P.push(z);R=g(N,z),F=n.length(R);isFinite(F)&&F>S&&(S=F),D.push(F)}L=N}}var U=o(m,t.colormap,S,A);return f?U.tubeScale=f:(0===S&&(S=1),U.tubeScale=.5*u*A/S),U};var u=t("./lib/shaders"),f=t("gl-cone3d").createMesh;e.exports.createTubeMesh=function(t,e){return f(t,e,{shaders:u,traceType:"streamtube"})}},{"./lib/shaders":346,"gl-cone3d":260,"gl-vec3":377,"gl-vec4":413}],349:[function(t,e,r){var n=t("gl-shader"),i=t("glslify"),a=i(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform vec3 objectOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\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 localCoordinate = vec3(uv.zw, f.x);\n worldCoordinate = objectOffset + localCoordinate;\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n"]),o=i(["precision 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 beckmannSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\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 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 (\n kill > 0.0 ||\n vColor.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)\n ) 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":335,glslify:350}],350:[function(t,e,r){arguments[4][257][0].apply(r,arguments)},{dup:257}],351:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=y(e),n=b(e),s=x(e),l=_(e),c=i(e),u=a(e,[{buffer:c,size:4,stride:40,offset:0},{buffer:c,size:3,stride:40,offset:16},{buffer:c,size:3,stride:40,offset:28}]),f=i(e),h=a(e,[{buffer:f,size:4,stride:20,offset:0},{buffer:f,size:1,stride:20,offset:16}]),p=i(e),d=a(e,[{buffer:p,size:2,type:e.FLOAT}]),g=o(e,1,256,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var m=new A(e,[0,0],[[0,0,0],[0,0,0]],r,n,c,u,g,s,l,f,h,p,d,[0,0,0]),v={levels:[[],[],[]]};for(var w in t)v[w]=t[w];return v.colormap=v.colormap||"jet",m.update(v),m};var n=t("bit-twiddle"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("typedarray-pool"),l=t("colormap"),c=t("ndarray-ops"),u=t("ndarray-pack"),f=t("ndarray"),h=t("surface-nets"),p=t("gl-mat4/multiply"),d=t("gl-mat4/invert"),g=t("binary-search-bounds"),m=t("ndarray-gradient"),v=t("./lib/shaders"),y=v.createShader,x=v.createContourShader,b=v.createPickShader,_=v.createPickContourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],T=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],k=[[0,0,0,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 M(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=k[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();function A(t,e,r,n,i,a,o,l,c,u,h,p,d,g,m){this.gl=t,this.shape=e,this.bounds=r,this.objectOffset=m,this.intensityBounds=[],this._shader=n,this._pickShader=i,this._coordinateBuffer=a,this._vao=o,this._colorMap=l,this._contourShader=c,this._contourPickShader=u,this._contourBuffer=h,this._contourVAO=p,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new M([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,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=A.prototype;S.genColormap=function(t,e){var r=!1,n=u([l({colormap:t,nshades:256,format:"rgba"}).map((function(t,n){var i=e?function(t,e){if(!e)return 1;if(!e.length)return 1;for(var r=0;rt&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}(n/255,e):t[3];return i<1&&(r=!0),[t[0],t[1],t[2],255*i]}))]);return c.divseq(n,255),this.hasAlphaScale=r,n},S.isTransparent=function(){return this.opacity<1||this.hasAlphaScale},S.isOpaque=function(){return!this.isTransparent()},S.pickSlots=1,S.setPickBase=function(t){this.pickId=t};var E=[0,0,0],C={showSurface:!1,showContour:!1,projections:[w.slice(),w.slice(),w.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function L(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||E,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=C.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],p(l,t.model,l);var c=C.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)c[i][n]=t.clipBounds[i][n];c[0][r]=-1e8,c[1][r]=1e8}return C.showSurface=o,C.showContour=s,C}var I={model:w,view:w,projection:w,inverseModel:w.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},P=w.slice(),z=[1,0,0,0,1,0,0,0,1];function O(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=I;n.model=t.model||w,n.view=t.view||w,n.projection=t.projection||w,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=d(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=z,n.vertexColor=this.vertexColor;var s=P;for(p(s,n.view,n.model),p(s,n.projection,s),d(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 c=s[12+i];for(o=0;o<3;++o)c+=s[4*o+i]*this.lightPosition[o];n.lightPosition[i]=c/l}var u=L(n,this);if(u.showSurface){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=u.projections[i],this._shader.uniforms.clipBounds=u.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(u.showContour){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=k[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 c=r.position;c[0]=c[1]=c[2]=0;for(var u=0;u<2;++u)for(var f=u?a:1-a,h=0;h<2;++h)for(var p=i+u,d=s+h,m=f*(h?l:1-l),v=0;v<3;++v)c[v]+=this._field[v].get(p,d)*m;for(var y=this._pickResult.level,x=0;x<3;++x)if(y[x]=g.le(this.contourLevels[x],c[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]Math.abs(_-c[x])&&(y[x]+=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],v=0;v<3;++v)r.dataCoordinate[v]=this._field[v].get(r.index[0],r.index[1]);return r},S.padField=function(t,e){var r=e.shape.slice(),n=t.shape.slice();c.assign(t.lo(1,1).hi(r[0],r[1]),e),c.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),c.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),c.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),c.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=R(t.contourWidth,Number)),"showContour"in t&&(this.showContour=R(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=R(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=B(t.contourColor)),"contourProject"in t&&(this.contourProject=R(t.contourProject,(function(t){return R(t,Boolean)}))),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=B(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=R(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=R(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"opacityscale"in t&&(this.opacityscale=t.opacityscale),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0),"colormap"in t&&this._colorMap.setPixels(this.genColormap(t.colormap,this.opacityscale));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 l=t.coords;if(!Array.isArray(l)||3!==l.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=l[o];for(v=0;v<2;++v)if(c.shape[v]!==a[v])throw new Error("gl-surface: coords have incorrect shape");this.padField(this._field[o],c)}}else if(t.ticks){var u=t.ticks;if(!Array.isArray(u)||2!==u.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=u[o];if((Array.isArray(p)||p.length)&&(p=f(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var d=f(p.data,a);d.stride[o]=p.stride[0],d.stride[1^o]=0,this.padField(this._field[o],d)}}else{for(o=0;o<2;++o){var g=[0,0];g[o]=1,this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2],g,0)}this._field[0].set(0,0,0);for(var v=0;v0){for(var xt=0;xt<5;++xt)Q.pop();U-=1}continue t}Q.push(nt[0],nt[1],ot[0],ot[1],nt[2]),U+=1}}rt.push(U)}this._contourOffsets[$]=et,this._contourCounts[$]=rt}var bt=s.mallocFloat(Q.length);for(o=0;o halfCharStep + halfCharWidth ||\n\t\t\t\t\tfloor(uv.x) < halfCharStep - halfCharWidth) return;\n\n\t\t\t\tuv += charId * charStep;\n\t\t\t\tuv = uv / atlasSize;\n\n\t\t\t\tvec4 color = fontColor;\n\t\t\t\tvec4 mask = texture2D(atlas, uv);\n\n\t\t\t\tfloat maskY = lightness(mask);\n\t\t\t\t// float colorY = lightness(color);\n\t\t\t\tcolor.a *= maskY;\n\t\t\t\tcolor.a *= opacity;\n\n\t\t\t\t// color.a += .1;\n\n\t\t\t\t// antialiasing, see yiq color space y-channel formula\n\t\t\t\t// color.rgb += (1. - color.rgb) * (1. - mask.rgb);\n\n\t\t\t\tgl_FragColor = color;\n\t\t\t}"});return{regl:t,draw:e,atlas:{}}},T.prototype.update=function(t){var e=this;if("string"==typeof t)t={text:t};else if(!t)return;null!=(t=i(t,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0)).opacity&&(Array.isArray(t.opacity)?this.opacity=t.opacity.map((function(t){return parseFloat(t)})):this.opacity=parseFloat(t.opacity)),null!=t.viewport&&(this.viewport=f(t.viewport),T.normalViewport&&(this.viewport.y=this.canvas.height-this.viewport.y-this.viewport.height),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null==this.viewport&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null!=t.kerning&&(this.kerning=t.kerning),null!=t.offset&&("number"==typeof t.offset&&(t.offset=[t.offset,0]),this.positionOffset=y(t.offset)),t.direction&&(this.direction=t.direction),t.range&&(this.range=t.range,this.scale=[1/(t.range[2]-t.range[0]),1/(t.range[3]-t.range[1])],this.translate=[-t.range[0],-t.range[1]]),t.scale&&(this.scale=t.scale),t.translate&&(this.translate=t.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),this.font.length||t.font||(t.font=T.baseFontSize+"px sans-serif");var r,a=!1,o=!1;if(t.font&&(Array.isArray(t.font)?t.font:[t.font]).forEach((function(t,r){if("string"==typeof t)try{t=n.parse(t)}catch(e){t=n.parse(T.baseFontSize+"px "+t)}else t=n.parse(n.stringify(t));var i=n.stringify({size:T.baseFontSize,family:t.family,stretch:_?t.stretch:void 0,variant:t.variant,weight:t.weight,style:t.style}),s=p(t.size),l=Math.round(s[0]*d(s[1]));if(l!==e.fontSize[r]&&(o=!0,e.fontSize[r]=l),!(e.font[r]&&i==e.font[r].baseString||(a=!0,e.font[r]=T.fonts[i],e.font[r]))){var c=t.family.join(", "),u=[t.style];t.style!=t.variant&&u.push(t.variant),t.variant!=t.weight&&u.push(t.weight),_&&t.weight!=t.stretch&&u.push(t.stretch),e.font[r]={baseString:i,family:c,weight:t.weight,stretch:t.stretch,style:t.style,variant:t.variant,width:{},kerning:{},metrics:v(c,{origin:"top",fontSize:T.baseFontSize,fontStyle:u.join(" ")})},T.fonts[i]=e.font[r]}})),(a||o)&&this.font.forEach((function(r,i){var a=n.stringify({size:e.fontSize[i],family:r.family,stretch:_?r.stretch:void 0,variant:r.variant,weight:r.weight,style:r.style});if(e.fontAtlas[i]=e.shader.atlas[a],!e.fontAtlas[i]){var o=r.metrics;e.shader.atlas[a]=e.fontAtlas[i]={fontString:a,step:2*Math.ceil(e.fontSize[i]*o.bottom*.5),em:e.fontSize[i],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:e.regl.texture()}}null==t.text&&(t.text=e.text)})),"string"==typeof t.text&&t.position&&t.position.length>2){for(var s=Array(.5*t.position.length),h=0;h2){for(var w=!t.position[0].length,k=u.mallocFloat(2*this.count),M=0,A=0;M1?e.align[r]:e.align[0]:e.align;if("number"==typeof n)return n;switch(n){case"right":case"end":return-t;case"center":case"centre":case"middle":return.5*-t}return 0}))),null==this.baseline&&null==t.baseline&&(t.baseline=0),null!=t.baseline&&(this.baseline=t.baseline,Array.isArray(this.baseline)||(this.baseline=[this.baseline]),this.baselineOffset=this.baseline.map((function(t,r){var n=(e.font[r]||e.font[0]).metrics,i=0;return i+=.5*n.bottom,i+="number"==typeof t?t-n.baseline:-n[t],T.normalViewport||(i*=-1),i}))),null!=t.color)if(t.color||(t.color="transparent"),"string"!=typeof t.color&&isNaN(t.color)){var H;if("number"==typeof t.color[0]&&t.color.length>this.counts.length){var G=t.color.length;H=u.mallocUint8(G);for(var Y=(t.color.subarray||t.color.slice).bind(t.color),W=0;W4||this.baselineOffset.length>1||this.align&&this.align.length>1||this.fontAtlas.length>1||this.positionOffset.length>2){var J=Math.max(.5*this.position.length||0,.25*this.color.length||0,this.baselineOffset.length||0,this.alignOffset.length||0,this.font.length||0,this.opacity.length||0,.5*this.positionOffset.length||0);this.batch=Array(J);for(var K=0;K1?this.counts[K]:this.counts[0],offset:this.textOffsets.length>1?this.textOffsets[K]:this.textOffsets[0],color:this.color?this.color.length<=4?this.color:this.color.subarray(4*K,4*K+4):[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[K]:this.opacity,baseline:null!=this.baselineOffset[K]?this.baselineOffset[K]:this.baselineOffset[0],align:this.align?null!=this.alignOffset[K]?this.alignOffset[K]:this.alignOffset[0]:0,atlas:this.fontAtlas[K]||this.fontAtlas[0],positionOffset:this.positionOffset.length>2?this.positionOffset.subarray(2*K,2*K+2):this.positionOffset}}else this.count?this.batch=[{count:this.count,offset:0,color:this.color||[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[0]:this.opacity,baseline:this.baselineOffset[0],align:this.alignOffset?this.alignOffset[0]:0,atlas:this.fontAtlas[0],positionOffset:this.positionOffset}]:this.batch=[]},T.prototype.destroy=function(){},T.prototype.kerning=!0,T.prototype.position={constant:new Float32Array(2)},T.prototype.translate=null,T.prototype.scale=null,T.prototype.font=null,T.prototype.text="",T.prototype.positionOffset=[0,0],T.prototype.opacity=1,T.prototype.color=new Uint8Array([0,0,0,255]),T.prototype.alignOffset=[0,0],T.normalViewport=!1,T.maxAtlasSize=1024,T.atlasCanvas=document.createElement("canvas"),T.atlasContext=T.atlasCanvas.getContext("2d",{alpha:!1}),T.baseFontSize=64,T.fonts={},e.exports=T},{"bit-twiddle":97,"color-normalize":125,"css-font":144,"detect-kerning":172,"es6-weak-map":233,"flatten-vertex-data":244,"font-atlas":245,"font-measure":246,"gl-util/context":354,"is-plain-obj":469,"object-assign":499,"parse-rect":504,"parse-unit":506,"pick-by-alias":511,regl:540,"to-px":578,"typedarray-pool":595}],353:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("ndarray-ops"),a=t("typedarray-pool");e.exports=function(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");o||c(t);if("number"==typeof arguments[1])return v(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return v(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1],r=u(e)?e:e.raw;if(r)return y(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return x(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var o=null,s=null,l=null;function c(t){o=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],s=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],l=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}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 f=function(t,e){i.muls(t,e,255)};function h(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 p(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=p.prototype;function g(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 m(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=m(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new p(t,o,e,r,n,i)}function y(t,e,r,n,i,a){var o=m(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new p(t,o,r,n,i,a)}function x(t,e){var r=e.dtype,o=e.shape.slice(),s=t.getParameter(t.MAX_TEXTURE_SIZE);if(o[0]<0||o[0]>s||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=g(o,e.stride.slice()),c=0;"float32"===r?c=t.FLOAT:"float64"===r?(c=t.FLOAT,l=!1,r="float32"):"uint8"===r?c=t.UNSIGNED_BYTE:(c=t.UNSIGNED_BYTE,l=!1,r="uint8");var u,h,d=0;if(2===o.length)d=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])d=t.ALPHA;else if(2===o[2])d=t.LUMINANCE_ALPHA;else if(3===o[2])d=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");d=t.RGBA}}c!==t.FLOAT||t.getExtension("OES_texture_float")||(c=t.UNSIGNED_BYTE,l=!1);var v=e.size;if(l)u=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var y=[o[2],o[2]*o[0],1];h=a.malloc(v,r);var x=n(h,o,y,0);"float32"!==r&&"float64"!==r||c!==t.UNSIGNED_BYTE?i.assign(x,e):f(x,e),u=h.subarray(0,v)}var b=m(t);return t.texImage2D(t.TEXTURE_2D,0,d,o[0],o[1],0,d,c,u),l||a.free(h),new p(t,b,o[0],o[1],d,c)}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 h(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return h(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,h(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,c,u){var h=u.dtype,p=u.shape.slice();if(p.length<2||p.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var d=0,m=0,v=g(p,u.stride.slice());"float32"===h?d=t.FLOAT:"float64"===h?(d=t.FLOAT,v=!1,h="float32"):"uint8"===h?d=t.UNSIGNED_BYTE:(d=t.UNSIGNED_BYTE,v=!1,h="uint8");if(2===p.length)m=t.LUMINANCE,p=[p[0],p[1],1],u=n(u.data,p,[u.stride[0],u.stride[1],1],u.offset);else{if(3!==p.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===p[2])m=t.ALPHA;else if(2===p[2])m=t.LUMINANCE_ALPHA;else if(3===p[2])m=t.RGB;else{if(4!==p[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");m=t.RGBA}p[2]}m!==t.LUMINANCE&&m!==t.ALPHA||s!==t.LUMINANCE&&s!==t.ALPHA||(m=s);if(m!==s)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=u.size,x=c.indexOf(o)<0;x&&c.push(o);if(d===l&&v)0===u.offset&&u.data.length===y?x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,u.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,u.data):x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,u.data.subarray(u.offset,u.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,u.data.subarray(u.offset,u.offset+y));else{var b;b=l===t.FLOAT?a.mallocFloat32(y):a.mallocUint8(y);var _=n(b,p,[p[2],p[2]*p[0],1]);d===t.FLOAT&&l===t.UNSIGNED_BYTE?f(_,u):i.assign(_,u),x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,b.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,b.subarray(0,y)),l===t.FLOAT?a.freeFloat32(b):a.freeUint8(b)}}(s,e,r,o,this.format,this.type,this._mipLevels,t)}}},{ndarray:495,"ndarray-ops":490,"typedarray-pool":595}],354:[function(t,e,r){(function(r){(function(){"use strict";var n=t("pick-by-alias");function i(t){if(t.container)if(t.container==document.body)document.body.style.width||(t.canvas.width=t.width||t.pixelRatio*r.innerWidth),document.body.style.height||(t.canvas.height=t.height||t.pixelRatio*r.innerHeight);else{var e=t.container.getBoundingClientRect();t.canvas.width=t.width||e.right-e.left,t.canvas.height=t.height||e.bottom-e.top}}function a(t){return"function"==typeof t.getContext&&"width"in t&&"height"in t}function o(){var t=document.createElement("canvas");return t.style.position="absolute",t.style.top=0,t.style.left=0,t}e.exports=function(t){var e;if(t?"string"==typeof t&&(t={container:t}):t={},a(t)?t={container:t}:t="string"==typeof(e=t).nodeName&&"function"==typeof e.appendChild&&"function"==typeof e.getBoundingClientRect?{container:t}:function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(t)?{gl:t}:n(t,{container:"container target element el canvas holder parent parentNode wrapper use ref root node",gl:"gl context webgl glContext",attrs:"attributes attrs contextAttributes",pixelRatio:"pixelRatio pxRatio px ratio pxratio pixelratio",width:"w width",height:"h height"},!0),t.pixelRatio||(t.pixelRatio=r.pixelRatio||1),t.gl)return t.gl;if(t.canvas&&(t.container=t.canvas.parentNode),t.container){if("string"==typeof t.container){var s=document.querySelector(t.container);if(!s)throw Error("Element "+t.container+" is not found");t.container=s}a(t.container)?(t.canvas=t.container,t.container=t.canvas.parentNode):t.canvas||(t.canvas=o(),t.container.appendChild(t.canvas),i(t))}else if(!t.canvas){if("undefined"==typeof document)throw Error("Not DOM environment. Use headless-gl.");t.container=document.body||document.documentElement,t.canvas=o(),t.container.appendChild(t.canvas),i(t)}if(!t.gl)try{t.gl=t.canvas.getContext("webgl",t.attrs)}catch(e){try{t.gl=t.canvas.getContext("experimental-webgl",t.attrs)}catch(e){t.gl=t.canvas.getContext("webgl-experimental",t.attrs)}}return t.gl}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"pick-by-alias":511}],355:[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":370,"./fromValues":376,"./normalize":387}],361:[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}},{}],362:[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}},{}],363:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}},{}],364:[function(t,e,r){e.exports=function(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}},{}],365:[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}},{}],366:[function(t,e,r){e.exports=t("./distance")},{"./distance":367}],367:[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)}},{}],368:[function(t,e,r){e.exports=t("./divide")},{"./divide":369}],369:[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}},{}],370:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],371:[function(t,e,r){e.exports=1e-6},{}],372:[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":371}],373:[function(t,e,r){e.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}},{}],374:[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}},{}],375:[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}},{}],388:[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}},{}],389:[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),c=Math.cos(n);return t[0]=e[0],t[1]=i+o*c-s*l,t[2]=a+o*l+s*c,t}},{}],390:[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),c=Math.cos(n);return t[0]=i+s*l+o*c,t[1]=e[1],t[2]=a+s*c-o*l,t}},{}],391:[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),c=Math.cos(n);return t[0]=i+o*c-s*l,t[1]=a+o*l+s*c,t[2]=e[2],t}},{}],392:[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}},{}],393:[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}},{}],394:[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}},{}],395:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}},{}],396:[function(t,e,r){e.exports=t("./squaredDistance")},{"./squaredDistance":398}],397:[function(t,e,r){e.exports=t("./squaredLength")},{"./squaredLength":399}],398:[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}},{}],399:[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}},{}],400:[function(t,e,r){e.exports=t("./subtract")},{"./subtract":401}],401:[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}},{}],402:[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}},{}],403:[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}},{}],404:[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],c=r[3],u=c*n+s*a-l*i,f=c*i+l*n-o*a,h=c*a+o*i-s*n,p=-o*n-s*i-l*a;return t[0]=u*c+p*-o+f*-l-h*-s,t[1]=f*c+p*-s+h*-o-u*-l,t[2]=h*c+p*-l+u*-s-f*-o,t}},{}],405:[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}},{}],406:[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}},{}],407:[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}},{}],408:[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}},{}],409:[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)}},{}],410:[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}},{}],411:[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]}},{}],412:[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}},{}],413:[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":405,"./clone":406,"./copy":407,"./create":408,"./distance":409,"./divide":410,"./dot":411,"./fromValues":412,"./inverse":414,"./length":415,"./lerp":416,"./max":417,"./min":418,"./multiply":419,"./negate":420,"./normalize":421,"./random":422,"./scale":423,"./scaleAndAdd":424,"./set":425,"./squaredDistance":426,"./squaredLength":427,"./subtract":428,"./transformMat4":429,"./transformQuat":430}],414:[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}},{}],415:[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)}},{}],416:[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}},{}],417:[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}},{}],418:[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}},{}],419:[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}},{}],420:[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}},{}],421:[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}},{}],422:[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":421,"./scale":423}],423:[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}},{}],424:[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}},{}],425:[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}},{}],426:[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}},{}],427:[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}},{}],428:[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}},{}],429:[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}},{}],430:[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],c=r[3],u=c*n+s*a-l*i,f=c*i+l*n-o*a,h=c*a+o*i-s*n,p=-o*n-s*i-l*a;return t[0]=u*c+p*-o+f*-l-h*-s,t[1]=f*c+p*-s+h*-o-u*-l,t[2]=h*c+p*-l+u*-s-f*-o,t[3]=e[3],t}},{}],431:[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 M(r),v+=r.length,(p=p.slice(r.length)).length}}function P(){return/[^a-fA-F0-9]/.test(e)?(M(p.join("")),h=999,u):(p.push(e),r=e,u+1)}function z(){return"."===e||/[eE]/.test(e)?(p.push(e),h=5,r=e,u+1):"x"===e&&1===p.length&&"0"===p[0]?(h=11,p.push(e),r=e,u+1):/[^\d]/.test(e)?(M(p.join("")),h=999,u):(p.push(e),r=e,u+1)}function O(){return"f"===e&&(p.push(e),r=e,u+=1),/[eE]/.test(e)?(p.push(e),r=e,u+1):("-"!==e&&"+"!==e||!/[eE]/.test(r))&&/[^\d]/.test(e)?(M(p.join("")),h=999,u):(p.push(e),r=e,u+1)}function D(){if(/[^\d\w_]/.test(e)){var t=p.join("");return h=k[t]?8:T[t]?7:6,M(p.join("")),h=999,u}return p.push(e),r=e,u+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=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":434,"./lib/builtins-300es":433,"./lib/literals":436,"./lib/literals-300es":435,"./lib/operators":437}],433:[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":434}],434:[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"]},{}],435:[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","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":436}],436:[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","uint","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"]},{}],437:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],438:[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":432}],439:[function(t,e,r){arguments[4][257][0].apply(r,arguments)},{dup:257}],440:[function(t,e,r){(function(r){(function(){"use strict";var n,i=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:i,e.exports=n}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":464}],441:[function(t,e,r){"use strict";var n=t("is-browser");e.exports=n&&function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){t=!1}return t}()},{"is-browser":464}],442:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=256*a+t[e+f],f+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+f],f+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,c=8*a-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=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=u):(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>=u?(s=0,o=u):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+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*g}},{}],443:[function(t,e,r){"use strict";var n=t("./types");e.exports=function(t,e){var r;for(r in n)if(n[r].detect(t,e))return r}},{"./types":446}],444:[function(t,e,r){(function(r){(function(){"use strict";var n=t("fs"),i=t("path"),a=t("./types"),o=t("./detector");function s(t,e){var r=o(t,e);if(r in a){var n=a[r].calculate(t,e);if(!1!==n)return n.type=r,n}throw new TypeError("unsupported file type: "+r+" (file: "+e+")")}e.exports=function(t,e){if(r.isBuffer(t))return s(t);if("string"!=typeof t)throw new TypeError("invalid invocation");var a=i.resolve(t);if("function"!=typeof e)return s(function(t){var e=n.openSync(t,"r"),i=n.fstatSync(e).size,a=Math.min(i,524288),o=r.alloc(a);return n.readSync(e,o,0,a,0),n.closeSync(e),o}(a),a);!function(t,e){n.open(t,"r",(function(i,a){if(i)return e(i);n.fstat(a,(function(i,o){if(i)return e(i);var s=o.size;if(s<=0)return e(new Error("File size is not greater than 0 \u2014\u2014 "+t));var l=Math.min(s,524288),c=r.alloc(l);n.read(a,c,0,l,0,(function(t){if(t)return e(t);n.close(a,(function(t){e(t,c)}))}))}))}))}(a,(function(t,r){if(t)return e(t);var n;try{n=s(r,a)}catch(e){t=e}e(t,n)}))},e.exports.types=Object.keys(a)}).call(this)}).call(this,t("buffer").Buffer)},{"./detector":443,"./types":446,buffer:111,fs:109,path:507}],445:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r=r||0,t["readUInt"+e+(n?"BE":"LE")].call(t,r)}},{}],446:[function(t,e,r){"use strict";var n={bmp:t("./types/bmp"),cur:t("./types/cur"),dds:t("./types/dds"),gif:t("./types/gif"),icns:t("./types/icns"),ico:t("./types/ico"),jpg:t("./types/jpg"),png:t("./types/png"),psd:t("./types/psd"),svg:t("./types/svg"),tiff:t("./types/tiff"),webp:t("./types/webp")};e.exports=n},{"./types/bmp":447,"./types/cur":448,"./types/dds":449,"./types/gif":450,"./types/icns":451,"./types/ico":452,"./types/jpg":453,"./types/png":454,"./types/psd":455,"./types/svg":456,"./types/tiff":457,"./types/webp":458}],447:[function(t,e,r){"use strict";e.exports={detect:function(t){return"BM"===t.toString("ascii",0,2)},calculate:function(t){return{width:t.readUInt32LE(18),height:Math.abs(t.readInt32LE(22))}}}},{}],448:[function(t,e,r){"use strict";e.exports={detect:function(t){return 0===t.readUInt16LE(0)&&2===t.readUInt16LE(2)},calculate:t("./ico").calculate}},{"./ico":452}],449:[function(t,e,r){"use strict";e.exports={detect:function(t){return 542327876===t.readUInt32LE(0)},calculate:function(t){return{height:t.readUInt32LE(12),width:t.readUInt32LE(16)}}}},{}],450:[function(t,e,r){"use strict";var n=/^GIF8[79]a/;e.exports={detect:function(t){var e=t.toString("ascii",0,6);return n.test(e)},calculate:function(t){return{width:t.readUInt16LE(6),height:t.readUInt16LE(8)}}}},{}],451:[function(t,e,r){"use strict";var n={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function i(t,e){var r=e+4;return[t.toString("ascii",e,r),t.readUInt32BE(r)]}function a(t){var e=n[t];return{width:e,height:e,type:t}}e.exports={detect:function(t){return"icns"===t.toString("ascii",0,4)},calculate:function(t){var e,r,n,o=t.length,s=8,l=t.readUInt32BE(4);if(r=a((e=i(t,s))[0]),(s+=e[1])===l)return r;for(n={width:r.width,height:r.height,images:[r]};st.length)return;var s=t.slice(r,i);if(274===n(s,16,0,e)){if(3!==n(s,16,2,e))return;if(1!==n(s,32,4,e))return;return n(s,16,8,e)}}}(r,a)}function s(t,e){if(e>t.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(255!==t[e])throw new TypeError("Invalid JPG, marker table corrupted")}e.exports={detect:function(t){return"ffd8"===t.toString("hex",0,2)},calculate:function(t){var e,r,n;for(t=t.slice(4);t.length;){if(r=t.readUInt16BE(0),i(t)&&(e=o(t,r)),s(t,r),192===(n=t[r+1])||193===n||194===n){var l=a(t,r+5);return e?{width:l.width,height:l.height,orientation:e}:l}t=t.slice(r+2)}throw new TypeError("Invalid JPG, no size found")}}},{"../readUInt":445}],454:[function(t,e,r){"use strict";e.exports={detect:function(t){if("PNG\r\n\x1a\n"===t.toString("ascii",1,8)){var e=t.toString("ascii",12,16);if("CgBI"===e&&(e=t.toString("ascii",28,32)),"IHDR"!==e)throw new TypeError("invalid png");return!0}},calculate:function(t){return"CgBI"===t.toString("ascii",12,16)?{width:t.readUInt32BE(32),height:t.readUInt32BE(36)}:{width:t.readUInt32BE(16),height:t.readUInt32BE(20)}}}},{}],455:[function(t,e,r){"use strict";e.exports={detect:function(t){return"8BPS"===t.toString("ascii",0,4)},calculate:function(t){return{width:t.readUInt32BE(18),height:t.readUInt32BE(14)}}}},{}],456:[function(t,e,r){"use strict";var n=/"']|"[^"]*"|'[^']*')*>/;var i={root:n,width:/\swidth=(['"])([^%]+?)\1/,height:/\sheight=(['"])([^%]+?)\1/,viewbox:/\sviewBox=(['"])(.+?)\1/},a={cm:96/2.54,mm:96/2.54/10,m:96/2.54*100,pt:96/72,pc:96/72/12,em:16,ex:8};function o(t){var e=/([0-9.]+)([a-z]*)/.exec(t);if(e)return Math.round(parseFloat(e[1])*(a[e[2]]||1))}function s(t){var e=t.split(" ");return{width:o(e[2]),height:o(e[3])}}e.exports={detect:function(t){return n.test(t)},calculate:function(t){var e=t.toString("utf8").match(i.root);if(e){var r=function(t){var e=t.match(i.width),r=t.match(i.height),n=t.match(i.viewbox);return{width:e&&o(e[2]),height:r&&o(r[2]),viewbox:n&&s(n[2])}}(e[0]);if(r.width&&r.height)return function(t){return{width:t.width,height:t.height}}(r);if(r.viewbox)return function(t){var e=t.viewbox.width/t.viewbox.height;return t.width?{width:t.width,height:Math.floor(t.width/e)}:t.height?{width:Math.floor(t.height*e),height:t.height}:{width:t.viewbox.width,height:t.viewbox.height}}(r)}throw new TypeError("invalid svg")}}},{}],457:[function(t,e,r){(function(r){(function(){"use strict";var n=t("fs"),i=t("../readUInt");function a(t,e){var r=i(t,16,8,e);return(i(t,16,10,e)<<16)+r}function o(t){if(t.length>24)return t.slice(12)}e.exports={detect:function(t){var e=t.toString("hex",0,4);return"49492a00"===e||"4d4d002a"===e},calculate:function(t,e){if(!e)throw new TypeError("Tiff doesn't support buffer");var s="BE"===function(t){var e=t.toString("ascii",0,2);return"II"===e?"LE":"MM"===e?"BE":void 0}(t),l=function(t,e){for(var r,n,s,l={};t&&t.length&&(r=i(t,16,0,e),n=i(t,16,2,e),s=i(t,32,4,e),0!==r);)1!==s||3!==n&&4!==n||(l[r]=a(t,e)),t=o(t);return l}(function(t,e,a){var o=i(t,32,4,a),s=1024,l=n.statSync(e).size;o+s>l&&(s=l-o-10);var c=r.alloc(s),u=n.openSync(e,"r");return n.readSync(u,c,0,s,o),c.slice(2)}(t,e,s),s),c=l[256],u=l[257];if(!c||!u)throw new TypeError("Invalid Tiff, missing tags");return{width:c,height:u}}}}).call(this)}).call(this,t("buffer").Buffer)},{"../readUInt":445,buffer:111,fs:109}],458:[function(t,e,r){"use strict";e.exports={detect:function(t){var e="RIFF"===t.toString("ascii",0,4),r="WEBP"===t.toString("ascii",8,12),n="VP8"===t.toString("ascii",12,15);return e&&r&&n},calculate:function(t){var e=t.toString("ascii",12,16);if(t=t.slice(20,30),"VP8X"===e){var r=t[0];return!(!(0==(192&r))||!(0==(1&r)))&&function(t){return{width:1+t.readUIntLE(4,3),height:1+t.readUIntLE(7,3)}}(t)}if("VP8 "===e&&47!==t[0])return function(t){return{width:16383&t.readInt16LE(6),height:16383&t.readInt16LE(8)}}(t);var n=t.toString("hex",3,6);return"VP8L"===e&&"9d012a"!==n&&function(t){return{width:1+((63&t[2])<<8|t[1]),height:1+((15&t[4])<<10|t[3]<<2|(192&t[2])>>6)}}(t)}}},{}],459:[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),u=0;u<=i;++u)l[u]=u;s<0&&(l[0]=1,l[1]=0);var f=new a(l,new Array(i+1),!1),h=f.adjacent,p=new Array(i+2);for(u=0;u<=i;++u){for(var d=l.slice(),g=0;g<=i;++g)g===u&&(d[g]=-1);var m=d[0];d[0]=d[1],d[1]=m;var v=new a(d,new Array(i+1),!0);h[u]=v,p[u]=v}p[i+1]=f;for(u=0;u<=i;++u){d=h[u].vertices;var y=h[u].adjacent;for(g=0;g<=i;++g){var x=d[g];if(x<0)y[g]=f;else for(var b=0;b<=i;++b)h[b].vertices.indexOf(x)<0&&(y[g]=h[b])}}var _=new c(i,o,p),w=!!e;for(u=i+1;u0&&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 u=c.prototype;u.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 c=s[l];if(c.boundary&&!(c.lastVisited<=-n)){for(var u=c.vertices,f=0;f<=r;++f){var h=u[f];i[f]=h<0?e:a[h]}var p=this.orient();if(p>0)return c;c.lastVisited=-n,0===p&&o.push(c)}}}return null},u.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,c=s.adjacent,u=0;u<=n;++u)a[u]=i[l[u]];s.lastVisited=r;for(u=0;u<=n;++u){var f=c[u];if(!(f.lastVisited>=r)){var h=a[u];a[u]=t;var p=this.orient();if(a[u]=h,p<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},u.addPeaks=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,l=this.tuple,c=this.interior,u=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,c.push(e);for(var h=[];f.length>0;){var p=(e=f.pop()).vertices,d=e.adjacent,g=p.indexOf(r);if(!(g<0))for(var m=0;m<=n;++m)if(m!==g){var v=d[m];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;b<=n;++b)y[b]<0?(x=b,l[b]=t):l[b]=i[y[b]];if(this.orient()>0){y[x]=r,v.boundary=!1,c.push(v),f.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var _=v.adjacent,w=p.slice(),T=d.slice(),k=new a(w,T,!0);u.push(k);var M=_.indexOf(e);if(!(M<0)){_[M]=k,T[g]=v,w[m]=-1,T[m]=e,d[m]=k,k.flip();for(b=0;b<=n;++b){var A=w[b];if(!(A<0||A===r)){for(var S=new Array(n-1),E=0,C=0;C<=n;++C){var L=w[C];L<0||C===b||(S[E++]=L)}h.push(new o(S,k,b))}}}}}}h.sort(s);for(m=0;m+1=0?o[l++]=s[u]:c=1&u;if(c===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":548,"simplicial-complex":558}],460:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function i(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 v(null);return new v(m(t))};var a=i.prototype;function o(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 s(t,e){var r=m(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 l(t,e){var r=t.intervals([]);r.push(e),s(t,r)}function c(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?0:(r.splice(n,1),s(t,r),1)}function u(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function h(t,e){for(var r=0;r>1],a=[],o=[],s=[];for(r=0;r3*(e+1)?l(this,t):this.left.insert(t):this.left=m([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?l(this,t):this.right.insert(t):this.right=m([t]);else{var r=n.ge(this.leftPoints,t,d),i=n.ge(this.rightPoints,t,g);this.leftPoints.splice(r,0,t),this.rightPoints.splice(i,0,t)}},a.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?c(this,t):2===(s=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?c(this,t):2===(s=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,i=this.left;i.right;)r=i,i=i.right;if(r===this)i.right=this.right;else{var a=this.left,s=this.right;r.count-=i.count,r.right=i.left,i.left=a,i.right=s}o(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?o(this,this.left):o(this,this.right);return 1}for(a=n.ge(this.leftPoints,t,d);athis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return f(this.rightPoints,t,e)}return h(this.leftPoints,e)},a.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?f(this.rightPoints,t,r):h(this.leftPoints,r)};var y=v.prototype;y.insert=function(t){this.root?this.root.insert(t):this.root=new i(t[0],null,null,[t],[t])},y.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},y.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},y.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(y,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(y,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":461}],461:[function(t,e,r){arguments[4][243][0].apply(r,arguments)},{dup:243}],462:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r * @license MIT */ -e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],440:[function(t,e,r){"use strict";e.exports="undefined"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion))},{}],441:[function(t,e,r){"use strict";e.exports=i,e.exports.isMobile=i,e.exports.default=i;var n=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,a=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function i(t){t||(t={});var e=t.ua;if(e||"undefined"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&"string"==typeof e.headers["user-agent"]&&(e=e.headers["user-agent"]),"string"!=typeof e)return!1;var r=t.tablet?a.test(e):n.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf("Macintosh")&&-1!==e.indexOf("Safari")&&(r=!0),r}},{}],442:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],443:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],444:[function(t,e,r){"use strict";e.exports=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}},{}],445:[function(t,e,r){"use strict";e.exports=function(t){return"string"==typeof t&&(t=t.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(t)&&/[\dz]$/i.test(t)&&t.length>4))}},{}],446:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],447:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():(t=t||self).mapboxgl=n()}(this,(function(){"use strict";var t,e,r;function n(n,a){if(t)if(e){var i="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),(r=a(o)).workerUrl=window.URL.createObjectURL(new Blob([i],{type:"text/javascript"}))}else e=a;else t=a}return n(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,a,i,o;for(void 0===e&&(e=1e-6),a=t,o=0;o<8;o++){if(i=this.sampleCurveX(a)-t,Math.abs(i)(n=1))return n;for(;ri?r=a:n=a,a=.5*(n-r)+r}return a},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var a=i;function i(t,e){this.x=t,this.y=e}function o(t,e,n,a){var i=new r(t,e,n,a);return function(t){return i.solve(t)}}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),a=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(t){return t instanceof i?t:Array.isArray(t)?new i(t[0],t[1]):t};var s=o(.25,.1,.25,1);function l(t,e,r){return Math.min(r,Math.max(e,t))}function c(t,e,r){var n=r-e,a=((t-e)%n+n)%n+e;return a===e?r:a}function u(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,a=e;n>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function d(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function g(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function m(t,e){return-1!==t.indexOf(e,t.length-e.length)}function v(t,e,r){var n={};for(var a in t)n[a]=e.call(r||this,t[a],a,t);return n}function y(t,e,r){var n={};for(var a in t)e.call(r||this,t[a],a,t)&&(n[a]=t[a]);return n}function x(t){return Array.isArray(t)?t.map(x):"object"==typeof t&&t?v(t,x):t}var b={};function _(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function w(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function T(t){for(var e=0,r=0,n=t.length,a=n-1,i=void 0,o=void 0;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,a){var i=n||a;return e[r]=!i||i.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var A=null;function S(t){if(null==A){var e=t.navigator?t.navigator.userAgent:null;A=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return A}function E(t){try{var e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var C,L,P,I,z=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),O=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,D=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,R={now:z,frame:function(t){var e=O(t);return{cancel:function(){return D(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=self.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return C||(C=self.document.createElement("a")),C.href=t,C.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio},get prefersReducedMotion(){return!!self.matchMedia&&(null==L&&(L=self.matchMedia("(prefers-reduced-motion: reduce)")),L.matches)}},F={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},B={supported:!1,testSupport:function(t){!N&&I&&(j?U(t):P=t)}},N=!1,j=!1;function U(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,I),t.isContextLost())return;B.supported=!0}catch(t){}t.deleteTexture(e),N=!0}self.document&&((I=self.document.createElement("img")).onload=function(){P&&U(P),P=null,j=!0},I.onerror=function(){N=!0,P=null},I.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var V="01",q=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function H(t){return 0===t.indexOf("mapbox:")}q.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",V,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},q.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},q.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},q.prototype.normalizeStyleURL=function(t,e){if(!H(t))return t;var r=Z(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeGlyphsURL=function(t,e){if(!H(t))return t;var r=Z(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSourceURL=function(t,e){if(!H(t))return t;var r=Z(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSpriteURL=function(t,e,r,n){var a=Z(t);return H(t)?(a.path="/styles/v1"+a.path+"/sprite"+e+r,this._makeAPIURL(a,this._customAccessToken||n)):(a.path+=""+e+r,X(a))},q.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!H(t))return t;var r=Z(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(R.devicePixelRatio>=2||512===e?"@2x":"")+(B.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e=1&&self.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){_("Unable to write to LocalStorage")}},K.prototype.processRequests=function(t){},K.prototype.postEvent=function(t,e,r,n){var a=this;if(F.EVENTS_URL){var i=Z(F.EVENTS_URL);i.params.push("access_token="+(n||F.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.10.1",skuId:V,userId:this.anonId},s=e?u(o,e):o,l={url:X(i),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=xt(l,(function(t){a.pendingRequest=null,r(t),a.saveEventData(),a.processRequests(n)}))}},K.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var Q,$,tt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(F.EVENTS_URL&&n||F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||Y(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,a=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),d(this.anonId)||(this.anonId=p()),this.postEvent(a,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}(K),et=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){F.EVENTS_URL&&F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||Y(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=J(F.ACCESS_TOKEN),n=r?r.u:F.ACCESS_TOKEN,a=n!==this.eventData.tokenU;d(this.anonId)||(this.anonId=p(),a=!0);var i=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),s=new Date(i),l=(i-this.eventData.lastSuccess)/864e5;a=a||l>=1||l<-1||o.getDate()!==s.getDate()}else a=!0;if(!a)return this.processRequests();this.postEvent(i,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=i,e.eventData.tokenU=n)}),t)}},e}(K)),rt=et.postTurnstileEvent.bind(et),nt=new tt,at=nt.postMapLoadEvent.bind(nt),it=500,ot=50;function st(){self.caches&&!Q&&(Q=self.caches.open("mapbox-tiles"))}function lt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ct,ut=1/0;function ht(){return null==ct&&(ct=self.OffscreenCanvas&&new self.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),ct}var ft={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ft);var pt,dt,gt=function(t){function e(e,r,n){401===r&&Y(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=r,this.url=n,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),mt=k()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===self.location.protocol?self.parent:self).location.href},vt=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(mt())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&self.Request.prototype.hasOwnProperty("signal"))return function(t,e){var r,n=new self.AbortController,a=new self.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:mt(),signal:n.signal}),i=!1,o=!1,s=(r=a.url).indexOf("sku=")>0&&Y(r);"json"===t.type&&a.headers.set("Accept","application/json");var l=function(r,n,i){if(!o){if(r&&"SecurityError"!==r.message&&_(r),n&&i)return c(n);var l=Date.now();self.fetch(a).then((function(r){if(r.ok){var n=s?r.clone():null;return c(r,n,l)}return e(new gt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},c=function(r,n,s){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){o||(n&&s&&function(t,e,r){if(st(),Q){var n={status:e.status,statusText:e.statusText,headers:new self.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var a=M(e.headers.get("Cache-Control")||"");a["no-store"]||(a["max-age"]&&n.headers.set("Expires",new Date(r+1e3*a["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===$)try{new Response(new ReadableStream),$=!0}catch(t){$=!1}$?e(t.body):t.blob().then(e)}(e,(function(e){var r=new self.Response(e,n);st(),Q&&Q.then((function(e){return e.put(lt(t.url),r)})).catch((function(t){return _(t.message)}))})))}}(a,n,s),i=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){o||e(new Error(t.message))}))};return s?function(t,e){if(st(),!Q)return e(null);var r=lt(t.url);Q.then((function(t){t.match(r).then((function(n){var a=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),r=M(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),a&&t.put(r,n.clone()),e(null,n,a)})).catch(e)})).catch(e)}(a,l):l(null,null),{cancel:function(){o=!0,i||n.abort()}}}(t,e);if(k()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){var r=new self.XMLHttpRequest;for(var n in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(n,t.headers[n]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new gt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},yt=function(t,e){return vt(u(t,{type:"arrayBuffer"}),e)},xt=function(t,e){return vt(u(t,{method:"POST"}),e)};pt=[],dt=0;var bt=function(t,e){if(B.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),dt>=F.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return pt.push(r),r}dt++;var n=!1,a=function(){if(!n)for(n=!0,dt--;pt.length&&dt0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},Mt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var At={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},St=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function Et(t){var e=t.value;return e?[new St(t.key,e,"constants have been deprecated as of v8")]:[]}function Ct(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,a=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Yt=[Ot,Dt,Rt,Ft,Bt,Vt,Nt,Ht(jt),qt];function Wt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Wt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=Yt;r255?255:t}function a(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function i(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),c=s.indexOf(")");if(-1!==l&&c+1===s.length){var u=s.substr(0,l),h=s.substr(l+1,c-(l+1)).split(","),f=1;switch(u){case"rgba":if(4!==h.length)return null;f=i(h.pop());case"rgb":return 3!==h.length?null:[a(h[0]),a(h[1]),a(h[2]),f];case"hsla":if(4!==h.length)return null;f=i(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,d=i(h[1]),g=i(h[2]),m=g<=.5?g*(d+1):g+d-g*d,v=2*g-m;return[n(255*o(v,m,p+1/3)),n(255*o(v,m,p)),n(255*o(v,m,p-1/3)),f];default:return null}}return null}}catch(t){}})).parseCSSColor,Kt=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};Kt.parse=function(t){if(t){if(t instanceof Kt)return t;if("string"==typeof t){var e=Jt(t);if(e)return new Kt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Kt.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},Kt.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},Kt.black=new Kt(0,0,0,1),Kt.white=new Kt(1,1,1,1),Kt.transparent=new Kt(0,0,0,0),Kt.red=new Kt(1,0,0,1);var Qt=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Qt.prototype.compare=function(t,e){return this.collator.compare(t,e)},Qt.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var $t=function(t,e,r,n,a){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=a},te=function(t){this.sections=t};te.fromString=function(t){return new te([new $t(t,null,null,null,null)])},te.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},te.factory=function(t){return t instanceof te?t:te.fromString(t)},te.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},te.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ne(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof Kt)return!0;if(t instanceof Qt)return!0;if(t instanceof te)return!0;if(t instanceof ee)return!0;if(Array.isArray(t)){for(var e=0,r=t;e2){var s=t[1];if("string"!=typeof s||!(s in le)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=le[s],n++}else i=jt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++}r=Ht(i,o)}else r=le[a];for(var l=[];n1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var ue=function(t){this.type=Vt,this.sections=t};ue.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],a=!1,i=1;i<=t.length-1;++i){var o=t[i];if(a&&"object"==typeof o&&!Array.isArray(o)){a=!1;var s=null;if(o["font-scale"]&&!(s=e.parse(o["font-scale"],1,Dt)))return null;var l=null;if(o["text-font"]&&!(l=e.parse(o["text-font"],1,Ht(Rt))))return null;var c=null;if(o["text-color"]&&!(c=e.parse(o["text-color"],1,Bt)))return null;var u=n[n.length-1];u.scale=s,u.font=l,u.textColor=c}else{var h=e.parse(t[i],1,jt);if(!h)return null;var f=h.type.kind;if("string"!==f&&"value"!==f&&"null"!==f&&"resolvedImage"!==f)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,n.push({content:h,scale:null,font:null,textColor:null})}}return new ue(n)},ue.prototype.evaluate=function(t){return new te(this.sections.map((function(e){var r=e.content.evaluate(t);return ae(r)===qt?new $t("",r,null,null,null):new $t(ie(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},ue.prototype.eachChild=function(t){for(var e=0,r=this.sections;e-1),r},he.prototype.eachChild=function(t){t(this.input)},he.prototype.outputDefined=function(){return!1},he.prototype.serialize=function(){return["image",this.input.serialize()]};var fe={"to-boolean":Ft,"to-color":Bt,"to-number":Dt,"to-string":Rt},pe=function(t,e){this.type=t,this.args=e};pe.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=fe[r],a=[],i=1;i4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":re(e[0],e[1],e[2],e[3])))return new Kt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new se(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var o=null,s=0,l=this.args;s=e[2]||t[1]<=e[1]||t[3]>=e[3])}function be(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(r*a*8192),Math.round(n*a*8192)]}function _e(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function we(t,e){for(var r,n,a,i,o,s,l,c=!1,u=0,h=e.length;u0&&s<0||o<0&&s>0}function Me(t,e,r){for(var n=0,a=r;nr[2]){var a=.5*n,i=t[0]-r[0]>a?-n:r[0]-t[0]>a?n:0;0===i&&(i=t[0]-r[2]>a?-n:r[2]-t[0]>a?n:0),t[0]+=i}ye(e,t)}function Pe(t,e,r,n){for(var a=8192*Math.pow(2,n.z),i=[8192*n.x,8192*n.y],o=[],s=0,l=t;s=0)return!1;var r=!0;return t.eachChild((function(t){r&&!Re(t,e)&&(r=!1)})),r}ze.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(ne(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;ne))throw new se("Input is not a number.");i=o-1}return 0}Be.prototype.parse=function(t,e,r,n,a){return void 0===a&&(a={}),e?this.concat(e,r,n)._parse(t,a):this._parse(t,a)},Be.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new ce(e,[t]):"coerce"===r?new pe(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var a=this.registry[n];if(a){var i=a.parse(t,this);if(!i)return null;if(this.expectedType){var o=this.expectedType,s=i.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==s.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(o,s))return null}else i=r(i,o,e.typeAnnotation||"coerce");else i=r(i,o,e.typeAnnotation||"assert")}if(!(i instanceof oe)&&"resolvedImage"!==i.type.kind&&function t(e){if(e instanceof Fe)return t(e.boundExpression);if(e instanceof me&&"error"===e.name)return!1;if(e instanceof ve)return!1;if(e instanceof ze)return!1;var r=e instanceof pe||e instanceof ce,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof oe})),!!n&&Oe(e)&&Re(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(i)){var l=new ge;try{i=new oe(i.type,i.evaluate(l))}catch(t){return this.error(t.message),null}}return i}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Be.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,a=r?this.scope.concat(r):this.scope;return new Be(this.registry,n,e||null,a,this.errors)},Be.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new It(n,t))},Be.prototype.checkSubtype=function(t,e){var r=Wt(t,e);return r&&this.error(r),r};var je=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,a=r;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var u=e.parse(s,c,a);if(!u)return null;a=a||u.type,n.push([o,u])}return new je(a,r,n)},je.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var a=e.length;return n>=e[a-1]?r[a-1].evaluate(t):r[Ne(e,n)].evaluate(t)},je.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ve=Object.freeze({__proto__:null,number:Ue,color:function(t,e,r){return new Kt(Ue(t.r,e.r,r),Ue(t.g,e.g,r),Ue(t.b,e.b,r),Ue(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return Ue(t,e[n],r)}))}}),qe=6/29*3*(6/29),He=Math.PI/180,Ge=180/Math.PI;function Ye(t){return t>.008856451679035631?Math.pow(t,1/3):t/qe+4/29}function We(t){return t>6/29?t*t*t:qe*(t-4/29)}function Ze(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Xe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Je(t){var e=Xe(t.r),r=Xe(t.g),n=Xe(t.b),a=Ye((.4124564*e+.3575761*r+.1804375*n)/.95047),i=Ye((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*i-16,a:500*(a-i),b:200*(i-Ye((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function Ke(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*We(e),r=.95047*We(r),n=1.08883*We(n),new Kt(Ze(3.2404542*r-1.5371385*e-.4985314*n),Ze(-.969266*r+1.8760108*e+.041556*n),Ze(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function Qe(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var $e={forward:Je,reverse:Ke,interpolate:function(t,e,r){return{l:Ue(t.l,e.l,r),a:Ue(t.a,e.a,r),b:Ue(t.b,e.b,r),alpha:Ue(t.alpha,e.alpha,r)}}},tr={forward:function(t){var e=Je(t),r=e.l,n=e.a,a=e.b,i=Math.atan2(a,n)*Ge;return{h:i<0?i+360:i,c:Math.sqrt(n*n+a*a),l:r,alpha:t.a}},reverse:function(t){var e=t.h*He,r=t.c;return Ke({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:Qe(t.h,e.h,r),c:Ue(t.c,e.c,r),l:Ue(t.l,e.l,r),alpha:Ue(t.alpha,e.alpha,r)}}},er=Object.freeze({__proto__:null,lab:$e,hcl:tr}),rr=function(t,e,r,n,a){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var i=0,o=a;i1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(a=e.parse(a,2,Dt)))return null;var l=[],c=null;"interpolate-hcl"===r||"interpolate-lab"===r?c=Bt:e.expectedType&&"value"!==e.expectedType.kind&&(c=e.expectedType);for(var u=0;u=h)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);var g=e.parse(f,d,c);if(!g)return null;c=c||g.type,l.push([h,g])}return"number"===c.kind||"color"===c.kind||"array"===c.kind&&"number"===c.itemType.kind&&"number"==typeof c.N?new rr(c,r,n,a,l):e.error("Type "+Gt(c)+" is not interpolatable.")},rr.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var a=e.length;if(n>=e[a-1])return r[a-1].evaluate(t);var i=Ne(e,n),o=rr.interpolationFactor(this.interpolation,n,e[i],e[i+1]),s=r[i].evaluate(t),l=r[i+1].evaluate(t);return"interpolate"===this.operator?Ve[this.type.kind.toLowerCase()](s,l,o):"interpolate-hcl"===this.operator?tr.reverse(tr.interpolate(tr.forward(s),tr.forward(l),o)):$e.reverse($e.interpolate($e.forward(s),$e.forward(l),o))},rr.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new se("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new se("Array index must be an integer, but found "+e+" instead.");return r[e]},or.prototype.eachChild=function(t){t(this.index),t(this.input)},or.prototype.outputDefined=function(){return!1},or.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var sr=function(t,e){this.type=Ft,this.needle=t,this.haystack=e};sr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,jt),n=e.parse(t[2],2,jt);return r&&n?Zt(r.type,[Ft,Rt,Dt,Ot,jt])?new sr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Gt(r.type)+" instead"):null},sr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Xt(e,["boolean","string","number","null"]))throw new se("Expected first argument to be of type boolean, string, number or null, but found "+Gt(ae(e))+" instead.");if(!Xt(r,["string","array"]))throw new se("Expected second argument to be of type array or string, but found "+Gt(ae(r))+" instead.");return r.indexOf(e)>=0},sr.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},sr.prototype.outputDefined=function(){return!0},sr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var lr=function(t,e,r){this.type=Dt,this.needle=t,this.haystack=e,this.fromIndex=r};lr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,jt),n=e.parse(t[2],2,jt);if(!r||!n)return null;if(!Zt(r.type,[Ft,Rt,Dt,Ot,jt]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Gt(r.type)+" instead");if(4===t.length){var a=e.parse(t[3],3,Dt);return a?new lr(r,n,a):null}return new lr(r,n)},lr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Xt(e,["boolean","string","number","null"]))throw new se("Expected first argument to be of type boolean, string, number or null, but found "+Gt(ae(e))+" instead.");if(!Xt(r,["string","array"]))throw new se("Expected second argument to be of type array or string, but found "+Gt(ae(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},lr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},lr.prototype.outputDefined=function(){return!1},lr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var cr=function(t,e,r,n,a,i){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=a,this.otherwise=i};cr.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var a={},i=[],o=2;oNumber.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof f&&Math.floor(f)!==f)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,ae(f)))return null}else r=ae(f);if(void 0!==a[String(f)])return c.error("Branch labels must be unique.");a[String(f)]=i.length}var p=e.parse(l,o,n);if(!p)return null;n=n||p.type,i.push(p)}var d=e.parse(t[1],1,jt);if(!d)return null;var g=e.parse(t[t.length-1],t.length-1,n);return g?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new cr(r,n,d,a,i,g):null},cr.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ae(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},cr.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},cr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},cr.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},a=0,i=Object.keys(this.cases).sort();a=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,jt),n=e.parse(t[2],2,Dt);if(!r||!n)return null;if(!Zt(r.type,[Ht(jt),Rt,jt]))return e.error("Expected first argument to be of type array or string, but found "+Gt(r.type)+" instead");if(4===t.length){var a=e.parse(t[3],3,Dt);return a?new hr(r.type,r,n,a):null}return new hr(r.type,r,n)},hr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Xt(e,["string","array"]))throw new se("Expected first argument to be of type array or string, but found "+Gt(ae(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},hr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},hr.prototype.outputDefined=function(){return!1},hr.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var gr=dr("==",(function(t,e,r){return e===r}),pr),mr=dr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!pr(0,e,r,n)})),vr=dr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),xr=dr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),br=dr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),_r=function(t,e,r,n,a){this.type=Rt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=a};_r.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Dt);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var a=null;if(n.locale&&!(a=e.parse(n.locale,1,Rt)))return null;var i=null;if(n.currency&&!(i=e.parse(n.currency,1,Rt)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Dt)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Dt))?null:new _r(r,a,i,o,s)},_r.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},_r.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},_r.prototype.outputDefined=function(){return!1},_r.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var wr=function(t){this.type=Dt,this.input=t};wr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Gt(r.type)+" instead."):new wr(r):null},wr.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new se("Expected value to be of type string or array, but found "+Gt(ae(e))+" instead.")},wr.prototype.eachChild=function(t){t(this.input)},wr.prototype.outputDefined=function(){return!1},wr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Tr={"==":gr,"!=":mr,">":yr,"<":vr,">=":br,"<=":xr,array:ce,at:or,boolean:ce,case:ur,coalesce:ar,collator:ve,format:ue,image:he,in:sr,"index-of":lr,interpolate:rr,"interpolate-hcl":rr,"interpolate-lab":rr,length:wr,let:ir,literal:oe,match:cr,number:ce,"number-format":_r,object:ce,slice:hr,step:je,string:ce,"to-boolean":pe,"to-color":pe,"to-number":pe,"to-string":pe,var:Fe,within:ze};function kr(t,e){var r=e[0],n=e[1],a=e[2],i=e[3];r=r.evaluate(t),n=n.evaluate(t),a=a.evaluate(t);var o=i?i.evaluate(t):1,s=re(r,n,a,o);if(s)throw new se(s);return new Kt(r/255*o,n/255*o,a/255*o,o)}function Mr(t,e){return t in e}function Ar(t,e){var r=e[t];return void 0===r?null:r}function Sr(t){return{type:t}}function Er(t){return{result:"success",value:t}}function Cr(t){return{result:"error",value:t}}function Lr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Pr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ir(t){return!!t.expression&&t.expression.interpolated}function zr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Or(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Dr(t){return t}function Rr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Fr(t,e,r,n,a){return Rr(typeof r===a?n[r]:void 0,t.default,e.default)}function Br(t,e,r){if("number"!==zr(r))return Rr(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var a=Ne(t.stops.map((function(t){return t[0]})),r);return t.stops[a][1]}function Nr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==zr(r))return Rr(t.default,e.default);var a=t.stops.length;if(1===a)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[a-1][0])return t.stops[a-1][1];var i=Ne(t.stops.map((function(t){return t[0]})),r),o=function(t,e,r,n){var a=n-r,i=t-r;return 0===a?0:1===e?i/a:(Math.pow(e,i)-1)/(Math.pow(e,a)-1)}(r,n,t.stops[i][0],t.stops[i+1][0]),s=t.stops[i][1],l=t.stops[i+1][1],c=Ve[e.type]||Dr;if(t.colorSpace&&"rgb"!==t.colorSpace){var u=er[t.colorSpace];c=function(t,e){return u.reverse(u.interpolate(u.forward(t),u.forward(e),o))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return c(r,n,o)}}:c(s,l,o)}function jr(t,e,r){return"color"===e.type?r=Kt.parse(r):"formatted"===e.type?r=te.fromString(r.toString()):"resolvedImage"===e.type?r=ee.fromString(r.toString()):zr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Rr(r,t.default,e.default)}me.register(Tr,{error:[{kind:"error"},[Rt],function(t,e){throw new se(e[0].evaluate(t))}],typeof:[Rt,[jt],function(t,e){return Gt(ae(e[0].evaluate(t)))}],"to-rgba":[Ht(Dt,4),[Bt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Bt,[Dt,Dt,Dt],kr],rgba:[Bt,[Dt,Dt,Dt,Dt],kr],has:{type:Ft,overloads:[[[Rt],function(t,e){return Mr(e[0].evaluate(t),t.properties())}],[[Rt,Nt],function(t,e){var r=e[1];return Mr(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:jt,overloads:[[[Rt],function(t,e){return Ar(e[0].evaluate(t),t.properties())}],[[Rt,Nt],function(t,e){var r=e[1];return Ar(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[jt,[Rt],function(t,e){return Ar(e[0].evaluate(t),t.featureState||{})}],properties:[Nt,[],function(t){return t.properties()}],"geometry-type":[Rt,[],function(t){return t.geometryType()}],id:[jt,[],function(t){return t.id()}],zoom:[Dt,[],function(t){return t.globals.zoom}],"heatmap-density":[Dt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Dt,[],function(t){return t.globals.lineProgress||0}],accumulated:[jt,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Dt,Sr(Dt),function(t,e){for(var r=0,n=0,a=e;n":[Ft,[Rt,jt],function(t,e){var r=e[0],n=e[1],a=t.properties()[r.value],i=n.value;return typeof a==typeof i&&a>i}],"filter-id->":[Ft,[jt],function(t,e){var r=e[0],n=t.id(),a=r.value;return typeof n==typeof a&&n>a}],"filter-<=":[Ft,[Rt,jt],function(t,e){var r=e[0],n=e[1],a=t.properties()[r.value],i=n.value;return typeof a==typeof i&&a<=i}],"filter-id-<=":[Ft,[jt],function(t,e){var r=e[0],n=t.id(),a=r.value;return typeof n==typeof a&&n<=a}],"filter->=":[Ft,[Rt,jt],function(t,e){var r=e[0],n=e[1],a=t.properties()[r.value],i=n.value;return typeof a==typeof i&&a>=i}],"filter-id->=":[Ft,[jt],function(t,e){var r=e[0],n=t.id(),a=r.value;return typeof n==typeof a&&n>=a}],"filter-has":[Ft,[jt],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Ft,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Ft,[Ht(Rt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Ft,[Ht(jt)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Ft,[Rt,Ht(jt)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[Ft,[Rt,Ht(jt)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var a=r+n>>1;if(e[a]===t)return!0;e[a]>t?n=a-1:r=a+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:Ft,overloads:[[[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Sr(Ft),function(t,e){for(var r=0,n=e;r0&&"string"==typeof t[0]&&t[0]in Tr}function qr(t,e){var r=new Be(Tr,[],e?function(t){var e={color:Bt,string:Rt,number:Dt,enum:Rt,boolean:Ft,formatted:Vt,resolvedImage:qt};return"array"===t.type?Ht(e[t.value]||jt,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Er(new Ur(n,e)):Cr(r.errors)}Ur.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,a,i){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=i,this.expression.evaluate(this._evaluator)},Ur.prototype.evaluate=function(t,e,r,n,a,i){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=i||null;try{var o=this.expression.evaluate(this._evaluator);if(null==o||"number"==typeof o&&o!=o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new se("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(o)+" instead.");return o}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Hr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!De(e.expression)};Hr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,a,i){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,a,i)},Hr.prototype.evaluate=function(t,e,r,n,a,i){return this._styleExpression.evaluate(t,e,r,n,a,i)};var Gr=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!De(e.expression),this.interpolationType=n};function Yr(t,e){if("error"===(t=qr(t,e)).result)return t;var r=t.value.expression,n=Oe(r);if(!n&&!Lr(e))return Cr([new It("","data expressions not supported")]);var a=Re(r,["zoom"]);if(!a&&!Pr(e))return Cr([new It("","zoom expressions not supported")]);var i=function t(e){var r=null;if(e instanceof ir)r=t(e.result);else if(e instanceof ar)for(var n=0,a=e.args;nn.maximum?[new St(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function Kr(t){var e,r,n,a=t.valueSpec,i=Lt(t.value.type),o={},s="categorical"!==i&&void 0===t.value.property,l=!s,c="array"===zr(t.value.stops)&&"array"===zr(t.value.stops[0])&&"object"===zr(t.value.stops[0][0]),u=Zr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new St(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Xr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===zr(r)&&0===r.length&&e.push(new St(t.key,r,"array must have at least one stop")),e},default:function(t){return bn({key:t.key,value:t.value,valueSpec:a,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&s&&u.push(new St(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||u.push(new St(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!Ir(t.valueSpec)&&u.push(new St(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Lr(t.valueSpec)?u.push(new St(t.key,t.value,"property functions not supported")):s&&!Pr(t.valueSpec)&&u.push(new St(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||u.push(new St(t.key,t.value,'"property" property is required')),u;function h(t){var e=[],i=t.value,s=t.key;if("array"!==zr(i))return[new St(s,i,"array expected, "+zr(i)+" found")];if(2!==i.length)return[new St(s,i,"array length 2 expected, length "+i.length+" found")];if(c){if("object"!==zr(i[0]))return[new St(s,i,"object expected, "+zr(i[0])+" found")];if(void 0===i[0].zoom)return[new St(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new St(s,i,"object stop key must have value")];if(n&&n>Lt(i[0].zoom))return[new St(s,i[0].zoom,"stop zoom values must appear in ascending order")];Lt(i[0].zoom)!==n&&(n=Lt(i[0].zoom),r=void 0,o={}),e=e.concat(Zr({key:s+"[0]",value:i[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Jr,value:f}}))}else e=e.concat(f({key:s+"[0]",value:i[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},i));return Vr(Pt(i[1]))?e.concat([new St(s+"[1]",i[1],"expressions are not allowed in function stops.")]):e.concat(bn({key:s+"[1]",value:i[1],valueSpec:a,style:t.style,styleSpec:t.styleSpec}))}function f(t,n){var s=zr(t.value),l=Lt(t.value),c=null!==t.value?t.value:n;if(e){if(s!==e)return[new St(t.key,c,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new St(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){var u="number expected, "+s+" found";return Lr(a)&&void 0===i&&(u+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new St(t.key,c,u)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==r&&l=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function an(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?on(t[1],t[2],"=="):"!="===r?cn(on(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?on(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(an))):"all"===r?["all"].concat(t.slice(1).map(an)):"none"===r?["all"].concat(t.slice(1).map(an).map(cn)):"in"===r?sn(t[1],t.slice(2)):"!in"===r?cn(sn(t[1],t.slice(2))):"has"===r?ln(t[1]):"!has"===r?cn(ln(t[1])):"within"!==r||t}function on(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function sn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(nn)]]:["filter-in-small",t,["literal",e]]}}function ln(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function cn(t){return["!",t]}function un(t){return tn(Pt(t.value))?Qr(Ct({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==zr(r))return[new St(n,r,"array expected, "+zr(r)+" found")];var a,i=e.styleSpec,o=[];if(r.length<1)return[new St(n,r,"filter array must have at least 1 element")];switch(o=o.concat($r({key:n+"[0]",value:r[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),Lt(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===Lt(r[1])&&o.push(new St(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&o.push(new St(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(a=zr(r[1]))&&o.push(new St(n+"[1]",r[1],"string expected, "+a+" found"));for(var s=2;s=u[p+0]&&n>=u[p+1])?(o[f]=!0,i.push(c[f])):o[f]=!1}}},Pn.prototype._forEachCell=function(t,e,r,n,a,i,o,s){for(var l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),u=this._convertToCellCoord(r),h=this._convertToCellCoord(n),f=l;f<=u;f++)for(var p=c;p<=h;p++){var d=this.d*p+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(p),this._convertFromCellCoord(f+1),this._convertFromCellCoord(p+1)))&&a.call(this,t,e,r,n,d,i,o,s))return}},Pn.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Pn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Pn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n=0)){var u=t[c];l[c]=On[s].shallow.indexOf(c)>=0?u:Nn(u,e)}t instanceof Error&&(l.message=t.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof t)}function jn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Fn(t)||Bn(t)||ArrayBuffer.isView(t)||t instanceof In)return t;if(Array.isArray(t))return t.map(jn);if("object"==typeof t){var e=t.$name||"Object",r=On[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),a=0,i=Object.keys(t);a=0?s:jn(s)}}return n}throw new Error("can't deserialize object of type "+typeof t)}var Un=function(){this.first=!0};Un.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function qn(t){for(var e=0,r=t;e=65097&&t<=65103)||Vn["CJK Compatibility Ideographs"](t)||Vn["CJK Compatibility"](t)||Vn["CJK Radicals Supplement"](t)||Vn["CJK Strokes"](t)||!(!Vn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Vn["CJK Unified Ideographs Extension A"](t)||Vn["CJK Unified Ideographs"](t)||Vn["Enclosed CJK Letters and Months"](t)||Vn["Hangul Compatibility Jamo"](t)||Vn["Hangul Jamo Extended-A"](t)||Vn["Hangul Jamo Extended-B"](t)||Vn["Hangul Jamo"](t)||Vn["Hangul Syllables"](t)||Vn.Hiragana(t)||Vn["Ideographic Description Characters"](t)||Vn.Kanbun(t)||Vn["Kangxi Radicals"](t)||Vn["Katakana Phonetic Extensions"](t)||Vn.Katakana(t)&&12540!==t||!(!Vn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Vn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Vn["Unified Canadian Aboriginal Syllabics"](t)||Vn["Unified Canadian Aboriginal Syllabics Extended"](t)||Vn["Vertical Forms"](t)||Vn["Yijing Hexagram Symbols"](t)||Vn["Yi Syllables"](t)||Vn["Yi Radicals"](t))))}function Gn(t){return!(Hn(t)||function(t){return!!(Vn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Vn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Vn["Letterlike Symbols"](t)||Vn["Number Forms"](t)||Vn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Vn["Control Pictures"](t)&&9251!==t||Vn["Optical Character Recognition"](t)||Vn["Enclosed Alphanumerics"](t)||Vn["Geometric Shapes"](t)||Vn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Vn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vn["CJK Symbols and Punctuation"](t)||Vn.Katakana(t)||Vn["Private Use Area"](t)||Vn["CJK Compatibility Forms"](t)||Vn["Small Form Variants"](t)||Vn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Yn(t){return t>=1424&&t<=2303||Vn["Arabic Presentation Forms-A"](t)||Vn["Arabic Presentation Forms-B"](t)}function Wn(t,e){return!(!e&&Yn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Vn.Khmer(t))}function Zn(t){for(var e=0,r=t;e-1&&(Jn="error"),Xn&&Xn(t)};function $n(){ta.fire(new Tt("pluginStateChange",{pluginStatus:Jn,pluginURL:Kn}))}var ta=new Mt,ea=function(){return Jn},ra=function(){if("deferred"!==Jn||!Kn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Jn="loading",$n(),Kn&&yt({url:Kn},(function(t){t?Qn(t):(Jn="loaded",$n())}))},na={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===Jn||null!=na.applyArabicShaping},isLoading:function(){return"loading"===Jn},setState:function(t){Jn=t.pluginStatus,Kn=t.pluginURL},isParsed:function(){return null!=na.applyArabicShaping&&null!=na.processBidirectionalText&&null!=na.processStyledBidirectionalText},getPluginURL:function(){return Kn}},aa=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Un,this.transition={})};aa.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var ia=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Or(t))return new Wr(t,e);if(Vr(t)){var r=Yr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return"string"==typeof t&&"color"===e.type&&(n=Kt.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification)};ia.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},ia.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var oa=function(t){this.property=t,this.value=new ia(t,void 0)};oa.prototype.transitioned=function(t,e){return new la(this.property,this.value,e,u({},t.transition,this.transition),t.now)},oa.prototype.untransitioned=function(){return new la(this.property,this.value,null,{},0)};var sa=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};sa.prototype.getValue=function(t){return x(this._values[t].value.value)},sa.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new oa(this._values[t].property)),this._values[t].value=new ia(this._values[t].property,null===e?void 0:x(e))},sa.prototype.getTransition=function(t){return x(this._values[t].transition)},sa.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new oa(this._values[t].property)),this._values[t].transition=x(e)||void 0},sa.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);ethis.end)return this.prior=null,a;if(this.value.isDataDriven())return this.prior=null,a;if(n=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}return a};var ca=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};ca.prototype.possiblyEvaluate=function(t,e,r){for(var n=new fa(this._properties),a=0,i=Object.keys(this._values);an.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(da),ma=function(t){this.specification=t};ma.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var a=t.expression.evaluate(e,null,{},r,n);return this._calculate(a,a,a,e)}return this._calculate(t.expression.evaluate(new aa(Math.floor(e.zoom-1),e)),t.expression.evaluate(new aa(Math.floor(e.zoom),e)),t.expression.evaluate(new aa(Math.floor(e.zoom+1),e)),e)}},ma.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},ma.prototype.interpolate=function(t){return t};var va=function(t){this.specification=t};va.prototype.possiblyEvaluate=function(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)},va.prototype.interpolate=function(){return!1};var ya=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new ia(r,void 0),a=this.defaultTransitionablePropertyValues[e]=new oa(r);this.defaultTransitioningPropertyValues[e]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};Dn("DataDrivenProperty",da),Dn("DataConstantProperty",pa),Dn("CrossFadedDataDrivenProperty",ga),Dn("CrossFadedProperty",ma),Dn("ColorRampProperty",va);var xa=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=(e=e).metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new ua(r.layout)),r.paint)){for(var n in this._transitionablePaint=new sa(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var a in e.layout)this.setLayoutProperty(a,e.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new fa(r.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){void 0===r&&(r={}),null!=e&&this._validate(En,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return m(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(Sn,"layers."+this.id+".paint."+t,t,e,r))return!1;if(m(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t],a="cross-faded-data-driven"===n.property.specification["property-type"],i=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||i||a||this._handleOverridablePaintPropertyUpdate(t,o,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),y(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,a){return void 0===a&&(a={}),(!a||!1!==a.validate)&&Cn(this,t.call(Mn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:At,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof ha&&Lr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Mt),ba={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},_a=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},wa=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Ta(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map((function(t){var a=ba[t.type].BYTES_PER_ELEMENT,i=r=ka(r,Math.max(e,a)),o=t.components||1;return n=Math.max(n,a),r+=a*o,{name:t.name,type:t.type,components:o,offset:i}})),size:ka(r,Math.max(n,e)),alignment:e}}function ka(t,e){return Math.ceil(t/e)*e}wa.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},wa.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},wa.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},wa.prototype.clear=function(){this.length=0},wa.prototype.resize=function(t){this.reserve(t),this.length=t},wa.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},wa.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Ma=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(wa);Ma.prototype.bytesPerElement=4,Dn("StructArrayLayout2i4",Ma);var Aa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,a){var i=4*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,this.int16[i+3]=a,t},e}(wa);Aa.prototype.bytesPerElement=8,Dn("StructArrayLayout4i8",Aa);var Sa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,a,i)},e.prototype.emplace=function(t,e,r,n,a,i,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=a,this.int16[s+4]=i,this.int16[s+5]=o,t},e}(wa);Sa.prototype.bytesPerElement=12,Dn("StructArrayLayout2i4i12",Sa);var Ea=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,a,i)},e.prototype.emplace=function(t,e,r,n,a,i,o){var s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=a,this.uint8[l+6]=i,this.uint8[l+7]=o,t},e}(wa);Ea.prototype.bytesPerElement=8,Dn("StructArrayLayout2i4ub8",Ea);var Ca=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s,l,c){var u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,a,i,o,s,l,c)},e.prototype.emplace=function(t,e,r,n,a,i,o,s,l,c,u){var h=9*t,f=18*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=a,this.uint16[h+4]=i,this.uint16[h+5]=o,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint8[f+16]=c,this.uint8[f+17]=u,t},e}(wa);Ca.prototype.bytesPerElement=18,Dn("StructArrayLayout8ui2ub18",Ca);var La=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s,l,c,u,h){var f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,n,a,i,o,s,l,c,u,h)},e.prototype.emplace=function(t,e,r,n,a,i,o,s,l,c,u,h,f){var p=12*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=n,this.int16[p+3]=a,this.uint16[p+4]=i,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=f,t},e}(wa);La.prototype.bytesPerElement=24,Dn("StructArrayLayout4i4ui4i24",La);var Pa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var a=3*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,t},e}(wa);Pa.prototype.bytesPerElement=12,Dn("StructArrayLayout3f12",Pa);var Ia=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(wa);Ia.prototype.bytesPerElement=4,Dn("StructArrayLayout1ul4",Ia);var za=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s,l){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,a,i,o,s,l)},e.prototype.emplace=function(t,e,r,n,a,i,o,s,l,c){var u=10*t,h=5*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=n,this.int16[u+3]=a,this.int16[u+4]=i,this.int16[u+5]=o,this.uint32[h+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,t},e}(wa);za.prototype.bytesPerElement=20,Dn("StructArrayLayout6i1ul2ui20",za);var Oa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,a,i)},e.prototype.emplace=function(t,e,r,n,a,i,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=a,this.int16[s+4]=i,this.int16[s+5]=o,t},e}(wa);Oa.prototype.bytesPerElement=12,Dn("StructArrayLayout2i2i2i12",Oa);var Da=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n,a)},e.prototype.emplace=function(t,e,r,n,a,i){var o=4*t,s=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[s+6]=a,this.int16[s+7]=i,t},e}(wa);Da.prototype.bytesPerElement=16,Dn("StructArrayLayout2f1f2i16",Da);var Ra=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,a){var i=12*t,o=3*t;return this.uint8[i+0]=e,this.uint8[i+1]=r,this.float32[o+1]=n,this.float32[o+2]=a,t},e}(wa);Ra.prototype.bytesPerElement=12,Dn("StructArrayLayout2ub2f12",Ra);var Fa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var a=3*t;return this.uint16[a+0]=e,this.uint16[a+1]=r,this.uint16[a+2]=n,t},e}(wa);Fa.prototype.bytesPerElement=6,Dn("StructArrayLayout3ui6",Fa);var Ba=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g,m){var v=this.length;return this.resize(v+1),this.emplace(v,t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g,m)},e.prototype.emplace=function(t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g,m,v){var y=24*t,x=12*t,b=48*t;return this.int16[y+0]=e,this.int16[y+1]=r,this.uint16[y+2]=n,this.uint16[y+3]=a,this.uint32[x+2]=i,this.uint32[x+3]=o,this.uint32[x+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=u,this.float32[x+7]=h,this.float32[x+8]=f,this.uint8[b+36]=p,this.uint8[b+37]=d,this.uint8[b+38]=g,this.uint32[x+10]=m,this.int16[y+22]=v,t},e}(wa);Ba.prototype.bytesPerElement=48,Dn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ba);var Na=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g,m,v,y,x,b,_,w,T,k,M,A,S){var E=this.length;return this.resize(E+1),this.emplace(E,t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g,m,v,y,x,b,_,w,T,k,M,A,S)},e.prototype.emplace=function(t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g,m,v,y,x,b,_,w,T,k,M,A,S,E){var C=34*t,L=17*t;return this.int16[C+0]=e,this.int16[C+1]=r,this.int16[C+2]=n,this.int16[C+3]=a,this.int16[C+4]=i,this.int16[C+5]=o,this.int16[C+6]=s,this.int16[C+7]=l,this.uint16[C+8]=c,this.uint16[C+9]=u,this.uint16[C+10]=h,this.uint16[C+11]=f,this.uint16[C+12]=p,this.uint16[C+13]=d,this.uint16[C+14]=g,this.uint16[C+15]=m,this.uint16[C+16]=v,this.uint16[C+17]=y,this.uint16[C+18]=x,this.uint16[C+19]=b,this.uint16[C+20]=_,this.uint16[C+21]=w,this.uint16[C+22]=T,this.uint32[L+12]=k,this.float32[L+13]=M,this.float32[L+14]=A,this.float32[L+15]=S,this.float32[L+16]=E,t},e}(wa);Na.prototype.bytesPerElement=68,Dn("StructArrayLayout8i15ui1ul4f68",Na);var ja=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(wa);ja.prototype.bytesPerElement=4,Dn("StructArrayLayout1f4",ja);var Ua=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var a=3*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,t},e}(wa);Ua.prototype.bytesPerElement=6,Dn("StructArrayLayout3i6",Ua);var Va=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var a=4*t;return this.uint32[2*t+0]=e,this.uint16[a+2]=r,this.uint16[a+3]=n,t},e}(wa);Va.prototype.bytesPerElement=8,Dn("StructArrayLayout1ul2ui8",Va);var qa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(wa);qa.prototype.bytesPerElement=4,Dn("StructArrayLayout2ui4",qa);var Ha=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(wa);Ha.prototype.bytesPerElement=2,Dn("StructArrayLayout1ui2",Ha);var Ga=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(wa);Ga.prototype.bytesPerElement=8,Dn("StructArrayLayout2f8",Ga);var Ya=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,a){var i=4*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,this.float32[i+3]=a,t},e}(wa);Ya.prototype.bytesPerElement=16,Dn("StructArrayLayout4f16",Ya);var Wa=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new a(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(_a);Wa.prototype.size=20;var Za=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Wa(this,t)},e}(za);Dn("CollisionBoxArray",Za);var Xa=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(_a);Xa.prototype.size=48;var Ja=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Xa(this,t)},e}(Ba);Dn("PlacedSymbolArray",Ja);var Ka=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(_a);Ka.prototype.size=68;var Qa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ka(this,t)},e}(Na);Dn("SymbolInstanceArray",Qa);var $a=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(ja);Dn("GlyphOffsetArray",$a);var ti=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(Ua);Dn("SymbolLineVertexArray",ti);var ei=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(_a);ei.prototype.size=8;var ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new ei(this,t)},e}(Va);Dn("FeatureIndexArray",ri);var ni=Ta([{name:"a_pos",components:2,type:"Int16"}],4).members,ai=function(t){void 0===t&&(t=[]),this.segments=t};function ii(t,e){return 256*(t=l(Math.floor(t),0,255))+l(Math.floor(e),0,255)}ai.prototype.prepareSegment=function(t,e,r,n){var a=this.segments[this.segments.length-1];return t>ai.MAX_VERTEX_ARRAY_LENGTH&&_("Max vertices per segment is "+ai.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!a||a.vertexLength+t>ai.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n)&&(a={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(a.sortKey=n),this.segments.push(a)),a},ai.prototype.get=function(){return this.segments},ai.prototype.destroy=function(){for(var t=0,e=this.segments;t>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:a^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return a^=t.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}})),li=e((function(t){t.exports=function(t,e){for(var r,n=t.length,a=e^n,i=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(i)|(255&t.charCodeAt(++i))<<8|(255&t.charCodeAt(++i))<<16|(255&t.charCodeAt(++i))<<24))+((1540483477*(r>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++i;switch(n){case 3:a^=(255&t.charCodeAt(i+2))<<16;case 2:a^=(255&t.charCodeAt(i+1))<<8;case 1:a=1540483477*(65535&(a^=255&t.charCodeAt(i)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}})),ci=si,ui=li;ci.murmur3=si,ci.murmur2=ui;var hi=function(){this.ids=[],this.positions=[],this.indexed=!1};hi.prototype.add=function(t,e,r,n){this.ids.push(pi(t)),this.positions.push(e,r,n)},hi.prototype.getPositions=function(t){for(var e=pi(t),r=0,n=this.ids.length-1;r>1;this.ids[a]>=e?n=a:r=a+1}for(var i=[];this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i},hi.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,a){for(;n>1],o=n-1,s=a+1;;){do{o++}while(e[o]i);if(o>=s)break;di(e,o,s),di(r,3*o,3*s),di(r,3*o+1,3*s+1),di(r,3*o+2,3*s+2)}s-nOi.max||o.yOi.max)&&(_("Geometry exceeds allowed extent, reduce your vector tile buffer size"),o.x=l(o.x,Oi.min,Oi.max),o.y=l(o.y,Oi.min,Oi.max))}return r}function Ri(t,e,r,n,a){t.emplaceBack(2*e+(n+1)/2,2*r+(a+1)/2)}var Fi=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ma,this.indexArray=new Fa,this.segments=new ai,this.programConfigurations=new Pi(ni,t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Bi(t,e){for(var r=0;r1){if(Vi(t,e))return!0;for(var n=0;n1?r:r.sub(e)._mult(a)._add(e))}function Yi(t,e){for(var r,n,a,i=!1,o=0;oe.y!=(a=r[l]).y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i);return i}function Wi(t,e){for(var r=!1,n=0,a=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function Zi(t,e,r){var n=r[0],a=r[2];if(t.xa.x&&e.x>a.x||t.ya.y&&e.y>a.y)return!1;var i=w(t,e,r[0]);return i!==w(t,e,r[1])||i!==w(t,e,r[2])||i!==w(t,e,r[3])}function Xi(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ji(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ki(t,e,r,n,i){if(!e[0]&&!e[1])return t;var o=a.convert(e)._mult(i);"viewport"===r&&o._rotate(-n);for(var s=[],l=0;l=8192||u<0||u>=8192)){var h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),f=h.vertexLength;Ri(this.layoutVertexArray,c,u,-1,-1),Ri(this.layoutVertexArray,c,u,1,-1),Ri(this.layoutVertexArray,c,u,1,1),Ri(this.layoutVertexArray,c,u,-1,1),this.indexArray.emplaceBack(f,f+1,f+2),this.indexArray.emplaceBack(f,f+3,f+2),h.vertexLength+=4,h.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)},Dn("CircleBucket",Fi,{omit:["layers"]});var Qi=new ya({"circle-sort-key":new da(At.layout_circle["circle-sort-key"])}),$i={paint:new ya({"circle-radius":new da(At.paint_circle["circle-radius"]),"circle-color":new da(At.paint_circle["circle-color"]),"circle-blur":new da(At.paint_circle["circle-blur"]),"circle-opacity":new da(At.paint_circle["circle-opacity"]),"circle-translate":new pa(At.paint_circle["circle-translate"]),"circle-translate-anchor":new pa(At.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new pa(At.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new pa(At.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new da(At.paint_circle["circle-stroke-width"]),"circle-stroke-color":new da(At.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new da(At.paint_circle["circle-stroke-opacity"])}),layout:Qi},to="undefined"!=typeof Float32Array?Float32Array:Array;function eo(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ro(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],p=e[10],d=e[11],g=e[12],m=e[13],v=e[14],y=e[15],x=r[0],b=r[1],_=r[2],w=r[3];return t[0]=x*n+b*s+_*h+w*g,t[1]=x*a+b*l+_*f+w*m,t[2]=x*i+b*c+_*p+w*v,t[3]=x*o+b*u+_*d+w*y,t[4]=(x=r[4])*n+(b=r[5])*s+(_=r[6])*h+(w=r[7])*g,t[5]=x*a+b*l+_*f+w*m,t[6]=x*i+b*c+_*p+w*v,t[7]=x*o+b*u+_*d+w*y,t[8]=(x=r[8])*n+(b=r[9])*s+(_=r[10])*h+(w=r[11])*g,t[9]=x*a+b*l+_*f+w*m,t[10]=x*i+b*c+_*p+w*v,t[11]=x*o+b*u+_*d+w*y,t[12]=(x=r[12])*n+(b=r[13])*s+(_=r[14])*h+(w=r[15])*g,t[13]=x*a+b*l+_*f+w*m,t[14]=x*i+b*c+_*p+w*v,t[15]=x*o+b*u+_*d+w*y,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var no,ao=ro;function io(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o,t}no=new to(3),to!=Float32Array&&(no[0]=0,no[1]=0,no[2]=0),function(){var t=new to(4);to!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var oo=(function(){var t=new to(2);to!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,$i)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Fi(t)},e.prototype.queryRadius=function(t){var e=t;return Xi("circle-radius",this,e)+Xi("circle-stroke-width",this,e)+Ji(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,a,i,o,s){for(var l=Ki(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),i.angle,o),c=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),u="map"===this.paint.get("circle-pitch-alignment"),h=u?l:function(t,e){return t.map((function(t){return so(t,e)}))}(l,s),f=u?c*o:c,p=0,d=n;pt.width||a.height>t.height||r.x>t.width-a.width||r.y>t.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||n.x>e.width-a.width||n.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,l=0;l80*r){n=i=t[0],a=o=t[1];for(var d=r;di&&(i=s),l>o&&(o=l);c=0!==(c=Math.max(i-n,o-a))?1/c:0}return Ao(f,p,r,n,a,c),p}function ko(t,e,r,n,a){var i,o;if(a===Zo(t,e,r,n)>0)for(i=e;i=e;i-=n)o=Go(i,t[i],t[i+1],o);return o&&No(o,o.next)&&(Yo(o),o=o.next),o}function Mo(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!No(n,n.next)&&0!==Bo(n.prev,n,n.next))n=n.next;else{if(Yo(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function Ao(t,e,r,n,a,i,o){if(t){!o&&i&&function(t,e,r,n){var a=t;do{null===a.z&&(a.z=Oo(a.x,a.y,e,r,n)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==t);a.prevZ.nextZ=null,a.prevZ=null,function(t){var e,r,n,a,i,o,s,l,c=1;do{for(r=t,t=null,i=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(a=r,r=r.nextZ,s--):(a=n,n=n.nextZ,l--),i?i.nextZ=a:t=a,a.prevZ=i,i=a;r=n}i.nextZ=null,c*=2}while(o>1)}(a)}(t,n,a,i);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,i?Eo(t,n,a,i):So(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),Yo(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?Ao(t=Co(Mo(t),e,r),e,r,n,a,i,2):2===o&&Lo(t,e,r,n,a,i):Ao(Mo(t),e,r,n,a,i,1);break}}}function So(t){var e=t.prev,r=t,n=t.next;if(Bo(e,r,n)>=0)return!1;for(var a=t.next.next;a!==t.prev;){if(Ro(e.x,e.y,r.x,r.y,n.x,n.y,a.x,a.y)&&Bo(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function Eo(t,e,r,n){var a=t.prev,i=t,o=t.next;if(Bo(a,i,o)>=0)return!1;for(var s=a.x>i.x?a.x>o.x?a.x:o.x:i.x>o.x?i.x:o.x,l=a.y>i.y?a.y>o.y?a.y:o.y:i.y>o.y?i.y:o.y,c=Oo(a.x=c&&f&&f.z<=u;){if(h!==t.prev&&h!==t.next&&Ro(a.x,a.y,i.x,i.y,o.x,o.y,h.x,h.y)&&Bo(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,f!==t.prev&&f!==t.next&&Ro(a.x,a.y,i.x,i.y,o.x,o.y,f.x,f.y)&&Bo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;h&&h.z>=c;){if(h!==t.prev&&h!==t.next&&Ro(a.x,a.y,i.x,i.y,o.x,o.y,h.x,h.y)&&Bo(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;f&&f.z<=u;){if(f!==t.prev&&f!==t.next&&Ro(a.x,a.y,i.x,i.y,o.x,o.y,f.x,f.y)&&Bo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Co(t,e,r){var n=t;do{var a=n.prev,i=n.next.next;!No(a,i)&&jo(a,n,n.next,i)&&qo(a,i)&&qo(i,a)&&(e.push(a.i/r),e.push(n.i/r),e.push(i.i/r),Yo(n),Yo(n.next),n=t=i),n=n.next}while(n!==t);return Mo(n)}function Lo(t,e,r,n,a,i){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Fo(o,s)){var l=Ho(o,s);return o=Mo(o,o.next),l=Mo(l,l.next),Ao(o,e,r,n,a,i),void Ao(l,e,r,n,a,i)}s=s.next}o=o.next}while(o!==t)}function Po(t,e){return t.x-e.x}function Io(t,e){if(e=function(t,e){var r,n=e,a=t.x,i=t.y,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=a&&s>o){if(o=s,s===a){if(i===n.y)return n;if(i===n.next.y)return n.next}r=n.x=n.x&&n.x>=u&&a!==n.x&&Ro(ir.x||n.x===r.x&&zo(r,n)))&&(r=n,f=l)),n=n.next}while(n!==c);return r}(t,e)){var r=Ho(e,t);Mo(e,e.next),Mo(r,r.next)}}function zo(t,e){return Bo(t.prev,t,e.prev)<0&&Bo(e.next,t,t.next)<0}function Oo(t,e,r,n,a){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*a)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*a)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Do(t){var e=t,r=t;do{(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(i-s)-(a-o)*(n-s)>=0}function Fo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&jo(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(qo(t,e)&&qo(e,t)&&function(t,e){var r=t,n=!1,a=(t.x+e.x)/2,i=(t.y+e.y)/2;do{r.y>i!=r.next.y>i&&r.next.y!==r.y&&a<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Bo(t.prev,t,e.prev)||Bo(t,e.prev,e))||No(t,e)&&Bo(t.prev,t,t.next)>0&&Bo(e.prev,e,e.next)>0)}function Bo(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function No(t,e){return t.x===e.x&&t.y===e.y}function jo(t,e,r,n){var a=Vo(Bo(t,e,r)),i=Vo(Bo(t,e,n)),o=Vo(Bo(r,n,t)),s=Vo(Bo(r,n,e));return a!==i&&o!==s||!(0!==a||!Uo(t,r,e))||!(0!==i||!Uo(t,n,e))||!(0!==o||!Uo(r,t,n))||!(0!==s||!Uo(r,e,n))}function Uo(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Vo(t){return t>0?1:t<0?-1:0}function qo(t,e){return Bo(t.prev,t,t.next)<0?Bo(t,e,t.next)>=0&&Bo(t,t.prev,e)>=0:Bo(t,e,t.prev)<0||Bo(t,t.next,e)<0}function Ho(t,e){var r=new Wo(t.i,t.x,t.y),n=new Wo(e.i,e.x,e.y),a=t.next,i=e.prev;return t.next=e,e.prev=t,r.next=a,a.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function Go(t,e,r,n){var a=new Wo(t,e,r);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function Yo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Wo(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Zo(t,e,r,n){for(var a=0,i=e,o=r-n;in;){if(a-n>600){var o=a-n+1,s=r-n+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*c/o+u)),Math.min(a,Math.floor(r+(o-s)*c/o+u)),i)}var h=e[r],f=n,p=a;for(Jo(e,n,r),i(e[a],h)>0&&Jo(e,n,a);f0;)p--}0===i(e[n],h)?Jo(e,n,p):Jo(e,++p,a),p<=r&&(n=p+1),r<=p&&(a=p-1)}}(t,e,r||0,n||t.length-1,a||Ko)}function Jo(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Ko(t,e){return te?1:0}function Qo(t,e){var r=t.length;if(r<=1)return[t];for(var n,a,i=[],o=0;o1)for(var l=0;l0&&r.holes.push(n+=t[a-1].length)}return r},_o.default=wo;var rs=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ma,this.indexArray=new Fa,this.indexArray2=new qa,this.programConfigurations=new Pi(bo,t.layers,t.zoom),this.segments=new ai,this.segments2=new ai,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};rs.prototype.populate=function(t,e,r){this.hasPattern=ts("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),a=[],i=0,o=t;i>3}if(i--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&l.push(e),e=[]),e.push(new a(o,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&l.push(e),l},ls.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,a=0,i=0,o=1/0,s=-1/0,l=1/0,c=-1/0;t.pos>3}if(n--,1===r||2===r)(a+=t.readSVarint())s&&(s=a),(i+=t.readSVarint())c&&(c=i);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,c]},ls.prototype.toGeoJSON=function(t,e,r){var n,a,i=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,l=this.loadGeometry(),c=ls.types[this.type];function u(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function ds(t,e,r){if(3===t){var n=new hs(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}fs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ss(this._pbf,e,this.extent,this._keys,this._values)};var gs={VectorTile:function(t,e){this.layers=t.readFields(ds,{},e)},VectorTileFeature:ss,VectorTileLayer:hs},ms=gs.VectorTileFeature.types,vs=Math.pow(2,13);function ys(t,e,r,n,a,i,o,s){t.emplaceBack(e,r,2*Math.floor(n*vs)+o,a*vs*2,i*vs*2,Math.round(s))}var xs=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Sa,this.indexArray=new Fa,this.programConfigurations=new Pi(os,t.layers,t.zoom),this.segments=new ai,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function bs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}xs.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=ts("fill-extrusion",this.layers,e);for(var n=0,a=t;n8192}))||I.every((function(t){return t.y<0}))||I.every((function(t){return t.y>8192}))))for(var g=0,m=0;m=1){var y=d[m-1];if(!bs(v,y)){h.vertexLength+4>ai.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var x=v.sub(y)._perp()._unit(),b=y.dist(v);g+b>32768&&(g=0),ys(this.layoutVertexArray,v.x,v.y,x.x,x.y,0,0,g),ys(this.layoutVertexArray,v.x,v.y,x.x,x.y,0,1,g),ys(this.layoutVertexArray,y.x,y.y,x.x,x.y,0,0,g+=b),ys(this.layoutVertexArray,y.x,y.y,x.x,x.y,0,1,g);var _=h.vertexLength;this.indexArray.emplaceBack(_,_+2,_+1),this.indexArray.emplaceBack(_+1,_+2,_+3),h.vertexLength+=4,h.primitiveLength+=2}}}}if(h.vertexLength+l>ai.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),"Polygon"===ms[t.type]){for(var w=[],T=[],k=h.vertexLength,M=0,A=s;M=2&&t[l-1].equals(t[l-2]);)l--;for(var c=0;c0;if(T&&v>c){var M=u.dist(p);if(M>2*h){var A=u.sub(u.sub(p)._mult(h/M)._round());this.updateDistance(p,A),this.addCurrentVertex(A,g,0,0,f),p=A}}var S=p&&d,E=S?r:s?"butt":n;if(S&&"round"===E&&(_a&&(E="bevel"),"bevel"===E&&(_>2&&(E="flipbevel"),_100)y=m.mult(-1);else{var C=_*g.add(m).mag()/g.sub(m).mag();y._perp()._mult(C*(k?-1:1))}this.addCurrentVertex(u,y,0,0,f),this.addCurrentVertex(u,y.mult(-1),0,0,f)}else if("bevel"===E||"fakeround"===E){var L=-Math.sqrt(_*_-1),P=k?L:0,I=k?0:L;if(p&&this.addCurrentVertex(u,g,P,I,f),"fakeround"===E)for(var z=Math.round(180*w/Math.PI/20),O=1;O2*h){var j=u.add(d.sub(u)._mult(h/N)._round());this.updateDistance(u,j),this.addCurrentVertex(j,m,0,0,f),u=j}}}}},Cs.prototype.addCurrentVertex=function(t,e,r,n,a,i){void 0===i&&(i=!1);var o=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,i,!1,r,a),this.addHalfVertex(t,o,s,i,!0,-n,a),this.distance>Es/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,a,i))},Cs.prototype.addHalfVertex=function(t,e,r,n,a,i,o){var s=.5*this.scaledDistance;this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(a?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===i?0:i<0?-1:1)|(63&s)<<2,s>>6);var l=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),o.primitiveLength++),a?this.e2=l:this.e1=l},Cs.prototype.updateScaledDistance=function(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(Es-1):this.distance},Cs.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},Dn("LineBucket",Cs,{omit:["layers","patternFeatures"]});var Ls=new ya({"line-cap":new pa(At.layout_line["line-cap"]),"line-join":new da(At.layout_line["line-join"]),"line-miter-limit":new pa(At.layout_line["line-miter-limit"]),"line-round-limit":new pa(At.layout_line["line-round-limit"]),"line-sort-key":new da(At.layout_line["line-sort-key"])}),Ps={paint:new ya({"line-opacity":new da(At.paint_line["line-opacity"]),"line-color":new da(At.paint_line["line-color"]),"line-translate":new pa(At.paint_line["line-translate"]),"line-translate-anchor":new pa(At.paint_line["line-translate-anchor"]),"line-width":new da(At.paint_line["line-width"]),"line-gap-width":new da(At.paint_line["line-gap-width"]),"line-offset":new da(At.paint_line["line-offset"]),"line-blur":new da(At.paint_line["line-blur"]),"line-dasharray":new ma(At.paint_line["line-dasharray"]),"line-pattern":new ga(At.paint_line["line-pattern"]),"line-gradient":new va(At.paint_line["line-gradient"])}),layout:Ls},Is=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new aa(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,a){return r=u({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,a)},e}(da))(Ps.paint.properties["line-width"].specification);Is.useIntegerZoom=!0;var zs=function(t){function e(e){t.call(this,e,Ps)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){this.gradient=mo(this._transitionablePaint._values["line-gradient"].value.expression,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=Is.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Cs(t)},e.prototype.queryRadius=function(t){var e=t,r=Os(Xi("line-width",this,e),Xi("line-gap-width",this,e)),n=Xi("line-offset",this,e);return r/2+Math.abs(n)+Ji(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,s){var l=Ki(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),c=s/2*Os(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(n=function(t,e){for(var r=[],n=new a(0,0),i=0;i=3)for(var i=0;i0?e+2*t:t}var Ds=Ta([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Rs=Ta([{name:"a_projected_pos",components:3,type:"Float32"}],4),Fs=(Ta([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Ta([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Bs=(Ta([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ta([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Ns=Ta([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function js(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),na.applyArabicShaping&&(t=na.applyArabicShaping(t)),t}(t.text,e,r)})),t}Ta([{name:"triangle",components:3,type:"Uint16"}]),Ta([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ta([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ta([{type:"Float32",name:"offsetX"}]),Ta([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Us={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"},Vs=function(t,e,r,n,a){var i,o,s=8*a-n-1,l=(1<>1,u=-7,h=r?a-1:0,f=r?-1:1,p=t[e+h];for(h+=f,i=p&(1<<-u)-1,p>>=-u,u+=s;u>0;i=256*i+t[e+h],h+=f,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=n;u>0;o=256*o+t[e+h],h+=f,u-=8);if(0===i)i=1-c;else{if(i===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),i-=c}return(p?-1:1)*o*Math.pow(2,i-n)},qs=function(t,e,r,n,a,i){var o,s,l,c=8*i-a-1,u=(1<>1,f=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=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=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(e*l-1)*Math.pow(2,a),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,a),o=0));a>=8;t[r+p]=255&s,p+=d,s/=256,a-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*g},Hs=Gs;function Gs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Gs.Varint=0,Gs.Fixed64=1,Gs.Bytes=2,Gs.Fixed32=5;var Ys="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Ws(t){return t.type===Gs.Bytes?t.readVarint()+t.pos:t.pos+1}function Zs(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Xs(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var a=r.pos-1;a>=t;a--)r.buf[a+n]=r.buf[a]}function Js(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function sl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ll(t,e,r){1===t&&r.readMessage(cl,e)}function cl(t,e,r){if(3===t){var n=r.readMessage(ul,{}),a=n.width,i=n.height,o=n.left,s=n.top,l=n.advance;e.push({id:n.id,bitmap:new fo({width:a+6,height:i+6},n.bitmap),metrics:{width:a,height:i,left:o,top:s,advance:l}})}}function ul(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function hl(t){for(var e=0,r=0,n=0,a=t;n=0;f--){var p=o[f];if(!(h.w>p.w||h.h>p.h)){if(h.x=p.x,h.y=p.y,l=Math.max(l,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===p.w&&h.h===p.h){var d=o.pop();f>3,i=this.pos;this.type=7&n,t(a,e,this),this.pos===i&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=il(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=sl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=il(this.buf,this.pos)+4294967296*il(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=il(this.buf,this.pos)+4294967296*sl(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Vs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Vs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,a,i=r.buf;if(n=(112&(a=i[r.pos++]))>>4,a<128)return Zs(t,n,e);if(n|=(127&(a=i[r.pos++]))<<3,a<128)return Zs(t,n,e);if(n|=(127&(a=i[r.pos++]))<<10,a<128)return Zs(t,n,e);if(n|=(127&(a=i[r.pos++]))<<17,a<128)return Zs(t,n,e);if(n|=(127&(a=i[r.pos++]))<<24,a<128)return Zs(t,n,e);if(n|=(1&(a=i[r.pos++]))<<31,a<128)return Zs(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ys?function(t,e,r){return Ys.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",a=e;a239?4:l>223?3:l>191?2:1;if(a+u>r)break;1===u?l<128&&(c=l):2===u?128==(192&(i=t[a+1]))&&(c=(31&l)<<6|63&i)<=127&&(c=null):3===u?(o=t[a+2],128==(192&(i=t[a+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&i)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(o=t[a+2],s=t[a+3],128==(192&(i=t[a+1]))&&128==(192&o)&&128==(192&s)&&((c=(15&l)<<18|(63&i)<<12|(63&o)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),a+=u}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Gs.Bytes)return t.push(this.readVarint(e));var r=Ws(this);for(t=t||[];this.pos127;);else if(e===Gs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Gs.Fixed32)this.pos+=4;else{if(e!==Gs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,a,i=0;i55295&&n<57344){if(!a){n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else a&&(t[r++]=239,t[r++]=191,t[r++]=189,a=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Xs(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),qs(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),qs(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Xs(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Gs.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Js,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Ks,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Qs,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,$s,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,al,e)},writeBytesField:function(t,e){this.writeTag(t,Gs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Gs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Gs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Gs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Gs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Gs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Gs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Gs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Gs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Gs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var fl=function(t,e){var r=e.pixelRatio,n=e.version,a=e.stretchX,i=e.stretchY,o=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=a,this.stretchY=i,this.content=o,this.version=n},pl={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};pl.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},pl.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},pl.tlbr.get=function(){return this.tl.concat(this.br)},pl.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(fl.prototype,pl);var dl=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var a=[];this.addImages(t,r,a),this.addImages(e,n,a);var i=hl(a),o=new po({width:i.w||1,height:i.h||1});for(var s in t){var l=t[s],c=r[s].paddedRect;po.copy(l.data,o,{x:0,y:0},{x:c.x+1,y:c.y+1},l.data)}for(var u in e){var h=e[u],f=n[u].paddedRect,p=f.x+1,d=f.y+1,g=h.data.width,m=h.data.height;po.copy(h.data,o,{x:0,y:0},{x:p,y:d},h.data),po.copy(h.data,o,{x:0,y:m-1},{x:p,y:d-1},{width:g,height:1}),po.copy(h.data,o,{x:0,y:0},{x:p,y:d+m},{width:g,height:1}),po.copy(h.data,o,{x:g-1,y:0},{x:p-1,y:d},{width:1,height:m}),po.copy(h.data,o,{x:0,y:0},{x:p+g,y:d},{width:1,height:m})}this.image=o,this.iconPositions=r,this.patternPositions=n};dl.prototype.addImages=function(t,e,r){for(var n in t){var a=t[n],i={x:0,y:0,w:a.data.width+2,h:a.data.height+2};r.push(i),e[n]=new fl(i,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},dl.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},dl.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]})}},Dn("ImagePosition",fl),Dn("ImageAtlas",dl);var gl={horizontal:1,vertical:2,horizontalOnly:3},ml=function(){this.scale=1,this.fontStack="",this.imageName=null};ml.forText=function(t,e){var r=new ml;return r.scale=t||1,r.fontStack=e,r},ml.forImage=function(t){var e=new ml;return e.imageName=t,e};var vl=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function yl(t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g){var m,v=vl.fromFeature(t,a);h===gl.vertical&&v.verticalizePunctuation();var y=na.processBidirectionalText,x=na.processStyledBidirectionalText;if(y&&1===v.sections.length){m=[];for(var b=0,_=y(v.toString(),Ml(v,c,i,e,n,p,d));b<_.length;b+=1){var w=_[b],T=new vl;T.text=w,T.sections=v.sections;for(var k=0;k0&&B>M&&(M=B)}else{var N=r[S.fontStack],j=N&&N[C];if(j&&j.rect)I=j.rect,P=j.metrics;else{var U=e[S.fontStack],V=U&&U[C];if(!V)continue;P=V.metrics}L=24*(_-S.scale)}D?(t.verticalizable=!0,k.push({glyph:C,imageName:z,x:f,y:p+L,vertical:D,scale:S.scale,fontStack:S.fontStack,sectionIndex:E,metrics:P,rect:I}),f+=O*S.scale+c):(k.push({glyph:C,imageName:z,x:f,y:p+L,vertical:D,scale:S.scale,fontStack:S.fontStack,sectionIndex:E,metrics:P,rect:I}),f+=P.advance*S.scale+c)}0!==k.length&&(d=Math.max(f-c,d),Sl(k,0,k.length-1,m,M)),f=0;var q=i*_+M;T.lineOffset=Math.max(M,w),p+=q,g=Math.max(q,g),++v}else p+=i,++v}var H,G=p- -17,Y=Al(o),W=Y.horizontalAlign,Z=Y.verticalAlign;(function(t,e,r,n,a,i,o,s,l){var c,u=(e-r)*a;c=i!==o?-s*n- -17:(-n*l+.5)*o;for(var h=0,f=t;h=0&&n>=t&&xl[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},vl.prototype.substring=function(t,e){var r=new vl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},vl.prototype.toString=function(){return this.text},vl.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},vl.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(ml.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var xl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},bl={};function _l(t,e,r,n,a,i){if(e.imageName){var o=n[e.imageName];return o?o.displaySize[0]*e.scale*24/i+a:0}var s=r[e.fontStack],l=s&&s[t];return l?l.metrics.advance*e.scale+a:0}function wl(t,e,r,n){var a=Math.pow(t-e,2);return n?t=0,h=0,f=0;f-r/2;){if(--o<0)return!1;s-=t[o].dist(i),i=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],c=0;sn;)c-=l.shift().angleDelta;if(c>a)return!1;o++,s+=u.dist(h)}return!0}function Dl(t){for(var e=0,r=0;rc){var d=(c-l)/p,g=Ue(h.x,f.x,d),m=Ue(h.y,f.y,d),v=new Cl(g,m,f.angleTo(h),u);return v._round(),!o||Ol(t,v,s,o,e)?v:void 0}l+=p}}function Nl(t,e,r,n,a,i,o,s,l){var c=Rl(n,i,o),u=Fl(n,a),h=u*o,f=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&_=0&&w=0&&p+u<=h){var T=new Cl(_,w,x,g);T._round(),a&&!Ol(e,T,o,a,i)||d.push(T)}}f+=y}return l||d.length||s||(d=t(e,f/2,n,a,i,o,s,!0,c)),d}(t,f?e/2*s%e:(u/2+2*i)*o*s%e,e,c,r,h,f,!1,l)}function jl(t,e,r,n,i){for(var o=[],s=0;s=n&&f.x>=n||(h.x>=n?h=new a(n,h.y+(n-h.x)/(f.x-h.x)*(f.y-h.y))._round():f.x>=n&&(f=new a(n,h.y+(n-h.x)/(f.x-h.x)*(f.y-h.y))._round()),h.y>=i&&f.y>=i||(h.y>=i?h=new a(h.x+(i-h.y)/(f.y-h.y)*(f.x-h.x),i)._round():f.y>=i&&(f=new a(h.x+(i-h.y)/(f.y-h.y)*(f.x-h.x),i)._round()),c&&h.equals(c[c.length-1])||o.push(c=[h]),c.push(f)))))}return o}function Ul(t,e,r,n){var i=[],o=t.image,s=o.pixelRatio,l=o.paddedRect.w-2,c=o.paddedRect.h-2,u=t.right-t.left,h=t.bottom-t.top,f=o.stretchX||[[0,l]],p=o.stretchY||[[0,c]],d=function(t,e){return t+e[1]-e[0]},g=f.reduce(d,0),m=p.reduce(d,0),v=l-g,y=c-m,x=0,b=g,_=0,w=m,T=0,k=v,M=0,A=y;if(o.content&&n){var S=o.content;x=Vl(f,0,S[0]),_=Vl(p,0,S[1]),b=Vl(f,S[0],S[2]),w=Vl(p,S[1],S[3]),T=S[0]-x,M=S[1]-_,k=S[2]-S[0]-b,A=S[3]-S[1]-w}var E=function(n,i,l,c){var f=Hl(n.stretch-x,b,u,t.left),p=Gl(n.fixed-T,k,n.stretch,g),d=Hl(i.stretch-_,w,h,t.top),v=Gl(i.fixed-M,A,i.stretch,m),y=Hl(l.stretch-x,b,u,t.left),S=Gl(l.fixed-T,k,l.stretch,g),E=Hl(c.stretch-_,w,h,t.top),C=Gl(c.fixed-M,A,c.stretch,m),L=new a(f,d),P=new a(y,d),I=new a(y,E),z=new a(f,E),O=new a(p/s,v/s),D=new a(S/s,C/s),R=e*Math.PI/180;if(R){var F=Math.sin(R),B=Math.cos(R),N=[B,-F,F,B];L._matMult(N),P._matMult(N),z._matMult(N),I._matMult(N)}var j=n.stretch+n.fixed,U=i.stretch+i.fixed;return{tl:L,tr:P,bl:z,br:I,tex:{x:o.paddedRect.x+1+j,y:o.paddedRect.y+1+U,w:l.stretch+l.fixed-j,h:c.stretch+c.fixed-U},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:O,pixelOffsetBR:D,minFontScaleX:k/s/u,minFontScaleY:A/s/h,isSDF:r}};if(n&&(o.stretchX||o.stretchY))for(var C=ql(f,v,g),L=ql(p,y,m),P=0;P0&&(d=Math.max(10,d),this.circleDiameter=d)}else{var g=o.top*s-l,m=o.bottom*s+l,v=o.left*s-l,y=o.right*s+l,x=o.collisionPadding;if(x&&(v-=x[0]*s,g-=x[1]*s,y+=x[2]*s,m+=x[3]*s),u){var b=new a(v,g),_=new a(y,g),w=new a(v,m),T=new a(y,m),k=u*Math.PI/180;b._rotate(k),_._rotate(k),w._rotate(k),T._rotate(k),v=Math.min(b.x,_.x,w.x,T.x),y=Math.max(b.x,_.x,w.x,T.x),g=Math.min(b.y,_.y,w.y,T.y),m=Math.max(b.y,_.y,w.y,T.y)}t.emplaceBack(e.x,e.y,v,g,y,m,r,n,i)}this.boxEndIndex=t.length},Wl=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=Zl),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function Zl(t,e){return te?1:0}function Xl(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,i=1/0,o=-1/0,s=-1/0,l=t[0],c=0;co)&&(o=u.x),(!c||u.y>s)&&(s=u.y)}var h=Math.min(o-n,s-i),f=h/2,p=new Wl([],Jl);if(0===h)return new a(n,i);for(var d=n;dm.d||!m.d)&&(m=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,v)),y.max-m.d<=e||(p.push(new Kl(y.p.x-(f=y.h/2),y.p.y-f,f,t)),p.push(new Kl(y.p.x+f,y.p.y-f,f,t)),p.push(new Kl(y.p.x-f,y.p.y+f,f,t)),p.push(new Kl(y.p.x+f,y.p.y+f,f,t)),v+=4)}return r&&(console.log("num probes: "+v),console.log("best distance: "+m.d)),m.p}function Jl(t,e){return e.max-t.max}function Kl(t,e,r,n){this.p=new a(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,a=0;at.y!=u.y>t.y&&t.x<(u.x-c.x)*(t.y-c.y)/(u.y-c.y)+c.x&&(r=!r),n=Math.min(n,Gi(t,c,u))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}Wl.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},Wl.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},Wl.prototype.peek=function(){return this.data[0]},Wl.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var a=t-1>>1,i=e[a];if(r(n,i)>=0)break;e[t]=i,t=a}e[t]=n},Wl.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,a=e[t];t=0)break;e[t]=o,t=i}e[t]=a};var Ql=Number.POSITIVE_INFINITY;function $l(t,e){return e[1]!==Ql?function(t,e,r){var n=0,a=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":a=r-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,a]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var a=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=a-7;break;case"bottom-right":case"bottom-left":n=7-a;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-a;break;case"top-left":case"bottom-left":r=a;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function tc(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function ec(t,e,r,n,i,o,s,l,c,u,h,f,p,d,g){var m=function(t,e,r,n,i,o,s,l){for(var c=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[],h=0,f=e.positionedLines;h32640&&_(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===v.kind&&((y=[128*d.compositeTextSizes[0].evaluate(s,{},g),128*d.compositeTextSizes[1].evaluate(s,{},g)])[0]>32640||y[1]>32640)&&_(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,m,y,l,o,s,u,e,c.lineStartIndex,c.lineLength,p,g);for(var x=0,b=h;x=0;o--)if(n.dist(i[o])0)&&("constant"!==i.value.kind||i.value.value.length>0),c="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,u=a.get("symbol-sort-key");if(this.features=[],l||c){for(var h=e.iconDependencies,f=e.glyphDependencies,p=e.availableImages,d=new aa(this.zoom),g=0,m=t;g=0;for(var z=0,O=k.sections;z=0;s--)i[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:a},s>0&&(a+=e[s-1].dist(e[s]));for(var l=0;l0},hc.prototype.hasIconData=function(){return this.icon.segments.get().length>0},hc.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},hc.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},hc.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},hc.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,a=r.vertexStartIndex;a1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Dn("SymbolBucket",hc,{omit:["layers","collisionBoxArray","features","compareText"]}),hc.MAX_GLYPHS=65535,hc.addDynamicAttributes=sc;var fc=new ya({"symbol-placement":new pa(At.layout_symbol["symbol-placement"]),"symbol-spacing":new pa(At.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new pa(At.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new da(At.layout_symbol["symbol-sort-key"]),"symbol-z-order":new pa(At.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new pa(At.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new pa(At.layout_symbol["icon-ignore-placement"]),"icon-optional":new pa(At.layout_symbol["icon-optional"]),"icon-rotation-alignment":new pa(At.layout_symbol["icon-rotation-alignment"]),"icon-size":new da(At.layout_symbol["icon-size"]),"icon-text-fit":new pa(At.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new pa(At.layout_symbol["icon-text-fit-padding"]),"icon-image":new da(At.layout_symbol["icon-image"]),"icon-rotate":new da(At.layout_symbol["icon-rotate"]),"icon-padding":new pa(At.layout_symbol["icon-padding"]),"icon-keep-upright":new pa(At.layout_symbol["icon-keep-upright"]),"icon-offset":new da(At.layout_symbol["icon-offset"]),"icon-anchor":new da(At.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new pa(At.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new pa(At.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new pa(At.layout_symbol["text-rotation-alignment"]),"text-field":new da(At.layout_symbol["text-field"]),"text-font":new da(At.layout_symbol["text-font"]),"text-size":new da(At.layout_symbol["text-size"]),"text-max-width":new da(At.layout_symbol["text-max-width"]),"text-line-height":new pa(At.layout_symbol["text-line-height"]),"text-letter-spacing":new da(At.layout_symbol["text-letter-spacing"]),"text-justify":new da(At.layout_symbol["text-justify"]),"text-radial-offset":new da(At.layout_symbol["text-radial-offset"]),"text-variable-anchor":new pa(At.layout_symbol["text-variable-anchor"]),"text-anchor":new da(At.layout_symbol["text-anchor"]),"text-max-angle":new pa(At.layout_symbol["text-max-angle"]),"text-writing-mode":new pa(At.layout_symbol["text-writing-mode"]),"text-rotate":new da(At.layout_symbol["text-rotate"]),"text-padding":new pa(At.layout_symbol["text-padding"]),"text-keep-upright":new pa(At.layout_symbol["text-keep-upright"]),"text-transform":new da(At.layout_symbol["text-transform"]),"text-offset":new da(At.layout_symbol["text-offset"]),"text-allow-overlap":new pa(At.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new pa(At.layout_symbol["text-ignore-placement"]),"text-optional":new pa(At.layout_symbol["text-optional"])}),pc={paint:new ya({"icon-opacity":new da(At.paint_symbol["icon-opacity"]),"icon-color":new da(At.paint_symbol["icon-color"]),"icon-halo-color":new da(At.paint_symbol["icon-halo-color"]),"icon-halo-width":new da(At.paint_symbol["icon-halo-width"]),"icon-halo-blur":new da(At.paint_symbol["icon-halo-blur"]),"icon-translate":new pa(At.paint_symbol["icon-translate"]),"icon-translate-anchor":new pa(At.paint_symbol["icon-translate-anchor"]),"text-opacity":new da(At.paint_symbol["text-opacity"]),"text-color":new da(At.paint_symbol["text-color"],{runtimeType:Bt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new da(At.paint_symbol["text-halo-color"]),"text-halo-width":new da(At.paint_symbol["text-halo-width"]),"text-halo-blur":new da(At.paint_symbol["text-halo-blur"]),"text-translate":new pa(At.paint_symbol["text-translate"]),"text-translate-anchor":new pa(At.paint_symbol["text-translate-anchor"])}),layout:fc},dc=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Ot,this.defaultValue=t};dc.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},dc.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},dc.prototype.outputDefined=function(){return!1},dc.prototype.serialize=function(){return null},Dn("FormatSectionOverride",dc,{omit:["defaultValue"]});var gc=function(t){function e(e){t.call(this,e,pc)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var a=[],i=0,o=n;i",targetMapId:n,sourceMapId:i.mapId})}}},Cc.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else k()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},Cc.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Cc.prototype.processTask=function(t,e){var r=this;if(""===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(jn(e.error)):n(null,jn(e.data)))}else{var a=!1,i=S(this.globalScope)?void 0:[],o=e.hasCallback?function(e,n){a=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"",sourceMapId:r.mapId,error:e?Nn(e):null,data:Nn(n,i)},i)}:function(t){a=!0},s=null,l=jn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,l,o);else if(this.parent.getWorkerSource){var c=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,c[0],l.source)[c[1]](l,o)}else o(new Error("Could not find function "+e.type));!a&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Cc.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Pc=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Pc.prototype.setNorthEast=function(t){return this._ne=t instanceof Ic?new Ic(t.lng,t.lat):Ic.convert(t),this},Pc.prototype.setSouthWest=function(t){return this._sw=t instanceof Ic?new Ic(t.lng,t.lat):Ic.convert(t),this},Pc.prototype.extend=function(t){var e,r,n=this._sw,a=this._ne;if(t instanceof Ic)e=t,r=t;else{if(!(t instanceof Pc))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Pc.convert(t)):this.extend(Ic.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return n||a?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new Ic(e.lng,e.lat),this._ne=new Ic(r.lng,r.lat)),this},Pc.prototype.getCenter=function(){return new Ic((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Pc.prototype.getSouthWest=function(){return this._sw},Pc.prototype.getNorthEast=function(){return this._ne},Pc.prototype.getNorthWest=function(){return new Ic(this.getWest(),this.getNorth())},Pc.prototype.getSouthEast=function(){return new Ic(this.getEast(),this.getSouth())},Pc.prototype.getWest=function(){return this._sw.lng},Pc.prototype.getSouth=function(){return this._sw.lat},Pc.prototype.getEast=function(){return this._ne.lng},Pc.prototype.getNorth=function(){return this._ne.lat},Pc.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Pc.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Pc.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Pc.prototype.contains=function(t){var e=Ic.convert(t),r=e.lng,n=e.lat,a=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&a},Pc.convert=function(t){return!t||t instanceof Pc?t:new Pc(t)};var Ic=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Ic.prototype.wrap=function(){return new Ic(c(this.lng,-180,180),this.lat)},Ic.prototype.toArray=function(){return[this.lng,this.lat]},Ic.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Ic.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,a=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(a,1))},Ic.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Pc(new Ic(this.lng-r,this.lat-e),new Ic(this.lng+r,this.lat+e))},Ic.convert=function(t){if(t instanceof Ic)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Ic(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Ic(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var zc=2*Math.PI*6371008.8;function Oc(t){return zc*Math.cos(t*Math.PI/180)}function Dc(t){return(180+t)/360}function Rc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Fc(t,e){return t/Oc(e)}function Bc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Nc=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};Nc.fromLngLat=function(t,e){void 0===e&&(e=0);var r=Ic.convert(t);return new Nc(Dc(r.lng),Rc(r.lat),Fc(e,r.lat))},Nc.prototype.toLngLat=function(){return new Ic(360*this.x-180,Bc(this.y))},Nc.prototype.toAltitude=function(){return this.z*Oc(Bc(this.y))},Nc.prototype.meterInMercatorCoordinateUnits=function(){return 1/zc*(t=Bc(this.y),1/Math.cos(t*Math.PI/180));var t};var jc=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=qc(0,t,t,e,r)};jc.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},jc.prototype.url=function(t,e){var r,n,a,i,o,s=(n=this.y,a=this.z,i=Lc(256*(r=this.x),256*(n=Math.pow(2,a)-n-1),a),o=Lc(256*(r+1),256*(n+1),a),i[0]+","+i[1]+","+o[0]+","+o[1]),l=function(t,e,r){for(var n,a="",i=t;i>0;i--)a+=(e&(n=1<this.canonical.z?new Vc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Vc.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?qc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):qc(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Vc.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Vc.prototype.children=function(t){if(this.overscaledZ>=t)return[new Vc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Vc(e,this.wrap,e,r,n),new Vc(e,this.wrap,e,r+1,n),new Vc(e,this.wrap,e,r,n+1),new Vc(e,this.wrap,e,r+1,n+1)]},Vc.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Hc.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Hc.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Hc.prototype.getPixels=function(){return new po({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Hc.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,a=e*this.dim+this.dim,i=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=a-1;break;case 1:a=n+1}switch(r){case-1:i=o-1;break;case 1:o=i+1}for(var s=-e*this.dim,l=-r*this.dim,c=i;c=0&&u[3]>=0&&s.insert(o,u[0],u[1],u[2],u[3])}},Xc.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new gs.VectorTile(new Hs(this.rawTileData)).layers,this.sourceLayerCoder=new Gc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Xc.prototype.query=function(t,e,r,n){var i=this;this.loadVTLayers();for(var o=t.params||{},s=8192/t.tileSize/t.scale,l=rn(o.filter),c=t.queryGeometry,u=t.queryPadding*s,h=Kc(c),f=this.grid.query(h.minX-u,h.minY-u,h.maxX+u,h.maxY+u),p=Kc(t.cameraQueryGeometry),d=0,g=this.grid3D.query(p.minX-u,p.minY-u,p.maxX+u,p.maxY+u,(function(e,r,n,i){return function(t,e,r,n,i){for(var o=0,s=t;o=l.x&&i>=l.y)return!0}var c=[new a(e,r),new a(e,i),new a(n,i),new a(n,r)];if(t.length>2)for(var u=0,h=c;u=0)return!0;return!1}(i,h)){var f=this.sourceLayerCoder.decode(r),p=this.vtLayers[f].feature(n);if(a.filter(new aa(this.tileID.overscaledZ),p))for(var d=this.getId(p,f),g=0;gn)a=!1;else if(e)if(this.expirationTimeot&&(t.getActor().send("enforceCacheSizeLimit",it),ut=0)},t.clamp=l,t.clearTileCache=function(t){var e=self.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=jl,t.clone=function(t){var e=new to(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=x,t.clone$2=function(t){var e=new to(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Ns,t.config=F,t.create=function(){var t=new to(16);return to!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new to(9);return to!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new to(4);return to!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=qr,t.createLayout=Ta,t.createStyleLayer=function(t){return"custom"===t.type?new bc(t):new _c[t.type](t)},t.cross=function(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],l=r[2];return t[0]=a*l-i*s,t[1]=i*o-n*l,t[2]=n*s-a*o,t},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},t.number=Ue,t.offscreenCanvasSupported=ht,t.ortho=function(t,e,r,n,a,i,o){var s=1/(e-r),l=1/(n-a),c=1/(i-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(a+n)*l,t[14]=(o+i)*c,t[15]=1,t},t.parseGlyphPBF=function(t){return new Hs(t).readFields(ll,[])},t.pbf=Hs,t.performSymbolLayout=function(t,e,r,n,a,i,o){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,l=t.layers[0]._unevaluatedLayout._values,c={};if("composite"===t.textSizeData.kind){var u=t.textSizeData,h=u.maxZoom;c.compositeTextSizes=[l["text-size"].possiblyEvaluate(new aa(u.minZoom),o),l["text-size"].possiblyEvaluate(new aa(h),o)]}if("composite"===t.iconSizeData.kind){var f=t.iconSizeData,p=f.maxZoom;c.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new aa(f.minZoom),o),l["icon-size"].possiblyEvaluate(new aa(p),o)]}c.layoutTextSize=l["text-size"].possiblyEvaluate(new aa(t.zoom+1),o),c.layoutIconSize=l["icon-size"].possiblyEvaluate(new aa(t.zoom+1),o),c.textMaxSize=l["text-size"].possiblyEvaluate(new aa(18));for(var d=24*s.get("text-line-height"),g="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),m=s.get("text-keep-upright"),v=s.get("text-size"),y=function(){var i=b[x],l=s.get("text-font").evaluate(i,{},o).join(","),u=v.evaluate(i,{},o),h=c.layoutTextSize.evaluate(i,{},o),f=c.layoutIconSize.evaluate(i,{},o),p={horizontal:{},vertical:void 0},y=i.text,w=[0,0];if(y){var T=y.toString(),k=24*s.get("text-letter-spacing").evaluate(i,{},o),M=function(t){for(var e=0,r=t;e=8192||h.y<0||h.y>=8192||function(t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g,m,v,y,x,b,w,T,k,M){var A,S,E,C,L,P=t.addToLineVertexArray(e,r),I=0,z=0,O=0,D=0,R=-1,F=-1,B={},N=ci(""),j=0,U=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(j=(A=s.layout.get("text-offset").evaluate(b,{},k).map((function(t){return 24*t})))[0],U=A[1]):(j=24*s.layout.get("text-radial-offset").evaluate(b,{},k),U=Ql),t.allowVerticalPlacement&&n.vertical){var V=s.layout.get("text-rotate").evaluate(b,{},k)+90;C=new Yl(l,e,c,u,h,n.vertical,f,p,d,V),o&&(L=new Yl(l,e,c,u,h,o,m,v,d,V))}if(a){var q=s.layout.get("icon-rotate").evaluate(b,{}),H="none"!==s.layout.get("icon-text-fit"),G=Ul(a,q,T,H),Y=o?Ul(o,q,T,H):void 0;E=new Yl(l,e,c,u,h,a,m,v,!1,q),I=4*G.length;var W=t.iconSizeData,Z=null;"source"===W.kind?(Z=[128*s.layout.get("icon-size").evaluate(b,{})])[0]>32640&&_(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===W.kind&&((Z=[128*w.compositeIconSizes[0].evaluate(b,{},k),128*w.compositeIconSizes[1].evaluate(b,{},k)])[0]>32640||Z[1]>32640)&&_(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,G,Z,x,y,b,!1,e,P.lineStartIndex,P.lineLength,-1,k),R=t.icon.placedSymbolArray.length-1,Y&&(z=4*Y.length,t.addSymbols(t.icon,Y,Z,x,y,b,gl.vertical,e,P.lineStartIndex,P.lineLength,-1,k),F=t.icon.placedSymbolArray.length-1)}for(var X in n.horizontal){var J=n.horizontal[X];if(!S){N=ci(J.text);var K=s.layout.get("text-rotate").evaluate(b,{},k);S=new Yl(l,e,c,u,h,J,f,p,d,K)}var Q=1===J.positionedLines.length;if(O+=ec(t,e,J,i,s,d,b,g,P,n.vertical?gl.horizontal:gl.horizontalOnly,Q?Object.keys(n.horizontal):[X],B,R,w,k),Q)break}n.vertical&&(D+=ec(t,e,n.vertical,i,s,d,b,g,P,gl.vertical,["vertical"],B,F,w,k));var $=S?S.boxStartIndex:t.collisionBoxArray.length,tt=S?S.boxEndIndex:t.collisionBoxArray.length,et=C?C.boxStartIndex:t.collisionBoxArray.length,rt=C?C.boxEndIndex:t.collisionBoxArray.length,nt=E?E.boxStartIndex:t.collisionBoxArray.length,at=E?E.boxEndIndex:t.collisionBoxArray.length,it=L?L.boxStartIndex:t.collisionBoxArray.length,ot=L?L.boxEndIndex:t.collisionBoxArray.length,st=-1,lt=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=lt(S,st),st=lt(C,st),st=lt(E,st);var ct=(st=lt(L,st))>-1?1:0;ct&&(st*=M/24),t.glyphOffsetArray.length>=hc.MAX_GLYPHS&&_("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,R,F,N,$,tt,et,rt,nt,at,it,ot,c,O,D,I,z,ct,0,f,j,U,st)}(t,h,s,r,n,a,f,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,v,w,M,l,x,T,A,d,e,i,c,u,o)};if("line"===S)for(var P=0,I=jl(e.geometry,0,0,8192,8192);P1){var j=Bl(N,k,r.vertical||g,n,24,y);j&&L(N,j)}}else if("Polygon"===e.type)for(var U=0,V=Qo(e.geometry,0);U=E.maxzoom||"none"!==E.visibility&&(o(S,this.zoom,n),(g[E.id]=E.createBucket({index:u.bucketLayerIDs.length,layers:S,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:b,sourceID:this.source})).populate(_,m,this.tileID.canonical),u.bucketLayerIDs.push(S.map((function(t){return t.id}))))}}}var C=t.mapObject(m.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(C).length?i.send("getGlyphs",{uid:this.uid,stacks:C},(function(t,e){h||(h=t,f=e,I.call(l))})):f={};var L=Object.keys(m.iconDependencies);L.length?i.send("getImages",{icons:L,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){h||(h=t,p=e,I.call(l))})):p={};var P=Object.keys(m.patternDependencies);function I(){if(h)return s(h);if(f&&p&&d){var e=new a(f),r=new t.ImageAtlas(p,d);for(var i in g){var l=g[i];l instanceof t.SymbolBucket?(o(l.layers,this.zoom,n),t.performSymbolLayout(l,f,e.positions,p,r.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):l.hasPattern&&(l instanceof t.LineBucket||l instanceof t.FillBucket||l instanceof t.FillExtrusionBucket)&&(o(l.layers,this.zoom,n),l.addFeatures(m,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:t.values(g).filter((function(t){return!t.isEmpty()})),featureIndex:u,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?e.positions:null})}}P.length?i.send("getImages",{icons:P,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){h||(h=t,d=e,I.call(l))})):d={},I.call(this)};var l=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||s,this.loading={},this.loaded={}};l.prototype.loadTile=function(e,r){var n=this,a=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[a]=new i(e);s.abort=this.loadVectorData(e,(function(e,i){if(delete n.loading[a],e||!i)return s.status="done",n.loaded[a]=s,r(e);var l=i.rawData,c={};i.expires&&(c.expires=i.expires),i.cacheControl&&(c.cacheControl=i.cacheControl);var u={};if(o){var h=o.finish();h&&(u.resourceTiming=JSON.parse(JSON.stringify(h)))}s.vectorTile=i.vectorTile,s.parse(i.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:l.slice(0)},n,c,u))})),n.loaded=n.loaded||{},n.loaded[a]=s}))},l.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,a=t.uid,i=this;if(n&&n[a]){var o=n[a];o.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var a=o.reloadCallback;a&&(delete o.reloadCallback,o.parse(o.vectorTile,i.layerIndex,r.availableImages,i.actor,a)),e(t,n)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},l.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},l.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var c=t.window.ImageBitmap,u=function(){this.loaded={}};function h(t,e){if(0!==t.length){f(t[0],e);for(var r=1;r=0!=!!e&&t.reverse()}u.prototype.loadTile=function(e,r){var n=e.uid,a=e.encoding,i=e.rawImageData,o=c&&i instanceof c?this.getImageData(i):i,s=new t.DEMData(n,o,a);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)},u.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:r.width,height:r.height},r.data)},u.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var p=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function E(t,e){for(var r=t.loadGeometry(),n=t.type,a=0,i=0,o=r.length,s=0;s>1;!function t(e,r,n,a,i,o){for(;i>a;){if(i-a>600){var s=i-a+1,l=n-a+1,c=Math.log(s),u=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);t(e,r,n,Math.max(a,Math.floor(n-l*u/s+h)),Math.min(i,Math.floor(n+(s-l)*u/s+h)),o)}var f=r[2*n+o],p=a,d=i;for(L(e,r,a,n),r[2*i+o]>f&&L(e,r,a,i);pf;)d--}r[2*a+o]===f?L(e,r,a,d):L(e,r,++d,i),d<=n&&(a=d+1),n<=d&&(i=d-1)}}(e,r,s,a,i,o%2),t(e,r,n,a,s-1,o+1),t(e,r,n,s+1,i,o+1)}}(o,s,n,0,o.length-1,0)};D.prototype.range=function(t,e,r,n){return function(t,e,r,n,a,i,o){for(var s,l,c=[0,t.length-1,0],u=[];c.length;){var h=c.pop(),f=c.pop(),p=c.pop();if(f-p<=o)for(var d=p;d<=f;d++)l=e[2*d+1],(s=e[2*d])>=r&&s<=a&&l>=n&&l<=i&&u.push(t[d]);else{var g=Math.floor((p+f)/2);l=e[2*g+1],(s=e[2*g])>=r&&s<=a&&l>=n&&l<=i&&u.push(t[g]);var m=(h+1)%2;(0===h?r<=s:n<=l)&&(c.push(p),c.push(g-1),c.push(m)),(0===h?a>=s:i>=l)&&(c.push(g+1),c.push(f),c.push(m))}}return u}(this.ids,this.coords,t,e,r,n,this.nodeSize)},D.prototype.within=function(t,e,r){return function(t,e,r,n,a,i){for(var o=[0,t.length-1,0],s=[],l=a*a;o.length;){var c=o.pop(),u=o.pop(),h=o.pop();if(u-h<=i)for(var f=h;f<=u;f++)I(e[2*f],e[2*f+1],r,n)<=l&&s.push(t[f]);else{var p=Math.floor((h+u)/2),d=e[2*p],g=e[2*p+1];I(d,g,r,n)<=l&&s.push(t[p]);var m=(c+1)%2;(0===c?r-a<=d:n-a<=g)&&(o.push(h),o.push(p-1),o.push(m)),(0===c?r+a>=d:n+a>=g)&&(o.push(p+1),o.push(u),o.push(m))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var R={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},F=function(t){this.options=H(Object.create(R),t),this.trees=new Array(this.options.maxZoom+1)};function B(t,e,r,n,a){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:a}}function N(t,e){var r=t.geometry.coordinates,n=r[1];return{x:V(r[0]),y:q(n),zoom:1/0,index:e,parentId:-1}}function j(t){return{type:"Feature",id:t.id,properties:U(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function U(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return H(H({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function V(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function H(t,e){for(var r in e)t[r]=e[r];return t}function G(t){return t.x}function Y(t){return t.y}function W(t,e,r,n,a,i){var o=a-r,s=i-n;if(0!==o||0!==s){var l=((t-r)*o+(e-n)*s)/(o*o+s*s);l>1?(r=a,n=i):l>0&&(r+=o*l,n+=s*l)}return(o=t-r)*o+(s=e-n)*s}function Z(t,e,r,n){var a={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)X(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(o+=n?(a*c-l*i)/2:Math.sqrt(Math.pow(l-a,2)+Math.pow(c-i,2))),a=l,i=c}var u=e.length-3;e[2]=1,function t(e,r,n,a){for(var i,o=a,s=n-r>>1,l=n-r,c=e[r],u=e[r+1],h=e[n],f=e[n+1],p=r+3;po)i=p,o=d;else if(d===o){var g=Math.abs(p-s);ga&&(i-r>3&&t(e,r,i,a),e[i+2]=o,n-i>3&&t(e,i,n,a))}(e,0,u,r),e[u+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function $(t,e,r,n){for(var a=0;a1?1:r}function rt(t,e,r,n,a,i,o,s){if(n/=e,i>=(r/=e)&&o=n)return null;for(var l=[],c=0;c=r&&d=n)){var g=[];if("Point"===f||"MultiPoint"===f)nt(h,g,r,n,a);else if("LineString"===f)at(h,g,r,n,a,!1,s.lineMetrics);else if("MultiLineString"===f)ot(h,g,r,n,a,!1);else if("Polygon"===f)ot(h,g,r,n,a,!0);else if("MultiPolygon"===f)for(var m=0;m=r&&o<=n&&(e.push(t[i]),e.push(t[i+1]),e.push(t[i+2]))}}function at(t,e,r,n,a,i,o){for(var s,l,c=it(t),u=0===a?lt:ct,h=t.start,f=0;fr&&(l=u(c,p,d,m,v,r),o&&(c.start=h+s*l)):y>n?x=r&&(l=u(c,p,d,m,v,r),b=!0),x>n&&y<=n&&(l=u(c,p,d,m,v,n),b=!0),!i&&b&&(o&&(c.end=h+s*l),e.push(c),c=it(t)),o&&(h+=s)}var _=t.length-3;p=t[_],d=t[_+1],g=t[_+2],(y=0===a?p:d)>=r&&y<=n&&st(c,p,d,g),_=c.length-3,i&&_>=3&&(c[_]!==c[0]||c[_+1]!==c[1])&&st(c,c[0],c[1],c[2]),c.length&&e.push(c)}function it(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ot(t,e,r,n,a,i){for(var o=0;oo.maxX&&(o.maxX=u),h>o.maxY&&(o.maxY=h)}return o}function gt(t,e,r,n){var a=e.geometry,i=e.type,o=[];if("Point"===i||"MultiPoint"===i)for(var s=0;s0&&e.size<(a?o:n))r.numPoints+=e.length/3;else{for(var s=[],l=0;lo)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;a&&function(t,e){for(var r=0,n=0,a=t.length,i=a-2;n0===e)for(n=0,a=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=n;c--){var u=+Date.now();s=this._cluster(s,c),this.trees[c]=new D(s,G,Y,i,Float32Array),r&&console.log("z%d: %d clusters in %dms",c,s.length,+Date.now()-u)}return r&&console.timeEnd("total time"),this},F.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),a=180===t[2]?180:((t[2]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,a=180;else if(r>a){var o=this.getClusters([r,n,180,i],e),s=this.getClusters([-180,n,a,i],e);return o.concat(s)}for(var l=this.trees[this._limitZoom(e)],c=[],u=0,h=l.range(V(r),q(i),V(a),q(n));u1?this._map(s,!0):null,d=(o<<5)+(e+1)+this.points.length,g=0,m=c;g>5},F.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},F.prototype._map=function(t,e){if(t.numPoints)return e?H({},t.properties):t.properties;var r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?H({},n):n},vt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},vt.prototype.splitTile=function(t,e,r,n,a,i,o){for(var s=[t,e,r,n],l=this.options,c=l.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var u=1<1&&console.time("creation"),f=this.tiles[h]=dt(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var p="z"+e;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(f.source=t,a){if(e===l.maxZoom||e===a)continue;var d=1<1&&console.time("clipping");var g,m,v,y,x,b,_=.5*l.buffer/l.extent,w=.5-_,T=.5+_,k=1+_;g=m=v=y=null,x=rt(t,u,r-_,r+T,0,f.minX,f.maxX,l),b=rt(t,u,r+w,r+k,0,f.minX,f.maxX,l),t=null,x&&(g=rt(x,u,n-_,n+T,1,f.minY,f.maxY,l),m=rt(x,u,n+w,n+k,1,f.minY,f.maxY,l),x=null),b&&(v=rt(b,u,n-_,n+T,1,f.minY,f.maxY,l),y=rt(b,u,n+w,n+k,1,f.minY,f.maxY,l),b=null),c>1&&console.timeEnd("clipping"),s.push(g||[],e+1,2*r,2*n),s.push(m||[],e+1,2*r,2*n+1),s.push(v||[],e+1,2*r+1,2*n),s.push(y||[],e+1,2*r+1,2*n+1)}}},vt.prototype.getTile=function(t,e,r){var n=this.options,a=n.extent,i=n.debug;if(t<0||t>24)return null;var o=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,c=t,u=e,h=r;!l&&c>0;)c--,u=Math.floor(u/2),h=Math.floor(h/2),l=this.tiles[yt(c,u,h)];return l&&l.source?(i>1&&console.log("found parent tile z%d-%d-%d",c,u,h),i>1&&console.time("drilling down"),this.splitTile(l.source,c,u,h,t,e,r),i>1&&console.timeEnd("drilling down"),this.tiles[s]?ft(this.tiles[s],a):null):null};var bt=function(e){function r(t,r,n,a){e.call(this,t,r,n,xt),a&&(this.loadGeoJSON=a)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var a=!!(n&&n.request&&n.request.collectResourceTiming)&&new t.RequestPerformance(n.request);this.loadGeoJSON(n,(function(i,o){if(i||!o)return r(i);if("object"!=typeof o)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){var n,a=e&&e.type;if("FeatureCollection"===a)for(n=0;n=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var f=function(e){function r(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e=0?1.2:1))}function v(t,e,r,n,a,i,o){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else if(i.ranges[s])e(null,{stack:r,id:a,glyph:o});else{var l=i.requests[s];l||(l=i.requests[s]=[],x.loadGlyphRange(r,s,n.url,n.requestManager,(function(t,e){if(e){for(var r in e)n._doesCharSupportLocalGlyph(+r)||(i.glyphs[+r]=e[+r]);i.ranges[s]=!0}for(var a=0,o=l;a1&&(s=t[++o]);var c=Math.abs(l-s.left),u=Math.abs(l-s.right),h=Math.min(c,u),f=void 0,p=a/r*(n+1);if(s.isDash){var d=n-Math.abs(p);f=Math.sqrt(h*h+d*d)}else f=n-Math.sqrt(h*h+p*p);this.data[i+l]=Math.max(0,Math.min(255,f+128))}},T.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}var a=t[0],i=t[t.length-1];a.isDash===i.isDash&&(a.left=i.left-this.width,i.right=a.right+this.width);for(var o=this.width*this.nextRow,s=0,l=t[s],c=0;c1&&(l=t[++s]);var u=Math.abs(c-l.left),h=Math.abs(c-l.right),f=Math.min(u,h);this.data[o+c]=Math.max(0,Math.min(255,(l.isDash?f:-f)+128))}},T.prototype.addDash=function(e,r){var n=r?7:0,a=2*n+1;if(this.nextRow+a>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var i=0,o=0;o=n&&e.x=a&&e.y0&&(l[new t.OverscaledTileID(e.overscaledZ,i,r.z,a,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,o,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),a=this._data;"string"==typeof a?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(a),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(a),this.actor.send(this.type+".loadData",n,(function(t,a){r._removed||a&&a.abandoned||(r._loaded=!0,a&&a.resourceTiming&&a.resourceTiming[r.id]&&(r._resourceTiming=a.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,a=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(a,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,i){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(i,n.map.painter,"reloadTile"===a),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),P=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),I=function(e){function r(t,r,n,a){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(e,r){var n=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(a,i){n._loaded=!0,a?n.fire(new t.ErrorEvent(a)):i&&(n.image=i,e&&(n.coordinates=e),r&&r(),n._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,a=-1/0,i=-1/0,o=0,s=e;or.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,P.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var a=this.tiles[n];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(I),O=function(e){function r(r,n,a,i){e.call(this,r,n,a,i),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var a in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,P.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var i=this.tiles[a];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];tthis.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this},N.prototype.has=function(t){return t.wrapped().key in this.data},N.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},N.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},N.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},N.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},N.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),a=this.data[r][n];return this.data[r].splice(n,1),a.timeout&&clearTimeout(a.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(a.value),this.order.splice(this.order.indexOf(r),1),this},N.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},N.prototype.filter=function(t){var e=[];for(var r in this.data)for(var n=0,a=this.data[r];n1||(Math.abs(r)>1&&(1===Math.abs(r+a)?r+=a:1===Math.abs(r-a)&&(r-=a)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[i]&&(t.neighboringTiles[i].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var a in this._tiles){var i=this._tiles[a];if(!(n[a]||!i.hasData()||i.tileID.overscaledZ<=e||i.tileID.overscaledZ>r)){for(var o=i.tileID;i&&i.tileID.overscaledZ>e+1;){var s=i.tileID.scaledTo(i.tileID.overscaledZ-1);(i=this._tiles[s.key])&&i.hasData()&&(o=s)}for(var l=o;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){n[o.key]=o;break}}}},r.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(var n=t.overscaledZ-1;n>=e;n--){var a=t.scaledTo(n),i=this._getLoadedTile(a);if(i)return i}},r.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},r.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*r*5),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(a)},r.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var r={};for(var n in this._tiles){var a=this._tiles[n];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),r[a.tileID.key]=a}for(var i in this._tiles=r,this._timers)clearTimeout(this._timers[i]),delete this._timers[i];for(var o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var a;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(a=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(a=a.filter((function(t){return n._source.hasTile(t)})))):a=[];var i=e.coveringZoomLevel(this._source),o=Math.max(i-r.maxOverzooming,this._source.minzoom),s=Math.max(i+r.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(a,i);if(It(this._source.type)){for(var c={},u={},h=0,f=Object.keys(l);hthis._source.maxzoom){var m=d.children(this._source.maxzoom)[0],v=this.getTile(m);if(v&&v.hasData()){n[m.key]=m;continue}}else{var y=d.children(this._source.maxzoom);if(n[y[0].key]&&n[y[1].key]&&n[y[2].key]&&n[y[3].key])continue}for(var x=g.wasRequested(),b=d.overscaledZ-1;b>=i;--b){var _=d.scaledTo(b);if(a[_.key])break;if(a[_.key]=!0,!(g=this.getTile(_))&&x&&(g=this._addTile(_)),g&&(n[_.key]=_,x=g.wasRequested(),g.hasData()))break}}}return n},r.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],r=void 0,n=this._tiles[t].tileID;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);var a=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(a))break;n=a}for(var i=0,o=e;i0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var a=this,i=[],o=this.transform;if(!o)return i;for(var s=n?o.getCameraQueryGeometry(e):e,l=e.map((function(t){return o.pointCoordinate(t)})),c=s.map((function(t){return o.pointCoordinate(t)})),u=this.getIds(),h=1/0,f=1/0,p=-1/0,d=-1/0,g=0,m=c;g=0&&v[1].y+m>=0){var y=l.map((function(t){return s.getTilePoint(t)})),x=c.map((function(t){return s.getTilePoint(t)}));i.push({tile:n,tileID:s,queryGeometry:y,cameraQueryGeometry:x,scale:g})}}},x=0;x=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)},r.prototype.removeFeatureState=function(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)},r.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},r.prototype.setDependencies=function(t,e,r){var n=this._tiles[t];n&&n.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function Pt(t,e){var r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function It(t){return"raster"===t||"image"===t||"video"===t}function zt(){return new t.window.Worker(Ya.workerUrl)}Lt.maxOverzooming=10,Lt.maxUnderzooming=3;var Ot="mapboxgl_preloaded_worker_pool",Dt=function(){this.active={}};Dt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length0?(a-o)/s:0;return this.points[i].mult(1-l).add(this.points[r].mult(l))};var Jt=function(t,e,r){var n=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var i=0;i=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,a,i,o,s,l){var c=a?e.textSizeData:e.iconSizeData,u=t.evaluateSizeForZoom(c,n.transform.zoom),h=[256/n.width*2+1,256/n.height*2+1],f=a?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;f.clear();for(var p=e.lineVertexArray,d=a?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=n.transform.width/n.transform.height,m=!1,v=0;vMath.abs(n.x-r.x)*a?{useVertical:!0}:(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function ie(e,r,n,a,i,o,s,l,c,u,h,f,p,d){var g,m=r/24,v=e.lineOffsetX*m,y=e.lineOffsetY*m;if(e.numGlyphs>1){var x=e.glyphStartIndex+e.numGlyphs,b=e.lineStartIndex,_=e.lineStartIndex+e.lineLength,w=ne(m,l,v,y,n,h,f,e,c,o,p);if(!w)return{notEnoughRoom:!0};var T=$t(w.first.point,s).point,k=$t(w.last.point,s).point;if(a&&!n){var M=ae(e.writingMode,T,k,d);if(M)return M}g=[w.first];for(var A=e.glyphStartIndex+1;A0?L.point:oe(f,C,S,1,i),I=ae(e.writingMode,S,P,d);if(I)return I}var z=se(m*l.getoffsetX(e.glyphStartIndex),v,y,n,h,f,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,o,p);if(!z)return{notEnoughRoom:!0};g=[z]}for(var O=0,D=g;O0?1:-1,g=0;a&&(d*=-1,g=Math.PI),d<0&&(g+=Math.PI);for(var m=d>0?l+s:l+s+1,v=i,y=i,x=0,b=0,_=Math.abs(p),w=[];x+b<=_;){if((m+=d)=c)return null;if(y=v,w.push(v),void 0===(v=f[m])){var T=new t.Point(u.getx(m),u.gety(m)),k=$t(T,h);if(k.signedDistanceFromCamera>0)v=f[m]=k.point;else{var M=m-d;v=oe(0===x?o:new t.Point(u.getx(M),u.gety(M)),T,y,_-x+1,h)}}x+=b,b=y.dist(v)}var A=(_-x)/b,S=v.sub(y),E=S.mult(A)._add(y);E._add(S._unit()._perp()._mult(n*d));var C=g+Math.atan2(v.y-y.y,v.x-y.x);return w.push(E),{point:E,angle:C,path:w}}Jt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Jt.prototype.insert=function(t,e,r,n,a){this._forEachCell(e,r,n,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a)},Jt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},Jt.prototype._insertBoxCell=function(t,e,r,n,a,i){this.boxCells[a].push(i)},Jt.prototype._insertCircleCell=function(t,e,r,n,a,i){this.circleCells[a].push(i)},Jt.prototype._query=function(t,e,r,n,a,i){if(r<0||t>this.width||n<0||e>this.height)return!a&&[];var o=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(a)return!0;for(var s=0;s0:o},Jt.prototype._queryCircle=function(t,e,r,n,a){var i=t-r,o=t+r,s=e-r,l=e+r;if(o<0||i>this.width||l<0||s>this.height)return!n&&[];var c=[];return this._forEachCell(i,s,o,l,this._queryCellCircle,c,{hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},a),n?c.length>0:c},Jt.prototype.query=function(t,e,r,n,a){return this._query(t,e,r,n,!1,a)},Jt.prototype.hitTest=function(t,e,r,n,a){return this._query(t,e,r,n,!0,a)},Jt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Jt.prototype._queryCell=function(t,e,r,n,a,i,o,s){var l=o.seenUids,c=this.boxCells[a];if(null!==c)for(var u=this.bboxes,h=0,f=c;h=u[d+0]&&n>=u[d+1]&&(!s||s(this.boxKeys[p]))){if(o.hitTest)return i.push(!0),!0;i.push({key:this.boxKeys[p],x1:u[d],y1:u[d+1],x2:u[d+2],y2:u[d+3]})}}}var g=this.circleCells[a];if(null!==g)for(var m=this.circles,v=0,y=g;vo*o+s*s},Jt.prototype._circleAndRectCollide=function(t,e,r,n,a,i,o){var s=(i-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var c=(o-a)/2,u=Math.abs(e-(a+c));if(u>c+r)return!1;if(l<=s||u<=c)return!0;var h=l-s,f=u-c;return h*h+f*f<=r*r};var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ce(t,e){for(var r=0;r=1;P--)L.push(E.path[P]);for(var I=1;I0){for(var R=L[0].clone(),F=L[0].clone(),B=1;B=M.x&&F.x<=A.x&&R.y>=M.y&&F.y<=A.y?[L]:F.xA.x||F.yA.y?[]:t.clipLine([L],M.x,M.y,A.x,A.y)}for(var N=0,j=D;N=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},he.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t=0&&e0?(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(g=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:m,width:r,height:n,anchor:t,textBoxScale:a,prevAnchor:g},this.markUsedJustification(f,t,h,p),f.allowVerticalPlacement&&(this.markUsedOrientation(f,p,h),this.placedOrientations[h.crossTileID]=p),{shift:v,placedGlyphBoxes:y}):void 0},_e.prototype.placeLayerBucketPart=function(e,r,n){var a=this,i=e.parameters,o=i.bucket,s=i.layout,l=i.posMatrix,c=i.textLabelPlaneMatrix,u=i.labelToScreenMatrix,h=i.textPixelRatio,f=i.holdingForFade,p=i.collisionBoxArray,d=i.partiallyEvaluatedTextSize,g=i.collisionGroup,m=s.get("text-optional"),v=s.get("icon-optional"),y=s.get("text-allow-overlap"),x=s.get("icon-allow-overlap"),b="map"===s.get("text-rotation-alignment"),_="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),T="viewport-y"===s.get("symbol-z-order"),k=y&&(x||!o.hasIconData()||v),M=x&&(y||!o.hasTextData()||m);!o.collisionArrays&&p&&o.deserializeCollisionBoxes(p);var A=function(e,i){if(!r[e.crossTileID])if(f)a.placements[e.crossTileID]=new ge(!1,!1,!1);else{var p,T=!1,A=!1,S=!0,E=null,C={box:null,offscreen:null},L={box:null,offscreen:null},P=null,I=null,z=0,O=0,D=0;i.textFeatureIndex?z=i.textFeatureIndex:e.useRuntimeCollisionCircles&&(z=e.featureIndex),i.verticalTextFeatureIndex&&(O=i.verticalTextFeatureIndex);var R=i.textBox;if(R){var F=function(r){var n=t.WritingMode.horizontal;if(o.allowVerticalPlacement&&!r&&a.prevPlacement){var i=a.prevPlacement.placedOrientations[e.crossTileID];i&&(a.placedOrientations[e.crossTileID]=i,a.markUsedOrientation(o,n=i,e))}return n},B=function(r,n){if(o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i.verticalTextBox)for(var a=0,s=o.writingModes;a0&&(N=N.filter((function(t){return t!==j.anchor}))).unshift(j.anchor)}var U=function(t,r,n){for(var i=t.x2-t.x1,s=t.y2-t.y1,c=e.textBoxScale,u=w&&!x?r:null,f={box:[],offscreen:!1},p=y?2*N.length:N.length,d=0;d=N.length,e,o,n,u);if(m&&(f=m.placedGlyphBoxes)&&f.box&&f.box.length){T=!0,E=m.shift;break}}return f};B((function(){return U(R,i.iconBox,t.WritingMode.horizontal)}),(function(){var r=i.verticalTextBox;return o.allowVerticalPlacement&&!(C&&C.box&&C.box.length)&&e.numVerticalGlyphVertices>0&&r?U(r,i.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),C&&(T=C.box,S=C.offscreen);var V=F(C&&C.box);if(!T&&a.prevPlacement){var q=a.prevPlacement.variableOffsets[e.crossTileID];q&&(a.variableOffsets[e.crossTileID]=q,a.markUsedJustification(o,q.anchor,e,V))}}else{var H=function(t,r){var n=a.collisionIndex.placeCollisionBox(t,y,h,l,g.predicate);return n&&n.box&&n.box.length&&(a.markUsedOrientation(o,r,e),a.placedOrientations[e.crossTileID]=r),n};B((function(){return H(R,t.WritingMode.horizontal)}),(function(){var r=i.verticalTextBox;return o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?H(r,t.WritingMode.vertical):{box:null,offscreen:null}})),F(C&&C.box&&C.box.length)}}if(T=(p=C)&&p.box&&p.box.length>0,S=p&&p.offscreen,e.useRuntimeCollisionCircles){var G=o.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),Y=t.evaluateSizeForFeature(o.textSizeData,d,G),W=s.get("text-padding");P=a.collisionIndex.placeCollisionCircles(y,G,o.lineVertexArray,o.glyphOffsetArray,Y,l,c,u,n,_,g.predicate,e.collisionCircleDiameter,W),T=y||P.circles.length>0&&!P.collisionDetected,S=S&&P.offscreen}if(i.iconFeatureIndex&&(D=i.iconFeatureIndex),i.iconBox){var Z=function(t){var e=w&&E?be(t,E.x,E.y,b,_,a.transform.angle):t;return a.collisionIndex.placeCollisionBox(e,x,h,l,g.predicate)};A=L&&L.box&&L.box.length&&i.verticalIconBox?(I=Z(i.verticalIconBox)).box.length>0:(I=Z(i.iconBox)).box.length>0,S=S&&I.offscreen}var X=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,J=v||0===e.numIconVertices;if(X||J?J?X||(A=A&&T):T=A&&T:A=T=A&&T,T&&p&&p.box&&a.collisionIndex.insertCollisionBox(p.box,s.get("text-ignore-placement"),o.bucketInstanceId,L&&L.box&&O?O:z,g.ID),A&&I&&a.collisionIndex.insertCollisionBox(I.box,s.get("icon-ignore-placement"),o.bucketInstanceId,D,g.ID),P&&(T&&a.collisionIndex.insertCollisionCircles(P.circles,s.get("text-ignore-placement"),o.bucketInstanceId,z,g.ID),n)){var K=o.bucketInstanceId,Q=a.collisionCircleArrays[K];void 0===Q&&(Q=a.collisionCircleArrays[K]=new me);for(var $=0;$=0;--E){var C=S[E];A(o.symbolInstances.get(C),o.collisionArrays[C])}else for(var L=e.symbolInstanceStart;L=0&&(e.text.placedSymbolArray.get(l).crossTileID=i>=0&&l!==i?0:n.crossTileID)}},_e.prototype.markUsedOrientation=function(e,r,n){for(var a=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,i=r===t.WritingMode.vertical?r:0,o=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];o0,y=a.placedOrientations[i.crossTileID],x=y===t.WritingMode.vertical,b=y===t.WritingMode.horizontal||y===t.WritingMode.horizontalOnly;if(s>0||l>0){var _=Le(m.text);d(e.text,s,x?Pe:_),d(e.text,l,b?Pe:_);var w=m.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||x?1:0)})),i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=w||b?1:0);var T=a.variableOffsets[i.crossTileID];T&&a.markUsedJustification(e,T.anchor,i,y);var k=a.placedOrientations[i.crossTileID];k&&(a.markUsedJustification(e,"left",i,k),a.markUsedOrientation(e,k,i))}if(v){var M=Le(m.icon),A=!(f&&i.verticalPlacedIconSymbolIndex&&x);i.placedIconSymbolIndex>=0&&(d(e.icon,i.numIconVertices,A?M:Pe),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=m.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,i.numVerticalIconVertices,A?Pe:M),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var S=e.collisionArrays[n];if(S){var E=new t.Point(0,0);if(S.textBox||S.verticalTextBox){var C=!0;if(c){var L=a.variableOffsets[g];L?(E=xe(L.anchor,L.width,L.height,L.textOffset,L.textBoxScale),u&&E._rotate(h?a.transform.angle:-a.transform.angle)):C=!1}S.textBox&&we(e.textCollisionBox.collisionVertexArray,m.text.placed,!C||x,E.x,E.y),S.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,m.text.placed,!C||b,E.x,E.y)}var P=Boolean(!b&&S.verticalIconBox);S.iconBox&&we(e.iconCollisionBox.collisionVertexArray,m.icon.placed,P,f?E.x:0,f?E.y:0),S.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!P,f?E.x:0,f?E.y:0)}}},m=0;mt},_e.prototype.setStale=function(){this.stale=!0};var Te=Math.pow(2,25),ke=Math.pow(2,24),Me=Math.pow(2,17),Ae=Math.pow(2,16),Se=Math.pow(2,9),Ee=Math.pow(2,8),Ce=Math.pow(2,1);function Le(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*Te+e*ke+r*Me+e*Ae+r*Se+e*Ee+r*Ce+e}var Pe=0,Ie=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};Ie.prototype.continuePlacement=function(t,e,r,n,a){for(var i=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=r[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Ie(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},ze.prototype.commit=function(t){return this.placement.commit(t),this.placement};var Oe=512/t.EXTENT/2,De=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;nt.overscaledZ)for(var s in o){var l=o[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,a)}else{var c=o[t.scaledTo(Number(i)).key];c&&c.findMatches(e.symbolInstances,t,a)}}for(var u=0;u1?"@2x":"",l=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){l=null,o||(o=t,a=e,u())})),c=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){c=null,o||(o=t,i=e,u())}));function u(){if(o)n(o);else if(a&&i){var e=t.browser.getImageData(i),r={};for(var s in a){var l=a[s],c=l.width,u=l.height,h=l.x,f=l.y,p=l.sdf,d=l.pixelRatio,g=l.stretchX,m=l.stretchY,v=l.content,y=new t.RGBAImage({width:c,height:u});t.RGBAImage.copy(e,y,{x:h,y:f},{x:0,y:0},{width:c,height:u}),r[s]={data:y,pixelRatio:d,sdf:p,stretchX:g,stretchY:m,content:v}}n(null,r)}}return{cancel:function(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(e,this.map._requestManager,(function(e,n){if(r._spriteRequest=null,e)r.fire(new t.ErrorEvent(e));else if(n)for(var a in n)r.imageManager.addImage(a,n[a]);r.imageManager.setLoaded(!0),r._availableImages=r.imageManager.listImages(),r.dispatcher.broadcast("setImages",r._availableImages),r.fire(new t.Event("data",{dataType:"style"}))}))},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var n=e.sourceLayer;if(n){var a=r.getSource();("geojson"===a.type||a.vectorLayerIds&&-1===a.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+n+'" does not exist on source "'+a.id+'" as specified by style layer "'+e.id+'"')))}}},r.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,n=t;r0)throw new Error("Unimplemented: "+a.map((function(t){return t.command})).join(", ")+".");return n.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var a=this;if(void 0===n&&(n={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var i=this.sourceCaches[e]=new Lt(e,r,this.dispatcher);i.style=this,i.setEventedParent(this,(function(){return{isSourceLoaded:a.loaded(),source:i.serialize(),sourceId:e}})),i.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var a=e.id;if(this.getLayer(a))this.fire(new t.ErrorEvent(new Error('Layer with id "'+a+'" already exists on this map')));else{var i;if("custom"===e.type){if(Ne(this,t.validateCustomStyleLayer(e)))return;i=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(a,e.source),e=t.clone$1(e),e=t.extend(e,{source:a})),this._validate(t.validateStyle.layer,"layers."+a,e,{arrayIndex:-1},n))return;i=t.createStyleLayer(e),this._validateLayer(i),i.setEventedParent(this,{layer:{id:a}}),this._serializedLayers[i.id]=i.serialize()}var o=r?this._order.indexOf(r):this._order.length;if(r&&-1===o)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(o,0,a),this._layerOrderChanged=!0,this._layers[a]=i,this._removedLayers[a]&&i.source&&"custom"!==i.type){var s=this._removedLayers[a];delete this._removedLayers[a],s.type!==i.type?this._updatedSources[i.source]="clear":(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause())}this._updateLayer(i),i.onAdd&&i.onAdd(this.map)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var a=r?this._order.indexOf(r):this._order.length;r&&-1===a?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(a,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.hasLayer=function(t){return t in this._layers},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var a=this.getLayer(e);a?a.minzoom===r&&a.maxzoom===n||(null!=r&&(a.minzoom=r),null!=n&&(a.maxzoom=n),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var a=this.getLayer(e);if(a){if(!t.deepEqual(a.filter,r))return null==r?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(t.validateStyle.filter,"layers."+a.id+".filter",r,null,n)||(a.filter=t.clone$1(r),this._updateLayer(a)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n,a){void 0===a&&(a={}),this._checkLoaded();var i=this.getLayer(e);i?t.deepEqual(i.getLayoutProperty(r),n)||(i.setLayoutProperty(r,n,a),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(e,r){var n=this.getLayer(e);if(n)return n.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,n,a){void 0===a&&(a={}),this._checkLoaded();var i=this.getLayer(e);i?t.deepEqual(i.getPaintProperty(r),n)||(i.setPaintProperty(r,n,a)&&this._updateLayer(i),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,a=e.sourceLayer,i=this.sourceCaches[n];if(void 0!==i){var o=i.getSource().type;"geojson"===o&&a?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||a?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),i.setFeatureState(a,e.id,r)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var n=e.source,a=this.sourceCaches[n];if(void 0!==a){var i=a.getSource().type,o="vector"===i?e.sourceLayer:void 0;"vector"!==i||o?r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))):a.removeFeatureState(o,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,a=this.sourceCaches[r];if(void 0!==a){if("vector"!==a.getSource().type||n)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.getFeatureState(n,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},n={},a=[],i=this._order.length-1;i>=0;i--){var o=this._order[i];if(r(o)){n[o]=i;for(var s=0,l=t;s=0;p--){var d=this._order[p];if(r(d))for(var g=a.length-1;g>=0;g--){var m=a[g].feature;if(n[m.layer.id] 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),$e=vr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),tr=vr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),er=vr("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),rr=vr("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),nr=vr("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ar=vr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),ir=vr("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),or=vr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),sr=vr("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),lr=vr("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),cr=vr("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),ur=vr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define MAX_LINE_DISTANCE 32767.0\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),hr=vr("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),fr=vr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),pr=vr("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),dr=vr("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),gr=vr("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),mr=vr("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function vr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n={};return{fragmentSource:t=t.replace(r,(function(t,e,r,a,i){return n[i]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nvarying "+r+" "+a+" "+i+";\n#else\nuniform "+r+" "+a+" u_"+i+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+i+"\n "+r+" "+a+" "+i+" = u_"+i+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,a,i){var o="float"===a?"vec2":"vec4",s=i.match(/color/)?"color":o;return n[i]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+r+" "+o+" a_"+i+";\nvarying "+r+" "+a+" "+i+";\n#else\nuniform "+r+" "+a+" u_"+i+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = a_"+i+";\n#else\n "+r+" "+a+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = unpack_mix_"+s+"(a_"+i+", u_"+i+"_t);\n#else\n "+r+" "+a+" "+i+" = u_"+i+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+r+" "+o+" a_"+i+";\n#else\nuniform "+r+" "+a+" u_"+i+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+r+" "+a+" "+i+" = a_"+i+";\n#else\n "+r+" "+a+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+r+" "+a+" "+i+" = unpack_mix_"+s+"(a_"+i+", u_"+i+"_t);\n#else\n "+r+" "+a+" "+i+" = u_"+i+";\n#endif\n"}))}}var yr=Object.freeze({__proto__:null,prelude:Ge,background:Ye,backgroundPattern:We,circle:Ze,clippingMask:Xe,heatmap:Je,heatmapTexture:Ke,collisionBox:Qe,collisionCircle:$e,debug:tr,fill:er,fillOutline:rr,fillOutlinePattern:nr,fillPattern:ar,fillExtrusion:ir,fillExtrusionPattern:or,hillshadePrepare:sr,hillshade:lr,line:cr,lineGradient:ur,linePattern:hr,lineSDF:fr,raster:pr,symbolIcon:dr,symbolSDF:gr,symbolTextAndIcon:mr}),xr=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};xr.prototype.bind=function(t,e,r,n,a,i,o,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==n.length,c=0;!l&&c>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}br.prototype.draw=function(t,e,r,n,a,i,o,s,l,c,u,h,f,p,d,g){var m,v=t.gl;if(!this.failedToCreate){for(var y in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(a),t.setCullFace(i),this.fixedUniforms)this.fixedUniforms[y].set(o[y]);p&&p.setUniforms(t,this.binderUniforms,h,{zoom:f});for(var x=(m={},m[v.LINES]=2,m[v.TRIANGLES]=3,m[v.LINE_STRIP]=1,m)[e],b=0,_=u.get();b<_.length;b+=1){var w=_[b],T=w.vaos||(w.vaos={});(T[s]||(T[s]=new xr)).bind(t,this,l,p?p.getPaintVertexBuffers():[],c,w.vertexOffset,d,g),v.drawElements(e,w.primitiveLength*x,v.UNSIGNED_SHORT,w.primitiveOffset*x*2)}}};var wr=function(e,r,n,a){var i=r.style.light,o=i.properties.get("position"),s=[o.x,o.y,o.z],l=t.create$1();"viewport"===i.properties.get("anchor")&&t.fromRotation(l,-r.transform.angle),t.transformMat3(s,s,l);var c=i.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+n,u_opacity:a}},Tr=function(e,r,n,a,i,o,s){return t.extend(wr(e,r,n,a),_r(o,r,s),{u_height_factor:-Math.pow(2,i.overscaledZ)/s.tileSize/8})},kr=function(t){return{u_matrix:t}},Mr=function(e,r,n,a){return t.extend(kr(e),_r(n,r,a))},Ar=function(t,e){return{u_matrix:t,u_world:e}},Sr=function(e,r,n,a,i){return t.extend(Mr(e,r,n,a),{u_world:i})},Er=function(e,r,n,a){var i,o,s=e.transform;if("map"===a.paint.get("circle-pitch-alignment")){var l=fe(n,1,s.zoom);i=!0,o=[l,l]}else i=!1,o=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===a.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(r.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+i,u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:o}},Cr=function(t,e,r){var n=fe(r,1,e.zoom),a=Math.pow(2,e.zoom-r.tileID.overscaledZ),i=r.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*a),e.pixelsToGLUnits[1]/(n*a)],u_overscale_factor:i}},Lr=function(t,e,r){return{u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:r.cameraToCenterDistance,u_viewport_size:[r.width,r.height]}},Pr=function(t,e,r){return void 0===r&&(r=1),{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:r}},Ir=function(t){return{u_matrix:t}},zr=function(t,e,r,n){return{u_matrix:t,u_extrude_scale:fe(e,1,r),u_intensity:n}},Or=function(e,r,n){var a=e.transform;return{u_matrix:Nr(e,r,n),u_ratio:1/fe(r,1,a.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Dr=function(e,r,n){return t.extend(Or(e,r,n),{u_image:0})},Rr=function(e,r,n,a){var i=e.transform,o=Br(r,i);return{u_matrix:Nr(e,r,n),u_texsize:r.imageAtlasTexture.size,u_ratio:1/fe(r,1,i.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[o,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},Fr=function(e,r,n,a,i){var o=e.lineAtlas,s=Br(r,e.transform),l="round"===n.layout.get("line-cap"),c=o.getDash(a.from,l),u=o.getDash(a.to,l),h=c.width*i.fromScale,f=u.width*i.toScale;return t.extend(Or(e,r,n),{u_patternscale_a:[s/h,-c.height/2],u_patternscale_b:[s/f,-u.height/2],u_sdfgamma:o.width/(256*Math.min(h,f)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:u.y,u_mix:i.t})};function Br(t,e){return 1/fe(t,1,e.tileZoom)}function Nr(t,e,r){return t.translatePosMatrix(e.tileID.posMatrix,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}var jr=function(t,e,r,n,a){return{u_matrix:t,u_tl_parent:e,u_scale_parent:r,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(o=a.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(i=a.paint.get("raster-contrast"),i>0?1/(1-i):1+i),u_spin_weights:Ur(a.paint.get("raster-hue-rotate"))};var i,o};function Ur(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var Vr,qr=function(t,e,r,n,a,i,o,s,l,c){var u=a.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:u.width/u.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:i,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+n,u_texsize:c,u_texture:0}},Hr=function(e,r,n,a,i,o,s,l,c,u,h){var f=i.transform;return t.extend(qr(e,r,n,a,i,o,s,l,c,u),{u_gamma_scale:a?Math.cos(f._pitch)*f.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+h})},Gr=function(e,r,n,a,i,o,s,l,c,u){return t.extend(Hr(e,r,n,a,i,o,s,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1})},Yr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Wr=function(e,r,n,a,i,o){return t.extend(function(t,e,r,n){var a=r.imageManager.getPattern(t.from.toString()),i=r.imageManager.getPattern(t.to.toString()),o=r.imageManager.getPixelSize(),s=o.width,l=o.height,c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,h=u*(n.tileID.canonical.x+n.tileID.wrap*c),f=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:i.tl,u_pattern_br_b:i.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:i.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/fe(n,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,f>>16],u_pixel_coord_lower:[65535&h,65535&f]}}(a,o,n,i),{u_matrix:e,u_opacity:r})},Zr={fillExtrusion:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},collisionCircle:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,r.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,r.u_viewport_size)}},debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_overlay:new t.Uniform1i(e,r.u_overlay),u_overlay_scale:new t.Uniform1f(e,r.u_overlay_scale)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_maxzoom:new t.Uniform1f(e,r.u_maxzoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Xr(e,r,n,a,i,o,s){for(var l=e.context,c=l.gl,u=e.useProgram("collisionBox"),h=[],f=0,p=0,d=0;d0){var _=t.create(),w=y;t.mul(_,v.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(_,_,v.placementViewportMatrix),h.push({circleArray:b,circleOffset:p,transform:w,invTransform:_}),p=f+=b.length/4}x&&u.draw(l,c.LINES,Mt.disabled,At.disabled,e.colorModeForRenderPass(),Et.disabled,Cr(y,e.transform,m),n.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}}if(s&&h.length){var T=e.useProgram("collisionCircle"),k=new t.StructArrayLayout2f1f2i16;k.resize(4*f),k._trim();for(var M=0,A=0,S=h;A=0&&(g[v.associatedIconIndex]={shiftedAnchor:k,angle:M})}else ce(v.numGlyphs,p)}if(h){d.clear();for(var S=e.icon.placedSymbolArray,E=0;E0){var s=t.browser.now(),l=(s-e.timeAdded)/o,c=r?(s-r.timeAdded)/o:-1,u=n.getSource(),h=i.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),f=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),p=f&&e.refreshedUponExpiration?1:t.clamp(f?l:1-c,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}var ln=new t.Color(1,0,0,1),cn=new t.Color(0,1,0,1),un=new t.Color(0,0,1,1),hn=new t.Color(1,0,1,1),fn=new t.Color(0,1,1,1);function pn(t,e,r,n){gn(t,0,e+r/2,t.transform.width,r,n)}function dn(t,e,r,n){gn(t,e-r/2,0,r,t.transform.height,n)}function gn(e,r,n,a,i,o){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(r*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,a*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio),s.clear({color:o}),l.disable(l.SCISSOR_TEST)}function mn(e,r,n){var a=e.context,i=a.gl,o=n.posMatrix,s=e.useProgram("debug"),l=Mt.disabled,c=At.disabled,u=e.colorModeForRenderPass();a.activeTexture.set(i.TEXTURE0),e.emptyTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE),s.draw(a,i.LINE_STRIP,l,c,u,Et.disabled,Pr(o,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var h=r.getTileByID(n.key).latestRawTileData,f=Math.floor((h&&h.byteLength||0)/1024),p=r.getTile(n).tileSize,d=512/Math.min(p,512)*(n.overscaledZ/e.transform.zoom)*.5,g=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(g+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var r=t.debugOverlayCanvas,n=t.context.gl,a=t.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,r.width,r.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(e,5,5),a.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,g+" "+f+"kb"),s.draw(a,i.TRIANGLES,l,c,St.alphaBlended,Et.disabled,Pr(o,t.Color.transparent,d),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var vn={symbol:function(e,r,n,a,i){if("translucent"===e.renderPass){var o=At.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,r,n,a,i,o,s){for(var l=r.transform,c="map"===i,u="map"===o,h=0,f=e;h256&&this.clearStencil(),r.setColorMode(St.disabled),r.setDepthMode(Mt.disabled);var a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var i=0,o=e;i256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new At({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},yn.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new At({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},yn.prototype.stencilConfigForOverlap=function(t){var e,r=this.context.gl,n=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),a=n[n.length-1].overscaledZ,i=n[0].overscaledZ-a+1;if(i>1){this.currentStencilSource=void 0,this.nextStencilID+i>256&&this.clearStencil();for(var o={},s=0;s=0;this.currentLayer--){var b=this.style._layers[a[this.currentLayer]],_=i[b.source],w=u[b.source];this._renderTileClippingMasks(b,w),this.renderLayer(this,_,b,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?e.pop():null},yn.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},yn.prototype.useProgram=function(t,e){this.cache=this.cache||{};var r=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new br(this.context,yr[t],e,Zr[t],this._showOverdrawInspector)),this.cache[r]},yn.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},yn.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},yn.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},yn.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var xn=function(t,e){this.points=t,this.planes=e};xn.fromInvProjectionMatrix=function(e,r,n){var a=Math.pow(2,n),i=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(r){return t.transformMat4([],r,e)})).map((function(e){return t.scale$1([],e,1/e[3]/r*a)})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var r=t.sub([],i[e[0]],i[e[1]]),n=t.sub([],i[e[2]],i[e[1]]),a=t.normalize([],t.cross([],r,n)),o=-t.dot(a,i[e[1]]);return a.concat(o)}));return new xn(i,o)};var bn=function(e,r){this.min=e,this.max=r,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};bn.prototype.quadrant=function(e){for(var r=[e%2==0,e<2],n=t.clone$2(this.min),a=t.clone$2(this.max),i=0;i=0;if(0===o)return 0;o!==r.length&&(n=!1)}if(n)return 2;for(var l=0;l<3;l++){for(var c=Number.MAX_VALUE,u=-Number.MAX_VALUE,h=0;hthis.max[l]-this.min[l])return 0}return 1};var _n=function(t,e,r,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=n};_n.prototype.interpolate=function(e,r,n){return null!=r.top&&null!=e.top&&(this.top=t.number(e.top,r.top,n)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,r.bottom,n)),null!=r.left&&null!=e.left&&(this.left=t.number(e.left,r.left,n)),null!=r.right&&null!=e.right&&(this.right=t.number(e.right,r.right,n)),this},_n.prototype.getCenter=function(e,r){var n=t.clamp((this.left+e-this.right)/2,0,e),a=t.clamp((this.top+r-this.bottom)/2,0,r);return new t.Point(n,a)},_n.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},_n.prototype.clone=function(){return new _n(this.top,this.bottom,this.left,this.right)},_n.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var wn=function(e,r,n,a,i){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===i||i,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==a?60:a,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new _n,this._posMatrixCache={},this._alignedPosMatrixCache={}},Tn={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};wn.prototype.clone=function(){var t=new wn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},Tn.minZoom.get=function(){return this._minZoom},Tn.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Tn.maxZoom.get=function(){return this._maxZoom},Tn.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Tn.minPitch.get=function(){return this._minPitch},Tn.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},Tn.maxPitch.get=function(){return this._maxPitch},Tn.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},Tn.renderWorldCopies.get=function(){return this._renderWorldCopies},Tn.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Tn.worldSize.get=function(){return this.tileSize*this.scale},Tn.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Tn.size.get=function(){return new t.Point(this.width,this.height)},Tn.bearing.get=function(){return-this.angle/Math.PI*180},Tn.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Tn.pitch.get=function(){return this._pitch/Math.PI*180},Tn.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},Tn.fov.get=function(){return this._fov/Math.PI*180},Tn.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},Tn.zoom.get=function(){return this._zoom},Tn.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},Tn.center.get=function(){return this._center},Tn.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Tn.padding.get=function(){return this._edgeInsets.toJSON()},Tn.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},Tn.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},wn.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},wn.prototype.interpolatePadding=function(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()},wn.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},wn.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var n=this.pointCoordinate(new t.Point(0,0)),a=this.pointCoordinate(new t.Point(this.width,0)),i=this.pointCoordinate(new t.Point(this.width,this.height)),o=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(n.x,a.x,i.x,o.x)),l=Math.floor(Math.max(n.x,a.x,i.x,o.x)),c=s-1;c<=l+1;c++)0!==c&&r.push(new t.UnwrappedTileID(c,e));return r},wn.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var a=t.MercatorCoordinate.fromLngLat(this.center),i=Math.pow(2,r),o=[i*a.x,i*a.y,0],s=xn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=r);var c=function(t){return{aabb:new bn([t*i,0,0],[(t+1)*i,i,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},u=[],h=[],f=r,p=e.reparseOverscaled?n:r;if(this._renderWorldCopies)for(var d=1;d<=3;d++)u.push(c(-d)),u.push(c(d));for(u.push(c(0));u.length>0;){var g=u.pop(),m=g.x,v=g.y,y=g.fullyVisible;if(!y){var x=g.aabb.intersects(s);if(0===x)continue;y=2===x}var b=g.aabb.distanceX(o),_=g.aabb.distanceY(o),w=Math.max(Math.abs(b),Math.abs(_));if(g.zoom===f||w>3+(1<=l)h.push({tileID:new t.OverscaledTileID(g.zoom===f?p:g.zoom,g.wrap,g.zoom,m,v),distanceSq:t.sqrLen([o[0]-.5-m,o[1]-.5-v])});else for(var T=0;T<4;T++){var k=(m<<1)+T%2,M=(v<<1)+(T>>1);u.push({aabb:g.aabb.quadrant(T),zoom:g.zoom+1,x:k,y:M,wrap:g.wrap,fullyVisible:y})}}return h.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},wn.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},Tn.unmodified.get=function(){return this._unmodified},wn.prototype.zoomScale=function(t){return Math.pow(2,t)},wn.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},wn.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},wn.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Tn.point.get=function(){return this.project(this.center)},wn.prototype.setLocationAtPoint=function(e,r){var n=this.pointCoordinate(r),a=this.pointCoordinate(this.centerPoint),i=this.locationCoordinate(e),o=new t.MercatorCoordinate(i.x-(n.x-a.x),i.y-(n.y-a.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())},wn.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},wn.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},wn.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},wn.prototype.coordinateLocation=function(t){return t.toLngLat()},wn.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);var a=r[3],i=n[3],o=r[1]/a,s=n[1]/i,l=r[2]/a,c=n[2]/i,u=l===c?0:(0-l)/(c-l);return new t.MercatorCoordinate(t.number(r[0]/a,n[0]/i,u)/this.worldSize,t.number(o,s,u)/this.worldSize)},wn.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},wn.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},wn.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},wn.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},wn.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var n=e.key,a=r?this._alignedPosMatrixCache:this._posMatrixCache;if(a[n])return a[n];var i=e.canonical,o=this.worldSize/this.zoomScale(i.z),s=i.x+Math.pow(2,i.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*o,i.y*o,0]),t.scale(l,l,[o/t.EXTENT,o/t.EXTENT,1]),t.multiply(l,r?this.alignedProjMatrix:this.projMatrix,l),a[n]=new Float32Array(l),a[n]},wn.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},wn.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,n,a,i=-90,o=90,s=-180,l=180,c=this.size,u=this._unmodified;if(this.latRange){var h=this.latRange;i=t.mercatorYfromLat(h[1])*this.worldSize,e=(o=t.mercatorYfromLat(h[0])*this.worldSize)-io&&(a=o-m)}if(this.lngRange){var v=p.x,y=c.x/2;v-yl&&(n=l-y)}void 0===n&&void 0===a||(this.center=this.unproject(new t.Point(void 0!==n?n:p.x,void 0!==a?a:p.y))),this._unmodified=u,this._constraining=!1}},wn.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var r=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),a=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-n,.01,Math.PI-.01)),i=this.point,o=i.x,s=i.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*a+this.cameraToCenterDistance),c=this.height/50,u=new Float64Array(16);t.perspective(u,this._fov,this.width/this.height,c,l),u[8]=2*-e.x/this.width,u[9]=2*e.y/this.height,t.scale(u,u,[1,-1,1]),t.translate(u,u,[0,0,-this.cameraToCenterDistance]),t.rotateX(u,u,this._pitch),t.rotateZ(u,u,this.angle),t.translate(u,u,[-o,-s,0]),this.mercatorMatrix=t.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),t.scale(u,u,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=u,this.invProjMatrix=t.invert([],this.projMatrix);var h=this.width%2/2,f=this.height%2/2,p=Math.cos(this.angle),d=Math.sin(this.angle),g=o-Math.round(o)+p*h+d*f,m=s-Math.round(s)+p*f+d*h,v=new Float64Array(u);if(t.translate(v,v,[g>.5?g-1:g,m>.5?m-1:m,0]),this.alignedProjMatrix=v,u=t.create(),t.scale(u,u,[this.width/2,-this.height/2,1]),t.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=t.create(),t.scale(u,u,[1,-1,1]),t.translate(u,u,[-1,-1,0]),t.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(u=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}},wn.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},wn.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},wn.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var n=r.x,a=r.y,i=r.x,o=r.y,s=0,l=e;s=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},kn.prototype._updateHashUnthrottled=function(){var e=this.getHashString();try{t.window.history.replaceState(t.window.history.state,"",e)}catch(t){}};var Mn={linearity:.3,easing:t.bezier(0,0,.3,1)},An=t.extend({deceleration:2500,maxSpeed:1400},Mn),Sn=t.extend({deceleration:20,maxSpeed:1400},Mn),En=t.extend({deceleration:1e3,maxSpeed:360},Mn),Cn=t.extend({deceleration:1e3,maxSpeed:90},Mn),Ln=function(t){this._map=t,this.clear()};function Pn(t,e){(!t.duration||t.duration0&&r-e[0].time>160;)e.shift()},Ln.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var r={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},n=0,a=this._inertiaBuffer;n=this._clickTolerance||this._map.fire(new zn(t.type,this._map,t))},Rn.prototype.dblclick=function(t){return this._firePreventable(new zn(t.type,this._map,t))},Rn.prototype.mouseover=function(t){this._map.fire(new zn(t.type,this._map,t))},Rn.prototype.mouseout=function(t){this._map.fire(new zn(t.type,this._map,t))},Rn.prototype.touchstart=function(t){return this._firePreventable(new On(t.type,this._map,t))},Rn.prototype.touchmove=function(t){this._map.fire(new On(t.type,this._map,t))},Rn.prototype.touchend=function(t){this._map.fire(new On(t.type,this._map,t))},Rn.prototype.touchcancel=function(t){this._map.fire(new On(t.type,this._map,t))},Rn.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},Rn.prototype.isEnabled=function(){return!0},Rn.prototype.isActive=function(){return!1},Rn.prototype.enable=function(){},Rn.prototype.disable=function(){};var Fn=function(t){this._map=t};Fn.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Fn.prototype.mousemove=function(t){this._map.fire(new zn(t.type,this._map,t))},Fn.prototype.mousedown=function(){this._delayContextMenu=!0},Fn.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Fn.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new zn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Fn.prototype.isEnabled=function(){return!0},Fn.prototype.isActive=function(){return!1},Fn.prototype.enable=function(){},Fn.prototype.disable=function(){};var Bn=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Nn(t,e){for(var r={},n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){for(var r=new t.Point(0,0),n=0,a=e;n30)&&(this.aborted=!0)}}},jn.prototype.touchend=function(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){var n=!this.aborted&&this.centroid;if(this.reset(),n)return n}};var Un=function(t){this.singleTap=new jn(t),this.numTaps=t.numTaps,this.reset()};Un.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Un.prototype.touchstart=function(t,e,r){this.singleTap.touchstart(t,e,r)},Un.prototype.touchmove=function(t,e,r){this.singleTap.touchmove(t,e,r)},Un.prototype.touchend=function(t,e,r){var n=this.singleTap.touchend(t,e,r);if(n){var a=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(a&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}};var Vn=function(){this._zoomIn=new Un({numTouches:1,numTaps:2}),this._zoomOut=new Un({numTouches:2,numTaps:1}),this.reset()};Vn.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},Vn.prototype.touchstart=function(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)},Vn.prototype.touchmove=function(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)},Vn.prototype.touchend=function(t,e,r){var n=this,a=this._zoomIn.touchend(t,e,r),i=this._zoomOut.touchend(t,e,r);return a?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(a)},{originalEvent:t})}}):i?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(i)},{originalEvent:t})}}):void 0},Vn.prototype.touchcancel=function(){this.reset()},Vn.prototype.enable=function(){this._enabled=!0},Vn.prototype.disable=function(){this._enabled=!1,this.reset()},Vn.prototype.isEnabled=function(){return this._enabled},Vn.prototype.isActive=function(){return this._active};var qn=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};qn.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},qn.prototype._correctButton=function(t,e){return!1},qn.prototype._move=function(t,e){return{}},qn.prototype.mousedown=function(t,e){if(!this._lastPoint){var n=r.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}},qn.prototype.mousemoveWindow=function(t,e){var r=this._lastPoint;if(r&&(t.preventDefault(),this._moved||!(e.dist(r)0&&(this._active=!0);var a=Nn(n,r),i=new t.Point(0,0),o=new t.Point(0,0),s=0;for(var l in a){var c=a[l],u=this._touches[l];u&&(i._add(c),o._add(c.sub(u)),s++,a[l]=c)}if(this._touches=a,!(sMath.abs(t.x)}var ea=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,ta(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,r){var n=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,a,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+a.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,r){if(void 0!==this._valid)return this._valid;var n=t.mag()>=2,a=e.mag()>=2;if(n||a){if(!n||!a)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;var i=t.y>0==e.y>0;return ta(t)&&ta(e)&&i}},e}(Zn),ra={panStep:100,bearingStep:15,pitchStep:10},na=function(){var t=ra;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep};function aa(t){return t*(2-t)}na.prototype.reset=function(){this._active=!1},na.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var r=0,n=0,a=0,i=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),i=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),i=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),o=1);break;default:return}return{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:aa,zoom:r?Math.round(l)+r*(t.shiftKey?2:1):l,bearing:s.getBearing()+n*e._bearingStep,pitch:s.getPitch()+a*e._pitchStep,offset:[-i*e._panStep,-o*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},na.prototype.enable=function(){this._enabled=!0},na.prototype.disable=function(){this._enabled=!1,this.reset()},na.prototype.isEnabled=function(){return this._enabled},na.prototype.isActive=function(){return this._active};var ia=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};ia.prototype.setZoomRate=function(t){this._defaultZoomRate=t},ia.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},ia.prototype.isEnabled=function(){return!!this._enabled},ia.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},ia.prototype.isZooming=function(){return!!this._zooming},ia.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},ia.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},ia.prototype.wheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.browser.now(),a=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(a*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}},ia.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},ia.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var n=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},ia.prototype.renderFrame=function(){return this._onScrollFrame()},ia.prototype._onScrollFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==a&&(a=1/a);var i="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(i*a))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var o,s="number"==typeof this._targetZoom?this._targetZoom:r.zoom,l=this._startZoom,c=this._easing,u=!1;if("wheel"===this._type&&l&&c){var h=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),f=c(h);o=t.number(l,s,f),h<1?this._frameId||(this._frameId=!0):u=!0}else o=s,u=!0;return this._active=!0,u&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!u,zoomDelta:o-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},ia.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,a=(t.browser.now()-n.start)/n.duration,i=n.easing(a+.01)-n.easing(a),o=.27/Math.sqrt(i*i+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=t.bezier(o,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r},ia.prototype.reset=function(){this._active=!1};var oa=function(t,e){this._clickZoom=t,this._tapZoom=e};oa.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},oa.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},oa.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},oa.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var sa=function(){this.reset()};sa.prototype.reset=function(){this._active=!1},sa.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(r){r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.unproject(e)},{originalEvent:t})}}},sa.prototype.enable=function(){this._enabled=!0},sa.prototype.disable=function(){this._enabled=!1,this.reset()},sa.prototype.isEnabled=function(){return this._enabled},sa.prototype.isActive=function(){return this._active};var la=function(){this._tap=new Un({numTouches:1,numTaps:1}),this.reset()};la.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},la.prototype.touchstart=function(t,e,r){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=e[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,e,r))},la.prototype.touchmove=function(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;var n=e[0],a=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:a/128}}}else this._tap.touchmove(t,e,r)},la.prototype.touchend=function(t,e,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(t,e,r)&&(this._tapTime=t.timeStamp)},la.prototype.touchcancel=function(){this.reset()},la.prototype.enable=function(){this._enabled=!0},la.prototype.disable=function(){this._enabled=!1,this.reset()},la.prototype.isEnabled=function(){return this._enabled},la.prototype.isActive=function(){return this._active};var ca=function(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r};ca.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},ca.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},ca.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},ca.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var ua=function(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r};ua.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},ua.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},ua.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},ua.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var ha=function(t,e,r,n){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0};ha.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},ha.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},ha.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},ha.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},ha.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},ha.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var fa=function(t){return t.zoom||t.drag||t.pitch||t.rotate},pa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function da(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var ga=function(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ln(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);var a=this._el;this._listeners=[[a,"touchstart",{passive:!1}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[t.window,"blur",void 0]];for(var i=0,o=this._listeners;ii?Math.min(2,_):Math.max(.5,_),w=Math.pow(m,1-e),T=a.unproject(x.add(b.mult(e*w)).mult(g));a.setLocationAtPoint(a.renderWorldCopies?T.wrap():T,d)}n._fireMoveEvents(r)}),(function(t){n._afterEase(r,t)}),e),this},r.prototype._prepareEase=function(e,r,n){void 0===n&&(n={}),this._moving=!0,r||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e,r){if(!this._easeId||!r||this._easeId!==r){delete this._easeId;var n=this._zooming,a=this._rotating,i=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),a&&this.fire(new t.Event("rotateend",e)),i&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},r.prototype.flyTo=function(e,r){var n=this;if(!e.essential&&t.browser.prefersReducedMotion){var a=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(a,r)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var i=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),c=this.getPadding(),u="zoom"in e?t.clamp(+e.zoom,i.minZoom,i.maxZoom):o,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,f="pitch"in e?+e.pitch:l,p="padding"in e?e.padding:i.padding,d=i.zoomScale(u-o),g=t.Point.convert(e.offset),m=i.centerPoint.add(g),v=i.pointLocation(m),y=t.LngLat.convert(e.center||v);this._normalizeCenter(y);var x=i.project(v),b=i.project(y).sub(x),_=e.curve,w=Math.max(i.width,i.height),T=w/d,k=b.mag();if("minZoom"in e){var M=t.clamp(Math.min(e.minZoom,o,u),i.minZoom,i.maxZoom),A=w/i.zoomScale(M-o);_=Math.sqrt(A/k*2)}var S=_*_;function E(t){var e=(T*T-w*w+(t?-1:1)*S*S*k*k)/(2*(t?T:w)*S*k);return Math.log(Math.sqrt(e*e+1)-e)}function C(t){return(Math.exp(t)-Math.exp(-t))/2}function L(t){return(Math.exp(t)+Math.exp(-t))/2}var P=E(0),I=function(t){return L(P)/L(P+_*t)},z=function(t){return w*((L(P)*(C(e=P+_*t)/L(e))-C(P))/S)/k;var e},O=(E(1)-P)/_;if(Math.abs(k)<1e-6||!isFinite(O)){if(Math.abs(w-T)<1e-6)return this.easeTo(e,r);var D=Te.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==h,this._pitching=f!==l,this._padding=!i.isPaddingEqual(p),this._prepareEase(r,!1),this._ease((function(e){var a=e*O,d=1/I(a);i.zoom=1===e?u:o+i.scaleZoom(d),n._rotating&&(i.bearing=t.number(s,h,e)),n._pitching&&(i.pitch=t.number(l,f,e)),n._padding&&(i.interpolatePadding(c,p,e),m=i.centerPoint.add(g));var v=1===e?y:i.unproject(x.add(b.mult(z(a))).mult(d));i.setLocationAtPoint(i.renderWorldCopies?v.wrap():v,m),n._fireMoveEvents(r)}),(function(){return n._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){return this._stop()},r.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}if(!t){var n=this.handlers;n&&n.stop()}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),va=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};va.prototype.getDefaultPosition=function(){return"bottom-right"},va.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._innerContainer=r.create("div","mapboxgl-ctrl-attrib-inner",this._container),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},va.prototype.onRemove=function(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},va.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var n=r.reduce((function(t,e,n){return e.value&&(t+=e.key+"="+e.value+(n=0)return!1;return!0}))).join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},va.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var ya=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};ya.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},ya.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},ya.prototype.getDefaultPosition=function(){return"bottom-left"},ya.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},ya.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},ya.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var xa=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};xa.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},xa.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var a=new wn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(n.call(this,a,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new xa,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},ba,e.locale),this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof wa))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return r._update(!1)})),this.on("moveend",(function(){return r._update(!1)})),this.on("zoom",(function(){return r._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1)),this.handlers=new ga(this,e),this._hash=e.hash&&new kn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new va({customAttribution:e.customAttribution})),this.addControl(new ya,e.logoPosition),this.on("style.load",(function(){r.transform.unmodified&&r.jumpTo(r.style.stylesheet)})),this.on("data",(function(e){r._update("style"===e.dataType),r.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){r.fire(new t.Event(e.dataType+"dataloading",e))}))}n&&(a.__proto__=n),(a.prototype=Object.create(n&&n.prototype)).constructor=a;var i={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return a.prototype._getMapId=function(){return this._mapId},a.prototype.addControl=function(e,r){if(void 0===r&&e.getDefaultPosition&&(r=e.getDefaultPosition()),void 0===r&&(r="top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var n=e.onAdd(this);this._controls.push(e);var a=this._controlPositions[r];return-1!==r.indexOf("bottom")?a.insertBefore(n,a.firstChild):a.appendChild(n),this},a.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},a.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],a=r[1];this._resizeCanvas(n,a),this.transform.resize(n,a),this.painter.resize(n,a);var i=!this._moving;return i&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),i&&this.fire(new t.Event("moveend",e)),this},a.prototype.getBounds=function(){return this.transform.getBounds()},a.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},a.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},a.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},a.prototype.getMaxZoom=function(){return this.transform.maxZoom},a.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},a.prototype.getMaxPitch=function(){return this.transform.maxPitch},a.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},a.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},a.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},a.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},a.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},a.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},a.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},a.prototype._createDelegatedListener=function(t,e,r){var n,a=this;if("mouseenter"===t||"mouseover"===t){var i=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var o=a.getLayer(e)?a.queryRenderedFeatures(n.point,{layers:[e]}):[];o.length?i||(i=!0,r.call(a,new zn(t,a,n.originalEvent,{features:o}))):i=!1},mouseout:function(){i=!1}}}}if("mouseleave"===t||"mouseout"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(a.getLayer(e)?a.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?o=!0:o&&(o=!1,r.call(a,new zn(t,a,n.originalEvent)))},mouseout:function(e){o&&(o=!1,r.call(a,new zn(t,a,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var n=a.getLayer(e)?a.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(a,t),delete t.features)},n)}},a.prototype.on=function(t,e,r){if(void 0===r)return n.prototype.on.call(this,t,e);var a=this._createDelegatedListener(t,e,r);for(var i in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(a),a.delegates)this.on(i,a.delegates[i]);return this},a.prototype.once=function(t,e,r){if(void 0===r)return n.prototype.once.call(this,t,e);var a=this._createDelegatedListener(t,e,r);for(var i in a.delegates)this.once(i,a.delegates[i]);return this},a.prototype.off=function(t,e,r){var a=this;return void 0===r?n.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(n){for(var i=n[t],o=0;o180;){var s=n.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}Ca.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag()},Ca.prototype.move=function(t,e){var r=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&r.setBearing(r.getBearing()+n.bearingDelta),this.mousePitch){var a=this.mousePitch.mousemoveWindow(t,e);a&&a.pitchDelta&&r.setPitch(r.getPitch()+a.pitchDelta)}},Ca.prototype.off=function(){var t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},Ca.prototype.offTemp=function(){r.enableDrag(),r.removeEventListener(t.window,"mousemove",this.mousemove),r.removeEventListener(t.window,"mouseup",this.mouseup)},Ca.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),r.mousePos(this.element,e)),r.addEventListener(t.window,"mousemove",this.mousemove),r.addEventListener(t.window,"mouseup",this.mouseup)},Ca.prototype.mousemove=function(t){this.move(t,r.mousePos(this.element,t))},Ca.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},Ca.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},Ca.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},Ca.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)e.getEast()||r.latitudee.getNorth())},n.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}},n.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},n.prototype._updateCamera=function(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,a=this._map.getBearing(),i=t.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(n),i,{geolocateSource:!0})},n.prototype._updateMarker=function(e){if(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},n.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),r=this._map.unproject([1,t]),n=e.distanceTo(r),a=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=a+"px",this._circleElement.style.height=a+"px"},n.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},n.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Fa)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},n.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},n.prototype._setupUI=function(e){var n=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=r.create("button","mapboxgl-ctrl-geolocate",this._container),r.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}else{var i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Oa(this._dotElement),this._circleElement=r.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Oa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==n._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(n._watchState="BACKGROUND",n._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),n._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),n.fire(new t.Event("trackuserlocationend")))}))},n.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ra--,Fa=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Ra>1?(e={maximumAge:6e5,timeout:0},Fa=!0):(e=this.options.positionOptions,Fa=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},n.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},n}(t.Evented),Na={maxWidth:100,unit:"metric"},ja=function(e){this.options=t.extend({},Na,e),t.bindAll(["_onMove","setUnit"],this)};function Ua(t,e,r){var n=r&&r.maxWidth||100,a=t._container.clientHeight/2,i=t.unproject([0,a]),o=t.unproject([n,a]),s=i.distanceTo(o);if(r&&"imperial"===r.unit){var l=3.2808*s;l>5280?Va(e,n,l/5280,t._getUIString("ScaleControl.Miles")):Va(e,n,l,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?Va(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Va(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):Va(e,n,s,t._getUIString("ScaleControl.Meters"))}function Va(t,e,r,n){var a,i,o,s=(a=r,(i=Math.pow(10,(""+Math.floor(a)).length-1))*(o=(o=a/i)>=10?10:o>=5?5:o>=3?3:o>=2?2:o>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(o)));t.style.width=e*(s/r)+"px",t.innerHTML=s+" "+n}ja.prototype.getDefaultPosition=function(){return"bottom-left"},ja.prototype._onMove=function(){Ua(this._map,this._container,this.options)},ja.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},ja.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},ja.prototype.setUnit=function(t){this.options.unit=t,Ua(this._map,this._container,this.options)};var qa=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};qa.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},qa.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},qa.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},qa.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},qa.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},qa.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},qa.prototype._isFullscreen=function(){return this._fullscreen},qa.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},qa.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Ha={closeButton:!0,closeOnClick:!0,className:"",maxWidth:"240px"},Ga=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(Ha),r),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},n.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},n.prototype.getElement=function(){return this._container},n.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.window.document.createDocumentFragment(),a=t.window.document.createElement("body");for(a.innerHTML=e;r=a.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},n.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},n.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},n.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},n.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},n.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},n.prototype._createContent=function(){this._content&&r.remove(this._content),this._content=r.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},n.prototype._onMouseUp=function(t){this._update(t.point)},n.prototype._onMouseMove=function(t){this._update(t.point)},n.prototype._onDrag=function(t){this._update(t.point)},n.prototype._update=function(e){var n=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return n._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=La(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var a=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),i=this.options.anchor,o=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(n,n),"top-right":new t.Point(-n,n),bottom:new t.Point(0,-r),"bottom-left":new t.Point(n,-n),"bottom-right":new t.Point(-n,-n),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var a=t.Point.convert(r);return{center:a,top:a,"top-left":a,"top-right":a,bottom:a,"bottom-left":a,"bottom-right":a,left:a,right:a}}return{center:t.Point.convert(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!i){var s,l=this._container.offsetWidth,c=this._container.offsetHeight;s=a.y+o.bottom.ythis._map.transform.height-c?["bottom"]:[],a.xthis._map.transform.width-l/2&&s.push("right"),i=0===s.length?"bottom":s.join("-")}var u=a.add(o[i]).round();r.setTransform(this._container,Pa[i]+" translate("+u.x+"px,"+u.y+"px)"),Ia(this._container,i,"popup")}},n.prototype._onClose=function(){this.remove()},n}(t.Evented),Ya={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Ma,NavigationControl:Ea,GeolocateControl:Ba,AttributionControl:va,ScaleControl:ja,FullscreenControl:qa,Popup:Ga,Marker:Oa,Style:qe,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Bt().acquire(Ot)},clearPrewarmedResources:function(){var t=Rt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Ot),Rt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Dt.workerCount},set workerCount(t){Dt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:""};return Ya})),r}))},{}],448:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1<p[1][2]&&(v[0]=-v[0]),p[0][2]>p[2][0]&&(v[1]=-v[1]),p[1][0]>p[0][1]&&(v[2]=-v[2]),!0}},{"./normalize":450,"gl-mat4/clone":272,"gl-mat4/create":273,"gl-mat4/determinant":274,"gl-mat4/invert":278,"gl-mat4/transpose":289,"gl-vec3/cross":339,"gl-vec3/dot":344,"gl-vec3/length":354,"gl-vec3/normalize":361}],450:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,a=0;a<16;a++)t[a]=e[a]*n;return!0}},{}],451:[function(t,e,r){var n=t("gl-vec3/lerp"),a=t("mat4-recompose"),i=t("mat4-decompose"),o=t("gl-mat4/determinant"),s=t("quat-slerp"),l=h(),c=h(),u=h();function h(){return{translate:f(),scale:f(1),skew:f(),perspective:[0,0,0,1],quaternion:[0,0,0,1]}}function f(t){return[t||0,t||0,t||0]}e.exports=function(t,e,r,h){if(0===o(e)||0===o(r))return!1;var f=i(e,l.translate,l.scale,l.skew,l.perspective,l.quaternion),p=i(r,c.translate,c.scale,c.skew,c.perspective,c.quaternion);return!(!f||!p)&&(n(u.translate,l.translate,c.translate,h),n(u.skew,l.skew,c.skew,h),n(u.scale,l.scale,c.scale,h),n(u.perspective,l.perspective,c.perspective,h),s(u.quaternion,l.quaternion,c.quaternion,h),a(t,u.translate,u.scale,u.skew,u.perspective,u.quaternion),!0)}},{"gl-mat4/determinant":274,"gl-vec3/lerp":355,"mat4-decompose":449,"mat4-recompose":452,"quat-slerp":501}],452:[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")},a=(n.create(),n.create());e.exports=function(t,e,r,i,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(a),0!==i[2]&&(a[9]=i[2],n.multiply(t,t,a)),0!==i[1]&&(a[9]=0,a[8]=i[1],n.multiply(t,t,a)),0!==i[0]&&(a[8]=0,a[4]=i[0],n.multiply(t,t,a)),n.scale(t,t,r),t}},{"gl-mat4/create":273,"gl-mat4/fromRotationTranslation":276,"gl-mat4/identity":277,"gl-mat4/multiply":280,"gl-mat4/scale":287,"gl-mat4/translate":288}],453:[function(t,e,r){"use strict";e.exports=Math.log2||function(t){return Math.log(t)*Math.LOG2E}},{}],454:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),a=t("mat4-interpolate"),i=t("gl-mat4/invert"),o=t("gl-mat4/rotateX"),s=t("gl-mat4/rotateY"),l=t("gl-mat4/rotateZ"),c=t("gl-mat4/lookAt"),u=t("gl-mat4/translate"),h=(t("gl-mat4/scale"),t("gl-vec3/normalize")),f=[0,0,0];function p(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 p((t=t||{}).matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};var d=p.prototype;d.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,c=0;c<16;++c)o[c]=s[l++];else{var u=e[r+1]-e[r],f=(l=16*r,this.prevMatrix),p=!0;for(c=0;c<16;++c)f[c]=s[l++];var d=this.nextMatrix;for(c=0;c<16;++c)d[c]=s[l++],p=p&&f[c]===d[c];if(u<1e-6||p)for(c=0;c<16;++c)o[c]=f[c];else a(o,f,d,(t-e[r])/u)}var g=this.computedUp;g[0]=o[1],g[1]=o[5],g[2]=o[9],h(g,g);var m=this.computedInverse;i(m,o);var v=this.computedEye,y=m[15];v[0]=m[12]/y,v[1]=m[13]/y,v[2]=m[14]/y;var x=this.computedCenter,b=Math.exp(this.computedRadius[0]);for(c=0;c<3;++c)x[c]=v[c]-o[2+4*c]*b}},d.idle=function(t){if(!(t1&&n(t[o[u-2]],t[o[u-1]],c)<=0;)u-=1,o.pop();for(o.push(l),u=s.length;u>1&&n(t[s[u-2]],t[s[u-1]],c)>=0;)u-=1,s.pop();s.push(l)}r=new Array(s.length+o.length-2);for(var h=0,f=(a=0,o.length);a0;--p)r[h++]=s[p];return r};var n=t("robust-orientation")[3]},{"robust-orientation":520}],457:[function(t,e,r){"use strict";e.exports=function(t,e){e||(e=t,t=window);var r=0,a=0,i=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 c(t,s){var c=n.x(s),u=n.y(s);"buttons"in s&&(t=0|s.buttons),(t!==r||c!==a||u!==i||l(s))&&(r=0|t,a=c||0,i=u||0,e&&e(r,a,i,o))}function u(t){c(0,t)}function h(){(r||a||i||o.shift||o.alt||o.meta||o.control)&&(a=i=0,r=0,o.shift=o.alt=o.control=o.meta=!1,e&&e(0,0,0,o))}function f(t){l(t)&&e&&e(r,a,i,o)}function p(t){0===n.buttons(t)?c(0,t):c(r,t)}function d(t){c(r|n.buttons(t),t)}function g(t){c(r&~n.buttons(t),t)}function m(){s||(s=!0,t.addEventListener("mousemove",p),t.addEventListener("mousedown",d),t.addEventListener("mouseup",g),t.addEventListener("mouseleave",u),t.addEventListener("mouseenter",u),t.addEventListener("mouseout",u),t.addEventListener("mouseover",u),t.addEventListener("blur",h),t.addEventListener("keyup",f),t.addEventListener("keydown",f),t.addEventListener("keypress",f),t!==window&&(window.addEventListener("blur",h),window.addEventListener("keyup",f),window.addEventListener("keydown",f),window.addEventListener("keypress",f)))}m();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return s},set:function(e){e?m():function(){if(!s)return;s=!1,t.removeEventListener("mousemove",p),t.removeEventListener("mousedown",d),t.removeEventListener("mouseup",g),t.removeEventListener("mouseleave",u),t.removeEventListener("mouseenter",u),t.removeEventListener("mouseout",u),t.removeEventListener("mouseover",u),t.removeEventListener("blur",h),t.removeEventListener("keyup",f),t.removeEventListener("keydown",f),t.removeEventListener("keypress",f),t!==window&&(window.removeEventListener("blur",h),window.removeEventListener("keyup",f),window.removeEventListener("keydown",f),window.removeEventListener("keypress",f))}()},enumerable:!0},buttons:{get:function(){return r},enumerable:!0},x:{get:function(){return a},enumerable:!0},y:{get:function(){return i},enumerable:!0},mods:{get:function(){return o},enumerable:!0}}),v};var n=t("mouse-event")},{"mouse-event":459}],458:[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 a=t.clientX||0,i=t.clientY||0,o=(s=e,s===window||s===document||s===document.body?n:s.getBoundingClientRect());var s;return r[0]=a-o.left,r[1]=i-o.top,r}},{}],459:[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 w=t.getters||[],T=new Array(b),k=0;k=0?T[k]=!0:T[k]=!1;return function(t,e,r,b,_,w){var T=w.length,k=_.length;if(k<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var M="extractContour"+_.join("_"),A=[],S=[],E=[],C=0;C0&&z.push(l(C,_[L-1])+"*"+s(_[L-1])),S.push(d(C,_[L])+"=("+z.join("-")+")|0")}for(C=0;C=0;--C)O.push(s(_[C]));S.push("Q=("+O.join("*")+")|0","P=mallocUint32(Q)","V=mallocUint32(Q)","X=0"),S.push(g(0)+"=0");for(L=1;L<1<0;_=_-1&d)x.push("V[X+"+v(_)+"]");x.push(y(0));for(_=0;_=0;--e)N(e,0);var r=[];for(e=0;e0){",p(_[e]),"=1;"),t(e-1,r|1<<_[e]);for(var n=0;n=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),i.push("1"),o.push("s["+l+"]-2"));var c=".lo("+i.join()+").hi("+o.join()+")";if(0===i.length&&(c=""),a>0){n.push("if(1");for(l=0;l=0||e.indexOf(-(l+1))>=0||n.push("&&s[",l,"]>2");n.push("){grad",a,"(src.pick(",s.join(),")",c);for(l=0;l=0||e.indexOf(-(l+1))>=0||n.push(",dst.pick(",s.join(),",",l,")",c);n.push(");")}for(l=0;l1){dst.set(",s.join(),",",u,",0.5*(src.get(",f.join(),")-src.get(",p.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):n.push("if(s[",u,"]>1){diff(",h,",src.pick(",f.join(),")",c,",src.pick(",p.join(),")",c,");}else{zero(",h,");};");break;case"mirror":0===a?n.push("dst.set(",s.join(),",",u,",0);"):n.push("zero(",h,");");break;case"wrap":var d=s.slice(),g=s.slice();e[l]<0?(d[u]="s["+u+"]-2",g[u]="0"):(d[u]="s["+u+"]-1",g[u]="1"),0===a?n.push("if(s[",u,"]>2){dst.set(",s.join(),",",u,",0.5*(src.get(",d.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):n.push("if(s[",u,"]>2){diff(",h,",src.pick(",d.join(),")",c,",src.pick(",g.join(),")",c,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}a>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 c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[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 u=["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:a,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":151}],465:[function(t,e,r){"use strict";var n=t("ndarray"),a=t("./doConvert.js");e.exports=function(t,e){for(var r=[],i=t,o=1;Array.isArray(i);)r.push(i.length),o*=i.length,i=i[0];return 0===r.length?n():(e||(e=n(new Float64Array(o),r)),a(e,t),e)}},{"./doConvert.js":466,ndarray:469}],466:[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":151}],467:[function(t,e,r){"use strict";var n=t("typedarray-pool"),a=32;function i(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",d,"=s",d,"-d",h,"*n",h].join("")):s.push(["d",d,"=s",d].join("")),h=d),0!==(p=t.length-1-l)&&(f>0?s.push(["e",p,"=s",p,"-e",f,"*n",f,",f",p,"=",c[p],"-f",f,"*n",f].join("")):s.push(["e",p,"=s",p,",f",p,"=",c[p]].join("")),f=p)}r.push("var "+s.join(","));var g=["0","n0-1","data","offset"].concat(o(t.length));r.push(["if(n0<=",a,"){","insertionSort(",g.join(","),")}else{","quickSort(",g.join(","),")}"].join("")),r.push("}return "+n);var m=new Function("insertionSort","quickSort",r.join("\n")),v=function(t,e){var r=["'use strict'"],n=["ndarrayInsertionSort",t.join("d"),e].join(""),a=["left","right","data","offset"].concat(o(t.length)),s=i(e),l=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var c=[],u=1;u1){r.push("dptr=0;sptr=ptr");for(u=t.length-1;u>=0;--u){0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"b){break __l}"].join(""));for(u=t.length-1;u>=1;--u)r.push("sptr+=e"+u,"dptr+=f"+u,"}");r.push("dptr=cptr;sptr=cptr-s0");for(u=t.length-1;u>=0;--u){0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"=0;--u){0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"scratch)){",f("cptr",h("cptr-s0")),"cptr-=s0","}",f("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)),c=i(e),u=0;n.push(["function ",s,"(",l.join(","),"){"].join(""));var h=["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 f=[],p=1;p=0;--i){0!==(o=t[i])&&n.push(["for(i",o,"=0;i",o,"1)for(i=0;i1?n.push("ptr_shift+=d"+o):n.push("ptr0+=d"+o),n.push("}"))}}function y(e,r,a,i){if(1===r.length)n.push("ptr0="+d(r[0]));else{for(var o=0;o1)for(o=0;o=1;--o)a&&n.push("pivot_ptr+=f"+o),r.length>1?n.push("ptr_shift+=e"+o):n.push("ptr0+=e"+o),n.push("}")}function x(){t.length>1&&c&&n.push("free(pivot1)","free(pivot2)")}function b(e,r){var a="el"+e,i="el"+r;if(t.length>1){var o="__l"+ ++u;y(o,[a,i],!1,["comp=",g("ptr0"),"-",g("ptr1"),"\n","if(comp>0){tmp0=",a,";",a,"=",i,";",i,"=tmp0;break ",o,"}\n","if(comp<0){break ",o,"}"].join(""))}else n.push(["if(",g(d(a)),">",g(d(i)),"){tmp0=",a,";",a,"=",i,";",i,"=tmp0}"].join(""))}function _(e,r){t.length>1?v([e,r],!1,m("ptr0",g("ptr1"))):n.push(m(d(e),g(d(r))))}function w(e,r,a){if(t.length>1){var i="__l"+ ++u;y(i,[r],!0,[e,"=",g("ptr0"),"-pivot",a,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else n.push([e,"=",g(d(r)),"-pivot",a].join(""))}function T(e,r){t.length>1?v([e,r],!1,["tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1","tmp")].join("")):n.push(["ptr0=",d(e),"\n","ptr1=",d(r),"\n","tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1","tmp")].join(""))}function k(e,r,a){t.length>1?(v([e,r,a],!1,["tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1",g("ptr2")),"\n",m("ptr2","tmp")].join("")),n.push("++"+r,"--"+a)):n.push(["ptr0=",d(e),"\n","ptr1=",d(r),"\n","ptr2=",d(a),"\n","++",r,"\n","--",a,"\n","tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1",g("ptr2")),"\n",m("ptr2","tmp")].join(""))}function M(t,e){T(t,e),n.push("--"+e)}function A(e,r,a){t.length>1?v([e,r],!0,[m("ptr0",g("ptr1")),"\n",m("ptr1",["pivot",a,"[pivot_ptr]"].join(""))].join("")):n.push(m(d(e),g(d(r))),m(d(r),"pivot"+a))}function S(e,r){n.push(["if((",r,"-",e,")<=",a,"){\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 E(e,r,a){t.length>1?(n.push(["__l",++u,":while(true){"].join("")),v([e],!0,["if(",g("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",u,"}"].join("")),n.push(a,"}")):n.push(["while(",g(d(e)),"===pivot",r,"){",a,"}"].join(""))}return n.push("var "+h.join(",")),b(1,2),b(4,5),b(1,3),b(2,3),b(1,4),b(3,4),b(2,5),b(2,3),b(4,5),t.length>1?v(["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",m("ptr5","x"),"\n",m("ptr6","y"),"\n",m("ptr7","z")].join("")):n.push(["pivot1=",g(d("el2")),"\n","pivot2=",g(d("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",g(d("el1")),"\n","y=",g(d("el3")),"\n","z=",g(d("el5")),"\n",m(d("index1"),"x"),"\n",m(d("index3"),"y"),"\n",m(d("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){"),T("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){"),k("k","less","great"),n.push("break"),n.push("}else{"),M("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){"),T("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){"),E("less",1,"++less"),E("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){"),T("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&&c?new Function("insertionSort","malloc","free",n.join("\n"))(r,c[0],c[1]):new Function("insertionSort",n.join("\n"))(r)}(t,e,v);return m(v,y)}},{"typedarray-pool":567}],468:[function(t,e,r){"use strict";var n=t("./lib/compile_sort.js"),a={};e.exports=function(t){var e=t.order,r=t.dtype,i=[e,r].join(":"),o=a[i];return o||(a[i]=o=n(e,r)),o(t),t}},{"./lib/compile_sort.js":467}],469:[function(t,e,r){var n=t("iota-array"),a=t("is-buffer"),i="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&&i.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];}}})")):i.push("ORDER})")),i.push("proto.set=function "+r+"_set("+l.join(",")+",v){"),a?i.push("return this.data.set("+u+",v)}"):i.push("return this.data["+u+"]=v}"),i.push("proto.get=function "+r+"_get("+l.join(",")+"){"),a?i.push("return this.data.get("+u+")}"):i.push("return this.data["+u+"]}"),i.push("proto.index=function "+r+"_index(",l.join(),"){return "+u+"}"),i.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 p=o.map((function(t){return"a"+t+"=this.shape["+t+"]"})),d=o.map((function(t){return"c"+t+"=this.stride["+t+"]"}));i.push("proto.lo=function "+r+"_lo("+l.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+d.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");i.push("return new "+r+"(this.data,"+o.map((function(t){return"a"+t})).join(",")+","+o.map((function(t){return"c"+t})).join(",")+",b)}"),i.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 i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.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",i.join("\n"))(c[t],s)}var c={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};e.exports=function(t,e,r,n){if(void 0===t)return(0,c.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,u=1;s>=0;--s)r[s]=u,u*=e[s]}if(void 0===n){n=0;for(s=0;st==t>0?i===-1>>>0?(r+=1,i=0):i+=1:0===i?(i=-1>>>0,r-=1):i-=1;return n.pack(i,r)}},{"double-bits":173}],471:[function(t,e,r){var n=Math.PI,a=c(120);function i(t,e,r,n){return["C",t,e,r,n,r,n]}function o(t,e,r,n,a,i){return["C",t/3+2/3*r,e/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}function s(t,e,r,i,o,c,u,h,f,p){if(p)T=p[0],k=p[1],_=p[2],w=p[3];else{var d=l(t,e,-o);t=d.x,e=d.y;var g=(t-(h=(d=l(h,f,-o)).x))/2,m=(e-(f=d.y))/2,v=g*g/(r*r)+m*m/(i*i);v>1&&(r*=v=Math.sqrt(v),i*=v);var y=r*r,x=i*i,b=(c==u?-1:1)*Math.sqrt(Math.abs((y*x-y*m*m-x*g*g)/(y*m*m+x*g*g)));b==1/0&&(b=1);var _=b*r*m/i+(t+h)/2,w=b*-i*g/r+(e+f)/2,T=Math.asin(((e-w)/i).toFixed(9)),k=Math.asin(((f-w)/i).toFixed(9));(T=t<_?n-T:T)<0&&(T=2*n+T),(k=h<_?n-k:k)<0&&(k=2*n+k),u&&T>k&&(T-=2*n),!u&&k>T&&(k-=2*n)}if(Math.abs(k-T)>a){var M=k,A=h,S=f;k=T+a*(u&&k>T?1:-1);var E=s(h=_+r*Math.cos(k),f=w+i*Math.sin(k),r,i,o,0,u,A,S,[k,M,_,w])}var C=Math.tan((k-T)/4),L=4/3*r*C,P=4/3*i*C,I=[2*t-(t+L*Math.sin(T)),2*e-(e-P*Math.cos(T)),h+L*Math.sin(k),f-P*Math.cos(k),h,f];if(p)return I;E&&(I=I.concat(E));for(var z=0;z7&&(r.push(v.splice(0,7)),v.unshift("C"));break;case"S":var x=p,b=d;"C"!=e&&"S"!=e||(x+=x-n,b+=b-a),v=["C",x,b,v[1],v[2],v[3],v[4]];break;case"T":"Q"==e||"T"==e?(h=2*p-h,f=2*d-f):(h=p,f=d),v=o(p,d,h,f,v[1],v[2]);break;case"Q":h=v[1],f=v[2],v=o(p,d,v[1],v[2],v[3],v[4]);break;case"L":v=i(p,d,v[1],v[2]);break;case"H":v=i(p,d,v[1],d);break;case"V":v=i(p,d,p,v[1]);break;case"Z":v=i(p,d,l,u)}e=y,p=v[v.length-2],d=v[v.length-1],v.length>4?(n=v[v.length-4],a=v[v.length-3]):(n=p,a=d),r.push(v)}return r}},{}],472:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,a=new Array(n),i=void 0===r?1e-6:r,o=0;oi){var b=a[c],_=1/Math.sqrt(m*y);for(x=0;x<3;++x){var w=(x+1)%3,T=(x+2)%3;b[x]+=_*(v[w]*g[T]-v[T]*g[w])}}}for(o=0;oi)for(_=1/Math.sqrt(k),x=0;x<3;++x)b[x]*=_;else for(x=0;x<3;++x)b[x]=0}return a},r.faceNormals=function(t,e,r){for(var n=t.length,a=new Array(n),i=void 0===r?1e-6:r,o=0;oi?1/Math.sqrt(p):0;for(c=0;c<3;++c)f[c]*=p;a[o]=f}return a}},{}],473:[function(t,e,r){ +e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],466:[function(t,e,r){"use strict";e.exports="undefined"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion))},{}],467:[function(t,e,r){"use strict";e.exports=a,e.exports.isMobile=a,e.exports.default=a;var n=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function a(t){t||(t={});var e=t.ua;if(e||"undefined"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&"string"==typeof e.headers["user-agent"]&&(e=e.headers["user-agent"]),"string"!=typeof e)return!1;var r=t.tablet?i.test(e):n.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf("Macintosh")&&-1!==e.indexOf("Safari")&&(r=!0),r}},{}],468:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],469:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],470:[function(t,e,r){"use strict";e.exports=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}},{}],471:[function(t,e,r){"use strict";e.exports=function(t){return"string"==typeof t&&(t=t.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(t)&&/[\dz]$/i.test(t)&&t.length>4))}},{}],472:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],473:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():(t=t||self).mapboxgl=n()}(this,(function(){"use strict";var t,e,r;function n(n,i){if(t)if(e){var a="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),(r=i(o)).workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"}))}else e=i;else t=i}return n(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,a,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)(n=1))return n;for(;ra?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=a;function a(t,e){this.x=t,this.y=e}function o(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(t){return t instanceof a?t:Array.isArray(t)?new a(t[0],t[1]):t};var s=o(.25,.1,.25,1);function l(t,e,r){return Math.min(r,Math.max(e,t))}function c(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function u(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function d(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function g(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function m(t,e){return-1!==t.indexOf(e,t.length-e.length)}function v(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function y(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function x(t){return Array.isArray(t)?t.map(x):"object"==typeof t&&t?v(t,x):t}var b={};function _(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function w(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function T(t){for(var e=0,r=0,n=t.length,i=n-1,a=void 0,o=void 0;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var a=n||i;return e[r]=!a||a.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var A=null;function S(t){if(null==A){var e=t.navigator?t.navigator.userAgent:null;A=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return A}function E(t){try{var e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var C,L,I,P,z=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),O=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,D=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,R={now:z,frame:function(t){var e=O(t);return{cancel:function(){return D(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=self.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return C||(C=self.document.createElement("a")),C.href=t,C.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio},get prefersReducedMotion(){return!!self.matchMedia&&(null==L&&(L=self.matchMedia("(prefers-reduced-motion: reduce)")),L.matches)}},F={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},B={supported:!1,testSupport:function(t){!N&&P&&(j?U(t):I=t)}},N=!1,j=!1;function U(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,P),t.isContextLost())return;B.supported=!0}catch(t){}t.deleteTexture(e),N=!0}self.document&&((P=self.document.createElement("img")).onload=function(){I&&U(I),I=null,j=!0},P.onerror=function(){N=!0,I=null},P.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var V="01",q=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function H(t){return 0===t.indexOf("mapbox:")}q.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",V,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},q.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},q.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},q.prototype.normalizeStyleURL=function(t,e){if(!H(t))return t;var r=X(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeGlyphsURL=function(t,e){if(!H(t))return t;var r=X(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSourceURL=function(t,e){if(!H(t))return t;var r=X(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSpriteURL=function(t,e,r,n){var i=X(t);return H(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,Z(i))},q.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!H(t))return t;var r=X(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(R.devicePixelRatio>=2||512===e?"@2x":"")+(B.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e=1&&self.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){_("Unable to write to LocalStorage")}},K.prototype.processRequests=function(t){},K.prototype.postEvent=function(t,e,r,n){var i=this;if(F.EVENTS_URL){var a=X(F.EVENTS_URL);a.params.push("access_token="+(n||F.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.10.1",skuId:V,userId:this.anonId},s=e?u(o,e):o,l={url:Z(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=xt(l,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n)}))}},K.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var Q,$,tt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(F.EVENTS_URL&&n||F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||Y(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,i=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),d(this.anonId)||(this.anonId=p()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}(K),et=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){F.EVENTS_URL&&F.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||Y(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=J(F.ACCESS_TOKEN),n=r?r.u:F.ACCESS_TOKEN,i=n!==this.eventData.tokenU;d(this.anonId)||(this.anonId=p(),i=!0);var a=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),s=new Date(a),l=(a-this.eventData.lastSuccess)/864e5;i=i||l>=1||l<-1||o.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(a,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=a,e.eventData.tokenU=n)}),t)}},e}(K)),rt=et.postTurnstileEvent.bind(et),nt=new tt,it=nt.postMapLoadEvent.bind(nt),at=500,ot=50;function st(){self.caches&&!Q&&(Q=self.caches.open("mapbox-tiles"))}function lt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ct,ut=1/0;function ft(){return null==ct&&(ct=self.OffscreenCanvas&&new self.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),ct}var ht={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ht);var pt,dt,gt=function(t){function e(e,r,n){401===r&&Y(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=r,this.url=n,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),mt=k()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===self.location.protocol?self.parent:self).location.href},vt=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(mt())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&self.Request.prototype.hasOwnProperty("signal"))return function(t,e){var r,n=new self.AbortController,i=new self.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:mt(),signal:n.signal}),a=!1,o=!1,s=(r=i.url).indexOf("sku=")>0&&Y(r);"json"===t.type&&i.headers.set("Accept","application/json");var l=function(r,n,a){if(!o){if(r&&"SecurityError"!==r.message&&_(r),n&&a)return c(n);var l=Date.now();self.fetch(i).then((function(r){if(r.ok){var n=s?r.clone():null;return c(r,n,l)}return e(new gt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},c=function(r,n,s){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){o||(n&&s&&function(t,e,r){if(st(),Q){var n={status:e.status,statusText:e.statusText,headers:new self.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var i=M(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===$)try{new Response(new ReadableStream),$=!0}catch(t){$=!1}$?e(t.body):t.blob().then(e)}(e,(function(e){var r=new self.Response(e,n);st(),Q&&Q.then((function(e){return e.put(lt(t.url),r)})).catch((function(t){return _(t.message)}))})))}}(i,n,s),a=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){o||e(new Error(t.message))}))};return s?function(t,e){if(st(),!Q)return e(null);var r=lt(t.url);Q.then((function(t){t.match(r).then((function(n){var i=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),r=M(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i)})).catch(e)})).catch(e)}(i,l):l(null,null),{cancel:function(){o=!0,a||n.abort()}}}(t,e);if(k()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){var r=new self.XMLHttpRequest;for(var n in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(n,t.headers[n]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new gt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},yt=function(t,e){return vt(u(t,{type:"arrayBuffer"}),e)},xt=function(t,e){return vt(u(t,{method:"POST"}),e)};pt=[],dt=0;var bt=function(t,e){if(B.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),dt>=F.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return pt.push(r),r}dt++;var n=!1,i=function(){if(!n)for(n=!0,dt--;pt.length&&dt0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},Mt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var At={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},St=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function Et(t){var e=t.value;return e?[new St(t.key,e,"constants have been deprecated as of v8")]:[]}function Ct(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Yt=[Ot,Dt,Rt,Ft,Bt,Vt,Nt,Ht(jt),qt];function Wt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Wt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=Yt;r255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=s.indexOf("("),c=s.indexOf(")");if(-1!==l&&c+1===s.length){var u=s.substr(0,l),f=s.substr(l+1,c-(l+1)).split(","),h=1;switch(u){case"rgba":if(4!==f.length)return null;h=a(f.pop());case"rgb":return 3!==f.length?null:[i(f[0]),i(f[1]),i(f[2]),h];case"hsla":if(4!==f.length)return null;h=a(f.pop());case"hsl":if(3!==f.length)return null;var p=(parseFloat(f[0])%360+360)%360/360,d=a(f[1]),g=a(f[2]),m=g<=.5?g*(d+1):g+d-g*d,v=2*g-m;return[n(255*o(v,m,p+1/3)),n(255*o(v,m,p)),n(255*o(v,m,p-1/3)),h];default:return null}}return null}}catch(t){}})).parseCSSColor,Kt=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};Kt.parse=function(t){if(t){if(t instanceof Kt)return t;if("string"==typeof t){var e=Jt(t);if(e)return new Kt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Kt.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},Kt.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},Kt.black=new Kt(0,0,0,1),Kt.white=new Kt(1,1,1,1),Kt.transparent=new Kt(0,0,0,0),Kt.red=new Kt(1,0,0,1);var Qt=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Qt.prototype.compare=function(t,e){return this.collator.compare(t,e)},Qt.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var $t=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i},te=function(t){this.sections=t};te.fromString=function(t){return new te([new $t(t,null,null,null,null)])},te.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},te.factory=function(t){return t instanceof te?t:te.fromString(t)},te.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},te.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ne(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof Kt)return!0;if(t instanceof Qt)return!0;if(t instanceof te)return!0;if(t instanceof ee)return!0;if(Array.isArray(t)){for(var e=0,r=t;e2){var s=t[1];if("string"!=typeof s||!(s in le)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);a=le[s],n++}else a=jt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++}r=Ht(a,o)}else r=le[i];for(var l=[];n1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var ue=function(t){this.type=Vt,this.sections=t};ue.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,a=1;a<=t.length-1;++a){var o=t[a];if(i&&"object"==typeof o&&!Array.isArray(o)){i=!1;var s=null;if(o["font-scale"]&&!(s=e.parse(o["font-scale"],1,Dt)))return null;var l=null;if(o["text-font"]&&!(l=e.parse(o["text-font"],1,Ht(Rt))))return null;var c=null;if(o["text-color"]&&!(c=e.parse(o["text-color"],1,Bt)))return null;var u=n[n.length-1];u.scale=s,u.font=l,u.textColor=c}else{var f=e.parse(t[a],1,jt);if(!f)return null;var h=f.type.kind;if("string"!==h&&"value"!==h&&"null"!==h&&"resolvedImage"!==h)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:f,scale:null,font:null,textColor:null})}}return new ue(n)},ue.prototype.evaluate=function(t){return new te(this.sections.map((function(e){var r=e.content.evaluate(t);return ie(r)===qt?new $t("",r,null,null,null):new $t(ae(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},ue.prototype.eachChild=function(t){for(var e=0,r=this.sections;e-1),r},fe.prototype.eachChild=function(t){t(this.input)},fe.prototype.outputDefined=function(){return!1},fe.prototype.serialize=function(){return["image",this.input.serialize()]};var he={"to-boolean":Ft,"to-color":Bt,"to-number":Dt,"to-string":Rt},pe=function(t,e){this.type=t,this.args=e};pe.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=he[r],i=[],a=1;a4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":re(e[0],e[1],e[2],e[3])))return new Kt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new se(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var o=null,s=0,l=this.args;s=e[2]||t[1]<=e[1]||t[3]>=e[3])}function be(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*8192),Math.round(n*i*8192)]}function _e(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function we(t,e){for(var r,n,i,a,o,s,l,c=!1,u=0,f=e.length;u0&&s<0||o<0&&s>0}function Me(t,e,r){for(var n=0,i=r;nr[2]){var i=.5*n,a=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;0===a&&(a=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=a}ye(e,t)}function Ie(t,e,r,n){for(var i=8192*Math.pow(2,n.z),a=[8192*n.x,8192*n.y],o=[],s=0,l=t;s=0)return!1;var r=!0;return t.eachChild((function(t){r&&!Re(t,e)&&(r=!1)})),r}ze.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(ne(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;ne))throw new se("Input is not a number.");a=o-1}return 0}Be.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},Be.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new ce(e,[t]):"coerce"===r?new pe(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var a=i.parse(t,this);if(!a)return null;if(this.expectedType){var o=this.expectedType,s=a.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==s.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(o,s))return null}else a=r(a,o,e.typeAnnotation||"coerce");else a=r(a,o,e.typeAnnotation||"assert")}if(!(a instanceof oe)&&"resolvedImage"!==a.type.kind&&function t(e){if(e instanceof Fe)return t(e.boundExpression);if(e instanceof me&&"error"===e.name)return!1;if(e instanceof ve)return!1;if(e instanceof ze)return!1;var r=e instanceof pe||e instanceof ce,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof oe})),!!n&&Oe(e)&&Re(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(a)){var l=new ge;try{a=new oe(a.type,a.evaluate(l))}catch(t){return this.error(t.message),null}}return a}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Be.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Be(this.registry,n,e||null,i,this.errors)},Be.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Pt(n,t))},Be.prototype.checkSubtype=function(t,e){var r=Wt(t,e);return r&&this.error(r),r};var je=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);var u=e.parse(s,c,i);if(!u)return null;i=i||u.type,n.push([o,u])}return new je(i,r,n)},je.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ne(e,n)].evaluate(t)},je.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ve=Object.freeze({__proto__:null,number:Ue,color:function(t,e,r){return new Kt(Ue(t.r,e.r,r),Ue(t.g,e.g,r),Ue(t.b,e.b,r),Ue(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return Ue(t,e[n],r)}))}}),qe=6/29*3*(6/29),He=Math.PI/180,Ge=180/Math.PI;function Ye(t){return t>.008856451679035631?Math.pow(t,1/3):t/qe+4/29}function We(t){return t>6/29?t*t*t:qe*(t-4/29)}function Xe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ze(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Je(t){var e=Ze(t.r),r=Ze(t.g),n=Ze(t.b),i=Ye((.4124564*e+.3575761*r+.1804375*n)/.95047),a=Ye((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*a-16,a:500*(i-a),b:200*(a-Ye((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function Ke(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*We(e),r=.95047*We(r),n=1.08883*We(n),new Kt(Xe(3.2404542*r-1.5371385*e-.4985314*n),Xe(-.969266*r+1.8760108*e+.041556*n),Xe(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function Qe(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var $e={forward:Je,reverse:Ke,interpolate:function(t,e,r){return{l:Ue(t.l,e.l,r),a:Ue(t.a,e.a,r),b:Ue(t.b,e.b,r),alpha:Ue(t.alpha,e.alpha,r)}}},tr={forward:function(t){var e=Je(t),r=e.l,n=e.a,i=e.b,a=Math.atan2(i,n)*Ge;return{h:a<0?a+360:a,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*He,r=t.c;return Ke({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:Qe(t.h,e.h,r),c:Ue(t.c,e.c,r),l:Ue(t.l,e.l,r),alpha:Ue(t.alpha,e.alpha,r)}}},er=Object.freeze({__proto__:null,lab:$e,hcl:tr}),rr=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var a=0,o=i;a1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Dt)))return null;var l=[],c=null;"interpolate-hcl"===r||"interpolate-lab"===r?c=Bt:e.expectedType&&"value"!==e.expectedType.kind&&(c=e.expectedType);for(var u=0;u=f)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);var g=e.parse(h,d,c);if(!g)return null;c=c||g.type,l.push([f,g])}return"number"===c.kind||"color"===c.kind||"array"===c.kind&&"number"===c.itemType.kind&&"number"==typeof c.N?new rr(c,r,n,i,l):e.error("Type "+Gt(c)+" is not interpolatable.")},rr.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var a=Ne(e,n),o=rr.interpolationFactor(this.interpolation,n,e[a],e[a+1]),s=r[a].evaluate(t),l=r[a+1].evaluate(t);return"interpolate"===this.operator?Ve[this.type.kind.toLowerCase()](s,l,o):"interpolate-hcl"===this.operator?tr.reverse(tr.interpolate(tr.forward(s),tr.forward(l),o)):$e.reverse($e.interpolate($e.forward(s),$e.forward(l),o))},rr.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new se("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new se("Array index must be an integer, but found "+e+" instead.");return r[e]},or.prototype.eachChild=function(t){t(this.index),t(this.input)},or.prototype.outputDefined=function(){return!1},or.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var sr=function(t,e){this.type=Ft,this.needle=t,this.haystack=e};sr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,jt),n=e.parse(t[2],2,jt);return r&&n?Xt(r.type,[Ft,Rt,Dt,Ot,jt])?new sr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Gt(r.type)+" instead"):null},sr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Zt(e,["boolean","string","number","null"]))throw new se("Expected first argument to be of type boolean, string, number or null, but found "+Gt(ie(e))+" instead.");if(!Zt(r,["string","array"]))throw new se("Expected second argument to be of type array or string, but found "+Gt(ie(r))+" instead.");return r.indexOf(e)>=0},sr.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},sr.prototype.outputDefined=function(){return!0},sr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var lr=function(t,e,r){this.type=Dt,this.needle=t,this.haystack=e,this.fromIndex=r};lr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,jt),n=e.parse(t[2],2,jt);if(!r||!n)return null;if(!Xt(r.type,[Ft,Rt,Dt,Ot,jt]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Gt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Dt);return i?new lr(r,n,i):null}return new lr(r,n)},lr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Zt(e,["boolean","string","number","null"]))throw new se("Expected first argument to be of type boolean, string, number or null, but found "+Gt(ie(e))+" instead.");if(!Zt(r,["string","array"]))throw new se("Expected second argument to be of type array or string, but found "+Gt(ie(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},lr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},lr.prototype.outputDefined=function(){return!1},lr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var cr=function(t,e,r,n,i,a){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=a};cr.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},a=[],o=2;oNumber.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,ie(h)))return null}else r=ie(h);if(void 0!==i[String(h)])return c.error("Branch labels must be unique.");i[String(h)]=a.length}var p=e.parse(l,o,n);if(!p)return null;n=n||p.type,a.push(p)}var d=e.parse(t[1],1,jt);if(!d)return null;var g=e.parse(t[t.length-1],t.length-1,n);return g?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new cr(r,n,d,i,a,g):null},cr.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ie(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},cr.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},cr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},cr.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,a=Object.keys(this.cases).sort();i=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,jt),n=e.parse(t[2],2,Dt);if(!r||!n)return null;if(!Xt(r.type,[Ht(jt),Rt,jt]))return e.error("Expected first argument to be of type array or string, but found "+Gt(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Dt);return i?new fr(r.type,r,n,i):null}return new fr(r.type,r,n)},fr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Zt(e,["string","array"]))throw new se("Expected first argument to be of type array or string, but found "+Gt(ie(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},fr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},fr.prototype.outputDefined=function(){return!1},fr.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var gr=dr("==",(function(t,e,r){return e===r}),pr),mr=dr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!pr(0,e,r,n)})),vr=dr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),xr=dr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),br=dr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),_r=function(t,e,r,n,i){this.type=Rt,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i};_r.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Dt);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var i=null;if(n.locale&&!(i=e.parse(n.locale,1,Rt)))return null;var a=null;if(n.currency&&!(a=e.parse(n.currency,1,Rt)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Dt)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Dt))?null:new _r(r,i,a,o,s)},_r.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},_r.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},_r.prototype.outputDefined=function(){return!1},_r.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var wr=function(t){this.type=Dt,this.input=t};wr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Gt(r.type)+" instead."):new wr(r):null},wr.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new se("Expected value to be of type string or array, but found "+Gt(ie(e))+" instead.")},wr.prototype.eachChild=function(t){t(this.input)},wr.prototype.outputDefined=function(){return!1},wr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Tr={"==":gr,"!=":mr,">":yr,"<":vr,">=":br,"<=":xr,array:ce,at:or,boolean:ce,case:ur,coalesce:ir,collator:ve,format:ue,image:fe,in:sr,"index-of":lr,interpolate:rr,"interpolate-hcl":rr,"interpolate-lab":rr,length:wr,let:ar,literal:oe,match:cr,number:ce,"number-format":_r,object:ce,slice:fr,step:je,string:ce,"to-boolean":pe,"to-color":pe,"to-number":pe,"to-string":pe,var:Fe,within:ze};function kr(t,e){var r=e[0],n=e[1],i=e[2],a=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var o=a?a.evaluate(t):1,s=re(r,n,i,o);if(s)throw new se(s);return new Kt(r/255*o,n/255*o,i/255*o,o)}function Mr(t,e){return t in e}function Ar(t,e){var r=e[t];return void 0===r?null:r}function Sr(t){return{type:t}}function Er(t){return{result:"success",value:t}}function Cr(t){return{result:"error",value:t}}function Lr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ir(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Pr(t){return!!t.expression&&t.expression.interpolated}function zr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Or(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Dr(t){return t}function Rr(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Fr(t,e,r,n,i){return Rr(typeof r===i?n[r]:void 0,t.default,e.default)}function Br(t,e,r){if("number"!==zr(r))return Rr(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=Ne(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function Nr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==zr(r))return Rr(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var a=Ne(t.stops.map((function(t){return t[0]})),r),o=function(t,e,r,n){var i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],l=t.stops[a+1][1],c=Ve[e.type]||Dr;if(t.colorSpace&&"rgb"!==t.colorSpace){var u=er[t.colorSpace];c=function(t,e){return u.reverse(u.interpolate(u.forward(t),u.forward(e),o))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return c(r,n,o)}}:c(s,l,o)}function jr(t,e,r){return"color"===e.type?r=Kt.parse(r):"formatted"===e.type?r=te.fromString(r.toString()):"resolvedImage"===e.type?r=ee.fromString(r.toString()):zr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Rr(r,t.default,e.default)}me.register(Tr,{error:[{kind:"error"},[Rt],function(t,e){throw new se(e[0].evaluate(t))}],typeof:[Rt,[jt],function(t,e){return Gt(ie(e[0].evaluate(t)))}],"to-rgba":[Ht(Dt,4),[Bt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Bt,[Dt,Dt,Dt],kr],rgba:[Bt,[Dt,Dt,Dt,Dt],kr],has:{type:Ft,overloads:[[[Rt],function(t,e){return Mr(e[0].evaluate(t),t.properties())}],[[Rt,Nt],function(t,e){var r=e[1];return Mr(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:jt,overloads:[[[Rt],function(t,e){return Ar(e[0].evaluate(t),t.properties())}],[[Rt,Nt],function(t,e){var r=e[1];return Ar(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[jt,[Rt],function(t,e){return Ar(e[0].evaluate(t),t.featureState||{})}],properties:[Nt,[],function(t){return t.properties()}],"geometry-type":[Rt,[],function(t){return t.geometryType()}],id:[jt,[],function(t){return t.id()}],zoom:[Dt,[],function(t){return t.globals.zoom}],"heatmap-density":[Dt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Dt,[],function(t){return t.globals.lineProgress||0}],accumulated:[jt,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Dt,Sr(Dt),function(t,e){for(var r=0,n=0,i=e;n":[Ft,[Rt,jt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>a}],"filter-id->":[Ft,[jt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[Ft,[Rt,jt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[Ft,[jt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[Ft,[Rt,jt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[Ft,[jt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[Ft,[jt],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Ft,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Ft,[Ht(Rt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Ft,[Ht(jt)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Ft,[Rt,Ht(jt)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[Ft,[Rt,Ht(jt)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:Ft,overloads:[[[Ft,Ft],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Sr(Ft),function(t,e){for(var r=0,n=e;r0&&"string"==typeof t[0]&&t[0]in Tr}function qr(t,e){var r=new Be(Tr,[],e?function(t){var e={color:Bt,string:Rt,number:Dt,enum:Rt,boolean:Ft,formatted:Vt,resolvedImage:qt};return"array"===t.type?Ht(e[t.value]||jt,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Er(new Ur(n,e)):Cr(r.errors)}Ur.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)},Ur.prototype.evaluate=function(t,e,r,n,i,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{var o=this.expression.evaluate(this._evaluator);if(null==o||"number"==typeof o&&o!=o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new se("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(o)+" instead.");return o}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Hr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!De(e.expression)};Hr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)},Hr.prototype.evaluate=function(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)};var Gr=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!De(e.expression),this.interpolationType=n};function Yr(t,e){if("error"===(t=qr(t,e)).result)return t;var r=t.value.expression,n=Oe(r);if(!n&&!Lr(e))return Cr([new Pt("","data expressions not supported")]);var i=Re(r,["zoom"]);if(!i&&!Ir(e))return Cr([new Pt("","zoom expressions not supported")]);var a=function t(e){var r=null;if(e instanceof ar)r=t(e.result);else if(e instanceof ir)for(var n=0,i=e.args;nn.maximum?[new St(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function Kr(t){var e,r,n,i=t.valueSpec,a=Lt(t.value.type),o={},s="categorical"!==a&&void 0===t.value.property,l=!s,c="array"===zr(t.value.stops)&&"array"===zr(t.value.stops[0])&&"object"===zr(t.value.stops[0][0]),u=Xr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===a)return[new St(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Zr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:f})),"array"===zr(r)&&0===r.length&&e.push(new St(t.key,r,"array must have at least one stop")),e},default:function(t){return bn({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===a&&s&&u.push(new St(t.key,t.value,'missing required property "property"')),"identity"===a||t.value.stops||u.push(new St(t.key,t.value,'missing required property "stops"')),"exponential"===a&&t.valueSpec.expression&&!Pr(t.valueSpec)&&u.push(new St(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Lr(t.valueSpec)?u.push(new St(t.key,t.value,"property functions not supported")):s&&!Ir(t.valueSpec)&&u.push(new St(t.key,t.value,"zoom functions not supported"))),"categorical"!==a&&!c||void 0!==t.value.property||u.push(new St(t.key,t.value,'"property" property is required')),u;function f(t){var e=[],a=t.value,s=t.key;if("array"!==zr(a))return[new St(s,a,"array expected, "+zr(a)+" found")];if(2!==a.length)return[new St(s,a,"array length 2 expected, length "+a.length+" found")];if(c){if("object"!==zr(a[0]))return[new St(s,a,"object expected, "+zr(a[0])+" found")];if(void 0===a[0].zoom)return[new St(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new St(s,a,"object stop key must have value")];if(n&&n>Lt(a[0].zoom))return[new St(s,a[0].zoom,"stop zoom values must appear in ascending order")];Lt(a[0].zoom)!==n&&(n=Lt(a[0].zoom),r=void 0,o={}),e=e.concat(Xr({key:s+"[0]",value:a[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Jr,value:h}}))}else e=e.concat(h({key:s+"[0]",value:a[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},a));return Vr(It(a[1]))?e.concat([new St(s+"[1]",a[1],"expressions are not allowed in function stops.")]):e.concat(bn({key:s+"[1]",value:a[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function h(t,n){var s=zr(t.value),l=Lt(t.value),c=null!==t.value?t.value:n;if(e){if(s!==e)return[new St(t.key,c,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new St(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==a){var u="number expected, "+s+" found";return Lr(i)&&void 0===a&&(u+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new St(t.key,c,u)]}return"categorical"!==a||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==a&&"number"===s&&void 0!==r&&l=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function an(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?on(t[1],t[2],"=="):"!="===r?cn(on(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?on(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(an))):"all"===r?["all"].concat(t.slice(1).map(an)):"none"===r?["all"].concat(t.slice(1).map(an).map(cn)):"in"===r?sn(t[1],t.slice(2)):"!in"===r?cn(sn(t[1],t.slice(2))):"has"===r?ln(t[1]):"!has"===r?cn(ln(t[1])):"within"!==r||t}function on(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function sn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(nn)]]:["filter-in-small",t,["literal",e]]}}function ln(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function cn(t){return["!",t]}function un(t){return tn(It(t.value))?Qr(Ct({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==zr(r))return[new St(n,r,"array expected, "+zr(r)+" found")];var i,a=e.styleSpec,o=[];if(r.length<1)return[new St(n,r,"filter array must have at least 1 element")];switch(o=o.concat($r({key:n+"[0]",value:r[0],valueSpec:a.filter_operator,style:e.style,styleSpec:e.styleSpec})),Lt(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===Lt(r[1])&&o.push(new St(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&o.push(new St(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=zr(r[1]))&&o.push(new St(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s=u[p+0]&&n>=u[p+1])?(o[h]=!0,a.push(c[h])):o[h]=!1}}},In.prototype._forEachCell=function(t,e,r,n,i,a,o,s){for(var l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),u=this._convertToCellCoord(r),f=this._convertToCellCoord(n),h=l;h<=u;h++)for(var p=c;p<=f;p++){var d=this.d*p+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(p),this._convertFromCellCoord(h+1),this._convertFromCellCoord(p+1)))&&i.call(this,t,e,r,n,d,a,o,s))return}},In.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},In.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},In.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n=0)){var u=t[c];l[c]=On[s].shallow.indexOf(c)>=0?u:Nn(u,e)}t instanceof Error&&(l.message=t.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof t)}function jn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||Fn(t)||Bn(t)||ArrayBuffer.isView(t)||t instanceof Pn)return t;if(Array.isArray(t))return t.map(jn);if("object"==typeof t){var e=t.$name||"Object",r=On[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),i=0,a=Object.keys(t);i=0?s:jn(s)}}return n}throw new Error("can't deserialize object of type "+typeof t)}var Un=function(){this.first=!0};Un.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function qn(t){for(var e=0,r=t;e=65097&&t<=65103)||Vn["CJK Compatibility Ideographs"](t)||Vn["CJK Compatibility"](t)||Vn["CJK Radicals Supplement"](t)||Vn["CJK Strokes"](t)||!(!Vn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Vn["CJK Unified Ideographs Extension A"](t)||Vn["CJK Unified Ideographs"](t)||Vn["Enclosed CJK Letters and Months"](t)||Vn["Hangul Compatibility Jamo"](t)||Vn["Hangul Jamo Extended-A"](t)||Vn["Hangul Jamo Extended-B"](t)||Vn["Hangul Jamo"](t)||Vn["Hangul Syllables"](t)||Vn.Hiragana(t)||Vn["Ideographic Description Characters"](t)||Vn.Kanbun(t)||Vn["Kangxi Radicals"](t)||Vn["Katakana Phonetic Extensions"](t)||Vn.Katakana(t)&&12540!==t||!(!Vn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Vn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Vn["Unified Canadian Aboriginal Syllabics"](t)||Vn["Unified Canadian Aboriginal Syllabics Extended"](t)||Vn["Vertical Forms"](t)||Vn["Yijing Hexagram Symbols"](t)||Vn["Yi Syllables"](t)||Vn["Yi Radicals"](t))))}function Gn(t){return!(Hn(t)||function(t){return!!(Vn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Vn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Vn["Letterlike Symbols"](t)||Vn["Number Forms"](t)||Vn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Vn["Control Pictures"](t)&&9251!==t||Vn["Optical Character Recognition"](t)||Vn["Enclosed Alphanumerics"](t)||Vn["Geometric Shapes"](t)||Vn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Vn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vn["CJK Symbols and Punctuation"](t)||Vn.Katakana(t)||Vn["Private Use Area"](t)||Vn["CJK Compatibility Forms"](t)||Vn["Small Form Variants"](t)||Vn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Yn(t){return t>=1424&&t<=2303||Vn["Arabic Presentation Forms-A"](t)||Vn["Arabic Presentation Forms-B"](t)}function Wn(t,e){return!(!e&&Yn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Vn.Khmer(t))}function Xn(t){for(var e=0,r=t;e-1&&(Jn="error"),Zn&&Zn(t)};function $n(){ti.fire(new Tt("pluginStateChange",{pluginStatus:Jn,pluginURL:Kn}))}var ti=new Mt,ei=function(){return Jn},ri=function(){if("deferred"!==Jn||!Kn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Jn="loading",$n(),Kn&&yt({url:Kn},(function(t){t?Qn(t):(Jn="loaded",$n())}))},ni={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===Jn||null!=ni.applyArabicShaping},isLoading:function(){return"loading"===Jn},setState:function(t){Jn=t.pluginStatus,Kn=t.pluginURL},isParsed:function(){return null!=ni.applyArabicShaping&&null!=ni.processBidirectionalText&&null!=ni.processStyledBidirectionalText},getPluginURL:function(){return Kn}},ii=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Un,this.transition={})};ii.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var ai=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Or(t))return new Wr(t,e);if(Vr(t)){var r=Yr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return"string"==typeof t&&"color"===e.type&&(n=Kt.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification)};ai.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},ai.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var oi=function(t){this.property=t,this.value=new ai(t,void 0)};oi.prototype.transitioned=function(t,e){return new li(this.property,this.value,e,u({},t.transition,this.transition),t.now)},oi.prototype.untransitioned=function(){return new li(this.property,this.value,null,{},0)};var si=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};si.prototype.getValue=function(t){return x(this._values[t].value.value)},si.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new oi(this._values[t].property)),this._values[t].value=new ai(this._values[t].property,null===e?void 0:x(e))},si.prototype.getTransition=function(t){return x(this._values[t].transition)},si.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new oi(this._values[t].property)),this._values[t].transition=x(e)||void 0},si.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);ethis.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(o))}return i};var ci=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};ci.prototype.possiblyEvaluate=function(t,e,r){for(var n=new hi(this._properties),i=0,a=Object.keys(this._values);in.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(di),mi=function(t){this.specification=t};mi.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new ii(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ii(Math.floor(e.zoom),e)),t.expression.evaluate(new ii(Math.floor(e.zoom+1),e)),e)}},mi.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},mi.prototype.interpolate=function(t){return t};var vi=function(t){this.specification=t};vi.prototype.possiblyEvaluate=function(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)},vi.prototype.interpolate=function(){return!1};var yi=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new ai(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new oi(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};Dn("DataDrivenProperty",di),Dn("DataConstantProperty",pi),Dn("CrossFadedDataDrivenProperty",gi),Dn("CrossFadedProperty",mi),Dn("ColorRampProperty",vi);var xi=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=(e=e).metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new ui(r.layout)),r.paint)){for(var n in this._transitionablePaint=new si(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new hi(r.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){void 0===r&&(r={}),null!=e&&this._validate(En,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return m(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(Sn,"layers."+this.id+".paint."+t,t,e,r))return!1;if(m(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],a=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||a||i||this._handleOverridablePaintPropertyUpdate(t,o,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),y(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&Cn(this,t.call(Mn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:At,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof fi&&Lr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Mt),bi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},_i=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},wi=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Ti(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map((function(t){var i=bi[t.type].BYTES_PER_ELEMENT,a=r=ki(r,Math.max(e,i)),o=t.components||1;return n=Math.max(n,i),r+=i*o,{name:t.name,type:t.type,components:o,offset:a}})),size:ki(r,Math.max(n,e)),alignment:e}}function ki(t,e){return Math.ceil(t/e)*e}wi.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},wi.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},wi.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},wi.prototype.clear=function(){this.length=0},wi.prototype.resize=function(t){this.reserve(t),this.length=t},wi.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},wi.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Mi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(wi);Mi.prototype.bytesPerElement=4,Dn("StructArrayLayout2i4",Mi);var Ai=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,t},e}(wi);Ai.prototype.bytesPerElement=8,Dn("StructArrayLayout4i8",Ai);var Si=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(wi);Si.prototype.bytesPerElement=12,Dn("StructArrayLayout2i4i12",Si);var Ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=a,this.uint8[l+7]=o,t},e}(wi);Ei.prototype.bytesPerElement=8,Dn("StructArrayLayout2i4ub8",Ei);var Ci=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,c){var u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,a,o,s,l,c)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,c,u){var f=9*t,h=18*t;return this.uint16[f+0]=e,this.uint16[f+1]=r,this.uint16[f+2]=n,this.uint16[f+3]=i,this.uint16[f+4]=a,this.uint16[f+5]=o,this.uint16[f+6]=s,this.uint16[f+7]=l,this.uint8[h+16]=c,this.uint8[h+17]=u,t},e}(wi);Ci.prototype.bytesPerElement=18,Dn("StructArrayLayout8ui2ub18",Ci);var Li=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,c,u,f){var h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,a,o,s,l,c,u,f)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,c,u,f,h){var p=12*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=n,this.int16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=f,this.int16[p+11]=h,t},e}(wi);Li.prototype.bytesPerElement=24,Dn("StructArrayLayout4i4ui4i24",Li);var Ii=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(wi);Ii.prototype.bytesPerElement=12,Dn("StructArrayLayout3f12",Ii);var Pi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(wi);Pi.prototype.bytesPerElement=4,Dn("StructArrayLayout1ul4",Pi);var zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,a,o,s,l)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,c){var u=10*t,f=5*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=n,this.int16[u+3]=i,this.int16[u+4]=a,this.int16[u+5]=o,this.uint32[f+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,t},e}(wi);zi.prototype.bytesPerElement=20,Dn("StructArrayLayout6i1ul2ui20",zi);var Oi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,a)},e.prototype.emplace=function(t,e,r,n,i,a,o){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,t},e}(wi);Oi.prototype.bytesPerElement=12,Dn("StructArrayLayout2i2i2i12",Oi);var Di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i)},e.prototype.emplace=function(t,e,r,n,i,a){var o=4*t,s=8*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[s+6]=i,this.int16[s+7]=a,t},e}(wi);Di.prototype.bytesPerElement=16,Dn("StructArrayLayout2f1f2i16",Di);var Ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=12*t,o=3*t;return this.uint8[a+0]=e,this.uint8[a+1]=r,this.float32[o+1]=n,this.float32[o+2]=i,t},e}(wi);Ri.prototype.bytesPerElement=12,Dn("StructArrayLayout2ub2f12",Ri);var Fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(wi);Fi.prototype.bytesPerElement=6,Dn("StructArrayLayout3ui6",Fi);var Bi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m){var v=this.length;return this.resize(v+1),this.emplace(v,t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m,v){var y=24*t,x=12*t,b=48*t;return this.int16[y+0]=e,this.int16[y+1]=r,this.uint16[y+2]=n,this.uint16[y+3]=i,this.uint32[x+2]=a,this.uint32[x+3]=o,this.uint32[x+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=u,this.float32[x+7]=f,this.float32[x+8]=h,this.uint8[b+36]=p,this.uint8[b+37]=d,this.uint8[b+38]=g,this.uint32[x+10]=m,this.int16[y+22]=v,t},e}(wi);Bi.prototype.bytesPerElement=48,Dn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Bi);var Ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m,v,y,x,b,_,w,T,k,M,A,S){var E=this.length;return this.resize(E+1),this.emplace(E,t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m,v,y,x,b,_,w,T,k,M,A,S)},e.prototype.emplace=function(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m,v,y,x,b,_,w,T,k,M,A,S,E){var C=34*t,L=17*t;return this.int16[C+0]=e,this.int16[C+1]=r,this.int16[C+2]=n,this.int16[C+3]=i,this.int16[C+4]=a,this.int16[C+5]=o,this.int16[C+6]=s,this.int16[C+7]=l,this.uint16[C+8]=c,this.uint16[C+9]=u,this.uint16[C+10]=f,this.uint16[C+11]=h,this.uint16[C+12]=p,this.uint16[C+13]=d,this.uint16[C+14]=g,this.uint16[C+15]=m,this.uint16[C+16]=v,this.uint16[C+17]=y,this.uint16[C+18]=x,this.uint16[C+19]=b,this.uint16[C+20]=_,this.uint16[C+21]=w,this.uint16[C+22]=T,this.uint32[L+12]=k,this.float32[L+13]=M,this.float32[L+14]=A,this.float32[L+15]=S,this.float32[L+16]=E,t},e}(wi);Ni.prototype.bytesPerElement=68,Dn("StructArrayLayout8i15ui1ul4f68",Ni);var ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(wi);ji.prototype.bytesPerElement=4,Dn("StructArrayLayout1f4",ji);var Ui=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(wi);Ui.prototype.bytesPerElement=6,Dn("StructArrayLayout3i6",Ui);var Vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t},e}(wi);Vi.prototype.bytesPerElement=8,Dn("StructArrayLayout1ul2ui8",Vi);var qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(wi);qi.prototype.bytesPerElement=4,Dn("StructArrayLayout2ui4",qi);var Hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(wi);Hi.prototype.bytesPerElement=2,Dn("StructArrayLayout1ui2",Hi);var Gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(wi);Gi.prototype.bytesPerElement=8,Dn("StructArrayLayout2f8",Gi);var Yi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var a=4*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,t},e}(wi);Yi.prototype.bytesPerElement=16,Dn("StructArrayLayout4f16",Yi);var Wi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(_i);Wi.prototype.size=20;var Xi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Wi(this,t)},e}(zi);Dn("CollisionBoxArray",Xi);var Zi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(_i);Zi.prototype.size=48;var Ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Zi(this,t)},e}(Bi);Dn("PlacedSymbolArray",Ji);var Ki=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(_i);Ki.prototype.size=68;var Qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ki(this,t)},e}(Ni);Dn("SymbolInstanceArray",Qi);var $i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(ji);Dn("GlyphOffsetArray",$i);var ta=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(Ui);Dn("SymbolLineVertexArray",ta);var ea=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(_i);ea.prototype.size=8;var ra=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new ea(this,t)},e}(Vi);Dn("FeatureIndexArray",ra);var na=Ti([{name:"a_pos",components:2,type:"Int16"}],4).members,ia=function(t){void 0===t&&(t=[]),this.segments=t};function aa(t,e){return 256*(t=l(Math.floor(t),0,255))+l(Math.floor(e),0,255)}ia.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>ia.MAX_VERTEX_ARRAY_LENGTH&&_("Max vertices per segment is "+ia.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>ia.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i},ia.prototype.get=function(){return this.segments},ia.prototype.destroy=function(){for(var t=0,e=this.segments;t>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),la=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,a=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&t.charCodeAt(a+2))<<16;case 2:i^=(255&t.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),ca=sa,ua=la;ca.murmur3=sa,ca.murmur2=ua;var fa=function(){this.ids=[],this.positions=[],this.indexed=!1};fa.prototype.add=function(t,e,r,n){this.ids.push(pa(t)),this.positions.push(e,r,n)},fa.prototype.getPositions=function(t){for(var e=pa(t),r=0,n=this.ids.length-1;r>1;this.ids[i]>=e?n=i:r=i+1}for(var a=[];this.ids[r]===e;)a.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return a},fa.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,i){for(;n>1],o=n-1,s=i+1;;){do{o++}while(e[o]a);if(o>=s)break;da(e,o,s),da(r,3*o,3*s),da(r,3*o+1,3*s+1),da(r,3*o+2,3*s+2)}s-nOa.max||o.yOa.max)&&(_("Geometry exceeds allowed extent, reduce your vector tile buffer size"),o.x=l(o.x,Oa.min,Oa.max),o.y=l(o.y,Oa.min,Oa.max))}return r}function Ra(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var Fa=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Mi,this.indexArray=new Fi,this.segments=new ia,this.programConfigurations=new Ia(na,t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Ba(t,e){for(var r=0;r1){if(Va(t,e))return!0;for(var n=0;n1?r:r.sub(e)._mult(i)._add(e))}function Ya(t,e){for(var r,n,i,a=!1,o=0;oe.y!=(i=r[l]).y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);return a}function Wa(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}function Xa(t,e,r){var n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return!1;var a=w(t,e,r[0]);return a!==w(t,e,r[1])||a!==w(t,e,r[2])||a!==w(t,e,r[3])}function Za(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ja(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ka(t,e,r,n,a){if(!e[0]&&!e[1])return t;var o=i.convert(e)._mult(a);"viewport"===r&&o._rotate(-n);for(var s=[],l=0;l=8192||u<0||u>=8192)){var f=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),h=f.vertexLength;Ra(this.layoutVertexArray,c,u,-1,-1),Ra(this.layoutVertexArray,c,u,1,-1),Ra(this.layoutVertexArray,c,u,1,1),Ra(this.layoutVertexArray,c,u,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),f.vertexLength+=4,f.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)},Dn("CircleBucket",Fa,{omit:["layers"]});var Qa=new yi({"circle-sort-key":new di(At.layout_circle["circle-sort-key"])}),$a={paint:new yi({"circle-radius":new di(At.paint_circle["circle-radius"]),"circle-color":new di(At.paint_circle["circle-color"]),"circle-blur":new di(At.paint_circle["circle-blur"]),"circle-opacity":new di(At.paint_circle["circle-opacity"]),"circle-translate":new pi(At.paint_circle["circle-translate"]),"circle-translate-anchor":new pi(At.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new pi(At.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new pi(At.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new di(At.paint_circle["circle-stroke-width"]),"circle-stroke-color":new di(At.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new di(At.paint_circle["circle-stroke-opacity"])}),layout:Qa},to="undefined"!=typeof Float32Array?Float32Array:Array;function eo(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ro(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],f=e[8],h=e[9],p=e[10],d=e[11],g=e[12],m=e[13],v=e[14],y=e[15],x=r[0],b=r[1],_=r[2],w=r[3];return t[0]=x*n+b*s+_*f+w*g,t[1]=x*i+b*l+_*h+w*m,t[2]=x*a+b*c+_*p+w*v,t[3]=x*o+b*u+_*d+w*y,t[4]=(x=r[4])*n+(b=r[5])*s+(_=r[6])*f+(w=r[7])*g,t[5]=x*i+b*l+_*h+w*m,t[6]=x*a+b*c+_*p+w*v,t[7]=x*o+b*u+_*d+w*y,t[8]=(x=r[8])*n+(b=r[9])*s+(_=r[10])*f+(w=r[11])*g,t[9]=x*i+b*l+_*h+w*m,t[10]=x*a+b*c+_*p+w*v,t[11]=x*o+b*u+_*d+w*y,t[12]=(x=r[12])*n+(b=r[13])*s+(_=r[14])*f+(w=r[15])*g,t[13]=x*i+b*l+_*h+w*m,t[14]=x*a+b*c+_*p+w*v,t[15]=x*o+b*u+_*d+w*y,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var no,io=ro;function ao(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}no=new to(3),to!=Float32Array&&(no[0]=0,no[1]=0,no[2]=0),function(){var t=new to(4);to!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var oo=(function(){var t=new to(2);to!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,$a)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Fa(t)},e.prototype.queryRadius=function(t){var e=t;return Za("circle-radius",this,e)+Za("circle-stroke-width",this,e)+Ja(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,a,o,s){for(var l=Ka(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,o),c=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),u="map"===this.paint.get("circle-pitch-alignment"),f=u?l:function(t,e){return t.map((function(t){return so(t,e)}))}(l,s),h=u?c*o:c,p=0,d=n;pt.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,l=0;l80*r){n=a=t[0],i=o=t[1];for(var d=r;da&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-n,o-i))?1/c:0}return Ao(h,p,r,n,i,c),p}function ko(t,e,r,n,i){var a,o;if(i===Xo(t,e,r,n)>0)for(a=e;a=e;a-=n)o=Go(a,t[a],t[a+1],o);return o&&No(o,o.next)&&(Yo(o),o=o.next),o}function Mo(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!No(n,n.next)&&0!==Bo(n.prev,n,n.next))n=n.next;else{if(Yo(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function Ao(t,e,r,n,i,a,o){if(t){!o&&a&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Oo(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,c=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,c*=2}while(o>1)}(i)}(t,n,i,a);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?Eo(t,n,i,a):So(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),Yo(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?Ao(t=Co(Mo(t),e,r),e,r,n,i,a,2):2===o&&Lo(t,e,r,n,i,a):Ao(Mo(t),e,r,n,i,a,1);break}}}function So(t){var e=t.prev,r=t,n=t.next;if(Bo(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Ro(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Bo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Eo(t,e,r,n){var i=t.prev,a=t,o=t.next;if(Bo(i,a,o)>=0)return!1;for(var s=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,l=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,c=Oo(i.x=c&&h&&h.z<=u;){if(f!==t.prev&&f!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Bo(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,h!==t.prev&&h!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Bo(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Bo(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;h&&h.z<=u;){if(h!==t.prev&&h!==t.next&&Ro(i.x,i.y,a.x,a.y,o.x,o.y,h.x,h.y)&&Bo(h.prev,h,h.next)>=0)return!1;h=h.nextZ}return!0}function Co(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!No(i,a)&&jo(i,n,n.next,a)&&qo(i,a)&&qo(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),Yo(n),Yo(n.next),n=t=a),n=n.next}while(n!==t);return Mo(n)}function Lo(t,e,r,n,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Fo(o,s)){var l=Ho(o,s);return o=Mo(o,o.next),l=Mo(l,l.next),Ao(o,e,r,n,i,a),void Ao(l,e,r,n,i,a)}s=s.next}o=o.next}while(o!==t)}function Io(t,e){return t.x-e.x}function Po(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=u&&i!==n.x&&Ro(ar.x||n.x===r.x&&zo(r,n)))&&(r=n,h=l)),n=n.next}while(n!==c);return r}(t,e)){var r=Ho(e,t);Mo(e,e.next),Mo(r,r.next)}}function zo(t,e){return Bo(t.prev,t,e.prev)<0&&Bo(e.next,t,t.next)<0}function Oo(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Do(t){var e=t,r=t;do{(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function Fo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&jo(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(qo(t,e)&&qo(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Bo(t.prev,t,e.prev)||Bo(t,e.prev,e))||No(t,e)&&Bo(t.prev,t,t.next)>0&&Bo(e.prev,e,e.next)>0)}function Bo(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function No(t,e){return t.x===e.x&&t.y===e.y}function jo(t,e,r,n){var i=Vo(Bo(t,e,r)),a=Vo(Bo(t,e,n)),o=Vo(Bo(r,n,t)),s=Vo(Bo(r,n,e));return i!==a&&o!==s||!(0!==i||!Uo(t,r,e))||!(0!==a||!Uo(t,n,e))||!(0!==o||!Uo(r,t,n))||!(0!==s||!Uo(r,e,n))}function Uo(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Vo(t){return t>0?1:t<0?-1:0}function qo(t,e){return Bo(t.prev,t,t.next)<0?Bo(t,e,t.next)>=0&&Bo(t,t.prev,e)>=0:Bo(t,e,t.prev)<0||Bo(t,t.next,e)<0}function Ho(t,e){var r=new Wo(t.i,t.x,t.y),n=new Wo(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function Go(t,e,r,n){var i=new Wo(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Yo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Wo(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Xo(t,e,r,n){for(var i=0,a=e,o=r-n;an;){if(i-n>600){var o=i-n+1,s=r-n+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*c/o+u)),Math.min(i,Math.floor(r+(o-s)*c/o+u)),a)}var f=e[r],h=n,p=i;for(Jo(e,n,r),a(e[i],f)>0&&Jo(e,n,i);h0;)p--}0===a(e[n],f)?Jo(e,n,p):Jo(e,++p,i),p<=r&&(n=p+1),r<=p&&(i=p-1)}}(t,e,r||0,n||t.length-1,i||Ko)}function Jo(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Ko(t,e){return te?1:0}function Qo(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,a=[],o=0;o1)for(var l=0;l0&&r.holes.push(n+=t[i-1].length)}return r},_o.default=wo;var rs=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Mi,this.indexArray=new Fi,this.indexArray2=new qi,this.programConfigurations=new Ia(bo,t.layers,t.zoom),this.segments=new ia,this.segments2=new ia,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};rs.prototype.populate=function(t,e,r){this.hasPattern=ts("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),i=[],a=0,o=t;a>3}if(a--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&l.push(e),e=[]),e.push(new i(o,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&l.push(e),l},ls.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,a=0,o=1/0,s=-1/0,l=1/0,c=-1/0;t.pos>3}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(a+=t.readSVarint())c&&(c=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,c]},ls.prototype.toGeoJSON=function(t,e,r){var n,i,a=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,l=this.loadGeometry(),c=ls.types[this.type];function u(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function ds(t,e,r){if(3===t){var n=new fs(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}hs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new ss(this._pbf,e,this.extent,this._keys,this._values)};var gs={VectorTile:function(t,e){this.layers=t.readFields(ds,{},e)},VectorTileFeature:ss,VectorTileLayer:fs},ms=gs.VectorTileFeature.types,vs=Math.pow(2,13);function ys(t,e,r,n,i,a,o,s){t.emplaceBack(e,r,2*Math.floor(n*vs)+o,i*vs*2,a*vs*2,Math.round(s))}var xs=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Si,this.indexArray=new Fi,this.programConfigurations=new Ia(os,t.layers,t.zoom),this.segments=new ia,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function bs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}xs.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=ts("fill-extrusion",this.layers,e);for(var n=0,i=t;n8192}))||P.every((function(t){return t.y<0}))||P.every((function(t){return t.y>8192}))))for(var g=0,m=0;m=1){var y=d[m-1];if(!bs(v,y)){f.vertexLength+4>ia.MAX_VERTEX_ARRAY_LENGTH&&(f=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var x=v.sub(y)._perp()._unit(),b=y.dist(v);g+b>32768&&(g=0),ys(this.layoutVertexArray,v.x,v.y,x.x,x.y,0,0,g),ys(this.layoutVertexArray,v.x,v.y,x.x,x.y,0,1,g),ys(this.layoutVertexArray,y.x,y.y,x.x,x.y,0,0,g+=b),ys(this.layoutVertexArray,y.x,y.y,x.x,x.y,0,1,g);var _=f.vertexLength;this.indexArray.emplaceBack(_,_+2,_+1),this.indexArray.emplaceBack(_+1,_+2,_+3),f.vertexLength+=4,f.primitiveLength+=2}}}}if(f.vertexLength+l>ia.MAX_VERTEX_ARRAY_LENGTH&&(f=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),"Polygon"===ms[t.type]){for(var w=[],T=[],k=f.vertexLength,M=0,A=s;M=2&&t[l-1].equals(t[l-2]);)l--;for(var c=0;c0;if(T&&v>c){var M=u.dist(p);if(M>2*f){var A=u.sub(u.sub(p)._mult(f/M)._round());this.updateDistance(p,A),this.addCurrentVertex(A,g,0,0,h),p=A}}var S=p&&d,E=S?r:s?"butt":n;if(S&&"round"===E&&(_i&&(E="bevel"),"bevel"===E&&(_>2&&(E="flipbevel"),_100)y=m.mult(-1);else{var C=_*g.add(m).mag()/g.sub(m).mag();y._perp()._mult(C*(k?-1:1))}this.addCurrentVertex(u,y,0,0,h),this.addCurrentVertex(u,y.mult(-1),0,0,h)}else if("bevel"===E||"fakeround"===E){var L=-Math.sqrt(_*_-1),I=k?L:0,P=k?0:L;if(p&&this.addCurrentVertex(u,g,I,P,h),"fakeround"===E)for(var z=Math.round(180*w/Math.PI/20),O=1;O2*f){var j=u.add(d.sub(u)._mult(f/N)._round());this.updateDistance(u,j),this.addCurrentVertex(j,m,0,0,h),u=j}}}}},Cs.prototype.addCurrentVertex=function(t,e,r,n,i,a){void 0===a&&(a=!1);var o=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,a,!1,r,i),this.addHalfVertex(t,o,s,a,!0,-n,i),this.distance>Es/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,a))},Cs.prototype.addHalfVertex=function(t,e,r,n,i,a,o){var s=.5*this.scaledDistance;this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&s)<<2,s>>6);var l=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),o.primitiveLength++),i?this.e2=l:this.e1=l},Cs.prototype.updateScaledDistance=function(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(Es-1):this.distance},Cs.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},Dn("LineBucket",Cs,{omit:["layers","patternFeatures"]});var Ls=new yi({"line-cap":new pi(At.layout_line["line-cap"]),"line-join":new di(At.layout_line["line-join"]),"line-miter-limit":new pi(At.layout_line["line-miter-limit"]),"line-round-limit":new pi(At.layout_line["line-round-limit"]),"line-sort-key":new di(At.layout_line["line-sort-key"])}),Is={paint:new yi({"line-opacity":new di(At.paint_line["line-opacity"]),"line-color":new di(At.paint_line["line-color"]),"line-translate":new pi(At.paint_line["line-translate"]),"line-translate-anchor":new pi(At.paint_line["line-translate-anchor"]),"line-width":new di(At.paint_line["line-width"]),"line-gap-width":new di(At.paint_line["line-gap-width"]),"line-offset":new di(At.paint_line["line-offset"]),"line-blur":new di(At.paint_line["line-blur"]),"line-dasharray":new mi(At.paint_line["line-dasharray"]),"line-pattern":new gi(At.paint_line["line-pattern"]),"line-gradient":new vi(At.paint_line["line-gradient"])}),layout:Ls},Ps=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new ii(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=u({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(di))(Is.paint.properties["line-width"].specification);Ps.useIntegerZoom=!0;var zs=function(t){function e(e){t.call(this,e,Is)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){this.gradient=mo(this._transitionablePaint._values["line-gradient"].value.expression,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=Ps.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Cs(t)},e.prototype.queryRadius=function(t){var e=t,r=Os(Za("line-width",this,e),Za("line-gap-width",this,e)),n=Za("line-offset",this,e);return r/2+Math.abs(n)+Ja(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,a,o,s){var l=Ka(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),c=s/2*Os(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(n=function(t,e){for(var r=[],n=new i(0,0),a=0;a=3)for(var a=0;a0?e+2*t:t}var Ds=Ti([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Rs=Ti([{name:"a_projected_pos",components:3,type:"Float32"}],4),Fs=(Ti([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Ti([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Bs=(Ti([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ti([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Ns=Ti([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function js(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),ni.applyArabicShaping&&(t=ni.applyArabicShaping(t)),t}(t.text,e,r)})),t}Ti([{name:"triangle",components:3,type:"Uint16"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ti([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ti([{type:"Float32",name:"offsetX"}]),Ti([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Us={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"},Vs=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,u=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=256*a+t[e+f],f+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+f],f+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},qs=function(t,e,r,n,i,a){var o,s,l,c=8*a-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=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=u):(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>=u?(s=0,o=u):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+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*g},Hs=Gs;function Gs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Gs.Varint=0,Gs.Fixed64=1,Gs.Bytes=2,Gs.Fixed32=5;var Ys="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Ws(t){return t.type===Gs.Bytes?t.readVarint()+t.pos:t.pos+1}function Xs(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Zs(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Js(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function sl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ll(t,e,r){1===t&&r.readMessage(cl,e)}function cl(t,e,r){if(3===t){var n=r.readMessage(ul,{}),i=n.width,a=n.height,o=n.left,s=n.top,l=n.advance;e.push({id:n.id,bitmap:new ho({width:i+6,height:a+6},n.bitmap),metrics:{width:i,height:a,left:o,top:s,advance:l}})}}function ul(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function fl(t){for(var e=0,r=0,n=0,i=t;n=0;h--){var p=o[h];if(!(f.w>p.w||f.h>p.h)){if(f.x=p.x,f.y=p.y,l=Math.max(l,f.y+f.h),s=Math.max(s,f.x+f.w),f.w===p.w&&f.h===p.h){var d=o.pop();h>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=al(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=sl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=al(this.buf,this.pos)+4294967296*al(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=al(this.buf,this.pos)+4294967296*sl(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Vs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Vs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,a=r.buf;if(n=(112&(i=a[r.pos++]))>>4,i<128)return Xs(t,n,e);if(n|=(127&(i=a[r.pos++]))<<3,i<128)return Xs(t,n,e);if(n|=(127&(i=a[r.pos++]))<<10,i<128)return Xs(t,n,e);if(n|=(127&(i=a[r.pos++]))<<17,i<128)return Xs(t,n,e);if(n|=(127&(i=a[r.pos++]))<<24,i<128)return Xs(t,n,e);if(n|=(1&(i=a[r.pos++]))<<31,i<128)return Xs(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ys?function(t,e,r){return Ys.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+u>r)break;1===u?l<128&&(c=l):2===u?128==(192&(a=t[i+1]))&&(c=(31&l)<<6|63&a)<=127&&(c=null):3===u?(o=t[i+2],128==(192&(a=t[i+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&a)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(o=t[i+2],s=t[i+3],128==(192&(a=t[i+1]))&&128==(192&o)&&128==(192&s)&&((c=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),i+=u}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Gs.Bytes)return t.push(this.readVarint(e));var r=Ws(this);for(t=t||[];this.pos127;);else if(e===Gs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Gs.Fixed32)this.pos+=4;else{if(e!==Gs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Zs(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),qs(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),qs(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Zs(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,Gs.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Js,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Ks,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Qs,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,$s,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,il,e)},writeBytesField:function(t,e){this.writeTag(t,Gs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Gs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Gs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Gs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Gs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Gs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Gs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Gs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Gs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Gs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var hl=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,a=e.stretchY,o=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=a,this.content=o,this.version=n},pl={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};pl.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},pl.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},pl.tlbr.get=function(){return this.tl.concat(this.br)},pl.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(hl.prototype,pl);var dl=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var a=fl(i),o=new po({width:a.w||1,height:a.h||1});for(var s in t){var l=t[s],c=r[s].paddedRect;po.copy(l.data,o,{x:0,y:0},{x:c.x+1,y:c.y+1},l.data)}for(var u in e){var f=e[u],h=n[u].paddedRect,p=h.x+1,d=h.y+1,g=f.data.width,m=f.data.height;po.copy(f.data,o,{x:0,y:0},{x:p,y:d},f.data),po.copy(f.data,o,{x:0,y:m-1},{x:p,y:d-1},{width:g,height:1}),po.copy(f.data,o,{x:0,y:0},{x:p,y:d+m},{width:g,height:1}),po.copy(f.data,o,{x:g-1,y:0},{x:p-1,y:d},{width:1,height:m}),po.copy(f.data,o,{x:0,y:0},{x:p+g,y:d},{width:1,height:m})}this.image=o,this.iconPositions=r,this.patternPositions=n};dl.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(a),e[n]=new hl(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},dl.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},dl.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]})}},Dn("ImagePosition",hl),Dn("ImageAtlas",dl);var gl={horizontal:1,vertical:2,horizontalOnly:3},ml=function(){this.scale=1,this.fontStack="",this.imageName=null};ml.forText=function(t,e){var r=new ml;return r.scale=t||1,r.fontStack=e,r},ml.forImage=function(t){var e=new ml;return e.imageName=t,e};var vl=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function yl(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g){var m,v=vl.fromFeature(t,i);f===gl.vertical&&v.verticalizePunctuation();var y=ni.processBidirectionalText,x=ni.processStyledBidirectionalText;if(y&&1===v.sections.length){m=[];for(var b=0,_=y(v.toString(),Ml(v,c,a,e,n,p,d));b<_.length;b+=1){var w=_[b],T=new vl;T.text=w,T.sections=v.sections;for(var k=0;k0&&B>M&&(M=B)}else{var N=r[S.fontStack],j=N&&N[C];if(j&&j.rect)P=j.rect,I=j.metrics;else{var U=e[S.fontStack],V=U&&U[C];if(!V)continue;I=V.metrics}L=24*(_-S.scale)}D?(t.verticalizable=!0,k.push({glyph:C,imageName:z,x:h,y:p+L,vertical:D,scale:S.scale,fontStack:S.fontStack,sectionIndex:E,metrics:I,rect:P}),h+=O*S.scale+c):(k.push({glyph:C,imageName:z,x:h,y:p+L,vertical:D,scale:S.scale,fontStack:S.fontStack,sectionIndex:E,metrics:I,rect:P}),h+=I.advance*S.scale+c)}0!==k.length&&(d=Math.max(h-c,d),Sl(k,0,k.length-1,m,M)),h=0;var q=a*_+M;T.lineOffset=Math.max(M,w),p+=q,g=Math.max(q,g),++v}else p+=a,++v}var H,G=p- -17,Y=Al(o),W=Y.horizontalAlign,X=Y.verticalAlign;(function(t,e,r,n,i,a,o,s,l){var c,u=(e-r)*i;c=a!==o?-s*n- -17:(-n*l+.5)*o;for(var f=0,h=t;f=0&&n>=t&&xl[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},vl.prototype.substring=function(t,e){var r=new vl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},vl.prototype.toString=function(){return this.text},vl.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},vl.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(ml.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var xl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},bl={};function _l(t,e,r,n,i,a){if(e.imageName){var o=n[e.imageName];return o?o.displaySize[0]*e.scale*24/a+i:0}var s=r[e.fontStack],l=s&&s[t];return l?l.metrics.advance*e.scale+i:0}function wl(t,e,r,n){var i=Math.pow(t-e,2);return n?t=0,f=0,h=0;h-r/2;){if(--o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],c=0;sn;)c-=l.shift().angleDelta;if(c>i)return!1;o++,s+=u.dist(f)}return!0}function Dl(t){for(var e=0,r=0;rc){var d=(c-l)/p,g=Ue(f.x,h.x,d),m=Ue(f.y,h.y,d),v=new Cl(g,m,h.angleTo(f),u);return v._round(),!o||Ol(t,v,s,o,e)?v:void 0}l+=p}}function Nl(t,e,r,n,i,a,o,s,l){var c=Rl(n,a,o),u=Fl(n,i),f=u*o,h=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-f=0&&_=0&&w=0&&p+u<=f){var T=new Cl(_,w,x,g);T._round(),i&&!Ol(e,T,o,i,a)||d.push(T)}}h+=y}return l||d.length||s||(d=t(e,h/2,n,i,a,o,s,!0,c)),d}(t,h?e/2*s%e:(u/2+2*a)*o*s%e,e,c,r,f,h,!1,l)}function jl(t,e,r,n,a){for(var o=[],s=0;s=n&&h.x>=n||(f.x>=n?f=new i(n,f.y+(n-f.x)/(h.x-f.x)*(h.y-f.y))._round():h.x>=n&&(h=new i(n,f.y+(n-f.x)/(h.x-f.x)*(h.y-f.y))._round()),f.y>=a&&h.y>=a||(f.y>=a?f=new i(f.x+(a-f.y)/(h.y-f.y)*(h.x-f.x),a)._round():h.y>=a&&(h=new i(f.x+(a-f.y)/(h.y-f.y)*(h.x-f.x),a)._round()),c&&f.equals(c[c.length-1])||o.push(c=[f]),c.push(h)))))}return o}function Ul(t,e,r,n){var a=[],o=t.image,s=o.pixelRatio,l=o.paddedRect.w-2,c=o.paddedRect.h-2,u=t.right-t.left,f=t.bottom-t.top,h=o.stretchX||[[0,l]],p=o.stretchY||[[0,c]],d=function(t,e){return t+e[1]-e[0]},g=h.reduce(d,0),m=p.reduce(d,0),v=l-g,y=c-m,x=0,b=g,_=0,w=m,T=0,k=v,M=0,A=y;if(o.content&&n){var S=o.content;x=Vl(h,0,S[0]),_=Vl(p,0,S[1]),b=Vl(h,S[0],S[2]),w=Vl(p,S[1],S[3]),T=S[0]-x,M=S[1]-_,k=S[2]-S[0]-b,A=S[3]-S[1]-w}var E=function(n,a,l,c){var h=Hl(n.stretch-x,b,u,t.left),p=Gl(n.fixed-T,k,n.stretch,g),d=Hl(a.stretch-_,w,f,t.top),v=Gl(a.fixed-M,A,a.stretch,m),y=Hl(l.stretch-x,b,u,t.left),S=Gl(l.fixed-T,k,l.stretch,g),E=Hl(c.stretch-_,w,f,t.top),C=Gl(c.fixed-M,A,c.stretch,m),L=new i(h,d),I=new i(y,d),P=new i(y,E),z=new i(h,E),O=new i(p/s,v/s),D=new i(S/s,C/s),R=e*Math.PI/180;if(R){var F=Math.sin(R),B=Math.cos(R),N=[B,-F,F,B];L._matMult(N),I._matMult(N),z._matMult(N),P._matMult(N)}var j=n.stretch+n.fixed,U=a.stretch+a.fixed;return{tl:L,tr:I,bl:z,br:P,tex:{x:o.paddedRect.x+1+j,y:o.paddedRect.y+1+U,w:l.stretch+l.fixed-j,h:c.stretch+c.fixed-U},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:O,pixelOffsetBR:D,minFontScaleX:k/s/u,minFontScaleY:A/s/f,isSDF:r}};if(n&&(o.stretchX||o.stretchY))for(var C=ql(h,v,g),L=ql(p,y,m),I=0;I0&&(d=Math.max(10,d),this.circleDiameter=d)}else{var g=o.top*s-l,m=o.bottom*s+l,v=o.left*s-l,y=o.right*s+l,x=o.collisionPadding;if(x&&(v-=x[0]*s,g-=x[1]*s,y+=x[2]*s,m+=x[3]*s),u){var b=new i(v,g),_=new i(y,g),w=new i(v,m),T=new i(y,m),k=u*Math.PI/180;b._rotate(k),_._rotate(k),w._rotate(k),T._rotate(k),v=Math.min(b.x,_.x,w.x,T.x),y=Math.max(b.x,_.x,w.x,T.x),g=Math.min(b.y,_.y,w.y,T.y),m=Math.max(b.y,_.y,w.y,T.y)}t.emplaceBack(e.x,e.y,v,g,y,m,r,n,a)}this.boxEndIndex=t.length},Wl=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=Xl),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function Xl(t,e){return te?1:0}function Zl(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,a=1/0,o=-1/0,s=-1/0,l=t[0],c=0;co)&&(o=u.x),(!c||u.y>s)&&(s=u.y)}var f=Math.min(o-n,s-a),h=f/2,p=new Wl([],Jl);if(0===f)return new i(n,a);for(var d=n;dm.d||!m.d)&&(m=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,v)),y.max-m.d<=e||(p.push(new Kl(y.p.x-(h=y.h/2),y.p.y-h,h,t)),p.push(new Kl(y.p.x+h,y.p.y-h,h,t)),p.push(new Kl(y.p.x-h,y.p.y+h,h,t)),p.push(new Kl(y.p.x+h,y.p.y+h,h,t)),v+=4)}return r&&(console.log("num probes: "+v),console.log("best distance: "+m.d)),m.p}function Jl(t,e){return e.max-t.max}function Kl(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=u.y>t.y&&t.x<(u.x-c.x)*(t.y-c.y)/(u.y-c.y)+c.x&&(r=!r),n=Math.min(n,Ga(t,c,u))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}Wl.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},Wl.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},Wl.prototype.peek=function(){return this.data[0]},Wl.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i}e[t]=n},Wl.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=o,t=a}e[t]=i};var Ql=Number.POSITIVE_INFINITY;function $l(t,e){return e[1]!==Ql?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function tc(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function ec(t,e,r,n,a,o,s,l,c,u,f,h,p,d,g){var m=function(t,e,r,n,a,o,s,l){for(var c=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[],f=0,h=e.positionedLines;f32640&&_(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===v.kind&&((y=[128*d.compositeTextSizes[0].evaluate(s,{},g),128*d.compositeTextSizes[1].evaluate(s,{},g)])[0]>32640||y[1]>32640)&&_(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,m,y,l,o,s,u,e,c.lineStartIndex,c.lineLength,p,g);for(var x=0,b=f;x=0;o--)if(n.dist(a[o])0)&&("constant"!==a.value.kind||a.value.value.length>0),c="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,u=i.get("symbol-sort-key");if(this.features=[],l||c){for(var f=e.iconDependencies,h=e.glyphDependencies,p=e.availableImages,d=new ii(this.zoom),g=0,m=t;g=0;for(var z=0,O=k.sections;z=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var l=0;l0},fc.prototype.hasIconData=function(){return this.icon.segments.get().length>0},fc.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},fc.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},fc.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},fc.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Dn("SymbolBucket",fc,{omit:["layers","collisionBoxArray","features","compareText"]}),fc.MAX_GLYPHS=65535,fc.addDynamicAttributes=sc;var hc=new yi({"symbol-placement":new pi(At.layout_symbol["symbol-placement"]),"symbol-spacing":new pi(At.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new pi(At.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new di(At.layout_symbol["symbol-sort-key"]),"symbol-z-order":new pi(At.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new pi(At.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new pi(At.layout_symbol["icon-ignore-placement"]),"icon-optional":new pi(At.layout_symbol["icon-optional"]),"icon-rotation-alignment":new pi(At.layout_symbol["icon-rotation-alignment"]),"icon-size":new di(At.layout_symbol["icon-size"]),"icon-text-fit":new pi(At.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new pi(At.layout_symbol["icon-text-fit-padding"]),"icon-image":new di(At.layout_symbol["icon-image"]),"icon-rotate":new di(At.layout_symbol["icon-rotate"]),"icon-padding":new pi(At.layout_symbol["icon-padding"]),"icon-keep-upright":new pi(At.layout_symbol["icon-keep-upright"]),"icon-offset":new di(At.layout_symbol["icon-offset"]),"icon-anchor":new di(At.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new pi(At.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new pi(At.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new pi(At.layout_symbol["text-rotation-alignment"]),"text-field":new di(At.layout_symbol["text-field"]),"text-font":new di(At.layout_symbol["text-font"]),"text-size":new di(At.layout_symbol["text-size"]),"text-max-width":new di(At.layout_symbol["text-max-width"]),"text-line-height":new pi(At.layout_symbol["text-line-height"]),"text-letter-spacing":new di(At.layout_symbol["text-letter-spacing"]),"text-justify":new di(At.layout_symbol["text-justify"]),"text-radial-offset":new di(At.layout_symbol["text-radial-offset"]),"text-variable-anchor":new pi(At.layout_symbol["text-variable-anchor"]),"text-anchor":new di(At.layout_symbol["text-anchor"]),"text-max-angle":new pi(At.layout_symbol["text-max-angle"]),"text-writing-mode":new pi(At.layout_symbol["text-writing-mode"]),"text-rotate":new di(At.layout_symbol["text-rotate"]),"text-padding":new pi(At.layout_symbol["text-padding"]),"text-keep-upright":new pi(At.layout_symbol["text-keep-upright"]),"text-transform":new di(At.layout_symbol["text-transform"]),"text-offset":new di(At.layout_symbol["text-offset"]),"text-allow-overlap":new pi(At.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new pi(At.layout_symbol["text-ignore-placement"]),"text-optional":new pi(At.layout_symbol["text-optional"])}),pc={paint:new yi({"icon-opacity":new di(At.paint_symbol["icon-opacity"]),"icon-color":new di(At.paint_symbol["icon-color"]),"icon-halo-color":new di(At.paint_symbol["icon-halo-color"]),"icon-halo-width":new di(At.paint_symbol["icon-halo-width"]),"icon-halo-blur":new di(At.paint_symbol["icon-halo-blur"]),"icon-translate":new pi(At.paint_symbol["icon-translate"]),"icon-translate-anchor":new pi(At.paint_symbol["icon-translate-anchor"]),"text-opacity":new di(At.paint_symbol["text-opacity"]),"text-color":new di(At.paint_symbol["text-color"],{runtimeType:Bt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new di(At.paint_symbol["text-halo-color"]),"text-halo-width":new di(At.paint_symbol["text-halo-width"]),"text-halo-blur":new di(At.paint_symbol["text-halo-blur"]),"text-translate":new pi(At.paint_symbol["text-translate"]),"text-translate-anchor":new pi(At.paint_symbol["text-translate-anchor"])}),layout:hc},dc=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Ot,this.defaultValue=t};dc.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},dc.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},dc.prototype.outputDefined=function(){return!1},dc.prototype.serialize=function(){return null},Dn("FormatSectionOverride",dc,{omit:["defaultValue"]});var gc=function(t){function e(e){t.call(this,e,pc)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],a=0,o=n;a",targetMapId:n,sourceMapId:a.mapId})}}},Cc.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else k()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},Cc.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Cc.prototype.processTask=function(t,e){var r=this;if(""===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(jn(e.error)):n(null,jn(e.data)))}else{var i=!1,a=S(this.globalScope)?void 0:[],o=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"",sourceMapId:r.mapId,error:e?Nn(e):null,data:Nn(n,a)},a)}:function(t){i=!0},s=null,l=jn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,l,o);else if(this.parent.getWorkerSource){var c=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,c[0],l.source)[c[1]](l,o)}else o(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Cc.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Ic=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Ic.prototype.setNorthEast=function(t){return this._ne=t instanceof Pc?new Pc(t.lng,t.lat):Pc.convert(t),this},Ic.prototype.setSouthWest=function(t){return this._sw=t instanceof Pc?new Pc(t.lng,t.lat):Pc.convert(t),this},Ic.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof Pc)e=t,r=t;else{if(!(t instanceof Ic))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Ic.convert(t)):this.extend(Pc.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Pc(e.lng,e.lat),this._ne=new Pc(r.lng,r.lat)),this},Ic.prototype.getCenter=function(){return new Pc((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Ic.prototype.getSouthWest=function(){return this._sw},Ic.prototype.getNorthEast=function(){return this._ne},Ic.prototype.getNorthWest=function(){return new Pc(this.getWest(),this.getNorth())},Ic.prototype.getSouthEast=function(){return new Pc(this.getEast(),this.getSouth())},Ic.prototype.getWest=function(){return this._sw.lng},Ic.prototype.getSouth=function(){return this._sw.lat},Ic.prototype.getEast=function(){return this._ne.lng},Ic.prototype.getNorth=function(){return this._ne.lat},Ic.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Ic.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Ic.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Ic.prototype.contains=function(t){var e=Pc.convert(t),r=e.lng,n=e.lat,i=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i},Ic.convert=function(t){return!t||t instanceof Ic?t:new Ic(t)};var Pc=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Pc.prototype.wrap=function(){return new Pc(c(this.lng,-180,180),this.lat)},Pc.prototype.toArray=function(){return[this.lng,this.lat]},Pc.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Pc.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(i,1))},Pc.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Ic(new Pc(this.lng-r,this.lat-e),new Pc(this.lng+r,this.lat+e))},Pc.convert=function(t){if(t instanceof Pc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Pc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Pc(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var zc=2*Math.PI*6371008.8;function Oc(t){return zc*Math.cos(t*Math.PI/180)}function Dc(t){return(180+t)/360}function Rc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Fc(t,e){return t/Oc(e)}function Bc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Nc=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};Nc.fromLngLat=function(t,e){void 0===e&&(e=0);var r=Pc.convert(t);return new Nc(Dc(r.lng),Rc(r.lat),Fc(e,r.lat))},Nc.prototype.toLngLat=function(){return new Pc(360*this.x-180,Bc(this.y))},Nc.prototype.toAltitude=function(){return this.z*Oc(Bc(this.y))},Nc.prototype.meterInMercatorCoordinateUnits=function(){return 1/zc*(t=Bc(this.y),1/Math.cos(t*Math.PI/180));var t};var jc=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=qc(0,t,t,e,r)};jc.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},jc.prototype.url=function(t,e){var r,n,i,a,o,s=(n=this.y,i=this.z,a=Lc(256*(r=this.x),256*(n=Math.pow(2,i)-n-1),i),o=Lc(256*(r+1),256*(n+1),i),a[0]+","+a[1]+","+o[0]+","+o[1]),l=function(t,e,r){for(var n,i="",a=t;a>0;a--)i+=(e&(n=1<this.canonical.z?new Vc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Vc.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?qc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):qc(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Vc.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Vc.prototype.children=function(t){if(this.overscaledZ>=t)return[new Vc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Vc(e,this.wrap,e,r,n),new Vc(e,this.wrap,e,r+1,n),new Vc(e,this.wrap,e,r,n+1),new Vc(e,this.wrap,e,r+1,n+1)]},Vc.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Hc.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Hc.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Hc.prototype.getPixels=function(){return new po({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Hc.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,a=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:a=o-1;break;case 1:o=a+1}for(var s=-e*this.dim,l=-r*this.dim,c=a;c=0&&u[3]>=0&&s.insert(o,u[0],u[1],u[2],u[3])}},Zc.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new gs.VectorTile(new Hs(this.rawTileData)).layers,this.sourceLayerCoder=new Gc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Zc.prototype.query=function(t,e,r,n){var a=this;this.loadVTLayers();for(var o=t.params||{},s=8192/t.tileSize/t.scale,l=rn(o.filter),c=t.queryGeometry,u=t.queryPadding*s,f=Kc(c),h=this.grid.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u),p=Kc(t.cameraQueryGeometry),d=0,g=this.grid3D.query(p.minX-u,p.minY-u,p.maxX+u,p.maxY+u,(function(e,r,n,a){return function(t,e,r,n,a){for(var o=0,s=t;o=l.x&&a>=l.y)return!0}var c=[new i(e,r),new i(e,a),new i(n,a),new i(n,r)];if(t.length>2)for(var u=0,f=c;u=0)return!0;return!1}(a,f)){var h=this.sourceLayerCoder.decode(r),p=this.vtLayers[h].feature(n);if(i.filter(new ii(this.tileID.overscaledZ),p))for(var d=this.getId(p,h),g=0;gn)i=!1;else if(e)if(this.expirationTimeot&&(t.getActor().send("enforceCacheSizeLimit",at),ut=0)},t.clamp=l,t.clearTileCache=function(t){var e=self.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=jl,t.clone=function(t){var e=new to(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=x,t.clone$2=function(t){var e=new to(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Ns,t.config=F,t.create=function(){var t=new to(16);return to!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new to(9);return to!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new to(4);return to!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=qr,t.createLayout=Ti,t.createStyleLayer=function(t){return"custom"===t.type?new bc(t):new _c[t.type](t)},t.cross=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},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t},t.number=Ue,t.offscreenCanvasSupported=ft,t.ortho=function(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),c=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(o+a)*c,t[15]=1,t},t.parseGlyphPBF=function(t){return new Hs(t).readFields(ll,[])},t.pbf=Hs,t.performSymbolLayout=function(t,e,r,n,i,a,o){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,l=t.layers[0]._unevaluatedLayout._values,c={};if("composite"===t.textSizeData.kind){var u=t.textSizeData,f=u.maxZoom;c.compositeTextSizes=[l["text-size"].possiblyEvaluate(new ii(u.minZoom),o),l["text-size"].possiblyEvaluate(new ii(f),o)]}if("composite"===t.iconSizeData.kind){var h=t.iconSizeData,p=h.maxZoom;c.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new ii(h.minZoom),o),l["icon-size"].possiblyEvaluate(new ii(p),o)]}c.layoutTextSize=l["text-size"].possiblyEvaluate(new ii(t.zoom+1),o),c.layoutIconSize=l["icon-size"].possiblyEvaluate(new ii(t.zoom+1),o),c.textMaxSize=l["text-size"].possiblyEvaluate(new ii(18));for(var d=24*s.get("text-line-height"),g="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),m=s.get("text-keep-upright"),v=s.get("text-size"),y=function(){var a=b[x],l=s.get("text-font").evaluate(a,{},o).join(","),u=v.evaluate(a,{},o),f=c.layoutTextSize.evaluate(a,{},o),h=c.layoutIconSize.evaluate(a,{},o),p={horizontal:{},vertical:void 0},y=a.text,w=[0,0];if(y){var T=y.toString(),k=24*s.get("text-letter-spacing").evaluate(a,{},o),M=function(t){for(var e=0,r=t;e=8192||f.y<0||f.y>=8192||function(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m,v,y,x,b,w,T,k,M){var A,S,E,C,L,I=t.addToLineVertexArray(e,r),P=0,z=0,O=0,D=0,R=-1,F=-1,B={},N=ca(""),j=0,U=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(j=(A=s.layout.get("text-offset").evaluate(b,{},k).map((function(t){return 24*t})))[0],U=A[1]):(j=24*s.layout.get("text-radial-offset").evaluate(b,{},k),U=Ql),t.allowVerticalPlacement&&n.vertical){var V=s.layout.get("text-rotate").evaluate(b,{},k)+90;C=new Yl(l,e,c,u,f,n.vertical,h,p,d,V),o&&(L=new Yl(l,e,c,u,f,o,m,v,d,V))}if(i){var q=s.layout.get("icon-rotate").evaluate(b,{}),H="none"!==s.layout.get("icon-text-fit"),G=Ul(i,q,T,H),Y=o?Ul(o,q,T,H):void 0;E=new Yl(l,e,c,u,f,i,m,v,!1,q),P=4*G.length;var W=t.iconSizeData,X=null;"source"===W.kind?(X=[128*s.layout.get("icon-size").evaluate(b,{})])[0]>32640&&_(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===W.kind&&((X=[128*w.compositeIconSizes[0].evaluate(b,{},k),128*w.compositeIconSizes[1].evaluate(b,{},k)])[0]>32640||X[1]>32640)&&_(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,G,X,x,y,b,!1,e,I.lineStartIndex,I.lineLength,-1,k),R=t.icon.placedSymbolArray.length-1,Y&&(z=4*Y.length,t.addSymbols(t.icon,Y,X,x,y,b,gl.vertical,e,I.lineStartIndex,I.lineLength,-1,k),F=t.icon.placedSymbolArray.length-1)}for(var Z in n.horizontal){var J=n.horizontal[Z];if(!S){N=ca(J.text);var K=s.layout.get("text-rotate").evaluate(b,{},k);S=new Yl(l,e,c,u,f,J,h,p,d,K)}var Q=1===J.positionedLines.length;if(O+=ec(t,e,J,a,s,d,b,g,I,n.vertical?gl.horizontal:gl.horizontalOnly,Q?Object.keys(n.horizontal):[Z],B,R,w,k),Q)break}n.vertical&&(D+=ec(t,e,n.vertical,a,s,d,b,g,I,gl.vertical,["vertical"],B,F,w,k));var $=S?S.boxStartIndex:t.collisionBoxArray.length,tt=S?S.boxEndIndex:t.collisionBoxArray.length,et=C?C.boxStartIndex:t.collisionBoxArray.length,rt=C?C.boxEndIndex:t.collisionBoxArray.length,nt=E?E.boxStartIndex:t.collisionBoxArray.length,it=E?E.boxEndIndex:t.collisionBoxArray.length,at=L?L.boxStartIndex:t.collisionBoxArray.length,ot=L?L.boxEndIndex:t.collisionBoxArray.length,st=-1,lt=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=lt(S,st),st=lt(C,st),st=lt(E,st);var ct=(st=lt(L,st))>-1?1:0;ct&&(st*=M/24),t.glyphOffsetArray.length>=fc.MAX_GLYPHS&&_("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,R,F,N,$,tt,et,rt,nt,it,at,ot,c,O,D,P,z,ct,0,h,j,U,st)}(t,f,s,r,n,i,h,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,v,w,M,l,x,T,A,d,e,a,c,u,o)};if("line"===S)for(var I=0,P=jl(e.geometry,0,0,8192,8192);I1){var j=Bl(N,k,r.vertical||g,n,24,y);j&&L(N,j)}}else if("Polygon"===e.type)for(var U=0,V=Qo(e.geometry,0);U=E.maxzoom||"none"!==E.visibility&&(o(S,this.zoom,n),(g[E.id]=E.createBucket({index:u.bucketLayerIDs.length,layers:S,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:b,sourceID:this.source})).populate(_,m,this.tileID.canonical),u.bucketLayerIDs.push(S.map((function(t){return t.id}))))}}}var C=t.mapObject(m.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(C).length?a.send("getGlyphs",{uid:this.uid,stacks:C},(function(t,e){f||(f=t,h=e,P.call(l))})):h={};var L=Object.keys(m.iconDependencies);L.length?a.send("getImages",{icons:L,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){f||(f=t,p=e,P.call(l))})):p={};var I=Object.keys(m.patternDependencies);function P(){if(f)return s(f);if(h&&p&&d){var e=new i(h),r=new t.ImageAtlas(p,d);for(var a in g){var l=g[a];l instanceof t.SymbolBucket?(o(l.layers,this.zoom,n),t.performSymbolLayout(l,h,e.positions,p,r.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):l.hasPattern&&(l instanceof t.LineBucket||l instanceof t.FillBucket||l instanceof t.FillExtrusionBucket)&&(o(l.layers,this.zoom,n),l.addFeatures(m,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:t.values(g).filter((function(t){return!t.isEmpty()})),featureIndex:u,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?h:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?e.positions:null})}}I.length?a.send("getImages",{icons:I,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){f||(f=t,d=e,P.call(l))})):d={},P.call(this)};var l=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||s,this.loading={},this.loaded={}};l.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[i]=new a(e);s.abort=this.loadVectorData(e,(function(e,a){if(delete n.loading[i],e||!a)return s.status="done",n.loaded[i]=s,r(e);var l=a.rawData,c={};a.expires&&(c.expires=a.expires),a.cacheControl&&(c.cacheControl=a.cacheControl);var u={};if(o){var f=o.finish();f&&(u.resourceTiming=JSON.parse(JSON.stringify(f)))}s.vectorTile=a.vectorTile,s.parse(a.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:l.slice(0)},n,c,u))})),n.loaded=n.loaded||{},n.loaded[i]=s}))},l.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,i=t.uid,a=this;if(n&&n[i]){var o=n[i];o.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,a.layerIndex,r.availableImages,a.actor,i)),e(t,n)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},l.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},l.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var c=t.window.ImageBitmap,u=function(){this.loaded={}};function f(t,e){if(0!==t.length){h(t[0],e);for(var r=1;r=0!=!!e&&t.reverse()}u.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,a=e.rawImageData,o=c&&a instanceof c?this.getImageData(a):a,s=new t.DEMData(n,o,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)},u.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:r.width,height:r.height},r.data)},u.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var p=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function E(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,a=0,o=r.length,s=0;s>1;!function t(e,r,n,i,a,o){for(;a>i;){if(a-i>600){var s=a-i+1,l=n-i+1,c=Math.log(s),u=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-l*u/s+f)),Math.min(a,Math.floor(n+(s-l)*u/s+f)),o)}var h=r[2*n+o],p=i,d=a;for(L(e,r,i,n),r[2*a+o]>h&&L(e,r,i,a);ph;)d--}r[2*i+o]===h?L(e,r,i,d):L(e,r,++d,a),d<=n&&(i=d+1),n<=d&&(a=d-1)}}(e,r,s,i,a,o%2),t(e,r,n,i,s-1,o+1),t(e,r,n,s+1,a,o+1)}}(o,s,n,0,o.length-1,0)};D.prototype.range=function(t,e,r,n){return function(t,e,r,n,i,a,o){for(var s,l,c=[0,t.length-1,0],u=[];c.length;){var f=c.pop(),h=c.pop(),p=c.pop();if(h-p<=o)for(var d=p;d<=h;d++)l=e[2*d+1],(s=e[2*d])>=r&&s<=i&&l>=n&&l<=a&&u.push(t[d]);else{var g=Math.floor((p+h)/2);l=e[2*g+1],(s=e[2*g])>=r&&s<=i&&l>=n&&l<=a&&u.push(t[g]);var m=(f+1)%2;(0===f?r<=s:n<=l)&&(c.push(p),c.push(g-1),c.push(m)),(0===f?i>=s:a>=l)&&(c.push(g+1),c.push(h),c.push(m))}}return u}(this.ids,this.coords,t,e,r,n,this.nodeSize)},D.prototype.within=function(t,e,r){return function(t,e,r,n,i,a){for(var o=[0,t.length-1,0],s=[],l=i*i;o.length;){var c=o.pop(),u=o.pop(),f=o.pop();if(u-f<=a)for(var h=f;h<=u;h++)P(e[2*h],e[2*h+1],r,n)<=l&&s.push(t[h]);else{var p=Math.floor((f+u)/2),d=e[2*p],g=e[2*p+1];P(d,g,r,n)<=l&&s.push(t[p]);var m=(c+1)%2;(0===c?r-i<=d:n-i<=g)&&(o.push(f),o.push(p-1),o.push(m)),(0===c?r+i>=d:n+i>=g)&&(o.push(p+1),o.push(u),o.push(m))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var R={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},F=function(t){this.options=H(Object.create(R),t),this.trees=new Array(this.options.maxZoom+1)};function B(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function N(t,e){var r=t.geometry.coordinates,n=r[1];return{x:V(r[0]),y:q(n),zoom:1/0,index:e,parentId:-1}}function j(t){return{type:"Feature",id:t.id,properties:U(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function U(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return H(H({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function V(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function H(t,e){for(var r in e)t[r]=e[r];return t}function G(t){return t.x}function Y(t){return t.y}function W(t,e,r,n,i,a){var o=i-r,s=a-n;if(0!==o||0!==s){var l=((t-r)*o+(e-n)*s)/(o*o+s*s);l>1?(r=i,n=a):l>0&&(r+=o*l,n+=s*l)}return(o=t-r)*o+(s=e-n)*s}function X(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)Z(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(o+=n?(i*c-l*a)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(c-a,2))),i=l,a=c}var u=e.length-3;e[2]=1,function t(e,r,n,i){for(var a,o=i,s=n-r>>1,l=n-r,c=e[r],u=e[r+1],f=e[n],h=e[n+1],p=r+3;po)a=p,o=d;else if(d===o){var g=Math.abs(p-s);gi&&(a-r>3&&t(e,r,a,i),e[a+2]=o,n-a>3&&t(e,a,n,i))}(e,0,u,r),e[u+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function $(t,e,r,n){for(var i=0;i1?1:r}function rt(t,e,r,n,i,a,o,s){if(n/=e,a>=(r/=e)&&o=n)return null;for(var l=[],c=0;c=r&&d=n)){var g=[];if("Point"===h||"MultiPoint"===h)nt(f,g,r,n,i);else if("LineString"===h)it(f,g,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===h)ot(f,g,r,n,i,!1);else if("Polygon"===h)ot(f,g,r,n,i,!0);else if("MultiPolygon"===h)for(var m=0;m=r&&o<=n&&(e.push(t[a]),e.push(t[a+1]),e.push(t[a+2]))}}function it(t,e,r,n,i,a,o){for(var s,l,c=at(t),u=0===i?lt:ct,f=t.start,h=0;hr&&(l=u(c,p,d,m,v,r),o&&(c.start=f+s*l)):y>n?x=r&&(l=u(c,p,d,m,v,r),b=!0),x>n&&y<=n&&(l=u(c,p,d,m,v,n),b=!0),!a&&b&&(o&&(c.end=f+s*l),e.push(c),c=at(t)),o&&(f+=s)}var _=t.length-3;p=t[_],d=t[_+1],g=t[_+2],(y=0===i?p:d)>=r&&y<=n&&st(c,p,d,g),_=c.length-3,a&&_>=3&&(c[_]!==c[0]||c[_+1]!==c[1])&&st(c,c[0],c[1],c[2]),c.length&&e.push(c)}function at(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ot(t,e,r,n,i,a){for(var o=0;oo.maxX&&(o.maxX=u),f>o.maxY&&(o.maxY=f)}return o}function gt(t,e,r,n){var i=e.geometry,a=e.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s0&&e.size<(i?o:n))r.numPoints+=e.length/3;else{for(var s=[],l=0;lo)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,a=i-2;n0===e)for(n=0,i=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=n;c--){var u=+Date.now();s=this._cluster(s,c),this.trees[c]=new D(s,G,Y,a,Float32Array),r&&console.log("z%d: %d clusters in %dms",c,s.length,+Date.now()-u)}return r&&console.timeEnd("total time"),this},F.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),i=180===t[2]?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){var o=this.getClusters([r,n,180,a],e),s=this.getClusters([-180,n,i,a],e);return o.concat(s)}for(var l=this.trees[this._limitZoom(e)],c=[],u=0,f=l.range(V(r),q(a),V(i),q(n));u1?this._map(s,!0):null,d=(o<<5)+(e+1)+this.points.length,g=0,m=c;g>5},F.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},F.prototype._map=function(t,e){if(t.numPoints)return e?H({},t.properties):t.properties;var r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?H({},n):n},vt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},vt.prototype.splitTile=function(t,e,r,n,i,a,o){for(var s=[t,e,r,n],l=this.options,c=l.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var u=1<1&&console.time("creation"),h=this.tiles[f]=dt(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var p="z"+e;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(h.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<1&&console.time("clipping");var g,m,v,y,x,b,_=.5*l.buffer/l.extent,w=.5-_,T=.5+_,k=1+_;g=m=v=y=null,x=rt(t,u,r-_,r+T,0,h.minX,h.maxX,l),b=rt(t,u,r+w,r+k,0,h.minX,h.maxX,l),t=null,x&&(g=rt(x,u,n-_,n+T,1,h.minY,h.maxY,l),m=rt(x,u,n+w,n+k,1,h.minY,h.maxY,l),x=null),b&&(v=rt(b,u,n-_,n+T,1,h.minY,h.maxY,l),y=rt(b,u,n+w,n+k,1,h.minY,h.maxY,l),b=null),c>1&&console.timeEnd("clipping"),s.push(g||[],e+1,2*r,2*n),s.push(m||[],e+1,2*r,2*n+1),s.push(v||[],e+1,2*r+1,2*n),s.push(y||[],e+1,2*r+1,2*n+1)}}},vt.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,a=n.debug;if(t<0||t>24)return null;var o=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,c=t,u=e,f=r;!l&&c>0;)c--,u=Math.floor(u/2),f=Math.floor(f/2),l=this.tiles[yt(c,u,f)];return l&&l.source?(a>1&&console.log("found parent tile z%d-%d-%d",c,u,f),a>1&&console.time("drilling down"),this.splitTile(l.source,c,u,f,t,e,r),a>1&&console.timeEnd("drilling down"),this.tiles[s]?ht(this.tiles[s],i):null):null};var bt=function(e){function r(t,r,n,i){e.call(this,t,r,n,xt),i&&(this.loadGeoJSON=i)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(n&&n.request&&n.request.collectResourceTiming)&&new t.RequestPerformance(n.request);this.loadGeoJSON(n,(function(a,o){if(a||!o)return r(a);if("object"!=typeof o)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var h=function(e){function r(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e=0?1.2:1))}function v(t,e,r,n,i,a,o){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else if(a.ranges[s])e(null,{stack:r,id:i,glyph:o});else{var l=a.requests[s];l||(l=a.requests[s]=[],x.loadGlyphRange(r,s,n.url,n.requestManager,(function(t,e){if(e){for(var r in e)n._doesCharSupportLocalGlyph(+r)||(a.glyphs[+r]=e[+r]);a.ranges[s]=!0}for(var i=0,o=l;i1&&(s=t[++o]);var c=Math.abs(l-s.left),u=Math.abs(l-s.right),f=Math.min(c,u),h=void 0,p=i/r*(n+1);if(s.isDash){var d=n-Math.abs(p);h=Math.sqrt(f*f+d*d)}else h=n-Math.sqrt(f*f+p*p);this.data[a+l]=Math.max(0,Math.min(255,h+128))}},T.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}var i=t[0],a=t[t.length-1];i.isDash===a.isDash&&(i.left=a.left-this.width,a.right=i.right+this.width);for(var o=this.width*this.nextRow,s=0,l=t[s],c=0;c1&&(l=t[++s]);var u=Math.abs(c-l.left),f=Math.abs(c-l.right),h=Math.min(u,f);this.data[o+c]=Math.max(0,Math.min(255,(l.isDash?h:-h)+128))}},T.prototype.addDash=function(e,r){var n=r?7:0,i=2*n+1;if(this.nextRow+i>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o=n&&e.x=i&&e.y0&&(l[new t.OverscaledTileID(e.overscaledZ,a,r.z,i,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,o,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.actor.send(this.type+".loadData",n,(function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,a){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(a,n.map.painter,"reloadTile"===i),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),I=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),P=function(e){function r(t,r,n,i){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(e,r){var n=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(i,a){n._loaded=!0,i?n.fire(new t.ErrorEvent(i)):a&&(n.image=a,e&&(n.coordinates=e),r&&r(),n._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,i=-1/0,a=-1/0,o=0,s=e;or.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,I.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(P),O=function(e){function r(r,n,i,a){e.call(this,r,n,i,a),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,I.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var a=this.tiles[i];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];tthis.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this},N.prototype.has=function(t){return t.wrapped().key in this.data},N.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},N.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},N.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},N.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},N.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},N.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},N.prototype.filter=function(t){var e=[];for(var r in this.data)for(var n=0,i=this.data[r];n1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[a]&&(t.neighboringTiles[a].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var i in this._tiles){var a=this._tiles[i];if(!(n[i]||!a.hasData()||a.tileID.overscaledZ<=e||a.tileID.overscaledZ>r)){for(var o=a.tileID;a&&a.tileID.overscaledZ>e+1;){var s=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[s.key])&&a.hasData()&&(o=s)}for(var l=o;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){n[o.key]=o;break}}}},r.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n),a=this._getLoadedTile(i);if(a)return a}},r.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},r.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*r*5),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(i)},r.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var r={};for(var n in this._tiles){var i=this._tiles[n];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),r[i.tileID.key]=i}for(var a in this._tiles=r,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter((function(t){return n._source.hasTile(t)})))):i=[];var a=e.coveringZoomLevel(this._source),o=Math.max(a-r.maxOverzooming,this._source.minzoom),s=Math.max(a+r.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(i,a);if(Pt(this._source.type)){for(var c={},u={},f=0,h=Object.keys(l);fthis._source.maxzoom){var m=d.children(this._source.maxzoom)[0],v=this.getTile(m);if(v&&v.hasData()){n[m.key]=m;continue}}else{var y=d.children(this._source.maxzoom);if(n[y[0].key]&&n[y[1].key]&&n[y[2].key]&&n[y[3].key])continue}for(var x=g.wasRequested(),b=d.overscaledZ-1;b>=a;--b){var _=d.scaledTo(b);if(i[_.key])break;if(i[_.key]=!0,!(g=this.getTile(_))&&x&&(g=this._addTile(_)),g&&(n[_.key]=_,x=g.wasRequested(),g.hasData()))break}}}return n},r.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],r=void 0,n=this._tiles[t].tileID;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);var i=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(i))break;n=i}for(var a=0,o=e;a0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var i=this,a=[],o=this.transform;if(!o)return a;for(var s=n?o.getCameraQueryGeometry(e):e,l=e.map((function(t){return o.pointCoordinate(t)})),c=s.map((function(t){return o.pointCoordinate(t)})),u=this.getIds(),f=1/0,h=1/0,p=-1/0,d=-1/0,g=0,m=c;g=0&&v[1].y+m>=0){var y=l.map((function(t){return s.getTilePoint(t)})),x=c.map((function(t){return s.getTilePoint(t)}));a.push({tile:n,tileID:s,queryGeometry:y,cameraQueryGeometry:x,scale:g})}}},x=0;x=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)},r.prototype.removeFeatureState=function(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)},r.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},r.prototype.setDependencies=function(t,e,r){var n=this._tiles[t];n&&n.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function It(t,e){var r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Pt(t){return"raster"===t||"image"===t||"video"===t}function zt(){return new t.window.Worker(Yi.workerUrl)}Lt.maxOverzooming=10,Lt.maxUnderzooming=3;var Ot="mapboxgl_preloaded_worker_pool",Dt=function(){this.active={}};Dt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length0?(i-o)/s:0;return this.points[a].mult(1-l).add(this.points[r].mult(l))};var Jt=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var a=0;a=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,i,a,o,s,l){var c=i?e.textSizeData:e.iconSizeData,u=t.evaluateSizeForZoom(c,n.transform.zoom),f=[256/n.width*2+1,256/n.height*2+1],h=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;h.clear();for(var p=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=n.transform.width/n.transform.height,m=!1,v=0;vMath.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function ae(e,r,n,i,a,o,s,l,c,u,f,h,p,d){var g,m=r/24,v=e.lineOffsetX*m,y=e.lineOffsetY*m;if(e.numGlyphs>1){var x=e.glyphStartIndex+e.numGlyphs,b=e.lineStartIndex,_=e.lineStartIndex+e.lineLength,w=ne(m,l,v,y,n,f,h,e,c,o,p);if(!w)return{notEnoughRoom:!0};var T=$t(w.first.point,s).point,k=$t(w.last.point,s).point;if(i&&!n){var M=ie(e.writingMode,T,k,d);if(M)return M}g=[w.first];for(var A=e.glyphStartIndex+1;A0?L.point:oe(h,C,S,1,a),P=ie(e.writingMode,S,I,d);if(P)return P}var z=se(m*l.getoffsetX(e.glyphStartIndex),v,y,n,f,h,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,o,p);if(!z)return{notEnoughRoom:!0};g=[z]}for(var O=0,D=g;O0?1:-1,g=0;i&&(d*=-1,g=Math.PI),d<0&&(g+=Math.PI);for(var m=d>0?l+s:l+s+1,v=a,y=a,x=0,b=0,_=Math.abs(p),w=[];x+b<=_;){if((m+=d)=c)return null;if(y=v,w.push(v),void 0===(v=h[m])){var T=new t.Point(u.getx(m),u.gety(m)),k=$t(T,f);if(k.signedDistanceFromCamera>0)v=h[m]=k.point;else{var M=m-d;v=oe(0===x?o:new t.Point(u.getx(M),u.gety(M)),T,y,_-x+1,f)}}x+=b,b=y.dist(v)}var A=(_-x)/b,S=v.sub(y),E=S.mult(A)._add(y);E._add(S._unit()._perp()._mult(n*d));var C=g+Math.atan2(v.y-y.y,v.x-y.x);return w.push(E),{point:E,angle:C,path:w}}Jt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Jt.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},Jt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},Jt.prototype._insertBoxCell=function(t,e,r,n,i,a){this.boxCells[i].push(a)},Jt.prototype._insertCircleCell=function(t,e,r,n,i,a){this.circleCells[i].push(a)},Jt.prototype._query=function(t,e,r,n,i,a){if(r<0||t>this.width||n<0||e>this.height)return!i&&[];var o=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s0:o},Jt.prototype._queryCircle=function(t,e,r,n,i){var a=t-r,o=t+r,s=e-r,l=e+r;if(o<0||a>this.width||l<0||s>this.height)return!n&&[];var c=[];return this._forEachCell(a,s,o,l,this._queryCellCircle,c,{hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},i),n?c.length>0:c},Jt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},Jt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},Jt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Jt.prototype._queryCell=function(t,e,r,n,i,a,o,s){var l=o.seenUids,c=this.boxCells[i];if(null!==c)for(var u=this.bboxes,f=0,h=c;f=u[d+0]&&n>=u[d+1]&&(!s||s(this.boxKeys[p]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:u[d],y1:u[d+1],x2:u[d+2],y2:u[d+3]})}}}var g=this.circleCells[i];if(null!==g)for(var m=this.circles,v=0,y=g;vo*o+s*s},Jt.prototype._circleAndRectCollide=function(t,e,r,n,i,a,o){var s=(a-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var c=(o-i)/2,u=Math.abs(e-(i+c));if(u>c+r)return!1;if(l<=s||u<=c)return!0;var f=l-s,h=u-c;return f*f+h*h<=r*r};var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ce(t,e){for(var r=0;r=1;I--)L.push(E.path[I]);for(var P=1;P0){for(var R=L[0].clone(),F=L[0].clone(),B=1;B=M.x&&F.x<=A.x&&R.y>=M.y&&F.y<=A.y?[L]:F.xA.x||F.yA.y?[]:t.clipLine([L],M.x,M.y,A.x,A.y)}for(var N=0,j=D;N=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},fe.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t=0&&e0?(this.prevPlacement&&this.prevPlacement.variableOffsets[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID].text&&(g=this.prevPlacement.variableOffsets[f.crossTileID].anchor),this.variableOffsets[f.crossTileID]={textOffset:m,width:r,height:n,anchor:t,textBoxScale:i,prevAnchor:g},this.markUsedJustification(h,t,f,p),h.allowVerticalPlacement&&(this.markUsedOrientation(h,p,f),this.placedOrientations[f.crossTileID]=p),{shift:v,placedGlyphBoxes:y}):void 0},_e.prototype.placeLayerBucketPart=function(e,r,n){var i=this,a=e.parameters,o=a.bucket,s=a.layout,l=a.posMatrix,c=a.textLabelPlaneMatrix,u=a.labelToScreenMatrix,f=a.textPixelRatio,h=a.holdingForFade,p=a.collisionBoxArray,d=a.partiallyEvaluatedTextSize,g=a.collisionGroup,m=s.get("text-optional"),v=s.get("icon-optional"),y=s.get("text-allow-overlap"),x=s.get("icon-allow-overlap"),b="map"===s.get("text-rotation-alignment"),_="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),T="viewport-y"===s.get("symbol-z-order"),k=y&&(x||!o.hasIconData()||v),M=x&&(y||!o.hasTextData()||m);!o.collisionArrays&&p&&o.deserializeCollisionBoxes(p);var A=function(e,a){if(!r[e.crossTileID])if(h)i.placements[e.crossTileID]=new ge(!1,!1,!1);else{var p,T=!1,A=!1,S=!0,E=null,C={box:null,offscreen:null},L={box:null,offscreen:null},I=null,P=null,z=0,O=0,D=0;a.textFeatureIndex?z=a.textFeatureIndex:e.useRuntimeCollisionCircles&&(z=e.featureIndex),a.verticalTextFeatureIndex&&(O=a.verticalTextFeatureIndex);var R=a.textBox;if(R){var F=function(r){var n=t.WritingMode.horizontal;if(o.allowVerticalPlacement&&!r&&i.prevPlacement){var a=i.prevPlacement.placedOrientations[e.crossTileID];a&&(i.placedOrientations[e.crossTileID]=a,i.markUsedOrientation(o,n=a,e))}return n},B=function(r,n){if(o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&a.verticalTextBox)for(var i=0,s=o.writingModes;i0&&(N=N.filter((function(t){return t!==j.anchor}))).unshift(j.anchor)}var U=function(t,r,n){for(var a=t.x2-t.x1,s=t.y2-t.y1,c=e.textBoxScale,u=w&&!x?r:null,h={box:[],offscreen:!1},p=y?2*N.length:N.length,d=0;d=N.length,e,o,n,u);if(m&&(h=m.placedGlyphBoxes)&&h.box&&h.box.length){T=!0,E=m.shift;break}}return h};B((function(){return U(R,a.iconBox,t.WritingMode.horizontal)}),(function(){var r=a.verticalTextBox;return o.allowVerticalPlacement&&!(C&&C.box&&C.box.length)&&e.numVerticalGlyphVertices>0&&r?U(r,a.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),C&&(T=C.box,S=C.offscreen);var V=F(C&&C.box);if(!T&&i.prevPlacement){var q=i.prevPlacement.variableOffsets[e.crossTileID];q&&(i.variableOffsets[e.crossTileID]=q,i.markUsedJustification(o,q.anchor,e,V))}}else{var H=function(t,r){var n=i.collisionIndex.placeCollisionBox(t,y,f,l,g.predicate);return n&&n.box&&n.box.length&&(i.markUsedOrientation(o,r,e),i.placedOrientations[e.crossTileID]=r),n};B((function(){return H(R,t.WritingMode.horizontal)}),(function(){var r=a.verticalTextBox;return o.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?H(r,t.WritingMode.vertical):{box:null,offscreen:null}})),F(C&&C.box&&C.box.length)}}if(T=(p=C)&&p.box&&p.box.length>0,S=p&&p.offscreen,e.useRuntimeCollisionCircles){var G=o.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),Y=t.evaluateSizeForFeature(o.textSizeData,d,G),W=s.get("text-padding");I=i.collisionIndex.placeCollisionCircles(y,G,o.lineVertexArray,o.glyphOffsetArray,Y,l,c,u,n,_,g.predicate,e.collisionCircleDiameter,W),T=y||I.circles.length>0&&!I.collisionDetected,S=S&&I.offscreen}if(a.iconFeatureIndex&&(D=a.iconFeatureIndex),a.iconBox){var X=function(t){var e=w&&E?be(t,E.x,E.y,b,_,i.transform.angle):t;return i.collisionIndex.placeCollisionBox(e,x,f,l,g.predicate)};A=L&&L.box&&L.box.length&&a.verticalIconBox?(P=X(a.verticalIconBox)).box.length>0:(P=X(a.iconBox)).box.length>0,S=S&&P.offscreen}var Z=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,J=v||0===e.numIconVertices;if(Z||J?J?Z||(A=A&&T):T=A&&T:A=T=A&&T,T&&p&&p.box&&i.collisionIndex.insertCollisionBox(p.box,s.get("text-ignore-placement"),o.bucketInstanceId,L&&L.box&&O?O:z,g.ID),A&&P&&i.collisionIndex.insertCollisionBox(P.box,s.get("icon-ignore-placement"),o.bucketInstanceId,D,g.ID),I&&(T&&i.collisionIndex.insertCollisionCircles(I.circles,s.get("text-ignore-placement"),o.bucketInstanceId,z,g.ID),n)){var K=o.bucketInstanceId,Q=i.collisionCircleArrays[K];void 0===Q&&(Q=i.collisionCircleArrays[K]=new me);for(var $=0;$=0;--E){var C=S[E];A(o.symbolInstances.get(C),o.collisionArrays[C])}else for(var L=e.symbolInstanceStart;L=0&&(e.text.placedSymbolArray.get(l).crossTileID=a>=0&&l!==a?0:n.crossTileID)}},_e.prototype.markUsedOrientation=function(e,r,n){for(var i=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,a=r===t.WritingMode.vertical?r:0,o=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];o0,y=i.placedOrientations[a.crossTileID],x=y===t.WritingMode.vertical,b=y===t.WritingMode.horizontal||y===t.WritingMode.horizontalOnly;if(s>0||l>0){var _=Le(m.text);d(e.text,s,x?Ie:_),d(e.text,l,b?Ie:_);var w=m.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||x?1:0)})),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=w||b?1:0);var T=i.variableOffsets[a.crossTileID];T&&i.markUsedJustification(e,T.anchor,a,y);var k=i.placedOrientations[a.crossTileID];k&&(i.markUsedJustification(e,"left",a,k),i.markUsedOrientation(e,k,a))}if(v){var M=Le(m.icon),A=!(h&&a.verticalPlacedIconSymbolIndex&&x);a.placedIconSymbolIndex>=0&&(d(e.icon,a.numIconVertices,A?M:Ie),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=m.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,a.numVerticalIconVertices,A?Ie:M),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var S=e.collisionArrays[n];if(S){var E=new t.Point(0,0);if(S.textBox||S.verticalTextBox){var C=!0;if(c){var L=i.variableOffsets[g];L?(E=xe(L.anchor,L.width,L.height,L.textOffset,L.textBoxScale),u&&E._rotate(f?i.transform.angle:-i.transform.angle)):C=!1}S.textBox&&we(e.textCollisionBox.collisionVertexArray,m.text.placed,!C||x,E.x,E.y),S.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,m.text.placed,!C||b,E.x,E.y)}var I=Boolean(!b&&S.verticalIconBox);S.iconBox&&we(e.iconCollisionBox.collisionVertexArray,m.icon.placed,I,h?E.x:0,h?E.y:0),S.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!I,h?E.x:0,h?E.y:0)}}},m=0;mt},_e.prototype.setStale=function(){this.stale=!0};var Te=Math.pow(2,25),ke=Math.pow(2,24),Me=Math.pow(2,17),Ae=Math.pow(2,16),Se=Math.pow(2,9),Ee=Math.pow(2,8),Ce=Math.pow(2,1);function Le(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*Te+e*ke+r*Me+e*Ae+r*Se+e*Ee+r*Ce+e}var Ie=0,Pe=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};Pe.prototype.continuePlacement=function(t,e,r,n,i){for(var a=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=r[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Pe(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},ze.prototype.commit=function(t){return this.placement.commit(t),this.placement};var Oe=512/t.EXTENT/2,De=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;nt.overscaledZ)for(var s in o){var l=o[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,i)}else{var c=o[t.scaledTo(Number(a)).key];c&&c.findMatches(e.symbolInstances,t,i)}}for(var u=0;u1?"@2x":"",l=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){l=null,o||(o=t,i=e,u())})),c=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){c=null,o||(o=t,a=e,u())}));function u(){if(o)n(o);else if(i&&a){var e=t.browser.getImageData(a),r={};for(var s in i){var l=i[s],c=l.width,u=l.height,f=l.x,h=l.y,p=l.sdf,d=l.pixelRatio,g=l.stretchX,m=l.stretchY,v=l.content,y=new t.RGBAImage({width:c,height:u});t.RGBAImage.copy(e,y,{x:f,y:h},{x:0,y:0},{width:c,height:u}),r[s]={data:y,pixelRatio:d,sdf:p,stretchX:g,stretchY:m,content:v}}n(null,r)}}return{cancel:function(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(e,this.map._requestManager,(function(e,n){if(r._spriteRequest=null,e)r.fire(new t.ErrorEvent(e));else if(n)for(var i in n)r.imageManager.addImage(i,n[i]);r.imageManager.setLoaded(!0),r._availableImages=r.imageManager.listImages(),r.dispatcher.broadcast("setImages",r._availableImages),r.fire(new t.Event("data",{dataType:"style"}))}))},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var n=e.sourceLayer;if(n){var i=r.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+n+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}}},r.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,n=t;r0)throw new Error("Unimplemented: "+i.map((function(t){return t.command})).join(", ")+".");return n.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(void 0===n&&(n={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var a=this.sourceCaches[e]=new Lt(e,r,this.dispatcher);a.style=this,a.setEventedParent(this,(function(){return{isSourceLoaded:i.loaded(),source:a.serialize(),sourceId:e}})),a.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else{var a;if("custom"===e.type){if(Ne(this,t.validateCustomStyleLayer(e)))return;a=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})),this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n))return;a=t.createStyleLayer(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[a.id]=a.serialize()}var o=r?this._order.indexOf(r):this._order.length;if(r&&-1===o)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(o,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&"custom"!==a.type){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.hasLayer=function(t){return t in this._layers},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.deepEqual(i.filter,r))return null==r?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",r,null,n)||(i.filter=t.clone$1(r),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var a=this.getLayer(e);a?t.deepEqual(a.getLayoutProperty(r),n)||(a.setLayoutProperty(r,n,i),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(e,r){var n=this.getLayer(e);if(n)return n.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var a=this.getLayer(e);a?t.deepEqual(a.getPaintProperty(r),n)||(a.setPaintProperty(r,n,i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,a=this.sourceCaches[n];if(void 0!==a){var o=a.getSource().type;"geojson"===o&&i?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||i?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.setFeatureState(i,e.id,r)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=this.sourceCaches[n];if(void 0!==i){var a=i.getSource().type,o="vector"===a?e.sourceLayer:void 0;"vector"!==a||o?r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))):i.removeFeatureState(o,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r];if(void 0!==i){if("vector"!==i.getSource().type||n)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),i.getFeatureState(n,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},n={},i=[],a=this._order.length-1;a>=0;a--){var o=this._order[a];if(r(o)){n[o]=a;for(var s=0,l=t;s=0;p--){var d=this._order[p];if(r(d))for(var g=i.length-1;g>=0;g--){var m=i[g].feature;if(n[m.layer.id] 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),$e=vr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),tr=vr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),er=vr("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),rr=vr("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),nr=vr("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ir=vr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),ar=vr("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),or=vr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),sr=vr("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),lr=vr("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),cr=vr("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),ur=vr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define MAX_LINE_DISTANCE 32767.0\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),fr=vr("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),hr=vr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),pr=vr("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),dr=vr("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),gr=vr("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),mr=vr("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function vr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n={};return{fragmentSource:t=t.replace(r,(function(t,e,r,i,a){return n[a]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nvarying "+r+" "+i+" "+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,i,a){var o="float"===i?"vec2":"vec4",s=a.match(/color/)?"color":o;return n[a]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float u_"+a+"_t;\nattribute "+r+" "+o+" a_"+a+";\nvarying "+r+" "+i+" "+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+a+" = a_"+a+";\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+a+" = unpack_mix_"+s+"(a_"+a+", u_"+a+"_t);\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float u_"+a+"_t;\nattribute "+r+" "+o+" a_"+a+";\n#else\nuniform "+r+" "+i+" u_"+a+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = a_"+a+";\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+r+" "+i+" "+a+" = unpack_mix_"+s+"(a_"+a+", u_"+a+"_t);\n#else\n "+r+" "+i+" "+a+" = u_"+a+";\n#endif\n"}))}}var yr=Object.freeze({__proto__:null,prelude:Ge,background:Ye,backgroundPattern:We,circle:Xe,clippingMask:Ze,heatmap:Je,heatmapTexture:Ke,collisionBox:Qe,collisionCircle:$e,debug:tr,fill:er,fillOutline:rr,fillOutlinePattern:nr,fillPattern:ir,fillExtrusion:ar,fillExtrusionPattern:or,hillshadePrepare:sr,hillshade:lr,line:cr,lineGradient:ur,linePattern:fr,lineSDF:hr,raster:pr,symbolIcon:dr,symbolSDF:gr,symbolTextAndIcon:mr}),xr=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};xr.prototype.bind=function(t,e,r,n,i,a,o,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==n.length,c=0;!l&&c>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}br.prototype.draw=function(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g){var m,v=t.gl;if(!this.failedToCreate){for(var y in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(i),t.setCullFace(a),this.fixedUniforms)this.fixedUniforms[y].set(o[y]);p&&p.setUniforms(t,this.binderUniforms,f,{zoom:h});for(var x=(m={},m[v.LINES]=2,m[v.TRIANGLES]=3,m[v.LINE_STRIP]=1,m)[e],b=0,_=u.get();b<_.length;b+=1){var w=_[b],T=w.vaos||(w.vaos={});(T[s]||(T[s]=new xr)).bind(t,this,l,p?p.getPaintVertexBuffers():[],c,w.vertexOffset,d,g),v.drawElements(e,w.primitiveLength*x,v.UNSIGNED_SHORT,w.primitiveOffset*x*2)}}};var wr=function(e,r,n,i){var a=r.style.light,o=a.properties.get("position"),s=[o.x,o.y,o.z],l=t.create$1();"viewport"===a.properties.get("anchor")&&t.fromRotation(l,-r.transform.angle),t.transformMat3(s,s,l);var c=a.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+n,u_opacity:i}},Tr=function(e,r,n,i,a,o,s){return t.extend(wr(e,r,n,i),_r(o,r,s),{u_height_factor:-Math.pow(2,a.overscaledZ)/s.tileSize/8})},kr=function(t){return{u_matrix:t}},Mr=function(e,r,n,i){return t.extend(kr(e),_r(n,r,i))},Ar=function(t,e){return{u_matrix:t,u_world:e}},Sr=function(e,r,n,i,a){return t.extend(Mr(e,r,n,i),{u_world:a})},Er=function(e,r,n,i){var a,o,s=e.transform;if("map"===i.paint.get("circle-pitch-alignment")){var l=he(n,1,s.zoom);a=!0,o=[l,l]}else a=!1,o=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(r.posMatrix,n,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+a,u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:o}},Cr=function(t,e,r){var n=he(r,1,e.zoom),i=Math.pow(2,e.zoom-r.tileID.overscaledZ),a=r.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*i),e.pixelsToGLUnits[1]/(n*i)],u_overscale_factor:a}},Lr=function(t,e,r){return{u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:r.cameraToCenterDistance,u_viewport_size:[r.width,r.height]}},Ir=function(t,e,r){return void 0===r&&(r=1),{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:r}},Pr=function(t){return{u_matrix:t}},zr=function(t,e,r,n){return{u_matrix:t,u_extrude_scale:he(e,1,r),u_intensity:n}},Or=function(e,r,n){var i=e.transform;return{u_matrix:Nr(e,r,n),u_ratio:1/he(r,1,i.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},Dr=function(e,r,n){return t.extend(Or(e,r,n),{u_image:0})},Rr=function(e,r,n,i){var a=e.transform,o=Br(r,a);return{u_matrix:Nr(e,r,n),u_texsize:r.imageAtlasTexture.size,u_ratio:1/he(r,1,a.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[o,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Fr=function(e,r,n,i,a){var o=e.lineAtlas,s=Br(r,e.transform),l="round"===n.layout.get("line-cap"),c=o.getDash(i.from,l),u=o.getDash(i.to,l),f=c.width*a.fromScale,h=u.width*a.toScale;return t.extend(Or(e,r,n),{u_patternscale_a:[s/f,-c.height/2],u_patternscale_b:[s/h,-u.height/2],u_sdfgamma:o.width/(256*Math.min(f,h)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:u.y,u_mix:a.t})};function Br(t,e){return 1/he(t,1,e.tileZoom)}function Nr(t,e,r){return t.translatePosMatrix(e.tileID.posMatrix,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}var jr=function(t,e,r,n,i){return{u_matrix:t,u_tl_parent:e,u_scale_parent:r,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(o=i.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(a=i.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:Ur(i.paint.get("raster-hue-rotate"))};var a,o};function Ur(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var Vr,qr=function(t,e,r,n,i,a,o,s,l,c){var u=i.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:u.width/u.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+n,u_texsize:c,u_texture:0}},Hr=function(e,r,n,i,a,o,s,l,c,u,f){var h=a.transform;return t.extend(qr(e,r,n,i,a,o,s,l,c,u),{u_gamma_scale:i?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+f})},Gr=function(e,r,n,i,a,o,s,l,c,u){return t.extend(Hr(e,r,n,i,a,o,s,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1})},Yr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Wr=function(e,r,n,i,a,o){return t.extend(function(t,e,r,n){var i=r.imageManager.getPattern(t.from.toString()),a=r.imageManager.getPattern(t.to.toString()),o=r.imageManager.getPixelSize(),s=o.width,l=o.height,c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,f=u*(n.tileID.canonical.x+n.tileID.wrap*c),h=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/he(n,1,r.transform.tileZoom),u_pixel_coord_upper:[f>>16,h>>16],u_pixel_coord_lower:[65535&f,65535&h]}}(i,o,n,a),{u_matrix:e,u_opacity:r})},Xr={fillExtrusion:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},collisionCircle:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,r.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,r.u_viewport_size)}},debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_overlay:new t.Uniform1i(e,r.u_overlay),u_overlay_scale:new t.Uniform1f(e,r.u_overlay_scale)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_maxzoom:new t.Uniform1f(e,r.u_maxzoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Zr(e,r,n,i,a,o,s){for(var l=e.context,c=l.gl,u=e.useProgram("collisionBox"),f=[],h=0,p=0,d=0;d0){var _=t.create(),w=y;t.mul(_,v.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(_,_,v.placementViewportMatrix),f.push({circleArray:b,circleOffset:p,transform:w,invTransform:_}),p=h+=b.length/4}x&&u.draw(l,c.LINES,Mt.disabled,At.disabled,e.colorModeForRenderPass(),Et.disabled,Cr(y,e.transform,m),n.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}}if(s&&f.length){var T=e.useProgram("collisionCircle"),k=new t.StructArrayLayout2f1f2i16;k.resize(4*h),k._trim();for(var M=0,A=0,S=f;A=0&&(g[v.associatedIconIndex]={shiftedAnchor:k,angle:M})}else ce(v.numGlyphs,p)}if(f){d.clear();for(var S=e.icon.placedSymbolArray,E=0;E0){var s=t.browser.now(),l=(s-e.timeAdded)/o,c=r?(s-r.timeAdded)/o:-1,u=n.getSource(),f=a.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!r||Math.abs(r.tileID.overscaledZ-f)>Math.abs(e.tileID.overscaledZ-f),p=h&&e.refreshedUponExpiration?1:t.clamp(h?l:1-c,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}var ln=new t.Color(1,0,0,1),cn=new t.Color(0,1,0,1),un=new t.Color(0,0,1,1),fn=new t.Color(1,0,1,1),hn=new t.Color(0,1,1,1);function pn(t,e,r,n){gn(t,0,e+r/2,t.transform.width,r,n)}function dn(t,e,r,n){gn(t,e-r/2,0,r,t.transform.height,n)}function gn(e,r,n,i,a,o){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(r*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,a*t.browser.devicePixelRatio),s.clear({color:o}),l.disable(l.SCISSOR_TEST)}function mn(e,r,n){var i=e.context,a=i.gl,o=n.posMatrix,s=e.useProgram("debug"),l=Mt.disabled,c=At.disabled,u=e.colorModeForRenderPass();i.activeTexture.set(a.TEXTURE0),e.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),s.draw(i,a.LINE_STRIP,l,c,u,Et.disabled,Ir(o,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var f=r.getTileByID(n.key).latestRawTileData,h=Math.floor((f&&f.byteLength||0)/1024),p=r.getTile(n).tileSize,d=512/Math.min(p,512)*(n.overscaledZ/e.transform.zoom)*.5,g=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(g+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var r=t.debugOverlayCanvas,n=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,r.width,r.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,g+" "+h+"kb"),s.draw(i,a.TRIANGLES,l,c,St.alphaBlended,Et.disabled,Ir(o,t.Color.transparent,d),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var vn={symbol:function(e,r,n,i,a){if("translucent"===e.renderPass){var o=At.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,r,n,i,a,o,s){for(var l=r.transform,c="map"===a,u="map"===o,f=0,h=e;f256&&this.clearStencil(),r.setColorMode(St.disabled),r.setDepthMode(Mt.disabled);var i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var a=0,o=e;a256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new At({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},yn.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new At({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},yn.prototype.stencilConfigForOverlap=function(t){var e,r=this.context.gl,n=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),i=n[n.length-1].overscaledZ,a=n[0].overscaledZ-i+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();for(var o={},s=0;s=0;this.currentLayer--){var b=this.style._layers[i[this.currentLayer]],_=a[b.source],w=u[b.source];this._renderTileClippingMasks(b,w),this.renderLayer(this,_,b,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?e.pop():null},yn.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},yn.prototype.useProgram=function(t,e){this.cache=this.cache||{};var r=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new br(this.context,yr[t],e,Xr[t],this._showOverdrawInspector)),this.cache[r]},yn.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},yn.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},yn.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},yn.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var xn=function(t,e){this.points=t,this.planes=e};xn.fromInvProjectionMatrix=function(e,r,n){var i=Math.pow(2,n),a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(r){return t.transformMat4([],r,e)})).map((function(e){return t.scale$1([],e,1/e[3]/r*i)})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var r=t.sub([],a[e[0]],a[e[1]]),n=t.sub([],a[e[2]],a[e[1]]),i=t.normalize([],t.cross([],r,n)),o=-t.dot(i,a[e[1]]);return i.concat(o)}));return new xn(a,o)};var bn=function(e,r){this.min=e,this.max=r,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};bn.prototype.quadrant=function(e){for(var r=[e%2==0,e<2],n=t.clone$2(this.min),i=t.clone$2(this.max),a=0;a=0;if(0===o)return 0;o!==r.length&&(n=!1)}if(n)return 2;for(var l=0;l<3;l++){for(var c=Number.MAX_VALUE,u=-Number.MAX_VALUE,f=0;fthis.max[l]-this.min[l])return 0}return 1};var _n=function(t,e,r,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=n};_n.prototype.interpolate=function(e,r,n){return null!=r.top&&null!=e.top&&(this.top=t.number(e.top,r.top,n)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,r.bottom,n)),null!=r.left&&null!=e.left&&(this.left=t.number(e.left,r.left,n)),null!=r.right&&null!=e.right&&(this.right=t.number(e.right,r.right,n)),this},_n.prototype.getCenter=function(e,r){var n=t.clamp((this.left+e-this.right)/2,0,e),i=t.clamp((this.top+r-this.bottom)/2,0,r);return new t.Point(n,i)},_n.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},_n.prototype.clone=function(){return new _n(this.top,this.bottom,this.left,this.right)},_n.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var wn=function(e,r,n,i,a){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===a||a,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new _n,this._posMatrixCache={},this._alignedPosMatrixCache={}},Tn={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};wn.prototype.clone=function(){var t=new wn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},Tn.minZoom.get=function(){return this._minZoom},Tn.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Tn.maxZoom.get=function(){return this._maxZoom},Tn.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Tn.minPitch.get=function(){return this._minPitch},Tn.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},Tn.maxPitch.get=function(){return this._maxPitch},Tn.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},Tn.renderWorldCopies.get=function(){return this._renderWorldCopies},Tn.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Tn.worldSize.get=function(){return this.tileSize*this.scale},Tn.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},Tn.size.get=function(){return new t.Point(this.width,this.height)},Tn.bearing.get=function(){return-this.angle/Math.PI*180},Tn.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Tn.pitch.get=function(){return this._pitch/Math.PI*180},Tn.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},Tn.fov.get=function(){return this._fov/Math.PI*180},Tn.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},Tn.zoom.get=function(){return this._zoom},Tn.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},Tn.center.get=function(){return this._center},Tn.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Tn.padding.get=function(){return this._edgeInsets.toJSON()},Tn.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},Tn.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},wn.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},wn.prototype.interpolatePadding=function(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()},wn.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},wn.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var n=this.pointCoordinate(new t.Point(0,0)),i=this.pointCoordinate(new t.Point(this.width,0)),a=this.pointCoordinate(new t.Point(this.width,this.height)),o=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(n.x,i.x,a.x,o.x)),l=Math.floor(Math.max(n.x,i.x,a.x,o.x)),c=s-1;c<=l+1;c++)0!==c&&r.push(new t.UnwrappedTileID(c,e));return r},wn.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var i=t.MercatorCoordinate.fromLngLat(this.center),a=Math.pow(2,r),o=[a*i.x,a*i.y,0],s=xn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=r);var c=function(t){return{aabb:new bn([t*a,0,0],[(t+1)*a,a,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},u=[],f=[],h=r,p=e.reparseOverscaled?n:r;if(this._renderWorldCopies)for(var d=1;d<=3;d++)u.push(c(-d)),u.push(c(d));for(u.push(c(0));u.length>0;){var g=u.pop(),m=g.x,v=g.y,y=g.fullyVisible;if(!y){var x=g.aabb.intersects(s);if(0===x)continue;y=2===x}var b=g.aabb.distanceX(o),_=g.aabb.distanceY(o),w=Math.max(Math.abs(b),Math.abs(_));if(g.zoom===h||w>3+(1<=l)f.push({tileID:new t.OverscaledTileID(g.zoom===h?p:g.zoom,g.wrap,g.zoom,m,v),distanceSq:t.sqrLen([o[0]-.5-m,o[1]-.5-v])});else for(var T=0;T<4;T++){var k=(m<<1)+T%2,M=(v<<1)+(T>>1);u.push({aabb:g.aabb.quadrant(T),zoom:g.zoom+1,x:k,y:M,wrap:g.wrap,fullyVisible:y})}}return f.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},wn.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},Tn.unmodified.get=function(){return this._unmodified},wn.prototype.zoomScale=function(t){return Math.pow(2,t)},wn.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},wn.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},wn.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},Tn.point.get=function(){return this.project(this.center)},wn.prototype.setLocationAtPoint=function(e,r){var n=this.pointCoordinate(r),i=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(e),o=new t.MercatorCoordinate(a.x-(n.x-i.x),a.y-(n.y-i.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())},wn.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},wn.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},wn.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},wn.prototype.coordinateLocation=function(t){return t.toLngLat()},wn.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],a=n[3],o=r[1]/i,s=n[1]/a,l=r[2]/i,c=n[2]/a,u=l===c?0:(0-l)/(c-l);return new t.MercatorCoordinate(t.number(r[0]/i,n[0]/a,u)/this.worldSize,t.number(o,s,u)/this.worldSize)},wn.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},wn.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},wn.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},wn.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},wn.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var n=e.key,i=r?this._alignedPosMatrixCache:this._posMatrixCache;if(i[n])return i[n];var a=e.canonical,o=this.worldSize/this.zoomScale(a.z),s=a.x+Math.pow(2,a.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*o,a.y*o,0]),t.scale(l,l,[o/t.EXTENT,o/t.EXTENT,1]),t.multiply(l,r?this.alignedProjMatrix:this.projMatrix,l),i[n]=new Float32Array(l),i[n]},wn.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},wn.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,n,i,a=-90,o=90,s=-180,l=180,c=this.size,u=this._unmodified;if(this.latRange){var f=this.latRange;a=t.mercatorYfromLat(f[1])*this.worldSize,e=(o=t.mercatorYfromLat(f[0])*this.worldSize)-ao&&(i=o-m)}if(this.lngRange){var v=p.x,y=c.x/2;v-yl&&(n=l-y)}void 0===n&&void 0===i||(this.center=this.unproject(new t.Point(void 0!==n?n:p.x,void 0!==i?i:p.y))),this._unmodified=u,this._constraining=!1}},wn.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var r=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),i=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-n,.01,Math.PI-.01)),a=this.point,o=a.x,s=a.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),c=this.height/50,u=new Float64Array(16);t.perspective(u,this._fov,this.width/this.height,c,l),u[8]=2*-e.x/this.width,u[9]=2*e.y/this.height,t.scale(u,u,[1,-1,1]),t.translate(u,u,[0,0,-this.cameraToCenterDistance]),t.rotateX(u,u,this._pitch),t.rotateZ(u,u,this.angle),t.translate(u,u,[-o,-s,0]),this.mercatorMatrix=t.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),t.scale(u,u,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=u,this.invProjMatrix=t.invert([],this.projMatrix);var f=this.width%2/2,h=this.height%2/2,p=Math.cos(this.angle),d=Math.sin(this.angle),g=o-Math.round(o)+p*f+d*h,m=s-Math.round(s)+p*h+d*f,v=new Float64Array(u);if(t.translate(v,v,[g>.5?g-1:g,m>.5?m-1:m,0]),this.alignedProjMatrix=v,u=t.create(),t.scale(u,u,[this.width/2,-this.height/2,1]),t.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=t.create(),t.scale(u,u,[1,-1,1]),t.translate(u,u,[-1,-1,0]),t.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(u=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}},wn.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},wn.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},wn.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var n=r.x,i=r.y,a=r.x,o=r.y,s=0,l=e;s=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},kn.prototype._updateHashUnthrottled=function(){var e=this.getHashString();try{t.window.history.replaceState(t.window.history.state,"",e)}catch(t){}};var Mn={linearity:.3,easing:t.bezier(0,0,.3,1)},An=t.extend({deceleration:2500,maxSpeed:1400},Mn),Sn=t.extend({deceleration:20,maxSpeed:1400},Mn),En=t.extend({deceleration:1e3,maxSpeed:360},Mn),Cn=t.extend({deceleration:1e3,maxSpeed:90},Mn),Ln=function(t){this._map=t,this.clear()};function In(t,e){(!t.duration||t.duration0&&r-e[0].time>160;)e.shift()},Ln.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var r={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},n=0,i=this._inertiaBuffer;n=this._clickTolerance||this._map.fire(new zn(t.type,this._map,t))},Rn.prototype.dblclick=function(t){return this._firePreventable(new zn(t.type,this._map,t))},Rn.prototype.mouseover=function(t){this._map.fire(new zn(t.type,this._map,t))},Rn.prototype.mouseout=function(t){this._map.fire(new zn(t.type,this._map,t))},Rn.prototype.touchstart=function(t){return this._firePreventable(new On(t.type,this._map,t))},Rn.prototype.touchmove=function(t){this._map.fire(new On(t.type,this._map,t))},Rn.prototype.touchend=function(t){this._map.fire(new On(t.type,this._map,t))},Rn.prototype.touchcancel=function(t){this._map.fire(new On(t.type,this._map,t))},Rn.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},Rn.prototype.isEnabled=function(){return!0},Rn.prototype.isActive=function(){return!1},Rn.prototype.enable=function(){},Rn.prototype.disable=function(){};var Fn=function(t){this._map=t};Fn.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Fn.prototype.mousemove=function(t){this._map.fire(new zn(t.type,this._map,t))},Fn.prototype.mousedown=function(){this._delayContextMenu=!0},Fn.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Fn.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new zn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Fn.prototype.isEnabled=function(){return!0},Fn.prototype.isActive=function(){return!1},Fn.prototype.enable=function(){},Fn.prototype.disable=function(){};var Bn=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Nn(t,e){for(var r={},n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){for(var r=new t.Point(0,0),n=0,i=e;n30)&&(this.aborted=!0)}}},jn.prototype.touchend=function(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){var n=!this.aborted&&this.centroid;if(this.reset(),n)return n}};var Un=function(t){this.singleTap=new jn(t),this.numTaps=t.numTaps,this.reset()};Un.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Un.prototype.touchstart=function(t,e,r){this.singleTap.touchstart(t,e,r)},Un.prototype.touchmove=function(t,e,r){this.singleTap.touchmove(t,e,r)},Un.prototype.touchend=function(t,e,r){var n=this.singleTap.touchend(t,e,r);if(n){var i=t.timeStamp-this.lastTime<500,a=!this.lastTap||this.lastTap.dist(n)<30;if(i&&a||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}};var Vn=function(){this._zoomIn=new Un({numTouches:1,numTaps:2}),this._zoomOut=new Un({numTouches:2,numTaps:1}),this.reset()};Vn.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},Vn.prototype.touchstart=function(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)},Vn.prototype.touchmove=function(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)},Vn.prototype.touchend=function(t,e,r){var n=this,i=this._zoomIn.touchend(t,e,r),a=this._zoomOut.touchend(t,e,r);return i?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}}):a?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(a)},{originalEvent:t})}}):void 0},Vn.prototype.touchcancel=function(){this.reset()},Vn.prototype.enable=function(){this._enabled=!0},Vn.prototype.disable=function(){this._enabled=!1,this.reset()},Vn.prototype.isEnabled=function(){return this._enabled},Vn.prototype.isActive=function(){return this._active};var qn=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};qn.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},qn.prototype._correctButton=function(t,e){return!1},qn.prototype._move=function(t,e){return{}},qn.prototype.mousedown=function(t,e){if(!this._lastPoint){var n=r.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}},qn.prototype.mousemoveWindow=function(t,e){var r=this._lastPoint;if(r&&(t.preventDefault(),this._moved||!(e.dist(r)0&&(this._active=!0);var i=Nn(n,r),a=new t.Point(0,0),o=new t.Point(0,0),s=0;for(var l in i){var c=i[l],u=this._touches[l];u&&(a._add(c),o._add(c.sub(u)),s++,i[l]=c)}if(this._touches=i,!(sMath.abs(t.x)}var ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,ti(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,r){var n=t[0].sub(this._lastPoints[0]),i=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,i,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+i.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,r){if(void 0!==this._valid)return this._valid;var n=t.mag()>=2,i=e.mag()>=2;if(n||i){if(!n||!i)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;var a=t.y>0==e.y>0;return ti(t)&&ti(e)&&a}},e}(Xn),ri={panStep:100,bearingStep:15,pitchStep:10},ni=function(){var t=ri;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep};function ii(t){return t*(2-t)}ni.prototype.reset=function(){this._active=!1},ni.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var r=0,n=0,i=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),o=1);break;default:return}return{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:ii,zoom:r?Math.round(l)+r*(t.shiftKey?2:1):l,bearing:s.getBearing()+n*e._bearingStep,pitch:s.getPitch()+i*e._pitchStep,offset:[-a*e._panStep,-o*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},ni.prototype.enable=function(){this._enabled=!0},ni.prototype.disable=function(){this._enabled=!1,this.reset()},ni.prototype.isEnabled=function(){return this._enabled},ni.prototype.isActive=function(){return this._active};var ai=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};ai.prototype.setZoomRate=function(t){this._defaultZoomRate=t},ai.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},ai.prototype.isEnabled=function(){return!!this._enabled},ai.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},ai.prototype.isZooming=function(){return!!this._zooming},ai.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},ai.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},ai.prototype.wheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.browser.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}},ai.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},ai.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var n=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},ai.prototype.renderFrame=function(){return this._onScrollFrame()},ai.prototype._onScrollFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var a="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(a*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var o,s="number"==typeof this._targetZoom?this._targetZoom:r.zoom,l=this._startZoom,c=this._easing,u=!1;if("wheel"===this._type&&l&&c){var f=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),h=c(f);o=t.number(l,s,h),f<1?this._frameId||(this._frameId=!0):u=!0}else o=s,u=!0;return this._active=!0,u&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!u,zoomDelta:o-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},ai.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.browser.now()-n.start)/n.duration,a=n.easing(i+.01)-n.easing(i),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=t.bezier(o,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r},ai.prototype.reset=function(){this._active=!1};var oi=function(t,e){this._clickZoom=t,this._tapZoom=e};oi.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},oi.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},oi.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},oi.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var si=function(){this.reset()};si.prototype.reset=function(){this._active=!1},si.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(r){r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.unproject(e)},{originalEvent:t})}}},si.prototype.enable=function(){this._enabled=!0},si.prototype.disable=function(){this._enabled=!1,this.reset()},si.prototype.isEnabled=function(){return this._enabled},si.prototype.isActive=function(){return this._active};var li=function(){this._tap=new Un({numTouches:1,numTaps:1}),this.reset()};li.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},li.prototype.touchstart=function(t,e,r){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=e[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,e,r))},li.prototype.touchmove=function(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;var n=e[0],i=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(t,e,r)},li.prototype.touchend=function(t,e,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(t,e,r)&&(this._tapTime=t.timeStamp)},li.prototype.touchcancel=function(){this.reset()},li.prototype.enable=function(){this._enabled=!0},li.prototype.disable=function(){this._enabled=!1,this.reset()},li.prototype.isEnabled=function(){return this._enabled},li.prototype.isActive=function(){return this._active};var ci=function(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r};ci.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},ci.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},ci.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},ci.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var ui=function(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r};ui.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},ui.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},ui.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},ui.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var fi=function(t,e,r,n){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0};fi.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},fi.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},fi.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},fi.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},fi.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},fi.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var hi=function(t){return t.zoom||t.drag||t.pitch||t.rotate},pi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function di(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var gi=function(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ln(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);var i=this._el;this._listeners=[[i,"touchstart",{passive:!1}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(var a=0,o=this._listeners;aa?Math.min(2,_):Math.max(.5,_),w=Math.pow(m,1-e),T=i.unproject(x.add(b.mult(e*w)).mult(g));i.setLocationAtPoint(i.renderWorldCopies?T.wrap():T,d)}n._fireMoveEvents(r)}),(function(t){n._afterEase(r,t)}),e),this},r.prototype._prepareEase=function(e,r,n){void 0===n&&(n={}),this._moving=!0,r||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e,r){if(!this._easeId||!r||this._easeId!==r){delete this._easeId;var n=this._zooming,i=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),a&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},r.prototype.flyTo=function(e,r){var n=this;if(!e.essential&&t.browser.prefersReducedMotion){var i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,r)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var a=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),c=this.getPadding(),u="zoom"in e?t.clamp(+e.zoom,a.minZoom,a.maxZoom):o,f="bearing"in e?this._normalizeBearing(e.bearing,s):s,h="pitch"in e?+e.pitch:l,p="padding"in e?e.padding:a.padding,d=a.zoomScale(u-o),g=t.Point.convert(e.offset),m=a.centerPoint.add(g),v=a.pointLocation(m),y=t.LngLat.convert(e.center||v);this._normalizeCenter(y);var x=a.project(v),b=a.project(y).sub(x),_=e.curve,w=Math.max(a.width,a.height),T=w/d,k=b.mag();if("minZoom"in e){var M=t.clamp(Math.min(e.minZoom,o,u),a.minZoom,a.maxZoom),A=w/a.zoomScale(M-o);_=Math.sqrt(A/k*2)}var S=_*_;function E(t){var e=(T*T-w*w+(t?-1:1)*S*S*k*k)/(2*(t?T:w)*S*k);return Math.log(Math.sqrt(e*e+1)-e)}function C(t){return(Math.exp(t)-Math.exp(-t))/2}function L(t){return(Math.exp(t)+Math.exp(-t))/2}var I=E(0),P=function(t){return L(I)/L(I+_*t)},z=function(t){return w*((L(I)*(C(e=I+_*t)/L(e))-C(I))/S)/k;var e},O=(E(1)-I)/_;if(Math.abs(k)<1e-6||!isFinite(O)){if(Math.abs(w-T)<1e-6)return this.easeTo(e,r);var D=Te.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==f,this._pitching=h!==l,this._padding=!a.isPaddingEqual(p),this._prepareEase(r,!1),this._ease((function(e){var i=e*O,d=1/P(i);a.zoom=1===e?u:o+a.scaleZoom(d),n._rotating&&(a.bearing=t.number(s,f,e)),n._pitching&&(a.pitch=t.number(l,h,e)),n._padding&&(a.interpolatePadding(c,p,e),m=a.centerPoint.add(g));var v=1===e?y:a.unproject(x.add(b.mult(z(i))).mult(d));a.setLocationAtPoint(a.renderWorldCopies?v.wrap():v,m),n._fireMoveEvents(r)}),(function(){return n._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){return this._stop()},r.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}if(!t){var n=this.handlers;n&&n.stop()}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),vi=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};vi.prototype.getDefaultPosition=function(){return"bottom-right"},vi.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._innerContainer=r.create("div","mapboxgl-ctrl-attrib-inner",this._container),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},vi.prototype.onRemove=function(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},vi.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var n=r.reduce((function(t,e,n){return e.value&&(t+=e.key+"="+e.value+(n=0)return!1;return!0}))).join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},vi.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var yi=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};yi.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://www.mapbox.com/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},yi.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},yi.prototype.getDefaultPosition=function(){return"bottom-left"},yi.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},yi.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},yi.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var xi=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};xi.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},xi.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var i=new wn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(n.call(this,i,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new xi,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},bi,e.locale),this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof wi))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return r._update(!1)})),this.on("moveend",(function(){return r._update(!1)})),this.on("zoom",(function(){return r._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1)),this.handlers=new gi(this,e),this._hash=e.hash&&new kn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new vi({customAttribution:e.customAttribution})),this.addControl(new yi,e.logoPosition),this.on("style.load",(function(){r.transform.unmodified&&r.jumpTo(r.style.stylesheet)})),this.on("data",(function(e){r._update("style"===e.dataType),r.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){r.fire(new t.Event(e.dataType+"dataloading",e))}))}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var a={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,r){if(void 0===r&&e.getDefaultPosition&&(r=e.getDefaultPosition()),void 0===r&&(r="top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var n=e.onAdd(this);this._controls.push(e);var i=this._controlPositions[r];return-1!==r.indexOf("bottom")?i.insertBefore(n,i.firstChild):i.appendChild(n),this},i.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i);var a=!this._moving;return a&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),a&&this.fire(new t.Event("moveend",e)),this},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},i.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},i.prototype._createDelegatedListener=function(t,e,r){var n,i=this;if("mouseenter"===t||"mouseover"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var o=i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[];o.length?a||(a=!0,r.call(i,new zn(t,i,n.originalEvent,{features:o}))):a=!1},mouseout:function(){a=!1}}}}if("mouseleave"===t||"mouseout"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?o=!0:o&&(o=!1,r.call(i,new zn(t,i,n.originalEvent)))},mouseout:function(e){o&&(o=!1,r.call(i,new zn(t,i,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var n=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(i,t),delete t.features)},n)}},i.prototype.on=function(t,e,r){if(void 0===r)return n.prototype.on.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var a in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i),i.delegates)this.on(a,i.delegates[a]);return this},i.prototype.once=function(t,e,r){if(void 0===r)return n.prototype.once.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var a in i.delegates)this.once(a,i.delegates[a]);return this},i.prototype.off=function(t,e,r){var i=this;return void 0===r?n.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(n){for(var a=n[t],o=0;o180;){var s=n.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}Ci.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag()},Ci.prototype.move=function(t,e){var r=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&r.setBearing(r.getBearing()+n.bearingDelta),this.mousePitch){var i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&r.setPitch(r.getPitch()+i.pitchDelta)}},Ci.prototype.off=function(){var t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},Ci.prototype.offTemp=function(){r.enableDrag(),r.removeEventListener(t.window,"mousemove",this.mousemove),r.removeEventListener(t.window,"mouseup",this.mouseup)},Ci.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),r.mousePos(this.element,e)),r.addEventListener(t.window,"mousemove",this.mousemove),r.addEventListener(t.window,"mouseup",this.mouseup)},Ci.prototype.mousemove=function(t){this.move(t,r.mousePos(this.element,t))},Ci.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},Ci.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},Ci.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},Ci.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)e.getEast()||r.latitudee.getNorth())},n.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}},n.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},n.prototype._updateCamera=function(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,i=this._map.getBearing(),a=t.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(n),a,{geolocateSource:!0})},n.prototype._updateMarker=function(e){if(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},n.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),r=this._map.unproject([1,t]),n=e.distanceTo(r),i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=i+"px",this._circleElement.style.height=i+"px"},n.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},n.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Fi)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},n.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},n.prototype._setupUI=function(e){var n=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=r.create("button","mapboxgl-ctrl-geolocate",this._container),r.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{var a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Oi(this._dotElement),this._circleElement=r.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Oi({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==n._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(n._watchState="BACKGROUND",n._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),n._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),n.fire(new t.Event("trackuserlocationend")))}))},n.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ri--,Fi=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Ri>1?(e={maximumAge:6e5,timeout:0},Fi=!0):(e=this.options.positionOptions,Fi=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},n.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},n}(t.Evented),Ni={maxWidth:100,unit:"metric"},ji=function(e){this.options=t.extend({},Ni,e),t.bindAll(["_onMove","setUnit"],this)};function Ui(t,e,r){var n=r&&r.maxWidth||100,i=t._container.clientHeight/2,a=t.unproject([0,i]),o=t.unproject([n,i]),s=a.distanceTo(o);if(r&&"imperial"===r.unit){var l=3.2808*s;l>5280?Vi(e,n,l/5280,t._getUIString("ScaleControl.Miles")):Vi(e,n,l,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?Vi(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Vi(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):Vi(e,n,s,t._getUIString("ScaleControl.Meters"))}function Vi(t,e,r,n){var i,a,o,s=(i=r,(a=Math.pow(10,(""+Math.floor(i)).length-1))*(o=(o=i/a)>=10?10:o>=5?5:o>=3?3:o>=2?2:o>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(o)));t.style.width=e*(s/r)+"px",t.innerHTML=s+" "+n}ji.prototype.getDefaultPosition=function(){return"bottom-left"},ji.prototype._onMove=function(){Ui(this._map,this._container,this.options)},ji.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},ji.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},ji.prototype.setUnit=function(t){this.options.unit=t,Ui(this._map,this._container,this.options)};var qi=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};qi.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},qi.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},qi.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},qi.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},qi.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},qi.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},qi.prototype._isFullscreen=function(){return this._fullscreen},qi.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},qi.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Hi={closeButton:!0,closeOnClick:!0,className:"",maxWidth:"240px"},Gi=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(Hi),r),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},n.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},n.prototype.getElement=function(){return this._container},n.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},n.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},n.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},n.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},n.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},n.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},n.prototype._createContent=function(){this._content&&r.remove(this._content),this._content=r.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},n.prototype._onMouseUp=function(t){this._update(t.point)},n.prototype._onMouseMove=function(t){this._update(t.point)},n.prototype._onDrag=function(t){this._update(t.point)},n.prototype._update=function(e){var n=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return n._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Li(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),a=this.options.anchor,o=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(n,n),"top-right":new t.Point(-n,n),bottom:new t.Point(0,-r),"bottom-left":new t.Point(n,-n),"bottom-right":new t.Point(-n,-n),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var i=t.Point.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!a){var s,l=this._container.offsetWidth,c=this._container.offsetHeight;s=i.y+o.bottom.ythis._map.transform.height-c?["bottom"]:[],i.xthis._map.transform.width-l/2&&s.push("right"),a=0===s.length?"bottom":s.join("-")}var u=i.add(o[a]).round();r.setTransform(this._container,Ii[a]+" translate("+u.x+"px,"+u.y+"px)"),Pi(this._container,a,"popup")}},n.prototype._onClose=function(){this.remove()},n}(t.Evented),Yi={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Mi,NavigationControl:Ei,GeolocateControl:Bi,AttributionControl:vi,ScaleControl:ji,FullscreenControl:qi,Popup:Gi,Marker:Oi,Style:qe,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Bt().acquire(Ot)},clearPrewarmedResources:function(){var t=Rt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Ot),Rt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Dt.workerCount},set workerCount(t){Dt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:""};return Yi})),r}))},{}],474:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1<p[1][2]&&(v[0]=-v[0]),p[0][2]>p[2][0]&&(v[1]=-v[1]),p[1][0]>p[0][1]&&(v[2]=-v[2]),!0}},{"./normalize":476,"gl-mat4/clone":278,"gl-mat4/create":280,"gl-mat4/determinant":281,"gl-mat4/invert":293,"gl-mat4/transpose":306,"gl-vec3/cross":365,"gl-vec3/dot":370,"gl-vec3/length":380,"gl-vec3/normalize":387}],476:[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}},{}],477:[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(),c=f(),u=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),p=a(r,c.translate,c.scale,c.skew,c.perspective,c.quaternion);return!(!h||!p)&&(n(u.translate,l.translate,c.translate,f),n(u.skew,l.skew,c.skew,f),n(u.scale,l.scale,c.scale,f),n(u.perspective,l.perspective,c.perspective,f),s(u.quaternion,l.quaternion,c.quaternion,f),i(t,u.translate,u.scale,u.skew,u.perspective,u.quaternion),!0)}},{"gl-mat4/determinant":281,"gl-vec3/lerp":381,"mat4-decompose":475,"mat4-recompose":478,"quat-slerp":527}],478:[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":280,"gl-mat4/fromRotationTranslation":284,"gl-mat4/identity":291,"gl-mat4/multiply":295,"gl-mat4/scale":303,"gl-mat4/translate":305}],479:[function(t,e,r){"use strict";e.exports=Math.log2||function(t){return Math.log(t)*Math.LOG2E}},{}],480:[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"),c=t("gl-mat4/lookAt"),u=t("gl-mat4/translate"),f=(t("gl-mat4/scale"),t("gl-vec3/normalize")),h=[0,0,0];function p(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 p((t=t||{}).matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};var d=p.prototype;d.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,c=0;c<16;++c)o[c]=s[l++];else{var u=e[r+1]-e[r],h=(l=16*r,this.prevMatrix),p=!0;for(c=0;c<16;++c)h[c]=s[l++];var d=this.nextMatrix;for(c=0;c<16;++c)d[c]=s[l++],p=p&&h[c]===d[c];if(u<1e-6||p)for(c=0;c<16;++c)o[c]=h[c];else i(o,h,d,(t-e[r])/u)}var g=this.computedUp;g[0]=o[1],g[1]=o[5],g[2]=o[9],f(g,g);var m=this.computedInverse;a(m,o);var v=this.computedEye,y=m[15];v[0]=m[12]/y,v[1]=m[13]/y,v[2]=m[14]/y;var x=this.computedCenter,b=Math.exp(this.computedRadius[0]);for(c=0;c<3;++c)x[c]=v[c]-o[2+4*c]*b}},d.idle=function(t){if(!(t1&&n(t[o[u-2]],t[o[u-1]],c)<=0;)u-=1,o.pop();for(o.push(l),u=s.length;u>1&&n(t[s[u-2]],t[s[u-1]],c)>=0;)u-=1,s.pop();s.push(l)}r=new Array(s.length+o.length-2);for(var f=0,h=(i=0,o.length);i0;--p)r[f++]=s[p];return r};var n=t("robust-orientation")[3]},{"robust-orientation":548}],483:[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 c(t,s){var c=n.x(s),u=n.y(s);"buttons"in s&&(t=0|s.buttons),(t!==r||c!==i||u!==a||l(s))&&(r=0|t,i=c||0,a=u||0,e&&e(r,i,a,o))}function u(t){c(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 p(t){0===n.buttons(t)?c(0,t):c(r,t)}function d(t){c(r|n.buttons(t),t)}function g(t){c(r&~n.buttons(t),t)}function m(){s||(s=!0,t.addEventListener("mousemove",p),t.addEventListener("mousedown",d),t.addEventListener("mouseup",g),t.addEventListener("mouseleave",u),t.addEventListener("mouseenter",u),t.addEventListener("mouseout",u),t.addEventListener("mouseover",u),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)))}m();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return s},set:function(e){e?m():function(){if(!s)return;s=!1,t.removeEventListener("mousemove",p),t.removeEventListener("mousedown",d),t.removeEventListener("mouseup",g),t.removeEventListener("mouseleave",u),t.removeEventListener("mouseenter",u),t.removeEventListener("mouseout",u),t.removeEventListener("mouseover",u),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}}),v};var n=t("mouse-event")},{"mouse-event":485}],484:[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}},{}],485:[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 w=t.getters||[],T=new Array(b),k=0;k=0?T[k]=!0:T[k]=!1;return function(t,e,r,b,_,w){var T=w.length,k=_.length;if(k<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var M="extractContour"+_.join("_"),A=[],S=[],E=[],C=0;C0&&z.push(l(C,_[L-1])+"*"+s(_[L-1])),S.push(d(C,_[L])+"=("+z.join("-")+")|0")}for(C=0;C=0;--C)O.push(s(_[C]));S.push("Q=("+O.join("*")+")|0","P=mallocUint32(Q)","V=mallocUint32(Q)","X=0"),S.push(g(0)+"=0");for(L=1;L<1<0;_=_-1&d)x.push("V[X+"+v(_)+"]");x.push(y(0));for(_=0;_=0;--e)N(e,0);var r=[];for(e=0;e0){",p(_[e]),"=1;"),t(e-1,r|1<<_[e]);for(var n=0;n=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 c=".lo("+a.join()+").hi("+o.join()+")";if(0===a.length&&(c=""),i>0){n.push("if(1");for(l=0;l=0||e.indexOf(-(l+1))>=0||n.push("&&s[",l,"]>2");n.push("){grad",i,"(src.pick(",s.join(),")",c);for(l=0;l=0||e.indexOf(-(l+1))>=0||n.push(",dst.pick(",s.join(),",",l,")",c);n.push(");")}for(l=0;l1){dst.set(",s.join(),",",u,",0.5*(src.get(",h.join(),")-src.get(",p.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):n.push("if(s[",u,"]>1){diff(",f,",src.pick(",h.join(),")",c,",src.pick(",p.join(),")",c,");}else{zero(",f,");};");break;case"mirror":0===i?n.push("dst.set(",s.join(),",",u,",0);"):n.push("zero(",f,");");break;case"wrap":var d=s.slice(),g=s.slice();e[l]<0?(d[u]="s["+u+"]-2",g[u]="0"):(d[u]="s["+u+"]-1",g[u]="1"),0===i?n.push("if(s[",u,"]>2){dst.set(",s.join(),",",u,",0.5*(src.get(",d.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):n.push("if(s[",u,"]>2){diff(",f,",src.pick(",d.join(),")",c,",src.pick(",g.join(),")",c,");}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 c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[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 u=["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":151}],491:[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":492,ndarray:495}],492:[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":151}],493:[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",d,"=s",d,"-d",f,"*n",f].join("")):s.push(["d",d,"=s",d].join("")),f=d),0!==(p=t.length-1-l)&&(h>0?s.push(["e",p,"=s",p,"-e",h,"*n",h,",f",p,"=",c[p],"-f",h,"*n",h].join("")):s.push(["e",p,"=s",p,",f",p,"=",c[p]].join("")),h=p)}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 m=new Function("insertionSort","quickSort",r.join("\n")),v=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 c=[],u=1;u1){r.push("dptr=0;sptr=ptr");for(u=t.length-1;u>=0;--u){0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"b){break __l}"].join(""));for(u=t.length-1;u>=1;--u)r.push("sptr+=e"+u,"dptr+=f"+u,"}");r.push("dptr=cptr;sptr=cptr-s0");for(u=t.length-1;u>=0;--u){0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"=0;--u){0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"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)),c=a(e),u=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=[],p=1;p=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="+d(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 x(){t.length>1&&c&&n.push("free(pivot1)","free(pivot2)")}function b(e,r){var i="el"+e,a="el"+r;if(t.length>1){var o="__l"+ ++u;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(d(i)),">",g(d(a)),"){tmp0=",i,";",i,"=",a,";",a,"=tmp0}"].join(""))}function _(e,r){t.length>1?v([e,r],!1,m("ptr0",g("ptr1"))):n.push(m(d(e),g(d(r))))}function w(e,r,i){if(t.length>1){var a="__l"+ ++u;y(a,[r],!0,[e,"=",g("ptr0"),"-pivot",i,"[pivot_ptr]\n","if(",e,"!==0){break ",a,"}"].join(""))}else n.push([e,"=",g(d(r)),"-pivot",i].join(""))}function T(e,r){t.length>1?v([e,r],!1,["tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1","tmp")].join("")):n.push(["ptr0=",d(e),"\n","ptr1=",d(r),"\n","tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1","tmp")].join(""))}function k(e,r,i){t.length>1?(v([e,r,i],!1,["tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1",g("ptr2")),"\n",m("ptr2","tmp")].join("")),n.push("++"+r,"--"+i)):n.push(["ptr0=",d(e),"\n","ptr1=",d(r),"\n","ptr2=",d(i),"\n","++",r,"\n","--",i,"\n","tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1",g("ptr2")),"\n",m("ptr2","tmp")].join(""))}function M(t,e){T(t,e),n.push("--"+e)}function A(e,r,i){t.length>1?v([e,r],!0,[m("ptr0",g("ptr1")),"\n",m("ptr1",["pivot",i,"[pivot_ptr]"].join(""))].join("")):n.push(m(d(e),g(d(r))),m(d(r),"pivot"+i))}function S(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 E(e,r,i){t.length>1?(n.push(["__l",++u,":while(true){"].join("")),v([e],!0,["if(",g("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",u,"}"].join("")),n.push(i,"}")):n.push(["while(",g(d(e)),"===pivot",r,"){",i,"}"].join(""))}return n.push("var "+f.join(",")),b(1,2),b(4,5),b(1,3),b(2,3),b(1,4),b(3,4),b(2,5),b(2,3),b(4,5),t.length>1?v(["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",m("ptr5","x"),"\n",m("ptr6","y"),"\n",m("ptr7","z")].join("")):n.push(["pivot1=",g(d("el2")),"\n","pivot2=",g(d("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",g(d("el1")),"\n","y=",g(d("el3")),"\n","z=",g(d("el5")),"\n",m(d("index1"),"x"),"\n",m(d("index3"),"y"),"\n",m(d("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){"),T("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){"),k("k","less","great"),n.push("break"),n.push("}else{"),M("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){"),T("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){"),E("less",1,"++less"),E("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){"),T("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&&c?new Function("insertionSort","malloc","free",n.join("\n"))(r,c[0],c[1]):new Function("insertionSort",n.join("\n"))(r)}(t,e,v);return m(v,y)}},{"typedarray-pool":595}],494:[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":493}],495:[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("+u+",v)}"):a.push("return this.data["+u+"]=v}"),a.push("proto.get=function "+r+"_get("+l.join(",")+"){"),i?a.push("return this.data.get("+u+")}"):a.push("return this.data["+u+"]}"),a.push("proto.index=function "+r+"_index(",l.join(),"){return "+u+"}"),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 p=o.map((function(t){return"a"+t+"=this.shape["+t+"]"})),d=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,"+p.join(",")+","+d.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"))(c[t],s)}var c={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};e.exports=function(t,e,r,n){if(void 0===t)return(0,c.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,u=1;s>=0;--s)r[s]=u,u*=e[s]}if(void 0===n){n=0;for(s=0;st==t>0?a===-1>>>0?(r+=1,a=0):a+=1:0===a?(a=-1>>>0,r-=1):a-=1;return n.pack(a,r)}},{"double-bits":173}],497:[function(t,e,r){var n=Math.PI,i=c(120);function a(t,e,r,n){return["C",t,e,r,n,r,n]}function o(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}function s(t,e,r,a,o,c,u,f,h,p){if(p)T=p[0],k=p[1],_=p[2],w=p[3];else{var d=l(t,e,-o);t=d.x,e=d.y;var g=(t-(f=(d=l(f,h,-o)).x))/2,m=(e-(h=d.y))/2,v=g*g/(r*r)+m*m/(a*a);v>1&&(r*=v=Math.sqrt(v),a*=v);var y=r*r,x=a*a,b=(c==u?-1:1)*Math.sqrt(Math.abs((y*x-y*m*m-x*g*g)/(y*m*m+x*g*g)));b==1/0&&(b=1);var _=b*r*m/a+(t+f)/2,w=b*-a*g/r+(e+h)/2,T=Math.asin(((e-w)/a).toFixed(9)),k=Math.asin(((h-w)/a).toFixed(9));(T=t<_?n-T:T)<0&&(T=2*n+T),(k=f<_?n-k:k)<0&&(k=2*n+k),u&&T>k&&(T-=2*n),!u&&k>T&&(k-=2*n)}if(Math.abs(k-T)>i){var M=k,A=f,S=h;k=T+i*(u&&k>T?1:-1);var E=s(f=_+r*Math.cos(k),h=w+a*Math.sin(k),r,a,o,0,u,A,S,[k,M,_,w])}var C=Math.tan((k-T)/4),L=4/3*r*C,I=4/3*a*C,P=[2*t-(t+L*Math.sin(T)),2*e-(e-I*Math.cos(T)),f+L*Math.sin(k),h-I*Math.cos(k),f,h];if(p)return P;E&&(P=P.concat(E));for(var z=0;z7&&(r.push(v.splice(0,7)),v.unshift("C"));break;case"S":var x=p,b=d;"C"!=e&&"S"!=e||(x+=x-n,b+=b-i),v=["C",x,b,v[1],v[2],v[3],v[4]];break;case"T":"Q"==e||"T"==e?(f=2*p-f,h=2*d-h):(f=p,h=d),v=o(p,d,f,h,v[1],v[2]);break;case"Q":f=v[1],h=v[2],v=o(p,d,v[1],v[2],v[3],v[4]);break;case"L":v=a(p,d,v[1],v[2]);break;case"H":v=a(p,d,v[1],d);break;case"V":v=a(p,d,p,v[1]);break;case"Z":v=a(p,d,l,u)}e=y,p=v[v.length-2],d=v[v.length-1],v.length>4?(n=v[v.length-4],i=v[v.length-3]):(n=p,i=d),r.push(v)}return r}},{}],498:[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 b=i[c],_=1/Math.sqrt(m*y);for(x=0;x<3;++x){var w=(x+1)%3,T=(x+2)%3;b[x]+=_*(v[w]*g[T]-v[T]*g[w])}}}for(o=0;oa)for(_=1/Math.sqrt(k),x=0;x<3;++x)b[x]*=_;else for(x=0;x<3;++x)b[x]=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(p):0;for(c=0;c<3;++c)h[c]*=p;i[o]=h}return i}},{}],499:[function(t,e,r){ /* object-assign (c) Sindre Sorhus @license MIT */ -"use strict";var n=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,l=o(t),c=1;c0){var h=Math.sqrt(u+1);t[0]=.5*(o-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-i)/h,t[3]=.5*h}else{var f=Math.max(e,i,c);h=Math.sqrt(2*f-u+1);e>=f?(t[0]=.5*h,t[1]=.5*(a+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(o-l)/h):i>=f?(t[0]=.5*(r+a)/h,t[1]=.5*h,t[2]=.5*(l+o)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(o+l)/h,t[2]=.5*h,t[3]=.5*(r-a)/h)}return t}},{}],475:[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),u(r=[].slice.call(r,0,4),r);var a=new h(r,e,Math.log(n));a.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&a.lookAt(0,t.eye,t.center,t.up);return a};var n=t("filtered-vector"),a=t("gl-mat4/lookAt"),i=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 c(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function u(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=c(r,n,a,i);o>1e-6?(t[0]=r/o,t[1]=n/o,t[2]=a/o,t[3]=i/o):(t[0]=t[1]=t[2]=0,t[3]=1)}function h(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 f=h.prototype;f.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},f.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;u(e,e);var r=this.computedMatrix;i(r,e);var n=this.computedCenter,a=this.computedEye,o=this.computedUp,s=Math.exp(this.computedRadius[0]);a[0]=n[0]+s*r[2],a[1]=n[1]+s*r[6],a[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 c=0,h=0;h<3;++h)c+=r[l+4*h]*a[h];r[12+l]=-c}},f.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},f.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},f.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},f.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var a=this.computedMatrix,i=a[1],o=a[5],s=a[9],c=l(i,o,s);i/=c,o/=c,s/=c;var u=a[0],h=a[4],f=a[8],p=u*i+h*o+f*s,d=l(u-=i*p,h-=o*p,f-=s*p);u/=d,h/=d,f/=d;var g=a[2],m=a[6],v=a[10],y=g*i+m*o+v*s,x=g*u+m*h+v*f,b=l(g-=y*i+x*u,m-=y*o+x*h,v-=y*s+x*f);g/=b,m/=b,v/=b;var _=u*e+i*r,w=h*e+o*r,T=f*e+s*r;this.center.move(t,_,w,T);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+n),this.radius.set(t,Math.log(k))},f.rotate=function(t,e,r,n){this.recalcMatrix(t),e=e||0,r=r||0;var a=this.computedMatrix,i=a[0],o=a[4],s=a[8],u=a[1],h=a[5],f=a[9],p=a[2],d=a[6],g=a[10],m=e*i+r*u,v=e*o+r*h,y=e*s+r*f,x=-(d*y-g*v),b=-(g*m-p*y),_=-(p*v-d*m),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),T=c(x,b,_,w);T>1e-6?(x/=T,b/=T,_/=T,w/=T):(x=b=_=0,w=1);var k=this.computedRotation,M=k[0],A=k[1],S=k[2],E=k[3],C=M*w+E*x+A*_-S*b,L=A*w+E*b+S*x-M*_,P=S*w+E*_+M*b-A*x,I=E*w-M*x-A*b-S*_;if(n){x=p,b=d,_=g;var z=Math.sin(n)/l(x,b,_);x*=z,b*=z,_*=z,I=I*(w=Math.cos(e))-(C=C*w+I*x+L*_-P*b)*x-(L=L*w+I*b+P*x-C*_)*b-(P=P*w+I*_+C*b-L*x)*_}var O=c(C,L,P,I);O>1e-6?(C/=O,L/=O,P/=O,I/=O):(C=L=P=0,I=1),this.rotation.set(t,C,L,P,I)},f.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;a(i,e,r,n);var o=this.computedRotation;s(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),u(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var l=0,c=0;c<3;++c)l+=Math.pow(r[c]-e[c],2);this.radius.set(t,.5*Math.log(Math.max(l,1e-6))),this.center.set(t,r[0],r[1],r[2])},f.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},f.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]),u(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;o(n,e);var a=n[15];if(Math.abs(a)>1e-6){var i=n[12]/a,l=n[13]/a,c=n[14]/a;this.recalcMatrix(t);var h=Math.exp(this.computedRadius[0]);this.center.set(t,i-n[2]*h,l-n[6]*h,c-n[10]*h),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},f.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},f.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},f.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])]},f.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]}},f.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 a=t.distance;a&&a>0&&this.radius.set(e,Math.log(a)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":474,"filtered-vector":242,"gl-mat4/fromQuat":275,"gl-mat4/invert":278,"gl-mat4/lookAt":279}],476:[function(t,e,r){ +"use strict";var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,l=o(t),c=1;c0){var f=Math.sqrt(u+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,c);f=Math.sqrt(2*h-u+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}},{}],501:[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),u(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 c(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function u(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=c(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;u(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 c=0,f=0;f<3;++f)c+=r[l+4*f]*i[f];r[12+l]=-c}},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],c=l(a,o,s);a/=c,o/=c,s/=c;var u=i[0],f=i[4],h=i[8],p=u*a+f*o+h*s,d=l(u-=a*p,f-=o*p,h-=s*p);u/=d,f/=d,h/=d;var g=i[2],m=i[6],v=i[10],y=g*a+m*o+v*s,x=g*u+m*f+v*h,b=l(g-=y*a+x*u,m-=y*o+x*f,v-=y*s+x*h);g/=b,m/=b,v/=b;var _=u*e+a*r,w=f*e+o*r,T=h*e+s*r;this.center.move(t,_,w,T);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+n),this.radius.set(t,Math.log(k))},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],u=i[1],f=i[5],h=i[9],p=i[2],d=i[6],g=i[10],m=e*a+r*u,v=e*o+r*f,y=e*s+r*h,x=-(d*y-g*v),b=-(g*m-p*y),_=-(p*v-d*m),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),T=c(x,b,_,w);T>1e-6?(x/=T,b/=T,_/=T,w/=T):(x=b=_=0,w=1);var k=this.computedRotation,M=k[0],A=k[1],S=k[2],E=k[3],C=M*w+E*x+A*_-S*b,L=A*w+E*b+S*x-M*_,I=S*w+E*_+M*b-A*x,P=E*w-M*x-A*b-S*_;if(n){x=p,b=d,_=g;var z=Math.sin(n)/l(x,b,_);x*=z,b*=z,_*=z,P=P*(w=Math.cos(e))-(C=C*w+P*x+L*_-I*b)*x-(L=L*w+P*b+I*x-C*_)*b-(I=I*w+P*_+C*b-L*x)*_}var O=c(C,L,I,P);O>1e-6?(C/=O,L/=O,I/=O,P/=O):(C=L=I=0,P=1),this.rotation.set(t,C,L,I,P)},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]),u(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var l=0,c=0;c<3;++c)l+=Math.pow(r[c]-e[c],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]),u(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,c=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,c-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":500,"filtered-vector":242,"gl-mat4/fromQuat":282,"gl-mat4/invert":293,"gl-mat4/lookAt":294}],502:[function(t,e,r){ /*! * pad-left * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT license. */ -"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return n(r="undefined"!=typeof r?r+"":" ",e)+t}},{"repeat-string":513}],477:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)return[t];var r=[t];"string"==typeof e||Array.isArray(e)?e={brackets:e}:e||(e={});var n=e.brackets?Array.isArray(e.brackets)?e.brackets:[e.brackets]:["{}","[]","()"],a=e.escape||"___",i=!!e.flat;n.forEach((function(t){var e=new RegExp(["\\",t[0],"[^\\",t[0],"\\",t[1],"]*\\",t[1]].join("")),n=[];function i(e,i,o){var s=r.push(e.slice(t[0].length,-t[1].length))-1;return n.push(s),a+s+a}r.forEach((function(t,n){for(var a,o=0;t!=a;)if(a=t,t=t.replace(e,i),o++>1e4)throw Error("References have circular dependency. Please, check them.");r[n]=t})),n=n.reverse(),r=r.map((function(e){return n.forEach((function(r){e=e.replace(new RegExp("(\\"+a+r+"\\"+a+")","g"),t[0]+"$1"+t[1])})),e}))}));var o=new RegExp("\\"+a+"([0-9]+)\\"+a);return i?r:function t(e,r,n){for(var a,i=[],s=0;a=o.exec(e);){if(s++>1e4)throw Error("Circular references in parenthesis");i.push(e.slice(0,a.index)),i.push(t(r[a[1]],r)),e=e.slice(a.index+a[0].length)}return i.push(e),i}(r[0],r)}function a(t,e){if(e&&e.flat){var r,n=e&&e.escape||"___",a=t[0];if(!a)return"";for(var i=new RegExp("\\"+n+"([0-9]+)\\"+n),o=0;a!=r;){if(o++>1e4)throw Error("Circular references in "+t);r=a,a=a.replace(i,s)}return a}return t.reduce((function t(e,r){return Array.isArray(r)&&(r=r.reduce(t,"")),e+r}),"");function s(e,r){if(null==t[r])throw Error("Reference "+r+"is undefined");return t[r]}}function i(t,e){return Array.isArray(t)?a(t,e):n(t,e)}i.parse=n,i.stringify=a,e.exports=i},{}],478:[function(t,e,r){"use strict";var n=t("pick-by-alias");e.exports=function(t){var e;arguments.length>1&&(t=arguments);"string"==typeof t?t=t.split(/\s/).map(parseFloat):"number"==typeof t&&(t=[t]);t.length&&"number"==typeof t[0]?e=1===t.length?{width:t[0],height:t[0],x:0,y:0}:2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=n(t,{left:"x l left Left",top:"y t top Top",width:"w width W Width",height:"h height W Width",bottom:"b bottom Bottom",right:"r right Right"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e}},{"pick-by-alias":485}],479:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(a,(function(t,r,a){var o=r.toLowerCase();for(a=function(t){var e=t.match(i);return e?e.map(Number):[]}(a),"m"==o&&a.length>2&&(e.push([r].concat(a.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(a.length==n[o])return a.unshift(r),e.push(a);if(a.length=0;n--){var a=t[n];"."===a?t.splice(n,1):".."===a?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!a;i--){var o=i>=0?arguments[i]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(r=o+"/"+r,a="/"===o.charAt(0))}return(a?"/":"")+(r=e(n(r.split("/"),(function(t){return!!t})),!a).join("/"))||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===a(t,-1);return(t=e(n(t.split("/"),(function(t){return!!t})),!i).join("/"))||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var a=n(t.split("/")),i=n(e.split("/")),o=Math.min(a.length,i.length),s=o,l=0;l=1;--i)if(47===(e=t.charCodeAt(i))){if(!a){n=i;break}}else a=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)},r.basename=function(t,e){var r=function(t){"string"!=typeof t&&(t+="");var e,r=0,n=-1,a=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!a){r=e+1;break}}else-1===n&&(a=!1,n=e+1);return-1===n?"":t.slice(r,n)}(t);return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},r.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,r=0,n=-1,a=!0,i=0,o=t.length-1;o>=0;--o){var s=t.charCodeAt(o);if(47!==s)-1===n&&(a=!1,n=o+1),46===s?-1===e?e=o:1!==i&&(i=1):-1!==e&&(i=-1);else if(!a){r=o+1;break}}return-1===e||-1===n||0===i||1===i&&e===n-1&&e===r+1?"":t.slice(e,n)};var a="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:500}],482:[function(t,e,r){(function(t){(function(){var r,n,a,i,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(r()-o)/1e6},n=t.hrtime,i=(r=function(){var t;return 1e9*(t=n())[0]+t[1]})(),s=1e9*t.uptime(),o=i-s):Date.now?(e.exports=function(){return Date.now()-a},a=Date.now()):(e.exports=function(){return(new Date).getTime()-a},a=(new Date).getTime())}).call(this)}).call(this,t("_process"))},{_process:500}],483:[function(t,e,r){"use strict";e.exports=function(t){var e=t.length;if(e<32){for(var r=1,a=0;a0;--o)i=l[o],r=s[o],s[o]=s[i],s[i]=r,l[o]=l[r],l[r]=i,c=(c+r)*o;return n.freeUint32(l),n.freeUint32(s),c},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,a,i,o=1;for((r=r||new Array(t))[0]=0,i=1;i0;--i)e=e-(n=e/o|0)*o|0,o=o/i|0,a=0|r[i],r[i]=0|r[n],r[n]=0|a;return r}},{"invert-permutation":436,"typedarray-pool":567}],485:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i,o={};if("string"==typeof e&&(e=a(e)),Array.isArray(e)){var s={};for(i=0;i0){o=i[u][r][0],l=u;break}s=o[1^l];for(var h=0;h<2;++h)for(var f=i[h][r],p=0;p0&&(o=d,s=g,l=h)}return a||o&&c(o,l),s}function h(t,r){var a=i[r][t][0],o=[t];c(a,r);for(var s=a[1^r];;){for(;s!==t;)o.push(s),s=u(o[o.length-2],s,!1);if(i[0][t].length+i[1][t].length===0)break;var l=o[o.length-1],h=t,f=o[1],p=u(l,h,!0);if(n(e[l],e[h],e[f],e[p])<0)break;o.push(t),s=u(l,h)}return o}function f(t,e){return e[1]===e[e.length-1]}for(o=0;o0;){i[0][o].length;var g=h(o,p);f(0,g)?d.push.apply(d,g):(d.length>0&&l.push(d),d=g)}d.length>0&&l.push(d)}return l};var n=t("compare-angle")},{"compare-angle":132}],487:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=n(t,e.length),a=new Array(e.length),i=new Array(e.length),o=[],s=0;s0;){var c=o.pop();a[c]=!1;var u=r[c];for(s=0;s0}))).length,m=new Array(g),v=new Array(g);for(p=0;p0;){var B=R.pop(),N=E[B];l(N,(function(t,e){return t-e}));var j,U=N.length,V=F[B];if(0===V){var q=d[B];j=[q]}for(p=0;p=0))if(F[H]=1^V,R.push(H),0===V)D(q=d[H])||(q.reverse(),j.push(q))}0===V&&r.push(j)}return r};var n=t("edges-to-adjacency-list"),a=t("planar-dual"),i=t("point-in-big-polygon"),o=t("two-product"),s=t("robust-sum"),l=t("uniq"),c=t("./lib/trim-leaves");function u(t,e){for(var r=new Array(t),n=0;n0&&e[a]===r[0]))return 1;i=t[a-1]}for(var s=1;i;){var l=i.key,c=n(r,l[0],l[1]);if(l[0][0]0))return 0;s=-1,i=i.right}else if(c>0)i=i.left;else{if(!(c<0))return 0;s=1,i=i.right}}return s}}(v.slabs,v.coordinates);return 0===i.length?y:function(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}(l(i),y)};var n=t("robust-orientation")[3],a=t("slab-decomposition"),i=t("interval-tree-1d"),o=t("binary-search-bounds");function s(){return!0}function l(t){for(var e={},r=0;r1e4)throw Error("References have circular dependency. Please, check them.");r[n]=t})),n=n.reverse(),r=r.map((function(e){return n.forEach((function(r){e=e.replace(new RegExp("(\\"+i+r+"\\"+i+")","g"),t[0]+"$1"+t[1])})),e}))}));var o=new RegExp("\\"+i+"([0-9]+)\\"+i);return a?r:function t(e,r,n){for(var i,a=[],s=0;i=o.exec(e);){if(s++>1e4)throw Error("Circular references in parenthesis");a.push(e.slice(0,i.index)),a.push(t(r[i[1]],r)),e=e.slice(i.index+i[0].length)}return a.push(e),a}(r[0],r)}function i(t,e){if(e&&e.flat){var r,n=e&&e.escape||"___",i=t[0];if(!i)return"";for(var a=new RegExp("\\"+n+"([0-9]+)\\"+n),o=0;i!=r;){if(o++>1e4)throw Error("Circular references in "+t);r=i,i=i.replace(a,s)}return i}return t.reduce((function t(e,r){return Array.isArray(r)&&(r=r.reduce(t,"")),e+r}),"");function s(e,r){if(null==t[r])throw Error("Reference "+r+"is undefined");return t[r]}}function a(t,e){return Array.isArray(t)?i(t,e):n(t,e)}a.parse=n,a.stringify=i,e.exports=a},{}],504:[function(t,e,r){"use strict";var n=t("pick-by-alias");e.exports=function(t){var e;arguments.length>1&&(t=arguments);"string"==typeof t?t=t.split(/\s/).map(parseFloat):"number"==typeof t&&(t=[t]);t.length&&"number"==typeof t[0]?e=1===t.length?{width:t[0],height:t[0],x:0,y:0}:2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=n(t,{left:"x l left Left",top:"y t top Top",width:"w width W Width",height:"h height W Width",bottom:"b bottom Bottom",right:"r right Right"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e}},{"pick-by-alias":511}],505:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,(function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),"m"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",i=0):i=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),a=s,o=0;continue}}else if(2===n.length||1===n.length){n="",i=0,a=s,o=0;continue}e&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+t.slice(a+1,s):n=t.slice(a+1,s),i=s-a-1;a=s,o=0}else 46===r&&-1!==o?++o:o=-1}return n}var i={resolve:function(){for(var e,i="",a=!1,o=arguments.length-1;o>=-1&&!a;o--){var s;o>=0?s=arguments[o]:(void 0===e&&(e=t.cwd()),s=e),r(s),0!==s.length&&(i=s+"/"+i,a=47===s.charCodeAt(0))}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(t){if(r(t),0===t.length)return".";var e=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return 0!==(t=n(t,!e)).length||e||(t="."),t.length>0&&i&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return r(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=n:t+="/"+n)}return void 0===t?".":i.normalize(t)},relative:function(t,e){if(r(t),r(e),t===e)return"";if((t=i.resolve(t))===(e=i.resolve(e)))return"";for(var n=1;nc){if(47===e.charCodeAt(s+f))return e.slice(s+f+1);if(0===f)return e.slice(s+f)}else o>c&&(47===t.charCodeAt(n+f)?u=f:0===f&&(u=0));break}var h=t.charCodeAt(n+f);if(h!==e.charCodeAt(s+f))break;47===h&&(u=f)}var p="";for(f=n+u+1;f<=a;++f)f!==a&&47!==t.charCodeAt(f)||(0===p.length?p+="..":p+="/..");return p.length>0?p+e.slice(s+u):(s+=u,47===e.charCodeAt(s)&&++s,e.slice(s))},_makeLong:function(t){return t},dirname:function(t){if(r(t),0===t.length)return".";for(var e=t.charCodeAt(0),n=47===e,i=-1,a=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!a){i=o;break}}else a=!1;return-1===i?n?"/":".":n&&1===i?"//":t.slice(0,i)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');r(t);var n,i=0,a=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var s=e.length-1,l=-1;for(n=t.length-1;n>=0;--n){var c=t.charCodeAt(n);if(47===c){if(!o){i=n+1;break}}else-1===l&&(o=!1,l=n+1),s>=0&&(c===e.charCodeAt(s)?-1==--s&&(a=n):(s=-1,a=l))}return i===a?a=l:-1===a&&(a=t.length),t.slice(i,a)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!o){i=n+1;break}}else-1===a&&(o=!1,a=n+1);return-1===a?"":t.slice(i,a)},extname:function(t){r(t);for(var e=-1,n=0,i=-1,a=!0,o=0,s=t.length-1;s>=0;--s){var l=t.charCodeAt(s);if(47!==l)-1===i&&(a=!1,i=s+1),46===l?-1===e?e=s:1!==o&&(o=1):-1!==e&&(o=-1);else if(!a){n=s+1;break}}return-1===e||-1===i||0===o||1===o&&e===i-1&&e===n+1?"":t.slice(e,i)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+t+n:n}("/",t)},parse:function(t){r(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var n,i=t.charCodeAt(0),a=47===i;a?(e.root="/",n=1):n=0;for(var o=-1,s=0,l=-1,c=!0,u=t.length-1,f=0;u>=n;--u)if(47!==(i=t.charCodeAt(u)))-1===l&&(c=!1,l=u+1),46===i?-1===o?o=u:1!==f&&(f=1):-1!==o&&(f=-1);else if(!c){s=u+1;break}return-1===o||-1===l||0===f||1===f&&o===l-1&&o===s+1?-1!==l&&(e.base=e.name=0===s&&a?t.slice(1,l):t.slice(s,l)):(0===s&&a?(e.name=t.slice(1,o),e.base=t.slice(1,l)):(e.name=t.slice(s,o),e.base=t.slice(s,l)),e.ext=t.slice(o,l)),s>0?e.dir=t.slice(0,s-1):a&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,e.exports=i}).call(this)}).call(this,t("_process"))},{_process:526}],508:[function(t,e,r){(function(t){(function(){(function(){var r,n,i,a,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(r()-o)/1e6},n=t.hrtime,a=(r=function(){var t;return 1e9*(t=n())[0]+t[1]})(),s=1e9*t.uptime(),o=a-s):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(this)}).call(this)}).call(this,t("_process"))},{_process:526}],509:[function(t,e,r){"use strict";e.exports=function(t){var e=t.length;if(e<32){for(var r=1,i=0;i0;--o)a=l[o],r=s[o],s[o]=s[a],s[a]=r,l[o]=l[r],l[r]=a,c=(c+r)*o;return n.freeUint32(l),n.freeUint32(s),c},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":462,"typedarray-pool":595}],511:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,a,o={};if("string"==typeof e&&(e=i(e)),Array.isArray(e)){var s={};for(a=0;a0){o=a[u][r][0],l=u;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=a[f][r],p=0;p0&&(o=d,s=g,l=f)}return i||o&&c(o,l),s}function f(t,r){var i=a[r][t][0],o=[t];c(i,r);for(var s=i[1^r];;){for(;s!==t;)o.push(s),s=u(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],p=u(l,f,!0);if(n(e[l],e[f],e[h],e[p])<0)break;o.push(t),s=u(l,f)}return o}function h(t,e){return e[1]===e[e.length-1]}for(o=0;o0;){a[0][o].length;var g=f(o,p);h(0,g)?d.push.apply(d,g):(d.length>0&&l.push(d),d=g)}d.length>0&&l.push(d)}return l};var n=t("compare-angle")},{"compare-angle":132}],513:[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 c=o.pop();i[c]=!1;var u=r[c];for(s=0;s0}))).length,m=new Array(g),v=new Array(g);for(p=0;p0;){var B=R.pop(),N=E[B];l(N,(function(t,e){return t-e}));var j,U=N.length,V=F[B];if(0===V){var q=d[B];j=[q]}for(p=0;p=0))if(F[H]=1^V,R.push(H),0===V)D(q=d[H])||(q.reverse(),j.push(q))}0===V&&r.push(j)}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"),c=t("./lib/trim-leaves");function u(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,c=n(r,l[0],l[1]);if(l[0][0]0))return 0;s=-1,a=a.right}else if(c>0)a=a.left;else{if(!(c<0))return 0;s=1,a=a.right}}return s}}(v.slabs,v.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 a=e[1]-r[1],i=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*i+a*s;return!(l-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-a>t&&(i-c)*(a-u)/(o-u)+c-n>t&&(s=!s),i=c,o=u}return s}};return e}},{}],494:[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]),a=1;a0}))}function u(t,n){var a=t.seg,i=n.seg,o=a.start,s=a.end,c=i.start,u=i.end;r&&r.checkIntersection(a,i);var h=e.linesIntersect(o,s,c,u);if(!1===h){if(!e.pointsCollinear(o,s,c))return!1;if(e.pointsSame(o,u)||e.pointsSame(s,c))return!1;var f=e.pointsSame(o,c),p=e.pointsSame(s,u);if(f&&p)return n;var d=!f&&e.pointBetween(o,c,u),g=!p&&e.pointBetween(s,c,u);if(f)return g?l(n,s):l(t,u),n;d&&(p||(g?l(n,s):l(t,u)),l(n,o))}else 0===h.alongA&&(-1===h.alongB?l(t,c):0===h.alongB?l(t,h.pt):1===h.alongB&&l(t,u)),0===h.alongB&&(-1===h.alongA?l(n,o):0===h.alongA?l(n,h.pt):1===h.alongA&&l(n,s));return!1}for(var h=[];!i.isEmpty();){var f=i.getHead();if(r&&r.vert(f.pt[0]),f.isStart){r&&r.segmentNew(f.seg,f.primary);var p=c(f),d=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function m(){if(d){var t=u(f,d);if(t)return t}return!!g&&u(f,g)}r&&r.tempStatus(f.seg,!!d&&d.seg,!!g&&g.seg);var v,y=m();if(y){var x;if(t)(x=null===f.seg.myFill.below||f.seg.myFill.above!==f.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=f.seg.myFill;r&&r.segmentUpdate(y.seg),f.other.remove(),f.remove()}if(i.getHead()!==f){r&&r.rewind(f.seg);continue}if(t)x=null===f.seg.myFill.below||f.seg.myFill.above!==f.seg.myFill.below,f.seg.myFill.below=g?g.seg.myFill.above:a,f.seg.myFill.above=x?!f.seg.myFill.below:f.seg.myFill.below;else if(null===f.seg.otherFill)v=g?f.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:f.primary?o:a,f.seg.otherFill={above:v,below:v};r&&r.status(f.seg,!!d&&d.seg,!!g&&g.seg),f.other.status=p.insert(n.node({ev:f}))}else{var b=f.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(s.exists(b.prev)&&s.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!f.primary){var _=f.seg.myFill;f.seg.myFill=f.seg.otherFill,f.seg.otherFill=_}h.push(f.seg)}i.getHead().remove()}return r&&r.done(),h}return t?{addRegion:function(t){for(var n,a,i,o=t[t.length-1],l=0;l=c?(k=1,y=c+2*f+d):y=f*(k=-f/c)+d):(k=0,p>=0?(M=0,y=d):-p>=h?(M=1,y=h+2*p+d):y=p*(M=-p/h)+d);else if(M<0)M=0,f>=0?(k=0,y=d):-f>=c?(k=1,y=c+2*f+d):y=f*(k=-f/c)+d;else{var A=1/T;y=(k*=A)*(c*k+u*(M*=A)+2*f)+M*(u*k+h*M+2*p)+d}else k<0?(b=h+p)>(x=u+f)?(_=b-x)>=(w=c-2*u+h)?(k=1,M=0,y=c+2*f+d):y=(k=_/w)*(c*k+u*(M=1-k)+2*f)+M*(u*k+h*M+2*p)+d:(k=0,b<=0?(M=1,y=h+2*p+d):p>=0?(M=0,y=d):y=p*(M=-p/h)+d):M<0?(b=c+f)>(x=u+p)?(_=b-x)>=(w=c-2*u+h)?(M=1,k=0,y=h+2*p+d):y=(k=1-(M=_/w))*(c*k+u*M+2*f)+M*(u*k+h*M+2*p)+d:(M=0,b<=0?(k=1,y=c+2*f+d):f>=0?(k=0,y=d):y=f*(k=-f/c)+d):(_=h+p-u-f)<=0?(k=0,M=1,y=h+2*p+d):_>=(w=c-2*u+h)?(k=1,M=0,y=c+2*f+d):y=(k=_/w)*(c*k+u*(M=1-k)+2*f)+M*(u*k+h*M+2*p)+d;var S=1-k-M;for(l=0;l1)for(var r=1;r0){var c=t[r-1];if(0===n(s,c)&&i(c)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}},{"cell-orientation":117,"compare-cell":133,"compare-oriented-cell":134}],508:[function(t,e,r){"use strict";var n=t("array-bounds"),a=t("color-normalize"),i=t("update-diff"),o=t("pick-by-alias"),s=t("object-assign"),l=t("flatten-vertex-data"),c=t("to-float32"),u=c.float32,h=c.fract32;e.exports=function(t,e){"function"==typeof t?(e||(e={}),e.regl=t):e=t;e.length&&(e.positions=e);if(!(t=e.regl).hasExtension("ANGLE_instanced_arrays"))throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");var r,c,p,d,g,m,v=t._gl,y={color:"black",capSize:5,lineWidth:1,opacity:1,viewport:null,range:null,offset:0,count:0,bounds:null,positions:[],errors:[]},x=[];return d=t.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array(0)}),c=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),p=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),g=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),m=t.buffer({usage:"static",type:"float",data:f}),T(e),r=t({vert:"\n\t\tprecision highp float;\n\n\t\tattribute vec2 position, positionFract;\n\t\tattribute vec4 error;\n\t\tattribute vec4 color;\n\n\t\tattribute vec2 direction, lineOffset, capOffset;\n\n\t\tuniform vec4 viewport;\n\t\tuniform float lineWidth, capSize;\n\t\tuniform vec2 scale, scaleFract, translate, translateFract;\n\n\t\tvarying vec4 fragColor;\n\n\t\tvoid main() {\n\t\t\tfragColor = color / 255.;\n\n\t\t\tvec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;\n\n\t\t\tvec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;\n\n\t\t\tvec2 position = position + dxy;\n\n\t\t\tvec2 pos = (position + translate) * scale\n\t\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t\t+ (position + translate) * scaleFract\n\t\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n\t\t\tpos += pixelOffset / viewport.zw;\n\n\t\t\tgl_Position = vec4(pos * 2. - 1., 0, 1);\n\t\t}\n\t\t",frag:"\n\t\tprecision highp float;\n\n\t\tvarying vec4 fragColor;\n\n\t\tuniform float opacity;\n\n\t\tvoid main() {\n\t\t\tgl_FragColor = fragColor;\n\t\t\tgl_FragColor.a *= opacity;\n\t\t}\n\t\t",uniforms:{range:t.prop("range"),lineWidth:t.prop("lineWidth"),capSize:t.prop("capSize"),opacity:t.prop("opacity"),scale:t.prop("scale"),translate:t.prop("translate"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{color:{buffer:d,offset:function(t,e){return 4*e.offset},divisor:1},position:{buffer:c,offset:function(t,e){return 8*e.offset},divisor:1},positionFract:{buffer:p,offset:function(t,e){return 8*e.offset},divisor:1},error:{buffer:g,offset:function(t,e){return 16*e.offset},divisor:1},direction:{buffer:m,stride:24,offset:0},lineOffset:{buffer:m,stride:24,offset:8},capOffset:{buffer:m,stride:24,offset:16}},primitive:"triangles",blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:!1},scissor:{enable:!0,box:t.prop("viewport")},viewport:t.prop("viewport"),stencil:!1,instances:t.prop("count"),count:f.length}),s(b,{update:T,draw:_,destroy:k,regl:t,gl:v,canvas:v.canvas,groups:x}),b;function b(t){t?T(t):null===t&&k(),_()}function _(e){if("number"==typeof e)return w(e);e&&!Array.isArray(e)&&(e=[e]),t._refresh(),x.forEach((function(t,r){t&&(e&&(e[r]?t.draw=!0:t.draw=!1),t.draw?w(r):t.draw=!0)}))}function w(t){"number"==typeof t&&(t=x[t]),null!=t&&t&&t.count&&t.color&&t.opacity&&t.positions&&t.positions.length>1&&(t.scaleRatio=[t.scale[0]*t.viewport.width,t.scale[1]*t.viewport.height],r(t),t.after&&t.after(t))}function T(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0,r=0;if(b.groups=x=t.map((function(t,c){var u=x[c];return t?("function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),t=o(t,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),u||(x[c]=u={id:c,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},t=s({},y,t)),i(u,t,[{lineWidth:function(t){return.5*+t},capSize:function(t){return.5*+t},opacity:parseFloat,errors:function(t){return t=l(t),r+=t.length,t},positions:function(t,r){return t=l(t,"float64"),r.count=Math.floor(t.length/2),r.bounds=n(t,2),r.offset=e,e+=r.count,t}},{color:function(t,e){var r=e.count;if(t||(t="transparent"),!Array.isArray(t)||"number"==typeof t[0]){var n=t;t=Array(r);for(var i=0;i 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * adjustedScale + translate;\n\tvec2 aBotPosition = (aBotCoord) * adjustedScale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * adjustedScale + translate;\n\tvec2 bBotPosition = (bBotCoord) * adjustedScale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform float dashSize, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:r,divisor:0,stride:8,offset:0},lineTop:{buffer:r,divisor:0,stride:8,offset:4},aColor:{buffer:t.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:t.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},n))}catch(t){e=a}return{fill:t({primitive:"triangle",elements:function(t,e){return e.triangles},offset:0,vert:o(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n\tfragColor.a *= opacity;\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n}\n"]),uniforms:{scale:t.prop("scale"),color:t.prop("fill"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{position:{buffer:t.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:t.prop("positionFractBuffer"),stride:8,offset:8}},blend:n.blend,depth:{enable:!1},scissor:n.scissor,stencil:n.stencil,viewport:n.viewport}),rect:a,miter:e}},m.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null},m.prototype.render=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];e.length&&(t=this).update.apply(t,e),this.draw()},m.prototype.draw=function(){for(var t=this,e=[],r=arguments.length;r--;)e[r]=arguments[r];return(e.length?e:this.passes).forEach((function(e,r){var n;if(e&&Array.isArray(e))return(n=t).draw.apply(n,e);"number"==typeof e&&(e=t.passes[e]),e&&e.count>1&&e.opacity&&(t.regl._refresh(),e.fill&&e.triangles&&e.triangles.length>2&&t.shaders.fill(e),e.thickness&&(e.scale[0]*e.viewport.width>m.precisionThreshold||e.scale[1]*e.viewport.height>m.precisionThreshold||"rect"===e.join||!e.join&&(e.thickness<=2||e.count>=m.maxPoints)?t.shaders.rect(e):t.shaders.miter(e)))})),this},m.prototype.update=function(t){var e=this;if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var r=this.regl,o=this.gl;if(t.forEach((function(t,h){var d=e.passes[h];if(void 0!==t)if(null!==t){if("number"==typeof t[0]&&(t={positions:t}),t=s(t,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color colour stroke colors colours stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow"}),d||(e.passes[h]=d={id:h,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,hole:[],depth:0,dashLength:1,dashTexture:r.texture({channels:1,data:new Uint8Array([255]),width:1,height:1,mag:"linear",min:"linear"}),colorBuffer:r.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array}),positionBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array}),positionFractBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array})},t=i({},m.defaults,t)),null!=t.thickness&&(d.thickness=parseFloat(t.thickness)),null!=t.opacity&&(d.opacity=parseFloat(t.opacity)),null!=t.miterLimit&&(d.miterLimit=parseFloat(t.miterLimit)),null!=t.overlay&&(d.overlay=!!t.overlay,ht.length)&&(e=t.length);for(var r=0,n=new Array(e);r 1.0 + delta) {\n\t\tdiscard;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]),l.vert=f(["precision highp float;\n#define GLSLIFY 1\n\nattribute float x, y, xFract, yFract;\nattribute float size, borderSize;\nattribute vec4 colorId, borderColorId;\nattribute float isActive;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform bool constPointSize;\nuniform sampler2D palette;\nuniform vec2 paletteSize;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nfloat pointSizeScale = (constPointSize) ? 2. : pixelRatio;\n\nbool isDirect = (paletteSize.x < 1.);\n\nvec4 getColor(vec4 id) {\n return isDirect ? id / 255. : texture2D(palette,\n vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n )\n );\n}\n\nvoid main() {\n // ignore inactive points\n if (isActive == 0.) return;\n\n vec2 position = vec2(x, y);\n vec2 positionFract = vec2(xFract, yFract);\n\n vec4 color = getColor(colorId);\n vec4 borderColor = getColor(borderColorId);\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pointSizeScale;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0., 1.);\n\n fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]),m&&(l.frag=l.frag.replace("smoothstep","smoothStep"),s.frag=s.frag.replace("smoothstep","smoothStep")),this.drawCircle=t(l)}b.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4},b.prototype.render=function(){return arguments.length&&this.update.apply(this,arguments),this.draw(),this},b.prototype.draw=function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;nn)?e.tree=u(t,{bounds:h}):n&&n.length&&(e.tree=n),e.tree){var f={primitive:"points",usage:"static",data:e.tree,type:"uint32"};e.elements?e.elements(f):e.elements=o.elements(f)}return a({data:v.float(t),usage:"dynamic"}),i({data:v.fract(t),usage:"dynamic"}),s({data:new Uint8Array(c),type:"uint8",usage:"stream"}),t}},{marker:function(e,r,n){var a=r.activation;if(a.forEach((function(t){return t&&t.destroy&&t.destroy()})),a.length=0,e&&"number"!=typeof e[0]){for(var i=[],s=0,l=Math.min(e.length,r.count);s=0)return i;if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)e=t;else{e=new Uint8Array(t.length);for(var o=0,s=t.length;o4*n&&(this.tooManyColors=!0),this.updatePalette(r),1===a.length?a[0]:a},b.prototype.updatePalette=function(t){if(!this.tooManyColors){var e=this.maxColors,r=this.paletteTexture,n=Math.ceil(.25*t.length/e);if(n>1)for(var a=.25*(t=t.slice()).length%e;a2?(s[0],s[2],n=s[1],a=s[3]):s.length?(n=s[0],a=s[1]):(s.x,n=s.y,s.x+s.width,a=s.y+s.height),l.length>2?(i=l[0],o=l[2],l[1],l[3]):l.length?(i=l[0],o=l[1]):(i=l.x,l.y,o=l.x+l.width,l.y+l.height),[i,n,o,a]}function p(t){if("number"==typeof t)return[t,t,t,t];if(2===t.length)return[t[0],t[1],t[0],t[1]];var e=l(t);return[e.x,e.y,e.x+e.width,e.y+e.height]}e.exports=u,u.prototype.render=function(){for(var t,e=this,r=[],n=arguments.length;n--;)r[n]=arguments[n];return r.length&&(t=this).update.apply(t,r),this.regl.attributes.preserveDrawingBuffer?this.draw():(this.dirty?null==this.planned&&(this.planned=o((function(){e.draw(),e.dirty=!0,e.planned=null}))):(this.draw(),this.dirty=!0,o((function(){e.dirty=!1}))),this)},u.prototype.update=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];if(e.length){for(var n=0;nk))&&(s.lower||!(T>>=e))<<3,(e|=r=(15<(t>>>=r))<<2)|(r=(3<(t>>>=r))<<1)|t>>>r>>1}function s(){function t(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}return 0<(e=r[o(t)>>2]).length?e.pop():new ArrayBuffer(t)}function e(t){r[o(t.byteLength)>>2].push(t)}var r=i(8,(function(){return[]}));return{alloc:t,free:e,allocType:function(e,r){var n=null;switch(e){case 5120:n=new Int8Array(t(r),0,r);break;case 5121:n=new Uint8Array(t(r),0,r);break;case 5122:n=new Int16Array(t(2*r),0,r);break;case 5123:n=new Uint16Array(t(2*r),0,r);break;case 5124:n=new Int32Array(t(4*r),0,r);break;case 5125:n=new Uint32Array(t(4*r),0,r);break;case 5126:n=new Float32Array(t(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(t){e(t.buffer)}}}function l(t){return!!t&&"object"==typeof t&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&"number"==typeof t.offset&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||Z(t.data))}function c(t,e,r,n,a,i){for(var o=0;o(a=s)&&(a=n.buffer.byteLength,5123===h?a>>=1:5125===h&&(a>>=2)),n.vertCount=a,a=o,0>o&&(a=4,1===(o=n.buffer.dimension)&&(a=0),2===o&&(a=1),3===o&&(a=4)),n.primType=a}function o(t){n.elementsCount--,delete s[t.id],t.buffer.destroy(),t.buffer=null}var s={},c=0,u={uint8:5121,uint16:5123};e.oes_element_index_uint&&(u.uint32=5125),a.prototype.bind=function(){this.buffer.bind()};var h=[];return{create:function(t,e){function s(t){if(t)if("number"==typeof t)c(t),h.primType=4,h.vertCount=0|t,h.type=5121;else{var e=null,r=35044,n=-1,a=-1,o=0,f=0;Array.isArray(t)||Z(t)||l(t)?e=t:("data"in t&&(e=t.data),"usage"in t&&(r=$[t.usage]),"primitive"in t&&(n=nt[t.primitive]),"count"in t&&(a=0|t.count),"type"in t&&(f=u[t.type]),"length"in t?o=0|t.length:(o=a,5123===f||5122===f?o*=2:5125!==f&&5124!==f||(o*=4))),i(h,e,r,n,a,o,f)}else c(),h.primType=4,h.vertCount=0,h.type=5121;return s}var c=r.create(null,34963,!0),h=new a(c._buffer);return n.elementsCount++,s(t),s._reglType="elements",s._elements=h,s.subdata=function(t,e){return c.subdata(t,e),s},s.destroy=function(){o(h)},s},createStream:function(t){var e=h.pop();return e||(e=new a(r.create(null,34963,!0,!1)._buffer)),i(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){h.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof a?t._elements:null},clear:function(){X(s).forEach(o)}}}function g(t){for(var e=Y.allocType(5123,t.length),r=0;r>>31<<15,a=(i<<1>>>24)-127,i=i>>13&1023;e[r]=-24>a?n:-14>a?n+(i+1024>>-14-a):15>=a,r.height>>=a,p(r,n[a]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function L(t){for(var e=t.images,r=0;re){for(var r=0;r=--this.refCount&&F(this)}}),o.profile&&(i.getTotalTextureSize=function(){var t=0;return Object.keys(yt).forEach((function(e){t+=yt[e].stats.size})),t}),{create2D:function(e,r){function n(t,e){var r=a.texInfo;P.call(r);var i=C();return"number"==typeof t?A(i,0|t,"number"==typeof e?0|e:0|t):t?(I(r,t),S(i,t)):A(i,1,1),r.genMipmaps&&(i.mipmask=(i.width<<1)-1),a.mipmask=i.mipmask,c(a,i),a.internalformat=i.internalformat,n.width=i.width,n.height=i.height,D(a),E(i,3553),z(r,3553),R(),L(i),o.profile&&(a.stats.size=T(a.internalformat,a.type,i.width,i.height,r.genMipmaps,!1)),n.format=tt[a.internalformat],n.type=et[a.type],n.mag=rt[r.magFilter],n.min=nt[r.minFilter],n.wrapS=at[r.wrapS],n.wrapT=at[r.wrapT],n}var a=new O(3553);return yt[a.id]=a,i.textureCount++,n(e,r),n.subimage=function(t,e,r,i){e|=0,r|=0,i|=0;var o=v();return c(o,a),o.width=0,o.height=0,p(o,t),o.width=o.width||(a.width>>i)-e,o.height=o.height||(a.height>>i)-r,D(a),d(o,3553,e,r,i),R(),k(o),n},n.resize=function(e,r){var i=0|e,s=0|r||i;if(i===a.width&&s===a.height)return n;n.width=a.width=i,n.height=a.height=s,D(a);for(var l=0;a.mipmask>>l;++l){var c=i>>l,u=s>>l;if(!c||!u)break;t.texImage2D(3553,l,a.format,c,u,0,a.format,a.type,null)}return R(),o.profile&&(a.stats.size=T(a.internalformat,a.type,i,s,!1,!1)),n},n._reglType="texture2d",n._texture=a,o.profile&&(n.stats=a.stats),n.destroy=function(){a.decRef()},n},createCube:function(e,r,n,a,s,l){function h(t,e,r,n,a,i){var s,l=f.texInfo;for(P.call(l),s=0;6>s;++s)g[s]=C();if("number"!=typeof t&&t){if("object"==typeof t)if(e)S(g[0],t),S(g[1],e),S(g[2],r),S(g[3],n),S(g[4],a),S(g[5],i);else if(I(l,t),u(f,t),"faces"in t)for(t=t.faces,s=0;6>s;++s)c(g[s],f),S(g[s],t[s]);else for(s=0;6>s;++s)S(g[s],t)}else for(t=0|t||1,s=0;6>s;++s)A(g[s],t,t);for(c(f,g[0]),f.mipmask=l.genMipmaps?(g[0].width<<1)-1:g[0].mipmask,f.internalformat=g[0].internalformat,h.width=g[0].width,h.height=g[0].height,D(f),s=0;6>s;++s)E(g[s],34069+s);for(z(l,34067),R(),o.profile&&(f.stats.size=T(f.internalformat,f.type,h.width,h.height,l.genMipmaps,!0)),h.format=tt[f.internalformat],h.type=et[f.type],h.mag=rt[l.magFilter],h.min=nt[l.minFilter],h.wrapS=at[l.wrapS],h.wrapT=at[l.wrapT],s=0;6>s;++s)L(g[s]);return h}var f=new O(34067);yt[f.id]=f,i.cubeCount++;var g=Array(6);return h(e,r,n,a,s,l),h.subimage=function(t,e,r,n,a){r|=0,n|=0,a|=0;var i=v();return c(i,f),i.width=0,i.height=0,p(i,e),i.width=i.width||(f.width>>a)-r,i.height=i.height||(f.height>>a)-n,D(f),d(i,34069+t,r,n,a),R(),k(i),h},h.resize=function(e){if((e|=0)!==f.width){h.width=f.width=e,h.height=f.height=e,D(f);for(var r=0;6>r;++r)for(var n=0;f.mipmask>>n;++n)t.texImage2D(34069+r,n,f.format,e>>n,e>>n,0,f.format,f.type,null);return R(),o.profile&&(f.stats.size=T(f.internalformat,f.type,h.width,h.height,!1,!0)),h}},h._reglType="textureCube",h._texture=f,o.profile&&(h.stats=f.stats),h.destroy=function(){f.decRef()},h},clear:function(){for(var e=0;er;++r)if(0!=(e.mipmask&1<>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;6>n;++n)t.texImage2D(34069+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);z(e.texInfo,e.target)}))}}}function M(t,e,r,n,a,i){function o(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=t=0;e?(t=e.width,n=e.height):r&&(t=r.width,n=r.height),this.width=t,this.height=n}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){t&&(t.texture?t.texture._texture.refCount+=1:t.renderbuffer._renderbuffer.refCount+=1)}function c(e,r){r&&(r.texture?t.framebufferTexture2D(36160,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,r.renderbuffer._renderbuffer.renderbuffer))}function u(t){var e=3553,r=null,n=null,a=t;return"object"==typeof t&&(a=t.data,"target"in t&&(e=0|t.target)),"texture2d"===(t=a._reglType)||"textureCube"===t?r=a:"renderbuffer"===t&&(n=a,e=36161),new o(e,r,n)}function h(t,e,r,i,s){return r?((t=n.create2D({width:t,height:e,format:i,type:s}))._texture.refCount=0,new o(3553,t,null)):((t=a.create({width:t,height:e,format:i}))._renderbuffer.refCount=0,new o(36161,null,t))}function f(t){return t&&(t.texture||t.renderbuffer)}function p(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r),t.width=e,t.height=r)}function d(){this.id=T++,k[this.id]=this,this.framebuffer=t.createFramebuffer(),this.height=this.width=0,this.colorAttachments=[],this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function g(t){t.colorAttachments.forEach(s),s(t.depthAttachment),s(t.stencilAttachment),s(t.depthStencilAttachment)}function m(e){t.deleteFramebuffer(e.framebuffer),e.framebuffer=null,i.framebufferCount--,delete k[e.id]}function v(e){var n;t.bindFramebuffer(36160,e.framebuffer);var a=e.colorAttachments;for(n=0;na;++a){for(c=0;ct;++t)r[t].resize(n);return e.width=e.height=n,e},_reglType:"framebufferCube",destroy:function(){r.forEach((function(t){t.destroy()}))}})},clear:function(){X(k).forEach(m)},restore:function(){x.cur=null,x.next=null,x.dirty=!0,X(k).forEach((function(e){e.framebuffer=t.createFramebuffer(),v(e)}))}})}function A(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function S(t,e,r,n,a){function i(){this.id=++c,this.attributes=[];var t=e.oes_vertex_array_object;this.vao=t?t.createVertexArrayOES():null,u[this.id]=this,this.buffers=[]}var o=r.maxAttributes,s=Array(o);for(r=0;rt&&(t=e.stats.uniformsCount)})),t},r.getMaxAttributesCount=function(){var t=0;return f.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);X(c).forEach(e),c={},X(u).forEach(e),u={},f.forEach((function(e){t.deleteProgram(e.program)})),f.length=0,h={},r.shaderCount=0},program:function(t,e,n,a){var i=h[e];i||(i=h[e]={});var o=i[t];return o&&!a?o:(e=new s(e,t),r.shaderCount++,l(e,n,a),o||(i[t]=e),f.push(e),e)},restore:function(){c={},u={};for(var t=0;t"+e+"?"+a+".constant["+e+"]:0;"})).join(""),"}}else{","if(",s,"(",a,".buffer)){",u,"=",i,".createStream(",34962,",",a,".buffer);","}else{",u,"=",i,".getBuffer(",a,".buffer);","}",h,'="type" in ',a,"?",o.glTypes,"[",a,".type]:",u,".dtype;",l.normalized,"=!!",a,".normalized;"),n("size"),n("offset"),n("stride"),n("divisor"),r("}}"),r.exit("if(",l.isStream,"){",i,".destroyStream(",u,");","}"),l}))})),o}function M(t,e,n,a,o){function s(t){var e=c[t];e&&(f[t]=e)}var l=function(t,e){if("string"==typeof(r=t.static).frag&&"string"==typeof r.vert){if(0>1)",s],");")}function e(){r(l,".drawArraysInstancedANGLE(",[d,g,m,s],");")}p?y?t():(r("if(",p,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(u+".drawElements("+[d,m,v,g+"<<(("+v+"-5121)>>1)"]+");")}function e(){r(u+".drawArrays("+[d,g,m]+");")}p?y?t():(r("if(",p,"){"),t(),r("}else{"),e(),r("}")):e()}var s,l,c=t.shared,u=c.gl,h=c.draw,f=n.draw,p=function(){var a=f.elements,i=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(i=r),a=a.append(t,i)):a=i.def(h,".","elements"),a&&i("if("+a+")"+u+".bindBuffer(34963,"+a+".buffer.buffer);"),a}(),d=a("primitive"),g=a("offset"),m=function(){var a=f.count,i=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(i=r),a=a.append(t,i)):a=i.def(h,".","count"),a}();if("number"==typeof m){if(0===m)return}else r("if(",m,"){"),r.exit("}");K&&(s=a("instances"),l=t.instancing);var v=p+".type",y=f.elements&&R(f.elements);K&&("number"!=typeof s||0<=s)?"string"==typeof s?(r("if(",s,">0){"),i(),r("}else if(",s,"<0){"),o(),r("}")):i():o()}function V(t,e,r,n,a){return a=(e=b()).proc("body",a),K&&(e.instancing=a.def(e.shared.extensions,".angle_instanced_arrays")),t(e,a,r,n),e.compile().body}function H(t,e,r,n){L(t,e),r.useVAO?r.drawVAO?e(t.shared.vao,".setVAO(",r.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),N(t,e,r,n.attributes,(function(){return!0}))),j(t,e,r,n.uniforms,(function(){return!0})),U(t,e,e,r)}function G(t,e,r,n){function a(){return!0}t.batchId="a1",L(t,e),N(t,e,r,n.attributes,a),j(t,e,r,n.uniforms,a),U(t,e,e,r)}function Y(t,e,r,n){function a(t){return t.contextDep&&o||t.propDep}function i(t){return!a(t)}L(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var c=t.scope(),u=t.scope();e(c.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",u,"}",c.exit),r.needsContext&&A(t,u,r.context),r.needsFramebuffer&&S(t,u,r.framebuffer),C(t,u,r.state,a),r.profile&&a(r.profile)&&P(t,u,r,!1,!0),n?(r.useVAO?r.drawVAO?a(r.drawVAO)?u(t.shared.vao,".setVAO(",r.drawVAO.append(t,u),");"):c(t.shared.vao,".setVAO(",r.drawVAO.append(t,c),");"):c(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(c(t.shared.vao,".setVAO(null);"),N(t,c,r,n.attributes,i),N(t,u,r,n.attributes,a)),j(t,c,r,n.uniforms,i),j(t,u,r,n.uniforms,a),U(t,c,u,r)):(e=t.global.def("{}"),n=r.shader.progVar.append(t,u),l=u.def(n,".id"),c=u.def(e,"[",l,"]"),u(t.shared.gl,".useProgram(",n,".program);","if(!",c,"){",c,"=",e,"[",l,"]=",t.link((function(e){return V(G,t,r,e,2)})),"(",n,");}",c,".call(this,a0[",s,"],",s,");"))}function W(t,r){function n(e){var n=r.shader[e];n&&a.set(i.shader,"."+e,n.append(t,a))}var a=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;A(t,a,r.context),r.framebuffer&&r.framebuffer.append(t,a),O(Object.keys(r.state)).forEach((function(e){var n=r.state[e].append(t,a);m(n)?n.forEach((function(r,n){a.set(t.next[e],"["+n+"]",r)})):a.set(i.next,"."+e,n)})),P(t,a,r,!0,!0),["elements","offset","count","instances","primitive"].forEach((function(e){var n=r.draw[e];n&&a.set(i.draw,"."+e,""+n.append(t,a))})),Object.keys(r.uniforms).forEach((function(n){a.set(i.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,a))})),Object.keys(r.attributes).forEach((function(e){var n=r.attributes[e].append(t,a),i=t.scopeAttrib(e);Object.keys(new X).forEach((function(t){a.set(i,"."+t,n[t])}))})),r.scopeVAO&&a.set(i.vao,".targetVAO",r.scopeVAO.append(t,a)),n("vert"),n("frag"),0=--this.refCount&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(u).forEach((function(e){t+=u[e].stats.size})),t}),{create:function(e,r){function o(e,r){var n=0,i=0,u=32854;if("object"==typeof e&&e?("shape"in e?(n=0|(i=e.shape)[0],i=0|i[1]):("radius"in e&&(n=i=0|e.radius),"width"in e&&(n=0|e.width),"height"in e&&(i=0|e.height)),"format"in e&&(u=s[e.format])):"number"==typeof e?(n=0|e,i="number"==typeof r?0|r:n):e||(n=i=1),n!==c.width||i!==c.height||u!==c.format)return o.width=c.width=n,o.height=c.height=i,c.format=u,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,u,n,i),a.profile&&(c.stats.size=yt[c.format]*c.width*c.height),o.format=l[c.format],o}var c=new i(t.createRenderbuffer());return u[c.id]=c,n.renderbufferCount++,o(e,r),o.resize=function(e,r){var n=0|e,i=0|r||n;return n===c.width&&i===c.height||(o.width=c.width=n,o.height=c.height=i,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,c.format,n,i),a.profile&&(c.stats.size=yt[c.format]*c.width*c.height)),o},o._reglType="renderbuffer",o._renderbuffer=c,a.profile&&(o.stats=c.stats),o.destroy=function(){c.decRef()},o},clear:function(){X(u).forEach(o)},restore:function(){X(u).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)})),t.bindRenderbuffer(36161,null)}}},bt=[];bt[6408]=4,bt[6407]=3;var _t=[];_t[5121]=1,_t[5126]=4,_t[36193]=2;var wt=["x","y","z","w"],Tt="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),kt={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Mt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},At={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},St={cw:2304,ccw:2305},Et=new D(!1,!1,!1,(function(){}));return function(t){function e(){if(0===J.length)w&&w.update(),tt=null;else{tt=H.next(e),h();for(var t=J.length-1;0<=t;--t){var r=J[t];r&&r(P,null,0)}m.flush(),w&&w.update()}}function r(){!tt&&0=J.length&&n()}}}}function u(){var t=Z.viewport,e=Z.scissor_box;t[0]=t[1]=e[0]=e[1]=0,P.viewportWidth=P.framebufferWidth=P.drawingBufferWidth=t[2]=e[2]=m.drawingBufferWidth,P.viewportHeight=P.framebufferHeight=P.drawingBufferHeight=t[3]=e[3]=m.drawingBufferHeight}function h(){P.tick+=1,P.time=g(),u(),Y.procs.poll()}function f(){u(),Y.procs.refresh(),w&&w.update()}function g(){return(G()-T)/1e3}if(!(t=a(t)))return null;var m=t.gl,v=m.getContextAttributes();m.isContextLost();var y=function(t,e){function r(e){var r;e=e.toLowerCase();try{r=n[e]=t.getExtension(e)}catch(t){}return!!r}for(var n={},a=0;ae;++e)et(U({framebuffer:t.framebuffer.faces[e]},t),l);else et(t,l);else l(0,t)},prop:q.define.bind(null,1),context:q.define.bind(null,2),this:q.define.bind(null,3),draw:s({}),buffer:function(t){return z.create(t,34962,!1,!1)},elements:function(t){return D.create(t,!1)},texture:F.create2D,cube:F.createCube,renderbuffer:B.create,framebuffer:V.create,framebufferCube:V.createCube,vao:O.createVAO,attributes:v,frame:c,on:function(t,e){var r;switch(t){case"frame":return c(e);case"lost":r=K;break;case"restore":r=Q;break;case"destroy":r=$}return r.push(e),{cancel:function(){for(var t=0;t=-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-c)*(i-u)/(o-u)+c-n>t&&(s=!s),a=c,o=u}return s}};return e}},{}],520:[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 u(t,n){var i=t.seg,a=n.seg,o=i.start,s=i.end,c=a.start,u=a.end;r&&r.checkIntersection(i,a);var f=e.linesIntersect(o,s,c,u);if(!1===f){if(!e.pointsCollinear(o,s,c))return!1;if(e.pointsSame(o,u)||e.pointsSame(s,c))return!1;var h=e.pointsSame(o,c),p=e.pointsSame(s,u);if(h&&p)return n;var d=!h&&e.pointBetween(o,c,u),g=!p&&e.pointBetween(s,c,u);if(h)return g?l(n,s):l(t,u),n;d&&(p||(g?l(n,s):l(t,u)),l(n,o))}else 0===f.alongA&&(-1===f.alongB?l(t,c):0===f.alongB?l(t,f.pt):1===f.alongB&&l(t,u)),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 p=c(h),d=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function m(){if(d){var t=u(h,d);if(t)return t}return!!g&&u(h,g)}r&&r.tempStatus(h.seg,!!d&&d.seg,!!g&&g.seg);var v,y=m();if(y){var x;if(t)(x=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above);else y.seg.otherFill=h.seg.myFill;r&&r.segmentUpdate(y.seg),h.other.remove(),h.remove()}if(a.getHead()!==h){r&&r.rewind(h.seg);continue}if(t)x=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=x?!h.seg.myFill.below:h.seg.myFill.below;else if(null===h.seg.otherFill)v=g?h.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:h.primary?o:i,h.seg.otherFill={above:v,below:v};r&&r.status(h.seg,!!d&&d.seg,!!g&&g.seg),h.other.status=p.insert(n.node({ev:h}))}else{var b=h.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(s.exists(b.prev)&&s.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.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=c?(k=1,y=c+2*h+d):y=h*(k=-h/c)+d):(k=0,p>=0?(M=0,y=d):-p>=f?(M=1,y=f+2*p+d):y=p*(M=-p/f)+d);else if(M<0)M=0,h>=0?(k=0,y=d):-h>=c?(k=1,y=c+2*h+d):y=h*(k=-h/c)+d;else{var A=1/T;y=(k*=A)*(c*k+u*(M*=A)+2*h)+M*(u*k+f*M+2*p)+d}else k<0?(b=f+p)>(x=u+h)?(_=b-x)>=(w=c-2*u+f)?(k=1,M=0,y=c+2*h+d):y=(k=_/w)*(c*k+u*(M=1-k)+2*h)+M*(u*k+f*M+2*p)+d:(k=0,b<=0?(M=1,y=f+2*p+d):p>=0?(M=0,y=d):y=p*(M=-p/f)+d):M<0?(b=c+h)>(x=u+p)?(_=b-x)>=(w=c-2*u+f)?(M=1,k=0,y=f+2*p+d):y=(k=1-(M=_/w))*(c*k+u*M+2*h)+M*(u*k+f*M+2*p)+d:(M=0,b<=0?(k=1,y=c+2*h+d):h>=0?(k=0,y=d):y=h*(k=-h/c)+d):(_=f+p-u-h)<=0?(k=0,M=1,y=f+2*p+d):_>=(w=c-2*u+f)?(k=1,M=0,y=c+2*h+d):y=(k=_/w)*(c*k+u*(M=1-k)+2*h)+M*(u*k+f*M+2*p)+d;var S=1-k-M;for(l=0;l1)for(var r=1;r0){var c=t[r-1];if(0===n(s,c)&&a(c)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}},{"cell-orientation":117,"compare-cell":133,"compare-oriented-cell":134}],534:[function(t,e,r){"use strict";var n=t("array-bounds"),i=t("color-normalize"),a=t("update-diff"),o=t("pick-by-alias"),s=t("object-assign"),l=t("flatten-vertex-data"),c=t("to-float32"),u=c.float32,f=c.fract32;e.exports=function(t,e){"function"==typeof t?(e||(e={}),e.regl=t):e=t;e.length&&(e.positions=e);if(!(t=e.regl).hasExtension("ANGLE_instanced_arrays"))throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");var r,c,p,d,g,m,v=t._gl,y={color:"black",capSize:5,lineWidth:1,opacity:1,viewport:null,range:null,offset:0,count:0,bounds:null,positions:[],errors:[]},x=[];return d=t.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array(0)}),c=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),p=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),g=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),m=t.buffer({usage:"static",type:"float",data:h}),T(e),r=t({vert:"\n\t\tprecision highp float;\n\n\t\tattribute vec2 position, positionFract;\n\t\tattribute vec4 error;\n\t\tattribute vec4 color;\n\n\t\tattribute vec2 direction, lineOffset, capOffset;\n\n\t\tuniform vec4 viewport;\n\t\tuniform float lineWidth, capSize;\n\t\tuniform vec2 scale, scaleFract, translate, translateFract;\n\n\t\tvarying vec4 fragColor;\n\n\t\tvoid main() {\n\t\t\tfragColor = color / 255.;\n\n\t\t\tvec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;\n\n\t\t\tvec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;\n\n\t\t\tvec2 position = position + dxy;\n\n\t\t\tvec2 pos = (position + translate) * scale\n\t\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t\t+ (position + translate) * scaleFract\n\t\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n\t\t\tpos += pixelOffset / viewport.zw;\n\n\t\t\tgl_Position = vec4(pos * 2. - 1., 0, 1);\n\t\t}\n\t\t",frag:"\n\t\tprecision highp float;\n\n\t\tvarying vec4 fragColor;\n\n\t\tuniform float opacity;\n\n\t\tvoid main() {\n\t\t\tgl_FragColor = fragColor;\n\t\t\tgl_FragColor.a *= opacity;\n\t\t}\n\t\t",uniforms:{range:t.prop("range"),lineWidth:t.prop("lineWidth"),capSize:t.prop("capSize"),opacity:t.prop("opacity"),scale:t.prop("scale"),translate:t.prop("translate"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{color:{buffer:d,offset:function(t,e){return 4*e.offset},divisor:1},position:{buffer:c,offset:function(t,e){return 8*e.offset},divisor:1},positionFract:{buffer:p,offset:function(t,e){return 8*e.offset},divisor:1},error:{buffer:g,offset:function(t,e){return 16*e.offset},divisor:1},direction:{buffer:m,stride:24,offset:0},lineOffset:{buffer:m,stride:24,offset:8},capOffset:{buffer:m,stride:24,offset:16}},primitive:"triangles",blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:!1},scissor:{enable:!0,box:t.prop("viewport")},viewport:t.prop("viewport"),stencil:!1,instances:t.prop("count"),count:h.length}),s(b,{update:T,draw:_,destroy:k,regl:t,gl:v,canvas:v.canvas,groups:x}),b;function b(t){t?T(t):null===t&&k(),_()}function _(e){if("number"==typeof e)return w(e);e&&!Array.isArray(e)&&(e=[e]),t._refresh(),x.forEach((function(t,r){t&&(e&&(e[r]?t.draw=!0:t.draw=!1),t.draw?w(r):t.draw=!0)}))}function w(t){"number"==typeof t&&(t=x[t]),null!=t&&t&&t.count&&t.color&&t.opacity&&t.positions&&t.positions.length>1&&(t.scaleRatio=[t.scale[0]*t.viewport.width,t.scale[1]*t.viewport.height],r(t),t.after&&t.after(t))}function T(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0,r=0;if(b.groups=x=t.map((function(t,c){var u=x[c];return t?("function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),t=o(t,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),u||(x[c]=u={id:c,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},t=s({},y,t)),a(u,t,[{lineWidth:function(t){return.5*+t},capSize:function(t){return.5*+t},opacity:parseFloat,errors:function(t){return t=l(t),r+=t.length,t},positions:function(t,r){return t=l(t,"float64"),r.count=Math.floor(t.length/2),r.bounds=n(t,2),r.offset=e,e+=r.count,t}},{color:function(t,e){var r=e.count;if(t||(t="transparent"),!Array.isArray(t)||"number"==typeof t[0]){var n=t;t=Array(r);for(var a=0;a 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * adjustedScale + translate;\n\tvec2 aBotPosition = (aBotCoord) * adjustedScale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * adjustedScale + translate;\n\tvec2 bBotPosition = (bBotCoord) * adjustedScale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform float dashSize, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:r,divisor:0,stride:8,offset:0},lineTop:{buffer:r,divisor:0,stride:8,offset:4},aColor:{buffer:t.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:t.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},n))}catch(t){e=i}return{fill:t({primitive:"triangle",elements:function(t,e){return e.triangles},offset:0,vert:o(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n\tfragColor.a *= opacity;\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n}\n"]),uniforms:{scale:t.prop("scale"),color:t.prop("fill"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{position:{buffer:t.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:t.prop("positionFractBuffer"),stride:8,offset:8}},blend:n.blend,depth:{enable:!1},scissor:n.scissor,stencil:n.stencil,viewport:n.viewport}),rect:i,miter:e}},m.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null},m.prototype.render=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];e.length&&(t=this).update.apply(t,e),this.draw()},m.prototype.draw=function(){for(var t=this,e=[],r=arguments.length;r--;)e[r]=arguments[r];return(e.length?e:this.passes).forEach((function(e,r){var n;if(e&&Array.isArray(e))return(n=t).draw.apply(n,e);"number"==typeof e&&(e=t.passes[e]),e&&e.count>1&&e.opacity&&(t.regl._refresh(),e.fill&&e.triangles&&e.triangles.length>2&&t.shaders.fill(e),e.thickness&&(e.scale[0]*e.viewport.width>m.precisionThreshold||e.scale[1]*e.viewport.height>m.precisionThreshold||"rect"===e.join||!e.join&&(e.thickness<=2||e.count>=m.maxPoints)?t.shaders.rect(e):t.shaders.miter(e)))})),this},m.prototype.update=function(t){var e=this;if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var r=this.regl,o=this.gl;if(t.forEach((function(t,f){var d=e.passes[f];if(void 0!==t)if(null!==t){if("number"==typeof t[0]&&(t={positions:t}),t=s(t,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color colour stroke colors colours stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow"}),d||(e.passes[f]=d={id:f,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,hole:[],depth:0,dashLength:1,dashTexture:r.texture({channels:1,data:new Uint8Array([255]),width:1,height:1,mag:"linear",min:"linear"}),colorBuffer:r.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array}),positionBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array}),positionFractBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array})},t=a({},m.defaults,t)),null!=t.thickness&&(d.thickness=parseFloat(t.thickness)),null!=t.opacity&&(d.opacity=parseFloat(t.opacity)),null!=t.miterLimit&&(d.miterLimit=parseFloat(t.miterLimit)),null!=t.overlay&&(d.overlay=!!t.overlay,ft.length)&&(e=t.length);for(var r=0,n=new Array(e);r 1.0 + delta) {\n\t\tdiscard;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]),l.vert=h(["precision highp float;\n#define GLSLIFY 1\n\nattribute float x, y, xFract, yFract;\nattribute float size, borderSize;\nattribute vec4 colorId, borderColorId;\nattribute float isActive;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform bool constPointSize;\nuniform sampler2D palette;\nuniform vec2 paletteSize;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nfloat pointSizeScale = (constPointSize) ? 2. : pixelRatio;\n\nbool isDirect = (paletteSize.x < 1.);\n\nvec4 getColor(vec4 id) {\n return isDirect ? id / 255. : texture2D(palette,\n vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n )\n );\n}\n\nvoid main() {\n // ignore inactive points\n if (isActive == 0.) return;\n\n vec2 position = vec2(x, y);\n vec2 positionFract = vec2(xFract, yFract);\n\n vec4 color = getColor(colorId);\n vec4 borderColor = getColor(borderColorId);\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pointSizeScale;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0., 1.);\n\n fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]),m&&(l.frag=l.frag.replace("smoothstep","smoothStep"),s.frag=s.frag.replace("smoothstep","smoothStep")),this.drawCircle=t(l)}b.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4},b.prototype.render=function(){return arguments.length&&this.update.apply(this,arguments),this.draw(),this},b.prototype.draw=function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;nn)?e.tree=u(t,{bounds:f}):n&&n.length&&(e.tree=n),e.tree){var h={primitive:"points",usage:"static",data:e.tree,type:"uint32"};e.elements?e.elements(h):e.elements=o.elements(h)}return i({data:v.float(t),usage:"dynamic"}),a({data:v.fract(t),usage:"dynamic"}),s({data:new Uint8Array(c),type:"uint8",usage:"stream"}),t}},{marker:function(e,r,n){var i=r.activation;if(i.forEach((function(t){return t&&t.destroy&&t.destroy()})),i.length=0,e&&"number"!=typeof e[0]){for(var a=[],s=0,l=Math.min(e.length,r.count);s=0)return a;if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)e=t;else{e=new Uint8Array(t.length);for(var o=0,s=t.length;o4*n&&(this.tooManyColors=!0),this.updatePalette(r),1===i.length?i[0]:i},b.prototype.updatePalette=function(t){if(!this.tooManyColors){var e=this.maxColors,r=this.paletteTexture,n=Math.ceil(.25*t.length/e);if(n>1)for(var i=.25*(t=t.slice()).length%e;i2?(s[0],s[2],n=s[1],i=s[3]):s.length?(n=s[0],i=s[1]):(s.x,n=s.y,s.x+s.width,i=s.y+s.height),l.length>2?(a=l[0],o=l[2],l[1],l[3]):l.length?(a=l[0],o=l[1]):(a=l.x,l.y,o=l.x+l.width,l.y+l.height),[a,n,o,i]}function p(t){if("number"==typeof t)return[t,t,t,t];if(2===t.length)return[t[0],t[1],t[0],t[1]];var e=l(t);return[e.x,e.y,e.x+e.width,e.y+e.height]}e.exports=u,u.prototype.render=function(){for(var t,e=this,r=[],n=arguments.length;n--;)r[n]=arguments[n];return r.length&&(t=this).update.apply(t,r),this.regl.attributes.preserveDrawingBuffer?this.draw():(this.dirty?null==this.planned&&(this.planned=o((function(){e.draw(),e.dirty=!0,e.planned=null}))):(this.draw(),this.dirty=!0,o((function(){e.dirty=!1}))),this)},u.prototype.update=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];if(e.length){for(var n=0;nk))&&(s.lower||!(T>>=e))<<3,(e|=r=(15<(t>>>=r))<<2)|(r=(3<(t>>>=r))<<1)|t>>>r>>1}function s(){function t(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}return 0<(e=r[o(t)>>2]).length?e.pop():new ArrayBuffer(t)}function e(t){r[o(t.byteLength)>>2].push(t)}var r=a(8,(function(){return[]}));return{alloc:t,free:e,allocType:function(e,r){var n=null;switch(e){case 5120:n=new Int8Array(t(r),0,r);break;case 5121:n=new Uint8Array(t(r),0,r);break;case 5122:n=new Int16Array(t(2*r),0,r);break;case 5123:n=new Uint16Array(t(2*r),0,r);break;case 5124:n=new Int32Array(t(4*r),0,r);break;case 5125:n=new Uint32Array(t(4*r),0,r);break;case 5126:n=new Float32Array(t(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(t){e(t.buffer)}}}function l(t){return!!t&&"object"==typeof t&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&"number"==typeof t.offset&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||X(t.data))}function c(t,e,r,n,i,a){for(var o=0;o(i=s)&&(i=n.buffer.byteLength,5123===f?i>>=1:5125===f&&(i>>=2)),n.vertCount=i,i=o,0>o&&(i=4,1===(o=n.buffer.dimension)&&(i=0),2===o&&(i=1),3===o&&(i=4)),n.primType=i}function o(t){n.elementsCount--,delete s[t.id],t.buffer.destroy(),t.buffer=null}var s={},c=0,u={uint8:5121,uint16:5123};e.oes_element_index_uint&&(u.uint32=5125),i.prototype.bind=function(){this.buffer.bind()};var f=[];return{create:function(t,e){function s(t){if(t)if("number"==typeof t)c(t),f.primType=4,f.vertCount=0|t,f.type=5121;else{var e=null,r=35044,n=-1,i=-1,o=0,h=0;Array.isArray(t)||X(t)||l(t)?e=t:("data"in t&&(e=t.data),"usage"in t&&(r=$[t.usage]),"primitive"in t&&(n=nt[t.primitive]),"count"in t&&(i=0|t.count),"type"in t&&(h=u[t.type]),"length"in t?o=0|t.length:(o=i,5123===h||5122===h?o*=2:5125!==h&&5124!==h||(o*=4))),a(f,e,r,n,i,o,h)}else c(),f.primType=4,f.vertCount=0,f.type=5121;return s}var c=r.create(null,34963,!0),f=new i(c._buffer);return n.elementsCount++,s(t),s._reglType="elements",s._elements=f,s.subdata=function(t,e){return c.subdata(t,e),s},s.destroy=function(){o(f)},s},createStream:function(t){var e=f.pop();return e||(e=new i(r.create(null,34963,!0,!1)._buffer)),a(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){f.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof i?t._elements:null},clear:function(){Z(s).forEach(o)}}}function g(t){for(var e=Y.allocType(5123,t.length),r=0;r>>31<<15,i=(a<<1>>>24)-127,a=a>>13&1023;e[r]=-24>i?n:-14>i?n+(a+1024>>-14-i):15>=i,r.height>>=i,p(r,n[i]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function L(t){for(var e=t.images,r=0;re){for(var r=0;r=--this.refCount&&F(this)}}),o.profile&&(a.getTotalTextureSize=function(){var t=0;return Object.keys(yt).forEach((function(e){t+=yt[e].stats.size})),t}),{create2D:function(e,r){function n(t,e){var r=i.texInfo;I.call(r);var a=C();return"number"==typeof t?A(a,0|t,"number"==typeof e?0|e:0|t):t?(P(r,t),S(a,t)):A(a,1,1),r.genMipmaps&&(a.mipmask=(a.width<<1)-1),i.mipmask=a.mipmask,c(i,a),i.internalformat=a.internalformat,n.width=a.width,n.height=a.height,D(i),E(a,3553),z(r,3553),R(),L(a),o.profile&&(i.stats.size=T(i.internalformat,i.type,a.width,a.height,r.genMipmaps,!1)),n.format=tt[i.internalformat],n.type=et[i.type],n.mag=rt[r.magFilter],n.min=nt[r.minFilter],n.wrapS=it[r.wrapS],n.wrapT=it[r.wrapT],n}var i=new O(3553);return yt[i.id]=i,a.textureCount++,n(e,r),n.subimage=function(t,e,r,a){e|=0,r|=0,a|=0;var o=v();return c(o,i),o.width=0,o.height=0,p(o,t),o.width=o.width||(i.width>>a)-e,o.height=o.height||(i.height>>a)-r,D(i),d(o,3553,e,r,a),R(),k(o),n},n.resize=function(e,r){var a=0|e,s=0|r||a;if(a===i.width&&s===i.height)return n;n.width=i.width=a,n.height=i.height=s,D(i);for(var l=0;i.mipmask>>l;++l){var c=a>>l,u=s>>l;if(!c||!u)break;t.texImage2D(3553,l,i.format,c,u,0,i.format,i.type,null)}return R(),o.profile&&(i.stats.size=T(i.internalformat,i.type,a,s,!1,!1)),n},n._reglType="texture2d",n._texture=i,o.profile&&(n.stats=i.stats),n.destroy=function(){i.decRef()},n},createCube:function(e,r,n,i,s,l){function f(t,e,r,n,i,a){var s,l=h.texInfo;for(I.call(l),s=0;6>s;++s)g[s]=C();if("number"!=typeof t&&t){if("object"==typeof t)if(e)S(g[0],t),S(g[1],e),S(g[2],r),S(g[3],n),S(g[4],i),S(g[5],a);else if(P(l,t),u(h,t),"faces"in t)for(t=t.faces,s=0;6>s;++s)c(g[s],h),S(g[s],t[s]);else for(s=0;6>s;++s)S(g[s],t)}else for(t=0|t||1,s=0;6>s;++s)A(g[s],t,t);for(c(h,g[0]),h.mipmask=l.genMipmaps?(g[0].width<<1)-1:g[0].mipmask,h.internalformat=g[0].internalformat,f.width=g[0].width,f.height=g[0].height,D(h),s=0;6>s;++s)E(g[s],34069+s);for(z(l,34067),R(),o.profile&&(h.stats.size=T(h.internalformat,h.type,f.width,f.height,l.genMipmaps,!0)),f.format=tt[h.internalformat],f.type=et[h.type],f.mag=rt[l.magFilter],f.min=nt[l.minFilter],f.wrapS=it[l.wrapS],f.wrapT=it[l.wrapT],s=0;6>s;++s)L(g[s]);return f}var h=new O(34067);yt[h.id]=h,a.cubeCount++;var g=Array(6);return f(e,r,n,i,s,l),f.subimage=function(t,e,r,n,i){r|=0,n|=0,i|=0;var a=v();return c(a,h),a.width=0,a.height=0,p(a,e),a.width=a.width||(h.width>>i)-r,a.height=a.height||(h.height>>i)-n,D(h),d(a,34069+t,r,n,i),R(),k(a),f},f.resize=function(e){if((e|=0)!==h.width){f.width=h.width=e,f.height=h.height=e,D(h);for(var r=0;6>r;++r)for(var n=0;h.mipmask>>n;++n)t.texImage2D(34069+r,n,h.format,e>>n,e>>n,0,h.format,h.type,null);return R(),o.profile&&(h.stats.size=T(h.internalformat,h.type,f.width,f.height,!1,!0)),f}},f._reglType="textureCube",f._texture=h,o.profile&&(f.stats=h.stats),f.destroy=function(){h.decRef()},f},clear:function(){for(var e=0;er;++r)if(0!=(e.mipmask&1<>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;6>n;++n)t.texImage2D(34069+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);z(e.texInfo,e.target)}))}}}function M(t,e,r,n,i,a){function o(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=t=0;e?(t=e.width,n=e.height):r&&(t=r.width,n=r.height),this.width=t,this.height=n}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){t&&(t.texture?t.texture._texture.refCount+=1:t.renderbuffer._renderbuffer.refCount+=1)}function c(e,r){r&&(r.texture?t.framebufferTexture2D(36160,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,r.renderbuffer._renderbuffer.renderbuffer))}function u(t){var e=3553,r=null,n=null,i=t;return"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),"texture2d"===(t=i._reglType)||"textureCube"===t?r=i:"renderbuffer"===t&&(n=i,e=36161),new o(e,r,n)}function f(t,e,r,a,s){return r?((t=n.create2D({width:t,height:e,format:a,type:s}))._texture.refCount=0,new o(3553,t,null)):((t=i.create({width:t,height:e,format:a}))._renderbuffer.refCount=0,new o(36161,null,t))}function h(t){return t&&(t.texture||t.renderbuffer)}function p(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r),t.width=e,t.height=r)}function d(){this.id=T++,k[this.id]=this,this.framebuffer=t.createFramebuffer(),this.height=this.width=0,this.colorAttachments=[],this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function g(t){t.colorAttachments.forEach(s),s(t.depthAttachment),s(t.stencilAttachment),s(t.depthStencilAttachment)}function m(e){t.deleteFramebuffer(e.framebuffer),e.framebuffer=null,a.framebufferCount--,delete k[e.id]}function v(e){var n;t.bindFramebuffer(36160,e.framebuffer);var i=e.colorAttachments;for(n=0;ni;++i){for(c=0;ct;++t)r[t].resize(n);return e.width=e.height=n,e},_reglType:"framebufferCube",destroy:function(){r.forEach((function(t){t.destroy()}))}})},clear:function(){Z(k).forEach(m)},restore:function(){x.cur=null,x.next=null,x.dirty=!0,Z(k).forEach((function(e){e.framebuffer=t.createFramebuffer(),v(e)}))}})}function A(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function S(t,e,r,n,i){function a(){this.id=++c,this.attributes=[];var t=e.oes_vertex_array_object;this.vao=t?t.createVertexArrayOES():null,u[this.id]=this,this.buffers=[]}var o=r.maxAttributes,s=Array(o);for(r=0;rt&&(t=e.stats.uniformsCount)})),t},r.getMaxAttributesCount=function(){var t=0;return h.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);Z(c).forEach(e),c={},Z(u).forEach(e),u={},h.forEach((function(e){t.deleteProgram(e.program)})),h.length=0,f={},r.shaderCount=0},program:function(t,e,n,i){var a=f[e];a||(a=f[e]={});var o=a[t];return o&&!i?o:(e=new s(e,t),r.shaderCount++,l(e,n,i),o||(a[t]=e),h.push(e),e)},restore:function(){c={},u={};for(var t=0;t"+e+"?"+i+".constant["+e+"]:0;"})).join(""),"}}else{","if(",s,"(",i,".buffer)){",u,"=",a,".createStream(",34962,",",i,".buffer);","}else{",u,"=",a,".getBuffer(",i,".buffer);","}",f,'="type" in ',i,"?",o.glTypes,"[",i,".type]:",u,".dtype;",l.normalized,"=!!",i,".normalized;"),n("size"),n("offset"),n("stride"),n("divisor"),r("}}"),r.exit("if(",l.isStream,"){",a,".destroyStream(",u,");","}"),l}))})),o}function M(t,e,n,i,o){function s(t){var e=c[t];e&&(h[t]=e)}var l=function(t,e){if("string"==typeof(r=t.static).frag&&"string"==typeof r.vert){if(0>1)",s],");")}function e(){r(l,".drawArraysInstancedANGLE(",[d,g,m,s],");")}p?y?t():(r("if(",p,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(u+".drawElements("+[d,m,v,g+"<<(("+v+"-5121)>>1)"]+");")}function e(){r(u+".drawArrays("+[d,g,m]+");")}p?y?t():(r("if(",p,"){"),t(),r("}else{"),e(),r("}")):e()}var s,l,c=t.shared,u=c.gl,f=c.draw,h=n.draw,p=function(){var i=h.elements,a=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(t,a)):i=a.def(f,".","elements"),i&&a("if("+i+")"+u+".bindBuffer(34963,"+i+".buffer.buffer);"),i}(),d=i("primitive"),g=i("offset"),m=function(){var i=h.count,a=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(t,a)):i=a.def(f,".","count"),i}();if("number"==typeof m){if(0===m)return}else r("if(",m,"){"),r.exit("}");K&&(s=i("instances"),l=t.instancing);var v=p+".type",y=h.elements&&R(h.elements);K&&("number"!=typeof s||0<=s)?"string"==typeof s?(r("if(",s,">0){"),a(),r("}else if(",s,"<0){"),o(),r("}")):a():o()}function V(t,e,r,n,i){return i=(e=b()).proc("body",i),K&&(e.instancing=i.def(e.shared.extensions,".angle_instanced_arrays")),t(e,i,r,n),e.compile().body}function H(t,e,r,n){L(t,e),r.useVAO?r.drawVAO?e(t.shared.vao,".setVAO(",r.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),N(t,e,r,n.attributes,(function(){return!0}))),j(t,e,r,n.uniforms,(function(){return!0})),U(t,e,e,r)}function G(t,e,r,n){function i(){return!0}t.batchId="a1",L(t,e),N(t,e,r,n.attributes,i),j(t,e,r,n.uniforms,i),U(t,e,e,r)}function Y(t,e,r,n){function i(t){return t.contextDep&&o||t.propDep}function a(t){return!i(t)}L(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var c=t.scope(),u=t.scope();e(c.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",u,"}",c.exit),r.needsContext&&A(t,u,r.context),r.needsFramebuffer&&S(t,u,r.framebuffer),C(t,u,r.state,i),r.profile&&i(r.profile)&&I(t,u,r,!1,!0),n?(r.useVAO?r.drawVAO?i(r.drawVAO)?u(t.shared.vao,".setVAO(",r.drawVAO.append(t,u),");"):c(t.shared.vao,".setVAO(",r.drawVAO.append(t,c),");"):c(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(c(t.shared.vao,".setVAO(null);"),N(t,c,r,n.attributes,a),N(t,u,r,n.attributes,i)),j(t,c,r,n.uniforms,a),j(t,u,r,n.uniforms,i),U(t,c,u,r)):(e=t.global.def("{}"),n=r.shader.progVar.append(t,u),l=u.def(n,".id"),c=u.def(e,"[",l,"]"),u(t.shared.gl,".useProgram(",n,".program);","if(!",c,"){",c,"=",e,"[",l,"]=",t.link((function(e){return V(G,t,r,e,2)})),"(",n,");}",c,".call(this,a0[",s,"],",s,");"))}function W(t,r){function n(e){var n=r.shader[e];n&&i.set(a.shader,"."+e,n.append(t,i))}var i=t.proc("scope",3);t.batchId="a2";var a=t.shared,o=a.current;A(t,i,r.context),r.framebuffer&&r.framebuffer.append(t,i),O(Object.keys(r.state)).forEach((function(e){var n=r.state[e].append(t,i);m(n)?n.forEach((function(r,n){i.set(t.next[e],"["+n+"]",r)})):i.set(a.next,"."+e,n)})),I(t,i,r,!0,!0),["elements","offset","count","instances","primitive"].forEach((function(e){var n=r.draw[e];n&&i.set(a.draw,"."+e,""+n.append(t,i))})),Object.keys(r.uniforms).forEach((function(n){i.set(a.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,i))})),Object.keys(r.attributes).forEach((function(e){var n=r.attributes[e].append(t,i),a=t.scopeAttrib(e);Object.keys(new Z).forEach((function(t){i.set(a,"."+t,n[t])}))})),r.scopeVAO&&i.set(a.vao,".targetVAO",r.scopeVAO.append(t,i)),n("vert"),n("frag"),0=--this.refCount&&o(this)},i.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(u).forEach((function(e){t+=u[e].stats.size})),t}),{create:function(e,r){function o(e,r){var n=0,a=0,u=32854;if("object"==typeof e&&e?("shape"in e?(n=0|(a=e.shape)[0],a=0|a[1]):("radius"in e&&(n=a=0|e.radius),"width"in e&&(n=0|e.width),"height"in e&&(a=0|e.height)),"format"in e&&(u=s[e.format])):"number"==typeof e?(n=0|e,a="number"==typeof r?0|r:n):e||(n=a=1),n!==c.width||a!==c.height||u!==c.format)return o.width=c.width=n,o.height=c.height=a,c.format=u,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,u,n,a),i.profile&&(c.stats.size=yt[c.format]*c.width*c.height),o.format=l[c.format],o}var c=new a(t.createRenderbuffer());return u[c.id]=c,n.renderbufferCount++,o(e,r),o.resize=function(e,r){var n=0|e,a=0|r||n;return n===c.width&&a===c.height||(o.width=c.width=n,o.height=c.height=a,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,c.format,n,a),i.profile&&(c.stats.size=yt[c.format]*c.width*c.height)),o},o._reglType="renderbuffer",o._renderbuffer=c,i.profile&&(o.stats=c.stats),o.destroy=function(){c.decRef()},o},clear:function(){Z(u).forEach(o)},restore:function(){Z(u).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)})),t.bindRenderbuffer(36161,null)}}},bt=[];bt[6408]=4,bt[6407]=3;var _t=[];_t[5121]=1,_t[5126]=4,_t[36193]=2;var wt=["x","y","z","w"],Tt="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),kt={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Mt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},At={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},St={cw:2304,ccw:2305},Et=new D(!1,!1,!1,(function(){}));return function(t){function e(){if(0===J.length)w&&w.update(),tt=null;else{tt=H.next(e),f();for(var t=J.length-1;0<=t;--t){var r=J[t];r&&r(I,null,0)}m.flush(),w&&w.update()}}function r(){!tt&&0=J.length&&n()}}}}function u(){var t=X.viewport,e=X.scissor_box;t[0]=t[1]=e[0]=e[1]=0,I.viewportWidth=I.framebufferWidth=I.drawingBufferWidth=t[2]=e[2]=m.drawingBufferWidth,I.viewportHeight=I.framebufferHeight=I.drawingBufferHeight=t[3]=e[3]=m.drawingBufferHeight}function f(){I.tick+=1,I.time=g(),u(),Y.procs.poll()}function h(){u(),Y.procs.refresh(),w&&w.update()}function g(){return(G()-T)/1e3}if(!(t=i(t)))return null;var m=t.gl,v=m.getContextAttributes();m.isContextLost();var y=function(t,e){function r(e){var r;e=e.toLowerCase();try{r=n[e]=t.getExtension(e)}catch(t){}return!!r}for(var n={},i=0;ie;++e)et(U({framebuffer:t.framebuffer.faces[e]},t),l);else et(t,l);else l(0,t)},prop:q.define.bind(null,1),context:q.define.bind(null,2),this:q.define.bind(null,3),draw:s({}),buffer:function(t){return z.create(t,34962,!1,!1)},elements:function(t){return D.create(t,!1)},texture:F.create2D,cube:F.createCube,renderbuffer:B.create,framebuffer:V.create,framebufferCube:V.createCube,vao:O.createVAO,attributes:v,frame:c,on:function(t,e){var r;switch(t){case"frame":return c(e);case"lost":r=K;break;case"restore":r=Q;break;case"destroy":r=$}return r.push(e),{cancel:function(){for(var t=0;t * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */ -"use strict";var n,a="";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,a="";else if(a.length>=r)return a.substr(0,r);for(;r>a.length&&e>1;)1&e&&(a+=t),e>>=1,t+=t;return a=(a+=t).substr(0,r)}},{}],514:[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:{})},{}],515:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.length,r=t[t.length-1],n=e,a=e-2;a>=0;--a){var i=r,o=t[a];(l=o-((r=i+o)-i))&&(t[--n]=r,r=l)}var s=0;for(a=n;a>1;return["sum(",t(e.slice(0,r)),",",t(e.slice(r)),")"].join("")}(e);var n}function u(t){return new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",c(l(t)),")};return robustDeterminant",t].join(""))(a,i,n,o)}var h=[function(){return[0]},function(t){return[t[0][0]]}];!function(){for(;h.length<6;)h.push(u(h.length));for(var t=[],r=["function robustDeterminant(m){switch(m.length){"],n=0;n<6;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var a=Function.apply(void 0,t);for(e.exports=a.apply(void 0,h.concat([h,u])),n=0;n>1;return["sum(",l(t.slice(0,e)),",",l(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 u(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===a?r.push("+b[",i,"]"):r.push("+A[",i,"][",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 i=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];!function(){for(;i.length<6;)i.push(a(i.length));for(var t=[],r=["function dispatchLinearSolve(A,b){switch(A.length){"],n=0;n<6;++n)t.push("s"+n),r.push("case ",n,":return s",n,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);for(e.exports=o.apply(void 0,i.concat([i,a])),n=0;n<6;++n)e.exports[n]=i[n]}()},{"robust-determinant":516}],520:[function(t,e,r){"use strict";var n=t("two-product"),a=t("robust-sum"),i=t("robust-scale"),o=t("robust-subtract");function s(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",l(t.slice(0,e)),",",l(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(i<=0)return o;n=a+i}else{if(!(a<0))return o;if(i>=0)return o;n=-(a+i)}var s=33306690738754716e-32*n;return o>=s||o<=-s?o:h(t,e,r)},function(t,e,r,n){var a=t[0]-n[0],i=e[0]-n[0],o=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],c=r[1]-n[1],u=t[2]-n[2],h=e[2]-n[2],p=r[2]-n[2],d=i*c,g=o*l,m=o*s,v=a*c,y=a*l,x=i*s,b=u*(d-g)+h*(m-v)+p*(y-x),_=7771561172376103e-31*((Math.abs(d)+Math.abs(g))*Math.abs(u)+(Math.abs(m)+Math.abs(v))*Math.abs(h)+(Math.abs(y)+Math.abs(x))*Math.abs(p));return b>_||-b>_?b:f(t,e,r,n)}];function d(t){var e=p[t.length];return e||(e=p[t.length]=u(t.length)),e.apply(void 0,t)}!function(){for(;p.length<=5;)p.push(u(p.length));for(var t=[],r=["slow"],n=0;n<=5;++n)t.push("a"+n),r.push("o"+n);var a=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=5;++n)a.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");a.push("}var s=new Array(arguments.length);for(var i=0;i0&&o>0||i<0&&o<0)return!1;var s=n(r,t,e),l=n(a,t,e);if(s>0&&l>0||s<0&&l<0)return!1;if(0===i&&0===o&&0===s&&0===l)return function(t,e,r,n){for(var a=0;a<2;++a){var i=t[a],o=e[a],s=Math.min(i,o),l=Math.max(i,o),c=r[a],u=n[a],h=Math.min(c,u);if(Math.max(c,u)=n?(a=h,(l+=1)=n?(a=h,(l+=1)0?1:0}},{}],527:[function(t,e,r){"use strict";e.exports=function(t){return a(n(t))};var n=t("boundary-cells"),a=t("reduce-simplicial-complex")},{"boundary-cells":100,"reduce-simplicial-complex":507}],528:[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[",a[0],"],c[",a[1],"])")}l.push("]")}l.push(");")}}for(i=t+1;i>1;--i){i>1,s=i(t[o],e);s<=0?(0===s&&(a=o),r=o+1):s>0&&(n=o-1)}return a}function u(t,e){for(var r=new Array(t.length),a=0,o=r.length;a=t.length||0!==i(t[m],s)););}return r}function h(t,e){if(e<0)return[];for(var r=[],a=(1<>>u&1&&c.push(a[u]);e.push(c)}return s(e)},r.skeleton=h,r.boundary=function(t){for(var e=[],r=0,n=t.length;r>1:(t>>1)-1}function x(t){for(var e=v(t);;){var r=e,n=2*t+1,a=2*(t+1),i=t;if(n0;){var r=y(t);if(r>=0)if(e0){var t=k[0];return m(0,A-1),A-=1,x(0),t}return-1}function w(t,e){var r=k[t];return c[r]===e?t:(c[r]=-1/0,b(t),_(),c[r]=e,b((A+=1)-1))}function T(t){if(!u[t]){u[t]=!0;var e=s[t],r=l[t];s[r]>=0&&(s[r]=e),l[e]>=0&&(l[e]=r),M[e]>=0&&w(M[e],g(e)),M[r]>=0&&w(M[r],g(r))}}var k=[],M=new Array(i);for(h=0;h>1;h>=0;--h)x(h);for(;;){var S=_();if(S<0||c[S]>r)break;T(S)}var E=[];for(h=0;h=0&&r>=0&&e!==r){var n=M[e],a=M[r];n!==a&&L.push([n,a])}})),a.unique(a.normalize(L)),{positions:E,edges:L}};var n=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":520,"simplicial-complex":532}],535:[function(t,e,r){"use strict";e.exports=function(t,e){var r,i,o,s;if(e[0][0]e[1][0]))return a(e,t);r=e[1],i=e[0]}if(t[0][0]t[1][0]))return-a(t,e);o=t[1],s=t[0]}var l=n(r,i,s),c=n(r,i,o);if(l<0){if(c<=0)return l}else if(l>0){if(c>=0)return l}else if(c)return c;if(l=n(s,o,i),c=n(s,o,r),l<0){if(c<=0)return l}else if(l>0){if(c>=0)return l}else if(c)return c;return i[0]-s[0]};var n=t("robust-orientation");function a(t,e){var r,a,i,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]),c=Math.min(e[0][1],e[1][1]),u=Math.max(e[0][1],e[1][1]);return lu?s-u:l-u}r=e[1],a=e[0]}t[0][1]0)if(e[0]!==o[1][0])r=t,t=t.right;else{if(l=c(t.right,e))return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l;if(l=c(t.right,e))return l;t=t.left}}return r}function u(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function h(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=c(this.slabs[e],t),a=-1;if(r&&(a=r.value),this.coordinates[e]===t[0]){var s=null;if(r&&(s=r.key),e>0){var u=c(this.slabs[e-1],t);u&&(s?o(u.key,s)>0&&(s=u.key,a=u.value):(a=u.value,s=u.key))}var h=this.horizontal[e];if(h.length>0){var f=n.ge(h,t[1],l);if(f=h.length)return a;p=h[f]}}if(p.start)if(s){var d=i(s[0],s[1],[t[0],p.y]);s[0][0]>s[1][0]&&(d=-d),d>0&&(a=p.index)}else a=p.index;else p.y!==t[1]&&(a=p.index)}}}return a}},{"./lib/order-segments":535,"binary-search-bounds":536,"functional-red-black-tree":247,"robust-orientation":520}],538:[function(t,e,r){"use strict";var n=t("robust-dot-product"),a=t("robust-sum");function i(t,e){var r=a(n(t,e),[e[e.length-1]]);return r[r.length-1]}function o(t,e,r,n){var a=-e/(n-e);a<0?a=0:a>1&&(a=1);for(var i=1-a,o=t.length,s=new Array(o),l=0;l0||a>0&&u<0){var h=o(s,u,l,a);r.push(h),n.push(h.slice())}u<0?n.push(l.slice()):u>0?r.push(l.slice()):(r.push(l.slice()),n.push(l.slice())),a=u}return{positive:r,negative:n}},e.exports.positive=function(t,e){for(var r=[],n=i(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;l0||n>0&&c<0)&&r.push(o(a,c,s,n)),c>=0&&r.push(s.slice()),n=c}return r},e.exports.negative=function(t,e){for(var r=[],n=i(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;l0||n>0&&c<0)&&r.push(o(a,c,s,n)),c<=0&&r.push(s.slice()),n=c}return r}},{"robust-dot-product":517,"robust-sum":525}],539:[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(t){return a(o(t),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}function a(r,n){var a,i,o,s,l,c,u,h,f,p=1,d=r.length,g="";for(i=0;i=0),s.type){case"b":a=parseInt(a,10).toString(2);break;case"c":a=String.fromCharCode(parseInt(a,10));break;case"d":case"i":a=parseInt(a,10);break;case"j":a=JSON.stringify(a,null,s.width?parseInt(s.width):0);break;case"e":a=s.precision?parseFloat(a).toExponential(s.precision):parseFloat(a).toExponential();break;case"f":a=s.precision?parseFloat(a).toFixed(s.precision):parseFloat(a);break;case"g":a=s.precision?String(Number(a.toPrecision(s.precision))):parseFloat(a);break;case"o":a=(parseInt(a,10)>>>0).toString(8);break;case"s":a=String(a),a=s.precision?a.substring(0,s.precision):a;break;case"t":a=String(!!a),a=s.precision?a.substring(0,s.precision):a;break;case"T":a=Object.prototype.toString.call(a).slice(8,-1).toLowerCase(),a=s.precision?a.substring(0,s.precision):a;break;case"u":a=parseInt(a,10)>>>0;break;case"v":a=a.valueOf(),a=s.precision?a.substring(0,s.precision):a;break;case"x":a=(parseInt(a,10)>>>0).toString(16);break;case"X":a=(parseInt(a,10)>>>0).toString(16).toUpperCase()}t.json.test(s.type)?g+=a:(!t.number.test(s.type)||h&&!s.sign?f="":(f=h?"+":"-",a=a.toString().replace(t.sign,"")),c=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",u=s.width-(f+a).length,l=s.width&&u>0?c.repeat(u):"",g+=s.align?f+a+l:"0"===c?f+l+a:l+f+a)}return g}var i=Object.create(null);function o(e){if(i[e])return i[e];for(var r,n=e,a=[],o=0;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],c=[];if(null===(c=t.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(c[1]);""!==(l=l.substring(c[0].length));)if(null!==(c=t.key_access.exec(l)))s.push(c[1]);else{if(null===(c=t.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(c[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}"undefined"!=typeof r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],540:[function(t,e,r){"use strict";var n=t("parenthesis");e.exports=function(t,e,r){if(null==t)throw Error("First argument should be a string");if(null==e)throw Error("Separator should be a string or a RegExp");r?("string"==typeof r||Array.isArray(r))&&(r={ignore:r}):r={},null==r.escape&&(r.escape=!0),null==r.ignore?r.ignore=["[]","()","{}","<>",'""',"''","``","\u201c\u201d","\xab\xbb"]:("string"==typeof r.ignore&&(r.ignore=[r.ignore]),r.ignore=r.ignore.map((function(t){return 1===t.length&&(t+=t),t})));var a=n.parse(t,{flat:!0,brackets:r.ignore}),i=a[0].split(e);if(r.escape){for(var o=[],s=0;s0;){e=c[c.length-1];var p=t[e];if(i[e]=0&&s[e].push(o[g])}i[e]=d}else{if(n[e]===r[e]){var m=[],v=[],y=0;for(d=l.length-1;d>=0;--d){var x=l[d];if(a[x]=!1,m.push(x),v.push(s[x]),y+=s[x].length,o[x]=h.length,x===e){l.length=d;break}}h.push(m);var b=new Array(y);for(d=0;d c)|0 },"),"generic"===e&&i.push("getters:[0],");for(var s=[],l=[],c=0;c>>7){");for(c=0;c<1<<(1<128&&c%128==0){h.length>0&&f.push("}}");var p="vExtra"+h.length;i.push("case ",c>>>7,":",p,"(m&0x7f,",l.join(),");break;"),f=["function ",p,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&c,":");for(var d=new Array(r),g=new Array(r),m=new Array(r),v=new Array(r),y=0,x=0;xx)&&!(c&1<<_)!=!(c&1<0&&(M="+"+m[b]+"*c");var A=d[b].length/y*.5,S=.5+v[b]/y*.5;k.push("d"+b+"-"+S+"-"+A+"*("+d[b].join("+")+M+")/("+g[b].join("+")+")")}f.push("a.push([",k.join(),"]);","break;")}i.push("}},"),h.length>0&&f.push("}}");var E=[];for(c=0;c<1<1&&(a=1),a<-1&&(a=-1),(t*n-e*r<0?-1:1)*Math.acos(a)};r.default=function(t){var e=t.px,r=t.py,l=t.cx,c=t.cy,u=t.rx,h=t.ry,f=t.xAxisRotation,p=void 0===f?0:f,d=t.largeArcFlag,g=void 0===d?0:d,m=t.sweepFlag,v=void 0===m?0:m,y=[];if(0===u||0===h)return[];var x=Math.sin(p*a/360),b=Math.cos(p*a/360),_=b*(e-l)/2+x*(r-c)/2,w=-x*(e-l)/2+b*(r-c)/2;if(0===_&&0===w)return[];u=Math.abs(u),h=Math.abs(h);var T=Math.pow(_,2)/Math.pow(u,2)+Math.pow(w,2)/Math.pow(h,2);T>1&&(u*=Math.sqrt(T),h*=Math.sqrt(T));var k=function(t,e,r,n,i,o,l,c,u,h,f,p){var d=Math.pow(i,2),g=Math.pow(o,2),m=Math.pow(f,2),v=Math.pow(p,2),y=d*g-d*v-g*m;y<0&&(y=0),y/=d*v+g*m;var x=(y=Math.sqrt(y)*(l===c?-1:1))*i/o*p,b=y*-o/i*f,_=h*x-u*b+(t+r)/2,w=u*x+h*b+(e+n)/2,T=(f-x)/i,k=(p-b)/o,M=(-f-x)/i,A=(-p-b)/o,S=s(1,0,T,k),E=s(T,k,M,A);return 0===c&&E>0&&(E-=a),1===c&&E<0&&(E+=a),[_,w,S,E]}(e,r,l,c,u,h,g,v,x,b,_,w),M=n(k,4),A=M[0],S=M[1],E=M[2],C=M[3],L=Math.abs(C)/(a/4);Math.abs(1-L)<1e-7&&(L=1);var P=Math.max(Math.ceil(L),1);C/=P;for(var I=0;Ie[2]&&(e[2]=c[u+0]),c[u+1]>e[3]&&(e[3]=c[u+1]);return e}},{"abs-svg-path":65,assert:73,"is-svg-path":445,"normalize-svg-path":545,"parse-svg-path":479}],545:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=[],o=0,s=0,l=0,c=0,u=null,h=null,f=0,p=0,d=0,g=t.length;d4?(o=m[m.length-4],s=m[m.length-3]):(o=f,s=p),r.push(m)}return r};var n=t("svg-arc-to-cubic-bezier");function a(t,e,r,n){return["C",t,e,r,n,r,n]}function i(t,e,r,n,a,i){return["C",t/3+2/3*r,e/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}},{"svg-arc-to-cubic-bezier":543}],546:[function(t,e,r){"use strict";var n,a=t("svg-path-bounds"),i=t("parse-svg-path"),o=t("draw-svg-path"),s=t("is-svg-path"),l=t("bitmap-sdf"),c=document.createElement("canvas"),u=c.getContext("2d");e.exports=function(t,e){if(!s(t))throw Error("Argument should be valid svg path string");e||(e={});var r,h;e.shape?(r=e.shape[0],h=e.shape[1]):(r=c.width=e.w||e.width||200,h=c.height=e.h||e.height||200);var f=Math.min(r,h),p=e.stroke||0,d=e.viewbox||e.viewBox||a(t),g=[r/(d[2]-d[0]),h/(d[3]-d[1])],m=Math.min(g[0]||0,g[1]||0)/2;u.fillStyle="black",u.fillRect(0,0,r,h),u.fillStyle="white",p&&("number"!=typeof p&&(p=1),u.strokeStyle=p>0?"white":"black",u.lineWidth=Math.abs(p));if(u.translate(.5*r,.5*h),u.scale(m,m),function(){if(null!=n)return n;var t=document.createElement("canvas").getContext("2d");if(t.canvas.width=t.canvas.height=1,!window.Path2D)return n=!1;var e=new Path2D("M0,0h1v1h-1v-1Z");t.fillStyle="black",t.fill(e);var r=t.getImageData(0,0,1,1);return n=r&&r.data&&255===r.data[3]}()){var v=new Path2D(t);u.fill(v),p&&u.stroke(v)}else{var y=i(t);o(u,y),u.fill(),p&&u.stroke()}return u.setTransform(1,0,0,1,0,0),l(u,{cutoff:null!=e.cutoff?e.cutoff:.5,radius:null!=e.radius?e.radius:.5*f})}},{"bitmap-sdf":98,"draw-svg-path":174,"is-svg-path":445,"parse-svg-path":479,"svg-path-bounds":544}],547:[function(t,e,r){(function(r){"use strict";e.exports=function t(e,r,a){a=a||{};var o=i[e];o||(o=i[e]={" ":{data:new Float32Array(0),shape:.2}});var s=o[r];if(!s)if(r.length<=1||!/\d/.test(r))s=o[r]=function(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),a=0,i=0,o=0;o0&&(h+=.02);var p=new Float32Array(u),d=0,g=-.5*h;for(f=0;f1&&(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=L(t,360),e=L(e,100),r=L(r,100),0===e)n=a=i=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=o(l,s,t+1/3),a=o(l,s,t),i=o(l,s,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(e.h,l,u),h=!0,f="hsl"),e.hasOwnProperty("a")&&(i=e.a));var p,d,g;return i=C(i),{ok:h,format:e.format||f,r:o(255,s(a.r,0)),g:o(255,s(a.g,0)),b:o(255,s(a.b,0)),a:i}}(e);this._originalInput=e,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=i(100*this._a)/100,this._format=l.format||u.format,this._gradientType=l.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=u.ok,this._tc_id=a++}function u(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,a,i=s(t,e,r),l=o(t,e,r),c=(i+l)/2;if(i==l)n=a=0;else{var u=i-l;switch(a=c>.5?u/(2-i-l):u/(i+l),i){case t:n=(e-r)/u+(e>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(c(n));return i}function A(t,e){e=e||6;for(var r=c(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],s=1/e;e--;)o.push(c({h:n,s:a,v:i})),i=(i+s)%1;return o}c.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,a=this.toRgb();return e=a.r/255,r=a.g/255,n=a.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=C(t),this._roundA=i(100*this._a)/100,this},toHsv:function(){var t=h(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=h(this._r,this._g,this._b),e=i(360*t.h),r=i(100*t.s),n=i(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=u(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=u(this._r,this._g,this._b),e=i(360*t.h),r=i(100*t.s),n=i(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return f(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,a){var o=[z(i(t).toString(16)),z(i(e).toString(16)),z(i(r).toString(16)),z(D(n))];if(a&&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:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*L(this._r,255))+"%",g:i(100*L(this._g,255))+"%",b:i(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*L(this._r,255))+"%, "+i(100*L(this._g,255))+"%, "+i(100*L(this._b,255))+"%)":"rgba("+i(100*L(this._r,255))+"%, "+i(100*L(this._g,255))+"%, "+i(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(E[f(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+p(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=c(t);r="#"+p(a._r,a._g,a._b,a._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 c(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(v,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:O(t[n]));t=r}return c(t,e)},c.equals=function(t,e){return!(!t||!e)&&c(t).toRgbString()==c(e).toRgbString()},c.random=function(){return c.fromRatio({r:l(),g:l(),b:l()})},c.mix=function(t,e,r){r=0===r?0:r||50;var n=c(t).toRgb(),a=c(e).toRgb(),i=r/100;return c({r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a})},c.readability=function(e,r){var n=c(e),a=c(r);return(t.max(n.getLuminance(),a.getLuminance())+.05)/(t.min(n.getLuminance(),a.getLuminance())+.05)},c.isReadable=function(t,e,r){var n,a,i=c.readability(t,e);switch(a=!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":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7}return a},c.mostReadable=function(t,e,r){var n,a,i,o,s=null,l=0;a=(r=r||{}).includeFallbackColors,i=r.level,o=r.size;for(var u=0;ul&&(l=n,s=c(e[u]));return c.isReadable(t,s,{level:i,size:o})||!a?s:(r.includeFallbackColors=!1,c.mostReadable(t,["#fff","#000"],r))};var S=c.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"},E=c.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(S);function C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(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 I(t){return parseInt(t,16)}function z(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function D(e){return t.round(255*parseFloat(e)).toString(16)}function R(t){return I(t)/255}var F,B,N,j=(B="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",N="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+B),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+B),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+B),hsva:new RegExp("hsva"+N),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!!j.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=c:window.tinycolor=c}(Math)},{}],549:[function(t,e,r){"use strict";e.exports=a,e.exports.float32=e.exports.float=a,e.exports.fract32=e.exports.fract=function(t){if(t.length){for(var e=a(t),r=0,n=e.length;ro&&(o=t[0]),t[1]s&&(s=t[1])}function c(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"Point":l(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(l)}}for(e in t.arcs.forEach((function(t){for(var e,r=-1,l=t.length;++ro&&(o=e[0]),e[1]s&&(s=e[1])})),t.objects)c(t.objects[e]);return[a,i,o,s]}function a(t,e){var r=e.id,n=e.bbox,a=null==e.properties?{}:e.properties,o=i(t,e);return null==r&&null==n?{type:"Feature",properties:a,geometry:o}:null==n?{type:"Feature",id:r,properties:a,geometry:o}:{type:"Feature",id:r,bbox:n,properties:a,geometry:o}}function i(t,e){var n=r(t.transform),a=t.arcs;function i(t,e){e.length&&e.pop();for(var r=a[t<0?~t:t],i=0,o=r.length;i1)n=l(t,e,r);else for(a=0,n=new Array(i=t.arcs.length);a1)for(var i,s,c=1,u=l(a[0]);cu&&(s=a[0],a[0]=a[c],a[c]=s,u=i);return a})).filter((function(t){return t.length>0}))}}function u(t,e){for(var r=0,n=t.length;r>>1;t[a]=2))throw new Error("n must be \u22652");var r,a=(l=t.bbox||n(t))[0],i=l[1],o=l[2],s=l[3];e={scale:[o-a?(o-a)/(r-1):1,s-i?(s-i)/(r-1):1],translate:[a,i]}}var l,c,u=h(e),f=t.objects,p={};function d(t){return u(t)}function g(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(g)};break;case"Point":e={type:"Point",coordinates:d(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(d)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(c in f)p[c]=g(f[c]);return{type:"Topology",bbox:l,transform:e,objects:p,arcs:t.arcs.map((function(t){var e,r=0,n=1,a=t.length,i=new Array(a);for(i[0]=u(t[0],0);++rMath.max(r,n)?a[2]=1:r>Math.max(e,n)?a[0]=1:a[1]=1;for(var i=0,o=0,l=0;l<3;++l)i+=t[l]*t[l],o+=a[l]*t[l];for(l=0;l<3;++l)a[l]-=o/i*t[l];return s(a,a),a}function f(t,e,r,a,i,o,s,l){this.center=n(r),this.up=n(a),this.right=n(i),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 c=0;c<16;++c)this.computedMatrix[c]=.5;this.recalcMatrix(0)}var p=f.prototype;p.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},p.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])]},p.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,a=0,i=0;i<3;++i)a+=e[i]*r[i],n+=e[i]*e[i];var l=Math.sqrt(n),u=0;for(i=0;i<3;++i)r[i]-=e[i]*a/n,u+=r[i]*r[i],e[i]/=l;var h=Math.sqrt(u);for(i=0;i<3;++i)r[i]/=h;var f=this.computedToward;o(f,e,r),s(f,f);var p=Math.exp(this.computedRadius[0]),d=this.computedAngle[0],g=this.computedAngle[1],m=Math.cos(d),v=Math.sin(d),y=Math.cos(g),x=Math.sin(g),b=this.computedCenter,_=m*y,w=v*y,T=x,k=-m*x,M=-v*x,A=y,S=this.computedEye,E=this.computedMatrix;for(i=0;i<3;++i){var C=_*r[i]+w*f[i]+T*e[i];E[4*i+1]=k*r[i]+M*f[i]+A*e[i],E[4*i+2]=C,E[4*i+3]=0}var L=E[1],P=E[5],I=E[9],z=E[2],O=E[6],D=E[10],R=P*D-I*O,F=I*z-L*D,B=L*O-P*z,N=c(R,F,B);R/=N,F/=N,B/=N,E[0]=R,E[4]=F,E[8]=B;for(i=0;i<3;++i)S[i]=b[i]+E[2+4*i]*p;for(i=0;i<3;++i){u=0;for(var j=0;j<3;++j)u+=E[i+4*j]*S[j];E[12+i]=-u}E[15]=1},p.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 d=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var a=this.computedMatrix;d[0]=a[2],d[1]=a[6],d[2]=a[10];for(var o=this.computedUp,s=this.computedRight,l=this.computedToward,c=0;c<3;++c)a[4*c]=o[c],a[4*c+1]=s[c],a[4*c+2]=l[c];i(a,a,n,d);for(c=0;c<3;++c)o[c]=a[4*c],s[c]=a[4*c+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,s[0],s[1],s[2])}},p.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var a=this.computedMatrix,i=(Math.exp(this.computedRadius[0]),a[1]),o=a[5],s=a[9],l=c(i,o,s);i/=l,o/=l,s/=l;var u=a[0],h=a[4],f=a[8],p=u*i+h*o+f*s,d=c(u-=i*p,h-=o*p,f-=s*p),g=(u/=d)*e+i*r,m=(h/=d)*e+o*r,v=(f/=d)*e+s*r;this.center.move(t,g,m,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+n),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,n){var i=1;"number"==typeof r&&(i=0|r),(i<0||i>3)&&(i=1);var o=(i+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var s=e[i],l=e[i+4],h=e[i+8];if(n){var f=Math.abs(s),p=Math.abs(l),d=Math.abs(h),g=Math.max(f,p,d);f===g?(s=s<0?-1:1,l=h=0):d===g?(h=h<0?-1:1,s=l=0):(l=l<0?-1:1,s=h=0)}else{var m=c(s,l,h);s/=m,l/=m,h/=m}var v,y,x=e[o],b=e[o+4],_=e[o+8],w=x*s+b*l+_*h,T=c(x-=s*w,b-=l*w,_-=h*w),k=l*(_/=T)-h*(b/=T),M=h*(x/=T)-s*_,A=s*b-l*x,S=c(k,M,A);if(k/=S,M/=S,A/=S,this.center.jump(t,H,G,Y),this.radius.idle(t),this.up.jump(t,s,l,h),this.right.jump(t,x,b,_),2===i){var E=e[1],C=e[5],L=e[9],P=E*x+C*b+L*_,I=E*k+C*M+L*A;v=R<0?-Math.PI/2:Math.PI/2,y=Math.atan2(I,P)}else{var z=e[2],O=e[6],D=e[10],R=z*s+O*l+D*h,F=z*x+O*b+D*_,B=z*k+O*M+D*A;v=Math.asin(u(R)),y=Math.atan2(B,F)}this.angle.jump(t,y,v),this.recalcMatrix(t);var N=e[2],j=e[6],U=e[10],V=this.computedMatrix;a(V,e);var q=V[15],H=V[12]/q,G=V[13]/q,Y=V[14]/q,W=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*W,G-j*W,Y-U*W)},p.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},p.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},p.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter;var a=(n=n||this.computedUp)[0],i=n[1],o=n[2],s=c(a,i,o);if(!(s<1e-6)){a/=s,i/=s,o/=s;var l=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],p=c(l,h,f);if(!(p<1e-6)){l/=p,h/=p,f/=p;var d=this.computedRight,g=d[0],m=d[1],v=d[2],y=a*g+i*m+o*v,x=c(g-=y*a,m-=y*i,v-=y*o);if(!(x<.01&&(x=c(g=i*f-o*h,m=o*l-a*f,v=a*h-i*l))<1e-6)){g/=x,m/=x,v/=x,this.up.set(t,a,i,o),this.right.set(t,g,m,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(p));var b=i*v-o*m,_=o*g-a*v,w=a*m-i*g,T=c(b,_,w),k=a*l+i*h+o*f,M=g*l+m*h+v*f,A=(b/=T)*l+(_/=T)*h+(w/=T)*f,S=Math.asin(u(k)),E=Math.atan2(A,M),C=this.angle._state,L=C[C.length-1],P=C[C.length-2];L%=2*Math.PI;var I=Math.abs(L+2*Math.PI-E),z=Math.abs(L-E),O=Math.abs(L-2*Math.PI-E);I":(e.length>100&&(e=e.slice(0,99)+"\u2026"),e=e.replace(a,(function(t){switch(t){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}})))}},{"./safe-to-string":558}],560:[function(t,e,r){"use strict";var n=t("../value/is"),a={object:!0,function:!0,undefined:!0};e.exports=function(t){return!!n(t)&&hasOwnProperty.call(a,typeof t)}},{"../value/is":566}],561:[function(t,e,r){"use strict";var n=t("../lib/resolve-exception"),a=t("./is");e.exports=function(t){return a(t)?t:n(t,"%v is not a plain function",arguments[1])}},{"../lib/resolve-exception":557,"./is":562}],562:[function(t,e,r){"use strict";var n=t("../function/is"),a=/^\s*class[\s{/}]/,i=Function.prototype.toString;e.exports=function(t){return!!n(t)&&!a.test(i.call(t))}},{"../function/is":556}],563:[function(t,e,r){"use strict";var n=t("../object/is");e.exports=function(t){if(!n(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},{"../object/is":560}],564:[function(t,e,r){"use strict";var n=t("../value/is"),a=t("../object/is"),i=Object.prototype.toString;e.exports=function(t){if(!n(t))return null;if(a(t)){var e=t.toString;if("function"!=typeof e)return null;if(e===i)return null}try{return""+t}catch(t){return null}}},{"../object/is":560,"../value/is":566}],565:[function(t,e,r){"use strict";var n=t("../lib/resolve-exception"),a=t("./is");e.exports=function(t){return a(t)?t:n(t,"Cannot use %v",arguments[1])}},{"../lib/resolve-exception":557,"./is":566}],566:[function(t,e,r){"use strict";e.exports=function(t){return null!=t}},{}],567:[function(t,e,r){(function(e){"use strict";var n=t("bit-twiddle"),a=t("dup"),i=t("buffer").Buffer;e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:a([32,0]),UINT16:a([32,0]),UINT32:a([32,0]),BIGUINT64:a([32,0]),INT8:a([32,0]),INT16:a([32,0]),INT32:a([32,0]),BIGINT64:a([32,0]),FLOAT:a([32,0]),DOUBLE:a([32,0]),DATA:a([32,0]),UINT8C:a([32,0]),BUFFER:a([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s="undefined"!=typeof BigUint64Array,l="undefined"!=typeof BigInt64Array,c=e.__TYPEDARRAY_POOL;c.UINT8C||(c.UINT8C=a([32,0])),c.BIGUINT64||(c.BIGUINT64=a([32,0])),c.BIGINT64||(c.BIGINT64=a([32,0])),c.BUFFER||(c.BUFFER=a([32,0]));var u=c.DATA,h=c.BUFFER;function f(t){if(t){var e=t.length||t.byteLength,r=n.log2(e);u[r].push(t)}}function p(t){t=n.nextPow2(t);var e=n.log2(t),r=u[e];return r.length>0?r.pop():new ArrayBuffer(t)}function d(t){return new Uint8Array(p(t),0,t)}function g(t){return new Uint16Array(p(2*t),0,t)}function m(t){return new Uint32Array(p(4*t),0,t)}function v(t){return new Int8Array(p(t),0,t)}function y(t){return new Int16Array(p(2*t),0,t)}function x(t){return new Int32Array(p(4*t),0,t)}function b(t){return new Float32Array(p(4*t),0,t)}function _(t){return new Float64Array(p(8*t),0,t)}function w(t){return o?new Uint8ClampedArray(p(t),0,t):d(t)}function T(t){return s?new BigUint64Array(p(8*t),0,t):null}function k(t){return l?new BigInt64Array(p(8*t),0,t):null}function M(t){return new DataView(p(t),0,t)}function A(t){t=n.nextPow2(t);var e=n.log2(t),r=h[e];return r.length>0?r.pop():new i(t)}r.free=function(t){if(i.isBuffer(t))h[n.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|n.log2(e);u[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeBigUint64=r.freeInt8=r.freeInt16=r.freeInt32=r.freeBigInt64=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){f(t.buffer)},r.freeArrayBuffer=f,r.freeBuffer=function(t){h[n.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return p(t);switch(e){case"uint8":return d(t);case"uint16":return g(t);case"uint32":return m(t);case"int8":return v(t);case"int16":return y(t);case"int32":return x(t);case"float":case"float32":return b(t);case"double":case"float64":return _(t);case"uint8_clamped":return w(t);case"bigint64":return k(t);case"biguint64":return T(t);case"buffer":return A(t);case"data":case"dataview":return M(t);default:return null}return null},r.mallocArrayBuffer=p,r.mallocUint8=d,r.mallocUint16=g,r.mallocUint32=m,r.mallocInt8=v,r.mallocInt16=y,r.mallocInt32=x,r.mallocFloat32=r.mallocFloat=b,r.mallocFloat64=r.mallocDouble=_,r.mallocUint8Clamped=w,r.mallocBigUint64=T,r.mallocBigInt64=k,r.mallocDataView=M,r.mallocBuffer=A,r.clearCache=function(){for(var t=0;t<32;++t)c.UINT8[t].length=0,c.UINT16[t].length=0,c.UINT32[t].length=0,c.INT8[t].length=0,c.INT16[t].length=0,c.INT32[t].length=0,c.FLOAT[t].length=0,c.DOUBLE[t].length=0,c.BIGUINT64[t].length=0,c.BIGINT64[t].length=0,c.UINT8C[t].length=0,u[t].length=0,h[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":97,buffer:111,dup:176}],568:[function(t,e,r){"use strict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e0&&(i=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,i+"px",n.font].filter((function(t){return t})).join(" "),r.textAlign="start",r.textBaseline="alphabetic",r.direction="ltr",f(function(t,e,r,n,i,o){r=r.replace(/\n/g,""),r=!0===o.breaklines?r.replace(/\/g,"\n"):r.replace(/\/g," ");var s="",l=[];for(p=0;p-1?parseInt(t[1+a]):0,l=i>-1?parseInt(r[1+i]):0;s!==l&&(n=n.replace(S(),"?px "),m*=Math.pow(.75,l-s),n=n.replace("?px ",S())),g+=.25*x*(l-s)}if(!0===o.superscripts){var c=t.indexOf("+"),u=r.indexOf("+"),h=c>-1?parseInt(t[1+c]):0,f=u>-1?parseInt(r[1+u]):0;h!==f&&(n=n.replace(S(),"?px "),m*=Math.pow(.75,f-h),n=n.replace("?px ",S())),g-=.25*x*(f-h)}if(!0===o.bolds){var p=t.indexOf("b|")>-1,d=r.indexOf("b|")>-1;!p&&d&&(n=v?n.replace("italic ","italic bold "):"bold "+n),p&&!d&&(n=n.replace("bold ",""))}if(!0===o.italics){var v=t.indexOf("i|")>-1,y=r.indexOf("i|")>-1;!v&&y&&(n="italic "+n),v&&!y&&(n=n.replace("italic ",""))}e.font=n}for(f=0;f",i="",o=a.length,s=i.length,l="+"===e[0]||"-"===e[0],c=0,u=-s;c>-1&&-1!==(c=r.indexOf(a,c))&&-1!==(u=r.indexOf(i,c+o))&&!(u<=c);){for(var h=c;h=u)n[h]=null,r=r.substr(0,h)+" "+r.substr(h+1);else if(null!==n[h]){var f=n[h].indexOf(e[0]);-1===f?n[h]+=e:l&&(n[h]=n[h].substr(0,f+1)+(1+parseInt(n[h][f+1]))+n[h].substr(f+2))}var p=c+o,d=r.substr(p,u-p).indexOf(a);c=-1!==d?d:u+s}return n}function u(t,e){var r=n(t,128);return e?i(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function h(t,e,r,n){var a=u(t,n),i=function(t,e,r){for(var n=e.textAlign||"start",a=e.textBaseline||"alphabetic",i=[1<<30,1<<30],o=[0,0],s=t.length,l=0;l=0?e[i]:a}))},has___:{value:y((function(e){var n=v(e);return n?r in n:t.indexOf(e)>=0}))},set___:{value:y((function(n,a){var i,o=v(n);return o?o[r]=a:(i=t.indexOf(n))>=0?e[i]=a:(i=t.length,e[i]=a,t[i]=n),this}))},delete___:{value:y((function(n){var a,i,o=v(n);return o?r in o&&delete o[r]:!((a=t.indexOf(n))<0)&&(i=t.length-1,t[a]=void 0,e[a]=e[i],t[a]=t[i],t.length=i,e.length=i,!0)}))}})};d.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 d||x();var e,n=new r,a=void 0,i=!1;return e=t?function(t,e){return n.set(t,e),n.has(t)||(a||(a=new d),a.set(t,e)),this}:function(t,e){if(i)try{n.set(t,e)}catch(r){a||(a=new d),a.set___(t,e)}else n.set(t,e);return this},Object.create(d.prototype,{get___:{value:y((function(t,e){return a?n.has(t)?n.get(t):a.get___(t,e):n.get(t,e)}))},has___:{value:y((function(t){return n.has(t)||!!a&&a.has___(t)}))},set___:{value:y(e)},delete___:{value:y((function(t){var e=!!n.delete(t);return a&&a.delete___(t)||e}))},permitHostObjects___:{value:y((function(t){if(t!==g)throw new Error("bogus call to permitHostObjects___");i=!0}))}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=d.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=d)}function g(t){t.permitHostObjects___&&t.permitHostObjects___(g)}function m(t){return!("weakmap:"==t.substr(0,"weakmap:".length)&&"___"===t.substr(t.length-3))}function v(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[l];if(e&&e.key===t)return e;if(s(t)){e={key:t};try{return o(t,l,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function y(t){return t.prototype=null,Object.freeze(t)}function x(){f||"undefined"==typeof console||(f=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},{}],575:[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":576}],576:[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}},{}],577:[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":575}],578:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":249}],579:[function(t,e,r){var n=t("../main"),a=t("object-assign"),i=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,a(o.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,e){if("string"==typeof t){var r=t.match(l);return r?r[0]:""}var n=this._validateYear(t),a=t.month(),i=""+this.toChineseMonth(n,a);return e&&i.length<2&&(i="0"+i),this.isIntercalaryMonth(n,a)&&(i+="i"),i},monthNames:function(t){if("string"==typeof t){var e=t.match(c);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),a=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"][this.toChineseMonth(r,n)-1];return this.isIntercalaryMonth(r,n)&&(a="\u95f0"+a),a},monthNamesShort:function(t){if("string"==typeof t){var e=t.match(u);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),a=["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"][this.toChineseMonth(r,n)-1];return this.isIntercalaryMonth(r,n)&&(a="\u95f0"+a),a},parseMonth:function(t,e){t=this._validateYear(t);var r,n=parseInt(e);if(isNaN(n))"\u95f0"===e[0]&&(r=!0,e=e.substring(1)),"\u6708"===e[e.length-1]&&(e=e.substring(0,e.length-1)),n=1+["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"].indexOf(e);else{var a=e[e.length-1];r="i"===a||"I"===a}return this.toMonthIndex(t,n,r)},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(t,e){if(t.year&&(t=t.year()),"number"!=typeof t||t<1888||t>2111)throw e.replace(/\{0\}/,this.local.name);return t},toMonthIndex:function(t,e,r){var a=this.intercalaryMonth(t);if(r&&e!==a||e<1||e>12)throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return a?!r&&e<=a?e-1:e:e-1},toChineseMonth:function(t,e){t.year&&(e=(t=t.year()).month());var r=this.intercalaryMonth(t);if(e<0||e>(r?12:11))throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return r?e>13},isIntercalaryMonth:function(t,e){t.year&&(e=(t=t.year()).month());var r=this.intercalaryMonth(t);return!!r&&r===e},leapYear:function(t){return 0!==this.intercalaryMonth(t)},weekOfYear:function(t,e,r){var a,o=this._validateYear(t,n.local.invalidyear),s=f[o-f[0]],l=s>>9&4095,c=s>>5&15,u=31&s;(a=i.newDate(l,c,u)).add(4-(a.dayOfWeek()||7),"d");var h=this.toJD(t,e,r)-a.toJD();return 1+Math.floor(h/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(t,e){t.year&&(e=t.month(),t=t.year()),t=this._validateYear(t);var r=h[t-h[0]];if(e>(r>>13?12:11))throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return r&1<<12-e?30:29},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,s,r,n.local.invalidDate);t=this._validateYear(a.year()),e=a.month(),r=a.day();var o=this.isIntercalaryMonth(t,e),s=this.toChineseMonth(t,e),l=function(t,e,r,n,a){var i,o,s;if("object"==typeof t)o=t,i=e||{};else{var l;if(!("number"==typeof t&&t>=1888&&t<=2111))throw new Error("Lunar year outside range 1888-2111");if(!("number"==typeof e&&e>=1&&e<=12))throw new Error("Lunar month outside range 1 - 12");if(!("number"==typeof r&&r>=1&&r<=30))throw new Error("Lunar day outside range 1 - 30");"object"==typeof n?(l=!1,i=n):(l=!!n,i=a||{}),o={year:t,month:e,day:r,isIntercalary:l}}s=o.day-1;var c,u=h[o.year-h[0]],p=u>>13;c=p&&(o.month>p||o.isIntercalary)?o.month:o.month-1;for(var d=0;d>9&4095,(g>>5&15)-1,(31&g)+s);return i.year=m.getFullYear(),i.month=1+m.getMonth(),i.day=m.getDate(),i}(t,s,r,o);return i.toJD(l.year,l.month,l.day)},fromJD:function(t){var e=i.fromJD(t),r=function(t,e,r,n){var a,i;if("object"==typeof t)a=t,i=e||{};else{if(!("number"==typeof t&&t>=1888&&t<=2111))throw new Error("Solar year outside range 1888-2111");if(!("number"==typeof e&&e>=1&&e<=12))throw new Error("Solar month outside range 1 - 12");if(!("number"==typeof r&&r>=1&&r<=31))throw new Error("Solar day outside range 1 - 31");a={year:t,month:e,day:r},i=n||{}}var o=f[a.year-f[0]],s=a.year<<9|a.month<<5|a.day;i.year=s>=o?a.year:a.year-1,o=f[i.year-f[0]];var l,c=new Date(o>>9&4095,(o>>5&15)-1,31&o),u=new Date(a.year,a.month-1,a.day);l=Math.round((u-c)/864e5);var p,d=h[i.year-h[0]];for(p=0;p<13;p++){var g=d&1<<12-p?30:29;if(l>13;!m||p=2&&n<=6},extraInfo:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return{century:o[Math.floor((a.year()-1)/100)+1]||""}},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return t=a.year()+(a.year()<0?1:0),e=a.month(),(r=a.day())+(e>1?16:0)+(e>2?32*(e-2):0)+400*(t-1)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t+.5)-Math.floor(this.jdEpoch)-1;var e=Math.floor(t/400)+1;t-=400*(e-1),t+=t>15?16:0;var r=Math.floor(t/32)+1,n=t-32*(r-1)+1;return this.newDate(e<=0?e-1:e,r,n)}});var o={20:"Fruitbat",21:"Anchovy"};n.calendars.discworld=i},{"../main":593,"object-assign":473}],582:[function(t,e,r){var n=t("../main"),a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar,a(i.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return(t=e.year()+(e.year()<0?1:0))%4==3||t%4==-1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear),13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(13===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return(t=a.year())<0&&t++,a.day()+30*(a.month()-1)+365*(t-1)+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch,r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;r<=0&&r--,e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1,a=e-30*(n-1)+1;return this.newDate(r,n,a)}}),n.calendars.ethiopian=i},{"../main":593,"object-assign":473}],583:[function(t,e,r){var n=t("../main"),a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function o(t,e){return t-e*Math.floor(t/e)}i.prototype=new n.baseCalendar,a(i.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return this._leapYear(e.year())},_leapYear:function(t){return o(7*(t=t<0?t+1:t)+1,19)<7},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),this._leapYear(t.year?t.year():t)?13:12},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year(),this.toJD(-1===t?1:t+1,7,1)-this.toJD(t,7,1)},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,n.local.invalidMonth),12===e&&this.leapYear(t)||8===e&&5===o(this.daysInYear(t),10)?30:9===e&&3===o(this.daysInYear(t),10)?29:this.daysPerMonth[e-1]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},extraInfo:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return{yearType:(this.leapYear(a)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(a)%10-3]}},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year(),e=a.month(),r=a.day();var i=t<=0?t+1:t,o=this.jdEpoch+this._delay1(i)+this._delay2(i)+r+1;if(e<7){for(var s=7;s<=this.monthsInYear(t);s++)o+=this.daysInMonth(t,s);for(s=1;s=this.toJD(-1===e?1:e+1,7,1);)e++;for(var r=tthis.toJD(e,r,this.daysInMonth(e,r));)r++;var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),n.calendars.hebrew=i},{"../main":593,"object-assign":473}],584:[function(t,e,r){var n=t("../main"),a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar,a(i.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(t){return(11*this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year()+14)%30<11},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return this.leapYear(t)?355:354},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return t=a.year(),e=a.month(),t=t<=0?t+1:t,(r=a.day())+Math.ceil(29.5*(e-1))+354*(t-1)+Math.floor((3+11*t)/30)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=Math.floor((30*(t-this.jdEpoch)+10646)/10631);e=e<=0?e-1:e;var r=Math.min(12,Math.ceil((t-29-this.toJD(e,1,1))/29.5)+1),n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),n.calendars.islamic=i},{"../main":593,"object-assign":473}],585:[function(t,e,r){var n=t("../main"),a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar,a(i.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return(t=e.year()<0?e.year()+1:e.year())%4==0},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return t=a.year(),e=a.month(),r=a.day(),t<0&&t++,e<=2&&(t--,e+=12),Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r-1524.5},fromJD:function(t){var e=Math.floor(t+.5)+1524,r=Math.floor((e-122.1)/365.25),n=Math.floor(365.25*r),a=Math.floor((e-n)/30.6001),i=a-Math.floor(a<14?1:13),o=r-Math.floor(i>2?4716:4715),s=e-n-Math.floor(30.6001*a);return o<=0&&o--,this.newDate(o,i,s)}}),n.calendars.julian=i},{"../main":593,"object-assign":473}],586:[function(t,e,r){var n=t("../main"),a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function o(t,e){return t-e*Math.floor(t/e)}function s(t,e){return o(t-1,e)+1}i.prototype=new n.baseCalendar,a(i.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),!1},formatYear:function(t){t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year();var e=Math.floor(t/400);return t%=400,t+=t<0?400:0,e+"."+Math.floor(t/20)+"."+t%20},forYear:function(t){if((t=t.split(".")).length<3)throw"Invalid Mayan year";for(var e=0,r=0;r19||r>0&&n<0)throw"Invalid Mayan year";e=20*e+n}return e},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),18},weekOfYear:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate),0},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),360},daysInMonth:function(t,e){return this._validate(t,e,this.minDay,n.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate).day()},weekDay:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate),!0},extraInfo:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate).toJD(),i=this._toHaab(a),o=this._toTzolkin(a);return{haabMonthName:this.local.haabMonths[i[0]-1],haabMonth:i[0],haabDay:i[1],tzolkinDayName:this.local.tzolkinMonths[o[0]-1],tzolkinDay:o[0],tzolkinTrecena:o[1]}},_toHaab:function(t){var e=o((t-=this.jdEpoch)+8+340,365);return[Math.floor(e/20)+1,o(e,20)]},_toTzolkin:function(t){return[s((t-=this.jdEpoch)+20,20),s(t+4,13)]},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return a.day()+20*a.month()+360*a.year()+this.jdEpoch},fromJD:function(t){t=Math.floor(t)+.5-this.jdEpoch;var e=Math.floor(t/360);t%=360,t+=t<0?360:0;var r=Math.floor(t/20),n=t%20;return this.newDate(e,r,n)}}),n.calendars.mayan=i},{"../main":593,"object-assign":473}],587:[function(t,e,r){var n=t("../main"),a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;var o=n.instance("gregorian");a(i.prototype,{name:"Nanakshahi",jdEpoch:2257673.5,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return o.leapYear(e.year()+(e.year()<1?1:0)+1469)},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(1-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidMonth);(t=a.year())<0&&t++;for(var i=a.day(),s=1;s=this.toJD(e+1,1,1);)e++;for(var r=t-Math.floor(this.toJD(e,1,1)+.5)+1,n=1;r>this.daysInMonth(e,n);)r-=this.daysInMonth(e,n),n++;return this.newDate(e,n,r)}}),n.calendars.nanakshahi=i},{"../main":593,"object-assign":473}],588:[function(t,e,r){var n=t("../main"),a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar,a(i.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){if(t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year(),"undefined"==typeof this.NEPALI_CALENDAR_DATA[t])return this.daysPerYear;for(var e=0,r=this.minMonth;r<=12;r++)e+=this.NEPALI_CALENDAR_DATA[t][r];return e},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,n.local.invalidMonth),"undefined"==typeof this.NEPALI_CALENDAR_DATA[t]?this.daysPerMonth[e-1]:this.NEPALI_CALENDAR_DATA[t][e]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year(),e=a.month(),r=a.day();var i=n.instance(),o=0,s=e,l=t;this._createMissingCalendarData(t);var c=t-(s>9||9===s&&r>=this.NEPALI_CALENDAR_DATA[l][0]?56:57);for(9!==e&&(o=r,s--);9!==s;)s<=0&&(s=12,l--),o+=this.NEPALI_CALENDAR_DATA[l][s],s--;return 9===e?(o+=r-this.NEPALI_CALENDAR_DATA[l][0])<0&&(o+=i.daysInYear(c)):o+=this.NEPALI_CALENDAR_DATA[l][9]-this.NEPALI_CALENDAR_DATA[l][0],i.newDate(c,1,1).add(o,"d").toJD()},fromJD:function(t){var e=n.instance().fromJD(t),r=e.year(),a=e.dayOfYear(),i=r+56;this._createMissingCalendarData(i);for(var o=9,s=this.NEPALI_CALENDAR_DATA[i][0],l=this.NEPALI_CALENDAR_DATA[i][o]-s+1;a>l;)++o>12&&(o=1,i++),l+=this.NEPALI_CALENDAR_DATA[i][o];var c=this.NEPALI_CALENDAR_DATA[i][o]-(l-a);return this.newDate(i,o,c)},_createMissingCalendarData:function(t){var e=this.daysPerMonth.slice(0);e.unshift(17);for(var r=t-1;r0?474:473))%2820+474+38)%2816<682},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-(n.dayOfWeek()+1)%7,"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year(),e=a.month(),r=a.day();var i=t-(t>=0?474:473),s=474+o(i,2820);return r+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*s-110)/2816)+365*(s-1)+1029983*Math.floor(i/2820)+this.jdEpoch-1},fromJD:function(t){var e=(t=Math.floor(t)+.5)-this.toJD(475,1,1),r=Math.floor(e/1029983),n=o(e,1029983),a=2820;if(1029982!==n){var i=Math.floor(n/366),s=o(n,366);a=Math.floor((2134*i+2816*s+2815)/1028522)+i+1}var l=a+2820*r+474;l=l<=0?l-1:l;var c=t-this.toJD(l,1,1)+1,u=c<=186?Math.ceil(c/31):Math.ceil((c-6)/30),h=t-this.toJD(l,u,1)+1;return this.newDate(l,u,h)}}),n.calendars.persian=i,n.calendars.jalali=i},{"../main":593,"object-assign":473}],590:[function(t,e,r){var n=t("../main"),a=t("object-assign"),i=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,a(o.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(e.year());return i.leapYear(t)},weekOfYear:function(t,e,r){var a=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(a.year());return i.weekOfYear(t,a.month(),a.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=this._t2gYear(a.year());return i.toJD(t,a.month(),a.day())},fromJD:function(t){var e=i.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)},_g2tYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)}}),n.calendars.taiwan=o},{"../main":593,"object-assign":473}],591:[function(t,e,r){var n=t("../main"),a=t("object-assign"),i=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,a(o.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(e.year());return i.leapYear(t)},weekOfYear:function(t,e,r){var a=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(a.year());return i.weekOfYear(t,a.month(),a.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=this._t2gYear(a.year());return i.toJD(t,a.month(),a.day())},fromJD:function(t){var e=i.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)},_g2tYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)}}),n.calendars.thai=o},{"../main":593,"object-assign":473}],592:[function(t,e,r){var n=t("../main"),a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar,a(i.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return 355===this.daysInYear(e.year())},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){for(var e=0,r=1;r<=12;r++)e+=this.daysInMonth(t,r);return e},daysInMonth:function(t,e){for(var r=this._validate(t,e,this.minDay,n.local.invalidMonth).toJD()-24e5+.5,a=0,i=0;ir)return o[a]-o[a-1];a++}return 30},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate),i=12*(a.year()-1)+a.month()-15292;return a.day()+o[i-1]-1+24e5-.5},fromJD:function(t){for(var e=t-24e5+.5,r=0,n=0;ne);n++)r++;var a=r+15292,i=Math.floor((a-1)/12),s=i+1,l=a-12*i,c=e-o[r-1]+1;return this.newDate(s,l,c)},isValid:function(t,e,r){var a=n.baseCalendar.prototype.isValid.apply(this,arguments);return a&&(a=(t=null!=t.year?t.year:t)>=1276&&t<=1500),a},_validate:function(t,e,r,a){var i=n.baseCalendar.prototype._validate.apply(this,arguments);if(i.year<1276||i.year>1500)throw a.replace(/\{0\}/,this.local.name);return i}}),n.calendars.ummalqura=i;var o=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},{"../main":593,"object-assign":473}],593:[function(t,e,r){var n=t("object-assign");function a(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function i(t,e,r,n){if(this._calendar=t,this._year=e,this._month=r,this._day=n,0===this._calendar._validateLevel&&!this._calendar.isValid(this._year,this._month,this._day))throw(c.local.invalidDate||c.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function o(t,e){return"000000".substring(0,e-(t=""+t).length)+t}function s(){this.shortYearCutoff="+10"}function l(t){this.local=this.regionalOptions[t]||this.regionalOptions[""]}n(a.prototype,{instance:function(t,e){t=(t||"gregorian").toLowerCase(),e=e||"";var r=this._localCals[t+"-"+e];if(!r&&this.calendars[t]&&(r=new this.calendars[t](e),this._localCals[t+"-"+e]=r),!r)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,t);return r},newDate:function(t,e,r,n,a){return(n=(null!=t&&t.year?t.calendar():"string"==typeof n?this.instance(n,a):n)||this.instance()).newDate(t,e,r)},substituteDigits:function(t){return function(e){return(e+"").replace(/[0-9]/g,(function(e){return t[e]}))}},substituteChineseDigits:function(t,e){return function(r){for(var n="",a=0;r>0;){var i=r%10;n=(0===i?"":t[i]+e[a])+n,a++,r=Math.floor(r/10)}return 0===n.indexOf(t[1]+e[1])&&(n=n.substr(1)),n||t[0]}}}),n(i.prototype,{newDate:function(t,e,r){return this._calendar.newDate(null==t?this:t,e,r)},year:function(t){return 0===arguments.length?this._year:this.set(t,"y")},month:function(t){return 0===arguments.length?this._month:this.set(t,"m")},day:function(t){return 0===arguments.length?this._day:this.set(t,"d")},date:function(t,e,r){if(!this._calendar.isValid(t,e,r))throw(c.local.invalidDate||c.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=t,this._month=e,this._day=r,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(t,e){return this._calendar.add(this,t,e)},set:function(t,e){return this._calendar.set(this,t,e)},compareTo:function(t){if(this._calendar.name!==t._calendar.name)throw(c.local.differentCalendars||c.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,t._calendar.local.name);var e=this._year!==t._year?this._year-t._year:this._month!==t._month?this.monthOfYear()-t.monthOfYear():this._day-t._day;return 0===e?0:e<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(t){return this._calendar.fromJD(t)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(t){return this._calendar.fromJSDate(t)},toString:function(){return(this.year()<0?"-":"")+o(Math.abs(this.year()),4)+"-"+o(this.month(),2)+"-"+o(this.day(),2)}}),n(s.prototype,{_validateLevel:0,newDate:function(t,e,r){return null==t?this.today():(t.year&&(this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),r=t.day(),e=t.month(),t=t.year()),new i(this,t,e,r))},today:function(){return this.fromJSDate(new Date)},epoch:function(t){return this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear).year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear);return(e.year()<0?"-":"")+o(Math.abs(e.year()),4)},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear),12},monthOfYear:function(t,e){var r=this._validate(t,e,this.minDay,c.local.invalidMonth||c.regionalOptions[""].invalidMonth);return(r.month()+this.monthsInYear(r)-this.firstMonth)%this.monthsInYear(r)+this.minMonth},fromMonthOfYear:function(t,e){var r=(e+this.firstMonth-2*this.minMonth)%this.monthsInYear(t)+this.minMonth;return this._validate(t,r,this.minDay,c.local.invalidMonth||c.regionalOptions[""].invalidMonth),r},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear);return this.leapYear(e)?366:365},dayOfYear:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate);return n.toJD()-this.newDate(n.year(),this.fromMonthOfYear(n.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,e,r){return this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),{}},add:function(t,e,r){return this._validate(t,this.minMonth,this.minDay,c.local.invalidDate||c.regionalOptions[""].invalidDate),this._correctAdd(t,this._add(t,e,r),e,r)},_add:function(t,e,r){if(this._validateLevel++,"d"===r||"w"===r){var n=t.toJD()+e*("w"===r?this.daysInWeek():1),a=t.calendar().fromJD(n);return this._validateLevel--,[a.year(),a.month(),a.day()]}try{var i=t.year()+("y"===r?e:0),o=t.monthOfYear()+("m"===r?e:0);a=t.day();"y"===r?(t.month()!==this.fromMonthOfYear(i,o)&&(o=this.newDate(i,t.month(),this.minDay).monthOfYear()),o=Math.min(o,this.monthsInYear(i)),a=Math.min(a,this.daysInMonth(i,this.fromMonthOfYear(i,o)))):"m"===r&&(!function(t){for(;oe-1+t.minMonth;)i++,o-=e,e=t.monthsInYear(i)}(this),a=Math.min(a,this.daysInMonth(i,this.fromMonthOfYear(i,o))));var s=[i,this.fromMonthOfYear(i,o),a];return this._validateLevel--,s}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,e,r,n){if(!(this.hasYearZero||"y"!==n&&"m"!==n||0!==e[0]&&t.year()>0==e[0]>0)){var a={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n],i=r<0?-1:1;e=this._add(t,r*a[0]+i*a[1],a[2])}return t.date(e[0],e[1],e[2])},set:function(t,e,r){this._validate(t,this.minMonth,this.minDay,c.local.invalidDate||c.regionalOptions[""].invalidDate);var n="y"===r?e:t.year(),a="m"===r?e:t.month(),i="d"===r?e:t.day();return"y"!==r&&"m"!==r||(i=Math.min(i,this.daysInMonth(n,a))),t.date(n,a,i)},isValid:function(t,e,r){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var a=this.newDate(t,e,this.minDay);n=e>=this.minMonth&&e-this.minMonth=this.minDay&&r-this.minDay13.5?13:1),c=a-(l>2.5?4716:4715);return c<=0&&c--,this.newDate(c,l,s)},toJSDate:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),a=new Date(n.year(),n.month()-1,n.day());return a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0),a.setHours(a.getHours()>12?a.getHours()+2:0),a},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var c=e.exports=new a;c.cdate=i,c.baseCalendar=s,c.calendars.gregorian=l},{"object-assign":473}],594:[function(t,e,r){var n=t("object-assign"),a=t("./main");n(a.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),a.local=a.regionalOptions[""],n(a.cdate.prototype,{formatDate:function(t,e){return"string"!=typeof t&&(e=t,t=""),this._calendar.formatDate(t||"",this,e)}}),n(a.baseCalendar.prototype,{UNIX_EPOCH:a.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:a.instance().jdEpoch,TICKS_PER_DAY:864e9,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,e,r){if("string"!=typeof t&&(r=e,e=t,t=""),!e)return"";if(e.calendar()!==this)throw a.local.invalidFormat||a.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat;for(var n,i,o,s,l=(r=r||{}).dayNamesShort||this.local.dayNamesShort,c=r.dayNames||this.local.dayNames,u=r.monthNumbers||this.local.monthNumbers,h=r.monthNamesShort||this.local.monthNamesShort,f=r.monthNames||this.local.monthNames,p=(r.calculateWeek||this.local.calculateWeek,function(e,r){for(var n=1;w+n1}),d=function(t,e,r,n){var a=""+e;if(p(t,n))for(;a.length1},x=function(t,r){var n=y(t,r),i=[2,3,n?4:2,n?4:2,10,11,20]["oyYJ@!".indexOf(t)+1],o=new RegExp("^-?\\d{1,"+i+"}"),s=e.substring(M).match(o);if(!s)throw(a.local.missingNumberAt||a.regionalOptions[""].missingNumberAt).replace(/\{0\}/,M);return M+=s[0].length,parseInt(s[0],10)},b=this,_=function(){if("function"==typeof l){y("m");var t=l.call(b,e.substring(M));return M+=t.length,t}return x("m")},w=function(t,r,n,i){for(var o=y(t,i)?n:r,s=0;s-1){p=1,d=g;for(var E=this.daysInMonth(f,p);d>E;E=this.daysInMonth(f,p))p++,d-=E}return h>-1?this.fromJD(h):this.newDate(f,p,d)},determineDate:function(t,e,r,n,a){r&&"object"!=typeof r&&(a=n,n=r,r=null),"string"!=typeof n&&(a=n,n="");var i=this;return e=e?e.newDate():null,t=null==t?e:"string"==typeof t?function(t){try{return i.parseDate(n,t,a)}catch(t){}for(var e=((t=t.toLowerCase()).match(/^c/)&&r?r.newDate():null)||i.today(),o=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,s=o.exec(t);s;)e.add(parseInt(s[1],10),s[2]||"d"),s=o.exec(t);return e}(t):"number"==typeof t?isNaN(t)||t===1/0||t===-1/0?e:i.today().add(t,"d"):i.newDate(t)}})},{"./main":593,"object-assign":473}],595:[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":151}],596:[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":595}],597:[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}]},{}],598:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=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:a({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",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.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",i.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:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803,"../../plots/font_attributes":825,"./arrow_paths":597}],599:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./draw").draw;function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach((function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref);e._extremes={},r&&s(e,r),n&&s(e,n)}))}function s(t,e){var r,n=e._id,i=n.charAt(0),o=t[i],s=t["a"+i],l=t[i+"ref"],c=t["a"+i+"ref"],u=t["_"+i+"padplus"],h=t["_"+i+"padminus"],f={x:1,y:-1}[i]*t[i+"shift"],p=3*t.arrowsize*t.arrowwidth||0,d=p+f,g=p-f,m=3*t.startarrowsize*t.arrowwidth||0,v=m+f,y=m-f;if(c===l){var x=a.findExtremes(e,[e.r2c(o)],{ppadplus:d,ppadminus:g}),b=a.findExtremes(e,[e.r2c(s)],{ppadplus:Math.max(u,v),ppadminus:Math.max(h,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else v=s?v+s:v,y=s?y-s:y,r=a.findExtremes(e,[e.r2c(o)],{ppadplus:Math.max(u,d,v),ppadminus:Math.max(h,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([i,o],t)}},{"../../lib":749,"../../plots/cartesian/axes":797,"./draw":604}],600:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("../../plot_api/plot_template").arrayEditor;function o(t,e){var r,n,a,i,o,l,c,u=t._fullLayout.annotations,h=[],f=[],p=[],d=(e||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(t,e){var r,s,l=o(t,e),c=l.on,u=l.off.concat(l.explicitOff),h={},f=t._fullLayout.annotations;if(!c.length&&!u.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,G=["x","y"],Y=0;Y1)&&(tt===$?((ct=et.r2fraction(e["a"+Q]))<0||ct>1)&&(H=!0):H=!0),W=et._offset+et.r2p(e[Q]),J=.5}else"x"===Q?(X=e[Q],W=b.l+b.w*X):(X=1-e[Q],W=b.t+b.h*X),J=e.showarrow?.5:X;if(e.showarrow){lt.head=W;var ut=e["a"+Q];K=nt*U(.5,e.xanchor)-at*U(.5,e.yanchor),tt===$?(lt.tail=et._offset+et.r2p(ut),Z=K):(lt.tail=W+ut,Z=K+ut),lt.text=lt.tail+K;var ht=x["x"===Q?"width":"height"];if("paper"===$&&(lt.head=o.constrain(lt.head,1,ht-1)),"pixel"===tt){var ft=-Math.max(lt.tail-3,lt.text),pt=Math.min(lt.tail+3,lt.text)-ht;ft>0?(lt.tail+=ft,lt.text+=ft):pt>0&&(lt.tail-=pt,lt.text-=pt)}lt.tail+=st,lt.head+=st}else Z=K=it*U(J,ot),lt.text=W+K;lt.text+=st,K+=st,Z+=st,e["_"+Q+"padplus"]=it/2+Z,e["_"+Q+"padminus"]=it/2-Z,e["_"+Q+"size"]=it,e["_"+Q+"shift"]=K}if(H)z.remove();else{var dt=0,gt=0;if("left"!==e.align&&(dt=(w-v)*("center"===e.align?.5:1)),"top"!==e.valign&&(gt=(I-y)*("middle"===e.valign?.5:1)),u)n.select("svg").attr({x:R+dt-1,y:R+gt}).call(c.setClipUrl,B?A:null,t);else{var mt=R+gt-d.top,vt=R+dt-d.left;V.call(h.positionText,vt,mt).call(c.setClipUrl,B?A:null,t)}N.select("rect").call(c.setRect,R,R,w,I),F.call(c.setRect,O/2,O/2,D-O,j-O),z.call(c.setTranslate,Math.round(S.x.text-D/2),Math.round(S.y.text-j/2)),L.attr({transform:"rotate("+E+","+S.x.text+","+S.y.text+")"});var yt,xt=function(r,n){C.selectAll(".annotation-arrow-g").remove();var u=S.x.head,h=S.y.head,f=S.x.tail+r,d=S.y.tail+n,v=S.x.text+r,y=S.y.text+n,x=o.rotationXYMatrix(E,v,y),w=o.apply2DTransform(x),A=o.apply2DTransform2(x),P=+F.attr("width"),I=+F.attr("height"),O=v-.5*P,D=O+P,R=y-.5*I,B=R+I,N=[[O,R,O,B],[O,B,D,B],[D,B,D,R],[D,R,O,R]].map(A);if(!N.reduce((function(t,e){return t^!!o.segmentsIntersect(u,h,u+1e6,h+1e6,e[0],e[1],e[2],e[3])}),!1)){N.forEach((function(t){var e=o.segmentsIntersect(f,d,u,h,t[0],t[1],t[2],t[3]);e&&(f=e.x,d=e.y)}));var j=e.arrowwidth,U=e.arrowcolor,V=e.arrowside,q=C.append("g").style({opacity:l.opacity(U)}).classed("annotation-arrow-g",!0),H=q.append("path").attr("d","M"+f+","+d+"L"+u+","+h).style("stroke-width",j+"px").call(l.stroke,l.rgb(U));if(g(H,V,e),_.annotationPosition&&H.node().parentNode&&!i){var G=u,Y=h;if(e.standoff){var W=Math.sqrt(Math.pow(u-f,2)+Math.pow(h-d,2));G+=e.standoff*(f-u)/W,Y+=e.standoff*(d-h)/W}var Z,X,J=q.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(f-G)+","+(d-Y),transform:"translate("+G+","+Y+")"}).style("stroke-width",j+6+"px").call(l.stroke,"rgba(0,0,0,0)").call(l.fill,"rgba(0,0,0,0)");p.init({element:J.node(),gd:t,prepFn:function(){var t=c.getTranslate(z);Z=t.x,X=t.y,s&&s.autorange&&T(s._name+".autorange",!0),m&&m.autorange&&T(m._name+".autorange",!0)},moveFn:function(t,r){var n=w(Z,X),a=n[0]+t,i=n[1]+r;z.call(c.setTranslate,a,i),k("x",s?s.p2r(s.r2p(e.x)+t):e.x+t/b.w),k("y",m?m.p2r(m.r2p(e.y)+r):e.y-r/b.h),e.axref===e.xref&&k("ax",s.p2r(s.r2p(e.ax)+t)),e.ayref===e.yref&&k("ay",m.p2r(m.r2p(e.ay)+r)),q.attr("transform","translate("+t+","+r+")"),L.attr({transform:"rotate("+E+","+a+","+i+")"})},doneFn:function(){a.call("_guiRelayout",t,M());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&xt(0,0),P)p.init({element:z.node(),gd:t,prepFn:function(){yt=L.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?k("ax",s.p2r(s.r2p(e.ax)+t)):k("ax",e.ax+t),e.ayref===e.yref?k("ay",m.p2r(m.r2p(e.ay)+r)):k("ay",e.ay+r),xt(t,r);else{if(i)return;var a,o;if(s)a=s.p2r(s.r2p(e.x)+t);else{var l=e._xsize/b.w,c=e.x+(e._xshift-e.xshift)/b.w-l/2;a=p.align(c+t/b.w,l,0,1,e.xanchor)}if(m)o=m.p2r(m.r2p(e.y)+r);else{var u=e._ysize/b.h,h=e.y-(e._yshift+e.yshift)/b.h-u/2;o=p.align(h-r/b.h,u,0,1,e.yanchor)}k("x",a),k("y",o),s&&m||(n=p.getCursor(s?.5:a,m?.5:o,e.xanchor,e.yanchor))}L.attr({transform:"translate("+t+","+r+")"+yt}),f(z,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",q(n))},doneFn:function(){f(z),a.call("_guiRelayout",t,M());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,m=e.indexOf("end")>=0,v=h.backoff*p+r.standoff,y=f.backoff*d+r.startstandoff;if("line"===u.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},s={x:+t.attr("x2"),y:+t.attr("y2")};var x=o.x-s.x,b=o.y-s.y;if(c=(l=Math.atan2(b,x))+Math.PI,v&&y&&v+y>Math.sqrt(x*x+b*b))return void P();if(v){if(v*v>x*x+b*b)return void P();var _=v*Math.cos(l),w=v*Math.sin(l);s.x+=_,s.y+=w,t.attr({x2:s.x,y2:s.y})}if(y){if(y*y>x*x+b*b)return void P();var T=y*Math.cos(l),k=y*Math.sin(l);o.x-=T,o.y-=k,t.attr({x1:o.x,y1:o.y})}}else if("path"===u.nodeName){var M=u.getTotalLength(),A="";if(M1){c=!0;break}}c?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l._pdata=a(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":848,"../annotations/draw":604}],611:[function(t,e,r){"use strict";var n=t("../../registry"),a=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 i=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 i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(n(t))},i.opacity=function(t){return t?n(t).getAlpha():0},i.addOpacity=function(t,e){var r=n(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},i.combine=function(t,e){var r=n(t).toRgb();if(1===r.a)return n(t).toRgbString();var a=n(e||l).toRgb(),i=1===a.a?a:{r:255*(1-a.a)+a.r*a.a,g:255*(1-a.a)+a.g*a.a,b:255*(1-a.a)+a.b*a.a},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},i.contrast=function(t,e,r){var a=n(t);return 1!==a.getAlpha()&&(a=n(i.combine(t,l))),(a.isDark()?e?a.lighten(e):l:r?a.darken(r):s).toString()},i.stroke=function(t,e){var r=n(e);t.style({stroke:i.tinyRGB(r),"stroke-opacity":r.getAlpha()})},i.fill=function(t,e){var r=n(e);t.style({fill:i.tinyRGB(r),"fill-opacity":r.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,r,n,a,o=Object.keys(t);for(e=0;e0?n>=l:n<=l));a++)n>u&&n0?n>=l:n<=l));a++)n>r[0]&&n1){var X=Math.pow(10,Math.floor(Math.log(Z)/Math.LN10));Y*=X*c.roundUp(Z/X,[2,5,10]),(Math.abs(C.start)/C.size+1e-6)%1<2e-6&&(G.tick0=0)}G.dtick=Y}G.domain=[V+N,V+R-N],G.setScale(),t.attr("transform","translate("+Math.round(l.l)+","+Math.round(l.t)+")");var J,K=t.select("."+k.cbtitleunshift).attr("transform","translate(-"+Math.round(l.l)+",-"+Math.round(l.t)+")"),Q=t.select("."+k.cbaxis),$=0;function tt(n,a){var i={propContainer:G,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+k.cbtitle)},s="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+s+",."+s+"-math-group").remove(),d.draw(r,n,u(i,a||{}))}return c.syncOrAsync([i.previousPromises,function(){if(-1!==["top","bottom"].indexOf(M)){var t,r=l.l+(e.x+F)*l.w,n=G.title.font.size;t="top"===M?(1-(V+R-N))*l.h+l.t+3+.75*n:(1-(V+N))*l.h+l.t-3-.25*n,tt(G._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(M)){var i=t.select("."+k.cbtitle),o=i.select("text"),u=[-e.outlinewidth/2,e.outlinewidth/2],h=i.select(".h"+G._id+"title-math-group").node(),p=15.6;if(o.node()&&(p=parseInt(o.node().style.fontSize,10)*_),h?($=f.bBox(h).height)>p&&(u[1]-=($-p)/2):o.node()&&!o.classed(k.jsPlaceholder)&&($=f.bBox(o.node()).height),$){if($+=5,"top"===M)G.domain[1]-=$/l.h,u[1]*=-1;else{G.domain[0]+=$/l.h;var d=g.lineCount(o);u[1]+=(1-d)*p}i.attr("transform","translate("+u+")"),G.setScale()}}t.selectAll("."+k.cbfills+",."+k.cblines).attr("transform","translate(0,"+Math.round(l.h*(1-G.domain[1]))+")"),Q.attr("transform","translate(0,"+Math.round(-l.t)+")");var v=t.select("."+k.cbfills).selectAll("rect."+k.cbfill).data(P);v.enter().append("rect").classed(k.cbfill,!0).style("stroke","none"),v.exit().remove();var y=A.map(G.c2p).map(Math.round).sort((function(t,e){return t-e}));v.each((function(t,i){var o=[0===i?A[0]:(P[i]+P[i-1])/2,i===P.length-1?A[1]:(P[i]+P[i+1])/2].map(G.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,y[0],y[1]);var s=n.select(this).attr({x:j,width:Math.max(z,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)f.gradient(s,r,e._id,"vertical",e._fillgradient,"fill");else{var l=E(t).replace("e-","");s.attr("fill",a(l).toHexString())}}));var x=t.select("."+k.cblines).selectAll("path."+k.cbline).data(m.color&&m.width?I:[]);x.enter().append("path").classed(k.cbline,!0),x.exit().remove(),x.each((function(t){n.select(this).attr("d","M"+j+","+(Math.round(G.c2p(t))+m.width/2%1)+"h"+z).call(f.lineGroupStyle,m.width,S(t),m.dash)})),Q.selectAll("g."+G._id+"tick,path").remove();var b=j+z+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),w=s.calcTicks(G),T=s.makeTransFn(G),C=s.getTickSigns(G)[2];return s.drawTicks(r,G,{vals:"inside"===G.ticks?s.clipEnds(G,w):w,layer:Q,path:s.makeTickPath(G,b,C),transFn:T}),s.drawLabels(r,G,{vals:w,layer:Q,transFn:T,labelFns:s.makeLabelFns(G,b)})},function(){if(-1===["top","bottom"].indexOf(M)){var t=G.title.font.size,e=G._offset+G._length/2,a=l.l+(G.position||0)*l.w+("right"===G.side?10+t*(G.showticklabels?1:.5):-10-t*(G.showticklabels?.5:0));tt("h"+G._id+"title",{avoid:{selection:n.select(r).selectAll("g."+G._id+"tick"),side:M,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},i.previousPromises,function(){var n=z+e.outlinewidth/2+f.bBox(Q.node()).width;if((J=K.select("text")).node()&&!J.classed(k.jsPlaceholder)){var a,o=K.select(".h"+G._id+"title-math-group").node();a=o&&-1!==["top","bottom"].indexOf(M)?f.bBox(o).width:f.bBox(K.node()).right-j-l.l,n=Math.max(n,a)}var s=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,c=q-H;t.select("."+k.cbbg).attr({x:j-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:H-B,width:Math.max(s,2),height:Math.max(c+2*B,2)}).call(p.fill,e.bgcolor).call(p.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+k.cboutline).attr({x:j,y:H+e.ypad+("top"===M?$:0),width:Math.max(z,2),height:Math.max(c-2*e.ypad-$,2)}).call(p.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var u=({center:.5,right:1}[e.xanchor]||0)*s;t.attr("transform","translate("+(l.l-u)+","+l.t+")");var h={},d=w[e.yanchor],g=T[e.yanchor];"pixels"===e.lenmode?(h.y=e.y,h.t=c*d,h.b=c*g):(h.t=h.b=0,h.yt=e.y+e.len*d,h.yb=e.y-e.len*g);var m=w[e.xanchor],v=T[e.xanchor];if("pixels"===e.thicknessmode)h.x=e.x,h.l=s*m,h.r=s*v;else{var y=s-z;h.l=y*m,h.r=y*v,h.xl=e.x-e.thickness*m,h.xr=e.x+e.thickness*v}i.autoMargin(r,e._id,h)}],r)}(r,e,t);m&&m.then&&(t._promises||[]).push(m),t._context.edits.colorbarPosition&&function(t,e,r){var n,a,i,s=r._fullLayout._size;l.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),h(t)},moveFn:function(r,o){t.attr("transform",n+" translate("+r+","+o+")"),a=l.align(e._xLeftFrac+r/s.w,e._thickFrac,0,1,e.xanchor),i=l.align(e._yBottomFrac-o/s.h,e._lenFrac,0,1,e.yanchor);var c=l.getCursor(a,i,e.xanchor,e.yanchor);h(t,c)},doneFn:function(){if(h(t),void 0!==a&&void 0!==i){var n={};n[e._propPrefix+"x"]=a,n[e._propPrefix+"y"]=i,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){i.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":717,"../../lib":749,"../../lib/extend":739,"../../lib/setcursor":769,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_defaults":799,"../../plots/cartesian/layout_attributes":811,"../../plots/cartesian/position_defaults":814,"../../plots/plots":860,"../../registry":880,"../color":615,"../colorscale/helpers":626,"../dragelement":634,"../drawing":637,"../titles":710,"./constants":617,d3:169,tinycolor2:548}],620:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":749}],621:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":616,"./defaults":618,"./draw":619,"./has_colorbar":620}],622:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),a=t("../../lib/regex").counter,i=t("./scales.js").scales;Object.keys(i);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,s=(e=e||{}).cLetter||"c",l=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),c="showScaleDflt"in e?e.showScaleDflt:"z"===s,u="string"==typeof e.colorscaleDflt?i[e.colorscaleDflt]:null,h=e.editTypeOverride||"",f=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(f+(r={z:"z",c:"color"}[s]));var p=s+"auto",d=s+"min",g=s+"max",m=s+"mid",v=(o(f+p),o(f+d),o(f+g),{});v[d]=v[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:h||"style"},e.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:v},x[d]={valType:"number",dflt:null,editType:h||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:h||"plot",impliedEdits:y},x[m]={valType:"number",dflt:null,editType:"calc",impliedEdits:v},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},l||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),e.noColorAxis||(x.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":765,"../colorbar/attributes":616,"./scales.js":630}],623:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,s=t._fullLayout,l=r.vals,c=r.containerStr,u=c?a.nestedProperty(e,c).get():e,h=i(u),f=!1!==h.auto,p=h.min,d=h.max,g=h.mid,m=function(){return a.aggNums(Math.min,null,l)},v=function(){return a.aggNums(Math.max,null,l)};(void 0===p?p=m():f&&(p=u._colorAx&&n(p)?Math.min(p,m()):m()),void 0===d?d=v():f&&(d=u._colorAx&&n(d)?Math.max(d,v()):v()),f&&void 0!==g&&(d-g>g-p?p=g-(d-g):d-g=0?s.colorscale.sequential:s.colorscale.sequentialminus,h._sync("colorscale",o))}},{"../../lib":749,"./helpers":626,"fast-isnumeric":241}],624:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./helpers").hasColorscale,i=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,a){var o=a.container?n.nestedProperty(t,a.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var s=i(o),l=s.auto;(l||void 0===s.min)&&r(o,a.min),(l||void 0===s.max)&&r(o,a.max),s.autocolorscale&&r(o,"colorscale")}}for(var s=0;s=0;n--,a++){var i=t[n];r[a]=[1-i[0],i[1]]}return r}function d(t,e){e=e||{};for(var r=t.domain,o=t.range,l=o.length,c=new Array(l),u=0;u4/3-s?o:s}},{}],632:[function(t,e,r){"use strict";var n=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":749}],633:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],634:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),a=t("has-hover"),i=t("has-passive-events"),o=t("../../lib").removeElement,s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var c=t("./unhover");function u(){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 h(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}l.unhover=c.wrapped,l.unhoverRaw=c.raw,l.init=function(t){var e,r,n,c,f,p,d,g,m=t.gd,v=1,y=m._context.doubleClickDelay,x=t.element;m._mouseDownTime||(m._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,i?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=t.clampFn||function(t,e,r){return Math.abs(t)y&&(v=Math.max(v-1,1)),m._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(v,p),!g){var r;try{r=new MouseEvent("click",e)}catch(t){var n=h(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)}d.dispatchEvent(r)}m._dragging=!1,m._dragged=!1}else m._dragged=!1}},l.coverSlip=u},{"../../lib":749,"../../plots/cartesian/constants":803,"./align":631,"./cursor":632,"./unhover":635,"has-hover":414,"has-passive-events":415,"mouse-event-offset":458}],635:[function(t,e,r){"use strict";var n=t("../../lib/events"),a=t("../../lib/throttle"),i=t("../../lib/dom").getGraphDiv,o=t("../fx/constants"),s=e.exports={};s.wrapped=function(t,e,r){(t=i(t))._fullLayout&&a.clear(t._fullLayout._uid+o.HOVERID),s.raw(t,e,r)},s.raw=function(t,e){var r=t._fullLayout,a=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&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/dom":737,"../../lib/events":738,"../../lib/throttle":774,"../fx/constants":649}],636:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],637:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("tinycolor2"),o=t("../../registry"),s=t("../color"),l=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),f=t("../../constants/alignment").LINE_SPACING,p=t("../../constants/interactions").DESELECTDIM,d=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),m=t("../../components/fx/helpers").appendArrayPointValue,v=e.exports={};v.font=function(t,e,r,n){c.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,a){t.call(v.setPosition,e,r).call(v.setSize,n,a)},v.translatePoint=function(t,e,r,n){var i=r.c2p(t.x),o=n.c2p(t.y);return!!(a(i)&&a(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",o):e.attr("transform","translate("+i+","+o+")"),!0)},v.translatePoints=function(t,e,r){t.each((function(t){var a=n.select(this);v.translatePoint(t,a,e,r)}))},v.hideOutsideRangePoint=function(t,e,r,n,a,i){e.attr("display",r.isPtWithinRange(t,a)&&n.isPtWithinRange(t,i)?null:"none")},v.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,a=e.yaxis;t.each((function(e){var i=e[0].trace,s=i.xcalendar,l=i.ycalendar,c=o.traceIs(i,"bar-like")?".bartext":".point,.textpoint";t.selectAll(c).each((function(t){v.hideOutsideRangePoint(t,n.select(this),r,a,s,l)}))}))}},v.crispRound=function(t,e,r){return e&&a(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},v.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,l=a||i.dash||"";s.stroke(e,n||i.color),v.dashLine(e,l,o)},v.lineGroupStyle=function(t,e,r,a){t.style("fill","none").each((function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,l=a||i.dash||"";n.select(this).call(s.stroke,r||i.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 y=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolNoFill={},v.symbolList=[],Object.keys(y).forEach((function(t){var e=y[t],r=e.n;v.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),v.symbolNames[r]=t,v.symbolFuncs[r]=e.f,e.needLine&&(v.symbolNeedLines[r]=!0),e.noDot?v.symbolNoDot[r]=!0:v.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(v.symbolNoFill[r]=!0)}));var x=v.symbolNames.length;function b(t,e){var r=t%100;return v.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}v.symbolNumber=function(t){if(a(t))t=+t;else 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>=x||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},T=n.format("~.1f"),k={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,a,o,l){for(var u=o.length,h=k[a],f=new Array(u),p=0;p"+v(t);d._gradientUrlQueryParts[y]=1},v.initGradients=function(t){var e=t._fullLayout;c.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},v.pointStyle=function(t,e,r){if(t.size()){var a=v.makePointStyleFns(e);t.each((function(t){v.singlePointStyle(t,n.select(this),e,a,r)}))}},v.singlePointStyle=function(t,e,r,n,a){var i=r.marker,o=i.line;if(e.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(t):void 0===t.mo?i.opacity:t.mo),n.ms2mrc){var l;l="various"===t.ms||"various"===i.size?3:n.ms2mrc(t.ms),t.mrc=l,n.selectedSizeFn&&(l=t.mrc=n.selectedSizeFn(t));var u=v.symbolNumber(t.mx||i.symbol)||0;t.om=u%200>=100,e.attr("d",b(u,l))}var h,f,p,d=!1;if(t.so)p=o.outlierwidth,f=o.outliercolor,h=i.outliercolor;else{var g=(o||{}).width;p=(t.mlw+1||g+1||(t.trace?(t.trace.marker.line||{}).width:0)+1)-1||0,f="mlc"in t?t.mlcc=n.lineScale(t.mlc):c.isArrayOrTypedArray(o.color)?s.defaultLine:o.color,c.isArrayOrTypedArray(i.color)&&(h=s.defaultLine,d=!0),h="mc"in t?t.mcc=n.markerScale(t.mc):i.color||"rgba(0,0,0,0)",n.selectedColorFn&&(h=n.selectedColorFn(t))}if(t.om)e.call(s.stroke,h).style({"stroke-width":(p||1)+"px",fill:"none"});else{e.style("stroke-width",(t.isBlank?0:p)+"px");var m=i.gradient,y=t.mgt;if(y?d=!0:y=m&&m.type,Array.isArray(y)&&(y=y[0],k[y]||(y=0)),y&&"none"!==y){var x=t.mgc;x?d=!0:x=m.color;var _=r.uid;d&&(_+="-"+t.i),v.gradient(e,a,_,y,[[0,x],[1,h]],"fill")}else s.fill(e,h);p&&s.stroke(e,f)}},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=d.isBubble(t)?g(t):function(){return(r.size||6)/2}),t.selectedpoints&&c.extendFlat(e,v.makeSelectedPointStyleFns(t)),e},v.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.marker||{},i=r.marker||{},s=n.marker||{},l=a.opacity,u=i.opacity,h=s.opacity,f=void 0!==u,d=void 0!==h;(c.isArrayOrTypedArray(l)||f||d)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?a.opacity:t.mo;return t.selected?f?u:e:d?h:p*e});var g=a.color,m=i.color,v=s.color;(m||v)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?m||e:v||e});var y=a.size,x=i.size,b=s.size,_=void 0!==x,w=void 0!==b;return o.traceIs(t,"symbols")&&(_||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||y/2;return t.selected?_?x/2:e:w?b/2:e}),e},v.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},a=t.textfont||{},i=r.textfont||{},o=n.textfont||{},l=a.color,c=i.color,u=o.color;return e.selectedTextColorFn=function(t){var e=t.tc||l;return t.selected?c||e:u||(c?e:s.addOpacity(e,p))},e},v.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=v.makeSelectedPointStyleFns(e),a=e.marker||{},i=[];r.selectedOpacityFn&&i.push((function(t,e){t.style("opacity",r.selectedOpacityFn(e))})),r.selectedColorFn&&i.push((function(t,e){s.fill(t,r.selectedColorFn(e))})),r.selectedSizeFn&&i.push((function(t,e){var n=e.mx||a.symbol||0,i=r.selectedSizeFn(e);t.attr("d",b(v.symbolNumber(n),i)),e.mrc2=i})),i.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 a;if(e.selectedpoints){var i=v.makeSelectedTextStyleFns(e);a=i.selectedTextColorFn}var o=e.texttemplate,s=r._fullLayout;t.each((function(t){var i=n.select(this),l=o?c.extractOption(t,e,"txt","texttemplate"):c.extractOption(t,e,"tx","text");if(l||0===l){if(o){var h=e._module.formatLabels?e._module.formatLabels(t,e,s):{},f={};m(f,e,t.i);var p=e._meta||{};l=c.texttemplateString(l,h,s._d3locale,f,t,p)}var d=t.tp||e.textposition,g=S(t,e),y=a?a(t):t.tc||e.textfont.color;i.call(v.font,t.tf||e.textfont.family,g,y).text(l).call(u.convertToTspans,r).call(A,d,g,t.mrc)}else i.remove()}))}},v.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=v.makeSelectedTextStyleFns(e);t.each((function(t){var a=n.select(this),i=r.selectedTextColorFn(t),o=t.tp||e.textposition,l=S(t,e);s.fill(a,i),A(a,o,l,t.mrc2||t.mrc)}))}};function E(t,e,r,a){var i=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],c=Math.pow(i*i+o*o,.25),u=Math.pow(s*s+l*l,.25),h=(u*u*i-c*c*s)*a,f=(u*u*o-c*c*l)*a,p=3*u*(c+u),d=3*c*(c+u);return[[n.round(e[0]+(p&&h/p),2),n.round(e[1]+(p&&f/p),2)],[n.round(e[0]-(d&&h/d),2),n.round(e[1]-(d&&f/d),2)]]}v.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(v.savedBBoxes={},P=0),r&&(v.savedBBoxes[r]=m),P++,c.extendFlat({},m)},v.setClipUrl=function(t,e,r){t.attr("clip-path",z(e,r))},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",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i=(i+=" translate("+e+", "+r+")").trim(),t[a]("transform",i),i},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",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i=(i+=" scale("+e+", "+r+")").trim(),t[a]("transform",i),i};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 D=/translate\([^)]*\)\s*$/;v.setTextPointsScale=function(t,e,r){t&&t.each((function(){var t,a=n.select(this),i=a.select("text");if(i.node()){var o=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(a.attr("transform")||"").match(D);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),a.attr("transform",t.join(" "))}}))}},{"../../components/fx/helpers":651,"../../constants/alignment":717,"../../constants/interactions":723,"../../constants/xmlns_namespaces":725,"../../lib":749,"../../lib/svg_text_utils":773,"../../registry":880,"../../traces/scatter/make_bubble_size_func":1172,"../../traces/scatter/subtypes":1179,"../color":615,"../colorscale":627,"./symbol_defs":638,d3:169,"fast-isnumeric":241,tinycolor2:548}],638:[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,a="l"+e+",-"+e,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+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),a=n.round(-t,2),i=n.round(-.309*t,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"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),a=n.round(.951*e,2),i=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+l+"H"+a+"L"+i+","+c+"L"+o+","+u+"L0,"+n.round(.382*e,2)+"L-"+o+","+u+"L-"+i+","+c+"L-"+a+","+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),a=n.round(.76*t,2);return"M-"+a+",0l-"+r+",-"+e+"h"+a+"l"+r+",-"+e+"l"+r+","+e+"h"+a+"l-"+r+","+e+"l"+r+","+e+"h-"+a+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+a+"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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+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),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+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),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+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),a=n.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"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),a=n.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"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),a=n.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+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),a=n.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:169}],639:[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"}}}},{}],640:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../registry"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),s=t("./compute_error");function l(t,e,r,a){var l=e["error_"+a]||{},c=[];if(l.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=s(l),h=0;h0;e.each((function(e){var h,f=e[0].trace,p=f.error_x||{},d=f.error_y||{};f.ids&&(h=function(t){return t.id});var g=o.hasMarkers(f)&&f.marker.maxdisplayed>0;d.visible||p.visible||(e=[]);var m=n.select(this).selectAll("g.errorbar").data(e,h);if(m.exit().remove(),e.length){p.visible||m.selectAll("path.xerror").remove(),d.visible||m.selectAll("path.yerror").remove(),m.style("opacity",1);var v=m.enter().append("g").classed("errorbar",!0);u&&v.style("opacity",0).transition().duration(s.duration).style("opacity",1),i.setClipUrl(m,r.layerClipId,t),m.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),a(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),a(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0)));return n}(t,l,c);if(!g||t.vis){var i,o=e.select("path.yerror");if(d.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var h=d.width;i="M"+(r.x-h)+","+r.yh+"h"+2*h+"m-"+h+",0V"+r.ys,r.noYS||(i+="m-"+h+",0h"+2*h),!o.size()?o=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(o=o.transition().duration(s.duration).ease(s.easing)),o.attr("d",i)}else o.remove();var f=e.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var m=(p.copy_ystyle?d:p).width;i="M"+r.xh+","+(r.y-m)+"v"+2*m+"m0,-"+m+"H"+r.xs,r.noXS||(i+="m0,-"+m+"v"+2*m),!f.size()?f=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(f=f.transition().duration(s.duration).ease(s.easing)),f.attr("d",i)}else f.remove()}}))}}))}},{"../../traces/scatter/subtypes":1179,"../drawing":637,d3:169,"fast-isnumeric":241}],645:[function(t,e,r){"use strict";var n=t("d3"),a=t("../color");e.exports=function(t){t.each((function(t){var e=t[0].trace,r=e.error_y||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)}))}},{"../color":615,d3:169}],646:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("./layout_attributes").hoverlabel,i=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:i({},a.bgcolor,{arrayOk:!0}),bordercolor:i({},a.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:i({},a.align,{arrayOk:!0}),namelength:i({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":739,"../../plots/font_attributes":825,"./layout_attributes":656}],647:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry");function i(t,e,r,a){a=a||n.identity,Array.isArray(t)&&(e[0][r]=a(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.indexb[0]._length||tt<0||tt>w[0]._length)return f.unhoverRaw(t,e)}if(e.pointerX=$+b[0]._offset,e.pointerY=tt+w[0]._offset,O="xval"in e?g.flat(l,e.xval):g.p2c(b,$),D="yval"in e?g.flat(l,e.yval):g.p2c(w,tt),!a(O[0])||!a(D[0]))return o.warn("Fx.hover failed",e,t),f.unhoverRaw(t,e)}var rt=1/0;function nt(t,r){for(F=0;FY&&(X.splice(0,Y),rt=X[0].distance),v&&0!==Z&&0===X.length){G.distance=Z,G.index=!1;var f=N._module.hoverPoints(G,q,H,"closest",u._hoverlayer);if(f&&(f=f.filter((function(t){return t.spikeDistance<=Z}))),f&&f.length){var p,d=f.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(d.length){var m=d[0];a(m.x0)&&a(m.y0)&&(p=it(m),(!K.vLinePoint||K.vLinePoint.spikeDistance>p.spikeDistance)&&(K.vLinePoint=p))}var y=f.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(y.length){var x=y[0];a(x.x0)&&a(x.y0)&&(p=it(x),(!K.hLinePoint||K.hLinePoint.spikeDistance>p.spikeDistance)&&(K.hLinePoint=p))}}}}}function at(t,e){for(var r,n=null,a=1/0,i=0;i1||X.length>1)||"closest"===C&&Q&&X.length>1,Mt=h.combine(u.plot_bgcolor||h.background,u.paper_bgcolor),At={hovermode:C,rotateLabels:kt,bgColor:Mt,container:u._hoverlayer,outerContainer:u._paperdiv,commonLabelOpts:u.hoverlabel,hoverdistance:u.hoverdistance},St=E(X,At,t);g.isUnifiedHover(C)||(!function(t,e,r){var n,a,i,o,s,l,c,u=0,h=1,f=t.size(),p=new Array(f),d=0;function g(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=i;n=!1}if(n){var c=0;for(o=0;oe.pmax&&c++;for(o=t.length-1;o>=0&&!(c<=0);o--)(l=t[o]).pos>e.pmax-1&&(l.del=!0,c--);for(o=0;o=0;s--)t[s].dp-=i;for(o=t.length-1;o>=0&&!(c<=0);o--)(l=t[o]).pos+l.dp+l.size>e.pmax&&(l.del=!0,c--)}}}t.each((function(t){var n=t[e],a="x"===n._id.charAt(0),i=n.range;0===d&&i&&i[0]>i[1]!==a&&(h=-1),p[d++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(a?_:1)/2,pmin:0,pmax:a?r.width:r.height}]})),p.sort((function(t,e){return t[0].posref-e[0].posref||h*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&u<=f;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(s=v.length-1;s>=0;s--)v[s].dp+=a;for(m.push.apply(m,v),p.splice(o+1,1),c=0,s=m.length-1;s>=0;s--)c+=m[s].dp;for(i=c/m.length,s=m.length-1;s>=0;s--)m[s].dp-=i;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(s=b.length-1;s>=0;s--){var w=b[s],T=w.datum;T.offset=w.dp,T.del=w.del}}}(St,kt?"xa":"ya",u),L(St,kt));if(e.target&&e.target.tagName){var Et=d.getComponentMethod("annotations","hasClickToShow")(t,bt);c(n.select(e.target),Et?"pointer":"")}if(!e.target||i||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)||String(a.pointNumbers)!==String(i.pointNumbers))return!0}return!1}(t,0,xt))return;xt&&t.emit("plotly_unhover",{event:e,points:xt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:b,yaxes:w,xvals:O,yvals:D})}(t,e,r,i)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var a=t.map((function(t){return{color:t.color||h.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,nameLength:t.nameLength,textAlign:t.textAlign,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),o=e.outerContainer?n.select(e.outerContainer):i,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||h.background,container:i,outerContainer:o},l=E(a,s,e.gd),c=0,u=0;return l.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function E(t,e,r){var a=r._fullLayout,i=e.hovermode,s=e.rotateLabels,c=e.bgColor,f=e.container,p=e.outerContainer,d=e.commonLabelOpts||{},b=e.fontFamily||m.HOVERFONT,_=e.fontSize||m.HOVERFONTSIZE,w=t[0],T=w.xa,S=w.ya,E="y"===i.charAt(0)?"yLabel":"xLabel",L=w[E],P=(String(L)||"").split(" ")[0],I=p.node().getBoundingClientRect(),z=I.top,O=I.width,D=I.height,R=void 0!==L&&w.distance<=e.hoverdistance&&("x"===i||"y"===i);if(R){var F,B,N=!0;for(F=0;Fa.width-E?(v=a.width-E,s.attr("d","M"+(E-k)+",0L"+E+","+A+k+"v"+A+(2*M+x.height)+"H-"+E+"V"+A+k+"H"+(E-2*k)+"Z")):s.attr("d","M0,0L"+k+","+A+k+"H"+(M+x.width/2)+"v"+A+(2*M+x.height)+"H-"+(M+x.width/2)+"V"+A+k+"H-"+k+"Z")}else{var C,P,I;"right"===S.side?(C="start",P=1,I="",v=T._offset+T._length):(C="end",P=-1,I="-",v=T._offset),y=S._offset+(w.y0+w.y1)/2,c.attr("text-anchor",C),s.attr("d","M0,0L"+I+k+","+k+"V"+(M+x.height/2)+"h"+I+(2*M+x.width)+"V-"+(M+x.height/2)+"H"+I+k+"V-"+k+"Z");var O,D=x.height/2,R=z-x.top-D,F="clip"+a._uid+"commonlabel"+S._id;if(v=0?$-=rt:$+=2*M;var nt=et.height+2*M,at=Q+nt>=D;return nt<=D&&(Q<=z?Q=S._offset+2*M:at&&(Q=D-nt)),tt.attr("transform","translate("+$+","+Q+")"),tt}var it=f.selectAll("g.hovertext").data(t,(function(t){return A(t)}));return it.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(h.fill,h.addOpacity(c,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(u.font,b,_)})),it.exit().remove(),it.each((function(t){var e=n.select(this).attr("transform",""),o=t.bgcolor||t.color,f=h.combine(h.opacity(o)?o:h.defaultLine,c),p=h.combine(h.opacity(t.color)?t.color:h.defaultLine,c),d=t.borderColor||h.contrast(f),g=C(t,R,i,a,L,e),m=g[0],v=g[1],y=e.select("text.nums").call(u.font,t.fontFamily||b,t.fontSize||_,t.fontColor||d).text(m).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),w=e.select("text.name"),T=0,A=0;if(v&&v!==m){w.call(u.font,t.fontFamily||b,t.fontSize||_,p).text(v).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r);var S=w.node().getBoundingClientRect();T=S.width+2*M,A=S.height+2*M}else w.remove(),e.select("rect").remove();e.select("path").style({fill:f,stroke:d});var E,P,I=y.node().getBoundingClientRect(),F=t.xa._offset+(t.x0+t.x1)/2,B=t.ya._offset+(t.y0+t.y1)/2,N=Math.abs(t.x1-t.x0),j=Math.abs(t.y1-t.y0),U=I.width+k+M+T;if(t.ty0=z-I.top,t.bx=I.width+2*M,t.by=Math.max(I.height+2*M,A),t.anchor="start",t.txwidth=I.width,t.tx2width=T,t.offset=0,s)t.pos=F,E=B+j/2+U<=D,P=B-j/2-U>=0,"top"!==t.idealAlign&&E||!P?E?(B+=j/2,t.anchor="start"):t.anchor="middle":(B-=j/2,t.anchor="end");else if(t.pos=B,E=F+N/2+U<=O,P=F-N/2-U>=0,"left"!==t.idealAlign&&E||!P)if(E)F+=N/2,t.anchor="start";else{t.anchor="middle";var V=U/2,q=F+V-O,H=F-V;q>0&&(F-=q),H<0&&(F+=-H)}else F-=N/2,t.anchor="end";y.attr("text-anchor",t.anchor),T&&w.attr("text-anchor",t.anchor),e.attr("transform","translate("+F+","+B+")"+(s?"rotate("+x+")":""))})),it}function C(t,e,r,n,a,i){var s="",l="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),s=O(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(l+=(l?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===a?l=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(l+=(l?"
":"")+t.text),void 0!==t.extraText&&(l+=(l?"
":"")+t.extraText),i&&""===l&&!t.hovertemplate&&(""===s&&i.remove(),l=s);var c=n._d3locale,u=t.hovertemplate||!1,h=t.hovertemplateLabels||t,f=t.eventData[0]||{};return u&&(l=(l=o.hovertemplateString(u,h,c,f,t.trace._meta)).replace(S,(function(e,r){return s=O(r,t.nameLength),""}))),[l,s]}function L(t,e){t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var a=r.select("text.nums"),i=t.anchor,o="end"===i?-1:1,s={start:1,end:-1,middle:0}[i],c=s*(k+M),h=c+s*(t.txwidth+M),f=0,p=t.offset;"middle"===i&&(c-=t.tx2width/2,h+=t.txwidth/2+M),e&&(p*=-T,f=t.offset*w),r.select("path").attr("d","middle"===i?"M-"+(t.bx/2+t.tx2width/2)+","+(p-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(o*k+f)+","+(k+p)+"v"+(t.by/2-k)+"h"+o*t.bx+"v-"+t.by+"H"+(o*k+f)+"V"+(p-k)+"Z");var d=c+f,g=p+t.ty0-t.by/2+M,m=t.textAlign||"auto";"auto"!==m&&("left"===m&&"start"!==i?(a.attr("text-anchor","start"),d="middle"===i?-t.bx/2-t.tx2width/2+M:-t.bx-M):"right"===m&&"end"!==i&&(a.attr("text-anchor","end"),d="middle"===i?t.bx/2-t.tx2width/2-M:t.bx+M)),a.call(l.positionText,d,g),t.tx2width&&(r.select("text.name").call(l.positionText,h+s*M+f,p+t.ty0-t.by/2+M),r.select("rect").call(u.setRect,h+(s-1)*t.tx2width/2+f,p-t.by/2-1,t.tx2width,t.by+2))}))}function P(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],s=t.cd[r]||{};function l(t){return t||a(t)&&0===t}var c=Array.isArray(r)?function(t,e){var a=o.castOption(i,r,t);return l(a)?a:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(s,n,t,e)};function u(e,r,n){var a=c(r,n);l(a)&&(t[e]=a)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),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:p.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:p.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 h=p.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+h+" / -"+p.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+h,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var f=p.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+f+" / -"+p.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+f,"y"===e&&(t.distance+=1)}var d=t.hoverinfo||t.trace.hoverinfo;return d&&"all"!==d&&(-1===(d=Array.isArray(d)?d:d.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===d.indexOf("y")&&(t.yLabel=void 0),-1===d.indexOf("z")&&(t.zLabel=void 0),-1===d.indexOf("text")&&(t.text=void 0),-1===d.indexOf("name")&&(t.name=void 0)),t}function I(t,e,r){var n,a,o=r.container,s=r.fullLayout,l=s._size,c=r.event,f=!!e.hLinePoint,d=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),d||f){var g=h.combine(s.plot_bgcolor,s.paper_bgcolor);if(f){var m,v,y=e.hLinePoint;n=y&&y.xa,"cursor"===(a=y&&y.ya).spikesnap?(m=c.pointerX,v=c.pointerY):(m=n._offset+y.x,v=a._offset+y.y);var x,b,_=i.readability(y.color,g)<1.5?h.contrast(g):y.color,w=a.spikemode,T=a.spikethickness,k=a.spikecolor||_,M=p.getPxPosition(t,a);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=m),-1!==w.indexOf("across")){var A=a._counterDomainMin,S=a._counterDomainMax;"free"===a.anchor&&(A=Math.min(A,a.position),S=Math.max(S,a.position)),x=l.l+A*l.w,b=l.l+S*l.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:v,y2:v,"stroke-width":T,stroke:k,"stroke-dasharray":u.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:v,y2:v,"stroke-width":T+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==a.side?T:-T),cy:v,r:T,fill:k}).classed("spikeline",!0)}if(d){var E,C,L=e.vLinePoint;n=L&&L.xa,a=L&&L.ya,"cursor"===n.spikesnap?(E=c.pointerX,C=c.pointerY):(E=n._offset+L.x,C=a._offset+L.y);var P,I,z=i.readability(L.color,g)<1.5?h.contrast(g):L.color,O=n.spikemode,D=n.spikethickness,R=n.spikecolor||z,F=p.getPxPosition(t,n);if(-1!==O.indexOf("toaxis")||-1!==O.indexOf("across")){if(-1!==O.indexOf("toaxis")&&(P=F,I=C),-1!==O.indexOf("across")){var B=n._counterDomainMin,N=n._counterDomainMax;"free"===n.anchor&&(B=Math.min(B,n.position),N=Math.max(N,n.position)),P=l.t+(1-N)*l.h,I=l.t+(1-B)*l.h}o.insert("line",":first-child").attr({x1:E,x2:E,y1:P,y2:I,"stroke-width":D,stroke:R,"stroke-dasharray":u.dashStyle(n.spikedash,D)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:E,x2:E,y1:P,y2:I,"stroke-width":D+2,stroke:g}).classed("spikeline",!0).classed("crisp",!0)}-1!==O.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:E,cy:F-("top"!==n.side?D:-D),r:D,fill:R}).classed("spikeline",!0)}}}function z(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function O(t,e){return l.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":749,"../../lib/events":738,"../../lib/override_cursor":760,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"../legend/defaults":667,"../legend/draw":668,"./constants":649,"./helpers":651,d3:169,"fast-isnumeric":241,tinycolor2:548}],653:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),i=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function s(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&i(e.hovermode)&&(o.font||(o.font={}),s("size"),s("family"),s("color"),e.legend?(o.bgcolor||(o.bgcolor=a.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":749,"../color":615,"./helpers":651}],654:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function i(r,i){return void 0!==e[r]?e[r]:n.coerce(t,e,a,r,i)}var o,s=i("clickmode");return e._has("cartesian")?s.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!f&&!p&&!d)"independent"===k("pattern")&&(f=!0);m._hasSubplotGrid=f;var x,b,_="top to bottom"===k("roworder"),w=f?.2:.1,T=f?.3:.1;g&&e._splomGridDflt&&(x=e._splomGridDflt.xside,b=e._splomGridDflt.yside),m._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,v,_)}}else delete e.grid}function k(t,e){return n.coerce(r,m,l,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,a,i,o,s,l,u,f=t.grid||{},p=e._subplots,d=r._hasSubplotGrid,g=r.rows,m=r.columns,v="independent"===r.pattern,y=r._axisMap={};if(d){var x=f.subplots||[];l=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var m=i.newContainer(e,"legend");if(_("uirevision",e.uirevision),!1!==g){_("bgcolor",e.paper_bgcolor),_("bordercolor"),_("borderwidth"),a.coerceFont(_,"font",e.font);var v,y,x,b=_("orientation");"h"===b?(v=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(v=1.02,y=1,x="auto"),_("traceorder",f),l.isGrouped(e.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemclick"),_("itemdoubleclick"),_("x",v),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),a.noneOrAll(c,m,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),a.coerceFont(_,"title.font",e.font))}}function _(t,e){return a.coerce(c,m,o,t,e)}}},{"../../lib":749,"../../plot_api/plot_template":787,"../../plots/layout_attributes":851,"../../registry":880,"./attributes":665,"./helpers":671}],668:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib/events"),l=t("../dragelement"),c=t("../drawing"),u=t("../color"),h=t("../../lib/svg_text_utils"),f=t("./handle_click"),p=t("./constants"),d=t("../../constants/alignment"),g=d.LINE_SPACING,m=d.FROM_TL,v=d.FROM_BR,y=t("./get_legend_data"),x=t("./style"),b=t("./helpers");function _(t,e,r,n,a){var i=r.data()[0][0].trace,l={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(i._group&&(l.group=i._group),o.traceIs(i,"pie-like")&&(l.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",l))if(1===n)e._clickTimeout=setTimeout((function(){f(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",l)&&f(r,t,n)}}function w(t,e,r){var n,i=t.data()[0][0],s=i.trace,l=o.traceIs(s,"pie-like"),u=s.index,f=r._main&&e._context.edits.legendText&&!l,d=r._maxNameLength;r.entries?n=i.text:(n=l?i.label:s.name,s._meta&&(n=a.templateString(n,s._meta)));var g=a.ensureSingle(t,"text","legendtext");g.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,r.font).text(f?T(n,d):n),h.positionText(g,p.textGap,0),f?g.call(h.makeEditable,{gd:e,text:n}).call(M,t,e,r).on("edit",(function(n){this.text(T(n,d)).call(M,t,e,r);var s=i.trace._fullInput||{},l={};if(o.hasTransform(s,"groupby")){var c=o.getTransformIndices(s,"groupby"),h=c[c.length-1],f=a.keyedContainer(s,"transforms["+h+"].styles","target","value.name");f.set(i.trace._group,n),l=f.constructUpdate()}else l.name=n;return o.call("_guiRestyle",e,l,u)})):M(g,t,e,r)}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,i=e._context.doubleClickDelay,o=1,s=a.ensureSingle(t,"rect","legendtoggle",(function(t){t.style("cursor","pointer").attr("pointer-events","all").call(u.fill,"rgba(0,0,0,0)")}));s.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimei&&(o=Math.max(o-1,1)),_(e,r,t,o,n.event)}}))}function M(t,e,r,n){n._main||t.attr("data-notex",!0),h.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var a=t.select("g[class*=math-group]"),i=a.node();r||(r=e._fullLayout.legend);var o,s,l=r.borderwidth,u=(n?r:r.title).font.size*g;if(i){var f=c.bBox(i);o=f.height,s=f.width,n?c.setTranslate(a,0,.25*o):c.setTranslate(a,l,.75*o+l)}else{var d=t.select(n?".legendtext":".legendtitletext"),m=h.lineCount(d),v=d.node();o=u*m,s=v?c.bBox(v).width:0;var y=u*((m-1)/2-.3);n?h.positionText(d,p.textGap,-y):h.positionText(d,p.titlePad+l,u+l)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=s):(r._titleWidth=s,r._titleHeight=o)}(e,r,n)}))}function A(t){return a.isRightAnchor(t)?"right":a.isCenterAnchor(t)?"center":"left"}function S(t){return a.isBottomAnchor(t)?"bottom":a.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,s=t._fullLayout,h="legend"+s._uid;if(e?(r=e.layer,h+="-hover"):((e=s.legend||{})._main=!0,r=s._infolayer),r){var f;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;f=s.showlegend&&y(t.calcdata,e)}else{if(!e.entries)return;f=y(e.entries,e)}var d=s.hiddenlabels||[];if(e._main&&(!s.showlegend||!f.length))return r.selectAll(".legend").remove(),s._topdefs.select("#"+h).remove(),i.autoMargin(t,"legend");var g=a.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),T=a.ensureSingleById(s._topdefs,"clipPath",h,(function(t){t.append("rect")})),E=a.ensureSingle(g,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));E.call(u.stroke,e.bordercolor).call(u.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var C=a.ensureSingle(g,"g","scrollbox"),L=e.title;if(e._titleWidth=0,e._titleHeight=0,L.text){var P=a.ensureSingle(C,"text","legendtitletext");P.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,L.font).text(L.text),M(P,C,t,e)}else C.selectAll(".legendtitletext").remove();var I=a.ensureSingle(g,"rect","scrollbar",(function(t){t.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),z=C.selectAll("g.groups").data(f);z.enter().append("g").attr("class","groups"),z.exit().remove();var O=z.selectAll("g.traces").data(a.identity);O.enter().append("g").attr("class","traces"),O.exit().remove(),O.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==d.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(x,t,e).each((function(){e._main&&n.select(this).call(k,t)})),a.syncOrAsync([i.previousPromises,function(){return function(t,e,r,a){var i=t._fullLayout;a||(a=i.legend);var o=i._size,s=b.isVertical(a),l=b.isGrouped(a),u=a.borderwidth,h=2*u,f=p.textGap,d=p.itemGap,g=2*(u+d),m=S(a),v=a.y<0||0===a.y&&"top"===m,y=a.y>1||1===a.y&&"bottom"===m;a._maxHeight=Math.max(v||y?i.height/2:o.h,30);var x=0;a._width=0,a._height=0;var _=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(a);if(s)r.each((function(t){var e=t[0].height;c.setTranslate(this,u+_[0],u+_[1]+a._height+e/2+d),a._height+=e,a._width=Math.max(a._width,t[0].width)})),x=f+a._width,a._width+=d+f+h,a._height+=g,l&&(e.each((function(t,e){c.setTranslate(this,0,e*a.tracegroupgap)})),a._height+=(a._lgroupsLength-1)*a.tracegroupgap);else{var w=A(a),T=a.x<0||0===a.x&&"right"===w,k=a.x>1||1===a.x&&"left"===w,M=y||v,E=i.width/2;a._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:E:k?M&&"right"===w?o.r+o.w:E:o.w,2*f);var C=0,L=0;r.each((function(t){var e=t[0].width+f;C=Math.max(C,e),L+=e})),x=null;var P=0;if(l){var I=0,z=0,O=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+d+n/2+e),e+=n,t=Math.max(t,f+r[0].width)})),I=Math.max(I,e);var r=t+d;r+u+z>a._maxWidth&&(P=Math.max(P,z),z=0,O+=I+a.tracegroupgap,I=e),c.setTranslate(this,z,O),z+=r})),a._width=Math.max(P,z)+u,a._height=O+I+g}else{var D=r.size(),R=L+h+(D-1)*da._maxWidth&&(P=Math.max(P,j),B=0,N+=F,a._height+=F,F=0),c.setTranslate(this,_[0]+u+B,_[1]+u+N+e/2+d),j=B+r+d,B+=n,F=Math.max(F,e)})),R?(a._width=B+h,a._height=F+g):(a._width=Math.max(P,j)+h,a._height+=F+g)}}a._width=Math.ceil(Math.max(a._width+_[0],a._titleWidth+2*(u+p.titlePad))),a._height=Math.ceil(Math.max(a._height+_[1],a._titleHeight+2*(u+p.itemGap))),a._effHeight=Math.min(a._height,a._maxHeight);var U=t._context.edits,V=U.legendText||U.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,a=V?f:x||f+t[0].width;s||(a+=d/2),c.setRect(e,0,-r/2,a,r)}))}(t,z,O,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=A(e),n=S(e);return i.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*m[r],r:e._width*v[r],b:e._effHeight*v[n],t:e._effHeight*m[n]})}(t)){var u,f,d,y,x=s._size,b=e.borderwidth,w=x.l+x.w*e.x-m[A(e)]*e._width,k=x.t+x.h*(1-e.y)-m[S(e)]*e._effHeight;if(e._main&&s.margin.autoexpand){var M=w,L=k;w=a.constrain(w,0,s.width-e._width),k=a.constrain(k,0,s.height-e._effHeight),w!==M&&a.log("Constrain legend.x to make legend fit inside graph"),k!==L&&a.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&c.setTranslate(g,w,k),I.on(".drag",null),g.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var P=e._effHeight;e._main||(P=e._height),E.attr({width:e._width-b,height:P-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:e._width-2*b,height:P-2*b,x:b,y:b}),c.setClipUrl(C,h,t),c.setRect(I,0,0,0,0),delete e._scrollY}else{var z,O,D,R=Math.max(p.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),F=e._effHeight-R-2*p.scrollBarMargin,B=e._height-e._effHeight,N=F/B,j=Math.min(e._scrollY||0,B);E.attr({width:e._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:e._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:e._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:e._effHeight-2*b,x:b,y:b+j}),c.setClipUrl(C,h,t),q(j,R,N),g.on("wheel",(function(){q(j=a.constrain(e._scrollY+n.event.deltaY/F*B,0,B),R,N),0!==j&&j!==B&&n.event.preventDefault()}));var U=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;z="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,D=j})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(O="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,q(j=function(t,e,r){var n=(r-e)/N+t;return a.constrain(n,0,B)}(D,z,O),R,N))}));I.call(U);var V=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(z=t.changedTouches[0].clientY,D=j)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(O=t.changedTouches[0].clientY,q(j=function(t,e,r){var n=(e-r)/N+t;return a.constrain(n,0,B)}(D,z,O),R,N))}));C.call(V)}if(t._context.edits.legendPosition)g.classed("cursor-move",!0),l.init({element:g.node(),gd:t,prepFn:function(){var t=c.getTranslate(g);d=t.x,y=t.y},moveFn:function(t,r){var n=d+t,a=y+r;c.setTranslate(g,n,a),u=l.align(n,0,x.l,x.l+x.w,e.xanchor),f=l.align(a,0,x.t+x.h,x.t,e.yanchor)},doneFn:function(){void 0!==u&&void 0!==f&&o.call("_guiRelayout",t,{"legend.x":u,"legend.y":f})},clickFn:function(e,n){var a=r.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}));a.size()>0&&_(t,g,a,e,n)}})}function q(r,n,a){e._scrollY=t._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(I,e._width,p.scrollBarMargin+r*a,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],t)}}},{"../../constants/alignment":717,"../../lib":749,"../../lib/events":738,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../../registry":880,"../color":615,"../dragelement":634,"../drawing":637,"./constants":666,"./get_legend_data":669,"./handle_click":670,"./helpers":671,"./style":673,d3:169}],669:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){var r,i,o={},s=[],l=!1,c={},u=0,h=0,f=e._main;function p(t,r){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),l=!0,o[t]=[[r]]):o[t].push([r]);else{var n="~~i"+u;s.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;a=e.width}return d?n:Math.min(a,r)};function m(t,e,r){var i=t[0].trace,o=i.marker||{},l=o.line||{},c=r?i.visible&&i.type===r:a.traceIs(i,"bar"),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(c?[t]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),u.exit().remove(),u.each((function(t){var e=n.select(this),r=t[0],a=g(r.mlw,o.line,5,2);e.style("stroke-width",a+"px").call(s.fill,r.mc||o.color),a&&s.stroke(e,r.mlc||l.color)}))}function v(t,e,r){var o=t[0],s=o.trace,l=r?s.visible&&s.type===r:a.traceIs(s,r),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(l?[t]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),c.exit().remove(),c.size()){var f=(s.marker||{}).line,p=g(h(f.width,o.pts),f,5,2),d=i.minExtend(s,{marker:{line:{width:p}}});d.marker.line.color=f.color;var m=i.minExtend(o,{trace:d});u(c,m,d)}}t.each((function(t){var e=n.select(this),a=i.ensureSingle(e,"g","layers");a.style("opacity",t[0].trace.opacity);var o=r.valign,s=t[0].lineHeight,l=t[0].height;if("middle"!==o&&s&&l){var c={top:1,bottom:-1}[o]*(.5*(s-l+3));a.attr("transform","translate(0,"+c+")")}else a.attr("transform",null);a.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),a.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var u=a.selectAll("g.legendsymbols").data([t]);u.enter().append("g").classed("legendsymbols",!0),u.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,a=t[0].trace,c=[];if(a.visible)switch(a.type){case"histogram2d":case"heatmap":c=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":c=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":c=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":c=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":c=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":c=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":c=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(c);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),u.exit().remove(),u.each((function(t,c){var u,h=n.select(this),p=l(a),d=p.colorscale,g=p.reversescale;if(d){if(!r){var m=d.length;u=0===c?d[g?m-1:0][1]:1===c?d[g?0:m-1][1]:d[Math.floor((m-1)/2)][1]}}else{var v=a.vertexcolor||a.facecolor||a.color;u=i.isArrayOrTypedArray(v)?v[c]||v[0]:v}h.attr("d",t[0]),u?h.call(s.fill,u):h.call((function(t){if(t.size()){var n="legendfill-"+a.uid;o.gradient(t,e,n,f(g,"radial"===r),d,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var a=t[0].trace[t[0].dir].marker;return t[0].mc=a.color,t[0].mlw=a.line.width,t[0].mlc=a.line.color,m(t,this,"waterfall")}var i=[];e.visible&&r&&(i=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(i);o.enter().append("path").classed("legendwaterfall",!0).attr("transform","translate(20,0)").style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),a=e[t[0]].marker,i=g(void 0,a.line,5,2);r.attr("d",t[1]).style("stroke-width",i+"px").call(s.fill,a.color),i&&r.call(s.stroke,a.line.color)}))})).each((function(t){m(t,this,"funnel")})).each((function(t){m(t,this)})).each((function(t){var r=t[0].trace,l=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&a.traceIs(r,"box-violin")?[t]:[]);l.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),l.exit().remove(),l.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==s.opacity(r.fillcolor)||0!==s.opacity((r.line||{}).color)){var a=g(void 0,r.line,5,2);t.style("stroke-width",a+"px").call(s.fill,r.fillcolor),a&&s.stroke(t,r.line.color)}else{var c=i.minExtend(r,{marker:{size:d?12:i.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});l.call(o.pointStyle,c,e)}}))})).each((function(t){v(t,this,"funnelarea")})).each((function(t){v(t,this,"pie")})).each((function(t){var r,a,s=t[0],u=s.trace,h=u.visible&&u.fill&&"none"!==u.fill,p=c.hasLines(u),d=u.contours,m=!1,v=!1,y=l(u),x=y.colorscale,b=y.reversescale;if(d){var _=d.coloring;"lines"===_?m=!0:p="none"===_||"heatmap"===_||d.showlines,"constraint"===d.type?h="="!==d._operation:"fill"!==_&&"heatmap"!==_||(v=!0)}var w=c.hasMarkers(u)||c.hasText(u),T=h||v,k=p||m,M=w||!T?"M5,0":k?"M5,-2":"M5,-3",A=n.select(this),S=A.select(".legendfill").selectAll("path").data(h||v?[t]:[]);if(S.enter().append("path").classed("js-fill",!0),S.exit().remove(),S.attr("d",M+"h30v6h-30z").call(h?o.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+u.uid;o.gradient(t,e,r,f(b),x,"fill")}}),p||m){var E=g(void 0,u.line,10,5);a=i.minExtend(u,{line:{width:E}}),r=[i.minExtend(s,{trace:a})]}var C=A.select(".legendlines").selectAll("path").data(p||m?[r]:[]);C.enter().append("path").classed("js-line",!0),C.exit().remove(),C.attr("d",M+(m?"l30,0.0001":"h30")).call(p?o.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+u.uid;o.lineGroupStyle(t),o.gradient(t,e,r,f(b),x,"stroke")}})})).each((function(t){var r,a,s=t[0],l=s.trace,u=c.hasMarkers(l),h=c.hasText(l),f=c.hasLines(l);function p(t,e,r,n){var a=i.nestedProperty(l,t).get(),o=i.isArrayOrTypedArray(a)&&e?e(a):a;if(d&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function g(t){return s._distinct&&s.index&&t[s.index]?t[s.index]:t[0]}if(u||h||f){var m={},v={};if(u){m.mc=p("marker.color",g),m.mx=p("marker.symbol",g),m.mo=p("marker.opacity",i.mean,[.2,1]),m.mlc=p("marker.line.color",g),m.mlw=p("marker.line.width",i.mean,[0,5],2),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",i.mean,[2,16],12);m.ms=y,v.marker.size=y}f&&(v.line={width:p("line.width",g,[0,10],5)}),h&&(m.tx="Aa",m.tp=p("textposition",g),m.ts=10,m.tc=p("textfont.color",g),m.tf=p("textfont.family",g)),r=[i.minExtend(s,m)],(a=i.minExtend(l,v)).selectedpoints=null,a.texttemplate=null}var x=n.select(this).select("g.legendpoints"),b=x.selectAll("path.scatterpts").data(u?r:[]);b.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform","translate(20,0)"),b.exit().remove(),b.call(o.pointStyle,a,e),u&&(r[0].mrc=3);var _=x.selectAll("g.pointtext").data(h?r:[]);_.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),_.exit().remove(),_.selectAll("text").call(o.textPointStyle,a,e)})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.visible&&"candlestick"===e.type?[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 a=n.select(this),i=e[r?"increasing":"decreasing"],o=g(void 0,i.line,5,2);a.style("stroke-width",o+"px").call(s.fill,i.fillcolor),o&&s.stroke(a,i.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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 a=n.select(this),i=e[r?"increasing":"decreasing"],l=g(void 0,i.line,5,2);a.style("fill","none").call(o.dashLine,i.line.dash,l),l&&s.stroke(a,i.line.color)}))}))}},{"../../lib":749,"../../registry":880,"../../traces/pie/helpers":1134,"../../traces/pie/style_one":1140,"../../traces/scatter/subtypes":1179,"../color":615,"../colorscale/helpers":626,"../drawing":637,d3:169}],674:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/plots"),i=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),s=t("../shapes/draw").eraseActiveShape,l=t("../../lib"),c=l._,u=e.exports={};function h(t,e){var r,a,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,c=t._fullLayout,u={},h=i.list(t,null,!0),f=c._cartesianSpikesEnabled;if("zoom"===s){var p,d="in"===l?.5:2,g=(1+d)/2,m=(1-d)/2;for(a=0;a1?(E=["toggleHover"],C=["resetViews"]):d?(S=["zoomInGeo","zoomOutGeo"],E=["hoverClosestGeo"],C=["resetGeo"]):p?(E=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(S=["zoomInMapbox","zoomOutMapbox"],E=["toggleHover"],C=["resetViewMapbox"]):v?E=["hoverClosestGl2d"]:g?E=["hoverClosestPie"]:_?(E=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):E=["toggleHover"];f&&(E=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var g=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),a=0,i=0;i=n.max)e=R[r+1];else if(t=n.pmax)e=R[r+1];else if(t0?f+c:c;return{ppad:c,ppadplus:u?d:g,ppadminus:u?g:d}}return{ppad:c}}function u(t,e,r,n,a){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,c,u,h,f=1/0,p=-1/0,d=n.match(i.segmentRE);for("date"===t.type&&(s=o.decodeDate(s)),l=0;lp&&(p=h)));return p>=f?[f,p]: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;oy?(k=h,E="y0",M=y,C="y1"):(k=y,E="y1",M=h,C="y0");W(n),J(s,r),function(t,e,r){var n=e.xref,a=e.yref,o=i.getFromId(r,n),s=i.getFromId(r,a),l="";"paper"===n||o.autorange||(l+=n);"paper"===a||s.autorange||(l+=a);u.setClipUrl(t,l?"clip"+r._fullLayout._uid+l:null,r)}(e,r,t),Y.moveFn="move"===z?Z:X,Y.altKey=n.altKey},doneFn:function(){if(v(t))return;p(e),K(s),b(e,t,r),n.call("_guiRelayout",t,l.getUpdateObj())},clickFn:function(){if(v(t))return;K(s)}};function W(r){if(v(t))z=null;else if(R)z="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=Y.element.getBoundingClientRect(),a=n.right-n.left,i=n.bottom-n.top,o=r.clientX-n.left,s=r.clientY-n.top,l=!F&&a>10&&i>10&&!r.shiftKey?f.getCursor(o/a,1-s/i):"move";p(e,l),z=l.split("-")[0]}}function Z(n,a){if("path"===r.type){var i=function(t){return t},o=i,l=i;O?B("xanchor",r.xanchor=q(x+n)):(o=function(t){return q(U(t)+n)},N&&"date"===N.type&&(o=g.encodeDate(o))),D?B("yanchor",r.yanchor=H(T+a)):(l=function(t){return H(V(t)+a)},j&&"date"===j.type&&(l=g.encodeDate(l))),B("path",r.path=w(I,o,l))}else O?B("xanchor",r.xanchor=q(x+n)):(B("x0",r.x0=q(c+n)),B("x1",r.x1=q(m+n))),D?B("yanchor",r.yanchor=H(T+a)):(B("y0",r.y0=H(h+a)),B("y1",r.y1=H(y+a)));e.attr("d",_(t,r)),J(s,r)}function X(n,a){if(F){var i=function(t){return t},o=i,l=i;O?B("xanchor",r.xanchor=q(x+n)):(o=function(t){return q(U(t)+n)},N&&"date"===N.type&&(o=g.encodeDate(o))),D?B("yanchor",r.yanchor=H(T+a)):(l=function(t){return H(V(t)+a)},j&&"date"===j.type&&(l=g.encodeDate(l))),B("path",r.path=w(I,o,l))}else if(R){if("resize-over-start-point"===z){var u=c+n,f=D?h-a:h+a;B("x0",r.x0=O?u:q(u)),B("y0",r.y0=D?f:H(f))}else if("resize-over-end-point"===z){var p=m+n,d=D?y-a:y+a;B("x1",r.x1=O?p:q(p)),B("y1",r.y1=D?d:H(d))}}else{var v=function(t){return-1!==z.indexOf(t)},b=v("n"),G=v("s"),Y=v("w"),W=v("e"),Z=b?k+a:k,X=G?M+a:M,K=Y?A+n:A,Q=W?S+n:S;D&&(b&&(Z=k-a),G&&(X=M-a)),(!D&&X-Z>10||D&&Z-X>10)&&(B(E,r[E]=D?Z:H(Z)),B(C,r[C]=D?X:H(X))),Q-K>10&&(B(L,r[L]=O?K:q(K)),B(P,r[P]=O?Q:q(Q)))}e.attr("d",_(t,r)),J(s,r)}function J(t,e){(O||D)&&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 i=U(O?e.xanchor:a.midRange(r?[e.x0,e.x1]:g.extractPathCoords(e.path,d.paramIsX))),o=V(D?e.yanchor:a.midRange(r?[e.y0,e.y1]:g.extractPathCoords(e.path,d.paramIsY)));if(i=g.roundPositionForSharpStrokeRendering(i,1),o=g.roundPositionForSharpStrokeRendering(o,1),O&&D){var s="M"+(i-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",s)}else if(O){var l="M"+(i-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",l)}else{var c="M"+(i-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function K(t){t.selectAll(".visual-cue").remove()}f.init(Y),G.node().onmousemove=W}(t,O,l,e,r,z):!0===l.editable&&O.style("pointer-events",P||c.opacity(S)*A<=.5?"stroke":"all");O.node().addEventListener("click",(function(){return function(t,e){if(!y(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void T(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=T,m(t)}}(t,O)}))}}function b(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"");u.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function _(t,e){var r,n,o,s,l,c,u,h,f=e.type,p=i.getFromId(t,e.xref),m=i.getFromId(t,e.yref),v=t._fullLayout._size;if(p?(r=g.shapePositionToRange(p),n=function(t){return p._offset+p.r2p(r(t,!0))}):n=function(t){return v.l+v.w*t},m?(o=g.shapePositionToRange(m),s=function(t){return m._offset+m.r2p(o(t,!0))}):s=function(t){return v.t+v.h*(1-t)},"path"===f)return p&&"date"===p.type&&(n=g.decodeDate(n)),m&&"date"===m.type&&(s=g.decodeDate(s)),function(t,e,r){var n=t.path,i=t.xsizemode,o=t.ysizemode,s=t.xanchor,l=t.yanchor;return n.replace(d.segmentRE,(function(t){var n=0,c=t.charAt(0),u=d.paramIsX[c],h=d.paramIsY[c],f=d.numParams[c],p=t.substr(1).replace(d.paramRE,(function(t){return u[n]?t="pixel"===i?e(s)+Number(t):e(t):h[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>f&&(t="X"),t}));return n>f&&(p=p.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+t)),c+p}))}(e,n,s);if("pixel"===e.xsizemode){var y=n(e.xanchor);l=y+e.x0,c=y+e.x1}else l=n(e.x0),c=n(e.x1);if("pixel"===e.ysizemode){var x=s(e.yanchor);u=x-e.y0,h=x-e.y1}else u=s(e.y0),h=s(e.y1);if("line"===f)return"M"+l+","+u+"L"+c+","+h;if("rect"===f)return"M"+l+","+u+"H"+c+"V"+h+"H"+l+"Z";var b=(l+c)/2,_=(u+h)/2,w=Math.abs(b-l),T=Math.abs(_-u),k="A"+w+","+T,M=b+w+","+_;return"M"+M+k+" 0 1,1 "+(b+","+(_-T))+k+" 0 0,1 "+M+"Z"}function w(t,e,r){return t.replace(d.segmentRE,(function(t){var n=0,a=t.charAt(0),i=d.paramIsX[a],o=d.paramIsY[a],s=d.numParams[a];return a+t.substr(1).replace(d.paramRE,(function(t){return n>=s||(i[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function T(t){y(t)&&(t._fullLayout._activeShapeIndex>=0&&(l(t),delete t._fullLayout._activeShapeIndex,m(t)))}e.exports={draw:m,drawOne:x,eraseActiveShape:function(t){if(!y(t))return;l(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&h(v),r.attr("d",g(e)),M&&!f)&&(k=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===T&&(t[0][0]="M"),e[w]=t,y(),x())}}()}}function I(t,r){!function(t,r){if(e.length)for(var n=0;n0&&l0&&(s=s.transition().duration(e.transition.duration).ease(e.transition.easing)),s.attr("transform","translate("+(o-.5*u.gripWidth)+","+e._dims.currentValueTotalHeight+")")}}function S(t,e){var r=t._dims;return r.inputAreaStart+u.stepInset+(r.inputAreaLength-2*u.stepInset)*Math.min(1,Math.max(0,e))}function E(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-u.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*u.stepInset-2*r.inputAreaStart)))}function C(t,e,r){var n=r._dims,a=s.ensureSingle(t,"rect",u.railTouchRectClass,(function(n){n.call(k,e,t,r).style("pointer-events","all")}));a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,u.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0),o.setTranslate(a,0,n.currentValueTotalHeight)}function L(t,e){var r=e._dims,n=r.inputAreaLength-2*u.railInset,a=s.ensureSingle(t,"rect",u.railRectClass);a.attr({width:n,height:u.railWidth,rx:u.railRadius,ry:u.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,e.bordercolor).call(i.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(a,u.railInset,.5*(r.inputAreaWidth-u.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[u.name],n=[],a=0;a0?[0]:[]);function s(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),a.autoMargin(t,g(e))}if(i.enter().append("g").classed(u.containerClassName,!0).style("cursor","ew-resize"),i.exit().each((function(){n.select(this).selectAll("g."+u.groupClassName).each(s)})).remove(),0!==r.length){var l=i.selectAll("g."+u.groupClassName).data(r,m);l.enter().append("g").classed(u.groupClassName,!0),l.exit().each(s).remove();for(var c=0;c0||h<0){var m={left:[-p,0],right:[p,0],top:[0,-p],bottom:[0,p]}[x.side];e.attr("transform","translate("+m+")")}}}return O.call(D),I&&(S?O.on(".opacity",null):(k=0,M=!0,O.text(v).on("mouseover.opacity",(function(){n.select(this).transition().duration(h.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(h.HIDE_PLACEHOLDER).style("opacity",0)}))),O.call(u.makeEditable,{gd:t}).on("edit",(function(e){void 0!==y?o.call("_guiRestyle",t,m,e,y):o.call("_guiRelayout",t,m,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(D)})).on("input",(function(t){this.text(t||" ").call(u.positionText,b.x,b.y)}))),O.classed("js-placeholder",M),w}}},{"../../constants/alignment":717,"../../constants/interactions":723,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../../registry":880,"../color":615,"../drawing":637,d3:169,"fast-isnumeric":241}],711:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll,s=t("../../plots/pad_attributes"),l=t("../../plot_api/plot_template").templatedArray,c=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"}]},args2:{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:c,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:i(s({editType:"arraydraw"}),{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/font_attributes":825,"../../plots/pad_attributes":859,"../color/attributes":614}],712:[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"}}},{}],713:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/array_container_defaults"),i=t("./attributes"),o=t("./constants").name,s=i.buttons;function l(t,e,r){function o(r,a){return n.coerce(t,e,i,r,a)}o("visible",a(t,e,{name:"buttons",handleItemDefaults:c}).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 c(t,e){function r(r,a){return n.coerce(t,e,s,r,a)}r("visible","skip"===t.method||Array.isArray(t.args))&&(r("method"),r("args"),r("args2"),r("label"),r("execute"))}e.exports=function(t,e){a(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":749,"../../plots/array_container_defaults":793,"./attributes":711,"./constants":712}],714:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=t("../color"),o=t("../drawing"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),c=t("../../plot_api/plot_template").arrayEditor,u=t("../../constants/alignment").LINE_SPACING,h=t("./constants"),f=t("./scrollbox");function p(t){return t._index}function d(t,e){return+t.attr(h.menuIndexAttrName)===e._index}function g(t,e,r,n,a,i,o,s){e.active=o,c(t.layout,h.name,e).applyUpdate("active",o),"buttons"===e.type?v(t,n,null,null,e):"dropdown"===e.type&&(a.attr(h.menuIndexAttrName,"-1"),m(t,n,a,i,e),s||v(t,n,a,i,e))}function m(t,e,r,n,a){var i=s.ensureSingle(e,"g",h.headerClassName,(function(t){t.style("pointer-events","all")})),l=a._dims,c=a.active,u=a.buttons[c]||h.blankHeaderOpts,f={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},p={width:l.headerWidth,height:l.headerHeight};i.call(y,a,u,t).call(A,a,f,p),s.ensureSingle(e,"text",h.headerArrowClassName,(function(t){t.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,a.font).text(h.arrowSymbol[a.direction])})).attr({x:l.headerWidth-h.arrowOffsetX+a.pad.l,y:l.headerHeight/2+h.textOffsetY+a.pad.t}),i.on("click",(function(){r.call(S,String(d(r,a)?-1:a._index)),v(t,e,r,n,a)})),i.on("mouseover",(function(){i.call(w)})),i.on("mouseout",(function(){i.call(T,a)})),o.setTranslate(e,l.lx,l.ly)}function v(t,e,r,i,o){r||(r=e).attr("pointer-events","all");var l=function(t){return-1==+t.attr(h.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,c="dropdown"===o.type?h.dropdownButtonClassName:h.buttonClassName,u=r.selectAll("g."+c).data(s.filterVisible(l)),f=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(f.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var d=0,m=0,v=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?m=v.headerHeight+h.gapButtonHeader:d=v.headerWidth+h.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(m=-h.gapButtonHeader+h.gapButton-v.openHeight),"dropdown"===o.type&&"left"===o.direction&&(d=-h.gapButtonHeader+h.gapButton-v.openWidth);var b={x:v.lx+d+o.pad.l,y:v.ly+m+o.pad.t,yPad:h.gapButton,xPad:h.gapButton,index:0},k={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(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(s.execute&&(s.args2&&o.active===l?(g(t,o,0,e,r,i,-1),a.executeAPICommand(t,s.method,s.args2)):(g(t,o,0,e,r,i,l),a.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(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(v.openWidth,v.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(v.openHeight,v.headerHeight)),k.direction=o.direction,i&&(u.size()?function(t,e,r,n,a,i){var o,s,l,c=a.direction,u="up"===c||"down"===c,f=a._dims,p=a.active;if(u)for(s=0,l=0;l0?[0]:[]);if(o.enter().append("g").classed(h.containerClassName,!0).style("cursor","pointer"),o.exit().each((function(){n.select(this).selectAll("g."+h.headerGroupClassName).each(i)})).remove(),0!==r.length){var l=o.selectAll("g."+h.headerGroupClassName).data(r,p);l.enter().append("g").classed(h.headerGroupClassName,!0);for(var c=s.ensureSingle(o,"g",h.dropdownButtonGroupClassName,(function(t){t.style("pointer-events","all")})),u=0;uw,M=s.barLength+2*s.barPad,A=s.barWidth+2*s.barPad,S=d,E=m+v;E+A>c&&(E=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,s.barColor),k?(this.hbar=C.attr({rx:s.barRadius,ry:s.barRadius,x:S,y:E,width:M,height:A}),this._hbarXMin=S+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var L=v>T,P=s.barWidth+2*s.barPad,I=s.barLength+2*s.barPad,z=d+g,O=m;z+P>l&&(z=l-P);var D=this.container.selectAll("rect.scrollbar-vertical").data(L?[0]:[]);D.exit().on(".drag",null).remove(),D.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,s.barColor),L?(this.vbar=D.attr({rx:s.barRadius,ry:s.barRadius,x:z,y:O,width:P,height:I}),this._vbarYMin=O+I/2,this._vbarTranslateMax=T-I):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,B=L?h+P+.5:h+.5,N=f-.5,j=k?p+A+.5:p+.5,U=o._topdefs.selectAll("#"+R).data(k||L?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",R).append("rect"),k||L?(this._clipRect=U.select("rect").attr({x:Math.floor(F),y:Math.floor(N),width:Math.ceil(B)-Math.floor(F),height:Math.ceil(j)-Math.floor(N)}),this.container.call(i.setClipUrl,R,this.gd),this.bg.attr({x:d,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),k||L){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 q=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),L&&this.vbar.on(".drag",null).call(q)}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(i.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,a=r+this._hbarTranslateMax;t=(o.constrain(n.event.x,r,a)-r)/(a-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,s=i+this._vbarTranslateMax;e=(o.constrain(n.event.y,i,s)-i)/(s-i)*(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(i.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 a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var s=e/n;this.vbar.call(i.setTranslate,t,e+s*this._vbarTranslateMax)}}},{"../../lib":749,"../color":615,"../drawing":637,d3:169}],717:[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"}}},{}],718:[function(t,e,r){"use strict";e.exports={INCREASING:{COLOR:"#3D9970",SYMBOL:"\u25b2"},DECREASING:{COLOR:"#FF4136",SYMBOL:"\u25bc"}}},{}],719:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],720:[function(t,e,r){"use strict";e.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],721:[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]}},{}],722:[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"}},{}],723:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],724:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],725:[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}},{}],726:[function(t,e,r){"use strict";r.version=t("./version").version,t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config")();for(var n=t("./registry"),a=r.register=n.register,i=t("./plot_api"),o=Object.keys(i),s=0;splotly-logomark"}}},{}],729:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],730:[function(t,e,r){"use strict";var n=t("./mod"),a=n.mod,i=n.modHalf,o=Math.PI,s=2*o;function l(t){return Math.abs(t[1]-t[0])>s-1e-14}function c(t,e){return i(e-t,s)}function u(t,e){if(l(e))return!0;var r,n;e[0](n=a(n,s))&&(n+=s);var i=a(t,s),o=i+s;return i>=r&&i<=n||o>=r&&o<=n}function h(t,e,r,n,a,i,c){a=a||0,i=i||0;var u,h,f,p,d,g=l([r,n]);function m(t,e){return[t*Math.cos(e)+a,i-t*Math.sin(e)]}g?(u=0,h=o,f=s):r=a&&t<=i);var a,i},pathArc:function(t,e,r,n,a){return h(null,t,e,r,n,a,0)},pathSector:function(t,e,r,n,a){return h(null,t,e,r,n,a,1)},pathAnnulus:function(t,e,r,n,a,i){return h(t,e,r,n,a,i,1)}}},{"./mod":756}],731:[function(t,e,r){"use strict";var n=Array.isArray,a="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function o(t){return a.isView(t)&&!(t instanceof i)}function s(t){return n(t)||o(t)}function l(t,e,r){if(s(t)){if(s(t[0])){for(var n=r,a=0;aa.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){t%1||!n(t)||void 0!==a.min&&ta.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var a="number"==typeof t;!0!==n.strict&&a?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){a(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every((function(t){return a(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(u(+t,360)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r,n){var a=n.regex||c(r);"string"==typeof t&&a.test(t)?e.set(t):e.set(r)},validateFunction:function(t,e){var r=e.dflt;return t===r||"string"==typeof t&&!!c(r).test(t)}},flaglist:{coerceFunction:function(t,e,r,n){if("string"==typeof t)if(-1===(n.extras||[]).indexOf(t)){for(var a=t.split("+"),i=0;i=n&&t<=a?t:u}if("string"!=typeof t&&"number"!=typeof t)return u;t=String(t);var c=_(e),v=t.charAt(0);!c||"G"!==v&&"g"!==v||(t=t.substr(1),e="");var w=c&&"chinese"===e.substr(0,7),T=t.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),S=Number(T[7]||0),E=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var L;k=Number(k);try{var P=m.getComponentMethod("calendars","getCal")(e);if(w){var I="i"===M.charAt(M.length-1);M=parseInt(M,10),L=P.newDate(k,P.toMonthIndex(k,M,I),A)}else L=P.newDate(k,Number(M),A)}catch(t){return u}return L?(L.toJD()-g)*h+S*f+E*p+C*d:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var z=new Date(Date.UTC(2e3,M,A,S,E));return z.setUTCFullYear(k),z.getUTCMonth()!==M||z.getUTCDate()!==A?u:z.getTime()+C*d},n=r.MIN_MS=r.dateTime2ms("-9999"),a=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==u};var T=90*h,k=3*f,M=5*p;function A(t,e,r,n,a){if((e||r||n||a)&&(t+=" "+w(e,2)+":"+w(r,2),(n||a)&&(t+=":"+w(n,2),a))){for(var i=4;a%10==0;)i-=1,a/=10;t+="."+w(a,i)}return t}r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=n&&t<=a))return u;e||(e=0);var i,o,s,c,y,x,b=Math.floor(10*l(t+.05,1)),w=Math.round(t-b/10);if(_(r)){var S=Math.floor(w/h)+g,E=Math.floor(l(t,h));try{i=m.getComponentMethod("calendars","getCal")(r).fromJD(S).formatDate("yyyy-mm-dd")}catch(t){i=v("G%Y-%m-%d")(new Date(w))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=n+h&&t<=a-h))return u;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return A(i("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,n){if(t===u)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 S=/%\d?f/g;function E(t,e,r,n){t=t.replace(S,(function(t){var r=Math.min(+t.charAt(1)||6,6);return(e/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"}));var a=new Date(Math.floor(e+.05));if(_(n))try{t=m.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(a)}var C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,n,a,i){if(a=_(a)&&a,!e)if("y"===r)e=i.year;else if("m"===r)e=i.month;else{if("d"!==r)return function(t,e){var r=l(t+.05,h),n=w(Math.floor(r/f),2)+":"+w(l(Math.floor(r/p),60),2);if("M"!==e){o(e)||(e=0);var a=(100+Math.min(l(t/d,60),C[e])).toFixed(e).substr(1);e>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}(t,r)+"\n"+E(i.dayMonthYear,t,n,a);e=i.dayMonth+"\n"+i.year}return E(e,t,n,a)};var L=3*h;r.incrementMonth=function(t,e,r){r=_(r)&&r;var n=l(t,h);if(t=Math.round(t-n),r)try{var a=Math.round(t/h)+g,i=m.getComponentMethod("calendars","getCal")(r),o=i.fromJD(a);return e%12?i.add(o,e,"m"):i.add(o,e/12,"y"),(o.toJD()-g)*h+n}catch(e){s.error("invalid ms "+t+" in calendar "+r)}var c=new Date(t+L);return c.setUTCMonth(c.getUTCMonth()+e)+n-L},r.findExactDates=function(t,e){for(var r,n,a=0,i=0,s=0,l=0,c=_(e)&&m.getComponentMethod("calendars","getCal")(e),u=0;u0&&t[e+1][0]<0)return e;return null}switch(e="RUS"===s||"FJI"===s?function(t){var e;if(null===c(t))e=t;else for(e=new Array(t.length),a=0;ae?r[n++]=[t[a][0]+360,t[a][1]]:a===e?(r[n++]=t[a],r[n++]=[t[a][0],-90]):r[n++]=t[a];var i=f.tester(r);i.pts.pop(),l.push(i)}:function(t){l.push(f.tester(t))},i.type){case"MultiPolygon":for(r=0;ra&&(a=c,e=l)}else e=r;return o.default(e).geometry.coordinates}(u),n.fIn=t,n.fOut=u,s.push(u)}else c.log(["Location",n.loc,"does not have a valid GeoJSON geometry.","Traces with locationmode *geojson-id* only support","*Polygon* and *MultiPolygon* geometries."].join(" "))}delete a[r]}switch(r.type){case"FeatureCollection":var f=r.features;for(n=0;n100?(clearInterval(i),n("Unexpected error while fetching from "+t)):void a++}),50)}))}for(var o=0;o0&&(r.push(a),a=[])}return a.length>0&&r.push(a),r},r.makeLine=function(t){return 1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}},r.makePolygon=function(t){if(1===t.length)return{type:"Polygon",coordinates:t};for(var e=new Array(t.length),r=0;r1||g<0||g>1?null:{x:t+l*g,y:e+h*g}}function l(t,e,r,n,a){var i=n*t+a*e;if(i<0)return n*n+a*a;if(i>r){var o=n-t,s=a-e;return o*o+s*s}var l=n*e-a*t;return l*l/r}r.segmentsIntersect=s,r.segmentDistance=function(t,e,r,n,a,i,o,c){if(s(t,e,r,n,a,i,o,c))return 0;var u=r-t,h=n-e,f=o-a,p=c-i,d=u*u+h*h,g=f*f+p*p,m=Math.min(l(u,h,d,a-t,i-e),l(u,h,d,o-t,c-e),l(f,p,g,t-a,e-i),l(f,p,g,r-a,n-i));return Math.sqrt(m)},r.getTextLocation=function(t,e,r,s){if(t===a&&s===i||(n={},a=t,i=s),n[r])return n[r];var l=t.getPointAtLength(o(r-s/2,e)),c=t.getPointAtLength(o(r+s/2,e)),u=Math.atan((c.y-l.y)/(c.x-l.x)),h=t.getPointAtLength(o(r,e)),f={x:(4*h.x+l.x+c.x)/6,y:(4*h.y+l.y+c.y)/6,theta:u};return n[r]=f,f},r.clearLocationCache=function(){a=null},r.getVisibleSegment=function(t,e,r){var n,a,i=e.left,o=e.right,s=e.top,l=e.bottom,c=0,u=t.getTotalLength(),h=u;function f(e){var r=t.getPointAtLength(e);0===e?n=r:e===u&&(a=r);var c=r.xo?r.x-o:0,h=r.yl?r.y-l:0;return Math.sqrt(c*c+h*h)}for(var p=f(c);p;){if((c+=p+r)>h)return;p=f(c)}for(p=f(h);p;){if(c>(h-=p+r))return;p=f(h)}return{min:c,max:h,len:h-c,total:u,isClosed:0===c&&h===u&&Math.abs(n.x-a.x)<.1&&Math.abs(n.y-a.y)<.1}},r.findPointOnPath=function(t,e,r,n){for(var a,i,o,s=(n=n||{}).pathLength||t.getTotalLength(),l=n.tolerance||.001,c=n.iterationLimit||30,u=t.getPointAtLength(0)[r]>t.getPointAtLength(s)[r]?-1:1,h=0,f=0,p=s;h0?p=a:f=a,h++}return i}},{"./mod":756}],745:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),i=t("color-normalize"),o=t("../components/colorscale"),s=t("../components/color/attributes").defaultLine,l=t("./array").isArrayOrTypedArray,c=i(s);function u(t,e){var r=t;return r[3]*=e,r}function h(t){if(n(t))return c;var e=i(t);return e.length?e:c}function f(t){return n(t)?t:1}e.exports={formatColor:function(t,e,r){var n,a,s,p,d,g=t.color,m=l(g),v=l(e),y=o.extractOpts(t),x=[];if(n=void 0!==y.colorscale?o.makeColorScaleFuncFromTrace(t):h,a=m?function(t,e){return void 0===t[e]?c:i(n(t[e]))}:h,s=v?function(t,e){return void 0===t[e]?1:f(t[e])}:f,m||v)for(var b=0;b1?(r*t+r*e)/r:t+e,a=String(n).length;if(a>16){var i=String(e).length;if(a>=String(t).length+i){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],749:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../constants/numerical"),s=o.FP_SAFE,l=o.BADNUM,c=e.exports={};c.nestedProperty=t("./nested_property"),c.keyedContainer=t("./keyed_container"),c.relativeAttr=t("./relative_attr"),c.isPlainObject=t("./is_plain_object"),c.toLogRange=t("./to_log_range"),c.relinkPrivateKeys=t("./relink_private");var u=t("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var h=t("./mod");c.mod=h.mod,c.modHalf=h.modHalf;var f=t("./coerce");c.valObjectMeta=f.valObjectMeta,c.coerce=f.coerce,c.coerce2=f.coerce2,c.coerceFont=f.coerceFont,c.coerceHoverinfo=f.coerceHoverinfo,c.coerceSelectionMarkerOpacity=f.coerceSelectionMarkerOpacity,c.validate=f.validate;var p=t("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var d=t("./search");c.findBin=d.findBin,c.sorterAsc=d.sorterAsc,c.sorterDes=d.sorterDes,c.distinctVals=d.distinctVals,c.roundUp=d.roundUp,c.sort=d.sort,c.findIndexOfMin=d.findIndexOfMin;var g=t("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var m=t("./matrix");c.init2dArray=m.init2dArray,c.transposeRagged=m.transposeRagged,c.dot=m.dot,c.translationMatrix=m.translationMatrix,c.rotationMatrix=m.rotationMatrix,c.rotationXYMatrix=m.rotationXYMatrix,c.apply2DTransform=m.apply2DTransform,c.apply2DTransform2=m.apply2DTransform2;var v=t("./angles");c.deg2rad=v.deg2rad,c.rad2deg=v.rad2deg,c.angleDelta=v.angleDelta,c.angleDist=v.angleDist,c.isFullCircle=v.isFullCircle,c.isAngleInsideSector=v.isAngleInsideSector,c.isPtInsideSector=v.isPtInsideSector,c.pathArc=v.pathArc,c.pathSector=v.pathSector,c.pathAnnulus=v.pathAnnulus;var y=t("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=t("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=t("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=t("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=t("./regex");c.counterRegex=w.counter;var T=t("./throttle");c.throttle=T.throttle,c.throttleDone=T.done,c.clearThrottle=T.clear;var k=t("./dom");function M(t){var e={};for(var r in t)for(var n=t[r],a=0;as?l:i(t)?Number(t):l:l},c.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(i(t)&&t>=0&&t%1==0)},c.noop=t("./noop"),c.identity=t("./identity"),c.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))},c.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},c.simpleMap=function(t,e,r,n,a){for(var i=t.length,o=new Array(i),s=0;s=Math.pow(2,r)?a>10?(c.warn("randstr failed uniqueness"),l):t(e,r,n,(a||0)+1):l},c.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},c.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,i,o=t.length,s=2*o,l=2*e-1,c=new Array(l),u=new Array(o);for(r=0;r=s&&(a-=s*Math.floor(a/s)),a<0?a=-1-a:a>=o&&(a=s-1-a),i+=t[a]*c[n];u[r]=i}return u},c.syncOrAsync=function(t,e,r){var n;function a(){return c.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(a).then(void 0,c.promiseError);return r&&r(e)},c.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},c.noneOrAll=function(t,e,r){if(t){var n,a=!1,i=!0;for(n=0;n0?e:0}))},c.fillArray=function(t,e,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(t))for(var a=0;a1?a+o[1]:"";if(i&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+i+"$2");return s+l},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var P=/^\w*$/;c.templateString=function(t,e){var r={};return t.replace(c.TEMPLATE_STRING_REGEX,(function(t,n){var a;return P.test(n)?a=e[n]:(r[n]=r[n]||c.nestedProperty(e,n).get,a=r[n]()),c.isValidTextValue(a)?a:""}))};var I={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return D.apply(I,arguments)};var z={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return D.apply(z,arguments)};var O=/^[:|\|]/;function D(t,e,r){var i=this,o=arguments;e||(e={});var s={};return t.replace(c.TEMPLATE_STRING_REGEX,(function(t,l,u){var h,f,p,d;for(p=3;p=48&&o<=57,c=s>=48&&s<=57;if(l&&(n=10*n+o-48),c&&(a=10*a+s-48),!l||!c){if(n!==a)return n-a;if(o!==s)return o-s}}return a-n};var R=2e9;c.seedPseudoRandom=function(){R=2e9},c.pseudoRandom=function(){var t=R;return R=(69069*R+1)%4294967296,Math.abs(R-t)<429496729?c.pseudoRandom():R/4294967296},c.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},a=c.extractOption(t,e,"htx","hovertext");if(c.isValidTextValue(a))return n(a);var i=c.extractOption(t,e,"tx","text");return c.isValidTextValue(i)?n(i):void 0},c.isValidTextValue=function(t){return t||0===t},c.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(c=1):c=0,"translate("+(a-c*(r+o))+","+(i-c*(n+s))+")"+(c<1?"scale("+c+")":"")+(l?"rotate("+l+(e?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(t,e){var r=c.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r}},{"../constants/numerical":724,"./anchor_utils":729,"./angles":730,"./array":731,"./clean_number":732,"./clear_responsive":734,"./coerce":735,"./dates":736,"./dom":737,"./extend":739,"./filter_unique":740,"./filter_visible":741,"./geometry2d":744,"./identity":747,"./increment":748,"./is_plain_object":750,"./keyed_container":751,"./localize":752,"./loggers":753,"./make_trace_groups":754,"./matrix":755,"./mod":756,"./nested_property":757,"./noop":758,"./notifier":759,"./push_unique":763,"./regex":765,"./relative_attr":766,"./relink_private":767,"./search":768,"./stats":771,"./throttle":774,"./to_log_range":775,d3:169,"d3-time-format":166,"fast-isnumeric":241}],750:[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}},{}],751:[function(t,e,r){"use strict";var n=t("./nested_property"),a=/^\w*$/;e.exports=function(t,e,r,i){var o,s,l;r=r||"name",i=i||"value";var c={};e&&e.length?(l=n(t,e),s=l.get()):s=t,e=e||"";var u={};if(s)for(o=0;o2)return c[e]=2|c[e],f.set(t,null);if(h){for(o=e;o1){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},i.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},i.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":785,"./notifier":759}],754:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var a=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));a.exit().remove(),a.enter().append("g").attr("class",r),a.order();var i=t.classed("rangeplot")?"nodeRangePlot3":"node3";return a.each((function(t){t[0][i]=n.select(this)})),a}},{d3:169}],755:[function(t,e,r){"use strict";r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],757:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./array").isArrayOrTypedArray;function i(t,e){return function(){var r,n,o,s,l,c=t;for(s=0;s/g),l=0;li||c===a||cs)&&(!e||!l(t))}:function(t,e){var l=t[0],c=t[1];if(l===a||li||c===a||cs)return!1;var u,h,f,p,d,g=r.length,m=r[0][0],v=r[0][1],y=0;for(u=1;uMath.max(h,m)||c>Math.max(f,v)))if(cu||Math.abs(n(o,f))>a)return!0;return!1},i.filter=function(t,e){var r=[t[0]],n=0,a=0;function o(o){t.push(o);var s=r.length,l=n;r.splice(a+1);for(var c=l+1;c1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":724,"./matrix":755}],762:[function(t,e,r){(function(r){"use strict";var n=t("./show_no_webgl_msg"),a=t("regl");e.exports=function(t,e){var i=t._fullLayout,o=!0;return i._glcanvas.each((function(n){if(!n.regl&&(!n.pick||i._has("parcoords"))){try{n.regl=a({canvas:this,attributes:{antialias:!n.pick,preserveDrawingBuffer:!0},pixelRatio:t._context.plotGlPixelRatio||r.devicePixelRatio,extensions:e||[]})}catch(t){o=!1}n.regl||(o=!1),o&&this.addEventListener("webglcontextlost",(function(e){t&&t.emit&&t.emit("plotly_webglcontextlost",{event:e,layer:n.key})}),!1)}})),o||n({container:i._glcontainer.node()}),o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./show_no_webgl_msg":770,regl:512}],763:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){for(var r=e.toString(),n=0;na.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 i,o,h=0,f=e.length,p=0,d=f>1?(e[f-1]-e[0])/(f-1):1;for(o=d>=0?r?s:l:r?u:c,t+=1e-9*d*(r?-1:1)*(d>=0?1:-1);h90&&a.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t,e){var n,a=(e||{}).unitMinDiff,i=t.slice();for(i.sort(r.sorterAsc),n=i.length-1;n>-1&&i[n]===o;n--);var s=1;a||(s=i[n]-i[0]||1);for(var l,c=s/(n||1)/1e4,u=[],h=0;h<=n;h++){var f=i[h],p=f-l;void 0===l?(u.push(f),l=f):p>c&&(s=Math.min(s,p),u.push(f),l=f)}return{vals:u,minDiff:s}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,s=r?0:1,l=r?1:0,c=r?Math.ceil:Math.floor;a0&&(n=1),r&&n)return t.sort(e)}return n?t:t.reverse()},r.findIndexOfMin=function(t,e){e=e||i;for(var r,n=1/0,a=0;ai.length)&&(o=i.length),n(e)||(e=!1),a(i[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":731,"fast-isnumeric":241}],772:[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":125}],773:[function(t,e,r){"use strict";var n=t("d3"),a=t("../lib"),i=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,M){var A=t.text(),E=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&A.match(l),C=n.select(t.node().parentNode);if(!C.empty()){var L=t.attr("class")?t.attr("class").split(" ")[0]:"text";return L+="-math",C.selectAll("svg."+L).remove(),C.selectAll("g."+L+"-group").remove(),t.style("display",null).attr({"data-unformatted":A,"data-math":"N"}),E?(e&&e._promises||[]).push(new Promise((function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),i={fontSize:r};!function(t,e,r){var i,o,s,l;MathJax.Hub.Queue((function(){return o=a.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"!==(i=MathJax.Hub.config.menuSettings.renderer))return MathJax.Hub.setRenderer("SVG")}),(function(){var r="math-output-"+a.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(c,"\\lt ").replace(u,"\\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())a.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"!==i)return MathJax.Hub.setRenderer(i)}),(function(){return void 0!==s&&(MathJax.Hub.processSectionDelay=s),MathJax.Hub.Config(o)}))}(E[2],i,(function(n,a,i){C.selectAll("svg."+L).remove(),C.selectAll("g."+L+"-group").remove();var o=n&&n.select("svg");if(!o||!o.node())return P(),void e();var l=C.append("g").classed(L+"-group",!0).attr({"pointer-events":"none","data-unformatted":A,"data-math":"Y"});l.node().appendChild(o.node()),a&&a.node()&&o.node().insertBefore(a.node().cloneNode(!0),o.node().firstChild),o.attr({class:L,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=t.node().style.fill||"black",u=o.select("g");u.attr({fill:c,stroke:c});var h=s(u,"width"),f=s(u,"height"),p=+t.attr("x")-h*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],d=-(r||s(t,"height"))/4;"y"===L[0]?(l.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-h/2,d-f/2]+")"}),o.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===L[0]?o.attr({x:t.attr("x"),y:d-f/2}):"a"===L[0]&&0!==L.indexOf("atitle")?o.attr({x:0,y:d}):o.attr({x:p,y:+t.attr("y")+d-f/2}),M&&M.call(t,l),e(l)}))}))):P(),t}function P(){C.empty()||(L=t.attr("class")+"-math",C.select("svg."+L).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(g," ");var r,s=!1,l=[],c=-1;function u(){c++;var e=document.createElementNS(i.svg,"tspan");n.select(e).attr({class:"line",dy:c*o+"em"}),t.appendChild(e),r=e;var a=l;if(l=[{node:e}],a.length>1)for(var s=1;s doesnt match end tag <"+t+">. Pretending it did match.",e),r=l[l.length-1].node}else a.log("Ignoring unexpected end tag .",e)}y.test(e)?u():(r=t,l=[{node:t}]);for(var C=e.split(m),L=0;L|>|>)/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"},f={sub:"0.3em",sup:"-0.6em"},p={sub:"-0.21em",sup:"0.42em"},d=["http:","https:","mailto:","",void 0,":"],g=r.NEWLINES=/(\r\n?|\n)/g,m=/(<[^<>]*>)/,v=/<(\/?)([^ >]*)(\s+(.*))?>/i,y=//i;r.BR_TAG_ALL=//gi;var x=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,b=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,_=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,w=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&S(n)}var k=/(^|;)\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"],a="...".length,i=t.split(m),o=[],s="",l=0,c=0;ca?o.push(u.substr(0,d-a)+"..."):o.push(u.substr(0,d));break}s=""}}return o.join("")};var M={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},A=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function S(t){return t.replace(A,(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)):M[e])||t}))}function E(t,e,r){var n,a,i,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},i="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:a()-c.top+"px",left:i()-c.left+"px","z-index":1e3}),this}}r.convertEntities=S,r.sanitizeHTML=function(t){t=t.replace(g," ");for(var e=document.createElement("p"),r=e,a=[],i=t.split(m),o=0;oi.ts+e?l():i.timer=setTimeout((function(){l(),i.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)a(n[t]),delete n[t];else for(var e in n)r.clear(e)}},{}],775:[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":241}],776:[function(t,e,r){"use strict";var n=e.exports={},a=t("../plots/geo/constants").locationmodeToLayer,i=t("topojson-client").feature;n.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},n.getTopojsonPath=function(t,e){return t+e+".json"},n.getTopojsonFeatures=function(t,e){var r=a[t.locationmode],n=e.objects[r];return i(e,n).features}},{"../plots/geo/constants":827,"topojson-client":551}],777:[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"}}},{}],778:[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"}}},{}],779:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,i=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 i=(s.subplotsRegistry.cartesian||{}).attrRegex,l=(s.subplotsRegistry.polar||{}).attrRegex,h=(s.subplotsRegistry.ternary||{}).attrRegex,f=(s.subplotsRegistry.gl3d||{}).attrRegex,g=Object.keys(t);for(e=0;e3?(P.x=1.02,P.xanchor="left"):P.x<-2&&(P.x=-.02,P.xanchor="right"),P.y>3?(P.y=1.02,P.yanchor="bottom"):P.y<-2&&(P.y=-.02,P.yanchor="top")),d(t),"rotate"===t.dragmode&&(t.dragmode="orbit"),c.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=b(e);r;){if(r in t)return!0;r=b(r)}return!1};var _=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1&&i.warn("Full array edits are incompatible with other edits",h);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",h,y),!0;e.set(y)}return!g&&(f(m,v),p(t),!0)}var x,b,_,w,T,k,M,A,S=Object.keys(r).map(Number).sort(o),E=e.get(),C=E||[],L=u(v,h).get(),P=[],I=-1,z=C.length;for(x=0;xC.length-(M?0:1))i.warn("index out of range",h,_);else if(void 0!==k)T.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",h,_),c(k)?P.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),L&&L.splice(_,0,{})):i.warn("Unrecognized full object edit value",h,_,k),-1===I&&(I=_);else for(b=0;b=0;x--)C.splice(P[x],1),L&&L.splice(P[x],1);if(C.length?E||e.set(C):e.set(null),g)return!1;if(f(m,v),d!==a){var O;if(-1===I)O=S;else{for(z=Math.max(C.length,z),O=[],x=0;x=I);x++)O.push(_);for(x=I;x=t.data.length||a<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+r+" must be unique.")}}function O(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 D(t,e,r,n,i){!function(t,e,r,n){var a=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 i in z(t,r,"indices"),e){if(!Array.isArray(e[i])||e[i].length!==r.length)throw new Error("attribute "+i+" must be an array of length equal to indices array length");if(a&&(!(i in n)||!Array.isArray(n[i])||n[i].length!==e[i].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 i,l,c,u,h,f=o.isPlainObject(n),p=[];for(var d in Array.isArray(r)||(r=[r]),r=I(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),T.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 a=X(t,n),i=a.flags;i.calc&&(t.calcdata=void 0);var s=[f.previousPromises];i.layoutReplot?s.push(k.layoutReplot):Object.keys(n).length&&(H(t,i,a)||f.supplyDefaults(t),i.legend&&s.push(k.doLegend),i.layoutstyle&&s.push(k.layoutStyles),i.axrange&&G(s,a.rangesAltered),i.ticks&&s.push(k.doTicksRelayout),i.modebar&&s.push(k.doModeBar),i.camera&&s.push(k.doCamera),i.colorbars&&s.push(k.doColorBars),s.push(E)),s.push(f.rehover,f.redrag),c.add(t,q,[t,a.undoit],q,[t,a.redoit]);var l=o.syncOrAsync(s,t);return l&&l.then||(l=Promise.resolve(t)),l.then((function(){return t.emit("plotly_relayout",a.eventData),t}))}function H(t,e,r){var n=t._fullLayout;if(!e.axrange)return!1;for(var a in e)if("axrange"!==a&&e[a])return!1;for(var i in r.rangesAltered){var o=d.id2name(i),s=t.layout[o],l=n[o];if(l.autorange=s.autorange,l.range=s.range.slice(),l.cleanRange(),l._matchGroup)for(var c in l._matchGroup)if(c!==i){var u=n[d.id2name(c)];u.autorange=l.autorange,u.range=l.range.slice(),u._input.range=l.range.slice()}}return!0}function G(t,e){var r=e?function(t){var r=[],n=!0;for(var a in e){var i=d.getFromId(t,a);if(r.push(a),i._matchGroup)for(var o in i._matchGroup)e[o]||r.push(o);i.automargin&&(n=!1)}return d.draw(t,r,{skipTitle:n})}:function(t){return d.draw(t,"redraw")};t.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Y=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,W=/^[xyz]axis[0-9]*\.autorange$/,Z=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function X(t,e){var r,n,a,i=t.layout,l=t._fullLayout,c=l._guiEditing,f=N(l._preGUI,c),p=Object.keys(e),g=d.list(t),m=o.extendDeepAll({},e),v={};for(V(e),p=Object.keys(e),n=0;n0&&"string"!=typeof z.parts[D];)D--;var R=z.parts[D],F=z.parts[D-1]+"."+R,j=z.parts.slice(0,D).join("."),U=s(t.layout,j).get(),q=s(l,j).get(),H=z.get();if(void 0!==O){k[I]=O,S[I]="reverse"===R?O:B(H);var G=h.getLayoutValObject(l,z.parts);if(G&&G.impliedEdits&&null!==O)for(var X in G.impliedEdits)E(o.relativeAttr(I,X),G.impliedEdits[X]);if(-1!==["width","height"].indexOf(I))if(O){E("autosize",null);var K="height"===I?"width":"height";E(K,l[K])}else l[I]=t._initialAutoSize[I];else if("autosize"===I)E("width",O?null:l.width),E("height",O?null:l.height);else if(F.match(Y))P(F),s(l,j+"._inputRange").set(null);else if(F.match(W)){P(F),s(l,j+"._inputRange").set(null);var Q=s(l,j).get();Q._inputDomain&&(Q._input.domain=Q._inputDomain.slice())}else F.match(Z)&&s(l,j+"._inputDomain").set(null);if("type"===R){var $=U,tt="linear"===q.type&&"log"===O,et="log"===q.type&&"linear"===O;if(tt||et){if($&&$.range)if(q.autorange)tt&&($.range=$.range[1]>$.range[0]?[1,2]:[2,1]);else{var rt=$.range[0],nt=$.range[1];tt?(rt<=0&&nt<=0&&E(j+".autorange",!0),rt<=0?rt=nt/1e6:nt<=0&&(nt=rt/1e6),E(j+".range[0]",Math.log(rt)/Math.LN10),E(j+".range[1]",Math.log(nt)/Math.LN10)):(E(j+".range[0]",Math.pow(10,rt)),E(j+".range[1]",Math.pow(10,nt)))}else E(j+".autorange",!0);Array.isArray(l._subplots.polar)&&l._subplots.polar.length&&l[z.parts[0]]&&"radialaxis"===z.parts[1]&&delete l[z.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(t,q,O,E),u.getComponentMethod("images","convertCoords")(t,q,O,E)}else E(j+".autorange",!0),E(j+".range",null);s(l,j+"._inputRange").set(null)}else if(R.match(A)){var at=s(l,I).get(),it=(O||{}).type;it&&"-"!==it||(it="linear"),u.getComponentMethod("annotations","convertCoords")(t,at,it,E),u.getComponentMethod("images","convertCoords")(t,at,it,E)}var ot=w.containerArrayMatch(I);if(ot){r=ot.array,n=ot.index;var st=ot.property,lt=G||{editType:"calc"};""!==n&&""===st&&(w.isAddVal(O)?S[I]=null:w.isRemoveVal(O)?S[I]=(s(i,r).get()||[])[n]:o.warn("unrecognized full object value",e)),M.update(_,lt),v[r]||(v[r]={});var ct=v[r][n];ct||(ct=v[r][n]={}),ct[st]=O,delete e[I]}else"reverse"===R?(U.range?U.range.reverse():(E(j+".autorange",!0),U.range=[1,0]),q.autorange?_.calc=!0:_.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===I&&("lasso"===O||"select"===O)&&"lasso"!==H&&"select"!==H||l._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,z.set(O))}}for(r in v){w.applyContainerArrayChanges(t,f(i,r),v[r],_,f)||(_.plot=!0)}var ut=l._axisConstraintGroups||[];for(C in L)for(n=0;n1;)if(n.pop(),void 0!==(r=s(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(t,e){for(var r=0;r=a.length?a[0]:a[t]:a}function l(t){return Array.isArray(i)?t>=i.length?i[0]:i[t]:i}function c(t,e){var r=0;return function(){if(t&&++r===e)return t()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise((function(i,u){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,T.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 p(){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 d,g,m=0;function v(t){return Array.isArray(a)?m>=a.length?t.transitionOpts=a[m]:t.transitionOpts=a[0]:t.transitionOpts=a,m++,t}var y=[],x=null==e,b=Array.isArray(e);if(!x&&!b&&o.isPlainObject(e))y.push({type:"object",data:v(o.extendFlat({},e))});else if(x||-1!==["string","number"].indexOf(typeof e))for(d=0;d0&&kk)&&M.push(g);y=M}}y.length>0?function(e){if(0!==e.length){for(var a=0;a=0;n--)if(o.isPlainObject(e[n])){var g=e[n].name,m=(u[g]||d[g]||{}).name,v=e[n].name,y=u[m]||d[m];m&&v&&"number"==typeof v&&y&&S<5&&(S++,o.warn('addFrames: overwriting frame "'+(u[m]||d[m]).name+'" with a frame whose name of type "number" also equates to "'+m+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===S&&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.")),d[g]={name:g},p.push({frame:f.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:h+n})}p.sort((function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(a=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(i=0;i=0;r--)n=e[r],i.push({type:"delete",index:n}),s.unshift({type:"insert",index:n,value:a[n]});var l=f.modifyFrames,u=f.modifyFrames,h=[t,s],p=[t,i];return c&&c.add(t,l,h,u,p),f.modifyFrames(t,i)},r.addTraces=function t(e,n,a){e=o.getGraphDiv(e);var i,s,l=[],u=r.deleteTraces,h=t,f=[e,l],p=[e,n];for(function(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&r=i.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!_(o))return!1;t=i[a][o]}else t=i[a]}else t=i}}return t}function _(t){return t===Math.round(t)&&t>=0}function w(){var t,e,r={};for(t in d(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var a=0;a=l.length)return!1;a=(r=(n.transformsRegistry[l[c].type]||{}).attributes)&&r[e[2]],s=3}else if("area"===t.type)a=u[o];else{var h=t._module;if(h||(h=(n.modules[t.type||i.type.dflt]||{})._module),!h)return!1;if(!(a=(r=h.attributes)&&r[o])){var f=h.basePlotModule;f&&f.attributes&&(a=f.attributes[o])}a||(a=i[o])}return b(a,e,s)},r.getLayoutValObject=function(t,e){return b(function(t,e){var r,a,i,s,l=t._basePlotModules;if(l){var c;for(r=0;r=a&&(r._input||{})._templateitemname;o&&(i=a);var s,l=e+"["+i+"]";function c(){s={},o&&(s[l]={},s[l].templateitemname=o)}function u(t,e){o?n.nestedProperty(s[l],t).set(e):s[l+"."+t]=e}function h(){var t=s;return c(),t}return c(),{modifyBase:function(t,e){s[t]=e},modifyItem:u,getUpdateObj:h,applyUpdate:function(e,r){e&&u(e,r);var a=h();for(var i in a)n.nestedProperty(t,i).set(a[i])}}}},{"../lib":749,"../plots/attributes":794}],788:[function(t,e,r){"use strict";var n=t("d3"),a=t("../registry"),i=t("../plots/plots"),o=t("../lib"),s=t("../lib/clear_gl_canvases"),l=t("../components/color"),c=t("../components/drawing"),u=t("../components/titles"),h=t("../components/modebar"),f=t("../plots/cartesian/axes"),p=t("../constants/alignment"),d=t("../plots/cartesian/constraints"),g=d.enforce,m=d.clean,v=t("../plots/cartesian/autorange").doAutoRange;function y(t,e,r){for(var n=0;n=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}function x(t){var e,a,s,u,d,g,m=t._fullLayout,v=m._size,x=v.p,_=f.list(t,"",!0);if(m._paperdiv.style({width:t._context.responsive&&m.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":m.width+"px",height:t._context.responsive&&m.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":m.height+"px"}).selectAll(".main-svg").call(c.setSize,m.width,m.height),t._context.setBackground(t,m.paper_bgcolor),r.drawMainTitle(t),h.manage(t),!m._has("cartesian"))return i.previousPromises(t);function T(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-x-n:e._offset+e._length+x+n:v.t+v.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+x+n:e._offset-x-n:v.l+v.w*(t.position||0)+n%1}for(e=0;e<_.length;e++){var k=(u=_[e])._anchorAxis;u._linepositions={},u._lw=c.crispRound(t,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],S=[],E=1===l.opacity(m.paper_bgcolor)&&1===l.opacity(m.plot_bgcolor)&&m.paper_bgcolor===m.plot_bgcolor;for(a in m._plots)if((s=m._plots[a]).mainplot)s.bg&&s.bg.remove(),s.bg=void 0;else{var C=s.xaxis.domain,L=s.yaxis.domain,P=s.plotgroup;if(y(C,L,S)){var I=P.node(),z=s.bg=o.ensureSingle(P,"rect","bg");I.insertBefore(z.node(),I.childNodes[0]),A.push(a)}else P.select("rect.bg").remove(),S.push([C,L]),E||(M.push(a),A.push(a))}var O,D,R,F,B,N,j,U,V,q,H,G,Y,W=m._bgLayer.selectAll(".bg").data(M);for(W.enter().append("rect").classed("bg",!0),W.exit().remove(),W.each((function(t){m._plots[t].bg=n.select(this)})),e=0;eT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var i=e[n],o=g(e,n,r);a(i)?(Array.isArray(e)&&!1===i._template&&i.templateitemname&&u.push({code:"missing",path:o,templateitemname:i.templateitemname}),t(i,o)):Array.isArray(i)&&m(i)&&t(i,o)}}({data:p,layout:f},""),u.length)return u.map(v)}},{"../lib":749,"../plots/attributes":794,"../plots/plots":860,"./plot_config":785,"./plot_schema":786,"./plot_template":787}],790:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./plot_api"),i=t("../plots/plots"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg"),u=t("../version").version,h={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,f,p,d;function g(t){return!(t in e)||o.validate(e[t],h[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],f=t.layout||{},p=t.config||{},d={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),f=o.extendDeep({},t.layout),p=t._context,d=t._fullLayout||{}),!g("width")&&null!==e.width||!g("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var m={};function v(t,r){return o.coerce(e,m,h,t,r)}var y=v("format"),x=v("width"),b=v("height"),_=v("scale"),w=v("setBackground"),T=v("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},f);x?M.width=x:null===e.width&&n(d.width)&&(M.width=d.width),b?M.height=b:null===e.height&&n(d.height)&&(M.height=d.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),S=s.getRedrawFunc(k);function E(){return new Promise((function(t){setTimeout(t,s.getDelay(k._fullLayout))}))}function C(){return new Promise((function(t,e){var r=l(k,y,_),n=k._fullLayout.width,h=k._fullLayout.height;function f(){a.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=i.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),f(),t(T?p:s.encodeJSON(p))}if(f(),"svg"===y)return t(T?r:s.encodeSVG(r));var d=document.createElement("canvas");d.id=o.randstr(),c({format:y,width:n,height:h,scale:_,canvas:d,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){a.plot(k,r,M,A).then(S).then(E).then(C).then((function(e){t(function(t){return T?t.replace(s.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":749,"../plots/plots":860,"../snapshot/helpers":884,"../snapshot/svgtoimg":886,"../snapshot/tosvg":888,"../version":1337,"./plot_api":784,"fast-isnumeric":241}],791:[function(t,e,r){"use strict";var n=t("../lib"),a=t("../plots/plots"),i=t("./plot_schema"),o=t("./plot_config").dfltConfig,s=n.isPlainObject,l=Array.isArray,c=n.isArrayOrTypedArray;function u(t,e,r,a,i,o){o=o||[];for(var h=Object.keys(t),f=0;fx.length&&a.push(d("unused",i,v.concat(x.length)));var M,A,S,E,C,L=x.length,P=Array.isArray(k);if(P&&(L=Math.min(L,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&a.push(d("unused",i,v.concat(A,x[A].length)));var I=x[A].length;for(M=0;M<(P?Math.min(I,k[A].length):I);M++)S=P?k[A][M]:k,E=y[A][M],C=x[A][M],n.validate(E,S)?C!==E&&C!==+E&&a.push(d("dynamic",i,v.concat(A,M),E,C)):a.push(d("value",i,v.concat(A,M),E))}else a.push(d("array",i,v.concat(A),y[A]));else for(A=0;A1&&p.push(d("object","layout"))),a.supplyDefaults(g);for(var m=g._fullData,v=r.length,y=0;y0&&((b=M-o(m)-o(v))>A?_/b>E&&(y=m,x=v,E=_/b):_/M>E&&(y={val:m.val,pad:0},x={val:v.val,pad:0},E=_/M));if(f===p){var C=f-1,L=f+1;if(T)if(0===f)i=[0,1];else{var P=(f>0?h:u).reduce((function(t,e){return Math.max(t,o(e))}),0),I=f/(1-Math.min(.5,P/M));i=f>0?[0,I]:[I,0]}else i=k?[Math.max(0,C),Math.max(1,L)]:[C,L]}else T?(y.val>=0&&(y={val:0,pad:0}),x.val<=0&&(x={val:0,pad:0})):k&&(y.val-E*o(y)<0&&(y={val:0,pad:0}),x.val<=0&&(x={val:1,pad:0})),E=(x.val-y.val-S(m.val,v.val))/(M-o(y)-o(x)),i=[y.val-E*o(y),x.val+E*o(x)];return d&&i.reverse(),a.simpleMap(i,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 c(t,e){var r,n,a,i=e._id,o=t._fullData,s=t._fullLayout,l=[],c=[];function f(t,e){for(r=0;r=r&&(c.extrapad||!o)){s=!1;break}a(e,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(t.splice(l,1),l--)}if(s){var u=i&&0===e;t.push({val:e,pad:u?0:r,extrapad:!u&&o})}}function p(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=a.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 i=e._anchorAxis;if(i&&i.rangeslider){var l=i.rangeslider[e._name];l&&"auto"===l.rangemode&&(l.range=s(t,e)),i._input.rangeslider[e._name]=a.extendFlat({},l)}},findExtremes:function(t,e,r){r||(r={});t._m||t.setScale();var a,o,s,l,c,f,d,g,m,v=[],y=[],x=e.length,b=r.padded||!1,_=r.tozero&&("linear"===t.type||"-"===t.type),w="log"===t.type,T=!1,k=r.vpadLinearized||!1;function M(t){if(Array.isArray(t))return T=!0,function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}var A=M((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),S=M((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),E=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(g=1/0,m=-1/0,w)for(a=0;a0&&(g=o),o>m&&o-i&&(g=o),o>m&&o=I;a--)P(a);return{min:v,max:y,opts:r}},concatExtremes:c}},{"../../constants/numerical":724,"../../lib":749,"../../registry":880,"fast-isnumeric":241}],797:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),c=t("../../components/titles"),u=t("../../components/color"),h=t("../../components/drawing"),f=t("./layout_attributes"),p=t("./clean_ticks"),d=t("../../constants/numerical"),g=d.ONEMAXYEAR,m=d.ONEAVGYEAR,v=d.ONEMINYEAR,y=d.ONEMAXQUARTER,x=d.ONEAVGQUARTER,b=d.ONEMINQUARTER,_=d.ONEMAXMONTH,w=d.ONEAVGMONTH,T=d.ONEMINMONTH,k=d.ONEWEEK,M=d.ONEDAY,A=M/2,S=d.ONEHOUR,E=d.ONEMIN,C=d.ONESEC,L=d.MINUS_SIGN,P=d.BADNUM,I=t("../../constants/alignment"),z=I.MID_SHIFT,O=I.CAP_SHIFT,D=I.LINE_SPACING,R=I.OPPOSITE_SIDE,F=e.exports={};F.setConvert=t("./set_convert");var B=t("./axis_autotype"),N=t("./axis_ids");F.id2name=N.id2name,F.name2id=N.name2id,F.cleanId=N.cleanId,F.list=N.list,F.listIds=N.listIds,F.getFromId=N.getFromId,F.getFromTrace=N.getFromTrace;var j=t("./autorange");F.getAutoRange=j.getAutoRange,F.findExtremes=j.findExtremes;function U(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}F.coerceRef=function(t,e,r,n,a,i){var o=n.charAt(n.length-1),l=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return a||(a=l[0]||i),i||(i=a),u[c]={valType:"enumerated",values:l.concat(i?[i]:[]),dflt:a},s.coerce(t,e,u,c)},F.coercePosition=function(t,e,r,n,a,i){var o,l;if("paper"===n||"pixel"===n)o=s.ensureNumber,l=r(a,i);else{var c=F.getFromId(e,n);l=r(a,i=c.fraction2r(i)),o=c.cleanPos}t[a]=o(l)},F.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:F.getFromId(e,r).cleanPos)(t)},F.redrawComponents=function(t,e){e=e||F.listIds(t);var r=t._fullLayout;function n(n,a,i,s){for(var l=o.getComponentMethod(n,a),c={},u=0;u2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},F.saveRangeInitial=function(t,e){for(var r=F.list(t,"",!0),n=!1,a=0;a.3*f||u(n)||u(i))){var p=r.dtick/2;t+=t+p.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=F.tickIncrement(t,"M6","reverse")+1.5*M:i.exactMonths>.8?t=F.tickIncrement(t,"M1","reverse")+15.5*M:t-=A;var l=F.tickIncrement(t,r);if(l<=n)return l}return t}(y,t,v,c,i)),m=y,0;m<=u;)m=F.tickIncrement(m,v,!1,i);return{start:e.c2r(y,0,i),end:e.c2r(m,0,i),size:v,_dataSpan:u-c}},F.prepTicks=function(t,e){var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if("auto"===t.tickmode||!t.dtick){var n,a=t.nticks;a||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,a=t._length/n):(n="y"===t._id.charAt(0)?40:80,a=s.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(a*=2)),"array"===t.tickmode&&(a*=100),t._roughDTick=(Math.abs(r[1]-r[0])-(t._lBreaks||0))/a,F.autoTicks(t,t._roughDTick),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),$(t)},F.calcTicks=function(t,e){F.prepTicks(t,e);var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if("array"===t.tickmode)return function(t){var e=t.tickvals,r=t.ticktext,n=new Array(e.length),a=U(s.simpleMap(t.range,t.r2l)),i=Math.min(a[0],a[1]),o=Math.max(a[0],a[1]),l=0;Array.isArray(r)||(r=[]);var c="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 u=0;ui&&h=o:n<=o)&&!(c.length>r||n===e);n=F.tickIncrement(n,t.dtick,l,t.calendar)){e=n;var a=!1;u&&n!==(0|n)&&(a=!0),c.push({minor:a,value:n})}}();var h="period"===t.ticklabelmode;if(h&&c.unshift({minor:!1,value:F.tickIncrement(c[0].value,t.dtick,!l,t.caldendar)}),t.rangebreaks){var f=c.length;if(f){var p=0;"auto"===t.tickmode&&(p=("y"===t._id.charAt(0)?2:6)*(t.tickfont?t.tickfont.size:12));for(var d,E=[],C=l?1:-1,L=l?f-1:0,I=l?0:f-1;C*I<=C*L;I+=C){var z=c[I];if(t.maskBreaks(z.value)!==P||(z.value=vt(z.value,t),!t._rl||t._rl[0]!==z.value&&t._rl[1]!==z.value)){var O=t.c2p(z.value);O===d?E[E.length-1].valuep)&&(d=O,E.push(z))}}c=E.reverse()}}mt(t)&&360===Math.abs(r[1]-r[0])&&c.pop(),t._tmax=(c[c.length-1]||{}).value,t._prevDateHead="",t._inCalcTicks=!0;var D,R=Math.min(r[0],r[1]),B=Math.max(r[0],r[1]),N=F.getTickFormat(t);h&&N&&(/%[fLQsSMX]/.test(N)||(/%[HI]/.test(N)?D=S:/%p/.test(N)?D=A:/%[Aadejuwx]/.test(N)?D=M:/%[UVW]/.test(N)?D=k:/%[Bbm]/.test(N)?D=w:/%[q]/.test(N)?D=x:/%[Yy]/.test(N)&&(D=m)));var j,V,q=[];for(j=0;j0?(X=j-1,J=j):(X=j,J=j);var K=q[X].x,Q=q[J].x,$=Math.abs(Q-K),et=D||$,rt=0;if(et>=v?rt=$>=v&&$<=g?$:m:D===x&&et>=b?rt=$>=b&&$<=y?$:x:et>=T?rt=$>=T&&$<=_?$:w:D===k&&et>=k?rt=k:et>=M?rt=M:D===A&&et>=A?rt=A:D===S&&et>=S&&(rt=S),rt&&t.rangebreaks){for(var nt=0,at=0,it=0;it<42;it++){var ot=it/42;t.maskBreaks(K*(1-ot)+Q*ot)!==P&&(ot<.5?nt++:at++)}at&&(rt*=(nt+at)/42)}rt<=$&&(Z+=rt/2),q[j].periodX=Z,(Z>B||Z=R){t._prevDateHead="",q[j].text=F.tickText(t,q[j].x).text;break}}return t._inCalcTicks=!1,q};var G=[2,5,10],Y=[1,2,3,6,12],W=[1,2,5,10,15,30],Z=[1,2,3,7,14],X=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],J=[-.301,0,.301,.699,1],K=[15,30,45,90,180];function Q(t,e,r){return e*s.roundUp(t/e,r)}function $(t){var e=t.dtick;if(t._tickexponent=0,a(e)||"string"==typeof e||(e=1),"category"!==t.type&&"multicategory"!==t.type||(t._tickround=null),"date"===t.type){var r=t.r2l(t.tick0),n=t.l2r(r).replace(/(^-|i)/g,""),i=n.length;if("M"===String(e).charAt(0))i>10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=M&&i<=10||e>=15*M)t._tickround="d";else if(e>=E&&i<=16||e>=S)t._tickround="M";else if(e>=C&&i<=19||e>=E)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,o)-20,t._tickround<0&&(t._tickround=4)}}else if(a(e)||"L"===e.charAt(0)){var s=t.range.map(t.r2d||Number);a(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])),c=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(c)>3&&(rt(t.exponentformat)&&!nt(c)?t._tickexponent=3*Math.round((c-1)/3):t._tickexponent=c)}else t._tickround=null}function tt(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}}F.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 i=2*e;if(i>m)e/=m,r=n(10),t.dtick="M"+12*Q(e,r,G);else if(i>w)e/=w,t.dtick="M"+Q(e,1,Y);else if(i>M){t.dtick=Q(e,M,t._hasDayOfWeekBreaks?[1,2,7,14]:Z),t.tick0=s.dateTick0(t.calendar,!0);var o=F.getTickFormat(t);if(/%[uVW]/.test(o)){var l=t.tick0.length,c=+t.tick0[l-1];t.tick0=t.tick0.substring(0,l-2)+String(c+1)}}else i>S?t.dtick=Q(e,S,Y):i>E?t.dtick=Q(e,E,W):i>C?t.dtick=Q(e,C,W):(r=n(10),t.dtick=Q(e,r,G))}else if("log"===t.type){t.tick0=0;var u=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(u[1]-u[0])<1){var h=1.5*Math.abs((u[1]-u[0])/e);e=Math.abs(Math.pow(10,u[1])-Math.pow(10,u[0]))/h,r=n(10),t.dtick="L"+Q(e,r,G)}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))):mt(t)?(t.tick0=0,r=1,t.dtick=Q(e,r,K)):(t.tick0=0,r=n(10),t.dtick=Q(e,r,G));if(0===t.dtick&&(t.dtick=1),!a(t.dtick)&&"string"!=typeof t.dtick){var f=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(f)}},F.tickIncrement=function(t,e,r,i){var o=r?-1:1;if(a(e))return s.increment(t,o*e);var l=e.charAt(0),c=o*Number(e.substr(1));if("M"===l)return s.incrementMonth(t,c,i);if("L"===l)return Math.log(Math.pow(10,t)+c)/Math.LN10;if("D"===l){var u="D2"===e?J:X,h=t+.01*o,f=s.roundUp(s.mod(h,1),u,r);return Math.floor(h)+Math.log(n.round(Math.pow(10,f),1))/Math.LN10}throw"unrecognized dtick "+String(e)},F.tickFirst=function(t,e){var r=t.r2l||Number,i=s.simpleMap(t.range,r,void 0,void 0,e),o=i[1]"+l,t._prevDateHead=l));e.text=c}(t,o,r,c):"log"===u?function(t,e,r,n,i){var o=t.dtick,l=e.x,c=t.tickformat,u="string"==typeof o&&o.charAt(0);"never"===i&&(i="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)e.text=at(Math.pow(10,l),t,i,n);else if(a(o)||"D"===u&&s.mod(l+.01,1)<.1){var h=Math.round(l),f=Math.abs(h),p=t.exponentformat;"power"===p||rt(p)&&nt(h)?(e.text=0===h?1:1===h?"10":"10"+(h>1?"":L)+f+"",e.fontSize*=1.25):("e"===p||"E"===p)&&f>2?e.text="1"+p+(h>0?"+":L)+f:(e.text=at(Math.pow(10,l),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==u)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 d=String(e.text).charAt(0);"0"!==d&&"1"!==d||("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,c,g):"category"===u?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"multicategory"===u?function(t,e,r){var n=Math.round(e.x),a=t._categories[n]||[],i=void 0===a[1]?"":String(a[1]),o=void 0===a[0]?"":String(a[0]);r?e.text=o+" - "+i:(e.text=i,e.text2=o)}(t,o,r):mt(t)?function(t,e,r,n,a){if("radians"!==t.thetaunit||r)e.text=at(e.x,t,a,n);else{var i=e.x/180;if(0===i)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){for(var r=1;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,a=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/a),Math.round(r/a)]}(i);if(o[1]>=100)e.text=at(s.deg2rad(e.x),t,a,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=L+e.text)}}}}(t,o,r,c,g):function(t,e,r,n,a){"never"===a?a="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide");e.text=at(e.x,t,a,n)}(t,o,0,c,g),n||(t.tickprefix&&!d(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!d(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var m=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[m(o.x-.5),m(o.x+t.dtick-.5)]}return o},F.hoverLabelText=function(t,e,r){if(r!==P&&r!==e)return F.hoverLabelText(t,e)+" - "+F.hoverLabelText(t,r);var n="log"===t.type&&e<=0,a=F.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":L+a:a};var et=["f","p","n","\u03bc","m","","k","M","G","T"];function rt(t){return"SI"===t||"B"===t}function nt(t){return t>14||t<-15}function at(t,e,r,n){var i=t<0,o=e._tickround,l=r||e.exponentformat||"B",c=e._tickexponent,u=F.getTickFormat(e),h=e.separatethousands;if(n){var f={exponentformat:l,dtick:"none"===e.showexponent?e.dtick:a(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};$(f),o=(Number(f._tickround)||0)+4,c=f._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return e._numFormat(u)(t).replace(/-/g,L);var p,d=Math.pow(10,-o)/2;if("none"===l&&(c=0),(t=Math.abs(t))"+p+"":"B"===l&&9===c?t+="B":rt(l)&&(t+=et[c/3+5]));return i?L+t:t}function it(t,e){for(var r=[],n={},a=0;a1&&r=a.min&&t=0,i=u(t,e[1])<=0;return(r||a)&&(n||i)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=o(a)))){r=n;break}break;case"log":for(e=0;e0?r.bottom-u:0,h)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===d){if("b"===l?n[l]=e._depth:(n[l]=e._depth=Math.max(r.width>0?u-r.top:0,h),p.reverse()),r.width>0){var m=r.right-(e._offset+e._length);m>0&&(n.xr=1,n.r=m);var v=e._offset-r.left;v>0&&(n.xl=0,n.l=v)}}else if("l"===l?n[l]=e._depth=Math.max(r.height>0?u-r.left:0,h):(n[l]=e._depth=Math.max(r.height>0?r.right-u:0,h),p.reverse()),r.height>0){var y=r.bottom-(e._offset+e._length);y>0&&(n.yb=0,n.b=y);var x=e._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===e.anchor?e.position:e._anchorAxis.domain[p[0]],e.title.text!==f._dfltTitle[d]&&(n[l]+=st(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((a={x:0,y:0,r:0,l:0,t:0,b:0})[c]=e.linewidth,e.mirror&&!0!==e.mirror&&(a[c]+=h),!0===e.mirror||"ticks"===e.mirror?a[g]=e._anchorAxis.domain[p[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(a[g]=[e._counterDomainMin,e._counterDomainMax][p[1]]))}X&&(s=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),i.autoMargin(t,ut(e),n),i.autoMargin(t,ht(e),a),i.autoMargin(t,ft(e),s)})),r.skipTitle||X&&"bottom"===e.side||W.push((function(){return function(t,e){var r,n=t._fullLayout,a=e._id,i=a.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+st(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===i?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var s,l,u,f,p=F.getPxPosition(t,e);"x"===i?(l=e._offset+e._length/2,u="top"===e.side?p-r:p+r):(u=e._offset+e._length/2,l="right"===e.side?p+r:p-r,s={rotate:"-90",offset:0});if("multicategory"!==e.type){var d=e._selections[e._id+"tick"];if(f={selection:d,side:e.side},d&&d.node()&&d.node().parentNode){var g=h.getTranslate(d.node().parentNode);f.offsetLeft=g.x,f.offsetTop=g.y}e.title.hasOwnProperty("standoff")&&(f.pad=0)}return c.draw(t,a+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[i],avoid:f,transform:s,attributes:{x:l,y:u,"text-anchor":"middle"}})}(t,e)})),s.syncOrAsync(W)}}function J(t){var r=p+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,a,i;t._selections[e].size()?(r=1/0,n=-1/0,a=1/0,i=-1/0,t._selections[e].each((function(){var t=ct(this),e=h.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),a=Math.min(a,e.left),i=Math.max(i,e.right)}))):(r=0,n=0,a=0,i=0);return{top:r,bottom:n,left:a,right:i,height:n-r,width:i-a}}(e,r)),w[r]}},F.getTickSigns=function(t){var e=t._id.charAt(0),r={x:"top",y:"right"}[e],n=t.side===r?1:-1,a=[-1,1,n,-n];return"inside"!==t.ticks==("x"===e)&&(a=a.map((function(t){return-t}))),t.side&&a.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),a},F.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))+")"}},F.makeTransPeriodFn=function(t){var e=t._id.charAt(0),r=t._offset;return"x"===e?function(e){return"translate("+(r+t.l2p(e.periodX))+",0)"}:function(e){return"translate(0,"+(r+t.l2p(e.periodX))+")"}},F.makeTickPath=function(t,e,r,n){n=void 0!==n?n:t.ticklen;var a=t._id.charAt(0),i=(t.linewidth||1)/2;return"x"===a?"M0,"+(e+i*r)+"v"+n*r:"M"+(e+i*r)+",0h"+n*r},F.makeLabelFns=function(t,e,r){var n=t._id.charAt(0),i="boundaries"!==t.tickson&&"outside"===t.ticks,o=0,l=0;if(i&&(o+=t.ticklen),r&&"outside"===t.ticks){var c=s.deg2rad(r);o=t.ticklen*Math.cos(c)+1,l=t.ticklen*Math.sin(c)}t.showticklabels&&(i||t.showline)&&(o+=.2*t.tickfont.size);var u,h,f,p,d={labelStandoff:o+=(t.linewidth||1)/2,labelShift:l};return"x"===n?(p="bottom"===t.side?1:-1,u=l*p,h=e+o*p,f="bottom"===t.side?1:-.2,d.xFn=function(t){return t.dx+u},d.yFn=function(t){return t.dy+h+t.fontSize*f},d.anchorFn=function(t,e){return a(e)&&0!==e&&180!==e?e*p<0?"end":"start":"middle"},d.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side?-n:0}):"y"===n&&(p="right"===t.side?1:-1,u=o,h=-l*p,f=90===Math.abs(t.tickangle)?.5:0,d.xFn=function(t){return t.dx+e+(u+t.fontSize*f)*p},d.yFn=function(t){return t.dy+h+t.fontSize*z},d.anchorFn=function(e,r){return a(r)&&90===Math.abs(r)?"middle":"right"===t.side?"start":"end"},d.heightFn=function(e,r,n){return(r*="left"===t.side?1:-1)<-30?-n:r<30?-.5*n:0}),d},F.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",a=r.vals;"period"===e.ticklabelmode&&(a=a.slice()).shift();var i=r.layer.selectAll("path."+n).data(e.ticks?a:[],ot);i.exit().remove(),i.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(u.stroke,e.tickcolor).style("stroke-width",h.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),i.attr("transform",r.transFn)},F.drawGrid=function(t,e,r){r=r||{};var n=e._id+"grid",a=r.vals,i=r.counterAxis;if(!1===e.showgrid)a=[];else if(i&&F.shouldShowZeroLine(t,e,i))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;e=2){var l,c,u="";if(2===o.length)for(l=0;l<2;l++)if(c=y(o[l])){u=d;break}var h=a("pattern",u);if(h===d)for(l=0;l<2;l++)(c=y(o[l]))&&(e.bounds[l]=o[l]=c-1);if(h)for(l=0;l<2;l++)switch(c=o[l],h){case d:if(!n(c))return void(e.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(e.enabled=!1);e.bounds[l]=o[l]=c;break;case g:if(!n(c))return void(e.enabled=!1);if((c=+c)<0||c>24)return void(e.enabled=!1);e.bounds[l]=o[l]=c}if(!1===r.autorange){var f=r.range;if(f[0]f[1])return void(e.enabled=!1)}else if(o[0]>f[0]&&o[1]n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.getAxisGroup=function(t,e){for(var r=t._axisMatchGroups,n=0;n0;o&&(a="array");var s,l=r("categoryorder",a);"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,a,i=e.dataAttr||t._id.charAt(0),o={};if(e.axData)r=e.axData;else for(r=[],n=0;nl*x)||T)for(r=0;rz&&RP&&(P=R);p/=(P-L)/(2*I),L=c.l2r(L),P=c.l2r(P),c.range=c._input.range=S=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function F(t,e,r,n,a){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",a+"Z")}function B(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 N(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),j(t,e,a,i)}function j(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 U(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function V(t){L&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),L=!1)}function q(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,C)/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 H(t,e,r,n){for(var a,i,o,l,c=!1,u={},h={},f=0;f=0)a._fullLayout._deactivateShape(a);else{var i=a._fullLayout.clickmode;if(U(a),2!==t||dt||Ut(),pt)i.indexOf("select")>-1&&M(r,a,X,J,e.id,Et),i.indexOf("event")>-1&&h.click(a,r,e.id);else if(1===t&&dt){var s=g?j:P,c="s"===g||"w"===L?0:1,u=s._name+".range["+c+"]",f=function(t,e){var r,a=t.range[e],i=Math.abs(a-t.range[1-e]);return"date"===t.type?a:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,n.format("."+r+"g")(Math.pow(10,a))):(r=Math.floor(Math.log(Math.abs(a))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,n.format("."+String(r)+"g")(a))}(s,c),p="left",d="middle";if(s.fixedrange)return;g?(d="n"===g?"top":"bottom","right"===s.side&&(p="right")):"e"===L&&(p="right"),a._context.showAxisRangeEntryBoxes&&n.select(vt).call(l.makeEditable,{gd:a,immediate:!0,background:a._fullLayout.paper_bgcolor,text:String(f),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:p,verticalAlign:d}).on("edit",(function(t){var e=s.d2r(t);void 0!==e&&o.call("_guiRelayout",a,u,e)}))}}}function Pt(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min($,e+yt)),a=Math.max(0,Math.min(tt,r+xt)),i=Math.abs(n-yt),o=Math.abs(a-xt);function s(){kt="",bt.r=bt.l,bt.t=bt.b,At.attr("d","M0,0Z")}if(bt.l=Math.min(yt,n),bt.r=Math.max(yt,n),bt.t=Math.min(xt,a),bt.b=Math.max(xt,a),et.isSubplotConstrained)i>C||o>C?(kt="xy",i/$>o/tt?(o=i*tt/$,xt>a?bt.t=xt-o:bt.b=xt+o):(i=o*$/tt,yt>n?bt.l=yt-i:bt.r=yt+i),At.attr("d",q(bt))):s();else if(rt.isSubplotConstrained)if(i>C||o>C){kt="xy";var l=Math.min(bt.l/$,(tt-bt.b)/tt),c=Math.max(bt.r/$,(tt-bt.t)/tt);bt.l=l*$,bt.r=c*$,bt.b=(1-l)*tt,bt.t=(1-c)*tt,At.attr("d",q(bt))}else s();else!at||og[1]-1/4096&&(e.domain=s),a.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":749,"fast-isnumeric":241}],815:[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 a=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(i+(a[0]-i)*e),t.l2r(i+(a[1]-i)*e)]}},{"../../constants/alignment":717}],816:[function(t,e,r){"use strict";var n=t("polybooljs"),a=t("../../registry"),i=t("../../components/drawing").dashStyle,o=t("../../components/color"),s=t("../../components/fx"),l=t("../../components/fx/helpers").makeEventData,c=t("../../components/dragelement/helpers"),u=c.freeMode,h=c.rectMode,f=c.drawMode,p=c.openMode,d=c.selectMode,g=t("../../components/shapes/draw_newshape/display_outlines"),m=t("../../components/shapes/draw_newshape/helpers").handleEllipse,v=t("../../components/shapes/draw_newshape/newshapes"),y=t("../../lib"),x=t("../../lib/polygon"),b=t("../../lib/throttle"),_=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),T=t("../../plot_api/subroutines").redrawReglTraces,k=t("./constants"),M=k.MINSELECT,A=x.filter,S=x.tester,E=t("./handle_outline").clearSelect,C=t("./helpers"),L=C.p2r,P=C.axValue,I=C.getTransform;function z(t,e,r,n,a,i,o){var s,l,c,u,h,f,d,m,v,y=e._hoverdata,x=e._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(y)){F(t,e,i);var _=function(t,e){var r,n,a=t[0],i=-1,o=[];for(n=0;n0?function(t,e){var r,n,a,i=[];for(a=0;a0&&i.push(r);if(1===i.length&&i[0]===e.searchInfo&&(n=e.searchInfo.cd[0].trace).selectedpoints.length===e.pointNumbers.length){for(a=0;a1)return!1;if((a+=r.selectedpoints.length)>1)return!1}return 1===a}(s)&&(f=j(_))){for(o&&o.remove(),v=0;v=0&&n._fullLayout._deactivateShape(n),f(e)){var i=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(i&&n._fullLayout._drawing){var o=v(i,t);o&&a.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function N(t,e,r,n){var a,i,o,s=[],l=e.map((function(t){return t._id})),c=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(a)>-1}function U(t,e,r){var n,i,o,s;for(n=0;n=0)W._fullLayout._deactivateShape(W);else if(!j){var r=Z.clickmode;b.done(ft).then((function(){if(b.clear(ft),2===t){for(lt.remove(),w=0;w-1&&z(e,W,a.xaxes,a.yaxes,a.subplot,a,lt),"event"===r&&W.emit("plotly_selected",void 0);s.click(W,e)})).catch(y.error)}},a.doneFn=function(){ht.remove(),b.done(ft).then((function(){b.clear(ft),a.gd.emit("plotly_selected",E),_&&a.selectionDefs&&(_.subtract=st,a.selectionDefs.push(_),a.mergedPolygons.length=0,[].push.apply(a.mergedPolygons,x)),a.doneFnCompleted&&a.doneFnCompleted(pt)})).catch(y.error),j&&B(a)}},clearSelect:E,clearSelectionsCache:B,selectOnClick:z}},{"../../components/color":615,"../../components/dragelement/helpers":633,"../../components/drawing":637,"../../components/fx":655,"../../components/fx/helpers":651,"../../components/shapes/draw_newshape/display_outlines":700,"../../components/shapes/draw_newshape/helpers":701,"../../components/shapes/draw_newshape/newshapes":702,"../../lib":749,"../../lib/clear_gl_canvases":733,"../../lib/polygon":761,"../../lib/throttle":774,"../../plot_api/subroutines":788,"../../registry":880,"./axis_ids":800,"./constants":803,"./handle_outline":807,"./helpers":808,polybooljs:491}],817:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-time-format").utcFormat,i=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,h=o.isArrayOrTypedArray,f=t("../../constants/numerical"),p=f.FP_SAFE,d=f.BADNUM,g=f.LOG_CLIP,m=f.ONEWEEK,v=f.ONEDAY,y=f.ONEHOUR,x=f.ONEMIN,b=f.ONESEC,_=t("./axis_ids"),w=t("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function M(t){return Math.pow(10,t)}function A(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",f=r.charAt(0);function S(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],a=t.range[1];return.5*(n+a-2*g*Math.abs(n-a))}return d}function E(e,r,n,a){if((a||{}).msUTC&&i(e))return+e;var s=c(e,n||t.calendar);if(s===d){if(!i(e))return d;e=+e;var l=Math.floor(10*o.mod(e+.05,1)),u=Math.round(e-l/10);s=c(new Date(u))+l/10}return s}function C(e,r,n){return l(e,r,n||t.calendar)}function L(e){return t._categories[Math.round(e)]}function P(e){if(A(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function I(e){if(t._categoriesMap)return t._categoriesMap[e]}function z(t){var e=I(t);return void 0!==e?e:i(t)?+t:void 0}function O(t,e,r){return n.round(r+e*t,2)}function D(t,e,r){return(t-r)/e}var R=function(e){return i(e)?O(e,t._m,t._b):d},F=function(e){return D(e,t._m,t._b)};if(t.rangebreaks){var B="y"===f;R=function(e){if(!i(e))return d;var r=t._rangebreaks.length;if(!r)return O(e,t._m,t._b);var n=B;t.range[0]>t.range[1]&&(n=!n);for(var a=n?-1:1,o=a*e,s=0,l=0;lu)){s=o<(c+u)/2?l:l+1;break}s=l+1}var h=t._B[s]||0;return isFinite(h)?O(e,t._m2,h):0},F=function(e){var r=t._rangebreaks.length;if(!r)return D(e,t._m,t._b);for(var n=0,a=0;at._rangebreaks[a].pmax&&(n=a+1);return D(e,t._m2,t._B[n])}}t.c2l="log"===t.type?S:u,t.l2c="log"===t.type?M:u,t.l2p=R,t.p2l=F,t.c2p="log"===t.type?function(t,e){return R(S(t,e))}:R,t.p2c="log"===t.type?function(t){return M(F(t))}:F,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=F,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return S(s(t),e)},t.r2d=t.r2c=function(t){return M(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=u,t.c2r=S,t.l2d=M,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return M(F(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=F,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=E,t.c2d=t.c2r=t.l2d=t.l2r=C,t.d2p=t.r2p=function(e,r,n){return t.l2p(E(e,0,n))},t.p2d=t.p2r=function(t,e,r){return C(F(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=P,t.r2d=t.c2d=t.l2d=L,t.d2r=t.d2l_noadd=z,t.r2c=function(e){var r=z(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=z,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return L(F(t))},t.r2p=t.d2p,t.p2r=F,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=L,t.d2r=t.d2l_noadd=z,t.r2c=function(e){var r=z(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=I,t.l2r=t.c2r=u,t.r2l=z,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return L(F(t))},t.r2p=t.d2p,t.p2r=F,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:u(t)},t.setupMultiCategory=function(n){var a,i,s=t._traceIndices,l=e._axisMatchGroups;if(l&&l.length&&0===t._categories.length)for(a=0;ap&&(s[n]=p),s[0]===s[1]){var c=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=c,s[1]+=c}}else o.nestedProperty(t,e).set(a)},t.setScale=function(r){var n=e._size;if(t.overlaying){var a=_.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var i=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(i);var s,l,c=t.r2l(t[i][0],o),u=t.r2l(t[i][1],o),h="y"===f;if((h?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(c,u),Math.max(c,u)),t._rangebreaks.length)){for(s=0;su&&(p=!p),p&&t._rangebreaks.reverse();var d=p?-1:1;for(t._m2=d*t._length/(Math.abs(u-c)-t._lBreaks),t._B.push(-t._m2*(h?u:c)),s=0;sa&&(a+=7,ia&&(a+=24,i=n&&i=n&&e=s.min&&(ts.max&&(s.max=n),a=!1)}a&&c.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function m(e,r){var n=e.plotinfo,a=n.xaxis,l=n.yaxis,c=a._length,u=l._length,h=!!e.xr1,f=!!e.yr1,p=[];if(h){var d=i.simpleMap(e.xr0,a.r2l),g=i.simpleMap(e.xr1,a.r2l),m=d[1]-d[0],v=g[1]-g[0];p[0]=(d[0]*(1-r)+r*g[0]-d[0])/(d[1]-d[0])*c,p[2]=c*(1-r+r*v/m),a.range[0]=a.l2r(d[0]*(1-r)+r*g[0]),a.range[1]=a.l2r(d[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(f){var y=i.simpleMap(e.yr0,l.r2l),x=i.simpleMap(e.yr1,l.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),l.range[0]=a.l2r(y[0]*(1-r)+r*x[0]),l.range[1]=l.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;s.drawOne(t,a,{skipTitle:!0}),s.drawOne(t,l,{skipTitle:!0}),s.redrawComponents(t,[a._id,l._id]);var w=h?c/p[2]:1,T=f?u/p[3]:1,k=h?p[0]:0,M=f?p[1]:0,A=h?p[0]/p[2]*c:0,S=f?p[1]/p[3]*u:0,E=a._offset-A,C=l._offset-S;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,E,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}s.redrawComponents(t)}},{"../../components/drawing":637,"../../lib":749,"../../registry":880,"./axes":797,d3:169}],822:[function(t,e,r){"use strict";var n=t("../../registry").traceIs,a=t("./axis_autotype");function i(t){return{v:"x",h:"y"}[t.orientation||"v"]}function o(t,e){var r=i(t),a=n(t,"box-violin"),o=n(t._fullInput||{},"candlestick");return a&&!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,s=t._id,l=s.charAt(0);-1!==s.indexOf("scene")&&(s=l);var c=function(t,e,r){for(var n=0;n0&&(a["_"+r+"axes"]||{})[e])return a;if((a[r+"axis"]||r)===e){if(o(a,r))return a;if((a[r]||[]).length||a[r+"0"])return a}}}(e,s,l);if(!c)return;if("histogram"===c.type&&l==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=l+"calendar",h=c[u],f={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&l==={h:"x",v:"y"}[c.orientation||"v"]&&(f.noMultiCategory=!0);if(o(c,l)){var p=i(c),d=[];for(r=0;r0?".":"")+i;a.isPlainObject(o)?l(o,e,s,n+1):e(s,i,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 c=r.hasSimpleAPICommandBindings(t,n,s.lookupTable);if(e&&e._commandObserver){if(c)return s;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,s}if(c){i(t,c,s.cache),s.check=function(){if(l){var e=i(t,c,s.cache);return e.changed&&o&&void 0!==s.lookupTable[e.value]&&(s.disable(),Promise.resolve(o({value:e.value,type:c.type,prop:c.prop,traces:c.traces,index:s.lookupTable[e.value]})).then(s.enable,s.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],h=0;h0&&a<0&&(a+=360);var s=(a-n)/4;return{type:"Polygon",coordinates:[[[n,i],[n,o],[n+s,o],[n+2*s,o],[n+3*s,o],[a,o],[a,i],[a-s,i],[a-2*s,i],[a-3*s,i],[n,i]]]}}e.exports=function(t){return new _(t)},w.plot=function(t,e,r){var n=this,a=e[this.id],i=[],o=!1;for(var s in v.layerNameToAdjective)if("frame"!==s&&a["show"+s]){o=!0;break}for(var l=0;l0&&i._module.calcGeoJSON(a,e)}if(!this.updateProjection(t,e)){this.viewInitial&&this.scope===r.scope||this.saveViewInitial(r),this.scope=r.scope,this.updateBaseLayers(e,r),this.updateDims(e,r),this.updateFx(e,r),c.generalUpdatePerTraceModule(this.graphDiv,this,t,r);var o=this.layers.frontplot.select(".scatterlayer");this.dataPoints.point=o.selectAll(".point"),this.dataPoints.text=o.selectAll("text"),this.dataPaths.line=o.selectAll(".js-line");var s=this.layers.backplot.select(".choroplethlayer");this.dataPaths.choropleth=s.selectAll("path"),this.render()}},w.updateProjection=function(t,e){var r=this.graphDiv,o=e[this.id],s=e._size,l=o.domain,c=o.projection,u=o.lonaxis,f=o.lataxis,p=u._ax,d=f._ax,g=this.projection=function(t){for(var e=t.projection.type,r=n.geo[v.projNames[e]](),a=t._isClipped?v.lonaxisSpan[e]/2:null,i=["center","rotate","parallels","clipExtent"],o=function(t){return t?r:[]},s=0;sa*Math.PI/180}return!1},r.getPath=function(){return n.geo.path().projection(r)},r.getBounds=function(t){return r.getPath().bounds(t)},r.fitExtent=function(t,e){var n=t[1][0]-t[0][0],a=t[1][1]-t[0][1],i=r.clipExtent&&r.clipExtent();r.scale(150).translate([0,0]),i&&r.clipExtent(null);var o=r.getBounds(e),s=Math.min(n/(o[1][0]-o[0][0]),a/(o[1][1]-o[0][1])),l=+t[0][0]+(n-s*(o[1][0]+o[0][0]))/2,c=+t[0][1]+(a-s*(o[1][1]+o[0][1]))/2;return i&&r.clipExtent(i),r.scale(150*s).translate([l,c])},r.precision(v.precision),a&&r.clipAngle(a-v.clipPad);return r}(o),m=[[s.l+s.w*l.x[0],s.t+s.h*(1-l.y[1])],[s.l+s.w*l.x[1],s.t+s.h*(1-l.y[0])]],y=o.center||{},x=c.rotation||{},b=u.range||[],_=f.range||[];if(o.fitbounds){p._length=m[1][0]-m[0][0],d._length=m[1][1]-m[0][1],p.range=h(r,p),d.range=h(r,d);var w=(p.range[0]+p.range[1])/2,k=(d.range[0]+d.range[1])/2;if(o._isScoped)y={lon:w,lat:k};else if(o._isClipped){y={lon:w,lat:k},x={lon:w,lat:k,roll:x.roll};var M=c.type,A=v.lonaxisSpan[M]/2||180,S=v.lataxisSpan[M]/2||90;b=[w-A,w+A],_=[k-S,k+S]}else y={lon:w,lat:k},x={lon:w,lat:x.lat,roll:x.roll}}g.center([y.lon-x.lon,y.lat-x.lat]).rotate([-x.lon,-x.lat,x.roll]).parallels(c.parallels);var E=T(b,_);g.fitExtent(m,E);var C=this.bounds=g.getBounds(E),L=this.fitScale=g.scale(),P=g.translate();if(!isFinite(C[0][0])||!isFinite(C[0][1])||!isFinite(C[1][0])||!isFinite(C[1][1])||isNaN(P[0])||isNaN(P[0])){for(var I=["fitbounds","projection.rotation","center","lonaxis.range","lataxis.range"],z="Invalid geo settings, relayout'ing to default view.",O={},D=0;D-1&&g(n.event,i,[r.xaxis],[r.yaxis],r.id,h),c.indexOf("event")>-1&&l.click(i,n.event))}))}function v(t){return r.projection.invert([t[0]+r.xaxis._offset,t[1]+r.yaxis._offset])}},w.makeFramework=function(){var t=this,e=t.graphDiv,r=e._fullLayout,a="clip"+r._uid+t.id;t.clipDef=r._clips.append("clipPath").attr("id",a),t.clipRect=t.clipDef.append("rect"),t.framework=n.select(t.container).append("g").attr("class","geo "+t.id).call(s.setClipUrl,a,e),t.project=function(e){var r=t.projection(e);return r?[r[0]-t.xaxis._offset,r[1]-t.yaxis._offset]:[null,null]},t.xaxis={_id:"x",c2p:function(e){return t.project(e)[0]}},t.yaxis={_id:"y",c2p:function(e){return t.project(e)[1]}},t.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},u.setConvert(t.mockAxis,r)},w.saveViewInitial=function(t){var e,r=t.center||{},n=t.projection,a=n.rotation||{};this.viewInitial={fitbounds:t.fitbounds,"projection.scale":n.scale},e=t._isScoped?{"center.lon":r.lon,"center.lat":r.lat}:t._isClipped?{"projection.rotation.lon":a.lon,"projection.rotation.lat":a.lat}:{"center.lon":r.lon,"center.lat":r.lat,"projection.rotation.lon":a.lon},i.extendFlat(this.viewInitial,e)},w.render=function(){var t,e=this.projection,r=e.getPath();function n(t){var r=e(t.lonlat);return r?"translate("+r[0]+","+r[1]+")":null}function a(t){return e.isLonLatOverEdges(t.lonlat)?"none":null}for(t in this.basePaths)this.basePaths[t].attr("d",r);for(t in this.dataPaths)this.dataPaths[t].attr("d",(function(t){return r(t.geojson)}));for(t in this.dataPoints)this.dataPoints[t].attr("display",a).attr("transform",n)}},{"../../components/color":615,"../../components/dragelement":634,"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/geo_location_utils":742,"../../lib/topojson_utils":776,"../../registry":880,"../cartesian/autorange":796,"../cartesian/axes":797,"../cartesian/select":816,"../plots":860,"./constants":827,"./projections":832,"./zoom":833,d3:169,"topojson-client":551}],829:[function(t,e,r){"use strict";var n=t("../../plots/get_data").getSubplotCalcData,a=t("../../lib").counterRegex,i=t("./geo"),o="geo",s=a(o),l={};l.geo={valType:"subplotid",dflt:o,editType:"calc"},e.exports={attr:o,name:o,idRoot:o,idRegex:s,attrRegex:s,attributes:l,layoutAttributes:t("./layout_attributes"),supplyLayoutDefaults:t("./layout_defaults"),plot:function(t){for(var e=t._fullLayout,r=t.calcdata,a=e._subplots.geo,s=0;s0&&L<0&&(L+=360);var P,I,z,O=(C+L)/2;if(!p){var D=d?h.projRotate:[O,0,0];P=r("projection.rotation.lon",D[0]),r("projection.rotation.lat",D[1]),r("projection.rotation.roll",D[2]),r("showcoastlines",!d&&y)&&(r("coastlinecolor"),r("coastlinewidth")),r("showocean",!!y&&void 0)&&r("oceancolor")}(p?(I=-96.6,z=38.7):(I=d?O:P,z=(E[0]+E[1])/2),r("center.lon",I),r("center.lat",z),g)&&r("projection.parallels",h.projParallels||[0,60]);r("projection.scale"),r("showland",!!y&&void 0)&&r("landcolor"),r("showlakes",!!y&&void 0)&&r("lakecolor"),r("showrivers",!!y&&void 0)&&(r("rivercolor"),r("riverwidth")),r("showcountries",d&&"usa"!==u&&y)&&(r("countrycolor"),r("countrywidth")),("usa"===u||"north america"===u&&50===c)&&(r("showsubunits",y),r("subunitcolor"),r("subunitwidth")),d||r("showframe",y)&&(r("framecolor"),r("framewidth")),r("bgcolor"),r("fitbounds")&&(delete e.projection.scale,d?(delete e.center.lon,delete e.center.lat):m?(delete e.center.lon,delete e.center.lat,delete e.projection.rotation.lon,delete e.projection.rotation.lat,delete e.lonaxis.range,delete e.lataxis.range):(delete e.center.lon,delete e.center.lat,delete e.projection.rotation.lon))}e.exports=function(t,e,r){a(t,e,r,{type:"geo",attributes:s,handleDefaults:c,fullData:r,partition:"y"})}},{"../../lib":749,"../get_data":834,"../subplot_defaults":874,"./constants":827,"./layout_attributes":830}],832:[function(t,e,r){"use strict";e.exports=function(t){function e(t,e){return{type:"Feature",id:t.id,properties:t.properties,geometry:r(t.geometry,e)}}function r(e,n){if(!e)return null;if("GeometryCollection"===e.type)return{type:"GeometryCollection",geometries:object.geometries.map((function(t){return r(t,n)}))};if(!c.hasOwnProperty(e.type))return null;var a=c[e.type];return t.geo.stream(e,n(a)),a.result()}t.geo.project=function(t,e){var a=e.stream;if(!a)throw new Error("not yet supported");return(t&&n.hasOwnProperty(t.type)?n[t.type]:r)(t,a)};var n={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map((function(t){return e(t,r)}))}}},a=[],i=[],o={point:function(t,e){a.push([t,e])},result:function(){var t=a.length?a.length<2?{type:"Point",coordinates:a[0]}:{type:"MultiPoint",coordinates:a}:null;return a=[],t}},s={lineStart:u,point:function(t,e){a.push([t,e])},lineEnd:function(){a.length&&(i.push(a),a=[])},result:function(){var t=i.length?i.length<2?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i}:null;return i=[],t}},l={polygonStart:u,lineStart:u,point:function(t,e){a.push([t,e])},lineEnd:function(){var t=a.length;if(t){do{a.push(a[0].slice())}while(++t<4);i.push(a),a=[]}},polygonEnd:u,result:function(){if(!i.length)return null;var t=[],e=[];return i.forEach((function(r){!function(t){if((e=t.length)<4)return!1;var e,r=0,n=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];for(;++rn^p>n&&r<(f-c)*(n-u)/(p-u)+c&&(a=!a)}return a}(t[0],r))return t.push(e),!0}))||t.push([e])})),i=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},c={Point:o,MultiPoint:o,LineString:s,MultiLineString:s,Polygon:l,MultiPolygon:l,Sphere:l};function u(){}var h=1e-6,f=Math.PI,p=f/2,d=(Math.sqrt(f),f/180),g=180/f;function m(t){return t>1?p:t<-1?-p:Math.asin(t)}function v(t){return t>1?0:t<-1?f:Math.acos(t)}var y=t.geo.projection,x=t.geo.projectionMutator;function b(t,e){var r=(2+p)*Math.sin(e);e/=2;for(var n=0,a=1/0;n<10&&Math.abs(a)>h;n++){var i=Math.cos(e);e-=a=(e+Math.sin(e)*(i+2)-r)/(2*i*(1+i))}return[2/Math.sqrt(f*(4+f))*t*(1+Math.cos(e)),2*Math.sqrt(f/(4+f))*Math.sin(e)]}t.geo.interrupt=function(e){var r,n=[[[[-f,0],[0,p],[f,0]]],[[[-f,0],[0,-p],[f,0]]]];function a(t,r){for(var a=r<0?-1:1,i=n[+(r<0)],o=0,s=i.length-1;oi[o][2][0];++o);var l=e(t-i[o][1][0],r);return l[0]+=e(i[o][1][0],a*r>a*i[o][0][1]?i[o][0][1]:r)[0],l}function i(){r=n.map((function(t){return t.map((function(t){var r,n=e(t[0][0],t[0][1])[0],a=e(t[2][0],t[2][1])[0],i=e(t[1][0],t[0][1])[1],o=e(t[1][0],t[1][1])[1];return i>o&&(r=i,i=o,o=r),[[n,i],[a,o]]}))}))}e.invert&&(a.invert=function(t,i){for(var o=r[+(i<0)],s=n[+(i<0)],l=0,u=o.length;l=0;--a){var p;o=180*(p=n[1][a])[0][0]/f,s=180*p[0][1]/f,c=180*p[1][1]/f,u=180*p[2][0]/f,h=180*p[2][1]/f;r.push(l([[u-e,h-e],[u-e,c+e],[o+e,c+e],[o+e,s-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}(),i)},a},o.lobes=function(t){return arguments.length?(n=t.map((function(t){return t.map((function(t){return[[t[0][0]*f/180,t[0][1]*f/180],[t[1][0]*f/180,t[1][1]*f/180],[t[2][0]*f/180,t[2][1]*f/180]]}))})),i(),o):n.map((function(t){return t.map((function(t){return[[180*t[0][0]/f,180*t[0][1]/f],[180*t[1][0]/f,180*t[1][1]/f],[180*t[2][0]/f,180*t[2][1]/f]]}))}))},o},b.invert=function(t,e){var r=.5*e*Math.sqrt((4+f)/f),n=m(r),a=Math.cos(n);return[t/(2/Math.sqrt(f*(4+f))*(1+a)),m((n+r*(a+2))/(2+p))]},(t.geo.eckert4=function(){return y(b)}).raw=b;var _=t.geo.azimuthalEqualArea.raw;function w(t,e){if(arguments.length<2&&(e=t),1===e)return _;if(e===1/0)return T;function r(r,n){var a=_(r/e,n);return a[0]*=t,a}return r.invert=function(r,n){var a=_.invert(r/t,n);return a[0]*=e,a},r}function T(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function k(t,e){return[3*t/(2*f)*Math.sqrt(f*f/3-e*e),e]}function M(t,e){return[t,1.25*Math.log(Math.tan(f/4+.4*e))]}function A(t){return function(e){var r,n=t*Math.sin(e),a=30;do{e-=r=(e+Math.sin(e)-n)/(1+Math.cos(e))}while(Math.abs(r)>h&&--a>0);return e/2}}T.invert=function(t,e){var r=2*m(e/2);return[t*Math.cos(r/2)/Math.cos(r),r]},(t.geo.hammer=function(){var t=2,e=x(w),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}).raw=w,k.invert=function(t,e){return[2/3*f*t/Math.sqrt(f*f/3-e*e),e]},(t.geo.kavrayskiy7=function(){return y(k)}).raw=k,M.invert=function(t,e){return[t,2.5*Math.atan(Math.exp(.8*e))-.625*f]},(t.geo.miller=function(){return y(M)}).raw=M,A(f);var S=function(t,e,r){var n=A(r);function a(r,a){return[t*r*Math.cos(a=n(a)),e*Math.sin(a)]}return a.invert=function(n,a){var i=m(a/e);return[n/(t*Math.cos(i)),m((2*i+Math.sin(2*i))/r)]},a}(Math.SQRT2/p,Math.SQRT2,f);function E(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791)),e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))]}(t.geo.mollweide=function(){return y(S)}).raw=S,E.invert=function(t,e){var r,n=e,a=25;do{var i=n*n,o=i*i;n-=r=(n*(1.007226+i*(.015085+o*(.028874*i-.044475-.005916*o)))-e)/(1.007226+i*(.045255+o*(.259866*i-.311325-.005916*11*o)))}while(Math.abs(r)>h&&--a>0);return[t/(.8707+(i=n*n)*(i*(i*i*i*(.003971-.001529*i)-.013791)-.131979)),n]},(t.geo.naturalEarth=function(){return y(E)}).raw=E;var C=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];function L(t,e){var r,n=Math.min(18,36*Math.abs(e)/f),a=Math.floor(n),i=n-a,o=(r=C[a])[0],s=r[1],l=(r=C[++a])[0],c=r[1],u=(r=C[Math.min(19,++a)])[0],h=r[1];return[t*(l+i*(u-o)/2+i*i*(u-2*l+o)/2),(e>0?p:-p)*(c+i*(h-s)/2+i*i*(h-2*c+s)/2)]}function P(t,e){return[t*Math.cos(e),e]}function I(t,e){var r,n=Math.cos(e),a=(r=v(n*Math.cos(t/=2)))?r/Math.sin(r):1;return[2*n*Math.sin(t)*a,Math.sin(e)*a]}function z(t,e){var r=I(t,e);return[(r[0]+t/p)/2,(r[1]+e)/2]}C.forEach((function(t){t[1]*=1.0144})),L.invert=function(t,e){var r=e/p,n=90*r,a=Math.min(18,Math.abs(n/5)),i=Math.max(0,Math.floor(a));do{var o=C[i][1],s=C[i+1][1],l=C[Math.min(19,i+2)][1],c=l-o,u=l-2*s+o,h=2*(Math.abs(r)-s)/c,f=u/c,m=h*(1-f*h*(1-2*f*h));if(m>=0||1===i){n=(e>=0?5:-5)*(m+a);var v,y=50;do{m=(a=Math.min(18,Math.abs(n)/5))-(i=Math.floor(a)),o=C[i][1],s=C[i+1][1],l=C[Math.min(19,i+2)][1],n-=(v=(e>=0?p:-p)*(s+m*(l-o)/2+m*m*(l-2*s+o)/2)-e)*g}while(Math.abs(v)>1e-12&&--y>0);break}}while(--i>=0);var x=C[i][0],b=C[i+1][0],_=C[Math.min(19,i+2)][0];return[t/(b+m*(_-x)/2+m*m*(_-2*b+x)/2),n*d]},(t.geo.robinson=function(){return y(L)}).raw=L,P.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return y(P)}).raw=P,I.invert=function(t,e){if(!(t*t+4*e*e>f*f+h)){var r=t,n=e,a=25;do{var i,o=Math.sin(r),s=Math.sin(r/2),l=Math.cos(r/2),c=Math.sin(n),u=Math.cos(n),p=Math.sin(2*n),d=c*c,g=u*u,m=s*s,y=1-g*l*l,x=y?v(u*l)*Math.sqrt(i=1/y):i=0,b=2*x*u*s-t,_=x*c-e,w=i*(g*m+x*u*l*d),T=i*(.5*o*p-2*x*c*s),k=.25*i*(p*s-x*c*g*o),M=i*(d*l+x*m*u),A=T*k-M*w;if(!A)break;var S=(_*T-b*M)/A,E=(b*k-_*w)/A;r-=S,n-=E}while((Math.abs(S)>h||Math.abs(E)>h)&&--a>0);return[r,n]}},(t.geo.aitoff=function(){return y(I)}).raw=I,z.invert=function(t,e){var r=t,n=e,a=25;do{var i,o=Math.cos(n),s=Math.sin(n),l=Math.sin(2*n),c=s*s,u=o*o,f=Math.sin(r),d=Math.cos(r/2),g=Math.sin(r/2),m=g*g,y=1-u*d*d,x=y?v(o*d)*Math.sqrt(i=1/y):i=0,b=.5*(2*x*o*g+r/p)-t,_=.5*(x*s+n)-e,w=.5*i*(u*m+x*o*d*c)+.5/p,T=i*(f*l/4-x*s*g),k=.125*i*(l*g-x*s*u*f),M=.5*i*(c*d+x*m*o)+.5,A=T*k-M*w,S=(_*T-b*M)/A,E=(b*k-_*w)/A;r-=S,n-=E}while((Math.abs(S)>h||Math.abs(E)>h)&&--a>0);return[r,n]},(t.geo.winkel3=function(){return y(z)}).raw=z}},{}],833:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../registry"),o=Math.PI/180,s=180/Math.PI,l={cursor:"pointer"},c={cursor:"auto"};function u(t,e){return n.behavior.zoom().translate(e.translate()).scale(e.scale())}function h(t,e,r){var n=t.id,o=t.graphDiv,s=o.layout,l=s[n],c=o._fullLayout,u=c[n],h={},f={};function p(t,e){h[n+"."+t]=a.nestedProperty(l,t).get(),i.call("_storeDirectGUIEdit",s,c._preGUI,h);var r=a.nestedProperty(u,t);r.get()!==e&&(r.set(e),a.nestedProperty(l,t).set(e),f[n+"."+t]=e)}r(p),p("projection.scale",e.scale()/t.fitScale),p("fitbounds",!1),o.emit("plotly_relayout",f)}function f(t,e){var r=u(0,e);function a(r){var n=e.invert(t.midPt);r("center.lon",n[0]),r("center.lat",n[1])}return r.on("zoomstart",(function(){n.select(this).style(l)})).on("zoom",(function(){e.scale(n.event.scale).translate(n.event.translate),t.render();var r=e.invert(t.midPt);t.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":e.scale()/t.fitScale,"geo.center.lon":r[0],"geo.center.lat":r[1]})})).on("zoomend",(function(){n.select(this).style(c),h(t,e,a)})),r}function p(t,e){var r,a,i,o,s,f,p,d,g,m=u(0,e);function v(t){return e.invert(t)}function y(r){var n=e.rotate(),a=e.invert(t.midPt);r("projection.rotation.lon",-n[0]),r("center.lon",a[0]),r("center.lat",a[1])}return m.on("zoomstart",(function(){n.select(this).style(l),r=n.mouse(this),a=e.rotate(),i=e.translate(),o=a,s=v(r)})).on("zoom",(function(){if(f=n.mouse(this),function(t){var r=v(t);if(!r)return!0;var n=e(r);return Math.abs(n[0]-t[0])>2||Math.abs(n[1]-t[1])>2}(r))return m.scale(e.scale()),void m.translate(e.translate());e.scale(n.event.scale),e.translate([i[0],n.event.translate[1]]),s?v(f)&&(d=v(f),p=[o[0]+(d[0]-s[0]),a[1],a[2]],e.rotate(p),o=p):s=v(r=f),g=!0,t.render();var l=e.rotate(),c=e.invert(t.midPt);t.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":e.scale()/t.fitScale,"geo.center.lon":c[0],"geo.center.lat":c[1],"geo.projection.rotation.lon":-l[0]})})).on("zoomend",(function(){n.select(this).style(c),g&&h(t,e,y)})),m}function d(t,e){var r,a={r:e.rotate(),k:e.scale()},i=u(0,e),o=function(t){var e=0,r=arguments.length,a=[];for(;++ed?(i=(h>0?90:-90)-p,a=0):(i=Math.asin(h/d)*s-p,a=Math.sqrt(d*d-h*h));var g=180-i-2*p,m=(Math.atan2(f,u)-Math.atan2(c,a))*s,v=(Math.atan2(f,u)-Math.atan2(c,-a))*s;return b(r[0],r[1],i,m)<=b(r[0],r[1],g,v)?[i,m,r[2]]:[g,v,r[2]]}function b(t,e,r,n){var a=_(r-t),i=_(n-e);return Math.sqrt(a*a+i*i)}function _(t){return(t%360+540)%360-180}function w(t,e,r){var n=r*o,a=t.slice(),i=0===e?1:0,s=2===e?1:2,l=Math.cos(n),c=Math.sin(n);return a[i]=t[i]*l-t[s]*c,a[s]=t[s]*l+t[i]*c,a}function T(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*s,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*s,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*s]}function k(t,e){for(var r=0,n=0,a=t.length;nMath.abs(s)?(c.boxEnd[1]=c.boxStart[1]+Math.abs(i)*_*(s>=0?1:-1),c.boxEnd[1]l[3]&&(c.boxEnd[1]=l[3],c.boxEnd[0]=c.boxStart[0]+(l[3]-c.boxStart[1])/Math.abs(_))):(c.boxEnd[0]=c.boxStart[0]+Math.abs(s)/_*(i>=0?1:-1),c.boxEnd[0]l[2]&&(c.boxEnd[0]=l[2],c.boxEnd[1]=c.boxStart[1]+(l[2]-c.boxStart[0])*Math.abs(_)))}}else c.boxEnabled?(i=c.boxStart[0]!==c.boxEnd[0],s=c.boxStart[1]!==c.boxEnd[1],i||s?(i&&(m(0,c.boxStart[0],c.boxEnd[0]),t.xaxis.autorange=!1),s&&(m(1,c.boxStart[1],c.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),c.boxEnabled=!1,c.boxInited=!1):c.boxInited&&(c.boxInited=!1);break;case"pan":c.boxEnabled=!1,c.boxInited=!1,e?(c.panning||(c.dragStart[0]=n,c.dragStart[1]=a),Math.abs(c.dragStart[0]-n).999&&(g="turntable"):g="turntable")}else g="turntable";r("dragmode",g),r("hovermode",n.getDfltFromLayout("hovermode"))}e.exports=function(t,e,r){var a=e._basePlotModules.length>1;o(t,e,r,{type:"gl3d",attributes:l,handleDefaults:u,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:function(e){if(!a)return n.validate(t[e],l[e])?t[e]:void 0},paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":615,"../../../lib":749,"../../../registry":880,"../../get_data":834,"../../subplot_defaults":874,"./axis_defaults":842,"./layout_attributes":845}],845:[function(t,e,r){"use strict";var n=t("./axis_attributes"),a=t("../../domain").attributes,i=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:i(s(0,0,1),{}),center:i(s(0,0,0),{}),eye:i(s(1.25,1.25,1.25),{}),projection:{type:{valType:"enumerated",values:["perspective","orthographic"],dflt:"perspective",editType:"calc"},editType:"calc"},editType:"camera"},domain:a({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":749,"../../../lib/extend":739,"../../domain":824,"./axis_attributes":841}],846:[function(t,e,r){"use strict";var n=t("../../../lib/str2rgbarray"),a=["xaxis","yaxis","zaxis"];function i(){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]}i.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[a[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 i;return e.merge(t),e}},{"../../../lib/str2rgbarray":772}],847:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,s=t.fullSceneLayout,l=[[],[],[]],c=0;c<3;++c){var u=s[i[c]];if(u._length=(r[c].hi-r[c].lo)*r[c].pixelsPerDataUnit/t.dataScale[c],Math.abs(u._length)===1/0||isNaN(u._length))l[c]=[];else{u._input_range=u.range.slice(),u.range[0]=r[c].lo/t.dataScale[c],u.range[1]=r[c].hi/t.dataScale[c],u._m=1/(t.dataScale[c]*r[c].pixelsPerDataUnit),u.range[0]===u.range[1]&&(u.range[0]-=1,u.range[1]+=1);var h=u.tickmode;if("auto"===u.tickmode){u.tickmode="linear";var f=u.nticks||a.constrain(u._length/40,4,9);n.autoTicks(u,Math.abs(u.range[1]-u.range[0])/f)}for(var p=n.calcTicks(u,{msUTC:!0}),d=0;d/g," "));l[c]=p,u.tickmode=h}}e.ticks=l;for(c=0;c<3;++c){o[c]=.5*(t.glplot.bounds[0][c]+t.glplot.bounds[1][c]);for(d=0;d<2;++d)e.bounds[d][c]=t.glplot.bounds[d][c]}t.contourLevels=function(t){for(var e=new Array(3),r=0;r<3;++r){for(var n=t[r],a=new Array(n.length),i=0;ir.deltaY?1.1:1/1.1,i=t.glplot.getAspectratio();t.glplot.setAspectratio({x:n*i.x,y:n*i.y,z:n*i.z})}a(t)}}),!!c&&{passive:!1}),t.glplot.canvas.addEventListener("mousemove",(function(){if(!1!==t.fullSceneLayout.dragmode&&0!==t.camera.mouseListener.buttons){var e=n();t.graphDiv.emit("plotly_relayouting",e)}})),t.staticMode||t.glplot.canvas.addEventListener("webglcontextlost",(function(r){e&&e.emit&&e.emit("plotly_webglcontextlost",{event:r,layer:t.id})}),!1),t.glplot.oncontextloss=function(){t.recoverContext()},t.glplot.onrender=function(){t.render()},!0},w.render=function(){var t,e=this,r=e.graphDiv,n=e.svgContainer,a=e.container.getBoundingClientRect(),i=a.width,o=a.height;n.setAttributeNS(null,"viewBox","0 0 "+i+" "+o),n.setAttributeNS(null,"width",i),n.setAttributeNS(null,"height",o),x(e),e.glplot.axes.update(e.axesOptions);for(var s,l=Object.keys(e.traces),c=null,u=e.glplot.selection,d=0;d")):"isosurface"===t.type||"volume"===t.type?(w.valueLabel=f.tickText(e._mockAxis,e._mockAxis.d2l(u.traceCoordinate[3]),"hover").text,A.push("value: "+w.valueLabel),u.textLabel&&A.push(u.textLabel),y=A.join("
")):y=u.textLabel;var S={x:u.traceCoordinate[0],y:u.traceCoordinate[1],z:u.traceCoordinate[2],data:b._input,fullData:b,curveNumber:b.index,pointNumber:_};p.appendArrayPointValue(S,b,_),t._module.eventData&&(S=b._module.eventData(S,u,b,{},_));var E={points:[S]};e.fullSceneLayout.hovermode&&p.loneHover({trace:b,x:(.5+.5*v[0]/v[3])*i,y:(.5-.5*v[1]/v[3])*o,xLabel:w.xLabel,yLabel:w.yLabel,zLabel:w.zLabel,text:y,name:c.name,color:p.castHoverOption(b,_,"bgcolor")||c.color,borderColor:p.castHoverOption(b,_,"bordercolor"),fontFamily:p.castHoverOption(b,_,"font.family"),fontSize:p.castHoverOption(b,_,"font.size"),fontColor:p.castHoverOption(b,_,"font.color"),nameLength:p.castHoverOption(b,_,"namelength"),textAlign:p.castHoverOption(b,_,"align"),hovertemplate:h.castOption(b,_,"hovertemplate"),hovertemplateLabels:h.extendFlat({},S,w),eventData:[S]},{container:n,gd:r}),u.buttons&&u.distance<5?r.emit("plotly_click",E):r.emit("plotly_hover",E),s=E}else p.loneUnhover(n),r.emit("plotly_unhover",s);e.drawAnnotations(e)},w.recoverContext=function(){var t=this;t.glplot.dispose();var e=function(){t.glplot.gl.isContextLost()?requestAnimationFrame(e):t.initializeGLPlot()?t.plot.apply(t,t.plotArgs):h.error("Catastrophic and unrecoverable WebGL error. Context lost.")};requestAnimationFrame(e)};var T=["xaxis","yaxis","zaxis"];function k(t,e,r){for(var n=t.fullSceneLayout,a=0;a<3;a++){var i=T[a],o=i.charAt(0),s=n[i],l=e[o],c=e[o+"calendar"],u=e["_"+o+"length"];if(h.isArrayOrTypedArray(l))for(var f,p=0;p<(u||l.length);p++)if(h.isArrayOrTypedArray(l[p]))for(var d=0;dm[1][i])m[0][i]=-1,m[1][i]=1;else{var C=m[1][i]-m[0][i];m[0][i]-=C/32,m[1][i]+=C/32}if("reversed"===s.autorange){var L=m[0][i];m[0][i]=m[1][i],m[1][i]=L}}else{var P=s.range;m[0][i]=s.r2l(P[0]),m[1][i]=s.r2l(P[1])}m[0][i]===m[1][i]&&(m[0][i]-=1,m[1][i]+=1),v[i]=m[1][i]-m[0][i],this.glplot.setBounds(i,{min:m[0][i]*f[i],max:m[1][i]*f[i]})}var I=c.aspectmode;if("cube"===I)g=[1,1,1];else if("manual"===I){var z=c.aspectratio;g=[z.x,z.y,z.z]}else{if("auto"!==I&&"data"!==I)throw new Error("scene.js aspectRatio was not one of the enumerated types");var O=[1,1,1];for(i=0;i<3;++i){var D=y[l=(s=c[T[i]]).type];O[i]=Math.pow(D.acc,1/D.count)/f[i]}g="data"===I||Math.max.apply(null,O)/Math.min.apply(null,O)<=4?O:[1,1,1]}c.aspectratio.x=u.aspectratio.x=g[0],c.aspectratio.y=u.aspectratio.y=g[1],c.aspectratio.z=u.aspectratio.z=g[2],this.glplot.setAspectratio(c.aspectratio),this.viewInitial.aspectratio||(this.viewInitial.aspectratio={x:c.aspectratio.x,y:c.aspectratio.y,z:c.aspectratio.z}),this.viewInitial.aspectmode||(this.viewInitial.aspectmode=c.aspectmode);var R=c.domain||null,F=e._size||null;if(R&&F){var B=this.container.style;B.position="absolute",B.left=F.l+R.x[0]*F.w+"px",B.top=F.t+(1-R.y[1])*F.h+"px",B.width=F.w*(R.x[1]-R.x[0])+"px",B.height=F.h*(R.y[1]-R.y[0])+"px"}this.glplot.redraw()}},w.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},w.getCamera=function(){var t;return this.camera.view.recalcMatrix(this.camera.view.lastT()),{up:{x:(t=this.camera).up[0],y:t.up[1],z:t.up[2]},center:{x:t.center[0],y:t.center[1],z:t.center[2]},eye:{x:t.eye[0],y:t.eye[1],z:t.eye[2]},projection:{type:!0===t._ortho?"orthographic":"perspective"}}},w.setViewport=function(t){var e,r=t.camera;this.camera.lookAt.apply(this,[[(e=r).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]]),this.glplot.setAspectratio(t.aspectratio),"orthographic"===r.projection.type!==this.camera._ortho&&(this.glplot.redraw(),this.glplot.clearRGBA(),this.glplot.dispose(),this.initializeGLPlot())},w.isCameraChanged=function(t){var e=this.getCamera(),r=h.nestedProperty(t,this.id+".camera").get();function n(t,e,r,n){var a=["up","center","eye"],i=["x","y","z"];return e[a[r]]&&t[a[r]][i[n]]===e[a[r]][i[n]]}var a=!1;if(void 0===r)a=!0;else{for(var i=0;i<3;i++)for(var o=0;o<3;o++)if(!n(e,r,i,o)){a=!0;break}(!r.projection||e.projection&&e.projection.type!==r.projection.type)&&(a=!0)}return a},w.isAspectChanged=function(t){var e=this.glplot.getAspectratio(),r=h.nestedProperty(t,this.id+".aspectratio").get();return void 0===r||r.x!==e.x||r.y!==e.y||r.z!==e.z},w.saveLayout=function(t){var e,r,n,a,i,o,s=this.fullLayout,l=this.isCameraChanged(t),c=this.isAspectChanged(t),f=l||c;if(f){var p={};if(l&&(e=this.getCamera(),n=(r=h.nestedProperty(t,this.id+".camera")).get(),p[this.id+".camera"]=n),c&&(a=this.glplot.getAspectratio(),o=(i=h.nestedProperty(t,this.id+".aspectratio")).get(),p[this.id+".aspectratio"]=o),u.call("_storeDirectGUIEdit",t,s._preGUI,p),l)r.set(e),h.nestedProperty(s,this.id+".camera").set(e);if(c)i.set(a),h.nestedProperty(s,this.id+".aspectratio").set(a),this.glplot.redraw()}return f},w.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,a=n._fullLayout,i=this.fullSceneLayout.camera,o=i.up.x,s=i.up.y,l=i.up.z;if(l/Math.sqrt(o*o+s*s+l*l)<.999){var c=this.id+".camera.up",f={x:0,y:0,z:1},p={};p[c]=f;var d=n.layout;u.call("_storeDirectGUIEdit",d,a._preGUI,p),i.up=f,h.nestedProperty(d,c).set(f)}}else r.keyBindingMode=t;this.fullSceneLayout.hovermode=e},w.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(n),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,a=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*a*4);e.readPixels(0,0,r,a,e.RGBA,e.UNSIGNED_BYTE,i),function(t,e,r){for(var n=0,a=r-1;n0)for(var s=255/o,l=0;l<3;++l)t[i+l]=Math.min(s*t[i+l],255)}}(i,r,a);var o=document.createElement("canvas");o.width=r,o.height=a;var s,l=o.getContext("2d"),c=l.createImageData(r,a);switch(c.data.set(i),l.putImageData(c,0,0),t){case"jpeg":s=o.toDataURL("image/jpeg");break;case"webp":s=o.toDataURL("image/webp");break;default:s=o.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(n),s},w.setConvert=function(){for(var t=0;t<3;t++){var e=this.fullSceneLayout[T[t]];f.setConvert(e,this.fullLayout),e.setScale=h.noop}},w.make4thDimension=function(){var t=this.graphDiv._fullLayout;this._mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},f.setConvert(this._mockAxis,t)},e.exports=_},{"../../components/fx":655,"../../lib":749,"../../lib/show_no_webgl_msg":770,"../../lib/str2rgbarray":772,"../../plots/cartesian/axes":797,"../../registry":880,"./layout/convert":843,"./layout/spikes":846,"./layout/tick_marks":847,"./project":848,"gl-plot3d":301,"has-passive-events":415,"is-mobile":441,"webgl-context":578}],850:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){n=n||t.length;for(var a=new Array(n),i=0;i\xa9 OpenStreetMap
',tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-osm-tiles",type:"raster",source:"plotly-osm-tiles",minzoom:0,maxzoom:22}]},"white-bg":{id:"white-bg",version:8,sources:{},layers:[{id:"white-bg",type:"background",paint:{"background-color":"#FFFFFF"},minzoom:0,maxzoom:22}]},"carto-positron":{id:"carto-positron",version:8,sources:{"plotly-carto-positron":{type:"raster",attribution:'\xa9 CARTO',tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-positron",type:"raster",source:"plotly-carto-positron",minzoom:0,maxzoom:22}]},"carto-darkmatter":{id:"carto-darkmatter",version:8,sources:{"plotly-carto-darkmatter":{type:"raster",attribution:'\xa9 CARTO',tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-darkmatter",type:"raster",source:"plotly-carto-darkmatter",minzoom:0,maxzoom:22}]},"stamen-terrain":{id:"stamen-terrain",version:8,sources:{"plotly-stamen-terrain":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under ODbL.',tiles:["https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-terrain",type:"raster",source:"plotly-stamen-terrain",minzoom:0,maxzoom:22}]},"stamen-toner":{id:"stamen-toner",version:8,sources:{"plotly-stamen-toner":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under ODbL.',tiles:["https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-toner",type:"raster",source:"plotly-stamen-toner",minzoom:0,maxzoom:22}]},"stamen-watercolor":{id:"stamen-watercolor",version:8,sources:{"plotly-stamen-watercolor":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under CC BY SA.',tiles:["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-watercolor",type:"raster",source:"plotly-stamen-watercolor",minzoom:0,maxzoom:22}]}},a=Object.keys(n);e.exports={requiredVersion:"1.10.1",styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",styleValuesMapbox:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],styleValueDflt:"basic",stylesNonMapbox:n,styleValuesNonMapbox:a,traceLayerPrefix:"plotly-trace-layer-",layoutLayerPrefix:"plotly-layout-layer-",wrongVersionErrorMsg:["Your custom plotly.js bundle is not using the correct mapbox-gl version","Please install mapbox-gl@1.10.1."].join("\n"),noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.plot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join("\n"),missingStyleErrorMsg:["No valid mapbox style found, please set `mapbox.style` to one of:",a.join(", "),"or register a Mapbox access token to use a Mapbox-served style."].join("\n"),multipleTokensErrorMsg:["Set multiple mapbox access token across different mapbox subplot,","using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join("\n"),mapOnErrorMsg:"Mapbox error.",mapboxLogo:{path0:"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z",path1:"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z",path2:"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z",polygon:"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34"},styleRules:{map:"overflow:hidden;position:relative;","missing-css":"display:none;",canary:"background-color:salmon;","ctrl-bottom-left":"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;","ctrl-bottom-right":"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;",ctrl:"clear: both; pointer-events: auto; transform: translate(0, 0);","ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner":"display: none;","ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner":"display: block; margin-top:2px","ctrl-attrib.mapboxgl-compact:hover":"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;","ctrl-attrib.mapboxgl-compact::after":'content: ""; cursor: pointer; position: absolute; background-image: url(\'data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath fill="%23333333" fill-rule="evenodd" d="M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0"/%3E %3C/svg%3E\'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;',"ctrl-attrib.mapboxgl-compact":"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;","ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; right: 0","ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; left: 0","ctrl-bottom-left .mapboxgl-ctrl":"margin: 0 0 10px 10px; float: left;","ctrl-bottom-right .mapboxgl-ctrl":"margin: 0 10px 10px 0; float: right;","ctrl-attrib":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a:hover":"color: inherit; text-decoration: underline;","ctrl-attrib .mapbox-improve-map":"font-weight: bold; margin-left: 2px;","attrib-empty":"display: none;","ctrl-logo":'display:block; width: 21px; height: 21px; background-image: url(\'data:image/svg+xml;charset=utf-8,%3C?xml version="1.0" encoding="utf-8"?%3E %3Csvg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve"%3E%3Cg transform="translate(0,0.01)"%3E%3Cpath d="m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z" style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3Cpath d="M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpath d="M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpolygon points="11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34 " style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3C/g%3E%3C/svg%3E\')'}}},{}],853:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r=t.split(" "),a=r[0],i=r[1],o=n.isArrayOrTypedArray(e)?n.mean(e):e,s=.5+o/100,l=1.5+o/100,c=["",""],u=[0,0];switch(a){case"top":c[0]="top",u[1]=-l;break;case"bottom":c[0]="bottom",u[1]=l}switch(i){case"left":c[1]="right",u[0]=-s;break;case"right":c[1]="left",u[0]=s}return{anchor:c[0]&&c[1]?c.join("-"):c[0]?c[0]:c[1]?c[1]:"center",offset:u}}},{"../../lib":749}],854:[function(t,e,r){"use strict";var n=t("mapbox-gl"),a=t("../../lib"),i=t("../../plots/get_data").getSubplotCalcData,o=t("../../constants/xmlns_namespaces"),s=t("d3"),l=t("../../components/drawing"),c=t("../../lib/svg_text_utils"),u=t("./mapbox"),h=r.constants=t("./constants");function f(t){return"string"==typeof t&&(-1!==h.styleValuesMapbox.indexOf(t)||0===t.indexOf("mapbox://"))}r.name="mapbox",r.attr="subplot",r.idRoot="mapbox",r.idRegex=r.attrRegex=a.counterRegex("mapbox"),r.attributes={subplot:{valType:"subplotid",dflt:"mapbox",editType:"calc"}},r.layoutAttributes=t("./layout_attributes"),r.supplyLayoutDefaults=t("./layout_defaults"),r.plot=function(t){var e=t._fullLayout,r=t.calcdata,o=e._subplots.mapbox;if(n.version!==h.requiredVersion)throw new Error(h.wrongVersionErrorMsg);var s=function(t,e){var r=t._fullLayout;if(""===t._context.mapboxAccessToken)return"";for(var n=[],i=[],o=!1,s=!1,l=0;l1&&a.warn(h.multipleTokensErrorMsg),n[0]):(i.length&&a.log(["Listed mapbox access token(s)",i.join(","),"but did not use a Mapbox map style, ignoring token(s)."].join(" ")),"")}(t,o);n.accessToken=s;for(var l=0;lx/2){var b=g.split("|").join("
");v.text(b).attr("data-unformatted",b).call(c.convertToTspans,t),y=l.bBox(v.node())}v.attr("transform","translate(-3, "+(8-y.height)+")"),m.insert("rect",".static-attribution").attr({x:-y.width-6,y:-y.height-3,width:y.width+6,height:y.height+3,fill:"rgba(255, 255, 255, 0.75)"});var _=1;y.width+6>x&&(_=x/(y.width+6));var w=[n.l+n.w*u.x[1],n.t+n.h*(1-u.y[0])];m.attr("transform","translate("+w[0]+","+w[1]+") scale("+_+")")}},r.updateFx=function(t){for(var e=t._fullLayout,r=e._subplots.mapbox,n=0;n0){for(var r=0;r0}function u(t){var e={},r={};switch(t.type){case"circle":n.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":n.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity,"line-dasharray":t.line.dash});break;case"fill":n.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var a=t.symbol,o=i(a.textposition,a.iconsize);n.extendFlat(e,{"icon-image":a.icon+"-15","icon-size":a.iconsize/10,"text-field":a.text,"text-size":a.textfont.size,"text-anchor":o.anchor,"text-offset":o.offset,"symbol-placement":a.placement}),n.extendFlat(r,{"icon-color":t.color,"text-color":a.textfont.color,"text-opacity":t.opacity});break;case"raster":n.extendFlat(r,{"raster-fade-duration":0,"raster-opacity":t.opacity})}return{layout:e,paint:r}}l.update=function(t){this.visible?this.needsNewImage(t)?this.updateImage(t):this.needsNewSource(t)?(this.removeLayer(),this.updateSource(t),this.updateLayer(t)):this.needsNewLayer(t)?this.updateLayer(t):this.updateStyle(t):(this.updateSource(t),this.updateLayer(t)),this.visible=c(t)},l.needsNewImage=function(t){return this.subplot.map.getSource(this.idSource)&&"image"===this.sourceType&&"image"===t.sourcetype&&(this.source!==t.source||JSON.stringify(this.coordinates)!==JSON.stringify(t.coordinates))},l.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},l.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},l.updateImage=function(t){this.subplot.map.getSource(this.idSource).updateImage({url:t.source,coordinates:t.coordinates})},l.updateSource=function(t){var e=this.subplot.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,c(t)){var r=function(t){var e,r=t.sourcetype,n=t.source,i={type:r};"geojson"===r?e="data":"vector"===r?e="string"==typeof n?"url":"tiles":"raster"===r?(e="tiles",i.tileSize=256):"image"===r&&(e="url",i.coordinates=t.coordinates);i[e]=n,t.sourceattribution&&(i.attribution=a(t.sourceattribution));return i}(t);e.addSource(this.idSource,r)}},l.updateLayer=function(t){var e,r=this.subplot,n=u(t),a=this.subplot.belowLookup["layout-"+this.index];if("traces"===a)for(var i=r.getMapLayers(),s=0;s1)for(r=0;r-1&&v(e.originalEvent,n,[r.xaxis],[r.yaxis],r.id,t),a.indexOf("event")>-1&&c.click(n,e.originalEvent)}}},_.updateFx=function(t){var e=this,r=e.map,n=e.gd;if(!e.isStatic){var i,o=t.dragmode;i=h(o)?function(t,r){(t.range={})[e.id]=[c([r.xmin,r.ymin]),c([r.xmax,r.ymax])]}:function(t,r,n){(t.lassoPoints={})[e.id]=n.filtered.map(c)};var s=e.dragOptions;e.dragOptions=a.extendDeep(s||{},{dragmode:t.dragmode,element:e.div,gd:n,plotinfo:{id:e.id,domain:t[e.id].domain,xaxis:e.xaxis,yaxis:e.yaxis,fillRangeItems:i},xaxes:[e.xaxis],yaxes:[e.yaxis],subplot:e.id}),r.off("click",e.onClickInPanHandler),p(o)||f(o)?(r.dragPan.disable(),r.on("zoomstart",e.clearSelect),e.dragOptions.prepFn=function(t,r,n){d(t,r,n,e.dragOptions,o)},l.init(e.dragOptions)):(r.dragPan.enable(),r.off("zoomstart",e.clearSelect),e.div.onmousedown=null,e.onClickInPanHandler=e.onClickInPanFn(e.dragOptions),r.on("click",e.onClickInPanHandler))}function c(t){var r=e.map.unproject(t);return[r.lng,r.lat]}},_.updateFramework=function(t){var e=t[this.id].domain,r=t._size,n=this.div.style;n.width=r.w*(e.x[1]-e.x[0])+"px",n.height=r.h*(e.y[1]-e.y[0])+"px",n.left=r.l+e.x[0]*r.w+"px",n.top=r.t+(1-e.y[1])*r.h+"px",this.xaxis._offset=r.l+e.x[0]*r.w,this.xaxis._length=r.w*(e.x[1]-e.x[0]),this.yaxis._offset=r.t+(1-e.y[1])*r.h,this.yaxis._length=r.h*(e.y[1]-e.y[0])},_.updateLayers=function(t){var e,r=t[this.id].layers,n=this.layerList;if(r.length!==n.length){for(e=0;e=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),l=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(){x.sendDataToCloud(t)}));else{var n=window.location.pathname.split("/"),a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}(t,o),s.text(o.text()&&l.text()?" - ":"")}},x.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var r=n.select(t).append("div").attr("id","hiddenform").style("display","none"),a=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return a.append("input").attr({type:"text",name:"data"}).node().value=x.graphJson(t,!1,"keepdata"),a.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(t,e){var r=t._context.locale,n=!1,a={};function i(t){for(var r=!0,i=0;i1&&O.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,l),s=0;s15&&O.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"),x.linkSubplots(f,l,h,i),x.cleanPlot(f,l,h,i);var N=!(!i._has||!i._has("gl2d")),j=!(!l._has||!l._has("gl2d")),U=!(!i._has||!i._has("cartesian"))||N,V=!(!l._has||!l._has("cartesian"))||j;U&&!V?i._bgLayer.remove():V&&!U&&(l._shouldCreateBgLayer=!0),i._zoomlayer&&!t._dragging&&p({_fullLayout:i}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var a=0;a0){var h=1-2*s;n=Math.round(h*n),a=Math.round(h*a)}}var f=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!e.height&&Math.abs(r.height-a)>1;(g||d)&&(d&&(r.width=n),g&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(t,e,r,n){var a,i,s,l=o.componentsRegistry,u=e._basePlotModules,h=o.subplotsRegistry.cartesian;for(a in l)(s=l[a]).includeBasePlot&&s.includeBasePlot(t,e);for(var f in u.length||u.push(h),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),h.finalizeSubplots(t,e)),e._subplots)e._subplots[f].sort(c.subplotSort);for(i=0;i.5*n.width&&(c.log("Margin push",e,"is too big in x, dropping"),r.l=r.r=0),r.b+r.t>.5*n.height&&(c.log("Margin push",e,"is too big in y, dropping"),r.b=r.t=0);var l=void 0!==r.xl?r.xl:r.x,u=void 0!==r.xr?r.xr:r.x,h=void 0!==r.yt?r.yt:r.y,f=void 0!==r.yb?r.yb:r.y;a[e]={l:{val:l,size:r.l+o},r:{val:u,size:r.r+o},b:{val:f,size:r.b+o},t:{val:h,size:r.t+o}},i[e]=1}else delete a[e],delete i[e];if(!n._replotting)return x.doAutoMargin(t)}},x.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),C(e);var r=e._size,n=e.margin,a=c.extendFlat({},r),s=n.l,l=n.r,u=n.t,h=n.b,f=e.width,p=e.height,d=e._pushmargin,g=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var m in d)g[m]||delete d[m];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:h}},d){var y=d[v].l||{},b=d[v].b||{},_=y.val,w=y.size,T=b.val,k=b.size;for(var M in d){if(i(w)&&d[M].r){var A=d[M].r.val,S=d[M].r.size;if(A>_){var E=(w*A+(S-f)*_)/(A-_),L=(S*(1-_)+(w-f)*(1-A))/(A-_);E>=0&&L>=0&&f-(E+L)>0&&E+L>s+l&&(s=E,l=L)}}if(i(k)&&d[M].t){var P=d[M].t.val,I=d[M].t.size;if(P>T){var z=(k*P+(I-p)*T)/(P-T),O=(I*(1-T)+(k-p)*(1-P))/(P-T);z>=0&&O>=0&&p-(O+z)>0&&z+O>h+u&&(h=z,u=O)}}}}}if(r.l=Math.round(s),r.r=Math.round(l),r.t=Math.round(u),r.b=Math.round(h),r.p=Math.round(n.pad),r.w=Math.round(f)-r.l-r.r,r.h=Math.round(p)-r.t-r.b,!e._replotting&&x.didMarginChange(a,r)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var D=3*(1+Object.keys(g).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var i=0,s=0;function l(){return i++,function(){s++,n||s!==i||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(a)}}r.runFn(l),setTimeout(l())}))}],i=c.syncOrAsync(a,t);return i&&i.then||(i=Promise.resolve()),i.then((function(){return t}))}x.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},x.graphJson=function(t,e,r,n,a,i){(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&x.supplyDefaults(t);var o=a?t._fullData:t.data,s=a?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function u(t,e){if("function"==typeof t)return e?"_function_":null;if(c.isPlainObject(t)){var n,a={};return Object.keys(t).sort().forEach((function(i){if(-1===["_","["].indexOf(i.charAt(0)))if("function"!=typeof t[i]){if("keepdata"===r){if("src"===i.substr(i.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[i+"src"])&&n.indexOf(":")>0)return;a[i]=u(t[i],e)}else e&&(a[i]="_function")})),a}return Array.isArray(t)?t.map((function(t){return u(t,e)})):c.isTypedArray(t)?c.simpleMap(t,c.identity):c.isJSDate(t)?c.ms2DateTimeLocal(+t):t}var h={data:(o||[]).map((function(t){var r=u(t);return e&&delete r.fit,r}))};return e||(h.layout=u(s)),t.framework&&t.framework.isPolar&&(h=t.framework.getConfig()),l&&(h.frames=u(l)),i&&(h.config=u(t._context,!0)),"object"===n?h:JSON.stringify(h)},x.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;i--)if(s[i].enabled){r._indexToPoints=s[i]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:h,y:h}]),o[0].t||(o[0].t={}),o[0].trace=r,d[e]=o}}for(z(l,u,p),a=0;a1e-10?t:0}function f(t,e,r){e=e||0,r=r||0;for(var n=t.length,a=new Array(n),i=0;i0?r:1/0})),a=n.mod(r+1,e.length);return[e[r],e[a]]},findIntersectionXY:c,findXYatLength:function(t,e,r,n){var a=-e*r,i=e*e+1,o=2*(e*a-r),s=a*a+r*r-t*t,l=Math.sqrt(o*o-4*i*s),c=(-o+l)/(2*i),u=(-o-l)/(2*i);return[[c,e*c+a+n],[u,e*u+a+n]]},clampTiny:h,pathPolygon:function(t,e,r,n,a,i){return"M"+f(u(t,e,r,n),a,i).join("L")},pathPolygonAnnulus:function(t,e,r,n,a,i,o){var s,l;t=0?f.angularAxis.domain:n.extent(T),E=Math.abs(T[1]-T[0]);M&&!k&&(E=0);var C=S.slice();A&&k&&(C[1]+=E);var L=f.angularAxis.ticksCount||4;L>8&&(L=L/(L/8)+L%8),f.angularAxis.ticksStep&&(L=(C[1]-C[0])/L);var P=f.angularAxis.ticksStep||(C[1]-C[0])/(L*(f.minorTicks+1));w&&(P=Math.max(Math.round(P),1)),C[2]||(C[2]=P);var I=n.range.apply(this,C);if(I=I.map((function(t,e){return parseFloat(t.toPrecision(12))})),s=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=s.domain(),u.layout.angularAxis.endPadding=A?E:0,"undefined"==typeof(t=n.select(this).select("svg.chart-root"))||t.empty()){var z=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),O=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));t=n.select(O)}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 D,R=t.select(".chart-group"),F={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map((function(t,e){return" "+t+" 0 "+f.font.outlineColor})).join(",")};if(f.showLegend){D=t.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var N=p.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:p.map((function(t,e){return t.name||"Element"+e})),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:D,elements:N,reverseOrder:f.legend.reverseOrder})})();var j=D.node().getBBox();x=Math.min(f.width-j.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),D.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else D=t.select(".legend-group").style({display:"none"});t.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(f.width-(f.margin.left+f.margin.right+2*x+(j?j.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(U[0]=Math.max(0,U[0]),U[1]=Math.max(0,U[1]),t.select(".outer-group").attr("transform","translate("+U+")"),f.title&&f.title.text){var V=t.select("g.title-group text").style(B).text(f.title.text),q=V.node().getBBox();V.attr({x:_[0]-q.width/2,y:_[1]-x-20})}var H=t.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=H.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}H.select("circle.outside-circle").attr({r:x}).style(F);var Y=t.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});function W(t,e){return s(t)%360+f.orientation}if(f.radialAxis.visible){var Z=n.svg.axis().scale(r).ticks(5).tickSize(5);H.call(Z).attr({transform:"rotate("+f.radialAxis.orientation+")"}),H.selectAll(".domain").style(F),H.selectAll("g>text").text((function(t,e){return this.textContent+f.radialAxis.ticksSuffix})).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),H.selectAll("g>line").style({stroke:"black"})}var X=t.select(".angular.axis-group").selectAll("g.angular-tick").data(I),J=X.enter().append("g").classed("angular-tick",!0);X.attr({transform:function(t,e){return"rotate("+W(t)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),X.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",(function(t,e){return e%(f.minorTicks+1)==0})).classed("minor",(function(t,e){return!(e%(f.minorTicks+1)==0)})).style(F),J.selectAll(".minor").style({stroke:f.minorTickColor}),X.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=X.select("text.axis-text").attr({x:x+f.labelOffset,dy:i+"em",transform:function(t,e){var r=W(t),n=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-r+" "+n+" 0)":"radial"==a?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text((function(t,e){return e%(f.minorTicks+1)!=0?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix})).style(B);f.angularAxis.rewriteTicks&&K.text((function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)}));var Q=n.max(R.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));D.attr({transform:"translate("+[x+Q,f.margin.top]+")"});var $=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(p);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),p[0]||$){var et=[];p.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=f.orientation,n.direction=f.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 a(o[r].defaultConfig(),t)}));o[r]().config(n)()}))}var at,it,ot=t.select(".guides-group"),st=t.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,hasTick:!0})();if(!k){var ht=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",(function(t,e){var r=o.util.getMousePos(Y).angle;ht.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=s.invert(n);var a=o.util.convertToCartesian(x+12,r+180);lt.text(o.util.round(at)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.angular-guide",(function(t,e){ot.select("line").style({opacity:0})}))}var ft=ot.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",(function(t,e){var n=o.util.getMousePos(Y).radius;ft.attr({r:n}).style({opacity:.5}),it=r.invert(o.util.getMousePos(Y).radius);var a=o.util.convertToCartesian(n,f.radialAxis.orientation);ct.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])})).on("mouseout.radial-guide",(function(t,e){ft.style({opacity:0}),ut.hide(),lt.hide(),ct.hide()})),t.selectAll(".geometry-group .mark").on("mouseover.tooltip",(function(e,r){var a=n.select(this),i=this.style.fill,s="black",l=this.style.opacity||1;if(a.attr({"data-opacity":l}),i&&"none"!==i){a.attr({"data-fill":i}),s=n.hsl(i).darker().toString(),a.style({fill:s,opacity:1});var c={t:o.util.round(e[0]),r:o.util.round(e[1])};k&&(c.t=w[e[0]]);var u="t: "+c.t+", r: "+c.r,h=this.getBoundingClientRect(),f=t.node().getBoundingClientRect(),p=[h.left+h.width/2-U[0]-f.left,h.top+h.height/2-U[1]-f.top];ut.config({color:s}).text(u),ut.move(p)}else i=this.style.stroke||"black",a.attr({"data-stroke":i}),s=n.hsl(i).darker().toString(),a.style({stroke:s,opacity:1})})).on("mousemove.tooltip",(function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()})).on("mouseout.tooltip",(function(t,e){ut.hide();var r=n.select(this),a=r.attr("data-fill");a?r.style({fill:a,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})}))}))}(c),this},f.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]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)})),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return u},f.getinputConfig=function(){return c},f.radialScale=function(t){return r},f.angularScale=function(t){return s},f.svg=function(){return t},n.rebind(f,h,"on"),f},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 a=e||6,i=[],o=[];n.range(0,360+a,a).forEach((function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)}));var s={t:i,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],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:u(s),transform:function(t,r){return"rotate("+(e.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return d.fill(r,a,i)},"fill-opacity":0,stroke:function(t,e){return d.stroke(r,a,i)},"stroke-width":function(t,e){return d["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return d["stroke-dasharray"](r,a,i)},opacity:function(t,e){return d.opacity(r,a,i)},display:function(t,e){return d.display(r,a,i)}})}};var h=e.angularScale.range(),f=Math.abs(h[1]-h[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle((function(t){return-f/2})).endAngle((function(t){return f/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])}));c.arc=function(t,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(t,r){return"rotate("+(e.orientation+s(t[0])+90)+")"}})};var d={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,a){return r[t[a].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 m=g.selectAll("path.mark").data((function(t,e){return t}));m.enter().append("path").attr({class:"mark"}),m.style(d).each(c[e.geometryType]),m.exit().remove(),g.exit().remove()}))}return i.config=function(e){return arguments.length?(e.forEach((function(e,r){t[r]||(t[r]={}),a(t[r],o.PolyChart.defaultConfig()),a(t[r],e)})),this):t},i.getColorScale=function(){},n.rebind(i,e,"on"),i},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,i=t.data.map((function(t,r){return[].concat(t).map((function(t,n){var i=a({},e.elements[r]);return i.name=t,i.color=[].concat(e.elements[r].color)[n],i}))})),o=n.merge(i);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})),c=e.fontSize,u=null==e.isContinuous?"number"==typeof o[0]:e.isContinuous,h=u?e.height:c*o.length,f=s.classed("legend-group",!0).selectAll("svg").data([0]),p=f.enter().append("svg").attr({width:300,height:h+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var d=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(d).range(l),m=n.scale[u?"linear":"ordinal"]().domain(d)[u?"range":"rangePoints"]([0,h]);if(u){var v=f.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);v.enter().append("stop"),v.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),f.append("rect").classed("legend-mark",!0).attr({height:e.height,width:e.colorBandWidth,fill:"url(#grad1)"})}else{var y=f.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("+[c/2,m(e)+c/2]+")"},d:function(t,e){var r,a,i,o=t.symbol;return i=3*(a=c),"line"===(r=o)?"M"+[[-a/2,-a/12],[a/2,-a/12],[a/2,a/12],[-a/2,a/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(i)():n.svg.symbol().type("square").size(i)()},fill:function(t,e){return g(e)}}),y.exit().remove()}var x=n.svg.axis().scale(m).orient("right"),b=f.select("g.legend-axis").attr({transform:"translate("+[u?e.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?e.textColor:"none"}),b.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?(a(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,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,c=function(){var n=(t=i.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:i.padding+l,dy:.3*+i.fontSize}),c};return c.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",h=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(h);var f=i.padding,p=e.node().getBBox(),d={fill:i.color,stroke:s,"stroke-width":"2px"},g=p.width+2*f+l,m=p.height+2*f;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[i.hasTick?0:l,0],[l,m/4],[l,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[l,-m/2+2*f]+")"}),t.style({display:"block"}),c},c.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(t)return t.style({display:"none"}),c},c.show=function(){if(t)return t.style({display:"block"}),c},c.config=function(t){return a(i,t),c},c},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=a({},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 i=o.util.duplicates(r.data.map((function(t,e){return t.geometry})));r.data.forEach((function(t,e){var n=i.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)}))}if(t.layout){var s=a({},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"],c=["top","right","bottom","left","pad"],u={};n.entries(s.margin).forEach((function(t,e){u[c[l.indexOf(t.key)]]=t.value})),s.margin=u}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":717,"../../../lib":749,d3:169}],870:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../../lib"),i=t("../../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=a.extendDeepAll,c=e.exports={};c.framework=function(t){var e,r,a,i,u,h=new s;function f(r,s){return s&&(u=s),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),e=e?l(e,r):r,a||(a=o.Axis()),i=o.adapter.plotly().convert(e),a.config(i).render(u),t.data=e.data,t.layout=e.layout,c.fillLayout(t),e}return f.isPolar=!0,f.svg=function(){return a.svg()},f.getConfig=function(){return e},f.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},f.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},f.setUndoPoint=function(){var t,n,a=this,i=o.util.cloneJson(e);t=i,n=r,h.add({undo:function(){n&&a(n)},redo:function(){a(t)}}),r=o.util.cloneJson(i)},f.undo=function(){h.undo()},f.redo=function(){h.redo()},f},c.fillLayout=function(t){var e=n.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=l(o,t.layout)}},{"../../../components/color":615,"../../../lib":749,"./micropolar":869,"./undo_manager":871,d3:169}],871:[function(t,e,r){"use strict";e.exports=function(){var t,e=[],r=-1,n=!1;function a(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n||(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?(a(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(a(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r=90||s>90&&l>=450?1:u<=0&&f<=0?0:Math.max(u,f);e=s<=180&&l>=180||s>180&&l>=540?-1:c>=0&&h>=0?0:Math.min(c,h);r=s<=270&&l>=270||s>270&&l>=630?-1:u>=0&&f>=0?0:Math.min(u,f);n=l>=360?1:c<=0&&h<=0?0:Math.max(c,h);return[e,r,n,a]}(f),x=y[2]-y[0],b=y[3]-y[1],_=h/u,w=Math.abs(b/x);_>w?(p=u,v=(h-(d=u*w))/n.h/2,g=[o[0],o[1]],m=[c[0]+v,c[1]-v]):(d=h,v=(u-(p=h/w))/n.w/2,g=[o[0]+v,o[1]-v],m=[c[0],c[1]]),this.xLength2=p,this.yLength2=d,this.xDomain2=g,this.yDomain2=m;var T=this.xOffset2=n.l+n.w*g[0],k=this.yOffset2=n.t+n.h*(1-m[1]),M=this.radius=p/x,A=this.innerRadius=e.hole*M,S=this.cx=T-M*y[0],L=this.cy=k+M*y[3],P=this.cxx=S-T,I=this.cyy=L-k;this.radialAxis=this.mockAxis(t,e,a,{_id:"x",side:{counterclockwise:"top",clockwise:"bottom"}[a.side],domain:[A/n.w,M/n.w]}),this.angularAxis=this.mockAxis(t,e,i,{side:"right",domain:[0,Math.PI],autorange:!1}),this.doAutoRange(t,e),this.updateAngularAxis(t,e),this.updateRadialAxis(t,e),this.updateRadialAxisTitle(t,e),this.xaxis=this.mockCartesianAxis(t,e,{_id:"x",domain:g}),this.yaxis=this.mockCartesianAxis(t,e,{_id:"y",domain:m});var z=this.pathSubplot();this.clipPaths.forTraces.select("path").attr("d",z).attr("transform",R(P,I)),r.frontplot.attr("transform",R(T,k)).call(l.setClipUrl,this._hasClipOnAxisFalse?null:this.clipIds.forTraces,this.gd),r.bg.attr("d",z).attr("transform",R(S,L)).call(s.fill,e.bgcolor)},I.mockAxis=function(t,e,r,n){var a=o.extendFlat({},r,n);return f(a,e,t),a},I.mockCartesianAxis=function(t,e,r){var n=this,a=r._id,i=o.extendFlat({type:"linear"},r);h(i,t);var s={x:[0,2],y:[1,3]};return i.setRange=function(){var t=n.sectorBBox,r=s[a],o=n.radialAxis._rl,l=(o[1]-o[0])/(1-e.hole);i.range=[t[r[0]]*l,t[r[1]]*l]},i.isPtWithinRange="x"===a?function(t){return n.isPtInside(t)}:function(){return!0},i.setRange(),i.setScale(),i},I.doAutoRange=function(t,e){var r=this.gd,n=this.radialAxis,a=e.radialaxis;n.setScale(),p(r,n);var i=n.range;a.range=i.slice(),a._input.range=i.slice(),n._rl=[n.r2l(i[0],null,"gregorian"),n.r2l(i[1],null,"gregorian")]},I.updateRadialAxis=function(t,e){var r=this,n=r.gd,a=r.layers,i=r.radius,l=r.innerRadius,c=r.cx,h=r.cy,f=e.radialaxis,p=E(e.sector[0],360),d=r.radialAxis,g=l90&&p<=270&&(d.tickangle=180);var m=function(t){return"translate("+(d.l2p(t.x)+l)+",0)"},v=z(f);if(r.radialTickLayout!==v&&(a["radial-axis"].selectAll(".xtick").remove(),r.radialTickLayout=v),g){d.setScale();var y=u.calcTicks(d),x=u.clipEnds(d,y),b=u.getTickSigns(d)[2];u.drawTicks(n,d,{vals:y,layer:a["radial-axis"],path:u.makeTickPath(d,0,b),transFn:m,crisp:!1}),u.drawGrid(n,d,{vals:x,layer:a["radial-grid"],path:function(t){return r.pathArc(d.r2p(t.x)+l)},transFn:o.noop,crisp:!1}),u.drawLabels(n,d,{vals:y,layer:a["radial-axis"],transFn:m,labelFns:u.makeLabelFns(d,0)})}var _=r.radialAxisAngle=r.vangles?L(O(C(f.angle),r.vangles)):f.angle,w=R(c,h),T=w+F(-_);D(a["radial-axis"],g&&(f.showticklabels||f.ticks),{transform:T}),D(a["radial-grid"],g&&f.showgrid,{transform:w}),D(a["radial-line"].select("line"),g&&f.showline,{x1:l,y1:0,x2:i,y2:0,transform:T}).attr("stroke-width",f.linewidth).call(s.stroke,f.linecolor)},I.updateRadialAxisTitle=function(t,e,r){var n=this.gd,a=this.radius,i=this.cx,o=this.cy,s=e.radialaxis,c=this.id+"title",u=void 0!==r?r:this.radialAxisAngle,h=C(u),f=Math.cos(h),p=Math.sin(h),d=0;if(s.title){var g=l.bBox(this.layers["radial-axis"].node()).height,m=s.title.font.size;d="counterclockwise"===s.side?-g-.4*m:g+.8*m}this.layers["radial-axis-title"]=v.draw(n,c,{propContainer:s,propName:this.id+".radialaxis.title",placeholder:S(n,"Click to enter radial axis title"),attributes:{x:i+a/2*f+d*p,y:o-a/2*p+d*f,"text-anchor":"middle"},transform:{rotate:-u}})},I.updateAngularAxis=function(t,e){var r=this,n=r.gd,a=r.layers,i=r.radius,l=r.innerRadius,c=r.cx,h=r.cy,f=e.angularaxis,p=r.angularAxis;r.fillViewInitialKey("angularaxis.rotation",f.rotation),p.setGeometry(),p.setScale();var d=function(t){return p.t2g(t.x)};"linear"===p.type&&"radians"===p.thetaunit&&(p.tick0=L(p.tick0),p.dtick=L(p.dtick));var g=function(t){return R(c+i*Math.cos(t),h-i*Math.sin(t))},m=u.makeLabelFns(p,0).labelStandoff,v={xFn:function(t){var e=d(t);return Math.cos(e)*m},yFn:function(t){var e=d(t),r=Math.sin(e)>0?.2:1;return-Math.sin(e)*(m+t.fontSize*r)+Math.abs(Math.cos(e))*(t.fontSize*k)},anchorFn:function(t){var e=d(t),r=Math.cos(e);return Math.abs(r)<.1?"middle":r>0?"start":"end"},heightFn:function(t,e,r){var n=d(t);return-.5*(1+Math.sin(n))*r}},y=z(f);r.angularTickLayout!==y&&(a["angular-axis"].selectAll("."+p._id+"tick").remove(),r.angularTickLayout=y);var x,b=u.calcTicks(p);if("linear"===e.gridshape?(x=b.map(d),o.angleDelta(x[0],x[1])<0&&(x=x.slice().reverse())):x=null,r.vangles=x,"category"===p.type&&(b=b.filter((function(t){return o.isAngleInsideSector(d(t),r.sectorInRad)}))),p.visible){var _="inside"===p.ticks?-1:1,w=(p.linewidth||1)/2;u.drawTicks(n,p,{vals:b,layer:a["angular-axis"],path:"M"+_*w+",0h"+_*p.ticklen,transFn:function(t){var e=d(t);return g(e)+F(-L(e))},crisp:!1}),u.drawGrid(n,p,{vals:b,layer:a["angular-grid"],path:function(t){var e=d(t),r=Math.cos(e),n=Math.sin(e);return"M"+[c+l*r,h-l*n]+"L"+[c+i*r,h-i*n]},transFn:o.noop,crisp:!1}),u.drawLabels(n,p,{vals:b,layer:a["angular-axis"],repositionOnUpdate:!0,transFn:function(t){return g(d(t))},labelFns:v})}D(a["angular-line"].select("path"),f.showline,{d:r.pathSubplot(),transform:R(c,h)}).attr("stroke-width",f.linewidth).call(s.stroke,f.linecolor)},I.updateFx=function(t,e){this.gd._context.staticPlot||(this.updateAngularDrag(t),this.updateRadialDrag(t,e,0),this.updateRadialDrag(t,e,1),this.updateMainDrag(t))},I.updateMainDrag=function(t){var e=this,r=e.gd,o=e.layers,s=t._zoomlayer,l=M.MINZOOM,c=M.OFFEDGE,u=e.radius,h=e.innerRadius,f=e.cx,p=e.cy,v=e.cxx,_=e.cyy,w=e.sectorInRad,T=e.vangles,k=e.radialAxis,S=A.clampTiny,E=A.findXYatLength,C=A.findEnclosingVertexAngles,L=M.cornerHalfWidth,P=M.cornerLen/2,I=d.makeDragger(o,"path","maindrag","crosshair");n.select(I).attr("d",e.pathSubplot()).attr("transform",R(f,p));var z,O,D,F,B,N,j,U,V,q={element:I,gd:r,subplot:e.id,plotinfo:{id:e.id,xaxis:e.xaxis,yaxis:e.yaxis},xaxes:[e.xaxis],yaxes:[e.yaxis]};function H(t,e){return Math.sqrt(t*t+e*e)}function G(t,e){return H(t-v,e-_)}function Y(t,e){return Math.atan2(_-e,t-v)}function W(t,e){return[t*Math.cos(e),t*Math.sin(-e)]}function Z(t,r){if(0===t)return e.pathSector(2*L);var n=P/t,a=r-n,i=r+n,o=Math.max(0,Math.min(t,u)),s=o-L,l=o+L;return"M"+W(s,a)+"A"+[s,s]+" 0,0,0 "+W(s,i)+"L"+W(l,i)+"A"+[l,l]+" 0,0,1 "+W(l,a)+"Z"}function X(t,r,n){if(0===t)return e.pathSector(2*L);var a,i,o=W(t,r),s=W(t,n),l=S((o[0]+s[0])/2),c=S((o[1]+s[1])/2);if(l&&c){var u=c/l,h=-1/u,f=E(L,u,l,c);a=E(P,h,f[0][0],f[0][1]),i=E(P,h,f[1][0],f[1][1])}else{var p,d;c?(p=P,d=L):(p=L,d=P),a=[[l-p,c-d],[l+p,c-d]],i=[[l-p,c+d],[l+p,c+d]]}return"M"+a.join("L")+"L"+i.reverse().join("L")+"Z"}function J(t,e){return e=Math.max(Math.min(e,u),h),tl?(t-1&&1===t&&x(n,r,[e.xaxis],[e.yaxis],e.id,q),a.indexOf("event")>-1&&m.click(r,n,e.id)}q.prepFn=function(t,n,i){var o=r._fullLayout.dragmode,l=I.getBoundingClientRect();if(z=n-l.left,O=i-l.top,T){var c=A.findPolygonOffset(u,w[0],w[1],T);z+=v+c[0],O+=_+c[1]}switch(o){case"zoom":q.moveFn=T?tt:Q,q.clickFn=nt,q.doneFn=et,function(){D=null,F=null,B=e.pathSubplot(),N=!1;var t=r._fullLayout[e.id];j=a(t.bgcolor).getLuminance(),(U=d.makeZoombox(s,j,f,p,B)).attr("fill-rule","evenodd"),V=d.makeCorners(s,f,p),b(r)}();break;case"select":case"lasso":y(t,n,i,q,o)}},I.onmousemove=function(t){m.hover(r,t,e.id),r._fullLayout._lasthover=I,r._fullLayout._hoversubplot=e.id},I.onmouseout=function(t){r._dragging||g.unhover(r,t)},g.init(q)},I.updateRadialDrag=function(t,e,r){var a=this,s=a.gd,l=a.layers,c=a.radius,u=a.innerRadius,h=a.cx,f=a.cy,p=a.radialAxis,m=M.radialDragBoxSize,v=m/2;if(p.visible){var y,x,_,k=C(a.radialAxisAngle),A=p._rl,S=A[0],E=A[1],P=A[r],I=.75*(A[1]-A[0])/(1-e.hole)/c;r?(y=h+(c+v)*Math.cos(k),x=f-(c+v)*Math.sin(k),_="radialdrag"):(y=h+(u-v)*Math.cos(k),x=f-(u-v)*Math.sin(k),_="radialdrag-inner");var z,B,N,j=d.makeRectDragger(l,_,"crosshair",-v,-v,m,m),U={element:j,gd:s};D(n.select(j),p.visible&&u0==(r?N>S:Nn?function(t){return t<=0}:function(t){return t>=0};t.c2g=function(r){var n=t.c2l(r)-e;return(s(n)?n:0)+o},t.g2c=function(r){return t.l2c(r+e-o)},t.g2p=function(t){return t*i},t.c2p=function(e){return t.g2p(t.c2g(e))}}}(t,e);break;case"angularaxis":!function(t,e){var r=t.type;if("linear"===r){var a=t.d2c,s=t.c2d;t.d2c=function(t,e){return function(t,e){return"degrees"===e?i(t):t}(a(t),e)},t.c2d=function(t,e){return s(function(t,e){return"degrees"===e?o(t):t}(t,e))}}t.makeCalcdata=function(e,a){var i,o,s=e[a],l=e._length,c=function(r){return t.d2c(r,e.thetaunit)};if(s){if(n.isTypedArray(s)&&"linear"===r){if(l===s.length)return s;if(s.subarray)return s.subarray(0,l)}for(i=new Array(l),o=0;o0){for(var n=[],a=0;a=u&&(p.min=0,g.min=0,m.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}function d(t,e,r,n){var a=h[e._name];function o(r,n){return i.coerce(t,e,a,r,n)}o("uirevision",n.uirevision),e.type="linear";var f=o("color"),p=f!==a.color.dflt?f:r.font.color,d=e._name.charAt(0).toUpperCase(),g="Component "+d,m=o("title.text",g);e._hovertitle=m===g?m:d,i.coerceFont(o,"title.font",{family:r.font.family,size:Math.round(1.2*r.font.size),color:p}),o("min"),c(t,e,o,"linear"),s(t,e,o,"linear",{}),l(t,e,o,{outerTicks:!0}),o("showticklabels")&&(i.coerceFont(o,"tickfont",{family:r.font.family,size:r.font.size,color:p}),o("tickangle"),o("tickformat")),u(t,e,o,{dfltColor:f,bgColor:r.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:a}),o("hoverformat"),o("layer")}e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:h,handleDefaults:p,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../components/color":615,"../../lib":749,"../../plot_api/plot_template":787,"../cartesian/line_grid_defaults":813,"../cartesian/tick_label_defaults":818,"../cartesian/tick_mark_defaults":819,"../cartesian/tick_value_defaults":820,"../subplot_defaults":874,"./layout_attributes":877}],879:[function(t,e,r){"use strict";var n=t("d3"),a=t("tinycolor2"),i=t("../../registry"),o=t("../../lib"),s=o._,l=t("../../components/color"),c=t("../../components/drawing"),u=t("../cartesian/set_convert"),h=t("../../lib/extend").extendFlat,f=t("../plots"),p=t("../cartesian/axes"),d=t("../../components/dragelement"),g=t("../../components/fx"),m=t("../../components/dragelement/helpers"),v=m.freeMode,y=m.rectMode,x=t("../../components/titles"),b=t("../cartesian/select").prepSelect,_=t("../cartesian/select").selectOnClick,w=t("../cartesian/select").clearSelect,T=t("../cartesian/select").clearSelectionsCache,k=t("../cartesian/constants");function M(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework(e),this.aTickLayout=null,this.bTickLayout=null,this.cTickLayout=null}e.exports=M;var A=M.prototype;A.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={},this.layers={}},A.plot=function(t,e){var r=e[this.id],n=e._size;this._hasClipOnAxisFalse=!1;for(var a=0;aS*x?a=(i=x)*S:i=(a=y)/S,o=m*a/y,s=v*i/x,r=e.l+e.w*d-a/2,n=e.t+e.h*(1-g)-i/2,f.x0=r,f.y0=n,f.w=a,f.h=i,f.sum=b,f.xaxis={type:"linear",range:[_+2*T-b,b-_-2*w],domain:[d-o/2,d+o/2],_id:"x"},u(f.xaxis,f.graphDiv._fullLayout),f.xaxis.setScale(),f.xaxis.isPtWithinRange=function(t){return t.a>=f.aaxis.range[0]&&t.a<=f.aaxis.range[1]&&t.b>=f.baxis.range[1]&&t.b<=f.baxis.range[0]&&t.c>=f.caxis.range[1]&&t.c<=f.caxis.range[0]},f.yaxis={type:"linear",range:[_,b-w-T],domain:[g-s/2,g+s/2],_id:"y"},u(f.yaxis,f.graphDiv._fullLayout),f.yaxis.setScale(),f.yaxis.isPtWithinRange=function(){return!0};var k=f.yaxis.domain[0],M=f.aaxis=h({},t.aaxis,{range:[_,b-w-T],side:"left",tickangle:(+t.aaxis.tickangle||0)-30,domain:[k,k+s*S],anchor:"free",position:0,_id:"y",_length:a});u(M,f.graphDiv._fullLayout),M.setScale();var A=f.baxis=h({},t.baxis,{range:[b-_-T,w],side:"bottom",domain:f.xaxis.domain,anchor:"free",position:0,_id:"x",_length:a});u(A,f.graphDiv._fullLayout),A.setScale();var E=f.caxis=h({},t.caxis,{range:[b-_-w,T],side:"right",tickangle:(+t.caxis.tickangle||0)+30,domain:[k,k+s*S],anchor:"free",position:0,_id:"y",_length:a});u(E,f.graphDiv._fullLayout),E.setScale();var C="M"+r+","+(n+i)+"h"+a+"l-"+a/2+",-"+i+"Z";f.clipDef.select("path").attr("d",C),f.layers.plotbg.select("path").attr("d",C);var L="M0,"+i+"h"+a+"l-"+a/2+",-"+i+"Z";f.clipDefRelative.select("path").attr("d",L);var P="translate("+r+","+n+")";f.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",P),f.clipDefRelative.select("path").attr("transform",null);var I="translate("+(r-A._offset)+","+(n+i)+")";f.layers.baxis.attr("transform",I),f.layers.bgrid.attr("transform",I);var z="translate("+(r+a/2)+","+n+")rotate(30)translate(0,"+-M._offset+")";f.layers.aaxis.attr("transform",z),f.layers.agrid.attr("transform",z);var O="translate("+(r+a/2)+","+n+")rotate(-30)translate(0,"+-E._offset+")";f.layers.caxis.attr("transform",O),f.layers.cgrid.attr("transform",O),f.drawAxes(!0),f.layers.aline.select("path").attr("d",M.showline?"M"+r+","+(n+i)+"l"+a/2+",-"+i:"M0,0").call(l.stroke,M.linecolor||"#000").style("stroke-width",(M.linewidth||0)+"px"),f.layers.bline.select("path").attr("d",A.showline?"M"+r+","+(n+i)+"h"+a:"M0,0").call(l.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),f.layers.cline.select("path").attr("d",E.showline?"M"+(r+a/2)+","+n+"l"+a/2+","+i:"M0,0").call(l.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px"),f.graphDiv._context.staticPlot||f.initInteractions(),c.setClipUrl(f.layers.frontplot,f._hasClipOnAxisFalse?null:f.clipId,f.graphDiv)},A.drawAxes=function(t){var e=this.graphDiv,r=this.id.substr(7)+"title",n=this.layers,a=this.aaxis,i=this.baxis,o=this.caxis;if(this.drawAx(a),this.drawAx(i),this.drawAx(o),t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0)),c=(i.showticklabels?i.tickfont.size:0)+("outside"===i.ticks?i.ticklen:0)+3;n["a-title"]=x.draw(e,"a"+r,{propContainer:a,propName:this.id+".aaxis.title",placeholder:s(e,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-a.title.font.size/3-l,"text-anchor":"middle"}}),n["b-title"]=x.draw(e,"b"+r,{propContainer:i,propName:this.id+".baxis.title",placeholder:s(e,"Click to enter Component B title"),attributes:{x:this.x0-c,y:this.y0+this.h+.83*i.title.font.size+c,"text-anchor":"middle"}}),n["c-title"]=x.draw(e,"c"+r,{propContainer:o,propName:this.id+".caxis.title",placeholder:s(e,"Click to enter Component C title"),attributes:{x:this.x0+this.w+c,y:this.y0+this.h+.83*o.title.font.size+c,"text-anchor":"middle"}})}},A.drawAx=function(t){var e,r=this.graphDiv,n=t._name,a=n.charAt(0),i=t._id,s=this.layers[n],l=a+"tickLayout",c=(e=t).ticks+String(e.ticklen)+String(e.showticklabels);this[l]!==c&&(s.selectAll("."+i+"tick").remove(),this[l]=c),t.setScale();var u=p.calcTicks(t),h=p.clipEnds(t,u),f=p.makeTransFn(t),d=p.getTickSigns(t)[2],g=o.deg2rad(30),m=d*(t.linewidth||1)/2,v=d*t.ticklen,y=this.w,x=this.h,b="b"===a?"M0,"+m+"l"+Math.sin(g)*v+","+Math.cos(g)*v:"M"+m+",0l"+Math.cos(g)*v+","+-Math.sin(g)*v,_={a:"M0,0l"+x+",-"+y/2,b:"M0,0l-"+y/2+",-"+x,c:"M0,0l-"+x+","+y/2}[a];p.drawTicks(r,t,{vals:"inside"===t.ticks?h:u,layer:s,path:b,transFn:f,crisp:!1}),p.drawGrid(r,t,{vals:h,layer:this.layers[a+"grid"],path:_,transFn:f,crisp:!1}),p.drawLabels(r,t,{vals:u,layer:s,transFn:f,labelFns:p.makeLabelFns(t,0,30)})};var E=k.MINZOOM/2+.87,C="m-0.87,.5h"+E+"v3h-"+(E+5.2)+"l"+(E/2+2.6)+",-"+(.87*E+4.5)+"l2.6,1.5l-"+E/2+","+.87*E+"Z",L="m0.87,.5h-"+E+"v3h"+(E+5.2)+"l-"+(E/2+2.6)+",-"+(.87*E+4.5)+"l-2.6,1.5l"+E/2+","+.87*E+"Z",P="m0,1l"+E/2+","+.87*E+"l2.6,-1.5l-"+(E/2+2.6)+",-"+(.87*E+4.5)+"l-"+(E/2+2.6)+","+(.87*E+4.5)+"l2.6,1.5l"+E/2+",-"+.87*E+"Z",I=!0;function z(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}A.clearSelect=function(){T(this.dragOptions),w(this.dragOptions.gd)},A.initInteractions=function(){var t,e,r,n,u,h,f,p,m,x,w=this,T=w.layers.plotbg.select("path").node(),M=w.graphDiv,A=M._fullLayout._zoomlayer;function E(t){var e={};return e[w.id+".aaxis.min"]=t.a,e[w.id+".baxis.min"]=t.b,e[w.id+".caxis.min"]=t.c,e}function O(t,e){var r=M._fullLayout.clickmode;z(M),2===t&&(M.emit("plotly_doubleclick",null),i.call("_guiRelayout",M,E({a:0,b:0,c:0}))),r.indexOf("select")>-1&&1===t&&_(e,M,[w.xaxis],[w.yaxis],w.id,w.dragOptions),r.indexOf("event")>-1&&g.click(M,e,w.id)}function D(t,e){return 1-e/w.h}function R(t,e){return 1-(t+(w.h-e)/Math.sqrt(3))/w.w}function F(t,e){return(t-(w.h-e)/Math.sqrt(3))/w.w}function B(a,i){var o=t+a,s=e+i,l=Math.max(0,Math.min(1,D(0,e),D(0,s))),c=Math.max(0,Math.min(1,R(t,e),R(o,s))),d=Math.max(0,Math.min(1,F(t,e),F(o,s))),g=(l/2+d)*w.w,v=(1-l/2-c)*w.w,y=(g+v)/2,b=v-g,_=(1-l)*w.h,T=_-b/S;b.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),x.transition().style("opacity",1).duration(200),p=!0),M.emit("plotly_relayouting",E(u))}function N(){z(M),u!==r&&(i.call("_guiRelayout",M,E(u)),I&&M.data&&M._context.showTips&&(o.notifier(s(M,"Double-click to zoom back out"),"long"),I=!1))}function j(t,e){var n=t/w.xaxis._m,a=e/w.yaxis._m,i=[(u={a:r.a-a,b:r.b+(n+a)/2,c:r.c-(n-a)/2}).a,u.b,u.c].sort(o.sorterAsc),s=i.indexOf(u.a),l=i.indexOf(u.b),h=i.indexOf(u.c);i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),u={a:i[s],b:i[l],c:i[h]},e=(r.a-u.a)*w.yaxis._m,t=(r.c-u.c-r.b+u.b)*w.xaxis._m);var f="translate("+(w.x0+t)+","+(w.y0+e)+")";w.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",f);var p="translate("+-t+","+-e+")";w.clipDefRelative.select("path").attr("transform",p),w.aaxis.range=[u.a,w.sum-u.b-u.c],w.baxis.range=[w.sum-u.a-u.c,u.b],w.caxis.range=[w.sum-u.a-u.b,u.c],w.drawAxes(!1),w._hasClipOnAxisFalse&&w.plotContainer.select(".scatterlayer").selectAll(".trace").call(c.hideOutsideRangePoints,w),M.emit("plotly_relayouting",E(u))}function U(){i.call("_guiRelayout",M,E(u))}this.dragOptions={element:T,gd:M,plotinfo:{id:w.id,domain:M._fullLayout[w.id].domain,xaxis:w.xaxis,yaxis:w.yaxis},subplot:w.id,prepFn:function(i,o,s){w.dragOptions.xaxes=[w.xaxis],w.dragOptions.yaxes=[w.yaxis];var c=w.dragOptions.dragmode=M._fullLayout.dragmode;v(c)?w.dragOptions.minDrag=1:w.dragOptions.minDrag=void 0,"zoom"===c?(w.dragOptions.moveFn=B,w.dragOptions.clickFn=O,w.dragOptions.doneFn=N,function(i,o,s){var c=T.getBoundingClientRect();t=o-c.left,e=s-c.top,r={a:w.aaxis.range[0],b:w.baxis.range[1],c:w.caxis.range[1]},u=r,n=w.aaxis.range[1]-r.a,h=a(w.graphDiv._fullLayout[w.id].bgcolor).getLuminance(),f="M0,"+w.h+"L"+w.w/2+", 0L"+w.w+","+w.h+"Z",p=!1,m=A.append("path").attr("class","zoombox").attr("transform","translate("+w.x0+", "+w.y0+")").style({fill:h>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",f),x=A.append("path").attr("class","zoombox-corners").attr("transform","translate("+w.x0+", "+w.y0+")").style({fill:l.background,stroke:l.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),w.clearSelect(M)}(0,o,s)):"pan"===c?(w.dragOptions.moveFn=j,w.dragOptions.clickFn=O,w.dragOptions.doneFn=U,r={a:w.aaxis.range[0],b:w.baxis.range[1],c:w.caxis.range[1]},u=r,w.clearSelect(M)):(y(c)||v(c))&&b(i,o,s,w.dragOptions,c)}},T.onmousemove=function(t){g.hover(M,t,w.id),M._fullLayout._lasthover=T,M._fullLayout._hoversubplot=w.id},T.onmouseout=function(t){M._dragging||d.unhover(M,t)},d.init(this.dragOptions)}},{"../../components/color":615,"../../components/dragelement":634,"../../components/dragelement/helpers":633,"../../components/drawing":637,"../../components/fx":655,"../../components/titles":710,"../../lib":749,"../../lib/extend":739,"../../registry":880,"../cartesian/axes":797,"../cartesian/constants":803,"../cartesian/select":816,"../cartesian/set_convert":817,"../plots":860,d3:169,tinycolor2:548}],880:[function(t,e,r){"use strict";var n=t("./lib/loggers"),a=t("./lib/noop"),i=t("./lib/push_unique"),o=t("./lib/is_plain_object"),s=t("./lib/dom").addStyleRule,l=t("./lib/extend"),c=t("./plots/attributes"),u=t("./plots/layout_attributes"),h=l.extendFlat,f=l.extendDeepAll;function p(t){var e=t.name,a=t.categories,i=t.meta;if(r.modules[e])n.log("Type "+e+" already registered");else{r.subplotsRegistry[t.basePlotModule.name]||function(t){var e=t.name;if(r.subplotsRegistry[e])return void n.log("Plot type "+e+" already registered.");for(var a in v(t),r.subplotsRegistry[e]=t,r.componentsRegistry)b(a,t.name)}(t.basePlotModule);for(var o={},l=0;l-1&&(h[p[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":615,"../components/drawing":637,"../constants/xmlns_namespaces":725,"../lib":749,d3:169}],889:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rh+c||!n(u))}for(var p=0;pi))return e}return void 0!==r?r:t.dflt},r.coerceColor=function(t,e,r){return a(e).isValid()?e:void 0!==r?r:t.dflt},r.coerceEnumerated=function(t,e,r){return t.coerceNumber&&(e=+e),-1!==t.values.indexOf(e)?e:void 0!==r?r:t.dflt},r.getValue=function(t,e){var r;return Array.isArray(t)?e0?a+=i:e<0&&(a-=i)}return n.inbox(r-e,a-e,b+(a-e)/(a-r)-1)}"h"===m.orientation?(i=r,s=e,u="y",h="x",f=S,p=A):(i=e,s=r,u="x",h="y",p=S,f=A);var E=t[u+"a"],C=t[h+"a"];d=Math.abs(E.r2c(E.range[1])-E.r2c(E.range[0]));var L=n.getDistanceFunction(a,f,p,(function(t){return(f(t)+p(t))/2}));if(n.getClosest(g,L,t),!1!==t.index&&g[t.index].p!==c){y||(T=function(t){return Math.min(_(t),t.p-v.bargroupwidth/2)},k=function(t){return Math.max(w(t),t.p+v.bargroupwidth/2)});var P=g[t.index],I=m.base?P.b+P.s:P.s;t[h+"0"]=t[h+"1"]=C.c2p(P[h],!0),t[h+"LabelVal"]=I;var z=v.extents[v.extents.round(P.p)];return t[u+"0"]=E.c2p(y?T(P):z[0],!0),t[u+"1"]=E.c2p(y?k(P):z[1],!0),t[u+"LabelVal"]=P.p,t.labelLabel=l(E,t[u+"LabelVal"]),t.valueLabel=l(C,t[h+"LabelVal"]),t.spikeDistance=(S(P)+function(t){return M(_(t),w(t))}(P))/2-b,t[u+"Spike"]=E.c2p(P.p,!0),o(P,m,t),t.hovertemplate=m.hovertemplate,t}}function h(t,e){var r=e.mcc||t.marker.color,n=e.mlcc||t.marker.line.color,a=s(t,e);return i.opacity(r)?r:i.opacity(n)&&a?n:void 0}e.exports={hoverPoints:function(t,e,r,n){var i=u(t,e,r,n);if(i){var o=i.cd,s=o[0].trace,l=o[i.index];return i.color=h(s,l),a.getComponentMethod("errorbars","hoverInfo")(l,s,i),[i]}},hoverOnBars:u,getTraceColor:h}},{"../../components/color":615,"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"./helpers":896}],898:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc").crossTraceCalc,colorbar:t("../scatter/marker_colorbar"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot").plot,style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"bar",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":810,"../scatter/marker_colorbar":1173,"./arrays_to_calcdata":889,"./attributes":890,"./calc":891,"./cross_trace_calc":893,"./defaults":894,"./event_data":895,"./hover":897,"./layout_attributes":899,"./layout_defaults":900,"./plot":901,"./select":902,"./style":904}],899:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],900:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../plots/cartesian/axes"),i=t("../../lib"),o=t("./layout_attributes");e.exports=function(t,e,r){function s(r,n){return i.coerce(t,e,o,r,n)}for(var l=!1,c=!1,u=!1,h={},f=s("barmode"),p=0;p0}function S(t){return"auto"===t?0:t}function E(t,e){var r=Math.PI/180*e,n=Math.abs(Math.sin(r)),a=Math.abs(Math.cos(r));return{x:t.width*a+t.height*n,y:t.width*n+t.height*a}}function C(t,e,r,n,a,i){var o=!!i.isHorizontal,s=!!i.constrained,l=i.angle||0,c=i.anchor||"end",u="end"===c,h="start"===c,f=((i.leftToRight||0)+1)/2,p=1-f,d=a.width,g=a.height,m=Math.abs(e-t),v=Math.abs(n-r),y=m>2*_&&v>2*_?_:0;m-=2*y,v-=2*y;var x=S(l);"auto"!==l||d<=m&&g<=v||!(d>m||g>v)||(d>v||g>m)&&d.01?H:function(t,e,r){return r&&t===e?t:Math.abs(t-e)>=2?H(t):t>e?Math.ceil(t):Math.floor(t)};B=G(B,N,D),N=G(N,B,D),j=G(j,U,!D),U=G(U,j,!D)}var Y=M(i.ensureSingle(I,"path"),P,m,v);if(Y.style("vector-effect","non-scaling-stroke").attr("d",isNaN((N-B)*(U-j))?"M0,0Z":"M"+B+","+j+"V"+U+"H"+N+"V"+j+"Z").call(l.setClipUrl,e.layerClipId,t),!P.uniformtext.mode&&R){var W=l.makePointStyleFns(h);l.singlePointStyle(c,Y,h,W,t)}!function(t,e,r,n,a,s,c,h,p,m,v){var w,T=e.xaxis,A=e.yaxis,L=t._fullLayout;function P(e,r,n){return i.ensureSingle(e,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(l.font,n).call(o.convertToTspans,t)}var I=n[0].trace,z="h"===I.orientation,O=function(t,e,r,n,a){var o,s=e[0].trace;o=s.texttemplate?function(t,e,r,n,a){var o=e[0].trace,s=i.castOption(o,r,"texttemplate");if(!s)return"";var l,c,h,f,p="waterfall"===o.type,d="funnel"===o.type;"h"===o.orientation?(l="y",c=a,h="x",f=n):(l="x",c=n,h="y",f=a);function g(t){return u(f,+t,!0).text}var m=e[r],v={};v.label=m.p,v.labelLabel=v[l+"Label"]=(y=m.p,u(c,y,!0).text);var y;var x=i.castOption(o,m.i,"text");(0===x||x)&&(v.text=x);v.value=m.s,v.valueLabel=v[h+"Label"]=g(m.s);var _={};b(_,o,m.i),p&&(v.delta=+m.rawS||m.s,v.deltaLabel=g(v.delta),v.final=m.v,v.finalLabel=g(v.final),v.initial=v.final-v.delta,v.initialLabel=g(v.initial));d&&(v.value=m.s,v.valueLabel=g(v.value),v.percentInitial=m.begR,v.percentInitialLabel=i.formatPercent(m.begR),v.percentPrevious=m.difR,v.percentPreviousLabel=i.formatPercent(m.difR),v.percentTotal=m.sumR,v.percenTotalLabel=i.formatPercent(m.sumR));var w=i.castOption(o,m.i,"customdata");w&&(v.customdata=w);return i.texttemplateString(s,v,t._d3locale,_,v,o._meta||{})}(t,e,r,n,a):s.textinfo?function(t,e,r,n){var a=t[0].trace,o="h"===a.orientation,s="waterfall"===a.type,l="funnel"===a.type;function c(t){return u(o?r:n,+t,!0).text}var h,f=a.textinfo,p=t[e],d=f.split("+"),g=[],m=function(t){return-1!==d.indexOf(t)};m("label")&&g.push((v=t[e].p,u(o?n:r,v,!0).text));var v;m("text")&&(0===(h=i.castOption(a,p.i,"text"))||h)&&g.push(h);if(s){var y=+p.rawS||p.s,x=p.v,b=x-y;m("initial")&&g.push(c(b)),m("delta")&&g.push(c(y)),m("final")&&g.push(c(x))}if(l){m("value")&&g.push(c(p.s));var _=0;m("percent initial")&&_++,m("percent previous")&&_++,m("percent total")&&_++;var w=_>1;m("percent initial")&&(h=i.formatPercent(p.begR),w&&(h+=" of initial"),g.push(h)),m("percent previous")&&(h=i.formatPercent(p.difR),w&&(h+=" of previous"),g.push(h)),m("percent total")&&(h=i.formatPercent(p.sumR),w&&(h+=" of total"),g.push(h))}return g.join("
")}(e,r,n,a):g.getValue(s.text,r);return g.coerceString(y,o)}(L,n,a,T,A);w=function(t,e){var r=g.getValue(t.textposition,e);return g.coerceEnumerated(x,r)}(I,a);var D="stack"===m.mode||"relative"===m.mode,R=n[a],F=!D||R._outmost;if(!O||"none"===w||(R.isBlank||s===c||h===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var B=L.font,N=d.getBarColor(n[a],I),j=d.getInsideTextFont(I,a,B,N),U=d.getOutsideTextFont(I,a,B),V=r.datum();z?"log"===T.type&&V.s0<=0&&(s=T.range[0]=G*(X/Y):X>=Y*(Z/G);G>0&&Y>0&&(J||K||Q)?w="inside":(w="outside",q.remove(),q=null)}else w="inside";if(!q){W=i.ensureUniformFontSize(t,"outside"===w?U:j);var $=(q=P(r,O,W)).attr("transform");if(q.attr("transform",""),H=l.bBox(q.node()),G=H.width,Y=H.height,q.attr("transform",$),G<=0||Y<=0)return void q.remove()}var tt,et,rt=I.textangle;"outside"===w?(et="both"===I.constraintext||"outside"===I.constraintext,tt=function(t,e,r,n,a,i){var o,s=!!i.isHorizontal,l=!!i.constrained,c=i.angle||0,u=a.width,h=a.height,f=Math.abs(e-t),p=Math.abs(n-r);o=s?p>2*_?_:0:f>2*_?_:0;var d=1;l&&(d=s?Math.min(1,p/h):Math.min(1,f/u));var g=S(c),m=E(a,g),v=(s?m.x:m.y)/2,y=(a.left+a.right)/2,x=(a.top+a.bottom)/2,b=(t+e)/2,w=(r+n)/2,T=0,M=0,A=s?k(e,t):k(r,n);s?(b=e-A*o,T=A*v):(w=n+A*o,M=-A*v);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:d,rotate:g}}(s,c,h,p,H,{isHorizontal:z,constrained:et,angle:rt})):(et="both"===I.constraintext||"inside"===I.constraintext,tt=C(s,c,h,p,H,{isHorizontal:z,constrained:et,angle:rt,anchor:I.insidetextanchor}));tt.fontSize=W.size,f(I.type,tt,L),R.transform=tt,M(q,L,m,v).attr("transform",i.getTextTransform(tt))}(t,e,I,r,p,B,N,j,U,m,v),e.layerClipId&&l.hideOutsideRangePoint(c,I.select("text"),w,L,h.xcalendar,h.ycalendar)}));var j=!1===h.cliponaxis;l.setClipUrl(c,j?null:e.layerClipId,t)}));c.getComponentMethod("errorbars","plot")(t,I,e,m)},toMoveInsideBar:C}},{"../../components/color":615,"../../components/drawing":637,"../../components/fx/helpers":651,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../registry":880,"./attributes":890,"./constants":892,"./helpers":896,"./style":904,"./uniform_text":906,d3:169,"fast-isnumeric":241}],902:[function(t,e,r){"use strict";function n(t,e,r,n,a){var i=e.c2p(n?t.s0:t.p0,!0),o=e.c2p(n?t.s1:t.p1,!0),s=r.c2p(n?t.p0:t.s0,!0),l=r.c2p(n?t.p1:t.s1,!0);return a?[(i+o)/2,(s+l)/2]:n?[o,(s+l)/2]:[(i+o)/2,l]}e.exports=function(t,e){var r,a=t.cd,i=t.xaxis,o=t.yaxis,s=a[0].trace,l="funnel"===s.type,c="h"===s.orientation,u=[];if(!1===e)for(r=0;r1||0===a.bargap&&0===a.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),e.selectAll("g.points").each((function(e){d(n.select(this),e[0].trace,t)})),s.getComponentMethod("errorbars","style")(e)},styleTextPoints:g,styleOnSelect:function(t,e,r){var a=e[0].trace;a.selectedpoints?function(t,e,r){i.selectedPointStyle(t.selectAll("path"),e),function(t,e,r){t.each((function(t){var a,s=n.select(this);if(t.selected){a=o.ensureUniformFontSize(r,m(s,t,e,r));var l=e.selected.textfont&&e.selected.textfont.color;l&&(a.color=l),i.font(s,a)}else i.selectedTextStyle(s,e)}))}(t.selectAll("text"),e,r)}(r,a,t):(d(r,a,t),s.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:l}},{"../../components/color":615,"../../components/drawing":637,"../../lib":749,"../../registry":880,"./attributes":890,"./helpers":896,"./uniform_text":906,d3:169}],905:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s){r("marker.color",o),a(t,"marker")&&i(t,e,s,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),a(t,"marker.line")&&i(t,e,s,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":615,"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626}],906:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib");function i(t){return"_"+t+"Text_minsize"}e.exports={recordMinTextSize:function(t,e,r){if(r.uniformtext.mode){var n=i(t),a=r.uniformtext.minsize,o=e.scale*e.fontSize;e.hide=of.range[1]&&(x+=Math.PI);if(n.getClosest(c,(function(t){return g(y,x,[t.rp0,t.rp1],[t.thetag0,t.thetag1],d)?m+Math.min(1,Math.abs(t.thetag1-t.thetag0)/v)-1+(t.rp1-y)/(t.rp1-t.rp0)-1:1/0}),t),!1!==t.index){var b=c[t.index];t.x0=t.x1=b.ct[0],t.y0=t.y1=b.ct[1];var _=a.extendFlat({},b,{r:b.s,theta:b.p});return o(b,u,t),s(_,u,h,t),t.hovertemplate=u.hovertemplate,t.color=i(u,b),t.xLabelVal=t.yLabelVal=void 0,b.s<0&&(t.idealAlign="left"),[t]}}},{"../../components/fx":655,"../../lib":749,"../../plots/polar/helpers":862,"../bar/hover":897,"../scatterpolar/hover":1232}],911:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"barpolar",basePlotModule:t("../../plots/polar"),categories:["polar","bar","showLegend"],attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("../scatterpolar/format_labels"),style:t("../bar/style").style,styleOnSelect:t("../bar/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../bar/select"),meta:{}}},{"../../plots/polar":863,"../bar/select":902,"../bar/style":904,"../scatter/marker_colorbar":1173,"../scatterpolar/format_labels":1231,"./attributes":907,"./calc":908,"./defaults":909,"./hover":910,"./layout_attributes":912,"./layout_defaults":913,"./plot":914}],912:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","overlay"],dflt:"stack",editType:"calc"},bargap:{valType:"number",dflt:.1,min:0,max:1,editType:"calc"}}},{}],913:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){var i,o={};function s(r,o){return n.coerce(t[i]||{},e[i],a,r,o)}for(var l=0;l0?(c=o,u=l):(c=l,u=o);var h=[s.findEnclosingVertexAngles(c,t.vangles)[0],(c+u)/2,s.findEnclosingVertexAngles(u,t.vangles)[1]];return s.pathPolygonAnnulus(n,a,c,u,h,e,r)};return function(t,n,a,o){return i.pathAnnulus(t,n,a,o,e,r)}}(e),p=e.layers.frontplot.select("g.barlayer");i.makeTraceGroups(p,r,"trace bars").each((function(){var r=n.select(this),s=i.ensureSingle(r,"g","points").selectAll("g.point").data(i.identity);s.enter().append("g").style("vector-effect","non-scaling-stroke").style("stroke-miterlimit",2).classed("point",!0),s.exit().remove(),s.each((function(t){var e,r=n.select(this),o=t.rp0=u.c2p(t.s0),s=t.rp1=u.c2p(t.s1),p=t.thetag0=h.c2g(t.p0),d=t.thetag1=h.c2g(t.p1);if(a(o)&&a(s)&&a(p)&&a(d)&&o!==s&&p!==d){var g=u.c2g(t.s1),m=(p+d)/2;t.ct=[l.c2p(g*Math.cos(m)),c.c2p(g*Math.sin(m))],e=f(o,s,p,d)}else e="M0,0Z";i.ensureSingle(r,"path").attr("d",e)})),o.setClipUrl(r,e._hasClipOnAxisFalse?e.clipIds.forTraces:null,t)}))}},{"../../components/drawing":637,"../../lib":749,"../../plots/polar/helpers":862,d3:169,"fast-isnumeric":241}],915:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../bar/attributes"),i=t("../../components/color/attributes"),o=t("../../plots/template_attributes").hovertemplateAttrs,s=t("../../lib/extend").extendFlat,l=n.marker,c=l.line;e.exports={y:{valType:"data_array",editType:"calc+clearAxisTypes"},x:{valType:"data_array",editType:"calc+clearAxisTypes"},x0:{valType:"any",editType:"calc+clearAxisTypes"},y0:{valType:"any",editType:"calc+clearAxisTypes"},dx:{valType:"number",editType:"calc"},dy:{valType:"number",editType:"calc"},name:{valType:"string",editType:"calc+clearAxisTypes"},q1:{valType:"data_array",editType:"calc+clearAxisTypes"},median:{valType:"data_array",editType:"calc+clearAxisTypes"},q3:{valType:"data_array",editType:"calc+clearAxisTypes"},lowerfence:{valType:"data_array",editType:"calc"},upperfence:{valType:"data_array",editType:"calc"},notched:{valType:"boolean",editType:"calc"},notchwidth:{valType:"number",min:0,max:.5,dflt:.25,editType:"calc"},notchspan:{valType:"data_array",editType:"calc"},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],editType:"calc"},jitter:{valType:"number",min:0,max:1,editType:"calc"},pointpos:{valType:"number",min:-2,max:2,editType:"calc"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],editType:"calc"},mean:{valType:"data_array",editType:"calc"},sd:{valType:"data_array",editType:"calc"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},quartilemethod:{valType:"enumerated",values:["linear","exclusive","inclusive"],dflt:"linear",editType:"calc"},width:{valType:"number",min:0,dflt:0,editType:"calc"},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)",editType:"style"},symbol:s({},l.symbol,{arrayOk:!1,editType:"plot"}),opacity:s({},l.opacity,{arrayOk:!1,dflt:1,editType:"style"}),size:s({},l.size,{arrayOk:!1,editType:"calc"}),color:s({},l.color,{arrayOk:!1,editType:"style"}),line:{color:s({},c.color,{arrayOk:!1,dflt:i.defaultLine,editType:"style"}),width:s({},c.width,{arrayOk:!1,dflt:0,editType:"style"}),outliercolor:{valType:"color",editType:"style"},outlierwidth:{valType:"number",min:0,dflt:1,editType:"style"},editType:"style"},editType:"plot"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:n.fillcolor,whiskerwidth:{valType:"number",min:0,max:1,dflt:.5,editType:"calc"},offsetgroup:a.offsetgroup,alignmentgroup:a.alignmentgroup,selected:{marker:n.selected.marker,editType:"style"},unselected:{marker:n.unselected.marker,editType:"style"},text:s({},n.text,{}),hovertext:s({},n.hovertext,{}),hovertemplate:o({}),hoveron:{valType:"flaglist",flags:["boxes","points"],dflt:"boxes+points",editType:"style"}}},{"../../components/color/attributes":614,"../../lib/extend":739,"../../plots/template_attributes":875,"../bar/attributes":890,"../scatter/attributes":1155}],916:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),i=t("../../lib"),o=t("../../constants/numerical").BADNUM,s=i._;e.exports=function(t,e){var r,l,v,y,x,b,_=t._fullLayout,w=a.getFromId(t,e.xaxis||"x"),T=a.getFromId(t,e.yaxis||"y"),k=[],M="violin"===e.type?"_numViolins":"_numBoxes";"h"===e.orientation?(v=w,y="x",x=T,b="y"):(v=T,y="y",x=w,b="x");var A,S,E,C,L,P,I=function(t,e,r,a){var o,s=e+"0"in t,l="d"+e in t;if(e in t||s&&l)return r.makeCalcdata(t,e);o=s?t[e+"0"]:"name"in t&&("category"===r.type||n(t.name)&&-1!==["linear","log"].indexOf(r.type)||i.isDateTime(t.name)&&"date"===r.type)?t.name:a;for(var c="multicategory"===r.type?r.r2c_just_indices(o):r.d2c(o,0,t[e+"calendar"]),u=t._length,h=new Array(u),f=0;fA.uf};if(e._hasPreCompStats){var F=e[y],B=function(t){return v.d2c((e[t]||[])[r])},N=1/0,j=-1/0;for(r=0;r=A.q1&&A.q3>=A.med){var V=B("lowerfence");A.lf=V!==o&&V<=A.q1?V:f(A,E,C);var q=B("upperfence");A.uf=q!==o&&q>=A.q3?q:p(A,E,C);var H=B("mean");A.mean=H!==o?H:C?i.mean(E,C):(A.q1+A.q3)/2;var G=B("sd");A.sd=H!==o&&G>=0?G:C?i.stdev(E,C,A.mean):A.q3-A.q1,A.lo=d(A),A.uo=g(A);var Y=B("notchspan");Y=Y!==o&&Y>0?Y:m(A,C),A.ln=A.med-Y,A.un=A.med+Y;var W=A.lf,Z=A.uf;e.boxpoints&&E.length&&(W=Math.min(W,E[0]),Z=Math.max(Z,E[C-1])),e.notched&&(W=Math.min(W,A.ln),Z=Math.max(Z,A.un)),A.min=W,A.max=Z}else{var X;i.warn(["Invalid input - make sure that q1 <= median <= q3","q1 = "+A.q1,"median = "+A.med,"q3 = "+A.q3].join("\n")),X=A.med!==o?A.med:A.q1!==o?A.q3!==o?(A.q1+A.q3)/2:A.q1:A.q3!==o?A.q3:0,A.med=X,A.q1=A.q3=X,A.lf=A.uf=X,A.mean=A.sd=X,A.ln=A.un=X,A.min=A.max=X}N=Math.min(N,A.min),j=Math.max(j,A.max),A.pts2=S.filter(R),k.push(A)}}e._extremes[v._id]=a.findExtremes(v,[N,j],{padded:!0})}else{var J=v.makeCalcdata(e,y),K=function(t,e){for(var r=t.length,n=new Array(r+1),a=0;a=0&&tt0){var ot,st;if((A={}).pos=A[b]=O[r],S=A.pts=$[r].sort(u),C=(E=A[y]=S.map(h)).length,A.min=E[0],A.max=E[C-1],A.mean=i.mean(E,C),A.sd=i.stdev(E,C,A.mean),A.med=i.interp(E,.5),C%2&&(at||it))at?(ot=E.slice(0,C/2),st=E.slice(C/2+1)):it&&(ot=E.slice(0,C/2+1),st=E.slice(C/2)),A.q1=i.interp(ot,.5),A.q3=i.interp(st,.5);else A.q1=i.interp(E,.25),A.q3=i.interp(E,.75);A.lf=f(A,E,C),A.uf=p(A,E,C),A.lo=d(A),A.uo=g(A);var lt=m(A,C);A.ln=A.med-lt,A.un=A.med+lt,et=Math.min(et,A.ln),rt=Math.max(rt,A.un),A.pts2=S.filter(R),k.push(A)}e._extremes[v._id]=a.findExtremes(v,e.notched?J.concat([et,rt]):J,{padded:!0})}return function(t,e){if(i.isArrayOrTypedArray(e.selectedpoints))for(var r=0;r0?(k[0].t={num:_[M],dPos:D,posLetter:b,valLetter:y,labels:{med:s(t,"median:"),min:s(t,"min:"),q1:s(t,"q1:"),q3:s(t,"q3:"),max:s(t,"max:"),mean:"sd"===e.boxmean?s(t,"mean \xb1 \u03c3:"):s(t,"mean:"),lf:s(t,"lower fence:"),uf:s(t,"upper fence:")}},_[M]++,k):[{t:{empty:!0}}]};var l={text:"tx",hovertext:"htx"};function c(t,e,r){for(var n in l)i.isArrayOrTypedArray(e[n])&&(Array.isArray(r)?i.isArrayOrTypedArray(e[n][r[0]])&&(t[l[n]]=e[n][r[0]][r[1]]):t[l[n]]=e[n][r])}function u(t,e){return t.v-e.v}function h(t){return t.v}function f(t,e,r){return 0===r?t.q1:Math.min(t.q1,e[Math.min(i.findBin(2.5*t.q1-1.5*t.q3,e,!0)+1,r-1)])}function p(t,e,r){return 0===r?t.q3:Math.max(t.q3,e[Math.max(i.findBin(2.5*t.q3-1.5*t.q1,e),0)])}function d(t){return 4*t.q1-3*t.q3}function g(t){return 4*t.q3-3*t.q1}function m(t,e){return 0===e?0:1.57*(t.q3-t.q1)/Math.sqrt(e)}},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"fast-isnumeric":241}],917:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),a=t("../../lib"),i=t("../../plots/cartesian/axis_ids").getAxisGroup,o=["v","h"];function s(t,e,r,o){var s,l,c,u=e.calcdata,h=e._fullLayout,f=o._id,p=f.charAt(0),d=[],g=0;for(s=0;s1,b=1-h[t+"gap"],_=1-h[t+"groupgap"];for(s=0;s0){var H=E.pointpos,G=E.jitter,Y=E.marker.size/2,W=0;H+G>=0&&((W=V*(H+G))>A?(q=!0,j=Y,B=W):W>R&&(j=Y,B=A)),W<=A&&(B=A);var Z=0;H-G<=0&&((Z=-V*(H-G))>S?(q=!0,U=Y,N=Z):Z>F&&(U=Y,N=S)),Z<=S&&(N=S)}else B=A,N=S;var X=new Array(c.length);for(l=0;l0?(m="v",v=x>0?Math.min(_,b):Math.min(b)):x>0?(m="h",v=Math.min(_)):v=0;if(v){e._length=v;var M=r("orientation",m);e._hasPreCompStats?"v"===M&&0===x?(r("x0",0),r("dx",1)):"h"===M&&0===y&&(r("y0",0),r("dy",1)):"v"===M&&0===x?r("x0"):"h"===M&&0===y&&r("y0"),a.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],i)}else e.visible=!1}function u(t,e,r,a){var i=a.prefix,o=n.coerce2(t,e,l,"marker.outliercolor"),s=r("marker.line.outliercolor"),c="outliers";e._hasPreCompStats?c="all":(o||s)&&(c="suspectedoutliers");var u=r(i+"points",c);u?(r("jitter","all"===u?.3:0),r("pointpos","all"===u?-1.5:0),r("marker.symbol"),r("marker.opacity"),r("marker.size"),r("marker.color",e.line.color),r("marker.line.color"),r("marker.line.width"),"suspectedoutliers"===u&&(r("marker.line.outliercolor",e.marker.color),r("marker.line.outlierwidth")),r("selected.marker.color"),r("unselected.marker.color"),r("selected.marker.size"),r("unselected.marker.size"),r("text"),r("hovertext")):delete e.marker;var h=r("hoveron");"all"!==h&&-1===h.indexOf("points")||r("hovertemplate"),n.coerceSelectionMarkerOpacity(e,r)}e.exports={supplyDefaults:function(t,e,r,a){function o(r,a){return n.coerce(t,e,l,r,a)}if(c(t,e,o,a),!1!==e.visible){var s=e._hasPreCompStats;s&&(o("lowerfence"),o("upperfence")),o("line.color",(t.marker||{}).color||r),o("line.width"),o("fillcolor",i.addOpacity(e.line.color,.5));var h=!1;if(s){var f=o("mean"),p=o("sd");f&&f.length&&(h=!0,p&&p.length&&(h="sd"))}o("boxmean",h),o("whiskerwidth"),o("width"),o("quartilemethod");var d=!1;if(s){var g=o("notchspan");g&&g.length&&(d=!0)}else n.validate(t.notchwidth,l.notchwidth)&&(d=!0);o("notched",d)&&o("notchwidth"),u(t,e,o,{prefix:"box"})}},crossTraceDefaults:function(t,e){var r,a;function i(t){return n.coerce(a._input,a,l,t)}for(var s=0;st.lo&&(x.so=!0)}return i}));f.enter().append("path").classed("point",!0),f.exit().remove(),f.call(i.translatePoints,o,s)}function l(t,e,r,i){var o,s,l=e.val,c=e.pos,u=!!c.rangebreaks,h=i.bPos,f=i.bPosPxOffset||0,p=r.boxmean||(r.meanline||{}).visible;Array.isArray(i.bdPos)?(o=i.bdPos[0],s=i.bdPos[1]):(o=i.bdPos,s=i.bdPos);var d=t.selectAll("path.mean").data("box"===r.type&&r.boxmean||"violin"===r.type&&r.box.visible&&r.meanline.visible?a.identity:[]);d.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),d.exit().remove(),d.each((function(t){var e=c.c2l(t.pos+h,!0),a=c.l2p(e-o)+f,i=c.l2p(e+s)+f,d=u?(a+i)/2:c.l2p(e)+f,g=l.c2p(t.mean,!0),m=l.c2p(t.mean-t.sd,!0),v=l.c2p(t.mean+t.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+g+","+a+"V"+i+("sd"===p?"m0,0L"+m+","+d+"L"+g+","+a+"L"+v+","+d+"Z":"")):n.select(this).attr("d","M"+a+","+g+"H"+i+("sd"===p?"m0,0L"+d+","+m+"L"+a+","+g+"L"+d+","+v+"Z":""))}))}e.exports={plot:function(t,e,r,i){var c=e.xaxis,u=e.yaxis;a.makeTraceGroups(i,r,"trace boxes").each((function(t){var e,r,a=n.select(this),i=t[0],h=i.t,f=i.trace;(h.wdPos=h.bdPos*f.whiskerwidth,!0!==f.visible||h.empty)?a.remove():("h"===f.orientation?(e=u,r=c):(e=c,r=u),o(a,{pos:e,val:r},f,h),s(a,{x:c,y:u},f,h),l(a,{pos:e,val:r},f,h))}))},plotBoxAndWhiskers:o,plotPoints:s,plotBoxMean:l}},{"../../components/drawing":637,"../../lib":749,d3:169}],925:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,a=t.cd,i=t.xaxis,o=t.yaxis,s=[];if(!1===e)for(r=0;r=10)return null;for(var a=1/0,i=-1/0,o=e.length,s=0;s0?Math.floor:Math.ceil,I=C>0?Math.ceil:Math.floor,z=C>0?Math.min:Math.max,O=C>0?Math.max:Math.min,D=P(S+L),R=I(E-L),F=[[h=A(S)]];for(i=D;i*C=0;a--)i[u-a]=t[h][a],o[u-a]=e[h][a];for(s.push({x:i,y:o,bicubic:l}),a=h,i=[],o=[];a>=0;a--)i[h-a]=t[a][0],o[h-a]=e[a][0];return s.push({x:i,y:o,bicubic:c}),s}},{}],939:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),a=t("../../lib/extend").extendFlat;e.exports=function(t,e,r){var i,o,s,l,c,u,h,f,p,d,g,m,v,y,x=t["_"+e],b=t[e+"axis"],_=b._gridlines=[],w=b._minorgridlines=[],T=b._boundarylines=[],k=t["_"+r],M=t[r+"axis"];"array"===b.tickmode&&(b.tickvals=x.slice());var A=t._xctrl,S=t._yctrl,E=A[0].length,C=A.length,L=t._a.length,P=t._b.length;n.prepTicks(b),"array"===b.tickmode&&delete b.tickvals;var I=b.smoothing?3:1;function z(n){var a,i,o,s,l,c,u,h,p,d,g,m,v=[],y=[],x={};if("b"===e)for(i=t.b2j(n),o=Math.floor(Math.max(0,Math.min(P-2,i))),s=i-o,x.length=P,x.crossLength=L,x.xy=function(e){return t.evalxy([],e,i)},x.dxy=function(e,r){return t.dxydi([],e,o,r,s)},a=0;a0&&(p=t.dxydi([],a-1,o,0,s),v.push(l[0]+p[0]/3),y.push(l[1]+p[1]/3),d=t.dxydi([],a-1,o,1,s),v.push(h[0]-d[0]/3),y.push(h[1]-d[1]/3)),v.push(h[0]),y.push(h[1]),l=h;else for(a=t.a2i(n),c=Math.floor(Math.max(0,Math.min(L-2,a))),u=a-c,x.length=L,x.crossLength=P,x.xy=function(e){return t.evalxy([],a,e)},x.dxy=function(e,r){return t.dxydj([],c,e,u,r)},i=0;i0&&(g=t.dxydj([],c,i-1,u,0),v.push(l[0]+g[0]/3),y.push(l[1]+g[1]/3),m=t.dxydj([],c,i-1,u,1),v.push(h[0]-m[0]/3),y.push(h[1]-m[1]/3)),v.push(h[0]),y.push(h[1]),l=h;return x.axisLetter=e,x.axis=b,x.crossAxis=M,x.value=n,x.constvar=r,x.index=f,x.x=v,x.y=y,x.smoothing=M.smoothing,x}function O(n){var a,i,o,s,l,c=[],u=[],h={};if(h.length=x.length,h.crossLength=k.length,"b"===e)for(o=Math.max(0,Math.min(P-2,n)),l=Math.min(1,Math.max(0,n-o)),h.xy=function(e){return t.evalxy([],e,n)},h.dxy=function(e,r){return t.dxydi([],e,o,r,l)},a=0;ax.length-1||_.push(a(O(o),{color:b.gridcolor,width:b.gridwidth}));for(f=u;fx.length-1||g<0||g>x.length-1))for(m=x[s],v=x[g],i=0;ix[x.length-1]||w.push(a(z(d),{color:b.minorgridcolor,width:b.minorgridwidth}));b.startline&&T.push(a(O(0),{color:b.startlinecolor,width:b.startlinewidth})),b.endline&&T.push(a(O(x.length-1),{color:b.endlinecolor,width:b.endlinewidth}))}else{for(l=5e-15,u=(c=[Math.floor((x[x.length-1]-b.tick0)/b.dtick*(1+l)),Math.ceil((x[0]-b.tick0)/b.dtick/(1+l))].sort((function(t,e){return t-e})))[0],h=c[1],f=u;f<=h;f++)p=b.tick0+b.dtick*f,_.push(a(z(p),{color:b.gridcolor,width:b.gridwidth}));for(f=u-1;fx[x.length-1]||w.push(a(z(d),{color:b.minorgridcolor,width:b.minorgridwidth}));b.startline&&T.push(a(z(x[0]),{color:b.startlinecolor,width:b.startlinewidth})),b.endline&&T.push(a(z(x[x.length-1]),{color:b.endlinecolor,width:b.endlinewidth}))}}},{"../../lib/extend":739,"../../plots/cartesian/axes":797}],940:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),a=t("../../lib/extend").extendFlat;e.exports=function(t,e){var r,i,o,s=e._labels=[],l=e._gridlines;for(r=0;re.length&&(t=t.slice(0,e.length)):t=[],a=0;a90&&(p-=180,l=-l),{angle:p,flip:l,p:t.c2p(n,e,r),offsetMultplier:c}}},{}],954:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/drawing"),i=t("./map_1d_array"),o=t("./makepath"),s=t("./orient_text"),l=t("../../lib/svg_text_utils"),c=t("../../lib"),u=t("../../constants/alignment");function h(t,e,r,a,s,l){var c="const-"+s+"-lines",u=r.selectAll("."+c).data(l);u.enter().append("path").classed(c,!0).style("vector-effect","non-scaling-stroke"),u.each((function(r){var a=r,s=a.x,l=a.y,c=i([],s,t.c2p),u=i([],l,e.c2p),h="M"+o(c,u,a.smoothing);n.select(this).attr("d",h).style("stroke-width",a.width).style("stroke",a.color).style("fill","none")})),u.exit().remove()}function f(t,e,r,i,o,c,u,h){var f=c.selectAll("text."+h).data(u);f.enter().append("text").classed(h,!0);var p=0,d={};return f.each((function(o,c){var u;if("auto"===o.axis.tickangle)u=s(i,e,r,o.xy,o.dxy);else{var h=(o.axis.tickangle+180)*Math.PI/180;u=s(i,e,r,o.xy,[Math.cos(h),Math.sin(h)])}c||(d={angle:u.angle,flip:u.flip});var f=(o.endAnchor?-1:1)*u.flip,g=n.select(this).attr({"text-anchor":f>0?"start":"end","data-notex":1}).call(a.font,o.font).text(o.text).call(l.convertToTspans,t),m=a.bBox(this);g.attr("transform","translate("+u.p[0]+","+u.p[1]+") rotate("+u.angle+")translate("+o.axis.labelpadding*f+","+.3*m.height+")"),p=Math.max(p,m.width+o.axis.labelpadding)})),f.exit().remove(),d.maxExtent=p,d}e.exports=function(t,e,r,a){var l=e.xaxis,u=e.yaxis,p=t._fullLayout._clips;c.makeTraceGroups(a,r,"trace").each((function(e){var r=n.select(this),a=e[0],d=a.trace,m=d.aaxis,v=d.baxis,y=c.ensureSingle(r,"g","minorlayer"),x=c.ensureSingle(r,"g","majorlayer"),b=c.ensureSingle(r,"g","boundarylayer"),_=c.ensureSingle(r,"g","labellayer");r.style("opacity",d.opacity),h(l,u,x,m,"a",m._gridlines),h(l,u,x,v,"b",v._gridlines),h(l,u,y,m,"a",m._minorgridlines),h(l,u,y,v,"b",v._minorgridlines),h(l,u,b,m,"a-boundary",m._boundarylines),h(l,u,b,v,"b-boundary",v._boundarylines);var w=f(t,l,u,d,a,_,m._labels,"a-label"),T=f(t,l,u,d,a,_,v._labels,"b-label");!function(t,e,r,n,a,i,o,l){var u,h,f,p,d=c.aggNums(Math.min,null,r.a),m=c.aggNums(Math.max,null,r.a),v=c.aggNums(Math.min,null,r.b),y=c.aggNums(Math.max,null,r.b);u=.5*(d+m),h=v,f=r.ab2xy(u,h,!0),p=r.dxyda_rough(u,h),void 0===o.angle&&c.extendFlat(o,s(r,a,i,f,r.dxydb_rough(u,h)));g(t,e,r,n,f,p,r.aaxis,a,i,o,"a-title"),u=d,h=.5*(v+y),f=r.ab2xy(u,h,!0),p=r.dxydb_rough(u,h),void 0===l.angle&&c.extendFlat(l,s(r,a,i,f,r.dxyda_rough(u,h)));g(t,e,r,n,f,p,r.baxis,a,i,l,"b-title")}(t,_,d,a,l,u,w,T),function(t,e,r,n,a){var s,l,u,h,f=r.select("#"+t._clipPathId);f.size()||(f=r.append("clipPath").classed("carpetclip",!0));var p=c.ensureSingle(f,"path","carpetboundary"),d=e.clipsegments,g=[];for(h=0;h90&&m<270,y=n.select(this);y.text(u.title.text).call(l.convertToTspans,t),v&&(x=(-l.lineCount(y)+d)*p*i-x),y.attr("transform","translate("+e.p[0]+","+e.p[1]+") rotate("+e.angle+") translate(0,"+x+")").classed("user-select-none",!0).attr("text-anchor","middle").call(a.font,u.title.font)})),y.exit().remove()}},{"../../components/drawing":637,"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"./makepath":951,"./map_1d_array":952,"./orient_text":953,d3:169}],955:[function(t,e,r){"use strict";var n=t("./constants"),a=t("../../lib/search").findBin,i=t("./compute_control_points"),o=t("./create_spline_evaluator"),s=t("./create_i_derivative_evaluator"),l=t("./create_j_derivative_evaluator");e.exports=function(t){var e=t._a,r=t._b,c=e.length,u=r.length,h=t.aaxis,f=t.baxis,p=e[0],d=e[c-1],g=r[0],m=r[u-1],v=e[e.length-1]-e[0],y=r[r.length-1]-r[0],x=v*n.RELATIVE_CULL_TOLERANCE,b=y*n.RELATIVE_CULL_TOLERANCE;p-=x,d+=x,g-=b,m+=b,t.isVisible=function(t,e){return t>p&&tg&&ed||em},t.setScale=function(){var e=t._x,r=t._y,n=i(t._xctrl,t._yctrl,e,r,h.smoothing,f.smoothing);t._xctrl=n[0],t._yctrl=n[1],t.evalxy=o([t._xctrl,t._yctrl],c,u,h.smoothing,f.smoothing),t.dxydi=s([t._xctrl,t._yctrl],h.smoothing,f.smoothing),t.dxydj=l([t._xctrl,t._yctrl],h.smoothing,f.smoothing)},t.i2a=function(t){var r=Math.max(0,Math.floor(t[0]),c-2),n=t[0]-r;return(1-n)*e[r]+n*e[r+1]},t.j2b=function(t){var e=Math.max(0,Math.floor(t[1]),c-2),n=t[1]-e;return(1-n)*r[e]+n*r[e+1]},t.ij2ab=function(e){return[t.i2a(e[0]),t.j2b(e[1])]},t.a2i=function(t){var r=Math.max(0,Math.min(a(t,e),c-2)),n=e[r],i=e[r+1];return Math.max(0,Math.min(c-1,r+(t-n)/(i-n)))},t.b2j=function(t){var e=Math.max(0,Math.min(a(t,r),u-2)),n=r[e],i=r[e+1];return Math.max(0,Math.min(u-1,e+(t-n)/(i-n)))},t.ab2ij=function(e){return[t.a2i(e[0]),t.b2j(e[1])]},t.i2c=function(e,r){return t.evalxy([],e,r)},t.ab2xy=function(n,a,i){if(!i&&(ne[c-1]|ar[u-1]))return[!1,!1];var o=t.a2i(n),s=t.b2j(a),l=t.evalxy([],o,s);if(i){var h,f,p,d,g=0,m=0,v=[];ne[c-1]?(h=c-2,f=1,g=(n-e[c-1])/(e[c-1]-e[c-2])):f=o-(h=Math.max(0,Math.min(c-2,Math.floor(o)))),ar[u-1]?(p=u-2,d=1,m=(a-r[u-1])/(r[u-1]-r[u-2])):d=s-(p=Math.max(0,Math.min(u-2,Math.floor(s)))),g&&(t.dxydi(v,h,p,f,d),l[0]+=v[0]*g,l[1]+=v[1]*g),m&&(t.dxydj(v,h,p,f,d),l[0]+=v[0]*m,l[1]+=v[1]*m)}return l},t.c2p=function(t,e,r){return[e.c2p(t[0]),r.c2p(t[1])]},t.p2x=function(t,e,r){return[e.p2c(t[0]),r.p2c(t[1])]},t.dadi=function(t){var r=Math.max(0,Math.min(e.length-2,t));return e[r+1]-e[r]},t.dbdj=function(t){var e=Math.max(0,Math.min(r.length-2,t));return r[e+1]-r[e]},t.dxyda=function(e,r,n,a){var i=t.dxydi(null,e,r,n,a),o=t.dadi(e,n);return[i[0]/o,i[1]/o]},t.dxydb=function(e,r,n,a){var i=t.dxydj(null,e,r,n,a),o=t.dbdj(r,a);return[i[0]/o,i[1]/o]},t.dxyda_rough=function(e,r,n){var a=v*(n||.1),i=t.ab2xy(e+a,r,!0),o=t.ab2xy(e-a,r,!0);return[.5*(i[0]-o[0])/a,.5*(i[1]-o[1])/a]},t.dxydb_rough=function(e,r,n){var a=y*(n||.1),i=t.ab2xy(e,r+a,!0),o=t.ab2xy(e,r-a,!0);return[.5*(i[0]-o[0])/a,.5*(i[1]-o[1])/a]},t.dpdx=function(t){return t._m},t.dpdy=function(t){return t._m}}},{"../../lib/search":768,"./compute_control_points":943,"./constants":944,"./create_i_derivative_evaluator":945,"./create_j_derivative_evaluator":946,"./create_spline_evaluator":947}],956:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var a,i,o,s=[],l=[],c=t[0].length,u=t.length;function h(e,r){var n,a=0,i=0;return e>0&&void 0!==(n=t[r][e-1])&&(i++,a+=n),e0&&void 0!==(n=t[r-1][e])&&(i++,a+=n),r0&&i0&&a1e-5);return n.log("Smoother converged to",k,"after",M,"iterations"),t}},{"../../lib":749}],957:[function(t,e,r){"use strict";var n=t("../../lib").isArray1D;e.exports=function(t,e,r){var a=r("x"),i=a&&a.length,o=r("y"),s=o&&o.length;if(!i&&!s)return!1;if(e._cheater=!a,i&&!n(a)||s&&!n(o))e._length=null;else{var l=i?a.length:1/0;s&&(l=Math.min(l,o.length)),e.a&&e.a.length&&(l=Math.min(l,e.a.length)),e.b&&e.b.length&&(l=Math.min(l,e.b.length)),e._length=l}return!0}},{"../../lib":749}],958:[function(t,e,r){"use strict";var n=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../scattergeo/attributes"),i=t("../../components/colorscale/attributes"),o=t("../../plots/attributes"),s=t("../../components/color/attributes").defaultLine,l=t("../../lib/extend").extendFlat,c=a.marker.line;e.exports=l({locations:{valType:"data_array",editType:"calc"},locationmode:a.locationmode,z:{valType:"data_array",editType:"calc"},geojson:l({},a.geojson,{}),featureidkey:a.featureidkey,text:l({},a.text,{}),hovertext:l({},a.hovertext,{}),marker:{line:{color:l({},c.color,{dflt:s}),width:l({},c.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:a.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:a.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:l({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]}),hovertemplate:n(),showlegend:l({},o.showlegend,{dflt:!1})},i("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/color/attributes":614,"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scattergeo/attributes":1196}],959:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../constants/numerical").BADNUM,i=t("../../components/colorscale/calc"),o=t("../scatter/arrays_to_calcdata"),s=t("../scatter/calc_selection");function l(t){return t&&"string"==typeof t}e.exports=function(t,e){var r,c=e._length,u=new Array(c);r=e.geojson?function(t){return l(t)||n(t)}:l;for(var h=0;h")}(t,h,o,f.mockAxis),[t]}},{"../../lib":749,"../../plots/cartesian/axes":797,"./attributes":958}],963:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../heatmap/colorbar"),calc:t("./calc"),calcGeoJSON:t("./plot").calcGeoJSON,plot:t("./plot").plot,style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"choropleth",basePlotModule:t("../../plots/geo"),categories:["geo","noOpacity","showLegend"],meta:{}}},{"../../plots/geo":829,"../heatmap/colorbar":1037,"./attributes":958,"./calc":959,"./defaults":960,"./event_data":961,"./hover":962,"./plot":964,"./select":965,"./style":966}],964:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../lib/geo_location_utils"),o=t("../../lib/topojson_utils").getTopojsonFeatures,s=t("../../plots/cartesian/autorange").findExtremes,l=t("./style").style;e.exports={calcGeoJSON:function(t,e){for(var r=t[0].trace,n=e[r.geo],a=n._subplot,l=r.locationmode,c=r._length,u="geojson-id"===l?i.extractTraceFeature(t):o(r,a.topojson),h=[],f=[],p=0;p=0;n--){var a=r[n].id;if("string"==typeof a&&0===a.indexOf("water"))for(var i=n+1;i=0;r--)t.removeLayer(e[r][1])},s.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},e.exports=function(t,e){var r=e[0].trace,a=new o(t,r.uid),i=a.sourceId,s=n(e),l=a.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(i,{type:"geojson",data:s.geojson}),a._addLayers(s,l),e[0].trace._glTrace=a,a}},{"../../plots/mapbox/constants":852,"./convert":968}],972:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),a=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l={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"]}),showlegend:s({},o.showlegend,{dflt:!1})};s(l,n("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}));["opacity","lightposition","lighting"].forEach((function(t){l[t]=i[t]})),l.hoverinfo=s({},o.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","text","name"],dflt:"x+y+z+norm+text+name"}),l.transforms=void 0,e.exports=l},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../mesh3d/attributes":1096}],973:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){for(var r=e.u,a=e.v,i=e.w,o=Math.min(e.x.length,e.y.length,e.z.length,r.length,a.length,i.length),s=-1/0,l=1/0,c=0;co.level||o.starts.length&&i===o.level)}break;case"constraint":if(n.prefixBoundary=!1,n.edgepaths.length)return;var s=n.x.length,l=n.y.length,c=-1/0,u=1/0;for(r=0;r":p>c&&(n.prefixBoundary=!0);break;case"<":(pc||n.starts.length&&f===u)&&(n.prefixBoundary=!0);break;case"][":h=Math.min(p[0],p[1]),f=Math.max(p[0],p[1]),hc&&(n.prefixBoundary=!0)}}}},{}],980:[function(t,e,r){"use strict";var n=t("../../components/colorscale"),a=t("./make_color_map"),i=t("./end_plus");e.exports={min:"zmin",max:"zmax",calc:function(t,e,r){var o=e.contours,s=e.line,l=o.size||1,c=o.coloring,u=a(e,{isColorbar:!0});if("heatmap"===c){var h=n.extractOpts(e);r._fillgradient=h.reversescale?n.flipScale(h.colorscale):h.colorscale,r._zrange=[h.min,h.max]}else"fill"===c&&(r._fillcolor=u);r._line={color:"lines"===c?u:s.color,width:!1!==o.showlines?s.width:0,dash:s.dash},r._levels={start:o.start,end:i(o),size:l}}}},{"../../components/colorscale":627,"./end_plus":988,"./make_color_map":993}],981:[function(t,e,r){"use strict";e.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],982:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("./label_defaults"),i=t("../../components/color"),o=i.addOpacity,s=i.opacity,l=t("../../constants/filter_ops"),c=l.CONSTRAINT_REDUCTION,u=l.COMPARISON_OPS2;e.exports=function(t,e,r,i,l,h){var f,p,d,g=e.contours,m=r("contours.operation");(g._operation=c[m],function(t,e){var r;-1===u.indexOf(e.operation)?(t("contours.value",[0,1]),Array.isArray(e.value)?e.value.length>2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:n(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),n(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0))}(r,g),"="===m?f=g.showlines=!0:(f=r("contours.showlines"),d=r("fillcolor",o((t.line||{}).color||l,.5))),f)&&(p=r("line.color",d&&s(d)?o(e.fillcolor,1):l),r("line.width",2),r("line.dash"));r("line.smoothing"),a(r,i,p,h)}},{"../../components/color":615,"../../constants/filter_ops":720,"./label_defaults":992,"fast-isnumeric":241}],983:[function(t,e,r){"use strict";var n=t("../../constants/filter_ops"),a=t("fast-isnumeric");function i(t,e){var r,i=Array.isArray(e);function o(t){return a(t)?+t:null}return-1!==n.COMPARISON_OPS2.indexOf(t)?r=o(i?e[0]:e):-1!==n.INTERVAL_OPS.indexOf(t)?r=i?[o(e[0]),o(e[1])]:[o(e),o(e)]:-1!==n.SET_OPS.indexOf(t)&&(r=i?e.map(o):[o(e)]),r}function o(t){return function(e){e=i(t,e);var r=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return{start:r,end:n,size:n-r}}}function s(t){return function(e){return{start:e=i(t,e),end:1/0,size:1/0}}}e.exports={"[]":o("[]"),"][":o("]["),">":s(">"),"<":s("<"),"=":s("=")}},{"../../constants/filter_ops":720,"fast-isnumeric":241}],984:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=n("contours.start"),i=n("contours.end"),o=!1===a||!1===i,s=r("contours.size");!(o?e.autocontour=!0:r("autocontour",!1))&&s||r("ncontours")}},{}],985:[function(t,e,r){"use strict";var n=t("../../lib");function a(t){return n.extendFlat({},t,{edgepaths:n.extendDeep([],t.edgepaths),paths:n.extendDeep([],t.paths),starts:n.extendDeep([],t.starts)})}e.exports=function(t,e){var r,i,o,s=function(t){return t.reverse()},l=function(t){return t};switch(e){case"=":case"<":return t;case">":for(1!==t.length&&n.warn("Contour data invalid for the specified inequality operation."),i=t[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",t);break}return l}},{"../../lib":749,"./constraint_mapping":983,"./end_plus":988}],988:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],989:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./constants");function i(t,e,r,n){return Math.abs(t[0]-e[0])20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==a.BOTTOMSTART.indexOf(t)?i=1:-1!==a.LEFTSTART.indexOf(t)?n=1:-1!==a.TOPSTART.indexOf(t)?i=-1:n=-1;return[n,i]}(h,r,e),p=[s(t,e,[-f[0],-f[1]])],d=t.z.length,g=t.z[0].length,m=e.slice(),v=f.slice();for(c=0;c<1e4;c++){if(h>20?(h=a.CHOOSESADDLE[h][(f[0]||f[1])<0?0:1],t.crossings[u]=a.SADDLEREMAINDER[h]):delete t.crossings[u],!(f=a.NEWDELTA[h])){n.log("Found bad marching index:",h,e,t.level);break}p.push(s(t,e,f)),e[0]+=f[0],e[1]+=f[1],u=e.join(","),i(p[p.length-1],p[p.length-2],o,l)&&p.pop();var y=f[0]&&(e[0]<0||e[0]>g-2)||f[1]&&(e[1]<0||e[1]>d-2);if(e[0]===m[0]&&e[1]===m[1]&&f[0]===v[0]&&f[1]===v[1]||r&&y)break;h=t.crossings[u]}1e4===c&&n.log("Infinite loop in contour?");var x,b,_,w,T,k,M,A,S,E,C,L,P,I,z,O=i(p[0],p[p.length-1],o,l),D=0,R=.2*t.smoothing,F=[],B=0;for(c=1;c=B;c--)if((x=F[c])=B&&x+F[b]A&&S--,t.edgepaths[S]=C.concat(p,E));break}V||(t.edgepaths[A]=p.concat(E))}for(A=0;At?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);return 5===r||10===r?t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208:15===r?0:r}e.exports=function(t){var e,r,i,o,s,l,c,u,h,f=t[0].z,p=f.length,d=f[0].length,g=2===p||2===d;for(r=0;r=0&&(n=y,s=l):Math.abs(r[1]-n[1])<.01?Math.abs(r[1]-y[1])<.01&&(y[0]-r[0])*(n[0]-y[0])>=0&&(n=y,s=l):a.log("endpt to newendpt is not vert. or horz.",r,n,y)}if(r=n,s>=0)break;h+="L"+n}if(s===t.edgepaths.length){a.log("unclosed perimeter path");break}f=s,(d=-1===p.indexOf(f))&&(f=p[0],h+="Z")}for(f=0;fn.center?n.right-s:s-n.left)/(u+Math.abs(Math.sin(c)*o)),p=(l>n.middle?n.bottom-l:l-n.top)/(Math.abs(h)+Math.cos(c)*o);if(f<1||p<1)return 1/0;var d=v.EDGECOST*(1/(f-1)+1/(p-1));d+=v.ANGLECOST*c*c;for(var g=s-u,m=l-h,y=s+u,x=l+h,b=0;b2*v.MAXCOST)break;p&&(s/=2),l=(o=c-s/2)+1.5*s}if(f<=v.MAXCOST)return u},r.addLabelData=function(t,e,r,n){var a=e.fontSize,i=e.width+a/3,o=Math.max(0,e.height-a/3),s=t.x,l=t.y,c=t.theta,u=Math.sin(c),h=Math.cos(c),f=function(t,e){return[s+t*h-e*u,l+t*u+e*h]},p=[f(-i/2,-o/2),f(-i/2,o/2),f(i/2,o/2),f(i/2,-o/2)];r.push({text:e.text,x:s,y:l,dy:e.dy,theta:c,level:e.level,width:i,height:o}),n.push(p)},r.drawLabels=function(t,e,r,i,o){var l=t.selectAll("text").data(e,(function(t){return t.text+","+t.x+","+t.y+","+t.theta}));if(l.exit().remove(),l.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each((function(t){var e=t.x+Math.sin(t.theta)*t.dy,a=t.y-Math.cos(t.theta)*t.dy;n.select(this).text(t.text).attr({x:e,y:a,transform:"rotate("+180*t.theta/Math.PI+" "+e+" "+a+")"}).call(s.convertToTspans,r)})),o){for(var c="",u=0;ur.end&&(r.start=r.end=(r.start+r.end)/2),t._input.contours||(t._input.contours={}),a.extendFlat(t._input.contours,{start:r.start,end:r.end,size:r.size}),t._input.autocontour=!0}else if("constraint"!==r.type){var c,u=r.start,h=r.end,f=t._input.contours;if(u>h&&(r.start=f.start=h,h=r.end=f.end=u,u=r.start),!(r.size>0))c=u===h?1:i(u,h,t.ncontours).dtick,f.size=r.size=c}}},{"../../lib":749,"../../plots/cartesian/axes":797}],997:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/drawing"),i=t("../heatmap/style"),o=t("./make_color_map");e.exports=function(t){var e=n.select(t).selectAll("g.contour");e.style("opacity",(function(t){return t[0].trace.opacity})),e.each((function(t){var e=n.select(this),r=t[0].trace,i=r.contours,s=r.line,l=i.size||1,c=i.start,u="constraint"===i.type,h=!u&&"lines"===i.coloring,f=!u&&"fill"===i.coloring,p=h||f?o(r):null;e.selectAll("g.contourlevel").each((function(t){n.select(this).selectAll("path").call(a.lineGroupStyle,s.width,h?p(t.level):s.color,s.dash)}));var d=i.labelfont;if(e.selectAll("g.contourlabels text").each((function(t){a.font(n.select(this),{family:d.family,size:d.size,color:d.color||(h?p(t.level):s.color)})})),u)e.selectAll("g.contourfill path").style("fill",r.fillcolor);else if(f){var g;e.selectAll("g.contourfill path").style("fill",(function(t){return void 0===g&&(g=t.level),p(t.level+.5*l)})),void 0===g&&(g=c),e.selectAll("g.contourbg path").style("fill",p(g-.5*l))}})),i(t)}},{"../../components/drawing":637,"../heatmap/style":1046,"./make_color_map":993,d3:169}],998:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults"),a=t("./label_defaults");e.exports=function(t,e,r,i,o){var s,l=r("contours.coloring"),c="";"fill"===l&&(s=r("contours.showlines")),!1!==s&&("lines"!==l&&(c=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==l&&(!0!==t.showlegend&&(e.showlegend=!1),e._dfltShowLegend=!1,n(t,e,i,r,{prefix:"",cLetter:"z"})),r("line.smoothing"),a(r,i,c,o)}},{"../../components/colorscale/defaults":625,"./label_defaults":992}],999:[function(t,e,r){"use strict";var n=t("../heatmap/attributes"),a=t("../contour/attributes"),i=t("../../components/colorscale/attributes"),o=t("../../lib/extend").extendFlat,s=a.contours;e.exports=o({carpet:{valType:"string",editType:"calc"},z:n.z,a:n.x,a0:n.x0,da:n.dx,b:n.y,b0:n.y0,db:n.dy,text:n.text,hovertext:n.hovertext,transpose:n.transpose,atype:n.xtype,btype:n.ytype,fillcolor:a.fillcolor,autocontour:a.autocontour,ncontours:a.ncontours,contours:{type:s.type,start:s.start,end:s.end,size:s.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:s.showlines,showlabels:s.showlabels,labelfont:s.labelfont,labelformat:s.labelformat,operation:s.operation,value:s.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:a.line.color,width:a.line.width,dash:a.line.dash,smoothing:a.line.smoothing,editType:"plot"},transforms:void 0},i("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../contour/attributes":977,"../heatmap/attributes":1034}],1e3:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc"),a=t("../../lib"),i=t("../heatmap/convert_column_xyz"),o=t("../heatmap/clean_2d_array"),s=t("../heatmap/interp2d"),l=t("../heatmap/find_empties"),c=t("../heatmap/make_bound_array"),u=t("./defaults"),h=t("../carpet/lookup_carpetid"),f=t("../contour/set_contours");e.exports=function(t,e){var r=e._carpetTrace=h(t,e);if(r&&r.visible&&"legendonly"!==r.visible){if(!e.a||!e.b){var p=t.data[r.index],d=t.data[e.index];d.a||(d.a=p.a),d.b||(d.b=p.b),u(d,e,e._defaultColor,t._fullLayout)}var g=function(t,e){var r,u,h,f,p,d,g,m=e._carpetTrace,v=m.aaxis,y=m.baxis;v._minDtick=0,y._minDtick=0,a.isArray1D(e.z)&&i(e,v,y,"a","b",["z"]);r=e._a=e._a||e.a,f=e._b=e._b||e.b,r=r?v.makeCalcdata(e,"_a"):[],f=f?y.makeCalcdata(e,"_b"):[],u=e.a0||0,h=e.da||1,p=e.b0||0,d=e.db||1,g=e._z=o(e._z||e.z,e.transpose),e._emptypoints=l(g),s(g,e._emptypoints);var x=a.maxRowLength(g),b="scaled"===e.xtype?"":r,_=c(e,b,u,h,x,v),w="scaled"===e.ytype?"":f,T=c(e,w,p,d,g.length,y),k={a:_,b:T,z:g};"levels"===e.contours.type&&"none"!==e.contours.coloring&&n(t,e,{vals:g,containerStr:"",cLetter:"z"});return[k]}(t,e);return f(e,e._z),g}}},{"../../components/colorscale/calc":623,"../../lib":749,"../carpet/lookup_carpetid":950,"../contour/set_contours":996,"../heatmap/clean_2d_array":1036,"../heatmap/convert_column_xyz":1038,"../heatmap/find_empties":1040,"../heatmap/interp2d":1043,"../heatmap/make_bound_array":1044,"./defaults":1001}],1001:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/xyz_defaults"),i=t("./attributes"),o=t("../contour/constraint_defaults"),s=t("../contour/contours_defaults"),l=t("../contour/style_defaults");e.exports=function(t,e,r,c){function u(r,a){return n.coerce(t,e,i,r,a)}if(u("carpet"),t.a&&t.b){if(!a(t,e,u,c,"a","b"))return void(e.visible=!1);u("text"),"constraint"===u("contours.type")?o(t,e,u,c,r,{hasHover:!1}):(s(t,e,u,(function(r){return n.coerce2(t,e,i,r)})),l(t,e,u,c,{hasHover:!1}))}else e._defaultColor=r,e._length=null}},{"../../lib":749,"../contour/constraint_defaults":982,"../contour/contours_defaults":984,"../contour/style_defaults":998,"../heatmap/xyz_defaults":1048,"./attributes":999}],1002:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../contour/colorbar"),calc:t("./calc"),plot:t("./plot"),style:t("../contour/style"),moduleType:"trace",name:"contourcarpet",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","carpet","contour","symbols","showLegend","hasLines","carpetDependent","noHover","noSortingByValue"],meta:{}}},{"../../plots/cartesian":810,"../contour/colorbar":980,"../contour/style":997,"./attributes":999,"./calc":1e3,"./defaults":1001,"./plot":1003}],1003:[function(t,e,r){"use strict";var n=t("d3"),a=t("../carpet/map_1d_array"),i=t("../carpet/makepath"),o=t("../../components/drawing"),s=t("../../lib"),l=t("../contour/make_crossings"),c=t("../contour/find_all_paths"),u=t("../contour/plot"),h=t("../contour/constants"),f=t("../contour/convert_to_constraints"),p=t("../contour/empty_pathinfo"),d=t("../contour/close_boundaries"),g=t("../carpet/lookup_carpetid"),m=t("../carpet/axis_aligned_line");function v(t,e,r){var n=t.getPointAtLength(e),a=t.getPointAtLength(r),i=a.x-n.x,o=a.y-n.y,s=Math.sqrt(i*i+o*o);return[i/s,o/s]}function y(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}function x(t,e){var r=Math.abs(t[0]*e[0]+t[1]*e[1]);return Math.sqrt(1-r*r)/r}e.exports=function(t,e,r,b){var _=e.xaxis,w=e.yaxis;s.makeTraceGroups(b,r,"contour").each((function(r){var b=n.select(this),T=r[0],k=T.trace,M=k._carpetTrace=g(t,k),A=t.calcdata[M.index][0];if(M.visible&&"legendonly"!==M.visible){var S=T.a,E=T.b,C=k.contours,L=p(C,e,T),P="constraint"===C.type,I=C._operation,z=P?"="===I?"lines":"fill":C.coloring,O=[[S[0],E[E.length-1]],[S[S.length-1],E[E.length-1]],[S[S.length-1],E[0]],[S[0],E[0]]];l(L);var D=1e-8*(S[S.length-1]-S[0]),R=1e-8*(E[E.length-1]-E[0]);c(L,D,R);var F,B,N,j,U=L;"constraint"===C.type&&(U=f(L,I)),function(t,e){var r,n,a,i,o,s,l,c,u;for(r=0;r=0;j--)F=A.clipsegments[j],B=a([],F.x,_.c2p),N=a([],F.y,w.c2p),B.reverse(),N.reverse(),V.push(i(B,N,F.bicubic));var q="M"+V.join("L")+"Z";!function(t,e,r,n,o,l){var c,u,h,f,p=s.ensureSingle(t,"g","contourbg").selectAll("path").data("fill"!==l||o?[]:[0]);p.enter().append("path"),p.exit().remove();var d=[];for(f=0;f=0&&(f=C,d=g):Math.abs(h[1]-f[1])=0&&(f=C,d=g):s.log("endpt to newendpt is not vert. or horz.",h,f,C)}if(d>=0)break;y+=S(h,f),h=f}if(d===e.edgepaths.length){s.log("unclosed perimeter path");break}u=d,(b=-1===x.indexOf(u))&&(u=x[0],y+=S(h,f)+"Z",h=null)}for(u=0;um&&(n.max=m);n.len=n.max-n.min}(this,r,t,n,c,e.height),!(n.len<(e.width+e.height)*h.LABELMIN)))for(var a=Math.min(Math.ceil(n.len/I),h.LABELMAX),i=0;i0?+p[u]:0),h.push({type:"Feature",geometry:{type:"Point",coordinates:v},properties:y})}}var b=o.extractOpts(e),_=b.reversescale?o.flipScale(b.colorscale):b.colorscale,w=_[0][1],T=["interpolate",["linear"],["heatmap-density"],0,i.opacity(w)<1?w:i.addOpacity(w,0)];for(u=1;u<_.length;u++)T.push(_[u][0],_[u][1]);var k=["interpolate",["linear"],["get","z"],b.min,0,b.max,1];return a.extendFlat(c.heatmap.paint,{"heatmap-weight":d?k:1/(b.max-b.min),"heatmap-color":T,"heatmap-radius":g?{type:"identity",property:"r"}:e.radius,"heatmap-opacity":e.opacity}),c.geojson={type:"FeatureCollection",features:h},c.heatmap.layout.visibility="visible",c}},{"../../components/color":615,"../../components/colorscale":627,"../../constants/numerical":724,"../../lib":749,"../../lib/geojson_utils":743,"fast-isnumeric":241}],1007:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../components/colorscale/defaults"),i=t("./attributes");e.exports=function(t,e,r,o){function s(r,a){return n.coerce(t,e,i,r,a)}var l=s("lon")||[],c=s("lat")||[],u=Math.min(l.length,c.length);u?(e._length=u,s("z"),s("radius"),s("below"),s("text"),s("hovertext"),s("hovertemplate"),a(t,e,o,s,{prefix:"",cLetter:"z"})):e.visible=!1}},{"../../components/colorscale/defaults":625,"../../lib":749,"./attributes":1004}],1008:[function(t,e,r){"use strict";e.exports=function(t,e){return t.lon=e.lon,t.lat=e.lat,t.z=e.z,t}},{}],1009:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("../scattermapbox/hover");e.exports=function(t,e,r){var o=i(t,e,r);if(o){var s=o[0],l=s.cd,c=l[0].trace,u=l[s.index];if(delete s.color,"z"in u){var h=s.subplot.mockAxis;s.z=u.z,s.zLabel=a.tickText(h,h.c2l(u.z),"hover").text}return s.extraText=function(t,e,r){if(t.hovertemplate)return;var a=(e.hi||t.hoverinfo).split("+"),i=-1!==a.indexOf("all"),o=-1!==a.indexOf("lon"),s=-1!==a.indexOf("lat"),l=e.lonlat,c=[];function u(t){return t+"\xb0"}i||o&&s?c.push("("+u(l[0])+", "+u(l[1])+")"):o?c.push(r.lon+u(l[0])):s&&c.push(r.lat+u(l[1]));(i||-1!==a.indexOf("text"))&&n.fillText(e,t,c);return c.join("
")}(c,u,l[0].t.labels),[s]}}},{"../../lib":749,"../../plots/cartesian/axes":797,"../scattermapbox/hover":1224}],1010:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../heatmap/colorbar"),formatLabels:t("../scattermapbox/format_labels"),calc:t("./calc"),plot:t("./plot"),hoverPoints:t("./hover"),eventData:t("./event_data"),getBelow:function(t,e){for(var r=e.getMapLayers(),n=0;n=0;r--)t.removeLayer(e[r][1])},o.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},e.exports=function(t,e){var r=e[0].trace,a=new i(t,r.uid),o=a.sourceId,s=n(e),l=a.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(o,{type:"geojson",data:s.geojson}),a._addLayers(s,l),a}},{"../../plots/mapbox/constants":852,"./convert":1006}],1012:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;r"),s.color=function(t,e){var r=t.marker,a=e.mc||r.color,i=e.mlc||r.line.color,o=e.mlw||r.line.width;if(n(a))return a;if(n(i)&&o)return i}(c,h),[s]}}},{"../../components/color":615,"../../lib":749,"../bar/hover":897}],1020:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style").style,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("../bar/select"),moduleType:"trace",name:"funnel",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":810,"../bar/select":902,"./attributes":1013,"./calc":1014,"./cross_trace_calc":1016,"./defaults":1017,"./event_data":1018,"./hover":1019,"./layout_attributes":1021,"./layout_defaults":1022,"./plot":1023,"./style":1024}],1021:[function(t,e,r){"use strict";e.exports={funnelmode:{valType:"enumerated",values:["stack","group","overlay"],dflt:"stack",editType:"calc"},funnelgap:{valType:"number",min:0,max:1,editType:"calc"},funnelgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],1022:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){var i=!1;function o(r,i){return n.coerce(t,e,a,r,i)}for(var s=0;s path").each((function(t){if(!t.isBlank){var e=s.marker;n.select(this).call(i.fill,t.mc||e.color).call(i.stroke,t.mlc||e.line.color).call(a.dashLine,e.line.dash,t.mlw||e.line.width).style("opacity",s.selectedpoints&&!t.selected?o:1)}})),c(r,s,t),r.selectAll(".regions").each((function(){n.select(this).selectAll("path").style("stroke-width",0).call(i.fill,s.connector.fillcolor)})),r.selectAll(".lines").each((function(){var t=s.connector.line;a.lineGroupStyle(n.select(this).selectAll("path"),t.width,t.color,t.dash)}))}))}}},{"../../components/color":615,"../../components/drawing":637,"../../constants/interactions":723,"../bar/style":904,"../bar/uniform_text":906,d3:169}],1025:[function(t,e,r){"use strict";var n=t("../pie/attributes"),a=t("../../plots/attributes"),i=t("../../plots/domain").attributes,o=t("../../plots/template_attributes").hovertemplateAttrs,s=t("../../plots/template_attributes").texttemplateAttrs,l=t("../../lib/extend").extendFlat;e.exports={labels:n.labels,label0:n.label0,dlabel:n.dlabel,values:n.values,marker:{colors:n.marker.colors,line:{color:l({},n.marker.line.color,{dflt:null}),width:l({},n.marker.line.width,{dflt:1}),editType:"calc"},editType:"calc"},text:n.text,hovertext:n.hovertext,scalegroup:l({},n.scalegroup,{}),textinfo:l({},n.textinfo,{flags:["label","text","value","percent"]}),texttemplate:s({editType:"plot"},{keys:["label","color","value","text","percent"]}),hoverinfo:l({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:o({},{keys:["label","color","value","text","percent"]}),textposition:l({},n.textposition,{values:["inside","none"],dflt:"inside"}),textfont:n.textfont,insidetextfont:n.insidetextfont,title:{text:n.title.text,font:n.title.font,position:l({},n.title.position,{values:["top left","top center","top right"],dflt:"top center"}),editType:"plot"},domain:i({name:"funnelarea",trace:!0,editType:"calc"}),aspectratio:{valType:"number",min:0,dflt:1,editType:"plot"},baseratio:{valType:"number",min:0,max:1,dflt:.333,editType:"plot"}}},{"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/template_attributes":875,"../pie/attributes":1129}],1026:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.name="funnelarea",r.plot=function(t,e,a,i){n.plotBasePlot(r.name,t,e,a,i)},r.clean=function(t,e,a,i){n.cleanBasePlot(r.name,t,e,a,i)}},{"../../plots/plots":860}],1027:[function(t,e,r){"use strict";var n=t("../pie/calc");e.exports={calc:function(t,e){return n.calc(t,e)},crossTraceCalc:function(t){n.crossTraceCalc(t,{type:"funnelarea"})}}},{"../pie/calc":1131}],1028:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),i=t("../../plots/domain").defaults,o=t("../bar/defaults").handleText,s=t("../pie/defaults").handleLabelsAndValues;e.exports=function(t,e,r,l){function c(r,i){return n.coerce(t,e,a,r,i)}var u=c("labels"),h=c("values"),f=s(u,h),p=f.len;if(e._hasLabels=f.hasLabels,e._hasValues=f.hasValues,!e._hasLabels&&e._hasValues&&(c("label0"),c("dlabel")),p){e._length=p,c("marker.line.width")&&c("marker.line.color",l.paper_bgcolor),c("marker.colors"),c("scalegroup");var d,g=c("text"),m=c("texttemplate");if(m||(d=c("textinfo",Array.isArray(g)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),m||d&&"none"!==d){var v=c("textposition");o(t,e,l,c,v,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1})}i(e,l,c),c("title.text")&&(c("title.position"),n.coerceFont(c,"title.font",l.font)),c("aspectratio"),c("baseratio")}else e.visible=!1}},{"../../lib":749,"../../plots/domain":824,"../bar/defaults":894,"../pie/defaults":1132,"./attributes":1025}],1029:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"funnelarea",basePlotModule:t("./base_plot"),categories:["pie-like","funnelarea","showLegend"],attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),style:t("./style"),styleOne:t("../pie/style_one"),meta:{}}},{"../pie/style_one":1140,"./attributes":1025,"./base_plot":1026,"./calc":1027,"./defaults":1028,"./layout_attributes":1030,"./layout_defaults":1031,"./plot":1032,"./style":1033}],1030:[function(t,e,r){"use strict";var n=t("../pie/layout_attributes").hiddenlabels;e.exports={hiddenlabels:n,funnelareacolorway:{valType:"colorlist",editType:"calc"},extendfunnelareacolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{"../pie/layout_attributes":1136}],1031:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function r(r,i){return n.coerce(t,e,a,r,i)}r("hiddenlabels"),r("funnelareacolorway",e.colorway),r("extendfunnelareacolors")}},{"../../lib":749,"./layout_attributes":1030}],1032:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/drawing"),i=t("../../lib"),o=t("../../lib/svg_text_utils"),s=t("../bar/plot").toMoveInsideBar,l=t("../bar/uniform_text"),c=l.recordMinTextSize,u=l.clearMinTextSize,h=t("../pie/helpers"),f=t("../pie/plot"),p=f.attachFxHandlers,d=f.determineInsideTextFont,g=f.layoutAreas,m=f.prerenderTitles,v=f.positionTitleOutside,y=f.formatSliceLabel;function x(t,e){return"l"+(e[0]-t[0])+","+(e[1]-t[1])}e.exports=function(t,e){var r=t._fullLayout;u("funnelarea",r),m(e,t),g(e,r._size),i.makeTraceGroups(r._funnelarealayer,e,"trace").each((function(e){var l=n.select(this),u=e[0],f=u.trace;!function(t){if(!t.length)return;var e=t[0],r=e.trace,n=r.aspectratio,a=r.baseratio;a>.999&&(a=.999);var i,o=Math.pow(a,2),s=e.vTotal,l=s,c=s*o/(1-o)/s;function u(){var t,e={x:t=Math.sqrt(c),y:-t};return[e.x,e.y]}var h,f,p=[];for(p.push(u()),h=t.length-1;h>-1;h--)if(!(f=t[h]).hidden){var d=f.v/l;c+=d,p.push(u())}var g=1/0,m=-1/0;for(h=0;h-1;h--)if(!(f=t[h]).hidden){var M=p[k+=1][0],A=p[k][1];f.TL=[-M,A],f.TR=[M,A],f.BL=w,f.BR=T,f.pxmid=(S=f.TR,E=f.BR,[.5*(S[0]+E[0]),.5*(S[1]+E[1])]),w=f.TL,T=f.TR}var S,E}(e),l.each((function(){var l=n.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove(),l.each((function(l,g){if(l.hidden)n.select(this).selectAll("path,g").remove();else{l.pointNumber=l.i,l.curveNumber=f.index;var m=u.cx,v=u.cy,b=n.select(this),_=b.selectAll("path.surface").data([l]);_.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),b.call(p,t,e);var w="M"+(m+l.TR[0])+","+(v+l.TR[1])+x(l.TR,l.BR)+x(l.BR,l.BL)+x(l.BL,l.TL)+"Z";_.attr("d",w),y(t,l,u);var T=h.castOption(f.textposition,l.pts),k=b.selectAll("g.slicetext").data(l.text&&"none"!==T?[0]:[]);k.enter().append("g").classed("slicetext",!0),k.exit().remove(),k.each((function(){var u=i.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),h=i.ensureUniformFontSize(t,d(f,l,r.font));u.text(l.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(a.font,h).call(o.convertToTspans,t);var p,y,x,b=a.bBox(u.node()),_=Math.min(l.BL[1],l.BR[1])+v,w=Math.max(l.TL[1],l.TR[1])+v;y=Math.max(l.TL[0],l.BL[0])+m,x=Math.min(l.TR[0],l.BR[0])+m,(p=s(y,x,_,w,b,{isHorizontal:!0,constrained:!0,angle:0,anchor:"middle"})).fontSize=h.size,c(f.type,p,r),e[g].transform=p,u.attr("transform",i.getTextTransform(p))}))}}));var g=n.select(this).selectAll("g.titletext").data(f.title.text?[0]:[]);g.enter().append("g").classed("titletext",!0),g.exit().remove(),g.each((function(){var e=i.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),s=f.title.text;f._meta&&(s=i.templateString(s,f._meta)),e.text(s).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(a.font,f.title.font).call(o.convertToTspans,t);var l=v(u,r._size);e.attr("transform","translate("+l.x+","+l.y+")"+(l.scale<1?"scale("+l.scale+")":"")+"translate("+l.tx+","+l.ty+")")}))}))}))}},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../bar/plot":901,"../bar/uniform_text":906,"../pie/helpers":1134,"../pie/plot":1138,d3:169}],1033:[function(t,e,r){"use strict";var n=t("d3"),a=t("../pie/style_one"),i=t("../bar/uniform_text").resizeText;e.exports=function(t){var e=t._fullLayout._funnelarealayer.selectAll(".trace");i(t,e,"funnelarea"),e.each((function(t){var e=t[0].trace,r=n.select(this);r.style({opacity:e.opacity}),r.selectAll("path.surface").each((function(t){n.select(this).call(a,t,e)}))}))}},{"../bar/uniform_text":906,"../pie/style_one":1140,d3:169}],1034:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../plots/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../../components/colorscale/attributes"),s=(t("../../constants/docs").FORMAT_LINK,t("../../lib/extend").extendFlat);e.exports=s({z:{valType:"data_array",editType:"calc"},x:s({},n.x,{impliedEdits:{xtype:"array"}}),x0:s({},n.x0,{impliedEdits:{xtype:"scaled"}}),dx:s({},n.dx,{impliedEdits:{xtype:"scaled"}}),y:s({},n.y,{impliedEdits:{ytype:"array"}}),y0:s({},n.y0,{impliedEdits:{ytype:"scaled"}}),dy:s({},n.dy,{impliedEdits:{ytype:"scaled"}}),text:{valType:"data_array",editType:"calc"},hovertext:{valType:"data_array",editType:"calc"},transpose:{valType:"boolean",dflt:!1,editType:"calc"},xtype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},ytype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,editType:"calc"},hoverongaps:{valType:"boolean",dflt:!0,editType:"none"},connectgaps:{valType:"boolean",editType:"calc"},xgap:{valType:"number",dflt:0,min:0,editType:"plot"},ygap:{valType:"number",dflt:0,min:0,editType:"plot"},zhoverformat:{valType:"string",dflt:"",editType:"none"},hovertemplate:i(),showlegend:s({},a.showlegend,{dflt:!1})},{transforms:void 0},o("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":622,"../../constants/docs":719,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1035:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../histogram2d/calc"),s=t("../../components/colorscale/calc"),l=t("./convert_column_xyz"),c=t("./clean_2d_array"),u=t("./interp2d"),h=t("./find_empties"),f=t("./make_bound_array"),p=t("../../constants/numerical").BADNUM;function d(t){for(var e=[],r=t.length,n=0;nI){L("x scale is not linear");break}}if(v.length&&"fast"===E){var z=(v[v.length-1]-v[0])/(v.length-1),O=Math.abs(z/100);for(_=0;_O){L("y scale is not linear");break}}}var D=a.maxRowLength(b),R="scaled"===e.xtype?"":r,F=f(e,R,g,m,D,T),B="scaled"===e.ytype?"":v,N=f(e,B,y,x,b.length,k);S||(e._extremes[T._id]=i.findExtremes(T,F),e._extremes[k._id]=i.findExtremes(k,N));var j={x:F,y:N,z:b,text:e._text||e.text,hovertext:e._hovertext||e.hovertext};if(R&&R.length===F.length-1&&(j.xCenter=R),B&&B.length===N.length-1&&(j.yCenter=B),A&&(j.xRanges=w.xRanges,j.yRanges=w.yRanges,j.pts=w.pts),M||s(t,e,{vals:b,cLetter:"z"}),M&&e.contours&&"heatmap"===e.contours.coloring){var U={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};j.xfill=f(U,R,g,m,D,T),j.yfill=f(U,B,y,x,b.length,k)}return[j]}},{"../../components/colorscale/calc":623,"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"../histogram2d/calc":1067,"./clean_2d_array":1036,"./convert_column_xyz":1038,"./find_empties":1040,"./interp2d":1043,"./make_bound_array":1044}],1036:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r,o){var s,l,c,u,h,f;function p(t){if(n(t))return+t}if(e&&e.transpose){for(s=0,h=0;h=0;o--)(s=((h[[(r=(i=f[o])[0])-1,a=i[1]]]||g)[2]+(h[[r+1,a]]||g)[2]+(h[[r,a-1]]||g)[2]+(h[[r,a+1]]||g)[2])/20)&&(l[i]=[r,a,s],f.splice(o,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(i in l)h[i]=l[i],u.push(l[i])}return u.sort((function(t,e){return e[2]-t[2]}))}},{"../../lib":749}],1041:[function(t,e,r){"use strict";var n=t("../../components/fx"),a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("../../components/colorscale").extractOpts;e.exports=function(t,e,r,s,l,c){var u,h,f,p,d=t.cd[0],g=d.trace,m=t.xa,v=t.ya,y=d.x,x=d.y,b=d.z,_=d.xCenter,w=d.yCenter,T=d.zmask,k=g.zhoverformat,M=y,A=x;if(!1!==t.index){try{f=Math.round(t.index[1]),p=Math.round(t.index[0])}catch(e){return void a.error("Error hovering on heatmap, pointNumber must be [row,col], found:",t.index)}if(f<0||f>=b[0].length||p<0||p>b.length)return}else{if(n.inbox(e-y[0],e-y[y.length-1],0)>0||n.inbox(r-x[0],r-x[x.length-1],0)>0)return;if(c){var S;for(M=[2*y[0]-y[1]],S=1;Sg&&(v=Math.max(v,Math.abs(t[i][o]-d)/(m-g))))}return v}e.exports=function(t,e){var r,a=1;for(o(t,e),r=0;r.01;r++)a=o(t,e,i(a));return a>.01&&n.log("interp2d didn't converge quickly",a),t}},{"../../lib":749}],1044:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib").isArrayOrTypedArray;e.exports=function(t,e,r,i,o,s){var l,c,u,h=[],f=n.traceIs(t,"contour"),p=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(a(e)&&e.length>1&&!p&&"category"!==s.type){var g=e.length;if(!(g<=o))return f?e.slice(0,o):e.slice(0,o+1);if(f||d)h=e.slice(0,o);else if(1===o)h=[e[0]-.5,e[0]+.5];else{for(h=[1.5*e[0]-.5*e[1]],u=1;u0;)f=p.c2p(T[y]),y--;for(f0;)v=d.c2p(k[y]),y--;if(v0&&(i=!0);for(var l=0;li){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]c?t>o?t>1.1*a?a:t>1.1*i?i:o:t>s?s:t>l?l:c:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function p(t,e,r,n,i,s){if(n&&t>o){var l=d(e,i,s),c=d(r,i,s),u=t===a?0:1;return l[u]!==c[u]}return Math.floor(r/t)-Math.floor(e/t)>.1}function d(t,e,r){var n=e.c2d(t,a,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}e.exports=function(t,e,r,n,i){var s,l,c=-1.1*e,f=-.1*e,p=t-f,d=r[0],g=r[1],m=Math.min(h(d+f,d+p,n,i),h(g+f,g+p,n,i)),v=Math.min(h(d+c,d+f,n,i),h(g+c,g+f,n,i));if(m>v&&vo){var y=s===a?1:6,x=s===a?"M12":"M1";return function(e,r){var o=n.c2d(e,a,i),s=o.indexOf("-",y);s>0&&(o=o.substr(0,s));var c=n.d2c(o,0,i);if(cr.r2l(B)&&(j=o.tickIncrement(j,b.size,!0,p)),O.start=r.l2r(j),F||a.nestedProperty(e,v+".start").set(O.start)}var U=b.end,V=r.r2l(z.end),q=void 0!==V;if((b.endFound||q)&&V!==r.r2l(U)){var H=q?V:a.aggNums(Math.max,null,d);O.end=r.l2r(H),q||a.nestedProperty(e,v+".start").set(O.end)}var G="autobin"+s;return!1===e._input[G]&&(e._input[v]=a.extendFlat({},e[v]||{}),delete e._input[G],delete e[G]),[O,d]}e.exports={calc:function(t,e){var r,i,p,d,g=[],m=[],v=o.getFromId(t,"h"===e.orientation?e.yaxis:e.xaxis),y="h"===e.orientation?"y":"x",x={x:"y",y:"x"}[y],b=e[y+"calendar"],_=e.cumulative,w=f(t,e,v,y),T=w[0],k=w[1],M="string"==typeof T.size,A=[],S=M?A:T,E=[],C=[],L=[],P=0,I=e.histnorm,z=e.histfunc,O=-1!==I.indexOf("density");_.enabled&&O&&(I=I.replace(/ ?density$/,""),O=!1);var D,R="max"===z||"min"===z?null:0,F=l.count,B=c[I],N=!1,j=function(t){return v.r2c(t,0,b)};for(a.isArrayOrTypedArray(e[x])&&"count"!==z&&(D=e[x],N="avg"===z,F=l[z]),r=j(T.start),p=j(T.end)+(r-o.tickIncrement(r,T.size,!1,b))/1e6;r=0&&d=0;n--)s(n);else if("increasing"===e){for(n=1;n=0;n--)t[n]+=t[n+1];"exclude"===r&&(t.push(0),t.shift())}}(m,_.direction,_.currentbin);var J=Math.min(g.length,m.length),K=[],Q=0,$=J-1;for(r=0;r=Q;r--)if(m[r]){$=r;break}for(r=Q;r<=$;r++)if(n(g[r])&&n(m[r])){var tt={p:g[r],s:m[r],b:0};_.enabled||(tt.pts=L[r],G?tt.ph0=tt.ph1=L[r].length?k[L[r][0]]:g[r]:(e._computePh=!0,tt.ph0=q(A[r]),tt.ph1=q(A[r+1],!0))),K.push(tt)}return 1===K.length&&(K[0].width1=o.tickIncrement(K[0].p,T.size,!1,b)-K[0].p),s(K,e),a.isArrayOrTypedArray(e.selectedpoints)&&a.tagSelected(K,e,Z),K},calcAllAutoBins:f}},{"../../lib":749,"../../plots/cartesian/axes":797,"../../registry":880,"../bar/arrays_to_calcdata":889,"./average":1054,"./bin_functions":1056,"./bin_label_vals":1057,"./norm_functions":1065,"fast-isnumeric":241}],1059:[function(t,e,r){"use strict";e.exports={eventDataKeys:["binNumber"]}},{}],1060:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axis_ids"),i=t("../../registry").traceIs,o=t("../bar/defaults").handleGroupingDefaults,s=n.nestedProperty,l=a.getAxisGroup,c=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],u=["x","y"];e.exports=function(t,e){var r,h,f,p,d,g,m,v=e._histogramBinOpts={},y=[],x={},b=[];function _(t,e){return n.coerce(r._input,r,r._module.attributes,t,e)}function w(t){return"v"===t.orientation?"x":"y"}function T(t,r,i){var o=t.uid+"__"+i;r||(r=o);var s=function(t,r){return a.getFromTrace({_fullLayout:e},t,r).type}(t,i),l=t[i+"calendar"]||"",c=v[r],u=!0;c&&(s===c.axType&&l===c.calendar?(u=!1,c.traces.push(t),c.dirs.push(i)):(r=o,s!==c.axType&&n.warn(["Attempted to group the bins of trace",t.index,"set on a","type:"+s,"axis","with bins on","type:"+c.axType,"axis."].join(" ")),l!==c.calendar&&n.warn(["Attempted to group the bins of trace",t.index,"set with a",l,"calendar","with bins",c.calendar?"on a "+c.calendar+" calendar":"w/o a set calendar"].join(" ")))),u&&(v[r]={traces:[t],dirs:[i],axType:s,calendar:t[i+"calendar"]||""}),t["_"+i+"bingroup"]=r}for(d=0;dS&&T.splice(S,T.length-S),A.length>S&&A.splice(S,A.length-S);var E=[],C=[],L=[],P="string"==typeof w.size,I="string"==typeof M.size,z=[],O=[],D=P?z:w,R=I?O:M,F=0,B=[],N=[],j=e.histnorm,U=e.histfunc,V=-1!==j.indexOf("density"),q="max"===U||"min"===U?null:0,H=i.count,G=o[j],Y=!1,W=[],Z=[],X="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";X&&"count"!==U&&(Y="avg"===U,H=i[U]);var J=w.size,K=x(w.start),Q=x(w.end)+(K-a.tickIncrement(K,J,!1,v))/1e6;for(r=K;r=0&&p=0&&d0||n.inbox(r-o.y0,r-(o.y0+o.h*s.dy),0)>0)){var u,h=Math.floor((e-o.x0)/s.dx),f=Math.floor(Math.abs(r-o.y0)/s.dy);if(s._hasZ?u=o.z[f][h]:s._hasSource&&(u=s._canvas.el.getContext("2d").getImageData(h,f,1,1).data),u){var p,d=o.hi||s.hoverinfo;if(d){var g=d.split("+");-1!==g.indexOf("all")&&(g=["color"]),-1!==g.indexOf("color")&&(p=!0)}var m,v=i.colormodel[s.colormodel],y=v.colormodel||s.colormodel,x=y.length,b=s._scaler(u),_=v.suffix,w=[];(s.hovertemplate||p)&&(w.push("["+[b[0]+_[0],b[1]+_[1],b[2]+_[2]].join(", ")),4===x&&w.push(", "+b[3]+_[3]),w.push("]"),w=w.join(""),t.extraText=y.toUpperCase()+": "+w),Array.isArray(s.hovertext)&&Array.isArray(s.hovertext[f])?m=s.hovertext[f][h]:Array.isArray(s.text)&&Array.isArray(s.text[f])&&(m=s.text[f][h]);var T=c.c2p(o.y0+(f+.5)*s.dy),k=o.x0+(h+.5)*s.dx,M=o.y0+(f+.5)*s.dy,A="["+u.slice(0,s.colormodel.length).join(", ")+"]";return[a.extendFlat(t,{index:[f,h],x0:l.c2p(o.x0+h*s.dx),x1:l.c2p(o.x0+(h+1)*s.dx),y0:T,y1:T,color:b,xVal:k,xLabelVal:k,yVal:M,yLabelVal:M,zLabelVal:A,text:m,hovertemplateLabels:{zLabel:A,colorLabel:w,"color[0]Label":b[0]+_[0],"color[1]Label":b[1]+_[1],"color[2]Label":b[2]+_[2],"color[3]Label":b[3]+_[3]}})]}}}},{"../../components/fx":655,"../../lib":749,"./constants":1077}],1081:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover"),eventData:t("./event_data"),moduleType:"trace",name:"image",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","2dMap","noSortingByValue"],animatable:!1,meta:{}}},{"../../plots/cartesian":810,"./attributes":1075,"./calc":1076,"./defaults":1078,"./event_data":1079,"./hover":1080,"./plot":1082,"./style":1083}],1082:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../constants/xmlns_namespaces"),o=t("./constants"),s=a.isIOS()||a.isSafari()||a.isIE();function l(t){return"linear"===t.type&&t.range[1]>t.range[0]==("x"===t._id.charAt(0))}e.exports=function(t,e,r,c){var u=e.xaxis,h=e.yaxis,f=!(s||t._context._exportedPlot);a.makeTraceGroups(c,r,"im").each((function(e){var r=n.select(this),s=e[0],c=s.trace,p=f&&!c._hasZ&&c._hasSource&&l(u)&&l(h);c._fastImage=p;var d,g,m,v,y,x,b=s.z,_=s.x0,w=s.y0,T=s.w,k=s.h,M=c.dx,A=c.dy;for(x=0;void 0===d&&x0;)g=u.c2p(_+x*M),x--;for(x=0;void 0===v&&x0;)y=h.c2p(w+x*A),x--;if(g0}function x(t){t.each((function(t){d.stroke(n.select(this),t.line.color)})).each((function(t){d.fill(n.select(this),t.color)})).style("stroke-width",(function(t){return t.line.width}))}function b(t,e,r){var n=t._fullLayout,i=a.extendFlat({type:"linear",ticks:"outside",range:r,showline:!0},e),o={type:"linear",_id:"x"+e._id},s={letter:"x",font:n.font,noHover:!0,noTickson:!0};function l(t,e){return a.coerce(i,o,p,t,e)}return h(i,o,l,s,n),f(i,o,l,s),o}function _(t,e){return"translate("+t+","+e+")"}function w(t,e,r){return[Math.min(e/t.width,r/t.height),t,e+"x"+r]}function T(t,e,r,a){var i=document.createElementNS("http://www.w3.org/2000/svg","text"),o=n.select(i);return o.text(t).attr("x",0).attr("y",0).attr("text-anchor",r).attr("data-unformatted",t).call(c.convertToTspans,a).call(s.font,e),s.bBox(o.node())}function k(t,e,r,n,i,o){var s="_cache"+e;t[s]&&t[s].key===i||(t[s]={key:i,value:r});var l=a.aggNums(o,null,[t[s].value,n],2);return t[s].value=l,l}e.exports=function(t,e,r,h){var f,p=t._fullLayout;y(r)&&h&&(f=h()),a.makeTraceGroups(p._indicatorlayer,e,"trace").each((function(e){var h,M,A,S,E,C=e[0].trace,L=n.select(this),P=C._hasGauge,I=C._isAngular,z=C._isBullet,O=C.domain,D={w:p._size.w*(O.x[1]-O.x[0]),h:p._size.h*(O.y[1]-O.y[0]),l:p._size.l+p._size.w*O.x[0],r:p._size.r+p._size.w*(1-O.x[1]),t:p._size.t+p._size.h*(1-O.y[1]),b:p._size.b+p._size.h*O.y[0]},R=D.l+D.w/2,F=D.t+D.h/2,B=Math.min(D.w/2,D.h),N=l.innerRadius*B,j=C.align||"center";if(M=F,P){if(I&&(h=R,M=F+B/2,A=function(t){return function(t,e){var r=Math.sqrt(t.width/2*(t.width/2)+t.height*t.height);return[e/r,t,e]}(t,.9*N)}),z){var U=l.bulletPadding,V=1-l.bulletNumberDomainSize+U;h=D.l+(V+(1-V)*m[j])*D.w,A=function(t){return w(t,(l.bulletNumberDomainSize-U)*D.w,D.h)}}}else h=D.l+m[j]*D.w,A=function(t){return w(t,D.w,D.h)};!function(t,e,r,i){var o,l,h,f=r[0].trace,p=i.numbersX,x=i.numbersY,w=f.align||"center",M=g[w],A=i.transitionOpts,S=i.onComplete,E=a.ensureSingle(e,"g","numbers"),C=[];f._hasNumber&&C.push("number");f._hasDelta&&(C.push("delta"),"left"===f.delta.position&&C.reverse());var L=E.selectAll("text").data(C);function P(e,r,n,a){if(!e.match("s")||n>=0==a>=0||r(n).slice(-1).match(v)||r(a).slice(-1).match(v))return r;var i=e.slice().replace("s","f").replace(/\d+/,(function(t){return parseInt(t)-1})),o=b(t,{tickformat:i});return function(t){return Math.abs(t)<1?u.tickText(o,t).text:r(t)}}L.enter().append("text"),L.attr("text-anchor",(function(){return M})).attr("class",(function(t){return t})).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),L.exit().remove();var I,z=f.mode+f.align;f._hasDelta&&(I=function(){var e=b(t,{tickformat:f.delta.valueformat},f._range);e.setScale(),u.prepTicks(e);var a=function(t){return u.tickText(e,t).text},i=function(t){return f.delta.relative?t.relativeDelta:t.delta},o=function(t,e){return 0===t||"number"!=typeof t||isNaN(t)?"-":(t>0?f.delta.increasing.symbol:f.delta.decreasing.symbol)+e(t)},h=function(t){return t.delta>=0?f.delta.increasing.color:f.delta.decreasing.color};void 0===f._deltaLastValue&&(f._deltaLastValue=i(r[0]));var p=E.select("text.delta");function g(){p.text(o(i(r[0]),a)).call(d.fill,h(r[0])).call(c.convertToTspans,t)}return p.call(s.font,f.delta.font).call(d.fill,h({delta:f._deltaLastValue})),y(A)?p.transition().duration(A.duration).ease(A.easing).tween("text",(function(){var t=n.select(this),e=i(r[0]),s=f._deltaLastValue,l=P(f.delta.valueformat,a,s,e),c=n.interpolateNumber(s,e);return f._deltaLastValue=e,function(e){t.text(o(c(e),l)),t.call(d.fill,h({delta:c(e)}))}})).each("end",(function(){g(),S&&S()})).each("interrupt",(function(){g(),S&&S()})):g(),l=T(o(i(r[0]),a),f.delta.font,M,t),p}(),z+=f.delta.position+f.delta.font.size+f.delta.font.family+f.delta.valueformat,z+=f.delta.increasing.symbol+f.delta.decreasing.symbol,h=l);f._hasNumber&&(!function(){var e=b(t,{tickformat:f.number.valueformat},f._range);e.setScale(),u.prepTicks(e);var a=function(t){return u.tickText(e,t).text},i=f.number.suffix,l=f.number.prefix,h=E.select("text.number");function p(){var e="number"==typeof r[0].y?l+a(r[0].y)+i:"-";h.text(e).call(s.font,f.number.font).call(c.convertToTspans,t)}y(A)?h.transition().duration(A.duration).ease(A.easing).each("end",(function(){p(),S&&S()})).each("interrupt",(function(){p(),S&&S()})).attrTween("text",(function(){var t=n.select(this),e=n.interpolateNumber(r[0].lastY,r[0].y);f._lastValue=r[0].y;var o=P(f.number.valueformat,a,r[0].lastY,r[0].y);return function(r){t.text(l+o(e(r))+i)}})):p(),o=T(l+a(r[0].y)+i,f.number.font,M,t)}(),z+=f.number.font.size+f.number.font.family+f.number.valueformat+f.number.suffix+f.number.prefix,h=o);if(f._hasDelta&&f._hasNumber){var O,D,R=[(o.left+o.right)/2,(o.top+o.bottom)/2],F=[(l.left+l.right)/2,(l.top+l.bottom)/2],B=.75*f.delta.font.size;"left"===f.delta.position&&(O=k(f,"deltaPos",0,-1*(o.width*m[f.align]+l.width*(1-m[f.align])+B),z,Math.min),D=R[1]-F[1],h={width:o.width+l.width+B,height:Math.max(o.height,l.height),left:l.left+O,right:o.right,top:Math.min(o.top,l.top+D),bottom:Math.max(o.bottom,l.bottom+D)}),"right"===f.delta.position&&(O=k(f,"deltaPos",0,o.width*(1-m[f.align])+l.width*m[f.align]+B,z,Math.max),D=R[1]-F[1],h={width:o.width+l.width+B,height:Math.max(o.height,l.height),left:o.left,right:l.right+O,top:Math.min(o.top,l.top+D),bottom:Math.max(o.bottom,l.bottom+D)}),"bottom"===f.delta.position&&(O=null,D=l.height,h={width:Math.max(o.width,l.width),height:o.height+l.height,left:Math.min(o.left,l.left),right:Math.max(o.right,l.right),top:o.bottom-o.height,bottom:o.bottom+l.height}),"top"===f.delta.position&&(O=null,D=o.top,h={width:Math.max(o.width,l.width),height:o.height+l.height,left:Math.min(o.left,l.left),right:Math.max(o.right,l.right),top:o.bottom-o.height-l.height,bottom:o.bottom}),I.attr({dx:O,dy:D})}(f._hasNumber||f._hasDelta)&&E.attr("transform",(function(){var t=i.numbersScaler(h);z+=t[2];var e,r=k(f,"numbersScale",1,t[0],z,Math.min);f._scaleNumbers||(r=1),e=f._isAngular?x-r*h.bottom:x-r*(h.top+h.bottom)/2,f._numbersTop=r*h.top+e;var n=h[w];"center"===w&&(n=(h.left+h.right)/2);var a=p-r*n;return _(a=k(f,"numbersTranslate",0,a,z,Math.max),e)+" scale("+r+")"}))}(t,L,e,{numbersX:h,numbersY:M,numbersScaler:A,transitionOpts:r,onComplete:f}),P&&(S={range:C.gauge.axis.range,color:C.gauge.bgcolor,line:{color:C.gauge.bordercolor,width:0},thickness:1},E={range:C.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:C.gauge.bordercolor,width:C.gauge.borderwidth},thickness:1});var q=L.selectAll("g.angular").data(I?e:[]);q.exit().remove();var H=L.selectAll("g.angularaxis").data(I?e:[]);H.exit().remove(),I&&function(t,e,r,a){var s,l,c,h,f=r[0].trace,p=a.size,d=a.radius,g=a.innerRadius,m=a.gaugeBg,v=a.gaugeOutline,w=[p.l+p.w/2,p.t+p.h/2+d/2],T=a.gauge,k=a.layer,M=a.transitionOpts,A=a.onComplete,S=Math.PI/2;function E(t){var e=f.gauge.axis.range[0],r=(t-e)/(f.gauge.axis.range[1]-e)*Math.PI-S;return r<-S?-S:r>S?S:r}function C(t){return n.svg.arc().innerRadius((g+d)/2-t/2*(d-g)).outerRadius((g+d)/2+t/2*(d-g)).startAngle(-S)}function L(t){t.attr("d",(function(t){return C(t.thickness).startAngle(E(t.range[0])).endAngle(E(t.range[1]))()}))}T.enter().append("g").classed("angular",!0),T.attr("transform",_(w[0],w[1])),k.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),k.selectAll("g.xangularaxistick,path,text").remove(),(s=b(t,f.gauge.axis)).type="linear",s.range=f.gauge.axis.range,s._id="xangularaxis",s.setScale();var P=function(t){return(s.range[0]-t.x)/(s.range[1]-s.range[0])*Math.PI+Math.PI},I={},z=u.makeLabelFns(s,0).labelStandoff;I.xFn=function(t){var e=P(t);return Math.cos(e)*z},I.yFn=function(t){var e=P(t),r=Math.sin(e)>0?.2:1;return-Math.sin(e)*(z+t.fontSize*r)+Math.abs(Math.cos(e))*(t.fontSize*o)},I.anchorFn=function(t){var e=P(t),r=Math.cos(e);return Math.abs(r)<.1?"middle":r>0?"start":"end"},I.heightFn=function(t,e,r){var n=P(t);return-.5*(1+Math.sin(n))*r};var O=function(t){return _(w[0]+d*Math.cos(t),w[1]-d*Math.sin(t))};c=function(t){return O(P(t))};if(l=u.calcTicks(s),h=u.getTickSigns(s)[2],s.visible){h="inside"===s.ticks?-1:1;var D=(s.linewidth||1)/2;u.drawTicks(t,s,{vals:l,layer:k,path:"M"+h*D+",0h"+h*s.ticklen,transFn:function(t){var e=P(t);return O(e)+"rotate("+-i(e)+")"}}),u.drawLabels(t,s,{vals:l,layer:k,transFn:c,labelFns:I})}var R=[m].concat(f.gauge.steps),F=T.selectAll("g.bg-arc").data(R);F.enter().append("g").classed("bg-arc",!0).append("path"),F.select("path").call(L).call(x),F.exit().remove();var B=C(f.gauge.bar.thickness),N=T.selectAll("g.value-arc").data([f.gauge.bar]);N.enter().append("g").classed("value-arc",!0).append("path");var j=N.select("path");y(M)?(j.transition().duration(M.duration).ease(M.easing).each("end",(function(){A&&A()})).each("interrupt",(function(){A&&A()})).attrTween("d",(U=B,V=E(r[0].lastY),q=E(r[0].y),function(){var t=n.interpolate(V,q);return function(e){return U.endAngle(t(e))()}})),f._lastValue=r[0].y):j.attr("d","number"==typeof r[0].y?B.endAngle(E(r[0].y)):"M0,0Z");var U,V,q;j.call(x),N.exit().remove(),R=[];var H=f.gauge.threshold.value;H&&R.push({range:[H,H],color:f.gauge.threshold.color,line:{color:f.gauge.threshold.line.color,width:f.gauge.threshold.line.width},thickness:f.gauge.threshold.thickness});var G=T.selectAll("g.threshold-arc").data(R);G.enter().append("g").classed("threshold-arc",!0).append("path"),G.select("path").call(L).call(x),G.exit().remove();var Y=T.selectAll("g.gauge-outline").data([v]);Y.enter().append("g").classed("gauge-outline",!0).append("path"),Y.select("path").call(L).call(x),Y.exit().remove()}(t,0,e,{radius:B,innerRadius:N,gauge:q,layer:H,size:D,gaugeBg:S,gaugeOutline:E,transitionOpts:r,onComplete:f});var G=L.selectAll("g.bullet").data(z?e:[]);G.exit().remove();var Y=L.selectAll("g.bulletaxis").data(z?e:[]);Y.exit().remove(),z&&function(t,e,r,n){var a,i,o,s,c,h=r[0].trace,f=n.gauge,p=n.layer,g=n.gaugeBg,m=n.gaugeOutline,v=n.size,_=h.domain,w=n.transitionOpts,T=n.onComplete;f.enter().append("g").classed("bullet",!0),f.attr("transform","translate("+v.l+", "+v.t+")"),p.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),p.selectAll("g.xbulletaxistick,path,text").remove();var k=v.h,M=h.gauge.bar.thickness*k,A=_.x[0],S=_.x[0]+(_.x[1]-_.x[0])*(h._hasNumber||h._hasDelta?1-l.bulletNumberDomainSize:1);(a=b(t,h.gauge.axis))._id="xbulletaxis",a.domain=[A,S],a.setScale(),i=u.calcTicks(a),o=u.makeTransFn(a),s=u.getTickSigns(a)[2],c=v.t+v.h,a.visible&&(u.drawTicks(t,a,{vals:"inside"===a.ticks?u.clipEnds(a,i):i,layer:p,path:u.makeTickPath(a,c,s),transFn:o}),u.drawLabels(t,a,{vals:i,layer:p,transFn:o,labelFns:u.makeLabelFns(a,c)}));function E(t){t.attr("width",(function(t){return Math.max(0,a.c2p(t.range[1])-a.c2p(t.range[0]))})).attr("x",(function(t){return a.c2p(t.range[0])})).attr("y",(function(t){return.5*(1-t.thickness)*k})).attr("height",(function(t){return t.thickness*k}))}var C=[g].concat(h.gauge.steps),L=f.selectAll("g.bg-bullet").data(C);L.enter().append("g").classed("bg-bullet",!0).append("rect"),L.select("rect").call(E).call(x),L.exit().remove();var P=f.selectAll("g.value-bullet").data([h.gauge.bar]);P.enter().append("g").classed("value-bullet",!0).append("rect"),P.select("rect").attr("height",M).attr("y",(k-M)/2).call(x),y(w)?P.select("rect").transition().duration(w.duration).ease(w.easing).each("end",(function(){T&&T()})).each("interrupt",(function(){T&&T()})).attr("width",Math.max(0,a.c2p(Math.min(h.gauge.axis.range[1],r[0].y)))):P.select("rect").attr("width","number"==typeof r[0].y?Math.max(0,a.c2p(Math.min(h.gauge.axis.range[1],r[0].y))):0);P.exit().remove();var I=r.filter((function(){return h.gauge.threshold.value})),z=f.selectAll("g.threshold-bullet").data(I);z.enter().append("g").classed("threshold-bullet",!0).append("line"),z.select("line").attr("x1",a.c2p(h.gauge.threshold.value)).attr("x2",a.c2p(h.gauge.threshold.value)).attr("y1",(1-h.gauge.threshold.thickness)/2*k).attr("y2",(1-(1-h.gauge.threshold.thickness)/2)*k).call(d.stroke,h.gauge.threshold.line.color).style("stroke-width",h.gauge.threshold.line.width),z.exit().remove();var O=f.selectAll("g.gauge-outline").data([m]);O.enter().append("g").classed("gauge-outline",!0).append("rect"),O.select("rect").call(E).call(x),O.exit().remove()}(t,0,e,{gauge:G,layer:Y,size:D,gaugeBg:S,gaugeOutline:E,transitionOpts:r,onComplete:f});var W=L.selectAll("text.title").data(e);W.exit().remove(),W.enter().append("text").classed("title",!0),W.attr("text-anchor",(function(){return z?g.right:g[C.title.align]})).text(C.title.text).call(s.font,C.title.font).call(c.convertToTspans,t),W.attr("transform",(function(){var t,e=D.l+D.w*m[C.title.align],r=l.titlePadding,n=s.bBox(W.node());if(P){if(I)if(C.gauge.axis.visible)t=s.bBox(H.node()).top-r-n.bottom;else t=D.t+D.h/2-B/2-n.bottom-r;z&&(t=M-(n.top+n.bottom)/2,e=D.l-l.bulletPadding*D.w)}else t=C._numbersTop-r-n.bottom;return _(e,t)}))}))}},{"../../components/color":615,"../../components/drawing":637,"../../constants/alignment":717,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"../../plots/cartesian/axis_defaults":799,"../../plots/cartesian/layout_attributes":811,"../../plots/cartesian/position_defaults":814,"./constants":1087,d3:169}],1091:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),a=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll;var c=e.exports=l(s({x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},value:{valType:"data_array"},isomin:{valType:"number"},isomax:{valType:"number"},surface:{show:{valType:"boolean",dflt:!0},count:{valType:"integer",dflt:2,min:1},fill:{valType:"number",min:0,max:1,dflt:1},pattern:{valType:"flaglist",flags:["A","B","C","D","E"],extras:["all","odd","even"],dflt:"all"}},spaceframe:{show:{valType:"boolean",dflt:!1},fill:{valType:"number",min:0,max:1,dflt:.15}},slices:{x:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}}},caps:{x:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}}},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:a(),showlegend:s({},o.showlegend,{dflt:!1})},n("",{colorAttr:"`value`",showScaleDflt:!0,editTypeOverride:"calc"}),{opacity:i.opacity,lightposition:i.lightposition,lighting:i.lighting,flatshading:i.flatshading,contour:i.contour,hoverinfo:s({},o.hoverinfo)}),"calc","nested");c.flatshading.dflt=!0,c.lighting.facenormalsepsilon.dflt=0,c.x.editType=c.y.editType=c.z.editType=c.value.editType="calc+clearAxisTypes",c.transforms=void 0},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875,"../mesh3d/attributes":1096}],1092:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc"),a=t("../streamtube/calc").processGrid,i=t("../streamtube/calc").filter;e.exports=function(t,e){e._len=Math.min(e.x.length,e.y.length,e.z.length,e.value.length),e._x=i(e.x,e._len),e._y=i(e.y,e._len),e._z=i(e.z,e._len),e._value=i(e.value,e._len);var r=a(e);e._gridFill=r.fill,e._Xs=r.Xs,e._Ys=r.Ys,e._Zs=r.Zs,e._len=r.len;for(var o=1/0,s=-1/0,l=0;l0;r--){var n=Math.min(e[r],e[r-1]),a=Math.max(e[r],e[r-1]);if(a>n&&n-1}function R(t,e){return null===t?e:t}function F(e,r,n){L();var a,i,o,l=[r],c=[n];if(s>=1)l=[r],c=[n];else if(s>0){var u=function(t,e){var r=t[0],n=t[1],a=t[2],i=function(t,e,r){for(var n=[],a=0;a-1?n[p]:C(d,g,v);f[p]=x>-1?x:I(d,g,v,R(e,y))}a=f[0],i=f[1],o=f[2],t._meshI.push(a),t._meshJ.push(i),t._meshK.push(o),++m}}function B(t,e,r,n){var a=t[3];an&&(a=n);for(var i=(t[3]-a)/(t[3]-e[3]+1e-9),o=[],s=0;s<4;s++)o[s]=(1-i)*t[s]+i*e[s];return o}function N(t,e,r){return t>=e&&t<=r}function j(t){var e=.001*(E-S);return t>=S-e&&t<=E+e}function U(e){for(var r=[],n=0;n<4;n++){var a=e[n];r.push([t._x[a],t._y[a],t._z[a],t._value[a]])}return r}function V(t,e,r,n,a,i){i||(i=1),r=[-1,-1,-1];var o=!1,s=[N(e[0][3],n,a),N(e[1][3],n,a),N(e[2][3],n,a)];if(!s[0]&&!s[1]&&!s[2])return!1;var l=function(t,e,r){return j(e[0][3])&&j(e[1][3])&&j(e[2][3])?(F(t,e,r),!0):i<3&&V(t,e,r,S,E,++i)};if(s[0]&&s[1]&&s[2])return l(t,e,r)||o;var c=!1;return[[0,1,2],[2,0,1],[1,2,0]].forEach((function(i){if(s[i[0]]&&s[i[1]]&&!s[i[2]]){var u=e[i[0]],h=e[i[1]],f=e[i[2]],p=B(f,u,n,a),d=B(f,h,n,a);o=l(t,[d,p,u],[-1,-1,r[i[0]]])||o,o=l(t,[u,h,d],[r[i[0]],r[i[1]],-1])||o,c=!0}})),c||[[0,1,2],[1,2,0],[2,0,1]].forEach((function(i){if(s[i[0]]&&!s[i[1]]&&!s[i[2]]){var u=e[i[0]],h=e[i[1]],f=e[i[2]],p=B(h,u,n,a),d=B(f,u,n,a);o=l(t,[d,p,u],[-1,-1,r[i[0]]])||o,c=!0}})),o}function q(t,e,r,n){var a=!1,i=U(e),o=[N(i[0][3],r,n),N(i[1][3],r,n),N(i[2][3],r,n),N(i[3][3],r,n)];if(!(o[0]||o[1]||o[2]||o[3]))return a;if(o[0]&&o[1]&&o[2]&&o[3])return g&&(a=function(t,e,r){var n=function(n,a,i){F(t,[e[n],e[a],e[i]],[r[n],r[a],r[i]])};n(0,1,2),n(3,0,1),n(2,3,0),n(1,2,3)}(t,i,e)||a),a;var s=!1;return[[0,1,2,3],[3,0,1,2],[2,3,0,1],[1,2,3,0]].forEach((function(l){if(o[l[0]]&&o[l[1]]&&o[l[2]]&&!o[l[3]]){var c=i[l[0]],u=i[l[1]],h=i[l[2]],f=i[l[3]];if(g)a=F(t,[c,u,h],[e[l[0]],e[l[1]],e[l[2]]])||a;else{var p=B(f,c,r,n),d=B(f,u,r,n),m=B(f,h,r,n);a=F(null,[p,d,m],[-1,-1,-1])||a}s=!0}})),s?a:([[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2],[0,2,3,1],[1,3,2,0]].forEach((function(l){if(o[l[0]]&&o[l[1]]&&!o[l[2]]&&!o[l[3]]){var c=i[l[0]],u=i[l[1]],h=i[l[2]],f=i[l[3]],p=B(h,c,r,n),d=B(h,u,r,n),m=B(f,u,r,n),v=B(f,c,r,n);g?(a=F(t,[c,v,p],[e[l[0]],-1,-1])||a,a=F(t,[u,d,m],[e[l[1]],-1,-1])||a):a=function(t,e,r){var n=function(n,a,i){F(t,[e[n],e[a],e[i]],[r[n],r[a],r[i]])};n(0,1,2),n(2,3,0)}(null,[p,d,m,v],[-1,-1,-1,-1])||a,s=!0}})),s||[[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2]].forEach((function(l){if(o[l[0]]&&!o[l[1]]&&!o[l[2]]&&!o[l[3]]){var c=i[l[0]],u=i[l[1]],h=i[l[2]],f=i[l[3]],p=B(u,c,r,n),d=B(h,c,r,n),m=B(f,c,r,n);g?(a=F(t,[c,p,d],[e[l[0]],-1,-1])||a,a=F(t,[c,d,m],[e[l[0]],-1,-1])||a,a=F(t,[c,m,p],[e[l[0]],-1,-1])||a):a=F(null,[p,d,m],[-1,-1,-1])||a,s=!0}})),a)}function H(t,e,r,n,a,i,o,s,l,c,u){var h=!1;return d&&(D(t,"A")&&(h=q(null,[e,r,n,i],c,u)||h),D(t,"B")&&(h=q(null,[r,n,a,l],c,u)||h),D(t,"C")&&(h=q(null,[r,i,o,l],c,u)||h),D(t,"D")&&(h=q(null,[n,i,s,l],c,u)||h),D(t,"E")&&(h=q(null,[r,n,i,l],c,u)||h)),g&&(h=q(t,[r,n,i,l],c,u)||h),h}function G(t,e,r,n,a,i,o,s){return[!0===s[0]||V(t,U([e,r,n]),[e,r,n],i,o),!0===s[1]||V(t,U([n,a,e]),[n,a,e],i,o)]}function Y(t,e,r,n,a,i,o,s,l){return s?G(t,e,r,a,n,i,o,l):G(t,r,a,n,e,i,o,l)}function W(t,e,r,n,a,i,o){var s,l,c,u,h=!1,f=function(){h=V(t,[s,l,c],[-1,-1,-1],a,i)||h,h=V(t,[c,u,s],[-1,-1,-1],a,i)||h},p=o[0],d=o[1],g=o[2];return p&&(s=z(U([k(e,r-0,n-0)])[0],U([k(e-1,r-0,n-0)])[0],p),l=z(U([k(e,r-0,n-1)])[0],U([k(e-1,r-0,n-1)])[0],p),c=z(U([k(e,r-1,n-1)])[0],U([k(e-1,r-1,n-1)])[0],p),u=z(U([k(e,r-1,n-0)])[0],U([k(e-1,r-1,n-0)])[0],p),f()),d&&(s=z(U([k(e-0,r,n-0)])[0],U([k(e-0,r-1,n-0)])[0],d),l=z(U([k(e-0,r,n-1)])[0],U([k(e-0,r-1,n-1)])[0],d),c=z(U([k(e-1,r,n-1)])[0],U([k(e-1,r-1,n-1)])[0],d),u=z(U([k(e-1,r,n-0)])[0],U([k(e-1,r-1,n-0)])[0],d),f()),g&&(s=z(U([k(e-0,r-0,n)])[0],U([k(e-0,r-0,n-1)])[0],g),l=z(U([k(e-0,r-1,n)])[0],U([k(e-0,r-1,n-1)])[0],g),c=z(U([k(e-1,r-1,n)])[0],U([k(e-1,r-1,n-1)])[0],g),u=z(U([k(e-1,r-0,n)])[0],U([k(e-1,r-0,n-1)])[0],g),f()),h}function Z(t,e,r,n,a,i,o,s,l,c,u,h){var f=t;return h?(d&&"even"===t&&(f=null),H(f,e,r,n,a,i,o,s,l,c,u)):(d&&"odd"===t&&(f=null),H(f,l,s,o,i,a,n,r,e,c,u))}function X(t,e,r,n,a){for(var i=[],o=0,s=0;sMath.abs(d-A)?[M,d]:[d,A];$(e,T[0],T[1])}}var C=[[Math.min(S,A),Math.max(S,A)],[Math.min(M,E),Math.max(M,E)]];["x","y","z"].forEach((function(e){for(var r=[],n=0;n0&&(u.push(p.id),"x"===e?h.push([p.distRatio,0,0]):"y"===e?h.push([0,p.distRatio,0]):h.push([0,0,p.distRatio]))}else c=nt(1,"x"===e?b-1:"y"===e?_-1:w-1);u.length>0&&(r[a]="x"===e?tt(null,u,i,o,h,r[a]):"y"===e?et(null,u,i,o,h,r[a]):rt(null,u,i,o,h,r[a]),a++),c.length>0&&(r[a]="x"===e?X(null,c,i,o,r[a]):"y"===e?J(null,c,i,o,r[a]):K(null,c,i,o,r[a]),a++)}var d=t.caps[e];d.show&&d.fill&&(O(d.fill),r[a]="x"===e?X(null,[0,b-1],i,o,r[a]):"y"===e?J(null,[0,_-1],i,o,r[a]):K(null,[0,w-1],i,o,r[a]),a++)}})),0===m&&P(),t._meshX=n,t._meshY=a,t._meshZ=i,t._meshIntensity=o,t._Xs=v,t._Ys=y,t._Zs=x}(),t}e.exports={findNearestOnAxis:l,generateIsoMeshes:f,createIsosurfaceTrace:function(t,e){var r=t.glplot.gl,a=n({gl:r}),i=new c(t,a,e.uid);return a._trace=i,i.update(e),t.glplot.add(a),i}}},{"../../components/colorscale":627,"../../lib/gl_format_color":745,"../../lib/str2rgbarray":772,"../../plots/gl3d/zip3":850,"gl-mesh3d":292}],1094:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("./attributes"),o=t("../../components/colorscale/defaults");function s(t,e,r,n,i){var s=i("isomin"),l=i("isomax");null!=l&&null!=s&&s>l&&(e.isomin=null,e.isomax=null);var c=i("x"),u=i("y"),h=i("z"),f=i("value");c&&c.length&&u&&u.length&&h&&h.length&&f&&f.length?(a.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],n),["x","y","z"].forEach((function(t){var e="caps."+t;i(e+".show")&&i(e+".fill");var r="slices."+t;i(r+".show")&&(i(r+".fill"),i(r+".locations"))})),i("spaceframe.show")&&i("spaceframe.fill"),i("surface.show")&&(i("surface.count"),i("surface.fill"),i("surface.pattern")),i("contour.show")&&(i("contour.color"),i("contour.width")),["text","hovertext","hovertemplate","lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","flatshading","opacity"].forEach((function(t){i(t)})),o(t,e,n,i,{prefix:"",cLetter:"c"}),e._length=null):e.visible=!1}e.exports={supplyDefaults:function(t,e,r,a){s(t,e,r,a,(function(r,a){return n.coerce(t,e,i,r,a)}))},supplyIsoDefaults:s}},{"../../components/colorscale/defaults":625,"../../lib":749,"../../registry":880,"./attributes":1091}],1095:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,calc:t("./calc"),colorbar:{min:"cmin",max:"cmax"},plot:t("./convert").createIsosurfaceTrace,moduleType:"trace",name:"isosurface",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","showLegend"],meta:{}}},{"../../plots/gl3d":839,"./attributes":1091,"./calc":1092,"./convert":1093,"./defaults":1094}],1096:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),a=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../surface/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s({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"},intensitymode:{valType:"enumerated",values:["vertex","cell"],dflt:"vertex",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"}),{opacity:i.opacity,flatshading:{valType:"boolean",dflt:!1,editType:"calc"},contour:{show:s({},i.contours.x.show,{}),color:i.contours.x.color,width:i.contours.x.width,editType:"calc"},lightposition:{x:s({},i.lightposition.x,{dflt:1e5}),y:s({},i.lightposition.y,{dflt:1e5}),z:s({},i.lightposition.z,{dflt:0}),editType:"calc"},lighting:s({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"},i.lighting),hoverinfo:s({},o.hoverinfo,{editType:"calc"}),showlegend:s({},o.showlegend,{dflt:!1})})},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../surface/attributes":1278}],1097:[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":623}],1098:[function(t,e,r){"use strict";var n=t("gl-mesh3d"),a=t("delaunay-triangulate"),i=t("alpha-shape"),o=t("convex-hull"),s=t("../../lib/gl_format_color").parseColorScale,l=t("../../lib/str2rgbarray"),c=t("../../components/colorscale").extractOpts,u=t("../../plots/gl3d/zip3");function h(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=h.prototype;function p(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.data._cellCenter?t.traceCoordinate=t.data.dataCoordinate: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,h=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||!m(t.i,h)||!m(t.j,h)||!m(t.k,h))return;n=u(g(t.i),g(t.j),g(t.k))}else n=0===t.alphahull?o(f):t.alphahull>0?i(t.alphahull,f):function(t,e){for(var r=["x","y","z"].indexOf(t),n=[],i=e.length,o=0;om):g=T>b,m=T;var k=l(b,_,w,T);k.pos=x,k.yc=(b+T)/2,k.i=y,k.dir=g?"increasing":"decreasing",k.x=k.pos,k.y=[w,_],p&&(k.tx=e.text[y]),d&&(k.htx=e.hovertext[y]),v.push(k)}else v.push({pos:x,empty:!0})}return e._extremes[s._id]=i.findExtremes(s,n.concat(h,u),{padded:!0}),v.length&&(v[0].t={labels:{open:a(t,"open:")+" ",high:a(t,"high:")+" ",low:a(t,"low:")+" ",close:a(t,"close:")+" "}}),v}e.exports={calc:function(t,e){var r=i.getFromId(t,e.xaxis),a=i.getFromId(t,e.yaxis),o=function(t,e,r){var a=r._minDiff;if(!a){var i,o=t._fullData,s=[];for(a=1/0,i=0;i"+c.labels[x]+n.hoverLabelText(s,b):((y=a.extendFlat({},f)).y0=y.y1=_,y.yLabelVal=b,y.yLabel=c.labels[x]+n.hoverLabelText(s,b),y.name="",h.push(y),m[b]=y)}return h}function f(t,e,r,a){var i=t.cd,o=t.ya,l=i[0].trace,h=i[0].t,f=u(t,e,r,a);if(!f)return[];var p=i[f.index],d=f.index=p.i,g=p.dir;function m(t){return h.labels[t]+n.hoverLabelText(o,l[t][d])}var v=p.hi||l.hoverinfo,y=v.split("+"),x="all"===v,b=x||-1!==y.indexOf("y"),_=x||-1!==y.indexOf("text"),w=b?[m("open"),m("high"),m("low"),m("close")+" "+c[g]]:[];return _&&s(p,l,w),f.extraText=w.join("
"),f.y0=f.y1=o.c2p(p.yc,!0),[f]}e.exports={hoverPoints:function(t,e,r,n){return t.cd[0].trace.hoverlabel.split?h(t,e,r,n):f(t,e,r,n)},hoverSplit:h,hoverOnPoints:f}},{"../../components/color":615,"../../components/fx":655,"../../constants/delta.js":718,"../../lib":749,"../../plots/cartesian/axes":797}],1105:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc").calc,plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover").hoverPoints,selectPoints:t("./select")}},{"../../plots/cartesian":810,"./attributes":1101,"./calc":1102,"./defaults":1103,"./hover":1104,"./plot":1107,"./select":1108,"./style":1109}],1106:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib");e.exports=function(t,e,r,i){var o=r("x"),s=r("open"),l=r("high"),c=r("low"),u=r("close");if(r("hoverlabel.split"),n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x"],i),s&&l&&c&&u){var h=Math.min(s.length,l.length,c.length,u.length);return o&&(h=Math.min(h,a.minRowLength(o))),e._length=h,h}}},{"../../lib":749,"../../registry":880}],1107:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib");e.exports=function(t,e,r,i){var o=e.yaxis,s=e.xaxis,l=!!s.rangebreaks;a.makeTraceGroups(i,r,"trace ohlc").each((function(t){var e=n.select(this),r=t[0],i=r.t;if(!0!==r.trace.visible||i.empty)e.remove();else{var c=i.tickLen,u=e.selectAll("path").data(a.identity);u.enter().append("path"),u.exit().remove(),u.attr("d",(function(t){if(t.empty)return"M0,0Z";var e=s.c2p(t.pos-c,!0),r=s.c2p(t.pos+c,!0),n=l?(e+r)/2:s.c2p(t.pos,!0);return"M"+e+","+o.c2p(t.o,!0)+"H"+n+"M"+n+","+o.c2p(t.h,!0)+"V"+o.c2p(t.l,!0)+"M"+r+","+o.c2p(t.c,!0)+"H"+n}))}}))}},{"../../lib":749,d3:169}],1108:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n=t.cd,a=t.xaxis,i=t.yaxis,o=[],s=n[0].t.bPos||0;if(!1===e)for(r=0;r=t.length)return!1;if(void 0!==e[t[r]])return!1;e[t[r]]=!0}return!0}(t.map((function(t){return t.displayindex}))))for(e=0;e0;c&&(o="array");var u=r("categoryorder",o);"array"===u?(r("categoryarray"),r("ticktext")):(delete t.categoryarray,delete t.ticktext),c||"array"!==u||(e.categoryorder="trace")}}e.exports=function(t,e,r,h){function f(r,a){return n.coerce(t,e,l,r,a)}var p=s(t,e,{name:"dimensions",handleItemDefaults:u}),d=function(t,e,r,o,s){s("line.shape"),s("line.hovertemplate");var l=s("line.color",o.colorway[0]);if(a(t,"line")&&n.isArrayOrTypedArray(l)){if(l.length)return s("line.colorscale"),i(t,e,o,s,{prefix:"line.",cLetter:"c"}),l.length;e.line.color=r}return 1/0}(t,e,r,h,f);o(e,h,f),Array.isArray(p)&&p.length||(e.visible=!1),c(e,p,"values",d),f("hoveron"),f("hovertemplate"),f("arrangement"),f("bundlecolors"),f("sortpaths"),f("counts");var g={family:h.font.family,size:Math.round(h.font.size),color:h.font.color};n.coerceFont(f,"labelfont",g);var m={family:h.font.family,size:Math.round(h.font.size/1.2),color:h.font.color};n.coerceFont(f,"tickfont",m)}},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/domain":824,"../parcoords/merge_length":1126,"./attributes":1110}],1114:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcats",basePlotModule:t("./base_plot"),categories:["noOpacity"],meta:{}}},{"./attributes":1110,"./base_plot":1111,"./calc":1112,"./defaults":1113,"./plot":1116}],1115:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plot_api/plot_api"),i=t("../../components/fx"),o=t("../../lib"),s=t("../../components/drawing"),l=t("tinycolor2"),c=t("../../lib/svg_text_utils");function u(t,e,r,a){var i=t.map(D.bind(0,e,r)),l=a.selectAll("g.parcatslayer").data([null]);l.enter().append("g").attr("class","parcatslayer").style("pointer-events","all");var u=l.selectAll("g.trace.parcats").data(i,h),m=u.enter().append("g").attr("class","trace parcats");u.attr("transform",(function(t){return"translate("+t.x+", "+t.y+")"})),m.append("g").attr("class","paths");var v=u.select("g.paths").selectAll("path.path").data((function(t){return t.paths}),h);v.attr("fill",(function(t){return t.model.color}));var b=v.enter().append("path").attr("class","path").attr("stroke-opacity",0).attr("fill",(function(t){return t.model.color})).attr("fill-opacity",0);x(b),v.attr("d",(function(t){return t.svgD})),b.empty()||v.sort(p),v.exit().remove(),v.on("mouseover",d).on("mouseout",g).on("click",y),m.append("g").attr("class","dimensions");var T=u.select("g.dimensions").selectAll("g.dimension").data((function(t){return t.dimensions}),h);T.enter().append("g").attr("class","dimension"),T.attr("transform",(function(t){return"translate("+t.x+", 0)"})),T.exit().remove();var k=T.selectAll("g.category").data((function(t){return t.categories}),h),M=k.enter().append("g").attr("class","category");k.attr("transform",(function(t){return"translate(0, "+t.y+")"})),M.append("rect").attr("class","catrect").attr("pointer-events","none"),k.select("rect.catrect").attr("fill","none").attr("width",(function(t){return t.width})).attr("height",(function(t){return t.height})),_(M);var A=k.selectAll("rect.bandrect").data((function(t){return t.bands}),h);A.each((function(){o.raiseToTop(this)})),A.attr("fill",(function(t){return t.color}));var I=A.enter().append("rect").attr("class","bandrect").attr("stroke-opacity",0).attr("fill",(function(t){return t.color})).attr("fill-opacity",0);A.attr("fill",(function(t){return t.color})).attr("width",(function(t){return t.width})).attr("height",(function(t){return t.height})).attr("y",(function(t){return t.y})).attr("cursor",(function(t){return"fixed"===t.parcatsViewModel.arrangement?"default":"perpendicular"===t.parcatsViewModel.arrangement?"ns-resize":"move"})),w(I),A.exit().remove(),M.append("text").attr("class","catlabel").attr("pointer-events","none");var z=e._fullLayout.paper_bgcolor;k.select("text.catlabel").attr("text-anchor",(function(t){return f(t)?"start":"end"})).attr("alignment-baseline","middle").style("text-shadow",z+" -1px 1px 2px, "+z+" 1px 1px 2px, "+z+" 1px -1px 2px, "+z+" -1px -1px 2px").style("fill","rgb(0, 0, 0)").attr("x",(function(t){return f(t)?t.width+5:-5})).attr("y",(function(t){return t.height/2})).text((function(t){return t.model.categoryLabel})).each((function(t){s.font(n.select(this),t.parcatsViewModel.categorylabelfont),c.convertToTspans(n.select(this),e)})),M.append("text").attr("class","dimlabel"),k.select("text.dimlabel").attr("text-anchor","middle").attr("alignment-baseline","baseline").attr("cursor",(function(t){return"fixed"===t.parcatsViewModel.arrangement?"default":"ew-resize"})).attr("x",(function(t){return t.width/2})).attr("y",-5).text((function(t,e){return 0===e?t.parcatsViewModel.model.dimensions[t.model.dimensionInd].dimensionLabel:null})).each((function(t){s.font(n.select(this),t.parcatsViewModel.labelfont)})),k.selectAll("rect.bandrect").on("mouseover",S).on("mouseout",E),k.exit().remove(),T.call(n.behavior.drag().origin((function(t){return{x:t.x,y:0}})).on("dragstart",C).on("drag",L).on("dragend",P)),u.each((function(t){t.traceSelection=n.select(this),t.pathSelection=n.select(this).selectAll("g.paths").selectAll("path.path"),t.dimensionSelection=n.select(this).selectAll("g.dimensions").selectAll("g.dimension")})),u.exit().remove()}function h(t){return t.key}function f(t){var e=t.parcatsViewModel.dimensions.length,r=t.parcatsViewModel.dimensions[e-1].model.dimensionInd;return t.model.dimensionInd===r}function p(t,e){return t.model.rawColor>e.model.rawColor?1:t.model.rawColor"),C=n.mouse(h)[0];i.loneHover({trace:f,x:_-d.left+g.left,y:w-d.top+g.top,text:E,color:t.model.color,borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontSize:10,fontColor:T,idealAlign:C<_?"right":"left",hovertemplate:(f.line||{}).hovertemplate,hovertemplateLabels:A,eventData:[{data:f._input,fullData:f,count:k,probability:M}]},{container:p._hoverlayer.node(),outerContainer:p._paper.node(),gd:h})}}}function g(t){if(!t.parcatsViewModel.dragDimension&&(x(n.select(this)),i.loneUnhover(t.parcatsViewModel.graphDiv._fullLayout._hoverlayer.node()),t.parcatsViewModel.pathSelection.sort(p),-1===t.parcatsViewModel.hoverinfoItems.indexOf("skip"))){var e=m(t),r=v(t);t.parcatsViewModel.graphDiv.emit("plotly_unhover",{points:e,event:n.event,constraints:r})}}function m(t){for(var e=[],r=I(t.parcatsViewModel),n=0;n1&&c.displayInd===l.dimensions.length-1?(r=o.left,a="left"):(r=o.left+o.width,a="right");var f=s.model.count,p=s.model.categoryLabel,d=f/s.parcatsViewModel.model.count,g={countLabel:f,categoryLabel:p,probabilityLabel:d.toFixed(3)},m=[];-1!==s.parcatsViewModel.hoverinfoItems.indexOf("count")&&m.push(["Count:",g.countLabel].join(" ")),-1!==s.parcatsViewModel.hoverinfoItems.indexOf("probability")&&m.push(["P("+g.categoryLabel+"):",g.probabilityLabel].join(" "));var v=m.join("
");return{trace:u,x:r-t.left,y:h-t.top,text:v,color:"lightgray",borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontSize:12,fontColor:"black",idealAlign:a,hovertemplate:u.hovertemplate,hovertemplateLabels:g,eventData:[{data:u._input,fullData:u,count:f,category:p,probability:d}]}}function S(t){if(!t.parcatsViewModel.dragDimension&&-1===t.parcatsViewModel.hoverinfoItems.indexOf("skip")){if(n.mouse(this)[1]<-1)return;var e,r=t.parcatsViewModel.graphDiv,a=r._fullLayout,s=a._paperdiv.node().getBoundingClientRect(),c=t.parcatsViewModel.hoveron;if("color"===c?(!function(t){var e=n.select(t).datum(),r=T(e);b(r),r.each((function(){o.raiseToTop(this)})),n.select(t.parentNode).selectAll("rect.bandrect").filter((function(t){return t.color===e.color})).each((function(){o.raiseToTop(this),n.select(this).attr("stroke","black").attr("stroke-width",1.5)}))}(this),M(this,"plotly_hover",n.event)):(!function(t){n.select(t.parentNode).selectAll("rect.bandrect").each((function(t){var e=T(t);b(e),e.each((function(){o.raiseToTop(this)}))})),n.select(t.parentNode).select("rect.catrect").attr("stroke","black").attr("stroke-width",2.5)}(this),k(this,"plotly_hover",n.event)),-1===t.parcatsViewModel.hoverinfoItems.indexOf("none"))"category"===c?e=A(s,this):"color"===c?e=function(t,e){var r,a,i=e.getBoundingClientRect(),o=n.select(e).datum(),s=o.categoryViewModel,c=s.parcatsViewModel,u=c.model.dimensions[s.model.dimensionInd],h=c.trace,f=i.y+i.height/2;c.dimensions.length>1&&u.displayInd===c.dimensions.length-1?(r=i.left,a="left"):(r=i.left+i.width,a="right");var p=s.model.categoryLabel,d=o.parcatsViewModel.model.count,g=0;o.categoryViewModel.bands.forEach((function(t){t.color===o.color&&(g+=t.count)}));var m=s.model.count,v=0;c.pathSelection.each((function(t){t.model.color===o.color&&(v+=t.model.count)}));var y=g/d,x=g/v,b=g/m,_={countLabel:d,categoryLabel:p,probabilityLabel:y.toFixed(3)},w=[];-1!==s.parcatsViewModel.hoverinfoItems.indexOf("count")&&w.push(["Count:",_.countLabel].join(" ")),-1!==s.parcatsViewModel.hoverinfoItems.indexOf("probability")&&(w.push("P(color \u2229 "+p+"): "+_.probabilityLabel),w.push("P("+p+" | color): "+x.toFixed(3)),w.push("P(color | "+p+"): "+b.toFixed(3)));var T=w.join("
"),k=l.mostReadable(o.color,["black","white"]);return{trace:h,x:r-t.left,y:f-t.top,text:T,color:o.color,borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontColor:k,fontSize:10,idealAlign:a,hovertemplate:h.hovertemplate,hovertemplateLabels:_,eventData:[{data:h._input,fullData:h,category:p,count:d,probability:y,categorycount:m,colorcount:v,bandcolorcount:g}]}}(s,this):"dimension"===c&&(e=function(t,e){var r=[];return n.select(e.parentNode.parentNode).selectAll("g.category").select("rect.catrect").each((function(){r.push(A(t,this))})),r}(s,this)),e&&i.loneHover(e,{container:a._hoverlayer.node(),outerContainer:a._paper.node(),gd:r})}}function E(t){var e=t.parcatsViewModel;if(!e.dragDimension&&(x(e.pathSelection),_(e.dimensionSelection.selectAll("g.category")),w(e.dimensionSelection.selectAll("g.category").selectAll("rect.bandrect")),i.loneUnhover(e.graphDiv._fullLayout._hoverlayer.node()),e.pathSelection.sort(p),-1===e.hoverinfoItems.indexOf("skip"))){"color"===t.parcatsViewModel.hoveron?M(this,"plotly_unhover",n.event):k(this,"plotly_unhover",n.event)}}function C(t){"fixed"!==t.parcatsViewModel.arrangement&&(t.dragDimensionDisplayInd=t.model.displayInd,t.initialDragDimensionDisplayInds=t.parcatsViewModel.model.dimensions.map((function(t){return t.displayInd})),t.dragHasMoved=!1,t.dragCategoryDisplayInd=null,n.select(this).selectAll("g.category").select("rect.catrect").each((function(e){var r=n.mouse(this)[0],a=n.mouse(this)[1];-2<=r&&r<=e.width+2&&-2<=a&&a<=e.height+2&&(t.dragCategoryDisplayInd=e.model.displayInd,t.initialDragCategoryDisplayInds=t.model.categories.map((function(t){return t.displayInd})),e.model.dragY=e.y,o.raiseToTop(this.parentNode),n.select(this.parentNode).selectAll("rect.bandrect").each((function(e){e.yh.y+h.height/2&&(o.model.displayInd=h.model.displayInd,h.model.displayInd=l),t.dragCategoryDisplayInd=o.model.displayInd}if(null===t.dragCategoryDisplayInd||"freeform"===t.parcatsViewModel.arrangement){i.model.dragX=n.event.x;var f=t.parcatsViewModel.dimensions[r],p=t.parcatsViewModel.dimensions[a];void 0!==f&&i.model.dragXp.x&&(i.model.displayInd=p.model.displayInd,p.model.displayInd=t.dragDimensionDisplayInd),t.dragDimensionDisplayInd=i.model.displayInd}B(t.parcatsViewModel),F(t.parcatsViewModel),O(t.parcatsViewModel),z(t.parcatsViewModel)}}function P(t){if("fixed"!==t.parcatsViewModel.arrangement&&null!==t.dragDimensionDisplayInd){n.select(this).selectAll("text").attr("font-weight","normal");var e={},r=I(t.parcatsViewModel),i=t.parcatsViewModel.model.dimensions.map((function(t){return t.displayInd})),o=t.initialDragDimensionDisplayInds.some((function(t,e){return t!==i[e]}));o&&i.forEach((function(r,n){var a=t.parcatsViewModel.model.dimensions[n].containerInd;e["dimensions["+a+"].displayindex"]=r}));var s=!1;if(null!==t.dragCategoryDisplayInd){var l=t.model.categories.map((function(t){return t.displayInd}));if(s=t.initialDragCategoryDisplayInds.some((function(t,e){return t!==l[e]}))){var c=t.model.categories.slice().sort((function(t,e){return t.displayInd-e.displayInd})),u=c.map((function(t){return t.categoryValue})),h=c.map((function(t){return t.categoryLabel}));e["dimensions["+t.model.containerInd+"].categoryarray"]=[u],e["dimensions["+t.model.containerInd+"].ticktext"]=[h],e["dimensions["+t.model.containerInd+"].categoryorder"]="array"}}if(-1===t.parcatsViewModel.hoverinfoItems.indexOf("skip")&&!t.dragHasMoved&&t.potentialClickBand&&("color"===t.parcatsViewModel.hoveron?M(t.potentialClickBand,"plotly_click",n.event.sourceEvent):k(t.potentialClickBand,"plotly_click",n.event.sourceEvent)),t.model.dragX=null,null!==t.dragCategoryDisplayInd)t.parcatsViewModel.dimensions[t.dragDimensionDisplayInd].categories[t.dragCategoryDisplayInd].model.dragY=null,t.dragCategoryDisplayInd=null;t.dragDimensionDisplayInd=null,t.parcatsViewModel.dragDimension=null,t.dragHasMoved=null,t.potentialClickBand=null,B(t.parcatsViewModel),F(t.parcatsViewModel),n.transition().duration(300).ease("cubic-in-out").each((function(){O(t.parcatsViewModel,!0),z(t.parcatsViewModel,!0)})).each("end",(function(){(o||s)&&a.restyle(t.parcatsViewModel.graphDiv,e,[r])}))}}function I(t){for(var e,r=t.graphDiv._fullData,n=0;n=0;s--)u+="C"+c[s]+","+(e[s+1]+a)+" "+l[s]+","+(e[s]+a)+" "+(t[s]+r[s])+","+(e[s]+a),u+="l-"+r[s]+",0 ";return u+="Z"}function F(t){var e=t.dimensions,r=t.model,n=e.map((function(t){return t.categories.map((function(t){return t.y}))})),a=t.model.dimensions.map((function(t){return t.categories.map((function(t){return t.displayInd}))})),i=t.model.dimensions.map((function(t){return t.displayInd})),o=t.dimensions.map((function(t){return t.model.dimensionInd})),s=e.map((function(t){return t.x})),l=e.map((function(t){return t.width})),c=[];for(var u in r.paths)r.paths.hasOwnProperty(u)&&c.push(r.paths[u]);function h(t){var e=t.categoryInds.map((function(t,e){return a[e][t]}));return o.map((function(t){return e[t]}))}c.sort((function(e,r){var n=h(e),a=h(r);return"backward"===t.sortpaths&&(n.reverse(),a.reverse()),n.push(e.valueInds[0]),a.push(r.valueInds[0]),t.bundlecolors&&(n.unshift(e.rawColor),a.unshift(r.rawColor)),na?1:0}));for(var f=new Array(c.length),p=e[0].model.count,d=e[0].categories.map((function(t){return t.height})).reduce((function(t,e){return t+e})),g=0;g0?d*(v.count/p):0;for(var y,x=new Array(n.length),b=0;b1?(t.width-80-16)/(n-1):0)*a;var i,o,s,l,c,u=[],h=t.model.maxCats,f=e.categories.length,p=e.count,d=t.height-8*(h-1),g=8*(h-f)/2,m=e.categories.map((function(t){return{displayInd:t.displayInd,categoryInd:t.categoryInd}}));for(m.sort((function(t,e){return t.displayInd-e.displayInd})),c=0;c0?o.count/p*d:0,s={key:o.valueInds[0],model:o,width:16,height:i,y:null!==o.dragY?o.dragY:g,bands:[],parcatsViewModel:t},g=g+i+8,u.push(s);return{key:e.dimensionInd,x:null!==e.dragX?e.dragX:r,y:0,width:16,model:e,categories:u,parcatsViewModel:t,dragCategoryDisplayInd:null,dragDimensionDisplayInd:null,initialDragDimensionDisplayInds:null,initialDragCategoryDisplayInds:null,dragHasMoved:null,potentialClickBand:null}}e.exports=function(t,e,r,n){u(r,t,n,e)}},{"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/svg_text_utils":773,"../../plot_api/plot_api":784,d3:169,tinycolor2:548}],1116:[function(t,e,r){"use strict";var n=t("./parcats");e.exports=function(t,e,r,a){var i=t._fullLayout,o=i._paper,s=i._size;n(t,o,e,{width:s.w,height:s.h,margin:{t:s.t,r:s.r,b:s.b,l:s.l}},r,a)}},{"./parcats":1115}],1117:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),a=t("../../plots/cartesian/layout_attributes"),i=t("../../plots/font_attributes"),o=t("../../plots/domain").attributes,s=t("../../lib/extend").extendFlat,l=t("../../plot_api/plot_template").templatedArray;e.exports={domain:o({name:"parcoords",trace:!0,editType:"plot"}),labelangle:{valType:"angle",dflt:0,editType:"plot"},labelside:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},labelfont:i({editType:"plot"}),tickfont:i({editType:"plot"}),rangefont:i({editType:"plot"}),dimensions:l("dimension",{label:{valType:"string",editType:"plot"},tickvals:s({},a.tickvals,{editType:"plot"}),ticktext:s({},a.ticktext,{editType:"plot"}),tickformat:s({},a.tickformat,{editType:"plot"}),visible:{valType:"boolean",dflt:!0,editType:"plot"},range:{valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],editType:"plot"},constraintrange:{valType:"info_array",freeLength:!0,dimensions:"1-2",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],editType:"plot"},multiselect:{valType:"boolean",dflt:!0,editType:"plot"},values:{valType:"data_array",editType:"calc"},editType:"calc"}),line:s({editType:"calc"},n("line",{colorscaleDflt:"Viridis",autoColorDflt:!1,editTypeOverride:"calc"}))}},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/plot_template":787,"../../plots/cartesian/layout_attributes":811,"../../plots/domain":824,"../../plots/font_attributes":825}],1118:[function(t,e,r){"use strict";var n=t("./constants"),a=t("d3"),i=t("../../lib/gup").keyFun,o=t("../../lib/gup").repeat,s=t("../../lib").sorterAsc,l=n.bar.snapRatio;function c(t,e){return t*(1-l)+e*l}var u=n.bar.snapClose;function h(t,e){return t*(1-u)+e*u}function f(t,e,r,n){if(function(t,e){for(var r=0;r=e[r][0]&&t<=e[r][1])return!0;return!1}(r,n))return r;var a=t?-1:1,i=0,o=e.length-1;if(a<0){var s=i;i=o,o=s}for(var l=e[i],u=l,f=i;a*fe){f=r;break}}if(i=u,isNaN(i)&&(i=isNaN(h)||isNaN(f)?isNaN(h)?f:h:e-c[h][1]t[1]+r||e=.9*t[1]+.1*t[0]?"n":e<=.9*t[0]+.1*t[1]?"s":"ns"}(d,e);g&&(o.interval=l[i],o.intervalPix=d,o.region=g)}}if(t.ordinal&&!o.region){var v=t.unitTickvals,y=t.unitToPaddedPx.invert(e);for(r=0;r=x[0]&&y<=x[1]){o.clickableOrdinalRange=x;break}}}return o}function _(t,e){a.event.sourceEvent.stopPropagation();var r=e.height-a.mouse(t)[1]-2*n.verticalPadding,i=e.brush.svgBrush;i.wasDragged=!0,i._dragging=!0,i.grabbingBar?i.newExtent=[r-i.grabPoint,r+i.barLength-i.grabPoint].map(e.unitToPaddedPx.invert):i.newExtent=[i.startExtent,e.unitToPaddedPx.invert(r)].sort(s),e.brush.filterSpecified=!0,i.extent=i.stayingIntervals.concat([i.newExtent]),i.brushCallback(e),x(t.parentNode)}function w(t,e){var r=b(e,e.height-a.mouse(t)[1]-2*n.verticalPadding),i="crosshair";r.clickableOrdinalRange?i="pointer":r.region&&(i=r.region+"-resize"),a.select(document.body).style("cursor",i)}function T(t){t.on("mousemove",(function(t){a.event.preventDefault(),t.parent.inBrushDrag||w(this,t)})).on("mouseleave",(function(t){t.parent.inBrushDrag||v()})).call(a.behavior.drag().on("dragstart",(function(t){!function(t,e){a.event.sourceEvent.stopPropagation();var r=e.height-a.mouse(t)[1]-2*n.verticalPadding,i=e.unitToPaddedPx.invert(r),o=e.brush,s=b(e,r),l=s.interval,c=o.svgBrush;if(c.wasDragged=!1,c.grabbingBar="ns"===s.region,c.grabbingBar){var u=l.map(e.unitToPaddedPx);c.grabPoint=r-u[0]-n.verticalPadding,c.barLength=u[1]-u[0]}c.clickableOrdinalRange=s.clickableOrdinalRange,c.stayingIntervals=e.multiselect&&o.filterSpecified?o.filter.getConsolidated():[],l&&(c.stayingIntervals=c.stayingIntervals.filter((function(t){return t[0]!==l[0]&&t[1]!==l[1]}))),c.startExtent=s.region?l["s"===s.region?1:0]:i,e.parent.inBrushDrag=!0,c.brushStartCallback()}(this,t)})).on("drag",(function(t){_(this,t)})).on("dragend",(function(t){!function(t,e){var r=e.brush,n=r.filter,i=r.svgBrush;i._dragging||(w(t,e),_(t,e),e.brush.svgBrush.wasDragged=!1),i._dragging=!1,a.event.sourceEvent.stopPropagation();var o=i.grabbingBar;if(i.grabbingBar=!1,i.grabLocation=void 0,e.parent.inBrushDrag=!1,v(),!i.wasDragged)return i.wasDragged=void 0,i.clickableOrdinalRange?r.filterSpecified&&e.multiselect?i.extent.push(i.clickableOrdinalRange):(i.extent=[i.clickableOrdinalRange],r.filterSpecified=!0):o?(i.extent=i.stayingIntervals,0===i.extent.length&&M(r)):M(r),i.brushCallback(e),x(t.parentNode),void i.brushEndCallback(r.filterSpecified?n.getConsolidated():[]);var s=function(){n.set(n.getConsolidated())};if(e.ordinal){var l=e.unitTickvals;l[l.length-1]i.newExtent[0];i.extent=i.stayingIntervals.concat(c?[i.newExtent]:[]),i.extent.length||M(r),i.brushCallback(e),c?x(t.parentNode,s):(s(),x(t.parentNode))}else s();i.brushEndCallback(r.filterSpecified?n.getConsolidated():[])}(this,t)})))}function k(t,e){return t[0]-e[0]}function M(t){t.filterSpecified=!1,t.svgBrush.extent=[[-1/0,1/0]]}function A(t){for(var e,r=t.slice(),n=[],a=r.shift();a;){for(e=a.slice();(a=r.shift())&&a[0]<=e[1];)e[1]=Math.max(e[1],a[1]);n.push(e)}return 1===n.length&&n[0][0]>n[0][1]&&(n=[]),n}e.exports={makeBrush:function(t,e,r,n,a,i){var o,l=function(){var t,e,r=[];return{set:function(n){1===(r=n.map((function(t){return t.slice().sort(s)})).sort(k)).length&&r[0][0]===-1/0&&r[0][1]===1/0&&(r=[[0,-1]]),t=A(r),e=r.reduce((function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}),[1/0,-1/0])},get:function(){return r.slice()},getConsolidated:function(){return t},getBounds:function(){return e}}}();return l.set(r),{filter:l,filterSpecified:e,svgBrush:{extent:[],brushStartCallback:n,brushCallback:(o=a,function(t){var e=t.brush,r=function(t){return t.svgBrush.extent.map((function(t){return t.slice()}))}(e).slice();e.filter.set(r),o()}),brushEndCallback:i}}},ensureAxisBrush:function(t){var e=t.selectAll("."+n.cn.axisBrush).data(o,i);e.enter().append("g").classed(n.cn.axisBrush,!0),function(t){var e=t.selectAll(".background").data(o);e.enter().append("rect").classed("background",!0).call(p).call(d).style("pointer-events","auto").attr("transform","translate(0 "+n.verticalPadding+")"),e.call(T).attr("height",(function(t){return t.height-n.verticalPadding}));var r=t.selectAll(".highlight-shadow").data(o);r.enter().append("line").classed("highlight-shadow",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width+n.bar.strokeWidth).attr("stroke",n.bar.strokeColor).attr("opacity",n.bar.strokeOpacity).attr("stroke-linecap","butt"),r.attr("y1",(function(t){return t.height})).call(y);var a=t.selectAll(".highlight").data(o);a.enter().append("line").classed("highlight",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width-n.bar.strokeWidth).attr("stroke",n.bar.fillColor).attr("opacity",n.bar.fillOpacity).attr("stroke-linecap","butt"),a.attr("y1",(function(t){return t.height})).call(y)}(e)},cleanRanges:function(t,e){if(Array.isArray(t[0])?(t=t.map((function(t){return t.sort(s)})),t=e.multiselect?A(t.sort(k)):[t[0]]):t=[t.sort(s)],e.tickvals){var r=e.tickvals.slice().sort(s);if(!(t=t.map((function(t){var e=[f(0,r,t[0],[]),f(1,r,t[1],[])];if(e[1]>e[0])return e})).filter((function(t){return t}))).length)return}return t.length>1?t:t[0]}}},{"../../lib":749,"../../lib/gup":746,"./constants":1121,d3:169}],1119:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/get_data").getModuleCalcData,i=t("./plot"),o=t("../../constants/xmlns_namespaces");r.name="parcoords",r.plot=function(t){var e=a(t.calcdata,"parcoords")[0];e.length&&i(t,e)},r.clean=function(t,e,r,n){var a=n._has&&n._has("parcoords"),i=e._has&&e._has("parcoords");a&&!i&&(n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){var e=t._fullLayout._glimages,r=n.select(t).selectAll(".svg-container");r.filter((function(t,e){return e===r.size()-1})).selectAll(".gl-canvas-context, .gl-canvas-focus").each((function(){var t=this.toDataURL("image/png");e.append("svg:image").attr({xmlns:o.svg,"xlink:href":t,preserveAspectRatio:"none",x:0,y:0,width:this.width,height:this.height})})),window.setTimeout((function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")}),60)}},{"../../constants/xmlns_namespaces":725,"../../plots/get_data":834,"./plot":1128,d3:169}],1120:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale"),i=t("../../lib/gup").wrap;e.exports=function(t,e){var r,o;return a.hasColorscale(e,"line")&&n(e.line.color)?(r=e.line.color,o=a.extractOpts(e.line).colorscale,a.calc(t,e,{vals:r,containerStr:"line",cLetter:"c"})):(r=function(t){for(var e=new Array(t),r=0;rh&&(n.log("parcoords traces support up to "+h+" dimensions at the moment"),d.splice(h));var g=s(t,e,{name:"dimensions",layout:l,handleItemDefaults:p}),m=function(t,e,r,o,s){var l=s("line.color",r);if(a(t,"line")&&n.isArrayOrTypedArray(l)){if(l.length)return s("line.colorscale"),i(t,e,o,s,{prefix:"line.",cLetter:"c"}),l.length;e.line.color=r}return 1/0}(t,e,r,l,u);o(e,l,u),Array.isArray(g)&&g.length||(e.visible=!1),f(e,g,"values",m);var v={family:l.font.family,size:Math.round(l.font.size/1.2),color:l.font.color};n.coerceFont(u,"labelfont",v),n.coerceFont(u,"tickfont",v),n.coerceFont(u,"rangefont",v),u("labelangle"),u("labelside")}},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749,"../../plots/array_container_defaults":793,"../../plots/cartesian/axes":797,"../../plots/domain":824,"./attributes":1117,"./axisbrush":1118,"./constants":1121,"./merge_length":1126}],1123:[function(t,e,r){"use strict";var n=t("../../lib").isTypedArray;r.convertTypedArray=function(t){return n(t)?Array.prototype.slice.call(t):t},r.isOrdinal=function(t){return!!t.tickvals},r.isVisible=function(t){return t.visible||!("visible"in t)}},{"../../lib":749}],1124:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcoords",basePlotModule:t("./base_plot"),categories:["gl","regl","noOpacity","noHover"],meta:{}}},{"./attributes":1117,"./base_plot":1119,"./calc":1120,"./defaults":1122,"./plot":1128}],1125:[function(t,e,r){"use strict";var n=t("glslify"),a=n(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nattribute vec4 p01_04, p05_08, p09_12, p13_16,\n p17_20, p21_24, p25_28, p29_32,\n p33_36, p37_40, p41_44, p45_48,\n p49_52, p53_56, p57_60, colors;\n\nuniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution, viewBoxPos, viewBoxSize;\nuniform sampler2D mask, palette;\nuniform float maskHeight;\nuniform float drwLayer; // 0: context, 1: focus, 2: pick\nuniform vec4 contextColor;\n\nbool isPick = (drwLayer > 1.5);\nbool isContext = (drwLayer < 0.5);\n\nconst vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0);\nconst vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * UNITS, UNITS);\n}\n\nfloat axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) {\n float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D);\n float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D);\n return y1 * (1.0 - ratio) + y2 * ratio;\n}\n\nint iMod(int a, int b) {\n return a - b * (a / b);\n}\n\nbool fOutside(float p, float lo, float hi) {\n return (lo < hi) && (lo > p || p > hi);\n}\n\nbool vOutside(vec4 p, vec4 lo, vec4 hi) {\n return (\n fOutside(p[0], lo[0], hi[0]) ||\n fOutside(p[1], lo[1], hi[1]) ||\n fOutside(p[2], lo[2], hi[2]) ||\n fOutside(p[3], lo[3], hi[3])\n );\n}\n\nbool mOutside(mat4 p, mat4 lo, mat4 hi) {\n return (\n vOutside(p[0], lo[0], hi[0]) ||\n vOutside(p[1], lo[1], hi[1]) ||\n vOutside(p[2], lo[2], hi[2]) ||\n vOutside(p[3], lo[3], hi[3])\n );\n}\n\nbool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) {\n return mOutside(A, loA, hiA) ||\n mOutside(B, loB, hiB) ||\n mOutside(C, loC, hiC) ||\n mOutside(D, loD, hiD);\n}\n\nbool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) {\n mat4 pnts[4];\n pnts[0] = A;\n pnts[1] = B;\n pnts[2] = C;\n pnts[3] = D;\n\n for(int i = 0; i < 4; ++i) {\n for(int j = 0; j < 4; ++j) {\n for(int k = 0; k < 4; ++k) {\n if(0 == iMod(\n int(255.0 * texture2D(mask,\n vec2(\n (float(i * 2 + j / 2) + 0.5) / 8.0,\n (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight\n ))[3]\n ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))),\n 2\n )) return true;\n }\n }\n }\n return false;\n}\n\nvec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) {\n float x = 0.5 * sign(v) + 0.5;\n float y = axisY(x, A, B, C, D);\n float z = 1.0 - abs(v);\n\n z += isContext ? 0.0 : 2.0 * float(\n outsideBoundingBox(A, B, C, D) ||\n outsideRasterMask(A, B, C, D)\n );\n\n return vec4(\n 2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0,\n z,\n 1.0\n );\n}\n\nvoid main() {\n mat4 A = mat4(p01_04, p05_08, p09_12, p13_16);\n mat4 B = mat4(p17_20, p21_24, p25_28, p29_32);\n mat4 C = mat4(p33_36, p37_40, p41_44, p45_48);\n mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS);\n\n float v = colors[3];\n\n gl_Position = position(isContext, v, A, B, C, D);\n\n fragColor =\n isContext ? vec4(contextColor) :\n isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5));\n}\n"]),i=n(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}\n"]),o=t("./constants").maxDimensionCount,s=t("../../lib"),l=new Uint8Array(4),c=new Uint8Array(4),u={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function h(t,e,r,n,a){var i=t._gl;i.enable(i.SCISSOR_TEST),i.scissor(e,r,n,a),t.clear({color:[0,0,0,0],depth:1})}function f(t,e,r,n,a,i){var o=i.key;r.drawCompleted||(!function(t){t.read({x:0,y:0,width:1,height:1,data:l})}(t),r.drawCompleted=!0),function s(l){var c=Math.min(n,a-l*n);0===l&&(window.cancelAnimationFrame(r.currentRafs[o]),delete r.currentRafs[o],h(t,i.scissorX,i.scissorY,i.scissorWidth,i.viewBoxSize[1])),r.clearOnly||(i.count=2*c,i.offset=2*l*n,e(i),l*n+c>>8*e)%256/255}function g(t,e,r){for(var n=new Array(8*e),a=0,i=0;iu&&(u=t[a].dim1.canvasX,o=a);0===s&&h(T,0,0,r.canvasWidth,r.canvasHeight);var p=function(t){var e,r,n,a=[[],[]];for(n=0;n<64;n++){var i=!t&&na._length&&(S=S.slice(0,a._length));var E,C=a.tickvals;function L(t,e){return{val:t,text:E[e]}}function P(t,e){return t.val-e.val}if(Array.isArray(C)&&C.length){E=a.ticktext,Array.isArray(E)&&E.length?E.length>C.length?E=E.slice(0,C.length):C.length>E.length&&(C=C.slice(0,E.length)):E=C.map(n.format(a.tickformat));for(var I=1;I=r||l>=i)return;var c=t.lineLayer.readPixel(s,i-1-l),u=0!==c[3],h=u?c[2]+256*(c[1]+256*c[0]):null,f={x:s,y:l,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:h};h!==O&&(u?a.hover(f):a.unhover&&a.unhover(f),O=h)}})),z.style("opacity",(function(t){return t.pick?0:1})),u.style("background","rgba(255, 255, 255, 0)");var D=u.selectAll("."+g.cn.parcoords).data(k,h);D.exit().remove(),D.enter().append("g").classed(g.cn.parcoords,!0).style("shape-rendering","crispEdges").style("pointer-events","none"),D.attr("transform",(function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"}));var R=D.selectAll("."+g.cn.parcoordsControlView).data(f,h);R.enter().append("g").classed(g.cn.parcoordsControlView,!0),R.attr("transform",(function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"}));var F=R.selectAll("."+g.cn.yAxis).data((function(t){return t.dimensions}),h);F.enter().append("g").classed(g.cn.yAxis,!0),R.each((function(t){L(F,t)})),z.each((function(t){if(t.viewModel){!t.lineLayer||a?t.lineLayer=v(this,t):t.lineLayer.update(t),(t.key||0===t.key)&&(t.viewModel[t.key]=t.lineLayer);var e=!t.context||a;t.lineLayer.render(t.viewModel.panels,e)}})),F.attr("transform",(function(t){return"translate("+t.xScale(t.xIndex)+", 0)"})),F.call(n.behavior.drag().origin((function(t){return t})).on("drag",(function(t){var e=t.parent;T.linePickActive(!1),t.x=Math.max(-g.overdrag,Math.min(t.model.width+g.overdrag,n.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,F.sort((function(t,e){return t.x-e.x})).each((function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio})),L(F,e),F.filter((function(e){return 0!==Math.abs(t.xIndex-e.xIndex)})).attr("transform",(function(t){return"translate("+t.xScale(t.xIndex)+", 0)"})),n.select(this).attr("transform","translate("+t.x+", 0)"),F.each((function(r,n,a){a===t.parent.key&&(e.dimensions[n]=r)})),e.contextLayer&&e.contextLayer.render(e.panels,!1,!M(e)),e.focusLayer.render&&e.focusLayer.render(e.panels)})).on("dragend",(function(t){var e=t.parent;t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,L(F,e),n.select(this).attr("transform",(function(t){return"translate("+t.x+", 0)"})),e.contextLayer&&e.contextLayer.render(e.panels,!1,!M(e)),e.focusLayer&&e.focusLayer.render(e.panels),e.pickLayer&&e.pickLayer.render(e.panels,!0),T.linePickActive(!0),a&&a.axesMoved&&a.axesMoved(e.key,e.dimensions.map((function(t){return t.crossfilterDimensionIndex})))}))),F.exit().remove();var B=F.selectAll("."+g.cn.axisOverlays).data(f,h);B.enter().append("g").classed(g.cn.axisOverlays,!0),B.selectAll("."+g.cn.axis).remove();var N=B.selectAll("."+g.cn.axis).data(f,h);N.enter().append("g").classed(g.cn.axis,!0),N.each((function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,a=r.domain();n.select(this).call(n.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?a:null).tickFormat((function(e){return d.isOrdinal(t)?e:P(t.model.dimensions[t.visibleIndex],e)})).scale(r)),l.font(N.selectAll("text"),t.model.tickFont)})),N.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),N.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var j=B.selectAll("."+g.cn.axisHeading).data(f,h);j.enter().append("g").classed(g.cn.axisHeading,!0);var U=j.selectAll("."+g.cn.axisTitle).data(f,h);U.enter().append("text").classed(g.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),U.text((function(t){return t.label})).each((function(e){var r=n.select(this);l.font(r,e.model.labelFont),s.convertToTspans(r,t)})).attr("transform",(function(t){var e=C(t.model.labelAngle,t.model.labelSide),r=g.axisTitleOffset;return(e.dir>0?"":"translate(0,"+(2*r+t.model.height)+")")+"rotate("+e.degrees+")translate("+-r*e.dx+","+-r*e.dy+")"})).attr("text-anchor",(function(t){var e=C(t.model.labelAngle,t.model.labelSide);return 2*Math.abs(e.dx)>Math.abs(e.dy)?e.dir*e.dx<0?"start":"end":"middle"}));var V=B.selectAll("."+g.cn.axisExtent).data(f,h);V.enter().append("g").classed(g.cn.axisExtent,!0);var q=V.selectAll("."+g.cn.axisExtentTop).data(f,h);q.enter().append("g").classed(g.cn.axisExtentTop,!0),q.attr("transform","translate(0,"+-g.axisExtentOffset+")");var H=q.selectAll("."+g.cn.axisExtentTopText).data(f,h);H.enter().append("text").classed(g.cn.axisExtentTopText,!0).call(E),H.text((function(t){return I(t,!0)})).each((function(t){l.font(n.select(this),t.model.rangeFont)}));var G=V.selectAll("."+g.cn.axisExtentBottom).data(f,h);G.enter().append("g").classed(g.cn.axisExtentBottom,!0),G.attr("transform",(function(t){return"translate(0,"+(t.model.height+g.axisExtentOffset)+")"}));var Y=G.selectAll("."+g.cn.axisExtentBottomText).data(f,h);Y.enter().append("text").classed(g.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(E),Y.text((function(t){return I(t,!1)})).each((function(t){l.font(n.select(this),t.model.rangeFont)})),m.ensureAxisBrush(B)}},{"../../components/colorscale":627,"../../components/drawing":637,"../../lib":749,"../../lib/gup":746,"../../lib/svg_text_utils":773,"../../plots/cartesian/axes":797,"./axisbrush":1118,"./constants":1121,"./helpers":1123,"./lines":1125,"color-rgba":127,d3:169}],1128:[function(t,e,r){"use strict";var n=t("./parcoords"),a=t("../../lib/prepare_regl"),i=t("./helpers").isVisible;function o(t,e,r){var n=e.indexOf(r),a=t.indexOf(n);return-1===a&&(a+=e.length),a}e.exports=function(t,e){var r=t._fullLayout;if(a(t)){var s={},l={},c={},u={},h=r._size;e.forEach((function(e,r){var n=e[0].trace;c[r]=n.index;var a=u[r]=n._fullInput.index;s[r]=t.data[a].dimensions,l[r]=t.data[a].dimensions.slice()}));n(t,e,{width:h.w,height:h.h,margin:{t:h.t,r:h.r,b:h.b,l:h.l}},{filterChanged:function(e,n,a){var i=l[e][n],o=a.map((function(t){return t.slice()})),s="dimensions["+n+"].constraintrange",h=r._tracePreGUI[t._fullData[c[e]]._fullInput.uid];if(void 0===h[s]){var f=i.constraintrange;h[s]=f||null}var p=t._fullData[c[e]].dimensions[n];o.length?(1===o.length&&(o=o[0]),i.constraintrange=o,p.constraintrange=o.slice(),o=[o]):(delete i.constraintrange,delete p.constraintrange,o=null);var d={};d[s]=o,t.emit("plotly_restyle",[d,[u[e]]])},hover:function(e){t.emit("plotly_hover",e)},unhover:function(e){t.emit("plotly_unhover",e)},axesMoved:function(e,r){var n=function(t,e){return function(r,n){return o(t,e,r)-o(t,e,n)}}(r,l[e].filter(i));s[e].sort(n),l[e].filter((function(t){return!i(t)})).sort((function(t){return l[e].indexOf(t)})).forEach((function(t){s[e].splice(s[e].indexOf(t),1),s[e].splice(l[e].indexOf(t),0,t)})),t.emit("plotly_restyle",[{dimensions:[s[e]]},[u[e]]])}})}}},{"../../lib/prepare_regl":762,"./helpers":1123,"./parcoords":1127}],1129:[function(t,e,r){"use strict";var n=t("../../plots/attributes"),a=t("../../plots/domain").attributes,i=t("../../plots/font_attributes"),o=t("../../components/color/attributes"),s=t("../../plots/template_attributes").hovertemplateAttrs,l=t("../../plots/template_attributes").texttemplateAttrs,c=t("../../lib/extend").extendFlat,u=i({editType:"plot",arrayOk:!0,colorEditType:"plot"});e.exports={labels:{valType:"data_array",editType:"calc"},label0:{valType:"number",dflt:0,editType:"calc"},dlabel:{valType:"number",dflt:1,editType:"calc"},values:{valType:"data_array",editType:"calc"},marker:{colors:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:o.defaultLine,arrayOk:!0,editType:"style"},width:{valType:"number",min:0,dflt:0,arrayOk:!0,editType:"style"},editType:"calc"},editType:"calc"},text:{valType:"data_array",editType:"plot"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"style"},scalegroup:{valType:"string",dflt:"",editType:"calc"},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"],editType:"calc"},hoverinfo:c({},n.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:s({},{keys:["label","color","value","percent","text"]}),texttemplate:l({editType:"plot"},{keys:["label","color","value","percent","text"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,editType:"plot"},textfont:c({},u,{}),insidetextorientation:{valType:"enumerated",values:["horizontal","radial","tangential","auto"],dflt:"auto",editType:"plot"},insidetextfont:c({},u,{}),outsidetextfont:c({},u,{}),automargin:{valType:"boolean",dflt:!1,editType:"plot"},title:{text:{valType:"string",dflt:"",editType:"plot"},font:c({},u,{}),position:{valType:"enumerated",values:["top left","top center","top right","middle center","bottom left","bottom center","bottom right"],editType:"plot"},editType:"plot"},domain:a({name:"pie",trace:!0,editType:"calc"}),hole:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},sort:{valType:"boolean",dflt:!0,editType:"calc"},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"number",min:-360,max:360,dflt:0,editType:"calc"},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0,editType:"calc"},_deprecated:{title:{valType:"string",dflt:"",editType:"calc"},titlefont:c({},u,{}),titleposition:{valType:"enumerated",values:["top left","top center","top right","middle center","bottom left","bottom center","bottom right"],editType:"calc"}}}},{"../../components/color/attributes":614,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/font_attributes":825,"../../plots/template_attributes":875}],1130:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.name="pie",r.plot=function(t,e,a,i){n.plotBasePlot(r.name,t,e,a,i)},r.clean=function(t,e,a,i){n.cleanBasePlot(r.name,t,e,a,i)}},{"../../plots/plots":860}],1131:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),i=t("../../components/color"),o={};function s(t){return function(e,r){return!!e&&(!!(e=a(e)).isValid()&&(e=i.addOpacity(e,e.getAlpha()),t[r]||(t[r]=e),e))}}function l(t,e){var r,n=JSON.stringify(t),i=e[n];if(!i){for(i=t.slice(),r=0;r0){s=!0;break}}s||(o=0)}return{hasLabels:r,hasValues:i,len:o}}e.exports={handleLabelsAndValues:l,supplyDefaults:function(t,e,r,n){function c(r,n){return a.coerce(t,e,i,r,n)}var u=l(c("labels"),c("values")),h=u.len;if(e._hasLabels=u.hasLabels,e._hasValues=u.hasValues,!e._hasLabels&&e._hasValues&&(c("label0"),c("dlabel")),h){e._length=h,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var f,p=c("text"),d=c("texttemplate");if(d||(f=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),d||f&&"none"!==f){var g=c("textposition");s(t,e,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(e,n,c);var m=c("hole");if(c("title.text")){var v=c("title.position",m?"middle center":"top center");m||"middle center"!==v||(e.title.position="top center"),a.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else e.visible=!1}}},{"../../lib":749,"../../plots/domain":824,"../bar/defaults":894,"./attributes":1129,"fast-isnumeric":241}],1133:[function(t,e,r){"use strict";var n=t("../../components/fx/helpers").appendArrayMultiPointValues;e.exports=function(t,e){var r={curveNumber:e.index,pointNumbers:t.pts,data:e._input,fullData:e,label:t.label,color:t.color,value:t.v,percent:t.percent,text:t.text,v:t.v};return 1===t.pts.length&&(r.pointNumber=r.i=t.pts[0]),n(r,e,t.pts),"funnelarea"===e.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":651}],1134:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;r"),name:u.hovertemplate||-1!==h.indexOf("name")?u.name:void 0,idealAlign:t.pxmid[0]<0?"left":"right",color:d.castOption(b.bgcolor,t.pts)||t.color,borderColor:d.castOption(b.bordercolor,t.pts),fontFamily:d.castOption(_.family,t.pts),fontSize:d.castOption(_.size,t.pts),fontColor:d.castOption(_.color,t.pts),nameLength:d.castOption(b.namelength,t.pts),textAlign:d.castOption(b.align,t.pts),hovertemplate:d.castOption(u.hovertemplate,t.pts),hovertemplateLabels:t,eventData:[g(t,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:e}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,e.emit("plotly_hover",{points:[g(t,u)],event:n.event})}})),t.on("mouseout",(function(t){var r=e._fullLayout,a=e._fullData[o.index],s=n.select(this).datum();o._hasHoverEvent&&(t.originalEvent=n.event,e.emit("plotly_unhover",{points:[g(s,a)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(i.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),t.on("click",(function(t){var r=e._fullLayout,a=e._fullData[o.index];e._dragging||!1===r.hovermode||(e._hoverdata=[g(t,a)],i.click(e,n.event))}))}function y(t,e,r){var n=d.castOption(t.insidetextfont.color,e.pts);!n&&t._input.textfont&&(n=d.castOption(t._input.textfont.color,e.pts));var a=d.castOption(t.insidetextfont.family,e.pts)||d.castOption(t.textfont.family,e.pts)||r.family,i=d.castOption(t.insidetextfont.size,e.pts)||d.castOption(t.textfont.size,e.pts)||r.size;return{color:n||o.contrast(e.color),family:a,size:i}}function x(t,e){for(var r,n,a=0;ae&&e>n||r=-4;m-=2)v(Math.PI*m,"tan");for(m=4;m>=-4;m-=2)v(Math.PI*(m+1),"tan")}if(h||p){for(m=4;m>=-4;m-=2)v(Math.PI*(m+1.5),"rad");for(m=4;m>=-4;m-=2)v(Math.PI*(m+.5),"rad")}}if(s||d||h){var y=Math.sqrt(t.width*t.width+t.height*t.height);if((i={scale:a*n*2/y,rCenter:1-a,rotate:0}).textPosAngle=(e.startangle+e.stopangle)/2,i.scale>=1)return i;g.push(i)}(d||p)&&((i=_(t,n,o,l,c)).textPosAngle=(e.startangle+e.stopangle)/2,g.push(i)),(d||f)&&((i=w(t,n,o,l,c)).textPosAngle=(e.startangle+e.stopangle)/2,g.push(i));for(var x=0,b=0,T=0;T=1)break}return g[x]}function _(t,e,r,n,a){e=Math.max(0,e-2*p);var i=t.width/t.height,o=M(i,n,e,r);return{scale:2*o/t.height,rCenter:T(i,o/e),rotate:k(a)}}function w(t,e,r,n,a){e=Math.max(0,e-2*p);var i=t.height/t.width,o=M(i,n,e,r);return{scale:2*o/t.width,rCenter:T(i,o/e),rotate:k(a+Math.PI/2)}}function T(t,e){return Math.cos(e)-t*e}function k(t){return(180/Math.PI*t+720)%180-90}function M(t,e,r,n){var a=t+1/(2*Math.tan(e));return r*Math.min(1/(Math.sqrt(a*a+.5)+a),n/(Math.sqrt(t*t+n/2)+t))}function A(t,e){return t.v!==e.vTotal||e.trace.hole?Math.min(1/(1+1/Math.sin(t.halfangle)),t.ring/2):1}function S(t,e){var r=e.pxmid[0],n=e.pxmid[1],a=t.width/2,i=t.height/2;return r<0&&(a*=-1),n<0&&(i*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:!0}}function E(t,e){var r,n,a,i=t.trace,o={x:t.cx,y:t.cy},s={tx:0,ty:0};s.ty+=i.title.font.size,a=L(i),-1!==i.title.position.indexOf("top")?(o.y-=(1+a)*t.r,s.ty-=t.titleBox.height):-1!==i.title.position.indexOf("bottom")&&(o.y+=(1+a)*t.r);var l,c,u=(l=t.r,c=t.trace.aspectratio,l/(void 0===c?1:c)),h=e.w*(i.domain.x[1]-i.domain.x[0])/2;return-1!==i.title.position.indexOf("left")?(h+=u,o.x-=(1+a)*u,s.tx+=t.titleBox.width/2):-1!==i.title.position.indexOf("center")?h*=2:-1!==i.title.position.indexOf("right")&&(h+=u,o.x+=(1+a)*u,s.tx-=t.titleBox.width/2),r=h/t.titleBox.width,n=C(t,e)/t.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:s.tx,ty:s.ty}}function C(t,e){var r=t.trace,n=e.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(t.titleBox.height,n/2)}function L(t){var e,r=t.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,e=0;er&&(r=t.pull[e]);return r}function P(t,e){for(var r=[],n=0;n1?(c=r.r,u=c/a.aspectratio):(u=r.r,c=u*a.aspectratio),c*=(1+a.baseratio)/2,l=c*u}o=Math.min(o,l/r.vTotal)}for(n=0;n")}if(i){var x=l.castOption(a,e.i,"texttemplate");if(x){var b=function(t){return{label:t.label,value:t.v,valueLabel:d.formatPieValue(t.v,n.separators),percent:t.v/r.vTotal,percentLabel:d.formatPiePercent(t.v/r.vTotal,n.separators),color:t.color,text:t.text,customdata:l.castOption(a,t.i,"customdata")}}(e),_=d.getFirstFilled(a.text,e.pts);(m(_)||""===_)&&(b.text=_),e.text=l.texttemplateString(x,b,t._fullLayout._d3locale,b,a._meta||{})}else e.text=""}}function O(t,e){var r=t.rotate*Math.PI/180,n=Math.cos(r),a=Math.sin(r),i=(e.left+e.right)/2,o=(e.top+e.bottom)/2;t.textX=i*n-o*a,t.textY=i*a+o*n,t.noCenter=!0}e.exports={plot:function(t,e){var r=t._fullLayout,i=r._size;f("pie",r),x(e,t),P(e,i);var u=l.makeTraceGroups(r._pielayer,e,"trace").each((function(e){var u=n.select(this),f=e[0],p=f.trace;!function(t){var e,r,n,a=t[0],i=a.r,o=a.trace,s=o.rotation*Math.PI/180,l=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(e=0;ea.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/a.vTotal,.5),r.ring=1-o.hole,r.rInscribed=A(r,a))}(e),u.attr("stroke-linejoin","round"),u.each((function(){var g=n.select(this).selectAll("g.slice").data(e);g.enter().append("g").classed("slice",!0),g.exit().remove();var m=[[[],[]],[[],[]]],x=!1;g.each((function(a,i){if(a.hidden)n.select(this).selectAll("path,g").remove();else{a.pointNumber=a.i,a.curveNumber=p.index,m[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var o=f.cx,u=f.cy,g=n.select(this),_=g.selectAll("path.surface").data([a]);if(_.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),g.call(v,t,e),p.pull){var w=+d.castOption(p.pull,a.pts)||0;w>0&&(o+=w*a.pxmid[0],u+=w*a.pxmid[1])}a.cxFinal=o,a.cyFinal=u;var T=p.hole;if(a.v===f.vTotal){var k="M"+(o+a.px0[0])+","+(u+a.px0[1])+L(a.px0,a.pxmid,!0,1)+L(a.pxmid,a.px0,!0,1)+"Z";T?_.attr("d","M"+(o+T*a.px0[0])+","+(u+T*a.px0[1])+L(a.px0,a.pxmid,!1,T)+L(a.pxmid,a.px0,!1,T)+"Z"+k):_.attr("d",k)}else{var M=L(a.px0,a.px1,!0,1);if(T){var A=1-T;_.attr("d","M"+(o+T*a.px1[0])+","+(u+T*a.px1[1])+L(a.px1,a.px0,!1,T)+"l"+A*a.px0[0]+","+A*a.px0[1]+M+"Z")}else _.attr("d","M"+o+","+u+"l"+a.px0[0]+","+a.px0[1]+M+"Z")}z(t,a,f);var E=d.castOption(p.textposition,a.pts),C=g.selectAll("g.slicetext").data(a.text&&"none"!==E?[0]:[]);C.enter().append("g").classed("slicetext",!0),C.exit().remove(),C.each((function(){var g=l.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),m=l.ensureUniformFontSize(t,"outside"===E?function(t,e,r){var n=d.castOption(t.outsidetextfont.color,e.pts)||d.castOption(t.textfont.color,e.pts)||r.color,a=d.castOption(t.outsidetextfont.family,e.pts)||d.castOption(t.textfont.family,e.pts)||r.family,i=d.castOption(t.outsidetextfont.size,e.pts)||d.castOption(t.textfont.size,e.pts)||r.size;return{color:n,family:a,size:i}}(p,a,r.font):y(p,a,r.font));g.text(a.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(s.font,m).call(c.convertToTspans,t);var v,_=s.bBox(g.node());if("outside"===E)v=S(_,a);else if(v=b(_,a,f),"auto"===E&&v.scale<1){var w=l.ensureUniformFontSize(t,p.outsidetextfont);g.call(s.font,w),v=S(_=s.bBox(g.node()),a)}var T=v.textPosAngle,k=void 0===T?a.pxmid:I(f.r,T);if(v.targetX=o+k[0]*v.rCenter+(v.x||0),v.targetY=u+k[1]*v.rCenter+(v.y||0),O(v,_),v.outside){var M=v.targetY;a.yLabelMin=M-_.height/2,a.yLabelMid=M,a.yLabelMax=M+_.height/2,a.labelExtraX=0,a.labelExtraY=0,x=!0}v.fontSize=m.size,h(p.type,v,r),e[i].transform=v,g.attr("transform",l.getTextTransform(v))}))}function L(t,e,r,n){var i=n*(e[0]-t[0]),o=n*(e[1]-t[1]);return"a"+n*f.r+","+n*f.r+" 0 "+a.largeArc+(r?" 1 ":" 0 ")+i+","+o}}));var _=n.select(this).selectAll("g.titletext").data(p.title.text?[0]:[]);if(_.enter().append("g").classed("titletext",!0),_.exit().remove(),_.each((function(){var e,r=l.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),a=p.title.text;p._meta&&(a=l.templateString(a,p._meta)),r.text(a).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(s.font,p.title.font).call(c.convertToTspans,t),e="middle center"===p.title.position?function(t){var e=Math.sqrt(t.titleBox.width*t.titleBox.width+t.titleBox.height*t.titleBox.height);return{x:t.cx,y:t.cy,scale:t.trace.hole*t.r*2/e,tx:0,ty:-t.titleBox.height/2+t.trace.title.font.size}}(f):E(f,i),r.attr("transform","translate("+e.x+","+e.y+")"+(e.scale<1?"scale("+e.scale+")":"")+"translate("+e.tx+","+e.ty+")")})),x&&function(t,e){var r,n,a,i,o,s,l,c,u,h,f,p,g;function m(t,e){return t.pxmid[1]-e.pxmid[1]}function v(t,e){return e.pxmid[1]-t.pxmid[1]}function y(t,r){r||(r={});var a,c,u,f,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),g=n?t.yLabelMin:t.yLabelMax,m=n?t.yLabelMax:t.yLabelMin,v=t.cyFinal+o(t.px0[1],t.px1[1]),y=p-g;if(y*l>0&&(t.labelExtraY=y),Array.isArray(e.pull))for(c=0;c=(d.castOption(e.pull,u.pts)||0)||((t.pxmid[1]-u.pxmid[1])*l>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-g-t.labelExtraY)*l>0&&(t.labelExtraY+=y):(m+t.labelExtraY-v)*l>0&&(a=3*s*Math.abs(c-h.indexOf(t)),(f=u.cxFinal+i(u.px0[0],u.px1[0])+a-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*s>0&&(t.labelExtraX+=f)))}for(n=0;n<2;n++)for(a=n?m:v,o=n?Math.max:Math.min,l=n?1:-1,r=0;r<2;r++){for(i=r?Math.max:Math.min,s=r?1:-1,(c=t[n][r]).sort(a),u=t[1-n][r],h=u.concat(c),p=[],f=0;fMath.abs(h)?s+="l"+h*t.pxmid[0]/t.pxmid[1]+","+h+"H"+(i+t.labelExtraX+c):s+="l"+t.labelExtraX+","+u+"v"+(h-u)+"h"+c}else s+="V"+(t.yLabelMid+t.labelExtraY)+"h"+c;l.ensureSingle(r,"path","textline").call(o.stroke,e.outsidetextfont.color).attr({"stroke-width":Math.min(2,e.outsidetextfont.size/8),d:s,fill:"none"})}else r.select("path.textline").remove()}))}(g,p),x&&p.automargin){var w=s.bBox(u.node()),T=p.domain,k=i.w*(T.x[1]-T.x[0]),M=i.h*(T.y[1]-T.y[0]),A=(.5*k-f.r)/i.w,C=(.5*M-f.r)/i.h;a.autoMargin(t,"pie."+p.uid+".automargin",{xl:T.x[0]-A,xr:T.x[1]+A,yb:T.y[0]-C,yt:T.y[1]+C,l:Math.max(f.cx-f.r-w.left,0),r:Math.max(w.right-(f.cx+f.r),0),b:Math.max(w.bottom-(f.cy+f.r),0),t:Math.max(f.cy-f.r-w.top,0),pad:5})}}))}));setTimeout((function(){u.selectAll("tspan").each((function(){var t=n.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))}))}),0)},formatSliceLabel:z,transformInsideText:b,determineInsideTextFont:y,positionTitleOutside:E,prerenderTitles:x,layoutAreas:P,attachFxHandlers:v,computeTransform:O}},{"../../components/color":615,"../../components/drawing":637,"../../components/fx":655,"../../lib":749,"../../lib/svg_text_utils":773,"../../plots/plots":860,"../bar/constants":892,"../bar/uniform_text":906,"./event_data":1133,"./helpers":1134,d3:169}],1139:[function(t,e,r){"use strict";var n=t("d3"),a=t("./style_one"),i=t("../bar/uniform_text").resizeText;e.exports=function(t){var e=t._fullLayout._pielayer.selectAll(".trace");i(t,e,"pie"),e.each((function(t){var e=t[0].trace,r=n.select(this);r.style({opacity:e.opacity}),r.selectAll("path.surface").each((function(t){n.select(this).call(a,t,e)}))}))}},{"../bar/uniform_text":906,"./style_one":1140,d3:169}],1140:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("./helpers").castOption;e.exports=function(t,e,r){var i=r.marker.line,o=a(i.color,e.pts)||n.defaultLine,s=a(i.width,e.pts)||0;t.style("stroke-width",s).call(n.fill,e.color).call(n.stroke,o)}},{"../../components/color":615,"./helpers":1134}],1141:[function(t,e,r){"use strict";var n=t("../scatter/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array",editType:"calc"},indices:{valType:"data_array",editType:"calc"},xbounds:{valType:"data_array",editType:"calc"},ybounds:{valType:"data_array",editType:"calc"},text:n.text,marker:{color:{valType:"color",arrayOk:!1,editType:"calc"},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1,editType:"calc"},blend:{valType:"boolean",dflt:null,editType:"calc"},sizemin:{valType:"number",min:.1,max:2,dflt:.5,editType:"calc"},sizemax:{valType:"number",min:.1,dflt:20,editType:"calc"},border:{color:{valType:"color",arrayOk:!1,editType:"calc"},arearatio:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},editType:"calc"},editType:"calc"},transforms:void 0}},{"../scatter/attributes":1155}],1142:[function(t,e,r){"use strict";var n=t("gl-pointcloud2d"),a=t("../../lib/str2rgbarray"),i=t("../../plots/cartesian/autorange").findExtremes,o=t("../scatter/get_trace_color");function s(t,e){this.scene=t,this.uid=e,this.type="pointcloud",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.idToIndex=new Int32Array(0),this.bounds=[0,0,0,0],this.pointcloudOptions={positions:new Float32Array(0),idToIndex:this.idToIndex,sizemin:.5,sizemax:12,color:[0,0,0,1],areaRatio:1,borderColor:[0,0,0,1]},this.pointcloud=n(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}var l=s.prototype;l.handlePick=function(t){var e=this.idToIndex[t.pointId];return{trace:this,dataCoord:t.dataCoord,traceCoord:this.pickXYData?[this.pickXYData[2*e],this.pickXYData[2*e+1]]:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:this.color,name:this.name,pointIndex:e,hoverinfo:this.hoverinfo}},l.update=function(t){this.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=o(t,{})},l.updateFast=function(t){var e,r,n,o,s,l,c=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,h=this.pickXYData=t.xy,f=t.xbounds&&t.ybounds,p=t.indices,d=this.bounds;if(h){if(n=h,e=h.length>>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(l=0;ld[2]&&(d[2]=o),sd[3]&&(d[3]=s);if(p)r=p;else for(r=new Int32Array(e),l=0;ld[2]&&(d[2]=o),sd[3]&&(d[3]=s);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var g=a(t.marker.color),m=a(t.marker.border.color),v=t.opacity*t.marker.opacity;g[3]*=v,this.pointcloudOptions.color=g;var y=t.marker.blend;if(null===y){y=c.length<100||u.length<100}this.pointcloudOptions.blend=y,m[3]*=v,this.pointcloudOptions.borderColor=m;var x=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=x,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions);var _=this.scene.xaxis,w=this.scene.yaxis,T=b/2||.5;t._extremes[_._id]=i(_,[d[0],d[2]],{ppad:T}),t._extremes[w._id]=i(w,[d[1],d[3]],{ppad:T})},l.dispose=function(){this.pointcloud.dispose()},e.exports=function(t,e){var r=new s(t,e.uid);return r.update(e),r}},{"../../lib/str2rgbarray":772,"../../plots/cartesian/autorange":796,"../scatter/get_trace_color":1165,"gl-pointcloud2d":303}],1143:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}i("x"),i("y"),i("xbounds"),i("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),i("text"),i("marker.color",r),i("marker.opacity"),i("marker.blend"),i("marker.sizemin"),i("marker.sizemax"),i("marker.border.color",r),i("marker.border.arearatio"),e._length=null}},{"../../lib":749,"./attributes":1141}],1144:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("../scatter3d/calc"),plot:t("./convert"),moduleType:"trace",name:"pointcloud",basePlotModule:t("../../plots/gl2d"),categories:["gl","gl2d","showLegend"],meta:{}}},{"../../plots/gl2d":837,"../scatter3d/calc":1183,"./attributes":1141,"./convert":1142,"./defaults":1143}],1145:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/attributes"),i=t("../../components/color/attributes"),o=t("../../components/fx/attributes"),s=t("../../plots/domain").attributes,l=t("../../plots/template_attributes").hovertemplateAttrs,c=t("../../components/colorscale/attributes"),u=t("../../plot_api/plot_template").templatedArray,h=t("../../lib/extend").extendFlat,f=t("../../plot_api/edit_types").overrideAll;t("../../constants/docs").FORMAT_LINK;(e.exports=f({hoverinfo:h({},a.hoverinfo,{flags:[],arrayOk:!1}),hoverlabel:o.hoverlabel,domain:s({name:"sankey",trace:!0}),orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s"},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:n({}),customdata:void 0,node:{label:{valType:"data_array",dflt:[]},groups:{valType:"info_array",impliedEdits:{x:[],y:[]},dimensions:2,freeLength:!0,dflt:[],items:{valType:"number",editType:"calc"}},x:{valType:"data_array",dflt:[]},y:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},customdata:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:i.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:.5,arrayOk:!0}},pad:{valType:"number",arrayOk:!1,min:0,dflt:20},thickness:{valType:"number",arrayOk:!1,min:1,dflt:20},hoverinfo:{valType:"enumerated",values:["all","none","skip"],dflt:"all"},hoverlabel:o.hoverlabel,hovertemplate:l({},{keys:["value","label"]})},link:{label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},customdata:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:i.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}},source:{valType:"data_array",dflt:[]},target:{valType:"data_array",dflt:[]},value:{valType:"data_array",dflt:[]},hoverinfo:{valType:"enumerated",values:["all","none","skip"],dflt:"all"},hoverlabel:o.hoverlabel,hovertemplate:l({},{keys:["value","label"]}),colorscales:u("concentrationscales",{editType:"calc",label:{valType:"string",editType:"calc",dflt:""},cmax:{valType:"number",editType:"calc",dflt:1},cmin:{valType:"number",editType:"calc",dflt:0},colorscale:h(c().colorscale,{dflt:[[0,"white"],[1,"black"]]})})}},"calc","nested")).transforms=void 0},{"../../components/color/attributes":614,"../../components/colorscale/attributes":622,"../../components/fx/attributes":646,"../../constants/docs":719,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plot_api/plot_template":787,"../../plots/attributes":794,"../../plots/domain":824,"../../plots/font_attributes":825,"../../plots/template_attributes":875}],1146:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll,a=t("../../plots/get_data").getModuleCalcData,i=t("./plot"),o=t("../../components/fx/layout_attributes"),s=t("../../lib/setcursor"),l=t("../../components/dragelement"),c=t("../../plots/cartesian/select").prepSelect,u=t("../../lib"),h=t("../../registry");function f(t,e){var r=t._fullData[e],n=t._fullLayout,a=n.dragmode,i="pan"===n.dragmode?"move":"crosshair",o=r._bgRect;if("pan"!==a&&"zoom"!==a){s(o,i);var f={_id:"x",c2p:u.identity,_offset:r._sankey.translateX,_length:r._sankey.width},p={_id:"y",c2p:u.identity,_offset:r._sankey.translateY,_length:r._sankey.height},d={gd:t,element:o.node(),plotinfo:{id:e,xaxis:f,yaxis:p,fillRangeItems:u.noop},subplot:e,xaxes:[f],yaxes:[p],doneFnCompleted:function(r){var n,a=t._fullData[e],i=a.node.groups.slice(),o=[];function s(t){for(var e=a._sankey.graph.nodes,r=0;ry&&(y=i.source[e]),i.target[e]>y&&(y=i.target[e]);var x,b=y+1;t.node._count=b;var _=t.node.groups,w={};for(e=0;e<_.length;e++){var T=_[e];for(x=0;x0&&s(E,b)&&s(C,b)&&(!w.hasOwnProperty(E)||!w.hasOwnProperty(C)||w[E]!==w[C])){w.hasOwnProperty(C)&&(C=w[C]),w.hasOwnProperty(E)&&(E=w[E]),C=+C,f[E=+E]=f[C]=!0;var L="";i.label&&i.label[e]&&(L=i.label[e]);var P=null;L&&p.hasOwnProperty(L)&&(P=p[L]),c.push({pointNumber:e,label:L,color:u?i.color[e]:i.color,customdata:h?i.customdata[e]:i.customdata,concentrationscale:P,source:E,target:C,value:+S}),A.source.push(E),A.target.push(C)}}var I=b+_.length,z=o(r.color),O=o(r.customdata),D=[];for(e=0;eb-1,childrenNodes:[],pointNumber:e,label:R,color:z?r.color[e]:r.color,customdata:O?r.customdata[e]:r.customdata})}var F=!1;return function(t,e,r){for(var i=a.init2dArray(t,0),o=0;o1}))}(I,A.source,A.target)&&(F=!0),{circular:F,links:c,nodes:D,groups:_,groupLookup:w}}e.exports=function(t,e){var r=c(e);return i({circular:r.circular,_nodes:r.nodes,_links:r.links,_groups:r.groups,_groupLookup:r.groupLookup})}},{"../../components/colorscale":627,"../../lib":749,"../../lib/gup":746,"strongly-connected-components":541}],1148:[function(t,e,r){"use strict";e.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeCapture:"node-capture",nodeCentered:"node-entered",nodeLabelGuide:"node-label-guide",nodeLabel:"node-label",nodeLabelTextPath:"node-label-text-path"}}},{}],1149:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),i=t("../../components/color"),o=t("tinycolor2"),s=t("../../plots/domain").defaults,l=t("../../components/fx/hoverlabel_defaults"),c=t("../../plot_api/plot_template"),u=t("../../plots/array_container_defaults");function h(t,e){function r(r,i){return n.coerce(t,e,a.link.colorscales,r,i)}r("label"),r("cmin"),r("cmax"),r("colorscale")}e.exports=function(t,e,r,f){function p(r,i){return n.coerce(t,e,a,r,i)}var d=n.extendDeep(f.hoverlabel,t.hoverlabel),g=t.node,m=c.newContainer(e,"node");function v(t,e){return n.coerce(g,m,a.node,t,e)}v("label"),v("groups"),v("x"),v("y"),v("pad"),v("thickness"),v("line.color"),v("line.width"),v("hoverinfo",t.hoverinfo),l(g,m,v,d),v("hovertemplate");var y=f.colorway;v("color",m.label.map((function(t,e){return i.addOpacity(function(t){return y[t%y.length]}(e),.8)}))),v("customdata");var x=t.link||{},b=c.newContainer(e,"link");function _(t,e){return n.coerce(x,b,a.link,t,e)}_("label"),_("source"),_("target"),_("value"),_("line.color"),_("line.width"),_("hoverinfo",t.hoverinfo),l(x,b,_,d),_("hovertemplate");var w,T=o(f.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)";_("color",n.repeat(T,b.value.length)),_("customdata"),u(x,b,{name:"colorscales",handleItemDefaults:h}),s(e,f,p),p("orientation"),p("valueformat"),p("valuesuffix"),m.x.length&&m.y.length&&(w="freeform"),p("arrangement",w),n.coerceFont(p,"textfont",n.extendFlat({},f.font)),e._length=null}},{"../../components/color":615,"../../components/fx/hoverlabel_defaults":653,"../../lib":749,"../../plot_api/plot_template":787,"../../plots/array_container_defaults":793,"../../plots/domain":824,"./attributes":1145,tinycolor2:548}],1150:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),moduleType:"trace",name:"sankey",basePlotModule:t("./base_plot"),selectPoints:t("./select.js"),categories:["noOpacity"],meta:{}}},{"./attributes":1145,"./base_plot":1146,"./calc":1147,"./defaults":1149,"./plot":1151,"./select.js":1153}],1151:[function(t,e,r){"use strict";var n=t("d3"),a=t("./render"),i=t("../../components/fx"),o=t("../../components/color"),s=t("../../lib"),l=t("./constants").cn,c=s._;function u(t){return""!==t}function h(t,e){return t.filter((function(t){return t.key===e.traceId}))}function f(t,e){n.select(t).select("path").style("fill-opacity",e),n.select(t).select("rect").style("fill-opacity",e)}function p(t){n.select(t).select("text.name").style("fill","black")}function d(t){return function(e){return-1!==t.node.sourceLinks.indexOf(e.link)||-1!==t.node.targetLinks.indexOf(e.link)}}function g(t){return function(e){return-1!==e.node.sourceLinks.indexOf(t.link)||-1!==e.node.targetLinks.indexOf(t.link)}}function m(t,e,r){e&&r&&h(r,e).selectAll("."+l.sankeyLink).filter(d(e)).call(y.bind(0,e,r,!1))}function v(t,e,r){e&&r&&h(r,e).selectAll("."+l.sankeyLink).filter(d(e)).call(x.bind(0,e,r,!1))}function y(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",(function(t){if(!t.link.concentrationscale)return.4})),a&&h(e,t).selectAll("."+l.sankeyLink).filter((function(t){return t.link.label===a})).style("fill-opacity",(function(t){if(!t.link.concentrationscale)return.4})),r&&h(e,t).selectAll("."+l.sankeyNode).filter(g(t)).call(m)}function x(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",(function(t){return t.tinyColorAlpha})),a&&h(e,t).selectAll("."+l.sankeyLink).filter((function(t){return t.link.label===a})).style("fill-opacity",(function(t){return t.tinyColorAlpha})),r&&h(e,t).selectAll(l.sankeyNode).filter(g(t)).call(v)}function b(t,e){var r=t.hoverlabel||{},n=s.nestedProperty(r,e).get();return!Array.isArray(n)&&n}e.exports=function(t,e){for(var r=t._fullLayout,s=r._paper,h=r._size,d=0;d"),color:b(s,"bgcolor")||o.addOpacity(d.color,1),borderColor:b(s,"bordercolor"),fontFamily:b(s,"font.family"),fontSize:b(s,"font.size"),fontColor:b(s,"font.color"),nameLength:b(s,"namelength"),textAlign:b(s,"align"),idealAlign:n.event.x"),color:b(o,"bgcolor")||a.tinyColorHue,borderColor:b(o,"bordercolor"),fontFamily:b(o,"font.family"),fontSize:b(o,"font.size"),fontColor:b(o,"font.color"),nameLength:b(o,"namelength"),textAlign:b(o,"align"),idealAlign:"left",hovertemplate:o.hovertemplate,hovertemplateLabels:v,eventData:[a.node]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t});f(y,.85),p(y)}}},unhover:function(e,a,o){!1!==t._fullLayout.hovermode&&(n.select(e).call(v,a,o),"skip"!==a.node.trace.node.hoverinfo&&(a.node.fullData=a.node.trace,t.emit("plotly_unhover",{event:n.event,points:[a.node]})),i.loneUnhover(r._hoverlayer.node()))},select:function(e,r,a){var o=r.node;o.originalEvent=n.event,t._hoverdata=[o],n.select(e).call(v,r,a),i.click(t,{target:!0})}}})}},{"../../components/color":615,"../../components/fx":655,"../../lib":749,"./constants":1148,"./render":1152,d3:169}],1152:[function(t,e,r){"use strict";var n=t("./constants"),a=t("d3"),i=t("tinycolor2"),o=t("../../components/color"),s=t("../../components/drawing"),l=t("@plotly/d3-sankey"),c=t("@plotly/d3-sankey-circular"),u=t("d3-force"),h=t("../../lib"),f=t("../../lib/gup"),p=f.keyFun,d=f.repeat,g=f.unwrap,m=t("d3-interpolate").interpolateNumber,v=t("../../registry");function y(t,e,r){var a,o=g(e),s=o.trace,u=s.domain,f="h"===s.orientation,p=s.node.pad,d=s.node.thickness,m=t.width*(u.x[1]-u.x[0]),v=t.height*(u.y[1]-u.y[0]),y=o._nodes,x=o._links,b=o.circular;(a=b?c.sankeyCircular().circularLinkGap(0):l.sankey()).iterations(n.sankeyIterations).size(f?[m,v]:[v,m]).nodeWidth(d).nodePadding(p).nodeId((function(t){return t.pointNumber})).nodes(y).links(x);var _,w,T,k=a();for(var M in a.nodePadding()=a||(r=a-e.y0)>1e-6&&(e.y0+=r,e.y1+=r),a=e.y1+p}))}(function(t){var e,r,n=t.map((function(t,e){return{x0:t.x0,index:e}})).sort((function(t,e){return t.x0-e.x0})),a=[],i=-1,o=-1/0;for(_=0;_o+d&&(i+=1,e=s.x0),o=s.x0,a[i]||(a[i]=[]),a[i].push(s),r=e-s.x0,s.x0+=r,s.x1+=r}return a}(y=k.nodes));a.update(k)}return{circular:b,key:r,trace:s,guid:h.randstr(),horizontal:f,width:m,height:v,nodePad:s.node.pad,nodeLineColor:s.node.line.color,nodeLineWidth:s.node.line.width,linkLineColor:s.link.line.color,linkLineWidth:s.link.line.width,valueFormat:s.valueformat,valueSuffix:s.valuesuffix,textFont:s.textfont,translateX:u.x[0]*t.width+t.margin.l,translateY:t.height-u.y[1]*t.height+t.margin.t,dragParallel:f?v:m,dragPerpendicular:f?m:v,arrangement:s.arrangement,sankey:a,graph:k,forceLayouts:{},interactionState:{dragInProgress:!1,hovered:!1}}}function x(t,e,r){var n=i(e.color),a=e.source.label+"|"+e.target.label+"__"+r;return e.trace=t.trace,e.curveNumber=t.trace.index,{circular:t.circular,key:a,traceId:t.key,pointNumber:e.pointNumber,link:e,tinyColorHue:o.tinyRGB(n),tinyColorAlpha:n.getAlpha(),linkPath:b,linkLineColor:t.linkLineColor,linkLineWidth:t.linkLineWidth,valueFormat:t.valueFormat,valueSuffix:t.valueSuffix,sankey:t.sankey,parent:t,interactionState:t.interactionState,flow:e.flow}}function b(){return function(t){if(t.link.circular)return e=t.link,r=e.width/2,n=e.circularPathData,"top"===e.circularLinkType?"M "+n.targetX+" "+(n.targetY+r)+" L"+n.rightInnerExtent+" "+(n.targetY+r)+"A"+(n.rightLargeArcRadius+r)+" "+(n.rightSmallArcRadius+r)+" 0 0 1 "+(n.rightFullExtent-r)+" "+(n.targetY-n.rightSmallArcRadius)+"L"+(n.rightFullExtent-r)+" "+n.verticalRightInnerExtent+"A"+(n.rightLargeArcRadius+r)+" "+(n.rightLargeArcRadius+r)+" 0 0 1 "+n.rightInnerExtent+" "+(n.verticalFullExtent-r)+"L"+n.leftInnerExtent+" "+(n.verticalFullExtent-r)+"A"+(n.leftLargeArcRadius+r)+" "+(n.leftLargeArcRadius+r)+" 0 0 1 "+(n.leftFullExtent+r)+" "+n.verticalLeftInnerExtent+"L"+(n.leftFullExtent+r)+" "+(n.sourceY-n.leftSmallArcRadius)+"A"+(n.leftLargeArcRadius+r)+" "+(n.leftSmallArcRadius+r)+" 0 0 1 "+n.leftInnerExtent+" "+(n.sourceY+r)+"L"+n.sourceX+" "+(n.sourceY+r)+"L"+n.sourceX+" "+(n.sourceY-r)+"L"+n.leftInnerExtent+" "+(n.sourceY-r)+"A"+(n.leftLargeArcRadius-r)+" "+(n.leftSmallArcRadius-r)+" 0 0 0 "+(n.leftFullExtent-r)+" "+(n.sourceY-n.leftSmallArcRadius)+"L"+(n.leftFullExtent-r)+" "+n.verticalLeftInnerExtent+"A"+(n.leftLargeArcRadius-r)+" "+(n.leftLargeArcRadius-r)+" 0 0 0 "+n.leftInnerExtent+" "+(n.verticalFullExtent+r)+"L"+n.rightInnerExtent+" "+(n.verticalFullExtent+r)+"A"+(n.rightLargeArcRadius-r)+" "+(n.rightLargeArcRadius-r)+" 0 0 0 "+(n.rightFullExtent+r)+" "+n.verticalRightInnerExtent+"L"+(n.rightFullExtent+r)+" "+(n.targetY-n.rightSmallArcRadius)+"A"+(n.rightLargeArcRadius-r)+" "+(n.rightSmallArcRadius-r)+" 0 0 0 "+n.rightInnerExtent+" "+(n.targetY-r)+"L"+n.targetX+" "+(n.targetY-r)+"Z":"M "+n.targetX+" "+(n.targetY-r)+" L"+n.rightInnerExtent+" "+(n.targetY-r)+"A"+(n.rightLargeArcRadius+r)+" "+(n.rightSmallArcRadius+r)+" 0 0 0 "+(n.rightFullExtent-r)+" "+(n.targetY+n.rightSmallArcRadius)+"L"+(n.rightFullExtent-r)+" "+n.verticalRightInnerExtent+"A"+(n.rightLargeArcRadius+r)+" "+(n.rightLargeArcRadius+r)+" 0 0 0 "+n.rightInnerExtent+" "+(n.verticalFullExtent+r)+"L"+n.leftInnerExtent+" "+(n.verticalFullExtent+r)+"A"+(n.leftLargeArcRadius+r)+" "+(n.leftLargeArcRadius+r)+" 0 0 0 "+(n.leftFullExtent+r)+" "+n.verticalLeftInnerExtent+"L"+(n.leftFullExtent+r)+" "+(n.sourceY+n.leftSmallArcRadius)+"A"+(n.leftLargeArcRadius+r)+" "+(n.leftSmallArcRadius+r)+" 0 0 0 "+n.leftInnerExtent+" "+(n.sourceY-r)+"L"+n.sourceX+" "+(n.sourceY-r)+"L"+n.sourceX+" "+(n.sourceY+r)+"L"+n.leftInnerExtent+" "+(n.sourceY+r)+"A"+(n.leftLargeArcRadius-r)+" "+(n.leftSmallArcRadius-r)+" 0 0 1 "+(n.leftFullExtent-r)+" "+(n.sourceY+n.leftSmallArcRadius)+"L"+(n.leftFullExtent-r)+" "+n.verticalLeftInnerExtent+"A"+(n.leftLargeArcRadius-r)+" "+(n.leftLargeArcRadius-r)+" 0 0 1 "+n.leftInnerExtent+" "+(n.verticalFullExtent-r)+"L"+n.rightInnerExtent+" "+(n.verticalFullExtent-r)+"A"+(n.rightLargeArcRadius-r)+" "+(n.rightLargeArcRadius-r)+" 0 0 1 "+(n.rightFullExtent+r)+" "+n.verticalRightInnerExtent+"L"+(n.rightFullExtent+r)+" "+(n.targetY+n.rightSmallArcRadius)+"A"+(n.rightLargeArcRadius-r)+" "+(n.rightSmallArcRadius-r)+" 0 0 1 "+n.rightInnerExtent+" "+(n.targetY+r)+"L"+n.targetX+" "+(n.targetY+r)+"Z";var e,r,n,a=t.link.source.x1,i=t.link.target.x0,o=m(a,i),s=o(.5),l=o(.5),c=t.link.y0-t.link.width/2,u=t.link.y0+t.link.width/2,h=t.link.y1-t.link.width/2,f=t.link.y1+t.link.width/2;return"M"+a+","+c+"C"+s+","+c+" "+l+","+h+" "+i+","+h+"L"+i+","+f+"C"+l+","+f+" "+s+","+u+" "+a+","+u+"Z"}}function _(t,e){var r=i(e.color),a=n.nodePadAcross,s=t.nodePad/2;e.dx=e.x1-e.x0,e.dy=e.y1-e.y0;var l=e.dx,c=Math.max(.5,e.dy),u="node_"+e.pointNumber;return e.group&&(u=h.randstr()),e.trace=t.trace,e.curveNumber=t.trace.index,{index:e.pointNumber,key:u,partOfGroup:e.partOfGroup||!1,group:e.group,traceId:t.key,trace:t.trace,node:e,nodePad:t.nodePad,nodeLineColor:t.nodeLineColor,nodeLineWidth:t.nodeLineWidth,textFont:t.textFont,size:t.horizontal?t.height:t.width,visibleWidth:Math.ceil(l),visibleHeight:c,zoneX:-a,zoneY:-s,zoneWidth:l+2*a,zoneHeight:c+2*s,labelY:t.horizontal?e.dy/2+1:e.dx/2+1,left:1===e.originalLayer,sizeAcross:t.width,forceLayouts:t.forceLayouts,horizontal:t.horizontal,darkBackground:r.getBrightness()<=128,tinyColorHue:o.tinyRGB(r),tinyColorAlpha:r.getAlpha(),valueFormat:t.valueFormat,valueSuffix:t.valueSuffix,sankey:t.sankey,graph:t.graph,arrangement:t.arrangement,uniqueNodeLabelPathId:[t.guid,t.key,u].join("_"),interactionState:t.interactionState,figure:t}}function w(t){t.attr("transform",(function(t){return"translate("+t.node.x0.toFixed(3)+", "+t.node.y0.toFixed(3)+")"}))}function T(t){t.call(w)}function k(t,e){t.call(T),e.attr("d",b())}function M(t){t.attr("width",(function(t){return t.node.x1-t.node.x0})).attr("height",(function(t){return t.visibleHeight}))}function A(t){return t.link.width>1||t.linkLineWidth>0}function S(t){return"translate("+t.translateX+","+t.translateY+")"+(t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function E(t){return"translate("+(t.horizontal?0:t.labelY)+" "+(t.horizontal?t.labelY:0)+")"}function C(t){return a.svg.line()([[t.horizontal?t.left?-t.sizeAcross:t.visibleWidth+n.nodeTextOffsetHorizontal:n.nodeTextOffsetHorizontal,0],[t.horizontal?t.left?-n.nodeTextOffsetHorizontal:t.sizeAcross:t.visibleHeight-n.nodeTextOffsetHorizontal,0]])}function L(t){return t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)"}function P(t){return t.horizontal?"scale(1 1)":"scale(-1 1)"}function I(t){return t.darkBackground&&!t.horizontal?"rgb(255,255,255)":"rgb(0,0,0)"}function z(t){return t.horizontal&&t.left?"100%":"0%"}function O(t,e,r){t.on(".basic",null).on("mouseover.basic",(function(t){t.interactionState.dragInProgress||t.partOfGroup||(r.hover(this,t,e),t.interactionState.hovered=[this,t])})).on("mousemove.basic",(function(t){t.interactionState.dragInProgress||t.partOfGroup||(r.follow(this,t),t.interactionState.hovered=[this,t])})).on("mouseout.basic",(function(t){t.interactionState.dragInProgress||t.partOfGroup||(r.unhover(this,t,e),t.interactionState.hovered=!1)})).on("click.basic",(function(t){t.interactionState.hovered&&(r.unhover(this,t,e),t.interactionState.hovered=!1),t.interactionState.dragInProgress||t.partOfGroup||r.select(this,t,e)}))}function D(t,e,r,i){var o=a.behavior.drag().origin((function(t){return{x:t.node.x0+t.visibleWidth/2,y:t.node.y0+t.visibleHeight/2}})).on("dragstart",(function(a){if("fixed"!==a.arrangement&&(h.ensureSingle(i._fullLayout._infolayer,"g","dragcover",(function(t){i._fullLayout._dragCover=t})),h.raiseToTop(this),a.interactionState.dragInProgress=a.node,F(a.node),a.interactionState.hovered&&(r.nodeEvents.unhover.apply(0,a.interactionState.hovered),a.interactionState.hovered=!1),"snap"===a.arrangement)){var o=a.traceId+"|"+a.key;a.forceLayouts[o]?a.forceLayouts[o].alpha(1):function(t,e,r,a){!function(t){for(var e=0;e0&&a.forceLayouts[e].alpha(0)}}(0,e,i,r)).stop()}(0,o,a),function(t,e,r,a,i){window.requestAnimationFrame((function o(){var s;for(s=0;s0)window.requestAnimationFrame(o);else{var l=r.node.originalX;r.node.x0=l-r.visibleWidth/2,r.node.x1=l+r.visibleWidth/2,R(r,i)}}))}(t,e,a,o,i)}})).on("drag",(function(r){if("fixed"!==r.arrangement){var n=a.event.x,i=a.event.y;"snap"===r.arrangement?(r.node.x0=n-r.visibleWidth/2,r.node.x1=n+r.visibleWidth/2,r.node.y0=i-r.visibleHeight/2,r.node.y1=i+r.visibleHeight/2):("freeform"===r.arrangement&&(r.node.x0=n-r.visibleWidth/2,r.node.x1=n+r.visibleWidth/2),i=Math.max(0,Math.min(r.size-r.visibleHeight/2,i)),r.node.y0=i-r.visibleHeight/2,r.node.y1=i+r.visibleHeight/2),F(r.node),"snap"!==r.arrangement&&(r.sankey.update(r.graph),k(t.filter(B(r)),e))}})).on("dragend",(function(t){if("fixed"!==t.arrangement){t.interactionState.dragInProgress=!1;for(var e=0;e5?t.node.label:""})).attr("text-anchor",(function(t){return t.horizontal&&t.left?"end":"start"})),q.transition().ease(n.ease).duration(n.duration).attr("startOffset",z).style("fill",I)}},{"../../components/color":615,"../../components/drawing":637,"../../lib":749,"../../lib/gup":746,"../../registry":880,"./constants":1148,"@plotly/d3-sankey":56,"@plotly/d3-sankey-circular":55,d3:169,"d3-force":160,"d3-interpolate":162,tinycolor2:548}],1153:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=[],n=t.cd[0].trace,a=n._sankey.graph.nodes,i=0;is&&M[m].gap;)m--;for(y=M[m].s,d=M.length-1;d>m;d--)M[d].s=y;for(;sA[u]&&u=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],1162:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("./attributes"),o=t("./constants"),s=t("./subtypes"),l=t("./xy_defaults"),c=t("./stack_defaults"),u=t("./marker_defaults"),h=t("./line_defaults"),f=t("./line_shape_defaults"),p=t("./text_defaults"),d=t("./fillcolor_defaults");e.exports=function(t,e,r,g){function m(r,a){return n.coerce(t,e,i,r,a)}var v=l(t,e,g,m);if(v||(e.visible=!1),e.visible){var y=c(t,e,g,m),x=!y&&vG!=(F=I[L][1])>=G&&(O=I[L-1][0],D=I[L][0],F-R&&(z=O+(D-O)*(G-R)/(F-R),U=Math.min(U,z),V=Math.max(V,z)));U=Math.max(U,0),V=Math.min(V,f._length);var Y=s.defaultLine;return s.opacity(h.fillcolor)?Y=h.fillcolor:s.opacity((h.line||{}).color)&&(Y=h.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:U,x1:V,y0:G,y1:G,color:Y,hovertemplate:!1}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":615,"../../components/fx":655,"../../lib":749,"../../registry":880,"./get_trace_color":1165}],1167:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":810,"./arrays_to_calcdata":1154,"./attributes":1155,"./calc":1156,"./cross_trace_calc":1160,"./cross_trace_defaults":1161,"./defaults":1162,"./format_labels":1164,"./hover":1166,"./marker_colorbar":1173,"./plot":1175,"./select":1176,"./style":1178,"./subtypes":1179}],1168:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s,l){var c=(t.marker||{}).color;(s("line.color",r),a(t,"line"))?i(t,e,o,s,{prefix:"line.",cLetter:"c"}):s("line.color",!n(c)&&c||r);s("line.width"),(l||{}).noDash||s("line.dash")}},{"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"../../lib":749}],1169:[function(t,e,r){"use strict";var n=t("../../constants/numerical"),a=n.BADNUM,i=n.LOG_CLIP,o=i+.5,s=i-.5,l=t("../../lib"),c=l.segmentsIntersect,u=l.constrain,h=t("./constants");e.exports=function(t,e){var r,n,i,f,p,d,g,m,v,y,x,b,_,w,T,k,M,A,S=e.xaxis,E=e.yaxis,C="log"===S.type,L="log"===E.type,P=S._length,I=E._length,z=e.connectGaps,O=e.baseTolerance,D=e.shape,R="linear"===D,F=e.fill&&"none"!==e.fill,B=[],N=h.minTolerance,j=t.length,U=new Array(j),V=0;function q(r){var n=t[r];if(!n)return!1;var i=e.linearized?S.l2p(n.x):S.c2p(n.x),l=e.linearized?E.l2p(n.y):E.c2p(n.y);if(i===a){if(C&&(i=S.c2p(n.x,!0)),i===a)return!1;L&&l===a&&(i*=Math.abs(S._m*I*(S._m>0?o:s)/(E._m*P*(E._m>0?o:s)))),i*=1e3}if(l===a){if(L&&(l=E.c2p(n.y,!0)),l===a)return!1;l*=1e3}return[i,l]}function H(t,e,r,n){var a=r-t,i=n-e,o=.5-t,s=.5-e,l=a*a+i*i,c=a*o+i*s;if(c>0&&crt||t[1]at)return[u(t[0],et,rt),u(t[1],nt,at)]}function st(t,e){return t[0]===e[0]&&(t[0]===et||t[0]===rt)||(t[1]===e[1]&&(t[1]===nt||t[1]===at)||void 0)}function lt(t,e,r){return function(n,a){var i=ot(n),o=ot(a),s=[];if(i&&o&&st(i,o))return s;i&&s.push(i),o&&s.push(o);var c=2*l.constrain((n[t]+a[t])/2,e,r)-((i||n)[t]+(o||a)[t]);c&&((i&&o?c>0==i[t]>o[t]?i:o:i||o)[t]+=c);return s}}function ct(t){var e=t[0],r=t[1],n=e===U[V-1][0],a=r===U[V-1][1];if(!n||!a)if(V>1){var i=e===U[V-2][0],o=r===U[V-2][1];n&&(e===et||e===rt)&&i?o?V--:U[V-1]=t:a&&(r===nt||r===at)&&o?i?V--:U[V-1]=t:U[V++]=t}else U[V++]=t}function ut(t){U[V-1][0]!==t[0]&&U[V-1][1]!==t[1]&&ct([X,J]),ct(t),K=null,X=J=0}function ht(t){if(M=t[0]/P,A=t[1]/I,W=t[0]rt?rt:0,Z=t[1]at?at:0,W||Z){if(V)if(K){var e=$(K,t);e.length>1&&(ut(e[0]),U[V++]=e[1])}else Q=$(U[V-1],t)[0],U[V++]=Q;else U[V++]=[W||t[0],Z||t[1]];var r=U[V-1];W&&Z&&(r[0]!==W||r[1]!==Z)?(K&&(X!==W&&J!==Z?ct(X&&J?(n=K,i=(a=t)[0]-n[0],o=(a[1]-n[1])/i,(n[1]*a[0]-a[1]*n[0])/i>0?[o>0?et:rt,at]:[o>0?rt:et,nt]):[X||W,J||Z]):X&&J&&ct([X,J])),ct([W,Z])):X-W&&J-Z&&ct([W||X,Z||J]),K=t,X=W,J=Z}else K&&ut($(K,t)[0]),U[V++]=t;var n,a,i,o}for("linear"===D||"spline"===D?$=function(t,e){for(var r=[],n=0,a=0;a<4;a++){var i=it[a],o=c(t[0],t[1],e[0],e[1],i[0],i[1],i[2],i[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&&Y(o,t)G(d,ft))break;i=d,(_=v[0]*m[0]+v[1]*m[1])>x?(x=_,f=d,g=!1):_=t.length||!d)break;ht(d),n=d}}else ht(f)}K&&ct([X||K[0],J||K[1]]),B.push(U.slice(0,V))}return B}},{"../../constants/numerical":724,"../../lib":749,"./constants":1159}],1170:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],1171:[function(t,e,r){"use strict";var n={tonextx:1,tonexty:1,tonext:1};e.exports=function(t,e,r){var a,i,o,s,l,c={},u=!1,h=-1,f=0,p=-1;for(i=0;i=0?l=p:(l=p=f,f++),l0?Math.max(e,a):0}}},{"fast-isnumeric":241}],1173:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],1174:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,i=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,c){var u=o.isBubble(t),h=(t.line||{}).color;(c=c||{},h&&(r=h),l("marker.symbol"),l("marker.opacity",u?.7:1),l("marker.size"),l("marker.color",r),a(t,"marker")&&i(t,e,s,l,{prefix:"marker.",cLetter:"c"}),c.noSelect||(l("selected.marker.color"),l("unselected.marker.color"),l("selected.marker.size"),l("unselected.marker.size")),c.noLine||(l("marker.line.color",h&&!Array.isArray(h)&&e.marker.color!==h?h:u?n.background:n.defaultLine),a(t,"marker.line")&&i(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",u?1:0)),u&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),c.gradient)&&("none"!==l("marker.gradient.type")&&l("marker.gradient.color"))}},{"../../components/color":615,"../../components/colorscale/defaults":625,"../../components/colorscale/helpers":626,"./subtypes":1179}],1175:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../registry"),i=t("../../lib"),o=i.ensureSingle,s=i.identity,l=t("../../components/drawing"),c=t("./subtypes"),u=t("./line_points"),h=t("./link_traces"),f=t("../../lib/polygon").tester;function p(t,e,r,h,p,d,g){var m;!function(t,e,r,a,o){var s=r.xaxis,l=r.yaxis,u=n.extent(i.simpleMap(s.range,s.r2c)),h=n.extent(i.simpleMap(l.range,l.r2c)),f=a[0].trace;if(!c.hasMarkers(f))return;var p=f.marker.maxdisplayed;if(0===p)return;var d=a.filter((function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=h[0]&&t.y<=h[1]})),g=Math.ceil(d.length/p),m=0;o.forEach((function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(t){return v?t.transition():t}var x=r.xaxis,b=r.yaxis,_=h[0].trace,w=_.line,T=n.select(d),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),S=o(T,"g","text");if(a.getComponentMethod("errorbars","plot")(t,k,r,g),!0===_.visible){var E,C;y(T).style("opacity",_.opacity);var L=_.fill.charAt(_.fill.length-1);"x"!==L&&"y"!==L&&(L=""),h[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var P,I,z="",O=[],D=_._prevtrace;D&&(z=D._prevRevpath||"",C=D._nextFill,O=D._polygons);var R,F,B,N,j,U,V,q="",H="",G=[],Y=i.noop;if(E=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(h),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(R=l.steps(w.shape),F=l.steps(w.shape.split("").reverse().join(""))):R=F="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")},B=function(t){return F(t.reverse())},G=u(h,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),V=_._polygons=new Array(G.length),m=0;m1){var r=n.select(this);if(r.datum(h),t)y(r.style("opacity",0).attr("d",P).call(l.lineGroupStyle)).style("opacity",1);else{var a=y(r);a.attr("d",P),l.singleLineStyle(h,a)}}}}}var W=M.selectAll(".js-line").data(G);y(W.exit()).style("opacity",0).remove(),W.each(Y(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Y(!0)),l.setClipUrl(W,r.layerClipId,t),G.length?(E?(E.datum(h),N&&U&&(L?("y"===L?N[1]=U[1]=b.c2p(0,!0):"x"===L&&(N[0]=U[0]=x.c2p(0,!0)),y(E).attr("d","M"+U+"L"+N+"L"+q.substr(1)).call(l.singleFillStyle)):y(E).attr("d",q+"Z").call(l.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&q&&z?("tonext"===_.fill?y(C).attr("d",q+"Z"+z+"Z").call(l.singleFillStyle):y(C).attr("d",q+"L"+z.substr(1)+"Z").call(l.singleFillStyle),_._polygons=_._polygons.concat(O)):(X(C),_._polygons=null)),_._prevRevpath=H,_._prevPolygons=V):(E?X(E):C&&X(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(h),S.datum(h),function(e,a,i){var o,u=i[0].trace,h=c.hasMarkers(u),f=c.hasText(u),p=tt(u),d=et,g=et;if(h||f){var m=s,_=u.stackgroup,w=_&&"infer zero"===t._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?m=w?K:J:_&&!w&&(m=Q),h&&(d=m),f&&(g=m)}var T,k=(o=e.selectAll("path.point").data(d,p)).enter().append("path").classed("point",!0);v&&k.call(l.pointStyle,u,t).call(l.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),h&&(T=l.makePointStyleFns(u)),o.each((function(e){var a=n.select(this),i=y(a);l.translatePoint(e,i,x,b)?(l.singlePointStyle(e,i,u,T,t),r.layerClipId&&l.hideOutsideRangePoint(e,i,x,b,u.xcalendar,u.ycalendar),u.customdata&&a.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):i.remove()})),v?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=a.selectAll("g").data(g,p)).enter().append("g").classed("textpoint",!0).append("text"),o.order(),o.each((function(t){var e=n.select(this),a=y(e.select("text"));l.translatePoint(t,a,x,b)?r.layerClipId&&l.hideOutsideRangePoint(t,e,x,b,u.xcalendar,u.ycalendar):e.remove()})),o.selectAll("text").call(l.textPointStyle,u,t).each((function(t){var e=x.c2p(t.x),r=b.c2p(t.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:e,y:r})}))})),o.exit().remove()}(A,S,h);var Z=!1===_.cliponaxis?null:r.layerClipId;l.setClipUrl(A,Z,t),l.setClipUrl(S,Z,t)}function X(t){y(t).attr("d","M0,0Z")}function J(t){return t.filter((function(t){return!t.gap&&t.vis}))}function K(t){return t.filter((function(t){return t.vis}))}function Q(t){return t.filter((function(t){return!t.gap}))}function $(t){return t.id}function tt(t){if(t.ids)return $}function et(){return!1}}e.exports=function(t,e,r,a,i,c){var u,f,d=!i,g=!!i&&i.duration>0,m=h(t,e,r);((u=a.selectAll("g.trace").data(m,(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.order(),function(t,e,r){e.each((function(e){var a=o(n.select(this),"g","fills");l.setClipUrl(a,r.layerClipId,t);var i=e[0].trace,c=[];i._ownfill&&c.push("_ownFill"),i._nexttrace&&c.push("_nextFill");var u=a.selectAll("g").data(c,s);u.enter().append("g"),u.exit().each((function(t){i[t]=null})).remove(),u.order().each((function(t){i[t]=o(n.select(this),"path","js-fill")}))}))}(t,u,e),g)?(c&&(f=c()),n.transition().duration(i.duration).ease(i.easing).each("end",(function(){f&&f()})).each("interrupt",(function(){f&&f()})).each((function(){a.selectAll("g.trace").each((function(r,n){p(t,n,e,r,m,this,i)}))}))):u.each((function(r,n){p(t,n,e,r,m,this,i)}));d&&u.exit().remove(),a.selectAll("path:not([d])").remove()}},{"../../components/drawing":637,"../../lib":749,"../../lib/polygon":761,"../../registry":880,"./line_points":1169,"./link_traces":1171,"./subtypes":1179,d3:169}],1176:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,i,o,s=t.cd,l=t.xaxis,c=t.yaxis,u=[],h=s[0].trace;if(!n.hasMarkers(h)&&!n.hasText(h))return[];if(!1===e)for(r=0;r0){var f=a.c2l(u);a._lowerLogErrorBound||(a._lowerLogErrorBound=f),a._lowerErrorBound=Math.min(a._lowerLogErrorBound,f)}}else o[s]=[-l[0]*r,l[1]*r]}return o}e.exports=function(t,e,r){var n=[a(t.x,t.error_x,e[0],r.xaxis),a(t.y,t.error_y,e[1],r.yaxis),a(t.z,t.error_z,e[2],r.zaxis)],i=function(t){for(var e=0;e-1?-1:t.indexOf("right")>-1?1:0}function b(t){return null==t?0:t.indexOf("top")>-1?-1:t.indexOf("bottom")>-1?1:0}function _(t,e){return e(4*t)}function w(t){return p[t]}function T(t,e,r,n,a){var i=null;if(l.isArrayOrTypedArray(t)){i=[];for(var o=0;o=0){var g=function(t,e,r){var n,a=(r+1)%3,i=(r+2)%3,o=[],l=[];for(n=0;n=0&&h("surfacecolor",f||p);for(var d=["x","y","z"],g=0;g<3;++g){var m="projection."+d[g];h(m+".show")&&(h(m+".opacity"),h(m+".scale"))}var v=n.getComponentMethod("errorbars","supplyDefaults");v(t,e,f||p||r,{axis:"z"}),v(t,e,f||p||r,{axis:"y",inherit:"z"}),v(t,e,f||p||r,{axis:"x",inherit:"z"})}else e.visible=!1}},{"../../lib":749,"../../registry":880,"../scatter/line_defaults":1168,"../scatter/marker_defaults":1174,"../scatter/subtypes":1179,"../scatter/text_defaults":1180,"./attributes":1182}],1187:[function(t,e,r){"use strict";e.exports={plot:t("./convert"),attributes:t("./attributes"),markerSymbols:t("../../constants/gl3d_markers"),supplyDefaults:t("./defaults"),colorbar:[{container:"marker",min:"cmin",max:"cmax"},{container:"line",min:"cmin",max:"cmax"}],calc:t("./calc"),moduleType:"trace",name:"scatter3d",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","symbols","showLegend","scatter-like"],meta:{}}},{"../../constants/gl3d_markers":722,"../../plots/gl3d":839,"./attributes":1182,"./calc":1183,"./convert":1185,"./defaults":1186}],1188:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../plots/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../../plots/template_attributes").texttemplateAttrs,s=t("../../components/colorscale/attributes"),l=t("../../lib/extend").extendFlat,c=n.marker,u=n.line,h=c.line;e.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:l({},n.mode,{dflt:"markers"}),text:l({},n.text,{}),texttemplate:o({editType:"plot"},{keys:["a","b","text"]}),hovertext:l({},n.hovertext,{}),line:{color:u.color,width:u.width,dash:u.dash,shape:l({},u.shape,{values:["linear","spline"]}),smoothing:u.smoothing,editType:"calc"},connectgaps:n.connectgaps,fill:l({},n.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:n.fillcolor,marker:l({symbol:c.symbol,opacity:c.opacity,maxdisplayed:c.maxdisplayed,size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,line:l({width:h.width,editType:"calc"},s("marker.line")),gradient:c.gradient,editType:"calc"},s("marker")),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:l({},a.hoverinfo,{flags:["a","b","text","name"]}),hoveron:n.hoveron,hovertemplate:i()}},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1189:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../scatter/colorscale_calc"),i=t("../scatter/arrays_to_calcdata"),o=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize,l=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e._carpetTrace=l(t,e);if(r&&r.visible&&"legendonly"!==r.visible){var c;e.xaxis=r.xaxis,e.yaxis=r.yaxis;var u,h,f=e._length,p=new Array(f),d=!1;for(c=0;c")}return o}function y(t,e){var r;r=t.labelprefix&&t.labelprefix.length>0?t.labelprefix.replace(/ = $/,""):t._hovertitle,m.push(r+": "+e.toFixed(3)+t.labelsuffix)}}},{"../../lib":749,"../scatter/hover":1166}],1194:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../scatter/select"),eventData:t("./event_data"),moduleType:"trace",name:"scattercarpet",basePlotModule:t("../../plots/cartesian"),categories:["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"],meta:{}}},{"../../plots/cartesian":810,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1188,"./calc":1189,"./defaults":1190,"./event_data":1191,"./format_labels":1192,"./hover":1193,"./plot":1195}],1195:[function(t,e,r){"use strict";var n=t("../scatter/plot"),a=t("../../plots/cartesian/axes"),i=t("../../components/drawing");e.exports=function(t,e,r,o){var s,l,c,u=r[0][0].carpet,h={xaxis:a.getFromId(t,u.xaxis||"x"),yaxis:a.getFromId(t,u.yaxis||"y"),plot:e.plot};for(n(t,h,r,o),s=0;s")}(c,g,t,l[0].t.labels),t.hovertemplate=c.hovertemplate,[t]}}},{"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../scatter/get_trace_color":1165,"./attributes":1196}],1202:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),calcGeoJSON:t("./plot").calcGeoJSON,plot:t("./plot").plot,style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"scattergeo",basePlotModule:t("../../plots/geo"),categories:["geo","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/geo":829,"../scatter/marker_colorbar":1173,"../scatter/style":1178,"./attributes":1196,"./calc":1197,"./defaults":1198,"./event_data":1199,"./format_labels":1200,"./hover":1201,"./plot":1203,"./select":1204,"./style":1205}],1203:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../lib/topojson_utils").getTopojsonFeatures,o=t("../../lib/geojson_utils"),s=t("../../lib/geo_location_utils"),l=t("../../plots/cartesian/autorange").findExtremes,c=t("../../constants/numerical").BADNUM,u=t("../scatter/calc").calcMarkerSize,h=t("../scatter/subtypes"),f=t("./style");e.exports={calcGeoJSON:function(t,e){var r,n,a=t[0].trace,o=e[a.geo],h=o._subplot,f=a._length;if(Array.isArray(a.locations)){var p=a.locationmode,d="geojson-id"===p?s.extractTraceFeature(t):i(a,h.topojson);for(r=0;r=g,T=2*_,k={},M=e._x=y.makeCalcdata(e,"x"),A=e._y=x.makeCalcdata(e,"y"),S=new Array(T);for(r=0;r<_;r++)o=M[r],s=A[r],S[2*r]=o===d?NaN:o,S[2*r+1]=s===d?NaN:s;if("log"===y.type)for(r=0;r1&&a.extendFlat(s.line,f.linePositions(t,r,n));if(s.errorX||s.errorY){var l=f.errorBarPositions(t,r,n,i,o);s.errorX&&a.extendFlat(s.errorX,l.x),s.errorY&&a.extendFlat(s.errorY,l.y)}s.text&&(a.extendFlat(s.text,{positions:n},f.textPosition(t,r,s.text,s.marker)),a.extendFlat(s.textSel,{positions:n},f.textPosition(t,r,s.text,s.markerSel)),a.extendFlat(s.textUnsel,{positions:n},f.textPosition(t,r,s.text,s.markerUnsel)));return s}(t,0,e,S,M,A),P=p(t,b);return u(v,e),w?L.marker&&(C=2*(L.marker.sizeAvg||Math.max(L.marker.size,3))):C=l(e,_),c(t,e,y,x,M,A,C),L.errorX&&m(e,y,L.errorX),L.errorY&&m(e,x,L.errorY),L.fill&&!P.fill2d&&(P.fill2d=!0),L.marker&&!P.scatter2d&&(P.scatter2d=!0),L.line&&!P.line2d&&(P.line2d=!0),!L.errorX&&!L.errorY||P.error2d||(P.error2d=!0),L.text&&!P.glText&&(P.glText=!0),L.marker&&(L.marker.snap=_),P.lineOptions.push(L.line),P.errorXOptions.push(L.errorX),P.errorYOptions.push(L.errorY),P.fillOptions.push(L.fill),P.markerOptions.push(L.marker),P.markerSelectedOptions.push(L.markerSel),P.markerUnselectedOptions.push(L.markerUnsel),P.textOptions.push(L.text),P.textSelectedOptions.push(L.textSel),P.textUnselectedOptions.push(L.textUnsel),P.selectBatch.push([]),P.unselectBatch.push([]),k._scene=P,k.index=P.count,k.x=M,k.y=A,k.positions=S,P.count++,[{x:!1,y:!1,t:k,trace:e}]}},{"../../constants/numerical":724,"../../lib":749,"../../plots/cartesian/autorange":796,"../../plots/cartesian/axis_ids":800,"../scatter/calc":1156,"../scatter/colorscale_calc":1158,"./constants":1208,"./convert":1209,"./scene_update":1217,"@plotly/point-cluster":57}],1208:[function(t,e,r){"use strict";e.exports={TOO_MANY_POINTS:1e5,SYMBOL_SDF_SIZE:200,SYMBOL_SIZE:20,SYMBOL_STROKE:1,DOT_RE:/-dot/,OPEN_RE:/-open/,DASHES:{solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}}},{}],1209:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("svg-path-sdf"),i=t("color-normalize"),o=t("../../registry"),s=t("../../lib"),l=t("../../components/drawing"),c=t("../../plots/cartesian/axis_ids"),u=t("../../lib/gl_format_color").formatColor,h=t("../scatter/subtypes"),f=t("../scatter/make_bubble_size_func"),p=t("./helpers"),d=t("./constants"),g=t("../../constants/interactions").DESELECTDIM,m={start:1,left:1,end:-1,right:-1,middle:0,center:0,bottom:1,top:-1},v=t("../../components/fx/helpers").appendArrayPointValue;function y(t,e){var r,a=t._fullLayout,i=e._length,o=e.textfont,l=e.textposition,c=Array.isArray(l)?l:[l],u=o.color,h=o.size,f=o.family,p={},d=e.texttemplate;if(d){p.text=[];var g=a._d3locale,m=Array.isArray(d),y=m?Math.min(d.length,i):i,x=m?function(t){return d[t]}:function(){return d};for(r=0;rd.TOO_MANY_POINTS||h.hasMarkers(e)?"rect":"round";if(c&&e.connectgaps){var f=n[0],p=n[1];for(a=0;a1?l[a]:l[0]:l,d=Array.isArray(c)?c.length>1?c[a]:c[0]:c,g=m[p],v=m[d],y=u?u/.8+1:0,x=-v*y-.5*v;o.offset[a]=[g*y/f,x/f]}}return o}}},{"../../components/drawing":637,"../../components/fx/helpers":651,"../../constants/interactions":723,"../../lib":749,"../../lib/gl_format_color":745,"../../plots/cartesian/axis_ids":800,"../../registry":880,"../scatter/make_bubble_size_func":1172,"../scatter/subtypes":1179,"./constants":1208,"./helpers":1213,"color-normalize":125,"fast-isnumeric":241,"svg-path-sdf":546}],1210:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../registry"),i=t("./helpers"),o=t("./attributes"),s=t("../scatter/constants"),l=t("../scatter/subtypes"),c=t("../scatter/xy_defaults"),u=t("../scatter/marker_defaults"),h=t("../scatter/line_defaults"),f=t("../scatter/fillcolor_defaults"),p=t("../scatter/text_defaults");e.exports=function(t,e,r,d){function g(r,a){return n.coerce(t,e,o,r,a)}var m=!!t.marker&&i.isOpenSymbol(t.marker.symbol),v=l.isBubble(t),y=c(t,e,d,g);if(y){var x=y100},r.isDotSymbol=function(t){return"string"==typeof t?n.DOT_RE.test(t):t>200}},{"./constants":1208}],1214:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("../scatter/get_trace_color");function o(t,e,r,o){var s=t.xa,l=t.ya,c=t.distance,u=t.dxy,h=t.index,f={pointNumber:h,x:e[h],y:r[h]};f.tx=Array.isArray(o.text)?o.text[h]:o.text,f.htx=Array.isArray(o.hovertext)?o.hovertext[h]:o.hovertext,f.data=Array.isArray(o.customdata)?o.customdata[h]:o.customdata,f.tp=Array.isArray(o.textposition)?o.textposition[h]:o.textposition;var p=o.textfont;p&&(f.ts=a.isArrayOrTypedArray(p.size)?p.size[h]:p.size,f.tc=Array.isArray(p.color)?p.color[h]:p.color,f.tf=Array.isArray(p.family)?p.family[h]:p.family);var d=o.marker;d&&(f.ms=a.isArrayOrTypedArray(d.size)?d.size[h]:d.size,f.mo=a.isArrayOrTypedArray(d.opacity)?d.opacity[h]:d.opacity,f.mx=a.isArrayOrTypedArray(d.symbol)?d.symbol[h]:d.symbol,f.mc=a.isArrayOrTypedArray(d.color)?d.color[h]:d.color);var g=d&&d.line;g&&(f.mlc=Array.isArray(g.color)?g.color[h]:g.color,f.mlw=a.isArrayOrTypedArray(g.width)?g.width[h]:g.width);var m=d&&d.gradient;m&&"none"!==m.type&&(f.mgt=Array.isArray(m.type)?m.type[h]:m.type,f.mgc=Array.isArray(m.color)?m.color[h]:m.color);var v=s.c2p(f.x,!0),y=l.c2p(f.y,!0),x=f.mrc||1,b=o.hoverlabel;b&&(f.hbg=Array.isArray(b.bgcolor)?b.bgcolor[h]:b.bgcolor,f.hbc=Array.isArray(b.bordercolor)?b.bordercolor[h]:b.bordercolor,f.hts=a.isArrayOrTypedArray(b.font.size)?b.font.size[h]:b.font.size,f.htc=Array.isArray(b.font.color)?b.font.color[h]:b.font.color,f.htf=Array.isArray(b.font.family)?b.font.family[h]:b.font.family,f.hnl=a.isArrayOrTypedArray(b.namelength)?b.namelength[h]:b.namelength);var _=o.hoverinfo;_&&(f.hi=Array.isArray(_)?_[h]:_);var w=o.hovertemplate;w&&(f.ht=Array.isArray(w)?w[h]:w);var T={};T[t.index]=f;var k=a.extendFlat({},t,{color:i(o,f),x0:v-x,x1:v+x,xLabelVal:f.x,y0:y-x,y1:y+x,yLabelVal:f.y,cd:T,distance:c,spikeDistance:u,hovertemplate:f.ht});return f.htx?k.text=f.htx:f.tx?k.text=f.tx:o.text&&(k.text=o.text),a.fillText(f,o,k),n.getComponentMethod("errorbars","hoverInfo")(f,o,k),k}e.exports={hoverPoints:function(t,e,r,n){var a,i,s,l,c,u,h,f,p,d=t.cd,g=d[0].t,m=d[0].trace,v=t.xa,y=t.ya,x=g.x,b=g.y,_=v.c2p(e),w=y.c2p(r),T=t.distance;if(g.tree){var k=v.p2c(_-T),M=v.p2c(_+T),A=y.p2c(w-T),S=y.p2c(w+T);a="x"===n?g.tree.range(Math.min(k,M),Math.min(y._rl[0],y._rl[1]),Math.max(k,M),Math.max(y._rl[0],y._rl[1])):g.tree.range(Math.min(k,M),Math.min(A,S),Math.max(k,M),Math.max(A,S))}else a=g.ids;var E=T;if("x"===n)for(c=0;c-1;c--)s=x[a[c]],l=b[a[c]],u=v.c2p(s)-_,h=y.c2p(l)-w,(f=Math.sqrt(u*u+h*h))v.glText.length){var w=b-v.glText.length;for(d=0;dr&&(isNaN(e[n])||isNaN(e[n+1]));)n-=2;t.positions=e.slice(r,n+2)}return t})),v.line2d.update(v.lineOptions)),v.error2d){var k=(v.errorXOptions||[]).concat(v.errorYOptions||[]);v.error2d.update(k)}v.scatter2d&&v.scatter2d.update(v.markerOptions),v.fillOrder=s.repeat(null,b),v.fill2d&&(v.fillOptions=v.fillOptions.map((function(t,e){var n=r[e];if(t&&n&&n[0]&&n[0].trace){var a,i,o=n[0],s=o.trace,l=o.t,c=v.lineOptions[e],u=[];s._ownfill&&u.push(e),s._nexttrace&&u.push(e+1),u.length&&(v.fillOrder[e]=u);var h,f,p=[],d=c&&c.positions||l.positions;if("tozeroy"===s.fill){for(h=0;hh&&isNaN(d[f+1]);)f-=2;0!==d[h+1]&&(p=[d[h],0]),p=p.concat(d.slice(h,f+2)),0!==d[f+1]&&(p=p.concat([d[f],0]))}else if("tozerox"===s.fill){for(h=0;hh&&isNaN(d[f]);)f-=2;0!==d[h]&&(p=[0,d[h+1]]),p=p.concat(d.slice(h,f+2)),0!==d[f]&&(p=p.concat([0,d[f+1]]))}else if("toself"===s.fill||"tonext"===s.fill){for(p=[],a=0,i=0;i-1;for(d=0;d=0?Math.floor((e+180)/360):Math.ceil((e-180)/360)),d=e-p;if(n.getClosest(l,(function(t){var e=t.lonlat;if(e[0]===s)return 1/0;var n=a.modHalf(e[0],360),i=e[1],o=f.project([n,i]),l=o.x-u.c2p([d,i]),c=o.y-h.c2p([n,r]),p=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(l*l+c*c)-p,1-3/p)}),t),!1!==t.index){var g=l[t.index],m=g.lonlat,v=[a.modHalf(m[0],360)+p,m[1]],y=u.c2p(v),x=h.c2p(v),b=g.mrc||1;t.x0=y-b,t.x1=y+b,t.y0=x-b,t.y1=x+b;var _={};_[c.subplot]={_subplot:f};var w=c._module.formatLabels(g,c,_);return t.lonLabel=w.lonLabel,t.latLabel=w.latLabel,t.color=i(c,g),t.extraText=function(t,e,r){if(t.hovertemplate)return;var n=(e.hi||t.hoverinfo).split("+"),a=-1!==n.indexOf("all"),i=-1!==n.indexOf("lon"),s=-1!==n.indexOf("lat"),l=e.lonlat,c=[];function u(t){return t+"\xb0"}a||i&&s?c.push("("+u(l[0])+", "+u(l[1])+")"):i?c.push(r.lon+u(l[0])):s&&c.push(r.lat+u(l[1]));(a||-1!==n.indexOf("text"))&&o(e,t,c);return c.join("
")}(c,g,l[0].t.labels),t.hovertemplate=c.hovertemplate,[t]}}},{"../../components/fx":655,"../../constants/numerical":724,"../../lib":749,"../scatter/get_trace_color":1165}],1225:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("../scattergeo/calc"),plot:t("./plot"),hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),styleOnSelect:function(t,e){e&&e[0].trace._glTrace.update(e)},moduleType:"trace",name:"scattermapbox",basePlotModule:t("../../plots/mapbox"),categories:["mapbox","gl","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/mapbox":854,"../scatter/marker_colorbar":1173,"../scattergeo/calc":1197,"./attributes":1219,"./defaults":1221,"./event_data":1222,"./format_labels":1223,"./hover":1224,"./plot":1226,"./select":1227}],1226:[function(t,e,r){"use strict";var n=t("./convert"),a=t("../../plots/mapbox/constants").traceLayerPrefix,i=["fill","line","circle","symbol"];function o(t,e){this.type="scattermapbox",this.subplot=t,this.uid=e,this.sourceIds={fill:"source-"+e+"-fill",line:"source-"+e+"-line",circle:"source-"+e+"-circle",symbol:"source-"+e+"-symbol"},this.layerIds={fill:a+e+"-fill",line:a+e+"-line",circle:a+e+"-circle",symbol:a+e+"-symbol"},this.below=null}var s=o.prototype;s.addSource=function(t,e){this.subplot.map.addSource(this.sourceIds[t],{type:"geojson",data:e.geojson})},s.setSourceData=function(t,e){this.subplot.map.getSource(this.sourceIds[t]).setData(e.geojson)},s.addLayer=function(t,e,r){this.subplot.addLayer({type:t,id:this.layerIds[t],source:this.sourceIds[t],layout:e.layout,paint:e.paint},r)},s.update=function(t){var e,r,a,o=this.subplot,s=o.map,l=n(o.gd,t),c=o.belowLookup["trace-"+this.uid];if(c!==this.below){for(e=i.length-1;e>=0;e--)r=i[e],s.removeLayer(this.layerIds[r]);for(e=0;e=0;e--){var r=i[e];t.removeLayer(this.layerIds[r]),t.removeSource(this.sourceIds[r])}},e.exports=function(t,e){for(var r=e[0].trace,a=new o(t,r.uid),s=n(t.gd,e),l=a.below=t.belowLookup["trace-"+r.uid],c=0;c")}}e.exports={hoverPoints:function(t,e,r,i){var o=n(t,e,r,i);if(o&&!1!==o[0].index){var s=o[0];if(void 0===s.index)return o;var l=t.subplot,c=s.cd[s.index],u=s.trace;if(l.isPtInside(c))return s.xLabelVal=void 0,s.yLabelVal=void 0,a(c,u,l,s),s.hovertemplate=u.hovertemplate,o}},makeHoverPointText:a}},{"../scatter/hover":1166}],1233:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:t("../../plots/polar"),categories:["polar","symbols","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,selectPoints:t("../scatter/select"),meta:{}}},{"../../plots/polar":863,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1228,"./calc":1229,"./defaults":1230,"./format_labels":1231,"./hover":1232,"./plot":1234}],1234:[function(t,e,r){"use strict";var n=t("../scatter/plot"),a=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r){for(var i=e.layers.frontplot.select("g.scatterlayer"),o={xaxis:e.xaxis,yaxis:e.yaxis,plot:e.framework,layerClipId:e._hasClipOnAxisFalse?e.clipIds.forTraces:null},s=e.radialAxis,l=e.angularAxis,c=0;c=c&&(y.marker.cluster=d.tree),y.marker&&(y.markerSel.positions=y.markerUnsel.positions=y.marker.positions=_),y.line&&_.length>1&&l.extendFlat(y.line,s.linePositions(t,p,_)),y.text&&(l.extendFlat(y.text,{positions:_},s.textPosition(t,p,y.text,y.marker)),l.extendFlat(y.textSel,{positions:_},s.textPosition(t,p,y.text,y.markerSel)),l.extendFlat(y.textUnsel,{positions:_},s.textPosition(t,p,y.text,y.markerUnsel))),y.fill&&!f.fill2d&&(f.fill2d=!0),y.marker&&!f.scatter2d&&(f.scatter2d=!0),y.line&&!f.line2d&&(f.line2d=!0),y.text&&!f.glText&&(f.glText=!0),f.lineOptions.push(y.line),f.fillOptions.push(y.fill),f.markerOptions.push(y.marker),f.markerSelectedOptions.push(y.markerSel),f.markerUnselectedOptions.push(y.markerUnsel),f.textOptions.push(y.text),f.textSelectedOptions.push(y.textSel),f.textUnselectedOptions.push(y.textUnsel),f.selectBatch.push([]),f.unselectBatch.push([]),d.x=w,d.y=T,d.rawx=w,d.rawy=T,d.r=m,d.theta=v,d.positions=_,d._scene=f,d.index=f.count,f.count++}})),i(t,e,r)}}},{"../../lib":749,"../scattergl/constants":1208,"../scattergl/convert":1209,"../scattergl/plot":1216,"../scattergl/scene_update":1217,"@plotly/point-cluster":57,"fast-isnumeric":241}],1242:[function(t,e,r){"use strict";var n=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../../plots/template_attributes").texttemplateAttrs,i=t("../scatter/attributes"),o=t("../../plots/attributes"),s=t("../../components/colorscale/attributes"),l=t("../../components/drawing/attributes").dash,c=t("../../lib/extend").extendFlat,u=i.marker,h=i.line,f=u.line;e.exports={a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},c:{valType:"data_array",editType:"calc"},sum:{valType:"number",dflt:0,min:0,editType:"calc"},mode:c({},i.mode,{dflt:"markers"}),text:c({},i.text,{}),texttemplate:a({editType:"plot"},{keys:["a","b","c","text"]}),hovertext:c({},i.hovertext,{}),line:{color:h.color,width:h.width,dash:l,shape:c({},h.shape,{values:["linear","spline"]}),smoothing:h.smoothing,editType:"calc"},connectgaps:i.connectgaps,cliponaxis:i.cliponaxis,fill:c({},i.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:i.fillcolor,marker:c({symbol:u.symbol,opacity:u.opacity,maxdisplayed:u.maxdisplayed,size:u.size,sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,line:c({width:f.width,editType:"calc"},s("marker.line")),gradient:u.gradient,editType:"calc"},s("marker")),textfont:i.textfont,textposition:i.textposition,selected:i.selected,unselected:i.unselected,hoverinfo:c({},o.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:i.hoveron,hovertemplate:n()}},{"../../components/colorscale/attributes":622,"../../components/drawing/attributes":636,"../../lib/extend":739,"../../plots/attributes":794,"../../plots/template_attributes":875,"../scatter/attributes":1155}],1243:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../scatter/colorscale_calc"),i=t("../scatter/arrays_to_calcdata"),o=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize,l=["a","b","c"],c={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,u,h,f,p,d,g=t._fullLayout[e.subplot].sum,m=e.sum||g,v={a:e.a,b:e.b,c:e.c};for(r=0;r"),o.hovertemplate=f.hovertemplate,i}function x(t,e){v.push(t._hovertitle+": "+e)}}},{"../scatter/hover":1166}],1248:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../scatter/select"),eventData:t("./event_data"),moduleType:"trace",name:"scatterternary",basePlotModule:t("../../plots/ternary"),categories:["ternary","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/ternary":876,"../scatter/marker_colorbar":1173,"../scatter/select":1176,"../scatter/style":1178,"./attributes":1242,"./calc":1243,"./defaults":1244,"./event_data":1245,"./format_labels":1246,"./hover":1247,"./plot":1249}],1249:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e,r){var a=e.plotContainer;a.select(".scatterlayer").selectAll("*").remove();var i={xaxis:e.xaxis,yaxis:e.yaxis,plot:a,layerClipId:e._hasClipOnAxisFalse?e.clipIdRelative:null},o=e.layers.frontplot.select("g.scatterlayer");n(t,i,r,o)}},{"../scatter/plot":1175}],1250:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),a=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../scattergl/attributes"),s=t("../../plots/cartesian/constants").idRegex,l=t("../../plot_api/plot_template").templatedArray,c=t("../../lib/extend").extendFlat,u=n.marker,h=u.line,f=c(a("marker.line",{editTypeOverride:"calc"}),{width:c({},h.width,{editType:"calc"}),editType:"calc"}),p=c(a("marker"),{symbol:u.symbol,size:c({},u.size,{editType:"markerSize"}),sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,opacity:u.opacity,colorbar:u.colorbar,line:f,editType:"calc"});function d(t){return{valType:"info_array",freeLength:!0,editType:"calc",items:{valType:"subplotid",regex:s[t],editType:"plot"}}}p.color.editType=p.cmin.editType=p.cmax.editType="style",e.exports={dimensions:l("dimension",{visible:{valType:"boolean",dflt:!0,editType:"calc"},label:{valType:"string",editType:"calc"},values:{valType:"data_array",editType:"calc+clearAxisTypes"},axis:{type:{valType:"enumerated",values:["linear","log","date","category"],editType:"calc+clearAxisTypes"},matches:{valType:"boolean",dflt:!1,editType:"calc"},editType:"calc+clearAxisTypes"},editType:"calc+clearAxisTypes"}),text:c({},o.text,{}),hovertext:c({},o.hovertext,{}),hovertemplate:i(),marker:p,xaxes:d("x"),yaxes:d("y"),diagonal:{visible:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},showupperhalf:{valType:"boolean",dflt:!0,editType:"calc"},showlowerhalf:{valType:"boolean",dflt:!0,editType:"calc"},selected:{marker:o.selected.marker,editType:"calc"},unselected:{marker:o.unselected.marker,editType:"calc"},opacity:o.opacity}},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/plot_template":787,"../../plots/cartesian/constants":803,"../../plots/template_attributes":875,"../scatter/attributes":1155,"../scattergl/attributes":1206}],1251:[function(t,e,r){"use strict";var n=t("regl-line2d"),a=t("../../registry"),i=t("../../lib/prepare_regl"),o=t("../../plots/get_data").getModuleCalcData,s=t("../../plots/cartesian"),l=t("../../plots/cartesian/axis_ids").getFromId,c=t("../../plots/cartesian/axes").shouldShowZeroLine;function u(t,e,r){for(var n=r.matrixOptions.data.length,a=e._visibleDims,i=r.viewOpts.ranges=new Array(n),o=0;of?2*(b.sizeAvg||Math.max(b.size,3)):i(e,x),p=0;pi&&l||a-1,A=!0;if(o(x)||!!p.selectedpoints||M){var S=p._length;if(p.selectedpoints){g.selectBatch=p.selectedpoints;var E=p.selectedpoints,C={};for(l=0;l1&&(u=g[y-1],f=m[y-1],d=v[y-1]),e=0;eu?"-":"+")+"x")).replace("y",(h>f?"-":"+")+"y")).replace("z",(p>d?"-":"+")+"z");var C=function(){y=0,A=[],S=[],E=[]};(!y||y2?t.slice(1,e-1):2===e?[(t[0]+t[1])/2]:t}function p(t){var e=t.length;return 1===e?[.5,.5]:[t[1]-t[0],t[e-1]-t[e-2]]}function d(t,e){var r=t.fullSceneLayout,a=t.dataScale,u=e._len,h={};function d(t,e){var n=r[e],o=a[c[e]];return i.simpleMap(t,(function(t){return n.d2l(t)*o}))}if(h.vectors=l(d(e._u,"xaxis"),d(e._v,"yaxis"),d(e._w,"zaxis"),u),!u)return{positions:[],cells:[]};var g=d(e._Xs,"xaxis"),m=d(e._Ys,"yaxis"),v=d(e._Zs,"zaxis");if(h.meshgrid=[g,m,v],h.gridFill=e._gridFill,e._slen)h.startingPositions=l(d(e._startsX,"xaxis"),d(e._startsY,"yaxis"),d(e._startsZ,"zaxis"));else{for(var y=m[0],x=f(g),b=f(v),_=new Array(x.length*b.length),w=0,T=0;T=0};v?(r=Math.min(m.length,x.length),l=function(t){return M(m[t])&&A(t)},h=function(t){return String(m[t])}):(r=Math.min(y.length,x.length),l=function(t){return M(y[t])&&A(t)},h=function(t){return String(y[t])}),_&&(r=Math.min(r,b.length));for(var S=0;S1){for(var P=i.randstr(),I=0;I"),name:k||z("name")?l.name:void 0,color:T("hoverlabel.bgcolor")||y.color,borderColor:T("hoverlabel.bordercolor"),fontFamily:T("hoverlabel.font.family"),fontSize:T("hoverlabel.font.size"),fontColor:T("hoverlabel.font.color"),nameLength:T("hoverlabel.namelength"),textAlign:T("hoverlabel.align"),hovertemplate:k,hovertemplateLabels:L,eventData:[h(a,l,f.eventDataKeys)]};m&&(R.x0=S-a.rInscribed*a.rpx1,R.x1=S+a.rInscribed*a.rpx1,R.idealAlign=a.pxmid[0]<0?"left":"right"),v&&(R.x=S,R.idealAlign=S<0?"left":"right"),o.loneHover(R,{container:i._hoverlayer.node(),outerContainer:i._paper.node(),gd:r}),d._hasHoverLabel=!0}if(v){var F=t.select("path.surface");f.styleOne(F,a,l,{hovered:!0})}d._hasHoverEvent=!0,r.emit("plotly_hover",{points:[h(a,l,f.eventDataKeys)],event:n.event})}})),t.on("mouseout",(function(e){var a=r._fullLayout,i=r._fullData[d.index],s=n.select(this).datum();if(d._hasHoverEvent&&(e.originalEvent=n.event,r.emit("plotly_unhover",{points:[h(s,i,f.eventDataKeys)],event:n.event}),d._hasHoverEvent=!1),d._hasHoverLabel&&(o.loneUnhover(a._hoverlayer.node()),d._hasHoverLabel=!1),v){var l=t.select("path.surface");f.styleOne(l,s,i,{hovered:!1})}})),t.on("click",(function(t){var e=r._fullLayout,i=r._fullData[d.index],s=m&&(c.isHierarchyRoot(t)||c.isLeaf(t)),u=c.getPtId(t),p=c.isEntry(t)?c.findEntryWithChild(g,u):c.findEntryWithLevel(g,u),v=c.getPtId(p),y={points:[h(t,i,f.eventDataKeys)],event:n.event};s||(y.nextLevel=v);var x=l.triggerHandler(r,"plotly_"+d.type+"click",y);if(!1!==x&&e.hovermode&&(r._hoverdata=[h(t,i,f.eventDataKeys)],o.click(r,n.event)),!s&&!1!==x&&!r._dragging&&!r._transitioning){a.call("_storeDirectGUIEdit",i,e._tracePreGUI[i.uid],{level:i.level});var b={data:[{level:v}],traces:[d.index]},_={frame:{redraw:!1,duration:f.transitionTime},transition:{duration:f.transitionTime,easing:f.transitionEasing},mode:"immediate",fromcurrent:!0};o.loneUnhover(e._hoverlayer.node()),a.call("animate",r,b,_)}}))}},{"../../components/fx":655,"../../components/fx/helpers":651,"../../lib":749,"../../lib/events":738,"../../registry":880,"../pie/helpers":1134,"./helpers":1272,d3:169}],1272:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../components/color"),i=t("../../lib/setcursor"),o=t("../pie/helpers");function s(t){return t.data.data.pid}r.findEntryWithLevel=function(t,e){var n;return e&&t.eachAfter((function(t){if(r.getPtId(t)===e)return n=t.copy()})),n||t},r.findEntryWithChild=function(t,e){var n;return t.eachAfter((function(t){for(var a=t.children||[],i=0;i0)},r.getMaxDepth=function(t){return t.maxdepth>=0?t.maxdepth:1/0},r.isHeader=function(t,e){return!(r.isLeaf(t)||t.depth===e._maxDepth-1)},r.getParent=function(t,e){return r.findEntryWithLevel(t,s(e))},r.listPath=function(t,e){var n=t.parent;if(!n)return[];var a=e?[n.data[e]]:[n];return r.listPath(n,e).concat(a)},r.getPath=function(t){return r.listPath(t,"label").join("/")+"/"},r.formatValue=o.formatPieValue,r.formatPercent=function(t,e){var r=n.formatPercent(t,0);return"0%"===r&&(r=o.formatPiePercent(t,e)),r}},{"../../components/color":615,"../../lib":749,"../../lib/setcursor":769,"../pie/helpers":1134}],1273:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"sunburst",basePlotModule:t("./base_plot"),categories:[],animatable:!0,attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot").plot,style:t("./style").style,colorbar:t("../scatter/marker_colorbar"),meta:{}}},{"../scatter/marker_colorbar":1173,"./attributes":1266,"./base_plot":1267,"./calc":1268,"./defaults":1270,"./layout_attributes":1274,"./layout_defaults":1275,"./plot":1276,"./style":1277}],1274:[function(t,e,r){"use strict";e.exports={sunburstcolorway:{valType:"colorlist",editType:"calc"},extendsunburstcolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{}],1275:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function r(r,i){return n.coerce(t,e,a,r,i)}r("sunburstcolorway",e.colorway),r("extendsunburstcolors")}},{"../../lib":749,"./layout_attributes":1274}],1276:[function(t,e,r){"use strict";var n=t("d3"),a=t("d3-hierarchy"),i=t("../../components/drawing"),o=t("../../lib"),s=t("../../lib/svg_text_utils"),l=t("../bar/uniform_text"),c=l.recordMinTextSize,u=l.clearMinTextSize,h=t("../pie/plot"),f=h.computeTransform,p=h.transformInsideText,d=t("./style").styleOne,g=t("../bar/style").resizeText,m=t("./fx"),v=t("./constants"),y=t("./helpers");function x(t,e,l,u){var h=t._fullLayout,g=!h.uniformtext.mode&&y.hasTransition(u),x=n.select(l).selectAll("g.slice"),_=e[0],w=_.trace,T=_.hierarchy,k=y.findEntryWithLevel(T,w.level),M=y.getMaxDepth(w),A=h._size,S=w.domain,E=A.w*(S.x[1]-S.x[0]),C=A.h*(S.y[1]-S.y[0]),L=.5*Math.min(E,C),P=_.cx=A.l+A.w*(S.x[1]+S.x[0])/2,I=_.cy=A.t+A.h*(1-S.y[0])-C/2;if(!k)return x.remove();var z=null,O={};g&&x.each((function(t){O[y.getPtId(t)]={rpx0:t.rpx0,rpx1:t.rpx1,x0:t.x0,x1:t.x1,transform:t.transform},!z&&y.isEntry(t)&&(z=t)}));var D=function(t){return a.partition().size([2*Math.PI,t.height+1])(t)}(k).descendants(),R=k.height+1,F=0,B=M;_.hasMultipleRoots&&y.isHierarchyRoot(k)&&(D=D.slice(1),R-=1,F=1,B+=1),D=D.filter((function(t){return t.y1<=B}));var N=Math.min(R,M),j=function(t){return(t-F)/N*L},U=function(t,e){return[t*Math.cos(e),-t*Math.sin(e)]},V=function(t){return o.pathAnnulus(t.rpx0,t.rpx1,t.x0,t.x1,P,I)},q=function(t){return P+b(t)[0]*(t.transform.rCenter||0)+(t.transform.x||0)},H=function(t){return I+b(t)[1]*(t.transform.rCenter||0)+(t.transform.y||0)};(x=x.data(D,y.getPtId)).enter().append("g").classed("slice",!0),g?x.exit().transition().each((function(){var t=n.select(this);t.select("path.surface").transition().attrTween("d",(function(t){var e=function(t){var e,r=y.getPtId(t),a=O[r],i=O[y.getPtId(k)];if(i){var o=t.x1>i.x1?2*Math.PI:0;e=t.rpx1G?2*Math.PI:0;e={x0:i,x1:i}}else e={rpx0:L,rpx1:L},o.extendFlat(e,Z(t));else e={rpx0:0,rpx1:0};else e={x0:0,x1:0};return n.interpolate(e,a)}(t);return function(t){return V(e(t))}})):u.attr("d",V),l.call(m,k,t,e,{eventDataKeys:v.eventDataKeys,transitionTime:v.CLICK_TRANSITION_TIME,transitionEasing:v.CLICK_TRANSITION_EASING}).call(y.setSliceCursor,t,{hideOnRoot:!0,hideOnLeaves:!0,isTransitioning:t._transitioning}),u.call(d,a,w);var x=o.ensureSingle(l,"g","slicetext"),b=o.ensureSingle(x,"text","",(function(t){t.attr("data-notex",1)})),T=o.ensureUniformFontSize(t,y.determineTextFont(w,a,h.font));b.text(r.formatSliceLabel(a,k,w,e,h)).classed("slicetext",!0).attr("text-anchor","middle").call(i.font,T).call(s.convertToTspans,t);var M=i.bBox(b.node());a.transform=p(M,a,_),a.transform.targetX=q(a),a.transform.targetY=H(a);var A=function(t,e){var r=t.transform;return f(r,e),r.fontSize=T.size,c(w.type,r,h),o.getTextTransform(r)};g?b.transition().attrTween("transform",(function(t){var e=function(t){var e,r=O[y.getPtId(t)],a=t.transform;if(r)e=r;else if(e={rpx1:t.rpx1,transform:{textPosAngle:a.textPosAngle,scale:0,rotate:a.rotate,rCenter:a.rCenter,x:a.x,y:a.y}},z)if(t.parent)if(G){var i=t.x1>G?2*Math.PI:0;e.x0=e.x1=i}else o.extendFlat(e,Z(t));else e.x0=e.x1=0;else e.x0=e.x1=0;var s=n.interpolate(e.transform.textPosAngle,t.transform.textPosAngle),l=n.interpolate(e.rpx1,t.rpx1),u=n.interpolate(e.x0,t.x0),f=n.interpolate(e.x1,t.x1),p=n.interpolate(e.transform.scale,a.scale),d=n.interpolate(e.transform.rotate,a.rotate),g=0===a.rCenter?3:0===e.transform.rCenter?1/3:1,m=n.interpolate(e.transform.rCenter,a.rCenter);return function(t){var e=l(t),r=u(t),n=f(t),i=function(t){return m(Math.pow(t,g))}(t),o={pxmid:U(e,(r+n)/2),rpx1:e,transform:{textPosAngle:s(t),rCenter:i,x:a.x,y:a.y}};return c(w.type,a,h),{transform:{targetX:q(o),targetY:H(o),scale:p(t),rotate:d(t),rCenter:i}}}}(t);return function(t){return A(e(t),M)}})):b.attr("transform",A(a,M))}))}function b(t){return e=t.rpx1,r=t.transform.textPosAngle,[e*Math.sin(r),-e*Math.cos(r)];var e,r}r.plot=function(t,e,r,a){var i,o,s=t._fullLayout,l=s._sunburstlayer,c=!r,h=!s.uniformtext.mode&&y.hasTransition(r);(u("sunburst",s),(i=l.selectAll("g.trace.sunburst").data(e,(function(t){return t[0].trace.uid}))).enter().append("g").classed("trace",!0).classed("sunburst",!0).attr("stroke-linejoin","round"),i.order(),h)?(a&&(o=a()),n.transition().duration(r.duration).ease(r.easing).each("end",(function(){o&&o()})).each("interrupt",(function(){o&&o()})).each((function(){l.selectAll("g.trace").each((function(e){x(t,e,this,r)}))}))):(i.each((function(e){x(t,e,this,r)})),s.uniformtext.mode&&g(t,s._sunburstlayer.selectAll(".trace"),"sunburst"));c&&i.exit().remove()},r.formatSliceLabel=function(t,e,r,n,a){var i=r.texttemplate,s=r.textinfo;if(!(i||s&&"none"!==s))return"";var l=a.separators,c=n[0],u=t.data.data,h=c.hierarchy,f=y.isHierarchyRoot(t),p=y.getParent(h,t),d=y.getValue(t);if(!i){var g,m=s.split("+"),v=function(t){return-1!==m.indexOf(t)},x=[];if(v("label")&&u.label&&x.push(u.label),u.hasOwnProperty("v")&&v("value")&&x.push(y.formatValue(u.v,l)),!f){v("current path")&&x.push(y.getPath(t.data));var b=0;v("percent parent")&&b++,v("percent entry")&&b++,v("percent root")&&b++;var _=b>1;if(b){var w,T=function(t){g=y.formatPercent(w,l),_&&(g+=" of "+t),x.push(g)};v("percent parent")&&!f&&(w=d/y.getValue(p),T("parent")),v("percent entry")&&(w=d/y.getValue(e),T("entry")),v("percent root")&&(w=d/y.getValue(h),T("root"))}}return v("text")&&(g=o.castOption(r,u.i,"text"),o.isValidTextValue(g)&&x.push(g)),x.join("
")}var k=o.castOption(r,u.i,"texttemplate");if(!k)return"";var M={};u.label&&(M.label=u.label),u.hasOwnProperty("v")&&(M.value=u.v,M.valueLabel=y.formatValue(u.v,l)),M.currentPath=y.getPath(t.data),f||(M.percentParent=d/y.getValue(p),M.percentParentLabel=y.formatPercent(M.percentParent,l),M.parent=y.getPtLabel(p)),M.percentEntry=d/y.getValue(e),M.percentEntryLabel=y.formatPercent(M.percentEntry,l),M.entry=y.getPtLabel(e),M.percentRoot=d/y.getValue(h),M.percentRootLabel=y.formatPercent(M.percentRoot,l),M.root=y.getPtLabel(h),u.hasOwnProperty("color")&&(M.color=u.color);var A=o.castOption(r,u.i,"text");return(o.isValidTextValue(A)||""===A)&&(M.text=A),M.customdata=o.castOption(r,u.i,"customdata"),o.texttemplateString(k,M,a._d3locale,M,r._meta||{})}},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../bar/style":904,"../bar/uniform_text":906,"../pie/plot":1138,"./constants":1269,"./fx":1271,"./helpers":1272,"./style":1277,d3:169,"d3-hierarchy":161}],1277:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/color"),i=t("../../lib"),o=t("../bar/uniform_text").resizeText;function s(t,e,r){var n=e.data.data,o=!e.children,s=n.i,l=i.castOption(r,s,"marker.line.color")||a.defaultLine,c=i.castOption(r,s,"marker.line.width")||0;t.style("stroke-width",c).call(a.fill,n.color).call(a.stroke,l).style("opacity",o?r.leaf.opacity:null)}e.exports={style:function(t){var e=t._fullLayout._sunburstlayer.selectAll(".trace");o(t,e,"sunburst"),e.each((function(t){var e=n.select(this),r=t[0].trace;e.style("opacity",r.opacity),e.selectAll("path.surface").each((function(t){n.select(this).call(s,t,r)}))}))},styleOne:s}},{"../../components/color":615,"../../lib":749,"../bar/uniform_text":906,d3:169}],1278:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll;function c(t){return{show:{valType:"boolean",dflt:!1},start:{valType:"number",dflt:null,editType:"plot"},end:{valType:"number",dflt:null,editType:"plot"},size:{valType:"number",dflt:null,min:0,editType:"plot"},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 u=e.exports=l(s({z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:i(),connectgaps:{valType:"boolean",dflt:!1,editType:"calc"},surfacecolor:{valType:"data_array"}},a("",{colorAttr:"z or surfacecolor",showScaleDflt:!0,autoColorDflt:!1,editTypeOverride:"calc"}),{contours:{x:c(),y:c(),z:c()},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},opacityscale:{valType:"any",editType:"calc"},_deprecated:{zauto:s({},a.zauto,{}),zmin:s({},a.zmin,{}),zmax:s({},a.zmax,{})},hoverinfo:s({},o.hoverinfo),showlegend:s({},o.showlegend,{dflt:!1})}),"calc","nested");u.x.editType=u.y.editType=u.z.editType="calc+clearAxisTypes",u.transforms=void 0},{"../../components/color":615,"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plot_api/edit_types":780,"../../plots/attributes":794,"../../plots/template_attributes":875}],1279:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(t,e,{vals:e.surfacecolor,containerStr:"",cLetter:"c"}):n(t,e,{vals:e.z,containerStr:"",cLetter:"c"})}},{"../../components/colorscale/calc":623}],1280:[function(t,e,r){"use strict";var n=t("gl-surface3d"),a=t("ndarray"),i=t("ndarray-linear-interpolate").d2,o=t("../heatmap/interp2d"),s=t("../heatmap/find_empties"),l=t("../../lib").isArrayOrTypedArray,c=t("../../lib/gl_format_color").parseColorScale,u=t("../../lib/str2rgbarray"),h=t("../../components/colorscale").extractOpts;function f(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.contourStart=[null,null,null],this.contourEnd=[null,null,null],this.contourSize=[0,0,0],this.minValues=[1/0,1/0,1/0],this.maxValues=[-1/0,-1/0,-1/0],this.dataScaleX=1,this.dataScaleY=1,this.refineData=!0,this.objectOffset=[0,0,0]}var p=f.prototype;p.getXat=function(t,e,r,n){var a=l(this.data.x)?l(this.data.x[0])?this.data.x[e][t]:this.data.x[t]:t;return void 0===r?a:n.d2l(a,0,r)},p.getYat=function(t,e,r,n){var a=l(this.data.y)?l(this.data.y[0])?this.data.y[e][t]:this.data.y[e]:e;return void 0===r?a:n.d2l(a,0,r)},p.getZat=function(t,e,r,n){var a=this.data.z[e][t];return null===a&&this.data.connectgaps&&this.data._interpolatedZ&&(a=this.data._interpolatedZ[e][t]),void 0===r?a:n.d2l(a,0,r)},p.handlePick=function(t){if(t.object===this.surface){var e=(t.data.index[0]-1)/this.dataScaleX-1,r=(t.data.index[1]-1)/this.dataScaleY-1,n=Math.max(Math.min(Math.round(e),this.data.z[0].length-1),0),a=Math.max(Math.min(Math.round(r),this.data._ylength-1),0);t.index=[n,a],t.traceCoordinate=[this.getXat(n,a),this.getYat(n,a),this.getZat(n,a)],t.dataCoordinate=[this.getXat(n,a,this.data.xcalendar,this.scene.fullSceneLayout.xaxis),this.getYat(n,a,this.data.ycalendar,this.scene.fullSceneLayout.yaxis),this.getZat(n,a,this.data.zcalendar,this.scene.fullSceneLayout.zaxis)];for(var i=0;i<3;i++){var o=t.dataCoordinate[i];null!=o&&(t.dataCoordinate[i]*=this.scene.dataScale[i])}var s=this.data.hovertext||this.data.text;return Array.isArray(s)&&s[a]&&void 0!==s[a][n]?t.textLabel=s[a][n]:t.textLabel=s||"",t.data.dataCoordinate=t.dataCoordinate.slice(),this.surface.highlight(t.data),this.scene.glplot.spikes.position=t.dataCoordinate,!0}};var d=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999];function g(t,e){if(t0){r=d[n];break}return r}function y(t,e){if(!(t<1||e<1)){for(var r=m(t),n=m(e),a=1,i=0;i_;)r--,r/=v(r),++r1?n:1},p.refineCoords=function(t){for(var e=this.dataScaleX,r=this.dataScaleY,n=t[0].shape[0],i=t[0].shape[1],o=0|Math.floor(t[0].shape[0]*e+1),s=0|Math.floor(t[0].shape[1]*r+1),l=1+n+1,c=1+i+1,u=a(new Float32Array(l*c),[l,c]),h=[1/e,0,0,0,1/r,0,0,0,1],f=0;f0&&null!==this.contourStart[t]&&null!==this.contourEnd[t]&&this.contourEnd[t]>this.contourStart[t]))for(a[t]=!0,e=this.contourStart[t];ei&&(this.minValues[e]=i),this.maxValues[e]",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}},{}],1287:[function(t,e,r){"use strict";var n=t("./constants"),a=t("../../lib/extend").extendFlat,i=t("fast-isnumeric");function o(t){if(Array.isArray(t)){for(var e=0,r=0;r=e||c===t.length-1)&&(n[a]=o,o.key=l++,o.firstRowIndex=s,o.lastRowIndex=c,o={firstRowIndex:null,lastRowIndex:null,rows:[]},a+=i,s=c+1,i=0);return n}e.exports=function(t,e){var r=l(e.cells.values),p=function(t){return t.slice(e.header.values.length,t.length)},d=l(e.header.values);d.length&&!d[0].length&&(d[0]=[""],d=l(d));var g=d.concat(p(r).map((function(){return c((d[0]||[""]).length)}))),m=e.domain,v=Math.floor(t._fullLayout._size.w*(m.x[1]-m.x[0])),y=Math.floor(t._fullLayout._size.h*(m.y[1]-m.y[0])),x=e.header.values.length?g[0].map((function(){return e.header.height})):[n.emptyHeaderHeight],b=r.length?r[0].map((function(){return e.cells.height})):[],_=x.reduce(s,0),w=f(b,y-_+n.uplift),T=h(f(x,_),[]),k=h(w,T),M={},A=e._fullInput.columnorder.concat(p(r.map((function(t,e){return e})))),S=g.map((function(t,r){var n=Array.isArray(e.columnwidth)?e.columnwidth[Math.min(r,e.columnwidth.length-1)]:e.columnwidth;return i(n)?Number(n):1})),E=S.reduce(s,0);S=S.map((function(t){return t/E*v}));var C=Math.max(o(e.header.line.width),o(e.cells.line.width)),L={key:e.uid+t._context.staticPlot,translateX:m.x[0]*t._fullLayout._size.w,translateY:t._fullLayout._size.h*(1-m.y[1]),size:t._fullLayout._size,width:v,maxLineWidth:C,height:y,columnOrder:A,groupHeight:y,rowBlocks:k,headerRowBlocks:T,scrollY:0,cells:a({},e.cells,{values:r}),headerCells:a({},e.header,{values:g}),gdColumns:g.map((function(t){return t[0]})),gdColumnsOriginalOrder:g.map((function(t){return t[0]})),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:g.map((function(t,e){var r=M[t];return M[t]=(r||0)+1,{key:t+"__"+M[t],label:t,specIndex:e,xIndex:A[e],xScale:u,x:void 0,calcdata:void 0,columnWidth:S[e]}}))};return L.columns.forEach((function(t){t.calcdata=L,t.x=u(t)})),L}},{"../../lib/extend":739,"./constants":1286,"fast-isnumeric":241}],1288:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat;r.splitToPanels=function(t){var e=[0,0],r=n({},t,{key:"header",type:"header",page:0,prevPages:e,currentRepaint:[null,null],dragHandle:!0,values:t.calcdata.headerCells.values[t.specIndex],rowBlocks:t.calcdata.headerRowBlocks,calcdata:n({},t.calcdata,{cells:t.calcdata.headerCells})});return[n({},t,{key:"cells1",type:"cells",page:0,prevPages:e,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),n({},t,{key:"cells2",type:"cells",page:1,prevPages:e,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),r]},r.splitToCells=function(t){var e=function(t){var e=t.rowBlocks[t.page],r=e?e.rows[0].rowIndex:0,n=e?r+e.rows.length:0;return[r,n]}(t);return(t.values||[]).slice(e[0],e[1]).map((function(r,n){return{keyWithinBlock:n+("string"==typeof r&&r.match(/[<$&> ]/)?"_keybuster_"+Math.random():""),key:e[0]+n,column:t,calcdata:t.calcdata,page:t.page,rowBlocks:t.rowBlocks,value:r}}))}},{"../../lib/extend":739}],1289:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),i=t("../../plots/domain").defaults;e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}i(e,o,s),s("columnwidth"),s("header.values"),s("header.format"),s("header.align"),s("header.prefix"),s("header.suffix"),s("header.height"),s("header.line.width"),s("header.line.color"),s("header.fill.color"),n.coerceFont(s,"header.font",n.extendFlat({},o.font)),function(t,e){for(var r=t.columnorder||[],n=t.header.values.length,a=r.slice(0,n),i=a.slice().sort((function(t,e){return t-e})),o=a.map((function(t){return i.indexOf(t)})),s=o.length;s/i),l=!o||s;t.mayHaveMarkup=o&&i.match(/[<&>]/);var c,u="string"==typeof(c=i)&&c.match(n.latexCheck);t.latex=u;var h,f,p=u?"":_(t.calcdata.cells.prefix,e,r)||"",d=u?"":_(t.calcdata.cells.suffix,e,r)||"",g=u?null:_(t.calcdata.cells.format,e,r)||null,m=p+(g?a.format(g)(t.value):t.value)+d;if(t.wrappingNeeded=!t.wrapped&&!l&&!u&&(h=b(m)),t.cellHeightMayIncrease=s||u||t.mayHaveMarkup||(void 0===h?b(m):h),t.needsConvertToTspans=t.mayHaveMarkup||t.wrappingNeeded||t.latex,t.wrappingNeeded){var v=(" "===n.wrapSplitCharacter?m.replace(/a&&n.push(i),a+=l}return n}(a,l,s);1===c.length&&(c[0]===a.length-1?c.unshift(c[0]-1):c.push(c[0]+1)),c[0]%2&&c.reverse(),e.each((function(t,e){t.page=c[e],t.scrollY=l})),e.attr("transform",(function(t){return"translate(0 "+(z(t.rowBlocks,t.page)-t.scrollY)+")"})),t&&(E(t,r,e,c,n.prevPages,n,0),E(t,r,e,c,n.prevPages,n,1),v(r,t))}}function S(t,e,r,i){return function(o){var s=o.calcdata?o.calcdata:o,l=e.filter((function(t){return s.key===t.key})),c=r||s.scrollbarState.dragMultiplier,u=s.scrollY;s.scrollY=void 0===i?s.scrollY+c*a.event.dy:i;var h=l.selectAll("."+n.cn.yColumn).selectAll("."+n.cn.columnBlock).filter(T);return A(t,h,l),s.scrollY===u}}function E(t,e,r,n,a,i,o){n[o]!==a[o]&&(clearTimeout(i.currentRepaint[o]),i.currentRepaint[o]=setTimeout((function(){var i=r.filter((function(t,e){return e===o&&n[e]!==a[e]}));y(t,e,i,r),a[o]=n[o]})))}function C(t,e,r,i){return function(){var o=a.select(e.parentNode);o.each((function(t){var e=t.fragments;o.selectAll("tspan.line").each((function(t,r){e[r].width=this.getComputedTextLength()}));var r,a,i=e[e.length-1].width,s=e.slice(0,-1),l=[],c=0,u=t.column.columnWidth-2*n.cellPad;for(t.value="";s.length;)c+(a=(r=s.shift()).width+i)>u&&(t.value+=l.join(n.wrapSpacer)+n.lineBreaker,l=[],c=0),l.push(r.text),c+=a;c&&(t.value+=l.join(n.wrapSpacer)),t.wrapped=!0})),o.selectAll("tspan.line").remove(),x(o.select("."+n.cn.cellText),r,t,i),a.select(e.parentNode.parentNode).call(I)}}function L(t,e,r,i,o){return function(){if(!o.settledY){var s=a.select(e.parentNode),l=R(o),c=o.key-l.firstRowIndex,u=l.rows[c].rowHeight,h=o.cellHeightMayIncrease?e.parentNode.getBoundingClientRect().height+2*n.cellPad:u,f=Math.max(h,u);f-l.rows[c].rowHeight&&(l.rows[c].rowHeight=f,t.selectAll("."+n.cn.columnCell).call(I),A(null,t.filter(T),0),v(r,i,!0)),s.attr("transform",(function(){var t=this.parentNode.getBoundingClientRect(),e=a.select(this.parentNode).select("."+n.cn.cellRect).node().getBoundingClientRect(),r=this.transform.baseVal.consolidate(),i=e.top-t.top+(r?r.matrix.f:n.cellPad);return"translate("+P(o,a.select(this.parentNode).select("."+n.cn.cellTextHolder).node().getBoundingClientRect().width)+" "+i+")"})),o.settledY=!0}}}function P(t,e){switch(t.align){case"left":return n.cellPad;case"right":return t.column.columnWidth-(e||0)-n.cellPad;case"center":return(t.column.columnWidth-(e||0))/2;default:return n.cellPad}}function I(t){t.attr("transform",(function(t){var e=t.rowBlocks[0].auxiliaryBlocks.reduce((function(t,e){return t+O(e,1/0)}),0);return"translate(0 "+(O(R(t),t.key)+e)+")"})).selectAll("."+n.cn.cellRect).attr("height",(function(t){return(e=R(t),r=t.key,e.rows[r-e.firstRowIndex]).rowHeight;var e,r}))}function z(t,e){for(var r=0,n=e-1;n>=0;n--)r+=D(t[n]);return r}function O(t,e){for(var r=0,n=0;n","<","|","/","\\"],dflt:">",editType:"plot"},thickness:{valType:"number",min:12,editType:"plot"},textfont:u({},s.textfont,{}),editType:"calc"},text:s.text,textinfo:l.textinfo,texttemplate:a({editType:"plot"},{keys:c.eventDataKeys.concat(["label","value"])}),hovertext:s.hovertext,hoverinfo:l.hoverinfo,hovertemplate:n({},{keys:c.eventDataKeys}),textfont:s.textfont,insidetextfont:s.insidetextfont,outsidetextfont:u({},s.outsidetextfont,{}),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"top left",editType:"plot"},domain:o({name:"treemap",trace:!0,editType:"calc"})}},{"../../components/colorscale/attributes":622,"../../lib/extend":739,"../../plots/domain":824,"../../plots/template_attributes":875,"../pie/attributes":1129,"../sunburst/attributes":1266,"./constants":1295}],1293:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.name="treemap",r.plot=function(t,e,a,i){n.plotBasePlot(r.name,t,e,a,i)},r.clean=function(t,e,a,i){n.cleanBasePlot(r.name,t,e,a,i)}},{"../../plots/plots":860}],1294:[function(t,e,r){"use strict";var n=t("../sunburst/calc");r.calc=function(t,e){return n.calc(t,e)},r.crossTraceCalc=function(t){return n._runCrossTraceCalc("treemap",t)}},{"../sunburst/calc":1268}],1295:[function(t,e,r){"use strict";e.exports={CLICK_TRANSITION_TIME:750,CLICK_TRANSITION_EASING:"poly",eventDataKeys:["currentPath","root","entry","percentRoot","percentEntry","percentParent"],gapWithPathbar:1}},{}],1296:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),i=t("../../components/color"),o=t("../../plots/domain").defaults,s=t("../bar/defaults").handleText,l=t("../bar/constants").TEXTPAD,c=t("../../components/colorscale"),u=c.hasColorscale,h=c.handleDefaults;e.exports=function(t,e,r,c){function f(r,i){return n.coerce(t,e,a,r,i)}var p=f("labels"),d=f("parents");if(p&&p.length&&d&&d.length){var g=f("values");g&&g.length?f("branchvalues"):f("count"),f("level"),f("maxdepth"),"squarify"===f("tiling.packing")&&f("tiling.squarifyratio"),f("tiling.flip"),f("tiling.pad");var m=f("text");f("texttemplate"),e.texttemplate||f("textinfo",Array.isArray(m)?"text+label":"label"),f("hovertext"),f("hovertemplate");var v=f("pathbar.visible");s(t,e,c,f,"auto",{hasPathbar:v,moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),f("textposition");var y=-1!==e.textposition.indexOf("bottom");f("marker.line.width")&&f("marker.line.color",c.paper_bgcolor);var x=f("marker.colors"),b=e._hasColorscale=u(t,"marker","colors")||(t.marker||{}).coloraxis;b?h(t,e,c,f,{prefix:"marker.",cLetter:"c"}):f("marker.depthfade",!(x||[]).length);var _=2*e.textfont.size;f("marker.pad.t",y?_/4:_),f("marker.pad.l",_/4),f("marker.pad.r",_/4),f("marker.pad.b",y?_:_/4),b&&h(t,e,c,f,{prefix:"marker.",cLetter:"c"}),e._hovered={marker:{line:{width:2,color:i.contrast(c.paper_bgcolor)}}},v&&(f("pathbar.thickness",e.pathbar.textfont.size+2*l),f("pathbar.side"),f("pathbar.edgeshape")),o(e,c,f),e._length=null}else e.visible=!1}},{"../../components/color":615,"../../components/colorscale":627,"../../lib":749,"../../plots/domain":824,"../bar/constants":892,"../bar/defaults":894,"./attributes":1292}],1297:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/drawing"),o=t("../../lib/svg_text_utils"),s=t("./partition"),l=t("./style").styleOne,c=t("./constants"),u=t("../sunburst/helpers"),h=t("../sunburst/fx");e.exports=function(t,e,r,f,p){var d=p.barDifY,g=p.width,m=p.height,v=p.viewX,y=p.viewY,x=p.pathSlice,b=p.toMoveInsideSlice,_=p.strTransform,w=p.hasTransition,T=p.handleSlicesExit,k=p.makeUpdateSliceInterpolator,M=p.makeUpdateTextInterpolator,A={},S=t._fullLayout,E=e[0],C=E.trace,L=E.hierarchy,P=g/C._entryDepth,I=u.listPath(r.data,"id"),z=s(L.copy(),[g,m],{packing:"dice",pad:{inner:0,top:0,left:0,right:0,bottom:0}}).descendants();(z=z.filter((function(t){var e=I.indexOf(t.data.id);return-1!==e&&(t.x0=P*e,t.x1=P*(e+1),t.y0=d,t.y1=d+m,t.onPathbar=!0,!0)}))).reverse(),(f=f.data(z,u.getPtId)).enter().append("g").classed("pathbar",!0),T(f,!0,A,[g,m],x),f.order();var O=f;w&&(O=O.transition().each("end",(function(){var e=n.select(this);u.setSliceCursor(e,t,{hideOnRoot:!1,hideOnLeaves:!1,isTransitioning:!1})}))),O.each((function(s){s._hoverX=v(s.x1-Math.min(g,m)/2),s._hoverY=y(s.y1-m/2);var f=n.select(this),p=a.ensureSingle(f,"path","surface",(function(t){t.style("pointer-events","all")}));w?p.transition().attrTween("d",(function(t){var e=k(t,!0,A,[g,m]);return function(t){return x(e(t))}})):p.attr("d",x),f.call(h,r,t,e,{styleOne:l,eventDataKeys:c.eventDataKeys,transitionTime:c.CLICK_TRANSITION_TIME,transitionEasing:c.CLICK_TRANSITION_EASING}).call(u.setSliceCursor,t,{hideOnRoot:!1,hideOnLeaves:!1,isTransitioning:t._transitioning}),p.call(l,s,C,{hovered:!1}),s._text=(u.getPtLabel(s)||"").split("
").join(" ")||"";var d=a.ensureSingle(f,"g","slicetext"),T=a.ensureSingle(d,"text","",(function(t){t.attr("data-notex",1)})),E=a.ensureUniformFontSize(t,u.determineTextFont(C,s,S.font,{onPathbar:!0}));T.text(s._text||" ").classed("slicetext",!0).attr("text-anchor","start").call(i.font,E).call(o.convertToTspans,t),s.textBB=i.bBox(T.node()),s.transform=b(s,{fontSize:E.size,onPathbar:!0}),s.transform.fontSize=E.size,w?T.transition().attrTween("transform",(function(t){var e=M(t,!0,A,[g,m]);return function(t){return _(e(t))}})):T.attr("transform",_(s))}))}},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../sunburst/fx":1271,"../sunburst/helpers":1272,"./constants":1295,"./partition":1302,"./style":1304,d3:169}],1298:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/drawing"),o=t("../../lib/svg_text_utils"),s=t("./partition"),l=t("./style").styleOne,c=t("./constants"),u=t("../sunburst/helpers"),h=t("../sunburst/fx"),f=t("../sunburst/plot").formatSliceLabel;e.exports=function(t,e,r,p,d){var g=d.width,m=d.height,v=d.viewX,y=d.viewY,x=d.pathSlice,b=d.toMoveInsideSlice,_=d.strTransform,w=d.hasTransition,T=d.handleSlicesExit,k=d.makeUpdateSliceInterpolator,M=d.makeUpdateTextInterpolator,A=d.prevEntry,S=t._fullLayout,E=e[0].trace,C=-1!==E.textposition.indexOf("left"),L=-1!==E.textposition.indexOf("right"),P=-1!==E.textposition.indexOf("bottom"),I=!P&&!E.marker.pad.t||P&&!E.marker.pad.b,z=s(r,[g,m],{packing:E.tiling.packing,squarifyratio:E.tiling.squarifyratio,flipX:E.tiling.flip.indexOf("x")>-1,flipY:E.tiling.flip.indexOf("y")>-1,pad:{inner:E.tiling.pad,top:E.marker.pad.t,left:E.marker.pad.l,right:E.marker.pad.r,bottom:E.marker.pad.b}}).descendants(),O=1/0,D=-1/0;z.forEach((function(t){var e=t.depth;e>=E._maxDepth?(t.x0=t.x1=(t.x0+t.x1)/2,t.y0=t.y1=(t.y0+t.y1)/2):(O=Math.min(O,e),D=Math.max(D,e))})),p=p.data(z,u.getPtId),E._maxVisibleLayers=isFinite(D)?D-O+1:0,p.enter().append("g").classed("slice",!0),T(p,!1,{},[g,m],x),p.order();var R=null;if(w&&A){var F=u.getPtId(A);p.each((function(t){null===R&&u.getPtId(t)===F&&(R={x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1})}))}var B=function(){return R||{x0:0,x1:g,y0:0,y1:m}},N=p;return w&&(N=N.transition().each("end",(function(){var e=n.select(this);u.setSliceCursor(e,t,{hideOnRoot:!0,hideOnLeaves:!1,isTransitioning:!1})}))),N.each((function(s){var p=u.isHeader(s,E);s._hoverX=v(s.x1-E.marker.pad.r),s._hoverY=y(P?s.y1-E.marker.pad.b/2:s.y0+E.marker.pad.t/2);var d=n.select(this),T=a.ensureSingle(d,"path","surface",(function(t){t.style("pointer-events","all")}));w?T.transition().attrTween("d",(function(t){var e=k(t,!1,B(),[g,m]);return function(t){return x(e(t))}})):T.attr("d",x),d.call(h,r,t,e,{styleOne:l,eventDataKeys:c.eventDataKeys,transitionTime:c.CLICK_TRANSITION_TIME,transitionEasing:c.CLICK_TRANSITION_EASING}).call(u.setSliceCursor,t,{isTransitioning:t._transitioning}),T.call(l,s,E,{hovered:!1}),s.x0===s.x1||s.y0===s.y1?s._text="":s._text=p?I?"":u.getPtLabel(s)||"":f(s,r,E,e,S)||"";var A=a.ensureSingle(d,"g","slicetext"),z=a.ensureSingle(A,"text","",(function(t){t.attr("data-notex",1)})),O=a.ensureUniformFontSize(t,u.determineTextFont(E,s,S.font));z.text(s._text||" ").classed("slicetext",!0).attr("text-anchor",L?"end":C||p?"start":"middle").call(i.font,O).call(o.convertToTspans,t),s.textBB=i.bBox(z.node()),s.transform=b(s,{fontSize:O.size,isHeader:p}),s.transform.fontSize=O.size,w?z.transition().attrTween("transform",(function(t){var e=M(t,!1,B(),[g,m]);return function(t){return _(e(t))}})):z.attr("transform",_(s))})),R}},{"../../components/drawing":637,"../../lib":749,"../../lib/svg_text_utils":773,"../sunburst/fx":1271,"../sunburst/helpers":1272,"../sunburst/plot":1276,"./constants":1295,"./partition":1302,"./style":1304,d3:169}],1299:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"treemap",basePlotModule:t("./base_plot"),categories:[],animatable:!0,attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),style:t("./style").style,colorbar:t("../scatter/marker_colorbar"),meta:{}}},{"../scatter/marker_colorbar":1173,"./attributes":1292,"./base_plot":1293,"./calc":1294,"./defaults":1296,"./layout_attributes":1300,"./layout_defaults":1301,"./plot":1303,"./style":1304}],1300:[function(t,e,r){"use strict";e.exports={treemapcolorway:{valType:"colorlist",editType:"calc"},extendtreemapcolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{}],1301:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function r(r,i){return n.coerce(t,e,a,r,i)}r("treemapcolorway",e.colorway),r("extendtreemapcolors")}},{"../../lib":749,"./layout_attributes":1300}],1302:[function(t,e,r){"use strict";var n=t("d3-hierarchy");e.exports=function(t,e,r){var a,i=r.flipX,o=r.flipY,s="dice-slice"===r.packing,l=r.pad[o?"bottom":"top"],c=r.pad[i?"right":"left"],u=r.pad[i?"left":"right"],h=r.pad[o?"top":"bottom"];s&&(a=c,c=l,l=a,a=u,u=h,h=a);var f=n.treemap().tile(function(t,e){switch(t){case"squarify":return n.treemapSquarify.ratio(e);case"binary":return n.treemapBinary;case"dice":return n.treemapDice;case"slice":return n.treemapSlice;default:return n.treemapSliceDice}}(r.packing,r.squarifyratio)).paddingInner(r.pad.inner).paddingLeft(c).paddingRight(u).paddingTop(l).paddingBottom(h).size(s?[e[1],e[0]]:e)(t);return(s||i||o)&&function t(e,r,n){var a;n.swapXY&&(a=e.x0,e.x0=e.y0,e.y0=a,a=e.x1,e.x1=e.y1,e.y1=a);n.flipX&&(a=e.x0,e.x0=r[0]-e.x1,e.x1=r[0]-a);n.flipY&&(a=e.y0,e.y0=r[1]-e.y1,e.y1=r[1]-a);var i=e.children;if(i)for(var o=0;o-1?E+P:-(L+P):0,z={x0:C,x1:C,y0:I,y1:I+L},O=function(t,e,r){var n=m.tiling.pad,a=function(t){return t-n<=e.x0},i=function(t){return t+n>=e.x1},o=function(t){return t-n<=e.y0},s=function(t){return t+n>=e.y1};return{x0:a(t.x0-n)?0:i(t.x0-n)?r[0]:t.x0,x1:a(t.x1+n)?0:i(t.x1+n)?r[0]:t.x1,y0:o(t.y0-n)?0:s(t.y0-n)?r[1]:t.y0,y1:o(t.y1+n)?0:s(t.y1+n)?r[1]:t.y1}},D=null,R={},F={},B=null,N=function(t,e){return e?R[g(t)]:F[g(t)]},j=function(t,e,r,n){if(e)return R[g(v)]||z;var a=F[m.level]||r;return function(t){return t.data.depth-y.data.depth=(n-=v.r-o)){var y=(r+n)/2;r=y,n=y}var x;f?a<(x=i-v.b)&&x"===Q?(l.x-=i,c.x-=i,u.x-=i,h.x-=i):"/"===Q?(u.x-=i,h.x-=i,o.x-=i/2,s.x-=i/2):"\\"===Q?(l.x-=i,c.x-=i,o.x-=i/2,s.x-=i/2):"<"===Q&&(o.x-=i,s.x-=i),K(l),K(h),K(o),K(c),K(u),K(s),"M"+X(l.x,l.y)+"L"+X(c.x,c.y)+"L"+X(s.x,s.y)+"L"+X(u.x,u.y)+"L"+X(h.x,h.y)+"L"+X(o.x,o.y)+"Z"},toMoveInsideSlice:$,makeUpdateSliceInterpolator:et,makeUpdateTextInterpolator:rt,handleSlicesExit:nt,hasTransition:T,strTransform:at}):b.remove()}e.exports=function(t,e,r,i){var o,s,l=t._fullLayout,c=l._treemaplayer,f=!r;(u("treemap",l),(o=c.selectAll("g.trace.treemap").data(e,(function(t){return t[0].trace.uid}))).enter().append("g").classed("trace",!0).classed("treemap",!0),o.order(),!l.uniformtext.mode&&a.hasTransition(r))?(i&&(s=i()),n.transition().duration(r.duration).ease(r.easing).each("end",(function(){s&&s()})).each("interrupt",(function(){s&&s()})).each((function(){c.selectAll("g.trace").each((function(e){m(t,e,this,r)}))}))):(o.each((function(e){m(t,e,this,r)})),l.uniformtext.mode&&h(t,l._treemaplayer.selectAll(".trace"),"treemap"));f&&o.exit().remove()}},{"../../lib":749,"../bar/constants":892,"../bar/plot":901,"../bar/style":904,"../bar/uniform_text":906,"../sunburst/helpers":1272,"./constants":1295,"./draw_ancestors":1297,"./draw_descendants":1298,d3:169}],1304:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/color"),i=t("../../lib"),o=t("../sunburst/helpers"),s=t("../bar/uniform_text").resizeText;function l(t,e,r,n){var s,l,c=(n||{}).hovered,u=e.data.data,h=u.i,f=u.color,p=o.isHierarchyRoot(e),d=1;if(c)s=r._hovered.marker.line.color,l=r._hovered.marker.line.width;else if(p&&"rgba(0,0,0,0)"===f)d=0,s="rgba(0,0,0,0)",l=0;else if(s=i.castOption(r,h,"marker.line.color")||a.defaultLine,l=i.castOption(r,h,"marker.line.width")||0,!r._hasColorscale&&!e.onPathbar){var g=r.marker.depthfade;if(g){var m,v=a.combine(a.addOpacity(r._backgroundColor,.75),f);if(!0===g){var y=o.getMaxDepth(r);m=isFinite(y)?o.isLeaf(e)?0:r._maxVisibleLayers-(e.data.depth-r._entryDepth):e.data.height+1}else m=e.data.depth-r._entryDepth,r._atRootLevel||m++;if(m>0)for(var x=0;x0){var y,x,b,_,w,T=t.xa,k=t.ya;"h"===f.orientation?(w=e,y="y",b=k,x="x",_=T):(w=r,y="x",b=T,x="y",_=k);var M=h[t.index];if(w>=M.span[0]&&w<=M.span[1]){var A=n.extendFlat({},t),S=_.c2p(w,!0),E=o.getKdeValue(M,f,w),C=o.getPositionOnKdePath(M,f,S),L=b._offset,P=b._length;A[y+"0"]=C[0],A[y+"1"]=C[1],A[x+"0"]=A[x+"1"]=S,A[x+"Label"]=x+": "+a.hoverLabelText(_,w)+", "+h[0].t.labels.kde+" "+E.toFixed(3),A.spikeDistance=v[0].spikeDistance;var I=y+"Spike";A[I]=v[0][I],v[0].spikeDistance=void 0,v[0][I]=void 0,A.hovertemplate=!1,m.push(A),(u={stroke:t.color})[y+"1"]=n.constrain(L+C[0],L,L+P),u[y+"2"]=n.constrain(L+C[1],L,L+P),u[x+"1"]=u[x+"2"]=_._offset+S}}d&&(m=m.concat(v))}-1!==p.indexOf("points")&&(c=i.hoverOnPoints(t,e,r));var z=l.selectAll(".violinline-"+f.uid).data(u?[0]:[]);return z.enter().append("line").classed("violinline-"+f.uid,!0).attr("stroke-width",1.5),z.exit().remove(),z.attr(u),"closest"===s?c?[c]:m:c?(m.push(c),m):m}},{"../../lib":749,"../../plots/cartesian/axes":797,"../box/hover":920,"./helpers":1309}],1311:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("../box/defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../box/select"),moduleType:"trace",name:"violin",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":810,"../box/defaults":918,"../box/select":925,"../scatter/style":1178,"./attributes":1305,"./calc":1306,"./cross_trace_calc":1307,"./defaults":1308,"./hover":1310,"./layout_attributes":1312,"./layout_defaults":1313,"./plot":1314,"./style":1315}],1312:[function(t,e,r){"use strict";var n=t("../box/layout_attributes"),a=t("../../lib").extendFlat;e.exports={violinmode:a({},n.boxmode,{}),violingap:a({},n.boxgap,{}),violingroupgap:a({},n.boxgroupgap,{})}},{"../../lib":749,"../box/layout_attributes":922}],1313:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes"),i=t("../box/layout_defaults");e.exports=function(t,e,r){i._supply(t,e,r,(function(r,i){return n.coerce(t,e,a,r,i)}),"violin")}},{"../../lib":749,"../box/layout_defaults":923,"./layout_attributes":1312}],1314:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/drawing"),o=t("../box/plot"),s=t("../scatter/line_points"),l=t("./helpers");e.exports=function(t,e,r,c){var u=t._fullLayout,h=e.xaxis,f=e.yaxis;function p(t){var e=s(t,{xaxis:h,yaxis:f,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0,linearized:!0});return i.smoothopen(e[0],1)}a.makeTraceGroups(c,r,"trace violins").each((function(t){var r=n.select(this),i=t[0],s=i.t,c=i.trace;if(!0!==c.visible||s.empty)r.remove();else{var d=s.bPos,g=s.bdPos,m=e[s.valLetter+"axis"],v=e[s.posLetter+"axis"],y="both"===c.side,x=y||"positive"===c.side,b=y||"negative"===c.side,_=r.selectAll("path.violin").data(a.identity);_.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin"),_.exit().remove(),_.each((function(t){var e,r,a,i,o,l,h,f,_=n.select(this),w=t.density,T=w.length,k=v.c2l(t.pos+d,!0),M=v.l2p(k);if(c.width)e=s.maxKDE/g;else{var A=u._violinScaleGroupStats[c.scalegroup];e="count"===c.scalemode?A.maxKDE/g*(A.maxCount/t.pts.length):A.maxKDE/g}if(x){for(h=new Array(T),o=0;o")),c.color=function(t,e){var r=t[e.dir].marker,n=r.color,i=r.line.color,o=r.line.width;if(a(n))return n;if(a(i)&&o)return i}(h,d),[c]}function w(t){return n(p,t)}}},{"../../components/color":615,"../../constants/delta.js":718,"../../plots/cartesian/axes":797,"../bar/hover":897}],1327:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style").style,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("../bar/select"),moduleType:"trace",name:"waterfall",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":810,"../bar/select":902,"./attributes":1320,"./calc":1321,"./cross_trace_calc":1323,"./defaults":1324,"./event_data":1325,"./hover":1326,"./layout_attributes":1328,"./layout_defaults":1329,"./plot":1330,"./style":1331}],1328:[function(t,e,r){"use strict";e.exports={waterfallmode:{valType:"enumerated",values:["group","overlay"],dflt:"group",editType:"calc"},waterfallgap:{valType:"number",min:0,max:1,editType:"calc"},waterfallgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],1329:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){var i=!1;function o(r,i){return n.coerce(t,e,a,r,i)}for(var s=0;s0&&(m+=f?"M"+h[0]+","+d[1]+"V"+d[0]:"M"+h[1]+","+d[0]+"H"+h[0]),"between"!==p&&(r.isSum||s path").each((function(t){if(!t.isBlank){var e=s[t.dir].marker;n.select(this).call(i.fill,e.color).call(i.stroke,e.line.color).call(a.dashLine,e.line.dash,e.line.width).style("opacity",s.selectedpoints&&!t.selected?o:1)}})),c(r,s,t),r.selectAll(".lines").each((function(){var t=s.connector.line;a.lineGroupStyle(n.select(this).selectAll("path"),t.width,t.color,t.dash)}))}))}}},{"../../components/color":615,"../../components/drawing":637,"../../constants/interactions":723,"../bar/style":904,"../bar/uniform_text":906,d3:169}],1332:[function(t,e,r){"use strict";var n=t("../plots/cartesian/axes"),a=t("../lib"),i=t("../plot_api/plot_schema"),o=t("./helpers").pointsAccessorFunction,s=t("../constants/numerical").BADNUM;r.moduleType="transform",r.name="aggregate";var l=r.attributes={enabled:{valType:"boolean",dflt:!0,editType:"calc"},groups:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x",editType:"calc"},aggregations:{_isLinkedToArray:"aggregation",target:{valType:"string",editType:"calc"},func:{valType:"enumerated",values:["count","sum","avg","median","mode","rms","stddev","min","max","first","last","change","range"],dflt:"first",editType:"calc"},funcmode:{valType:"enumerated",values:["sample","population"],dflt:"sample",editType:"calc"},enabled:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},editType:"calc"},c=l.aggregations;function u(t,e,r,i){if(i.enabled){for(var o=i.target,l=a.nestedProperty(e,o),c=l.get(),u=function(t,e){var r=t.func,n=e.d2c,i=e.c2d;switch(r){case"count":return h;case"first":return f;case"last":return p;case"sum":return function(t,e){for(var r=0,a=0;aa&&(a=u,o=c)}}return a?i(o):s};case"rms":return function(t,e){for(var r=0,a=0,o=0;o":return function(t){return f(t)>s};case">=":return function(t){return f(t)>=s};case"[]":return function(t){var e=f(t);return e>=s[0]&&e<=s[1]};case"()":return function(t){var e=f(t);return e>s[0]&&e=s[0]&&es[0]&&e<=s[1]};case"][":return function(t){var e=f(t);return e<=s[0]||e>=s[1]};case")(":return function(t){var e=f(t);return es[1]};case"](":return function(t){var e=f(t);return e<=s[0]||e>s[1]};case")[":return function(t){var e=f(t);return e=s[1]};case"{}":return function(t){return-1!==s.indexOf(f(t))};case"}{":return function(t){return-1===s.indexOf(f(t))}}}(r,i.getDataToCoordFunc(t,e,s,a),f),x={},b={},_=0;d?(m=function(t){x[t.astr]=n.extendDeep([],t.get()),t.set(new Array(h))},v=function(t,e){var r=x[t.astr][e];t.get()[e]=r}):(m=function(t){x[t.astr]=n.extendDeep([],t.get()),t.set([])},v=function(t,e){var r=x[t.astr][e];t.get().push(r)}),k(m);for(var w=o(e.transforms,r),T=0;T1?"%{group} (%{trace})":"%{group}");var l=t.styles,c=o.styles=[];if(l)for(i=0;i=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)}},{}],542:[function(t,e,r){(function(t){(function(){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],543:[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];(l=o-((r=a+o)-a))&&(t[--n]=r,r=l)}var s=0;for(i=n;i>1;return["sum(",t(e.slice(0,r)),",",t(e.slice(r)),")"].join("")}(e);var n}function u(t){return new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",c(l(t)),")};return robustDeterminant",t].join(""))(i,a,n,o)}var f=[function(){return[0]},function(t){return[t[0][0]]}];!function(){for(;f.length<6;)f.push(u(f.length));for(var t=[],r=["function robustDeterminant(m){switch(m.length){"],n=0;n<6;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);for(e.exports=i.apply(void 0,f.concat([f,u])),n=0;n>1;return["sum(",l(t.slice(0,e)),",",l(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 u(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 a=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];!function(){for(;a.length<6;)a.push(i(a.length));for(var t=[],r=["function dispatchLinearSolve(A,b){switch(A.length){"],n=0;n<6;++n)t.push("s"+n),r.push("case ",n,":return s",n,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);for(e.exports=o.apply(void 0,a.concat([a,i])),n=0;n<6;++n)e.exports[n]=a[n]}()},{"robust-determinant":544}],548:[function(t,e,r){"use strict";var n=t("two-product"),i=t("robust-sum"),a=t("robust-scale"),o=t("robust-subtract");function s(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",l(t.slice(0,e)),",",l(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=33306690738754716e-32*n;return o>=s||o<=-s?o:f(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],c=r[1]-n[1],u=t[2]-n[2],f=e[2]-n[2],p=r[2]-n[2],d=a*c,g=o*l,m=o*s,v=i*c,y=i*l,x=a*s,b=u*(d-g)+f*(m-v)+p*(y-x),_=7771561172376103e-31*((Math.abs(d)+Math.abs(g))*Math.abs(u)+(Math.abs(m)+Math.abs(v))*Math.abs(f)+(Math.abs(y)+Math.abs(x))*Math.abs(p));return b>_||-b>_?b:h(t,e,r,n)}];function d(t){var e=p[t.length];return e||(e=p[t.length]=u(t.length)),e.apply(void 0,t)}!function(){for(;p.length<=5;)p.push(u(p.length));for(var t=[],r=["slow"],n=0;n<=5;++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<=5;++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),c=r[i],u=n[i],f=Math.min(c,u);if(Math.max(c,u)=n?(i=f,(l+=1)=n?(i=f,(l+=1)0?1:0}},{}],555:[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":100,"reduce-simplicial-complex":533}],556:[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(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 u(t,e){for(var r=new Array(t.length),i=0,o=r.length;i=t.length||0!==a(t[m],s)););}return r}function f(t,e){if(e<0)return[];for(var r=[],i=(1<>>u&1&&c.push(i[u]);e.push(c)}return s(e)},r.skeleton=f,r.boundary=function(t){for(var e=[],r=0,n=t.length;r>1:(t>>1)-1}function x(t){for(var e=v(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(n0;){var r=y(t);if(r>=0)if(e0){var t=k[0];return m(0,A-1),A-=1,x(0),t}return-1}function w(t,e){var r=k[t];return c[r]===e?t:(c[r]=-1/0,b(t),_(),c[r]=e,b((A+=1)-1))}function T(t){if(!u[t]){u[t]=!0;var e=s[t],r=l[t];s[r]>=0&&(s[r]=e),l[e]>=0&&(l[e]=r),M[e]>=0&&w(M[e],g(e)),M[r]>=0&&w(M[r],g(r))}}var k=[],M=new Array(a);for(f=0;f>1;f>=0;--f)x(f);for(;;){var S=_();if(S<0||c[S]>r)break;T(S)}var E=[];for(f=0;f=0&&r>=0&&e!==r){var n=M[e],i=M[r];n!==i&&L.push([n,i])}})),i.unique(i.normalize(L)),{positions:E,edges:L}};var n=t("robust-orientation"),i=t("simplicial-complex")},{"robust-orientation":548,"simplicial-complex":560}],563:[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),c=n(r,a,o);if(l<0){if(c<=0)return l}else if(l>0){if(c>=0)return l}else if(c)return c;if(l=n(s,o,a),c=n(s,o,r),l<0){if(c<=0)return l}else if(l>0){if(c>=0)return l}else if(c)return c;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]),c=Math.min(e[0][1],e[1][1]),u=Math.max(e[0][1],e[1][1]);return lu?s-u:l-u}r=e[1],i=e[0]}t[0][1]0)if(e[0]!==o[1][0])r=t,t=t.right;else{if(l=c(t.right,e))return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l;if(l=c(t.right,e))return l;t=t.left}}return r}function u(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=c(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 u=c(this.slabs[e-1],t);u&&(s?o(u.key,s)>0&&(s=u.key,i=u.value):(i=u.value,s=u.key))}var f=this.horizontal[e];if(f.length>0){var h=n.ge(f,t[1],l);if(h=f.length)return i;p=f[h]}}if(p.start)if(s){var d=a(s[0],s[1],[t[0],p.y]);s[0][0]>s[1][0]&&(d=-d),d>0&&(i=p.index)}else i=p.index;else p.y!==t[1]&&(i=p.index)}}}return i}},{"./lib/order-segments":563,"binary-search-bounds":564,"functional-red-black-tree":247,"robust-orientation":548}],566:[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&&u<0){var f=o(s,u,l,i);r.push(f),n.push(f.slice())}u<0?n.push(l.slice()):u>0?r.push(l.slice()):(r.push(l.slice()),n.push(l.slice())),i=u}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&&c<0)&&r.push(o(i,c,s,n)),c>=0&&r.push(s.slice()),n=c}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&&c<0)&&r.push(o(i,c,s,n)),c<=0&&r.push(s.slice()),n=c}return r}},{"robust-dot-product":545,"robust-sum":553}],567:[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(t){return i(o(t),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}function i(r,n){var i,a,o,s,l,c,u,f,h,p=1,d=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,"")),c=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",u=s.width-(h+i).length,l=s.width&&u>0?c.repeat(u):"",g+=s.align?h+i+l:"0"===c?h+l+i:l+h+i)}return g}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var r,n=e,i=[],o=0;n;){if(null!==(r=t.text.exec(n)))i.push(r[0]);else if(null!==(r=t.modulo.exec(n)))i.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],c=[];if(null===(c=t.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(c[1]);""!==(l=l.substring(c[0].length));)if(null!==(c=t.key_access.exec(l)))s.push(c[1]);else{if(null===(c=t.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(c[1])}r[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");i.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 a[e]=i}"undefined"!=typeof r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],568:[function(t,e,r){"use strict";var n=t("parenthesis");e.exports=function(t,e,r){if(null==t)throw Error("First argument should be a string");if(null==e)throw Error("Separator should be a string or a RegExp");r?("string"==typeof r||Array.isArray(r))&&(r={ignore:r}):r={},null==r.escape&&(r.escape=!0),null==r.ignore?r.ignore=["[]","()","{}","<>",'""',"''","``","\u201c\u201d","\xab\xbb"]:("string"==typeof r.ignore&&(r.ignore=[r.ignore]),r.ignore=r.ignore.map((function(t){return 1===t.length&&(t+=t),t})));var i=n.parse(t,{flat:!0,brackets:r.ignore}),a=i[0].split(e);if(r.escape){for(var o=[],s=0;s0;){e=c[c.length-1];var p=t[e];if(a[e]=0&&s[e].push(o[g])}a[e]=d}else{if(n[e]===r[e]){var m=[],v=[],y=0;for(d=l.length-1;d>=0;--d){var x=l[d];if(i[x]=!1,m.push(x),v.push(s[x]),y+=s[x].length,o[x]=f.length,x===e){l.length=d;break}}f.push(m);var b=new Array(y);for(d=0;d c)|0 },"),"generic"===e&&a.push("getters:[0],");for(var s=[],l=[],c=0;c>>7){");for(c=0;c<1<<(1<128&&c%128==0){f.length>0&&h.push("}}");var p="vExtra"+f.length;a.push("case ",c>>>7,":",p,"(m&0x7f,",l.join(),");break;"),h=["function ",p,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&c,":");for(var d=new Array(r),g=new Array(r),m=new Array(r),v=new Array(r),y=0,x=0;xx)&&!(c&1<<_)!=!(c&1<0&&(M="+"+m[b]+"*c");var A=d[b].length/y*.5,S=.5+v[b]/y*.5;k.push("d"+b+"-"+S+"-"+A+"*("+d[b].join("+")+M+")/("+g[b].join("+")+")")}h.push("a.push([",k.join(),"]);","break;")}a.push("}},"),f.length>0&&h.push("}}");var E=[];for(c=0;c<1<1&&(i=1),i<-1&&(i=-1),(t*n-e*r<0?-1:1)*Math.acos(i)};r.default=function(t){var e=t.px,r=t.py,l=t.cx,c=t.cy,u=t.rx,f=t.ry,h=t.xAxisRotation,p=void 0===h?0:h,d=t.largeArcFlag,g=void 0===d?0:d,m=t.sweepFlag,v=void 0===m?0:m,y=[];if(0===u||0===f)return[];var x=Math.sin(p*i/360),b=Math.cos(p*i/360),_=b*(e-l)/2+x*(r-c)/2,w=-x*(e-l)/2+b*(r-c)/2;if(0===_&&0===w)return[];u=Math.abs(u),f=Math.abs(f);var T=Math.pow(_,2)/Math.pow(u,2)+Math.pow(w,2)/Math.pow(f,2);T>1&&(u*=Math.sqrt(T),f*=Math.sqrt(T));var k=function(t,e,r,n,a,o,l,c,u,f,h,p){var d=Math.pow(a,2),g=Math.pow(o,2),m=Math.pow(h,2),v=Math.pow(p,2),y=d*g-d*v-g*m;y<0&&(y=0),y/=d*v+g*m;var x=(y=Math.sqrt(y)*(l===c?-1:1))*a/o*p,b=y*-o/a*h,_=f*x-u*b+(t+r)/2,w=u*x+f*b+(e+n)/2,T=(h-x)/a,k=(p-b)/o,M=(-h-x)/a,A=(-p-b)/o,S=s(1,0,T,k),E=s(T,k,M,A);return 0===c&&E>0&&(E-=i),1===c&&E<0&&(E+=i),[_,w,S,E]}(e,r,l,c,u,f,g,v,x,b,_,w),M=n(k,4),A=M[0],S=M[1],E=M[2],C=M[3],L=Math.abs(C)/(i/4);Math.abs(1-L)<1e-7&&(L=1);var I=Math.max(Math.ceil(L),1);C/=I;for(var P=0;Pe[2]&&(e[2]=c[u+0]),c[u+1]>e[3]&&(e[3]=c[u+1]);return e}},{"abs-svg-path":65,assert:73,"is-svg-path":471,"normalize-svg-path":573,"parse-svg-path":505}],573:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=[],o=0,s=0,l=0,c=0,u=null,f=null,h=0,p=0,d=0,g=t.length;d4?(o=m[m.length-4],s=m[m.length-3]):(o=h,s=p),r.push(m)}return r};var n=t("svg-arc-to-cubic-bezier");function i(t,e,r,n){return["C",t,e,r,n,r,n]}function a(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}},{"svg-arc-to-cubic-bezier":571}],574:[function(t,e,r){"use strict";var n,i=t("svg-path-bounds"),a=t("parse-svg-path"),o=t("draw-svg-path"),s=t("is-svg-path"),l=t("bitmap-sdf"),c=document.createElement("canvas"),u=c.getContext("2d");e.exports=function(t,e){if(!s(t))throw Error("Argument should be valid svg path string");e||(e={});var r,f;e.shape?(r=e.shape[0],f=e.shape[1]):(r=c.width=e.w||e.width||200,f=c.height=e.h||e.height||200);var h=Math.min(r,f),p=e.stroke||0,d=e.viewbox||e.viewBox||i(t),g=[r/(d[2]-d[0]),f/(d[3]-d[1])],m=Math.min(g[0]||0,g[1]||0)/2;u.fillStyle="black",u.fillRect(0,0,r,f),u.fillStyle="white",p&&("number"!=typeof p&&(p=1),u.strokeStyle=p>0?"white":"black",u.lineWidth=Math.abs(p));if(u.translate(.5*r,.5*f),u.scale(m,m),function(){if(null!=n)return n;var t=document.createElement("canvas").getContext("2d");if(t.canvas.width=t.canvas.height=1,!window.Path2D)return n=!1;var e=new Path2D("M0,0h1v1h-1v-1Z");t.fillStyle="black",t.fill(e);var r=t.getImageData(0,0,1,1);return n=r&&r.data&&255===r.data[3]}()){var v=new Path2D(t);u.fill(v),p&&u.stroke(v)}else{var y=a(t);o(u,y),u.fill(),p&&u.stroke()}return u.setTransform(1,0,0,1,0,0),l(u,{cutoff:null!=e.cutoff?e.cutoff:.5,radius:null!=e.radius?e.radius:.5*h})}},{"bitmap-sdf":98,"draw-svg-path":174,"is-svg-path":471,"parse-svg-path":505,"svg-path-bounds":572}],575:[function(t,e,r){(function(r){(function(){"use strict";e.exports=function t(e,r,i){i=i||{};var o=a[e];o||(o=a[e]={" ":{data:new Float32Array(0),shape:.2}});var s=o[r];if(!s)if(r.length<=1||!/\d/.test(r))s=o[r]=function(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),i=0,a=0,o=0;o0&&(f+=.02);var p=new Float32Array(u),d=0,g=-.5*f;for(h=0;h1&&(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=L(t,360),e=L(e,100),r=L(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,u),f=!0,h="hsl"),e.hasOwnProperty("a")&&(a=e.a));var p,d,g;return a=C(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=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=a(100*this._a)/100,this._format=l.format||u.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=u.ok,this._tc_id=i++}function u(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=s(t,e,r),l=o(t,e,r),c=(a+l)/2;if(a==l)n=i=0;else{var u=a-l;switch(i=c>.5?u/(2-a-l):u/(a+l),a){case t:n=(e-r)/u+(e>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(c(n));return a}function A(t,e){e=e||6;for(var r=c(t).toHsv(),n=r.h,i=r.s,a=r.v,o=[],s=1/e;e--;)o.push(c({h:n,s:i,v:a})),a=(a+s)%1;return o}c.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=C(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=u(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=u(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=[z(a(t).toString(16)),z(a(e).toString(16)),z(a(r).toString(16)),z(D(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*L(this._r,255))+"%",g:a(100*L(this._g,255))+"%",b:a(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*L(this._r,255))+"%, "+a(100*L(this._g,255))+"%, "+a(100*L(this._b,255))+"%)":"rgba("+a(100*L(this._r,255))+"%, "+a(100*L(this._g,255))+"%, "+a(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(E[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+p(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=c(t);r="#"+p(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 c(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(v,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(T,arguments)}},c.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:O(t[n]));t=r}return c(t,e)},c.equals=function(t,e){return!(!t||!e)&&c(t).toRgbString()==c(e).toRgbString()},c.random=function(){return c.fromRatio({r:l(),g:l(),b:l()})},c.mix=function(t,e,r){r=0===r?0:r||50;var n=c(t).toRgb(),i=c(e).toRgb(),a=r/100;return c({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})},c.readability=function(e,r){var n=c(e),i=c(r);return(t.max(n.getLuminance(),i.getLuminance())+.05)/(t.min(n.getLuminance(),i.getLuminance())+.05)},c.isReadable=function(t,e,r){var n,i,a=c.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},c.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 u=0;ul&&(l=n,s=c(e[u]));return c.isReadable(t,s,{level:a,size:o})||!i?s:(r.includeFallbackColors=!1,c.mostReadable(t,["#fff","#000"],r))};var S=c.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"},E=c.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(S);function C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(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 I(t){return o(1,s(0,t))}function P(t){return parseInt(t,16)}function z(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function D(e){return t.round(255*parseFloat(e)).toString(16)}function R(t){return P(t)/255}var F,B,N,j=(B="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",N="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+B),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+B),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+B),hsva:new RegExp("hsva"+N),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!!j.CSS_UNIT.exec(t)}"undefined"!=typeof e&&e.exports?e.exports=c:window.tinycolor=c}(Math)},{}],577:[function(t,e,r){"use strict";e.exports=i,e.exports.float32=e.exports.float=i,e.exports.fract32=e.exports.fract=function(t){if(t.length){for(var e=i(t),r=0,n=e.length;ro&&(o=t[0]),t[1]s&&(s=t[1])}function c(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"Point":l(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(l)}}for(e in t.arcs.forEach((function(t){for(var e,r=-1,l=t.length;++ro&&(o=e[0]),e[1]s&&(s=e[1])})),t.objects)c(t.objects[e]);return[i,a,o,s]}function i(t,e){var r=e.id,n=e.bbox,i=null==e.properties?{}:e.properties,o=a(t,e);return null==r&&null==n?{type:"Feature",properties:i,geometry:o}:null==n?{type:"Feature",id:r,properties:i,geometry:o}:{type:"Feature",id:r,bbox:n,properties:i,geometry:o}}function a(t,e){var n=r(t.transform),i=t.arcs;function a(t,e){e.length&&e.pop();for(var r=i[t<0?~t:t],a=0,o=r.length;a1)n=l(t,e,r);else for(i=0,n=new Array(a=t.arcs.length);i1)for(var a,s,c=1,u=l(i[0]);cu&&(s=i[0],i[0]=i[c],i[c]=s,u=a);return i})).filter((function(t){return t.length>0}))}}function u(t,e){for(var r=0,n=t.length;r>>1;t[i]=2))throw new Error("n must be \u22652");var r,i=(l=t.bbox||n(t))[0],a=l[1],o=l[2],s=l[3];e={scale:[o-i?(o-i)/(r-1):1,s-a?(s-a)/(r-1):1],translate:[i,a]}}var l,c,u=f(e),h=t.objects,p={};function d(t){return u(t)}function g(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(g)};break;case"Point":e={type:"Point",coordinates:d(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(d)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(c in h)p[c]=g(h[c]);return{type:"Topology",bbox:l,transform:e,objects:p,arcs:t.arcs.map((function(t){var e,r=0,n=1,i=t.length,a=new Array(i);for(a[0]=u(t[0],0);++rMath.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 c=0;c<16;++c)this.computedMatrix[c]=.5;this.recalcMatrix(0)}var p=h.prototype;p.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},p.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])]},p.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),u=0;for(a=0;a<3;++a)r[a]-=e[a]*i/n,u+=r[a]*r[a],e[a]/=l;var f=Math.sqrt(u);for(a=0;a<3;++a)r[a]/=f;var h=this.computedToward;o(h,e,r),s(h,h);var p=Math.exp(this.computedRadius[0]),d=this.computedAngle[0],g=this.computedAngle[1],m=Math.cos(d),v=Math.sin(d),y=Math.cos(g),x=Math.sin(g),b=this.computedCenter,_=m*y,w=v*y,T=x,k=-m*x,M=-v*x,A=y,S=this.computedEye,E=this.computedMatrix;for(a=0;a<3;++a){var C=_*r[a]+w*h[a]+T*e[a];E[4*a+1]=k*r[a]+M*h[a]+A*e[a],E[4*a+2]=C,E[4*a+3]=0}var L=E[1],I=E[5],P=E[9],z=E[2],O=E[6],D=E[10],R=I*D-P*O,F=P*z-L*D,B=L*O-I*z,N=c(R,F,B);R/=N,F/=N,B/=N,E[0]=R,E[4]=F,E[8]=B;for(a=0;a<3;++a)S[a]=b[a]+E[2+4*a]*p;for(a=0;a<3;++a){u=0;for(var j=0;j<3;++j)u+=E[a+4*j]*S[j];E[12+a]=-u}E[15]=1},p.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 d=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;d[0]=i[2],d[1]=i[6],d[2]=i[10];for(var o=this.computedUp,s=this.computedRight,l=this.computedToward,c=0;c<3;++c)i[4*c]=o[c],i[4*c+1]=s[c],i[4*c+2]=l[c];a(i,i,n,d);for(c=0;c<3;++c)o[c]=i[4*c],s[c]=i[4*c+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,s[0],s[1],s[2])}},p.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=c(a,o,s);a/=l,o/=l,s/=l;var u=i[0],f=i[4],h=i[8],p=u*a+f*o+h*s,d=c(u-=a*p,f-=o*p,h-=s*p),g=(u/=d)*e+a*r,m=(f/=d)*e+o*r,v=(h/=d)*e+s*r;this.center.move(t,g,m,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+n),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.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),p=Math.abs(l),d=Math.abs(f),g=Math.max(h,p,d);h===g?(s=s<0?-1:1,l=f=0):d===g?(f=f<0?-1:1,s=l=0):(l=l<0?-1:1,s=f=0)}else{var m=c(s,l,f);s/=m,l/=m,f/=m}var v,y,x=e[o],b=e[o+4],_=e[o+8],w=x*s+b*l+_*f,T=c(x-=s*w,b-=l*w,_-=f*w),k=l*(_/=T)-f*(b/=T),M=f*(x/=T)-s*_,A=s*b-l*x,S=c(k,M,A);if(k/=S,M/=S,A/=S,this.center.jump(t,H,G,Y),this.radius.idle(t),this.up.jump(t,s,l,f),this.right.jump(t,x,b,_),2===a){var E=e[1],C=e[5],L=e[9],I=E*x+C*b+L*_,P=E*k+C*M+L*A;v=R<0?-Math.PI/2:Math.PI/2,y=Math.atan2(P,I)}else{var z=e[2],O=e[6],D=e[10],R=z*s+O*l+D*f,F=z*x+O*b+D*_,B=z*k+O*M+D*A;v=Math.asin(u(R)),y=Math.atan2(B,F)}this.angle.jump(t,y,v),this.recalcMatrix(t);var N=e[2],j=e[6],U=e[10],V=this.computedMatrix;i(V,e);var q=V[15],H=V[12]/q,G=V[13]/q,Y=V[14]/q,W=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*W,G-j*W,Y-U*W)},p.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},p.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},p.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.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=c(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],p=c(l,f,h);if(!(p<1e-6)){l/=p,f/=p,h/=p;var d=this.computedRight,g=d[0],m=d[1],v=d[2],y=i*g+a*m+o*v,x=c(g-=y*i,m-=y*a,v-=y*o);if(!(x<.01&&(x=c(g=a*h-o*f,m=o*l-i*h,v=i*f-a*l))<1e-6)){g/=x,m/=x,v/=x,this.up.set(t,i,a,o),this.right.set(t,g,m,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(p));var b=a*v-o*m,_=o*g-i*v,w=i*m-a*g,T=c(b,_,w),k=i*l+a*f+o*h,M=g*l+m*f+v*h,A=(b/=T)*l+(_/=T)*f+(w/=T)*h,S=Math.asin(u(k)),E=Math.atan2(A,M),C=this.angle._state,L=C[C.length-1],I=C[C.length-2];L%=2*Math.PI;var P=Math.abs(L+2*Math.PI-E),z=Math.abs(L-E),O=Math.abs(L-2*Math.PI-E);P":(e.length>100&&(e=e.slice(0,99)+"\u2026"),e=e.replace(i,(function(t){switch(t){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}})))}},{"./safe-to-string":586}],588:[function(t,e,r){"use strict";var n=t("../value/is"),i={object:!0,function:!0,undefined:!0};e.exports=function(t){return!!n(t)&&hasOwnProperty.call(i,typeof t)}},{"../value/is":594}],589:[function(t,e,r){"use strict";var n=t("../lib/resolve-exception"),i=t("./is");e.exports=function(t){return i(t)?t:n(t,"%v is not a plain function",arguments[1])}},{"../lib/resolve-exception":585,"./is":590}],590:[function(t,e,r){"use strict";var n=t("../function/is"),i=/^\s*class[\s{/}]/,a=Function.prototype.toString;e.exports=function(t){return!!n(t)&&!i.test(a.call(t))}},{"../function/is":584}],591:[function(t,e,r){"use strict";var n=t("../object/is");e.exports=function(t){if(!n(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t}catch(t){return!1}}},{"../object/is":588}],592:[function(t,e,r){"use strict";var n=t("../value/is"),i=t("../object/is"),a=Object.prototype.toString;e.exports=function(t){if(!n(t))return null;if(i(t)){var e=t.toString;if("function"!=typeof e)return null;if(e===a)return null}try{return""+t}catch(t){return null}}},{"../object/is":588,"../value/is":594}],593:[function(t,e,r){"use strict";var n=t("../lib/resolve-exception"),i=t("./is");e.exports=function(t){return i(t)?t:n(t,"Cannot use %v",arguments[1])}},{"../lib/resolve-exception":585,"./is":594}],594:[function(t,e,r){"use strict";e.exports=function(t){return null!=t}},{}],595:[function(t,e,r){(function(e){(function(){"use strict";var n=t("bit-twiddle"),i=t("dup"),a=t("buffer").Buffer;e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:i([32,0]),UINT16:i([32,0]),UINT32:i([32,0]),BIGUINT64:i([32,0]),INT8:i([32,0]),INT16:i([32,0]),INT32:i([32,0]),BIGINT64:i([32,0]),FLOAT:i([32,0]),DOUBLE:i([32,0]),DATA:i([32,0]),UINT8C:i([32,0]),BUFFER:i([32,0])});var o="undefined"!=typeof Uint8ClampedArray,s="undefined"!=typeof BigUint64Array,l="undefined"!=typeof BigInt64Array,c=e.__TYPEDARRAY_POOL;c.UINT8C||(c.UINT8C=i([32,0])),c.BIGUINT64||(c.BIGUINT64=i([32,0])),c.BIGINT64||(c.BIGINT64=i([32,0])),c.BUFFER||(c.BUFFER=i([32,0]));var u=c.DATA,f=c.BUFFER;function h(t){if(t){var e=t.length||t.byteLength,r=n.log2(e);u[r].push(t)}}function p(t){t=n.nextPow2(t);var e=n.log2(t),r=u[e];return r.length>0?r.pop():new ArrayBuffer(t)}function d(t){return new Uint8Array(p(t),0,t)}function g(t){return new Uint16Array(p(2*t),0,t)}function m(t){return new Uint32Array(p(4*t),0,t)}function v(t){return new Int8Array(p(t),0,t)}function y(t){return new Int16Array(p(2*t),0,t)}function x(t){return new Int32Array(p(4*t),0,t)}function b(t){return new Float32Array(p(4*t),0,t)}function _(t){return new Float64Array(p(8*t),0,t)}function w(t){return o?new Uint8ClampedArray(p(t),0,t):d(t)}function T(t){return s?new BigUint64Array(p(8*t),0,t):null}function k(t){return l?new BigInt64Array(p(8*t),0,t):null}function M(t){return new DataView(p(t),0,t)}function A(t){t=n.nextPow2(t);var e=n.log2(t),r=f[e];return r.length>0?r.pop():new a(t)}r.free=function(t){if(a.isBuffer(t))f[n.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|n.log2(e);u[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeBigUint64=r.freeInt8=r.freeInt16=r.freeInt32=r.freeBigInt64=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){h(t.buffer)},r.freeArrayBuffer=h,r.freeBuffer=function(t){f[n.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return p(t);switch(e){case"uint8":return d(t);case"uint16":return g(t);case"uint32":return m(t);case"int8":return v(t);case"int16":return y(t);case"int32":return x(t);case"float":case"float32":return b(t);case"double":case"float64":return _(t);case"uint8_clamped":return w(t);case"bigint64":return k(t);case"biguint64":return T(t);case"buffer":return A(t);case"data":case"dataview":return M(t);default:return null}return null},r.mallocArrayBuffer=p,r.mallocUint8=d,r.mallocUint16=g,r.mallocUint32=m,r.mallocInt8=v,r.mallocInt16=y,r.mallocInt32=x,r.mallocFloat32=r.mallocFloat=b,r.mallocFloat64=r.mallocDouble=_,r.mallocUint8Clamped=w,r.mallocBigUint64=T,r.mallocBigInt64=k,r.mallocDataView=M,r.mallocBuffer=A,r.clearCache=function(){for(var t=0;t<32;++t)c.UINT8[t].length=0,c.UINT16[t].length=0,c.UINT32[t].length=0,c.INT8[t].length=0,c.INT16[t].length=0,c.INT32[t].length=0,c.FLOAT[t].length=0,c.DOUBLE[t].length=0,c.BIGUINT64[t].length=0,c.BIGINT64[t].length=0,c.UINT8C[t].length=0,u[t].length=0,f[t].length=0}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":97,buffer:111,dup:176}],596:[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",h(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(p=0;p-1?parseInt(t[1+i]):0,l=a>-1?parseInt(r[1+a]):0;s!==l&&(n=n.replace(S(),"?px "),m*=Math.pow(.75,l-s),n=n.replace("?px ",S())),g+=.25*x*(l-s)}if(!0===o.superscripts){var c=t.indexOf("+"),u=r.indexOf("+"),f=c>-1?parseInt(t[1+c]):0,h=u>-1?parseInt(r[1+u]):0;f!==h&&(n=n.replace(S(),"?px "),m*=Math.pow(.75,h-f),n=n.replace("?px ",S())),g-=.25*x*(h-f)}if(!0===o.bolds){var p=t.indexOf("b|")>-1,d=r.indexOf("b|")>-1;!p&&d&&(n=v?n.replace("italic ","italic bold "):"bold "+n),p&&!d&&(n=n.replace("bold ",""))}if(!0===o.italics){var v=t.indexOf("i|")>-1,y=r.indexOf("i|")>-1;!v&&y&&(n="italic "+n),v&&!y&&(n=n.replace("italic ",""))}e.font=n}for(h=0;h",a="",o=i.length,s=a.length,l="+"===e[0]||"-"===e[0],c=0,u=-s;c>-1&&-1!==(c=r.indexOf(i,c))&&-1!==(u=r.indexOf(a,c+o))&&!(u<=c);){for(var f=c;f=u)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 p=c+o,d=r.substr(p,u-p).indexOf(i);c=-1!==d?d:u+s}return n}function u(t,e){var r=n(t,128);return e?a(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function f(t,e,r,n){var i=u(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:y((function(e){var n=v(e);return n?r in n:t.indexOf(e)>=0}))},set___:{value:y((function(n,i){var a,o=v(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:y((function(n){var i,a,o=v(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)}))}})};d.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 d||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 d),i.set(t,e)),this}:function(t,e){if(a)try{n.set(t,e)}catch(r){i||(i=new d),i.set___(t,e)}else n.set(t,e);return this},Object.create(d.prototype,{get___:{value:y((function(t,e){return i?n.has(t)?n.get(t):i.get___(t,e):n.get(t,e)}))},has___:{value:y((function(t){return n.has(t)||!!i&&i.has___(t)}))},set___:{value:y(e)},delete___:{value:y((function(t){var e=!!n.delete(t);return i&&i.delete___(t)||e}))},permitHostObjects___:{value:y((function(t){if(t!==g)throw new Error("bogus call to permitHostObjects___");a=!0}))}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=d.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=d)}function g(t){t.permitHostObjects___&&t.permitHostObjects___(g)}function m(t){return!("weakmap:"==t.substr(0,"weakmap:".length)&&"___"===t.substr(t.length-3))}function v(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[l];if(e&&e.key===t)return e;if(s(t)){e={key:t};try{return o(t,l,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function y(t){return t.prototype=null,Object.freeze(t)}function x(){h||"undefined"==typeof console||(h=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},{}],603:[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":604}],604:[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}},{}],605:[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":603}],606:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":249}],607:[function(t,e,r){var n=t("../main"),i=t("object-assign"),a=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,i(o.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,e){if("string"==typeof t){var r=t.match(l);return r?r[0]:""}var n=this._validateYear(t),i=t.month(),a=""+this.toChineseMonth(n,i);return e&&a.length<2&&(a="0"+a),this.isIntercalaryMonth(n,i)&&(a+="i"),a},monthNames:function(t){if("string"==typeof t){var e=t.match(c);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),i=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"][this.toChineseMonth(r,n)-1];return this.isIntercalaryMonth(r,n)&&(i="\u95f0"+i),i},monthNamesShort:function(t){if("string"==typeof t){var e=t.match(u);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),i=["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"][this.toChineseMonth(r,n)-1];return this.isIntercalaryMonth(r,n)&&(i="\u95f0"+i),i},parseMonth:function(t,e){t=this._validateYear(t);var r,n=parseInt(e);if(isNaN(n))"\u95f0"===e[0]&&(r=!0,e=e.substring(1)),"\u6708"===e[e.length-1]&&(e=e.substring(0,e.length-1)),n=1+["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"].indexOf(e);else{var i=e[e.length-1];r="i"===i||"I"===i}return this.toMonthIndex(t,n,r)},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(t,e){if(t.year&&(t=t.year()),"number"!=typeof t||t<1888||t>2111)throw e.replace(/\{0\}/,this.local.name);return t},toMonthIndex:function(t,e,r){var i=this.intercalaryMonth(t);if(r&&e!==i||e<1||e>12)throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return i?!r&&e<=i?e-1:e:e-1},toChineseMonth:function(t,e){t.year&&(e=(t=t.year()).month());var r=this.intercalaryMonth(t);if(e<0||e>(r?12:11))throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return r?e>13},isIntercalaryMonth:function(t,e){t.year&&(e=(t=t.year()).month());var r=this.intercalaryMonth(t);return!!r&&r===e},leapYear:function(t){return 0!==this.intercalaryMonth(t)},weekOfYear:function(t,e,r){var i,o=this._validateYear(t,n.local.invalidyear),s=h[o-h[0]],l=s>>9&4095,c=s>>5&15,u=31&s;(i=a.newDate(l,c,u)).add(4-(i.dayOfWeek()||7),"d");var f=this.toJD(t,e,r)-i.toJD();return 1+Math.floor(f/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(t,e){t.year&&(e=t.month(),t=t.year()),t=this._validateYear(t);var r=f[t-f[0]];if(e>(r>>13?12:11))throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return r&1<<12-e?30:29},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,s,r,n.local.invalidDate);t=this._validateYear(i.year()),e=i.month(),r=i.day();var o=this.isIntercalaryMonth(t,e),s=this.toChineseMonth(t,e),l=function(t,e,r,n,i){var a,o,s;if("object"==typeof t)o=t,a=e||{};else{var l;if(!("number"==typeof t&&t>=1888&&t<=2111))throw new Error("Lunar year outside range 1888-2111");if(!("number"==typeof e&&e>=1&&e<=12))throw new Error("Lunar month outside range 1 - 12");if(!("number"==typeof r&&r>=1&&r<=30))throw new Error("Lunar day outside range 1 - 30");"object"==typeof n?(l=!1,a=n):(l=!!n,a=i||{}),o={year:t,month:e,day:r,isIntercalary:l}}s=o.day-1;var c,u=f[o.year-f[0]],p=u>>13;c=p&&(o.month>p||o.isIntercalary)?o.month:o.month-1;for(var d=0;d>9&4095,(g>>5&15)-1,(31&g)+s);return a.year=m.getFullYear(),a.month=1+m.getMonth(),a.day=m.getDate(),a}(t,s,r,o);return a.toJD(l.year,l.month,l.day)},fromJD:function(t){var e=a.fromJD(t),r=function(t,e,r,n){var i,a;if("object"==typeof t)i=t,a=e||{};else{if(!("number"==typeof t&&t>=1888&&t<=2111))throw new Error("Solar year outside range 1888-2111");if(!("number"==typeof e&&e>=1&&e<=12))throw new Error("Solar month outside range 1 - 12");if(!("number"==typeof r&&r>=1&&r<=31))throw new Error("Solar day outside range 1 - 31");i={year:t,month:e,day:r},a=n||{}}var o=h[i.year-h[0]],s=i.year<<9|i.month<<5|i.day;a.year=s>=o?i.year:i.year-1,o=h[a.year-h[0]];var l,c=new Date(o>>9&4095,(o>>5&15)-1,31&o),u=new Date(i.year,i.month-1,i.day);l=Math.round((u-c)/864e5);var p,d=f[a.year-f[0]];for(p=0;p<13;p++){var g=d&1<<12-p?30:29;if(l>13;!m||p=2&&n<=6},extraInfo:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return{century:o[Math.floor((i.year()-1)/100)+1]||""}},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return t=i.year()+(i.year()<0?1:0),e=i.month(),(r=i.day())+(e>1?16:0)+(e>2?32*(e-2):0)+400*(t-1)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t+.5)-Math.floor(this.jdEpoch)-1;var e=Math.floor(t/400)+1;t-=400*(e-1),t+=t>15?16:0;var r=Math.floor(t/32)+1,n=t-32*(r-1)+1;return this.newDate(e<=0?e-1:e,r,n)}});var o={20:"Fruitbat",21:"Anchovy"};n.calendars.discworld=a},{"../main":621,"object-assign":499}],610:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return(t=e.year()+(e.year()<0?1:0))%4==3||t%4==-1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear),13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(13===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return(t=i.year())<0&&t++,i.day()+30*(i.month()-1)+365*(t-1)+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch,r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;r<=0&&r--,e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1,i=e-30*(n-1)+1;return this.newDate(r,n,i)}}),n.calendars.ethiopian=a},{"../main":621,"object-assign":499}],611:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function o(t,e){return t-e*Math.floor(t/e)}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return this._leapYear(e.year())},_leapYear:function(t){return o(7*(t=t<0?t+1:t)+1,19)<7},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),this._leapYear(t.year?t.year():t)?13:12},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year(),this.toJD(-1===t?1:t+1,7,1)-this.toJD(t,7,1)},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,n.local.invalidMonth),12===e&&this.leapYear(t)||8===e&&5===o(this.daysInYear(t),10)?30:9===e&&3===o(this.daysInYear(t),10)?29:this.daysPerMonth[e-1]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},extraInfo:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return{yearType:(this.leapYear(i)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(i)%10-3]}},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=i.year(),e=i.month(),r=i.day();var a=t<=0?t+1:t,o=this.jdEpoch+this._delay1(a)+this._delay2(a)+r+1;if(e<7){for(var s=7;s<=this.monthsInYear(t);s++)o+=this.daysInMonth(t,s);for(s=1;s=this.toJD(-1===e?1:e+1,7,1);)e++;for(var r=tthis.toJD(e,r,this.daysInMonth(e,r));)r++;var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),n.calendars.hebrew=a},{"../main":621,"object-assign":499}],612:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(t){return(11*this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year()+14)%30<11},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return this.leapYear(t)?355:354},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return t=i.year(),e=i.month(),t=t<=0?t+1:t,(r=i.day())+Math.ceil(29.5*(e-1))+354*(t-1)+Math.floor((3+11*t)/30)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=Math.floor((30*(t-this.jdEpoch)+10646)/10631);e=e<=0?e-1:e;var r=Math.min(12,Math.ceil((t-29-this.toJD(e,1,1))/29.5)+1),n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),n.calendars.islamic=a},{"../main":621,"object-assign":499}],613:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return(t=e.year()<0?e.year()+1:e.year())%4==0},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return t=i.year(),e=i.month(),r=i.day(),t<0&&t++,e<=2&&(t--,e+=12),Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r-1524.5},fromJD:function(t){var e=Math.floor(t+.5)+1524,r=Math.floor((e-122.1)/365.25),n=Math.floor(365.25*r),i=Math.floor((e-n)/30.6001),a=i-Math.floor(i<14?1:13),o=r-Math.floor(a>2?4716:4715),s=e-n-Math.floor(30.6001*i);return o<=0&&o--,this.newDate(o,a,s)}}),n.calendars.julian=a},{"../main":621,"object-assign":499}],614:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function o(t,e){return t-e*Math.floor(t/e)}function s(t,e){return o(t-1,e)+1}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),!1},formatYear:function(t){t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year();var e=Math.floor(t/400);return t%=400,t+=t<0?400:0,e+"."+Math.floor(t/20)+"."+t%20},forYear:function(t){if((t=t.split(".")).length<3)throw"Invalid Mayan year";for(var e=0,r=0;r19||r>0&&n<0)throw"Invalid Mayan year";e=20*e+n}return e},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),18},weekOfYear:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate),0},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),360},daysInMonth:function(t,e){return this._validate(t,e,this.minDay,n.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate).day()},weekDay:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate),!0},extraInfo:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate).toJD(),a=this._toHaab(i),o=this._toTzolkin(i);return{haabMonthName:this.local.haabMonths[a[0]-1],haabMonth:a[0],haabDay:a[1],tzolkinDayName:this.local.tzolkinMonths[o[0]-1],tzolkinDay:o[0],tzolkinTrecena:o[1]}},_toHaab:function(t){var e=o((t-=this.jdEpoch)+8+340,365);return[Math.floor(e/20)+1,o(e,20)]},_toTzolkin:function(t){return[s((t-=this.jdEpoch)+20,20),s(t+4,13)]},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return i.day()+20*i.month()+360*i.year()+this.jdEpoch},fromJD:function(t){t=Math.floor(t)+.5-this.jdEpoch;var e=Math.floor(t/360);t%=360,t+=t<0?360:0;var r=Math.floor(t/20),n=t%20;return this.newDate(e,r,n)}}),n.calendars.mayan=a},{"../main":621,"object-assign":499}],615:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar;var o=n.instance("gregorian");i(a.prototype,{name:"Nanakshahi",jdEpoch:2257673.5,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return o.leapYear(e.year()+(e.year()<1?1:0)+1469)},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(1-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidMonth);(t=i.year())<0&&t++;for(var a=i.day(),s=1;s=this.toJD(e+1,1,1);)e++;for(var r=t-Math.floor(this.toJD(e,1,1)+.5)+1,n=1;r>this.daysInMonth(e,n);)r-=this.daysInMonth(e,n),n++;return this.newDate(e,n,r)}}),n.calendars.nanakshahi=a},{"../main":621,"object-assign":499}],616:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){if(t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year(),"undefined"==typeof this.NEPALI_CALENDAR_DATA[t])return this.daysPerYear;for(var e=0,r=this.minMonth;r<=12;r++)e+=this.NEPALI_CALENDAR_DATA[t][r];return e},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,n.local.invalidMonth),"undefined"==typeof this.NEPALI_CALENDAR_DATA[t]?this.daysPerMonth[e-1]:this.NEPALI_CALENDAR_DATA[t][e]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=i.year(),e=i.month(),r=i.day();var a=n.instance(),o=0,s=e,l=t;this._createMissingCalendarData(t);var c=t-(s>9||9===s&&r>=this.NEPALI_CALENDAR_DATA[l][0]?56:57);for(9!==e&&(o=r,s--);9!==s;)s<=0&&(s=12,l--),o+=this.NEPALI_CALENDAR_DATA[l][s],s--;return 9===e?(o+=r-this.NEPALI_CALENDAR_DATA[l][0])<0&&(o+=a.daysInYear(c)):o+=this.NEPALI_CALENDAR_DATA[l][9]-this.NEPALI_CALENDAR_DATA[l][0],a.newDate(c,1,1).add(o,"d").toJD()},fromJD:function(t){var e=n.instance().fromJD(t),r=e.year(),i=e.dayOfYear(),a=r+56;this._createMissingCalendarData(a);for(var o=9,s=this.NEPALI_CALENDAR_DATA[a][0],l=this.NEPALI_CALENDAR_DATA[a][o]-s+1;i>l;)++o>12&&(o=1,a++),l+=this.NEPALI_CALENDAR_DATA[a][o];var c=this.NEPALI_CALENDAR_DATA[a][o]-(l-i);return this.newDate(a,o,c)},_createMissingCalendarData:function(t){var e=this.daysPerMonth.slice(0);e.unshift(17);for(var r=t-1;r0?474:473))%2820+474+38)%2816<682},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-(n.dayOfWeek()+1)%7,"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=i.year(),e=i.month(),r=i.day();var a=t-(t>=0?474:473),s=474+o(a,2820);return r+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*s-110)/2816)+365*(s-1)+1029983*Math.floor(a/2820)+this.jdEpoch-1},fromJD:function(t){var e=(t=Math.floor(t)+.5)-this.toJD(475,1,1),r=Math.floor(e/1029983),n=o(e,1029983),i=2820;if(1029982!==n){var a=Math.floor(n/366),s=o(n,366);i=Math.floor((2134*a+2816*s+2815)/1028522)+a+1}var l=i+2820*r+474;l=l<=0?l-1:l;var c=t-this.toJD(l,1,1)+1,u=c<=186?Math.ceil(c/31):Math.ceil((c-6)/30),f=t-this.toJD(l,u,1)+1;return this.newDate(l,u,f)}}),n.calendars.persian=a,n.calendars.jalali=a},{"../main":621,"object-assign":499}],618:[function(t,e,r){var n=t("../main"),i=t("object-assign"),a=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,i(o.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(e.year());return a.leapYear(t)},weekOfYear:function(t,e,r){var i=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(i.year());return a.weekOfYear(t,i.month(),i.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=this._t2gYear(i.year());return a.toJD(t,i.month(),i.day())},fromJD:function(t){var e=a.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)},_g2tYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)}}),n.calendars.taiwan=o},{"../main":621,"object-assign":499}],619:[function(t,e,r){var n=t("../main"),i=t("object-assign"),a=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,i(o.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(e.year());return a.leapYear(t)},weekOfYear:function(t,e,r){var i=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(i.year());return a.weekOfYear(t,i.month(),i.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=this._t2gYear(i.year());return a.toJD(t,i.month(),i.day())},fromJD:function(t){var e=a.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)},_g2tYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)}}),n.calendars.thai=o},{"../main":621,"object-assign":499}],620:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return 355===this.daysInYear(e.year())},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){for(var e=0,r=1;r<=12;r++)e+=this.daysInMonth(t,r);return e},daysInMonth:function(t,e){for(var r=this._validate(t,e,this.minDay,n.local.invalidMonth).toJD()-24e5+.5,i=0,a=0;ar)return o[i]-o[i-1];i++}return 30},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate),a=12*(i.year()-1)+i.month()-15292;return i.day()+o[a-1]-1+24e5-.5},fromJD:function(t){for(var e=t-24e5+.5,r=0,n=0;ne);n++)r++;var i=r+15292,a=Math.floor((i-1)/12),s=a+1,l=i-12*a,c=e-o[r-1]+1;return this.newDate(s,l,c)},isValid:function(t,e,r){var i=n.baseCalendar.prototype.isValid.apply(this,arguments);return i&&(i=(t=null!=t.year?t.year:t)>=1276&&t<=1500),i},_validate:function(t,e,r,i){var a=n.baseCalendar.prototype._validate.apply(this,arguments);if(a.year<1276||a.year>1500)throw i.replace(/\{0\}/,this.local.name);return a}}),n.calendars.ummalqura=a;var o=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},{"../main":621,"object-assign":499}],621:[function(t,e,r){var n=t("object-assign");function i(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function a(t,e,r,n){if(this._calendar=t,this._year=e,this._month=r,this._day=n,0===this._calendar._validateLevel&&!this._calendar.isValid(this._year,this._month,this._day))throw(c.local.invalidDate||c.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function o(t,e){return"000000".substring(0,e-(t=""+t).length)+t}function s(){this.shortYearCutoff="+10"}function l(t){this.local=this.regionalOptions[t]||this.regionalOptions[""]}n(i.prototype,{instance:function(t,e){t=(t||"gregorian").toLowerCase(),e=e||"";var r=this._localCals[t+"-"+e];if(!r&&this.calendars[t]&&(r=new this.calendars[t](e),this._localCals[t+"-"+e]=r),!r)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,t);return r},newDate:function(t,e,r,n,i){return(n=(null!=t&&t.year?t.calendar():"string"==typeof n?this.instance(n,i):n)||this.instance()).newDate(t,e,r)},substituteDigits:function(t){return function(e){return(e+"").replace(/[0-9]/g,(function(e){return t[e]}))}},substituteChineseDigits:function(t,e){return function(r){for(var n="",i=0;r>0;){var a=r%10;n=(0===a?"":t[a]+e[i])+n,i++,r=Math.floor(r/10)}return 0===n.indexOf(t[1]+e[1])&&(n=n.substr(1)),n||t[0]}}}),n(a.prototype,{newDate:function(t,e,r){return this._calendar.newDate(null==t?this:t,e,r)},year:function(t){return 0===arguments.length?this._year:this.set(t,"y")},month:function(t){return 0===arguments.length?this._month:this.set(t,"m")},day:function(t){return 0===arguments.length?this._day:this.set(t,"d")},date:function(t,e,r){if(!this._calendar.isValid(t,e,r))throw(c.local.invalidDate||c.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=t,this._month=e,this._day=r,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(t,e){return this._calendar.add(this,t,e)},set:function(t,e){return this._calendar.set(this,t,e)},compareTo:function(t){if(this._calendar.name!==t._calendar.name)throw(c.local.differentCalendars||c.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,t._calendar.local.name);var e=this._year!==t._year?this._year-t._year:this._month!==t._month?this.monthOfYear()-t.monthOfYear():this._day-t._day;return 0===e?0:e<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(t){return this._calendar.fromJD(t)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(t){return this._calendar.fromJSDate(t)},toString:function(){return(this.year()<0?"-":"")+o(Math.abs(this.year()),4)+"-"+o(this.month(),2)+"-"+o(this.day(),2)}}),n(s.prototype,{_validateLevel:0,newDate:function(t,e,r){return null==t?this.today():(t.year&&(this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),r=t.day(),e=t.month(),t=t.year()),new a(this,t,e,r))},today:function(){return this.fromJSDate(new Date)},epoch:function(t){return this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear).year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear);return(e.year()<0?"-":"")+o(Math.abs(e.year()),4)},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear),12},monthOfYear:function(t,e){var r=this._validate(t,e,this.minDay,c.local.invalidMonth||c.regionalOptions[""].invalidMonth);return(r.month()+this.monthsInYear(r)-this.firstMonth)%this.monthsInYear(r)+this.minMonth},fromMonthOfYear:function(t,e){var r=(e+this.firstMonth-2*this.minMonth)%this.monthsInYear(t)+this.minMonth;return this._validate(t,r,this.minDay,c.local.invalidMonth||c.regionalOptions[""].invalidMonth),r},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear);return this.leapYear(e)?366:365},dayOfYear:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate);return n.toJD()-this.newDate(n.year(),this.fromMonthOfYear(n.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,e,r){return this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),{}},add:function(t,e,r){return this._validate(t,this.minMonth,this.minDay,c.local.invalidDate||c.regionalOptions[""].invalidDate),this._correctAdd(t,this._add(t,e,r),e,r)},_add:function(t,e,r){if(this._validateLevel++,"d"===r||"w"===r){var n=t.toJD()+e*("w"===r?this.daysInWeek():1),i=t.calendar().fromJD(n);return this._validateLevel--,[i.year(),i.month(),i.day()]}try{var a=t.year()+("y"===r?e:0),o=t.monthOfYear()+("m"===r?e:0);i=t.day();"y"===r?(t.month()!==this.fromMonthOfYear(a,o)&&(o=this.newDate(a,t.month(),this.minDay).monthOfYear()),o=Math.min(o,this.monthsInYear(a)),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o)))):"m"===r&&(!function(t){for(;oe-1+t.minMonth;)a++,o-=e,e=t.monthsInYear(a)}(this),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o))));var s=[a,this.fromMonthOfYear(a,o),i];return this._validateLevel--,s}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,e,r,n){if(!(this.hasYearZero||"y"!==n&&"m"!==n||0!==e[0]&&t.year()>0==e[0]>0)){var i={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n],a=r<0?-1:1;e=this._add(t,r*i[0]+a*i[1],i[2])}return t.date(e[0],e[1],e[2])},set:function(t,e,r){this._validate(t,this.minMonth,this.minDay,c.local.invalidDate||c.regionalOptions[""].invalidDate);var n="y"===r?e:t.year(),i="m"===r?e:t.month(),a="d"===r?e:t.day();return"y"!==r&&"m"!==r||(a=Math.min(a,this.daysInMonth(n,i))),t.date(n,i,a)},isValid:function(t,e,r){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var i=this.newDate(t,e,this.minDay);n=e>=this.minMonth&&e-this.minMonth=this.minDay&&r-this.minDay13.5?13:1),c=i-(l>2.5?4716:4715);return c<=0&&c--,this.newDate(c,l,s)},toJSDate:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),i=new Date(n.year(),n.month()-1,n.day());return i.setHours(0),i.setMinutes(0),i.setSeconds(0),i.setMilliseconds(0),i.setHours(i.getHours()>12?i.getHours()+2:0),i},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var c=e.exports=new i;c.cdate=a,c.baseCalendar=s,c.calendars.gregorian=l},{"object-assign":499}],622:[function(t,e,r){var n=t("object-assign"),i=t("./main");n(i.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),i.local=i.regionalOptions[""],n(i.cdate.prototype,{formatDate:function(t,e){return"string"!=typeof t&&(e=t,t=""),this._calendar.formatDate(t||"",this,e)}}),n(i.baseCalendar.prototype,{UNIX_EPOCH:i.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:i.instance().jdEpoch,TICKS_PER_DAY:864e9,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,e,r){if("string"!=typeof t&&(r=e,e=t,t=""),!e)return"";if(e.calendar()!==this)throw i.local.invalidFormat||i.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat;for(var n,a,o,s,l=(r=r||{}).dayNamesShort||this.local.dayNamesShort,c=r.dayNames||this.local.dayNames,u=r.monthNumbers||this.local.monthNumbers,f=r.monthNamesShort||this.local.monthNamesShort,h=r.monthNames||this.local.monthNames,p=(r.calculateWeek||this.local.calculateWeek,function(e,r){for(var n=1;w+n1}),d=function(t,e,r,n){var i=""+e;if(p(t,n))for(;i.length1},x=function(t,r){var n=y(t,r),a=[2,3,n?4:2,n?4:2,10,11,20]["oyYJ@!".indexOf(t)+1],o=new RegExp("^-?\\d{1,"+a+"}"),s=e.substring(M).match(o);if(!s)throw(i.local.missingNumberAt||i.regionalOptions[""].missingNumberAt).replace(/\{0\}/,M);return M+=s[0].length,parseInt(s[0],10)},b=this,_=function(){if("function"==typeof l){y("m");var t=l.call(b,e.substring(M));return M+=t.length,t}return x("m")},w=function(t,r,n,a){for(var o=y(t,a)?n:r,s=0;s-1){p=1,d=g;for(var E=this.daysInMonth(h,p);d>E;E=this.daysInMonth(h,p))p++,d-=E}return f>-1?this.fromJD(f):this.newDate(h,p,d)},determineDate:function(t,e,r,n,i){r&&"object"!=typeof r&&(i=n,n=r,r=null),"string"!=typeof n&&(i=n,n="");var a=this;return e=e?e.newDate():null,t=null==t?e:"string"==typeof t?function(t){try{return a.parseDate(n,t,i)}catch(t){}for(var e=((t=t.toLowerCase()).match(/^c/)&&r?r.newDate():null)||a.today(),o=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,s=o.exec(t);s;)e.add(parseInt(s[1],10),s[2]||"d"),s=o.exec(t);return e}(t):"number"==typeof t?isNaN(t)||t===1/0||t===-1/0?e:a.today().add(t,"d"):a.newDate(t)}})},{"./main":621,"object-assign":499}],623:[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":151}],624:[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":623}],625:[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}]},{}],626:[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;t("../../constants/axis_placeable_objects");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"}}})},{"../../constants/axis_placeable_objects":746,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833,"../../plots/font_attributes":855,"./arrow_paths":625}],627:[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),a=i.getRefType(e.xref),o=i.getRefType(e.yref);e._extremes={},"range"===a&&s(e,r),"range"===o&&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"],c=t["a"+a+"ref"],u=t["_"+a+"padplus"],f=t["_"+a+"padminus"],h={x:1,y:-1}[a]*t[a+"shift"],p=3*t.arrowsize*t.arrowwidth||0,d=p+h,g=p-h,m=3*t.startarrowsize*t.arrowwidth||0,v=m+h,y=m-h;if(c===l){var x=i.findExtremes(e,[e.r2c(o)],{ppadplus:d,ppadminus:g}),b=i.findExtremes(e,[e.r2c(s)],{ppadplus:Math.max(u,v),ppadminus:Math.max(f,y)});r={min:[x.min[0],b.min[0]],max:[x.max[0],b.max[0]]}}else v=s?v+s:v,y=s?y-s:y,r=i.findExtremes(e,[e.r2c(o)],{ppadplus:Math.max(u,d,v),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":778,"../../plots/cartesian/axes":827,"./draw":632}],628:[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,c,u=t._fullLayout.annotations,f=[],h=[],p=[],d=(e||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(t,e){var r,s,l=o(t,e),c=l.on,u=l.off.concat(l.explicitOff),f={},h=t._fullLayout.annotations;if(!c.length&&!u.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}for(var W=!1,X=["x","y"],Z=0;Z1)&&(nt===rt?((pt=it.r2fraction(e["a"+et]))<0||pt>1)&&(W=!0):W=!0),J=it._offset+it.r2p(e[et]),$=.5}else{var dt="domain"===ht;"x"===et?(Q=e[et],J=dt?it._offset+it._length*Q:J=T.l+T.w*Q):(Q=1-e[et],J=dt?it._offset+it._length*Q:J=T.t+T.h*Q),$=e.showarrow?.5:Q}if(e.showarrow){ft.head=J;var gt=e["a"+et];if(tt=ot*H(.5,e.xanchor)-st*H(.5,e.yanchor),nt===rt){var mt=l.getRefType(nt);"domain"===mt?("y"===et&&(gt=1-gt),ft.tail=it._offset+it._length*gt):"paper"===mt?"y"===et?(gt=1-gt,ft.tail=T.t+T.h*gt):ft.tail=T.l+T.w*gt:ft.tail=it._offset+it.r2p(gt),K=tt}else ft.tail=J+gt,K=tt+gt;ft.text=ft.tail+tt;var vt=w["x"===et?"width":"height"];if("paper"===rt&&(ft.head=o.constrain(ft.head,1,vt-1)),"pixel"===nt){var yt=-Math.max(ft.tail-3,ft.text),xt=Math.min(ft.tail+3,ft.text)-vt;yt>0?(ft.tail+=yt,ft.text+=yt):xt>0&&(ft.tail-=xt,ft.text-=xt)}ft.tail+=ut,ft.head+=ut}else K=tt=lt*H($,ct),ft.text=J+tt;ft.text+=ut,tt+=ut,K+=ut,e["_"+et+"padplus"]=lt/2+K,e["_"+et+"padminus"]=lt/2-K,e["_"+et+"size"]=lt,e["_"+et+"shift"]=tt}if(W)R.remove();else{var bt=0,_t=0;if("left"!==e.align&&(bt=(M-b)*("center"===e.align?.5:1)),"top"!==e.valign&&(_t=(D-_)*("middle"===e.valign?.5:1)),f)n.select("svg").attr({x:N+bt-1,y:N+_t}).call(u.setClipUrl,U?C:null,t);else{var wt=N+_t-g.top,Tt=N+bt-g.left;G.call(h.positionText,Tt,wt).call(u.setClipUrl,U?C:null,t)}V.select("rect").call(u.setRect,N,N,M,D),j.call(u.setRect,F/2,F/2,B-F,q-F),R.call(u.setTranslate,Math.round(L.x.text-B/2),Math.round(L.y.text-q/2)),z.attr({transform:"rotate("+I+","+L.x.text+","+L.y.text+")"});var kt,Mt=function(r,n){P.selectAll(".annotation-arrow-g").remove();var l=L.x.head,f=L.y.head,h=L.x.tail+r,p=L.y.tail+n,g=L.x.text+r,b=L.y.text+n,_=o.rotationXYMatrix(I,g,b),w=o.apply2DTransform(_),M=o.apply2DTransform2(_),C=+j.attr("width"),O=+j.attr("height"),D=g-.5*C,F=D+C,B=b-.5*O,N=B+O,U=[[D,B,D,N],[D,N,F,N],[F,N,F,B],[F,B,D,B]].map(M);if(!U.reduce((function(t,e){return t^!!o.segmentsIntersect(l,f,l+1e6,f+1e6,e[0],e[1],e[2],e[3])}),!1)){U.forEach((function(t){var e=o.segmentsIntersect(h,p,l,f,t[0],t[1],t[2],t[3]);e&&(h=e.x,p=e.y)}));var V=e.arrowwidth,q=e.arrowcolor,H=e.arrowside,G=P.append("g").style({opacity:c.opacity(q)}).classed("annotation-arrow-g",!0),Y=G.append("path").attr("d","M"+h+","+p+"L"+l+","+f).style("stroke-width",V+"px").call(c.stroke,c.rgb(q));if(m(Y,H,e),k.annotationPosition&&Y.node().parentNode&&!a){var W=l,X=f;if(e.standoff){var Z=Math.sqrt(Math.pow(l-h,2)+Math.pow(f-p,2));W+=e.standoff*(h-l)/Z,X+=e.standoff*(p-f)/Z}var J,K,Q=G.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-W)+","+(p-X),transform:s(W,X)}).style("stroke-width",V+6+"px").call(c.stroke,"rgba(0,0,0,0)").call(c.fill,"rgba(0,0,0,0)");d.init({element:Q.node(),gd:t,prepFn:function(){var t=u.getTranslate(R);J=t.x,K=t.y,v&&v.autorange&&A(v._name+".autorange",!0),x&&x.autorange&&A(x._name+".autorange",!0)},moveFn:function(t,r){var n=w(J,K),i=n[0]+t,a=n[1]+r;R.call(u.setTranslate,i,a),S("x",y(v,t,"x",T,e)),S("y",y(x,r,"y",T,e)),e.axref===e.xref&&S("ax",y(v,t,"ax",T,e)),e.ayref===e.yref&&S("ay",y(x,r,"ay",T,e)),G.attr("transform",s(t,r)),z.attr({transform:"rotate("+I+","+i+","+a+")"})},doneFn:function(){i.call("_guiRelayout",t,E());var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&Mt(0,0),O)d.init({element:R.node(),gd:t,prepFn:function(){kt=z.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?S("ax",y(v,t,"ax",T,e)):S("ax",e.ax+t),e.ayref===e.yref?S("ay",y(x,r,"ay",T.w,e)):S("ay",e.ay+r),Mt(t,r);else{if(a)return;var i,o;if(v)i=y(v,t,"x",T,e);else{var l=e._xsize/T.w,c=e.x+(e._xshift-e.xshift)/T.w-l/2;i=d.align(c+t/T.w,l,0,1,e.xanchor)}if(x)o=y(x,r,"y",T,e);else{var u=e._ysize/T.h,f=e.y-(e._yshift+e.yshift)/T.h-u/2;o=d.align(f-r/T.h,u,0,1,e.yanchor)}S("x",i),S("y",o),v&&x||(n=d.getCursor(v?.5:i,x?.5:o,e.xanchor,e.yanchor))}z.attr({transform:s(t,r)+kt}),p(R,n)},clickFn:function(r,n){e.captureevents&&t.emit("plotly_clickannotation",Y(n))},doneFn:function(){p(R),i.call("_guiRelayout",t,E());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,x=e.indexOf("end")>=0,b=d.backoff*m+r.standoff,_=g.backoff*v+r.startstandoff;if("line"===p.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},u={x:+t.attr("x2"),y:+t.attr("y2")};var w=o.x-u.x,T=o.y-u.y;if(h=(f=Math.atan2(T,w))+Math.PI,b&&_&&b+_>Math.sqrt(w*w+T*T))return void O();if(b){if(b*b>w*w+T*T)return void O();var k=b*Math.cos(f),M=b*Math.sin(f);u.x+=k,u.y+=M,t.attr({x2:u.x,y2:u.y})}if(_){if(_*_>w*w+T*T)return void O();var A=_*Math.cos(f),S=_*Math.sin(f);o.x-=A,o.y-=S,t.attr({x1:o.x,y1:o.y})}}else if("path"===p.nodeName){var E=p.getTotalLength(),C="";if(E1){c=!0;break}}c?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":878,"../annotations/draw":632}],639:[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?n>=l:n<=l));i++)n>u&&n0?n>=l:n<=l));i++)n>r[0]&&n1){var J=Math.pow(10,Math.floor(Math.log(Z)/Math.LN10));W*=J*c.roundUp(Z/J,[2,5,10]),(Math.abs(L.start)/L.size+1e-6)%1<2e-6&&(Y.tick0=0)}Y.dtick=W}Y.domain=[q+j,q+F-j],Y.setScale(),t.attr("transform",u(Math.round(l.l),Math.round(l.t)));var K,Q=t.select("."+M.cbtitleunshift).attr("transform",u(-Math.round(l.l),-Math.round(l.t))),$=t.select("."+M.cbaxis),tt=0;function et(n,i){var a={propContainer:Y,propName:e._propPrefix+"title",traceIndex:e._traceIndex,_meta:e._meta,placeholder:o._dfltTitle.colorbar,containerGroup:t.select("."+M.cbtitle)},s="h"===n.charAt(0)?n.substr(1):"h"+n;t.selectAll("."+s+",."+s+"-math-group").remove(),g.draw(r,n,f(a,i||{}))}return c.syncOrAsync([a.previousPromises,function(){if(-1!==["top","bottom"].indexOf(A)){var t,r=l.l+(e.x+B)*l.w,n=Y.title.font.size;t="top"===A?(1-(q+F-j))*l.h+l.t+3+.75*n:(1-(q+j))*l.h+l.t-3-.25*n,et(Y._id+"title",{attributes:{x:r,y:t,"text-anchor":"start"}})}},function(){if(-1!==["top","bottom"].indexOf(A)){var a=t.select("."+M.cbtitle),o=a.select("text"),f=[-e.outlinewidth/2,e.outlinewidth/2],h=a.select(".h"+Y._id+"title-math-group").node(),d=15.6;if(o.node()&&(d=parseInt(o.node().style.fontSize,10)*w),h?(tt=p.bBox(h).height)>d&&(f[1]-=(tt-d)/2):o.node()&&!o.classed(M.jsPlaceholder)&&(tt=p.bBox(o.node()).height),tt){if(tt+=5,"top"===A)Y.domain[1]-=tt/l.h,f[1]*=-1;else{Y.domain[0]+=tt/l.h;var g=m.lineCount(o);f[1]+=(1-g)*d}a.attr("transform",u(f[0],f[1])),Y.setScale()}}t.selectAll("."+M.cbfills+",."+M.cblines).attr("transform",u(0,Math.round(l.h*(1-Y.domain[1])))),$.attr("transform",u(0,Math.round(-l.t)));var y=t.select("."+M.cbfills).selectAll("rect."+M.cbfill).attr("style","").data(P);y.enter().append("rect").classed(M.cbfill,!0).style("stroke","none"),y.exit().remove();var x=S.map(Y.c2p).map(Math.round).sort((function(t,e){return t-e}));y.each((function(t,a){var o=[0===a?S[0]:(P[a]+P[a-1])/2,a===P.length-1?S[1]:(P[a]+P[a+1])/2].map(Y.c2p).map(Math.round);o[1]=c.constrain(o[1]+(o[1]>o[0])?1:-1,x[0],x[1]);var s=n.select(this).attr({x:U,width:Math.max(O,2),y:n.min(o),height:Math.max(n.max(o)-n.min(o),2)});if(e._fillgradient)p.gradient(s,r,e._id,"vertical",e._fillgradient,"fill");else{var l=C(t).replace("e-","");s.attr("fill",i(l).toHexString())}}));var b=t.select("."+M.cblines).selectAll("path."+M.cbline).data(v.color&&v.width?z:[]);b.enter().append("path").classed(M.cbline,!0),b.exit().remove(),b.each((function(t){n.select(this).attr("d","M"+U+","+(Math.round(Y.c2p(t))+v.width/2%1)+"h"+O).call(p.lineGroupStyle,v.width,E(t),v.dash)})),$.selectAll("g."+Y._id+"tick,path").remove();var _=U+O+(e.outlinewidth||0)/2-("outside"===e.ticks?1:0),T=s.calcTicks(Y),k=s.getTickSigns(Y)[2];return s.drawTicks(r,Y,{vals:"inside"===Y.ticks?s.clipEnds(Y,T):T,layer:$,path:s.makeTickPath(Y,_,k),transFn:s.makeTransTickFn(Y)}),s.drawLabels(r,Y,{vals:T,layer:$,transFn:s.makeTransTickLabelFn(Y),labelFns:s.makeLabelFns(Y,_)})},function(){if(-1===["top","bottom"].indexOf(A)){var t=Y.title.font.size,e=Y._offset+Y._length/2,i=l.l+(Y.position||0)*l.w+("right"===Y.side?10+t*(Y.showticklabels?1:.5):-10-t*(Y.showticklabels?.5:0));et("h"+Y._id+"title",{avoid:{selection:n.select(r).selectAll("g."+Y._id+"tick"),side:A,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:i,y:e,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}},a.previousPromises,function(){var n=O+e.outlinewidth/2;if(-1===Y.ticklabelposition.indexOf("inside")&&(n+=p.bBox($.node()).width),(K=Q.select("text")).node()&&!K.classed(M.jsPlaceholder)){var i,o=Q.select(".h"+Y._id+"title-math-group").node();i=o&&-1!==["top","bottom"].indexOf(A)?p.bBox(o).width:p.bBox(Q.node()).right-U-l.l,n=Math.max(n,i)}var s=2*e.xpad+n+e.borderwidth+e.outlinewidth/2,c=H-G;t.select("."+M.cbbg).attr({x:U-e.xpad-(e.borderwidth+e.outlinewidth)/2,y:G-N,width:Math.max(s,2),height:Math.max(c+2*N,2)}).call(d.fill,e.bgcolor).call(d.stroke,e.bordercolor).style("stroke-width",e.borderwidth),t.selectAll("."+M.cboutline).attr({x:U,y:G+e.ypad+("top"===A?tt:0),width:Math.max(O,2),height:Math.max(c-2*e.ypad-tt,2)}).call(d.stroke,e.outlinecolor).style({fill:"none","stroke-width":e.outlinewidth});var f=({center:.5,right:1}[e.xanchor]||0)*s;t.attr("transform",u(l.l-f,l.t));var h={},g=T[e.yanchor],m=k[e.yanchor];"pixels"===e.lenmode?(h.y=e.y,h.t=c*g,h.b=c*m):(h.t=h.b=0,h.yt=e.y+e.len*g,h.yb=e.y-e.len*m);var v=T[e.xanchor],y=k[e.xanchor];if("pixels"===e.thicknessmode)h.x=e.x,h.l=s*v,h.r=s*y;else{var x=s-O;h.l=x*v,h.r=x*y,h.xl=e.x-e.thickness*v,h.xr=e.x+e.thickness*y}a.autoMargin(r,e._id,h)}],r)}(r,e,t);v&&v.then&&(t._promises||[]).push(v),t._context.edits.colorbarPosition&&function(t,e,r){var n,i,a,s=r._fullLayout._size;l.init({element:t.node(),gd:r,prepFn:function(){n=t.attr("transform"),h(t)},moveFn:function(r,o){t.attr("transform",n+u(r,o)),i=l.align(e._xLeftFrac+r/s.w,e._thickFrac,0,1,e.xanchor),a=l.align(e._yBottomFrac-o/s.h,e._lenFrac,0,1,e.yanchor);var c=l.getCursor(i,a,e.xanchor,e.yanchor);h(t,c)},doneFn:function(){if(h(t),void 0!==i&&void 0!==a){var n={};n[e._propPrefix+"x"]=i,n[e._propPrefix+"y"]=a,void 0!==e._traceIndex?o.call("_guiRestyle",r,n,e._traceIndex):o.call("_guiRelayout",r,n)}}})}(r,e,t)})),e.exit().each((function(e){a.autoMargin(t,e._id)})).remove(),e.order()}}},{"../../constants/alignment":745,"../../lib":778,"../../lib/extend":768,"../../lib/setcursor":798,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_defaults":829,"../../plots/cartesian/layout_attributes":841,"../../plots/cartesian/position_defaults":844,"../../plots/plots":890,"../../registry":910,"../color":643,"../colorscale/helpers":654,"../dragelement":662,"../drawing":665,"../titles":738,"./constants":645,d3:169,tinycolor2:576}],648:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":778}],649:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":644,"./defaults":646,"./draw":647,"./has_colorbar":648}],650:[function(t,e,r){"use strict";var n=t("../colorbar/attributes"),i=t("../../lib/regex").counter,a=t("./scales.js").scales;Object.keys(a);function o(t){return"`"+t+"`"}e.exports=function(t,e){t=t||"";var r,s=(e=e||{}).cLetter||"c",l=("onlyIfNumerical"in e?e.onlyIfNumerical:Boolean(t),"noScale"in e?e.noScale:"marker.line"===t),c="showScaleDflt"in e?e.showScaleDflt:"z"===s,u="string"==typeof e.colorscaleDflt?a[e.colorscaleDflt]:null,f=e.editTypeOverride||"",h=t?t+".":"";"colorAttr"in e?(r=e.colorAttr,e.colorAttr):o(h+(r={z:"z",c:"color"}[s]));var p=s+"auto",d=s+"min",g=s+"max",m=s+"mid",v=(o(h+p),o(h+d),o(h+g),{});v[d]=v[g]=void 0;var y={};y[p]=!1;var x={};return"color"===r&&(x.color={valType:"color",arrayOk:!0,editType:f||"style"},e.anim&&(x.color.anim=!0)),x[p]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:v},x[d]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[g]={valType:"number",dflt:null,editType:f||"plot",impliedEdits:y},x[m]={valType:"number",dflt:null,editType:"calc",impliedEdits:v},x.colorscale={valType:"colorscale",editType:"calc",dflt:u,impliedEdits:{autocolorscale:!1}},x.autocolorscale={valType:"boolean",dflt:!1!==e.autoColorDflt,editType:"calc",impliedEdits:{colorscale:void 0}},x.reversescale={valType:"boolean",dflt:!1,editType:"plot"},l||(x.showscale={valType:"boolean",dflt:c,editType:"calc"},x.colorbar=n),e.noColorAxis||(x.coloraxis={valType:"subplotid",regex:i("coloraxis"),dflt:null,editType:"calc"}),x}},{"../../lib/regex":794,"../colorbar/attributes":644,"./scales.js":658}],651:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./helpers").extractOpts;e.exports=function(t,e,r){var o,s=t._fullLayout,l=r.vals,c=r.containerStr,u=c?i.nestedProperty(e,c).get():e,f=a(u),h=!1!==f.auto,p=f.min,d=f.max,g=f.mid,m=function(){return i.aggNums(Math.min,null,l)},v=function(){return i.aggNums(Math.max,null,l)};(void 0===p?p=m():h&&(p=u._colorAx&&n(p)?Math.min(p,m()):m()),void 0===d?d=v():h&&(d=u._colorAx&&n(d)?Math.max(d,v()):v()),h&&void 0!==g&&(d-g>g-p?p=g-(d-g):d-g=0?s.colorscale.sequential:s.colorscale.sequentialminus,f._sync("colorscale",o))}},{"../../lib":778,"./helpers":654,"fast-isnumeric":241}],652:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./helpers").hasColorscale,a=t("./helpers").extractOpts;e.exports=function(t,e){function r(t,e){var r=t["_"+e];void 0!==r&&(t[e]=r)}function o(t,i){var o=i.container?n.nestedProperty(t,i.container).get():t;if(o)if(o.coloraxis)o._colorAx=e[o.coloraxis];else{var s=a(o),l=s.auto;(l||void 0===s.min)&&r(o,i.min),(l||void 0===s.max)&&r(o,i.max),s.autocolorscale&&r(o,"colorscale")}}for(var s=0;s=0;n--,i++){var a=t[n];r[i]=[1-a[0],a[1]]}return r}function d(t,e){e=e||{};for(var r=t.domain,o=t.range,l=o.length,c=new Array(l),u=0;u4/3-s?o:s}},{}],660:[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":778}],661:[function(t,e,r){"use strict";r.selectMode=function(t){return"lasso"===t||"select"===t},r.drawMode=function(t){return"drawclosedpath"===t||"drawopenpath"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.openMode=function(t){return"drawline"===t||"drawopenpath"===t},r.rectMode=function(t){return"select"===t||"drawline"===t||"drawrect"===t||"drawcircle"===t},r.freeMode=function(t){return"lasso"===t||"drawclosedpath"===t||"drawopenpath"===t},r.selectingOrDrawing=function(t){return r.freeMode(t)||r.rectMode(t)}},{}],662:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),i=t("has-hover"),a=t("has-passive-events"),o=t("../../lib").removeElement,s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var c=t("./unhover");function u(){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 f(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}l.unhover=c.wrapped,l.unhoverRaw=c.raw,l.init=function(t){var e,r,n,c,h,p,d,g,m=t.gd,v=1,y=m._context.doubleClickDelay,x=t.element;m._mouseDownTime||(m._mouseDownTime=0),x.style.pointerEvents="all",x.onmousedown=_,a?(x._ontouchstart&&x.removeEventListener("touchstart",x._ontouchstart),x._ontouchstart=_,x.addEventListener("touchstart",_,{passive:!1})):x.ontouchstart=_;var b=t.clampFn||function(t,e,r){return Math.abs(t)y&&(v=Math.max(v-1,1)),m._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(v,p),!g){var r;try{r=new MouseEvent("click",e)}catch(t){var n=f(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)}d.dispatchEvent(r)}m._dragging=!1,m._dragged=!1}else m._dragged=!1}},l.coverSlip=u},{"../../lib":778,"../../plots/cartesian/constants":833,"./align":659,"./cursor":660,"./unhover":663,"has-hover":440,"has-passive-events":441,"mouse-event-offset":484}],663:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/dom").getGraphDiv,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/dom":766,"../../lib/events":767,"../../lib/throttle":803,"../fx/constants":677}],664:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],665:[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"),c=t("../../lib"),u=c.strTranslate,f=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),p=t("../../constants/alignment").LINE_SPACING,d=t("../../constants/interactions").DESELECTDIM,g=t("../../traces/scatter/subtypes"),m=t("../../traces/scatter/make_bubble_size_func"),v=t("../../components/fx/helpers").appendArrayPointValue,y=e.exports={};y.font=function(t,e,r,n){c.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)},y.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},y.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},y.setRect=function(t,e,r,n,i){t.call(y.setPosition,e,r).call(y.setSize,n,i)},y.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",u(a,o)),!0)},y.translatePoints=function(t,e,r){t.each((function(t){var i=n.select(this);y.translatePoint(t,i,e,r)}))},y.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},y.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,i=e.yaxis;t.each((function(e){var a=e[0].trace,s=a.xcalendar,l=a.ycalendar,c=o.traceIs(a,"bar-like")?".bartext":".point,.textpoint";t.selectAll(c).each((function(t){y.hideOutsideRangePoint(t,n.select(this),r,i,s,l)}))}))}},y.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},y.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),y.dashLine(e,l,o)},y.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(y.dashLine,l,o)}))},y.dashLine=function(t,e,r){r=+r||0,e=y.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},y.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},y.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},y.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 x=t("./symbol_defs");y.symbolNames=[],y.symbolFuncs=[],y.symbolNeedLines={},y.symbolNoDot={},y.symbolNoFill={},y.symbolList=[],Object.keys(x).forEach((function(t){var e=x[t],r=e.n;y.symbolList.push(r,String(r),t,r+100,String(r+100),t+"-open"),y.symbolNames[r]=t,y.symbolFuncs[r]=e.f,e.needLine&&(y.symbolNeedLines[r]=!0),e.noDot?y.symbolNoDot[r]=!0:y.symbolList.push(r+200,String(r+200),t+"-dot",r+300,String(r+300),t+"-open-dot"),e.noFill&&(y.symbolNoFill[r]=!0)}));var b=y.symbolNames.length;function _(t,e){var r=t%100;return y.symbolFuncs[r](e)+(t>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}y.symbolNumber=function(t){if(i(t))t=+t;else 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=y.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=b||t>=400?0:Math.floor(Math.max(t,0))};var w={x1:1,x2:0,y1:0,y2:0},T={x1:0,x2:0,y1:1,y2:0},k=n.format("~.1f"),M={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:w},horizontalreversed:{node:"linearGradient",attrs:w,reversed:!0},vertical:{node:"linearGradient",attrs:T},verticalreversed:{node:"linearGradient",attrs:T,reversed:!0}};y.gradient=function(t,e,r,i,o,l){for(var u=o.length,f=M[i],h=new Array(u),p=0;p"+v(t);d._gradientUrlQueryParts[y]=1},y.initGradients=function(t){var e=t._fullLayout;c.ensureSingle(e._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove(),e._gradientUrlQueryParts={}},y.pointStyle=function(t,e,r){if(t.size()){var i=y.makePointStyleFns(e);t.each((function(t){y.singlePointStyle(t,n.select(this),e,i,r)}))}},y.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 u=y.symbolNumber(t.mx||a.symbol)||0;t.om=u%200>=100,e.attr("d",_(u,l))}var f,h,p,d=!1;if(t.so)p=o.outlierwidth,h=o.outliercolor,f=a.outliercolor;else{var g=(o||{}).width;p=(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):c.isArrayOrTypedArray(o.color)?s.defaultLine:o.color,c.isArrayOrTypedArray(a.color)&&(f=s.defaultLine,d=!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":(p||1)+"px",fill:"none"});else{e.style("stroke-width",(t.isBlank?0:p)+"px");var m=a.gradient,v=t.mgt;if(v?d=!0:v=m&&m.type,Array.isArray(v)&&(v=v[0],M[v]||(v=0)),v&&"none"!==v){var x=t.mgc;x?d=!0:x=m.color;var b=r.uid;d&&(b+="-"+t.i),y.gradient(e,i,b,v,[[0,x],[1,f]],"fill")}else s.fill(e,f);p&&s.stroke(e,h)}},y.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=y.tryColorscale(r,""),e.lineScale=y.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=g.isBubble(t)?m(t):function(){return(r.size||6)/2}),t.selectedpoints&&c.extendFlat(e,y.makeSelectedPointStyleFns(t)),e},y.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.marker||{},a=r.marker||{},s=n.marker||{},l=i.opacity,u=a.opacity,f=s.opacity,h=void 0!==u,p=void 0!==f;(c.isArrayOrTypedArray(l)||h||p)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?i.opacity:t.mo;return t.selected?h?u:e:p?f:d*e});var g=i.color,m=a.color,v=s.color;(m||v)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?m||e:v||e});var y=i.size,x=a.size,b=s.size,_=void 0!==x,w=void 0!==b;return o.traceIs(t,"symbols")&&(_||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||y/2;return t.selected?_?x/2:e:w?b/2:e}),e},y.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.textfont||{},a=r.textfont||{},o=n.textfont||{},l=i.color,c=a.color,u=o.color;return e.selectedTextColorFn=function(t){var e=t.tc||l;return t.selected?c||e:u||(c?e:s.addOpacity(e,d))},e},y.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.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",_(y.symbolNumber(n),a)),e.mrc2=a})),a.length&&t.each((function(t){for(var e=n.select(this),r=0;r0?r:0}y.textPointStyle=function(t,e,r){if(t.size()){var i;if(e.selectedpoints){var a=y.makeSelectedTextStyleFns(e);i=a.selectedTextColorFn}var o=e.texttemplate,s=r._fullLayout;t.each((function(t){var a=n.select(this),l=o?c.extractOption(t,e,"txt","texttemplate"):c.extractOption(t,e,"tx","text");if(l||0===l){if(o){var u=e._module.formatLabels?e._module.formatLabels(t,e,s):{},h={};v(h,e,t.i);var p=e._meta||{};l=c.texttemplateString(l,u,s._d3locale,h,t,p)}var d=t.tp||e.textposition,g=E(t,e),m=i?i(t):t.tc||e.textfont.color;a.call(y.font,t.tf||e.textfont.family,g,m).text(l).call(f.convertToTspans,r).call(S,d,g,t.mrc)}else a.remove()}))}},y.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=y.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),S(i,o,l,t.mrc2||t.mrc)}))}};function C(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],c=Math.pow(a*a+o*o,.25),u=Math.pow(s*s+l*l,.25),f=(u*u*a-c*c*s)*i,h=(u*u*o-c*c*l)*i,p=3*u*(c+u),d=3*c*(c+u);return[[n.round(e[0]+(p&&f/p),2),n.round(e[1]+(p&&h/p),2)],[n.round(e[0]-(d&&f/d),2),n.round(e[1]-(d&&h/d),2)]]}y.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&&(y.savedBBoxes={},P=0),r&&(y.savedBBoxes[r]=m),P++,c.extendFlat({},m)},y.setClipUrl=function(t,e,r){t.attr("clip-path",O(e,r))},y.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}},y.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+=u(e,r)).trim(),t[i]("transform",a),a},y.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}},y.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 D=/\s*sc.*/;y.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(D,"");t=(t+=n).trim(),this.setAttribute("transform",t)}))}};var R=/translate\([^)]*\)\s*$/;y.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?[]:[u(o,s),"scale("+e+","+r+")",u(-o,-s)],l&&t.push(l),i.attr("transform",t.join(""))}}))}},{"../../components/fx/helpers":679,"../../constants/alignment":745,"../../constants/interactions":752,"../../constants/xmlns_namespaces":754,"../../lib":778,"../../lib/svg_text_utils":802,"../../registry":910,"../../traces/scatter/make_bubble_size_func":1203,"../../traces/scatter/subtypes":1211,"../color":643,"../colorscale":655,"./symbol_defs":666,d3:169,"fast-isnumeric":241,tinycolor2:576}],666:[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),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+c+"L"+o+","+u+"L0,"+n.round(.382*e,2)+"L-"+o+","+u+"L-"+a+","+c+"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},"arrow-up":{n:45,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-down":{n:46,f:function(t){var e=n.round(t,2);return"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},noDot:!0},"arrow-left":{n:47,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-right":{n:48,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,0L-"+e+",-"+r+"V"+r+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+","+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(t){var e=n.round(t,2);return"M-"+e+",0H"+e+"M0,0L-"+e+",-"+n.round(2*t,2)+"H"+e+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(t){var e=n.round(2*t,2),r=n.round(t,2);return"M0,-"+r+"V"+r+"M0,0L-"+e+",-"+r+"V"+r+"Z"},needLine:!0,noDot:!0}}},{d3:169}],667:[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"}}}},{}],668:[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]||{},c=[];if(l.visible&&-1!==["linear","log"].indexOf(r.type)){for(var u=s(l),f=0;f0;e.each((function(e){var f,h=e[0].trace,p=h.error_x||{},d=h.error_y||{};h.ids&&(f=function(t){return t.id});var g=o.hasMarkers(h)&&h.marker.maxdisplayed>0;d.visible||p.visible||(e=[]);var m=n.select(this).selectAll("g.errorbar").data(e,f);if(m.exit().remove(),e.length){p.visible||m.selectAll("path.xerror").remove(),d.visible||m.selectAll("path.yerror").remove(),m.style("opacity",1);var v=m.enter().append("g").classed("errorbar",!0);u&&v.style("opacity",0).transition().duration(s.duration).style("opacity",1),a.setClipUrl(m,r.layerClipId,t),m.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,c);if(!g||t.vis){var a,o=e.select("path.yerror");if(d.visible&&i(r.x)&&i(r.yh)&&i(r.ys)){var f=d.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):u&&(o=o.transition().duration(s.duration).ease(s.easing)),o.attr("d",a)}else o.remove();var h=e.select("path.xerror");if(p.visible&&i(r.y)&&i(r.xh)&&i(r.xs)){var m=(p.copy_ystyle?d:p).width;a="M"+r.xh+","+(r.y-m)+"v"+2*m+"m0,-"+m+"H"+r.xs,r.noXS||(a+="m0,-"+m+"v"+2*m),!h.size()?h=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(h=h.transition().duration(s.duration).ease(s.easing)),h.attr("d",a)}else h.remove()}}))}}))}},{"../../traces/scatter/subtypes":1211,"../drawing":665,d3:169,"fast-isnumeric":241}],673:[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":643,d3:169}],674:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("./layout_attributes").hoverlabel,a=t("../../lib/extend").extendFlat;e.exports={hoverlabel:{bgcolor:a({},i.bgcolor,{arrayOk:!0}),bordercolor:a({},i.bordercolor,{arrayOk:!0}),font:n({arrayOk:!0,editType:"none"}),align:a({},i.align,{arrayOk:!0}),namelength:a({},i.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":768,"../../plots/font_attributes":855,"./layout_attributes":684}],675:[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.indexb[0]._length||tt<0||tt>_[0]._length)return d.unhoverRaw(t,e)}if(e.pointerX=$+b[0]._offset,e.pointerY=tt+_[0]._offset,C="xval"in e?v.flat(s,e.xval):v.p2c(b,$),I="yval"in e?v.flat(s,e.yval):v.p2c(_,tt),!i(C[0])||!i(I[0]))return o.warn("Fx.hover failed",e,t),d.unhoverRaw(t,e)}var nt=1/0;function it(t,r){for(F=0;FY&&(Z.splice(0,Y),nt=Z[0].distance),g&&0!==X&&0===Z.length){G.distance=X,G.index=!1;var f=N._module.hoverPoints(G,q,H,"closest",l._hoverlayer);if(f&&(f=f.filter((function(t){return t.spikeDistance<=X}))),f&&f.length){var h,d=f.filter((function(t){return t.xa.showspikes&&"hovered data"!==t.xa.spikesnap}));if(d.length){var m=d[0];i(m.x0)&&i(m.y0)&&(h=ot(m),(!K.vLinePoint||K.vLinePoint.spikeDistance>h.spikeDistance)&&(K.vLinePoint=h))}var y=f.filter((function(t){return t.ya.showspikes&&"hovered data"!==t.ya.spikesnap}));if(y.length){var x=y[0];i(x.x0)&&i(x.y0)&&(h=ot(x),(!K.hLinePoint||K.hLinePoint.spikeDistance>h.spikeDistance)&&(K.hLinePoint=h))}}}}}function at(t,e){for(var r,n=null,i=1/0,a=0;a1||Z.length>1)||"closest"===S&&Q&&Z.length>1,At=p.combine(l.plot_bgcolor||p.background,l.paper_bgcolor),St={hovermode:S,rotateLabels:Mt,bgColor:At,container:l._hoverlayer,outerContainer:l._paperdiv,commonLabelOpts:l.hoverlabel,hoverdistance:l.hoverdistance},Et=L(Z,St,t);v.isUnifiedHover(S)||(!function(t,e,r){var n,i,a,o,s,l,c,u=0,f=1,h=t.size(),p=new Array(h),d=0;function g(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 c=0;for(o=0;oe.pmax&&c++;for(o=t.length-1;o>=0&&!(c<=0);o--)(l=t[o]).pos>e.pmax-1&&(l.del=!0,c--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(c<=0);o--)(l=t[o]).pos+l.dp+l.size>e.pmax&&(l.del=!0,c--)}}}t.each((function(t){var n=t[e],i="x"===n._id.charAt(0),a=n.range;0===d&&a&&a[0]>a[1]!==i&&(f=-1),p[d++]=[{datum:t,traceIndex:t.trace.index,dp:0,pos:t.pos,posref:t.posref,size:t.by*(i?T:1)/2,pmin:0,pmax:i?r.width:r.height}]})),p.sort((function(t,e){return t[0].posref-e[0].posref||f*(e[0].traceIndex-t[0].traceIndex)}));for(;!n&&u<=h;){for(u++,n=!0,o=0;o.01&&y.pmin===x.pmin&&y.pmax===x.pmax){for(s=v.length-1;s>=0;s--)v[s].dp+=i;for(m.push.apply(m,v),p.splice(o+1,1),c=0,s=m.length-1;s>=0;s--)c+=m[s].dp;for(a=c/m.length,s=m.length-1;s>=0;s--)m[s].dp-=a;n=!1}else o++}p.forEach(g)}for(o=p.length-1;o>=0;o--){var b=p[o];for(s=b.length-1;s>=0;s--){var _=b[s],w=_.datum;w.offset=_.dp,w.del=_.del}}}(Et,Mt?"xa":"ya",l),P(Et,Mt,l._invScaleX,l._invScaleY));if(e.target&&e.target.tagName){var Ct=m.getComponentMethod("annotations","hasClickToShow")(t,_t);f(n.select(e.target),Ct?"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,bt))return;bt&&t.emit("plotly_unhover",{event:e,points:bt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:b,yaxes:_,xvals:C,yvals:I})}(t,e,r,a)}))},r.loneHover=function(t,e){var r=!0;Array.isArray(t)||(r=!1,t=[t]);var i=t.map((function(t){return{color:t.color||p.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,nameLength:t.nameLength,textAlign:t.textAlign,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}})),a=n.select(e.container),o=e.outerContainer?n.select(e.outerContainer):a,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||p.background,container:a,outerContainer:o},l=L(i,s,e.gd),c=0,u=0;l.sort((function(t,e){return t.y0-e.y0})).each((function(t,r){var n=t.y0-t.by/2;t.offset=n-5([\s\S]*)<\/extra>/;function L(t,e,r){var i=r._fullLayout,a=e.hovermode,c=e.rotateLabels,f=e.bgColor,d=e.container,g=e.outerContainer,m=e.commonLabelOpts||{},w=e.fontFamily||y.HOVERFONT,T=e.fontSize||y.HOVERFONTSIZE,k=t[0],M=k.xa,C=k.ya,L="y"===a.charAt(0)?"yLabel":"xLabel",P=k[L],z=(String(P)||"").split(" ")[0],O=g.node().getBoundingClientRect(),D=O.top,R=O.width,F=O.height,B=void 0!==P&&k.distance<=e.hoverdistance&&("x"===a||"y"===a);if(B){var N,j,U=!0;for(N=0;Ni.width-E?(y=i.width-E,l.attr("d","M"+(E-A)+",0L"+E+","+_+A+"v"+_+(2*S+b.height)+"H-"+E+"V"+_+A+"H"+(E-2*A)+"Z")):l.attr("d","M0,0L"+A+","+_+A+"H"+(S+b.width/2)+"v"+_+(2*S+b.height)+"H-"+(S+b.width/2)+"V"+_+A+"H-"+A+"Z")}else{var L,I,z;"right"===C.side?(L="start",I=1,z="",y=M._offset+M._length):(L="end",I=-1,z="-",y=M._offset),x=C._offset+(k.y0+k.y1)/2,c.attr("text-anchor",L),l.attr("d","M0,0L"+z+A+","+A+"V"+(S+b.height/2)+"h"+z+(2*S+b.width)+"V-"+(S+b.height/2)+"H"+z+A+"V-"+A+"Z");var O,R=b.height/2,F=D-b.top-R,B="clip"+i._uid+"commonlabel"+C._id;if(y=0?et-=it:et+=2*S;var at=nt.height+2*S,ot=tt+at>=F;return at<=F&&(tt<=D?tt=C._offset+2*S:ot&&(tt=F-at)),rt.attr("transform",s(et,tt)),rt}var st=d.selectAll("g.hovertext").data(t,(function(t){return E(t)}));return st.enter().append("g").classed("hovertext",!0).each((function(){var t=n.select(this);t.append("rect").call(p.fill,p.addOpacity(f,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(h.font,w,T)})),st.exit().remove(),st.each((function(t){var e=n.select(this).attr("transform",""),o=t.color;Array.isArray(o)&&(o=o[t.eventData[0].pointNumber]);var d=t.bgcolor||o,g=p.combine(p.opacity(d)?d:p.defaultLine,f),m=p.combine(p.opacity(o)?o:p.defaultLine,f),v=t.borderColor||p.contrast(g),y=I(t,B,a,i,P,e),x=y[0],b=y[1],k=e.select("text.nums").call(h.font,t.fontFamily||w,t.fontSize||T,t.fontColor||v).text(x).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,r),M=e.select("text.name"),E=0,C=0;if(b&&b!==x){M.call(h.font,t.fontFamily||w,t.fontSize||T,m).text(b).attr("data-notex",1).call(u.positionText,0,0).call(u.convertToTspans,r);var L=M.node().getBoundingClientRect();E=L.width+2*S,C=L.height+2*S}else M.remove(),e.select("rect").remove();e.select("path").style({fill:g,stroke:v});var z,O,N=k.node().getBoundingClientRect(),j=t.xa._offset+(t.x0+t.x1)/2,U=t.ya._offset+(t.y0+t.y1)/2,V=Math.abs(t.x1-t.x0),q=Math.abs(t.y1-t.y0),H=N.width+A+S+E;if(t.ty0=D-N.top,t.bx=N.width+2*S,t.by=Math.max(N.height+2*S,C),t.anchor="start",t.txwidth=N.width,t.tx2width=E,t.offset=0,c)t.pos=j,z=U+q/2+H<=F,O=U-q/2-H>=0,"top"!==t.idealAlign&&z||!O?z?(U+=q/2,t.anchor="start"):t.anchor="middle":(U-=q/2,t.anchor="end");else if(t.pos=U,z=j+V/2+H<=R,O=j-V/2-H>=0,"left"!==t.idealAlign&&z||!O)if(z)j+=V/2,t.anchor="start";else{t.anchor="middle";var G=H/2,Y=j+G-R,W=j-G;Y>0&&(j-=Y),W<0&&(j+=-W)}else j-=V/2,t.anchor="end";k.attr("text-anchor",t.anchor),E&&M.attr("text-anchor",t.anchor),e.attr("transform",s(j,U)+(c?l(_):""))})),st}function I(t,e,r,n,i,a){var s="",l="";void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name&&(t.trace._meta&&(t.name=o.templateString(t.name,t.trace._meta)),s=R(t.name,t.nameLength)),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),"choropleth"!==t.trace.type&&"choroplethmapbox"!==t.trace.type&&(l+=(l?"z: ":"")+t.zLabel)):e&&t[r.charAt(0)+"Label"]===i?l=t[("x"===r.charAt(0)?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&"scattercarpet"!==t.trace.type&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",!t.text&&0!==t.text||Array.isArray(t.text)||(l+=(l?"
":"")+t.text),void 0!==t.extraText&&(l+=(l?"
":"")+t.extraText),a&&""===l&&!t.hovertemplate&&(""===s&&a.remove(),l=s);var c=n._d3locale,u=t.hovertemplate||!1,f=t.hovertemplateLabels||t,h=t.eventData[0]||{};return u&&(l=(l=o.hovertemplateString(u,f,c,h,t.trace._meta)).replace(C,(function(e,r){return s=R(r,t.nameLength),""}))),[l,s]}function P(t,e,r,i){var a=function(t){return t*r},o=function(t){return t*i};t.each((function(t){var r=n.select(this);if(t.del)return r.remove();var i=r.select("text.nums"),s=t.anchor,l="end"===s?-1:1,c={start:1,end:-1,middle:0}[s],f=c*(A+S),p=f+c*(t.txwidth+S),d=0,g=t.offset,m="middle"===s;m&&(f-=t.tx2width/2,p+=t.txwidth/2+S),e&&(g*=-M,d=t.offset*k),r.select("path").attr("d",m?"M-"+a(t.bx/2+t.tx2width/2)+","+o(g-t.by/2)+"h"+a(t.bx)+"v"+o(t.by)+"h-"+a(t.bx)+"Z":"M0,0L"+a(l*A+d)+","+o(A+g)+"v"+o(t.by/2-A)+"h"+a(l*t.bx)+"v-"+o(t.by)+"H"+a(l*A+d)+"V"+o(g-A)+"Z");var v=d+f,y=g+t.ty0-t.by/2+S,x=t.textAlign||"auto";"auto"!==x&&("left"===x&&"start"!==s?(i.attr("text-anchor","start"),v=m?-t.bx/2-t.tx2width/2+S:-t.bx-S):"right"===x&&"end"!==s&&(i.attr("text-anchor","end"),v=m?t.bx/2-t.tx2width/2-S:t.bx+S)),i.call(u.positionText,a(v),o(y)),t.tx2width&&(r.select("text.name").call(u.positionText,a(p+c*S+d),o(g+t.ty0-t.by/2+S)),r.select("rect").call(h.setRect,a(p+(c-1)*t.tx2width/2+d),o(g-t.by/2-1),a(t.tx2width),o(t.by+2)))}))}function z(t,e){var r=t.index,n=t.trace||{},a=t.cd[0],s=t.cd[r]||{};function l(t){return t||i(t)&&0===t}var c=Array.isArray(r)?function(t,e){var i=o.castOption(a,r,t);return l(i)?i:o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(s,n,t,e)};function u(e,r,n){var i=c(r,n);l(i)&&(t[e]=i)}if(u("hoverinfo","hi","hoverinfo"),u("bgcolor","hbg","hoverlabel.bgcolor"),u("borderColor","hbc","hoverlabel.bordercolor"),u("fontFamily","htf","hoverlabel.font.family"),u("fontSize","hts","hoverlabel.font.size"),u("fontColor","htc","hoverlabel.font.color"),u("nameLength","hnl","hoverlabel.namelength"),u("textAlign","hta","hoverlabel.align"),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:g.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:g.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 f=g.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+f+" / -"+g.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+f,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var h=g.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+h+" / -"+g.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+h,"y"===e&&(t.distance+=1)}var p=t.hoverinfo||t.trace.hoverinfo;return p&&"all"!==p&&(-1===(p=Array.isArray(p)?p:p.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===p.indexOf("y")&&(t.yLabel=void 0),-1===p.indexOf("z")&&(t.zLabel=void 0),-1===p.indexOf("text")&&(t.text=void 0),-1===p.indexOf("name")&&(t.name=void 0)),t}function O(t,e,r){var n,i,o=r.container,s=r.fullLayout,l=s._size,c=r.event,u=!!e.hLinePoint,f=!!e.vLinePoint;if(o.selectAll(".spikeline").remove(),f||u){var d=p.combine(s.plot_bgcolor,s.paper_bgcolor);if(u){var m,v,y=e.hLinePoint;n=y&&y.xa,"cursor"===(i=y&&y.ya).spikesnap?(m=c.pointerX,v=c.pointerY):(m=n._offset+y.x,v=i._offset+y.y);var x,b,_=a.readability(y.color,d)<1.5?p.contrast(d):y.color,w=i.spikemode,T=i.spikethickness,k=i.spikecolor||_,M=g.getPxPosition(t,i);if(-1!==w.indexOf("toaxis")||-1!==w.indexOf("across")){if(-1!==w.indexOf("toaxis")&&(x=M,b=m),-1!==w.indexOf("across")){var A=i._counterDomainMin,S=i._counterDomainMax;"free"===i.anchor&&(A=Math.min(A,i.position),S=Math.max(S,i.position)),x=l.l+A*l.w,b=l.l+S*l.w}o.insert("line",":first-child").attr({x1:x,x2:b,y1:v,y2:v,"stroke-width":T,stroke:k,"stroke-dasharray":h.dashStyle(i.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:x,x2:b,y1:v,y2:v,"stroke-width":T+2,stroke:d}).classed("spikeline",!0).classed("crisp",!0)}-1!==w.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:M+("right"!==i.side?T:-T),cy:v,r:T,fill:k}).classed("spikeline",!0)}if(f){var E,C,L=e.vLinePoint;n=L&&L.xa,i=L&&L.ya,"cursor"===n.spikesnap?(E=c.pointerX,C=c.pointerY):(E=n._offset+L.x,C=i._offset+L.y);var I,P,z=a.readability(L.color,d)<1.5?p.contrast(d):L.color,O=n.spikemode,D=n.spikethickness,R=n.spikecolor||z,F=g.getPxPosition(t,n);if(-1!==O.indexOf("toaxis")||-1!==O.indexOf("across")){if(-1!==O.indexOf("toaxis")&&(I=F,P=C),-1!==O.indexOf("across")){var B=n._counterDomainMin,N=n._counterDomainMax;"free"===n.anchor&&(B=Math.min(B,n.position),N=Math.max(N,n.position)),I=l.t+(1-N)*l.h,P=l.t+(1-B)*l.h}o.insert("line",":first-child").attr({x1:E,x2:E,y1:I,y2:P,"stroke-width":D,stroke:R,"stroke-dasharray":h.dashStyle(n.spikedash,D)}).classed("spikeline",!0).classed("crisp",!0),o.insert("line",":first-child").attr({x1:E,x2:E,y1:I,y2:P,"stroke-width":D+2,stroke:d}).classed("spikeline",!0).classed("crisp",!0)}-1!==O.indexOf("marker")&&o.insert("circle",":first-child").attr({cx:E,cy:F-("top"!==n.side?D:-D),r:D,fill:R}).classed("spikeline",!0)}}}function D(t,e){return!e||(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)}function R(t,e){return u.plainText(t||"",{len:e,allowedTags:["br","sub","sup","b","i","em"]})}},{"../../lib":778,"../../lib/events":767,"../../lib/override_cursor":789,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"../legend/defaults":695,"../legend/draw":696,"./constants":677,"./helpers":679,d3:169,"fast-isnumeric":241,tinycolor2:576}],681:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("./helpers").isUnifiedHover;e.exports=function(t,e,r,o){function s(t){o.font[t]||(o.font[t]=e.legend?e.legend.font[t]:e.font[t])}o=o||{},e&&a(e.hovermode)&&(o.font||(o.font={}),s("size"),s("family"),s("color"),e.legend?(o.bgcolor||(o.bgcolor=i.combine(e.legend.bgcolor,e.paper_bgcolor)),o.bordercolor||(o.bordercolor=e.legend.bordercolor)):o.bgcolor||(o.bgcolor=e.paper_bgcolor)),r("hoverlabel.bgcolor",o.bgcolor),r("hoverlabel.bordercolor",o.bordercolor),r("hoverlabel.namelength",o.namelength),n.coerceFont(r,"hoverlabel.font",o.font),r("hoverlabel.align",o.align)}},{"../../lib":778,"../color":643,"./helpers":679}],682:[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 void 0!==e[r]?e[r]:n.coerce(t,e,i,r,a)}var o,s=a("clickmode");return e._has("cartesian")?s.indexOf("select")>-1?o="closest":(e._isHoriz=function(t,e){for(var r=e._scatterStackOpts||{},n=0;n1){if(!h&&!p&&!d)"independent"===k("pattern")&&(h=!0);m._hasSubplotGrid=h;var x,b,_="top to bottom"===k("roworder"),w=h?.2:.1,T=h?.3:.1;g&&e._splomGridDflt&&(x=e._splomGridDflt.xside,b=e._splomGridDflt.yside),m._domains={x:u("x",k,w,x,y),y:u("y",k,T,b,v,_)}}else delete e.grid}function k(t,e){return n.coerce(r,m,l,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,i,a,o,s,l,u,h=t.grid||{},p=e._subplots,d=r._hasSubplotGrid,g=r.rows,m=r.columns,v="independent"===r.pattern,y=r._axisMap={};if(d){var x=h.subplots||[];l=r.subplots=new Array(g);var b=1;for(n=0;n1);if(!1!==g||c.uirevision){var m=a.newContainer(e,"legend");if(_("uirevision",e.uirevision),!1!==g){_("bgcolor",e.paper_bgcolor),_("bordercolor"),_("borderwidth"),i.coerceFont(_,"font",e.font);var v,y,x,b=_("orientation");"h"===b?(v=0,n.getComponentMethod("rangeslider","isVisible")(t.xaxis)?(y=1.1,x="bottom"):(y=-.1,x="top")):(v=1.02,y=1,x="auto"),_("traceorder",h),l.isGrouped(e.legend)&&_("tracegroupgap"),_("itemsizing"),_("itemwidth"),_("itemclick"),_("itemdoubleclick"),_("x",v),_("xanchor"),_("y",y),_("yanchor",x),_("valign"),i.noneOrAll(c,m,["x","y"]),_("title.text")&&(_("title.side","h"===b?"left":"top"),i.coerceFont(_,"title.font",e.font))}}function _(t,e){return i.coerce(c,m,o,t,e)}}},{"../../lib":778,"../../plot_api/plot_template":816,"../../plots/layout_attributes":881,"../../registry":910,"./attributes":693,"./helpers":699}],696:[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"),c=t("../drawing"),u=t("../color"),f=t("../../lib/svg_text_utils"),h=t("./handle_click"),p=t("./constants"),d=t("../../constants/alignment"),g=d.LINE_SPACING,m=d.FROM_TL,v=d.FROM_BR,y=t("./get_legend_data"),x=t("./style"),b=t("./helpers");function _(t,e,r,n,i){var a=r.data()[0][0].trace,l={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&&(l.group=a._group),o.traceIs(a,"pie-like")&&(l.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",l))if(1===n)e._clickTimeout=setTimeout((function(){h(r,t,n)}),t._context.doubleClickDelay);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",l)&&h(r,t,n)}}function w(t,e,r){var n,a=t.data()[0][0],s=a.trace,l=o.traceIs(s,"pie-like"),u=s.index,h=r._main&&e._context.edits.legendText&&!l,d=r._maxNameLength;r.entries?n=a.text:(n=l?a.label:s.name,s._meta&&(n=i.templateString(n,s._meta)));var g=i.ensureSingle(t,"text","legendtext");g.attr("text-anchor","start").call(c.font,r.font).text(h?T(n,d):n);var m=r.itemwidth+2*p.itemGap;f.positionText(g,m,0),h?g.call(f.makeEditable,{gd:e,text:n}).call(M,t,e,r).on("edit",(function(n){this.text(T(n,d)).call(M,t,e,r);var s=a.trace._fullInput||{},l={};if(o.hasTransform(s,"groupby")){var c=o.getTransformIndices(s,"groupby"),f=c[c.length-1],h=i.keyedContainer(s,"transforms["+f+"].styles","target","value.name");h.set(a.trace._group,n),l=h.constructUpdate()}else l.name=n;return o.call("_guiRestyle",e,l,u)})):M(g,t,e,r)}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=e._context.doubleClickDelay,o=1,s=i.ensureSingle(t,"rect","legendtoggle",(function(t){e._context.staticPlot||t.style("cursor","pointer").attr("pointer-events","all"),t.call(u.fill,"rgba(0,0,0,0)")}));e._context.staticPlot||(s.on("mousedown",(function(){(r=(new Date).getTime())-e._legendMouseDownTimea&&(o=Math.max(o-1,1)),_(e,r,t,o,n.event)}})))}function M(t,e,r,n){n._main||t.attr("data-notex",!0),f.convertToTspans(t,r,(function(){!function(t,e,r){var n=t.data()[0][0];if(r._main&&n&&!n.trace.showlegend)return void t.remove();var i=t.select("g[class*=math-group]"),a=i.node();r||(r=e._fullLayout.legend);var o,s,l=r.borderwidth,u=(n?r:r.title).font.size*g;if(a){var h=c.bBox(a);o=h.height,s=h.width,n?c.setTranslate(i,0,.25*o):c.setTranslate(i,l,.75*o+l)}else{var d=t.select(n?".legendtext":".legendtitletext"),m=f.lineCount(d),v=d.node();o=u*m,s=v?c.bBox(v).width:0;var y=u*((m-1)/2-.3);if(n){var x=r.itemwidth+2*p.itemGap;f.positionText(d,x,-y)}else f.positionText(d,p.titlePad+l,u+l)}n?(n.lineHeight=u,n.height=Math.max(o,16)+3,n.width=s):(r._titleWidth=s,r._titleHeight=o)}(e,r,n)}))}function A(t){return i.isRightAnchor(t)?"right":i.isCenterAnchor(t)?"center":"left"}function S(t){return i.isBottomAnchor(t)?"bottom":i.isMiddleAnchor(t)?"middle":"top"}e.exports=function(t,e){var r,s=t._fullLayout,f="legend"+s._uid;if(e?(r=e.layer,f+="-hover"):((e=s.legend||{})._main=!0,r=s._infolayer),r){var h;if(t._legendMouseDownTime||(t._legendMouseDownTime=0),e._main){if(!t.calcdata)return;h=s.showlegend&&y(t.calcdata,e)}else{if(!e.entries)return;h=y(e.entries,e)}var d=s.hiddenlabels||[];if(e._main&&(!s.showlegend||!h.length))return r.selectAll(".legend").remove(),s._topdefs.select("#"+f).remove(),a.autoMargin(t,"legend");var g=i.ensureSingle(r,"g","legend",(function(t){e._main&&t.attr("pointer-events","all")})),T=i.ensureSingleById(s._topdefs,"clipPath",f,(function(t){t.append("rect")})),E=i.ensureSingle(g,"rect","bg",(function(t){t.attr("shape-rendering","crispEdges")}));E.call(u.stroke,e.bordercolor).call(u.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");var C=i.ensureSingle(g,"g","scrollbox"),L=e.title;if(e._titleWidth=0,e._titleHeight=0,L.text){var I=i.ensureSingle(C,"text","legendtitletext");I.attr("text-anchor","start").call(c.font,L.font).text(L.text),M(I,C,t,e)}else C.selectAll(".legendtitletext").remove();var P=i.ensureSingle(g,"rect","scrollbar",(function(t){t.attr(p.scrollBarEnterAttrs).call(u.fill,p.scrollBarColor)})),z=C.selectAll("g.groups").data(h);z.enter().append("g").attr("class","groups"),z.exit().remove();var O=z.selectAll("g.traces").data(i.identity);O.enter().append("g").attr("class","traces"),O.exit().remove(),O.style("opacity",(function(t){var e=t[0].trace;return o.traceIs(e,"pie-like")?-1!==d.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1})).each((function(){n.select(this).call(w,t,e)})).call(x,t,e).each((function(){e._main&&n.select(this).call(k,t)})),i.syncOrAsync([a.previousPromises,function(){return function(t,e,r,i){var a=t._fullLayout;i||(i=a.legend);var o=a._size,s=b.isVertical(i),l=b.isGrouped(i),u=i.borderwidth,f=2*u,h=p.itemGap,d=i.itemwidth+2*h,g=2*(u+h),m=S(i),v=i.y<0||0===i.y&&"top"===m,y=i.y>1||1===i.y&&"bottom"===m;i._maxHeight=Math.max(v||y?a.height/2:o.h,30);var x=0;i._width=0,i._height=0;var _=function(t){var e=0,r=0,n=t.title.side;n&&(-1!==n.indexOf("left")&&(e=t._titleWidth),-1!==n.indexOf("top")&&(r=t._titleHeight));return[e,r]}(i);if(s)r.each((function(t){var e=t[0].height;c.setTranslate(this,u+_[0],u+_[1]+i._height+e/2+h),i._height+=e,i._width=Math.max(i._width,t[0].width)})),x=d+i._width,i._width+=h+d+f,i._height+=g,l&&(e.each((function(t,e){c.setTranslate(this,0,e*i.tracegroupgap)})),i._height+=(i._lgroupsLength-1)*i.tracegroupgap);else{var w=A(i),T=i.x<0||0===i.x&&"right"===w,k=i.x>1||1===i.x&&"left"===w,M=y||v,E=a.width/2;i._maxWidth=Math.max(T?M&&"left"===w?o.l+o.w:E:k?M&&"right"===w?o.r+o.w:E:o.w,2*d);var C=0,L=0;r.each((function(t){var e=t[0].width+d;C=Math.max(C,e),L+=e})),x=null;var I=0;if(l){var P=0,z=0,O=0;e.each((function(){var t=0,e=0;n.select(this).selectAll("g.traces").each((function(r){var n=r[0].height;c.setTranslate(this,_[0],_[1]+u+h+n/2+e),e+=n,t=Math.max(t,d+r[0].width)})),P=Math.max(P,e);var r=t+h;r+u+z>i._maxWidth&&(I=Math.max(I,z),z=0,O+=P+i.tracegroupgap,P=e),c.setTranslate(this,z,O),z+=r})),i._width=Math.max(I,z)+u,i._height=O+P+g}else{var D=r.size(),R=L+f+(D-1)*h=i._maxWidth&&(I=Math.max(I,j),B=0,N+=F,i._height+=F,F=0),c.setTranslate(this,_[0]+u+B,_[1]+u+N+e/2+h),j=B+r+h,B+=n,F=Math.max(F,e)})),R?(i._width=B+f,i._height=F+g):(i._width=Math.max(I,j)+f,i._height+=F+g)}}i._width=Math.ceil(Math.max(i._width+_[0],i._titleWidth+2*(u+p.titlePad))),i._height=Math.ceil(Math.max(i._height+_[1],i._titleHeight+2*(u+p.itemGap))),i._effHeight=Math.min(i._height,i._maxHeight);var U=t._context.edits,V=U.legendText||U.legendPosition;r.each((function(t){var e=n.select(this).select(".legendtoggle"),r=t[0].height,i=V?d:x||d+t[0].width;s||(i+=h/2),c.setRect(e,0,-r/2,i,r)}))}(t,z,O,e)},function(){if(!e._main||!function(t){var e=t._fullLayout.legend,r=A(e),n=S(e);return a.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*m[r],r:e._width*v[r],b:e._effHeight*v[n],t:e._effHeight*m[n]})}(t)){var u,h,d,y,x=s._size,b=e.borderwidth,w=x.l+x.w*e.x-m[A(e)]*e._width,k=x.t+x.h*(1-e.y)-m[S(e)]*e._effHeight;if(e._main&&s.margin.autoexpand){var M=w,L=k;w=i.constrain(w,0,s.width-e._width),k=i.constrain(k,0,s.height-e._effHeight),w!==M&&i.log("Constrain legend.x to make legend fit inside graph"),k!==L&&i.log("Constrain legend.y to make legend fit inside graph")}if(e._main&&c.setTranslate(g,w,k),P.on(".drag",null),g.on("wheel",null),!e._main||e._height<=e._maxHeight||t._context.staticPlot){var I=e._effHeight;e._main||(I=e._height),E.attr({width:e._width-b,height:I-b,x:b/2,y:b/2}),c.setTranslate(C,0,0),T.select("rect").attr({width:e._width-2*b,height:I-2*b,x:b,y:b}),c.setClipUrl(C,f,t),c.setRect(P,0,0,0,0),delete e._scrollY}else{var z,O,D,R=Math.max(p.scrollBarMinHeight,e._effHeight*e._effHeight/e._height),F=e._effHeight-R-2*p.scrollBarMargin,B=e._height-e._effHeight,N=F/B,j=Math.min(e._scrollY||0,B);E.attr({width:e._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:e._effHeight-b,x:b/2,y:b/2}),T.select("rect").attr({width:e._width-2*b+p.scrollBarWidth+p.scrollBarMargin,height:e._effHeight-2*b,x:b,y:b+j}),c.setClipUrl(C,f,t),q(j,R,N),g.on("wheel",(function(){q(j=i.constrain(e._scrollY+n.event.deltaY/F*B,0,B),R,N),0!==j&&j!==B&&n.event.preventDefault()}));var U=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;z="touchstart"===t.type?t.changedTouches[0].clientY:t.clientY,D=j})).on("drag",(function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||(O="touchmove"===t.type?t.changedTouches[0].clientY:t.clientY,q(j=function(t,e,r){var n=(r-e)/N+t;return i.constrain(n,0,B)}(D,z,O),R,N))}));P.call(U);var V=n.behavior.drag().on("dragstart",(function(){var t=n.event.sourceEvent;"touchstart"===t.type&&(z=t.changedTouches[0].clientY,D=j)})).on("drag",(function(){var t=n.event.sourceEvent;"touchmove"===t.type&&(O=t.changedTouches[0].clientY,q(j=function(t,e,r){var n=(e-r)/N+t;return i.constrain(n,0,B)}(D,z,O),R,N))}));C.call(V)}if(t._context.edits.legendPosition)g.classed("cursor-move",!0),l.init({element:g.node(),gd:t,prepFn:function(){var t=c.getTranslate(g);d=t.x,y=t.y},moveFn:function(t,r){var n=d+t,i=y+r;c.setTranslate(g,n,i),u=l.align(n,0,x.l,x.l+x.w,e.xanchor),h=l.align(i,0,x.t+x.h,x.t,e.yanchor)},doneFn:function(){void 0!==u&&void 0!==h&&o.call("_guiRelayout",t,{"legend.x":u,"legend.y":h})},clickFn:function(e,n){var i=r.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&&_(t,g,i,e,n)}})}function q(r,n,i){e._scrollY=t._fullLayout.legend._scrollY=r,c.setTranslate(C,0,-r),c.setRect(P,e._width,p.scrollBarMargin+r*i,p.scrollBarWidth,n),T.select("rect").attr("y",b+r)}}],t)}}},{"../../constants/alignment":745,"../../lib":778,"../../lib/events":767,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../../registry":910,"../color":643,"../dragelement":662,"../drawing":665,"./constants":694,"./get_legend_data":697,"./handle_click":698,"./helpers":699,"./style":701,d3:169}],697:[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,c={},u=0,f=0,h=e._main;function p(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"+u;s.push(n),o[n]=[[r]],u++}}for(r=0;r0))return 0;i=e.width}return m?n:Math.min(i,r)};function _(t,e,r){var a=t[0].trace,o=a.marker||{},s=o.line||{},c=r?a.visible&&a.type===r:i.traceIs(a,"bar"),u=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(c?[t]:[]);u.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),u.exit().remove(),u.each((function(t){var e=n.select(this),r=t[0],i=b(r.mlw,o.line,5,2);e.style("stroke-width",i+"px").call(l.fill,r.mc||o.color),i&&l.stroke(e,r.mlc||s.color)}))}function w(t,e,r){var o=t[0],s=o.trace,l=r?s.visible&&s.type===r:i.traceIs(s,r),c=n.select(e).select("g.legendpoints").selectAll("path.legend"+r).data(l?[t]:[]);if(c.enter().append("path").classed("legend"+r,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),c.exit().remove(),c.size()){var u=(s.marker||{}).line,p=b(h(u.width,o.pts),u,5,2),d=a.minExtend(s,{marker:{line:{width:p}}});d.marker.line.color=u.color;var g=a.minExtend(o,{trace:d});f(c,g,d)}}t.each((function(t){var e=n.select(this),i=a.ensureSingle(e,"g","layers");i.style("opacity",t[0].trace.opacity);var s=r.valign,l=t[0].lineHeight,c=t[0].height;if("middle"!==s&&l&&c){var u={top:1,bottom:-1}[s]*(.5*(l-c+3));i.attr("transform",o(0,u))}else i.attr("transform",null);i.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),i.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var f=i.selectAll("g.legendsymbols").data([t]);f.enter().append("g").classed("legendsymbols",!0),f.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)})).each((function(t){var r,i=t[0].trace,o=[];if(i.visible)switch(i.type){case"histogram2d":case"heatmap":o=[["M-15,-2V4H15V-2Z"]],r=!0;break;case"choropleth":case"choroplethmapbox":o=[["M-6,-6V6H6V-6Z"]],r=!0;break;case"densitymapbox":o=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],r="radial";break;case"cone":o=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],r=!1;break;case"streamtube":o=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],r=!1;break;case"surface":o=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],r=!0;break;case"mesh3d":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!1;break;case"volume":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],r=!0;break;case"isosurface":o=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],r=!1}var u=n.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(o);u.enter().append("path").classed("legend3dandfriends",!0).attr("transform",x).style("stroke-miterlimit",1),u.exit().remove(),u.each((function(t,o){var u,f=n.select(this),h=c(i),p=h.colorscale,g=h.reversescale;if(p){if(!r){var m=p.length;u=0===o?p[g?m-1:0][1]:1===o?p[g?0:m-1][1]:p[Math.floor((m-1)/2)][1]}}else{var v=i.vertexcolor||i.facecolor||i.color;u=a.isArrayOrTypedArray(v)?v[o]||v[0]:v}f.attr("d",t[0]),u?f.call(l.fill,u):f.call((function(t){if(t.size()){var n="legendfill-"+i.uid;s.gradient(t,e,n,d(g,"radial"===r),p,"fill")}}))}))})).each((function(t){var e=t[0].trace,r="waterfall"===e.type;if(t[0]._distinct&&r){var i=t[0].trace[t[0].dir].marker;return t[0].mc=i.color,t[0].mlw=i.line.width,t[0].mlc=i.line.color,_(t,this,"waterfall")}var a=[];e.visible&&r&&(a=t[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var o=n.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(a);o.enter().append("path").classed("legendwaterfall",!0).attr("transform",x).style("stroke-miterlimit",1),o.exit().remove(),o.each((function(t){var r=n.select(this),i=e[t[0]].marker,a=b(void 0,i.line,5,2);r.attr("d",t[1]).style("stroke-width",a+"px").call(l.fill,i.color),a&&r.call(l.stroke,i.line.color)}))})).each((function(t){_(t,this,"funnel")})).each((function(t){_(t,this)})).each((function(t){var r=t[0].trace,o=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(r.visible&&i.traceIs(r,"box-violin")?[t]:[]);o.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",x),o.exit().remove(),o.each((function(){var t=n.select(this);if("all"!==r.boxpoints&&"all"!==r.points||0!==l.opacity(r.fillcolor)||0!==l.opacity((r.line||{}).color)){var i=b(void 0,r.line,5,2);t.style("stroke-width",i+"px").call(l.fill,r.fillcolor),i&&l.stroke(t,r.line.color)}else{var c=a.minExtend(r,{marker:{size:m?12:a.constrain(r.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});o.call(s.pointStyle,c,e)}}))})).each((function(t){w(t,this,"funnelarea")})).each((function(t){w(t,this,"pie")})).each((function(t){var r,i,o=t[0],l=o.trace,f=l.visible&&l.fill&&"none"!==l.fill,h=u.hasLines(l),p=l.contours,g=!1,m=!1,y=c(l),x=y.colorscale,_=y.reversescale;if(p){var w=p.coloring;"lines"===w?g=!0:h="none"===w||"heatmap"===w||p.showlines,"constraint"===p.type?f="="!==p._operation:"fill"!==w&&"heatmap"!==w||(m=!0)}var T=u.hasMarkers(l)||u.hasText(l),k=f||m,M=h||g,A=T||!k?"M5,0":M?"M5,-2":"M5,-3",S=n.select(this),E=S.select(".legendfill").selectAll("path").data(f||m?[t]:[]);if(E.enter().append("path").classed("js-fill",!0),E.exit().remove(),E.attr("d",A+"h"+v+"v6h-"+v+"z").call(f?s.fillGroupStyle:function(t){if(t.size()){var r="legendfill-"+l.uid;s.gradient(t,e,r,d(_),x,"fill")}}),h||g){var C=b(void 0,l.line,10,5);i=a.minExtend(l,{line:{width:C}}),r=[a.minExtend(o,{trace:i})]}var L=S.select(".legendlines").selectAll("path").data(h||g?[r]:[]);L.enter().append("path").classed("js-line",!0),L.exit().remove(),L.attr("d",A+(g?"l"+v+",0.0001":"h"+v)).call(h?s.lineGroupStyle:function(t){if(t.size()){var r="legendline-"+l.uid;s.lineGroupStyle(t),s.gradient(t,e,r,d(_),x,"stroke")}})})).each((function(t){var r,i,o=t[0],l=o.trace,c=u.hasMarkers(l),f=u.hasText(l),h=u.hasLines(l);function p(t,e,r,n){var i=a.nestedProperty(l,t).get(),o=a.isArrayOrTypedArray(i)&&e?e(i):i;if(m&&o&&void 0!==n&&(o=n),r){if(or[1])return r[1]}return o}function d(t){return o._distinct&&o.index&&t[o.index]?t[o.index]:t[0]}if(c||f||h){var g={},v={};if(c){g.mc=p("marker.color",d),g.mx=p("marker.symbol",d),g.mo=p("marker.opacity",a.mean,[.2,1]),g.mlc=p("marker.line.color",d),g.mlw=p("marker.line.width",a.mean,[0,5],2),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var y=p("marker.size",a.mean,[2,16],12);g.ms=y,v.marker.size=y}h&&(v.line={width:p("line.width",d,[0,10],5)}),f&&(g.tx="Aa",g.tp=p("textposition",d),g.ts=10,g.tc=p("textfont.color",d),g.tf=p("textfont.family",d)),r=[a.minExtend(o,g)],(i=a.minExtend(l,v)).selectedpoints=null,i.texttemplate=null}var b=n.select(this).select("g.legendpoints"),_=b.selectAll("path.scatterpts").data(c?r:[]);_.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",x),_.exit().remove(),_.call(s.pointStyle,i,e),c&&(r[0].mrc=3);var w=b.selectAll("g.pointtext").data(f?r:[]);w.enter().append("g").classed("pointtext",!0).append("text").attr("transform",x),w.exit().remove(),w.selectAll("text").call(s.textPointStyle,i,e)})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.visible&&"candlestick"===e.type?[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",x).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var i=n.select(this),a=e[r?"increasing":"decreasing"],o=b(void 0,a.line,5,2);i.style("stroke-width",o+"px").call(l.fill,a.fillcolor),o&&l.stroke(i,a.line.color)}))})).each((function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.visible&&"ohlc"===e.type?[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",x).style("stroke-miterlimit",1),r.exit().remove(),r.each((function(t,r){var i=n.select(this),a=e[r?"increasing":"decreasing"],o=b(void 0,a.line,5,2);i.style("fill","none").call(s.dashLine,a.line.dash,o),o&&l.stroke(i,a.line.color)}))}))}},{"../../lib":778,"../../registry":910,"../../traces/pie/helpers":1165,"../../traces/pie/style_one":1171,"../../traces/scatter/subtypes":1211,"../color":643,"../colorscale/helpers":654,"../drawing":665,"./constants":694,d3:169}],702:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/plots"),a=t("../../plots/cartesian/axis_ids"),o=t("../../fonts/ploticon"),s=t("../shapes/draw").eraseActiveShape,l=t("../../lib"),c=l._,u=e.exports={};function f(t,e){var r,i,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,c=t._fullLayout,u={},f=a.list(t,null,!0),h=c._cartesianSpikesEnabled;if("zoom"===s){var p,d="in"===l?.5:2,g=(1+d)/2,m=(1-d)/2;for(i=0;i1?(E=["toggleHover"],C=["resetViews"]):d?(S=["zoomInGeo","zoomOutGeo"],E=["hoverClosestGeo"],C=["resetGeo"]):p?(E=["hoverClosest3d"],C=["resetCameraDefault3d","resetCameraLastSave3d"]):x?(S=["zoomInMapbox","zoomOutMapbox"],E=["toggleHover"],C=["resetViewMapbox"]):v?E=["hoverClosestGl2d"]:g?E=["hoverClosestPie"]:_?(E=["hoverClosestCartesian","hoverCompareCartesian"],C=["resetViewSankey"]):E=["toggleHover"];h&&(E=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);(function(t){for(var e=0;e0)){var g=function(t,e,r){for(var n=r.filter((function(r){return e[r].anchor===t._id})),i=0,a=0;a=n.max)e=F[r+1];else if(t=n.pmax)e=F[r+1];else if(t0?h+c:c;return{ppad:c,ppadplus:u?d:g,ppadminus:u?g:d}}return{ppad:c}}function u(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,c,u,f,h=1/0,p=-1/0,d=n.match(a.segmentRE);for("date"===t.type&&(s=o.decodeDate(s)),l=0;lp&&(p=f)));return p>=h?[h,p]: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;oy?(k=f,E="y0",M=y,C="y1"):(k=y,E="y1",M=f,C="y0");Z(n),Q(s,r),function(t,e,r){var n=e.xref,i=e.yref,o=a.getFromId(r,n),s=a.getFromId(r,i),l="";"paper"===n||o.autorange||(l+=n);"paper"===i||s.autorange||(l+=i);u.setClipUrl(t,l?"clip"+r._fullLayout._uid+l:null,r)}(e,r,t),X.moveFn="move"===z?J:K,X.altKey=n.altKey},doneFn:function(){if(v(t))return;p(e),$(s),b(e,t,r),n.call("_guiRelayout",t,l.getUpdateObj())},clickFn:function(){if(v(t))return;$(s)}};function Z(r){if(v(t))z=null;else if(R)z="path"===r.target.tagName?"move":"start-point"===r.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var n=X.element.getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top,o=r.clientX-n.left,s=r.clientY-n.top,l=!F&&i>10&&a>10&&!r.shiftKey?h.getCursor(o/i,1-s/a):"move";p(e,l),z=l.split("-")[0]}}function J(n,i){if("path"===r.type){var a=function(t){return t},o=a,l=a;O?B("xanchor",r.xanchor=G(x+n)):(o=function(t){return G(q(t)+n)},N&&"date"===N.type&&(o=g.encodeDate(o))),D?B("yanchor",r.yanchor=Y(T+i)):(l=function(t){return Y(H(t)+i)},U&&"date"===U.type&&(l=g.encodeDate(l))),B("path",r.path=w(P,o,l))}else O?B("xanchor",r.xanchor=G(x+n)):(B("x0",r.x0=G(c+n)),B("x1",r.x1=G(m+n))),D?B("yanchor",r.yanchor=Y(T+i)):(B("y0",r.y0=Y(f+i)),B("y1",r.y1=Y(y+i)));e.attr("d",_(t,r)),Q(s,r)}function K(n,i){if(F){var a=function(t){return t},o=a,l=a;O?B("xanchor",r.xanchor=G(x+n)):(o=function(t){return G(q(t)+n)},N&&"date"===N.type&&(o=g.encodeDate(o))),D?B("yanchor",r.yanchor=Y(T+i)):(l=function(t){return Y(H(t)+i)},U&&"date"===U.type&&(l=g.encodeDate(l))),B("path",r.path=w(P,o,l))}else if(R){if("resize-over-start-point"===z){var u=c+n,h=D?f-i:f+i;B("x0",r.x0=O?u:G(u)),B("y0",r.y0=D?h:Y(h))}else if("resize-over-end-point"===z){var p=m+n,d=D?y-i:y+i;B("x1",r.x1=O?p:G(p)),B("y1",r.y1=D?d:Y(d))}}else{var v=function(t){return-1!==z.indexOf(t)},b=v("n"),j=v("s"),V=v("w"),W=v("e"),X=b?k+i:k,Z=j?M+i:M,J=V?A+n:A,K=W?S+n:S;D&&(b&&(X=k-i),j&&(Z=M-i)),(!D&&Z-X>10||D&&X-Z>10)&&(B(E,r[E]=D?X:Y(X)),B(C,r[C]=D?Z:Y(Z))),K-J>10&&(B(L,r[L]=O?J:G(J)),B(I,r[I]=O?K:G(K)))}e.attr("d",_(t,r)),Q(s,r)}function Q(t,e){(O||D)&&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=q(O?e.xanchor:i.midRange(r?[e.x0,e.x1]:g.extractPathCoords(e.path,d.paramIsX))),o=H(D?e.yanchor:i.midRange(r?[e.y0,e.y1]:g.extractPathCoords(e.path,d.paramIsY)));if(a=g.roundPositionForSharpStrokeRendering(a,1),o=g.roundPositionForSharpStrokeRendering(o,1),O&&D){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(O){var l="M"+(a-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",l)}else{var c="M"+(a-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function $(t){t.selectAll(".visual-cue").remove()}h.init(X),W.node().onmousemove=Z}(t,O,l,e,r,z):!0===l.editable&&O.style("pointer-events",I||c.opacity(S)*A<=.5?"stroke":"all");O.node().addEventListener("click",(function(){return function(t,e){if(!y(t))return;var r=+e.node().getAttribute("data-index");if(r>=0){if(r===t._fullLayout._activeShapeIndex)return void T(t);t._fullLayout._activeShapeIndex=r,t._fullLayout._deactivateShape=T,m(t)}}(t,O)}))}}function b(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");u.setClipUrl(t,n?"clip"+e._fullLayout._uid+n:null,e)}function _(t,e){var r,n,o,s,l,c,u,f,h=e.type,p=a.getRefType(e.xref),m=a.getRefType(e.yref),v=a.getFromId(t,e.xref),y=a.getFromId(t,e.yref),x=t._fullLayout._size;if(v?"domain"===p?n=function(t){return v._offset+v._length*t}:(r=g.shapePositionToRange(v),n=function(t){return v._offset+v.r2p(r(t,!0))}):n=function(t){return x.l+x.w*t},y?"domain"===m?s=function(t){return y._offset+y._length*(1-t)}:(o=g.shapePositionToRange(y),s=function(t){return y._offset+y.r2p(o(t,!0))}):s=function(t){return x.t+x.h*(1-t)},"path"===h)return v&&"date"===v.type&&(n=g.decodeDate(n)),y&&"date"===y.type&&(s=g.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(d.segmentRE,(function(t){var n=0,c=t.charAt(0),u=d.paramIsX[c],f=d.paramIsY[c],h=d.numParams[c],p=t.substr(1).replace(d.paramRE,(function(t){return u[n]?t="pixel"===a?e(s)+Number(t):e(t):f[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>h&&(t="X"),t}));return n>h&&(p=p.replace(/[\s,]*X.*/,""),i.log("Ignoring extra params in segment "+t)),c+p}))}(e,n,s);if("pixel"===e.xsizemode){var b=n(e.xanchor);l=b+e.x0,c=b+e.x1}else l=n(e.x0),c=n(e.x1);if("pixel"===e.ysizemode){var _=s(e.yanchor);u=_-e.y0,f=_-e.y1}else u=s(e.y0),f=s(e.y1);if("line"===h)return"M"+l+","+u+"L"+c+","+f;if("rect"===h)return"M"+l+","+u+"H"+c+"V"+f+"H"+l+"Z";var w=(l+c)/2,T=(u+f)/2,k=Math.abs(w-l),M=Math.abs(T-u),A="A"+k+","+M,S=w+k+","+T;return"M"+S+A+" 0 1,1 "+(w+","+(T-M))+A+" 0 0,1 "+S+"Z"}function w(t,e,r){return t.replace(d.segmentRE,(function(t){var n=0,i=t.charAt(0),a=d.paramIsX[i],o=d.paramIsY[i],s=d.numParams[i];return i+t.substr(1).replace(d.paramRE,(function(t){return n>=s||(a[n]?t=e(t):o[n]&&(t=r(t)),n++),t}))}))}function T(t){y(t)&&(t._fullLayout._activeShapeIndex>=0&&(l(t),delete t._fullLayout._activeShapeIndex,m(t)))}e.exports={draw:m,drawOne:x,eraseActiveShape:function(t){if(!y(t))return;l(t);var e=t._fullLayout._activeShapeIndex,r=(t.layout||{}).shapes||[];if(e=0&&f(v),r.attr("d",g(e)),M&&!h)&&(k=function(t,e){for(var r=0;r1&&(2!==t.length||"Z"!==t[1][0])&&(0===T&&(t[0][0]="M"),e[w]=t,y(),x())}}()}}function P(t,r){!function(t,r){if(e.length)for(var n=0;n0&&l0&&(s=s.transition().duration(e.transition.duration).ease(e.transition.easing)),s.attr("transform",l(o-.5*f.gripWidth,e._dims.currentValueTotalHeight))}}function E(t,e){var r=t._dims;return r.inputAreaStart+f.stepInset+(r.inputAreaLength-2*f.stepInset)*Math.min(1,Math.max(0,e))}function C(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-f.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*f.stepInset-2*r.inputAreaStart)))}function L(t,e,r){var n=r._dims,i=s.ensureSingle(t,"rect",f.railTouchRectClass,(function(n){n.call(M,e,t,r).style("pointer-events","all")}));i.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,f.tickOffset+r.ticklen+n.labelHeight)}).call(a.fill,r.bgcolor).attr("opacity",0),o.setTranslate(i,0,n.currentValueTotalHeight)}function I(t,e){var r=e._dims,n=r.inputAreaLength-2*f.railInset,i=s.ensureSingle(t,"rect",f.railRectClass);i.attr({width:n,height:f.railWidth,rx:f.railRadius,ry:f.railRadius,"shape-rendering":"crispEdges"}).call(a.stroke,e.bordercolor).call(a.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(i,f.railInset,.5*(r.inputAreaWidth-f.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[f.name],n=[],i=0;i0?[0]:[]);function s(e){e._commandObserver&&(e._commandObserver.remove(),delete e._commandObserver),i.autoMargin(t,m(e))}if(a.enter().append("g").classed(f.containerClassName,!0).style("cursor","ew-resize"),a.exit().each((function(){n.select(this).selectAll("g."+f.groupClassName).each(s)})).remove(),0!==r.length){var l=a.selectAll("g."+f.groupClassName).data(r,v);l.enter().append("g").classed(f.groupClassName,!0),l.exit().each(s).remove();for(var c=0;c0||h<0){var v={left:[-d,0],right:[d,0],top:[0,-d],bottom:[0,d]}[b.side];e.attr("transform",l(v[0],v[1]))}}}return D.call(R),z&&(E?D.on(".opacity",null):(M=0,A=!0,D.text(y).on("mouseover.opacity",(function(){n.select(this).transition().duration(h.SHOW_PLACEHOLDER).style("opacity",1)})).on("mouseout.opacity",(function(){n.select(this).transition().duration(h.HIDE_PLACEHOLDER).style("opacity",0)}))),D.call(f.makeEditable,{gd:t}).on("edit",(function(e){void 0!==x?o.call("_guiRestyle",t,v,e,x):o.call("_guiRelayout",t,v,e)})).on("cancel",(function(){this.text(this.attr("data-unformatted")).call(R)})).on("input",(function(t){this.text(t||" ").call(f.positionText,_.x,_.y)}))),D.classed("js-placeholder",A),T}}},{"../../constants/alignment":745,"../../constants/interactions":752,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../../registry":910,"../color":643,"../drawing":665,d3:169,"fast-isnumeric":241}],739:[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,c=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"}]},args2:{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:c,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":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/font_attributes":855,"../../plots/pad_attributes":889,"../color/attributes":642}],740:[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"}}},{}],741:[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:c}).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 c(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("args2"),r("label"),r("execute"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":778,"../../plots/array_container_defaults":822,"./attributes":739,"./constants":740}],742:[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"),c=t("../../plot_api/plot_template").arrayEditor,u=t("../../constants/alignment").LINE_SPACING,f=t("./constants"),h=t("./scrollbox");function p(t){return t._index}function d(t,e){return+t.attr(f.menuIndexAttrName)===e._index}function g(t,e,r,n,i,a,o,s){e.active=o,c(t.layout,f.name,e).applyUpdate("active",o),"buttons"===e.type?v(t,n,null,null,e):"dropdown"===e.type&&(i.attr(f.menuIndexAttrName,"-1"),m(t,n,i,a,e),s||v(t,n,i,a,e))}function m(t,e,r,n,i){var a=s.ensureSingle(e,"g",f.headerClassName,(function(t){t.style("pointer-events","all")})),l=i._dims,c=i.active,u=i.buttons[c]||f.blankHeaderOpts,h={y:i.pad.t,yPad:0,x:i.pad.l,xPad:0,index:0},p={width:l.headerWidth,height:l.headerHeight};a.call(y,i,u,t).call(A,i,h,p),s.ensureSingle(e,"text",f.headerArrowClassName,(function(t){t.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(S,String(d(r,i)?-1:i._index)),v(t,e,r,n,i)})),a.on("mouseover",(function(){a.call(w)})),a.on("mouseout",(function(){a.call(T,i)})),o.setTranslate(e,l.lx,l.ly)}function v(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,c="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,u=r.selectAll("g."+c).data(s.filterVisible(l)),h=u.enter().append("g").classed(c,!0),p=u.exit();"dropdown"===o.type?(h.attr("opacity","0").transition().attr("opacity","1"),p.transition().attr("opacity","0").remove()):p.remove();var d=0,m=0,v=o._dims,x=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(x?m=v.headerHeight+f.gapButtonHeader:d=v.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(m=-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+m+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},k={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(A,o,b),c.on("click",(function(){n.event.defaultPrevented||(s.execute&&(s.args2&&o.active===l?(g(t,o,0,e,r,a,-1),i.executeAPICommand(t,s.method,s.args2)):(g(t,o,0,e,r,a,l),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(T,o),u.call(_,o)}))})),u.call(_,o),x?(k.w=Math.max(v.openWidth,v.headerWidth),k.h=b.y-k.t):(k.w=b.x-k.l,k.h=Math.max(v.openHeight,v.headerHeight)),k.direction=o.direction,a&&(u.size()?function(t,e,r,n,i,a){var o,s,l,c=i.direction,u="up"===c||"down"===c,h=i._dims,p=i.active;if(u)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,p);l.enter().append("g").classed(f.headerGroupClassName,!0);for(var c=s.ensureSingle(o,"g",f.dropdownButtonGroupClassName,(function(t){t.style("pointer-events","all")})),u=0;uw,M=s.barLength+2*s.barPad,A=s.barWidth+2*s.barPad,S=d,E=m+v;E+A>c&&(E=c-A);var C=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,s.barColor),k?(this.hbar=C.attr({rx:s.barRadius,ry:s.barRadius,x:S,y:E,width:M,height:A}),this._hbarXMin=S+M/2,this._hbarTranslateMax=w-M):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var L=v>T,I=s.barWidth+2*s.barPad,P=s.barLength+2*s.barPad,z=d+g,O=m;z+I>l&&(z=l-I);var D=this.container.selectAll("rect.scrollbar-vertical").data(L?[0]:[]);D.exit().on(".drag",null).remove(),D.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,s.barColor),L?(this.vbar=D.attr({rx:s.barRadius,ry:s.barRadius,x:z,y:O,width:I,height:P}),this._vbarYMin=O+P/2,this._vbarTranslateMax=T-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,B=L?f+I+.5:f+.5,N=h-.5,j=k?p+A+.5:p+.5,U=o._topdefs.selectAll("#"+R).data(k||L?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",R).append("rect"),k||L?(this._clipRect=U.select("rect").attr({x:Math.floor(F),y:Math.floor(N),width:Math.ceil(B)-Math.floor(F),height:Math.ceil(j)-Math.floor(N)}),this.container.call(a.setClipUrl,R,this.gd),this.bg.attr({x:d,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),k||L){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 q=n.behavior.drag().on("dragstart",(function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()})).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),L&&this.vbar.on(".drag",null).call(q)}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":778,"../color":643,"../drawing":665,d3:169}],745:[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"}}},{}],746:[function(t,e,r){"use strict";e.exports={axisRefDescription:function(t,e,r){return["If set to a",t,"axis id (e.g. *"+t+"* or","*"+t+"2*), the `"+t+"` position refers to a",t,"coordinate. If set to *paper*, the `"+t+"`","position refers to the distance from the",e,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",e,"("+r+"). If set to a",t,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",e,"of the domain of that axis: e.g.,","*"+t+"2 domain* refers to the domain of the second",t," axis and a",t,"position of 0.5 refers to the","point between the",e,"and the",r,"of the domain of the","second",t,"axis."].join(" ")}}},{}],747:[function(t,e,r){"use strict";e.exports={INCREASING:{COLOR:"#3D9970",SYMBOL:"\u25b2"},DECREASING:{COLOR:"#FF4136",SYMBOL:"\u25bc"}}},{}],748:[function(t,e,r){"use strict";e.exports={FORMAT_LINK:"https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format#locale_format"}},{}],749:[function(t,e,r){"use strict";e.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],750:[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]}},{}],751:[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"}},{}],752:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],753:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"\u2212"}},{}],754:[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}},{}],755:[function(t,e,r){"use strict";r.version=t("./version").version,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;splotly-logomark"}}},{}],758:[function(t,e,r){"use strict";r.isLeftAnchor=function(t){return"left"===t.xanchor||"auto"===t.xanchor&&t.x<=1/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/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}},{}],759:[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 c(t,e){return a(e-t,s)}function u(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,c){i=i||0,a=a||0;var u,f,h,p,d,g=l([r,n]);function m(t,e){return[t*Math.cos(e)+i,a-t*Math.sin(e)]}g?(u=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":785}],760:[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(u(+t,360)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r,n){var i=n.regex||c(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&&!!c(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:u}if("string"!=typeof t&&"number"!=typeof t)return u;t=String(t);var c=_(e),v=t.charAt(0);!c||"G"!==v&&"g"!==v||(t=t.substr(1),e="");var w=c&&"chinese"===e.substr(0,7),T=t.match(w?x:y);if(!T)return u;var k=T[1],M=T[3]||"1",A=Number(T[5]||1),S=Number(T[7]||0),E=Number(T[9]||0),C=Number(T[11]||0);if(c){if(2===k.length)return u;var L;k=Number(k);try{var I=m.getComponentMethod("calendars","getCal")(e);if(w){var P="i"===M.charAt(M.length-1);M=parseInt(M,10),L=I.newDate(k,I.toMonthIndex(k,M,P),A)}else L=I.newDate(k,Number(M),A)}catch(t){return u}return L?(L.toJD()-g)*f+S*h+E*p+C*d:u}k=2===k.length?(Number(k)+2e3-b)%100+b:Number(k),M-=1;var z=new Date(Date.UTC(2e3,M,A,S,E));return z.setUTCFullYear(k),z.getUTCMonth()!==M||z.getUTCDate()!==A?u:z.getTime()+C*d},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)!==u};var T=90*f,k=3*h,M=5*p;function A(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 u;e||(e=0);var a,o,s,c,y,x,b=Math.floor(10*l(t+.05,1)),w=Math.round(t-b/10);if(_(r)){var S=Math.floor(w/f)+g,E=Math.floor(l(t,f));try{a=m.getComponentMethod("calendars","getCal")(r).fromJD(S).formatDate("yyyy-mm-dd")}catch(t){a=v("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 u;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return A(a("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,n){if(t===u)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 S=/%\d?f/g;function E(t,e,r,n){t=t.replace(S,(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=m.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(i)}var C=[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/p),60),2);if("M"!==e){o(e)||(e=0);var i=(100+Math.min(l(t/d,60),C[e])).toFixed(e).substr(1);e>0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}(t,r)+"\n"+E(a.dayMonthYear,t,n,i);e=a.dayMonth+"\n"+a.year}return E(e,t,n,i)};var L=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=m.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 c=new Date(t+L);return c.setUTCMonth(c.getUTCMonth()+e)+n-L},r.findExactDates=function(t,e){for(var r,n,i=0,a=0,s=0,l=0,c=_(e)&&m.getComponentMethod("calendars","getCal")(e),u=0;u0&&t[e+1][0]<0)return e;return null}switch(e="RUS"===s||"FJI"===s?function(t){var e;if(null===c(t))e=t;else for(e=new Array(t.length),i=0;ie?r[n++]=[t[i][0]+360,t[i][1]]:i===e?(r[n++]=t[i],r[n++]=[t[i][0],-90]):r[n++]=t[i];var a=h.tester(r);a.pts.pop(),l.push(a)}:function(t){l.push(h.tester(t))},a.type){case"MultiPolygon":for(r=0;ri&&(i=c,e=l)}else e=r;return o.default(e).geometry.coordinates}(u),n.fIn=t,n.fOut=u,s.push(u)}else c.log(["Location",n.loc,"does not have a valid GeoJSON geometry.","Traces with locationmode *geojson-id* only support","*Polygon* and *MultiPolygon* geometries."].join(" "))}delete i[r]}switch(r.type){case"FeatureCollection":var h=r.features;for(n=0;n100?(clearInterval(a),n("Unexpected error while fetching from "+t)):void i++}),50)}))}for(var o=0;o0&&(r.push(i),i=[])}return i.length>0&&r.push(i),r},r.makeLine=function(t){return 1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}},r.makePolygon=function(t){if(1===t.length)return{type:"Polygon",coordinates:t};for(var e=new Array(t.length),r=0;r1||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,c){if(s(t,e,r,n,i,a,o,c))return 0;var u=r-t,f=n-e,h=o-i,p=c-a,d=u*u+f*f,g=h*h+p*p,m=Math.min(l(u,f,d,i-t,a-e),l(u,f,d,o-t,c-e),l(h,p,g,t-i,e-a),l(h,p,g,r-i,n-a));return Math.sqrt(m)},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)),c=t.getPointAtLength(o(r+s/2,e)),u=Math.atan((c.y-l.y)/(c.x-l.x)),f=t.getPointAtLength(o(r,e)),h={x:(4*f.x+l.x+c.x)/6,y:(4*f.y+l.y+c.y)/6,theta:u};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,c=0,u=t.getTotalLength(),f=u;function h(e){var r=t.getPointAtLength(e);0===e?n=r:e===u&&(i=r);var c=r.xo?r.x-o:0,f=r.yl?r.y-l:0;return Math.sqrt(c*c+f*f)}for(var p=h(c);p;){if((c+=p+r)>f)return;p=h(c)}for(p=h(f);p;){if(c>(f-=p+r))return;p=h(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&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,c=n.iterationLimit||30,u=t.getPointAtLength(0)[r]>t.getPointAtLength(s)[r]?-1:1,f=0,h=0,p=s;f0?p=i:h=i,f++}return a}},{"./mod":785}],774:[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,c=a(s);function u(t,e){var r=t;return r[3]*=e,r}function f(t){if(n(t))return c;var e=a(t);return e.length?e:c}function h(t){return n(t)?t:1}e.exports={formatColor:function(t,e,r){var n,i,s,p,d,g=t.color,m=l(g),v=l(e),y=o.extractOpts(t),x=[];if(n=void 0!==y.colorscale?o.makeColorScaleFuncFromTrace(t):f,i=m?function(t,e){return void 0===t[e]?c:a(n(t[e]))}:f,s=v?function(t,e){return void 0===t[e]?1:h(t[e])}:h,m||v)for(var b=0;b1?(r*t+r*e)/r:t+e,i=String(n).length;if(i>16){var a=String(e).length;if(i>=String(t).length+a){var o=parseFloat(n).toPrecision(12);-1===o.indexOf("e+")&&(n=+o)}}return n}},{}],778:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../constants/numerical"),s=o.FP_SAFE,l=o.BADNUM,c=e.exports={};c.nestedProperty=t("./nested_property"),c.keyedContainer=t("./keyed_container"),c.relativeAttr=t("./relative_attr"),c.isPlainObject=t("./is_plain_object"),c.toLogRange=t("./to_log_range"),c.relinkPrivateKeys=t("./relink_private");var u=t("./array");c.isTypedArray=u.isTypedArray,c.isArrayOrTypedArray=u.isArrayOrTypedArray,c.isArray1D=u.isArray1D,c.ensureArray=u.ensureArray,c.concat=u.concat,c.maxRowLength=u.maxRowLength,c.minRowLength=u.minRowLength;var f=t("./mod");c.mod=f.mod,c.modHalf=f.modHalf;var h=t("./coerce");c.valObjectMeta=h.valObjectMeta,c.coerce=h.coerce,c.coerce2=h.coerce2,c.coerceFont=h.coerceFont,c.coerceHoverinfo=h.coerceHoverinfo,c.coerceSelectionMarkerOpacity=h.coerceSelectionMarkerOpacity,c.validate=h.validate;var p=t("./dates");c.dateTime2ms=p.dateTime2ms,c.isDateTime=p.isDateTime,c.ms2DateTime=p.ms2DateTime,c.ms2DateTimeLocal=p.ms2DateTimeLocal,c.cleanDate=p.cleanDate,c.isJSDate=p.isJSDate,c.formatDate=p.formatDate,c.incrementMonth=p.incrementMonth,c.dateTick0=p.dateTick0,c.dfltRange=p.dfltRange,c.findExactDates=p.findExactDates,c.MIN_MS=p.MIN_MS,c.MAX_MS=p.MAX_MS;var d=t("./search");c.findBin=d.findBin,c.sorterAsc=d.sorterAsc,c.sorterDes=d.sorterDes,c.distinctVals=d.distinctVals,c.roundUp=d.roundUp,c.sort=d.sort,c.findIndexOfMin=d.findIndexOfMin;var g=t("./stats");c.aggNums=g.aggNums,c.len=g.len,c.mean=g.mean,c.median=g.median,c.midRange=g.midRange,c.variance=g.variance,c.stdev=g.stdev,c.interp=g.interp;var m=t("./matrix");c.init2dArray=m.init2dArray,c.transposeRagged=m.transposeRagged,c.dot=m.dot,c.translationMatrix=m.translationMatrix,c.rotationMatrix=m.rotationMatrix,c.rotationXYMatrix=m.rotationXYMatrix,c.apply3DTransform=m.apply3DTransform,c.apply2DTransform=m.apply2DTransform,c.apply2DTransform2=m.apply2DTransform2,c.convertCssMatrix=m.convertCssMatrix,c.inverseTransformMatrix=m.inverseTransformMatrix;var v=t("./angles");c.deg2rad=v.deg2rad,c.rad2deg=v.rad2deg,c.angleDelta=v.angleDelta,c.angleDist=v.angleDist,c.isFullCircle=v.isFullCircle,c.isAngleInsideSector=v.isAngleInsideSector,c.isPtInsideSector=v.isPtInsideSector,c.pathArc=v.pathArc,c.pathSector=v.pathSector,c.pathAnnulus=v.pathAnnulus;var y=t("./anchor_utils");c.isLeftAnchor=y.isLeftAnchor,c.isCenterAnchor=y.isCenterAnchor,c.isRightAnchor=y.isRightAnchor,c.isTopAnchor=y.isTopAnchor,c.isMiddleAnchor=y.isMiddleAnchor,c.isBottomAnchor=y.isBottomAnchor;var x=t("./geometry2d");c.segmentsIntersect=x.segmentsIntersect,c.segmentDistance=x.segmentDistance,c.getTextLocation=x.getTextLocation,c.clearLocationCache=x.clearLocationCache,c.getVisibleSegment=x.getVisibleSegment,c.findPointOnPath=x.findPointOnPath;var b=t("./extend");c.extendFlat=b.extendFlat,c.extendDeep=b.extendDeep,c.extendDeepAll=b.extendDeepAll,c.extendDeepNoArrays=b.extendDeepNoArrays;var _=t("./loggers");c.log=_.log,c.warn=_.warn,c.error=_.error;var w=t("./regex");c.counterRegex=w.counter;var T=t("./throttle");c.throttle=T.throttle,c.throttleDone=T.done,c.clearThrottle=T.clear;var k=t("./dom");function M(t){var e={};for(var r in t)for(var n=t[r],i=0;is?l:a(t)?Number(t):l:l},c.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(a(t)&&t>=0&&t%1==0)},c.noop=t("./noop"),c.identity=t("./identity"),c.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))},c.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},c.simpleMap=function(t,e,r,n,i){for(var a=t.length,o=new Array(a),s=0;s=Math.pow(2,r)?i>10?(c.warn("randstr failed uniqueness"),l):t(e,r,n,(i||0)+1):l},c.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},c.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,c=new Array(l),u=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]*c[n];u[r]=a}return u},c.syncOrAsync=function(t,e,r){var n;function i(){return c.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,c.promiseError);return r&&r(e)},c.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},c.noneOrAll=function(t,e,r){if(t){var n,i=!1,a=!0;for(n=0;n0?e:0}))},c.fillArray=function(t,e,r,n){if(n=n||c.identity,c.isArrayOrTypedArray(t))for(var i=0;i1?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},c.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var I=/^\w*$/;c.templateString=function(t,e){var r={};return t.replace(c.TEMPLATE_STRING_REGEX,(function(t,n){var i;return I.test(n)?i=e[n]:(r[n]=r[n]||c.nestedProperty(e,n).get,i=r[n]()),c.isValidTextValue(i)?i:""}))};var P={max:10,count:0,name:"hovertemplate"};c.hovertemplateString=function(){return D.apply(P,arguments)};var z={max:10,count:0,name:"texttemplate"};c.texttemplateString=function(){return D.apply(z,arguments)};var O=/^[:|\|]/;function D(t,e,r){var a=this,o=arguments;e||(e={});var s={};return t.replace(c.TEMPLATE_STRING_REGEX,(function(t,l,u){var f,h,p,d;for(p=3;p=48&&o<=57,c=s>=48&&s<=57;if(l&&(n=10*n+o-48),c&&(i=10*i+s-48),!l||!c){if(n!==i)return n-i;if(o!==s)return o-s}}return i-n};var R=2e9;c.seedPseudoRandom=function(){R=2e9},c.pseudoRandom=function(){var t=R;return R=(69069*R+1)%4294967296,Math.abs(R-t)<429496729?c.pseudoRandom():R/4294967296},c.fillText=function(t,e,r){var n=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},i=c.extractOption(t,e,"htx","hovertext");if(c.isValidTextValue(i))return n(i);var a=c.extractOption(t,e,"tx","text");return c.isValidTextValue(a)?n(a):void 0},c.isValidTextValue=function(t){return t||0===t},c.formatPercent=function(t,e){e=e||0;for(var r=(Math.round(100*t*Math.pow(10,e))*Math.pow(.1,e)).toFixed(e)+"%",n=0;n1&&(u=1):u=0,c.strTranslate(i-u*(r+o),a-u*(n+s))+c.strScale(u)+(l?"rotate("+l+(e?"":" "+r+" "+n)+")":"")},c.ensureUniformFontSize=function(t,e){var r=c.extendFlat({},e);return r.size=Math.max(e.size,t._fullLayout.uniformtext.minsize||0),r},c.join2=function(t,e,r){var n=t.length;return n>1?t.slice(0,-1).join(e)+r+t[n-1]:t.join(e)}},{"../constants/numerical":753,"./anchor_utils":758,"./angles":759,"./array":760,"./clean_number":761,"./clear_responsive":763,"./coerce":764,"./dates":765,"./dom":766,"./extend":768,"./filter_unique":769,"./filter_visible":770,"./geometry2d":773,"./identity":776,"./increment":777,"./is_plain_object":779,"./keyed_container":780,"./localize":781,"./loggers":782,"./make_trace_groups":783,"./matrix":784,"./mod":785,"./nested_property":786,"./noop":787,"./notifier":788,"./push_unique":792,"./regex":794,"./relative_attr":795,"./relink_private":796,"./search":797,"./stats":800,"./throttle":803,"./to_log_range":804,d3:169,"d3-time-format":166,"fast-isnumeric":241}],779:[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}},{}],780:[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 c={};e&&e.length?(l=n(t,e),s=l.get()):s=t,e=e||"";var u={};if(s)for(o=0;o2)return c[e]=2|c[e],h.set(t,null);if(f){for(o=e;o1){var e=["LOG:"];for(t=0;t1){var r=[];for(t=0;t"),"long")}},a.warn=function(){var t;if(n.logging>0){var e=["WARN:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}},a.error=function(){var t;if(n.logging>0){var e=["ERROR:"];for(t=0;t0){var r=[];for(t=0;t"),"stick")}}},{"../plot_api/plot_config":814,"./notifier":788}],783:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e,r){var i=t.selectAll("g."+r.replace(/\s/g,".")).data(e,(function(t){return t[0].trace.uid}));i.exit().remove(),i.enter().append("g").attr("class",r),i.order();var a=t.classed("rangeplot")?"nodeRangePlot3":"node3";return i.each((function(t){t[0][a]=n.select(this)})),i}},{d3:169}],784:[function(t,e,r){"use strict";var n=t("gl-mat4");r.init2dArray=function(t,e){for(var r=new Array(t),n=0;ne/2?t-Math.round(t/e)*e:t}}},{}],786:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./array").isArrayOrTypedArray;function a(t,e){return function(){var r,n,o,s,l,c=t;for(s=0;s/g),l=0;la||c===i||cs)&&(!e||!l(t))}:function(t,e){var l=t[0],c=t[1];if(l===i||la||c===i||cs)return!1;var u,f,h,p,d,g=r.length,m=r[0][0],v=r[0][1],y=0;for(u=1;uMath.max(f,m)||c>Math.max(h,v)))if(cu||Math.abs(n(o,h))>i)return!0;return!1},a.filter=function(t,e){var r=[t[0]],n=0,i=0;function o(o){t.push(o);var s=r.length,l=n;r.splice(i+1);for(var c=l+1;c1&&o(t.pop());return{addPt:o,raw:t,filtered:r}}},{"../constants/numerical":753,"./matrix":784}],791:[function(t,e,r){(function(r){(function(){"use strict";var n=t("./show_no_webgl_msg"),i=t("regl");e.exports=function(t,e){var a=t._fullLayout,o=!0;return a._glcanvas.each((function(n){if(!n.regl&&(!n.pick||a._has("parcoords"))){try{n.regl=i({canvas:this,attributes:{antialias:!n.pick,preserveDrawingBuffer:!0},pixelRatio:t._context.plotGlPixelRatio||r.devicePixelRatio,extensions:e||[]})}catch(t){o=!1}n.regl||(o=!1),o&&this.addEventListener("webglcontextlost",(function(e){t&&t.emit&&t.emit("plotly_webglcontextlost",{event:e,layer:n.key})}),!1)}})),o||n({container:a._glcontainer.node()}),o}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./show_no_webgl_msg":799,regl:540}],792:[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,o,f=0,h=e.length,p=0,d=h>1?(e[h-1]-e[0])/(h-1):1;for(o=d>=0?r?s:l:r?u:c,t+=1e-9*d*(r?-1:1)*(d>=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,e){var n,i=(e||{}).unitMinDiff,a=t.slice();for(a.sort(r.sorterAsc),n=a.length-1;n>-1&&a[n]===o;n--);var s=1;i||(s=a[n]-a[0]||1);for(var l,c=s/(n||1)/1e4,u=[],f=0;f<=n;f++){var h=a[f],p=h-l;void 0===l?(u.push(h),l=h):p>c&&(s=Math.min(s,p),u.push(h),l=h)}return{vals:u,minDiff:s}},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,c=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":760,"fast-isnumeric":241}],801:[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":125}],802:[function(t,e,r){"use strict";var n=t("d3"),i=t("../lib"),a=i.strTranslate,o=t("../constants/xmlns_namespaces"),s=t("../constants/alignment").LINE_SPACING;function l(t,e){return t.node().getBoundingClientRect()[e]}var c=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,A){var S=t.text(),C=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&S.match(c),L=n.select(t.node().parentNode);if(!L.empty()){var I=t.attr("class")?t.attr("class").split(" ")[0]:"text";return I+="-math",L.selectAll("svg."+I).remove(),L.selectAll("g."+I+"-group").remove(),t.style("display",null).attr({"data-unformatted":S,"data-math":"N"}),C?(e&&e._promises||[]).push(new Promise((function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),o={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(f,"\\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)}))}(C[2],o,(function(n,i,o){L.selectAll("svg."+I).remove(),L.selectAll("g."+I+"-group").remove();var s=n&&n.select("svg");if(!s||!s.node())return P(),void e();var c=L.append("g").classed(I+"-group",!0).attr({"pointer-events":"none","data-unformatted":S,"data-math":"Y"});c.node().appendChild(s.node()),i&&i.node()&&s.node().insertBefore(i.node().cloneNode(!0),s.node().firstChild),s.attr({class:I,height:o.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=t.node().style.fill||"black",f=s.select("g");f.attr({fill:u,stroke:u});var h=l(f,"width"),p=l(f,"height"),d=+t.attr("x")-h*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],g=-(r||l(t,"height"))/4;"y"===I[0]?(c.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+")"+a(-h/2,g-p/2)}),s.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===I[0]?s.attr({x:t.attr("x"),y:g-p/2}):"a"===I[0]&&0!==I.indexOf("atitle")?s.attr({x:0,y:g}):s.attr({x:d,y:+t.attr("y")+g-p/2}),A&&A.call(t,c),e(c)}))}))):P(),t}function P(){L.empty()||(I=t.attr("class")+"-math",L.select("svg."+I).remove()),t.text("").style("white-space","pre"),function(t,e){e=e.replace(m," ");var r,a=!1,l=[],c=-1;function u(){c++;var e=document.createElementNS(o.svg,"tspan");n.select(e).attr({class:"line",dy:c*s+"em"}),t.appendChild(e),r=e;var i=l;if(l=[{node:e}],i.length>1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),r=l[l.length-1].node}else i.log("Ignoring unexpected end tag .",e)}x.test(e)?u():(r=t,l=[{node:t}]);for(var C=e.split(v),L=0;L|>|>)/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"},p={sub:"0.3em",sup:"-0.6em"},d={sub:"-0.21em",sup:"0.42em"},g=["http:","https:","mailto:","",void 0,":"],m=r.NEWLINES=/(\r\n?|\n)/g,v=/(<[^<>]*>)/,y=/<(\/?)([^ >]*)(\s+(.*))?>/i,x=//i;r.BR_TAG_ALL=//gi;var b=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,_=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,T=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function k(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&E(n)}var M=/(^|;)\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(v),o=[],s="",l=0,c=0;ci?o.push(u.substr(0,d-i)+"..."):o.push(u.substr(0,d));break}s=""}}return o.join("")};var A={mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},S=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function E(t){return t.replace(S,(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)):A[e])||t}))}function C(t,e,r){var n,a,o,s=r.horizontalAlign,l=r.verticalAlign||"top",c=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return a="bottom"===l?function(){return c.bottom-n.height}:"middle"===l?function(){return c.top+(c.height-n.height)/2}:function(){return c.top},o="right"===s?function(){return c.right-n.width}:"center"===s?function(){return c.left+(c.width-n.width)/2}:function(){return c.left},function(){n=this.node().getBoundingClientRect();var t=o()-u.left,e=a()-u.top,s=r.gd||{};if(r.gd){s._fullLayout._calcInverseTransform(s);var l=i.apply3DTransform(s._fullLayout._invTransform)(t,e);t=l[0],e=l[1]}return this.style({top:e+"px",left:t+"px","z-index":1e3}),this}}r.convertEntities=E,r.sanitizeHTML=function(t){t=t.replace(m," ");for(var e=document.createElement("p"),r=e,i=[],a=t.split(v),o=0;oa.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)}},{}],804:[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":241}],805:[function(t,e,r){"use strict";var n=e.exports={},i=t("../plots/geo/constants").locationmodeToLayer,a=t("topojson-client").feature;n.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},n.getTopojsonPath=function(t,e){return t+e+".json"},n.getTopojsonFeatures=function(t,e){var r=i[t.locationmode],n=e.objects[r];return a(e,n).features}},{"../plots/geo/constants":857,"topojson-client":579}],806:[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"}}},{}],807:[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"}}},{}],808:[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?(z.x=1.02,z.xanchor="left"):z.x<-2&&(z.x=-.02,z.xanchor="right"),z.y>3?(z.y=1.02,z.yanchor="bottom"):z.y<-2&&(z.y=-.02,z.yanchor="top")),d(t),"rotate"===t.dragmode&&(t.dragmode="orbit"),c.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=b(e);r;){if(r in t)return!0;r=b(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(c(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(m,v),p(t),!0)}var x,b,_,w,T,k,M,A,S=Object.keys(r).map(Number).sort(o),E=e.get(),C=E||[],L=u(v,f).get(),I=[],P=-1,z=C.length;for(x=0;xC.length-(M?0:1))a.warn("index out of range",f,_);else if(void 0!==k)T.length>1&&a.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?I.push(_):M?("add"===k&&(k={}),C.splice(_,0,k),L&&L.splice(_,0,{})):a.warn("Unrecognized full object edit value",f,_,k),-1===P&&(P=_);else for(b=0;b=0;x--)C.splice(I[x],1),L&&L.splice(I[x],1);if(C.length?E||e.set(C):e.set(null),g)return!1;if(h(m,v),d!==i){var O;if(-1===P)O=S;else{for(z=Math.max(C.length,z),O=[],x=0;x=P);x++)O.push(_);for(x=P;x=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 O(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 D(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,c,u,f,h=o.isPlainObject(n),p=[];for(var d 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),T.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=Z(t,n),a=i.flags;a.calc&&(t.calcdata=void 0);var s=[h.previousPromises];a.layoutReplot?s.push(k.layoutReplot):Object.keys(n).length&&(H(t,a,i)||h.supplyDefaults(t),a.legend&&s.push(k.doLegend),a.layoutstyle&&s.push(k.layoutStyles),a.axrange&&G(s,i.rangesAltered),a.ticks&&s.push(k.doTicksRelayout),a.modebar&&s.push(k.doModeBar),a.camera&&s.push(k.doCamera),a.colorbars&&s.push(k.doColorBars),s.push(E)),s.push(h.rehover,h.redrag),c.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 H(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=d.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 c in l._matchGroup)if(c!==a){var u=n[d.id2name(c)];u.autorange=l.autorange,u.range=l.range.slice(),u._input.range=l.range.slice()}}return!0}function G(t,e){var r=e?function(t){var r=[],n=!0;for(var i in e){var a=d.getFromId(t,i);if(r.push(i),-1!==(a.ticklabelposition||"").indexOf("inside")&&a._anchorAxis&&r.push(a._anchorAxis._id),a._matchGroup)for(var o in a._matchGroup)e[o]||r.push(o);a.automargin&&(n=!1)}return d.draw(t,r,{skipTitle:n})}:function(t){return d.draw(t,"redraw")};t.push(b,k.doAutoRangeAndConstraints,r,k.drawData,k.finalDraw)}var Y=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,W=/^[xyz]axis[0-9]*\.autorange$/,X=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function Z(t,e){var r,n,i,a=t.layout,l=t._fullLayout,c=l._guiEditing,h=N(l._preGUI,c),p=Object.keys(e),g=d.list(t),m=o.extendDeepAll({},e),v={};for(V(e),p=Object.keys(e),n=0;n0&&"string"!=typeof z.parts[D];)D--;var R=z.parts[D],F=z.parts[D-1]+"."+R,j=z.parts.slice(0,D).join("."),U=s(t.layout,j).get(),q=s(l,j).get(),H=z.get();if(void 0!==O){k[P]=O,S[P]="reverse"===R?O:B(H);var G=f.getLayoutValObject(l,z.parts);if(G&&G.impliedEdits&&null!==O)for(var Z in G.impliedEdits)E(o.relativeAttr(P,Z),G.impliedEdits[Z]);if(-1!==["width","height"].indexOf(P))if(O){E("autosize",null);var K="height"===P?"width":"height";E(K,l[K])}else l[P]=t._initialAutoSize[P];else if("autosize"===P)E("width",O?null:l.width),E("height",O?null:l.height);else if(F.match(Y))I(F),s(l,j+"._inputRange").set(null);else if(F.match(W)){I(F),s(l,j+"._inputRange").set(null);var Q=s(l,j).get();Q._inputDomain&&(Q._input.domain=Q._inputDomain.slice())}else F.match(X)&&s(l,j+"._inputDomain").set(null);if("type"===R){C=U;var $="linear"===q.type&&"log"===O,tt="log"===q.type&&"linear"===O;if($||tt){if(C&&C.range)if(q.autorange)$&&(C.range=C.range[1]>C.range[0]?[1,2]:[2,1]);else{var et=C.range[0],rt=C.range[1];$?(et<=0&&rt<=0&&E(j+".autorange",!0),et<=0?et=rt/1e6:rt<=0&&(rt=et/1e6),E(j+".range[0]",Math.log(et)/Math.LN10),E(j+".range[1]",Math.log(rt)/Math.LN10)):(E(j+".range[0]",Math.pow(10,et)),E(j+".range[1]",Math.pow(10,rt)))}else E(j+".autorange",!0);Array.isArray(l._subplots.polar)&&l._subplots.polar.length&&l[z.parts[0]]&&"radialaxis"===z.parts[1]&&delete l[z.parts[0]]._subplot.viewInitial["radialaxis.range"],u.getComponentMethod("annotations","convertCoords")(t,q,O,E),u.getComponentMethod("images","convertCoords")(t,q,O,E)}else E(j+".autorange",!0),E(j+".range",null);s(l,j+"._inputRange").set(null)}else if(R.match(A)){var nt=s(l,P).get(),it=(O||{}).type;it&&"-"!==it||(it="linear"),u.getComponentMethod("annotations","convertCoords")(t,nt,it,E),u.getComponentMethod("images","convertCoords")(t,nt,it,E)}var at=w.containerArrayMatch(P);if(at){r=at.array,n=at.index;var ot=at.property,st=G||{editType:"calc"};""!==n&&""===ot&&(w.isAddVal(O)?S[P]=null:w.isRemoveVal(O)?S[P]=(s(a,r).get()||[])[n]:o.warn("unrecognized full object value",e)),M.update(_,st),v[r]||(v[r]={});var lt=v[r][n];lt||(lt=v[r][n]={}),lt[ot]=O,delete e[P]}else"reverse"===R?(U.range?U.range.reverse():(E(j+".autorange",!0),U.range=[1,0]),q.autorange?_.calc=!0:_.plot=!0):(l._has("scatter-like")&&l._has("regl")&&"dragmode"===P&&("lasso"===O||"select"===O)&&"lasso"!==H&&"select"!==H||l._has("gl2d")?_.plot=!0:G?M.update(_,G):_.calc=!0,z.set(O))}}for(r in v){w.applyContainerArrayChanges(t,h(a,r),v[r],_,h)||(_.plot=!0)}for(var ct in L){var ut=(C=d.getFromId(t,ct))&&C._constraintGroup;if(ut)for(var ft in _.calc=!0,ut)L[ft]||(d.getFromId(t,ft)._constraintShrinkable=!0)}return(J(t)||e.height||e.width)&&(_.plot=!0),(_.plot||_.calc)&&(_.layoutReplot=!0),{flags:_,rangesAltered:L,undoit:S,redoit:k,eventData:m}}function J(t){var e=t._fullLayout,r=e.width,n=e.height;return t.layout.autosize&&h.plotAutoSize(t,t.layout,e),e.width!==r||e.height!==n}function K(t,e,n,i){if(t=o.getGraphDiv(t),T.clearPromiseQueue(t),t.framework&&t.framework.isPolar)return Promise.resolve(t);o.isPlainObject(e)||(e={}),o.isPlainObject(n)||(n={}),Object.keys(e).length&&(t.changed=!0),Object.keys(n).length&&(t.changed=!0);var a=T.coerceTraceIndices(t,i),s=U(t,o.extendFlat({},e),a),l=s.flags,u=Z(t,o.extendFlat({},n)),f=u.flags;(l.calc||f.calc)&&(t.calcdata=void 0),l.clearAxisTypes&&T.clearAxisTypes(t,a,n);var p=[];f.layoutReplot?p.push(k.layoutReplot):l.fullReplot?p.push(r.plot):(p.push(h.previousPromises),H(t,f,u)||h.supplyDefaults(t),l.style&&p.push(k.doTraceStyle),(l.colorbars||f.colorbars)&&p.push(k.doColorBars),f.legend&&p.push(k.doLegend),f.layoutstyle&&p.push(k.layoutStyles),f.axrange&&G(p,u.rangesAltered),f.ticks&&p.push(k.doTicksRelayout),f.modebar&&p.push(k.doModeBar),f.camera&&p.push(k.doCamera),p.push(E)),p.push(h.rehover,h.redrag),c.add(t,K,[t,s.undoit,u.undoit,s.traces],K,[t,s.redoit,u.redoit,s.traces]);var d=o.syncOrAsync(p,t);return d&&d.then||(d=Promise.resolve(t)),d.then((function(){return t.emit("plotly_update",{data:s.eventData,layout:u.eventData}),t}))}function Q(t){return function(e){e._fullLayout._guiEditing=!0;var r=t.apply(null,arguments);return e._fullLayout._guiEditing=!1,r}}var $=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],tt=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function et(t,e){for(var r=0;r1;)if(n.pop(),void 0!==(r=s(e,n.join(".")+".uirevision").get()))return r;return e.uirevision}function nt(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 c(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,u){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,T.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 p(){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 d,g,m=0;function v(t){return Array.isArray(i)?m>=i.length?t.transitionOpts=i[m]:t.transitionOpts=i[0]:t.transitionOpts=i,m++,t}var y=[],x=null==e,b=Array.isArray(e);if(!x&&!b&&o.isPlainObject(e))y.push({type:"object",data:v(o.extendFlat({},e))});else if(x||-1!==["string","number"].indexOf(typeof e))for(d=0;d0&&kk)&&M.push(g);y=M}}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,m=(u[g]||d[g]||{}).name,v=e[n].name,y=u[m]||d[m];m&&v&&"number"==typeof v&&y&&S<5&&(S++,o.warn('addFrames: overwriting frame "'+(u[m]||d[m]).name+'" with a frame whose name of type "number" also equates to "'+m+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===S&&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.")),d[g]={name:g},p.push({frame:h.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:f+n})}p.sort((function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(i=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;u[i.name="frame "+t._transitionData._counter++];);if(u[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,u=h.modifyFrames,f=[t,s],p=[t,a];return c&&c.add(t,l,f,u,p),h.modifyFrames(t,a)},r.addTraces=function t(e,n,i){e=o.getGraphDiv(e);var a,s,l=[],u=r.deleteTraces,f=t,h=[e,l],p=[e,n];for(function(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&r=0&&r=a.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!_(o))return!1;t=a[i][o]}else t=a[i]}else t=a}}return t}function _(t){return t===Math.round(t)&&t>=0}function w(){var t,e,r={};for(t in d(r,o),n.subplotsRegistry){if((e=n.subplotsRegistry[t]).layoutAttributes)if(Array.isArray(e.attr))for(var i=0;i=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 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 c;for(r=0;r=i&&(r._input||{})._templateitemname;o&&(a=i);var s,l=e+"["+a+"]";function c(){s={},o&&(s[l]={},s[l].templateitemname=o)}function u(t,e){o?n.nestedProperty(s[l],t).set(e):s[l+"."+t]=e}function f(){var t=s;return c(),t}return c(),{modifyBase:function(t,e){s[t]=e},modifyItem:u,getUpdateObj:f,applyUpdate:function(e,r){e&&u(e,r);var i=f();for(var a in i)n.nestedProperty(t,a).set(i[a])}}}},{"../lib":778,"../plots/attributes":823}],817:[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"),c=t("../components/drawing"),u=t("../components/titles"),f=t("../components/modebar"),h=t("../plots/cartesian/axes"),p=t("../constants/alignment"),d=t("../plots/cartesian/constraints"),g=d.enforce,m=d.clean,v=t("../plots/cartesian/autorange").doAutoRange;function y(t,e,r){for(var n=0;n=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}function x(t){var e,i,s,u,d,g,m=t._fullLayout,v=m._size,x=v.p,_=h.list(t,"",!0);if(m._paperdiv.style({width:t._context.responsive&&m.autosize&&!t._context._hasZeroWidth&&!t.layout.width?"100%":m.width+"px",height:t._context.responsive&&m.autosize&&!t._context._hasZeroHeight&&!t.layout.height?"100%":m.height+"px"}).selectAll(".main-svg").call(c.setSize,m.width,m.height),t._context.setBackground(t,m.paper_bgcolor),r.drawMainTitle(t),f.manage(t),!m._has("cartesian"))return a.previousPromises(t);function T(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-x-n:e._offset+e._length+x+n:v.t+v.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+x+n:e._offset-x-n:v.l+v.w*(t.position||0)+n%1}for(e=0;e<_.length;e++){var k=(u=_[e])._anchorAxis;u._linepositions={},u._lw=c.crispRound(t,u.linewidth,1),u._mainLinePosition=T(u,k,u.side),u._mainMirrorPosition=u.mirror&&k?T(u,k,p.OPPOSITE_SIDE[u.side]):null}var M=[],A=[],S=[],E=1===l.opacity(m.paper_bgcolor)&&1===l.opacity(m.plot_bgcolor)&&m.paper_bgcolor===m.plot_bgcolor;for(i in m._plots)if((s=m._plots[i]).mainplot)s.bg&&s.bg.remove(),s.bg=void 0;else{var C=s.xaxis.domain,L=s.yaxis.domain,I=s.plotgroup;if(y(C,L,S)){var P=I.node(),z=s.bg=o.ensureSingle(I,"rect","bg");P.insertBefore(z.node(),P.childNodes[0]),A.push(i)}else I.select("rect.bg").remove(),S.push([C,L]),E||(M.push(i),A.push(i))}var O,D,R,F,B,N,j,U,V,q,H,G,Y,W=m._bgLayer.selectAll(".bg").data(M);for(W.enter().append("rect").classed("bg",!0),W.exit().remove(),W.each((function(t){m._plots[t].bg=n.select(this)})),e=0;eT?u.push({code:"unused",traceType:y,templateCount:w,dataCount:T}):T>w&&u.push({code:"reused",traceType:y,templateCount:w,dataCount:T})}}else u.push({code:"data"});if(function t(e,r){for(var n in e)if("_"!==n.charAt(0)){var a=e[n],o=g(e,n,r);i(a)?(Array.isArray(e)&&!1===a._template&&a.templateitemname&&u.push({code:"missing",path:o,templateitemname:a.templateitemname}),t(a,o)):Array.isArray(a)&&m(a)&&t(a,o)}}({data:p,layout:h},""),u.length)return u.map(v)}},{"../lib":778,"../plots/attributes":823,"../plots/plots":890,"./plot_config":814,"./plot_schema":815,"./plot_template":816}],819:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./plot_api"),a=t("../plots/plots"),o=t("../lib"),s=t("../snapshot/helpers"),l=t("../snapshot/tosvg"),c=t("../snapshot/svgtoimg"),u=t("../version").version,f={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],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}};e.exports=function(t,e){var r,h,p,d;function g(t){return!(t in e)||o.validate(e[t],f[t])}if(e=e||{},o.isPlainObject(t)?(r=t.data||[],h=t.layout||{},p=t.config||{},d={}):(t=o.getGraphDiv(t),r=o.extendDeep([],t.data),h=o.extendDeep({},t.layout),p=t._context,d=t._fullLayout||{}),!g("width")&&null!==e.width||!g("height")&&null!==e.height)throw new Error("Height and width should be pixel values.");if(!g("format"))throw new Error("Export format is not "+o.join2(f.format.values,", "," or ")+".");var m={};function v(t,r){return o.coerce(e,m,f,t,r)}var y=v("format"),x=v("width"),b=v("height"),_=v("scale"),w=v("setBackground"),T=v("imageDataOnly"),k=document.createElement("div");k.style.position="absolute",k.style.left="-5000px",document.body.appendChild(k);var M=o.extendFlat({},h);x?M.width=x:null===e.width&&n(d.width)&&(M.width=d.width),b?M.height=b:null===e.height&&n(d.height)&&(M.height=d.height);var A=o.extendFlat({},p,{_exportedPlot:!0,staticPlot:!0,setBackground:w}),S=s.getRedrawFunc(k);function E(){return new Promise((function(t){setTimeout(t,s.getDelay(k._fullLayout))}))}function C(){return new Promise((function(t,e){var r=l(k,y,_),n=k._fullLayout.width,f=k._fullLayout.height;function h(){i.purge(k),document.body.removeChild(k)}if("full-json"===y){var p=a.graphJson(k,!1,"keepdata","object",!0,!0);return p.version=u,p=JSON.stringify(p),h(),t(T?p:s.encodeJSON(p))}if(h(),"svg"===y)return t(T?r:s.encodeSVG(r));var d=document.createElement("canvas");d.id=o.randstr(),c({format:y,width:n,height:f,scale:_,canvas:d,svg:r,promise:!0}).then(t).catch(e)}))}return new Promise((function(t,e){i.plot(k,r,M,A).then(S).then(E).then(C).then((function(e){t(function(t){return T?t.replace(s.IMAGE_URL_PREFIX,""):t}(e))})).catch((function(t){e(t)}))}))}},{"../lib":778,"../plots/plots":890,"../snapshot/helpers":914,"../snapshot/svgtoimg":916,"../snapshot/tosvg":918,"../version":1369,"./plot_api":813,"fast-isnumeric":241}],820:[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,c=n.isArrayOrTypedArray;function u(t,e,r,i,a,o){o=o||[];for(var f=Object.keys(t),h=0;hx.length&&i.push(d("unused",a,v.concat(x.length)));var M,A,S,E,C,L=x.length,I=Array.isArray(k);if(I&&(L=Math.min(L,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&i.push(d("unused",a,v.concat(A,x[A].length)));var P=x[A].length;for(M=0;M<(I?Math.min(P,k[A].length):P);M++)S=I?k[A][M]:k,E=y[A][M],C=x[A][M],n.validate(E,S)?C!==E&&C!==+E&&i.push(d("dynamic",a,v.concat(A,M),E,C)):i.push(d("value",a,v.concat(A,M),E))}else i.push(d("array",a,v.concat(A),y[A]));else for(A=0;A1&&p.push(d("object","layout"))),i.supplyDefaults(g);for(var m=g._fullData,v=r.length,y=0;y0&&Math.round(f)===f))return i;c=f}for(var h=e.calendar,p="start"===l,d="end"===l,g=t[r+"period0"],m=a(g,h)||0,v=[],y=i.length,x=0;xT;)w=o(w,-c,h);for(;w<=T;)w=o(w,c,h);_=o(w,-c,h)}else{for(w=m+(b=Math.round((T-m)/u))*u;w>T;)w-=u;for(;w<=T;)w+=u;_=w-u}v[x]=p?_:d?w:(_+w)/2}return v}},{"../../constants/numerical":753,"../../lib":778,"fast-isnumeric":241}],825:[function(t,e,r){"use strict";e.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],826:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../constants/numerical").FP_SAFE,o=t("../../registry"),s=t("./axis_ids").getFromId;function l(t,e){var r,n,a=[],o=u(e,0),s=u(e,1),l=f(t,e),h=l.min,p=l.max;if(0===h.length||0===p.length)return i.simpleMap(e.range,e.r2l);var d=h[0].val,g=p[0].val;for(r=1;r0&&((w=S-o(y)-s(x))>E?T/w>C&&(b=y,_=x,C=T/w):T/S>C&&(b={val:y.val,pad:0},_={val:x.val,pad:0},C=T/S));if(d===g){var L=d-1,I=d+1;if(M)if(0===d)a=[0,1];else{var P=(d>0?p:h).reduce((function(t,e){return Math.max(t,s(e))}),0),z=d/(1-Math.min(.5,P/S));a=d>0?[0,z]:[z,0]}else a=A?[Math.max(0,L),Math.max(1,I)]:[L,I]}else M?(b.val>=0&&(b={val:0,pad:0}),_.val<=0&&(_={val:0,pad:0})):A&&(b.val-C*o(b)<0&&(b={val:0,pad:0}),_.val<=0&&(_={val:1,pad:0})),C=(_.val-b.val-c(e,y.val,x.val))/(S-o(b)-s(_)),a=[b.val-C*o(b),_.val+C*s(_)];return m&&a.reverse(),i.simpleMap(a,e.l2r||Number)}function c(t,e,r){var n=0;if(t.rangebreaks)for(var i=t.locateBreaks(e,r),a=0;a0?r.ppadplus:r.ppadminus)||r.ppad||0),S=M((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),E=M(r.vpadplus||r.vpad),C=M(r.vpadminus||r.vpad);if(!T){if(d=1/0,m=-1/0,w)for(i=0;i0&&(d=o),o>m&&o-a&&(d=o),o>m&&o=P;i--)I(i);return{min:v,max:y,opts:r}},concatExtremes:f};function f(t,e,r){var n,i,a,o=e._id,l=t._fullData,c=t._fullLayout,u=[],d=[];function g(t,e){for(n=0;n=r&&(c.extrapad||!o)){s=!1;break}i(e,c.val)&&c.pad<=r&&(o||!c.extrapad)&&(t.splice(l,1),l--)}if(s){var u=a&&0===e;t.push({val:e,pad:u?0:r,extrapad:!u&&o})}}function g(t){return n(t)&&Math.abs(t)=e}},{"../../constants/numerical":753,"../../lib":778,"../../registry":910,"./axis_ids":830,"fast-isnumeric":241}],827:[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=s.strTranslate,c=t("../../lib/svg_text_utils"),u=t("../../components/titles"),f=t("../../components/color"),h=t("../../components/drawing"),p=t("./layout_attributes"),d=t("./clean_ticks"),g=t("../../constants/numerical"),m=g.ONEMAXYEAR,v=g.ONEAVGYEAR,y=g.ONEMINYEAR,x=g.ONEMAXQUARTER,b=g.ONEAVGQUARTER,_=g.ONEMINQUARTER,w=g.ONEMAXMONTH,T=g.ONEAVGMONTH,k=g.ONEMINMONTH,M=g.ONEWEEK,A=g.ONEDAY,S=A/2,E=g.ONEHOUR,C=g.ONEMIN,L=g.ONESEC,I=g.MINUS_SIGN,P=g.BADNUM,z=t("../../constants/alignment"),O=z.MID_SHIFT,D=z.CAP_SHIFT,R=z.LINE_SPACING,F=z.OPPOSITE_SIDE,B=e.exports={};B.setConvert=t("./set_convert");var N=t("./axis_autotype"),j=t("./axis_ids");B.id2name=j.id2name,B.name2id=j.name2id,B.cleanId=j.cleanId,B.list=j.list,B.listIds=j.listIds,B.getFromId=j.getFromId,B.getFromTrace=j.getFromTrace;var U=t("./autorange");B.getAutoRange=U.getAutoRange,B.findExtremes=U.findExtremes;function V(t){var e=1e-4*(t[1]-t[0]);return[t[0]-e,t[1]+e]}B.coerceRef=function(t,e,r,n,i,a){var o=n.charAt(n.length-1),l=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return i||(i=l[0]||("string"==typeof a?a:a[0])),a||(a=i),l=l.concat(l.map((function(t){return t+" domain"}))),u[c]={valType:"enumerated",values:l.concat(a?"string"==typeof a?[a]:a:[]),dflt:i},s.coerce(t,e,u,c)},B.getRefType=function(t){return void 0===t?t:"paper"===t?"paper":"pixel"===t?"pixel":/( domain)$/.test(t)?"domain":"range"},B.coercePosition=function(t,e,r,n,i,a){var o,l;if("range"!==B.getRefType(n))o=s.ensureNumber,l=r(i,a);else{var c=B.getFromId(e,n);l=r(i,a=c.fraction2r(a)),o=c.cleanPos}t[i]=o(l)},B.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:B.getFromId(e,r).cleanPos)(t)},B.redrawComponents=function(t,e){e=e||B.listIds(t);var r=t._fullLayout;function n(n,i,a,s){for(var l=o.getComponentMethod(n,i),c={},u=0;u2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},B.saveRangeInitial=function(t,e){for(var r=B.list(t,"",!0),n=!1,i=0;i.3*h||u(n)||u(a))){var p=r.dtick/2;t+=t+p.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=B.tickIncrement(t,"M6","reverse")+1.5*A:a.exactMonths>.8?t=B.tickIncrement(t,"M1","reverse")+15.5*A:t-=S;var l=B.tickIncrement(t,r);if(l<=n)return l}return t}(y,t,v,c,a)),m=y,0;m<=u;)m=B.tickIncrement(m,v,!1,a);return{start:e.c2r(y,0,a),end:e.c2r(m,0,a),size:v,_dataSpan:u-c}},B.prepTicks=function(t,e){var r=s.simpleMap(t.range,t.r2l,void 0,void 0,e);if(t._dtickInit=t.dtick,t._tick0Init=t.tick0,"auto"===t.tickmode||!t.dtick){var n,a=t.nticks;a||("category"===t.type||"multicategory"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,a=t._length/n):(n="y"===t._id.charAt(0)?40:80,a=s.constrain(t._length/n,4,9)+1),"radialaxis"===t._name&&(a*=2)),"array"===t.tickmode&&(a*=100),t._roughDTick=Math.abs(r[1]-r[0])/a,B.autoTicks(t,t._roughDTick),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}"period"===t.ticklabelmode&&function(t){var e;function r(){return!(i(t.dtick)||"M"!==t.dtick.charAt(0))}var n=r(),a=B.getTickFormat(t);if(a){var o=t._dtickInit!==t.dtick;/%[fLQsSMX]/.test(a)||(/%[HI]/.test(a)?(e=E,o&&!n&&t.dticka&&f=o:p<=o;p=B.tickIncrement(p,t.dtick,l,t.calendar)){if(t.rangebreaks&&!l){if(p=u)break}if(C.length>g||p===L)break;L=p;var I=!1;f&&p!==(0|p)&&(I=!0),C.push({minor:I,value:p})}if(h&&function(t,e,r){for(var n=0;n0?(a=n-1,o=n):(a=n,o=n);var s,l=t[a].value,c=t[o].value,u=Math.abs(c-l),f=r||u,h=0;f>=y?h=u>=y&&u<=m?u:v:r===b&&f>=_?h=u>=_&&u<=x?u:b:f>=k?h=u>=k&&u<=w?u:T:r===M&&f>=M?h=M:f>=A?h=A:r===S&&f>=S?h=S:r===E&&f>=E&&(h=E),h>=u&&(h=u,s=!0);var p=i+h;if(e.rangebreaks&&h>0){for(var d=0,g=0;g<84;g++){var C=(g+.5)/84;e.maskBreaks(i*(1-C)+C*p)!==P&&d++}(h*=d/84)||(t[n].drop=!0),s&&u>M&&(h=u)}(h>0||0===n)&&(t[n].periodX=i+h/2)}}(C,t,t._definedDelta),t.rangebreaks){var z="y"===t._id.charAt(0),O=1;"auto"===t.tickmode&&(O=t.tickfont?t.tickfont.size:12);var D=NaN;for(d=C.length-1;d>-1;d--)if(C[d].drop)C.splice(d,1);else{C[d].value=bt(C[d].value,t);var R=t.c2p(C[d].value);(z?D>R-O:Du||Nu&&(F.periodX=u),N10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=A&&a<=10||e>=15*A)t._tickround="d";else if(e>=C&&a<=16||e>=E)t._tickround="M";else if(e>=L&&a<=19||e>=C)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])),c=Math.floor(Math.log(l)/Math.LN10+.01),u=void 0===t.minexponent?3:t.minexponent;Math.abs(c)>u&&(it(t.exponentformat)&&!at(c)?t._tickexponent=3*Math.round((c-1)/3):t._tickexponent=c)}else t._tickround=null}function rt(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}}B.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,0);var a=2*e;if(a>v)e/=v,r=n(10),t.dtick="M"+12*tt(e,r,W);else if(a>T)e/=T,t.dtick="M"+tt(e,1,X);else if(a>A){t.dtick=tt(e,A,t._hasDayOfWeekBreaks?[1,2,7,14]:J);var o=B.getTickFormat(t),l="period"===t.ticklabelmode;l&&(t._rawTick0=t.tick0),/%[uVW]/.test(o)?t.tick0=s.dateTick0(t.calendar,2):t.tick0=s.dateTick0(t.calendar,1),l&&(t._dowTick0=t.tick0)}else a>E?t.dtick=tt(e,E,X):a>C?t.dtick=tt(e,C,Z):a>L?t.dtick=tt(e,L,Z):(r=n(10),t.dtick=tt(e,r,W))}else if("log"===t.type){t.tick0=0;var c=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(c[1]-c[0])<1){var u=1.5*Math.abs((c[1]-c[0])/e);e=Math.abs(Math.pow(10,c[1])-Math.pow(10,c[0]))/u,r=n(10),t.dtick="L"+tt(e,r,W)}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))):xt(t)?(t.tick0=0,r=1,t.dtick=tt(e,r,$)):(t.tick0=0,r=n(10),t.dtick=tt(e,r,W));if(0===t.dtick&&(t.dtick=1),!i(t.dtick)&&"string"!=typeof t.dtick){var f=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(f)}},B.tickIncrement=function(t,e,r,a){var o=r?-1:1;if(i(e))return s.increment(t,o*e);var l=e.charAt(0),c=o*Number(e.substr(1));if("M"===l)return s.incrementMonth(t,c,a);if("L"===l)return Math.log(Math.pow(10,t)+c)/Math.LN10;if("D"===l){var u="D2"===e?Q:K,f=t+.01*o,h=s.roundUp(s.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(e)},B.tickFirst=function(t,e){var r=t.r2l||Number,a=s.simpleMap(t.range,r,void 0,void 0,e),o=a[1]"+l,t._prevDateHead=l));e.text=c}(t,o,r,c):"log"===u?function(t,e,r,n,a){var o=t.dtick,l=e.x,c=t.tickformat,u="string"==typeof o&&o.charAt(0);"never"===a&&(a="");n&&"L"!==u&&(o="L3",u="L");if(c||"L"===u)e.text=ot(Math.pow(10,l),t,a,n);else if(i(o)||"D"===u&&s.mod(l+.01,1)<.1){var f=Math.round(l),h=Math.abs(f),p=t.exponentformat;"power"===p||it(p)&&at(f)?(e.text=0===f?1:1===f?"10":"10"+(f>1?"":I)+h+"",e.fontSize*=1.25):("e"===p||"E"===p)&&h>2?e.text="1"+p+(f>0?"+":I)+h:(e.text=ot(Math.pow(10,l),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==u)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 d=String(e.text).charAt(0);"0"!==d&&"1"!==d||("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,c,g):"category"===u?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"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,o,r):xt(t)?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=ot(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){for(var r=1;!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=ot(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=I+e.text)}}}}(t,o,r,c,g):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=ot(e.x,t,i,n)}(t,o,0,c,g),n||(t.tickprefix&&!d(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!d(t.showticksuffix)&&(o.text+=t.ticksuffix)),"boundaries"===t.tickson||t.showdividers){var m=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[m(o.x-.5),m(o.x+t.dtick-.5)]}return o},B.hoverLabelText=function(t,e,r){if(r!==P&&r!==e)return B.hoverLabelText(t,e)+" - "+B.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=B.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":I+i:i};var nt=["f","p","n","\u03bc","m","","k","M","G","T"];function it(t){return"SI"===t||"B"===t}function at(t){return t>14||t<-15}function ot(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",c=e._tickexponent,u=B.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,minexponent:e.minexponent,dtick:"none"===e.showexponent?e.dtick:i(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};et(h),o=(Number(h._tickround)||0)+4,c=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return e._numFormat(u)(t).replace(/-/g,I);var p,d=Math.pow(10,-o)/2;if("none"===l&&(c=0),(t=Math.abs(t))"+p+"":"B"===l&&9===c?t+="B":it(l)&&(t+=nt[c/3+5]));return a?I+t:t}function st(t,e){for(var r=[],n={},i=0;i1&&r=i.min&&t=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=o(i)))){r=n;break}break;case"log":for(e=0;e0?r.bottom-f:0,h)))),e.automargin){n={x:0,y:0,r:0,l:0,t:0,b:0};var p=[0,1];if("x"===d){if("b"===l?n[l]=e._depth:(n[l]=e._depth=Math.max(r.width>0?f-r.top:0,h),p.reverse()),r.width>0){var m=r.right-(e._offset+e._length);m>0&&(n.xr=1,n.r=m);var v=e._offset-r.left;v>0&&(n.xl=0,n.l=v)}}else if("l"===l?n[l]=e._depth=Math.max(r.height>0?f-r.left:0,h):(n[l]=e._depth=Math.max(r.height>0?r.right-f:0,h),p.reverse()),r.height>0){var y=r.bottom-(e._offset+e._length);y>0&&(n.yb=0,n.b=y);var x=e._offset-r.top;x>0&&(n.yt=1,n.t=x)}n[g]="free"===e.anchor?e.position:e._anchorAxis.domain[p[0]],e.title.text!==c._dfltTitle[d]&&(n[l]+=ut(e)+(e.title.standoff||0)),e.mirror&&"free"!==e.anchor&&((i={x:0,y:0,r:0,l:0,t:0,b:0})[u]=e.linewidth,e.mirror&&!0!==e.mirror&&(i[u]+=h),!0===e.mirror||"ticks"===e.mirror?i[g]=e._anchorAxis.domain[p[1]]:"all"!==e.mirror&&"allticks"!==e.mirror||(i[g]=[e._counterDomainMin,e._counterDomainMax][p[1]]))}K&&(s=o.getComponentMethod("rangeslider","autoMarginOpts")(t,e)),a.autoMargin(t,pt(e),n),a.autoMargin(t,dt(e),i),a.autoMargin(t,gt(e),s)})),r.skipTitle||K&&"bottom"===e.side||Z.push((function(){return function(t,e){var r,n=t._fullLayout,i=e._id,a=i.charAt(0),o=e.title.font.size;if(e.title.hasOwnProperty("standoff"))r=e._depth+e.title.standoff+ut(e);else{if("multicategory"===e.type)r=e._depth;else{r=10+1.5*o+(e.linewidth?e.linewidth-1:0)}r+="x"===a?"top"===e.side?o*(e.showticklabels?1:0):o*(e.showticklabels?1.5:.5):"right"===e.side?o*(e.showticklabels?1:.5):o*(e.showticklabels?.5:0)}var s,l,c,f,p=B.getPxPosition(t,e);"x"===a?(l=e._offset+e._length/2,c="top"===e.side?p-r:p+r):(c=e._offset+e._length/2,l="right"===e.side?p+r:p-r,s={rotate:"-90",offset:0});if("multicategory"!==e.type){var d=e._selections[e._id+"tick"];if(f={selection:d,side:e.side},d&&d.node()&&d.node().parentNode){var g=h.getTranslate(d.node().parentNode);f.offsetLeft=g.x,f.offsetTop=g.y}e.title.hasOwnProperty("standoff")&&(f.pad=0)}return u.draw(t,i+"title",{propContainer:e,propName:e._name+".title.text",placeholder:n._dfltTitle[a],avoid:f,transform:s,attributes:{x:l,y:c,"text-anchor":"middle"}})}(t,e)})),s.syncOrAsync(Z)}}function Q(t){var r=p+(t||"tick");return w[r]||(w[r]=function(t,e){var r,n,i,a;t._selections[e].size()?(r=1/0,n=-1/0,i=1/0,a=-1/0,t._selections[e].each((function(){var t=ht(this),e=h.bBox(t.node().parentNode);r=Math.min(r,e.top),n=Math.max(n,e.bottom),i=Math.min(i,e.left),a=Math.max(a,e.right)}))):(r=0,n=0,i=0,a=0);return{top:r,bottom:n,left:i,right:a,height:n-r,width:a-i}}(e,r)),w[r]}},B.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}))),t.side&&i.push({l:-1,t:-1,r:1,b:1}[t.side.charAt(0)]),i},B.makeTransTickFn=function(t){return"x"===t._id.charAt(0)?function(e){return l(t._offset+t.l2p(e.x),0)}:function(e){return l(0,t._offset+t.l2p(e.x))}},B.makeTransTickLabelFn=function(t){var e=function(t){var e=t.ticklabelposition||"",r=function(t){return-1!==e.indexOf(t)},n=r("top"),i=r("left"),a=r("right"),o=r("bottom"),s=r("inside"),l=o||i||n||a;if(!l&&!s)return[0,0];var c=t.side,u=l?(t.tickwidth||0)/2:0,f=3,h=t.tickfont?t.tickfont.size:12;(o||n)&&(u+=h*D,f+=(t.linewidth||0)/2);(i||a)&&(u+=(t.linewidth||0)/2,f+=3);s&&"top"===c&&(f-=h*(1-D));(i||n)&&(u=-u);"bottom"!==c&&"right"!==c||(f=-f);return[l?u:0,s?f:0]}(t),r=e[0],n=e[1];return"x"===t._id.charAt(0)?function(e){return l(r+t._offset+t.l2p(lt(e)),n)}:function(e){return l(n,r+t._offset+t.l2p(lt(e)))}},B.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},B.makeLabelFns=function(t,e,r){var n=t.ticklabelposition||"",a=function(t){return-1!==n.indexOf(t)},o=a("top"),l=a("left"),c=a("right"),u=a("bottom")||l||o||c,f=a("inside"),h="inside"===n&&"inside"===t.ticks||!f&&"outside"===t.ticks&&"boundaries"!==t.tickson,p=0,d=0,g=h?t.ticklen:0;if(f?g*=-1:u&&(g=0),h&&(p+=g,r)){var m=s.deg2rad(r);p=g*Math.cos(m)+1,d=g*Math.sin(m)}t.showticklabels&&(h||t.showline)&&(p+=.2*t.tickfont.size);var v,y,x,b,_,w={labelStandoff:p+=(t.linewidth||1)/2*(f?-1:1),labelShift:d},T=0,k=t.side,M=t._id.charAt(0),A=t.tickangle;if("x"===M)b=(_=!f&&"bottom"===k||f&&"top"===k)?1:-1,f&&(b*=-1),v=d*b,y=e+p*b,x=_?1:-.2,90===Math.abs(A)&&(f?x+=O:x=-90===A&&"bottom"===k?D:90===A&&"top"===k?O:.5,T=O/2*(A/90)),w.xFn=function(t){return t.dx+v+T*t.fontSize},w.yFn=function(t){return t.dy+y+t.fontSize*x},w.anchorFn=function(t,e){if(u){if(l)return"end";if(c)return"start"}return i(e)&&0!==e&&180!==e?e*b<0!==f?"end":"start":"middle"},w.heightFn=function(e,r,n){return r<-60||r>60?-.5*n:"top"===t.side!==f?-n:0};else if("y"===M){if(b=(_=!f&&"left"===k||f&&"right"===k)?1:-1,f&&(b*=-1),v=p,y=d*b,x=0,f||90!==Math.abs(A)||(x=-90===A&&"left"===k||90===A&&"right"===k?D:.5),f){var S=i(A)?+A:0;if(0!==S){var E=s.deg2rad(S);T=Math.abs(Math.sin(E))*D*b,x=0}}w.xFn=function(t){return t.dx+e-(v+t.fontSize*x)*b+T*t.fontSize},w.yFn=function(t){return t.dy+y+t.fontSize*O},w.anchorFn=function(t,e){return i(e)&&90===Math.abs(e)?"middle":_?"end":"start"},w.heightFn=function(e,r,n){return"right"===t.side&&(r*=-1),r<-30?-n:r<30?-.5*n:0}}return w},B.drawTicks=function(t,e,r){r=r||{};var n=e._id+"tick",i=r.vals;"period"===e.ticklabelmode&&(i=i.slice()).shift();var a=r.layer.selectAll("path."+n).data(e.ticks?i:[],ct);a.exit().remove(),a.enter().append("path").classed(n,1).classed("ticks",1).classed("crisp",!1!==r.crisp).call(f.stroke,e.tickcolor).style("stroke-width",h.crispRound(t,e.tickwidth,1)+"px").attr("d",r.path),a.attr("transform",r.transFn)},B.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&&B.shouldShowZeroLine(t,e,a))for(var o="array"===e.tickmode,s=0;so||i.lefto||i.top+(e.tickangle?0:t.fontSize/4)1)for(n=1;n2*o}(i,e))return"date";var m="strict"!==r.autotypenumbers;return function(t,e){for(var r=t.length,n=f(r),i=0,o=0,s={},u=0;u2*i}(i,m)?"category":function(t,e){for(var r=t.length,n=0;n=2){var l,c,u="";if(2===o.length)for(l=0;l<2;l++)if(c=y(o[l])){u=d;break}var f=i("pattern",u);if(f===d)for(l=0;l<2;l++)(c=y(o[l]))&&(e.bounds[l]=o[l]=c-1);if(f)for(l=0;l<2;l++)switch(c=o[l],f){case d:if(!n(c))return void(e.enabled=!1);if((c=+c)!==Math.floor(c)||c<0||c>=7)return void(e.enabled=!1);e.bounds[l]=o[l]=c;break;case g:if(!n(c))return void(e.enabled=!1);if((c=+c)<0||c>24)return void(e.enabled=!1);e.bounds[l]=o[l]=c}if(!1===r.autorange){var h=r.range;if(h[0]h[1])return void(e.enabled=!1)}else if(o[0]>h[0]&&o[1]n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)},r.ref2id=function(t){return!!/^[xyz]/.test(t)&&t.split(" ")[0]}},{"../../registry":910,"./constants":833}],831:[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;nn?i.substr(n):a.substr(r))+o:i+a+t*e:o}function m(t,e){for(var r=e._size,n=r.h/r.w,i={},a=Object.keys(t),o=0;oc*x)||T)for(r=0;rz&&FI&&(I=F);h/=(I-L)/(2*P),L=l.l2r(L),I=l.l2r(I),l.range=l._input.range=S=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function B(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",l(r,n)).attr("d",i+"Z")}function N(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",l(e,r)).attr("d","M0,0Z")}function j(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"),U(t,e,i,a)}function U(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 V(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function q(t){I&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),I=!1)}function H(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,L)/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 G(t,e,r,n,i){for(var a,o,l,c,u=!1,f={},h={},p=(i||{}).xaHash,d=(i||{}).yaHash,g=0;g=0)i._fullLayout._deactivateShape(i);else{var a=i._fullLayout.clickmode;if(V(i),2!==t||mt||qt(),gt)a.indexOf("select")>-1&&A(r,i,Z,J,e.id,Lt),a.indexOf("event")>-1&&h.click(i,r,e.id);else if(1===t&&mt){var s=d?P:I,l="s"===d||"w"===m?0:1,u=s._name+".range["+l+"]",f=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,l),p="left",g="middle";if(s.fixedrange)return;d?(g="n"===d?"top":"bottom","right"===s.side&&(p="right")):"e"===m&&(p="right"),i._context.showAxisRangeEntryBoxes&&n.select(xt).call(c.makeEditable,{gd:i,immediate:!0,background:i._fullLayout.paper_bgcolor,text:String(f),fill:s.tickfont?s.tickfont.color:"#444",horizontalAlign:p,verticalAlign:g}).on("edit",(function(t){var e=s.d2r(t);void 0!==e&&o.call("_guiRelayout",i,u,e)}))}}}function zt(e,r){if(t._transitioningWithDuration)return!1;var n=Math.max(0,Math.min($,ht*e+bt)),i=Math.max(0,Math.min(tt,pt*r+_t)),a=Math.abs(n-bt),o=Math.abs(i-_t);function s(){At="",wt.r=wt.l,wt.t=wt.b,Et.attr("d","M0,0Z")}if(wt.l=Math.min(bt,n),wt.r=Math.max(bt,n),wt.t=Math.min(_t,i),wt.b=Math.max(_t,i),et.isSubplotConstrained)a>L||o>L?(At="xy",a/$>o/tt?(o=a*tt/$,_t>i?wt.t=_t-o:wt.b=_t+o):(a=o*$/tt,bt>n?wt.l=bt-a:wt.r=bt+a),Et.attr("d",H(wt))):s();else if(rt.isSubplotConstrained)if(a>L||o>L){At="xy";var l=Math.min(wt.l/$,(tt-wt.b)/tt),c=Math.max(wt.r/$,(tt-wt.t)/tt);wt.l=l*$,wt.r=c*$,wt.b=(1-l)*tt,wt.t=(1-c)*tt,Et.attr("d",H(wt))}else s();else!it||o0){var u;if(rt.isSubplotConstrained||!nt&&1===it.length){for(u=0;ug[1]-1/4096&&(e.domain=s),i.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":778,"fast-isnumeric":241}],845:[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)],t.setScale()}},{"../../constants/alignment":745}],846:[function(t,e,r){"use strict";var n=t("polybooljs"),i=t("../../registry"),a=t("../../components/drawing").dashStyle,o=t("../../components/color"),s=t("../../components/fx"),l=t("../../components/fx/helpers").makeEventData,c=t("../../components/dragelement/helpers"),u=c.freeMode,f=c.rectMode,h=c.drawMode,p=c.openMode,d=c.selectMode,g=t("../../components/shapes/draw_newshape/display_outlines"),m=t("../../components/shapes/draw_newshape/helpers").handleEllipse,v=t("../../components/shapes/draw_newshape/newshapes"),y=t("../../lib"),x=t("../../lib/polygon"),b=t("../../lib/throttle"),_=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),T=t("../../plot_api/subroutines").redrawReglTraces,k=t("./constants"),M=k.MINSELECT,A=x.filter,S=x.tester,E=t("./handle_outline").clearSelect,C=t("./helpers"),L=C.p2r,I=C.axValue,P=C.getTransform;function z(t,e,r,n,i,a,o){var s,l,c,u,f,h,d,m,v,y=e._hoverdata,x=e._fullLayout.clickmode.indexOf("event")>-1,b=[];if(function(t){return t&&Array.isArray(t)&&!0!==t[0].hoverOnBox}(y)){F(t,e,a);var _=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=j(_))){for(o&&o.remove(),v=0;v=0&&n._fullLayout._deactivateShape(n),h(e)){var a=n._fullLayout._zoomlayer.selectAll(".select-outline-"+r.id);if(a&&n._fullLayout._drawing){var o=v(a,t);o&&i.call("_guiRelayout",n,{shapes:o}),n._fullLayout._drawing=!1}}r.selection={},r.selection.selectionDefs=t.selectionDefs=[],r.selection.mergedPolygons=t.mergedPolygons=[]}function N(t,e,r,n){var i,a,o,s=[],l=e.map((function(t){return t._id})),c=r.map((function(t){return t._id}));for(o=0;o0?n[0]:r;return!!e.selectedpoints&&e.selectedpoints.indexOf(i)>-1}function U(t,e,r){var n,a,o,s;for(n=0;n=0)C._fullLayout._deactivateShape(C);else if(!_){var r=O.clickmode;b.done(gt).then((function(){if(b.clear(gt),2===t){for(ft.remove(),$=0;$-1&&z(e,C,i.xaxes,i.yaxes,i.subplot,i,ft),"event"===r&&C.emit("plotly_selected",void 0);s.click(C,e)})).catch(y.error)}},i.doneFn=function(){dt.remove(),b.done(gt).then((function(){b.clear(gt),i.gd.emit("plotly_selected",et),Q&&i.selectionDefs&&(Q.subtract=ut,i.selectionDefs.push(Q),i.mergedPolygons.length=0,[].push.apply(i.mergedPolygons,K)),i.doneFnCompleted&&i.doneFnCompleted(mt)})).catch(y.error),_&&B(i)}},clearSelect:E,clearSelectionsCache:B,selectOnClick:z}},{"../../components/color":643,"../../components/dragelement/helpers":661,"../../components/drawing":665,"../../components/fx":683,"../../components/fx/helpers":679,"../../components/shapes/draw_newshape/display_outlines":728,"../../components/shapes/draw_newshape/helpers":729,"../../components/shapes/draw_newshape/newshapes":730,"../../lib":778,"../../lib/clear_gl_canvases":762,"../../lib/polygon":790,"../../lib/throttle":803,"../../plot_api/subroutines":817,"../../registry":910,"./axis_ids":830,"./constants":833,"./handle_outline":837,"./helpers":838,polybooljs:517}],847:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-time-format").utcFormat,a=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,f=o.isArrayOrTypedArray,h=t("../../constants/numerical"),p=h.FP_SAFE,d=h.BADNUM,g=h.LOG_CLIP,m=h.ONEWEEK,v=h.ONEDAY,y=h.ONEHOUR,x=h.ONEMIN,b=h.ONESEC,_=t("./axis_ids"),w=t("./constants"),T=w.HOUR_PATTERN,k=w.WEEKDAY_PATTERN;function M(t){return Math.pow(10,t)}function A(t){return null!=t}e.exports=function(t,e){e=e||{};var r=t._id||"x",h=r.charAt(0);function S(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*g*Math.abs(n-i))}return d}function E(e,r,n,i){if((i||{}).msUTC&&a(e))return+e;var s=c(e,n||t.calendar);if(s===d){if(!a(e))return d;e=+e;var l=Math.floor(10*o.mod(e+.05,1)),u=Math.round(e-l/10);s=c(new Date(u))+l/10}return s}function C(e,r,n){return l(e,r,n||t.calendar)}function L(e){return t._categories[Math.round(e)]}function I(e){if(A(e)){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push("number"==typeof e?String(e):e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function P(e){if(t._categoriesMap)return t._categoriesMap[e]}function z(t){var e=P(t);return void 0!==e?e:a(t)?+t:void 0}function O(t){return a(t)?+t:P(t)}function D(t,e,r){return n.round(r+e*t,2)}function R(t,e,r){return(t-r)/e}var F=function(e){return a(e)?D(e,t._m,t._b):d},B=function(e){return R(e,t._m,t._b)};if(t.rangebreaks){var N="y"===h;F=function(e){if(!a(e))return d;var r=t._rangebreaks.length;if(!r)return D(e,t._m,t._b);var n=N;t.range[0]>t.range[1]&&(n=!n);for(var i=n?-1:1,o=i*e,s=0,l=0;lu)){s=o<(c+u)/2?l:l+1;break}s=l+1}var f=t._B[s]||0;return isFinite(f)?D(e,t._m2,f):0},B=function(e){var r=t._rangebreaks.length;if(!r)return R(e,t._m,t._b);for(var n=0,i=0;it._rangebreaks[i].pmax&&(n=i+1);return R(e,t._m2,t._B[n])}}t.c2l="log"===t.type?S:u,t.l2c="log"===t.type?M:u,t.l2p=F,t.p2l=B,t.c2p="log"===t.type?function(t,e){return F(S(t,e))}:F,t.p2c="log"===t.type?function(t){return M(B(t))}:B,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=B,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return S(s(t),e)},t.r2d=t.r2c=function(t){return M(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=u,t.c2r=S,t.l2d=M,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return M(B(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=B,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=E,t.c2d=t.c2r=t.l2d=t.l2r=C,t.d2p=t.r2p=function(e,r,n){return t.l2p(E(e,0,n))},t.p2d=t.p2r=function(t,e,r){return C(B(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type?(t.d2c=t.d2l=I,t.r2d=t.c2d=t.l2d=L,t.d2r=t.d2l_noadd=z,t.r2c=function(e){var r=O(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=O,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return L(B(t))},t.r2p=t.d2p,t.p2r=B,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}):"multicategory"===t.type&&(t.r2d=t.c2d=t.l2d=L,t.d2r=t.d2l_noadd=z,t.r2c=function(e){var r=z(e);return void 0!==r?r:t.fraction2r(.5)},t.r2c_just_indices=P,t.l2r=t.c2r=u,t.r2l=z,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return L(B(t))},t.r2p=t.d2p,t.p2r=B,t.cleanPos=function(t){return Array.isArray(t)||"string"==typeof t&&""!==t?t:u(t)},t.setupMultiCategory=function(n){var i,a,s=t._traceIndices,l=t._matchGroup;if(l&&0===t._categories.length)for(var c in l)if(c!==r){var u=e[_.id2name(c)];s=s.concat(u._traceIndices)}var p=[[0,{}],[0,{}]],d=[];for(i=0;ip&&(s[n]=p),s[0]===s[1]){var c=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=c,s[1]+=c}}else o.nestedProperty(t,e).set(i)},t.setScale=function(r){var n=e._size;if(t.overlaying){var i=_.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var a=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(a);var s,l,c=t.r2l(t[a][0],o),u=t.r2l(t[a][1],o),f="y"===h;if((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/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),t._rangebreaks=[],t._lBreaks=0,t._m2=0,t._B=[],t.rangebreaks)&&(t._rangebreaks=t.locateBreaks(Math.min(c,u),Math.max(c,u)),t._rangebreaks.length)){for(s=0;su&&(p=!p),p&&t._rangebreaks.reverse();var d=p?-1:1;for(t._m2=d*t._length/(Math.abs(u-c)-t._lBreaks),t._B.push(-t._m2*(f?u:c)),s=0;si&&(i+=7,ai&&(i+=24,a=n&&a=n&&e=s.min&&(ts.max&&(s.max=n),i=!1)}i&&c.push({min:t,max:n})}};for(n=0;nr.duration?(!function(){for(var r={},n=0;n rect").call(o.setTranslate,0,0).call(o.setScale,1,1),t.plot.call(o.setTranslate,e._offset,r._offset).call(o.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(o.setPointGroupScale,1,1),n.selectAll(".textpoint").call(o.setTextPointsScale,1,1),n.call(o.hideOutsideRangePoints,t)}function m(e,r){var n=e.plotinfo,i=n.xaxis,l=n.yaxis,c=i._length,u=l._length,f=!!e.xr1,h=!!e.yr1,p=[];if(f){var d=a.simpleMap(e.xr0,i.r2l),g=a.simpleMap(e.xr1,i.r2l),m=d[1]-d[0],v=g[1]-g[0];p[0]=(d[0]*(1-r)+r*g[0]-d[0])/(d[1]-d[0])*c,p[2]=c*(1-r+r*v/m),i.range[0]=i.l2r(d[0]*(1-r)+r*g[0]),i.range[1]=i.l2r(d[1]*(1-r)+r*g[1])}else p[0]=0,p[2]=c;if(h){var y=a.simpleMap(e.yr0,l.r2l),x=a.simpleMap(e.yr1,l.r2l),b=y[1]-y[0],_=x[1]-x[0];p[1]=(y[1]*(1-r)+r*x[1]-y[1])/(y[0]-y[1])*u,p[3]=u*(1-r+r*_/b),l.range[0]=i.l2r(y[0]*(1-r)+r*x[0]),l.range[1]=l.l2r(y[1]*(1-r)+r*x[1])}else p[1]=0,p[3]=u;s.drawOne(t,i,{skipTitle:!0}),s.drawOne(t,l,{skipTitle:!0}),s.redrawComponents(t,[i._id,l._id]);var w=f?c/p[2]:1,T=h?u/p[3]:1,k=f?p[0]:0,M=h?p[1]:0,A=f?p[0]/p[2]*c:0,S=h?p[1]/p[3]*u:0,E=i._offset-A,C=l._offset-S;n.clipRect.call(o.setTranslate,k,M).call(o.setScale,1/w,1/T),n.plot.call(o.setTranslate,E,C).call(o.setScale,w,T),o.setPointGroupScale(n.zoomScalePts,1/w,1/T),o.setTextPointsScale(n.zoomScaleTxt,1/w,1/T)}s.redrawComponents(t)}},{"../../components/drawing":665,"../../lib":778,"../../registry":910,"./axes":827,d3:169}],852:[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("autotypenumbers",s.autotypenumbersDflt),"-"===r("type",(s.splomStash||{}).type)&&(!function(t,e){if("-"!==t.type)return;var r,s=t._id,l=s.charAt(0);-1!==s.indexOf("scene")&&(s=l);var c=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,s,l);if(!c)return;if("histogram"===c.type&&l==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=l+"calendar",f=c[u],h={noMultiCategory:!n(c,"cartesian")||n(c,"noMultiCategory")};"box"===c.type&&c._hasPreCompStats&&l==={h:"x",v:"y"}[c.orientation||"v"]&&(h.noMultiCategory=!0);if(h.autotypenumbers=t.autotypenumbers,o(c,l)){var p=a(c),d=[];for(r=0;r0?".":"")+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 c=r.hasSimpleAPICommandBindings(t,n,s.lookupTable);if(e&&e._commandObserver){if(c)return s;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,s}if(c){a(t,c,s.cache),s.check=function(){if(l){var e=a(t,c,s.cache);return e.changed&&o&&void 0!==s.lookupTable[e.value]&&(s.disable(),Promise.resolve(o({value:e.value,type:c.type,prop:c.prop,traces:c.traces,index:s.lookupTable[e.value]})).then(s.enable,s.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;f0&&i<0&&(i+=360);var s=(i-n)/4;return{type:"Polygon",coordinates:[[[n,a],[n,o],[n+s,o],[n+2*s,o],[n+3*s,o],[i,o],[i,a],[i-s,a],[i-2*s,a],[i-3*s,a],[n,a]]]}}e.exports=function(t){return new w(t)},T.plot=function(t,e,r){var n=this,i=e[this.id],a=[],o=!1;for(var s in y.layerNameToAdjective)if("frame"!==s&&i["show"+s]){o=!0;break}for(var l=0;l0&&a._module.calcGeoJSON(i,e)}if(!this.updateProjection(t,e)){this.viewInitial&&this.scope===r.scope||this.saveViewInitial(r),this.scope=r.scope,this.updateBaseLayers(e,r),this.updateDims(e,r),this.updateFx(e,r),u.generalUpdatePerTraceModule(this.graphDiv,this,t,r);var o=this.layers.frontplot.select(".scatterlayer");this.dataPoints.point=o.selectAll(".point"),this.dataPoints.text=o.selectAll("text"),this.dataPaths.line=o.selectAll(".js-line");var s=this.layers.backplot.select(".choroplethlayer");this.dataPaths.choropleth=s.selectAll("path"),this.render()}},T.updateProjection=function(t,e){var r=this.graphDiv,o=e[this.id],s=e._size,l=o.domain,c=o.projection,u=o.lonaxis,f=o.lataxis,p=u._ax,d=f._ax,g=this.projection=function(t){for(var e=t.projection.type,r=n.geo[y.projNames[e]](),i=t._isClipped?y.lonaxisSpan[e]/2:null,a=["center","rotate","parallels","clipExtent"],o=function(t){return t?r:[]},s=0;si*Math.PI/180}return!1},r.getPath=function(){return n.geo.path().projection(r)},r.getBounds=function(t){return r.getPath().bounds(t)},r.fitExtent=function(t,e){var n=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=r.clipExtent&&r.clipExtent();r.scale(150).translate([0,0]),a&&r.clipExtent(null);var o=r.getBounds(e),s=Math.min(n/(o[1][0]-o[0][0]),i/(o[1][1]-o[0][1])),l=+t[0][0]+(n-s*(o[1][0]+o[0][0]))/2,c=+t[0][1]+(i-s*(o[1][1]+o[0][1]))/2;return a&&r.clipExtent(a),r.scale(150*s).translate([l,c])},r.precision(y.precision),i&&r.clipAngle(i-y.clipPad);return r}(o),m=[[s.l+s.w*l.x[0],s.t+s.h*(1-l.y[1])],[s.l+s.w*l.x[1],s.t+s.h*(1-l.y[0])]],v=o.center||{},x=c.rotation||{},b=u.range||[],_=f.range||[];if(o.fitbounds){p._length=m[1][0]-m[0][0],d._length=m[1][1]-m[0][1],p.range=h(r,p),d.range=h(r,d);var w=(p.range[0]+p.range[1])/2,T=(d.range[0]+d.range[1])/2;if(o._isScoped)v={lon:w,lat:T};else if(o._isClipped){v={lon:w,lat:T},x={lon:w,lat:T,roll:x.roll};var M=c.type,A=y.lonaxisSpan[M]/2||180,S=y.lataxisSpan[M]/2||90;b=[w-A,w+A],_=[T-S,T+S]}else v={lon:w,lat:T},x={lon:w,lat:x.lat,roll:x.roll}}g.center([v.lon-x.lon,v.lat-x.lat]).rotate([-x.lon,-x.lat,x.roll]).parallels(c.parallels);var E=k(b,_);g.fitExtent(m,E);var C=this.bounds=g.getBounds(E),L=this.fitScale=g.scale(),I=g.translate();if(!isFinite(C[0][0])||!isFinite(C[0][1])||!isFinite(C[1][0])||!isFinite(C[1][1])||isNaN(I[0])||isNaN(I[0])){for(var P=["fitbounds","projection.rotation","center","lonaxis.range","lataxis.range"],z="Invalid geo settings, relayout'ing to default view.",O={},D=0;D-1&&m(n.event,a,[r.xaxis],[r.yaxis],r.id,f),l.indexOf("event")>-1&&c.click(a,n.event))}))}function h(t){return r.projection.invert([t[0]+r.xaxis._offset,t[1]+r.yaxis._offset])}},T.makeFramework=function(){var t=this,e=t.graphDiv,r=e._fullLayout,i="clip"+r._uid+t.id;t.clipDef=r._clips.append("clipPath").attr("id",i),t.clipRect=t.clipDef.append("rect"),t.framework=n.select(t.container).append("g").attr("class","geo "+t.id).call(l.setClipUrl,i,e),t.project=function(e){var r=t.projection(e);return r?[r[0]-t.xaxis._offset,r[1]-t.yaxis._offset]:[null,null]},t.xaxis={_id:"x",c2p:function(e){return t.project(e)[0]}},t.yaxis={_id:"y",c2p:function(e){return t.project(e)[1]}},t.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},f.setConvert(t.mockAxis,r)},T.saveViewInitial=function(t){var e,r=t.center||{},n=t.projection,i=n.rotation||{};this.viewInitial={fitbounds:t.fitbounds,"projection.scale":n.scale},e=t._isScoped?{"center.lon":r.lon,"center.lat":r.lat}:t._isClipped?{"projection.rotation.lon":i.lon,"projection.rotation.lat":i.lat}:{"center.lon":r.lon,"center.lat":r.lat,"projection.rotation.lon":i.lon},a.extendFlat(this.viewInitial,e)},T.render=function(){var t,e=this.projection,r=e.getPath();function n(t){var r=e(t.lonlat);return r?o(r[0],r[1]):null}function i(t){return e.isLonLatOverEdges(t.lonlat)?"none":null}for(t in this.basePaths)this.basePaths[t].attr("d",r);for(t in this.dataPaths)this.dataPaths[t].attr("d",(function(t){return r(t.geojson)}));for(t in this.dataPoints)this.dataPoints[t].attr("display",i).attr("transform",n)}},{"../../components/color":643,"../../components/dragelement":662,"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/geo_location_utils":771,"../../lib/topojson_utils":805,"../../registry":910,"../cartesian/autorange":826,"../cartesian/axes":827,"../cartesian/select":846,"../plots":890,"./constants":857,"./projections":862,"./zoom":863,d3:169,"topojson-client":579}],859:[function(t,e,r){"use strict";var n=t("../../plots/get_data").getSubplotCalcData,i=t("../../lib").counterRegex,a=t("./geo"),o="geo",s=i(o),l={};l.geo={valType:"subplotid",dflt:o,editType:"calc"},e.exports={attr:o,name:o,idRoot:o,idRegex:s,attrRegex:s,attributes:l,layoutAttributes:t("./layout_attributes"),supplyLayoutDefaults:t("./layout_defaults"),plot:function(t){for(var e=t._fullLayout,r=t.calcdata,i=e._subplots.geo,s=0;s0&&L<0&&(L+=360);var I,P,z,O=(C+L)/2;if(!p){var D=d?f.projRotate:[O,0,0];I=r("projection.rotation.lon",D[0]),r("projection.rotation.lat",D[1]),r("projection.rotation.roll",D[2]),r("showcoastlines",!d&&y)&&(r("coastlinecolor"),r("coastlinewidth")),r("showocean",!!y&&void 0)&&r("oceancolor")}(p?(P=-96.6,z=38.7):(P=d?O:I,z=(E[0]+E[1])/2),r("center.lon",P),r("center.lat",z),g)&&r("projection.parallels",f.projParallels||[0,60]);r("projection.scale"),r("showland",!!y&&void 0)&&r("landcolor"),r("showlakes",!!y&&void 0)&&r("lakecolor"),r("showrivers",!!y&&void 0)&&(r("rivercolor"),r("riverwidth")),r("showcountries",d&&"usa"!==u&&y)&&(r("countrycolor"),r("countrywidth")),("usa"===u||"north america"===u&&50===c)&&(r("showsubunits",y),r("subunitcolor"),r("subunitwidth")),d||r("showframe",y)&&(r("framecolor"),r("framewidth")),r("bgcolor"),r("fitbounds")&&(delete e.projection.scale,d?(delete e.center.lon,delete e.center.lat):m?(delete e.center.lon,delete e.center.lat,delete e.projection.rotation.lon,delete e.projection.rotation.lat,delete e.lonaxis.range,delete e.lataxis.range):(delete e.center.lon,delete e.center.lat,delete e.projection.rotation.lon))}e.exports=function(t,e,r){i(t,e,r,{type:"geo",attributes:s,handleDefaults:c,fullData:r,partition:"y"})}},{"../../lib":778,"../get_data":864,"../subplot_defaults":904,"./constants":857,"./layout_attributes":860}],862:[function(t,e,r){"use strict";e.exports=function(t){function e(t,e){return{type:"Feature",id:t.id,properties:t.properties,geometry:r(t.geometry,e)}}function r(e,n){if(!e)return null;if("GeometryCollection"===e.type)return{type:"GeometryCollection",geometries:object.geometries.map((function(t){return r(t,n)}))};if(!c.hasOwnProperty(e.type))return null;var i=c[e.type];return t.geo.stream(e,n(i)),i.result()}t.geo.project=function(t,e){var i=e.stream;if(!i)throw new Error("not yet supported");return(t&&n.hasOwnProperty(t.type)?n[t.type]:r)(t,i)};var n={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map((function(t){return e(t,r)}))}}},i=[],a=[],o={point:function(t,e){i.push([t,e])},result:function(){var t=i.length?i.length<2?{type:"Point",coordinates:i[0]}:{type:"MultiPoint",coordinates:i}:null;return i=[],t}},s={lineStart:u,point:function(t,e){i.push([t,e])},lineEnd:function(){i.length&&(a.push(i),i=[])},result:function(){var t=a.length?a.length<2?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a}:null;return a=[],t}},l={polygonStart:u,lineStart:u,point:function(t,e){i.push([t,e])},lineEnd:function(){var t=i.length;if(t){do{i.push(i[0].slice())}while(++t<4);a.push(i),i=[]}},polygonEnd:u,result:function(){if(!a.length)return null;var t=[],e=[];return a.forEach((function(r){!function(t){if((e=t.length)<4)return!1;var e,r=0,n=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];for(;++rn^p>n&&r<(h-c)*(n-u)/(p-u)+c&&(i=!i)}return i}(t[0],r))return t.push(e),!0}))||t.push([e])})),a=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},c={Point:o,MultiPoint:o,LineString:s,MultiLineString:s,Polygon:l,MultiPolygon:l,Sphere:l};function u(){}var f=1e-6,h=Math.PI,p=h/2,d=(Math.sqrt(h),h/180),g=180/h;function m(t){return t>1?p:t<-1?-p:Math.asin(t)}function v(t){return t>1?0:t<-1?h:Math.acos(t)}var y=t.geo.projection,x=t.geo.projectionMutator;function b(t,e){var r=(2+p)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>f;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(h*(4+h))*t*(1+Math.cos(e)),2*Math.sqrt(h/(4+h))*Math.sin(e)]}t.geo.interrupt=function(e){var r,n=[[[[-h,0],[0,p],[h,0]]],[[[-h,0],[0,-p],[h,0]]]];function i(t,r){for(var i=r<0?-1:1,a=n[+(r<0)],o=0,s=a.length-1;oa[o][2][0];++o);var l=e(t-a[o][1][0],r);return l[0]+=e(a[o][1][0],i*r>i*a[o][0][1]?a[o][0][1]:r)[0],l}function a(){r=n.map((function(t){return t.map((function(t){var r,n=e(t[0][0],t[0][1])[0],i=e(t[2][0],t[2][1])[0],a=e(t[1][0],t[0][1])[1],o=e(t[1][0],t[1][1])[1];return a>o&&(r=a,a=o,o=r),[[n,a],[i,o]]}))}))}e.invert&&(i.invert=function(t,a){for(var o=r[+(a<0)],s=n[+(a<0)],l=0,u=o.length;l=0;--i){var p;o=180*(p=n[1][i])[0][0]/h,s=180*p[0][1]/h,c=180*p[1][1]/h,u=180*p[2][0]/h,f=180*p[2][1]/h;r.push(l([[u-e,f-e],[u-e,c+e],[o+e,c+e],[o+e,s-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}(),a)},i},o.lobes=function(t){return arguments.length?(n=t.map((function(t){return t.map((function(t){return[[t[0][0]*h/180,t[0][1]*h/180],[t[1][0]*h/180,t[1][1]*h/180],[t[2][0]*h/180,t[2][1]*h/180]]}))})),a(),o):n.map((function(t){return t.map((function(t){return[[180*t[0][0]/h,180*t[0][1]/h],[180*t[1][0]/h,180*t[1][1]/h],[180*t[2][0]/h,180*t[2][1]/h]]}))}))},o},b.invert=function(t,e){var r=.5*e*Math.sqrt((4+h)/h),n=m(r),i=Math.cos(n);return[t/(2/Math.sqrt(h*(4+h))*(1+i)),m((n+r*(i+2))/(2+p))]},(t.geo.eckert4=function(){return y(b)}).raw=b;var _=t.geo.azimuthalEqualArea.raw;function w(t,e){if(arguments.length<2&&(e=t),1===e)return _;if(e===1/0)return T;function r(r,n){var i=_(r/e,n);return i[0]*=t,i}return r.invert=function(r,n){var i=_.invert(r/t,n);return i[0]*=e,i},r}function T(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function k(t,e){return[3*t/(2*h)*Math.sqrt(h*h/3-e*e),e]}function M(t,e){return[t,1.25*Math.log(Math.tan(h/4+.4*e))]}function A(t){return function(e){var r,n=t*Math.sin(e),i=30;do{e-=r=(e+Math.sin(e)-n)/(1+Math.cos(e))}while(Math.abs(r)>f&&--i>0);return e/2}}T.invert=function(t,e){var r=2*m(e/2);return[t*Math.cos(r/2)/Math.cos(r),r]},(t.geo.hammer=function(){var t=2,e=x(w),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}).raw=w,k.invert=function(t,e){return[2/3*h*t/Math.sqrt(h*h/3-e*e),e]},(t.geo.kavrayskiy7=function(){return y(k)}).raw=k,M.invert=function(t,e){return[t,2.5*Math.atan(Math.exp(.8*e))-.625*h]},(t.geo.miller=function(){return y(M)}).raw=M,A(h);var S=function(t,e,r){var n=A(r);function i(r,i){return[t*r*Math.cos(i=n(i)),e*Math.sin(i)]}return i.invert=function(n,i){var a=m(i/e);return[n/(t*Math.cos(a)),m((2*a+Math.sin(2*a))/r)]},i}(Math.SQRT2/p,Math.SQRT2,h);function E(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791)),e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))]}(t.geo.mollweide=function(){return y(S)}).raw=S,E.invert=function(t,e){var r,n=e,i=25;do{var a=n*n,o=a*a;n-=r=(n*(1.007226+a*(.015085+o*(.028874*a-.044475-.005916*o)))-e)/(1.007226+a*(.045255+o*(.259866*a-.311325-.005916*11*o)))}while(Math.abs(r)>f&&--i>0);return[t/(.8707+(a=n*n)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),n]},(t.geo.naturalEarth=function(){return y(E)}).raw=E;var C=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];function L(t,e){var r,n=Math.min(18,36*Math.abs(e)/h),i=Math.floor(n),a=n-i,o=(r=C[i])[0],s=r[1],l=(r=C[++i])[0],c=r[1],u=(r=C[Math.min(19,++i)])[0],f=r[1];return[t*(l+a*(u-o)/2+a*a*(u-2*l+o)/2),(e>0?p:-p)*(c+a*(f-s)/2+a*a*(f-2*c+s)/2)]}function I(t,e){return[t*Math.cos(e),e]}function P(t,e){var r,n=Math.cos(e),i=(r=v(n*Math.cos(t/=2)))?r/Math.sin(r):1;return[2*n*Math.sin(t)*i,Math.sin(e)*i]}function z(t,e){var r=P(t,e);return[(r[0]+t/p)/2,(r[1]+e)/2]}C.forEach((function(t){t[1]*=1.0144})),L.invert=function(t,e){var r=e/p,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=C[a][1],s=C[a+1][1],l=C[Math.min(19,a+2)][1],c=l-o,u=l-2*s+o,f=2*(Math.abs(r)-s)/c,h=u/c,m=f*(1-h*f*(1-2*h*f));if(m>=0||1===a){n=(e>=0?5:-5)*(m+i);var v,y=50;do{m=(i=Math.min(18,Math.abs(n)/5))-(a=Math.floor(i)),o=C[a][1],s=C[a+1][1],l=C[Math.min(19,a+2)][1],n-=(v=(e>=0?p:-p)*(s+m*(l-o)/2+m*m*(l-2*s+o)/2)-e)*g}while(Math.abs(v)>1e-12&&--y>0);break}}while(--a>=0);var x=C[a][0],b=C[a+1][0],_=C[Math.min(19,a+2)][0];return[t/(b+m*(_-x)/2+m*m*(_-2*b+x)/2),n*d]},(t.geo.robinson=function(){return y(L)}).raw=L,I.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return y(I)}).raw=I,P.invert=function(t,e){if(!(t*t+4*e*e>h*h+f)){var r=t,n=e,i=25;do{var a,o=Math.sin(r),s=Math.sin(r/2),l=Math.cos(r/2),c=Math.sin(n),u=Math.cos(n),p=Math.sin(2*n),d=c*c,g=u*u,m=s*s,y=1-g*l*l,x=y?v(u*l)*Math.sqrt(a=1/y):a=0,b=2*x*u*s-t,_=x*c-e,w=a*(g*m+x*u*l*d),T=a*(.5*o*p-2*x*c*s),k=.25*a*(p*s-x*c*g*o),M=a*(d*l+x*m*u),A=T*k-M*w;if(!A)break;var S=(_*T-b*M)/A,E=(b*k-_*w)/A;r-=S,n-=E}while((Math.abs(S)>f||Math.abs(E)>f)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return y(P)}).raw=P,z.invert=function(t,e){var r=t,n=e,i=25;do{var a,o=Math.cos(n),s=Math.sin(n),l=Math.sin(2*n),c=s*s,u=o*o,h=Math.sin(r),d=Math.cos(r/2),g=Math.sin(r/2),m=g*g,y=1-u*d*d,x=y?v(o*d)*Math.sqrt(a=1/y):a=0,b=.5*(2*x*o*g+r/p)-t,_=.5*(x*s+n)-e,w=.5*a*(u*m+x*o*d*c)+.5/p,T=a*(h*l/4-x*s*g),k=.125*a*(l*g-x*s*u*h),M=.5*a*(c*d+x*m*o)+.5,A=T*k-M*w,S=(_*T-b*M)/A,E=(b*k-_*w)/A;r-=S,n-=E}while((Math.abs(S)>f||Math.abs(E)>f)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return y(z)}).raw=z}},{}],863:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../registry"),o=Math.PI/180,s=180/Math.PI,l={cursor:"pointer"},c={cursor:"auto"};function u(t,e){return n.behavior.zoom().translate(e.translate()).scale(e.scale())}function f(t,e,r){var n=t.id,o=t.graphDiv,s=o.layout,l=s[n],c=o._fullLayout,u=c[n],f={},h={};function p(t,e){f[n+"."+t]=i.nestedProperty(l,t).get(),a.call("_storeDirectGUIEdit",s,c._preGUI,f);var r=i.nestedProperty(u,t);r.get()!==e&&(r.set(e),i.nestedProperty(l,t).set(e),h[n+"."+t]=e)}r(p),p("projection.scale",e.scale()/t.fitScale),p("fitbounds",!1),o.emit("plotly_relayout",h)}function h(t,e){var r=u(0,e);function i(r){var n=e.invert(t.midPt);r("center.lon",n[0]),r("center.lat",n[1])}return r.on("zoomstart",(function(){n.select(this).style(l)})).on("zoom",(function(){e.scale(n.event.scale).translate(n.event.translate),t.render();var r=e.invert(t.midPt);t.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":e.scale()/t.fitScale,"geo.center.lon":r[0],"geo.center.lat":r[1]})})).on("zoomend",(function(){n.select(this).style(c),f(t,e,i)})),r}function p(t,e){var r,i,a,o,s,h,p,d,g,m=u(0,e);function v(t){return e.invert(t)}function y(r){var n=e.rotate(),i=e.invert(t.midPt);r("projection.rotation.lon",-n[0]),r("center.lon",i[0]),r("center.lat",i[1])}return m.on("zoomstart",(function(){n.select(this).style(l),r=n.mouse(this),i=e.rotate(),a=e.translate(),o=i,s=v(r)})).on("zoom",(function(){if(h=n.mouse(this),function(t){var r=v(t);if(!r)return!0;var n=e(r);return Math.abs(n[0]-t[0])>2||Math.abs(n[1]-t[1])>2}(r))return m.scale(e.scale()),void m.translate(e.translate());e.scale(n.event.scale),e.translate([a[0],n.event.translate[1]]),s?v(h)&&(d=v(h),p=[o[0]+(d[0]-s[0]),i[1],i[2]],e.rotate(p),o=p):s=v(r=h),g=!0,t.render();var l=e.rotate(),c=e.invert(t.midPt);t.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":e.scale()/t.fitScale,"geo.center.lon":c[0],"geo.center.lat":c[1],"geo.projection.rotation.lon":-l[0]})})).on("zoomend",(function(){n.select(this).style(c),g&&f(t,e,y)})),m}function d(t,e){var r,i={r:e.rotate(),k:e.scale()},a=u(0,e),o=function(t){var e=0,r=arguments.length,i=[];for(;++ed?(a=(f>0?90:-90)-p,i=0):(a=Math.asin(f/d)*s-p,i=Math.sqrt(d*d-f*f));var g=180-a-2*p,m=(Math.atan2(h,u)-Math.atan2(c,i))*s,v=(Math.atan2(h,u)-Math.atan2(c,-i))*s;return b(r[0],r[1],a,m)<=b(r[0],r[1],g,v)?[a,m,r[2]]:[g,v,r[2]]}function b(t,e,r,n){var i=_(r-t),a=_(n-e);return Math.sqrt(i*i+a*a)}function _(t){return(t%360+540)%360-180}function w(t,e,r){var n=r*o,i=t.slice(),a=0===e?1:0,s=2===e?1:2,l=Math.cos(n),c=Math.sin(n);return i[a]=t[a]*l-t[s]*c,i[s]=t[s]*l+t[a]*c,i}function T(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*s,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*s,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*s]}function k(t,e){for(var r=0,n=0,i=t.length;nMath.abs(s)?(c.boxEnd[1]=c.boxStart[1]+Math.abs(a)*_*(s>=0?1:-1),c.boxEnd[1]l[3]&&(c.boxEnd[1]=l[3],c.boxEnd[0]=c.boxStart[0]+(l[3]-c.boxStart[1])/Math.abs(_))):(c.boxEnd[0]=c.boxStart[0]+Math.abs(s)/_*(a>=0?1:-1),c.boxEnd[0]l[2]&&(c.boxEnd[0]=l[2],c.boxEnd[1]=c.boxStart[1]+(l[2]-c.boxStart[0])*Math.abs(_)))}}else c.boxEnabled?(a=c.boxStart[0]!==c.boxEnd[0],s=c.boxStart[1]!==c.boxEnd[1],a||s?(a&&(m(0,c.boxStart[0],c.boxEnd[0]),t.xaxis.autorange=!1),s&&(m(1,c.boxStart[1],c.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),c.boxEnabled=!1,c.boxInited=!1):c.boxInited&&(c.boxInited=!1);break;case"pan":c.boxEnabled=!1,c.boxInited=!1,e?(c.panning||(c.dragStart[0]=n,c.dragStart[1]=i),Math.abs(c.dragStart[0]-n).999&&(g="turntable"):g="turntable")}else g="turntable";r("dragmode",g),r("hovermode",n.getDfltFromLayout("hovermode"))}e.exports=function(t,e,r){var i=e._basePlotModules.length>1;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},autotypenumbersDflt:e.autotypenumbers,paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":643,"../../../lib":778,"../../../registry":910,"../../get_data":864,"../../subplot_defaults":904,"./axis_defaults":872,"./layout_attributes":875}],875:[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":778,"../../../lib/extend":768,"../../domain":854,"./axis_attributes":871}],876:[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":801}],877:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,s=t.fullSceneLayout,l=[[],[],[]],c=0;c<3;++c){var u=s[a[c]];if(u._length=(r[c].hi-r[c].lo)*r[c].pixelsPerDataUnit/t.dataScale[c],Math.abs(u._length)===1/0||isNaN(u._length))l[c]=[];else{u._input_range=u.range.slice(),u.range[0]=r[c].lo/t.dataScale[c],u.range[1]=r[c].hi/t.dataScale[c],u._m=1/(t.dataScale[c]*r[c].pixelsPerDataUnit),u.range[0]===u.range[1]&&(u.range[0]-=1,u.range[1]+=1);var f=u.tickmode;if("auto"===u.tickmode){u.tickmode="linear";var h=u.nticks||i.constrain(u._length/40,4,9);n.autoTicks(u,Math.abs(u.range[1]-u.range[0])/h)}for(var p=n.calcTicks(u,{msUTC:!0}),d=0;d/g," "));l[c]=p,u.tickmode=f}}e.ticks=l;for(c=0;c<3;++c){o[c]=.5*(t.glplot.bounds[0][c]+t.glplot.bounds[1][c]);for(d=0;d<2;++d)e.bounds[d][c]=t.glplot.bounds[d][c]}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;ar.deltaY?1.1:1/1.1,a=t.glplot.getAspectratio();t.glplot.setAspectratio({x:n*a.x,y:n*a.y,z:n*a.z})}i(t)}}),!!c&&{passive:!1}),t.glplot.canvas.addEventListener("mousemove",(function(){if(!1!==t.fullSceneLayout.dragmode&&0!==t.camera.mouseListener.buttons){var e=n();t.graphDiv.emit("plotly_relayouting",e)}})),t.staticMode||t.glplot.canvas.addEventListener("webglcontextlost",(function(r){e&&e.emit&&e.emit("plotly_webglcontextlost",{event:r,layer:t.id})}),!1)),t.glplot.oncontextloss=function(){t.recoverContext()},t.glplot.onrender=function(){t.render()},!0},w.render=function(){var t,e=this,r=e.graphDiv,n=e.svgContainer,i=e.container.getBoundingClientRect();r._fullLayout._calcInverseTransform(r);var a=r._fullLayout._invScaleX,o=r._fullLayout._invScaleY,s=i.width*a,l=i.height*o;n.setAttributeNS(null,"viewBox","0 0 "+s+" "+l),n.setAttributeNS(null,"width",s),n.setAttributeNS(null,"height",l),x(e),e.glplot.axes.update(e.axesOptions);for(var c,u=Object.keys(e.traces),d=null,g=e.glplot.selection,v=0;v")):"isosurface"===t.type||"volume"===t.type?(k.valueLabel=h.tickText(e._mockAxis,e._mockAxis.d2l(g.traceCoordinate[3]),"hover").text,E.push("value: "+k.valueLabel),g.textLabel&&E.push(g.textLabel),_=E.join("
")):_=g.textLabel;var C={x:g.traceCoordinate[0],y:g.traceCoordinate[1],z:g.traceCoordinate[2],data:w._input,fullData:w,curveNumber:w.index,pointNumber:T};p.appendArrayPointValue(C,w,T),t._module.eventData&&(C=w._module.eventData(C,g,w,{},T));var L={points:[C]};e.fullSceneLayout.hovermode&&p.loneHover({trace:w,x:(.5+.5*b[0]/b[3])*s,y:(.5-.5*b[1]/b[3])*l,xLabel:k.xLabel,yLabel:k.yLabel,zLabel:k.zLabel,text:_,name:d.name,color:p.castHoverOption(w,T,"bgcolor")||d.color,borderColor:p.castHoverOption(w,T,"bordercolor"),fontFamily:p.castHoverOption(w,T,"font.family"),fontSize:p.castHoverOption(w,T,"font.size"),fontColor:p.castHoverOption(w,T,"font.color"),nameLength:p.castHoverOption(w,T,"namelength"),textAlign:p.castHoverOption(w,T,"align"),hovertemplate:f.castOption(w,T,"hovertemplate"),hovertemplateLabels:f.extendFlat({},C,k),eventData:[C]},{container:n,gd:r}),g.buttons&&g.distance<5?r.emit("plotly_click",L):r.emit("plotly_hover",L),c=L}else p.loneUnhover(n),r.emit("plotly_unhover",c);e.drawAnnotations(e)},w.recoverContext=function(){var t=this;t.glplot.dispose();var e=function(){t.glplot.gl.isContextLost()?requestAnimationFrame(e):t.initializeGLPlot()?t.plot.apply(t,t.plotArgs):f.error("Catastrophic and unrecoverable WebGL error. Context lost.")};requestAnimationFrame(e)};var k=["xaxis","yaxis","zaxis"];function M(t,e,r){for(var n=t.fullSceneLayout,i=0;i<3;i++){var a=k[i],o=a.charAt(0),s=n[a],l=e[o],c=e[o+"calendar"],u=e["_"+o+"length"];if(f.isArrayOrTypedArray(l))for(var h,p=0;p<(u||l.length);p++)if(f.isArrayOrTypedArray(l[p]))for(var d=0;dm[1][a])m[0][a]=-1,m[1][a]=1;else{var C=m[1][a]-m[0][a];m[0][a]-=C/32,m[1][a]+=C/32}if("reversed"===s.autorange){var L=m[0][a];m[0][a]=m[1][a],m[1][a]=L}}else{var I=s.range;m[0][a]=s.r2l(I[0]),m[1][a]=s.r2l(I[1])}m[0][a]===m[1][a]&&(m[0][a]-=1,m[1][a]+=1),v[a]=m[1][a]-m[0][a],this.glplot.setBounds(a,{min:m[0][a]*h[a],max:m[1][a]*h[a]})}var P=c.aspectmode;if("cube"===P)g=[1,1,1];else if("manual"===P){var z=c.aspectratio;g=[z.x,z.y,z.z]}else{if("auto"!==P&&"data"!==P)throw new Error("scene.js aspectRatio was not one of the enumerated types");var O=[1,1,1];for(a=0;a<3;++a){var D=y[l=(s=c[k[a]]).type];O[a]=Math.pow(D.acc,1/D.count)/h[a]}g="data"===P||Math.max.apply(null,O)/Math.min.apply(null,O)<=4?O:[1,1,1]}c.aspectratio.x=u.aspectratio.x=g[0],c.aspectratio.y=u.aspectratio.y=g[1],c.aspectratio.z=u.aspectratio.z=g[2],this.glplot.setAspectratio(c.aspectratio),this.viewInitial.aspectratio||(this.viewInitial.aspectratio={x:c.aspectratio.x,y:c.aspectratio.y,z:c.aspectratio.z}),this.viewInitial.aspectmode||(this.viewInitial.aspectmode=c.aspectmode);var R=c.domain||null,F=e._size||null;if(R&&F){var B=this.container.style;B.position="absolute",B.left=F.l+R.x[0]*F.w+"px",B.top=F.t+(1-R.y[1])*F.h+"px",B.width=F.w*(R.x[1]-R.x[0])+"px",B.height=F.h*(R.y[1]-R.y[0])+"px"}this.glplot.redraw()}},w.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},w.getCamera=function(){var t;return this.camera.view.recalcMatrix(this.camera.view.lastT()),{up:{x:(t=this.camera).up[0],y:t.up[1],z:t.up[2]},center:{x:t.center[0],y:t.center[1],z:t.center[2]},eye:{x:t.eye[0],y:t.eye[1],z:t.eye[2]},projection:{type:!0===t._ortho?"orthographic":"perspective"}}},w.setViewport=function(t){var e,r=t.camera;this.camera.lookAt.apply(this,[[(e=r).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]]),this.glplot.setAspectratio(t.aspectratio),"orthographic"===r.projection.type!==this.camera._ortho&&(this.glplot.redraw(),this.glplot.clearRGBA(),this.glplot.dispose(),this.initializeGLPlot())},w.isCameraChanged=function(t){var e=this.getCamera(),r=f.nestedProperty(t,this.id+".camera").get();function n(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]]}var i=!1;if(void 0===r)i=!0;else{for(var a=0;a<3;a++)for(var o=0;o<3;o++)if(!n(e,r,a,o)){i=!0;break}(!r.projection||e.projection&&e.projection.type!==r.projection.type)&&(i=!0)}return i},w.isAspectChanged=function(t){var e=this.glplot.getAspectratio(),r=f.nestedProperty(t,this.id+".aspectratio").get();return void 0===r||r.x!==e.x||r.y!==e.y||r.z!==e.z},w.saveLayout=function(t){var e,r,n,i,a,o,s=this.fullLayout,l=this.isCameraChanged(t),c=this.isAspectChanged(t),h=l||c;if(h){var p={};if(l&&(e=this.getCamera(),n=(r=f.nestedProperty(t,this.id+".camera")).get(),p[this.id+".camera"]=n),c&&(i=this.glplot.getAspectratio(),o=(a=f.nestedProperty(t,this.id+".aspectratio")).get(),p[this.id+".aspectratio"]=o),u.call("_storeDirectGUIEdit",t,s._preGUI,p),l)r.set(e),f.nestedProperty(s,this.id+".camera").set(e);if(c)a.set(i),f.nestedProperty(s,this.id+".aspectratio").set(i),this.glplot.redraw()}return h},w.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 c=this.id+".camera.up",h={x:0,y:0,z:1},p={};p[c]=h;var d=n.layout;u.call("_storeDirectGUIEdit",d,i._preGUI,p),a.up=h,f.nestedProperty(d,c).set(h)}}else r.keyBindingMode=t;this.fullSceneLayout.hovermode=e},w.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),function(t,e,r){for(var n=0,i=r-1;n0)for(var s=255/o,l=0;l<3;++l)t[a+l]=Math.min(s*t[a+l],255)}}(a,r,i);var o=document.createElement("canvas");o.width=r,o.height=i;var s,l=o.getContext("2d"),c=l.createImageData(r,i);switch(c.data.set(a),l.putImageData(c,0,0),t){case"jpeg":s=o.toDataURL("image/jpeg");break;case"webp":s=o.toDataURL("image/webp");break;default:s=o.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(n),s},w.setConvert=function(){for(var t=0;t<3;t++){var e=this.fullSceneLayout[k[t]];h.setConvert(e,this.fullLayout),e.setScale=f.noop}},w.make4thDimension=function(){var t=this.graphDiv._fullLayout;this._mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},h.setConvert(this._mockAxis,t)},e.exports=_},{"../../components/fx":683,"../../lib":778,"../../lib/show_no_webgl_msg":799,"../../lib/str2rgbarray":801,"../../plots/cartesian/axes":827,"../../registry":910,"./layout/convert":873,"./layout/spikes":876,"./layout/tick_marks":877,"./project":878,"gl-plot3d":321,"has-passive-events":441,"is-mobile":467,"webgl-context":606}],880:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){n=n||t.length;for(var i=new Array(n),a=0;a\xa9 OpenStreetMap
',tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-osm-tiles",type:"raster",source:"plotly-osm-tiles",minzoom:0,maxzoom:22}]},"white-bg":{id:"white-bg",version:8,sources:{},layers:[{id:"white-bg",type:"background",paint:{"background-color":"#FFFFFF"},minzoom:0,maxzoom:22}]},"carto-positron":{id:"carto-positron",version:8,sources:{"plotly-carto-positron":{type:"raster",attribution:'\xa9 CARTO',tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-positron",type:"raster",source:"plotly-carto-positron",minzoom:0,maxzoom:22}]},"carto-darkmatter":{id:"carto-darkmatter",version:8,sources:{"plotly-carto-darkmatter":{type:"raster",attribution:'\xa9 CARTO',tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-darkmatter",type:"raster",source:"plotly-carto-darkmatter",minzoom:0,maxzoom:22}]},"stamen-terrain":{id:"stamen-terrain",version:8,sources:{"plotly-stamen-terrain":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under ODbL.',tiles:["https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-terrain",type:"raster",source:"plotly-stamen-terrain",minzoom:0,maxzoom:22}]},"stamen-toner":{id:"stamen-toner",version:8,sources:{"plotly-stamen-toner":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under ODbL.',tiles:["https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-toner",type:"raster",source:"plotly-stamen-toner",minzoom:0,maxzoom:22}]},"stamen-watercolor":{id:"stamen-watercolor",version:8,sources:{"plotly-stamen-watercolor":{type:"raster",attribution:'Map tiles by Stamen Design, under CC BY 3.0 | Data by OpenStreetMap, under CC BY SA.',tiles:["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-watercolor",type:"raster",source:"plotly-stamen-watercolor",minzoom:0,maxzoom:22}]}},i=Object.keys(n);e.exports={requiredVersion:"1.10.1",styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",styleValuesMapbox:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],styleValueDflt:"basic",stylesNonMapbox:n,styleValuesNonMapbox:i,traceLayerPrefix:"plotly-trace-layer-",layoutLayerPrefix:"plotly-layout-layer-",wrongVersionErrorMsg:["Your custom plotly.js bundle is not using the correct mapbox-gl version","Please install mapbox-gl@1.10.1."].join("\n"),noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.plot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join("\n"),missingStyleErrorMsg:["No valid mapbox style found, please set `mapbox.style` to one of:",i.join(", "),"or register a Mapbox access token to use a Mapbox-served style."].join("\n"),multipleTokensErrorMsg:["Set multiple mapbox access token across different mapbox subplot,","using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join("\n"),mapOnErrorMsg:"Mapbox error.",mapboxLogo:{path0:"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z",path1:"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z",path2:"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z",polygon:"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34"},styleRules:{map:"overflow:hidden;position:relative;","missing-css":"display:none;",canary:"background-color:salmon;","ctrl-bottom-left":"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;","ctrl-bottom-right":"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;",ctrl:"clear: both; pointer-events: auto; transform: translate(0, 0);","ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner":"display: none;","ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner":"display: block; margin-top:2px","ctrl-attrib.mapboxgl-compact:hover":"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;","ctrl-attrib.mapboxgl-compact::after":'content: ""; cursor: pointer; position: absolute; background-image: url(\'data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath fill="%23333333" fill-rule="evenodd" d="M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0"/%3E %3C/svg%3E\'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;',"ctrl-attrib.mapboxgl-compact":"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;","ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; right: 0","ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; left: 0","ctrl-bottom-left .mapboxgl-ctrl":"margin: 0 0 10px 10px; float: left;","ctrl-bottom-right .mapboxgl-ctrl":"margin: 0 10px 10px 0; float: right;","ctrl-attrib":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a:hover":"color: inherit; text-decoration: underline;","ctrl-attrib .mapbox-improve-map":"font-weight: bold; margin-left: 2px;","attrib-empty":"display: none;","ctrl-logo":'display:block; width: 21px; height: 21px; background-image: url(\'data:image/svg+xml;charset=utf-8,%3C?xml version="1.0" encoding="utf-8"?%3E %3Csvg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve"%3E%3Cg transform="translate(0,0.01)"%3E%3Cpath d="m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z" style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3Cpath d="M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpath d="M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpolygon points="11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34 " style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3C/g%3E%3C/svg%3E\')'}}},{}],883:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r=t.split(" "),i=r[0],a=r[1],o=n.isArrayOrTypedArray(e)?n.mean(e):e,s=.5+o/100,l=1.5+o/100,c=["",""],u=[0,0];switch(i){case"top":c[0]="top",u[1]=-l;break;case"bottom":c[0]="bottom",u[1]=l}switch(a){case"left":c[1]="right",u[0]=-s;break;case"right":c[1]="left",u[0]=s}return{anchor:c[0]&&c[1]?c.join("-"):c[0]?c[0]:c[1]?c[1]:"center",offset:u}}},{"../../lib":778}],884:[function(t,e,r){"use strict";var n=t("mapbox-gl"),i=t("../../lib"),a=i.strTranslate,o=i.strScale,s=t("../../plots/get_data").getSubplotCalcData,l=t("../../constants/xmlns_namespaces"),c=t("d3"),u=t("../../components/drawing"),f=t("../../lib/svg_text_utils"),h=t("./mapbox"),p=r.constants=t("./constants");function d(t){return"string"==typeof t&&(-1!==p.styleValuesMapbox.indexOf(t)||0===t.indexOf("mapbox://"))}r.name="mapbox",r.attr="subplot",r.idRoot="mapbox",r.idRegex=r.attrRegex=i.counterRegex("mapbox"),r.attributes={subplot:{valType:"subplotid",dflt:"mapbox",editType:"calc"}},r.layoutAttributes=t("./layout_attributes"),r.supplyLayoutDefaults=t("./layout_defaults"),r.plot=function(t){var e=t._fullLayout,r=t.calcdata,a=e._subplots.mapbox;if(n.version!==p.requiredVersion)throw new Error(p.wrongVersionErrorMsg);var o=function(t,e){var r=t._fullLayout;if(""===t._context.mapboxAccessToken)return"";for(var n=[],a=[],o=!1,s=!1,l=0;l1&&i.warn(p.multipleTokensErrorMsg),n[0]):(a.length&&i.log(["Listed mapbox access token(s)",a.join(","),"but did not use a Mapbox map style, ignoring token(s)."].join(" ")),"")}(t,a);n.accessToken=o;for(var l=0;l_/2){var w=v.split("|").join("
");x.text(w).attr("data-unformatted",w).call(f.convertToTspans,t),b=u.bBox(x.node())}x.attr("transform",a(-3,8-b.height)),y.insert("rect",".static-attribution").attr({x:-b.width-6,y:-b.height-3,width:b.width+6,height:b.height+3,fill:"rgba(255, 255, 255, 0.75)"});var T=1;b.width+6>_&&(T=_/(b.width+6));var k=[n.l+n.w*h.x[1],n.t+n.h*(1-h.y[0])];y.attr("transform",a(k[0],k[1])+o(T))}},r.updateFx=function(t){for(var e=t._fullLayout,r=e._subplots.mapbox,n=0;n0){for(var r=0;r0}function u(t){var e={},r={};switch(t.type){case"circle":n.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":n.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity,"line-dasharray":t.line.dash});break;case"fill":n.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var i=t.symbol,o=a(i.textposition,i.iconsize);n.extendFlat(e,{"icon-image":i.icon+"-15","icon-size":i.iconsize/10,"text-field":i.text,"text-size":i.textfont.size,"text-anchor":o.anchor,"text-offset":o.offset,"symbol-placement":i.placement}),n.extendFlat(r,{"icon-color":t.color,"text-color":i.textfont.color,"text-opacity":t.opacity});break;case"raster":n.extendFlat(r,{"raster-fade-duration":0,"raster-opacity":t.opacity})}return{layout:e,paint:r}}l.update=function(t){this.visible?this.needsNewImage(t)?this.updateImage(t):this.needsNewSource(t)?(this.removeLayer(),this.updateSource(t),this.updateLayer(t)):this.needsNewLayer(t)?this.updateLayer(t):this.updateStyle(t):(this.updateSource(t),this.updateLayer(t)),this.visible=c(t)},l.needsNewImage=function(t){return this.subplot.map.getSource(this.idSource)&&"image"===this.sourceType&&"image"===t.sourcetype&&(this.source!==t.source||JSON.stringify(this.coordinates)!==JSON.stringify(t.coordinates))},l.needsNewSource=function(t){return this.sourceType!==t.sourcetype||JSON.stringify(this.source)!==JSON.stringify(t.source)||this.layerType!==t.type},l.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},l.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},l.updateImage=function(t){this.subplot.map.getSource(this.idSource).updateImage({url:t.source,coordinates:t.coordinates});var e=this.findFollowingMapboxLayerId(this.lookupBelow());null!==e&&this.subplot.map.moveLayer(this.idLayer,e)},l.updateSource=function(t){var e=this.subplot.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,c(t)){var r=function(t){var e,r=t.sourcetype,n=t.source,a={type:r};"geojson"===r?e="data":"vector"===r?e="string"==typeof n?"url":"tiles":"raster"===r?(e="tiles",a.tileSize=256):"image"===r&&(e="url",a.coordinates=t.coordinates);a[e]=n,t.sourceattribution&&(a.attribution=i(t.sourceattribution));return a}(t);e.addSource(this.idSource,r)}},l.findFollowingMapboxLayerId=function(t){if("traces"===t)for(var e=this.subplot.getMapLayers(),r=0;r1)for(r=0;r-1&&v(e.originalEvent,n,[r.xaxis],[r.yaxis],r.id,t),i.indexOf("event")>-1&&c.click(n,e.originalEvent)}}},_.updateFx=function(t){var e=this,r=e.map,n=e.gd;if(!e.isStatic){var a,o=t.dragmode;a=f(o)?function(t,r){(t.range={})[e.id]=[c([r.xmin,r.ymin]),c([r.xmax,r.ymax])]}:function(t,r,n){(t.lassoPoints={})[e.id]=n.filtered.map(c)};var s=e.dragOptions;e.dragOptions=i.extendDeep(s||{},{dragmode:t.dragmode,element:e.div,gd:n,plotinfo:{id:e.id,domain:t[e.id].domain,xaxis:e.xaxis,yaxis:e.yaxis,fillRangeItems:a},xaxes:[e.xaxis],yaxes:[e.yaxis],subplot:e.id}),r.off("click",e.onClickInPanHandler),p(o)||h(o)?(r.dragPan.disable(),r.on("zoomstart",e.clearSelect),e.dragOptions.prepFn=function(t,r,n){d(t,r,n,e.dragOptions,o)},l.init(e.dragOptions)):(r.dragPan.enable(),r.off("zoomstart",e.clearSelect),e.div.onmousedown=null,e.onClickInPanHandler=e.onClickInPanFn(e.dragOptions),r.on("click",e.onClickInPanHandler))}function c(t){var r=e.map.unproject(t);return[r.lng,r.lat]}},_.updateFramework=function(t){var e=t[this.id].domain,r=t._size,n=this.div.style;n.width=r.w*(e.x[1]-e.x[0])+"px",n.height=r.h*(e.y[1]-e.y[0])+"px",n.left=r.l+e.x[0]*r.w+"px",n.top=r.t+(1-e.y[1])*r.h+"px",this.xaxis._offset=r.l+e.x[0]*r.w,this.xaxis._length=r.w*(e.x[1]-e.x[0]),this.yaxis._offset=r.t+(1-e.y[1])*r.h,this.yaxis._length=r.h*(e.y[1]-e.y[0])},_.updateLayers=function(t){var e,r=t[this.id].layers,n=this.layerList;if(r.length!==n.length){for(e=0;e=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"),l=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(){x.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()&&l.text()?" - ":"")}},x.sendDataToCloud=function(t){var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;if(e){t.emit("plotly_beforeexport");var 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=x.graphJson(t,!1,"keepdata"),i.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1}};var w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function k(t,e){var r=t._context.locale;r||(r="en-US");var n=!1,i={};function a(t){for(var r=!0,a=0;a1&&O.length>1){for(o.getComponentMethod("grid","sizeDefaults")(u,l),s=0;s15&&O.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"),x.linkSubplots(h,l,f,a),x.cleanPlot(h,l,f,a);var N=!(!a._has||!a._has("gl2d")),j=!(!l._has||!l._has("gl2d")),U=!(!a._has||!a._has("cartesian"))||N,V=!(!l._has||!l._has("cartesian"))||j;U&&!V?a._bgLayer.remove():V&&!U&&(l._shouldCreateBgLayer=!0),a._zoomlayer&&!t._dragging&&p({_fullLayout:a}),function(t,e){var r,n=[];e.meta&&(r=e._meta={meta:e.meta,layout:{meta:e.meta}});for(var i=0;i0){var f=1-2*s;n=Math.round(f*n),i=Math.round(f*i)}}var h=x.layoutAttributes.width.min,p=x.layoutAttributes.height.min;n1,g=!e.height&&Math.abs(r.height-i)>1;(g||d)&&(d&&(r.width=n),g&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),x.sanitizeMargins(r)},x.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a,s,l=o.componentsRegistry,u=e._basePlotModules,f=o.subplotsRegistry.cartesian;for(i in l)(s=l[i]).includeBasePlot&&s.includeBasePlot(t,e);for(var h in u.length||u.push(f),e._has("cartesian")&&(o.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(c.subplotSort);for(a=0;a1&&(r.l/=h,r.r/=h);var p=(r.t+r.b)/s;p>1&&(r.t/=p,r.b/=p);var d=void 0!==r.xl?r.xl:r.x,g=void 0!==r.xr?r.xr:r.x,m=void 0!==r.yt?r.yt:r.y,v=void 0!==r.yb?r.yb:r.y;l[e]={l:{val:d,size:r.l+u},r:{val:g,size:r.r+u},b:{val:v,size:r.b+u},t:{val:m,size:r.t+u}},c[e]=1}else delete l[e],delete c[e];if(!n._replotting)return x.doAutoMargin(t)}},x.doAutoMargin=function(t){var e=t._fullLayout,r=e.width,n=e.height,i=Math.max(0,r-64),s=Math.max(0,n-64);e._size||(e._size={}),C(e);var l=e._size,u=e.margin,f=c.extendFlat({},l),p=u.l,d=u.r,g=u.t,m=u.b,v=e._pushmargin,y=e._pushmarginIds;if(!1!==e.margin.autoexpand){for(var b in v)y[b]||delete v[b];for(var _ in v.base={l:{val:0,size:p},r:{val:1,size:d},t:{val:1,size:g},b:{val:0,size:m}},v){var w=v[_].l||{},T=v[_].b||{},k=w.val,M=w.size,A=T.val,S=T.size;for(var E in v){if(a(M)&&v[E].r){var L=v[E].r.val,I=v[E].r.size;if(L>k){var P=(M*L+(I-r)*k)/(L-k),z=(I*(1-k)+(M-r)*(1-L))/(L-k);P+z>p+d&&(p=P,d=z)}}if(a(S)&&v[E].t){var O=v[E].t.val,D=v[E].t.size;if(O>A){var R=(S*O+(D-n)*A)/(O-A),F=(D*(1-A)+(S-n)*(1-O))/(O-A);R+F>m+g&&(m=R,g=F)}}}}}var B=(p+d)/i;B>1&&(p/=B,d/=B);var N=(m+g)/s;if(N>1&&(m/=N,g/=N),l.l=Math.round(p),l.r=Math.round(d),l.t=Math.round(g),l.b=Math.round(m),l.p=Math.round(u.pad),l.w=Math.round(r)-l.l-l.r,l.h=Math.round(n)-l.t-l.b,!e._replotting&&x.didMarginChange(f,l)){"_redrawFromAutoMarginCount"in e?e._redrawFromAutoMarginCount++:e._redrawFromAutoMarginCount=1;var j=3*(1+Object.keys(y).length);if(e._redrawFromAutoMarginCount0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push((function(){n=!0})),r.redraw&&t._transitionData._interruptCallbacks.push((function(){return o.call("redraw",t)})),t._transitionData._interruptCallbacks.push((function(){t.emit("plotly_transitioninterrupted",[])}));var a=0,s=0;function l(){return a++,function(){s++,n||s!==a||function(e){if(!t._transitionData)return;(function(t){if(t)for(;t.length;)t.shift()})(t._transitionData._interruptCallbacks),Promise.resolve().then((function(){if(r.redraw)return o.call("redraw",t)})).then((function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])})).then(e)}(i)}}r.runFn(l),setTimeout(l())}))}],a=c.syncOrAsync(i,t);return a&&a.then||(a=Promise.resolve()),a.then((function(){return t}))}x.didMarginChange=function(t,e){for(var r=0;r1)return!0}return!1},x.graphJson=function(t,e,r,n,i,a){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&x.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function u(t,e){if("function"==typeof t)return e?"_function_":null;if(c.isPlainObject(t)){var n,i={};return Object.keys(t).sort().forEach((function(a){if(-1===["_","["].indexOf(a.charAt(0)))if("function"!=typeof t[a]){if("keepdata"===r){if("src"===a.substr(a.length-3))return}else if("keepstream"===r){if("string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0&&!c.isPlainObject(t.stream))return}else if("keepall"!==r&&"string"==typeof(n=t[a+"src"])&&n.indexOf(":")>0)return;i[a]=u(t[a],e)}else e&&(i[a]="_function")})),i}return Array.isArray(t)?t.map((function(t){return u(t,e)})):c.isTypedArray(t)?c.simpleMap(t,c.identity):c.isJSDate(t)?c.ms2DateTimeLocal(+t):t}var f={data:(o||[]).map((function(t){var r=u(t);return e&&delete r.fit,r}))};if(!e&&(f.layout=u(s),i)){var h=s._size;f.layout.computed={margin:{b:h.b,l:h.l,r:h.r,t:h.t}}}return t.framework&&t.framework.isPolar&&(f=t.framework.getConfig()),l&&(f.frames=u(l)),a&&(f.config=u(t._context,!0)),"object"===n?f:JSON.stringify(f)},x.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r=0;a--)if(s[a].enabled){r._indexToPoints=s[a]._indexToPoints;break}n&&n.calc&&(o=n.calc(t,r))}Array.isArray(o)&&o[0]||(o=[{x:f,y:f}]),o[0].t||(o[0].t={}),o[0].trace=r,d[e]=o}}for(z(l,u,p),i=0;i1e-10?t:0}function h(t,e,r){e=e||0,r=r||0;for(var n=t.length,i=new Array(n),a=0;a0?r:1/0})),i=n.mod(r+1,e.length);return[e[r],e[i]]},findIntersectionXY:c,findXYatLength:function(t,e,r,n){var i=-e*r,a=e*e+1,o=2*(e*i-r),s=i*i+r*r-t*t,l=Math.sqrt(o*o-4*a*s),c=(-o+l)/(2*a),u=(-o-l)/(2*a);return[[c,e*c+i+n],[u,e*u+i+n]]},clampTiny:f,pathPolygon:function(t,e,r,n,i,a){return"M"+h(u(t,e,r,n),i,a).join("L")},pathPolygonAnnulus:function(t,e,r,n,i,a,o){var s,l;t=0?h.angularAxis.domain:n.extent(T),E=Math.abs(T[1]-T[0]);M&&!k&&(E=0);var C=S.slice();A&&k&&(C[1]+=E);var L=h.angularAxis.ticksCount||4;L>8&&(L=L/(L/8)+L%8),h.angularAxis.ticksStep&&(L=(C[1]-C[0])/L);var I=h.angularAxis.ticksStep||(C[1]-C[0])/(L*(h.minorTicks+1));w&&(I=Math.max(Math.round(I),1)),C[2]||(C[2]=I);var P=n.range.apply(this,C);if(P=P.map((function(t,e){return parseFloat(t.toPrecision(12))})),s=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=s.domain(),u.layout.angularAxis.endPadding=A?E:0,"undefined"==typeof(t=n.select(this).select("svg.chart-root"))||t.empty()){var z=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),O=this.appendChild(this.ownerDocument.importNode(z.documentElement,!0));t=n.select(O)}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 D,R=t.select(".chart-group"),F={fill:"none",stroke:h.tickColor},B={"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){D=t.select(".legend-group").attr({transform:"translate("+[x,h.margin.top]+")"}).style({display:"block"});var N=p.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:p.map((function(t,e){return t.name||"Element"+e})),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:D,elements:N,reverseOrder:h.legend.reverseOrder})})();var j=D.node().getBBox();x=Math.min(h.width-j.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,x=Math.max(10,x),_=[h.margin.left+x,h.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),D.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else D=t.select(".legend-group").style({display:"none"});t.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(h.width-(h.margin.left+h.margin.right+2*x+(j?j.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*x))/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(B).text(h.title.text),q=V.node().getBBox();V.attr({x:_[0]-q.width/2,y:_[1]-x-20})}var H=t.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var G=H.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(F),G.attr("r",r),G.exit().remove()}H.select("circle.outside-circle").attr({r:x}).style(F);var Y=t.select("circle.background-circle").attr({r:x}).style({fill:h.backgroundColor,stroke:h.stroke});function W(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var X=n.svg.axis().scale(r).ticks(5).tickSize(5);H.call(X).attr({transform:"rotate("+h.radialAxis.orientation+")"}),H.selectAll(".domain").style(F),H.selectAll("g>text").text((function(t,e){return this.textContent+h.radialAxis.ticksSuffix})).style(B).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,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),H.selectAll("g>line").style({stroke:"black"})}var Z=t.select(".angular.axis-group").selectAll("g.angular-tick").data(P),J=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(),J.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(F),J.selectAll(".minor").style({stroke:h.minorTickColor}),Z.select("line.grid-line").attr({x1:h.tickLength?x-h.tickLength:0,x2:x}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=Z.select("text.axis-text").attr({x:x+h.labelOffset,dy:a+"em",transform:function(t,e){var r=W(t),n=x+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(B);h.angularAxis.rewriteTicks&&K.text((function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)}));var Q=n.max(R.selectAll(".angular-tick text")[0].map((function(t,e){return t.getCTM().e+t.getBBox().width})));D.attr({transform:"translate("+[x+Q,h.margin.top]+")"});var $=t.select("g.geometry-group").selectAll("g").size()>0,tt=t.select("g.geometry-group").selectAll("g.geometry").data(p);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),p[0]||$){var et=[];p.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})(),ct=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,hasTick:!0})();if(!k){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",(function(t,e){var r=o.util.getMousePos(Y).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(x+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"});R.on("mousemove.radial-guide",(function(t,e){var n=o.util.getMousePos(Y).radius;ht.attr({r:n}).style({opacity:.5}),at=r.invert(o.util.getMousePos(Y).radius);var i=o.util.convertToCartesian(n,h.radialAxis.orientation);ct.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])})).on("mouseout.radial-guide",(function(t,e){ht.style({opacity:0}),ut.hide(),lt.hide(),ct.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 c={t:o.util.round(e[0]),r:o.util.round(e[1])};k&&(c.t=w[e[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),h=t.node().getBoundingClientRect(),p=[f.left+f.width/2-U[0]-h.left,f.top+f.height/2-U[1]-h.top];ut.config({color:s}).text(u),ut.move(p)}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")&&ut.show()})).on("mouseout.tooltip",(function(t,e){ut.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")})}))}))}(c),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 u},h.getinputConfig=function(){return c},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:u(s),transform:function(t,r){return"rotate("+(e.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return d.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return d.stroke(r,i,a)},"stroke-width":function(t,e){return d["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return d["stroke-dasharray"](r,i,a)},opacity:function(t,e){return d.opacity(r,i,a)},display:function(t,e){return d.display(r,i,a)}})}};var f=e.angularScale.range(),h=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=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])}));c.arc=function(t,r,i){n.select(this).attr({class:"mark arc",d:p,transform:function(t,r){return"rotate("+(e.orientation+s(t[0])+90)+")"}})};var d={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 m=g.selectAll("path.mark").data((function(t,e){return t}));m.enter().append("path").attr({class:"mark"}),m.style(d).each(c[e.geometryType]),m.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})),c=e.fontSize,u=null==e.isContinuous?"number"==typeof o[0]:e.isContinuous,f=u?e.height:c*o.length,h=s.classed("legend-group",!0).selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var d=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(d).range(l),m=n.scale[u?"linear":"ordinal"]().domain(d)[u?"range":"rangePoints"]([0,f]);if(u){var v=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);v.enter().append("stop"),v.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("+[c/2,m(e)+c/2]+")"},d:function(t,e){var r,i,a,o=t.symbol;return a=3*(i=c),"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 x=n.svg.axis().scale(m).orient("right"),b=h.select("g.legend-axis").attr({transform:"translate("+[u?e.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?e.textColor:"none"}),b.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,c=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}),c};return c.text=function(i){var o=n.hsl(a.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=i||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var h=a.padding,p=e.node().getBBox(),d={fill:a.color,stroke:s,"stroke-width":"2px"},g=p.width+2*h+l,m=p.height+2*h;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[a.hasTick?0:l,0],[l,m/4],[l,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[l,-m/2+2*h]+")"}),t.style({display:"block"}),c},c.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(t)return t.style({display:"none"}),c},c.show=function(){if(t)return t.style({display:"block"}),c},c.config=function(t){return i(a,t),c},c},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"],c=["top","right","bottom","left","pad"],u={};n.entries(s.margin).forEach((function(t,e){u[c[l.indexOf(t.key)]]=t.value})),s.margin=u}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":745,"../../../lib":778,d3:169}],900:[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,c=e.exports={};c.framework=function(t){var e,r,i,a,u,f=new s;function h(r,s){return s&&(u=s),n.select(n.select(u).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(u),t.data=e.data,t.layout=e.layout,c.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},c.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":643,"../../../lib":778,"./micropolar":899,"./undo_manager":901,d3:169}],901:[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||(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=90||s>90&&l>=450?1:u<=0&&h<=0?0:Math.max(u,h);e=s<=180&&l>=180||s>180&&l>=540?-1:c>=0&&f>=0?0:Math.min(c,f);r=s<=270&&l>=270||s>270&&l>=630?-1:u>=0&&h>=0?0:Math.min(u,h);n=l>=360?1:c<=0&&f<=0?0:Math.max(c,f);return[e,r,n,i]}(p),b=x[2]-x[0],_=x[3]-x[1],w=h/f,T=Math.abs(_/b);w>T?(d=f,y=(h-(g=f*T))/n.h/2,m=[o[0],o[1]],v=[s[0]+y,s[1]-y]):(g=h,y=(f-(d=h/T))/n.w/2,m=[o[0]+y,o[1]-y],v=[s[0],s[1]]),this.xLength2=d,this.yLength2=g,this.xDomain2=m,this.yDomain2=v;var k=this.xOffset2=n.l+n.w*m[0],M=this.yOffset2=n.t+n.h*(1-v[1]),A=this.radius=d/b,S=this.innerRadius=e.hole*A,E=this.cx=k-A*x[0],C=this.cy=M+A*x[3],P=this.cxx=E-k,z=this.cyy=C-M;this.radialAxis=this.mockAxis(t,e,i,{_id:"x",side:{counterclockwise:"top",clockwise:"bottom"}[i.side],domain:[S/n.w,A/n.w]}),this.angularAxis=this.mockAxis(t,e,a,{side:"right",domain:[0,Math.PI],autorange:!1}),this.doAutoRange(t,e),this.updateAngularAxis(t,e),this.updateRadialAxis(t,e),this.updateRadialAxisTitle(t,e),this.xaxis=this.mockCartesianAxis(t,e,{_id:"x",domain:m}),this.yaxis=this.mockCartesianAxis(t,e,{_id:"y",domain:v});var O=this.pathSubplot();this.clipPaths.forTraces.select("path").attr("d",O).attr("transform",l(P,z)),r.frontplot.attr("transform",l(k,M)).call(u.setClipUrl,this._hasClipOnAxisFalse?null:this.clipIds.forTraces,this.gd),r.bg.attr("d",O).attr("transform",l(E,C)).call(c.fill,e.bgcolor)},O.mockAxis=function(t,e,r,n){var i=o.extendFlat({},r,n);return d(i,e,t),i},O.mockCartesianAxis=function(t,e,r){var n=this,i=r._id,a=o.extendFlat({type:"linear"},r);p(a,t);var s={x:[0,2],y:[1,3]};return a.setRange=function(){var t=n.sectorBBox,r=s[i],o=n.radialAxis._rl,l=(o[1]-o[0])/(1-e.hole);a.range=[t[r[0]]*l,t[r[1]]*l]},a.isPtWithinRange="x"===i?function(t){return n.isPtInside(t)}:function(){return!0},a.setRange(),a.setScale(),a},O.doAutoRange=function(t,e){var r=this.gd,n=this.radialAxis,i=e.radialaxis;n.setScale(),g(r,n);var a=n.range;i.range=a.slice(),i._input.range=a.slice(),n._rl=[n.r2l(a[0],null,"gregorian"),n.r2l(a[1],null,"gregorian")]},O.updateRadialAxis=function(t,e){var r=this,n=r.gd,i=r.layers,a=r.radius,u=r.innerRadius,f=r.cx,p=r.cy,d=e.radialaxis,g=L(e.sector[0],360),m=r.radialAxis,v=u90&&g<=270&&(m.tickangle=180);var y=function(t){return l(m.l2p(t.x)+u,0)},x=D(d);if(r.radialTickLayout!==x&&(i["radial-axis"].selectAll(".xtick").remove(),r.radialTickLayout=x),v){m.setScale();var b=h.calcTicks(m),_=h.clipEnds(m,b),w=h.getTickSigns(m)[2];h.drawTicks(n,m,{vals:b,layer:i["radial-axis"],path:h.makeTickPath(m,0,w),transFn:y,crisp:!1}),h.drawGrid(n,m,{vals:_,layer:i["radial-grid"],path:function(t){return r.pathArc(m.r2p(t.x)+u)},transFn:o.noop,crisp:!1}),h.drawLabels(n,m,{vals:b,layer:i["radial-axis"],transFn:y,labelFns:h.makeLabelFns(m,0)})}var T=r.radialAxisAngle=r.vangles?P(R(I(d.angle),r.vangles)):d.angle,k=l(f,p),M=k+s(-T);F(i["radial-axis"],v&&(d.showticklabels||d.ticks),{transform:M}),F(i["radial-grid"],v&&d.showgrid,{transform:k}),F(i["radial-line"].select("line"),v&&d.showline,{x1:u,y1:0,x2:a,y2:0,transform:M}).attr("stroke-width",d.linewidth).call(c.stroke,d.linecolor)},O.updateRadialAxisTitle=function(t,e,r){var n=this.gd,i=this.radius,a=this.cx,o=this.cy,s=e.radialaxis,l=this.id+"title",c=void 0!==r?r:this.radialAxisAngle,f=I(c),h=Math.cos(f),p=Math.sin(f),d=0;if(s.title){var g=u.bBox(this.layers["radial-axis"].node()).height,m=s.title.font.size;d="counterclockwise"===s.side?-g-.4*m:g+.8*m}this.layers["radial-axis-title"]=x.draw(n,l,{propContainer:s,propName:this.id+".radialaxis.title",placeholder:C(n,"Click to enter radial axis title"),attributes:{x:a+i/2*h+d*p,y:o-i/2*p+d*h,"text-anchor":"middle"},transform:{rotate:-c}})},O.updateAngularAxis=function(t,e){var r=this,n=r.gd,i=r.layers,a=r.radius,u=r.innerRadius,f=r.cx,p=r.cy,d=e.angularaxis,g=r.angularAxis;r.fillViewInitialKey("angularaxis.rotation",d.rotation),g.setGeometry(),g.setScale();var m=function(t){return g.t2g(t.x)};"linear"===g.type&&"radians"===g.thetaunit&&(g.tick0=P(g.tick0),g.dtick=P(g.dtick));var v=function(t){return l(f+a*Math.cos(t),p-a*Math.sin(t))},y=h.makeLabelFns(g,0).labelStandoff,x={xFn:function(t){var e=m(t);return Math.cos(e)*y},yFn:function(t){var e=m(t),r=Math.sin(e)>0?.2:1;return-Math.sin(e)*(y+t.fontSize*r)+Math.abs(Math.cos(e))*(t.fontSize*A)},anchorFn:function(t){var e=m(t),r=Math.cos(e);return Math.abs(r)<.1?"middle":r>0?"start":"end"},heightFn:function(t,e,r){var n=m(t);return-.5*(1+Math.sin(n))*r}},b=D(d);r.angularTickLayout!==b&&(i["angular-axis"].selectAll("."+g._id+"tick").remove(),r.angularTickLayout=b);var _,w=h.calcTicks(g);if("linear"===e.gridshape?(_=w.map(m),o.angleDelta(_[0],_[1])<0&&(_=_.slice().reverse())):_=null,r.vangles=_,"category"===g.type&&(w=w.filter((function(t){return o.isAngleInsideSector(m(t),r.sectorInRad)}))),g.visible){var T="inside"===g.ticks?-1:1,k=(g.linewidth||1)/2;h.drawTicks(n,g,{vals:w,layer:i["angular-axis"],path:"M"+T*k+",0h"+T*g.ticklen,transFn:function(t){var e=m(t);return v(e)+s(-P(e))},crisp:!1}),h.drawGrid(n,g,{vals:w,layer:i["angular-grid"],path:function(t){var e=m(t),r=Math.cos(e),n=Math.sin(e);return"M"+[f+u*r,p-u*n]+"L"+[f+a*r,p-a*n]},transFn:o.noop,crisp:!1}),h.drawLabels(n,g,{vals:w,layer:i["angular-axis"],repositionOnUpdate:!0,transFn:function(t){return v(m(t))},labelFns:x})}F(i["angular-line"].select("path"),d.showline,{d:r.pathSubplot(),transform:l(f,p)}).attr("stroke-width",d.linewidth).call(c.stroke,d.linecolor)},O.updateFx=function(t,e){this.gd._context.staticPlot||(this.updateAngularDrag(t),this.updateRadialDrag(t,e,0),this.updateRadialDrag(t,e,1),this.updateMainDrag(t))},O.updateMainDrag=function(t){var e,r,s=this,c=s.gd,u=s.layers,f=t._zoomlayer,h=S.MINZOOM,p=S.OFFEDGE,d=s.radius,g=s.innerRadius,x=s.cx,T=s.cy,k=s.cxx,M=s.cyy,A=s.sectorInRad,C=s.vangles,L=s.radialAxis,I=E.clampTiny,P=E.findXYatLength,z=E.findEnclosingVertexAngles,O=S.cornerHalfWidth,D=S.cornerLen/2,R=m.makeDragger(u,"path","maindrag","crosshair");n.select(R).attr("d",s.pathSubplot()).attr("transform",l(x,T));var F,B,N,j,U,V,q,H,G,Y={element:R,gd:c,subplot:s.id,plotinfo:{id:s.id,xaxis:s.xaxis,yaxis:s.yaxis},xaxes:[s.xaxis],yaxes:[s.yaxis]};function W(t,e){return Math.sqrt(t*t+e*e)}function X(t,e){return W(t-k,e-M)}function Z(t,e){return Math.atan2(M-e,t-k)}function J(t,e){return[t*Math.cos(e),t*Math.sin(-e)]}function K(t,e){if(0===t)return s.pathSector(2*O);var r=D/t,n=e-r,i=e+r,a=Math.max(0,Math.min(t,d)),o=a-O,l=a+O;return"M"+J(o,n)+"A"+[o,o]+" 0,0,0 "+J(o,i)+"L"+J(l,i)+"A"+[l,l]+" 0,0,1 "+J(l,n)+"Z"}function Q(t,e,r){if(0===t)return s.pathSector(2*O);var n,i,a=J(t,e),o=J(t,r),l=I((a[0]+o[0])/2),c=I((a[1]+o[1])/2);if(l&&c){var u=c/l,f=-1/u,h=P(O,u,l,c);n=P(D,f,h[0][0],h[0][1]),i=P(D,f,h[1][0],h[1][1])}else{var p,d;c?(p=D,d=O):(p=O,d=D),n=[[l-p,c-d],[l+p,c-d]],i=[[l-p,c+d],[l+p,c+d]]}return"M"+n.join("L")+"L"+i.reverse().join("L")+"Z"}function $(t,e){return e=Math.max(Math.min(e,d),g),th?(t-1&&1===t&&_(e,c,[s.xaxis],[s.yaxis],s.id,Y),r.indexOf("event")>-1&&y.click(c,e,s.id)}Y.prepFn=function(t,n,a){var l=c._fullLayout.dragmode,u=R.getBoundingClientRect();c._fullLayout._calcInverseTransform(c);var h=c._fullLayout._invTransform;e=c._fullLayout._invScaleX,r=c._fullLayout._invScaleY;var p=o.apply3DTransform(h)(n-u.left,a-u.top);if(F=p[0],B=p[1],C){var g=E.findPolygonOffset(d,A[0],A[1],C);F+=k+g[0],B+=M+g[1]}switch(l){case"zoom":Y.moveFn=C?nt:et,Y.clickFn=ot,Y.doneFn=it,function(){N=null,j=null,U=s.pathSubplot(),V=!1;var t=c._fullLayout[s.id];q=i(t.bgcolor).getLuminance(),(H=m.makeZoombox(f,q,x,T,U)).attr("fill-rule","evenodd"),G=m.makeCorners(f,x,T),w(c)}();break;case"select":case"lasso":b(t,n,a,Y,l)}},R.onmousemove=function(t){y.hover(c,t,s.id),c._fullLayout._lasthover=R,c._fullLayout._hoversubplot=s.id},R.onmouseout=function(t){c._dragging||v.unhover(c,t)},v.init(Y)},O.updateRadialDrag=function(t,e,r){var i=this,c=i.gd,u=i.layers,f=i.radius,h=i.innerRadius,p=i.cx,d=i.cy,g=i.radialAxis,y=S.radialDragBoxSize,x=y/2;if(g.visible){var b,_,T,A=I(i.radialAxisAngle),E=g._rl,C=E[0],L=E[1],z=E[r],O=.75*(E[1]-E[0])/(1-e.hole)/f;r?(b=p+(f+x)*Math.cos(A),_=d-(f+x)*Math.sin(A),T="radialdrag"):(b=p+(h-x)*Math.cos(A),_=d-(h-x)*Math.sin(A),T="radialdrag-inner");var D,B,N,j=m.makeRectDragger(u,T,"crosshair",-x,-x,y,y),U={element:j,gd:c};F(n.select(j),g.visible&&h0==(r?N>C:Nn?function(t){return t<=0}:function(t){return t>=0};t.c2g=function(r){var n=t.c2l(r)-e;return(s(n)?n:0)+o},t.g2c=function(r){return t.l2c(r+e-o)},t.g2p=function(t){return t*a},t.c2p=function(e){return t.g2p(t.c2g(e))}}}(t,e);break;case"angularaxis":!function(t,e){var r=t.type;if("linear"===r){var i=t.d2c,s=t.c2d;t.d2c=function(t,e){return function(t,e){return"degrees"===e?a(t):t}(i(t),e)},t.c2d=function(t,e){return s(function(t,e){return"degrees"===e?o(t):t}(t,e))}}t.makeCalcdata=function(e,i){var a,o,s=e[i],l=e._length,c=function(r){return t.d2c(r,e.thetaunit)};if(s){if(n.isTypedArray(s)&&"linear"===r){if(l===s.length)return s;if(s.subarray)return s.subarray(0,l)}for(a=new Array(l),o=0;o0){for(var n=[],i=0;i=u&&(p.min=0,g.min=0,m.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}function d(t,e,r,n){var i=f[e._name];function o(r,n){return a.coerce(t,e,i,r,n)}o("uirevision",n.uirevision),e.type="linear";var h=o("color"),p=h!==i.color.dflt?h:r.font.color,d=e._name.charAt(0).toUpperCase(),g="Component "+d,m=o("title.text",g);e._hovertitle=m===g?m:d,a.coerceFont(o,"title.font",{family:r.font.family,size:Math.round(1.2*r.font.size),color:p}),o("min"),c(t,e,o,"linear"),s(t,e,o,"linear",{}),l(t,e,o,{outerTicks:!0}),o("showticklabels")&&(a.coerceFont(o,"tickfont",{family:r.font.family,size:r.font.size,color:p}),o("tickangle"),o("tickformat")),u(t,e,o,{dfltColor:h,bgColor:r.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:i}),o("hoverformat"),o("layer")}e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:f,handleDefaults:p,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../components/color":643,"../../lib":778,"../../plot_api/plot_template":816,"../cartesian/line_grid_defaults":843,"../cartesian/tick_label_defaults":848,"../cartesian/tick_mark_defaults":849,"../cartesian/tick_value_defaults":850,"../subplot_defaults":904,"./layout_attributes":907}],909:[function(t,e,r){"use strict";var n=t("d3"),i=t("tinycolor2"),a=t("../../registry"),o=t("../../lib"),s=o.strTranslate,l=o._,c=t("../../components/color"),u=t("../../components/drawing"),f=t("../cartesian/set_convert"),h=t("../../lib/extend").extendFlat,p=t("../plots"),d=t("../cartesian/axes"),g=t("../../components/dragelement"),m=t("../../components/fx"),v=t("../../components/dragelement/helpers"),y=v.freeMode,x=v.rectMode,b=t("../../components/titles"),_=t("../cartesian/select").prepSelect,w=t("../cartesian/select").selectOnClick,T=t("../cartesian/select").clearSelect,k=t("../cartesian/select").clearSelectionsCache,M=t("../cartesian/constants");function A(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework(e),this.aTickLayout=null,this.bTickLayout=null,this.cTickLayout=null}e.exports=A;var S=A.prototype;S.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={},this.layers={}},S.plot=function(t,e){var r=e[this.id],n=e._size;this._hasClipOnAxisFalse=!1;for(var i=0;iE*b?i=(a=b)*E:a=(i=x)/E,o=v*i/x,l=y*a/b,r=e.l+e.w*g-i/2,n=e.t+e.h*(1-m)-a/2,p.x0=r,p.y0=n,p.w=i,p.h=a,p.sum=_,p.xaxis={type:"linear",range:[w+2*k-_,_-w-2*T],domain:[g-o/2,g+o/2],_id:"x"},f(p.xaxis,p.graphDiv._fullLayout),p.xaxis.setScale(),p.xaxis.isPtWithinRange=function(t){return t.a>=p.aaxis.range[0]&&t.a<=p.aaxis.range[1]&&t.b>=p.baxis.range[1]&&t.b<=p.baxis.range[0]&&t.c>=p.caxis.range[1]&&t.c<=p.caxis.range[0]},p.yaxis={type:"linear",range:[w,_-T-k],domain:[m-l/2,m+l/2],_id:"y"},f(p.yaxis,p.graphDiv._fullLayout),p.yaxis.setScale(),p.yaxis.isPtWithinRange=function(){return!0};var M=p.yaxis.domain[0],A=p.aaxis=h({},t.aaxis,{range:[w,_-T-k],side:"left",tickangle:(+t.aaxis.tickangle||0)-30,domain:[M,M+l*E],anchor:"free",position:0,_id:"y",_length:i});f(A,p.graphDiv._fullLayout),A.setScale();var S=p.baxis=h({},t.baxis,{range:[_-w-k,T],side:"bottom",domain:p.xaxis.domain,anchor:"free",position:0,_id:"x",_length:i});f(S,p.graphDiv._fullLayout),S.setScale();var C=p.caxis=h({},t.caxis,{range:[_-w-T,k],side:"right",tickangle:(+t.caxis.tickangle||0)+30,domain:[M,M+l*E],anchor:"free",position:0,_id:"y",_length:i});f(C,p.graphDiv._fullLayout),C.setScale();var L="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";p.clipDef.select("path").attr("d",L),p.layers.plotbg.select("path").attr("d",L);var I="M0,"+a+"h"+i+"l-"+i/2+",-"+a+"Z";p.clipDefRelative.select("path").attr("d",I);var P=s(r,n);p.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",P),p.clipDefRelative.select("path").attr("transform",null);var z=s(r-S._offset,n+a);p.layers.baxis.attr("transform",z),p.layers.bgrid.attr("transform",z);var O=s(r+i/2,n)+"rotate(30)"+s(0,-A._offset);p.layers.aaxis.attr("transform",O),p.layers.agrid.attr("transform",O);var D=s(r+i/2,n)+"rotate(-30)"+s(0,-C._offset);p.layers.caxis.attr("transform",D),p.layers.cgrid.attr("transform",D),p.drawAxes(!0),p.layers.aline.select("path").attr("d",A.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(c.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),p.layers.bline.select("path").attr("d",S.showline?"M"+r+","+(n+a)+"h"+i:"M0,0").call(c.stroke,S.linecolor||"#000").style("stroke-width",(S.linewidth||0)+"px"),p.layers.cline.select("path").attr("d",C.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(c.stroke,C.linecolor||"#000").style("stroke-width",(C.linewidth||0)+"px"),p.graphDiv._context.staticPlot||p.initInteractions(),u.setClipUrl(p.layers.frontplot,p._hasClipOnAxisFalse?null:p.clipId,p.graphDiv)},S.drawAxes=function(t){var e=this.graphDiv,r=this.id.substr(7)+"title",n=this.layers,i=this.aaxis,a=this.baxis,o=this.caxis;if(this.drawAx(i),this.drawAx(a),this.drawAx(o),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(o.showticklabels?.75*o.tickfont.size:0)+("outside"===o.ticks?.87*o.ticklen:0)),c=(a.showticklabels?a.tickfont.size:0)+("outside"===a.ticks?a.ticklen:0)+3;n["a-title"]=b.draw(e,"a"+r,{propContainer:i,propName:this.id+".aaxis.title",placeholder:l(e,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-i.title.font.size/3-s,"text-anchor":"middle"}}),n["b-title"]=b.draw(e,"b"+r,{propContainer:a,propName:this.id+".baxis.title",placeholder:l(e,"Click to enter Component B title"),attributes:{x:this.x0-c,y:this.y0+this.h+.83*a.title.font.size+c,"text-anchor":"middle"}}),n["c-title"]=b.draw(e,"c"+r,{propContainer:o,propName:this.id+".caxis.title",placeholder:l(e,"Click to enter Component C title"),attributes:{x:this.x0+this.w+c,y:this.y0+this.h+.83*o.title.font.size+c,"text-anchor":"middle"}})}},S.drawAx=function(t){var e,r=this.graphDiv,n=t._name,i=n.charAt(0),a=t._id,s=this.layers[n],l=i+"tickLayout",c=(e=t).ticks+String(e.ticklen)+String(e.showticklabels);this[l]!==c&&(s.selectAll("."+a+"tick").remove(),this[l]=c),t.setScale();var u=d.calcTicks(t),f=d.clipEnds(t,u),h=d.makeTransTickFn(t),p=d.getTickSigns(t)[2],g=o.deg2rad(30),m=p*(t.linewidth||1)/2,v=p*t.ticklen,y=this.w,x=this.h,b="b"===i?"M0,"+m+"l"+Math.sin(g)*v+","+Math.cos(g)*v:"M"+m+",0l"+Math.cos(g)*v+","+-Math.sin(g)*v,_={a:"M0,0l"+x+",-"+y/2,b:"M0,0l-"+y/2+",-"+x,c:"M0,0l-"+x+","+y/2}[i];d.drawTicks(r,t,{vals:"inside"===t.ticks?f:u,layer:s,path:b,transFn:h,crisp:!1}),d.drawGrid(r,t,{vals:f,layer:this.layers[i+"grid"],path:_,transFn:h,crisp:!1}),d.drawLabels(r,t,{vals:u,layer:s,transFn:h,labelFns:d.makeLabelFns(t,0,30)})};var C=M.MINZOOM/2+.87,L="m-0.87,.5h"+C+"v3h-"+(C+5.2)+"l"+(C/2+2.6)+",-"+(.87*C+4.5)+"l2.6,1.5l-"+C/2+","+.87*C+"Z",I="m0.87,.5h-"+C+"v3h"+(C+5.2)+"l-"+(C/2+2.6)+",-"+(.87*C+4.5)+"l-2.6,1.5l"+C/2+","+.87*C+"Z",P="m0,1l"+C/2+","+.87*C+"l2.6,-1.5l-"+(C/2+2.6)+",-"+(.87*C+4.5)+"l-"+(C/2+2.6)+","+(.87*C+4.5)+"l2.6,1.5l"+C/2+",-"+.87*C+"Z",z=!0;function O(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}S.clearSelect=function(){k(this.dragOptions),T(this.dragOptions.gd)},S.initInteractions=function(){var t,e,r,n,f,h,p,d,v,b,T,k,A=this,S=A.layers.plotbg.select("path").node(),C=A.graphDiv,D=C._fullLayout._zoomlayer;function R(t){var e={};return e[A.id+".aaxis.min"]=t.a,e[A.id+".baxis.min"]=t.b,e[A.id+".caxis.min"]=t.c,e}function F(t,e){var r=C._fullLayout.clickmode;O(C),2===t&&(C.emit("plotly_doubleclick",null),a.call("_guiRelayout",C,R({a:0,b:0,c:0}))),r.indexOf("select")>-1&&1===t&&w(e,C,[A.xaxis],[A.yaxis],A.id,A.dragOptions),r.indexOf("event")>-1&&m.click(C,e,A.id)}function B(t,e){return 1-e/A.h}function N(t,e){return 1-(t+(A.h-e)/Math.sqrt(3))/A.w}function j(t,e){return(t-(A.h-e)/Math.sqrt(3))/A.w}function U(i,a){var o=r+i*t,s=n+a*e,l=Math.max(0,Math.min(1,B(0,n),B(0,s))),c=Math.max(0,Math.min(1,N(r,n),N(o,s))),u=Math.max(0,Math.min(1,j(r,n),j(o,s))),g=(l/2+u)*A.w,m=(1-l/2-c)*A.w,y=(g+m)/2,x=m-g,_=(1-l)*A.h,w=_-x/E;x.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),k.transition().style("opacity",1).duration(200),b=!0),C.emit("plotly_relayouting",R(p))}function V(){O(C),p!==f&&(a.call("_guiRelayout",C,R(p)),z&&C.data&&C._context.showTips&&(o.notifier(l(C,"Double-click to zoom back out"),"long"),z=!1))}function q(t,e){var r=t/A.xaxis._m,n=e/A.yaxis._m,i=[(p={a:f.a-n,b:f.b+(r+n)/2,c:f.c-(r-n)/2}).a,p.b,p.c].sort(o.sorterAsc),a=i.indexOf(p.a),l=i.indexOf(p.b),c=i.indexOf(p.c);i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),p={a:i[a],b:i[l],c:i[c]},e=(f.a-p.a)*A.yaxis._m,t=(f.c-p.c-f.b+p.b)*A.xaxis._m);var h=s(A.x0+t,A.y0+e);A.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",h);var d=s(-t,-e);A.clipDefRelative.select("path").attr("transform",d),A.aaxis.range=[p.a,A.sum-p.b-p.c],A.baxis.range=[A.sum-p.a-p.c,p.b],A.caxis.range=[A.sum-p.a-p.b,p.c],A.drawAxes(!1),A._hasClipOnAxisFalse&&A.plotContainer.select(".scatterlayer").selectAll(".trace").call(u.hideOutsideRangePoints,A),C.emit("plotly_relayouting",R(p))}function H(){a.call("_guiRelayout",C,R(p))}this.dragOptions={element:S,gd:C,plotinfo:{id:A.id,domain:C._fullLayout[A.id].domain,xaxis:A.xaxis,yaxis:A.yaxis},subplot:A.id,prepFn:function(a,l,u){A.dragOptions.xaxes=[A.xaxis],A.dragOptions.yaxes=[A.yaxis],t=C._fullLayout._invScaleX,e=C._fullLayout._invScaleY;var g=A.dragOptions.dragmode=C._fullLayout.dragmode;y(g)?A.dragOptions.minDrag=1:A.dragOptions.minDrag=void 0,"zoom"===g?(A.dragOptions.moveFn=U,A.dragOptions.clickFn=F,A.dragOptions.doneFn=V,function(t,e,a){var l=S.getBoundingClientRect();r=e-l.left,n=a-l.top,C._fullLayout._calcInverseTransform(C);var u=C._fullLayout._invTransform,g=o.apply3DTransform(u)(r,n);r=g[0],n=g[1],f={a:A.aaxis.range[0],b:A.baxis.range[1],c:A.caxis.range[1]},p=f,h=A.aaxis.range[1]-f.a,d=i(A.graphDiv._fullLayout[A.id].bgcolor).getLuminance(),v="M0,"+A.h+"L"+A.w/2+", 0L"+A.w+","+A.h+"Z",b=!1,T=D.append("path").attr("class","zoombox").attr("transform",s(A.x0,A.y0)).style({fill:d>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",v),k=D.append("path").attr("class","zoombox-corners").attr("transform",s(A.x0,A.y0)).style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),A.clearSelect(C)}(0,l,u)):"pan"===g?(A.dragOptions.moveFn=q,A.dragOptions.clickFn=F,A.dragOptions.doneFn=H,f={a:A.aaxis.range[0],b:A.baxis.range[1],c:A.caxis.range[1]},p=f,A.clearSelect(C)):(x(g)||y(g))&&_(a,l,u,A.dragOptions,g)}},S.onmousemove=function(t){m.hover(C,t,A.id),C._fullLayout._lasthover=S,C._fullLayout._hoversubplot=A.id},S.onmouseout=function(t){C._dragging||g.unhover(C,t)},g.init(this.dragOptions)}},{"../../components/color":643,"../../components/dragelement":662,"../../components/dragelement/helpers":661,"../../components/drawing":665,"../../components/fx":683,"../../components/titles":738,"../../lib":778,"../../lib/extend":768,"../../registry":910,"../cartesian/axes":827,"../cartesian/constants":833,"../cartesian/select":846,"../cartesian/set_convert":847,"../plots":890,d3:169,tinycolor2:576}],910:[function(t,e,r){"use strict";var n=t("./lib/loggers"),i=t("./lib/noop"),a=t("./lib/push_unique"),o=t("./lib/is_plain_object"),s=t("./lib/dom").addStyleRule,l=t("./lib/extend"),c=t("./plots/attributes"),u=t("./plots/layout_attributes"),f=l.extendFlat,h=l.extendDeepAll;function p(t){var e=t.name,i=t.categories,a=t.meta;if(r.modules[e])n.log("Type "+e+" already registered");else{r.subplotsRegistry[t.basePlotModule.name]||function(t){var e=t.name;if(r.subplotsRegistry[e])return void n.log("Plot type "+e+" already registered.");for(var i in v(t),r.subplotsRegistry[e]=t,r.componentsRegistry)b(i,t.name)}(t.basePlotModule);for(var o={},l=0;l-1&&(f[p[r]].title={text:""});for(r=0;r")?"":e.html(t).text()}));return e.remove(),r}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),i.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":643,"../components/drawing":665,"../constants/xmlns_namespaces":754,"../lib":778,d3:169}],919:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rf+c||!n(u))}for(var p=0;pa))return e}return void 0!==r?r:t.dflt},r.coerceColor=function(t,e,r){return i(e).isValid()?e:void 0!==r?r:t.dflt},r.coerceEnumerated=function(t,e,r){return t.coerceNumber&&(e=+e),-1!==t.values.indexOf(e)?e:void 0!==r?r:t.dflt},r.getValue=function(t,e){var r;return Array.isArray(t)?e0?i+=a:e<0&&(i-=a)}return n.inbox(r-e,i-e,b+(i-e)/(i-r)-1)}"h"===m.orientation?(a=r,s=e,u="y",f="x",h=S,p=A):(a=e,s=r,u="x",f="y",p=S,h=A);var E=t[u+"a"],C=t[f+"a"];d=Math.abs(E.r2c(E.range[1])-E.r2c(E.range[0]));var L=n.getDistanceFunction(i,h,p,(function(t){return(h(t)+p(t))/2}));if(n.getClosest(g,L,t),!1!==t.index&&g[t.index].p!==c){y||(T=function(t){return Math.min(_(t),t.p-v.bargroupwidth/2)},k=function(t){return Math.max(w(t),t.p+v.bargroupwidth/2)});var I=g[t.index],P=m.base?I.b+I.s:I.s;t[f+"0"]=t[f+"1"]=C.c2p(I[f],!0),t[f+"LabelVal"]=P;var z=v.extents[v.extents.round(I.p)];t[u+"0"]=E.c2p(y?T(I):z[0],!0),t[u+"1"]=E.c2p(y?k(I):z[1],!0);var O=void 0!==I.orig_p;return t[u+"LabelVal"]=O?I.orig_p:I.p,t.labelLabel=l(E,t[u+"LabelVal"]),t.valueLabel=l(C,t[f+"LabelVal"]),t.baseLabel=l(C,I.b),t.spikeDistance=(S(I)+function(t){return M(_(t),w(t))}(I))/2-b,t[u+"Spike"]=E.c2p(I.p,!0),o(I,m,t),t.hovertemplate=m.hovertemplate,t}}function f(t,e){var r=e.mcc||t.marker.color,n=e.mlcc||t.marker.line.color,i=s(t,e);return a.opacity(r)?r:a.opacity(n)&&i?n:void 0}e.exports={hoverPoints:function(t,e,r,n){var a=u(t,e,r,n);if(a){var o=a.cd,s=o[0].trace,l=o[a.index];return a.color=f(s,l),i.getComponentMethod("errorbars","hoverInfo")(l,s,a),[a]}},hoverOnBars:u,getTraceColor:f}},{"../../components/color":643,"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"./helpers":926}],928:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc").crossTraceCalc,colorbar:t("../scatter/marker_colorbar"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot").plot,style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"bar",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":840,"../scatter/marker_colorbar":1204,"./arrays_to_calcdata":919,"./attributes":920,"./calc":921,"./cross_trace_calc":923,"./defaults":924,"./event_data":925,"./hover":927,"./layout_attributes":929,"./layout_defaults":930,"./plot":931,"./select":932,"./style":934}],929:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],930:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=t("./layout_attributes");e.exports=function(t,e,r){function s(r,n){return a.coerce(t,e,o,r,n)}for(var l=!1,c=!1,u=!1,f={},h=s("barmode"),p=0;p0}function S(t){return"auto"===t?0:t}function E(t,e){var r=Math.PI/180*e,n=Math.abs(Math.sin(r)),i=Math.abs(Math.cos(r));return{x:t.width*i+t.height*n,y:t.width*n+t.height*i}}function C(t,e,r,n,i,a){var o=!!a.isHorizontal,s=!!a.constrained,l=a.angle||0,c=a.anchor||"end",u="end"===c,f="start"===c,h=((a.leftToRight||0)+1)/2,p=1-h,d=i.width,g=i.height,m=Math.abs(e-t),v=Math.abs(n-r),y=m>2*_&&v>2*_?_:0;m-=2*y,v-=2*y;var x=S(l);"auto"!==l||d<=m&&g<=v||!(d>m||g>v)||(d>v||g>m)&&d.01?H:function(t,e,r){return r&&t===e?t:Math.abs(t-e)>=2?H(t):t>e?Math.ceil(t):Math.floor(t)};B=G(B,N,D),N=G(N,B,D),j=G(j,U,!D),U=G(U,j,!D)}var Y=M(a.ensureSingle(P,"path"),I,m,v);if(Y.style("vector-effect","non-scaling-stroke").attr("d",isNaN((N-B)*(U-j))||V&&t._context.staticPlot?"M0,0Z":"M"+B+","+j+"V"+U+"H"+N+"V"+j+"Z").call(l.setClipUrl,e.layerClipId,t),!I.uniformtext.mode&&R){var W=l.makePointStyleFns(f);l.singlePointStyle(c,Y,f,W,t)}!function(t,e,r,n,i,s,c,f,p,m,v){var w,T=e.xaxis,A=e.yaxis,L=t._fullLayout;function I(e,r,n){return a.ensureSingle(e,"text").text(r).attr({class:"bartext bartext-"+w,"text-anchor":"middle","data-notex":1}).call(l.font,n).call(o.convertToTspans,t)}var P=n[0].trace,z="h"===P.orientation,O=function(t,e,r,n,i){var o,s=e[0].trace;o=s.texttemplate?function(t,e,r,n,i){var o=e[0].trace,s=a.castOption(o,r,"texttemplate");if(!s)return"";var l,c,f,h,p="waterfall"===o.type,d="funnel"===o.type;"h"===o.orientation?(l="y",c=i,f="x",h=n):(l="x",c=n,f="y",h=i);function g(t){return u(h,+t,!0).text}var m=e[r],v={};v.label=m.p,v.labelLabel=v[l+"Label"]=(y=m.p,u(c,y,!0).text);var y;var x=a.castOption(o,m.i,"text");(0===x||x)&&(v.text=x);v.value=m.s,v.valueLabel=v[f+"Label"]=g(m.s);var _={};b(_,o,m.i),p&&(v.delta=+m.rawS||m.s,v.deltaLabel=g(v.delta),v.final=m.v,v.finalLabel=g(v.final),v.initial=v.final-v.delta,v.initialLabel=g(v.initial));d&&(v.value=m.s,v.valueLabel=g(v.value),v.percentInitial=m.begR,v.percentInitialLabel=a.formatPercent(m.begR),v.percentPrevious=m.difR,v.percentPreviousLabel=a.formatPercent(m.difR),v.percentTotal=m.sumR,v.percenTotalLabel=a.formatPercent(m.sumR));var w=a.castOption(o,m.i,"customdata");w&&(v.customdata=w);return a.texttemplateString(s,v,t._d3locale,_,v,o._meta||{})}(t,e,r,n,i):s.textinfo?function(t,e,r,n){var i=t[0].trace,o="h"===i.orientation,s="waterfall"===i.type,l="funnel"===i.type;function c(t){return u(o?r:n,+t,!0).text}var f,h=i.textinfo,p=t[e],d=h.split("+"),g=[],m=function(t){return-1!==d.indexOf(t)};m("label")&&g.push((v=t[e].p,u(o?n:r,v,!0).text));var v;m("text")&&(0===(f=a.castOption(i,p.i,"text"))||f)&&g.push(f);if(s){var y=+p.rawS||p.s,x=p.v,b=x-y;m("initial")&&g.push(c(b)),m("delta")&&g.push(c(y)),m("final")&&g.push(c(x))}if(l){m("value")&&g.push(c(p.s));var _=0;m("percent initial")&&_++,m("percent previous")&&_++,m("percent total")&&_++;var w=_>1;m("percent initial")&&(f=a.formatPercent(p.begR),w&&(f+=" of initial"),g.push(f)),m("percent previous")&&(f=a.formatPercent(p.difR),w&&(f+=" of previous"),g.push(f)),m("percent total")&&(f=a.formatPercent(p.sumR),w&&(f+=" of total"),g.push(f))}return g.join("
")}(e,r,n,i):g.getValue(s.text,r);return g.coerceString(y,o)}(L,n,i,T,A);w=function(t,e){var r=g.getValue(t.textposition,e);return g.coerceEnumerated(x,r)}(P,i);var D="stack"===m.mode||"relative"===m.mode,R=n[i],F=!D||R._outmost;if(!O||"none"===w||(R.isBlank||s===c||f===p)&&("auto"===w||"inside"===w))return void r.select("text").remove();var B=L.font,N=d.getBarColor(n[i],P),j=d.getInsideTextFont(P,i,B,N),U=d.getOutsideTextFont(P,i,B),V=r.datum();z?"log"===T.type&&V.s0<=0&&(s=T.range[0]=G*(Z/Y):Z>=Y*(X/G);G>0&&Y>0&&(J||K||Q)?w="inside":(w="outside",q.remove(),q=null)}else w="inside";if(!q){W=a.ensureUniformFontSize(t,"outside"===w?U:j);var $=(q=I(r,O,W)).attr("transform");if(q.attr("transform",""),H=l.bBox(q.node()),G=H.width,Y=H.height,q.attr("transform",$),G<=0||Y<=0)return void q.remove()}var tt,et,rt=P.textangle;"outside"===w?(et="both"===P.constraintext||"outside"===P.constraintext,tt=function(t,e,r,n,i,a){var o,s=!!a.isHorizontal,l=!!a.constrained,c=a.angle||0,u=i.width,f=i.height,h=Math.abs(e-t),p=Math.abs(n-r);o=s?p>2*_?_:0:h>2*_?_:0;var d=1;l&&(d=s?Math.min(1,p/f):Math.min(1,h/u));var g=S(c),m=E(i,g),v=(s?m.x:m.y)/2,y=(i.left+i.right)/2,x=(i.top+i.bottom)/2,b=(t+e)/2,w=(r+n)/2,T=0,M=0,A=s?k(e,t):k(r,n);s?(b=e-A*o,T=A*v):(w=n+A*o,M=-A*v);return{textX:y,textY:x,targetX:b,targetY:w,anchorX:T,anchorY:M,scale:d,rotate:g}}(s,c,f,p,H,{isHorizontal:z,constrained:et,angle:rt})):(et="both"===P.constraintext||"inside"===P.constraintext,tt=C(s,c,f,p,H,{isHorizontal:z,constrained:et,angle:rt,anchor:P.insidetextanchor}));tt.fontSize=W.size,h(P.type,tt,L),R.transform=tt,M(q,L,m,v).attr("transform",a.getTextTransform(tt))}(t,e,P,r,p,B,N,j,U,m,v),e.layerClipId&&l.hideOutsideRangePoint(c,P.select("text"),w,L,f.xcalendar,f.ycalendar)}));var j=!1===f.cliponaxis;l.setClipUrl(c,j?null:e.layerClipId,t)}));c.getComponentMethod("errorbars","plot")(t,P,e,m)},toMoveInsideBar:C}},{"../../components/color":643,"../../components/drawing":665,"../../components/fx/helpers":679,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../registry":910,"./attributes":920,"./constants":922,"./helpers":926,"./style":934,"./uniform_text":936,d3:169,"fast-isnumeric":241}],932:[function(t,e,r){"use strict";function n(t,e,r,n,i){var a=e.c2p(n?t.s0:t.p0,!0),o=e.c2p(n?t.s1:t.p1,!0),s=r.c2p(n?t.p0:t.s0,!0),l=r.c2p(n?t.p1:t.s1,!0);return i?[(a+o)/2,(s+l)/2]:n?[o,(s+l)/2]:[(a+o)/2,l]}e.exports=function(t,e){var r,i=t.cd,a=t.xaxis,o=t.yaxis,s=i[0].trace,l="funnel"===s.type,c="h"===s.orientation,u=[];if(!1===e)for(r=0;r1||0===i.bargap&&0===i.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")})),e.selectAll("g.points").each((function(e){d(n.select(this),e[0].trace,t)})),s.getComponentMethod("errorbars","style")(e)},styleTextPoints:g,styleOnSelect:function(t,e,r){var i=e[0].trace;i.selectedpoints?function(t,e,r){a.selectedPointStyle(t.selectAll("path"),e),function(t,e,r){t.each((function(t){var i,s=n.select(this);if(t.selected){i=o.ensureUniformFontSize(r,m(s,t,e,r));var l=e.selected.textfont&&e.selected.textfont.color;l&&(i.color=l),a.font(s,i)}else a.selectedTextStyle(s,e)}))}(t.selectAll("text"),e,r)}(r,i,t):(d(r,i,t),s.getComponentMethod("errorbars","style")(r))},getInsideTextFont:y,getOutsideTextFont:x,getBarColor:_,resizeText:l}},{"../../components/color":643,"../../components/drawing":665,"../../lib":778,"../../registry":910,"./attributes":920,"./helpers":926,"./uniform_text":936,d3:169}],935:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/helpers").hasColorscale,a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s){r("marker.color",o),i(t,"marker")&&a(t,e,s,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),i(t,"marker.line")&&a(t,e,s,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":643,"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654}],936:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib");function a(t){return"_"+t+"Text_minsize"}e.exports={recordMinTextSize:function(t,e,r){if(r.uniformtext.mode){var n=a(t),i=r.uniformtext.minsize,o=e.scale*e.fontSize;e.hide=oh.range[1]&&(x+=Math.PI);if(n.getClosest(c,(function(t){return g(y,x,[t.rp0,t.rp1],[t.thetag0,t.thetag1],d)?m+Math.min(1,Math.abs(t.thetag1-t.thetag0)/v)-1+(t.rp1-y)/(t.rp1-t.rp0)-1:1/0}),t),!1!==t.index){var b=c[t.index];t.x0=t.x1=b.ct[0],t.y0=t.y1=b.ct[1];var _=i.extendFlat({},b,{r:b.s,theta:b.p});return o(b,u,t),s(_,u,f,t),t.hovertemplate=u.hovertemplate,t.color=a(u,b),t.xLabelVal=t.yLabelVal=void 0,b.s<0&&(t.idealAlign="left"),[t]}}},{"../../components/fx":683,"../../lib":778,"../../plots/polar/helpers":892,"../bar/hover":927,"../scatterpolar/hover":1264}],941:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"barpolar",basePlotModule:t("../../plots/polar"),categories:["polar","bar","showLegend"],attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("../scatterpolar/format_labels"),style:t("../bar/style").style,styleOnSelect:t("../bar/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../bar/select"),meta:{}}},{"../../plots/polar":893,"../bar/select":932,"../bar/style":934,"../scatter/marker_colorbar":1204,"../scatterpolar/format_labels":1263,"./attributes":937,"./calc":938,"./defaults":939,"./hover":940,"./layout_attributes":942,"./layout_defaults":943,"./plot":944}],942:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","overlay"],dflt:"stack",editType:"calc"},bargap:{valType:"number",dflt:.1,min:0,max:1,editType:"calc"}}},{}],943:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r){var a,o={};function s(r,o){return n.coerce(t[a]||{},e[a],i,r,o)}for(var l=0;l0?(c=o,u=l):(c=l,u=o);var f=[s.findEnclosingVertexAngles(c,t.vangles)[0],(c+u)/2,s.findEnclosingVertexAngles(u,t.vangles)[1]];return s.pathPolygonAnnulus(n,i,c,u,f,e,r)};return function(t,n,i,o){return a.pathAnnulus(t,n,i,o,e,r)}}(e),p=e.layers.frontplot.select("g.barlayer");a.makeTraceGroups(p,r,"trace bars").each((function(){var r=n.select(this),s=a.ensureSingle(r,"g","points").selectAll("g.point").data(a.identity);s.enter().append("g").style("vector-effect","non-scaling-stroke").style("stroke-miterlimit",2).classed("point",!0),s.exit().remove(),s.each((function(t){var e,r=n.select(this),o=t.rp0=u.c2p(t.s0),s=t.rp1=u.c2p(t.s1),p=t.thetag0=f.c2g(t.p0),d=t.thetag1=f.c2g(t.p1);if(i(o)&&i(s)&&i(p)&&i(d)&&o!==s&&p!==d){var g=u.c2g(t.s1),m=(p+d)/2;t.ct=[l.c2p(g*Math.cos(m)),c.c2p(g*Math.sin(m))],e=h(o,s,p,d)}else e="M0,0Z";a.ensureSingle(r,"path").attr("d",e)})),o.setClipUrl(r,e._hasClipOnAxisFalse?e.clipIds.forTraces:null,t)}))}},{"../../components/drawing":665,"../../lib":778,"../../plots/polar/helpers":892,d3:169,"fast-isnumeric":241}],945:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../bar/attributes"),a=t("../../components/color/attributes"),o=t("../../plots/template_attributes").hovertemplateAttrs,s=t("../../lib/extend").extendFlat,l=n.marker,c=l.line;e.exports={y:{valType:"data_array",editType:"calc+clearAxisTypes"},x:{valType:"data_array",editType:"calc+clearAxisTypes"},x0:{valType:"any",editType:"calc+clearAxisTypes"},y0:{valType:"any",editType:"calc+clearAxisTypes"},dx:{valType:"number",editType:"calc"},dy:{valType:"number",editType:"calc"},xperiod:n.xperiod,yperiod:n.yperiod,xperiod0:n.xperiod0,yperiod0:n.yperiod0,xperiodalignment:n.xperiodalignment,yperiodalignment:n.yperiodalignment,name:{valType:"string",editType:"calc+clearAxisTypes"},q1:{valType:"data_array",editType:"calc+clearAxisTypes"},median:{valType:"data_array",editType:"calc+clearAxisTypes"},q3:{valType:"data_array",editType:"calc+clearAxisTypes"},lowerfence:{valType:"data_array",editType:"calc"},upperfence:{valType:"data_array",editType:"calc"},notched:{valType:"boolean",editType:"calc"},notchwidth:{valType:"number",min:0,max:.5,dflt:.25,editType:"calc"},notchspan:{valType:"data_array",editType:"calc"},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],editType:"calc"},jitter:{valType:"number",min:0,max:1,editType:"calc"},pointpos:{valType:"number",min:-2,max:2,editType:"calc"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],editType:"calc"},mean:{valType:"data_array",editType:"calc"},sd:{valType:"data_array",editType:"calc"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},quartilemethod:{valType:"enumerated",values:["linear","exclusive","inclusive"],dflt:"linear",editType:"calc"},width:{valType:"number",min:0,dflt:0,editType:"calc"},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)",editType:"style"},symbol:s({},l.symbol,{arrayOk:!1,editType:"plot"}),opacity:s({},l.opacity,{arrayOk:!1,dflt:1,editType:"style"}),size:s({},l.size,{arrayOk:!1,editType:"calc"}),color:s({},l.color,{arrayOk:!1,editType:"style"}),line:{color:s({},c.color,{arrayOk:!1,dflt:a.defaultLine,editType:"style"}),width:s({},c.width,{arrayOk:!1,dflt:0,editType:"style"}),outliercolor:{valType:"color",editType:"style"},outlierwidth:{valType:"number",min:0,dflt:1,editType:"style"},editType:"style"},editType:"plot"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:n.fillcolor,whiskerwidth:{valType:"number",min:0,max:1,dflt:.5,editType:"calc"},offsetgroup:i.offsetgroup,alignmentgroup:i.alignmentgroup,selected:{marker:n.selected.marker,editType:"style"},unselected:{marker:n.unselected.marker,editType:"style"},text:s({},n.text,{}),hovertext:s({},n.hovertext,{}),hovertemplate:o({}),hoveron:{valType:"flaglist",flags:["boxes","points"],dflt:"boxes+points",editType:"style"}}},{"../../components/color/attributes":642,"../../lib/extend":768,"../../plots/template_attributes":905,"../bar/attributes":920,"../scatter/attributes":1186}],946:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../plots/cartesian/align_period"),o=t("../../lib"),s=t("../../constants/numerical").BADNUM,l=o._;e.exports=function(t,e){var r,c,y,x,b,_,w,T=t._fullLayout,k=i.getFromId(t,e.xaxis||"x"),M=i.getFromId(t,e.yaxis||"y"),A=[],S="violin"===e.type?"_numViolins":"_numBoxes";"h"===e.orientation?(y=k,x="x",b=M,_="y",w=!!e.yperiodalignment):(y=M,x="y",b=k,_="x",w=!!e.xperiodalignment);var E,C,L,I,P,z,O=function(t,e,r,i){var s,l=e+"0"in t,c="d"+e in t;if(e in t||l&&c){var u=r.makeCalcdata(t,e);return[a(t,r,e,u),u]}s=l?t[e+"0"]:"name"in t&&("category"===r.type||n(t.name)&&-1!==["linear","log"].indexOf(r.type)||o.isDateTime(t.name)&&"date"===r.type)?t.name:i;for(var f="multicategory"===r.type?r.r2c_just_indices(s):r.d2c(s,0,t[e+"calendar"]),h=t._length,p=new Array(h),d=0;dE.uf};if(e._hasPreCompStats){var U=e[x],V=function(t){return y.d2c((e[t]||[])[r])},q=1/0,H=-1/0;for(r=0;r=E.q1&&E.q3>=E.med){var Y=V("lowerfence");E.lf=Y!==s&&Y<=E.q1?Y:p(E,L,I);var W=V("upperfence");E.uf=W!==s&&W>=E.q3?W:d(E,L,I);var X=V("mean");E.mean=X!==s?X:I?o.mean(L,I):(E.q1+E.q3)/2;var Z=V("sd");E.sd=X!==s&&Z>=0?Z:I?o.stdev(L,I,E.mean):E.q3-E.q1,E.lo=g(E),E.uo=m(E);var J=V("notchspan");J=J!==s&&J>0?J:v(E,I),E.ln=E.med-J,E.un=E.med+J;var K=E.lf,Q=E.uf;e.boxpoints&&L.length&&(K=Math.min(K,L[0]),Q=Math.max(Q,L[I-1])),e.notched&&(K=Math.min(K,E.ln),Q=Math.max(Q,E.un)),E.min=K,E.max=Q}else{var $;o.warn(["Invalid input - make sure that q1 <= median <= q3","q1 = "+E.q1,"median = "+E.med,"q3 = "+E.q3].join("\n")),$=E.med!==s?E.med:E.q1!==s?E.q3!==s?(E.q1+E.q3)/2:E.q1:E.q3!==s?E.q3:0,E.med=$,E.q1=E.q3=$,E.lf=E.uf=$,E.mean=E.sd=$,E.ln=E.un=$,E.min=E.max=$}q=Math.min(q,E.min),H=Math.max(H,E.max),E.pts2=C.filter(j),A.push(E)}}e._extremes[y._id]=i.findExtremes(y,[q,H],{padded:!0})}else{var tt=y.makeCalcdata(e,x),et=function(t,e){for(var r=t.length,n=new Array(r+1),i=0;i=0&&it0){var ut,ft;if((E={}).pos=E[_]=B[r],C=E.pts=nt[r].sort(f),I=(L=E[x]=C.map(h)).length,E.min=L[0],E.max=L[I-1],E.mean=o.mean(L,I),E.sd=o.stdev(L,I,E.mean),E.med=o.interp(L,.5),I%2&&(lt||ct))lt?(ut=L.slice(0,I/2),ft=L.slice(I/2+1)):ct&&(ut=L.slice(0,I/2+1),ft=L.slice(I/2)),E.q1=o.interp(ut,.5),E.q3=o.interp(ft,.5);else E.q1=o.interp(L,.25),E.q3=o.interp(L,.75);E.lf=p(E,L,I),E.uf=d(E,L,I),E.lo=g(E),E.uo=m(E);var ht=v(E,I);E.ln=E.med-ht,E.un=E.med+ht,at=Math.min(at,E.ln),ot=Math.max(ot,E.un),E.pts2=C.filter(j),A.push(E)}e._extremes[y._id]=i.findExtremes(y,e.notched?tt.concat([at,ot]):tt,{padded:!0})}return function(t,e){if(o.isArrayOrTypedArray(e.selectedpoints))for(var r=0;r0?(A[0].t={num:T[S],dPos:N,posLetter:_,valLetter:x,labels:{med:l(t,"median:"),min:l(t,"min:"),q1:l(t,"q1:"),q3:l(t,"q3:"),max:l(t,"max:"),mean:"sd"===e.boxmean?l(t,"mean \xb1 \u03c3:"):l(t,"mean:"),lf:l(t,"lower fence:"),uf:l(t,"upper fence:")}},T[S]++,A):[{t:{empty:!0}}]};var c={text:"tx",hovertext:"htx"};function u(t,e,r){for(var n in c)o.isArrayOrTypedArray(e[n])&&(Array.isArray(r)?o.isArrayOrTypedArray(e[n][r[0]])&&(t[c[n]]=e[n][r[0]][r[1]]):t[c[n]]=e[n][r])}function f(t,e){return t.v-e.v}function h(t){return t.v}function p(t,e,r){return 0===r?t.q1:Math.min(t.q1,e[Math.min(o.findBin(2.5*t.q1-1.5*t.q3,e,!0)+1,r-1)])}function d(t,e,r){return 0===r?t.q3:Math.max(t.q3,e[Math.max(o.findBin(2.5*t.q3-1.5*t.q1,e),0)])}function g(t){return 4*t.q1-3*t.q3}function m(t){return 4*t.q3-3*t.q1}function v(t,e){return 0===e?0:1.57*(t.q3-t.q1)/Math.sqrt(e)}},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"fast-isnumeric":241}],947:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib"),a=t("../../plots/cartesian/constraints").getAxisGroup,o=["v","h"];function s(t,e,r,o){var s,l,c,u=e.calcdata,f=e._fullLayout,h=o._id,p=h.charAt(0),d=[],g=0;for(s=0;s1,b=1-f[t+"gap"],_=1-f[t+"groupgap"];for(s=0;s0){var H=E.pointpos,G=E.jitter,Y=E.marker.size/2,W=0;H+G>=0&&((W=V*(H+G))>A?(q=!0,j=Y,B=W):W>R&&(j=Y,B=A)),W<=A&&(B=A);var X=0;H-G<=0&&((X=-V*(H-G))>S?(q=!0,U=Y,N=X):X>F&&(U=Y,N=S)),X<=S&&(N=S)}else B=A,N=S;var Z=new Array(c.length);for(l=0;l0?(m="v",v=x>0?Math.min(_,b):Math.min(b)):x>0?(m="h",v=Math.min(_)):v=0;if(v){e._length=v;var S=r("orientation",m);e._hasPreCompStats?"v"===S&&0===x?(r("x0",0),r("dx",1)):"h"===S&&0===y&&(r("y0",0),r("dy",1)):"v"===S&&0===x?r("x0"):"h"===S&&0===y&&r("y0"),i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],a)}else e.visible=!1}function f(t,e,r,i){var a=i.prefix,o=n.coerce2(t,e,c,"marker.outliercolor"),s=r("marker.line.outliercolor"),l="outliers";e._hasPreCompStats?l="all":(o||s)&&(l="suspectedoutliers");var u=r(a+"points",l);u?(r("jitter","all"===u?.3:0),r("pointpos","all"===u?-1.5:0),r("marker.symbol"),r("marker.opacity"),r("marker.size"),r("marker.color",e.line.color),r("marker.line.color"),r("marker.line.width"),"suspectedoutliers"===u&&(r("marker.line.outliercolor",e.marker.color),r("marker.line.outlierwidth")),r("selected.marker.color"),r("unselected.marker.color"),r("selected.marker.size"),r("unselected.marker.size"),r("text"),r("hovertext")):delete e.marker;var f=r("hoveron");"all"!==f&&-1===f.indexOf("points")||r("hovertemplate"),n.coerceSelectionMarkerOpacity(e,r)}e.exports={supplyDefaults:function(t,e,r,i){function s(r,i){return n.coerce(t,e,c,r,i)}if(u(t,e,s,i),!1!==e.visible){o(t,e,i,s);var l=e._hasPreCompStats;l&&(s("lowerfence"),s("upperfence")),s("line.color",(t.marker||{}).color||r),s("line.width"),s("fillcolor",a.addOpacity(e.line.color,.5));var h=!1;if(l){var p=s("mean"),d=s("sd");p&&p.length&&(h=!0,d&&d.length&&(h="sd"))}s("boxmean",h),s("whiskerwidth"),s("width"),s("quartilemethod");var g=!1;if(l){var m=s("notchspan");m&&m.length&&(g=!0)}else n.validate(t.notchwidth,c.notchwidth)&&(g=!0);s("notched",g)&&s("notchwidth"),f(t,e,s,{prefix:"box"})}},crossTraceDefaults:function(t,e){var r,i;function a(t){return n.coerce(i._input,i,c,t)}for(var o=0;ot.lo&&(x.so=!0)}return a}));h.enter().append("path").classed("point",!0),h.exit().remove(),h.call(a.translatePoints,o,s)}function l(t,e,r,a){var o,s,l=e.val,c=e.pos,u=!!c.rangebreaks,f=a.bPos,h=a.bPosPxOffset||0,p=r.boxmean||(r.meanline||{}).visible;Array.isArray(a.bdPos)?(o=a.bdPos[0],s=a.bdPos[1]):(o=a.bdPos,s=a.bdPos);var d=t.selectAll("path.mean").data("box"===r.type&&r.boxmean||"violin"===r.type&&r.box.visible&&r.meanline.visible?i.identity:[]);d.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),d.exit().remove(),d.each((function(t){var e=c.c2l(t.pos+f,!0),i=c.l2p(e-o)+h,a=c.l2p(e+s)+h,d=u?(i+a)/2:c.l2p(e)+h,g=l.c2p(t.mean,!0),m=l.c2p(t.mean-t.sd,!0),v=l.c2p(t.mean+t.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+g+","+i+"V"+a+("sd"===p?"m0,0L"+m+","+d+"L"+g+","+i+"L"+v+","+d+"Z":"")):n.select(this).attr("d","M"+i+","+g+"H"+a+("sd"===p?"m0,0L"+d+","+m+"L"+i+","+g+"L"+d+","+v+"Z":""))}))}e.exports={plot:function(t,e,r,a){var c=e.xaxis,u=e.yaxis;i.makeTraceGroups(a,r,"trace boxes").each((function(t){var e,r,i=n.select(this),a=t[0],f=a.t,h=a.trace;(f.wdPos=f.bdPos*h.whiskerwidth,!0!==h.visible||f.empty)?i.remove():("h"===h.orientation?(e=u,r=c):(e=c,r=u),o(i,{pos:e,val:r},h,f),s(i,{x:c,y:u},h,f),l(i,{pos:e,val:r},h,f))}))},plotBoxAndWhiskers:o,plotPoints:s,plotBoxMean:l}},{"../../components/drawing":665,"../../lib":778,d3:169}],955:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i=t.cd,a=t.xaxis,o=t.yaxis,s=[];if(!1===e)for(r=0;r=10)return null;for(var i=1/0,a=-1/0,o=e.length,s=0;s0?Math.floor:Math.ceil,P=C>0?Math.ceil:Math.floor,z=C>0?Math.min:Math.max,O=C>0?Math.max:Math.min,D=I(S+L),R=P(E-L),F=[[f=A(S)]];for(a=D;a*C=0;i--)a[u-i]=t[f][i],o[u-i]=e[f][i];for(s.push({x:a,y:o,bicubic:l}),i=f,a=[],o=[];i>=0;i--)a[f-i]=t[i][0],o[f-i]=e[i][0];return s.push({x:a,y:o,bicubic:c}),s}},{}],969:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e,r){var a,o,s,l,c,u,f,h,p,d,g,m,v,y,x=t["_"+e],b=t[e+"axis"],_=b._gridlines=[],w=b._minorgridlines=[],T=b._boundarylines=[],k=t["_"+r],M=t[r+"axis"];"array"===b.tickmode&&(b.tickvals=x.slice());var A=t._xctrl,S=t._yctrl,E=A[0].length,C=A.length,L=t._a.length,I=t._b.length;n.prepTicks(b),"array"===b.tickmode&&delete b.tickvals;var P=b.smoothing?3:1;function z(n){var i,a,o,s,l,c,u,f,p,d,g,m,v=[],y=[],x={};if("b"===e)for(a=t.b2j(n),o=Math.floor(Math.max(0,Math.min(I-2,a))),s=a-o,x.length=I,x.crossLength=L,x.xy=function(e){return t.evalxy([],e,a)},x.dxy=function(e,r){return t.dxydi([],e,o,r,s)},i=0;i0&&(p=t.dxydi([],i-1,o,0,s),v.push(l[0]+p[0]/3),y.push(l[1]+p[1]/3),d=t.dxydi([],i-1,o,1,s),v.push(f[0]-d[0]/3),y.push(f[1]-d[1]/3)),v.push(f[0]),y.push(f[1]),l=f;else for(i=t.a2i(n),c=Math.floor(Math.max(0,Math.min(L-2,i))),u=i-c,x.length=L,x.crossLength=I,x.xy=function(e){return t.evalxy([],i,e)},x.dxy=function(e,r){return t.dxydj([],c,e,u,r)},a=0;a0&&(g=t.dxydj([],c,a-1,u,0),v.push(l[0]+g[0]/3),y.push(l[1]+g[1]/3),m=t.dxydj([],c,a-1,u,1),v.push(f[0]-m[0]/3),y.push(f[1]-m[1]/3)),v.push(f[0]),y.push(f[1]),l=f;return x.axisLetter=e,x.axis=b,x.crossAxis=M,x.value=n,x.constvar=r,x.index=h,x.x=v,x.y=y,x.smoothing=M.smoothing,x}function O(n){var i,a,o,s,l,c=[],u=[],f={};if(f.length=x.length,f.crossLength=k.length,"b"===e)for(o=Math.max(0,Math.min(I-2,n)),l=Math.min(1,Math.max(0,n-o)),f.xy=function(e){return t.evalxy([],e,n)},f.dxy=function(e,r){return t.dxydi([],e,o,r,l)},i=0;ix.length-1||_.push(i(O(o),{color:b.gridcolor,width:b.gridwidth}));for(h=u;hx.length-1||g<0||g>x.length-1))for(m=x[s],v=x[g],a=0;ax[x.length-1]||w.push(i(z(d),{color:b.minorgridcolor,width:b.minorgridwidth}));b.startline&&T.push(i(O(0),{color:b.startlinecolor,width:b.startlinewidth})),b.endline&&T.push(i(O(x.length-1),{color:b.endlinecolor,width:b.endlinewidth}))}else{for(l=5e-15,u=(c=[Math.floor((x[x.length-1]-b.tick0)/b.dtick*(1+l)),Math.ceil((x[0]-b.tick0)/b.dtick/(1+l))].sort((function(t,e){return t-e})))[0],f=c[1],h=u;h<=f;h++)p=b.tick0+b.dtick*h,_.push(i(z(p),{color:b.gridcolor,width:b.gridwidth}));for(h=u-1;hx[x.length-1]||w.push(i(z(d),{color:b.minorgridcolor,width:b.minorgridwidth}));b.startline&&T.push(i(z(x[0]),{color:b.startlinecolor,width:b.startlinewidth})),b.endline&&T.push(i(z(x[x.length-1]),{color:b.endlinecolor,width:b.endlinewidth}))}}},{"../../lib/extend":768,"../../plots/cartesian/axes":827}],970:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e){var r,a,o,s=e._labels=[],l=e._gridlines;for(r=0;re.length&&(t=t.slice(0,e.length)):t=[],i=0;i90&&(p-=180,l=-l),{angle:p,flip:l,p:t.c2p(n,e,r),offsetMultplier:c}}},{}],984:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),a=t("./map_1d_array"),o=t("./makepath"),s=t("./orient_text"),l=t("../../lib/svg_text_utils"),c=t("../../lib"),u=c.strRotate,f=c.strTranslate,h=t("../../constants/alignment");function p(t,e,r,i,s,l){var c="const-"+s+"-lines",u=r.selectAll("."+c).data(l);u.enter().append("path").classed(c,!0).style("vector-effect","non-scaling-stroke"),u.each((function(r){var i=r,s=i.x,l=i.y,c=a([],s,t.c2p),u=a([],l,e.c2p),f="M"+o(c,u,i.smoothing);n.select(this).attr("d",f).style("stroke-width",i.width).style("stroke",i.color).style("fill","none")})),u.exit().remove()}function d(t,e,r,a,o,c,h,p){var d=c.selectAll("text."+p).data(h);d.enter().append("text").classed(p,!0);var g=0,m={};return d.each((function(o,c){var h;if("auto"===o.axis.tickangle)h=s(a,e,r,o.xy,o.dxy);else{var p=(o.axis.tickangle+180)*Math.PI/180;h=s(a,e,r,o.xy,[Math.cos(p),Math.sin(p)])}c||(m={angle:h.angle,flip:h.flip});var d=(o.endAnchor?-1:1)*h.flip,v=n.select(this).attr({"text-anchor":d>0?"start":"end","data-notex":1}).call(i.font,o.font).text(o.text).call(l.convertToTspans,t),y=i.bBox(this);v.attr("transform",f(h.p[0],h.p[1])+u(h.angle)+f(o.axis.labelpadding*d,.3*y.height)),g=Math.max(g,y.width+o.axis.labelpadding)})),d.exit().remove(),m.maxExtent=g,m}e.exports=function(t,e,r,i){var l=e.xaxis,u=e.yaxis,f=t._fullLayout._clips;c.makeTraceGroups(i,r,"trace").each((function(e){var r=n.select(this),i=e[0],h=i.trace,g=h.aaxis,m=h.baxis,y=c.ensureSingle(r,"g","minorlayer"),x=c.ensureSingle(r,"g","majorlayer"),b=c.ensureSingle(r,"g","boundarylayer"),_=c.ensureSingle(r,"g","labellayer");r.style("opacity",h.opacity),p(l,u,x,g,"a",g._gridlines),p(l,u,x,m,"b",m._gridlines),p(l,u,y,g,"a",g._minorgridlines),p(l,u,y,m,"b",m._minorgridlines),p(l,u,b,g,"a-boundary",g._boundarylines),p(l,u,b,m,"b-boundary",m._boundarylines);var w=d(t,l,u,h,i,_,g._labels,"a-label"),T=d(t,l,u,h,i,_,m._labels,"b-label");!function(t,e,r,n,i,a,o,l){var u,f,h,p,d=c.aggNums(Math.min,null,r.a),g=c.aggNums(Math.max,null,r.a),m=c.aggNums(Math.min,null,r.b),y=c.aggNums(Math.max,null,r.b);u=.5*(d+g),f=m,h=r.ab2xy(u,f,!0),p=r.dxyda_rough(u,f),void 0===o.angle&&c.extendFlat(o,s(r,i,a,h,r.dxydb_rough(u,f)));v(t,e,r,n,h,p,r.aaxis,i,a,o,"a-title"),u=d,f=.5*(m+y),h=r.ab2xy(u,f,!0),p=r.dxydb_rough(u,f),void 0===l.angle&&c.extendFlat(l,s(r,i,a,h,r.dxyda_rough(u,f)));v(t,e,r,n,h,p,r.baxis,i,a,l,"b-title")}(t,_,h,i,l,u,w,T),function(t,e,r,n,i){var s,l,u,f,h=r.select("#"+t._clipPathId);h.size()||(h=r.append("clipPath").classed("carpetclip",!0));var p=c.ensureSingle(h,"path","carpetboundary"),d=e.clipsegments,g=[];for(f=0;f90&&y<270,b=n.select(this);b.text(h.title.text).call(l.convertToTspans,t),x&&(_=(-l.lineCount(b)+m)*g*a-_),b.attr("transform",f(e.p[0],e.p[1])+u(e.angle)+f(0,_)).attr("text-anchor","middle").call(i.font,h.title.font)})),b.exit().remove()}},{"../../components/drawing":665,"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"./makepath":981,"./map_1d_array":982,"./orient_text":983,d3:169}],985:[function(t,e,r){"use strict";var n=t("./constants"),i=t("../../lib/search").findBin,a=t("./compute_control_points"),o=t("./create_spline_evaluator"),s=t("./create_i_derivative_evaluator"),l=t("./create_j_derivative_evaluator");e.exports=function(t){var e=t._a,r=t._b,c=e.length,u=r.length,f=t.aaxis,h=t.baxis,p=e[0],d=e[c-1],g=r[0],m=r[u-1],v=e[e.length-1]-e[0],y=r[r.length-1]-r[0],x=v*n.RELATIVE_CULL_TOLERANCE,b=y*n.RELATIVE_CULL_TOLERANCE;p-=x,d+=x,g-=b,m+=b,t.isVisible=function(t,e){return t>p&&tg&&ed||em},t.setScale=function(){var e=t._x,r=t._y,n=a(t._xctrl,t._yctrl,e,r,f.smoothing,h.smoothing);t._xctrl=n[0],t._yctrl=n[1],t.evalxy=o([t._xctrl,t._yctrl],c,u,f.smoothing,h.smoothing),t.dxydi=s([t._xctrl,t._yctrl],f.smoothing,h.smoothing),t.dxydj=l([t._xctrl,t._yctrl],f.smoothing,h.smoothing)},t.i2a=function(t){var r=Math.max(0,Math.floor(t[0]),c-2),n=t[0]-r;return(1-n)*e[r]+n*e[r+1]},t.j2b=function(t){var e=Math.max(0,Math.floor(t[1]),c-2),n=t[1]-e;return(1-n)*r[e]+n*r[e+1]},t.ij2ab=function(e){return[t.i2a(e[0]),t.j2b(e[1])]},t.a2i=function(t){var r=Math.max(0,Math.min(i(t,e),c-2)),n=e[r],a=e[r+1];return Math.max(0,Math.min(c-1,r+(t-n)/(a-n)))},t.b2j=function(t){var e=Math.max(0,Math.min(i(t,r),u-2)),n=r[e],a=r[e+1];return Math.max(0,Math.min(u-1,e+(t-n)/(a-n)))},t.ab2ij=function(e){return[t.a2i(e[0]),t.b2j(e[1])]},t.i2c=function(e,r){return t.evalxy([],e,r)},t.ab2xy=function(n,i,a){if(!a&&(ne[c-1]|ir[u-1]))return[!1,!1];var o=t.a2i(n),s=t.b2j(i),l=t.evalxy([],o,s);if(a){var f,h,p,d,g=0,m=0,v=[];ne[c-1]?(f=c-2,h=1,g=(n-e[c-1])/(e[c-1]-e[c-2])):h=o-(f=Math.max(0,Math.min(c-2,Math.floor(o)))),ir[u-1]?(p=u-2,d=1,m=(i-r[u-1])/(r[u-1]-r[u-2])):d=s-(p=Math.max(0,Math.min(u-2,Math.floor(s)))),g&&(t.dxydi(v,f,p,h,d),l[0]+=v[0]*g,l[1]+=v[1]*g),m&&(t.dxydj(v,f,p,h,d),l[0]+=v[0]*m,l[1]+=v[1]*m)}return l},t.c2p=function(t,e,r){return[e.c2p(t[0]),r.c2p(t[1])]},t.p2x=function(t,e,r){return[e.p2c(t[0]),r.p2c(t[1])]},t.dadi=function(t){var r=Math.max(0,Math.min(e.length-2,t));return e[r+1]-e[r]},t.dbdj=function(t){var e=Math.max(0,Math.min(r.length-2,t));return r[e+1]-r[e]},t.dxyda=function(e,r,n,i){var a=t.dxydi(null,e,r,n,i),o=t.dadi(e,n);return[a[0]/o,a[1]/o]},t.dxydb=function(e,r,n,i){var a=t.dxydj(null,e,r,n,i),o=t.dbdj(r,i);return[a[0]/o,a[1]/o]},t.dxyda_rough=function(e,r,n){var i=v*(n||.1),a=t.ab2xy(e+i,r,!0),o=t.ab2xy(e-i,r,!0);return[.5*(a[0]-o[0])/i,.5*(a[1]-o[1])/i]},t.dxydb_rough=function(e,r,n){var i=y*(n||.1),a=t.ab2xy(e,r+i,!0),o=t.ab2xy(e,r-i,!0);return[.5*(a[0]-o[0])/i,.5*(a[1]-o[1])/i]},t.dpdx=function(t){return t._m},t.dpdy=function(t){return t._m}}},{"../../lib/search":797,"./compute_control_points":973,"./constants":974,"./create_i_derivative_evaluator":975,"./create_j_derivative_evaluator":976,"./create_spline_evaluator":977}],986:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a,o,s=[],l=[],c=t[0].length,u=t.length;function f(e,r){var n,i=0,a=0;return e>0&&void 0!==(n=t[r][e-1])&&(a++,i+=n),e0&&void 0!==(n=t[r-1][e])&&(a++,i+=n),r0&&a0&&i1e-5);return n.log("Smoother converged to",k,"after",M,"iterations"),t}},{"../../lib":778}],987:[function(t,e,r){"use strict";var n=t("../../lib").isArray1D;e.exports=function(t,e,r){var i=r("x"),a=i&&i.length,o=r("y"),s=o&&o.length;if(!a&&!s)return!1;if(e._cheater=!i,a&&!n(i)||s&&!n(o))e._length=null;else{var l=a?i.length:1/0;s&&(l=Math.min(l,o.length)),e.a&&e.a.length&&(l=Math.min(l,e.a.length)),e.b&&e.b.length&&(l=Math.min(l,e.b.length)),e._length=l}return!0}},{"../../lib":778}],988:[function(t,e,r){"use strict";var n=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../scattergeo/attributes"),a=t("../../components/colorscale/attributes"),o=t("../../plots/attributes"),s=t("../../components/color/attributes").defaultLine,l=t("../../lib/extend").extendFlat,c=i.marker.line;e.exports=l({locations:{valType:"data_array",editType:"calc"},locationmode:i.locationmode,z:{valType:"data_array",editType:"calc"},geojson:l({},i.geojson,{}),featureidkey:i.featureidkey,text:l({},i.text,{}),hovertext:l({},i.hovertext,{}),marker:{line:{color:l({},c.color,{dflt:s}),width:l({},c.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:i.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:i.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:l({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]}),hovertemplate:n(),showlegend:l({},o.showlegend,{dflt:!1})},a("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/color/attributes":642,"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scattergeo/attributes":1228}],989:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../constants/numerical").BADNUM,a=t("../../components/colorscale/calc"),o=t("../scatter/arrays_to_calcdata"),s=t("../scatter/calc_selection");function l(t){return t&&"string"==typeof t}e.exports=function(t,e){var r,c=e._length,u=new Array(c);r=e.geojson?function(t){return l(t)||n(t)}:l;for(var f=0;f")}(t,f,o),[t]}},{"../../lib":778,"../../plots/cartesian/axes":827,"./attributes":988}],993:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../heatmap/colorbar"),calc:t("./calc"),calcGeoJSON:t("./plot").calcGeoJSON,plot:t("./plot").plot,style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"choropleth",basePlotModule:t("../../plots/geo"),categories:["geo","noOpacity","showLegend"],meta:{}}},{"../../plots/geo":859,"../heatmap/colorbar":1067,"./attributes":988,"./calc":989,"./defaults":990,"./event_data":991,"./hover":992,"./plot":994,"./select":995,"./style":996}],994:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../lib/geo_location_utils"),o=t("../../lib/topojson_utils").getTopojsonFeatures,s=t("../../plots/cartesian/autorange").findExtremes,l=t("./style").style;e.exports={calcGeoJSON:function(t,e){for(var r=t[0].trace,n=e[r.geo],i=n._subplot,l=r.locationmode,c=r._length,u="geojson-id"===l?a.extractTraceFeature(t):o(r,i.topojson),f=[],h=[],p=0;p=0;n--){var i=r[n].id;if("string"==typeof i&&0===i.indexOf("water"))for(var a=n+1;a=0;r--)t.removeLayer(e[r][1])},s.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},e.exports=function(t,e){var r=e[0].trace,i=new o(t,r.uid),a=i.sourceId,s=n(e),l=i.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(a,{type:"geojson",data:s.geojson}),i._addLayers(s,l),e[0].trace._glTrace=i,i}},{"../../plots/mapbox/constants":882,"./convert":998}],1002:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l={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:i({editType:"calc"},{keys:["norm"]}),showlegend:s({},o.showlegend,{dflt:!1})};s(l,n("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}));["opacity","lightposition","lighting"].forEach((function(t){l[t]=a[t]})),l.hoverinfo=s({},o.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","text","name"],dflt:"x+y+z+norm+text+name"}),l.transforms=void 0,e.exports=l},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../mesh3d/attributes":1127}],1003:[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,c=0;co.level||o.starts.length&&a===o.level)}break;case"constraint":if(n.prefixBoundary=!1,n.edgepaths.length)return;var s=n.x.length,l=n.y.length,c=-1/0,u=1/0;for(r=0;r":p>c&&(n.prefixBoundary=!0);break;case"<":(pc||n.starts.length&&h===u)&&(n.prefixBoundary=!0);break;case"][":f=Math.min(p[0],p[1]),h=Math.max(p[0],p[1]),fc&&(n.prefixBoundary=!0)}}}},{}],1010:[function(t,e,r){"use strict";var n=t("../../components/colorscale"),i=t("./make_color_map"),a=t("./end_plus");e.exports={min:"zmin",max:"zmax",calc:function(t,e,r){var o=e.contours,s=e.line,l=o.size||1,c=o.coloring,u=i(e,{isColorbar:!0});if("heatmap"===c){var f=n.extractOpts(e);r._fillgradient=f.reversescale?n.flipScale(f.colorscale):f.colorscale,r._zrange=[f.min,f.max]}else"fill"===c&&(r._fillcolor=u);r._line={color:"lines"===c?u:s.color,width:!1!==o.showlines?s.width:0,dash:s.dash},r._levels={start:o.start,end:a(o),size:l}}}},{"../../components/colorscale":655,"./end_plus":1018,"./make_color_map":1023}],1011:[function(t,e,r){"use strict";e.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],1012:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./label_defaults"),a=t("../../components/color"),o=a.addOpacity,s=a.opacity,l=t("../../constants/filter_ops"),c=l.CONSTRAINT_REDUCTION,u=l.COMPARISON_OPS2;e.exports=function(t,e,r,a,l,f){var h,p,d,g=e.contours,m=r("contours.operation");(g._operation=c[m],function(t,e){var r;-1===u.indexOf(e.operation)?(t("contours.value",[0,1]),Array.isArray(e.value)?e.value.length>2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:n(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),n(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0))}(r,g),"="===m?h=g.showlines=!0:(h=r("contours.showlines"),d=r("fillcolor",o((t.line||{}).color||l,.5))),h)&&(p=r("line.color",d&&s(d)?o(e.fillcolor,1):l),r("line.width",2),r("line.dash"));r("line.smoothing"),i(r,a,p,f)}},{"../../components/color":643,"../../constants/filter_ops":749,"./label_defaults":1022,"fast-isnumeric":241}],1013:[function(t,e,r){"use strict";var n=t("../../constants/filter_ops"),i=t("fast-isnumeric");function a(t,e){var r,a=Array.isArray(e);function o(t){return i(t)?+t:null}return-1!==n.COMPARISON_OPS2.indexOf(t)?r=o(a?e[0]:e):-1!==n.INTERVAL_OPS.indexOf(t)?r=a?[o(e[0]),o(e[1])]:[o(e),o(e)]:-1!==n.SET_OPS.indexOf(t)&&(r=a?e.map(o):[o(e)]),r}function o(t){return function(e){e=a(t,e);var r=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return{start:r,end:n,size:n-r}}}function s(t){return function(e){return{start:e=a(t,e),end:1/0,size:1/0}}}e.exports={"[]":o("[]"),"][":o("]["),">":s(">"),"<":s("<"),"=":s("=")}},{"../../constants/filter_ops":749,"fast-isnumeric":241}],1014:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=n("contours.start"),a=n("contours.end"),o=!1===i||!1===a,s=r("contours.size");!(o?e.autocontour=!0:r("autocontour",!1))&&s||r("ncontours")}},{}],1015:[function(t,e,r){"use strict";var n=t("../../lib");function i(t){return n.extendFlat({},t,{edgepaths:n.extendDeep([],t.edgepaths),paths:n.extendDeep([],t.paths),starts:n.extendDeep([],t.starts)})}e.exports=function(t,e){var r,a,o,s=function(t){return t.reverse()},l=function(t){return t};switch(e){case"=":case"<":return t;case">":for(1!==t.length&&n.warn("Contour data invalid for the specified inequality operation."),a=t[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",t);break}return l}},{"../../lib":778,"./constraint_mapping":1013,"./end_plus":1018}],1018:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],1019:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./constants");function a(t,e,r,n){return Math.abs(t[0]-e[0])20&&e?208===t||1114===t?n=0===r[0]?1:-1:a=0===r[1]?1:-1:-1!==i.BOTTOMSTART.indexOf(t)?a=1:-1!==i.LEFTSTART.indexOf(t)?n=1:-1!==i.TOPSTART.indexOf(t)?a=-1:n=-1;return[n,a]}(f,r,e),p=[s(t,e,[-h[0],-h[1]])],d=t.z.length,g=t.z[0].length,m=e.slice(),v=h.slice();for(c=0;c<1e4;c++){if(f>20?(f=i.CHOOSESADDLE[f][(h[0]||h[1])<0?0:1],t.crossings[u]=i.SADDLEREMAINDER[f]):delete t.crossings[u],!(h=i.NEWDELTA[f])){n.log("Found bad marching index:",f,e,t.level);break}p.push(s(t,e,h)),e[0]+=h[0],e[1]+=h[1],u=e.join(","),a(p[p.length-1],p[p.length-2],o,l)&&p.pop();var y=h[0]&&(e[0]<0||e[0]>g-2)||h[1]&&(e[1]<0||e[1]>d-2);if(e[0]===m[0]&&e[1]===m[1]&&h[0]===v[0]&&h[1]===v[1]||r&&y)break;f=t.crossings[u]}1e4===c&&n.log("Infinite loop in contour?");var x,b,_,w,T,k,M,A,S,E,C,L,I,P,z,O=a(p[0],p[p.length-1],o,l),D=0,R=.2*t.smoothing,F=[],B=0;for(c=1;c=B;c--)if((x=F[c])=B&&x+F[b]A&&S--,t.edgepaths[S]=C.concat(p,E));break}V||(t.edgepaths[A]=p.concat(E))}for(A=0;At?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);return 5===r||10===r?t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208:15===r?0:r}e.exports=function(t){var e,r,a,o,s,l,c,u,f,h=t[0].z,p=h.length,d=h[0].length,g=2===p||2===d;for(r=0;r=0&&(n=y,s=l):Math.abs(r[1]-n[1])<.01?Math.abs(r[1]-y[1])<.01&&(y[0]-r[0])*(n[0]-y[0])>=0&&(n=y,s=l):i.log("endpt to newendpt is not vert. or horz.",r,n,y)}if(r=n,s>=0)break;f+="L"+n}if(s===t.edgepaths.length){i.log("unclosed perimeter path");break}h=s,(d=-1===p.indexOf(h))&&(h=p[0],f+="Z")}for(h=0;hn.center?n.right-s:s-n.left)/(u+Math.abs(Math.sin(c)*o)),p=(l>n.middle?n.bottom-l:l-n.top)/(Math.abs(f)+Math.cos(c)*o);if(h<1||p<1)return 1/0;var d=v.EDGECOST*(1/(h-1)+1/(p-1));d+=v.ANGLECOST*c*c;for(var g=s-u,m=l-f,y=s+u,x=l+f,b=0;b2*v.MAXCOST)break;p&&(s/=2),l=(o=c-s/2)+1.5*s}if(h<=v.MAXCOST)return u},r.addLabelData=function(t,e,r,n){var i=e.fontSize,a=e.width+i/3,o=Math.max(0,e.height-i/3),s=t.x,l=t.y,c=t.theta,u=Math.sin(c),f=Math.cos(c),h=function(t,e){return[s+t*f-e*u,l+t*u+e*f]},p=[h(-a/2,-o/2),h(-a/2,o/2),h(a/2,o/2),h(a/2,-o/2)];r.push({text:e.text,x:s,y:l,dy:e.dy,theta:c,level:e.level,width:a,height:o}),n.push(p)},r.drawLabels=function(t,e,r,a,o){var l=t.selectAll("text").data(e,(function(t){return t.text+","+t.x+","+t.y+","+t.theta}));if(l.exit().remove(),l.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each((function(t){var e=t.x+Math.sin(t.theta)*t.dy,i=t.y-Math.cos(t.theta)*t.dy;n.select(this).text(t.text).attr({x:e,y:i,transform:"rotate("+180*t.theta/Math.PI+" "+e+" "+i+")"}).call(s.convertToTspans,r)})),o){for(var c="",u=0;ur.end&&(r.start=r.end=(r.start+r.end)/2),t._input.contours||(t._input.contours={}),i.extendFlat(t._input.contours,{start:r.start,end:r.end,size:r.size}),t._input.autocontour=!0}else if("constraint"!==r.type){var c,u=r.start,f=r.end,h=t._input.contours;if(u>f&&(r.start=h.start=f,f=r.end=h.end=u,u=r.start),!(r.size>0))c=u===f?1:a(u,f,t.ncontours).dtick,h.size=r.size=c}}},{"../../lib":778,"../../plots/cartesian/axes":827}],1027:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),a=t("../heatmap/style"),o=t("./make_color_map");e.exports=function(t){var e=n.select(t).selectAll("g.contour");e.style("opacity",(function(t){return t[0].trace.opacity})),e.each((function(t){var e=n.select(this),r=t[0].trace,a=r.contours,s=r.line,l=a.size||1,c=a.start,u="constraint"===a.type,f=!u&&"lines"===a.coloring,h=!u&&"fill"===a.coloring,p=f||h?o(r):null;e.selectAll("g.contourlevel").each((function(t){n.select(this).selectAll("path").call(i.lineGroupStyle,s.width,f?p(t.level):s.color,s.dash)}));var d=a.labelfont;if(e.selectAll("g.contourlabels text").each((function(t){i.font(n.select(this),{family:d.family,size:d.size,color:d.color||(f?p(t.level):s.color)})})),u)e.selectAll("g.contourfill path").style("fill",r.fillcolor);else if(h){var g;e.selectAll("g.contourfill path").style("fill",(function(t){return void 0===g&&(g=t.level),p(t.level+.5*l)})),void 0===g&&(g=c),e.selectAll("g.contourbg path").style("fill",p(g-.5*l))}})),a(t)}},{"../../components/drawing":665,"../heatmap/style":1076,"./make_color_map":1023,d3:169}],1028:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults"),i=t("./label_defaults");e.exports=function(t,e,r,a,o){var s,l=r("contours.coloring"),c="";"fill"===l&&(s=r("contours.showlines")),!1!==s&&("lines"!==l&&(c=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==l&&(!0!==t.showlegend&&(e.showlegend=!1),e._dfltShowLegend=!1,n(t,e,a,r,{prefix:"",cLetter:"z"})),r("line.smoothing"),i(r,a,c,o)}},{"../../components/colorscale/defaults":653,"./label_defaults":1022}],1029:[function(t,e,r){"use strict";var n=t("../heatmap/attributes"),i=t("../contour/attributes"),a=t("../../components/colorscale/attributes"),o=t("../../lib/extend").extendFlat,s=i.contours;e.exports=o({carpet:{valType:"string",editType:"calc"},z:n.z,a:n.x,a0:n.x0,da:n.dx,b:n.y,b0:n.y0,db:n.dy,text:n.text,hovertext:n.hovertext,transpose:n.transpose,atype:n.xtype,btype:n.ytype,fillcolor:i.fillcolor,autocontour:i.autocontour,ncontours:i.ncontours,contours:{type:s.type,start:s.start,end:s.end,size:s.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:s.showlines,showlabels:s.showlabels,labelfont:s.labelfont,labelformat:s.labelformat,operation:s.operation,value:s.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:i.line.color,width:i.line.width,dash:i.line.dash,smoothing:i.line.smoothing,editType:"plot"},transforms:void 0},a("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../contour/attributes":1007,"../heatmap/attributes":1064}],1030:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc"),i=t("../../lib"),a=t("../heatmap/convert_column_xyz"),o=t("../heatmap/clean_2d_array"),s=t("../heatmap/interp2d"),l=t("../heatmap/find_empties"),c=t("../heatmap/make_bound_array"),u=t("./defaults"),f=t("../carpet/lookup_carpetid"),h=t("../contour/set_contours");e.exports=function(t,e){var r=e._carpetTrace=f(t,e);if(r&&r.visible&&"legendonly"!==r.visible){if(!e.a||!e.b){var p=t.data[r.index],d=t.data[e.index];d.a||(d.a=p.a),d.b||(d.b=p.b),u(d,e,e._defaultColor,t._fullLayout)}var g=function(t,e){var r,u,f,h,p,d,g,m=e._carpetTrace,v=m.aaxis,y=m.baxis;v._minDtick=0,y._minDtick=0,i.isArray1D(e.z)&&a(e,v,y,"a","b",["z"]);r=e._a=e._a||e.a,h=e._b=e._b||e.b,r=r?v.makeCalcdata(e,"_a"):[],h=h?y.makeCalcdata(e,"_b"):[],u=e.a0||0,f=e.da||1,p=e.b0||0,d=e.db||1,g=e._z=o(e._z||e.z,e.transpose),e._emptypoints=l(g),s(g,e._emptypoints);var x=i.maxRowLength(g),b="scaled"===e.xtype?"":r,_=c(e,b,u,f,x,v),w="scaled"===e.ytype?"":h,T=c(e,w,p,d,g.length,y),k={a:_,b:T,z:g};"levels"===e.contours.type&&"none"!==e.contours.coloring&&n(t,e,{vals:g,containerStr:"",cLetter:"z"});return[k]}(t,e);return h(e,e._z),g}}},{"../../components/colorscale/calc":651,"../../lib":778,"../carpet/lookup_carpetid":980,"../contour/set_contours":1026,"../heatmap/clean_2d_array":1066,"../heatmap/convert_column_xyz":1068,"../heatmap/find_empties":1070,"../heatmap/interp2d":1073,"../heatmap/make_bound_array":1074,"./defaults":1031}],1031:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../heatmap/xyz_defaults"),a=t("./attributes"),o=t("../contour/constraint_defaults"),s=t("../contour/contours_defaults"),l=t("../contour/style_defaults");e.exports=function(t,e,r,c){function u(r,i){return n.coerce(t,e,a,r,i)}if(u("carpet"),t.a&&t.b){if(!i(t,e,u,c,"a","b"))return void(e.visible=!1);u("text"),"constraint"===u("contours.type")?o(t,e,u,c,r,{hasHover:!1}):(s(t,e,u,(function(r){return n.coerce2(t,e,a,r)})),l(t,e,u,c,{hasHover:!1}))}else e._defaultColor=r,e._length=null}},{"../../lib":778,"../contour/constraint_defaults":1012,"../contour/contours_defaults":1014,"../contour/style_defaults":1028,"../heatmap/xyz_defaults":1078,"./attributes":1029}],1032:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../contour/colorbar"),calc:t("./calc"),plot:t("./plot"),style:t("../contour/style"),moduleType:"trace",name:"contourcarpet",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","carpet","contour","symbols","showLegend","hasLines","carpetDependent","noHover","noSortingByValue"],meta:{}}},{"../../plots/cartesian":840,"../contour/colorbar":1010,"../contour/style":1027,"./attributes":1029,"./calc":1030,"./defaults":1031,"./plot":1033}],1033:[function(t,e,r){"use strict";var n=t("d3"),i=t("../carpet/map_1d_array"),a=t("../carpet/makepath"),o=t("../../components/drawing"),s=t("../../lib"),l=t("../contour/make_crossings"),c=t("../contour/find_all_paths"),u=t("../contour/plot"),f=t("../contour/constants"),h=t("../contour/convert_to_constraints"),p=t("../contour/empty_pathinfo"),d=t("../contour/close_boundaries"),g=t("../carpet/lookup_carpetid"),m=t("../carpet/axis_aligned_line");function v(t,e,r){var n=t.getPointAtLength(e),i=t.getPointAtLength(r),a=i.x-n.x,o=i.y-n.y,s=Math.sqrt(a*a+o*o);return[a/s,o/s]}function y(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}function x(t,e){var r=Math.abs(t[0]*e[0]+t[1]*e[1]);return Math.sqrt(1-r*r)/r}e.exports=function(t,e,r,b){var _=e.xaxis,w=e.yaxis;s.makeTraceGroups(b,r,"contour").each((function(r){var b=n.select(this),T=r[0],k=T.trace,M=k._carpetTrace=g(t,k),A=t.calcdata[M.index][0];if(M.visible&&"legendonly"!==M.visible){var S=T.a,E=T.b,C=k.contours,L=p(C,e,T),I="constraint"===C.type,P=C._operation,z=I?"="===P?"lines":"fill":C.coloring,O=[[S[0],E[E.length-1]],[S[S.length-1],E[E.length-1]],[S[S.length-1],E[0]],[S[0],E[0]]];l(L);var D=1e-8*(S[S.length-1]-S[0]),R=1e-8*(E[E.length-1]-E[0]);c(L,D,R);var F,B,N,j,U=L;"constraint"===C.type&&(U=h(L,P)),function(t,e){var r,n,i,a,o,s,l,c,u;for(r=0;r=0;j--)F=A.clipsegments[j],B=i([],F.x,_.c2p),N=i([],F.y,w.c2p),B.reverse(),N.reverse(),V.push(a(B,N,F.bicubic));var q="M"+V.join("L")+"Z";!function(t,e,r,n,o,l){var c,u,f,h,p=s.ensureSingle(t,"g","contourbg").selectAll("path").data("fill"!==l||o?[]:[0]);p.enter().append("path"),p.exit().remove();var d=[];for(h=0;h=0&&(h=C,d=g):Math.abs(f[1]-h[1])=0&&(h=C,d=g):s.log("endpt to newendpt is not vert. or horz.",f,h,C)}if(d>=0)break;y+=S(f,h),f=h}if(d===e.edgepaths.length){s.log("unclosed perimeter path");break}u=d,(b=-1===x.indexOf(u))&&(u=x[0],y+=S(f,h)+"Z",f=null)}for(u=0;um&&(n.max=m);n.len=n.max-n.min}(this,r,t,n,c,e.height),!(n.len<(e.width+e.height)*f.LABELMIN)))for(var i=Math.min(Math.ceil(n.len/P),f.LABELMAX),a=0;a0?+p[u]:0),f.push({type:"Feature",geometry:{type:"Point",coordinates:v},properties:y})}}var b=o.extractOpts(e),_=b.reversescale?o.flipScale(b.colorscale):b.colorscale,w=_[0][1],T=["interpolate",["linear"],["heatmap-density"],0,a.opacity(w)<1?w:a.addOpacity(w,0)];for(u=1;u<_.length;u++)T.push(_[u][0],_[u][1]);var k=["interpolate",["linear"],["get","z"],b.min,0,b.max,1];return i.extendFlat(c.heatmap.paint,{"heatmap-weight":d?k:1/(b.max-b.min),"heatmap-color":T,"heatmap-radius":g?{type:"identity",property:"r"}:e.radius,"heatmap-opacity":e.opacity}),c.geojson={type:"FeatureCollection",features:f},c.heatmap.layout.visibility="visible",c}},{"../../components/color":643,"../../components/colorscale":655,"../../constants/numerical":753,"../../lib":778,"../../lib/geojson_utils":772,"fast-isnumeric":241}],1037:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}var l=s("lon")||[],c=s("lat")||[],u=Math.min(l.length,c.length);u?(e._length=u,s("z"),s("radius"),s("below"),s("text"),s("hovertext"),s("hovertemplate"),i(t,e,o,s,{prefix:"",cLetter:"z"})):e.visible=!1}},{"../../components/colorscale/defaults":653,"../../lib":778,"./attributes":1034}],1038:[function(t,e,r){"use strict";e.exports=function(t,e){return t.lon=e.lon,t.lat=e.lat,t.z=e.z,t}},{}],1039:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("../scattermapbox/hover");e.exports=function(t,e,r){var o=a(t,e,r);if(o){var s=o[0],l=s.cd,c=l[0].trace,u=l[s.index];if(delete s.color,"z"in u){var f=s.subplot.mockAxis;s.z=u.z,s.zLabel=i.tickText(f,f.c2l(u.z),"hover").text}return s.extraText=function(t,e,r){if(t.hovertemplate)return;var i=(e.hi||t.hoverinfo).split("+"),a=-1!==i.indexOf("all"),o=-1!==i.indexOf("lon"),s=-1!==i.indexOf("lat"),l=e.lonlat,c=[];function u(t){return t+"\xb0"}a||o&&s?c.push("("+u(l[0])+", "+u(l[1])+")"):o?c.push(r.lon+u(l[0])):s&&c.push(r.lat+u(l[1]));(a||-1!==i.indexOf("text"))&&n.fillText(e,t,c);return c.join("
")}(c,u,l[0].t.labels),[s]}}},{"../../lib":778,"../../plots/cartesian/axes":827,"../scattermapbox/hover":1256}],1040:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../heatmap/colorbar"),formatLabels:t("../scattermapbox/format_labels"),calc:t("./calc"),plot:t("./plot"),hoverPoints:t("./hover"),eventData:t("./event_data"),getBelow:function(t,e){for(var r=e.getMapLayers(),n=0;n=0;r--)t.removeLayer(e[r][1])},o.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},e.exports=function(t,e){var r=e[0].trace,i=new a(t,r.uid),o=i.sourceId,s=n(e),l=i.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(o,{type:"geojson",data:s.geojson}),i._addLayers(s,l),i}},{"../../plots/mapbox/constants":882,"./convert":1036}],1042:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;r"),s.color=function(t,e){var r=t.marker,i=e.mc||r.color,a=e.mlc||r.line.color,o=e.mlw||r.line.width;if(n(i))return i;if(n(a)&&o)return a}(c,f),[s]}}},{"../../components/color":643,"../../lib":778,"../bar/hover":927}],1050:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style").style,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("../bar/select"),moduleType:"trace",name:"funnel",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":840,"../bar/select":932,"./attributes":1043,"./calc":1044,"./cross_trace_calc":1046,"./defaults":1047,"./event_data":1048,"./hover":1049,"./layout_attributes":1051,"./layout_defaults":1052,"./plot":1053,"./style":1054}],1051:[function(t,e,r){"use strict";e.exports={funnelmode:{valType:"enumerated",values:["stack","group","overlay"],dflt:"stack",editType:"calc"},funnelgap:{valType:"number",min:0,max:1,editType:"calc"},funnelgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],1052:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r){var a=!1;function o(r,a){return n.coerce(t,e,i,r,a)}for(var s=0;s path").each((function(t){if(!t.isBlank){var e=s.marker;n.select(this).call(a.fill,t.mc||e.color).call(a.stroke,t.mlc||e.line.color).call(i.dashLine,e.line.dash,t.mlw||e.line.width).style("opacity",s.selectedpoints&&!t.selected?o:1)}})),c(r,s,t),r.selectAll(".regions").each((function(){n.select(this).selectAll("path").style("stroke-width",0).call(a.fill,s.connector.fillcolor)})),r.selectAll(".lines").each((function(){var t=s.connector.line;i.lineGroupStyle(n.select(this).selectAll("path"),t.width,t.color,t.dash)}))}))}}},{"../../components/color":643,"../../components/drawing":665,"../../constants/interactions":752,"../bar/style":934,"../bar/uniform_text":936,d3:169}],1055:[function(t,e,r){"use strict";var n=t("../pie/attributes"),i=t("../../plots/attributes"),a=t("../../plots/domain").attributes,o=t("../../plots/template_attributes").hovertemplateAttrs,s=t("../../plots/template_attributes").texttemplateAttrs,l=t("../../lib/extend").extendFlat;e.exports={labels:n.labels,label0:n.label0,dlabel:n.dlabel,values:n.values,marker:{colors:n.marker.colors,line:{color:l({},n.marker.line.color,{dflt:null}),width:l({},n.marker.line.width,{dflt:1}),editType:"calc"},editType:"calc"},text:n.text,hovertext:n.hovertext,scalegroup:l({},n.scalegroup,{}),textinfo:l({},n.textinfo,{flags:["label","text","value","percent"]}),texttemplate:s({editType:"plot"},{keys:["label","color","value","text","percent"]}),hoverinfo:l({},i.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:o({},{keys:["label","color","value","text","percent"]}),textposition:l({},n.textposition,{values:["inside","none"],dflt:"inside"}),textfont:n.textfont,insidetextfont:n.insidetextfont,title:{text:n.title.text,font:n.title.font,position:l({},n.title.position,{values:["top left","top center","top right"],dflt:"top center"}),editType:"plot"},domain:a({name:"funnelarea",trace:!0,editType:"calc"}),aspectratio:{valType:"number",min:0,dflt:1,editType:"plot"},baseratio:{valType:"number",min:0,max:1,dflt:.333,editType:"plot"}}},{"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/template_attributes":905,"../pie/attributes":1160}],1056:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.name="funnelarea",r.plot=function(t,e,i,a){n.plotBasePlot(r.name,t,e,i,a)},r.clean=function(t,e,i,a){n.cleanBasePlot(r.name,t,e,i,a)}},{"../../plots/plots":890}],1057:[function(t,e,r){"use strict";var n=t("../pie/calc");e.exports={calc:function(t,e){return n.calc(t,e)},crossTraceCalc:function(t){n.crossTraceCalc(t,{type:"funnelarea"})}}},{"../pie/calc":1162}],1058:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../plots/domain").defaults,o=t("../bar/defaults").handleText,s=t("../pie/defaults").handleLabelsAndValues;e.exports=function(t,e,r,l){function c(r,a){return n.coerce(t,e,i,r,a)}var u=c("labels"),f=c("values"),h=s(u,f),p=h.len;if(e._hasLabels=h.hasLabels,e._hasValues=h.hasValues,!e._hasLabels&&e._hasValues&&(c("label0"),c("dlabel")),p){e._length=p,c("marker.line.width")&&c("marker.line.color",l.paper_bgcolor),c("marker.colors"),c("scalegroup");var d,g=c("text"),m=c("texttemplate");if(m||(d=c("textinfo",Array.isArray(g)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),m||d&&"none"!==d){var v=c("textposition");o(t,e,l,c,v,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1})}a(e,l,c),c("title.text")&&(c("title.position"),n.coerceFont(c,"title.font",l.font)),c("aspectratio"),c("baseratio")}else e.visible=!1}},{"../../lib":778,"../../plots/domain":854,"../bar/defaults":924,"../pie/defaults":1163,"./attributes":1055}],1059:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"funnelarea",basePlotModule:t("./base_plot"),categories:["pie-like","funnelarea","showLegend"],attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),style:t("./style"),styleOne:t("../pie/style_one"),meta:{}}},{"../pie/style_one":1171,"./attributes":1055,"./base_plot":1056,"./calc":1057,"./defaults":1058,"./layout_attributes":1060,"./layout_defaults":1061,"./plot":1062,"./style":1063}],1060:[function(t,e,r){"use strict";var n=t("../pie/layout_attributes").hiddenlabels;e.exports={hiddenlabels:n,funnelareacolorway:{valType:"colorlist",editType:"calc"},extendfunnelareacolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{"../pie/layout_attributes":1167}],1061:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,a){return n.coerce(t,e,i,r,a)}r("hiddenlabels"),r("funnelareacolorway",e.colorway),r("extendfunnelareacolors")}},{"../../lib":778,"./layout_attributes":1060}],1062:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),a=t("../../lib"),o=a.strScale,s=a.strTranslate,l=t("../../lib/svg_text_utils"),c=t("../bar/plot").toMoveInsideBar,u=t("../bar/uniform_text"),f=u.recordMinTextSize,h=u.clearMinTextSize,p=t("../pie/helpers"),d=t("../pie/plot"),g=d.attachFxHandlers,m=d.determineInsideTextFont,v=d.layoutAreas,y=d.prerenderTitles,x=d.positionTitleOutside,b=d.formatSliceLabel;function _(t,e){return"l"+(e[0]-t[0])+","+(e[1]-t[1])}e.exports=function(t,e){var r=t._fullLayout;h("funnelarea",r),y(e,t),v(e,r._size),a.makeTraceGroups(r._funnelarealayer,e,"trace").each((function(e){var u=n.select(this),h=e[0],d=h.trace;!function(t){if(!t.length)return;var e=t[0],r=e.trace,n=r.aspectratio,i=r.baseratio;i>.999&&(i=.999);var a,o=Math.pow(i,2),s=e.vTotal,l=s,c=s*o/(1-o)/s;function u(){var t,e={x:t=Math.sqrt(c),y:-t};return[e.x,e.y]}var f,h,p=[];for(p.push(u()),f=t.length-1;f>-1;f--)if(!(h=t[f]).hidden){var d=h.v/l;c+=d,p.push(u())}var g=1/0,m=-1/0;for(f=0;f-1;f--)if(!(h=t[f]).hidden){var M=p[k+=1][0],A=p[k][1];h.TL=[-M,A],h.TR=[M,A],h.BL=w,h.BR=T,h.pxmid=(S=h.TR,E=h.BR,[.5*(S[0]+E[0]),.5*(S[1]+E[1])]),w=h.TL,T=h.TR}var S,E}(e),u.each((function(){var u=n.select(this).selectAll("g.slice").data(e);u.enter().append("g").classed("slice",!0),u.exit().remove(),u.each((function(o,s){if(o.hidden)n.select(this).selectAll("path,g").remove();else{o.pointNumber=o.i,o.curveNumber=d.index;var u=h.cx,v=h.cy,y=n.select(this),x=y.selectAll("path.surface").data([o]);x.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),y.call(g,t,e);var w="M"+(u+o.TR[0])+","+(v+o.TR[1])+_(o.TR,o.BR)+_(o.BR,o.BL)+_(o.BL,o.TL)+"Z";x.attr("d",w),b(t,o,h);var T=p.castOption(d.textposition,o.pts),k=y.selectAll("g.slicetext").data(o.text&&"none"!==T?[0]:[]);k.enter().append("g").classed("slicetext",!0),k.exit().remove(),k.each((function(){var h=a.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),p=a.ensureUniformFontSize(t,m(d,o,r.font));h.text(o.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(i.font,p).call(l.convertToTspans,t);var g,y,x,b=i.bBox(h.node()),_=Math.min(o.BL[1],o.BR[1])+v,w=Math.max(o.TL[1],o.TR[1])+v;y=Math.max(o.TL[0],o.BL[0])+u,x=Math.min(o.TR[0],o.BR[0])+u,(g=c(y,x,_,w,b,{isHorizontal:!0,constrained:!0,angle:0,anchor:"middle"})).fontSize=p.size,f(d.type,g,r),e[s].transform=g,h.attr("transform",a.getTextTransform(g))}))}}));var v=n.select(this).selectAll("g.titletext").data(d.title.text?[0]:[]);v.enter().append("g").classed("titletext",!0),v.exit().remove(),v.each((function(){var e=a.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),c=d.title.text;d._meta&&(c=a.templateString(c,d._meta)),e.text(c).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(i.font,d.title.font).call(l.convertToTspans,t);var u=x(h,r._size);e.attr("transform",s(u.x,u.y)+o(Math.min(1,u.scale))+s(u.tx,u.ty))}))}))}))}},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../bar/plot":931,"../bar/uniform_text":936,"../pie/helpers":1165,"../pie/plot":1169,d3:169}],1063:[function(t,e,r){"use strict";var n=t("d3"),i=t("../pie/style_one"),a=t("../bar/uniform_text").resizeText;e.exports=function(t){var e=t._fullLayout._funnelarealayer.selectAll(".trace");a(t,e,"funnelarea"),e.each((function(t){var e=t[0].trace,r=n.select(this);r.style({opacity:e.opacity}),r.selectAll("path.surface").each((function(t){n.select(this).call(i,t,e)}))}))}},{"../bar/uniform_text":936,"../pie/style_one":1171,d3:169}],1064:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../../components/colorscale/attributes"),s=(t("../../constants/docs").FORMAT_LINK,t("../../lib/extend").extendFlat);e.exports=s({z:{valType:"data_array",editType:"calc"},x:s({},n.x,{impliedEdits:{xtype:"array"}}),x0:s({},n.x0,{impliedEdits:{xtype:"scaled"}}),dx:s({},n.dx,{impliedEdits:{xtype:"scaled"}}),y:s({},n.y,{impliedEdits:{ytype:"array"}}),y0:s({},n.y0,{impliedEdits:{ytype:"scaled"}}),dy:s({},n.dy,{impliedEdits:{ytype:"scaled"}}),xperiod:s({},n.xperiod,{impliedEdits:{xtype:"scaled"}}),yperiod:s({},n.yperiod,{impliedEdits:{ytype:"scaled"}}),xperiod0:s({},n.xperiod0,{impliedEdits:{xtype:"scaled"}}),yperiod0:s({},n.yperiod0,{impliedEdits:{ytype:"scaled"}}),xperiodalignment:s({},n.xperiodalignment,{impliedEdits:{xtype:"scaled"}}),yperiodalignment:s({},n.yperiodalignment,{impliedEdits:{ytype:"scaled"}}),text:{valType:"data_array",editType:"calc"},hovertext:{valType:"data_array",editType:"calc"},transpose:{valType:"boolean",dflt:!1,editType:"calc"},xtype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},ytype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,editType:"calc"},hoverongaps:{valType:"boolean",dflt:!0,editType:"none"},connectgaps:{valType:"boolean",editType:"calc"},xgap:{valType:"number",dflt:0,min:0,editType:"plot"},ygap:{valType:"number",dflt:0,min:0,editType:"plot"},zhoverformat:{valType:"string",dflt:"",editType:"none"},hovertemplate:a(),showlegend:s({},i.showlegend,{dflt:!1})},{transforms:void 0},o("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":650,"../../constants/docs":748,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1065:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/cartesian/align_period"),s=t("../histogram2d/calc"),l=t("../../components/colorscale/calc"),c=t("./convert_column_xyz"),u=t("./clean_2d_array"),f=t("./interp2d"),h=t("./find_empties"),p=t("./make_bound_array"),d=t("../../constants/numerical").BADNUM;function g(t){for(var e=[],r=t.length,n=0;nD){z("x scale is not linear");break}}if(x.length&&"fast"===I){var R=(x[x.length-1]-x[0])/(x.length-1),F=Math.abs(R/100);for(k=0;kF){z("y scale is not linear");break}}}var B=i.maxRowLength(T),N="scaled"===e.xtype?"":r,j=p(e,N,m,v,B,A),U="scaled"===e.ytype?"":x,V=p(e,U,b,_,T.length,S);L||(e._extremes[A._id]=a.findExtremes(A,j),e._extremes[S._id]=a.findExtremes(S,V));var q={x:j,y:V,z:T,text:e._text||e.text,hovertext:e._hovertext||e.hovertext};if(e.xperiodalignment&&y&&(q.orig_x=y),e.yperiodalignment&&w&&(q.orig_y=w),N&&N.length===j.length-1&&(q.xCenter=N),U&&U.length===V.length-1&&(q.yCenter=U),C&&(q.xRanges=M.xRanges,q.yRanges=M.yRanges,q.pts=M.pts),E||l(t,e,{vals:T,cLetter:"z"}),E&&e.contours&&"heatmap"===e.contours.coloring){var H={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};q.xfill=p(H,N,m,v,B,A),q.yfill=p(H,U,b,_,T.length,S)}return[q]}},{"../../components/colorscale/calc":651,"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/axes":827,"../../registry":910,"../histogram2d/calc":1097,"./clean_2d_array":1066,"./convert_column_xyz":1068,"./find_empties":1070,"./interp2d":1073,"./make_bound_array":1074}],1066:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r,o){var s,l,c,u,f,h;function p(t){if(n(t))return+t}if(e&&e.transpose){for(s=0,f=0;f=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),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(a in l)f[a]=l[a],u.push(l[a])}return u.sort((function(t,e){return e[2]-t[2]}))}},{"../../lib":778}],1071:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../components/colorscale").extractOpts;e.exports=function(t,e,r,s,l,c){var u,f,h,p,d=t.cd[0],g=d.trace,m=t.xa,v=t.ya,y=d.x,x=d.y,b=d.z,_=d.xCenter,w=d.yCenter,T=d.zmask,k=g.zhoverformat,M=y,A=x;if(!1!==t.index){try{h=Math.round(t.index[1]),p=Math.round(t.index[0])}catch(e){return void i.error("Error hovering on heatmap, pointNumber must be [row,col], found:",t.index)}if(h<0||h>=b[0].length||p<0||p>b.length)return}else{if(n.inbox(e-y[0],e-y[y.length-1],0)>0||n.inbox(r-x[0],r-x[x.length-1],0)>0)return;if(c){var S;for(M=[2*y[0]-y[1]],S=1;Sg&&(v=Math.max(v,Math.abs(t[a][o]-d)/(m-g))))}return v}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":778}],1074:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib").isArrayOrTypedArray;e.exports=function(t,e,r,a,o,s){var l,c,u,f=[],h=n.traceIs(t,"contour"),p=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(i(e)&&e.length>1&&!p&&"category"!==s.type){var g=e.length;if(!(g<=o))return h?e.slice(0,o):e.slice(0,o+1);if(h||d)f=e.slice(0,o);else if(1===o)f=[e[0]-.5,e[0]+.5];else{for(f=[1.5*e[0]-.5*e[1]],u=1;u0;)h=p.c2p(T[y]),y--;for(h0;)v=d.c2p(k[y]),y--;if(v0&&(a=!0);for(var l=0;la){var o=a-r[t];return r[t]=a,o}}return 0},max:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]c?t>o?t>1.1*i?i:t>1.1*a?a:o:t>s?s:t>l?l:c:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function p(t,e,r,n,a,s){if(n&&t>o){var l=d(e,a,s),c=d(r,a,s),u=t===i?0:1;return l[u]!==c[u]}return Math.floor(r/t)-Math.floor(e/t)>.1}function d(t,e,r){var n=e.c2d(t,i,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}e.exports=function(t,e,r,n,a){var s,l,c=-1.1*e,h=-.1*e,p=t-h,d=r[0],g=r[1],m=Math.min(f(d+h,d+p,n,a),f(g+h,g+p,n,a)),v=Math.min(f(d+c,d+h,n,a),f(g+c,g+h,n,a));if(m>v&&vo){var y=s===i?1:6,x=s===i?"M12":"M1";return function(e,r){var o=n.c2d(e,i,a),s=o.indexOf("-",y);s>0&&(o=o.substr(0,s));var c=n.d2c(o,0,a);if(cr.r2l(B)&&(j=o.tickIncrement(j,b.size,!0,p)),O.start=r.l2r(j),F||i.nestedProperty(e,v+".start").set(O.start)}var U=b.end,V=r.r2l(z.end),q=void 0!==V;if((b.endFound||q)&&V!==r.r2l(U)){var H=q?V:i.aggNums(Math.max,null,d);O.end=r.l2r(H),q||i.nestedProperty(e,v+".start").set(O.end)}var G="autobin"+s;return!1===e._input[G]&&(e._input[v]=i.extendFlat({},e[v]||{}),delete e._input[G],delete e[G]),[O,d]}e.exports={calc:function(t,e){var r,a,p,d,g=[],m=[],v=o.getFromId(t,"h"===e.orientation?e.yaxis:e.xaxis),y="h"===e.orientation?"y":"x",x={x:"y",y:"x"}[y],b=e[y+"calendar"],_=e.cumulative,w=h(t,e,v,y),T=w[0],k=w[1],M="string"==typeof T.size,A=[],S=M?A:T,E=[],C=[],L=[],I=0,P=e.histnorm,z=e.histfunc,O=-1!==P.indexOf("density");_.enabled&&O&&(P=P.replace(/ ?density$/,""),O=!1);var D,R="max"===z||"min"===z?null:0,F=l.count,B=c[P],N=!1,j=function(t){return v.r2c(t,0,b)};for(i.isArrayOrTypedArray(e[x])&&"count"!==z&&(D=e[x],N="avg"===z,F=l[z]),r=j(T.start),p=j(T.end)+(r-o.tickIncrement(r,T.size,!1,b))/1e6;r=0&&d=0;n--)s(n);else if("increasing"===e){for(n=1;n=0;n--)t[n]+=t[n+1];"exclude"===r&&(t.push(0),t.shift())}}(m,_.direction,_.currentbin);var J=Math.min(g.length,m.length),K=[],Q=0,$=J-1;for(r=0;r=Q;r--)if(m[r]){$=r;break}for(r=Q;r<=$;r++)if(n(g[r])&&n(m[r])){var tt={p:g[r],s:m[r],b:0};_.enabled||(tt.pts=L[r],G?tt.ph0=tt.ph1=L[r].length?k[L[r][0]]:g[r]:(e._computePh=!0,tt.ph0=q(A[r]),tt.ph1=q(A[r+1],!0))),K.push(tt)}return 1===K.length&&(K[0].width1=o.tickIncrement(K[0].p,T.size,!1,b)-K[0].p),s(K,e),i.isArrayOrTypedArray(e.selectedpoints)&&i.tagSelected(K,e,X),K},calcAllAutoBins:h}},{"../../lib":778,"../../plots/cartesian/axes":827,"../../registry":910,"../bar/arrays_to_calcdata":919,"./average":1084,"./bin_functions":1086,"./bin_label_vals":1087,"./norm_functions":1095,"fast-isnumeric":241}],1089:[function(t,e,r){"use strict";e.exports={eventDataKeys:["binNumber"]}},{}],1090:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axis_ids"),a=t("../../registry").traceIs,o=t("../bar/defaults").handleGroupingDefaults,s=n.nestedProperty,l=t("../../plots/cartesian/constraints").getAxisGroup,c=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],u=["x","y"];e.exports=function(t,e){var r,f,h,p,d,g,m,v=e._histogramBinOpts={},y=[],x={},b=[];function _(t,e){return n.coerce(r._input,r,r._module.attributes,t,e)}function w(t){return"v"===t.orientation?"x":"y"}function T(t,r,a){var o=t.uid+"__"+a;r||(r=o);var s=function(t,r){return i.getFromTrace({_fullLayout:e},t,r).type}(t,a),l=t[a+"calendar"]||"",c=v[r],u=!0;c&&(s===c.axType&&l===c.calendar?(u=!1,c.traces.push(t),c.dirs.push(a)):(r=o,s!==c.axType&&n.warn(["Attempted to group the bins of trace",t.index,"set on a","type:"+s,"axis","with bins on","type:"+c.axType,"axis."].join(" ")),l!==c.calendar&&n.warn(["Attempted to group the bins of trace",t.index,"set with a",l,"calendar","with bins",c.calendar?"on a "+c.calendar+" calendar":"w/o a set calendar"].join(" ")))),u&&(v[r]={traces:[t],dirs:[a],axType:s,calendar:t[a+"calendar"]||""}),t["_"+a+"bingroup"]=r}for(d=0;dS&&T.splice(S,T.length-S),A.length>S&&A.splice(S,A.length-S);var E=[],C=[],L=[],I="string"==typeof w.size,P="string"==typeof M.size,z=[],O=[],D=I?z:w,R=P?O:M,F=0,B=[],N=[],j=e.histnorm,U=e.histfunc,V=-1!==j.indexOf("density"),q="max"===U||"min"===U?null:0,H=a.count,G=o[j],Y=!1,W=[],X=[],Z="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";Z&&"count"!==U&&(Y="avg"===U,H=a[U]);var J=w.size,K=x(w.start),Q=x(w.end)+(K-i.tickIncrement(K,J,!1,v))/1e6;for(r=K;r=0&&p=0&&d0||n.inbox(r-o.y0,r-(o.y0+o.h*s.dy),0)>0)){var u,f=Math.floor((e-o.x0)/s.dx),h=Math.floor(Math.abs(r-o.y0)/s.dy);if(s._hasZ?u=o.z[h][f]:s._hasSource&&(u=s._canvas.el.getContext("2d").getImageData(f,h,1,1).data),u){var p,d=o.hi||s.hoverinfo;if(d){var g=d.split("+");-1!==g.indexOf("all")&&(g=["color"]),-1!==g.indexOf("color")&&(p=!0)}var m,v=a.colormodel[s.colormodel],y=v.colormodel||s.colormodel,x=y.length,b=s._scaler(u),_=v.suffix,w=[];(s.hovertemplate||p)&&(w.push("["+[b[0]+_[0],b[1]+_[1],b[2]+_[2]].join(", ")),4===x&&w.push(", "+b[3]+_[3]),w.push("]"),w=w.join(""),t.extraText=y.toUpperCase()+": "+w),Array.isArray(s.hovertext)&&Array.isArray(s.hovertext[h])?m=s.hovertext[h][f]:Array.isArray(s.text)&&Array.isArray(s.text[h])&&(m=s.text[h][f]);var T=c.c2p(o.y0+(h+.5)*s.dy),k=o.x0+(f+.5)*s.dx,M=o.y0+(h+.5)*s.dy,A="["+u.slice(0,s.colormodel.length).join(", ")+"]";return[i.extendFlat(t,{index:[h,f],x0:l.c2p(o.x0+f*s.dx),x1:l.c2p(o.x0+(f+1)*s.dx),y0:T,y1:T,color:b,xVal:k,xLabelVal:k,yVal:M,yLabelVal:M,zLabelVal:A,text:m,hovertemplateLabels:{zLabel:A,colorLabel:w,"color[0]Label":b[0]+_[0],"color[1]Label":b[1]+_[1],"color[2]Label":b[2]+_[2],"color[3]Label":b[3]+_[3]}})]}}}},{"../../components/fx":683,"../../lib":778,"./constants":1107}],1112:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover"),eventData:t("./event_data"),moduleType:"trace",name:"image",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","2dMap","noSortingByValue"],animatable:!1,meta:{}}},{"../../plots/cartesian":840,"./attributes":1105,"./calc":1106,"./defaults":1108,"./event_data":1109,"./hover":1111,"./plot":1113,"./style":1114}],1113:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=i.strTranslate,o=t("../../constants/xmlns_namespaces"),s=t("./constants"),l=i.isIOS()||i.isSafari()||i.isIE();e.exports=function(t,e,r,c){var u=e.xaxis,f=e.yaxis,h=!(l||t._context._exportedPlot);i.makeTraceGroups(c,r,"im").each((function(e){var r=n.select(this),l=e[0],c=l.trace,p=h&&!c._hasZ&&c._hasSource&&"linear"===u.type&&"linear"===f.type;c._fastImage=p;var d,g,m,v,y,x,b=l.z,_=l.x0,w=l.y0,T=l.w,k=l.h,M=c.dx,A=c.dy;for(x=0;void 0===d&&x0;)g=u.c2p(_+x*M),x--;for(x=0;void 0===v&&x0;)y=f.c2p(w+x*A),x--;if(gP[0];if(z||O){var D=d+S/2,R=v+E/2;L+="transform:"+a(D+"px",R+"px")+"scale("+(z?-1:1)+","+(O?-1:1)+")"+a(-D+"px",-R+"px")+";"}}C.attr("style",L);var F=new Promise((function(t){if(c._hasZ)t();else if(c._hasSource)if(c._canvas&&c._canvas.el.width===T&&c._canvas.el.height===k&&c._canvas.source===c.source)t();else{var e=document.createElement("canvas");e.width=T,e.height=k;var r=e.getContext("2d");c._image=c._image||new Image;var n=c._image;n.onload=function(){r.drawImage(n,0,0),c._canvas={el:e,source:c.source},t()},n.setAttribute("src",c.source)}})).then((function(){var t;if(c._hasZ)t=B((function(t,e){return b[e][t]})).toDataURL("image/png");else if(c._hasSource)if(p)t=c.source;else{var e=c._canvas.el.getContext("2d").getImageData(0,0,T,k).data;t=B((function(t,r){var n=4*(r*T+t);return[e[n],e[n+1],e[n+2],e[n+3]]})).toDataURL("image/png")}C.attr({"xlink:href":t,height:E,width:S,x:d,y:v})}));t._promises.push(F)}function B(t){var e=document.createElement("canvas");e.width=S,e.height=E;var r,n=e.getContext("2d"),a=function(t){return i.constrain(Math.round(u.c2p(_+t*M)-d),0,S)},o=function(t){return i.constrain(Math.round(f.c2p(w+t*A)-v),0,E)},h=s.colormodel[c.colormodel],p=h.colormodel||c.colormodel,g=h.fmt;for(x=0;x0}function _(t){t.each((function(t){m.stroke(n.select(this),t.line.color)})).each((function(t){m.fill(n.select(this),t.color)})).style("stroke-width",(function(t){return t.line.width}))}function w(t,e,r){var n=t._fullLayout,a=i.extendFlat({type:"linear",ticks:"outside",range:r,showline:!0},e),o={type:"linear",_id:"x"+e._id},s={letter:"x",font:n.font,noHover:!0,noTickson:!0};function l(t,e){return i.coerce(a,o,g,t,e)}return p(a,o,l,s,n),d(a,o,l,s),o}function T(t,e,r){return[Math.min(e/t.width,r/t.height),t,e+"x"+r]}function k(t,e,r,i){var a=document.createElementNS("http://www.w3.org/2000/svg","text"),o=n.select(a);return o.text(t).attr("x",0).attr("y",0).attr("text-anchor",r).attr("data-unformatted",t).call(f.convertToTspans,i).call(c.font,e),c.bBox(o.node())}function M(t,e,r,n,a,o){var s="_cache"+e;t[s]&&t[s].key===a||(t[s]={key:a,value:r});var l=i.aggNums(o,null,[t[s].value,n],2);return t[s].value=l,l}e.exports=function(t,e,r,p){var d,g=t._fullLayout;b(r)&&p&&(d=p()),i.makeTraceGroups(g._indicatorlayer,e,"trace").each((function(e){var p,A,S,E,C,L=e[0].trace,I=n.select(this),P=L._hasGauge,z=L._isAngular,O=L._isBullet,D=L.domain,R={w:g._size.w*(D.x[1]-D.x[0]),h:g._size.h*(D.y[1]-D.y[0]),l:g._size.l+g._size.w*D.x[0],r:g._size.r+g._size.w*(1-D.x[1]),t:g._size.t+g._size.h*(1-D.y[1]),b:g._size.b+g._size.h*D.y[0]},F=R.l+R.w/2,B=R.t+R.h/2,N=Math.min(R.w/2,R.h),j=u.innerRadius*N,U=L.align||"center";if(A=B,P){if(z&&(p=F,A=B+N/2,S=function(t){return function(t,e){var r=Math.sqrt(t.width/2*(t.width/2)+t.height*t.height);return[e/r,t,e]}(t,.9*j)}),O){var V=u.bulletPadding,q=1-u.bulletNumberDomainSize+V;p=R.l+(q+(1-q)*y[U])*R.w,S=function(t){return T(t,(u.bulletNumberDomainSize-V)*R.w,R.h)}}}else p=R.l+y[U]*R.w,S=function(t){return T(t,R.w,R.h)};!function(t,e,r,s){var l,u,p,d=r[0].trace,g=s.numbersX,_=s.numbersY,T=d.align||"center",A=v[T],S=s.transitionOpts,E=s.onComplete,C=i.ensureSingle(e,"g","numbers"),L=[];d._hasNumber&&L.push("number");d._hasDelta&&(L.push("delta"),"left"===d.delta.position&&L.reverse());var I=C.selectAll("text").data(L);function P(e,r,n,i){if(!e.match("s")||n>=0==i>=0||r(n).slice(-1).match(x)||r(i).slice(-1).match(x))return r;var a=e.slice().replace("s","f").replace(/\d+/,(function(t){return parseInt(t)-1})),o=w(t,{tickformat:a});return function(t){return Math.abs(t)<1?h.tickText(o,t).text:r(t)}}I.enter().append("text"),I.attr("text-anchor",(function(){return A})).attr("class",(function(t){return t})).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),I.exit().remove();var z,O=d.mode+d.align;d._hasDelta&&(z=function(){var e=w(t,{tickformat:d.delta.valueformat},d._range);e.setScale(),h.prepTicks(e);var i=function(t){return h.tickText(e,t).text},a=function(t){return d.delta.relative?t.relativeDelta:t.delta},o=function(t,e){return 0===t||"number"!=typeof t||isNaN(t)?"-":(t>0?d.delta.increasing.symbol:d.delta.decreasing.symbol)+e(t)},s=function(t){return t.delta>=0?d.delta.increasing.color:d.delta.decreasing.color};void 0===d._deltaLastValue&&(d._deltaLastValue=a(r[0]));var l=C.select("text.delta");function p(){l.text(o(a(r[0]),i)).call(m.fill,s(r[0])).call(f.convertToTspans,t)}return l.call(c.font,d.delta.font).call(m.fill,s({delta:d._deltaLastValue})),b(S)?l.transition().duration(S.duration).ease(S.easing).tween("text",(function(){var t=n.select(this),e=a(r[0]),l=d._deltaLastValue,c=P(d.delta.valueformat,i,l,e),u=n.interpolateNumber(l,e);return d._deltaLastValue=e,function(e){t.text(o(u(e),c)),t.call(m.fill,s({delta:u(e)}))}})).each("end",(function(){p(),E&&E()})).each("interrupt",(function(){p(),E&&E()})):p(),u=k(o(a(r[0]),i),d.delta.font,A,t),l}(),O+=d.delta.position+d.delta.font.size+d.delta.font.family+d.delta.valueformat,O+=d.delta.increasing.symbol+d.delta.decreasing.symbol,p=u);d._hasNumber&&(!function(){var e=w(t,{tickformat:d.number.valueformat},d._range);e.setScale(),h.prepTicks(e);var i=function(t){return h.tickText(e,t).text},a=d.number.suffix,o=d.number.prefix,s=C.select("text.number");function u(){var e="number"==typeof r[0].y?o+i(r[0].y)+a:"-";s.text(e).call(c.font,d.number.font).call(f.convertToTspans,t)}b(S)?s.transition().duration(S.duration).ease(S.easing).each("end",(function(){u(),E&&E()})).each("interrupt",(function(){u(),E&&E()})).attrTween("text",(function(){var t=n.select(this),e=n.interpolateNumber(r[0].lastY,r[0].y);d._lastValue=r[0].y;var s=P(d.number.valueformat,i,r[0].lastY,r[0].y);return function(r){t.text(o+s(e(r))+a)}})):u(),l=k(o+i(r[0].y)+a,d.number.font,A,t)}(),O+=d.number.font.size+d.number.font.family+d.number.valueformat+d.number.suffix+d.number.prefix,p=l);if(d._hasDelta&&d._hasNumber){var D,R,F=[(l.left+l.right)/2,(l.top+l.bottom)/2],B=[(u.left+u.right)/2,(u.top+u.bottom)/2],N=.75*d.delta.font.size;"left"===d.delta.position&&(D=M(d,"deltaPos",0,-1*(l.width*y[d.align]+u.width*(1-y[d.align])+N),O,Math.min),R=F[1]-B[1],p={width:l.width+u.width+N,height:Math.max(l.height,u.height),left:u.left+D,right:l.right,top:Math.min(l.top,u.top+R),bottom:Math.max(l.bottom,u.bottom+R)}),"right"===d.delta.position&&(D=M(d,"deltaPos",0,l.width*(1-y[d.align])+u.width*y[d.align]+N,O,Math.max),R=F[1]-B[1],p={width:l.width+u.width+N,height:Math.max(l.height,u.height),left:l.left,right:u.right+D,top:Math.min(l.top,u.top+R),bottom:Math.max(l.bottom,u.bottom+R)}),"bottom"===d.delta.position&&(D=null,R=u.height,p={width:Math.max(l.width,u.width),height:l.height+u.height,left:Math.min(l.left,u.left),right:Math.max(l.right,u.right),top:l.bottom-l.height,bottom:l.bottom+u.height}),"top"===d.delta.position&&(D=null,R=l.top,p={width:Math.max(l.width,u.width),height:l.height+u.height,left:Math.min(l.left,u.left),right:Math.max(l.right,u.right),top:l.bottom-l.height-u.height,bottom:l.bottom}),z.attr({dx:D,dy:R})}(d._hasNumber||d._hasDelta)&&C.attr("transform",(function(){var t=s.numbersScaler(p);O+=t[2];var e,r=M(d,"numbersScale",1,t[0],O,Math.min);d._scaleNumbers||(r=1),e=d._isAngular?_-r*p.bottom:_-r*(p.top+p.bottom)/2,d._numbersTop=r*p.top+e;var n=p[T];"center"===T&&(n=(p.left+p.right)/2);var i=g-r*n;return i=M(d,"numbersTranslate",0,i,O,Math.max),o(i,e)+a(r)}))}(t,I,e,{numbersX:p,numbersY:A,numbersScaler:S,transitionOpts:r,onComplete:d}),P&&(E={range:L.gauge.axis.range,color:L.gauge.bgcolor,line:{color:L.gauge.bordercolor,width:0},thickness:1},C={range:L.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:L.gauge.bordercolor,width:L.gauge.borderwidth},thickness:1});var H=I.selectAll("g.angular").data(z?e:[]);H.exit().remove();var G=I.selectAll("g.angularaxis").data(z?e:[]);G.exit().remove(),z&&function(t,e,r,i){var a,c,u,f,p=r[0].trace,d=i.size,g=i.radius,m=i.innerRadius,v=i.gaugeBg,y=i.gaugeOutline,x=[d.l+d.w/2,d.t+d.h/2+g/2],T=i.gauge,k=i.layer,M=i.transitionOpts,A=i.onComplete,S=Math.PI/2;function E(t){var e=p.gauge.axis.range[0],r=(t-e)/(p.gauge.axis.range[1]-e)*Math.PI-S;return r<-S?-S:r>S?S:r}function C(t){return n.svg.arc().innerRadius((m+g)/2-t/2*(g-m)).outerRadius((m+g)/2+t/2*(g-m)).startAngle(-S)}function L(t){t.attr("d",(function(t){return C(t.thickness).startAngle(E(t.range[0])).endAngle(E(t.range[1]))()}))}T.enter().append("g").classed("angular",!0),T.attr("transform",o(x[0],x[1])),k.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),k.selectAll("g.xangularaxistick,path,text").remove(),(a=w(t,p.gauge.axis)).type="linear",a.range=p.gauge.axis.range,a._id="xangularaxis",a.setScale();var I=function(t){return(a.range[0]-t.x)/(a.range[1]-a.range[0])*Math.PI+Math.PI},P={},z=h.makeLabelFns(a,0).labelStandoff;P.xFn=function(t){var e=I(t);return Math.cos(e)*z},P.yFn=function(t){var e=I(t),r=Math.sin(e)>0?.2:1;return-Math.sin(e)*(z+t.fontSize*r)+Math.abs(Math.cos(e))*(t.fontSize*l)},P.anchorFn=function(t){var e=I(t),r=Math.cos(e);return Math.abs(r)<.1?"middle":r>0?"start":"end"},P.heightFn=function(t,e,r){var n=I(t);return-.5*(1+Math.sin(n))*r};var O=function(t){return o(x[0]+g*Math.cos(t),x[1]-g*Math.sin(t))};u=function(t){return O(I(t))};if(c=h.calcTicks(a),f=h.getTickSigns(a)[2],a.visible){f="inside"===a.ticks?-1:1;var D=(a.linewidth||1)/2;h.drawTicks(t,a,{vals:c,layer:k,path:"M"+f*D+",0h"+f*a.ticklen,transFn:function(t){var e=I(t);return O(e)+"rotate("+-s(e)+")"}}),h.drawLabels(t,a,{vals:c,layer:k,transFn:u,labelFns:P})}var R=[v].concat(p.gauge.steps),F=T.selectAll("g.bg-arc").data(R);F.enter().append("g").classed("bg-arc",!0).append("path"),F.select("path").call(L).call(_),F.exit().remove();var B=C(p.gauge.bar.thickness),N=T.selectAll("g.value-arc").data([p.gauge.bar]);N.enter().append("g").classed("value-arc",!0).append("path");var j=N.select("path");b(M)?(j.transition().duration(M.duration).ease(M.easing).each("end",(function(){A&&A()})).each("interrupt",(function(){A&&A()})).attrTween("d",(U=B,V=E(r[0].lastY),q=E(r[0].y),function(){var t=n.interpolate(V,q);return function(e){return U.endAngle(t(e))()}})),p._lastValue=r[0].y):j.attr("d","number"==typeof r[0].y?B.endAngle(E(r[0].y)):"M0,0Z");var U,V,q;j.call(_),N.exit().remove(),R=[];var H=p.gauge.threshold.value;H&&R.push({range:[H,H],color:p.gauge.threshold.color,line:{color:p.gauge.threshold.line.color,width:p.gauge.threshold.line.width},thickness:p.gauge.threshold.thickness});var G=T.selectAll("g.threshold-arc").data(R);G.enter().append("g").classed("threshold-arc",!0).append("path"),G.select("path").call(L).call(_),G.exit().remove();var Y=T.selectAll("g.gauge-outline").data([y]);Y.enter().append("g").classed("gauge-outline",!0).append("path"),Y.select("path").call(L).call(_),Y.exit().remove()}(t,0,e,{radius:N,innerRadius:j,gauge:H,layer:G,size:R,gaugeBg:E,gaugeOutline:C,transitionOpts:r,onComplete:d});var Y=I.selectAll("g.bullet").data(O?e:[]);Y.exit().remove();var W=I.selectAll("g.bulletaxis").data(O?e:[]);W.exit().remove(),O&&function(t,e,r,n){var i,a,s,l,c,f=r[0].trace,p=n.gauge,d=n.layer,g=n.gaugeBg,v=n.gaugeOutline,y=n.size,x=f.domain,T=n.transitionOpts,k=n.onComplete;p.enter().append("g").classed("bullet",!0),p.attr("transform",o(y.l,y.t)),d.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),d.selectAll("g.xbulletaxistick,path,text").remove();var M=y.h,A=f.gauge.bar.thickness*M,S=x.x[0],E=x.x[0]+(x.x[1]-x.x[0])*(f._hasNumber||f._hasDelta?1-u.bulletNumberDomainSize:1);(i=w(t,f.gauge.axis))._id="xbulletaxis",i.domain=[S,E],i.setScale(),a=h.calcTicks(i),s=h.makeTransTickFn(i),l=h.getTickSigns(i)[2],c=y.t+y.h,i.visible&&(h.drawTicks(t,i,{vals:"inside"===i.ticks?h.clipEnds(i,a):a,layer:d,path:h.makeTickPath(i,c,l),transFn:s}),h.drawLabels(t,i,{vals:a,layer:d,transFn:s,labelFns:h.makeLabelFns(i,c)}));function C(t){t.attr("width",(function(t){return Math.max(0,i.c2p(t.range[1])-i.c2p(t.range[0]))})).attr("x",(function(t){return i.c2p(t.range[0])})).attr("y",(function(t){return.5*(1-t.thickness)*M})).attr("height",(function(t){return t.thickness*M}))}var L=[g].concat(f.gauge.steps),I=p.selectAll("g.bg-bullet").data(L);I.enter().append("g").classed("bg-bullet",!0).append("rect"),I.select("rect").call(C).call(_),I.exit().remove();var P=p.selectAll("g.value-bullet").data([f.gauge.bar]);P.enter().append("g").classed("value-bullet",!0).append("rect"),P.select("rect").attr("height",A).attr("y",(M-A)/2).call(_),b(T)?P.select("rect").transition().duration(T.duration).ease(T.easing).each("end",(function(){k&&k()})).each("interrupt",(function(){k&&k()})).attr("width",Math.max(0,i.c2p(Math.min(f.gauge.axis.range[1],r[0].y)))):P.select("rect").attr("width","number"==typeof r[0].y?Math.max(0,i.c2p(Math.min(f.gauge.axis.range[1],r[0].y))):0);P.exit().remove();var z=r.filter((function(){return f.gauge.threshold.value})),O=p.selectAll("g.threshold-bullet").data(z);O.enter().append("g").classed("threshold-bullet",!0).append("line"),O.select("line").attr("x1",i.c2p(f.gauge.threshold.value)).attr("x2",i.c2p(f.gauge.threshold.value)).attr("y1",(1-f.gauge.threshold.thickness)/2*M).attr("y2",(1-(1-f.gauge.threshold.thickness)/2)*M).call(m.stroke,f.gauge.threshold.line.color).style("stroke-width",f.gauge.threshold.line.width),O.exit().remove();var D=p.selectAll("g.gauge-outline").data([v]);D.enter().append("g").classed("gauge-outline",!0).append("rect"),D.select("rect").call(C).call(_),D.exit().remove()}(t,0,e,{gauge:Y,layer:W,size:R,gaugeBg:E,gaugeOutline:C,transitionOpts:r,onComplete:d});var X=I.selectAll("text.title").data(e);X.exit().remove(),X.enter().append("text").classed("title",!0),X.attr("text-anchor",(function(){return O?v.right:v[L.title.align]})).text(L.title.text).call(c.font,L.title.font).call(f.convertToTspans,t),X.attr("transform",(function(){var t,e=R.l+R.w*y[L.title.align],r=u.titlePadding,n=c.bBox(X.node());if(P){if(z)if(L.gauge.axis.visible)t=c.bBox(G.node()).top-r-n.bottom;else t=R.t+R.h/2-N/2-n.bottom-r;O&&(t=A-(n.top+n.bottom)/2,e=R.l-u.bulletPadding*R.w)}else t=L._numbersTop-r-n.bottom;return o(e,t)}))}))}},{"../../components/color":643,"../../components/drawing":665,"../../constants/alignment":745,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"../../plots/cartesian/axis_defaults":829,"../../plots/cartesian/layout_attributes":841,"../../plots/cartesian/position_defaults":844,"./constants":1118,d3:169}],1122:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../mesh3d/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll;var c=e.exports=l(s({x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},value:{valType:"data_array"},isomin:{valType:"number"},isomax:{valType:"number"},surface:{show:{valType:"boolean",dflt:!0},count:{valType:"integer",dflt:2,min:1},fill:{valType:"number",min:0,max:1,dflt:1},pattern:{valType:"flaglist",flags:["A","B","C","D","E"],extras:["all","odd","even"],dflt:"all"}},spaceframe:{show:{valType:"boolean",dflt:!1},fill:{valType:"number",min:0,max:1,dflt:.15}},slices:{x:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}}},caps:{x:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}}},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:i(),showlegend:s({},o.showlegend,{dflt:!1})},n("",{colorAttr:"`value`",showScaleDflt:!0,editTypeOverride:"calc"}),{opacity:a.opacity,lightposition:a.lightposition,lighting:a.lighting,flatshading:a.flatshading,contour:a.contour,hoverinfo:s({},o.hoverinfo)}),"calc","nested");c.flatshading.dflt=!0,c.lighting.facenormalsepsilon.dflt=0,c.x.editType=c.y.editType=c.z.editType=c.value.editType="calc+clearAxisTypes",c.transforms=void 0},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905,"../mesh3d/attributes":1127}],1123:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc"),i=t("../streamtube/calc").processGrid,a=t("../streamtube/calc").filter;e.exports=function(t,e){e._len=Math.min(e.x.length,e.y.length,e.z.length,e.value.length),e._x=a(e.x,e._len),e._y=a(e.y,e._len),e._z=a(e.z,e._len),e._value=a(e.value,e._len);var r=i(e);e._gridFill=r.fill,e._Xs=r.Xs,e._Ys=r.Ys,e._Zs=r.Zs,e._len=r.len;for(var o=1/0,s=-1/0,l=0;l0;r--){var n=Math.min(e[r],e[r-1]),i=Math.max(e[r],e[r-1]);if(i>n&&n-1}function R(t,e){return null===t?e:t}function F(e,r,n){L();var i,a,o,l=[r],c=[n];if(s>=1)l=[r],c=[n];else if(s>0){var u=function(t,e){var r=t[0],n=t[1],i=t[2],a=function(t,e,r){for(var n=[],i=0;i-1?n[p]:C(d,g,v);h[p]=x>-1?x:P(d,g,v,R(e,y))}i=h[0],a=h[1],o=h[2],t._meshI.push(i),t._meshJ.push(a),t._meshK.push(o),++m}}function B(t,e,r,n){var i=t[3];in&&(i=n);for(var a=(t[3]-i)/(t[3]-e[3]+1e-9),o=[],s=0;s<4;s++)o[s]=(1-a)*t[s]+a*e[s];return o}function N(t,e,r){return t>=e&&t<=r}function j(t){var e=.001*(E-S);return t>=S-e&&t<=E+e}function U(e){for(var r=[],n=0;n<4;n++){var i=e[n];r.push([t._x[i],t._y[i],t._z[i],t._value[i]])}return r}function V(t,e,r,n,i,a){a||(a=1),r=[-1,-1,-1];var o=!1,s=[N(e[0][3],n,i),N(e[1][3],n,i),N(e[2][3],n,i)];if(!s[0]&&!s[1]&&!s[2])return!1;var l=function(t,e,r){return j(e[0][3])&&j(e[1][3])&&j(e[2][3])?(F(t,e,r),!0):a<3&&V(t,e,r,S,E,++a)};if(s[0]&&s[1]&&s[2])return l(t,e,r)||o;var c=!1;return[[0,1,2],[2,0,1],[1,2,0]].forEach((function(a){if(s[a[0]]&&s[a[1]]&&!s[a[2]]){var u=e[a[0]],f=e[a[1]],h=e[a[2]],p=B(h,u,n,i),d=B(h,f,n,i);o=l(t,[d,p,u],[-1,-1,r[a[0]]])||o,o=l(t,[u,f,d],[r[a[0]],r[a[1]],-1])||o,c=!0}})),c||[[0,1,2],[1,2,0],[2,0,1]].forEach((function(a){if(s[a[0]]&&!s[a[1]]&&!s[a[2]]){var u=e[a[0]],f=e[a[1]],h=e[a[2]],p=B(f,u,n,i),d=B(h,u,n,i);o=l(t,[d,p,u],[-1,-1,r[a[0]]])||o,c=!0}})),o}function q(t,e,r,n){var i=!1,a=U(e),o=[N(a[0][3],r,n),N(a[1][3],r,n),N(a[2][3],r,n),N(a[3][3],r,n)];if(!(o[0]||o[1]||o[2]||o[3]))return i;if(o[0]&&o[1]&&o[2]&&o[3])return g&&(i=function(t,e,r){var n=function(n,i,a){F(t,[e[n],e[i],e[a]],[r[n],r[i],r[a]])};n(0,1,2),n(3,0,1),n(2,3,0),n(1,2,3)}(t,a,e)||i),i;var s=!1;return[[0,1,2,3],[3,0,1,2],[2,3,0,1],[1,2,3,0]].forEach((function(l){if(o[l[0]]&&o[l[1]]&&o[l[2]]&&!o[l[3]]){var c=a[l[0]],u=a[l[1]],f=a[l[2]],h=a[l[3]];if(g)i=F(t,[c,u,f],[e[l[0]],e[l[1]],e[l[2]]])||i;else{var p=B(h,c,r,n),d=B(h,u,r,n),m=B(h,f,r,n);i=F(null,[p,d,m],[-1,-1,-1])||i}s=!0}})),s?i:([[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2],[0,2,3,1],[1,3,2,0]].forEach((function(l){if(o[l[0]]&&o[l[1]]&&!o[l[2]]&&!o[l[3]]){var c=a[l[0]],u=a[l[1]],f=a[l[2]],h=a[l[3]],p=B(f,c,r,n),d=B(f,u,r,n),m=B(h,u,r,n),v=B(h,c,r,n);g?(i=F(t,[c,v,p],[e[l[0]],-1,-1])||i,i=F(t,[u,d,m],[e[l[1]],-1,-1])||i):i=function(t,e,r){var n=function(n,i,a){F(t,[e[n],e[i],e[a]],[r[n],r[i],r[a]])};n(0,1,2),n(2,3,0)}(null,[p,d,m,v],[-1,-1,-1,-1])||i,s=!0}})),s||[[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2]].forEach((function(l){if(o[l[0]]&&!o[l[1]]&&!o[l[2]]&&!o[l[3]]){var c=a[l[0]],u=a[l[1]],f=a[l[2]],h=a[l[3]],p=B(u,c,r,n),d=B(f,c,r,n),m=B(h,c,r,n);g?(i=F(t,[c,p,d],[e[l[0]],-1,-1])||i,i=F(t,[c,d,m],[e[l[0]],-1,-1])||i,i=F(t,[c,m,p],[e[l[0]],-1,-1])||i):i=F(null,[p,d,m],[-1,-1,-1])||i,s=!0}})),i)}function H(t,e,r,n,i,a,o,s,l,c,u){var f=!1;return d&&(D(t,"A")&&(f=q(null,[e,r,n,a],c,u)||f),D(t,"B")&&(f=q(null,[r,n,i,l],c,u)||f),D(t,"C")&&(f=q(null,[r,a,o,l],c,u)||f),D(t,"D")&&(f=q(null,[n,a,s,l],c,u)||f),D(t,"E")&&(f=q(null,[r,n,a,l],c,u)||f)),g&&(f=q(t,[r,n,a,l],c,u)||f),f}function G(t,e,r,n,i,a,o,s){return[!0===s[0]||V(t,U([e,r,n]),[e,r,n],a,o),!0===s[1]||V(t,U([n,i,e]),[n,i,e],a,o)]}function Y(t,e,r,n,i,a,o,s,l){return s?G(t,e,r,i,n,a,o,l):G(t,r,i,n,e,a,o,l)}function W(t,e,r,n,i,a,o){var s,l,c,u,f=!1,h=function(){f=V(t,[s,l,c],[-1,-1,-1],i,a)||f,f=V(t,[c,u,s],[-1,-1,-1],i,a)||f},p=o[0],d=o[1],g=o[2];return p&&(s=z(U([k(e,r-0,n-0)])[0],U([k(e-1,r-0,n-0)])[0],p),l=z(U([k(e,r-0,n-1)])[0],U([k(e-1,r-0,n-1)])[0],p),c=z(U([k(e,r-1,n-1)])[0],U([k(e-1,r-1,n-1)])[0],p),u=z(U([k(e,r-1,n-0)])[0],U([k(e-1,r-1,n-0)])[0],p),h()),d&&(s=z(U([k(e-0,r,n-0)])[0],U([k(e-0,r-1,n-0)])[0],d),l=z(U([k(e-0,r,n-1)])[0],U([k(e-0,r-1,n-1)])[0],d),c=z(U([k(e-1,r,n-1)])[0],U([k(e-1,r-1,n-1)])[0],d),u=z(U([k(e-1,r,n-0)])[0],U([k(e-1,r-1,n-0)])[0],d),h()),g&&(s=z(U([k(e-0,r-0,n)])[0],U([k(e-0,r-0,n-1)])[0],g),l=z(U([k(e-0,r-1,n)])[0],U([k(e-0,r-1,n-1)])[0],g),c=z(U([k(e-1,r-1,n)])[0],U([k(e-1,r-1,n-1)])[0],g),u=z(U([k(e-1,r-0,n)])[0],U([k(e-1,r-0,n-1)])[0],g),h()),f}function X(t,e,r,n,i,a,o,s,l,c,u,f){var h=t;return f?(d&&"even"===t&&(h=null),H(h,e,r,n,i,a,o,s,l,c,u)):(d&&"odd"===t&&(h=null),H(h,l,s,o,a,i,n,r,e,c,u))}function Z(t,e,r,n,i){for(var a=[],o=0,s=0;sMath.abs(d-A)?[M,d]:[d,A];$(e,T[0],T[1])}}var C=[[Math.min(S,A),Math.max(S,A)],[Math.min(M,E),Math.max(M,E)]];["x","y","z"].forEach((function(e){for(var r=[],n=0;n0&&(u.push(p.id),"x"===e?f.push([p.distRatio,0,0]):"y"===e?f.push([0,p.distRatio,0]):f.push([0,0,p.distRatio]))}else c=nt(1,"x"===e?b-1:"y"===e?_-1:w-1);u.length>0&&(r[i]="x"===e?tt(null,u,a,o,f,r[i]):"y"===e?et(null,u,a,o,f,r[i]):rt(null,u,a,o,f,r[i]),i++),c.length>0&&(r[i]="x"===e?Z(null,c,a,o,r[i]):"y"===e?J(null,c,a,o,r[i]):K(null,c,a,o,r[i]),i++)}var d=t.caps[e];d.show&&d.fill&&(O(d.fill),r[i]="x"===e?Z(null,[0,b-1],a,o,r[i]):"y"===e?J(null,[0,_-1],a,o,r[i]):K(null,[0,w-1],a,o,r[i]),i++)}})),0===m&&I(),t._meshX=n,t._meshY=i,t._meshZ=a,t._meshIntensity=o,t._Xs=v,t._Ys=y,t._Zs=x}(),t}e.exports={findNearestOnAxis:l,generateIsoMeshes:h,createIsosurfaceTrace:function(t,e){var r=t.glplot.gl,i=n({gl:r}),a=new c(t,i,e.uid);return i._trace=a,a.update(e),t.glplot.add(i),a}}},{"../../components/colorscale":655,"../../lib/gl_format_color":774,"../../lib/str2rgbarray":801,"../../plots/gl3d/zip3":880,"gl-mesh3d":309}],1125:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("./attributes"),o=t("../../components/colorscale/defaults");function s(t,e,r,n,a){var s=a("isomin"),l=a("isomax");null!=l&&null!=s&&s>l&&(e.isomin=null,e.isomax=null);var c=a("x"),u=a("y"),f=a("z"),h=a("value");c&&c.length&&u&&u.length&&f&&f.length&&h&&h.length?(i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],n),["x","y","z"].forEach((function(t){var e="caps."+t;a(e+".show")&&a(e+".fill");var r="slices."+t;a(r+".show")&&(a(r+".fill"),a(r+".locations"))})),a("spaceframe.show")&&a("spaceframe.fill"),a("surface.show")&&(a("surface.count"),a("surface.fill"),a("surface.pattern")),a("contour.show")&&(a("contour.color"),a("contour.width")),["text","hovertext","hovertemplate","lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","flatshading","opacity"].forEach((function(t){a(t)})),o(t,e,n,a,{prefix:"",cLetter:"c"}),e._length=null):e.visible=!1}e.exports={supplyDefaults:function(t,e,r,i){s(t,e,r,i,(function(r,i){return n.coerce(t,e,a,r,i)}))},supplyIsoDefaults:s}},{"../../components/colorscale/defaults":653,"../../lib":778,"../../registry":910,"./attributes":1122}],1126:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,calc:t("./calc"),colorbar:{min:"cmin",max:"cmax"},plot:t("./convert").createIsosurfaceTrace,moduleType:"trace",name:"isosurface",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","showLegend"],meta:{}}},{"../../plots/gl3d":869,"./attributes":1122,"./calc":1123,"./convert":1124,"./defaults":1125}],1127:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../surface/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s({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:i({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"},intensitymode:{valType:"enumerated",values:["vertex","cell"],dflt:"vertex",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"}),{opacity:a.opacity,flatshading:{valType:"boolean",dflt:!1,editType:"calc"},contour:{show:s({},a.contours.x.show,{}),color:a.contours.x.color,width:a.contours.x.width,editType:"calc"},lightposition:{x:s({},a.lightposition.x,{dflt:1e5}),y:s({},a.lightposition.y,{dflt:1e5}),z:s({},a.lightposition.z,{dflt:0}),editType:"calc"},lighting:s({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"},a.lighting),hoverinfo:s({},o.hoverinfo,{editType:"calc"}),showlegend:s({},o.showlegend,{dflt:!1})})},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../surface/attributes":1310}],1128:[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":651}],1129:[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"),c=t("../../components/colorscale").extractOpts,u=t("../../plots/gl3d/zip3");function f(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}var h=f.prototype;function p(t){for(var e=[],r=t.length,n=0;n=e-.5)return!1;return!0}h.handlePick=function(t){if(t.object===this.mesh){var e=t.index=t.data.index;t.data._cellCenter?t.traceCoordinate=t.data.dataCoordinate: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}},h.update=function(t){var e=this.scene,r=e.fullSceneLayout;this.data=t;var n,f=t.x.length,h=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||!m(t.i,f)||!m(t.j,f)||!m(t.k,f))return;n=u(g(t.i),g(t.j),g(t.k))}else n=0===t.alphahull?o(h):t.alphahull>0?a(t.alphahull,h):function(t,e){for(var r=["x","y","z"].indexOf(t),n=[],a=e.length,o=0;ov):m=M>w,v=M;var A=c(w,T,k,M);A.pos=_,A.yc=(w+M)/2,A.i=b,A.dir=m?"increasing":"decreasing",A.x=A.pos,A.y=[k,T],y&&(A.orig_p=r[b]),d&&(A.tx=e.text[b]),g&&(A.htx=e.hovertext[b]),x.push(A)}else x.push({pos:_,empty:!0})}return e._extremes[l._id]=a.findExtremes(l,n.concat(h,f),{padded:!0}),x.length&&(x[0].t={labels:{open:i(t,"open:")+" ",high:i(t,"high:")+" ",low:i(t,"low:")+" ",close:i(t,"close:")+" "}}),x}e.exports={calc:function(t,e){var r=a.getFromId(t,e.xaxis),i=a.getFromId(t,e.yaxis),s=function(t,e,r){var i=r._minDiff;if(!i){var a,s=t._fullData,l=[];for(i=1/0,a=0;a"+c.labels[x]+n.hoverLabelText(s,b):((y=i.extendFlat({},h)).y0=y.y1=_,y.yLabelVal=b,y.yLabel=c.labels[x]+n.hoverLabelText(s,b),y.name="",f.push(y),m[b]=y)}return f}function h(t,e,r,i){var a=t.cd,o=t.ya,l=a[0].trace,f=a[0].t,h=u(t,e,r,i);if(!h)return[];var p=a[h.index],d=h.index=p.i,g=p.dir;function m(t){return f.labels[t]+n.hoverLabelText(o,l[t][d])}var v=p.hi||l.hoverinfo,y=v.split("+"),x="all"===v,b=x||-1!==y.indexOf("y"),_=x||-1!==y.indexOf("text"),w=b?[m("open"),m("high"),m("low"),m("close")+" "+c[g]]:[];return _&&s(p,l,w),h.extraText=w.join("
"),h.y0=h.y1=o.c2p(p.yc,!0),[h]}e.exports={hoverPoints:function(t,e,r,n){return t.cd[0].trace.hoverlabel.split?f(t,e,r,n):h(t,e,r,n)},hoverSplit:f,hoverOnPoints:h}},{"../../components/color":643,"../../components/fx":683,"../../constants/delta.js":747,"../../lib":778,"../../plots/cartesian/axes":827}],1136:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc").calc,plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover").hoverPoints,selectPoints:t("./select")}},{"../../plots/cartesian":840,"./attributes":1132,"./calc":1133,"./defaults":1134,"./hover":1135,"./plot":1138,"./select":1139,"./style":1140}],1137:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib");e.exports=function(t,e,r,a){var o=r("x"),s=r("open"),l=r("high"),c=r("low"),u=r("close");if(r("hoverlabel.split"),n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x"],a),s&&l&&c&&u){var f=Math.min(s.length,l.length,c.length,u.length);return o&&(f=Math.min(f,i.minRowLength(o))),e._length=f,f}}},{"../../lib":778,"../../registry":910}],1138:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib");e.exports=function(t,e,r,a){var o=e.yaxis,s=e.xaxis,l=!!s.rangebreaks;i.makeTraceGroups(a,r,"trace ohlc").each((function(t){var e=n.select(this),r=t[0],a=r.t;if(!0!==r.trace.visible||a.empty)e.remove();else{var c=a.tickLen,u=e.selectAll("path").data(i.identity);u.enter().append("path"),u.exit().remove(),u.attr("d",(function(t){if(t.empty)return"M0,0Z";var e=s.c2p(t.pos-c,!0),r=s.c2p(t.pos+c,!0),n=l?(e+r)/2:s.c2p(t.pos,!0);return"M"+e+","+o.c2p(t.o,!0)+"H"+n+"M"+n+","+o.c2p(t.h,!0)+"V"+o.c2p(t.l,!0)+"M"+r+","+o.c2p(t.c,!0)+"H"+n}))}}))}},{"../../lib":778,d3:169}],1139:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n=t.cd,i=t.xaxis,a=t.yaxis,o=[],s=n[0].t.bPos||0;if(!1===e)for(r=0;r=t.length)return!1;if(void 0!==e[t[r]])return!1;e[t[r]]=!0}return!0}(t.map((function(t){return t.displayindex}))))for(e=0;e0;c&&(o="array");var u=r("categoryorder",o);"array"===u?(r("categoryarray"),r("ticktext")):(delete t.categoryarray,delete t.ticktext),c||"array"!==u||(e.categoryorder="trace")}}e.exports=function(t,e,r,f){function h(r,i){return n.coerce(t,e,l,r,i)}var p=s(t,e,{name:"dimensions",handleItemDefaults:u}),d=function(t,e,r,o,s){s("line.shape"),s("line.hovertemplate");var l=s("line.color",o.colorway[0]);if(i(t,"line")&&n.isArrayOrTypedArray(l)){if(l.length)return s("line.colorscale"),a(t,e,o,s,{prefix:"line.",cLetter:"c"}),l.length;e.line.color=r}return 1/0}(t,e,r,f,h);o(e,f,h),Array.isArray(p)&&p.length||(e.visible=!1),c(e,p,"values",d),h("hoveron"),h("hovertemplate"),h("arrangement"),h("bundlecolors"),h("sortpaths"),h("counts");var g={family:f.font.family,size:Math.round(f.font.size),color:f.font.color};n.coerceFont(h,"labelfont",g);var m={family:f.font.family,size:Math.round(f.font.size/1.2),color:f.font.color};n.coerceFont(h,"tickfont",m)}},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/domain":854,"../parcoords/merge_length":1157,"./attributes":1141}],1145:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcats",basePlotModule:t("./base_plot"),categories:["noOpacity"],meta:{}}},{"./attributes":1141,"./base_plot":1142,"./calc":1143,"./defaults":1144,"./plot":1147}],1146:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plot_api/plot_api"),a=t("../../components/fx"),o=t("../../lib"),s=o.strTranslate,l=t("../../components/drawing"),c=t("tinycolor2"),u=t("../../lib/svg_text_utils");function f(t,e,r,i){var a=t.map(R.bind(0,e,r)),c=i.selectAll("g.parcatslayer").data([null]);c.enter().append("g").attr("class","parcatslayer").style("pointer-events","all");var f=c.selectAll("g.trace.parcats").data(a,h),v=f.enter().append("g").attr("class","trace parcats");f.attr("transform",(function(t){return s(t.x,t.y)})),v.append("g").attr("class","paths");var y=f.select("g.paths").selectAll("path.path").data((function(t){return t.paths}),h);y.attr("fill",(function(t){return t.model.color}));var _=y.enter().append("path").attr("class","path").attr("stroke-opacity",0).attr("fill",(function(t){return t.model.color})).attr("fill-opacity",0);b(_),y.attr("d",(function(t){return t.svgD})),_.empty()||y.sort(d),y.exit().remove(),y.on("mouseover",g).on("mouseout",m).on("click",x),v.append("g").attr("class","dimensions");var k=f.select("g.dimensions").selectAll("g.dimension").data((function(t){return t.dimensions}),h);k.enter().append("g").attr("class","dimension"),k.attr("transform",(function(t){return s(t.x,0)})),k.exit().remove();var M=k.selectAll("g.category").data((function(t){return t.categories}),h),A=M.enter().append("g").attr("class","category");M.attr("transform",(function(t){return s(0,t.y)})),A.append("rect").attr("class","catrect").attr("pointer-events","none"),M.select("rect.catrect").attr("fill","none").attr("width",(function(t){return t.width})).attr("height",(function(t){return t.height})),w(A);var S=M.selectAll("rect.bandrect").data((function(t){return t.bands}),h);S.each((function(){o.raiseToTop(this)})),S.attr("fill",(function(t){return t.color}));var z=S.enter().append("rect").attr("class","bandrect").attr("stroke-opacity",0).attr("fill",(function(t){return t.color})).attr("fill-opacity",0);S.attr("fill",(function(t){return t.color})).attr("width",(function(t){return t.width})).attr("height",(function(t){return t.height})).attr("y",(function(t){return t.y})).attr("cursor",(function(t){return"fixed"===t.parcatsViewModel.arrangement?"default":"perpendicular"===t.parcatsViewModel.arrangement?"ns-resize":"move"})),T(z),S.exit().remove(),A.append("text").attr("class","catlabel").attr("pointer-events","none");var O=e._fullLayout.paper_bgcolor;M.select("text.catlabel").attr("text-anchor",(function(t){return p(t)?"start":"end"})).attr("alignment-baseline","middle").style("text-shadow",O+" -1px 1px 2px, "+O+" 1px 1px 2px, "+O+" 1px -1px 2px, "+O+" -1px -1px 2px").style("fill","rgb(0, 0, 0)").attr("x",(function(t){return p(t)?t.width+5:-5})).attr("y",(function(t){return t.height/2})).text((function(t){return t.model.categoryLabel})).each((function(t){l.font(n.select(this),t.parcatsViewModel.categorylabelfont),u.convertToTspans(n.select(this),e)})),A.append("text").attr("class","dimlabel"),M.select("text.dimlabel").attr("text-anchor","middle").attr("alignment-baseline","baseline").attr("cursor",(function(t){return"fixed"===t.parcatsViewModel.arrangement?"default":"ew-resize"})).attr("x",(function(t){return t.width/2})).attr("y",-5).text((function(t,e){return 0===e?t.parcatsViewModel.model.dimensions[t.model.dimensionInd].dimensionLabel:null})).each((function(t){l.font(n.select(this),t.parcatsViewModel.labelfont)})),M.selectAll("rect.bandrect").on("mouseover",E).on("mouseout",C),M.exit().remove(),k.call(n.behavior.drag().origin((function(t){return{x:t.x,y:0}})).on("dragstart",L).on("drag",I).on("dragend",P)),f.each((function(t){t.traceSelection=n.select(this),t.pathSelection=n.select(this).selectAll("g.paths").selectAll("path.path"),t.dimensionSelection=n.select(this).selectAll("g.dimensions").selectAll("g.dimension")})),f.exit().remove()}function h(t){return t.key}function p(t){var e=t.parcatsViewModel.dimensions.length,r=t.parcatsViewModel.dimensions[e-1].model.dimensionInd;return t.model.dimensionInd===r}function d(t,e){return t.model.rawColor>e.model.rawColor?1:t.model.rawColor"),C=n.mouse(f)[0];a.loneHover({trace:h,x:b-d.left+g.left,y:w-d.top+g.top,text:E,color:t.model.color,borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontSize:10,fontColor:T,idealAlign:C1&&h.displayInd===f.dimensions.length-1?(i=c.left,a="left"):(i=c.left+c.width,a="right");var g=u.model.count,m=u.model.categoryLabel,v=g/u.parcatsViewModel.model.count,y={countLabel:g,categoryLabel:m,probabilityLabel:v.toFixed(3)},x=[];-1!==u.parcatsViewModel.hoverinfoItems.indexOf("count")&&x.push(["Count:",y.countLabel].join(" ")),-1!==u.parcatsViewModel.hoverinfoItems.indexOf("probability")&&x.push(["P("+y.categoryLabel+"):",y.probabilityLabel].join(" "));var b=x.join("
");return{trace:p,x:o*(i-e.left),y:s*(d-e.top),text:b,color:"lightgray",borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontSize:12,fontColor:"black",idealAlign:a,hovertemplate:p.hovertemplate,hovertemplateLabels:y,eventData:[{data:p._input,fullData:p,count:g,category:m,probability:v}]}}function E(t){if(!t.parcatsViewModel.dragDimension&&-1===t.parcatsViewModel.hoverinfoItems.indexOf("skip")){if(n.mouse(this)[1]<-1)return;var e,r=t.parcatsViewModel.graphDiv,i=r._fullLayout,s=i._paperdiv.node().getBoundingClientRect(),l=t.parcatsViewModel.hoveron;if("color"===l?(!function(t){var e=n.select(t).datum(),r=k(e);_(r),r.each((function(){o.raiseToTop(this)})),n.select(t.parentNode).selectAll("rect.bandrect").filter((function(t){return t.color===e.color})).each((function(){o.raiseToTop(this),n.select(this).attr("stroke","black").attr("stroke-width",1.5)}))}(this),A(this,"plotly_hover",n.event)):(!function(t){n.select(t.parentNode).selectAll("rect.bandrect").each((function(t){var e=k(t);_(e),e.each((function(){o.raiseToTop(this)}))})),n.select(t.parentNode).select("rect.catrect").attr("stroke","black").attr("stroke-width",2.5)}(this),M(this,"plotly_hover",n.event)),-1===t.parcatsViewModel.hoverinfoItems.indexOf("none"))"category"===l?e=S(r,s,this):"color"===l?e=function(t,e,r){t._fullLayout._calcInverseTransform(t);var i,a,o=t._fullLayout._invScaleX,s=t._fullLayout._invScaleY,l=r.getBoundingClientRect(),u=n.select(r).datum(),f=u.categoryViewModel,h=f.parcatsViewModel,p=h.model.dimensions[f.model.dimensionInd],d=h.trace,g=l.y+l.height/2;h.dimensions.length>1&&p.displayInd===h.dimensions.length-1?(i=l.left,a="left"):(i=l.left+l.width,a="right");var m=f.model.categoryLabel,v=u.parcatsViewModel.model.count,y=0;u.categoryViewModel.bands.forEach((function(t){t.color===u.color&&(y+=t.count)}));var x=f.model.count,b=0;h.pathSelection.each((function(t){t.model.color===u.color&&(b+=t.model.count)}));var _=y/v,w=y/b,T=y/x,k={countLabel:v,categoryLabel:m,probabilityLabel:_.toFixed(3)},M=[];-1!==f.parcatsViewModel.hoverinfoItems.indexOf("count")&&M.push(["Count:",k.countLabel].join(" ")),-1!==f.parcatsViewModel.hoverinfoItems.indexOf("probability")&&(M.push("P(color \u2229 "+m+"): "+k.probabilityLabel),M.push("P("+m+" | color): "+w.toFixed(3)),M.push("P(color | "+m+"): "+T.toFixed(3)));var A=M.join("
"),S=c.mostReadable(u.color,["black","white"]);return{trace:d,x:o*(i-e.left),y:s*(g-e.top),text:A,color:u.color,borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontColor:S,fontSize:10,idealAlign:a,hovertemplate:d.hovertemplate,hovertemplateLabels:k,eventData:[{data:d._input,fullData:d,category:m,count:v,probability:_,categorycount:x,colorcount:b,bandcolorcount:y}]}}(r,s,this):"dimension"===l&&(e=function(t,e,r){var i=[];return n.select(r.parentNode.parentNode).selectAll("g.category").select("rect.catrect").each((function(){i.push(S(t,e,this))})),i}(r,s,this)),e&&a.loneHover(e,{container:i._hoverlayer.node(),outerContainer:i._paper.node(),gd:r})}}function C(t){var e=t.parcatsViewModel;if(!e.dragDimension&&(b(e.pathSelection),w(e.dimensionSelection.selectAll("g.category")),T(e.dimensionSelection.selectAll("g.category").selectAll("rect.bandrect")),a.loneUnhover(e.graphDiv._fullLayout._hoverlayer.node()),e.pathSelection.sort(d),-1===e.hoverinfoItems.indexOf("skip"))){"color"===t.parcatsViewModel.hoveron?A(this,"plotly_unhover",n.event):M(this,"plotly_unhover",n.event)}}function L(t){"fixed"!==t.parcatsViewModel.arrangement&&(t.dragDimensionDisplayInd=t.model.displayInd,t.initialDragDimensionDisplayInds=t.parcatsViewModel.model.dimensions.map((function(t){return t.displayInd})),t.dragHasMoved=!1,t.dragCategoryDisplayInd=null,n.select(this).selectAll("g.category").select("rect.catrect").each((function(e){var r=n.mouse(this)[0],i=n.mouse(this)[1];-2<=r&&r<=e.width+2&&-2<=i&&i<=e.height+2&&(t.dragCategoryDisplayInd=e.model.displayInd,t.initialDragCategoryDisplayInds=t.model.categories.map((function(t){return t.displayInd})),e.model.dragY=e.y,o.raiseToTop(this.parentNode),n.select(this.parentNode).selectAll("rect.bandrect").each((function(e){e.yf.y+f.height/2&&(o.model.displayInd=f.model.displayInd,f.model.displayInd=l),t.dragCategoryDisplayInd=o.model.displayInd}if(null===t.dragCategoryDisplayInd||"freeform"===t.parcatsViewModel.arrangement){a.model.dragX=n.event.x;var h=t.parcatsViewModel.dimensions[r],p=t.parcatsViewModel.dimensions[i];void 0!==h&&a.model.dragXp.x&&(a.model.displayInd=p.model.displayInd,p.model.displayInd=t.dragDimensionDisplayInd),t.dragDimensionDisplayInd=a.model.displayInd}N(t.parcatsViewModel),B(t.parcatsViewModel),D(t.parcatsViewModel),O(t.parcatsViewModel)}}function P(t){if("fixed"!==t.parcatsViewModel.arrangement&&null!==t.dragDimensionDisplayInd){n.select(this).selectAll("text").attr("font-weight","normal");var e={},r=z(t.parcatsViewModel),a=t.parcatsViewModel.model.dimensions.map((function(t){return t.displayInd})),o=t.initialDragDimensionDisplayInds.some((function(t,e){return t!==a[e]}));o&&a.forEach((function(r,n){var i=t.parcatsViewModel.model.dimensions[n].containerInd;e["dimensions["+i+"].displayindex"]=r}));var s=!1;if(null!==t.dragCategoryDisplayInd){var l=t.model.categories.map((function(t){return t.displayInd}));if(s=t.initialDragCategoryDisplayInds.some((function(t,e){return t!==l[e]}))){var c=t.model.categories.slice().sort((function(t,e){return t.displayInd-e.displayInd})),u=c.map((function(t){return t.categoryValue})),f=c.map((function(t){return t.categoryLabel}));e["dimensions["+t.model.containerInd+"].categoryarray"]=[u],e["dimensions["+t.model.containerInd+"].ticktext"]=[f],e["dimensions["+t.model.containerInd+"].categoryorder"]="array"}}if(-1===t.parcatsViewModel.hoverinfoItems.indexOf("skip")&&!t.dragHasMoved&&t.potentialClickBand&&("color"===t.parcatsViewModel.hoveron?A(t.potentialClickBand,"plotly_click",n.event.sourceEvent):M(t.potentialClickBand,"plotly_click",n.event.sourceEvent)),t.model.dragX=null,null!==t.dragCategoryDisplayInd)t.parcatsViewModel.dimensions[t.dragDimensionDisplayInd].categories[t.dragCategoryDisplayInd].model.dragY=null,t.dragCategoryDisplayInd=null;t.dragDimensionDisplayInd=null,t.parcatsViewModel.dragDimension=null,t.dragHasMoved=null,t.potentialClickBand=null,N(t.parcatsViewModel),B(t.parcatsViewModel),n.transition().duration(300).ease("cubic-in-out").each((function(){D(t.parcatsViewModel,!0),O(t.parcatsViewModel,!0)})).each("end",(function(){(o||s)&&i.restyle(t.parcatsViewModel.graphDiv,e,[r])}))}}function z(t){for(var e,r=t.graphDiv._fullData,n=0;n=0;s--)u+="C"+c[s]+","+(e[s+1]+i)+" "+l[s]+","+(e[s]+i)+" "+(t[s]+r[s])+","+(e[s]+i),u+="l-"+r[s]+",0 ";return u+="Z"}function B(t){var e=t.dimensions,r=t.model,n=e.map((function(t){return t.categories.map((function(t){return t.y}))})),i=t.model.dimensions.map((function(t){return t.categories.map((function(t){return t.displayInd}))})),a=t.model.dimensions.map((function(t){return t.displayInd})),o=t.dimensions.map((function(t){return t.model.dimensionInd})),s=e.map((function(t){return t.x})),l=e.map((function(t){return t.width})),c=[];for(var u in r.paths)r.paths.hasOwnProperty(u)&&c.push(r.paths[u]);function f(t){var e=t.categoryInds.map((function(t,e){return i[e][t]}));return o.map((function(t){return e[t]}))}c.sort((function(e,r){var n=f(e),i=f(r);return"backward"===t.sortpaths&&(n.reverse(),i.reverse()),n.push(e.valueInds[0]),i.push(r.valueInds[0]),t.bundlecolors&&(n.unshift(e.rawColor),i.unshift(r.rawColor)),ni?1:0}));for(var h=new Array(c.length),p=e[0].model.count,d=e[0].categories.map((function(t){return t.height})).reduce((function(t,e){return t+e})),g=0;g0?d*(v.count/p):0;for(var y,x=new Array(n.length),b=0;b1?(t.width-80-16)/(n-1):0)*i;var a,o,s,l,c,u=[],f=t.model.maxCats,h=e.categories.length,p=e.count,d=t.height-8*(f-1),g=8*(f-h)/2,m=e.categories.map((function(t){return{displayInd:t.displayInd,categoryInd:t.categoryInd}}));for(m.sort((function(t,e){return t.displayInd-e.displayInd})),c=0;c0?o.count/p*d:0,s={key:o.valueInds[0],model:o,width:16,height:a,y:null!==o.dragY?o.dragY:g,bands:[],parcatsViewModel:t},g=g+a+8,u.push(s);return{key:e.dimensionInd,x:null!==e.dragX?e.dragX:r,y:0,width:16,model:e,categories:u,parcatsViewModel:t,dragCategoryDisplayInd:null,dragDimensionDisplayInd:null,initialDragDimensionDisplayInds:null,initialDragCategoryDisplayInds:null,dragHasMoved:null,potentialClickBand:null}}e.exports=function(t,e,r,n){f(r,t,n,e)}},{"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/svg_text_utils":802,"../../plot_api/plot_api":813,d3:169,tinycolor2:576}],1147:[function(t,e,r){"use strict";var n=t("./parcats");e.exports=function(t,e,r,i){var a=t._fullLayout,o=a._paper,s=a._size;n(t,o,e,{width:s.w,height:s.h,margin:{t:s.t,r:s.r,b:s.b,l:s.l}},r,i)}},{"./parcats":1146}],1148:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../../plots/cartesian/layout_attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/domain").attributes,s=t("../../lib/extend").extendFlat,l=t("../../plot_api/plot_template").templatedArray;e.exports={domain:o({name:"parcoords",trace:!0,editType:"plot"}),labelangle:{valType:"angle",dflt:0,editType:"plot"},labelside:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},labelfont:a({editType:"plot"}),tickfont:a({editType:"plot"}),rangefont:a({editType:"plot"}),dimensions:l("dimension",{label:{valType:"string",editType:"plot"},tickvals:s({},i.tickvals,{editType:"plot"}),ticktext:s({},i.ticktext,{editType:"plot"}),tickformat:s({},i.tickformat,{editType:"plot"}),visible:{valType:"boolean",dflt:!0,editType:"plot"},range:{valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],editType:"plot"},constraintrange:{valType:"info_array",freeLength:!0,dimensions:"1-2",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],editType:"plot"},multiselect:{valType:"boolean",dflt:!0,editType:"plot"},values:{valType:"data_array",editType:"calc"},editType:"calc"}),line:s({editType:"calc"},n("line",{colorscaleDflt:"Viridis",autoColorDflt:!1,editTypeOverride:"calc"}))}},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/plot_template":816,"../../plots/cartesian/layout_attributes":841,"../../plots/domain":854,"../../plots/font_attributes":855}],1149:[function(t,e,r){"use strict";var n=t("./constants"),i=t("d3"),a=t("../../lib/gup").keyFun,o=t("../../lib/gup").repeat,s=t("../../lib").sorterAsc,l=t("../../lib").strTranslate,c=n.bar.snapRatio;function u(t,e){return t*(1-c)+e*c}var f=n.bar.snapClose;function h(t,e){return t*(1-f)+e*f}function p(t,e,r,n){if(function(t,e){for(var r=0;r=e[r][0]&&t<=e[r][1])return!0;return!1}(r,n))return r;var i=t?-1:1,a=0,o=e.length-1;if(i<0){var s=a;a=o,o=s}for(var l=e[a],c=l,f=a;i*fe){h=r;break}}if(a=u,isNaN(a)&&(a=isNaN(f)||isNaN(h)?isNaN(f)?h:f:e-c[f][1]t[1]+r||e=.9*t[1]+.1*t[0]?"n":e<=.9*t[0]+.1*t[1]?"s":"ns"}(d,e);g&&(o.interval=l[a],o.intervalPix=d,o.region=g)}}if(t.ordinal&&!o.region){var m=t.unitTickvals,y=t.unitToPaddedPx.invert(e);for(r=0;r=x[0]&&y<=x[1]){o.clickableOrdinalRange=x;break}}}return o}function w(t,e){i.event.sourceEvent.stopPropagation();var r=e.height-i.mouse(t)[1]-2*n.verticalPadding,a=e.brush.svgBrush;a.wasDragged=!0,a._dragging=!0,a.grabbingBar?a.newExtent=[r-a.grabPoint,r+a.barLength-a.grabPoint].map(e.unitToPaddedPx.invert):a.newExtent=[a.startExtent,e.unitToPaddedPx.invert(r)].sort(s),e.brush.filterSpecified=!0,a.extent=a.stayingIntervals.concat([a.newExtent]),a.brushCallback(e),b(t.parentNode)}function T(t,e){var r=_(e,e.height-i.mouse(t)[1]-2*n.verticalPadding),a="crosshair";r.clickableOrdinalRange?a="pointer":r.region&&(a=r.region+"-resize"),i.select(document.body).style("cursor",a)}function k(t){t.on("mousemove",(function(t){i.event.preventDefault(),t.parent.inBrushDrag||T(this,t)})).on("mouseleave",(function(t){t.parent.inBrushDrag||y()})).call(i.behavior.drag().on("dragstart",(function(t){!function(t,e){i.event.sourceEvent.stopPropagation();var r=e.height-i.mouse(t)[1]-2*n.verticalPadding,a=e.unitToPaddedPx.invert(r),o=e.brush,s=_(e,r),l=s.interval,c=o.svgBrush;if(c.wasDragged=!1,c.grabbingBar="ns"===s.region,c.grabbingBar){var u=l.map(e.unitToPaddedPx);c.grabPoint=r-u[0]-n.verticalPadding,c.barLength=u[1]-u[0]}c.clickableOrdinalRange=s.clickableOrdinalRange,c.stayingIntervals=e.multiselect&&o.filterSpecified?o.filter.getConsolidated():[],l&&(c.stayingIntervals=c.stayingIntervals.filter((function(t){return t[0]!==l[0]&&t[1]!==l[1]}))),c.startExtent=s.region?l["s"===s.region?1:0]:a,e.parent.inBrushDrag=!0,c.brushStartCallback()}(this,t)})).on("drag",(function(t){w(this,t)})).on("dragend",(function(t){!function(t,e){var r=e.brush,n=r.filter,a=r.svgBrush;a._dragging||(T(t,e),w(t,e),e.brush.svgBrush.wasDragged=!1),a._dragging=!1,i.event.sourceEvent.stopPropagation();var o=a.grabbingBar;if(a.grabbingBar=!1,a.grabLocation=void 0,e.parent.inBrushDrag=!1,y(),!a.wasDragged)return a.wasDragged=void 0,a.clickableOrdinalRange?r.filterSpecified&&e.multiselect?a.extent.push(a.clickableOrdinalRange):(a.extent=[a.clickableOrdinalRange],r.filterSpecified=!0):o?(a.extent=a.stayingIntervals,0===a.extent.length&&A(r)):A(r),a.brushCallback(e),b(t.parentNode),void a.brushEndCallback(r.filterSpecified?n.getConsolidated():[]);var s=function(){n.set(n.getConsolidated())};if(e.ordinal){var l=e.unitTickvals;l[l.length-1]a.newExtent[0];a.extent=a.stayingIntervals.concat(c?[a.newExtent]:[]),a.extent.length||A(r),a.brushCallback(e),c?b(t.parentNode,s):(s(),b(t.parentNode))}else s();a.brushEndCallback(r.filterSpecified?n.getConsolidated():[])}(this,t)})))}function M(t,e){return t[0]-e[0]}function A(t){t.filterSpecified=!1,t.svgBrush.extent=[[-1/0,1/0]]}function S(t){for(var e,r=t.slice(),n=[],i=r.shift();i;){for(e=i.slice();(i=r.shift())&&i[0]<=e[1];)e[1]=Math.max(e[1],i[1]);n.push(e)}return 1===n.length&&n[0][0]>n[0][1]&&(n=[]),n}e.exports={makeBrush:function(t,e,r,n,i,a){var o,l=function(){var t,e,r=[];return{set:function(n){1===(r=n.map((function(t){return t.slice().sort(s)})).sort(M)).length&&r[0][0]===-1/0&&r[0][1]===1/0&&(r=[[0,-1]]),t=S(r),e=r.reduce((function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}),[1/0,-1/0])},get:function(){return r.slice()},getConsolidated:function(){return t},getBounds:function(){return e}}}();return l.set(r),{filter:l,filterSpecified:e,svgBrush:{extent:[],brushStartCallback:n,brushCallback:(o=i,function(t){var e=t.brush,r=function(t){return t.svgBrush.extent.map((function(t){return t.slice()}))}(e).slice();e.filter.set(r),o()}),brushEndCallback:a}}},ensureAxisBrush:function(t){var e=t.selectAll("."+n.cn.axisBrush).data(o,a);e.enter().append("g").classed(n.cn.axisBrush,!0),function(t){var e=t.selectAll(".background").data(o);e.enter().append("rect").classed("background",!0).call(d).call(g).style("pointer-events","auto").attr("transform",l(0,n.verticalPadding)),e.call(k).attr("height",(function(t){return t.height-n.verticalPadding}));var r=t.selectAll(".highlight-shadow").data(o);r.enter().append("line").classed("highlight-shadow",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width+n.bar.strokeWidth).attr("stroke",n.bar.strokeColor).attr("opacity",n.bar.strokeOpacity).attr("stroke-linecap","butt"),r.attr("y1",(function(t){return t.height})).call(x);var i=t.selectAll(".highlight").data(o);i.enter().append("line").classed("highlight",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width-n.bar.strokeWidth).attr("stroke",n.bar.fillColor).attr("opacity",n.bar.fillOpacity).attr("stroke-linecap","butt"),i.attr("y1",(function(t){return t.height})).call(x)}(e)},cleanRanges:function(t,e){if(Array.isArray(t[0])?(t=t.map((function(t){return t.sort(s)})),t=e.multiselect?S(t.sort(M)):[t[0]]):t=[t.sort(s)],e.tickvals){var r=e.tickvals.slice().sort(s);if(!(t=t.map((function(t){var e=[p(0,r,t[0],[]),p(1,r,t[1],[])];if(e[1]>e[0])return e})).filter((function(t){return t}))).length)return}return t.length>1?t:t[0]}}},{"../../lib":778,"../../lib/gup":775,"./constants":1152,d3:169}],1150:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/get_data").getModuleCalcData,a=t("./plot"),o=t("../../constants/xmlns_namespaces");r.name="parcoords",r.plot=function(t){var e=i(t.calcdata,"parcoords")[0];e.length&&a(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("parcoords"),a=e._has&&e._has("parcoords");i&&!a&&(n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){var e=t._fullLayout._glimages,r=n.select(t).selectAll(".svg-container");r.filter((function(t,e){return e===r.size()-1})).selectAll(".gl-canvas-context, .gl-canvas-focus").each((function(){var t=this.toDataURL("image/png");e.append("svg:image").attr({xmlns:o.svg,"xlink:href":t,preserveAspectRatio:"none",x:0,y:0,width:this.width,height:this.height})})),window.setTimeout((function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")}),60)}},{"../../constants/xmlns_namespaces":754,"../../plots/get_data":864,"./plot":1159,d3:169}],1151:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,i=t("../../components/colorscale"),a=t("../../lib/gup").wrap;e.exports=function(t,e){var r,o;return i.hasColorscale(e,"line")&&n(e.line.color)?(r=e.line.color,o=i.extractOpts(e.line).colorscale,i.calc(t,e,{vals:r,containerStr:"line",cLetter:"c"})):(r=function(t){for(var e=new Array(t),r=0;rf&&(n.log("parcoords traces support up to "+f+" dimensions at the moment"),d.splice(f));var g=s(t,e,{name:"dimensions",layout:l,handleItemDefaults:p}),m=function(t,e,r,o,s){var l=s("line.color",r);if(i(t,"line")&&n.isArrayOrTypedArray(l)){if(l.length)return s("line.colorscale"),a(t,e,o,s,{prefix:"line.",cLetter:"c"}),l.length;e.line.color=r}return 1/0}(t,e,r,l,u);o(e,l,u),Array.isArray(g)&&g.length||(e.visible=!1),h(e,g,"values",m);var v={family:l.font.family,size:Math.round(l.font.size/1.2),color:l.font.color};n.coerceFont(u,"labelfont",v),n.coerceFont(u,"tickfont",v),n.coerceFont(u,"rangefont",v),u("labelangle"),u("labelside")}},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778,"../../plots/array_container_defaults":822,"../../plots/cartesian/axes":827,"../../plots/domain":854,"./attributes":1148,"./axisbrush":1149,"./constants":1152,"./merge_length":1157}],1154:[function(t,e,r){"use strict";var n=t("../../lib").isTypedArray;r.convertTypedArray=function(t){return n(t)?Array.prototype.slice.call(t):t},r.isOrdinal=function(t){return!!t.tickvals},r.isVisible=function(t){return t.visible||!("visible"in t)}},{"../../lib":778}],1155:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcoords",basePlotModule:t("./base_plot"),categories:["gl","regl","noOpacity","noHover"],meta:{}}},{"./attributes":1148,"./base_plot":1150,"./calc":1151,"./defaults":1153,"./plot":1159}],1156:[function(t,e,r){"use strict";var n=t("glslify"),i=n(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nattribute vec4 p01_04, p05_08, p09_12, p13_16,\n p17_20, p21_24, p25_28, p29_32,\n p33_36, p37_40, p41_44, p45_48,\n p49_52, p53_56, p57_60, colors;\n\nuniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution, viewBoxPos, viewBoxSize;\nuniform sampler2D mask, palette;\nuniform float maskHeight;\nuniform float drwLayer; // 0: context, 1: focus, 2: pick\nuniform vec4 contextColor;\n\nbool isPick = (drwLayer > 1.5);\nbool isContext = (drwLayer < 0.5);\n\nconst vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0);\nconst vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * UNITS, UNITS);\n}\n\nfloat axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) {\n float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D);\n float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D);\n return y1 * (1.0 - ratio) + y2 * ratio;\n}\n\nint iMod(int a, int b) {\n return a - b * (a / b);\n}\n\nbool fOutside(float p, float lo, float hi) {\n return (lo < hi) && (lo > p || p > hi);\n}\n\nbool vOutside(vec4 p, vec4 lo, vec4 hi) {\n return (\n fOutside(p[0], lo[0], hi[0]) ||\n fOutside(p[1], lo[1], hi[1]) ||\n fOutside(p[2], lo[2], hi[2]) ||\n fOutside(p[3], lo[3], hi[3])\n );\n}\n\nbool mOutside(mat4 p, mat4 lo, mat4 hi) {\n return (\n vOutside(p[0], lo[0], hi[0]) ||\n vOutside(p[1], lo[1], hi[1]) ||\n vOutside(p[2], lo[2], hi[2]) ||\n vOutside(p[3], lo[3], hi[3])\n );\n}\n\nbool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) {\n return mOutside(A, loA, hiA) ||\n mOutside(B, loB, hiB) ||\n mOutside(C, loC, hiC) ||\n mOutside(D, loD, hiD);\n}\n\nbool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) {\n mat4 pnts[4];\n pnts[0] = A;\n pnts[1] = B;\n pnts[2] = C;\n pnts[3] = D;\n\n for(int i = 0; i < 4; ++i) {\n for(int j = 0; j < 4; ++j) {\n for(int k = 0; k < 4; ++k) {\n if(0 == iMod(\n int(255.0 * texture2D(mask,\n vec2(\n (float(i * 2 + j / 2) + 0.5) / 8.0,\n (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight\n ))[3]\n ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))),\n 2\n )) return true;\n }\n }\n }\n return false;\n}\n\nvec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) {\n float x = 0.5 * sign(v) + 0.5;\n float y = axisY(x, A, B, C, D);\n float z = 1.0 - abs(v);\n\n z += isContext ? 0.0 : 2.0 * float(\n outsideBoundingBox(A, B, C, D) ||\n outsideRasterMask(A, B, C, D)\n );\n\n return vec4(\n 2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0,\n z,\n 1.0\n );\n}\n\nvoid main() {\n mat4 A = mat4(p01_04, p05_08, p09_12, p13_16);\n mat4 B = mat4(p17_20, p21_24, p25_28, p29_32);\n mat4 C = mat4(p33_36, p37_40, p41_44, p45_48);\n mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS);\n\n float v = colors[3];\n\n gl_Position = position(isContext, v, A, B, C, D);\n\n fragColor =\n isContext ? vec4(contextColor) :\n isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5));\n}\n"]),a=n(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}\n"]),o=t("./constants").maxDimensionCount,s=t("../../lib"),l=new Uint8Array(4),c=new Uint8Array(4),u={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function f(t,e,r,n,i){var a=t._gl;a.enable(a.SCISSOR_TEST),a.scissor(e,r,n,i),t.clear({color:[0,0,0,0],depth:1})}function h(t,e,r,n,i,a){var o=a.key;r.drawCompleted||(!function(t){t.read({x:0,y:0,width:1,height:1,data:l})}(t),r.drawCompleted=!0),function s(l){var c=Math.min(n,i-l*n);0===l&&(window.cancelAnimationFrame(r.currentRafs[o]),delete r.currentRafs[o],f(t,a.scissorX,a.scissorY,a.scissorWidth,a.viewBoxSize[1])),r.clearOnly||(a.count=2*c,a.offset=2*l*n,e(a),l*n+c>>8*e)%256/255}function g(t,e,r){for(var n=new Array(8*e),i=0,a=0;au&&(u=t[i].dim1.canvasX,o=i);0===s&&f(T,0,0,r.canvasWidth,r.canvasHeight);var p=function(t){var e,r,n,i=[[],[]];for(n=0;n<64;n++){var a=!t&&ni._length&&(A=A.slice(0,i._length));var E,C=i.tickvals;function L(t,e){return{val:t,text:E[e]}}function I(t,e){return t.val-e.val}if(Array.isArray(C)&&C.length){E=i.ticktext,Array.isArray(E)&&E.length?E.length>C.length?E=E.slice(0,C.length):C.length>E.length&&(C=C.slice(0,E.length)):E=C.map(n.format(i.tickformat));for(var P=1;P=r||l>=a)return;var c=t.lineLayer.readPixel(s,a-1-l),u=0!==c[3],f=u?c[2]+256*(c[1]+256*c[0]):null,h={x:s,y:l,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:f};f!==R&&(u?i.hover(h):i.unhover&&i.unhover(h),R=f)}})),D.style("opacity",(function(t){return t.pick?0:1})),h.style("background","rgba(255, 255, 255, 0)");var F=h.selectAll("."+v.cn.parcoords).data(A,p);F.exit().remove(),F.enter().append("g").classed(v.cn.parcoords,!0).style("shape-rendering","crispEdges").style("pointer-events","none"),F.attr("transform",(function(t){return l(t.model.translateX,t.model.translateY)}));var B=F.selectAll("."+v.cn.parcoordsControlView).data(d,p);B.enter().append("g").classed(v.cn.parcoordsControlView,!0),B.attr("transform",(function(t){return l(t.model.pad.l,t.model.pad.t)}));var N=B.selectAll("."+v.cn.yAxis).data((function(t){return t.dimensions}),p);N.enter().append("g").classed(v.cn.yAxis,!0),B.each((function(t){P(N,t)})),D.each((function(t){if(t.viewModel){!t.lineLayer||i?t.lineLayer=x(this,t):t.lineLayer.update(t),(t.key||0===t.key)&&(t.viewModel[t.key]=t.lineLayer);var e=!t.context||i;t.lineLayer.render(t.viewModel.panels,e)}})),N.attr("transform",(function(t){return l(t.xScale(t.xIndex),0)})),N.call(n.behavior.drag().origin((function(t){return t})).on("drag",(function(t){var e=t.parent;M.linePickActive(!1),t.x=Math.max(-v.overdrag,Math.min(t.model.width+v.overdrag,n.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,N.sort((function(t,e){return t.x-e.x})).each((function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio})),P(N,e),N.filter((function(e){return 0!==Math.abs(t.xIndex-e.xIndex)})).attr("transform",(function(t){return l(t.xScale(t.xIndex),0)})),n.select(this).attr("transform",l(t.x,0)),N.each((function(r,n,i){i===t.parent.key&&(e.dimensions[n]=r)})),e.contextLayer&&e.contextLayer.render(e.panels,!1,!S(e)),e.focusLayer.render&&e.focusLayer.render(e.panels)})).on("dragend",(function(t){var e=t.parent;t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,P(N,e),n.select(this).attr("transform",(function(t){return l(t.x,0)})),e.contextLayer&&e.contextLayer.render(e.panels,!1,!S(e)),e.focusLayer&&e.focusLayer.render(e.panels),e.pickLayer&&e.pickLayer.render(e.panels,!0),M.linePickActive(!0),i&&i.axesMoved&&i.axesMoved(e.key,e.dimensions.map((function(t){return t.crossfilterDimensionIndex})))}))),N.exit().remove();var j=N.selectAll("."+v.cn.axisOverlays).data(d,p);j.enter().append("g").classed(v.cn.axisOverlays,!0),j.selectAll("."+v.cn.axis).remove();var U=j.selectAll("."+v.cn.axis).data(d,p);U.enter().append("g").classed(v.cn.axis,!0),U.each((function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,i=r.domain();n.select(this).call(n.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?i:null).tickFormat((function(e){return m.isOrdinal(t)?e:z(t.model.dimensions[t.visibleIndex],e)})).scale(r)),u.font(U.selectAll("text"),t.model.tickFont)})),U.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),U.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default");var V=j.selectAll("."+v.cn.axisHeading).data(d,p);V.enter().append("g").classed(v.cn.axisHeading,!0);var q=V.selectAll("."+v.cn.axisTitle).data(d,p);q.enter().append("text").classed(v.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("pointer-events","auto"),q.text((function(t){return t.label})).each((function(e){var r=n.select(this);u.font(r,e.model.labelFont),c.convertToTspans(r,t)})).attr("transform",(function(t){var e=I(t.model.labelAngle,t.model.labelSide),r=v.axisTitleOffset;return(e.dir>0?"":l(0,2*r+t.model.height))+s(e.degrees)+l(-r*e.dx,-r*e.dy)})).attr("text-anchor",(function(t){var e=I(t.model.labelAngle,t.model.labelSide);return 2*Math.abs(e.dx)>Math.abs(e.dy)?e.dir*e.dx<0?"start":"end":"middle"}));var H=j.selectAll("."+v.cn.axisExtent).data(d,p);H.enter().append("g").classed(v.cn.axisExtent,!0);var G=H.selectAll("."+v.cn.axisExtentTop).data(d,p);G.enter().append("g").classed(v.cn.axisExtentTop,!0),G.attr("transform",l(0,-v.axisExtentOffset));var Y=G.selectAll("."+v.cn.axisExtentTopText).data(d,p);Y.enter().append("text").classed(v.cn.axisExtentTopText,!0).call(L),Y.text((function(t){return O(t,!0)})).each((function(t){u.font(n.select(this),t.model.rangeFont)}));var W=H.selectAll("."+v.cn.axisExtentBottom).data(d,p);W.enter().append("g").classed(v.cn.axisExtentBottom,!0),W.attr("transform",(function(t){return l(0,t.model.height+v.axisExtentOffset)}));var X=W.selectAll("."+v.cn.axisExtentBottomText).data(d,p);X.enter().append("text").classed(v.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(L),X.text((function(t){return O(t,!1)})).each((function(t){u.font(n.select(this),t.model.rangeFont)})),y.ensureAxisBrush(j)}},{"../../components/colorscale":655,"../../components/drawing":665,"../../lib":778,"../../lib/gup":775,"../../lib/svg_text_utils":802,"../../plots/cartesian/axes":827,"./axisbrush":1149,"./constants":1152,"./helpers":1154,"./lines":1156,"color-rgba":127,d3:169}],1159:[function(t,e,r){"use strict";var n=t("./parcoords"),i=t("../../lib/prepare_regl"),a=t("./helpers").isVisible;function o(t,e,r){var n=e.indexOf(r),i=t.indexOf(n);return-1===i&&(i+=e.length),i}e.exports=function(t,e){var r=t._fullLayout;if(i(t)){var s={},l={},c={},u={},f=r._size;e.forEach((function(e,r){var n=e[0].trace;c[r]=n.index;var i=u[r]=n._fullInput.index;s[r]=t.data[i].dimensions,l[r]=t.data[i].dimensions.slice()}));n(t,e,{width:f.w,height:f.h,margin:{t:f.t,r:f.r,b:f.b,l:f.l}},{filterChanged:function(e,n,i){var a=l[e][n],o=i.map((function(t){return t.slice()})),s="dimensions["+n+"].constraintrange",f=r._tracePreGUI[t._fullData[c[e]]._fullInput.uid];if(void 0===f[s]){var h=a.constraintrange;f[s]=h||null}var p=t._fullData[c[e]].dimensions[n];o.length?(1===o.length&&(o=o[0]),a.constraintrange=o,p.constraintrange=o.slice(),o=[o]):(delete a.constraintrange,delete p.constraintrange,o=null);var d={};d[s]=o,t.emit("plotly_restyle",[d,[u[e]]])},hover:function(e){t.emit("plotly_hover",e)},unhover:function(e){t.emit("plotly_unhover",e)},axesMoved:function(e,r){var n=function(t,e){return function(r,n){return o(t,e,r)-o(t,e,n)}}(r,l[e].filter(a));s[e].sort(n),l[e].filter((function(t){return!a(t)})).sort((function(t){return l[e].indexOf(t)})).forEach((function(t){s[e].splice(s[e].indexOf(t),1),s[e].splice(l[e].indexOf(t),0,t)})),t.emit("plotly_restyle",[{dimensions:[s[e]]},[u[e]]])}})}}},{"../../lib/prepare_regl":791,"./helpers":1154,"./parcoords":1158}],1160:[function(t,e,r){"use strict";var n=t("../../plots/attributes"),i=t("../../plots/domain").attributes,a=t("../../plots/font_attributes"),o=t("../../components/color/attributes"),s=t("../../plots/template_attributes").hovertemplateAttrs,l=t("../../plots/template_attributes").texttemplateAttrs,c=t("../../lib/extend").extendFlat,u=a({editType:"plot",arrayOk:!0,colorEditType:"plot"});e.exports={labels:{valType:"data_array",editType:"calc"},label0:{valType:"number",dflt:0,editType:"calc"},dlabel:{valType:"number",dflt:1,editType:"calc"},values:{valType:"data_array",editType:"calc"},marker:{colors:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:o.defaultLine,arrayOk:!0,editType:"style"},width:{valType:"number",min:0,dflt:0,arrayOk:!0,editType:"style"},editType:"calc"},editType:"calc"},text:{valType:"data_array",editType:"plot"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"style"},scalegroup:{valType:"string",dflt:"",editType:"calc"},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"],editType:"calc"},hoverinfo:c({},n.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:s({},{keys:["label","color","value","percent","text"]}),texttemplate:l({editType:"plot"},{keys:["label","color","value","percent","text"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,editType:"plot"},textfont:c({},u,{}),insidetextorientation:{valType:"enumerated",values:["horizontal","radial","tangential","auto"],dflt:"auto",editType:"plot"},insidetextfont:c({},u,{}),outsidetextfont:c({},u,{}),automargin:{valType:"boolean",dflt:!1,editType:"plot"},title:{text:{valType:"string",dflt:"",editType:"plot"},font:c({},u,{}),position:{valType:"enumerated",values:["top left","top center","top right","middle center","bottom left","bottom center","bottom right"],editType:"plot"},editType:"plot"},domain:i({name:"pie",trace:!0,editType:"calc"}),hole:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},sort:{valType:"boolean",dflt:!0,editType:"calc"},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"number",min:-360,max:360,dflt:0,editType:"calc"},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0,editType:"calc"},_deprecated:{title:{valType:"string",dflt:"",editType:"calc"},titlefont:c({},u,{}),titleposition:{valType:"enumerated",values:["top left","top center","top right","middle center","bottom left","bottom center","bottom right"],editType:"calc"}}}},{"../../components/color/attributes":642,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/font_attributes":855,"../../plots/template_attributes":905}],1161:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.name="pie",r.plot=function(t,e,i,a){n.plotBasePlot(r.name,t,e,i,a)},r.clean=function(t,e,i,a){n.cleanBasePlot(r.name,t,e,i,a)}},{"../../plots/plots":890}],1162:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../../components/color"),o={};function s(t){return function(e,r){return!!e&&(!!(e=i(e)).isValid()&&(e=a.addOpacity(e,e.getAlpha()),t[r]||(t[r]=e),e))}}function l(t,e){var r,n=JSON.stringify(t),a=e[n];if(!a){for(a=t.slice(),r=0;r0){s=!0;break}}s||(o=0)}return{hasLabels:r,hasValues:a,len:o}}e.exports={handleLabelsAndValues:l,supplyDefaults:function(t,e,r,n){function c(r,n){return i.coerce(t,e,a,r,n)}var u=l(c("labels"),c("values")),f=u.len;if(e._hasLabels=u.hasLabels,e._hasValues=u.hasValues,!e._hasLabels&&e._hasValues&&(c("label0"),c("dlabel")),f){e._length=f,c("marker.line.width")&&c("marker.line.color"),c("marker.colors"),c("scalegroup");var h,p=c("text"),d=c("texttemplate");if(d||(h=c("textinfo",Array.isArray(p)?"text+percent":"percent")),c("hovertext"),c("hovertemplate"),d||h&&"none"!==h){var g=c("textposition");s(t,e,n,c,g,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(g)||"auto"===g||"outside"===g)&&c("automargin"),("inside"===g||"auto"===g||Array.isArray(g))&&c("insidetextorientation")}o(e,n,c);var m=c("hole");if(c("title.text")){var v=c("title.position",m?"middle center":"top center");m||"middle center"!==v||(e.title.position="top center"),i.coerceFont(c,"title.font",n.font)}c("sort"),c("direction"),c("rotation"),c("pull")}else e.visible=!1}}},{"../../lib":778,"../../plots/domain":854,"../bar/defaults":924,"./attributes":1160,"fast-isnumeric":241}],1164:[function(t,e,r){"use strict";var n=t("../../components/fx/helpers").appendArrayMultiPointValues;e.exports=function(t,e){var r={curveNumber:e.index,pointNumbers:t.pts,data:e._input,fullData:e,label:t.label,color:t.color,value:t.v,percent:t.percent,text:t.text,v:t.v};return 1===t.pts.length&&(r.pointNumber=r.i=t.pts[0]),n(r,e,t.pts),"funnelarea"===e.type&&(delete r.v,delete r.i),r}},{"../../components/fx/helpers":679}],1165:[function(t,e,r){"use strict";var n=t("../../lib");function i(t){return-1!==t.indexOf("e")?t.replace(/[.]?0+e/,"e"):-1!==t.indexOf(".")?t.replace(/[.]?0+$/,""):t}r.formatPiePercent=function(t,e){var r=i((100*t).toPrecision(3));return n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=i(t.toPrecision(10));return n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;r"),name:u.hovertemplate||-1!==f.indexOf("name")?u.name:void 0,idealAlign:t.pxmid[0]<0?"left":"right",color:m.castOption(b.bgcolor,t.pts)||t.color,borderColor:m.castOption(b.bordercolor,t.pts),fontFamily:m.castOption(_.family,t.pts),fontSize:m.castOption(_.size,t.pts),fontColor:m.castOption(_.color,t.pts),nameLength:m.castOption(b.namelength,t.pts),textAlign:m.castOption(b.align,t.pts),hovertemplate:m.castOption(u.hovertemplate,t.pts),hovertemplateLabels:t,eventData:[v(t,u)]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:e}),o._hasHoverLabel=!0}o._hasHoverEvent=!0,e.emit("plotly_hover",{points:[v(t,u)],event:n.event})}})),t.on("mouseout",(function(t){var r=e._fullLayout,i=e._fullData[o.index],s=n.select(this).datum();o._hasHoverEvent&&(t.originalEvent=n.event,e.emit("plotly_unhover",{points:[v(s,i)],event:n.event}),o._hasHoverEvent=!1),o._hasHoverLabel&&(a.loneUnhover(r._hoverlayer.node()),o._hasHoverLabel=!1)})),t.on("click",(function(t){var r=e._fullLayout,i=e._fullData[o.index];e._dragging||!1===r.hovermode||(e._hoverdata=[v(t,i)],a.click(e,n.event))}))}function b(t,e,r){var n=m.castOption(t.insidetextfont.color,e.pts);!n&&t._input.textfont&&(n=m.castOption(t._input.textfont.color,e.pts));var i=m.castOption(t.insidetextfont.family,e.pts)||m.castOption(t.textfont.family,e.pts)||r.family,a=m.castOption(t.insidetextfont.size,e.pts)||m.castOption(t.textfont.size,e.pts)||r.size;return{color:n||o.contrast(e.color),family:i,size:a}}function _(t,e){for(var r,n,i=0;ie&&e>n||r=-4;m-=2)v(Math.PI*m,"tan");for(m=4;m>=-4;m-=2)v(Math.PI*(m+1),"tan")}if(f||p){for(m=4;m>=-4;m-=2)v(Math.PI*(m+1.5),"rad");for(m=4;m>=-4;m-=2)v(Math.PI*(m+.5),"rad")}}if(s||d||f){var y=Math.sqrt(t.width*t.width+t.height*t.height);if((a={scale:i*n*2/y,rCenter:1-i,rotate:0}).textPosAngle=(e.startangle+e.stopangle)/2,a.scale>=1)return a;g.push(a)}(d||p)&&((a=T(t,n,o,l,c)).textPosAngle=(e.startangle+e.stopangle)/2,g.push(a)),(d||h)&&((a=k(t,n,o,l,c)).textPosAngle=(e.startangle+e.stopangle)/2,g.push(a));for(var x=0,b=0,_=0;_=1)break}return g[x]}function T(t,e,r,n,i){e=Math.max(0,e-2*g);var a=t.width/t.height,o=S(a,n,e,r);return{scale:2*o/t.height,rCenter:M(a,o/e),rotate:A(i)}}function k(t,e,r,n,i){e=Math.max(0,e-2*g);var a=t.height/t.width,o=S(a,n,e,r);return{scale:2*o/t.width,rCenter:M(a,o/e),rotate:A(i+Math.PI/2)}}function M(t,e){return Math.cos(e)-t*e}function A(t){return(180/Math.PI*t+720)%180-90}function S(t,e,r,n){var i=t+1/(2*Math.tan(e));return r*Math.min(1/(Math.sqrt(i*i+.5)+i),n/(Math.sqrt(t*t+n/2)+t))}function E(t,e){return t.v!==e.vTotal||e.trace.hole?Math.min(1/(1+1/Math.sin(t.halfangle)),t.ring/2):1}function C(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,a=t.height/2;return r<0&&(i*=-1),n<0&&(a*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(a)*(i>0?1:-1)/2,y:a/(1+r*r/(n*n)),outside:!0}}function L(t,e){var r,n,i,a=t.trace,o={x:t.cx,y:t.cy},s={tx:0,ty:0};s.ty+=a.title.font.size,i=P(a),-1!==a.title.position.indexOf("top")?(o.y-=(1+i)*t.r,s.ty-=t.titleBox.height):-1!==a.title.position.indexOf("bottom")&&(o.y+=(1+i)*t.r);var l,c,u=(l=t.r,c=t.trace.aspectratio,l/(void 0===c?1:c)),f=e.w*(a.domain.x[1]-a.domain.x[0])/2;return-1!==a.title.position.indexOf("left")?(f+=u,o.x-=(1+i)*u,s.tx+=t.titleBox.width/2):-1!==a.title.position.indexOf("center")?f*=2:-1!==a.title.position.indexOf("right")&&(f+=u,o.x+=(1+i)*u,s.tx-=t.titleBox.width/2),r=f/t.titleBox.width,n=I(t,e)/t.titleBox.height,{x:o.x,y:o.y,scale:Math.min(r,n),tx:s.tx,ty:s.ty}}function I(t,e){var r=t.trace,n=e.h*(r.domain.y[1]-r.domain.y[0]);return Math.min(t.titleBox.height,n/2)}function P(t){var e,r=t.pull;if(!r)return 0;if(Array.isArray(r))for(r=0,e=0;er&&(r=t.pull[e]);return r}function z(t,e){for(var r=[],n=0;n1?(c=r.r,u=c/i.aspectratio):(u=r.r,c=u*i.aspectratio),c*=(1+i.baseratio)/2,l=c*u}o=Math.min(o,l/r.vTotal)}for(n=0;n")}if(a){var x=l.castOption(i,e.i,"texttemplate");if(x){var b=function(t){return{label:t.label,value:t.v,valueLabel:m.formatPieValue(t.v,n.separators),percent:t.v/r.vTotal,percentLabel:m.formatPiePercent(t.v/r.vTotal,n.separators),color:t.color,text:t.text,customdata:l.castOption(i,t.i,"customdata")}}(e),_=m.getFirstFilled(i.text,e.pts);(y(_)||""===_)&&(b.text=_),e.text=l.texttemplateString(x,b,t._fullLayout._d3locale,b,i._meta||{})}else e.text=""}}function R(t,e){var r=t.rotate*Math.PI/180,n=Math.cos(r),i=Math.sin(r),a=(e.left+e.right)/2,o=(e.top+e.bottom)/2;t.textX=a*n-o*i,t.textY=a*i+o*n,t.noCenter=!0}e.exports={plot:function(t,e){var r=t._fullLayout,a=r._size;d("pie",r),_(e,t),z(e,a);var h=l.makeTraceGroups(r._pielayer,e,"trace").each((function(e){var h=n.select(this),d=e[0],g=d.trace;!function(t){var e,r,n,i=t[0],a=i.r,o=i.trace,s=m.getRotationAngle(o.rotation),l=2*Math.PI/i.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(e=0;ei.vTotal/2?1:0,r.halfangle=Math.PI*Math.min(r.v/i.vTotal,.5),r.ring=1-o.hole,r.rInscribed=E(r,i))}(e),h.attr("stroke-linejoin","round"),h.each((function(){var v=n.select(this).selectAll("g.slice").data(e);v.enter().append("g").classed("slice",!0),v.exit().remove();var y=[[[],[]],[[],[]]],_=!1;v.each((function(i,a){if(i.hidden)n.select(this).selectAll("path,g").remove();else{i.pointNumber=i.i,i.curveNumber=g.index,y[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var o=d.cx,c=d.cy,u=n.select(this),h=u.selectAll("path.surface").data([i]);if(h.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),u.call(x,t,e),g.pull){var v=+m.castOption(g.pull,i.pts)||0;v>0&&(o+=v*i.pxmid[0],c+=v*i.pxmid[1])}i.cxFinal=o,i.cyFinal=c;var T=g.hole;if(i.v===d.vTotal){var k="M"+(o+i.px0[0])+","+(c+i.px0[1])+L(i.px0,i.pxmid,!0,1)+L(i.pxmid,i.px0,!0,1)+"Z";T?h.attr("d","M"+(o+T*i.px0[0])+","+(c+T*i.px0[1])+L(i.px0,i.pxmid,!1,T)+L(i.pxmid,i.px0,!1,T)+"Z"+k):h.attr("d",k)}else{var M=L(i.px0,i.px1,!0,1);if(T){var A=1-T;h.attr("d","M"+(o+T*i.px1[0])+","+(c+T*i.px1[1])+L(i.px1,i.px0,!1,T)+"l"+A*i.px0[0]+","+A*i.px0[1]+M+"Z")}else h.attr("d","M"+o+","+c+"l"+i.px0[0]+","+i.px0[1]+M+"Z")}D(t,i,d);var S=m.castOption(g.textposition,i.pts),E=u.selectAll("g.slicetext").data(i.text&&"none"!==S?[0]:[]);E.enter().append("g").classed("slicetext",!0),E.exit().remove(),E.each((function(){var u=l.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),h=l.ensureUniformFontSize(t,"outside"===S?function(t,e,r){var n=m.castOption(t.outsidetextfont.color,e.pts)||m.castOption(t.textfont.color,e.pts)||r.color,i=m.castOption(t.outsidetextfont.family,e.pts)||m.castOption(t.textfont.family,e.pts)||r.family,a=m.castOption(t.outsidetextfont.size,e.pts)||m.castOption(t.textfont.size,e.pts)||r.size;return{color:n,family:i,size:a}}(g,i,r.font):b(g,i,r.font));u.text(i.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(s.font,h).call(f.convertToTspans,t);var v,y=s.bBox(u.node());if("outside"===S)v=C(y,i);else if(v=w(y,i,d),"auto"===S&&v.scale<1){var x=l.ensureUniformFontSize(t,g.outsidetextfont);u.call(s.font,x),v=C(y=s.bBox(u.node()),i)}var T=v.textPosAngle,k=void 0===T?i.pxmid:O(d.r,T);if(v.targetX=o+k[0]*v.rCenter+(v.x||0),v.targetY=c+k[1]*v.rCenter+(v.y||0),R(v,y),v.outside){var M=v.targetY;i.yLabelMin=M-y.height/2,i.yLabelMid=M,i.yLabelMax=M+y.height/2,i.labelExtraX=0,i.labelExtraY=0,_=!0}v.fontSize=h.size,p(g.type,v,r),e[a].transform=v,u.attr("transform",l.getTextTransform(v))}))}function L(t,e,r,n){var a=n*(e[0]-t[0]),o=n*(e[1]-t[1]);return"a"+n*d.r+","+n*d.r+" 0 "+i.largeArc+(r?" 1 ":" 0 ")+a+","+o}}));var T=n.select(this).selectAll("g.titletext").data(g.title.text?[0]:[]);if(T.enter().append("g").classed("titletext",!0),T.exit().remove(),T.each((function(){var e,r=l.ensureSingle(n.select(this),"text","",(function(t){t.attr("data-notex",1)})),i=g.title.text;g._meta&&(i=l.templateString(i,g._meta)),r.text(i).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(s.font,g.title.font).call(f.convertToTspans,t),e="middle center"===g.title.position?function(t){var e=Math.sqrt(t.titleBox.width*t.titleBox.width+t.titleBox.height*t.titleBox.height);return{x:t.cx,y:t.cy,scale:t.trace.hole*t.r*2/e,tx:0,ty:-t.titleBox.height/2+t.trace.title.font.size}}(d):L(d,a),r.attr("transform",u(e.x,e.y)+c(Math.min(1,e.scale))+u(e.tx,e.ty))})),_&&function(t,e){var r,n,i,a,o,s,l,c,u,f,h,p,d;function g(t,e){return t.pxmid[1]-e.pxmid[1]}function v(t,e){return e.pxmid[1]-t.pxmid[1]}function y(t,r){r||(r={});var i,c,u,h,p=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),d=n?t.yLabelMin:t.yLabelMax,g=n?t.yLabelMax:t.yLabelMin,v=t.cyFinal+o(t.px0[1],t.px1[1]),y=p-d;if(y*l>0&&(t.labelExtraY=y),Array.isArray(e.pull))for(c=0;c=(m.castOption(e.pull,u.pts)||0)||((t.pxmid[1]-u.pxmid[1])*l>0?(y=u.cyFinal+o(u.px0[1],u.px1[1])-d-t.labelExtraY)*l>0&&(t.labelExtraY+=y):(g+t.labelExtraY-v)*l>0&&(i=3*s*Math.abs(c-f.indexOf(t)),(h=u.cxFinal+a(u.px0[0],u.px1[0])+i-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*s>0&&(t.labelExtraX+=h)))}for(n=0;n<2;n++)for(i=n?g:v,o=n?Math.max:Math.min,l=n?1:-1,r=0;r<2;r++){for(a=r?Math.max:Math.min,s=r?1:-1,(c=t[n][r]).sort(i),u=t[1-n][r],f=u.concat(c),p=[],h=0;hMath.abs(f)?s+="l"+f*t.pxmid[0]/t.pxmid[1]+","+f+"H"+(a+t.labelExtraX+c):s+="l"+t.labelExtraX+","+u+"v"+(f-u)+"h"+c}else s+="V"+(t.yLabelMid+t.labelExtraY)+"h"+c;l.ensureSingle(r,"path","textline").call(o.stroke,e.outsidetextfont.color).attr({"stroke-width":Math.min(2,e.outsidetextfont.size/8),d:s,fill:"none"})}else r.select("path.textline").remove()}))}(v,g),_&&g.automargin){var k=s.bBox(h.node()),M=g.domain,A=a.w*(M.x[1]-M.x[0]),S=a.h*(M.y[1]-M.y[0]),E=(.5*A-d.r)/a.w,I=(.5*S-d.r)/a.h;i.autoMargin(t,"pie."+g.uid+".automargin",{xl:M.x[0]-E,xr:M.x[1]+E,yb:M.y[0]-I,yt:M.y[1]+I,l:Math.max(d.cx-d.r-k.left,0),r:Math.max(k.right-(d.cx+d.r),0),b:Math.max(k.bottom-(d.cy+d.r),0),t:Math.max(d.cy-d.r-k.top,0),pad:5})}}))}));setTimeout((function(){h.selectAll("tspan").each((function(){var t=n.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))}))}),0)},formatSliceLabel:D,transformInsideText:w,determineInsideTextFont:b,positionTitleOutside:L,prerenderTitles:_,layoutAreas:z,attachFxHandlers:x,computeTransform:R}},{"../../components/color":643,"../../components/drawing":665,"../../components/fx":683,"../../lib":778,"../../lib/svg_text_utils":802,"../../plots/plots":890,"../bar/constants":922,"../bar/uniform_text":936,"./event_data":1164,"./helpers":1165,d3:169}],1170:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one"),a=t("../bar/uniform_text").resizeText;e.exports=function(t){var e=t._fullLayout._pielayer.selectAll(".trace");a(t,e,"pie"),e.each((function(t){var e=t[0].trace,r=n.select(this);r.style({opacity:e.opacity}),r.selectAll("path.surface").each((function(t){n.select(this).call(i,t,e)}))}))}},{"../bar/uniform_text":936,"./style_one":1171,d3:169}],1171:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("./helpers").castOption;e.exports=function(t,e,r){var a=r.marker.line,o=i(a.color,e.pts)||n.defaultLine,s=i(a.width,e.pts)||0;t.style("stroke-width",s).call(n.fill,e.color).call(n.stroke,o)}},{"../../components/color":643,"./helpers":1165}],1172:[function(t,e,r){"use strict";var n=t("../scatter/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array",editType:"calc"},indices:{valType:"data_array",editType:"calc"},xbounds:{valType:"data_array",editType:"calc"},ybounds:{valType:"data_array",editType:"calc"},text:n.text,marker:{color:{valType:"color",arrayOk:!1,editType:"calc"},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1,editType:"calc"},blend:{valType:"boolean",dflt:null,editType:"calc"},sizemin:{valType:"number",min:.1,max:2,dflt:.5,editType:"calc"},sizemax:{valType:"number",min:.1,dflt:20,editType:"calc"},border:{color:{valType:"color",arrayOk:!1,editType:"calc"},arearatio:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},editType:"calc"},editType:"calc"},transforms:void 0}},{"../scatter/attributes":1186}],1173:[function(t,e,r){"use strict";var n=t("gl-pointcloud2d"),i=t("../../lib/str2rgbarray"),a=t("../../plots/cartesian/autorange").findExtremes,o=t("../scatter/get_trace_color");function s(t,e){this.scene=t,this.uid=e,this.type="pointcloud",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.idToIndex=new Int32Array(0),this.bounds=[0,0,0,0],this.pointcloudOptions={positions:new Float32Array(0),idToIndex:this.idToIndex,sizemin:.5,sizemax:12,color:[0,0,0,1],areaRatio:1,borderColor:[0,0,0,1]},this.pointcloud=n(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}var l=s.prototype;l.handlePick=function(t){var e=this.idToIndex[t.pointId];return{trace:this,dataCoord:t.dataCoord,traceCoord:this.pickXYData?[this.pickXYData[2*e],this.pickXYData[2*e+1]]:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:this.color,name:this.name,pointIndex:e,hoverinfo:this.hoverinfo}},l.update=function(t){this.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=o(t,{})},l.updateFast=function(t){var e,r,n,o,s,l,c=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,f=this.pickXYData=t.xy,h=t.xbounds&&t.ybounds,p=t.indices,d=this.bounds;if(f){if(n=f,e=f.length>>>1,h)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(l=0;ld[2]&&(d[2]=o),sd[3]&&(d[3]=s);if(p)r=p;else for(r=new Int32Array(e),l=0;ld[2]&&(d[2]=o),sd[3]&&(d[3]=s);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var g=i(t.marker.color),m=i(t.marker.border.color),v=t.opacity*t.marker.opacity;g[3]*=v,this.pointcloudOptions.color=g;var y=t.marker.blend;if(null===y){y=c.length<100||u.length<100}this.pointcloudOptions.blend=y,m[3]*=v,this.pointcloudOptions.borderColor=m;var x=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=x,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions);var _=this.scene.xaxis,w=this.scene.yaxis,T=b/2||.5;t._extremes[_._id]=a(_,[d[0],d[2]],{ppad:T}),t._extremes[w._id]=a(w,[d[1],d[3]],{ppad:T})},l.dispose=function(){this.pointcloud.dispose()},e.exports=function(t,e){var r=new s(t,e.uid);return r.update(e),r}},{"../../lib/str2rgbarray":801,"../../plots/cartesian/autorange":826,"../scatter/get_trace_color":1196,"gl-pointcloud2d":324}],1174:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r){function a(r,a){return n.coerce(t,e,i,r,a)}a("x"),a("y"),a("xbounds"),a("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),a("text"),a("marker.color",r),a("marker.opacity"),a("marker.blend"),a("marker.sizemin"),a("marker.sizemax"),a("marker.border.color",r),a("marker.border.arearatio"),e._length=null}},{"../../lib":778,"./attributes":1172}],1175:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("../scatter3d/calc"),plot:t("./convert"),moduleType:"trace",name:"pointcloud",basePlotModule:t("../../plots/gl2d"),categories:["gl","gl2d","showLegend"],meta:{}}},{"../../plots/gl2d":867,"../scatter3d/calc":1215,"./attributes":1172,"./convert":1173,"./defaults":1174}],1176:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/attributes"),a=t("../../components/color/attributes"),o=t("../../components/fx/attributes"),s=t("../../plots/domain").attributes,l=t("../../plots/template_attributes").hovertemplateAttrs,c=t("../../components/colorscale/attributes"),u=t("../../plot_api/plot_template").templatedArray,f=t("../../lib/extend").extendFlat,h=t("../../plot_api/edit_types").overrideAll;t("../../constants/docs").FORMAT_LINK;(e.exports=h({hoverinfo:f({},i.hoverinfo,{flags:[],arrayOk:!1}),hoverlabel:o.hoverlabel,domain:s({name:"sankey",trace:!0}),orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s"},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:n({}),customdata:void 0,node:{label:{valType:"data_array",dflt:[]},groups:{valType:"info_array",impliedEdits:{x:[],y:[]},dimensions:2,freeLength:!0,dflt:[],items:{valType:"number",editType:"calc"}},x:{valType:"data_array",dflt:[]},y:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},customdata:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:a.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:.5,arrayOk:!0}},pad:{valType:"number",arrayOk:!1,min:0,dflt:20},thickness:{valType:"number",arrayOk:!1,min:1,dflt:20},hoverinfo:{valType:"enumerated",values:["all","none","skip"],dflt:"all"},hoverlabel:o.hoverlabel,hovertemplate:l({},{keys:["value","label"]})},link:{label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},customdata:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:a.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}},source:{valType:"data_array",dflt:[]},target:{valType:"data_array",dflt:[]},value:{valType:"data_array",dflt:[]},hoverinfo:{valType:"enumerated",values:["all","none","skip"],dflt:"all"},hoverlabel:o.hoverlabel,hovertemplate:l({},{keys:["value","label"]}),colorscales:u("concentrationscales",{editType:"calc",label:{valType:"string",editType:"calc",dflt:""},cmax:{valType:"number",editType:"calc",dflt:1},cmin:{valType:"number",editType:"calc",dflt:0},colorscale:f(c().colorscale,{dflt:[[0,"white"],[1,"black"]]})})}},"calc","nested")).transforms=void 0},{"../../components/color/attributes":642,"../../components/colorscale/attributes":650,"../../components/fx/attributes":674,"../../constants/docs":748,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plot_api/plot_template":816,"../../plots/attributes":823,"../../plots/domain":854,"../../plots/font_attributes":855,"../../plots/template_attributes":905}],1177:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll,i=t("../../plots/get_data").getModuleCalcData,a=t("./plot"),o=t("../../components/fx/layout_attributes"),s=t("../../lib/setcursor"),l=t("../../components/dragelement"),c=t("../../plots/cartesian/select").prepSelect,u=t("../../lib"),f=t("../../registry");function h(t,e){var r=t._fullData[e],n=t._fullLayout,i=n.dragmode,a="pan"===n.dragmode?"move":"crosshair",o=r._bgRect;if("pan"!==i&&"zoom"!==i){s(o,a);var h={_id:"x",c2p:u.identity,_offset:r._sankey.translateX,_length:r._sankey.width},p={_id:"y",c2p:u.identity,_offset:r._sankey.translateY,_length:r._sankey.height},d={gd:t,element:o.node(),plotinfo:{id:e,xaxis:h,yaxis:p,fillRangeItems:u.noop},subplot:e,xaxes:[h],yaxes:[p],doneFnCompleted:function(r){var n,i=t._fullData[e],a=i.node.groups.slice(),o=[];function s(t){for(var e=i._sankey.graph.nodes,r=0;ry&&(y=a.source[e]),a.target[e]>y&&(y=a.target[e]);var x,b=y+1;t.node._count=b;var _=t.node.groups,w={};for(e=0;e<_.length;e++){var T=_[e];for(x=0;x0&&s(E,b)&&s(C,b)&&(!w.hasOwnProperty(E)||!w.hasOwnProperty(C)||w[E]!==w[C])){w.hasOwnProperty(C)&&(C=w[C]),w.hasOwnProperty(E)&&(E=w[E]),C=+C,h[E=+E]=h[C]=!0;var L="";a.label&&a.label[e]&&(L=a.label[e]);var I=null;L&&p.hasOwnProperty(L)&&(I=p[L]),c.push({pointNumber:e,label:L,color:u?a.color[e]:a.color,customdata:f?a.customdata[e]:a.customdata,concentrationscale:I,source:E,target:C,value:+S}),A.source.push(E),A.target.push(C)}}var P=b+_.length,z=o(r.color),O=o(r.customdata),D=[];for(e=0;eb-1,childrenNodes:[],pointNumber:e,label:R,color:z?r.color[e]:r.color,customdata:O?r.customdata[e]:r.customdata})}var F=!1;return function(t,e,r){for(var a=i.init2dArray(t,0),o=0;o1}))}(P,A.source,A.target)&&(F=!0),{circular:F,links:c,nodes:D,groups:_,groupLookup:w}}e.exports=function(t,e){var r=c(e);return a({circular:r.circular,_nodes:r.nodes,_links:r.links,_groups:r.groups,_groupLookup:r.groupLookup})}},{"../../components/colorscale":655,"../../lib":778,"../../lib/gup":775,"strongly-connected-components":569}],1179:[function(t,e,r){"use strict";e.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeCapture:"node-capture",nodeCentered:"node-entered",nodeLabelGuide:"node-label-guide",nodeLabel:"node-label",nodeLabelTextPath:"node-label-text-path"}}},{}],1180:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../components/color"),o=t("tinycolor2"),s=t("../../plots/domain").defaults,l=t("../../components/fx/hoverlabel_defaults"),c=t("../../plot_api/plot_template"),u=t("../../plots/array_container_defaults");function f(t,e){function r(r,a){return n.coerce(t,e,i.link.colorscales,r,a)}r("label"),r("cmin"),r("cmax"),r("colorscale")}e.exports=function(t,e,r,h){function p(r,a){return n.coerce(t,e,i,r,a)}var d=n.extendDeep(h.hoverlabel,t.hoverlabel),g=t.node,m=c.newContainer(e,"node");function v(t,e){return n.coerce(g,m,i.node,t,e)}v("label"),v("groups"),v("x"),v("y"),v("pad"),v("thickness"),v("line.color"),v("line.width"),v("hoverinfo",t.hoverinfo),l(g,m,v,d),v("hovertemplate");var y=h.colorway;v("color",m.label.map((function(t,e){return a.addOpacity(function(t){return y[t%y.length]}(e),.8)}))),v("customdata");var x=t.link||{},b=c.newContainer(e,"link");function _(t,e){return n.coerce(x,b,i.link,t,e)}_("label"),_("source"),_("target"),_("value"),_("line.color"),_("line.width"),_("hoverinfo",t.hoverinfo),l(x,b,_,d),_("hovertemplate");var w,T=o(h.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)";_("color",n.repeat(T,b.value.length)),_("customdata"),u(x,b,{name:"colorscales",handleItemDefaults:f}),s(e,h,p),p("orientation"),p("valueformat"),p("valuesuffix"),m.x.length&&m.y.length&&(w="freeform"),p("arrangement",w),n.coerceFont(p,"textfont",n.extendFlat({},h.font)),e._length=null}},{"../../components/color":643,"../../components/fx/hoverlabel_defaults":681,"../../lib":778,"../../plot_api/plot_template":816,"../../plots/array_container_defaults":822,"../../plots/domain":854,"./attributes":1176,tinycolor2:576}],1181:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),moduleType:"trace",name:"sankey",basePlotModule:t("./base_plot"),selectPoints:t("./select.js"),categories:["noOpacity"],meta:{}}},{"./attributes":1176,"./base_plot":1177,"./calc":1178,"./defaults":1180,"./plot":1182,"./select.js":1184}],1182:[function(t,e,r){"use strict";var n=t("d3"),i=t("./render"),a=t("../../components/fx"),o=t("../../components/color"),s=t("../../lib"),l=t("./constants").cn,c=s._;function u(t){return""!==t}function f(t,e){return t.filter((function(t){return t.key===e.traceId}))}function h(t,e){n.select(t).select("path").style("fill-opacity",e),n.select(t).select("rect").style("fill-opacity",e)}function p(t){n.select(t).select("text.name").style("fill","black")}function d(t){return function(e){return-1!==t.node.sourceLinks.indexOf(e.link)||-1!==t.node.targetLinks.indexOf(e.link)}}function g(t){return function(e){return-1!==e.node.sourceLinks.indexOf(t.link)||-1!==e.node.targetLinks.indexOf(t.link)}}function m(t,e,r){e&&r&&f(r,e).selectAll("."+l.sankeyLink).filter(d(e)).call(y.bind(0,e,r,!1))}function v(t,e,r){e&&r&&f(r,e).selectAll("."+l.sankeyLink).filter(d(e)).call(x.bind(0,e,r,!1))}function y(t,e,r,n){var i=n.datum().link.label;n.style("fill-opacity",(function(t){if(!t.link.concentrationscale)return.4})),i&&f(e,t).selectAll("."+l.sankeyLink).filter((function(t){return t.link.label===i})).style("fill-opacity",(function(t){if(!t.link.concentrationscale)return.4})),r&&f(e,t).selectAll("."+l.sankeyNode).filter(g(t)).call(m)}function x(t,e,r,n){var i=n.datum().link.label;n.style("fill-opacity",(function(t){return t.tinyColorAlpha})),i&&f(e,t).selectAll("."+l.sankeyLink).filter((function(t){return t.link.label===i})).style("fill-opacity",(function(t){return t.tinyColorAlpha})),r&&f(e,t).selectAll(l.sankeyNode).filter(g(t)).call(v)}function b(t,e){var r=t.hoverlabel||{},n=s.nestedProperty(r,e).get();return!Array.isArray(n)&&n}e.exports=function(t,e){for(var r=t._fullLayout,s=r._paper,f=r._size,d=0;d"),color:b(s,"bgcolor")||o.addOpacity(d.color,1),borderColor:b(s,"bordercolor"),fontFamily:b(s,"font.family"),fontSize:b(s,"font.size"),fontColor:b(s,"font.color"),nameLength:b(s,"namelength"),textAlign:b(s,"align"),idealAlign:n.event.x"),color:b(o,"bgcolor")||i.tinyColorHue,borderColor:b(o,"bordercolor"),fontFamily:b(o,"font.family"),fontSize:b(o,"font.size"),fontColor:b(o,"font.color"),nameLength:b(o,"namelength"),textAlign:b(o,"align"),idealAlign:"left",hovertemplate:o.hovertemplate,hovertemplateLabels:v,eventData:[i.node]},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t});h(_,.85),p(_)}}},unhover:function(e,i,o){!1!==t._fullLayout.hovermode&&(n.select(e).call(v,i,o),"skip"!==i.node.trace.node.hoverinfo&&(i.node.fullData=i.node.trace,t.emit("plotly_unhover",{event:n.event,points:[i.node]})),a.loneUnhover(r._hoverlayer.node()))},select:function(e,r,i){var o=r.node;o.originalEvent=n.event,t._hoverdata=[o],n.select(e).call(v,r,i),a.click(t,{target:!0})}}})}},{"../../components/color":643,"../../components/fx":683,"../../lib":778,"./constants":1179,"./render":1183,d3:169}],1183:[function(t,e,r){"use strict";var n=t("./constants"),i=t("d3"),a=t("tinycolor2"),o=t("../../components/color"),s=t("../../components/drawing"),l=t("@plotly/d3-sankey"),c=t("@plotly/d3-sankey-circular"),u=t("d3-force"),f=t("../../lib"),h=f.strTranslate,p=t("../../lib/gup"),d=p.keyFun,g=p.repeat,m=p.unwrap,v=t("d3-interpolate").interpolateNumber,y=t("../../registry");function x(t,e,r){var i,o=m(e),s=o.trace,u=s.domain,h="h"===s.orientation,p=s.node.pad,d=s.node.thickness,g=t.width*(u.x[1]-u.x[0]),v=t.height*(u.y[1]-u.y[0]),y=o._nodes,x=o._links,b=o.circular;(i=b?c.sankeyCircular().circularLinkGap(0):l.sankey()).iterations(n.sankeyIterations).size(h?[g,v]:[v,g]).nodeWidth(d).nodePadding(p).nodeId((function(t){return t.pointNumber})).nodes(y).links(x);var _,w,T,k=i();for(var M in i.nodePadding()=i||(r=i-e.y0)>1e-6&&(e.y0+=r,e.y1+=r),i=e.y1+p}))}(function(t){var e,r,n=t.map((function(t,e){return{x0:t.x0,index:e}})).sort((function(t,e){return t.x0-e.x0})),i=[],a=-1,o=-1/0;for(_=0;_o+d&&(a+=1,e=s.x0),o=s.x0,i[a]||(i[a]=[]),i[a].push(s),r=e-s.x0,s.x0+=r,s.x1+=r}return i}(y=k.nodes));i.update(k)}return{circular:b,key:r,trace:s,guid:f.randstr(),horizontal:h,width:g,height:v,nodePad:s.node.pad,nodeLineColor:s.node.line.color,nodeLineWidth:s.node.line.width,linkLineColor:s.link.line.color,linkLineWidth:s.link.line.width,valueFormat:s.valueformat,valueSuffix:s.valuesuffix,textFont:s.textfont,translateX:u.x[0]*t.width+t.margin.l,translateY:t.height-u.y[1]*t.height+t.margin.t,dragParallel:h?v:g,dragPerpendicular:h?g:v,arrangement:s.arrangement,sankey:i,graph:k,forceLayouts:{},interactionState:{dragInProgress:!1,hovered:!1}}}function b(t,e,r){var n=a(e.color),i=e.source.label+"|"+e.target.label+"__"+r;return e.trace=t.trace,e.curveNumber=t.trace.index,{circular:t.circular,key:i,traceId:t.key,pointNumber:e.pointNumber,link:e,tinyColorHue:o.tinyRGB(n),tinyColorAlpha:n.getAlpha(),linkPath:_,linkLineColor:t.linkLineColor,linkLineWidth:t.linkLineWidth,valueFormat:t.valueFormat,valueSuffix:t.valueSuffix,sankey:t.sankey,parent:t,interactionState:t.interactionState,flow:e.flow}}function _(){return function(t){if(t.link.circular)return e=t.link,r=e.width/2,n=e.circularPathData,"top"===e.circularLinkType?"M "+n.targetX+" "+(n.targetY+r)+" L"+n.rightInnerExtent+" "+(n.targetY+r)+"A"+(n.rightLargeArcRadius+r)+" "+(n.rightSmallArcRadius+r)+" 0 0 1 "+(n.rightFullExtent-r)+" "+(n.targetY-n.rightSmallArcRadius)+"L"+(n.rightFullExtent-r)+" "+n.verticalRightInnerExtent+"A"+(n.rightLargeArcRadius+r)+" "+(n.rightLargeArcRadius+r)+" 0 0 1 "+n.rightInnerExtent+" "+(n.verticalFullExtent-r)+"L"+n.leftInnerExtent+" "+(n.verticalFullExtent-r)+"A"+(n.leftLargeArcRadius+r)+" "+(n.leftLargeArcRadius+r)+" 0 0 1 "+(n.leftFullExtent+r)+" "+n.verticalLeftInnerExtent+"L"+(n.leftFullExtent+r)+" "+(n.sourceY-n.leftSmallArcRadius)+"A"+(n.leftLargeArcRadius+r)+" "+(n.leftSmallArcRadius+r)+" 0 0 1 "+n.leftInnerExtent+" "+(n.sourceY+r)+"L"+n.sourceX+" "+(n.sourceY+r)+"L"+n.sourceX+" "+(n.sourceY-r)+"L"+n.leftInnerExtent+" "+(n.sourceY-r)+"A"+(n.leftLargeArcRadius-r)+" "+(n.leftSmallArcRadius-r)+" 0 0 0 "+(n.leftFullExtent-r)+" "+(n.sourceY-n.leftSmallArcRadius)+"L"+(n.leftFullExtent-r)+" "+n.verticalLeftInnerExtent+"A"+(n.leftLargeArcRadius-r)+" "+(n.leftLargeArcRadius-r)+" 0 0 0 "+n.leftInnerExtent+" "+(n.verticalFullExtent+r)+"L"+n.rightInnerExtent+" "+(n.verticalFullExtent+r)+"A"+(n.rightLargeArcRadius-r)+" "+(n.rightLargeArcRadius-r)+" 0 0 0 "+(n.rightFullExtent+r)+" "+n.verticalRightInnerExtent+"L"+(n.rightFullExtent+r)+" "+(n.targetY-n.rightSmallArcRadius)+"A"+(n.rightLargeArcRadius-r)+" "+(n.rightSmallArcRadius-r)+" 0 0 0 "+n.rightInnerExtent+" "+(n.targetY-r)+"L"+n.targetX+" "+(n.targetY-r)+"Z":"M "+n.targetX+" "+(n.targetY-r)+" L"+n.rightInnerExtent+" "+(n.targetY-r)+"A"+(n.rightLargeArcRadius+r)+" "+(n.rightSmallArcRadius+r)+" 0 0 0 "+(n.rightFullExtent-r)+" "+(n.targetY+n.rightSmallArcRadius)+"L"+(n.rightFullExtent-r)+" "+n.verticalRightInnerExtent+"A"+(n.rightLargeArcRadius+r)+" "+(n.rightLargeArcRadius+r)+" 0 0 0 "+n.rightInnerExtent+" "+(n.verticalFullExtent+r)+"L"+n.leftInnerExtent+" "+(n.verticalFullExtent+r)+"A"+(n.leftLargeArcRadius+r)+" "+(n.leftLargeArcRadius+r)+" 0 0 0 "+(n.leftFullExtent+r)+" "+n.verticalLeftInnerExtent+"L"+(n.leftFullExtent+r)+" "+(n.sourceY+n.leftSmallArcRadius)+"A"+(n.leftLargeArcRadius+r)+" "+(n.leftSmallArcRadius+r)+" 0 0 0 "+n.leftInnerExtent+" "+(n.sourceY-r)+"L"+n.sourceX+" "+(n.sourceY-r)+"L"+n.sourceX+" "+(n.sourceY+r)+"L"+n.leftInnerExtent+" "+(n.sourceY+r)+"A"+(n.leftLargeArcRadius-r)+" "+(n.leftSmallArcRadius-r)+" 0 0 1 "+(n.leftFullExtent-r)+" "+(n.sourceY+n.leftSmallArcRadius)+"L"+(n.leftFullExtent-r)+" "+n.verticalLeftInnerExtent+"A"+(n.leftLargeArcRadius-r)+" "+(n.leftLargeArcRadius-r)+" 0 0 1 "+n.leftInnerExtent+" "+(n.verticalFullExtent-r)+"L"+n.rightInnerExtent+" "+(n.verticalFullExtent-r)+"A"+(n.rightLargeArcRadius-r)+" "+(n.rightLargeArcRadius-r)+" 0 0 1 "+(n.rightFullExtent+r)+" "+n.verticalRightInnerExtent+"L"+(n.rightFullExtent+r)+" "+(n.targetY+n.rightSmallArcRadius)+"A"+(n.rightLargeArcRadius-r)+" "+(n.rightSmallArcRadius-r)+" 0 0 1 "+n.rightInnerExtent+" "+(n.targetY+r)+"L"+n.targetX+" "+(n.targetY+r)+"Z";var e,r,n,i=t.link.source.x1,a=t.link.target.x0,o=v(i,a),s=o(.5),l=o(.5),c=t.link.y0-t.link.width/2,u=t.link.y0+t.link.width/2,f=t.link.y1-t.link.width/2,h=t.link.y1+t.link.width/2;return"M"+i+","+c+"C"+s+","+c+" "+l+","+f+" "+a+","+f+"L"+a+","+h+"C"+l+","+h+" "+s+","+u+" "+i+","+u+"Z"}}function w(t,e){var r=a(e.color),i=n.nodePadAcross,s=t.nodePad/2;e.dx=e.x1-e.x0,e.dy=e.y1-e.y0;var l=e.dx,c=Math.max(.5,e.dy),u="node_"+e.pointNumber;return e.group&&(u=f.randstr()),e.trace=t.trace,e.curveNumber=t.trace.index,{index:e.pointNumber,key:u,partOfGroup:e.partOfGroup||!1,group:e.group,traceId:t.key,trace:t.trace,node:e,nodePad:t.nodePad,nodeLineColor:t.nodeLineColor,nodeLineWidth:t.nodeLineWidth,textFont:t.textFont,size:t.horizontal?t.height:t.width,visibleWidth:Math.ceil(l),visibleHeight:c,zoneX:-i,zoneY:-s,zoneWidth:l+2*i,zoneHeight:c+2*s,labelY:t.horizontal?e.dy/2+1:e.dx/2+1,left:1===e.originalLayer,sizeAcross:t.width,forceLayouts:t.forceLayouts,horizontal:t.horizontal,darkBackground:r.getBrightness()<=128,tinyColorHue:o.tinyRGB(r),tinyColorAlpha:r.getAlpha(),valueFormat:t.valueFormat,valueSuffix:t.valueSuffix,sankey:t.sankey,graph:t.graph,arrangement:t.arrangement,uniqueNodeLabelPathId:[t.guid,t.key,u].join("_"),interactionState:t.interactionState,figure:t}}function T(t){t.attr("transform",(function(t){return h(t.node.x0.toFixed(3),t.node.y0.toFixed(3))}))}function k(t){t.call(T)}function M(t,e){t.call(k),e.attr("d",_())}function A(t){t.attr("width",(function(t){return t.node.x1-t.node.x0})).attr("height",(function(t){return t.visibleHeight}))}function S(t){return t.link.width>1||t.linkLineWidth>0}function E(t){return h(t.translateX,t.translateY)+(t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function C(t){return h(t.horizontal?0:t.labelY,t.horizontal?t.labelY:0)}function L(t){return i.svg.line()([[t.horizontal?t.left?-t.sizeAcross:t.visibleWidth+n.nodeTextOffsetHorizontal:n.nodeTextOffsetHorizontal,0],[t.horizontal?t.left?-n.nodeTextOffsetHorizontal:t.sizeAcross:t.visibleHeight-n.nodeTextOffsetHorizontal,0]])}function I(t){return t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)"}function P(t){return t.horizontal?"scale(1 1)":"scale(-1 1)"}function z(t){return t.darkBackground&&!t.horizontal?"rgb(255,255,255)":"rgb(0,0,0)"}function O(t){return t.horizontal&&t.left?"100%":"0%"}function D(t,e,r){t.on(".basic",null).on("mouseover.basic",(function(t){t.interactionState.dragInProgress||t.partOfGroup||(r.hover(this,t,e),t.interactionState.hovered=[this,t])})).on("mousemove.basic",(function(t){t.interactionState.dragInProgress||t.partOfGroup||(r.follow(this,t),t.interactionState.hovered=[this,t])})).on("mouseout.basic",(function(t){t.interactionState.dragInProgress||t.partOfGroup||(r.unhover(this,t,e),t.interactionState.hovered=!1)})).on("click.basic",(function(t){t.interactionState.hovered&&(r.unhover(this,t,e),t.interactionState.hovered=!1),t.interactionState.dragInProgress||t.partOfGroup||r.select(this,t,e)}))}function R(t,e,r,a){var o=i.behavior.drag().origin((function(t){return{x:t.node.x0+t.visibleWidth/2,y:t.node.y0+t.visibleHeight/2}})).on("dragstart",(function(i){if("fixed"!==i.arrangement&&(f.ensureSingle(a._fullLayout._infolayer,"g","dragcover",(function(t){a._fullLayout._dragCover=t})),f.raiseToTop(this),i.interactionState.dragInProgress=i.node,B(i.node),i.interactionState.hovered&&(r.nodeEvents.unhover.apply(0,i.interactionState.hovered),i.interactionState.hovered=!1),"snap"===i.arrangement)){var o=i.traceId+"|"+i.key;i.forceLayouts[o]?i.forceLayouts[o].alpha(1):function(t,e,r,i){!function(t){for(var e=0;e0&&i.forceLayouts[e].alpha(0)}}(0,e,a,r)).stop()}(0,o,i),function(t,e,r,i,a){window.requestAnimationFrame((function o(){var s;for(s=0;s0)window.requestAnimationFrame(o);else{var l=r.node.originalX;r.node.x0=l-r.visibleWidth/2,r.node.x1=l+r.visibleWidth/2,F(r,a)}}))}(t,e,i,o,a)}})).on("drag",(function(r){if("fixed"!==r.arrangement){var n=i.event.x,a=i.event.y;"snap"===r.arrangement?(r.node.x0=n-r.visibleWidth/2,r.node.x1=n+r.visibleWidth/2,r.node.y0=a-r.visibleHeight/2,r.node.y1=a+r.visibleHeight/2):("freeform"===r.arrangement&&(r.node.x0=n-r.visibleWidth/2,r.node.x1=n+r.visibleWidth/2),a=Math.max(0,Math.min(r.size-r.visibleHeight/2,a)),r.node.y0=a-r.visibleHeight/2,r.node.y1=a+r.visibleHeight/2),B(r.node),"snap"!==r.arrangement&&(r.sankey.update(r.graph),M(t.filter(N(r)),e))}})).on("dragend",(function(t){if("fixed"!==t.arrangement){t.interactionState.dragInProgress=!1;for(var e=0;e5?t.node.label:""})).attr("text-anchor",(function(t){return t.horizontal&&t.left?"end":"start"})),q.transition().ease(n.ease).duration(n.duration).attr("startOffset",O).style("fill",z)}},{"../../components/color":643,"../../components/drawing":665,"../../lib":778,"../../lib/gup":775,"../../registry":910,"./constants":1179,"@plotly/d3-sankey":56,"@plotly/d3-sankey-circular":55,d3:169,"d3-force":160,"d3-interpolate":162,tinycolor2:576}],1184:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=[],n=t.cd[0].trace,i=n._sankey.graph.nodes,a=0;al&&E[v].gap;)v--;for(x=E[v].s,g=E.length-1;g>v;g--)E[g].s=x;for(;lA[u]&&u=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],1193:[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"),c=t("./period_defaults"),u=t("./stack_defaults"),f=t("./marker_defaults"),h=t("./line_defaults"),p=t("./line_shape_defaults"),d=t("./text_defaults"),g=t("./fillcolor_defaults");e.exports=function(t,e,r,m){function v(r,i){return n.coerce(t,e,a,r,i)}var y=l(t,e,m,v);if(y||(e.visible=!1),e.visible){c(t,e,m,v);var x=u(t,e,m,v),b=!x&&yG!=(F=P[L][1])>=G&&(O=P[L-1][0],D=P[L][0],F-R&&(z=O+(D-O)*(G-R)/(F-R),U=Math.min(U,z),V=Math.max(V,z)));U=Math.max(U,0),V=Math.min(V,h._length);var Y=s.defaultLine;return s.opacity(f.fillcolor)?Y=f.fillcolor:s.opacity((f.line||{}).color)&&(Y=f.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:U,x1:V,y0:G,y1:G,color:Y,hovertemplate:!1}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":643,"../../components/fx":683,"../../lib":778,"../../registry":910,"./get_trace_color":1196}],1198:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports={hasLines:n.hasLines,hasMarkers:n.hasMarkers,hasText:n.hasText,isBubble:n.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":840,"./arrays_to_calcdata":1185,"./attributes":1186,"./calc":1187,"./cross_trace_calc":1191,"./cross_trace_defaults":1192,"./defaults":1193,"./format_labels":1195,"./hover":1197,"./marker_colorbar":1204,"./plot":1207,"./select":1208,"./style":1210,"./subtypes":1211}],1199:[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 c=(t.marker||{}).color;(s("line.color",r),i(t,"line"))?a(t,e,o,s,{prefix:"line.",cLetter:"c"}):s("line.color",!n(c)&&c||r);s("line.width"),(l||{}).noDash||s("line.dash")}},{"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"../../lib":778}],1200:[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"),c=l.segmentsIntersect,u=l.constrain,f=t("./constants");e.exports=function(t,e){var r,n,a,h,p,d,g,m,v,y,x,b,_,w,T,k,M,A,S=e.xaxis,E=e.yaxis,C="log"===S.type,L="log"===E.type,I=S._length,P=E._length,z=e.connectGaps,O=e.baseTolerance,D=e.shape,R="linear"===D,F=e.fill&&"none"!==e.fill,B=[],N=f.minTolerance,j=t.length,U=new Array(j),V=0;function q(r){var n=t[r];if(!n)return!1;var a=e.linearized?S.l2p(n.x):S.c2p(n.x),l=e.linearized?E.l2p(n.y):E.c2p(n.y);if(a===i){if(C&&(a=S.c2p(n.x,!0)),a===i)return!1;L&&l===i&&(a*=Math.abs(S._m*P*(S._m>0?o:s)/(E._m*I*(E._m>0?o:s)))),a*=1e3}if(l===i){if(L&&(l=E.c2p(n.y,!0)),l===i)return!1;l*=1e3}return[a,l]}function H(t,e,r,n){var i=r-t,a=n-e,o=.5-t,s=.5-e,l=i*i+a*a,c=i*o+a*s;if(c>0&&crt||t[1]it)return[u(t[0],et,rt),u(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 c=2*l.constrain((n[t]+i[t])/2,e,r)-((a||n)[t]+(o||i)[t]);c&&((a&&o?c>0==a[t]>o[t]?a:o:a||o)[t]+=c);return s}}function ct(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 ut(t){U[V-1][0]!==t[0]&&U[V-1][1]!==t[1]&&ct([Z,J]),ct(t),K=null,Z=J=0}function ft(t){if(M=t[0]/I,A=t[1]/P,W=t[0]rt?rt:0,X=t[1]it?it:0,W||X){if(V)if(K){var e=$(K,t);e.length>1&&(ut(e[0]),U[V++]=e[1])}else Q=$(U[V-1],t)[0],U[V++]=Q;else U[V++]=[W||t[0],X||t[1]];var r=U[V-1];W&&X&&(r[0]!==W||r[1]!==X)?(K&&(Z!==W&&J!==X?ct(Z&&J?(n=K,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,J||X]):Z&&J&&ct([Z,J])),ct([W,X])):Z-W&&J-X&&ct([W||Z,X||J]),K=t,Z=W,J=X}else K&&ut($(K,t)[0]),U[V++]=t;var n,i,a,o}for("linear"===D||"spline"===D?$=function(t,e){for(var r=[],n=0,i=0;i<4;i++){var a=at[i],o=c(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&&Y(o,t)G(d,ht))break;a=d,(_=v[0]*m[0]+v[1]*m[1])>x?(x=_,h=d,g=!1):_=t.length||!d)break;ft(d),n=d}}else ft(h)}K&&ct([Z||K[0],J||K[1]]),B.push(U.slice(0,V))}return B}},{"../../constants/numerical":753,"../../lib":778,"./constants":1190}],1201:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],1202:[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,c={},u=!1,f=-1,h=0,p=-1;for(a=0;a=0?l=p:(l=p=h,h++),l0?Math.max(e,i):0}}},{"fast-isnumeric":241}],1204:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],1205:[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,c){var u=o.isBubble(t),f=(t.line||{}).color;(c=c||{},f&&(r=f),l("marker.symbol"),l("marker.opacity",u?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),c.noSelect||(l("selected.marker.color"),l("unselected.marker.color"),l("selected.marker.size"),l("unselected.marker.size")),c.noLine||(l("marker.line.color",f&&!Array.isArray(f)&&e.marker.color!==f?f:u?n.background:n.defaultLine),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",u?1:0)),u&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),c.gradient)&&("none"!==l("marker.gradient.type")&&l("marker.gradient.color"))}},{"../../components/color":643,"../../components/colorscale/defaults":653,"../../components/colorscale/helpers":654,"./subtypes":1211}],1206:[function(t,e,r){"use strict";var n=t("../../lib").dateTick0,i=t("../../constants/numerical").ONEWEEK;function a(t,e){return n(e,t%i==0?1:0)}e.exports=function(t,e,r,n,i){if(i||(i={x:!0,y:!0}),i.x){var o=n("xperiod");o&&(n("xperiod0",a(o,e.xcalendar)),n("xperiodalignment"))}if(i.y){var s=n("yperiod");s&&(n("yperiod0",a(s,e.ycalendar)),n("yperiodalignment"))}}},{"../../constants/numerical":753,"../../lib":778}],1207:[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"),c=t("./subtypes"),u=t("./line_points"),f=t("./link_traces"),h=t("../../lib/polygon").tester;function p(t,e,r,f,p,d,g){var m;!function(t,e,r,i,o){var s=r.xaxis,l=r.yaxis,u=n.extent(a.simpleMap(s.range,s.r2c)),f=n.extent(a.simpleMap(l.range,l.r2c)),h=i[0].trace;if(!c.hasMarkers(h))return;var p=h.marker.maxdisplayed;if(0===p)return;var d=i.filter((function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]})),g=Math.ceil(d.length/p),m=0;o.forEach((function(t,r){var n=t[0].trace;c.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function y(t){return v?t.transition():t}var x=r.xaxis,b=r.yaxis,_=f[0].trace,w=_.line,T=n.select(d),k=o(T,"g","errorbars"),M=o(T,"g","lines"),A=o(T,"g","points"),S=o(T,"g","text");if(i.getComponentMethod("errorbars","plot")(t,k,r,g),!0===_.visible){var E,C;y(T).style("opacity",_.opacity);var L=_.fill.charAt(_.fill.length-1);"x"!==L&&"y"!==L&&(L=""),f[0][r.isRangePlot?"nodeRangePlot3":"node3"]=T;var I,P,z="",O=[],D=_._prevtrace;D&&(z=D._prevRevpath||"",C=D._nextFill,O=D._polygons);var R,F,B,N,j,U,V,q="",H="",G=[],Y=a.noop;if(E=_._ownFill,c.hasLines(_)||"none"!==_.fill){for(C&&C.datum(f),-1!==["hv","vh","hvh","vhv"].indexOf(w.shape)?(R=l.steps(w.shape),F=l.steps(w.shape.split("").reverse().join(""))):R=F="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")},B=function(t){return F(t.reverse())},G=u(f,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify,fill:_.fill}),V=_._polygons=new Array(G.length),m=0;m1){var r=n.select(this);if(r.datum(f),t)y(r.style("opacity",0).attr("d",I).call(l.lineGroupStyle)).style("opacity",1);else{var i=y(r);i.attr("d",I),l.singleLineStyle(f,i)}}}}}var W=M.selectAll(".js-line").data(G);y(W.exit()).style("opacity",0).remove(),W.each(Y(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Y(!0)),l.setClipUrl(W,r.layerClipId,t),G.length?(E?(E.datum(f),N&&U&&(L?("y"===L?N[1]=U[1]=b.c2p(0,!0):"x"===L&&(N[0]=U[0]=x.c2p(0,!0)),y(E).attr("d","M"+U+"L"+N+"L"+q.substr(1)).call(l.singleFillStyle)):y(E).attr("d",q+"Z").call(l.singleFillStyle))):C&&("tonext"===_.fill.substr(0,6)&&q&&z?("tonext"===_.fill?y(C).attr("d",q+"Z"+z+"Z").call(l.singleFillStyle):y(C).attr("d",q+"L"+z.substr(1)+"Z").call(l.singleFillStyle),_._polygons=_._polygons.concat(O)):(Z(C),_._polygons=null)),_._prevRevpath=H,_._prevPolygons=V):(E?Z(E):C&&Z(C),_._polygons=_._prevRevpath=_._prevPolygons=null),A.datum(f),S.datum(f),function(e,i,a){var o,u=a[0].trace,f=c.hasMarkers(u),h=c.hasText(u),p=tt(u),d=et,g=et;if(f||h){var m=s,_=u.stackgroup,w=_&&"infer zero"===t._fullLayout._scatterStackOpts[x._id+b._id][_].stackgaps;u.marker.maxdisplayed||u._needsCull?m=w?K:J:_&&!w&&(m=Q),f&&(d=m),h&&(g=m)}var T,k=(o=e.selectAll("path.point").data(d,p)).enter().append("path").classed("point",!0);v&&k.call(l.pointStyle,u,t).call(l.translatePoints,x,b).style("opacity",0).transition().style("opacity",1),o.order(),f&&(T=l.makePointStyleFns(u)),o.each((function(e){var i=n.select(this),a=y(i);l.translatePoint(e,a,x,b)?(l.singlePointStyle(e,a,u,T,t),r.layerClipId&&l.hideOutsideRangePoint(e,a,x,b,u.xcalendar,u.ycalendar),u.customdata&&i.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()})),v?o.exit().transition().style("opacity",0).remove():o.exit().remove(),(o=i.selectAll("g").data(g,p)).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,x,b)?r.layerClipId&&l.hideOutsideRangePoint(t,e,x,b,u.xcalendar,u.ycalendar):e.remove()})),o.selectAll("text").call(l.textPointStyle,u,t).each((function(t){var e=x.c2p(t.x),r=b.c2p(t.y);n.select(this).selectAll("tspan.line").each((function(){y(n.select(this)).attr({x:e,y:r})}))})),o.exit().remove()}(A,S,f);var X=!1===_.cliponaxis?null:r.layerClipId;l.setClipUrl(A,X,t),l.setClipUrl(S,X,t)}function Z(t){y(t).attr("d","M0,0Z")}function J(t){return t.filter((function(t){return!t.gap&&t.vis}))}function K(t){return t.filter((function(t){return t.vis}))}function Q(t){return t.filter((function(t){return!t.gap}))}function $(t){return t.id}function tt(t){if(t.ids)return $}function et(){return!1}}e.exports=function(t,e,r,i,a,c){var u,h,d=!a,g=!!a&&a.duration>0,m=f(t,e,r);((u=i.selectAll("g.trace").data(m,(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.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,c=[];a._ownfill&&c.push("_ownFill"),a._nexttrace&&c.push("_nextFill");var u=i.selectAll("g").data(c,s);u.enter().append("g"),u.exit().each((function(t){a[t]=null})).remove(),u.order().each((function(t){a[t]=o(n.select(this),"path","js-fill")}))}))}(t,u,e),g)?(c&&(h=c()),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){p(t,n,e,r,m,this,a)}))}))):u.each((function(r,n){p(t,n,e,r,m,this,a)}));d&&u.exit().remove(),i.selectAll("path:not([d])").remove()}},{"../../components/drawing":665,"../../lib":778,"../../lib/polygon":790,"../../registry":910,"./line_points":1200,"./link_traces":1202,"./subtypes":1211,d3:169}],1208:[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,c=t.yaxis,u=[],f=s[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===e)for(r=0;r0){var h=i.c2l(u);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 b(t){return null==t?0:t.indexOf("top")>-1?-1:t.indexOf("bottom")>-1?1:0}function _(t,e){return e(4*t)}function w(t){return p[t]}function T(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||p);for(var d=["x","y","z"],g=0;g<3;++g){var m="projection."+d[g];f(m+".show")&&(f(m+".opacity"),f(m+".scale"))}var v=n.getComponentMethod("errorbars","supplyDefaults");v(t,e,h||p||r,{axis:"z"}),v(t,e,h||p||r,{axis:"y",inherit:"z"}),v(t,e,h||p||r,{axis:"x",inherit:"z"})}else e.visible=!1}},{"../../lib":778,"../../registry":910,"../scatter/line_defaults":1199,"../scatter/marker_defaults":1205,"../scatter/subtypes":1211,"../scatter/text_defaults":1212,"./attributes":1214}],1219:[function(t,e,r){"use strict";e.exports={plot:t("./convert"),attributes:t("./attributes"),markerSymbols:t("../../constants/gl3d_markers"),supplyDefaults:t("./defaults"),colorbar:[{container:"marker",min:"cmin",max:"cmax"},{container:"line",min:"cmin",max:"cmax"}],calc:t("./calc"),moduleType:"trace",name:"scatter3d",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","symbols","showLegend","scatter-like"],meta:{}}},{"../../constants/gl3d_markers":751,"../../plots/gl3d":869,"./attributes":1214,"./calc":1215,"./convert":1217,"./defaults":1218}],1220:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../../plots/template_attributes").texttemplateAttrs,s=t("../../components/colorscale/attributes"),l=t("../../lib/extend").extendFlat,c=n.marker,u=n.line,f=c.line;e.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:l({},n.mode,{dflt:"markers"}),text:l({},n.text,{}),texttemplate:o({editType:"plot"},{keys:["a","b","text"]}),hovertext:l({},n.hovertext,{}),line:{color:u.color,width:u.width,dash:u.dash,shape:l({},u.shape,{values:["linear","spline"]}),smoothing:u.smoothing,editType:"calc"},connectgaps:n.connectgaps,fill:l({},n.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:n.fillcolor,marker:l({symbol:c.symbol,opacity:c.opacity,maxdisplayed:c.maxdisplayed,size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,line:l({width:f.width,editType:"calc"},s("marker.line")),gradient:c.gradient,editType:"calc"},s("marker")),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:l({},i.hoverinfo,{flags:["a","b","text","name"]}),hoveron:n.hoveron,hovertemplate:a()}},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1221:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc"),a=t("../scatter/arrays_to_calcdata"),o=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize,l=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e._carpetTrace=l(t,e);if(r&&r.visible&&"legendonly"!==r.visible){var c;e.xaxis=r.xaxis,e.yaxis=r.yaxis;var u,f,h=e._length,p=new Array(h),d=!1;for(c=0;c")}return o}function y(t,e){var r;r=t.labelprefix&&t.labelprefix.length>0?t.labelprefix.replace(/ = $/,""):t._hovertitle,m.push(r+": "+e.toFixed(3)+t.labelsuffix)}}},{"../../lib":778,"../scatter/hover":1197}],1226:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../scatter/select"),eventData:t("./event_data"),moduleType:"trace",name:"scattercarpet",basePlotModule:t("../../plots/cartesian"),categories:["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"],meta:{}}},{"../../plots/cartesian":840,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1220,"./calc":1221,"./defaults":1222,"./event_data":1223,"./format_labels":1224,"./hover":1225,"./plot":1227}],1227:[function(t,e,r){"use strict";var n=t("../scatter/plot"),i=t("../../plots/cartesian/axes"),a=t("../../components/drawing");e.exports=function(t,e,r,o){var s,l,c,u=r[0][0].carpet,f={xaxis:i.getFromId(t,u.xaxis||"x"),yaxis:i.getFromId(t,u.yaxis||"y"),plot:e.plot};for(n(t,f,r,o),s=0;s")}(c,g,t,l[0].t.labels),t.hovertemplate=c.hovertemplate,[t]}}},{"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../scatter/get_trace_color":1196,"./attributes":1228}],1234:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),calcGeoJSON:t("./plot").calcGeoJSON,plot:t("./plot").plot,style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"scattergeo",basePlotModule:t("../../plots/geo"),categories:["geo","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/geo":859,"../scatter/marker_colorbar":1204,"../scatter/style":1210,"./attributes":1228,"./calc":1229,"./defaults":1230,"./event_data":1231,"./format_labels":1232,"./hover":1233,"./plot":1235,"./select":1236,"./style":1237}],1235:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../lib/topojson_utils").getTopojsonFeatures,o=t("../../lib/geojson_utils"),s=t("../../lib/geo_location_utils"),l=t("../../plots/cartesian/autorange").findExtremes,c=t("../../constants/numerical").BADNUM,u=t("../scatter/calc").calcMarkerSize,f=t("../scatter/subtypes"),h=t("./style");e.exports={calcGeoJSON:function(t,e){var r,n,i=t[0].trace,o=e[i.geo],f=o._subplot,h=i._length;if(Array.isArray(i.locations)){var p=i.locationmode,d="geojson-id"===p?s.extractTraceFeature(t):a(i,f.topojson);for(r=0;r=m,k=2*w,M={},A=x.makeCalcdata(e,"x"),S=b.makeCalcdata(e,"y"),E=s(e,x,"x",A),C=s(e,b,"y",S);e._x=E,e._y=C,e.xperiodalignment&&(e._origX=A),e.yperiodalignment&&(e._origY=S);var L=new Array(k);for(r=0;r1&&i.extendFlat(s.line,p.linePositions(t,r,n));if(s.errorX||s.errorY){var l=p.errorBarPositions(t,r,n,a,o);s.errorX&&i.extendFlat(s.errorX,l.x),s.errorY&&i.extendFlat(s.errorY,l.y)}s.text&&(i.extendFlat(s.text,{positions:n},p.textPosition(t,r,s.text,s.marker)),i.extendFlat(s.textSel,{positions:n},p.textPosition(t,r,s.text,s.markerSel)),i.extendFlat(s.textUnsel,{positions:n},p.textPosition(t,r,s.text,s.markerUnsel)));return s}(t,0,e,L,E,C),O=d(t,_);return f(y,e),T?z.marker&&(P=2*(z.marker.sizeAvg||Math.max(z.marker.size,3))):P=c(e,w),u(t,e,x,b,E,C,P),z.errorX&&v(e,x,z.errorX),z.errorY&&v(e,b,z.errorY),z.fill&&!O.fill2d&&(O.fill2d=!0),z.marker&&!O.scatter2d&&(O.scatter2d=!0),z.line&&!O.line2d&&(O.line2d=!0),!z.errorX&&!z.errorY||O.error2d||(O.error2d=!0),z.text&&!O.glText&&(O.glText=!0),z.marker&&(z.marker.snap=w),O.lineOptions.push(z.line),O.errorXOptions.push(z.errorX),O.errorYOptions.push(z.errorY),O.fillOptions.push(z.fill),O.markerOptions.push(z.marker),O.markerSelectedOptions.push(z.markerSel),O.markerUnselectedOptions.push(z.markerUnsel),O.textOptions.push(z.text),O.textSelectedOptions.push(z.textSel),O.textUnselectedOptions.push(z.textUnsel),O.selectBatch.push([]),O.unselectBatch.push([]),M._scene=O,M.index=O.count,M.x=E,M.y=C,M.positions=L,O.count++,[{x:!1,y:!1,t:M,trace:e}]}},{"../../constants/numerical":753,"../../lib":778,"../../plots/cartesian/align_period":824,"../../plots/cartesian/autorange":826,"../../plots/cartesian/axis_ids":830,"../scatter/calc":1187,"../scatter/colorscale_calc":1189,"./constants":1240,"./convert":1241,"./scene_update":1249,"@plotly/point-cluster":57}],1240:[function(t,e,r){"use strict";e.exports={TOO_MANY_POINTS:1e5,SYMBOL_SDF_SIZE:200,SYMBOL_SIZE:20,SYMBOL_STROKE:1,DOT_RE:/-dot/,OPEN_RE:/-open/,DASHES:{solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}}},{}],1241:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("svg-path-sdf"),a=t("color-normalize"),o=t("../../registry"),s=t("../../lib"),l=t("../../components/drawing"),c=t("../../plots/cartesian/axis_ids"),u=t("../../lib/gl_format_color").formatColor,f=t("../scatter/subtypes"),h=t("../scatter/make_bubble_size_func"),p=t("./helpers"),d=t("./constants"),g=t("../../constants/interactions").DESELECTDIM,m={start:1,left:1,end:-1,right:-1,middle:0,center:0,bottom:1,top:-1},v=t("../../components/fx/helpers").appendArrayPointValue;function y(t,e){var r,i=t._fullLayout,a=e._length,o=e.textfont,l=e.textposition,c=Array.isArray(l)?l:[l],u=o.color,f=o.size,h=o.family,p={},d=e.texttemplate;if(d){p.text=[];var g=i._d3locale,m=Array.isArray(d),y=m?Math.min(d.length,a):a,x=m?function(t){return d[t]}:function(){return d};for(r=0;rd.TOO_MANY_POINTS||f.hasMarkers(e)?"rect":"round";if(c&&e.connectgaps){var h=n[0],p=n[1];for(i=0;i1?l[i]:l[0]:l,d=Array.isArray(c)?c.length>1?c[i]:c[0]:c,g=m[p],v=m[d],y=u?u/.8+1:0,x=-v*y-.5*v;o.offset[i]=[g*y/h,x/h]}}return o}}},{"../../components/drawing":665,"../../components/fx/helpers":679,"../../constants/interactions":752,"../../lib":778,"../../lib/gl_format_color":774,"../../plots/cartesian/axis_ids":830,"../../registry":910,"../scatter/make_bubble_size_func":1203,"../scatter/subtypes":1211,"./constants":1240,"./helpers":1245,"color-normalize":125,"fast-isnumeric":241,"svg-path-sdf":574}],1242:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("./helpers"),o=t("./attributes"),s=t("../scatter/constants"),l=t("../scatter/subtypes"),c=t("../scatter/xy_defaults"),u=t("../scatter/period_defaults"),f=t("../scatter/marker_defaults"),h=t("../scatter/line_defaults"),p=t("../scatter/fillcolor_defaults"),d=t("../scatter/text_defaults");e.exports=function(t,e,r,g){function m(r,i){return n.coerce(t,e,o,r,i)}var v=!!t.marker&&a.isOpenSymbol(t.marker.symbol),y=l.isBubble(t),x=c(t,e,g,m);if(x){u(t,e,g,m);var b=x100},r.isDotSymbol=function(t){return"string"==typeof t?n.DOT_RE.test(t):t>200}},{"./constants":1240}],1246:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../scatter/get_trace_color");function o(t,e,r,o){var s=t.xa,l=t.ya,c=t.distance,u=t.dxy,f=t.index,h={pointNumber:f,x:e[f],y:r[f]};h.tx=Array.isArray(o.text)?o.text[f]:o.text,h.htx=Array.isArray(o.hovertext)?o.hovertext[f]:o.hovertext,h.data=Array.isArray(o.customdata)?o.customdata[f]:o.customdata,h.tp=Array.isArray(o.textposition)?o.textposition[f]:o.textposition;var p=o.textfont;p&&(h.ts=i.isArrayOrTypedArray(p.size)?p.size[f]:p.size,h.tc=Array.isArray(p.color)?p.color[f]:p.color,h.tf=Array.isArray(p.family)?p.family[f]:p.family);var d=o.marker;d&&(h.ms=i.isArrayOrTypedArray(d.size)?d.size[f]:d.size,h.mo=i.isArrayOrTypedArray(d.opacity)?d.opacity[f]:d.opacity,h.mx=i.isArrayOrTypedArray(d.symbol)?d.symbol[f]:d.symbol,h.mc=i.isArrayOrTypedArray(d.color)?d.color[f]:d.color);var g=d&&d.line;g&&(h.mlc=Array.isArray(g.color)?g.color[f]:g.color,h.mlw=i.isArrayOrTypedArray(g.width)?g.width[f]:g.width);var m=d&&d.gradient;m&&"none"!==m.type&&(h.mgt=Array.isArray(m.type)?m.type[f]:m.type,h.mgc=Array.isArray(m.color)?m.color[f]:m.color);var v=s.c2p(h.x,!0),y=l.c2p(h.y,!0),x=h.mrc||1,b=o.hoverlabel;b&&(h.hbg=Array.isArray(b.bgcolor)?b.bgcolor[f]:b.bgcolor,h.hbc=Array.isArray(b.bordercolor)?b.bordercolor[f]:b.bordercolor,h.hts=i.isArrayOrTypedArray(b.font.size)?b.font.size[f]:b.font.size,h.htc=Array.isArray(b.font.color)?b.font.color[f]:b.font.color,h.htf=Array.isArray(b.font.family)?b.font.family[f]:b.font.family,h.hnl=i.isArrayOrTypedArray(b.namelength)?b.namelength[f]:b.namelength);var _=o.hoverinfo;_&&(h.hi=Array.isArray(_)?_[f]:_);var w=o.hovertemplate;w&&(h.ht=Array.isArray(w)?w[f]:w);var T={};T[t.index]=h;var k=o._origX,M=o._origY,A=i.extendFlat({},t,{color:a(o,h),x0:v-x,x1:v+x,xLabelVal:k?k[f]:h.x,y0:y-x,y1:y+x,yLabelVal:M?M[f]:h.y,cd:T,distance:c,spikeDistance:u,hovertemplate:h.ht});return h.htx?A.text=h.htx:h.tx?A.text=h.tx:o.text&&(A.text=o.text),i.fillText(h,o,A),n.getComponentMethod("errorbars","hoverInfo")(h,o,A),A}e.exports={hoverPoints:function(t,e,r,n){var i,a,s,l,c,u,f,h,p,d=t.cd,g=d[0].t,m=d[0].trace,v=t.xa,y=t.ya,x=g.x,b=g.y,_=v.c2p(e),w=y.c2p(r),T=t.distance;if(g.tree){var k=v.p2c(_-T),M=v.p2c(_+T),A=y.p2c(w-T),S=y.p2c(w+T);i="x"===n?g.tree.range(Math.min(k,M),Math.min(y._rl[0],y._rl[1]),Math.max(k,M),Math.max(y._rl[0],y._rl[1])):g.tree.range(Math.min(k,M),Math.min(A,S),Math.max(k,M),Math.max(A,S))}else i=g.ids;var E=T;if("x"===n)for(c=0;c-1;c--)s=x[i[c]],l=b[i[c]],u=v.c2p(s)-_,f=y.c2p(l)-w,(h=Math.sqrt(u*u+f*f))v.glText.length){var w=b-v.glText.length;for(d=0;dr&&(isNaN(e[n])||isNaN(e[n+1]));)n-=2;t.positions=e.slice(r,n+2)}return t})),v.line2d.update(v.lineOptions)),v.error2d){var k=(v.errorXOptions||[]).concat(v.errorYOptions||[]);v.error2d.update(k)}v.scatter2d&&v.scatter2d.update(v.markerOptions),v.fillOrder=s.repeat(null,b),v.fill2d&&(v.fillOptions=v.fillOptions.map((function(t,e){var n=r[e];if(t&&n&&n[0]&&n[0].trace){var i,a,o=n[0],s=o.trace,l=o.t,c=v.lineOptions[e],u=[];s._ownfill&&u.push(e),s._nexttrace&&u.push(e+1),u.length&&(v.fillOrder[e]=u);var f,h,p=[],d=c&&c.positions||l.positions;if("tozeroy"===s.fill){for(f=0;ff&&isNaN(d[h+1]);)h-=2;0!==d[f+1]&&(p=[d[f],0]),p=p.concat(d.slice(f,h+2)),0!==d[h+1]&&(p=p.concat([d[h],0]))}else if("tozerox"===s.fill){for(f=0;ff&&isNaN(d[h]);)h-=2;0!==d[f]&&(p=[0,d[f+1]]),p=p.concat(d.slice(f,h+2)),0!==d[h]&&(p=p.concat([0,d[h+1]]))}else if("toself"===s.fill||"tonext"===s.fill){for(p=[],i=0,a=0;a-1;for(d=0;d=0?Math.floor((e+180)/360):Math.ceil((e-180)/360)),d=e-p;if(n.getClosest(l,(function(t){var e=t.lonlat;if(e[0]===s)return 1/0;var n=i.modHalf(e[0],360),a=e[1],o=h.project([n,a]),l=o.x-u.c2p([d,a]),c=o.y-f.c2p([n,r]),p=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(l*l+c*c)-p,1-3/p)}),t),!1!==t.index){var g=l[t.index],m=g.lonlat,v=[i.modHalf(m[0],360)+p,m[1]],y=u.c2p(v),x=f.c2p(v),b=g.mrc||1;t.x0=y-b,t.x1=y+b,t.y0=x-b,t.y1=x+b;var _={};_[c.subplot]={_subplot:h};var w=c._module.formatLabels(g,c,_);return t.lonLabel=w.lonLabel,t.latLabel=w.latLabel,t.color=a(c,g),t.extraText=function(t,e,r){if(t.hovertemplate)return;var n=(e.hi||t.hoverinfo).split("+"),i=-1!==n.indexOf("all"),a=-1!==n.indexOf("lon"),s=-1!==n.indexOf("lat"),l=e.lonlat,c=[];function u(t){return t+"\xb0"}i||a&&s?c.push("("+u(l[0])+", "+u(l[1])+")"):a?c.push(r.lon+u(l[0])):s&&c.push(r.lat+u(l[1]));(i||-1!==n.indexOf("text"))&&o(e,t,c);return c.join("
")}(c,g,l[0].t.labels),t.hovertemplate=c.hovertemplate,[t]}}},{"../../components/fx":683,"../../constants/numerical":753,"../../lib":778,"../scatter/get_trace_color":1196}],1257:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("../scattergeo/calc"),plot:t("./plot"),hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),styleOnSelect:function(t,e){e&&e[0].trace._glTrace.update(e)},moduleType:"trace",name:"scattermapbox",basePlotModule:t("../../plots/mapbox"),categories:["mapbox","gl","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/mapbox":884,"../scatter/marker_colorbar":1204,"../scattergeo/calc":1229,"./attributes":1251,"./defaults":1253,"./event_data":1254,"./format_labels":1255,"./hover":1256,"./plot":1258,"./select":1259}],1258:[function(t,e,r){"use strict";var n=t("./convert"),i=t("../../plots/mapbox/constants").traceLayerPrefix,a=["fill","line","circle","symbol"];function o(t,e){this.type="scattermapbox",this.subplot=t,this.uid=e,this.sourceIds={fill:"source-"+e+"-fill",line:"source-"+e+"-line",circle:"source-"+e+"-circle",symbol:"source-"+e+"-symbol"},this.layerIds={fill:i+e+"-fill",line:i+e+"-line",circle:i+e+"-circle",symbol:i+e+"-symbol"},this.below=null}var s=o.prototype;s.addSource=function(t,e){this.subplot.map.addSource(this.sourceIds[t],{type:"geojson",data:e.geojson})},s.setSourceData=function(t,e){this.subplot.map.getSource(this.sourceIds[t]).setData(e.geojson)},s.addLayer=function(t,e,r){this.subplot.addLayer({type:t,id:this.layerIds[t],source:this.sourceIds[t],layout:e.layout,paint:e.paint},r)},s.update=function(t){var e,r,i,o=this.subplot,s=o.map,l=n(o.gd,t),c=o.belowLookup["trace-"+this.uid];if(c!==this.below){for(e=a.length-1;e>=0;e--)r=a[e],s.removeLayer(this.layerIds[r]);for(e=0;e=0;e--){var r=a[e];t.removeLayer(this.layerIds[r]),t.removeSource(this.sourceIds[r])}},e.exports=function(t,e){for(var r=e[0].trace,i=new o(t,r.uid),s=n(t.gd,e),l=i.below=t.belowLookup["trace-"+r.uid],c=0;c")}}e.exports={hoverPoints:function(t,e,r,a){var o=n(t,e,r,a);if(o&&!1!==o[0].index){var s=o[0];if(void 0===s.index)return o;var l=t.subplot,c=s.cd[s.index],u=s.trace;if(l.isPtInside(c))return s.xLabelVal=void 0,s.yLabelVal=void 0,i(c,u,l,s),s.hovertemplate=u.hovertemplate,o}},makeHoverPointText:i}},{"../scatter/hover":1197}],1265:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:t("../../plots/polar"),categories:["polar","symbols","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,selectPoints:t("../scatter/select"),meta:{}}},{"../../plots/polar":893,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1260,"./calc":1261,"./defaults":1262,"./format_labels":1263,"./hover":1264,"./plot":1266}],1266:[function(t,e,r){"use strict";var n=t("../scatter/plot"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r){for(var a=e.layers.frontplot.select("g.scatterlayer"),o={xaxis:e.xaxis,yaxis:e.yaxis,plot:e.framework,layerClipId:e._hasClipOnAxisFalse?e.clipIds.forTraces:null},s=e.radialAxis,l=e.angularAxis,c=0;c=c&&(y.marker.cluster=d.tree),y.marker&&(y.markerSel.positions=y.markerUnsel.positions=y.marker.positions=_),y.line&&_.length>1&&l.extendFlat(y.line,s.linePositions(t,p,_)),y.text&&(l.extendFlat(y.text,{positions:_},s.textPosition(t,p,y.text,y.marker)),l.extendFlat(y.textSel,{positions:_},s.textPosition(t,p,y.text,y.markerSel)),l.extendFlat(y.textUnsel,{positions:_},s.textPosition(t,p,y.text,y.markerUnsel))),y.fill&&!h.fill2d&&(h.fill2d=!0),y.marker&&!h.scatter2d&&(h.scatter2d=!0),y.line&&!h.line2d&&(h.line2d=!0),y.text&&!h.glText&&(h.glText=!0),h.lineOptions.push(y.line),h.fillOptions.push(y.fill),h.markerOptions.push(y.marker),h.markerSelectedOptions.push(y.markerSel),h.markerUnselectedOptions.push(y.markerUnsel),h.textOptions.push(y.text),h.textSelectedOptions.push(y.textSel),h.textUnselectedOptions.push(y.textUnsel),h.selectBatch.push([]),h.unselectBatch.push([]),d.x=w,d.y=T,d.rawx=w,d.rawy=T,d.r=m,d.theta=v,d.positions=_,d._scene=h,d.index=h.count,h.count++}})),a(t,e,r)}}},{"../../lib":778,"../scattergl/constants":1240,"../scattergl/convert":1241,"../scattergl/plot":1248,"../scattergl/scene_update":1249,"@plotly/point-cluster":57,"fast-isnumeric":241}],1274:[function(t,e,r){"use strict";var n=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../../plots/template_attributes").texttemplateAttrs,a=t("../scatter/attributes"),o=t("../../plots/attributes"),s=t("../../components/colorscale/attributes"),l=t("../../components/drawing/attributes").dash,c=t("../../lib/extend").extendFlat,u=a.marker,f=a.line,h=u.line;e.exports={a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},c:{valType:"data_array",editType:"calc"},sum:{valType:"number",dflt:0,min:0,editType:"calc"},mode:c({},a.mode,{dflt:"markers"}),text:c({},a.text,{}),texttemplate:i({editType:"plot"},{keys:["a","b","c","text"]}),hovertext:c({},a.hovertext,{}),line:{color:f.color,width:f.width,dash:l,shape:c({},f.shape,{values:["linear","spline"]}),smoothing:f.smoothing,editType:"calc"},connectgaps:a.connectgaps,cliponaxis:a.cliponaxis,fill:c({},a.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:a.fillcolor,marker:c({symbol:u.symbol,opacity:u.opacity,maxdisplayed:u.maxdisplayed,size:u.size,sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,line:c({width:h.width,editType:"calc"},s("marker.line")),gradient:u.gradient,editType:"calc"},s("marker")),textfont:a.textfont,textposition:a.textposition,selected:a.selected,unselected:a.unselected,hoverinfo:c({},o.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:a.hoveron,hovertemplate:n()}},{"../../components/colorscale/attributes":650,"../../components/drawing/attributes":664,"../../lib/extend":768,"../../plots/attributes":823,"../../plots/template_attributes":905,"../scatter/attributes":1186}],1275:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc"),a=t("../scatter/arrays_to_calcdata"),o=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize,l=["a","b","c"],c={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,u,f,h,p,d,g=t._fullLayout[e.subplot].sum,m=e.sum||g,v={a:e.a,b:e.b,c:e.c};for(r=0;r"),o.hovertemplate=h.hovertemplate,a}function x(t,e){v.push(t._hovertitle+": "+e)}}},{"../scatter/hover":1197}],1280:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../scatter/select"),eventData:t("./event_data"),moduleType:"trace",name:"scatterternary",basePlotModule:t("../../plots/ternary"),categories:["ternary","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/ternary":906,"../scatter/marker_colorbar":1204,"../scatter/select":1208,"../scatter/style":1210,"./attributes":1274,"./calc":1275,"./defaults":1276,"./event_data":1277,"./format_labels":1278,"./hover":1279,"./plot":1281}],1281:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e,r){var i=e.plotContainer;i.select(".scatterlayer").selectAll("*").remove();var a={xaxis:e.xaxis,yaxis:e.yaxis,plot:i,layerClipId:e._hasClipOnAxisFalse?e.clipIdRelative:null},o=e.layers.frontplot.select("g.scatterlayer");n(t,a,r,o)}},{"../scatter/plot":1207}],1282:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../scattergl/attributes"),s=t("../../plots/cartesian/constants").idRegex,l=t("../../plot_api/plot_template").templatedArray,c=t("../../lib/extend").extendFlat,u=n.marker,f=u.line,h=c(i("marker.line",{editTypeOverride:"calc"}),{width:c({},f.width,{editType:"calc"}),editType:"calc"}),p=c(i("marker"),{symbol:u.symbol,size:c({},u.size,{editType:"markerSize"}),sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,opacity:u.opacity,colorbar:u.colorbar,line:h,editType:"calc"});function d(t){return{valType:"info_array",freeLength:!0,editType:"calc",items:{valType:"subplotid",regex:s[t],editType:"plot"}}}p.color.editType=p.cmin.editType=p.cmax.editType="style",e.exports={dimensions:l("dimension",{visible:{valType:"boolean",dflt:!0,editType:"calc"},label:{valType:"string",editType:"calc"},values:{valType:"data_array",editType:"calc+clearAxisTypes"},axis:{type:{valType:"enumerated",values:["linear","log","date","category"],editType:"calc+clearAxisTypes"},matches:{valType:"boolean",dflt:!1,editType:"calc"},editType:"calc+clearAxisTypes"},editType:"calc+clearAxisTypes"}),text:c({},o.text,{}),hovertext:c({},o.hovertext,{}),hovertemplate:a(),marker:p,xaxes:d("x"),yaxes:d("y"),diagonal:{visible:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},showupperhalf:{valType:"boolean",dflt:!0,editType:"calc"},showlowerhalf:{valType:"boolean",dflt:!0,editType:"calc"},selected:{marker:o.selected.marker,editType:"calc"},unselected:{marker:o.unselected.marker,editType:"calc"},opacity:o.opacity}},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/plot_template":816,"../../plots/cartesian/constants":833,"../../plots/template_attributes":905,"../scatter/attributes":1186,"../scattergl/attributes":1238}],1283:[function(t,e,r){"use strict";var n=t("regl-line2d"),i=t("../../registry"),a=t("../../lib/prepare_regl"),o=t("../../plots/get_data").getModuleCalcData,s=t("../../plots/cartesian"),l=t("../../plots/cartesian/axis_ids").getFromId,c=t("../../plots/cartesian/axes").shouldShowZeroLine;function u(t,e,r){for(var n=r.matrixOptions.data.length,i=e._visibleDims,a=r.viewOpts.ranges=new Array(n),o=0;oh?2*(b.sizeAvg||Math.max(b.size,3)):a(e,x),p=0;pa&&l||i-1,A=!0;if(o(x)||!!p.selectedpoints||M){var S=p._length;if(p.selectedpoints){g.selectBatch=p.selectedpoints;var E=p.selectedpoints,C={};for(l=0;l1&&(u=g[y-1],h=m[y-1],d=v[y-1]),e=0;eu?"-":"+")+"x")).replace("y",(f>h?"-":"+")+"y")).replace("z",(p>d?"-":"+")+"z");var C=function(){y=0,A=[],S=[],E=[]};(!y||y2?t.slice(1,e-1):2===e?[(t[0]+t[1])/2]:t}function p(t){var e=t.length;return 1===e?[.5,.5]:[t[1]-t[0],t[e-1]-t[e-2]]}function d(t,e){var r=t.fullSceneLayout,i=t.dataScale,u=e._len,f={};function d(t,e){var n=r[e],o=i[c[e]];return a.simpleMap(t,(function(t){return n.d2l(t)*o}))}if(f.vectors=l(d(e._u,"xaxis"),d(e._v,"yaxis"),d(e._w,"zaxis"),u),!u)return{positions:[],cells:[]};var g=d(e._Xs,"xaxis"),m=d(e._Ys,"yaxis"),v=d(e._Zs,"zaxis");if(f.meshgrid=[g,m,v],f.gridFill=e._gridFill,e._slen)f.startingPositions=l(d(e._startsX,"xaxis"),d(e._startsY,"yaxis"),d(e._startsZ,"zaxis"));else{for(var y=m[0],x=h(g),b=h(v),_=new Array(x.length*b.length),w=0,T=0;T=0};v?(r=Math.min(m.length,x.length),l=function(t){return M(m[t])&&A(t)},f=function(t){return String(m[t])}):(r=Math.min(y.length,x.length),l=function(t){return M(y[t])&&A(t)},f=function(t){return String(y[t])}),_&&(r=Math.min(r,b.length));for(var S=0;S1){for(var I=a.randstr(),P=0;P"),name:k||z("name")?l.name:void 0,color:T("hoverlabel.bgcolor")||y.color,borderColor:T("hoverlabel.bordercolor"),fontFamily:T("hoverlabel.font.family"),fontSize:T("hoverlabel.font.size"),fontColor:T("hoverlabel.font.color"),nameLength:T("hoverlabel.namelength"),textAlign:T("hoverlabel.align"),hovertemplate:k,hovertemplateLabels:L,eventData:[f(i,l,h.eventDataKeys)]};m&&(R.x0=S-i.rInscribed*i.rpx1,R.x1=S+i.rInscribed*i.rpx1,R.idealAlign=i.pxmid[0]<0?"left":"right"),v&&(R.x=S,R.idealAlign=S<0?"left":"right"),o.loneHover(R,{container:a._hoverlayer.node(),outerContainer:a._paper.node(),gd:r}),d._hasHoverLabel=!0}if(v){var F=t.select("path.surface");h.styleOne(F,i,l,{hovered:!0})}d._hasHoverEvent=!0,r.emit("plotly_hover",{points:[f(i,l,h.eventDataKeys)],event:n.event})}})),t.on("mouseout",(function(e){var i=r._fullLayout,a=r._fullData[d.index],s=n.select(this).datum();if(d._hasHoverEvent&&(e.originalEvent=n.event,r.emit("plotly_unhover",{points:[f(s,a,h.eventDataKeys)],event:n.event}),d._hasHoverEvent=!1),d._hasHoverLabel&&(o.loneUnhover(i._hoverlayer.node()),d._hasHoverLabel=!1),v){var l=t.select("path.surface");h.styleOne(l,s,a,{hovered:!1})}})),t.on("click",(function(t){var e=r._fullLayout,a=r._fullData[d.index],s=m&&(c.isHierarchyRoot(t)||c.isLeaf(t)),u=c.getPtId(t),p=c.isEntry(t)?c.findEntryWithChild(g,u):c.findEntryWithLevel(g,u),v=c.getPtId(p),y={points:[f(t,a,h.eventDataKeys)],event:n.event};s||(y.nextLevel=v);var x=l.triggerHandler(r,"plotly_"+d.type+"click",y);if(!1!==x&&e.hovermode&&(r._hoverdata=[f(t,a,h.eventDataKeys)],o.click(r,n.event)),!s&&!1!==x&&!r._dragging&&!r._transitioning){i.call("_storeDirectGUIEdit",a,e._tracePreGUI[a.uid],{level:a.level});var b={data:[{level:v}],traces:[d.index]},_={frame:{redraw:!1,duration:h.transitionTime},transition:{duration:h.transitionTime,easing:h.transitionEasing},mode:"immediate",fromcurrent:!0};o.loneUnhover(e._hoverlayer.node()),i.call("animate",r,b,_)}}))}},{"../../components/fx":683,"../../components/fx/helpers":679,"../../lib":778,"../../lib/events":767,"../../registry":910,"../pie/helpers":1165,"./helpers":1304,d3:169}],1304:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),a=t("../../lib/setcursor"),o=t("../pie/helpers");function s(t){return t.data.data.pid}r.findEntryWithLevel=function(t,e){var n;return e&&t.eachAfter((function(t){if(r.getPtId(t)===e)return n=t.copy()})),n||t},r.findEntryWithChild=function(t,e){var n;return t.eachAfter((function(t){for(var i=t.children||[],a=0;a0)},r.getMaxDepth=function(t){return t.maxdepth>=0?t.maxdepth:1/0},r.isHeader=function(t,e){return!(r.isLeaf(t)||t.depth===e._maxDepth-1)},r.getParent=function(t,e){return r.findEntryWithLevel(t,s(e))},r.listPath=function(t,e){var n=t.parent;if(!n)return[];var i=e?[n.data[e]]:[n];return r.listPath(n,e).concat(i)},r.getPath=function(t){return r.listPath(t,"label").join("/")+"/"},r.formatValue=o.formatPieValue,r.formatPercent=function(t,e){var r=n.formatPercent(t,0);return"0%"===r&&(r=o.formatPiePercent(t,e)),r}},{"../../components/color":643,"../../lib":778,"../../lib/setcursor":798,"../pie/helpers":1165}],1305:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"sunburst",basePlotModule:t("./base_plot"),categories:[],animatable:!0,attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot").plot,style:t("./style").style,colorbar:t("../scatter/marker_colorbar"),meta:{}}},{"../scatter/marker_colorbar":1204,"./attributes":1298,"./base_plot":1299,"./calc":1300,"./defaults":1302,"./layout_attributes":1306,"./layout_defaults":1307,"./plot":1308,"./style":1309}],1306:[function(t,e,r){"use strict";e.exports={sunburstcolorway:{valType:"colorlist",editType:"calc"},extendsunburstcolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{}],1307:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,a){return n.coerce(t,e,i,r,a)}r("sunburstcolorway",e.colorway),r("extendsunburstcolors")}},{"../../lib":778,"./layout_attributes":1306}],1308:[function(t,e,r){"use strict";var n=t("d3"),i=t("d3-hierarchy"),a=t("../../components/drawing"),o=t("../../lib"),s=t("../../lib/svg_text_utils"),l=t("../bar/uniform_text"),c=l.recordMinTextSize,u=l.clearMinTextSize,f=t("../pie/plot"),h=t("../pie/helpers").getRotationAngle,p=f.computeTransform,d=f.transformInsideText,g=t("./style").styleOne,m=t("../bar/style").resizeText,v=t("./fx"),y=t("./constants"),x=t("./helpers");function b(t,e,l,u){var f=t._fullLayout,m=!f.uniformtext.mode&&x.hasTransition(u),b=n.select(l).selectAll("g.slice"),w=e[0],T=w.trace,k=w.hierarchy,M=x.findEntryWithLevel(k,T.level),A=x.getMaxDepth(T),S=f._size,E=T.domain,C=S.w*(E.x[1]-E.x[0]),L=S.h*(E.y[1]-E.y[0]),I=.5*Math.min(C,L),P=w.cx=S.l+S.w*(E.x[1]+E.x[0])/2,z=w.cy=S.t+S.h*(1-E.y[0])-L/2;if(!M)return b.remove();var O=null,D={};m&&b.each((function(t){D[x.getPtId(t)]={rpx0:t.rpx0,rpx1:t.rpx1,x0:t.x0,x1:t.x1,transform:t.transform},!O&&x.isEntry(t)&&(O=t)}));var R=function(t){return i.partition().size([2*Math.PI,t.height+1])(t)}(M).descendants(),F=M.height+1,B=0,N=A;w.hasMultipleRoots&&x.isHierarchyRoot(M)&&(R=R.slice(1),F-=1,B=1,N+=1),R=R.filter((function(t){return t.y1<=N}));var j=h(T.rotation);j&&R.forEach((function(t){t.x0+=j,t.x1+=j}));var U=Math.min(F,A),V=function(t){return(t-B)/U*I},q=function(t,e){return[t*Math.cos(e),-t*Math.sin(e)]},H=function(t){return o.pathAnnulus(t.rpx0,t.rpx1,t.x0,t.x1,P,z)},G=function(t){return P+_(t)[0]*(t.transform.rCenter||0)+(t.transform.x||0)},Y=function(t){return z+_(t)[1]*(t.transform.rCenter||0)+(t.transform.y||0)};(b=b.data(R,x.getPtId)).enter().append("g").classed("slice",!0),m?b.exit().transition().each((function(){var t=n.select(this);t.select("path.surface").transition().attrTween("d",(function(t){var e=function(t){var e,r=x.getPtId(t),i=D[r],a=D[x.getPtId(M)];if(a){var o=(t.x1>a.x1?2*Math.PI:0)+j;e=t.rpx1W?2*Math.PI:0)+j;e={x0:a,x1:a}}else e={rpx0:I,rpx1:I},o.extendFlat(e,J(t));else e={rpx0:0,rpx1:0};else e={x0:j,x1:j};return n.interpolate(e,i)}(t);return function(t){return H(e(t))}})):u.attr("d",H),l.call(v,M,t,e,{eventDataKeys:y.eventDataKeys,transitionTime:y.CLICK_TRANSITION_TIME,transitionEasing:y.CLICK_TRANSITION_EASING}).call(x.setSliceCursor,t,{hideOnRoot:!0,hideOnLeaves:!0,isTransitioning:t._transitioning}),u.call(g,i,T);var h=o.ensureSingle(l,"g","slicetext"),b=o.ensureSingle(h,"text","",(function(t){t.attr("data-notex",1)})),_=o.ensureUniformFontSize(t,x.determineTextFont(T,i,f.font));b.text(r.formatSliceLabel(i,M,T,e,f)).classed("slicetext",!0).attr("text-anchor","middle").call(a.font,_).call(s.convertToTspans,t);var k=a.bBox(b.node());i.transform=d(k,i,w),i.transform.targetX=G(i),i.transform.targetY=Y(i);var A=function(t,e){var r=t.transform;return p(r,e),r.fontSize=_.size,c(T.type,r,f),o.getTextTransform(r)};m?b.transition().attrTween("transform",(function(t){var e=function(t){var e,r=D[x.getPtId(t)],i=t.transform;if(r)e=r;else if(e={rpx1:t.rpx1,transform:{textPosAngle:i.textPosAngle,scale:0,rotate:i.rotate,rCenter:i.rCenter,x:i.x,y:i.y}},O)if(t.parent)if(W){var a=t.x1>W?2*Math.PI:0;e.x0=e.x1=a}else o.extendFlat(e,J(t));else e.x0=e.x1=j;else e.x0=e.x1=j;var s=n.interpolate(e.transform.textPosAngle,t.transform.textPosAngle),l=n.interpolate(e.rpx1,t.rpx1),u=n.interpolate(e.x0,t.x0),h=n.interpolate(e.x1,t.x1),p=n.interpolate(e.transform.scale,i.scale),d=n.interpolate(e.transform.rotate,i.rotate),g=0===i.rCenter?3:0===e.transform.rCenter?1/3:1,m=n.interpolate(e.transform.rCenter,i.rCenter);return function(t){var e=l(t),r=u(t),n=h(t),a=function(t){return m(Math.pow(t,g))}(t),o={pxmid:q(e,(r+n)/2),rpx1:e,transform:{textPosAngle:s(t),rCenter:a,x:i.x,y:i.y}};return c(T.type,i,f),{transform:{targetX:G(o),targetY:Y(o),scale:p(t),rotate:d(t),rCenter:a}}}}(t);return function(t){return A(e(t),k)}})):b.attr("transform",A(i,k))}))}function _(t){return e=t.rpx1,r=t.transform.textPosAngle,[e*Math.sin(r),-e*Math.cos(r)];var e,r}r.plot=function(t,e,r,i){var a,o,s=t._fullLayout,l=s._sunburstlayer,c=!r,f=!s.uniformtext.mode&&x.hasTransition(r);(u("sunburst",s),(a=l.selectAll("g.trace.sunburst").data(e,(function(t){return t[0].trace.uid}))).enter().append("g").classed("trace",!0).classed("sunburst",!0).attr("stroke-linejoin","round"),a.order(),f)?(i&&(o=i()),n.transition().duration(r.duration).ease(r.easing).each("end",(function(){o&&o()})).each("interrupt",(function(){o&&o()})).each((function(){l.selectAll("g.trace").each((function(e){b(t,e,this,r)}))}))):(a.each((function(e){b(t,e,this,r)})),s.uniformtext.mode&&m(t,s._sunburstlayer.selectAll(".trace"),"sunburst"));c&&a.exit().remove()},r.formatSliceLabel=function(t,e,r,n,i){var a=r.texttemplate,s=r.textinfo;if(!(a||s&&"none"!==s))return"";var l=i.separators,c=n[0],u=t.data.data,f=c.hierarchy,h=x.isHierarchyRoot(t),p=x.getParent(f,t),d=x.getValue(t);if(!a){var g,m=s.split("+"),v=function(t){return-1!==m.indexOf(t)},y=[];if(v("label")&&u.label&&y.push(u.label),u.hasOwnProperty("v")&&v("value")&&y.push(x.formatValue(u.v,l)),!h){v("current path")&&y.push(x.getPath(t.data));var b=0;v("percent parent")&&b++,v("percent entry")&&b++,v("percent root")&&b++;var _=b>1;if(b){var w,T=function(t){g=x.formatPercent(w,l),_&&(g+=" of "+t),y.push(g)};v("percent parent")&&!h&&(w=d/x.getValue(p),T("parent")),v("percent entry")&&(w=d/x.getValue(e),T("entry")),v("percent root")&&(w=d/x.getValue(f),T("root"))}}return v("text")&&(g=o.castOption(r,u.i,"text"),o.isValidTextValue(g)&&y.push(g)),y.join("
")}var k=o.castOption(r,u.i,"texttemplate");if(!k)return"";var M={};u.label&&(M.label=u.label),u.hasOwnProperty("v")&&(M.value=u.v,M.valueLabel=x.formatValue(u.v,l)),M.currentPath=x.getPath(t.data),h||(M.percentParent=d/x.getValue(p),M.percentParentLabel=x.formatPercent(M.percentParent,l),M.parent=x.getPtLabel(p)),M.percentEntry=d/x.getValue(e),M.percentEntryLabel=x.formatPercent(M.percentEntry,l),M.entry=x.getPtLabel(e),M.percentRoot=d/x.getValue(f),M.percentRootLabel=x.formatPercent(M.percentRoot,l),M.root=x.getPtLabel(f),u.hasOwnProperty("color")&&(M.color=u.color);var A=o.castOption(r,u.i,"text");return(o.isValidTextValue(A)||""===A)&&(M.text=A),M.customdata=o.castOption(r,u.i,"customdata"),o.texttemplateString(k,M,i._d3locale,M,r._meta||{})}},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../bar/style":934,"../bar/uniform_text":936,"../pie/helpers":1165,"../pie/plot":1169,"./constants":1301,"./fx":1303,"./helpers":1304,"./style":1309,d3:169,"d3-hierarchy":161}],1309:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/color"),a=t("../../lib"),o=t("../bar/uniform_text").resizeText;function s(t,e,r){var n=e.data.data,o=!e.children,s=n.i,l=a.castOption(r,s,"marker.line.color")||i.defaultLine,c=a.castOption(r,s,"marker.line.width")||0;t.style("stroke-width",c).call(i.fill,n.color).call(i.stroke,l).style("opacity",o?r.leaf.opacity:null)}e.exports={style:function(t){var e=t._fullLayout._sunburstlayer.selectAll(".trace");o(t,e,"sunburst"),e.each((function(t){var e=n.select(this),r=t[0].trace;e.style("opacity",r.opacity),e.selectAll("path.surface").each((function(t){n.select(this).call(s,t,r)}))}))},styleOne:s}},{"../../components/color":643,"../../lib":778,"../bar/uniform_text":936,d3:169}],1310:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/attributes"),a=t("../../plots/template_attributes").hovertemplateAttrs,o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll;function c(t){return{show:{valType:"boolean",dflt:!1},start:{valType:"number",dflt:null,editType:"plot"},end:{valType:"number",dflt:null,editType:"plot"},size:{valType:"number",dflt:null,min:0,editType:"plot"},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 u=e.exports=l(s({z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:a(),connectgaps:{valType:"boolean",dflt:!1,editType:"calc"},surfacecolor:{valType:"data_array"}},i("",{colorAttr:"z or surfacecolor",showScaleDflt:!0,autoColorDflt:!1,editTypeOverride:"calc"}),{contours:{x:c(),y:c(),z:c()},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},opacityscale:{valType:"any",editType:"calc"},_deprecated:{zauto:s({},i.zauto,{}),zmin:s({},i.zmin,{}),zmax:s({},i.zmax,{})},hoverinfo:s({},o.hoverinfo),showlegend:s({},o.showlegend,{dflt:!1})}),"calc","nested");u.x.editType=u.y.editType=u.z.editType="calc+clearAxisTypes",u.transforms=void 0},{"../../components/color":643,"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plot_api/edit_types":809,"../../plots/attributes":823,"../../plots/template_attributes":905}],1311:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(t,e,{vals:e.surfacecolor,containerStr:"",cLetter:"c"}):n(t,e,{vals:e.z,containerStr:"",cLetter:"c"})}},{"../../components/colorscale/calc":651}],1312:[function(t,e,r){"use strict";var n=t("gl-surface3d"),i=t("ndarray"),a=t("ndarray-linear-interpolate").d2,o=t("../heatmap/interp2d"),s=t("../heatmap/find_empties"),l=t("../../lib").isArrayOrTypedArray,c=t("../../lib/gl_format_color").parseColorScale,u=t("../../lib/str2rgbarray"),f=t("../../components/colorscale").extractOpts;function h(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.contourStart=[null,null,null],this.contourEnd=[null,null,null],this.contourSize=[0,0,0],this.minValues=[1/0,1/0,1/0],this.maxValues=[-1/0,-1/0,-1/0],this.dataScaleX=1,this.dataScaleY=1,this.refineData=!0,this.objectOffset=[0,0,0]}var p=h.prototype;p.getXat=function(t,e,r,n){var i=l(this.data.x)?l(this.data.x[0])?this.data.x[e][t]:this.data.x[t]:t;return void 0===r?i:n.d2l(i,0,r)},p.getYat=function(t,e,r,n){var i=l(this.data.y)?l(this.data.y[0])?this.data.y[e][t]:this.data.y[e]:e;return void 0===r?i:n.d2l(i,0,r)},p.getZat=function(t,e,r,n){var i=this.data.z[e][t];return null===i&&this.data.connectgaps&&this.data._interpolatedZ&&(i=this.data._interpolatedZ[e][t]),void 0===r?i:n.d2l(i,0,r)},p.handlePick=function(t){if(t.object===this.surface){var e=(t.data.index[0]-1)/this.dataScaleX-1,r=(t.data.index[1]-1)/this.dataScaleY-1,n=Math.max(Math.min(Math.round(e),this.data.z[0].length-1),0),i=Math.max(Math.min(Math.round(r),this.data._ylength-1),0);t.index=[n,i],t.traceCoordinate=[this.getXat(n,i),this.getYat(n,i),this.getZat(n,i)],t.dataCoordinate=[this.getXat(n,i,this.data.xcalendar,this.scene.fullSceneLayout.xaxis),this.getYat(n,i,this.data.ycalendar,this.scene.fullSceneLayout.yaxis),this.getZat(n,i,this.data.zcalendar,this.scene.fullSceneLayout.zaxis)];for(var a=0;a<3;a++){var o=t.dataCoordinate[a];null!=o&&(t.dataCoordinate[a]*=this.scene.dataScale[a])}var s=this.data.hovertext||this.data.text;return Array.isArray(s)&&s[i]&&void 0!==s[i][n]?t.textLabel=s[i][n]:t.textLabel=s||"",t.data.dataCoordinate=t.dataCoordinate.slice(),this.surface.highlight(t.data),this.scene.glplot.spikes.position=t.dataCoordinate,!0}};var d=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999];function g(t,e){if(t0){r=d[n];break}return r}function y(t,e){if(!(t<1||e<1)){for(var r=m(t),n=m(e),i=1,a=0;a_;)r--,r/=v(r),++r1?n:1},p.refineCoords=function(t){for(var e=this.dataScaleX,r=this.dataScaleY,n=t[0].shape[0],a=t[0].shape[1],o=0|Math.floor(t[0].shape[0]*e+1),s=0|Math.floor(t[0].shape[1]*r+1),l=1+n+1,c=1+a+1,u=i(new Float32Array(l*c),[l,c]),f=[1/e,0,0,0,1/r,0,0,0,1],h=0;h0&&null!==this.contourStart[t]&&null!==this.contourEnd[t]&&this.contourEnd[t]>this.contourStart[t]))for(i[t]=!0,e=this.contourStart[t];ea&&(this.minValues[e]=a),this.maxValues[e]",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}},{}],1319:[function(t,e,r){"use strict";var n=t("./constants"),i=t("../../lib/extend").extendFlat,a=t("fast-isnumeric");function o(t){if(Array.isArray(t)){for(var e=0,r=0;r=e||c===t.length-1)&&(n[i]=o,o.key=l++,o.firstRowIndex=s,o.lastRowIndex=c,o={firstRowIndex:null,lastRowIndex:null,rows:[]},i+=a,s=c+1,a=0);return n}e.exports=function(t,e){var r=l(e.cells.values),p=function(t){return t.slice(e.header.values.length,t.length)},d=l(e.header.values);d.length&&!d[0].length&&(d[0]=[""],d=l(d));var g=d.concat(p(r).map((function(){return c((d[0]||[""]).length)}))),m=e.domain,v=Math.floor(t._fullLayout._size.w*(m.x[1]-m.x[0])),y=Math.floor(t._fullLayout._size.h*(m.y[1]-m.y[0])),x=e.header.values.length?g[0].map((function(){return e.header.height})):[n.emptyHeaderHeight],b=r.length?r[0].map((function(){return e.cells.height})):[],_=x.reduce(s,0),w=h(b,y-_+n.uplift),T=f(h(x,_),[]),k=f(w,T),M={},A=e._fullInput.columnorder.concat(p(r.map((function(t,e){return e})))),S=g.map((function(t,r){var n=Array.isArray(e.columnwidth)?e.columnwidth[Math.min(r,e.columnwidth.length-1)]:e.columnwidth;return a(n)?Number(n):1})),E=S.reduce(s,0);S=S.map((function(t){return t/E*v}));var C=Math.max(o(e.header.line.width),o(e.cells.line.width)),L={key:e.uid+t._context.staticPlot,translateX:m.x[0]*t._fullLayout._size.w,translateY:t._fullLayout._size.h*(1-m.y[1]),size:t._fullLayout._size,width:v,maxLineWidth:C,height:y,columnOrder:A,groupHeight:y,rowBlocks:k,headerRowBlocks:T,scrollY:0,cells:i({},e.cells,{values:r}),headerCells:i({},e.header,{values:g}),gdColumns:g.map((function(t){return t[0]})),gdColumnsOriginalOrder:g.map((function(t){return t[0]})),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:g.map((function(t,e){var r=M[t];return M[t]=(r||0)+1,{key:t+"__"+M[t],label:t,specIndex:e,xIndex:A[e],xScale:u,x:void 0,calcdata:void 0,columnWidth:S[e]}}))};return L.columns.forEach((function(t){t.calcdata=L,t.x=u(t)})),L}},{"../../lib/extend":768,"./constants":1318,"fast-isnumeric":241}],1320:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat;r.splitToPanels=function(t){var e=[0,0],r=n({},t,{key:"header",type:"header",page:0,prevPages:e,currentRepaint:[null,null],dragHandle:!0,values:t.calcdata.headerCells.values[t.specIndex],rowBlocks:t.calcdata.headerRowBlocks,calcdata:n({},t.calcdata,{cells:t.calcdata.headerCells})});return[n({},t,{key:"cells1",type:"cells",page:0,prevPages:e,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),n({},t,{key:"cells2",type:"cells",page:1,prevPages:e,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),r]},r.splitToCells=function(t){var e=function(t){var e=t.rowBlocks[t.page],r=e?e.rows[0].rowIndex:0,n=e?r+e.rows.length:0;return[r,n]}(t);return(t.values||[]).slice(e[0],e[1]).map((function(r,n){return{keyWithinBlock:n+("string"==typeof r&&r.match(/[<$&> ]/)?"_keybuster_"+Math.random():""),key:e[0]+n,column:t,calcdata:t.calcdata,page:t.page,rowBlocks:t.rowBlocks,value:r}}))}},{"../../lib/extend":768}],1321:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../plots/domain").defaults;e.exports=function(t,e,r,o){function s(r,a){return n.coerce(t,e,i,r,a)}a(e,o,s),s("columnwidth"),s("header.values"),s("header.format"),s("header.align"),s("header.prefix"),s("header.suffix"),s("header.height"),s("header.line.width"),s("header.line.color"),s("header.fill.color"),n.coerceFont(s,"header.font",n.extendFlat({},o.font)),function(t,e){for(var r=t.columnorder||[],n=t.header.values.length,i=r.slice(0,n),a=i.slice().sort((function(t,e){return t-e})),o=i.map((function(t){return a.indexOf(t)})),s=o.length;s/i),l=!o||s;t.mayHaveMarkup=o&&a.match(/[<&>]/);var c,u="string"==typeof(c=a)&&c.match(n.latexCheck);t.latex=u;var f,h,p=u?"":w(t.calcdata.cells.prefix,e,r)||"",d=u?"":w(t.calcdata.cells.suffix,e,r)||"",g=u?null:w(t.calcdata.cells.format,e,r)||null,m=p+(g?i.format(g)(t.value):t.value)+d;if(t.wrappingNeeded=!t.wrapped&&!l&&!u&&(f=_(m)),t.cellHeightMayIncrease=s||u||t.mayHaveMarkup||(void 0===f?_(m):f),t.needsConvertToTspans=t.mayHaveMarkup||t.wrappingNeeded||t.latex,t.wrappingNeeded){var v=(" "===n.wrapSplitCharacter?m.replace(/i&&n.push(a),i+=l}return n}(i,l,s);1===u.length&&(u[0]===i.length-1?u.unshift(u[0]-1):u.push(u[0]+1)),u[0]%2&&u.reverse(),e.each((function(t,e){t.page=u[e],t.scrollY=l})),e.attr("transform",(function(t){var e=O(t.rowBlocks,t.page)-t.scrollY;return c(0,e)})),t&&(C(t,r,e,u,n.prevPages,n,0),C(t,r,e,u,n.prevPages,n,1),y(r,t))}}function E(t,e,r,a){return function(o){var s=o.calcdata?o.calcdata:o,l=e.filter((function(t){return s.key===t.key})),c=r||s.scrollbarState.dragMultiplier,u=s.scrollY;s.scrollY=void 0===a?s.scrollY+c*i.event.dy:a;var f=l.selectAll("."+n.cn.yColumn).selectAll("."+n.cn.columnBlock).filter(k);return S(t,f,l),s.scrollY===u}}function C(t,e,r,n,i,a,o){n[o]!==i[o]&&(clearTimeout(a.currentRepaint[o]),a.currentRepaint[o]=setTimeout((function(){var a=r.filter((function(t,e){return e===o&&n[e]!==i[e]}));x(t,e,a,r),i[o]=n[o]})))}function L(t,e,r,a){return function(){var o=i.select(e.parentNode);o.each((function(t){var e=t.fragments;o.selectAll("tspan.line").each((function(t,r){e[r].width=this.getComputedTextLength()}));var r,i,a=e[e.length-1].width,s=e.slice(0,-1),l=[],c=0,u=t.column.columnWidth-2*n.cellPad;for(t.value="";s.length;)c+(i=(r=s.shift()).width+a)>u&&(t.value+=l.join(n.wrapSpacer)+n.lineBreaker,l=[],c=0),l.push(r.text),c+=i;c&&(t.value+=l.join(n.wrapSpacer)),t.wrapped=!0})),o.selectAll("tspan.line").remove(),b(o.select("."+n.cn.cellText),r,t,a),i.select(e.parentNode.parentNode).call(z)}}function I(t,e,r,a,o){return function(){if(!o.settledY){var s=i.select(e.parentNode),l=F(o),u=o.key-l.firstRowIndex,f=l.rows[u].rowHeight,h=o.cellHeightMayIncrease?e.parentNode.getBoundingClientRect().height+2*n.cellPad:f,p=Math.max(h,f);p-l.rows[u].rowHeight&&(l.rows[u].rowHeight=p,t.selectAll("."+n.cn.columnCell).call(z),S(null,t.filter(k),0),y(r,a,!0)),s.attr("transform",(function(){var t=this.parentNode.getBoundingClientRect(),e=i.select(this.parentNode).select("."+n.cn.cellRect).node().getBoundingClientRect(),r=this.transform.baseVal.consolidate(),a=e.top-t.top+(r?r.matrix.f:n.cellPad);return c(P(o,i.select(this.parentNode).select("."+n.cn.cellTextHolder).node().getBoundingClientRect().width),a)})),o.settledY=!0}}}function P(t,e){switch(t.align){case"left":return n.cellPad;case"right":return t.column.columnWidth-(e||0)-n.cellPad;case"center":return(t.column.columnWidth-(e||0))/2;default:return n.cellPad}}function z(t){t.attr("transform",(function(t){var e=t.rowBlocks[0].auxiliaryBlocks.reduce((function(t,e){return t+D(e,1/0)}),0),r=D(F(t),t.key);return c(0,r+e)})).selectAll("."+n.cn.cellRect).attr("height",(function(t){return(e=F(t),r=t.key,e.rows[r-e.firstRowIndex]).rowHeight;var e,r}))}function O(t,e){for(var r=0,n=e-1;n>=0;n--)r+=R(t[n]);return r}function D(t,e){for(var r=0,n=0;n","<","|","/","\\"],dflt:">",editType:"plot"},thickness:{valType:"number",min:12,editType:"plot"},textfont:u({},s.textfont,{}),editType:"calc"},text:s.text,textinfo:l.textinfo,texttemplate:i({editType:"plot"},{keys:c.eventDataKeys.concat(["label","value"])}),hovertext:s.hovertext,hoverinfo:l.hoverinfo,hovertemplate:n({},{keys:c.eventDataKeys}),textfont:s.textfont,insidetextfont:s.insidetextfont,outsidetextfont:u({},s.outsidetextfont,{}),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"top left",editType:"plot"},sort:s.sort,root:l.root,domain:o({name:"treemap",trace:!0,editType:"calc"})}},{"../../components/colorscale/attributes":650,"../../lib/extend":768,"../../plots/domain":854,"../../plots/template_attributes":905,"../pie/attributes":1160,"../sunburst/attributes":1298,"./constants":1327}],1325:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.name="treemap",r.plot=function(t,e,i,a){n.plotBasePlot(r.name,t,e,i,a)},r.clean=function(t,e,i,a){n.cleanBasePlot(r.name,t,e,i,a)}},{"../../plots/plots":890}],1326:[function(t,e,r){"use strict";var n=t("../sunburst/calc");r.calc=function(t,e){return n.calc(t,e)},r.crossTraceCalc=function(t){return n._runCrossTraceCalc("treemap",t)}},{"../sunburst/calc":1300}],1327:[function(t,e,r){"use strict";e.exports={CLICK_TRANSITION_TIME:750,CLICK_TRANSITION_EASING:"poly",eventDataKeys:["currentPath","root","entry","percentRoot","percentEntry","percentParent"],gapWithPathbar:1}},{}],1328:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../components/color"),o=t("../../plots/domain").defaults,s=t("../bar/defaults").handleText,l=t("../bar/constants").TEXTPAD,c=t("../../components/colorscale"),u=c.hasColorscale,f=c.handleDefaults;e.exports=function(t,e,r,c){function h(r,a){return n.coerce(t,e,i,r,a)}var p=h("labels"),d=h("parents");if(p&&p.length&&d&&d.length){var g=h("values");g&&g.length?h("branchvalues"):h("count"),h("level"),h("maxdepth"),"squarify"===h("tiling.packing")&&h("tiling.squarifyratio"),h("tiling.flip"),h("tiling.pad");var m=h("text");h("texttemplate"),e.texttemplate||h("textinfo",Array.isArray(m)?"text+label":"label"),h("hovertext"),h("hovertemplate");var v=h("pathbar.visible");s(t,e,c,h,"auto",{hasPathbar:v,moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),h("textposition");var y=-1!==e.textposition.indexOf("bottom");h("marker.line.width")&&h("marker.line.color",c.paper_bgcolor);var x=h("marker.colors"),b=e._hasColorscale=u(t,"marker","colors")||(t.marker||{}).coloraxis;b?f(t,e,c,h,{prefix:"marker.",cLetter:"c"}):h("marker.depthfade",!(x||[]).length);var _=2*e.textfont.size;h("marker.pad.t",y?_/4:_),h("marker.pad.l",_/4),h("marker.pad.r",_/4),h("marker.pad.b",y?_:_/4),b&&f(t,e,c,h,{prefix:"marker.",cLetter:"c"}),e._hovered={marker:{line:{width:2,color:a.contrast(c.paper_bgcolor)}}},v&&(h("pathbar.thickness",e.pathbar.textfont.size+2*l),h("pathbar.side"),h("pathbar.edgeshape")),h("sort"),h("root.color"),o(e,c,h),e._length=null}else e.visible=!1}},{"../../components/color":643,"../../components/colorscale":655,"../../lib":778,"../../plots/domain":854,"../bar/constants":922,"../bar/defaults":924,"./attributes":1324}],1329:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../components/drawing"),o=t("../../lib/svg_text_utils"),s=t("./partition"),l=t("./style").styleOne,c=t("./constants"),u=t("../sunburst/helpers"),f=t("../sunburst/fx");e.exports=function(t,e,r,h,p){var d=p.barDifY,g=p.width,m=p.height,v=p.viewX,y=p.viewY,x=p.pathSlice,b=p.toMoveInsideSlice,_=p.strTransform,w=p.hasTransition,T=p.handleSlicesExit,k=p.makeUpdateSliceInterpolator,M=p.makeUpdateTextInterpolator,A={},S=t._fullLayout,E=e[0],C=E.trace,L=E.hierarchy,I=g/C._entryDepth,P=u.listPath(r.data,"id"),z=s(L.copy(),[g,m],{packing:"dice",pad:{inner:0,top:0,left:0,right:0,bottom:0}}).descendants();(z=z.filter((function(t){var e=P.indexOf(t.data.id);return-1!==e&&(t.x0=I*e,t.x1=I*(e+1),t.y0=d,t.y1=d+m,t.onPathbar=!0,!0)}))).reverse(),(h=h.data(z,u.getPtId)).enter().append("g").classed("pathbar",!0),T(h,!0,A,[g,m],x),h.order();var O=h;w&&(O=O.transition().each("end",(function(){var e=n.select(this);u.setSliceCursor(e,t,{hideOnRoot:!1,hideOnLeaves:!1,isTransitioning:!1})}))),O.each((function(s){s._hoverX=v(s.x1-Math.min(g,m)/2),s._hoverY=y(s.y1-m/2);var h=n.select(this),p=i.ensureSingle(h,"path","surface",(function(t){t.style("pointer-events","all")}));w?p.transition().attrTween("d",(function(t){var e=k(t,!0,A,[g,m]);return function(t){return x(e(t))}})):p.attr("d",x),h.call(f,r,t,e,{styleOne:l,eventDataKeys:c.eventDataKeys,transitionTime:c.CLICK_TRANSITION_TIME,transitionEasing:c.CLICK_TRANSITION_EASING}).call(u.setSliceCursor,t,{hideOnRoot:!1,hideOnLeaves:!1,isTransitioning:t._transitioning}),p.call(l,s,C,{hovered:!1}),s._text=(u.getPtLabel(s)||"").split("
").join(" ")||"";var d=i.ensureSingle(h,"g","slicetext"),T=i.ensureSingle(d,"text","",(function(t){t.attr("data-notex",1)})),E=i.ensureUniformFontSize(t,u.determineTextFont(C,s,S.font,{onPathbar:!0}));T.text(s._text||" ").classed("slicetext",!0).attr("text-anchor","start").call(a.font,E).call(o.convertToTspans,t),s.textBB=a.bBox(T.node()),s.transform=b(s,{fontSize:E.size,onPathbar:!0}),s.transform.fontSize=E.size,w?T.transition().attrTween("transform",(function(t){var e=M(t,!0,A,[g,m]);return function(t){return _(e(t))}})):T.attr("transform",_(s))}))}},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../sunburst/fx":1303,"../sunburst/helpers":1304,"./constants":1327,"./partition":1334,"./style":1336,d3:169}],1330:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../components/drawing"),o=t("../../lib/svg_text_utils"),s=t("./partition"),l=t("./style").styleOne,c=t("./constants"),u=t("../sunburst/helpers"),f=t("../sunburst/fx"),h=t("../sunburst/plot").formatSliceLabel;e.exports=function(t,e,r,p,d){var g=d.width,m=d.height,v=d.viewX,y=d.viewY,x=d.pathSlice,b=d.toMoveInsideSlice,_=d.strTransform,w=d.hasTransition,T=d.handleSlicesExit,k=d.makeUpdateSliceInterpolator,M=d.makeUpdateTextInterpolator,A=d.prevEntry,S=t._fullLayout,E=e[0].trace,C=-1!==E.textposition.indexOf("left"),L=-1!==E.textposition.indexOf("right"),I=-1!==E.textposition.indexOf("bottom"),P=!I&&!E.marker.pad.t||I&&!E.marker.pad.b,z=s(r,[g,m],{packing:E.tiling.packing,squarifyratio:E.tiling.squarifyratio,flipX:E.tiling.flip.indexOf("x")>-1,flipY:E.tiling.flip.indexOf("y")>-1,pad:{inner:E.tiling.pad,top:E.marker.pad.t,left:E.marker.pad.l,right:E.marker.pad.r,bottom:E.marker.pad.b}}).descendants(),O=1/0,D=-1/0;z.forEach((function(t){var e=t.depth;e>=E._maxDepth?(t.x0=t.x1=(t.x0+t.x1)/2,t.y0=t.y1=(t.y0+t.y1)/2):(O=Math.min(O,e),D=Math.max(D,e))})),p=p.data(z,u.getPtId),E._maxVisibleLayers=isFinite(D)?D-O+1:0,p.enter().append("g").classed("slice",!0),T(p,!1,{},[g,m],x),p.order();var R=null;if(w&&A){var F=u.getPtId(A);p.each((function(t){null===R&&u.getPtId(t)===F&&(R={x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1})}))}var B=function(){return R||{x0:0,x1:g,y0:0,y1:m}},N=p;return w&&(N=N.transition().each("end",(function(){var e=n.select(this);u.setSliceCursor(e,t,{hideOnRoot:!0,hideOnLeaves:!1,isTransitioning:!1})}))),N.each((function(s){var p=u.isHeader(s,E);s._hoverX=v(s.x1-E.marker.pad.r),s._hoverY=y(I?s.y1-E.marker.pad.b/2:s.y0+E.marker.pad.t/2);var d=n.select(this),T=i.ensureSingle(d,"path","surface",(function(t){t.style("pointer-events","all")}));w?T.transition().attrTween("d",(function(t){var e=k(t,!1,B(),[g,m]);return function(t){return x(e(t))}})):T.attr("d",x),d.call(f,r,t,e,{styleOne:l,eventDataKeys:c.eventDataKeys,transitionTime:c.CLICK_TRANSITION_TIME,transitionEasing:c.CLICK_TRANSITION_EASING}).call(u.setSliceCursor,t,{isTransitioning:t._transitioning}),T.call(l,s,E,{hovered:!1}),s.x0===s.x1||s.y0===s.y1?s._text="":s._text=p?P?"":u.getPtLabel(s)||"":h(s,r,E,e,S)||"";var A=i.ensureSingle(d,"g","slicetext"),z=i.ensureSingle(A,"text","",(function(t){t.attr("data-notex",1)})),O=i.ensureUniformFontSize(t,u.determineTextFont(E,s,S.font));z.text(s._text||" ").classed("slicetext",!0).attr("text-anchor",L?"end":C||p?"start":"middle").call(a.font,O).call(o.convertToTspans,t),s.textBB=a.bBox(z.node()),s.transform=b(s,{fontSize:O.size,isHeader:p}),s.transform.fontSize=O.size,w?z.transition().attrTween("transform",(function(t){var e=M(t,!1,B(),[g,m]);return function(t){return _(e(t))}})):z.attr("transform",_(s))})),R}},{"../../components/drawing":665,"../../lib":778,"../../lib/svg_text_utils":802,"../sunburst/fx":1303,"../sunburst/helpers":1304,"../sunburst/plot":1308,"./constants":1327,"./partition":1334,"./style":1336,d3:169}],1331:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"treemap",basePlotModule:t("./base_plot"),categories:[],animatable:!0,attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),style:t("./style").style,colorbar:t("../scatter/marker_colorbar"),meta:{}}},{"../scatter/marker_colorbar":1204,"./attributes":1324,"./base_plot":1325,"./calc":1326,"./defaults":1328,"./layout_attributes":1332,"./layout_defaults":1333,"./plot":1335,"./style":1336}],1332:[function(t,e,r){"use strict";e.exports={treemapcolorway:{valType:"colorlist",editType:"calc"},extendtreemapcolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{}],1333:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,a){return n.coerce(t,e,i,r,a)}r("treemapcolorway",e.colorway),r("extendtreemapcolors")}},{"../../lib":778,"./layout_attributes":1332}],1334:[function(t,e,r){"use strict";var n=t("d3-hierarchy");e.exports=function(t,e,r){var i,a=r.flipX,o=r.flipY,s="dice-slice"===r.packing,l=r.pad[o?"bottom":"top"],c=r.pad[a?"right":"left"],u=r.pad[a?"left":"right"],f=r.pad[o?"top":"bottom"];s&&(i=c,c=l,l=i,i=u,u=f,f=i);var h=n.treemap().tile(function(t,e){switch(t){case"squarify":return n.treemapSquarify.ratio(e);case"binary":return n.treemapBinary;case"dice":return n.treemapDice;case"slice":return n.treemapSlice;default:return n.treemapSliceDice}}(r.packing,r.squarifyratio)).paddingInner(r.pad.inner).paddingLeft(c).paddingRight(u).paddingTop(l).paddingBottom(f).size(s?[e[1],e[0]]:e)(t);return(s||a||o)&&function t(e,r,n){var i;n.swapXY&&(i=e.x0,e.x0=e.y0,e.y0=i,i=e.x1,e.x1=e.y1,e.y1=i);n.flipX&&(i=e.x0,e.x0=r[0]-e.x1,e.x1=r[0]-i);n.flipY&&(i=e.y0,e.y0=r[1]-e.y1,e.y1=r[1]-i);var a=e.children;if(a)for(var o=0;o-1?E+I:-(L+I):0,z={x0:C,x1:C,y0:P,y1:P+L},O=function(t,e,r){var n=m.tiling.pad,i=function(t){return t-n<=e.x0},a=function(t){return t+n>=e.x1},o=function(t){return t-n<=e.y0},s=function(t){return t+n>=e.y1};return{x0:i(t.x0-n)?0:a(t.x0-n)?r[0]:t.x0,x1:i(t.x1+n)?0:a(t.x1+n)?r[0]:t.x1,y0:o(t.y0-n)?0:s(t.y0-n)?r[1]:t.y0,y1:o(t.y1+n)?0:s(t.y1+n)?r[1]:t.y1}},D=null,R={},F={},B=null,N=function(t,e){return e?R[g(t)]:F[g(t)]},j=function(t,e,r,n){if(e)return R[g(v)]||z;var i=F[m.level]||r;return function(t){return t.data.depth-y.data.depth=(n-=v.r-o)){var y=(r+n)/2;r=y,n=y}var x;h?i<(x=a-v.b)&&x"===Q?(l.x-=a,c.x-=a,u.x-=a,f.x-=a):"/"===Q?(u.x-=a,f.x-=a,o.x-=a/2,s.x-=a/2):"\\"===Q?(l.x-=a,c.x-=a,o.x-=a/2,s.x-=a/2):"<"===Q&&(o.x-=a,s.x-=a),K(l),K(f),K(o),K(c),K(u),K(s),"M"+Z(l.x,l.y)+"L"+Z(c.x,c.y)+"L"+Z(s.x,s.y)+"L"+Z(u.x,u.y)+"L"+Z(f.x,f.y)+"L"+Z(o.x,o.y)+"Z"},toMoveInsideSlice:$,makeUpdateSliceInterpolator:et,makeUpdateTextInterpolator:rt,handleSlicesExit:nt,hasTransition:T,strTransform:it}):b.remove()}e.exports=function(t,e,r,a){var o,s,l=t._fullLayout,c=l._treemaplayer,h=!r;(u("treemap",l),(o=c.selectAll("g.trace.treemap").data(e,(function(t){return t[0].trace.uid}))).enter().append("g").classed("trace",!0).classed("treemap",!0),o.order(),!l.uniformtext.mode&&i.hasTransition(r))?(a&&(s=a()),n.transition().duration(r.duration).ease(r.easing).each("end",(function(){s&&s()})).each("interrupt",(function(){s&&s()})).each((function(){c.selectAll("g.trace").each((function(e){m(t,e,this,r)}))}))):(o.each((function(e){m(t,e,this,r)})),l.uniformtext.mode&&f(t,l._treemaplayer.selectAll(".trace"),"treemap"));h&&o.exit().remove()}},{"../../lib":778,"../bar/constants":922,"../bar/plot":931,"../bar/style":934,"../bar/uniform_text":936,"../sunburst/helpers":1304,"./constants":1327,"./draw_ancestors":1329,"./draw_descendants":1330,d3:169}],1336:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/color"),a=t("../../lib"),o=t("../sunburst/helpers"),s=t("../bar/uniform_text").resizeText;function l(t,e,r,n){var s,l,c=(n||{}).hovered,u=e.data.data,f=u.i,h=u.color,p=o.isHierarchyRoot(e),d=1;if(c)s=r._hovered.marker.line.color,l=r._hovered.marker.line.width;else if(p&&h===r.root.color)d=100,s="rgba(0,0,0,0)",l=0;else if(s=a.castOption(r,f,"marker.line.color")||i.defaultLine,l=a.castOption(r,f,"marker.line.width")||0,!r._hasColorscale&&!e.onPathbar){var g=r.marker.depthfade;if(g){var m,v=i.combine(i.addOpacity(r._backgroundColor,.75),h);if(!0===g){var y=o.getMaxDepth(r);m=isFinite(y)?o.isLeaf(e)?0:r._maxVisibleLayers-(e.data.depth-r._entryDepth):e.data.height+1}else m=e.data.depth-r._entryDepth,r._atRootLevel||m++;if(m>0)for(var x=0;x0){var y,x,b,_,w,T=t.xa,k=t.ya;"h"===h.orientation?(w=e,y="y",b=k,x="x",_=T):(w=r,y="x",b=T,x="y",_=k);var M=f[t.index];if(w>=M.span[0]&&w<=M.span[1]){var A=n.extendFlat({},t),S=_.c2p(w,!0),E=o.getKdeValue(M,h,w),C=o.getPositionOnKdePath(M,h,S),L=b._offset,I=b._length;A[y+"0"]=C[0],A[y+"1"]=C[1],A[x+"0"]=A[x+"1"]=S,A[x+"Label"]=x+": "+i.hoverLabelText(_,w)+", "+f[0].t.labels.kde+" "+E.toFixed(3),A.spikeDistance=v[0].spikeDistance;var P=y+"Spike";A[P]=v[0][P],v[0].spikeDistance=void 0,v[0][P]=void 0,A.hovertemplate=!1,m.push(A),(u={stroke:t.color})[y+"1"]=n.constrain(L+C[0],L,L+I),u[y+"2"]=n.constrain(L+C[1],L,L+I),u[x+"1"]=u[x+"2"]=_._offset+S}}d&&(m=m.concat(v))}-1!==p.indexOf("points")&&(c=a.hoverOnPoints(t,e,r));var z=l.selectAll(".violinline-"+h.uid).data(u?[0]:[]);return z.enter().append("line").classed("violinline-"+h.uid,!0).attr("stroke-width",1.5),z.exit().remove(),z.attr(u),"closest"===s?c?[c]:m:c?(m.push(c),m):m}},{"../../lib":778,"../../plots/cartesian/axes":827,"../box/hover":950,"./helpers":1341}],1343:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("../box/defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../box/select"),moduleType:"trace",name:"violin",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":840,"../box/defaults":948,"../box/select":955,"../scatter/style":1210,"./attributes":1337,"./calc":1338,"./cross_trace_calc":1339,"./defaults":1340,"./hover":1342,"./layout_attributes":1344,"./layout_defaults":1345,"./plot":1346,"./style":1347}],1344:[function(t,e,r){"use strict";var n=t("../box/layout_attributes"),i=t("../../lib").extendFlat;e.exports={violinmode:i({},n.boxmode,{}),violingap:i({},n.boxgap,{}),violingroupgap:i({},n.boxgroupgap,{})}},{"../../lib":778,"../box/layout_attributes":952}],1345:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes"),a=t("../box/layout_defaults");e.exports=function(t,e,r){a._supply(t,e,r,(function(r,a){return n.coerce(t,e,i,r,a)}),"violin")}},{"../../lib":778,"../box/layout_defaults":953,"./layout_attributes":1344}],1346:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../components/drawing"),o=t("../box/plot"),s=t("../scatter/line_points"),l=t("./helpers");e.exports=function(t,e,r,c){var u=t._fullLayout,f=e.xaxis,h=e.yaxis;function p(t){var e=s(t,{xaxis:f,yaxis:h,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0,linearized:!0});return a.smoothopen(e[0],1)}i.makeTraceGroups(c,r,"trace violins").each((function(t){var r=n.select(this),a=t[0],s=a.t,c=a.trace;if(!0!==c.visible||s.empty)r.remove();else{var d=s.bPos,g=s.bdPos,m=e[s.valLetter+"axis"],v=e[s.posLetter+"axis"],y="both"===c.side,x=y||"positive"===c.side,b=y||"negative"===c.side,_=r.selectAll("path.violin").data(i.identity);_.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin"),_.exit().remove(),_.each((function(t){var e,r,i,a,o,l,f,h,_=n.select(this),w=t.density,T=w.length,k=v.c2l(t.pos+d,!0),M=v.l2p(k);if(c.width)e=s.maxKDE/g;else{var A=u._violinScaleGroupStats[c.scalegroup];e="count"===c.scalemode?A.maxKDE/g*(A.maxCount/t.pts.length):A.maxKDE/g}if(x){for(f=new Array(T),o=0;o")),c.color=function(t,e){var r=t[e.dir].marker,n=r.color,a=r.line.color,o=r.line.width;if(i(n))return n;if(i(a)&&o)return a}(f,d),[c]}function w(t){return n(p,t)}}},{"../../components/color":643,"../../constants/delta.js":747,"../../plots/cartesian/axes":827,"../bar/hover":927}],1359:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style").style,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("../bar/select"),moduleType:"trace",name:"waterfall",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":840,"../bar/select":932,"./attributes":1352,"./calc":1353,"./cross_trace_calc":1355,"./defaults":1356,"./event_data":1357,"./hover":1358,"./layout_attributes":1360,"./layout_defaults":1361,"./plot":1362,"./style":1363}],1360:[function(t,e,r){"use strict";e.exports={waterfallmode:{valType:"enumerated",values:["group","overlay"],dflt:"group",editType:"calc"},waterfallgap:{valType:"number",min:0,max:1,editType:"calc"},waterfallgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],1361:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r){var a=!1;function o(r,a){return n.coerce(t,e,i,r,a)}for(var s=0;s0&&(m+=h?"M"+f[0]+","+d[1]+"V"+d[0]:"M"+f[1]+","+d[0]+"H"+f[0]),"between"!==p&&(r.isSum||s path").each((function(t){if(!t.isBlank){var e=s[t.dir].marker;n.select(this).call(a.fill,e.color).call(a.stroke,e.line.color).call(i.dashLine,e.line.dash,e.line.width).style("opacity",s.selectedpoints&&!t.selected?o:1)}})),c(r,s,t),r.selectAll(".lines").each((function(){var t=s.connector.line;i.lineGroupStyle(n.select(this).selectAll("path"),t.width,t.color,t.dash)}))}))}}},{"../../components/color":643,"../../components/drawing":665,"../../constants/interactions":752,"../bar/style":934,"../bar/uniform_text":936,d3:169}],1364:[function(t,e,r){"use strict";var n=t("../plots/cartesian/axes"),i=t("../lib"),a=t("../plot_api/plot_schema"),o=t("./helpers").pointsAccessorFunction,s=t("../constants/numerical").BADNUM;r.moduleType="transform",r.name="aggregate";var l=r.attributes={enabled:{valType:"boolean",dflt:!0,editType:"calc"},groups:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x",editType:"calc"},aggregations:{_isLinkedToArray:"aggregation",target:{valType:"string",editType:"calc"},func:{valType:"enumerated",values:["count","sum","avg","median","mode","rms","stddev","min","max","first","last","change","range"],dflt:"first",editType:"calc"},funcmode:{valType:"enumerated",values:["sample","population"],dflt:"sample",editType:"calc"},enabled:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},editType:"calc"},c=l.aggregations;function u(t,e,r,a){if(a.enabled){for(var o=a.target,l=i.nestedProperty(e,o),c=l.get(),u=function(t,e){var r=t.func,n=e.d2c,a=e.c2d;switch(r){case"count":return f;case"first":return h;case"last":return p;case"sum":return function(t,e){for(var r=0,i=0;ii&&(i=u,o=c)}}return i?a(o):s};case"rms":return function(t,e){for(var r=0,i=0,o=0;o":return function(t){return h(t)>s};case">=":return function(t){return h(t)>=s};case"[]":return function(t){var e=h(t);return e>=s[0]&&e<=s[1]};case"()":return function(t){var e=h(t);return e>s[0]&&e=s[0]&&es[0]&&e<=s[1]};case"][":return function(t){var e=h(t);return e<=s[0]||e>=s[1]};case")(":return function(t){var e=h(t);return es[1]};case"](":return function(t){var e=h(t);return e<=s[0]||e>s[1]};case")[":return function(t){var e=h(t);return e=s[1]};case"{}":return function(t){return-1!==s.indexOf(h(t))};case"}{":return function(t){return-1===s.indexOf(h(t))}}}(r,a.getDataToCoordFunc(t,e,s,i),h),x={},b={},_=0;d?(m=function(t){x[t.astr]=n.extendDeep([],t.get()),t.set(new Array(f))},v=function(t,e){var r=x[t.astr][e];t.get()[e]=r}):(m=function(t){x[t.astr]=n.extendDeep([],t.get()),t.set([])},v=function(t,e){var r=x[t.astr][e];t.get().push(r)}),k(m);for(var w=o(e.transforms,r),T=0;T1?"%{group} (%{trace})":"%{group}");var l=t.styles,c=o.styles=[];if(l)for(a=0;a=0.5 0", - "rimraf": "2" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - } - } - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -4494,9 +4679,9 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" }, "fuse.js": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.4.1.tgz", - "integrity": "sha512-+hAS7KYgLXontDh/vqffs7wIBw0ceb9Sx8ywZQhOsiQGcSO5zInGhttWOUYQYlvV/yYMJOacQ129Xs3mP3+oZQ==", + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.4.3.tgz", + "integrity": "sha512-JNgngolukIrqwayWnvy6NLH63hmwKPhm63o0uyBg51jPD0j09IvAzlV1rTXfAsgxpghI7khAo6Mv+EmvjDWXig==", "dev": true }, "gamma": { @@ -4518,6 +4703,43 @@ "string-width": "^1.0.1", "strip-ansi": "^3.0.1", "wide-align": "^1.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } } }, "gaze": { @@ -4606,16 +4828,96 @@ "robust-orientation": "^1.1.3", "split-polygon": "^1.0.0", "vectorize-text": "^3.2.1" - } - }, - "gl-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/gl-buffer/-/gl-buffer-2.1.2.tgz", - "integrity": "sha1-LbjZwaVSf7oM25EonCBuiCuInNs=", - "requires": { - "ndarray": "^1.0.15", - "ndarray-ops": "^1.1.0", - "typedarray-pool": "^1.0.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } + } + }, + "gl-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/gl-buffer/-/gl-buffer-2.1.2.tgz", + "integrity": "sha1-LbjZwaVSf7oM25EonCBuiCuInNs=", + "requires": { + "ndarray": "^1.0.15", + "ndarray-ops": "^1.1.0", + "typedarray-pool": "^1.0.0" } }, "gl-cone3d": { @@ -4635,6 +4937,86 @@ "glsl-specular-cook-torrance": "^2.0.1", "glslify": "^7.0.0", "ndarray": "^1.0.18" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-constants": { @@ -4656,6 +5038,86 @@ "iota-array": "^1.0.0", "ndarray": "^1.0.18", "surface-nets": "^1.0.2" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-error3d": { @@ -4668,6 +5130,86 @@ "gl-vao": "^1.3.0", "glsl-out-of-range": "^1.0.4", "glslify": "^7.0.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-fbo": { @@ -4700,6 +5242,86 @@ "glslify": "^7.0.0", "iota-array": "^1.0.0", "typedarray-pool": "^1.2.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-line3d": { @@ -4715,13 +5337,88 @@ "glsl-out-of-range": "^1.0.4", "glslify": "^7.0.0", "ndarray": "^1.0.18" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, - "gl-mat3": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gl-mat3/-/gl-mat3-1.0.0.tgz", - "integrity": "sha1-iWMyGcpCk3mha5GF2V1BcTRTuRI=" - }, "gl-mat4": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gl-mat4/-/gl-mat4-1.2.0.tgz", @@ -4752,6 +5449,86 @@ "polytope-closest-point": "^1.0.0", "simplicial-complex-contour": "^1.0.2", "typedarray-pool": "^1.1.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-plot2d": { @@ -4766,12 +5543,92 @@ "glsl-inverse": "^1.0.0", "glslify": "^7.0.0", "text-cache": "^4.2.2" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-plot3d": { - "version": "2.4.6", - "resolved": "https://registry.npmjs.org/gl-plot3d/-/gl-plot3d-2.4.6.tgz", - "integrity": "sha512-CkrNvDKu0p74Di2g2Oc9kU+s1Oe+wi4cIfHzXABp8DvfoRl0/bayqJ9q8EcRAqMeQQxQZYGvJkk4hlBwI758Jw==", + "version": "2.4.7", + "resolved": "https://registry.npmjs.org/gl-plot3d/-/gl-plot3d-2.4.7.tgz", + "integrity": "sha512-mLDVWrl4Dj0O0druWyHUK5l7cBQrRIJRn2oROEgrRuOgbbrLAzsREKefwMO0bA0YqkiZMFMnV5VvPA9j57X5Xg==", "requires": { "3d-view": "^2.0.0", "a-big-triangle": "^1.0.3", @@ -4789,6 +5646,86 @@ "mouse-wheel": "^1.2.0", "ndarray": "^1.0.19", "right-now": "^1.0.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-pointcloud2d": { @@ -4800,6 +5737,86 @@ "gl-shader": "^4.2.1", "glslify": "^7.0.0", "typedarray-pool": "^1.1.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-quat": { @@ -4810,6 +5827,13 @@ "gl-mat3": "^1.0.0", "gl-vec3": "^1.0.3", "gl-vec4": "^1.0.0" + }, + "dependencies": { + "gl-mat3": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gl-mat3/-/gl-mat3-1.0.0.tgz", + "integrity": "sha1-iWMyGcpCk3mha5GF2V1BcTRTuRI=" + } } }, "gl-scatter3d": { @@ -4826,6 +5850,86 @@ "is-string-blank": "^1.0.1", "typedarray-pool": "^1.1.0", "vectorize-text": "^3.2.1" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-select-box": { @@ -4836,6 +5940,86 @@ "gl-buffer": "^2.1.2", "gl-shader": "^4.2.1", "glslify": "^7.0.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-select-static": { @@ -4872,6 +6056,86 @@ "gl-shader": "^4.2.1", "gl-vao": "^1.3.0", "glslify": "^7.0.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-state": { @@ -4894,12 +6158,92 @@ "glsl-out-of-range": "^1.0.4", "glsl-specular-cook-torrance": "^2.0.1", "glslify": "^7.0.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-surface3d": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/gl-surface3d/-/gl-surface3d-1.5.2.tgz", - "integrity": "sha512-rWSQwEQDkB0T5CDEDFJwJc4VgwwJaAyFRSJ92NJlrTSwDlsEsWdzG9+APx6FWJMwkOpIoZGWqv+csswK2kMMLQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/gl-surface3d/-/gl-surface3d-1.6.0.tgz", + "integrity": "sha512-x15+u4712ysnB85G55RLJEml6mOB4VaDn0VTlXCc9JcjRl5Es10Tk7lhGGyiPtkCfHwvhnkxzYA1/rHHYN7Y0A==", "requires": { "binary-search-bounds": "^2.0.4", "bit-twiddle": "^1.0.2", @@ -4920,6 +6264,86 @@ "ndarray-scratch": "^1.2.0", "surface-nets": "^1.0.2", "typedarray-pool": "^1.1.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "gl-text": { @@ -5017,13 +6441,13 @@ } }, "globule": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz", - "integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.2.tgz", + "integrity": "sha512-7IDTQTIu2xzXkT+6mlluidnWo+BypnbSoEVVQCGfzqnl5Ik8d3e1d4wycb8Rj9tWW+Z39uPWsdlquqiqPCd/pA==", "dev": true, "requires": { "glob": "~7.1.1", - "lodash": "~4.17.12", + "lodash": "~4.17.10", "minimatch": "~3.0.2" } }, @@ -5246,12 +6670,12 @@ } }, "glslify-deps": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.1.tgz", - "integrity": "sha512-Ogm179MCazwIRyEqs3g3EOY4Y3XIAa0yl8J5RE9rJC6QH1w8weVOp2RZu0mvnYy/2xIas1w166YR2eZdDkWQxg==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", "requires": { "@choojs/findup": "^0.2.0", - "events": "^1.0.2", + "events": "^3.2.0", "glsl-resolve": "0.0.1", "glsl-tokenizer": "^2.0.0", "graceful-fs": "^4.1.2", @@ -5337,6 +6761,14 @@ "dev": true, "requires": { "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } } }, "has-binary2": { @@ -5624,9 +7056,9 @@ "integrity": "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g==" }, "import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", + "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -5639,12 +7071,6 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "in-publish": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.1.tgz", - "integrity": "sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ==", - "dev": true - }, "incremental-convex-hull": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/incremental-convex-hull/-/incremental-convex-hull-1.0.1.tgz", @@ -5713,9 +7139,9 @@ } }, "insert-module-globals": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.0.tgz", - "integrity": "sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.1.tgz", + "integrity": "sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==", "dev": true, "requires": { "JSONStream": "^1.0.3", @@ -5885,6 +7311,15 @@ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==" }, + "is-core-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz", + "integrity": "sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -5952,13 +7387,16 @@ "integrity": "sha512-4ew1Sx6B6kEAl3T3NOM0yB94J3NZnBdNt4paw0e8nY73yHHTeTEhyQ3Lj7EQEnv5LD+GxNTaT4L46jcKjjpLiQ==" }, "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-generator-function": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.7.tgz", + "integrity": "sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw==", + "dev": true }, "is-glob": { "version": "4.0.1", @@ -5991,6 +7429,12 @@ "resolved": "https://registry.npmjs.org/is-mobile/-/is-mobile-2.2.2.tgz", "integrity": "sha512-wW/SXnYJkTjs++tVK5b6kVITZpAZPtUrt9SF80vvxGiF/Oywal+COk1jlRkiVq15RFNEQKQY31TkV24/1T5cVg==" }, + "is-negative-zero": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", + "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", + "dev": true + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -6174,9 +7618,9 @@ "dev": true }, "js-base64": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz", - "integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz", + "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==", "dev": true }, "js-string-escape": { @@ -6311,9 +7755,9 @@ "dev": true }, "jsonschema": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.6.tgz", - "integrity": "sha512-SqhURKZG07JyKKeo/ir24QnS4/BV7a6gQy93bUSe4lUdNp0QNpIz2c9elWJQ9dpc5cQYY6cvCzgRwy0MQCLyqA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.7.tgz", + "integrity": "sha512-3dFMg9hmI9LdHag/BRIhMefCfbq1hicvYMy8YhZQorAdzOzWz7NjniSpn39yjpzUAMIWtGyyZuH2KNBloH7ZLw==", "dev": true }, "jsprim": { @@ -6329,24 +7773,23 @@ } }, "karma": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/karma/-/karma-5.1.1.tgz", - "integrity": "sha512-xAlOr5PMqUbiKXSv5PCniHWV3aiwj6wIZ0gUVcwpTCPVQm/qH2WAMFWxtnpM6KJqhkRWrIpovR4Rb0rn8GtJzQ==", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/karma/-/karma-5.2.3.tgz", + "integrity": "sha512-tHdyFADhVVPBorIKCX8A37iLHxc6RBRphkSoQ+MLKdAtFn1k97tD8WUGi1KlEtDZKL3hui0qhsY9HXUfSNDYPQ==", "dev": true, "requires": { "body-parser": "^1.19.0", "braces": "^3.0.2", - "chokidar": "^3.0.0", + "chokidar": "^3.4.2", "colors": "^1.4.0", "connect": "^3.7.0", "di": "^0.0.1", "dom-serialize": "^2.2.1", - "flatted": "^2.0.2", "glob": "^7.1.6", "graceful-fs": "^4.2.4", "http-proxy": "^1.18.1", "isbinaryfile": "^4.0.6", - "lodash": "^4.17.15", + "lodash": "^4.17.19", "log4js": "^6.2.1", "mime": "^2.4.5", "minimatch": "^3.0.4", @@ -6356,7 +7799,7 @@ "socket.io": "^2.3.0", "source-map": "^0.6.1", "tmp": "0.2.1", - "ua-parser-js": "0.7.21", + "ua-parser-js": "0.7.22", "yargs": "^15.3.1" }, "dependencies": { @@ -6446,13 +7889,13 @@ } }, "karma-viewport": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/karma-viewport/-/karma-viewport-1.0.6.tgz", - "integrity": "sha512-pDKvcpBxOH5sYbg9018U554cvmxBH+BxQJ7zqDpvDre6xzpSauEOVldBJ8fgDwsRIYZoFYa8qZ1mGjYRtRVKvA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/karma-viewport/-/karma-viewport-1.0.7.tgz", + "integrity": "sha512-4JDYvu9IGSs+JhaHNLorhI8cv7LDytHzVWxnXCm0WLku+/xAgqmWtqf+osCjKaI9wyBuF3dJiOKx9dKpa6boEw==", "dev": true, "requires": { - "@types/karma": "^4.4.0", - "jsonschema": "^1.2.5" + "@types/karma": "^5.0.0", + "jsonschema": "^1.2.6" } }, "kdbush": { @@ -6504,6 +7947,14 @@ "pify": "^2.0.0", "pinkie-promise": "^2.0.0", "strip-bom": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } } }, "locate-path": { @@ -6524,33 +7975,78 @@ } } }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", - "dev": true - }, - "lodash.memoize": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", - "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", - "dev": true - }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", - "dev": true - }, - "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", - "dev": true, - "requires": { - "chalk": "^2.4.2" - } - }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "lodash.memoize": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", + "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", + "dev": true + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dev": true, + "requires": { + "chalk": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "log4js": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz", @@ -6574,27 +8070,17 @@ "signal-exit": "^3.0.0" } }, - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, "madge": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/madge/-/madge-3.9.2.tgz", - "integrity": "sha512-6ZvyKinAOOzcRpvpm1iyOuds+LvWIq3o3GmUYAHMJdIpDAgVY3mphxVzeWNo3agIOv0X0T/zbLycXQm9Rn19nA==", + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/madge/-/madge-3.12.0.tgz", + "integrity": "sha512-9kA2W5RIbvH25CWc8tzPNn1X47AOcHEEwZJxWAMxhEOKEziVR1iMCbGCFUea5tWXs/A+xgJF59o/oSbNkOXpeg==", "dev": true, "requires": { "chalk": "^4.1.0", "commander": "^5.1.0", "commondir": "^1.0.1", "debug": "^4.0.1", - "dependency-tree": "^7.2.1", + "dependency-tree": "^7.2.2", "detective-amd": "^3.0.0", "detective-cjs": "^3.1.1", "detective-es6": "^2.1.0", @@ -6605,8 +8091,7 @@ "detective-stylus": "^1.0.0", "detective-typescript": "^5.8.0", "graphviz": "0.0.9", - "ora": "^4.0.4", - "pify": "^5.0.0", + "ora": "^5.1.0", "pluralize": "^8.0.0", "precinct": "^6.3.1", "pretty-ms": "^7.0.0", @@ -6616,12 +8101,11 @@ }, "dependencies": { "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, @@ -6656,16 +8140,10 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "pify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz", - "integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==", - "dev": true - }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -6692,12 +8170,6 @@ "semver": "^5.6.0" }, "dependencies": { - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -7174,6 +8646,25 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, + "minipass": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz", + "integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + } + }, "mixin-deep": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", @@ -7208,12 +8699,12 @@ "dev": true }, "module-definition": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.3.0.tgz", - "integrity": "sha512-HTplA9xwDzH67XJFC1YvZMUElWJD28DV0dUq7lhTs+JKJamUOWA/CcYWSlhW5amJO66uWtY7XdltT+LfX0wIVg==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.3.1.tgz", + "integrity": "sha512-kLidGPwQ2yq484nSD+D3JoJp4Etc0Ox9P0L34Pu/cU4X4HcG7k7p62XI5BBuvURWMRX3RPyuhOcBHbKus+UH4A==", "dev": true, "requires": { - "ast-module-types": "^2.6.0", + "ast-module-types": "^2.7.1", "node-source-walk": "^4.0.0" } }, @@ -7506,60 +8997,66 @@ } }, "node-gyp": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", - "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-7.1.2.tgz", + "integrity": "sha512-CbpcIo7C3eMu3dL1c3d0xw449fHIGALIJsRP4DDPHpyiW8vcriNY7ubh9TE4zEKfSxscY7PjeFnshE7h75ynjQ==", "dev": true, "requires": { - "fstream": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "osenv": "0", - "request": "^2.87.0", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^2.0.0", - "which": "1" + "env-paths": "^2.2.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.3", + "nopt": "^5.0.0", + "npmlog": "^4.1.2", + "request": "^2.88.2", + "rimraf": "^3.0.2", + "semver": "^7.3.2", + "tar": "^6.0.2", + "which": "^2.0.2" }, "dependencies": { - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { - "minimist": "^1.2.5" + "glob": "^7.1.3" } }, "semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } } } }, "node-sass": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz", - "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-5.0.0.tgz", + "integrity": "sha512-opNgmlu83ZCF792U281Ry7tak9IbVC+AKnXGovcQ8LG8wFaJv6cLnRlc6DIHlmNxWEexB5bZxi9SZ9JyUuOYjw==", "dev": true, "requires": { "async-foreach": "^0.1.3", "chalk": "^1.1.1", - "cross-spawn": "^3.0.0", + "cross-spawn": "^7.0.3", "gaze": "^1.0.0", "get-stdin": "^4.0.1", "glob": "^7.0.3", - "in-publish": "^2.0.0", "lodash": "^4.17.15", "meow": "^3.7.0", "mkdirp": "^0.5.1", "nan": "^2.13.2", - "node-gyp": "^3.8.0", + "node-gyp": "^7.1.0", "npmlog": "^4.0.0", "request": "^2.88.0", "sass-graph": "2.2.5", @@ -7567,6 +9064,12 @@ "true-case-path": "^1.0.2" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", @@ -7586,16 +9089,6 @@ "supports-color": "^2.0.0" } }, - "cross-spawn": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", - "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - } - }, "mkdirp": { "version": "0.5.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", @@ -7605,6 +9098,15 @@ "minimist": "^1.2.5" } }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -7632,9 +9134,9 @@ } }, "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", "dev": true, "requires": { "abbrev": "1" @@ -7833,18 +9335,18 @@ } }, "onetime": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", - "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, "requires": { "mimic-fn": "^2.1.0" } }, "open": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/open/-/open-7.2.1.tgz", - "integrity": "sha512-xbYCJib4spUdmcs0g/2mK1nKo/jO2T7INClWd/beL7PFkXRWgr8B23ssDHX/USPn2M2IjDR5UdpYs6I67SnTSA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/open/-/open-7.3.0.tgz", + "integrity": "sha512-mgLwQIx2F/ye9SmbrUkurZCnkoXyXyu9EbHtJZrICjVAJfyMArdHp3KkixGdZx1ZHFPNIwl0DDM1dFFqXbTLZw==", "dev": true, "requires": { "is-docker": "^2.0.0", @@ -7865,41 +9367,34 @@ } }, "ora": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/ora/-/ora-4.0.4.tgz", - "integrity": "sha512-77iGeVU1cIdRhgFzCK8aw1fbtT1B/iZAvWjS+l/o1x0RShMgxHUZaD2yDpWsNCPwXg9z1ZA78Kbdvr8kBmG/Ww==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.1.0.tgz", + "integrity": "sha512-9tXIMPvjZ7hPTbk8DFq1f7Kow/HU/pQYB60JbNq+QnGwcyhWVZaQ4hM9zQDEsPxw/muLpgiHSaumUZxCAmod/w==", "dev": true, "requires": { - "chalk": "^3.0.0", + "chalk": "^4.1.0", "cli-cursor": "^3.1.0", - "cli-spinners": "^2.2.0", + "cli-spinners": "^2.4.0", "is-interactive": "^1.0.0", - "log-symbols": "^3.0.0", + "log-symbols": "^4.0.0", "mute-stream": "0.0.8", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" }, "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -7921,19 +9416,10 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -7962,30 +9448,6 @@ "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", "dev": true }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - }, - "dependencies": { - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - } - } - }, "outpipe": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/outpipe/-/outpipe-1.1.1.tgz", @@ -8063,14 +9525,13 @@ } }, "parse-asn1": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", - "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", "dev": true, "requires": { - "asn1.js": "^4.0.0", + "asn1.js": "^5.2.0", "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", "evp_bytestokey": "^1.0.0", "pbkdf2": "^3.0.3", "safe-buffer": "^5.1.1" @@ -8146,9 +9607,9 @@ "dev": true }, "path-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", - "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", "dev": true }, "path-dirname": { @@ -8197,6 +9658,14 @@ "graceful-fs": "^4.1.2", "pify": "^2.0.0", "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } } }, "pbf": { @@ -8255,9 +9724,9 @@ "dev": true }, "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true }, "pinkie": { @@ -8342,9 +9811,9 @@ "dev": true }, "postcss": { - "version": "7.0.32", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", - "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", + "version": "7.0.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.35.tgz", + "integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==", "dev": true, "requires": { "chalk": "^2.4.2", @@ -8424,9 +9893,9 @@ } }, "pretty-ms": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.0.tgz", - "integrity": "sha512-J3aPWiC5e9ZeZFuSeBraGxSkGMOvulSWsxDByOcbD1Pr75YL3LSNIKIb52WXbCLE1sS5s4inBBbryjF4Y05Ceg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", + "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", "dev": true, "requires": { "parse-ms": "^2.1.0" @@ -8466,12 +9935,6 @@ "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", "dev": true }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -8859,19 +10322,99 @@ "parse-rect": "^1.2.0", "pick-by-alias": "^1.2.0", "to-float32": "^1.0.1" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "regl-scatter2d": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regl-scatter2d/-/regl-scatter2d-3.2.0.tgz", - "integrity": "sha512-c0MxiakVW50UBslsHRmnq41w53bhat5oGvugZEpIZGTdKHVeopRAR2FQHeJf8YrEhOsVn7TpOk9tjySoyHXWGA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/regl-scatter2d/-/regl-scatter2d-3.2.1.tgz", + "integrity": "sha512-qxUCK5kXuoVZin2gPLXkgkBfRr3XLobVgEfn5N0fiprsb/ncTCtSNVBqP0EJgNb115R+FXte9LKA9YrFx7uBnA==", "requires": { "@plotly/point-cluster": "^3.1.9", "array-range": "^1.0.1", "array-rearrange": "^2.2.2", "clamp": "^1.0.1", "color-id": "^1.1.0", - "color-normalize": "1.5.0", + "color-normalize": "^1.5.0", "color-rgba": "^2.1.1", "flatten-vertex-data": "^1.0.2", "glslify": "^7.0.0", @@ -8882,6 +10425,86 @@ "pick-by-alias": "^1.2.0", "to-float32": "^1.0.1", "update-diff": "^1.1.0" + }, + "dependencies": { + "glslify": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-7.1.1.tgz", + "integrity": "sha512-bud98CJ6kGZcP9Yxcsi7Iz647wuDz3oN+IZsjCRi5X1PI7t/xPKeL0mOwXJjo+CRZMqvq0CkSJiywCcY7kVYog==", + "requires": { + "bl": "^2.2.1", + "concat-stream": "^1.5.2", + "duplexify": "^3.4.5", + "falafel": "^2.1.0", + "from2": "^2.3.0", + "glsl-resolve": "0.0.1", + "glsl-token-whitespace-trim": "^1.0.0", + "glslify-bundle": "^5.0.0", + "glslify-deps": "^1.2.5", + "minimist": "^1.2.5", + "resolve": "^1.1.5", + "stack-trace": "0.0.9", + "static-eval": "^2.0.5", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "glslify-deps": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/glslify-deps/-/glslify-deps-1.3.2.tgz", + "integrity": "sha512-7S7IkHWygJRjcawveXQjRXLO2FTjijPDYC7QfZyAQanY+yGLCFHYnPtsGT9bdyHiwPTw/5a1m1M9hamT2aBpag==", + "requires": { + "@choojs/findup": "^0.2.0", + "events": "^3.2.0", + "glsl-resolve": "0.0.1", + "glsl-tokenizer": "^2.0.0", + "graceful-fs": "^4.1.2", + "inherits": "^2.0.1", + "map-limit": "0.0.1", + "resolve": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } } }, "regl-splom": { @@ -9230,9 +10853,9 @@ "dev": true }, "run-series": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.8.tgz", - "integrity": "sha512-+GztYEPRpIsQoCSraWHDBs9WVy4eVME16zhOtDB4H9J4xN0XRhknnmLOl+4gRgZtu8dpp9N/utSPjKH/xmDzXg==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz", + "integrity": "sha512-Arc4hUN896vjkqCYrUXquBFtRZdv1PfLbTYP71efP6butxyQ0kWpiNJyAgsxscmQg1cqvHY32/UCBzXedTpU2g==", "dev": true }, "rw": { @@ -9300,12 +10923,6 @@ "wrap-ansi": "^5.1.0" } }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -9315,35 +10932,6 @@ "locate-path": "^3.0.0" } }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -9353,12 +10941,6 @@ "ansi-regex": "^4.1.0" } }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, "wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", @@ -9370,12 +10952,6 @@ "strip-ansi": "^5.0.0" } }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, "yargs": { "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", @@ -9557,13 +11133,68 @@ "dev": true }, "side-channel": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.2.tgz", - "integrity": "sha512-7rL9YlPHg7Ancea1S96Pa8/QWb4BtXL/TZvS6B8XFetGBeuhAsfmUspK6DokBeZ64+Kj9TCNRD/30pVz1BvQNA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz", + "integrity": "sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g==", "dev": true, "requires": { - "es-abstract": "^1.17.0-next.1", - "object-inspect": "^1.7.0" + "es-abstract": "^1.18.0-next.0", + "object-inspect": "^1.8.0" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "is-callable": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", + "dev": true + }, + "is-regex": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", + "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "object-inspect": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "dev": true + }, + "object.assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", + "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.0", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } } }, "signal-exit": { @@ -9668,14 +11299,6 @@ "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - } } }, "snapdragon": { @@ -9939,9 +11562,9 @@ "dev": true }, "spdx-correct": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", - "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", @@ -9955,9 +11578,9 @@ "dev": true }, "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, "requires": { "spdx-exceptions": "^2.1.0", @@ -9965,9 +11588,9 @@ } }, "spdx-license-ids": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", - "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", + "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", "dev": true }, "split-polygon": { @@ -10104,49 +11727,33 @@ "dev": true }, "stream-browserify": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", - "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", + "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", "dev": true, "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" }, "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" } }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, "requires": { - "safe-buffer": "~5.1.0" + "safe-buffer": "~5.2.0" } } } @@ -10356,14 +11963,37 @@ } }, "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } } }, "string.prototype.trim": { @@ -10431,12 +12061,12 @@ } }, "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^5.0.0" } }, "strip-bom": { @@ -10582,46 +12212,6 @@ "lodash": "^4.17.14", "slice-ansi": "^2.1.0", "string-width": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } } }, "tapable": { @@ -10668,14 +12258,17 @@ } }, "tar": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", - "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.5.tgz", + "integrity": "sha512-0b4HOimQHj9nXNEAA7zWwMM91Zhhba3pspja6sQbgTpynOJf+bkjBnfybNYzbpLbnwXnbyB4LOREvlyXLkCHSg==", "dev": true, "requires": { - "block-stream": "*", - "fstream": "^1.0.12", - "inherits": "2" + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" } }, "temp": { @@ -10803,9 +12396,9 @@ } }, "tinycolor2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", - "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", + "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==" }, "tinyqueue": { "version": "2.0.3", @@ -10990,9 +12583,9 @@ "dev": true }, "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, "tsutils": { @@ -11094,15 +12687,15 @@ } }, "typescript": { - "version": "3.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.5.tgz", - "integrity": "sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ==", + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", + "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", "dev": true }, "ua-parser-js": { - "version": "0.7.21", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz", - "integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ==", + "version": "0.7.22", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.22.tgz", + "integrity": "sha512-YUxzMjJ5T71w6a8WWVcMGM6YWOTX27rCoIQgLXiWaxqXSx9D7DNjiGWn1aJIRSQ5qr0xuhra77bSIh6voR/46Q==", "dev": true }, "umd": { @@ -11302,20 +12895,17 @@ "dev": true }, "util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", - "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", + "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==", "dev": true, "requires": { - "inherits": "2.0.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - } + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" } }, "util-deprecate": { @@ -11379,9 +12969,9 @@ "dev": true }, "v8-compile-cache": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", - "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", "dev": true }, "validate-npm-package-license": { @@ -11590,6 +13180,62 @@ "to-regex": "^3.0.1" } }, + "browserify": { + "version": "16.5.2", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.5.2.tgz", + "integrity": "sha512-TkOR1cQGdmXU9zW4YukWzWVSJwrxmNdADFbqbE3HFgQWe5wqZmOawqZ7J/8MPCwk/W8yY7Y0h+7mOtcZxLP23g==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "assert": "^1.4.0", + "browser-pack": "^6.0.1", + "browser-resolve": "^2.0.0", + "browserify-zlib": "~0.2.0", + "buffer": "~5.2.1", + "cached-path-relative": "^1.0.0", + "concat-stream": "^1.6.0", + "console-browserify": "^1.1.0", + "constants-browserify": "~1.0.0", + "crypto-browserify": "^3.0.0", + "defined": "^1.0.0", + "deps-sort": "^2.0.0", + "domain-browser": "^1.2.0", + "duplexer2": "~0.1.2", + "events": "^2.0.0", + "glob": "^7.1.0", + "has": "^1.0.0", + "htmlescape": "^1.1.0", + "https-browserify": "^1.0.0", + "inherits": "~2.0.1", + "insert-module-globals": "^7.0.0", + "labeled-stream-splicer": "^2.0.0", + "mkdirp-classic": "^0.5.2", + "module-deps": "^6.2.3", + "os-browserify": "~0.3.0", + "parents": "^1.0.1", + "path-browserify": "~0.0.0", + "process": "~0.11.0", + "punycode": "^1.3.2", + "querystring-es3": "~0.2.0", + "read-only-stream": "^2.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.4", + "shasum": "^1.0.0", + "shell-quote": "^1.6.1", + "stream-browserify": "^2.0.0", + "stream-http": "^3.0.0", + "string_decoder": "^1.1.1", + "subarg": "^1.0.0", + "syntax-error": "^1.1.1", + "through2": "^2.0.0", + "timers-browserify": "^1.0.1", + "tty-browserify": "0.0.1", + "url": "~0.11.0", + "util": "~0.10.1", + "vm-browserify": "^1.0.0", + "xtend": "^4.0.0" + } + }, "chokidar": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", @@ -11618,6 +13264,12 @@ } } }, + "events": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/events/-/events-2.1.0.tgz", + "integrity": "sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg==", + "dev": true + }, "extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", @@ -12244,6 +13896,12 @@ "remove-trailing-separator": "^1.0.1" } }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "dev": true + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -12276,6 +13934,16 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, + "stream-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", + "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -12304,6 +13972,23 @@ "is-number": "^3.0.0", "repeat-string": "^1.6.1" } + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } } } }, @@ -12435,6 +14120,33 @@ "dev": true, "requires": { "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } } }, "word-wrap": { @@ -12575,9 +14287,9 @@ "dev": true }, "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, "yargs": { diff --git a/package.json b/package.json index 806f38f7358..fc4933a8195 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plotly.js", - "version": "1.55.2", + "version": "1.58.0", "description": "The open source javascript graphing library that powers plotly", "license": "MIT", "main": "./lib/index.js", @@ -64,8 +64,10 @@ "@turf/centroid": "^6.0.2", "alpha-shape": "^1.0.0", "canvas-fit": "^1.5.0", - "color-normalize": "^1.5.0", - "color-rgba": "^2.1.1", + "color-alpha": "1.0.4", + "color-normalize": "1.5.0", + "color-parse": "1.3.8", + "color-rgba": "2.1.1", "convex-hull": "^1.0.3", "country-regex": "^1.1.0", "d3": "^3.5.17", @@ -84,13 +86,13 @@ "gl-mat4": "^1.2.0", "gl-mesh3d": "^2.3.1", "gl-plot2d": "^1.4.5", - "gl-plot3d": "^2.4.6", + "gl-plot3d": "^2.4.7", "gl-pointcloud2d": "^1.0.3", "gl-scatter3d": "^1.2.3", "gl-select-box": "^1.0.4", "gl-spikes2d": "^1.0.2", "gl-streamtube3d": "^1.4.1", - "gl-surface3d": "^1.5.2", + "gl-surface3d": "^1.6.0", "gl-text": "^1.1.8", "glslify": "^7.1.1", "has-hover": "^1.0.1", @@ -109,7 +111,7 @@ "regl": "^1.6.1", "regl-error2d": "^2.0.11", "regl-line2d": "^3.0.18", - "regl-scatter2d": "3.2.0", + "regl-scatter2d": "^3.2.1", "regl-splom": "^1.0.12", "right-now": "^1.0.0", "robust-orientation": "^1.1.3", @@ -117,7 +119,7 @@ "strongly-connected-components": "^1.0.1", "superscript-text": "^1.0.0", "svg-path-sdf": "^1.1.3", - "tinycolor2": "^1.4.1", + "tinycolor2": "^1.4.2", "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", @@ -125,26 +127,27 @@ }, "devDependencies": { "brfs": "^2.0.2", - "browserify": "^16.5.2", + "browserify": "^17.0.0", "browserify-transform-tools": "^1.7.0", "bubleify": "^2.0.0", "check-node-version": "^4.0.3", "chttps": "^1.0.6", - "deep-equal": "^2.0.3", + "deep-equal": "^2.0.4", "derequire": "^2.1.1", "ecstatic": "^4.1.4", "elliptic": "^6.5.3", - "eslint": "^7.7.0", + "eslint": "^7.13.0", "espree": "^7.3.0", + "extra-iterable": "^2.5.13", "falafel": "^2.2.4", "fs-extra": "^9.0.1", - "fuse.js": "^6.4.1", + "fuse.js": "^6.4.3", "glob": "^7.1.6", "gzip-size": "^5.1.1", "into-stream": "^6.0.0", "jasmine-core": "^3.5.0", "jsdom": "^16.4.0", - "karma": "^5.1.1", + "karma": "^5.2.3", "karma-browserify": "^7.0.0", "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^1.3.0", @@ -153,19 +156,19 @@ "karma-jasmine-spec-tags": "^1.3.0", "karma-spec-reporter": "0.0.32", "karma-verbose-reporter": "0.0.6", - "karma-viewport": "^1.0.6", + "karma-viewport": "^1.0.7", "lodash": "^4.17.20", - "madge": "^3.9.2", + "madge": "^3.12.0", "minify-stream": "^2.1.0", "mkdirp": "^1.0.4", - "node-sass": "^4.14.1", + "node-sass": "^5.0.0", "npm-link-check": "^4.0.0", - "open": "^7.2.1", + "open": "^7.3.0", "prepend-file": "^2.0.0", "prettysize": "^2.0.0", "read-last-lines": "^1.7.2", "requirejs": "^2.3.6", - "run-series": "^1.1.8", + "run-series": "^1.1.9", "through2": "^4.0.2", "true-case-path": "^2.2.1", "watchify": "^3.11.1" diff --git a/src/components/annotations/attributes.js b/src/components/annotations/attributes.js index 1e27069b618..2dd2fe8b6a3 100644 --- a/src/components/annotations/attributes.js +++ b/src/components/annotations/attributes.js @@ -12,7 +12,34 @@ var ARROWPATHS = require('./arrow_paths'); var fontAttrs = require('../../plots/font_attributes'); var cartesianConstants = require('../../plots/cartesian/constants'); var templatedArray = require('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = require('../../constants/axis_placeable_objects'); +function arrowAxisRefDescription(axis) { + return [ + 'In order for absolute positioning of the arrow to work, *a' + axis + + 'ref* must be exactly the same as *' + axis + 'ref*, otherwise *a' + axis + + 'ref* will revert to *pixel* (explained next).', + 'For relative positioning, *a' + axis + 'ref* can be set to *pixel*,', + 'in which case the *a' + axis + '* value is specified in pixels', + 'relative to *' + axis + '*.', + 'Absolute positioning is useful', + 'for trendline annotations which should continue to indicate', + 'the correct trend when zoomed. Relative positioning is useful', + 'for specifying the text offset for an annotated point.' + ].join(' '); +} + +function arrowCoordinateDescription(axis, lower, upper) { + return [ + 'Sets the', axis, 'component of the arrow tail about the arrow head.', + 'If `a' + axis + 'ref` is `pixel`, a positive (negative)', + 'component corresponds to an arrow pointing', + 'from', upper, 'to', lower, '(' + lower, 'to', upper + ').', + 'If `a' + axis + 'ref` is not `pixel` and is exactly the same as `' + axis + 'ref`,', + 'this is an absolute value on that axis,', + 'like `' + axis + '`, specified in the same coordinates as `' + axis + 'ref`.' + ].join(' '); +} module.exports = templatedArray('annotation', { visible: { @@ -254,12 +281,7 @@ module.exports = templatedArray('annotation', { role: 'info', editType: 'calc+arraydraw', description: [ - 'Sets the x component of the arrow tail about the arrow head.', - 'If `axref` is `pixel`, a positive (negative) ', - 'component corresponds to an arrow pointing', - 'from right to left (left to right).', - 'If `axref` is an axis, this is an absolute value on that axis,', - 'like `x`, NOT a relative value.' + arrowCoordinateDescription('x', 'left', 'right') ].join(' ') }, ay: { @@ -267,12 +289,7 @@ module.exports = templatedArray('annotation', { role: 'info', editType: 'calc+arraydraw', description: [ - 'Sets the y component of the arrow tail about the arrow head.', - 'If `ayref` is `pixel`, a positive (negative) ', - 'component corresponds to an arrow pointing', - 'from bottom to top (top to bottom).', - 'If `ayref` is an axis, this is an absolute value on that axis,', - 'like `y`, NOT a relative value.' + arrowCoordinateDescription('y', 'top', 'bottom') ].join(' ') }, axref: { @@ -285,12 +302,10 @@ module.exports = templatedArray('annotation', { role: 'info', editType: 'calc', description: [ - 'Indicates in what terms the tail of the annotation (ax,ay) ', - 'is specified. If `pixel`, `ax` is a relative offset in pixels ', - 'from `x`. If set to an x axis id (e.g. *x* or *x2*), `ax` is ', - 'specified in the same terms as that axis. This is useful ', - 'for trendline annotations which should continue to indicate ', - 'the correct trend when zoomed.' + 'Indicates in what coordinates the tail of the', + 'annotation (ax,ay) is specified.', + axisPlaceableObjs.axisRefDescription('ax', 'left', 'right'), + arrowAxisRefDescription('x') ].join(' ') }, ayref: { @@ -303,12 +318,10 @@ module.exports = templatedArray('annotation', { role: 'info', editType: 'calc', description: [ - 'Indicates in what terms the tail of the annotation (ax,ay) ', - 'is specified. If `pixel`, `ay` is a relative offset in pixels ', - 'from `y`. If set to a y axis id (e.g. *y* or *y2*), `ay` is ', - 'specified in the same terms as that axis. This is useful ', - 'for trendline annotations which should continue to indicate ', - 'the correct trend when zoomed.' + 'Indicates in what coordinates the tail of the', + 'annotation (ax,ay) is specified.', + axisPlaceableObjs.axisRefDescription('ay', 'bottom', 'top'), + arrowAxisRefDescription('y') ].join(' ') }, // positioning @@ -322,11 +335,7 @@ module.exports = templatedArray('annotation', { editType: 'calc', description: [ 'Sets the annotation\'s x coordinate axis.', - 'If set to an x axis id (e.g. *x* or *x2*), the `x` position', - 'refers to an x coordinate', - 'If set to *paper*, the `x` position refers to the distance from', - 'the left side of the plotting area in normalized coordinates', - 'where 0 (1) corresponds to the left (right) side.' + axisPlaceableObjs.axisRefDescription('x', 'left', 'right'), ].join(' ') }, x: { @@ -385,11 +394,7 @@ module.exports = templatedArray('annotation', { editType: 'calc', description: [ 'Sets the annotation\'s y coordinate axis.', - 'If set to an y axis id (e.g. *y* or *y2*), the `y` position', - 'refers to an y coordinate', - 'If set to *paper*, the `y` position refers to the distance from', - 'the bottom of the plotting area in normalized coordinates', - 'where 0 (1) corresponds to the bottom (top).' + axisPlaceableObjs.axisRefDescription('y', 'bottom', 'top'), ].join(' ') }, y: { diff --git a/src/components/annotations/calc_autorange.js b/src/components/annotations/calc_autorange.js index aa47ec253e8..2c598b7ba48 100644 --- a/src/components/annotations/calc_autorange.js +++ b/src/components/annotations/calc_autorange.js @@ -34,10 +34,12 @@ function annAutorange(gd) { Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa = Axes.getFromId(gd, ann.xref); var ya = Axes.getFromId(gd, ann.yref); + var xRefType = Axes.getRefType(ann.xref); + var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; - if(xa) calcAxisExpansion(ann, xa); - if(ya) calcAxisExpansion(ann, ya); + if(xRefType === 'range') calcAxisExpansion(ann, xa); + if(yRefType === 'range') calcAxisExpansion(ann, ya); }); } diff --git a/src/components/annotations/defaults.js b/src/components/annotations/defaults.js index aca202ffaa2..ed791e4a1cf 100644 --- a/src/components/annotations/defaults.js +++ b/src/components/annotations/defaults.js @@ -60,7 +60,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) { if(showArrow) { var arrowPosAttr = 'a' + axLetter; // axref, ayref - var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel'); + var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel', + ['pixel', 'paper']); // for now the arrow can only be on the same axis or specified as pixels // TODO: sometime it might be interesting to allow it to be on *any* axis diff --git a/src/components/annotations/draw.js b/src/components/annotations/draw.js index f810100a420..eeeaa560fc5 100644 --- a/src/components/annotations/draw.js +++ b/src/components/annotations/draw.js @@ -13,6 +13,7 @@ var d3 = require('d3'); var Registry = require('../../registry'); var Plots = require('../../plots/plots'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var Axes = require('../../plots/cartesian/axes'); var Color = require('../color'); var Drawing = require('../drawing'); @@ -73,6 +74,31 @@ function drawOne(gd, index) { drawRaw(gd, options, index, false, xa, ya); } +// Convert pixels to the coordinates relevant for the axis referred to. For +// example, for paper it would convert to a value normalized by the dimension of +// the plot. +// axDomainRef: if true and axa defined, draws relative to axis domain, +// otherwise draws relative to data (if axa defined) or paper (if not). +function shiftPosition(axa, dAx, axLetter, gs, options) { + var optAx = options[axLetter]; + var axRef = options[axLetter + 'ref']; + var vertical = axLetter.indexOf('y') !== -1; + var axDomainRef = Axes.getRefType(axRef) === 'domain'; + var gsDim = vertical ? gs.h : gs.w; + if(axa) { + if(axDomainRef) { + // here optAx normalized to length of axis (e.g., normally in range + // 0 to 1). But dAx is in pixels. So we normalize dAx to length of + // axis before doing the math. + return optAx + (vertical ? -dAx : dAx) / axa._length; + } else { + return axa.p2r(axa.r2p(optAx) + dAx); + } + } else { + return optAx + (vertical ? -dAx : dAx) / gsDim; + } +} + /** * drawRaw: draw a single annotation, potentially with modifications * @@ -296,13 +322,14 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var alignPosition; var autoAlignFraction; var textShift; + var axRefType = Axes.getRefType(axRef); /* * calculate the *primary* pixel position * which is the arrowhead if there is one, * otherwise the text anchor point */ - if(ax) { + if(ax && (axRefType !== 'domain')) { // check if annotation is off screen, to bypass DOM manipulations var posFraction = ax.r2fraction(options[axLetter]); if(posFraction < 0 || posFraction > 1) { @@ -318,12 +345,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { + var axRefTypeEqDomain = axRefType === 'domain'; if(axLetter === 'x') { alignPosition = options[axLetter]; - basePx = gs.l + gs.w * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.l + gs.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; - basePx = gs.t + gs.h * alignPosition; + basePx = axRefTypeEqDomain ? + ax._offset + ax._length * alignPosition : + basePx = gs.t + gs.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } @@ -340,8 +372,29 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { annSizeFromHeight * shiftFraction(0.5, options.yanchor); if(tailRef === axRef) { - posPx.tail = ax._offset + ax.r2p(arrowLength); - // tail is data-referenced: autorange pads the text in px from the tail + // In the case tailRefType is 'domain' or 'paper', the arrow's + // position is set absolutely, which is consistent with how + // it behaves when its position is set in data ('range') + // coordinates. + var tailRefType = Axes.getRefType(tailRef); + if(tailRefType === 'domain') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + } + posPx.tail = ax._offset + ax._length * arrowLength; + } else if(tailRefType === 'paper') { + if(axLetter === 'y') { + arrowLength = 1 - arrowLength; + posPx.tail = gs.t + gs.h * arrowLength; + } else { + posPx.tail = gs.l + gs.w * arrowLength; + } + } else { + // assumed tailRef is range or paper referenced + posPx.tail = ax._offset + ax.r2p(arrowLength); + } + // tail is range- or domain-referenced: autorange pads the + // text in px from the tail textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; @@ -531,7 +584,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { .classed('cursor-move', true) .attr({ d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), - transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' + transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }) .style('stroke-width', (strokewidth + 6) + 'px') .call(Color.stroke, 'rgba(0,0,0,0)') @@ -562,22 +615,23 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { var ycenter = annxy0[1] + dy; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); - modifyItem('x', xa ? - xa.p2r(xa.r2p(options.x) + dx) : - (options.x + (dx / gs.w))); - modifyItem('y', ya ? - ya.p2r(ya.r2p(options.y) + dy) : - (options.y - (dy / gs.h))); + modifyItem('x', + shiftPosition(xa, dx, 'x', gs, options)); + modifyItem('y', + shiftPosition(ya, dy, 'y', gs, options)); + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs, options)); } - arrowGroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); + arrowGroup.attr('transform', strTranslate(dx, dy)); annTextGroup.attr({ transform: 'rotate(' + textangle + ',' + xcenter + ',' + ycenter + ')' @@ -609,14 +663,17 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { moveFn: function(dx, dy) { var csr = 'pointer'; if(options.showarrow) { + // for these 2 calls to shiftPosition, it is assumed xa, ya are + // defined, so gsDim will not be used, but we put it in + // anyways for consistency if(options.axref === options.xref) { - modifyItem('ax', xa.p2r(xa.r2p(options.ax) + dx)); + modifyItem('ax', shiftPosition(xa, dx, 'ax', gs, options)); } else { modifyItem('ax', options.ax + dx); } if(options.ayref === options.yref) { - modifyItem('ay', ya.p2r(ya.r2p(options.ay) + dy)); + modifyItem('ay', shiftPosition(ya, dy, 'ay', gs.w, options)); } else { modifyItem('ay', options.ay + dy); } @@ -625,7 +682,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else if(!subplotId) { var xUpdate, yUpdate; if(xa) { - xUpdate = xa.p2r(xa.r2p(options.x) + dx); + // shiftPosition will not execute code where xa was + // undefined, so we use to calculate xUpdate too + xUpdate = shiftPosition(xa, dx, 'x', gs, options); } else { var widthFraction = options._xsize / gs.w; var xLeft = options.x + (options._xshift - options.xshift) / gs.w - widthFraction / 2; @@ -635,7 +694,9 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } if(ya) { - yUpdate = ya.p2r(ya.r2p(options.y) + dy); + // shiftPosition will not execute code where ya was + // undefined, so we use to calculate yUpdate too + yUpdate = shiftPosition(ya, dy, 'y', gs, options); } else { var heightFraction = options._ysize / gs.h; var yBottom = options.y - (options._yshift + options.yshift) / gs.h - heightFraction / 2; @@ -655,7 +716,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) { } else return; annTextGroup.attr({ - transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform + transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); diff --git a/src/components/annotations/draw_arrow_head.js b/src/components/annotations/draw_arrow_head.js index 846faa8587b..99eafdc91d3 100644 --- a/src/components/annotations/draw_arrow_head.js +++ b/src/components/annotations/draw_arrow_head.js @@ -15,6 +15,11 @@ var Color = require('../color'); var ARROWPATHS = require('./arrow_paths'); +var Lib = require('../../lib'); +var strScale = Lib.strScale; +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; + /** * Add arrowhead(s) to a path or line element * @@ -134,9 +139,9 @@ module.exports = function drawArrowHead(el3, ends, options) { 'class': el3.attr('class'), d: arrowHeadStyle.path, transform: - 'translate(' + p.x + ',' + p.y + ')' + - (rot ? 'rotate(' + (rot * 180 / Math.PI) + ')' : '') + - 'scale(' + arrowScale + ')' + strTranslate(p.x, p.y) + + strRotate(rot * 180 / Math.PI) + + strScale(arrowScale) }) .style({ fill: Color.rgb(options.arrowcolor), diff --git a/src/components/colorbar/attributes.js b/src/components/colorbar/attributes.js index 8c34b050b17..a424fc97f53 100644 --- a/src/components/colorbar/attributes.js +++ b/src/components/colorbar/attributes.js @@ -157,6 +157,19 @@ module.exports = overrideAll({ tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}), + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + role: 'info', + description: [ + 'Determines where tick labels are drawn.' + ].join(' ') + }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, @@ -173,6 +186,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { diff --git a/src/components/colorbar/defaults.js b/src/components/colorbar/defaults.js index 0a501cd321d..6ad2a117784 100644 --- a/src/components/colorbar/defaults.js +++ b/src/components/colorbar/defaults.js @@ -51,10 +51,14 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('bordercolor'); coerce('borderwidth'); coerce('bgcolor'); + var ticklabelposition = coerce('ticklabelposition'); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear'); var opts = {outerTicks: false, font: layout.font}; + if(ticklabelposition.indexOf('inside') !== -1) { + opts.bgColor = 'black'; // could we instead use the average of colors in the scale? + } handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, 'linear', opts); diff --git a/src/components/colorbar/draw.js b/src/components/colorbar/draw.js index a952f78340d..676df2ec886 100644 --- a/src/components/colorbar/draw.js +++ b/src/components/colorbar/draw.js @@ -16,6 +16,7 @@ var Registry = require('../../registry'); var Axes = require('../../plots/cartesian/axes'); var dragElement = require('../dragelement'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var extendFlat = require('../../lib/extend').extendFlat; var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); @@ -270,10 +271,10 @@ function drawColorBar(g, opts, gd) { ax.setScale(); - g.attr('transform', 'translate(' + Math.round(gs.l) + ',' + Math.round(gs.t) + ')'); + g.attr('transform', strTranslate(Math.round(gs.l), Math.round(gs.t))); var titleCont = g.select('.' + cn.cbtitleunshift) - .attr('transform', 'translate(-' + Math.round(gs.l) + ',-' + Math.round(gs.t) + ')'); + .attr('transform', strTranslate(-Math.round(gs.l), -Math.round(gs.t))); var axLayer = g.select('.' + cn.cbaxis); var titleEl; @@ -385,18 +386,19 @@ function drawColorBar(g, opts, gd) { titleTrans[1] += (1 - nlines) * lineSize; } - titleGroup.attr('transform', 'translate(' + titleTrans + ')'); + titleGroup.attr('transform', strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } g.selectAll('.' + cn.cbfills + ',.' + cn.cblines) - .attr('transform', 'translate(0,' + Math.round(gs.h * (1 - ax.domain[1])) + ')'); + .attr('transform', strTranslate(0, Math.round(gs.h * (1 - ax.domain[1])))); - axLayer.attr('transform', 'translate(0,' + Math.round(-gs.t) + ')'); + axLayer.attr('transform', strTranslate(0, Math.round(-gs.t))); var fills = g.select('.' + cn.cbfills) .selectAll('rect.' + cn.cbfill) + .attr('style', '') .data(fillLevels); fills.enter().append('rect') .classed(cn.cbfill, true) @@ -460,20 +462,19 @@ function drawColorBar(g, opts, gd) { (opts.outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0); var vals = Axes.calcTicks(ax); - var transFn = Axes.makeTransFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd, ax, { vals: ax.ticks === 'inside' ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), - transFn: transFn + transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd, ax, { vals: vals, layer: axLayer, - transFn: transFn, + transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } @@ -483,7 +484,11 @@ function drawColorBar(g, opts, gd) { // TODO: why are we redrawing multiple times now with this? // I guess autoMargin doesn't like being post-promise? function positionCB() { - var innerWidth = thickPx + opts.outlinewidth / 2 + Drawing.bBox(axLayer.node()).width; + var innerWidth = thickPx + opts.outlinewidth / 2; + if(ax.ticklabelposition.indexOf('inside') === -1) { + innerWidth += Drawing.bBox(axLayer.node()).width; + } + titleEl = titleCont.select('text'); if(titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { @@ -528,7 +533,7 @@ function drawColorBar(g, opts, gd) { // fix positioning for xanchor!='left' var xoffset = ({center: 0.5, right: 1}[opts.xanchor] || 0) * outerwidth; - g.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); + g.attr('transform', strTranslate(gs.l - xoffset, gs.t)); // auto margin adjustment var marginOpts = {}; @@ -584,7 +589,7 @@ function makeEditable(g, opts, gd) { setCursor(g); }, moveFn: function(dx, dy) { - g.attr('transform', t0 + ' ' + 'translate(' + dx + ',' + dy + ')'); + g.attr('transform', t0 + strTranslate(dx, dy)); xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac, 0, 1, opts.xanchor); @@ -679,10 +684,12 @@ function mockColorBarAxis(gd, opts, zrange) { tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, + ticklabelposition: opts.ticklabelposition, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, + minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, diff --git a/src/components/drawing/index.js b/src/components/drawing/index.js index 66da24e32e0..1307e9ca2a9 100644 --- a/src/components/drawing/index.js +++ b/src/components/drawing/index.js @@ -17,6 +17,7 @@ var Registry = require('../../registry'); var Color = require('../color'); var Colorscale = require('../colorscale'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); @@ -78,7 +79,7 @@ drawing.translatePoint = function(d, sel, xa, ya) { if(sel.node().nodeName === 'text') { sel.attr('x', x).attr('y', y); } else { - sel.attr('transform', 'translate(' + x + ',' + y + ')'); + sel.attr('transform', strTranslate(x, y)); } } else { return false; @@ -704,7 +705,7 @@ function textPointPosition(s, textPosition, fontSize, markerRadius) { // fix the overall text group position s.attr('text-anchor', h); - group.attr('transform', 'translate(' + dx + ',' + dy + ')'); + group.attr('transform', strTranslate(dx, dy)); } function extracTextFontSize(d, trace) { @@ -1095,7 +1096,7 @@ drawing.setTranslate = function(element, x, y) { y = y || 0; transform = transform.replace(re, '').trim(); - transform += ' translate(' + x + ', ' + y + ')'; + transform += strTranslate(x, y); transform = transform.trim(); element[setter]('transform', transform); @@ -1129,7 +1130,7 @@ drawing.setScale = function(element, x, y) { y = y || 1; transform = transform.replace(re, '').trim(); - transform += ' scale(' + x + ', ' + y + ')'; + transform += 'scale(' + x + ',' + y + ')'; transform = transform.trim(); element[setter]('transform', transform); @@ -1148,7 +1149,7 @@ drawing.setPointGroupScale = function(selection, xScale, yScale) { // The same scale transform for every point: var scale = (xScale === 1 && yScale === 1) ? '' : - ' scale(' + xScale + ',' + yScale + ')'; + 'scale(' + xScale + ',' + yScale + ')'; selection.each(function() { var t = (this.getAttribute('transform') || '').replace(SCALE_RE, ''); @@ -1179,9 +1180,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms = []; } else { transforms = [ - 'translate(' + x + ',' + y + ')', + strTranslate(x, y), 'scale(' + xScale + ',' + yScale + ')', - 'translate(' + (-x) + ',' + (-y) + ')', + strTranslate(-x, -y), ]; } @@ -1189,6 +1190,6 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { transforms.push(existingTransform); } - el.attr('transform', transforms.join(' ')); + el.attr('transform', transforms.join('')); }); }; diff --git a/src/components/fx/hover.js b/src/components/fx/hover.js index 45617636789..05a17c9c17e 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -13,6 +13,8 @@ var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; +var strRotate = Lib.strRotate; var Events = require('../../lib/events'); var svgTextUtils = require('../../lib/svg_text_utils'); var overrideCursor = require('../../lib/override_cursor'); @@ -192,7 +194,9 @@ exports.loneHover = function loneHover(hoverItems, opts) { d.offset -= anchor; }); - alignHoverText(hoverLabel, fullOpts.rotateLabels); + var scaleX = opts.gd._fullLayout._invScaleX; + var scaleY = opts.gd._fullLayout._invScaleY; + alignHoverText(hoverLabel, fullOpts.rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; @@ -336,6 +340,12 @@ function _hover(gd, evt, subplot, noHoverEvent) { xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); + + xpx = transformedCoords[0]; + ypx = transformedCoords[1]; + // in case hover was called from mouseout into hovertext, // it's possible you're not actually over the plot anymore if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { @@ -716,10 +726,8 @@ function _hover(gd, evt, subplot, noHoverEvent) { if(!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels ? 'xa' : 'ya', fullLayout); - alignHoverText(hoverLabels, rotateLabels); - } - - // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true + alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); + } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true // we should improve the "fx" API so other plots can use it without these hack. if(evt.target && evt.target.tagName) { var hasClickToShow = Registry.getComponentMethod('annotations', 'hasClickToShow')(gd, newhoverdata); @@ -960,7 +968,7 @@ function createHoverText(hoverData, opts, gd) { Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd); } - label.attr('transform', 'translate(' + lx + ',' + ly + ')'); + label.attr('transform', strTranslate(lx, ly)); // remove the "close but not quite" points // because of error bars, only take up to a space @@ -1068,7 +1076,7 @@ function createHoverText(hoverData, opts, gd) { ly = outerHeight - txHeight; } } - legendContainer.attr('transform', 'translate(' + lx + ',' + ly + ')'); + legendContainer.attr('transform', strTranslate(lx, ly)); return legendContainer; } @@ -1103,8 +1111,13 @@ function createHoverText(hoverData, opts, gd) { hoverLabels.each(function(d) { var g = d3.select(this).attr('transform', ''); + var dColor = d.color; + if(Array.isArray(dColor)) { + dColor = dColor[d.eventData[0].pointNumber]; + } + // combine possible non-opaque trace color with bgColor - var color0 = d.bgcolor || d.color; + var color0 = d.bgcolor || dColor; // color for 'nums' part of the label var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, @@ -1112,7 +1125,7 @@ function createHoverText(hoverData, opts, gd) { ); // color for 'name' part of the label var nameColor = Color.combine( - Color.opacity(d.color) ? d.color : Color.defaultLine, + Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); // find a contrasting color for border and text @@ -1212,8 +1225,8 @@ function createHoverText(hoverData, opts, gd) { tx.attr('text-anchor', d.anchor); if(tx2width) tx2.attr('text-anchor', d.anchor); - g.attr('transform', 'translate(' + htx + ',' + hty + ')' + - (rotateLabels ? 'rotate(' + YANGLE + ')' : '')); + g.attr('transform', strTranslate(htx, hty) + + (rotateLabels ? strRotate(YANGLE) : '')); }); return hoverLabels; @@ -1472,7 +1485,10 @@ function hoverAvoidOverlaps(hoverLabels, axKey, fullLayout) { } } -function alignHoverText(hoverLabels, rotateLabels) { +function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { + var pX = function(x) { return x * scaleX; }; + var pY = function(y) { return y * scaleY; }; + // finally set the text positioning relative to the data and draw the // box around it hoverLabels.each(function(d) { @@ -1488,7 +1504,8 @@ function alignHoverText(hoverLabels, rotateLabels) { var offsetX = 0; var offsetY = d.offset; - if(anchor === 'middle') { + var isMiddle = anchor === 'middle'; + if(isMiddle) { txx -= d.tx2width / 2; tx2x += d.txwidth / 2 + HOVERTEXTPAD; } @@ -1497,49 +1514,50 @@ function alignHoverText(hoverLabels, rotateLabels) { offsetX = d.offset * YSHIFTX; } - g.select('path').attr('d', anchor === 'middle' ? + g.select('path') + .attr('d', isMiddle ? // middle aligned: rect centered on data - ('M-' + (d.bx / 2 + d.tx2width / 2) + ',' + (offsetY - d.by / 2) + - 'h' + d.bx + 'v' + d.by + 'h-' + d.bx + 'Z') : + ('M-' + pX(d.bx / 2 + d.tx2width / 2) + ',' + pY(offsetY - d.by / 2) + + 'h' + pX(d.bx) + 'v' + pY(d.by) + 'h-' + pX(d.bx) + 'Z') : // left or right aligned: side rect with arrow to data - ('M0,0L' + (horzSign * HOVERARROWSIZE + offsetX) + ',' + (HOVERARROWSIZE + offsetY) + - 'v' + (d.by / 2 - HOVERARROWSIZE) + - 'h' + (horzSign * d.bx) + - 'v-' + d.by + - 'H' + (horzSign * HOVERARROWSIZE + offsetX) + - 'V' + (offsetY - HOVERARROWSIZE) + + ('M0,0L' + pX(horzSign * HOVERARROWSIZE + offsetX) + ',' + pY(HOVERARROWSIZE + offsetY) + + 'v' + pY(d.by / 2 - HOVERARROWSIZE) + + 'h' + pX(horzSign * d.bx) + + 'v-' + pY(d.by) + + 'H' + pX(horzSign * HOVERARROWSIZE + offsetX) + + 'V' + pY(offsetY - HOVERARROWSIZE) + 'Z')); - var posX = txx + offsetX; + var posX = offsetX + txx; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || 'auto'; if(textAlign !== 'auto') { if(textAlign === 'left' && anchor !== 'start') { tx.attr('text-anchor', 'start'); - posX = anchor === 'middle' ? + posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if(textAlign === 'right' && anchor !== 'end') { tx.attr('text-anchor', 'end'); - posX = anchor === 'middle' ? + posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } - tx.call(svgTextUtils.positionText, posX, posY); + tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if(d.tx2width) { g.select('text.name') .call(svgTextUtils.positionText, - tx2x + alignShift * HOVERTEXTPAD + offsetX, - offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); + pX(tx2x + alignShift * HOVERTEXTPAD + offsetX), + pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD)); g.select('rect') .call(Drawing.setRect, - tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX, - offsetY - d.by / 2 - 1, - d.tx2width, d.by + 2); + pX(tx2x + (alignShift - 1) * d.tx2width / 2 + offsetX), + pY(offsetY - d.by / 2 - 1), + pX(d.tx2width), pY(d.by + 2)); } }); } diff --git a/src/components/images/attributes.js b/src/components/images/attributes.js index 1018355839e..c14afa9e7d8 100644 --- a/src/components/images/attributes.js +++ b/src/components/images/attributes.js @@ -10,6 +10,7 @@ var cartesianConstants = require('../../plots/cartesian/constants'); var templatedArray = require('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = require('../../constants/axis_placeable_objects'); module.exports = templatedArray('image', { @@ -57,7 +58,9 @@ module.exports = templatedArray('image', { 'Sets the image container size horizontally.', 'The image will be sized based on the `position` value.', 'When `xref` is set to `paper`, units are sized relative', - 'to the plot width.' + 'to the plot width.', + 'When `xref` ends with ` domain`, units are sized relative', + 'to the axis width.', ].join(' ') }, @@ -70,7 +73,9 @@ module.exports = templatedArray('image', { 'Sets the image container size vertically.', 'The image will be sized based on the `position` value.', 'When `yref` is set to `paper`, units are sized relative', - 'to the plot height.' + 'to the plot height.', + 'When `yref` ends with ` domain`, units are sized relative', + 'to the axis height.' ].join(' ') }, @@ -150,11 +155,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw', description: [ 'Sets the images\'s x coordinate axis.', - 'If set to a x axis id (e.g. *x* or *x2*), the `x` position', - 'refers to an x data coordinate', - 'If set to *paper*, the `x` position refers to the distance from', - 'the left of plot in normalized coordinates', - 'where *0* (*1*) corresponds to the left (right).' + axisPlaceableObjs.axisRefDescription('x', 'left', 'right'), ].join(' ') }, @@ -169,11 +170,7 @@ module.exports = templatedArray('image', { editType: 'arraydraw', description: [ 'Sets the images\'s y coordinate axis.', - 'If set to a y axis id (e.g. *y* or *y2*), the `y` position', - 'refers to a y data coordinate.', - 'If set to *paper*, the `y` position refers to the distance from', - 'the bottom of the plot in normalized coordinates', - 'where *0* (*1*) corresponds to the bottom (top).' + axisPlaceableObjs.axisRefDescription('y', 'bottom', 'top'), ].join(' ') }, editType: 'arraydraw' diff --git a/src/components/images/defaults.js b/src/components/images/defaults.js index 0c08874c441..7e85e6508f8 100644 --- a/src/components/images/defaults.js +++ b/src/components/images/defaults.js @@ -49,7 +49,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { for(var i = 0; i < 2; i++) { // 'paper' is the fallback axref var axLetter = axLetters[i]; - var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper'); + var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, 'paper', undefined); if(axRef !== 'paper') { var ax = Axes.getFromId(gdMock, axRef); diff --git a/src/components/images/draw.js b/src/components/images/draw.js index c1d93e3f3c5..50378e37802 100644 --- a/src/components/images/draw.js +++ b/src/components/images/draw.js @@ -11,6 +11,7 @@ var d3 = require('d3'); var Drawing = require('../drawing'); var Axes = require('../../plots/cartesian/axes'); +var axisIds = require('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); module.exports = function draw(gd) { @@ -27,7 +28,7 @@ module.exports = function draw(gd) { if(img.visible) { if(img.layer === 'below' && img.xref !== 'paper' && img.yref !== 'paper') { - subplot = img.xref + img.yref; + subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; @@ -130,10 +131,25 @@ module.exports = function draw(gd) { // Axes if specified var xa = Axes.getFromId(gd, d.xref); var ya = Axes.getFromId(gd, d.yref); + var xIsDomain = Axes.getRefType(d.xref) === 'domain'; + var yIsDomain = Axes.getRefType(d.yref) === 'domain'; var size = fullLayout._size; - var width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w; - var height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h; + var width, height; + if(xa !== undefined) { + width = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.sizex : + Math.abs(xa.l2p(d.sizex) - xa.l2p(0)); + } else { + width = d.sizex * size.w; + } + if(ya !== undefined) { + height = ((typeof(d.yref) === 'string') && yIsDomain) ? + ya._length * d.sizey : + Math.abs(ya.l2p(d.sizey) - ya.l2p(0)); + } else { + height = d.sizey * size.h; + } // Offsets for anchor positioning var xOffset = width * anchors.x[d.xanchor].offset; @@ -142,8 +158,25 @@ module.exports = function draw(gd) { var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; // Final positions - var xPos = (xa ? xa.r2p(d.x) + xa._offset : d.x * size.w + size.l) + xOffset; - var yPos = (ya ? ya.r2p(d.y) + ya._offset : size.h - d.y * size.h + size.t) + yOffset; + var xPos, yPos; + if(xa !== undefined) { + xPos = ((typeof(d.xref) === 'string') && xIsDomain) ? + xa._length * d.x + xa._offset : + xa.r2p(d.x) + xa._offset; + } else { + xPos = d.x * size.w + size.l; + } + xPos += xOffset; + if(ya !== undefined) { + yPos = ((typeof(d.yref) === 'string') && yIsDomain) ? + // consistent with "paper" yref value, where positive values + // move up the page + ya._length * (1 - d.y) + ya._offset : + ya.r2p(d.y) + ya._offset; + } else { + yPos = size.h - d.y * size.h + size.t; + } + yPos += yOffset; // Construct the proper aspectRatio attribute switch(d.sizing) { @@ -167,8 +200,8 @@ module.exports = function draw(gd) { // Set proper clipping on images - var xId = xa ? xa._id : ''; - var yId = ya ? ya._id : ''; + var xId = xa && (Axes.getRefType(d.xref) !== 'domain') ? xa._id : ''; + var yId = ya && (Axes.getRefType(d.yref) !== 'domain') ? ya._id : ''; var clipAxes = xId + yId; Drawing.setClipUrl( diff --git a/src/components/legend/attributes.js b/src/components/legend/attributes.js index 8e2456ef157..07e4785fbe9 100644 --- a/src/components/legend/attributes.js +++ b/src/components/legend/attributes.js @@ -92,6 +92,14 @@ module.exports = { 'or remain *constant* independent of the symbol size on the graph.' ].join(' ') }, + itemwidth: { + valType: 'number', + min: 30, + dflt: 30, + role: 'style', + editType: 'legend', + description: 'Sets the width (in px) of the legend item symbols (the part other than the title.text).', + }, itemclick: { valType: 'enumerated', diff --git a/src/components/legend/constants.js b/src/components/legend/constants.js index 67a0468c3d2..8a213bf6413 100644 --- a/src/components/legend/constants.js +++ b/src/components/legend/constants.js @@ -17,8 +17,6 @@ module.exports = { // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, - // number of px between legend symbol and legend text (always in x direction) - textGap: 40, // number of px between each legend item (x and/or y direction) itemGap: 5 }; diff --git a/src/components/legend/defaults.js b/src/components/legend/defaults.js index 9077a1e7890..06e2bce6d12 100644 --- a/src/components/legend/defaults.js +++ b/src/components/legend/defaults.js @@ -113,6 +113,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); coerce('itemsizing'); + coerce('itemwidth'); coerce('itemclick'); coerce('itemdoubleclick'); diff --git a/src/components/legend/draw.js b/src/components/legend/draw.js index b56ecf4f448..9240f7e44c1 100644 --- a/src/components/legend/draw.js +++ b/src/components/legend/draw.js @@ -89,7 +89,6 @@ module.exports = function draw(gd, opts) { if(title.text) { var titleEl = Lib.ensureSingle(scrollBox, 'text', 'legendtitletext'); titleEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, title.font) .text(title.text); @@ -410,11 +409,11 @@ function drawTexts(g, gd, opts) { var textEl = Lib.ensureSingle(g, 'text', 'legendtext'); textEl.attr('text-anchor', 'start') - .classed('user-select-none', true) .call(Drawing.font, opts.font) .text(isEditable ? ensureLength(name, maxNameLength) : name); - svgTextUtils.positionText(textEl, constants.textGap, 0); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, 0); if(isEditable) { textEl.call(svgTextUtils.makeEditable, {gd: gd, text: name}) @@ -467,11 +466,14 @@ function setupTraceToggle(g, gd) { var numClicks = 1; var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) { - s.style('cursor', 'pointer') - .attr('pointer-events', 'all') - .call(Color.fill, 'rgba(0,0,0,0)'); + if(!gd._context.staticPlot) { + s.style('cursor', 'pointer').attr('pointer-events', 'all'); + } + s.call(Color.fill, 'rgba(0,0,0,0)'); }); + if(gd._context.staticPlot) return; + traceToggle.on('mousedown', function() { newMouseDownTime = (new Date()).getTime(); if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) { @@ -541,7 +543,8 @@ function computeTextDimensions(g, gd, opts) { // to avoid getBoundingClientRect var textY = lineHeight * ((textLines - 1) / 2 - 0.3); if(legendItem) { - svgTextUtils.positionText(textEl, constants.textGap, -textY); + var textGap = opts.itemwidth + constants.itemGap * 2; + svgTextUtils.positionText(textEl, textGap, -textY); } else { // case of title svgTextUtils.positionText(textEl, constants.titlePad + bw, lineHeight + bw); } @@ -594,8 +597,8 @@ function computeLegendDimensions(gd, groups, traces, opts) { var bw = opts.borderwidth; var bw2 = 2 * bw; - var textGap = constants.textGap; var itemGap = constants.itemGap; + var textGap = opts.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(opts); diff --git a/src/components/legend/style.js b/src/components/legend/style.js index b7b9bec7618..3dbf2bfc09b 100644 --- a/src/components/legend/style.js +++ b/src/components/legend/style.js @@ -12,6 +12,7 @@ var d3 = require('d3'); var Registry = require('../../registry'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = require('../drawing'); var Color = require('../color'); var extractOpts = require('../colorscale/helpers').extractOpts; @@ -20,6 +21,8 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); var pieCastOption = require('../../traces/pie/helpers').castOption; +var constants = require('./constants'); + var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; @@ -30,6 +33,9 @@ module.exports = function style(s, gd, legend) { var fullLayout = gd._fullLayout; if(!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === 'constant'; + var itemWidth = legend.itemwidth; + var centerPos = (itemWidth + constants.itemGap * 2) / 2; + var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; @@ -58,7 +64,7 @@ module.exports = function style(s, gd, legend) { } else { var factor = {top: 1, bottom: -1}[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)); - layers.attr('transform', 'translate(0,' + markerOffsetY + ')'); + layers.attr('transform', strTranslate(0, markerOffsetY)); } var fill = layers @@ -161,7 +167,7 @@ module.exports = function style(s, gd, legend) { .data(showFill || showGradientFill ? [d] : []); fill.enter().append('path').classed('js-fill', true); fill.exit().remove(); - fill.attr('d', pathStart + 'h30v6h-30z') + fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z') .call(showFill ? Drawing.fillGroupStyle : fillGradient); if(showLine || showGradientLine) { @@ -181,7 +187,7 @@ module.exports = function style(s, gd, legend) { // though there *is* no vertical variation in this case. // so add an invisibly small angle to the line // This issue (and workaround) exist across (Mac) Chrome, FF, and Safari - line.attr('d', pathStart + (showGradientLine ? 'l30,0.0001' : 'h30')) + line.attr('d', pathStart + (showGradientLine ? 'l' + itemWidth + ',0.0001' : 'h' + itemWidth)) .call(showLine ? Drawing.lineGroupStyle : lineGradient); } @@ -271,7 +277,7 @@ module.exports = function style(s, gd, legend) { // make sure marker is on the bottom, in case it enters after text pts.enter().insert('path', ':first-child') .classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd); @@ -283,7 +289,7 @@ module.exports = function style(s, gd, legend) { .data(showText ? dMod : []); txt.enter() .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); + .append('text').attr('transform', centerTransform); txt.exit().remove(); txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); } @@ -311,7 +317,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legendwaterfall') .data(ptsData); pts.enter().append('path').classed('legendwaterfall', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -351,7 +357,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); barpath.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); barpath.exit().remove(); barpath.each(function(d) { @@ -375,7 +381,7 @@ module.exports = function style(s, gd, legend) { pts.enter().append('path').classed('legendbox', true) // if we want the median bar, prepend M6,0H-6 .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); pts.each(function() { @@ -415,7 +421,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H-8M-8,6V-6H8Z'; // increasing return 'M15,0H8M8,-6V6H-8Z'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -442,7 +448,7 @@ module.exports = function style(s, gd, legend) { if(i) return 'M-15,0H0M-8,-6V0'; // increasing return 'M15,0H0M8,6V0'; // decreasing }) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); @@ -478,7 +484,7 @@ module.exports = function style(s, gd, legend) { .data(isVisible ? [d] : []); pts.enter().append('path').classed('legend' + desiredType, true) .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); + .attr('transform', centerTransform); pts.exit().remove(); if(pts.size()) { @@ -576,7 +582,7 @@ module.exports = function style(s, gd, legend) { .selectAll('path.legend3dandfriends') .data(ptsData); pts.enter().append('path').classed('legend3dandfriends', true) - .attr('transform', 'translate(20,0)') + .attr('transform', centerTransform) .style('stroke-miterlimit', 1); pts.exit().remove(); diff --git a/src/components/rangeselector/draw.js b/src/components/rangeselector/draw.js index 7fe49cd98b4..ec82c49228e 100644 --- a/src/components/rangeselector/draw.js +++ b/src/components/rangeselector/draw.js @@ -15,6 +15,7 @@ var Plots = require('../../plots/plots'); var Color = require('../color'); var Drawing = require('../drawing'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); @@ -144,8 +145,7 @@ function drawButtonText(button, selectorLayout, d, gd) { } var text = Lib.ensureSingle(button, 'text', 'selector-text', function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'middle'); + s.attr('text-anchor', 'middle'); }); text.call(Drawing.font, selectorLayout.font) @@ -196,9 +196,7 @@ function reposition(gd, buttons, opts, axName, selector) { // TODO add buttongap attribute - button.attr('transform', 'translate(' + - (borderWidth + width) + ',' + borderWidth + - ')'); + button.attr('transform', strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, @@ -251,5 +249,5 @@ function reposition(gd, buttons, opts, axName, selector) { t: height * FROM_TL[yanchor] }); - selector.attr('transform', 'translate(' + lx + ',' + ly + ')'); + selector.attr('transform', strTranslate(lx, ly)); } diff --git a/src/components/rangeslider/draw.js b/src/components/rangeslider/draw.js index 584477e9721..7f8e5bf5586 100644 --- a/src/components/rangeslider/draw.js +++ b/src/components/rangeslider/draw.js @@ -14,6 +14,7 @@ var Registry = require('../../registry'); var Plots = require('../../plots/plots'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); @@ -119,7 +120,7 @@ module.exports = function(gd) { opts._offsetShift + constants.extraPad ); - rangeSlider.attr('transform', 'translate(' + x + ',' + y + ')'); + rangeSlider.attr('transform', strTranslate(x, y)); // update data <--> pixel coordinate conversion methods @@ -232,6 +233,8 @@ module.exports = function(gd) { }; function setupDragElement(rangeSlider, gd, axisOpts, opts) { + if(gd._context.staticPlot) return; + var slideBox = rangeSlider.select('rect.' + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select('rect.' + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select('rect.' + constants.grabAreaMaxClassName).node(); @@ -378,10 +381,10 @@ function setPixelRange(rangeSlider, gd, axisOpts, opts, oppAxisOpts, oppAxisRang var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select('g.' + constants.grabberMinClassName) - .attr('transform', 'translate(' + xMin + ',' + offset + ')'); + .attr('transform', strTranslate(xMin, offset)); rangeSlider.select('g.' + constants.grabberMaxClassName) - .attr('transform', 'translate(' + xMax + ',' + offset + ')'); + .attr('transform', strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd, axisOpts, opts) { @@ -403,7 +406,7 @@ function drawBg(rangeSlider, gd, axisOpts, opts) { bg.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, - transform: 'translate(' + offsetShift + ',' + offsetShift + ')', + transform: strTranslate(offsetShift, offsetShift), fill: opts.bgcolor, stroke: opts.bordercolor, 'stroke-width': lw @@ -619,14 +622,12 @@ function drawGrabbers(rangeSlider, gd, axisOpts, opts) { handleMax.attr(handleDynamicAttrs); // - if(gd._context.staticPlot) return; - var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, - cursor: constants.grabAreaCursor + cursor: !gd._context.staticPlot ? constants.grabAreaCursor : undefined, }; var grabAreaMin = Lib.ensureSingle(grabberMin, 'rect', constants.grabAreaMinClassName, function(s) { diff --git a/src/components/shapes/attributes.js b/src/components/shapes/attributes.js index 1b8b0ff2665..9e445831897 100644 --- a/src/components/shapes/attributes.js +++ b/src/components/shapes/attributes.js @@ -13,6 +13,7 @@ var scatterLineAttrs = require('../../traces/scatter/attributes').line; var dash = require('../drawing/attributes').dash; var extendFlat = require('../../lib/extend').extendFlat; var templatedArray = require('../../plot_api/plot_template').templatedArray; +var axisPlaceableObjs = require('../../constants/axis_placeable_objects'); module.exports = templatedArray('shape', { visible: { @@ -63,11 +64,7 @@ module.exports = templatedArray('shape', { xref: extendFlat({}, annAttrs.xref, { description: [ 'Sets the shape\'s x coordinate axis.', - 'If set to an x axis id (e.g. *x* or *x2*), the `x` position', - 'refers to an x coordinate.', - 'If set to *paper*, the `x` position refers to the distance from', - 'the left side of the plotting area in normalized coordinates', - 'where *0* (*1*) corresponds to the left (right) side.', + axisPlaceableObjs.axisRefDescription('x', 'left', 'right'), 'If the axis `type` is *log*, then you must take the', 'log of your desired range.', 'If the axis `type` is *date*, then you must convert', @@ -126,11 +123,7 @@ module.exports = templatedArray('shape', { yref: extendFlat({}, annAttrs.yref, { description: [ 'Sets the annotation\'s y coordinate axis.', - 'If set to an y axis id (e.g. *y* or *y2*), the `y` position', - 'refers to an y coordinate', - 'If set to *paper*, the `y` position refers to the distance from', - 'the bottom of the plotting area in normalized coordinates', - 'where *0* (*1*) corresponds to the bottom (top).' + axisPlaceableObjs.axisRefDescription('y', 'bottom', 'top'), ].join(' ') }), ysizemode: { diff --git a/src/components/shapes/calc_autorange.js b/src/components/shapes/calc_autorange.js index 6aae1d05fe1..b9e022b3b84 100644 --- a/src/components/shapes/calc_autorange.js +++ b/src/components/shapes/calc_autorange.js @@ -25,9 +25,12 @@ module.exports = function calcAutorange(gd) { var shape = shapeList[i]; shape._extremes = {}; - var ax, bounds; + var ax; var bounds; + var xRefType = Axes.getRefType(shape.xref); + var yRefType = Axes.getRefType(shape.yref); - if(shape.xref !== 'paper') { + // paper and axis domain referenced shapes don't affect autorange + if(shape.xref !== 'paper' && xRefType !== 'domain') { var vx0 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x0; var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1; ax = Axes.getFromId(gd, shape.xref); @@ -38,7 +41,7 @@ module.exports = function calcAutorange(gd) { } } - if(shape.yref !== 'paper') { + if(shape.yref !== 'paper' && yRefType !== 'domain') { var vy0 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y0; var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1; ax = Axes.getFromId(gd, shape.yref); diff --git a/src/components/shapes/defaults.js b/src/components/shapes/defaults.js index 85b18ad3463..c6ab8ea3b6c 100644 --- a/src/components/shapes/defaults.js +++ b/src/components/shapes/defaults.js @@ -63,9 +63,11 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { var r2pos; // xref, yref - var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, '', 'paper'); + var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined, + 'paper'); + var axRefType = Axes.getRefType(axRef); - if(axRef !== 'paper') { + if(axRefType === 'range') { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); diff --git a/src/components/shapes/draw.js b/src/components/shapes/draw.js index b519a654a8b..14f3faef6f7 100644 --- a/src/components/shapes/draw.js +++ b/src/components/shapes/draw.js @@ -183,7 +183,10 @@ function setClipPath(shapePath, gd, shapeOptions) { // note that for layer="below" the clipAxes can be different from the // subplot we're drawing this in. This could cause problems if the shape // spans two subplots. See https://github.com/plotly/plotly.js/issues/1452 - var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, ''); + // + // if axis is 'paper' or an axis with " domain" appended, then there is no + // clip axis + var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, '').replace(/[xyz][1-9]* *domain/g, ''); Drawing.setClipUrl( shapePath, @@ -209,11 +212,13 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe // setup conversion functions var xa = Axes.getFromId(gd, shapeOptions.xref); + var xRefType = Axes.getRefType(shapeOptions.xref); var ya = Axes.getFromId(gd, shapeOptions.yref); - var x2p = helpers.getDataToPixel(gd, xa); - var y2p = helpers.getDataToPixel(gd, ya, true); - var p2x = helpers.getPixelToData(gd, xa); - var p2y = helpers.getPixelToData(gd, ya, true); + var yRefType = Axes.getRefType(shapeOptions.yref); + var x2p = helpers.getDataToPixel(gd, xa, false, xRefType); + var y2p = helpers.getDataToPixel(gd, ya, true, yRefType); + var p2x = helpers.getPixelToData(gd, xa, false, xRefType); + var p2y = helpers.getPixelToData(gd, ya, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { @@ -584,6 +589,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe function getPathString(gd, options) { var type = options.type; + var xRefType = Axes.getRefType(options.xref); + var yRefType = Axes.getRefType(options.yref); var xa = Axes.getFromId(gd, options.xref); var ya = Axes.getFromId(gd, options.yref); var gs = gd._fullLayout._size; @@ -591,15 +598,23 @@ function getPathString(gd, options) { var x0, x1, y0, y1; if(xa) { - x2r = helpers.shapePositionToRange(xa); - x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + if(xRefType === 'domain') { + x2p = function(v) { return xa._offset + xa._length * v; }; + } else { + x2r = helpers.shapePositionToRange(xa); + x2p = function(v) { return xa._offset + xa.r2p(x2r(v, true)); }; + } } else { x2p = function(v) { return gs.l + gs.w * v; }; } if(ya) { - y2r = helpers.shapePositionToRange(ya); - y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + if(yRefType === 'domain') { + y2p = function(v) { return ya._offset + ya._length * (1 - v); }; + } else { + y2r = helpers.shapePositionToRange(ya); + y2p = function(v) { return ya._offset + ya.r2p(y2r(v, true)); }; + } } else { y2p = function(v) { return gs.t + gs.h * (1 - v); }; } diff --git a/src/components/shapes/helpers.js b/src/components/shapes/helpers.js index fb5416a70ef..b22ea96a60d 100644 --- a/src/components/shapes/helpers.js +++ b/src/components/shapes/helpers.js @@ -58,18 +58,24 @@ exports.extractPathCoords = function(path, paramsToUse) { return extractedCoordinates; }; -exports.getDataToPixel = function(gd, axis, isVertical) { +exports.getDataToPixel = function(gd, axis, isVertical, refType) { var gs = gd._fullLayout._size; var dataToPixel; if(axis) { - var d2r = exports.shapePositionToRange(axis); - - dataToPixel = function(v) { - return axis._offset + axis.r2p(d2r(v, true)); - }; - - if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + if(refType === 'domain') { + dataToPixel = function(v) { + return axis._length * (isVertical ? (1 - v) : v) + axis._offset; + }; + } else { + var d2r = exports.shapePositionToRange(axis); + + dataToPixel = function(v) { + return axis._offset + axis.r2p(d2r(v, true)); + }; + + if(axis.type === 'date') dataToPixel = exports.decodeDate(dataToPixel); + } } else if(isVertical) { dataToPixel = function(v) { return gs.t + gs.h * (1 - v); }; } else { @@ -79,13 +85,20 @@ exports.getDataToPixel = function(gd, axis, isVertical) { return dataToPixel; }; -exports.getPixelToData = function(gd, axis, isVertical) { +exports.getPixelToData = function(gd, axis, isVertical, opt) { var gs = gd._fullLayout._size; var pixelToData; if(axis) { - var r2d = exports.rangeToShapePosition(axis); - pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + if(opt === 'domain') { + pixelToData = function(p) { + var q = (p - axis._offset) / axis._length; + return isVertical ? 1 - q : q; + }; + } else { + var r2d = exports.rangeToShapePosition(axis); + pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; + } } else if(isVertical) { pixelToData = function(p) { return 1 - (p - gs.t) / gs.h; }; } else { diff --git a/src/components/sliders/draw.js b/src/components/sliders/draw.js index dff30e5d2bd..e0496fb7746 100644 --- a/src/components/sliders/draw.js +++ b/src/components/sliders/draw.js @@ -14,6 +14,7 @@ var Plots = require('../../plots/plots'); var Color = require('../color'); var Drawing = require('../drawing'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = require('../../lib/svg_text_utils'); var arrayEditor = require('../../plot_api/plot_template').arrayEditor; @@ -302,11 +303,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { } var text = Lib.ensureSingle(sliderGroup, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': textAnchor, - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -357,11 +357,10 @@ function drawGrip(sliderGroup, gd, sliderOpts) { function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, 'text', constants.labelClass, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'middle', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); }); var tx = data.step.label; @@ -574,7 +573,7 @@ function setGripPosition(sliderGroup, sliderOpts, doTransition) { // Drawing.setTranslate doesn't work here becasue of the transition duck-typing. // It's also not necessary because there are no other transitions to preserve. - el.attr('transform', 'translate(' + (x - constants.gripWidth * 0.5) + ',' + (sliderOpts._dims.currentValueTotalHeight) + ')'); + el.attr('transform', strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } // Convert a number from [0-1] to a pixel position relative to the slider group container: diff --git a/src/components/titles/index.js b/src/components/titles/index.js index a1cdddaf21a..830d27e7beb 100644 --- a/src/components/titles/index.js +++ b/src/components/titles/index.js @@ -15,6 +15,7 @@ var isNumeric = require('fast-isnumeric'); var Plots = require('../../plots/plots'); var Registry = require('../../registry'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = require('../drawing'); var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); @@ -135,7 +136,7 @@ function draw(gd, titleClass, options) { transformVal += 'rotate(' + [transform.rotate, attributes.x, attributes.y] + ')'; } if(transform.offset) { - transformVal += 'translate(0, ' + transform.offset + ')'; + transformVal += strTranslate(0, transform.offset); } } else { transformVal = null; @@ -213,7 +214,7 @@ function draw(gd, titleClass, options) { top: [0, -shift], bottom: [0, shift] }[avoid.side]; - titleGroup.attr('transform', 'translate(' + shiftTemplate + ')'); + titleGroup.attr('transform', strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } diff --git a/src/components/updatemenus/draw.js b/src/components/updatemenus/draw.js index d5a160432c0..d74e312b74b 100644 --- a/src/components/updatemenus/draw.js +++ b/src/components/updatemenus/draw.js @@ -195,8 +195,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { // draw drop arrow at the right edge var arrow = Lib.ensureSingle(gHeader, 'text', constants.headerArrowClassName, function(s) { - s.classed('user-select-none', true) - .attr('text-anchor', 'end') + s.attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) .text(constants.arrowSymbol[menuOpts.direction]); }); @@ -435,11 +434,10 @@ function drawItemRect(item, menuOpts) { function drawItemText(item, menuOpts, itemOpts, gd) { var text = Lib.ensureSingle(item, 'text', constants.itemTextClassName, function(s) { - s.classed('user-select-none', true) - .attr({ - 'text-anchor': 'start', - 'data-notex': 1 - }); + s.attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); }); var tx = itemOpts.label; diff --git a/src/constants/axis_placeable_objects.js b/src/constants/axis_placeable_objects.js new file mode 100644 index 00000000000..1982b035a42 --- /dev/null +++ b/src/constants/axis_placeable_objects.js @@ -0,0 +1,30 @@ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + + +'use strict'; + +module.exports = { + axisRefDescription: function(axisname, lower, upper) { + return [ + 'If set to a', axisname, 'axis id (e.g. *' + axisname + '* or', + '*' + axisname + '2*), the `' + axisname + '` position refers to a', + axisname, 'coordinate. If set to *paper*, the `' + axisname + '`', + 'position refers to the distance from the', lower, 'of the plotting', + 'area in normalized coordinates where *0* (*1*) corresponds to the', + lower, '(' + upper + '). If set to a', axisname, 'axis ID followed by', + '*domain* (separated by a space), the position behaves like for', + '*paper*, but refers to the distance in fractions of the domain', + 'length from the', lower, 'of the domain of that axis: e.g.,', + '*' + axisname + '2 domain* refers to the domain of the second', + axisname, ' axis and a', axisname, 'position of 0.5 refers to the', + 'point between the', lower, 'and the', upper, 'of the domain of the', + 'second', axisname, 'axis.', + ].join(' '); + } +}; diff --git a/src/lib/dates.js b/src/lib/dates.js index 4fc8387d2cb..7664c00e0e9 100644 --- a/src/lib/dates.js +++ b/src/lib/dates.js @@ -45,9 +45,23 @@ function isWorldCalendar(calendar) { /* * dateTick0: get the canonical tick for this calendar * + * integer weekdays : Saturday: 0, Sunday: 1, Monday: 2, etc. + */ +exports.dateTick0 = function(calendar, dayOfWeek) { + var tick0 = _dateTick0(calendar, !!dayOfWeek); + if(dayOfWeek < 2) return tick0; + + var v = exports.dateTime2ms(tick0, calendar); + v += ONEDAY * (dayOfWeek - 1); // shift Sunday to Monday, etc. + return exports.ms2DateTime(v, 0, calendar); +}; + +/* + * _dateTick0: get the canonical tick for this calendar + * * bool sunday is for week ticks, shift it to a Sunday. */ -exports.dateTick0 = function(calendar, sunday) { +function _dateTick0(calendar, sunday) { if(isWorldCalendar(calendar)) { return sunday ? Registry.getComponentMethod('calendars', 'CANONICAL_SUNDAY')[calendar] : @@ -55,7 +69,7 @@ exports.dateTick0 = function(calendar, sunday) { } else { return sunday ? '2000-01-02' : '2000-01-01'; } -}; +} /* * dfltRange: for each calendar, give a valid default range diff --git a/src/lib/dom.js b/src/lib/dom.js index 6bc7760d253..99154835919 100644 --- a/src/lib/dom.js +++ b/src/lib/dom.js @@ -10,6 +10,8 @@ var d3 = require('d3'); var loggers = require('./loggers'); +var matrix = require('./matrix'); +var mat4X4 = require('gl-mat4'); /** * Allow referencing a graph DOM element either directly @@ -91,11 +93,84 @@ function deleteRelatedStyleRule(uid) { if(style) removeElement(style); } +function getFullTransformMatrix(element) { + var allElements = getElementAndAncestors(element); + // the identity matrix + var out = [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; + allElements.forEach(function(e) { + var t = getElementTransformMatrix(e); + if(t) { + var m = matrix.convertCssMatrix(t); + out = mat4X4.multiply(out, out, m); + } + }); + return out; +} + +/** + * extracts and parses the 2d css style transform matrix from some element + */ +function getElementTransformMatrix(element) { + var style = window.getComputedStyle(element, null); + var transform = ( + style.getPropertyValue('-webkit-transform') || + style.getPropertyValue('-moz-transform') || + style.getPropertyValue('-ms-transform') || + style.getPropertyValue('-o-transform') || + style.getPropertyValue('transform') + ); + + if(transform === 'none') return null; + // the transform is a string in the form of matrix(a, b, ...) or matrix3d(...) + return transform + .replace('matrix', '') + .replace('3d', '') + .slice(1, -1) + .split(',') + .map(function(n) { return +n; }); +} +/** + * retrieve all DOM elements that are ancestors of the specified one (including itself) + */ +function getElementAndAncestors(element) { + var allElements = []; + while(isTransformableElement(element)) { + allElements.push(element); + element = element.parentNode; + } + return allElements; +} + +function isTransformableElement(element) { + return element && (element instanceof Element || element instanceof HTMLElement); +} + +function equalDomRects(a, b) { + return ( + a && b && + a.x === b.x && + a.y === b.y && + a.top === b.top && + a.left === b.left && + a.right === b.right && + a.bottom === b.bottom + ); +} + module.exports = { getGraphDiv: getGraphDiv, isPlotDiv: isPlotDiv, removeElement: removeElement, addStyleRule: addStyleRule, addRelatedStyleRule: addRelatedStyleRule, - deleteRelatedStyleRule: deleteRelatedStyleRule + deleteRelatedStyleRule: deleteRelatedStyleRule, + getFullTransformMatrix: getFullTransformMatrix, + getElementTransformMatrix: getElementTransformMatrix, + getElementAndAncestors: getElementAndAncestors, + equalDomRects: equalDomRects }; diff --git a/src/lib/gl_format_color.js b/src/lib/gl_format_color.js index a0176a58321..2e5a47a61b6 100644 --- a/src/lib/gl_format_color.js +++ b/src/lib/gl_format_color.js @@ -76,14 +76,11 @@ function formatColor(containerIn, opacityIn, len) { return colorOut; } -function parseColorScale(cont, alpha) { - if(alpha === undefined) alpha = 1; - +function parseColorScale(cont) { var cOpts = Colorscale.extractOpts(cont); - var colorscale = cOpts.reversescale ? - Colorscale.flipScale(cOpts.colorscale) : - cOpts.colorscale; + var colorscale = cOpts.colorscale; + if(cOpts.reversescale) colorscale = Colorscale.flipScale(cOpts.colorscale); return colorscale.map(function(elem) { var index = elem[0]; @@ -91,7 +88,7 @@ function parseColorScale(cont, alpha) { var rgb = color.toRgb(); return { index: index, - rgb: [rgb.r, rgb.g, rgb.b, alpha] + rgb: [rgb.r, rgb.g, rgb.b, rgb.a] }; }); } diff --git a/src/lib/index.js b/src/lib/index.js index 157dd15542b..da28ce654a1 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -88,8 +88,11 @@ lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; +lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; +lib.convertCssMatrix = matrixModule.convertCssMatrix; +lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = require('./angles'); lib.deg2rad = anglesModule.deg2rad; @@ -145,6 +148,10 @@ lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; +lib.getFullTransformMatrix = domModule.getFullTransformMatrix; +lib.getElementTransformMatrix = domModule.getElementTransformMatrix; +lib.getElementAndAncestors = domModule.getElementAndAncestors; +lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = require('./clear_responsive'); @@ -1195,6 +1202,18 @@ lib.isHidden = function(gd) { return !display || display === 'none'; }; +lib.strTranslate = function(x, y) { + return (x || y) ? 'translate(' + x + ',' + y + ')' : ''; +}; + +lib.strRotate = function(a) { + return a ? 'rotate(' + a + ')' : ''; +}; + +lib.strScale = function(s) { + return s !== 1 ? 'scale(' + s + ')' : ''; +}; + /** Return transform text for bar bar-like rectangles and pie-like slices * @param {object} transform * - targetX: desired position on the x-axis @@ -1221,13 +1240,11 @@ lib.getTextTransform = function(transform) { else if(scale > 1) scale = 1; return ( - 'translate(' + - (targetX - scale * (textX + anchorX)) + ',' + - (targetY - scale * (textY + anchorY)) + - ')' + - (scale < 1 ? - 'scale(' + scale + ')' : '' + lib.strTranslate( + targetX - scale * (textX + anchorX), + targetY - scale * (textY + anchorY) ) + + lib.strScale(scale) + (rotate ? 'rotate(' + rotate + (noCenter ? '' : ' ' + textX + ' ' + textY) + @@ -1244,3 +1261,20 @@ lib.ensureUniformFontSize = function(gd, baseFont) { ); return out; }; + +/** + * provide a human-readable list e.g. "A, B, C and D" with an ending separator + * + * @param {array} arr : the array to join + * @param {string} mainSeparator : main separator + * @param {string} lastSeparator : last separator + * + * @return {string} : joined list + */ +lib.join2 = function(arr, mainSeparator, lastSeparator) { + var len = arr.length; + if(len > 1) { + return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; + } + return arr.join(mainSeparator); +}; diff --git a/src/lib/matrix.js b/src/lib/matrix.js index 80f5a87e508..a7467856cbc 100644 --- a/src/lib/matrix.js +++ b/src/lib/matrix.js @@ -9,6 +9,7 @@ 'use strict'; +var mat4X4 = require('gl-mat4'); exports.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); @@ -84,13 +85,23 @@ exports.rotationXYMatrix = function(a, x, y) { exports.translationMatrix(-x, -y)); }; +// applies a 3D transformation matrix to either x, y and z params +// Note: z is optional +exports.apply3DTransform = function(transform) { + return function() { + var args = arguments; + var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; + return exports.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); + }; +}; + // applies a 2D transformation matrix to either x and y params or an [x,y] array exports.apply2DTransform = function(transform) { return function() { var args = arguments; if(args.length === 3) { args = args[0]; - }// from map + } // from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; @@ -103,3 +114,37 @@ exports.apply2DTransform2 = function(transform) { return at(xys.slice(0, 2)).concat(at(xys.slice(2, 4))); }; }; + +exports.convertCssMatrix = function(m) { + if(m) { + var len = m.length; + if(len === 16) return m; + if(len === 6) { + // converts a 2x3 css transform matrix to a 4x4 matrix see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix + return [ + m[0], m[1], 0, 0, + m[2], m[3], 0, 0, + 0, 0, 1, 0, + m[4], m[5], 0, 1 + ]; + } + } + return [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]; +}; + +// find the inverse for a 4x4 affine transform matrix +exports.inverseTransformMatrix = function(m) { + var out = []; + mat4X4.invert(out, m); + return [ + [out[0], out[1], out[2], out[3]], + [out[4], out[5], out[6], out[7]], + [out[8], out[9], out[10], out[11]], + [out[12], out[13], out[14], out[15]] + ]; +}; diff --git a/src/lib/svg_text_utils.js b/src/lib/svg_text_utils.js index 93194a14145..e9549eab98f 100644 --- a/src/lib/svg_text_utils.js +++ b/src/lib/svg_text_utils.js @@ -14,6 +14,7 @@ var d3 = require('d3'); var Lib = require('../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var LINE_SPACING = require('../constants/alignment').LINE_SPACING; @@ -128,7 +129,7 @@ exports.convertToTspans = function(_context, gd, _callback) { if(svgClass[0] === 'y') { mathjaxGroup.attr({ transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + - ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' + ')' + strTranslate(-newSvgW / 2, dy - newSvgH / 2) }); newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { @@ -743,9 +744,20 @@ function alignHTMLWith(_base, container, options) { return function() { thisRect = this.node().getBoundingClientRect(); + + var x0 = getLeft() - cRect.left; + var y0 = getTop() - cRect.top; + var gd = options.gd || {}; + if(options.gd) { + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + } + this.style({ - top: (getTop() - cRect.top) + 'px', - left: (getLeft() - cRect.left) + 'px', + top: y0 + 'px', + left: x0 + 'px', 'z-index': 1000 }); return this; diff --git a/src/plot_api/helpers.js b/src/plot_api/helpers.js index 230b313a8b7..dc688ce8600 100644 --- a/src/plot_api/helpers.js +++ b/src/plot_api/helpers.js @@ -174,6 +174,16 @@ exports.cleanLayout = function(layout) { cleanAxRef(shape, 'yref'); } + var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; + for(i = 0; i < imagesLen; i++) { + var image = layout.images[i]; + + if(!Lib.isPlainObject(image)) continue; + + cleanAxRef(image, 'xref'); + cleanAxRef(image, 'yref'); + } + var legend = layout.legend; if(legend) { // check for old-style legend positioning (x or y is +/- 100) @@ -218,7 +228,7 @@ function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if(valIn && valIn !== 'paper') { - container[attr] = cleanId(valIn, axLetter); + container[attr] = cleanId(valIn, axLetter, true); } } diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 4baa8a329e5..1cc856e3bd7 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -367,7 +367,18 @@ function plot(gd, data, layout, config) { if(hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); - if(hasCartesian) seq.push(drawAxes); + if(hasCartesian) { + seq.push( + drawAxes, + function insideTickLabelsAutorange(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + relayout(gd, gd._fullLayout._insideTickLabelsAutorange).then(function() { + gd._fullLayout._insideTickLabelsAutorange = undefined; + }); + } + } + ); + } seq.push( subroutines.drawData, @@ -381,9 +392,16 @@ function plot(gd, data, layout, config) { // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, + saveRangeInitialForInsideTickLabels, Plots.previousPromises ); + function saveRangeInitialForInsideTickLabels(gd) { + if(gd._fullLayout._insideTickLabelsAutorange) { + if(graphWasEmpty) Axes.saveRangeInitial(gd, true); + } + } + // even if everything we did was synchronous, return a promise // so that the caller doesn't care which route we took var plotDone = Lib.syncOrAsync(seq, gd); @@ -1961,6 +1979,12 @@ function addAxRangeSequence(seq, rangesAltered) { var ax = Axes.getFromId(gd, id); axIds.push(id); + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + if(ax._anchorAxis) { + axIds.push(ax._anchorAxis._id); + } + } + if(ax._matchGroup) { for(var id2 in ax._matchGroup) { if(!rangesAltered[id2]) { @@ -2055,7 +2079,7 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; - var axId; + var ax; function recordAlteredAxis(pleafPlus) { var axId = Axes.name2id(pleafPlus.split('.')[0]); @@ -2145,7 +2169,7 @@ function _relayout(gd, aobj) { // previously we did this for log <-> not-log, but now only do it // for log <-> linear if(pleaf === 'type') { - var ax = parentIn; + ax = parentIn; var toLog = parentFull.type === 'linear' && vi === 'log'; var fromLog = parentFull.type === 'log' && vi === 'linear'; @@ -2283,21 +2307,19 @@ function _relayout(gd, aobj) { } // figure out if we need to recalculate axis constraints - var constraints = fullLayout._axisConstraintGroups || []; - for(axId in rangesAltered) { - for(i = 0; i < constraints.length; i++) { - var group = constraints[i]; - if(group[axId]) { - // Always recalc if we're changing constrained ranges. - // Otherwise it's possible to violate the constraints by - // specifying arbitrary ranges for all axes in the group. - // this way some ranges may expand beyond what's specified, - // as they do at first draw, to satisfy the constraints. - flags.calc = true; - for(var groupAxId in group) { - if(!rangesAltered[groupAxId]) { - Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; - } + for(var axId in rangesAltered) { + ax = Axes.getFromId(gd, axId); + var group = ax && ax._constraintGroup; + if(group) { + // Always recalc if we're changing constrained ranges. + // Otherwise it's possible to violate the constraints by + // specifying arbitrary ranges for all axes in the group. + // this way some ranges may expand beyond what's specified, + // as they do at first draw, to satisfy the constraints. + flags.calc = true; + for(var groupAxId in group) { + if(!rangesAltered[groupAxId]) { + Axes.getFromId(gd, groupAxId)._constraintShrinkable = true; } } } @@ -3708,6 +3730,19 @@ function purge(gd) { return gd; } +// determines if the graph div requires a recalculation of its inverse matrix transforms by comparing old + new bounding boxes. +function calcInverseTransform(gd) { + var fullLayout = gd._fullLayout; + + var newBBox = gd.getBoundingClientRect(); + if(Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; + + var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd)); + fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); + fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); + fullLayout._lastBBox = newBBox; +} + // ------------------------------------------------------- // makePlotFramework: Create the plot container and axes // ------------------------------------------------------- @@ -3715,15 +3750,20 @@ function makePlotFramework(gd) { var gd3 = d3.select(gd); var fullLayout = gd._fullLayout; + fullLayout._calcInverseTransform = calcInverseTransform; + fullLayout._calcInverseTransform(gd); + // Plot container fullLayout._container = gd3.selectAll('.plot-container').data([0]); - fullLayout._container.enter().insert('div', ':first-child') + fullLayout._container.enter() + .insert('div', ':first-child') .classed('plot-container', true) .classed('plotly', true); // Make the svg container fullLayout._paperdiv = fullLayout._container.selectAll('.svg-container').data([0]); fullLayout._paperdiv.enter().append('div') + .classed('user-select-none', true) .classed('svg-container', true) .style('position', 'relative'); @@ -3749,6 +3789,7 @@ function makePlotFramework(gd) { .classed('main-svg', true); fullLayout._modebardiv = fullLayout._paperdiv.append('div'); + delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append('svg') .classed('main-svg', true); diff --git a/src/plot_api/subroutines.js b/src/plot_api/subroutines.js index 7b8fc4c1766..bab023f3651 100644 --- a/src/plot_api/subroutines.js +++ b/src/plot_api/subroutines.js @@ -178,7 +178,7 @@ function lsInner(gd) { xa = plotinfo.xaxis; ya = plotinfo.yaxis; - if(plotinfo.bg) { + if(plotinfo.bg && xa._offset !== undefined && ya._offset !== undefined) { plotinfo.bg .call(Drawing.setRect, xa._offset - pad, ya._offset - pad, @@ -667,57 +667,35 @@ exports.redrawReglTraces = function(gd) { }; exports.doAutoRangeAndConstraints = function(gd) { - var fullLayout = gd._fullLayout; var axList = Axes.list(gd, '', true); - var matchGroups = fullLayout._axisMatchGroups || []; - var axLookup = {}; var ax; - var axRng; + + var autoRangeDone = {}; for(var i = 0; i < axList.length; i++) { ax = axList[i]; - cleanAxisConstraints(gd, ax); - doAutoRange(gd, ax); - axLookup[ax._id] = 1; - } - - enforceAxisConstraints(gd); - groupLoop: - for(var j = 0; j < matchGroups.length; j++) { - var group = matchGroups[j]; - var rng = null; - var id; - - for(id in group) { - ax = Axes.getFromId(gd, id); - - // skip over 'missing' axes which do not pass through doAutoRange - if(!axLookup[ax._id]) continue; - // if one axis has autorange false, we're done - if(ax.autorange === false) continue groupLoop; - - axRng = Lib.simpleMap(ax.range, ax.r2l); - if(rng) { - if(rng[0] < rng[1]) { - rng[0] = Math.min(rng[0], axRng[0]); - rng[1] = Math.max(rng[1], axRng[1]); - } else { - rng[0] = Math.max(rng[0], axRng[0]); - rng[1] = Math.min(rng[1], axRng[1]); + if(!autoRangeDone[ax._id]) { + autoRangeDone[ax._id] = 1; + cleanAxisConstraints(gd, ax); + doAutoRange(gd, ax); + + // For matching axes, just propagate this autorange to the group. + // The extra arg to doAutoRange avoids recalculating the range, + // since doAutoRange by itself accounts for all matching axes. but + // there are other side-effects of doAutoRange that we still want. + var matchGroup = ax._matchGroup; + if(matchGroup) { + for(var id2 in matchGroup) { + var ax2 = Axes.getFromId(gd, id2); + doAutoRange(gd, ax2, ax.range); + autoRangeDone[id2] = 1; } - } else { - rng = axRng; } } - - for(id in group) { - ax = Axes.getFromId(gd, id); - ax.range = Lib.simpleMap(rng, ax.l2r); - ax._input.range = ax.range.slice(); - ax.setScale(); - } } + + enforceAxisConstraints(gd); }; // An initial paint must be completed before these components can be diff --git a/src/plot_api/to_image.js b/src/plot_api/to_image.js index 11491416f01..e0e3f4c18bd 100644 --- a/src/plot_api/to_image.js +++ b/src/plot_api/to_image.js @@ -116,7 +116,7 @@ function toImage(gd, opts) { } if(!isImpliedOrValid('format')) { - throw new Error('Image format is not jpeg, png, svg or webp.'); + throw new Error('Export format is not ' + Lib.join2(attrs.format.values, ', ', ' or ') + '.'); } var fullOpts = {}; diff --git a/src/plots/cartesian/align_period.js b/src/plots/cartesian/align_period.js new file mode 100644 index 00000000000..abc833490cf --- /dev/null +++ b/src/plots/cartesian/align_period.js @@ -0,0 +1,90 @@ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var isNumeric = require('fast-isnumeric'); +var Lib = require('../../lib'); +var dateTime2ms = Lib.dateTime2ms; +var incrementMonth = Lib.incrementMonth; +var constants = require('../../constants/numerical'); +var ONEAVGMONTH = constants.ONEAVGMONTH; + +module.exports = function alignPeriod(trace, ax, axLetter, vals) { + if(ax.type !== 'date') return vals; + + var alignment = trace[axLetter + 'periodalignment']; + if(!alignment) return vals; + + var period = trace[axLetter + 'period']; + var mPeriod; + if(isNumeric(period)) { + period = +period; + if(period <= 0) return vals; + } else if(typeof period === 'string' && period.charAt(0) === 'M') { + var n = +(period.substring(1)); + if(n > 0 && Math.round(n) === n) { + mPeriod = n; + } else return vals; + } + + var calendar = ax.calendar; + + var isStart = 'start' === alignment; + // var isMiddle = 'middle' === alignment; + var isEnd = 'end' === alignment; + + var period0 = trace[axLetter + 'period0']; + var base = dateTime2ms(period0, calendar) || 0; + + var newVals = []; + var len = vals.length; + for(var i = 0; i < len; i++) { + var v = vals[i]; + + var nEstimated, startTime, endTime; + if(mPeriod) { + // guess at how many periods away from base we are + nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); + endTime = incrementMonth(base, mPeriod * nEstimated, calendar); + + // iterate to get the exact bounds before and after v + // there may be ways to make this faster, but most of the time + // we'll only execute each loop zero or one time. + while(endTime > v) { + endTime = incrementMonth(endTime, -mPeriod, calendar); + } + while(endTime <= v) { + endTime = incrementMonth(endTime, mPeriod, calendar); + } + + // now we know endTime is the boundary immediately after v + // so startTime is obtained by incrementing backward one period. + startTime = incrementMonth(endTime, -mPeriod, calendar); + } else { // case of ms + nEstimated = Math.round((v - base) / period); + endTime = base + nEstimated * period; + + while(endTime > v) { + endTime -= period; + } + while(endTime <= v) { + endTime += period; + } + + startTime = endTime - period; + } + + newVals[i] = ( + isStart ? startTime : + isEnd ? endTime : + (startTime + endTime) / 2 + ); + } + return newVals; +}; diff --git a/src/plots/cartesian/autorange.js b/src/plots/cartesian/autorange.js index d2c90fcb271..7564ac8cd3a 100644 --- a/src/plots/cartesian/autorange.js +++ b/src/plots/cartesian/autorange.js @@ -14,6 +14,8 @@ var Lib = require('../../lib'); var FP_SAFE = require('../../constants/numerical').FP_SAFE; var Registry = require('../../registry'); +var getFromId = require('./axis_ids').getFromId; + module.exports = { getAutoRange: getAutoRange, makePadFn: makePadFn, @@ -54,7 +56,8 @@ function getAutoRange(gd, ax) { var i, j; var newRange = []; - var getPad = makePadFn(ax); + var getPadMin = makePadFn(ax, 0); + var getPadMax = makePadFn(ax, 1); var extremes = concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; @@ -95,19 +98,6 @@ function getAutoRange(gd, ax) { // don't allow padding to reduce the data to < 10% of the length var minSpan = axLen / 10; - // find axis rangebreaks in [v0,v1] and compute its length in value space - var calcBreaksLength = function(v0, v1) { - var lBreaks = 0; - if(ax.rangebreaks) { - var rangebreaksOut = ax.locateBreaks(v0, v1); - for(var i = 0; i < rangebreaksOut.length; i++) { - var brk = rangebreaksOut[i]; - lBreaks += brk.max - brk.min; - } - } - return lBreaks; - }; - var mbest = 0; var minpt, maxpt, minbest, maxbest, dp, dv; @@ -115,9 +105,9 @@ function getAutoRange(gd, ax) { minpt = minArray[i]; for(j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; - dv = maxpt.val - minpt.val - calcBreaksLength(minpt.val, maxpt.val); + dv = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if(dv > 0) { - dp = axLen - getPad(minpt) - getPad(maxpt); + dp = axLen - getPadMin(minpt) - getPadMax(maxpt); if(dp > minSpan) { if(dv / dp > mbest) { minbest = minpt; @@ -135,8 +125,8 @@ function getAutoRange(gd, ax) { } } - function getMaxPad(prev, pt) { - return Math.max(prev, getPad(pt)); + function maximumPad(prev, pt) { + return Math.max(prev, getPadMax(pt)); } if(minmin === maxmax) { @@ -150,7 +140,7 @@ function getAutoRange(gd, ax) { // 'tozero' pins 0 to the low end, so follow that. newRange = [0, 1]; } else { - var maxPad = (minmin > 0 ? maxArray : minArray).reduce(getMaxPad, 0); + var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); // we're pushing a single value away from the edge due to its // padding, with the other end clamped at zero // 0.5 means don't push it farther than the center. @@ -171,7 +161,7 @@ function getAutoRange(gd, ax) { maxbest = {val: 0, pad: 0}; } } else if(nonNegative) { - if(minbest.val - mbest * getPad(minbest) < 0) { + if(minbest.val - mbest * getPadMin(minbest) < 0) { minbest = {val: 0, pad: 0}; } if(maxbest.val <= 0) { @@ -180,12 +170,12 @@ function getAutoRange(gd, ax) { } // in case it changed again... - mbest = (maxbest.val - minbest.val - calcBreaksLength(minpt.val, maxpt.val)) / - (axLen - getPad(minbest) - getPad(maxbest)); + mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / + (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ - minbest.val - mbest * getPad(minbest), - maxbest.val + mbest * getPad(maxbest) + minbest.val - mbest * getPadMin(minbest), + maxbest.val + mbest * getPadMax(maxbest) ]; } @@ -195,13 +185,41 @@ function getAutoRange(gd, ax) { return Lib.simpleMap(newRange, ax.l2r || Number); } +// find axis rangebreaks in [v0,v1] and compute its length in value space +function calcBreaksLength(ax, v0, v1) { + var lBreaks = 0; + if(ax.rangebreaks) { + var rangebreaksOut = ax.locateBreaks(v0, v1); + for(var i = 0; i < rangebreaksOut.length; i++) { + var brk = rangebreaksOut[i]; + lBreaks += brk.max - brk.min; + } + } + return lBreaks; +} + /* * calculate the pixel padding for ax._min and ax._max entries with * optional extrapad as 5% of the total axis length */ -function makePadFn(ax) { +function makePadFn(ax, max) { // 5% padding for points that specify extrapad: true - var extrappad = ax._length / 20; + var extrappad = 0.05 * ax._length; + + if( + (ax.ticklabelposition || '').indexOf('inside') !== -1 || + ((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1 + ) { + var axReverse = ax.autorange === 'reversed'; + if(!axReverse) { + var rng = Lib.simpleMap(ax.range, ax.r2l); + axReverse = rng[1] < rng[0]; + } + if(axReverse) max = !max; + } + + extrappad = adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max); + extrappad = adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max); // domain-constrained axes: base extrappad on the unconstrained // domain so it's consistent as the domain changes @@ -213,7 +231,97 @@ function makePadFn(ax) { return function getPad(pt) { return pt.pad + (pt.extrapad ? extrappad : 0); }; } -function concatExtremes(gd, ax) { +var TEXTPAD = 3; + +function adjustPadForInsideLabelsOnThisAxis(extrappad, ax, max) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + if(!has('inside')) return extrappad; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + if( + (max && (isLeft || isBottom)) || + (!max && (isRight || isTop)) + ) { + return extrappad; + } + + // increase padding to make more room for inside tick labels of the axis + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + var isX = ax._id.charAt(0) === 'x'; + var morePad = (isX ? 1.2 : 0.6) * fontSize; + + if(isAligned) { + morePad *= 2; + morePad += (ax.tickwidth || 0) / 2; + } + + morePad += TEXTPAD; + + extrappad = Math.max(extrappad, morePad); + + return extrappad; +} + +function adjustPadForInsideLabelsOnAnchorAxis(extrappad, ax, max) { + var anchorAxis = (ax._anchorAxis || {}); + if((anchorAxis.ticklabelposition || '').indexOf('inside') !== -1) { + // increase padding to make more room for inside tick labels of the counter axis + if(( + !max && ( + anchorAxis.side === 'left' || + anchorAxis.side === 'bottom' + ) + ) || ( + max && ( + anchorAxis.side === 'top' || + anchorAxis.side === 'right' + ) + )) { + var isX = ax._id.charAt(0) === 'x'; + + var morePad = 0; + if(anchorAxis._vals) { + var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + 'tick'] || 0); + var cosA = Math.abs(Math.cos(rad)); + var sinA = Math.abs(Math.sin(rad)); + + // use bounding boxes + anchorAxis._vals.forEach(function(t) { + if(t.bb) { + var w = t.bb.width; + var h = t.bb.height; + + morePad = Math.max(morePad, isX ? + Math.max(w * cosA, h * sinA) : + Math.max(h * cosA, w * sinA) + ); + + // add extra pad around label + morePad += 3; + } + }); + } + + if(anchorAxis.ticks === 'inside' && anchorAxis.ticklabelposition === 'inside') { + morePad += anchorAxis.ticklen || 0; + } + + extrappad = Math.max(extrappad, morePad); + } + } + + return extrappad; +} + +function concatExtremes(gd, ax, noMatch) { var axId = ax._id; var fullData = gd._fullData; var fullLayout = gd._fullLayout; @@ -242,14 +350,34 @@ function concatExtremes(gd, ax) { _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); + // Include the extremes from other matched axes with this one + if(ax._matchGroup && !noMatch) { + for(var axId2 in ax._matchGroup) { + if(axId2 !== ax._id) { + var ax2 = getFromId(gd, axId2); + var extremes2 = concatExtremes(gd, ax2, true); + // convert padding on the second axis to the first with lenRatio + var lenRatio = ax._length / ax2._length; + for(j = 0; j < extremes2.min.length; j++) { + d = extremes2.min[j]; + collapseMinArray(minArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + for(j = 0; j < extremes2.max.length; j++) { + d = extremes2.max[j]; + collapseMaxArray(maxArray, d.val, d.pad * lenRatio, {extrapad: d.extrapad}); + } + } + } + } + return {min: minArray, max: maxArray}; } -function doAutoRange(gd, ax) { +function doAutoRange(gd, ax, presetRange) { ax.setScale(); if(ax.autorange) { - ax.range = getAutoRange(gd, ax); + ax.range = presetRange ? presetRange.slice() : getAutoRange(gd, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index f2280d48c58..0445134133a 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -14,6 +14,7 @@ var Plots = require('../../plots/plots'); var Registry = require('../../registry'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = require('../../lib/svg_text_utils'); var Titles = require('../../components/titles'); var Color = require('../../components/color'); @@ -47,6 +48,8 @@ var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; +var TEXTPAD = 3; + var axes = module.exports = {}; axes.setConvert = require('./set_convert'); @@ -91,14 +94,17 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption var refAttr = attr + 'ref'; var attrDef = {}; - if(!dflt) dflt = axlist[0] || extraOption; + if(!dflt) dflt = axlist[0] || (typeof extraOption === 'string' ? extraOption : extraOption[0]); if(!extraOption) extraOption = dflt; + axlist = axlist.concat(axlist.map(function(x) { return x + ' domain'; })); // data-ref annotations are not supported in gl2d yet attrDef[refAttr] = { valType: 'enumerated', - values: axlist.concat(extraOption ? [extraOption] : []), + values: axlist.concat(extraOption ? + (typeof extraOption === 'string' ? [extraOption] : extraOption) : + []), dflt: dflt }; @@ -106,6 +112,21 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; +/* + * Get the type of an axis reference. This can be 'range', 'domain', or 'paper'. + * This assumes ar is a valid axis reference and returns 'range' if it doesn't + * match the patterns for 'paper' or 'domain'. + * + * ar: the axis reference string + * + */ +axes.getRefType = function(ar) { + if(ar === undefined) { return ar; } + if(ar === 'paper') { return 'paper'; } + if(ar === 'pixel') { return 'pixel'; } + if(/( domain)$/.test(ar)) { return 'domain'; } else { return 'range'; } +}; + /* * coerce position attributes (range-type) that can be either on axes or absolute * (paper or pixel) referenced. The biggest complication here is that we don't know @@ -130,8 +151,8 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { var cleanPos, pos; - - if(axRef === 'paper' || axRef === 'pixel') { + var axRefType = axes.getRefType(axRef); + if(axRefType !== 'range') { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { @@ -140,7 +161,6 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } - containerOut[attr] = cleanPos(pos); }; @@ -199,7 +219,9 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t // setup the data-to-calc method. if(Array.isArray(d2cTarget)) { ax = { - type: autoType(targetArray), + type: autoType(targetArray, undefined, { + autotypenumbers: gd._fullLayout.autotypenumbers + }), _categories: [] }; axes.setConvert(ax); @@ -521,6 +543,9 @@ function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, undefined, undefined, opts); + ax._dtickInit = ax.dtick; + ax._tick0Init = ax.tick0; + // calculate max number of (auto) ticks to display based on plot size if(ax.tickmode === 'auto' || !ax.dtick) { var nt = ax.nticks; @@ -545,7 +570,7 @@ axes.prepTicks = function(ax, opts) { if(ax.tickmode === 'array') nt *= 100; - ax._roughDTick = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / nt; + ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt; axes.autoTicks(ax, ax._roughDTick); // check for a forced minimum dtick @@ -555,6 +580,10 @@ axes.prepTicks = function(ax, opts) { } } + if(ax.ticklabelmode === 'period') { + adjustPeriodDelta(ax); + } + // check for missing tick0 if(!ax.tick0) { ax.tick0 = (ax.type === 'date') ? '2000-01-01' : 0; @@ -568,6 +597,190 @@ axes.prepTicks = function(ax, opts) { autoTickRound(ax); }; +function nMonths(dtick) { + return +(dtick.substring(1)); +} + +function adjustPeriodDelta(ax) { // adjusts ax.dtick and sets ax._definedDelta + var definedDelta; + + function mDate() { + return !( + isNumeric(ax.dtick) || + ax.dtick.charAt(0) !== 'M' + ); + } + var isMDate = mDate(); + var tickformat = axes.getTickFormat(ax); + if(tickformat) { + var noDtick = ax._dtickInit !== ax.dtick; + if( + !(/%[fLQsSMX]/.test(tickformat)) + // %f: microseconds as a decimal number [000000, 999999] + // %L: milliseconds as a decimal number [000, 999] + // %Q: milliseconds since UNIX epoch + // %s: seconds since UNIX epoch + // %S: second as a decimal number [00,61] + // %M: minute as a decimal number [00,59] + // %X: the locale’s time, such as %-I:%M:%S %p + ) { + if( + /%[HI]/.test(tickformat) + // %H: hour (24-hour clock) as a decimal number [00,23] + // %I: hour (12-hour clock) as a decimal number [01,12] + ) { + definedDelta = ONEHOUR; + if(noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; + } else if( + /%p/.test(tickformat) // %p: either AM or PM + ) { + definedDelta = HALFDAY; + if(noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; + } else if( + /%[Aadejuwx]/.test(tickformat) + // %A: full weekday name + // %a: abbreviated weekday name + // %d: zero-padded day of the month as a decimal number [01,31] + // %e: space-padded day of the month as a decimal number [ 1,31] + // %j: day of the year as a decimal number [001,366] + // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] + // %w: Sunday-based weekday as a decimal number [0,6] + // %x: the locale’s date, such as %-m/%-d/%Y + ) { + definedDelta = ONEDAY; + if(noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; + } else if( + /%[UVW]/.test(tickformat) + // %U: Sunday-based week of the year as a decimal number [00,53] + // %V: ISO 8601 week of the year as a decimal number [01, 53] + // %W: Monday-based week of the year as a decimal number [00,53] + ) { + definedDelta = ONEWEEK; + if(noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; + } else if( + /%[Bbm]/.test(tickformat) + // %B: full month name + // %b: abbreviated month name + // %m: month as a decimal number [01,12] + ) { + definedDelta = ONEAVGMONTH; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH) + ) ax.dtick = 'M1'; + } else if( + /%[q]/.test(tickformat) + // %q: quarter of the year as a decimal number [1,4] + ) { + definedDelta = ONEAVGQUARTER; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER) + ) ax.dtick = 'M3'; + } else if( + /%[Yy]/.test(tickformat) + // %Y: year with century as a decimal number, such as 1999 + // %y: year without century as a decimal number [00,99] + ) { + definedDelta = ONEAVGYEAR; + if(noDtick && ( + isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR) + ) ax.dtick = 'M12'; + } + } + } + + isMDate = mDate(); + if(isMDate && ax.tick0 === ax._dowTick0) { + // discard Sunday/Monday tweaks + ax.tick0 = ax._rawTick0; + } + + ax._definedDelta = definedDelta; +} + +function positionPeriodTicks(tickVals, ax, definedDelta) { + for(var i = 0; i < tickVals.length; i++) { + var v = tickVals[i].value; + + var a = i; + var b = i + 1; + if(i < tickVals.length - 1) { + a = i; + b = i + 1; + } else if(i > 0) { + a = i - 1; + b = i; + } else { + a = i; + b = i; + } + + var A = tickVals[a].value; + var B = tickVals[b].value; + var actualDelta = Math.abs(B - A); + var delta = definedDelta || actualDelta; + var periodLength = 0; + + if(delta >= ONEMINYEAR) { + if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGYEAR; + } + } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { + if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGQUARTER; + } + } else if(delta >= ONEMINMONTH) { + if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { + periodLength = actualDelta; + } else { + periodLength = ONEAVGMONTH; + } + } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { + periodLength = ONEWEEK; + } else if(delta >= ONEDAY) { + periodLength = ONEDAY; + } else if(definedDelta === HALFDAY && delta >= HALFDAY) { + periodLength = HALFDAY; + } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { + periodLength = ONEHOUR; + } + + var inBetween; + if(periodLength >= actualDelta) { + // ensure new label positions remain between ticks + periodLength = actualDelta; + inBetween = true; + } + + var endPeriod = v + periodLength; + if(ax.rangebreaks && periodLength > 0) { + var nAll = 84; // highly divisible 7 * 12 + var n = 0; + for(var c = 0; c < nAll; c++) { + var r = (c + 0.5) / nAll; + if(ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; + } + periodLength *= n / nAll; + + if(!periodLength) { + tickVals[i].drop = true; + } + + if(inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; // center monthly & longer periods + } + + if( + periodLength > 0 || // not instant + i === 0 // taking care first tick added + ) { + tickVals[i].periodX = v + periodLength / 2; + } + } +} + // calculate the ticks: text, values, positioning // if ticks are set to automatic, determine the right values (tick0,dtick) // in any case, set tickround to # of digits to round tick labels to, @@ -580,15 +793,20 @@ axes.calcTicks = function calcTicks(ax, opts) { // in case we're missing some ticktext, we can break out for array ticks if(ax.tickmode === 'array') return arrayTicks(ax); - // find the first tick - ax._tmin = axes.tickFirst(ax, opts); - // add a tiny bit so we get ticks which may have rounded out var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; // check for reversed axis var axrev = (rng[1] < rng[0]); + var minRange = Math.min(rng[0], rng[1]); + var maxRange = Math.max(rng[0], rng[1]); + + var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); + var isPeriod = ax.ticklabelmode === 'period'; + + // find the first tick + ax._tmin = axes.tickFirst(ax, opts); // No visible ticks? Quit. // I've only seen this on category axes with all categories off the edge. @@ -600,85 +818,81 @@ axes.calcTicks = function calcTicks(ax, opts) { Math.min(ax._categories.length - 0.5, endTick); } - var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L'); - - var tickVals; - function generateTicks() { - var xPrevious = null; - var maxTicks = Math.max(1000, ax._length || 0); - tickVals = []; - for(var x = ax._tmin; - (axrev) ? (x >= endTick) : (x <= endTick); - x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)) { - // prevent infinite loops - no more than one tick per pixel, - // and make sure each value is different from the previous - if(tickVals.length > maxTicks || x === xPrevious) break; - xPrevious = x; - - var minor = false; - if(isDLog && (x !== (x | 0))) { - minor = true; - } + var x = ax._tmin; - tickVals.push({ - minor: minor, - value: x - }); + if(ax.rangebreaks && ax._tick0Init !== ax.tick0) { + // adjust tick0 + x = moveOutsideBreak(x, ax); + if(!axrev) { + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); } } - generateTicks(); - - var isPeriod = ax.ticklabelmode === 'period'; if(isPeriod) { - // add one label to show pre tick0 period - tickVals.unshift({ - minor: false, - value: axes.tickIncrement(tickVals[0].value, ax.dtick, !axrev, ax.caldendar) + // add one item to label period before tick0 + x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar); + } + + var maxTicks = Math.max(1000, ax._length || 0); + var tickVals = []; + var xPrevious = null; + for(; + (axrev) ? (x >= endTick) : (x <= endTick); + x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar) + ) { + if(ax.rangebreaks) { + if(!axrev) { + if(x < startTick) continue; + if(ax.maskBreaks(x) === BADNUM && moveOutsideBreak(x, ax) >= maxRange) break; + } + } + + // prevent infinite loops - no more than one tick per pixel, + // and make sure each value is different from the previous + if(tickVals.length > maxTicks || x === xPrevious) break; + xPrevious = x; + + var minor = false; + if(isDLog && (x !== (x | 0))) { + minor = true; + } + + tickVals.push({ + minor: minor, + value: x }); } + if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta); + + var i; if(ax.rangebreaks) { - // replace ticks inside breaks that would get a tick - // and reduce ticks - var len = tickVals.length; - if(len) { - var tf = 0; - if(ax.tickmode === 'auto') { - tf = - (ax._id.charAt(0) === 'y' ? 2 : 6) * - (ax.tickfont ? ax.tickfont.size : 12); - } + var flip = ax._id.charAt(0) === 'y'; - var newTickVals = []; - var prevPos; - - var dir = axrev ? 1 : -1; - var first = axrev ? 0 : len - 1; - var last = axrev ? len - 1 : 0; - for(var q = first; dir * q <= dir * last; q += dir) { - var tickVal = tickVals[q]; - if(ax.maskBreaks(tickVal.value) === BADNUM) { - tickVal.value = moveOutsideBreak(tickVal.value, ax); - - if(ax._rl && ( - ax._rl[0] === tickVal.value || - ax._rl[1] === tickVal.value - )) continue; - } + var fontSize = 1; // one pixel minimum + if(ax.tickmode === 'auto') { + fontSize = ax.tickfont ? ax.tickfont.size : 12; + } - var pos = ax.c2p(tickVal.value); + var prevL = NaN; + for(i = tickVals.length - 1; i > -1; i--) { + if(tickVals[i].drop) { + tickVals.splice(i, 1); + continue; + } - if(pos === prevPos) { - if(newTickVals[newTickVals.length - 1].value < tickVal.value) { - newTickVals[newTickVals.length - 1] = tickVal; - } - } else if(prevPos === undefined || Math.abs(pos - prevPos) > tf) { - prevPos = pos; - newTickVals.push(tickVal); - } + tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); + + // avoid overlaps + var l = ax.c2p(tickVals[i].value); + if(flip ? + (prevL > l - fontSize) : + (prevL < l + fontSize) + ) { // ensure one pixel minimum + tickVals.splice(axrev ? i + 1 : i, 1); + } else { + prevL = l; } - tickVals = newTickVals.reverse(); } } @@ -699,180 +913,32 @@ axes.calcTicks = function calcTicks(ax, opts) { ax._prevDateHead = ''; ax._inCalcTicks = true; - var minRange = Math.min(rng[0], rng[1]); - var maxRange = Math.max(rng[0], rng[1]); - - var definedDelta; - var tickformat = axes.getTickFormat(ax); - if(isPeriod && tickformat) { - if( - !(/%[fLQsSMX]/.test(tickformat)) - // %f: microseconds as a decimal number [000000, 999999] - // %L: milliseconds as a decimal number [000, 999] - // %Q: milliseconds since UNIX epoch - // %s: seconds since UNIX epoch - // %S: second as a decimal number [00,61] - // %M: minute as a decimal number [00,59] - // %X: the locale’s time, such as %-I:%M:%S %p - ) { - if( - /%[HI]/.test(tickformat) - // %H: hour (24-hour clock) as a decimal number [00,23] - // %I: hour (12-hour clock) as a decimal number [01,12] - ) definedDelta = ONEHOUR; - else if( - /%p/.test(tickformat) // %p: either AM or PM - ) definedDelta = HALFDAY; - else if( - /%[Aadejuwx]/.test(tickformat) - // %A: full weekday name - // %a: abbreviated weekday name - // %d: zero-padded day of the month as a decimal number [01,31] - // %e: space-padded day of the month as a decimal number [ 1,31] - // %j: day of the year as a decimal number [001,366] - // %u: Monday-based (ISO 8601) weekday as a decimal number [1,7] - // %w: Sunday-based weekday as a decimal number [0,6] - // %x: the locale’s date, such as %-m/%-d/%Y - ) definedDelta = ONEDAY; - else if( - /%[UVW]/.test(tickformat) - // %U: Sunday-based week of the year as a decimal number [00,53] - // %V: ISO 8601 week of the year as a decimal number [01, 53] - // %W: Monday-based week of the year as a decimal number [00,53] - ) definedDelta = ONEWEEK; - else if( - /%[Bbm]/.test(tickformat) - // %B: full month name - // %b: abbreviated month name - // %m: month as a decimal number [01,12] - ) definedDelta = ONEAVGMONTH; - else if( - /%[q]/.test(tickformat) - // %q: quarter of the year as a decimal number [1,4] - ) definedDelta = ONEAVGQUARTER; - else if( - /%[Yy]/.test(tickformat) - // %Y: year with century as a decimal number, such as 1999 - // %y: year without century as a decimal number [00,99] - ) definedDelta = ONEAVGYEAR; - } - } - var ticksOut = []; - var i; - var prevText; + var t, p; for(i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; - var t = axes.tickText( + t = axes.tickText( ax, _value, false, // hover _minor // noSuffixPrefix ); - if(isPeriod && prevText === t.text) continue; - prevText = t.text; + p = tickVals[i].periodX; + if(p !== undefined) { + t.periodX = p; + if(p > maxRange || p < minRange) { // hide label if outside the range + if(p > maxRange) t.periodX = maxRange; + if(p < minRange) t.periodX = minRange; - ticksOut.push(t); - } - - if(isPeriod) { - var removedPreTick0Label = false; - - for(i = 0; i < ticksOut.length; i++) { - var v = ticksOut[i].x; - - var a = i; - var b = i + 1; - if(i < ticksOut.length - 1) { - a = i; - b = i + 1; - } else if(i > 0) { - a = i - 1; - b = i; - } else { - a = i; - b = i; - } - - var A = ticksOut[a].x; - var B = ticksOut[b].x; - var actualDelta = Math.abs(B - A); - var delta = definedDelta || actualDelta; - var periodLength = 0; - - if(delta >= ONEMINYEAR) { - if(actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGYEAR; - } - } else if(definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { - if(actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGQUARTER; - } - } else if(delta >= ONEMINMONTH) { - if(actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { - periodLength = actualDelta; - } else { - periodLength = ONEAVGMONTH; - } - } else if(definedDelta === ONEWEEK && delta >= ONEWEEK) { - periodLength = ONEWEEK; - } else if(delta >= ONEDAY) { - periodLength = ONEDAY; - } else if(definedDelta === HALFDAY && delta >= HALFDAY) { - periodLength = HALFDAY; - } else if(definedDelta === ONEHOUR && delta >= ONEHOUR) { - periodLength = ONEHOUR; - } - - if(periodLength && ax.rangebreaks) { - var nFirstHalf = 0; - var nSecondHalf = 0; - var nAll = 2 * 3 * 7; // number of samples - for(var c = 0; c < nAll; c++) { - var r = c / nAll; - if(ax.maskBreaks(A * (1 - r) + B * r) !== BADNUM) { - if(r < 0.5) { - nFirstHalf++; - } else { - nSecondHalf++; - } - } - } - - if(nSecondHalf) { - periodLength *= (nFirstHalf + nSecondHalf) / nAll; - } - } - - if(periodLength <= actualDelta) { // i.e. to ensure new label positions remain between ticks - v += periodLength / 2; - } - - ticksOut[i].periodX = v; - - if(v > maxRange || v < minRange) { // hide label if outside the range - ticksOut[i].text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) - removedPreTick0Label = true; + t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132) + ax._prevDateHead = ''; } } - if(removedPreTick0Label) { - for(i = 0; i < ticksOut.length; i++) { - if(ticksOut[i].periodX <= maxRange && ticksOut[i].periodX >= minRange) { - // redo first visible tick - ax._prevDateHead = ''; - ticksOut[i].text = axes.tickText(ax, ticksOut[i].x).text; - break; - } - } - } + ticksOut.push(t); } ax._inCalcTicks = false; @@ -965,7 +1031,8 @@ axes.autoTicks = function(ax, roughDTick) { } if(ax.type === 'date') { - ax.tick0 = Lib.dateTick0(ax.calendar); + ax.tick0 = Lib.dateTick0(ax.calendar, 0); + // the criteria below are all based on the rough spacing we calculate // being > half of the final unit - so precalculate twice the rough val var roughX2 = 2 * roughDTick; @@ -982,15 +1049,17 @@ axes.autoTicks = function(ax, roughDTick) { // get week ticks on sunday // this will also move the base tick off 2000-01-01 if dtick is // 2 or 3 days... but that's a weird enough case that we'll ignore it. - ax.tick0 = Lib.dateTick0(ax.calendar, true); - var tickformat = axes.getTickFormat(ax); + var isPeriod = ax.ticklabelmode === 'period'; + if(isPeriod) ax._rawTick0 = ax.tick0; + if(/%[uVW]/.test(tickformat)) { - // replace Sunday with Monday for ISO and Monday-based formats - var len = ax.tick0.length; - var lastD = +ax.tick0[len - 1]; - ax.tick0 = ax.tick0.substring(0, len - 2) + String(lastD + 1); + ax.tick0 = Lib.dateTick0(ax.calendar, 2); // Monday + } else { + ax.tick0 = Lib.dateTick0(ax.calendar, 1); // Sunday } + + if(isPeriod) ax._dowTick0 = ax.tick0; } else if(roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if(roughX2 > ONEMIN) { @@ -1103,7 +1172,8 @@ function autoTickRound(ax) { var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); - if(Math.abs(rangeexp) > 3) { + var minexponent = ax.minexponent === undefined ? 3 : ax.minexponent; + if(Math.abs(rangeexp) > minexponent) { if(isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; @@ -1586,6 +1656,7 @@ function numFormat(v, ax, fmtoverride, hover) { // make a dummy axis obj to get the auto rounding and exponent var ah = { exponentformat: exponentFormat, + minexponent: ax.minexponent, dtick: ax.showexponent === 'none' ? ax.dtick : (isNumeric(v) ? Math.abs(v) || 1 : 1), // if not showing any exponents, don't change the exponent @@ -1858,21 +1929,23 @@ axes.draw = function(gd, arg, opts) { fullLayout._paper.selectAll('g.subplot').each(function(d) { var id = d[0]; var plotinfo = fullLayout._plots[id]; - var xa = plotinfo.xaxis; - var ya = plotinfo.yaxis; - - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); - plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); - plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); - - if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); - if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); - - fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); - fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + if(plotinfo) { + var xa = plotinfo.xaxis; + var ya = plotinfo.yaxis; + + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'tick2').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'tick2').remove(); + plotinfo.xaxislayer.selectAll('.' + xa._id + 'divider').remove(); + plotinfo.yaxislayer.selectAll('.' + ya._id + 'divider').remove(); + + if(plotinfo.gridlayer) plotinfo.gridlayer.selectAll('path').remove(); + if(plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll('path').remove(); + + fullLayout._infolayer.select('.g-' + xa._id + 'title').remove(); + fullLayout._infolayer.select('.g-' + ya._id + 'title').remove(); + } }); } @@ -1973,23 +2046,24 @@ axes.drawOne = function(gd, ax, opts) { if(!ax.visible) return; - var transFn = axes.makeTransFn(ax); - var transTickLabelFn = ax.ticklabelmode === 'period' ? - axes.makeTransPeriodFn(ax) : - axes.makeTransFn(ax); + var transTickFn = axes.makeTransTickFn(ax); + var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; // We remove zero lines, grid lines, and inside ticks if they're within 1px of the end // The key case here is removing zero lines when the axis bound is zero var valsClipped; + var insideTicks = ax.ticks === 'inside'; + var outsideTicks = ax.ticks === 'outside'; + if(ax.tickson === 'boundaries') { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); - tickVals = ax.ticks === 'inside' ? valsClipped : boundaryVals; + tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); - tickVals = ax.ticks === 'inside' ? valsClipped : vals; + tickVals = (insideTicks && ax.ticklabelmode !== 'period') ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; @@ -2020,13 +2094,13 @@ axes.drawOne = function(gd, ax, opts) { counterAxis: counterAxis, layer: plotinfo.gridlayer.select('.' + axId), path: gridPath, - transFn: transFn + transFn: transTickFn }); axes.drawZeroLine(gd, ax, { counterAxis: counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, - transFn: transFn + transFn: transTickFn }); } } @@ -2047,7 +2121,7 @@ axes.drawOne = function(gd, ax, opts) { } var tickPath; - if(ax.showdividers && ax.ticks === 'outside' && ax.tickson === 'boundaries') { + if(ax.showdividers && outsideTicks && ax.tickson === 'boundaries') { var dividerLookup = {}; for(i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; @@ -2063,7 +2137,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: mainAxLayer, path: tickPath, - transFn: transFn + transFn: transTickFn }); if(ax.mirror === 'allticks') { @@ -2083,7 +2157,7 @@ axes.drawOne = function(gd, ax, opts) { vals: tickVals, layer: plotinfo[axLetter + 'axislayer'], path: spTickPath, - transFn: transFn + transFn: transTickFn }); } @@ -2115,7 +2189,7 @@ axes.drawOne = function(gd, ax, opts) { cls: axId + 'tick2', repositionOnUpdate: true, secondary: true, - transFn: transFn, + transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4]) }); }); @@ -2127,7 +2201,7 @@ axes.drawOne = function(gd, ax, opts) { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth), - transFn: transFn + transFn: transTickFn }); }); } else if(ax.title.hasOwnProperty('standoff')) { @@ -2142,7 +2216,7 @@ axes.drawOne = function(gd, ax, opts) { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd, ax); - var outsideTickLen = ax.ticks === 'outside' ? ax.ticklen : 0; + var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; @@ -2398,22 +2472,82 @@ axes.getTickSigns = function(ax) { * - {fn} l2p * @return {fn} function of calcTicks items */ -axes.makeTransFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.x)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.x)) + ')'; }; +axes.makeTransTickFn = function(ax) { + return ax._id.charAt(0) === 'x' ? + function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : + function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; }; -axes.makeTransPeriodFn = function(ax) { - var axLetter = ax._id.charAt(0); - var offset = ax._offset; - return axLetter === 'x' ? - function(d) { return 'translate(' + (offset + ax.l2p(d.periodX)) + ',0)'; } : - function(d) { return 'translate(0,' + (offset + ax.l2p(d.periodX)) + ')'; }; +axes.makeTransTickLabelFn = function(ax) { + var uv = getTickLabelUV(ax); + var u = uv[0]; + var v = uv[1]; + + return ax._id.charAt(0) === 'x' ? + function(d) { + return strTranslate( + u + ax._offset + ax.l2p(getPosX(d)), + v + ); + } : + function(d) { + return strTranslate( + v, + u + ax._offset + ax.l2p(getPosX(d)) + ); + }; }; +function getPosX(d) { + return d.periodX !== undefined ? d.periodX : d.x; +} + +// u is a shift along the axis, +// v is a shift perpendicular to the axis +function getTickLabelUV(ax) { + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isInside = has('inside'); + + var isAligned = isBottom || isLeft || isTop || isRight; + + // early return + if(!isAligned && !isInside) return [0, 0]; + + var side = ax.side; + + var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; + var v = TEXTPAD; + + var fontSize = ax.tickfont ? ax.tickfont.size : 12; + if(isBottom || isTop) { + u += fontSize * CAP_SHIFT; + v += (ax.linewidth || 0) / 2; + } + if(isLeft || isRight) { + u += (ax.linewidth || 0) / 2; + v += TEXTPAD; + } + if(isInside && side === 'top') { + v -= fontSize * (1 - CAP_SHIFT); + } + + if(isLeft || isTop) u = -u; + if(side === 'bottom' || side === 'right') v = -v; + + return [ + isAligned ? u : 0, + isInside ? v : 0 + ]; +} + /** * Make axis tick path string * @@ -2459,24 +2593,45 @@ axes.makeTickPath = function(ax, shift, sgn, len) { * - {number} labelShift (gap perpendicular to ticks) */ axes.makeLabelFns = function(ax, shift, angle) { - var axLetter = ax._id.charAt(0); - var ticksOnOutsideLabels = ax.tickson !== 'boundaries' && ax.ticks === 'outside'; + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + + var insideTickLabels = has('inside'); + var labelsOverTicks = + (ticklabelposition === 'inside' && ax.ticks === 'inside') || + (!insideTickLabels && ax.ticks === 'outside' && ax.tickson !== 'boundaries'); var labelStandoff = 0; var labelShift = 0; - if(ticksOnOutsideLabels) { - labelStandoff += ax.ticklen; + var tickLen = labelsOverTicks ? ax.ticklen : 0; + if(insideTickLabels) { + tickLen *= -1; + } else if(isAligned) { + tickLen = 0; } - if(angle && ax.ticks === 'outside') { - var rad = Lib.deg2rad(angle); - labelStandoff = ax.ticklen * Math.cos(rad) + 1; - labelShift = ax.ticklen * Math.sin(rad); + + if(labelsOverTicks) { + labelStandoff += tickLen; + if(angle) { + var rad = Lib.deg2rad(angle); + labelStandoff = tickLen * Math.cos(rad) + 1; + labelShift = tickLen * Math.sin(rad); + } } - if(ax.showticklabels && (ticksOnOutsideLabels || ax.showline)) { + + if(ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } - labelStandoff += (ax.linewidth || 1) / 2; + labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff: labelStandoff, @@ -2484,42 +2639,101 @@ axes.makeLabelFns = function(ax, shift, angle) { }; var x0, y0, ff, flipIt; + var xQ = 0; + var side = ax.side; + var axLetter = ax._id.charAt(0); + var tickangle = ax.tickangle; + var endSide; if(axLetter === 'x') { - flipIt = ax.side === 'bottom' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'bottom') || + (insideTickLabels && side === 'top'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelShift * flipIt; y0 = shift + labelStandoff * flipIt; - ff = ax.side === 'bottom' ? 1 : -0.2; + ff = endSide ? 1 : -0.2; + if(Math.abs(tickangle) === 90) { + if(insideTickLabels) { + ff += MID_SHIFT; + } else { + if(tickangle === -90 && side === 'bottom') { + ff = CAP_SHIFT; + } else if(tickangle === 90 && side === 'top') { + ff = MID_SHIFT; + } else { + ff = 0.5; + } + } - out.xFn = function(d) { return d.dx + x0; }; + xQ = (MID_SHIFT / 2) * (tickangle / 90); + } + + out.xFn = function(d) { return d.dx + x0 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; }; out.anchorFn = function(d, a) { + if(isAligned) { + if(isLeft) return 'end'; + if(isRight) return 'start'; + } + if(!isNumeric(a) || a === 0 || a === 180) { return 'middle'; } - return (a * flipIt < 0) ? 'end' : 'start'; + + return ((a * flipIt < 0) !== insideTickLabels) ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { return (a < -60 || a > 60) ? -0.5 * h : - ax.side === 'top' ? -h : + ((ax.side === 'top') !== insideTickLabels) ? -h : 0; }; } else if(axLetter === 'y') { - flipIt = ax.side === 'right' ? 1 : -1; + endSide = + (!insideTickLabels && side === 'left') || + (insideTickLabels && side === 'right'); + + flipIt = endSide ? 1 : -1; + if(insideTickLabels) flipIt *= -1; + x0 = labelStandoff; - y0 = -labelShift * flipIt; - ff = Math.abs(ax.tickangle) === 90 ? 0.5 : 0; + y0 = labelShift * flipIt; + ff = 0; + if(!insideTickLabels && Math.abs(tickangle) === 90) { + if( + (tickangle === -90 && side === 'left') || + (tickangle === 90 && side === 'right') + ) { + ff = CAP_SHIFT; + } else { + ff = 0.5; + } + } - out.xFn = function(d) { return d.dx + shift + (x0 + d.fontSize * ff) * flipIt; }; + if(insideTickLabels) { + var ang = isNumeric(tickangle) ? +tickangle : 0; + if(ang !== 0) { + var rA = Lib.deg2rad(ang); + xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; + ff = 0; + } + } + + out.xFn = function(d) { return d.dx + shift - (x0 + d.fontSize * ff) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y0 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if(isNumeric(a) && Math.abs(a) === 90) { return 'middle'; } - return ax.side === 'right' ? 'start' : 'end'; + + return endSide ? 'end' : 'start'; }; out.heightFn = function(d, a, h) { - a *= ax.side === 'left' ? 1 : -1; + if(ax.side === 'right') a *= -1; + return a < -30 ? -h : a < 30 ? -0.5 * h : 0; @@ -2771,6 +2985,8 @@ axes.drawLabels = function(gd, ax, opts) { } function positionLabels(s, angle) { + var isInside = (ax.ticklabelposition || '').indexOf('inside') !== -1; + s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select('.text-math-group'); @@ -2788,22 +3004,66 @@ axes.drawLabels = function(gd, ax, opts) { var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if(anchorHeight) { - transform += ' translate(0, ' + anchorHeight + ')'; + transform += strTranslate(0, anchorHeight); } if(mathjaxGroup.empty()) { - thisLabel.select('text').attr({ + var thisText = thisLabel.select('text'); + thisText.attr({ transform: transform, 'text-anchor': anchor }); + + if(isInside) { + // ensure visible + thisText.style({ opacity: 100 }); + + if(ax._hideOutOfRangeInsideTickLabels) { + ax._hideOutOfRangeInsideTickLabels(); + } + } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * {end: -0.5, start: 0.5}[anchor]; - mathjaxGroup.attr('transform', transform + (mjShift ? 'translate(' + mjShift + ',0)' : '')); + mathjaxGroup.attr('transform', transform + strTranslate(mjShift, 0)); } }); } + ax._hideOutOfRangeInsideTickLabels = undefined; + if((ax.ticklabelposition || '').indexOf('inside') !== -1) { + ax._hideOutOfRangeInsideTickLabels = function() { + var rl = Lib.simpleMap(ax.range, ax.r2l); + + // hide inside tick labels that go outside axis end points + var p0 = ax.l2p(rl[0]); + var p1 = ax.l2p(rl[1]); + + var min = Math.min(p0, p1) + ax._offset; + var max = Math.max(p0, p1) + ax._offset; + + var isX = ax._id.charAt(0) === 'x'; + + tickLabels.each(function(d) { + var thisLabel = d3.select(this); + var mathjaxGroup = thisLabel.select('.text-math-group'); + + if(mathjaxGroup.empty()) { + var bb = Drawing.bBox(thisLabel.node()); + var hide = false; + if(isX) { + if(bb.right > max) hide = true; + else if(bb.left < min) hide = true; + } else { + if(bb.bottom > max) hide = true; + else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true; + } + if(hide) thisLabel.select('text').style({ opacity: 0 }); + } // TODO: hide mathjax? + }); + }; + } + // make sure all labels are correctly positioned at their base angle // the positionLabels call above is only for newly drawn labels. // do this without waiting, using the last calculated angle to @@ -2871,11 +3131,24 @@ axes.drawLabels = function(gd, ax, opts) { } else { var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); + + var ticklabelposition = ax.ticklabelposition || ''; + var has = function(str) { + return ticklabelposition.indexOf(str) !== -1; + }; + var isTop = has('top'); + var isLeft = has('left'); + var isRight = has('right'); + var isBottom = has('bottom'); + var isAligned = isBottom || isLeft || isTop || isRight; + var pad = !isAligned ? 0 : + (ax.tickwidth || 0) + 2 * TEXTPAD; + var rotate90 = (tickSpacing < maxFontSize * 2.5) || ax.type === 'multicategory'; // any overlap at all - set 30 degrees or 90 degrees for(i = 0; i < lbbArray.length - 1; i++) { - if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1])) { + if(Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad)) { autoangle = rotate90 ? 90 : 30; break; } @@ -2915,6 +3188,26 @@ axes.drawLabels = function(gd, ax, opts) { }); } + var anchorAx = ax._anchorAxis; + if( + anchorAx && anchorAx.autorange && + (ax.ticklabelposition || '').indexOf('inside') !== -1 + ) { + if(!fullLayout._insideTickLabelsAutorange) { + fullLayout._insideTickLabelsAutorange = {}; + } + fullLayout._insideTickLabelsAutorange[anchorAx._name + '.autorange'] = anchorAx.autorange; + + seq.push( + function computeFinalTickLabelBoundingBoxes() { + tickLabels.each(function(d, i) { + var thisLabel = selectTickLabel(this); + ax._vals[i].bb = Drawing.bBox(thisLabel.node()); + }); + } + ); + } + var done = Lib.syncOrAsync(seq); if(done && done.then) gd._promises.push(done); return done; diff --git a/src/plots/cartesian/axis_autotype.js b/src/plots/cartesian/axis_autotype.js index 2cfd9707013..de9e8045512 100644 --- a/src/plots/cartesian/axis_autotype.js +++ b/src/plots/cartesian/axis_autotype.js @@ -14,23 +14,49 @@ var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); var BADNUM = require('../../constants/numerical').BADNUM; +var isArrayOrTypedArray = Lib.isArrayOrTypedArray; +var isDateTime = Lib.isDateTime; +var cleanNumber = Lib.cleanNumber; +var round = Math.round; + module.exports = function autoType(array, calendar, opts) { - opts = opts || {}; + var a = array; + + var noMultiCategory = opts.noMultiCategory; + if(isArrayOrTypedArray(a) && !a.length) return '-'; + if(!noMultiCategory && multiCategory(a)) return 'multicategory'; + if(noMultiCategory && Array.isArray(a[0])) { // no need to flat typed arrays here + var b = []; + for(var i = 0; i < a.length; i++) { + if(isArrayOrTypedArray(a[i])) { + for(var j = 0; j < a[i].length; j++) { + b.push(a[i][j]); + } + } + } + a = b; + } + + if(moreDates(a, calendar)) return 'date'; - if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory'; - if(moreDates(array, calendar)) return 'date'; - if(category(array)) return 'category'; - if(linearOK(array)) return 'linear'; - else return '-'; + var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts + if(category(a, convertNumeric)) return 'category'; + if(linearOK(a, convertNumeric)) return 'linear'; + + return '-'; }; +function hasTypeNumber(v, convertNumeric) { + return convertNumeric ? isNumeric(v) : typeof v === 'number'; +} + // is there at least one number in array? If not, we should leave // ax.type empty so it can be autoset later -function linearOK(array) { - if(!array) return false; +function linearOK(a, convertNumeric) { + var len = a.length; - for(var i = 0; i < array.length; i++) { - if(isNumeric(array[i])) return true; + for(var i = 0; i < len; i++) { + if(hasTypeNumber(a[i], convertNumeric)) return true; } return false; @@ -43,51 +69,61 @@ function linearOK(array) { // numbers and a few dates // as with categories, consider DISTINCT values only. function moreDates(a, calendar) { - // test at most 1000 points, evenly spaced - var inc = Math.max(1, (a.length - 1) / 1000); - var dcnt = 0; - var ncnt = 0; + var len = a.length; + + var inc = getIncrement(len); + var dats = 0; + var nums = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(Lib.isDateTime(ai, calendar)) dcnt += 1; - if(isNumeric(ai)) ncnt += 1; + if(isDateTime(ai, calendar)) dats++; + if(isNumeric(ai)) nums++; } - return (dcnt > ncnt * 2); + return dats > nums * 2; +} + +// return increment to test at most 1000 points, evenly spaced +function getIncrement(len) { + return Math.max(1, (len - 1) / 1000); } // are the (x,y)-values in gd.data mostly text? // require twice as many DISTINCT categories as distinct numbers -function category(a) { - // test at most 1000 points - var inc = Math.max(1, (a.length - 1) / 1000); - var curvenums = 0; - var curvecats = 0; +function category(a, convertNumeric) { + var len = a.length; + + var inc = getIncrement(len); + var nums = 0; + var cats = 0; var seen = {}; - for(var i = 0; i < a.length; i += inc) { - var ai = a[Math.round(i)]; + for(var f = 0; f < len; f += inc) { + var i = round(f); + var ai = a[i]; var stri = String(ai); if(seen[stri]) continue; seen[stri] = 1; - if(typeof ai === 'boolean') curvecats++; - else if(Lib.cleanNumber(ai) !== BADNUM) curvenums++; - else if(typeof ai === 'string') curvecats++; + var t = typeof ai; + if(t === 'boolean') cats++; + else if(convertNumeric ? cleanNumber(ai) !== BADNUM : t === 'number') nums++; + else if(t === 'string') cats++; } - return curvecats > curvenums * 2; + return cats > nums * 2; } // very-loose requirements for multicategory, // trace modules that should never auto-type to multicategory // should be declared with 'noMultiCategory' function multiCategory(a) { - return Lib.isArrayOrTypedArray(a[0]) && Lib.isArrayOrTypedArray(a[1]); + return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } diff --git a/src/plots/cartesian/axis_defaults.js b/src/plots/cartesian/axis_defaults.js index 667ecda5c7f..350f3bbdb78 100644 --- a/src/plots/cartesian/axis_defaults.js +++ b/src/plots/cartesian/axis_defaults.js @@ -54,9 +54,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || '-'; + var ticklabelmode; if(axType === 'date') { var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleDefaults'); handleCalendarDefaults(containerIn, containerOut, 'calendar', options.calendar); + + if(!options.noTicklabelmode) { + ticklabelmode = coerce('ticklabelmode'); + } + } + + if(!options.noTicklabelposition || axType === 'multicategory') { + Lib.coerce(containerIn, containerOut, { + ticklabelposition: { + valType: 'enumerated', + dflt: 'outside', + values: ticklabelmode === 'period' ? ['outside', 'inside'] : + letter === 'x' ? [ + 'outside', 'inside', + 'outside left', 'inside left', + 'outside right', 'inside right' + ] : [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside bottom', 'inside bottom' + ] + } + }, 'ticklabelposition'); } setConvert(containerOut, layoutOut); @@ -114,7 +138,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, ) { var ticksonDflt; if(isMultiCategory) ticksonDflt = 'boundaries'; - coerce('tickson', ticksonDflt); + var tickson = coerce('tickson', ticksonDflt); + if(tickson === 'boundaries') { + delete containerOut.ticklabelposition; + } } if(isMultiCategory) { @@ -126,8 +153,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, } if(axType === 'date') { - if(!options.noTicklabelmode) coerce('ticklabelmode'); - handleArrayContainerDefaults(containerIn, containerOut, { name: 'rangebreaks', inclusionAttr: 'enabled', diff --git a/src/plots/cartesian/axis_ids.js b/src/plots/cartesian/axis_ids.js index 5306b32452d..db2c3705275 100644 --- a/src/plots/cartesian/axis_ids.js +++ b/src/plots/cartesian/axis_ids.js @@ -18,7 +18,7 @@ var constants = require('./constants'); // completely in favor of just 'x' if it weren't ingrained in the API etc. exports.id2name = function id2name(id) { if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; - var axNum = id.substr(1); + var axNum = id.split(' ')[0].substr(1); if(axNum === '1') axNum = ''; return id.charAt(0) + 'axis' + axNum; }; @@ -30,13 +30,20 @@ exports.name2id = function name2id(name) { return name.charAt(0) + axNum; }; -exports.cleanId = function cleanId(id, axLetter) { +/* + * Cleans up the number of an axis, e.g., 'x002'->'x2', 'x0'->'x', 'x1' -> 'x', + * etc. + * If domainId is true, then id could be a domain reference and if it is, the + * ' domain' part is kept at the end of the axis ID string. + */ +exports.cleanId = function cleanId(id, axLetter, domainId) { + var domainTest = /( domain)$/.test(id); if(typeof id !== 'string' || !id.match(constants.AX_ID_PATTERN)) return; if(axLetter && id.charAt(0) !== axLetter) return; - - var axNum = id.substr(1).replace(/^0+/, ''); + if(domainTest && (!domainId)) return; + var axNum = id.split(' ')[0].substr(1).replace(/^0+/, ''); if(axNum === '1') axNum = ''; - return id.charAt(0) + axNum; + return id.charAt(0) + axNum + (domainTest && domainId ? ' domain' : ''); }; // get all axis objects, as restricted in listNames @@ -82,6 +89,8 @@ exports.listIds = function(gd, axLetter) { // optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it exports.getFromId = function(gd, id, type) { var fullLayout = gd._fullLayout; + // remove "domain" suffix + id = ((id === undefined) || (typeof(id) !== 'string')) ? id : id.replace(' domain', ''); if(type === 'x') id = id.replace(/y[0-9]*/, ''); else if(type === 'y') id = id.replace(/x[0-9]*/, ''); @@ -114,12 +123,16 @@ exports.idSort = function(id1, id2) { return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; -exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { - var matchGroups = fullLayout._axisMatchGroups; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) return 'g' + i; - } - return axId; +/* + * An axis reference (e.g., the contents at the 'xref' key of an object) might + * have extra information appended. Extract the axis ID only. + * + * ar: the axis reference string + * + */ +exports.ref2id = function(ar) { + // This assumes ar has been coerced via coerceRef, and uses the shortcut of + // checking if the first letter matches [xyz] to determine if it should + // return the axis ID. Otherwise it returns false. + return (/^[xyz]/.test(ar)) ? ar.split(' ')[0] : false; }; diff --git a/src/plots/cartesian/clean_ticks.js b/src/plots/cartesian/clean_ticks.js index 02cdc1de820..6e88e61828b 100644 --- a/src/plots/cartesian/clean_ticks.js +++ b/src/plots/cartesian/clean_ticks.js @@ -10,7 +10,9 @@ var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); -var ONEDAY = require('../../constants/numerical').ONEDAY; +var constants = require('../../constants/numerical'); +var ONEDAY = constants.ONEDAY; +var ONEWEEK = constants.ONEWEEK; /** * Return a validated dtick value for this axis @@ -75,7 +77,9 @@ exports.dtick = function(dtick, axType) { */ exports.tick0 = function(tick0, axType, calendar, dtick) { if(axType === 'date') { - return Lib.cleanDate(tick0, Lib.dateTick0(calendar)); + return Lib.cleanDate(tick0, + Lib.dateTick0(calendar, (dtick % ONEWEEK === 0) ? 1 : 0) + ); } if(dtick === 'D1' || dtick === 'D2') { // D1 and D2 modes ignore tick0 entirely diff --git a/src/plots/cartesian/constants.js b/src/plots/cartesian/constants.js index 98ef0bc9f18..c6a523fe2df 100644 --- a/src/plots/cartesian/constants.js +++ b/src/plots/cartesian/constants.js @@ -12,8 +12,8 @@ var counterRegex = require('../../lib/regex').counter; module.exports = { idRegex: { - x: counterRegex('x'), - y: counterRegex('y') + x: counterRegex('x', '( domain)?'), + y: counterRegex('y', '( domain)?') }, attrRegex: counterRegex('[xy]axis'), @@ -25,7 +25,7 @@ module.exports = { // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc - AX_ID_PATTERN: /^[xyz][0-9]*$/, + AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots diff --git a/src/plots/cartesian/constraints.js b/src/plots/cartesian/constraints.js index d3c0c138152..90ead3b020c 100644 --- a/src/plots/cartesian/constraints.js +++ b/src/plots/cartesian/constraints.js @@ -9,74 +9,280 @@ 'use strict'; var Lib = require('../../lib'); + +var autorange = require('./autorange'); var id2name = require('./axis_ids').id2name; +var layoutAttributes = require('./layout_attributes'); var scaleZoom = require('./scale_zoom'); -var makePadFn = require('./autorange').makePadFn; -var concatExtremes = require('./autorange').concatExtremes; +var setConvert = require('./set_convert'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; var FROM_BL = require('../../constants/alignment').FROM_BL; -exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, opts) { - var allAxisIds = opts.allAxisIds; +exports.handleDefaults = function(layoutIn, layoutOut, opts) { + var axIds = opts.axIds; + var axHasImage = opts.axHasImage; + + // sets of axes linked by `scaleanchor` OR `matches` along with the + // scaleratios compounded together, populated in handleConstraintDefaults + var constraintGroups = layoutOut._axisConstraintGroups = []; + // similar to _axisConstraintGroups, but only matching axes + var matchGroups = layoutOut._axisMatchGroups = []; + + var i, group, axId, axName, axIn, axOut, attr, val; + + for(i = 0; i < axIds.length; i++) { + axName = id2name(axIds[i]); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + + handleOneAxDefaults(axIn, axOut, { + axIds: axIds, + layoutOut: layoutOut, + hasImage: axHasImage[axName] + }); + } + + // save matchGroup on each matching axis + function stash(groups, stashAttr) { + for(i = 0; i < groups.length; i++) { + group = groups[i]; + for(axId in group) { + layoutOut[id2name(axId)][stashAttr] = group; + } + } + } + stash(matchGroups, '_matchGroup'); + + // If any axis in a constraint group is fixedrange, they all get fixed + // This covers matches axes, as they're now in the constraintgroup too + // and have not yet been removed (if the group is *only* matching) + for(i = 0; i < constraintGroups.length; i++) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut.fixedrange) { + for(var axId2 in group) { + var axName2 = id2name(axId2); + if((layoutIn[axName2] || {}).fixedrange === false) { + Lib.warn( + 'fixedrange was specified as false for axis ' + + axName2 + ' but was overridden because another ' + + 'axis in its constraint group has fixedrange true' + ); + } + layoutOut[axName2].fixedrange = true; + } + break; + } + } + } + + // remove constraint groups that simply duplicate match groups + i = 0; + while(i < constraintGroups.length) { + group = constraintGroups[i]; + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + if(axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { + constraintGroups.splice(i, 1); + i--; + } + break; + } + i++; + } + + // save constraintGroup on each constrained axis + stash(constraintGroups, '_constraintGroup'); + + // make sure `matching` axes share values of necessary attributes + // Precedence (base axis is the one that doesn't list a `matches`, ie others + // all point to it): + // (1) explicitly defined value in the base axis + // (2) explicitly defined in another axis (arbitrary order) + // (3) default in the base axis + var matchAttrs = [ + 'constrain', + 'range', + 'autorange', + 'rangemode', + 'rangebreaks', + 'categoryorder', + 'categoryarray' + ]; + var hasRange = false; + var hasDayOfWeekBreaks = false; + + function setAttrVal() { + val = axOut[attr]; + if(attr === 'rangebreaks') { + hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; + } + } + + for(i = 0; i < matchGroups.length; i++) { + group = matchGroups[i]; + + // find 'matching' range attrs + for(var j = 0; j < matchAttrs.length; j++) { + attr = matchAttrs[j]; + val = null; + var baseAx; + for(axId in group) { + axName = id2name(axId); + axIn = layoutIn[axName]; + axOut = layoutOut[axName]; + if(!(attr in axOut)) { + continue; + } + if(!axOut.matches) { + baseAx = axOut; + // top priority: explicit value in base axis + if(attr in axIn) { + setAttrVal(); + break; + } + } + if(val === null && attr in axIn) { + // second priority: first explicit value in another axis + setAttrVal(); + } + } + + // special logic for coupling of range and autorange + // if nobody explicitly specifies autorange, but someone does + // explicitly specify range, autorange must be disabled. + if(attr === 'range' && val) { + hasRange = true; + } + if(attr === 'autorange' && val === null && hasRange) { + val = false; + } + + if(val === null && attr in baseAx) { + // fallback: default value in base axis + val = baseAx[attr]; + } + // but we still might not have a value, which is fine. + if(val !== null) { + for(axId in group) { + axOut = layoutOut[id2name(axId)]; + axOut[attr] = attr === 'range' ? val.slice() : val; + + if(attr === 'rangebreaks') { + axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; + setConvert(axOut, layoutOut); + } + } + } + } + } +}; + +function handleOneAxDefaults(axIn, axOut, opts) { + var axIds = opts.axIds; var layoutOut = opts.layoutOut; - var scaleanchorDflt = opts.scaleanchorDflt; - var constrainDflt = opts.constrainDflt; + var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; - var axId = containerOut._id; + var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; - var thisID = containerOut._id; - var letter = thisID.charAt(0); + var thisID = axOut._id; + var isX = thisID.charAt(0) === 'x'; + + // Clear _matchGroup & _constraintGroup so relinkPrivateKeys doesn't keep + // an old one around. If this axis is in a group we'll set this again later + axOut._matchGroup = null; + axOut._constraintGroup = null; + + function coerce(attr, dflt) { + return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); + } // coerce the constraint mechanics even if this axis has no scaleanchor // because it may be the anchor of another axis. - var constrain = coerce('constrain', constrainDflt); - Lib.coerce(containerIn, containerOut, { + coerce('constrain', hasImage ? 'domain' : 'range'); + Lib.coerce(axIn, axOut, { constraintoward: { valType: 'enumerated', - values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], - dflt: letter === 'x' ? 'center' : 'middle' + values: isX ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: isX ? 'center' : 'middle' } }, 'constraintoward'); - var matches, matchOpts; + // If this axis is already part of a constraint group, we can't + // scaleanchor any other axis in that group, or we'd make a loop. + // Filter axIds to enforce this, also matching axis types. + var thisType = axOut.type; + var i, idi; - if((containerIn.matches || splomStash.matches) && !containerOut.fixedrange) { - matchOpts = getConstraintOpts(matchGroups, thisID, allAxisIds, layoutOut); - matches = Lib.coerce(containerIn, containerOut, { + var linkableAxes = []; + for(i = 0; i < axIds.length; i++) { + idi = axIds[i]; + if(idi === thisID) continue; + + var axi = layoutOut[id2name(idi)]; + if(axi.type === thisType) { + linkableAxes.push(idi); + } + } + + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup) { + var linkableAxesNoLoops = []; + for(i = 0; i < linkableAxes.length; i++) { + idi = linkableAxes[i]; + if(!thisGroup[idi]) linkableAxesNoLoops.push(idi); + } + linkableAxes = linkableAxesNoLoops; + } + + var canLink = linkableAxes.length; + + var matches, scaleanchor; + + if(canLink && (axIn.matches || splomStash.matches)) { + matches = Lib.coerce(axIn, axOut, { matches: { valType: 'enumerated', - values: matchOpts.linkableAxes || [], - dflt: splomStash.matches + values: linkableAxes, + dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : undefined } }, 'matches'); } - // 'matches' wins over 'scaleanchor' (for now) - var scaleanchor, scaleOpts; - - if(!matches && - !(containerOut.fixedrange && constrain !== 'domain') && - (containerIn.scaleanchor || scaleanchorDflt) - ) { - scaleOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut, constrain); - scaleanchor = Lib.coerce(containerIn, containerOut, { + // 'matches' wins over 'scaleanchor' - each axis can only specify one + // constraint, but you can chain matches and scaleanchor constraints by + // specifying them in separate axes. + var scaleanchorDflt = hasImage && !isX ? axOut.anchor : undefined; + if(canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { + scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: 'enumerated', - values: scaleOpts.linkableAxes || [] + values: linkableAxes } }, 'scaleanchor', scaleanchorDflt); } if(matches) { - delete containerOut.constrain; - updateConstraintGroups(matchGroups, matchOpts.thisGroup, thisID, matches, 1); - } else if(allAxisIds.indexOf(containerIn.matches) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.matches: "' + - containerIn.matches + '" to avoid either an infinite loop ' + - 'or because the target axis has fixed range.'); + axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); + + // Also include match constraints in the scale groups + var matchedAx = layoutOut[id2name(matches)]; + var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); + if(isX !== (matches.charAt(0) === 'x')) { + // We don't yet know the actual scale ratio of x/y matches constraints, + // due to possible automargins, so just leave a placeholder for this: + // 'x' means "x size over y size", 'y' means the inverse. + // in principle in the constraint group you could get multiple of these. + matchRatio = (isX ? 'x' : 'y') + matchRatio; + } + updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); + } else if(axIn.matches && axIds.indexOf(axIn.matches) !== -1) { + Lib.warn('ignored ' + axOut._name + '.matches: "' + + axIn.matches + '" to avoid an infinite loop'); } if(scaleanchor) { @@ -87,64 +293,39 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, o // Of course if you use several super-tiny values you could eventually // force a product of these to zero and all hell would break loose... // Likewise with super-huge values. - if(!scaleratio) scaleratio = containerOut.scaleratio = 1; - - updateConstraintGroups(constraintGroups, scaleOpts.thisGroup, thisID, scaleanchor, scaleratio); - } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { - Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + - containerIn.scaleanchor + '" to avoid either an infinite loop ' + - 'and possibly inconsistent scaleratios, or because the target ' + - 'axis has fixed range or this axis declares a *matches* constraint.'); + if(!scaleratio) scaleratio = axOut.scaleratio = 1; + + updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); + } else if(axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { + Lib.warn('ignored ' + axOut._name + '.scaleanchor: "' + + axIn.scaleanchor + '" to avoid either an infinite loop ' + + 'and possibly inconsistent scaleratios, or because this axis ' + + 'declares a *matches* constraint.'); } -}; - -// If this axis is already part of a constraint group, we can't -// scaleanchor any other axis in that group, or we'd make a loop. -// Filter allAxisIds to enforce this, also matching axis types. -function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { - var doesNotConstrainRange = constrain !== 'range'; - var thisType = layoutOut[id2name(thisID)].type; - var i, j, idj, axj; +} - var linkableAxes = []; - for(j = 0; j < allAxisIds.length; j++) { - idj = allAxisIds[j]; - if(idj === thisID) continue; - - axj = layoutOut[id2name(idj)]; - if(axj.type === thisType) { - if(!axj.fixedrange) { - linkableAxes.push(idj); - } else if(doesNotConstrainRange && axj.anchor) { - // allow domain constraints on subplots where - // BOTH axes have fixedrange:true and constrain:domain - var counterAxj = layoutOut[id2name(axj.anchor)]; - if(counterAxj.fixedrange) { - linkableAxes.push(idj); - } - } - } +function extent(layoutOut, ax) { + var domain = ax.domain; + if(!domain) { + // at this point overlaying axes haven't yet inherited their main domains + // TODO: constrain: domain with overlaying axes is likely a bug. + domain = layoutOut[id2name(ax.overlaying)].domain; } + return domain[1] - domain[0]; +} - for(i = 0; i < groups.length; i++) { +function getConstraintGroup(groups, thisID) { + for(var i = 0; i < groups.length; i++) { if(groups[i][thisID]) { - var thisGroup = groups[i]; - - var linkableAxesNoLoops = []; - for(j = 0; j < linkableAxes.length; j++) { - idj = linkableAxes[j]; - if(!thisGroup[idj]) linkableAxesNoLoops.push(idj); - } - return {linkableAxes: linkableAxesNoLoops, thisGroup: thisGroup}; + return groups[i]; } } - - return {linkableAxes: linkableAxes, thisGroup: null}; + return null; } /* * Add this axis to the axis constraint groups, which is the collection - * of axes that are all constrained together on scale. + * of axes that are all constrained together on scale (or matching). * * constraintGroups: a list of objects. each object is * {axis_id: scale_within_group}, where scale_within_group is @@ -153,12 +334,14 @@ function getConstraintOpts(groups, thisID, allAxisIds, layoutOut, constrain) { * * thisGroup: the group the current axis is already in * thisID: the id if the current axis - * scaleanchor: the id of the axis to scale it with - * scaleratio: the ratio of this axis to the scaleanchor axis + * thatID: the id of the axis to scale it with + * scaleratio: the ratio of this axis to the thatID axis */ -function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor, scaleratio) { +function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; + var thisGroup = getConstraintGroup(constraintGroups, thisID); + if(thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; @@ -171,38 +354,109 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor var thisGroupKeys = Object.keys(thisGroup); // we know that this axis isn't in any other groups, but we don't know - // about the scaleanchor axis. If it is, we need to merge the groups. + // about the thatID axis. If it is, we need to merge the groups. for(i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; - if(i !== thisGroupIndex && groupi[scaleanchor]) { - var baseScale = groupi[scaleanchor]; + if(i !== thisGroupIndex && groupi[thatID]) { + var baseScale = groupi[thatID]; for(j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; - groupi[keyj] = baseScale * scaleratio * thisGroup[keyj]; + groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } - // otherwise, we insert the new scaleanchor axis as the base scale (1) + // otherwise, we insert the new thatID axis as the base scale (1) // in its group, and scale the rest of the group to it if(scaleratio !== 1) { for(j = 0; j < thisGroupKeys.length; j++) { - thisGroup[thisGroupKeys[j]] *= scaleratio; + var key = thisGroupKeys[j]; + thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); } } - thisGroup[scaleanchor] = 1; + thisGroup[thatID] = 1; +} + +// scales may be numbers or 'x1.3', 'yy4.5' etc to multiply by as-yet-unknown +// ratios between x and y plot sizes n times +function multiplyScales(a, b) { + var aPrefix = ''; + var bPrefix = ''; + var aLen, bLen; + + if(typeof a === 'string') { + aPrefix = a.match(/^[xy]*/)[0]; + aLen = aPrefix.length; + a = +a.substr(aLen); + } + + if(typeof b === 'string') { + bPrefix = b.match(/^[xy]*/)[0]; + bLen = bPrefix.length; + b = +b.substr(bLen); + } + + var c = a * b; + + // just two numbers + if(!aLen && !bLen) { + return c; + } + + // one or more prefixes of the same type + if(!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { + return aPrefix + bPrefix + (a * b); + } + + // x and y cancel each other out exactly - back to a number + if(aLen === bLen) { + return c; + } + + // partial cancelation of prefixes + return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; +} + +function finalRatios(group, fullLayout) { + var size = fullLayout._size; + var yRatio = size.h / size.w; + var out = {}; + var keys = Object.keys(group); + for(var i = 0; i < keys.length; i++) { + var key = keys[i]; + var val = group[key]; + + if(typeof val === 'string') { + var prefix = val.match(/^[xy]*/)[0]; + var pLen = prefix.length; + val = +val.substr(pLen); + var mult = prefix.charAt(0) === 'y' ? yRatio : (1 / yRatio); + for(var j = 0; j < pLen; j++) { + val *= mult; + } + } + + out[key] = val; + } + return out; } exports.enforce = function enforce(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; - var i, j, axisID, ax, normScale, mode, factor; + var i, j, group, axisID, ax, normScale, mode, factor; + // matching constraints are handled in the autorange code when autoranged, + // or in the supplyDefaults code when explicitly ranged. + // now we just need to handle scaleanchor constraints + // matches constraints that chain with scaleanchor constraints are included + // here too, but because matches has already been satisfied, + // any changes here should preserve that. for(i = 0; i < constraintGroups.length; i++) { - var group = constraintGroups[i]; + group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; @@ -311,25 +565,26 @@ exports.enforce = function enforce(gd) { // *are* expanding to the full domain var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; - var getPad = makePadFn(ax); + var getPadMin = autorange.makePadFn(ax, 0); + var getPadMax = autorange.makePadFn(ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); - var extremes = concatExtremes(gd, ax); + var extremes = autorange.concatExtremes(gd, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for(k = 0; k < minArray.length; k++) { - newVal = minArray[k].val - getPad(minArray[k]) / m; + newVal = minArray[k].val - getPadMin(minArray[k]) / m; if(newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for(k = 0; k < maxArray.length; k++) { - newVal = maxArray[k].val + getPad(maxArray[k]) / m; + newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if(newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } @@ -351,6 +606,16 @@ exports.enforce = function enforce(gd) { } }; +exports.getAxisGroup = function getAxisGroup(fullLayout, axId) { + var matchGroups = fullLayout._axisMatchGroups; + + for(var i = 0; i < matchGroups.length; i++) { + var group = matchGroups[i]; + if(group[axId]) return 'g' + i; + } + return axId; +}; + // For use before autoranging, check if this axis was previously constrained // by domain but no longer is exports.clean = function clean(gd, ax) { diff --git a/src/plots/cartesian/dragbox.js b/src/plots/cartesian/dragbox.js index 573362f0047..e4128972f4c 100644 --- a/src/plots/cartesian/dragbox.js +++ b/src/plots/cartesian/dragbox.js @@ -14,6 +14,7 @@ var supportsPassive = require('has-passive-events'); var Registry = require('../../registry'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var svgTextUtils = require('../../lib/svg_text_utils'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); @@ -90,6 +91,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var hasScatterGl, hasSplom, hasSVG; // collected changes to be made to the plot by relayout at the end var updates; + // scaling factors from css transform + var scaleX; + var scaleY; function recomputeAxisLists() { xa0 = plotinfo.xaxis; @@ -121,10 +125,11 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { yActive = isDirectionActive(yaxes, ns); allFixedRanges = !yActive && !xActive; - links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash); matches = calcLinks(gd, gd._fullLayout._axisMatchGroups, xaHash, yaHash); - editX = ew || links.isSubplotConstrained || matches.isSubplotConstrained; - editY = ns || links.isSubplotConstrained || matches.isSubplotConstrained; + links = calcLinks(gd, gd._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); + var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; + editX = ew || spConstrained; + editY = ns || spConstrained; var fullLayout = gd._fullLayout; hasScatterGl = fullLayout._has('scattergl'); @@ -161,6 +166,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { recomputeAxisLists(); + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + if(!allFixedRanges) { if(isMainDrag) { // main dragger handles all drag modes, and changes @@ -326,6 +334,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(gd._fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + box = {l: x0, r: x0, w: 0, t: y0, b: y0, h: 0}; lum = gd._hmpixcount ? (gd._hmlumcount / gd._hmpixcount) : @@ -343,8 +357,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return false; } - var x1 = Math.max(0, Math.min(pw, dx0 + x0)); - var y1 = Math.max(0, Math.min(ph, dy0 + y0)); + var x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + var y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); @@ -544,6 +558,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // plotDrag: move the plot in response to a drag function plotDrag(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; // If a transition is in progress, then disable any behavior: if(gd._transitioningWithDuration) { return; @@ -553,6 +569,22 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { gd._fullLayout._replotting = true; if(xActive === 'ew' || yActive === 'ns') { + var spDx = xActive ? -dx : 0; + var spDy = yActive ? -dy : 0; + if(matches.isSubplotConstrained) { + if(xActive && yActive) { + var frac = (dx / pw - dy / ph) / 2; + dx = frac * pw; + dy = -frac * ph; + spDx = -dx; + spDy = -dy; + } + if(yActive) { + spDx = -spDy * pw / ph; + } else { + spDy = -spDx * ph / pw; + } + } if(xActive) { dragAxList(xaxes, dx); updateMatchedAxRange('x'); @@ -561,7 +593,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dragAxList(yaxes, dy); updateMatchedAxRange('y'); } - updateSubplots([xActive ? -dx : 0, yActive ? -dy : 0, pw, ph]); + updateSubplots([spDx, spDy, pw, ph]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); return; @@ -592,15 +624,17 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { (movedAx._rl[end] - movedAx._rl[otherEnd]); } - if(links.isSubplotConstrained && xActive && yActive) { + var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; + if(xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { // dragging a corner of a constrained subplot: // respect the fixed corner, but harmonize dx and dy - var dxySign = ((xActive === 'w') === (yActive === 'n')) ? 1 : -1; var dxyFraction = (dx / pw + dxySign * dy / ph) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph; } + var xStart, yStart; + if(xActive === 'w') dx = dz(xaxes, 0, dx); else if(xActive === 'e') dx = dz(xaxes, 1, -dx); else if(!xActive) dx = 0; @@ -609,12 +643,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { else if(yActive === 's') dy = dz(yaxes, 0, -dy); else if(!yActive) dy = 0; - var xStart = (xActive === 'w') ? dx : 0; - var yStart = (yActive === 'n') ? dy : 0; + xStart = (xActive === 'w') ? dx : 0; + yStart = (yActive === 'n') ? dy : 0; - if(links.isSubplotConstrained) { + if( + (links.isSubplotConstrained && !matches.isSubplotConstrained) || + // NW or SE on matching axes - create a symmetric zoom + (matches.isSubplotConstrained && xActive && yActive && dxySign > 0) + ) { var i; - if(!xActive && yActive.length === 1) { + if(matches.isSubplotConstrained || (!xActive && yActive.length === 1)) { // dragging one end of the y axis of a constrained subplot // scale the other axis the same about its middle for(i = 0; i < xaxes.length; i++) { @@ -624,7 +662,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { dx = dy * pw / ph; xStart = dx / 2; } - if(!yActive && xActive.length === 1) { + if(matches.isSubplotConstrained || (!yActive && xActive.length === 1)) { for(i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); @@ -634,9 +672,24 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } } - updateMatchedAxRange('x'); - updateMatchedAxRange('y'); - updateSubplots([xStart, yStart, pw - dx, ph - dy]); + if(!matches.isSubplotConstrained || !yActive) { + updateMatchedAxRange('x'); + } + if(!matches.isSubplotConstrained || !xActive) { + updateMatchedAxRange('y'); + } + var xSize = pw - dx; + var ySize = ph - dy; + if(matches.isSubplotConstrained && !(xActive && yActive)) { + if(xActive) { + yStart = xStart ? 0 : (dx * ph / pw); + ySize = xSize * ph / pw; + } else { + xStart = yStart ? 0 : (dy * pw / ph); + xSize = ySize * pw / ph; + } + } + updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd.emit('plotly_relayouting', updates); } @@ -836,15 +889,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { xa = sp.xaxis; ya = sp.yaxis; - var editX2 = editX && !xa.fixedrange && xaHash[xa._id]; - var editY2 = editY && !ya.fixedrange && yaHash[ya._id]; + var editX2 = (editX || matches.isSubplotConstrained) && !xa.fixedrange && xaHash[xa._id]; + var editY2 = (editY || matches.isSubplotConstrained) && !ya.fixedrange && yaHash[ya._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = ew ? viewBox[0] : getShift(xa, xScaleFactor2); + clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa, xScaleFactor2); } else if(matches.xaHash[xa._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa._length / xa0._length; @@ -860,7 +913,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = ns ? viewBox[1] : getShift(ya, yScaleFactor2); + clipDy = ns || matches.isSubplotConstrained ? viewBox[1] : getShift(ya, yScaleFactor2); } else if(matches.yaHash[ya._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya._length / ya0._length; @@ -1072,7 +1125,7 @@ function makeZoombox(zoomlayer, lum, xs, ys, path0) { 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', path0 + 'Z'); } @@ -1085,7 +1138,7 @@ function makeCorners(zoomlayer, xs, ys) { 'stroke-width': 1, opacity: 0 }) - .attr('transform', 'translate(' + xs + ', ' + ys + ')') + .attr('transform', strTranslate(xs, ys)) .attr('d', 'M0,0Z'); } @@ -1150,11 +1203,13 @@ function xyCorners(box) { 'h' + clen + 'v3h-' + (clen + 3) + 'Z'; } -function calcLinks(gd, groups, xaHash, yaHash) { +function calcLinks(gd, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; + var xExclude = (exclude || {}).xaHash; + var yExclude = (exclude || {}).yaHash; for(var i = 0; i < groups.length; i++) { var group = groups[i]; @@ -1165,14 +1220,22 @@ function calcLinks(gd, groups, xaHash, yaHash) { // dragging them, so we know to scale these axes automatically too // to match the changes in the dragged x axes for(xLinkID in group) { - if(!(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID]) { + if( + !(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && + !(xLinkID.charAt(0) === 'x' ? xaHash : yaHash)[xLinkID] + ) { xLinks[xLinkID] = xID; } } // check if the x and y axes of THIS drag are linked for(yID in yaHash) { - if(group[yID]) isSubplotConstrained = true; + if( + !(exclude && (xExclude[yID] || yExclude[yID])) && + group[yID] + ) { + isSubplotConstrained = true; + } } } } @@ -1182,7 +1245,10 @@ function calcLinks(gd, groups, xaHash, yaHash) { for(yID in yaHash) { if(group[yID]) { for(yLinkID in group) { - if(!(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID]) { + if( + !(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && + !(yLinkID.charAt(0) === 'x' ? xaHash : yaHash)[yLinkID] + ) { yLinks[yLinkID] = yID; } } diff --git a/src/plots/cartesian/helpers.js b/src/plots/cartesian/helpers.js index b07c36f0703..30129f19a3b 100644 --- a/src/plots/cartesian/helpers.js +++ b/src/plots/cartesian/helpers.js @@ -9,6 +9,8 @@ 'use strict'; +var strTranslate = require('../../lib').strTranslate; + // in v2 (once log ranges are fixed), // we'll be able to p2r here for all axis types function p2r(ax, v) { @@ -39,9 +41,10 @@ function axValue(ax) { } function getTransform(plotinfo) { - return 'translate(' + - plotinfo.xaxis._offset + ',' + - plotinfo.yaxis._offset + ')'; + return strTranslate( + plotinfo.xaxis._offset, + plotinfo.yaxis._offset + ); } module.exports = { diff --git a/src/plots/cartesian/include_components.js b/src/plots/cartesian/include_components.js index cd817b55464..e8738b42c1d 100644 --- a/src/plots/cartesian/include_components.js +++ b/src/plots/cartesian/include_components.js @@ -11,6 +11,7 @@ var Registry = require('../../registry'); var Lib = require('../../lib'); +var axisIds = require('./axis_ids'); /** * Factory function for checking component arrays for subplot references. @@ -40,8 +41,10 @@ module.exports = function makeIncludeComponents(containerArrayName) { var itemi = array[i]; if(!Lib.isPlainObject(itemi)) continue; - var xref = itemi.xref; - var yref = itemi.yref; + // call cleanId because if xref, or yref has something appended + // (e.g., ' domain') this will get removed. + var xref = axisIds.cleanId(itemi.xref, 'x', false); + var yref = axisIds.cleanId(itemi.yref, 'y', false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); diff --git a/src/plots/cartesian/index.js b/src/plots/cartesian/index.js index 43d8d2c2fdc..6c92547f86e 100644 --- a/src/plots/cartesian/index.js +++ b/src/plots/cartesian/index.js @@ -335,6 +335,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout); oldFullLayout._defs.selectAll('.axesclip').remove(); delete oldFullLayout._axisConstraintGroups; + delete oldFullLayout._axisMatchGroups; } else if(oldSubplotList.cartesian) { // otherwise look for subplots we need to remove diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index 3e732dda964..5e808e148e1 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -102,6 +102,19 @@ module.exports = { 'the axis in question.' ].join(' ') }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + role: 'info', + editType: 'calc', + description: [ + 'Using *strict* a numeric string in trace data is not converted to a number.', + 'Using *convert types* a numeric string in trace data may be', + 'treated as a number during automatic axis `type` detection.', + 'Defaults to layout.autotypenumbers.' + ].join(' ') + }, autorange: { valType: 'enumerated', values: [true, false, 'reversed'], @@ -210,13 +223,13 @@ module.exports = { constrain: { valType: 'enumerated', values: ['range', 'domain'], - dflt: 'range', role: 'info', editType: 'plot', description: [ 'If this axis needs to be compressed (either due to its own `scaleanchor` and', '`scaleratio` or those of the other axis), determines how that happens:', - 'by increasing the *range* (default), or by decreasing the *domain*.' + 'by increasing the *range*, or by decreasing the *domain*.', + 'Default is *domain* for axes containing image traces, *range* otherwise.' ].join(' ') }, // constraintoward: not used directly, just put here for reference @@ -492,6 +505,29 @@ module.exports = { 'between ticks.' ].join(' ') }, + // ticklabelposition: not used directly, as values depend on direction (similar to side) + // left/right options are for x axes, and top/bottom options are for y axes + ticklabelposition: { + valType: 'enumerated', + values: [ + 'outside', 'inside', + 'outside top', 'inside top', + 'outside left', 'inside left', + 'outside right', 'inside right', + 'outside bottom', 'inside bottom' + ], + dflt: 'outside', + role: 'info', + editType: 'calc', + description: [ + 'Determines where tick labels are drawn with respect to the axis', + 'Please note that', + 'top or bottom has no effect on x axes or when `ticklabelmode` is set to *period*.', + 'Similarly', + 'left or right has no effect on y axes or when `ticklabelmode` is set to *period*.', + 'Has no effect on *multicategory* axes or when `tickson` is set to *boundaries*.' + ].join(' ') + }, mirror: { valType: 'enumerated', values: [true, 'ticks', false, 'all', 'allticks'], @@ -680,6 +716,17 @@ module.exports = { 'If *B*, 1B.' ].join(' ') }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + role: 'style', + editType: 'ticks', + description: [ + 'Hide SI prefix for 10^n if |n| is below this number.', + 'This only has an effect when `tickformat` is *SI* or *B*.' + ].join(' ') + }, separatethousands: { valType: 'boolean', dflt: false, diff --git a/src/plots/cartesian/layout_defaults.js b/src/plots/cartesian/layout_defaults.js index 3e411ae0574..bc43f6fcde4 100644 --- a/src/plots/cartesian/layout_defaults.js +++ b/src/plots/cartesian/layout_defaults.js @@ -19,7 +19,7 @@ var basePlotLayoutAttributes = require('../layout_attributes'); var layoutAttributes = require('./layout_attributes'); var handleTypeDefaults = require('./type_defaults'); var handleAxisDefaults = require('./axis_defaults'); -var handleConstraintDefaults = require('./constraints').handleConstraintDefaults; +var constraints = require('./constraints'); var handlePositionDefaults = require('./position_defaults'); var axisIds = require('./axis_ids'); @@ -38,6 +38,8 @@ function appendList(cont, k, item) { } module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { + var autotypenumbersDflt = layoutOut.autotypenumbers; + var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; @@ -246,6 +248,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: visibleDflt, reverseDflt: reverseDflt, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -310,6 +313,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { automargin: true, visibleDflt: false, reverseDflt: false, + autotypenumbersDflt: autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; @@ -374,96 +378,8 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { // We need to do this after all axes have coerced both `type` // (so we link only axes of the same type) and // `fixedrange` (so we can avoid linking from OR TO a fixed axis). - - // sets of axes linked by `scaleanchor` along with the scaleratios compounded - // together, populated in handleConstraintDefaults - var constraintGroups = layoutOut._axisConstraintGroups = []; - // similar to _axisConstraintGroups, but for matching axes - var matchGroups = layoutOut._axisMatchGroups = []; - // make sure to include 'missing' axes here - var allAxisIdsIncludingMissing = allAxisIds.concat(missingMatchedAxisIds); - var axNamesIncludingMissing = axNames.concat(Lib.simpleMap(missingMatchedAxisIds, id2name)); - - for(i = 0; i < axNamesIncludingMissing.length; i++) { - axName = axNamesIncludingMissing[i]; - axLetter = axName.charAt(0); - axLayoutIn = layoutIn[axName]; - axLayoutOut = layoutOut[axName]; - - var scaleanchorDflt; - if(axLetter === 'y' && !axLayoutIn.hasOwnProperty('scaleanchor') && axHasImage[axName]) { - scaleanchorDflt = axLayoutOut.anchor; - } else { - scaleanchorDflt = undefined; - } - - var constrainDflt; - if(!axLayoutIn.hasOwnProperty('constrain') && axHasImage[axName]) { - constrainDflt = 'domain'; - } else { - constrainDflt = undefined; - } - - handleConstraintDefaults(axLayoutIn, axLayoutOut, coerce, { - allAxisIds: allAxisIdsIncludingMissing, - layoutOut: layoutOut, - scaleanchorDflt: scaleanchorDflt, - constrainDflt: constrainDflt - }); - } - - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - var rng = null; - var autorange = null; - - // find 'matching' range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(!axLayoutOut.matches) { - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - } - } - // if `ax.matches` values are reciprocal, - // pick values of first axis in group - if(rng === null || autorange === null) { - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - rng = axLayoutOut.range; - autorange = axLayoutOut.autorange; - break; - } - } - // apply matching range attrs - for(axId in group) { - axLayoutOut = layoutOut[id2name(axId)]; - if(axLayoutOut.matches) { - axLayoutOut.range = rng.slice(); - axLayoutOut.autorange = autorange; - } - axLayoutOut._matchGroup = group; - } - - // remove matching axis from scaleanchor constraint groups (for now) - if(constraintGroups.length) { - for(axId in group) { - for(j = 0; j < constraintGroups.length; j++) { - var group2 = constraintGroups[j]; - for(var axId2 in group2) { - if(axId === axId2) { - Lib.warn('Axis ' + axId2 + ' is set with both ' + - 'a *scaleanchor* and *matches* constraint; ' + - 'ignoring the scale constraint.'); - - delete group2[axId2]; - if(Object.keys(group2).length < 2) { - constraintGroups.splice(j, 1); - } - } - } - } - } - } - } + constraints.handleDefaults(layoutIn, layoutOut, { + axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), + axHasImage: axHasImage + }); }; diff --git a/src/plots/cartesian/scale_zoom.js b/src/plots/cartesian/scale_zoom.js index 3cdc8b4495f..db6fbfad9a4 100644 --- a/src/plots/cartesian/scale_zoom.js +++ b/src/plots/cartesian/scale_zoom.js @@ -23,4 +23,5 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; + ax.setScale(); }; diff --git a/src/plots/cartesian/select.js b/src/plots/cartesian/select.js index a61bbbcb23c..72156ea80f5 100644 --- a/src/plots/cartesian/select.js +++ b/src/plots/cartesian/select.js @@ -67,6 +67,14 @@ function prepSelect(e, startX, startY, dragOptions, mode) { var transform = getTransform(plotinfo); var x0 = startX - dragBBox.left; var y0 = startY - dragBBox.top; + + fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + var scaleX = fullLayout._invScaleX; + var scaleY = fullLayout._invScaleY; + var x1 = x0; var y1 = y0; var path0 = 'M' + x0 + ',' + y0; @@ -156,8 +164,8 @@ function prepSelect(e, startX, startY, dragOptions, mode) { } dragOptions.moveFn = function(dx0, dy0) { - x1 = Math.max(0, Math.min(pw, dx0 + x0)); - y1 = Math.max(0, Math.min(ph, dy0 + y0)); + x1 = Math.max(0, Math.min(pw, scaleX * dx0 + x0)); + y1 = Math.max(0, Math.min(ph, scaleY * dy0 + y0)); var dx = Math.abs(x1 - x0); var dy = Math.abs(y1 - y0); diff --git a/src/plots/cartesian/set_convert.js b/src/plots/cartesian/set_convert.js index 1100cef9340..5d55e06fd73 100644 --- a/src/plots/cartesian/set_convert.js +++ b/src/plots/cartesian/set_convert.js @@ -30,7 +30,6 @@ var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = require('./axis_ids'); - var constants = require('./constants'); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; @@ -186,6 +185,10 @@ module.exports = function setConvert(ax, fullLayout) { if(isNumeric(v)) return +v; } + function getRangePosition(v) { + return isNumeric(v) ? +v : getCategoryIndex(v); + } + // include 2 fractional digits on pixel, for PDF zooming etc function _l2p(v, m, b) { return d3.round(b + m * v, 2); } @@ -317,12 +320,12 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { - var index = getCategoryPosition(v); + var index = getRangePosition(v); return index !== undefined ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; - ax.r2l = getCategoryPosition; + ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; @@ -365,17 +368,12 @@ module.exports = function setConvert(ax, fullLayout) { var traceIndices = ax._traceIndices; var i, j; - var matchGroups = fullLayout._axisMatchGroups; - if(matchGroups && matchGroups.length && ax._categories.length === 0) { - for(i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - if(group[axId]) { - for(var axId2 in group) { - if(axId2 !== axId) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - traceIndices = traceIndices.concat(ax2._traceIndices); - } - } + var group = ax._matchGroup; + if(group && ax._categories.length === 0) { + for(var axId2 in group) { + if(axId2 !== axId) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + traceIndices = traceIndices.concat(ax2._traceIndices); } } } @@ -879,38 +877,26 @@ module.exports = function setConvert(ax, fullLayout) { // should skip if not category nor multicategory ax.clearCalc = function() { - var matchGroups = fullLayout._axisMatchGroups; - - if(matchGroups && matchGroups.length) { - var found = false; - - for(var i = 0; i < matchGroups.length; i++) { - var group = matchGroups[i]; - - if(group[axId]) { - found = true; - var categories = null; - var categoriesMap = null; - - for(var axId2 in group) { - var ax2 = fullLayout[axisIds.id2name(axId2)]; - if(ax2._categories) { - categories = ax2._categories; - categoriesMap = ax2._categoriesMap; - break; - } - } - - if(categories && categoriesMap) { - ax._categories = categories; - ax._categoriesMap = categoriesMap; - } else { - ax._emptyCategories(); - } + var group = ax._matchGroup; + if(group) { + var categories = null; + var categoriesMap = null; + + for(var axId2 in group) { + var ax2 = fullLayout[axisIds.id2name(axId2)]; + if(ax2._categories) { + categories = ax2._categories; + categoriesMap = ax2._categoriesMap; break; } } - if(!found) ax._emptyCategories(); + + if(categories && categoriesMap) { + ax._categories = categories; + ax._categoriesMap = categoriesMap; + } else { + ax._emptyCategories(); + } } else { ax._emptyCategories(); } diff --git a/src/plots/cartesian/tick_label_defaults.js b/src/plots/cartesian/tick_label_defaults.js index ad3a1d166a1..5b451d3455a 100644 --- a/src/plots/cartesian/tick_label_defaults.js +++ b/src/plots/cartesian/tick_label_defaults.js @@ -10,6 +10,7 @@ 'use strict'; var Lib = require('../../lib'); +var contrast = require('../../components/color').contrast; var layoutAttributes = require('./layout_attributes'); var handleArrayContainerDefaults = require('../array_container_defaults'); @@ -46,10 +47,14 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(showTickLabels) { var font = options.font || {}; var contColor = containerOut.color; - // as with titlefont.color, inherit axis.color only if one was - // explicitly provided - var dfltFontColor = (contColor && contColor !== layoutAttributes.color.dflt) ? + var position = containerOut.ticklabelposition || ''; + var dfltFontColor = position.indexOf('inside') !== -1 ? + contrast(options.bgColor) : + // as with titlefont.color, inherit axis.color only if one was + // explicitly provided + (contColor && contColor !== layoutAttributes.color.dflt) ? contColor : font.color; + Lib.coerceFont(coerce, 'tickfont', { family: font.family, size: font.size, @@ -72,6 +77,7 @@ function handleOtherDefaults(containerIn, containerOut, coerce, axType, options) if(!tickFormat && axType !== 'date') { coerce('showexponent', showAttrDflt); coerce('exponentformat'); + coerce('minexponent'); coerce('separatethousands'); } } diff --git a/src/plots/cartesian/type_defaults.js b/src/plots/cartesian/type_defaults.js index f9d73cd3663..80a6933cee4 100644 --- a/src/plots/cartesian/type_defaults.js +++ b/src/plots/cartesian/type_defaults.js @@ -16,6 +16,7 @@ var autoType = require('./axis_autotype'); * name: axis object name (ie 'xaxis') if one should be stored */ module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type', (options.splomStash || {}).type); if(axType === '-') { @@ -68,6 +69,8 @@ function setAutoType(ax, data) { opts.noMultiCategory = true; } + opts.autotypenumbers = ax.autotypenumbers; + // check all boxes on this x axis to see // if they're dates, numbers, or categories if(isBoxWithoutPositionCoords(d0, axLetter)) { diff --git a/src/plots/geo/geo.js b/src/plots/geo/geo.js index 96e33c664d9..ea7a89bc8d4 100644 --- a/src/plots/geo/geo.js +++ b/src/plots/geo/geo.js @@ -14,6 +14,7 @@ var d3 = require('d3'); var Registry = require('../../registry'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var Fx = require('../../components/fx'); @@ -632,7 +633,7 @@ proto.render = function() { function translatePoints(d) { var lonlatPx = projection(d.lonlat); return lonlatPx ? - 'translate(' + lonlatPx[0] + ',' + lonlatPx[1] + ')' : + strTranslate(lonlatPx[0], lonlatPx[1]) : null; } diff --git a/src/plots/gl2d/scene2d.js b/src/plots/gl2d/scene2d.js index 79d6bc48de0..06d5ccd9863 100644 --- a/src/plots/gl2d/scene2d.js +++ b/src/plots/gl2d/scene2d.js @@ -145,11 +145,6 @@ proto.makeFramework = function() { this.updateSize(canvas); - // disabling user select on the canvas - // sanitizes double-clicks interactions - // ref: https://github.com/plotly/plotly.js/issues/744 - canvas.className += ' user-select-none'; - // create SVG container for hover text var svgContainer = this.svgContainer = document.createElementNS( 'http://www.w3.org/2000/svg', diff --git a/src/plots/gl3d/layout/axis_attributes.js b/src/plots/gl3d/layout/axis_attributes.js index 4a805ff8dbb..587deabdf2c 100644 --- a/src/plots/gl3d/layout/axis_attributes.js +++ b/src/plots/gl3d/layout/axis_attributes.js @@ -78,6 +78,7 @@ module.exports = overrideAll({ type: extendFlat({}, axesAttrs.type, { values: ['-', 'linear', 'log', 'date', 'category'] }), + autotypenumbers: axesAttrs.autotypenumbers, autorange: axesAttrs.autorange, rangemode: axesAttrs.rangemode, range: extendFlat({}, axesAttrs.range, { @@ -108,6 +109,7 @@ module.exports = overrideAll({ showticksuffix: axesAttrs.showticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickformat: axesAttrs.tickformat, tickformatstops: axesAttrs.tickformatstops, diff --git a/src/plots/gl3d/layout/axis_defaults.js b/src/plots/gl3d/layout/axis_defaults.js index 8bc9d7155ef..b7ff2435868 100644 --- a/src/plots/gl3d/layout/axis_defaults.js +++ b/src/plots/gl3d/layout/axis_defaults.js @@ -52,6 +52,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { showGrid: true, noTickson: true, noTicklabelmode: true, + noTicklabelposition: true, bgColor: options.bgColor, calendar: options.calendar }, diff --git a/src/plots/gl3d/layout/defaults.js b/src/plots/gl3d/layout/defaults.js index dd4c3eca2ce..be2b7da07e1 100644 --- a/src/plots/gl3d/layout/defaults.js +++ b/src/plots/gl3d/layout/defaults.js @@ -40,6 +40,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { font: layoutOut.font, fullData: fullData, getDfltFromLayout: getDfltFromLayout, + autotypenumbersDflt: layoutOut.autotypenumbers, paper_bgcolor: layoutOut.paper_bgcolor, calendar: layoutOut.calendar }); @@ -109,6 +110,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { data: fullGl3dData, bgColor: bgColorCombined, calendar: opts.calendar, + autotypenumbersDflt: opts.autotypenumbersDflt, fullLayout: opts.fullLayout }); diff --git a/src/plots/gl3d/scene.js b/src/plots/gl3d/scene.js index e45fb6e932a..a522afa8fcd 100644 --- a/src/plots/gl3d/scene.js +++ b/src/plots/gl3d/scene.js @@ -136,6 +136,8 @@ proto.prepareOptions = function() { return opts; }; +var firstInit = true; + proto.tryCreatePlot = function() { var scene = this; @@ -146,7 +148,7 @@ proto.tryCreatePlot = function() { try { scene.glplot = createPlot(opts); } catch(e) { - if(scene.staticMode) { + if(scene.staticMode || !firstInit) { success = false; } else { // try second time try { @@ -158,15 +160,22 @@ proto.tryCreatePlot = function() { 'The device may not be supported by is-mobile module!', 'Inverting preserveDrawingBuffer option in second attempt to create webgl scene.' ].join(' ')); + + // invert is-mobile isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; scene.glplot = createPlot(opts); } catch(e) { + // revert changes to is-mobile + isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; + success = false; } } } + firstInit = false; + return success; }; @@ -238,43 +247,45 @@ proto.initializeGLPlot = function() { scene.graphDiv.emit('plotly_relayout', update); }; - scene.glplot.canvas.addEventListener('mouseup', function() { - relayoutCallback(scene); - }); + if(scene.glplot.canvas) { + scene.glplot.canvas.addEventListener('mouseup', function() { + relayoutCallback(scene); + }); - scene.glplot.canvas.addEventListener('wheel', function(e) { - if(gd._context._scrollZoom.gl3d) { - if(scene.camera._ortho) { - var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1; - var o = scene.glplot.getAspectratio(); - scene.glplot.setAspectratio({ - x: s * o.x, - y: s * o.y, - z: s * o.z - }); - } + scene.glplot.canvas.addEventListener('wheel', function(e) { + if(gd._context._scrollZoom.gl3d) { + if(scene.camera._ortho) { + var s = (e.deltaX > e.deltaY) ? 1.1 : 1.0 / 1.1; + var o = scene.glplot.getAspectratio(); + scene.glplot.setAspectratio({ + x: s * o.x, + y: s * o.y, + z: s * o.z + }); + } - relayoutCallback(scene); - } - }, passiveSupported ? {passive: false} : false); + relayoutCallback(scene); + } + }, passiveSupported ? {passive: false} : false); - scene.glplot.canvas.addEventListener('mousemove', function() { - if(scene.fullSceneLayout.dragmode === false) return; - if(scene.camera.mouseListener.buttons === 0) return; + scene.glplot.canvas.addEventListener('mousemove', function() { + if(scene.fullSceneLayout.dragmode === false) return; + if(scene.camera.mouseListener.buttons === 0) return; - var update = makeUpdate(); - scene.graphDiv.emit('plotly_relayouting', update); - }); + var update = makeUpdate(); + scene.graphDiv.emit('plotly_relayouting', update); + }); - if(!scene.staticMode) { - scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { - if(gd && gd.emit) { - gd.emit('plotly_webglcontextlost', { - event: event, - layer: scene.id - }); - } - }, false); + if(!scene.staticMode) { + scene.glplot.canvas.addEventListener('webglcontextlost', function(event) { + if(gd && gd.emit) { + gd.emit('plotly_webglcontextlost', { + event: event, + layer: scene.id + }); + } + }, false); + } } scene.glplot.oncontextloss = function() { @@ -296,8 +307,12 @@ proto.render = function() { // update size of svg container var svgContainer = scene.svgContainer; var clientRect = scene.container.getBoundingClientRect(); - var width = clientRect.width; - var height = clientRect.height; + + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var width = clientRect.width * scaleX; + var height = clientRect.height * scaleY; svgContainer.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height); svgContainer.setAttributeNS(null, 'width', width); svgContainer.setAttributeNS(null, 'height', height); diff --git a/src/plots/layout_attributes.js b/src/plots/layout_attributes.js index 2a2a2f3a473..da0a15d8d91 100644 --- a/src/plots/layout_attributes.js +++ b/src/plots/layout_attributes.js @@ -265,6 +265,15 @@ module.exports = { }, editType: 'plot' }, + computed: { + valType: 'any', + role: 'info', + editType: 'none', + description: [ + 'Placeholder for exporting automargin-impacting values namely', + '`margin.t`, `margin.b`, `margin.l` and `margin.r` in *full-json* mode.', + ].join(' ') + }, paper_bgcolor: { valType: 'color', role: 'style', @@ -283,6 +292,19 @@ module.exports = { 'Sets the background color of the plotting area in-between x and y axes.' ].join(' ') }, + autotypenumbers: { + valType: 'enumerated', + values: ['convert types', 'strict'], + dflt: 'convert types', + role: 'info', + editType: 'calc', + description: [ + 'Using *strict* a numeric string in trace data is not converted to a number.', + 'Using *convert types* a numeric string in trace data may be', + 'treated as a number during automatic axis `type` detection.', + 'This is the default value; however it could be overridden for individual axes.' + ].join(' ') + }, separators: { valType: 'string', role: 'style', diff --git a/src/plots/mapbox/index.js b/src/plots/mapbox/index.js index c9e93b61d6f..4c6b4717ae5 100644 --- a/src/plots/mapbox/index.js +++ b/src/plots/mapbox/index.js @@ -11,6 +11,8 @@ var mapboxgl = require('mapbox-gl'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; +var strScale = Lib.strScale; var getSubplotCalcData = require('../../plots/get_data').getSubplotCalcData; var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); var d3 = require('d3'); @@ -127,7 +129,7 @@ exports.toSVG = function(gd) { var hidden = subplotDiv.select('.mapboxgl-ctrl-logo').node().offsetParent === null; if(!hidden) { var logo = fullLayout._glimages.append('g'); - logo.attr('transform', 'translate(' + (size.l + size.w * domain.x[0] + 10) + ', ' + (size.t + size.h * (1 - domain.y[0]) - 31) + ')'); + logo.attr('transform', strTranslate(size.l + size.w * domain.x[0] + 10, size.t + size.h * (1 - domain.y[0]) - 31)); logo.append('path') .attr('d', constants.mapboxLogo.path0) .style({ @@ -187,7 +189,7 @@ exports.toSVG = function(gd) { bBox = Drawing.bBox(attributionText.node()); } - attributionText.attr('transform', 'translate(-3, ' + (-bBox.height + 8) + ')'); + attributionText.attr('transform', strTranslate(-3, -bBox.height + 8)); // Draw white rectangle behind text attributionGroup @@ -205,7 +207,7 @@ exports.toSVG = function(gd) { if((bBox.width + 6) > maxWidth) scaleRatio = maxWidth / (bBox.width + 6); var offset = [(size.l + size.w * domain.x[1]), (size.t + size.h * (1 - domain.y[0]))]; - attributionGroup.attr('transform', 'translate(' + offset[0] + ',' + offset[1] + ') scale(' + scaleRatio + ')'); + attributionGroup.attr('transform', strTranslate(offset[0], offset[1]) + strScale(scaleRatio)); } }; diff --git a/src/plots/mapbox/layers.js b/src/plots/mapbox/layers.js index dd05b225667..99669e1077a 100644 --- a/src/plots/mapbox/layers.js +++ b/src/plots/mapbox/layers.js @@ -73,7 +73,7 @@ proto.needsNewSource = function(opts) { // stay safe and make new source on type changes return ( this.sourceType !== opts.sourcetype || - this.source !== opts.source || + JSON.stringify(this.source) !== JSON.stringify(opts.source) || this.layerType !== opts.type ); }; @@ -85,11 +85,23 @@ proto.needsNewLayer = function(opts) { ); }; +proto.lookupBelow = function() { + return this.subplot.belowLookup['layout-' + this.index]; +}; + proto.updateImage = function(opts) { var map = this.subplot.map; map.getSource(this.idSource).updateImage({ url: opts.source, coordinates: opts.coordinates }); + + // Since the `updateImage` control flow doesn't call updateLayer, + // We need to take care of moving the image layer to match the location + // where updateLayer would have placed it. + var _below = this.findFollowingMapboxLayerId(this.lookupBelow()); + if(_below !== null) { + this.subplot.map.moveLayer(this.idLayer, _below); + } }; proto.updateSource = function(opts) { @@ -107,15 +119,9 @@ proto.updateSource = function(opts) { map.addSource(this.idSource, sourceOpts); }; -proto.updateLayer = function(opts) { - var subplot = this.subplot; - var convertedOpts = convertOpts(opts); - - var below = this.subplot.belowLookup['layout-' + this.index]; - var _below; - +proto.findFollowingMapboxLayerId = function(below) { if(below === 'traces') { - var mapLayers = subplot.getMapLayers(); + var mapLayers = this.subplot.getMapLayers(); // find id of first plotly trace layer for(var i = 0; i < mapLayers.length; i++) { @@ -123,13 +129,19 @@ proto.updateLayer = function(opts) { if(typeof layerId === 'string' && layerId.indexOf(constants.traceLayerPrefix) === 0 ) { - _below = layerId; + below = layerId; break; } } - } else { - _below = below; } + return below; +}; + +proto.updateLayer = function(opts) { + var subplot = this.subplot; + var convertedOpts = convertOpts(opts); + var below = this.lookupBelow(); + var _below = this.findFollowingMapboxLayerId(below); this.removeLayer(); diff --git a/src/plots/mapbox/mapbox.js b/src/plots/mapbox/mapbox.js index b3268b9a5cb..71d48193187 100644 --- a/src/plots/mapbox/mapbox.js +++ b/src/plots/mapbox/mapbox.js @@ -450,15 +450,15 @@ proto.initFx = function(calcData, fullLayout) { map.on('mousemove', function(evt) { var bb = self.div.getBoundingClientRect(); - - // some hackery to get Fx.hover to work - evt.clientX = evt.point.x + bb.left; - evt.clientY = evt.point.y + bb.top; + var xy = [ + evt.originalEvent.offsetX, + evt.originalEvent.offsetY + ]; evt.target.getBoundingClientRect = function() { return bb; }; - self.xaxis.p2c = function() { return evt.lngLat.lng; }; - self.yaxis.p2c = function() { return evt.lngLat.lat; }; + self.xaxis.p2c = function() { return map.unproject(xy).lng; }; + self.yaxis.p2c = function() { return map.unproject(xy).lat; }; gd._fullLayout._rehover = function() { if(gd._fullLayout._hoversubplot === self.id && gd._fullLayout[self.id]) { diff --git a/src/plots/plots.js b/src/plots/plots.js index 03ba70426c0..5e3357b054d 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -667,7 +667,7 @@ function emptySubplotLists() { */ function getFormatObj(gd, formatKeys) { var locale = gd._context.locale; - if(!locale) locale === 'en-US'; + if(!locale) locale = 'en-US'; var formatDone = false; var formatObj = {}; @@ -1476,6 +1476,8 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { layoutOut._dataTemplate = template.data; } + coerce('autotypenumbers'); + var globalFont = Lib.coerceFont(coerce, 'font'); coerce('title.text', layoutOut._dfltTitle.plot); @@ -1864,6 +1866,9 @@ function initMargins(fullLayout) { if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; } +var minFinalWidth = 64; // could possibly be exposed as layout.margin.minfinalwidth +var minFinalHeight = 64; // could possibly be exposed as layout.margin.minfinalheight + /** * autoMargin: called by components that may need to expand the margins to * be rendered on-plot. @@ -1881,6 +1886,10 @@ function initMargins(fullLayout) { */ plots.autoMargin = function(gd, id, o) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -1900,13 +1909,15 @@ plots.autoMargin = function(gd, id, o) { // if the item is too big, just give it enough automargin to // make sure you can still grab it and bring it back - if(o.l + o.r > fullLayout.width * 0.5) { - Lib.log('Margin push', id, 'is too big in x, dropping'); - o.l = o.r = 0; + var rW = (o.l + o.r) / maxSpaceW; + if(rW > 1) { + o.l /= rW; + o.r /= rW; } - if(o.b + o.t > fullLayout.height * 0.5) { - Lib.log('Margin push', id, 'is too big in y, dropping'); - o.b = o.t = 0; + var rH = (o.t + o.b) / maxSpaceH; + if(rH > 1) { + o.t /= rH; + o.b /= rH; } var xl = o.xl !== undefined ? o.xl : o.x; @@ -1931,6 +1942,11 @@ plots.autoMargin = function(gd, id, o) { plots.doAutoMargin = function(gd) { var fullLayout = gd._fullLayout; + var width = fullLayout.width; + var height = fullLayout.height; + var maxSpaceW = Math.max(0, width - minFinalWidth); + var maxSpaceH = Math.max(0, height - minFinalHeight); + if(!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); @@ -1945,8 +1961,6 @@ plots.doAutoMargin = function(gd) { var mr = margin.r; var mt = margin.t; var mb = margin.b; - var width = fullLayout.width; - var height = fullLayout.height; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; @@ -1978,11 +1992,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pl) && pushMargin[k2].r) { var fr = pushMargin[k2].r.val; var pr = pushMargin[k2].r.size; - if(fr > fl) { var newL = (pl * fr + (pr - width) * fl) / (fr - fl); var newR = (pr * (1 - fl) + (pl - width) * (1 - fr)) / (fr - fl); - if(newL >= 0 && newR >= 0 && width - (newL + newR) > 0 && newL + newR > ml + mr) { + if(newL + newR > ml + mr) { ml = newL; mr = newR; } @@ -1992,11 +2005,10 @@ plots.doAutoMargin = function(gd) { if(isNumeric(pb) && pushMargin[k2].t) { var ft = pushMargin[k2].t.val; var pt = pushMargin[k2].t.size; - if(ft > fb) { var newB = (pb * ft + (pt - height) * fb) / (ft - fb); var newT = (pt * (1 - fb) + (pb - height) * (1 - ft)) / (ft - fb); - if(newB >= 0 && newT >= 0 && height - (newT + newB) > 0 && newB + newT > mb + mt) { + if(newB + newT > mb + mt) { mb = newB; mt = newT; } @@ -2006,6 +2018,18 @@ plots.doAutoMargin = function(gd) { } } + var rW = (ml + mr) / maxSpaceW; + if(rW > 1) { + ml /= rW; + mr /= rW; + } + + var rH = (mb + mt) / maxSpaceH; + if(rH > 1) { + mb /= rH; + mt /= rH; + } + gs.l = Math.round(ml); gs.r = Math.round(mr); gs.t = Math.round(mt); @@ -2032,11 +2056,24 @@ plots.doAutoMargin = function(gd) { if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call('plot', gd); } else { + fullLayout._size = oldMargins; Lib.warn('Too many auto-margin redraws.'); } } + + hideOutOfRangeInsideTickLabels(gd); }; +function hideOutOfRangeInsideTickLabels(gd) { + var axList = axisIDs.list(gd, '', true); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + + var hideFn = ax._hideOutOfRangeInsideTickLabels; + if(hideFn) hideFn(); + } +} + var marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h']; plots.didMarginChange = function(margin0, margin1) { @@ -2160,7 +2197,20 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi return d; }) }; - if(!dataonly) { obj.layout = stripObj(layout); } + if(!dataonly) { + obj.layout = stripObj(layout); + if(useDefaults) { + var gs = layout._size; + obj.layout.computed = { + margin: { + b: gs.b, + l: gs.l, + r: gs.r, + t: gs.t + } + }; + } + } if(gd.framework && gd.framework.isPolar) obj = gd.framework.getConfig(); @@ -3060,6 +3110,9 @@ function sortAxisCategoriesByValue(axList, gd) { var aggregator = match[1]; var order = match[2]; + var axLetter = ax._id.charAt(0); + var isX = axLetter === 'x'; + // Store values associated with each category var categoriesValue = []; for(j = 0; j < ax._categories.length; j++) { @@ -3070,7 +3123,6 @@ function sortAxisCategoriesByValue(axList, gd) { for(j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd._fullData[traceIndex]; - var axLetter = ax._id.charAt(0); // Skip over invisible traces if(fullTrace.visible !== true) continue; @@ -3080,27 +3132,28 @@ function sortAxisCategoriesByValue(axList, gd) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } + var isSplom = type === 'splom'; + var isScattergl = type === 'scattergl'; var cd = gd.calcdata[traceIndex]; for(k = 0; k < cd.length; k++) { var cdi = cd[k]; - var cat, catIndex, value; + var catIndex, value; - if(type === 'splom') { + if(isSplom) { // If `splom`, collect values across dimensions // Find which dimension the current axis is representing var currentDimensionIndex = fullTrace._axesDim[ax._id]; // Apply logic to associated x axis if it's defined - if(axLetter === 'y') { + if(!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for(l = 0; l < categories.length; l++) { - cat = categories[l]; - catIndex = ax._categoriesMap[cat]; + catIndex = ax._categoriesMap[categories[l]]; // Collect associated values at index `l` over all other dimensions for(o = 0; o < cdi.trace.dimensions.length; o++) { @@ -3109,18 +3162,14 @@ function sortAxisCategoriesByValue(axList, gd) { categoriesValue[catIndex][1].push(dimension.values[l]); } } - } else if(type === 'scattergl') { + } else if(isScattergl) { // If `scattergl`, collect all values stashed under cdi.t for(l = 0; l < cdi.t.x.length; l++) { - if(axLetter === 'x') { - cat = cdi.t.x[l]; - catIndex = cat; + if(isX) { + catIndex = cdi.t.x[l]; value = cdi.t.y[l]; - } - - if(axLetter === 'y') { - cat = cdi.t.y[l]; - catIndex = cat; + } else { + catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); @@ -3143,16 +3192,19 @@ function sortAxisCategoriesByValue(axList, gd) { } } else { // For all other 2d cartesian traces - if(axLetter === 'x') { - cat = cdi.p + 1 ? cdi.p : cdi.x; - value = cdi.s || cdi.v || cdi.y; - } else if(axLetter === 'y') { - cat = cdi.p + 1 ? cdi.p : cdi.y; - value = cdi.s || cdi.v || cdi.x; + catIndex = cdi.p; + if(catIndex === undefined) catIndex = cdi[axLetter]; + + value = cdi.s; + if(value === undefined) value = cdi.v; + if(value === undefined) value = isX ? cdi.y : cdi.x; + + if(!Array.isArray(value)) { + if(value === undefined) value = []; + else value = [value]; } - if(!Array.isArray(value)) value = [value]; for(l = 0; l < value.length; l++) { - categoriesValue[cat][1].push(value[l]); + categoriesValue[catIndex][1].push(value[l]); } } } @@ -3194,12 +3246,8 @@ function sortAxisCategoriesByValue(axList, gd) { function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; - var i, ax, axId; - - for(i = 0; i < axList.length; i++) { - ax = axList[i]; - axId = ax._id; + function setupOne(ax) { ax.clearCalc(); if(ax.type === 'multicategory') { ax.setupMultiCategory(fullData); @@ -3208,13 +3256,14 @@ function setupAxisCategories(axList, fullData, fullLayout) { axLookup[ax._id] = 1; } + Lib.simpleMap(axList, setupOne); + // look into match groups for 'missing' axes var matchGroups = fullLayout._axisMatchGroups || []; - for(i = 0; i < matchGroups.length; i++) { - for(axId in matchGroups[i]) { + for(var i = 0; i < matchGroups.length; i++) { + for(var axId in matchGroups[i]) { if(!axLookup[axId]) { - ax = fullLayout[axisIDs.id2name(axId)]; - ax.clearCalc(); + setupOne(fullLayout[axisIDs.id2name(axId)]); } } } diff --git a/src/plots/polar/layout_attributes.js b/src/plots/polar/layout_attributes.js index fc296524e34..e4f7630d725 100644 --- a/src/plots/polar/layout_attributes.js +++ b/src/plots/polar/layout_attributes.js @@ -47,6 +47,7 @@ var axisTickAttrs = overrideAll({ ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, @@ -60,6 +61,7 @@ var radialAxisAttrs = { type: extendFlat({}, axesAttrs.type, { values: ['-', 'linear', 'log', 'date', 'category'] }), + autotypenumbers: axesAttrs.autotypenumbers, autorange: extendFlat({}, axesAttrs.autorange, {editType: 'plot'}), rangemode: { @@ -178,6 +180,7 @@ var angularAxisAttrs = { 'If *category, use `period` to set the number of integer coordinates around polar axis.' ].join(' ') }, + autotypenumbers: axesAttrs.autotypenumbers, categoryorder: axesAttrs.categoryorder, categoryarray: axesAttrs.categoryarray, diff --git a/src/plots/polar/layout_defaults.js b/src/plots/polar/layout_defaults.js index f751ad9cef8..5bdc69c746a 100644 --- a/src/plots/polar/layout_defaults.js +++ b/src/plots/polar/layout_defaults.js @@ -57,7 +57,7 @@ function handleDefaults(contIn, contOut, coerce, opts) { axOut._traceIndices = subplotData.map(function(t) { return t._expandedIndex; }); var dataAttr = constants.axisName2dataArray[axName]; - var axType = handleAxisTypeDefaults(axIn, axOut, coerceAxis, subplotData, dataAttr); + var axType = handleAxisTypeDefaults(axIn, axOut, coerceAxis, subplotData, dataAttr, opts); handleCategoryOrderDefaults(axIn, axOut, coerceAxis, { axData: subplotData, @@ -187,7 +187,8 @@ function handleDefaults(contIn, contOut, coerce, opts) { } } -function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr) { +function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr, options) { + var autotypenumbers = coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type'); if(axType === '-') { @@ -201,7 +202,10 @@ function handleAxisTypeDefaults(axIn, axOut, coerce, subplotData, dataAttr) { } if(trace && trace[dataAttr]) { - axOut.type = autoType(trace[dataAttr], 'gregorian'); + axOut.type = autoType(trace[dataAttr], 'gregorian', { + noMultiCategory: true, + autotypenumbers: autotypenumbers + }); } if(axOut.type === '-') { @@ -224,6 +228,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { attributes: layoutAttributes, handleDefaults: handleDefaults, font: layoutOut.font, + autotypenumbersDflt: layoutOut.autotypenumbers, paper_bgcolor: layoutOut.paper_bgcolor, fullData: fullData, layoutOut: layoutOut diff --git a/src/plots/polar/polar.js b/src/plots/polar/polar.js index ebeed62ab25..57a4ac167d9 100644 --- a/src/plots/polar/polar.js +++ b/src/plots/polar/polar.js @@ -13,6 +13,8 @@ var tinycolor = require('tinycolor2'); var Registry = require('../../registry'); var Lib = require('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var Plots = require('../plots'); @@ -379,7 +381,7 @@ proto.updateRadialAxis = function(fullLayout, polarLayout) { // easier to set rotate angle with custom translate function var transFn = function(d) { - return 'translate(' + (ax.l2p(d.x) + innerRadius) + ',0)'; + return strTranslate(ax.l2p(d.x) + innerRadius, 0); }; // set special grid path function @@ -678,6 +680,9 @@ proto.updateMainDrag = function(fullLayout) { var chw = constants.cornerHalfWidth; var chl = constants.cornerLen / 2; + var scaleX; + var scaleY; + var mainDrag = dragBox.makeDragger(layers, 'path', 'maindrag', 'crosshair'); d3.select(mainDrag) @@ -837,8 +842,12 @@ proto.updateMainDrag = function(fullLayout) { } function zoomMove(dx, dy) { + dx = dx * scaleX; + dy = dy * scaleY; + var x1 = x0 + dx; var y1 = y0 + dy; + var rr0 = xy2r(x0, y0); var rr1 = Math.min(xy2r(x1, y1), radius); var a0 = xy2a(x0, y0); @@ -934,8 +943,13 @@ proto.updateMainDrag = function(fullLayout) { var dragModeNow = gd._fullLayout.dragmode; var bbox = mainDrag.getBoundingClientRect(); - x0 = startX - bbox.left; - y0 = startY - bbox.top; + gd._fullLayout._calcInverseTransform(gd); + var inverse = gd._fullLayout._invTransform; + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + var transformedCoords = Lib.apply3DTransform(inverse)(startX - bbox.left, startY - bbox.top); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; // need to offset x/y as bbox center does not // match origin for asymmetric polygons @@ -1187,8 +1201,8 @@ proto.updateAngularDrag = function(fullLayout) { var fullLayoutNow = _this.gd._fullLayout; var polarLayoutNow = fullLayoutNow[_this.id]; - var x1 = x0 + dx; - var y1 = y0 + dy; + var x1 = x0 + dx * fullLayout._invScaleX; + var y1 = y0 + dy * fullLayout._invScaleY; var a1 = xy2a(x1, y1); var da = rad2deg(a1 - a0); rot1 = rot0 + da; @@ -1281,6 +1295,12 @@ proto.updateAngularDrag = function(fullLayout) { var bbox = angularDrag.getBoundingClientRect(); x0 = startX - bbox.left; y0 = startY - bbox.top; + + gd._fullLayout._calcInverseTransform(gd); + var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + a0 = xy2a(x0, y0); dragOpts.moveFn = moveFn; @@ -1419,11 +1439,3 @@ function updateElement(sel, showAttr, attrs) { } return sel; } - -function strTranslate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - -function strRotate(angle) { - return 'rotate(' + angle + ')'; -} diff --git a/src/plots/ternary/layout_attributes.js b/src/plots/ternary/layout_attributes.js index d451a6d729d..aa763b38b8e 100644 --- a/src/plots/ternary/layout_attributes.js +++ b/src/plots/ternary/layout_attributes.js @@ -40,6 +40,7 @@ var ternaryAxesAttrs = { ticksuffix: axesAttrs.ticksuffix, showexponent: axesAttrs.showexponent, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, separatethousands: axesAttrs.separatethousands, tickfont: axesAttrs.tickfont, tickangle: axesAttrs.tickangle, diff --git a/src/plots/ternary/ternary.js b/src/plots/ternary/ternary.js index 5610ceff51e..7513c74222c 100644 --- a/src/plots/ternary/ternary.js +++ b/src/plots/ternary/ternary.js @@ -14,6 +14,7 @@ var tinycolor = require('tinycolor2'); var Registry = require('../../registry'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var _ = Lib._; var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); @@ -301,7 +302,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { var triangleClipRelative = 'M0,' + h + 'h' + w + 'l-' + (w / 2) + ',-' + h + 'Z'; _this.clipDefRelative.select('path').attr('d', triangleClipRelative); - var plotTransform = 'translate(' + x0 + ',' + y0 + ')'; + var plotTransform = strTranslate(x0, y0); _this.plotContainer.selectAll('.scatterlayer,.maplayer') .attr('transform', plotTransform); @@ -310,18 +311,18 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { // TODO: shift axes to accommodate linewidth*sin(30) tick mark angle // TODO: there's probably an easier way to handle these translations/offsets now... - var bTransform = 'translate(' + (x0 - baxis._offset) + ',' + (y0 + h) + ')'; + var bTransform = strTranslate(x0 - baxis._offset, y0 + h); _this.layers.baxis.attr('transform', bTransform); _this.layers.bgrid.attr('transform', bTransform); - var aTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(30)translate(0,' + -aaxis._offset + ')'; + var aTransform = strTranslate(x0 + w / 2, y0) + + 'rotate(30)' + strTranslate(0, -aaxis._offset); _this.layers.aaxis.attr('transform', aTransform); _this.layers.agrid.attr('transform', aTransform); - var cTransform = 'translate(' + (x0 + w / 2) + ',' + y0 + - ')rotate(-30)translate(0,' + -caxis._offset + ')'; + var cTransform = strTranslate(x0 + w / 2, y0) + + 'rotate(-30)' + strTranslate(0, -caxis._offset); _this.layers.caxis.attr('transform', cTransform); _this.layers.cgrid.attr('transform', cTransform); @@ -427,7 +428,7 @@ proto.drawAx = function(ax) { var vals = Axes.calcTicks(ax); var valsClipped = Axes.clipEnds(ax, vals); - var transFn = Axes.makeTransFn(ax); + var transFn = Axes.makeTransTickFn(ax); var tickSign = Axes.getTickSigns(ax)[2]; var caRad = Lib.deg2rad(counterAngle); @@ -502,6 +503,8 @@ proto.initInteractions = function() { var dragger = _this.layers.plotbg.select('path').node(); var gd = _this.graphDiv; var zoomLayer = gd._fullLayout._zoomlayer; + var scaleX; + var scaleY; // use plotbg for the main interactions this.dragOptions = { @@ -520,6 +523,9 @@ proto.initInteractions = function() { _this.dragOptions.xaxes = [_this.xaxis]; _this.dragOptions.yaxes = [_this.yaxis]; + scaleX = gd._fullLayout._invScaleX; + scaleY = gd._fullLayout._invScaleY; + var dragModeNow = _this.dragOptions.dragmode = gd._fullLayout.dragmode; if(freeMode(dragModeNow)) _this.dragOptions.minDrag = 1; @@ -575,6 +581,13 @@ proto.initInteractions = function() { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; y0 = startY - dragBBox.top; + + gd._fullLayout._calcInverseTransform(gd); + var inverse = gd._fullLayout._invTransform; + var transformedCoords = Lib.apply3DTransform(inverse)(x0, y0); + x0 = transformedCoords[0]; + y0 = transformedCoords[1]; + mins0 = { a: _this.aaxis.range[0], b: _this.baxis.range[1], @@ -588,7 +601,7 @@ proto.initInteractions = function() { zb = zoomLayer.append('path') .attr('class', 'zoombox') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') + .attr('transform', strTranslate(_this.x0, _this.y0)) .style({ 'fill': lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)', 'stroke-width': 0 @@ -597,7 +610,7 @@ proto.initInteractions = function() { corners = zoomLayer.append('path') .attr('class', 'zoombox-corners') - .attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')') + .attr('transform', strTranslate(_this.x0, _this.y0)) .style({ fill: Color.background, stroke: Color.defaultLine, @@ -614,8 +627,8 @@ proto.initInteractions = function() { function getCFrac(x, y) { return ((x - (_this.h - y) / Math.sqrt(3)) / _this.w); } function zoomMove(dx0, dy0) { - var x1 = x0 + dx0; - var y1 = y0 + dy0; + var x1 = x0 + dx0 * scaleX; + var y1 = y0 + dy0 * scaleY; var afrac = Math.max(0, Math.min(1, getAFrac(x0, y0), getAFrac(x1, y1))); var bfrac = Math.max(0, Math.min(1, getBFrac(x0, y0), getBFrac(x1, y1))); var cfrac = Math.max(0, Math.min(1, getCFrac(x0, y0), getCFrac(x1, y1))); @@ -714,11 +727,11 @@ proto.initInteractions = function() { } // move the data (translate, don't redraw) - var plotTransform = 'translate(' + (_this.x0 + dx) + ',' + (_this.y0 + dy) + ')'; + var plotTransform = strTranslate(_this.x0 + dx, _this.y0 + dy); _this.plotContainer.selectAll('.scatterlayer,.maplayer') .attr('transform', plotTransform); - var plotTransform2 = 'translate(' + -dx + ',' + -dy + ')'; + var plotTransform2 = strTranslate(-dx, -dy); _this.clipDefRelative.select('path').attr('transform', plotTransform2); // move the ticks diff --git a/src/snapshot/download.js b/src/snapshot/download.js index 82e2c589c07..50c9a7488eb 100644 --- a/src/snapshot/download.js +++ b/src/snapshot/download.js @@ -31,6 +31,8 @@ function downloadImage(gd, opts) { opts = opts || {}; opts.format = opts.format || 'png'; + opts.width = opts.width || null; + opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { diff --git a/src/traces/bar/attributes.js b/src/traces/bar/attributes.js index b922b4a86d8..fd7572d7eef 100644 --- a/src/traces/bar/attributes.js +++ b/src/traces/bar/attributes.js @@ -59,6 +59,13 @@ module.exports = { y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, texttemplate: texttemplateAttrs({editType: 'plot'}, { keys: constants.eventDataKeys diff --git a/src/traces/bar/calc.js b/src/traces/bar/calc.js index 67b994e98cb..218808f5212 100644 --- a/src/traces/bar/calc.js +++ b/src/traces/bar/calc.js @@ -9,6 +9,7 @@ 'use strict'; var Axes = require('../../plots/cartesian/axes'); +var alignPeriod = require('../../plots/cartesian/align_period'); var hasColorscale = require('../../components/colorscale/helpers').hasColorscale; var colorscaleCalc = require('../../components/colorscale/calc'); var arraysToCalcdata = require('./arrays_to_calcdata'); @@ -17,18 +18,23 @@ var calcSelection = require('../scatter/calc_selection'); module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; var sizeOpts = { msUTC: !!(trace.base || trace.base === 0) }; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x', sizeOpts); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y', sizeOpts); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -39,6 +45,10 @@ module.exports = function calc(gd, trace) { for(var i = 0; i < serieslen; i++) { cd[i] = { p: pos[i], s: size[i] }; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cd[i].id = String(trace.ids[i]); } diff --git a/src/traces/bar/cross_trace_calc.js b/src/traces/bar/cross_trace_calc.js index 1bb5dda2f81..719174b555d 100644 --- a/src/traces/bar/cross_trace_calc.js +++ b/src/traces/bar/cross_trace_calc.js @@ -14,7 +14,7 @@ var BADNUM = require('../../constants/numerical').BADNUM; var Registry = require('../../registry'); var Axes = require('../../plots/cartesian/axes'); -var getAxisGroup = require('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = require('../../plots/cartesian/constraints').getAxisGroup; var Sieve = require('./sieve.js'); /* diff --git a/src/traces/bar/defaults.js b/src/traces/bar/defaults.js index d6284ff5351..593a1670cff 100644 --- a/src/traces/bar/defaults.js +++ b/src/traces/bar/defaults.js @@ -13,8 +13,9 @@ var Color = require('../../components/color'); var Registry = require('../../registry'); var handleXYDefaults = require('../scatter/xy_defaults'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var handleStyleDefaults = require('./style_defaults'); -var getAxisGroup = require('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = require('../../plots/cartesian/constraints').getAxisGroup; var attributes = require('./attributes'); var coerceFont = Lib.coerceFont; @@ -30,6 +31,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); coerce('base'); coerce('offset'); diff --git a/src/traces/bar/hover.js b/src/traces/bar/hover.js index 8cb3d926540..55b2dff5f50 100644 --- a/src/traces/bar/hover.js +++ b/src/traces/bar/hover.js @@ -158,10 +158,13 @@ function hoverOnBars(pointData, xval, yval, hovermode) { var extent = t.extents[t.extents.round(di.p)]; pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true); pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true); - pointData[posLetter + 'LabelVal'] = di.p; + + var hasPeriod = di.orig_p !== undefined; + pointData[posLetter + 'LabelVal'] = hasPeriod ? di.orig_p : di.p; pointData.labelLabel = hoverLabelText(pa, pointData[posLetter + 'LabelVal']); pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + 'LabelVal']); + pointData.baseLabel = hoverLabelText(sa, di.b); // spikelines always want "closest" distance regardless of hovermode pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 - maxHoverDistance; diff --git a/src/traces/bar/plot.js b/src/traces/bar/plot.js index eaee3a1418c..c52bd16c976 100644 --- a/src/traces/bar/plot.js +++ b/src/traces/bar/plot.js @@ -242,7 +242,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback); sel .style('vector-effect', 'non-scaling-stroke') - .attr('d', isNaN((x1 - x0) * (y1 - y0)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') + .attr('d', (isNaN((x1 - x0) * (y1 - y0)) || (isBlank && gd._context.staticPlot)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z') .call(Drawing.setClipUrl, plotinfo.layerClipId, gd); if(!fullLayout.uniformtext.mode && withTransition) { diff --git a/src/traces/box/attributes.js b/src/traces/box/attributes.js index 91316d919a9..dd6bc37823e 100644 --- a/src/traces/box/attributes.js +++ b/src/traces/box/attributes.js @@ -76,6 +76,13 @@ module.exports = { ].join(' ') }, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + name: { valType: 'string', role: 'info', diff --git a/src/traces/box/calc.js b/src/traces/box/calc.js index 0c9115dc03b..90d40ac9216 100644 --- a/src/traces/box/calc.js +++ b/src/traces/box/calc.js @@ -11,6 +11,7 @@ var isNumeric = require('fast-isnumeric'); var Axes = require('../../plots/cartesian/axes'); +var alignPeriod = require('../../plots/cartesian/align_period'); var Lib = require('../../lib'); var BADNUM = require('../../constants/numerical').BADNUM; @@ -29,19 +30,24 @@ module.exports = function calc(gd, trace) { var valAxis, valLetter; var posAxis, posLetter; + var hasPeriod; if(trace.orientation === 'h') { valAxis = xa; valLetter = 'x'; posAxis = ya; posLetter = 'y'; + hasPeriod = !!trace.yperiodalignment; } else { valAxis = ya; valLetter = 'y'; posAxis = xa; posLetter = 'x'; + hasPeriod = !!trace.xperiodalignment; } - var posArray = getPos(trace, posLetter, posAxis, fullLayout[numKey]); + var allPosArrays = getPosArrays(trace, posLetter, posAxis, fullLayout[numKey]); + var posArray = allPosArrays[0]; + var origPos = allPosArrays[1]; var dv = Lib.distinctVals(posArray); var posDistinct = dv.vals; var dPos = dv.minDiff / 2; @@ -77,6 +83,9 @@ module.exports = function calc(gd, trace) { cdi = {}; cdi.pos = cdi[posLetter] = posi; + if(hasPeriod && origPos) { + cdi.orig_p = origPos[i]; // used by hover + } cdi.q1 = d2c('q1'); cdi.med = d2c('median'); @@ -303,13 +312,15 @@ module.exports = function calc(gd, trace) { // so if you want one box // per trace, set x0 (y0) to the x (y) value or category for this trace // (or set x (y) to a constant array matching y (x)) -function getPos(trace, posLetter, posAxis, num) { +function getPosArrays(trace, posLetter, posAxis, num) { var hasPosArray = posLetter in trace; var hasPos0 = posLetter + '0' in trace; var hasPosStep = 'd' + posLetter in trace; if(hasPosArray || (hasPos0 && hasPosStep)) { - return posAxis.makeCalcdata(trace, posLetter); + var origPos = posAxis.makeCalcdata(trace, posLetter); + var pos = alignPeriod(trace, posAxis, posLetter, origPos); + return [pos, origPos]; } var pos0; @@ -337,7 +348,7 @@ function getPos(trace, posLetter, posAxis, num) { var out = new Array(len); for(var i = 0; i < len; i++) out[i] = pos0c; - return out; + return [out]; } function makeBins(x, dx) { diff --git a/src/traces/box/cross_trace_calc.js b/src/traces/box/cross_trace_calc.js index 72b57856cfb..165ef398627 100644 --- a/src/traces/box/cross_trace_calc.js +++ b/src/traces/box/cross_trace_calc.js @@ -10,7 +10,7 @@ var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); -var getAxisGroup = require('../../plots/cartesian/axis_ids').getAxisGroup; +var getAxisGroup = require('../../plots/cartesian/constraints').getAxisGroup; var orientations = ['v', 'h']; diff --git a/src/traces/box/defaults.js b/src/traces/box/defaults.js index 300053e6e5d..b0e155042b1 100644 --- a/src/traces/box/defaults.js +++ b/src/traces/box/defaults.js @@ -11,6 +11,7 @@ var Lib = require('../../lib'); var Registry = require('../../registry'); var Color = require('../../components/color'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var handleGroupingDefaults = require('../bar/defaults').handleGroupingDefaults; var autoType = require('../../plots/cartesian/axis_autotype'); var attributes = require('./attributes'); @@ -23,6 +24,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { handleSampleDefaults(traceIn, traceOut, coerce, layout); if(traceOut.visible === false) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var hasPreCompStats = traceOut._hasPreCompStats; if(hasPreCompStats) { @@ -106,6 +109,11 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { var yLen = yDims && Lib.minRowLength(y); var xLen = xDims && Lib.minRowLength(x); + var calendar = layout.calendar; + var opts = { + autotypenumbers: layout.autotypenumbers + }; + var defaultOrientation, len; if(traceOut._hasPreCompStats) { switch(String(xDims) + String(yDims)) { @@ -157,7 +165,7 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { var hasCategories = false; var i; for(i = 0; i < x.length; i++) { - if(autoType(x[i]) === 'category') { + if(autoType(x[i], calendar, opts) === 'category') { hasCategories = true; break; } @@ -168,7 +176,7 @@ function handleSampleDefaults(traceIn, traceOut, coerce, layout) { len = Math.min(sLen, xLen, y.length); } else { for(i = 0; i < y.length; i++) { - if(autoType(y[i]) === 'category') { + if(autoType(y[i], calendar, opts) === 'category') { hasCategories = true; break; } diff --git a/src/traces/box/hover.js b/src/traces/box/hover.js index 3fee0d1e638..1ad3c705fb8 100644 --- a/src/traces/box/hover.js +++ b/src/traces/box/hover.js @@ -143,7 +143,7 @@ function hoverOnBoxes(pointData, xval, yval, hovermode) { pointData[pLetter + '0'] = pAxis.c2p(di.pos + t.bPos - boxDeltaNeg, true); pointData[pLetter + '1'] = pAxis.c2p(di.pos + t.bPos + boxDeltaPos, true); - pointData[pLetter + 'LabelVal'] = di.pos; + pointData[pLetter + 'LabelVal'] = di.orig_p !== undefined ? di.orig_p : di.pos; var spikePosAttr = pLetter + 'Spike'; pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; @@ -257,14 +257,16 @@ function hoverOnPoints(pointData, xval, yval) { hovertemplate: trace.hovertemplate }); + var origPos = di.orig_p; + var pos = origPos !== undefined ? origPos : di.pos; var pa; if(trace.orientation === 'h') { pa = ya; closePtData.xLabelVal = pt.x; - closePtData.yLabelVal = di.pos; + closePtData.yLabelVal = pos; } else { pa = xa; - closePtData.xLabelVal = di.pos; + closePtData.xLabelVal = pos; closePtData.yLabelVal = pt.y; } diff --git a/src/traces/candlestick/attributes.js b/src/traces/candlestick/attributes.js index 754096a3d45..1a9f491dc10 100644 --- a/src/traces/candlestick/attributes.js +++ b/src/traces/candlestick/attributes.js @@ -27,6 +27,10 @@ function directionAttrs(lineColorDefault) { } module.exports = { + xperiod: OHLCattrs.xperiod, + xperiod0: OHLCattrs.xperiod0, + xperiodalignment: OHLCattrs.xperiodalignment, + x: OHLCattrs.x, open: OHLCattrs.open, high: OHLCattrs.high, diff --git a/src/traces/candlestick/calc.js b/src/traces/candlestick/calc.js index 25f4b1f10aa..eb06d1916aa 100644 --- a/src/traces/candlestick/calc.js +++ b/src/traces/candlestick/calc.js @@ -10,6 +10,7 @@ var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); +var alignPeriod = require('../../plots/cartesian/align_period'); var calcCommon = require('../ohlc/calc').calcCommon; @@ -18,9 +19,10 @@ module.exports = function(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis); var ya = Axes.getFromId(gd, trace.yaxis); - var x = xa.makeCalcdata(trace, 'x'); + var origX = xa.makeCalcdata(trace, 'x'); + var x = alignPeriod(trace, xa, 'x', origX); - var cd = calcCommon(gd, trace, x, ya, ptFunc); + var cd = calcCommon(gd, trace, origX, x, ya, ptFunc); if(cd.length) { Lib.extendFlat(cd[0].t, { diff --git a/src/traces/candlestick/defaults.js b/src/traces/candlestick/defaults.js index 244cfafa768..200f21c98ed 100644 --- a/src/traces/candlestick/defaults.js +++ b/src/traces/candlestick/defaults.js @@ -12,6 +12,7 @@ var Lib = require('../../lib'); var Color = require('../../components/color'); var handleOHLC = require('../ohlc/ohlc_defaults'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var attributes = require('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -25,6 +26,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce, {x: true}); + coerce('line.width'); handleDirection(traceIn, traceOut, coerce, 'increasing'); diff --git a/src/traces/carpet/ab_defaults.js b/src/traces/carpet/ab_defaults.js index b0875392f19..76f1c0bde59 100644 --- a/src/traces/carpet/ab_defaults.js +++ b/src/traces/carpet/ab_defaults.js @@ -47,6 +47,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) { calendar: traceOut.calendar, dfltColor: dfltColor, bgColor: fullLayout.paper_bgcolor, + autotypenumbersDflt: fullLayout.autotypenumbers, fullLayout: fullLayout }; diff --git a/src/traces/carpet/axis_attributes.js b/src/traces/carpet/axis_attributes.js index 16b03ee3c48..b308bdbfaf8 100644 --- a/src/traces/carpet/axis_attributes.js +++ b/src/traces/carpet/axis_attributes.js @@ -88,6 +88,7 @@ module.exports = { 'the axis in question.' ].join(' ') }, + autotypenumbers: axesAttrs.autotypenumbers, autorange: { valType: 'enumerated', values: [true, false, 'reversed'], @@ -284,6 +285,16 @@ module.exports = { 'If *B*, 1B.' ].join(' ') }, + minexponent: { + valType: 'number', + dflt: 3, + min: 0, + role: 'style', + editType: 'calc', + description: [ + 'Hide SI prefix for 10^n if |n| is below this number' + ].join(' ') + }, separatethousands: { valType: 'boolean', dflt: false, diff --git a/src/traces/carpet/axis_defaults.js b/src/traces/carpet/axis_defaults.js index 680a787a6c8..0c28cfdc741 100644 --- a/src/traces/carpet/axis_defaults.js +++ b/src/traces/carpet/axis_defaults.js @@ -51,6 +51,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) } // now figure out type and do some more initialization + coerce('autotypenumbers', options.autotypenumbersDflt); var axType = coerce('type'); if(axType === '-') { if(options.data) setAutoType(containerOut, options.data); @@ -78,6 +79,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) coerce('separatethousands'); coerce('tickformat'); coerce('exponentformat'); + coerce('minexponent'); coerce('showexponent'); coerce('categoryorder'); @@ -186,6 +188,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options) delete containerOut.tickangle; delete containerOut.showexponent; delete containerOut.exponentformat; + delete containerOut.minexponent; delete containerOut.tickformat; delete containerOut.showticksuffix; delete containerOut.showtickprefix; @@ -217,5 +220,7 @@ function setAutoType(ax, data) { var calAttr = axLetter + 'calendar'; var calendar = ax[calAttr]; - ax.type = autoType(data, calendar); + ax.type = autoType(data, calendar, { + autotypenumbers: ax.autotypenumbers + }); } diff --git a/src/traces/carpet/plot.js b/src/traces/carpet/plot.js index 2e61c63d578..8d630b90578 100644 --- a/src/traces/carpet/plot.js +++ b/src/traces/carpet/plot.js @@ -16,6 +16,8 @@ var makepath = require('./makepath'); var orientText = require('./orient_text'); var svgTextUtils = require('../../lib/svg_text_utils'); var Lib = require('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var alignmentConstants = require('../../constants/alignment'); module.exports = function plot(gd, plotinfo, cdcarpet, carpetLayer) { @@ -154,11 +156,11 @@ function drawAxisLabels(gd, xaxis, yaxis, trace, t, layer, labels, labelClass) { labelEl.attr('transform', // Translate to the correct point: - 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + + strTranslate(orientation.p[0], orientation.p[1]) + // Rotate to line up with grid line tangent: - 'rotate(' + orientation.angle + ')' + + strRotate(orientation.angle) + // Adjust the baseline and indentation: - 'translate(' + label.axis.labelpadding * direction + ',' + bbox.height * 0.3 + ')' + strTranslate(label.axis.labelpadding * direction, bbox.height * 0.3) ); maxExtent = Math.max(maxExtent, bbox.width + label.axis.labelpadding); @@ -235,11 +237,10 @@ function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, labelOrientat } el.attr('transform', - 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + - 'rotate(' + orientation.angle + ') ' + - 'translate(0,' + offset + ')' + strTranslate(orientation.p[0], orientation.p[1]) + + strRotate(orientation.angle) + + strTranslate(0, offset) ) - .classed('user-select-none', true) .attr('text-anchor', 'middle') .call(Drawing.font, axis.title.font); }); diff --git a/src/traces/choropleth/hover.js b/src/traces/choropleth/hover.js index 3d1609ef627..1ebe905c22e 100644 --- a/src/traces/choropleth/hover.js +++ b/src/traces/choropleth/hover.js @@ -19,17 +19,20 @@ module.exports = function hoverPoints(pointData, xval, yval) { var pt, i, j, isInside; + var xy = [xval, yval]; + var altXy = [xval + 360, yval]; + for(i = 0; i < cd.length; i++) { pt = cd[i]; isInside = false; if(pt._polygons) { for(j = 0; j < pt._polygons.length; j++) { - if(pt._polygons[j].contains([xval, yval])) { + if(pt._polygons[j].contains(xy)) { isInside = !isInside; } // for polygons that cross antimeridian as xval is in [-180, 180] - if(pt._polygons[j].contains([xval + 360, yval])) { + if(pt._polygons[j].contains(altXy)) { isInside = !isInside; } } @@ -49,7 +52,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { pointData.zLabel = Axes.tickText(geo.mockAxis, geo.mockAxis.c2l(pt.z), 'hover').text; pointData.hovertemplate = pt.hovertemplate; - makeHoverInfo(pointData, trace, pt, geo.mockAxis); + makeHoverInfo(pointData, trace, pt); return [pointData]; }; diff --git a/src/traces/contour/attributes.js b/src/traces/contour/attributes.js index 2d44f30d4df..66ca08583ce 100644 --- a/src/traces/contour/attributes.js +++ b/src/traces/contour/attributes.js @@ -31,6 +31,14 @@ module.exports = extendFlat({ y: heatmapAttrs.y, y0: heatmapAttrs.y0, dy: heatmapAttrs.dy, + + xperiod: heatmapAttrs.xperiod, + yperiod: heatmapAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: heatmapAttrs.xperiodalignment, + yperiodalignment: heatmapAttrs.yperiodalignment, + text: heatmapAttrs.text, hovertext: heatmapAttrs.hovertext, transpose: heatmapAttrs.transpose, diff --git a/src/traces/contour/defaults.js b/src/traces/contour/defaults.js index b0489275155..a25249b8495 100644 --- a/src/traces/contour/defaults.js +++ b/src/traces/contour/defaults.js @@ -11,6 +11,7 @@ var Lib = require('../../lib'); var handleXYZDefaults = require('../heatmap/xyz_defaults'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var handleConstraintDefaults = require('./constraint_defaults'); var handleContoursDefaults = require('./contours_defaults'); var handleStyleDefaults = require('./style_defaults'); @@ -32,6 +33,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); diff --git a/src/traces/funnel/attributes.js b/src/traces/funnel/attributes.js index e18309dd7f6..de06d0786ae 100644 --- a/src/traces/funnel/attributes.js +++ b/src/traces/funnel/attributes.js @@ -25,6 +25,13 @@ module.exports = { y0: barAttrs.y0, dy: barAttrs.dy, + xperiod: barAttrs.xperiod, + yperiod: barAttrs.yperiod, + xperiod0: barAttrs.xperiod0, + yperiod0: barAttrs.yperiod0, + xperiodalignment: barAttrs.xperiodalignment, + yperiodalignment: barAttrs.yperiodalignment, + hovertext: barAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys diff --git a/src/traces/funnel/calc.js b/src/traces/funnel/calc.js index 7f182e5ea26..468fb1a6153 100644 --- a/src/traces/funnel/calc.js +++ b/src/traces/funnel/calc.js @@ -9,6 +9,7 @@ 'use strict'; var Axes = require('../../plots/cartesian/axes'); +var alignPeriod = require('../../plots/cartesian/align_period'); var arraysToCalcdata = require('./arrays_to_calcdata'); var calcSelection = require('../scatter/calc_selection'); var BADNUM = require('../../constants/numerical').BADNUM; @@ -16,14 +17,19 @@ var BADNUM = require('../../constants/numerical').BADNUM; module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos, i, cdi; + var size, pos, origPos, i, cdi; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -55,6 +61,10 @@ module.exports = function calc(gd, trace) { trace._base[i] = -0.5 * cdi.s; + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cdi.id = String(trace.ids[i]); } diff --git a/src/traces/funnel/defaults.js b/src/traces/funnel/defaults.js index 4d1ea4b47e2..acf9f65083b 100644 --- a/src/traces/funnel/defaults.js +++ b/src/traces/funnel/defaults.js @@ -13,6 +13,7 @@ var Lib = require('../../lib'); var handleGroupingDefaults = require('../bar/defaults').handleGroupingDefaults; var handleText = require('../bar/defaults').handleText; var handleXYDefaults = require('../scatter/xy_defaults'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var attributes = require('./attributes'); var Color = require('../../components/color'); @@ -27,6 +28,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('orientation', (traceOut.y && !traceOut.x) ? 'v' : 'h'); coerce('offset'); coerce('width'); diff --git a/src/traces/funnelarea/plot.js b/src/traces/funnelarea/plot.js index 672835bc456..0e683d9bdb8 100644 --- a/src/traces/funnelarea/plot.js +++ b/src/traces/funnelarea/plot.js @@ -12,6 +12,8 @@ var d3 = require('d3'); var Drawing = require('../../components/drawing'); var Lib = require('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = require('../../lib/svg_text_utils'); var barPlot = require('../bar/plot'); @@ -167,9 +169,9 @@ module.exports = function plot(gd, cdModule) { var transform = positionTitleOutside(cd0, fullLayout._size); titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); }); }); diff --git a/src/traces/heatmap/attributes.js b/src/traces/heatmap/attributes.js index c4e9770930f..d6c6093112c 100644 --- a/src/traces/heatmap/attributes.js +++ b/src/traces/heatmap/attributes.js @@ -29,6 +29,13 @@ module.exports = extendFlat({ y0: extendFlat({}, scatterAttrs.y0, {impliedEdits: {ytype: 'scaled'}}), dy: extendFlat({}, scatterAttrs.dy, {impliedEdits: {ytype: 'scaled'}}), + xperiod: extendFlat({}, scatterAttrs.xperiod, {impliedEdits: {xtype: 'scaled'}}), + yperiod: extendFlat({}, scatterAttrs.yperiod, {impliedEdits: {ytype: 'scaled'}}), + xperiod0: extendFlat({}, scatterAttrs.xperiod0, {impliedEdits: {xtype: 'scaled'}}), + yperiod0: extendFlat({}, scatterAttrs.yperiod0, {impliedEdits: {ytype: 'scaled'}}), + xperiodalignment: extendFlat({}, scatterAttrs.xperiodalignment, {impliedEdits: {xtype: 'scaled'}}), + yperiodalignment: extendFlat({}, scatterAttrs.yperiodalignment, {impliedEdits: {ytype: 'scaled'}}), + text: { valType: 'data_array', editType: 'calc', diff --git a/src/traces/heatmap/calc.js b/src/traces/heatmap/calc.js index 0f8f0c50f95..5e83bfb8d00 100644 --- a/src/traces/heatmap/calc.js +++ b/src/traces/heatmap/calc.js @@ -11,6 +11,7 @@ var Registry = require('../../registry'); var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); +var alignPeriod = require('../../plots/cartesian/align_period'); var histogram2dCalc = require('../histogram2d/calc'); var colorscaleCalc = require('../../components/colorscale/calc'); @@ -30,15 +31,9 @@ module.exports = function calc(gd, trace) { var isHist = Registry.traceIs(trace, 'histogram'); var isGL2D = Registry.traceIs(trace, 'gl2d'); var zsmooth = isContour ? 'best' : trace.zsmooth; - var x; - var x0; - var dx; - var y; - var y0; - var dy; - var z; - var i; - var binned; + var x, x0, dx, origX; + var y, y0, dy, origY; + var z, i, binned; // cancel minimum tick spacings (only applies to bars and boxes) xa._minDtick = 0; @@ -46,12 +41,16 @@ module.exports = function calc(gd, trace) { if(isHist) { binned = histogram2dCalc(gd, trace); + origX = binned.orig_x; x = binned.x; x0 = binned.x0; dx = binned.dx; + + origY = binned.orig_y; y = binned.y; y0 = binned.y0; dy = binned.dy; + z = binned.z; } else { var zIn = trace.z; @@ -61,8 +60,12 @@ module.exports = function calc(gd, trace) { y = trace._y; zIn = trace._z; } else { - x = trace._x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace._y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + origX = trace.x ? xa.makeCalcdata(trace, 'x') : []; + origY = trace.y ? ya.makeCalcdata(trace, 'y') : []; + x = alignPeriod(trace, xa, 'x', origX); + y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; } x0 = trace.x0; @@ -144,6 +147,13 @@ module.exports = function calc(gd, trace) { hovertext: trace._hovertext || trace.hovertext }; + if(trace.xperiodalignment && origX) { + cd0.orig_x = origX; + } + if(trace.yperiodalignment && origY) { + cd0.orig_y = origY; + } + if(xIn && xIn.length === xArray.length - 1) cd0.xCenter = xIn; if(yIn && yIn.length === yArray.length - 1) cd0.yCenter = yIn; diff --git a/src/traces/heatmap/convert_column_xyz.js b/src/traces/heatmap/convert_column_xyz.js index ab5f180f7fa..5818e8d69f0 100644 --- a/src/traces/heatmap/convert_column_xyz.js +++ b/src/traces/heatmap/convert_column_xyz.js @@ -11,11 +11,15 @@ var Lib = require('../../lib'); var BADNUM = require('../../constants/numerical').BADNUM; +var alignPeriod = require('../../plots/cartesian/align_period'); module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, arrayVarNames) { var colLen = trace._length; var col1 = ax1.makeCalcdata(trace, var1Name); var col2 = ax2.makeCalcdata(trace, var2Name); + col1 = alignPeriod(trace, ax1, var1Name, col1); + col2 = alignPeriod(trace, ax2, var2Name, col2); + var textCol = trace.text; var hasColumnText = (textCol !== undefined && Lib.isArray1D(textCol)); var hoverTextCol = trace.hovertext; diff --git a/src/traces/heatmap/defaults.js b/src/traces/heatmap/defaults.js index b3fda9d8c9b..360ce5531a3 100644 --- a/src/traces/heatmap/defaults.js +++ b/src/traces/heatmap/defaults.js @@ -12,6 +12,7 @@ var Lib = require('../../lib'); var handleXYZDefaults = require('./xyz_defaults'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var handleStyleDefaults = require('./style_defaults'); var colorscaleDefaults = require('../../components/colorscale/defaults'); var attributes = require('./attributes'); @@ -28,6 +29,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('text'); coerce('hovertext'); coerce('hovertemplate'); diff --git a/src/traces/heatmap/hover.js b/src/traces/heatmap/hover.js index 86c2a42c6f3..4f9f5131b9a 100644 --- a/src/traces/heatmap/hover.js +++ b/src/traces/heatmap/hover.js @@ -70,14 +70,21 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, hoverLay var y0 = ya.c2p(y[ny]); var y1 = ya.c2p(y[ny + 1]); + var _x, _y; if(contour) { + _x = cd0.orig_x || x; + _y = cd0.orig_y || y; + x1 = x0; - xl = x[nx]; + xl = _x[nx]; y1 = y0; - yl = y[ny]; + yl = _y[ny]; } else { - xl = xc ? xc[nx] : ((x[nx] + x[nx + 1]) / 2); - yl = yc ? yc[ny] : ((y[ny] + y[ny + 1]) / 2); + _x = cd0.orig_x || xc || x; + _y = cd0.orig_y || yc || y; + + xl = xc ? _x[nx] : ((_x[nx] + _x[nx + 1]) / 2); + yl = yc ? _y[ny] : ((_y[ny] + _y[ny + 1]) / 2); if(xa && xa.type === 'category') xl = x[nx]; if(ya && ya.type === 'category') yl = y[ny]; diff --git a/src/traces/histogram/cross_trace_defaults.js b/src/traces/histogram/cross_trace_defaults.js index 906bac67a8c..d900b44f95c 100644 --- a/src/traces/histogram/cross_trace_defaults.js +++ b/src/traces/histogram/cross_trace_defaults.js @@ -15,7 +15,7 @@ var traceIs = require('../../registry').traceIs; var handleGroupingDefaults = require('../bar/defaults').handleGroupingDefaults; var nestedProperty = Lib.nestedProperty; -var getAxisGroup = axisIds.getAxisGroup; +var getAxisGroup = require('../../plots/cartesian/constraints').getAxisGroup; var BINATTRS = [ {aStr: {x: 'xbins.start', y: 'ybins.start'}, name: 'start'}, @@ -174,10 +174,9 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) { } var binGroupFound = false; - for(i = 0; i < traces.length; i++) { - traceOut = traces[i]; + if(traces.length) { + traceOut = traces[0]; binGroupFound = coerce('bingroup'); - break; } groupName = binGroupFound || groupName; diff --git a/src/traces/image/calc.js b/src/traces/image/calc.js index cfdf3e4b75e..9fa27fbb8b5 100644 --- a/src/traces/image/calc.js +++ b/src/traces/image/calc.js @@ -13,9 +13,7 @@ var constants = require('./constants'); var isNumeric = require('fast-isnumeric'); var Axes = require('../../plots/cartesian/axes'); var maxRowLength = require('../../lib').maxRowLength; -var sizeOf = require('image-size'); -var dataUri = require('../../snapshot/helpers').IMAGE_URL_PREFIX; -var Buffer = require('buffer/').Buffer; // note: the trailing slash is important! +var getImageSize = require('./helpers').getImageSize; module.exports = function calc(gd, trace) { var h; @@ -96,10 +94,3 @@ function makeScaler(trace) { return c; }; } - -// Get image size -function getImageSize(src) { - var data = src.replace(dataUri, ''); - var buff = new Buffer(data, 'base64'); - return sizeOf(buff); -} diff --git a/src/traces/image/helpers.js b/src/traces/image/helpers.js new file mode 100644 index 00000000000..1fd442c364b --- /dev/null +++ b/src/traces/image/helpers.js @@ -0,0 +1,19 @@ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var sizeOf = require('image-size'); +var dataUri = require('../../snapshot/helpers').IMAGE_URL_PREFIX; +var Buffer = require('buffer/').Buffer; // note: the trailing slash is important! + +exports.getImageSize = function(src) { + var data = src.replace(dataUri, ''); + var buff = new Buffer(data, 'base64'); + return sizeOf(buff); +}; diff --git a/src/traces/image/plot.js b/src/traces/image/plot.js index c5a85c3af8f..60bc5a6cc2d 100644 --- a/src/traces/image/plot.js +++ b/src/traces/image/plot.js @@ -10,17 +10,12 @@ var d3 = require('d3'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); var constants = require('./constants'); var unsupportedBrowsers = Lib.isIOS() || Lib.isSafari() || Lib.isIE(); -function compatibleAxis(ax) { - return ax.type === 'linear' && - // y axis must be reversed but x axis mustn't be - ((ax.range[1] > ax.range[0]) === (ax._id.charAt(0) === 'x')); -} - module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { var xa = plotinfo.xaxis; var ya = plotinfo.yaxis; @@ -31,7 +26,7 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { var plotGroup = d3.select(this); var cd0 = cd[0]; var trace = cd0.trace; - var fastImage = supportsPixelatedImage && !trace._hasZ && trace._hasSource && compatibleAxis(xa) && compatibleAxis(ya); + var fastImage = supportsPixelatedImage && !trace._hasZ && trace._hasSource && xa.type === 'linear' && ya.type === 'linear'; trace._fastImage = fastImage; var z = cd0.z; @@ -144,8 +139,23 @@ module.exports = function plot(gd, plotinfo, cdimage, imageLayer) { // Pixelated image rendering // http://phrogz.net/tmp/canvas_image_zoom.html // https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering - image3 - .attr('style', 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;'); + var style = 'image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;'; + if(fastImage) { + var xRange = Lib.simpleMap(xa.range, xa.r2l); + var yRange = Lib.simpleMap(ya.range, ya.r2l); + + var flipX = xRange[1] < xRange[0]; + var flipY = yRange[1] > yRange[0]; + if(flipX || flipY) { + var tx = left + imageWidth / 2; + var ty = top + imageHeight / 2; + style += 'transform:' + + strTranslate(tx + 'px', ty + 'px') + + 'scale(' + (flipX ? -1 : 1) + ',' + (flipY ? -1 : 1) + ')' + + strTranslate(-tx + 'px', -ty + 'px') + ';'; + } + } + image3.attr('style', style); var p = new Promise(function(resolve) { if(trace._hasZ) { diff --git a/src/traces/indicator/attributes.js b/src/traces/indicator/attributes.js index e9bd0ab5c92..452f9665f1a 100644 --- a/src/traces/indicator/attributes.js +++ b/src/traces/indicator/attributes.js @@ -355,6 +355,7 @@ module.exports = { showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, + minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, editType: 'plot' }, 'plot'), diff --git a/src/traces/indicator/plot.js b/src/traces/indicator/plot.js index 96ef6de708b..d3a8c96f0ee 100644 --- a/src/traces/indicator/plot.js +++ b/src/traces/indicator/plot.js @@ -11,6 +11,8 @@ var d3 = require('d3'); var Lib = require('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var rad2deg = Lib.rad2deg; var MID_SHIFT = require('../../constants/alignment').MID_SHIFT; var Drawing = require('../../components/drawing'); @@ -243,7 +245,7 @@ function drawBulletGauge(gd, plotGroup, cd, opts) { // Enter bullet, axis bullet.enter().append('g').classed('bullet', true); - bullet.attr('transform', 'translate(' + size.l + ', ' + size.t + ')'); + bullet.attr('transform', strTranslate(size.l, size.t)); axisLayer.enter().append('g') .classed('bulletaxis', true) @@ -262,7 +264,7 @@ function drawBulletGauge(gd, plotGroup, cd, opts) { ax.setScale(); vals = Axes.calcTicks(ax); - transFn = Axes.makeTransFn(ax); + transFn = Axes.makeTransTickFn(ax); tickSign = Axes.getTickSigns(ax)[2]; shift = size.t + size.h; @@ -780,7 +782,7 @@ function drawNumbers(gd, plotGroup, cd, opts) { // Stash translateX translateX = cache(trace, 'numbersTranslate', 0, translateX, key, Math.max); - return strTranslate(translateX, translateY) + ' scale(' + scaleRatio + ')'; + return strTranslate(translateX, translateY) + strScale(scaleRatio); }); } } @@ -837,10 +839,6 @@ function mockAxis(gd, opts, zrange) { return axisOut; } -function strTranslate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} - function fitTextInsideBox(textBB, width, height) { // compute scaling ratio to have text fit within specified width and height var ratio = Math.min(width / textBB.width, height / textBB.height); diff --git a/src/traces/ohlc/attributes.js b/src/traces/ohlc/attributes.js index 9d36ec76173..c09f86206a8 100644 --- a/src/traces/ohlc/attributes.js +++ b/src/traces/ohlc/attributes.js @@ -34,6 +34,10 @@ function directionAttrs(lineColorDefault) { module.exports = { + xperiod: scatterAttrs.xperiod, + xperiod0: scatterAttrs.xperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + x: { valType: 'data_array', editType: 'calc+clearAxisTypes', diff --git a/src/traces/ohlc/calc.js b/src/traces/ohlc/calc.js index f90153c537a..c02617c8f0b 100644 --- a/src/traces/ohlc/calc.js +++ b/src/traces/ohlc/calc.js @@ -11,6 +11,7 @@ var Lib = require('../../lib'); var _ = Lib._; var Axes = require('../../plots/cartesian/axes'); +var alignPeriod = require('../../plots/cartesian/align_period'); var BADNUM = require('../../constants/numerical').BADNUM; function calc(gd, trace) { @@ -20,10 +21,12 @@ function calc(gd, trace) { var tickLen = convertTickWidth(gd, xa, trace); var minDiff = trace._minDiff; trace._minDiff = null; + var origX = trace._origX; + trace._origX = null; var x = trace._xcalc; trace._xcalc = null; - var cd = calcCommon(gd, trace, x, ya, ptFunc); + var cd = calcCommon(gd, trace, origX, x, ya, ptFunc); trace._extremes[xa._id] = Axes.findExtremes(xa, x, {vpad: minDiff / 2}); if(cd.length) { @@ -49,7 +52,7 @@ function ptFunc(o, h, l, c) { // shared between OHLC and candlestick // ptFunc makes a calcdata point specific to each trace type, from oi, hi, li, ci -function calcCommon(gd, trace, x, ya, ptFunc) { +function calcCommon(gd, trace, origX, x, ya, ptFunc) { var o = ya.makeCalcdata(trace, 'open'); var h = ya.makeCalcdata(trace, 'high'); var l = ya.makeCalcdata(trace, 'low'); @@ -62,6 +65,8 @@ function calcCommon(gd, trace, x, ya, ptFunc) { var increasing = true; var cPrev = null; + var hasPeriod = !!trace.xperiodalignment; + var cd = []; for(var i = 0; i < x.length; i++) { var xi = x[i]; @@ -90,6 +95,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) { pt.x = pt.pos; pt.y = [li, hi]; + if(hasPeriod) pt.orig_p = origX[i]; // used by hover if(hasTextArray) pt.tx = trace.text[i]; if(hasHovertextArray) pt.htx = trace.hovertext[i]; @@ -121,7 +127,7 @@ function calcCommon(gd, trace, x, ya, ptFunc) { * in all traces; when a trace uses this in its * calc step it deletes _minDiff, so that next calc this is * done again in case the data changed. - * also since we need it here, stash _xcalc on the trace + * also since we need it here, stash _xcalc (and _origX) on the trace */ function convertTickWidth(gd, xa, trace) { var minDiff = trace._minDiff; @@ -143,7 +149,10 @@ function convertTickWidth(gd, xa, trace) { ) { ohlcTracesOnThisXaxis.push(tracei); - var xcalc = xa.makeCalcdata(tracei, 'x'); + var origX = xa.makeCalcdata(tracei, 'x'); + tracei._origX = origX; + + var xcalc = alignPeriod(trace, xa, 'x', origX); tracei._xcalc = xcalc; var _minDiff = Lib.distinctVals(xcalc).minDiff; diff --git a/src/traces/ohlc/defaults.js b/src/traces/ohlc/defaults.js index 78f22e790f0..21f44d89374 100644 --- a/src/traces/ohlc/defaults.js +++ b/src/traces/ohlc/defaults.js @@ -11,6 +11,7 @@ var Lib = require('../../lib'); var handleOHLC = require('./ohlc_defaults'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var attributes = require('./attributes'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { @@ -24,6 +25,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce, {x: true}); + coerce('line.width'); coerce('line.dash'); diff --git a/src/traces/ohlc/hover.js b/src/traces/ohlc/hover.js index c11cfeec77b..6f138b41df1 100644 --- a/src/traces/ohlc/hover.js +++ b/src/traces/ohlc/hover.js @@ -88,7 +88,7 @@ function getClosestPoint(pointData, xval, yval, hovermode) { pointData.x0 = xa.c2p(di.pos + centerShift - displayHalfWidth, true); pointData.x1 = xa.c2p(di.pos + centerShift + displayHalfWidth, true); - pointData.xLabelVal = di.pos; + pointData.xLabelVal = di.orig_p !== undefined ? di.orig_p : di.pos; pointData.spikeDistance = dxy(di) * spikePseudoDistance / hoverPseudoDistance; pointData.xSpike = xa.c2p(di.pos, true); diff --git a/src/traces/parcats/parcats.js b/src/traces/parcats/parcats.js index a5fc1a60659..733fa32fa0f 100644 --- a/src/traces/parcats/parcats.js +++ b/src/traces/parcats/parcats.js @@ -12,6 +12,7 @@ var d3 = require('d3'); var Plotly = require('../../plot_api/plot_api'); var Fx = require('../../components/fx'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var Drawing = require('../../components/drawing'); var tinycolor = require('tinycolor2'); var svgTextUtils = require('../../lib/svg_text_utils'); @@ -41,7 +42,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update properties for each trace traceSelection .attr('transform', function(d) { - return 'translate(' + d.x + ', ' + d.y + ')'; + return strTranslate(d.x, d.y); }); // Initialize paths group @@ -122,7 +123,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update dimension group transforms dimensionSelection.attr('transform', function(d) { - return 'translate(' + d.x + ', 0)'; + return strTranslate(d.x, 0); }); // Remove any old dimensions @@ -144,7 +145,7 @@ function performPlot(parcatsModels, graphDiv, layout, svg) { // Update category transforms categorySelection .attr('transform', function(d) { - return 'translate(0, ' + d.y + ')'; + return strTranslate(0, d.y); }); @@ -765,7 +766,11 @@ function emitPointsEventColorHovermode(bandElement, eventName, event) { * HTML element for band * */ -function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { +function createHoverLabelForCategoryHovermode(gd, rootBBox, bandElement) { + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + // Selections var rectSelection = d3.select(bandElement.parentNode).select('rect.catrect'); var rectBoundingBox = rectSelection.node().getBoundingClientRect(); @@ -813,8 +818,8 @@ function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { var hovertext = hoverinfoParts.join('
'); return { trace: trace, - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, + x: scaleX * (hoverCenterX - rootBBox.left), + y: scaleY * (hoverCenterY - rootBBox.top), text: hovertext, color: 'lightgray', borderColor: 'black', @@ -843,7 +848,7 @@ function createHoverLabelForCategoryHovermode(rootBBox, bandElement) { * HTML element for band * */ -function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { +function createHoverLabelForDimensionHovermode(gd, rootBBox, bandElement) { var allHoverlabels = []; d3.select(bandElement.parentNode.parentNode) @@ -851,7 +856,7 @@ function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { .select('rect.catrect') .each(function() { var bandNode = this; - allHoverlabels.push(createHoverLabelForCategoryHovermode(rootBBox, bandNode)); + allHoverlabels.push(createHoverLabelForCategoryHovermode(gd, rootBBox, bandNode)); }); return allHoverlabels; @@ -866,7 +871,11 @@ function createHoverLabelForDimensionHovermode(rootBBox, bandElement) { * HTML element for band * */ -function createHoverLabelForColorHovermode(rootBBox, bandElement) { +function createHoverLabelForColorHovermode(gd, rootBBox, bandElement) { + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var bandBoundingBox = bandElement.getBoundingClientRect(); // Models @@ -944,8 +953,8 @@ function createHoverLabelForColorHovermode(rootBBox, bandElement) { return { trace: trace, - x: hoverCenterX - rootBBox.left, - y: hoverCenterY - rootBBox.top, + x: scaleX * (hoverCenterX - rootBBox.left), + y: scaleY * (hoverCenterY - rootBBox.top), // name: 'NAME', text: hovertext, color: bandViewModel.color, @@ -1008,11 +1017,11 @@ function mouseoverCategoryBand(bandViewModel) { if(bandViewModel.parcatsViewModel.hoverinfoItems.indexOf('none') === -1) { var hoverItems; if(hoveron === 'category') { - hoverItems = createHoverLabelForCategoryHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForCategoryHovermode(gd, rootBBox, bandElement); } else if(hoveron === 'color') { - hoverItems = createHoverLabelForColorHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForColorHovermode(gd, rootBBox, bandElement); } else if(hoveron === 'dimension') { - hoverItems = createHoverLabelForDimensionHovermode(rootBBox, bandElement); + hoverItems = createHoverLabelForDimensionHovermode(gd, rootBBox, bandElement); } if(hoverItems) { @@ -1401,13 +1410,13 @@ function updateSvgCategories(parcatsViewModel, hasTransition) { // Update dimension position transition(parcatsViewModel.dimensionSelection) .attr('transform', function(d) { - return 'translate(' + d.x + ', 0)'; + return strTranslate(d.x, 0); }); // Update category position transition(categorySelection) .attr('transform', function(d) { - return 'translate(0, ' + d.y + ')'; + return strTranslate(0, d.y); }); var dimLabelSelection = categorySelection.select('.dimlabel'); diff --git a/src/traces/parcoords/axisbrush.js b/src/traces/parcoords/axisbrush.js index 09578b6a517..0c7c45d8f63 100644 --- a/src/traces/parcoords/axisbrush.js +++ b/src/traces/parcoords/axisbrush.js @@ -13,6 +13,7 @@ var d3 = require('d3'); var keyFun = require('../../lib/gup').keyFun; var repeat = require('../../lib/gup').repeat; var sortAsc = require('../../lib').sorterAsc; +var strTranslate = require('../../lib').strTranslate; var snapRatio = c.bar.snapRatio; function snapOvershoot(v, vAdjacent) { return v * (1 - snapRatio) + vAdjacent * snapRatio; } @@ -370,7 +371,7 @@ function renderAxisBrush(axisBrush) { .call(barHorizontalSetup) .call(backgroundBarHorizontalSetup) .style('pointer-events', 'auto') // parent pointer events are disabled; we must have it to register events - .attr('transform', 'translate(0 ' + c.verticalPadding + ')'); + .attr('transform', strTranslate(0, c.verticalPadding)); background .call(attachDragBehavior) diff --git a/src/traces/parcoords/parcoords.js b/src/traces/parcoords/parcoords.js index d314f9ad4c8..f31b0e7dbfb 100644 --- a/src/traces/parcoords/parcoords.js +++ b/src/traces/parcoords/parcoords.js @@ -13,6 +13,8 @@ var rgba = require('color-rgba'); var Axes = require('../../plots/cartesian/axes'); var Lib = require('../../lib'); +var strRotate = Lib.strRotate; +var strTranslate = Lib.strTranslate; var svgTextUtils = require('../../lib/svg_text_utils'); var Drawing = require('../../components/drawing'); var Colorscale = require('../../components/colorscale'); @@ -350,8 +352,7 @@ function styleExtentTexts(selection) { selection .classed(c.cn.axisExtentText, true) .attr('text-anchor', 'middle') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); } function parcoordsInteractionState() { @@ -519,7 +520,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .style('pointer-events', 'none'); controlOverlay.attr('transform', function(d) { - return 'translate(' + d.model.translateX + ',' + d.model.translateY + ')'; + return strTranslate(d.model.translateX, d.model.translateY); }); var parcoordsControlView = controlOverlay.selectAll('.' + c.cn.parcoordsControlView) @@ -530,7 +531,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.parcoordsControlView, true); parcoordsControlView.attr('transform', function(d) { - return 'translate(' + d.model.pad.l + ',' + d.model.pad.t + ')'; + return strTranslate(d.model.pad.l, d.model.pad.t); }); var yAxis = parcoordsControlView.selectAll('.' + c.cn.yAxis) @@ -561,7 +562,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { }); yAxis.attr('transform', function(d) { - return 'translate(' + d.xScale(d.xIndex) + ', 0)'; + return strTranslate(d.xScale(d.xIndex), 0); }); // drag column for reordering columns @@ -583,8 +584,8 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { updatePanelLayout(yAxis, p); yAxis.filter(function(e) { return Math.abs(d.xIndex - e.xIndex) !== 0; }) - .attr('transform', function(d) { return 'translate(' + d.xScale(d.xIndex) + ', 0)'; }); - d3.select(this).attr('transform', 'translate(' + d.x + ', 0)'); + .attr('transform', function(d) { return strTranslate(d.xScale(d.xIndex), 0); }); + d3.select(this).attr('transform', strTranslate(d.x, 0)); yAxis.each(function(e, i0, i1) { if(i1 === d.parent.key) p.dimensions[i0] = e; }); p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); p.focusLayer.render && p.focusLayer.render(p.panels); @@ -595,7 +596,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { d.canvasX = d.x * d.model.canvasPixelRatio; updatePanelLayout(yAxis, p); d3.select(this) - .attr('transform', function(d) { return 'translate(' + d.x + ', 0)'; }); + .attr('transform', function(d) { return strTranslate(d.x, 0); }); p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p)); p.focusLayer && p.focusLayer.render(p.panels); p.pickLayer && p.pickLayer.render(p.panels, true); @@ -655,8 +656,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axis.selectAll('text') .style('text-shadow', '1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff') - .style('cursor', 'default') - .style('user-select', 'none'); + .style('cursor', 'default'); var axisHeading = axisOverlays.selectAll('.' + c.cn.axisHeading) .data(repeat, keyFun); @@ -673,7 +673,6 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisTitle, true) .attr('text-anchor', 'middle') .style('cursor', 'ew-resize') - .style('user-select', 'none') .style('pointer-events', 'auto'); axisTitle @@ -687,9 +686,9 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { var tilt = calcTilt(d.model.labelAngle, d.model.labelSide); var r = c.axisTitleOffset; return ( - (tilt.dir > 0 ? '' : 'translate(0,' + (2 * r + d.model.height) + ')') + - 'rotate(' + tilt.degrees + ')' + - 'translate(' + (-r * tilt.dx) + ',' + (-r * tilt.dy) + ')' + (tilt.dir > 0 ? '' : strTranslate(0, 2 * r + d.model.height)) + + strRotate(tilt.degrees) + + strTranslate(-r * tilt.dx, -r * tilt.dy) ); }) .attr('text-anchor', function(d) { @@ -719,7 +718,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { .classed(c.cn.axisExtentTop, true); axisExtentTop - .attr('transform', 'translate(' + 0 + ',' + -c.axisExtentOffset + ')'); + .attr('transform', strTranslate(0, -c.axisExtentOffset)); var axisExtentTopText = axisExtentTop.selectAll('.' + c.cn.axisExtentTopText) .data(repeat, keyFun); @@ -742,7 +741,7 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) { axisExtentBottom .attr('transform', function(d) { - return 'translate(' + 0 + ',' + (d.model.height + c.axisExtentOffset) + ')'; + return strTranslate(0, d.model.height + c.axisExtentOffset); }); var axisExtentBottomText = axisExtentBottom.selectAll('.' + c.cn.axisExtentBottomText) diff --git a/src/traces/pie/helpers.js b/src/traces/pie/helpers.js index 1bac7dffda2..0131283c9bd 100644 --- a/src/traces/pie/helpers.js +++ b/src/traces/pie/helpers.js @@ -10,19 +10,21 @@ var Lib = require('../../lib'); +function format(vRounded) { + return ( + vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') : + vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') : + vRounded + ); +} + exports.formatPiePercent = function formatPiePercent(v, separators) { - var vRounded = (v * 100).toPrecision(3); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + '%'; }; exports.formatPieValue = function formatPieValue(v, separators) { - var vRounded = v.toPrecision(10); - if(vRounded.lastIndexOf('.') !== -1) { - vRounded = vRounded.replace(/[.]?0+$/, ''); - } + var vRounded = format(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; @@ -38,3 +40,7 @@ exports.castOption = function castOption(item, indices) { if(Array.isArray(item)) return exports.getFirstFilled(item, indices); else if(item) return item; }; + +exports.getRotationAngle = function(rotation) { + return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180; +}; diff --git a/src/traces/pie/plot.js b/src/traces/pie/plot.js index 9dd866c04f0..a38b69f8d49 100644 --- a/src/traces/pie/plot.js +++ b/src/traces/pie/plot.js @@ -15,6 +15,8 @@ var Fx = require('../../components/fx'); var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var Lib = require('../../lib'); +var strScale = Lib.strScale; +var strTranslate = Lib.strTranslate; var svgTextUtils = require('../../lib/svg_text_utils'); var uniformText = require('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; @@ -244,9 +246,9 @@ function plot(gd, cdModule) { } titleText.attr('transform', - 'translate(' + transform.x + ',' + transform.y + ')' + - (transform.scale < 1 ? ('scale(' + transform.scale + ')') : '') + - 'translate(' + transform.tx + ',' + transform.ty + ')'); + strTranslate(transform.x, transform.y) + + strScale(Math.min(1, transform.scale)) + + strTranslate(transform.tx, transform.ty)); }); // now make sure no labels overlap (at least within one pie) @@ -1045,7 +1047,7 @@ function setCoords(cd) { var cd0 = cd[0]; var r = cd0.r; var trace = cd0.trace; - var currentAngle = trace.rotation * Math.PI / 180; + var currentAngle = helpers.getRotationAngle(trace.rotation); var angleFactor = 2 * Math.PI / cd0.vTotal; var firstPt = 'px0'; var lastPt = 'px1'; diff --git a/src/traces/sankey/plot.js b/src/traces/sankey/plot.js index d85a2da7b7b..6d6abb157a6 100644 --- a/src/traces/sankey/plot.js +++ b/src/traces/sankey/plot.js @@ -292,10 +292,14 @@ module.exports = function plot(gd, calcData) { var hovertemplateLabels = {valueLabel: d3.format(d.valueFormat)(d.node.value) + d.valueSuffix}; d.node.fullData = d.node.trace; + gd._fullLayout._calcInverseTransform(gd); + var scaleX = gd._fullLayout._invScaleX; + var scaleY = gd._fullLayout._invScaleY; + var tooltip = Fx.loneHover({ - x0: hoverCenterX0, - x1: hoverCenterX1, - y: hoverCenterY, + x0: scaleX * hoverCenterX0, + x1: scaleX * hoverCenterX1, + y: scaleY * hoverCenterY, name: d3.format(d.valueFormat)(d.node.value) + d.valueSuffix, text: [ d.node.label, diff --git a/src/traces/sankey/render.js b/src/traces/sankey/render.js index 031d31ebdb1..b9e570a5849 100644 --- a/src/traces/sankey/render.js +++ b/src/traces/sankey/render.js @@ -17,6 +17,7 @@ var d3Sankey = require('@plotly/d3-sankey'); var d3SankeyCircular = require('@plotly/d3-sankey-circular'); var d3Force = require('d3-force'); var Lib = require('../../lib'); +var strTranslate = Lib.strTranslate; var gup = require('../../lib/gup'); var keyFun = gup.keyFun; var repeat = gup.repeat; @@ -527,7 +528,7 @@ function nodeModel(d, n) { function updateNodePositions(sankeyNode) { sankeyNode .attr('transform', function(d) { - return 'translate(' + d.node.x0.toFixed(3) + ', ' + (d.node.y0).toFixed(3) + ')'; + return strTranslate(d.node.x0.toFixed(3), (d.node.y0).toFixed(3)); }); } @@ -549,12 +550,12 @@ function sizeNode(rect) { function salientEnough(d) {return (d.link.width > 1 || d.linkLineWidth > 0);} function sankeyTransform(d) { - var offset = 'translate(' + d.translateX + ',' + d.translateY + ')'; + var offset = strTranslate(d.translateX, d.translateY); return offset + (d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)'); } function nodeCentering(d) { - return 'translate(' + (d.horizontal ? 0 : d.labelY) + ' ' + (d.horizontal ? d.labelY : 0) + ')'; + return strTranslate(d.horizontal ? 0 : d.labelY, d.horizontal ? d.labelY : 0); } function textGuidePath(d) { @@ -1026,7 +1027,6 @@ module.exports = function(gd, svg, calcData, layout, callbacks) { .append('text') .classed(c.cn.nodeLabel, true) .attr('transform', textFlip) - .style('user-select', 'none') .style('cursor', 'default') .style('fill', 'black'); diff --git a/src/traces/scatter/attributes.js b/src/traces/scatter/attributes.js index 780ae61a8b3..d7e5ef20e04 100644 --- a/src/traces/scatter/attributes.js +++ b/src/traces/scatter/attributes.js @@ -16,8 +16,55 @@ var dash = require('../../components/drawing/attributes').dash; var Drawing = require('../../components/drawing'); var constants = require('./constants'); + var extendFlat = require('../../lib/extend').extendFlat; +function axisPeriod(axis) { + return { + valType: 'any', + dflt: 0, + role: 'info', + editType: 'calc', + description: [ + 'Only relevant when the axis `type` is *date*.', + 'Sets the period positioning in milliseconds or *M* on the ' + axis + ' axis.', + 'Special values in the form of *M* could be used to declare', + 'the number of months. In this case `n` must be a positive integer.' + ].join(' ') + }; +} + +function axisPeriod0(axis) { + return { + valType: 'any', + role: 'info', + editType: 'calc', + description: [ + 'Only relevant when the axis `type` is *date*.', + 'Sets the base for period positioning in milliseconds or date string on the ' + axis + ' axis.', + 'When `' + axis + 'period` is round number of weeks,', + 'the `' + axis + 'period0` by default would be on a Sunday i.e. 2000-01-02,', + 'otherwise it would be at 2000-01-01.' + ].join(' ') + }; +} + +function axisPeriodAlignment(axis) { + return { + valType: 'enumerated', + values: [ + 'start', 'middle', 'end' + ], + dflt: 'middle', + role: 'style', + editType: 'calc', + description: [ + 'Only relevant when the axis `type` is *date*.', + 'Sets the alignment of data points on the ' + axis + ' axis.' + ].join(' ') + }; +} + module.exports = { x: { valType: 'data_array', @@ -80,6 +127,13 @@ module.exports = { ].join(' ') }, + xperiod: axisPeriod('x'), + yperiod: axisPeriod('y'), + xperiod0: axisPeriod0('x0'), + yperiod0: axisPeriod0('y0'), + xperiodalignment: axisPeriodAlignment('x'), + yperiodalignment: axisPeriodAlignment('y'), + stackgroup: { valType: 'string', role: 'info', diff --git a/src/traces/scatter/calc.js b/src/traces/scatter/calc.js index 7b82a397562..59ae9466434 100644 --- a/src/traces/scatter/calc.js +++ b/src/traces/scatter/calc.js @@ -12,6 +12,7 @@ var isNumeric = require('fast-isnumeric'); var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); +var alignPeriod = require('../../plots/cartesian/align_period'); var BADNUM = require('../../constants/numerical').BADNUM; var subTypes = require('./subtypes'); @@ -23,8 +24,11 @@ function calc(gd, trace) { var fullLayout = gd._fullLayout; var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var x = xa.makeCalcdata(trace, 'x'); - var y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + var serieslen = trace._length; var cd = new Array(serieslen); var ids = trace.ids; @@ -55,6 +59,9 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } + var hasPeriodX = !!trace.xperiodalignment; + var hasPeriodY = !!trace.yperiodalignment; + for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -62,6 +69,13 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; + + if(hasPeriodX) { + cdi.orig_x = origX[i]; // used by hover + } + if(hasPeriodY) { + cdi.orig_y = origY[i]; // used by hover + } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes diff --git a/src/traces/scatter/defaults.js b/src/traces/scatter/defaults.js index 08758d76181..a69c5675999 100644 --- a/src/traces/scatter/defaults.js +++ b/src/traces/scatter/defaults.js @@ -15,6 +15,7 @@ var attributes = require('./attributes'); var constants = require('./constants'); var subTypes = require('./subtypes'); var handleXYDefaults = require('./xy_defaults'); +var handlePeriodDefaults = require('./period_defaults'); var handleStackDefaults = require('./stack_defaults'); var handleMarkerDefaults = require('./marker_defaults'); var handleLineDefaults = require('./line_defaults'); @@ -32,6 +33,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!traceOut.visible) return; + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ? diff --git a/src/traces/scatter/hover.js b/src/traces/scatter/hover.js index b481dc3ca19..e6ca5f9bbc1 100644 --- a/src/traces/scatter/hover.js +++ b/src/traces/scatter/hover.js @@ -78,8 +78,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), diff --git a/src/traces/scatter/period_defaults.js b/src/traces/scatter/period_defaults.js new file mode 100644 index 00000000000..474784ed365 --- /dev/null +++ b/src/traces/scatter/period_defaults.js @@ -0,0 +1,45 @@ +/** +* Copyright 2012-2020, Plotly, Inc. +* All rights reserved. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +'use strict'; + +var dateTick0 = require('../../lib').dateTick0; +var numConstants = require('../../constants/numerical'); +var ONEWEEK = numConstants.ONEWEEK; + +function getPeriod0Dflt(period, calendar) { + if(period % ONEWEEK === 0) { + return dateTick0(calendar, 1); // Sunday + } + return dateTick0(calendar, 0); +} + +module.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { + if(!opts) { + opts = { + x: true, + y: true + }; + } + + if(opts.x) { + var xperiod = coerce('xperiod'); + if(xperiod) { + coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar)); + coerce('xperiodalignment'); + } + } + + if(opts.y) { + var yperiod = coerce('yperiod'); + if(yperiod) { + coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar)); + coerce('yperiodalignment'); + } + } +}; diff --git a/src/traces/scatter3d/convert.js b/src/traces/scatter3d/convert.js index a5ab89ceef5..2e82ee0259d 100644 --- a/src/traces/scatter3d/convert.js +++ b/src/traces/scatter3d/convert.js @@ -331,11 +331,11 @@ function convertPlotlyOptions(scene, data) { return params; } -function arrayToColor(color) { - if(Array.isArray(color)) { +function _arrayToColor(color) { + if(Lib.isArrayOrTypedArray(color)) { var c = color[0]; - if(Array.isArray(c)) color = c; + if(Lib.isArrayOrTypedArray(c)) color = c; return 'rgb(' + color.slice(0, 3).map(function(x) { return Math.round(x * 255); @@ -345,6 +345,18 @@ function arrayToColor(color) { return null; } +function arrayToColor(colors) { + if(!Lib.isArrayOrTypedArray(colors)) { + return null; + } + + if((colors.length === 4) && (typeof colors[0] === 'number')) { + return _arrayToColor(colors); + } + + return colors.map(_arrayToColor); +} + proto.update = function(data) { var gl = this.scene.glplot.gl; var lineOptions; diff --git a/src/traces/scattergl/attributes.js b/src/traces/scattergl/attributes.js index a47f87cd08e..bd6747b10da 100644 --- a/src/traces/scattergl/attributes.js +++ b/src/traces/scattergl/attributes.js @@ -28,6 +28,13 @@ var attrs = module.exports = overrideAll({ y0: scatterAttrs.y0, dy: scatterAttrs.dy, + xperiod: scatterAttrs.xperiod, + yperiod: scatterAttrs.yperiod, + xperiod0: scatterAttrs.xperiod0, + yperiod0: scatterAttrs.yperiod0, + xperiodalignment: scatterAttrs.xperiodalignment, + yperiodalignment: scatterAttrs.yperiodalignment, + text: scatterAttrs.text, hovertext: scatterAttrs.hovertext, diff --git a/src/traces/scattergl/calc.js b/src/traces/scattergl/calc.js index df2b4156032..8e07449f9a4 100644 --- a/src/traces/scattergl/calc.js +++ b/src/traces/scattergl/calc.js @@ -13,6 +13,7 @@ var cluster = require('@plotly/point-cluster'); var Lib = require('../../lib'); var AxisIDs = require('../../plots/cartesian/axis_ids'); var findExtremes = require('../../plots/cartesian/autorange').findExtremes; +var alignPeriod = require('../../plots/cartesian/align_period'); var scatterCalc = require('../scatter/calc'); var calcMarkerSize = scatterCalc.calcMarkerSize; @@ -36,8 +37,15 @@ module.exports = function calc(gd, trace) { var stash = {}; var i, xx, yy; - var x = trace._x = xa.makeCalcdata(trace, 'x'); - var y = trace._y = ya.makeCalcdata(trace, 'y'); + var origX = xa.makeCalcdata(trace, 'x'); + var origY = ya.makeCalcdata(trace, 'y'); + var x = alignPeriod(trace, xa, 'x', origX); + var y = alignPeriod(trace, ya, 'y', origY); + trace._x = x; + trace._y = y; + + if(trace.xperiodalignment) trace._origX = origX; + if(trace.yperiodalignment) trace._origY = origY; // we need hi-precision for scatter2d, // regl-scatter2d uses NaNs for bad/missing values diff --git a/src/traces/scattergl/defaults.js b/src/traces/scattergl/defaults.js index a30becb09ee..9775b3c6669 100644 --- a/src/traces/scattergl/defaults.js +++ b/src/traces/scattergl/defaults.js @@ -16,6 +16,7 @@ var attributes = require('./attributes'); var constants = require('../scatter/constants'); var subTypes = require('../scatter/subtypes'); var handleXYDefaults = require('../scatter/xy_defaults'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var handleMarkerDefaults = require('../scatter/marker_defaults'); var handleLineDefaults = require('../scatter/line_defaults'); var handleFillColorDefaults = require('../scatter/fillcolor_defaults'); @@ -34,6 +35,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout traceOut.visible = false; return; } + + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines'; coerce('text'); diff --git a/src/traces/scattergl/hover.js b/src/traces/scattergl/hover.js index 6e7c03a947c..4705f158ec7 100644 --- a/src/traces/scattergl/hover.js +++ b/src/traces/scattergl/hover.js @@ -161,16 +161,19 @@ function calcHover(pointData, x, y, trace) { var fakeCd = {}; fakeCd[pointData.index] = di; + var origX = trace._origX; + var origY = trace._origY; + var pointData2 = Lib.extendFlat({}, pointData, { color: getTraceColor(trace, di), x0: xp - rad, x1: xp + rad, - xLabelVal: di.x, + xLabelVal: origX ? origX[id] : di.x, y0: yp - rad, y1: yp + rad, - yLabelVal: di.y, + yLabelVal: origY ? origY[id] : di.y, cd: fakeCd, distance: minDist, diff --git a/src/traces/scattermapbox/attributes.js b/src/traces/scattermapbox/attributes.js index 833e6ebbb90..34a13e9a030 100644 --- a/src/traces/scattermapbox/attributes.js +++ b/src/traces/scattermapbox/attributes.js @@ -18,6 +18,7 @@ var colorScaleAttrs = require('../../components/colorscale/attributes'); var extendFlat = require('../../lib/extend').extendFlat; var overrideAll = require('../../plot_api/edit_types').overrideAll; +var mapboxLayoutAtributes = require('../../plots/mapbox/layout_attributes'); var lineAttrs = scatterGeoAttrs.line; var markerAttrs = scatterGeoAttrs.marker; @@ -26,6 +27,52 @@ module.exports = overrideAll({ lon: scatterGeoAttrs.lon, lat: scatterGeoAttrs.lat, + cluster: { + enabled: { + valType: 'boolean', + role: 'info', + dflt: false, + description: 'Determines whether clustering is enabled or disabled.' + }, + maxzoom: extendFlat({}, mapboxLayoutAtributes.layers.maxzoom, { + description: [ + 'Sets the maximum zoom level.', + 'At zoom levels equal to or greater than the maxzoom, the layer will be hidden.' + ].join(' ') + }), + step: { + role: 'info', + valType: 'number', + arrayOk: true, + dflt: -1, + min: -1, + description: [ + 'Sets the steps for each cluster.' + ].join(' ') + }, + size: { + role: 'info', + valType: 'number', + arrayOk: true, + dflt: 20, + min: 0, + description: [ + 'Sets the size for each cluster step.' + ].join(' ') + }, + color: { + valType: 'color', + arrayOk: true, + role: 'style', + description: [ + 'Sets the color for each cluster step.' + ].join(' ') + }, + opacity: extendFlat({}, markerAttrs.opacity, { + dflt: 1 + }) + }, + // locations // locationmode diff --git a/src/traces/scattermapbox/convert.js b/src/traces/scattermapbox/convert.js index 0362d96a07c..2ab21fe2285 100644 --- a/src/traces/scattermapbox/convert.js +++ b/src/traces/scattermapbox/convert.js @@ -32,19 +32,20 @@ module.exports = function convert(gd, calcTrace) { var hasLines = subTypes.hasLines(trace); var hasMarkers = subTypes.hasMarkers(trace); var hasText = subTypes.hasText(trace); - var hasCircles = (hasMarkers && trace.marker.symbol === 'circle'); - var hasSymbols = (hasMarkers && trace.marker.symbol !== 'circle'); + var hasCircles = hasMarkers && trace.marker.symbol === 'circle'; + var hasSymbols = hasMarkers && trace.marker.symbol !== 'circle'; + var hasCluster = trace.cluster.enabled; - var fill = initContainer(); - var line = initContainer(); - var circle = initContainer(); - var symbol = initContainer(); + var fill = initContainer('fill'); + var line = initContainer('line'); + var circle = initContainer('circle'); + var symbol = initContainer('symbol'); var opts = { fill: fill, line: line, circle: circle, - symbol: symbol + symbol: symbol, }; // early return if not visible or placeholder @@ -82,6 +83,29 @@ module.exports = function convert(gd, calcTrace) { var circleOpts = makeCircleOpts(calcTrace); circle.geojson = circleOpts.geojson; circle.layout.visibility = 'visible'; + if(hasCluster) { + circle.filter = ['!', ['has', 'point_count']]; + opts.cluster = { + type: 'circle', + filter: ['has', 'point_count'], + layout: {visibility: 'visible'}, + paint: { + 'circle-color': arrayifyAttribute(trace.cluster.color, trace.cluster.step), + 'circle-radius': arrayifyAttribute(trace.cluster.size, trace.cluster.step), + 'circle-opacity': arrayifyAttribute(trace.cluster.opacity, trace.cluster.step), + }, + }; + opts.clusterCount = { + type: 'symbol', + filter: ['has', 'point_count'], + paint: {}, + layout: { + 'text-field': '{point_count_abbreviated}', + 'text-font': ['Open Sans Regular', 'Arial Unicode MS Regular'], + 'text-size': 12 + } + }; + } Lib.extendFlat(circle.paint, { 'circle-color': circleOpts.mcc, @@ -90,6 +114,10 @@ module.exports = function convert(gd, calcTrace) { }); } + if(hasCircles && hasCluster) { + circle.filter = ['!', ['has', 'point_count']]; + } + if(hasSymbols || hasText) { symbol.geojson = makeSymbolGeoJSON(calcTrace, gd); @@ -150,10 +178,12 @@ module.exports = function convert(gd, calcTrace) { return opts; }; -function initContainer() { +function initContainer(type) { return { + type: type, geojson: geoJsonUtils.makeBlank(), layout: { visibility: 'none' }, + filter: null, paint: {} }; } @@ -208,7 +238,8 @@ function makeCircleOpts(calcTrace) { features.push({ type: 'Feature', - geometry: {type: 'Point', coordinates: lonlat}, + id: i + 1, + geometry: { type: 'Point', coordinates: lonlat }, properties: props }); } @@ -266,7 +297,6 @@ function makeSymbolGeoJSON(calcTrace, gd) { getFillFunc(trace.text) : blankFillFunc; - var features = []; for(var i = 0; i < calcTrace.length; i++) { @@ -331,3 +361,16 @@ function blankFillFunc() { return ''; } function isBADNUM(lonlat) { return lonlat[0] === BADNUM; } + +function arrayifyAttribute(attribute, step) { + var idx, newattribute; + if(Lib.isArrayOrTypedArray(attribute) && Lib.isArrayOrTypedArray(step)) { + newattribute = ['step', ['get', 'point_count'], attribute[0]]; + for(idx = 1; idx < attribute.length; idx++) { + newattribute.push(step[idx - 1], attribute[idx]); + } + } else { + newattribute = attribute; + } + return newattribute; +} diff --git a/src/traces/scattermapbox/defaults.js b/src/traces/scattermapbox/defaults.js index 21842d9abc7..97d08154c12 100644 --- a/src/traces/scattermapbox/defaults.js +++ b/src/traces/scattermapbox/defaults.js @@ -54,6 +54,15 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } } + var clusterEnabled = coerce('cluster.enabled'); + if(clusterEnabled) { + coerce('cluster.maxzoom'); + coerce('cluster.step'); + coerce('cluster.color', traceOut.marker.color || defaultColor); + coerce('cluster.size'); + coerce('cluster.opacity'); + } + if(subTypes.hasText(traceOut)) { handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true}); } diff --git a/src/traces/scattermapbox/hover.js b/src/traces/scattermapbox/hover.js index d1bd61d3a3e..9c532d98bb0 100644 --- a/src/traces/scattermapbox/hover.js +++ b/src/traces/scattermapbox/hover.js @@ -14,6 +14,7 @@ var Lib = require('../../lib'); var getTraceColor = require('../scatter/get_trace_color'); var fillText = Lib.fillText; var BADNUM = require('../../constants/numerical').BADNUM; +var LAYER_PREFIX = require('../../plots/mapbox/constants').traceLayerPrefix; module.exports = function hoverPoints(pointData, xval, yval) { var cd = pointData.cd; @@ -21,6 +22,13 @@ module.exports = function hoverPoints(pointData, xval, yval) { var xa = pointData.xa; var ya = pointData.ya; var subplot = pointData.subplot; + var clusteredPointsIds = []; + var layer = LAYER_PREFIX + trace.uid + '-circle'; + + if(trace.cluster.enabled) { + var elems = subplot.map.queryRenderedFeatures(null, {layers: [layer]}); + clusteredPointsIds = elems.map(function(elem) {return elem.id;}); + } // compute winding number about [-180, 180] globe var winding = (xval >= 0) ? @@ -34,6 +42,7 @@ module.exports = function hoverPoints(pointData, xval, yval) { function distFn(d) { var lonlat = d.lonlat; if(lonlat[0] === BADNUM) return Infinity; + if(trace.cluster.enabled && clusteredPointsIds.indexOf(d.i + 1) === -1) return Infinity; var lon = Lib.modHalf(lonlat[0], 360); var lat = lonlat[1]; diff --git a/src/traces/scattermapbox/plot.js b/src/traces/scattermapbox/plot.js index be14630a1f0..f61f0e08b08 100644 --- a/src/traces/scattermapbox/plot.js +++ b/src/traces/scattermapbox/plot.js @@ -8,27 +8,36 @@ 'use strict'; +var Lib = require('../../lib'); var convert = require('./convert'); var LAYER_PREFIX = require('../../plots/mapbox/constants').traceLayerPrefix; -var ORDER = ['fill', 'line', 'circle', 'symbol']; +var ORDER = { + cluster: ['cluster', 'clusterCount', 'circle'], + nonCluster: ['fill', 'line', 'circle', 'symbol'], +}; -function ScatterMapbox(subplot, uid) { +function ScatterMapbox(subplot, uid, clusterEnabled) { this.type = 'scattermapbox'; this.subplot = subplot; this.uid = uid; + this.clusterEnabled = clusterEnabled; this.sourceIds = { fill: 'source-' + uid + '-fill', line: 'source-' + uid + '-line', circle: 'source-' + uid + '-circle', - symbol: 'source-' + uid + '-symbol' + symbol: 'source-' + uid + '-symbol', + cluster: 'source-' + uid + '-circle', + clusterCount: 'source-' + uid + '-circle', }; this.layerIds = { fill: LAYER_PREFIX + uid + '-fill', line: LAYER_PREFIX + uid + '-line', circle: LAYER_PREFIX + uid + '-circle', - symbol: LAYER_PREFIX + uid + '-symbol' + symbol: LAYER_PREFIX + uid + '-symbol', + cluster: LAYER_PREFIX + uid + '-cluster', + clusterCount: LAYER_PREFIX + uid + '-cluster-count', }; // We could merge the 'fill' source with the 'line' source and @@ -42,11 +51,20 @@ function ScatterMapbox(subplot, uid) { var proto = ScatterMapbox.prototype; -proto.addSource = function(k, opts) { - this.subplot.map.addSource(this.sourceIds[k], { +proto.addSource = function(k, opts, cluster) { + var sourceOpts = { type: 'geojson', - data: opts.geojson - }); + data: opts.geojson, + }; + + if(cluster.enabled) { + Lib.extendFlat(sourceOpts, { + cluster: true, + clusterMaxZoom: cluster.maxzoom, + }); + } + + this.subplot.map.addSource(this.sourceIds[k], sourceOpts); }; proto.setSourceData = function(k, opts) { @@ -56,56 +74,80 @@ proto.setSourceData = function(k, opts) { }; proto.addLayer = function(k, opts, below) { - this.subplot.addLayer({ - type: k, + var source = { + type: opts.type, id: this.layerIds[k], source: this.sourceIds[k], layout: opts.layout, - paint: opts.paint - }, below); + paint: opts.paint, + }; + if(opts.filter) { + source.filter = opts.filter; + } + this.subplot.addLayer(source, below); }; proto.update = function update(calcTrace) { + var trace = calcTrace[0].trace; var subplot = this.subplot; var map = subplot.map; var optsAll = convert(subplot.gd, calcTrace); var below = subplot.belowLookup['trace-' + this.uid]; - var i, k, opts; - - if(below !== this.below) { - for(i = ORDER.length - 1; i >= 0; i--) { - k = ORDER[i]; + var i, k, opts, order; + var hasCluster = trace.cluster.enabled; + var hadCluster = this.clusterEnabled; + + if(hasCluster === hadCluster) { + order = []; + if(below !== this.below) { + for(i = order.length - 1; i >= 0; i--) { + k = order[i]; + map.removeLayer(this.layerIds[k]); + } + for(i = 0; i < order.length; i++) { + k = order[i]; + opts = optsAll[k]; + this.addLayer(k, opts, below); + } + this.below = below; + } + } else if(hasCluster && !hadCluster) { + for(i = ORDER.nonCluster.length - 1; i >= 0; i--) { + k = ORDER.nonCluster[i]; map.removeLayer(this.layerIds[k]); + map.removeSource(this.sourceIds[k]); } - for(i = 0; i < ORDER.length; i++) { - k = ORDER[i]; + this.addSource('circle', optsAll.circle, trace.cluster); + for(i = 0; i < ORDER.cluster.length; i++) { + k = ORDER.cluster[i]; opts = optsAll[k]; this.addLayer(k, opts, below); } - this.below = below; - } - - for(i = 0; i < ORDER.length; i++) { - k = ORDER[i]; - opts = optsAll[k]; - - subplot.setOptions(this.layerIds[k], 'setLayoutProperty', opts.layout); - - if(opts.layout.visibility === 'visible') { - this.setSourceData(k, opts); - subplot.setOptions(this.layerIds[k], 'setPaintProperty', opts.paint); + this.clusterEnabled = hasCluster; + } else if(!hasCluster && hadCluster) { + for(i = 0; i < ORDER.cluster.length; i++) { + k = ORDER.cluster[i]; + map.removeLayer(this.layerIds[k]); } + map.removeSource(this.sourceIds.circle); + for(i = 0; i < ORDER.nonCluster.length; i++) { + k = ORDER.nonCluster[i]; + opts = optsAll[k]; + this.addSource(k, opts, trace.cluster); + this.addLayer(k, opts, below); + } + this.clusterEnabled = hasCluster; } - // link ref for quick update during selections + // link ref for quick update during selections calcTrace[0].trace._glTrace = this; }; proto.dispose = function dispose() { var map = this.subplot.map; - - for(var i = ORDER.length - 1; i >= 0; i--) { - var k = ORDER[i]; + var order = this.clusterEnabled ? ORDER.cluster : ORDER.nonCluster; + for(var i = order.length - 1; i >= 0; i--) { + var k = order[i]; map.removeLayer(this.layerIds[k]); map.removeSource(this.sourceIds[k]); } @@ -113,15 +155,29 @@ proto.dispose = function dispose() { module.exports = function createScatterMapbox(subplot, calcTrace) { var trace = calcTrace[0].trace; - var scatterMapbox = new ScatterMapbox(subplot, trace.uid); + var scatterMapbox = new ScatterMapbox( + subplot, + trace.uid, + trace.cluster.enabled + ); var optsAll = convert(subplot.gd, calcTrace); var below = scatterMapbox.below = subplot.belowLookup['trace-' + trace.uid]; + var i, k, opts; - for(var i = 0; i < ORDER.length; i++) { - var k = ORDER[i]; - var opts = optsAll[k]; - scatterMapbox.addSource(k, opts); - scatterMapbox.addLayer(k, opts, below); + if(trace.cluster.enabled) { + scatterMapbox.addSource('circle', optsAll.circle, trace.cluster); + for(i = 0; i < ORDER.cluster.length; i++) { + k = ORDER.cluster[i]; + opts = optsAll[k]; + scatterMapbox.addLayer(k, opts, below); + } + } else { + for(i = 0; i < ORDER.nonCluster.length; i++) { + k = ORDER.nonCluster[i]; + opts = optsAll[k]; + scatterMapbox.addSource(k, opts, trace.cluster); + scatterMapbox.addLayer(k, opts, below); + } } // link ref for quick update during selections diff --git a/src/traces/sunburst/attributes.js b/src/traces/sunburst/attributes.js index 4ccd65b80d9..31e51c3c019 100644 --- a/src/traces/sunburst/attributes.js +++ b/src/traces/sunburst/attributes.js @@ -203,6 +203,31 @@ module.exports = { 'this option won\'t have any effect and `insidetextfont` would be used.' ].join(' ') }), + rotation: { + valType: 'angle', + role: 'style', + dflt: 0, + editType: 'plot', + description: [ + 'Rotates the whole diagram counterclockwise by some angle.', + 'By default the first slice starts at 3 o\'clock.' + ].join(' ') + }, + sort: pieAttrs.sort, + + root: { + color: { + valType: 'color', + editType: 'calc', + role: 'style', + dflt: 'rgba(0,0,0,0)', + description: [ + 'sets the color of the root node for a sunburst or a treemap trace.', + 'this has no effect when a colorscale is used to set the markers.' + ].join(' ') + }, + editType: 'calc' + }, domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'}) }; diff --git a/src/traces/sunburst/calc.js b/src/traces/sunburst/calc.js index e8a9a90d676..58eab8ffae0 100644 --- a/src/traces/sunburst/calc.js +++ b/src/traces/sunburst/calc.js @@ -111,7 +111,10 @@ exports.calc = function(gd, trace) { label: k }); } else { - return Lib.warn('Multiple implied roots, cannot build ' + trace.type + ' hierarchy.'); + return Lib.warn([ + 'Multiple implied roots, cannot build', trace.type, 'hierarchy of', trace.name + '.', + 'These roots include:', impliedRoots.join(', ') + ].join(' ')); } } else if(parent2children[''].length > 1) { var dummyId = Lib.randstr(); @@ -140,7 +143,10 @@ exports.calc = function(gd, trace) { .id(function(d) { return d.id; }) .parentId(function(d) { return d.pid; })(cd); } catch(e) { - return Lib.warn('Failed to build ' + trace.type + ' hierarchy. Error: ' + e.message); + return Lib.warn([ + 'Failed to build', trace.type, 'hierarchy of', trace.name + '.', + 'Error:', e.message + ].join(' ')); } var hierarchy = d3Hierarchy.hierarchy(root); @@ -170,7 +176,7 @@ exports.calc = function(gd, trace) { if(v < partialSum * ALMOST_EQUAL) { failed = true; return Lib.warn([ - 'Total value for node', d.data.data.id, + 'Total value for node', d.data.data.id, 'of', trace.name, 'is smaller than the sum of its children.', '\nparent value =', v, '\nchildren sum =', partialSum @@ -192,7 +198,9 @@ exports.calc = function(gd, trace) { if(failed) return; // TODO add way to sort by height also? - hierarchy.sort(function(a, b) { return b.value - a.value; }); + if(trace.sort) { + hierarchy.sort(function(a, b) { return b.value - a.value; }); + } var pullColor; var scaleColor; @@ -268,8 +276,8 @@ exports._runCrossTraceCalc = function(desiredType, gd) { dfltColorCount++; } } else { - // root gets no coloring by default - cdi.color = 'rgba(0,0,0,0)'; + // set root color. no coloring by default. + cdi.color = cdi.trace.root.color; } } } diff --git a/src/traces/sunburst/defaults.js b/src/traces/sunburst/defaults.js index cd034ca75fb..2ddd3da5a3f 100644 --- a/src/traces/sunburst/defaults.js +++ b/src/traces/sunburst/defaults.js @@ -73,6 +73,12 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('insidetextorientation'); + coerce('sort'); + + coerce('rotation'); + + coerce('root.color'); + handleDomainDefaults(traceOut, layout, coerce); // do not support transforms for now diff --git a/src/traces/sunburst/plot.js b/src/traces/sunburst/plot.js index ef3616e4b88..f80d707c0fe 100644 --- a/src/traces/sunburst/plot.js +++ b/src/traces/sunburst/plot.js @@ -18,6 +18,7 @@ var uniformText = require('../bar/uniform_text'); var recordMinTextSize = uniformText.recordMinTextSize; var clearMinTextSize = uniformText.clearMinTextSize; var piePlot = require('../pie/plot'); +var getRotationAngle = require('../pie/helpers').getRotationAngle; var computeTransform = piePlot.computeTransform; var transformInsideText = piePlot.transformInsideText; var styleOne = require('./style').styleOne; @@ -150,6 +151,14 @@ function plotOne(gd, cd, element, transitionOpts) { // filter out slices that won't show up on graph sliceData = sliceData.filter(function(pt) { return pt.y1 <= cutoff; }); + var baseX = getRotationAngle(trace.rotation); + if(baseX) { + sliceData.forEach(function(pt) { + pt.x0 += baseX; + pt.x1 += baseX; + }); + } + // partition span ('y') to sector radial px value var maxY = Math.min(maxHeight, maxDepth); var y2rpx = function(y) { return (y - yOffset) / maxY * rMax; }; @@ -302,7 +311,7 @@ function plotOne(gd, cd, element, transitionOpts) { var next; if(entryPrev) { - var a = pt.x1 > entryPrev.x1 ? 2 * Math.PI : 0; + var a = (pt.x1 > entryPrev.x1 ? 2 * Math.PI : 0) + baseX; // if pt to remove: // - if 'below' where the root-node used to be: shrink it radially inward // - otherwise, collapse it clockwise or counterclockwise which ever is shortest to theta=0 @@ -352,7 +361,7 @@ function plotOne(gd, cd, element, transitionOpts) { // if new branch, twist it in clockwise or // counterclockwise which ever is shorter to // its final angle - var a = pt.x1 > nextX1ofPrevEntry ? 2 * Math.PI : 0; + var a = (pt.x1 > nextX1ofPrevEntry ? 2 * Math.PI : 0) + baseX; prev = {x0: a, x1: a}; } else { // if new leaf (when maxdepth is set), @@ -367,7 +376,7 @@ function plotOne(gd, cd, element, transitionOpts) { } } else { // start sector of new traces from theta=0 - prev = {x0: 0, x1: 0}; + prev = {x0: baseX, x1: baseX}; } } @@ -410,11 +419,11 @@ function plotOne(gd, cd, element, transitionOpts) { } } else { // if new root-node - prev.x0 = prev.x1 = 0; + prev.x0 = prev.x1 = baseX; } } else { // on new traces - prev.x0 = prev.x1 = 0; + prev.x0 = prev.x1 = baseX; } } diff --git a/src/traces/surface/convert.js b/src/traces/surface/convert.js index 06bb723eb58..b65bd345730 100644 --- a/src/traces/surface/convert.js +++ b/src/traces/surface/convert.js @@ -433,8 +433,7 @@ proto.update = function(data) { var scene = this.scene; var sceneLayout = scene.fullSceneLayout; var surface = this.surface; - var alpha = data.opacity; - var colormap = parseColorScale(data, alpha); + var colormap = parseColorScale(data); var scaleFactor = scene.dataScale; var xlen = data.z[0].length; var ylen = data._ylength; @@ -679,10 +678,6 @@ proto.update = function(data) { if('lightposition' in data) { surface.lightPosition = [data.lightposition.x, data.lightposition.y, data.lightposition.z]; } - - if(alpha && alpha < 1) { - surface.supportsTransparency = true; - } }; proto.dispose = function() { diff --git a/src/traces/table/plot.js b/src/traces/table/plot.js index aed2f799cf7..cf5dfde68ff 100644 --- a/src/traces/table/plot.js +++ b/src/traces/table/plot.js @@ -14,6 +14,7 @@ var gup = require('../../lib/gup'); var Drawing = require('../../components/drawing'); var svgUtil = require('../../lib/svg_text_utils'); var raiseToTop = require('../../lib').raiseToTop; +var strTranslate = require('../../lib').strTranslate; var cancelEeaseColumn = require('../../lib').cancelTransition; var prepareData = require('./data_preparation_helper'); var splitData = require('./data_split_helpers'); @@ -46,7 +47,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { .attr('width', function(d) {return d.width + d.size.l + d.size.r;}) .attr('height', function(d) {return d.height + d.size.t + d.size.b;}) .attr('transform', function(d) { - return 'translate(' + d.translateX + ',' + d.translateY + ')'; + return strTranslate(d.translateX, d.translateY); }); var tableControlView = table.selectAll('.' + c.cn.tableControlView) @@ -79,7 +80,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { } tableControlView - .attr('transform', function(d) {return 'translate(' + d.size.l + ' ' + d.size.t + ')';}); + .attr('transform', function(d) {return strTranslate(d.size.l, d.size.t);}); // scrollBackground merely ensures that mouse events are captured even on crazy fast scrollwheeling // otherwise rendering glitches may occur @@ -108,7 +109,7 @@ module.exports = function plot(gd, wrappedTraceHolders) { yColumn.exit().remove(); - yColumn.attr('transform', function(d) {return 'translate(' + d.x + ' 0)';}); + yColumn.attr('transform', function(d) {return strTranslate(d.x, 0);}); if(dynamic) { yColumn.call(d3.behavior.drag() @@ -136,10 +137,10 @@ module.exports = function plot(gd, wrappedTraceHolders) { .transition() .ease(c.transitionEase) .duration(c.transitionDuration) - .attr('transform', function(d) {return 'translate(' + d.x + ' 0)';}); + .attr('transform', function(d) {return strTranslate(d.x, 0);}); movedColumn .call(cancelEeaseColumn) - .attr('transform', 'translate(' + d.x + ' -' + c.uplift + ' )'); + .attr('transform', strTranslate(d.x, -c.uplift)); }) .on('dragend', function(d) { var movedColumn = d3.select(this); @@ -294,7 +295,7 @@ function renderScrollbarKit(tableControlView, gd, bypassVisibleBar) { }) .attr('transform', function(d) { var xPosition = d.width + c.scrollbarWidth / 2 + c.scrollbarOffset; - return 'translate(' + xPosition + ' ' + headerHeight(d) + ')'; + return strTranslate(xPosition, headerHeight(d)); }); var scrollbar = scrollbarKit.selectAll('.' + c.cn.scrollbar) @@ -313,7 +314,7 @@ function renderScrollbarKit(tableControlView, gd, bypassVisibleBar) { scrollbarSlider .attr('transform', function(d) { - return 'translate(0 ' + (d.scrollbarState.topY || 0) + ')'; + return strTranslate(0, d.scrollbarState.topY || 0); }); var scrollbarGlyph = scrollbarSlider.selectAll('.' + c.cn.scrollbarGlyph) @@ -572,7 +573,7 @@ function populateCellText(cellText, tableControlView, allColumnBlock, gd) { } else { d3.select(element.parentNode) // basic cell adjustment - compliance with `cellPad` - .attr('transform', function(d) {return 'translate(' + xPosition(d) + ' ' + c.cellPad + ')';}) + .attr('transform', function(d) {return strTranslate(xPosition(d), c.cellPad);}) .attr('text-anchor', function(d) { return ({ left: 'start', @@ -622,7 +623,7 @@ function easeColumn(selection, d, y) { .transition() .ease(c.releaseTransitionEase) .duration(c.releaseTransitionDuration) - .attr('transform', 'translate(' + d.x + ' ' + y + ')'); + .attr('transform', strTranslate(d.x, y)); } function cellsBlock(d) {return d.type === 'cells';} @@ -703,7 +704,7 @@ function updateBlockYPosition(gd, cellsColumnBlock, tableControlView) { cellsColumnBlock .attr('transform', function(d) { var yTranslate = firstRowAnchor(d.rowBlocks, d.page) - d.scrollY; - return 'translate(0 ' + yTranslate + ')'; + return strTranslate(0, yTranslate); }); // conditionally rerendering panel 0 and 1 @@ -829,7 +830,7 @@ function updateYPositionMaker(columnBlock, element, tableControlView, gd, d) { var rectBox = d3.select(element.parentNode).select('.' + c.cn.cellRect).node().getBoundingClientRect(); var currentTransform = element.transform.baseVal.consolidate(); var yPosition = rectBox.top - box.top + (currentTransform ? currentTransform.matrix.f : c.cellPad); - return 'translate(' + xPosition(d, d3.select(element.parentNode).select('.' + c.cn.cellTextHolder).node().getBoundingClientRect().width) + ' ' + yPosition + ')'; + return strTranslate(xPosition(d, d3.select(element.parentNode).select('.' + c.cn.cellTextHolder).node().getBoundingClientRect().width), yPosition); }); d.settledY = true; @@ -852,7 +853,7 @@ function setCellHeightAndPositionY(columnCell) { var l = getBlock(d); var rowAnchor = rowsHeight(l, d.key); var yOffset = rowAnchor + headerHeight; - return 'translate(0 ' + yOffset + ')'; + return strTranslate(0, yOffset); }) .selectAll('.' + c.cn.cellRect) .attr('height', function(d) {return getRow(getBlock(d), d.key).rowHeight;}); diff --git a/src/traces/treemap/attributes.js b/src/traces/treemap/attributes.js index c2f121237b2..ea58032199f 100644 --- a/src/traces/treemap/attributes.js +++ b/src/traces/treemap/attributes.js @@ -268,6 +268,8 @@ module.exports = { 'Sets the positions of the `text` elements.' ].join(' ') }, + sort: pieAttrs.sort, + root: sunburstAttrs.root, domain: domainAttrs({name: 'treemap', trace: true, editType: 'calc'}), }; diff --git a/src/traces/treemap/defaults.js b/src/traces/treemap/defaults.js index 017fe0a6013..1b0e6f2116e 100644 --- a/src/traces/treemap/defaults.js +++ b/src/traces/treemap/defaults.js @@ -114,6 +114,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pathbar.edgeshape'); } + coerce('sort'); + + coerce('root.color'); + handleDomainDefaults(traceOut, layout, coerce); // do not support transforms for now diff --git a/src/traces/treemap/style.js b/src/traces/treemap/style.js index 18803bb8a25..322cc00e6e4 100644 --- a/src/traces/treemap/style.js +++ b/src/traces/treemap/style.js @@ -47,8 +47,8 @@ function styleOne(s, pt, trace, opts) { lineColor = trace._hovered.marker.line.color; lineWidth = trace._hovered.marker.line.width; } else { - if(isRoot && fillColor === 'rgba(0,0,0,0)') { - opacity = 0; + if(isRoot && fillColor === trace.root.color) { + opacity = 100; lineColor = 'rgba(0,0,0,0)'; lineWidth = 0; } else { diff --git a/src/traces/violin/attributes.js b/src/traces/violin/attributes.js index 388733c93f4..6a7df22505a 100644 --- a/src/traces/violin/attributes.js +++ b/src/traces/violin/attributes.js @@ -16,6 +16,7 @@ module.exports = { x: boxAttrs.x, x0: boxAttrs.x0, y0: boxAttrs.y0, + name: extendFlat({}, boxAttrs.name, { description: [ 'Sets the trace name.', diff --git a/src/traces/waterfall/attributes.js b/src/traces/waterfall/attributes.js index b722160ec10..d00499e9520 100644 --- a/src/traces/waterfall/attributes.js +++ b/src/traces/waterfall/attributes.js @@ -77,6 +77,13 @@ module.exports = { y0: barAttrs.y0, dy: barAttrs.dy, + xperiod: barAttrs.xperiod, + yperiod: barAttrs.yperiod, + xperiod0: barAttrs.xperiod0, + yperiod0: barAttrs.yperiod0, + xperiodalignment: barAttrs.xperiodalignment, + yperiodalignment: barAttrs.yperiodalignment, + hovertext: barAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys diff --git a/src/traces/waterfall/calc.js b/src/traces/waterfall/calc.js index 636099e1d15..7d57bd0ece3 100644 --- a/src/traces/waterfall/calc.js +++ b/src/traces/waterfall/calc.js @@ -9,6 +9,7 @@ 'use strict'; var Axes = require('../../plots/cartesian/axes'); +var alignPeriod = require('../../plots/cartesian/align_period'); var mergeArray = require('../../lib').mergeArray; var calcSelection = require('../scatter/calc_selection'); var BADNUM = require('../../constants/numerical').BADNUM; @@ -24,14 +25,19 @@ function isTotal(a) { module.exports = function calc(gd, trace) { var xa = Axes.getFromId(gd, trace.xaxis || 'x'); var ya = Axes.getFromId(gd, trace.yaxis || 'y'); - var size, pos; + var size, pos, origPos; + var hasPeriod; if(trace.orientation === 'h') { size = xa.makeCalcdata(trace, 'x'); - pos = ya.makeCalcdata(trace, 'y'); + origPos = ya.makeCalcdata(trace, 'y'); + pos = alignPeriod(trace, ya, 'y', origPos); + hasPeriod = !!trace.yperiodalignment; } else { size = ya.makeCalcdata(trace, 'y'); - pos = xa.makeCalcdata(trace, 'x'); + origPos = xa.makeCalcdata(trace, 'x'); + pos = alignPeriod(trace, xa, 'x', origPos); + hasPeriod = !!trace.xperiodalignment; } // create the "calculated data" to plot @@ -85,6 +91,10 @@ module.exports = function calc(gd, trace) { hasTotals = true; } + if(hasPeriod) { + cd[i].orig_p = origPos[i]; // used by hover + } + if(trace.ids) { cdi.id = String(trace.ids[i]); } diff --git a/src/traces/waterfall/defaults.js b/src/traces/waterfall/defaults.js index 022589a99e1..256d8d5a995 100644 --- a/src/traces/waterfall/defaults.js +++ b/src/traces/waterfall/defaults.js @@ -13,6 +13,7 @@ var Lib = require('../../lib'); var handleGroupingDefaults = require('../bar/defaults').handleGroupingDefaults; var handleText = require('../bar/defaults').handleText; var handleXYDefaults = require('../scatter/xy_defaults'); +var handlePeriodDefaults = require('../scatter/period_defaults'); var attributes = require('./attributes'); var Color = require('../../components/color'); var delta = require('../../constants/delta.js'); @@ -38,6 +39,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) { return; } + handlePeriodDefaults(traceIn, traceOut, layout, coerce); + coerce('measure'); coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v'); diff --git a/src/version.js b/src/version.js index 05e061fdaab..0b2f4777dee 100644 --- a/src/version.js +++ b/src/version.js @@ -9,4 +9,4 @@ 'use strict'; // package version injected by `npm run preprocess` -exports.version = '1.55.2'; +exports.version = '1.58.0'; diff --git a/tasks/test_syntax.js b/tasks/test_syntax.js index 14c20675120..48b28537fc1 100644 --- a/tasks/test_syntax.js +++ b/tasks/test_syntax.js @@ -112,9 +112,6 @@ function assertSrcContents() { // Forbidden in IE in any context var IE_BLACK_LIST = ['classList']; - // not implemented in FF, or inconsistent with others - var FF_BLACK_LIST = ['offsetX', 'offsetY']; - // require'd built-in modules var BUILTINS = ['events']; @@ -151,8 +148,6 @@ function assertSrcContents() { if(!(isSunburstOrTreemap && isLinkedToObject)) { logs.push(file + ' : contains .' + lastPart + ' (IE failure in SVG)'); } - } else if(FF_BLACK_LIST.indexOf(lastPart) !== -1) { - logs.push(file + ' : contains .' + lastPart + ' (FF failure)'); } } else if(node.type === 'Identifier' && node.source() === 'getComputedStyle') { if(node.parent.source() !== 'window.getComputedStyle') { @@ -213,7 +208,7 @@ function assertSrcContents() { * - If you use conforms to these rules, you may update * KNOWN_GET_COMPUTED_STYLE_CALLS to count the new use. */ - var KNOWN_GET_COMPUTED_STYLE_CALLS = 5; + var KNOWN_GET_COMPUTED_STYLE_CALLS = 6; if(getComputedStyleCnt !== KNOWN_GET_COMPUTED_STYLE_CALLS) { logs.push('Expected ' + KNOWN_GET_COMPUTED_STYLE_CALLS + ' window.getComputedStyle calls, found ' + getComputedStyleCnt + diff --git a/test/image/baselines/1.png b/test/image/baselines/1.png index eb01e3dfafc..fbe4ec8f869 100644 Binary files a/test/image/baselines/1.png and b/test/image/baselines/1.png differ diff --git a/test/image/baselines/automargin-large-margins-both-sides.png b/test/image/baselines/automargin-large-margins-both-sides.png new file mode 100644 index 00000000000..fc17d8fe808 Binary files /dev/null and b/test/image/baselines/automargin-large-margins-both-sides.png differ diff --git a/test/image/baselines/automargin-large-margins-horizontal.png b/test/image/baselines/automargin-large-margins-horizontal.png new file mode 100644 index 00000000000..2641dd8d97e Binary files /dev/null and b/test/image/baselines/automargin-large-margins-horizontal.png differ diff --git a/test/image/baselines/automargin-large-margins.png b/test/image/baselines/automargin-large-margins.png new file mode 100644 index 00000000000..dad69bba747 Binary files /dev/null and b/test/image/baselines/automargin-large-margins.png differ diff --git a/test/image/baselines/axes_breaks-candlestick2.png b/test/image/baselines/axes_breaks-candlestick2.png index e93fee533ae..326bf1dd071 100644 Binary files a/test/image/baselines/axes_breaks-candlestick2.png and b/test/image/baselines/axes_breaks-candlestick2.png differ diff --git a/test/image/baselines/axes_breaks-dtick_auto.png b/test/image/baselines/axes_breaks-dtick_auto.png index 18808479908..523b13a3170 100644 Binary files a/test/image/baselines/axes_breaks-dtick_auto.png and b/test/image/baselines/axes_breaks-dtick_auto.png differ diff --git a/test/image/baselines/axes_breaks-finance.png b/test/image/baselines/axes_breaks-finance.png index dffbeceebe9..d50156127af 100644 Binary files a/test/image/baselines/axes_breaks-finance.png and b/test/image/baselines/axes_breaks-finance.png differ diff --git a/test/image/baselines/axes_breaks-matches.png b/test/image/baselines/axes_breaks-matches.png new file mode 100644 index 00000000000..7d5fb86addc Binary files /dev/null and b/test/image/baselines/axes_breaks-matches.png differ diff --git a/test/image/baselines/axes_breaks-night_autorange-reversed.png b/test/image/baselines/axes_breaks-night_autorange-reversed.png index 464e78edb37..37fe6c40862 100644 Binary files a/test/image/baselines/axes_breaks-night_autorange-reversed.png and b/test/image/baselines/axes_breaks-night_autorange-reversed.png differ diff --git a/test/image/baselines/axes_breaks-overlap.png b/test/image/baselines/axes_breaks-overlap.png index eed0f683fd7..3cc73f6915b 100644 Binary files a/test/image/baselines/axes_breaks-overlap.png and b/test/image/baselines/axes_breaks-overlap.png differ diff --git a/test/image/baselines/axes_breaks-rangeslider.png b/test/image/baselines/axes_breaks-rangeslider.png index 10c47a94354..73600339ce6 100644 Binary files a/test/image/baselines/axes_breaks-rangeslider.png and b/test/image/baselines/axes_breaks-rangeslider.png differ diff --git a/test/image/baselines/axes_breaks-reversed-without-pattern.png b/test/image/baselines/axes_breaks-reversed-without-pattern.png index 497b91fd460..29fec4b988a 100644 Binary files a/test/image/baselines/axes_breaks-reversed-without-pattern.png and b/test/image/baselines/axes_breaks-reversed-without-pattern.png differ diff --git a/test/image/baselines/axes_breaks-round-weekdays.png b/test/image/baselines/axes_breaks-round-weekdays.png index 9f20ece5dfa..f4288baf687 100644 Binary files a/test/image/baselines/axes_breaks-round-weekdays.png and b/test/image/baselines/axes_breaks-round-weekdays.png differ diff --git a/test/image/baselines/axes_breaks-values.png b/test/image/baselines/axes_breaks-values.png index b3c9e48c6d8..c7c47d0e295 100644 Binary files a/test/image/baselines/axes_breaks-values.png and b/test/image/baselines/axes_breaks-values.png differ diff --git a/test/image/baselines/axes_breaks-weekends-weeknights.png b/test/image/baselines/axes_breaks-weekends-weeknights.png index 427913aa1f4..530bc27375f 100644 Binary files a/test/image/baselines/axes_breaks-weekends-weeknights.png and b/test/image/baselines/axes_breaks-weekends-weeknights.png differ diff --git a/test/image/baselines/axes_breaks-weekends_autorange-reversed.png b/test/image/baselines/axes_breaks-weekends_autorange-reversed.png index 33a32e12aa6..2892d889414 100644 Binary files a/test/image/baselines/axes_breaks-weekends_autorange-reversed.png and b/test/image/baselines/axes_breaks-weekends_autorange-reversed.png differ diff --git a/test/image/baselines/axes_breaks.png b/test/image/baselines/axes_breaks.png index 722307c1624..5f34b4c8e68 100644 Binary files a/test/image/baselines/axes_breaks.png and b/test/image/baselines/axes_breaks.png differ diff --git a/test/image/baselines/axes_chain_scaleanchor_matches.png b/test/image/baselines/axes_chain_scaleanchor_matches.png new file mode 100644 index 00000000000..026c906cb55 Binary files /dev/null and b/test/image/baselines/axes_chain_scaleanchor_matches.png differ diff --git a/test/image/baselines/axes_chain_scaleanchor_matches2.png b/test/image/baselines/axes_chain_scaleanchor_matches2.png new file mode 100644 index 00000000000..33bed3a95a6 Binary files /dev/null and b/test/image/baselines/axes_chain_scaleanchor_matches2.png differ diff --git a/test/image/baselines/axes_linked_date_autorange.png b/test/image/baselines/axes_linked_date_autorange.png index 46b9e97cb94..3a2da78fe9f 100644 Binary files a/test/image/baselines/axes_linked_date_autorange.png and b/test/image/baselines/axes_linked_date_autorange.png differ diff --git a/test/image/baselines/axes_scaleanchor-with-matches.png b/test/image/baselines/axes_scaleanchor-with-matches.png index 56599d8d2ce..29e4065ffd2 100644 Binary files a/test/image/baselines/axes_scaleanchor-with-matches.png and b/test/image/baselines/axes_scaleanchor-with-matches.png differ diff --git a/test/image/baselines/bar_annotation_max_range_eq_category.png b/test/image/baselines/bar_annotation_max_range_eq_category.png new file mode 100644 index 00000000000..f919fffe294 Binary files /dev/null and b/test/image/baselines/bar_annotation_max_range_eq_category.png differ diff --git a/test/image/baselines/bar_multiline_labels.png b/test/image/baselines/bar_multiline_labels.png index 7788b298bd8..cf6aad94e2c 100644 Binary files a/test/image/baselines/bar_multiline_labels.png and b/test/image/baselines/bar_multiline_labels.png differ diff --git a/test/image/baselines/box_grouped-multicategory.png b/test/image/baselines/box_grouped-multicategory.png index 395b10cc106..22605b01a07 100644 Binary files a/test/image/baselines/box_grouped-multicategory.png and b/test/image/baselines/box_grouped-multicategory.png differ diff --git a/test/image/baselines/date_axes_period_breaks_automargin.png b/test/image/baselines/date_axes_period_breaks_automargin.png index 4ccf3e75f3f..2b7679051da 100644 Binary files a/test/image/baselines/date_axes_period_breaks_automargin.png and b/test/image/baselines/date_axes_period_breaks_automargin.png differ diff --git a/test/image/baselines/domain_ref_axis_types.png b/test/image/baselines/domain_ref_axis_types.png new file mode 100644 index 00000000000..88a884fe3ea Binary files /dev/null and b/test/image/baselines/domain_ref_axis_types.png differ diff --git a/test/image/baselines/domain_refs.png b/test/image/baselines/domain_refs.png new file mode 100644 index 00000000000..7347652f223 Binary files /dev/null and b/test/image/baselines/domain_refs.png differ diff --git a/test/image/baselines/geo_country-names.png b/test/image/baselines/geo_country-names.png index 921a87a1571..31d5d096d9b 100644 Binary files a/test/image/baselines/geo_country-names.png and b/test/image/baselines/geo_country-names.png differ diff --git a/test/image/baselines/geo_custom-colorscale.png b/test/image/baselines/geo_custom-colorscale.png index f5f38305461..8ed84752d25 100644 Binary files a/test/image/baselines/geo_custom-colorscale.png and b/test/image/baselines/geo_custom-colorscale.png differ diff --git a/test/image/baselines/gl2d_marker_coloraxis.png b/test/image/baselines/gl2d_marker_coloraxis.png index e1ec515186a..4724448d777 100644 Binary files a/test/image/baselines/gl2d_marker_coloraxis.png and b/test/image/baselines/gl2d_marker_coloraxis.png differ diff --git a/test/image/baselines/gl2d_parcoords_rgba_colorscale.png b/test/image/baselines/gl2d_parcoords_rgba_colorscale.png index 5e9f663bad7..4903a01242e 100644 Binary files a/test/image/baselines/gl2d_parcoords_rgba_colorscale.png and b/test/image/baselines/gl2d_parcoords_rgba_colorscale.png differ diff --git a/test/image/baselines/gl2d_period_positioning.png b/test/image/baselines/gl2d_period_positioning.png new file mode 100644 index 00000000000..a861bd64403 Binary files /dev/null and b/test/image/baselines/gl2d_period_positioning.png differ diff --git a/test/image/baselines/gl3d_coloraxes.png b/test/image/baselines/gl3d_coloraxes.png index 0fd3f7530e5..df31cb21eab 100644 Binary files a/test/image/baselines/gl3d_coloraxes.png and b/test/image/baselines/gl3d_coloraxes.png differ diff --git a/test/image/baselines/gl3d_scatter3d-colorscale-marker-and-line.png b/test/image/baselines/gl3d_scatter3d-colorscale-marker-and-line.png index b5b807b9f5c..91b4fe027c2 100644 Binary files a/test/image/baselines/gl3d_scatter3d-colorscale-marker-and-line.png and b/test/image/baselines/gl3d_scatter3d-colorscale-marker-and-line.png differ diff --git a/test/image/baselines/gl3d_surface-heatmap-treemap_transparent-colorscale.png b/test/image/baselines/gl3d_surface-heatmap-treemap_transparent-colorscale.png new file mode 100644 index 00000000000..cc9d130b545 Binary files /dev/null and b/test/image/baselines/gl3d_surface-heatmap-treemap_transparent-colorscale.png differ diff --git a/test/image/baselines/image_source_axis_reverse.png b/test/image/baselines/image_source_axis_reverse.png new file mode 100644 index 00000000000..4c7120a508f Binary files /dev/null and b/test/image/baselines/image_source_axis_reverse.png differ diff --git a/test/image/baselines/legend_itemwidth_dashline.png b/test/image/baselines/legend_itemwidth_dashline.png new file mode 100644 index 00000000000..016e4aaa4d2 Binary files /dev/null and b/test/image/baselines/legend_itemwidth_dashline.png differ diff --git a/test/image/baselines/legend_small_horizontal.png b/test/image/baselines/legend_small_horizontal.png index 97445e02ebe..925f8396be2 100644 Binary files a/test/image/baselines/legend_small_horizontal.png and b/test/image/baselines/legend_small_horizontal.png differ diff --git a/test/image/baselines/mapbox_scattercluster.png b/test/image/baselines/mapbox_scattercluster.png new file mode 100644 index 00000000000..dc859b2668b Binary files /dev/null and b/test/image/baselines/mapbox_scattercluster.png differ diff --git a/test/image/baselines/matching-categories.png b/test/image/baselines/matching-categories.png index e5c61632275..31d2a3c52c7 100644 Binary files a/test/image/baselines/matching-categories.png and b/test/image/baselines/matching-categories.png differ diff --git a/test/image/baselines/missing-category-order.png b/test/image/baselines/missing-category-order.png new file mode 100644 index 00000000000..de52a7cfc06 Binary files /dev/null and b/test/image/baselines/missing-category-order.png differ diff --git a/test/image/baselines/period_positioning.png b/test/image/baselines/period_positioning.png new file mode 100644 index 00000000000..69cacd47bb3 Binary files /dev/null and b/test/image/baselines/period_positioning.png differ diff --git a/test/image/baselines/period_positioning2.png b/test/image/baselines/period_positioning2.png new file mode 100644 index 00000000000..71917ac6b72 Binary files /dev/null and b/test/image/baselines/period_positioning2.png differ diff --git a/test/image/baselines/period_positioning3.png b/test/image/baselines/period_positioning3.png new file mode 100644 index 00000000000..82f414d893b Binary files /dev/null and b/test/image/baselines/period_positioning3.png differ diff --git a/test/image/baselines/period_positioning4.png b/test/image/baselines/period_positioning4.png new file mode 100644 index 00000000000..f885f15c384 Binary files /dev/null and b/test/image/baselines/period_positioning4.png differ diff --git a/test/image/baselines/period_positioning5.png b/test/image/baselines/period_positioning5.png new file mode 100644 index 00000000000..ed5326bda35 Binary files /dev/null and b/test/image/baselines/period_positioning5.png differ diff --git a/test/image/baselines/period_positioning6.png b/test/image/baselines/period_positioning6.png new file mode 100644 index 00000000000..0a60dc74996 Binary files /dev/null and b/test/image/baselines/period_positioning6.png differ diff --git a/test/image/baselines/period_positioning7.png b/test/image/baselines/period_positioning7.png new file mode 100644 index 00000000000..0192fe0aa8b Binary files /dev/null and b/test/image/baselines/period_positioning7.png differ diff --git a/test/image/baselines/period_positioning8.png b/test/image/baselines/period_positioning8.png new file mode 100644 index 00000000000..80a692e441c Binary files /dev/null and b/test/image/baselines/period_positioning8.png differ diff --git a/test/image/baselines/sunburst_inside-text-orientation_clock.png b/test/image/baselines/sunburst_inside-text-orientation_clock.png index 1216ae00c05..24bcfbf2481 100644 Binary files a/test/image/baselines/sunburst_inside-text-orientation_clock.png and b/test/image/baselines/sunburst_inside-text-orientation_clock.png differ diff --git a/test/image/baselines/ticklabelposition-0.png b/test/image/baselines/ticklabelposition-0.png new file mode 100644 index 00000000000..37f4a5c26cd Binary files /dev/null and b/test/image/baselines/ticklabelposition-0.png differ diff --git a/test/image/baselines/ticklabelposition-1.png b/test/image/baselines/ticklabelposition-1.png new file mode 100644 index 00000000000..85c116eb93f Binary files /dev/null and b/test/image/baselines/ticklabelposition-1.png differ diff --git a/test/image/baselines/ticklabelposition-2.png b/test/image/baselines/ticklabelposition-2.png new file mode 100644 index 00000000000..d9d94d1e6de Binary files /dev/null and b/test/image/baselines/ticklabelposition-2.png differ diff --git a/test/image/baselines/ticklabelposition-a.png b/test/image/baselines/ticklabelposition-a.png new file mode 100644 index 00000000000..2270af98e82 Binary files /dev/null and b/test/image/baselines/ticklabelposition-a.png differ diff --git a/test/image/baselines/ticklabelposition-b.png b/test/image/baselines/ticklabelposition-b.png new file mode 100644 index 00000000000..5fbdc96f3cf Binary files /dev/null and b/test/image/baselines/ticklabelposition-b.png differ diff --git a/test/image/baselines/ticklabelposition-c.png b/test/image/baselines/ticklabelposition-c.png new file mode 100644 index 00000000000..09b2c6ea530 Binary files /dev/null and b/test/image/baselines/ticklabelposition-c.png differ diff --git a/test/image/baselines/ticklabelposition-d.png b/test/image/baselines/ticklabelposition-d.png new file mode 100644 index 00000000000..81d2cc7b4a4 Binary files /dev/null and b/test/image/baselines/ticklabelposition-d.png differ diff --git a/test/image/baselines/treemap_sunburst_basic.png b/test/image/baselines/treemap_sunburst_basic.png index c7716c8308c..0e5970bd860 100644 Binary files a/test/image/baselines/treemap_sunburst_basic.png and b/test/image/baselines/treemap_sunburst_basic.png differ diff --git a/test/image/baselines/treemap_textposition.png b/test/image/baselines/treemap_textposition.png index 82a137dc35b..9ae06f087a7 100644 Binary files a/test/image/baselines/treemap_textposition.png and b/test/image/baselines/treemap_textposition.png differ diff --git a/test/image/baselines/vertical-tickangles.png b/test/image/baselines/vertical-tickangles.png new file mode 100644 index 00000000000..3cdae815068 Binary files /dev/null and b/test/image/baselines/vertical-tickangles.png differ diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index 6ab557722dc..93ec06d83fc 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -103,8 +103,8 @@ if(allMock || argv.filter) { var FLAKY_LIST = [ 'treemap_coffee', 'treemap_textposition', - 'treemap_sunburst_marker_colors', 'treemap_with-without_values', + 'gl3d_directions-streamtube1', ]; console.log(''); diff --git a/test/image/mocks/automargin-large-margins-both-sides.json b/test/image/mocks/automargin-large-margins-both-sides.json new file mode 100644 index 00000000000..66c741b0bea --- /dev/null +++ b/test/image/mocks/automargin-large-margins-both-sides.json @@ -0,0 +1,54 @@ +{ + "data": [{ + "name": "< D E A T H >", + "marker": { "color": "red" }, + "y": [ + "Antonio Vivaldi", + "Johann Sebastian Bach", + "Wolfgang Amadeus Mozart", + "Ludwig van Beethoven" + ], + "x": [ + "1741", + "1750", + "1791", + "1827" + ] + }, + { + "name": "< B I R T H >", + "marker": { "color": "blue" }, + "y": [ + "Antonio Vivaldi", + "Johann Sebastian Bach", + "Wolfgang Amadeus Mozart", + "Ludwig van Beethoven" + ], + "x": [ + "1678", + "1685", + "1756", + "1770" + ] + }], + "layout": { + "title": { + "text": "Longest and shortest
names and time periods" + }, + "width": 200, + "height": 200, + "margin": { + "t": 80, + "b": 20, + "l": 20, + "r": 20 + }, + "xaxis": { + "type": "date", + "automargin": true + }, + "yaxis": { + "automargin": true + } + } +} diff --git a/test/image/mocks/automargin-large-margins-horizontal.json b/test/image/mocks/automargin-large-margins-horizontal.json new file mode 100644 index 00000000000..931e87a4731 --- /dev/null +++ b/test/image/mocks/automargin-large-margins-horizontal.json @@ -0,0 +1,55 @@ +{ + "data": [{ + "name": "< D E A T H >", + "marker": { "color": "red" }, + "y": [ + "Antonio Vivaldi", + "Johann Sebastian Bach", + "Wolfgang Amadeus Mozart", + "Ludwig van Beethoven" + ], + "x": [ + "1741", + "1750", + "1791", + "1827" + ] + }, + { + "name": "< B I R T H >", + "marker": { "color": "blue" }, + "y": [ + "Antonio Vivaldi", + "Johann Sebastian Bach", + "Wolfgang Amadeus Mozart", + "Ludwig van Beethoven" + ], + "x": [ + "1678", + "1685", + "1756", + "1770" + ] + }], + "layout": { + "showlegend": false, + "title": { + "text": "Longest and shortest
names and time periods" + }, + "width": 240, + "height": 200, + "margin": { + "t": 80, + "b": 20, + "l": 20, + "r": 20 + }, + "xaxis": { + "type": "date", + "automargin": true + }, + "yaxis": { + "automargin": true + } + } +} diff --git a/test/image/mocks/automargin-large-margins.json b/test/image/mocks/automargin-large-margins.json new file mode 100644 index 00000000000..589ba2a2213 --- /dev/null +++ b/test/image/mocks/automargin-large-margins.json @@ -0,0 +1,54 @@ +{ + "data": [{ + "name": "< D E A T H >", + "marker": { "color": "red" }, + "x": [ + "Antonio Vivaldi", + "Johann Sebastian Bach", + "Wolfgang Amadeus Mozart", + "Ludwig van Beethoven" + ], + "y": [ + "1741", + "1750", + "1791", + "1827" + ] + }, + { + "name": "< B I R T H >", + "marker": { "color": "blue" }, + "x": [ + "Antonio Vivaldi", + "Johann Sebastian Bach", + "Wolfgang Amadeus Mozart", + "Ludwig van Beethoven" + ], + "y": [ + "1678", + "1685", + "1756", + "1770" + ] + }], + "layout": { + "title": { + "text": "Longest and shortest
names and time periods" + }, + "width": 240, + "height": 300, + "margin": { + "t": 80, + "b": 20, + "l": 20, + "r": 20 + }, + "yaxis": { + "type": "date", + "automargin": true + }, + "xaxis": { + "automargin": true + } + } +} diff --git a/test/image/mocks/axes_breaks-contour1d.json b/test/image/mocks/axes_breaks-contour1d.json index dbc9c4f052b..c218b2d504c 100644 --- a/test/image/mocks/axes_breaks-contour1d.json +++ b/test/image/mocks/axes_breaks-contour1d.json @@ -856,6 +856,7 @@ "text": "1D-z-array contour with rangebreaks" }, "xaxis": { + "dtick": 1800000, "rangebreaks": [ { "pattern": "hour", diff --git a/test/image/mocks/axes_breaks-contour2d.json b/test/image/mocks/axes_breaks-contour2d.json index 94823f364c4..d4dcf9c7661 100644 --- a/test/image/mocks/axes_breaks-contour2d.json +++ b/test/image/mocks/axes_breaks-contour2d.json @@ -128,6 +128,7 @@ "text": "2D-z-array contour with rangebreaks" }, "xaxis": { + "dtick": 1800000, "rangebreaks": [ { "pattern": "hour", diff --git a/test/image/mocks/axes_breaks-heatmap1d.json b/test/image/mocks/axes_breaks-heatmap1d.json index d1bb6cc6a9a..52f8d0f8675 100644 --- a/test/image/mocks/axes_breaks-heatmap1d.json +++ b/test/image/mocks/axes_breaks-heatmap1d.json @@ -856,6 +856,7 @@ "text": "1D-z-array heatmap with rangebreaks" }, "xaxis": { + "dtick": 1800000, "rangebreaks": [ { "pattern": "hour", diff --git a/test/image/mocks/axes_breaks-heatmap2d.json b/test/image/mocks/axes_breaks-heatmap2d.json index 30fcad62abc..1e49b93f6cb 100644 --- a/test/image/mocks/axes_breaks-heatmap2d.json +++ b/test/image/mocks/axes_breaks-heatmap2d.json @@ -128,6 +128,7 @@ "text": "2D-z-array heatmap with rangebreaks" }, "xaxis": { + "dtick": 1800000, "rangebreaks": [ { "pattern": "hour", diff --git a/test/image/mocks/axes_breaks-histogram2d.json b/test/image/mocks/axes_breaks-histogram2d.json index c9cf100821d..846ba0d5848 100644 --- a/test/image/mocks/axes_breaks-histogram2d.json +++ b/test/image/mocks/axes_breaks-histogram2d.json @@ -482,6 +482,7 @@ "2020-01-02 16:55", "2020-01-03 09:55" ], + "dtick": 1800000, "rangebreaks": [{ "pattern": "hour", "bounds": [18, 9] diff --git a/test/image/mocks/axes_breaks-matches.json b/test/image/mocks/axes_breaks-matches.json new file mode 100644 index 00000000000..4e51c5ed55c --- /dev/null +++ b/test/image/mocks/axes_breaks-matches.json @@ -0,0 +1,71 @@ +{ + "data": [ + { + "mode": "lines+markers", + "x": [ + "2020-05-09", + "2020-05-10", + "2020-05-11", + "2020-05-12", + "2020-05-13", + "2020-05-14", + "2020-05-15", + "2020-05-16", + "2020-05-17", + "2020-05-18", + "2020-05-19", + "2020-05-20", + "2020-05-21", + "2020-05-22", + "2020-05-23", + "2020-05-24", + "2020-05-25", + "2020-05-26", + "2020-05-27", + "2020-05-28" + ] + }, + { + "mode": "lines+markers", + "xaxis": "x2", + "yaxis": "y2", + "x": [ + "2020-05-09", + "2020-05-10", + "2020-05-11", + "2020-05-12", + "2020-05-13", + "2020-05-14", + "2020-05-15", + "2020-05-16", + "2020-05-17", + "2020-05-18", + "2020-05-19", + "2020-05-20", + "2020-05-21", + "2020-05-22", + "2020-05-23", + "2020-05-24", + "2020-05-25", + "2020-05-26", + "2020-05-27", + "2020-05-28" + ], + "y0": 10 + } + ], + "layout": { + "showlegend": false, + "width": 600, + "height": 400, + "xaxis": {"domain": [0, 0.45]}, + "xaxis2": { + "rangebreaks": [{"bounds": ["sat", "mon"]}], + "matches": "x", + "anchor": "y2", + "domain": [0.55, 1] + }, + "yaxis2": {"anchor": "x2"}, + "title": {"text": "matches + rangebreaks"} + } +} diff --git a/test/image/mocks/axes_chain_scaleanchor_matches.json b/test/image/mocks/axes_chain_scaleanchor_matches.json new file mode 100644 index 00000000000..36d95c91580 --- /dev/null +++ b/test/image/mocks/axes_chain_scaleanchor_matches.json @@ -0,0 +1,26 @@ +{ + "data": [ + {"z": [[1, 2], [3, 4], [5, 6]], "type": "heatmap", "showscale": false}, + {"z": [[1, 2, 3], [6, 5, 4]], "type": "heatmap", "xaxis": "x2", "yaxis": "y2", "showscale": false}, + {"z": [[1, 6], [2, 5], [3, 4]], "type": "heatmap", "xaxis": "x3", "yaxis": "y3", "showscale": false}, + {"z": [[1, 2, 3], [4, 5, 6]], "type": "heatmap", "xaxis": "x4", "yaxis": "y4", "showscale": false} + ], + "layout": { + "xaxis": {"domain": [0, 0.4], "constrain": "domain"}, + "yaxis": {"domain": [0, 0.3], "constrain": "domain", "scaleanchor": "x", "title": {"text": "constrain domain"}}, + "xaxis2": {"domain": [0.6, 1], "matches": "x", "anchor": "y2", "title": {"text": "<- each right subplot matches
the axes left and below
and all are constrained
to square bricks."}}, + "yaxis2": {"domain": [0.2, 0.5], "matches": "y", "anchor": "x2"}, + "xaxis3": {"domain": [0, 0.4], "constrain": "range", "anchor": "y3"}, + "yaxis3": {"domain": [0.5, 0.8], "constrain": "range", "scaleanchor": "x3", "anchor": "x3", "title": {"text": "constrain range"}}, + "xaxis4": {"domain": [0.6, 1], "matches": "x3", "anchor": "y4"}, + "yaxis4": {"domain": [0.7, 1], "matches": "y3", "anchor": "x4"}, + "shapes": [ + {"x0": 0, "x1": 0.4, "y0": 0, "y1": 0.3, "xref": "paper", "yref": "paper", "type": "rect", "line": {"color": "#888", "dash": "dot"}}, + {"x0": 0.6, "x1": 1, "y0": 0.2, "y1": 0.5, "xref": "paper", "yref": "paper", "type": "rect", "line": {"color": "#888", "dash": "dot"}}, + {"x0": 0, "x1": 0.4, "y0": 0.5, "y1": 0.8, "xref": "paper", "yref": "paper", "type": "rect", "line": {"color": "#888", "dash": "dot"}}, + {"x0": 0.6, "x1": 1, "y0": 0.7, "y1": 1, "xref": "paper", "yref": "paper", "type": "rect", "line": {"color": "#888", "dash": "dot"}} + ], + "width": 700, + "height": 600 + } +} diff --git a/test/image/mocks/axes_chain_scaleanchor_matches2.json b/test/image/mocks/axes_chain_scaleanchor_matches2.json new file mode 100644 index 00000000000..aee211fd4c8 --- /dev/null +++ b/test/image/mocks/axes_chain_scaleanchor_matches2.json @@ -0,0 +1,82 @@ +{ + "data": [ + {"y":[1,2], "marker": {"color": "red"}}, + {"y":[1,2],"xaxis":"x2","yaxis":"y2", "marker": {"color": "red"}}, + {"y":[1,2],"xaxis":"x3","yaxis":"y3", "marker": {"color": "red"}}, + {"y":[1,2],"xaxis":"x4","yaxis":"y4", "marker": {"color": "red"}}, + {"y":[1,2],"xaxis":"x5","yaxis":"y5", "marker": {"color": "green"}}, + {"y":[1,2],"xaxis":"x6","yaxis":"y6", "marker": {"color": "green"}}, + {"y":[1,2],"xaxis":"x7","yaxis":"y7", "marker": {"color": "green"}}, + {"y":[1,2],"xaxis":"x8","yaxis":"y8", "marker": {"color": "green"}}, + {"y":[1,2],"xaxis":"x9","yaxis":"y9", "marker": {"color": "blue"}}, + {"y":[1,2],"xaxis":"x10","yaxis":"y10", "marker": {"color": "blue"}}, + {"y":[1,2],"xaxis":"x11","yaxis":"y11", "marker": {"color": "blue"}}, + {"y":[1,2],"xaxis":"x12","yaxis":"y12", "marker": {"color": "blue"}}, + {"y":[1,2],"xaxis":"x13","yaxis":"y13", "marker": {"color": "black"}}, + {"y":[1,2],"xaxis":"x14","yaxis":"y14", "marker": {"color": "black"}}, + {"y":[1,2],"xaxis":"x15","yaxis":"y15", "marker": {"color": "black"}}, + {"y":[1,2],"xaxis":"x16","yaxis":"y16", "marker": {"color": "black"}} + ], + "layout": { + "xaxis": {"domain": [0, 0.2], "anchor": "y"}, + "yaxis": {"domain": [0, 0.15], "anchor": "x", "matches": "x"}, + "xaxis2": {"domain": [0.25, 0.45], "anchor": "y2", "scaleanchor": "y"}, + "yaxis2": {"domain": [0, 0.15], "anchor": "x2", "matches": "x2"}, + "xaxis3": {"domain": [0.5, 0.7], "anchor": "y3", "scaleanchor": "y2"}, + "yaxis3": {"domain": [0, 0.15], "anchor": "x3", "matches": "x3"}, + "xaxis4": {"domain": [0.75, 0.95], "anchor": "y4", "scaleanchor": "y3"}, + "yaxis4": {"domain": [0, 0.15], "anchor": "x4", "matches": "x4"}, + + "xaxis5": {"domain": [0, 0.2], "anchor": "y5", "constrain": "domain"}, + "yaxis5": {"domain": [0.25, 0.4], "anchor": "x5", "matches": "x5", "constrain": "domain"}, + "xaxis6": {"domain": [0.25, 0.45], "anchor": "y6", "scaleanchor": "y5", "constrain": "domain"}, + "yaxis6": {"domain": [0.25, 0.4], "anchor": "x6", "matches": "x6", "constrain": "domain"}, + "xaxis7": {"domain": [0.5, 0.7], "anchor": "y7", "scaleanchor": "y6", "constrain": "domain"}, + "yaxis7": {"domain": [0.25, 0.4], "anchor": "x7", "matches": "x7", "constrain": "domain"}, + "xaxis8": {"domain": [0.75, 0.95], "anchor": "y8", "scaleanchor": "y7", "constrain": "domain"}, + "yaxis8": {"domain": [0.25, 0.4], "anchor": "x8", "matches": "x8", "constrain": "domain"}, + + "xaxis9": {"domain": [0, 0.15], "anchor": "y9"}, + "yaxis9": {"domain": [0.5, 0.7], "anchor": "x9", "matches": "x9"}, + "xaxis10": {"domain": [0.25, 0.4], "anchor": "y10", "scaleanchor": "y9"}, + "yaxis10": {"domain": [0.5, 0.7], "anchor": "x10", "matches": "x10"}, + "xaxis11": {"domain": [0.5, 0.65], "anchor": "y11", "scaleanchor": "y10"}, + "yaxis11": {"domain": [0.5, 0.7], "anchor": "x11", "matches": "x11"}, + "xaxis12": {"domain": [0.75, 0.9], "anchor": "y12", "scaleanchor": "y11"}, + "yaxis12": {"domain": [0.5, 0.7], "anchor": "x12", "matches": "x12"}, + + "xaxis13": {"domain": [0, 0.15], "anchor": "y13", "constrain": "domain"}, + "yaxis13": {"domain": [0.75, 0.95], "anchor": "x13", "matches": "x13", "constrain": "domain"}, + "xaxis14": {"domain": [0.25, 0.4], "anchor": "y14", "scaleanchor": "y13", "constrain": "domain"}, + "yaxis14": {"domain": [0.75, 0.95], "anchor": "x14", "matches": "x14", "constrain": "domain"}, + "xaxis15": {"domain": [0.5, 0.65], "anchor": "y15", "scaleanchor": "y14", "constrain": "domain"}, + "yaxis15": {"domain": [0.75, 0.95], "anchor": "x15", "matches": "x15", "constrain": "domain"}, + "xaxis16": {"domain": [0.75, 0.9], "anchor": "y16", "scaleanchor": "y15", "constrain": "domain"}, + "yaxis16": {"domain": [0.75, 0.95], "anchor": "x16", "matches": "x16", "constrain": "domain"}, + + "shapes": [ + {"x0": 0, "x1": 0.2, "y0": 0, "y1": 0.15, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.25, "x1": 0.45, "y0": 0, "y1": 0.15, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.5, "x1": 0.7, "y0": 0, "y1": 0.15, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.75, "x1": 0.95, "y0": 0, "y1": 0.15, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0, "x1": 0.2, "y0": 0.25, "y1": 0.4, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.25, "x1": 0.45, "y0": 0.25, "y1": 0.4, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.5, "x1": 0.7, "y0": 0.25, "y1": 0.4, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.75, "x1": 0.95, "y0": 0.25, "y1": 0.4, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0, "x1": 0.15, "y0": 0.5, "y1": 0.7, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.25, "x1": 0.4, "y0": 0.5, "y1": 0.7, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.5, "x1": 0.65, "y0": 0.5, "y1": 0.7, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.75, "x1": 0.9, "y0": 0.5, "y1": 0.7, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0, "x1": 0.15, "y0": 0.75, "y1": 0.95, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.25, "x1": 0.4, "y0": 0.75, "y1": 0.95, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.5, "x1": 0.65, "y0": 0.75, "y1": 0.95, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}}, + {"x0": 0.75, "x1": 0.9, "y0": 0.75, "y1": 0.95, "type": "rect", "xref": "paper", "yref": "paper", "line": {"color": "#ccc", "dash": "dot"}} + ], + "annotations": [{"x": 0, "y": 1, "xanchor": "left", "yanchor": "top", "xref": "paper", "yref": "paper", "showarrow": false, "align": "left", "text": "y matches same x, x scales to the previous y. Subplot aspect ratios compound"}], + + "width": 500, + "height": 500, + "margin": {"l": 50, "r": 0, "t": 0, "b": 50}, + "showlegend": false + } +} diff --git a/test/image/mocks/bar_annotation_max_range_eq_category.json b/test/image/mocks/bar_annotation_max_range_eq_category.json new file mode 100644 index 00000000000..3585b6f479a --- /dev/null +++ b/test/image/mocks/bar_annotation_max_range_eq_category.json @@ -0,0 +1,29 @@ +{ + "data": [ + { + "x": ["1.5", "2.5", "3.5", "Not Known"], + "y": ["1.0", "1.0", "2.0", "1.0"], + "type": "bar" + } + ], + "layout": { + "xaxis": { + "type": "category", + "autorange": true + }, + "annotations": [ + { + "x": "Not Known", + "y": 1, + "text": "Should point to category", + "showarrow": true + }, + { + "x": 1.5, + "y": 1.0, + "text": "Should point to serial number", + "showarrow": true + } + ] + } +} diff --git a/test/image/mocks/domain_ref_axis_types.json b/test/image/mocks/domain_ref_axis_types.json new file mode 100644 index 00000000000..7f32664abcc --- /dev/null +++ b/test/image/mocks/domain_ref_axis_types.json @@ -0,0 +1,1234 @@ +{ + "data": [ + { + "type": "bar", + "x": [ + 1, + 2, + 3, + 4 + ], + "xaxis": "x", + "y": [ + 3, + 1, + 6, + 10 + ], + "yaxis": "y" + }, + { + "type": "bar", + "x": [ + 1, + 2, + 3, + 4 + ], + "xaxis": "x2", + "y": [ + 3, + 1, + 6, + 10 + ], + "yaxis": "y2" + }, + { + "type": "bar", + "x": [ + 0, + 86400000, + 172800000, + 259200000 + ], + "xaxis": "x3", + "y": [ + 3, + 1, + 6, + 10 + ], + "yaxis": "y3" + }, + { + "type": "bar", + "x": [ + "dog", + "cat", + "bear", + "alex" + ], + "xaxis": "x4", + "y": [ + 3, + 1, + 6, + 10 + ], + "yaxis": "y4" + }, + { + "type": "bar", + "x": [ + [ + "A", + "B", + "B", + "C" + ], + [ + "table", + "chair", + "piano", + "mojtaba" + ] + ], + "xaxis": "x5", + "y": [ + 3, + 1, + 6, + 10 + ], + "yaxis": "y5" + }, + { + "orientation": "h", + "type": "bar", + "x": [ + 3, + 1, + 6, + 10 + ], + "xaxis": "x6", + "y": [ + 1, + 2, + 3, + 4 + ], + "yaxis": "y6" + }, + { + "orientation": "h", + "type": "bar", + "x": [ + 3, + 1, + 6, + 10 + ], + "xaxis": "x7", + "y": [ + 1, + 2, + 3, + 4 + ], + "yaxis": "y7" + }, + { + "orientation": "h", + "type": "bar", + "x": [ + 3, + 1, + 6, + 10 + ], + "xaxis": "x8", + "y": [ + 0, + 86400000, + 172800000, + 259200000 + ], + "yaxis": "y8" + }, + { + "orientation": "h", + "type": "bar", + "x": [ + 3, + 1, + 6, + 10 + ], + "xaxis": "x9", + "y": [ + "dog", + "cat", + "bear", + "alex" + ], + "yaxis": "y9" + }, + { + "orientation": "h", + "type": "bar", + "x": [ + 3, + 1, + 6, + 10 + ], + "xaxis": "x10", + "y": [ + [ + "A", + "B", + "B", + "C" + ], + [ + "table", + "chair", + "piano", + "mojtaba" + ] + ], + "yaxis": "y10" + } + ], + "layout": { + "annotations": [ + { + "font": { + "size": 16 + }, + "showarrow": false, + "text": "linear", + "x": 0.08399999999999999, + "xanchor": "center", + "xref": "paper", + "y": 1.0, + "yanchor": "bottom", + "yref": "paper" + }, + { + "font": { + "size": 16 + }, + "showarrow": false, + "text": "log", + "x": 0.292, + "xanchor": "center", + "xref": "paper", + "y": 1.0, + "yanchor": "bottom", + "yref": "paper" + }, + { + "font": { + "size": 16 + }, + "showarrow": false, + "text": "date", + "x": 0.5, + "xanchor": "center", + "xref": "paper", + "y": 1.0, + "yanchor": "bottom", + "yref": "paper" + }, + { + "font": { + "size": 16 + }, + "showarrow": false, + "text": "category", + "x": 0.708, + "xanchor": "center", + "xref": "paper", + "y": 1.0, + "yanchor": "bottom", + "yref": "paper" + }, + { + "font": { + "size": 16 + }, + "showarrow": false, + "text": "multicategory", + "x": 0.9159999999999999, + "xanchor": "center", + "xref": "paper", + "y": 1.0, + "yanchor": "bottom", + "yref": "paper" + } + ], + "shapes": [ + { + "type": "line", + "x0": 3, + "x1": 3, + "xref": "x", + "y0": 0, + "y1": 1, + "yref": "y domain" + }, + { + "type": "line", + "x0": 4, + "x1": 4, + "xref": "x", + "y0": 0, + "y1": 1, + "yref": "y domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x domain", + "y0": 2, + "y1": 2, + "yref": "y" + }, + { + "type": "rect", + "x0": 1, + "x1": 2, + "xref": "x", + "y0": 0, + "y1": 1, + "yref": "y domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x domain", + "y0": 3, + "y1": 5, + "yref": "y" + }, + { + "type": "line", + "x0": 3, + "x1": 3, + "xref": "x2", + "y0": 0, + "y1": 1, + "yref": "y2 domain" + }, + { + "type": "line", + "x0": 4, + "x1": 4, + "xref": "x2", + "y0": 0, + "y1": 1, + "yref": "y2 domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x2 domain", + "y0": 2, + "y1": 2, + "yref": "y2" + }, + { + "type": "rect", + "x0": 1, + "x1": 2, + "xref": "x2", + "y0": 0, + "y1": 1, + "yref": "y2 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x2 domain", + "y0": 3, + "y1": 5, + "yref": "y2" + }, + { + "type": "line", + "x0": 172800000, + "x1": 172800000, + "xref": "x3", + "y0": 0, + "y1": 1, + "yref": "y3 domain" + }, + { + "type": "line", + "x0": 259200000, + "x1": 259200000, + "xref": "x3", + "y0": 0, + "y1": 1, + "yref": "y3 domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x3 domain", + "y0": 2, + "y1": 2, + "yref": "y3" + }, + { + "type": "rect", + "x0": 0, + "x1": 86400000, + "xref": "x3", + "y0": 0, + "y1": 1, + "yref": "y3 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x3 domain", + "y0": 3, + "y1": 5, + "yref": "y3" + }, + { + "type": "line", + "x0": "bear", + "x1": "bear", + "xref": "x4", + "y0": 0, + "y1": 1, + "yref": "y4 domain" + }, + { + "type": "line", + "x0": "alex", + "x1": "alex", + "xref": "x4", + "y0": 0, + "y1": 1, + "yref": "y4 domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x4 domain", + "y0": 2, + "y1": 2, + "yref": "y4" + }, + { + "type": "rect", + "x0": "dog", + "x1": "cat", + "xref": "x4", + "y0": 0, + "y1": 1, + "yref": "y4 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x4 domain", + "y0": 3, + "y1": 5, + "yref": "y4" + }, + { + "type": "line", + "x0": [ + "B", + "piano" + ], + "x1": [ + "B", + "piano" + ], + "xref": "x5", + "y0": 0, + "y1": 1, + "yref": "y5 domain" + }, + { + "type": "line", + "x0": [ + "C", + "mojtaba" + ], + "x1": [ + "C", + "mojtaba" + ], + "xref": "x5", + "y0": 0, + "y1": 1, + "yref": "y5 domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x5 domain", + "y0": 2, + "y1": 2, + "yref": "y5" + }, + { + "type": "rect", + "x0": [ + "A", + "table" + ], + "x1": [ + "B", + "chair" + ], + "xref": "x5", + "y0": 0, + "y1": 1, + "yref": "y5 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x5 domain", + "y0": 3, + "y1": 5, + "yref": "y5" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x6 domain", + "y0": 3, + "y1": 3, + "yref": "y6" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x6 domain", + "y0": 4, + "y1": 4, + "yref": "y6" + }, + { + "type": "line", + "x0": 2, + "x1": 2, + "xref": "x6", + "y0": 0, + "y1": 1, + "yref": "y6 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x6 domain", + "y0": 1, + "y1": 2, + "yref": "y6" + }, + { + "type": "rect", + "x0": 3, + "x1": 5, + "xref": "x6", + "y0": 0, + "y1": 1, + "yref": "y6 domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x7 domain", + "y0": 3, + "y1": 3, + "yref": "y7" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x7 domain", + "y0": 4, + "y1": 4, + "yref": "y7" + }, + { + "type": "line", + "x0": 2, + "x1": 2, + "xref": "x7", + "y0": 0, + "y1": 1, + "yref": "y7 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x7 domain", + "y0": 1, + "y1": 2, + "yref": "y7" + }, + { + "type": "rect", + "x0": 3, + "x1": 5, + "xref": "x7", + "y0": 0, + "y1": 1, + "yref": "y7 domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x8 domain", + "y0": 172800000, + "y1": 172800000, + "yref": "y8" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x8 domain", + "y0": 259200000, + "y1": 259200000, + "yref": "y8" + }, + { + "type": "line", + "x0": 2, + "x1": 2, + "xref": "x8", + "y0": 0, + "y1": 1, + "yref": "y8 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x8 domain", + "y0": 0, + "y1": 86400000, + "yref": "y8" + }, + { + "type": "rect", + "x0": 3, + "x1": 5, + "xref": "x8", + "y0": 0, + "y1": 1, + "yref": "y8 domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x9 domain", + "y0": "bear", + "y1": "bear", + "yref": "y9" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x9 domain", + "y0": "alex", + "y1": "alex", + "yref": "y9" + }, + { + "type": "line", + "x0": 2, + "x1": 2, + "xref": "x9", + "y0": 0, + "y1": 1, + "yref": "y9 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x9 domain", + "y0": "dog", + "y1": "cat", + "yref": "y9" + }, + { + "type": "rect", + "x0": 3, + "x1": 5, + "xref": "x9", + "y0": 0, + "y1": 1, + "yref": "y9 domain" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x10 domain", + "y0": [ + "B", + "piano" + ], + "y1": [ + "B", + "piano" + ], + "yref": "y10" + }, + { + "type": "line", + "x0": 0, + "x1": 1, + "xref": "x10 domain", + "y0": [ + "C", + "mojtaba" + ], + "y1": [ + "C", + "mojtaba" + ], + "yref": "y10" + }, + { + "type": "line", + "x0": 2, + "x1": 2, + "xref": "x10", + "y0": 0, + "y1": 1, + "yref": "y10 domain" + }, + { + "type": "rect", + "x0": 0, + "x1": 1, + "xref": "x10 domain", + "y0": [ + "A", + "table" + ], + "y1": [ + "B", + "chair" + ], + "yref": "y10" + }, + { + "type": "rect", + "x0": 3, + "x1": 5, + "xref": "x10", + "y0": 0, + "y1": 1, + "yref": "y10 domain" + } + ], + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + } + }, + "type": "bar" + } + ] + }, + "layout": { + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0.0, + 0.16799999999999998 + ], + "tickfont": { + "size": 8 + }, + "type": "linear" + }, + "xaxis10": { + "anchor": "y10", + "domain": [ + 0.832, + 1.0 + ], + "tickfont": { + "size": 8 + } + }, + "xaxis2": { + "anchor": "y2", + "domain": [ + 0.208, + 0.376 + ], + "tickfont": { + "size": 8 + }, + "type": "log" + }, + "xaxis3": { + "anchor": "y3", + "domain": [ + 0.416, + 0.584 + ], + "tickfont": { + "size": 8 + }, + "type": "date" + }, + "xaxis4": { + "anchor": "y4", + "domain": [ + 0.624, + 0.792 + ], + "tickfont": { + "size": 8 + }, + "type": "category" + }, + "xaxis5": { + "anchor": "y5", + "domain": [ + 0.832, + 1.0 + ], + "tickfont": { + "size": 8 + }, + "type": "multicategory" + }, + "xaxis6": { + "anchor": "y6", + "domain": [ + 0.0, + 0.16799999999999998 + ], + "tickfont": { + "size": 8 + } + }, + "xaxis7": { + "anchor": "y7", + "domain": [ + 0.208, + 0.376 + ], + "tickfont": { + "size": 8 + } + }, + "xaxis8": { + "anchor": "y8", + "domain": [ + 0.416, + 0.584 + ], + "tickfont": { + "size": 8 + } + }, + "xaxis9": { + "anchor": "y9", + "domain": [ + 0.624, + 0.7248 + ], + "tickfont": { + "size": 8 + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0.625, + 1.0 + ], + "tickfont": { + "size": 8 + } + }, + "yaxis10": { + "anchor": "x10", + "domain": [ + 0.0, + 0.375 + ], + "tickfont": { + "size": 8 + }, + "type": "multicategory" + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0.625, + 1.0 + ], + "tickfont": { + "size": 8 + } + }, + "yaxis3": { + "anchor": "x3", + "domain": [ + 0.625, + 1.0 + ], + "tickfont": { + "size": 8 + } + }, + "yaxis4": { + "anchor": "x4", + "domain": [ + 0.625, + 1.0 + ], + "tickfont": { + "size": 8 + } + }, + "yaxis5": { + "anchor": "x5", + "domain": [ + 0.625, + 1.0 + ], + "tickfont": { + "size": 8 + } + }, + "yaxis6": { + "anchor": "x6", + "domain": [ + 0.0, + 0.375 + ], + "tickfont": { + "size": 8 + }, + "type": "linear" + }, + "yaxis7": { + "anchor": "x7", + "domain": [ + 0.0, + 0.375 + ], + "tickfont": { + "size": 8 + }, + "type": "log" + }, + "yaxis8": { + "anchor": "x8", + "domain": [ + 0.0, + 0.375 + ], + "tickfont": { + "size": 8 + }, + "type": "date" + }, + "yaxis9": { + "anchor": "x9", + "domain": [ + 0.0, + 0.375 + ], + "tickfont": { + "size": 8 + }, + "type": "category" + } + } +} diff --git a/test/image/mocks/domain_refs.json b/test/image/mocks/domain_refs.json new file mode 100644 index 00000000000..af56005cc3a --- /dev/null +++ b/test/image/mocks/domain_refs.json @@ -0,0 +1,221 @@ +{ + "data": [{ + "type": "scatter", + "x": [], + "xaxis": "x", + "y": [], + "yaxis": "y" + }, + { + "type": "scatter", + "x": [], + "xaxis": "x2", + "y": [], + "yaxis": "y2" + }, + { + "type": "scatter", + "x": [], + "xaxis": "x3", + "y": [], + "yaxis": "y3" + }, + { + "type": "scatter", + "x": [], + "xaxis": "x4", + "y": [], + "yaxis": "y4" + } + ], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [ + 0.0, + 0.45 + ], + "range": [ + 1, + 10 + ] + }, + "xaxis2": { + "anchor": "y2", + "type": "log", + "domain": [ + 0.55, + 1.0 + ], + "range": [ + 0, + 1 + ] + }, + "xaxis3": { + "anchor": "y3", + "domain": [ + 0.0, + 0.45 + ], + "range": [ + 1, + 10 + ] + }, + "xaxis4": { + "anchor": "y4", + "type": "log", + "domain": [ + 0.55, + 1.0 + ], + "range": [ + 0, + 1 + ] + }, + "yaxis": { + "anchor": "x", + "type": "log", + "domain": [ + 0.575, + 1 + ], + "range": [ + 0, + 1 + ] + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0.575, + 1 + ], + "range": [ + 1, + 10 + ] + }, + "yaxis3": { + "anchor": "x3", + "type": "log", + "domain": [ + 0.0, + 0.425 + ], + "range": [ + 0, + 1 + ] + }, + "yaxis4": { + "anchor": "x4", + "domain": [ + 0.0, + 0.425 + ], + "range": [ + 1, + 10 + ] + }, + "shapes": [{ + "type": "line", + "xref": "x3", + "yref": "y3 domain", + "x0": 6, + "y0": 0, + "x1": 6, + "y1": 1, + "line": { + "color": "rgb(10, 20, 30)" + } + }, { + "type": "line", + "xref": "x4 domain", + "yref": "y4", + "x0": 0, + "y0": 8, + "x1": 1, + "y1": 8, + "line": { + "color": "rgb(10, 20, 31)" + } + },{ + "type": "rect", + "xref": "x domain", + "yref": "y", + "x0": 0, + "y0": 4, + "x1": 1, + "y1": 9, + "line": { + "color": "rgb(10, 20, 32)" + } + }, { + "type": "rect", + "xref": "x2", + "yref": "y2 domain", + "x0": 1, + "y0": 0, + "x1": 3, + "y1": 1, + "line": { + "color": "rgb(10, 20, 33)" + } + }], + "annotations": [{ + "text": "A", + "bordercolor": "rgb(100, 200, 232)", + "xref": "x3 domain", + "yref": "y3 domain", + "x": 0, + "y": 0, + "axref": "x3 domain", + "ayref": "y3 domain", + "ax": 0.5, + "ay": 0.5, + "arrowcolor": "rgb(231, 200, 100)" + }, { + "text": "B", + "bordercolor": "rgb(200, 200, 232)", + "xref": "x4 domain", + "yref": "y4 domain", + "x": 1, + "y": 1, + "axref": "x4 domain", + "ayref": "y4 domain", + "ax": 0.5, + "ay": 0.5, + "arrowcolor": "rgb(231, 200, 200)" + }], + "images": [{ + "source": "https://images.plot.ly/language-icons/api-home/js-logo.png", + "xref": "x domain", + "yref": "y domain", + "x": 0, + "y": 0, + "xanchor": "left", + "yanchor": "bottom", + "sizex": 0.5, + "sizey": 0.5, + "sizing": "stretch" + }, { + "source": "https://images.plot.ly/language-icons/api-home/python-logo.png", + "xref": "x2 domain", + "yref": "y2 domain", + "x": 1, + "y": 1, + "xanchor": "right", + "yanchor": "top", + "sizex": 0.5, + "sizey": 0.5, + "sizing": "stretch" + }] + }, + "config": { + "editable": true + } +} diff --git a/test/image/mocks/geo_country-names.json b/test/image/mocks/geo_country-names.json index 017b9460c87..c8913decb22 100644 --- a/test/image/mocks/geo_country-names.json +++ b/test/image/mocks/geo_country-names.json @@ -391,6 +391,12 @@ ], "zmin": 0.1, "zmax": 17.5, + "colorbar": { + "dtick": 1, + "ticks": "inside", + "ticklen": 16, + "ticklabelposition": "inside bottom" + }, "colorscale": [ [ 0, diff --git a/test/image/mocks/geo_custom-colorscale.json b/test/image/mocks/geo_custom-colorscale.json index 9f86a33fcde..fc80db14726 100644 --- a/test/image/mocks/geo_custom-colorscale.json +++ b/test/image/mocks/geo_custom-colorscale.json @@ -16,6 +16,11 @@ 60, 40 ], + "colorbar": { + "ticks": "inside", + "ticklen": 16, + "ticklabelposition": "inside bottom" + }, "colorscale": "Greens", "reversescale": true, "zmin": 0, diff --git a/test/image/mocks/gl2d_parcoords_rgba_colorscale.json b/test/image/mocks/gl2d_parcoords_rgba_colorscale.json index 758943ab768..af0071930bc 100644 --- a/test/image/mocks/gl2d_parcoords_rgba_colorscale.json +++ b/test/image/mocks/gl2d_parcoords_rgba_colorscale.json @@ -32,6 +32,10 @@ "rgba(0,0,255,1)" ] ], + "colorbar": { + "ticks": "inside", + "ticklabelposition": "inside" + }, "showscale": true }, "type": "parcoords" diff --git a/test/image/mocks/gl2d_period_positioning.json b/test/image/mocks/gl2d_period_positioning.json new file mode 100644 index 00000000000..358e8872653 --- /dev/null +++ b/test/image/mocks/gl2d_period_positioning.json @@ -0,0 +1,34 @@ +{ + "data": [ + { + "name": "scattergl", + "type": "scattergl", + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01", "2005-01-01", "2006-01-01"], + "y": ["1970-01-01", "1970-02-01", "1970-03-01", "1970-04-01", "1970-05-01", "1970-06-01"], + "xperiod": "M12", + "xperiodalignment": "middle", + "yperiod": "M1", + "yperiodalignment": "middle" + } + ], + "layout": { + "width": 600, + "height": 300, + "margin": { + "t": 30, + "b": 30 + }, + "showlegend": true, + "hovermode": "closest", + + "xaxis": { + "ticklabelmode": "period", + "tickcolor": "black" + }, + + "yaxis": { + "ticklabelmode": "period", + "tickcolor": "black" + } + } +} diff --git a/test/image/mocks/gl3d_coloraxes.json b/test/image/mocks/gl3d_coloraxes.json index 0f4e16c94a9..0e8c59971e4 100644 --- a/test/image/mocks/gl3d_coloraxes.json +++ b/test/image/mocks/gl3d_coloraxes.json @@ -1247,7 +1247,9 @@ "colorscale": "Viridis", "colorbar": { "x": -0.1, - "xanchor": "right" + "xanchor": "right", + "ticks": "inside", + "ticklabelposition": "inside bottom" } }, "coloraxis2": { @@ -1255,7 +1257,9 @@ "reversescale": true, "colorbar": { "x": 1.1, - "xanchor": "left" + "xanchor": "left", + "ticks": "outside", + "ticklabelposition": "outside bottom" } } } diff --git a/test/image/mocks/gl3d_scatter3d-colorscale-marker-and-line.json b/test/image/mocks/gl3d_scatter3d-colorscale-marker-and-line.json index c4c6bbf63a1..9257cad862e 100644 --- a/test/image/mocks/gl3d_scatter3d-colorscale-marker-and-line.json +++ b/test/image/mocks/gl3d_scatter3d-colorscale-marker-and-line.json @@ -14,6 +14,7 @@ "len": 0.5, "y": 1, "yanchor": "top", + "ticklabelposition": "inside", "title": {"text": "line colorscale", "side": "right"} } }, @@ -25,6 +26,7 @@ "len": 0.5, "y": 0, "yanchor": "bottom", + "ticklabelposition": "inside", "title": {"text": "marker colorscale", "side": "right"} } diff --git a/test/image/mocks/gl3d_surface-heatmap-treemap_transparent-colorscale.json b/test/image/mocks/gl3d_surface-heatmap-treemap_transparent-colorscale.json new file mode 100644 index 00000000000..4e493d35c73 --- /dev/null +++ b/test/image/mocks/gl3d_surface-heatmap-treemap_transparent-colorscale.json @@ -0,0 +1,210 @@ +{ + "data": [ + { + "type": "treemap", + "labels": [ + "Alpha", + "Bravo", + "Charlie", + "Delta", + "Echo", + "Foxtrot", + "Golf", + "Hotel", + "India", + "Juliet", + "Kilo", + "Lima", + "Mike", + "November", + "Oscar", + "Papa", + "Quebec", + "Romeo", + "Sierra", + "Tango", + "Uniform", + "Victor", + "Whiskey", + "X ray", + "Yankee", + "Zulu" + ], + "parents": [ + "", + "Alpha", + "Alpha", + "Charlie", + "Charlie", + "Charlie", + "Foxtrot", + "Foxtrot", + "Foxtrot", + "Foxtrot", + "Juliet", + "Juliet", + "Juliet", + "Juliet", + "Juliet", + "Oscar", + "Oscar", + "Oscar", + "Oscar", + "Oscar", + "Oscar", + "Uniform", + "Uniform", + "Uniform", + "Uniform", + "Uniform", + "Uniform" + ], + "branchvalues": "total", + "values": [ + 40000, + 2000, + 38000, + 1500, + 2500, + 34000, + 1000, + 2000, + 3000, + 28000, + 1250, + 1750, + 2250, + 2750, + 20000, + 1000, + 1500, + 2000, + 2500, + 3000, + 10000, + 1000, + 1500, + 2000, + 2500, + 3000 + ], + "sort": false, + "level": "Oscar", + "count": "leaves+branches", + "textinfo": "label", + "insidetextorientation": "horizontal", + "marker": { + "line": { + "color": "#777" + }, + "colorscale": [ + [0, "rgba(0,0,255,1)"], + [0.5, "rgba(0,255,0,0.25)"], + [1, "rgba(255,0,0,1)"] + ], + "showscale": false + }, + "domain": { + "x": [0, 0.3] + } + }, + { + "type": "heatmap", + "zsmooth": "best", + "coloraxis": "coloraxis", + "contours": { + "z": { + "show": true + } + }, + "x": [0, 2000, 4000, 6000, 8000], + "y": [0, 2000, 4000, 6000, 8000], + "z": [ + [0, 0, 0, 0, 0], + [0, 500, 4000, 3500, 0], + [0, 1000, 0, 3000, 0], + [0, 1500, 2000, 2500, 0], + [0, 0, 0, 0, 0] + ] + }, + { + "type": "surface", + "coloraxis": "coloraxis", + "contours": { + "z": { + "show": true + } + }, + "x": [0, 2000, 4000, 6000, 8000], + "y": [0, 2000, 4000, 6000, 8000], + "z": [ + [0, 0, 0, 0, 0], + [0, 500, 4000, 3500, 0], + [0, 1000, 0, 3000, 0], + [0, 1500, 2000, 2500, 0], + [0, 0, 0, 0, 0] + ] + } + ], + "layout": { + "width": 1000, + "height": 350, + "title": { + "text": "treemap, heatmap & surface plots with transparent colorscale and engineering formatting" + }, + "coloraxis": { + "colorscale": [ + [0, "rgba(0,0,255,1)"], + [0.5, "rgba(0,255,0,0.25)"], + [1, "rgba(255,0,0,1)"] + ], + "colorbar": { + "minexponent": 0 + } + }, + "margin": { + "t": 75, + "l": 25, + "r": 25, + "b": 25 + }, + "xaxis": { + "domain": [0.35, 0.65], + "minexponent": 0, + "dtick": 2000 + }, + "yaxis": { + "minexponent": 0, + "dtick": 2000 + }, + "scene": { + "xaxis": { + "minexponent": 0, + "dtick": 2000 + }, + "yaxis": { + "minexponent": 0, + "dtick": 2000 + }, + "zaxis": { + "minexponent": 0, + "dtick": 2000 + }, + "domain": { + "x": [0.7, 1] + }, + "camera": { + "eye": { + "x": 0, + "y": 0, + "z": 2.1 + }, + "up": { + "x": 0, + "y": 1, + "z": 0 + } + } + } + } +} diff --git a/test/image/mocks/image_source_axis_reverse.json b/test/image/mocks/image_source_axis_reverse.json new file mode 100644 index 00000000000..edd7b578c5a --- /dev/null +++ b/test/image/mocks/image_source_axis_reverse.json @@ -0,0 +1,60 @@ +{ + "data": [ + { + "colormodel": "rgba", + "type": "image", + "source": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAlCAYAAAAA7LqSAAADmklEQVR4nO2XUWhTVxjHfyfdmKMN1oelK9QSLUVY2RWHrEKtLw66KQX30Ifpg0qxz31wb8O0UNjL1I3h09iDAy000D0Z0DJhEdslBXN7SwZBJmmbErKwNuU2UXDes4d4r700bib33KflD+Ge8+We78sv3/fdcy401VRTTTXVVFMIvxwnEhG5c97fP+lbLPARZHz8qBwY+AAA0zTp69MA/4B8cTo+flRq2n4MY42dMMFgEICRkZ+Uxw2odgigafudq2majn3nWLV8ATGMNdf44cPfd9lVyxeQwcF3MIw1gsEgY2OLzM9fYmDgPebnLzlQquVLj1y//pFcWan+R1eujLm+KxYTHDr0o/K4b6l2GI2efPnY3eTUqSMUiwmgBQDD+ANNC6sOCSgurUxmVAKUSpfp6tpHLJYiFksBL4AXaFr45Vy9lGUkkxmVhpEll9ukra1q6+raB+D68d3d76oK6ZKSjGQyozIWS5HLbVIujwCQyz0jHL4LVIHsT3f3r0xNfS3/zV8jUlpaNsT6eoS2tq/Q9TnSaZOZmRAzMyFKpcvo+hz5fEE5jGcQOxt2GeXzBQC2t6fY3p5y3bu+HnFsqmE8gdh9AThlZGtr67kzDoU6CIU6nPnGxioXLnzD0NCXLC7+rQTGE4jd3MePJ9H1OQBu3PjW2SO2tp6TTvfQ2dnhWjc9PSvs++2rVyl7aun6XTY2Vl22dLqHw4erp97Ozg6WlnqIRqfFqzVqIMADiL3x7cyGrb1733bGds8ArvK6f/+HRkPXVMNHhWj0pMzlNkkmw46tvT1NofAUTXtfPnnyrKbvgwf3yImJpPIznufSOns2C8Dt22EKhafMzq6KfL7XKpfZ1cStrUEeP/YasbY8Hd6KxS/kvXvfkc3eQdO+Z3j4kTh27BMrELCoVCpYlvUqkBBIKWltrb5cLSz8ojQrnpzZEOHwaYaHHwkAISSVSgWAlpYWDCMZMIxkwLIshBAIoXxTBzyA3Lr1p8xm7zA4+DnnzoUEwNWrnzkpEEKQSi04/peXFwMA5XKZoSGT8+c/tHZ7bVwNgcTjJQfixIl2AXDt2qeWlILe3iKAC8LW0lIicOZMdXzggNrDY90g8XhJPnjwswsCqiVlmn8hhETXf3ut38nJhC9vpXU5fR2ErWy2ws2by//pc2WlXE/YN9Ibg9gQ4fDpmhCgvlx8UTxekvF4qeYjJxLptyYmPq6reS9e7Kt7zf9C/wDLc4opp/2WUgAAAABJRU5ErkJggg==" + }, + { + "colormodel": "rgba", + "type": "image", + "xaxis": "x2", + "yaxis": "y2", + "source": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAlCAYAAAAA7LqSAAADmklEQVR4nO2XUWhTVxjHfyfdmKMN1oelK9QSLUVY2RWHrEKtLw66KQX30Ifpg0qxz31wb8O0UNjL1I3h09iDAy000D0Z0DJhEdslBXN7SwZBJmmbErKwNuU2UXDes4d4r700bib33KflD+Ge8+We78sv3/fdcy401VRTTTXVVFMIvxwnEhG5c97fP+lbLPARZHz8qBwY+AAA0zTp69MA/4B8cTo+flRq2n4MY42dMMFgEICRkZ+Uxw2odgigafudq2majn3nWLV8ATGMNdf44cPfd9lVyxeQwcF3MIw1gsEgY2OLzM9fYmDgPebnLzlQquVLj1y//pFcWan+R1eujLm+KxYTHDr0o/K4b6l2GI2efPnY3eTUqSMUiwmgBQDD+ANNC6sOCSgurUxmVAKUSpfp6tpHLJYiFksBL4AXaFr45Vy9lGUkkxmVhpEll9ukra1q6+raB+D68d3d76oK6ZKSjGQyozIWS5HLbVIujwCQyz0jHL4LVIHsT3f3r0xNfS3/zV8jUlpaNsT6eoS2tq/Q9TnSaZOZmRAzMyFKpcvo+hz5fEE5jGcQOxt2GeXzBQC2t6fY3p5y3bu+HnFsqmE8gdh9AThlZGtr67kzDoU6CIU6nPnGxioXLnzD0NCXLC7+rQTGE4jd3MePJ9H1OQBu3PjW2SO2tp6TTvfQ2dnhWjc9PSvs++2rVyl7aun6XTY2Vl22dLqHw4erp97Ozg6WlnqIRqfFqzVqIMADiL3x7cyGrb1733bGds8ArvK6f/+HRkPXVMNHhWj0pMzlNkkmw46tvT1NofAUTXtfPnnyrKbvgwf3yImJpPIznufSOns2C8Dt22EKhafMzq6KfL7XKpfZ1cStrUEeP/YasbY8Hd6KxS/kvXvfkc3eQdO+Z3j4kTh27BMrELCoVCpYlvUqkBBIKWltrb5cLSz8ojQrnpzZEOHwaYaHHwkAISSVSgWAlpYWDCMZMIxkwLIshBAIoXxTBzyA3Lr1p8xm7zA4+DnnzoUEwNWrnzkpEEKQSi04/peXFwMA5XKZoSGT8+c/tHZ7bVwNgcTjJQfixIl2AXDt2qeWlILe3iKAC8LW0lIicOZMdXzggNrDY90g8XhJPnjwswsCqiVlmn8hhETXf3ut38nJhC9vpXU5fR2ErWy2ws2by//pc2WlXE/YN9Ibg9gQ4fDpmhCgvlx8UTxekvF4qeYjJxLptyYmPq6reS9e7Kt7zf9C/wDLc4opp/2WUgAAAABJRU5ErkJggg==" + }, + { + "colormodel": "rgba", + "type": "image", + "xaxis": "x3", + "yaxis": "y3", + "source": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAlCAYAAAAA7LqSAAADmklEQVR4nO2XUWhTVxjHfyfdmKMN1oelK9QSLUVY2RWHrEKtLw66KQX30Ifpg0qxz31wb8O0UNjL1I3h09iDAy000D0Z0DJhEdslBXN7SwZBJmmbErKwNuU2UXDes4d4r700bib33KflD+Ge8+We78sv3/fdcy401VRTTTXVVFMIvxwnEhG5c97fP+lbLPARZHz8qBwY+AAA0zTp69MA/4B8cTo+flRq2n4MY42dMMFgEICRkZ+Uxw2odgigafudq2majn3nWLV8ATGMNdf44cPfd9lVyxeQwcF3MIw1gsEgY2OLzM9fYmDgPebnLzlQquVLj1y//pFcWan+R1eujLm+KxYTHDr0o/K4b6l2GI2efPnY3eTUqSMUiwmgBQDD+ANNC6sOCSgurUxmVAKUSpfp6tpHLJYiFksBL4AXaFr45Vy9lGUkkxmVhpEll9ukra1q6+raB+D68d3d76oK6ZKSjGQyozIWS5HLbVIujwCQyz0jHL4LVIHsT3f3r0xNfS3/zV8jUlpaNsT6eoS2tq/Q9TnSaZOZmRAzMyFKpcvo+hz5fEE5jGcQOxt2GeXzBQC2t6fY3p5y3bu+HnFsqmE8gdh9AThlZGtr67kzDoU6CIU6nPnGxioXLnzD0NCXLC7+rQTGE4jd3MePJ9H1OQBu3PjW2SO2tp6TTvfQ2dnhWjc9PSvs++2rVyl7aun6XTY2Vl22dLqHw4erp97Ozg6WlnqIRqfFqzVqIMADiL3x7cyGrb1733bGds8ArvK6f/+HRkPXVMNHhWj0pMzlNkkmw46tvT1NofAUTXtfPnnyrKbvgwf3yImJpPIznufSOns2C8Dt22EKhafMzq6KfL7XKpfZ1cStrUEeP/YasbY8Hd6KxS/kvXvfkc3eQdO+Z3j4kTh27BMrELCoVCpYlvUqkBBIKWltrb5cLSz8ojQrnpzZEOHwaYaHHwkAISSVSgWAlpYWDCMZMIxkwLIshBAIoXxTBzyA3Lr1p8xm7zA4+DnnzoUEwNWrnzkpEEKQSi04/peXFwMA5XKZoSGT8+c/tHZ7bVwNgcTjJQfixIl2AXDt2qeWlILe3iKAC8LW0lIicOZMdXzggNrDY90g8XhJPnjwswsCqiVlmn8hhETXf3ut38nJhC9vpXU5fR2ErWy2ws2by//pc2WlXE/YN9Ibg9gQ4fDpmhCgvlx8UTxekvF4qeYjJxLptyYmPq6reS9e7Kt7zf9C/wDLc4opp/2WUgAAAABJRU5ErkJggg==" + }, + { + "colormodel": "rgba", + "type": "image", + "xaxis": "x4", + "yaxis": "y4", + "source": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAlCAYAAAAA7LqSAAADmklEQVR4nO2XUWhTVxjHfyfdmKMN1oelK9QSLUVY2RWHrEKtLw66KQX30Ifpg0qxz31wb8O0UNjL1I3h09iDAy000D0Z0DJhEdslBXN7SwZBJmmbErKwNuU2UXDes4d4r700bib33KflD+Ge8+We78sv3/fdcy401VRTTTXVVFMIvxwnEhG5c97fP+lbLPARZHz8qBwY+AAA0zTp69MA/4B8cTo+flRq2n4MY42dMMFgEICRkZ+Uxw2odgigafudq2majn3nWLV8ATGMNdf44cPfd9lVyxeQwcF3MIw1gsEgY2OLzM9fYmDgPebnLzlQquVLj1y//pFcWan+R1eujLm+KxYTHDr0o/K4b6l2GI2efPnY3eTUqSMUiwmgBQDD+ANNC6sOCSgurUxmVAKUSpfp6tpHLJYiFksBL4AXaFr45Vy9lGUkkxmVhpEll9ukra1q6+raB+D68d3d76oK6ZKSjGQyozIWS5HLbVIujwCQyz0jHL4LVIHsT3f3r0xNfS3/zV8jUlpaNsT6eoS2tq/Q9TnSaZOZmRAzMyFKpcvo+hz5fEE5jGcQOxt2GeXzBQC2t6fY3p5y3bu+HnFsqmE8gdh9AThlZGtr67kzDoU6CIU6nPnGxioXLnzD0NCXLC7+rQTGE4jd3MePJ9H1OQBu3PjW2SO2tp6TTvfQ2dnhWjc9PSvs++2rVyl7aun6XTY2Vl22dLqHw4erp97Ozg6WlnqIRqfFqzVqIMADiL3x7cyGrb1733bGds8ArvK6f/+HRkPXVMNHhWj0pMzlNkkmw46tvT1NofAUTXtfPnnyrKbvgwf3yImJpPIznufSOns2C8Dt22EKhafMzq6KfL7XKpfZ1cStrUEeP/YasbY8Hd6KxS/kvXvfkc3eQdO+Z3j4kTh27BMrELCoVCpYlvUqkBBIKWltrb5cLSz8ojQrnpzZEOHwaYaHHwkAISSVSgWAlpYWDCMZMIxkwLIshBAIoXxTBzyA3Lr1p8xm7zA4+DnnzoUEwNWrnzkpEEKQSi04/peXFwMA5XKZoSGT8+c/tHZ7bVwNgcTjJQfixIl2AXDt2qeWlILe3iKAC8LW0lIicOZMdXzggNrDY90g8XhJPnjwswsCqiVlmn8hhETXf3ut38nJhC9vpXU5fR2ErWy2ws2by//pc2WlXE/YN9Ibg9gQ4fDpmhCgvlx8UTxekvF4qeYjJxLptyYmPq6reS9e7Kt7zf9C/wDLc4opp/2WUgAAAABJRU5ErkJggg==" + } + ], + "layout": { + "grid": { + "rows": 2, + "columns": 2, + "pattern": "independent" + }, + "width": 600, + "height": 600, + "margin": { + "t": 35, + "l": 35, + "b": 35, + "r": 35 + }, + "xaxis2": { + "autorange": "reversed" + }, + "yaxis3": { + "range": [ + "8", + "32" + ] + }, + "yaxis4": { + "autorange": true + }, + "xaxis4": { + "autorange": "reversed" + } + } +} diff --git a/test/image/mocks/legend_horizontal_testwrap.json b/test/image/mocks/legend_horizontal_testwrap.json index 2fab5a7585c..55dc1c34f7c 100644 --- a/test/image/mocks/legend_horizontal_testwrap.json +++ b/test/image/mocks/legend_horizontal_testwrap.json @@ -20,7 +20,7 @@ } ], "layout": { - "title": "Testplot", + "title": {"text": "Testplot"}, "width": 400, "height": 300, "legend": {"orientation": "h"}, diff --git a/test/image/mocks/legend_itemwidth_dashline.json b/test/image/mocks/legend_itemwidth_dashline.json new file mode 100644 index 00000000000..000cd459e15 --- /dev/null +++ b/test/image/mocks/legend_itemwidth_dashline.json @@ -0,0 +1,45 @@ +{ + "data": [ + { + "x": [ + 2, + 3, + 4, + 5 + ], + "y": [ + 16, + 5, + 11, + 9 + ], + "line": { + "dash": "dashdot" + }, + "type": "scatter" + }, + { + "x": [ + 1, + 2, + 3, + 4 + ], + "y": [ + 12, + 9, + 15, + 12 + ], + "line": { + "dash": "dash" + }, + "type": "scatter" + } + ], + "layout": { + "legend": { + "itemwidth": 60 + } + } +} diff --git a/test/image/mocks/mapbox_scattercluster.json b/test/image/mocks/mapbox_scattercluster.json new file mode 100644 index 00000000000..9a9ea95e328 --- /dev/null +++ b/test/image/mocks/mapbox_scattercluster.json @@ -0,0 +1,259 @@ +{ + "data": [ + { + "type": "scattermapbox", + "subplot": "mapbox", + "name": "20 (20)", + "mode": "markers", + "marker": { + "size": 20, + "color": "lightgray", + "opacity": 0.5 + }, + "cluster": { + "enabled": true, + "radius": 20, + "color": "yellow" + }, + "lon": [ + -73.56, + -79.38, + -123.12, + -114.07, + -113.49, + -75.69, + -63.57, + -123.36, + -97.13, + -104.61 + ], + "lat": [ + 45.5, + 43.65, + 49.28, + 51.04, + 53.54, + 45.42, + 44.64, + 48.42, + 49.89, + 50.44 + ], + "text": [ + "Montreal", + "Toronto", + "Vancouver", + "Calgary", + "Edmonton", + "Ottawa", + "Halifax", + "Victoria", + "Winnepeg", + "Regina" + ] + }, + { + "type": "scattermapbox", + "subplot": "mapbox2", + "name": "20 (40)", + "mode": "markers", + "marker": { + "size": 20 + }, + "cluster": { + "enabled": true, + "radius": 40 + }, + "lon": [ + -73.56, + -79.38, + -123.12, + -114.07, + -113.49, + -75.69, + -63.57, + -123.36, + -97.13, + -104.61 + ], + "lat": [ + 45.5, + 43.65, + 49.28, + 51.04, + 53.54, + 45.42, + 44.64, + 48.42, + 49.89, + 50.44 + ], + "text": [ + "Montreal", + "Toronto", + "Vancouver", + "Calgary", + "Edmonton", + "Ottawa", + "Halifax", + "Victoria", + "Winnepeg", + "Regina" + ] + }, + { + "type": "scattermapbox", + "subplot": "mapbox3", + "name": "40 (20)", + "mode": "markers", + "marker": { + "size": 40 + }, + "cluster": { + "enabled": true, + "radius": 20 + }, + "lon": [ + -73.56, + -79.38, + -123.12, + -114.07, + -113.49, + -75.69, + -63.57, + -123.36, + -97.13, + -104.61 + ], + "lat": [ + 45.5, + 43.65, + 49.28, + 51.04, + 53.54, + 45.42, + 44.64, + 48.42, + 49.89, + 50.44 + ], + "text": [ + "Montreal", + "Toronto", + "Vancouver", + "Calgary", + "Edmonton", + "Ottawa", + "Halifax", + "Victoria", + "Winnepeg", + "Regina" + ] + }, + { + "type": "scattermapbox", + "subplot": "mapbox4", + "name": "40 (40)", + "mode": "markers", + "marker": { + "size": 40 + }, + "cluster": { + "enabled": true, + "radius": 40 + }, + "lon": [ + -73.56, + -79.38, + -123.12, + -114.07, + -113.49, + -75.69, + -63.57, + -123.36, + -97.13, + -104.61 + ], + "lat": [ + 45.5, + 43.65, + 49.28, + 51.04, + 53.54, + 45.42, + 44.64, + 48.42, + 49.89, + 50.44 + ], + "text": [ + "Montreal", + "Toronto", + "Vancouver", + "Calgary", + "Edmonton", + "Ottawa", + "Halifax", + "Victoria", + "Winnepeg", + "Regina" + ] + } + ], + "layout": { + "title": { + "text": "Clustering points over Canadian cities" + }, + "mapbox": { + "zoom": 2, + "style": "dark", + "center": { + "lon": -90, + "lat": 45 + }, + "domain": { + "x": [0.55, 1], + "y": [0.55, 1] + } + }, + "mapbox2": { + "zoom": 2, + "style": "light", + "center": { + "lon": -90, + "lat": 45 + }, + "domain": { + "x": [0.55, 1], + "y": [0, 0.45] + } + }, + "mapbox3": { + "zoom": 2, + "style": "light", + "center": { + "lon": -90, + "lat": 45 + }, + "domain": { + "x": [0, 0.45], + "y": [0.55, 1] + } + }, + "mapbox4": { + "zoom": 2, + "style": "dark", + "center": { + "lon": -90, + "lat": 45 + }, + "domain": { + "x": [0, 0.45], + "y": [0, 0.45] + } + }, + "height": 800, + "width": 1200, + "autosize": true + } +} diff --git a/test/image/mocks/missing-category-order.json b/test/image/mocks/missing-category-order.json new file mode 100644 index 00000000000..70c78c677c3 --- /dev/null +++ b/test/image/mocks/missing-category-order.json @@ -0,0 +1,41 @@ +{ + "data": [ + { + "type": "histogram", + "x": [ + "A", + "A", + "B" + ] + }, + { + "type": "histogram", + "x": [ + "A", + "A", + "C" + ] + }, + { + "type": "histogram", + "x": [ + "B", + "B" + ] + } + ], + "layout": { + "barmode": "stack", + "xaxis": { + "categoryorder": "total descending" + }, + "width": 300, + "height": 200, + "margin": { + "t": 40, + "b": 20, + "l": 20, + "r": 20 + } + } +} diff --git a/test/image/mocks/period_positioning.json b/test/image/mocks/period_positioning.json new file mode 100644 index 00000000000..fc6be78312e --- /dev/null +++ b/test/image/mocks/period_positioning.json @@ -0,0 +1,220 @@ +{ + "data": [ + { + "xaxis": "x", + "yaxis": "y", + "name": "bar (v)", + "type": "bar", + "y": [1, 2, 3, 4], + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "xperiod": "M12", + "xperiodalignment": "middle" + }, + { + "xaxis": "x", + "yaxis": "y", + "name": "scatter", + "type": "scatter", + "y": [1, 2, 3, 4], + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "xperiod": "M12", + "xperiodalignment": "middle" + }, + + { + "xaxis": "x2", + "yaxis": "y2", + "name": "bar (h)", + "type": "bar", + "orientation": "h", + "x": [1, 2, 3, 4], + "y": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "yperiod": "M12", + "yperiodalignment": "middle" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "name": "scatter2", + "type": "scatter", + "x": [1, 2, 3, 4], + "y": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "yperiod": "M12", + "yperiodalignment": "middle" + }, + + { + "xaxis": "x3", + "yaxis": "y3", + "name": "waterfall", + "type": "waterfall", + "y": [4, -3, 2, -1], + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "xperiod": "M12", + "xperiodalignment": "middle" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "name": "funnel", + "type": "funnel", + "x": [4, 3, 2, 1], + "y": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "yperiod": "M12", + "yperiodalignment": "middle" + }, + + { + "xaxis": "x5", + "yaxis": "y5", + "name": "heatmap", + "type": "heatmap", + "zsmooth": "best", + "showscale": false, + "showlegend": true, + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "y": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "z": [ + [0, 1, 0, 1], + [1, 0, 1, 0], + [0, 1, 0, 1], + [1, 0, 1, 0] + ], + "xperiod": "M12", + "xperiodalignment": "middle", + "yperiod": "M12", + "yperiodalignment": "middle" + }, + + { + "xaxis": "x6", + "yaxis": "y6", + "name": "contour", + "type": "contour", + "colorscale": "Portland", + "showscale": false, + "showlegend": true, + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "y": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "z": [ + [0, 1, 0, 1], + [1, 0, 1, 0], + [0, 1, 0, 1], + [1, 0, 1, 0] + ], + "xperiod": "M12", + "xperiodalignment": "middle", + "yperiod": "M12", + "yperiodalignment": "middle" + } + ], + "layout": { + "width": 1000, + "height": 500, + "showlegend": true, + "hovermode": "closest", + + "xaxis": { + "ticklabelmode": "period", + "tickcolor": "black", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis2": { + "tickcolor": "black", + "anchor": "y2", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis3": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y3", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis4": { + "anchor": "y4", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis5": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y5", + "domain": [ + 0.7, + 1 + ] + }, + "xaxis6": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y6", + "domain": [ + 0.7, + 1 + ] + }, + + "yaxis": { + "tickcolor": "black", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis2": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "x2", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis3": { + "tickcolor": "black", + "anchor": "x3", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis4": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "x4", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis5": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "x5", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis6": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "x6", + "domain": [ + 0.55, + 1 + ] + } + } +} diff --git a/test/image/mocks/period_positioning2.json b/test/image/mocks/period_positioning2.json new file mode 100644 index 00000000000..192e1eb709c --- /dev/null +++ b/test/image/mocks/period_positioning2.json @@ -0,0 +1,136 @@ +{ + "data": [ + { + "xaxis": "x", + "yaxis": "y", + "name": "ohlc", + "type": "ohlc", + "low": [0, 0, 0, 0], + "close": [0.5, 1, 1.5, 2], + "open": [1, 2, 3, 4], + "high": [2, 4, 6, 8], + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "xperiod": "M12", + "xperiodalignment": "middle" + }, + + { + "xaxis": "x2", + "yaxis": "y2", + "name": "candlestick", + "type": "candlestick", + "low": [0, 0, 0, 0], + "close": [0.5, 1, 1.5, 2], + "open": [1, 2, 3, 4], + "high": [2, 4, 6, 8], + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "xperiod": "M12", + "xperiodalignment": "middle" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "name": "box (v)", + "type": "box", + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "lowerfence": [2, 4, 6, 8], + "q1": [4, 5.5, 7, 8.5], + "median": [6, 7, 8, 9], + "q3": [8, 8.5, 9, 9.5], + "upperfence": [10, 10, 10, 10], + "xperiod": "M12", + "xperiodalignment": "middle" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "name": "box (h)", + "type": "box", + "y": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01"], + "lowerfence": [0, 0, 0, 0], + "q1": [0.5, 1, 1.5, 2], + "median": [1, 2, 3, 4], + "q3": [1.5, 3, 4.5, 6], + "upperfence": [2, 4, 6, 8], + "yperiod": "M12", + "yperiodalignment": "middle" + } + ], + "layout": { + "width": 700, + "height": 500, + "showlegend": true, + "hovermode": "closest", + + "xaxis": { + "rangeslider": {"visible": false}, + "ticklabelmode": "period", + "tickcolor": "black", + "domain": [ + 0, + 0.45 + ] + }, + "xaxis2": { + "rangeslider": {"visible": false}, + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y2", + "domain": [ + 0, + 0.45 + ] + }, + "xaxis3": { + "rangeslider": {"visible": false}, + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y3", + "domain": [ + 0.55, + 1 + ] + }, + "xaxis4": { + "tickcolor": "black", + "anchor": "y4", + "domain": [ + 0.55, + 1 + ] + }, + + "yaxis": { + "tickcolor": "black", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis2": { + "tickcolor": "black", + "anchor": "x2", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis3": { + "tickcolor": "black", + "anchor": "x3", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis4": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "x4", + "domain": [ + 0.55, + 1 + ] + } + } +} diff --git a/test/image/mocks/period_positioning3.json b/test/image/mocks/period_positioning3.json new file mode 100644 index 00000000000..a881dd5313a --- /dev/null +++ b/test/image/mocks/period_positioning3.json @@ -0,0 +1,314 @@ +{ + "data": [ + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M1", + "name": "start (M1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-01", "2001-03-01", "2001-04-01", "2001-05-01", "2001-06-01"], + "xperiodalignment": "start" + }, + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M1", + "name": "middle (M1)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-01", "2001-03-01", "2001-04-01", "2001-05-01", "2001-06-01"], + "xperiodalignment": "middle" + }, + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M1", + "name": "end (M1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-01", "2001-03-01", "2001-04-01", "2001-05-01", "2001-06-01"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M2", + "name": "start (M2)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-03-01", "2001-05-01", "2001-07-01", "2001-09-01", "2001-11-01"], + "xperiodalignment": "start" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M2", + "name": "middle (M2)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-03-01", "2001-05-01", "2001-07-01", "2001-09-01", "2001-11-01"], + "xperiodalignment": "middle" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M2", + "name": "end (M2)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-03-01", "2001-05-01", "2001-07-01", "2001-09-01", "2001-11-01"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M3", + "name": "start (M3)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-04-01", "2001-07-01", "2001-10-01", "2002-01-01", "2002-04-01"], + "xperiodalignment": "start" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M3", + "name": "middle (M3)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-04-01", "2001-07-01", "2001-10-01", "2002-01-01", "2002-04-01"], + "xperiodalignment": "middle" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M3", + "name": "end (M3)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-04-01", "2001-07-01", "2001-10-01", "2002-01-01", "2002-04-01"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M6", + "name": "start (M6)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-07-01", "2002-01-01", "2002-07-01", "2003-01-01", "2003-07-01"], + "xperiodalignment": "start" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M6", + "name": "middle (M6)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-07-01", "2002-01-01", "2002-07-01", "2003-01-01", "2003-07-01"], + "xperiodalignment": "middle" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M6", + "name": "end (M6)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-07-01", "2002-01-01", "2002-07-01", "2003-01-01", "2003-07-01"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M12", + "name": "start (M12)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01", "2005-01-01", "2006-01-01"], + "xperiodalignment": "start" + }, + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M12", + "name": "middle (M12)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01", "2005-01-01", "2006-01-01"], + "xperiodalignment": "middle" + }, + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M12", + "name": "end (M12)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2002-01-01", "2003-01-01", "2004-01-01", "2005-01-01", "2006-01-01"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "start (W1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-08", "2001-01-15", "2001-01-22", "2001-01-29", "2001-02-05"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "bar (W1)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-08", "2001-01-15", "2001-01-22", "2001-01-29", "2001-02-05"], + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "start (W1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-08", "2001-01-15", "2001-01-22", "2001-01-29", "2001-02-05"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + } + ], + "layout": { + "width": 1000, + "height": 500, + "margin": { + "t": 50, + "l": 50, + "r": 50, + "b": 50 + }, + "showlegend": true, + "hovermode": "closest", + + "xaxis": { + "ticklabelmode": "period", + "tickcolor": "black", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis2": { + "dtick": "M2", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y2", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis3": { + "dtick": "M3", + "tickformat": "Q%q", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y3", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis4": { + "dtick": "M6", + "tickformat": "%Y", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y4", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis5": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y5", + "domain": [ + 0.7, + 1 + ] + }, + "xaxis6": { + "dtick": 604800000, + "tick0": "2001-01-01", + "ticklabelmode": "period", + "tickformat": "W%V", + "tickcolor": "black", + "anchor": "y6", + "domain": [ + 0.7, + 1 + ] + }, + + "yaxis": { + "tickcolor": "black", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis2": { + "tickcolor": "black", + "anchor": "x2", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis3": { + "tickcolor": "black", + "anchor": "x3", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis4": { + "tickcolor": "black", + "anchor": "x4", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis5": { + "tickcolor": "black", + "anchor": "x5", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis6": { + "tickcolor": "black", + "anchor": "x6", + "domain": [ + 0.55, + 1 + ] + } + } +} diff --git a/test/image/mocks/period_positioning4.json b/test/image/mocks/period_positioning4.json new file mode 100644 index 00000000000..cffd05e9f2a --- /dev/null +++ b/test/image/mocks/period_positioning4.json @@ -0,0 +1,323 @@ +{ + "data": [ + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M1", + "name": "start (M1)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-15", "2001-02-01", "2001-02-15", "2001-03-01", "2001-03-15"], + "xperiodalignment": "start" + }, + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M1", + "name": "middle (M1)", + "marker": { "opacity": 0.5 }, "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-15", "2001-02-01", "2001-02-15", "2001-03-01", "2001-03-15"], + "textposition": "inside", "textangle": 0, "texttemplate": "%{x|%b-%e}", + "xperiodalignment": "middle" + }, + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M1", + "name": "end (M1)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-15", "2001-02-01", "2001-02-15", "2001-03-01", "2001-03-15"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M2", + "name": "start (M2)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-01", "2001-03-01", "2001-04-01", "2001-05-01", "2001-06-01"], + "xperiodalignment": "start" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M2", + "name": "middle (M2)", + "marker": { "opacity": 0.5 }, "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-01", "2001-03-01", "2001-04-01", "2001-05-01", "2001-06-01"], + "textposition": "inside", "textangle": 0, "texttemplate": "%{x|%b-%e}", + "xperiodalignment": "middle" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M2", + "name": "end (M2)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-01", "2001-03-01", "2001-04-01", "2001-05-01", "2001-06-01"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M3", + "name": "start (M3)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-15", "2001-04-01", "2001-05-15", "2001-07-01", "2001-08-15"], + "xperiodalignment": "start" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M3", + "name": "middle (M3)", + "marker": { "opacity": 0.5 }, "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-15", "2001-04-01", "2001-05-15", "2001-07-01", "2001-08-15"], + "textposition": "inside", "textangle": 0, "texttemplate": "%{x|%b-%e}", + "xperiodalignment": "middle" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M3", + "name": "end (M3)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-02-15", "2001-04-01", "2001-05-15", "2001-07-01", "2001-08-15"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M6", + "name": "start (M6)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-04-01", "2001-07-01", "2001-10-01", "2002-01-01", "2002-04-01"], + "xperiodalignment": "start" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M6", + "name": "middle (M6)", + "marker": { "opacity": 0.5 }, "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-04-01", "2001-07-01", "2001-10-01", "2002-01-01", "2002-04-01"], + "textposition": "inside", "textangle": 0, "texttemplate": "%{x|%b-%e}", + "xperiodalignment": "middle" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M6", + "name": "end (M6)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-04-01", "2001-07-01", "2001-10-01", "2002-01-01", "2002-04-01"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M12", + "name": "start (M12)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-07-01", "2002-01-01", "2002-07-01", "2003-01-01", "2003-07-01"], + "xperiodalignment": "start" + }, + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M12", + "name": "middle (M12)", + "marker": { "opacity": 0.5 }, "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-07-01", "2002-01-01", "2002-07-01", "2003-01-01", "2003-07-01"], + "textposition": "inside", "textangle": 0, "texttemplate": "%{x|%b-%e}", + "xperiodalignment": "middle" + }, + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M12", + "name": "end (M12)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-07-01", "2002-01-01", "2002-07-01", "2003-01-01", "2003-07-01"], + "xperiodalignment": "end" + }, + + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "start (W1)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-05", "2001-01-08", "2001-01-12", "2001-01-15", "2001-01-19"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "middle (W1)", + "marker": { "opacity": 0.5 }, "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-05", "2001-01-08", "2001-01-12", "2001-01-15", "2001-01-19"], + "textposition": "inside", "textangle": 0, + "texttemplate": "%{x|%A}", + "hovertemplate": "%{x|%A}, %{y}", + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "end (W1)", + "marker": { "opacity": 0.5 }, "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-05", "2001-01-08", "2001-01-12", "2001-01-15", "2001-01-19"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + } + ], + "layout": { + "barmode": "overlay", + "width": 1000, + "height": 500, + "margin": { + "t": 50, + "l": 50, + "r": 50, + "b": 50 + }, + "showlegend": true, + "hovermode": "closest", + + "xaxis": { + "ticklabelmode": "period", + "tickcolor": "black", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis2": { + "dtick": "M2", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y2", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis3": { + "dtick": "M3", + "tickformat": "Q%q", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y3", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis4": { + "dtick": "M6", + "tickformat": "%Y", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y4", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis5": { + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y5", + "domain": [ + 0.7, + 1 + ] + }, + "xaxis6": { + "dtick": 604800000, + "tick0": "2001-01-01", + "ticklabelmode": "period", + "tickformat": "W%V", + "tickcolor": "black", + "anchor": "y6", + "domain": [ + 0.7, + 1 + ] + }, + + "yaxis": { + "tickcolor": "black", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis2": { + "tickcolor": "black", + "anchor": "x2", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis3": { + "tickcolor": "black", + "anchor": "x3", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis4": { + "tickcolor": "black", + "anchor": "x4", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis5": { + "tickcolor": "black", + "anchor": "x5", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis6": { + "tickcolor": "black", + "anchor": "x6", + "domain": [ + 0.55, + 1 + ] + } + } +} diff --git a/test/image/mocks/period_positioning5.json b/test/image/mocks/period_positioning5.json new file mode 100644 index 00000000000..cde9e35ecd1 --- /dev/null +++ b/test/image/mocks/period_positioning5.json @@ -0,0 +1,334 @@ +{ + "data": [ + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M9", + "name": "start (M9)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2001-10", "2002-07", "2003-04", "2004-01", "2004-10"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M9", + "name": "middle (M9)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2001-10", "2002-07", "2003-04", "2004-01", "2004-10"], + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x", + "yaxis": "y", + "xperiod": "M9", + "name": "end (M9)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2001-10", "2002-07", "2003-04", "2004-01", "2004-10"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + }, + + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M12", + "name": "start (Y1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2002-01", "2003-01", "2004-01", "2005-01", "2006-01"], + "xperiod0": "2002-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M12", + "name": "middle (Y1)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2002-01", "2003-01", "2004-01", "2005-01", "2006-01"], + "xperiod0": "2002-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": "M12", + "name": "end (Y1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2002-01", "2003-01", "2004-01", "2005-01", "2006-01"], + "xperiod0": "2002-01-01", + "xperiodalignment": "end" + }, + + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M18", + "name": "start (Y1.5)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2002-07", "2004-01", "2005-07", "2007-01", "2008-07"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M18", + "name": "middle (Y1.5)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2002-07", "2004-01", "2005-07", "2007-01", "2008-07"], + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": "M18", + "name": "end (Y1.5)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2002-07", "2004-01", "2005-07", "2007-01", "2008-07"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + }, + + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M24", + "name": "start (Y2)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2003-01", "2005-01", "2007-01", "2009-01", "2011-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M24", + "name": "middle (Y2)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2003-01", "2005-01", "2007-01", "2009-01", "2011-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": "M24", + "name": "end (Y2)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2003-01", "2005-01", "2007-01", "2009-01", "2011-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + }, + + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M48", + "name": "start (Y4)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2005-01", "2009-01", "2013-01", "2017-01", "2021-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M48", + "name": "middle (Y4)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2005-01", "2009-01", "2013-01", "2017-01", "2021-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": "M48", + "name": "end (Y4)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2005-01", "2009-01", "2013-01", "2017-01", "2021-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + }, + + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": "M120", + "name": "start (Y10)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2011-01", "2021-01", "2031-01", "2041-01", "2051-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": "M120", + "name": "middle (Y10)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2011-01", "2021-01", "2031-01", "2041-01", "2051-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": "M120", + "name": "end (Y5)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2011-01", "2021-01", "2031-01", "2041-01", "2051-01"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + } + + ], + "layout": { + "width": 1000, + "height": 500, + "margin": { + "t": 50, + "l": 50, + "r": 50, + "b": 50 + }, + "showlegend": true, + "hovermode": "closest", + + "xaxis": { + "tick0": "2001-01", + "dtick": "M9", + "ticklabelmode": "period", + "tickcolor": "black", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis2": { + "tick0": "2001-01", + "dtick": "M12", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y2", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis3": { + "tick0": "2001-01", + "dtick": "M18", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y3", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis4": { + "tick0": "2001-01", + "dtick": "M24", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y4", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis5": { + "tick0": "2001-01", + "dtick": "M48", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y5", + "domain": [ + 0.7, + 1 + ] + }, + "xaxis6": { + "tick0": "2001-01", + "dtick": "M120", + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y6", + "domain": [ + 0.7, + 1 + ] + }, + + "yaxis": { + "tickcolor": "black", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis2": { + "tickcolor": "black", + "anchor": "x2", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis3": { + "tickcolor": "black", + "anchor": "x3", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis4": { + "tickcolor": "black", + "anchor": "x4", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis5": { + "tickcolor": "black", + "anchor": "x5", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis6": { + "tickcolor": "black", + "anchor": "x6", + "domain": [ + 0.55, + 1 + ] + } + } +} diff --git a/test/image/mocks/period_positioning6.json b/test/image/mocks/period_positioning6.json new file mode 100644 index 00000000000..6f1cfaaae9d --- /dev/null +++ b/test/image/mocks/period_positioning6.json @@ -0,0 +1,333 @@ +{ + "data": [ + { + "xaxis": "x", + "yaxis": "y", + "xperiod": 86400000, + "name": "start (D1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-02", "2001-01-03", "2001-01-04", "2001-01-05", "2001-01-06"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x", + "yaxis": "y", + "xperiod": 86400000, + "name": "middle (D1)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-02", "2001-01-03", "2001-01-04", "2001-01-05", "2001-01-06"], + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x", + "yaxis": "y", + "xperiod": 86400000, + "name": "end (D1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-02", "2001-01-03", "2001-01-04", "2001-01-05", "2001-01-06"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + }, + + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": 86400000, + "name": "start (D1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2000-12-31", "2001-01-01", "2001-01-02", "2001-01-03", "2001-01-04", "2001-01-05"], + "xperiod0": "2000-12-31", + "xperiodalignment": "start" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": 86400000, + "name": "middle (D1)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2000-12-31", "2001-01-01", "2001-01-02", "2001-01-03", "2001-01-04", "2001-01-05"], + "xperiod0": "2000-12-31", + "xperiodalignment": "middle" + }, + { + "xaxis": "x2", + "yaxis": "y2", + "xperiod": 86400000, + "name": "end (D1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2000-12-31", "2001-01-01", "2001-01-02", "2001-01-03", "2001-01-04", "2001-01-05"], + "xperiod0": "2000-12-31", + "xperiodalignment": "end" + }, + + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": 172800000, + "name": "start (D2)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-03", "2001-01-05", "2001-01-07", "2001-01-09", "2001-01-11"], + "xperiod0": "2001-01-01", + "xperiodalignment": "start" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": 172800000, + "name": "middle (D2)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-03", "2001-01-05", "2001-01-07", "2001-01-09", "2001-01-11"], + "xperiod0": "2001-01-01", + "xperiodalignment": "middle" + }, + { + "xaxis": "x3", + "yaxis": "y3", + "xperiod": 172800000, + "name": "end (D2)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-03", "2001-01-05", "2001-01-07", "2001-01-09", "2001-01-11"], + "xperiod0": "2001-01-01", + "xperiodalignment": "end" + }, + + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": 172800000, + "name": "start (D2)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-02", "2001-01-04", "2001-01-06", "2001-01-08", "2001-01-10", "2001-01-12"], + "xperiod0": "2001-01-02", + "xperiodalignment": "start" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": 172800000, + "name": "middle (D2)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-02", "2001-01-04", "2001-01-06", "2001-01-08", "2001-01-10", "2001-01-12"], + "xperiod0": "2001-01-02", + "xperiodalignment": "middle" + }, + { + "xaxis": "x4", + "yaxis": "y4", + "xperiod": 172800000, + "name": "end (D2)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-02", "2001-01-04", "2001-01-06", "2001-01-08", "2001-01-10", "2001-01-12"], + "xperiod0": "2001-01-02", + "xperiodalignment": "end" + }, + + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": 604800000, + "name": "start (W1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-08", "2001-01-15", "2001-01-22", "2001-01-29", "2001-02-05"], + "xperiod0": "2000-12-31", + "xperiodalignment": "start" + }, + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": 604800000, + "name": "middle (W1)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-08", "2001-01-15", "2001-01-22", "2001-01-29", "2001-02-05"], + "xperiod0": "2000-12-31", + "xperiodalignment": "middle" + }, + { + "xaxis": "x5", + "yaxis": "y5", + "xperiod": 604800000, + "name": "end (W1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01-01", "2001-01-08", "2001-01-15", "2001-01-22", "2001-01-29", "2001-02-05"], + "xperiod0": "2000-12-31", + "xperiodalignment": "end" + }, + + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "start (W1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2000-12-31", "2001-01-07", "2001-01-14", "2001-01-21", "2001-01-28", "2001-02-04"], + "xperiod0": "2000-12-31", + "xperiodalignment": "start" + }, + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "middle (W1)", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2000-12-31", "2001-01-07", "2001-01-14", "2001-01-21", "2001-01-28", "2001-02-04"], + "xperiod0": "2000-12-31", + "xperiodalignment": "middle" + }, + { + "xaxis": "x6", + "yaxis": "y6", + "xperiod": 604800000, + "name": "end (W1)", + "type": "scatter", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2000-12-31", "2001-01-07", "2001-01-14", "2001-01-21", "2001-01-28", "2001-02-04"], + "xperiod0": "2000-12-31", + "xperiodalignment": "end" + } + ], + "layout": { + "width": 1000, + "height": 500, + "margin": { + "t": 50, + "l": 50, + "r": 50, + "b": 50 + }, + "showlegend": true, + "hovermode": "closest", + + "xaxis": { + "tick0": "2001-01-01", + "dtick": 86400000, + "ticklabelmode": "period", + "tickcolor": "black", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis2": { + "tick0": "2000-12-31", + "dtick": 86400000, + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y2", + "domain": [ + 0, + 0.3 + ] + }, + "xaxis3": { + "tick0": "2001-01-01", + "dtick": 172800000, + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y3", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis4": { + "tick0": "2001-01-02", + "dtick": 172800000, + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y4", + "domain": [ + 0.35, + 0.65 + ] + }, + "xaxis5": { + "tick0": "2001-01-01", + "dtick": 604800000, + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y5", + "domain": [ + 0.7, + 1 + ] + }, + "xaxis6": { + "tick0": "2000-12-31", + "dtick": 604800000, + "ticklabelmode": "period", + "tickcolor": "black", + "anchor": "y6", + "domain": [ + 0.7, + 1 + ] + }, + + "yaxis": { + "tickcolor": "black", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis2": { + "tickcolor": "black", + "anchor": "x2", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis3": { + "tickcolor": "black", + "anchor": "x3", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis4": { + "tickcolor": "black", + "anchor": "x4", + "domain": [ + 0.55, + 1 + ] + }, + "yaxis5": { + "tickcolor": "black", + "anchor": "x5", + "domain": [ + 0, + 0.45 + ] + }, + "yaxis6": { + "tickcolor": "black", + "anchor": "x6", + "domain": [ + 0.55, + 1 + ] + } + } +} diff --git a/test/image/mocks/period_positioning7.json b/test/image/mocks/period_positioning7.json new file mode 100644 index 00000000000..d0a117943f6 --- /dev/null +++ b/test/image/mocks/period_positioning7.json @@ -0,0 +1,387 @@ +{ + "data": [ + { + "xperiod": 604800000, + "xperiod0": "2020-01-06", + "name": "start", + "type": "scatter", + "y": [ + 6, + 13, + 20, + 27, + 34, + 41, + 48, + 55, + 62, + 69, + 76, + 83, + 90, + 97, + 104, + 111, + 118, + 125, + 132, + 139, + 146, + 153, + 160, + 167, + 174, + 181, + 188, + 195, + 202, + 209, + 216, + 223, + 230, + 237, + 244, + 251, + 258, + 265, + 272, + 279, + 286, + 293, + 300, + 307, + 314, + 321, + 328, + 335, + 342, + 349, + 356, + 363 + ], + "x": [ + "2020-01-06", + "2020-01-13", + "2020-01-20", + "2020-01-27", + "2020-02-03", + "2020-02-10", + "2020-02-17", + "2020-02-24", + "2020-03-02", + "2020-03-09", + "2020-03-16", + "2020-03-23", + "2020-03-30", + "2020-04-06", + "2020-04-13", + "2020-04-20", + "2020-04-27", + "2020-05-04", + "2020-05-11", + "2020-05-18", + "2020-05-25", + "2020-06-01", + "2020-06-08", + "2020-06-15", + "2020-06-22", + "2020-06-29", + "2020-07-06", + "2020-07-13", + "2020-07-20", + "2020-07-27", + "2020-08-03", + "2020-08-10", + "2020-08-17", + "2020-08-24", + "2020-08-31", + "2020-09-07", + "2020-09-14", + "2020-09-21", + "2020-09-28", + "2020-10-05", + "2020-10-12", + "2020-10-19", + "2020-10-26", + "2020-11-02", + "2020-11-09", + "2020-11-16", + "2020-11-23", + "2020-11-30", + "2020-12-07", + "2020-12-14", + "2020-12-21", + "2020-12-28" + ], + "xperiodalignment": "start" + }, + { + "xperiod": 604800000, + "xperiod0": "2020-01-06", + "marker": { + "opacity": 0.5, + "line": { + "color": "black", + "width": 1 + } + }, + "name": "middle", + "type": "bar", + "y": [ + 6, + 13, + 20, + 27, + 34, + 41, + 48, + 55, + 62, + 69, + 76, + 83, + 90, + 97, + 104, + 111, + 118, + 125, + 132, + 139, + 146, + 153, + 160, + 167, + 174, + 181, + 188, + 195, + 202, + 209, + 216, + 223, + 230, + 237, + 244, + 251, + 258, + 265, + 272, + 279, + 286, + 293, + 300, + 307, + 314, + 321, + 328, + 335, + 342, + 349, + 356, + 363 + ], + "x": [ + "2020-01-06", + "2020-01-13", + "2020-01-20", + "2020-01-27", + "2020-02-03", + "2020-02-10", + "2020-02-17", + "2020-02-24", + "2020-03-02", + "2020-03-09", + "2020-03-16", + "2020-03-23", + "2020-03-30", + "2020-04-06", + "2020-04-13", + "2020-04-20", + "2020-04-27", + "2020-05-04", + "2020-05-11", + "2020-05-18", + "2020-05-25", + "2020-06-01", + "2020-06-08", + "2020-06-15", + "2020-06-22", + "2020-06-29", + "2020-07-06", + "2020-07-13", + "2020-07-20", + "2020-07-27", + "2020-08-03", + "2020-08-10", + "2020-08-17", + "2020-08-24", + "2020-08-31", + "2020-09-07", + "2020-09-14", + "2020-09-21", + "2020-09-28", + "2020-10-05", + "2020-10-12", + "2020-10-19", + "2020-10-26", + "2020-11-02", + "2020-11-09", + "2020-11-16", + "2020-11-23", + "2020-11-30", + "2020-12-07", + "2020-12-14", + "2020-12-21", + "2020-12-28" + ], + "xperiodalignment": "middle" + }, + { + "xperiod": 604800000, + "xperiod0": "2020-01-06", + "name": "end", + "type": "scatter", + "y": [ + 6, + 13, + 20, + 27, + 34, + 41, + 48, + 55, + 62, + 69, + 76, + 83, + 90, + 97, + 104, + 111, + 118, + 125, + 132, + 139, + 146, + 153, + 160, + 167, + 174, + 181, + 188, + 195, + 202, + 209, + 216, + 223, + 230, + 237, + 244, + 251, + 258, + 265, + 272, + 279, + 286, + 293, + 300, + 307, + 314, + 321, + 328, + 335, + 342, + 349, + 356, + 363 + ], + "x": [ + "2020-01-06", + "2020-01-13", + "2020-01-20", + "2020-01-27", + "2020-02-03", + "2020-02-10", + "2020-02-17", + "2020-02-24", + "2020-03-02", + "2020-03-09", + "2020-03-16", + "2020-03-23", + "2020-03-30", + "2020-04-06", + "2020-04-13", + "2020-04-20", + "2020-04-27", + "2020-05-04", + "2020-05-11", + "2020-05-18", + "2020-05-25", + "2020-06-01", + "2020-06-08", + "2020-06-15", + "2020-06-22", + "2020-06-29", + "2020-07-06", + "2020-07-13", + "2020-07-20", + "2020-07-27", + "2020-08-03", + "2020-08-10", + "2020-08-17", + "2020-08-24", + "2020-08-31", + "2020-09-07", + "2020-09-14", + "2020-09-21", + "2020-09-28", + "2020-10-05", + "2020-10-12", + "2020-10-19", + "2020-10-26", + "2020-11-02", + "2020-11-09", + "2020-11-16", + "2020-11-23", + "2020-11-30", + "2020-12-07", + "2020-12-14", + "2020-12-21", + "2020-12-28" + ], + "xperiodalignment": "end" + } + ], + "layout": { + "barmode": "overlay", + "width": 900, + "height": 450, + "margin": { + "t": 60, + "l": 60, + "r": 61, + "b": 60 + }, + "showlegend": true, + "hovermode": "closest", + "title": { + "text": "2020 Mondays" + }, + "yaxis": { + "title": { + "text": "day of year" + } + }, + "xaxis": { + "title": { + "text": "week of year" + }, + "tick0": "2020-01-06", + "dtick": 604800000, + "tickformat": "%W", + "ticklabelmode": "period", + "tickcolor": "black" + } + } +} diff --git a/test/image/mocks/period_positioning8.json b/test/image/mocks/period_positioning8.json new file mode 100644 index 00000000000..ddcc3e36464 --- /dev/null +++ b/test/image/mocks/period_positioning8.json @@ -0,0 +1,67 @@ +{ + "data": [ + { + "marker": { + "opacity": 0.5, + "line": { + "width": 2, + "color": "white" + } + }, + "textposition": "inside", + "textangle": 0, + "texttemplate": "%{x|%A %d %b %Y}", + "hovertemplate": "%{x|%A}, %{y}", + "type": "bar", + "y": [ + 28, + 28, + 28, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 21, + 21, + 21, + 21 + ], + "x": [ + "2020-01-16", + "2020-01-17", + "2020-01-18", + "2020-01-19", + "2020-01-20", + "2020-01-21", + "2020-01-22", + "2020-01-23", + "2020-01-24", + "2020-01-25", + "2020-01-26", + "2020-01-27", + "2020-01-28", + "2020-01-29" + ], + "xperiod": 604800000 + } + ], + "layout": { + "width": 600, + "height": 400, + "margin": { + "t": 50 + }, + "hovermode": "closest", + "barmode": "stack", + "bargap": 0, + "xaxis": { + "dtick": 86400000, + "ticklabelmode": "period", + "tickformat": "%a %m-%d", + "tickcolor": "black" + } + } +} diff --git a/test/image/mocks/sunburst_inside-text-orientation_clock.json b/test/image/mocks/sunburst_inside-text-orientation_clock.json index a6d7312bbee..354c9b0d92f 100644 --- a/test/image/mocks/sunburst_inside-text-orientation_clock.json +++ b/test/image/mocks/sunburst_inside-text-orientation_clock.json @@ -4,6 +4,7 @@ "name": "horizontal", "insidetextorientation": "horizontal", "type": "sunburst", + "root": { "color": "yellow" }, "parents": [ "", "A", @@ -77,6 +78,7 @@ "name": "radial", "insidetextorientation": "radial", "type": "sunburst", + "root": { "color": "yellow" }, "parents": [ "", "A", @@ -150,6 +152,7 @@ "name": "tangential", "insidetextorientation": "tangential", "type": "sunburst", + "root": { "color": "yellow" }, "parents": [ "", "A", @@ -223,6 +226,7 @@ "name": "auto", "insidetextorientation": "auto", "type": "sunburst", + "root": { "color": "yellow" }, "parents": [ "", "A", diff --git a/test/image/mocks/ticklabelposition-0.json b/test/image/mocks/ticklabelposition-0.json new file mode 100644 index 00000000000..4845e55b7d5 --- /dev/null +++ b/test/image/mocks/ticklabelposition-0.json @@ -0,0 +1,138 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "x": [0, 1000], + "y": [1e-1, 1e+6] + }, { + "xaxis": "x2", + "yaxis": "y2", + "x": [0, 1000], + "y": [1e-1, 1e+6] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": [0, 1000], + "y": [1e-1, 1e+6] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": [0, 1000], + "y": [1e-1, 1e+6] + }], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "side": "bottom", + "ticks": "outside", + "ticklabelposition": "outside right", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.475], + "autorange": "reversed", + "type": "log", + "side": "left", + "ticks": "inside", + "ticklabelposition": "outside top", + "tickfont": { "size": 20 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.525, 1], + "autorange": "reversed", + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "outside right", + "tickfont": { "size": 20 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0, 0.475], + "type": "log", + "side": "right", + "ticks": "inside", + "ticklabelposition": "outside top", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0.525, 1], + "side": "top", + "ticks": "outside", + "ticklabelposition": "outside left", + "tickfont": { "size": 20 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0.525, 1], + "autorange": "reversed", + "type": "log", + "side": "right", + "ticks": "outside", + "ticklabelposition": "outside bottom", + "tickfont": { "size": 16 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0, 0.475], + "autorange": "reversed", + "side": "top", + "ticks": "inside", + "ticklabelposition": "outside right", + "tickangle": -60, + "tickfont": { "size": 16 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.525, 1], + "type": "log", + "side": "left", + "ticks": "inside", + "ticklabelposition": "outside bottom", + "tickangle": 30, + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "gridcolor": "white" + }, + "font": { + "family": "Raleway" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 1000, + "height": 1000 + } +} diff --git a/test/image/mocks/ticklabelposition-1.json b/test/image/mocks/ticklabelposition-1.json new file mode 100644 index 00000000000..a96b7af9114 --- /dev/null +++ b/test/image/mocks/ticklabelposition-1.json @@ -0,0 +1,149 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "x": ["20-12-20", "21-01-20"], + "y": [1e-1, 1e+6] + }, { + "xaxis": "x2", + "yaxis": "y2", + "x": ["20-10", "21-05-15"], + "y": [1e-1, 1e+6] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": ["20", "23"], + "y": [1e-1, 1e+6] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": ["20-12-20", "21-01-20"], + "y": [1e-1, 1e+6] + }], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "type": "date", + "ticklabelmode": "period", + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.475], + "autorange": "reversed", + "type": "log", + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside top", + "tickfont": { "size": 20 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.525, 1], + "autorange": "reversed", + "type": "date", + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside left", + "tickfont": { "size": 20 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0, 0.475], + "type": "log", + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0.525, 1], + "type": "date", + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside right", + "tickfont": { "size": 20 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0.525, 1], + "autorange": "reversed", + "type": "log", + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside bottom", + "tickfont": { "size": 16 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0, 0.475], + "autorange": "reversed", + "type": "date", + "ticklabelmode": "period", + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.525, 1], + "type": "log", + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside bottom", + "tickangle": 30, + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "gridcolor": "white" + }, + "font": { + "family": "Raleway" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 1000, + "height": 1000, + "margin": { + "t": 40, + "b": 40, + "l": 40, + "r": 40 + } + } +} diff --git a/test/image/mocks/ticklabelposition-2.json b/test/image/mocks/ticklabelposition-2.json new file mode 100644 index 00000000000..982e1899cf9 --- /dev/null +++ b/test/image/mocks/ticklabelposition-2.json @@ -0,0 +1,167 @@ +{ + "data": [{ + "yaxis": "y", + "xaxis": "x", + "y": ["20-11", "21-03"], + "x": [1e-1, 1e+6] + }, { + "yaxis": "y2", + "xaxis": "x2", + "y": ["20-10", "21-04"], + "x": [1e-1, 1e+6] + }, { + "yaxis": "y3", + "xaxis": "x3", + "y": ["01-01", "01-09"], + "x": [1e-1, 1e+6] + }, { + "yaxis": "y4", + "xaxis": "x4", + "y": ["01", "10"], + "x": [1e-1, 1e+6] + }], + "layout": { + "yaxis": { + "anchor": "x", + "domain": [0, 0.475], + "type": "date", + "ticklabelmode": "period", + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "linecolor": "yellow", + "tickcolor": "yellow", + "gridcolor": "rgb(191,191,191)" + }, + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "autorange": "reversed", + "type": "log", + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside right", + "tickfont": { "size": 20 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "linecolor": "yellow", + "tickcolor": "yellow", + "gridcolor": "rgb(191,191,191)" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0.525, 1], + "autorange": "reversed", + "type": "date", + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside bottom", + "tickfont": { "size": 20 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "linecolor": "yellow", + "tickcolor": "yellow", + "gridcolor": "rgb(191,191,191)" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0, 0.475], + "type": "log", + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside right", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "linecolor": "yellow", + "tickcolor": "yellow", + "gridcolor": "rgb(191,191,191)" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0.525, 1], + "type": "date", + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside bottom", + "tickfont": { "size": 20 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "linecolor": "yellow", + "tickcolor": "yellow", + "gridcolor": "rgb(191,191,191)" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0.525, 1], + "autorange": "reversed", + "type": "log", + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside left", + "tickfont": { "size": 16 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "linecolor": "yellow", + "tickcolor": "yellow", + "gridcolor": "rgb(191,191,191)" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0, 0.475], + "autorange": "reversed", + "type": "date", + "ticklabelmode": "period", + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "tickangle": -45, + "tickfont": { "size": 16 }, + "ticklen": 8, + "tickwidth": 4, + "linewidth": 4, + "linecolor": "yellow", + "tickcolor": "yellow", + "gridcolor": "rgb(191,191,191)" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0.525, 1], + "type": "log", + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside left", + "tickangle": 45, + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 8, + "linewidth": 1, + "linecolor": "yellow", + "tickcolor": "yellow", + "gridcolor": "rgb(191,191,191)" + }, + "font": { + "family": "Raleway" + }, + "paper_bgcolor": "rgb(191,191,191)", + "plot_bgcolor": "rgb(63,63,63)", + "showlegend": false, + "width": 1000, + "height": 1000, + "margin": { + "t": 40, + "b": 40, + "l": 40, + "r": 40 + } + } +} diff --git a/test/image/mocks/ticklabelposition-a.json b/test/image/mocks/ticklabelposition-a.json new file mode 100644 index 00000000000..c1153a9b6ed --- /dev/null +++ b/test/image/mocks/ticklabelposition-a.json @@ -0,0 +1,134 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x2", + "yaxis": "y2", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": [-5000, 10000], + "y": [-5000, 10000] + }], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.475], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.525, 1], + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0, 0.475], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0.525, 1], + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0.525, 1], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0, 0.475], + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.525, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "font": { + "family": "Raleway" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 800, + "height": 800, + "margin": { + "t": 40, + "b": 40, + "l": 40, + "r": 40 + } + } +} diff --git a/test/image/mocks/ticklabelposition-b.json b/test/image/mocks/ticklabelposition-b.json new file mode 100644 index 00000000000..b1b681e82a7 --- /dev/null +++ b/test/image/mocks/ticklabelposition-b.json @@ -0,0 +1,134 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "x": [-10000, 10000], + "y": [-10000, 10000] + }, { + "xaxis": "x2", + "yaxis": "y2", + "x": [-10000, 10000], + "y": [-10000, 10000] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": [-10000, 10000], + "y": [-10000, 10000] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": [-10000, 10000], + "y": [-10000, 10000] + }], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside right", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.475], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside top", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.525, 1], + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside left", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0, 0.475], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside top", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0.525, 1], + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside left", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0.525, 1], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside bottom", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0, 0.475], + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside right", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.525, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside bottom", + "tickfont": { "size": 16 }, + "ticklen": 16, + "tickwidth": 4, + "linewidth": 10, + "gridcolor": "white" + }, + "font": { + "family": "Raleway" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 800, + "height": 800, + "margin": { + "t": 40, + "b": 40, + "l": 40, + "r": 40 + } + } +} diff --git a/test/image/mocks/ticklabelposition-c.json b/test/image/mocks/ticklabelposition-c.json new file mode 100644 index 00000000000..ddab2398b72 --- /dev/null +++ b/test/image/mocks/ticklabelposition-c.json @@ -0,0 +1,126 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x2", + "yaxis": "y2", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": [-5000, 10000], + "y": [-5000, 10000] + }], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": 30, + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.475], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": -60, + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.525, 1], + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": 60, + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0, 0.475], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": -30, + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0.525, 1], + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": -30, + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0.525, 1], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": 60, + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0, 0.475], + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": -60, + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.525, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": 30, + "gridcolor": "white" + }, + "font": { + "family": "Raleway" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 800, + "height": 800, + "margin": { + "t": 40, + "b": 40, + "l": 40, + "r": 40 + } + } +} diff --git a/test/image/mocks/ticklabelposition-d.json b/test/image/mocks/ticklabelposition-d.json new file mode 100644 index 00000000000..8f5ba43e24f --- /dev/null +++ b/test/image/mocks/ticklabelposition-d.json @@ -0,0 +1,126 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x2", + "yaxis": "y2", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": [-5000, 10000], + "y": [-5000, 10000] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": [-5000, 10000], + "y": [-5000, 10000] + }], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": 90, + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.475], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": 90, + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.525, 1], + "side": "bottom", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": -90, + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0, 0.475], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": -90, + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0.525, 1], + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": -90, + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0.525, 1], + "side": "right", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": 90, + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0, 0.475], + "side": "top", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": 90, + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.525, 1], + "side": "left", + "ticks": "inside", + "ticklabelposition": "inside", + "tickfont": { "size": 16 }, + "ticklen": 0, + "tickangle": -90, + "gridcolor": "white" + }, + "font": { + "family": "Raleway" + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 800, + "height": 800, + "margin": { + "t": 40, + "b": 40, + "l": 40, + "r": 40 + } + } +} diff --git a/test/image/mocks/treemap_sunburst_basic.json b/test/image/mocks/treemap_sunburst_basic.json index f7519e7a0ea..4b007666119 100644 --- a/test/image/mocks/treemap_sunburst_basic.json +++ b/test/image/mocks/treemap_sunburst_basic.json @@ -194,6 +194,7 @@ }, { "type": "sunburst", + "rotation": 180, "level": "", "labels": [ "A1", @@ -295,6 +296,7 @@ }, { "type": "sunburst", + "rotation": 90, "level": "", "labels": [ "C1", diff --git a/test/image/mocks/treemap_textposition.json b/test/image/mocks/treemap_textposition.json index b946c74d9a6..b1cb4b2b186 100644 --- a/test/image/mocks/treemap_textposition.json +++ b/test/image/mocks/treemap_textposition.json @@ -2,6 +2,7 @@ "data": [ { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "bottom left textposition", "textposition": "bottom left", @@ -110,6 +111,7 @@ }, { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "bottom center textposition", "textposition": "bottom center", @@ -219,6 +221,7 @@ }, { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "bottom right textposition", "textposition": "bottom right", @@ -330,6 +333,7 @@ }, { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "middle left textposition", "textposition": "middle left", @@ -436,6 +440,7 @@ }, { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "middle center textposition", "textposition": "middle center", @@ -543,6 +548,7 @@ }, { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "middle right textposition", "textposition": "middle right", @@ -649,6 +655,7 @@ }, { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "top left textposition", "textposition": "top left", @@ -759,6 +766,7 @@ }, { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "top center textposition", "textposition": "top center", @@ -869,6 +877,7 @@ }, { "type": "treemap", + "root": { "color": "yellow" }, "textinfo": "label+text+percent parent+percent entry+percent root", "name": "top right textposition", "textposition": "top right", diff --git a/test/image/mocks/vertical-tickangles.json b/test/image/mocks/vertical-tickangles.json new file mode 100644 index 00000000000..d55a60d8b16 --- /dev/null +++ b/test/image/mocks/vertical-tickangles.json @@ -0,0 +1,94 @@ +{ + "data": [{ + "xaxis": "x", + "yaxis": "y", + "x": ["Gg", "Pp"], + "y": ["Qq", "Yy"] + }, { + "xaxis": "x2", + "yaxis": "y2", + "x": ["Gg", "Pp"], + "y": ["Qq", "Yy"] + }, { + "xaxis": "x3", + "yaxis": "y3", + "x": ["Gg", "Pp"], + "y": ["Qq", "Yy"] + }, { + "xaxis": "x4", + "yaxis": "y4", + "x": ["Gg", "Pp"], + "y": ["Qq", "Yy"] + }], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [0, 0.475], + "side": "bottom", + "tickangle": 90, + "gridcolor": "white" + }, + "yaxis": { + "anchor": "x", + "domain": [0, 0.475], + "side": "left", + "tickangle": 0, + "gridcolor": "white" + }, + "xaxis2": { + "anchor": "y2", + "domain": [0.525, 1], + "side": "bottom", + "tickangle": 0, + "gridcolor": "white" + }, + "yaxis2": { + "anchor": "x2", + "domain": [0, 0.475], + "side": "right", + "tickangle": 0, + "gridcolor": "white" + }, + "xaxis3": { + "anchor": "y3", + "domain": [0.525, 1], + "side": "top", + "tickangle": -90, + "gridcolor": "white" + }, + "yaxis3": { + "anchor": "x3", + "domain": [0.525, 1], + "side": "right", + "tickangle": 90, + "gridcolor": "white" + }, + "xaxis4": { + "anchor": "y4", + "domain": [0, 0.475], + "side": "top", + "tickangle": 0, + "gridcolor": "white" + }, + "yaxis4": { + "anchor": "x4", + "domain": [0.525, 1], + "side": "left", + "tickangle": -90, + "gridcolor": "white" + }, + "font": { + "size": 40 + }, + "plot_bgcolor": "lightblue", + "showlegend": false, + "width": 600, + "height": 600, + "margin": { + "t": 80, + "b": 80, + "l": 80, + "r": 80 + } + } +} diff --git a/test/jasmine/assets/domain_ref/components.js b/test/jasmine/assets/domain_ref/components.js new file mode 100644 index 00000000000..bb481cf7842 --- /dev/null +++ b/test/jasmine/assets/domain_ref/components.js @@ -0,0 +1,855 @@ +// Test the placement of Axis Referencing Objects (AROs) +// Tools that can be wrapped in Jasmine tests. +// +// TODO: To make it work with Jasmine, we need to return a list of promises, +// one for each combination in the combo. When we're debugging / exploring, we +// want to be able to call the promise from the browser. When in a jasmine +// test, we need a description of the test and the promise doing the test +// itself. In this case, it needs to tell jasmine if it passed or failed, so we +// pass in an assert function that the promise can call. Then in jasmine, the +// promise is followed by .catch(failTest).then(done) +'use strict'; + +var Plotly = require('../../../../lib/index'); +var d3 = require('d3'); +var pixelCalc = require('../../assets/pixel_calc'); +var getSVGElemScreenBBox = require('../../assets/get_svg_elem_screen_bbox'); +// var SVGTools = require('../../assets/svg_tools'); +var Lib = require('../../../../src/lib'); +var Axes = require('../../../../src/plots/cartesian/axes'); +var axisIds = require('../../../../src/plots/cartesian/axis_ids'); +var testImage = 'https://images.plot.ly/language-icons/api-home/js-logo.png'; +var iterable = require('extra-iterable'); + +var testMock = require('./domain_ref_base.json'); + +// NOTE: this tolerance is in pixels +var EQUALITY_TOLERANCE = 1e-2; + +// Make an array from a finite iterable (for environments not having +// Array.from) +function iterToArray(iter) { + var a = []; + var v; + // when done is true v.value is undefined + for(v = iter.next(); !v.done; v = iter.next()) { + a.push(v.value); + } + return a; +} + +// some made-up values for testing +// NOTE: The pixel values are intentionally set so that 2*pixel is never greater +// than the mock's margin. This is so that annotations are not unintentionally +// clipped out because they exceed the plotting area. The reason for using twice +// the pixel value is because the annotation test requires plotting 2 +// annotations, the second having arrow components twice as long as the first. +var aroPositionsX = [{ + // aros referring to data + ref: 'range', + value: [2, 3], + // for objects that need a size (i.e., images) + size: 1.5, + // for the case when annotations specifies arrow in pixels, this value + // is read instead of value[1] + pixel: 25 +}, +{ + // aros referring to domains + ref: 'domain', + value: [0.2, 0.75], + size: 0.3, + pixel: 30 +}, +{ + // aros referring to paper + ref: 'paper', + value: [0.25, 0.8], + size: 0.35, + pixel: 35 +}, +]; +var aroPositionsY = [{ + // aros referring to data + ref: 'range', + // two values for rects + value: [1, 2], + pixel: 30, + size: 1.2 +}, +{ + // aros referring to domains + ref: 'domain', + value: [0.25, 0.7], + pixel: 40, + size: 0.2 +}, +{ + // aros referring to paper + ref: 'paper', + value: [0.2, 0.85], + pixel: 45, + size: 0.3 +} +]; + +var axisTypes = ['linear', 'log']; +// Test on 'x', 'y', 'x2', 'y2' axes +// TODO the 'paper' position references are tested twice when once would +// suffice. +var axisPairs = [ + ['x', 'y'], + ['x2', 'y2'] +]; +// For annotations: if arrow coordinate is in the same coordinate system 's', if +// pixel then 'p' +var arrowAxis = [ + ['s', 's'], + ['p', 's'], + ['s', 'p'], + ['p', 'p'] +]; +// only test the shapes line and rect for now +var shapeTypes = ['line', 'rect']; +// anchor positions for images +var xAnchors = ['left', 'center', 'right']; +var yAnchors = ['top', 'middle', 'bottom']; +// this color chosen so it can easily be found with d3 +// NOTE: for images color cannot be set but it will be the only image in the +// plot so you can use d3.select('g image').node() +var aroColor = 'rgb(50, 100, 150)'; + +// acts on an Object representing a aro which could be a line or a rect +// DEPRECATED +function aroFromAROPos(aro, axletter, axnum, aropos) { + aro[axletter + '0'] = aropos.value[0]; + aro[axletter + '1'] = aropos.value[1]; + if(aropos.ref === 'range') { + aro[axletter + 'ref'] = axletter + axnum; + } else if(aropos.ref === 'domain') { + aro[axletter + 'ref'] = axletter + axnum + ' domain'; + } else if(aropos.ref === 'paper') { + aro[axletter + 'ref'] = 'paper'; + } +} + +// {axid} is the axis id, e.g., x2, y, etc. +// {ref} is ['range'|'domain'|'paper'] +function makeAxRef(axid, ref) { + var axref; + switch(ref) { + case 'range': + axref = axid; + break; + case 'domain': + axref = axid + ' domain'; + break; + case 'paper': + axref = 'paper'; + break; + default: + throw 'Bad axis type (ref): ' + ref; + } + return axref; +} + +// shape, annotation and image all take x0, y0, xref, yref, color parameters +// x0, y0 are numerical values, xref, yref are strings that could be passed to +// the xref field of an ANO (e.g., 'x2 domain' or 'paper'), color should be +// specified using the 'rgb(r, g, b)' syntax +// arotype can be 'shape', 'annotation', or 'image' +// shapes take type=[line|rect], x1, y1 +// annotations take ax, ay, axref, ayref, (text is just set to "A" and xanchor +// and yanchor are always set to left because these are text attributes which we +// don't test) +// images take xsize, ysize, xanchor, yanchor (sizing is set to stretch for simplicity +// in computing the bounding box and source is something predetermined) +function aroFromParams(arotype, x0, y0, xref, yref, color, opts) { + // fill with common values + var aro = { + xref: xref, + yref: yref + }; + switch(arotype) { + case 'shape': + aro.x0 = x0; + aro.y0 = y0; + aro.x1 = opts.x1; + aro.y1 = opts.y1; + aro.type = opts.type; + aro.line = { + color: color + }; + break; + case 'annotation': + aro.x = x0; + aro.y = y0; + aro.text = 'A'; + aro.ax = opts.ax; + aro.ay = opts.ay; + aro.axref = opts.axref; + aro.ayref = opts.ayref; + aro.showarrow = true; + aro.arrowhead = 0; + aro.arrowcolor = color; + break; + case 'image': + aro.x = x0; + aro.y = y0; + aro.sizex = opts.sizex; + aro.sizey = opts.sizey; + aro.xanchor = opts.xanchor; + aro.yanchor = opts.yanchor; + aro.sizing = 'stretch'; + aro.source = testImage; + break; + default: + throw 'Bad arotype: ' + arotype; + } + return aro; +} + +// Calculate the ax value of an annotation given a particular desired scaling K +// This also works with log axes by taking logs of each part of the sum, so that +// the length in pixels is multiplied by the scalar +function annaxscale(ac, c0) { + var ret; + ret = c0 + 2 * (ac - c0); + return ret; +} + +// This tests to see that an annotation was drawn correctly. +// Determinining the length of the arrow seems complicated due to the +// rectangle containing the text, so we draw 2 annotations, one K times the +// length of the other, and solve for the desired arrow length from the +// length measured on the screen. This works because multiplying the length +// of the arrow doesn't change where the arrow meets the text box. +// xaxistype can be linear|log, only used if xref has type 'range' or 'domain', +// same for yaxistype and yref +function annotationTest(gd, layout, opt) { + var x0 = opt.x0; + var y0 = opt.y0; + var ax = opt.ax; + var ay = opt.ay; + var xref = opt.xref; + var yref = opt.yref; + var axref = opt.axref; + var ayref = opt.ayref; + var xaxistype = opt.xaxistype; + var yaxistype = opt.yaxistype; + var xid = opt.xid; + var yid = opt.yid; + + // Take the log of values corresponding to log axes. This is because the + // test is designed to make predicting the pixel positions easy, and it's + // easiest when we work with the logarithm of values on log axes (doubling + // the log value doubles the pixel value, etc.). + var xreftype = Axes.getRefType(xref); + var yreftype = Axes.getRefType(yref); + var axreftype = Axes.getRefType(axref); + var ayreftype = Axes.getRefType(ayref); + x0 = xreftype === 'range' && xaxistype === 'log' ? Math.log10(x0) : x0; + ax = axreftype === 'range' && xaxistype === 'log' ? Math.log10(ax) : ax; + y0 = yreftype === 'range' && yaxistype === 'log' ? Math.log10(y0) : y0; + ay = ayreftype === 'range' && yaxistype === 'log' ? Math.log10(ay) : ay; + // if xref != axref or axref === 'pixel' then ax is a value relative to + // x0 but in pixels. Same for yref + var axpixels = false; + if((axreftype === 'pixel') || (axreftype !== xreftype)) { + axpixels = true; + } + var aypixels = false; + if((ayreftype === 'pixel') || (ayreftype !== yreftype)) { + aypixels = true; + } + logAxisIfAxType(gd.layout, layout, xid, xaxistype); + logAxisIfAxType(gd.layout, layout, yid, yaxistype); + var xpixels; + var ypixels; + var opts0 = { + ax: ax, + ay: ay, + axref: axref, + ayref: ayref, + }; + var opts1 = { + ax: axpixels ? 2 * ax : annaxscale(ax, x0), + ay: aypixels ? 2 * ay : annaxscale(ay, y0), + axref: axref, + ayref: ayref, + }; + // 2 colors so we can extract each annotation individually + var color0 = 'rgb(10, 20, 30)'; + var color1 = 'rgb(10, 20, 31)'; + var anno0 = aroFromParams('annotation', x0, y0, xref, yref, color0, opts0); + var anno1 = aroFromParams('annotation', x0, y0, xref, yref, color1, opts1); + layout.annotations = [anno0, anno1]; + return Plotly.relayout(gd, layout) + .then(function(gd) { + // the choice of anno1 or anno0 is arbitrary + var xabspixels = mapAROCoordToPixel(gd.layout, 'xref', anno1, 'x', 0, true); + var yabspixels = mapAROCoordToPixel(gd.layout, 'yref', anno1, 'y', 0, true); + if(axpixels) { + // no need to map the specified values to pixels (because that's what + // they are already) + xpixels = ax; + } else { + xpixels = mapAROCoordToPixel(gd.layout, 'xref', anno0, 'ax', 0, true) - + xabspixels; + } + if(aypixels) { + // no need to map the specified values to pixels (because that's what + // they are already) + ypixels = ay; + } else { + ypixels = mapAROCoordToPixel(gd.layout, 'yref', anno0, 'ay', 0, true) - + yabspixels; + } + var annobbox0 = getSVGElemScreenBBox(findAROByColor(color0)); + var annobbox1 = getSVGElemScreenBBox(findAROByColor(color1)); + // solve for the arrow length's x coordinate + var arrowLenX = ((annobbox1.x + annobbox1.width) - (annobbox0.x + annobbox0 + .width)); + var arrowLenY; + var yabspixelscmp; + if(aypixels) { + // for annotations whose arrows are specified in relative pixels, + // positive pixel values on the y axis mean moving down the page like + // SVG coordinates, so we have to add height + arrowLenY = (annobbox1.y + annobbox1.height) - + (annobbox0.y + annobbox0.height); + yabspixelscmp = annobbox0.y; + } else { + arrowLenY = annobbox1.y - annobbox0.y; + yabspixelscmp = annobbox0.y + annobbox0.height; + } + var ret = coordsEq(arrowLenX, xpixels) && + coordsEq(arrowLenY, ypixels) && + coordsEq(xabspixels, annobbox0.x) && + coordsEq(yabspixels, yabspixelscmp); + return ret; + }); +} + +// axid is e.g., 'x', 'y2' etc. +// if nologrange is true, log of range is not taken +function logAxisIfAxType(layoutIn, layoutOut, axid, axtype, nologrange) { + var axname = axisIds.id2name(axid); + if((axtype === 'log') && (axid !== undefined)) { + var axis = Lib.extendDeep({}, layoutIn[axname]); + axis.type = 'log'; + axis.range = nologrange ? axis.range : axis.range.map(Math.log10); + layoutOut[axname] = axis; + } +} + +// {layout} is required to map to pixels using its domain, range and size +// {axref} can be xref or yref +// {aro} is the components object where c and axref will be looked up +// {c} can be x0, x1, y0, y1 +// {offset} allows adding something to the coordinate before converting, say if +// you want to map the point on the other side of a square +// {nolog} if set to true, the log of a range value will not be taken before +// computing its pixel position. This is useful for components whose positions +// are specified in log coordinates (i.e., images and annotations). +// You can tell I first wrote this function for shapes only and then learned +// later this was the case for images and annotations :'). +function mapAROCoordToPixel(layout, axref, aro, c, offset, nolog) { + var reftype = Axes.getRefType(aro[axref]); + var ret; + offset = (offset === undefined) ? 0 : offset; + var val = aro[c] + offset; + var axis; + if(reftype === 'range') { + axis = axisIds.id2name(aro[axref]); + ret = pixelCalc.mapRangeToPixel(layout, axis, val, nolog); + } else if(reftype === 'domain') { + axis = axisIds.id2name(aro[axref]); + ret = pixelCalc.mapDomainToPixel(layout, axis, val); + } else if(reftype === 'paper') { + axis = axref[0]; + ret = pixelCalc.mapPaperToPixel(layout, axis, val); + } + return ret; +} + +// compute the bounding box of the shape so that it can be compared with the SVG +// bounding box +function shapeToBBox(layout, aro) { + var bbox = {}; + var x1; + var y1; + // map x coordinates + bbox.x = mapAROCoordToPixel(layout, 'xref', aro, 'x0'); + x1 = mapAROCoordToPixel(layout, 'xref', aro, 'x1'); + // SVG bounding boxes have x,y referring to top left corner, but here we are + // specifying aros where y0 refers to the bottom left corner like + // Plotly.js, so we swap y0 and y1 + bbox.y = mapAROCoordToPixel(layout, 'yref', aro, 'y1'); + y1 = mapAROCoordToPixel(layout, 'yref', aro, 'y0'); + bbox.width = x1 - bbox.x; + bbox.height = y1 - bbox.y; + return bbox; +} + +function imageToBBox(layout, img) { + var bbox = {}; + // these will be pixels from the bottom of the plot and will be manipulated + // below to be compatible with the SVG bounding box + var x0; + var x1; + var y0; + var y1; + switch(img.xanchor) { + case 'left': + x0 = mapAROCoordToPixel(layout, 'xref', img, 'x', undefined, true); + x1 = mapAROCoordToPixel(layout, 'xref', img, 'x', img.sizex, true); + break; + case 'right': + x0 = mapAROCoordToPixel(layout, 'xref', img, 'x', -img.sizex, true); + x1 = mapAROCoordToPixel(layout, 'xref', img, 'x', undefined, true); + break; + case 'center': + x0 = mapAROCoordToPixel(layout, 'xref', img, 'x', -img.sizex * 0.5, true); + x1 = mapAROCoordToPixel(layout, 'xref', img, 'x', img.sizex * 0.5, true); + break; + default: + throw 'Bad xanchor: ' + img.xanchor; + } + switch(img.yanchor) { + case 'bottom': + y0 = mapAROCoordToPixel(layout, 'yref', img, 'y', undefined, true); + y1 = mapAROCoordToPixel(layout, 'yref', img, 'y', img.sizey, true); + break; + case 'top': + y0 = mapAROCoordToPixel(layout, 'yref', img, 'y', -img.sizey, true); + y1 = mapAROCoordToPixel(layout, 'yref', img, 'y', undefined, true); + break; + case 'middle': + y0 = mapAROCoordToPixel(layout, 'yref', img, 'y', -img.sizey * 0.5, true); + y1 = mapAROCoordToPixel(layout, 'yref', img, 'y', img.sizey * 0.5, true); + break; + default: + throw 'Bad yanchor: ' + img.yanchor; + } + bbox.x = x0; + bbox.width = x1 - x0; + // done this way because the pixel value of y1 will be smaller than the + // pixel value x0 if y1 > y0 (because of how SVG draws relative to the top + // of the screen) + bbox.y = y1; + bbox.height = y0 - y1; + return bbox; +} + +function coordsEq(a, b) { + if(a && b) { + return Math.abs(a - b) < EQUALITY_TOLERANCE; + } + return false; +} + +function compareBBoxes(a, b) { + return ['x', 'y', 'width', 'height'].map( + function(k) { return coordsEq(a[k], b[k]); }).reduce( + function(l, r) { return l && r; }, + true); +} + +function findAROByColor(color, id, type, colorAttribute) { + id = (id === undefined) ? '' : id + ' '; + type = (type === undefined) ? 'path' : type; + colorAttribute = (colorAttribute === undefined) ? 'stroke' : colorAttribute; + var selector = id + type; + var ret = d3.selectAll(selector).filter(function() { + return this.style[colorAttribute] === color; + }).node(); + return ret; +} + +function findImage(id) { + id = (id === undefined) ? '' : id + ' '; + var selector = id + 'g image'; + var ret = d3.select(selector).node(); + return ret; +} + +function imageTest(gd, layout, opt) { + var xaxtype = opt.xaxtype; + var yaxtype = opt.yaxtype; + var x = opt.x; + var y = opt.y; + var sizex = opt.sizex; + var sizey = opt.sizey; + var xanchor = opt.xanchor; + var yanchor = opt.yanchor; + var xref = opt.xref; + var yref = opt.yref; + var xid = opt.xid; + var yid = opt.yid; + + var image = { + x: x, + y: y, + sizex: sizex, + sizey: sizey, + source: testImage, + xanchor: xanchor, + yanchor: yanchor, + xref: xref, + yref: yref, + sizing: 'stretch' + }; + var ret; + // we pass xid, yid because we possibly want to change some axes to log, + // even if we refer to paper in the end + logAxisIfAxType(gd.layout, layout, xid, xaxtype, true); + logAxisIfAxType(gd.layout, layout, yid, yaxtype, true); + layout.images = [image]; + return Plotly.relayout(gd, layout) + .then(function(gd) { + var imageElem = findImage('#' + gd.id); + var svgImageBBox = getSVGElemScreenBBox(imageElem); + var imageBBox = imageToBBox(gd.layout, image); + ret = compareBBoxes(svgImageBBox, imageBBox); + return ret; + }); +} + +// gets the SVG bounding box of the aro and checks it against what mapToPixel +// gives +function checkAROPosition(gd, aro) { + var aroPath = findAROByColor(aro.line.color, '#' + gd.id); + var aroPathBBox = getSVGElemScreenBBox(aroPath); + var aroBBox = shapeToBBox(gd.layout, aro); + var ret = compareBBoxes(aroBBox, aroPathBBox); + // console.log('aroBBox: ' + JSON.stringify(aroBBox)); + // console.log('aroPathBBox: ' + JSON.stringify(SVGTools.svgRectToObj(aroPathBBox))); + return ret; +} + +function shapeTest( + gd, + opt) { + var xAxNum = opt.xAxNum; + var xaxisType = opt.xaxisType; + var xaroPos = opt.xaroPos; + var yAxNum = opt.yAxNum; + var yaxisType = opt.yaxisType; + var yaroPos = opt.yaroPos; + var aroType = opt.aroType; + + // console.log('gd.layout: ', JSON.stringify(gd.layout)); + var aro = { + type: aroType, + line: { + color: aroColor + } + }; + aroFromAROPos(aro, 'x', xAxNum, xaroPos); + aroFromAROPos(aro, 'y', yAxNum, yaroPos); + var layout = { + shapes: [aro] + }; + // change to log axes if need be + logAxisIfAxType(gd.layout, layout, 'x' + xAxNum, xaxisType); + logAxisIfAxType(gd.layout, layout, 'y' + yAxNum, yaxisType); + // console.log('layout: ', JSON.stringify(layout)); + return Plotly.relayout(gd, layout) + .then(function(gd) { + return checkAROPosition(gd, aro); + }); +} + +function describeShapeComboTest(combo) { + var xaxisType = combo[0]; + var yaxisType = combo[1]; + var axispair = combo[2]; + var xaroPos = combo[3]; + var yaroPos = combo[4]; + var shapeType = combo[5]; + var gdId = combo[6]; + var xid = axispair[0]; + var yid = axispair[1]; + return [ + '#', gdId, + 'should create a plot with parameters:', '\n', + 'x-axis type:', xaxisType, '\n', + 'y-axis type:', yaxisType, '\n', + 'axis pair:', xid, yid, '\n', + 'ARO position x:', JSON.stringify(xaroPos), '\n', + 'ARO position y:', JSON.stringify(yaroPos), '\n', + 'shape type:', shapeType, '\n', + ].join(' '); +} + +function testShapeCombo(combo, assert, gd) { + var xaxisType = combo[0]; + var yaxisType = combo[1]; + var axispair = combo[2]; + var xaroPos = combo[3]; + var yaroPos = combo[4]; + var shapeType = combo[5]; + var xAxNum = axispair[0].substr(1); + var yAxNum = axispair[1].substr(1); + return Plotly.newPlot(gd, Lib.extendDeep({}, testMock)) + .then(function(gd) { + return shapeTest(gd, + {xAxNum: xAxNum, + xaxisType: xaxisType, + xaroPos: xaroPos, + yAxNum: yAxNum, + yaxisType: yaxisType, + yaroPos: yaroPos, + aroType: shapeType, + }); + }).then(function(testRet) { + assert(testRet); + }); +} + +function describeImageComboTest(combo) { + var axistypex = combo[0]; + var axistypey = combo[1]; + var axispair = combo[2]; + var aroposx = combo[3]; + var aroposy = combo[4]; + var xanchor = combo[5]; + var yanchor = combo[6]; + var gdId = combo[7]; + var xid = axispair[0]; + var yid = axispair[1]; + var xref = makeAxRef(xid, aroposx.ref); + var yref = makeAxRef(yid, aroposy.ref); + // TODO Add image combo test description + return [ + '#', gdId, + 'should create a plot with parameters:', '\n', + 'x-axis type:', axistypex, '\n', + 'y-axis type:', axistypey, '\n', + 'axis pair:', xid, yid, '\n', + 'ARO position x:', JSON.stringify(aroposx), '\n', + 'ARO position y:', JSON.stringify(aroposy), '\n', + 'xanchor:', xanchor, '\n', + 'yanchor:', yanchor, '\n', + 'xref:', xref, '\n', + 'yref:', yref, '\n', + ].join(' '); +} + +function testImageCombo(combo, assert, gd) { + var axistypex = combo[0]; + var axistypey = combo[1]; + var axispair = combo[2]; + var aroposx = combo[3]; + var aroposy = combo[4]; + var xanchor = combo[5]; + var yanchor = combo[6]; + var xid = axispair[0]; + var yid = axispair[1]; + var xref = makeAxRef(xid, aroposx.ref); + var yref = makeAxRef(yid, aroposy.ref); + return Plotly.newPlot(gd, Lib.extendDeep({}, testMock)) + .then(function(gd) { + return imageTest(gd, {}, + { + xaxtype: axistypex, + yaxtype: axistypey, + x: aroposx.value[0], + y: aroposy.value[0], + sizex: aroposx.size, + sizey: aroposy.size, + xanchor: xanchor, + yanchor: yanchor, + xref: xref, + yref: yref, + xid: xid, + yid: yid, + }); + }).then(function(testRet) { + assert(testRet); + }); +} + +function describeAnnotationComboTest(combo) { + var axistypex = combo[0]; + var axistypey = combo[1]; + var axispair = combo[2]; + var aroposx = combo[3]; + var aroposy = combo[4]; + var arrowaxispair = combo[5]; + var gdId = combo[6]; + var xid = axispair[0]; + var yid = axispair[1]; + var xref = makeAxRef(xid, aroposx.ref); + var yref = makeAxRef(yid, aroposy.ref); + return [ + '#', gdId, + 'should create a plot with parameters:', '\n', + 'x-axis type:', axistypex, '\n', + 'y-axis type:', axistypey, '\n', + 'axis pair:', xid, yid, '\n', + 'ARO position x:', JSON.stringify(aroposx), '\n', + 'ARO position y:', JSON.stringify(aroposy), '\n', + 'arrow axis pair:', arrowaxispair, '\n', + 'xref:', xref, '\n', + 'yref:', yref, '\n', + ].join(' '); +} + +function testAnnotationCombo(combo, assert, gd) { + var axistypex = combo[0]; + var axistypey = combo[1]; + var axispair = combo[2]; + var aroposx = combo[3]; + var aroposy = combo[4]; + var arrowaxispair = combo[5]; + var xid = axispair[0]; + var yid = axispair[1]; + var xref = makeAxRef(xid, aroposx.ref); + var yref = makeAxRef(yid, aroposy.ref); + var axref = arrowaxispair[0] === 'p' ? 'pixel' : xref; + var ayref = arrowaxispair[1] === 'p' ? 'pixel' : yref; + var x0 = aroposx.value[0]; + var y0 = aroposy.value[0]; + var ax = axref === 'pixel' ? aroposx.pixel : aroposx.value[1]; + var ay = ayref === 'pixel' ? aroposy.pixel : aroposy.value[1]; + return Plotly.newPlot(gd, Lib.extendDeep({}, testMock)) + .then(function(gd) { + return annotationTest(gd, {}, + { + x0: x0, + y0: y0, + ax: ax, + ay: ay, + xref: xref, + yref: yref, + axref: axref, + ayref: ayref, + axistypex: axistypex, + axistypey: axistypey, + xid: xid, + yid: yid, + }); + }).then(function(testRet) { + assert(testRet); + }); +} + +// return a list of functions, each returning a promise that executes a +// particular test. This function takes the keepGraphDiv argument, which if true +// will prevent destroying the generated graph after the test is executed, and +// an assert argument, which is a function that will be passed true if the test +// passed. +// {testCombos} is a list of combinations each of which will be passed to the +// test function +// {test} is the function returning a Promise that executes this test +function comboTests(testCombos, test) { + var ret = testCombos.map(function(combo) { + return function(assert, gd) { + return test(combo, assert, gd); + }; + }); + return ret; +} + +// return a list of strings, each describing a corresponding test +// describe is a function taking a combination and returning a description of +// the test +function comboTestDescriptions(testCombos, desribe) { + var ret = testCombos.map(desribe); + return ret; +} + +function annotationTestCombos() { + var testCombos = iterToArray(iterable.cartesianProduct([ + axisTypes, axisTypes, axisPairs, aroPositionsX, aroPositionsY, arrowAxis + ])); + testCombos = testCombos.map( + function(c, i) { + return c.concat(['graph-' + i]); + } + ); + return testCombos; +} + +function annotationTests() { + var testCombos = annotationTestCombos(); + return comboTests(testCombos, testAnnotationCombo); +} + +function annotationTestDescriptions() { + var testCombos = annotationTestCombos(); + return comboTestDescriptions(testCombos, describeAnnotationComboTest); +} + +function imageTestCombos() { + var testCombos = iterToArray(iterable.cartesianProduct( + [ + axisTypes, axisTypes, axisPairs, + // axis reference types are contained in here + aroPositionsX, aroPositionsY, + xAnchors, yAnchors + ] + )); + testCombos = testCombos.map( + function(c, i) { + return c.concat(['graph-' + i]); + } + ); + return testCombos; +} + +function imageTests() { + var testCombos = imageTestCombos(); + return comboTests(testCombos, testImageCombo); +} + +function imageTestDescriptions() { + var testCombos = imageTestCombos(); + return comboTestDescriptions(testCombos, describeImageComboTest); +} + +function shapeTestCombos() { + var testCombos = iterToArray(iterable.cartesianProduct( + [ + axisTypes, axisTypes, axisPairs, + // axis reference types are contained in here + aroPositionsX, aroPositionsY, shapeTypes + ] + )); + testCombos = testCombos.map( + function(c, i) { + return c.concat(['graph-' + i]); + } + ); + return testCombos; +} + +function shapeTests() { + var testCombos = shapeTestCombos(); + return comboTests(testCombos, testShapeCombo); +} + +function shapeTestDescriptions() { + var testCombos = shapeTestCombos(); + return comboTestDescriptions(testCombos, describeShapeComboTest); +} + +module.exports = { + // tests + annotations: { + descriptions: annotationTestDescriptions, + tests: annotationTests, + }, + images: { + descriptions: imageTestDescriptions, + tests: imageTests, + }, + shapes: { + descriptions: shapeTestDescriptions, + tests: shapeTests + }, + // utilities + findAROByColor: findAROByColor +}; diff --git a/test/jasmine/assets/domain_ref/domain_ref_base.json b/test/jasmine/assets/domain_ref/domain_ref_base.json new file mode 100644 index 00000000000..8e759334d43 --- /dev/null +++ b/test/jasmine/assets/domain_ref/domain_ref_base.json @@ -0,0 +1,41 @@ +{ + "data": [{ + "x": [1, 2], + "y": [3, 1], + "type": "scatter", + "xaxis": "x", + "yaxis": "y", + "line": { "color": "rgb(127,127,127)" } + },{ + "x": [1, 3], + "y": [1, 2], + "type": "scatter", + "xaxis": "x2", + "yaxis": "y2", + "line": { "color": "rgb(127,127,127)" } + } + ], + "layout": { + "xaxis": { + "domain": [0,0.75], + "range": [1, 4] + }, + "yaxis": { + "domain": [0,0.4], + "range": [1, 4] + }, + "xaxis2": { + "domain": [0.75,1], + "range": [1, 5], + "anchor": "y2" + }, + "yaxis2": { + "domain": [0.4,1], + "range": [1, 3], + "anchor": "x2" + }, + "margin": { "l": 100, "r": 100, "t": 100, "b": 100, "autoexpand": false }, + "width": 400, + "height": 400 + } +} diff --git a/test/jasmine/assets/domain_ref/domain_refs_editable.json b/test/jasmine/assets/domain_ref/domain_refs_editable.json new file mode 100644 index 00000000000..f5cb8f1b56e --- /dev/null +++ b/test/jasmine/assets/domain_ref/domain_refs_editable.json @@ -0,0 +1,159 @@ +{ + "data": [ + { + "type": "scatter", + "x": [], + "xaxis": "x", + "y": [], + "yaxis": "y" + }, + { + "type": "scatter", + "x": [], + "xaxis": "x2", + "y": [], + "yaxis": "y2" + }, + { + "type": "scatter", + "x": [], + "xaxis": "x3", + "y": [], + "yaxis": "y3" + }, + { + "type": "scatter", + "x": [], + "xaxis": "x4", + "y": [], + "yaxis": "y4" + } + ], + "layout": { + "xaxis": { + "anchor": "y", + "domain": [ + 0.0, + 0.45 + ] + }, + "xaxis2": { + "anchor": "y2", + "domain": [ + 0.55, + 1.0 + ] + }, + "xaxis3": { + "anchor": "y3", + "domain": [ + 0.0, + 0.45 + ], + "range": [ + 1, + 10 + ] + }, + "xaxis4": { + "type": "log", + "anchor": "y4", + "domain": [ + 0.55, + 1.0 + ], + "range": [ + 0, + 1 + ] + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0.575, + 1.0 + ] + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0.575, + 1.0 + ] + }, + "yaxis3": { + "type": "log", + "anchor": "x3", + "domain": [ + 0.0, + 0.425 + ], + "range": [ + 0, + 1 + ] + }, + "yaxis4": { + "anchor": "x4", + "domain": [ + 0.0, + 0.425 + ], + "range": [ + 1, + 10 + ] + }, + "shapes": [{ + "type": "rect", + "xref": "x3 domain", + "yref": "y3 domain", + "x0": 0.1, + "y0": 0.2, + "x1": 0.3, + "y1": 0.4, + "line": { "color": "rgb(10, 20, 30)" } + },{ + "type": "rect", + "xref": "x4 domain", + "yref": "y4 domain", + "x0": 0.4, + "y0": 0.5, + "x1": 0.6, + "y1": 0.7, + "line": { "color": "rgb(10, 20, 31)" } + }], + "annotations": [{ + "text": "A", + "bordercolor": "rgb(100, 200, 232)", + "xref": "x3 domain", + "yref": "y3 domain", + "x": 0.4, + "y": 0.6, + "axref": "x3 domain", + "ayref": "y3 domain", + "ax": 0.7, + "ay": 0.8, + "arrowcolor": "rgb(231, 200, 100)", + "arrowwidth": 3 + },{ + "text": "B", + "bordercolor": "rgb(200, 200, 232)", + "xref": "x4 domain", + "yref": "y4 domain", + "x": 0.3, + "y": 0.4, + "axref": "x4 domain", + "ayref": "y4 domain", + "ax": 0.1, + "ay": 0.2, + "arrowcolor": "rgb(231, 200, 200)", + "arrowwidth": 3 + }], + "dragmode": "drawopenpath" + }, + "config": { + "editable": true, + "modeBarButtonsToAdd": ["drawopenpath"] + } +} diff --git a/test/jasmine/assets/get_rect_center.js b/test/jasmine/assets/get_rect_center.js index 1117383354b..fec124acfe7 100644 --- a/test/jasmine/assets/get_rect_center.js +++ b/test/jasmine/assets/get_rect_center.js @@ -1,5 +1,7 @@ 'use strict'; +var SVGTools = require('./svg_tools'); + /** * Get the screen coordinates of the center of @@ -18,7 +20,7 @@ module.exports = function getRectCenter(rect) { // Taken from: http://stackoverflow.com/a/5835212/4068492 function getRectScreenCoords(rect) { - var svg = findParentSVG(rect); + var svg = SVGTools.findParentSVG(rect); var pt = svg.createSVGPoint(); var corners = {}; var matrix = rect.getScreenCTM(); @@ -35,13 +37,3 @@ function getRectScreenCoords(rect) { return corners; } - -function findParentSVG(node) { - var parentNode = node.parentNode; - - if(parentNode.tagName === 'svg') { - return parentNode; - } else { - return findParentSVG(parentNode); - } -} diff --git a/test/jasmine/assets/get_svg_elem_screen_bbox.js b/test/jasmine/assets/get_svg_elem_screen_bbox.js new file mode 100644 index 00000000000..a6d95d0001e --- /dev/null +++ b/test/jasmine/assets/get_svg_elem_screen_bbox.js @@ -0,0 +1,29 @@ +'use strict'; + +var SVGTools = require('./svg_tools'); + +/** + * Get the bounding box in screen coordinates of an SVG element. + * + * @param {elem} SVG element's node. + */ +module.exports = getSVGElemScreenBBox; + +// Get the screen coordinates of an SVG Element's bounding box +// Based off of this: +// https://stackoverflow.com/questions/26049488/how-to-get-absolute-coordinates-of-object-inside-a-g-group +function getSVGElemScreenBBox(elem) { + var svg = SVGTools.findParentSVG(elem); + var rect = svg.createSVGRect(); + var pt = svg.createSVGPoint(); + var ctm = elem.getScreenCTM(); + var bbox = elem.getBBox(); + pt.x = bbox.x; + pt.y = bbox.y; + rect.width = bbox.width; + rect.height = bbox.height; + pt = pt.matrixTransform(ctm); + rect.x = pt.x; + rect.y = pt.y; + return rect; +} diff --git a/test/jasmine/assets/pixel_calc.js b/test/jasmine/assets/pixel_calc.js new file mode 100644 index 00000000000..d214c56826b --- /dev/null +++ b/test/jasmine/assets/pixel_calc.js @@ -0,0 +1,69 @@ +'use strict'; + +// Calculate the pixel values from various objects + +// {layout} is where the margins are obtained from +// {axis} can be x or y and is used to extract the values for making the +// calculation. If axis is y then d is converted to 1 - d to be consistent with +// how the y axis in Plotly.js works. +// {domain} depends on the application: if we're converting from the paper domain +// to pixels then domain can just be [0,1]. If we're converting from an axis +// domain to pixels, then domain[0] is the start of its domain and domain[1] the +// end (as obtained from layout.xaxis.domain for example). +// {d} Is normalized to domain length, so 0 is the beginning of the domain and 1 +// the end, but it can have values beyond this (e.g., -2 is twice the domain +// length in the opposite direction). For the case where you want to convert +// from range to pixels, convert the range to a normalized using the range for +// that axis (e.g., layout.xaxis.range) +function mapToPixelHelper(layout, axis, domain, d) { + var dim; + var lower; + var upper; + if(axis === 'x') { + dim = 'width'; + lower = 'l'; + upper = 'r'; + } else if(axis === 'y') { + dim = 'height'; + lower = 'b'; + upper = 't'; + } else { + throw 'Bad axis letter: ' + axis; + } + var plotwidth = layout[dim] - layout.margin[lower] - layout.margin[upper]; + var domwidth = (domain[1] - domain[0]) * plotwidth; + if(dim === 'height') { + // y-axes relative to bottom of plot in plotly.js + return layout[dim] - (layout.margin[lower] + domain[0] * plotwidth + domwidth * d); + } + return layout.margin[lower] + domain[0] * plotwidth + domwidth * d; +} + +// axis must be single letter, e.g., x or y +function mapPaperToPixel(layout, axis, d) { + return mapToPixelHelper(layout, axis, [0, 1], d); +} + +// Here axis must have the same form as in layout, e.g., xaxis, yaxis2, etc. +function mapDomainToPixel(layout, axis, d) { + return mapToPixelHelper(layout, axis[0], layout[axis].domain, d); +} + +// Here axis must have the same form as in layout, e.g., xaxis, yaxis2, etc. +// nolog is provided to avoid taking the log of the value even if the axis is a +// log axis. This is used in the case of layout images, whose corner coordinates +// and dimensions are specified in powers of 10, e.g., if the corner's x +// coordinate is at data 10, then the x value passed is 1 +function mapRangeToPixel(layout, axis, r, nolog) { + if((!nolog) && (layout[axis].type === 'log')) { + r = Math.log10(r); + } + var d = (r - layout[axis].range[0]) / (layout[axis].range[1] - layout[axis].range[0]); + return mapDomainToPixel(layout, axis, d); +} + +module.exports = { + mapPaperToPixel: mapPaperToPixel, + mapDomainToPixel: mapDomainToPixel, + mapRangeToPixel: mapRangeToPixel +}; diff --git a/test/jasmine/assets/svg_tools.js b/test/jasmine/assets/svg_tools.js new file mode 100644 index 00000000000..72ba4e44f86 --- /dev/null +++ b/test/jasmine/assets/svg_tools.js @@ -0,0 +1,25 @@ +'use strict'; + +module.exports = { + findParentSVG: findParentSVG, + svgRectToObj: svgRectToObj +}; + +function findParentSVG(node) { + var parentNode = node.parentNode; + + if(parentNode.tagName === 'svg') { + return parentNode; + } else { + return findParentSVG(parentNode); + } +} + +function svgRectToObj(svgrect) { + var obj = {}; + obj.x = svgrect.x; + obj.y = svgrect.y; + obj.width = svgrect.width; + obj.height = svgrect.height; + return obj; +} diff --git a/test/jasmine/bundle_tests/plotschema_test.js b/test/jasmine/bundle_tests/plotschema_test.js index 36149adb965..7011aa61a8e 100644 --- a/test/jasmine/bundle_tests/plotschema_test.js +++ b/test/jasmine/bundle_tests/plotschema_test.js @@ -14,6 +14,7 @@ var gl3dAttrs = require('@src/plots/gl3d').layoutAttributes; var polarLayoutAttrs = require('@src/plots/polar/legacy/axis_attributes'); var annotationAttrs = require('@src/components/annotations').layoutAttributes; var updatemenuAttrs = require('@src/components/updatemenus').layoutAttributes; +var cartesianIdRegex = require('@src/plots/cartesian/constants').idRegex; describe('plot schema', function() { 'use strict'; @@ -363,9 +364,9 @@ describe('plot schema', function() { var splomAttrs = plotSchema.traces.splom.attributes; expect(typeof splomAttrs.xaxes.items.regex).toBe('string'); - expect(splomAttrs.xaxes.items.regex).toBe('/^x([2-9]|[1-9][0-9]+)?$/'); + expect(splomAttrs.xaxes.items.regex).toBe(cartesianIdRegex.x.toString()); expect(typeof splomAttrs.yaxes.items.regex).toBe('string'); - expect(splomAttrs.yaxes.items.regex).toBe('/^y([2-9]|[1-9][0-9]+)?$/'); + expect(splomAttrs.yaxes.items.regex).toBe(cartesianIdRegex.y.toString()); }); it('should prune unsupported global-level trace attributes', function() { diff --git a/test/jasmine/karma.conf.js b/test/jasmine/karma.conf.js index cde3011b4eb..113f3185ade 100644 --- a/test/jasmine/karma.conf.js +++ b/test/jasmine/karma.conf.js @@ -246,7 +246,13 @@ func.defaultConfig = { }, _Firefox: { base: 'Firefox', - flags: ['--width=' + argv.width, '--height=' + argv.height] + flags: ['--width=' + argv.width, '--height=' + argv.height], + prefs: { + 'devtools.toolbox.zoomValue': '1.5', + 'devtools.toolbox.host': 'window', + 'devtools.toolbox.previousHost': 'bottom', + 'devtools.command-button-rulers.enabled': true + } } }, diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index 94c2d74c762..5c4cc342d1e 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -13,12 +13,15 @@ var Cartesian = require('@src/plots/cartesian'); var Axes = require('@src/plots/cartesian/axes'); var Fx = require('@src/components/fx'); var supplyLayoutDefaults = require('@src/plots/cartesian/layout_defaults'); -var BADNUM = require('@src/constants/numerical').BADNUM; -var ONEDAY = require('@src/constants/numerical').ONEDAY; +var numerical = require('@src/constants/numerical'); +var BADNUM = numerical.BADNUM; +var ONEDAY = numerical.ONEDAY; +var ONEWEEK = numerical.ONEWEEK; var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var failTest = require('../assets/fail_test'); +var negateIf = require('../assets/negate_if'); var selectButton = require('../assets/modebar_button'); var supplyDefaults = require('../assets/supply_defaults'); @@ -188,6 +191,7 @@ describe('Test axes', function() { beforeEach(function() { layoutOut = { + autotypenumbers: 'convert types', _has: Plots._hasPlotType, _basePlotModules: [], _dfltTitle: {x: 'x', y: 'y'}, @@ -329,7 +333,92 @@ describe('Test axes', function() { ['d', 'e', 'f'] ] }); - checkTypes('linear', 'linear'); + checkTypes('linear', 'category'); + }); + }); + + describe('autotype disable/enable converting numeric strings', function() { + it('should disable converting numeric strings using axis.autotypenumbers', function() { + layoutIn = { + xaxis: {}, + yaxis: { autotypenumbers: 'strict' } + }; + + supplyLayoutDefaults(layoutIn, layoutOut, [{ + type: 'scatter', + xaxis: 'x', + yaxis: 'y', + x: ['0', '1', '1970', '2000'], + y: ['0', '1', '1970', '2000'] + }]); + + expect(layoutOut.xaxis.autotypenumbers).toBe('convert types'); + expect(layoutOut.yaxis.autotypenumbers).toBe('strict'); + expect(layoutOut.xaxis.type).toBe('linear'); + expect(layoutOut.yaxis.type).toBe('category'); + }); + + it('should enable converting numeric strings using axis.autotypenumbers and inherit defaults from layout.autotypenumbers', function() { + layoutOut.autotypenumbers = 'strict'; + + layoutIn = { + xaxis: { autotypenumbers: 'convert types' }, + yaxis: {} + }; + + supplyLayoutDefaults(layoutIn, layoutOut, [{ + type: 'scatter', + xaxis: 'x', + yaxis: 'y', + x: ['0', '1', '1970', '2000'], + y: ['0', '1', '1970', '2000'] + }]); + + expect(layoutOut.xaxis.autotypenumbers).toBe('convert types'); + expect(layoutOut.yaxis.autotypenumbers).toBe('strict'); + expect(layoutOut.xaxis.type).toBe('linear'); + expect(layoutOut.yaxis.type).toBe('category'); + }); + + it('should autotype date having more dates with & without strict autotypenumbers', function() { + layoutIn = { + xaxis: {}, + yaxis: { autotypenumbers: 'strict' } + }; + + var dates = [ + 0, + '0', + '00', + '0000', + '1970', + '2000', + '2001-01', + '2001-02', + '2001-03', + '2001-04', + '2001-05', + '2001-06', + '2001-07', + '2001-08', + '2001-09', + '2001-10', + '2001-11', + '2001-12' + ]; + + supplyLayoutDefaults(layoutIn, layoutOut, [{ + type: 'scatter', + xaxis: 'x', + yaxis: 'y', + x: dates, + y: dates + }]); + + expect(layoutOut.xaxis.autotypenumbers).toBe('convert types'); + expect(layoutOut.yaxis.autotypenumbers).toBe('strict'); + expect(layoutOut.xaxis.type).toBe('date'); + expect(layoutOut.yaxis.type).toBe('date'); }); }); @@ -484,6 +573,119 @@ describe('Test axes', function() { .toEqual(tinycolor.mix('#444', bgColor, frac).toRgbString()); }); + it('should default to a dark color for tickfont when plotting background is light', function() { + layoutIn = { + plot_bgcolor: 'lightblue', + xaxis: { + showgrid: true, + ticklabelposition: 'inside' + } + }; + + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.tickfont.color).toEqual('#444'); + }); + + it('should default to a light color for tickfont when plotting background is dark', function() { + layoutIn = { + plot_bgcolor: 'darkblue', + xaxis: { + showgrid: true, + ticklabelposition: 'inside' + } + }; + + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.tickfont.color).toEqual('#fff'); + }); + + it('should not coerce ticklabelposition on *multicategory* axes for now', function() { + layoutIn = { + xaxis: {type: 'multicategory'}, + yaxis: {type: 'multicategory'} + }; + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.ticklabelposition).toBeUndefined(); + expect(layoutOut.yaxis.ticklabelposition).toBeUndefined(); + }); + + ['category', 'linear', 'date'].forEach(function(type) { + it('should coerce ticklabelposition on *' + type + '* axes', function() { + layoutIn = { + xaxis: {type: type}, + yaxis: {type: type} + }; + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.ticklabelposition).toBe('outside'); + expect(layoutOut.yaxis.ticklabelposition).toBe('outside'); + }); + }); + + ['category', 'linear', 'date'].forEach(function(type) { + it('should be able to set ticklabelposition to *inside* on *' + type + '* axes', function() { + layoutIn = { + xaxis: {type: type, ticklabelposition: 'inside'}, + yaxis: {type: type, ticklabelposition: 'inside'} + }; + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.ticklabelposition).toBe('inside'); + expect(layoutOut.yaxis.ticklabelposition).toBe('inside'); + }); + }); + + ['inside left', 'inside right', 'outside left', 'outside right'].forEach(function(ticklabelposition) { + ['category', 'linear', 'date'].forEach(function(type) { + it('should be able to set ticklabelposition to *' + ticklabelposition + '* on xaxis for *' + type + '* axes', function() { + layoutIn = { + xaxis: {type: type, ticklabelposition: ticklabelposition}, + yaxis: {type: type, ticklabelposition: ticklabelposition} + }; + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.ticklabelposition).toBe(ticklabelposition); + expect(layoutOut.yaxis.ticklabelposition).toBe('outside', ticklabelposition + ' is not a valid input on yaxis'); + }); + }); + }); + + ['inside top', 'inside bottom', 'outside top', 'outside bottom'].forEach(function(ticklabelposition) { + ['category', 'linear', 'date'].forEach(function(type) { + it('should be able to set ticklabelposition to *' + ticklabelposition + '* on yaxis for *' + type + '* axes', function() { + layoutIn = { + xaxis: {type: type, ticklabelposition: ticklabelposition}, + yaxis: {type: type, ticklabelposition: ticklabelposition} + }; + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.ticklabelposition).toBe('outside', ticklabelposition + ' is not a valid input on yaxis'); + expect(layoutOut.yaxis.ticklabelposition).toBe(ticklabelposition); + }); + }); + }); + + [ + 'inside left', 'inside right', 'outside left', 'outside right', + 'inside top', 'inside bottom', 'outside top', 'outside bottom' + ].forEach(function(ticklabelposition) { + it('should not be able to set ticklabelposition to *' + ticklabelposition + '* when ticklabelmode is *period*', function() { + layoutIn = { + xaxis: {type: 'date', ticklabelmode: 'period', ticklabelposition: ticklabelposition}, + yaxis: {type: 'date', ticklabelmode: 'period', ticklabelposition: ticklabelposition} + }; + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.ticklabelposition).toBe('outside', ticklabelposition + ' is not a valid input with period mode'); + expect(layoutOut.yaxis.ticklabelposition).toBe('outside', ticklabelposition + ' is not a valid input with period mode'); + }); + }); + + it('should be able to set ticklabelposition to *inside* on yaxis when ticklabelmode is *period*', function() { + layoutIn = { + xaxis: {type: 'date', ticklabelmode: 'period', ticklabelposition: 'inside'}, + yaxis: {type: 'date', ticklabelmode: 'period', ticklabelposition: 'inside'} + }; + supplyLayoutDefaults(layoutIn, layoutOut, fullData); + expect(layoutOut.xaxis.ticklabelposition).toBe('inside'); + expect(layoutOut.yaxis.ticklabelposition).toBe('inside'); + }); + it('should inherit calendar from the layout', function() { layoutOut.calendar = 'nepali'; layoutIn = { @@ -589,14 +791,10 @@ describe('Test axes', function() { ]); }); - var warnTxt = ' to avoid either an infinite loop and possibly ' + - 'inconsistent scaleratios, or because the target axis has ' + - 'fixed range or this axis declares a *matches* constraint.'; - it('breaks scaleanchor loops and drops conflicting ratios', function() { var warnings = []; spyOn(Lib, 'warn').and.callFake(function(msg) { - warnings.push(msg); + warnings.push(msg.substr(0, msg.indexOf(' to avoid'))); }); layoutIn = { @@ -612,7 +810,8 @@ describe('Test axes', function() { yaxis4: {scaleanchor: 'y', scaleratio: 17}, // y<->y is OK now }; layoutOut._subplots.cartesian.push('x2y2', 'x3y3', 'x4y4'); - layoutOut._subplots.yaxis.push('x2', 'x3', 'x4', 'y2', 'y3', 'y4'); + layoutOut._subplots.xaxis.push('x2', 'x3', 'x4'); + layoutOut._subplots.yaxis.push('y2', 'y3', 'y4'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); @@ -622,15 +821,15 @@ describe('Test axes', function() { ]); expect(warnings).toEqual([ - 'ignored yaxis.scaleanchor: "x"' + warnTxt, - 'ignored yaxis3.scaleanchor: "x2"' + warnTxt + 'ignored yaxis.scaleanchor: "x"', + 'ignored yaxis3.scaleanchor: "x2"' ]); }); it('silently drops invalid scaleanchor values', function() { var warnings = []; spyOn(Lib, 'warn').and.callFake(function(msg) { - warnings.push(msg); + warnings.push(msg.substr(0, msg.indexOf(' to avoid'))); }); layoutIn = { @@ -644,7 +843,7 @@ describe('Test axes', function() { supplyLayoutDefaults(layoutIn, layoutOut, fullData); expect(layoutOut._axisConstraintGroups).toEqual([]); - expect(warnings).toEqual(['ignored xaxis.scaleanchor: "x"' + warnTxt]); + expect(warnings).toEqual(['ignored xaxis.scaleanchor: "x"']); ['xaxis', 'yaxis', 'xaxis2'].forEach(function(axName) { expect(layoutOut[axName].scaleanchor).toBeUndefined(axName); @@ -703,23 +902,23 @@ describe('Test axes', function() { expect(layoutOut.xaxis2.matches).toBe('x'); expect(layoutOut.xaxis2.scaleanchor).toBe(undefined); - expect(layoutOut.xaxis2.constrain).toBe(undefined); + // constrain is still coerced in case someone else scales to xaxis2 + expect(layoutOut.xaxis2.constrain).toBe('range'); expect(layoutOut._axisConstraintGroups).toEqual([]); expect(layoutOut._axisMatchGroups).toEqual([{x: 1, x2: 1}]); }); - it('remove axes from constraint groups if they are in a match group', function() { + it('combines all chained scaled/matched axes into a group but drops match-only groups from constraintGroups', function() { layoutIn = { - // this one is ok + // this one big group xaxis: {}, yaxis: {scaleanchor: 'x'}, - // this one too - xaxis2: {}, - yaxis2: {matches: 'x2'}, - // not these ones - xaxis3: {scaleanchor: 'x2'}, - yaxis3: {scaleanchor: 'y2'} + xaxis2: {matches: 'x'}, + yaxis2: {matches: 'y'}, + // this is another group but only shows up in matchGroups + xaxis3: {}, + yaxis3: {matches: 'x3'} }; layoutOut._subplots.cartesian.push('x2y2, x3y3'); layoutOut._subplots.xaxis.push('x2', 'x3'); @@ -727,74 +926,76 @@ describe('Test axes', function() { supplyLayoutDefaults(layoutIn, layoutOut, fullData); - expect(layoutOut._axisMatchGroups.length).toBe(1); - expect(layoutOut._axisMatchGroups).toContain({x2: 1, y2: 1}); + expect(layoutOut._axisMatchGroups).toEqual([{x: 1, x2: 1}, {y: 1, y2: 1}, {x3: 1, y3: 1}]); - expect(layoutOut._axisConstraintGroups.length).toBe(1); - expect(layoutOut._axisConstraintGroups).toContain({x: 1, y: 1}); + expect(layoutOut._axisConstraintGroups).toEqual([{x: 1, y: 1, x2: 1, y2: 1}]); }); - it('remove constraint group if they are one or zero items left in it', function() { + it('includes matches in constraintGroup when combined with scaleanchor', function() { layoutIn = { xaxis: {}, yaxis: {matches: 'x'}, - xaxis2: {scaleanchor: 'y'} + xaxis2: {scaleanchor: 'x'} }; layoutOut._subplots.cartesian.push('x2y'); layoutOut._subplots.xaxis.push('x2'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); - expect(layoutOut._axisMatchGroups.length).toBe(1); - expect(layoutOut._axisMatchGroups).toContain({x: 1, y: 1}); - - expect(layoutOut._axisConstraintGroups.length).toBe(0); + expect(layoutOut._axisMatchGroups).toEqual([{x: 1, y: 1}]); + expect(layoutOut._axisConstraintGroups).toEqual([{x: 1, y: 'y1', x2: 1}]); }); - it('drops scaleanchor settings if either the axis or target has fixedrange', function() { + it('turns all scaled axes fixedrange if any is fixedrange', function() { // some of these will create warnings... not too important, so not going to test, // just want to keep the output clean // spyOn(Lib, 'warn'); layoutIn = { xaxis: {fixedrange: true, scaleanchor: 'y', scaleratio: 2}, - yaxis: {scaleanchor: 'x2', scaleratio: 3}, // only this one should survive + yaxis: {scaleanchor: 'x2', scaleratio: 3}, xaxis2: {}, yaxis2: {scaleanchor: 'x', scaleratio: 5} }; layoutOut._subplots.cartesian.push('x2y2'); - layoutOut._subplots.yaxis.push('x2', 'y2'); + layoutOut._subplots.xaxis.push('x2'); + layoutOut._subplots.yaxis.push('y2'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); - expect(layoutOut._axisConstraintGroups).toEqual([{x2: 1, y: 3}]); + expect(layoutOut._axisConstraintGroups).toEqual([{x2: 1, y: 3, x: 6, y2: 30}]); + expect(layoutOut.xaxis.scaleanchor).toBe('y'); + expect(layoutOut.xaxis.scaleratio).toBe(2); expect(layoutOut.yaxis.scaleanchor).toBe('x2'); expect(layoutOut.yaxis.scaleratio).toBe(3); + expect(layoutOut.yaxis2.scaleanchor).toBe('x'); + expect(layoutOut.yaxis2.scaleratio).toBe(5); - ['xaxis', 'yaxis2', 'xaxis2'].forEach(function(axName) { - expect(layoutOut[axName].scaleanchor).toBeUndefined(); - expect(layoutOut[axName].scaleratio).toBeUndefined(); + ['xaxis', 'yaxis', 'yaxis2', 'xaxis2'].forEach(function(axName) { + expect(layoutOut[axName].fixedrange).toBe(true, axName); }); }); - it('drops *matches* settings if either the axis or target has fixedrange', function() { + it('turns all matching axes fixedrange if any is fixedrange', function() { layoutIn = { xaxis: {fixedrange: true, matches: 'y'}, - yaxis: {matches: 'x2'}, // only this one should survive + yaxis: {matches: 'x2'}, xaxis2: {}, yaxis2: {matches: 'x'} }; layoutOut._subplots.cartesian.push('x2y2'); - layoutOut._subplots.yaxis.push('x2', 'y2'); + layoutOut._subplots.xaxis.push('x2'); + layoutOut._subplots.yaxis.push('y2'); supplyLayoutDefaults(layoutIn, layoutOut, fullData); - expect(layoutOut._axisMatchGroups).toEqual([{x2: 1, y: 1}]); + expect(layoutOut._axisMatchGroups).toEqual([{x: 1, x2: 1, y: 1, y2: 1}]); expect(layoutOut.yaxis.matches).toBe('x2'); - ['xaxis', 'yaxis2', 'xaxis2'].forEach(function(axName) { - expect(layoutOut[axName].matches).toBeUndefined(); + ['xaxis', 'xaxis2', 'yaxis', 'yaxis2'].forEach(function(axName) { + negateIf(axName !== 'xaxis2', expect(layoutOut[axName].matches)).toBeUndefined(axName); + expect(layoutOut[axName].fixedrange).toBe(true, axName); }); }); @@ -902,7 +1103,7 @@ describe('Test axes', function() { // matchee ax has range yaxis: {range: [0, 1]}, yaxis2: {matches: 'y'}, - // matcher ax has range (gets ignored) + // first explicit range gets copied to both xaxis3: {}, yaxis3: {range: [-1, 1], matches: 'x3'}, // both ax have range @@ -925,13 +1126,14 @@ describe('Test axes', function() { names.forEach(function(n) { var ax = layoutOut[n]; expect(ax.autorange).toBe(autorange, n); - expect(ax.range).toEqual(rng); + expect(ax.range[0]).toBe(rng[0], n); + expect(ax.range[1]).toBe(rng[1], n); }); } _assertMatchingAxes(['xaxis', 'xaxis2'], true, [-1, 6]); _assertMatchingAxes(['yaxis', 'yaxis2'], false, [0, 1]); - _assertMatchingAxes(['xaxis3', 'yaxis3'], true, [-1, 6]); + _assertMatchingAxes(['xaxis3', 'yaxis3'], false, [-1, 1]); _assertMatchingAxes(['xaxis4', 'yaxis4'], false, [-1, 3]); }); @@ -1630,7 +1832,7 @@ describe('Test axes', function() { }) .then(function() { assertRanges('base (autoranged)', [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.245, 3.245], true], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.285, 3.245], true], [['yaxis'], [-0.211, 3.211], true] ]); }) @@ -1644,7 +1846,7 @@ describe('Test axes', function() { .then(function() { return Plotly.relayout(gd, 'xaxis2.autorange', true); }) .then(function() { assertRanges('back to autorange', [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.245, 3.245], true], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.285, 3.245], true], [['yaxis'], [-0.211, 3.211], true] ]); }) @@ -1779,6 +1981,25 @@ describe('Test axes', function() { }); }); + describe('bar category autorange', function() { + var gd; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + describe('a category has the same value of one of the auto range computed extreme', function() { + it('should compute the right range for X axis', function() { + Plotly.plot(gd, [{x: ['0', '-0.5', '3.5', 'Not Known'], y: [ '1.0', '1.0', '2.0', '1.0'], type: 'bar'}], { + xaxis: {type: 'category', autorange: true} + }); + expect(gd._fullLayout.xaxis._rl).toEqual([-0.5, 3.5]); + }); + }); + }); + describe('handleTickDefaults', function() { var data = [{ x: [1, 2, 3], y: [3, 4, 5] }]; var gd; @@ -2851,6 +3072,58 @@ describe('Test axes', function() { ]); }); + it('Does not use SI prefixes for 10^n with |n| < minexponent', function() { + var textOut = mockCalc({ + type: 'log', + tickmode: 'linear', + exponentformat: 'SI', + minexponent: 5, + showexponent: 'all', + tick0: 0, + dtick: 1, + range: [-18.5, 18.5] + }); + + expect(textOut).toEqual([ + '10\u221218', + '10\u221217', + '10\u221216', + '1f', '10f', '100f', '1p', '10p', '100p', '1n', '10n', '100n', + '1μ', '0.00001', '0.0001', '0.001', '0.01', '0.1', '1', '10', '100', + '1000', '10,000', '100,000', '1M', '10M', '100M', '1G', '10G', '100G', + '1T', '10T', '100T', + '1015', + '1016', + '1017', + '1018' + ]); + + textOut = mockCalc({ + type: 'log', + tickmode: 'linear', + exponentformat: 'SI', + minexponent: 0, + showexponent: 'all', + tick0: 0, + dtick: 1, + range: [-18.5, 18.5] + }); + + expect(textOut).toEqual([ + '10\u221218', + '10\u221217', + '10\u221216', + '1f', '10f', '100f', '1p', '10p', '100p', '1n', '10n', '100n', + '1μ', '10μ', '100μ', '1m', '10m', '100m', '1', '10', '100', + '1k', '10k', '100k', '1M', '10M', '100M', '1G', '10G', '100G', + '1T', '10T', '100T', + '1015', + '1016', + '1017', + '1018' + ]); + }); + it('supports e/E format on log axes', function() { ['e', 'E'].forEach(function(e) { var textOut = mockCalc({ @@ -3783,7 +4056,7 @@ describe('Test axes', function() { .then(function() { return Plotly.relayout(gd, 'height', 100); }) .then(function() { _assert('after relayout to *small* height', { - bottomLowerBound: 30, + bottomLowerBound: 15, totalHeight: 100 }); }) @@ -3823,7 +4096,7 @@ describe('Test axes', function() { .then(function() { return Plotly.relayout(gd, 'width', 100); }) .then(function() { _assert('after relayout to *small* width', { - leftLowerBound: 30, + leftLowerBound: 15, totalWidth: 100 }); }) @@ -4985,12 +5258,14 @@ describe('Test axes', function() { afterEach(destroyGraphDiv); - function _assert(msg, exp) { + function _assert(msg, exp, autorange) { var fullLayout = gd._fullLayout; var xa = fullLayout.xaxis; - expect(xa._vals.map(function(d) { return d.x; })) - .withContext(msg).toEqual(exp.tickVals); + var vals = xa._vals.map(function(d) { return Lib.ms2DateTime(d.x); }); + if(autorange === 'reversed') vals.reverse(); + + expect(vals).withContext(msg).toEqual(exp.tickVals); } it('should not include requested ticks that fall within rangebreaks', function(done) { @@ -5012,7 +5287,7 @@ describe('Test axes', function() { }) .then(function() { _assert('base', { - tickVals: [0, 50, 100, 150, 200] + tickVals: ['1970-01-01', '1970-01-01 00:00:00.05', '1970-01-01 00:00:00.1', '1970-01-01 00:00:00.15', '1970-01-01 00:00:00.2'] }); }) .then(function() { @@ -5032,7 +5307,7 @@ describe('Test axes', function() { }) .then(function() { _assert('with two rangebreaks', { - tickVals: [0, 5, 90, 95, 190, 195, 200] + tickVals: ['1970-01-01', '1970-01-01 00:00:00.089', '1970-01-01 00:00:00.1', '1970-01-01 00:00:00.189', '1970-01-01 00:00:00.2'] }); }) .catch(failTest) @@ -5062,7 +5337,7 @@ describe('Test axes', function() { }], layout: { width: 1600, - height: 1600 + height: 400 } }; @@ -5093,8 +5368,8 @@ describe('Test axes', function() { '1970-01-12 08:00', '1970-01-12 12:00', '1970-01-12 16:00', '1970-01-13 08:00', '1970-01-13 12:00', '1970-01-13 16:00', '1970-01-14 08:00', '1970-01-14 12:00', '1970-01-14 16:00' - ].map(Lib.dateTime2ms) - }); + ] + }, autorange); }) .then(function() { fig.layout.xaxis = { @@ -5124,8 +5399,8 @@ describe('Test axes', function() { '1970-01-12 08:00', '1970-01-12 11:00', '1970-01-12 14:00', '1970-01-13 08:00', '1970-01-13 11:00', '1970-01-13 14:00', '1970-01-14 08:00', '1970-01-14 11:00', '1970-01-14 14:00' - ].map(Lib.dateTime2ms) - }); + ] + }, autorange); }) .then(function() { fig.layout.xaxis = { @@ -5155,8 +5430,8 @@ describe('Test axes', function() { '1970-01-12 08:00', '1970-01-12 10:00', '1970-01-12 12:00', '1970-01-12 14:00', '1970-01-12 16:00', '1970-01-13 08:00', '1970-01-13 10:00', '1970-01-13 12:00', '1970-01-13 14:00', '1970-01-13 16:00', '1970-01-14 08:00', '1970-01-14 10:00', '1970-01-14 12:00', '1970-01-14 14:00', '1970-01-14 16:00' - ].map(Lib.dateTime2ms) - }); + ] + }, autorange); }) .catch(failTest) .then(done); @@ -5210,11 +5485,15 @@ describe('Test axes', function() { function _assert(msg, expPositions, expLabels) { var ax = gd._fullLayout.xaxis; - var positions = ax._vals.map(function(d) { return ax.c2d(d.periodX); }); - expect(positions).withContext(msg).toEqual(expPositions); - + var positions = ax._vals.map(function(d) { return ax.c2d(d.periodX !== undefined ? d.periodX : d.x); }); var labels = ax._vals.map(function(d) { return d.text; }); - expect(labels).withContext(msg).toEqual(expLabels); + + for(var i = 0; i < labels.length; i++) { + expect(labels[i]).withContext(msg).toBe(expLabels[i]); + if(labels[i] !== ' ') { + expect(positions[i]).withContext(msg).toBe(expPositions[i]); + } + } } ['%Y', '%y'].forEach(function(formatter, i) { @@ -5419,7 +5698,7 @@ describe('Test axes', function() { }); ['%U', '%V', '%W'].forEach(function(formatter, i) { - it('should move weekly labels by one day (i.e. to help center the labels) when *day of week* rangebreak is present', function(done) { + it('should position weekly labels in the middle when *day of week* rangebreak is present', function(done) { Plotly.newPlot(gd, { data: [{ hovertemplate: hovertemplate, @@ -5468,13 +5747,13 @@ describe('Test axes', function() { }) .then(function() { _assert('', [ - ['2019-12-31 04:00', '2020-01-08 12:00', '2020-01-15 12:00', '2020-01-22 12:00', '2020-01-29 12:00'], - ['2020-01-01 12:00', '2020-01-08 12:00', '2020-01-15 12:00', '2020-01-22 12:00', '2020-01-29 12:00'], - ['2020-01-01 12:00', '2020-01-08 12:00', '2020-01-15 12:00', '2020-01-22 12:00', '2020-01-29 12:00'] + ['2020-01-08 12:00', '2020-01-15 12:00', '2020-01-22 12:00', '2020-01-29 12:00'], + ['2020-01-08 12:00', '2020-01-15 12:00', '2020-01-22 12:00', '2020-01-29 12:00'], + ['2020-01-08 12:00', '2020-01-15 12:00', '2020-01-22 12:00', '2020-01-29 12:00'] ][i], [ - [' ', 'Jan-W01', 'Jan-W02', 'Jan-W03', 'Jan-W04'], - ['Dec-W01', 'Jan-W02', 'Jan-W03', 'Jan-W04', 'Jan-W05'], - ['Dec-W52', 'Jan-W01', 'Jan-W02', 'Jan-W03', 'Jan-W04'] + ['Jan-W01', 'Jan-W02', 'Jan-W03', 'Jan-W04'], + ['Jan-W02', 'Jan-W03', 'Jan-W04', 'Jan-W05'], + ['Jan-W01', 'Jan-W02', 'Jan-W03', 'Jan-W04'] ][i]); }) .catch(failTest) @@ -5562,7 +5841,6 @@ describe('Test axes', function() { }); }); - [ { formatter: '%H', @@ -5576,28 +5854,28 @@ describe('Test axes', function() { }, { formatter: '%p', - positions: ['2019-12-31 21:00', '2020-01-01 06:00', '2020-01-01 18:00', '2020-01-02 06:00'], + positions: ['2019-12-31 18:00', '2020-01-01 06:00', '2020-01-01 18:00', '2020-01-02 06:00'], labels: [' ', 'Wed-AM', 'Wed-PM', ' '] }, { formatter: '%M', - positions: ['2019-12-31 21:00', '2020-01-01 12:00', '2020-01-02 12:00'], - labels: [' ', 'Wed-00', ' '] + positions: ['2019-12-31 21:00', '2020-01-01', '2020-01-01 03:00', '2020-01-01 06:00', '2020-01-01 09:00', '2020-01-01 12:00', '2020-01-01 15:00', '2020-01-01 18:00', '2020-01-01 21:00', '2020-01-02'], + labels: [' ', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Thu-00'] }, { formatter: '%S', - positions: ['2019-12-31 21:00', '2020-01-01 12:00', '2020-01-02 12:00'], - labels: [' ', 'Wed-00', ' '] + positions: ['2019-12-31 21:00', '2020-01-01', '2020-01-01 03:00', '2020-01-01 06:00', '2020-01-01 09:00', '2020-01-01 12:00', '2020-01-01 15:00', '2020-01-01 18:00', '2020-01-01 21:00', '2020-01-02'], + labels: [' ', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Wed-00', 'Thu-00'] }, { formatter: '%L', - positions: ['2019-12-31 21:00', '2020-01-01 12:00', '2020-01-02 12:00'], - labels: [' ', 'Wed-000', ' '] + positions: ['2019-12-31 21:00', '2020-01-01', '2020-01-01 03:00', '2020-01-01 06:00', '2020-01-01 09:00', '2020-01-01 12:00', '2020-01-01 15:00', '2020-01-01 18:00', '2020-01-01 21:00', '2020-01-02'], + labels: [' ', 'Wed-000', 'Wed-000', 'Wed-000', 'Wed-000', 'Wed-000', 'Wed-000', 'Wed-000', 'Wed-000', 'Thu-000'] }, { formatter: '%f', - positions: ['2019-12-31 21:00', '2020-01-01 12:00', '2020-01-02 12:00'], - labels: [' ', 'Wed-0', ' '] + positions: ['2019-12-31 21:00', '2020-01-01', '2020-01-01 03:00', '2020-01-01 06:00', '2020-01-01 09:00', '2020-01-01 12:00', '2020-01-01 15:00', '2020-01-01 18:00', '2020-01-01 21:00', '2020-01-02'], + labels: [' ', 'Wed-0', 'Wed-0', 'Wed-0', 'Wed-0', 'Wed-0', 'Wed-0', 'Wed-0', 'Wed-0', 'Thu-0'] } ].forEach(function(t) { it('should respect time tickformat that includes ' + t.formatter, function(done) { @@ -5622,6 +5900,53 @@ describe('Test axes', function() { }); }); + [ + { + range: ['2019-12-10', '2020-01-10'], + positions: ['2019-12-16 12:00', '2020-01-10'], + labels: ['2019-Dec', ' '] + }, + { + range: ['2019-12-20', '2020-01-20'], + positions: ['2019-12-20', '2020-01-16 12:00'], + labels: [' ', '2020-Jan'] + }, + { + range: ['2020-01-20', '2019-12-20'], + positions: ['2020-01-20', '2020-01-16 12:00'], + labels: [' ', '2020-Jan'] + } + ].forEach(function(t) { + it('should position labels with monthly tickformat when auto dtick is weekly | range:' + t.range, function(done) { + Plotly.newPlot(gd, { + data: [{ + x: [ + '2020-01-01', + '2020-01-02' + ], + mode: 'lines+text', + text: [ + 'Jan 01', + 'Jan 02' + ] + }], + layout: { + width: 600, + xaxis: { + range: t.range, + ticklabelmode: 'period', + tickformat: '%Y-%b' + } + } + }) + .then(function() { + _assert('', t.positions, t.labels); + }) + .catch(failTest) + .then(done); + }); + }); + [ { range: ['2020-12-15', '2084-12-15'], @@ -5867,48 +6192,48 @@ describe('Test axes', function() { [ { range: ['2020-12-14 08:00', '2022-12-14 08:00'], - positions: ['2020-12-06 10:26:47.1429', '2021-03-07 09:50:21.4286', '2021-06-06 16:26:47.1429', '2021-09-06 16:26:47.1429', '2021-12-07 09:50:21.4286', '2022-03-06 16:26:47.1429', '2022-06-06 16:26:47.1429', '2022-09-07 01:08:34.2857', '2022-12-07 01:08:34.2857'], - labels: [' ', 'Mar 2021', 'Jun 2021', 'Sep 2021', 'Dec 2021', 'Mar 2022', 'Jun 2022', 'Sep 2022', 'Dec 2022'] + positions: ['2021-01-06 07:45', '2021-04-06 07:45', '2021-07-06 07:45', '2021-10-06 07:45', '2022-01-06 07:45', '2022-04-06 07:45', '2022-07-06 07:45', '2022-10-06 07:45'], + labels: ['Jan 2021', 'Apr 2021', 'Jul 2021', 'Oct 2021', 'Jan 2022', 'Apr 2022', 'Jul 2022', 'Oct 2022'] }, { range: ['2020-12-14 08:00', '2021-08-14 08:00'], - positions: ['2020-12-06 04:17:08.5714', '2020-12-27 22:00', '2021-01-24 22:00', '2021-02-21 22:00', '2021-03-21 22:00', '2021-04-18 22:00', '2021-05-16 22:00', '2021-06-13 22:00', '2021-07-11 22:00', '2021-08-08 22:00'], - labels: [' ', 'Dec 21
2020', 'Jan 18
2021', 'Feb 15', 'Mar 15', 'Apr 12', 'May 10', 'Jun 7', 'Jul 5', 'Aug 2'] + positions: ['2021-01-16 18:00', '2021-02-15 06:00', '2021-03-16 18:00', '2021-04-16 06:00', '2021-05-16 18:00', '2021-06-16 06:00', '2021-07-16 18:00', '2021-08-16 18:00'], + labels: ['Jan 2021', 'Feb 2021', 'Mar 2021', 'Apr 2021', 'May 2021', 'Jun 2021', 'Jul 2021', ' '] }, { range: ['2020-12-14 08:00', '2021-04-14 08:00'], - positions: ['2020-12-13 03:42:51.4286', '2020-12-21 11:42:51.4286', '2021-01-04 11:42:51.4286', '2021-01-18 11:42:51.4286', '2021-02-01 11:42:51.4286', '2021-02-15 11:42:51.4286', '2021-03-01 11:42:51.4286', '2021-03-15 11:42:51.4286', '2021-03-29 11:42:51.4286', '2021-04-12 11:42:51.4286'], - labels: [' ', 'Dec 21
2020', 'Jan 4
2021', 'Jan 18', 'Feb 1', 'Feb 15', 'Mar 1', 'Mar 15', 'Mar 29', 'Apr 12'] + positions: ['2020-12-21 12:00', '2021-01-04 12:00', '2021-01-18 12:00', '2021-02-01 12:00', '2021-02-15 12:00', '2021-03-01 12:00', '2021-03-15 12:00', '2021-03-29 12:00', '2021-04-12 12:00'], + labels: ['Dec 21
2020', 'Jan 4
2021', 'Jan 18', 'Feb 1', 'Feb 15', 'Mar 1', 'Mar 15', 'Mar 29', 'Apr 12'] }, { range: ['2020-12-14 08:00', '2021-02-14 08:00'], - positions: ['2020-12-13 03:42:51.4286', '2020-12-21 10:17:08.5714', '2020-12-28 10:17:08.5714', '2021-01-04 10:17:08.5714', '2021-01-11 10:17:08.5714', '2021-01-18 10:17:08.5714', '2021-01-25 10:17:08.5714', '2021-02-01 10:17:08.5714', '2021-02-08 11:42:51.4286', '2021-02-14 13:42:51.4286'], - labels: [' ', 'Dec 21
2020', 'Dec 28', 'Jan 4
2021', 'Jan 11', 'Jan 18', 'Jan 25', 'Feb 1', 'Feb 8', ' '] + positions: ['2020-12-21 12:00', '2020-12-28 12:00', '2021-01-04 12:00', '2021-01-11 12:00', '2021-01-18 12:00', '2021-01-25 12:00', '2021-02-01 12:00', '2021-02-08 12:00'], + labels: ['Dec 21
2020', 'Dec 28', 'Jan 4
2021', 'Jan 11', 'Jan 18', 'Jan 25', 'Feb 1', 'Feb 8'] }, { range: ['2020-12-14 08:00', '2021-01-14 08:00'], - positions: ['2020-12-14 05:08:34.2857', '2020-12-16 12:17:08.5714', '2020-12-18 09:08:34.2857', '2020-12-22 12:17:08.5714', '2020-12-24 18:00', '2020-12-28 12:17:08.5714', '2020-12-30 12:17:08.5714', '2021-01-01 09:08:34.2857', '2021-01-05 12:17:08.5714', '2021-01-07 18:00', '2021-01-11 12:17:08.5714', '2021-01-13 12:17:08.5714'], - labels: [' ', 'Dec 16
2020', 'Dec 18', 'Dec 22', 'Dec 24', 'Dec 28', 'Dec 30', 'Jan 1
2021', 'Jan 5', 'Jan 7', 'Jan 11', 'Jan 13'] + positions: ['2020-12-21 12:00', '2020-12-28 12:00', '2021-01-04 12:00', '2021-01-11 12:00'], + labels: ['Dec 21
2020', 'Dec 28', 'Jan 4
2021', 'Jan 11'] }, { range: ['2020-12-14 08:00', '2021-01-01 08:00'], - positions: ['2020-12-14 05:08:34.2857', '2020-12-16 12:17:08.5714', '2020-12-18 09:08:34.2857', '2020-12-22 12:17:08.5714', '2020-12-24 18:00', '2020-12-28 12:17:08.5714', '2020-12-30 12:17:08.5714', '2021-01-01 12:17:08.5714'], - labels: [' ', 'Dec 16
2020', 'Dec 18', 'Dec 22', 'Dec 24', 'Dec 28', 'Dec 30', ' '] + positions: ['2020-12-16 12:00', '2020-12-18 12:00', '2020-12-22 12:00', '2020-12-24 12:00', '2020-12-28 12:00', '2020-12-30 12:00', '2021-01-01 12:00'], + labels: ['Dec 16
2020', 'Dec 18', 'Dec 22', 'Dec 24', 'Dec 28', 'Dec 30', ' '] }, { range: ['2020-12-14 08:00', '2020-12-22 08:00'], - positions: ['2020-12-14 04:51:25.7143', '2020-12-15 18:00', '2020-12-16 18:00', '2020-12-17 18:00', '2020-12-18 18:00', '2020-12-21 18:00', '2020-12-22 18:00'], - labels: [' ', '06:00
Dec 15, 2020', '06:00
Dec 16, 2020', '06:00
Dec 17, 2020', '06:00
Dec 18, 2020', '06:00
Dec 21, 2020', ' '] + positions: ['2020-12-15 12:00', '2020-12-16 12:00', '2020-12-17 12:00', '2020-12-18 12:00', '2020-12-21 12:00', '2020-12-22 12:00'], + labels: ['Dec 15
2020', 'Dec 16', 'Dec 17', 'Dec 18', 'Dec 21', ' '] }, { range: ['2020-12-14 08:00', '2020-12-18 08:00'], - positions: ['2020-12-14 06:00', '2020-12-14 12:00', '2020-12-15 06:00', '2020-12-15 12:00', '2020-12-16 06:00', '2020-12-16 12:00', '2020-12-17 06:00', '2020-12-17 12:00', '2020-12-18 06:00'], - labels: [' ', '12:00
Dec 14, 2020', '06:00
Dec 15, 2020', '12:00', '06:00
Dec 16, 2020', '12:00', '06:00
Dec 17, 2020', '12:00', '06:00
Dec 18, 2020'] + positions: ['2020-12-14 12:00', '2020-12-15 06:00', '2020-12-15 12:00', '2020-12-16 06:00', '2020-12-16 12:00', '2020-12-17 06:00', '2020-12-17 12:00', '2020-12-18 06:00'], + labels: ['12:00
Dec 14, 2020', '06:00
Dec 15, 2020', '12:00', '06:00
Dec 16, 2020', '12:00', '06:00
Dec 17, 2020', '12:00', '06:00
Dec 18, 2020'] }, { range: ['2020-12-14 08:00', '2020-12-16 08:00'], - positions: ['2020-12-14 06:00', '2020-12-14 09:00', '2020-12-14 12:00', '2020-12-14 15:00', '2020-12-15 06:00', '2020-12-15 09:00', '2020-12-15 12:00', '2020-12-15 15:00', '2020-12-16 06:00'], - labels: [' ', '09:00
Dec 14, 2020', '12:00', '15:00', '06:00
Dec 15, 2020', '09:00', '12:00', '15:00', '06:00
Dec 16, 2020'] + positions: ['2020-12-14 12:00', '2020-12-15 06:00', '2020-12-15 12:00', '2020-12-16 06:00'], + labels: ['12:00
Dec 14, 2020', '06:00
Dec 15, 2020', '12:00', '06:00
Dec 16, 2020'] } ].forEach(function(t) { it('should position auto labels with rangebreaks | range:' + t.range, function(done) { @@ -5968,6 +6293,42 @@ describe('Test axes', function() { .then(done); }); }); + + [undefined, '%U', '%V', '%W'].forEach(function(tickformat) { + it('with ' + tickformat + ' tickformat, should default tick0 on a Sunday when dtick is a round number of weeks', function(done) { + var fig = { + data: [ + { + showlegend: false, + type: 'bar', + width: ONEWEEK, + xperiod: ONEWEEK, + x: [ + '2020-09-16', + '2020-09-24', + '2020-09-30' + ], + y: [3, 2, 4] + } + ], + layout: { + xaxis: { + tickformat: tickformat, + dtick: ONEWEEK, + ticklabelmode: 'period', + showgrid: true, + } + } + }; + + Plotly.newPlot(gd, fig) + .then(function() { + expect(gd._fullLayout.xaxis.tick0).toBe('2000-01-02'); + }) + .catch(failTest) + .then(done); + }); + }); }); }); diff --git a/test/jasmine/tests/bar_test.js b/test/jasmine/tests/bar_test.js index 8b835f36907..44f237eeb7a 100644 --- a/test/jasmine/tests/bar_test.js +++ b/test/jasmine/tests/bar_test.js @@ -2119,6 +2119,21 @@ describe('A bar plot', function() { .then(done); }); + it('should display bar of zero-length as M0,0Z when staticPlot is true', function(done) { + // otherwise Chromium produces a PDF with visual artifacts in place of zero-length bar: https://github.com/plotly/orca/issues/345 + var mock = {data: [{type: 'bar', x: ['a', 'b'], y: [0, 5]}], config: {staticPlot: true}}; + + Plotly.newPlot(gd, mock) + .then(function() { + var nodes = gd.querySelectorAll('g.point > path'); + expect(nodes.length).toBe(2, '# of bars'); + var d = nodes[0].getAttribute('d'); + expect(d).toBe('M0,0Z'); + }) + .catch(failTest) + .then(done); + }); + describe('show narrow bars', function() { ['initial zoom', 'after zoom out'].forEach(function(zoomStr) { it(zoomStr, function(done) { @@ -2495,6 +2510,52 @@ describe('bar hover', function() { .catch(failTest) .then(done); }); + + it('should provide a default label for base in hovertemplate', function(done) { + gd = createGraphDiv(); + + function _hover(xpx, ypx) { + return function() { + Fx.hover(gd, {xpx: xpx, ypx: ypx}, 'xy'); + Lib.clearThrottle(); + }; + } + + Plotly.plot(gd, { + data: [{ + type: 'bar', + orientation: 'h', + base: ['2020-04-06 22:17:00'], + x: [11520000.0], + y: ['test'], + hovertemplate: ['%{base}
%{x}'] + }], + layout: { + xaxis: { type: 'date', tickprefix: '*', ticksuffix: '*' }, + width: 400, + height: 400, + margin: {l: 0, t: 0, r: 0, b: 0}, + hovermode: 'closest' + } + }) + .then(_hover(200, 200)) + .then(function() { + assertHoverLabelContent({ + nums: '*Apr 6, 2020, 22:17*\n*Apr 7, 2020, 01:29*', + name: 'trace 0' + }); + return Plotly.relayout(gd, 'xaxis.tickformat', '%d'); + }) + .then(_hover(200, 200)) + .then(function() { + assertHoverLabelContent({ + nums: '*06*\n*07*', + name: 'trace 0' + }); + }) + .catch(failTest) + .then(done); + }); }); describe('with special width/offset combinations', function() { diff --git a/test/jasmine/tests/box_test.js b/test/jasmine/tests/box_test.js index 9ea11d6b406..bf915365c95 100644 --- a/test/jasmine/tests/box_test.js +++ b/test/jasmine/tests/box_test.js @@ -26,7 +26,7 @@ describe('Test boxes supplyDefaults', function() { it('should set visible to false when x and y are empty', function() { traceIn = {}; - supplyDefaults(traceIn, traceOut, defaultColor); + supplyDefaults(traceIn, traceOut, defaultColor, {}); expect(traceOut.visible).toBe(false); traceIn = { @@ -636,6 +636,82 @@ describe('Test boxes supplyDefaults', function() { }); }); +describe('Test box autoType', function() { + it('should disable converting numeric strings using axis.autotypenumbers', function() { + var gd = { + layout: { + xaxis: { autotypenumbers: 'strict' } + }, + data: [{ + type: 'box', + x: ['3', '0', '1', '2'], + + xaxis: 'x', + lowerfence: ['0', '0', '0', '0'], + q1: ['0.5', '1', '1.5', '2'], + median: ['1', '2', '3', '4'], + q3: ['1.5', '3', '4.5', '6'], + upperfence: ['2', '4', '6', '8'], + }] + }; + + supplyAllDefaults(gd); + + expect(gd._fullLayout.xaxis.autotypenumbers).toBe('strict'); + expect(gd._fullLayout.xaxis.type).toBe('category'); + }); + + it('should enable converting numeric strings using axis.autotypenumbers', function() { + var gd = { + layout: { + autotypenumbers: 'strict', + xaxis: { autotypenumbers: 'convert types' } + }, + data: [{ + type: 'box', + x: ['3', '0', '1', '2'], + + xaxis: 'x', + lowerfence: ['0', '0', '0', '0'], + q1: ['0.5', '1', '1.5', '2'], + median: ['1', '2', '3', '4'], + q3: ['1.5', '3', '4.5', '6'], + upperfence: ['2', '4', '6', '8'], + }] + }; + + supplyAllDefaults(gd); + + expect(gd._fullLayout.xaxis.autotypenumbers).toBe('convert types'); + expect(gd._fullLayout.xaxis.type).toBe('linear'); + }); + + it('should enable converting numeric inherit defaults from layout.autotypenumbers', function() { + var gd = { + layout: { + autotypenumbers: 'strict', + xaxis: {} + }, + data: [{ + type: 'box', + x: ['3', '0', '1', '2'], + + xaxis: 'x', + lowerfence: ['0', '0', '0', '0'], + q1: ['0.5', '1', '1.5', '2'], + median: ['1', '2', '3', '4'], + q3: ['1.5', '3', '4.5', '6'], + upperfence: ['2', '4', '6', '8'], + }] + }; + + supplyAllDefaults(gd); + + expect(gd._fullLayout.xaxis.autotypenumbers).toBe('strict'); + expect(gd._fullLayout.xaxis.type).toBe('category'); + }); +}); + describe('Test box hover:', function() { var gd; diff --git a/test/jasmine/tests/carpet_test.js b/test/jasmine/tests/carpet_test.js index 8bf0aab5033..fa821fbdc5c 100644 --- a/test/jasmine/tests/carpet_test.js +++ b/test/jasmine/tests/carpet_test.js @@ -217,6 +217,75 @@ describe('supplyDefaults visibility check', function() { }); }); +describe('Test carpet autoType', function() { + it('should disable converting numeric strings using axis.autotypenumbers', function() { + var gd = { + layout: { + xaxis: { autotypenumbers: 'strict' }, + yaxis: {} + }, + data: [{ + type: 'carpet', + a: ['1', '2', '3'], + b: ['1', '2'], + x: [['1', '2', '3'], ['4', '5', '6']], + y: [['1', '2', '3'], ['4', '5', '6']], + }] + }; + + supplyAllDefaults(gd); + + var xaxis = gd._fullLayout.xaxis; + var yaxis = gd._fullLayout.yaxis; + expect(xaxis.autotypenumbers).toBe('strict'); + expect(yaxis.autotypenumbers).toBe('convert types'); + expect(xaxis.type).toBe('category'); + expect(yaxis.type).toBe('linear'); + + // inherit default from layout.autotypenumbers + var aaxis = gd._fullData[0].aaxis; + var baxis = gd._fullData[0].baxis; + expect(aaxis.autotypenumbers).toBe('convert types'); + expect(baxis.autotypenumbers).toBe('convert types'); + expect(aaxis.type).toBe('linear'); + expect(baxis.type).toBe('linear'); + }); + + it('should enable converting numeric strings using axis.autotypenumbers and inherit defaults from layout.autotypenumbers', function() { + var gd = { + layout: { + autotypenumbers: 'strict', + xaxis: { autotypenumbers: 'convert types' }, + yaxis: {} + }, + data: [{ + type: 'carpet', + a: ['1', '2', '3'], + b: ['1', '2'], + x: [['1', '2', '3'], ['4', '5', '6']], + y: [['1', '2', '3'], ['4', '5', '6']], + }] + }; + + supplyAllDefaults(gd); + + var xaxis = gd._fullLayout.xaxis; + var yaxis = gd._fullLayout.yaxis; + expect(xaxis.autotypenumbers).toBe('convert types'); + expect(yaxis.autotypenumbers).toBe('strict'); + expect(xaxis.type).toBe('linear'); + expect(yaxis.type).toBe('category'); + + // inherit default from layout.autotypenumbers + var aaxis = gd._fullData[0].aaxis; + var baxis = gd._fullData[0].baxis; + expect(aaxis.autotypenumbers).toBe('strict'); + expect(baxis.autotypenumbers).toBe('strict'); + expect(aaxis.type).toBe('category'); + expect(baxis.type).toBe('category'); + }); +}); + describe('carpet smooth_fill_2d_array', function() { var _; diff --git a/test/jasmine/tests/cartesian_interact_test.js b/test/jasmine/tests/cartesian_interact_test.js index 2fdd891f83b..e1a368f2ae8 100644 --- a/test/jasmine/tests/cartesian_interact_test.js +++ b/test/jasmine/tests/cartesian_interact_test.js @@ -872,7 +872,7 @@ describe('axis zoom/pan and main plot zoom', function() { var msgi = n + ' - ' + msg; if(opts.autorange) { expect(eventData[n + '.autorange']).toBe(true, 2, msgi + '|event data'); - } else if(!opts.noChange) { + } else if(!opts.noChange && !opts.noEventData) { expect(eventData[n + '.range[0]']).toBeCloseTo(rng[0], TOL, msgi + '|event data [0]'); expect(eventData[n + '.range[1]']).toBeCloseTo(rng[1], TOL, msgi + '|event data [1]'); } @@ -970,14 +970,14 @@ describe('axis zoom/pan and main plot zoom', function() { dragmode: 'zoom' }; - var xr0 = [-0.245, 3.245]; + var xr0 = [-0.285, 3.246]; var yr0 = [-0.211, 3.211]; var specs = [{ desc: 'zoombox on xy', drag: ['xy', 'nsew', 30, 30], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [1.494, 2.350]], + [['xaxis', 'xaxis2', 'xaxis3'], [1.457, 2.328]], [['yaxis'], [1.179, 1.50]] ], dblclickSubplot: 'xy' @@ -985,7 +985,7 @@ describe('axis zoom/pan and main plot zoom', function() { desc: 'x-only zoombox on xy', drag: ['xy', 'nsew', 30, 0], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [1.494, 2.350]], + [['xaxis', 'xaxis2', 'xaxis3'], [1.457, 2.328]], [['yaxis'], yr0, {noChange: true}] ], dblclickSubplot: 'x2y' @@ -1003,7 +1003,7 @@ describe('axis zoom/pan and main plot zoom', function() { exp: [ // N.B. slightly different range result // due difference in ax._length - [['xaxis', 'xaxis2', 'xaxis3'], [1.492, 2.062]], + [['xaxis', 'xaxis2', 'xaxis3'], [1.468, 2.049]], [['yaxis'], [1.179, 1.50]] ], dblclickSubplot: 'x3y' @@ -1013,7 +1013,7 @@ describe('axis zoom/pan and main plot zoom', function() { exp: [ // Similarly here slightly different range result // due difference in ax._length - [['xaxis', 'xaxis2', 'xaxis3'], [1.485, 1.974]], + [['xaxis', 'xaxis2', 'xaxis3'], [1.470, 1.974]], [['yaxis'], [1.179, 1.50]] ], dblclickSubplot: 'xy' @@ -1021,7 +1021,7 @@ describe('axis zoom/pan and main plot zoom', function() { desc: 'drag ew on x2y', drag: ['x2y', 'ew', 30, 0], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.816, 2.675], {dragged: true}], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.866, 2.665], {dragged: true}], [['yaxis'], yr0, {noChange: true}] ], dblclickSubplot: 'x3y' @@ -1029,7 +1029,7 @@ describe('axis zoom/pan and main plot zoom', function() { desc: 'drag ew on x3y', drag: ['x3y', 'ew', 30, 0], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.734, 2.756], {dragged: true}], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.783, 2.748], {dragged: true}], [['yaxis'], yr0, {noChange: true}] ], dblclickSubplot: 'xy' @@ -1037,7 +1037,8 @@ describe('axis zoom/pan and main plot zoom', function() { desc: 'drag e on xy', drag: ['xy', 'e', 30, 30], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [xr0[0], 1.366], {dragged: true}], + // FIXME On CI we need 1.359 but locally it's 1.317 ?? + [['xaxis', 'xaxis2', 'xaxis3'], [xr0[0], 1.359], {dragged: true}], [['yaxis'], yr0, {noChange: true}] ], dblclickSubplot: 'x3y' @@ -1045,7 +1046,8 @@ describe('axis zoom/pan and main plot zoom', function() { desc: 'drag nw on x3y', drag: ['xy', 'nw', 30, 30], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-1.379, 3.245], {dragged: true}], + // FIXME On CI we need -1.425 but locally it's -1.442 ?? + [['xaxis', 'xaxis2', 'xaxis3'], [-1.425, xr0[1]], {dragged: true}], [['yaxis'], [-0.211, 3.565], {dragged: true}] ], dblclickSubplot: 'x3y' @@ -1054,7 +1056,7 @@ describe('axis zoom/pan and main plot zoom', function() { dragmode: 'pan', drag: ['xy', 'nsew', 30, 30], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-1.101, 2.390], {dragged: true}], + [['xaxis', 'xaxis2', 'xaxis3'], [-1.157, 2.374], {dragged: true}], [['yaxis'], [0.109, 3.532], {dragged: true}] ], dblclickSubplot: 'x3y' @@ -1063,7 +1065,7 @@ describe('axis zoom/pan and main plot zoom', function() { dragmode: 'pan', drag: ['x2y', 'nsew', 30, 30], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.816, 2.675], {dragged: true}], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.866, 2.665], {dragged: true}], [['yaxis'], [0.109, 3.532], {dragged: true}] ], dblclickSubplot: 'x2y' @@ -1072,7 +1074,7 @@ describe('axis zoom/pan and main plot zoom', function() { dragmode: 'pan', drag: ['x3y', 'nsew', 30, 30], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.734, 2.756], {dragged: true}], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.783, 2.748], {dragged: true}], [['yaxis'], [0.109, 3.532], {dragged: true}] ], dblclickSubplot: 'xy' @@ -1080,7 +1082,7 @@ describe('axis zoom/pan and main plot zoom', function() { desc: 'scrolling on x3y subplot', scroll: ['x3y', 20], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.613, 3.245], {dragged: true}], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.655, 3.247], {dragged: true}], [['yaxis'], [-0.211, 3.571], {dragged: true}] ], dblclickSubplot: 'xy' @@ -1088,7 +1090,7 @@ describe('axis zoom/pan and main plot zoom', function() { desc: 'scrolling on x2y subplot', scroll: ['x2y', 20], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.613, 3.245], {dragged: true}], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.655, 3.247], {dragged: true}], [['yaxis'], [-0.211, 3.571], {dragged: true}] ], dblclickSubplot: 'xy' @@ -1096,7 +1098,7 @@ describe('axis zoom/pan and main plot zoom', function() { desc: 'scrolling on xy subplot', scroll: ['xy', 20], exp: [ - [['xaxis', 'xaxis2', 'xaxis3'], [-0.613, 3.245], {dragged: true}], + [['xaxis', 'xaxis2', 'xaxis3'], [-0.655, 3.247], {dragged: true}], [['yaxis'], [-0.211, 3.571], {dragged: true}] ], dblclickSubplot: 'x2y' @@ -1150,14 +1152,14 @@ describe('axis zoom/pan and main plot zoom', function() { }; var xr0 = [-0.211, 3.211]; - var yr0 = [-0.077, 3.163]; + var yr0 = [-0.234, 3.244]; var specs = [{ desc: 'pan on xy', drag: ['xy', 'nsew', 30, 30], exp: [ [['xaxis'], [-0.534, 2.888], {dragged: true}], - [['yaxis', 'yaxis2', 'yaxis3'], [0.706, 3.947], {dragged: true}], + [['yaxis', 'yaxis2', 'yaxis3'], [0.607, 4.085], {dragged: true}], ], trans: [-30, -30, -30, -45, -30, -52.5] }, { @@ -1165,7 +1167,7 @@ describe('axis zoom/pan and main plot zoom', function() { drag: ['xy2', 'nsew', 30, 30], exp: [ [['xaxis'], [-0.534, 2.888], {dragged: true}], - [['yaxis', 'yaxis2', 'yaxis3'], [0.444, 3.685], {dragged: true}], + [['yaxis', 'yaxis2', 'yaxis3'], [0.327, 3.805], {dragged: true}], ], trans: [-30, -20, -30, -30, -30, -35] }, { @@ -1173,7 +1175,7 @@ describe('axis zoom/pan and main plot zoom', function() { drag: ['xy3', 'nsew', 30, 30], exp: [ [['xaxis'], [-0.534, 2.888], {dragged: true}], - [['yaxis', 'yaxis2', 'yaxis3'], [0.370, 3.611], {dragged: true}], + [['yaxis', 'yaxis2', 'yaxis3'], [0.247, 3.725], {dragged: true}], ], trans: [-30, -17.142, -30, -25.71, -30, -30] }, { @@ -1181,7 +1183,7 @@ describe('axis zoom/pan and main plot zoom', function() { drag: ['xy2', 'ns', 0, 30], exp: [ [['xaxis'], xr0, {noChange: true}], - [['yaxis', 'yaxis2', 'yaxis3'], [0.444, 3.685], {dragged: true}], + [['yaxis', 'yaxis2', 'yaxis3'], [0.327, 3.805], {dragged: true}], ], trans: [0, -20, 0, -30, 0, -35] }, { @@ -1189,7 +1191,7 @@ describe('axis zoom/pan and main plot zoom', function() { drag: ['xy3', 'n', 0, 30], exp: [ [['xaxis'], xr0, {noChange: true}], - [['yaxis', 'yaxis2', 'yaxis3'], [yr0[0], 3.683], {dragged: true}], + [['yaxis', 'yaxis2', 'yaxis3'], [yr0[0], 3.802], {dragged: true}], ], trans: [0, -19.893, 0, -29.839, 0, -34.812], scale: [1, 1.160, 1, 1.160, 1, 1.160] @@ -1198,7 +1200,7 @@ describe('axis zoom/pan and main plot zoom', function() { drag: ['xy', 's', 0, 30], exp: [ [['xaxis'], xr0, {noChange: true}], - [['yaxis', 'yaxis2', 'yaxis3'], [1.617, yr0[1]], {dragged: true}], + [['yaxis', 'yaxis2', 'yaxis3'], [1.586, yr0[1]], {dragged: true}], ], trans: [0, 0, 0, 0, 0, 0], scale: [1, 0.476, 1, 0.476, 1, 0.476] @@ -1588,6 +1590,130 @@ describe('axis zoom/pan and main plot zoom', function() { .catch(failTest) .then(done); }); + + it('matching and constrained subplots play nice together', function(done) { + var data = [ + {x: [0, 3], y: [0, 3]}, + {x: [0, 3], y: [1, 8], xaxis: 'x2', yaxis: 'y2'} + ]; + + var layout = { + width: 400, height: 350, margin: {l: 50, r: 50, t: 50, b: 50}, + yaxis: {domain: [0, 0.4], scaleanchor: 'x'}, + xaxis2: {anchor: 'y2'}, + yaxis2: {domain: [0.6, 1], matches: 'x2'}, + showlegend: false + }; + var x2y2, mx, my; + + makePlot(data, layout).then(function() { + assertRanges('base', [ + [['xaxis'], [-3.955, 6.955]], + [['yaxis'], [-0.318, 3.318]], + [['xaxis2', 'yaxis2'], [-0.588, 8.824]] + ]); + x2y2 = d3.select('.subplot.x2y2 .plot'); + expect(x2y2.attr('transform')).toBe('translate(50,50)'); + mx = gd._fullLayout.xaxis._m; + my = gd._fullLayout.yaxis._m; + }) + .then(function() { + var drag = makeDragFns('x2y2', 'ns', 30, 30); + return drag.start().then(function() { + assertRanges('during drag', [ + [['xaxis'], [-3.955, 6.955]], + [['yaxis'], [-0.318, 3.318]], + [['xaxis2', 'yaxis2'], [2.236, 11.648], {skipInput: true}] + ]); + // Check that the data container moves as it should with the axes + expect(x2y2.attr('transform')).toBe('translate(-40,80)scale(1,1)'); + }) + .then(drag.end); + }) + .then(_assert('after drag on x2y2 subplot', [ + [['xaxis'], [-3.955, 6.955], {noChange: true}], + [['yaxis'], [-0.318, 3.318], {noChange: true}], + [['xaxis2', 'yaxis2'], [2.236, 11.648], {dragged: true}] + ])) + .then(function() { + // make sure the ranges were correct when xy was redrawn + expect(gd._fullLayout.xaxis._m).toBe(mx); + expect(gd._fullLayout.yaxis._m).toBe(my); + }) + .then(doDblClick('x2y2', 'ew')) + .then(_assert('after double-click on x2', [ + [['xaxis'], [-3.955, 6.955], {noChange: true}], + [['yaxis'], [-0.318, 3.318], {noChange: true}], + [['xaxis2'], [-0.588, 8.824], {autorange: true}], + [['yaxis2'], [-0.588, 8.824], {noEventData: true}] + ])) + .then(function() { + expect(gd._fullLayout.xaxis._m).toBe(mx); + expect(gd._fullLayout.yaxis._m).toBe(my); + }) + .catch(failTest) + .then(done); + }); + + it('handles matching & scaleanchor chained together', function(done) { + var data = [ + {y: [1, 2]}, + {y: [0, 1], xaxis: 'x2', yaxis: 'y2'} + ]; + + var layout = { + width: 350, + height: 300, + margin: {l: 50, r: 50, t: 50, b: 50}, + showlegend: false, + xaxis: {domain: [0, 0.4]}, + yaxis: {domain: [0, 0.5], matches: 'x'}, + xaxis2: {domain: [0.6, 1], scaleanchor: 'x', anchor: 'y2'}, + yaxis2: {domain: [0.5, 1], matches: 'x2', anchor: 'x2'} + }; + + makePlot(data, layout).then(function() { + assertRanges('base', [ + [['xaxis', 'yaxis'], [-0.212, 2.212]], + [['xaxis2', 'yaxis2'], [-0.712, 1.712]] + ]); + }) + .then(function() { + var drag = makeDragFns('xy', 'sw', 30, -30); + return drag.start().then(function() { + assertRanges('during drag sw', [ + [['xaxis', 'yaxis'], [-1.251, 2.212], {skipInput: true}], + [['xaxis2', 'yaxis2'], [-1.232, 2.232], {skipInput: true}] + ]); + }) + .then(drag.end); + }) + .then(_assert('after drag sw on xy subplot', [ + [['xaxis', 'yaxis'], [-1.251, 2.212], {dragged: true}], + [['xaxis2', 'yaxis2'], [-1.232, 2.232], {dragged: true}] + ])) + .then(doDblClick('x2y2', 'nsew')) + .then(_assert('after double-click on x2', [ + [['xaxis', 'yaxis'], [-0.212, 2.212], {autorange: true}], + [['xaxis2', 'yaxis2'], [-0.712, 1.712], {autorange: true}] + ])) + .then(function() { + var drag = makeDragFns('xy', 'nw', 30, 30); + return drag.start().then(function() { + assertRanges('during drag nw', [ + [['xaxis', 'yaxis'], [-0.732, 2.732], {skipInput: true}], + [['xaxis2', 'yaxis2'], [-1.232, 2.232], {skipInput: true}] + ]); + }) + .then(drag.end); + }) + .then(_assert('after drag nw on xy subplot', [ + [['xaxis', 'yaxis'], [-0.732, 2.732], {dragged: true}], + [['xaxis2', 'yaxis2'], [-1.232, 2.232], {dragged: true}] + ])) + .catch(failTest) + .then(done); + }); }); describe('redrag behavior', function() { @@ -2244,3 +2370,201 @@ describe('Event data:', function() { .then(done); }); }); + +describe('Cartesian plots with css transforms', function() { + var gd; + var eventRecordings = {}; + + beforeEach(function() { + eventRecordings = {}; + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + function _getLocalPos(element, point) { + var bb = element.getBoundingClientRect(); + return [ + bb.left + point[0], + bb.top + point[1] + ]; + } + + function transformPlot(gd, transformString) { + gd.style.webkitTransform = transformString; + gd.style.MozTransform = transformString; + gd.style.msTransform = transformString; + gd.style.OTransform = transformString; + gd.style.transform = transformString; + } + + function _drag(start, end) { + var localStart = _getLocalPos(gd, start); + var localEnd = _getLocalPos(gd, end); + Lib.clearThrottle(); + mouseEvent('mousemove', localStart[0], localStart[1]); + mouseEvent('mousedown', localStart[0], localStart[1]); + mouseEvent('mousemove', localEnd[0], localEnd[1]); + } + + function _dragRelease(start, end) { + var localEnd = _getLocalPos(gd, end); + _drag(start, end); + mouseEvent('mouseup', localEnd[0], localEnd[1]); + } + + function _hover(pos) { + return new Promise(function(resolve, reject) { + var localPos = _getLocalPos(gd, pos); + gd.once('plotly_hover', function(d) { + Lib.clearThrottle(); + resolve(d); + }); + + mouseEvent('mousemove', localPos[0], localPos[1]); + + setTimeout(function() { + reject('plotly_hover did not get called!'); + }, 100); + }); + } + + function _unhover(pos) { + var localPos = _getLocalPos(gd, pos); + mouseEvent('mouseout', localPos[0], localPos[1]); + } + + var points = [[50, 180], [150, 180], [250, 180]]; + var xLabels = ['one', 'two', 'three']; + var mock = { + data: [{ + x: xLabels, + y: [1, 2, 3], + type: 'bar' + }], + layout: { + width: 600, + height: 400, + margin: {l: 0, t: 0, r: 0, b: 0} + } + }; + + [{ + transform: 'scaleX(0.5)', + hovered: 1, + selected: {numPoints: 1, selectedLabels: ['two']} + }, { + transform: 'scale(0.5)', + hovered: 1, + selected: {numPoints: 2, selectedLabels: ['one', 'two']} + }, { + transform: 'scale(0.25) translate(150px, 25%) scaleY(2)', + hovered: 1, + selected: {numPoints: 3, selectedLabels: ['one', 'two', 'three']} + }].forEach(function(t) { + var transform = t.transform; + + it('hover behaves correctly after css transform: ' + transform, function(done) { + function _hoverAndAssertEventOccurred(point, label) { + return _hover(point) + .then(function() { + expect(eventRecordings[label]).toBe(t.hovered); + }) + .then(function() { + _unhover(point); + }); + } + + Plotly.newPlot(gd, Lib.extendDeep({}, mock)) + .then(function() { + transformPlot(gd, transform); + + gd.on('plotly_hover', function(d) { + eventRecordings[d.points[0].x] = 1; + }); + }) + .then(function() {_hoverAndAssertEventOccurred(points[0], xLabels[0]);}) + .then(function() {_hoverAndAssertEventOccurred(points[1], xLabels[1]);}) + .then(function() {_hoverAndAssertEventOccurred(points[2], xLabels[2]);}) + .catch(failTest) + .then(done); + }); + + it('drag-zoom behaves correctly after css transform: ' + transform, function(done) { + // return a rect of form {left, top, width, height} from the zoomlayer + // svg path. + function _getZoomlayerPathRect(pathStr) { + var rect = {}; + rect.height = Number(pathStr.split('v')[1].split('h')[0]); + rect.width = Number(pathStr.split('h')[1].split('v')[0]); + var startCoordsString = pathStr.split('M')[2].split('v')[0]; + rect.left = Number(startCoordsString.split(',')[0]); + rect.top = Number(startCoordsString.split(',')[1]); + return rect; + } + + // asserts that the zoombox path must go from the start to end positions, + // in css-transformed coordinates. + function _assertTransformedZoombox(startPos, endPos) { + startPos = Lib.apply3DTransform(gd._fullLayout._invTransform)(startPos[0], startPos[1]); + endPos = Lib.apply3DTransform(gd._fullLayout._invTransform)(endPos[0], endPos[1]); + var size = [endPos[0] - startPos[0], endPos[1] - startPos[1]]; + var zb = d3.select(gd).select('g.zoomlayer > path.zoombox'); + var zoomboxRect = _getZoomlayerPathRect(zb.attr('d')); + expect(zoomboxRect.left).toBeCloseTo(startPos[0], -1); + expect(zoomboxRect.top).toBeCloseTo(startPos[1]); + expect(zoomboxRect.width).toBeCloseTo(size[0]); + expect(zoomboxRect.height).toBeCloseTo(size[1]); + } + + var start = [50, 50]; + var end = [150, 150]; + + Plotly.newPlot(gd, Lib.extendDeep({}, mock)) + .then(function() { + transformPlot(gd, transform); + + _drag(start, end); + }) + .then(function() { + _assertTransformedZoombox(start, end); + }) + .then(function() { mouseEvent('mouseup', 0, 0); }) + .catch(failTest) + .then(done); + }); + + it('select behaves correctly after css transform: ' + transform, function(done) { + function _assertSelected(expectation) { + var data = gd._fullData[0]; + var points = data.selectedpoints; + expect(typeof(points) !== 'undefined').toBeTrue(); + if(expectation.numPoints) { + expect(points.length).toBe(expectation.numPoints); + } + if(expectation.selectedLabels) { + var selectedLabels = points.map(function(i) { return data.x[i]; }); + expect(selectedLabels).toEqual(expectation.selectedLabels); + } + } + + var start = [10, 10]; + var end = [200, 200]; + + Plotly.newPlot(gd, Lib.extendDeep({}, mock)) + .then(function() { + transformPlot(gd, transform); + + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { + _dragRelease(start, end); + }) + .then(function() { + _assertSelected(t.selected); + }) + .catch(failTest) + .then(done); + }); + }); +}); diff --git a/test/jasmine/tests/choropleth_test.js b/test/jasmine/tests/choropleth_test.js index 9aee3409e56..8d263da441e 100644 --- a/test/jasmine/tests/choropleth_test.js +++ b/test/jasmine/tests/choropleth_test.js @@ -156,8 +156,17 @@ describe('Test choropleth hover:', function() { afterEach(destroyGraphDiv); - function run(pos, fig, content, style) { + function transformPlot(gd, transformString) { + gd.style.webkitTransform = transformString; + gd.style.MozTransform = transformString; + gd.style.msTransform = transformString; + gd.style.OTransform = transformString; + gd.style.transform = transformString; + } + + function run(hasCssTransform, pos, fig, content, style) { gd = createGraphDiv(); + var scale = 1; style = style || { bgcolor: 'rgb(68, 68, 68)', @@ -167,8 +176,14 @@ describe('Test choropleth hover:', function() { fontFamily: 'Arial' }; - return Plotly.plot(gd, fig).then(function() { - mouseEvent('mousemove', pos[0], pos[1]); + return Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) { + scale = 0.5; + transformPlot(gd, 'translate(-25%, -25%) scale(0.5)'); + } + + mouseEvent('mousemove', scale * pos[0], scale * pos[1]); assertHoverLabelContent({ nums: content[0], name: content[1] @@ -180,102 +195,123 @@ describe('Test choropleth hover:', function() { }); } - it('should generate hover label info (base)', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); - - run( - [400, 160], - fig, - ['RUS\n10', 'trace 1'] - ) - .then(done); + [false, true].forEach(function(hasCssTransform) { + it('should generate hover label info (base), hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); + + run( + hasCssTransform, + [400, 160], + fig, + ['RUS\n10', 'trace 1'] + ) + .then(done); + }); }); - it('should use the hovertemplate', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); - fig.data[1].hovertemplate = 'tpl %{z}x'; - - run( - [400, 160], - fig, - ['tpl 10', 'x'] - ) - .then(done); + [false, true].forEach(function(hasCssTransform) { + it('should use the hovertemplate, hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); + fig.data[1].hovertemplate = 'tpl %{z}x'; + + run( + hasCssTransform, + [400, 160], + fig, + ['tpl 10', 'x'] + ) + .then(done); + }); }); - it('should generate hover label info (\'text\' single value case)', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); - fig.data[1].text = 'tExT'; - fig.data[1].hoverinfo = 'text'; - - run( - [400, 160], - fig, - ['tExT', null] - ) - .then(done); + [false, true].forEach(function(hasCssTransform) { + it('should generate hover label info (\'text\' single value case), hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); + fig.data[1].text = 'tExT'; + fig.data[1].hoverinfo = 'text'; + + run( + hasCssTransform, + [400, 160], + fig, + ['tExT', null] + ) + .then(done); + }); }); - it('should generate hover label info (\'text\' array case)', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); - fig.data[1].text = ['tExT', 'TeXt', '-text-']; - fig.data[1].hoverinfo = 'text'; - - run( - [400, 160], - fig, - ['-text-', null] - ) - .then(done); + [false, true].forEach(function(hasCssTransform) { + it('should generate hover label info (\'text\' array case), hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); + fig.data[1].text = ['tExT', 'TeXt', '-text-']; + fig.data[1].hoverinfo = 'text'; + + run( + hasCssTransform, + [400, 160], + fig, + ['-text-', null] + ) + .then(done); + }); }); - it('should generate hover labels from `hovertext`', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); - fig.data[1].hovertext = ['tExT', 'TeXt', '-text-']; - fig.data[1].text = ['N', 'O', 'P']; - fig.data[1].hoverinfo = 'text'; - - run( - [400, 160], - fig, - ['-text-', null] - ) - .then(done); + [false, true].forEach(function(hasCssTransform) { + it('should generate hover labels from `hovertext`, hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); + fig.data[1].hovertext = ['tExT', 'TeXt', '-text-']; + fig.data[1].text = ['N', 'O', 'P']; + fig.data[1].hoverinfo = 'text'; + + run( + hasCssTransform, + [400, 160], + fig, + ['-text-', null] + ) + .then(done); + }); }); - it('should generate hover label with custom styling', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); - fig.data[1].hoverlabel = { - bgcolor: 'red', - bordercolor: ['blue', 'black', 'green'], - font: {family: 'Roboto'} - }; + [false, true].forEach(function(hasCssTransform) { + it('should generate hover label with custom styling, hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); + fig.data[1].hoverlabel = { + bgcolor: 'red', + bordercolor: ['blue', 'black', 'green'], + font: {family: 'Roboto'} + }; - run( - [400, 160], - fig, - ['RUS\n10', 'trace 1'], - { - bgcolor: 'rgb(255, 0, 0)', - bordercolor: 'rgb(0, 128, 0)', - fontColor: 'rgb(0, 128, 0)', - fontSize: 13, - fontFamily: 'Roboto' - } - ) - .then(done); + run( + hasCssTransform, + [400, 160], + fig, + ['RUS\n10', 'trace 1'], + { + bgcolor: 'rgb(255, 0, 0)', + bordercolor: 'rgb(0, 128, 0)', + fontColor: 'rgb(0, 128, 0)', + fontSize: 13, + fontFamily: 'Roboto' + } + ) + .then(done); + }); }); - it('should generate hover label with arrayOk \'hoverinfo\' settings', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); - fig.data[1].hoverinfo = ['location', 'z', 'location+name']; - - run( - [400, 160], - fig, - ['RUS', 'trace 1'] - ) - .then(done); + [false, true].forEach(function(hasCssTransform) { + it('should generate hover label with arrayOk \'hoverinfo\' settings, hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/geo_first.json')); + fig.data[1].hoverinfo = ['location', 'z', 'location+name']; + + run( + hasCssTransform, + [400, 160], + fig, + ['RUS', 'trace 1'] + ) + .then(done); + }); }); describe('should preserve z formatting hovetemplate equivalence', function() { @@ -292,24 +328,30 @@ describe('Test choropleth hover:', function() { var pos = [400, 160]; var exp = ['10.02132', 'RUS']; - it('- base case (truncate z decimals)', function(done) { - run(pos, base(), exp).then(done); + [false, true].forEach(function(hasCssTransform) { + it('- base case (truncate z decimals), hasCssTransform: ' + hasCssTransform, function(done) { + run(hasCssTransform, pos, base(), exp).then(done); + }); }); - it('- hovertemplate case (same z truncation)', function(done) { - var fig = base(); - fig.hovertemplate = '%{z}%{location}'; - run(pos, fig, exp).then(done); + [false, true].forEach(function(hasCssTransform) { + it('- hovertemplate case (same z truncation), hasCssTransform: ' + hasCssTransform, function(done) { + var fig = base(); + fig.hovertemplate = '%{z}%{location}'; + run(hasCssTransform, pos, fig, exp).then(done); + }); }); }); - it('should include *properties* from input custom geojson', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/geo_custom-geojson.json')); - fig.data = [fig.data[1]]; - fig.data[0].hovertemplate = '%{properties.name}%{ct[0]:.1f} | %{ct[1]:.1f}'; - fig.layout.geo.projection = {scale: 20}; + [false, true].forEach(function(hasCssTransform) { + it('should include *properties* from input custom geojson, hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/geo_custom-geojson.json')); + fig.data = [fig.data[1]]; + fig.data[0].hovertemplate = '%{properties.name}%{ct[0]:.1f} | %{ct[1]:.1f}'; + fig.layout.geo.projection = {scale: 20}; - run([300, 200], fig, ['New York', '-75.1 | 42.6']).then(done); + run(hasCssTransform, [300, 200], fig, ['New York', '-75.1 | 42.6']).then(done); + }); }); }); diff --git a/test/jasmine/tests/choroplethmapbox_test.js b/test/jasmine/tests/choroplethmapbox_test.js index 1940e983e6f..e01641bd5f1 100644 --- a/test/jasmine/tests/choroplethmapbox_test.js +++ b/test/jasmine/tests/choroplethmapbox_test.js @@ -525,8 +525,20 @@ describe('@noCI Test choroplethmapbox hover:', function() { setTimeout(done, 200); }); - function run(s, done) { + function transformPlot(gd, transformString) { + gd.style.webkitTransform = transformString; + gd.style.MozTransform = transformString; + gd.style.msTransform = transformString; + gd.style.OTransform = transformString; + gd.style.transform = transformString; + } + + function run(hasCssTransform, s, done) { gd = createGraphDiv(); + var scale = 1; + if(hasCssTransform) { + scale = 0.5; + } var fig = Lib.extendDeep({}, s.mock || require('@mocks/mapbox_choropleth0.json') @@ -543,6 +555,8 @@ describe('@noCI Test choroplethmapbox hover:', function() { var pos = s.pos || [270, 220]; return Plotly.plot(gd, fig).then(function() { + if(hasCssTransform) transformPlot(gd, 'translate(-25%, -25%) scale(0.5)'); + var to = setTimeout(function() { failTest('no event data received'); done(); @@ -569,7 +583,7 @@ describe('@noCI Test choroplethmapbox hover:', function() { setTimeout(done, 0); }); - mouseEvent('mousemove', pos[0], pos[1]); + mouseEvent('mousemove', scale * pos[0], scale * pos[1]); }) .catch(failTest); } @@ -631,8 +645,10 @@ describe('@noCI Test choroplethmapbox hover:', function() { }]; specs.forEach(function(s) { - it('@gl should generate correct hover labels ' + s.desc, function(done) { - run(s, done); + [false, true].forEach(function(hasCssTransform) { + it('@gl should generate correct hover labels ' + s.desc + ', hasCssTransform: ' + hasCssTransform, function(done) { + run(hasCssTransform, s, done); + }); }); }); }); diff --git a/test/jasmine/tests/click_test.js b/test/jasmine/tests/click_test.js index 6c87ab00055..500ab236cc1 100644 --- a/test/jasmine/tests/click_test.js +++ b/test/jasmine/tests/click_test.js @@ -1083,7 +1083,7 @@ describe('Test click interactions:', function() { var fns = drag.makeFns({pos0: [start, start], posN: [end, end]}); fns.start().then(function() { - expect(plot.attr('transform')).toBe('translate(250, 280) scale(1, 1)'); + expect(plot.attr('transform')).toBe('translate(250,280)scale(1,1)'); }) .then(fns.end) .catch(failTest) diff --git a/test/jasmine/tests/colorbar_test.js b/test/jasmine/tests/colorbar_test.js index 0405651fad9..e67eb841d21 100644 --- a/test/jasmine/tests/colorbar_test.js +++ b/test/jasmine/tests/colorbar_test.js @@ -338,8 +338,8 @@ describe('Test colorbar:', function() { var yAxes = d3.select(gd).selectAll('.parcoords .y-axis'); expect(yAxes.size()).toBe(2); var transform = yAxes[0][1].getAttribute('transform'); - if(expandedMargin) expect(transform).not.toBe('translate(400, 0)'); - else expect(transform).toBe('translate(400, 0)'); + if(expandedMargin) expect(transform).not.toBe('translate(400,0)'); + else expect(transform).toBe('translate(400,0)'); var cbfills = colorbars.selectAll('.cbfill'); expect(cbfills.size()).toBe(present ? 1 : 0); @@ -524,5 +524,42 @@ describe('Test colorbar:', function() { .catch(failTest) .then(done); }); + + it('creates the same colorbars attributes in newPlot and react', function(done) { + function getCBFillAttributes() { + var attrs = []; + var colorbars = d3.select(gd).selectAll('.colorbar'); + colorbars.selectAll('.cbfill').each(function() { + var attrsForElem = {}; + for(var i = 0; i < this.attributes.length; i++) { + var attr = this.attributes.item(i); + attrsForElem[attr.name] = attr.value; + } + attrs.push(attrsForElem); + }); + return attrs; + } + + var z = [[1, 10], [100, 1000]]; + + var expectedAttrs; + var actualAttrs; + + Plotly.newPlot(gd, [{type: 'contour', z: z}]) + .then(function() { + expectedAttrs = getCBFillAttributes(); + + return Plotly.newPlot(gd, [{type: 'heatmap', z: z}]) + .then(function() { + return Plotly.react(gd, [{type: 'contour', z: z}]); + }); + }) + .then(function() { + actualAttrs = getCBFillAttributes(); + expect(actualAttrs).toEqual(expectedAttrs); + }) + .catch(failTest) + .then(done); + }); }); }); diff --git a/test/jasmine/tests/domain_ref_interact_test.js b/test/jasmine/tests/domain_ref_interact_test.js new file mode 100644 index 00000000000..6d79887ca2d --- /dev/null +++ b/test/jasmine/tests/domain_ref_interact_test.js @@ -0,0 +1,192 @@ +'use strict'; +var failTest = require('../assets/fail_test'); +var domainRefComponents = require('../assets/domain_ref/components'); +var createGraphDiv = require('../assets/create_graph_div'); +var destroyGraphDiv = require('../assets/destroy_graph_div'); +var Plotly = require('../../../lib/index'); +var Lib = require('../../../src/lib'); +var getSVGElemScreenBBox = require( + '../assets/get_svg_elem_screen_bbox'); +var testMock = require('../assets/domain_ref/domain_refs_editable.json'); +var delay = require('../assets/delay'); +var mouseEvent = require('../assets/mouse_event'); +// we have to use drag to move annotations for some reason +var drag = require('../assets/drag'); +// var SVGTools = require('../assets/svg_tools'); + +// color of the rectangles +var rectColor1 = 'rgb(10, 20, 30)'; +var rectColor2 = 'rgb(10, 20, 31)'; +var rectColor3 = 'rgb(100, 200, 232)'; +var rectColor4 = 'rgb(200, 200, 232)'; +var arrowColor1 = 'rgb(231, 200, 100)'; +var arrowColor2 = 'rgb(231, 200, 200)'; + +var DELAY_TIME = 10; + +// function svgRectToJSON(svgrect) { +// return JSON.stringify(SVGTools.svgRectToObj(svgrect)); +// } + +function checkBBox(bboxBefore, bboxAfter, moveX, moveY) { + // We print out the objects for sanity, because sometimes Jasmine says a + // test passed when it actually did nothing! + // console.log('bboxBefore', svgRectToJSON(bboxBefore)); + // console.log('bboxAfter', svgRectToJSON(bboxAfter)); + // console.log('moveX', moveX); + // console.log('moveY', moveY); + expect(bboxAfter.x).toBeCloseTo(bboxBefore.x + moveX, 2); + expect(bboxAfter.y).toBeCloseTo(bboxBefore.y + moveY, 2); +} + +function testObjectMove(objectColor, moveX, moveY, type) { + var bboxBefore = getSVGElemScreenBBox( + domainRefComponents.findAROByColor(objectColor, undefined, type) + ); + var pos = { + mouseStartX: bboxBefore.x + bboxBefore.width * 0.5, + mouseStartY: bboxBefore.y + bboxBefore.height * 0.5, + }; + pos.mouseEndX = pos.mouseStartX + moveX; + pos.mouseEndY = pos.mouseStartY + moveY; + mouseEvent('mousemove', pos.mouseStartX, pos.mouseStartY); + mouseEvent('mousedown', pos.mouseStartX, pos.mouseStartY); + mouseEvent('mousemove', pos.mouseEndX, pos.mouseEndY); + mouseEvent('mouseup', pos.mouseEndX, pos.mouseEndY); + var bboxAfter = getSVGElemScreenBBox( + domainRefComponents.findAROByColor(objectColor, undefined, type) + ); + checkBBox(bboxBefore, bboxAfter, moveX, moveY); +} + +function dragPos0(bbox, corner) { + if(corner === 'bl') { + return [ bbox.x + bbox.width * 0.5, + bbox.y + bbox.height * 0.5 - 10 ]; + } else if(corner === 'tr') { + return [ bbox.x + bbox.width * 0.5, + bbox.y + bbox.height * 0.5 + 10 ]; + } else { + return [ bbox.x + bbox.width * 0.5, + bbox.y + bbox.height * 0.5]; + } +} + +// Tests moving the annotation label +function testAnnotationMoveLabel(objectColor, moveX, moveY) { + var bboxAfter; + // Get where the text box (label) is before dragging it + var bboxBefore = getSVGElemScreenBBox( + domainRefComponents.findAROByColor(objectColor, undefined, 'rect') + ); + // we have to use drag to move annotations for some reason + var optLabelDrag = { + pos0: dragPos0(bboxBefore) + }; + optLabelDrag.dpos = [moveX, moveY]; + // console.log('optLabelDrag', optLabelDrag); + // drag the label, this will make the arrow rotate around the arrowhead + return (new Promise(function(resolve) { + drag(optLabelDrag); resolve(); + })) + .then(delay(DELAY_TIME)) + .then(function() { + // then check it's position + bboxAfter = getSVGElemScreenBBox( + domainRefComponents.findAROByColor(objectColor, undefined, 'rect') + ); + checkBBox(bboxBefore, bboxAfter, moveX, moveY); + }) + .then(delay(DELAY_TIME)); +} + +// Tests moving the whole annotation +function testAnnotationMoveWhole(objectColor, arrowColor, moveX, moveY, corner) { + var bboxAfter; + var arrowBBoxAfter; + // Get where the text box (label) is before dragging it + var bboxBefore = getSVGElemScreenBBox( + domainRefComponents.findAROByColor(objectColor, undefined, 'rect') + ); + var arrowBBoxBefore = getSVGElemScreenBBox( + domainRefComponents.findAROByColor(arrowColor, undefined, 'path', 'fill') + ); + var optArrowDrag = { + pos0: dragPos0(arrowBBoxBefore, corner) + }; + optArrowDrag.dpos = [moveX, moveY]; + // console.log('optArrowDrag', optArrowDrag); + // drag the whole annotation + (new Promise(function(resolve) { + drag(optArrowDrag); resolve(); + })) + .then(delay(DELAY_TIME)) + .then(function() { + // check the new position of the arrow and label + arrowBBoxAfter = getSVGElemScreenBBox( + domainRefComponents.findAROByColor(arrowColor, undefined, 'path', 'fill') + ); + bboxAfter = getSVGElemScreenBBox( + domainRefComponents.findAROByColor(objectColor, undefined, 'rect') + ); + checkBBox(arrowBBoxBefore, arrowBBoxAfter, moveX, moveY); + checkBBox(bboxBefore, bboxAfter, moveX, moveY); + }) + .then(delay(DELAY_TIME)); +} + +describe('Shapes referencing domain', function() { + var gd; + beforeEach(function() { + gd = createGraphDiv(); + }); + afterEach(function() { + Plotly.purge(gd); + destroyGraphDiv(gd); + gd = null; + }); + function testObjectMoveItFun(color, x, y, type) { + return function(done) { + Plotly.newPlot(gd, Lib.extendDeep({}, testMock)) + .then(delay(DELAY_TIME)) + .then(function() { + testObjectMove(color, x, y, type); + }) + .then(delay(DELAY_TIME)) + .catch(failTest) + .then(done); + }; + } + function testAnnotationMoveLabelItFun(color, x, y) { + return function(done) { + Plotly.newPlot(gd, Lib.extendDeep({}, testMock)) + .then(delay(DELAY_TIME)) + .then(testAnnotationMoveLabel(color, x, y)) + .then(delay(DELAY_TIME)) + .catch(failTest) + .then(done); + }; + } + function testAnnotationMoveWholeItFun(color, arrowColor, x, y, corner) { + return function(done) { + Plotly.newPlot(gd, Lib.extendDeep({}, testMock)) + .then(delay(DELAY_TIME)) + .then(testAnnotationMoveWhole(color, arrowColor, x, y, corner)) + .then(delay(DELAY_TIME)) + .catch(failTest) + .then(done); + }; + } + it('should move box on linear x axis and log y to the proper position', + testObjectMoveItFun(rectColor1, 100, -300, 'path')); + it('should move box on log x axis and linear y to the proper position', + testObjectMoveItFun(rectColor2, -400, -200, 'path')); + it('should move annotation label on linear x axis and log y to the proper position', + testAnnotationMoveLabelItFun(rectColor3, 50, -100, 'rect')); + it('should move annotation label on log x axis and linear y to the proper position', + testAnnotationMoveLabelItFun(rectColor4, -75, -150, 'rect')); + it('should move whole annotation on linear x axis and log y to the proper position', + testAnnotationMoveWholeItFun(rectColor3, arrowColor1, 50, -100, 'bl')); + it('should move whole annotation on log x axis and linear y to the proper position', + testAnnotationMoveWholeItFun(rectColor4, arrowColor2, -75, -150, 'tr')); +}); diff --git a/test/jasmine/tests/domain_ref_test.js b/test/jasmine/tests/domain_ref_test.js new file mode 100644 index 00000000000..79ab84b101e --- /dev/null +++ b/test/jasmine/tests/domain_ref_test.js @@ -0,0 +1,48 @@ +'use strict'; +var failTest = require('../assets/fail_test'); +var domainRefComponents = require('../assets/domain_ref/components'); +var createGraphDiv = require('../assets/create_graph_div'); +var destroyGraphDiv = require('../assets/destroy_graph_div'); +var Plotly = require('../../../lib/index'); +// optionally specify a test number to run just a single test +var testNumber; + +function makeTests(component, filter) { + return function() { + filter = filter === undefined ? function() { + return true; + } : filter; + var descriptions = component.descriptions().filter(filter); + var tests = component.tests().filter(filter); + var gd; + beforeEach(function() { + gd = createGraphDiv(); + }); + afterEach(function() { + Plotly.purge(gd); + destroyGraphDiv(gd); + gd = null; + }); + descriptions.forEach(function(d, i) { + it(d, function(done) { + // console.log('testing ' + d); + gd.id = 'graph-' + i; + tests[i](function(v) { + expect(v).toBe(true); + }, gd) + .catch(failTest) + .then(done); + }); + }); + }; +} + +['annotations', 'images', 'shapes'].forEach(function(componentName) { + describe('Test ' + componentName, makeTests(domainRefComponents[componentName], + function(f, i) { + if(testNumber === undefined) { + return true; + } + return i === testNumber; + })); +}); diff --git a/test/jasmine/tests/download_test.js b/test/jasmine/tests/download_test.js index 6b7473419df..2c483c9e5f0 100644 --- a/test/jasmine/tests/download_test.js +++ b/test/jasmine/tests/download_test.js @@ -2,6 +2,7 @@ var Plotly = require('@lib/index'); var Lib = require('@src/lib'); var helpers = require('@src/snapshot/helpers'); +var getImageSize = require('@src/traces/image/helpers').getImageSize; var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); @@ -164,6 +165,33 @@ describe('Plotly.downloadImage', function() { .catch(failTest) .then(done); }); + + it('should default width & height for downloadImage to match with the live graph', function(done) { + spyOn(Lib, 'isSafari').and.callFake(function() { return true; }); + spyOn(helpers, 'octetStream'); + + var fig = { + data: [{y: [0, 1]}] + }; + + gd.style.width = '500px'; + gd.style.height = '300px'; + + Plotly.plot(gd, fig) + .then(function() { return Plotly.downloadImage(gd, {format: 'png'}); }) + .then(function() { + var args = helpers.octetStream.calls.allArgs(); + var blob = args[0][0]; + expect(blob.slice(0, 8)).toBe(';base64,', 'format:png'); + var size = getImageSize('data:image/png' + blob); + expect(size.width).toBe(gd._fullLayout.width, 'fullLayout width'); + expect(size.height).toBe(gd._fullLayout.height, 'fullLayout height'); + expect(size.width).toBe(500, 'div width'); + expect(size.height).toBe(300, 'div height'); + }) + .catch(failTest) + .then(done); + }); }); function downloadTest(gd, format) { diff --git a/test/jasmine/tests/drawing_test.js b/test/jasmine/tests/drawing_test.js index 556a30c5762..b5c3c0100ec 100644 --- a/test/jasmine/tests/drawing_test.js +++ b/test/jasmine/tests/drawing_test.js @@ -79,19 +79,19 @@ describe('Drawing', function() { expect(Drawing.getTranslate(el)).toEqual({ x: 0, y: 0 }); - el.setAttribute('transform', 'translate(123.45px, 67)'); + el.setAttribute('transform', 'translate(123.45px,67)'); expect(Drawing.getTranslate(el)).toEqual({ x: 123.45, y: 67 }); el.setAttribute('transform', 'translate(123.45)'); expect(Drawing.getTranslate(el)).toEqual({ x: 123.45, y: 0 }); - el.setAttribute('transform', 'translate(1 2)'); + el.setAttribute('transform', 'translate(1,2)'); expect(Drawing.getTranslate(el)).toEqual({ x: 1, y: 2 }); - el.setAttribute('transform', 'translate(1 2); rotate(20deg)'); + el.setAttribute('transform', 'translate(1,2); rotate(20deg)'); expect(Drawing.getTranslate(el)).toEqual({ x: 1, y: 2 }); - el.setAttribute('transform', 'rotate(20deg) translate(1 2);'); + el.setAttribute('transform', 'rotate(20deg)translate(1,2);'); expect(Drawing.getTranslate(el)).toEqual({ x: 1, y: 2 }); el.setAttribute('transform', 'rotate(20deg)'); @@ -101,16 +101,16 @@ describe('Drawing', function() { it('should work with d3 elements', function() { var el = d3.select(document.createElement('div')); - el.attr('transform', 'translate(123.45px, 67)'); + el.attr('transform', 'translate(123.45px,67)'); expect(Drawing.getTranslate(el)).toEqual({ x: 123.45, y: 67 }); el.attr('transform', 'translate(123.45)'); expect(Drawing.getTranslate(el)).toEqual({ x: 123.45, y: 0 }); - el.attr('transform', 'translate(1 2)'); + el.attr('transform', 'translate(1,2)'); expect(Drawing.getTranslate(el)).toEqual({ x: 1, y: 2 }); - el.attr('transform', 'translate(1 2); rotate(20)'); + el.attr('transform', 'translate(1,2); rotate(20)'); expect(Drawing.getTranslate(el)).toEqual({ x: 1, y: 2 }); el.attr('transform', 'rotate(20)'); @@ -124,19 +124,19 @@ describe('Drawing', function() { expect(Drawing.getTranslate(el)).toEqual({ x: 0, y: 0 }); var testCases = [ - { transform: 'translate(-123.45px, -67)', x: -123.45, y: -67 }, - { transform: 'translate(-123.45px, 67)', x: -123.45, y: 67 }, - { transform: 'translate(123.45px, -67)', x: 123.45, y: -67 }, + { transform: 'translate(-123.45px,-67)', x: -123.45, y: -67 }, + { transform: 'translate(-123.45px,67)', x: -123.45, y: 67 }, + { transform: 'translate(123.45px,-67)', x: 123.45, y: -67 }, { transform: 'translate(-123.45)', x: -123.45, y: 0 }, - { transform: 'translate(-1 -2)', x: -1, y: -2 }, - { transform: 'translate(-1 2)', x: -1, y: 2 }, - { transform: 'translate(1 -2)', x: 1, y: -2 }, - { transform: 'translate(-1 -2); rotate(20deg)', x: -1, y: -2 }, - { transform: 'translate(-1 2); rotate(20deg)', x: -1, y: 2 }, - { transform: 'translate(1 -2); rotate(20deg)', x: 1, y: -2 }, - { transform: 'rotate(20deg) translate(-1 -2);', x: -1, y: -2 }, - { transform: 'rotate(20deg) translate(-1 2);', x: -1, y: 2 }, - { transform: 'rotate(20deg) translate(1 -2);', x: 1, y: -2 } + { transform: 'translate(-1,-2)', x: -1, y: -2 }, + { transform: 'translate(-1,2)', x: -1, y: 2 }, + { transform: 'translate(1,-2)', x: 1, y: -2 }, + { transform: 'translate(-1,-2); rotate(20deg)', x: -1, y: -2 }, + { transform: 'translate(-1,2); rotate(20deg)', x: -1, y: 2 }, + { transform: 'translate(1,-2); rotate(20deg)', x: 1, y: -2 }, + { transform: 'rotate(20deg)translate(-1,-2);', x: -1, y: -2 }, + { transform: 'rotate(20deg)translate(-1,2);', x: -1, y: 2 }, + { transform: 'rotate(20deg)translate(1,-2);', x: 1, y: -2 } ]; for(var i = 0; i < testCases.length; i++) { @@ -159,34 +159,34 @@ describe('Drawing', function() { var el = document.createElement('div'); Drawing.setTranslate(el, 5); - expect(el.getAttribute('transform')).toBe('translate(5, 0)'); + expect(el.getAttribute('transform')).toBe('translate(5,0)'); Drawing.setTranslate(el, 10, 20); - expect(el.getAttribute('transform')).toBe('translate(10, 20)'); + expect(el.getAttribute('transform')).toBe('translate(10,20)'); Drawing.setTranslate(el); - expect(el.getAttribute('transform')).toBe('translate(0, 0)'); + expect(el.getAttribute('transform')).toBe(''); - el.setAttribute('transform', 'translate(0, 0); rotate(30)'); + el.setAttribute('transform', 'rotate(30)'); Drawing.setTranslate(el, 30, 40); - expect(el.getAttribute('transform')).toBe('rotate(30) translate(30, 40)'); + expect(el.getAttribute('transform')).toBe('rotate(30)translate(30,40)'); }); it('should work with d3 elements', function() { var el = d3.select(document.createElement('div')); Drawing.setTranslate(el, 5); - expect(el.attr('transform')).toBe('translate(5, 0)'); + expect(el.attr('transform')).toBe('translate(5,0)'); Drawing.setTranslate(el, 30, 40); - expect(el.attr('transform')).toBe('translate(30, 40)'); + expect(el.attr('transform')).toBe('translate(30,40)'); Drawing.setTranslate(el); - expect(el.attr('transform')).toBe('translate(0, 0)'); + expect(el.attr('transform')).toBe(''); - el.attr('transform', 'translate(0, 0); rotate(30)'); + el.attr('transform', 'rotate(30)'); Drawing.setTranslate(el, 30, 40); - expect(el.attr('transform')).toBe('rotate(30) translate(30, 40)'); + expect(el.attr('transform')).toBe('rotate(30)translate(30,40)'); }); }); @@ -202,13 +202,13 @@ describe('Drawing', function() { el.setAttribute('transform', 'scale(123.45)'); expect(Drawing.getScale(el)).toEqual({ x: 123.45, y: 1 }); - el.setAttribute('transform', 'scale(0.1 2)'); + el.setAttribute('transform', 'scale(0.1,2)'); expect(Drawing.getScale(el)).toEqual({ x: 0.1, y: 2 }); - el.setAttribute('transform', 'scale(0.1 2); rotate(20deg)'); + el.setAttribute('transform', 'scale(0.1,2); rotate(20deg)'); expect(Drawing.getScale(el)).toEqual({ x: 0.1, y: 2 }); - el.setAttribute('transform', 'rotate(20deg) scale(0.1 2);'); + el.setAttribute('transform', 'rotate(20deg)scale(0.1,2);'); expect(Drawing.getScale(el)).toEqual({ x: 0.1, y: 2 }); el.setAttribute('transform', 'rotate(20deg)'); @@ -218,16 +218,16 @@ describe('Drawing', function() { it('should work with d3 elements', function() { var el = d3.select(document.createElement('div')); - el.attr('transform', 'scale(1.23, 45)'); + el.attr('transform', 'scale(1.23,45)'); expect(Drawing.getScale(el)).toEqual({ x: 1.23, y: 45 }); el.attr('transform', 'scale(123.45)'); expect(Drawing.getScale(el)).toEqual({ x: 123.45, y: 1 }); - el.attr('transform', 'scale(0.1 2)'); + el.attr('transform', 'scale(0.1,2)'); expect(Drawing.getScale(el)).toEqual({ x: 0.1, y: 2 }); - el.attr('transform', 'scale(0.1 2); rotate(20)'); + el.attr('transform', 'scale(0.1,2); rotate(20)'); expect(Drawing.getScale(el)).toEqual({ x: 0.1, y: 2 }); el.attr('transform', 'rotate(20)'); @@ -240,34 +240,34 @@ describe('Drawing', function() { var el = document.createElement('div'); Drawing.setScale(el, 5); - expect(el.getAttribute('transform')).toBe('scale(5, 1)'); + expect(el.getAttribute('transform')).toBe('scale(5,1)'); Drawing.setScale(el, 30, 40); - expect(el.getAttribute('transform')).toBe('scale(30, 40)'); + expect(el.getAttribute('transform')).toBe('scale(30,40)'); Drawing.setScale(el); - expect(el.getAttribute('transform')).toBe('scale(1, 1)'); + expect(el.getAttribute('transform')).toBe('scale(1,1)'); - el.setAttribute('transform', 'scale(1, 1); rotate(30)'); + el.setAttribute('transform', 'scale(1,1); rotate(30)'); Drawing.setScale(el, 30, 40); - expect(el.getAttribute('transform')).toBe('rotate(30) scale(30, 40)'); + expect(el.getAttribute('transform')).toBe('rotate(30)scale(30,40)'); }); it('should work with d3 elements', function() { var el = d3.select(document.createElement('div')); Drawing.setScale(el, 5); - expect(el.attr('transform')).toBe('scale(5, 1)'); + expect(el.attr('transform')).toBe('scale(5,1)'); Drawing.setScale(el, 30, 40); - expect(el.attr('transform')).toBe('scale(30, 40)'); + expect(el.attr('transform')).toBe('scale(30,40)'); Drawing.setScale(el); - expect(el.attr('transform')).toBe('scale(1, 1)'); + expect(el.attr('transform')).toBe('scale(1,1)'); - el.attr('transform', 'scale(0, 0); rotate(30)'); + el.attr('transform', 'scale(0,0); rotate(30)'); Drawing.setScale(el, 30, 40); - expect(el.attr('transform')).toBe('rotate(30) scale(30, 40)'); + expect(el.attr('transform')).toBe('rotate(30)scale(30,40)'); }); }); @@ -287,23 +287,23 @@ describe('Drawing', function() { it('appends the scale of a point', function() { el.setAttribute('transform', 'translate(1,2)'); Drawing.setPointGroupScale(sel, 2, 2); - expect(el.getAttribute('transform')).toBe('translate(1,2) scale(2,2)'); + expect(el.getAttribute('transform')).toBe('translate(1,2)scale(2,2)'); }); it('modifies the scale of a point', function() { - el.setAttribute('transform', 'translate(1,2) scale(3,4)'); + el.setAttribute('transform', 'translate(1,2)scale(3,4)'); Drawing.setPointGroupScale(sel, 2, 2); - expect(el.getAttribute('transform')).toBe('translate(1,2) scale(2,2)'); + expect(el.getAttribute('transform')).toBe('translate(1,2)scale(2,2)'); }); - it('does not apply the scale of a point if scale (1, 1)', function() { + it('does not apply the scale of a point if scale (1,1)', function() { el.setAttribute('transform', 'translate(1,2)'); Drawing.setPointGroupScale(sel, 1, 1); expect(el.getAttribute('transform')).toBe('translate(1,2)'); }); - it('removes the scale of a point if scale (1, 1)', function() { - el.setAttribute('transform', 'translate(1,2) scale(3,4)'); + it('removes the scale of a point if scale (1,1)', function() { + el.setAttribute('transform', 'translate(1,2)scale(3,4)'); Drawing.setPointGroupScale(sel, 1, 1); expect(el.getAttribute('transform')).toBe('translate(1,2)'); }); @@ -320,7 +320,7 @@ describe('Drawing', function() { it('sets the transform on an empty element', function() { Drawing.setTextPointsScale(g, 2, 3); - expect(g.attr('transform')).toEqual('translate(0,0) scale(2,3) translate(0,0)'); + expect(g.attr('transform')).toEqual('scale(2,3)'); }); it('unsets the transform', function() { @@ -330,16 +330,16 @@ describe('Drawing', function() { it('preserves a leading translate', function() { Drawing.setTextPointsScale(g, 1, 1); - g.attr('transform', 'translate(1, 2)'); - expect(g.attr('transform')).toEqual('translate(1, 2)'); + g.attr('transform', 'translate(1,2)'); + expect(g.attr('transform')).toEqual('translate(1,2)'); }); it('preserves transforms', function() { text.attr('x', 8); text.attr('y', 9); - g.attr('transform', 'translate(1, 2)'); + g.attr('transform', 'translate(1,2)'); Drawing.setTextPointsScale(g, 4, 5); - expect(g.attr('transform')).toEqual('translate(8,9) scale(4,5) translate(-8,-9) translate(1, 2)'); + expect(g.attr('transform')).toEqual('translate(8,9)scale(4,5)translate(-8,-9)translate(1,2)'); }); it('should not break when is not present', function() { diff --git a/test/jasmine/tests/gl2d_click_test.js b/test/jasmine/tests/gl2d_click_test.js index 20d3fa33b75..f5eb64812ab 100644 --- a/test/jasmine/tests/gl2d_click_test.js +++ b/test/jasmine/tests/gl2d_click_test.js @@ -23,6 +23,7 @@ Plotly.register([ require('@lib/contourgl') ]); +var mock0 = require('@mocks/gl2d_scatter-continuous-clustering.json'); var mock1 = require('@mocks/gl2d_14.json'); var mock2 = require('@mocks/gl2d_pointcloud-basic.json'); @@ -445,6 +446,31 @@ describe('Test hover and click interactions', function() { .then(done); }); + it('@gl scatter3d should propagate marker colors to hover labels', function(done) { + var _mock = Lib.extendDeep({}, mock0); + _mock.layout.width = 800; + _mock.layout.height = 600; + + var run = makeRunner([700, 300], { + x: 15075859, + y: 79183, + curveNumber: 0, + pointNumber: 0, + bgcolor: 'rgb(202, 178, 214)', + bordercolor: 'rgb(68, 68, 68)', + fontSize: 13, + fontFamily: 'Arial', + fontColor: 'rgb(68, 68, 68)' + }, { + msg: 'pointcloud' + }); + + Plotly.newPlot(gd, _mock) + .then(run) + .catch(failTest) + .then(done); + }); + it('@gl should output correct event data for heatmapgl', function(done) { var _mock = Lib.extendDeep({}, mock3); _mock.data[0].type = 'heatmapgl'; @@ -629,3 +655,41 @@ describe('Test hover and click interactions', function() { .then(done); }); }); + +describe('hover with (x|y)period positioning', function() { + 'use strict'; + + var gd; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + function _hover(x, y) { + delete gd._hoverdata; + Lib.clearThrottle(); + mouseEvent('mousemove', x, y); + } + + it('@gl shows hover info for scattergl', function(done) { + Plotly.newPlot(gd, require('@mocks/gl2d_period_positioning.json')) + .then(function() { _hover(100, 255); }) + .then(function() { + assertHoverLabelContent({ + name: '', + nums: '(Jan 2001, Jan 1, 1970)' + }); + }) + .then(function() { _hover(470, 45); }) + .then(function() { + assertHoverLabelContent({ + name: '', + nums: '(Jan 2006, Jun 1, 1970)' + }); + }) + .catch(failTest) + .then(done); + }); +}); diff --git a/test/jasmine/tests/gl2d_plot_interact_test.js b/test/jasmine/tests/gl2d_plot_interact_test.js index 60eca4fdfe4..945345b51d0 100644 --- a/test/jasmine/tests/gl2d_plot_interact_test.js +++ b/test/jasmine/tests/gl2d_plot_interact_test.js @@ -21,7 +21,7 @@ describe('Test removal of gl contexts', function() { var gd; beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; gd = createGraphDiv(); }); @@ -94,7 +94,7 @@ describe('Test gl plot side effects', function() { var gd; beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; gd = createGraphDiv(); }); @@ -389,7 +389,7 @@ describe('Test gl2d plot interactions:', function() { var mock = require('@mocks/gl2d_10.json'); beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; gd = createGraphDiv(); }); diff --git a/test/jasmine/tests/gl3d_hover_click_test.js b/test/jasmine/tests/gl3d_hover_click_test.js index 57f74f1b03f..7cfcb7b645a 100644 --- a/test/jasmine/tests/gl3d_hover_click_test.js +++ b/test/jasmine/tests/gl3d_hover_click_test.js @@ -35,7 +35,7 @@ describe('Test gl3d trace click/hover:', function() { beforeEach(function() { gd = createGraphDiv(); ptData = {}; - jasmine.DEFAULT_TIMEOUT_INTERVAL = 6000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 12000; }); afterEach(function() { @@ -68,7 +68,7 @@ describe('Test gl3d trace click/hover:', function() { expect(ptData.pointNumber).toEqual(pointNumber, 'pointNumber'); Object.keys(extra || {}).forEach(function(k) { - expect(ptData[k]).toBe(extra[k], k + ' val'); + expect(ptData[k]).toEqual(extra[k], k + ' val'); }); } @@ -929,4 +929,355 @@ describe('Test gl3d trace click/hover:', function() { .catch(failTest) .then(done); }); + + describe('propagate colors to hover labels', function() { + ['marker', 'line'].forEach(function(t) { + it('@gl scatter3d ' + t + ' colors', function(done) { + var orange = new Uint8Array(3); + orange[0] = 255; + orange[1] = 127; + orange[2] = 0; + + var color = [ + 'red', + [0, 255, 0], + 'rgba(0,0,255,0.5)', + orange, + 'yellow', + // left undefined + ]; + + var _mock = { + data: [{ + type: 'scatter3d', + x: [-1, -2, -3, -4, -5, -6], + y: [1, 2, 3, 4, 5, 6], + z: [0, 0, 0, 0, 0, 0] + }], + layout: { + margin: { t: 50, b: 50, l: 50, r: 50 }, + width: 600, + height: 400, + scene: { aspectratio: { x: 2, y: 2, z: 0.5} } + } + }; + + if(t === 'marker') { + _mock.data[0].mode = 'markers'; + _mock.data[0].marker = { + color: color, + size: 20 + }; + } else { + _mock.data[0].mode = 'lines'; + _mock.data[0].line = { + color: color, + width: 40 + }; + } + + Plotly.newPlot(gd, _mock) + .then(delay(100)) + .then(function() { + gd.on('plotly_hover', function(eventData) { + ptData = eventData.points[0]; + }); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 80, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −1', 'y: 1', 'z: 0'); + assertEventData(-1, 1, 0, 0, 0, t === 'marker' ? { + 'marker.color': 'red' + } : { + 'line.color': 'red' + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(255, 0, 0)', + bordercolor: 'rgb(255, 255, 255)', + fontColor: 'rgb(255, 255, 255)', + fontSize: 13, + fontFamily: 'Arial' + }, 'red'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 169, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −2', 'y: 2', 'z: 0'); + assertEventData(-2, 2, 0, 0, 1, t === 'marker' ? { + 'marker.color': [0, 255, 0] + } : { + 'line.color': [0, 255, 0] + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(0, 255, 0)', + bordercolor: 'rgb(68, 68, 68)', + fontColor: 'rgb(68, 68, 68)', + fontSize: 13, + fontFamily: 'Arial' + }, 'green'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 258, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −3', 'y: 3', 'z: 0'); + assertEventData(-3, 3, 0, 0, 2, t === 'marker' ? { + 'marker.color': 'rgba(0,0,255,0.5)' + } : { + 'line.color': 'rgba(0,0,255,0.5)' + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(0, 0, 255)', + bordercolor: 'rgb(255, 255, 255)', + fontColor: 'rgb(255, 255, 255)', + fontSize: 13, + fontFamily: 'Arial' + }, 'blue'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 347, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −4', 'y: 4', 'z: 0'); + assertEventData(-4, 4, 0, 0, 3, t === 'marker' ? { + 'marker.color': orange + } : { + 'line.color': orange + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(255, 127, 0)', + bordercolor: 'rgb(68, 68, 68)', + fontColor: 'rgb(68, 68, 68)', + fontSize: 13, + fontFamily: 'Arial' + }, 'orange'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 436, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −5', 'y: 5', 'z: 0'); + assertEventData(-5, 5, 0, 0, 4, t === 'marker' ? { + 'marker.color': 'yellow' + } : { + 'line.color': 'yellow' + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(255, 255, 0)', + bordercolor: 'rgb(68, 68, 68)', + fontColor: 'rgb(68, 68, 68)', + fontSize: 13, + fontFamily: 'Arial' + }, 'yellow'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 525, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −6', 'y: 6', 'z: 0'); + assertEventData(-6, 6, 0, 0, 5, t === 'marker' ? { + 'marker.color': undefined + } : { + 'line.color': undefined + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(68, 68, 68)', + bordercolor: 'rgb(255, 255, 255)', + fontColor: 'rgb(255, 255, 255)', + fontSize: 13, + fontFamily: 'Arial' + }, 'undefined'); + }) + .catch(failTest) + .then(done); + }); + + it('@gl scatter3d ' + t + ' colorscale', function(done) { + var color = [ + 2, + 1, + 0, + -1, + -2, + // left undefined + ]; + + var _mock = { + data: [{ + type: 'scatter3d', + x: [-1, -2, -3, -4, -5, -6], + y: [1, 2, 3, 4, 5, 6], + z: [0, 0, 0, 0, 0, 0] + }], + layout: { + margin: { t: 50, b: 50, l: 50, r: 50 }, + width: 600, + height: 400, + scene: { aspectratio: { x: 2, y: 2, z: 0.5} } + } + }; + + if(t === 'marker') { + _mock.data[0].mode = 'markers'; + _mock.data[0].marker = { + colorscale: 'Portland', + color: color, + size: 20 + }; + } else { + _mock.data[0].mode = 'lines'; + _mock.data[0].line = { + colorscale: 'Portland', + color: color, + width: 40 + }; + } + + Plotly.newPlot(gd, _mock) + .then(delay(100)) + .then(function() { + gd.on('plotly_hover', function(eventData) { + ptData = eventData.points[0]; + }); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 80, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −1', 'y: 1', 'z: 0'); + assertEventData(-1, 1, 0, 0, 0, t === 'marker' ? { + 'marker.color': 2 + } : { + 'line.color': 2 + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(217, 30, 30)', + bordercolor: 'rgb(255, 255, 255)', + fontColor: 'rgb(255, 255, 255)', + fontSize: 13, + fontFamily: 'Arial' + }, '1st point'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 169, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −2', 'y: 2', 'z: 0'); + assertEventData(-2, 2, 0, 0, 1, t === 'marker' ? { + 'marker.color': 1 + } : { + 'line.color': 1 + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(242, 143, 56)', + bordercolor: 'rgb(68, 68, 68)', + fontColor: 'rgb(68, 68, 68)', + fontSize: 13, + fontFamily: 'Arial' + }, '2nd point'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 258, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −3', 'y: 3', 'z: 0'); + assertEventData(-3, 3, 0, 0, 2, t === 'marker' ? { + 'marker.color': 0 + } : { + 'line.color': 0 + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(242, 211, 56)', + bordercolor: 'rgb(68, 68, 68)', + fontColor: 'rgb(68, 68, 68)', + fontSize: 13, + fontFamily: 'Arial' + }, '3rd point'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 347, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −4', 'y: 4', 'z: 0'); + assertEventData(-4, 4, 0, 0, 3, t === 'marker' ? { + 'marker.color': -1 + } : { + 'line.color': -1 + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(10, 136, 186)', + bordercolor: 'rgb(255, 255, 255)', + fontColor: 'rgb(255, 255, 255)', + fontSize: 13, + fontFamily: 'Arial' + }, '4th point'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 436, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −5', 'y: 5', 'z: 0'); + assertEventData(-5, 5, 0, 0, 4, t === 'marker' ? { + 'marker.color': -2 + } : { + 'line.color': -2 + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(12, 51, 131)', + bordercolor: 'rgb(255, 255, 255)', + fontColor: 'rgb(255, 255, 255)', + fontSize: 13, + fontFamily: 'Arial' + }, '5th point'); + }) + .then(delay(100)) + .then(function() { + mouseEvent('mouseover', 525, 200); + }) + .then(delay(100)) + .then(function() { + assertHoverText('x: −6', 'y: 6', 'z: 0'); + assertEventData(-6, 6, 0, 0, 5, t === 'marker' ? { + 'marker.color': undefined + } : { + 'line.color': undefined + }); + assertHoverLabelStyle(d3.selectAll('g.hovertext'), { + bgcolor: 'rgb(68, 68, 68)', + bordercolor: 'rgb(255, 255, 255)', + fontColor: 'rgb(255, 255, 255)', + fontSize: 13, + fontFamily: 'Arial' + }, '6th point'); + }) + .catch(failTest) + .then(done); + }); + }); + }); }); diff --git a/test/jasmine/tests/gl3d_plot_interact_test.js b/test/jasmine/tests/gl3d_plot_interact_test.js index b77003fb8d1..92ef3de8003 100644 --- a/test/jasmine/tests/gl3d_plot_interact_test.js +++ b/test/jasmine/tests/gl3d_plot_interact_test.js @@ -19,7 +19,7 @@ describe('Test gl3d before/after plot', function() { var mock = require('@mocks/gl3d_marker-arrays.json'); beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 4000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 8000; }); afterEach(function() { @@ -144,7 +144,7 @@ describe('Test gl3d plots', function() { beforeEach(function() { gd = createGraphDiv(); - jasmine.DEFAULT_TIMEOUT_INTERVAL = 6000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 12000; }); afterEach(function() { @@ -918,7 +918,7 @@ describe('Test gl3d drag and wheel interactions', function() { beforeEach(function() { gd = createGraphDiv(); - jasmine.DEFAULT_TIMEOUT_INTERVAL = 3000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 6000; }); afterEach(function() { @@ -941,15 +941,15 @@ describe('Test gl3d drag and wheel interactions', function() { var sceneTarget; var relayoutCallback = jasmine.createSpy('relayoutCallback'); - function assertEvent(e) { - expect(e.defaultPrevented).toEqual(true); + function assertEvent(e, passive) { + expect(e.defaultPrevented).not.toEqual(passive); relayoutCallback(); } - gd.addEventListener('touchend', assertEvent); - gd.addEventListener('touchstart', assertEvent); - gd.addEventListener('touchmove', assertEvent); - gd.addEventListener('wheel', assertEvent); + gd.addEventListener('touchend', function(e) { assertEvent(e, true); }); + gd.addEventListener('touchstart', function(e) { assertEvent(e, true); }); + gd.addEventListener('touchmove', function(e) { assertEvent(e, false); }); + gd.addEventListener('wheel', function(e) { assertEvent(e, false); }); Plotly.plot(gd, mock) .then(function() { diff --git a/test/jasmine/tests/gl3dlayout_test.js b/test/jasmine/tests/gl3dlayout_test.js index 06232dab190..a4a56bd29a0 100644 --- a/test/jasmine/tests/gl3dlayout_test.js +++ b/test/jasmine/tests/gl3dlayout_test.js @@ -26,7 +26,9 @@ describe('Test gl3d axes defaults', function() { }; beforeEach(function() { - layoutOut = {}; + layoutOut = { + autotypenumbers: 'convert types' + }; }); it('should define specific default set with empty initial layout', function() { @@ -128,6 +130,7 @@ describe('Test Gl3d layout defaults', function() { beforeEach(function() { layoutOut = { + autotypenumbers: 'convert types', _basePlotModules: ['gl3d'], _dfltTitle: {x: 'xxx', y: 'yyy', colorbar: 'cbbb'}, _subplots: {gl3d: ['scene']} @@ -380,6 +383,157 @@ describe('Test Gl3d layout defaults', function() { expect(layoutOut.scene.zaxis.gridcolor) .toEqual(tinycolor.mix('#444', bgColor, frac).toRgbString()); }); + + it('should disable converting numeric strings using axis.autotypenumbers', function() { + supplyLayoutDefaults({ + scene: { + xaxis: { autotypenumbers: 'strict' }, + yaxis: {}, + zaxis: { autotypenumbers: 'strict' } + } + }, layoutOut, [{ + type: 'scatter3d', + x: ['1970', '2000', '0', '1'], + y: ['1970', '2000', '0', '1'], + z: ['1970', '2000', '0', '1'], + scene: 'scene' + }]); + + var xaxis = layoutOut.scene.xaxis; + var yaxis = layoutOut.scene.yaxis; + var zaxis = layoutOut.scene.zaxis; + expect(xaxis.autotypenumbers).toBe('strict'); + expect(yaxis.autotypenumbers).toBe('convert types'); + expect(zaxis.autotypenumbers).toBe('strict'); + expect(xaxis.type).toBe('category'); + expect(yaxis.type).toBe('linear'); + expect(zaxis.type).toBe('category'); + }); + + it('should enable converting numeric strings using axis.autotypenumbers and inherit defaults from layout.autotypenumbers', function() { + layoutOut.autotypenumbers = 'strict'; + + supplyLayoutDefaults({ + scene: { + xaxis: { autotypenumbers: 'convert types' }, + yaxis: {}, + zaxis: { autotypenumbers: 'convert types' } + } + }, layoutOut, [{ + type: 'scatter3d', + x: ['1970', '2000', '0', '1'], + y: ['1970', '2000', '0', '1'], + z: ['1970', '2000', '0', '1'], + scene: 'scene' + }]); + + var xaxis = layoutOut.scene.xaxis; + var yaxis = layoutOut.scene.yaxis; + var zaxis = layoutOut.scene.zaxis; + expect(xaxis.autotypenumbers).toBe('convert types'); + expect(yaxis.autotypenumbers).toBe('strict'); + expect(zaxis.autotypenumbers).toBe('convert types'); + expect(xaxis.type).toBe('linear'); + expect(yaxis.type).toBe('category'); + expect(zaxis.type).toBe('linear'); + }); + + ['convert types', 'strict'].forEach(function(autotypenumbers) { + it('with autotypenumbers: *' + autotypenumbers + '* should autotype *linear* case of 2d array', function() { + var typedArray = new Float32Array(2); + typedArray[0] = 0; + typedArray[1] = 1; + + supplyLayoutDefaults({ + scene: { + xaxis: { autotypenumbers: autotypenumbers }, + yaxis: { autotypenumbers: autotypenumbers }, + zaxis: { autotypenumbers: autotypenumbers } + } + }, layoutOut, [{ + scene: 'scene', + type: 'surface', + x: [0, 1], + y: typedArray, + z: [ + typedArray, + [1, 0] + ] + }]); + + var xaxis = layoutOut.scene.xaxis; + var yaxis = layoutOut.scene.yaxis; + var zaxis = layoutOut.scene.zaxis; + expect(xaxis.autotypenumbers).toBe(autotypenumbers); + expect(yaxis.autotypenumbers).toBe(autotypenumbers); + expect(zaxis.autotypenumbers).toBe(autotypenumbers); + expect(xaxis.type).toBe('linear'); + expect(yaxis.type).toBe('linear'); + expect(zaxis.type).toBe('linear'); + }); + }); + + ['convert types', 'strict'].forEach(function(autotypenumbers) { + it('with autotypenumbers: *' + autotypenumbers + '* should autotype *category* case of 2d array', function() { + supplyLayoutDefaults({ + scene: { + xaxis: { autotypenumbers: autotypenumbers }, + yaxis: { autotypenumbers: autotypenumbers }, + zaxis: { autotypenumbers: autotypenumbers } + } + }, layoutOut, [{ + scene: 'scene', + type: 'surface', + x: ['A', 'B'], + y: ['C', 'D'], + z: [ + ['E', 'F'], + ['F', 'E'] + ] + }]); + + var xaxis = layoutOut.scene.xaxis; + var yaxis = layoutOut.scene.yaxis; + var zaxis = layoutOut.scene.zaxis; + expect(xaxis.autotypenumbers).toBe(autotypenumbers); + expect(yaxis.autotypenumbers).toBe(autotypenumbers); + expect(zaxis.autotypenumbers).toBe(autotypenumbers); + expect(xaxis.type).toBe('category'); + expect(yaxis.type).toBe('category'); + expect(zaxis.type).toBe('category'); + }); + }); + + ['convert types', 'strict'].forEach(function(autotypenumbers) { + it('with autotypenumbers: *' + autotypenumbers + '* should autotype *date* case of 2d array', function() { + supplyLayoutDefaults({ + scene: { + xaxis: { autotypenumbers: autotypenumbers }, + yaxis: { autotypenumbers: autotypenumbers }, + zaxis: { autotypenumbers: autotypenumbers } + } + }, layoutOut, [{ + scene: 'scene', + type: 'surface', + x: ['00-01', '00-02'], + y: ['00-01', '00-02'], + z: [ + ['00-01', '00-02'], + ['00-02', '00-01'] + ] + }]); + + var xaxis = layoutOut.scene.xaxis; + var yaxis = layoutOut.scene.yaxis; + var zaxis = layoutOut.scene.zaxis; + expect(xaxis.autotypenumbers).toBe(autotypenumbers); + expect(yaxis.autotypenumbers).toBe(autotypenumbers); + expect(zaxis.autotypenumbers).toBe(autotypenumbers); + expect(xaxis.type).toBe('date'); + expect(yaxis.type).toBe('date'); + expect(zaxis.type).toBe('date'); + }); + }); }); }); diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index c117315d5e4..8bf58daf414 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -2391,7 +2391,6 @@ describe('hover on many lines+bars', function() { }); }); - describe('hover info on overlaid subplots', function() { 'use strict'; @@ -2688,6 +2687,448 @@ describe('Hover on multicategory axes', function() { }); }); +describe('hover on traces with (x|y)period positioning', function() { + 'use strict'; + + var gd; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + function _hover(x, y) { + delete gd._hoverdata; + Lib.clearThrottle(); + mouseEvent('mousemove', x, y); + } + + it('shows hover info for scatter, bar, waterfall, funnel, heatmap and contour traces', function(done) { + Plotly.newPlot(gd, require('@mocks/period_positioning.json')) + .then(function() { _hover(110, 390); }) + .then(function() { + assertHoverLabelContent({ + name: 'scatter', + nums: '(Jan 2001, 1)' + }); + }) + .then(function() { _hover(290, 285); }) + .then(function() { + assertHoverLabelContent({ + name: 'scatter', + nums: '(Jan 2004, 4)' + }); + }) + .then(function() { _hover(110, 410); }) + .then(function() { + assertHoverLabelContent({ + name: 'bar (v)', + nums: '(Jan 2001, 1)' + }); + }) + .then(function() { _hover(290, 410); }) + .then(function() { + assertHoverLabelContent({ + name: 'bar (v)', + nums: '(Jan 2004, 4)' + }); + }) + .then(function() { _hover(100, 230); }) + .then(function() { + assertHoverLabelContent({ + name: 'bar (h)', + nums: '(1, Jan 2001)' + }); + }) + .then(function() { _hover(100, 120); }) + .then(function() { + assertHoverLabelContent({ + name: 'bar (h)', + nums: '(4, Jan 2004)' + }); + }) + .then(function() { _hover(135, 230); }) + .then(function() { + assertHoverLabelContent({ + name: 'scatter2', + nums: '(1, Jan 2001)' + }); + }) + .then(function() { _hover(305, 120); }) + .then(function() { + assertHoverLabelContent({ + name: 'scatter2', + nums: '(4, Jan 2004)' + }); + }) + .then(function() { _hover(385, 355); }) + .then(function() { + assertHoverLabelContent({ + name: 'waterfall', + nums: [ + '(Jan 2001, 4)', + '4 ▲', + 'Initial: 0' + ].join('\n') + }); + }) + .then(function() { _hover(565, 355); }) + .then(function() { + assertHoverLabelContent({ + name: 'waterfall', + nums: [ + '(Jan 2004, 2)', + '(1) ▼', + 'Initial: 3' + ].join('\n') + }); + }) + .then(function() { _hover(475, 225); }) + .then(function() { + assertHoverLabelContent({ + name: 'funnel', + nums: [ + '(1, Jan 2004)', + '25% of initial', + '50% of previous', + '10% of total' + ].join('\n') + }); + }) + .then(function() { _hover(475, 115); }) + .then(function() { + assertHoverLabelContent({ + name: 'funnel', + nums: [ + '(4, Jan 2001)', + '100% of initial', + '100% of previous', + '40% of total' + ].join('\n') + }); + }) + .then(function() { _hover(665, 365); }) + .then(function() { + assertHoverLabelContent({ + name: 'heatmap', + nums: [ + 'x: Jan 2001', + 'y: Jan 2002', + 'z: 1' + ].join('\n') + }); + }) + .then(function() { _hover(800, 150); }) + .then(function() { + assertHoverLabelContent({ + name: 'contour', + nums: [ + 'x: Jan 2003', + 'y: Jan 2003', + 'z: 0' + ].join('\n') + }); + }) + + .catch(failTest) + .then(done); + }); + + it('shows hover info for box, ohlc, candlestick traces', function(done) { + Plotly.newPlot(gd, require('@mocks/period_positioning2.json')) + .then(function() { _hover(110, 390); }) + .then(function() { + assertHoverLabelContent({ + name: 'ohlc', + nums: [ + 'Jan 2001', + 'open: 1', + 'high: 2', + 'low: 0', + 'close: 0.5 ▼' + ].join('\n') + }); + }) + .then(function() { _hover(290, 285); }) + .then(function() { + assertHoverLabelContent({ + name: 'ohlc', + nums: [ + 'Jan 2004', + 'open: 4', + 'high: 8', + 'low: 0', + 'close: 2 ▼' + ].join('\n') + }); + }) + .then(function() { _hover(290, 120); }) + .then(function() { + assertHoverLabelContent({ + name: 'candlestick', + nums: [ + 'Jan 2004', + 'open: 4', + 'high: 8', + 'low: 0', + 'close: 2 ▼' + ].join('\n') + }); + }) + .then(function() { _hover(385, 355); }) + .then(function() { + assertHoverLabelContent({ + name: ['', '', '', 'box (v)', ''], + nums: [ + '(Jan 2001, min: 2)', + '(Jan 2001, q1: 4)', + '(Jan 2001, q3: 8)', + '(Jan 2001, median: 6)', + '(Jan 2001, max: 10)', + ] + }); + }) + .then(function() { _hover(475, 120); }) + .then(function() { + assertHoverLabelContent({ + name: ['', '', '', '', 'box (h)'], + nums: [ + '(max: 8, Jan 2004)', + '(min: 0, Jan 2004)', + '(q1: 2, Jan 2004)', + '(q3: 6, Jan 2004)', + '(median: 4, Jan 2004)' + ] + }); + }) + + .catch(failTest) + .then(done); + }); + + it('shows hover info and hovertemplate for bar and scatter traces using (start | middle | end) alignments and different periods', function(done) { + Plotly.newPlot(gd, require('@mocks/period_positioning4.json')) + .then(function() { _hover(65, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (M1)', + nums: '(Jan 1, 2001, 1)' + }); + }) + .then(function() { _hover(65, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (M1)', + nums: '(Jan 15, 2001, 2)' + }); + }) + .then(function() { _hover(100, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (M1)', + nums: '(Jan 1, 2001, 1)' + }); + }) + .then(function() { _hover(100, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (M1)', + nums: '(Jan 15, 2001, 2)' + }); + }) + .then(function() { _hover(135, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (M1)', + nums: '(Jan 1, 2001, 1)' + }); + }) + .then(function() { _hover(135, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (M1)', + nums: '(Jan 15, 2001, 2)' + }); + }) + + .then(function() { _hover(65, 205); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (M2)', + nums: '(Jan 1, 2001, 1)' + }); + }) + .then(function() { _hover(65, 175); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (M2)', + nums: '(Feb 1, 2001, 2)' + }); + }) + .then(function() { _hover(100, 205); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (M2)', + nums: '(Jan 1, 2001, 1)' + }); + }) + .then(function() { _hover(100, 175); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (M2)', + nums: '(Feb 1, 2001, 2)' + }); + }) + .then(function() { _hover(135, 205); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (M2)', + nums: '(Jan 1, 2001, 1)' + }); + }) + .then(function() { _hover(135, 175); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (M2)', + nums: '(Feb 1, 2001, 2)' + }); + }) + + .then(function() { _hover(345, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (M3)', + nums: '(Q1, 1)' + }); + }) + .then(function() { _hover(345, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (M3)', + nums: '(Q1, 2)' + }); + }) + .then(function() { _hover(380, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (M3)', + nums: '(Q1, 1)' + }); + }) + .then(function() { _hover(380, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (M3)', + nums: '(Q1, 2)' + }); + }) + .then(function() { _hover(415, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (M3)', + nums: '(Q1, 1)' + }); + }) + .then(function() { _hover(415, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (M3)', + nums: '(Q1, 2)' + }); + }) + + .then(function() { _hover(630, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (M12)', + nums: '(Jan 2001, 1)' + }); + }) + .then(function() { _hover(630, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (M12)', + nums: '(Jul 2001, 2)' + }); + }) + .then(function() { _hover(665, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (M12)', + nums: '(Jan 2001, 1)' + }); + }) + .then(function() { _hover(665, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (M12)', + nums: '(Jul 2001, 2)' + }); + }) + .then(function() { _hover(700, 425); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (M12)', + nums: '(Jan 2001, 1)' + }); + }) + .then(function() { _hover(700, 395); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (M12)', + nums: '(Jul 2001, 2)' + }); + }) + + .then(function() { _hover(630, 205); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (W1)', + nums: '(W01, 1)' + }); + }) + .then(function() { _hover(630, 175); }) + .then(function() { + assertHoverLabelContent({ + name: 'start (W1)', + nums: '(W01, 2)' + }); + }) + .then(function() { _hover(665, 205); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (W1)', + nums: 'Monday, 1' + }); + }) + .then(function() { _hover(665, 175); }) + .then(function() { + assertHoverLabelContent({ + name: 'middle (W1)', + nums: 'Friday, 2' + }); + }) + .then(function() { _hover(700, 205); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (W1)', + nums: '(W01, 1)' + }); + }) + .then(function() { _hover(700, 175); }) + .then(function() { + assertHoverLabelContent({ + name: 'end (W1)', + nums: '(W01, 2)' + }); + }) + + .catch(failTest) + .then(done); + }); +}); + describe('Hover on axes with rangebreaks', function() { var gd; var eventData; diff --git a/test/jasmine/tests/image_test.js b/test/jasmine/tests/image_test.js index 9363a730ffa..903cde4ee59 100644 --- a/test/jasmine/tests/image_test.js +++ b/test/jasmine/tests/image_test.js @@ -208,11 +208,11 @@ describe('image smart layout defaults', function() { expect(gd._fullLayout.yaxis.scaleanchor).toBe('x'); }); - it('should NOT set scaleanchor if it\'s already defined', function() { - gd.data = [{type: 'image', z: [[[255, 0, 0]]]}]; + it('should NOT reset scaleanchor if it\'s already defined', function() { + gd.data = [{type: 'image', z: [[[255, 0, 0]]]}, {y: [5, 3, 2], xaxis: 'x3'}]; gd.layout = {yaxis: {scaleanchor: 'x3'}}; supplyAllDefaults(gd); - expect(gd._fullLayout.yaxis.scaleanchor).toBe(undefined); + expect(gd._fullLayout.yaxis.scaleanchor).toBe('x3'); }); it('should constrain axes to domain if images are present', function() { @@ -233,7 +233,7 @@ describe('image smart layout defaults', function() { it('should NOT constrain axes to domain if it\'s already defined', function() { gd.data = [{type: 'image', z: [[[255, 0, 0]]]}]; - gd.layout = {yaxis: {constrain: false}, xaxis: {constrain: false}}; + gd.layout = {yaxis: {constrain: 'range'}, xaxis: {constrain: 'range'}}; supplyAllDefaults(gd); expect(gd._fullLayout.xaxis.constrain).toBe('range'); expect(gd._fullLayout.yaxis.constrain).toBe('range'); @@ -423,9 +423,7 @@ describe('image plot', function() { [ ['yaxis.type', 'log'], - ['xaxis.type', 'log'], - ['xaxis.range', [50, 0]], - ['yaxis.range', [0, 50]] + ['xaxis.type', 'log'] ].forEach(function(attr) { it('does not renders pixelated image when the axes are not compatible', function(done) { var mock = require('@mocks/image_astronaut_source.json'); @@ -669,5 +667,38 @@ describe('image hover:', function() { .then(done); }); }); + + [ + [true, true], + [true, 'reversed'], // the default image layout + ['reversed', true], + ['reversed', 'reversed'] + ].forEach(function(test) { + it('should show correct hover info regardless of axis directions ' + test, function(done) { + var mockCopy = Lib.extendDeep({}, mock); + mockCopy.layout.xaxis.autorange = test[0]; + mockCopy.layout.yaxis.autorange = test[1]; + mockCopy.data[0].colormodel = 'rgba'; + mockCopy.data[0].hovertemplate = 'x:%{x}, y:%{y}, z:%{z}'; + Plotly.newPlot(gd, mockCopy) + .then(function() { + var x = 205; + var y = 125; + + // adjust considering css + if(test[0] === 'reversed') x = 512 - x; + if(test[1] !== 'reversed') y = 512 - y; + _hover(x, y); + }) + .then(function() { + assertHoverLabelContent({ + nums: 'x:205, y:125, z:[202, 148, 125, 255]', + name: '' + }, 'positions should be correct!'); + }) + .catch(failTest) + .then(done); + }); + }); }); }); diff --git a/test/jasmine/tests/indicator_test.js b/test/jasmine/tests/indicator_test.js index 4bc28714830..fb987c4b284 100644 --- a/test/jasmine/tests/indicator_test.js +++ b/test/jasmine/tests/indicator_test.js @@ -154,8 +154,7 @@ describe('Indicator plot', function() { expect(numbers.length).toBe(1); var transform = numbers.attr('transform'); - expect(transform.match('scale')).toBeTruthy('cannot find scale attribute on text.numbers[0]'); - var scale = transform.match(/.*scale\((.*)\)/)[1]; + var scale = transform.match('scale') ? transform.match(/.*scale\((.*)\)/)[1] : 1; expect(scale).toBeCloseTo(value, 1, msg); } @@ -171,7 +170,7 @@ describe('Indicator plot', function() { return Plotly.relayout(gd, {width: 200, height: 200}); }) .then(function() { - checkNumbersScale(0.2, 'should scale down'); + checkNumbersScale(0.4794007490636704, 'should scale down'); return Plotly.relayout(gd, {width: 400, height: 400}); }) .then(function() { diff --git a/test/jasmine/tests/legend_scroll_test.js b/test/jasmine/tests/legend_scroll_test.js index 3ae4942c6f0..80eba3f4400 100644 --- a/test/jasmine/tests/legend_scroll_test.js +++ b/test/jasmine/tests/legend_scroll_test.js @@ -109,7 +109,7 @@ describe('The legend', function() { expect(getScroll(gd)).toBe(finalDataScroll); expect(scrollBox.getAttribute('transform')).toBe( - 'translate(0, ' + -finalDataScroll + ')'); + 'translate(0,' + -finalDataScroll + ')'); }); function dragScroll(element, rightClick, mainClick) { @@ -158,7 +158,7 @@ describe('The legend', function() { var dataScroll = getScroll(gd); expect(dataScroll).toBeCloseTo(finalDataScroll, 3); expect(scrollBox.getAttribute('transform')).toBe( - 'translate(0, ' + -dataScroll + ')'); + 'translate(0,' + -dataScroll + ')'); }); it('should not scroll on dragging the scrollbox with a mouse', function() { @@ -167,8 +167,7 @@ describe('The legend', function() { var dataScroll = getScroll(gd); expect(dataScroll).not.toBeCloseTo(finalDataScroll, 3); - expect(scrollBox.getAttribute('transform')).toBe( - 'translate(0, ' + -dataScroll + ')'); + expect(scrollBox.getAttribute('transform')).toBe(''); }); it('should handle touch events on scrollbox', function(done) { @@ -227,8 +226,7 @@ describe('The legend', function() { var dataScroll = getScroll(gd); expect(dataScroll).not.toBeCloseTo(finalDataScroll, 3); - expect(scrollBox.getAttribute('transform')).toBe( - 'translate(0, ' + -dataScroll + ')'); + expect(scrollBox.getAttribute('transform')).toBe(''); }); it('removes scroll bar and handlers when switching to horizontal', function(done) { @@ -307,7 +305,7 @@ describe('The legend', function() { expect(+toggle.parentNode.style.opacity).toBeLessThan(1); expect(getScroll(gd)).toBe(dataScroll); expect(scrollBox.getAttribute('transform')).toBe( - 'translate(0, ' + -dataScroll + ')'); + 'translate(0,' + -dataScroll + ')'); done(); }, DBLCLICKDELAY * 2); }); @@ -345,7 +343,7 @@ describe('The legend', function() { expect(+toggle.parentNode.style.opacity).toBeLessThan(1); expect(getScroll(gd)).toBe(dataScroll); expect(scrollBox.getAttribute('transform')).toBe( - 'translate(0, ' + -dataScroll + ')'); + 'translate(0,' + -dataScroll + ')'); expect(scrollBar.getAttribute('width')).toBeGreaterThan(0); expect(scrollBar.getAttribute('height')).toBeGreaterThan(0); done(); @@ -357,10 +355,10 @@ describe('The legend', function() { var scrollBox = getScrollBox(); legend.dispatchEvent(scrollTo(-100)); - expect(scrollBox.getAttribute('transform')).toBe('translate(0, 0)'); + expect(scrollBox.getAttribute('transform')).toBe(''); legend.dispatchEvent(scrollTo(100000)); - expect(scrollBox.getAttribute('transform')).toBe('translate(0, -179)'); + expect(scrollBox.getAttribute('transform')).toBe('translate(0,-179)'); }); it('should scale the scrollbar movement from top to bottom', function() { @@ -405,7 +403,7 @@ describe('The legend', function() { expect(countLegendClipPaths(gd)).toBe(1); // clippath resized to new height less than new plot height - expect(+legendHeight).toBe(getPlotHeight(gd)); + expect(+legendHeight).toBeGreaterThan(getPlotHeight(gd)); expect(+legendHeight).toBeLessThan(+origLegendHeight); done(); diff --git a/test/jasmine/tests/legend_test.js b/test/jasmine/tests/legend_test.js index 21f25626989..06de0f4643f 100644 --- a/test/jasmine/tests/legend_test.js +++ b/test/jasmine/tests/legend_test.js @@ -1289,6 +1289,47 @@ describe('legend interaction', function() { }); }); + describe('staticPlot', function() { + var gd; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + function toggleTrace() { + var toggle = d3.select('.legendtoggle').node(); + expect(toggle).not.toEqual(null); + + toggle.dispatchEvent(new MouseEvent('mousedown')); + toggle.dispatchEvent(new MouseEvent('mouseup')); + + // Delay needs to be long enough for Plotly to react + return delay(300)(); + } + + function assertToggled(toggled) { + return function() { + var container = d3.select('g.traces').node(); + expect(container).not.toEqual(null); + expect(container.style.opacity).toBe(toggled ? '0.5' : '1'); + }; + } + + it('should prevent toggling if set', function(done) { + var data = [{ x: [0, 1], y: [0, 1], type: 'scatter' }]; + var layout = { showlegend: true }; + var config = { staticPlot: true }; + + Plotly.newPlot(gd, data, layout, config) + .then(toggleTrace) + .then(assertToggled(false)) + .catch(failTest) + .then(done); + }); + }); + describe('visible toggle', function() { var gd; diff --git a/test/jasmine/tests/mapbox_test.js b/test/jasmine/tests/mapbox_test.js index 538dd39f701..8bb86a575f6 100644 --- a/test/jasmine/tests/mapbox_test.js +++ b/test/jasmine/tests/mapbox_test.js @@ -948,10 +948,15 @@ describe('@noCI, mapbox plots', function() { layout: { mapbox: { layers: [{ + 'sourcetype': 'raster', + 'source': ['https://a.tile.openstreetmap.org/{z}/{x}/{y}.png'], + 'below': 'traces', + }, { 'sourcetype': 'image', 'coordinates': coords, - 'source': source - }] + 'source': source, + 'below': 'traces', + }], } } }; @@ -970,7 +975,7 @@ describe('@noCI, mapbox plots', function() { Plotly.react(gd, makeFigure(redImage)).then(function() { var mapbox = gd._fullLayout.mapbox._subplot; map = mapbox.map; - layerSource = map.getSource(mapbox.layerList[0].idSource); + layerSource = map.getSource(mapbox.layerList[1].idSource); spyOn(layerSource, 'updateImage').and.callThrough(); spyOn(map, 'removeSource').and.callThrough(); @@ -981,6 +986,23 @@ describe('@noCI, mapbox plots', function() { {url: greenImage, coordinates: coords} ); expect(map.removeSource).not.toHaveBeenCalled(); + + // Check order of layers + var mapbox = gd._fullLayout.mapbox._subplot; + var mapboxLayers = mapbox.getMapLayers(); + var plotlyjsLayers = mapbox.layerList; + + var indexLower = mapboxLayers.findIndex(function(layer) { + return layer.id === 'plotly-layout-layer-' + plotlyjsLayers[0].uid; + }); + + var indexUpper = mapboxLayers.findIndex(function(layer) { + return layer.id === 'plotly-layout-layer-' + plotlyjsLayers[1].uid; + }); + + expect(indexLower).toBeGreaterThan(-1); + expect(indexUpper).toBeGreaterThan(0); + expect(indexUpper).toBe(indexLower + 1); }) .catch(failTest) .then(done); diff --git a/test/jasmine/tests/mock_test.js b/test/jasmine/tests/mock_test.js index d68c3604bd2..9c600a40e86 100644 --- a/test/jasmine/tests/mock_test.js +++ b/test/jasmine/tests/mock_test.js @@ -39,6 +39,9 @@ var list = [ 'annotations', 'annotations-autorange', 'arrow-markers', + 'automargin-large-margins', + 'automargin-large-margins-both-sides', + 'automargin-large-margins-horizontal', 'automargin-mirror-all', 'automargin-mirror-allticks', 'automargin-multiline-titles', @@ -78,6 +81,8 @@ var list = [ 'axes_category_descending', 'axes_category_descending_with_gaps', 'axes_category_null', + 'axes_chain_scaleanchor_matches', + 'axes_chain_scaleanchor_matches2', 'axes_custom-ticks_log-date', 'axes_enumerated_ticks', 'axes_free_default', @@ -118,6 +123,7 @@ var list = [ 'bar_hide_nulls', 'bar_line', 'bar_marker_array', + 'bar_annotation_max_range_eq_category', 'bar_multiline_labels', 'bar_nonnumeric_sizes', 'bar_show_narrow', @@ -260,6 +266,8 @@ var list = [ 'date_histogram', 'dendrogram', 'display-text_zero-number', + 'domain_refs', + 'domain_ref_axis_types', 'earth_heatmap', 'electric_heatmap', 'empty', @@ -415,6 +423,7 @@ var list = [ 'gl2d_parcoords_select_first_last_enum', 'gl2d_parcoords_style_labels', 'gl2d_parcoords_tick_format', + 'gl2d_period_positioning', 'gl2d_point-selection', 'gl2d_pointcloud-basic', 'gl2d_rgb_dont_accept_alpha_scattergl', @@ -562,9 +571,11 @@ var list = [ 'gl3d_surface_transparent-with-contours', 'gl3d_surface-circular-colorscale', 'gl3d_surface-circular-opacityscale', + 'gl3d_surface-heatmap-treemap_transparent-colorscale', 'gl3d_surface-lighting', 'gl3d_tetrahedra', 'gl3d_text-weirdness', + 'gl3d_ticks-milliseconds', 'gl3d_traces-with-legend', 'gl3d_traces-with-opacity', 'gl3d_transparent_same-depth', @@ -639,6 +650,7 @@ var list = [ 'image_colormodel', 'image_non_numeric', 'image_opacity', + 'image_source_axis_reverse', 'image_with_gaps', 'image_with_heatmap', 'image_zmin_zmax', @@ -663,8 +675,10 @@ var list = [ 'legend_horizontal_bg_fit', 'legend_horizontal_groups', 'legend_horizontal_one_row', + 'legend_horizontal_testwrap', 'legend_horizontal_wrap-alll-lines', 'legend_inside', + 'legend_itemwidth_dashline', 'legend_labels', 'legend_large_margin', 'legend_margin-autoexpand-false', @@ -715,6 +729,7 @@ var list = [ 'mapbox_geojson-attributes', 'mapbox_layers', 'mapbox_osm-style', + 'mapbox_scattercluster', 'mapbox_stamen-style', 'mapbox_symbol-text', 'mapbox_texttemplate', @@ -726,6 +741,7 @@ var list = [ 'matching-missing-axes', 'mathjax', 'mirror-all-vs-allticks', + 'missing-category-order', 'multicategory', 'multicategory_histograms', 'multicategory-inside-ticks', @@ -753,6 +769,14 @@ var list = [ 'parcats_reordered', 'parcats_unbundled', 'percent_error_bar', + 'period_positioning', + 'period_positioning2', + 'period_positioning3', + 'period_positioning4', + 'period_positioning5', + 'period_positioning6', + 'period_positioning7', + 'period_positioning8', 'picnic_heatmap', 'pie_aggregated', 'pie_automargin', @@ -819,6 +843,7 @@ var list = [ 'range_slider_reversed-range', 'range_slider_top_axis', 'rdbu_heatmap', + 'reversed-axis-dividers', 'sankey_circular', 'sankey_circular_large', 'sankey_circular_process', @@ -938,6 +963,13 @@ var list = [ 'tick-percent', 'tickformat', 'tickformatstops', + 'ticklabelposition-0', + 'ticklabelposition-1', + 'ticklabelposition-2', + 'ticklabelposition-a', + 'ticklabelposition-b', + 'ticklabelposition-c', + 'ticklabelposition-d', 'tickson_boundaries', 'titles-avoid-labels', 'trace_metatext', @@ -995,6 +1027,7 @@ var list = [ 'updatemenus', 'updatemenus_positioning', 'updatemenus_toggle', + 'vertical-tickangles', 'violin_bandwidth-edge-cases', 'violin_box_multiple_widths', 'violin_box_overlay', @@ -1091,6 +1124,9 @@ figs['animation_bar'] = require('@mocks/animation_bar'); // figs['annotations'] = require('@mocks/annotations'); // figs['annotations-autorange'] = require('@mocks/annotations-autorange'); figs['arrow-markers'] = require('@mocks/arrow-markers'); +figs['automargin-large-margins'] = require('@mocks/automargin-large-margins'); +figs['automargin-large-margins-both-sides'] = require('@mocks/automargin-large-margins-both-sides'); +figs['automargin-large-margins-horizontal'] = require('@mocks/automargin-large-margins-horizontal'); figs['automargin-mirror-all'] = require('@mocks/automargin-mirror-all'); figs['automargin-mirror-allticks'] = require('@mocks/automargin-mirror-allticks'); figs['automargin-multiline-titles'] = require('@mocks/automargin-multiline-titles'); @@ -1130,6 +1166,8 @@ figs['axes_category_categoryarray_truncated_tails'] = require('@mocks/axes_categ // figs['axes_category_descending'] = require('@mocks/axes_category_descending'); // figs['axes_category_descending_with_gaps'] = require('@mocks/axes_category_descending_with_gaps'); figs['axes_category_null'] = require('@mocks/axes_category_null'); +figs['axes_chain_scaleanchor_matches'] = require('@mocks/axes_chain_scaleanchor_matches'); +figs['axes_chain_scaleanchor_matches2'] = require('@mocks/axes_chain_scaleanchor_matches2'); figs['axes_custom-ticks_log-date'] = require('@mocks/axes_custom-ticks_log-date'); figs['axes_enumerated_ticks'] = require('@mocks/axes_enumerated_ticks'); figs['axes_free_default'] = require('@mocks/axes_free_default'); @@ -1170,6 +1208,7 @@ figs['bar_group_percent'] = require('@mocks/bar_group_percent'); figs['bar_hide_nulls'] = require('@mocks/bar_hide_nulls'); figs['bar_line'] = require('@mocks/bar_line'); figs['bar_marker_array'] = require('@mocks/bar_marker_array'); +figs['bar_annotation_max_range_eq_category'] = require('@mocks/bar_annotation_max_range_eq_category'); figs['bar_multiline_labels'] = require('@mocks/bar_multiline_labels'); figs['bar_nonnumeric_sizes'] = require('@mocks/bar_nonnumeric_sizes'); figs['bar_show_narrow'] = require('@mocks/bar_show_narrow'); @@ -1312,6 +1351,8 @@ figs['date_axes_period_breaks_automargin'] = require('@mocks/date_axes_period_br figs['date_histogram'] = require('@mocks/date_histogram'); // figs['dendrogram'] = require('@mocks/dendrogram'); figs['display-text_zero-number'] = require('@mocks/display-text_zero-number'); +figs['domain_refs'] = require('@mocks/domain_refs'); +figs['domain_ref_axis_types'] = require('@mocks/domain_ref_axis_types'); figs['earth_heatmap'] = require('@mocks/earth_heatmap'); figs['electric_heatmap'] = require('@mocks/electric_heatmap'); figs['empty'] = require('@mocks/empty'); @@ -1467,6 +1508,7 @@ figs['gl2d_parcoords_rgba_colorscale'] = require('@mocks/gl2d_parcoords_rgba_col // figs['gl2d_parcoords_select_first_last_enum'] = require('@mocks/gl2d_parcoords_select_first_last_enum'); figs['gl2d_parcoords_style_labels'] = require('@mocks/gl2d_parcoords_style_labels'); figs['gl2d_parcoords_tick_format'] = require('@mocks/gl2d_parcoords_tick_format'); +figs['gl2d_period_positioning'] = require('@mocks/gl2d_period_positioning'); figs['gl2d_point-selection'] = require('@mocks/gl2d_point-selection'); // figs['gl2d_pointcloud-basic'] = require('@mocks/gl2d_pointcloud-basic'); // figs['gl2d_rgb_dont_accept_alpha_scattergl'] = require('@mocks/gl2d_rgb_dont_accept_alpha_scattergl'); @@ -1614,9 +1656,11 @@ figs['gl3d_surface_opacity_match_mesh3d'] = require('@mocks/gl3d_surface_opacity figs['gl3d_surface_transparent-with-contours'] = require('@mocks/gl3d_surface_transparent-with-contours'); figs['gl3d_surface-circular-colorscale'] = require('@mocks/gl3d_surface-circular-colorscale'); figs['gl3d_surface-circular-opacityscale'] = require('@mocks/gl3d_surface-circular-opacityscale'); +// figs['gl3d_surface-heatmap-treemap_transparent-colorscale'] = require('@mocks/gl3d_surface-heatmap-treemap_transparent-colorscale'); // figs['gl3d_surface-lighting'] = require('@mocks/gl3d_surface-lighting'); figs['gl3d_tetrahedra'] = require('@mocks/gl3d_tetrahedra'); figs['gl3d_text-weirdness'] = require('@mocks/gl3d_text-weirdness'); +figs['gl3d_ticks-milliseconds'] = require('@mocks/gl3d_ticks-milliseconds'); // figs['gl3d_traces-with-legend'] = require('@mocks/gl3d_traces-with-legend'); // figs['gl3d_traces-with-opacity'] = require('@mocks/gl3d_traces-with-opacity'); figs['gl3d_transparent_same-depth'] = require('@mocks/gl3d_transparent_same-depth'); @@ -1691,6 +1735,7 @@ figs['image_cat'] = require('@mocks/image_cat'); figs['image_colormodel'] = require('@mocks/image_colormodel'); figs['image_non_numeric'] = require('@mocks/image_non_numeric'); figs['image_opacity'] = require('@mocks/image_opacity'); +figs['image_source_axis_reverse'] = require('@mocks/image_source_axis_reverse'); figs['image_with_gaps'] = require('@mocks/image_with_gaps'); figs['image_with_heatmap'] = require('@mocks/image_with_heatmap'); figs['image_zmin_zmax'] = require('@mocks/image_zmin_zmax'); @@ -1715,8 +1760,10 @@ figs['layout-colorway'] = require('@mocks/layout-colorway'); figs['legend_horizontal_bg_fit'] = require('@mocks/legend_horizontal_bg_fit'); figs['legend_horizontal_groups'] = require('@mocks/legend_horizontal_groups'); figs['legend_horizontal_one_row'] = require('@mocks/legend_horizontal_one_row'); +figs['legend_horizontal_testwrap'] = require('@mocks/legend_horizontal_testwrap'); figs['legend_horizontal_wrap-alll-lines'] = require('@mocks/legend_horizontal_wrap-alll-lines'); figs['legend_inside'] = require('@mocks/legend_inside'); +figs['legend_itemwidth_dashline'] = require('@mocks/legend_itemwidth_dashline'); figs['legend_labels'] = require('@mocks/legend_labels'); figs['legend_large_margin'] = require('@mocks/legend_large_margin'); figs['legend_margin-autoexpand-false'] = require('@mocks/legend_margin-autoexpand-false'); @@ -1767,6 +1814,7 @@ figs['mapbox_fill'] = require('@mocks/mapbox_fill'); figs['mapbox_geojson-attributes'] = require('@mocks/mapbox_geojson-attributes'); figs['mapbox_layers'] = require('@mocks/mapbox_layers'); figs['mapbox_osm-style'] = require('@mocks/mapbox_osm-style'); +figs['mapbox_scattercluster'] = require('@mocks/mapbox_scattercluster'); figs['mapbox_stamen-style'] = require('@mocks/mapbox_stamen-style'); figs['mapbox_symbol-text'] = require('@mocks/mapbox_symbol-text'); figs['mapbox_texttemplate'] = require('@mocks/mapbox_texttemplate'); @@ -1778,6 +1826,7 @@ figs['matching-categories'] = require('@mocks/matching-categories'); // figs['matching-missing-axes'] = require('@mocks/matching-missing-axes'); // figs['mathjax'] = require('@mocks/mathjax'); figs['mirror-all-vs-allticks'] = require('@mocks/mirror-all-vs-allticks'); +figs['missing-category-order'] = require('@mocks/missing-category-order'); figs['multicategory'] = require('@mocks/multicategory'); figs['multicategory_histograms'] = require('@mocks/multicategory_histograms'); figs['multicategory-inside-ticks'] = require('@mocks/multicategory-inside-ticks'); @@ -1805,6 +1854,14 @@ figs['parcats_numeric_sort'] = require('@mocks/parcats_numeric_sort'); figs['parcats_reordered'] = require('@mocks/parcats_reordered'); figs['parcats_unbundled'] = require('@mocks/parcats_unbundled'); figs['percent_error_bar'] = require('@mocks/percent_error_bar'); +figs['period_positioning'] = require('@mocks/period_positioning'); +figs['period_positioning2'] = require('@mocks/period_positioning2'); +figs['period_positioning3'] = require('@mocks/period_positioning3'); +figs['period_positioning4'] = require('@mocks/period_positioning4'); +figs['period_positioning5'] = require('@mocks/period_positioning5'); +figs['period_positioning6'] = require('@mocks/period_positioning6'); +figs['period_positioning7'] = require('@mocks/period_positioning7'); +figs['period_positioning8'] = require('@mocks/period_positioning8'); figs['picnic_heatmap'] = require('@mocks/picnic_heatmap'); figs['pie_aggregated'] = require('@mocks/pie_aggregated'); figs['pie_automargin'] = require('@mocks/pie_automargin'); @@ -1871,6 +1928,7 @@ figs['range_slider_rangemode'] = require('@mocks/range_slider_rangemode'); figs['range_slider_reversed-range'] = require('@mocks/range_slider_reversed-range'); figs['range_slider_top_axis'] = require('@mocks/range_slider_top_axis'); figs['rdbu_heatmap'] = require('@mocks/rdbu_heatmap'); +figs['reversed-axis-dividers'] = require('@mocks/reversed-axis-dividers'); figs['sankey_circular'] = require('@mocks/sankey_circular'); figs['sankey_circular_large'] = require('@mocks/sankey_circular_large'); figs['sankey_circular_process'] = require('@mocks/sankey_circular_process'); @@ -1990,6 +2048,13 @@ figs['tick-increment'] = require('@mocks/tick-increment'); figs['tick-percent'] = require('@mocks/tick-percent'); figs['tickformat'] = require('@mocks/tickformat'); figs['tickformatstops'] = require('@mocks/tickformatstops'); +figs['ticklabelposition-0'] = require('@mocks/ticklabelposition-0'); +figs['ticklabelposition-1'] = require('@mocks/ticklabelposition-1'); +figs['ticklabelposition-2'] = require('@mocks/ticklabelposition-2'); +figs['ticklabelposition-a'] = require('@mocks/ticklabelposition-a'); +figs['ticklabelposition-b'] = require('@mocks/ticklabelposition-b'); +figs['ticklabelposition-c'] = require('@mocks/ticklabelposition-c'); +figs['ticklabelposition-d'] = require('@mocks/ticklabelposition-d'); figs['tickson_boundaries'] = require('@mocks/tickson_boundaries'); // figs['titles-avoid-labels'] = require('@mocks/titles-avoid-labels'); // figs['trace_metatext'] = require('@mocks/trace_metatext'); @@ -2047,6 +2112,7 @@ figs['uniformtext_treemap_coffee-maxdepth3'] = require('@mocks/uniformtext_treem // figs['updatemenus'] = require('@mocks/updatemenus'); figs['updatemenus_positioning'] = require('@mocks/updatemenus_positioning'); figs['updatemenus_toggle'] = require('@mocks/updatemenus_toggle'); +figs['vertical-tickangles'] = require('@mocks/vertical-tickangles'); figs['violin_bandwidth-edge-cases'] = require('@mocks/violin_bandwidth-edge-cases'); figs['violin_box_multiple_widths'] = require('@mocks/violin_box_multiple_widths'); figs['violin_box_overlay'] = require('@mocks/violin_box_overlay'); @@ -2092,7 +2158,6 @@ figs['waterfall-offsetgroups'] = require('@mocks/waterfall-offsetgroups'); // figs['yiorrd_heatmap'] = require('@mocks/yiorrd_heatmap'); figs['zsmooth_methods'] = require('@mocks/zsmooth_methods'); - describe('@noCI mock validation', function() { list.forEach(function(name) { var figure = figs[name]; diff --git a/test/jasmine/tests/modebar_test.js b/test/jasmine/tests/modebar_test.js index 66c7b7b9a9a..b97d81a6960 100644 --- a/test/jasmine/tests/modebar_test.js +++ b/test/jasmine/tests/modebar_test.js @@ -1579,4 +1579,46 @@ describe('ModeBar', function() { .then(done); }); }); + + describe('modebar html', function() { + var gd; + var traces = [ + {type: 'scatter', x: [1, 2], y: [1, 2]}, + {type: 'scatter3d', x: [1, 2], y: [1, 2], z: [1, 2]}, + {type: 'surface', z: [[1, 2], [1, 2]]}, + {type: 'heatmap', z: [[1, 2], [1, 2]]}, + ]; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(function() { + Plotly.purge(gd); + destroyGraphDiv(); + }); + + function getModebarDiv() { + return document.getElementById('modebar-' + gd._fullLayout._uid); + } + + traces.forEach(function(fromTrace) { + traces.forEach(function(toTrace) { + it('is still present when switching from ' + fromTrace.type + ' to ' + toTrace.type, function(done) { + Plotly.plot(gd, [fromTrace], {}) + .then(function() { + expect(getModebarDiv()).toBeTruthy(); + expect(getModebarDiv().innerHTML).toBeTruthy(); + }) + .then(Plotly.react(gd, [toTrace])) + .then(function() { + expect(getModebarDiv()).toBeTruthy(); + expect(getModebarDiv().innerHTML).toBeTruthy(); + }) + .then(done) + .catch(failTest); + }); + }); + }); + }); }); diff --git a/test/jasmine/tests/parcats_test.js b/test/jasmine/tests/parcats_test.js index 9255740ba6e..1ab3cbd8a48 100644 --- a/test/jasmine/tests/parcats_test.js +++ b/test/jasmine/tests/parcats_test.js @@ -1,5 +1,6 @@ var Plotly = require('@lib/index'); var Lib = require('@src/lib'); +var strTranslate = Lib.strTranslate; var d3 = require('d3'); var createGraphDiv = require('../assets/create_graph_div'); @@ -12,7 +13,7 @@ var delay = require('../assets/delay'); var customAssertions = require('../assets/custom_assertions'); var assertHoverLabelContent = customAssertions.assertHoverLabelContent; -var CALLBACK_DELAY = 500; +var CALLBACK_DELAY = 3000; // Testing constants // ================= @@ -104,7 +105,7 @@ function checkParcatsSvg(gd) { var parcatsTraceSelection = d3.select('g.trace.parcats'); expect(parcatsTraceSelection.attr('transform')).toEqual( - makeTranslate( + strTranslate( size.w * domain.x[0] + margin.r, size.h * domain.y[0] + margin.t)); @@ -116,7 +117,7 @@ function checkParcatsSvg(gd) { dimensionSelection.each(function(dimension, dimInd) { var expectedX = categoryLabelPad + dimInd * dimDx; var expectedY = 0; - var expectedTransform = makeTranslate(expectedX, expectedY); + var expectedTransform = strTranslate(expectedX, expectedY); expect(d3.select(this).attr('transform')).toEqual(expectedTransform); }); @@ -130,7 +131,7 @@ function checkParcatsSvg(gd) { var catWidth = catSel.datum().width; var catHeight = catSel.datum().height; - var expectedTransform = 'translate(0, ' + nextY + ')'; + var expectedTransform = strTranslate(0, nextY); expect(catSel.attr('transform')).toEqual(expectedTransform); nextY += category.height + catSpacing; @@ -151,10 +152,6 @@ function checkParcatsSvg(gd) { }); } -function makeTranslate(x, y) { - return 'translate(' + x + ', ' + y + ')'; -} - // Test cases // ========== diff --git a/test/jasmine/tests/pie_test.js b/test/jasmine/tests/pie_test.js index 5c809fac3b3..c22f9d4decf 100644 --- a/test/jasmine/tests/pie_test.js +++ b/test/jasmine/tests/pie_test.js @@ -1007,7 +1007,7 @@ describe('Pie traces', function() { textposition: [['outside', 'outside', 'inside', 'inside', 'outside']], 'outsidetextfont.size': 12 }, { - t: '~=', l: 'shrunk', + t: '~=', l: '~=', b: 'grew', r: 'grew' })) .then(check('automargin:false', {automargin: false}, { @@ -2064,3 +2064,117 @@ describe('pie uniformtext', function() { .then(done); }); }); + +describe('pie value format', function() { + 'use strict'; + + var gd; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + it('should handle rounding big & small values', function(done) { + Plotly.newPlot(gd, [{ + type: 'pie', + textinfo: 'value', + values: [ + 123456789012, + 12345678901.2, + 1234567890.12, + 123456789.012, + 12345678.9012, + 1234567.89012, + 123456.789012, + 12345.6789012, + 1234.56789012, + 123.456789012, + 12.3456789012, + 1.23456789012, + 0.123456789012, + 0.0123456789012, + 0.00123456789012, + 0.000123456789012, + 0.0000123456789012, + 0.00000123456789012, + 0.000000123456789012, + 0.0000000123456789012 + ] + }]) + .then(function() { + var exp = [ + '1.23456789e+11', + '1.23456789e+10', + '1,234,567,890', + '123,456,789', + '12,345,678.9', + '1,234,567.89', + '123,456.789', + '12,345.6789', + '1,234.56789', + '123.456789', + '12.3456789', + '1.23456789', + '0.123456789', + '0.0123456789', + '0.00123456789', + '0.000123456789', + '0.0000123456789', + '0.00000123456789', + '1.23456789e-7', + '1.23456789e-8' + ]; + + var selection = d3.selectAll(SLICES_TEXT_SELECTOR); + for(var i = 0; i < selection[0].length; i++) { + var text = selection[0][i].getAttribute('data-unformatted'); + expect(text).toBe(exp[i]); + } + }) + .catch(failTest) + .then(done); + }); + + it('should handle rounding big & small percents', function(done) { + Plotly.newPlot(gd, [{ + type: 'pie', + textinfo: 'percent', + values: [ + 0.9, + 0.09, + 0.009, + 0.0009, + 0.00009, + 0.000009, + 0.0000009, + 0.00000009, + 0.000000009, + 0.0000000009 + ] + }]) + .then(function() { + var exp = [ + '90%', + '9%', + '0.9%', + '0.09%', + '0.009%', + '0.0009%', + '0.00009%', + '0.000009%', + '9e-7%', + '9e-8%' + ]; + + var selection = d3.selectAll(SLICES_TEXT_SELECTOR); + for(var i = 0; i < selection[0].length; i++) { + var text = selection[0][i].innerHTML; + expect(text).toBe(exp[i]); + } + }) + .catch(failTest) + .then(done); + }); +}); diff --git a/test/jasmine/tests/polar_test.js b/test/jasmine/tests/polar_test.js index e087f2495e4..4278881e027 100644 --- a/test/jasmine/tests/polar_test.js +++ b/test/jasmine/tests/polar_test.js @@ -74,6 +74,7 @@ describe('Test polar plots defaults:', function() { }]; layoutOut = { + autotypenumbers: 'convert types', font: {color: 'red'}, _subplots: {polar: ['polar']} }; @@ -209,6 +210,56 @@ describe('Test polar plots defaults:', function() { expect(layoutOut.polar.radialaxis.hoverformat).toBe('g'); expect(layoutOut.polar.angularaxis.hoverformat).toBe('g'); }); + + it('should disable converting numeric strings using axis.autotypenumbers', function() { + _supply({ + polar: { + radialaxis: { + autotypenumbers: 'strict' + }, + angularaxis: { + autotypenumbers: 'strict' + } + } + }, [{ + visible: true, + type: 'scatterpolar', + r: ['0', '1', '1970', '2000'], + theta: ['0', '1', '1970', '2000'], + subplot: 'polar' + }]); + + expect(layoutOut.polar.angularaxis.autotypenumbers).toBe('strict'); + expect(layoutOut.polar.radialaxis.autotypenumbers).toBe('strict'); + expect(layoutOut.polar.radialaxis.type).toBe('category'); + expect(layoutOut.polar.angularaxis.type).toBe('category'); + }); + + it('should enable converting numeric strings using axis.autotypenumbers and inherit defaults from layout.autotypenumbers', function() { + layoutOut.autotypenumbers = 'strict'; + + _supply({ + polar: { + radialaxis: { + autotypenumbers: 'convert types' + }, + angularaxis: { + autotypenumbers: 'convert types' + } + } + }, [{ + visible: true, + type: 'scatterpolar', + r: ['0', '1', '1970', '2000'], + theta: ['0', '1', '1970', '2000'], + subplot: 'polar' + }]); + + expect(layoutOut.polar.angularaxis.autotypenumbers).toBe('convert types'); + expect(layoutOut.polar.radialaxis.autotypenumbers).toBe('convert types'); + expect(layoutOut.polar.radialaxis.type).toBe('linear'); + expect(layoutOut.polar.angularaxis.type).toBe('linear'); + }); }); describe('Test relayout on polar subplots:', function() { @@ -675,7 +726,7 @@ describe('Test polar interactions:', function() { ]; beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; eventData = ''; eventCnts = {}; gd = createGraphDiv(); @@ -1367,7 +1418,7 @@ describe('Test polar *gridshape linear* interactions', function() { var gd; beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; gd = createGraphDiv(); }); @@ -1595,3 +1646,163 @@ describe('Test polar *gridshape linear* interactions', function() { .then(done); }); }); + + +describe('Polar plots with css transforms', function() { + var gd; + + beforeEach(function() { + gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + function _getLocalPos(element, point) { + var bb = element.getBoundingClientRect(); + return [ + bb.left + point[0], + bb.top + point[1] + ]; + } + + function transformPlot(gd, transformString) { + gd.style.webkitTransform = transformString; + gd.style.MozTransform = transformString; + gd.style.msTransform = transformString; + gd.style.OTransform = transformString; + gd.style.transform = transformString; + } + + function _drag(start, dp) { + var node = d3.select('.polar > .draglayer > .maindrag').node(); + var localStart = _getLocalPos(gd, start); + return drag({node: node, dpos: dp, pos0: localStart}); + } + + function _hover(pos) { + return new Promise(function(resolve, reject) { + var localPos = _getLocalPos(gd, pos); + gd.once('plotly_hover', function(d) { + Lib.clearThrottle(); + resolve(d); + }); + + mouseEvent('mousemove', localPos[0], localPos[1]); + + setTimeout(function() { + reject('plotly_hover did not get called!'); + }, 100); + }); + } + + function _getVisiblePointsData() { + return Array.from( + document.querySelectorAll('.point').entries(), + function(e) { return e[1]; } + ) + .filter(function(e) { return window.getComputedStyle(e).display !== 'none'; }) + .map(function(e) { return e.__data__; }); + } + + var rVals = [100, 50, 50, 100]; + var thetaVals = [135, 135, 315, 315]; + var plotSize = [400, 400]; + var mock = { + data: [{ + type: 'scatterpolar', + r: rVals, + theta: thetaVals, + mode: 'markers', + marker: { + size: 20, + } + }], + layout: { + width: plotSize[0], + height: plotSize[1], + margin: {l: 0, t: 0, r: 0, b: 0}, + hovermode: 'closest' + } + }; + + [{ + transform: 'scaleX(0.75)', + hovered: 1, + zoomed: [0, 1, 2, 3], + selected: {numPoints: 2} + }, { + transform: 'scale(0.5)', + hovered: 4, + zoomed: [0, 3], + selected: {numPoints: 3} + }, { + transform: 'scale(0.5) translate(-200px, 25%)', + hovered: 4, + zoomed: [0, 3], + selected: {numPoints: 3} + }].forEach(function(t) { + var transform = t.transform; + + it('hover behaves correctly after css transform: ' + transform, function(done) { + var hoverEvents = {}; + + Plotly.newPlot(gd, Lib.extendDeep({}, mock)) + .then(function() { + transformPlot(gd, transform); + + gd.on('plotly_hover', function(d) { + hoverEvents[d.points[0].pointIndex] = true; + }); + }) + .then(function() { _hover([32, 32]); }) + .then(function() { _hover([65, 65]); }) + .then(function() { _hover([132, 132]); }) + .then(function() { _hover([165, 165]); }) + .then(function() { + expect(Object.keys(hoverEvents).length).toBe(t.hovered); + }) + .catch(failTest) + .then(done); + }); + + it('drag-zoom behaves correctly after css transform: ' + transform, function(done) { + Plotly.newPlot(gd, Lib.extendDeep({}, mock)) + + .then(function() { + transformPlot(gd, transform); + + return _drag([10, 10], [50, 50]); + }) + .then(function() { + var points = _getVisiblePointsData(); + expect(points.map(function(e) { return e.i; })).toEqual(t.zoomed); + }) + .catch(failTest) + .then(done); + }); + + it('select behaves correctly after css transform: ' + transform, function(done) { + function _assertSelected(expectation) { + var data = gd._fullData[0]; + var points = data.selectedpoints; + expect(typeof(points) !== 'undefined').toBeTrue(); + if(expectation.numPoints) { + expect(points.length).toBe(expectation.numPoints); + } + } + + Plotly.newPlot(gd, Lib.extendDeep({}, mock)) + .then(function() { + transformPlot(gd, transform); + + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { return _drag([30, 30], [130, 130]); }) + .then(function() { + _assertSelected(t.selected); + }) + .catch(failTest) + .then(done); + }); + }); +}); diff --git a/test/jasmine/tests/range_slider_test.js b/test/jasmine/tests/range_slider_test.js index a7232261480..72ebcd18711 100644 --- a/test/jasmine/tests/range_slider_test.js +++ b/test/jasmine/tests/range_slider_test.js @@ -201,6 +201,40 @@ describe('Visible rangesliders', function() { .then(done); }); + it('should not react to any interactions when staticPlot is set', function(done) { + var mockCopy = Lib.extendDeep({}, mock); + var moveDelta = 50; + Plotly.newPlot(gd, mockCopy.data, mockCopy.layout, { staticPlot: true }) + .then(function() { + // Try move minimum handle + var minHandle = d3.select('.' + constants.grabberMinClassName).node(); + expect(minHandle).not.toEqual(null); + var minHandleRect = minHandle.getBoundingClientRect(); + var x = minHandleRect.x + minHandleRect.width / 2; + var y = minHandleRect.y + minHandleRect.height / 2; + return slide(x, y, x + moveDelta, y); + }) + .then(function() { + // Try move maximum handle + var maxHandle = d3.select('.' + constants.grabberMaxClassName).node(); + expect(maxHandle).not.toEqual(null); + var maxHandleRect = maxHandle.getBoundingClientRect(); + var x = maxHandleRect.x + maxHandleRect.width / 2; + var y = maxHandleRect.y + maxHandleRect.height / 2; + return slide(x, y, x - moveDelta, y); + }) + .then(function() { + // Slidebox should not exist + var slidebox = d3.select('.' + constants.slideBoxClassName).node(); + expect(slidebox).toEqual(null); + }) + .then(function() { + expect(gd.layout.xaxis.range).toBeCloseToArray([0, 49]); + }) + .catch(failTest) + .then(done); + }); + it('should update correctly when moving slider on an axis with rangebreaks', function(done) { var start = 250; var end = 300; diff --git a/test/jasmine/tests/scatter3d_test.js b/test/jasmine/tests/scatter3d_test.js index abe1a04bde4..27cdea117bf 100644 --- a/test/jasmine/tests/scatter3d_test.js +++ b/test/jasmine/tests/scatter3d_test.js @@ -106,7 +106,7 @@ describe('Test scatter3d interactions:', function() { beforeEach(function() { gd = createGraphDiv(); - jasmine.DEFAULT_TIMEOUT_INTERVAL = 6000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 12000; }); afterEach(function() { diff --git a/test/jasmine/tests/scattergl_test.js b/test/jasmine/tests/scattergl_test.js index 6dc35e2cb36..4e1c60d10d9 100644 --- a/test/jasmine/tests/scattergl_test.js +++ b/test/jasmine/tests/scattergl_test.js @@ -624,7 +624,7 @@ describe('Test scattergl autorange:', function() { var gd; beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; gd = createGraphDiv(); }); @@ -675,7 +675,7 @@ describe('Test scattergl autorange:', function() { var gd; beforeEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; gd = createGraphDiv(); // to avoid expansive draw calls (which could be problematic on CI) spyOn(ScatterGl, 'plot').and.callFake(function(gd) { diff --git a/test/jasmine/tests/scattermapbox_test.js b/test/jasmine/tests/scattermapbox_test.js index 298d64f7b98..9ce917ea84d 100644 --- a/test/jasmine/tests/scattermapbox_test.js +++ b/test/jasmine/tests/scattermapbox_test.js @@ -656,6 +656,53 @@ describe('scattermapbox convert', function() { expect(opts.line.geojson.coordinates).toEqual([], 'line coords'); expect(opts.fill.geojson.coordinates).toEqual([], 'fill coords'); }); + + it('cluster options', function() { + var opts = _convert(Lib.extendFlat({}, base, { + cluster: { + enabled: true + } + })); + + // Ensure that cluster and clusterCount options is added to options + expect(opts.cluster).toBeInstanceOf(Object); + expect(opts.clusterCount).toBeInstanceOf(Object); + + // Ensure correct type of layers + expect(opts.cluster.type).toEqual('circle'); + expect(opts.clusterCount.type).toEqual('symbol'); + }); + + it('cluster colors, sizes, opacities - array', function() { + var opts = _convert(Lib.extendFlat({}, base, { + cluster: { + enabled: true, + color: 'red', + size: 20, + opacity: 0.25 + } + })); + + expect(opts.cluster.paint['circle-color']).toEqual('red'); + expect(opts.cluster.paint['circle-radius']).toEqual(20); + expect(opts.cluster.paint['circle-opacity']).toEqual(0.25); + }); + + it('cluster colors, sizes, opacities - array', function() { + var opts = _convert(Lib.extendFlat({}, base, { + cluster: { + enabled: true, + step: [10], + color: ['red', 'green'], + size: [20, 40], + opacity: [0.25, 0.75] + } + })); + + expect(opts.cluster.paint['circle-color']).toEqual(['step', ['get', 'point_count'], 'red', 10, 'green']); + expect(opts.cluster.paint['circle-radius']).toEqual(['step', ['get', 'point_count'], 20, 10, 40]); + expect(opts.cluster.paint['circle-opacity']).toEqual(['step', ['get', 'point_count'], 0.25, 10, 0.75]); + }); }); describe('@noCI scattermapbox hover', function() { @@ -951,7 +998,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() { click(pointPos[0], pointPos[1]); var pt = futureData.points[0]; - var evt = futureData.event; expect(Object.keys(pt)).toEqual([ 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat' @@ -963,9 +1009,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() { expect(pt.lat).toEqual(10, 'points[0].lat'); expect(pt.lon).toEqual(10, 'points[0].lon'); expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); - - expect(evt.clientX).toEqual(pointPos[0], 'event.clientX'); - expect(evt.clientY).toEqual(pointPos[1], 'event.clientY'); }); }); @@ -1013,8 +1056,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() { // expect(pt.lon).toEqual(10, 'points[0].lon'); // expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); - // expect(evt.clientX).toEqual(pointPos[0], 'event.clientX'); - // expect(evt.clientY).toEqual(pointPos[1], 'event.clientY'); // Object.getOwnPropertyNames(clickOpts).forEach(function(opt) { // expect(evt[opt]).toEqual(clickOpts[opt], 'event.' + opt); // }); @@ -1035,7 +1076,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() { mouseEvent('mousemove', pointPos[0], pointPos[1]); var pt = futureData.points[0]; - var evt = futureData.event; expect(Object.keys(pt)).toEqual([ 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat' @@ -1047,9 +1087,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() { expect(pt.lat).toEqual(10, 'points[0].lat'); expect(pt.lon).toEqual(10, 'points[0].lon'); expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); - - expect(evt.clientX).toEqual(pointPos[0], 'event.clientX'); - expect(evt.clientY).toEqual(pointPos[1], 'event.clientY'); }); }); @@ -1065,7 +1102,6 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() { it('@gl should contain the correct fields', function(done) { move(pointPos[0], pointPos[1], nearPos[0], nearPos[1], HOVERMINTIME + 10).then(function() { var pt = futureData.points[0]; - var evt = futureData.event; expect(Object.keys(pt)).toEqual([ 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat' @@ -1077,9 +1113,130 @@ describe('@noCI Test plotly events on a scattermapbox plot:', function() { expect(pt.lat).toEqual(10, 'points[0].lat'); expect(pt.lon).toEqual(10, 'points[0].lon'); expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); + }).then(done); + }); + }); +}); + +describe('@noCI Test plotly events on a scattermapbox plot when css transform is present:', function() { + var mock = require('@mocks/mapbox_0.json'); + var pointPos = [440 / 2, 290 / 2]; + var nearPos = [460 / 2, 290 / 2]; + var blankPos = [10 / 2, 10 / 2]; + var mockCopy; + var gd; + + function transformPlot(gd, transformString) { + gd.style.webkitTransform = transformString; + gd.style.MozTransform = transformString; + gd.style.msTransform = transformString; + gd.style.OTransform = transformString; + gd.style.transform = transformString; + } + + beforeAll(function() { + Plotly.setPlotConfig({ + mapboxAccessToken: require('@build/credentials.json').MAPBOX_ACCESS_TOKEN + }); + }); + + beforeEach(function(done) { + gd = createGraphDiv(); + mockCopy = Lib.extendDeep({}, mock); + mockCopy.layout.width = 800; + mockCopy.layout.height = 500; + + Plotly.plot(gd, mockCopy) + .then(function() { transformPlot(gd, 'translate(-25%, -25%) scale(0.5)'); }) + .then(done); + }); + + afterEach(destroyGraphDiv); + + describe('click events', function() { + var futureData; + + beforeEach(function() { + futureData = undefined; + gd.on('plotly_click', function(data) { + futureData = data; + }); + }); + + it('@gl should not be trigged when not on data points', function() { + click(blankPos[0], blankPos[1]); + expect(futureData).toBe(undefined); + }); + + it('@gl should contain the correct fields', function() { + click(pointPos[0], pointPos[1]); - expect(evt.clientX).toEqual(nearPos[0], 'event.clientX'); - expect(evt.clientY).toEqual(nearPos[1], 'event.clientY'); + var pt = futureData.points[0]; + + expect(Object.keys(pt)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat' + ]); + + expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber'); + expect(typeof pt.data).toEqual(typeof {}, 'points[0].data'); + expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData'); + expect(pt.lat).toEqual(10, 'points[0].lat'); + expect(pt.lon).toEqual(10, 'points[0].lon'); + expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); + }); + }); + + describe('hover events', function() { + var futureData; + + beforeEach(function() { + gd.on('plotly_hover', function(data) { + futureData = data; + }); + }); + + it('@gl should contain the correct fields', function() { + mouseEvent('mousemove', blankPos[0], blankPos[1]); + mouseEvent('mousemove', pointPos[0], pointPos[1]); + + var pt = futureData.points[0]; + + expect(Object.keys(pt)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat' + ]); + + expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber'); + expect(typeof pt.data).toEqual(typeof {}, 'points[0].data'); + expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData'); + expect(pt.lat).toEqual(10, 'points[0].lat'); + expect(pt.lon).toEqual(10, 'points[0].lon'); + expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); + }); + }); + + describe('unhover events', function() { + var futureData; + + beforeEach(function() { + gd.on('plotly_unhover', function(data) { + futureData = data; + }); + }); + + it('@gl should contain the correct fields', function(done) { + move(pointPos[0], pointPos[1], nearPos[0], nearPos[1], HOVERMINTIME + 10).then(function() { + var pt = futureData.points[0]; + + expect(Object.keys(pt)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', 'lon', 'lat' + ]); + + expect(pt.curveNumber).toEqual(0, 'points[0].curveNumber'); + expect(typeof pt.data).toEqual(typeof {}, 'points[0].data'); + expect(typeof pt.fullData).toEqual(typeof {}, 'points[0].fullData'); + expect(pt.lat).toEqual(10, 'points[0].lat'); + expect(pt.lon).toEqual(10, 'points[0].lon'); + expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber'); }).then(done); }); }); diff --git a/test/jasmine/tests/select_test.js b/test/jasmine/tests/select_test.js index fbcc5261fa3..e032731ab21 100644 --- a/test/jasmine/tests/select_test.js +++ b/test/jasmine/tests/select_test.js @@ -1836,10 +1836,32 @@ describe('Test select box and lasso per trace:', function() { }; } - function _run(dragPath, afterDragFn, dblClickPos, eventCounts, msg) { + function transformPlot(gd, transformString) { + gd.style.webkitTransform = transformString; + gd.style.MozTransform = transformString; + gd.style.msTransform = transformString; + gd.style.OTransform = transformString; + gd.style.transform = transformString; + } + + var cssTransform = 'translate(-25%, -25%) scale(0.5)'; + + function _run(hasCssTransform, dragPath, afterDragFn, dblClickPos, eventCounts, msg) { afterDragFn = afterDragFn || function() {}; dblClickPos = dblClickPos || [250, 200]; + var scale = 1; + if(hasCssTransform) { + scale = 0.5; + } + dblClickPos[0] *= scale; + dblClickPos[1] *= scale; + for(var i = 0; i < dragPath.length; i++) { + for(var j = 0; j < dragPath[i].length; j++) { + dragPath[i][j] *= scale; + } + } + resetEvents(gd); assertSelectionNodes(0, 0); @@ -1862,1018 +1884,1011 @@ describe('Test select box and lasso per trace:', function() { }); } - it('@flaky should work on scatterternary traces', function(done) { - var assertPoints = makeAssertPoints(['a', 'b', 'c']); - var assertSelectedPoints = makeAssertSelectedPoints(); - - var fig = Lib.extendDeep({}, require('@mocks/ternary_simple')); - fig.layout.width = 800; - fig.layout.dragmode = 'select'; - addInvisible(fig); - - Plotly.plot(gd, fig).then(function() { - return _run( - [[400, 200], [445, 235]], - function() { - assertPoints([[0.5, 0.25, 0.25]]); - assertSelectedPoints({0: [0]}); - }, - [380, 180], - BOXEVENTS, 'scatterternary select' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'lasso'); - }) - .then(function() { - return _run( - [[400, 200], [445, 200], [445, 235], [400, 235], [400, 200]], - function() { - assertPoints([[0.5, 0.25, 0.25]]); - assertSelectedPoints({0: [0]}); - }, - [380, 180], - LASSOEVENTS, 'scatterternary lasso' - ); - }) - .then(function() { - // should work after a relayout too - return Plotly.relayout(gd, 'width', 400); - }) - .then(function() { - return _run( - [[200, 200], [230, 200], [230, 230], [200, 230], [200, 200]], - function() { - assertPoints([[0.5, 0.25, 0.25]]); - assertSelectedPoints({0: [0]}); - }, - [180, 180], - LASSOEVENTS, 'scatterternary lasso after relayout' - ); - }) - .catch(failTest) - .then(done); - }); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work on scatterternary traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['a', 'b', 'c']); + var assertSelectedPoints = makeAssertSelectedPoints(); - it('@flaky should work on scattercarpet traces', function(done) { - var assertPoints = makeAssertPoints(['a', 'b']); - var assertSelectedPoints = makeAssertSelectedPoints(); + var fig = Lib.extendDeep({}, require('@mocks/ternary_simple')); + fig.layout.width = 800; + fig.layout.dragmode = 'select'; + addInvisible(fig); - var fig = Lib.extendDeep({}, require('@mocks/scattercarpet')); - delete fig.data[6].selectedpoints; - fig.layout.dragmode = 'select'; - addInvisible(fig); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); - Plotly.plot(gd, fig).then(function() { - return _run( - [[300, 200], [400, 250]], - function() { - assertPoints([[0.2, 1.5]]); - assertSelectedPoints({1: [], 2: [], 3: [], 4: [], 5: [1], 6: []}); - }, - null, BOXEVENTS, 'scattercarpet select' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'lasso'); - }) - .then(function() { - return _run( - [[300, 200], [400, 200], [400, 250], [300, 250], [300, 200]], - function() { - assertPoints([[0.2, 1.5]]); - assertSelectedPoints({1: [], 2: [], 3: [], 4: [], 5: [1], 6: []}); - }, - null, LASSOEVENTS, 'scattercarpet lasso' - ); - }) - .catch(failTest) - .then(done); + return _run(hasCssTransform, + [[400, 200], [445, 235]], + function() { + assertPoints([[0.5, 0.25, 0.25]]); + assertSelectedPoints({0: [0]}); + }, + [380, 180], + BOXEVENTS, 'scatterternary select' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'lasso'); + }) + .then(function() { + return _run(hasCssTransform, + [[400, 200], [445, 200], [445, 235], [400, 235], [400, 200]], + function() { + assertPoints([[0.5, 0.25, 0.25]]); + assertSelectedPoints({0: [0]}); + }, + [380, 180], + LASSOEVENTS, 'scatterternary lasso' + ); + }) + .then(function() { + // should work after a relayout too + return Plotly.relayout(gd, 'width', 400); + }) + .then(function() { + return _run(hasCssTransform, + [[200, 200], [230, 200], [230, 230], [200, 230], [200, 200]], + function() { + assertPoints([[0.5, 0.25, 0.25]]); + assertSelectedPoints({0: [0]}); + }, + [180, 180], + LASSOEVENTS, 'scatterternary lasso after relayout' + ); + }) + .catch(failTest) + .then(done); + }); }); - it('@noCI @gl should work on scattermapbox traces', function(done) { - var assertPoints = makeAssertPoints(['lon', 'lat']); - var assertRanges = makeAssertRanges('mapbox'); - var assertLassoPoints = makeAssertLassoPoints('mapbox'); - var assertSelectedPoints = makeAssertSelectedPoints(); - - var fig = Lib.extendDeep({}, require('@mocks/mapbox_bubbles-text')); - - fig.data[0].lon.push(null); - fig.data[0].lat.push(null); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work on scattercarpet traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['a', 'b']); + var assertSelectedPoints = makeAssertSelectedPoints(); - fig.layout.dragmode = 'select'; - fig.config = { - mapboxAccessToken: require('@build/credentials.json').MAPBOX_ACCESS_TOKEN - }; - addInvisible(fig); + var fig = Lib.extendDeep({}, require('@mocks/scattercarpet')); + delete fig.data[6].selectedpoints; + fig.layout.dragmode = 'select'; + addInvisible(fig); - Plotly.plot(gd, fig).then(function() { - return _run( - [[370, 120], [500, 200]], - function() { - assertPoints([[30, 30]]); - assertRanges([[21.99, 34.55], [38.14, 25.98]]); - assertSelectedPoints({0: [2]}); - }, - null, BOXEVENTS, 'scattermapbox select' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'lasso'); - }) - .then(function() { - return _run( - [[300, 200], [300, 300], [400, 300], [400, 200], [300, 200]], - function() { - assertPoints([[20, 20]]); - assertSelectedPoints({0: [1]}); - assertLassoPoints([ - [13.28, 25.97], [13.28, 14.33], [25.71, 14.33], [25.71, 25.97], [13.28, 25.97] - ]); - }, - null, LASSOEVENTS, 'scattermapbox lasso' - ); - }) - .then(function() { - // make selection handlers don't get called in 'pan' dragmode - return Plotly.relayout(gd, 'dragmode', 'pan'); - }) - .then(function() { - return _run( - [[370, 120], [500, 200]], null, null, NOEVENTS, 'scattermapbox pan' - ); - }) - .catch(failTest) - .then(done); - }, LONG_TIMEOUT_INTERVAL); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); - it('@noCI @gl should work on choroplethmapbox traces', function(done) { - var assertPoints = makeAssertPoints(['location', 'z']); - var assertRanges = makeAssertRanges('mapbox'); - var assertLassoPoints = makeAssertLassoPoints('mapbox'); - var assertSelectedPoints = makeAssertSelectedPoints(); + return _run(hasCssTransform, + [[300, 200], [400, 250]], + function() { + assertPoints([[0.2, 1.5]]); + assertSelectedPoints({1: [], 2: [], 3: [], 4: [], 5: [1], 6: []}); + }, + null, BOXEVENTS, 'scattercarpet select' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'lasso'); + }) + .then(function() { + return _run(hasCssTransform, + [[300, 200], [400, 200], [400, 250], [300, 250], [300, 200]], + function() { + assertPoints([[0.2, 1.5]]); + assertSelectedPoints({1: [], 2: [], 3: [], 4: [], 5: [1], 6: []}); + }, + null, LASSOEVENTS, 'scattercarpet lasso' + ); + }) + .catch(failTest) + .then(done); + }); + }); - var fig = Lib.extendDeep({}, require('@mocks/mapbox_choropleth0.json')); + [false, true].forEach(function(hasCssTransform) { + it('@noCI @gl should work on scattermapbox traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['lon', 'lat']); + var assertRanges = makeAssertRanges('mapbox'); + var assertLassoPoints = makeAssertLassoPoints('mapbox'); + var assertSelectedPoints = makeAssertSelectedPoints(); - fig.data[0].locations.push(null); + var fig = Lib.extendDeep({}, require('@mocks/mapbox_bubbles-text')); - fig.layout.dragmode = 'select'; - fig.config = { - mapboxAccessToken: require('@build/credentials.json').MAPBOX_ACCESS_TOKEN - }; - addInvisible(fig); + fig.data[0].lon.push(null); + fig.data[0].lat.push(null); - Plotly.plot(gd, fig).then(function() { - return _run( - [[150, 150], [300, 300]], - function() { - assertPoints([['NY', 10]]); - assertRanges([[-83.29, 46.13], [-73.97, 39.29]]); - assertSelectedPoints({0: [0]}); - }, - null, BOXEVENTS, 'choroplethmapbox select' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'lasso'); - }) - .then(function() { - return _run( - [[300, 200], [300, 300], [400, 300], [400, 200], [300, 200]], - function() { - assertPoints([['MA', 20]]); - assertSelectedPoints({0: [1]}); - assertLassoPoints([ - [-73.97, 43.936], [-73.97, 39.293], [-67.756, 39.293], - [-67.756, 43.936], [-73.971, 43.936] - ]); - }, - null, LASSOEVENTS, 'choroplethmapbox lasso' - ); - }) - .catch(failTest) - .then(done); - }, LONG_TIMEOUT_INTERVAL); - - it('@flaky should work on scattergeo traces', function(done) { - var assertPoints = makeAssertPoints(['lon', 'lat']); - var assertSelectedPoints = makeAssertSelectedPoints(); - var assertRanges = makeAssertRanges('geo'); - var assertLassoPoints = makeAssertLassoPoints('geo'); - - function assertNodeOpacity(exp) { - var traces = d3.select(gd).selectAll('.scatterlayer > .trace'); - expect(traces.size()).toBe(Object.keys(exp).length, 'correct # of trace '); - - traces.each(function(_, i) { - d3.select(this).selectAll('path.point').each(function(_, j) { - expect(Number(this.style.opacity)) - .toBe(exp[i][j], 'node opacity - trace ' + i + ' pt ' + j); - }); - }); - } + fig.layout.dragmode = 'select'; + fig.config = { + mapboxAccessToken: require('@build/credentials.json').MAPBOX_ACCESS_TOKEN + }; + addInvisible(fig); - var fig = { - data: [{ - type: 'scattergeo', - lon: [10, 20, 30, null], - lat: [10, 20, 30, null] - }, { - type: 'scattergeo', - lon: [-10, -20, -30], - lat: [10, 20, 30] - }], - layout: { - showlegend: false, - dragmode: 'select', - width: 800, - height: 600 - } - }; - addInvisible(fig); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[350, 200], [450, 400]], - function() { - assertPoints([[10, 10], [20, 20], [-10, 10], [-20, 20]]); - assertSelectedPoints({0: [0, 1], 1: [0, 1]}); - assertNodeOpacity({0: [1, 1, 0.2], 1: [1, 1, 0.2]}); - assertRanges([[-28.13, 61.88], [28.13, -50.64]]); - }, - null, BOXEVENTS, 'scattergeo select' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'lasso'); - }) - .then(function() { - return _run( - [[300, 200], [300, 300], [400, 300], [400, 200], [300, 200]], - function() { - assertPoints([[-10, 10], [-20, 20], [-30, 30]]); - assertSelectedPoints({0: [], 1: [0, 1, 2]}); - assertNodeOpacity({0: [0.2, 0.2, 0.2], 1: [1, 1, 1]}); - assertLassoPoints([ - [-56.25, 61.88], [-56.24, 5.63], [0, 5.63], [0, 61.88], [-56.25, 61.88] - ]); - }, - null, LASSOEVENTS, 'scattergeo lasso' - ); - }) - .then(function() { - // some projection types can't handle BADNUM during c2p, - // make they are skipped here - return Plotly.relayout(gd, 'geo.projection.type', 'robinson'); - }) - .then(function() { - return _run( - [[300, 200], [300, 300], [400, 300], [400, 200], [300, 200]], - function() { - assertPoints([[-10, 10], [-20, 20], [-30, 30]]); - assertSelectedPoints({0: [], 1: [0, 1, 2]}); - assertNodeOpacity({0: [0.2, 0.2, 0.2], 1: [1, 1, 1]}); - assertLassoPoints([ - [-67.40, 55.07], [-56.33, 4.968], [0, 4.968], [0, 55.07], [-67.40, 55.07] - ]); - }, - null, LASSOEVENTS, 'scattergeo lasso (on robinson projection)' - ); - }) - .then(function() { - // make sure selection handlers don't get called in 'pan' dragmode - return Plotly.relayout(gd, 'dragmode', 'pan'); - }) - .then(function() { - return _run( - [[370, 120], [500, 200]], null, null, NOEVENTS, 'scattergeo pan' - ); - }) - .catch(failTest) - .then(done); - }, LONG_TIMEOUT_INTERVAL); + return _run(hasCssTransform, + [[370, 120], [500, 200]], + function() { + assertPoints([[30, 30]]); + assertRanges([[21.99, 34.55], [38.14, 25.98]]); + assertSelectedPoints({0: [2]}); + }, + null, BOXEVENTS, 'scattermapbox select' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'lasso'); + }) + .then(function() { + return _run(hasCssTransform, + [[300, 200], [300, 300], [400, 300], [400, 200], [300, 200]], + function() { + assertPoints([[20, 20]]); + assertSelectedPoints({0: [1]}); + assertLassoPoints([ + [13.28, 25.97], [13.28, 14.33], [25.71, 14.33], [25.71, 25.97], [13.28, 25.97] + ]); + }, + null, LASSOEVENTS, 'scattermapbox lasso' + ); + }) + .then(function() { + // make selection handlers don't get called in 'pan' dragmode + return Plotly.relayout(gd, 'dragmode', 'pan'); + }) + .then(function() { + return _run(hasCssTransform, + [[370, 120], [500, 200]], null, null, NOEVENTS, 'scattermapbox pan' + ); + }) + .catch(failTest) + .then(done); + }, LONG_TIMEOUT_INTERVAL); + }); - it('@flaky should work on scatterpolar traces', function(done) { - var assertPoints = makeAssertPoints(['r', 'theta']); - var assertSelectedPoints = makeAssertSelectedPoints(); + [false, true].forEach(function(hasCssTransform) { + it('@noCI @gl should work on choroplethmapbox traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['location', 'z']); + var assertRanges = makeAssertRanges('mapbox'); + var assertLassoPoints = makeAssertLassoPoints('mapbox'); + var assertSelectedPoints = makeAssertSelectedPoints(); - var fig = Lib.extendDeep({}, require('@mocks/polar_subplots')); - fig.layout.width = 800; - fig.layout.dragmode = 'select'; - addInvisible(fig); + var fig = Lib.extendDeep({}, require('@mocks/mapbox_choropleth0.json')); - Plotly.plot(gd, fig).then(function() { - return _run( - [[150, 150], [350, 250]], - function() { - assertPoints([[1, 0], [2, 45]]); - assertSelectedPoints({0: [0, 1]}); - }, - [200, 200], - BOXEVENTS, 'scatterpolar select' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'lasso'); - }) - .then(function() { - return _run( - [[150, 150], [350, 150], [350, 250], [150, 250], [150, 150]], - function() { - assertPoints([[1, 0], [2, 45]]); - assertSelectedPoints({0: [0, 1]}); - }, - [200, 200], - LASSOEVENTS, 'scatterpolar lasso' - ); - }) - .catch(failTest) - .then(done); - }); + fig.data[0].locations.push(null); - it('@flaky should work on barpolar traces', function(done) { - var assertPoints = makeAssertPoints(['r', 'theta']); - var assertSelectedPoints = makeAssertSelectedPoints(); + fig.layout.dragmode = 'select'; + fig.config = { + mapboxAccessToken: require('@build/credentials.json').MAPBOX_ACCESS_TOKEN + }; + addInvisible(fig); - var fig = Lib.extendDeep({}, require('@mocks/polar_wind-rose.json')); - fig.layout.showlegend = false; - fig.layout.width = 500; - fig.layout.height = 500; - fig.layout.dragmode = 'select'; - addInvisible(fig); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); - Plotly.plot(gd, fig).then(function() { - return _run( - [[150, 150], [250, 250]], - function() { - assertPoints([ - [62.5, 'N-W'], [55, 'N-W'], [40, 'North'], - [40, 'N-W'], [20, 'North'], [22.5, 'N-W'] - ]); - assertSelectedPoints({ - 0: [7], - 1: [7], - 2: [0, 7], - 3: [0, 7] - }); - }, - [200, 200], - BOXEVENTS, 'barpolar select' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'lasso'); - }) - .then(function() { - return _run( - [[150, 150], [350, 150], [350, 250], [150, 250], [150, 150]], - function() { - assertPoints([ - [62.5, 'N-W'], [50, 'N-E'], [55, 'N-W'], [40, 'North'], - [30, 'N-E'], [40, 'N-W'], [20, 'North'], [7.5, 'N-E'], [22.5, 'N-W'] - ]); - assertSelectedPoints({ - 0: [7], - 1: [1, 7], - 2: [0, 1, 7], - 3: [0, 1, 7] - }); - }, - [200, 200], - LASSOEVENTS, 'barpolar lasso' - ); - }) - .catch(failTest) - .then(done); + return _run(hasCssTransform, + [[150, 150], [300, 300]], + function() { + assertPoints([['NY', 10]]); + assertRanges([[-83.29, 46.13], [-73.97, 39.29]]); + assertSelectedPoints({0: [0]}); + }, + null, BOXEVENTS, 'choroplethmapbox select' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'lasso'); + }) + .then(function() { + return _run(hasCssTransform, + [[300, 200], [300, 300], [400, 300], [400, 200], [300, 200]], + function() { + assertPoints([['MA', 20]]); + assertSelectedPoints({0: [1]}); + assertLassoPoints([ + [-73.97, 43.936], [-73.97, 39.293], [-67.756, 39.293], + [-67.756, 43.936], [-73.971, 43.936] + ]); + }, + null, LASSOEVENTS, 'choroplethmapbox lasso' + ); + }) + .catch(failTest) + .then(done); + }, LONG_TIMEOUT_INTERVAL); }); - it('@flaky should work on choropleth traces', function(done) { - var assertPoints = makeAssertPoints(['location', 'z']); - var assertSelectedPoints = makeAssertSelectedPoints(); - var assertRanges = makeAssertRanges('geo', -0.5); - var assertLassoPoints = makeAssertLassoPoints('geo', -0.5); - - var fig = Lib.extendDeep({}, require('@mocks/geo_choropleth-text')); - fig.layout.width = 870; - fig.layout.height = 450; - fig.layout.dragmode = 'select'; - fig.layout.geo.scope = 'europe'; - addInvisible(fig, false); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work on scattergeo traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['lon', 'lat']); + var assertSelectedPoints = makeAssertSelectedPoints(); + var assertRanges = makeAssertRanges('geo'); + var assertLassoPoints = makeAssertLassoPoints('geo'); - // add a trace with no locations which will then make trace invisible, lacking DOM elements - var emptyChoroplethTrace = Lib.extendDeep({}, fig.data[0]); - emptyChoroplethTrace.text = []; - emptyChoroplethTrace.locations = []; - emptyChoroplethTrace.z = []; - fig.data.push(emptyChoroplethTrace); + function assertNodeOpacity(exp) { + var traces = d3.select(gd).selectAll('.scatterlayer > .trace'); + expect(traces.size()).toBe(Object.keys(exp).length, 'correct # of trace '); - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[350, 200], [400, 250]], - function() { - assertPoints([['GBR', 26.507354205352502], ['IRL', 86.4125147625692]]); - assertSelectedPoints({0: [43, 54]}); - assertRanges([[-19.11, 63.06], [7.31, 53.72]]); - }, - [280, 190], - BOXEVENTS, 'choropleth select' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'lasso'); - }) - .then(function() { - return _run( - [[350, 200], [400, 200], [400, 250], [350, 250], [350, 200]], - function() { - assertPoints([['GBR', 26.507354205352502], ['IRL', 86.4125147625692]]); - assertSelectedPoints({0: [43, 54]}); - assertLassoPoints([ - [-19.11, 63.06], [5.50, 65.25], [7.31, 53.72], [-12.90, 51.70], [-19.11, 63.06] - ]); - }, - [280, 190], - LASSOEVENTS, 'choropleth lasso' - ); - }) - .then(function() { - // make selection handlers don't get called in 'pan' dragmode - return Plotly.relayout(gd, 'dragmode', 'pan'); - }) - .then(function() { - return _run( - [[370, 120], [500, 200]], null, [200, 180], NOEVENTS, 'choropleth pan' - ); - }) - .catch(failTest) - .then(done); - }, LONG_TIMEOUT_INTERVAL); + traces.each(function(_, i) { + d3.select(this).selectAll('path.point').each(function(_, j) { + expect(Number(this.style.opacity)) + .toBe(exp[i][j], 'node opacity - trace ' + i + ' pt ' + j); + }); + }); + } - it('@flaky should work for waterfall traces', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']); - var assertSelectedPoints = makeAssertSelectedPoints(); - var assertRanges = makeAssertRanges(); - var assertLassoPoints = makeAssertLassoPoints(); + var fig = { + data: [{ + type: 'scattergeo', + lon: [10, 20, 30, null], + lat: [10, 20, 30, null] + }, { + type: 'scattergeo', + lon: [-10, -20, -30], + lat: [10, 20, 30] + }], + layout: { + showlegend: false, + dragmode: 'select', + width: 800, + height: 600 + } + }; + addInvisible(fig); - var fig = Lib.extendDeep({}, require('@mocks/waterfall_profit-loss_2018_positive-negative')); - fig.layout.dragmode = 'lasso'; - addInvisible(fig); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[400, 300], [200, 400], [400, 500], [600, 400], [500, 350]], - function() { - assertPoints([ - [0, 281, 'Purchases'], - [0, 269, 'Material expenses'], - [0, 191, 'Personnel expenses'], - [0, 179, 'Other expenses'] - ]); - assertSelectedPoints({ - 0: [5, 6, 7, 8] - }); - assertLassoPoints([ - [288.8086, 57.7617, 288.8086, 519.8555, 404.3321], - [4.33870, 6.7580, 9.1774, 6.75806, 5.54838] - ]); - }, - null, LASSOEVENTS, 'waterfall lasso' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'select'); - }) - .then(function() { - return _run( - [[300, 300], [400, 400]], - function() { - assertPoints([ - [0, 281, 'Purchases'], - [0, 269, 'Material expenses'] - ]); - assertSelectedPoints({ - 0: [5, 6] - }); - assertRanges([ - [173.28519, 288.8086], - [4.3387, 6.7580] - ]); - }, - null, BOXEVENTS, 'waterfall select' - ); - }) - .catch(failTest) - .then(done); + return _run(hasCssTransform, + [[350, 200], [450, 400]], + function() { + assertPoints([[10, 10], [20, 20], [-10, 10], [-20, 20]]); + assertSelectedPoints({0: [0, 1], 1: [0, 1]}); + assertNodeOpacity({0: [1, 1, 0.2], 1: [1, 1, 0.2]}); + assertRanges([[-28.13, 61.88], [28.13, -50.64]]); + }, + null, BOXEVENTS, 'scattergeo select' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'lasso'); + }) + .then(function() { + return _run(hasCssTransform, + [[300, 200], [300, 300], [400, 300], [400, 200], [300, 200]], + function() { + assertPoints([[-10, 10], [-20, 20], [-30, 30]]); + assertSelectedPoints({0: [], 1: [0, 1, 2]}); + assertNodeOpacity({0: [0.2, 0.2, 0.2], 1: [1, 1, 1]}); + assertLassoPoints([ + [-56.25, 61.88], [-56.24, 5.63], [0, 5.63], [0, 61.88], [-56.25, 61.88] + ]); + }, + null, LASSOEVENTS, 'scattergeo lasso' + ); + }) + .then(function() { + // some projection types can't handle BADNUM during c2p, + // make they are skipped here + return Plotly.relayout(gd, 'geo.projection.type', 'robinson'); + }) + .then(function() { + return _run(hasCssTransform, + [[300, 200], [300, 300], [400, 300], [400, 200], [300, 200]], + function() { + assertPoints([[-10, 10], [-20, 20], [-30, 30]]); + assertSelectedPoints({0: [], 1: [0, 1, 2]}); + assertNodeOpacity({0: [0.2, 0.2, 0.2], 1: [1, 1, 1]}); + assertLassoPoints([ + [-67.40, 55.07], [-56.33, 4.968], [0, 4.968], [0, 55.07], [-67.40, 55.07] + ]); + }, + null, LASSOEVENTS, 'scattergeo lasso (on robinson projection)' + ); + }) + .then(function() { + // make sure selection handlers don't get called in 'pan' dragmode + return Plotly.relayout(gd, 'dragmode', 'pan'); + }) + .then(function() { + return _run(hasCssTransform, + [[370, 120], [500, 200]], null, null, NOEVENTS, 'scattergeo pan' + ); + }) + .catch(failTest) + .then(done); + }, LONG_TIMEOUT_INTERVAL); }); - it('@flaky should work for funnel traces', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']); - var assertSelectedPoints = makeAssertSelectedPoints(); - var assertRanges = makeAssertRanges(); - var assertLassoPoints = makeAssertLassoPoints(); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work on scatterpolar traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['r', 'theta']); + var assertSelectedPoints = makeAssertSelectedPoints(); - var fig = Lib.extendDeep({}, require('@mocks/funnel_horizontal_group_basic')); - fig.layout.dragmode = 'lasso'; - addInvisible(fig); + var fig = Lib.extendDeep({}, require('@mocks/polar_subplots')); + fig.layout.width = 800; + fig.layout.dragmode = 'select'; + addInvisible(fig); - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[400, 300], [200, 400], [400, 500], [600, 400], [500, 350]], - function() { - assertPoints([ - [0, 331.5, 'Author: etpinard'], - [1, 53.5, 'Pull requests'], - [1, 15.5, 'Author: etpinard'], - ]); - assertSelectedPoints({ - 0: [2], - 1: [1, 2] - }); - assertLassoPoints([ - [-161.6974, -1701.6728, -161.6974, 1378.2779, 608.2902], - [1.1129, 1.9193, 2.7258, 1.9193, 1.5161] - ]); - }, - null, LASSOEVENTS, 'funnel lasso' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'select'); - }) - .then(function() { - return _run( - [[300, 300], [500, 500]], - function() { - assertPoints([ - [0, 331.5, 'Author: etpinard'], - [1, 53.5, 'Pull requests'], - [1, 15.5, 'Author: etpinard'] - ]); - assertSelectedPoints({ - 0: [2], - 1: [1, 2] - }); - assertRanges([ - [-931.6851, 608.2902], - [1.1129, 2.7258] - ]); - }, - null, BOXEVENTS, 'funnel select' - ); - }) - .catch(failTest) - .then(done); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[150, 150], [350, 250]], + function() { + assertPoints([[1, 0], [2, 45]]); + assertSelectedPoints({0: [0, 1]}); + }, + [200, 200], + BOXEVENTS, 'scatterpolar select' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'lasso'); + }) + .then(function() { + return _run(hasCssTransform, + [[150, 150], [350, 150], [350, 250], [150, 250], [150, 150]], + function() { + assertPoints([[1, 0], [2, 45]]); + assertSelectedPoints({0: [0, 1]}); + }, + [200, 200], + LASSOEVENTS, 'scatterpolar lasso' + ); + }) + .catch(failTest) + .then(done); + }); }); - it('@flaky should work for bar traces', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']); - var assertSelectedPoints = makeAssertSelectedPoints(); - var assertRanges = makeAssertRanges(); - var assertLassoPoints = makeAssertLassoPoints(); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work on barpolar traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['r', 'theta']); + var assertSelectedPoints = makeAssertSelectedPoints(); - var fig = Lib.extendDeep({}, require('@mocks/0')); - fig.layout.dragmode = 'lasso'; - addInvisible(fig); + var fig = Lib.extendDeep({}, require('@mocks/polar_wind-rose.json')); + fig.layout.showlegend = false; + fig.layout.width = 500; + fig.layout.height = 500; + fig.layout.dragmode = 'select'; + addInvisible(fig); - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[350, 200], [400, 200], [400, 250], [350, 250], [350, 200]], - function() { - assertPoints([ - [0, 4.9, 0.371], [0, 5, 0.368], [0, 5.1, 0.356], [0, 5.2, 0.336], - [0, 5.3, 0.309], [0, 5.4, 0.275], [0, 5.5, 0.235], [0, 5.6, 0.192], - [0, 5.7, 0.145], - [1, 5.1, 0.485], [1, 5.2, 0.409], [1, 5.3, 0.327], - [1, 5.4, 0.24], [1, 5.5, 0.149], [1, 5.6, 0.059], - [2, 4.9, 0.473], [2, 5, 0.368], [2, 5.1, 0.258], - [2, 5.2, 0.146], [2, 5.3, 0.036] - ]); - assertSelectedPoints({ - 0: [49, 50, 51, 52, 53, 54, 55, 56, 57], - 1: [51, 52, 53, 54, 55, 56], - 2: [49, 50, 51, 52, 53] - }); - assertLassoPoints([ - [4.87, 5.74, 5.74, 4.87, 4.87], - [0.53, 0.53, -0.02, -0.02, 0.53] - ]); - }, - null, LASSOEVENTS, 'bar lasso' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'select'); - }) - .then(delay(100)) - .then(function() { - return _run( - [[350, 200], [370, 220]], - function() { - assertPoints([ - [0, 4.9, 0.371], [0, 5, 0.368], [0, 5.1, 0.356], [0, 5.2, 0.336], - [1, 5.1, 0.485], [1, 5.2, 0.41], - [2, 4.9, 0.473], [2, 5, 0.37] - ]); - assertSelectedPoints({ - 0: [49, 50, 51, 52], - 1: [51, 52], - 2: [49, 50] - }); - assertRanges([[4.87, 5.22], [0.31, 0.53]]); - }, - null, BOXEVENTS, 'bar select' - ); - }) - .then(function() { - // mimic https://github.com/plotly/plotly.js/issues/3795 - return Plotly.relayout(gd, { - 'xaxis.rangeslider.visible': true, - 'xaxis.range': [0, 6] - }); - }) - .then(function() { - return _run( - [[350, 200], [360, 200]], - function() { - assertPoints([ - [0, 2.5, -0.429], [1, 2.5, -1.015], [2, 2.5, -1.172], - ]); - assertSelectedPoints({ - 0: [25], - 1: [25], - 2: [25] - }); - assertRanges([[2.434, 2.521], [-1.4355, 2.0555]]); - }, - null, BOXEVENTS, 'bar select (after xaxis.range relayout)' - ); - }) - .catch(failTest) - .then(done); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[150, 150], [250, 250]], + function() { + assertPoints([ + [62.5, 'N-W'], [55, 'N-W'], [40, 'North'], + [40, 'N-W'], [20, 'North'], [22.5, 'N-W'] + ]); + assertSelectedPoints({ + 0: [7], + 1: [7], + 2: [0, 7], + 3: [0, 7] + }); + }, + [200, 200], + BOXEVENTS, 'barpolar select' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'lasso'); + }) + .then(function() { + return _run(hasCssTransform, + [[150, 150], [350, 150], [350, 250], [150, 250], [150, 150]], + function() { + assertPoints([ + [62.5, 'N-W'], [50, 'N-E'], [55, 'N-W'], [40, 'North'], + [30, 'N-E'], [40, 'N-W'], [20, 'North'], [7.5, 'N-E'], [22.5, 'N-W'] + ]); + assertSelectedPoints({ + 0: [7], + 1: [1, 7], + 2: [0, 1, 7], + 3: [0, 1, 7] + }); + }, + [200, 200], + LASSOEVENTS, 'barpolar lasso' + ); + }) + .catch(failTest) + .then(done); + }); }); - it('@flaky should work for date/category traces', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']); - var assertSelectedPoints = makeAssertSelectedPoints(); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work on choropleth traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['location', 'z']); + var assertSelectedPoints = makeAssertSelectedPoints(); + var assertRanges = makeAssertRanges('geo', -0.5); + var assertLassoPoints = makeAssertLassoPoints('geo', -0.5); - var fig = { - data: [{ - x: ['2017-01-01', '2017-02-01', '2017-03-01'], - y: ['a', 'b', 'c'] - }, { - type: 'bar', - x: ['2017-01-01', '2017-02-02', '2017-03-01'], - y: ['a', 'b', 'c'] - }], - layout: { - dragmode: 'lasso', - width: 400, - height: 400 - } - }; - addInvisible(fig); + var fig = Lib.extendDeep({}, require('@mocks/geo_choropleth-text')); + fig.layout.width = 870; + fig.layout.height = 450; + fig.layout.dragmode = 'select'; + fig.layout.geo.scope = 'europe'; + addInvisible(fig, false); - var x0 = 100; - var y0 = 100; - var x1 = 250; - var y1 = 250; + // add a trace with no locations which will then make trace invisible, lacking DOM elements + var emptyChoroplethTrace = Lib.extendDeep({}, fig.data[0]); + emptyChoroplethTrace.text = []; + emptyChoroplethTrace.locations = []; + emptyChoroplethTrace.z = []; + fig.data.push(emptyChoroplethTrace); - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[x0, y0], [x1, y0], [x1, y1], [x0, y1], [x0, y0]], - function() { - assertPoints([ - [0, '2017-02-01', 'b'], - [1, '2017-02-02', 'b'] - ]); - assertSelectedPoints({0: [1], 1: [1]}); - }, - null, LASSOEVENTS, 'date/category lasso' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'select'); - }) - .then(function() { - return _run( - [[x0, y0], [x1, y1]], - function() { - assertPoints([ - [0, '2017-02-01', 'b'], - [1, '2017-02-02', 'b'] - ]); - assertSelectedPoints({0: [1], 1: [1]}); - }, - null, BOXEVENTS, 'date/category select' - ); - }) - .catch(failTest) - .then(done); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[350, 200], [400, 250]], + function() { + assertPoints([['GBR', 26.507354205352502], ['IRL', 86.4125147625692]]); + assertSelectedPoints({0: [43, 54]}); + assertRanges([[-19.11, 63.06], [7.31, 53.72]]); + }, + [280, 190], + BOXEVENTS, 'choropleth select' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'lasso'); + }) + .then(function() { + return _run(hasCssTransform, + [[350, 200], [400, 200], [400, 250], [350, 250], [350, 200]], + function() { + assertPoints([['GBR', 26.507354205352502], ['IRL', 86.4125147625692]]); + assertSelectedPoints({0: [43, 54]}); + assertLassoPoints([ + [-19.11, 63.06], [5.50, 65.25], [7.31, 53.72], [-12.90, 51.70], [-19.11, 63.06] + ]); + }, + [280, 190], + LASSOEVENTS, 'choropleth lasso' + ); + }) + .then(function() { + // make selection handlers don't get called in 'pan' dragmode + return Plotly.relayout(gd, 'dragmode', 'pan'); + }) + .then(function() { + return _run(hasCssTransform, + [[370, 120], [500, 200]], null, [200, 180], NOEVENTS, 'choropleth pan' + ); + }) + .catch(failTest) + .then(done); + }, LONG_TIMEOUT_INTERVAL); + }); + + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work for waterfall traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']); + var assertSelectedPoints = makeAssertSelectedPoints(); + var assertRanges = makeAssertRanges(); + var assertLassoPoints = makeAssertLassoPoints(); + + var fig = Lib.extendDeep({}, require('@mocks/waterfall_profit-loss_2018_positive-negative')); + fig.layout.dragmode = 'lasso'; + addInvisible(fig); + + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[400, 300], [200, 400], [400, 500], [600, 400], [500, 350]], + function() { + assertPoints([ + [0, 281, 'Purchases'], + [0, 269, 'Material expenses'], + [0, 191, 'Personnel expenses'], + [0, 179, 'Other expenses'] + ]); + assertSelectedPoints({ + 0: [5, 6, 7, 8] + }); + assertLassoPoints([ + [288.8086, 57.7617, 288.8086, 519.8555, 404.3321], + [4.33870, 6.7580, 9.1774, 6.75806, 5.54838] + ]); + }, + null, LASSOEVENTS, 'waterfall lasso' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { + return _run(hasCssTransform, + [[300, 300], [400, 400]], + function() { + assertPoints([ + [0, 281, 'Purchases'], + [0, 269, 'Material expenses'] + ]); + assertSelectedPoints({ + 0: [5, 6] + }); + assertRanges([ + [173.28519, 288.8086], + [4.3387, 6.7580] + ]); + }, + null, BOXEVENTS, 'waterfall select' + ); + }) + .catch(failTest) + .then(done); + }); + }); + + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work for funnel traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']); + var assertSelectedPoints = makeAssertSelectedPoints(); + var assertRanges = makeAssertRanges(); + var assertLassoPoints = makeAssertLassoPoints(); + + var fig = Lib.extendDeep({}, require('@mocks/funnel_horizontal_group_basic')); + fig.layout.dragmode = 'lasso'; + addInvisible(fig); + + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[400, 300], [200, 400], [400, 500], [600, 400], [500, 350]], + function() { + assertPoints([ + [0, 331.5, 'Author: etpinard'], + [1, 53.5, 'Pull requests'], + [1, 15.5, 'Author: etpinard'], + ]); + assertSelectedPoints({ + 0: [2], + 1: [1, 2] + }); + assertLassoPoints([ + [-161.6974, -1701.6728, -161.6974, 1378.2779, 608.2902], + [1.1129, 1.9193, 2.7258, 1.9193, 1.5161] + ]); + }, + null, LASSOEVENTS, 'funnel lasso' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { + return _run(hasCssTransform, + [[300, 300], [500, 500]], + function() { + assertPoints([ + [0, 331.5, 'Author: etpinard'], + [1, 53.5, 'Pull requests'], + [1, 15.5, 'Author: etpinard'] + ]); + assertSelectedPoints({ + 0: [2], + 1: [1, 2] + }); + assertRanges([ + [-931.6851, 608.2902], + [1.1129, 2.7258] + ]); + }, + null, BOXEVENTS, 'funnel select' + ); + }) + .catch(failTest) + .then(done); + }); + }); + + [false].forEach(function(hasCssTransform) { + it('@flaky should work for bar traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']); + var assertSelectedPoints = makeAssertSelectedPoints(); + var assertRanges = makeAssertRanges(); + var assertLassoPoints = makeAssertLassoPoints(); + + var fig = Lib.extendDeep({}, require('@mocks/0')); + fig.layout.dragmode = 'lasso'; + addInvisible(fig); + + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[350, 200], [400, 200], [400, 250], [350, 250], [350, 200]], + function() { + assertPoints([ + [0, 4.9, 0.371], [0, 5, 0.368], [0, 5.1, 0.356], [0, 5.2, 0.336], + [0, 5.3, 0.309], [0, 5.4, 0.275], [0, 5.5, 0.235], [0, 5.6, 0.192], + [0, 5.7, 0.145], + [1, 5.1, 0.485], [1, 5.2, 0.409], [1, 5.3, 0.327], + [1, 5.4, 0.24], [1, 5.5, 0.149], [1, 5.6, 0.059], + [2, 4.9, 0.473], [2, 5, 0.368], [2, 5.1, 0.258], + [2, 5.2, 0.146], [2, 5.3, 0.036] + ]); + assertSelectedPoints({ + 0: [49, 50, 51, 52, 53, 54, 55, 56, 57], + 1: [51, 52, 53, 54, 55, 56], + 2: [49, 50, 51, 52, 53] + }); + assertLassoPoints([ + [4.87, 5.74, 5.74, 4.87, 4.87], + [0.53, 0.53, -0.02, -0.02, 0.53] + ]); + }, + null, LASSOEVENTS, 'bar lasso' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(delay(100)) + .then(function() { + return _run(hasCssTransform, + [[350, 200], [370, 220]], + function() { + assertPoints([ + [0, 4.9, 0.371], [0, 5, 0.368], [0, 5.1, 0.356], [0, 5.2, 0.336], + [1, 5.1, 0.485], [1, 5.2, 0.41], + [2, 4.9, 0.473], [2, 5, 0.37] + ]); + assertSelectedPoints({ + 0: [49, 50, 51, 52], + 1: [51, 52], + 2: [49, 50] + }); + assertRanges([[4.87, 5.22], [0.31, 0.53]]); + }, + null, BOXEVENTS, 'bar select' + ); + }) + .then(function() { + // mimic https://github.com/plotly/plotly.js/issues/3795 + return Plotly.relayout(gd, { + 'xaxis.rangeslider.visible': true, + 'xaxis.range': [0, 6] + }); + }) + .then(function() { + return _run(hasCssTransform, + [[350, 200], [360, 200]], + function() { + assertPoints([ + [0, 2.5, -0.429], [1, 2.5, -1.015], [2, 2.5, -1.172], + ]); + assertSelectedPoints({ + 0: [25], + 1: [25], + 2: [25] + }); + assertRanges([[2.434, 2.521], [-1.4355, 2.0555]]); + }, + null, BOXEVENTS, 'bar select (after xaxis.range relayout)' + ); + }) + .catch(failTest) + .then(done); + }); + }); + + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work for date/category traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']); + var assertSelectedPoints = makeAssertSelectedPoints(); + + var fig = { + data: [{ + x: ['2017-01-01', '2017-02-01', '2017-03-01'], + y: ['a', 'b', 'c'] + }, { + type: 'bar', + x: ['2017-01-01', '2017-02-02', '2017-03-01'], + y: ['a', 'b', 'c'] + }], + layout: { + dragmode: 'lasso', + width: 400, + height: 400 + } + }; + addInvisible(fig); + + var x0 = 100; + var y0 = 100; + var x1 = 250; + var y1 = 250; + + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[x0, y0], [x1, y0], [x1, y1], [x0, y1], [x0, y0]], + function() { + assertPoints([ + [0, '2017-02-01', 'b'], + [1, '2017-02-02', 'b'] + ]); + assertSelectedPoints({0: [1], 1: [1]}); + }, + null, LASSOEVENTS, 'date/category lasso' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { + return _run(hasCssTransform, + [[x0, y0], [x1, y1]], + function() { + assertPoints([ + [0, '2017-02-01', 'b'], + [1, '2017-02-02', 'b'] + ]); + assertSelectedPoints({0: [1], 1: [1]}); + }, + null, BOXEVENTS, 'date/category select' + ); + }) + .catch(failTest) + .then(done); + }); }); - it('@flaky should work for histogram traces', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y', 'pointIndices']); - var assertSelectedPoints = makeAssertSelectedPoints(); - var assertRanges = makeAssertRanges(); - var assertLassoPoints = makeAssertLassoPoints(); - - var fig = Lib.extendDeep({}, require('@mocks/hist_grouped')); - fig.layout.dragmode = 'lasso'; - fig.layout.width = 600; - fig.layout.height = 500; - addInvisible(fig); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work for histogram traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y', 'pointIndices']); + var assertSelectedPoints = makeAssertSelectedPoints(); + var assertRanges = makeAssertRanges(); + var assertLassoPoints = makeAssertLassoPoints(); - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]], - function() { - assertPoints([ - [0, 1.8, 2, [3, 4]], [1, 2.2, 1, [1]], [1, 3.2, 1, [2]] - ]); - assertSelectedPoints({0: [3, 4], 1: [1, 2]}); - assertLassoPoints([ - [1.66, 3.59, 3.59, 1.66, 1.66], - [2.17, 2.17, 0.69, 0.69, 2.17] - ]); - }, - null, LASSOEVENTS, 'histogram lasso' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'select'); - }) - .then(function() { - return _run( - [[200, 200], [400, 350]], - function() { - assertPoints([ - [0, 1.8, 2, [3, 4]], [1, 2.2, 1, [1]], [1, 3.2, 1, [2]] - ]); - assertSelectedPoints({0: [3, 4], 1: [1, 2]}); - assertRanges([[1.66, 3.59], [0.69, 2.17]]); - }, - null, BOXEVENTS, 'histogram select' - ); - }) - .catch(failTest) - .then(done); - }); + var fig = Lib.extendDeep({}, require('@mocks/hist_grouped')); + fig.layout.dragmode = 'lasso'; + fig.layout.width = 600; + fig.layout.height = 500; + addInvisible(fig); - it('@flaky should work for box traces', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']); - var assertSelectedPoints = makeAssertSelectedPoints(); - var assertRanges = makeAssertRanges(); - var assertLassoPoints = makeAssertLassoPoints(); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); - var fig = Lib.extendDeep({}, require('@mocks/box_grouped')); - fig.data.forEach(function(trace) { - trace.boxpoints = 'all'; + return _run(hasCssTransform, + [[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]], + function() { + assertPoints([ + [0, 1.8, 2, [3, 4]], [1, 2.2, 1, [1]], [1, 3.2, 1, [2]] + ]); + assertSelectedPoints({0: [3, 4], 1: [1, 2]}); + assertLassoPoints([ + [1.66, 3.59, 3.59, 1.66, 1.66], + [2.17, 2.17, 0.69, 0.69, 2.17] + ]); + }, + null, LASSOEVENTS, 'histogram lasso' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { + return _run(hasCssTransform, + [[200, 200], [400, 350]], + function() { + assertPoints([ + [0, 1.8, 2, [3, 4]], [1, 2.2, 1, [1]], [1, 3.2, 1, [2]] + ]); + assertSelectedPoints({0: [3, 4], 1: [1, 2]}); + assertRanges([[1.66, 3.59], [0.69, 2.17]]); + }, + null, BOXEVENTS, 'histogram select' + ); + }) + .catch(failTest) + .then(done); }); - fig.layout.dragmode = 'lasso'; - fig.layout.width = 600; - fig.layout.height = 500; - fig.layout.xaxis = {range: [-0.565, 1.5]}; - addInvisible(fig); - - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]], - function() { - assertPoints([ - [0, 0.2, 'day 2'], [0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], - [1, 0.2, 'day 2'], [1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], - [2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'] - ]); - assertSelectedPoints({ - 0: [6, 11, 10, 7], - 1: [11, 8, 6, 10], - 2: [1, 4, 5] - }); - assertLassoPoints([ - [0.0423, 1.0546, 1.0546, 0.0423, 0.0423], - [0.71, 0.71, 0.1875, 0.1875, 0.71] - ]); - }, - null, LASSOEVENTS, 'box lasso' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'select'); - }) - .then(function() { - return _run( - [[200, 200], [400, 350]], - function() { - assertPoints([ - [0, 0.2, 'day 2'], [0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], - [1, 0.2, 'day 2'], [1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], - [2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'] - ]); - assertSelectedPoints({ - 0: [6, 11, 10, 7], - 1: [11, 8, 6, 10], - 2: [1, 4, 5] - }); - assertRanges([[0.04235, 1.0546], [0.1875, 0.71]]); - }, - null, BOXEVENTS, 'box select' - ); - }) - .catch(failTest) - .then(done); }); - it('@flaky should work for box traces (q1/median/q3 case)', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']); - var assertSelectedPoints = makeAssertSelectedPoints(); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work for box traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']); + var assertSelectedPoints = makeAssertSelectedPoints(); + var assertRanges = makeAssertRanges(); + var assertLassoPoints = makeAssertLassoPoints(); - var fig = { - data: [{ - type: 'box', - x0: 'A', - q1: [1], - median: [2], - q3: [3], - y: [[0, 1, 2, 3, 4]], - pointpos: 0, - }], - layout: { - width: 500, - height: 500, - dragmode: 'lasso' - } - }; + var fig = Lib.extendDeep({}, require('@mocks/box_grouped')); + fig.data.forEach(function(trace) { + trace.boxpoints = 'all'; + }); + fig.layout.dragmode = 'lasso'; + fig.layout.width = 600; + fig.layout.height = 500; + fig.layout.xaxis = {range: [-0.565, 1.5]}; + addInvisible(fig); - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]], - function() { - assertPoints([ [0, 1, undefined], [0, 2, undefined] ]); - assertSelectedPoints({ 0: [[0, 1], [0, 2]] }); - }, - null, LASSOEVENTS, 'box lasso' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'select'); - }) - .then(function() { - return _run( - [[200, 200], [400, 300]], - function() { - assertPoints([ [0, 2, undefined] ]); - assertSelectedPoints({ 0: [[0, 2]] }); - }, - null, BOXEVENTS, 'box select' - ); - }) - .catch(failTest) - .then(done); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]], + function() { + assertPoints([ + [0, 0.2, 'day 2'], [0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], + [1, 0.2, 'day 2'], [1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], + [2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'] + ]); + assertSelectedPoints({ + 0: [6, 11, 10, 7], + 1: [11, 8, 6, 10], + 2: [1, 4, 5] + }); + assertLassoPoints([ + [0.0423, 1.0546, 1.0546, 0.0423, 0.0423], + [0.71, 0.71, 0.1875, 0.1875, 0.71] + ]); + }, + null, LASSOEVENTS, 'box lasso' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { + return _run(hasCssTransform, + [[200, 200], [400, 350]], + function() { + assertPoints([ + [0, 0.2, 'day 2'], [0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], + [1, 0.2, 'day 2'], [1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], + [2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'] + ]); + assertSelectedPoints({ + 0: [6, 11, 10, 7], + 1: [11, 8, 6, 10], + 2: [1, 4, 5] + }); + assertRanges([[0.04235, 1.0546], [0.1875, 0.71]]); + }, + null, BOXEVENTS, 'box select' + ); + }) + .catch(failTest) + .then(done); + }); }); - it('@flaky should work for violin traces', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']); - var assertSelectedPoints = makeAssertSelectedPoints(); - var assertRanges = makeAssertRanges(); - var assertLassoPoints = makeAssertLassoPoints(); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work for box traces (q1/median/q3 case), hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']); + var assertSelectedPoints = makeAssertSelectedPoints(); - var fig = Lib.extendDeep({}, require('@mocks/violin_grouped')); - fig.layout.dragmode = 'lasso'; - fig.layout.width = 600; - fig.layout.height = 500; - addInvisible(fig); + var fig = { + data: [{ + type: 'box', + x0: 'A', + q1: [1], + median: [2], + q3: [3], + y: [[0, 1, 2, 3, 4]], + pointpos: 0, + }], + layout: { + width: 500, + height: 500, + dragmode: 'lasso' + } + }; - Plotly.plot(gd, fig) - .then(function() { - return _run( - [[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]], - function() { - assertPoints([ - [0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], [0, 0.9, 'day 2'], - [1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], [1, 0.8, 'day 2'], - [1, 0.9, 'day 2'], - [2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'], [2, 0.9, 'day 1'] - ]); - assertSelectedPoints({ - 0: [11, 10, 7, 8], - 1: [8, 6, 10, 9, 7], - 2: [1, 4, 5, 3] - }); - assertLassoPoints([ - [0.07777, 1.0654, 1.0654, 0.07777, 0.07777], - [1.02, 1.02, 0.27, 0.27, 1.02] - ]); - }, - null, LASSOEVENTS, 'violin lasso' - ); - }) - .then(function() { - return Plotly.relayout(gd, 'dragmode', 'select'); - }) - .then(function() { - return _run( - [[200, 200], [400, 350]], - function() { - assertPoints([ - [0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], [0, 0.9, 'day 2'], - [1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], [1, 0.8, 'day 2'], - [1, 0.9, 'day 2'], - [2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'], [2, 0.9, 'day 1'] - ]); - assertSelectedPoints({ - 0: [11, 10, 7, 8], - 1: [8, 6, 10, 9, 7], - 2: [1, 4, 5, 3] - }); - assertRanges([[0.07777, 1.0654], [0.27, 1.02]]); - }, - null, BOXEVENTS, 'violin select' - ); - }) - .catch(failTest) - .then(done); + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]], + function() { + assertPoints([ [0, 1, undefined], [0, 2, undefined] ]); + assertSelectedPoints({ 0: [[0, 1], [0, 2]] }); + }, + null, LASSOEVENTS, 'box lasso' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { + return _run(hasCssTransform, + [[200, 200], [400, 300]], + function() { + assertPoints([ [0, 2, undefined] ]); + assertSelectedPoints({ 0: [[0, 2]] }); + }, + null, BOXEVENTS, 'box select' + ); + }) + .catch(failTest) + .then(done); + }); }); - ['ohlc', 'candlestick'].forEach(function(type) { - it('@flaky should work for ' + type + ' traces', function(done) { - var assertPoints = makeAssertPoints(['curveNumber', 'x', 'open', 'high', 'low', 'close']); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work for violin traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']); var assertSelectedPoints = makeAssertSelectedPoints(); var assertRanges = makeAssertRanges(); var assertLassoPoints = makeAssertLassoPoints(); - var l0 = 275; - var lv0 = '2011-01-03 18:00'; - var r0 = 325; - var rv0 = '2011-01-04 06:00'; - var l1 = 75; - var lv1 = '2011-01-01 18:00'; - var r1 = 125; - var rv1 = '2011-01-02 06:00'; - var t = 75; - var tv = 7.565; - var b = 225; - var bv = -1.048; - - function countUnSelectedPaths(selector) { - var unselected = 0; - d3.select(gd).selectAll(selector).each(function() { - var opacity = this.style.opacity; - if(opacity < 1) unselected++; - }); - return unselected; - } - Plotly.newPlot(gd, [{ - type: type, - x: ['2011-01-02', '2011-01-03', '2011-01-04'], - open: [1, 2, 3], - high: [3, 4, 5], - low: [0, 1, 2], - close: [0, 3, 2] - }], { - width: 400, - height: 400, - margin: {l: 50, r: 50, t: 50, b: 50}, - yaxis: {range: [-3, 9]}, - dragmode: 'lasso' - }) + var fig = Lib.extendDeep({}, require('@mocks/violin_grouped')); + fig.layout.dragmode = 'lasso'; + fig.layout.width = 600; + fig.layout.height = 500; + addInvisible(fig); + + Plotly.plot(gd, fig) .then(function() { - return _run( - [[l0, t], [l0, b], [r0, b], [r0, t], [l0, t]], + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[200, 200], [400, 200], [400, 350], [200, 350], [200, 200]], function() { - assertPoints([[0, '2011-01-04', 3, 5, 2, 2]]); - assertSelectedPoints([[2]]); + assertPoints([ + [0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], [0, 0.9, 'day 2'], + [1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], [1, 0.8, 'day 2'], + [1, 0.9, 'day 2'], + [2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'], [2, 0.9, 'day 1'] + ]); + assertSelectedPoints({ + 0: [11, 10, 7, 8], + 1: [8, 6, 10, 9, 7], + 2: [1, 4, 5, 3] + }); assertLassoPoints([ - [lv0, lv0, rv0, rv0, lv0], - [tv, bv, bv, tv, tv] + [0.07777, 1.0654, 1.0654, 0.07777, 0.07777], + [1.02, 1.02, 0.27, 0.27, 1.02] ]); - expect(countUnSelectedPaths('.cartesianlayer .trace path')).toBe(2); - expect(countUnSelectedPaths('.rangeslider-rangeplot .trace path')).toBe(2); }, - null, LASSOEVENTS, type + ' lasso' + null, LASSOEVENTS, 'violin lasso' ); }) .then(function() { return Plotly.relayout(gd, 'dragmode', 'select'); }) .then(function() { - return _run( - [[l1, t], [r1, b]], + return _run(hasCssTransform, + [[200, 200], [400, 350]], function() { - assertPoints([[0, '2011-01-02', 1, 3, 0, 0]]); - assertSelectedPoints([[0]]); - assertRanges([[lv1, rv1], [bv, tv]]); + assertPoints([ + [0, 0.3, 'day 2'], [0, 0.5, 'day 2'], [0, 0.7, 'day 2'], [0, 0.9, 'day 2'], + [1, 0.5, 'day 2'], [1, 0.7, 'day 2'], [1, 0.7, 'day 2'], [1, 0.8, 'day 2'], + [1, 0.9, 'day 2'], + [2, 0.3, 'day 1'], [2, 0.6, 'day 1'], [2, 0.6, 'day 1'], [2, 0.9, 'day 1'] + ]); + assertSelectedPoints({ + 0: [11, 10, 7, 8], + 1: [8, 6, 10, 9, 7], + 2: [1, 4, 5, 3] + }); + assertRanges([[0.07777, 1.0654], [0.27, 1.02]]); }, - null, BOXEVENTS, type + ' select' + null, BOXEVENTS, 'violin select' ); }) .catch(failTest) @@ -2881,134 +2896,227 @@ describe('Test select box and lasso per trace:', function() { }); }); - it('@flaky should work on traces with enabled transforms', function(done) { - var assertSelectedPoints = makeAssertSelectedPoints(); + [false].forEach(function(hasCssTransform) { + ['ohlc', 'candlestick'].forEach(function(type) { + it('@flaky should work for ' + type + ' traces, hasCssTransform: ' + hasCssTransform, function(done) { + var assertPoints = makeAssertPoints(['curveNumber', 'x', 'open', 'high', 'low', 'close']); + var assertSelectedPoints = makeAssertSelectedPoints(); + var assertRanges = makeAssertRanges(); + var assertLassoPoints = makeAssertLassoPoints(); + var l0 = 275; + var lv0 = '2011-01-03 18:00'; + var r0 = 325; + var rv0 = '2011-01-04 06:00'; + var l1 = 75; + var lv1 = '2011-01-01 18:00'; + var r1 = 125; + var rv1 = '2011-01-02 06:00'; + var t = 75; + var tv = 7.565; + var b = 225; + var bv = -1.048; + + function countUnSelectedPaths(selector) { + var unselected = 0; + d3.select(gd).selectAll(selector).each(function() { + var opacity = this.style.opacity; + if(opacity < 1) unselected++; + }); + return unselected; + } - Plotly.plot(gd, [{ - x: [1, 2, 3, 4, 5], - y: [2, 3, 1, 7, 9], - marker: {size: [10, 20, 20, 20, 10]}, - transforms: [{ - type: 'filter', - operation: '>', - value: 2, - target: 'y' - }, { - type: 'aggregate', - groups: 'marker.size', - aggregations: [ - // 20: 6, 10: 5 - {target: 'x', func: 'sum'}, - // 20: 5, 10: 9 - {target: 'y', func: 'avg'} - ] - }] - }], { - dragmode: 'select', - showlegend: false, - width: 400, - height: 400, - margin: {l: 0, t: 0, r: 0, b: 0} - }) - .then(function() { - return _run( - [[5, 5], [395, 395]], - function() { - assertSelectedPoints({0: [1, 3, 4]}); - }, - [380, 180], - BOXEVENTS, 'transformed trace select (all points selected)' - ); - }) - .catch(failTest) - .then(done); + Plotly.newPlot(gd, [{ + type: type, + x: ['2011-01-02', '2011-01-03', '2011-01-04'], + open: [1, 2, 3], + high: [3, 4, 5], + low: [0, 1, 2], + close: [0, 3, 2] + }], { + width: 400, + height: 400, + margin: {l: 50, r: 50, t: 50, b: 50}, + yaxis: {range: [-3, 9]}, + dragmode: 'lasso' + }) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[l0, t], [l0, b], [r0, b], [r0, t], [l0, t]], + function() { + assertPoints([[0, '2011-01-04', 3, 5, 2, 2]]); + assertSelectedPoints([[2]]); + assertLassoPoints([ + [lv0, lv0, rv0, rv0, lv0], + [tv, bv, bv, tv, tv] + ]); + expect(countUnSelectedPaths('.cartesianlayer .trace path')).toBe(2); + expect(countUnSelectedPaths('.rangeslider-rangeplot .trace path')).toBe(2); + }, + null, LASSOEVENTS, type + ' lasso' + ); + }) + .then(function() { + return Plotly.relayout(gd, 'dragmode', 'select'); + }) + .then(function() { + return _run(hasCssTransform, + [[l1, t], [r1, b]], + function() { + assertPoints([[0, '2011-01-02', 1, 3, 0, 0]]); + assertSelectedPoints([[0]]); + assertRanges([[lv1, rv1], [bv, tv]]); + }, + null, BOXEVENTS, type + ' select' + ); + }) + .catch(failTest) + .then(done); + }); + }); }); - it('@flaky should work on scatter/bar traces with text nodes', function(done) { - var assertSelectedPoints = makeAssertSelectedPoints(); + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work on traces with enabled transforms, hasCssTransform: ' + hasCssTransform, function(done) { + var assertSelectedPoints = makeAssertSelectedPoints(); - function assertFillOpacity(exp, msg) { - var txtPts = d3.select(gd).select('g.plot').selectAll('text'); + Plotly.plot(gd, [{ + x: [1, 2, 3, 4, 5], + y: [2, 3, 1, 7, 9], + marker: {size: [10, 20, 20, 20, 10]}, + transforms: [{ + type: 'filter', + operation: '>', + value: 2, + target: 'y' + }, { + type: 'aggregate', + groups: 'marker.size', + aggregations: [ + // 20: 6, 10: 5 + {target: 'x', func: 'sum'}, + // 20: 5, 10: 9 + {target: 'y', func: 'avg'} + ] + }] + }], { + dragmode: 'select', + showlegend: false, + width: 400, + height: 400, + margin: {l: 0, t: 0, r: 0, b: 0} + }) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); - expect(txtPts.size()).toBe(exp.length, '# of text nodes: ' + msg); + return _run(hasCssTransform, + [[5, 5], [395, 395]], + function() { + assertSelectedPoints({0: [1, 3, 4]}); + }, + [380, 180], + BOXEVENTS, 'transformed trace select (all points selected)' + ); + }) + .catch(failTest) + .then(done); + }); + }); - txtPts.each(function(_, i) { - var act = Number(this.style['fill-opacity']); - expect(act).toBe(exp[i], 'node ' + i + ' fill opacity: ' + msg); - }); - } + [false, true].forEach(function(hasCssTransform) { + it('@flaky should work on scatter/bar traces with text nodes, hasCssTransform: ' + hasCssTransform, function(done) { + var assertSelectedPoints = makeAssertSelectedPoints(); - Plotly.plot(gd, [{ - mode: 'markers+text', - x: [1, 2, 3], - y: [1, 2, 1], - text: ['a', 'b', 'c'] - }, { - type: 'bar', - x: [1, 2, 3], - y: [1, 2, 1], - text: ['A', 'B', 'C'], - textposition: 'outside' - }], { - dragmode: 'select', - hovermode: 'closest', - showlegend: false, - width: 400, - height: 400, - margin: {l: 0, t: 0, r: 0, b: 0} - }) - .then(function() { - return _run( - [[10, 10], [100, 300]], - function() { - assertSelectedPoints({0: [0], 1: [0]}); - assertFillOpacity([1, 0.2, 0.2, 1, 0.2, 0.2], '_run'); - }, - [10, 10], BOXEVENTS, 'selecting first scatter/bar text nodes' - ); - }) - .then(function() { - assertFillOpacity([1, 1, 1, 1, 1, 1], 'final'); - }) - .catch(failTest) - .then(done); - }); + function assertFillOpacity(exp, msg) { + var txtPts = d3.select(gd).select('g.plot').selectAll('text'); - describe('should work on sankey traces', function() { - var waitingTime = sankeyConstants.duration * 2; + expect(txtPts.size()).toBe(exp.length, '# of text nodes: ' + msg); - it('@flaky select', function(done) { - var fig = Lib.extendDeep({}, require('@mocks/sankey_circular.json')); - fig.layout.dragmode = 'select'; - var dblClickPos = [250, 400]; + txtPts.each(function(_, i) { + var act = Number(this.style['fill-opacity']); + expect(act).toBe(exp[i], 'node ' + i + ' fill opacity: ' + msg); + }); + } - Plotly.plot(gd, fig) - .then(function() { - // No groups initially - expect(gd._fullData[0].node.groups).toEqual([]); + Plotly.plot(gd, [{ + mode: 'markers+text', + x: [1, 2, 3], + y: [1, 2, 1], + text: ['a', 'b', 'c'] + }, { + type: 'bar', + x: [1, 2, 3], + y: [1, 2, 1], + text: ['A', 'B', 'C'], + textposition: 'outside' + }], { + dragmode: 'select', + hovermode: 'closest', + showlegend: false, + width: 400, + height: 400, + margin: {l: 0, t: 0, r: 0, b: 0} }) .then(function() { - // Grouping the two nodes on the top right - return _run( - [[640, 130], [400, 450]], + if(hasCssTransform) transformPlot(gd, cssTransform); + + return _run(hasCssTransform, + [[10, 10], [100, 300]], function() { - expect(gd._fullData[0].node.groups).toEqual([[2, 3]], 'failed to group #2 + #3'); + assertSelectedPoints({0: [0], 1: [0]}); + assertFillOpacity([1, 0.2, 0.2, 1, 0.2, 0.2], '_run'); }, - dblClickPos, BOXEVENTS, 'for top right nodes #2 and #3' + [10, 10], BOXEVENTS, 'selecting first scatter/bar text nodes' ); }) - .then(delay(waitingTime)) - .then(function() { - // Grouping node #4 and the previous group - drag([[715, 400], [300, 110]]); - }) - .then(delay(waitingTime)) .then(function() { - expect(gd._fullData[0].node.groups).toEqual([[4, 3, 2]], 'failed to group #4 + existing group of #2 and #3'); + assertFillOpacity([1, 1, 1, 1, 1, 1], 'final'); }) .catch(failTest) .then(done); }); + }); + + describe('should work on sankey traces', function() { + var waitingTime = sankeyConstants.duration * 2; + + [false].forEach(function(hasCssTransform) { + it('@flaky select, hasCssTransform: ' + hasCssTransform, function(done) { + var fig = Lib.extendDeep({}, require('@mocks/sankey_circular.json')); + fig.layout.dragmode = 'select'; + var dblClickPos = [250, 400]; + + Plotly.plot(gd, fig) + .then(function() { + if(hasCssTransform) transformPlot(gd, cssTransform); + + // No groups initially + expect(gd._fullData[0].node.groups).toEqual([]); + }) + .then(function() { + // Grouping the two nodes on the top right + return _run(hasCssTransform, + [[640, 130], [400, 450]], + function() { + expect(gd._fullData[0].node.groups).toEqual([[2, 3]], 'failed to group #2 + #3'); + }, + dblClickPos, BOXEVENTS, 'for top right nodes #2 and #3' + ); + }) + .then(delay(waitingTime)) + .then(function() { + // Grouping node #4 and the previous group + drag([[715, 400], [300, 110]]); + }) + .then(delay(waitingTime)) + .then(function() { + expect(gd._fullData[0].node.groups).toEqual([[4, 3, 2]], 'failed to group #4 + existing group of #2 and #3'); + }) + .catch(failTest) + .then(done); + }); + }); it('@flaky should not work when dragmode is undefined', function(done) { var fig = Lib.extendDeep({}, require('@mocks/sankey_circular.json')); diff --git a/test/jasmine/tests/splom_test.js b/test/jasmine/tests/splom_test.js index 7052124d76e..2b43f198418 100644 --- a/test/jasmine/tests/splom_test.js +++ b/test/jasmine/tests/splom_test.js @@ -537,9 +537,10 @@ describe('Test splom trace defaults:', function() { var fullLayout = gd._fullLayout; expect(fullLayout.xaxis.matches).toBe('y'); - expect(fullLayout.yaxis.matches).toBe('x'); expect(fullLayout.xaxis2.matches).toBe('y2'); - expect(fullLayout.yaxis2.matches).toBe('x2'); + // not necessary to set y axes matching x, since x already matches y + expect(fullLayout.yaxis.matches).toBe(undefined); + expect(fullLayout.yaxis2.matches).toBe(undefined); var groups = fullLayout._axisMatchGroups; expect(groups.length).toBe(2); @@ -562,7 +563,7 @@ describe('Test splom trace defaults:', function() { expect(fullLayout.xaxis).toBe(undefined); expect(fullLayout.yaxis.matches).toBe(undefined); expect(fullLayout.xaxis2.matches).toBe('y2'); - expect(fullLayout.yaxis2.matches).toBe('x2'); + expect(fullLayout.yaxis2.matches).toBe(undefined); expect(fullLayout.xaxis3.matches).toBe(undefined); expect(fullLayout.yaxis3).toBe(undefined); @@ -586,7 +587,7 @@ describe('Test splom trace defaults:', function() { expect(fullLayout.xaxis.matches).toBe(undefined); expect(fullLayout.yaxis).toBe(undefined); expect(fullLayout.xaxis2.matches).toBe('y2'); - expect(fullLayout.yaxis2.matches).toBe('x2'); + expect(fullLayout.yaxis2.matches).toBe(undefined); expect(fullLayout.xaxis3).toBe(undefined); expect(fullLayout.yaxis3.matches).toBe(undefined); @@ -608,7 +609,7 @@ describe('Test splom trace defaults:', function() { var fullLayout = gd._fullLayout; expect(fullLayout.xaxis.matches).toBe('y'); - expect(fullLayout.yaxis.matches).toBe('x'); + expect(fullLayout.yaxis.matches).toBe(undefined); expect(fullLayout.xaxis2.matches).toBe('x'); expect(fullLayout.yaxis2.matches).toBe('x2'); diff --git a/test/jasmine/tests/sunburst_test.js b/test/jasmine/tests/sunburst_test.js index d78ee444c64..a59bb2e57fb 100644 --- a/test/jasmine/tests/sunburst_test.js +++ b/test/jasmine/tests/sunburst_test.js @@ -248,7 +248,7 @@ describe('Test sunburst calc:', function() { }); expect(Lib.warn).toHaveBeenCalledTimes(1); - expect(Lib.warn).toHaveBeenCalledWith('Multiple implied roots, cannot build sunburst hierarchy.'); + expect(Lib.warn).toHaveBeenCalledWith('Multiple implied roots, cannot build sunburst hierarchy of trace 0. These roots include: Root1, Root22'); }); it('should generate "root of roots" when it can', function() { @@ -299,8 +299,8 @@ describe('Test sunburst calc:', function() { expect(gd.calcdata[0][0].hierarchy).toBe(undefined, 'no computed hierarchy'); expect(Lib.warn).toHaveBeenCalledTimes(2); - expect(Lib.warn.calls.allArgs()[0][0]).toBe('Total value for node Root is smaller than the sum of its children. \nparent value = 0 \nchildren sum = 3'); - expect(Lib.warn.calls.allArgs()[1][0]).toBe('Total value for node B is smaller than the sum of its children. \nparent value = 2 \nchildren sum = 3'); + expect(Lib.warn.calls.allArgs()[0][0]).toBe('Total value for node Root of trace 0 is smaller than the sum of its children. \nparent value = 0 \nchildren sum = 3'); + expect(Lib.warn.calls.allArgs()[1][0]).toBe('Total value for node B of trace 0 is smaller than the sum of its children. \nparent value = 2 \nchildren sum = 3'); }); it('should warn labels/parents lead to ambiguous hierarchy', function() { @@ -310,7 +310,7 @@ describe('Test sunburst calc:', function() { }); expect(Lib.warn).toHaveBeenCalledTimes(1); - expect(Lib.warn).toHaveBeenCalledWith('Failed to build sunburst hierarchy. Error: ambiguous: A'); + expect(Lib.warn).toHaveBeenCalledWith('Failed to build sunburst hierarchy of trace 0. Error: ambiguous: A'); }); it('should warn ids/parents lead to ambiguous hierarchy', function() { @@ -321,7 +321,7 @@ describe('Test sunburst calc:', function() { }); expect(Lib.warn).toHaveBeenCalledTimes(1); - expect(Lib.warn).toHaveBeenCalledWith('Failed to build sunburst hierarchy. Error: ambiguous: b'); + expect(Lib.warn).toHaveBeenCalledWith('Failed to build sunburst hierarchy of trace 0. Error: ambiguous: b'); }); it('should accept numbers (even `0`) are ids/parents items', function() { diff --git a/test/jasmine/tests/ternary_test.js b/test/jasmine/tests/ternary_test.js index df7d3a1ccaf..624f362eec1 100644 --- a/test/jasmine/tests/ternary_test.js +++ b/test/jasmine/tests/ternary_test.js @@ -559,6 +559,177 @@ describe('ternary plots', function() { } }); +describe('ternary plots when css transform is present', function() { + 'use strict'; + + afterEach(destroyGraphDiv); + + var mock = require('@mocks/ternary_simple.json'); + var gd; + + function transformPlot(gd, transformString) { + gd.style.webkitTransform = transformString; + gd.style.MozTransform = transformString; + gd.style.msTransform = transformString; + gd.style.OTransform = transformString; + gd.style.transform = transformString; + } + + var cssTransform = 'translate(-25%, -25%) scale(0.5)'; + var scale = 0.5; + var pointPos = [scale * 391, scale * 219]; + var blankPos = [scale * 200, scale * 200]; + + beforeEach(function(done) { + gd = createGraphDiv(); + + var mockCopy = Lib.extendDeep({}, mock); + + Plotly.plot(gd, mockCopy.data, mockCopy.layout) + .then(function() { transformPlot(gd, cssTransform); }) + .then(done); + }); + + it('should respond zoom drag interactions', function(done) { + function assertRange(gd, expected) { + var ternary = gd._fullLayout.ternary; + var actual = [ + ternary.aaxis.min, + ternary.baxis.min, + ternary.caxis.min + ]; + expect(actual).toBeCloseToArray(expected); + } + + assertRange(gd, [0.231, 0.2, 0.11]); + + drag({path: [[scale * 383, scale * 213], [scale * 293, scale * 243]]}) + .then(function() { assertRange(gd, [0.4486, 0.2480, 0.1453]); }) + .then(function() { return doubleClick(pointPos[0], pointPos[1]); }) + .then(function() { assertRange(gd, [0, 0, 0]); }) + .catch(failTest) + .then(done); + }); + + it('should display to hover labels', function(done) { + mouseEvent('mousemove', blankPos[0], blankPos[1]); + assertHoverLabelContent([null, null], 'only on data points'); + + function check(content, style, msg) { + Lib.clearThrottle(); + mouseEvent('mousemove', pointPos[0], pointPos[1]); + + assertHoverLabelContent({nums: content}, msg); + assertHoverLabelStyle(d3.select('g.hovertext'), style, msg); + } + + check([ + 'Component A: 0.5', + 'B: 0.25', + 'Component C: 0.25' + ].join('\n'), { + bgcolor: 'rgb(31, 119, 180)', + bordercolor: 'rgb(255, 255, 255)', + fontColor: 'rgb(255, 255, 255)', + fontSize: 13, + fontFamily: 'Arial' + }, 'one label per data pt'); + + Plotly.restyle(gd, { + 'hoverlabel.bordercolor': 'blue', + 'hoverlabel.font.family': [['Gravitas', 'Arial', 'Roboto']] + }) + .then(function() { + check([ + 'Component A: 0.5', + 'B: 0.25', + 'Component C: 0.25' + ].join('\n'), { + bgcolor: 'rgb(31, 119, 180)', + bordercolor: 'rgb(0, 0, 255)', + fontColor: 'rgb(0, 0, 255)', + fontSize: 13, + fontFamily: 'Gravitas' + }, 'after hoverlabel styling restyle call'); + + return Plotly.restyle(gd, 'hoverinfo', [['a', 'b+c', 'b']]); + }) + .then(function() { + check('Component A: 0.5', { + bgcolor: 'rgb(31, 119, 180)', + bordercolor: 'rgb(0, 0, 255)', + fontColor: 'rgb(0, 0, 255)', + fontSize: 13, + fontFamily: 'Gravitas' + }, 'after hoverlabel styling restyle call'); + }) + .catch(failTest) + .then(done); + }); + + it('should respond to hover interactions by', function() { + var hoverCnt = 0; + var unhoverCnt = 0; + + var hoverData, unhoverData; + + gd.on('plotly_hover', function(eventData) { + hoverCnt++; + hoverData = eventData.points[0]; + }); + + gd.on('plotly_unhover', function(eventData) { + unhoverCnt++; + unhoverData = eventData.points[0]; + }); + + mouseEvent('mousemove', blankPos[0], blankPos[1]); + expect(hoverData).toBe(undefined, 'not firing on blank points'); + expect(unhoverData).toBe(undefined, 'not firing on blank points'); + + mouseEvent('mousemove', pointPos[0], pointPos[1]); + expect(hoverData).not.toBe(undefined, 'firing on data points'); + expect(Object.keys(hoverData)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', + 'xaxis', 'yaxis', 'a', 'b', 'c' + ], 'returning the correct event data keys'); + expect(hoverData.curveNumber).toEqual(0, 'returning the correct curve number'); + expect(hoverData.pointNumber).toEqual(0, 'returning the correct point number'); + + mouseEvent('mouseout', pointPos[0], pointPos[1]); + expect(unhoverData).not.toBe(undefined, 'firing on data points'); + expect(Object.keys(unhoverData)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', + 'xaxis', 'yaxis', 'a', 'b', 'c' + ], 'returning the correct event data keys'); + expect(unhoverData.curveNumber).toEqual(0, 'returning the correct curve number'); + expect(unhoverData.pointNumber).toEqual(0, 'returning the correct point number'); + + expect(hoverCnt).toEqual(1); + expect(unhoverCnt).toEqual(1); + }); + + it('should respond to click interactions by', function() { + var ptData; + + gd.on('plotly_click', function(eventData) { + ptData = eventData.points[0]; + }); + + click(blankPos[0], blankPos[1]); + expect(ptData).toBe(undefined, 'not firing on blank points'); + + click(pointPos[0], pointPos[1]); + expect(ptData).not.toBe(undefined, 'firing on data points'); + expect(Object.keys(ptData)).toEqual([ + 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', + 'xaxis', 'yaxis', 'a', 'b', 'c' + ], 'returning the correct event data keys'); + expect(ptData.curveNumber).toEqual(0, 'returning the correct curve number'); + expect(ptData.pointNumber).toEqual(0, 'returning the correct point number'); + }); +}); + describe('ternary defaults', function() { 'use strict'; diff --git a/test/jasmine/tests/toimage_test.js b/test/jasmine/tests/toimage_test.js index 5baac3d2445..0f8d649dddc 100644 --- a/test/jasmine/tests/toimage_test.js +++ b/test/jasmine/tests/toimage_test.js @@ -6,6 +6,7 @@ var createGraphDiv = require('../assets/create_graph_div'); var destroyGraphDiv = require('../assets/destroy_graph_div'); var failTest = require('../assets/fail_test'); var subplotMock = require('@mocks/multiple_subplots.json'); +var pieAutoMargin = require('@mocks/pie_automargin'); var FORMATS = ['png', 'jpeg', 'webp', 'svg']; @@ -65,7 +66,7 @@ describe('Plotly.toImage', function() { Plotly.plot(gd, fig.data, fig.layout) .then(function(gd) { expect(function() { Plotly.toImage(gd, {format: 'x'}); }) - .toThrow(new Error('Image format is not jpeg, png, svg or webp.')); + .toThrow(new Error('Export format is not png, jpeg, webp, svg or full-json.')); }) .catch(failTest) .then(done); @@ -301,5 +302,53 @@ describe('Plotly.toImage', function() { .catch(failTest) .then(done); }); + + it('export computed margins', function(done) { + Plotly.toImage(pieAutoMargin, imgOpts) + .then(function(fig) { + fig = JSON.parse(fig); + var computed = fig.layout.computed; + expect(computed).toBeDefined('no computed'); + expect(computed.margin).toBeDefined('no computed margin'); + expect(computed.margin.t).toBeDefined('no top'); + expect(computed.margin.l).toBeDefined('no left'); + expect(computed.margin.r).toBeDefined('no right'); + expect(computed.margin.b).toBeDefined('no bottom'); + }) + .catch(failTest) + .then(done); + }); + + it('record and export computed margins with "Too many auto-margin redraws"', function(done) { + Plotly.toImage({ + data: [{ + x: [ + 'a', + 'b', + 'looooooooooooooooooooooooooooooooooog', + 'd' + ] + }], + layout: { + width: 400, + height: 400, + paper_bgcolor: 'lightblue', + xaxis: { + automargin: true + }, + yaxis: { + automargin: true + } + } + }, imgOpts) + .then(function(fig) { + fig = JSON.parse(fig); + var computed = fig.layout.computed; + expect(computed.margin.b).toBeGreaterThan(80); + expect(computed.margin.r).toBeGreaterThan(80); + }) + .catch(failTest) + .then(done); + }); }); }); diff --git a/test/jasmine/tests/treemap_test.js b/test/jasmine/tests/treemap_test.js index f5788260b2d..52374fc3cc4 100644 --- a/test/jasmine/tests/treemap_test.js +++ b/test/jasmine/tests/treemap_test.js @@ -363,7 +363,7 @@ describe('Test treemap calc:', function() { }); expect(Lib.warn).toHaveBeenCalledTimes(1); - expect(Lib.warn).toHaveBeenCalledWith('Multiple implied roots, cannot build treemap hierarchy.'); + expect(Lib.warn).toHaveBeenCalledWith('Multiple implied roots, cannot build treemap hierarchy of trace 0. These roots include: Root1, Root22'); }); it('should generate "root of roots" when it can', function() { @@ -414,8 +414,8 @@ describe('Test treemap calc:', function() { expect(gd.calcdata[0][0].hierarchy).toBe(undefined, 'no computed hierarchy'); expect(Lib.warn).toHaveBeenCalledTimes(2); - expect(Lib.warn.calls.allArgs()[0][0]).toBe('Total value for node Root is smaller than the sum of its children. \nparent value = 0 \nchildren sum = 3'); - expect(Lib.warn.calls.allArgs()[1][0]).toBe('Total value for node B is smaller than the sum of its children. \nparent value = 2 \nchildren sum = 3'); + expect(Lib.warn.calls.allArgs()[0][0]).toBe('Total value for node Root of trace 0 is smaller than the sum of its children. \nparent value = 0 \nchildren sum = 3'); + expect(Lib.warn.calls.allArgs()[1][0]).toBe('Total value for node B of trace 0 is smaller than the sum of its children. \nparent value = 2 \nchildren sum = 3'); }); it('should warn labels/parents lead to ambiguous hierarchy', function() { @@ -425,7 +425,7 @@ describe('Test treemap calc:', function() { }); expect(Lib.warn).toHaveBeenCalledTimes(1); - expect(Lib.warn).toHaveBeenCalledWith('Failed to build treemap hierarchy. Error: ambiguous: A'); + expect(Lib.warn).toHaveBeenCalledWith('Failed to build treemap hierarchy of trace 0. Error: ambiguous: A'); }); it('should warn ids/parents lead to ambiguous hierarchy', function() { @@ -436,7 +436,7 @@ describe('Test treemap calc:', function() { }); expect(Lib.warn).toHaveBeenCalledTimes(1); - expect(Lib.warn).toHaveBeenCalledWith('Failed to build treemap hierarchy. Error: ambiguous: b'); + expect(Lib.warn).toHaveBeenCalledWith('Failed to build treemap hierarchy of trace 0. Error: ambiguous: b'); }); it('should accept numbers (even `0`) are ids/parents items', function() {